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 |
|---|---|---|---|---|---|
Ruby | Ruby | add support for nested archives | 589c5b4e8dc4fab625868672d138e46290b19ecf | <ide><path>Library/Homebrew/test/unpack_strategy_spec.rb
<ide> end
<ide> end
<ide>
<add>describe UnpackStrategy do
<add> describe "#extract_nestedly" do
<add> let(:file_name) { "file" }
<add> let(:nested_archive) {
<add> dir = mktmpdir
<add>
<add> (dir/"file").write "This file was inside a GZIP inside a BZIP2."
<add> system "gzip", dir.children.first
<add> system "bzip2", dir.children.first
<add>
<add> dir.children.first
<add> }
<add> let(:unpack_dir) { mktmpdir }
<add> subject(:strategy) { described_class.detect(nested_archive) }
<add>
<add> it "can extract nested archives" do
<add> strategy.extract_nestedly(to: unpack_dir)
<add>
<add> expect(File.read(unpack_dir/file_name)).to eq("This file was inside a GZIP inside a BZIP2.")
<add> end
<add> end
<add>end
<add>
<ide> describe UncompressedUnpackStrategy do
<ide> let(:path) {
<ide> (mktmpdir/"test").tap do |path|
<ide><path>Library/Homebrew/unpack_strategy.rb
<ide> def extract(to: nil, basename: nil)
<ide> unpack_dir.mkpath
<ide> extract_to_dir(unpack_dir, basename: basename)
<ide> end
<add>
<add> def extract_nestedly(to: nil, basename: nil)
<add> if is_a?(UncompressedUnpackStrategy)
<add> extract(to: to, basename: basename)
<add> return
<add> end
<add>
<add> Dir.mktmpdir do |tmp_unpack_dir|
<add> tmp_unpack_dir = Pathname(tmp_unpack_dir)
<add>
<add> extract(to: tmp_unpack_dir, basename: basename)
<add>
<add> children = tmp_unpack_dir.children
<add>
<add> if children.count == 1
<add> s = self.class.detect(children.first)
<add>
<add> s.extract_nestedly(to: to, basename: basename)
<add> next
<add> end
<add>
<add> DirectoryUnpackStrategy.new(tmp_unpack_dir).extract(to: to)
<add> end
<add> end
<ide> end
<ide>
<ide> class DirectoryUnpackStrategy < UnpackStrategy
<ide> def self.can_extract?(path:, magic_number:)
<ide> end
<ide> end
<ide>
<del>class XzUnpackStrategy < UncompressedUnpackStrategy
<add>class XzUnpackStrategy < UnpackStrategy
<ide> def self.can_extract?(path:, magic_number:)
<ide> magic_number.match?(/\A\xFD7zXZ\x00/n)
<ide> end
<ide> def extract_nested_tar(unpack_dir, basename:)
<ide> end
<ide> end
<ide>
<del>class Bzip2UnpackStrategy < UncompressedUnpackStrategy
<add>class Bzip2UnpackStrategy < UnpackStrategy
<ide> def self.can_extract?(path:, magic_number:)
<ide> magic_number.match?(/\ABZh/n)
<ide> end
<ide>
<ide> private
<ide>
<ide> def extract_to_dir(unpack_dir, basename:)
<del> super
<add> FileUtils.cp path, unpack_dir/basename, preserve: true
<ide> safe_system "bunzip2", "-q", unpack_dir/basename
<ide> end
<ide> end
<ide>
<del>class GzipUnpackStrategy < UncompressedUnpackStrategy
<add>class GzipUnpackStrategy < UnpackStrategy
<ide> def self.can_extract?(path:, magic_number:)
<ide> magic_number.match?(/\A\037\213/n)
<ide> end
<ide>
<ide> private
<ide>
<ide> def extract_to_dir(unpack_dir, basename:)
<del> super
<add> FileUtils.cp path, unpack_dir/basename, preserve: true
<ide> safe_system "gunzip", "-q", "-N", unpack_dir/basename
<ide> end
<ide> end
<ide>
<del>class LzipUnpackStrategy < UncompressedUnpackStrategy
<add>class LzipUnpackStrategy < UnpackStrategy
<ide> def self.can_extract?(path:, magic_number:)
<ide> magic_number.match?(/\ALZIP/n)
<ide> end
<ide>
<ide> private
<ide>
<ide> def extract_to_dir(unpack_dir, basename:)
<del> super
<add> FileUtils.cp path, unpack_dir/basename, preserve: true
<ide> safe_system Formula["lzip"].opt_bin/"lzip", "-d", "-q", unpack_dir/basename
<ide> end
<ide> end | 2 |
Javascript | Javascript | update webgltextures for gl.rgb | 89c1738ac98a96bfdfdb299c5ec85f464a6a8889 | <ide><path>src/renderers/webgl/WebGLTextures.js
<ide> function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
<ide>
<ide> if ( ! _isWebGL2 ) return glFormat;
<ide>
<del> if ( glFormat === _gl.RGBA && glType === _gl.FLOAT ) return _gl.RGBA32F;
<del> if ( glFormat === _gl.RGBA && glType === _gl.HALF_FLOAT ) return _gl.RGBA16F;
<add> if ( glFormat === _gl.RGB || glFormat === _gl.RGBA ) {
<add>
<add> if ( glType === _gl.FLOAT ) return _gl.RGBA32F;
<add> if ( glType === _gl.HALF_FLOAT ) return _gl.RGBA16F;
<add>
<add> }
<ide>
<ide> return glFormat;
<ide> | 1 |
Javascript | Javascript | use cff compiler for building type1 font | a235ec1441716a51eb540e855a02e7f6d82916d7 | <ide><path>src/fonts.js
<ide> var Type1Font = function Type1Font(name, file, properties) {
<ide> };
<ide>
<ide> Type1Font.prototype = {
<del> createCFFIndexHeader: function Type1Font_createCFFIndexHeader(objects,
<del> isByte) {
<del> // First 2 bytes contains the number of objects contained into this index
<del> var count = objects.length;
<del>
<del> // If there is no object, just create an array saying that with another
<del> // offset byte.
<del> if (count == 0)
<del> return '\x00\x00\x00';
<del>
<del> var data = String.fromCharCode((count >> 8) & 0xFF, count & 0xff);
<del>
<del> // Next byte contains the offset size use to reference object in the file
<del> // Actually we're using 0x04 to be sure to be able to store everything
<del> // without thinking of it while coding.
<del> data += '\x04';
<del>
<del> // Add another offset after this one because we need a new offset
<del> var relativeOffset = 1;
<del> for (var i = 0; i < count + 1; i++) {
<del> data += String.fromCharCode((relativeOffset >>> 24) & 0xFF,
<del> (relativeOffset >> 16) & 0xFF,
<del> (relativeOffset >> 8) & 0xFF,
<del> relativeOffset & 0xFF);
<del>
<del> if (objects[i])
<del> relativeOffset += objects[i].length;
<del> }
<del>
<del> for (var i = 0; i < count; i++) {
<del> for (var j = 0, jj = objects[i].length; j < jj; j++)
<del> data += isByte ? String.fromCharCode(objects[i][j] & 0xFF) :
<del> objects[i][j];
<del> }
<del> return data;
<del> },
<del>
<del> encodeNumber: function Type1Font_encodeNumber(value) {
<del> // some of the fonts has ouf-of-range values
<del> // they are just arithmetic overflows
<del> // make sanitizer happy
<del> value |= 0;
<del> if (value >= -32768 && value <= 32767) {
<del> return '\x1c' +
<del> String.fromCharCode((value >> 8) & 0xFF) +
<del> String.fromCharCode(value & 0xFF);
<del> } else {
<del> return '\x1d' +
<del> String.fromCharCode((value >> 24) & 0xFF) +
<del> String.fromCharCode((value >> 16) & 0xFF) +
<del> String.fromCharCode((value >> 8) & 0xFF) +
<del> String.fromCharCode(value & 0xFF);
<del> }
<del> },
<del>
<ide> getOrderedCharStrings: function Type1Font_getOrderedCharStrings(glyphs,
<ide> properties) {
<ide> var charstrings = [];
<ide> Type1Font.prototype = {
<ide> if (command > 32000) {
<ide> var divisor = charstring[i + 1];
<ide> command /= divisor;
<del> charstring.splice(i, 3, 28, command >> 8, command & 0xff);
<add> charstring.splice(i, 3, 28, (command >> 8) & 0xff, command & 0xff);
<ide> } else {
<del> charstring.splice(i, 1, 28, command >> 8, command & 0xff);
<add> charstring.splice(i, 1, 28, (command >> 8) & 0xff, command & 0xff);
<ide> }
<ide> i += 2;
<ide> }
<ide> Type1Font.prototype = {
<ide> },
<ide>
<ide> wrap: function Type1Font_wrap(name, glyphs, charstrings, subrs, properties) {
<del> var comp = new CFFCompiler();
<del> // TODO: remove this function after refactoring wrap to use the CFFCompiler.
<del> function encodeNumber(num) {
<del> var val = comp.encodeNumber(num);
<del> var ret = '';
<del> for (var i = 0; i < val.length; i++) {
<del> ret += String.fromCharCode(val[i]);
<del> }
<del> return ret;
<add> var cff = new CFF();
<add> cff.header = new CFFHeader(1, 0, 4, 4);
<add>
<add> cff.names = [name];
<add>
<add> var topDict = new CFFTopDict();
<add> topDict.setByName('version', 0);
<add> topDict.setByName('Notice', 1);
<add> topDict.setByName('FullName', 2);
<add> topDict.setByName('FamilyName', 3);
<add> topDict.setByName('Weight', 4);
<add> topDict.setByName('Encoding', null); // placeholder
<add> topDict.setByName('FontBBox', properties.bbox);
<add> topDict.setByName('charset', null); // placeholder
<add> topDict.setByName('CharStrings', null); // placeholder
<add> topDict.setByName('Private', null); // placeholder
<add> cff.topDict = topDict;
<add>
<add> var strings = new CFFStrings();
<add> strings.add('Version 0.11'); // Version
<add> strings.add('See original notice'); // Notice
<add> strings.add(name); // FullName
<add> strings.add(name); // FamilyName
<add> strings.add('Medium'); // Weight
<add> cff.strings = strings;
<add>
<add> cff.globalSubrIndex = new CFFIndex();
<add>
<add> var count = glyphs.length;
<add> var charsetArray = [0];
<add> for (var i = 0; i < count; i++) {
<add> var index = CFFStandardStrings.indexOf(charstrings[i].glyph);
<add> // Some characters like asterikmath && circlecopyrt are
<add> // missing from the original strings, for the moment let's
<add> // map them to .notdef and see later if it cause any
<add> // problems
<add> if (index == -1)
<add> index = 0;
<add>
<add> charsetArray.push((index >> 8) & 0xff, index & 0xff);
<ide> }
<add> cff.charset = new CFFCharset(false, 0, [], charsetArray);
<ide>
<del> var fields = {
<del> // major version, minor version, header size, offset size
<del> 'header': '\x01\x00\x04\x04',
<del>
<del> 'names': this.createCFFIndexHeader([name]),
<del>
<del> 'topDict': (function topDict(self) {
<del> return function cffWrapTopDict() {
<del> var header = '\x00\x01\x01\x01';
<del> var dict =
<del> '\xf8\x1b\x00' + // version
<del> '\xf8\x1c\x01' + // Notice
<del> '\xf8\x1d\x02' + // FullName
<del> '\xf8\x1e\x03' + // FamilyName
<del> '\xf8\x1f\x04' + // Weight
<del> '\x1c\x00\x00\x10'; // Encoding
<del>
<del> var boundingBox = properties.bbox;
<del> for (var i = 0, ii = boundingBox.length; i < ii; i++)
<del> dict += encodeNumber(boundingBox[i]);
<del> dict += '\x05'; // FontBBox;
<del>
<del> var offset = fields.header.length +
<del> fields.names.length +
<del> (header.length + 1) +
<del> (dict.length + (4 + 4)) +
<del> fields.strings.length +
<del> fields.globalSubrs.length;
<del>
<del> // If the offset if over 32767, encodeNumber is going to return
<del> // 5 bytes to encode the position instead of 3.
<del> if ((offset + fields.charstrings.length) > 32767) {
<del> offset += 9;
<del> } else {
<del> offset += 7;
<del> }
<del>
<del> dict += self.encodeNumber(offset) + '\x0f'; // Charset
<del>
<del> offset = offset + (glyphs.length * 2) + 1;
<del> dict += self.encodeNumber(offset) + '\x11'; // Charstrings
<del>
<del> offset = offset + fields.charstrings.length;
<del> dict += self.encodeNumber(fields.privateData.length);
<del> dict += self.encodeNumber(offset) + '\x12'; // Private
<del>
<del> return header + String.fromCharCode(dict.length + 1) + dict;
<del> };
<del> })(this),
<del>
<del> 'strings': (function strings(self) {
<del> var strings = [
<del> 'Version 0.11', // Version
<del> 'See original notice', // Notice
<del> name, // FullName
<del> name, // FamilyName
<del> 'Medium' // Weight
<del> ];
<del> return self.createCFFIndexHeader(strings);
<del> })(this),
<del>
<del> 'globalSubrs': this.createCFFIndexHeader([]),
<del>
<del> 'charset': (function charset(self) {
<del> var charsetString = '\x00'; // Encoding
<del>
<del> var count = glyphs.length;
<del> for (var i = 0; i < count; i++) {
<del> var index = CFFStandardStrings.indexOf(charstrings[i].glyph);
<del> // Some characters like asterikmath && circlecopyrt are
<del> // missing from the original strings, for the moment let's
<del> // map them to .notdef and see later if it cause any
<del> // problems
<del> if (index == -1)
<del> index = 0;
<del>
<del> charsetString += String.fromCharCode(index >> 8, index & 0xff);
<del> }
<del> return charsetString;
<del> })(this),
<del>
<del> 'charstrings': this.createCFFIndexHeader([[0x8B, 0x0E]].concat(glyphs),
<del> true),
<del>
<del> 'privateData': (function cffWrapPrivate(self) {
<del> var data =
<del> '\x8b\x14' + // defaultWidth
<del> '\x8b\x15'; // nominalWidth
<del> var fieldMap = {
<del> BlueValues: '\x06',
<del> OtherBlues: '\x07',
<del> FamilyBlues: '\x08',
<del> FamilyOtherBlues: '\x09',
<del> StemSnapH: '\x0c\x0c',
<del> StemSnapV: '\x0c\x0d',
<del> BlueShift: '\x0c\x0a',
<del> BlueFuzz: '\x0c\x0b',
<del> BlueScale: '\x0c\x09',
<del> LanguageGroup: '\x0c\x11',
<del> ExpansionFactor: '\x0c\x12'
<del> };
<del> for (var field in fieldMap) {
<del> if (!properties.privateData.hasOwnProperty(field))
<del> continue;
<del> var value = properties.privateData[field];
<del>
<del> if (isArray(value)) {
<del> for (var i = 0, ii = value.length; i < ii; i++)
<del> data += encodeNumber(value[i]);
<del> } else {
<del> data += encodeNumber(value);
<del> }
<del> data += fieldMap[field];
<del> }
<del>
<del> data += self.encodeNumber(data.length + 4) + '\x13'; // Subrs offset
<del>
<del> return data;
<del> })(this),
<del>
<del> 'localSubrs': this.createCFFIndexHeader(subrs, true)
<del> };
<del> fields.topDict = fields.topDict();
<del>
<add> var charStringsIndex = new CFFIndex();
<add> charStringsIndex.add([0x8B, 0x0E]); // .notdef
<add> for (var i = 0; i < count; i++) {
<add> charStringsIndex.add(glyphs[i]);
<add> }
<add> cff.charStrings = charStringsIndex;
<add>
<add> var privateDict = new CFFPrivateDict();
<add> privateDict.setByName('Subrs', null); // placeholder
<add> var fields = [
<add> // TODO: missing StdHW, StdVW, ForceBold
<add> 'BlueValues',
<add> 'OtherBlues',
<add> 'FamilyBlues',
<add> 'FamilyOtherBlues',
<add> 'StemSnapH',
<add> 'StemSnapV',
<add> 'BlueShift',
<add> 'BlueFuzz',
<add> 'BlueScale',
<add> 'LanguageGroup',
<add> 'ExpansionFactor'
<add> ];
<add> for (var i = 0, ii = fields.length; i < ii; i++) {
<add> var field = fields[i];
<add> if (!properties.privateData.hasOwnProperty(field))
<add> continue;
<add> privateDict.setByName(field, properties.privateData[field]);
<add> }
<add> cff.topDict.privateDict = privateDict;
<ide>
<del> var cff = [];
<del> for (var index in fields) {
<del> var field = fields[index];
<del> for (var i = 0, ii = field.length; i < ii; i++)
<del> cff.push(field.charCodeAt(i));
<add> var subrIndex = new CFFIndex();
<add> for (var i = 0, ii = subrs.length; i < ii; i++) {
<add> subrIndex.add(subrs[i]);
<ide> }
<add> privateDict.subrsIndex = subrIndex;
<ide>
<del> return cff;
<add> var compiler = new CFFCompiler(cff);
<add> return compiler.compile();
<ide> }
<ide> };
<ide>
<ide> var CFFDict = (function CFFDictClosure() {
<ide> this.values[key] = value;
<ide> return true;
<ide> },
<add> setByName: function CFFDict_setByName(name, value) {
<add> if (!(name in this.nameToKeyMap)) {
<add> error('Invalid dictionary name "' + name + '"');
<add> }
<add> this.values[this.nameToKeyMap[name]] = value;
<add> },
<ide> hasName: function CFFDict_hasName(name) {
<ide> return this.nameToKeyMap[name] in this.values;
<ide> }, | 1 |
PHP | PHP | fix behavior of oneachside = 1 with paginator | c59cffa7825498e1d419d8c86cd8527520f718cb | <ide><path>src/Illuminate/Pagination/UrlWindow.php
<ide> protected function getSmallSlider()
<ide> */
<ide> protected function getUrlSlider($onEachSide)
<ide> {
<del> $window = $onEachSide * 2;
<add> $window = $onEachSide + 4;
<ide>
<ide> if (! $this->hasPages()) {
<ide> return ['first' => null, 'slider' => null, 'last' => null];
<ide> protected function getUrlSlider($onEachSide)
<ide> // just render the beginning of the page range, followed by the last 2 of the
<ide> // links in this list, since we will not have room to create a full slider.
<ide> if ($this->currentPage() <= $window) {
<del> return $this->getSliderTooCloseToBeginning($window);
<add> return $this->getSliderTooCloseToBeginning($window, $onEachSide);
<ide> }
<ide>
<ide> // If the current page is close to the ending of the page range we will just get
<ide> // this first couple pages, followed by a larger window of these ending pages
<ide> // since we're too close to the end of the list to create a full on slider.
<ide> elseif ($this->currentPage() > ($this->lastPage() - $window)) {
<del> return $this->getSliderTooCloseToEnding($window);
<add> return $this->getSliderTooCloseToEnding($window, $onEachSide);
<ide> }
<ide>
<ide> // If we have enough room on both sides of the current page to build a slider we
<ide> protected function getUrlSlider($onEachSide)
<ide> * Get the slider of URLs when too close to beginning of window.
<ide> *
<ide> * @param int $window
<add> * @param int $onEachSide
<ide> * @return array
<ide> */
<del> protected function getSliderTooCloseToBeginning($window)
<add> protected function getSliderTooCloseToBeginning($window, $onEachSide)
<ide> {
<ide> return [
<del> 'first' => $this->paginator->getUrlRange(1, $window + 2),
<add> 'first' => $this->paginator->getUrlRange(1, $window + $onEachSide),
<ide> 'slider' => null,
<ide> 'last' => $this->getFinish(),
<ide> ];
<ide> protected function getSliderTooCloseToBeginning($window)
<ide> * Get the slider of URLs when too close to ending of window.
<ide> *
<ide> * @param int $window
<add> * @param int $onEachSide
<ide> * @return array
<ide> */
<del> protected function getSliderTooCloseToEnding($window)
<add> protected function getSliderTooCloseToEnding($window, $onEachSide)
<ide> {
<ide> $last = $this->paginator->getUrlRange(
<del> $this->lastPage() - ($window + 2),
<add> $this->lastPage() - ($window + ($onEachSide - 1)),
<ide> $this->lastPage()
<ide> );
<ide>
<ide><path>tests/Pagination/UrlWindowTest.php
<ide> public function testPresenterCanGetAUrlRangeForASmallNumberOfUrls()
<ide> public function testPresenterCanGetAUrlRangeForAWindowOfLinks()
<ide> {
<ide> $array = [];
<del> for ($i = 1; $i <= 13; $i++) {
<add> for ($i = 1; $i <= 20; $i++) {
<ide> $array[$i] = 'item'.$i;
<ide> }
<del> $p = new LengthAwarePaginator($array, count($array), 1, 7);
<add> $p = new LengthAwarePaginator($array, count($array), 1, 12);
<ide> $window = new UrlWindow($p);
<ide> $slider = [];
<del> for ($i = 4; $i <= 10; $i++) {
<add> for ($i = 9; $i <= 15; $i++) {
<ide> $slider[$i] = '/?page='.$i;
<ide> }
<ide>
<del> $this->assertEquals(['first' => [1 => '/?page=1', 2 => '/?page=2'], 'slider' => $slider, 'last' => [12 => '/?page=12', 13 => '/?page=13']], $window->get());
<add> $this->assertEquals(['first' => [1 => '/?page=1', 2 => '/?page=2'], 'slider' => $slider, 'last' => [19 => '/?page=19', 20 => '/?page=20']], $window->get());
<ide>
<ide> /*
<ide> * Test Being Near The End Of The List
<ide> */
<del> $p = new LengthAwarePaginator($array, count($array), 1, 8);
<add> $array = [];
<add> for ($i = 1; $i <= 13; $i++) {
<add> $array[$i] = 'item'.$i;
<add> }
<add> $p = new LengthAwarePaginator($array, count($array), 1, 10);
<ide> $window = new UrlWindow($p);
<ide> $last = [];
<del> for ($i = 5; $i <= 13; $i++) {
<add> for ($i = 4; $i <= 13; $i++) {
<ide> $last[$i] = '/?page='.$i;
<ide> }
<del>
<ide> $this->assertEquals(['first' => [1 => '/?page=1', 2 => '/?page=2'], 'slider' => null, 'last' => $last], $window->get());
<ide> }
<ide> | 2 |
Javascript | Javascript | add babel-node to seed | 9d12d868921797c87d4c626fde72252cebf760c6 | <ide><path>index.js
<ide> /* eslint-disable no-process-exit */
<add>require('babel/register');
<ide> require('dotenv').load();
<ide> var fs = require('fs'),
<ide> path = require('path'), | 1 |
PHP | PHP | add failing test for lazycollection@until | 4e43bddd60752cfe509c6be08967c85c26639474 | <ide><path>tests/Support/SupportLazyCollectionIsLazyTest.php
<ide> public function testUnlessNotEmptyIsLazy()
<ide> });
<ide> }
<ide>
<add> public function testUntilIsLazy()
<add> {
<add> $this->assertDoesNotEnumerate(function ($collection) {
<add> $collection->until(INF);
<add> });
<add>
<add> $this->assertEnumerates(10, function ($collection) {
<add> $collection->until(10)->all();
<add> });
<add>
<add> $this->assertEnumerates(10, function ($collection) {
<add> $collection->until(function ($item) {
<add> return $item === 10;
<add> })->all();
<add> });
<add> }
<add>
<ide> public function testUnwrapEnumeratesOne()
<ide> {
<ide> $this->assertEnumeratesOnce(function ($collection) { | 1 |
Text | Text | add changelog entry | 8f05fee1ff26247d6fec8f06f711a60a3c4e48fc | <ide><path>railties/CHANGELOG.md
<ide> ## Rails 4.0.0 (unreleased) ##
<ide>
<add>* `Rails.version` now returns an instance of `Gem::Version`
<add>
<add> *Charlie Somerville*
<add>
<ide> * Don't generate a scaffold.css when --no-assets is specified
<ide>
<ide> *Kevin Glowacz* | 1 |
Javascript | Javascript | fix coding style in test/unit/testreporter.js | 2bd81786c238477388c6f041af913b9e894b1798 | <ide><path>test/unit/testreporter.js
<ide> var TestReporter = function(browser, appPath) {
<ide> r.onreadystatechange = function sendTaskResultOnreadystatechange(e) {
<ide> if (r.readyState == 4) {
<ide> // Retry until successful
<del> if (r.status !== 200)
<add> if (r.status !== 200) {
<ide> send(action, json);
<add> }
<ide> }
<ide> };
<ide> json['browser'] = browser;
<ide> var TestReporter = function(browser, appPath) {
<ide> status: status,
<ide> description: description
<ide> };
<del> if (typeof error !== 'undefined')
<add> if (typeof error !== 'undefined') {
<ide> message['error'] = error;
<add> }
<ide> send('/submit_task_results', message);
<ide> }
<ide>
<ide> var TestReporter = function(browser, appPath) {
<ide> } else {
<ide> var failedMessages = '';
<ide> var items = results.getItems();
<del> for (var i = 0, ii = items.length; i < ii; i++)
<del> if (!items[i].passed())
<add> for (var i = 0, ii = items.length; i < ii; i++) {
<add> if (!items[i].passed()) {
<ide> failedMessages += items[i].message + ' ';
<add> }
<add> }
<ide> sendResult('TEST-UNEXPECTED-FAIL', results.description, failedMessages);
<ide> }
<ide> }; | 1 |
Ruby | Ruby | handle double pluralization for irregular plurals | 1754bd9b208e8d9207c226d1ffb3cee490856a78 | <ide><path>activesupport/lib/active_support/inflections.rb
<ide> module ActiveSupport
<ide> inflect.plural(/s$/i, 's')
<ide> inflect.plural(/(ax|test)is$/i, '\1es')
<ide> inflect.plural(/(octop|vir)us$/i, '\1i')
<add> inflect.plural(/(octop|vir)i$/i, '\1i')
<ide> inflect.plural(/(alias|status)$/i, '\1es')
<ide> inflect.plural(/(bu)s$/i, '\1ses')
<ide> inflect.plural(/(buffal|tomat)o$/i, '\1oes')
<ide> inflect.plural(/([ti])um$/i, '\1a')
<add> inflect.plural(/([ti])a$/i, '\1a')
<ide> inflect.plural(/sis$/i, 'ses')
<ide> inflect.plural(/(?:([^f])fe|([lr])f)$/i, '\1\2ves')
<ide> inflect.plural(/(hive)$/i, '\1s')
<ide> inflect.plural(/([^aeiouy]|qu)y$/i, '\1ies')
<ide> inflect.plural(/(x|ch|ss|sh)$/i, '\1es')
<ide> inflect.plural(/(matr|vert|ind)(?:ix|ex)$/i, '\1ices')
<ide> inflect.plural(/([m|l])ouse$/i, '\1ice')
<add> inflect.plural(/([m|l])ice$/i, '\1ice')
<ide> inflect.plural(/^(ox)$/i, '\1en')
<add> inflect.plural(/^(oxen)$/i, '\1')
<ide> inflect.plural(/(quiz)$/i, '\1zes')
<ide>
<ide> inflect.singular(/s$/i, '')
<ide><path>activesupport/test/inflector_test.rb
<ide> def test_uncountable_word_is_not_greedy
<ide> assert_equal(singular.capitalize, ActiveSupport::Inflector.singularize(plural.capitalize))
<ide> end
<ide> end
<add>
<add> SingularToPlural.each do |singular, plural|
<add> define_method "test_pluralize_#{plural}" do
<add> assert_equal(plural, ActiveSupport::Inflector.pluralize(plural))
<add> assert_equal(plural.capitalize, ActiveSupport::Inflector.pluralize(plural.capitalize))
<add> end
<add> end
<ide>
<ide> def test_overwrite_previous_inflectors
<ide> assert_equal("series", ActiveSupport::Inflector.singularize("series"))
<ide><path>activesupport/test/inflector_test_cases.rb
<ide> module InflectorTestCases
<ide>
<ide> "datum" => "data",
<ide> "medium" => "media",
<add> "stadium" => "stadia",
<ide> "analysis" => "analyses",
<ide>
<ide> "node_child" => "node_children", | 3 |
Python | Python | remove dead code from spacy._ml | f6fef30adc217ed84dc658bc849cdee039663750 | <ide><path>spacy/_ml.py
<ide> def reapply_bwd(dY, sgd=None):
<ide> return wrap(reapply_fwd, layer)
<ide>
<ide>
<del>
<del>
<ide> def asarray(ops, dtype):
<ide> def forward(X, drop=0.):
<ide> return ops.asarray(X, dtype=dtype), None
<ide> return layerize(forward)
<ide>
<ide>
<del>def foreach(layer):
<del> def forward(Xs, drop=0.):
<del> results = []
<del> backprops = []
<del> for X in Xs:
<del> result, bp = layer.begin_update(X, drop=drop)
<del> results.append(result)
<del> backprops.append(bp)
<del> def backward(d_results, sgd=None):
<del> dXs = []
<del> for d_result, backprop in zip(d_results, backprops):
<del> dXs.append(backprop(d_result, sgd))
<del> return dXs
<del> return results, backward
<del> model = layerize(forward)
<del> model._layers.append(layer)
<del> return model
<del>
<del>
<del>def rebatch(size, layer):
<del> ops = layer.ops
<del> def forward(X, drop=0.):
<del> if X.shape[0] < size:
<del> return layer.begin_update(X)
<del> parts = _divide_array(X, size)
<del> results, bp_results = zip(*[layer.begin_update(p, drop=drop)
<del> for p in parts])
<del> y = ops.flatten(results)
<del> def backward(dy, sgd=None):
<del> d_parts = [bp(y, sgd=sgd) for bp, y in
<del> zip(bp_results, _divide_array(dy, size))]
<del> try:
<del> dX = ops.flatten(d_parts)
<del> except TypeError:
<del> dX = None
<del> except ValueError:
<del> dX = None
<del> return dX
<del> return y, backward
<del> model = layerize(forward)
<del> model._layers.append(layer)
<del> return model
<del>
<del>
<ide> def _divide_array(X, size):
<ide> parts = []
<ide> index = 0
<ide> def preprocess_doc(docs, drop=0.):
<ide> vals = ops.allocate(keys.shape[0]) + 1
<ide> return (keys, vals, lengths), None
<ide>
<add>
<ide> def getitem(i):
<ide> def getitem_fwd(X, drop=0.):
<ide> return X[i], None
<ide> return layerize(getitem_fwd)
<ide>
<add>
<ide> def build_tagger_model(nr_class, **cfg):
<ide> embed_size = util.env_opt('embed_size', 7000)
<ide> if 'token_vector_width' in cfg:
<ide> def SpacyVectors(docs, drop=0.):
<ide> return batch, None
<ide>
<ide>
<del>def foreach(layer, drop_factor=1.0):
<del> '''Map a layer across elements in a list'''
<del> def foreach_fwd(Xs, drop=0.):
<del> drop *= drop_factor
<del> ys = []
<del> backprops = []
<del> for X in Xs:
<del> y, bp_y = layer.begin_update(X, drop=drop)
<del> ys.append(y)
<del> backprops.append(bp_y)
<del> def foreach_bwd(d_ys, sgd=None):
<del> d_Xs = []
<del> for d_y, bp_y in zip(d_ys, backprops):
<del> if bp_y is not None and bp_y is not None:
<del> d_Xs.append(d_y, sgd=sgd)
<del> else:
<del> d_Xs.append(None)
<del> return d_Xs
<del> return ys, foreach_bwd
<del> model = wrap(foreach_fwd, layer)
<del> return model
<del>
<del>
<ide> def build_text_classifier(nr_class, width=64, **cfg):
<ide> nr_vector = cfg.get('nr_vector', 5000)
<ide> pretrained_dims = cfg.get('pretrained_dims', 0) | 1 |
Python | Python | add a test case for ninefold loadbalancer driver | 4e48b4587d8af6cce0cc083db10287c8a9f933e3 | <ide><path>libcloud/test/loadbalancer/test_ninefold.py
<add>import sys
<add>import unittest
<add>
<add>from libcloud.loadbalancer.types import Provider
<add>from libcloud.loadbalancer.providers import get_driver
<add>
<add>
<add>class NinefoldLbTestCase(unittest.TestCase):
<add> def test_driver_instantiation(self):
<add> cls = get_driver(Provider.NINEFOLD)
<add> cls('username', 'key')
<add>
<add>
<add>if __name__ == '__main__':
<add> sys.exit(unittest.main()) | 1 |
Text | Text | add openssl cve fix to notable changes in v15.5.0 | 81442fa9fdc900e4b7058b142dfbdd268d2dbd6a | <ide><path>doc/changelogs/CHANGELOG_V15.md
<ide> Vulnerabilities fixed:
<ide>
<ide> ### Notable Changes
<ide>
<add>#### OpenSSL-1.1.1i
<add>
<add>OpenSSL-1.1.1i contains a fix for CVE-2020-1971: OpenSSL - EDIPARTYNAME NULL pointer de-reference (High). This is a vulnerability in OpenSSL which may be exploited through Node.js. You can read more about it in https://www.openssl.org/news/secadv/20201208.txt
<add>
<add>Contributed by Myles Borins [#36520](https://github.com/nodejs/node/pull/36520).
<add>
<ide> #### Extended support for `AbortSignal` in child_process and stream
<ide>
<ide> The following APIs now support an `AbortSignal` in their options object: | 1 |
Text | Text | add tip style to style entry | dc24bb63d6cad6266cc2718bd077ba25f34e1842 | <ide><path>docs/cookbook/cb-02-inline-styles.md
<ide> permalink: inline-styles.html
<ide> script: "cookbook/inline-styles.js"
<ide> ---
<ide>
<add>## Q&A format
<add>
<ide> ### Problem
<del>You want to apply inline style to an element.
<add>You want to put inline style to an element.
<ide>
<ide> ### Solution
<ide> Instead of writing a string, create an object whose key is the camelCased version of the style name, and whose value is the style's value, in string:
<ide>
<del><div id="examples">
<del> <div class="example">
<del> <div id="inlineStylesExample"></div>
<del> </div>
<del></div>
<add>```html
<add>/** @jsx React.DOM */
<add>
<add>var divStyle = {
<add> color: 'white',
<add> backgroundColor: 'lightblue',
<add> WebkitTransition: 'all' // note the capital 'W' here
<add>};
<add>
<add>React.renderComponent(<div style={divStyle}>Hello World!</div>, mountNode);
<add>```
<ide>
<ide> ### Discussion
<del>Style keys are camelCased in order to be consistent with accessing the properties using `node.style.___` in DOM. This also explains why `WebkitTransition` has an uppercase 'W'.
<ide>\ No newline at end of file
<add>Style keys are camelCased in order to be consistent with accessing the properties using `node.style.___` in DOM. This also explains why `WebkitTransition` has an uppercase 'W'.
<add>
<add>## Tips format
<add>
<add>In React, inline styles are nto specified as a string, but as an object whose key is the camelCased version of the style name, and whose value is the style's value in string:
<add>
<add>```html
<add>/** @jsx React.DOM */
<add>
<add>var divStyle = {
<add> color: 'white',
<add> backgroundColor: 'lightblue',
<add> WebkitTransition: 'all' // note the capital 'W' here
<add>};
<add>
<add>React.renderComponent(<div style={divStyle}>Hello World!</div>, mountNode);
<add>```
<add>
<add>Style keys are camelCased in order to be consistent with accessing the properties using node.style.___ in DOM. This also explains why WebkitTransition has an uppercase 'W'. | 1 |
Javascript | Javascript | allow multiple values for same config | 43fa0a884765752e18bf70f4be13cc721ee866de | <ide><path>benchmark/common.js
<ide> function Benchmark(fn, configs, options) {
<ide> }
<ide>
<ide> Benchmark.prototype._parseArgs = function(argv, configs) {
<del> const cliOptions = Object.assign({}, configs);
<add> const cliOptions = {};
<ide> const extraOptions = {};
<ide> // Parse configuration arguments
<ide> for (const arg of argv) {
<ide> Benchmark.prototype._parseArgs = function(argv, configs) {
<ide> console.error('bad argument: ' + arg);
<ide> process.exit(1);
<ide> }
<add> const config = match[1];
<ide>
<del> if (configs[match[1]]) {
<add> if (configs[config]) {
<ide> // Infer the type from the config object and parse accordingly
<del> const isNumber = typeof configs[match[1]][0] === 'number';
<add> const isNumber = typeof configs[config][0] === 'number';
<ide> const value = isNumber ? +match[2] : match[2];
<del> cliOptions[match[1]] = [value];
<add> if (!cliOptions[config])
<add> cliOptions[config] = [];
<add> cliOptions[config].push(value);
<ide> } else {
<del> extraOptions[match[1]] = match[2];
<add> extraOptions[config] = match[2];
<ide> }
<ide> }
<del> return { cli: cliOptions, extra: extraOptions };
<add> return { cli: Object.assign({}, configs, cliOptions), extra: extraOptions };
<ide> };
<ide>
<ide> Benchmark.prototype._queue = function(options) { | 1 |
Text | Text | correct document page of html page | 6bef39b0f1fa0c014ba6dd4474b93972468019db | <ide><path>laravel/documentation/views/html.md
<ide> For example, the < symbol should be converted to its entity representation. Conv
<ide>
<ide> #### Generating a reference to a CSS file using a given media type:
<ide>
<del> echo HTML::style('css/common.css', 'print');
<add> echo HTML::style('css/common.css', array('media' => 'print'));
<ide>
<ide> *Further Reading:*
<ide>
<ide> For example, the < symbol should be converted to its entity representation. Conv
<ide>
<ide> #### Generating a link that should use HTTPS:
<ide>
<del> echo HTML::secure_link('user/profile', 'User Profile');
<add> echo HTML::link_to_secure('user/profile', 'User Profile');
<ide>
<ide> #### Generating a link and specifying extra HTML attributes:
<ide>
<ide> The "mailto" method on the HTML class obfuscates the given e-mail address so it
<ide> echo HTML::ol(array('Get Peanut Butter', 'Get Chocolate', 'Feast'));
<ide>
<ide> echo HTML::ul(array('Ubuntu', 'Snow Leopard', 'Windows'));
<del>
<add>
<ide> echo HTML::dl(array('Ubuntu' => 'An operating system by Canonical', 'Windows' => 'An operating system by Microsoft'));
<ide>
<ide> <a name="custom-macros"></a> | 1 |
Ruby | Ruby | convert some multiline code into a single line | 7ffeba6380035e190efdf7eb7a003dd51e356cea | <ide><path>Library/Homebrew/livecheck/livecheck.rb
<ide> def resource_version(
<ide> livecheck_strategy = livecheck.strategy
<ide> livecheck_strategy_block = livecheck.strategy_block
<ide>
<del> livecheck_url_string = livecheck_url_to_string(
<del> livecheck_url,
<del> resource,
<del> )
<add> livecheck_url_string = livecheck_url_to_string(livecheck_url, resource)
<ide>
<ide> urls = [livecheck_url_string] if livecheck_url_string
<ide> urls ||= checkable_urls(resource)
<ide> def resource_version(
<ide>
<ide> resource_version_info[:meta] = { livecheckable: has_livecheckable, url: {} }
<ide> if livecheck_url.is_a?(Symbol) && livecheck_url_string
<del> resource_version_info[:meta][:url][:symbol] =
<del> livecheck_url
<add> resource_version_info[:meta][:url][:symbol] = livecheck_url
<ide> end
<ide> resource_version_info[:meta][:url][:original] = original_url
<ide> resource_version_info[:meta][:url][:processed] = url if url != original_url | 1 |
Javascript | Javascript | fix double-exit on nested domains | 80472bc301234d9dc4142e62bbffc4300fffdd83 | <ide><path>src/node.js
<ide> // The domain error handler threw! oh no!
<ide> // See if another domain can catch THIS error,
<ide> // or else crash on the original one.
<del> domainStack.pop();
<add> // If the user already exited it, then don't double-exit.
<add> if (domain === domainModule.active)
<add> domainStack.pop();
<ide> if (domainStack.length) {
<ide> var parentDomain = domainStack[domainStack.length - 1];
<ide> process.domain = domainModule.active = parentDomain;
<ide><path>test/simple/test-domain-nested-throw.js
<ide> var assert = require('assert');
<ide>
<ide> var domain = require('domain');
<ide>
<add>var dispose;
<add>switch (process.argv[2]) {
<add> case 'true':
<add> dispose = true;
<add> break;
<add> case 'false':
<add> dispose = false;
<add> break;
<add> default:
<add> parent();
<add> return;
<add>}
<add>
<add>function parent() {
<add> var node = process.execPath;
<add> var spawn = require('child_process').spawn;
<add> var opt = { stdio: 'inherit' };
<add> var child = spawn(node, [__filename, 'true'], opt);
<add> child.on('exit', function(c) {
<add> assert(!c);
<add> child = spawn(node, [__filename, 'false'], opt);
<add> child.on('exit', function(c) {
<add> assert(!c);
<add> console.log('ok');
<add> });
<add> });
<add>}
<add>
<ide> var gotDomain1Error = false;
<ide> var gotDomain2Error = false;
<ide>
<ide> function inner(throw1, throw2) {
<ide> var domain1 = domain.createDomain();
<ide>
<ide> domain1.on('error', function (err) {
<del> console.error('domain 1 error');
<del> if (gotDomain1Error) process.exit(1);
<add> if (gotDomain1Error) {
<add> console.error('got domain 1 twice');
<add> process.exit(1);
<add> }
<add> if (dispose) domain1.dispose();
<ide> gotDomain1Error = true;
<ide> throw2();
<ide> });
<ide> function outer() {
<ide> var domain2 = domain.createDomain();
<ide>
<ide> domain2.on('error', function (err) {
<del> console.error('domain 2 error');
<add> if (gotDomain2Error) {
<add> console.error('got domain 2 twice');
<add> process.exit(1);
<add> }
<ide> gotDomain2Error = true;
<ide> });
<ide>
<ide> process.on('exit', function() {
<ide> assert(gotDomain2Error);
<ide> assert(threw1);
<ide> assert(threw2);
<del> console.log('ok');
<add> console.log('ok', dispose);
<ide> });
<ide>
<ide> outer(); | 2 |
Text | Text | add note about using cluster without networking | adb7be2649abb9ffa835886427b48d765688fdb5 | <ide><path>doc/api/cluster.md
<ide> will be dropped and new connections will be refused. Node.js does not
<ide> automatically manage the number of workers, however. It is the application's
<ide> responsibility to manage the worker pool based on its own needs.
<ide>
<del>
<add>Although a primary use case for the `cluster` module is networking, it can
<add>also be used for other use cases requiring worker processes.
<ide>
<ide> ## Class: Worker
<ide> <!-- YAML | 1 |
Python | Python | fix linspace for use with physical quantities | 4a764d3c7afccedc6e96fce0bdabe6ed44f255dc | <ide><path>numpy/core/function_base.py
<ide> def linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None):
<ide> num = int(num)
<ide>
<ide> # Convert float/complex array scalars to float, gh-3504
<del> start = start + 0.
<del> stop = stop + 0.
<add> start = start * 1.
<add> stop = stop * 1.
<ide>
<ide> if dtype is None:
<ide> dtype = result_type(start, stop, float(num))
<ide><path>numpy/core/tests/test_function_base.py
<ide> def test_complex(self):
<ide> lim2 = linspace(1j, 10, 5)
<ide> t2 = array([ 0.0+1.j , 2.5+0.75j, 5.0+0.5j , 7.5+0.25j, 10.0+0.j])
<ide> assert_equal(lim1, t1)
<del> assert_equal(lim2, t2)
<ide>\ No newline at end of file
<add> assert_equal(lim2, t2)
<add>
<add> def test_physical_quantities(self):
<add> class PhysicalQuantity(float):
<add> def __new__(cls, value):
<add> return float.__new__(cls, value)
<add>
<add> def __add__(self, x):
<add> assert_(isinstance(x, PhysicalQuantity))
<add> return PhysicalQuantity(float(x) + float(self))
<add> __radd__ = __add__
<add>
<add> def __sub__(self, x):
<add> assert_(isinstance(x, PhysicalQuantity))
<add> return PhysicalQuantity(float(self) - float(x))
<add>
<add> def __rsub__(self, x):
<add> assert_(isinstance(x, PhysicalQuantity))
<add> return PhysicalQuantity(float(x) - float(self))
<add>
<add> def __mul__(self, x):
<add> return PhysicalQuantity(float(x) * float(self))
<add> __rmul__ = __mul__
<add>
<add> def __div__(self, x):
<add> return PhysicalQuantity(float(self) / float(x))
<add>
<add> def __rdiv__(self, x):
<add> return PhysicalQuantity(float(x) / float(self))
<add>
<add>
<add> a = PhysicalQuantity(0.0)
<add> b = PhysicalQuantity(1.0)
<add> assert_equal(linspace(a, b), linspace(0.0, 1.0))
<ide>\ No newline at end of file | 2 |
Go | Go | remove unused map() method | 7b510fda0cd6d633501b3e999e16bd98ce89dea3 | <ide><path>daemon/containerd/service.go
<ide> func (cs *ImageService) GetLayerFolders(img *image.Image, rwLayer layer.RWLayer)
<ide> panic("not implemented")
<ide> }
<ide>
<del>// Map returns a map of all images in the ImageStore.
<del>func (cs *ImageService) Map() map[image.ID]*image.Image {
<del> panic("not implemented")
<del>}
<del>
<ide> // GetLayerByID returns a layer by ID
<ide> // called from daemon.go Daemon.restore(), and Daemon.containerExport().
<ide> func (cs *ImageService) GetLayerByID(string) (layer.RWLayer, error) {
<ide><path>daemon/image_service.go
<ide> type ImageService interface {
<ide> // Other
<ide>
<ide> GetRepository(ctx context.Context, ref reference.Named, authConfig *types.AuthConfig) (distribution.Repository, error)
<del> Map() map[image.ID]*image.Image
<ide> SearchRegistryForImages(ctx context.Context, searchFilters filters.Args, term string, limit int, authConfig *types.AuthConfig, headers map[string][]string) (*registry.SearchResults, error)
<ide> DistributionServices() images.DistributionServices
<ide> Children(id image.ID) []image.ID
<ide><path>daemon/images/images.go
<ide> func (r byCreated) Len() int { return len(r) }
<ide> func (r byCreated) Swap(i, j int) { r[i], r[j] = r[j], r[i] }
<ide> func (r byCreated) Less(i, j int) bool { return r[i].Created < r[j].Created }
<ide>
<del>// Map returns a map of all images in the ImageStore
<del>func (i *ImageService) Map() map[image.ID]*image.Image {
<del> return i.imageStore.Map()
<del>}
<del>
<ide> // Images returns a filtered list of images.
<ide> func (i *ImageService) Images(_ context.Context, opts types.ImageListOptions) ([]*types.ImageSummary, error) {
<ide> if err := opts.Filters.Validate(acceptedImageFilterTags); err != nil { | 3 |
Java | Java | fix mergedannotations javadoc | 87dba5a4df3bd4b2e9f0b5c31d9ceda2d81ec94d | <ide><path>spring-core/src/main/java/org/springframework/core/annotation/MergedAnnotations.java
<ide> public interface MergedAnnotations extends Iterable<MergedAnnotation<Annotation>
<ide> <A extends Annotation> boolean isPresent(Class<A> annotationType);
<ide>
<ide> /**
<del> * Determine if the specified annotation is directly present.
<del> * <p>Equivalent to calling {@code get(annotationType).isDirectlyPresent()}.
<add> * Determine if the specified annotation is either directly present or
<add> * meta-present.
<add> * <p>Equivalent to calling {@code get(annotationType).isPresent()}.
<ide> * @param annotationType the fully qualified class name of the annotation type
<ide> * to check
<ide> * @return {@code true} if the annotation is present
<ide> public interface MergedAnnotations extends Iterable<MergedAnnotation<Annotation>
<ide> <A extends Annotation> boolean isDirectlyPresent(Class<A> annotationType);
<ide>
<ide> /**
<del> * Determine if the specified annotation is either directly present or
<del> * meta-present.
<del> * <p>Equivalent to calling {@code get(annotationType).isPresent()}.
<add> * Determine if the specified annotation is directly present.
<add> * <p>Equivalent to calling {@code get(annotationType).isDirectlyPresent()}.
<ide> * @param annotationType the fully qualified class name of the annotation type
<ide> * to check
<ide> * @return {@code true} if the annotation is present | 1 |
PHP | PHP | remove the before/after options | 444699e02b98446fb508c22e3bd9f4f34b5a7ab8 | <ide><path>src/View/Helper/FormHelper.php
<ide> public function postLink($title, $url = null, $options = array(), $confirmMessag
<ide> *
<ide> * - `div` - Include a wrapping div? Defaults to true. Accepts sub options similar to
<ide> * FormHelper::input().
<del> * - `before` - Content to include before the input.
<del> * - `after` - Content to include after the input.
<ide> * - `type` - Set to 'reset' for reset inputs. Defaults to 'submit'
<ide> * - Other attributes will be assigned to the input element.
<ide> *
<ide> public function submit($caption = null, $options = array()) {
<ide> }
<ide>
<ide> if (isset($options['name'])) {
<del> $name = str_replace(array('[', ']'), array('.', ''), $options['name']);
<ide> $this->_secure($options['secure'], $this->_secureFieldName($options));
<ide> }
<ide> unset($options['secure']);
<ide>
<del> $before = $options['before'];
<del> $after = $options['after'];
<del> unset($options['before'], $options['after']);
<del>
<ide> $isUrl = strpos($caption, '://') !== false;
<ide> $isImage = preg_match('/\.(jpg|jpe|jpeg|gif|png|ico)$/', $caption);
<ide>
<ide> public function submit($caption = null, $options = array()) {
<ide> $options['value'] = $caption;
<ide> $tag = $this->Html->useTag('submit', $options);
<ide> }
<del> $out = $before . $tag . $after;
<add> $out = $tag;
<ide>
<ide> if (isset($divOptions)) {
<ide> $tag = $divOptions['tag'];
<ide><path>tests/TestCase/View/Helper/FormHelperTest.php
<ide> public function testSubmitButton() {
<ide> $expected = array('input' => array('type' => 'submit', 'value' => 'Test Submit', 'class' => 'save'));
<ide> $this->assertTags($result, $expected);
<ide>
<del> $result = $this->Form->submit('Test Submit', array('div' => array('id' => 'SaveButton')));
<del> $expected = array(
<del> 'div' => array('class' => 'submit', 'id' => 'SaveButton'),
<del> 'input' => array('type' => 'submit', 'value' => 'Test Submit'),
<del> '/div'
<del> );
<del> $this->assertTags($result, $expected);
<del>
<ide> $result = $this->Form->submit('Next >');
<ide> $expected = array(
<ide> 'div' => array('class' => 'submit'),
<ide> public function testSubmitButton() {
<ide> '/div'
<ide> );
<ide> $this->assertTags($result, $expected);
<del>
<del> $before = '--before--';
<del> $after = '--after--';
<del> $result = $this->Form->submit('Test', array('before' => $before));
<del> $expected = array(
<del> 'div' => array('class' => 'submit'),
<del> '--before--',
<del> 'input' => array('type' => 'submit', 'value' => 'Test'),
<del> '/div'
<del> );
<del> $this->assertTags($result, $expected);
<del>
<del> $result = $this->Form->submit('Test', array('after' => $after));
<del> $expected = array(
<del> 'div' => array('class' => 'submit'),
<del> 'input' => array('type' => 'submit', 'value' => 'Test'),
<del> '--after--',
<del> '/div'
<del> );
<del> $this->assertTags($result, $expected);
<del>
<del> $result = $this->Form->submit('Test', array('before' => $before, 'after' => $after));
<del> $expected = array(
<del> 'div' => array('class' => 'submit'),
<del> '--before--',
<del> 'input' => array('type' => 'submit', 'value' => 'Test'),
<del> '--after--',
<del> '/div'
<del> );
<del> $this->assertTags($result, $expected);
<ide> }
<ide>
<ide> /**
<ide> public function testSubmitImage() {
<ide> '/div'
<ide> );
<ide> $this->assertTags($result, $expected);
<del>
<del> $after = '--after--';
<del> $before = '--before--';
<del> $result = $this->Form->submit('cake.power.gif', array('after' => $after));
<del> $expected = array(
<del> 'div' => array('class' => 'submit'),
<del> 'input' => array('type' => 'image', 'src' => 'img/cake.power.gif'),
<del> '--after--',
<del> '/div'
<del> );
<del> $this->assertTags($result, $expected);
<del>
<del> $result = $this->Form->submit('cake.power.gif', array('before' => $before));
<del> $expected = array(
<del> 'div' => array('class' => 'submit'),
<del> '--before--',
<del> 'input' => array('type' => 'image', 'src' => 'img/cake.power.gif'),
<del> '/div'
<del> );
<del> $this->assertTags($result, $expected);
<del>
<del> $result = $this->Form->submit('cake.power.gif', array('before' => $before, 'after' => $after));
<del> $expected = array(
<del> 'div' => array('class' => 'submit'),
<del> '--before--',
<del> 'input' => array('type' => 'image', 'src' => 'img/cake.power.gif'),
<del> '--after--',
<del> '/div'
<del> );
<del> $this->assertTags($result, $expected);
<del>
<del> $result = $this->Form->submit('Not.an.image', array('before' => $before, 'after' => $after));
<del> $expected = array(
<del> 'div' => array('class' => 'submit'),
<del> '--before--',
<del> 'input' => array('type' => 'submit', 'value' => 'Not.an.image'),
<del> '--after--',
<del> '/div'
<del> );
<del> $this->assertTags($result, $expected);
<ide> }
<ide>
<ide> /** | 2 |
PHP | PHP | fix arraying of relations | 087ecd6ece89d9038840281cc02b78c92ac7eb29 | <ide><path>src/Illuminate/Database/Eloquent/Model.php
<ide> public function relationsToArray()
<ide> // If the relation value has been set, we will set it on this attributes
<ide> // list for returning. If it was not arrayable or null, we'll not set
<ide> // the value on the array because it is some type of invalid value.
<del> if (isset($relation))
<add> if (isset($relation) or is_null($value))
<ide> {
<ide> $attributes[$key] = $relation;
<ide> }
<ide><path>tests/Database/DatabaseEloquentModelTest.php
<ide> public function testToArray()
<ide> new EloquentModelStub(array('bar' => 'baz')), new EloquentModelStub(array('bam' => 'boom'))
<ide> )));
<ide> $model->setRelation('partner', new EloquentModelStub(array('name' => 'abby')));
<add> $model->setRelation('group', null);
<add> $model->setRelation('multi', new Illuminate\Database\Eloquent\Collection);
<ide> $array = $model->toArray();
<ide>
<ide> $this->assertTrue(is_array($array));
<ide> $this->assertEquals('foo', $array['name']);
<ide> $this->assertEquals('baz', $array['names'][0]['bar']);
<ide> $this->assertEquals('boom', $array['names'][1]['bam']);
<ide> $this->assertEquals('abby', $array['partner']['name']);
<add> $this->assertEquals(null, $array['group']);
<add> $this->assertEquals(array(), $array['multi']);
<ide> $this->assertFalse(isset($array['password']));
<ide> }
<ide> | 2 |
PHP | PHP | add plugin examples | ae5e7508dfdad0451fe3e98efd19ffe601a960fe | <ide><path>tests/TestCase/ORM/TableRegistryTest.php
<ide> public function testGetFallbacks()
<ide> $this->assertEquals('rebels', $result->table(), 'The table should be taken from options');
<ide> $this->assertEquals('C3P0', $result->alias());
<ide>
<add> $result = TableRegistry::get('Funky.Chipmunks');
<add> $this->assertInstanceOf('Cake\ORM\Table', $result);
<add> $this->assertEquals('chipmunks', $result->table(), 'The table should be derived from the alias');
<add> $this->assertEquals('Chipmunks', $result->alias());
<add>
<add> $result = TableRegistry::get('Awesome', ['className' => 'Funky.Monkies']);
<add> $this->assertInstanceOf('Cake\ORM\Table', $result);
<add> $this->assertEquals('monkies', $result->table(), 'The table should be derived from the classname');
<add> $this->assertEquals('Awesome', $result->alias());
<add>
<ide> $result = TableRegistry::get('Stuff', ['className' => 'Cake\ORM\Table']);
<ide> $this->assertInstanceOf('Cake\ORM\Table', $result);
<del> $this->assertEquals('stuff', $result->table(), 'The table should be drived from the alias');
<add> $this->assertEquals('stuff', $result->table(), 'The table should be derived from the alias');
<ide> $this->assertEquals('Stuff', $result->alias());
<ide> }
<ide> | 1 |
Javascript | Javascript | fix spelling in test case comments | e890344d18fdc4ad096d2c5020a7101bc355ad8b | <ide><path>test/abort/test-http-parser-consume.js
<ide> if (process.argv[2] === 'child') {
<ide> const rr = get({ port: server.address().port }, common.mustCall(() => {
<ide> // This bad input (0) should abort the parser and the process
<ide> rr.parser.consume(0);
<del> // This line should be unreachanble.
<add> // This line should be unreachable.
<ide> assert.fail('this should be unreachable');
<ide> }));
<ide> }));
<ide> } else {
<del> // super-proces
<add> // super-process
<ide> const child = spawn(process.execPath, [__filename, 'child']);
<ide> child.stdout.on('data', common.mustNotCall());
<ide>
<ide><path>test/async-hooks/hook-checks.js
<ide> require('../common');
<ide> * @param {Object} activity including timestamps for each life time event,
<ide> * i.e. init, before ...
<ide> * @param {Object} hooks the expected life time event invocations with a count
<del> * indicating how oftn they should have been invoked,
<add> * indicating how often they should have been invoked,
<ide> * i.e. `{ init: 1, before: 2, after: 2 }`
<ide> * @param {String} stage the name of the stage in the test at which we are
<ide> * checking the invocations
<ide><path>test/async-hooks/test-internal-nexttick-default-trigger.js
<ide> const common = require('../common');
<ide>
<ide> // This tests ensures that the triggerId of both the internal and external
<del>// nexTick function sets the triggerAsyncId correctly.
<add>// nextTick function sets the triggerAsyncId correctly.
<ide>
<ide> const assert = require('assert');
<ide> const async_hooks = require('async_hooks');
<ide><path>test/async-hooks/test-pipeconnectwrap.js
<ide> function onlisten() {
<ide> const awaitOnconnectCalls = new Set(['server', 'client']);
<ide> function maybeOnconnect(source) {
<ide> // both server and client must call onconnect. On most OS's waiting for
<del> // the client is sufficient, but on CertOS 5 the sever needs to respond too.
<add> // the client is sufficient, but on CentOS 5 the sever needs to respond too.
<ide> assert.ok(awaitOnconnectCalls.size > 0);
<ide> awaitOnconnectCalls.delete(source);
<ide> if (awaitOnconnectCalls.size > 0) return;
<ide><path>test/async-hooks/verify-graph.js
<ide> function pruneTickObjects(activities) {
<ide> foundTickObject = true;
<ide>
<ide> // point all triggerAsyncIds that point to the tickObject
<del> // to its triggerAsyncId and findally remove it from the activities
<add> // to its triggerAsyncId and finally remove it from the activities
<ide> const tickObject = activities[tickObjectIdx];
<ide> const newTriggerId = tickObject.triggerAsyncId;
<ide> const oldTriggerId = tickObject.uid;
<ide><path>test/common/index.js
<ide> if (process.env.NODE_TEST_WITH_ASYNC_HOOKS) {
<ide> const async_wrap = process.binding('async_wrap');
<ide>
<ide> process.on('exit', () => {
<del> // itterate through handles to make sure nothing crashes
<add> // iterate through handles to make sure nothing crashes
<ide> for (const k in initHandles)
<ide> util.inspect(initHandles[k]);
<ide> });
<ide><path>test/fixtures/net-fd-passing-receiver.js
<ide> receiver = net.createServer(function(socket) {
<ide> });
<ide> });
<ide>
<del>/* To signal the test runne we're up and listening */
<add>/* To signal the test runner we're up and listening */
<ide> receiver.on('listening', function() {
<ide> console.log('ready');
<ide> });
<ide><path>test/parallel/test-async-hooks-http-agent.js
<ide> const http = require('http');
<ide> // Checks that an http.Agent properly asyncReset()s a reused socket handle, and
<ide> // re-assigns the fresh async id to the reused `net.Socket` instance.
<ide>
<del>// Make sure a single socket is transpartently reused for 2 requests.
<add>// Make sure a single socket is transparently reused for 2 requests.
<ide> const agent = new http.Agent({
<ide> keepAlive: true,
<ide> keepAliveMsecs: Infinity,
<ide><path>test/parallel/test-async-hooks-promise-enable-disable.js
<ide> let p_inits = 0;
<ide> common.crashOnUnhandledRejection();
<ide>
<ide> // Not useful to place common.mustCall() around 'exit' event b/c it won't be
<del>// able to check it anway.
<add>// able to check it anyway.
<ide> process.on('exit', (code) => {
<ide> if (code !== 0)
<ide> return;
<ide> if (p_er !== null)
<ide> throw p_er;
<del> // Expecint exactly 2 PROMISE types to reach init.
<add> // Expecting exactly 2 PROMISE types to reach init.
<ide> assert.strictEqual(p_inits, EXPECTED_INITS);
<ide> });
<ide>
<ide><path>test/parallel/test-async-wrap-pop-id-during-load.js
<ide> if (process.argv[2] === 'async') {
<ide> throw new Error();
<ide> }
<ide> (async function() { await fn(); })();
<del> // While the above should error, just in case it dosn't the script shouldn't
<add> // While the above should error, just in case it doesn't the script shouldn't
<ide> // fork itself indefinitely so return early.
<ide> return;
<ide> }
<ide><path>test/parallel/test-buffer-fill.js
<ide> Buffer.alloc(8, '');
<ide> return 0;
<ide> } else {
<ide> elseWasLast = true;
<del> // Once buffer.js calls the C++ implemenation of fill, return -1
<add> // Once buffer.js calls the C++ implementation of fill, return -1
<ide> return -1;
<ide> }
<ide> }
<ide> common.expectsError(() => {
<ide> return 1;
<ide> } else {
<ide> elseWasLast = true;
<del> // Once buffer.js calls the C++ implemenation of fill, return -1
<add> // Once buffer.js calls the C++ implementation of fill, return -1
<ide> return -1;
<ide> }
<ide> }
<ide><path>test/parallel/test-buffer-includes.js
<ide> assert.strictEqual(
<ide> );
<ide>
<ide>
<del>// test usc2 encoding
<add>// test ucs2 encoding
<ide> let twoByteString = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'ucs2');
<ide>
<ide> assert(twoByteString.includes('\u0395', 4, 'ucs2'));
<ide><path>test/parallel/test-buffer-indexof.js
<ide> assert.strictEqual(511, longBufferString.lastIndexOf(pattern, 1534));
<ide> // "yolo swag swag yolo swag yolo yolo swag" ..., goes on for about 5MB.
<ide> // This is hard to search because it all looks similar, but never repeats.
<ide>
<del>// countBits returns the number of bits in the binary reprsentation of n.
<add>// countBits returns the number of bits in the binary representation of n.
<ide> function countBits(n) {
<ide> let count;
<ide> for (count = 0; n > 0; count++) {
<ide><path>test/parallel/test-buffer-read.js
<ide> function read(buff, funx, args, expected) {
<ide>
<ide> }
<ide>
<del>// testing basic functionality of readDoubleBE() and readDOubleLE()
<add>// testing basic functionality of readDoubleBE() and readDoubleLE()
<ide> read(buf, 'readDoubleBE', [1], -3.1827727774563287e+295);
<ide> read(buf, 'readDoubleLE', [1], -6.966010051009108e+144);
<ide>
<del>// testing basic functionality of readFLoatBE() and readFloatLE()
<add>// testing basic functionality of readFloatBE() and readFloatLE()
<ide> read(buf, 'readFloatBE', [1], -1.6691549692541768e+37);
<ide> read(buf, 'readFloatLE', [1], -7861303808);
<ide>
<ide><path>test/parallel/test-child-process-internal.js
<ide> if (process.argv[2] === 'child') {
<ide> //send non-internal message containing PREFIX at a non prefix position
<ide> process.send(normal);
<ide>
<del> //send inernal message
<add> //send internal message
<ide> process.send(internal);
<ide>
<ide> process.exit(0);
<ide><path>test/parallel/test-child-process-send-returns-boolean.js
<ide> const fixtures = require('../common/fixtures');
<ide> const subScript = fixtures.path('child-process-persistent.js');
<ide>
<ide> {
<del> // Test `send` return value on `fork` that opens and IPC by deafult.
<add> // Test `send` return value on `fork` that opens and IPC by default.
<ide> const n = fork(subScript);
<ide> // `subprocess.send` should always return `true` for the first send.
<ide> const rv = n.send({ h: 'w' }, (err) => { if (err) assert.fail(err); });
<ide> const subScript = fixtures.path('child-process-persistent.js');
<ide> const server = net.createServer(common.mustNotCall()).listen(0, () => {
<ide> const handle = server._handle;
<ide>
<del> // Sending a handle and not giving the tickQueue time to acknoladge should
<add> // Sending a handle and not giving the tickQueue time to acknowledge should
<ide> // create the internal backlog, but leave it empty.
<ide> const rv1 = s.send('one', handle, (err) => { if (err) assert.fail(err); });
<ide> assert.strictEqual(rv1, true);
<del> // Since the first `send` included a handle (should be unackoladged),
<del> // we can safly queue up only one more message.
<add> // Since the first `send` included a handle (should be unacknowledged),
<add> // we can safely queue up only one more message.
<ide> const rv2 = s.send('two', (err) => { if (err) assert.fail(err); });
<ide> assert.strictEqual(rv2, true);
<ide> // The backlog should now be indicate to backoff.
<ide><path>test/parallel/test-crypto-deprecated.js
<ide> common.expectWarning('DeprecationWarning', [
<ide>
<ide> // Accessing the deprecated function is enough to trigger the warning event.
<ide> // It does not need to be called. So the assert serves the purpose of both
<del>// triggering the warning event and confirming that the deprected function is
<add>// triggering the warning event and confirming that the deprecated function is
<ide> // mapped to the correct non-deprecated function.
<ide> assert.strictEqual(crypto.Credentials, tls.SecureContext);
<ide> assert.strictEqual(crypto.createCredentials, tls.createSecureContext);
<ide><path>test/parallel/test-crypto-fips.js
<ide> testHelper(
<ide> // to try to call the fips setter, to try to detect this situation, as
<ide> // that would throw an error:
<ide> // ("Error: Cannot set FIPS mode in a non-FIPS build.").
<del>// Due to this uncertanty the following tests are skipped when configured
<add>// Due to this uncertainty the following tests are skipped when configured
<ide> // with --shared-openssl.
<ide> if (!sharedOpenSSL()) {
<ide> // OpenSSL config file should be able to turn on FIPS mode
<ide><path>test/parallel/test-domain-throw-error-then-throw-from-uncaught-exception-handler.js
<ide> if (process.argv[2] === 'child') {
<ide> // is not properly flushed in V8's Isolate::Throw right before the
<ide> // process aborts due to an uncaught exception, and thus the error
<ide> // message representing the error that was thrown cannot be read by the
<del> // parent process. So instead of parsing the child process' stdandard
<add> // parent process. So instead of parsing the child process' standard
<ide> // error, the parent process will check that in the case
<ide> // --abort-on-uncaught-exception was passed, the process did not exit
<ide> // with exit code RAN_UNCAUGHT_EXCEPTION_HANDLER_EXIT_CODE.
<ide><path>test/parallel/test-event-emitter-remove-listeners.js
<ide> function listener2() {}
<ide>
<ide> // listener4 will still be called although it is removed by listener 3.
<ide> ee.emit('hello');
<del> // This is so because the interal listener array at time of emit
<add> // This is so because the internal listener array at time of emit
<ide> // was [listener3,listener4]
<ide>
<del> // Interal listener array [listener3]
<add> // Internal listener array [listener3]
<ide> ee.emit('hello');
<ide> }
<ide>
<ide><path>test/parallel/test-fs-access.js
<ide> createFileWithPerms(readWriteFile, 0o666);
<ide> * The change of user id is done after creating the fixtures files for the same
<ide> * reason: the test may be run as the superuser within a directory in which
<ide> * only the superuser can create files, and thus it may need superuser
<del> * priviledges to create them.
<add> * privileges to create them.
<ide> *
<ide> * There's not really any point in resetting the process' user id to 0 after
<ide> * changing it to 'nobody', since in the case that the test runs without
<ide><path>test/parallel/test-fs-read-stream-double-close.js
<ide> const fs = require('fs');
<ide> {
<ide> const s = fs.createReadStream(__filename);
<ide>
<del> // this is a private API, but it is worth esting. close calls this
<add> // this is a private API, but it is worth testing. close calls this
<ide> s.destroy(null, common.mustCall());
<ide> s.destroy(null, common.mustCall());
<ide> }
<ide><path>test/parallel/test-http-agent-keepalive.js
<ide> function remoteClose() {
<ide> process.nextTick(common.mustCall(() => {
<ide> assert.strictEqual(agent.sockets[name], undefined);
<ide> assert.strictEqual(agent.freeSockets[name].length, 1);
<del> // waitting remote server close the socket
<add> // waiting remote server close the socket
<ide> setTimeout(common.mustCall(() => {
<ide> assert.strictEqual(agent.sockets[name], undefined);
<ide> assert.strictEqual(agent.freeSockets[name], undefined,
<ide> function remoteClose() {
<ide> }
<ide>
<ide> function remoteError() {
<del> // remove server will destroy ths socket
<add> // remote server will destroy the socket
<ide> const req = get('/error', common.mustNotCall());
<ide> req.on('error', common.mustCall((err) => {
<ide> assert(err);
<ide><path>test/parallel/test-http-extra-response.js
<ide> const server = net.createServer(function(socket) {
<ide>
<ide> if (postBody.includes('\r\n')) {
<ide> socket.write(fullResponse);
<del> // omg, I wrote the response twice, what a terrible HTTP server I am.
<ide> socket.end(fullResponse);
<ide> }
<ide> });
<ide><path>test/parallel/test-http2-server-push-disabled.js
<ide> server.listen(0, common.mustCall(() => {
<ide> options);
<ide> const req = client.request({ ':path': '/' });
<ide>
<del> // Because push stream sre disabled, this must not be called.
<add> // Because push streams are disabled, this must not be called.
<ide> client.on('stream', common.mustNotCall());
<ide>
<ide> req.resume();
<ide><path>test/parallel/test-http2-server-timeout.js
<ide> server.once('timeout', onServerTimeout);
<ide> server.listen(0, common.mustCall(() => {
<ide> const url = `http://localhost:${server.address().port}`;
<ide> const client = http2.connect(url);
<del> // Because of the timeout, an ECONRESET error may or may not happen here.
<add> // Because of the timeout, an ECONNRESET error may or may not happen here.
<ide> // Keep this as a non-op and do not use common.mustCall()
<ide> client.on('error', () => {});
<ide> client.on('close', common.mustCall(() => {
<ide> const client2 = http2.connect(url);
<del> // Because of the timeout, an ECONRESET error may or may not happen here.
<add> // Because of the timeout, an ECONNRESET error may or may not happen here.
<ide> // Keep this as a non-op and do not use common.mustCall()
<ide> client2.on('error', () => {});
<ide> client2.on('close', common.mustCall(() => server.close()));
<ide><path>test/parallel/test-http2-too-many-streams.js
<ide> server.on('stream', common.mustCall((stream) => {
<ide> // c should never be greater than 1.
<ide> assert.strictEqual(++c, 1);
<ide> stream.respond();
<del> // Force some asynchronos stuff.
<add> // Force some asynchronous stuff.
<ide> setImmediate(() => {
<ide> stream.end('ok');
<ide> assert.strictEqual(--c, 0);
<ide><path>test/parallel/test-https-agent-secure-protocol.js
<ide> server.listen(0, common.mustCall(function() {
<ide> }, common.mustCall(function(res) {
<ide> res.resume();
<ide> globalAgent.once('free', common.mustCall(function() {
<del> // Verify that two keep-alived connections are created
<add> // Verify that two keep-alive connections are created
<ide> // due to the different secureProtocol settings:
<ide> const keys = Object.keys(globalAgent.freeSockets);
<ide> assert.strictEqual(keys.length, 2);
<ide><path>test/parallel/test-https-socket-options.js
<ide> server_http.listen(0, function() {
<ide> });
<ide>
<ide> // Then try https server (requires functions to be
<del>// mirroed in tls.js's CryptoStream)
<add>// mirrored in tls.js's CryptoStream)
<ide>
<ide> const server_https = https.createServer(options, function(req, res) {
<ide> console.log('got HTTPS request');
<ide><path>test/parallel/test-internal-fs-syncwritestream.js
<ide> const filename = path.join(common.tmpDir, 'sync-write-stream.txt');
<ide> assert.strictEqual(stream.listenerCount('end'), 1);
<ide> }
<ide>
<del>// Verfiy that the file will be written synchronously.
<add>// Verify that the file will be written synchronously.
<ide> {
<ide> const fd = fs.openSync(filename, 'w');
<ide> const stream = new SyncWriteStream(fd);
<ide> const filename = path.join(common.tmpDir, 'sync-write-stream.txt');
<ide> assert.strictEqual(stream.destroySoon(), true);
<ide> }
<ide>
<del>// Verfit that the 'end' event listener will also destroy the stream.
<add>// Verify that the 'end' event listener will also destroy the stream.
<ide> {
<ide> const fd = fs.openSync(filename, 'w');
<ide> const stream = new SyncWriteStream(fd);
<ide><path>test/parallel/test-net-listen-error.js
<ide> const net = require('net');
<ide>
<ide> const server = net.createServer(function(socket) {
<ide> });
<del>server.listen(1, '1.1.1.1', common.mustNotCall()); // EACCESS or EADDRNOTAVAIL
<add>server.listen(1, '1.1.1.1', common.mustNotCall()); // EACCES or EADDRNOTAVAIL
<ide> server.on('error', common.mustCall());
<ide><path>test/parallel/test-net-pipe-connect-errors.js
<ide> if (common.isWindows) {
<ide> emptyTxt = fixtures.path('empty.txt');
<ide> } else {
<ide> common.refreshTmpDir();
<del> // Keep the file name very short so tht we don't exceed the 108 char limit
<add> // Keep the file name very short so that we don't exceed the 108 char limit
<ide> // on CI for a POSIX socket. Even though this isn't actually a socket file,
<ide> // the error will be different from the one we are expecting if we exceed the
<ide> // limit.
<ide><path>test/parallel/test-net-write-after-close.js
<ide> const server = net.createServer(common.mustCall(function(socket) {
<ide>
<ide> server.listen(0, function() {
<ide> const client = net.connect(this.address().port, function() {
<del> // cliend.end() will close both the readable and writable side
<add> // client.end() will close both the readable and writable side
<ide> // of the duplex because allowHalfOpen defaults to false.
<ide> // Then 'end' will be emitted when it receives a FIN packet from
<ide> // the other side.
<ide><path>test/parallel/test-os.js
<ide> is.string(arch);
<ide> assert.ok(arch.length > 0);
<ide>
<ide> if (!common.isSunOS) {
<del> // not implemeneted yet
<add> // not implemented yet
<ide> assert.ok(os.loadavg().length > 0);
<ide> assert.ok(os.freemem() > 0);
<ide> assert.ok(os.totalmem() > 0);
<ide><path>test/parallel/test-promises-unhandled-rejections.js
<ide> asyncTest('While inside setImmediate, catching a rejected promise derived ' +
<ide> });
<ide> });
<ide>
<del>// State adapation tests
<add>// State adaptation tests
<ide> asyncTest('catching a promise which is asynchronously rejected (via ' +
<ide> 'resolution to an asynchronously-rejected promise) prevents' +
<ide> ' unhandledRejection', function(done) {
<ide><path>test/parallel/test-readline-interface.js
<ide> function isWarned(emitter) {
<ide> assert.strictEqual(isWarned(process.stdout._events), false);
<ide> }
<ide>
<del> // can create a new readline Interface with a null output arugument
<add> // can create a new readline Interface with a null output argument
<ide> {
<ide> const fi = new FakeInput();
<ide> const rli = new readline.Interface(
<ide><path>test/parallel/test-repl.js
<ide> const errorTests = [
<ide> send: '/(.)(.)(.)(.)(.)(.)(.)(.)(.)/.test(\'123456789\')\n',
<ide> expect: 'true'
<ide> },
<del> // the following test's result depends on the RegEx's match from the above
<add> // the following test's result depends on the RegExp's match from the above
<ide> {
<ide> send: 'RegExp.$1\nRegExp.$2\nRegExp.$3\nRegExp.$4\nRegExp.$5\n' +
<ide> 'RegExp.$6\nRegExp.$7\nRegExp.$8\nRegExp.$9\n',
<ide><path>test/parallel/test-require-symlink.js
<ide> function copyDir(source, target) {
<ide> copyDir(fixtureSource, tmpDirTarget);
<ide>
<ide> // Move to tmp dir and do everything with relative paths there so that the test
<del>// doesn't incorrectly fail due to a symlink somewhere else in the absolte path.
<add>// doesn't incorrectly fail due to a symlink somewhere else in the absolute
<add>// path.
<ide> process.chdir(common.tmpDir);
<ide>
<ide> const linkDir = path.join(dirName,
<ide><path>test/parallel/test-stream-transform-final-sync.js
<ide> let state = 0;
<ide>
<ide> /*
<ide> What you do
<del>var stream = new tream.Transform({
<add>var stream = new stream.Transform({
<ide> transform: function transformCallback(chunk, _, next) {
<ide> // part 1
<ide> this.push(chunk);
<ide><path>test/parallel/test-stream-transform-final.js
<ide> let state = 0;
<ide>
<ide> /*
<ide> What you do
<del>var stream = new tream.Transform({
<add>var stream = new stream.Transform({
<ide> transform: function transformCallback(chunk, _, next) {
<ide> // part 1
<ide> this.push(chunk);
<ide><path>test/parallel/test-stream2-transform.js
<ide> const Transform = require('_stream_transform');
<ide> }
<ide>
<ide> {
<del> // Verify assymetric transform (expand)
<add> // Verify asymmetric transform (expand)
<ide> const pt = new Transform();
<ide>
<ide> // emit each chunk 2 times.
<ide> const Transform = require('_stream_transform');
<ide> }
<ide>
<ide> {
<del> // Verify assymetric trasform (compress)
<add> // Verify asymmetric transform (compress)
<ide> const pt = new Transform();
<ide>
<ide> // each output is the first char of 3 consecutive chunks,
<ide> const Transform = require('_stream_transform');
<ide> // this tests for a stall when data is written to a full stream
<ide> // that has empty transforms.
<ide> {
<del> // Verify compex transform behavior
<add> // Verify complex transform behavior
<ide> let count = 0;
<ide> let saved = null;
<ide> const pt = new Transform({ highWaterMark: 3 });
<ide><path>test/parallel/test-stream3-cork-uncork.js
<ide> writeChunks(inputChunks, () => {
<ide> // trigger writing out the buffer
<ide> w.uncork();
<ide>
<del> // buffered bytes shoud be seen in current tick
<add> // buffered bytes should be seen in current tick
<ide> assert.strictEqual(seenChunks.length, 4);
<ide>
<ide> // did the chunks match
<ide><path>test/parallel/test-stringbytes-external.js
<ide> assert.strictEqual(c_bin.toString('latin1'), ucs2_control);
<ide> assert.strictEqual(c_ucs.toString('latin1'), ucs2_control);
<ide>
<ide>
<del>// now let's test BASE64 and HEX ecoding/decoding
<add>// now let's test BASE64 and HEX encoding/decoding
<ide> const RADIOS = 2;
<ide> const PRE_HALF_APEX = Math.ceil(EXTERN_APEX / 2) - RADIOS;
<ide> const PRE_3OF4_APEX = Math.ceil((EXTERN_APEX / 4) * 3) - RADIOS;
<ide><path>test/parallel/test-tls-cnnic-whitelist.js
<ide> const testCases = [
<ide> errorCode: 'CERT_REVOKED'
<ide> },
<ide> // Test 1: for the fix of node#2061
<del> // agent6-cert.pem is signed by intermidate cert of ca3.
<add> // agent6-cert.pem is signed by intermediate cert of ca3.
<ide> // The server has a cert chain of agent6->ca3->ca1(root) but
<ide> // tls.connect should be failed with an error of
<ide> // UNABLE_TO_GET_ISSUER_CERT_LOCALLY since the root CA of ca1 is not
<ide><path>test/parallel/test-tls-ecdh-disable.js
<ide> // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
<ide> // USE OR OTHER DEALINGS IN THE SOFTWARE.
<ide>
<del>// Test that the usage of eliptic curves are not permitted if disabled during
<add>// Test that the usage of elliptic curves are not permitted if disabled during
<ide> // server initialization.
<ide>
<ide> 'use strict';
<ide><path>test/parallel/test-tls-server-verify.js
<ide> function runTest(port, testIndex) {
<ide> let renegotiated = false;
<ide> const server = tls.Server(serverOptions, function handleConnection(c) {
<ide> c.on('error', function(e) {
<del> // child.kill() leads ECONNRESET errro in the TLS connection of
<del> // openssl s_client via spawn(). A Test result is already
<add> // child.kill() leads ECONNRESET error in the TLS connection of
<add> // openssl s_client via spawn(). A test result is already
<ide> // checked by the data of client.stdout before child.kill() so
<ide> // these tls errors can be ignored.
<ide> });
<ide><path>test/sequential/test-inspector-contexts.js
<ide> async function testContextCreatedAndDestroyed() {
<ide> const { name, origin, auxData } = contextCreated.params.context;
<ide> if (common.isSunOS || common.isWindows) {
<ide> // uv_get_process_title() is unimplemented on Solaris-likes, it returns
<del> // an empy string. On the Windows CI buildbots it returns "Administrator:
<del> // Windows PowerShell[42]" because of a GetConsoleTitle() quirk. Not much
<del> // we can do about either, just verify that it contains the PID.
<add> // an empty string. On the Windows CI buildbots it returns
<add> // "Administrator: Windows PowerShell[42]" because of a GetConsoleTitle()
<add> // quirk. Not much we can do about either, just verify that it contains
<add> // the PID.
<ide> strictEqual(name.includes(`[${process.pid}]`), true);
<ide> } else {
<ide> strictEqual(`${process.argv0}[${process.pid}]`, name);
<ide><path>test/sequential/test-readline-interface.js
<ide> const common = require('../common');
<ide>
<ide> // These test cases are in `sequential` rather than the analogous test file in
<del>// `parallel` because they become unrelaible under load. The unreliability under
<add>// `parallel` because they become unreliable under load. The unreliability under
<ide> // load was determined empirically when the test cases were in `parallel` by
<ide> // running:
<ide> // tools/test.py -j 96 --repeat 192 test/parallel/test-readline-interface.js | 48 |
Javascript | Javascript | fix central dashed line | 54756f4d32e55b9618b151a7e07de1a82c9b034c | <ide><path>d3.chart.js
<ide> d3.chart.boxplot = function() {
<ide>
<ide> // Update center line.
<ide> var center = g.selectAll("line.center")
<del> .data([[min, max]]);
<add> .data([[whiskerData[0], whiskerData[whiskerData.length - 1]]]);
<ide>
<ide> center.enter().append("svg:line")
<ide> .attr("class", "center")
<ide><path>d3.chart.min.js
<del>(function(){function g(a){var b=a(0);return function(c){return Math.abs(a(c)-b)}}function f(a){return function(b){return"translate("+a(b)+",0)"}}function e(a){return a.measures}function d(a){return a.markers}function c(a){return a.ranges}function b(a){var b=a.length;return[.25,.5,.75].map(function(c){c*=b;if(parseInt(c)===c)return(a[c]+c[c+1])/2;return a[Math.round(c)]})}function a(a){return[0,a.length-1]}d3.chart={},d3.chart.boxplot=function(){function k(a){a.each(function(a,b){a=a.map(g).sort(d3.ascending);var k=a.length,l=a[0],m=a[k-1],n=h.call(this,a,b),o=n.map(function(b){return a[b]}),p=n[0],q=n[n.length-1],r=q-p,s=i(a.slice(p,q)),t=a.slice(0,p).concat(a.slice(q+1,k)),u=d3.select(this),v=d3.scale.linear().domain(f?f.call(this,a,b):[l,m]).range([d,0]),w=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(v.range());this.__chart__=v;var x=u.selectAll("line.center").data([[l,m]]);x.enter().append("svg:line").attr("class","center").attr("x1",c/2).attr("y1",function(a){return w(a[0])}).attr("x2",c/2).attr("y2",function(a){return w(a[1])}).transition().duration(e).attr("y1",function(a){return v(a[0])}).attr("y2",function(a){return v(a[1])}),x.transition().duration(e).attr("y1",function(a){return v(a[0])}).attr("y2",function(a){return v(a[1])}),x.exit().remove();var y=u.selectAll("rect.box").data([[s[0],s[2]]]);y.enter().append("svg:rect").attr("class","box").attr("x",0).attr("y",function(a){return w(a[1])}).attr("width",c).attr("height",function(a){return w(a[0])-w(a[1])}).transition().duration(e).attr("y",function(a){return v(a[1])}).attr("height",function(a){return v(a[0])-v(a[1])}),y.transition().duration(e).attr("y",function(a){return v(a[1])}).attr("height",function(a){return v(a[0])-v(a[1])}),y.exit().remove();var z=u.selectAll("line.median").data([s[1]]);z.enter().append("svg:line").attr("class","median").attr("x1",0).attr("y1",w).attr("x2",c).attr("y2",w).transition().duration(e).attr("y1",v).attr("y2",v),z.transition().duration(e).attr("y1",v).attr("y2",v),z.exit().remove();var A=u.selectAll("line.whisker").data(o);A.enter().append("svg:line").attr("class","whisker").attr("x1",0).attr("y1",w).attr("x2",c).attr("y2",w).transition().duration(e).attr("y1",v).attr("y2",v),A.transition().duration(e).attr("y1",v).attr("y2",v),A.exit().remove();var B=u.selectAll("circle.outlier").data(t);B.enter().append("svg:circle").attr("class","outlier").attr("r",5).attr("cx",c/2).attr("cy",w).transition().duration(e).attr("cy",v),B.transition().duration(e).attr("cy",v),B.exit().remove();var C=j||v.tickFormat(8),D=u.selectAll("text").data(s.concat(o));D.enter().append("svg:text").attr("dy",".3em").attr("dx",function(a,b){return b&1?8:-8}).attr("x",function(a,b){return b&1?c:0}).attr("y",w).attr("text-anchor",function(a,b){return b&1?"start":"end"}).text(C).transition().duration(e).attr("y",v),D.text(C).transition().duration(e).attr("y",v)})}var c=1,d=1,e=0,f=null,g=Number,h=a,i=b,j=null;k.width=function(a){if(!arguments.length)return c;c=a;return k},k.height=function(a){if(!arguments.length)return d;d=a;return k},k.tickFormat=function(a){if(!arguments.length)return j;j=a;return k},k.duration=function(a){if(!arguments.length)return e;e=a;return k},k.domain=function(a){if(!arguments.length)return f;f=d3.functor(a);return k},k.value=function(a){if(!arguments.length)return g;g=a;return k},k.whiskers=function(a){if(!arguments.length)return h;h=a;return k},k.quartiles=function(a){if(!arguments.length)return i;i=a;return k};return k},d3.chart.bullet=function(){function o(a){a.each(function(a,c){var d=i.call(this,a,c).slice().sort(d3.descending),e=j.call(this,a,c).slice().sort(d3.descending),o=k.call(this,a,c).slice().sort(d3.descending),p=d3.select(this),q=d3.scale.linear().domain([0,Math.max(d[0],e[0],o[0])]).range(b?[l,0]:[0,l]),r=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(q.range());this.__chart__=q;var s=g(r),t=g(q),u=p.selectAll("rect.range").data(d);u.enter().append("svg:rect").attr("class",function(a,b){return"range s"+b}).attr("width",s).attr("height",m).attr("x",b?r:0).transition().duration(h).attr("width",t).attr("x",b?q:0),u.transition().duration(h).attr("x",b?q:0).attr("width",t).attr("height",m);var v=p.selectAll("rect.measure").data(o);v.enter().append("svg:rect").attr("class",function(a,b){return"measure s"+b}).attr("width",s).attr("height",m/3).attr("x",b?r:0).attr("y",m/3).transition().duration(h).attr("width",t).attr("x",b?q:0),v.transition().duration(h).attr("width",t).attr("height",m/3).attr("x",b?q:0).attr("y",m/3);var w=p.selectAll("line.marker").data(e);w.enter().append("svg:line").attr("class","marker").attr("x1",r).attr("x2",r).attr("y1",m/6).attr("y2",m*5/6).transition().duration(h).attr("x1",q).attr("x2",q),w.transition().duration(h).attr("x1",q).attr("x2",q).attr("y1",m/6).attr("y2",m*5/6);var x=n||q.tickFormat(8),y=p.selectAll("g.tick").data(q.ticks(8),function(a){return this.textContent||x(a)}),z=y.enter().append("svg:g").attr("class","tick").attr("transform",f(r)).attr("opacity",1e-6);z.append("svg:line").attr("y1",m).attr("y2",m*7/6),z.append("svg:text").attr("text-anchor","middle").attr("dy","1em").attr("y",m*7/6).text(x),z.transition().duration(h).attr("transform",f(q)).attr("opacity",1);var A=y.transition().duration(h).attr("transform",f(q)).attr("opacity",1);A.select("line").attr("y1",m).attr("y2",m*7/6),A.select("text").attr("y",m*7/6),y.exit().transition().duration(h).attr("transform",f(q)).attr("opacity",1e-6).remove()})}var a="left",b=!1,h=0,i=c,j=d,k=e,l=380,m=30,n=null;o.orient=function(c){if(!arguments.length)return a;a=c,b=a=="right"||a=="bottom";return o},o.ranges=function(a){if(!arguments.length)return i;i=a;return o},o.markers=function(a){if(!arguments.length)return j;j=a;return o},o.measures=function(a){if(!arguments.length)return k;k=a;return o},o.width=function(a){if(!arguments.length)return l;l=a;return o},o.height=function(a){if(!arguments.length)return m;m=a;return o},o.tickFormat=function(a){if(!arguments.length)return n;n=a;return o},o.duration=function(a){if(!arguments.length)return h;h=a;return o};return o}})()
<ide>\ No newline at end of file
<add>(function(){function g(a){var b=a(0);return function(c){return Math.abs(a(c)-b)}}function f(a){return function(b){return"translate("+a(b)+",0)"}}function e(a){return a.measures}function d(a){return a.markers}function c(a){return a.ranges}function b(a){var b=a.length;return[.25,.5,.75].map(function(c){c*=b;if(parseInt(c)===c)return(a[c]+c[c+1])/2;return a[Math.round(c)]})}function a(a){return[0,a.length-1]}d3.chart={},d3.chart.boxplot=function(){function k(a){a.each(function(a,b){a=a.map(g).sort(d3.ascending);var k=a.length,l=a[0],m=a[k-1],n=h.call(this,a,b),o=n.map(function(b){return a[b]}),p=n[0],q=n[n.length-1],r=q-p,s=i(a.slice(p,q)),t=a.slice(0,p).concat(a.slice(q+1,k)),u=d3.select(this),v=d3.scale.linear().domain(f?f.call(this,a,b):[l,m]).range([d,0]),w=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(v.range());this.__chart__=v;var x=u.selectAll("line.center").data([[o[0],o[o.length-1]]]);x.enter().append("svg:line").attr("class","center").attr("x1",c/2).attr("y1",function(a){return w(a[0])}).attr("x2",c/2).attr("y2",function(a){return w(a[1])}).transition().duration(e).attr("y1",function(a){return v(a[0])}).attr("y2",function(a){return v(a[1])}),x.transition().duration(e).attr("y1",function(a){return v(a[0])}).attr("y2",function(a){return v(a[1])}),x.exit().remove();var y=u.selectAll("rect.box").data([[s[0],s[2]]]);y.enter().append("svg:rect").attr("class","box").attr("x",0).attr("y",function(a){return w(a[1])}).attr("width",c).attr("height",function(a){return w(a[0])-w(a[1])}).transition().duration(e).attr("y",function(a){return v(a[1])}).attr("height",function(a){return v(a[0])-v(a[1])}),y.transition().duration(e).attr("y",function(a){return v(a[1])}).attr("height",function(a){return v(a[0])-v(a[1])}),y.exit().remove();var z=u.selectAll("line.median").data([s[1]]);z.enter().append("svg:line").attr("class","median").attr("x1",0).attr("y1",w).attr("x2",c).attr("y2",w).transition().duration(e).attr("y1",v).attr("y2",v),z.transition().duration(e).attr("y1",v).attr("y2",v),z.exit().remove();var A=u.selectAll("line.whisker").data(o);A.enter().append("svg:line").attr("class","whisker").attr("x1",0).attr("y1",w).attr("x2",c).attr("y2",w).transition().duration(e).attr("y1",v).attr("y2",v),A.transition().duration(e).attr("y1",v).attr("y2",v),A.exit().remove();var B=u.selectAll("circle.outlier").data(t);B.enter().append("svg:circle").attr("class","outlier").attr("r",5).attr("cx",c/2).attr("cy",w).transition().duration(e).attr("cy",v),B.transition().duration(e).attr("cy",v),B.exit().remove();var C=j||v.tickFormat(8),D=u.selectAll("text").data(s.concat(o));D.enter().append("svg:text").attr("dy",".3em").attr("dx",function(a,b){return b&1?8:-8}).attr("x",function(a,b){return b&1?c:0}).attr("y",w).attr("text-anchor",function(a,b){return b&1?"start":"end"}).text(C).transition().duration(e).attr("y",v),D.text(C).transition().duration(e).attr("y",v)})}var c=1,d=1,e=0,f=null,g=Number,h=a,i=b,j=null;k.width=function(a){if(!arguments.length)return c;c=a;return k},k.height=function(a){if(!arguments.length)return d;d=a;return k},k.tickFormat=function(a){if(!arguments.length)return j;j=a;return k},k.duration=function(a){if(!arguments.length)return e;e=a;return k},k.domain=function(a){if(!arguments.length)return f;f=d3.functor(a);return k},k.value=function(a){if(!arguments.length)return g;g=a;return k},k.whiskers=function(a){if(!arguments.length)return h;h=a;return k},k.quartiles=function(a){if(!arguments.length)return i;i=a;return k};return k},d3.chart.bullet=function(){function o(a){a.each(function(a,c){var d=i.call(this,a,c).slice().sort(d3.descending),e=j.call(this,a,c).slice().sort(d3.descending),o=k.call(this,a,c).slice().sort(d3.descending),p=d3.select(this),q=d3.scale.linear().domain([0,Math.max(d[0],e[0],o[0])]).range(b?[l,0]:[0,l]),r=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(q.range());this.__chart__=q;var s=g(r),t=g(q),u=p.selectAll("rect.range").data(d);u.enter().append("svg:rect").attr("class",function(a,b){return"range s"+b}).attr("width",s).attr("height",m).attr("x",b?r:0).transition().duration(h).attr("width",t).attr("x",b?q:0),u.transition().duration(h).attr("x",b?q:0).attr("width",t).attr("height",m);var v=p.selectAll("rect.measure").data(o);v.enter().append("svg:rect").attr("class",function(a,b){return"measure s"+b}).attr("width",s).attr("height",m/3).attr("x",b?r:0).attr("y",m/3).transition().duration(h).attr("width",t).attr("x",b?q:0),v.transition().duration(h).attr("width",t).attr("height",m/3).attr("x",b?q:0).attr("y",m/3);var w=p.selectAll("line.marker").data(e);w.enter().append("svg:line").attr("class","marker").attr("x1",r).attr("x2",r).attr("y1",m/6).attr("y2",m*5/6).transition().duration(h).attr("x1",q).attr("x2",q),w.transition().duration(h).attr("x1",q).attr("x2",q).attr("y1",m/6).attr("y2",m*5/6);var x=n||q.tickFormat(8),y=p.selectAll("g.tick").data(q.ticks(8),function(a){return this.textContent||x(a)}),z=y.enter().append("svg:g").attr("class","tick").attr("transform",f(r)).attr("opacity",1e-6);z.append("svg:line").attr("y1",m).attr("y2",m*7/6),z.append("svg:text").attr("text-anchor","middle").attr("dy","1em").attr("y",m*7/6).text(x),z.transition().duration(h).attr("transform",f(q)).attr("opacity",1);var A=y.transition().duration(h).attr("transform",f(q)).attr("opacity",1);A.select("line").attr("y1",m).attr("y2",m*7/6),A.select("text").attr("y",m*7/6),y.exit().transition().duration(h).attr("transform",f(q)).attr("opacity",1e-6).remove()})}var a="left",b=!1,h=0,i=c,j=d,k=e,l=380,m=30,n=null;o.orient=function(c){if(!arguments.length)return a;a=c,b=a=="right"||a=="bottom";return o},o.ranges=function(a){if(!arguments.length)return i;i=a;return o},o.markers=function(a){if(!arguments.length)return j;j=a;return o},o.measures=function(a){if(!arguments.length)return k;k=a;return o},o.width=function(a){if(!arguments.length)return l;l=a;return o},o.height=function(a){if(!arguments.length)return m;m=a;return o},o.tickFormat=function(a){if(!arguments.length)return n;n=a;return o},o.duration=function(a){if(!arguments.length)return h;h=a;return o};return o}})()
<ide>\ No newline at end of file
<ide><path>src/chart/boxplot.js
<ide> d3.chart.boxplot = function() {
<ide>
<ide> // Update center line.
<ide> var center = g.selectAll("line.center")
<del> .data([[min, max]]);
<add> .data([[whiskerData[0], whiskerData[whiskerData.length - 1]]]);
<ide>
<ide> center.enter().append("svg:line")
<ide> .attr("class", "center") | 3 |
Python | Python | clarify qa pipeline output based on character | 4bbad604ebddcb64f37e83cacbb54202ea4466e4 | <ide><path>src/transformers/pipelines/question_answering.py
<ide> def __call__(self, *args, **kwargs):
<ide> A :obj:`dict` or a list of :obj:`dict`: Each result comes as a dictionary with the following keys:
<ide>
<ide> - **score** (:obj:`float`) -- The probability associated to the answer.
<del> - **start** (:obj:`int`) -- The start index of the answer (in the tokenized version of the input).
<del> - **end** (:obj:`int`) -- The end index of the answer (in the tokenized version of the input).
<add> - **start** (:obj:`int`) -- The character start index of the answer (in the tokenized version of the
<add> input).
<add> - **end** (:obj:`int`) -- The character end index of the answer (in the tokenized version of the input).
<ide> - **answer** (:obj:`str`) -- The answer to the question.
<ide> """
<ide> # Set defaults values | 1 |
Python | Python | handle queued tasks from multiple jobs/executors | 43bdd7a4c876f9ac2d4c357d9c30c0956a1b0d76 | <ide><path>airflow/executors/base_executor.py
<ide> def start(self): # pragma: no cover
<ide> """
<ide> pass
<ide>
<del> def queue_command(self, key, command, priority=1, queue=None):
<add> def queue_command(self, task_instance, command, priority=1, queue=None):
<add> key = task_instance.key
<ide> if key not in self.queued_tasks and key not in self.running:
<ide> self.logger.info("Adding to queue: {}".format(command))
<del> self.queued_tasks[key] = (command, priority, queue)
<add> self.queued_tasks[key] = (command, priority, queue, task_instance)
<ide>
<ide> def queue_task_instance(
<ide> self,
<ide> def queue_task_instance(
<ide> pool=pool,
<ide> pickle_id=pickle_id)
<ide> self.queue_command(
<del> task_instance.key,
<add> task_instance,
<ide> command,
<ide> priority=task_instance.task.priority_weight_total,
<ide> queue=task_instance.task.queue)
<ide> def sync(self):
<ide> pass
<ide>
<ide> def heartbeat(self):
<del> # Calling child class sync method
<del> self.logger.debug("Calling the {} sync method".format(self.__class__))
<del> self.sync()
<ide>
<ide> # Triggering new jobs
<ide> if not self.parallelism:
<ide> def heartbeat(self):
<ide> key=lambda x: x[1][1],
<ide> reverse=True)
<ide> for i in range(min((open_slots, len(self.queued_tasks)))):
<del> key, (command, priority, queue) = sorted_queue.pop(0)
<del> self.running[key] = command
<add> key, (command, _, queue, ti) = sorted_queue.pop(0)
<add> # TODO(jlowin) without a way to know what Job ran which tasks,
<add> # there is a danger that another Job started running a task
<add> # that was also queued to this executor. This is the last chance
<add> # to check if that hapened. The most probable way is that a
<add> # Scheduler tried to run a task that was originally queued by a
<add> # Backfill. This fix reduces the probability of a collision but
<add> # does NOT eliminate it.
<ide> self.queued_tasks.pop(key)
<del> self.execute_async(key, command=command, queue=queue)
<add> ti.refresh_from_db()
<add> if ti.state != State.RUNNING:
<add> self.running[key] = command
<add> self.execute_async(key, command=command, queue=queue)
<add> else:
<add> self.logger.debug(
<add> 'Task is already running, not sending to '
<add> 'executor: {}'.format(key))
<add>
<add> # Calling child class sync method
<add> self.logger.debug("Calling the {} sync method".format(self.__class__))
<add> self.sync()
<ide>
<ide> def change_state(self, key, state):
<ide> self.running.pop(key)
<ide><path>airflow/executors/celery_executor.py
<ide> def end(self, synchronous=False):
<ide> async.state not in celery_states.READY_STATES
<ide> for async in self.tasks.values()]):
<ide> time.sleep(5)
<add> self.sync()
<ide><path>airflow/executors/local_executor.py
<ide> def end(self):
<ide> [self.queue.put((None, None)) for w in self.workers]
<ide> # Wait for commands to finish
<ide> self.queue.join()
<del>
<add> self.sync()
<ide><path>airflow/jobs.py
<ide> def __init__(
<ide>
<ide> self.refresh_dags_every = refresh_dags_every
<ide> self.do_pickle = do_pickle
<del> self.queued_tis = set()
<ide> super(SchedulerJob, self).__init__(*args, **kwargs)
<ide>
<ide> self.heartrate = conf.getint('scheduler', 'SCHEDULER_HEARTBEAT_SEC')
<ide> def process_dag(self, dag, queue):
<ide>
<ide> session.close()
<ide>
<del> def process_events(self, executor, dagbag):
<del> """
<del> Respond to executor events.
<del>
<del> Used to identify queued tasks and schedule them for further processing.
<del> """
<del> for key, executor_state in list(executor.get_event_buffer().items()):
<del> dag_id, task_id, execution_date = key
<del> if dag_id not in dagbag.dags:
<del> self.logger.error(
<del> 'Executor reported a dag_id that was not found in the '
<del> 'DagBag: {}'.format(dag_id))
<del> continue
<del> elif not dagbag.dags[dag_id].has_task(task_id):
<del> self.logger.error(
<del> 'Executor reported a task_id that was not found in the '
<del> 'dag: {} in dag {}'.format(task_id, dag_id))
<del> continue
<del> task = dagbag.dags[dag_id].get_task(task_id)
<del> ti = models.TaskInstance(task, execution_date)
<del> ti.refresh_from_db()
<del>
<del> if executor_state == State.SUCCESS:
<del> # collect queued tasks for prioritiztion
<del> if ti.state == State.QUEUED:
<del> self.queued_tis.add(ti)
<del> else:
<del> # special instructions for failed executions could go here
<del> pass
<del>
<ide> @provide_session
<ide> def prioritize_queued(self, session, executor, dagbag):
<ide> # Prioritizing queued task instances
<ide>
<ide> pools = {p.pool: p for p in session.query(models.Pool).all()}
<del>
<add> TI = models.TaskInstance
<add> queued_tis = (
<add> session.query(TI)
<add> .filter(TI.state == State.QUEUED)
<add> .all()
<add> )
<ide> self.logger.info(
<del> "Prioritizing {} queued jobs".format(len(self.queued_tis)))
<add> "Prioritizing {} queued jobs".format(len(queued_tis)))
<ide> session.expunge_all()
<ide> d = defaultdict(list)
<del> for ti in self.queued_tis:
<add> for ti in queued_tis:
<ide> if ti.dag_id not in dagbag.dags:
<ide> self.logger.info(
<ide> "DAG no longer in dagbag, deleting {}".format(ti))
<ide> def prioritize_queued(self, session, executor, dagbag):
<ide> else:
<ide> d[ti.pool].append(ti)
<ide>
<del> self.queued_tis.clear()
<del>
<ide> dag_blacklist = set(dagbag.paused_dags())
<ide> for pool, tis in list(d.items()):
<ide> if not pool:
<ide> def prioritize_queued(self, session, executor, dagbag):
<ide> open_slots -= 1
<ide> else:
<ide> session.delete(ti)
<add> session.commit()
<ide> continue
<ide> ti.task = task
<ide>
<ide> def _execute(self):
<ide> try:
<ide> loop_start_dttm = datetime.now()
<ide> try:
<del> self.process_events(executor=executor, dagbag=dagbag)
<ide> self.prioritize_queued(executor=executor, dagbag=dagbag)
<ide> except Exception as e:
<ide> self.logger.exception(e)
<ide><path>tests/dags/test_issue_1225.py
<ide> from airflow.models import DAG
<ide> from airflow.operators import DummyOperator, PythonOperator, SubDagOperator
<ide> from airflow.utils.trigger_rule import TriggerRule
<add>import time
<add>
<ide> DEFAULT_DATE = datetime(2016, 1, 1)
<ide> default_args = dict(
<ide> start_date=DEFAULT_DATE,
<ide> def fail():
<ide> raise ValueError('Expected failure.')
<ide>
<add>def delayed_fail():
<add> """
<add> Delayed failure to make sure that processes are running before the error
<add> is raised.
<add>
<add> TODO handle more directly (without sleeping)
<add> """
<add> time.sleep(5)
<add> raise ValueError('Expected failure.')
<add>
<ide> # DAG tests backfill with pooled tasks
<ide> # Previously backfill would queue the task but never run it
<ide> dag1 = DAG(dag_id='test_backfill_pooled_task_dag', default_args=default_args)
<ide> def fail():
<ide> end_date=DEFAULT_DATE,
<ide> default_args=default_args)
<ide> dag8_task1 = PythonOperator(
<del> python_callable=fail,
<add> # use delayed_fail because otherwise LocalExecutor will have a chance to
<add> # complete the task
<add> python_callable=delayed_fail,
<ide> task_id='test_queued_task',
<ide> dag=dag8,
<ide> pool='test_queued_pool')
<ide><path>tests/jobs.py
<ide>
<ide> from airflow import AirflowException, settings
<ide> from airflow.bin import cli
<add>from airflow.executors import DEFAULT_EXECUTOR
<ide> from airflow.jobs import BackfillJob, SchedulerJob
<del>from airflow.models import DagBag, DagRun, Pool, TaskInstance as TI
<add>from airflow.models import DAG, DagBag, DagRun, Pool, TaskInstance as TI
<add>from airflow.operators import DummyOperator
<add>from airflow.utils.db import provide_session
<ide> from airflow.utils.state import State
<ide> from airflow.utils.timeout import timeout
<del>from airflow.utils.db import provide_session
<ide>
<ide> from airflow import configuration
<ide> configuration.test_mode()
<ide> def test_scheduler_pooled_tasks(self):
<ide> dag = self.dagbag.get_dag(dag_id)
<ide> dag.clear()
<ide>
<del> scheduler = SchedulerJob(dag_id, num_runs=10)
<add> scheduler = SchedulerJob(dag_id, num_runs=1)
<ide> scheduler.run()
<ide>
<ide> task_1 = dag.tasks[0]
<ide> logging.info("Trying to find task {}".format(task_1))
<ide> ti = TI(task_1, dag.start_date)
<ide> ti.refresh_from_db()
<del> self.assertEqual(ti.state, State.FAILED)
<add> self.assertEqual(ti.state, State.QUEUED)
<ide>
<add> # now we use a DIFFERENT scheduler and executor
<add> # to simulate the num-runs CLI arg
<add> scheduler2 = SchedulerJob(
<add> dag_id,
<add> num_runs=5,
<add> executor=DEFAULT_EXECUTOR.__class__())
<add> scheduler2.run()
<add>
<add> ti.refresh_from_db()
<add> self.assertEqual(ti.state, State.FAILED)
<ide> dag.clear()
<ide>
<ide> def test_dagrun_deadlock_ignore_depends_on_past_advance_ex_date(self): | 6 |
Javascript | Javascript | remove unneeded constants | cc2ddada5869f66616b130a82e5bc7372b6c4b53 | <ide><path>examples/jsm/nodes/ShaderNode.js
<ide> export const step = new ShaderNodeProxy( MathNode, 'step' );
<ide> export const tan = new ShaderNodeProxy( MathNode, 'tan' );
<ide> export const transformDirection = new ShaderNodeProxy( MathNode, 'transformDirection' );
<ide>
<del>export const PI = float( Math.PI );
<del>export const PI2 = float( Math.PI * 2 );
<del>export const PI_HALF = float( Math.PI / 2 );
<del>export const RECIPROCAL_PI = float( 1 / Math.PI );
<del>export const RECIPROCAL_PI2 = float( 1 / ( 2 * Math.PI ) );
<ide> export const EPSILON = float( 1e-6 );
<ide> export const INFINITY = float( 1e6 );
<ide><path>examples/jsm/nodes/functions/BSDFs.js
<ide> import { ShaderNode,
<ide> cond, greaterThan, and,
<ide> transformedNormalView, positionViewDirection,
<ide> diffuseColor, specularColor, roughness,
<del> PI, RECIPROCAL_PI, EPSILON
<add> EPSILON
<ide> } from '../ShaderNode.js';
<ide>
<ide> export const F_Schlick = new ShaderNode( ( inputs ) => {
<ide> export const F_Schlick = new ShaderNode( ( inputs ) => {
<ide>
<ide> export const BRDF_Lambert = new ShaderNode( ( inputs ) => {
<ide>
<del> return mul( RECIPROCAL_PI, inputs.diffuseColor ); // punctual light
<add> return mul( 1 / Math.PI, inputs.diffuseColor ); // punctual light
<ide>
<ide> } ); // validated
<ide>
<ide> export const D_GGX = new ShaderNode( ( inputs ) => {
<ide>
<ide> const denom = add( mul( pow2( dotNH ), sub( a2, 1.0 ) ), 1.0 ); // avoid alpha = 0 with dotNH = 1
<ide>
<del> return mul( RECIPROCAL_PI, div( a2, pow2( denom ) ) );
<add> return mul( 1 / Math.PI, div( a2, pow2( denom ) ) );
<ide>
<ide> } ); // validated
<ide>
<ide> export const RE_Direct_Physical = new ShaderNode( ( inputs ) => {
<ide> const dotNL = saturate( dot( transformedNormalView, lightDirection ) );
<ide> let irradiance = mul( dotNL, lightColor );
<ide>
<del> irradiance = mul( irradiance, PI ); // punctual light
<add> irradiance = mul( irradiance, Math.PI ); // punctual light
<ide>
<ide> addTo( directDiffuse, mul( irradiance, BRDF_Lambert( { diffuseColor: diffuseColor.rgb } ) ) );
<ide>
<ide><path>examples/jsm/nodes/utils/OscNode.js
<ide> import Node from '../core/Node.js';
<ide> import TimerNode from './TimerNode.js';
<del>import { abs, fract, round, sin, add, sub, mul, PI2 } from '../ShaderNode.js';
<add>import { abs, fract, round, sin, add, sub, mul } from '../ShaderNode.js';
<ide>
<ide> class OscNode extends Node {
<ide>
<ide> class OscNode extends Node {
<ide>
<ide> if ( method === OscNode.SINE ) {
<ide>
<del> outputNode = add( mul( sin( mul( add( timeNode, .75 ), PI2 ) ), .5 ), .5 );
<add> outputNode = add( mul( sin( mul( add( timeNode, .75 ), Math.PI * 2 ) ), .5 ), .5 );
<ide>
<ide> } else if ( method === OscNode.SQUARE ) {
<ide> | 3 |
Ruby | Ruby | replace argv.verbose? with homebrew.args.verbose? | acde828a45c452b54413a3cd711752343e54f3cf | <ide><path>Library/Homebrew/cleaner.rb
<ide> def prune
<ide> # actual files gets removed correctly.
<ide> dirs.reverse_each do |d|
<ide> if d.children.empty?
<del> puts "rmdir: #{d} (empty)" if ARGV.verbose?
<add> puts "rmdir: #{d} (empty)" if Homebrew.args.verbose?
<ide> d.rmdir
<ide> end
<ide> end
<ide><path>Library/Homebrew/cli/parser.rb
<ide> def switch(*names, description: nil, env: nil, required_for: nil, depends_on: ni
<ide> set_constraints(name, required_for: required_for, depends_on: depends_on)
<ide> end
<ide>
<del> enable_switch(*names, from: :env) if !env.nil? && !ENV["HOMEBREW_#{env.to_s.upcase}"].nil?
<add> enable_switch(*names, from: :env) if env?(env)
<ide> end
<ide> alias switch_option switch
<ide>
<add> def env?(env)
<add> env.present? && ENV["HOMEBREW_#{env.to_s.upcase}"].present?
<add> end
<add>
<ide> def usage_banner(text)
<ide> @parser.banner = Formatter.wrap("#{text}\n", COMMAND_DESC_WIDTH)
<ide> end
<ide><path>Library/Homebrew/download_strategy.rb
<ide> def stage
<ide> ref_type: @ref_type, ref: @ref)
<ide> .extract_nestedly(basename: basename,
<ide> prioritise_extension: true,
<del> verbose: ARGV.verbose? && !shutup)
<add> verbose: Homebrew.args.verbose? && !shutup)
<ide> chdir
<ide> end
<ide>
<ide> def system_command!(*args, **options)
<ide> *args,
<ide> print_stdout: !shutup,
<ide> print_stderr: !shutup,
<del> verbose: ARGV.verbose? && !shutup,
<add> verbose: Homebrew.args.verbose? && !shutup,
<ide> env: env,
<ide> **options,
<ide> )
<ide> class NoUnzipCurlDownloadStrategy < CurlDownloadStrategy
<ide> def stage
<ide> UnpackStrategy::Uncompressed.new(cached_location)
<ide> .extract(basename: basename,
<del> verbose: ARGV.verbose? && !shutup)
<add> verbose: Homebrew.args.verbose? && !shutup)
<ide> end
<ide> end
<ide>
<ide> def fetch_repo(target, url, revision = nil, ignore_externals = false)
<ide> # This saves on bandwidth and will have a similar effect to verifying the
<ide> # cache as it will make any changes to get the right revision.
<ide> args = []
<del> args << "--quiet" unless ARGV.verbose?
<add> args << "--quiet" unless Homebrew.args.verbose?
<ide>
<ide> if revision
<ide> ohai "Checking out #{@ref}"
<ide> def repo_valid?
<ide> end
<ide>
<ide> def quiet_flag
<del> "-Q" unless ARGV.verbose?
<add> "-Q" unless Homebrew.args.verbose?
<ide> end
<ide>
<ide> def clone_repo
<ide><path>Library/Homebrew/exceptions.rb
<ide> def fetch_issues
<ide> def dump
<ide> puts
<ide>
<del> if ARGV.verbose?
<add> if Homebrew.args.verbose?
<ide> require "system_config"
<ide> require "build_environment"
<ide>
<ide><path>Library/Homebrew/extend/pathname.rb
<ide> def counts
<ide> MAXIMUM_VERBOSE_OUTPUT = 100
<ide>
<ide> def verbose?
<del> return ARGV.verbose? unless ENV["CI"]
<del> return false unless ARGV.verbose?
<add> return Homebrew.args.verbose? unless ENV["CI"]
<add> return false unless Homebrew.args.verbose?
<ide>
<ide> if total < MAXIMUM_VERBOSE_OUTPUT
<ide> true
<ide><path>Library/Homebrew/formula.rb
<ide> def head_version_outdated?(version, fetch_head: false)
<ide> return false unless head&.downloader.is_a?(VCSDownloadStrategy)
<ide>
<ide> downloader = head.downloader
<del> downloader.shutup! unless ARGV.verbose?
<add> downloader.shutup! unless Homebrew.args.verbose?
<ide> downloader.commit_outdated?(version.version.commit)
<ide> end
<ide>
<ide> def undeclared_runtime_dependencies
<ide> # # If there is a "make", "install" available, please use it!
<ide> # system "make", "install"</pre>
<ide> def system(cmd, *args)
<del> verbose = ARGV.verbose?
<add> verbose = Homebrew.args.verbose?
<ide> verbose_using_dots = !ENV["HOMEBREW_VERBOSE_USING_DOTS"].nil?
<ide>
<ide> # remove "boring" arguments so that the important ones are more likely to
<ide><path>Library/Homebrew/formula_installer.rb
<ide> def initialize(formula)
<ide> @include_test = ARGV.include?("--include-test")
<ide> @interactive = false
<ide> @git = false
<del> @verbose = ARGV.verbose?
<add> @verbose = Homebrew.args.verbose?
<ide> @quieter = ARGV.quieter?
<ide> @debug = ARGV.debug?
<ide> @installed_as_dependency = false
<ide><path>Library/Homebrew/keg.rb
<ide> def resolve_any_conflicts(dst, mode)
<ide> begin
<ide> keg = Keg.for(src)
<ide> rescue NotAKegError
<del> puts "Won't resolve conflicts for symlink #{dst} as it doesn't resolve into the Cellar" if ARGV.verbose?
<add> if Homebrew.args.verbose?
<add> puts "Won't resolve conflicts for symlink #{dst} as it doesn't resolve into the Cellar"
<add> end
<ide> return
<ide> end
<ide>
<ide> def resolve_any_conflicts(dst, mode)
<ide>
<ide> def make_relative_symlink(dst, src, mode)
<ide> if dst.symlink? && src == dst.resolved_path
<del> puts "Skipping; link already exists: #{dst}" if ARGV.verbose?
<add> puts "Skipping; link already exists: #{dst}" if Homebrew.args.verbose?
<ide> return
<ide> end
<ide>
<ide><path>Library/Homebrew/resource.rb
<ide> def fetch(verify_download_integrity: true)
<ide>
<ide> def verify_download_integrity(fn)
<ide> if fn.file?
<del> ohai "Verifying #{fn.basename} checksum" if ARGV.verbose?
<add> ohai "Verifying #{fn.basename} checksum" if Homebrew.args.verbose?
<ide> fn.verify_checksum(checksum)
<ide> end
<ide> rescue ChecksumMissingError
<ide><path>Library/Homebrew/sandbox.rb
<ide> def exec(*args)
<ide> end
<ide> end
<ide>
<del> if @failed && ARGV.verbose?
<add> if @failed && ENV["HOMEBREW_VERBOSE"].present?
<ide> ohai "Sandbox log"
<ide> puts logs
<ide> $stdout.flush # without it, brew test-bot would fail to catch the log
<ide><path>Library/Homebrew/style.rb
<ide> def check_style_impl(files, output_type, fix: false, except_cops: nil, only_cops
<ide> args << "--parallel"
<ide> end
<ide>
<del> args += ["--extra-details", "--display-cop-names"] if ARGV.verbose?
<add> args += ["--extra-details", "--display-cop-names"] if Homebrew.args.verbose?
<ide>
<ide> if except_cops
<ide> except_cops.map! { |cop| RuboCop::Cop::Cop.registry.qualified_cop_name(cop.to_s, "") }
<ide><path>Library/Homebrew/system_command.rb
<ide> def plist
<ide> end
<ide>
<ide> def warn_plist_garbage(garbage)
<del> return unless ARGV.verbose?
<add> return unless Homebrew.args.verbose?
<ide> return unless garbage.match?(/\S/)
<ide>
<ide> opoo "Received non-XML output from #{Formatter.identifier(command.first)}:"
<ide><path>Library/Homebrew/test/rubocops/lines_spec.rb
<ide> class Foo < Formula
<ide> desc "foo"
<ide> url 'https://brew.sh/foo-1.0.tgz'
<ide> def install
<del> verbose = ARGV.verbose?
<add> verbose = Homebrew.args.verbose?
<ide> end
<ide> end
<ide> RUBY
<ide><path>Library/Homebrew/test/system_command_result_spec.rb
<ide>
<ide> context "when verbose" do
<ide> before do
<del> allow(ARGV).to receive(:verbose?).and_return(true)
<add> allow(Homebrew.args).to receive(:verbose?).and_return(true)
<ide> end
<ide>
<ide> it "warns about garbage" do
<ide>
<ide> context "when verbose" do
<ide> before do
<del> allow(ARGV).to receive(:verbose?).and_return(true)
<add> allow(Homebrew.args).to receive(:verbose?).and_return(true)
<ide> end
<ide>
<ide> it "warns about garbage" do
<ide><path>Library/Homebrew/utils.rb
<ide> def _system(cmd, *args, **options)
<ide> end
<ide>
<ide> def system(cmd, *args, **options)
<del> if ARGV.verbose?
<add> if Homebrew.args.verbose?
<ide> puts "#{cmd} #{args * " "}".gsub(RUBY_PATH, "ruby")
<ide> .gsub($LOAD_PATH.join(File::PATH_SEPARATOR).to_s, "$LOAD_PATH")
<ide> end
<ide> def require?(path)
<ide> end
<ide>
<ide> def ohai_title(title)
<del> title = Tty.truncate(title) if $stdout.tty? && !ARGV.verbose?
<add> title = Tty.truncate(title) if $stdout.tty? && !Homebrew.args.verbose?
<ide> Formatter.headline(title, color: :blue)
<ide> end
<ide>
<ide> def odebug(title, *sput)
<ide> end
<ide>
<ide> def oh1(title, options = {})
<del> title = Tty.truncate(title) if $stdout.tty? && !ARGV.verbose? && options.fetch(:truncate, :auto) == :auto
<add> title = Tty.truncate(title) if $stdout.tty? && !Homebrew.args.verbose? && options.fetch(:truncate, :auto) == :auto
<ide> puts Formatter.headline(title, color: :green)
<ide> end
<ide>
<ide> def capture_stderr
<ide> end
<ide>
<ide> def nostdout
<del> if ARGV.verbose?
<add> if Homebrew.args.verbose?
<ide> yield
<ide> else
<ide> begin
<ide><path>Library/Homebrew/utils/curl.rb
<ide> def curl_args(*extra_args, show_output: false, user_agent: :default)
<ide>
<ide> unless show_output
<ide> args << "--fail"
<del> args << "--progress-bar" unless ARGV.verbose?
<add> args << "--progress-bar" unless Homebrew.args.verbose?
<ide> args << "--verbose" if ENV["HOMEBREW_CURL_VERBOSE"]
<ide> args << "--silent" unless $stdout.tty?
<ide> end | 16 |
Text | Text | remove size alias for length validation | a94186f836044d5ddaf9b185e01a99dc1c2569f8 | <ide><path>guides/source/active_record_validations.md
<ide> provide a personalized message or use `presence: true` instead. When
<ide> `:in` or `:within` have a lower limit of 1, you should either provide a
<ide> personalized message or call `presence` prior to `length`.
<ide>
<del>The `size` helper is an alias for `length`.
<del>
<ide> ### `numericality`
<ide>
<ide> This helper validates that your attributes have only numeric values. By | 1 |
Javascript | Javascript | remove excessive value from http2 benchmark | e136903700445f1d5f7555f22f69be189a14f682 | <ide><path>benchmark/http2/respond-with-fd.js
<ide> const fs = require('fs');
<ide> const file = path.join(path.resolve(__dirname, '../fixtures'), 'alice.html');
<ide>
<ide> const bench = common.createBenchmark(main, {
<del> requests: [100, 1000, 10000, 100000, 1000000],
<add> requests: [100, 1000, 10000, 100000],
<ide> streams: [100, 200, 1000],
<ide> clients: [1, 2],
<ide> benchmarker: ['h2load'] | 1 |
Javascript | Javascript | implement modifications to pull request | a920c12539991c4184fd977e9b1ec1cd01333609 | <ide><path>test/watchCases/plugins/automatic-prefetch-plugin/0/foo/c.js
<ide> module.exports = "a test";
<del>
<del>
<ide><path>test/watchCases/plugins/automatic-prefetch-plugin/0/index.js
<ide> it("should watch for changes", function() {
<ide> require("./foo/" + WATCH_STEP).should.be.eql('This is only a test.' + WATCH_STEP);
<del> if(WATCH_STEP > 0){
<del> STATS_JSON.modules[0].prefetched.should.be.true();
<del> STATS_JSON.modules[1].prefetched.should.be.true();
<del> STATS_JSON.modules[2].prefetched.should.be.true();
<del> }
<add> if(+WATCH_STEP > 0) {
<add> STATS_JSON.modules[0].prefetched.should.be.true();
<add> STATS_JSON.modules[1].prefetched.should.be.true();
<add> STATS_JSON.modules[2].prefetched.should.be.true();
<add> STATS_JSON.modules[3].prefetched.should.be.true();
<add> }
<ide> });
<ide><path>test/watchCases/plugins/automatic-prefetch-plugin/1/foo/1.js
<ide> var a = require("./a");
<ide> var b = require("./b");
<ide> var c = require("./c");
<ide>
<del>module.exports = a + b + c + '.1';
<ide>\ No newline at end of file
<add>module.exports = a + b + c + '.1';
<ide><path>test/watchCases/plugins/automatic-prefetch-plugin/1/foo/a.js
<del>module.exports = "This ";
<ide><path>test/watchCases/plugins/automatic-prefetch-plugin/1/foo/b.js
<del>module.exports = "is only ";
<ide><path>test/watchCases/plugins/automatic-prefetch-plugin/1/foo/c.js
<del>module.exports = "a test";
<del>
<del>
<ide><path>test/watchCases/plugins/automatic-prefetch-plugin/2/foo/a.js
<del>module.exports = "This ";
<ide><path>test/watchCases/plugins/automatic-prefetch-plugin/2/foo/b.js
<del>module.exports = "is only ";
<ide><path>test/watchCases/plugins/automatic-prefetch-plugin/2/foo/c.js
<del>module.exports = "a test";
<del>
<del>
<ide><path>test/watchCases/plugins/automatic-prefetch-plugin/3/foo/a.js
<del>module.exports = "This ";
<ide><path>test/watchCases/plugins/automatic-prefetch-plugin/3/foo/b.js
<del>module.exports = "is only ";
<ide><path>test/watchCases/plugins/automatic-prefetch-plugin/3/foo/c.js
<del>module.exports = "a test";
<del>
<del>
<ide><path>test/watchCases/plugins/automatic-prefetch-plugin/webpack.config.js
<ide> var webpack = require("../../../../");
<ide> module.exports = {
<ide> plugins: [
<del> new webpack.AutomaticPrefetchPlugin()
<add> new webpack.AutomaticPrefetchPlugin()
<ide> ]
<ide> }; | 13 |
Javascript | Javascript | replace string concatenation with template | 66a990b5edad89af6bc3c4d048f8ddc5463e80ab | <ide><path>test/parallel/test-http-incoming-pipelined-socket-destroy.js
<ide> const server = http.createServer(common.mustCall(function(req, res) {
<ide>
<ide> // Make a bunch of requests pipelined on the same socket
<ide> function generator(seeds) {
<add> const port = server.address().port;
<ide> return seeds.map(function(r) {
<del> return 'GET /' + r + ' HTTP/1.1\r\n' +
<del> `Host: localhost:${server.address().port}\r\n` +
<add> return `GET /${r} HTTP/1.1\r\n` +
<add> `Host: localhost:${port}\r\n` +
<ide> '\r\n' +
<ide> '\r\n';
<ide> }).join(''); | 1 |
Text | Text | add explicit bracket for markdown reference links | 24011de9071fcd092fab29719d3fa8269a95288a | <ide><path>doc/api/assert.md
<ide> All instances contain the built-in `Error` properties (`message` and `name`)
<ide> and:
<ide>
<ide> * `actual` {any} Set to the `actual` argument for methods such as
<del> [`assert.strictEqual()`].
<add> [`assert.strictEqual()`][].
<ide> * `expected` {any} Set to the `expected` value for methods such as
<del> [`assert.strictEqual()`].
<add> [`assert.strictEqual()`][].
<ide> * `generatedMessage` {boolean} Indicates if the message was auto-generated
<ide> (`true`) or not.
<ide> * `code` {string} Value is always `ERR_ASSERTION` to show that the error is an
<ide> If `message` is falsy, the error message is set as the values of `actual` and
<ide> `message` is provided as third argument it will be used as the error message and
<ide> the other arguments will be stored as properties on the thrown object. If
<ide> `stackStartFn` is provided, all stack frames above that function will be
<del>removed from stacktrace (see [`Error.captureStackTrace`]). If no arguments are
<add>removed from stacktrace (see [`Error.captureStackTrace`][]). If no arguments are
<ide> given, the default message `Failed` will be used.
<ide>
<ide> ```js
<ide><path>doc/api/crypto.md
<ide> and Ed448 are currently supported.
<ide>
<ide> If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function
<ide> behaves as if [`keyObject.export()`][] had been called on its result. Otherwise,
<del>the respective part of the key is returned as a [`KeyObject`].
<add>the respective part of the key is returned as a [`KeyObject`][].
<ide>
<ide> It is recommended to encode public keys as `'spki'` and private keys as
<ide> `'pkcs8'` with encryption for long-term storage:
<ide> and Ed448 are currently supported.
<ide>
<ide> If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function
<ide> behaves as if [`keyObject.export()`][] had been called on its result. Otherwise,
<del>the respective part of the key is returned as a [`KeyObject`].
<add>the respective part of the key is returned as a [`KeyObject`][].
<ide>
<ide> When encoding public keys, it is recommended to use `'spki'`. When encoding
<ide> private keys, it is recommended to use `'pks8'` with a strong passphrase, and to
<ide><path>doc/api/deprecations.md
<ide> changes:
<ide>
<ide> Type: Documentation-only
<ide>
<del>Prefer [`response.socket`][] over [`response.connection`] and
<del>[`request.socket`][] over [`request.connection`].
<add>Prefer [`response.socket`][] over [`response.connection`][] and
<add>[`request.socket`][] over [`request.connection`][].
<ide>
<ide> <a id="DEP0134"></a>
<ide> ### DEP0134: process._tickCallback
<ide><path>doc/api/errors.md
<ide> system error.
<ide> * {number}
<ide>
<ide> The `error.errno` property is a negative number which corresponds
<del>to the error code defined in [`libuv Error handling`].
<add>to the error code defined in [`libuv Error handling`][].
<ide>
<ide> On Windows the error number provided by the system will be normalized by libuv.
<ide>
<ide> To get the string representation of the error code, use
<del>[`util.getSystemErrorName(error.errno)`].
<add>[`util.getSystemErrorName(error.errno)`][].
<ide>
<ide> ### error.info
<ide>
<ide> semantics for determining whether a path can be used is platform-dependent.
<ide> ### ERR_INVALID_HANDLE_TYPE
<ide>
<ide> An attempt was made to send an unsupported "handle" over an IPC communication
<del>channel to a child process. See [`subprocess.send()`] and [`process.send()`] for
<del>more information.
<add>channel to a child process. See [`subprocess.send()`][] and [`process.send()`][]
<add>for more information.
<ide>
<ide> <a id="ERR_INVALID_HTTP_TOKEN"></a>
<ide> ### ERR_INVALID_HTTP_TOKEN
<ide> for more information.
<ide> ### ERR_MANIFEST_ASSERT_INTEGRITY
<ide>
<ide> An attempt was made to load a resource, but the resource did not match the
<del>integrity defined by the policy manifest. See the documentation for [policy]
<add>integrity defined by the policy manifest. See the documentation for [policy][]
<ide> manifests for more information.
<ide>
<ide> <a id="ERR_MANIFEST_DEPENDENCY_MISSING"></a>
<ide> ### ERR_MANIFEST_DEPENDENCY_MISSING
<ide>
<ide> An attempt was made to load a resource, but the resource was not listed as a
<ide> dependency from the location that attempted to load it. See the documentation
<del>for [policy] manifests for more information.
<add>for [policy][] manifests for more information.
<ide>
<ide> <a id="ERR_MANIFEST_INTEGRITY_MISMATCH"></a>
<ide> ### ERR_MANIFEST_INTEGRITY_MISMATCH
<ide>
<ide> An attempt was made to load a policy manifest, but the manifest had multiple
<ide> entries for a resource which did not match each other. Update the manifest
<ide> entries to match in order to resolve this error. See the documentation for
<del>[policy] manifests for more information.
<add>[policy][] manifests for more information.
<ide>
<ide> <a id="ERR_MANIFEST_INVALID_RESOURCE_FIELD"></a>
<ide> ### ERR_MANIFEST_INVALID_RESOURCE_FIELD
<ide>
<ide> A policy manifest resource had an invalid value for one of its fields. Update
<ide> the manifest entry to match in order to resolve this error. See the
<del>documentation for [policy] manifests for more information.
<add>documentation for [policy][] manifests for more information.
<ide>
<ide> <a id="ERR_MANIFEST_PARSE_POLICY"></a>
<ide> ### ERR_MANIFEST_PARSE_POLICY
<ide>
<ide> An attempt was made to load a policy manifest, but the manifest was unable to
<del>be parsed. See the documentation for [policy] manifests for more information.
<add>be parsed. See the documentation for [policy][] manifests for more information.
<ide>
<ide> <a id="ERR_MANIFEST_TDZ"></a>
<ide> ### ERR_MANIFEST_TDZ
<ide> initialization has not yet taken place. This is likely a bug in Node.js.
<ide> ### ERR_MANIFEST_UNKNOWN_ONERROR
<ide>
<ide> A policy manifest was loaded, but had an unknown value for its "onerror"
<del>behavior. See the documentation for [policy] manifests for more information.
<add>behavior. See the documentation for [policy][] manifests for more information.
<ide>
<ide> <a id="ERR_MEMORY_ALLOCATION_FAILED"></a>
<ide> ### ERR_MEMORY_ALLOCATION_FAILED
<ide><path>doc/api/fs.md
<ide> Using `fs.stat()` to check for the existence of a file before calling
<ide> Instead, user code should open/read/write the file directly and handle the
<ide> error raised if the file is not available.
<ide>
<del>To check if a file exists without manipulating it afterwards, [`fs.access()`]
<add>To check if a file exists without manipulating it afterwards, [`fs.access()`][]
<ide> is recommended.
<ide>
<ide> For example, given the following folder structure:
<ide> The recursive option is only supported on macOS and Windows.
<ide> This feature depends on the underlying operating system providing a way
<ide> to be notified of filesystem changes.
<ide>
<del>* On Linux systems, this uses [`inotify(7)`].
<del>* On BSD systems, this uses [`kqueue(2)`].
<del>* On macOS, this uses [`kqueue(2)`] for files and [`FSEvents`] for directories.
<del>* On SunOS systems (including Solaris and SmartOS), this uses [`event ports`].
<del>* On Windows systems, this feature depends on [`ReadDirectoryChangesW`].
<del>* On Aix systems, this feature depends on [`AHAFS`], which must be enabled.
<add>* On Linux systems, this uses [`inotify(7)`][].
<add>* On BSD systems, this uses [`kqueue(2)`][].
<add>* On macOS, this uses [`kqueue(2)`][] for files and [`FSEvents`][] for
<add> directories.
<add>* On SunOS systems (including Solaris and SmartOS), this uses [`event ports`][].
<add>* On Windows systems, this feature depends on [`ReadDirectoryChangesW`][].
<add>* On Aix systems, this feature depends on [`AHAFS`][], which must be enabled.
<ide>
<ide> If the underlying functionality is not available for some reason, then
<ide> `fs.watch` will not be able to function. For example, watching files or
<ide><path>doc/api/globals.md
<ide> Used to handle binary data. See the [buffer section][].
<ide>
<ide> ## \_\_dirname
<ide>
<del>This variable may appear to be global but is not. See [`__dirname`].
<add>This variable may appear to be global but is not. See [`__dirname`][].
<ide>
<ide> ## \_\_filename
<ide>
<del>This variable may appear to be global but is not. See [`__filename`].
<add>This variable may appear to be global but is not. See [`__filename`][].
<ide>
<ide> ## clearImmediate(immediateObject)
<ide> <!-- YAML
<ide> added: v0.9.1
<ide>
<ide> <!--type=global-->
<ide>
<del>[`clearImmediate`] is described in the [timers][] section.
<add>[`clearImmediate`][] is described in the [timers][] section.
<ide>
<ide> ## clearInterval(intervalObject)
<ide> <!-- YAML
<ide> added: v0.0.1
<ide>
<ide> <!--type=global-->
<ide>
<del>[`clearInterval`] is described in the [timers][] section.
<add>[`clearInterval`][] is described in the [timers][] section.
<ide>
<ide> ## clearTimeout(timeoutObject)
<ide> <!-- YAML
<ide> added: v0.0.1
<ide>
<ide> <!--type=global-->
<ide>
<del>[`clearTimeout`] is described in the [timers][] section.
<add>[`clearTimeout`][] is described in the [timers][] section.
<ide>
<ide> ## console
<ide> <!-- YAML
<ide> Used to print to stdout and stderr. See the [`console`][] section.
<ide>
<ide> ## exports
<ide>
<del>This variable may appear to be global but is not. See [`exports`].
<add>This variable may appear to be global but is not. See [`exports`][].
<ide>
<ide> ## global
<ide> <!-- YAML
<ide> Node.js this is different. The top-level scope is not the global scope;
<ide>
<ide> ## module
<ide>
<del>This variable may appear to be global but is not. See [`module`].
<add>This variable may appear to be global but is not. See [`module`][].
<ide>
<ide> ## process
<ide> <!-- YAML
<ide> DataHandler.prototype.load = async function load(key) {
<ide>
<ide> ## require()
<ide>
<del>This variable may appear to be global but is not. See [`require()`].
<add>This variable may appear to be global but is not. See [`require()`][].
<ide>
<ide> ## setImmediate(callback[, ...args])
<ide> <!-- YAML
<ide> added: v0.9.1
<ide>
<ide> <!-- type=global -->
<ide>
<del>[`setImmediate`] is described in the [timers][] section.
<add>[`setImmediate`][] is described in the [timers][] section.
<ide>
<ide> ## setInterval(callback, delay[, ...args])
<ide> <!-- YAML
<ide> added: v0.0.1
<ide>
<ide> <!-- type=global -->
<ide>
<del>[`setInterval`] is described in the [timers][] section.
<add>[`setInterval`][] is described in the [timers][] section.
<ide>
<ide> ## setTimeout(callback, delay[, ...args])
<ide> <!-- YAML
<ide> added: v0.0.1
<ide>
<ide> <!-- type=global -->
<ide>
<del>[`setTimeout`] is described in the [timers][] section.
<add>[`setTimeout`][] is described in the [timers][] section.
<ide>
<ide> ## TextDecoder
<ide> <!-- YAML
<ide><path>doc/api/http.md
<ide> the requests to that server, but each one will occur over a new connection.
<ide> When a connection is closed by the client or the server, it is removed
<ide> from the pool. Any unused sockets in the pool will be unrefed so as not
<ide> to keep the Node.js process running when there are no outstanding requests.
<del>(see [`socket.unref()`]).
<add>(see [`socket.unref()`][]).
<ide>
<ide> It is good practice, to [`destroy()`][] an `Agent` instance when it is no
<ide> longer in use, because unused sockets consume OS resources.
<ide><path>doc/api/http2.md
<ide> added: v9.4.0
<ide> -->
<ide>
<ide> Calls [`ref()`][`net.Socket.prototype.ref()`] on this `Http2Session`
<del>instance's underlying [`net.Socket`].
<add>instance's underlying [`net.Socket`][].
<ide>
<ide> #### http2session.remoteSettings
<ide> <!-- YAML
<ide> added: v9.4.0
<ide> -->
<ide>
<ide> Calls [`unref()`][`net.Socket.prototype.unref()`] on this `Http2Session`
<del>instance's underlying [`net.Socket`].
<add>instance's underlying [`net.Socket`][].
<ide>
<ide> ### Class: ServerHttp2Session
<ide> <!-- YAML
<ide> added: v8.4.0
<ide>
<ide> Stops the server from establishing new sessions. This does not prevent new
<ide> request streams from being created due to the persistent nature of HTTP/2
<del>sessions. To gracefully shut down the server, call [`http2session.close()`] on
<add>sessions. To gracefully shut down the server, call [`http2session.close()`][] on
<ide> all active sessions.
<ide>
<ide> If `callback` is provided, it is not invoked until all active sessions have been
<ide> added: v8.4.0
<ide>
<ide> Stops the server from establishing new sessions. This does not prevent new
<ide> request streams from being created due to the persistent nature of HTTP/2
<del>sessions. To gracefully shut down the server, call [`http2session.close()`] on
<add>sessions. To gracefully shut down the server, call [`http2session.close()`][] on
<ide> all active sessions.
<ide>
<ide> If `callback` is provided, it is not invoked until all active sessions have been
<ide> added: v8.4.0
<ide> * `stream` {ServerHttp2Stream} The newly-created `ServerHttp2Stream` object
<ide>
<ide> Call [`http2stream.pushStream()`][] with the given headers, and wrap the
<del>given [`Http2Stream`] on a newly created `Http2ServerResponse` as the callback
<add>given [`Http2Stream`][] on a newly created `Http2ServerResponse` as the callback
<ide> parameter if successful. When `Http2ServerRequest` is closed, the callback is
<ide> called with an error `ERR_HTTP2_INVALID_STREAM`.
<ide>
<ide><path>doc/api/inspector.md
<ide> added: v8.0.0
<ide> -->
<ide>
<ide> Immediately close the session. All pending message callbacks will be called
<del>with an error. [`session.connect()`] will need to be called to be able to send
<add>with an error. [`session.connect()`][] will need to be called to be able to send
<ide> messages again. Reconnected session will lose all inspector state, such as
<ide> enabled agents or configured breakpoints.
<ide>
<ide><path>doc/api/process.md
<ide> all `'exit'` listeners have finished running the Node.js process will terminate.
<ide>
<ide> The listener callback function is invoked with the exit code specified either
<ide> by the [`process.exitCode`][] property, or the `exitCode` argument passed to the
<del>[`process.exit()`] method.
<add>[`process.exit()`][] method.
<ide>
<ide> ```js
<ide> process.on('exit', (code) => {
<ide> added: v0.1.27
<ide>
<ide> The `process.argv` property returns an array containing the command line
<ide> arguments passed when the Node.js process was launched. The first element will
<del>be [`process.execPath`]. See `process.argv0` if access to the original value of
<del>`argv[0]` is needed. The second element will be the path to the JavaScript
<add>be [`process.execPath`][]. See `process.argv0` if access to the original value
<add>of `argv[0]` is needed. The second element will be the path to the JavaScript
<ide> file being executed. The remaining elements will be any additional command line
<ide> arguments.
<ide>
<ide> added: v0.1.13
<ide> The `process.exit()` method instructs Node.js to terminate the process
<ide> synchronously with an exit status of `code`. If `code` is omitted, exit uses
<ide> either the 'success' code `0` or the value of `process.exitCode` if it has been
<del>set. Node.js will not terminate until all the [`'exit'`] event listeners are
<add>set. Node.js will not terminate until all the [`'exit'`][] event listeners are
<ide> called.
<ide>
<ide> To exit with a 'failure' code:
<ide> changes:
<ide> fully drained after the current operation on the JavaScript stack runs to
<ide> completion and before the event loop is allowed to continue. It's possible to
<ide> create an infinite loop if one were to recursively call `process.nextTick()`.
<del>See the [Event Loop] guide for more background.
<add>See the [Event Loop][] guide for more background.
<ide>
<ide> ```js
<ide> console.log('start');
<ide><path>doc/api/readline.md
<ide> > Stability: 2 - Stable
<ide>
<ide> The `readline` module provides an interface for reading data from a [Readable][]
<del>stream (such as [`process.stdin`]) one line at a time. It can be accessed using:
<add>stream (such as [`process.stdin`][]) one line at a time. It can be accessed
<add>using:
<ide>
<ide> ```js
<ide> const readline = require('readline');
<ide><path>doc/api/stream.md
<ide> total size of the internal write buffer is below the threshold set by
<ide> the size of the internal buffer reaches or exceeds the `highWaterMark`, `false`
<ide> will be returned.
<ide>
<del>A key goal of the `stream` API, particularly the [`stream.pipe()`] method,
<add>A key goal of the `stream` API, particularly the [`stream.pipe()`][] method,
<ide> is to limit the buffering of data to acceptable levels such that sources and
<ide> destinations of differing speeds will not overwhelm the available memory.
<ide>
<ide> from the stream.
<ide>
<ide> Adding a [`'readable'`][] event handler automatically make the stream to
<ide> stop flowing, and the data to be consumed via
<del>[`readable.read()`][stream-read]. If the [`'readable'`] event handler is
<add>[`readable.read()`][stream-read]. If the [`'readable'`][] event handler is
<ide> removed, then the stream will start flowing again if there is a
<ide> [`'data'`][] event handler.
<ide>
<ide> on the type of stream being created, as detailed in the chart below:
<ide>
<ide> | Use-case | Class | Method(s) to implement |
<ide> | -------- | ----- | ---------------------- |
<del>| Reading only | [`Readable`] | <code>[_read()][stream-_read]</code> |
<del>| Writing only | [`Writable`] | <code>[_write()][stream-_write]</code>, <code>[_writev()][stream-_writev]</code>, <code>[_final()][stream-_final]</code> |
<del>| Reading and writing | [`Duplex`] | <code>[_read()][stream-_read]</code>, <code>[_write()][stream-_write]</code>, <code>[_writev()][stream-_writev]</code>, <code>[_final()][stream-_final]</code> |
<del>| Operate on written data, then read the result | [`Transform`] | <code>[_transform()][stream-_transform]</code>, <code>[_flush()][stream-_flush]</code>, <code>[_final()][stream-_final]</code> |
<add>| Reading only | [`Readable`][] | [`_read()`][stream-_read] |
<add>| Writing only | [`Writable`][] | [`_write()`][stream-_write], [`_writev()`][stream-_writev], [`_final()`][stream-_final] |
<add>| Reading and writing | [`Duplex`][] | [`_read()`][stream-_read], [`_write()`][stream-_write], [`_writev()`][stream-_writev], [`_final()`][stream-_final] |
<add>| Operate on written data, then read the result | [`Transform`][] | [`_transform()`][stream-_transform], [`_flush()`][stream-_flush], [`_final()`][stream-_final] |
<ide>
<ide> The implementation code for a stream should *never* call the "public" methods
<ide> of a stream that are intended for use by consumers (as described in the
<ide> or write buffered data before a stream ends.
<ide> #### Errors While Writing
<ide>
<ide> Errors occurring during the processing of the [`writable._write()`][],
<del>[`writable._writev()`][] and [`writable._final()`] methods must be propagated
<add>[`writable._writev()`][] and [`writable._final()`][] methods must be propagated
<ide> by invoking the callback and passing the error as the first argument.
<ide> Throwing an `Error` from within these methods or manually emitting an `'error'`
<ide> event results in undefined behavior.
<ide><path>doc/api/timers.md
<ide> added: v0.9.1
<ide> -->
<ide>
<ide> * `callback` {Function} The function to call at the end of this turn of
<del> [the Node.js Event Loop]
<add> the Node.js [Event Loop][]
<ide> * `...args` {any} Optional arguments to pass when the `callback` is called.
<ide> * Returns: {Immediate} for use with [`clearImmediate()`][]
<ide>
<ide><path>doc/api/tls.md
<ide> Where:
<ide>
<ide> <!-- type=misc -->
<ide>
<del>The term "[Forward Secrecy]" or "Perfect Forward Secrecy" describes a feature of
<del>key-agreement (i.e., key-exchange) methods. That is, the server and client keys
<del>are used to negotiate new temporary keys that are used specifically and only for
<del>the current communication session. Practically, this means that even if the
<del>server's private key is compromised, communication can only be decrypted by
<del>eavesdroppers if the attacker manages to obtain the key-pair specifically
<add>The term "[Forward Secrecy][]" or "Perfect Forward Secrecy" describes a feature
<add>of key-agreement (i.e., key-exchange) methods. That is, the server and client
<add>keys are used to negotiate new temporary keys that are used specifically and
<add>only for the current communication session. Practically, this means that even
<add>if the server's private key is compromised, communication can only be decrypted
<add>by eavesdroppers if the attacker manages to obtain the key-pair specifically
<ide> generated for the session.
<ide>
<ide> Perfect Forward Secrecy is achieved by randomly generating a key pair for
<ide> all sessions). Methods implementing this technique are called "ephemeral".
<ide> Currently two methods are commonly used to achieve Perfect Forward Secrecy (note
<ide> the character "E" appended to the traditional abbreviations):
<ide>
<del>* [DHE] - An ephemeral version of the Diffie Hellman key-agreement protocol.
<del>* [ECDHE] - An ephemeral version of the Elliptic Curve Diffie Hellman
<add>* [DHE][] - An ephemeral version of the Diffie Hellman key-agreement protocol.
<add>* [ECDHE][] - An ephemeral version of the Elliptic Curve Diffie Hellman
<ide> key-agreement protocol.
<ide>
<ide> Ephemeral methods may have some performance drawbacks, because key generation
<ide> openssl dhparam -outform PEM -out dhparam.pem 2048
<ide> If using Perfect Forward Secrecy using `ECDHE`, Diffie-Hellman parameters are
<ide> not required and a default ECDHE curve will be used. The `ecdhCurve` property
<ide> can be used when creating a TLS Server to specify the list of names of supported
<del>curves to use, see [`tls.createServer()`] for more info.
<add>curves to use, see [`tls.createServer()`][] for more info.
<ide>
<ide> Perfect Forward Secrecy was optional up to TLSv1.2, but it is not optional for
<ide> TLSv1.3, because all TLSv1.3 cipher suites use ECDHE.
<ide> node server.js
<ide>
<ide> The default can also be replaced on a per client or server basis using the
<ide> `ciphers` option from [`tls.createSecureContext()`][], which is also available
<del>in [`tls.createServer()`], [`tls.connect()`], and when creating new
<del>[`tls.TLSSocket`]s.
<add>in [`tls.createServer()`][], [`tls.connect()`][], and when creating new
<add>[`tls.TLSSocket`][]s.
<ide>
<ide> The ciphers list can contain a mixture of TLSv1.3 cipher suite names, the ones
<ide> that start with `'TLS_'`, and specifications for TLSv1.2 and below cipher
<ide> of an application. The `--tls-cipher-list` switch and `ciphers` option should by
<ide> used only if absolutely necessary.
<ide>
<ide> The default cipher suite prefers GCM ciphers for [Chrome's 'modern
<del>cryptography' setting] and also prefers ECDHE and DHE ciphers for Perfect
<add>cryptography' setting][] and also prefers ECDHE and DHE ciphers for Perfect
<ide> Forward Secrecy, while offering *some* backward compatibility.
<ide>
<ide> 128 bit AES is preferred over 192 and 256 bit AES in light of [specific
<del>attacks affecting larger AES key sizes].
<add>attacks affecting larger AES key sizes][].
<ide>
<ide> Old clients that rely on insecure and deprecated RC4 or DES-based ciphers
<ide> (like Internet Explorer 6) cannot complete the handshaking process with
<ide> the default configuration. If these clients _must_ be supported, the
<del>[TLS recommendations] may offer a compatible cipher suite. For more details
<add>[TLS recommendations][] may offer a compatible cipher suite. For more details
<ide> on the format, see the OpenSSL [cipher list format][] documentation.
<ide>
<ide> There are only 5 TLSv1.3 cipher suites:
<ide> The typical flow of an OCSP Request is as follows:
<ide> 2. Server receives the request and emits the `'OCSPRequest'` event, calling the
<ide> listener if registered.
<ide> 3. Server extracts the OCSP URL from either the `certificate` or `issuer` and
<del> performs an [OCSP request] to the CA.
<add> performs an [OCSP request][] to the CA.
<ide> 4. Server receives `'OCSPResponse'` from the CA and sends it back to the client
<ide> via the `callback` argument
<ide> 5. Client validates the response and either destroys the socket or performs a
<ide> via the `ca` option when establishing the TLS connection.)
<ide> Listening for this event will have an effect only on connections established
<ide> after the addition of the event listener.
<ide>
<del>An npm module like [asn1.js] may be used to parse the certificates.
<add>An npm module like [asn1.js][] may be used to parse the certificates.
<ide>
<ide> ### Event: 'resumeSession'
<ide> <!-- YAML
<ide> changes:
<ide> provided.
<ide> For PEM encoded certificates, supported types are "TRUSTED CERTIFICATE",
<ide> "X509 CERTIFICATE", and "CERTIFICATE".
<del> See also [`tls.rootCertificates`].
<add> See also [`tls.rootCertificates`][].
<ide> * `cert` {string|string[]|Buffer|Buffer[]} Cert chains in PEM format. One cert
<ide> chain should be provided per private key. Each cert chain should consist of
<ide> the PEM formatted certificate for a provided private `key`, followed by the
<ide> changes:
<ide> curve automatically. Use [`crypto.getCurves()`][] to obtain a list of
<ide> available curve names. On recent releases, `openssl ecparam -list_curves`
<ide> will also display the name and description of each available elliptic curve.
<del> **Default:** [`tls.DEFAULT_ECDH_CURVE`].
<add> **Default:** [`tls.DEFAULT_ECDH_CURVE`][].
<ide> * `honorCipherOrder` {boolean} Attempt to use the server's cipher suite
<ide> preferences instead of the client's. When `true`, causes
<ide> `SSL_OP_CIPHER_SERVER_PREFERENCE` to be set in `secureOptions`, see
<ide> added: v12.3.0
<ide>
<ide> An immutable array of strings representing the root certificates (in PEM format)
<ide> used for verifying peer certificates. This is the default value of the `ca`
<del>option to [`tls.createSecureContext()`].
<add>option to [`tls.createSecureContext()`][].
<ide>
<ide> ## tls.DEFAULT_ECDH_CURVE
<ide> <!-- YAML
<ide> changes:
<ide> -->
<ide>
<ide> The default curve name to use for ECDH key agreement in a tls server. The
<del>default value is `'auto'`. See [`tls.createSecureContext()`] for further
<add>default value is `'auto'`. See [`tls.createSecureContext()`][] for further
<ide> information.
<ide>
<ide> ## tls.DEFAULT_MAX_VERSION
<ide><path>doc/api/tracing.md
<ide> accepts a list of comma-separated category names.
<ide> The available categories are:
<ide>
<ide> * `node` - An empty placeholder.
<del>* `node.async_hooks` - Enables capture of detailed [`async_hooks`] trace data.
<del> The [`async_hooks`] events have a unique `asyncId` and a special `triggerId`
<add>* `node.async_hooks` - Enables capture of detailed [`async_hooks`][] trace data.
<add> The [`async_hooks`][] events have a unique `asyncId` and a special `triggerId`
<ide> `triggerAsyncId` property.
<ide> * `node.bootstrap` - Enables capture of Node.js bootstrap milestones.
<ide> * `node.console` - Enables capture of `console.time()` and `console.count()`
<ide> output.
<ide> * `node.dns.native` - Enables capture of trace data for DNS queries.
<ide> * `node.environment` - Enables capture of Node.js Environment milestones.
<ide> * `node.fs.sync` - Enables capture of trace data for file system sync methods.
<del>* `node.perf` - Enables capture of [Performance API] measurements.
<add>* `node.perf` - Enables capture of [Performance API][] measurements.
<ide> * `node.perf.usertiming` - Enables capture of only Performance API User Timing
<ide> measures and marks.
<ide> * `node.perf.timerify` - Enables capture of only Performance API timerify
<ide> The available categories are:
<ide> of unhandled Promise rejections and handled-after-rejections.
<ide> * `node.vm.script` - Enables capture of trace data for the `vm` module's
<ide> `runInNewContext()`, `runInContext()`, and `runInThisContext()` methods.
<del>* `v8` - The [V8] events are GC, compiling, and execution related.
<add>* `v8` - The [V8][] events are GC, compiling, and execution related.
<ide>
<ide> By default the `node`, `node.async_hooks`, and `v8` categories are enabled.
<ide>
<ide><path>doc/api/util.md
<ide> The `util._extend()` method was never intended to be used outside of internal
<ide> Node.js modules. The community found and used it anyway.
<ide>
<ide> It is deprecated and should not be used in new code. JavaScript comes with very
<del>similar built-in functionality through [`Object.assign()`].
<add>similar built-in functionality through [`Object.assign()`][].
<ide>
<ide> ### util.isArray(object)
<ide> <!-- YAML
<ide><path>doc/guides/maintaining-V8.md
<ide> process.
<ide>
<ide> ### Unfixed Upstream Bugs
<ide>
<del>If the bug can be reproduced on the [Node.js `canary` branch], Chromium canary,
<del>or V8 tip-of-tree, and the test case is valid, then the bug needs to be fixed
<del>upstream first.
<add>If the bug can be reproduced on the [Node.js `canary` branch][], Chromium
<add>canary, or V8 tip-of-tree, and the test case is valid, then the bug needs to be
<add>fixed upstream first.
<ide>
<ide> * Start by opening a bug upstream using [this template][V8TemplateUpstreamBug].
<ide> * Make sure to include a link to the corresponding Node.js issue
<ide> to be cherry-picked in the Node.js repository and V8-CI must test the change.
<ide> V8 team to get help with reimplementing the patch.
<ide> * Open a cherry-pick PR on `nodejs/node` targeting the *vY.x-staging* branch
<ide> and notify the `@nodejs/v8` team.
<del> * Run the Node.js [V8 CI] in addition to the [Node.js CI].
<add> * Run the Node.js [V8 CI][] in addition to the [Node.js CI][].
<ide> The CI uses the `test-v8` target in the `Makefile`, which uses
<ide> `tools/make-v8.sh` to reconstruct a git tree in the `deps/v8` directory to
<ide> run V8 tests.
<ide>
<del>The [`git-node`] tool can be used to simplify this task. Run
<add>The [`git-node`][] tool can be used to simplify this task. Run
<ide> `git node v8 backport <sha>` to cherry-pick a commit.
<ide>
<ide> An example for workflow how to cherry-pick consider the bug
<ide> PR-URL: https://github.com/nodejs/node/pull/7833
<ide> ```
<ide>
<ide> * Open a PR against the `v6.x-staging` branch in the Node.js repo. Launch the
<del> normal and [V8 CI] using the Node.js CI system. We only needed to backport to
<del> `v6.x` as the other LTS branches weren't affected by this bug.
<add> normal and [V8 CI][] using the Node.js CI system. We only needed to backport
<add> to `v6.x` as the other LTS branches weren't affected by this bug.
<ide>
<ide> ### Backports Identified by the V8 team
<ide>
<ide> curl -L https://github.com/v8/v8/compare/${V8_OLD_VERSION}...${V8_NEW_VERSION}.p
<ide> V8 also keeps tags of the form *5.4-lkgr* which point to the *Last Known Good
<ide> Revision* from the 5.4 branch that can be useful in the update process above.
<ide>
<del>The [`git-node`] tool can be used to simplify this task. Run `git node v8 minor`
<add>The [`git-node`][] tool can be used to simplify this task. Run `git node v8 minor`
<ide> to apply a minor update.
<ide>
<ide> ### Major Updates
<ide> To audit for floating patches:
<ide> git log --oneline deps/v8
<ide> ```
<ide>
<del>To replace the copy of V8 in Node.js, use the [`git-node`] tool. For example, if
<del>you want to replace the copy of V8 in Node.js with the branch-head for V8 5.1
<add>To replace the copy of V8 in Node.js, use the [`git-node`][] tool. For example,
<add>if you want to replace the copy of V8 in Node.js with the branch-head for V8 5.1
<ide> branch:
<ide>
<ide> ```shell | 17 |
Javascript | Javascript | replace `listeners()` with `listenercount()` | b11d6ecbb8bb2f0d6f423be6775e587f4e9b1c4d | <ide><path>Libraries/EventEmitter/NativeEventEmitter.js
<ide> export default class NativeEventEmitter extends EventEmitter {
<ide>
<ide> removeAllListeners(eventType: string) {
<ide> invariant(eventType, 'eventType argument is required.');
<del> const count = this.listeners(eventType).length;
<add> const count = this.listenerCount(eventType);
<ide> if (this._nativeModule != null) {
<ide> this._nativeModule.removeListeners(count);
<ide> }
<ide><path>Libraries/vendor/emitter/_EventEmitter.js
<ide> class EventEmitter {
<ide> }
<ide>
<ide> /**
<del> * Returns an array of listeners that are currently registered for the given
<add> * Returns the number of listeners that are currently registered for the given
<ide> * event.
<ide> *
<ide> * @param {string} eventType - Name of the event to query
<del> * @returns {array}
<add> * @returns {number}
<ide> */
<del> listeners(eventType: string): [EmitterSubscription] {
<add> listenerCount(eventType: string): number {
<ide> const subscriptions = this._subscriber.getSubscriptionsForType(eventType);
<ide> return subscriptions
<del> ? subscriptions
<del> // We filter out missing entries because the array is sparse.
<del> // "callbackfn is called only for elements of the array which actually
<del> // exist; it is not called for missing elements of the array."
<del> // https://www.ecma-international.org/ecma-262/9.0/index.html#sec-array.prototype.filter
<del> .filter(sparseFilterPredicate)
<del> .map(subscription => subscription.listener)
<del> : [];
<add> ? // We filter out missing entries because the array is sparse.
<add> // "callbackfn is called only for elements of the array which actually
<add> // exist; it is not called for missing elements of the array."
<add> // https://www.ecma-international.org/ecma-262/9.0/index.html#sec-array.prototype.filter
<add> subscriptions.filter(sparseFilterPredicate).length
<add> : 0;
<ide> }
<ide>
<ide> /** | 2 |
PHP | PHP | remove cake_test_lib constant | 0508055ee9b77fe3d358ca401d3e74185cb7bfc0 | <ide><path>app/webroot/test.php
<ide> die(__d('cake', 'Debug setting does not allow access to this url.'));
<ide> }
<ide>
<del>require_once CAKE_TESTS_LIB . 'CakeTestSuiteDispatcher.php';
<add>require_once CAKE . 'TestSuite' . DS . 'CakeTestSuiteDispatcher.php';
<ide>
<ide> CakeTestSuiteDispatcher::run();
<ide><path>lib/Cake/Console/templates/skel/webroot/test.php
<ide> die(__('Debug setting does not allow access to this url.'));
<ide> }
<ide>
<del>require_once CAKE_TESTS_LIB . 'CakeTestSuiteDispatcher.php';
<add>require_once CAKE . 'TestSuite' . DS . 'CakeTestSuiteDispatcher.php';
<ide>
<ide> CakeTestSuiteDispatcher::run();
<ide><path>lib/Cake/TestSuite/CakeTestSuiteDispatcher.php
<ide> protected function _checkPHPUnit() {
<ide> $found = $this->loadTestFramework();
<ide> if (!$found) {
<ide> $baseDir = $this->_baseDir;
<del> include CAKE_TESTS_LIB . 'templates/phpunit.php';
<add> include CAKE . 'TestSuite' . DS . 'templates' . DS . 'phpunit.php';
<ide> exit();
<ide> }
<ide> }
<ide> public function loadTestFramework() {
<ide> function _checkXdebug() {
<ide> if (!extension_loaded('xdebug')) {
<ide> $baseDir = $this->_baseDir;
<del> include CAKE_TESTS_LIB . 'templates/xdebug.php';
<add> include CAKE . 'TestSuite' . DS . 'templates' . DS . 'xdebug.php';
<ide> exit();
<ide> }
<ide> }
<ide> function _runTestCase() {
<ide> 'baseUrl' => $this->_baseUrl,
<ide> 'baseDir' => $this->_baseDir,
<ide> );
<del>
<add>
<ide> $options = array(
<ide> '--filter', $this->params['filter'],
<ide> '--output', $this->params['output'],
<ide> function _runTestCase() {
<ide> } catch (MissingConnectionException $exception) {
<ide> ob_end_clean();
<ide> $baseDir = $this->_baseDir;
<del> include CAKE_TESTS_LIB . 'templates' . DS . 'missing_connection.php';
<add> include CAKE . 'TestSuite' . DS . 'templates' . DS . 'missing_connection.php';
<ide> exit();
<ide> }
<ide> }
<ide><path>lib/Cake/TestSuite/Reporter/CakeHtmlReporter.php
<ide> public function paintHeader() {
<ide> public function paintDocumentStart() {
<ide> ob_start();
<ide> $baseDir = $this->params['baseDir'];
<del> include CAKE_TESTS_LIB . 'templates' . DS . 'header.php';
<add> include CAKE . 'TestSuite' . DS . 'templates' . DS . 'header.php';
<ide> }
<ide>
<ide> /**
<ide> public function paintTestMenu() {
<ide> $cases = $this->baseUrl() . '?show=cases';
<ide> $plugins = App::objects('plugin', null, false);
<ide> sort($plugins);
<del> include CAKE_TESTS_LIB . 'templates' . DS . 'menu.php';
<add> include CAKE . 'TestSuite' . DS . 'templates' . DS . 'menu.php';
<ide> }
<ide>
<ide> /**
<ide> protected function _queryString($url) {
<ide> */
<ide> public function paintDocumentEnd() {
<ide> $baseDir = $this->params['baseDir'];
<del> include CAKE_TESTS_LIB . 'templates/footer.php';
<add> include CAKE . 'TestSuite' . DS . 'templates' . DS . 'footer.php';
<ide> if (ob_get_length()) {
<ide> ob_end_flush();
<ide> }
<ide> public function startTestSuite(PHPUnit_Framework_TestSuite $suite) {
<ide> }
<ide> echo '<h2>' . __d('cake_dev', 'Running %s', $suite->getName()) . '</h2>';
<ide> }
<del>}
<ide>\ No newline at end of file
<add>}
<ide><path>lib/Cake/bootstrap.php
<ide> define('CAKE_TESTS', CAKE.'Test'.DS);
<ide> }
<ide>
<del>/**
<del> * Path to the test suite.
<del> */
<del> define('CAKE_TESTS_LIB', LIBS . 'TestSuite' . DS);
<del>
<ide> /**
<ide> * Path to the controller test directory.
<ide> */ | 5 |
Javascript | Javascript | fix metadata comment | 226799e1f8767a8ab2849ea04f595dc82ce83747 | <ide><path>src/locale/fil.js
<ide> //! moment.js locale configuration
<del>//! locale : Tagalog (Philippines) [tl-ph]
<add>//! locale : Filipino [fil]
<ide> //! author : Dan Hagman : https://github.com/hagmandan
<ide> //! author : Matthew Co : https://github.com/matthewdeeco
<ide> | 1 |
Javascript | Javascript | copy color to uniforms value | 2f350889c9a3d6696f08006db30c35eeb16c6a9d | <ide><path>src/renderers/WebGLRenderer.js
<ide> function WebGLRenderer( parameters ) {
<ide>
<ide> } else if ( material.isShadowMaterial ) {
<ide>
<del> m_uniforms.color.value = material.color;
<add> m_uniforms.color.value.copy( material.color );
<ide> m_uniforms.opacity.value = material.opacity;
<ide>
<ide> }
<ide> function WebGLRenderer( parameters ) {
<ide>
<ide> if ( material.color ) {
<ide>
<del> uniforms.diffuse.value = material.color;
<add> uniforms.diffuse.value.copy( material.color );
<ide>
<ide> }
<ide>
<ide> function WebGLRenderer( parameters ) {
<ide>
<ide> function refreshUniformsLine( uniforms, material ) {
<ide>
<del> uniforms.diffuse.value = material.color;
<add> uniforms.diffuse.value.copy( material.color );
<ide> uniforms.opacity.value = material.opacity;
<ide>
<ide> }
<ide> function WebGLRenderer( parameters ) {
<ide>
<ide> function refreshUniformsPoints( uniforms, material ) {
<ide>
<del> uniforms.diffuse.value = material.color;
<add> uniforms.diffuse.value.copy( material.color );
<ide> uniforms.opacity.value = material.opacity;
<ide> uniforms.size.value = material.size * _pixelRatio;
<ide> uniforms.scale.value = _height * 0.5;
<ide> function WebGLRenderer( parameters ) {
<ide>
<ide> function refreshUniformsSprites( uniforms, material ) {
<ide>
<del> uniforms.diffuse.value = material.color;
<add> uniforms.diffuse.value.copy( material.color );
<ide> uniforms.opacity.value = material.opacity;
<ide> uniforms.rotation.value = material.rotation;
<ide> uniforms.map.value = material.map;
<ide> function WebGLRenderer( parameters ) {
<ide>
<ide> function refreshUniformsFog( uniforms, fog ) {
<ide>
<del> uniforms.fogColor.value = fog.color;
<add> uniforms.fogColor.value.copy( fog.color );
<ide>
<ide> if ( fog.isFog ) {
<ide>
<ide> function WebGLRenderer( parameters ) {
<ide>
<ide> function refreshUniformsPhong( uniforms, material ) {
<ide>
<del> uniforms.specular.value = material.specular;
<add> uniforms.specular.value.copy( material.specular );
<ide> uniforms.shininess.value = Math.max( material.shininess, 1e-4 ); // to prevent pow( 0.0, 0.0 )
<ide>
<ide> if ( material.emissiveMap ) { | 1 |
Javascript | Javascript | move method definition to es6 class `mixin` | a66d9a5369108a43263b445aa9316af66e64b7c1 | <ide><path>packages/ember-metal/lib/mixin.js
<ide> export default class Mixin {
<ide>
<ide> return ret;
<ide> }
<del>}
<ide>
<del>Mixin._apply = applyMixin;
<add> /**
<add> @method reopen
<add> @param arguments*
<add> @private
<add> */
<add> reopen() {
<add> let currentMixin;
<add>
<add> if (this.properties) {
<add> currentMixin = new Mixin(undefined, this.properties);
<add> this.properties = undefined;
<add> this.mixins = [currentMixin];
<add> } else if (!this.mixins) {
<add> this.mixins = [];
<add> }
<ide>
<del>Mixin.finishPartial = finishPartial;
<add> let mixins = this.mixins;
<add> let idx;
<add>
<add> for (idx = 0; idx < arguments.length; idx++) {
<add> currentMixin = arguments[idx];
<add> assert(
<add> `Expected hash or Mixin instance, got ${Object.prototype.toString.call(currentMixin)}`,
<add> typeof currentMixin === 'object' && currentMixin !== null &&
<add> Object.prototype.toString.call(currentMixin) !== '[object Array]'
<add> );
<add>
<add> if (currentMixin instanceof Mixin) {
<add> mixins.push(currentMixin);
<add> } else {
<add> mixins.push(new Mixin(undefined, currentMixin));
<add> }
<add> }
<ide>
<del>let unprocessedFlag = false;
<add> return this;
<add> }
<ide>
<del>export function hasUnprocessedMixins() {
<del> return unprocessedFlag;
<del>}
<add> /**
<add> @method apply
<add> @param obj
<add> @return applied object
<add> @private
<add> */
<add> apply(obj) {
<add> return applyMixin(obj, [this], false);
<add> }
<ide>
<del>export function clearUnprocessedMixins() {
<del> unprocessedFlag = false;
<del>}
<add> applyPartial(obj) {
<add> return applyMixin(obj, [this], true);
<add> }
<ide>
<del>let MixinPrototype = Mixin.prototype;
<add> /**
<add> @method detect
<add> @param obj
<add> @return {Boolean}
<add> @private
<add> */
<add> detect(obj) {
<add> if (typeof obj !== 'object' || obj === null) { return false; }
<add> if (obj instanceof Mixin) { return _detect(obj, this, {}); }
<add> let meta = peekMeta(obj);
<add> if (meta === undefined) { return false; }
<add> return !!meta.peekMixins(guidFor(this));
<add> }
<ide>
<del>/**
<del> @method reopen
<del> @param arguments*
<del> @private
<del>*/
<del>MixinPrototype.reopen = function() {
<del> let currentMixin;
<add> without(...args) {
<add> let ret = new Mixin([this]);
<add> ret._without = args;
<add> return ret;
<add> }
<add>
<add> keys() {
<add> let keys = {};
<add> let seen = {};
<ide>
<del> if (this.properties) {
<del> currentMixin = new Mixin(undefined, this.properties);
<del> this.properties = undefined;
<del> this.mixins = [currentMixin];
<del> } else if (!this.mixins) {
<del> this.mixins = [];
<add> _keys(keys, this, seen);
<add> let ret = Object.keys(keys);
<add> return ret;
<ide> }
<ide>
<del> let mixins = this.mixins;
<del> let idx;
<add>}
<ide>
<del> for (idx = 0; idx < arguments.length; idx++) {
<del> currentMixin = arguments[idx];
<del> assert(
<del> `Expected hash or Mixin instance, got ${Object.prototype.toString.call(currentMixin)}`,
<del> typeof currentMixin === 'object' && currentMixin !== null &&
<del> Object.prototype.toString.call(currentMixin) !== '[object Array]'
<del> );
<add>Mixin._apply = applyMixin;
<add>Mixin.finishPartial = finishPartial;
<ide>
<del> if (currentMixin instanceof Mixin) {
<del> mixins.push(currentMixin);
<del> } else {
<del> mixins.push(new Mixin(undefined, currentMixin));
<del> }
<del> }
<add>let MixinPrototype = Mixin.prototype;
<add>MixinPrototype.toString = Object.toString;
<ide>
<del> return this;
<del>};
<add>debugSeal(MixinPrototype);
<ide>
<del>/**
<del> @method apply
<del> @param obj
<del> @return applied object
<del> @private
<del>*/
<del>MixinPrototype.apply = function(obj) {
<del> return applyMixin(obj, [this], false);
<del>};
<add>let unprocessedFlag = false;
<ide>
<del>MixinPrototype.applyPartial = function(obj) {
<del> return applyMixin(obj, [this], true);
<del>};
<add>export function hasUnprocessedMixins() {
<add> return unprocessedFlag;
<add>}
<ide>
<del>MixinPrototype.toString = Object.toString;
<add>export function clearUnprocessedMixins() {
<add> unprocessedFlag = false;
<add>}
<ide>
<ide> function _detect(curMixin, targetMixin, seen) {
<ide> let guid = guidFor(curMixin);
<ide> function _detect(curMixin, targetMixin, seen) {
<ide> return false;
<ide> }
<ide>
<del>/**
<del> @method detect
<del> @param obj
<del> @return {Boolean}
<del> @private
<del>*/
<del>MixinPrototype.detect = function(obj) {
<del> if (typeof obj !== 'object' || obj === null) { return false; }
<del> if (obj instanceof Mixin) { return _detect(obj, this, {}); }
<del> let meta = peekMeta(obj);
<del> if (meta === undefined) { return false; }
<del> return !!meta.peekMixins(guidFor(this));
<del>};
<del>
<del>MixinPrototype.without = function(...args) {
<del> let ret = new Mixin([this]);
<del> ret._without = args;
<del> return ret;
<del>};
<del>
<ide> function _keys(ret, mixin, seen) {
<ide> if (seen[guidFor(mixin)]) { return; }
<ide> seen[guidFor(mixin)] = true;
<ide> function _keys(ret, mixin, seen) {
<ide> }
<ide> }
<ide>
<del>MixinPrototype.keys = function() {
<del> let keys = {};
<del> let seen = {};
<del>
<del> _keys(keys, this, seen);
<del> let ret = Object.keys(keys);
<del> return ret;
<del>};
<del>
<del>debugSeal(MixinPrototype);
<del>
<ide> const REQUIRED = new Descriptor();
<ide> REQUIRED.toString = () => '(Required Property)';
<ide> | 1 |
PHP | PHP | change assertequals to assertsame | 5600af55df51db2ec3ec5f2b4ee4576108f2de24 | <ide><path>tests/TestCase/ORM/TableTest.php
<ide> public function testSaveManyFailed()
<ide> $result = $table->saveMany($entities);
<ide>
<ide> $this->assertFalse($result);
<del> $this->assertEquals($expectedCount, $table->find()->count());
<add> $this->assertSame($expectedCount, $table->find()->count());
<ide> foreach ($entities as $entity) {
<ide> $this->assertTrue($entity->isNew());
<ide> } | 1 |
Python | Python | fix grammatical error | aa1d34dc51fc63dabc46f388822ba73b15d3ef97 | <ide><path>src/flask/scaffold.py
<ide> def teardown_request(self, f: TeardownCallable) -> TeardownCallable:
<ide> stack of active contexts. This becomes relevant if you are using
<ide> such constructs in tests.
<ide>
<del> Teardown functions must avoid raising exceptions, since they . If they
<del> execute code that might fail they
<del> will have to surround the execution of these code by try/except
<del> statements and log occurring errors.
<add> Teardown functions must avoid raising exceptions. If
<add> they execute code that might fail they
<add> will have to surround the execution of that code with try/except
<add> statements and log any errors.
<ide>
<ide> When a teardown function was called because of an exception it will
<ide> be passed an error object. | 1 |
Text | Text | use full path to system ruby in setup instructions | a43227143d0464ab7d6776c2d6866d653503cb5d | <ide><path>README.md
<ide> Quick Install to /usr/local
<ide> ---------------------------
<ide> [This script][gist] will prompt for confirmation before it does anything:
<ide>
<del> ruby -e "$(curl -fsSL https://raw.github.com/gist/323731/39fc1416e34b9f6db201b4a026181f4ceb7cfa74)"
<add> /usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731/39fc1416e34b9f6db201b4a026181f4ceb7cfa74)"
<ide>
<ide> Afterwards, [install Xcode][xcode].
<ide> | 1 |
Python | Python | fix generation repetition penalty with xla | fd9aa82b07d9b844a21f18f1622de5ca104f25bd | <ide><path>src/transformers/generation_tf_logits_process.py
<ide> def _create_score_penalties(self, input_ids: tf.Tensor, logits: tf.Tensor) -> tf
<ide>
<ide> # Scatters the penalties
<ide> token_penalties = tf.ones(logits.shape)
<add> batch_size = input_ids.shape[0]
<add> seq_len = tf.shape(input_ids)[1] # the sequence length has dynamic size, hence the dynamic shape
<ide> indexable_prev_input_ids = tf.concat(
<ide> (
<del> tf.expand_dims(tf.repeat(tf.range(input_ids.shape[0]), input_ids.shape[1]), axis=-1),
<add> tf.expand_dims(tf.repeat(tf.range(batch_size), seq_len), axis=-1),
<ide> tf.expand_dims(tf.reshape(input_ids, [-1]), axis=-1),
<ide> ),
<ide> axis=1, | 1 |
Javascript | Javascript | reuse meta `arraycontentdidchange` | 49f01699a9c209c3134ac85895cba4456a58b935 | <ide><path>packages/ember-runtime/lib/mixins/array.js
<ide> export function arrayContentDidChange(array, startIdx, removeAmt, addAmt) {
<ide>
<ide> let normalStartIdx = startIdx < 0 ? previousLength + startIdx : startIdx;
<ide> if (cache.firstObject !== undefined && normalStartIdx === 0) {
<del> propertyWillChange(array, 'firstObject');
<del> propertyDidChange(array, 'firstObject');
<add> propertyWillChange(array, 'firstObject', meta);
<add> propertyDidChange(array, 'firstObject', meta);
<ide> }
<ide>
<ide> if (cache.lastObject !== undefined) {
<ide> let previousLastIndex = previousLength - 1;
<ide> let lastAffectedIndex = normalStartIdx + removedAmount;
<ide> if (previousLastIndex < lastAffectedIndex) {
<del> propertyWillChange(array, 'lastObject');
<del> propertyDidChange(array, 'lastObject');
<add> propertyWillChange(array, 'lastObject', meta);
<add> propertyDidChange(array, 'lastObject', meta);
<ide> }
<ide> }
<ide> } | 1 |
Python | Python | fix lint issue | 45d33fdacc79c182f8a17bd2f628e10c8ab184ec | <ide><path>libcloud/compute/drivers/openstack.py
<ide> def ex_list_subnets(self):
<ide> response = self.network_connection.request(
<ide> self._subnets_url_prefix).object
<ide> return self._to_subnets(response)
<add>
<ide> def ex_list_ports(self):
<ide> """
<ide> List all OpenStack_2_PortInterfaces | 1 |
Python | Python | fix base filters in one_hot | 4973fe3069b594f1cc808cc18bf473ff21ab7956 | <ide><path>keras/preprocessing/text.py
<ide> def text_to_word_sequence(text,
<ide> return [i for i in seq if i]
<ide>
<ide>
<del>def one_hot(text, n, filters=base_filter(), lower=True, split=" "):
<add>def one_hot(text, n,
<add> filters='!"#$%&()*+,-./:;<=>?@[\\]^_`{|}~\t\n',
<add> lower=True,
<add> split=' '):
<ide> seq = text_to_word_sequence(text,
<ide> filters=filters,
<ide> lower=lower, | 1 |
Go | Go | remove unneeded "digest" alias for "go-digest" | a0230f3d9a1f650c06142a2865f8aed08e3a7f0d | <ide><path>builder/builder-next/adapters/containerimage/pull.go
<ide> import (
<ide> "github.com/moby/buildkit/util/leaseutil"
<ide> "github.com/moby/buildkit/util/progress"
<ide> "github.com/moby/buildkit/util/resolver"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> "github.com/opencontainers/image-spec/identity"
<ide> ocispec "github.com/opencontainers/image-spec/specs-go/v1"
<ide> "github.com/pkg/errors"
<ide><path>builder/builder-next/adapters/localinlinecache/inlinecache.go
<ide> import (
<ide> "github.com/moby/buildkit/session"
<ide> "github.com/moby/buildkit/solver"
<ide> "github.com/moby/buildkit/worker"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> specs "github.com/opencontainers/image-spec/specs-go/v1"
<ide> "github.com/pkg/errors"
<ide> )
<ide><path>builder/builder-next/adapters/snapshot/snapshot.go
<ide> import (
<ide> "github.com/docker/docker/pkg/idtools"
<ide> "github.com/moby/buildkit/identity"
<ide> "github.com/moby/buildkit/snapshot"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> "github.com/pkg/errors"
<ide> bolt "go.etcd.io/bbolt"
<ide> )
<ide><path>builder/builder-next/exporter/export.go
<ide> import (
<ide> "github.com/docker/docker/reference"
<ide> "github.com/moby/buildkit/exporter"
<ide> "github.com/moby/buildkit/exporter/containerimage/exptypes"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> "github.com/pkg/errors"
<ide> "github.com/sirupsen/logrus"
<ide> )
<ide><path>builder/builder-next/exporter/writer.go
<ide> import (
<ide> "github.com/moby/buildkit/cache"
<ide> "github.com/moby/buildkit/util/progress"
<ide> "github.com/moby/buildkit/util/system"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> ocispec "github.com/opencontainers/image-spec/specs-go/v1"
<ide> "github.com/pkg/errors"
<ide> "github.com/sirupsen/logrus"
<ide><path>builder/builder-next/imagerefchecker/checker.go
<ide> import (
<ide> "github.com/docker/docker/image"
<ide> "github.com/docker/docker/layer"
<ide> "github.com/moby/buildkit/cache"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> )
<ide>
<ide> // LayerGetter abstracts away the snapshotter
<ide><path>builder/builder-next/worker/worker.go
<ide> import (
<ide> "github.com/moby/buildkit/util/compression"
<ide> "github.com/moby/buildkit/util/contentutil"
<ide> "github.com/moby/buildkit/util/progress"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> ocispec "github.com/opencontainers/image-spec/specs-go/v1"
<ide> "github.com/pkg/errors"
<ide> "github.com/sirupsen/logrus"
<ide><path>builder/remotecontext/tarsum.go
<ide> import (
<ide>
<ide> "github.com/docker/docker/pkg/containerfs"
<ide> iradix "github.com/hashicorp/go-immutable-radix"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> "github.com/pkg/errors"
<ide> "github.com/tonistiigi/fsutil"
<ide> )
<ide><path>client/service_create.go
<ide> import (
<ide> "github.com/docker/distribution/reference"
<ide> "github.com/docker/docker/api/types"
<ide> "github.com/docker/docker/api/types/swarm"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> "github.com/pkg/errors"
<ide> )
<ide>
<ide><path>client/service_create_test.go
<ide> import (
<ide> registrytypes "github.com/docker/docker/api/types/registry"
<ide> "github.com/docker/docker/api/types/swarm"
<ide> "github.com/docker/docker/errdefs"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> v1 "github.com/opencontainers/image-spec/specs-go/v1"
<ide> "gotest.tools/v3/assert"
<ide> is "gotest.tools/v3/assert/cmp"
<ide><path>daemon/cluster/executor/container/adapter.go
<ide> import (
<ide> "github.com/docker/swarmkit/api"
<ide> "github.com/docker/swarmkit/log"
<ide> gogotypes "github.com/gogo/protobuf/types"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> "github.com/pkg/errors"
<ide> "github.com/sirupsen/logrus"
<ide> "golang.org/x/time/rate"
<ide><path>daemon/images/image.go
<ide> import (
<ide> "github.com/docker/distribution/reference"
<ide> "github.com/docker/docker/errdefs"
<ide> "github.com/docker/docker/image"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> specs "github.com/opencontainers/image-spec/specs-go/v1"
<ide> "github.com/pkg/errors"
<ide> "github.com/sirupsen/logrus"
<ide><path>daemon/images/image_prune.go
<ide> import (
<ide> "github.com/docker/docker/errdefs"
<ide> "github.com/docker/docker/image"
<ide> "github.com/docker/docker/layer"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> "github.com/pkg/errors"
<ide> "github.com/sirupsen/logrus"
<ide> )
<ide><path>daemon/images/image_pull.go
<ide> import (
<ide> "github.com/docker/docker/errdefs"
<ide> "github.com/docker/docker/pkg/progress"
<ide> "github.com/docker/docker/pkg/streamformatter"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> specs "github.com/opencontainers/image-spec/specs-go/v1"
<ide> "github.com/pkg/errors"
<ide> "github.com/sirupsen/logrus"
<ide><path>daemon/images/service.go
<ide> import (
<ide> dockerreference "github.com/docker/docker/reference"
<ide> "github.com/docker/docker/registry"
<ide> "github.com/docker/libtrust"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> "github.com/pkg/errors"
<ide> "github.com/sirupsen/logrus"
<ide> "golang.org/x/sync/singleflight"
<ide><path>daemon/images/store.go
<ide> import (
<ide> "github.com/docker/docker/distribution"
<ide> "github.com/docker/docker/image"
<ide> "github.com/docker/docker/layer"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> "github.com/pkg/errors"
<ide> "github.com/sirupsen/logrus"
<ide> )
<ide><path>daemon/images/store_test.go
<ide> import (
<ide> "github.com/containerd/containerd/metadata"
<ide> "github.com/containerd/containerd/namespaces"
<ide> "github.com/docker/docker/image"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> v1 "github.com/opencontainers/image-spec/specs-go/v1"
<ide> "go.etcd.io/bbolt"
<ide> "gotest.tools/v3/assert"
<ide><path>daemon/list_test.go
<ide> import (
<ide> "github.com/docker/docker/container"
<ide> "github.com/docker/docker/image"
<ide> "github.com/google/uuid"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> "gotest.tools/v3/assert"
<ide> is "gotest.tools/v3/assert/cmp"
<ide> )
<ide><path>distribution/config.go
<ide> import (
<ide> refstore "github.com/docker/docker/reference"
<ide> "github.com/docker/docker/registry"
<ide> "github.com/docker/libtrust"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> specs "github.com/opencontainers/image-spec/specs-go/v1"
<ide> "github.com/pkg/errors"
<ide> )
<ide><path>distribution/manifest.go
<ide> import (
<ide> "github.com/docker/distribution/manifest/manifestlist"
<ide> "github.com/docker/distribution/manifest/schema1"
<ide> "github.com/docker/distribution/manifest/schema2"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> specs "github.com/opencontainers/image-spec/specs-go/v1"
<ide> "github.com/pkg/errors"
<ide> )
<ide><path>distribution/manifest_test.go
<ide> import (
<ide> "github.com/docker/distribution/manifest/schema1"
<ide> "github.com/docker/distribution/manifest/schema2"
<ide> "github.com/google/go-cmp/cmp/cmpopts"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> specs "github.com/opencontainers/image-spec/specs-go/v1"
<ide> "github.com/pkg/errors"
<ide> "gotest.tools/v3/assert"
<ide><path>distribution/metadata/v2_metadata_service.go
<ide> import (
<ide>
<ide> "github.com/docker/docker/api/types"
<ide> "github.com/docker/docker/layer"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> )
<ide>
<ide> // V2MetadataService maps layer IDs to a set of known metadata for
<ide><path>distribution/metadata/v2_metadata_service_test.go
<ide> import (
<ide> "testing"
<ide>
<ide> "github.com/docker/docker/layer"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> )
<ide>
<ide> func TestV2MetadataService(t *testing.T) {
<ide><path>distribution/pull.go
<ide> import (
<ide> "github.com/docker/docker/pkg/progress"
<ide> refstore "github.com/docker/docker/reference"
<ide> "github.com/docker/docker/registry"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> "github.com/pkg/errors"
<ide> "github.com/sirupsen/logrus"
<ide> )
<ide><path>distribution/pull_v2.go
<ide> import (
<ide> "github.com/docker/docker/pkg/system"
<ide> refstore "github.com/docker/docker/reference"
<ide> "github.com/docker/docker/registry"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> specs "github.com/opencontainers/image-spec/specs-go/v1"
<ide> "github.com/pkg/errors"
<ide> "github.com/sirupsen/logrus"
<ide><path>distribution/pull_v2_test.go
<ide> import (
<ide>
<ide> "github.com/docker/distribution/manifest/schema1"
<ide> "github.com/docker/distribution/reference"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> specs "github.com/opencontainers/image-spec/specs-go/v1"
<ide> "gotest.tools/v3/assert"
<ide> is "gotest.tools/v3/assert/cmp"
<ide><path>distribution/push_v2.go
<ide> import (
<ide> "github.com/docker/docker/pkg/progress"
<ide> "github.com/docker/docker/pkg/stringid"
<ide> "github.com/docker/docker/registry"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> "github.com/pkg/errors"
<ide> "github.com/sirupsen/logrus"
<ide> )
<ide><path>distribution/push_v2_test.go
<ide> import (
<ide> "github.com/docker/docker/pkg/progress"
<ide> refstore "github.com/docker/docker/reference"
<ide> "github.com/docker/docker/registry"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> )
<ide>
<ide> func TestGetRepositoryMountCandidates(t *testing.T) {
<ide><path>distribution/xfer/download_test.go
<ide> import (
<ide> "github.com/docker/docker/image"
<ide> "github.com/docker/docker/layer"
<ide> "github.com/docker/docker/pkg/progress"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> "gotest.tools/v3/assert"
<ide> )
<ide>
<ide><path>image/fs.go
<ide> import (
<ide> "sync"
<ide>
<ide> "github.com/docker/docker/pkg/ioutils"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> "github.com/pkg/errors"
<ide> "github.com/sirupsen/logrus"
<ide> )
<ide><path>image/fs_test.go
<ide> import (
<ide> "path/filepath"
<ide> "testing"
<ide>
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> "gotest.tools/v3/assert"
<ide> is "gotest.tools/v3/assert/cmp"
<ide> )
<ide><path>image/image.go
<ide> import (
<ide> "github.com/docker/docker/api/types/container"
<ide> "github.com/docker/docker/dockerversion"
<ide> "github.com/docker/docker/layer"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> )
<ide>
<ide> // ID is the content-addressable ID of an image.
<ide><path>image/store.go
<ide> import (
<ide> "github.com/docker/distribution/digestset"
<ide> "github.com/docker/docker/layer"
<ide> "github.com/docker/docker/pkg/system"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> "github.com/pkg/errors"
<ide> "github.com/sirupsen/logrus"
<ide> )
<ide><path>image/tarexport/load.go
<ide> import (
<ide> "github.com/docker/docker/pkg/stringid"
<ide> "github.com/docker/docker/pkg/system"
<ide> "github.com/moby/sys/symlink"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> "github.com/sirupsen/logrus"
<ide> )
<ide>
<ide><path>image/tarexport/save.go
<ide> import (
<ide> "github.com/docker/docker/layer"
<ide> "github.com/docker/docker/pkg/archive"
<ide> "github.com/docker/docker/pkg/system"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> "github.com/pkg/errors"
<ide> )
<ide>
<ide><path>image/v1/imagev1.go
<ide> import (
<ide> "github.com/docker/docker/image"
<ide> "github.com/docker/docker/layer"
<ide> "github.com/docker/docker/pkg/stringid"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> "github.com/sirupsen/logrus"
<ide> )
<ide>
<ide><path>integration-cli/docker_cli_build_test.go
<ide> import (
<ide> "github.com/docker/docker/testutil/fakegit"
<ide> "github.com/docker/docker/testutil/fakestorage"
<ide> "github.com/moby/buildkit/frontend/dockerfile/command"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> "gotest.tools/v3/assert"
<ide> "gotest.tools/v3/assert/cmp"
<ide> "gotest.tools/v3/icmd"
<ide><path>integration-cli/docker_cli_by_digest_test.go
<ide> import (
<ide> "github.com/docker/docker/api/types"
<ide> "github.com/docker/docker/integration-cli/cli"
<ide> "github.com/docker/docker/integration-cli/cli/build"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> "gotest.tools/v3/assert"
<ide> is "gotest.tools/v3/assert/cmp"
<ide> )
<ide><path>integration-cli/docker_cli_pull_local_test.go
<ide> import (
<ide> "github.com/docker/distribution/manifest/manifestlist"
<ide> "github.com/docker/distribution/manifest/schema2"
<ide> "github.com/docker/docker/integration-cli/cli/build"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> "gotest.tools/v3/assert"
<ide> "gotest.tools/v3/icmd"
<ide> )
<ide><path>integration-cli/docker_cli_pull_test.go
<ide> import (
<ide> "testing"
<ide> "time"
<ide>
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> "gotest.tools/v3/assert"
<ide> is "gotest.tools/v3/assert/cmp"
<ide> )
<ide><path>integration-cli/docker_cli_save_load_test.go
<ide> import (
<ide> "time"
<ide>
<ide> "github.com/docker/docker/integration-cli/cli/build"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> "gotest.tools/v3/assert"
<ide> is "gotest.tools/v3/assert/cmp"
<ide> "gotest.tools/v3/icmd"
<ide><path>layer/empty_test.go
<ide> import (
<ide> "io"
<ide> "testing"
<ide>
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> )
<ide>
<ide> func TestEmptyLayer(t *testing.T) {
<ide><path>layer/filestore.go
<ide> import (
<ide>
<ide> "github.com/docker/distribution"
<ide> "github.com/docker/docker/pkg/ioutils"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> "github.com/pkg/errors"
<ide> "github.com/sirupsen/logrus"
<ide> )
<ide><path>layer/filestore_test.go
<ide> import (
<ide> "testing"
<ide>
<ide> "github.com/docker/docker/pkg/stringid"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> )
<ide>
<ide> func randomLayerID(seed int64) ChainID {
<ide><path>layer/layer.go
<ide> import (
<ide> "github.com/docker/distribution"
<ide> "github.com/docker/docker/pkg/archive"
<ide> "github.com/docker/docker/pkg/containerfs"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> "github.com/sirupsen/logrus"
<ide> )
<ide>
<ide><path>layer/layer_store.go
<ide> import (
<ide> "github.com/docker/docker/pkg/stringid"
<ide> "github.com/docker/docker/pkg/system"
<ide> "github.com/moby/locker"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> "github.com/sirupsen/logrus"
<ide> "github.com/vbatts/tar-split/tar/asm"
<ide> "github.com/vbatts/tar-split/tar/storage"
<ide><path>layer/layer_test.go
<ide> import (
<ide> "github.com/docker/docker/pkg/containerfs"
<ide> "github.com/docker/docker/pkg/idtools"
<ide> "github.com/docker/docker/pkg/stringid"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> )
<ide>
<ide> func init() {
<ide><path>layer/migration.go
<ide> import (
<ide> "io"
<ide> "os"
<ide>
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> "github.com/sirupsen/logrus"
<ide> "github.com/vbatts/tar-split/tar/asm"
<ide> "github.com/vbatts/tar-split/tar/storage"
<ide><path>layer/ro_layer.go
<ide> import (
<ide> "runtime"
<ide>
<ide> "github.com/docker/distribution"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> )
<ide>
<ide> type roLayer struct {
<ide><path>plugin/backend_linux.go
<ide> import (
<ide> "github.com/docker/docker/pkg/stringid"
<ide> v2 "github.com/docker/docker/plugin/v2"
<ide> "github.com/moby/sys/mount"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> specs "github.com/opencontainers/image-spec/specs-go/v1"
<ide> "github.com/pkg/errors"
<ide> "github.com/sirupsen/logrus"
<ide><path>plugin/fetch_linux.go
<ide> import (
<ide> "github.com/docker/docker/pkg/ioutils"
<ide> "github.com/docker/docker/pkg/progress"
<ide> "github.com/docker/docker/pkg/stringid"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> specs "github.com/opencontainers/image-spec/specs-go/v1"
<ide> "github.com/pkg/errors"
<ide> "github.com/sirupsen/logrus"
<ide><path>plugin/manager.go
<ide> import (
<ide> "github.com/docker/docker/pkg/pubsub"
<ide> v2 "github.com/docker/docker/plugin/v2"
<ide> "github.com/docker/docker/registry"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> specs "github.com/opencontainers/runtime-spec/specs-go"
<ide> "github.com/pkg/errors"
<ide> "github.com/sirupsen/logrus"
<ide><path>plugin/manager_linux.go
<ide> import (
<ide> "github.com/docker/docker/pkg/stringid"
<ide> v2 "github.com/docker/docker/plugin/v2"
<ide> "github.com/moby/sys/mount"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> specs "github.com/opencontainers/image-spec/specs-go/v1"
<ide> "github.com/pkg/errors"
<ide> "github.com/sirupsen/logrus"
<ide><path>plugin/v2/plugin.go
<ide> import (
<ide> "github.com/docker/docker/api/types"
<ide> "github.com/docker/docker/pkg/plugingetter"
<ide> "github.com/docker/docker/pkg/plugins"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> specs "github.com/opencontainers/runtime-spec/specs-go"
<ide> )
<ide>
<ide><path>reference/store.go
<ide> import (
<ide>
<ide> "github.com/docker/distribution/reference"
<ide> "github.com/docker/docker/pkg/ioutils"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> "github.com/pkg/errors"
<ide> )
<ide>
<ide><path>reference/store_test.go
<ide> import (
<ide> "testing"
<ide>
<ide> "github.com/docker/distribution/reference"
<del> digest "github.com/opencontainers/go-digest"
<add> "github.com/opencontainers/go-digest"
<ide> "gotest.tools/v3/assert"
<ide> is "gotest.tools/v3/assert/cmp"
<ide> ) | 56 |
Text | Text | add links to apache software and docs | 89990e69286556448ba3a8588ee826c93bedf0af | <ide><path>guide/english/apache/index.md
<ide> Their purpose is supporting Apache software projects under Apache license.
<ide>
<ide> ## Apache HTTP Server
<ide>
<del>The Apache HTTP Server, commonly known as Apache, is a free and open-source cross-platform web server, released under the terms of [Apache License 2.0](https://en.wikipedia.org/wiki/Apache_License). Apache is developed and maintained by an open community of developers under the auspices of the Apache Software Foundation.
<del>Apache runs on 67% of all webservers in the world. It is fast, reliable, and secure. It can be highly customized to meet the needs of many different environments by using extensions and modules.
<add>The Apache HTTP Server, commonly known as Apache, is a free and open-source cross-platform web server, released under the terms of [Apache License 2.0](https://en.wikipedia.org/wiki/Apache_License). Apache is developed and maintained by an open community of developers under the auspices of the [Apache Software Foundation](http://www.apache.org/).
<ide>
<add>Apache runs on 67% of all webservers in the world. It is fast, reliable, and secure. It can be highly customized to meet the needs of many different environments by using extensions and modules.
<ide>
<ide> ## Installation
<ide>
<ide> You can copy the `default.conf` and modify accordingly in the following director
<ide>
<ide> ### Getting Started Guides
<ide> - [Getting Started with Apache HTTP Server Version 2.5](https://httpd.apache.org/docs/trunk/getting-started.html)
<add>
<add>### Documentation
<add>- [Apache HTTP Server Documentation](http://httpd.apache.org/docs/) | 1 |
Python | Python | remove types from kpo docstring | a159ae828f92eb2590f47762a52d10ea03b1a465 | <ide><path>airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py
<ide> class KubernetesPodOperator(BaseOperator):
<ide> The docker images's entrypoint is used if this is not provided.
<ide> :param arguments: arguments of the entrypoint. (templated)
<ide> The docker image's CMD is used if this is not provided.
<del> :param ports: ports for launched pod.
<del> :param volume_mounts: volumeMounts for launched pod.
<del> :param volumes: volumes for launched pod. Includes ConfigMaps and PersistentVolumes.
<add> :param ports: ports for the launched pod.
<add> :param volume_mounts: volumeMounts for the launched pod.
<add> :param volumes: volumes for the launched pod. Includes ConfigMaps and PersistentVolumes.
<ide> :param env_vars: Environment variables initialized in the container. (templated)
<ide> :param secrets: Kubernetes secrets to inject in the container.
<ide> They can be exposed as environment vars or files in a volume.
<ide> class KubernetesPodOperator(BaseOperator):
<ide> :param annotations: non-identifying metadata you can attach to the Pod.
<ide> Can be a large range of data, and can include characters
<ide> that are not permitted by labels.
<del> :param resources: A dict containing resources requests and limits.
<del> Possible keys are request_memory, request_cpu, limit_memory, limit_cpu,
<del> and limit_gpu, which will be used to generate airflow.kubernetes.pod.Resources.
<del> See also kubernetes.io/docs/concepts/configuration/manage-compute-resources-container
<del> :param affinity: A dict containing a group of affinity scheduling rules.
<add> :param resources: resources for the launched pod.
<add> :param affinity: affinity scheduling rules for the launched pod.
<ide> :param config_file: The path to the Kubernetes config file. (templated)
<ide> If not specified, default value is ``~/.kube/config``
<ide> :param node_selector: A dict containing a group of scheduling rules.
<ide> class KubernetesPodOperator(BaseOperator):
<ide> :param priority_class_name: priority class name for the launched Pod
<ide> :param termination_grace_period: Termination grace period if task killed in UI,
<ide> defaults to kubernetes default
<del>
<ide> """
<ide>
<ide> BASE_CONTAINER_NAME = 'base' | 1 |
PHP | PHP | fix typo in the console output | 3a9ab0e3be91cc9c2a57b4b313f6f07c97233e88 | <ide><path>src/Shell/I18nShell.php
<ide> public function main()
<ide> $this->out('<info>I18n Shell</info>');
<ide> $this->hr();
<ide> $this->out('[E]xtract POT file from sources');
<del> $this->out('[I]inialize a language from POT file');
<add> $this->out('[I]nitialize a language from POT file');
<ide> $this->out('[H]elp');
<ide> $this->out('[Q]uit');
<ide> | 1 |
Ruby | Ruby | respect model.record_timestamps? in upsert_all | c5c4315259254ddb12272839e502659e2fee1240 | <ide><path>activerecord/lib/active_record/insert_all.rb
<ide> def initialize(model, inserts, on_duplicate:, returning: nil, unique_by: nil)
<ide>
<ide> @model, @connection, @inserts, @keys = model, model.connection, inserts, inserts.first.keys.map(&:to_s)
<ide> @on_duplicate, @returning, @unique_by = on_duplicate, returning, unique_by
<add> @record_timestamps = model.record_timestamps
<ide>
<ide> disallow_raw_sql!(returning)
<ide> disallow_raw_sql!(on_duplicate)
<ide> def map_key_with_value
<ide> inserts.map do |attributes|
<ide> attributes = attributes.stringify_keys
<ide> attributes.merge!(scope_attributes) if scope_attributes
<add> attributes.reverse_merge!(timestamps_for_create) if record_timestamps?
<ide>
<ide> verify_attributes(attributes)
<ide>
<del> keys.map do |key|
<add> keys_including_timestamps.map do |key|
<ide> yield key, attributes[key]
<ide> end
<ide> end
<ide> end
<ide>
<add> def record_timestamps?
<add> @record_timestamps
<add> end
<add>
<add> # TODO: Consider remaining this method, as it only conditionally extends keys, not always
<add> def keys_including_timestamps
<add> @keys_including_timestamps ||= if record_timestamps?
<add> keys + model.all_timestamp_attributes_in_model
<add> else
<add> keys
<add> end
<add> end
<add>
<ide> private
<ide> attr_reader :scope_attributes
<ide>
<ide> def unique_by_columns
<ide>
<ide>
<ide> def verify_attributes(attributes)
<del> if keys != attributes.keys.to_set
<add> if keys_including_timestamps != attributes.keys.to_set
<ide> raise ArgumentError, "All objects being inserted must have the same keys"
<ide> end
<ide> end
<ide> def disallow_raw_sql!(value)
<ide> "by wrapping them in Arel.sql()."
<ide> end
<ide>
<add> def timestamps_for_create
<add> model.all_timestamp_attributes_in_model.index_with(connection.high_precision_current_timestamp)
<add> end
<add>
<ide> class Builder # :nodoc:
<ide> attr_reader :model
<ide>
<del> delegate :skip_duplicates?, :update_duplicates?, :keys, to: :insert_all
<add> delegate :skip_duplicates?, :update_duplicates?, :keys, :keys_including_timestamps, :record_timestamps?, to: :insert_all
<ide>
<ide> def initialize(insert_all)
<ide> @insert_all, @model, @connection = insert_all, insert_all.model, insert_all.connection
<ide> def into
<ide> end
<ide>
<ide> def values_list
<del> types = extract_types_from_columns_on(model.table_name, keys: keys)
<add> types = extract_types_from_columns_on(model.table_name, keys: keys_including_timestamps)
<ide>
<ide> values_list = insert_all.map_key_with_value do |key, value|
<add> next value if Arel::Nodes::SqlLiteral === value
<ide> connection.with_yaml_fallback(types[key].serialize(value))
<ide> end
<ide>
<ide> def updatable_columns
<ide> end
<ide>
<ide> def touch_model_timestamps_unless(&block)
<del> return "" unless update_duplicates?
<add> return "" unless update_duplicates? && record_timestamps?
<ide>
<ide> model.timestamp_attributes_for_update_in_model.filter_map do |column_name|
<ide> if touch_timestamp_attribute?(column_name)
<ide> def touch_timestamp_attribute?(column_name)
<ide> end
<ide>
<ide> def columns_list
<del> format_columns(insert_all.keys)
<add> format_columns(insert_all.keys_including_timestamps)
<ide> end
<ide>
<ide> def extract_types_from_columns_on(table_name, keys:)
<ide><path>activerecord/test/cases/insert_all_test.rb
<ide> def test_upsert_all_uses_given_updated_on_over_implicit_updated_on
<ide> assert_equal updated_on, Book.find(101).updated_on
<ide> end
<ide>
<del> def test_upsert_all_does_not_implicitly_set_timestamps_on_create_even_when_model_record_timestamps_is_true
<add> def test_upsert_all_implicitly_sets_timestamps_on_create_when_model_record_timestamps_is_true
<ide> with_record_timestamps(Ship, true) do
<ide> Ship.upsert_all [{ id: 101, name: "RSS Boaty McBoatface" }]
<ide>
<ide> ship = Ship.find(101)
<del> assert_nil ship.created_at
<del> assert_nil ship.created_on
<del> assert_nil ship.updated_at
<del> assert_nil ship.updated_on
<add> assert_equal Time.new.year, ship.created_at.year
<add> assert_equal Time.new.year, ship.created_on.year
<add> assert_equal Time.new.year, ship.updated_at.year
<add> assert_equal Time.new.year, ship.updated_on.year
<ide> end
<ide> end
<ide>
<ide> def test_upsert_all_implicitly_sets_timestamps_on_update_when_model_record_times
<ide> end
<ide> end
<ide>
<del> def test_upsert_all_implicitly_sets_timestamps_on_update_even_when_model_record_timestamps_is_false
<add> def test_upsert_all_does_not_implicitly_set_timestamps_on_update_when_model_record_timestamps_is_false
<ide> skip unless supports_insert_on_duplicate_update?
<ide>
<ide> with_record_timestamps(Ship, false) do
<ide> def test_upsert_all_implicitly_sets_timestamps_on_update_even_when_model_record_
<ide> ship = Ship.find(101)
<ide> assert_nil ship.created_at
<ide> assert_nil ship.created_on
<del> assert_equal Time.now.year, ship.updated_at.year
<del> assert_equal Time.now.year, ship.updated_on.year
<add> assert_nil ship.updated_at
<add> assert_nil ship.updated_on
<ide> end
<ide> end
<ide> | 2 |
Python | Python | handle empty data with serializer | b4199704316bd2d67281cbc3cf946eab9bded407 | <ide><path>rest_framework/serializers.py
<ide> def data(self):
<ide> @property
<ide> def errors(self):
<ide> ret = super(Serializer, self).errors
<add> if isinstance(ret, list) and len(ret) == 1 and ret[0].code == 'null':
<add> # Edge case. Provide a more descriptive error than
<add> # "this field may not be null", when no data is passed.
<add> detail = ErrorDetail('No data provided', code='null')
<add> ret = {api_settings.NON_FIELD_ERRORS_KEY: [detail]}
<ide> return ReturnDict(ret, serializer=self)
<ide>
<ide>
<ide> def data(self):
<ide> @property
<ide> def errors(self):
<ide> ret = super(ListSerializer, self).errors
<add> if isinstance(ret, list) and len(ret) == 1 and ret[0].code == 'null':
<add> # Edge case. Provide a more descriptive error than
<add> # "this field may not be null", when no data is passed.
<add> detail = ErrorDetail('No data provided', code='null')
<add> ret = {api_settings.NON_FIELD_ERRORS_KEY: [detail]}
<ide> if isinstance(ret, dict):
<ide> return ReturnDict(ret, serializer=self)
<ide> return ReturnList(ret, serializer=self)
<ide><path>tests/test_serializer.py
<ide> def create(validated_data):
<ide> with pytest.raises(AssertionError):
<ide> serializer.save()
<ide>
<add> def test_validate_none_data(self):
<add> data = None
<add> serializer = self.Serializer(data=data)
<add> assert not serializer.is_valid()
<add> assert serializer.errors == {'non_field_errors': ['No data provided']}
<add>
<ide>
<ide> class TestValidateMethod:
<ide> def test_non_field_error_validate_method(self):
<ide><path>tests/test_serializer_nested.py
<ide> def test_nested_serialize_empty(self):
<ide> serializer = self.Serializer()
<ide> assert serializer.data == expected_data
<ide>
<add> def test_nested_serialize_no_data(self):
<add> data = None
<add> serializer = self.Serializer(data=data)
<add> assert not serializer.is_valid()
<add> assert serializer.errors == {'non_field_errors': ['No data provided']}
<add>
<ide>
<ide> class TestNotRequiredNestedSerializer:
<ide> def setup(self): | 3 |
Javascript | Javascript | add missing types | 84f9842d547845c0a65d5d1ae820b0245c954927 | <ide><path>lib/RuntimeModule.js
<ide> const Module = require("./Module");
<ide> const TYPES = new Set(["runtime"]);
<ide>
<ide> class RuntimeModule extends Module {
<add> /**
<add> * @param {string} name a readable name
<add> * @param {number=} stage an optional stage
<add> */
<ide> constructor(name, stage = 0) {
<ide> super("runtime");
<ide> this.name = name;
<ide> this.stage = stage;
<ide> this.buildMeta = {};
<ide> this.buildInfo = {};
<add> /** @type {string} */
<ide> this._cachedGeneratedCode = undefined;
<ide> }
<ide>
<ide> class RuntimeModule extends Module {
<ide> * @returns {string} runtime code
<ide> */
<ide> getGeneratedCode() {
<del> if (this._cachedGeneratedCode) return this._cachedGeneratedCode;
<add> if (this._cachedGeneratedCode) {
<add> return this._cachedGeneratedCode;
<add> }
<ide> return (this._cachedGeneratedCode = this.generate());
<ide> }
<ide> }
<ide><path>lib/RuntimePlugin.js
<ide> class RuntimePlugin {
<ide> /\[(full)?hash(:\d+)?\]/.test(
<ide> compilation.outputOptions.hotUpdateMainFilename
<ide> )
<del> )
<add> ) {
<ide> set.add(RuntimeGlobals.getFullHash);
<add> }
<ide> compilation.addRuntimeModule(
<ide> chunk,
<ide> new GetMainFilenameRuntimeModule(
<ide> compilation,
<del> chunk,
<ide> "update manifest",
<ide> RuntimeGlobals.getUpdateManifestFilename,
<ide> compilation.outputOptions.hotUpdateMainFilename
<ide><path>lib/runtime/ChunkNameRuntimeModule.js
<ide> const RuntimeGlobals = require("../RuntimeGlobals");
<ide> const RuntimeModule = require("../RuntimeModule");
<ide>
<ide> class ChunkNameRuntimeModule extends RuntimeModule {
<add> /**
<add> * @param {string} chunkName the chunk's name
<add> */
<ide> constructor(chunkName) {
<ide> super("chunkName");
<ide> this.chunkName = chunkName;
<ide><path>lib/runtime/EnsureChunkRuntimeModule.js
<ide> class EnsureChunkRuntimeModule extends RuntimeModule {
<ide> "// The chunk loading function for additional chunks",
<ide> `${RuntimeGlobals.ensureChunk} = function requireEnsure(chunkId) {`,
<ide> Template.indent([
<del> `return Promise.all(Object.keys(${handlers}).reduce(function(promises, key) { ${handlers}[key](chunkId, promises); return promises; }, []));`
<add> `return Promise.all(Object.keys(${handlers}).reduce(function(promises, key) {`,
<add> Template.indent([
<add> `${handlers}[key](chunkId, promises);`,
<add> "return promises;"
<add> ]),
<add> `}, []));`
<ide> ]),
<ide> "};"
<ide> ]);
<ide><path>lib/runtime/GetFullHashRuntimeModule.js
<ide> const RuntimeGlobals = require("../RuntimeGlobals");
<ide> const RuntimeModule = require("../RuntimeModule");
<ide>
<add>/** @typedef {import("../Compilation")} Compilation */
<add>
<ide> class GetFullHashRuntimeModule extends RuntimeModule {
<add> /**
<add> * @param {Compilation} compilation the compilation
<add> */
<ide> constructor(compilation) {
<ide> super("getFullHash");
<ide> this.compilation = compilation;
<ide><path>lib/runtime/GetMainFilenameRuntimeModule.js
<ide> const RuntimeGlobals = require("../RuntimeGlobals");
<ide> const RuntimeModule = require("../RuntimeModule");
<ide> const Template = require("../Template");
<ide>
<add>/** @typedef {import("../Compilation")} Compilation */
<add>
<ide> class GetMainFilenameRuntimeModule extends RuntimeModule {
<del> constructor(compilation, chunk, name, global, filename) {
<add> /**
<add> * @param {Compilation} compilation the compilation
<add> * @param {string} name readable name
<add> * @param {string} global global object binding
<add> * @param {string} filename main file name
<add> */
<add> constructor(compilation, name, global, filename) {
<ide> super(`get ${name} filename`);
<ide> this.compilation = compilation;
<del> this.chunk = chunk;
<ide> this.global = global;
<ide> this.filename = filename;
<ide> }
<ide><path>lib/runtime/HelperRuntimeModule.js
<ide> const RuntimeModule = require("../RuntimeModule");
<ide>
<ide> class HelperRuntimeModule extends RuntimeModule {
<add> /**
<add> * @param {string} name a readable name
<add> */
<ide> constructor(name) {
<ide> super(name);
<ide> }
<ide><path>lib/runtime/PublicPathRuntimeModule.js
<ide> const RuntimeGlobals = require("../RuntimeGlobals");
<ide> const RuntimeModule = require("../RuntimeModule");
<ide>
<add>/** @typedef {import("../Compilation")} Compilation */
<add>
<ide> class PublicPathRuntimeModule extends RuntimeModule {
<add> /**
<add> * @param {Compilation} compilation the compilation
<add> */
<ide> constructor(compilation) {
<ide> super("publicPath");
<ide> this.compilation = compilation;
<ide><path>lib/util/AsyncQueue.js
<ide> class AsyncQueue {
<ide> this._stopped = false;
<ide>
<ide> this.hooks = {
<add> /** @type {AsyncSeriesHook<[T]>} */
<ide> beforeAdd: new AsyncSeriesHook(["item"]),
<add> /** @type {SyncHook<[T]>} */
<ide> added: new SyncHook(["item"]),
<add> /** @type {AsyncSeriesHook<[T]>} */
<ide> beforeStart: new AsyncSeriesHook(["item"]),
<add> /** @type {SyncHook<[T]>} */
<ide> started: new SyncHook(["item"]),
<add> /** @type {SyncHook<[T, Error, R]>} */
<ide> result: new SyncHook(["item", "error", "result"])
<ide> };
<ide> | 9 |
PHP | PHP | add database connection to di container | 9cb46e6d6c4576aad6fcbc2e63a2837b2e2a4e95 | <ide><path>src/Illuminate/Database/DatabaseServiceProvider.php
<ide> public function register()
<ide> $this->app->singleton('db', function ($app) {
<ide> return new DatabaseManager($app, $app['db.factory']);
<ide> });
<add>
<add> $this->app->bind('db.connection', function ($app) {
<add> return $app['db']->connection();
<add> });
<ide> }
<ide>
<ide> /**
<ide><path>src/Illuminate/Foundation/Application.php
<ide> public function registerCoreContainerAliases()
<ide> 'cookie' => ['Illuminate\Cookie\CookieJar', 'Illuminate\Contracts\Cookie\Factory', 'Illuminate\Contracts\Cookie\QueueingFactory'],
<ide> 'encrypter' => ['Illuminate\Encryption\Encrypter', 'Illuminate\Contracts\Encryption\Encrypter'],
<ide> 'db' => 'Illuminate\Database\DatabaseManager',
<add> 'db.connection' => ['Illuminate\Database\Connection', 'Illuminate\Database\ConnectionInterface'],
<ide> 'events' => ['Illuminate\Events\Dispatcher', 'Illuminate\Contracts\Events\Dispatcher'],
<ide> 'files' => 'Illuminate\Filesystem\Filesystem',
<ide> 'filesystem' => ['Illuminate\Filesystem\FilesystemManager', 'Illuminate\Contracts\Filesystem\Factory'], | 2 |
Javascript | Javascript | fix typo in aca documentation [ci skip] | 966d3a7bf2c08c5c20213d29686cbb409a07734a | <ide><path>actioncable/app/javascript/action_cable/subscriptions.js
<ide> import Subscription from "./subscription"
<ide>
<del>// Collection class for creating (and internally managing) channel subscriptions. The only method intended to be triggered by the user
<del>// us ActionCable.Subscriptions#create, and it should be called through the consumer like so:
<add>// Collection class for creating (and internally managing) channel subscriptions.
<add>// The only method intended to be triggered by the user is ActionCable.Subscriptions#create,
<add>// and it should be called through the consumer like so:
<ide> //
<ide> // App = {}
<ide> // App.cable = ActionCable.createConsumer("ws://example.com/accounts/1") | 1 |
Python | Python | add newline at the end | 6393251803b6562d9b2ea98cf1385d1dbb0207d9 | <ide><path>Graphs/minimum_spanning_tree_kruskal.py
<ide> def find_parent(i):
<ide>
<ide> print(minimum_spanning_tree_cost)
<ide> for edge in minimum_spanning_tree:
<del> print(edge)
<ide>\ No newline at end of file
<add> print(edge) | 1 |
Javascript | Javascript | use template strings | 1ee36f614ce3813598ac2d3d75dccc39e1c93a2a | <ide><path>lib/util.js
<ide> exports.debuglog = function(set) {
<ide> debugEnviron = process.env.NODE_DEBUG || '';
<ide> set = set.toUpperCase();
<ide> if (!debugs[set]) {
<del> if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
<add> if (new RegExp(`\\b${set}\\b`, 'i').test(debugEnviron)) {
<ide> var pid = process.pid;
<ide> debugs[set] = function() {
<ide> var msg = exports.format.apply(exports, arguments);
<ide> function stylizeWithColor(str, styleType) {
<ide> var style = inspect.styles[styleType];
<ide>
<ide> if (style) {
<del> return '\u001b[' + inspect.colors[style][0] + 'm' + str +
<del> '\u001b[' + inspect.colors[style][1] + 'm';
<add> return `\u001b[${inspect.colors[style][0]}m${str}` +
<add> `\u001b[${inspect.colors[style][1]}m`;
<ide> } else {
<ide> return str;
<ide> }
<ide> function formatValue(ctx, value, recurseTimes) {
<ide> // Some type of object without properties can be shortcutted.
<ide> if (keys.length === 0) {
<ide> if (typeof value === 'function') {
<del> var name = value.name ? ': ' + value.name : '';
<del> return ctx.stylize('[Function' + name + ']', 'special');
<add> return ctx.stylize(`[Function${value.name ? `: ${value.name}` : ''}]`,
<add> 'special');
<ide> }
<ide> if (isRegExp(value)) {
<ide> return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
<ide> function formatValue(ctx, value, recurseTimes) {
<ide> // now check the `raw` value to handle boxed primitives
<ide> if (typeof raw === 'string') {
<ide> formatted = formatPrimitiveNoColor(ctx, raw);
<del> return ctx.stylize('[String: ' + formatted + ']', 'string');
<add> return ctx.stylize(`[String: ${formatted}]`, 'string');
<ide> }
<ide> if (typeof raw === 'symbol') {
<ide> formatted = formatPrimitiveNoColor(ctx, raw);
<del> return ctx.stylize('[Symbol: ' + formatted + ']', 'symbol');
<add> return ctx.stylize(`[Symbol: ${formatted}]`, 'symbol');
<ide> }
<ide> if (typeof raw === 'number') {
<ide> formatted = formatPrimitiveNoColor(ctx, raw);
<del> return ctx.stylize('[Number: ' + formatted + ']', 'number');
<add> return ctx.stylize(`[Number: ${formatted}]`, 'number');
<ide> }
<ide> if (typeof raw === 'boolean') {
<ide> formatted = formatPrimitiveNoColor(ctx, raw);
<del> return ctx.stylize('[Boolean: ' + formatted + ']', 'boolean');
<add> return ctx.stylize(`[Boolean: ${formatted}]`, 'boolean');
<ide> }
<ide> // Fast path for ArrayBuffer and SharedArrayBuffer.
<ide> // Can't do the same for DataView because it has a non-primitive
<ide> function formatValue(ctx, value, recurseTimes) {
<ide>
<ide> // Make functions say that they are functions
<ide> if (typeof value === 'function') {
<del> var n = value.name ? ': ' + value.name : '';
<del> base = ' [Function' + n + ']';
<add> base = ` [Function${value.name ? `: ${value.name}` : ''}]`;
<ide> }
<ide>
<ide> // Make RegExps say that they are RegExps
<ide> function formatValue(ctx, value, recurseTimes) {
<ide> // Make boxed primitive Strings look like such
<ide> if (typeof raw === 'string') {
<ide> formatted = formatPrimitiveNoColor(ctx, raw);
<del> base = ' ' + '[String: ' + formatted + ']';
<add> base = ` [String: ${formatted}]`;
<ide> }
<ide>
<ide> // Make boxed primitive Numbers look like such
<ide> if (typeof raw === 'number') {
<ide> formatted = formatPrimitiveNoColor(ctx, raw);
<del> base = ' ' + '[Number: ' + formatted + ']';
<add> base = ` [Number: ${formatted}]`;
<ide> }
<ide>
<ide> // Make boxed primitive Booleans look like such
<ide> if (typeof raw === 'boolean') {
<ide> formatted = formatPrimitiveNoColor(ctx, raw);
<del> base = ' ' + '[Boolean: ' + formatted + ']';
<add> base = ` [Boolean: ${formatted}]`;
<ide> }
<ide>
<ide> // Add constructor name if available
<ide> if (base === '' && constructor)
<del> braces[0] = constructor.name + ' ' + braces[0];
<add> braces[0] = `${constructor.name} ${braces[0]}`;
<ide>
<ide> if (empty === true) {
<ide> return braces[0] + base + braces[1];
<ide> function formatPrimitiveNoColor(ctx, value) {
<ide>
<ide>
<ide> function formatError(value) {
<del> return value.stack || '[' + Error.prototype.toString.call(value) + ']';
<add> return value.stack || `[${Error.prototype.toString.call(value)}]`;
<ide> }
<ide>
<ide>
<ide> function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
<ide> }
<ide> if (!hasOwnProperty(visibleKeys, key)) {
<ide> if (typeof key === 'symbol') {
<del> name = '[' + ctx.stylize(key.toString(), 'symbol') + ']';
<add> name = `[${ctx.stylize(key.toString(), 'symbol')}]`;
<ide> } else {
<del> name = '[' + key + ']';
<add> name = `[${key}]`;
<ide> }
<ide> }
<ide> if (!str) {
<ide> function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
<ide> }
<ide> }
<ide>
<del> return name + ': ' + str;
<add> return `${name}: ${str}`;
<ide> }
<ide>
<ide>
<ide> function reduceToSingleString(output, base, braces, breakLength) {
<ide> // we need to force the first item to be on the next line or the
<ide> // items will not line up correctly.
<ide> (base === '' && braces[0].length === 1 ? '' : base + '\n ') +
<del> ' ' +
<del> output.join(',\n ') +
<del> ' ' +
<del> braces[1];
<add> ` ${output.join(',\n ')} ${braces[1]}`;
<ide> }
<ide>
<del> return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
<add> return `${braces[0]}${base} ${output.join(', ')} ${braces[1]}`;
<ide> }
<ide>
<ide>
<ide> exports.puts = internalUtil.deprecate(function() {
<ide>
<ide>
<ide> exports.debug = internalUtil.deprecate(function(x) {
<del> process.stderr.write('DEBUG: ' + x + '\n');
<add> process.stderr.write(`DEBUG: ${x}\n`);
<ide> }, 'util.debug is deprecated. Use console.error instead.');
<ide>
<ide>
<ide> exports.error = internalUtil.deprecate(function(x) {
<ide>
<ide> exports._errnoException = function(err, syscall, original) {
<ide> var errname = uv.errname(err);
<del> var message = syscall + ' ' + errname;
<add> var message = `${syscall} ${errname}`;
<ide> if (original)
<ide> message += ' ' + original;
<ide> var e = new Error(message);
<ide> exports._exceptionWithHostPort = function(err,
<ide> additional) {
<ide> var details;
<ide> if (port && port > 0) {
<del> details = address + ':' + port;
<add> details = `${address}:${port}`;
<ide> } else {
<ide> details = address;
<ide> }
<ide>
<ide> if (additional) {
<del> details += ' - Local (' + additional + ')';
<add> details += ` - Local (${additional})`;
<ide> }
<ide> var ex = exports._errnoException(err, syscall, details);
<ide> ex.address = address; | 1 |
Javascript | Javascript | fix readablestate.awaitdrain mechanism | 819b2d36bcffdb9f33e0e4497ac818d64fe5711d | <ide><path>lib/_stream_readable.js
<ide> Readable.prototype.pipe = function(dest, pipeOpts) {
<ide> // If the user unpiped during `dest.write()`, it is possible
<ide> // to get stuck in a permanently paused state if that write
<ide> // also returned false.
<del> if (state.pipesCount === 1 &&
<del> state.pipes[0] === dest &&
<del> src.listenerCount('data') === 1 &&
<add> // => Check whether `dest` is still a piping destination.
<add> if (((state.pipesCount === 1 && state.pipes === dest) ||
<add> (state.pipesCount > 1 && state.pipes.indexOf(dest) !== -1)) &&
<ide> !cleanedUp) {
<ide> debug('false write response, pause', src._readableState.awaitDrain);
<ide> src._readableState.awaitDrain++;
<ide><path>test/parallel/test-stream-pipe-await-drain.js
<add>'use strict';
<add>const common = require('../common');
<add>const stream = require('stream');
<add>
<add>// This is very similar to test-stream-pipe-cleanup-pause.js.
<add>
<add>const reader = new stream.Readable();
<add>const writer1 = new stream.Writable();
<add>const writer2 = new stream.Writable();
<add>
<add>// 560000 is chosen here because it is larger than the (default) highWaterMark
<add>// and will cause `.write()` to return false
<add>// See: https://github.com/nodejs/node/issues/5820
<add>const buffer = Buffer.allocUnsafe(560000);
<add>
<add>reader._read = function(n) {};
<add>
<add>writer1._write = common.mustCall(function(chunk, encoding, cb) {
<add> this.emit('chunk-received');
<add> cb();
<add>}, 1);
<add>writer1.once('chunk-received', function() {
<add> setImmediate(function() {
<add> // This one should *not* get through to writer1 because writer2 is not
<add> // "done" processing.
<add> reader.push(buffer);
<add> });
<add>});
<add>
<add>// A "slow" consumer:
<add>writer2._write = common.mustCall(function(chunk, encoding, cb) {
<add> // Not calling cb here to "simulate" slow stream.
<add>
<add> // This should be called exactly once, since the first .write() call
<add> // will return false.
<add>}, 1);
<add>
<add>reader.pipe(writer1);
<add>reader.pipe(writer2);
<add>reader.push(buffer); | 2 |
PHP | PHP | add datetime to inputregistry | e0079c1d2b8c31e087c1a69b7235c49c4e76e769 | <ide><path>src/View/Input/InputRegistry.php
<ide> class InputRegistry {
<ide> 'radio' => ['Cake\View\Input\Radio', 'label'],
<ide> 'select' => ['Cake\View\Input\SelectBox'],
<ide> 'textarea' => ['Cake\View\Input\Textarea'],
<add> 'datetime' => ['Cake\View\Input\DateTime', 'select'],
<ide> '_default' => ['Cake\View\Input\Basic'],
<ide> ];
<ide> | 1 |
Javascript | Javascript | add more eventemitter benchmarks | 847b9d212a404e5906ea9f366c458332c0318c53 | <ide><path>benchmark/events/ee-emit-multi-args.js
<add>var common = require('../common.js');
<add>var EventEmitter = require('events').EventEmitter;
<add>
<add>var bench = common.createBenchmark(main, {n: [25e4]});
<add>
<add>function main(conf) {
<add> var n = conf.n | 0;
<add>
<add> var ee = new EventEmitter();
<add> var listeners = [];
<add>
<add> for (var k = 0; k < 10; k += 1)
<add> ee.on('dummy', function() {});
<add>
<add> bench.start();
<add> for (var i = 0; i < n; i += 1) {
<add> ee.emit('dummy', 5, true);
<add> }
<add> bench.end(n);
<add>}
<ide><path>benchmark/events/ee-emit.js
<add>var common = require('../common.js');
<add>var EventEmitter = require('events').EventEmitter;
<add>
<add>var bench = common.createBenchmark(main, {n: [25e4]});
<add>
<add>function main(conf) {
<add> var n = conf.n | 0;
<add>
<add> var ee = new EventEmitter();
<add>
<add> for (var k = 0; k < 10; k += 1)
<add> ee.on('dummy', function() {});
<add>
<add> bench.start();
<add> for (var i = 0; i < n; i += 1) {
<add> ee.emit('dummy');
<add> }
<add> bench.end(n);
<add>}
<ide><path>benchmark/events/ee-listener-count.js
<add>var common = require('../common.js');
<add>var EventEmitter = require('events').EventEmitter;
<add>
<add>var bench = common.createBenchmark(main, {n: [25e4]});
<add>
<add>function main(conf) {
<add> var n = conf.n | 0;
<add>
<add> var ee = new EventEmitter();
<add> var listenerCount = EventEmitter.listenerCount;
<add>
<add> for (var k = 0; k < 10; k += 1)
<add> ee.on('dummy', function() {});
<add>
<add> bench.start();
<add> for (var i = 0; i < n; i += 1) {
<add> var r = listenerCount(ee, 'dummy');
<add> }
<add> bench.end(n);
<add>}
<ide><path>benchmark/events/ee-listeners-many.js
<add>var common = require('../common.js');
<add>var EventEmitter = require('events').EventEmitter;
<add>
<add>var bench = common.createBenchmark(main, {n: [25e4]});
<add>
<add>function main(conf) {
<add> var n = conf.n | 0;
<add>
<add> var ee = new EventEmitter();
<add> ee.setMaxListeners(101);
<add>
<add> for (var k = 0; k < 100; k += 1)
<add> ee.on('dummy', function() {});
<add>
<add> bench.start();
<add> for (var i = 0; i < n; i += 1) {
<add> var r = ee.listeners('dummy');
<add> }
<add> bench.end(n);
<add>}
<ide><path>benchmark/events/ee-listeners.js
<add>var common = require('../common.js');
<add>var EventEmitter = require('events').EventEmitter;
<add>
<add>var bench = common.createBenchmark(main, {n: [25e4]});
<add>
<add>function main(conf) {
<add> var n = conf.n | 0;
<add>
<add> var ee = new EventEmitter();
<add>
<add> for (var k = 0; k < 10; k += 1)
<add> ee.on('dummy', function() {});
<add>
<add> bench.start();
<add> for (var i = 0; i < n; i += 1) {
<add> var r = ee.listeners('dummy');
<add> }
<add> bench.end(n);
<add>} | 5 |
Javascript | Javascript | update nextchallenge logic to ignore beta | efc76f7f7193c192d95699843ef9c553c9660739 | <ide><path>common/app/routes/challenges/utils.js
<ide> export function getNextChallenge(
<ide> // skip is used to skip isComingSoon challenges
<ide> block.challenges[ index + 1 + skip ]
<ide> ];
<del> if (!isDev && nextChallenge && nextChallenge.isComingSoon) {
<add> if (
<add> !isDev &&
<add> nextChallenge &&
<add> (nextChallenge.isComingSoon || nextChallenge.isBeta)
<add> ) {
<ide> // if we find a next challenge and it is a coming soon
<ide> // recur with plus one to skip this challenge
<ide> return getNextChallenge(current, entities, { isDev, skip: skip + 1 });
<ide><path>common/app/routes/challenges/utils.test.js
<ide> import {
<ide>
<ide> test('common/app/routes/challenges/utils', function(t) {
<ide> t.test('getNextChallenge', t => {
<del> t.plan(5);
<add> t.plan(7);
<ide> t.test('should return falsey when current challenge is not found', t => {
<ide> t.plan(1);
<ide> const entities = {
<ide> test('common/app/routes/challenges/utils', function(t) {
<ide> comingSoon
<ide> );
<ide> });
<add> t.test('should skip isBeta challenge', t => {
<add> t.plan(1);
<add> const currentChallenge = {
<add> dashedName: 'current-challenge',
<add> block: 'current-block'
<add> };
<add> const beta = {
<add> dashedName: 'beta-challenge',
<add> isBeta: true,
<add> block: 'current-block'
<add> };
<add> const nextChallenge = {
<add> dashedName: 'next-challenge',
<add> block: 'current-block'
<add> };
<add> const shouldBeNext = getNextChallenge(
<add> 'current-challenge',
<add> {
<add> challenge: {
<add> 'current-challenge': currentChallenge,
<add> 'next-challenge': nextChallenge,
<add> 'beta-challenge': beta,
<add> 'beta-challenge2': beta
<add> },
<add> block: {
<add> 'current-block': {
<add> challenges: [
<add> 'current-challenge',
<add> 'beta-challenge',
<add> 'beta-challenge2',
<add> 'next-challenge'
<add> ]
<add> }
<add> }
<add> }
<add> );
<add> t.isEqual(shouldBeNext, nextChallenge);
<add> });
<add> t.test('should not skip isBeta challenge if in dev', t => {
<add> t.plan(1);
<add> const currentChallenge = {
<add> dashedName: 'current-challenge',
<add> block: 'current-block'
<add> };
<add> const beta = {
<add> dashedName: 'beta-challenge',
<add> isBeta: true,
<add> block: 'current-block'
<add> };
<add> const nextChallenge = {
<add> dashedName: 'next-challenge',
<add> block: 'current-block'
<add> };
<add> const entities = {
<add> challenge: {
<add> 'current-challenge': currentChallenge,
<add> 'next-challenge': nextChallenge,
<add> 'beta-challenge': beta
<add> },
<add> block: {
<add> 'current-block': {
<add> challenges: [
<add> 'current-challenge',
<add> 'beta-challenge',
<add> 'next-challenge'
<add> ]
<add> }
<add> }
<add> };
<add> t.isEqual(
<add> getNextChallenge('current-challenge', entities, { isDev: true }),
<add> beta
<add> );
<add> });
<ide> });
<ide>
<ide> t.test('getFirstChallengeOfNextBlock', t => { | 2 |
Text | Text | add oyyd to collaborators | 616125c8b1e901b857aa19ec9ddca06b2f72910a | <ide><path>README.md
<ide> For information about the governance of the Node.js project, see
<ide> **Alexis Campailla** <orangemocha@nodejs.org>
<ide> * [othiym23](https://github.com/othiym23) -
<ide> **Forrest L Norvell** <ogd@aoaioxxysz.net> (he/him)
<add>* [oyyd](https://github.com/oyyd) -
<add>**Ouyang Yadong** <oyydoibh@gmail.com> (he/him)
<ide> * [pmq20](https://github.com/pmq20) -
<ide> **Minqi Pan** <pmq2001@gmail.com>
<ide> * [princejwesley](https://github.com/princejwesley) - | 1 |
Python | Python | set version to 2.3.1 | 86d13a9fb84cee2df56a998446d340207dfdbd5f | <ide><path>spacy/about.py
<ide> # fmt: off
<ide> __title__ = "spacy"
<del>__version__ = "2.3.0"
<add>__version__ = "2.3.1"
<ide> __release__ = True
<ide> __download_url__ = "https://github.com/explosion/spacy-models/releases/download"
<ide> __compatibility__ = "https://raw.githubusercontent.com/explosion/spacy-models/master/compatibility.json" | 1 |
Python | Python | fix triggerdagrunoperator extra link | 820e836c4a2e45239279d4d71e1db9434022fec5 | <ide><path>airflow/operators/trigger_dagrun.py
<ide> from airflow.api.common.experimental.trigger_dag import trigger_dag
<ide> from airflow.exceptions import AirflowException, DagNotFound, DagRunAlreadyExists
<ide> from airflow.models import BaseOperator, BaseOperatorLink, DagBag, DagModel, DagRun
<add>from airflow.models.xcom import XCom
<ide> from airflow.utils import timezone
<ide> from airflow.utils.helpers import build_airflow_url_with_query
<ide> from airflow.utils.state import State
<ide> from airflow.utils.types import DagRunType
<ide>
<add>XCOM_EXECUTION_DATE_ISO = "trigger_execution_date_iso"
<add>XCOM_RUN_ID = "trigger_run_id"
<add>
<ide>
<ide> class TriggerDagRunLink(BaseOperatorLink):
<ide> """
<ide> class TriggerDagRunLink(BaseOperatorLink):
<ide> name = 'Triggered DAG'
<ide>
<ide> def get_link(self, operator, dttm):
<del> query = {"dag_id": operator.trigger_dag_id, "execution_date": dttm.isoformat()}
<add> # Fetch the correct execution date for the triggerED dag which is
<add> # stored in xcom during execution of the triggerING task.
<add> trigger_execution_date_iso = XCom.get_one(
<add> execution_date=dttm, key=XCOM_EXECUTION_DATE_ISO, task_id=operator.task_id, dag_id=operator.dag_id
<add> )
<add>
<add> query = {"dag_id": operator.trigger_dag_id, "base_date": trigger_execution_date_iso}
<ide> return build_airflow_url_with_query(query)
<ide>
<ide>
<ide> def execute(self, context: Dict):
<ide> execution_date=self.execution_date,
<ide> replace_microseconds=False,
<ide> )
<add>
<ide> except DagRunAlreadyExists as e:
<ide> if self.reset_dag_run:
<ide> self.log.info("Clearing %s on %s", self.trigger_dag_id, self.execution_date)
<ide> def execute(self, context: Dict):
<ide> else:
<ide> raise e
<ide>
<add> # Store the execution date from the dag run (either created or found above) to
<add> # be used when creating the extra link on the webserver.
<add> ti = context['task_instance']
<add> ti.xcom_push(key=XCOM_EXECUTION_DATE_ISO, value=dag_run.execution_date.isoformat())
<add> ti.xcom_push(key=XCOM_RUN_ID, value=dag_run.run_id)
<add>
<ide> if self.wait_for_completion:
<ide> # wait for dag to complete
<ide> while True:
<ide><path>tests/operators/test_trigger_dagrun.py
<ide> import pathlib
<ide> import tempfile
<ide> from datetime import datetime
<del>from unittest import TestCase
<add>from unittest import TestCase, mock
<ide>
<ide> import pytest
<ide>
<ide> def tearDown(self):
<ide>
<ide> pathlib.Path(self._tmpfile).unlink()
<ide>
<add> @mock.patch('airflow.operators.trigger_dagrun.build_airflow_url_with_query')
<add> def assert_extra_link(self, triggering_exec_date, triggered_dag_run, triggering_task, mock_build_url):
<add> """
<add> Asserts whether the correct extra links url will be created.
<add>
<add> Specifically it tests whether the correct dag id and date are passed to
<add> the method which constructs the final url.
<add> Note: We can't run that method to generate the url itself because the Flask app context
<add> isn't available within the test logic, so it is mocked here.
<add> """
<add> triggering_task.get_extra_links(triggering_exec_date, 'Triggered DAG')
<add> assert mock_build_url.called
<add> args, _ = mock_build_url.call_args
<add> expected_args = {
<add> 'dag_id': triggered_dag_run.dag_id,
<add> 'base_date': triggered_dag_run.execution_date.isoformat(),
<add> }
<add> assert expected_args in args
<add>
<ide> def test_trigger_dagrun(self):
<ide> """Test TriggerDagRunOperator."""
<ide> task = TriggerDagRunOperator(task_id="test_task", trigger_dag_id=TRIGGERED_DAG_ID, dag=self.dag)
<ide> def test_trigger_dagrun(self):
<ide> with create_session() as session:
<ide> dagruns = session.query(DagRun).filter(DagRun.dag_id == TRIGGERED_DAG_ID).all()
<ide> assert len(dagruns) == 1
<del> assert dagruns[0].external_trigger
<add> triggered_dag_run = dagruns[0]
<add> assert triggered_dag_run.external_trigger
<add> self.assert_extra_link(DEFAULT_DATE, triggered_dag_run, task)
<ide>
<ide> def test_trigger_dagrun_custom_run_id(self):
<ide> task = TriggerDagRunOperator(
<ide> def test_trigger_dagrun_with_execution_date(self):
<ide> with create_session() as session:
<ide> dagruns = session.query(DagRun).filter(DagRun.dag_id == TRIGGERED_DAG_ID).all()
<ide> assert len(dagruns) == 1
<del> assert dagruns[0].external_trigger
<del> assert dagruns[0].execution_date == utc_now
<add> triggered_dag_run = dagruns[0]
<add> assert triggered_dag_run.external_trigger
<add> assert triggered_dag_run.execution_date == utc_now
<add> self.assert_extra_link(DEFAULT_DATE, triggered_dag_run, task)
<ide>
<ide> def test_trigger_dagrun_twice(self):
<ide> """Test TriggerDagRunOperator with custom execution_date."""
<ide> def test_trigger_dagrun_twice(self):
<ide> )
<ide> session.add(dag_run)
<ide> session.commit()
<del> task.execute(None)
<add> task.run(start_date=DEFAULT_DATE, end_date=DEFAULT_DATE, ignore_ti_state=True)
<ide>
<ide> dagruns = session.query(DagRun).filter(DagRun.dag_id == TRIGGERED_DAG_ID).all()
<ide> assert len(dagruns) == 1
<del> assert dagruns[0].external_trigger
<del> assert dagruns[0].execution_date == utc_now
<add> triggered_dag_run = dagruns[0]
<add> assert triggered_dag_run.external_trigger
<add> assert triggered_dag_run.execution_date == utc_now
<add> self.assert_extra_link(DEFAULT_DATE, triggered_dag_run, task)
<ide>
<ide> def test_trigger_dagrun_with_templated_execution_date(self):
<ide> """Test TriggerDagRunOperator with templated execution_date."""
<ide> def test_trigger_dagrun_with_templated_execution_date(self):
<ide> with create_session() as session:
<ide> dagruns = session.query(DagRun).filter(DagRun.dag_id == TRIGGERED_DAG_ID).all()
<ide> assert len(dagruns) == 1
<del> assert dagruns[0].external_trigger
<del> assert dagruns[0].execution_date == DEFAULT_DATE
<add> triggered_dag_run = dagruns[0]
<add> assert triggered_dag_run.external_trigger
<add> assert triggered_dag_run.execution_date == DEFAULT_DATE
<add> self.assert_extra_link(DEFAULT_DATE, triggered_dag_run, task)
<ide>
<ide> def test_trigger_dagrun_operator_conf(self):
<ide> """Test passing conf to the triggered DagRun."""
<ide> def test_trigger_dagrun_triggering_itself(self):
<ide> .all()
<ide> )
<ide> assert len(dagruns) == 2
<del> assert dagruns[1].state == State.QUEUED
<add> triggered_dag_run = dagruns[1]
<add> assert triggered_dag_run.state == State.QUEUED
<add> self.assert_extra_link(execution_date, triggered_dag_run, task)
<ide>
<ide> def test_trigger_dagrun_triggering_itself_with_execution_date(self):
<ide> """Test TriggerDagRunOperator that triggers itself with execution date, | 2 |
Java | Java | reuse resolvabletype in getdependencytype | b69ab8d568d363d1e5e6be4330fa6d1242e27a9a | <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/config/DependencyDescriptor.java
<ide> import java.io.Serializable;
<ide> import java.lang.annotation.Annotation;
<ide> import java.lang.reflect.Field;
<del>import java.lang.reflect.ParameterizedType;
<del>import java.lang.reflect.Type;
<ide> import java.util.Map;
<ide> import java.util.Optional;
<ide>
<ide> public String getDependencyName() {
<ide> public Class<?> getDependencyType() {
<ide> if (this.field != null) {
<ide> if (this.nestingLevel > 1) {
<del> Type type = this.field.getGenericType();
<del> for (int i = 2; i <= this.nestingLevel; i++) {
<del> if (type instanceof ParameterizedType) {
<del> Type[] args = ((ParameterizedType) type).getActualTypeArguments();
<del> type = args[args.length - 1];
<del> }
<del> }
<del> if (type instanceof Class) {
<del> return (Class<?>) type;
<del> }
<del> else if (type instanceof ParameterizedType) {
<del> Type arg = ((ParameterizedType) type).getRawType();
<del> if (arg instanceof Class) {
<del> return (Class<?>) arg;
<del> }
<del> }
<del> return Object.class;
<add> Class<?> clazz = getResolvableType().getRawClass();
<add> return clazz != null ? clazz : Object.class;
<ide> }
<ide> else {
<ide> return this.field.getType(); | 1 |
Python | Python | add lemmatizer fixture | 09acfbca012c6a1b98fbb4167420ed0b5797f9be | <ide><path>spacy/tests/conftest.py
<ide> from ..hu import Hungarian
<ide> from ..tokens import Doc
<ide> from ..strings import StringStore
<add>from ..lemmatizer import Lemmatizer
<ide> from ..attrs import ORTH, TAG, HEAD, DEP
<ide> from ..util import match_best_version, get_data_path
<ide>
<ide> def en_entityrecognizer():
<ide> return English.Defaults.create_entity()
<ide>
<ide>
<add>@pytest.fixture
<add>def lemmatizer(path):
<add> if path is not None:
<add> return Lemmatizer.load(path)
<add> else:
<add> return None
<add>
<add>
<ide> @pytest.fixture
<ide> def text_file():
<ide> return StringIO() | 1 |
PHP | PHP | add collection tests. | 5a52bebd203bb887e339e588aa75d938ae2d2ed7 | <ide><path>tests/Support/SupportCollectionTest.php
<ide> public function testCombineWithCollection()
<ide>
<ide> $this->assertSame($expected, $actual);
<ide> }
<add>
<add> public function testReduce()
<add> {
<add> $data = new Collection([1, 2, 3]);
<add> $this->assertEquals(6, $data->reduce(function ($carry, $element) { return $carry += $element; }));
<add> }
<add>
<add> /**
<add> * @expectedException InvalidArgumentException
<add> */
<add> public function testRandomThrowsAnExceptionUsingAmountBiggerThanCollectionSize()
<add> {
<add> $data = new Collection([1, 2, 3]);
<add> $data->random(4);
<add> }
<ide> }
<ide>
<ide> class TestAccessorEloquentTestStub | 1 |
Java | Java | add responseentity test | 475b876f08349b70e066719e5ae7437db96ad255 | <ide><path>spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ResponseEntityResultHandlerTests.java
<ide> public void handleMonoWithWildcardBodyType() throws Exception {
<ide> assertResponseBody("\"body\"");
<ide> }
<ide>
<add> @Test // SPR-14877
<add> public void handleMonoWithWildcardBodyTypeAndNullBody() throws Exception {
<add>
<add> this.exchange.getAttributes().put(HandlerMapping.PRODUCIBLE_MEDIA_TYPES_ATTRIBUTE,
<add> Collections.singleton(MediaType.APPLICATION_JSON));
<add>
<add> HandlerResult result = new HandlerResult(new TestController(), Mono.just(notFound().build()),
<add> ResolvableMethod.onClass(TestController.class)
<add> .name("monoResponseEntityWildcard")
<add> .resolveReturnType());
<add>
<add> this.resultHandler.handleResult(this.exchange, result).block(Duration.ofSeconds(5));
<add>
<add> assertEquals(HttpStatus.NOT_FOUND, this.response.getStatusCode());
<add> assertNull(this.response.getBody());
<add> }
<add>
<ide>
<ide> private void testHandle(Object returnValue, ResolvableType type) {
<ide> HandlerResult result = handlerResult(returnValue, type); | 1 |
PHP | PHP | improve sql server last insert id retrieval | 200fcdbf0f28aff145a2ed2a943d704c36fd3c63 | <ide><path>src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php
<ide> public function compileExists(Builder $query)
<ide> return $this->compileSelect($existsQuery->selectRaw('1 [exists]')->limit(1));
<ide> }
<ide>
<add> /**
<add> * Compile an insert and get ID statement into SQL.
<add> *
<add> * @param \Illuminate\Database\Query\Builder $query
<add> * @param array $values
<add> * @param string $sequence
<add> * @return string
<add> */
<add> public function compileInsertGetId(Builder $query, $values, $sequence)
<add> {
<add> $sql = $this->compileInsert($query, $values);
<add>
<add> return 'set nocount on;'.$sql.';select scope_identity() as '.$this->wrap($sequence ?: 'id');
<add> }
<add>
<ide> /**
<ide> * Compile an update statement with joins into SQL.
<ide> *
<ide><path>src/Illuminate/Database/Query/Processors/SqlServerProcessor.php
<ide>
<ide> namespace Illuminate\Database\Query\Processors;
<ide>
<del>use Exception;
<del>use Illuminate\Database\Connection;
<ide> use Illuminate\Database\Query\Builder;
<ide>
<ide> class SqlServerProcessor extends Processor
<ide> public function processInsertGetId(Builder $query, $sql, $values, $sequence = nu
<ide> {
<ide> $connection = $query->getConnection();
<ide>
<del> $connection->insert($sql, $values);
<add> $connection->recordsHaveBeenModified();
<ide>
<del> if ($connection->getConfig('odbc') === true) {
<del> $id = $this->processInsertGetIdForOdbc($connection);
<del> } else {
<del> $id = $connection->getPdo()->lastInsertId();
<del> }
<add> $result = $connection->selectFromWriteConnection($sql, $values)[0];
<ide>
<del> return is_numeric($id) ? (int) $id : $id;
<del> }
<add> $sequence = $sequence ?: 'id';
<ide>
<del> /**
<del> * Process an "insert get ID" query for ODBC.
<del> *
<del> * @param \Illuminate\Database\Connection $connection
<del> * @return int
<del> *
<del> * @throws \Exception
<del> */
<del> protected function processInsertGetIdForOdbc(Connection $connection)
<del> {
<del> $result = $connection->selectFromWriteConnection(
<del> 'SELECT CAST(COALESCE(SCOPE_IDENTITY(), @@IDENTITY) AS int) AS insertid'
<del> );
<del>
<del> if (! $result) {
<del> throw new Exception('Unable to retrieve lastInsertID for ODBC.');
<del> }
<add> $id = is_object($result) ? $result->{$sequence} : $result[$sequence];
<ide>
<del> $row = $result[0];
<del>
<del> return is_object($row) ? $row->insertid : $row['insertid'];
<add> return is_numeric($id) ? (int) $id : $id;
<ide> }
<ide>
<ide> /**
<ide><path>tests/Database/DatabaseQueryBuilderTest.php
<ide> public function testInsertGetIdWithEmptyValues()
<ide> $builder->from('users')->insertGetId([]);
<ide>
<ide> $builder = $this->getSqlServerBuilder();
<del> $builder->getProcessor()->shouldReceive('processInsertGetId')->once()->with($builder, 'insert into [users] default values', [], null);
<add> $builder->getProcessor()->shouldReceive('processInsertGetId')->once()->with($builder, 'set nocount on;insert into [users] default values;select scope_identity() as [id]', [], null);
<ide> $builder->from('users')->insertGetId([]);
<ide> }
<ide>
<ide> public function testPostgresInsertGetId()
<ide> $this->assertEquals(1, $result);
<ide> }
<ide>
<add> public function testSqlServerInsertGetId()
<add> {
<add> $builder = $this->getSqlServerBuilder();
<add> $builder->getProcessor()->shouldReceive('processInsertGetId')->once()->with($builder, 'set nocount on;insert into [users] ([email]) values (?);select scope_identity() as [id]', ['foo'], 'id')->andReturn(1);
<add> $result = $builder->from('users')->insertGetId(['email' => 'foo'], 'id');
<add> $this->assertEquals(1, $result);
<add> }
<add>
<ide> public function testMySqlWrapping()
<ide> {
<ide> $builder = $this->getMySqlBuilder(); | 3 |
Ruby | Ruby | improve eof handling | e30f2af9870905181f12dbd45a973145dcadc1ee | <ide><path>Library/Homebrew/system_command.rb
<ide> def write_input_to(raw_stdin)
<ide>
<ide> sig { params(sources: T::Array[IO], _block: T.proc.params(type: Symbol, line: String).void).void }
<ide> def each_line_from(sources, &_block)
<del> loop do
<del> readable_sources, = IO.select(sources)
<del>
<del> readable_sources = T.must(readable_sources).reject(&:eof?)
<add> sources_remaining = sources.dup
<add> while sources_remaining.present?
<add> readable_sources, = IO.select(sources_remaining)
<add> readable_sources = T.must(readable_sources)
<ide>
<ide> break if readable_sources.empty?
<ide>
<ide> readable_sources.each do |source|
<ide> line = source.readline_nonblock || ""
<ide> type = (source == sources[0]) ? :stdout : :stderr
<ide> yield(type, line)
<del> rescue IO::WaitReadable, EOFError
<add> rescue EOFError
<add> source.close_read
<add> sources_remaining.delete(source)
<add> rescue IO::WaitReadable
<ide> next
<ide> end
<ide> end
<ide>
<del> sources.each(&:close_read)
<add> sources_remaining.each(&:close_read)
<ide> end
<ide>
<ide> # Result containing the output and exit status of a finished sub-process. | 1 |
PHP | PHP | fix form control docs url | 2c9d04d74e037041337d92d8a4d0620a397f4d1d | <ide><path>src/View/Helper/FormHelper.php
<ide> public function fieldset(string $fields = '', array $options = []): string
<ide> * @param string $fieldName This should be "modelname.fieldname"
<ide> * @param array<string, mixed> $options Each type of input takes different options.
<ide> * @return string Completed form widget.
<del> * @link https://book.cakephp.org/4/en/views/helpers/form.html#creating-form-inputs
<add> * @link https://book.cakephp.org/4/en/views/helpers/form.html#creating-form-controls
<ide> * @psalm-suppress InvalidReturnType
<ide> * @psalm-suppress InvalidReturnStatement
<ide> */ | 1 |
Python | Python | add hook_params in basesqloperator | ccb9d04c22dfbe1efa8d0b690ddd929894acff9a | <ide><path>airflow/models/connection.py
<ide> def rotate_fernet_key(self):
<ide> if self._extra and self.is_extra_encrypted:
<ide> self._extra = fernet.rotate(self._extra.encode('utf-8')).decode()
<ide>
<del> def get_hook(self):
<del> """Return hook based on conn_type."""
<add> def get_hook(self, *, hook_kwargs=None):
<add> """Return hook based on conn_type"""
<ide> (
<ide> hook_class_name,
<ide> conn_id_param,
<ide> def get_hook(self):
<ide> "Could not import %s when discovering %s %s", hook_class_name, hook_name, package_name
<ide> )
<ide> raise
<del> return hook_class(**{conn_id_param: self.conn_id})
<add> if hook_kwargs is None:
<add> hook_kwargs = {}
<add> return hook_class(**{conn_id_param: self.conn_id}, **hook_kwargs)
<ide>
<ide> def __repr__(self):
<ide> return self.conn_id
<ide><path>airflow/operators/sql.py
<ide> class BaseSQLOperator(BaseOperator):
<ide> You can custom the behavior by overriding the .get_db_hook() method.
<ide> """
<ide>
<del> def __init__(self, *, conn_id: Optional[str] = None, database: Optional[str] = None, **kwargs):
<add> def __init__(
<add> self,
<add> *,
<add> conn_id: Optional[str] = None,
<add> database: Optional[str] = None,
<add> hook_params: Optional[Dict] = None,
<add> **kwargs,
<add> ):
<ide> super().__init__(**kwargs)
<ide> self.conn_id = conn_id
<ide> self.database = database
<add> self.hook_params = {} if hook_params is None else hook_params
<ide>
<ide> @cached_property
<ide> def _hook(self):
<ide> """Get DB Hook based on connection type"""
<ide> self.log.debug("Get connection for %s", self.conn_id)
<ide> conn = BaseHook.get_connection(self.conn_id)
<ide>
<del> hook = conn.get_hook()
<add> hook = conn.get_hook(hook_kwargs=self.hook_params)
<ide> if not isinstance(hook, DbApiHook):
<ide> raise AirflowException(
<ide> f'The connection type is not supported by {self.__class__.__name__}. '
<ide><path>tests/operators/test_sql.py
<ide> def test_not_allowed_conn_type(self, mock_get_conn):
<ide> with pytest.raises(AirflowException, match=r"The connection type is not supported"):
<ide> self._operator._hook
<ide>
<add> def test_sql_operator_hook_params_snowflake(self, mock_get_conn):
<add> mock_get_conn.return_value = Connection(conn_id='snowflake_default', conn_type='snowflake')
<add> self._operator.hook_params = {
<add> 'warehouse': 'warehouse',
<add> 'database': 'database',
<add> 'role': 'role',
<add> 'schema': 'schema',
<add> }
<add> assert self._operator._hook.conn_type == 'snowflake'
<add> assert self._operator._hook.warehouse == 'warehouse'
<add> assert self._operator._hook.database == 'database'
<add> assert self._operator._hook.role == 'role'
<add> assert self._operator._hook.schema == 'schema'
<add>
<add> def test_sql_operator_hook_params_biguery(self, mock_get_conn):
<add> mock_get_conn.return_value = Connection(
<add> conn_id='google_cloud_bigquery_default', conn_type='gcpbigquery'
<add> )
<add> self._operator.hook_params = {'use_legacy_sql': True, 'location': 'us-east1'}
<add> assert self._operator._hook.conn_type == 'gcpbigquery'
<add> assert self._operator._hook.use_legacy_sql
<add> assert self._operator._hook.location == 'us-east1'
<add>
<ide>
<ide> class TestCheckOperator(unittest.TestCase):
<ide> def setUp(self): | 3 |
Mixed | Ruby | add support for `if_not_exists` to indexes | 7ba08037f8d807cce2a25b0445743d07adfbe44c | <ide><path>activerecord/CHANGELOG.md
<add>* Add support for `if_not_exists` option for adding index.
<add>
<add> The `add_index` method respects `if_not_exists` option. If it is set to true
<add> index won't be added.
<add>
<add> Usage:
<add>
<add> ```
<add> add_index :users, :account_id, if_not_exists: true
<add> ```
<add>
<add> The `if_not_exists` option passed to `create_table` also gets propogated to indexes
<add> created within that migration so that if table and its indexes exist then there is no
<add> attempt to create them again.
<add>
<add> *Prathamesh Sonpatki*
<add>
<ide> * Add `ActiveRecord::Base#previously_new_record?` to show if a record was new before the last save.
<ide>
<ide> *Tom Ward*
<ide><path>activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
<ide> def create_table(table_name, id: :primary_key, primary_key: nil, force: nil, **o
<ide>
<ide> unless supports_indexes_in_create?
<ide> td.indexes.each do |column_name, index_options|
<del> add_index(table_name, column_name, index_options)
<add> add_index(table_name, column_name, index_options.merge!(if_not_exists: td.if_not_exists))
<ide> end
<ide> end
<ide>
<ide> def rename_column(table_name, column_name, new_column_name)
<ide> #
<ide> # CREATE INDEX suppliers_name_index ON suppliers(name)
<ide> #
<add> # ====== Creating a index which already exists
<add> #
<add> # add_index(:suppliers, :name, if_not_exists: true)
<add> #
<add> # generates:
<add> #
<add> # CREATE INDEX IF NOT EXISTS suppliers_name_index ON suppliers(name)
<add> #
<add> # Note: Not supported by MySQL.
<add> #
<ide> # ====== Creating a unique index
<ide> #
<ide> # add_index(:accounts, [:branch_id, :party_id], unique: true)
<ide> def rename_column(table_name, column_name, new_column_name)
<ide> #
<ide> # For more information see the {"Transactional Migrations" section}[rdoc-ref:Migration].
<ide> def add_index(table_name, column_name, options = {})
<del> index_name, index_type, index_columns, index_options = add_index_options(table_name, column_name, **options)
<del> execute "CREATE #{index_type} INDEX #{quote_column_name(index_name)} ON #{quote_table_name(table_name)} (#{index_columns})#{index_options}"
<add> index_name, index_type, index_columns, index_if_not_exists_clause, index_options = add_index_options(table_name, column_name, **options)
<add> execute "CREATE #{index_type} #{index_if_not_exists_clause} #{quote_column_name(index_name)} ON #{quote_table_name(table_name)} (#{index_columns})#{index_options}"
<ide> end
<ide>
<ide> # Removes the given index from the table.
<ide> def update_table_definition(table_name, base) #:nodoc:
<ide> def add_index_options(table_name, column_name, comment: nil, **options) # :nodoc:
<ide> column_names = index_column_names(column_name)
<ide>
<del> options.assert_valid_keys(:unique, :order, :name, :where, :length, :internal, :using, :algorithm, :type, :opclass)
<add> options.assert_valid_keys(:unique, :order, :name, :where, :length, :internal, :using, :algorithm, :type, :opclass, :if_not_exists)
<ide>
<ide> index_type = options[:type].to_s if options.key?(:type)
<ide> index_type ||= options[:unique] ? "UNIQUE" : ""
<ide> def add_index_options(table_name, column_name, comment: nil, **options) # :nodoc
<ide> index_options = options[:where] ? " WHERE #{options[:where]}" : ""
<ide> end
<ide>
<add> if_not_exists_index_clause = options[:if_not_exists] ? "INDEX IF NOT EXISTS" : "INDEX"
<add>
<ide> validate_index_length!(table_name, index_name, options.fetch(:internal, false))
<ide>
<ide> index_columns = quoted_columns_for_index(column_names, **options).join(", ")
<ide>
<del> [index_name, index_type, index_columns, index_options, algorithm, using, comment]
<add> [index_name, index_type, index_columns, if_not_exists_index_clause, index_options, algorithm, using, comment]
<ide> end
<ide>
<ide> def options_include_default?(options)
<ide><path>activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
<ide> def rename_column(table_name, column_name, new_column_name) #:nodoc:
<ide> end
<ide>
<ide> def add_index(table_name, column_name, options = {}) #:nodoc:
<del> index_name, index_type, index_columns, _, index_algorithm, index_using, comment = add_index_options(table_name, column_name, **options)
<add> return if options[:if_not_exists] && index_exists?(table_name, column_name, options)
<add>
<add> index_name, index_type, index_columns, _, _, index_algorithm, index_using, comment = add_index_options(table_name, column_name, **options)
<ide> sql = +"CREATE #{index_type} INDEX #{quote_column_name(index_name)} #{index_using} ON #{quote_table_name(table_name)} (#{index_columns}) #{index_algorithm}"
<ide> execute add_sql_comment!(sql, comment)
<ide> end
<ide> def rename_column_for_alter(table_name, column_name, new_column_name)
<ide> end
<ide>
<ide> def add_index_for_alter(table_name, column_name, options = {})
<del> index_name, index_type, index_columns, _, index_algorithm, index_using = add_index_options(table_name, column_name, **options)
<add> index_name, index_type, index_columns, _, _, index_algorithm, index_using = add_index_options(table_name, column_name, **options)
<ide> index_algorithm[0, 0] = ", " if index_algorithm.present?
<ide> "ADD #{index_type} INDEX #{quote_column_name(index_name)} #{index_using} (#{index_columns})#{index_algorithm}"
<ide> end
<ide><path>activerecord/lib/active_record/connection_adapters/mysql/schema_creation.rb
<ide> def add_column_position!(sql, options)
<ide> end
<ide>
<ide> def index_in_create(table_name, column_name, options)
<del> index_name, index_type, index_columns, _, _, index_using, comment = @conn.add_index_options(table_name, column_name, **options)
<add> index_name, index_type, index_columns, _, _, _, index_using, comment = @conn.add_index_options(table_name, column_name, **options)
<ide> add_sql_comment!((+"#{index_type} INDEX #{quote_column_name(index_name)} #{index_using} (#{index_columns})"), comment)
<ide> end
<ide> end
<ide><path>activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
<ide> def rename_column(table_name, column_name, new_column_name) #:nodoc:
<ide> end
<ide>
<ide> def add_index(table_name, column_name, options = {}) #:nodoc:
<del> index_name, index_type, index_columns_and_opclasses, index_options, index_algorithm, index_using, comment = add_index_options(table_name, column_name, **options)
<del> execute("CREATE #{index_type} INDEX #{index_algorithm} #{quote_column_name(index_name)} ON #{quote_table_name(table_name)} #{index_using} (#{index_columns_and_opclasses})#{index_options}").tap do
<add> index_name, index_type, index_columns_and_opclasses, index_if_not_exists_clause, index_options, index_algorithm, index_using, comment = add_index_options(table_name, column_name, **options)
<add> execute("CREATE #{index_type} #{index_if_not_exists_clause} #{index_algorithm} #{quote_column_name(index_name)} ON #{quote_table_name(table_name)} #{index_using} (#{index_columns_and_opclasses})#{index_options}").tap do
<ide> execute "COMMENT ON INDEX #{quote_column_name(index_name)} IS #{quote(comment)}" if comment
<ide> end
<ide> end
<ide><path>activerecord/test/cases/adapters/mysql2/active_schema_test.rb
<ide> def test_add_index
<ide> expected = "CREATE INDEX `index_people_on_last_name` USING btree ON `people` (`last_name`(10)) ALGORITHM = COPY"
<ide> assert_equal expected, add_index(:people, :last_name, length: 10, using: :btree, algorithm: :copy)
<ide>
<add> with_real_execute do
<add> add_index(:people, :first_name)
<add> assert index_exists?(:people, :first_name)
<add>
<add> assert_nothing_raised do
<add> add_index(:people, :first_name, if_not_exists: true)
<add> end
<add> end
<add>
<ide> assert_raise ArgumentError do
<ide> add_index(:people, :last_name, algorithm: :coyp)
<ide> end
<ide><path>activerecord/test/cases/adapters/postgresql/active_schema_test.rb
<ide> def test_add_index
<ide> expected = %(CREATE INDEX "index_people_on_last_name" ON "people" ("last_name" NULLS FIRST))
<ide> assert_equal expected, add_index(:people, :last_name, order: "NULLS FIRST")
<ide>
<add> expected = %(CREATE INDEX IF NOT EXISTS "index_people_on_last_name" ON "people" ("last_name"))
<add> assert_equal expected, add_index(:people, :last_name, if_not_exists: true)
<add>
<ide> assert_raise ArgumentError do
<ide> add_index(:people, :last_name, algorithm: :copy)
<ide> end
<ide><path>activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb
<ide> def test_index
<ide> end
<ide> end
<ide>
<add> def test_index_with_if_not_exists
<add> with_example_table do
<add> @conn.add_index "ex", "id"
<add>
<add> assert_nothing_raised do
<add> @conn.add_index "ex", "id", if_not_exists: true
<add> end
<add> end
<add> end
<add>
<ide> def test_non_unique_index
<ide> with_example_table do
<ide> @conn.add_index "ex", "id", name: "fun"
<ide><path>activerecord/test/cases/migration/index_test.rb
<ide> def test_add_index_does_not_accept_too_long_index_names
<ide> connection.add_index(table_name, "foo", name: good_index_name)
<ide> end
<ide>
<add> def test_add_index_which_already_exists_does_not_raise_error
<add> connection.add_index(table_name, "foo", if_not_exists: true)
<add>
<add> assert_nothing_raised do
<add> connection.add_index(table_name, "foo", if_not_exists: true)
<add> end
<add> end
<add>
<ide> def test_internal_index_with_name_matching_database_limit
<ide> good_index_name = "x" * connection.index_name_length
<ide> connection.add_index(table_name, "foo", name: good_index_name, internal: true)
<ide><path>activerecord/test/cases/migration_test.rb
<ide> def test_create_table_with_if_not_exists_true
<ide> connection.drop_table :testings, if_exists: true
<ide> end
<ide>
<add> def test_create_table_with_indexes_and_if_not_exists_true
<add> connection = Person.connection
<add> connection.create_table :testings, force: true do |t|
<add> t.references :people
<add> t.string :foo
<add> end
<add>
<add> assert_nothing_raised do
<add> connection.create_table :testings, if_not_exists: true do |t|
<add> t.references :people
<add> t.string :foo
<add> end
<add> end
<add> ensure
<add> connection.drop_table :testings, if_exists: true
<add> end
<add>
<ide> def test_create_table_with_force_true_does_not_drop_nonexisting_table
<ide> # using a copy as we need the drop_table method to
<ide> # continue to work for the ensure block of the test | 10 |
Javascript | Javascript | support an unescaped url port | b94ca12fa0b027d8592f5717e038b7b116c59384 | <ide><path>src/ngResource/resource.js
<ide> *
<ide> * @param {string} url A parametrized URL template with parameters prefixed by `:` as in
<ide> * `/user/:username`. If you are using a URL with a port number (e.g.
<del> * `http://example.com:8080/api`), you'll need to escape the colon character before the port
<del> * number, like this: `$resource('http://example.com\\:8080/api')`.
<add> * `http://example.com:8080/api`), it will be respected.
<ide> *
<ide> * If you are using a url with a suffix, just add the suffix, like this:
<ide> * `$resource('http://example.com/resource.json')` or `$resource('http://example.com/:id.json')
<ide> angular.module('ngResource', ['ng']).
<ide>
<ide> var urlParams = self.urlParams = {};
<ide> forEach(url.split(/\W/), function(param){
<del> if (param && (new RegExp("(^|[^\\\\]):" + param + "(\\W|$)").test(url))) {
<add> if (!(new RegExp("^\\d+$").test(param)) && param && (new RegExp("(^|[^\\\\]):" + param + "(\\W|$)").test(url))) {
<ide> urlParams[param] = true;
<ide> }
<ide> });
<ide><path>test/ngResource/resourceSpec.js
<ide> describe("resource", function() {
<ide> R.get({a: 'foo', b: 'bar'});
<ide> });
<ide>
<add> it('should support an unescaped url', function() {
<add> var R = $resource('http://localhost:8080/Path/:a');
<add>
<add> $httpBackend.expect('GET', 'http://localhost:8080/Path/foo').respond();
<add> R.get({a: 'foo'});
<add> });
<add>
<ide>
<ide> it('should correctly encode url params', function() {
<ide> var R = $resource('/Path/:a'); | 2 |
Javascript | Javascript | replace newlines in deprecation with space | 63f110addb51807613f24d066c3acc51c10c7de9 | <ide><path>tools/doc/html.js
<ide> function parseLists(input) {
<ide> headingIndex = -1;
<ide> heading = null;
<ide> }
<del> tok.text = parseAPIHeader(tok.text);
<add> tok.text = parseAPIHeader(tok.text).replace(/\n/g, ' ');
<ide> output.push({ type: 'html', text: tok.text });
<ide> return;
<ide> } else if (state === 'MAYBE_STABILITY_BQ') { | 1 |
Ruby | Ruby | redirect bundler stdout to stderr" | c4d69dd2e903f7faa810da59cf4b307bd8cdd116 | <ide><path>Library/Homebrew/dev-cmd/vendor-gems.rb
<ide> def vendor_gems
<ide> end
<ide>
<ide> ohai "bundle install --standalone"
<del> safe_system_redirect_stdout_to_stderr "bundle", "install", "--standalone"
<add> safe_system "bundle", "install", "--standalone"
<ide>
<ide> ohai "bundle pristine"
<ide> safe_system "bundle", "pristine"
<ide><path>Library/Homebrew/utils.rb
<ide> def quiet_system(cmd, *args)
<ide> end
<ide> end
<ide>
<del> # Redirects stdout to stderr, throws exception on command failure.
<del> def safe_system_redirect_stdout_to_stderr(cmd, *args)
<del> return if Homebrew._system(cmd, *args) do
<del> # Redirect stdout stream to stderr stream. This is useful to prevent
<del> # subprocesses from writing to stdout and interfering with the intended
<del> # output, e.g. when running a brew command with `--json` for programs
<del> # automating brew commands.
<del> $stdout.reopen($stderr)
<del> end
<del>
<del> raise ErrorDuringExecution.new([cmd, *args], status: $CHILD_STATUS)
<del> end
<del>
<ide> def which(cmd, path = ENV["PATH"])
<ide> PATH.new(path).each do |p|
<ide> begin
<ide><path>Library/Homebrew/utils/gems.rb
<ide> def install_bundler_gems!(only_warn_on_failure: false, setup_path: true)
<ide>
<ide> # for some reason sometimes the exit code lies so check the output too.
<ide> if bundle_check_failed || bundle_check_output.include?("Install missing gems")
<del> begin
<del> safe_system_redirect_stdout_to_stderr bundle, "install"
<del> rescue ErrorDuringExecution
<add> unless system bundle, "install"
<ide> message = <<~EOS
<ide> failed to run `#{bundle} install`!
<ide> EOS | 3 |
Javascript | Javascript | add caveat about symbols to string error message | b9c96cfc73b6e0adcb7b747c40ac40c74995ea7f | <ide><path>eslint-rules/no-primitive-constructors.js
<ide> 'use strict';
<ide>
<ide> module.exports = function(context) {
<add> function report(node, name, msg) {
<add> context.report(node, `Do not use the ${name} constructor. ${msg}`);
<add> }
<add>
<ide> function check(node) {
<ide> const name = node.callee.name;
<del> let msg = null;
<ide> switch (name) {
<ide> case 'Boolean':
<del> msg = 'To cast a value to a boolean, use double negation: !!value';
<add> report(
<add> node,
<add> name,
<add> 'To cast a value to a boolean, use double negation: !!value'
<add> );
<ide> break;
<ide> case 'String':
<del> msg = 'To cast a value to a string, concat it with the empty string: \'\' + value';
<add> report(
<add> node,
<add> name,
<add> 'To cast a value to a string, concat it with the empty string ' +
<add> '(unless it\'s a symbol, which have different semantics): ' +
<add> '\'\' + value'
<add> );
<ide> break;
<ide> }
<del> if (msg) {
<del> context.report(node, `Do not use the ${name} constructor. ${msg}`);
<del> }
<ide> }
<ide>
<ide> return { | 1 |
PHP | PHP | bind request on constructor | f07272015670d3296bb8d1aa0571ce55d63a638f | <ide><path>src/Illuminate/Foundation/Application.php
<ide> class Application extends Container implements HttpKernelInterface, TerminableIn
<ide> /**
<ide> * Create a new Illuminate application instance.
<ide> *
<add> * @param \Illuminate\Http\Request $request
<ide> * @return void
<ide> */
<del> public function __construct()
<add> public function __construct(Request $request = null)
<ide> {
<del> $this['request'] = function()
<del> {
<del> throw new \Exception("Using request outside of scope. Try moving call to before handler or route.");
<del> };
<add> $this->instance('request', $request ?: Request::createFromGlobals());
<ide>
<ide> $this->registerBaseServiceProviders();
<ide> }
<ide> public function run(SymfonyRequest $request)
<ide> ->push('Illuminate\Cookie\Queue', $this['cookie'])
<ide> ->push('Illuminate\Session\Middleware', $this['session'])
<ide> ->resolve($this)
<del> ->handle($request);
<add> ->handle($this['request']);
<ide>
<ide> $this->callCloseCallbacks($request, $response);
<ide> | 1 |
Python | Python | remove six dependency | a0801719f8f24a0e3192eca203bbd341c4e557ec | <ide><path>flask/helpers.py
<ide>
<ide> from werkzeug.datastructures import Headers
<ide> from werkzeug.exceptions import NotFound
<del>import six
<ide> from flask._compat import string_types, text_type
<ide>
<ide> # this was moved in 0.7
<ide> def generator():
<ide> # pushed. This item is discarded. Then when the iteration continues the
<ide> # real generator is executed.
<ide> wrapped_g = generator()
<del> six.advance_iterator(wrapped_g)
<add> next(wrapped_g)
<ide> return wrapped_g
<ide>
<ide>
<ide><path>flask/json.py
<ide> import uuid
<ide> from datetime import datetime
<ide> from .globals import current_app, request
<add>from ._compat import text_type
<ide>
<ide> from werkzeug.http import http_date
<ide>
<ide> # Use the same json implementation as itsdangerous on which we
<ide> # depend anyways.
<ide> from itsdangerous import json as _json
<del>import six
<ide>
<ide>
<ide> # figure out if simplejson escapes slashes. This behavior was changed
<ide> def default(self, o):
<ide> if isinstance(o, uuid.UUID):
<ide> return str(o)
<ide> if hasattr(o, '__html__'):
<del> return six.text_type(o.__html__())
<add> return text_type(o.__html__())
<ide> return _json.JSONEncoder.default(self, o)
<ide>
<ide>
<ide><path>flask/templating.py
<ide> from .globals import _request_ctx_stack, _app_ctx_stack
<ide> from .signals import template_rendered
<ide> from .module import blueprint_is_module
<del>import six
<add>from ._compat import itervalues, iteritems
<ide>
<ide>
<ide> def _default_template_ctx_processor():
<ide> def _iter_loaders(self, template):
<ide> except (ValueError, KeyError):
<ide> pass
<ide>
<del> for blueprint in six.itervalues(self.app.blueprints):
<add> for blueprint in itervalues(self.app.blueprints):
<ide> if blueprint_is_module(blueprint):
<ide> continue
<ide> loader = blueprint.jinja_loader
<ide> def list_templates(self):
<ide> if loader is not None:
<ide> result.update(loader.list_templates())
<ide>
<del> for name, blueprint in six.iteritems(self.app.blueprints):
<add> for name, blueprint in iteritems(self.app.blueprints):
<ide> loader = blueprint.jinja_loader
<ide> if loader is not None:
<ide> for template in loader.list_templates():
<ide><path>flask/testsuite/basic.py
<ide> from datetime import datetime
<ide> from threading import Thread
<ide> from flask.testsuite import FlaskTestCase, emits_module_deprecation_warning
<add>from flask._compat import text_type
<ide> from werkzeug.exceptions import BadRequest, NotFound
<ide> from werkzeug.http import parse_date
<ide> from werkzeug.routing import BuildError
<del>import six
<ide>
<ide>
<ide> class BasicFunctionalityTestCase(FlaskTestCase):
<ide> def index():
<ide>
<ide> @app.route('/test')
<ide> def test():
<del> return six.text_type(flask.session.permanent)
<add> return text_type(flask.session.permanent)
<ide>
<ide> client = app.test_client()
<ide> rv = client.get('/')
<ide><path>flask/testsuite/blueprints.py
<ide> import unittest
<ide> import warnings
<ide> from flask.testsuite import FlaskTestCase, emits_module_deprecation_warning
<add>from flask._compat import text_type
<ide> from werkzeug.exceptions import NotFound
<ide> from werkzeug.http import parse_cache_control_header
<ide> from jinja2 import TemplateNotFound
<del>import six
<ide>
<ide>
<ide> # import moduleapp here because it uses deprecated features and we don't
<ide> def foo(bar, baz):
<ide>
<ide> @bp.route('/bar')
<ide> def bar(bar):
<del> return six.text_type(bar)
<add> return text_type(bar)
<ide>
<ide> app = flask.Flask(__name__)
<ide> app.register_blueprint(bp, url_prefix='/1', url_defaults={'bar': 23})
<ide><path>flask/testsuite/ext.py
<ide>
<ide> import sys
<ide> import unittest
<add>try:
<add> from imp import reload as reload_module
<add>except ImportError:
<add> reload_module = reload
<ide> from flask.testsuite import FlaskTestCase
<ide> from flask._compat import PY2
<del>from six.moves import reload_module
<ide>
<ide> class ExtImportHookTestCase(FlaskTestCase):
<ide>
<ide><path>flask/testsuite/helpers.py
<ide> from logging import StreamHandler
<ide> from flask.testsuite import FlaskTestCase, catch_warnings, catch_stderr
<ide> from werkzeug.http import parse_cache_control_header, parse_options_header
<del>import six
<del>from flask._compat import StringIO
<add>from flask._compat import StringIO, text_type
<ide>
<ide>
<ide> def has_encoding(name):
<ide> def test_json_bad_requests(self):
<ide> app = flask.Flask(__name__)
<ide> @app.route('/json', methods=['POST'])
<ide> def return_json():
<del> return six.text_type(flask.request.json)
<add> return text_type(flask.request.json)
<ide> c = app.test_client()
<ide> rv = c.post('/json', data='malformed', content_type='application/json')
<ide> self.assert_equal(rv.status_code, 400)
<ide> def test_json_bad_requests_content_type(self):
<ide> app = flask.Flask(__name__)
<ide> @app.route('/json', methods=['POST'])
<ide> def return_json():
<del> return six.text_type(flask.request.json)
<add> return text_type(flask.request.json)
<ide> c = app.test_client()
<ide> rv = c.post('/json', data='malformed', content_type='application/json')
<ide> self.assert_equal(rv.status_code, 400)
<ide> def test_json_attr(self):
<ide> app = flask.Flask(__name__)
<ide> @app.route('/add', methods=['POST'])
<ide> def add():
<del> return six.text_type(flask.request.json['a'] + flask.request.json['b'])
<add> return text_type(flask.request.json['a'] + flask.request.json['b'])
<ide> c = app.test_client()
<ide> rv = c.post('/add', data=flask.json.dumps({'a': 1, 'b': 2}),
<ide> content_type='application/json')
<ide> def __iter__(self):
<ide> def close(self):
<ide> called.append(42)
<ide> def next(self):
<del> return six.advance_iterator(self._gen)
<add> return next(self._gen)
<ide> @app.route('/')
<ide> def index():
<ide> def generate():
<ide><path>flask/testsuite/testing.py
<ide> import flask
<ide> import unittest
<ide> from flask.testsuite import FlaskTestCase
<del>import six
<add>from flask._compat import text_type
<ide>
<ide>
<ide> class TestToolsTestCase(FlaskTestCase):
<ide> def test_session_transactions(self):
<ide>
<ide> @app.route('/')
<ide> def index():
<del> return six.text_type(flask.session['foo'])
<add> return text_type(flask.session['foo'])
<ide>
<ide> with app.test_client() as c:
<ide> with c.session_transaction() as sess:
<ide><path>setup.py
<ide> def run(self):
<ide> zip_safe=False,
<ide> platforms='any',
<ide> install_requires=[
<del> 'six>=1.3.0',
<ide> 'Werkzeug>=0.7',
<ide> 'Jinja2>=2.4',
<ide> 'itsdangerous>=0.17' | 9 |
Javascript | Javascript | add failing test for gh-511 | e530507cb1f7b3cc41e86fd1141c760055f9f890 | <ide><path>test/pummel/test-next-tick-loops-quick.js
<add>var common = require('../common');
<add>var assert = require('assert');
<add>
<add>// Regression test GH-511: https://github.com/ry/node/issues/issue/511
<add>// Make sure nextTick loops quickly
<add>
<add>setTimeout(function () {
<add> t = Date.now() - t;
<add> STOP = 1;
<add> console.log(["ctr: ",ctr, ", t:", t, "ms -> ", (ctr/t).toFixed(2), "KHz"].join(''));
<add> assert.ok(ctr > 1000);
<add>}, 2000);
<add>
<add>var ctr = 0;
<add>var STOP = 0;
<add>var t = Date.now()+ 2;
<add>while (t > Date.now()) ; //get in sync with clock
<add>
<add>(function foo () {
<add> if (STOP) return;
<add> process.nextTick(foo);
<add> ctr++;
<add>})(); | 1 |
Mixed | Javascript | add getter and setter to mocktracker | afed1afa55962211b6b56c2068d520b4d8a08888 | <ide><path>doc/api/test.md
<ide> test('mocks a counting function', (t) => {
<ide> });
<ide> ```
<ide>
<add>### `mock.getter(object, methodName[, implementation][, options])`
<add>
<add><!-- YAML
<add>added: REPLACEME
<add>-->
<add>
<add>This function is syntax sugar for [`MockTracker.method`][] with `options.getter`
<add>set to `true`.
<add>
<ide> ### `mock.method(object, methodName[, implementation][, options])`
<ide>
<ide> <!-- YAML
<ide> This function restores the default behavior of all mocks that were previously
<ide> created by this `MockTracker`. Unlike `mock.reset()`, `mock.restoreAll()` does
<ide> not disassociate the mocks from the `MockTracker` instance.
<ide>
<add>### `mock.setter(object, methodName[, implementation][, options])`
<add>
<add><!-- YAML
<add>added: REPLACEME
<add>-->
<add>
<add>This function is syntax sugar for [`MockTracker.method`][] with `options.setter`
<add>set to `true`.
<add>
<ide> ## Class: `TapStream`
<ide>
<ide> <!-- YAML
<ide> added:
<ide> [`--test-only`]: cli.md#--test-only
<ide> [`--test`]: cli.md#--test
<ide> [`MockFunctionContext`]: #class-mockfunctioncontext
<add>[`MockTracker.method`]: #mockmethodobject-methodname-implementation-options
<ide> [`MockTracker`]: #class-mocktracker
<ide> [`SuiteContext`]: #class-suitecontext
<ide> [`TestContext`]: #class-testcontext
<ide><path>lib/internal/test_runner/mock.js
<ide> class MockTracker {
<ide> return mock;
<ide> }
<ide>
<add> getter(
<add> object,
<add> methodName,
<add> implementation = kDefaultFunction,
<add> options = kEmptyObject
<add> ) {
<add> if (implementation !== null && typeof implementation === 'object') {
<add> options = implementation;
<add> implementation = kDefaultFunction;
<add> } else {
<add> validateObject(options, 'options');
<add> }
<add>
<add> const { getter = true } = options;
<add>
<add> if (getter === false) {
<add> throw new ERR_INVALID_ARG_VALUE(
<add> 'options.getter', getter, 'cannot be false'
<add> );
<add> }
<add>
<add> return this.method(object, methodName, implementation, {
<add> ...options,
<add> getter,
<add> });
<add> }
<add>
<add> setter(
<add> object,
<add> methodName,
<add> implementation = kDefaultFunction,
<add> options = kEmptyObject
<add> ) {
<add> if (implementation !== null && typeof implementation === 'object') {
<add> options = implementation;
<add> implementation = kDefaultFunction;
<add> } else {
<add> validateObject(options, 'options');
<add> }
<add>
<add> const { setter = true } = options;
<add>
<add> if (setter === false) {
<add> throw new ERR_INVALID_ARG_VALUE(
<add> 'options.setter', setter, 'cannot be false'
<add> );
<add> }
<add>
<add> return this.method(object, methodName, implementation, {
<add> ...options,
<add> setter,
<add> });
<add> }
<add>
<ide> reset() {
<ide> this.restoreAll();
<ide> this.#mocks = [];
<ide><path>test/parallel/test-runner-mocking.js
<ide> test('mocks a setter', (t) => {
<ide> assert.strictEqual(obj.prop, 65);
<ide> });
<ide>
<add>test('mocks a getter with syntax sugar', (t) => {
<add> const obj = {
<add> prop: 5,
<add> get method() {
<add> return this.prop;
<add> },
<add> };
<add>
<add> function mockMethod() {
<add> return this.prop - 1;
<add> }
<add> const getter = t.mock.getter(obj, 'method', mockMethod);
<add> assert.strictEqual(getter.mock.calls.length, 0);
<add> assert.strictEqual(obj.method, 4);
<add>
<add> const call = getter.mock.calls[0];
<add>
<add> assert.deepStrictEqual(call.arguments, []);
<add> assert.strictEqual(call.result, 4);
<add> assert.strictEqual(call.target, undefined);
<add> assert.strictEqual(call.this, obj);
<add>
<add> assert.strictEqual(getter.mock.restore(), undefined);
<add> assert.strictEqual(obj.method, 5);
<add>});
<add>
<add>test('mocks a setter with syntax sugar', (t) => {
<add> const obj = {
<add> prop: 100,
<add> // eslint-disable-next-line accessor-pairs
<add> set method(val) {
<add> this.prop = val;
<add> },
<add> };
<add>
<add> function mockMethod(val) {
<add> this.prop = -val;
<add> }
<add>
<add> assert.strictEqual(obj.prop, 100);
<add> obj.method = 88;
<add> assert.strictEqual(obj.prop, 88);
<add>
<add> const setter = t.mock.setter(obj, 'method', mockMethod);
<add>
<add> assert.strictEqual(setter.mock.calls.length, 0);
<add> obj.method = 77;
<add> assert.strictEqual(obj.prop, -77);
<add> assert.strictEqual(setter.mock.calls.length, 1);
<add>
<add> const call = setter.mock.calls[0];
<add>
<add> assert.deepStrictEqual(call.arguments, [77]);
<add> assert.strictEqual(call.result, undefined);
<add> assert.strictEqual(call.target, undefined);
<add> assert.strictEqual(call.this, obj);
<add>
<add> assert.strictEqual(setter.mock.restore(), undefined);
<add> assert.strictEqual(obj.prop, -77);
<add> obj.method = 65;
<add> assert.strictEqual(obj.prop, 65);
<add>});
<add>
<ide> test('mocked functions match name and length', (t) => {
<ide> function getNameAndLength(fn) {
<ide> return {
<ide> test('spies on a class prototype method', (t) => {
<ide> assert.strictEqual(call.target, undefined);
<ide> assert.strictEqual(call.this, instance);
<ide> });
<add>
<add>test('getter() fails if getter options set to false', (t) => {
<add> assert.throws(() => {
<add> t.mock.getter({}, 'method', { getter: false });
<add> }, /The property 'options\.getter' cannot be false/);
<add>});
<add>
<add>test('setter() fails if setter options set to false', (t) => {
<add> assert.throws(() => {
<add> t.mock.setter({}, 'method', { setter: false });
<add> }, /The property 'options\.setter' cannot be false/);
<add>});
<add>
<add>test('getter() fails if setter options is true', (t) => {
<add> assert.throws(() => {
<add> t.mock.getter({}, 'method', { setter: true });
<add> }, /The property 'options\.setter' cannot be used with 'options\.getter'/);
<add>});
<add>
<add>test('setter() fails if getter options is true', (t) => {
<add> assert.throws(() => {
<add> t.mock.setter({}, 'method', { getter: true });
<add> }, /The property 'options\.setter' cannot be used with 'options\.getter'/);
<add>}); | 3 |
Javascript | Javascript | add missing return, fix | 5d35df8afa12488ef774b2a1236e8359cad3342a | <ide><path>Libraries/Interaction/InteractionManager.js
<ide> var InteractionManager = {
<ide> then: promise.then.bind(promise),
<ide> done: (...args) => {
<ide> if (promise.done) {
<del> promise.done(...args);
<add> return promise.done(...args);
<ide> } else {
<ide> console.warn('Tried to call done when not supported by current Promise implementation.');
<ide> } | 1 |
Python | Python | add numpy implementation of f90 spacing function | 0c539e1f2526d09ffefc56ccead470dbbd56cd24 | <ide><path>numpy/testing/tests/test_utils.py
<ide> def test_catch_no_raise(self):
<ide> else:
<ide> raise AssertionError("should have raised an AssertionError")
<ide>
<add>class TestSpacing(unittest.TestCase):
<add> def test_one(self):
<add> for dt, dec in zip([np.float32, np.float64], (10, 20)):
<add> x = np.array(1, dtype=dt)
<add> # In theory, eps and spacing(1) should be exactly equal
<add> assert_array_almost_equal(spacing(x), np.finfo(dt).eps, decimal=dec)
<add>
<add> def test_simple(self):
<add> # Reference from this fortran file, built with gfortran 4.3.3 on linux
<add> # 32bits:
<add> # PROGRAM test_spacing
<add> # INTEGER, PARAMETER :: SGL = SELECTED_REAL_KIND(p=6, r=37)
<add> # INTEGER, PARAMETER :: DBL = SELECTED_REAL_KIND(p=13, r=200)
<add> #
<add> # WRITE(*,*) spacing(0.00001_DBL)
<add> # WRITE(*,*) spacing(1.0_DBL)
<add> # WRITE(*,*) spacing(1000._DBL)
<add> # WRITE(*,*) spacing(10500._DBL)
<add> #
<add> # WRITE(*,*) spacing(0.00001_SGL)
<add> # WRITE(*,*) spacing(1.0_SGL)
<add> # WRITE(*,*) spacing(1000._SGL)
<add> # WRITE(*,*) spacing(10500._SGL)
<add> # END PROGRAM
<add> ref = {}
<add> ref[np.float64] = [1.69406589450860068E-021,
<add> 2.22044604925031308E-016,
<add> 1.13686837721616030E-013,
<add> 1.81898940354585648E-012]
<add> ref[np.float32] = [
<add> 9.09494702E-13,
<add> 1.19209290E-07,
<add> 6.10351563E-05,
<add> 9.76562500E-04]
<add>
<add> for dt, dec in zip([np.float32, np.float64], (10, 20)):
<add> x = np.array([1e-5, 1, 1000, 10500], dtype=dt)
<add> assert_array_almost_equal(spacing(x), ref[dt], decimal=dec)
<ide>
<ide> if __name__ == '__main__':
<ide> run_module_suite()
<ide><path>numpy/testing/utils.py
<ide> def integer_repr(x):
<ide> return _integer_repr(x, np.int64, np.int64(-2**63))
<ide> else:
<ide> raise ValueError("Unsupported dtype %s" % x.dtype)
<add>
<add>def spacing(x, dtype=None):
<add> """Return the spacing for each item in x.
<add>
<add> spacing(x) is defined as the space between x and the next representable
<add> floating point number > x. For example, spacing(1) == EPS
<add>
<add> This aims at being equivalent to the Fortran 95 spacing intrinsic.
<add> """
<add> import numpy as np
<add> if dtype:
<add> x = np.atleast_1d(np.array(x, dtype=dtype))
<add> else:
<add> x = np.atleast_1d(np.array(x))
<add>
<add> if np.iscomplexobj(x):
<add> raise NotImplementerError("_compute_spacing not implemented for complex array")
<add>
<add> t = x.dtype
<add> if not t in [np.float32, np.float64]:
<add> raise ValueError("Could not convert both arrays to supported type")
<add>
<add> res = integer_repr(x)
<add> return (res + 1).view(t) - res.view(t)
<add> # XXX: alternative implementation, the one used in gfortran: much simpler,
<add> # but I am not sure I understand it, and it does not work for Nan
<add> #p = np.finfo(t).nmant + 1
<add> #emin = np.finfo(t).minexp
<add> #
<add> #e = np.frexp(x)[1] - p
<add> #e[e<=emin] = emin
<add>
<add> #return np.ldexp(np.array(1., dtype=t), e) | 2 |
PHP | PHP | create dropallforeignkeys method for sql server | f8e0662e377544dd0ce78328033f1da995947efb | <ide><path>src/Illuminate/Database/Schema/Builder.php
<ide> public function disableForeignKeyConstraints()
<ide> );
<ide> }
<ide>
<add> /**
<add> * Drop all foreign keys from the database.
<add> *
<add> * @return void
<add> *
<add> * @throws \LogicException
<add> */
<add> public function dropAllForeignKeys()
<add> {
<add> throw new LogicException('This database driver does not support dropping all foreign keys.');
<add> }
<add>
<ide> /**
<ide> * Execute the blueprint to build / modify the table.
<ide> *
<ide><path>src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php
<ide> public function compileDisableForeignKeyConstraints()
<ide> return 'EXEC sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all";';
<ide> }
<ide>
<add> /**
<add> * Compile the command to drop all foreign keys
<add> *
<add> * @return string
<add> */
<add> public function dropAllForeignKeys()
<add> {
<add> return "DECLARE @sql NVARCHAR(MAX) = N'';
<add> SELECT @sql += 'ALTER TABLE ' + QUOTENAME(OBJECT_SCHEMA_NAME(parent_object_id))
<add> + '.' + QUOTENAME(OBJECT_NAME(parent_object_id)) +
<add> ' DROP CONSTRAINT ' + QUOTENAME(name) + ';'
<add> FROM sys.foreign_keys;
<add>
<add> EXEC sp_executesql @sql;";
<add> }
<add>
<ide> /**
<ide> * Create the column definition for a char type.
<ide> *
<ide><path>src/Illuminate/Database/Schema/SqlServerBuilder.php
<ide> class SqlServerBuilder extends Builder
<ide> */
<ide> public function dropAllTables()
<ide> {
<del> $this->disableForeignKeyConstraints();
<del>
<add> $this->connection->statement($this->grammar->dropAllForeignKeys());
<ide> $this->connection->statement($this->grammar->compileDropAllTables());
<del>
<del> $this->enableForeignKeyConstraints();
<ide> }
<ide> } | 3 |
Go | Go | remove aliases for deprecated pkg/fsutils | c1729f876c7e4a13e0183cce4d3ac4f6c82bd488 | <ide><path>pkg/fsutils/fsutils_linux.go
<del>package fsutils // import "github.com/docker/docker/pkg/fsutils"
<del>
<del>import "github.com/containerd/continuity/fs"
<del>
<del>// SupportsDType returns whether the filesystem mounted on path supports d_type.
<del>//
<del>// Deprecated: use github.com/containerd/continuity/fs.SupportsDType
<del>var SupportsDType = fs.SupportsDType | 1 |
Java | Java | improve javadocs of flatmapsingle and flatmapmaybe | 3f9ffae961506ba560a8d43e936a94eb5f563d3c | <ide><path>src/main/java/io/reactivex/Flowable.java
<ide> public final <U, V> Flowable<V> flatMapIterable(final Function<? super T, ? exte
<ide> }
<ide>
<ide> /**
<del> * Maps each element of the upstream Flowable into MaybeSources, subscribes to them and
<del> * waits until the upstream and all MaybeSources complete.
<add> * Maps each element of the upstream Flowable into MaybeSources, subscribes to all of them
<add> * and merges their onSuccess values, in no particular order, into a single Flowable sequence.
<ide> * <dl>
<ide> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator consumes the upstream in an unbounded manner.</dd>
<ide> public final <R> Flowable<R> flatMapMaybe(Function<? super T, ? extends MaybeSou
<ide> }
<ide>
<ide> /**
<del> * Maps each element of the upstream Flowable into MaybeSources, subscribes to them and
<del> * waits until the upstream and all MaybeSources complete, optionally delaying all errors.
<add> * Maps each element of the upstream Flowable into MaybeSources, subscribes to at most
<add> * {@code maxConcurrency} MaybeSources at a time and merges their onSuccess values,
<add> * in no particular order, into a single Flowable sequence, optionally delaying all errors.
<ide> * <dl>
<ide> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>If {@code maxConcurrency == Integer.MAX_VALUE} the operator consumes the upstream in an unbounded manner.
<ide> public final <R> Flowable<R> flatMapMaybe(Function<? super T, ? extends MaybeSou
<ide> }
<ide>
<ide> /**
<del> * Maps each element of the upstream Flowable into SingleSources, subscribes to them and
<del> * waits until the upstream and all SingleSources complete.
<add> * Maps each element of the upstream Flowable into SingleSources, subscribes to all of them
<add> * and merges their onSuccess values, in no particular order, into a single Flowable sequence.
<ide> * <dl>
<ide> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator consumes the upstream in an unbounded manner.</dd>
<ide> public final <R> Flowable<R> flatMapSingle(Function<? super T, ? extends SingleS
<ide> }
<ide>
<ide> /**
<del> * Maps each element of the upstream Flowable into SingleSources, subscribes to them and
<del> * waits until the upstream and all SingleSources complete, optionally delaying all errors.
<add> * Maps each element of the upstream Flowable into SingleSources, subscribes to at most
<add> * {@code maxConcurrency} SingleSources at a time and merges their onSuccess values,
<add> * in no particular order, into a single Flowable sequence, optionally delaying all errors.
<ide> * <dl>
<ide> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>If {@code maxConcurrency == Integer.MAX_VALUE} the operator consumes the upstream in an unbounded manner.
<ide><path>src/main/java/io/reactivex/Observable.java
<ide> public final <U, V> Observable<V> flatMapIterable(final Function<? super T, ? ex
<ide> }
<ide>
<ide> /**
<del> * Maps each element of the upstream Observable into MaybeSources, subscribes to them and
<del> * waits until the upstream and all MaybeSources complete.
<add> * Maps each element of the upstream Observable into MaybeSources, subscribes to all of them
<add> * and merges their onSuccess values, in no particular order, into a single Observable sequence.
<ide> * <p>
<ide> * <img width="640" height="310" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/flatMapMaybe.png" alt="">
<ide> * <dl>
<ide> public final <R> Observable<R> flatMapMaybe(Function<? super T, ? extends MaybeS
<ide> }
<ide>
<ide> /**
<del> * Maps each element of the upstream Observable into MaybeSources, subscribes to them and
<del> * waits until the upstream and all MaybeSources complete, optionally delaying all errors.
<add> * Maps each element of the upstream Observable into MaybeSources, subscribes to them
<add> * and merges their onSuccess values, in no particular order, into a single Observable sequence,
<add> * optionally delaying all errors.
<ide> * <p>
<ide> * <img width="640" height="310" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/flatMapMaybe.png" alt="">
<ide> * <dl>
<ide> public final <R> Observable<R> flatMapMaybe(Function<? super T, ? extends MaybeS
<ide> }
<ide>
<ide> /**
<del> * Maps each element of the upstream Observable into SingleSources, subscribes to them and
<del> * waits until the upstream and all SingleSources complete.
<add> * Maps each element of the upstream Observable into SingleSources, subscribes to all of them
<add> * and merges their onSuccess values, in no particular order, into a single Observable sequence.
<ide> * <p>
<ide> * <img width="640" height="310" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/flatMapSingle.png" alt="">
<ide> * <dl>
<ide> public final <R> Observable<R> flatMapSingle(Function<? super T, ? extends Singl
<ide> }
<ide>
<ide> /**
<del> * Maps each element of the upstream Observable into SingleSources, subscribes to them and
<del> * waits until the upstream and all SingleSources complete, optionally delaying all errors.
<add> * Maps each element of the upstream Observable into SingleSources, subscribes to them
<add> * and merges their onSuccess values, in no particular order, into a single Observable sequence,
<add> * optionally delaying all errors.
<ide> * <p>
<ide> * <img width="640" height="310" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/flatMapSingle.png" alt="">
<ide> * <dl> | 2 |
Javascript | Javascript | update preact links in examples | a104cf683888991cafc1762c443dfa9f0d1ff4c9 | <ide><path>examples/data-fetch/pages/preact-stars.js
<ide> function PreactStars({ stars }) {
<ide> }
<ide>
<ide> export async function getStaticProps() {
<del> const res = await fetch('https://api.github.com/repos/developit/preact')
<add> const res = await fetch('https://api.github.com/repos/preactjs/preact')
<ide> const json = await res.json()
<ide>
<ide> return {
<ide><path>examples/with-vercel-fetch/pages/preact.js
<ide> export default function Preact({ stars }) {
<ide> }
<ide>
<ide> export async function getStaticProps() {
<del> const res = await fetch('https://api.github.com/repos/developit/preact')
<add> const res = await fetch('https://api.github.com/repos/preactjs/preact')
<ide> const json = await res.json() // better use it inside try .. catch
<ide> return {
<ide> props: { stars: json.stargazers_count }, | 2 |
Ruby | Ruby | allow checksums access | bf828aa36bcee07d6a030b720e12c525ab86c854 | <ide><path>Library/Homebrew/formula_support.rb
<ide> def initialize
<ide> # a Hash, which indicates the platform the checksum applies on.
<ide> Checksum::TYPES.each do |cksum|
<ide> class_eval <<-EOS, __FILE__, __LINE__ + 1
<del> def #{cksum}(val)
<add> def #{cksum}(val=nil)
<add> return @#{cksum} if val.nil?
<ide> @#{cksum} ||= Hash.new
<ide> case val
<ide> when Hash | 1 |
PHP | PHP | sync app core.php with tempalte core.php | 3ff9747d02f3805cec4630adf659c6e9512fee13 | <ide><path>app/config/core.php
<ide> *
<ide> * Options:
<ide> *
<del> * - `handler` - callback - The callback to handle errors. You can set this to any callback type,
<add> * - `handler` - callback - The callback to handle errors. You can set this to any callback type,
<ide> * including anonymous functions.
<ide> * - `level` - int - The level of errors you are interested in capturing.
<ide> * - `trace` - boolean - Include stack traces for errors in log files.
<ide> ));
<ide>
<ide> /**
<del> * Configure the Exception handler used for uncaught exceptions. By default,
<del> * ErrorHandler::handleException() is used. It will display a HTML page for the exception, and
<del> * while debug > 0, framework errors like Missing Controller will be displayed. When debug = 0,
<add> * Configure the Exception handler used for uncaught exceptions. By default,
<add> * ErrorHandler::handleException() is used. It will display a HTML page for the exception, and
<add> * while debug > 0, framework errors like Missing Controller will be displayed. When debug = 0,
<ide> * framework errors will be coerced into generic HTTP errors.
<ide> *
<ide> * Options:
<ide> *
<del> * - `handler` - callback - The callback to handle exceptions. You can set this to any callback type,
<add> * - `handler` - callback - The callback to handle exceptions. You can set this to any callback type,
<ide> * including anonymous functions.
<ide> * - `renderer` - string - The class responsible for rendering uncaught exceptions. If you choose a custom class you
<ide> * should place the file for that class in app/libs. This class needs to implement a render method.
<ide> /**
<ide> * Session configuration.
<ide> *
<del> * Contains an array of settings to use for session configuration. The defaults key is
<add> * Contains an array of settings to use for session configuration. The defaults key is
<ide> * used to define a default preset to use for sessions, any settings declared here will override
<ide> * the settings of the default config.
<ide> *
<ide> * - `Session.name` - The name of the cookie to use. Defaults to 'CAKEPHP'
<ide> * - `Session.timeout` - The number of minutes you want sessions to live for. This timeout is handled by CakePHP
<ide> * - `Session.cookieTimeout` - The number of minutes you want session cookies to live for.
<del> * - `Session.checkAgent` - Do you want the user agent to be checked when starting sessions? You might want to set the
<add> * - `Session.checkAgent` - Do you want the user agent to be checked when starting sessions? You might want to set the
<ide> * value to false, when dealing with older versions of IE, Chrome Frame or certain web-browsing devices and AJAX
<ide> * - `Session.defaults` - The default configuration set to use as a basis for your session.
<ide> * There are four builtins: php, cake, cache, database.
<ide> * - `Session.handler` - Can be used to enable a custom session handler. Expects an array of of callables,
<ide> * that can be used with `session_save_handler`. Using this option will automatically add `session.save_handler`
<ide> * to the ini array.
<del> * - `Session.autoRegenerate` - Enabling this setting, turns on automatic renewal of sessions, and
<add> * - `Session.autoRegenerate` - Enabling this setting, turns on automatic renewal of sessions, and
<ide> * sessionids that change frequently. See CakeSession::$requestCountdown.
<ide> * - `Session.ini` - An associative array of additional ini values to set.
<ide> *
<ide> *
<ide> */
<ide>
<del>// Pick the caching engine to use. If APC is enabled use it.
<add>/**
<add> * Pick the caching engine to use. If APC is enabled use it.
<add> * If running via cli - apc is disabled by default. ensure it's avaiable and enabled in this case
<add> *
<add> */
<ide> $engine = 'File';
<del>if (extension_loaded('apc')) {
<add>if (extension_loaded('apc') && (php_sapi_name() !== 'cli' || ini_get('apc.enable_cli'))) {
<ide> $engine = 'Apc';
<ide> }
<ide>
<ide> ));
<ide>
<ide> /**
<del> * Configure the cache for model, and datasource caches. This cache configuration
<add> * Configure the cache for model, and datasource caches. This cache configuration
<ide> * is used to store schema descriptions, and table listings in connections.
<ide> */
<ide> Cache::config('_cake_model_', array(
<ide> 'serialize' => ($engine === 'File'),
<ide> 'duration' => $duration
<ide> ));
<del> | 1 |
PHP | PHP | add deprecated class stub | 9c72b1e02b9861874f394e169bdbb354555d3f8c | <ide><path>src/Http/ControllerFactory.php
<add><?php
<add>declare(strict_types=1);
<add>
<add>class_alias(
<add> 'Cake\Controller\ControllerFactory',
<add> 'Cake\Http\ControllerFactory',
<add>);
<add>deprecationWarning(
<add> 'Use Cake\Controller\ControllerFactory instead of Cake\Http\ControllerFactory.'
<add>); | 1 |
Ruby | Ruby | check formula name against blacklisted names | 4a9601ab82c1f8093d8d3643bed8b2532f7c4890 | <ide><path>Library/Homebrew/dev-cmd/audit.rb
<ide> require "cmd/search"
<ide> require "cmd/style"
<ide> require "date"
<add>require "blacklist"
<ide>
<ide> module Homebrew
<ide> module_function
<ide> def audit_formula_name
<ide> name = formula.name
<ide> full_name = formula.full_name
<ide>
<add> if blacklisted?(name)
<add> problem "'#{name}' is blacklisted."
<add> end
<add>
<ide> if Formula.aliases.include? name
<ide> problem "Formula name conflicts with existing aliases."
<ide> return | 1 |
Python | Python | correct a bug with docker module and server mode | 105920cd8334e6e6e35fa90828dbd08e78aac71d | <ide><path>glances/plugins/glances_docker.py
<ide> def update(self):
<ide> self.reset()
<ide>
<ide> # The Docker-py lib is mandatory
<del> if not docker_tag or self.args.disable_docker:
<add> if not docker_tag or (self.args is not None and self.args.disable_docker):
<ide> return self.stats
<ide>
<ide> if self.get_input() == 'local': | 1 |
Python | Python | use lookup_url_kwarg in presave if required | 216ac8a5c1ba39bf24e4e91b6fac7e0ac1dee7e4 | <ide><path>rest_framework/mixins.py
<ide> def pre_save(self, obj):
<ide> Set any attributes on the object that are implicit in the request.
<ide> """
<ide> # pk and/or slug attributes are implicit in the URL.
<del> lookup = self.kwargs.get(self.lookup_field, None)
<add> lookup_url_kwarg = self.lookup_url_kwarg or self.lookup_field
<add> lookup = self.kwargs.get(lookup_url_kwarg, None)
<ide> pk = self.kwargs.get(self.pk_url_kwarg, None)
<ide> slug = self.kwargs.get(self.slug_url_kwarg, None)
<ide> slug_field = slug and self.slug_field or None | 1 |
Text | Text | add 16.8.0 changelog and update some readmes | ce6ecd3fbf59bcf245851c6bbbfadfb69c534afe | <ide><path>CHANGELOG.md
<ide> </summary>
<ide> </details>
<ide>
<add>## 16.8.0 (February 6, 2019)
<add>
<add>### React
<add>
<add>* Add [Hooks](https://reactjs.org/docs/hooks-intro.html) — a way to use state and other React features without writing a class. ([@acdlite](https://github.com/acdlite) et al. in [#13968](https://github.com/facebook/react/pull/13968))
<add>* Improve the `useReducer` Hook lazy initialization API. ([@acdlite](https://github.com/acdlite) in [#14723](https://github.com/facebook/react/pull/14723))
<add>
<add>### React DOM
<add>
<add>* Bail out of rendering on identical values for `useState` and `useReducer` Hooks. ([@acdlite](https://github.com/acdlite) in [#14569](https://github.com/facebook/react/pull/14569))
<add>* Use `Object.is` algorithm for comparing `useState` and `useReducer` values. ([@Jessidhia](https://github.com/Jessidhia) in [#14752](https://github.com/facebook/react/pull/14752))
<add>* Don’t compare the first argument passed to `useEffect`/`useMemo`/`useCallback` Hooks. ([@acdlite](https://github.com/acdlite) in [#14594](https://github.com/facebook/react/pull/14594))
<add>* Support synchronous thenables passed to `React.lazy()`. ([@gaearon](https://github.com/gaearon) in [#14626](https://github.com/facebook/react/pull/14626))
<add>* Render components with Hooks twice in Strict Mode (DEV-only) to match class behavior. ([@gaearon](https://github.com/gaearon) in [#14654](https://github.com/facebook/react/pull/14654))
<add>* Warn about mismatching Hook order in development. ([@threepointone](https://github.com/threepointone) in [#14585](https://github.com/facebook/react/pull/14585) and [@acdlite](https://github.com/acdlite) in [#14591](https://github.com/facebook/react/pull/14591))
<add>* Effect clean-up functions must return either `undefined` or a function. All other values, including `null`, are not allowed. [@acdlite](https://github.com/acdlite) in [#14119](https://github.com/facebook/react/pull/14119)
<add>
<add>### React Test Renderer and Test Utils
<add>
<add>* Support Hooks in the shallow renderer. ([@trueadm](https://github.com/trueadm) in [#14567](https://github.com/facebook/react/pull/14567))
<add>* Fix wrong state in `shouldComponentUpdate` in the presence of `getDerivedStateFromProps` for Shallow Renderer. ([@chenesan](https://github.com/chenesan) in [#14613](https://github.com/facebook/react/pull/14613))
<add>* Add `ReactTestRenderer.act()` and `ReactTestUtils.act()` for batching updates so that tests more closely match real behavior. ([@threepointone](https://github.com/threepointone) in [#14744](https://github.com/facebook/react/pull/14744))
<add>
<add>
<add>### ESLint Plugin: React Hooks
<add>
<add>* Initial [release](https://www.npmjs.com/package/eslint-plugin-react-hooks). ([@calebmer](https://github.com/calebmer) in [#13968](https://github.com/facebook/react/pull/13968))
<add>* Fix reporting after encountering a loop. ([@calebmer](https://github.com/calebmer) and [@Yurickh](https://github.com/Yurickh) in [#14661](https://github.com/facebook/react/pull/14661))
<add>* Don't consider throwing to be a rule violation. ([@sophiebits](https://github.com/sophiebits) in [#14040](https://github.com/facebook/react/pull/14040))
<add>
<ide> ## 16.7.0 (December 19, 2018)
<ide>
<ide> ### React DOM
<ide><path>packages/eslint-plugin-react-hooks/README.md
<ide>
<ide> This ESLint plugin enforces the [Rules of Hooks](https://reactjs.org/docs/hooks-rules.html).
<ide>
<del>It is a part of the [Hooks proposal](https://reactjs.org/docs/hooks-intro.html) for React.
<del>
<del>## Experimental Status
<del>
<del>This is an experimental release and is intended to be used for testing the Hooks proposal with React 16.8 alpha. The exact heuristics it uses may be adjusted.
<del>
<del>The [Rules of Hooks](https://reactjs.org/docs/hooks-rules.html) documentation contains a link to the technical RFC. Please leave a comment on the RFC if you have concerns or ideas about how this plugin should work.
<add>It is a part of the [Hooks API](https://reactjs.org/docs/hooks-intro.html) for React.
<ide>
<ide> ## Installation
<ide>
<del>**Note: If you're using Create React App, please wait for a corresponding experimental release of `react-scripts` that includes this rule instead of adding it directly.**
<add>**Note: If you're using Create React App, please wait for a corresponding release of `react-scripts` that includes this rule instead of adding it directly.**
<ide>
<ide> Assuming you already have ESLint installed, run:
<ide>
<ide> ```sh
<ide> # npm
<del>npm install eslint-plugin-react-hooks@next --save-dev
<add>npm install eslint-plugin-react-hooks --save-dev
<ide>
<ide> # yarn
<del>yarn add eslint-plugin-react-hooks@next --dev
<add>yarn add eslint-plugin-react-hooks --dev
<ide> ```
<ide>
<ide> Then add it to your ESLint configuration: | 2 |
Python | Python | add text categorizer to language | baa3d81c3518e9e81bd6bc89382fca1d6c727f33 | <ide><path>spacy/language.py
<ide> from .pipeline import TokenVectorEncoder, NeuralTagger, NeuralEntityRecognizer
<ide> from .pipeline import NeuralLabeller
<ide> from .pipeline import SimilarityHook
<add>from .pipeline import TextCategorizer
<ide>
<ide> from .compat import json_dumps
<ide> from .attrs import IS_STOP
<ide> def create_pipeline(cls, nlp=None, disable=tuple()):
<ide> NeuralDependencyParser(nlp.vocab, **cfg),
<ide> nonproj.deprojectivize],
<ide> 'ner': lambda nlp, **cfg: [NeuralEntityRecognizer(nlp.vocab, **cfg)],
<add> 'similarity': lambda nlp, **cfg: [SimilarityHook(nlp.vocab, **cfg)],
<add> 'textcat': lambda nlp, **cfg: [TextCategorizer(nlp.vocab, **cfg)],
<ide> # Temporary compatibility -- delete after pivot
<ide> 'token_vectors': lambda nlp, **cfg: [TokenVectorEncoder(nlp.vocab, **cfg)],
<ide> 'tags': lambda nlp, **cfg: [NeuralTagger(nlp.vocab, **cfg)],
<ide> def create_pipeline(cls, nlp=None, disable=tuple()):
<ide> nonproj.deprojectivize,
<ide> ],
<ide> 'entities': lambda nlp, **cfg: [NeuralEntityRecognizer(nlp.vocab, **cfg)],
<del> 'similarity': lambda nlp, **cfg: [SimilarityHook(nlp.vocab, **cfg)]
<ide> }
<ide>
<ide> token_match = TOKEN_MATCH | 1 |
Text | Text | fix text to follow portuguese language syntax | 47ee0fefa4e25ef34d3add87220611810401ee8b | <ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-flexbox/align-elements-using-the-align-items-property.portuguese.md
<ide> localeTitle: Alinhar elementos usando a propriedade align-items
<ide> ---
<ide>
<ide> ## Description
<del><section id="description"> A propriedade <code>align-items</code> é semelhante a <code>justify-content</code> . Lembre-se de que a propriedade <code>justify-content</code> alinha os itens flexíveis ao longo do eixo principal. Para linhas, o eixo principal é uma linha horizontal e, para colunas, é uma linha vertical. Os contêineres flex também possuem um <strong>eixo cruzado</strong> que é o oposto do eixo principal. Para linhas, o eixo transversal é vertical e para colunas, o eixo transversal é horizontal. O CSS oferece a propriedade <code>align-items</code> para alinhar itens flexíveis ao longo do eixo cruzado. Por uma linha, ele informa ao CSS como empurrar os itens da linha inteira para cima ou para baixo no contêiner. E para uma coluna, como empurrar todos os itens para a esquerda ou para a direita dentro do contêiner. Os diferentes valores disponíveis para <code>align-items</code> incluem: <ul><li> <code>flex-start</code> : alinha os itens ao início do contêiner flexível. Para linhas, isso alinha os itens ao topo do contêiner. Para colunas, isso alinha os itens à esquerda do contêiner. </li><li> <code>flex-end</code> : alinha os itens ao final do contêiner flexível. Para linhas, isso alinha os itens à parte inferior do contêiner. Para colunas, isso alinha os itens à direita do contêiner. </li><li> <code>center</code> : alinhe os itens ao centro. Para linhas, alinha verticalmente os itens (espaço igual acima e abaixo dos itens). Para colunas, isso as alinha horizontalmente (espaço igual à esquerda e à direita dos itens). </li><li> <code>stretch</code> : esticar os itens para encher o contêiner flexível. Por exemplo, itens de linha são esticados para preencher o contêiner flexível de cima para baixo. </li><li> <code>baseline</code> : alinha os itens às suas linhas de base. A linha de base é um conceito de texto, pense nisso como a linha em que as letras se encaixam. </li></ul></section>
<add><section id="description"> A propriedade <code>align-items</code> é semelhante a <code>justify-content</code> . Lembre-se de que a propriedade <code>justify-content</code> alinha os itens flexíveis ao longo do eixo principal. Para linhas, o eixo principal é uma linha horizontal e, para colunas, é uma linha vertical. Os contêineres flexíveis também possuem um <strong>eixo cruzado</strong> que é o oposto do eixo principal. Para linhas, o eixo cruzado é vertical e para colunas, o eixo cruzado é horizontal. O CSS oferece a propriedade <code>align-items</code> para alinhar itens flexíveis ao longo do eixo cruzado. Para uma linha, ele informa ao CSS como empurrar os itens da linha inteira para cima ou para baixo no contêiner. E para uma coluna, como empurrar todos os itens para a esquerda ou para a direita dentro do contêiner. Os diferentes valores disponíveis para <code>align-items</code> incluem: <ul><li> <code>flex-start</code> : alinha os itens ao início do contêiner flexível. Para linhas, isso alinha os itens ao topo do contêiner. Para colunas, isso alinha os itens à esquerda do contêiner. </li><li> <code>flex-end</code> : alinha os itens ao final do contêiner flexível. Para linhas, isso alinha os itens à parte inferior do contêiner. Para colunas, isso alinha os itens à direita do contêiner. </li><li> <code>center</code> : alinha os itens ao centro. Para linhas, alinha verticalmente os itens (espaço igual acima e abaixo dos itens). Para colunas, isso as alinha horizontalmente (espaço igual à esquerda e à direita dos itens). </li><li> <code>stretch</code> : estica os itens para encher o contêiner flexível. Por exemplo, itens de linha são esticados para preencher o contêiner flexível de cima para baixo. </li><li> <code>baseline</code> : alinha os itens às suas linhas de base. A linha de base é um conceito de texto, pense nisso como a linha em que as letras ficam em cima. </li></ul></section>
<ide>
<ide> ## Instructions
<del><section id="instructions"> Um exemplo ajuda a mostrar essa propriedade em ação. Adicione os <code>align-items</code> propriedade CSS <code>align-items</code> <code>#box-container</code> e atribua a ele um valor de center. <strong>Bônus</strong> <br> Tente as outras opções para a propriedade <code>align-items</code> no editor de código para ver suas diferenças. Mas note que um valor de centro é o único que passará este desafio. </section>
<add><section id="instructions"> Um exemplo ajuda a mostrar essa propriedade em ação. Adicione a propriedade CSS <code>align-items</code> ao elemento <code>#box-container</code> e atribua a ele um valor de *center*.
<add><br> <strong>Bônus</strong> <br> Tente as outras opções para a propriedade <code>align-items</code> no editor de código para ver suas diferenças. Mas note que um valor de *center* é o único que passará este desafio. </section>
<ide>
<ide> ## Tests
<ide> <section id='tests'> | 1 |
PHP | PHP | use id() as version doesn't exist in phpunit 3.6 | f6c5ceb77a2344d722da07a6edc200694df2009e | <ide><path>lib/Cake/Test/Case/Event/CakeEventManagerTest.php
<ide> public function testDispatchReturnValue() {
<ide> */
<ide> public function testDispatchFalseStopsEvent() {
<ide> $this->skipIf(
<del> version_compare(PHPUnit_Runner_Version::VERSION, '3.7', '<'),
<add> version_compare(PHPUnit_Runner_Version::id(), '3.7', '<'),
<ide> 'These tests fail in PHPUnit 3.6'
<ide> );
<ide> | 1 |
Text | Text | update changelog for 2.8.3 | 20a9bd4e2279db29a317469c5fd93d5d0ae4fa2d | <ide><path>CHANGELOG.md
<ide> Changelog
<ide> =========
<ide>
<add>### 2.8.3
<add>
<add>Bugfixes:
<add>
<add>* [#1801](https://github.com/moment/moment/issues/1801) proper pluralization for Arabic
<add>* [#1833](https://github.com/moment/moment/issues/1833) improve spm integration
<add>* [#1871](https://github.com/moment/moment/issues/1871) fix zone bug caused by Firefox 24
<add>* [#1882](https://github.com/moment/moment/issues/1882) Use hh:mm in Czech
<add>* [#1883](https://github.com/moment/moment/issues/1883) Fix 2.8.0 regression in duration as conversions
<add>* [#1890](https://github.com/moment/moment/issues/1890) Faster travis builds
<add>* [#1892](https://github.com/moment/moment/issues/1892) Faster isBefore/After/Same
<add>* [#1848](https://github.com/moment/moment/issues/1848) Fix flaky month diffs
<add>* [#1895](https://github.com/moment/moment/issues/1895) Fix 2.8.0 regression in moment.utc with format array
<add>* [#1896](https://github.com/moment/moment/issues/1896) Support setting invalid instance locale (noop)
<add>* [#1897](https://github.com/moment/moment/issues/1897) Support moment([str]) in addition to moment([int])
<add>
<ide> ### 2.8.2
<ide>
<ide> Minor bugfixes: | 1 |
Javascript | Javascript | remove vestigial redirects | b347d157fb2d460d6a711529575547a6a0649983 | <ide><path>app.js
<ide> app.get('/map',
<ide> );
<ide>
<ide> app.get('/live-pair-programming', function(req, res) {
<del> res.redirect(301, '/field-guide/live-stream-pair-programming-on-twitch.tv');
<add> res.redirect(301, '/twitch');
<ide> });
<ide>
<del>app.get('/install-screenhero', function(req, res) {
<del> res.redirect(301, '/field-guide/install-screenhero');
<del>});
<del>
<del>app.get('/guide-to-our-nonprofit-projects', function(req, res) {
<del> res.redirect(301, '/field-guide/a-guide-to-our-nonprofit-projects');
<del>});
<del>
<del>app.get('/chromebook', function(req, res) {
<del> res.redirect(301, '/field-guide/chromebook');
<del>});
<del>
<del>app.get('/deploy-a-website', function(req, res) {
<del> res.redirect(301, '/field-guide/deploy-a-website');
<del>});
<del>
<del>app.get('/gmail-shortcuts', function(req, res) {
<del> res.redirect(301, '/field-guide/gmail-shortcuts');
<del>});
<del>
<del>app.get('/nodeschool-challenges', function(req, res) {
<del> res.redirect(301, '/field-guide/nodeschool-challenges');
<del>});
<del>
<del>
<ide> app.get('/learn-to-code', challengeMapController.challengeMap);
<ide> app.get('/about', function(req, res) {
<ide> res.redirect(301, '/map');
<ide> app.get(
<ide> );
<ide>
<ide> app.get('/privacy', function(req, res) {
<del> res.redirect(301, '/field-guide/what-is-the-free-code-camp-privacy-policy?');
<add> res.redirect(301, '/field-guide/what-is-the-free-code-camp-privacy-policy');
<ide> });
<ide>
<ide> app.get('/submit-cat-photo', resourcesController.catPhotoSubmit); | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.