content_type
stringclasses
8 values
main_lang
stringclasses
7 values
message
stringlengths
1
50
sha
stringlengths
40
40
patch
stringlengths
52
962k
file_count
int64
1
300
Text
Text
update tags in adding-new-napi-api.md
c3770536bcfb79fd2b562a861831eed369576b58
<ide><path>doc/contributing/adding-new-napi-api.md <ide> Node-API. <ide> ABI compatibility with other versions of Node.js. <ide> * New API **should** be agnostic towards the underlying JavaScript VM. <ide> * New API PRs **must** have a corresponding documentation update. <del>* New API PRs **must** be tagged as **n-api**. <add>* New API PRs **must** be tagged as **node-api**. <ide> * There **must** be at least one test case showing how to use the API. <ide> * There **should** be at least one test case per interesting use of the API. <ide> * There **should** be a sample provided that operates in a realistic way <ide> Node-API. <ide> * Experimental status exit criteria **must** involve at least the <ide> following: <ide> * A new PR **must** be opened in `nodejs/node` to remove experimental <del> status. This PR **must** be tagged as **n-api** and **semver-minor**. <add> status. This PR **must** be tagged as **node-api** and **semver-minor**. <ide> * Exiting an API from experimental **must** be signed off by the team. <ide> * If a backport is merited, an API **must** have a down-level <ide> implementation.
1
Java
Java
add tint color to inline icons
e8e2a6e4102c1ba0ee3d068769e47fa61c160524
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/text/frescosupport/FrescoBasedReactTextInlineImageShadowNode.java <ide> public class FrescoBasedReactTextInlineImageShadowNode extends ReactTextInlineIm <ide> private final @Nullable Object mCallerContext; <ide> private float mWidth = YogaConstants.UNDEFINED; <ide> private float mHeight = YogaConstants.UNDEFINED; <add> private int mTintColor = 0; <ide> <ide> public FrescoBasedReactTextInlineImageShadowNode( <ide> AbstractDraweeControllerBuilder draweeControllerBuilder, <ide> private FrescoBasedReactTextInlineImageShadowNode(FrescoBasedReactTextInlineImag <ide> mHeaders = node.mHeaders; // mHeaders is immutable <ide> mWidth = node.mWidth; <ide> mHeight = node.mHeight; <add> mTintColor = node.mTintColor; <ide> mDraweeControllerBuilder = node.mDraweeControllerBuilder; <ide> mCallerContext = node.mCallerContext; <ide> mUri = node.mUri; <ide> public void setHeaders(ReadableMap headers) { <ide> mHeaders = headers; <ide> } <ide> <add> @ReactProp(name = "tintColor") <add> public void setTintColor(int tintColor) { <add> mTintColor = tintColor; <add> } <add> <ide> /** <ide> * Besides width/height, all other layout props on inline images are ignored <ide> */ <ide> public void setHeight(Dynamic height) { <ide> "Inline images must not have percentage based height"); <ide> } <ide> } <del> <add> <ide> public @Nullable Uri getUri() { <ide> return mUri; <ide> } <ide> public TextInlineImageSpan buildInlineImageSpan() { <ide> resources, <ide> height, <ide> width, <add> mTintColor, <ide> getUri(), <ide> getHeaders(), <ide> getDraweeControllerBuilder(), <ide><path>ReactAndroid/src/main/java/com/facebook/react/views/text/frescosupport/FrescoBasedReactTextInlineImageSpan.java <ide> <ide> package com.facebook.react.views.text.frescosupport; <ide> <add>import android.graphics.Color; <add>import android.graphics.PorterDuff; <ide> import javax.annotation.Nullable; <ide> <ide> import android.content.res.Resources; <ide> public class FrescoBasedReactTextInlineImageSpan extends TextInlineImageSpan { <ide> private final @Nullable Object mCallerContext; <ide> <ide> private int mHeight; <add> private int mTintColor; <ide> private Uri mUri; <ide> private int mWidth; <ide> private ReadableMap mHeaders; <ide> public FrescoBasedReactTextInlineImageSpan( <ide> Resources resources, <ide> int height, <ide> int width, <add> int tintColor, <ide> @Nullable Uri uri, <ide> ReadableMap headers, <ide> AbstractDraweeControllerBuilder draweeControllerBuilder, <ide> public FrescoBasedReactTextInlineImageSpan( <ide> mCallerContext = callerContext; <ide> <ide> mHeight = height; <add> mTintColor = tintColor; <ide> mWidth = width; <ide> mUri = (uri != null) ? uri : Uri.EMPTY; <ide> mHeaders = headers; <ide> public void draw( <ide> <ide> mDrawable = mDraweeHolder.getTopLevelDrawable(); <ide> mDrawable.setBounds(0, 0, mWidth, mHeight); <add> if(mTintColor != 0) { <add> mDrawable.setColorFilter(mTintColor, PorterDuff.Mode.SRC_IN); <add> } <ide> mDrawable.setCallback(mTextView); <add> <ide> } <ide> <ide> // NOTE: This drawing code is copied from DynamicDrawableSpan
2
Javascript
Javascript
fix formaterror for ff4 and opera
b6db58c6472002cd81821a106816398942d4d0a4
<ide><path>src/Angular.js <ide> function forEachSorted(obj, iterator, context) { <ide> function formatError(arg) { <ide> if (arg instanceof Error) { <ide> if (arg.stack) { <del> arg = arg.stack; <add> arg = (arg.message && arg.stack.indexOf(arg.message) === -1) ? <add> 'Error: ' + arg.message + '\n' + arg.stack : arg.stack; <ide> } else if (arg.sourceURL) { <ide> arg = arg.message + '\n' + arg.sourceURL + ':' + arg.line; <ide> }
1
PHP
PHP
update validation logic
92a3b24ba8fea8cb0342c8efbf0b7025ec98496b
<ide><path>src/Illuminate/Foundation/Application.php <ide> class Application extends Container implements ApplicationContract, HttpKernelIn <ide> * <ide> * @var string <ide> */ <del> const VERSION = '5.2.1'; <add> const VERSION = '5.2.2'; <ide> <ide> /** <ide> * The base path for the Laravel installation. <ide><path>src/Illuminate/Validation/Validator.php <ide> protected function validateArray($attribute, $value) <ide> return true; <ide> } <ide> <del> return is_array($value); <add> return is_null($value) || is_array($value); <ide> } <ide> <ide> /** <ide> protected function validateBoolean($attribute, $value) <ide> <ide> $acceptable = [true, false, 0, 1, '0', '1']; <ide> <del> return in_array($value, $acceptable, true); <add> return is_null($value) || in_array($value, $acceptable, true); <ide> } <ide> <ide> /** <ide> protected function validateInteger($attribute, $value) <ide> return true; <ide> } <ide> <del> return filter_var($value, FILTER_VALIDATE_INT) !== false; <add> return is_null($value) || filter_var($value, FILTER_VALIDATE_INT) !== false; <ide> } <ide> <ide> /** <ide> protected function validateNumeric($attribute, $value) <ide> return true; <ide> } <ide> <del> return is_numeric($value); <add> return is_null($value) || is_numeric($value); <ide> } <ide> <ide> /** <ide> protected function validateString($attribute, $value) <ide> return true; <ide> } <ide> <del> return is_string($value); <add> return is_null($value) || is_string($value); <ide> } <ide> <ide> /** <ide><path>tests/Validation/ValidationValidatorTest.php <ide> public function testThatPrimitiveTypesAreImplicitAndMustBeCorrectIfDataIsPresent <ide> $v = new Validator($trans, [], ['foo' => 'numeric']); <ide> $this->assertTrue($v->passes()); <ide> <add> // Allow null on these rules unless required <ide> $trans = $this->getRealTranslator(); <ide> $v = new Validator($trans, ['foo' => null], ['foo' => 'numeric']); <add> $this->assertFalse($v->fails()); <add> <add> // Allow null on these rules unless required <add> $trans = $this->getRealTranslator(); <add> $v = new Validator($trans, ['foo' => null], ['foo' => 'required|numeric']); <ide> $this->assertTrue($v->fails()); <ide> <ide> $trans = $this->getRealTranslator();
3
Ruby
Ruby
detect recursive dependencies
42bb19a6317172804cd149024115f6973fa2fd4f
<ide><path>Library/Homebrew/formula_installer.rb <ide> def check_install_sanity <ide> recursive_deps = formula.recursive_dependencies <ide> recursive_formulae = recursive_deps.map(&:to_formula) <ide> <add> recursive_dependencies = [] <add> recursive_formulae.each do |dep| <add> dep_recursive_dependencies = dep.recursive_dependencies.map(&:to_s) <add> if dep_recursive_dependencies.include?(formula.name) <add> recursive_dependencies << "#{formula.full_name} depends on #{dep.full_name}" <add> recursive_dependencies << "#{dep.full_name} depends on #{formula.full_name}" <add> end <add> end <add> <add> unless recursive_dependencies.empty? <add> raise CannotInstallFormulaError, <<-EOS.undent <add> #{formula.full_name} contains a recursive dependency on itself: <add> #{recursive_dependencies.join("\n ")} <add> EOS <add> end <add> <add> if recursive_formulae.flat_map(&:recursive_dependencies).map(&:to_s).include?(formula.name) <add> raise CannotInstallFormulaError, <<-EOS.undent <add> #{formula.full_name} contains a recursive dependency on itself! <add> EOS <add> end <add> <ide> if ENV["HOMEBREW_CHECK_RECURSIVE_VERSION_DEPENDENCIES"] <ide> version_hash = {} <ide> version_conflicts = Set.new
1
Text
Text
update a link url to www.freecodecamp.org
3823aa90c16e192fc4de67af0fe674a41c5de349
<ide><path>curriculum/challenges/english/03-front-end-development-libraries/redux/create-a-redux-store.md <ide> The Redux `store` is an object which holds and manages application `state`. Ther <ide> <ide> Declare a `store` variable and assign it to the `createStore()` method, passing in the `reducer` as an argument. <ide> <del>**Note:** The code in the editor uses ES6 default argument syntax to initialize this state to hold a value of `5`. If you're not familiar with default arguments, you can refer to the <a href="https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions" target="_blank" rel="noopener noreferrer nofollow">ES6 section in the Curriculum</a> which covers this topic. <add>**Note:** The code in the editor uses ES6 default argument syntax to initialize this state to hold a value of `5`. If you're not familiar with default arguments, you can refer to the <a href="https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions" target="_blank" rel="noopener noreferrer nofollow">ES6 section in the Curriculum</a> which covers this topic. <ide> <ide> # --hints-- <ide>
1
Javascript
Javascript
use yyyy-mm-dd for l in lang/zh-cn.js
95ffe8b4623c43706a16374a0d553dc45cd6b122
<ide><path>lang/zh-cn.js <ide> weekdaysMin : "日_一_二_三_四_五_六".split("_"), <ide> longDateFormat : { <ide> LT : "Ah点mm", <del> L : "YYYY年MMMD日", <add> L : "YYYY-MM-DD", <ide> LL : "YYYY年MMMD日", <ide> LLL : "YYYY年MMMD日LT", <ide> LLLL : "YYYY年MMMD日ddddLT", <del> l : "YYYY年MMMD日", <add> l : "YYYY-MM-DD", <ide> ll : "YYYY年MMMD日", <ide> lll : "YYYY年MMMD日LT", <ide> llll : "YYYY年MMMD日ddddLT" <ide> prefix = this.unix() < startOfWeek.unix() ? '[上]' : '[本]'; <ide> return this.minutes() === 0 ? prefix + "dddAh点整" : prefix + "dddAh点mm"; <ide> }, <del> sameElse : 'L' <add> sameElse : 'LL' <ide> }, <ide> ordinal : function (number, period) { <ide> switch (period) { <ide><path>test/lang/zh-cn.js <ide> exports["lang:zh-cn"] = { <ide> ['s ss', '50 50'], <ide> ['a A', '下午 下午'], <ide> ['[这年的第] DDDo', '这年的第 45日'], <del> ['L', '2010年2月14日'], <add> ['L', '2010-02-14'], <ide> ['LL', '2010年2月14日'], <ide> ['LLL', '2010年2月14日下午3点25'], <ide> ['LLLL', '2010年2月14日星期日下午3点25'], <del> ['l', '2010年2月14日'], <add> ['l', '2010-02-14'], <ide> ['ll', '2010年2月14日'], <ide> ['lll', '2010年2月14日下午3点25'], <ide> ['llll', '2010年2月14日星期日下午3点25'] <ide> exports["lang:zh-cn"] = { <ide> var weeksAgo = moment().subtract({ w: 1 }), <ide> weeksFromNow = moment().add({ w: 1 }); <ide> <del> test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "1 week ago"); <del> test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 1 week"); <add> test.equal(weeksAgo.calendar(), weeksAgo.format('LL'), "1 week ago"); <add> test.equal(weeksFromNow.calendar(), weeksFromNow.format('LL'), "in 1 week"); <ide> <ide> weeksAgo = moment().subtract({ w: 2 }); <ide> weeksFromNow = moment().add({ w: 2 }); <ide> <del> test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "2 weeks ago"); <del> test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 2 weeks"); <add> test.equal(weeksAgo.calendar(), weeksAgo.format('LL'), "2 weeks ago"); <add> test.equal(weeksFromNow.calendar(), weeksFromNow.format('LL'), "in 2 weeks"); <ide> test.done(); <ide> }, <ide>
2
Javascript
Javascript
add trailing commas
fe027da1f0aa8d63ed9a2c8298a45946bc674fff
<ide><path>lib/fs.js <ide> function writeSync(fd, buffer, offsetOrOptions, length, position) { <ide> ({ <ide> offset = 0, <ide> length = buffer.byteLength - offset, <del> position = null <add> position = null, <ide> } = offsetOrOptions ?? ObjectCreate(null)); <ide> } <ide> if (position === undefined) <ide><path>lib/internal/fs/promises.js <ide> async function read(handle, bufferOrParams, offset, length, position) { <ide> buffer = Buffer.alloc(16384), <ide> offset = 0, <ide> length = buffer.byteLength - offset, <del> position = null <add> position = null, <ide> } = bufferOrParams ?? ObjectCreate(null)); <ide> <ide> validateBuffer(buffer); <ide> async function read(handle, bufferOrParams, offset, length, position) { <ide> ({ <ide> offset = 0, <ide> length = buffer.byteLength - offset, <del> position = null <add> position = null, <ide> } = offset); <ide> } <ide> <ide> async function write(handle, buffer, offsetOrOptions, length, position) { <ide> ({ <ide> offset = 0, <ide> length = buffer.byteLength - offset, <del> position = null <add> position = null, <ide> } = offsetOrOptions ?? ObjectCreate(null)); <ide> } <ide>
2
Javascript
Javascript
fix some bugs
6f3fff579894c5a28cfa1dd0116a57593624b04c
<ide><path>pdf.js <ide> function warn(msg) { <ide> } <ide> <ide> function error(msg) { <add> console.log(backtrace()); <ide> throw new Error(msg); <ide> } <ide> <ide> function assertWellFormed(cond, msg) { <ide> malformed(msg); <ide> } <ide> <add>function backtrace() { <add> var stackStr; <add> try { <add> throw new Error(); <add> } catch(e) { <add> stackStr = e.stack; <add> }; <add> return stackStr.split('\n').slice(1).join('\n'); <add>} <add> <ide> function shadow(obj, prop, value) { <ide> Object.defineProperty(obj, prop, { value: value, enumerable: true, configurable: true, writable: false }); <ide> return value; <ide> var XRef = (function() { <ide> return this.fetch(obj); <ide> }, <ide> fetch: function(ref) { <add> <add> <add> if ("undefined" == typeof ref) { <add> console.log(backtrace()); <add> } <add> <add> <ide> var num = ref.num; <ide> var e = this.cache[num]; <ide> if (e) <ide> var Page = (function() { <ide> return shadow(this, 'mediaBox', <ide> ((IsArray(obj) && obj.length == 4) ? obj : null)); <ide> }, <del> startRendering: function(canvasCtx, continuation) { <add> startRendering: function(canvasCtx, continuation, onerror) { <ide> var self = this; <ide> var stats = self.stats; <ide> stats.compile = stats.fonts = stats.render = 0; <ide> var Page = (function() { <ide> // Always defer call to display() to work around bug in <ide> // Firefox error reporting from XHR callbacks. <ide> setTimeout(function () { <del> self.display(gfx); <del> stats.render = Date.now(); <del> continuation(); <add> var exc = null; <add> try { <add> self.display(gfx); <add> stats.render = Date.now(); <add> } catch (e) { <add> exc = e.toString(); <add> } <add> continuation(exc); <ide> }); <ide> }); <ide> }, <ide> var PartialEvaluator = (function() { <ide> if (!df) <ide> return null; <ide> compositeFont = true; <del> descendant = xref.fetch(df[0]); <add> <add> if (IsRef(df)) { <add> df = xref.fetch(df); <add> } <add> <add> descendant = xref.fetch(IsRef(df) ? df : df[0]); <ide> subType = descendant.get('Subtype'); <ide> fd = descendant.get('FontDescriptor'); <ide> } else { <ide> var ColorSpace = (function() { <ide> }; <ide> <ide> constructor.parse = function colorspace_parse(cs, xref, res) { <add> <add> <add> <add> if ("undefined" == typeof(cs)) <add> console.log(backtrace()); <add> <add> <add> <add> <ide> if (IsName(cs)) { <ide> var colorSpaces = res.get('ColorSpace'); <ide> if (colorSpaces) { <ide> var ColorSpace = (function() { <ide> case 'Lab': <ide> case 'DeviceN': <ide> default: <del> error("unrecognized color space object '" + mode + "'"); <add> error("unimplemented color space object '" + mode + "'"); <ide> } <ide> } else { <del> error('unrecognized color space object'); <add> error('unrecognized color space object: "'+ cs +"'"); <ide> } <ide> }; <ide> <ide> var PDFImage = (function() { <ide> this.bpc = bitsPerComponent; <ide> <ide> var colorSpace = dict.get('ColorSpace', 'CS'); <add> if (!colorSpace) { <add> TODO('JPX images (which don"t require color spaces'); <add> colorSpace = new Name('DeviceRGB'); <add> } <ide> this.colorSpace = ColorSpace.parse(colorSpace, xref, res); <ide> <ide> this.numComps = this.colorSpace.numComps; <ide><path>test/driver.js <ide> function nextPage(task, loadError) { <ide> <ide> page.startRendering( <ide> ctx, <del> function() { snapshotCurrentPage(page, task, failure); }); <add> function(e) { <add> snapshotCurrentPage(page, task, <add> (!failure && e) ? ('render: '+ e) : failure); <add> }); <ide> } catch(e) { <ide> failure = 'page setup: '+ e.toString(); <ide> }
2
PHP
PHP
fix some tests
cca3c44078d458e9013e6788f40744907a9af616
<ide><path>tests/Cookie/CookieTest.php <ide> public function testUnqueue() <ide> { <ide> $cookie = $this->getCreator(); <ide> $cookie->queue($cookie->make('foo','bar')); <del> $this->assertArrayHasKey('foo',$cookie->getQueuedCookies()); <add> $this->assertArrayHasKey('foo', $cookie->getQueuedCookies()); <ide> $cookie->unqueue('foo'); <ide> $this->assertEmpty($cookie->getQueuedCookies()); <ide> } <ide><path>tests/Database/DatabaseEloquentModelTest.php <ide> public function testCalculatedAttributes() <ide> $attributes = $model->getAttributes(); <ide> <ide> // ensure password attribute was not set to null <del> $this->assertFalse(array_key_exists('password', $attributes)); <add> $this->assertArrayNotHasKey('password', $attributes); <ide> $this->assertEquals('******', $model->password); <ide> $this->assertEquals('5ebe2294ecd0e0f08eab7690d2a6ee69', $attributes['password_hash']); <ide> $this->assertEquals('5ebe2294ecd0e0f08eab7690d2a6ee69', $model->password_hash); <ide><path>tests/Database/DatabaseEloquentRelationTest.php <ide> public function tearDown() <ide> public function testSetRelationFail() <ide> { <ide> $parent = new EloquentRelationResetModelStub; <del> $relation =new EloquentRelationResetModelStub; <del> $parent->setRelation('test',$relation); <del> $parent->setRelation('foo','bar'); <del> $this->assertTrue(!array_key_exists('foo', $parent->toArray())); <add> $relation = new EloquentRelationResetModelStub; <add> $parent->setRelation('test', $relation); <add> $parent->setRelation('foo', 'bar'); <add> $this->assertArrayNotHasKey('foo', $parent->toArray()); <ide> } <ide> <ide> <ide><path>tests/Session/SessionStoreTest.php <ide> public function testCantSetInvalidId() <ide> $session = $this->getSession(); <ide> <ide> $session->setId(null); <del> $this->assertFalse(null == $session->getId()); <add> $this->assertNotNull($session->getId()); <ide> <ide> $session->setId(array('a')); <del> $this->assertFalse(array('a') == $session->getId()); <add> $this->assertNotSame(array('a'), $session->getId()); <ide> <ide> $session->setId('wrong'); <del> $this->assertFalse('wrong' == $session->getId()); <add> $this->assertNotEquals('wrong', $session->getId()); <ide> } <ide> <ide>
4
Javascript
Javascript
fix merge problem with argsarray/fnarray
d4a810e2b36f72f2631372114bb77d9d0a7046c8
<ide><path>pdf.js <ide> var Page = (function pagePage() { <ide> var self = this; <ide> this.IRQueue = IRQueue; <ide> var gfx = new CanvasGraphics(this.ctx, this.objs); <del> var continuation = this.callback; <add> var startTime = Date.now(); <add> var continuation = function(err) { <add> var pageNum = this.pageNumber + 1; <add> console.log('page=%d - rendering time: time=%dms', <add> pageNum, Date.now() - startTime); <add> console.log('page=%d - total time: time=%dms', <add> pageNum, Date.now() - this.startRenderingTime); <add> <add> this.callback(err); <add> }.bind(this); <ide> <ide> var displayContinuation = function pageDisplayContinuation() { <ide> console.log('--display--'); <del> <ide> // Always defer call to display() to work around bug in <ide> // Firefox error reporting from XHR callbacks. <ide> setTimeout(function pageSetTimeout() { <ide> var Page = (function pagePage() { <ide> self.stats.render = Date.now(); <ide> console.log('page=%d - executeIRQueue: time=%dms', <ide> self.pageNumber + 1, self.stats.render - startTime); <add> console.log('call back'); <ide> callback(); <ide> } <ide> } <ide> var Page = (function pagePage() { <ide> } <ide> return links; <ide> }, <del> startRendering: function(ctx, callback, errback) { <add> startRendering: function(ctx, callback) { <ide> this.ctx = ctx; <ide> this.callback = callback; <ide> <ide> var PartialEvaluator = (function partialEvaluator() { <ide> var patterns = xref.fetchIfRef(resources.get('Pattern')) || new Dict(); <ide> var parser = new Parser(new Lexer(stream), false); <ide> var res = resources; <del> var args = [], argsArray = [], fnArray = [], obj; <add> var args = [], obj; <ide> var getObjBt = function getObjBt() { <ide> parser = this.oldParser; <ide> return { name: 'BT' }; <ide> var CanvasGraphics = (function canvasGraphics() { <ide> <ide> paintImageXObject: function(imgData) { <ide> this.save(); <del> <ide> var ctx = this.ctx; <ide> var w = imgData.width; <ide> var h = imgData.height;
1
Javascript
Javascript
use function for function components
7b0802eb40c64c23fb47bd4d353b81cd5e3fac9e
<ide><path>packages/create-next-app/templates/default/pages/index.js <ide> import Head from 'next/head' <ide> <del>const Home = () => ( <del> <div className="container"> <del> <Head> <del> <title>Create Next App</title> <del> <link rel="icon" href="/favicon.ico" /> <del> </Head> <del> <del> <main> <del> <h1 className="title"> <del> Welcome to <a href="https://nextjs.org">Next.js!</a> <del> </h1> <del> <del> <p className="description"> <del> Get started by editing <code>pages/index.js</code> <del> </p> <del> <del> <div className="grid"> <del> <a href="https://nextjs.org/docs" className="card"> <del> <h3>Documentation &rarr;</h3> <del> <p>Find in-depth information about Next.js features and API.</p> <del> </a> <del> <del> <a href="https://nextjs.org/learn" className="card"> <del> <h3>Learn &rarr;</h3> <del> <p>Learn about Next.js in an interactive course with quizzes!</p> <del> </a> <del> <add>export default function Home() { <add> return ( <add> <div className="container"> <add> <Head> <add> <title>Create Next App</title> <add> <link rel="icon" href="/favicon.ico" /> <add> </Head> <add> <add> <main> <add> <h1 className="title"> <add> Welcome to <a href="https://nextjs.org">Next.js!</a> <add> </h1> <add> <add> <p className="description"> <add> Get started by editing <code>pages/index.js</code> <add> </p> <add> <add> <div className="grid"> <add> <a href="https://nextjs.org/docs" className="card"> <add> <h3>Documentation &rarr;</h3> <add> <p>Find in-depth information about Next.js features and API.</p> <add> </a> <add> <add> <a href="https://nextjs.org/learn" className="card"> <add> <h3>Learn &rarr;</h3> <add> <p>Learn about Next.js in an interactive course with quizzes!</p> <add> </a> <add> <add> <a <add> href="https://github.com/zeit/next.js/tree/master/examples" <add> className="card" <add> > <add> <h3>Examples &rarr;</h3> <add> <p>Discover and deploy boilerplate example Next.js projects.</p> <add> </a> <add> <add> <a <add> href="https://zeit.co/import?filter=next.js&utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app" <add> className="card" <add> > <add> <h3>Deploy &rarr;</h3> <add> <p> <add> Instantly deploy your Next.js site to a public URL with ZEIT Now. <add> </p> <add> </a> <add> </div> <add> </main> <add> <add> <footer> <ide> <a <del> href="https://github.com/zeit/next.js/tree/master/examples" <del> className="card" <add> href="https://zeit.co?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app" <add> target="_blank" <add> rel="noopener noreferrer" <ide> > <del> <h3>Examples &rarr;</h3> <del> <p>Discover and deploy boilerplate example Next.js projects.</p> <add> Powered by <img src="/zeit.svg" alt="ZEIT Logo" /> <ide> </a> <add> </footer> <ide> <del> <a <del> href="https://zeit.co/import?filter=next.js&utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app" <del> className="card" <del> > <del> <h3>Deploy &rarr;</h3> <del> <p> <del> Instantly deploy your Next.js site to a public URL with ZEIT Now. <del> </p> <del> </a> <del> </div> <del> </main> <del> <del> <footer> <del> <a <del> href="https://zeit.co?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app" <del> target="_blank" <del> rel="noopener noreferrer" <del> > <del> Powered by <img src="/zeit.svg" alt="ZEIT Logo" /> <del> </a> <del> </footer> <del> <del> <style jsx>{` <del> .container { <del> min-height: 100vh; <del> padding: 0 0.5rem; <del> display: flex; <del> flex-direction: column; <del> justify-content: center; <del> align-items: center; <del> } <del> <del> main { <del> padding: 5rem 0; <del> flex: 1; <del> display: flex; <del> flex-direction: column; <del> justify-content: center; <del> align-items: center; <del> } <del> <del> footer { <del> width: 100%; <del> height: 100px; <del> border-top: 1px solid #eaeaea; <del> display: flex; <del> justify-content: center; <del> align-items: center; <del> } <del> <del> footer img { <del> margin-left: 0.5rem; <del> } <del> <del> footer a { <del> display: flex; <del> justify-content: center; <del> align-items: center; <del> } <del> <del> a { <del> color: inherit; <del> text-decoration: none; <del> } <del> <del> .title a { <del> color: #0070f3; <del> text-decoration: none; <del> } <del> <del> .title a:hover, <del> .title a:focus, <del> .title a:active { <del> text-decoration: underline; <del> } <del> <del> .title { <del> margin: 0; <del> line-height: 1.15; <del> font-size: 4rem; <del> } <del> <del> .title, <del> .description { <del> text-align: center; <del> } <del> <del> .description { <del> line-height: 1.5; <del> font-size: 1.5rem; <del> } <del> <del> code { <del> background: #fafafa; <del> border-radius: 5px; <del> padding: 0.75rem; <del> font-size: 1.1rem; <del> font-family: Menlo, Monaco, Lucida Console, Liberation Mono, <del> DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace; <del> } <del> <del> .grid { <del> display: flex; <del> align-items: center; <del> justify-content: center; <del> flex-wrap: wrap; <del> <del> max-width: 800px; <del> margin-top: 3rem; <del> } <del> <del> .card { <del> margin: 1rem; <del> flex-basis: 45%; <del> padding: 1.5rem; <del> text-align: left; <del> color: inherit; <del> text-decoration: none; <del> border: 1px solid #eaeaea; <del> border-radius: 10px; <del> transition: color 0.15s ease, border-color 0.15s ease; <del> } <del> <del> .card:hover, <del> .card:focus, <del> .card:active { <del> color: #0070f3; <del> border-color: #0070f3; <del> } <del> <del> .card h3 { <del> margin: 0 0 1rem 0; <del> font-size: 1.5rem; <del> } <del> <del> .card p { <del> margin: 0; <del> font-size: 1.25rem; <del> line-height: 1.5; <del> } <del> <del> @media (max-width: 600px) { <del> .grid { <del> width: 100%; <add> <style jsx>{` <add> .container { <add> min-height: 100vh; <add> padding: 0 0.5rem; <add> display: flex; <add> flex-direction: column; <add> justify-content: center; <add> align-items: center; <add> } <add> <add> main { <add> padding: 5rem 0; <add> flex: 1; <add> display: flex; <ide> flex-direction: column; <add> justify-content: center; <add> align-items: center; <add> } <add> <add> footer { <add> width: 100%; <add> height: 100px; <add> border-top: 1px solid #eaeaea; <add> display: flex; <add> justify-content: center; <add> align-items: center; <add> } <add> <add> footer img { <add> margin-left: 0.5rem; <add> } <add> <add> footer a { <add> display: flex; <add> justify-content: center; <add> align-items: center; <add> } <add> <add> a { <add> color: inherit; <add> text-decoration: none; <add> } <add> <add> .title a { <add> color: #0070f3; <add> text-decoration: none; <add> } <add> <add> .title a:hover, <add> .title a:focus, <add> .title a:active { <add> text-decoration: underline; <add> } <add> <add> .title { <add> margin: 0; <add> line-height: 1.15; <add> font-size: 4rem; <add> } <add> <add> .title, <add> .description { <add> text-align: center; <add> } <add> <add> .description { <add> line-height: 1.5; <add> font-size: 1.5rem; <add> } <add> <add> code { <add> background: #fafafa; <add> border-radius: 5px; <add> padding: 0.75rem; <add> font-size: 1.1rem; <add> font-family: Menlo, Monaco, Lucida Console, Liberation Mono, <add> DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace; <add> } <add> <add> .grid { <add> display: flex; <add> align-items: center; <add> justify-content: center; <add> flex-wrap: wrap; <add> <add> max-width: 800px; <add> margin-top: 3rem; <add> } <add> <add> .card { <add> margin: 1rem; <add> flex-basis: 45%; <add> padding: 1.5rem; <add> text-align: left; <add> color: inherit; <add> text-decoration: none; <add> border: 1px solid #eaeaea; <add> border-radius: 10px; <add> transition: color 0.15s ease, border-color 0.15s ease; <add> } <add> <add> .card:hover, <add> .card:focus, <add> .card:active { <add> color: #0070f3; <add> border-color: #0070f3; <add> } <add> <add> .card h3 { <add> margin: 0 0 1rem 0; <add> font-size: 1.5rem; <add> } <add> <add> .card p { <add> margin: 0; <add> font-size: 1.25rem; <add> line-height: 1.5; <add> } <add> <add> @media (max-width: 600px) { <add> .grid { <add> width: 100%; <add> flex-direction: column; <add> } <add> } <add> `}</style> <add> <add> <style jsx global>{` <add> html, <add> body { <add> padding: 0; <add> margin: 0; <add> font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, <add> Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, <add> sans-serif; <add> } <add> <add> * { <add> box-sizing: border-box; <ide> } <del> } <del> `}</style> <del> <del> <style jsx global>{` <del> html, <del> body { <del> padding: 0; <del> margin: 0; <del> font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, <del> Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; <del> } <del> <del> * { <del> box-sizing: border-box; <del> } <del> `}</style> <del> </div> <del>) <del> <del>export default Home <add> `}</style> <add> </div> <add> ) <add>}
1
Java
Java
add allowheader property to webcontentgenerator
319e8e2c2f36ea146a03eaded6a39c575431fe6f
<ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/support/WebContentGenerator.java <ide> <ide> package org.springframework.web.servlet.support; <ide> <add>import java.util.ArrayList; <ide> import java.util.Arrays; <add>import java.util.Collection; <ide> import java.util.LinkedHashSet; <ide> import java.util.Set; <ide> import java.util.concurrent.TimeUnit; <ide> import javax.servlet.http.HttpServletResponse; <ide> <ide> import org.springframework.http.CacheControl; <add>import org.springframework.http.HttpMethod; <add>import org.springframework.util.ObjectUtils; <ide> import org.springframework.util.StringUtils; <ide> import org.springframework.web.HttpRequestMethodNotSupportedException; <ide> import org.springframework.web.HttpSessionRequiredException; <ide> * @author Rod Johnson <ide> * @author Juergen Hoeller <ide> * @author Brian Clozel <add> * @author Rossen Stoyanchev <ide> * @see #setCacheSeconds <ide> * @see #setCacheControl <ide> * @see #setRequireSession <ide> public abstract class WebContentGenerator extends WebApplicationObjectSupport { <ide> /** Set of supported HTTP methods */ <ide> private Set<String> supportedMethods; <ide> <add> private String allowHeader; <add> <ide> private boolean requireSession = false; <ide> <ide> private CacheControl cacheControl; <ide> public WebContentGenerator(boolean restrictDefaultSupportedMethods) { <ide> this.supportedMethods.add(METHOD_HEAD); <ide> this.supportedMethods.add(METHOD_POST); <ide> } <add> initAllowHeader(); <ide> } <ide> <ide> /** <ide> * Create a new WebContentGenerator. <ide> * @param supportedMethods the supported HTTP methods for this content generator <ide> */ <ide> public WebContentGenerator(String... supportedMethods) { <del> this.supportedMethods = new LinkedHashSet<String>(Arrays.asList(supportedMethods)); <add> setSupportedMethods(supportedMethods); <add> } <add> <add> private void initAllowHeader() { <add> Collection<String> allowedMethods; <add> if (this.supportedMethods == null) { <add> allowedMethods = new ArrayList<String>(HttpMethod.values().length - 1); <add> for (HttpMethod method : HttpMethod.values()) { <add> if (!HttpMethod.TRACE.equals(method)) { <add> allowedMethods.add(method.name()); <add> } <add> } <add> } <add> else if (this.supportedMethods.contains(HttpMethod.OPTIONS.name())) { <add> allowedMethods = this.supportedMethods; <add> } <add> else { <add> allowedMethods = new ArrayList<String>(this.supportedMethods); <add> allowedMethods.add(HttpMethod.OPTIONS.name()); <add> <add> } <add> this.allowHeader = StringUtils.collectionToCommaDelimitedString(allowedMethods); <ide> } <ide> <ide> <ide> public WebContentGenerator(String... supportedMethods) { <ide> * unrestricted for general controllers and interceptors. <ide> */ <ide> public final void setSupportedMethods(String... methods) { <del> if (methods != null) { <add> if (!ObjectUtils.isEmpty(methods)) { <ide> this.supportedMethods = new LinkedHashSet<String>(Arrays.asList(methods)); <ide> } <ide> else { <ide> this.supportedMethods = null; <ide> } <add> initAllowHeader(); <ide> } <ide> <ide> /** <ide> public final String[] getSupportedMethods() { <ide> return StringUtils.toStringArray(this.supportedMethods); <ide> } <ide> <add> /** <add> * Return the "Allow" header value to use in response to an HTTP OPTIONS <add> * request based on the configured {@link #setSupportedMethods supported <add> * methods} also automatically adding "OPTIONS" to the list even if not <add> * present as a supported method. This means sub-classes don't have to <add> * explicitly list "OPTIONS" as a supported method as long as HTTP OPTIONS <add> * requests are handled before making a call to <add> * {@link #checkRequest(HttpServletRequest)}. <add> */ <add> protected String getAllowHeader() { <add> return this.allowHeader; <add> } <add> <ide> /** <ide> * Set whether a session should be required to handle requests. <ide> */ <ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/support/WebContentGeneratorTests.java <add>/* <add> * Copyright 2002-2016 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add>package org.springframework.web.servlet.support; <add> <add>import org.junit.Test; <add> <add>import static org.junit.Assert.assertEquals; <add> <add>/** <add> * Unit tests for {@link WebContentGenerator}. <add> * @author Rossen Stoyanchev <add> */ <add>public class WebContentGeneratorTests { <add> <add> <add> @Test <add> public void getAllowHeaderWithConstructorTrue() throws Exception { <add> WebContentGenerator generator = new TestWebContentGenerator(true); <add> assertEquals("GET,HEAD,POST,OPTIONS", generator.getAllowHeader()); <add> } <add> <add> @Test <add> public void getAllowHeaderWithConstructorFalse() throws Exception { <add> WebContentGenerator generator = new TestWebContentGenerator(false); <add> assertEquals("GET,HEAD,POST,PUT,PATCH,DELETE,OPTIONS", generator.getAllowHeader()); <add> } <add> <add> @Test <add> public void getAllowHeaderWithSupportedMethodsConstructor() throws Exception { <add> WebContentGenerator generator = new TestWebContentGenerator("POST"); <add> assertEquals("POST,OPTIONS", generator.getAllowHeader()); <add> } <add> <add> @Test <add> public void getAllowHeaderWithSupportedMethodsSetter() throws Exception { <add> WebContentGenerator generator = new TestWebContentGenerator(); <add> generator.setSupportedMethods("POST"); <add> assertEquals("POST,OPTIONS", generator.getAllowHeader()); <add> } <add> <add> @Test <add> public void getAllowHeaderWithSupportedMethodsSetterEmpty() throws Exception { <add> WebContentGenerator generator = new TestWebContentGenerator(); <add> generator.setSupportedMethods(); <add> assertEquals("Effectively \"no restriction\" on supported methods", <add> "GET,HEAD,POST,PUT,PATCH,DELETE,OPTIONS", generator.getAllowHeader()); <add> } <add> <add> <add> private static class TestWebContentGenerator extends WebContentGenerator { <add> <add> public TestWebContentGenerator() { <add> } <add> <add> public TestWebContentGenerator(boolean restrictDefaultSupportedMethods) { <add> super(restrictDefaultSupportedMethods); <add> } <add> <add> public TestWebContentGenerator(String... supportedMethods) { <add> super(supportedMethods); <add> } <add> } <add>}
2
Ruby
Ruby
change more array.wrap to kernel#array
2ed17977acb288310d5455f1d716faba2202ba0c
<ide><path>actionpack/lib/action_controller/metal/params_wrapper.rb <ide> require 'active_support/core_ext/class/attribute' <ide> require 'active_support/core_ext/hash/slice' <ide> require 'active_support/core_ext/hash/except' <del>require 'active_support/core_ext/array/wrap' <ide> require 'active_support/core_ext/module/anonymous' <ide> require 'action_dispatch/http/mime_types' <ide> <ide> module ActionController <ide> # wrap_parameters :person, :include => [:username, :password] <ide> # end <ide> # <del> # On ActiveRecord models with no +:include+ or +:exclude+ option set, <add> # On ActiveRecord models with no +:include+ or +:exclude+ option set, <ide> # if attr_accessible is set on that model, it will only wrap the accessible <del> # parameters, else it will only wrap the parameters returned by the class <add> # parameters, else it will only wrap the parameters returned by the class <ide> # method attribute_names. <ide> # <ide> # If you're going to pass the parameters to an +ActiveModel+ object (such as <ide> def _set_wrapper_defaults(options, model=nil) <ide> controller_name.singularize <ide> end <ide> <del> options[:include] = Array.wrap(options[:include]).collect(&:to_s) if options[:include] <del> options[:exclude] = Array.wrap(options[:exclude]).collect(&:to_s) if options[:exclude] <del> options[:format] = Array.wrap(options[:format]) <add> options[:include] = Array(options[:include]).collect(&:to_s) if options[:include] <add> options[:exclude] = Array(options[:exclude]).collect(&:to_s) if options[:exclude] <add> options[:format] = Array(options[:format]) <ide> <ide> self._wrapper_options = options <ide> end <ide><path>actionpack/lib/action_dispatch/http/filter_parameters.rb <ide> def parameter_filter <ide> end <ide> <ide> def env_filter <del> parameter_filter_for(Array.wrap(@env["action_dispatch.parameter_filter"]) << /RAW_POST_DATA/) <add> parameter_filter_for(Array(@env["action_dispatch.parameter_filter"]) << /RAW_POST_DATA/) <ide> end <ide> <ide> def parameter_filter_for(filters) <ide><path>actionpack/lib/action_view/helpers/form_options_helper.rb <ide> def time_zone_select(object, method, priority_zones = nil, options = {}, html_op <ide> def options_for_select(container, selected = nil) <ide> return container if String === container <ide> <del> selected, disabled = extract_selected_and_disabled(selected).map do | r | <del> Array.wrap(r).map { |item| item.to_s } <add> selected, disabled = extract_selected_and_disabled(selected).map do |r| <add> Array(r).map { |item| item.to_s } <ide> end <ide> <ide> container.map do |element| <ide><path>actionpack/lib/action_view/lookup_context.rb <del>require 'active_support/core_ext/array/wrap' <ide> require 'active_support/core_ext/object/blank' <ide> require 'active_support/core_ext/module/remove_method' <ide> <ide> def #{name} <ide> end <ide> <ide> def #{name}=(value) <del> value = value.present? ? Array.wrap(value) : default_#{name} <add> value = value.present? ? Array(value) : default_#{name} <ide> _set_detail(:#{name}, value) if value != @details[:#{name}] <ide> end <ide> <ide><path>actionpack/lib/action_view/renderer/abstract_renderer.rb <ide> def extract_details(options) <ide> details = {} <ide> @lookup_context.registered_details.each do |key| <ide> next unless value = options[key] <del> details[key] = Array.wrap(value) <add> details[key] = Array(value) <ide> end <ide> details <ide> end <ide><path>actionpack/lib/action_view/renderer/template_renderer.rb <ide> require 'active_support/core_ext/object/try' <del>require 'active_support/core_ext/array/wrap' <ide> <ide> module ActionView <ide> class TemplateRenderer < AbstractRenderer #:nodoc: <ide><path>actionpack/lib/action_view/template.rb <del>require 'active_support/core_ext/array/wrap' <ide> require 'active_support/core_ext/object/blank' <ide> require 'active_support/core_ext/object/try' <ide> require 'active_support/core_ext/kernel/singleton_class' <ide> def initialize(source, identifier, handler, details) <ide> @locals = details[:locals] || [] <ide> @virtual_path = details[:virtual_path] <ide> @updated_at = details[:updated_at] || Time.now <del> @formats = Array.wrap(format).map { |f| f.is_a?(Mime::Type) ? f.ref : f } <add> @formats = Array(format).map { |f| f.is_a?(Mime::Type) ? f.ref : f } <ide> end <ide> <ide> # Returns if the underlying handler supports streaming. If so, <ide><path>actionpack/lib/action_view/template/error.rb <del>require "active_support/core_ext/array/wrap" <ide> require "active_support/core_ext/enumerable" <ide> <ide> module ActionView <ide> class MissingTemplate < ActionViewError #:nodoc: <ide> <ide> def initialize(paths, path, prefixes, partial, details, *) <ide> @path = path <del> prefixes = Array.wrap(prefixes) <add> prefixes = Array(prefixes) <ide> template_type = if partial <ide> "partial" <ide> elsif path =~ /layouts/i <ide><path>actionpack/test/abstract_unit.rb <ide> def get(thing, *args) <ide> end <ide> <ide> def assert_body(body) <del> assert_equal body, Array.wrap(response.body).join <add> assert_equal body, Array(response.body).join <ide> end <ide> <ide> def assert_status(code) <ide> assert_equal code, response.status <ide> end <ide> <ide> def assert_response(body, status = 200, headers = {}) <del> assert_body body <add> assert_body body <ide> assert_status status <ide> headers.each do |header, value| <ide> assert_header header, value
9
Text
Text
remove git conflict markers
34278b3301c0ca339d32a90264f0018e35a1e7e9
<ide><path>docs/reference/commandline/swarm_join.md <ide> This flag is generally not necessary when joining an existing swarm. <ide> ### `--manager` <ide> <ide> Joins the node as a manager <del>>>>>>>> 22565e1... Split advertised address from listen address <ide> <ide> ### `--token string` <ide>
1
Python
Python
improve error messages in tf backend
a86057d91c5f82a40bf70cbb342dd93d6be631f2
<ide><path>keras/backend/tensorflow_backend.py <ide> def set_value(x, value): <ide> class Function(object): <ide> <ide> def __init__(self, inputs, outputs, updates=[]): <del> assert type(inputs) in {list, tuple} <del> assert type(outputs) in {list, tuple} <del> assert type(updates) in {list, tuple} <add> assert type(inputs) in {list, tuple}, 'Input to a TensorFlow backend function should be a list or tuple.' <add> assert type(outputs) in {list, tuple}, 'Output to a TensorFlow backend function should be a list or tuple.' <add> assert type(updates) in {list, tuple}, 'Updates in a TensorFlow backend function should be a list or tuple.' <ide> self.inputs = list(inputs) <ide> self.outputs = list(outputs) <ide> with tf.control_dependencies(self.outputs):
1
Ruby
Ruby
suggest brew services for linux
73bc934c85dd6fabf44076482affe267cd21c5a6
<ide><path>Library/Homebrew/caveats.rb <ide> def caveats <ide> caveats << function_completion_caveats(shell) <ide> end <ide> <del> caveats << plist_caveats <add> caveats << service_caveats <ide> caveats << elisp_caveats <ide> caveats.compact.join("\n") <ide> end <ide> def elisp_caveats <ide> EOS <ide> end <ide> <del> def plist_caveats <del> return if !f.plist_manual && !f.service? <add> def service_caveats <add> return if !f.plist && !f.service? && !keg&.plist_installed? <add> <add> s = [] <ide> <ide> command = if f.service? <ide> f.service.manual_command <ide> else <ide> f.plist_manual <ide> end <ide> <del> # Default to brew services not being supported. macOS overrides this behavior. <del> <<~EOS <add> return <<~EOS if !which("launchctl") && f.plist <ide> #{Formatter.warning("Warning:")} #{f.name} provides a launchd plist which can only be used on macOS! <ide> You can manually execute the service instead with: <ide> #{command} <ide> EOS <del> end <ide> <del> def plist_path <del> destination = if f.plist_startup <del> "/Library/LaunchDaemons" <add> # Brew services only works with these two tools <add> return <<~EOS if !which("systemctl") && !which("launchctl") && f.service? <add> #{Formatter.warning("Warning:")} #{f.name} provides a service which can only be used on macOS or systemd! <add> You can manually execute the service instead with: <add> #{command} <add> EOS <add> <add> is_running_service = f.service? && quiet_system("ps aux | grep #{f.service.command&.first}") <add> if is_running_service || (f.plist && quiet_system("/bin/launchctl list #{f.plist_name} &>/dev/null")) <add> s << "To restart #{f.full_name} after an upgrade:" <add> s << " #{f.plist_startup ? "sudo " : ""}brew services restart #{f.full_name}" <add> elsif f.plist_startup <add> s << "To start #{f.full_name} now and restart at startup:" <add> s << " sudo brew services start #{f.full_name}" <ide> else <del> "~/Library/LaunchAgents" <add> s << "To start #{f.full_name} now and restart at login:" <add> s << " brew services start #{f.full_name}" <ide> end <ide> <del> plist_filename = if f.plist <del> f.plist_path.basename <del> else <del> File.basename Dir["#{keg}/*.plist"].first <add> if f.plist_manual || f.service? <add> s << "Or, if you don't want/need a background service you can just run:" <add> s << " #{command}" <ide> end <del> destination_path = Pathname.new(File.expand_path(destination)) <ide> <del> destination_path/plist_filename <add> # pbpaste is the system clipboard tool on macOS and fails with `tmux` by default <add> # check if this is being run under `tmux` to avoid failing <add> if ENV["HOMEBREW_TMUX"] && !quiet_system("/usr/bin/pbpaste") <add> s << "" << "WARNING: brew services will fail when run under tmux." <add> end <add> <add> "#{s.join("\n")}\n" unless s.empty? <ide> end <ide> end <del> <del>require "extend/os/caveats" <ide><path>Library/Homebrew/extend/os/caveats.rb <del># typed: strict <del># frozen_string_literal: true <del> <del>require "extend/os/mac/caveats" if OS.mac? <ide><path>Library/Homebrew/extend/os/mac/caveats.rb <del># typed: true <del># frozen_string_literal: true <del> <del>class Caveats <del> undef plist_caveats <del> <del> def plist_caveats <del> s = [] <del> return if !f.plist && !f.service? && !keg&.plist_installed? <del> <del> plist_domain = f.plist_path.basename(".plist") <del> <del> # we readlink because this path probably doesn't exist since caveats <del> # occurs before the link step of installation <del> # Yosemite security measures mildly tighter rules: <del> # https://github.com/Homebrew/legacy-homebrew/issues/33815 <del> if f.plist && (!plist_path.file? || !plist_path.symlink?) <del> if f.plist_startup <del> s << "To have launchd start #{f.full_name} now and restart at startup:" <del> s << " sudo brew services start #{f.full_name}" <del> else <del> s << "To have launchd start #{f.full_name} now and restart at login:" <del> s << " brew services start #{f.full_name}" <del> end <del> # For startup plists, we cannot tell whether it's running on launchd, <del> # as it requires for `sudo launchctl list` to get real result. <del> elsif f.plist_startup <del> s << "To restart #{f.full_name} after an upgrade:" <del> s << " sudo brew services restart #{f.full_name}" <del> elsif Kernel.system "/bin/launchctl list #{plist_domain} &>/dev/null" <del> s << "To restart #{f.full_name} after an upgrade:" <del> s << " brew services restart #{f.full_name}" <del> else <del> s << "To start #{f.full_name}:" <del> s << " brew services start #{f.full_name}" <del> end <del> <del> if f.plist_manual || f.service? <del> command = if f.service? <del> f.service <del> .command <del> .map do |arg| <del> next arg unless arg.match?(/\s/) <del> <del> # quote multi-word arguments <del> "'#{arg}'" <del> end.join(" ") <del> else <del> f.plist_manual <del> end <del> <del> s << "Or, if you don't want/need a background service you can just run:" <del> s << " #{command}" <del> end <del> <del> # pbpaste is the system clipboard tool on macOS and fails with `tmux` by default <del> # check if this is being run under `tmux` to avoid failing <del> if ENV["HOMEBREW_TMUX"] && !quiet_system("/usr/bin/pbpaste") <del> s << "" << "WARNING: brew services will fail when run under tmux." <del> end <del> "#{s.join("\n")}\n" unless s.empty? <del> end <del>end <ide><path>Library/Homebrew/test/caveats_spec.rb <ide> def caveats <ide> <ide> describe "#caveats" do <ide> context "when f.plist is not nil", :needs_macos do <add> it "prints error when no launchd is present" do <add> f = formula do <add> url "foo-1.0" <add> def plist <add> "plist_test.plist" <add> end <add> end <add> allow_any_instance_of(Object).to receive(:which).with("launchctl").and_return(nil) <add> expect(described_class.new(f).caveats).to include("provides a launchd plist which can only be used on macOS!") <add> end <add> <ide> it "prints plist startup information when f.plist_startup is not nil" do <ide> f = formula do <ide> url "foo-1.0" <ide> def plist <ide> plist_path = mktmpdir/"plist" <ide> FileUtils.touch plist_path <ide> allow(f_obj).to receive(:plist_path).and_return(plist_path) <add> allow(Homebrew).to receive(:_system).and_return(true) <add> allow(Homebrew).to receive(:_system).with("/bin/launchctl list #{f.plist_name} &>/dev/null").and_return(true) <ide> allow(plist_path).to receive(:symlink?).and_return(true) <ide> expect(f_obj.caveats).to include("restart #{f.full_name}") <ide> expect(f_obj.caveats).to include("sudo") <ide> end <ide> <del> context "when plist_path is not a file nor symlinked and plist_startup is false" do <del> let(:f) { <del> formula do <del> url "foo-1.0" <del> def plist <del> "plist_test.plist" <del> end <del> end <del> } <del> let(:f_obj) { described_class.new(f) } <del> let(:caveats) { f_obj.caveats } <del> let(:plist_path) { mktmpdir/"plist" } <del> <del> before do <del> FileUtils.touch plist_path <del> allow(f_obj).to receive(:plist_path).and_return(plist_path) <del> allow(plist_path).to receive(:symlink?).and_return(true) <del> end <del> <del> it "tells command to run after upgrade" do <del> allow(Kernel).to receive(:system).with(any_args).and_return(true) <del> expect(caveats).to include("restart #{f.full_name} after an upgrade") <del> end <del> <del> it "tells command to run to start formula" do <del> expect(caveats).to include("To start #{f.full_name}:") <del> end <del> end <del> <ide> it "gives information about plist_manual" do <ide> f = formula do <ide> url "foo-1.0" <ide> def plist <ide> expect(caveats).to include("background service") <ide> end <ide> <del> it "wraps multi-word service parameters" do <add> it "warns about brew failing under tmux" do <ide> f = formula do <ide> url "foo-1.0" <del> service do <del> run [bin/"nginx", "-g", "daemon off;"] <add> def plist <add> "plist_test.plist" <ide> end <ide> end <add> ENV["HOMEBREW_TMUX"] = "1" <add> allow(Homebrew).to receive(:_system).and_return(true) <add> allow(Homebrew).to receive(:_system).with("/usr/bin/pbpaste").and_return(false) <ide> caveats = described_class.new(f).caveats <ide> <del> expect(f.service?).to eq(true) <del> expect(caveats).to include("#{f.bin}/nginx -g 'daemon off;'") <del> expect(caveats).to include("background service") <add> expect(caveats).to include("WARNING:") <add> expect(caveats).to include("tmux") <ide> end <add> end <ide> <del> it "warns about brew failing under tmux" do <add> context "when f.service is not nil" do <add> it "prints warning when no service deamon is found" do <ide> f = formula do <ide> url "foo-1.0" <del> def plist <del> "plist_test.plist" <add> service do <add> run [bin/"cmd"] <ide> end <add> plist_options startup: true <ide> end <del> ENV["HOMEBREW_TMUX"] = "1" <del> allow(Homebrew).to receive(:_system).with("/usr/bin/pbpaste").and_return(false) <add> <add> allow_any_instance_of(Object).to receive(:which).with("launchctl").and_return(nil) <add> allow_any_instance_of(Object).to receive(:which).with("systemctl").and_return(nil) <add> expect(described_class.new(f).caveats).to include("service which can only be used on macOS or systemd!") <add> end <add> <add> it "prints service startup information when f.plist_startup is not nil" do <add> f = formula do <add> url "foo-1.0" <add> service do <add> run [bin/"cmd"] <add> end <add> plist_options startup: true <add> end <add> cmd = "#{HOMEBREW_CELLAR}/formula_name/1.0/bin/cmd" <add> allow(Homebrew).to receive(:_system).and_return(true) <add> allow(Homebrew).to receive(:_system).with("ps aux | grep #{cmd}").and_return(false) <add> expect(described_class.new(f).caveats).to include("startup") <add> end <add> <add> it "prints service login information when f.plist_startup is nil" do <add> f = formula do <add> url "foo-1.0" <add> service do <add> run [bin/"cmd"] <add> end <add> end <add> cmd = "#{HOMEBREW_CELLAR}/formula_name/1.0/bin/cmd" <add> allow(Homebrew).to receive(:_system).and_return(true) <add> allow(Homebrew).to receive(:_system).with("ps aux | grep #{cmd}").and_return(false) <add> expect(described_class.new(f).caveats).to include("login") <add> end <add> <add> it "gives information about restarting services after upgrade" do <add> f = formula do <add> url "foo-1.0" <add> service do <add> run [bin/"cmd"] <add> end <add> plist_options startup: true <add> end <add> cmd = "#{HOMEBREW_CELLAR}/formula_name/1.0/bin/cmd" <add> f_obj = described_class.new(f) <add> allow(Homebrew).to receive(:_system).and_return(true) <add> allow(Homebrew).to receive(:_system).with("ps aux | grep #{cmd}").and_return(true) <add> expect(f_obj.caveats).to include("restart #{f.full_name}") <add> expect(f_obj.caveats).to include("sudo") <add> end <add> <add> it "gives information about service manual command" do <add> f = formula do <add> url "foo-1.0" <add> service do <add> run [bin/"cmd", "start"] <add> environment_variables VAR: "foo" <add> end <add> end <add> cmd = "#{HOMEBREW_CELLAR}/formula_name/1.0/bin/cmd" <ide> caveats = described_class.new(f).caveats <ide> <del> expect(caveats).to include("WARNING:") <del> expect(caveats).to include("tmux") <add> expect(caveats).to include("background service") <add> expect(caveats).to include("VAR=\"foo\" #{cmd} start") <ide> end <ide> end <ide>
4
Text
Text
fix broken link on docs man page
a0df23ec8db39d24913322d274d7107dc56f8e01
<ide><path>docs/README.md <ide> - [External Commands](External-Commands.md) <ide> - [Ruby Gems, Python Eggs and Perl Modules](Gems,-Eggs-and-Perl-Modules.md) <ide> - [Python](Homebrew-and-Python.md) <del>- [How To Build Software Outside Homebrew With Homebrew `keg_only` dependencies](How-to-build-software-outside-Homebrew-with-Homebrew-keg-only-dependencies.md) <add>- [How To Build Software Outside Homebrew With Homebrew `keg_only` dependencies](How-to-Build-Software-Outside-Homebrew-with-Homebrew-keg-only-Dependencies.md) <ide> - [Xcode](Xcode.md) <ide> - [Kickstarter Supporters](Kickstarter-Supporters.md) <ide>
1
Python
Python
fix gevent import
022f447dd13af16f4407c557a737a0afee1e839a
<ide><path>celery/concurrency/gevent.py <ide> def apply_timeout(target, args=(), kwargs={}, callback=None, <ide> class Timer(_timer.Timer): <ide> <ide> def __init__(self, *args, **kwargs): <del> from gevent.greenlet import Greenlet, GreenletExit <add> from gevent import Greenlet, GreenletExit <ide> <ide> class _Greenlet(Greenlet): <ide> cancel = Greenlet.kill
1
Ruby
Ruby
fix collectionproxy#<< documentation
970a1469977690a1396741272049ff76f737fbb1
<ide><path>activerecord/lib/active_record/associations/collection_proxy.rb <ide> def to_ary <ide> alias_method :to_a, :to_ary <ide> <ide> # Adds one or more +records+ to the collection by setting their foreign keys <del> # to the collection‘s primary key. Returns +self+, so several appends may be <add> # to the association‘s primary key. Returns +self+, so several appends may be <ide> # chained together. <ide> # <ide> # class Person < ActiveRecord::Base
1
Javascript
Javascript
add error handling for inmemorycache
15a999260389163a569e24804d8b5e81b1df144d
<ide><path>api-server/server/models/donation.js <ide> import { Observable } from 'rx'; <ide> import debug from 'debug'; <ide> <add>import { reportError } from '../middlewares/error-reporter'; <ide> import InMemoryCache from '../utils/in-memory-cache'; <ide> <ide> const log = debug('fcc:boot:donate'); <ide> const fiveMinutes = 1000 * 60 * 5; <ide> export default function(Donation) { <ide> let activeDonationUpdateInterval = null; <ide> const activeDonationCountCacheTTL = fiveMinutes; <del> const activeDonationCountCache = InMemoryCache(0); <add> const activeDonationCountCache = InMemoryCache(0, reportError); <ide> const activeDonationsQuery$ = () => <ide> Donation.find$({ <ide> // eslint-disable-next-line no-undefined <ide> export default function(Donation) { <ide> } <ide> <ide> process.on('exit', cleanUp); <add> <ide> Donation.on('dataSourceAttached', () => { <ide> Donation.find$ = Observable.fromNodeCallback(Donation.find.bind(Donation)); <ide> Donation.findOne$ = Observable.fromNodeCallback( <ide> Donation.findOne.bind(Donation) <ide> ); <del> activeDonationsQuery$().subscribe(count => { <del> log('activeDonator count: %d', count); <del> return activeDonationCountCache.update(() => count); <del> }); <ide> <add> seedTheCache() <add> .then(setupCacheUpdateInterval) <add> .catch(err => { <add> const errMsg = `Error caught seeding the cache: ${err.message}`; <add> err.message = errMsg; <add> reportError(err); <add> }); <add> }); <add> <add> function seedTheCache() { <add> return new Promise((resolve, reject) => <add> Observable.defer(activeDonationsQuery$).subscribe(count => { <add> log('activeDonator count: %d', count); <add> activeDonationCountCache.update(() => count); <add> return resolve(); <add> }, reject) <add> ); <add> } <add> <add> function setupCacheUpdateInterval() { <ide> activeDonationUpdateInterval = setInterval( <ide> () => <del> activeDonationsQuery$().subscribe(count => { <del> log('activeDonator count: %d', count); <del> return activeDonationCountCache.update(() => count); <del> }), <add> Observable.defer(activeDonationsQuery$).subscribe( <add> count => { <add> log('activeDonator count: %d', count); <add> return activeDonationCountCache.update(() => count); <add> }, <add> err => { <add> const errMsg = `Error caught updating the cache: ${err.message}`; <add> err.message = errMsg; <add> reportError(err); <add> } <add> ), <ide> activeDonationCountCacheTTL <ide> ); <del> }); <add> return null; <add> } <ide> <ide> function getCurrentActiveDonationCount$() { <ide> return Observable.of(activeDonationCountCache.get()); <ide><path>api-server/server/utils/in-memory-cache.js <ide> function isPromiseLike(thing) { <ide> return !!thing && typeof thing.then === 'function'; <ide> } <ide> <del>function InMemoryCache(initialValue) { <add>function InMemoryCache(initialValue, reportError) { <add> if (typeof reportError !== 'function') { <add> throw new Error( <add> 'No reportError function specified for this in-memory-cache' <add> ); <add> } <ide> const cacheKey = Symbol('cacheKey'); <ide> const cache = new Map(); <del> <del> if (typeof initialValue !== 'undefined') { <del> cache.set(cacheKey, initialValue); <del> } <add> cache.set(cacheKey, initialValue); <ide> <ide> return { <ide> get() { <ide> const value = cache.get(cacheKey); <ide> return typeof value !== 'undefined' ? value : null; <ide> }, <add> <ide> async update(fn) { <del> const maybePromisedValue = fn(); <add> let maybePromisedValue; <add> try { <add> maybePromisedValue = fn(); <add> } catch (e) { <add> const errMsg = `InMemoryCache > update > caught: ${e.message}`; <add> e.message = errMsg; <add> reportError(e); <add> return null; <add> } <ide> if (isPromiseLike(maybePromisedValue)) { <ide> return maybePromisedValue.then(value => cache.set(cacheKey, value)); <ide> } else { <ide> function InMemoryCache(initialValue) { <ide> return null; <ide> } <ide> }, <add> <ide> clear() { <ide> return cache.delete(cacheKey); <ide> } <ide><path>api-server/server/utils/in-memory-cache.test.js <del>/* global describe expect it beforeEach */ <add>/* global describe expect it */ <ide> import inMemoryCache from './in-memory-cache'; <add>import sinon from 'sinon'; <ide> <ide> describe('InMemoryCache', () => { <add> let reportErrorStub; <ide> const theAnswer = 42; <ide> const before = 'before'; <ide> const after = 'after'; <ide> const emptyCacheValue = null; <ide> <del> describe('get', () => { <del> it('returns null for an empty cache', () => { <del> const cache = inMemoryCache(); <del> expect(cache.get()).toBe(emptyCacheValue); <del> }); <add> beforeEach(() => { <add> reportErrorStub = sinon.spy(); <add> }); <add> <add> it('throws if no report function is passed as a second argument', () => { <add> expect(() => inMemoryCache(null)).toThrowError( <add> 'No reportError function specified for this in-memory-cache' <add> ); <add> }); <ide> <add> describe('get', () => { <ide> it('returns an initial value', () => { <del> const cache = inMemoryCache(theAnswer); <add> const cache = inMemoryCache(theAnswer, reportErrorStub); <ide> expect(cache.get()).toBe(theAnswer); <ide> }); <ide> }); <ide> <ide> describe('update', () => { <ide> it('updates the cached value', () => { <del> const cache = inMemoryCache(before); <add> const cache = inMemoryCache(before, reportErrorStub); <ide> cache.update(() => after); <ide> expect(cache.get()).toBe(after); <ide> }); <ide> <ide> it('can handle promises correctly', done => { <del> const cache = inMemoryCache(before); <add> const cache = inMemoryCache(before, reportErrorStub); <ide> cache.update(() => new Promise(resolve => resolve(after))); <ide> // because async <ide> setImmediate(() => { <ide> expect(cache.get()).toBe(after); <ide> done(); <ide> }); <ide> }); <add> <add> it('reports errors thrown from the update function', () => { <add> const reportErrorStub = sinon.spy(); <add> const cache = inMemoryCache(before, reportErrorStub); <add> <add> const updateError = new Error('An update error'); <add> const updateThatThrows = () => { <add> throw updateError; <add> }; <add> <add> cache.update(updateThatThrows); <add> expect(reportErrorStub.calledWith(updateError)).toBe(true); <add> }); <ide> }); <ide> <ide> describe('clear', () => { <ide> it('clears the cache', () => { <ide> expect.assertions(2); <del> const cache = inMemoryCache(theAnswer); <add> const cache = inMemoryCache(theAnswer, reportErrorStub); <ide> expect(cache.get()).toBe(theAnswer); <ide> cache.clear(); <ide> expect(cache.get()).toBe(emptyCacheValue);
3
Text
Text
add preventdefault() on click event
91156b6f0ced65b5681874e2cf2a95e045d708e9
<ide><path>guides/source/working_with_javascript_in_rails.md <ide> paintIt = (element, backgroundColor, textColor) -> <ide> element.style.color = textColor <ide> <ide> $ -> <del> $("a[data-background-color]").click -> <add> $("a[data-background-color]").click (e) -> <add> e.preventDefault() <add> <ide> backgroundColor = $(this).data("background-color") <ide> textColor = $(this).data("text-color") <ide> paintIt(this, backgroundColor, textColor)
1
Mixed
Text
update examples to show real worth
cc0d8fbec96aeb1664fe98d45929a236b18aec81
<ide><path>activesupport/CHANGELOG.md <ide> * Added yield to Object#presence, so you can do this: <ide> <del> person.presence { |p| p.name.first } || 'Nobody' <add> project.account.owner.presence { |p| p.name.first } || 'Nobody' <add> <add> instead of calling twice (which may incur double SQL calls): <add> <add> project.account.owner ? project.account.owner.name.first || 'Nobody' <add> <add> or assigning to local variable: <add> <add> owner = project.account.owner <add> owner ? owner.name.first || 'Nobody' <ide> <ide> *DHH* <ide> <ide><path>activesupport/lib/active_support/core_ext/object/blank.rb <ide> def present? <ide> # You can also use this with a block that will be yielded if the object is present <ide> # and the result of that block will then be returned <ide> # <del> # person.presence { |p| p.name.first } || 'Nobody' <add> # project.account.owner.presence { |p| p.name.first } || 'Nobody' <ide> # <ide> # @return [Object] <ide> def presence
2
Ruby
Ruby
use explicit path to llvm
b70a5da5eb9e9f498a8f4c4c6ea0033a5ed96cb6
<ide><path>Library/Homebrew/brewkit.rb <ide> prefix = `/usr/bin/xcode-select -print-path`.chomp <ide> prefix = "/Developer" if prefix.to_s.empty? <ide> <del> ENV['PATH'] = "#{prefix}/usr/llvm-gcc-4.2/bin:#{ENV['PATH']}" <del> ENV['CC'] = 'llvm-gcc-4.2' <del> ENV['CXX'] = 'llvm-g++-4.2' <add> ENV['CC'] = "#{prefix}/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2" <add> ENV['CXX'] = "#{prefix}/usr/llvm-gcc-4.2/bin/llvm-g++-4.2" <ide> cflags = ['-O4'] # O4 baby! <ide> else <ide> ENV['CC']="gcc-4.2"
1
Ruby
Ruby
pass explicit sort to handle apfs
f6bc7dc4c61f5fb34709da62eb68cfad74f9fd91
<ide><path>Library/Homebrew/cmd/search.rb <ide> module Homebrew <ide> <ide> def search <ide> if ARGV.empty? <del> puts Formatter.columns(Formula.full_names) <add> puts Formatter.columns(Formula.full_names.sort) <ide> elsif ARGV.include? "--macports" <ide> exec_browser "https://www.macports.org/ports.php?by=name&substr=#{ARGV.next}" <ide> elsif ARGV.include? "--fink" <ide> def search <ide> results = search_taps(name) <ide> end <ide> <del> puts Formatter.columns(results) unless results.empty? <add> puts Formatter.columns(results.sort) unless results.empty? <ide> else <ide> query = ARGV.first <ide> regex = query_regexp(query) <ide> local_results = search_formulae(regex) <del> puts Formatter.columns(local_results) unless local_results.empty? <add> puts Formatter.columns(local_results.sort) unless local_results.empty? <ide> <ide> tap_results = search_taps(query) <del> puts Formatter.columns(tap_results) unless tap_results.empty? <add> puts Formatter.columns(tap_results.sort) unless tap_results.empty? <ide> <ide> if $stdout.tty? <ide> count = local_results.length + tap_results.length
1
Ruby
Ruby
remove branching logic from calls to find_nth
0405d5a7e95776f9adf5b8ff064300898d89b43a
<ide><path>activerecord/lib/active_record/relation/finder_methods.rb <ide> def first(limit = nil) <ide> if limit <ide> find_nth_with_limit(offset_value, limit) <ide> else <del> find_nth(:first, offset_value) <add> find_nth(:first, offset_index) <ide> end <ide> end <ide> <ide> def last! <ide> # Person.offset(3).second # returns the second object from OFFSET 3 (which is OFFSET 4) <ide> # Person.where(["user_name = :u", { u: user_name }]).second <ide> def second <del> find_nth(:second, offset_value ? offset_value + 1 : 1) <add> find_nth(:second, offset_index + 1) <ide> end <ide> <ide> # Same as +second+ but raises <tt>ActiveRecord::RecordNotFound</tt> if no record <ide> def second! <ide> # Person.offset(3).third # returns the third object from OFFSET 3 (which is OFFSET 5) <ide> # Person.where(["user_name = :u", { u: user_name }]).third <ide> def third <del> find_nth(:third, offset_value ? offset_value + 2 : 2) <add> find_nth(:third, offset_index + 2) <ide> end <ide> <ide> # Same as +third+ but raises <tt>ActiveRecord::RecordNotFound</tt> if no record <ide> def third! <ide> # Person.offset(3).fourth # returns the fourth object from OFFSET 3 (which is OFFSET 6) <ide> # Person.where(["user_name = :u", { u: user_name }]).fourth <ide> def fourth <del> find_nth(:fourth, offset_value ? offset_value + 3 : 3) <add> find_nth(:fourth, offset_index + 3) <ide> end <ide> <ide> # Same as +fourth+ but raises <tt>ActiveRecord::RecordNotFound</tt> if no record <ide> def fourth! <ide> # Person.offset(3).fifth # returns the fifth object from OFFSET 3 (which is OFFSET 7) <ide> # Person.where(["user_name = :u", { u: user_name }]).fifth <ide> def fifth <del> find_nth(:fifth, offset_value ? offset_value + 4 : 4) <add> find_nth(:fifth, offset_index + 4) <ide> end <ide> <ide> # Same as +fifth+ but raises <tt>ActiveRecord::RecordNotFound</tt> if no record <ide> def fifth! <ide> # Person.offset(3).forty_two # returns the fifth object from OFFSET 3 (which is OFFSET 44) <ide> # Person.where(["user_name = :u", { u: user_name }]).forty_two <ide> def forty_two <del> find_nth(:forty_two, offset_value ? offset_value + 41 : 41) <add> find_nth(:forty_two, offset_index + 41) <ide> end <ide> <ide> # Same as +forty_two+ but raises <tt>ActiveRecord::RecordNotFound</tt> if no record <ide> def raise_record_not_found_exception!(ids, result_size, expected_size) #:nodoc: <ide> <ide> private <ide> <add> def offset_index <add> offset_value || 0 <add> end <add> <ide> def find_with_associations <ide> join_dependency = construct_join_dependency <ide>
1
Javascript
Javascript
add default param to options
cb77a4801c7955def3236e509160caf32cf6eebb
<ide><path>src/config.js <ide> class Config { <ide> // * `true` if the value was set. <ide> // * `false` if the value was not able to be coerced to the type specified in the setting's schema. <ide> set () { <del> let [keyPath, value, options] = Array.from(arguments) <add> let [keyPath, value, options = {}] = Array.from(arguments) <ide> <ide> if (!this.settingsLoaded) { <ide> this.pendingOperations.push(() => this.set(keyPath, value, options)) <ide> } <ide> <del> const scopeSelector = options != null ? options.scopeSelector : undefined <del> let source = options != null ? options.source : undefined <del> const shouldSave = (options != null ? options.save : undefined) != null ? (options != null ? options.save : undefined) : true <add> const scopeSelector = options.scopeSelector <add> let source = options.source <add> const shouldSave = options.save != null ? options.save : true <ide> <ide> if (source && !scopeSelector) { <ide> throw new Error("::set with a 'source' and no 'sourceSelector' is not yet implemented!")
1
PHP
PHP
add support for localization in throttleslogins
e963fcbe25e0b716f2a8d958a84dabb25a97670e
<ide><path>src/Illuminate/Foundation/Auth/ThrottlesLogins.php <ide> protected function incrementLoginAttempts(Request $request) <ide> protected function sendLockoutResponse(Request $request) <ide> { <ide> $seconds = (int) Cache::get($this->getLoginLockExpirationKey($request)) - time(); <del> <add> $key = 'passwords.throttle'; <ide> return redirect($this->loginPath()) <ide> ->withInput($request->only($this->loginUsername(), 'remember')) <ide> ->withErrors([ <del> $this->loginUsername() => 'Too many login attempts. Please try again in '.$seconds.' seconds.', <add> $this->loginUsername() => trans()->has($key) ? trans($key, ['seconds' => $seconds]) : 'Too many login attempts. Please try again in '.$seconds.' seconds.', <ide> ]); <ide> } <ide>
1
Javascript
Javascript
replace bitwise ors by ors
d4f4b43d29cfb91bbaea74b3f369621c1ddc0cb4
<ide><path>src/scripting_api/field.js <ide> class Field extends PDFObject { <ide> this._document = data.doc; <ide> this._actions = this._createActionsMap(data.actions); <ide> <del> this._fillColor = data.fillColor | ["T"]; <del> this._strokeColor = data.strokeColor | ["G", 0]; <del> this._textColor = data.textColor | ["G", 0]; <add> this._fillColor = data.fillColor || ["T"]; <add> this._strokeColor = data.strokeColor || ["G", 0]; <add> this._textColor = data.textColor || ["G", 0]; <ide> } <ide> <ide> get fillColor() {
1
Javascript
Javascript
update d3.js and d3.min.js
25c0bca405b61cb80484bf56036a491cda724711
<ide><path>d3.js <ide> d3.range = function(start, stop, step) { <ide> <ide> // calculate correction for IEEE error <ide> function calcRdx(n, m) { <del> var val = n > m ? n : m; <del> return Math.pow(10, 18 - ~~(Math.log((val > 0) ? val : -val) * Math.LOG10E)); <add> var low = n < m ? n : m, <add> fix = 1; <add> if (isNaN(+low)) return low; <add> while ((fix *= 10) * low % 1 !== 0); <add> return fix; <ide> } <ide> d3.requote = function(s) { <ide> return s.replace(d3_requote_re, "\\$&"); <ide><path>d3.min.js <del>(function(){function e(a){var b=-1,c=a.length,d=[];while(++b<c)d.push(a[b]);return d}function f(a){return Array.prototype.slice.call(a)}function i(){return this}function j(a,b,c){return function(){var d=c.apply(b,arguments);return arguments.length?a:d}}function k(a){return a!=null&&!isNaN(a)}function l(a){return a.length}function m(a){return a==null}function n(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function o(a,b){var c=a>b?a:b;return Math.pow(10,18-~~(Math.log(c>0?c:-c)*Math.LOG10E))}function r(){}function s(a){function d(){var c=b,d=-1,e=c.length,f;while(++d<e)(f=c[d].on)&&f.apply(this,arguments);return a}var b=[],c={};return d.on=function(d,e){var f,g;if(arguments.length<2)return(f=c[d])&&f.on;if(f=c[d])f.on=null,b=b.slice(0,g=b.indexOf(f)).concat(b.slice(g+1)),delete c[d];return e&&b.push(c[d]={on:e}),a},d}function v(a,b){return b-(a?1+Math.floor(Math.log(a+Math.pow(10,1+Math.floor(Math.log(a)/Math.LN10)-b))/Math.LN10):1)}function w(a){return a+""}function x(a){var b=a.lastIndexOf("."),c=b>=0?a.substring(b):(b=a.length,""),d=[];while(b>0)d.push(a.substring(b-=3,b+3));return d.reverse().join(",")+c}function z(a,b){return{scale:Math.pow(10,(8-b)*3),symbol:a}}function E(a){return function(b){return b<=0?0:b>=1?1:a(b)}}function F(a){return function(b){return 1-a(1-b)}}function G(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function H(a){return a}function I(a){return function(b){return Math.pow(b,a)}}function J(a){return 1-Math.cos(a*Math.PI/2)}function K(a){return Math.pow(2,10*(a-1))}function L(a){return 1-Math.sqrt(1-a*a)}function M(a,b){var c;return arguments.length<2&&(b=.45),arguments.length<1?(a=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/a),function(d){return 1+a*Math.pow(2,10*-d)*Math.sin((d-c)*2*Math.PI/b)}}function N(a){return a||(a=1.70158),function(b){return b*b*((a+1)*b-a)}}function O(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}function P(){d3.event.stopPropagation(),d3.event.preventDefault()}function R(a){return a=="transform"?d3.interpolateTransform:d3.interpolate}function S(a,b){return b=b-(a=+a)?1/(b-a):0,function(c){return(c-a)*b}}function T(a,b){return b=b-(a=+a)?1/(b-a):0,function(c){return Math.max(0,Math.min(1,(c-a)*b))}}function U(a,b,c){return new V(a,b,c)}function V(a,b,c){this.r=a,this.g=b,this.b=c}function W(a){return a<16?"0"+Math.max(0,a).toString(16):Math.min(255,a).toString(16)}function X(a,b,c){var d=0,e=0,f=0,g,h,i;g=/([a-z]+)\((.*)\)/i.exec(a);if(g){h=g[2].split(",");switch(g[1]){case"hsl":return c(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case"rgb":return b(Z(h[0]),Z(h[1]),Z(h[2]))}}return(i=$[a])?b(i.r,i.g,i.b):(a!=null&&a.charAt(0)==="#"&&(a.length===4?(d=a.charAt(1),d+=d,e=a.charAt(2),e+=e,f=a.charAt(3),f+=f):a.length===7&&(d=a.substring(1,3),e=a.substring(3,5),f=a.substring(5,7)),d=parseInt(d,16),e=parseInt(e,16),f=parseInt(f,16)),b(d,e,f))}function Y(a,b,c){var d=Math.min(a/=255,b/=255,c/=255),e=Math.max(a,b,c),f=e-d,g,h,i=(e+d)/2;return f?(h=i<.5?f/(e+d):f/(2-e-d),a==e?g=(b-c)/f+(b<c?6:0):b==e?g=(c-a)/f+2:g=(a-b)/f+4,g*=60):h=g=0,ba(g,h,i)}function Z(a){var b=parseFloat(a);return a.charAt(a.length-1)==="%"?Math.round(b*2.55):b}function ba(a,b,c){return new bb(a,b,c)}function bb(a,b,c){this.h=a,this.s=b,this.l=c}function bc(a,b,c){function f(a){return a>360?a-=360:a<0&&(a+=360),a<60?d+(e-d)*a/60:a<180?e:a<240?d+(e-d)*(240-a)/60:d}function g(a){return Math.round(f(a)*255)}var d,e;return a%=360,a<0&&(a+=360),b=b<0?0:b>1?1:b,c=c<0?0:c>1?1:c,e=c<=.5?c*(1+b):c+b-c*b,d=2*c-e,U(g(a+120),g(a),g(a-120))}function bd(a){return h(a,bj),a}function bk(a){return function(){return be(a,this)}}function bl(a){return function(){return bf(a,this)}}function bn(a,b){function f(){if(b=this.classList)return b.add(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;c.lastIndex=0,c.test(e)||(e=n(e+" "+a),d?b.baseVal=e:this.className=e)}function g(){if(b=this.classList)return b.remove(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;e=n(e.replace(c," ")),d?b.baseVal=e:this.className=e}function h(){(b.apply(this,arguments)?f:g).call(this)}var c=new RegExp("(^|\\s+)"+d3.requote(a)+"(\\s+|$)","g");if(arguments.length<2){var d=this.node();if(e=d.classList)return e.contains(a);var e=d.className;return c.lastIndex=0,c.test(e.baseVal!=null?e.baseVal:e)}return this.each(typeof b=="function"?h:b?f:g)}function bo(a){return{__data__:a}}function bp(a){return function(){return bi(this,a)}}function bq(a){return arguments.length||(a=d3.ascending),function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function bs(a){return h(a,bt),a}function bu(a,b,c){h(a,by);var d={},e=d3.dispatch("start","end"),f=bB;return a.id=b,a.time=c,a.tween=function(b,c){return arguments.length<2?d[b]:(c==null?delete d[b]:d[b]=c,a)},a.ease=function(b){return arguments.length?(f=typeof b=="function"?b:d3.ease.apply(d3,arguments),a):f},a.each=function(b,c){return arguments.length<2?bC.call(a,b):(e.on(b,c),a)},d3.timer(function(g){return a.each(function(h,i,j){function p(a){if(o.active>b)return r();o.active=b;for(var f in d)(f=d[f].call(l,h,i))&&k.push(f);return e.start.call(l,h,i),q(a)||d3.timer(q,0,c),1}function q(a){if(o.active!==b)return r();var c=(a-m)/n,d=f(c),g=k.length;while(g>0)k[--g].call(l,d);if(c>=1)return r(),bA=b,e.end.call(l,h,i),bA=0,1}function r(){return--o.count||delete l.__transition__,1}var k=[],l=this,m=a[j][i].delay,n=a[j][i].duration,o=l.__transition__||(l.__transition__={active:0,count:0});++o.count,m<=g?p(g):d3.timer(p,m,c)}),1},0,c),a}function bw(a,b,c){return c!=""&&bv}function bx(a,b){function d(a,d,e){var f=b.call(this,a,d);return f==null?e!=""&&bv:e!=f&&c(e,f)}function e(a,d,e){return e!=b&&c(e,b)}var c=R(a);return typeof b=="function"?d:b==null?bw:(b+="",e)}function bC(a){for(var b=0,c=this.length;b<c;b++)for(var d=this[b],e=0,f=d.length;e<f;e++){var g=d[e];g&&a.call(g=g.node,g.__data__,e,b)}return this}function bG(){var a,b=Date.now(),c=bD;while(c)a=b-c.then,a>=c.delay&&(c.flush=c.callback(a)),c=c.next;var d=bH()-b;d>24?(isFinite(d)&&(clearTimeout(bF),bF=setTimeout(bG,d)),bE=0):(bE=1,bI(bG))}function bH(){var a=null,b=bD,c=Infinity;while(b)b.flush?b=a?a.next=b.next:bD=b.next:(c=Math.min(c,b.then+b.delay),b=(a=b).next);return c}function bJ(a){var b=[a.a,a.b],c=[a.c,a.d],d=bL(b),e=bK(b,c),f=bL(bM(c,b,-e))||0;b[0]*c[1]<c[0]*b[1]&&(b[0]*=-1,b[1]*=-1,d*=-1,e*=-1),this.rotate=(d?Math.atan2(b[1],b[0]):Math.atan2(-c[0],c[1]))*bN,this.translate=[a.e,a.f],this.scale=[d,f],this.skew=f?Math.atan2(e,f)*bN:0}function bK(a,b){return a[0]*b[0]+a[1]*b[1]}function bL(a){var b=Math.sqrt(bK(a,a));return b&&(a[0]/=b,a[1]/=b),b}function bM(a,b,c){return a[0]+=c*b[0],a[1]+=c*b[1],a}function bO(){}function bP(a){var b=a[0],c=a[a.length-1];return b<c?[b,c]:[c,b]}function bQ(a){return a.rangeExtent?a.rangeExtent():bP(a.range())}function bR(a,b){var c=0,d=a.length-1,e=a[c],f=a[d],g;f<e&&(g=c,c=d,d=g,g=e,e=f,f=g);if(g=f-e)b=b(g),a[c]=b.floor(e),a[d]=b.ceil(f);return a}function bS(){return Math}function bT(a,b,c,d){function g(){var g=a.length==2?bZ:b$,i=d?T:S;return e=g(a,b,i,c),f=g(b,a,i,d3.interpolate),h}function h(a){return e(a)}var e,f;return h.invert=function(a){return f(a)},h.domain=function(b){return arguments.length?(a=b.map(Number),g()):a},h.range=function(a){return arguments.length?(b=a,g()):b},h.rangeRound=function(a){return h.range(a).interpolate(d3.interpolateRound)},h.clamp=function(a){return arguments.length?(d=a,g()):d},h.interpolate=function(a){return arguments.length?(c=a,g()):c},h.ticks=function(b){return bX(a,b)},h.tickFormat=function(b){return bY(a,b)},h.nice=function(){return bR(a,bV),g()},h.copy=function(){return bT(a,b,c,d)},g()}function bU(a,b){return d3.rebind(a,b,"range","rangeRound","interpolate","clamp")}function bV(a){return a=Math.pow(10,Math.round(Math.log(a)/Math.LN10)-1),{floor:function(b){return Math.floor(b/a)*a},ceil:function(b){return Math.ceil(b/a)*a}}}function bW(a,b){var c=bP(a),d=c[1]-c[0],e=Math.pow(10,Math.floor(Math.log(d/b)/Math.LN10)),f=b/d*e;return f<=.15?e*=10:f<=.35?e*=5:f<=.75&&(e*=2),c[0]=Math.ceil(c[0]/e)*e,c[1]=Math.floor(c[1]/e)*e+e*.5,c[2]=e,c}function bX(a,b){return d3.range.apply(d3,bW(a,b))}function bY(a,b){return d3.format(",."+Math.max(0,-Math.floor(Math.log(bW(a,b)[2])/Math.LN10+.01))+"f")}function bZ(a,b,c,d){var e=c(a[0],a[1]),f=d(b[0],b[1]);return function(a){return f(e(a))}}function b$(a,b,c,d){var e=[],f=[],g=0,h=a.length-1;a[h]<a[0]&&(a=a.slice().reverse(),b=b.slice().reverse());while(++g<=h)e.push(c(a[g-1],a[g])),f.push(d(b[g-1],b[g]));return function(b){var c=d3.bisect(a,b,1,h)-1;return f[c](e[c](b))}}function b_(a,b){function d(c){return a(b(c))}var c=b.pow;return d.invert=function(b){return c(a.invert(b))},d.domain=function(e){return arguments.length?(b=e[0]<0?cc:cb,c=b.pow,a.domain(e.map(b)),d):a.domain().map(c)},d.nice=function(){return a.domain(bR(a.domain(),bS)),d},d.ticks=function(){var d=bP(a.domain()),e=[];if(d.every(isFinite)){var f=Math.floor(d[0]),g=Math.ceil(d[1]),h=c(d[0]),i=c(d[1]);if(b===cc){e.push(c(f));for(;f++<g;)for(var j=9;j>0;j--)e.push(c(f)*j)}else{for(;f<g;f++)for(var j=1;j<10;j++)e.push(c(f)*j);e.push(c(f))}for(f=0;e[f]<h;f++);for(g=e.length;e[g-1]>i;g--);e=e.slice(f,g)}return e},d.tickFormat=function(a,e){arguments.length<2&&(e=ca);if(arguments.length<1)return e;var f=a/d.ticks().length,g=b===cc?(h=-1e-12,Math.floor):(h=1e-12,Math.ceil),h;return function(a){return a/c(g(b(a)+h))<f?e(a):""}},d.copy=function(){return b_(a.copy(),b)},bU(d,a)}function cb(a){return Math.log(a<0?0:a)/Math.LN10}function cc(a){return-Math.log(a>0?0:-a)/Math.LN10}function cd(a,b){function e(b){return a(c(b))}var c=ce(b),d=ce(1/b);return e.invert=function(b){return d(a.invert(b))},e.domain=function(b){return arguments.length?(a.domain(b.map(c)),e):a.domain().map(d)},e.ticks=function(a){return bX(e.domain(),a)},e.tickFormat=function(a){return bY(e.domain(),a)},e.nice=function(){return e.domain(bR(e.domain(),bV))},e.exponent=function(a){if(!arguments.length)return b;var f=e.domain();return c=ce(b=a),d=ce(1/b),e.domain(f)},e.copy=function(){return cd(a.copy(),b)},bU(e,a)}function ce(a){return function(b){return b<0?-Math.pow(-b,a):Math.pow(b,a)}}function cf(a,b){function f(b){return d[((c[b]||(c[b]=a.push(b)))-1)%d.length]}function g(b,c){return d3.range(a.length).map(function(a){return b+c*a})}var c,d,e;return f.domain=function(d){if(!arguments.length)return a;a=[],c={};var e=-1,g=d.length,h;while(++e<g)c[h=d[e]]||(c[h]=a.push(h));return f[b.t](b.x,b.p)},f.range=function(a){return arguments.length?(d=a,e=0,b={t:"range",x:a},f):d},f.rangePoints=function(c,h){arguments.length<2&&(h=0);var i=c[0],j=c[1],k=(j-i)/(a.length-1+h);return d=g(a.length<2?(i+j)/2:i+k*h/2,k),e=0,b={t:"rangePoints",x:c,p:h},f},f.rangeBands=function(c,h){arguments.length<2&&(h=0);var i=c[0],j=c[1],k=(j-i)/(a.length+h);return d=g(i+k*h,k),e=k*(1-h),b={t:"rangeBands",x:c,p:h},f},f.rangeRoundBands=function(c,h){arguments.length<2&&(h=0);var i=c[0],j=c[1],k=Math.floor((j-i)/(a.length+h));return d=g(i+Math.round((j-i-(a.length-h)*k)/2),k),e=Math.round(k*(1-h)),b={t:"rangeRoundBands",x:c,p:h},f},f.rangeBand=function(){return e},f.rangeExtent=function(){return b.t==="range"?bP(b.x):b.x},f.copy=function(){return cf(a,b)},f.domain(a)}function ck(a,b){function d(){var d=0,f=a.length,g=b.length;c=[];while(++d<g)c[d-1]=d3.quantile(a,d/g);return e}function e(a){return isNaN(a=+a)?NaN:b[d3.bisect(c,a)]}var c;return e.domain=function(b){return arguments.length?(a=b.filter(function(a){return!isNaN(a)}).sort(d3.ascending),d()):a},e.range=function(a){return arguments.length?(b=a,d()):b},e.quantiles=function(){return c},e.copy=function(){return ck(a,b)},d()}function cl(a,b,c){function f(b){return c[Math.max(0,Math.min(e,Math.floor(d*(b-a))))]}function g(){return d=c.length/(b-a),e=c.length-1,f}var d,e;return f.domain=function(c){return arguments.length?(a=+c[0],b=+c[c.length-1],g()):[a,b]},f.range=function(a){return arguments.length?(c=a,g()):c},f.copy=function(){return cl(a,b,c)},g()}function co(a){return a.innerRadius}function cp(a){return a.outerRadius}function cq(a){return a.startAngle}function cr(a){return a.endAngle}function cs(a){function g(d){return d.length<1?null:"M"+e(a(ct(this,d,b,c)),f)}var b=cu,c=cv,d="linear",e=cw[d],f=.7;return g.x=function(a){return arguments.length?(b=a,g):b},g.y=function(a){return arguments.length?(c=a,g):c},g.interpolate=function(a){return arguments.length?(e=cw[d=a],g):d},g.tension=function(a){return arguments.length?(f=a,g):f},g}function ct(a,b,c,d){var e=[],f=-1,g=b.length,h=typeof c=="function",i=typeof d=="function",j;if(h&&i)while(++f<g)e.push([c.call(a,j=b[f],f),d.call(a,j,f)]);else if(h)while(++f<g)e.push([c.call(a,b[f],f),d]);else if(i)while(++f<g)e.push([c,d.call(a,b[f],f)]);else while(++f<g)e.push([c,d]);return e}function cu(a){return a[0]}function cv(a){return a[1]}function cx(a){var b=0,c=a.length,d=a[0],e=[d[0],",",d[1]];while(++b<c)e.push("L",(d=a[b])[0],",",d[1]);return e.join("")}function cy(a){var b=0,c=a.length,d=a[0],e=[d[0],",",d[1]];while(++b<c)e.push("V",(d=a[b])[1],"H",d[0]);return e.join("")}function cz(a){var b=0,c=a.length,d=a[0],e=[d[0],",",d[1]];while(++b<c)e.push("H",(d=a[b])[0],"V",d[1]);return e.join("")}function cA(a,b){return a.length<4?cx(a):a[1]+cD(a.slice(1,a.length-1),cE(a,b))}function cB(a,b){return a.length<3?cx(a):a[0]+cD((a.push(a[0]),a),cE([a[a.length-2]].concat(a,[a[1]]),b))}function cC(a,b,c){return a.length<3?cx(a):a[0]+cD(a,cE(a,b))}function cD(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return cx(a);var c=a.length!=b.length,d="",e=a[0],f=a[1],g=b[0],h=g,i=1;c&&(d+="Q"+(f[0]-g[0]*2/3)+","+(f[1]-g[1]*2/3)+","+f[0]+","+f[1],e=a[1],i=2);if(b.length>1){h=b[1],f=a[i],i++,d+="C"+(e[0]+g[0])+","+(e[1]+g[1])+","+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1];for(var j=2;j<b.length;j++,i++)f=a[i],h=b[j],d+="S"+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1]}if(c){var k=a[i];d+="Q"+(f[0]+h[0]*2/3)+","+(f[1]+h[1]*2/3)+","+k[0]+","+k[1]}return d}function cE(a,b){var c=[],d=(1-b)/2,e,f=a[0],g=a[1],h=1,i=a.length;while(++h<i)e=f,f=g,g=a[h],c.push([d*(g[0]-e[0]),d*(g[1]-e[1])]);return c}function cF(a){if(a.length<3)return cx(a);var b=1,c=a.length,d=a[0],e=d[0],f=d[1],g=[e,e,e,(d=a[1])[0]],h=[f,f,f,d[1]],i=[e,",",f];cN(i,g,h);while(++b<c)d=a[b],g.shift(),g.push(d[0]),h.shift(),h.push(d[1]),cN(i,g,h);b=-1;while(++b<2)g.shift(),g.push(d[0]),h.shift(),h.push(d[1]),cN(i,g,h);return i.join("")}function cG(a){if(a.length<4)return cx(a);var b=[],c=-1,d=a.length,e,f=[0],g=[0];while(++c<3)e=a[c],f.push(e[0]),g.push(e[1]);b.push(cJ(cM,f)+","+cJ(cM,g)),--c;while(++c<d)e=a[c],f.shift(),f.push(e[0]),g.shift(),g.push(e[1]),cN(b,f,g);return b.join("")}function cH(a){var b,c=-1,d=a.length,e=d+4,f,g=[],h=[];while(++c<4)f=a[c%d],g.push(f[0]),h.push(f[1]);b=[cJ(cM,g),",",cJ(cM,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),cN(b,g,h);return b.join("")}function cI(a,b){var c=a.length-1,d=a[0][0],e=a[0][1],f=a[c][0]-d,g=a[c][1]-e,h=-1,i,j;while(++h<=c)i=a[h],j=h/c,i[0]=b*i[0]+(1-b)*(d+j*f),i[1]=b*i[1]+(1-b)*(e+j*g);return cF(a)}function cJ(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function cN(a,b,c){a.push("C",cJ(cK,b),",",cJ(cK,c),",",cJ(cL,b),",",cJ(cL,c),",",cJ(cM,b),",",cJ(cM,c))}function cO(a,b){return(b[1]-a[1])/(b[0]-a[0])}function cP(a){var b=0,c=a.length-1,d=[],e=a[0],f=a[1],g=d[0]=cO(e,f);while(++b<c)d[b]=g+(g=cO(e=f,f=a[b+1]));return d[b]=g,d}function cQ(a){var b=[],c,d,e,f,g=cP(a),h=-1,i=a.length-1;while(++h<i)c=cO(a[h],a[h+1]),Math.abs(c)<1e-6?g[h]=g[h+1]=0:(d=g[h]/c,e=g[h+1]/c,f=d*d+e*e,f>9&&(f=c*3/Math.sqrt(f),g[h]=f*d,g[h+1]=f*e));h=-1;while(++h<=i)f=(a[Math.min(i,h+1)][0]-a[Math.max(0,h-1)][0])/(6*(1+g[h]*g[h])),b.push([f||0,g[h]*f||0]);return b}function cR(a){return a.length<3?cx(a):a[0]+cD(a,cQ(a))}function cS(a){var b,c=-1,d=a.length,e,f;while(++c<d)b=a[c],e=b[0],f=b[1]+cm,b[0]=e*Math.cos(f),b[1]=e*Math.sin(f);return a}function cT(a){function j(f){if(f.length<1)return null;var j=ct(this,f,b,d),k=ct(this,f,b===c?cU(j):c,d===e?cV(j):e);return"M"+g(a(k),i)+"L"+h(a(j.reverse()),i)+"Z"}var b=cu,c=cu,d=0,e=cv,f,g,h,i=.7;return j.x=function(a){return arguments.length?(b=c=a,j):c},j.x0=function(a){return arguments.length?(b=a,j):b},j.x1=function(a){return arguments.length?(c=a,j):c},j.y=function(a){return arguments.length?(d=e=a,j):e},j.y0=function(a){return arguments.length?(d=a,j):d},j.y1=function(a){return arguments.length?(e=a,j):e},j.interpolate=function(a){return arguments.length?(g=cw[f=a],h=g.reverse||g,j):f},j.tension=function(a){return arguments.length?(i=a,j):i},j.interpolate("linear")}function cU(a){return function(b,c){return a[c][0]}}function cV(a){return function(b,c){return a[c][1]}}function cW(a){return a.source}function cX(a){return a.target}function cY(a){return a.radius}function cZ(a){return a.startAngle}function c$(a){return a.endAngle}function c_(a){return[a.x,a.y]}function da(a){return function(){var b=a.apply(this,arguments),c=b[0],d=b[1]+cm;return[c*Math.cos(d),c*Math.sin(d)]}}function dc(a,b){var c=(a.ownerSVGElement||a).createSVGPoint();if(db<0&&(window.scrollX||window.scrollY)){var d=d3.select(document.body).append("svg").style("position","absolute").style("top",0).style("left",0),e=d[0][0].getScreenCTM();db=!e.f&&!e.e,d.remove()}return db?(c.x=b.pageX,c.y=b.pageY):(c.x=b.clientX,c.y=b.clientY),c=c.matrixTransform(a.getScreenCTM().inverse()),[c.x,c.y]}function dd(){return 64}function de(){return"circle"}function di(a,b){a.attr("transform",function(a){return"translate("+b(a)+",0)"})}function dj(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function dk(a,b,c){e=[];if(c&&b.length>1){var d=bP(a.domain()),e,f=-1,g=b.length,h=(b[1]-b[0])/++c,i,j;while(++f<g)for(i=c;--i>0;)(j=+b[f]-i*h)>=d[0]&&e.push(j);for(--f,i=0;++i<c&&(j=+b[f]+i*h)<d[1];)e.push(j)}return e}function dw(a,b){a.select(".extent").attr("x",b[0][0]),a.selectAll(".n,.s,.w,.nw,.sw").attr("x",b[0][0]-2),a.selectAll(".e,.ne,.se").attr("x",b[1][0]-3),a.selectAll(".extent,.n,.s").attr("width",b[1][0]-b[0][0])}function dx(a,b){a.select(".extent").attr("y",b[0][1]),a.selectAll(".n,.e,.w,.nw,.ne").attr("y",b[0][1]-3),a.selectAll(".s,.se,.sw").attr("y",b[1][1]-4),a.selectAll(".extent,.e,.w").attr("height",b[1][1]-b[0][1])}function dy(){d3.event.keyCode==32&&dn&&!ds&&(du=null,dv[0]-=dr[1][0],dv[1]-=dr[1][1],ds=2,P())}function dz(){d3.event.keyCode==32&&ds==2&&(dv[0]+=dr[1][0],dv[1]+=dr[1][1],ds=0,P())}function dA(){if(dv){var a=d3.svg.mouse(dn),b=d3.select(dn);ds||(d3.event.altKey?(du||(du=[(dr[0][0]+dr[1][0])/2,(dr[0][1]+dr[1][1])/2]),dv[0]=dr[+(a[0]<du[0])][0],dv[1]=dr[+(a[1]<du[1])][1]):du=null),dp&&(dB(a,dp,0),dw(b,dr)),dq&&(dB(a,dq,1),dx(b,dr)),dm("brush")}}function dB(a,b,c){var d=bQ(b),e=d[0],f=d[1],g=dv[c],h=dr[1][c]-dr[0][c],i,j;ds&&(e-=g,f-=h+g),i=Math.max(e,Math.min(f,a[c])),ds?j=(i+=g)+h:(du&&(g=Math.max(e,Math.min(f,2*du[c]-i))),g<i?(j=i,i=g):j=g),dr[0][c]=i,dr[1][c]=j}function dC(){dv&&(dA(),d3.select(dn).selectAll(".resize").style("pointer-events",dl.empty()?"none":"all"),dm("brushend"),dl=dm=dn=dp=dq=dr=ds=dt=du=dv=null,P())}function dL(a){var b=dM(),c=d3.event,d=d3.event={type:a};b&&(d.x=b[0]+dI[0],d.y=b[1]+dI[1],d.dx=b[0]-dJ[0],d.dy=b[1]-dJ[1],dK|=d.dx|d.dy,dJ=b);try{dE[a].apply(dG,dH)}finally{d3.event=c}c.stopPropagation(),c.preventDefault()}function dM(){var a=dG.parentNode,b=d3.event.changedTouches;return a&&(b?d3.svg.touches(a,b)[0]:d3.svg.mouse(a))}function dN(){if(!dG)return;var a=dG.parentNode;if(!a)return dO();dL("drag"),P()}function dO(){if(!dG)return;dL("dragend"),dK&&(P(),dK=d3.event.target===dF),dE=dF=dG=dH=dI=dJ=null}function dP(){dK&&(P(),dK=0)}function ea(a){return[a[0]-dV[0],a[1]-dV[1],dV[2]]}function eb(){dQ||(dQ=d3.select("body").append("div").style("visibility","hidden").style("top",0).style("height",0).style("width",0).style("overflow-y","scroll").append("div").style("height","2000px").node().parentNode);var a=d3.event,b;try{dQ.scrollTop=1e3,dQ.dispatchEvent(a),b=1e3-dQ.scrollTop}catch(c){b=a.wheelDelta||-a.detail*5}return b*.005}function ec(){var a=d3.svg.touches(dZ),b=-1,c=a.length,d;while(++b<c)dT[(d=a[b]).identifier]=ea(d);return a}function ed(){var a=d3.svg.touches(dZ);switch(a.length){case 1:var b=a[0];eh(dV[2],b,dT[b.identifier]);break;case 2:var c=a[0],d=a[1],e=[(c[0]+d[0])/2,(c[1]+d[1])/2],f=dT[c.identifier],g=dT[d.identifier],h=[(f[0]+g[0])/2,(f[1]+g[1])/2,f[2]];eh(Math.log(d3.event.scale)/Math.LN2+f[2],e,h)}}function ee(){dS=null,dR&&(d_=1,eh(dV[2],d3.svg.mouse(dZ),dR))}function ef(){dR&&(d_&&(P(),d_=dY===d3.event.target),dV=dW=dX=dY=dZ=d$=dR=null)}function eg(){d_&&(P(),d_=0)}function eh(a,b,c){function l(a,b,c){a.domain(a.range().map(function(f){return a.invert((f-c)*d/e+b)}))}a=ej(a,2);var d=Math.pow(2,dV[2]),e=Math.pow(2,a),f=Math.pow(2,(dV[2]=a)-c[2]),g=dV[0],h=dV[1],i=dV[0]=ej(b[0]-c[0]*f,0,e),j=dV[1]=ej(b[1]-c[1]*f,1,e),k=d3.event;d3.event={scale:e,translate:[i,j],transform:function(a,b){a&&l(a,g,i),b&&l(b,h,j)}};try{dX.apply(dZ,d$)}finally{d3.event=k}k.preventDefault()}function ej(a,b,c){var d=dW[b],e=d[0],f=d[1];return arguments.length===3?Math.max(f*(f===Infinity?-Infinity:1/c-1),Math.min(e===-Infinity?Infinity:e,a/c))*c:Math.max(e,Math.min(f,a))}Date.now||(Date.now=function(){return+(new Date)});try{document.createElement("div").style.setProperty("opacity",0,"")}catch(a){var b=CSSStyleDeclaration.prototype,c=b.setProperty;b.setProperty=function(a,b,d){c.call(this,a,b+"",d)}}d3={version:"2.7.4"};var d=f;try{d(document.documentElement.childNodes)[0].nodeType}catch(g){d=e}var h=[].__proto__?function(a,b){a.__proto__=b}:function(a,b){for(var c in b)a[c]=b[c]};d3.functor=function(a){return typeof a=="function"?a:function(){return a}},d3.rebind=function(a,b){var c=1,d=arguments.length,e;while(++c<d)a[e=arguments[c]]=j(a,b,b[e]);return a},d3.ascending=function(a,b){return a<b?-1:a>b?1:a>=b?0:NaN},d3.descending=function(a,b){return b<a?-1:b>a?1:b>=a?0:NaN},d3.mean=function(a,b){var c=a.length,d,e=0,f=-1,g=0;if(arguments.length===1)while(++f<c)k(d=a[f])&&(e+=(d-e)/++g);else while(++f<c)k(d=b.call(a,a[f],f))&&(e+=(d-e)/++g);return g?e:undefined},d3.median=function(a,b){return arguments.length>1&&(a=a.map(b)),a=a.filter(k),a.length?d3.quantile(a.sort(d3.ascending),.5):undefined},d3.min=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&e>f&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&e>f&&(e=f)}return e},d3.max=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&f>e&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&f>e&&(e=f)}return e},d3.extent=function(a,b){var c=-1,d=a.length,e,f,g;if(arguments.length===1){while(++c<d&&((e=g=a[c])==null||e!=e))e=g=undefined;while(++c<d)(f=a[c])!=null&&(e>f&&(e=f),g<f&&(g=f))}else{while(++c<d&&((e=g=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&(e>f&&(e=f),g<f&&(g=f))}return[e,g]},d3.random={normal:function(a,b){return arguments.length<2&&(b=1),arguments.length<1&&(a=0),function(){var c,d,e;do c=Math.random()*2-1,d=Math.random()*2-1,e=c*c+d*d;while(!e||e>1);return a+b*c*Math.sqrt(-2*Math.log(e)/e)}}},d3.sum=function(a,b){var c=0,d=a.length,e,f=-1;if(arguments.length===1)while(++f<d)isNaN(e=+a[f])||(c+=e);else while(++f<d)isNaN(e=+b.call(a,a[f],f))||(c+=e);return c},d3.quantile=function(a,b){var c=(a.length-1)*b+1,d=Math.floor(c),e=a[d-1],f=c-d;return f?e+f*(a[d]-e):e},d3.transpose=function(a){return d3.zip.apply(d3,a)},d3.zip=function(){if(!(e=arguments.length))return[];for(var a=-1,b=d3.min(arguments,l),c=new Array(b);++a<b;)for(var d=-1,e,f=c[a]=new Array(e);++d<e;)f[d]=arguments[d][a];return c},d3.bisectLeft=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;a[e]<b?c=e+1:d=e}return c},d3.bisect=d3.bisectRight=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;b<a[e]?d=e:c=e+1}return c},d3.first=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])>0&&(e=f);return e},d3.last=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])<=0&&(e=f);return e},d3.nest=function(){function f(c,g){if(g>=b.length)return e?e.call(a,c):d?c.sort(d):c;var h=-1,i=c.length,j=b[g++],k,l,m={};while(++h<i)(k=j(l=c[h]))in m?m[k].push(l):m[k]=[l];for(k in m)m[k]=f(m[k],g);return m}function g(a,d){if(d>=b.length)return a;var e=[],f=c[d++],h;for(h in a)e.push({key:h,values:g(a[h],d)});return f&&e.sort(function(a,b){return f(a.key,b.key)}),e}var a={},b=[],c=[],d,e;return a.map=function(a){return f(a,0)},a.entries=function(a){return g(f(a,0),0)},a.key=function(c){return b.push(c),a},a.sortKeys=function(d){return c[b.length-1]=d,a},a.sortValues=function(b){return d=b,a},a.rollup=function(b){return e=b,a},a},d3.keys=function(a){var b=[];for(var c in a)b.push(c);return b},d3.values=function(a){var b=[];for(var c in a)b.push(a[c]);return b},d3.entries=function(a){var b=[];for(var c in a)b.push({key:c,value:a[c]});return b},d3.permute=function(a,b){var c=[],d=-1,e=b.length;while(++d<e)c[d]=a[b[d]];return c},d3.merge=function(a){return Array.prototype.concat.apply([],a)},d3.split=function(a,b){var c=[],d=[],e,f=-1,g=a.length;arguments.length<2&&(b=m);while(++f<g)b.call(d,e=a[f],f)?d=[]:(d.length||c.push(d),d.push(e));return c},d3.range=function(a,b,c){arguments.length<3&&(c=1,arguments.length<2&&(b=a,a=0));if((b-a)/c==Infinity)throw new Error("infinite range");var d=[],e=o(a,b),f=-1,g;if(c<0)while((g=(e*a+e*c*++f)/e)>b)d.push(g);else while((g=(e*a+e*c*++f)/e)<b)d.push(g);return d},d3.requote=function(a){return a.replace(p,"\\$&")};var p=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;d3.round=function(a,b){return b?Math.round(a*(b=Math.pow(10,b)))/b:Math.round(a)},d3.xhr=function(a,b,c){var d=new XMLHttpRequest;arguments.length<3?(c=b,b=null):b&&d.overrideMimeType&&d.overrideMimeType(b),d.open("GET",a,!0),b&&d.setRequestHeader("Accept",b),d.onreadystatechange=function(){d.readyState===4&&c(d.status<300?d:null)},d.send(null)},d3.text=function(a,b,c){function d(a){c(a&&a.responseText)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.json=function(a,b){d3.text(a,"application/json",function(a){b(a?JSON.parse(a):null)})},d3.html=function(a,b){d3.text(a,"text/html",function(a){if(a!=null){var c=document.createRange();c.selectNode(document.body),a=c.createContextualFragment(a)}b(a)})},d3.xml=function(a,b,c){function d(a){c(a&&a.responseXML)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)};var q={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};d3.ns={prefix:q,qualify:function(a){var b=a.indexOf(":");return b<0?a in q?{space:q[a],local:a}:a:{space:q[a.substring(0,b)],local:a.substring(b+1)}}},d3.dispatch=function(){var a=new r,b=-1,c=arguments.length;while(++b<c)a[arguments[b]]=s(a);return a},r.prototype.on=function(a,b){var c=a.indexOf("."),d="";return c>0&&(d=a.substring(c+1),a=a.substring(0,c)),arguments.length<2?this[a].on(d):this[a].on(d,b)},d3.format=function(a){var b=t.exec(a),c=b[1]||" ",d=b[3]||"",e=b[5],f=+b[6],g=b[7],h=b[8],i=b[9],j=1,k="",l=!1;h&&(h=+h.substring(1)),e&&(c="0",g&&(f-=Math.floor((f-1)/4)));switch(i){case"n":g=!0,i="g";break;case"%":j=100,k="%",i="f";break;case"p":j=100,k="%",i="r";break;case"d":l=!0,h=0;break;case"s":j=-1,i="r"}return i=="r"&&!h&&(i="g"),i=u[i]||w,function(a){if(l&&a%1)return"";var b=a<0&&(a=-a)?"−":d;if(j<0){var m=d3.formatPrefix(a,h);a*=m.scale,k=m.symbol}else a*=j;a=i(a,h);if(e){var n=a.length+b.length;n<f&&(a=(new Array(f-n+1)).join(c)+a),g&&(a=x(a)),a=b+a}else{g&&(a=x(a)),a=b+a;var n=a.length;n<f&&(a=(new Array(f-n+1)).join(c)+a)}return a+k}};var t=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,u={g:function(a,b){return a.toPrecision(b)},e:function(a,b){return a.toExponential(b)},f:function(a,b){return a.toFixed(b)},r:function(a,b){return d3.round(a,b=v(a,b)).toFixed(Math.max(0,Math.min(20,b)))}},y=["y","z","a","f","p","n","μ","m","","k","M","G","T","P","E","Z","Y"].map(z);d3.formatPrefix=function(a,b){var c=0;return a&&(a<0&&(a*=-1),b&&(a=d3.round(a,v(a,b))),c=1+Math.floor(1e-12+Math.log(a)/Math.LN10),c=Math.max(-24,Math.min(24,Math.floor((c<=0?c+1:c-1)/3)*3))),y[8+c/3]};var A=I(2),B=I(3),C={linear:function(){return H},poly:I,quad:function(){return A},cubic:function(){return B},sin:function(){return J},exp:function(){return K},circle:function(){return L},elastic:M,back:N,bounce:function(){return O}},D={"in":function(a){return a},out:F,"in-out":G,"out-in":function(a){return G(F(a))}};d3.ease=function(a){var b=a.indexOf("-"),c=b>=0?a.substring(0,b):a,d=b>=0?a.substring(b+1):"in";return E(D[d](C[c].apply(null,Array.prototype.slice.call(arguments,1))))},d3.event=null,d3.interpolate=function(a,b){var c=d3.interpolators.length,d;while(--c>=0&&!(d=d3.interpolators[c](a,b)));return d},d3.interpolateNumber=function(a,b){return b-=a,function(c){return a+b*c}},d3.interpolateRound=function(a,b){return b-=a,function(c){return Math.round(a+b*c)}},d3.interpolateString=function(a,b){var c,d,e,f=0,g=0,h=[],i=[],j,k;Q.lastIndex=0;for(d=0;c=Q.exec(b);++d)c.index&&h.push(b.substring(f,g=c.index)),i.push({i:h.length,x:c[0]}),h.push(null),f=Q.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=Q.exec(a))&&d<j;++d){k=i[d];if(k.x==c[0]){if(k.i)if(h[k.i+1]==null){h[k.i-1]+=k.x,h.splice(k.i,1);for(e=d+1;e<j;++e)i[e].i--}else{h[k.i-1]+=k.x+h[k.i+1],h.splice(k.i,2);for(e=d+1;e<j;++e)i[e].i-=2}else if(h[k.i+1]==null)h[k.i]=k.x;else{h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1);for(e=d+1;e<j;++e)i[e].i--}i.splice(d,1),j--,d--}else k.x=d3.interpolateNumber(parseFloat(c[0]),parseFloat(k.x))}while(d<j)k=i.pop(),h[k.i+1]==null?h[k.i]=k.x:(h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1)),j--;return h.length===1?h[0]==null?i[0].x:function(){return b}:function(a){for(d=0;d<j;++d)h[(k=i[d]).i]=k.x(a);return h.join("")}},d3.interpolateTransform=function(a,b){var c=[],d=[],e,f=d3.transform(a),g=d3.transform(b),h=f.translate,i=g.translate,j=f.rotate,k=g.rotate,l=f.skew,m=g.skew,n=f.scale,o=g.scale;return h[0]!=i[0]||h[1]!=i[1]?(c.push("translate(",null,",",null,")"),d.push({i:1,x:d3.interpolateNumber(h[0],i[0])},{i:3,x:d3.interpolateNumber(h[1],i[1])})):i[0]||i[1]?c.push("translate("+i+")"):c.push(""),j!=k?d.push({i:c.push(c.pop()+"rotate(",null,")")-2,x:d3.interpolateNumber(j,k)}):k&&c.push(c.pop()+"rotate("+k+")"),l!=m?d.push({i:c.push(c.pop()+"skewX(",null,")")-2,x:d3.interpolateNumber(l,m)}):m&&c.push(c.pop()+"skewX("+m+")"),n[0]!=o[0]||n[1]!=o[1]?(e=c.push(c.pop()+"scale(",null,",",null,")"),d.push({i:e-4,x:d3.interpolateNumber(n[0],o[0])},{i:e-2,x:d3.interpolateNumber(n[1],o[1])})):(o[0]!=1||o[1]!=1)&&c.push(c.pop()+"scale("+o+")"),e=d.length,function(a){var b=-1,f;while(++b<e)c[(f=d[b]).i]=f.x(a);return c.join("")}},d3.interpolateRgb=function(a,b){a=d3.rgb(a),b=d3.rgb(b);var c=a.r,d=a.g,e=a.b,f=b.r-c,g=b.g-d,h=b.b-e;return function(a){return"#"+W(Math.round(c+f*a))+W(Math.round(d+g*a))+W(Math.round(e+h*a))}},d3.interpolateHsl=function(a,b){a=d3.hsl(a),b=d3.hsl(b);var c=a.h,d=a.s,e=a.l,f=b.h-c,g=b.s-d,h=b.l-e;return function(a){return bc(c+f*a,d+g*a,e+h*a).toString()}},d3.interpolateArray=function(a,b){var c=[],d=[],e=a.length,f=b.length,g=Math.min(a.length,b.length),h;for(h=0;h<g;++h)c.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)d[h]=a[h];for(;h<f;++h)d[h]=b[h];return function(a){for(h=0;h<g;++h)d[h]=c[h](a);return d}},d3.interpolateObject=function(a,b){var c={},d={},e;for(e in a)e in b?c[e]=R(e)(a[e],b[e]):d[e]=a[e];for(e in b)e in a||(d[e]=b[e]);return function(a){for(e in c)d[e]=c[e](a);return d}};var Q=/[-+]?(?:\d*\.?\d+)(?:[eE][-+]?\d+)?/g;d3.interpolators=[d3.interpolateObject,function(a,b){return b instanceof Array&&d3.interpolateArray(a,b)},function(a,b){return(typeof a=="string"||typeof b=="string")&&d3.interpolateString(a+"",b+"")},function(a,b){return(typeof b=="string"?b in $||/^(#|rgb\(|hsl\()/.test(b):b instanceof V||b instanceof bb)&&d3.interpolateRgb(a,b)},function(a,b){return!isNaN(a=+a)&&!isNaN(b=+b)&&d3.interpolateNumber(a,b)}],d3.rgb=function(a,b,c){return arguments.length===1?a instanceof V?U(a.r,a.g,a.b):X(""+a,U,bc):U(~~a,~~b,~~c)},V.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);var b=this.r,c=this.g,d=this.b,e=30;return!b&&!c&&!d?U(e,e,e):(b&&b<e&&(b=e),c&&c<e&&(c=e),d&&d<e&&(d=e),U(Math.min <add>(function(){function e(a){var b=-1,c=a.length,d=[];while(++b<c)d.push(a[b]);return d}function f(a){return Array.prototype.slice.call(a)}function i(){return this}function j(a,b,c){return function(){var d=c.apply(b,arguments);return arguments.length?a:d}}function k(a){return a!=null&&!isNaN(a)}function l(a){return a.length}function m(a){return a==null}function n(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function o(a,b){var c=a<b?a:b,d=1;if(isNaN(+c))return c;while((d*=10)*c%1!==0);return d}function r(){}function s(a){function d(){var c=b,d=-1,e=c.length,f;while(++d<e)(f=c[d].on)&&f.apply(this,arguments);return a}var b=[],c={};return d.on=function(d,e){var f,g;if(arguments.length<2)return(f=c[d])&&f.on;if(f=c[d])f.on=null,b=b.slice(0,g=b.indexOf(f)).concat(b.slice(g+1)),delete c[d];return e&&b.push(c[d]={on:e}),a},d}function v(a,b){return b-(a?1+Math.floor(Math.log(a+Math.pow(10,1+Math.floor(Math.log(a)/Math.LN10)-b))/Math.LN10):1)}function w(a){return a+""}function x(a){var b=a.lastIndexOf("."),c=b>=0?a.substring(b):(b=a.length,""),d=[];while(b>0)d.push(a.substring(b-=3,b+3));return d.reverse().join(",")+c}function z(a,b){return{scale:Math.pow(10,(8-b)*3),symbol:a}}function E(a){return function(b){return b<=0?0:b>=1?1:a(b)}}function F(a){return function(b){return 1-a(1-b)}}function G(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function H(a){return a}function I(a){return function(b){return Math.pow(b,a)}}function J(a){return 1-Math.cos(a*Math.PI/2)}function K(a){return Math.pow(2,10*(a-1))}function L(a){return 1-Math.sqrt(1-a*a)}function M(a,b){var c;return arguments.length<2&&(b=.45),arguments.length<1?(a=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/a),function(d){return 1+a*Math.pow(2,10*-d)*Math.sin((d-c)*2*Math.PI/b)}}function N(a){return a||(a=1.70158),function(b){return b*b*((a+1)*b-a)}}function O(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}function P(){d3.event.stopPropagation(),d3.event.preventDefault()}function R(a){return a=="transform"?d3.interpolateTransform:d3.interpolate}function S(a,b){return b=b-(a=+a)?1/(b-a):0,function(c){return(c-a)*b}}function T(a,b){return b=b-(a=+a)?1/(b-a):0,function(c){return Math.max(0,Math.min(1,(c-a)*b))}}function U(a,b,c){return new V(a,b,c)}function V(a,b,c){this.r=a,this.g=b,this.b=c}function W(a){return a<16?"0"+Math.max(0,a).toString(16):Math.min(255,a).toString(16)}function X(a,b,c){var d=0,e=0,f=0,g,h,i;g=/([a-z]+)\((.*)\)/i.exec(a);if(g){h=g[2].split(",");switch(g[1]){case"hsl":return c(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case"rgb":return b(Z(h[0]),Z(h[1]),Z(h[2]))}}return(i=$[a])?b(i.r,i.g,i.b):(a!=null&&a.charAt(0)==="#"&&(a.length===4?(d=a.charAt(1),d+=d,e=a.charAt(2),e+=e,f=a.charAt(3),f+=f):a.length===7&&(d=a.substring(1,3),e=a.substring(3,5),f=a.substring(5,7)),d=parseInt(d,16),e=parseInt(e,16),f=parseInt(f,16)),b(d,e,f))}function Y(a,b,c){var d=Math.min(a/=255,b/=255,c/=255),e=Math.max(a,b,c),f=e-d,g,h,i=(e+d)/2;return f?(h=i<.5?f/(e+d):f/(2-e-d),a==e?g=(b-c)/f+(b<c?6:0):b==e?g=(c-a)/f+2:g=(a-b)/f+4,g*=60):h=g=0,ba(g,h,i)}function Z(a){var b=parseFloat(a);return a.charAt(a.length-1)==="%"?Math.round(b*2.55):b}function ba(a,b,c){return new bb(a,b,c)}function bb(a,b,c){this.h=a,this.s=b,this.l=c}function bc(a,b,c){function f(a){return a>360?a-=360:a<0&&(a+=360),a<60?d+(e-d)*a/60:a<180?e:a<240?d+(e-d)*(240-a)/60:d}function g(a){return Math.round(f(a)*255)}var d,e;return a%=360,a<0&&(a+=360),b=b<0?0:b>1?1:b,c=c<0?0:c>1?1:c,e=c<=.5?c*(1+b):c+b-c*b,d=2*c-e,U(g(a+120),g(a),g(a-120))}function bd(a){return h(a,bj),a}function bk(a){return function(){return be(a,this)}}function bl(a){return function(){return bf(a,this)}}function bn(a,b){function f(){if(b=this.classList)return b.add(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;c.lastIndex=0,c.test(e)||(e=n(e+" "+a),d?b.baseVal=e:this.className=e)}function g(){if(b=this.classList)return b.remove(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;e=n(e.replace(c," ")),d?b.baseVal=e:this.className=e}function h(){(b.apply(this,arguments)?f:g).call(this)}var c=new RegExp("(^|\\s+)"+d3.requote(a)+"(\\s+|$)","g");if(arguments.length<2){var d=this.node();if(e=d.classList)return e.contains(a);var e=d.className;return c.lastIndex=0,c.test(e.baseVal!=null?e.baseVal:e)}return this.each(typeof b=="function"?h:b?f:g)}function bo(a){return{__data__:a}}function bp(a){return function(){return bi(this,a)}}function bq(a){return arguments.length||(a=d3.ascending),function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function bs(a){return h(a,bt),a}function bu(a,b,c){h(a,by);var d={},e=d3.dispatch("start","end"),f=bB;return a.id=b,a.time=c,a.tween=function(b,c){return arguments.length<2?d[b]:(c==null?delete d[b]:d[b]=c,a)},a.ease=function(b){return arguments.length?(f=typeof b=="function"?b:d3.ease.apply(d3,arguments),a):f},a.each=function(b,c){return arguments.length<2?bC.call(a,b):(e.on(b,c),a)},d3.timer(function(g){return a.each(function(h,i,j){function p(a){if(o.active>b)return r();o.active=b;for(var f in d)(f=d[f].call(l,h,i))&&k.push(f);return e.start.call(l,h,i),q(a)||d3.timer(q,0,c),1}function q(a){if(o.active!==b)return r();var c=(a-m)/n,d=f(c),g=k.length;while(g>0)k[--g].call(l,d);if(c>=1)return r(),bA=b,e.end.call(l,h,i),bA=0,1}function r(){return--o.count||delete l.__transition__,1}var k=[],l=this,m=a[j][i].delay,n=a[j][i].duration,o=l.__transition__||(l.__transition__={active:0,count:0});++o.count,m<=g?p(g):d3.timer(p,m,c)}),1},0,c),a}function bw(a,b,c){return c!=""&&bv}function bx(a,b){function d(a,d,e){var f=b.call(this,a,d);return f==null?e!=""&&bv:e!=f&&c(e,f)}function e(a,d,e){return e!=b&&c(e,b)}var c=R(a);return typeof b=="function"?d:b==null?bw:(b+="",e)}function bC(a){for(var b=0,c=this.length;b<c;b++)for(var d=this[b],e=0,f=d.length;e<f;e++){var g=d[e];g&&a.call(g=g.node,g.__data__,e,b)}return this}function bG(){var a,b=Date.now(),c=bD;while(c)a=b-c.then,a>=c.delay&&(c.flush=c.callback(a)),c=c.next;var d=bH()-b;d>24?(isFinite(d)&&(clearTimeout(bF),bF=setTimeout(bG,d)),bE=0):(bE=1,bI(bG))}function bH(){var a=null,b=bD,c=Infinity;while(b)b.flush?b=a?a.next=b.next:bD=b.next:(c=Math.min(c,b.then+b.delay),b=(a=b).next);return c}function bJ(a){var b=[a.a,a.b],c=[a.c,a.d],d=bL(b),e=bK(b,c),f=bL(bM(c,b,-e))||0;b[0]*c[1]<c[0]*b[1]&&(b[0]*=-1,b[1]*=-1,d*=-1,e*=-1),this.rotate=(d?Math.atan2(b[1],b[0]):Math.atan2(-c[0],c[1]))*bN,this.translate=[a.e,a.f],this.scale=[d,f],this.skew=f?Math.atan2(e,f)*bN:0}function bK(a,b){return a[0]*b[0]+a[1]*b[1]}function bL(a){var b=Math.sqrt(bK(a,a));return b&&(a[0]/=b,a[1]/=b),b}function bM(a,b,c){return a[0]+=c*b[0],a[1]+=c*b[1],a}function bO(){}function bP(a){var b=a[0],c=a[a.length-1];return b<c?[b,c]:[c,b]}function bQ(a){return a.rangeExtent?a.rangeExtent():bP(a.range())}function bR(a,b){var c=0,d=a.length-1,e=a[c],f=a[d],g;f<e&&(g=c,c=d,d=g,g=e,e=f,f=g);if(g=f-e)b=b(g),a[c]=b.floor(e),a[d]=b.ceil(f);return a}function bS(){return Math}function bT(a,b,c,d){function g(){var g=a.length==2?bZ:b$,i=d?T:S;return e=g(a,b,i,c),f=g(b,a,i,d3.interpolate),h}function h(a){return e(a)}var e,f;return h.invert=function(a){return f(a)},h.domain=function(b){return arguments.length?(a=b.map(Number),g()):a},h.range=function(a){return arguments.length?(b=a,g()):b},h.rangeRound=function(a){return h.range(a).interpolate(d3.interpolateRound)},h.clamp=function(a){return arguments.length?(d=a,g()):d},h.interpolate=function(a){return arguments.length?(c=a,g()):c},h.ticks=function(b){return bX(a,b)},h.tickFormat=function(b){return bY(a,b)},h.nice=function(){return bR(a,bV),g()},h.copy=function(){return bT(a,b,c,d)},g()}function bU(a,b){return d3.rebind(a,b,"range","rangeRound","interpolate","clamp")}function bV(a){return a=Math.pow(10,Math.round(Math.log(a)/Math.LN10)-1),{floor:function(b){return Math.floor(b/a)*a},ceil:function(b){return Math.ceil(b/a)*a}}}function bW(a,b){var c=bP(a),d=c[1]-c[0],e=Math.pow(10,Math.floor(Math.log(d/b)/Math.LN10)),f=b/d*e;return f<=.15?e*=10:f<=.35?e*=5:f<=.75&&(e*=2),c[0]=Math.ceil(c[0]/e)*e,c[1]=Math.floor(c[1]/e)*e+e*.5,c[2]=e,c}function bX(a,b){return d3.range.apply(d3,bW(a,b))}function bY(a,b){return d3.format(",."+Math.max(0,-Math.floor(Math.log(bW(a,b)[2])/Math.LN10+.01))+"f")}function bZ(a,b,c,d){var e=c(a[0],a[1]),f=d(b[0],b[1]);return function(a){return f(e(a))}}function b$(a,b,c,d){var e=[],f=[],g=0,h=a.length-1;a[h]<a[0]&&(a=a.slice().reverse(),b=b.slice().reverse());while(++g<=h)e.push(c(a[g-1],a[g])),f.push(d(b[g-1],b[g]));return function(b){var c=d3.bisect(a,b,1,h)-1;return f[c](e[c](b))}}function b_(a,b){function d(c){return a(b(c))}var c=b.pow;return d.invert=function(b){return c(a.invert(b))},d.domain=function(e){return arguments.length?(b=e[0]<0?cc:cb,c=b.pow,a.domain(e.map(b)),d):a.domain().map(c)},d.nice=function(){return a.domain(bR(a.domain(),bS)),d},d.ticks=function(){var d=bP(a.domain()),e=[];if(d.every(isFinite)){var f=Math.floor(d[0]),g=Math.ceil(d[1]),h=c(d[0]),i=c(d[1]);if(b===cc){e.push(c(f));for(;f++<g;)for(var j=9;j>0;j--)e.push(c(f)*j)}else{for(;f<g;f++)for(var j=1;j<10;j++)e.push(c(f)*j);e.push(c(f))}for(f=0;e[f]<h;f++);for(g=e.length;e[g-1]>i;g--);e=e.slice(f,g)}return e},d.tickFormat=function(a,e){arguments.length<2&&(e=ca);if(arguments.length<1)return e;var f=a/d.ticks().length,g=b===cc?(h=-1e-12,Math.floor):(h=1e-12,Math.ceil),h;return function(a){return a/c(g(b(a)+h))<f?e(a):""}},d.copy=function(){return b_(a.copy(),b)},bU(d,a)}function cb(a){return Math.log(a<0?0:a)/Math.LN10}function cc(a){return-Math.log(a>0?0:-a)/Math.LN10}function cd(a,b){function e(b){return a(c(b))}var c=ce(b),d=ce(1/b);return e.invert=function(b){return d(a.invert(b))},e.domain=function(b){return arguments.length?(a.domain(b.map(c)),e):a.domain().map(d)},e.ticks=function(a){return bX(e.domain(),a)},e.tickFormat=function(a){return bY(e.domain(),a)},e.nice=function(){return e.domain(bR(e.domain(),bV))},e.exponent=function(a){if(!arguments.length)return b;var f=e.domain();return c=ce(b=a),d=ce(1/b),e.domain(f)},e.copy=function(){return cd(a.copy(),b)},bU(e,a)}function ce(a){return function(b){return b<0?-Math.pow(-b,a):Math.pow(b,a)}}function cf(a,b){function f(b){return d[((c[b]||(c[b]=a.push(b)))-1)%d.length]}function g(b,c){return d3.range(a.length).map(function(a){return b+c*a})}var c,d,e;return f.domain=function(d){if(!arguments.length)return a;a=[],c={};var e=-1,g=d.length,h;while(++e<g)c[h=d[e]]||(c[h]=a.push(h));return f[b.t](b.x,b.p)},f.range=function(a){return arguments.length?(d=a,e=0,b={t:"range",x:a},f):d},f.rangePoints=function(c,h){arguments.length<2&&(h=0);var i=c[0],j=c[1],k=(j-i)/(a.length-1+h);return d=g(a.length<2?(i+j)/2:i+k*h/2,k),e=0,b={t:"rangePoints",x:c,p:h},f},f.rangeBands=function(c,h){arguments.length<2&&(h=0);var i=c[0],j=c[1],k=(j-i)/(a.length+h);return d=g(i+k*h,k),e=k*(1-h),b={t:"rangeBands",x:c,p:h},f},f.rangeRoundBands=function(c,h){arguments.length<2&&(h=0);var i=c[0],j=c[1],k=Math.floor((j-i)/(a.length+h));return d=g(i+Math.round((j-i-(a.length-h)*k)/2),k),e=Math.round(k*(1-h)),b={t:"rangeRoundBands",x:c,p:h},f},f.rangeBand=function(){return e},f.rangeExtent=function(){return b.t==="range"?bP(b.x):b.x},f.copy=function(){return cf(a,b)},f.domain(a)}function ck(a,b){function d(){var d=0,f=a.length,g=b.length;c=[];while(++d<g)c[d-1]=d3.quantile(a,d/g);return e}function e(a){return isNaN(a=+a)?NaN:b[d3.bisect(c,a)]}var c;return e.domain=function(b){return arguments.length?(a=b.filter(function(a){return!isNaN(a)}).sort(d3.ascending),d()):a},e.range=function(a){return arguments.length?(b=a,d()):b},e.quantiles=function(){return c},e.copy=function(){return ck(a,b)},d()}function cl(a,b,c){function f(b){return c[Math.max(0,Math.min(e,Math.floor(d*(b-a))))]}function g(){return d=c.length/(b-a),e=c.length-1,f}var d,e;return f.domain=function(c){return arguments.length?(a=+c[0],b=+c[c.length-1],g()):[a,b]},f.range=function(a){return arguments.length?(c=a,g()):c},f.copy=function(){return cl(a,b,c)},g()}function co(a){return a.innerRadius}function cp(a){return a.outerRadius}function cq(a){return a.startAngle}function cr(a){return a.endAngle}function cs(a){function g(d){return d.length<1?null:"M"+e(a(ct(this,d,b,c)),f)}var b=cu,c=cv,d="linear",e=cw[d],f=.7;return g.x=function(a){return arguments.length?(b=a,g):b},g.y=function(a){return arguments.length?(c=a,g):c},g.interpolate=function(a){return arguments.length?(e=cw[d=a],g):d},g.tension=function(a){return arguments.length?(f=a,g):f},g}function ct(a,b,c,d){var e=[],f=-1,g=b.length,h=typeof c=="function",i=typeof d=="function",j;if(h&&i)while(++f<g)e.push([c.call(a,j=b[f],f),d.call(a,j,f)]);else if(h)while(++f<g)e.push([c.call(a,b[f],f),d]);else if(i)while(++f<g)e.push([c,d.call(a,b[f],f)]);else while(++f<g)e.push([c,d]);return e}function cu(a){return a[0]}function cv(a){return a[1]}function cx(a){var b=0,c=a.length,d=a[0],e=[d[0],",",d[1]];while(++b<c)e.push("L",(d=a[b])[0],",",d[1]);return e.join("")}function cy(a){var b=0,c=a.length,d=a[0],e=[d[0],",",d[1]];while(++b<c)e.push("V",(d=a[b])[1],"H",d[0]);return e.join("")}function cz(a){var b=0,c=a.length,d=a[0],e=[d[0],",",d[1]];while(++b<c)e.push("H",(d=a[b])[0],"V",d[1]);return e.join("")}function cA(a,b){return a.length<4?cx(a):a[1]+cD(a.slice(1,a.length-1),cE(a,b))}function cB(a,b){return a.length<3?cx(a):a[0]+cD((a.push(a[0]),a),cE([a[a.length-2]].concat(a,[a[1]]),b))}function cC(a,b,c){return a.length<3?cx(a):a[0]+cD(a,cE(a,b))}function cD(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return cx(a);var c=a.length!=b.length,d="",e=a[0],f=a[1],g=b[0],h=g,i=1;c&&(d+="Q"+(f[0]-g[0]*2/3)+","+(f[1]-g[1]*2/3)+","+f[0]+","+f[1],e=a[1],i=2);if(b.length>1){h=b[1],f=a[i],i++,d+="C"+(e[0]+g[0])+","+(e[1]+g[1])+","+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1];for(var j=2;j<b.length;j++,i++)f=a[i],h=b[j],d+="S"+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1]}if(c){var k=a[i];d+="Q"+(f[0]+h[0]*2/3)+","+(f[1]+h[1]*2/3)+","+k[0]+","+k[1]}return d}function cE(a,b){var c=[],d=(1-b)/2,e,f=a[0],g=a[1],h=1,i=a.length;while(++h<i)e=f,f=g,g=a[h],c.push([d*(g[0]-e[0]),d*(g[1]-e[1])]);return c}function cF(a){if(a.length<3)return cx(a);var b=1,c=a.length,d=a[0],e=d[0],f=d[1],g=[e,e,e,(d=a[1])[0]],h=[f,f,f,d[1]],i=[e,",",f];cN(i,g,h);while(++b<c)d=a[b],g.shift(),g.push(d[0]),h.shift(),h.push(d[1]),cN(i,g,h);b=-1;while(++b<2)g.shift(),g.push(d[0]),h.shift(),h.push(d[1]),cN(i,g,h);return i.join("")}function cG(a){if(a.length<4)return cx(a);var b=[],c=-1,d=a.length,e,f=[0],g=[0];while(++c<3)e=a[c],f.push(e[0]),g.push(e[1]);b.push(cJ(cM,f)+","+cJ(cM,g)),--c;while(++c<d)e=a[c],f.shift(),f.push(e[0]),g.shift(),g.push(e[1]),cN(b,f,g);return b.join("")}function cH(a){var b,c=-1,d=a.length,e=d+4,f,g=[],h=[];while(++c<4)f=a[c%d],g.push(f[0]),h.push(f[1]);b=[cJ(cM,g),",",cJ(cM,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),cN(b,g,h);return b.join("")}function cI(a,b){var c=a.length-1,d=a[0][0],e=a[0][1],f=a[c][0]-d,g=a[c][1]-e,h=-1,i,j;while(++h<=c)i=a[h],j=h/c,i[0]=b*i[0]+(1-b)*(d+j*f),i[1]=b*i[1]+(1-b)*(e+j*g);return cF(a)}function cJ(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function cN(a,b,c){a.push("C",cJ(cK,b),",",cJ(cK,c),",",cJ(cL,b),",",cJ(cL,c),",",cJ(cM,b),",",cJ(cM,c))}function cO(a,b){return(b[1]-a[1])/(b[0]-a[0])}function cP(a){var b=0,c=a.length-1,d=[],e=a[0],f=a[1],g=d[0]=cO(e,f);while(++b<c)d[b]=g+(g=cO(e=f,f=a[b+1]));return d[b]=g,d}function cQ(a){var b=[],c,d,e,f,g=cP(a),h=-1,i=a.length-1;while(++h<i)c=cO(a[h],a[h+1]),Math.abs(c)<1e-6?g[h]=g[h+1]=0:(d=g[h]/c,e=g[h+1]/c,f=d*d+e*e,f>9&&(f=c*3/Math.sqrt(f),g[h]=f*d,g[h+1]=f*e));h=-1;while(++h<=i)f=(a[Math.min(i,h+1)][0]-a[Math.max(0,h-1)][0])/(6*(1+g[h]*g[h])),b.push([f||0,g[h]*f||0]);return b}function cR(a){return a.length<3?cx(a):a[0]+cD(a,cQ(a))}function cS(a){var b,c=-1,d=a.length,e,f;while(++c<d)b=a[c],e=b[0],f=b[1]+cm,b[0]=e*Math.cos(f),b[1]=e*Math.sin(f);return a}function cT(a){function j(f){if(f.length<1)return null;var j=ct(this,f,b,d),k=ct(this,f,b===c?cU(j):c,d===e?cV(j):e);return"M"+g(a(k),i)+"L"+h(a(j.reverse()),i)+"Z"}var b=cu,c=cu,d=0,e=cv,f,g,h,i=.7;return j.x=function(a){return arguments.length?(b=c=a,j):c},j.x0=function(a){return arguments.length?(b=a,j):b},j.x1=function(a){return arguments.length?(c=a,j):c},j.y=function(a){return arguments.length?(d=e=a,j):e},j.y0=function(a){return arguments.length?(d=a,j):d},j.y1=function(a){return arguments.length?(e=a,j):e},j.interpolate=function(a){return arguments.length?(g=cw[f=a],h=g.reverse||g,j):f},j.tension=function(a){return arguments.length?(i=a,j):i},j.interpolate("linear")}function cU(a){return function(b,c){return a[c][0]}}function cV(a){return function(b,c){return a[c][1]}}function cW(a){return a.source}function cX(a){return a.target}function cY(a){return a.radius}function cZ(a){return a.startAngle}function c$(a){return a.endAngle}function c_(a){return[a.x,a.y]}function da(a){return function(){var b=a.apply(this,arguments),c=b[0],d=b[1]+cm;return[c*Math.cos(d),c*Math.sin(d)]}}function dc(a,b){var c=(a.ownerSVGElement||a).createSVGPoint();if(db<0&&(window.scrollX||window.scrollY)){var d=d3.select(document.body).append("svg").style("position","absolute").style("top",0).style("left",0),e=d[0][0].getScreenCTM();db=!e.f&&!e.e,d.remove()}return db?(c.x=b.pageX,c.y=b.pageY):(c.x=b.clientX,c.y=b.clientY),c=c.matrixTransform(a.getScreenCTM().inverse()),[c.x,c.y]}function dd(){return 64}function de(){return"circle"}function di(a,b){a.attr("transform",function(a){return"translate("+b(a)+",0)"})}function dj(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function dk(a,b,c){e=[];if(c&&b.length>1){var d=bP(a.domain()),e,f=-1,g=b.length,h=(b[1]-b[0])/++c,i,j;while(++f<g)for(i=c;--i>0;)(j=+b[f]-i*h)>=d[0]&&e.push(j);for(--f,i=0;++i<c&&(j=+b[f]+i*h)<d[1];)e.push(j)}return e}function dw(a,b){a.select(".extent").attr("x",b[0][0]),a.selectAll(".n,.s,.w,.nw,.sw").attr("x",b[0][0]-2),a.selectAll(".e,.ne,.se").attr("x",b[1][0]-3),a.selectAll(".extent,.n,.s").attr("width",b[1][0]-b[0][0])}function dx(a,b){a.select(".extent").attr("y",b[0][1]),a.selectAll(".n,.e,.w,.nw,.ne").attr("y",b[0][1]-3),a.selectAll(".s,.se,.sw").attr("y",b[1][1]-4),a.selectAll(".extent,.e,.w").attr("height",b[1][1]-b[0][1])}function dy(){d3.event.keyCode==32&&dn&&!ds&&(du=null,dv[0]-=dr[1][0],dv[1]-=dr[1][1],ds=2,P())}function dz(){d3.event.keyCode==32&&ds==2&&(dv[0]+=dr[1][0],dv[1]+=dr[1][1],ds=0,P())}function dA(){if(dv){var a=d3.svg.mouse(dn),b=d3.select(dn);ds||(d3.event.altKey?(du||(du=[(dr[0][0]+dr[1][0])/2,(dr[0][1]+dr[1][1])/2]),dv[0]=dr[+(a[0]<du[0])][0],dv[1]=dr[+(a[1]<du[1])][1]):du=null),dp&&(dB(a,dp,0),dw(b,dr)),dq&&(dB(a,dq,1),dx(b,dr)),dm("brush")}}function dB(a,b,c){var d=bQ(b),e=d[0],f=d[1],g=dv[c],h=dr[1][c]-dr[0][c],i,j;ds&&(e-=g,f-=h+g),i=Math.max(e,Math.min(f,a[c])),ds?j=(i+=g)+h:(du&&(g=Math.max(e,Math.min(f,2*du[c]-i))),g<i?(j=i,i=g):j=g),dr[0][c]=i,dr[1][c]=j}function dC(){dv&&(dA(),d3.select(dn).selectAll(".resize").style("pointer-events",dl.empty()?"none":"all"),dm("brushend"),dl=dm=dn=dp=dq=dr=ds=dt=du=dv=null,P())}function dL(a){var b=dM(),c=d3.event,d=d3.event={type:a};b&&(d.x=b[0]+dI[0],d.y=b[1]+dI[1],d.dx=b[0]-dJ[0],d.dy=b[1]-dJ[1],dK|=d.dx|d.dy,dJ=b);try{dE[a].apply(dG,dH)}finally{d3.event=c}c.stopPropagation(),c.preventDefault()}function dM(){var a=dG.parentNode,b=d3.event.changedTouches;return a&&(b?d3.svg.touches(a,b)[0]:d3.svg.mouse(a))}function dN(){if(!dG)return;var a=dG.parentNode;if(!a)return dO();dL("drag"),P()}function dO(){if(!dG)return;dL("dragend"),dK&&(P(),dK=d3.event.target===dF),dE=dF=dG=dH=dI=dJ=null}function dP(){dK&&(P(),dK=0)}function ea(a){return[a[0]-dV[0],a[1]-dV[1],dV[2]]}function eb(){dQ||(dQ=d3.select("body").append("div").style("visibility","hidden").style("top",0).style("height",0).style("width",0).style("overflow-y","scroll").append("div").style("height","2000px").node().parentNode);var a=d3.event,b;try{dQ.scrollTop=1e3,dQ.dispatchEvent(a),b=1e3-dQ.scrollTop}catch(c){b=a.wheelDelta||-a.detail*5}return b*.005}function ec(){var a=d3.svg.touches(dZ),b=-1,c=a.length,d;while(++b<c)dT[(d=a[b]).identifier]=ea(d);return a}function ed(){var a=d3.svg.touches(dZ);switch(a.length){case 1:var b=a[0];eh(dV[2],b,dT[b.identifier]);break;case 2:var c=a[0],d=a[1],e=[(c[0]+d[0])/2,(c[1]+d[1])/2],f=dT[c.identifier],g=dT[d.identifier],h=[(f[0]+g[0])/2,(f[1]+g[1])/2,f[2]];eh(Math.log(d3.event.scale)/Math.LN2+f[2],e,h)}}function ee(){dS=null,dR&&(d_=1,eh(dV[2],d3.svg.mouse(dZ),dR))}function ef(){dR&&(d_&&(P(),d_=dY===d3.event.target),dV=dW=dX=dY=dZ=d$=dR=null)}function eg(){d_&&(P(),d_=0)}function eh(a,b,c){function l(a,b,c){a.domain(a.range().map(function(f){return a.invert((f-c)*d/e+b)}))}a=ej(a,2);var d=Math.pow(2,dV[2]),e=Math.pow(2,a),f=Math.pow(2,(dV[2]=a)-c[2]),g=dV[0],h=dV[1],i=dV[0]=ej(b[0]-c[0]*f,0,e),j=dV[1]=ej(b[1]-c[1]*f,1,e),k=d3.event;d3.event={scale:e,translate:[i,j],transform:function(a,b){a&&l(a,g,i),b&&l(b,h,j)}};try{dX.apply(dZ,d$)}finally{d3.event=k}k.preventDefault()}function ej(a,b,c){var d=dW[b],e=d[0],f=d[1];return arguments.length===3?Math.max(f*(f===Infinity?-Infinity:1/c-1),Math.min(e===-Infinity?Infinity:e,a/c))*c:Math.max(e,Math.min(f,a))}Date.now||(Date.now=function(){return+(new Date)});try{document.createElement("div").style.setProperty("opacity",0,"")}catch(a){var b=CSSStyleDeclaration.prototype,c=b.setProperty;b.setProperty=function(a,b,d){c.call(this,a,b+"",d)}}d3={version:"2.7.4"};var d=f;try{d(document.documentElement.childNodes)[0].nodeType}catch(g){d=e}var h=[].__proto__?function(a,b){a.__proto__=b}:function(a,b){for(var c in b)a[c]=b[c]};d3.functor=function(a){return typeof a=="function"?a:function(){return a}},d3.rebind=function(a,b){var c=1,d=arguments.length,e;while(++c<d)a[e=arguments[c]]=j(a,b,b[e]);return a},d3.ascending=function(a,b){return a<b?-1:a>b?1:a>=b?0:NaN},d3.descending=function(a,b){return b<a?-1:b>a?1:b>=a?0:NaN},d3.mean=function(a,b){var c=a.length,d,e=0,f=-1,g=0;if(arguments.length===1)while(++f<c)k(d=a[f])&&(e+=(d-e)/++g);else while(++f<c)k(d=b.call(a,a[f],f))&&(e+=(d-e)/++g);return g?e:undefined},d3.median=function(a,b){return arguments.length>1&&(a=a.map(b)),a=a.filter(k),a.length?d3.quantile(a.sort(d3.ascending),.5):undefined},d3.min=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&e>f&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&e>f&&(e=f)}return e},d3.max=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&f>e&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&f>e&&(e=f)}return e},d3.extent=function(a,b){var c=-1,d=a.length,e,f,g;if(arguments.length===1){while(++c<d&&((e=g=a[c])==null||e!=e))e=g=undefined;while(++c<d)(f=a[c])!=null&&(e>f&&(e=f),g<f&&(g=f))}else{while(++c<d&&((e=g=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&(e>f&&(e=f),g<f&&(g=f))}return[e,g]},d3.random={normal:function(a,b){return arguments.length<2&&(b=1),arguments.length<1&&(a=0),function(){var c,d,e;do c=Math.random()*2-1,d=Math.random()*2-1,e=c*c+d*d;while(!e||e>1);return a+b*c*Math.sqrt(-2*Math.log(e)/e)}}},d3.sum=function(a,b){var c=0,d=a.length,e,f=-1;if(arguments.length===1)while(++f<d)isNaN(e=+a[f])||(c+=e);else while(++f<d)isNaN(e=+b.call(a,a[f],f))||(c+=e);return c},d3.quantile=function(a,b){var c=(a.length-1)*b+1,d=Math.floor(c),e=a[d-1],f=c-d;return f?e+f*(a[d]-e):e},d3.transpose=function(a){return d3.zip.apply(d3,a)},d3.zip=function(){if(!(e=arguments.length))return[];for(var a=-1,b=d3.min(arguments,l),c=new Array(b);++a<b;)for(var d=-1,e,f=c[a]=new Array(e);++d<e;)f[d]=arguments[d][a];return c},d3.bisectLeft=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;a[e]<b?c=e+1:d=e}return c},d3.bisect=d3.bisectRight=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;b<a[e]?d=e:c=e+1}return c},d3.first=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])>0&&(e=f);return e},d3.last=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])<=0&&(e=f);return e},d3.nest=function(){function f(c,g){if(g>=b.length)return e?e.call(a,c):d?c.sort(d):c;var h=-1,i=c.length,j=b[g++],k,l,m={};while(++h<i)(k=j(l=c[h]))in m?m[k].push(l):m[k]=[l];for(k in m)m[k]=f(m[k],g);return m}function g(a,d){if(d>=b.length)return a;var e=[],f=c[d++],h;for(h in a)e.push({key:h,values:g(a[h],d)});return f&&e.sort(function(a,b){return f(a.key,b.key)}),e}var a={},b=[],c=[],d,e;return a.map=function(a){return f(a,0)},a.entries=function(a){return g(f(a,0),0)},a.key=function(c){return b.push(c),a},a.sortKeys=function(d){return c[b.length-1]=d,a},a.sortValues=function(b){return d=b,a},a.rollup=function(b){return e=b,a},a},d3.keys=function(a){var b=[];for(var c in a)b.push(c);return b},d3.values=function(a){var b=[];for(var c in a)b.push(a[c]);return b},d3.entries=function(a){var b=[];for(var c in a)b.push({key:c,value:a[c]});return b},d3.permute=function(a,b){var c=[],d=-1,e=b.length;while(++d<e)c[d]=a[b[d]];return c},d3.merge=function(a){return Array.prototype.concat.apply([],a)},d3.split=function(a,b){var c=[],d=[],e,f=-1,g=a.length;arguments.length<2&&(b=m);while(++f<g)b.call(d,e=a[f],f)?d=[]:(d.length||c.push(d),d.push(e));return c},d3.range=function(a,b,c){arguments.length<3&&(c=1,arguments.length<2&&(b=a,a=0));if((b-a)/c==Infinity)throw new Error("infinite range");var d=[],e=o(a,b),f=-1,g;if(c<0)while((g=(e*a+e*c*++f)/e)>b)d.push(g);else while((g=(e*a+e*c*++f)/e)<b)d.push(g);return d},d3.requote=function(a){return a.replace(p,"\\$&")};var p=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;d3.round=function(a,b){return b?Math.round(a*(b=Math.pow(10,b)))/b:Math.round(a)},d3.xhr=function(a,b,c){var d=new XMLHttpRequest;arguments.length<3?(c=b,b=null):b&&d.overrideMimeType&&d.overrideMimeType(b),d.open("GET",a,!0),b&&d.setRequestHeader("Accept",b),d.onreadystatechange=function(){d.readyState===4&&c(d.status<300?d:null)},d.send(null)},d3.text=function(a,b,c){function d(a){c(a&&a.responseText)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.json=function(a,b){d3.text(a,"application/json",function(a){b(a?JSON.parse(a):null)})},d3.html=function(a,b){d3.text(a,"text/html",function(a){if(a!=null){var c=document.createRange();c.selectNode(document.body),a=c.createContextualFragment(a)}b(a)})},d3.xml=function(a,b,c){function d(a){c(a&&a.responseXML)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)};var q={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};d3.ns={prefix:q,qualify:function(a){var b=a.indexOf(":");return b<0?a in q?{space:q[a],local:a}:a:{space:q[a.substring(0,b)],local:a.substring(b+1)}}},d3.dispatch=function(){var a=new r,b=-1,c=arguments.length;while(++b<c)a[arguments[b]]=s(a);return a},r.prototype.on=function(a,b){var c=a.indexOf("."),d="";return c>0&&(d=a.substring(c+1),a=a.substring(0,c)),arguments.length<2?this[a].on(d):this[a].on(d,b)},d3.format=function(a){var b=t.exec(a),c=b[1]||" ",d=b[3]||"",e=b[5],f=+b[6],g=b[7],h=b[8],i=b[9],j=1,k="",l=!1;h&&(h=+h.substring(1)),e&&(c="0",g&&(f-=Math.floor((f-1)/4)));switch(i){case"n":g=!0,i="g";break;case"%":j=100,k="%",i="f";break;case"p":j=100,k="%",i="r";break;case"d":l=!0,h=0;break;case"s":j=-1,i="r"}return i=="r"&&!h&&(i="g"),i=u[i]||w,function(a){if(l&&a%1)return"";var b=a<0&&(a=-a)?"−":d;if(j<0){var m=d3.formatPrefix(a,h);a*=m.scale,k=m.symbol}else a*=j;a=i(a,h);if(e){var n=a.length+b.length;n<f&&(a=(new Array(f-n+1)).join(c)+a),g&&(a=x(a)),a=b+a}else{g&&(a=x(a)),a=b+a;var n=a.length;n<f&&(a=(new Array(f-n+1)).join(c)+a)}return a+k}};var t=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,u={g:function(a,b){return a.toPrecision(b)},e:function(a,b){return a.toExponential(b)},f:function(a,b){return a.toFixed(b)},r:function(a,b){return d3.round(a,b=v(a,b)).toFixed(Math.max(0,Math.min(20,b)))}},y=["y","z","a","f","p","n","μ","m","","k","M","G","T","P","E","Z","Y"].map(z);d3.formatPrefix=function(a,b){var c=0;return a&&(a<0&&(a*=-1),b&&(a=d3.round(a,v(a,b))),c=1+Math.floor(1e-12+Math.log(a)/Math.LN10),c=Math.max(-24,Math.min(24,Math.floor((c<=0?c+1:c-1)/3)*3))),y[8+c/3]};var A=I(2),B=I(3),C={linear:function(){return H},poly:I,quad:function(){return A},cubic:function(){return B},sin:function(){return J},exp:function(){return K},circle:function(){return L},elastic:M,back:N,bounce:function(){return O}},D={"in":function(a){return a},out:F,"in-out":G,"out-in":function(a){return G(F(a))}};d3.ease=function(a){var b=a.indexOf("-"),c=b>=0?a.substring(0,b):a,d=b>=0?a.substring(b+1):"in";return E(D[d](C[c].apply(null,Array.prototype.slice.call(arguments,1))))},d3.event=null,d3.interpolate=function(a,b){var c=d3.interpolators.length,d;while(--c>=0&&!(d=d3.interpolators[c](a,b)));return d},d3.interpolateNumber=function(a,b){return b-=a,function(c){return a+b*c}},d3.interpolateRound=function(a,b){return b-=a,function(c){return Math.round(a+b*c)}},d3.interpolateString=function(a,b){var c,d,e,f=0,g=0,h=[],i=[],j,k;Q.lastIndex=0;for(d=0;c=Q.exec(b);++d)c.index&&h.push(b.substring(f,g=c.index)),i.push({i:h.length,x:c[0]}),h.push(null),f=Q.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=Q.exec(a))&&d<j;++d){k=i[d];if(k.x==c[0]){if(k.i)if(h[k.i+1]==null){h[k.i-1]+=k.x,h.splice(k.i,1);for(e=d+1;e<j;++e)i[e].i--}else{h[k.i-1]+=k.x+h[k.i+1],h.splice(k.i,2);for(e=d+1;e<j;++e)i[e].i-=2}else if(h[k.i+1]==null)h[k.i]=k.x;else{h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1);for(e=d+1;e<j;++e)i[e].i--}i.splice(d,1),j--,d--}else k.x=d3.interpolateNumber(parseFloat(c[0]),parseFloat(k.x))}while(d<j)k=i.pop(),h[k.i+1]==null?h[k.i]=k.x:(h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1)),j--;return h.length===1?h[0]==null?i[0].x:function(){return b}:function(a){for(d=0;d<j;++d)h[(k=i[d]).i]=k.x(a);return h.join("")}},d3.interpolateTransform=function(a,b){var c=[],d=[],e,f=d3.transform(a),g=d3.transform(b),h=f.translate,i=g.translate,j=f.rotate,k=g.rotate,l=f.skew,m=g.skew,n=f.scale,o=g.scale;return h[0]!=i[0]||h[1]!=i[1]?(c.push("translate(",null,",",null,")"),d.push({i:1,x:d3.interpolateNumber(h[0],i[0])},{i:3,x:d3.interpolateNumber(h[1],i[1])})):i[0]||i[1]?c.push("translate("+i+")"):c.push(""),j!=k?d.push({i:c.push(c.pop()+"rotate(",null,")")-2,x:d3.interpolateNumber(j,k)}):k&&c.push(c.pop()+"rotate("+k+")"),l!=m?d.push({i:c.push(c.pop()+"skewX(",null,")")-2,x:d3.interpolateNumber(l,m)}):m&&c.push(c.pop()+"skewX("+m+")"),n[0]!=o[0]||n[1]!=o[1]?(e=c.push(c.pop()+"scale(",null,",",null,")"),d.push({i:e-4,x:d3.interpolateNumber(n[0],o[0])},{i:e-2,x:d3.interpolateNumber(n[1],o[1])})):(o[0]!=1||o[1]!=1)&&c.push(c.pop()+"scale("+o+")"),e=d.length,function(a){var b=-1,f;while(++b<e)c[(f=d[b]).i]=f.x(a);return c.join("")}},d3.interpolateRgb=function(a,b){a=d3.rgb(a),b=d3.rgb(b);var c=a.r,d=a.g,e=a.b,f=b.r-c,g=b.g-d,h=b.b-e;return function(a){return"#"+W(Math.round(c+f*a))+W(Math.round(d+g*a))+W(Math.round(e+h*a))}},d3.interpolateHsl=function(a,b){a=d3.hsl(a),b=d3.hsl(b);var c=a.h,d=a.s,e=a.l,f=b.h-c,g=b.s-d,h=b.l-e;return function(a){return bc(c+f*a,d+g*a,e+h*a).toString()}},d3.interpolateArray=function(a,b){var c=[],d=[],e=a.length,f=b.length,g=Math.min(a.length,b.length),h;for(h=0;h<g;++h)c.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)d[h]=a[h];for(;h<f;++h)d[h]=b[h];return function(a){for(h=0;h<g;++h)d[h]=c[h](a);return d}},d3.interpolateObject=function(a,b){var c={},d={},e;for(e in a)e in b?c[e]=R(e)(a[e],b[e]):d[e]=a[e];for(e in b)e in a||(d[e]=b[e]);return function(a){for(e in c)d[e]=c[e](a);return d}};var Q=/[-+]?(?:\d*\.?\d+)(?:[eE][-+]?\d+)?/g;d3.interpolators=[d3.interpolateObject,function(a,b){return b instanceof Array&&d3.interpolateArray(a,b)},function(a,b){return(typeof a=="string"||typeof b=="string")&&d3.interpolateString(a+"",b+"")},function(a,b){return(typeof b=="string"?b in $||/^(#|rgb\(|hsl\()/.test(b):b instanceof V||b instanceof bb)&&d3.interpolateRgb(a,b)},function(a,b){return!isNaN(a=+a)&&!isNaN(b=+b)&&d3.interpolateNumber(a,b)}],d3.rgb=function(a,b,c){return arguments.length===1?a instanceof V?U(a.r,a.g,a.b):X(""+a,U,bc):U(~~a,~~b,~~c)},V.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);var b=this.r,c=this.g,d=this.b,e=30;return!b&&!c&&!d?U(e,e,e):(b&&b<e&&(b=e),c&&c<e&&(c=e),d&&d<e&&(d=e),U(Math.min <ide> (255,Math.floor(b/a)),Math.min(255,Math.floor(c/a)),Math.min(255,Math.floor(d/a))))},V.prototype.darker=function(a){return a=Math.pow(.7,arguments.length?a:1),U(Math.floor(a*this.r),Math.floor(a*this.g),Math.floor(a*this.b))},V.prototype.hsl=function(){return Y(this.r,this.g,this.b)},V.prototype.toString=function(){return"#"+W(this.r)+W(this.g)+W(this.b)};var $={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};for(var _ in $)$[_]=X($[_],U,bc);d3.hsl=function(a,b,c){return arguments.length===1?a instanceof bb?ba(a.h,a.s,a.l):X(""+a,Y,ba):ba(+a,+b,+c)},bb.prototype.brighter=function(a){return a=Math.pow(.7,arguments.length?a:1),ba(this.h,this.s,this.l/a)},bb.prototype.darker=function(a){return a=Math.pow(.7,arguments.length?a:1),ba(this.h,this.s,a*this.l)},bb.prototype.rgb=function(){return bc(this.h,this.s,this.l)},bb.prototype.toString=function(){return this.rgb().toString()};var be=function(a,b){return b.querySelector(a)},bf=function(a,b){return b.querySelectorAll(a)},bg=document.documentElement,bh=bg.matchesSelector||bg.webkitMatchesSelector||bg.mozMatchesSelector||bg.msMatchesSelector||bg.oMatchesSelector,bi=function(a,b){return bh.call(a,b)};typeof Sizzle=="function"&&(be=function(a,b){return Sizzle(a,b)[0]},bf=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))},bi=Sizzle.matchesSelector);var bj=[];d3.selection=function(){return br},d3.selection.prototype=bj,bj.select=function(a){var b=[],c,d,e,f;typeof a!="function"&&(a=bk(a));for(var g=-1,h=this.length;++g<h;){b.push(c=[]),c.parentNode=(e=this[g]).parentNode;for(var i=-1,j=e.length;++i<j;)(f=e[i])?(c.push(d=a.call(f,f.__data__,i)),d&&"__data__"in f&&(d.__data__=f.__data__)):c.push(null)}return bd(b)},bj.selectAll=function(a){var b=[],c,e;typeof a!="function"&&(a=bl(a));for(var f=-1,g=this.length;++f<g;)for(var h=this[f],i=-1,j=h.length;++i<j;)if(e=h[i])b.push(c=d(a.call(e,e.__data__,i))),c.parentNode=e;return bd(b)},bj.attr=function(a,b){function d(){this.removeAttribute(a)}function e(){this.removeAttributeNS(a.space,a.local)}function f(){this.setAttribute(a,b)}function g(){this.setAttributeNS(a.space,a.local,b)}function h(){var c=b.apply(this,arguments);c==null?this.removeAttribute(a):this.setAttribute(a,c)}function i(){var c=b.apply(this,arguments);c==null?this.removeAttributeNS(a.space,a.local):this.setAttributeNS(a.space,a.local,c)}a=d3.ns.qualify(a);if(arguments.length<2){var c=this.node();return a.local?c.getAttributeNS(a.space,a.local):c.getAttribute(a)}return this.each(b==null?a.local?e:d:typeof b=="function"?a.local?i:h:a.local?g:f)},bj.classed=function(a,b){var c=a.split(bm),d=c.length,e=-1;if(arguments.length>1){while(++e<d)bn.call(this,c[e],b);return this}while(++e<d)if(!bn.call(this,c[e]))return!1;return!0};var bm=/\s+/g;bj.style=function(a,b,c){function d(){this.style.removeProperty(a)}function e(){this.style.setProperty(a,b,c)}function f(){var d=b.apply(this,arguments);d==null?this.style.removeProperty(a):this.style.setProperty(a,d,c)}return arguments.length<3&&(c=""),arguments.length<2?window.getComputedStyle(this.node(),null).getPropertyValue(a):this.each(b==null?d:typeof b=="function"?f:e)},bj.property=function(a,b){function c(){delete this[a]}function d(){this[a]=b}function e(){var c=b.apply(this,arguments);c==null?delete this[a]:this[a]=c}return arguments.length<2?this.node()[a]:this.each(b==null?c:typeof b=="function"?e:d)},bj.text=function(a){return arguments.length<1?this.node().textContent:this.each(typeof a=="function"?function(){var b=a.apply(this,arguments);this.textContent=b==null?"":b}:a==null?function(){this.textContent=""}:function(){this.textContent=a})},bj.html=function(a){return arguments.length<1?this.node().innerHTML:this.each(typeof a=="function"?function(){var b=a.apply(this,arguments);this.innerHTML=b==null?"":b}:a==null?function(){this.innerHTML=""}:function(){this.innerHTML=a})},bj.append=function(a){function b(){return this.appendChild(document.createElementNS(this.namespaceURI,a))}function c(){return this.appendChild(document.createElementNS(a.space,a.local))}return a=d3.ns.qualify(a),this.select(a.local?c:b)},bj.insert=function(a,b){function c(){return this.insertBefore(document.createElementNS(this.namespaceURI,a),be(b,this))}function d(){return this.insertBefore(document.createElementNS(a.space,a.local),be(b,this))}return a=d3.ns.qualify(a),this.select(a.local?d:c)},bj.remove=function(){return this.each(function(){var a=this.parentNode;a&&a.removeChild(this)})},bj.data=function(a,b){function f(a,f){var g,h=a.length,i=f.length,j=Math.min(h,i),k=Math.max(h,i),l=[],m=[],n=[],o,p;if(b){var q={},r=[],s,t=f.length;for(g=-1;++g<h;)s=b.call(o=a[g],o.__data__,g),s in q?n[t++]=o:q[s]=o,r.push(s);for(g=-1;++g<i;)o=q[s=b.call(f,p=f[g],g)],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=bo(p),l[g]=n[g]=null),delete q[s];for(g=-1;++g<h;)r[g]in q&&(n[g]=a[g])}else{for(g=-1;++g<j;)o=a[g],p=f[g],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=bo(p),l[g]=n[g]=null);for(;g<i;++g)m[g]=bo(f[g]),l[g]=n[g]=null;for(;g<k;++g)n[g]=a[g],m[g]=l[g]=null}m.update=l,m.parentNode=l.parentNode=n.parentNode=a.parentNode,c.push(m),d.push(l),e.push(n)}var c=[],d=[],e=[],g=-1,h=this.length,i;if(typeof a=="function")while(++g<h)f(i=this[g],a.call(i,i.parentNode.__data__,g));else while(++g<h)f(i=this[g],a);var j=bd(d);return j.enter=function(){return bs(c)},j.exit=function(){return bd(e)},j},bj.filter=function(a){var b=[],c,d,e;typeof a!="function"&&(a=bp(a));for(var f=0,g=this.length;f<g;f++){b.push(c=[]),c.parentNode=(d=this[f]).parentNode;for(var h=0,i=d.length;h<i;h++)(e=d[h])&&a.call(e,e.__data__,h)&&c.push(e)}return bd(b)},bj.map=function(a){return this.each(function(){this.__data__=a.apply(this,arguments)})},bj.order=function(){for(var a=-1,b=this.length;++a<b;)for(var c=this[a],d=c.length-1,e=c[d],f;--d>=0;)if(f=c[d])e&&e!==f.nextSibling&&e.parentNode.insertBefore(f,e),e=f;return this},bj.sort=function(a){a=bq.apply(this,arguments);for(var b=-1,c=this.length;++b<c;)this[b].sort(a);return this.order()},bj.on=function(a,b,c){arguments.length<3&&(c=!1);var d="__on"+a,e=a.indexOf(".");return e>0&&(a=a.substring(0,e)),arguments.length<2?(e=this.node()[d])&&e._:this.each(function(e,f){function h(a){var c=d3.event;d3.event=a;try{b.call(g,g.__data__,f)}finally{d3.event=c}}var g=this;g[d]&&g.removeEventListener(a,g[d],c),b&&g.addEventListener(a,g[d]=h,c),h._=b})},bj.each=function(a){for(var b=-1,c=this.length;++b<c;)for(var d=this[b],e=-1,f=d.length;++e<f;){var g=d[e];g&&a.call(g,g.__data__,e,b)}return this},bj.call=function(a){return a.apply(this,(arguments[0]=this,arguments)),this},bj.empty=function(){return!this.node()},bj.node=function(a){for(var b=0,c=this.length;b<c;b++)for(var d=this[b],e=0,f=d.length;e<f;e++){var g=d[e];if(g)return g}return null},bj.transition=function(){var a=[],b,c;for(var d=-1,e=this.length;++d<e;){a.push(b=[]);for(var f=this[d],g=-1,h=f.length;++g<h;)b.push((c=f[g])?{node:c,delay:0,duration:250}:null)}return bu(a,bA||++bz,Date.now())};var br=bd([[document]]);br[0].parentNode=bg,d3.select=function(a){return typeof a=="string"?br.select(a):bd([[a]])},d3.selectAll=function(a){return typeof a=="string"?br.selectAll(a):bd([d(a)])};var bt=[];bt.append=bj.append,bt.insert=bj.insert,bt.empty=bj.empty,bt.node=bj.node,bt.select=function(a){var b=[],c,d,e,f,g;for(var h=-1,i=this.length;++h<i;){e=(f=this[h]).update,b.push(c=[]),c.parentNode=f.parentNode;for(var j=-1,k=f.length;++j<k;)(g=f[j])?(c.push(e[j]=d=a.call(f.parentNode,g.__data__,j)),d.__data__=g.__data__):c.push(null)}return bd(b)};var bv={},by=[],bz=0,bA=0,bB=d3.ease("cubic-in-out");by.call=bj.call,d3.transition=function(){return br.transition()},d3.transition.prototype=by,by.select=function(a){var b=[],c,d,e;typeof a!="function"&&(a=bk(a));for(var f=-1,g=this.length;++f<g;){b.push(c=[]);for(var h=this[f],i=-1,j=h.length;++i<j;)(e=h[i])&&(d=a.call(e.node,e.node.__data__,i))?("__data__"in e.node&&(d.__data__=e.node.__data__),c.push({node:d,delay:e.delay,duration:e.duration})):c.push(null)}return bu(b,this.id,this.time).ease(this.ease())},by.selectAll=function(a){var b=[],c,d,e;typeof a!="function"&&(a=bl(a));for(var f=-1,g=this.length;++f<g;)for(var h=this[f],i=-1,j=h.length;++i<j;)if(e=h[i]){d=a.call(e.node,e.node.__data__,i),b.push(c=[]);for(var k=-1,l=d.length;++k<l;)c.push({node:d[k],delay:e.delay,duration:e.duration})}return bu(b,this.id,this.time).ease(this.ease())},by.attr=function(a,b){return this.attrTween(a,bx(a,b))},by.attrTween=function(a,b){function d(a,d){var e=b.call(this,a,d,this.getAttribute(c));return e===bv?(this.removeAttribute(c),null):e&&function(a){this.setAttribute(c,e(a))}}function e(a,d){var e=b.call(this,a,d,this.getAttributeNS(c.space,c.local));return e===bv?(this.removeAttributeNS(c.space,c.local),null):e&&function(a){this.setAttributeNS(c.space,c.local,e(a))}}var c=d3.ns.qualify(a);return this.tween("attr."+a,c.local?e:d)},by.style=function(a,b,c){return arguments.length<3&&(c=""),this.styleTween(a,bx(a,b),c)},by.styleTween=function(a,b,c){return arguments.length<3&&(c=""),this.tween("style."+a,function(d,e){var f=b.call(this,d,e,window.getComputedStyle(this,null).getPropertyValue(a));return f===bv?(this.style.removeProperty(a),null):f&&function(b){this.style.setProperty(a,f(b),c)}})},by.text=function(a){return this.tween("text",function(b,c){this.textContent=typeof a=="function"?a.call(this,b,c):a})},by.remove=function(){return this.each("end.transition",function(){var a;!this.__transition__&&(a=this.parentNode)&&a.removeChild(this)})},by.delay=function(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].delay=+a.apply(this,arguments)}:(a=+a,function(c,d,e){b[e][d].delay=a}))},by.duration=function(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].duration=+a.apply(this,arguments)}:(a=+a,function(c,d,e){b[e][d].duration=a}))},by.transition=function(){return this.select(i)};var bD=null,bE,bF;d3.timer=function(a,b,c){var d=!1,e,f=bD;if(arguments.length<3){if(arguments.length<2)b=0;else if(!isFinite(b))return;c=Date.now()}while(f){if(f.callback===a){f.then=c,f.delay=b,d=!0;break}e=f,f=f.next}d||(bD={callback:a,then:c,delay:b,next:bD}),bE||(bF=clearTimeout(bF),bE=1,bI(bG))},d3.timer.flush=function(){var a,b=Date.now(),c=bD;while(c)a=b-c.then,c.delay||(c.flush=c.callback(a)),c=c.next;bH()};var bI=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.transform=function(a){var b=document.createElementNS(d3.ns.prefix.svg,"g"),c={a:1,b:0,c:0,d:1,e:0,f:0};return(d3.transform=function(a){b.setAttribute("transform",a);var d=b.transform.baseVal.consolidate();return new bJ(d?d.matrix:c)})(a)},bJ.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var bN=180/Math.PI;d3.scale={},d3.scale.linear=function(){return bT([0,1],[0,1],d3.interpolate,!1)},d3.scale.log=function(){return b_(d3.scale.linear(),cb)};var ca=d3.format(".0e");cb.pow=function(a){return Math.pow(10,a)},cc.pow=function(a){return-Math.pow(10,-a)},d3.scale.pow=function(){return cd(d3.scale.linear(),1)},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){return cf([],{t:"range",x:[]})},d3.scale.category10=function(){return d3.scale.ordinal().range(cg)},d3.scale.category20=function(){return d3.scale.ordinal().range(ch)},d3.scale.category20b=function(){return d3.scale.ordinal().range(ci)},d3.scale.category20c=function(){return d3.scale.ordinal().range(cj)};var cg=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ch=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],ci=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],cj=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){return ck([],[])},d3.scale.quantize=function(){return cl(0,1,[0,1])},d3.svg={},d3.svg.arc=function(){function e(){var e=a.apply(this,arguments),f=b.apply(this,arguments),g=c.apply(this,arguments)+cm,h=d.apply(this,arguments)+cm,i=(h<g&&(i=g,g=h,h=i),h-g),j=i<Math.PI?"0":"1",k=Math.cos(g),l=Math.sin(g),m=Math.cos(h),n=Math.sin(h);return i>=cn?e?"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"M0,"+e+"A"+e+","+e+" 0 1,0 0,"+ -e+"A"+e+","+e+" 0 1,0 0,"+e+"Z":"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"Z":e?"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L"+e*m+","+e*n+"A"+e+","+e+" 0 "+j+",0 "+e*k+","+e*l+"Z":"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L0,0"+"Z"}var a=co,b=cp,c=cq,d=cr;return e.innerRadius=function(b){return arguments.length?(a=d3.functor(b),e):a},e.outerRadius=function(a){return arguments.length?(b=d3.functor(a),e):b},e.startAngle=function(a){return arguments.length?(c=d3.functor(a),e):c},e.endAngle=function(a){return arguments.length?(d=d3.functor(a),e):d},e.centroid=function(){var e=(a.apply(this,arguments)+b.apply(this,arguments))/2,f=(c.apply(this,arguments)+d.apply(this,arguments))/2+cm;return[Math.cos(f)*e,Math.sin(f)*e]},e};var cm=-Math.PI/2,cn=2*Math.PI-1e-6;d3.svg.line=function(){return cs(Object)};var cw={linear:cx,"step-before":cy,"step-after":cz,basis:cF,"basis-open":cG,"basis-closed":cH,bundle:cI,cardinal:cC,"cardinal-open":cA,"cardinal-closed":cB,monotone:cR},cK=[0,2/3,1/3,0],cL=[0,1/3,2/3,0],cM=[0,1/6,2/3,1/6];d3.svg.line.radial=function(){var a=cs(cS);return a.radius=a.x,delete a.x,a.angle=a.y,delete a.y,a},cy.reverse=cz,cz.reverse=cy,d3.svg.area=function(){return cT(Object)},d3.svg.area.radial=function(){var a=cT(cS);return a.radius=a.x,delete a.x,a.innerRadius=a.x0,delete a.x0,a.outerRadius=a.x1,delete a.x1,a.angle=a.y,delete a.y,a.startAngle=a.y0,delete a.y0,a.endAngle=a.y1,delete a.y1,a},d3.svg.chord=function(){function f(c,d){var e=g(this,a,c,d),f=g(this,b,c,d);return"M"+e.p0+i(e.r,e.p1,e.a1-e.a0)+(h(e,f)?j(e.r,e.p1,e.r,e.p0):j(e.r,e.p1,f.r,f.p0)+i(f.r,f.p1,f.a1-f.a0)+j(f.r,f.p1,e.r,e.p0))+"Z"}function g(a,b,f,g){var h=b.call(a,f,g),i=c.call(a,h,g),j=d.call(a,h,g)+cm,k=e.call(a,h,g)+cm;return{r:i,a0:j,a1:k,p0:[i*Math.cos(j),i*Math.sin(j)],p1:[i*Math.cos(k),i*Math.sin(k)]}}function h(a,b){return a.a0==b.a0&&a.a1==b.a1}function i(a,b,c){return"A"+a+","+a+" 0 "+ +(c>Math.PI)+",1 "+b}function j(a,b,c,d){return"Q 0,0 "+d}var a=cW,b=cX,c=cY,d=cq,e=cr;return f.radius=function(a){return arguments.length?(c=d3.functor(a),f):c},f.source=function(b){return arguments.length?(a=d3.functor(b),f):a},f.target=function(a){return arguments.length?(b=d3.functor(a),f):b},f.startAngle=function(a){return arguments.length?(d=d3.functor(a),f):d},f.endAngle=function(a){return arguments.length?(e=d3.functor(a),f):e},f},d3.svg.diagonal=function(){function d(d,e){var f=a.call(this,d,e),g=b.call(this,d,e),h=(f.y+g.y)/2,i=[f,{x:f.x,y:h},{x:g.x,y:h},g];return i=i.map(c),"M"+i[0]+"C"+i[1]+" "+i[2]+" "+i[3]}var a=cW,b=cX,c=c_;return d.source=function(b){return arguments.length?(a=d3.functor(b),d):a},d.target=function(a){return arguments.length?(b=d3.functor(a),d):b},d.projection=function(a){return arguments.length?(c=a,d):c},d},d3.svg.diagonal.radial=function(){var a=d3.svg.diagonal(),b=c_,c=a.projection;return a.projection=function(a){return arguments.length?c(da(b=a)):b},a},d3.svg.mouse=function(a){return dc(a,d3.event)};var db=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.touches=function(a,b){return arguments.length<2&&(b=d3.event.touches),b?d(b).map(function(b){var c=dc(a,b);return c.identifier=b.identifier,c}):[]},d3.svg.symbol=function(){function c(c,d){return(df[a.call(this,c,d)]||df.circle)(b.call(this,c,d))}var a=de,b=dd;return c.type=function(b){return arguments.length?(a=d3.functor(b),c):a},c.size=function(a){return arguments.length?(b=d3.functor(a),c):b},c};var df={circle:function(a){var b=Math.sqrt(a/Math.PI);return"M0,"+b+"A"+b+","+b+" 0 1,1 0,"+ -b+"A"+b+","+b+" 0 1,1 0,"+b+"Z"},cross:function(a){var b=Math.sqrt(a/5)/2;return"M"+ -3*b+","+ -b+"H"+ -b+"V"+ -3*b+"H"+b+"V"+ -b+"H"+3*b+"V"+b+"H"+b+"V"+3*b+"H"+ -b+"V"+b+"H"+ -3*b+"Z"},diamond:function(a){var b=Math.sqrt(a/(2*dh)),c=b*dh;return"M0,"+ -b+"L"+c+",0"+" 0,"+b+" "+ -c+",0"+"Z"},square:function(a){var b=Math.sqrt(a)/2;return"M"+ -b+","+ -b+"L"+b+","+ -b+" "+b+","+b+" "+ -b+","+b+"Z"},"triangle-down":function(a){var b=Math.sqrt(a/dg),c=b*dg/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.sqrt(a/dg),c=b*dg/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}};d3.svg.symbolTypes=d3.keys(df);var dg=Math.sqrt(3),dh=Math.tan(30*Math.PI/180);d3.svg.axis=function(){function j(j){j.each(function(k,l,m){var n=d3.select(this),o=j.delay?function(a){var b=bA;try{return bA=j.id,a.transition().delay(j[m][l].delay).duration(j[m][l].duration).ease(j.ease())}finally{bA=b}}:Object,p=a.ticks?a.ticks.apply(a,g):a.domain(),q=h==null?a.tickFormat?a.tickFormat.apply(a,g):String:h,r=dk(a,p,i),s=n.selectAll(".minor").data(r,String),t=s.enter().insert("line","g").attr("class","tick minor").style("opacity",1e-6),u=o(s.exit()).style("opacity",1e-6).remove(),v=o(s).style("opacity",1),w=n.selectAll("g").data(p,String),x=w.enter().insert("g","path").style("opacity",1e-6),y=o(w.exit()).style("opacity",1e-6).remove(),z=o(w).style("opacity",1),A,B=bQ(a),C=n.selectAll(".domain").data([0]),D=C.enter().append("path").attr("class","domain"),E=o(C),F=a.copy(),G=this.__chart__||F;this.__chart__=F,x.append("line").attr("class","tick"),x.append("text"),z.select("text").text(q);switch(b){case"bottom":A=di,t.attr("y2",d),v.attr("x2",0).attr("y2",d),x.select("line").attr("y2",c),x.select("text").attr("y",Math.max(c,0)+f),z.select("line").attr("x2",0).attr("y2",c),z.select("text").attr("x",0).attr("y",Math.max(c,0)+f).attr("dy",".71em").attr("text-anchor","middle"),E.attr("d","M"+B[0]+","+e+"V0H"+B[1]+"V"+e);break;case"top":A=di,t.attr("y2",-d),v.attr("x2",0).attr("y2",-d),x.select("line").attr("y2",-c),x.select("text").attr("y",-(Math.max(c,0)+f)),z.select("line").attr("x2",0).attr("y2",-c),z.select("text").attr("x",0).attr("y",-(Math.max(c,0)+f)).attr("dy","0em").attr("text-anchor","middle"),E.attr("d","M"+B[0]+","+ -e+"V0H"+B[1]+"V"+ -e);break;case"left":A=dj,t.attr("x2",-d),v.attr("x2",-d).attr("y2",0),x.select("line").attr("x2",-c),x.select("text").attr("x",-(Math.max(c,0)+f)),z.select("line").attr("x2",-c).attr("y2",0),z.select("text").attr("x",-(Math.max(c,0)+f)).attr("y",0).attr("dy",".32em").attr("text-anchor","end"),E.attr("d","M"+ -e+","+B[0]+"H0V"+B[1]+"H"+ -e);break;case"right":A=dj,t.attr("x2",d),v.attr("x2",d).attr("y2",0),x.select("line").attr("x2",c),x.select("text").attr("x",Math.max(c,0)+f),z.select("line").attr("x2",c).attr("y2",0),z.select("text").attr("x",Math.max(c,0)+f).attr("y",0).attr("dy",".32em").attr("text-anchor","start"),E.attr("d","M"+e+","+B[0]+"H0V"+B[1]+"H"+e)}if(a.ticks)x.call(A,G),z.call(A,F),y.call(A,F),t.call(A,G),v.call(A,F),u.call(A,F);else{var H=F.rangeBand()/2,I=function(a){return F(a)+H};x.call(A,I),z.call(A,I)}})}var a=d3.scale.linear(),b="bottom",c=6,d=6,e=6,f=3,g=[10],h,i=0;return j.scale=function(b){return arguments.length?(a=b,j):a},j.orient=function(a){return arguments.length?(b=a,j):b},j.ticks=function(){return arguments.length?(g=arguments,j):g},j.tickFormat=function(a){return arguments.length?(h=a,j):h},j.tickSize=function(a,b,f){if(!arguments.length)return c;var g=arguments.length-1;return c=+a,d=g>1?+b:c,e=g>0?+arguments[g]:c,j},j.tickPadding=function(a){return arguments.length?(f=+a,j):f},j.tickSubdivide=function(a){return arguments.length?(i=+a,j):i},j},d3.svg.brush=function(){function e(a){var g=b&&c?["n","e","s","w","nw","ne","se","sw"]:b?["e","w"]:c?["n","s"]:[];a.each(function(){var a=d3.select(this).on("mousedown.brush",f),h=a.selectAll(".background").data([0]),i=a.selectAll(".extent").data([0]),j=a.selectAll(".resize").data(g,String),k;h.enter().append("rect").attr("class","background").style("visibility","hidden").style("pointer-events","all").style("cursor","crosshair"),i.enter().append("rect").attr("class","extent").style("cursor","move"),j.enter().append("rect").attr("class",function(a){return"resize "+a}).attr("width",6).attr("height",6).style("visibility","hidden").style("cursor",function(a){return dD[a]}),j.style("pointer-events",e.empty()?"none":"all"),j.exit().remove(),b&&(k=bQ(b),h.attr("x",k[0]).attr("width",k[1]-k[0]),dw(a,d)),c&&(k=bQ(c),h.attr("y",k[0]).attr("height",k[1]-k[0]),dx(a,d))})}function f(){var a=d3.select(d3.event.target);dl=e,dn=this,dr=d,dv=d3.svg.mouse(dn),(ds=a.classed("extent"))?(dv[0]=d[0][0]-dv[0],dv[1]=d[0][1]-dv[1]):a.classed("resize")?(dt=d3.event.target.__data__,dv[0]=d[+/w$/.test(dt)][0],dv[1]=d[+/^n/.test(dt)][1]):d3.event.altKey&&(du=dv.slice()),dp=!/^(n|s)$/.test(dt)&&b,dq=!/^(e|w)$/.test(dt)&&c,dm=g(this,arguments),dm("brushstart"),dA(),P()}function g(b,c){return function(d){var f=d3.event;try{d3.event={type:d,target:e},a[d].apply(b,c)}finally{d3.event=f}}}var a=d3.dispatch("brushstart","brush","brushend"),b,c,d=[[0,0],[0,0]];return e.x=function(a){return arguments.length?(b=a,e):b},e.y=function(a){return arguments.length?(c=a,e):c},e.extent=function(a){var f,g,h,i,j;return arguments.length?(b&&(f=a[0],g=a[1],c&&(f=f[0],g=g[0]),b.invert&&(f=b(f),g=b(g)),g<f&&(j=f,f=g,g=j),d[0][0]=f,d[1][0]=g),c&&(h=a[0],i=a[1],b&&(h=h[1],i=i[1]),c.invert&&(h=c(h),i=c(i)),i<h&&(j=h,h=i,i=j),d[0][1]=h,d[1][1]=i),e):(b&&(f=d[0][0],g=d[1][0],b.invert&&(f=b.invert(f),g=b.invert(g)),g<f&&(j=f,f=g,g=j)),c&&(h=d[0][1],i=d[1][1],c.invert&&(h=c.invert(h),i=c.invert(i)),i<h&&(j=h,h=i,i=j)),b&&c?[[f,h],[g,i]]:b?[f,g]:c&&[h,i])},e.clear=function(){return d[0][0]=d[0][1]=d[1][0]=d[1][1]=0,e},e.empty=function(){return b&&d[0][0]===d[1][0]||c&&d[0][1]===d[1][1]},d3.select(window).on("mousemove.brush",dA).on("mouseup.brush",dC).on("keydown.brush",dy).on("keyup.brush",dz),d3.rebind(e,a,"on")};var dl,dm,dn,dp,dq,dr,ds,dt,du,dv,dD={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"};d3.behavior={},d3.behavior.drag=function(){function c(){this.on("mousedown.drag",e).on("touchstart.drag",e),d3.select(window).on("mousemove.drag",dN).on("touchmove.drag",dN).on("mouseup.drag",dO,!0).on("touchend.drag",dO,!0).on("click.drag",dP,!0)}function d(){dE=a,dF=d3.event.target,dG=this,dH=arguments,dJ=dM(),b?(dI=b.apply(dG,dH),dI=[dI.x-dJ[0],dI.y-dJ[1]]):dI=[0,0],dK=0}function e(){d.apply(this,arguments),dL("dragstart")}var a=d3.dispatch("drag","dragstart","dragend"),b=null;return c.origin=function(a){return arguments.length?(b=a,c):b},d3.rebind(c,a,"on")};var dE,dF,dG,dH,dI,dJ,dK;d3.behavior.zoom=function(){function d(){this.on("mousedown.zoom",f).on("mousewheel.zoom",g).on("DOMMouseScroll.zoom",g).on("dblclick.zoom",h).on("touchstart.zoom",i),d3.select(window).on("mousemove.zoom",ee).on("mouseup.zoom",ef).on("touchmove.zoom",ed).on("touchend.zoom",ec).on("click.zoom",eg,!0)}function e(){dV=a,dW=c,dX=b.zoom,dY=d3.event.target,dZ=this,d$=arguments}function f(){e.apply(this,arguments),dR=ea(d3.svg.mouse(dZ)),d_=0,d3.event.preventDefault(),window.focus()}function g(){e.apply(this,arguments),dS||(dS=ea(d3.svg.mouse(dZ))),eh(eb()+a[2],d3.svg.mouse(dZ),dS)}function h(){e.apply(this,arguments);var b=d3.svg.mouse(dZ);eh(d3.event.shiftKey?Math.ceil(a[2]-1):Math.floor(a[2]+1),b,ea(b))}function i(){e.apply(this,arguments);var b=ec(),c,d=Date.now();b.length===1&&d-dU<300&&eh(1+Math.floor(a[2]),c=b[0],dT[c.identifier]),dU=d}var a=[0,0,0],b=d3.dispatch("zoom"),c=ei;return d.extent=function(a){return arguments.length?(c=a==null?ei:a,d):c},d3.rebind(d,b,"on")};var dQ,dR,dS,dT={},dU=0,dV,dW,dX,dY,dZ,d$,d_,ei=[[-Infinity,Infinity],[-Infinity,Infinity],[-Infinity,Infinity]]})(); <ide>\ No newline at end of file
2
PHP
PHP
add reset method to breadcrumbshelper
e49d0957c0dea380f2fe57c98f6f9a1ef45cd5e4
<ide><path>src/View/Helper/BreadcrumbsHelper.php <ide> public function getCrumbs() <ide> return $this->crumbs; <ide> } <ide> <add> /** <add> * Removes all existing crumbs. <add> * <add> * @return $this <add> */ <add> public function reset() <add> { <add> $this->crumbs = []; <add> <add> return $this; <add> } <add> <ide> /** <ide> * Renders the breadcrumbs trail. <ide> * <ide><path>tests/TestCase/View/Helper/BreadcrumbsHelperTest.php <ide> public function testPrependMultiple() <ide> $this->assertEquals($expected, $result); <ide> } <ide> <add> /** <add> * Test ability to empty crumbs list. <add> * <add> * @return void <add> */ <add> public function testReset() <add> { <add> $this->breadcrumbs->add('Home', '/'); <add> $this->breadcrumbs->add('Products', '/products'); <add> <add> $crumbs = $this->breadcrumbs->getCrumbs(); <add> $this->assertEquals(count($crumbs), 2); <add> <add> $this->breadcrumbs->reset(); <add> $actual = $this->breadcrumbs->getCrumbs(); <add> $this->assertEquals($actual, []); <add> } <add> <ide> /** <ide> * Test adding crumbs to a specific index <ide> *
2
Text
Text
update callbacks documentation
0e6fd3d306c6a8dffdbc333433006e0b6b483873
<ide><path>docs/sources/callbacks.md <ide> The `logs` dictionary will contain keys for quantities relevant to the current b <ide> <ide> --- <ide> <add>## Available callbacks <add> <add>```python <add>keras.callbacks.ModelCheckpoint(filepath, verbose=0, save_best_only=False) <add>``` <add> <add>Save the model after every epoch. If `save_best_only=True`, the latest best model according to the validation loss will not be overwritten. <add> <add> <add>```python <add>keras.callbacks.EarlyStopping(patience=0, verbose=0) <add>``` <add> <add>Stop training after no improvement of the validation loss is seen for `patience` epochs. <add> <add>--- <add> <ide> <ide> ## Create a callback <ide>
1
PHP
PHP
fix cs errors
3eb93d3ef2d6fb53858e743d9056c1cf53d2963d
<ide><path>tests/TestCase/Collection/CollectionTest.php <ide> public function testFilterChaining() <ide> $items = ['a' => 1, 'b' => 2, 'c' => 3]; <ide> $collection = new Collection($items); <ide> $callable = $this->getMockBuilder(\StdClass::class) <del> ->setMethods(['__invoke']) <del> ->getMock(); <add> ->setMethods(['__invoke']) <add> ->getMock(); <ide> <ide> $callable->expects($this->once()) <ide> ->method('__invoke') <ide> public function testEveryReturnTrue() <ide> $items = ['a' => 1, 'b' => 2, 'c' => 3]; <ide> $collection = new Collection($items); <ide> $callable = $this->getMockBuilder(\StdClass::class) <del> ->setMethods(['__invoke']) <del> ->getMock(); <add> ->setMethods(['__invoke']) <add> ->getMock(); <ide> <ide> $callable->expects($this->at(0)) <ide> ->method('__invoke') <ide> public function testEveryReturnFalse() <ide> $items = ['a' => 1, 'b' => 2, 'c' => 3]; <ide> $collection = new Collection($items); <ide> $callable = $this->getMockBuilder(\StdClass::class) <del> ->setMethods(['__invoke']) <del> ->getMock(); <add> ->setMethods(['__invoke']) <add> ->getMock(); <ide> <ide> $callable->expects($this->at(0)) <ide> ->method('__invoke') <ide> public function testEveryReturnFalse() <ide> $items = []; <ide> $collection = new Collection($items); <ide> $callable = $this->getMockBuilder(\StdClass::class) <del> ->setMethods(['__invoke']) <del> ->getMock(); <add> ->setMethods(['__invoke']) <add> ->getMock(); <ide> <ide> $callable->expects($this->never()) <ide> ->method('__invoke'); <ide> public function testSomeReturnTrue() <ide> $items = ['a' => 1, 'b' => 2, 'c' => 3]; <ide> $collection = new Collection($items); <ide> $callable = $this->getMockBuilder(\StdClass::class) <del> ->setMethods(['__invoke']) <del> ->getMock(); <add> ->setMethods(['__invoke']) <add> ->getMock(); <ide> <ide> $callable->expects($this->at(0)) <ide> ->method('__invoke') <ide> public function testSomeReturnFalse() <ide> $items = ['a' => 1, 'b' => 2, 'c' => 3]; <ide> $collection = new Collection($items); <ide> $callable = $this->getMockBuilder(\StdClass::class) <del> ->setMethods(['__invoke']) <del> ->getMock(); <add> ->setMethods(['__invoke']) <add> ->getMock(); <ide> <ide> $callable->expects($this->at(0)) <ide> ->method('__invoke') <ide> public function testReduceWithInitialValue() <ide> $items = ['a' => 1, 'b' => 2, 'c' => 3]; <ide> $collection = new Collection($items); <ide> $callable = $this->getMockBuilder(\StdClass::class) <del> ->setMethods(['__invoke']) <del> ->getMock(); <add> ->setMethods(['__invoke']) <add> ->getMock(); <ide> <ide> $callable->expects($this->at(0)) <ide> ->method('__invoke') <ide> public function testReduceWithoutInitialValue() <ide> $items = ['a' => 1, 'b' => 2, 'c' => 3, 'd' => 4]; <ide> $collection = new Collection($items); <ide> $callable = $this->getMockBuilder(\StdClass::class) <del> ->setMethods(['__invoke']) <del> ->getMock(); <add> ->setMethods(['__invoke']) <add> ->getMock(); <ide> <ide> $callable->expects($this->at(0)) <ide> ->method('__invoke') <ide> public function testCompile() <ide> $items = ['a' => 1, 'b' => 2, 'c' => 3]; <ide> $collection = new Collection($items); <ide> $callable = $this->getMockBuilder(\StdClass::class) <del> ->setMethods(['__invoke']) <del> ->getMock(); <add> ->setMethods(['__invoke']) <add> ->getMock(); <ide> <ide> $callable->expects($this->at(0)) <ide> ->method('__invoke')
1
Text
Text
prepare changelog for 2.12.0 [ci skip]
b2cad6729c64cb8d4359ef6f3b0a49d689334ec1
<ide><path>CHANGELOG.md <ide> # Ember Changelog <ide> <del>### 2.12.0-beta.3 (March 8, 2017) <del> <del>- [#14987](https://github.com/emberjs/ember.js/pull/14987) [BUGFIX] Fix a memory leak when components are destroyed. <del>- [#14986](https://github.com/emberjs/ember.js/pull/14986) [BUGFIX] Fix a memory leak in RSVP.js. <del>- [#14985](https://github.com/emberjs/ember.js/pull/14985) [BUGFIX] Fix a bug that added babel helpers to the global scope. <del>- [#14898](https://github.com/emberjs/ember.js/pull/14898) [BUGFIX] Fix an issue where errors in tests sometimes do not cause a failure. <del>- [#14707](https://github.com/emberjs/ember.js/pull/14707) [BUGFIX] Improve deprecation message for unsafe `style` attribute bindings. <del> <del>### 2.12.0-beta.2 (February 16, 2017) <del> <del>- [#14872](https://github.com/emberjs/ember.js/pull/14872) / [#14871](https://github.com/emberjs/ember.js/pull/14871) / [#14883](https://github.com/emberjs/ember.js/pull/14883) [PERF] Simplify action event handler <del>- [#14905](https://github.com/emberjs/ember.js/pull/14905) [DOC] Add link to `_lookupFactory` deprecation message <del>- [#14762](https://github.com/emberjs/ember.js/pull/14762) [BUGFIX] Make ember-template-compiler handle {{input}} helpers with sub-expression "type" <del>- [#14791](https://github.com/emberjs/ember.js/pull/14791) [BUGFIX] exempt routes that share a controller from duplicate assertion <del>- [#14860](https://github.com/emberjs/ember.js/pull/14860) [BUGFIX] Add back `mainContext` to loader #14859 (fixes issue with non ember-cli template compilation). <del>- [#14878](https://github.com/emberjs/ember.js/pull/14878) [DOC] Fix yuidoc package paths to ensure RSVP is properly included in API documentation. <del>- [#14910](https://github.com/emberjs/ember.js/pull/14910) [BUGFIX] Include blueprints in NPM release, to ensure `ember-source` blueprints are used over `ember-cli-legacy-blueprints`. <del> <del>### 2.12.0-beta.1 (January 23, 2017) <add>### 2.12.0 (March 14, 2017) <ide> <add>- [#15000](https://github.com/emberjs/ember.js/pull/15000) / [#15002](https://github.com/emberjs/ember.js/pull/15002) / [#15006](https://github.com/emberjs/ember.js/pull/15006) / [#15008](https://github.com/emberjs/ember.js/pull/15008) / [#15009](https://github.com/emberjs/ember.js/pull/15009) / [#15011](https://github.com/emberjs/ember.js/pull/15011) [PERF] Assorted performance improvements for modern browsers. <add>- [#14872](https://github.com/emberjs/ember.js/pull/14872) / [#14871](https://github.com/emberjs/ember.js/pull/14871) / [#14883](https://github.com/emberjs/ember.js/pull/14883) [PERF] Simplify action event handlertemplate compilation). <ide> - [#14360](https://github.com/emberjs/ember.js/pull/14360) [FEATURE factory-for] Implement `factoryFor`. <ide> - [#14751](https://github.com/emberjs/ember.js/pull/14751) [DEPRECATION} Deprecate `Ember.K`. <ide> - [#14756](https://github.com/emberjs/ember.js/pull/14756) [PERF] Disable costly `eventManager` support when unused. <ide> - [#14794](https://github.com/emberjs/ember.js/pull/14794) [BUGFIX] Fix query param stickiness between models in ember-engines. <ide> - [#14851](https://github.com/emberjs/ember.js/pull/14851) [PERF] only `LOG_VIEW_LOOKUPS` in debug <ide> - [#14829](https://github.com/emberjs/ember.js/pull/14829) [PERF] only `logLibraryVersions` in debug mode <ide> - [#14852](https://github.com/emberjs/ember.js/pull/14852) [PERF] only `LOG_TRANSITIONS` and `LOG_TRANSITIONS_INTERNAL` in debug <del>- [#14854](https://github.com/emberjs/ember.js/pull/14854) [PER] only `LOG_ACTIVE_GENERATION` and `LOG_RESOLVER` in debug <add>- [#14854](https://github.com/emberjs/ember.js/pull/14854) [PERF] only `LOG_ACTIVE_GENERATION` and `LOG_RESOLVER` in debug <ide> <ide> ### 2.11.3 (March 8, 2017) <ide>
1
Javascript
Javascript
fix typo in console.error
492412f1779e41ce020c62cedfc6e36c9be6d0a9
<ide><path>packager/react-packager/src/DependencyResolver/DependencyGraph/index.js <ide> class DependencyGraph { <ide> this._helpers = new Helpers(this._opts); <ide> this.load().catch((err) => { <ide> // This only happens at initialization. Live errors are easier to recover from. <del> console.error('Error building DepdendencyGraph:\n', err.stack); <add> console.error('Error building DependencyGraph:\n', err.stack); <ide> process.exit(1); <ide> }); <ide> }
1
Text
Text
add code block, avoid punctuation
c73017bd909b0e58c86669a7fb29fd32fed679d4
<ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/use-a-bezier-curve-to-move-a-graphic.md <ide> Remember that all `cubic-bezier` functions start with `p0` at (0, 0) and end wit <ide> <ide> # --instructions-- <ide> <del>To see the effect of this Bezier curve in action, change the `animation-timing-function` of the element with id of `red` to a `cubic-bezier` function with x1, y1, x2, y2 values set respectively to 0, 0, 0.58, 1. This will make both elements progress through the animation similarly. <add>To see the effect of this Bezier curve in action, change the `animation-timing-function` of the element with id of `red` to a `cubic-bezier` function with x1, y1, x2, y2 set respectively to `0, 0, 0.58, 1` as the values. This will make both elements progress through the animation similarly. <ide> <ide> # --hints-- <ide>
1
Python
Python
stop timer threads after staring them
aa795790c1689691186b159bae05a3c5573629c5
<ide><path>celery/tests/test_worker.py <ide> def qos(self, **kwargs): <ide> l.qos = QoS(l.task_consumer, l.initial_prefetch_count, l.logger) <ide> l.event_dispatcher = MockEventDispatcher() <ide> l.receive_message(m.decode(), m) <add> l.eta_schedule.stop() <ide> <ide> items = [entry[2] for entry in self.eta_schedule.queue] <ide> found = 0 <ide> def test_receieve_message_eta(self): <ide> self.assertTrue(dispatcher.flushed) <ide> l.event_dispatcher = MockEventDispatcher() <ide> l.receive_message(m.decode(), m) <del> <add> l.eta_schedule.stop() <ide> in_hold = self.eta_schedule.queue[0] <ide> self.assertEqual(len(in_hold), 3) <ide> eta, priority, entry = in_hold
1
Go
Go
fix missing comment in docker inspect
d32f43013bf4c3aaa90c9ea409fbb9ade4105200
<ide><path>daemon/daemon.go <ide> func (daemon *Daemon) LookupImage(name string) (*types.ImageInspect, error) { <ide> } <ide> } <ide> <add> comment := img.Comment <add> if len(comment) == 0 && len(img.History) > 0 { <add> comment = img.History[len(img.History)-1].Comment <add> } <add> <ide> imageInspect := &types.ImageInspect{ <ide> ID: img.ID().String(), <ide> RepoTags: repoTags, <ide> RepoDigests: repoDigests, <ide> Parent: img.Parent.String(), <del> Comment: img.Comment, <add> Comment: comment, <ide> Created: img.Created.Format(time.RFC3339Nano), <ide> Container: img.Container, <ide> ContainerConfig: &img.ContainerConfig, <ide><path>integration-cli/docker_cli_inspect_test.go <ide> func (s *DockerSuite) TestInspectStopWhenNotFound(c *check.C) { <ide> c.Assert(out, checker.Not(checker.Contains), "not-shown") <ide> c.Assert(out, checker.Contains, "Error: No such container: missing") <ide> } <add> <add>func (s *DockerSuite) TestInspectHistory(c *check.C) { <add> dockerCmd(c, "run", "--name=testcont", "-d", "busybox", "top") <add> dockerCmd(c, "commit", "-m", "test comment", "testcont", "testimg") <add> out, _, err := dockerCmdWithError("inspect", "--format='{{.Comment}}'", "testimg") <add> <add> c.Assert(err, check.IsNil) <add> c.Assert(out, checker.Contains, "test comment") <add>}
2
Ruby
Ruby
fix typo in `match` doc [ci skip]
fa5436e017e31a00a33dd69eb989255af63c636e
<ide><path>actionpack/lib/action_dispatch/routing/mapper.rb <ide> module Base <ide> # end <ide> # <ide> # [:constraints] <del> # Constrains parameters with a hash of regular expressions <add> # Constraints parameters with a hash of regular expressions <ide> # or an object that responds to <tt>matches?</tt>. In addition, constraints <ide> # other than path can also be specified with any object <ide> # that responds to <tt>===</tt> (eg. String, Array, Range, etc.).
1
Python
Python
add is_decoder as an attribute to config class
17177e73796f516e3f49d311eab77b02ab679871
<ide><path>transformers/modeling_bert.py <ide> class BertLayer(nn.Module): <ide> def __init__(self, config): <ide> super(BertLayer, self).__init__() <ide> self.self_attention = BertAttention(config) <del> if config.get("is_decoder", False): <add> if getattr(config, "is_decoder", False): <ide> self.attention = BertAttention(config) <ide> self.intermediate = BertIntermediate(config) <ide> self.output = BertOutput(config) <ide> def forward(self, hidden_states, attention_mask=None, head_mask=None): <ide> class BertDecoder(nn.Module): <ide> def __init__(self, config): <ide> super(BertDecoder, self).__init__() <del> config["is_decoder"] = True <add> config.is_decoder = True <ide> self.output_attentions = config.output_attentions <ide> self.output_hidden_states = config.output_hidden_states <ide> self.layers = nn.ModuleList([BertLayer(config) for _ in range(config.num_hidden_layers)])
1
Ruby
Ruby
simplify xcodebuild special case
63629ab13bfe7e355eacf1235e52699f5cc3a581
<ide><path>Library/Homebrew/formula.rb <ide> def test_defined? <ide> # Pretty titles the command and buffers stdout/stderr <ide> # Throws if there's an error <ide> def system cmd, *args <add> removed_ENV_variables = {} <add> <ide> # remove "boring" arguments so that the important ones are more likely to <ide> # be shown considering that we trim long ohai lines to the terminal width <ide> pretty_args = args.dup <ide> def system cmd, *args <ide> end <ide> ohai "#{cmd} #{pretty_args*' '}".strip <ide> <del> removed_ENV_variables = case if args.empty? then cmd.split(' ').first else cmd end <del> when "xcodebuild" <del> ENV.remove_cc_etc <add> if cmd.to_s.start_with? "xcodebuild" <add> removed_ENV_variables.update(ENV.remove_cc_etc) <ide> end <ide> <ide> @exec_count ||= 0 <ide> def system cmd, *args <ide> end <ide> ensure <ide> rd.close if rd and not rd.closed? <del> ENV.update(removed_ENV_variables) if removed_ENV_variables <add> ENV.update(removed_ENV_variables) <ide> end <ide> <ide> private
1
Python
Python
ignore complexwarning in ``test_iter_copy_casts``
3c7cd655c78ed7663e0dd672ed705364a09c8e16
<ide><path>numpy/core/tests/test_nditer.py <ide> def test_iter_copy(): <ide> <ide> @pytest.mark.parametrize("dtype", np.typecodes["All"]) <ide> @pytest.mark.parametrize("loop_dtype", np.typecodes["All"]) <add>@pytest.mark.filterwarnings("ignore::numpy.ComplexWarning") <ide> def test_iter_copy_casts(dtype, loop_dtype): <ide> # Ensure the dtype is never flexible: <ide> if loop_dtype.lower() == "m":
1
Text
Text
add gabrielschulhof to collaborators
24c45054e425dbc47c19262cfc4fb9f917a0e08d
<ide><path>README.md <ide> more information about the governance of the Node.js project, see <ide> **Daniel Wang** &lt;wangyang0123@gmail.com&gt; <ide> * [Fishrock123](https://github.com/Fishrock123) - <ide> **Jeremiah Senkpiel** &lt;fishrock123@rocketmail.com&gt; <add>* [gabrielschulhof](https://github.com/gabrielschulhof) - <add>**Gabriel Schulhof** &lt;gabriel.schulhof@intel.com&gt; <ide> * [geek](https://github.com/geek) - <ide> **Wyatt Preul** &lt;wpreul@gmail.com&gt; <ide> * [gibfahn](https://github.com/gibfahn) -
1
Ruby
Ruby
fix syntax error
e52a12a8b5f52ed80d6717214a53cedac347d8b8
<ide><path>Library/Homebrew/cmd/test-bot.rb <ide> def test_bot <ide> ARGV.named.each do |argument| <ide> test_error = false <ide> begin <del> test = Test.new(argument, :tap => tap, :skip_homebrew = skip_homebrew) <del> skip_homebrew ||= true <add> test = Test.new(argument, :tap => tap, :skip_homebrew => skip_homebrew) <add> skip_homebrew = true <ide> rescue ArgumentError => e <ide> test_error = true <ide> ofail e.message
1
Javascript
Javascript
use internal api instead of crypto module
fa3d6bedf9b1507bc17265eb9fad70b623247d85
<ide><path>lib/_tls_common.js <ide> const { <ide> <ide> const { SSL_OP_CIPHER_SERVER_PREFERENCE } = process.binding('constants').crypto; <ide> <del>// Lazily loaded <del>var crypto = null; <add>// Lazily loaded from internal/crypto/util. <add>let toBuf = null; <ide> <ide> const { internalBinding } = require('internal/bootstrap/loaders'); <ide> const { SecureContext: NativeSecureContext } = internalBinding('crypto'); <ide> exports.createSecureContext = function createSecureContext(options, context) { <ide> } <ide> <ide> if (options.pfx) { <del> if (!crypto) <del> crypto = require('crypto'); <add> if (!toBuf) <add> toBuf = require('internal/crypto/util').toBuf; <ide> <ide> if (Array.isArray(options.pfx)) { <ide> for (i = 0; i < options.pfx.length; i++) { <ide> const pfx = options.pfx[i]; <ide> const raw = pfx.buf ? pfx.buf : pfx; <del> const buf = crypto._toBuf(raw); <add> const buf = toBuf(raw); <ide> const passphrase = pfx.passphrase || options.passphrase; <ide> if (passphrase) { <del> c.context.loadPKCS12(buf, crypto._toBuf(passphrase)); <add> c.context.loadPKCS12(buf, toBuf(passphrase)); <ide> } else { <ide> c.context.loadPKCS12(buf); <ide> } <ide> } <ide> } else { <del> const buf = crypto._toBuf(options.pfx); <add> const buf = toBuf(options.pfx); <ide> const passphrase = options.passphrase; <ide> if (passphrase) { <del> c.context.loadPKCS12(buf, crypto._toBuf(passphrase)); <add> c.context.loadPKCS12(buf, toBuf(passphrase)); <ide> } else { <ide> c.context.loadPKCS12(buf); <ide> }
1
PHP
PHP
reduce mock usage
a674c1ab2c1fdfbcfdf9ba6266fe8c5196313606
<ide><path>tests/TestCase/Auth/ControllerAuthorizeTest.php <ide> public function setUp(): void <ide> ->setMethods(['isAuthorized']) <ide> ->disableOriginalConstructor() <ide> ->getMock(); <del> $this->components = $this->getMockBuilder(ComponentRegistry::class)->getMock(); <del> $this->components->expects($this->any()) <del> ->method('getController') <del> ->will($this->returnValue($this->controller)); <add> $this->components = new ComponentRegistry($this->controller); <ide> <ide> $this->auth = new ControllerAuthorize($this->components); <ide> } <ide><path>tests/TestCase/Database/Log/LoggingStatementTest.php <ide> public function testExecuteWithError() <ide> */ <ide> public function testSetAndGetLogger() <ide> { <del> $logger = $this->getMockBuilder(QueryLogger::class) <del> ->disableOriginalConstructor() <del> ->getMock(); <add> $logger = new QueryLogger(); <ide> $st = new LoggingStatement( <ide> $this->getMockBuilder(StatementInterface::class)->getMock(), <ide> $this->getMockBuilder(DriverInterface::class)->getMock() <ide><path>tests/TestCase/Datasource/QueryCacherTest.php <ide> use Cake\Cache\Cache; <ide> use Cake\Datasource\QueryCacher; <ide> use Cake\TestSuite\TestCase; <add>use stdClass; <ide> <ide> /** <ide> * Query cacher test <ide> public function tearDown(): void <ide> public function testFetchFunctionKey() <ide> { <ide> $this->_mockRead('my_key', 'A winner'); <del> $query = $this->getMockBuilder('stdClass')->getMock(); <add> $query = new stdClass(); <ide> <ide> $cacher = new QueryCacher(function ($q) use ($query) { <ide> $this->assertSame($query, $q); <ide> public function testFetchFunctionKeyNoString() <ide> $this->expectException(\RuntimeException::class); <ide> $this->expectExceptionMessage('Cache key functions must return a string. Got false.'); <ide> $this->_mockRead('my_key', 'A winner'); <del> $query = $this->getMockBuilder('stdClass')->getMock(); <add> $query = new stdClass(); <ide> <ide> $cacher = new QueryCacher(function ($q) { <ide> return false; <ide> public function testFetchCacheHitStringEngine() <ide> { <ide> $this->_mockRead('my_key', 'A winner'); <ide> $cacher = new QueryCacher('my_key', 'queryCache'); <del> $query = $this->getMockBuilder('stdClass')->getMock(); <add> $query = new stdClass(); <ide> $result = $cacher->fetch($query); <ide> $this->assertSame('A winner', $result); <ide> } <ide> public function testFetchCacheHit() <ide> { <ide> $this->_mockRead('my_key', 'A winner'); <ide> $cacher = new QueryCacher('my_key', $this->engine); <del> $query = $this->getMockBuilder('stdClass')->getMock(); <add> $query = new stdClass(); <ide> $result = $cacher->fetch($query); <ide> $this->assertSame('A winner', $result); <ide> } <ide> public function testFetchCacheMiss() <ide> { <ide> $this->_mockRead('my_key', false); <ide> $cacher = new QueryCacher('my_key', $this->engine); <del> $query = $this->getMockBuilder('stdClass')->getMock(); <add> $query = new stdClass(); <ide> $result = $cacher->fetch($query); <ide> $this->assertNull($result, 'Cache miss should not have an isset() return.'); <ide> } <ide><path>tests/TestCase/Form/FormTest.php <ide> namespace Cake\Test\TestCase\Form; <ide> <ide> use Cake\Form\Form; <add>use Cake\Form\Schema; <ide> use Cake\TestSuite\TestCase; <ide> use Cake\Validation\Validator; <ide> use TestApp\Form\AppForm; <ide> public function testSchema() <ide> $this->assertInstanceOf('Cake\Form\Schema', $schema); <ide> $this->assertSame($schema, $form->schema(), 'Same instance each time'); <ide> <del> $schema = $this->getMockBuilder('Cake\Form\Schema')->getMock(); <add> $schema = new Schema(); <ide> $this->assertSame($schema, $form->schema($schema)); <ide> $this->assertSame($schema, $form->schema()); <ide> <ide> public function testGetValidator() <ide> public function testSetValidator() <ide> { <ide> $form = new Form(); <del> $validator = $this->getMockBuilder('Cake\Validation\Validator')->getMock(); <add> $validator = new Validator(); <ide> <ide> $form->setValidator('default', $validator); <ide> $this->assertSame($validator, $form->getValidator()); <ide> public function testExecuteInvalid() <ide> */ <ide> public function testExecuteValid() <ide> { <del> $form = $this->getMockBuilder('Cake\Form\Form') <del> ->setMethods(['_execute']) <del> ->getMock(); <add> $form = new Form(); <ide> $form->getValidator() <ide> ->add('email', 'format', ['rule' => 'email']); <ide> $data = [ <ide> 'email' => 'test@example.com', <ide> ]; <del> $form->expects($this->once()) <del> ->method('_execute') <del> ->with($data) <del> ->will($this->returnValue(true)); <ide> <ide> $this->assertTrue($form->execute($data)); <ide> } <ide><path>tests/TestCase/Mailer/Transport/DebugTransportTest.php <ide> public function setUp(): void <ide> */ <ide> public function testSend() <ide> { <del> $message = $this->getMockBuilder(Message::class) <del> ->setMethods(['getBody']) <del> ->getMock(); <add> $message = new Message(); <ide> $message->setFrom('noreply@cakephp.org', 'CakePHP Test'); <ide> $message->setTo('cake@cakephp.org', 'CakePHP'); <ide> $message->setCc(['mark@cakephp.org' => 'Mark Story', 'juan@cakephp.org' => 'Juan Basso']); <ide> public function testSend() <ide> $message->setSubject('Testing Message'); <ide> $date = date(DATE_RFC2822); <ide> $message->setHeaders(['Date' => $date, 'o:tag' => ['foo', 'bar']]); <del> $message->expects($this->once())->method('getBody')->will($this->returnValue(['First Line', 'Second Line', '.Third Line', ''])); <add> $message->setBody(['text' => "First Line\nSecond Line\n.Third Line\n"]); <ide> <ide> $headers = "From: CakePHP Test <noreply@cakephp.org>\r\n"; <ide> $headers .= "To: CakePHP <cake@cakephp.org>\r\n"; <ide> public function testSend() <ide> <ide> $data = "First Line\r\n"; <ide> $data .= "Second Line\r\n"; <del> $data .= ".Third Line\r\n"; // Not use 'RFC5321 4.5.2.Transparency' in DebugTransport. <add> $data .= ".Third Line\r\n\r\n"; // Not use 'RFC5321 4.5.2.Transparency' in DebugTransport. <ide> <ide> $result = $this->DebugTransport->send($message); <ide> <ide><path>tests/TestCase/Mailer/Transport/MailTransportTest.php <ide> public function testSendWithoutRecipient() <ide> */ <ide> public function testSendData() <ide> { <del> $message = $this->getMockBuilder(Message::class) <del> ->setMethods(['getBody']) <del> ->getMock(); <add> $message = new Message(); <ide> $message->setFrom('noreply@cakephp.org', 'CakePHP Test'); <ide> $message->setReturnPath('pleasereply@cakephp.org', 'CakePHP Return'); <ide> $message->setTo('cake@cakephp.org', 'CakePHP'); <ide> public function testSendData() <ide> 'Date' => $date, <ide> 'X-add' => mb_encode_mimeheader($longNonAscii, 'utf8', 'B'), <ide> ]); <del> $message->expects($this->any())->method('getBody') <del> ->will($this->returnValue(['First Line', 'Second Line', '.Third Line', ''])); <add> $message->setBody(['text' => "First Line\nSecond Line\n.Third Line"]); <ide> <ide> $encoded = '=?UTF-8?B?Rm/DuCBCw6VyIELDqXogRm/DuCBCw6VyIELDqXogRm/DuCBCw6VyIELDqXog?='; <ide> $encoded .= ' =?UTF-8?B?Rm/DuCBCw6VyIELDqXo=?='; <ide> public function testSendData() <ide> ->with( <ide> 'CakePHP <cake@cakephp.org>', <ide> $encoded, <del> implode(PHP_EOL, ['First Line', 'Second Line', '.Third Line', '']), <add> implode(PHP_EOL, ['First Line', 'Second Line', '.Third Line', '', '']), <ide> $data, <ide> '-f' <ide> ); <ide><path>tests/TestCase/Mailer/Transport/SmtpTransportTest.php <ide> public function testRcptWithReturnPath() <ide> */ <ide> public function testSendData() <ide> { <del> $message = $this->getMockBuilder(Message::class) <del> ->setMethods(['getBody']) <del> ->getMock(); <del> /** @var \Cake\Mailer\Message $message */ <add> $message = new Message(); <ide> $message->setFrom('noreply@cakephp.org', 'CakePHP Test'); <ide> $message->setReturnPath('pleasereply@cakephp.org', 'CakePHP Return'); <ide> $message->setTo('cake@cakephp.org', 'CakePHP'); <ide> public function testSendData() <ide> $message->setSubject('Testing SMTP'); <ide> $date = date(DATE_RFC2822); <ide> $message->setHeaders(['Date' => $date]); <del> $message->expects($this->once()) <del> ->method('getBody') <del> ->will($this->returnValue(['First Line', 'Second Line', '.Third Line', ''])); <add> $message->setBody(['text' => "First Line\nSecond Line\n.Third Line"]); <ide> <ide> $data = "From: CakePHP Test <noreply@cakephp.org>\r\n"; <ide> $data .= "Return-Path: CakePHP Return <pleasereply@cakephp.org>\r\n"; <ide> public function testSendData() <ide> $data .= "\r\n"; <ide> $data .= "First Line\r\n"; <ide> $data .= "Second Line\r\n"; <del> $data .= "..Third Line\r\n"; // RFC5321 4.5.2.Transparency <add> $data .= "..Third Line\r\n\r\n"; // RFC5321 4.5.2.Transparency <ide> $data .= "\r\n"; <ide> $data .= "\r\n\r\n.\r\n"; <ide>
7
Python
Python
add some tests for ndarray.put
b1f8bcf451ef75344439d56c9953f6652af899d7
<ide><path>numpy/core/tests/test_multiarray.py <ide> def test_diagonal_memleak(self): <ide> a.diagonal() <ide> assert_(sys.getrefcount(a) < 50) <ide> <add> def test_put(self): <add> icodes = np.typecodes['AllInteger'] <add> fcodes = np.typecodes['AllFloat'] <add> for dt in icodes + fcodes + 'O': <add> tgt = np.array([0, 1, 0, 3, 0, 5], dtype=dt) <add> <add> # test 1-d <add> a = np.zeros(6, dtype=dt) <add> a.put([1, 3, 5], [1, 3, 5]) <add> assert_equal(a, tgt) <add> <add> # test 2-d <add> a = np.zeros((2, 3), dtype=dt) <add> a.put([1, 3, 5], [1, 3, 5]) <add> assert_equal(a, tgt.reshape(2, 3)) <add> <add> for dt in '?': <add> tgt = np.array([False, True, False, True, False, True], dtype=dt) <add> <add> # test 1-d <add> a = np.zeros(6, dtype=dt) <add> a.put([1, 3, 5], [True]*3) <add> assert_equal(a, tgt) <add> <add> # test 2-d <add> a = np.zeros((2, 3), dtype=dt) <add> a.put([1, 3, 5], [True]*3) <add> assert_equal(a, tgt.reshape(2, 3)) <add> <add> # check must be writeable <add> a = np.zeros(6) <add> a.flags.writeable = False <add> assert_raises(ValueError, a.put, [1, 3, 5], [1, 3, 5]) <add> <ide> def test_ravel(self): <ide> a = np.array([[0, 1], [2, 3]]) <ide> assert_equal(a.ravel(), [0, 1, 2, 3])
1
Javascript
Javascript
use custom separators for re-joining list items
c6c9d26e3487ce24ece390c26994123964f805b0
<ide><path>src/ng/directive/input.js <ide> var minlengthDirective = function() { <ide> * can be a fixed string (by default a comma) or a regular expression. <ide> * <ide> * @element input <del> * @param {string=} ngList optional delimiter that should be used to split the value. If <del> * specified in form `/something/` then the value will be converted into a regular expression. <add> * @param {string=} ngList optional delimiter that should be used to split the value. <ide> * <ide> * @example <ide> <example name="ngList-directive" module="listExample"> <ide> var ngListDirective = function() { <ide> return { <ide> require: 'ngModel', <ide> link: function(scope, element, attr, ctrl) { <del> var match = /\/(.*)\//.exec(attr.ngList), <del> separator = match && new RegExp(match[1]) || attr.ngList || ','; <add> var separator = attr.ngList || ', '; <ide> <ide> var parse = function(viewValue) { <ide> // If the viewValue is invalid (say required but empty) it will be `undefined` <ide> var ngListDirective = function() { <ide> var list = []; <ide> <ide> if (viewValue) { <del> forEach(viewValue.split(separator), function(value) { <add> forEach(viewValue.split(trim(separator)), function(value) { <ide> if (value) list.push(trim(value)); <ide> }); <ide> } <ide> var ngListDirective = function() { <ide> ctrl.$parsers.push(parse); <ide> ctrl.$formatters.push(function(value) { <ide> if (isArray(value)) { <del> return value.join(', '); <add> return value.join(separator); <ide> } <ide> <ide> return undefined; <ide><path>test/ng/directive/inputSpec.js <ide> describe('input', function() { <ide> it("should not clobber text if model changes due to itself", function() { <ide> // When the user types 'a,b' the 'a,' stage parses to ['a'] but if the <ide> // $parseModel function runs it will change to 'a', in essence preventing <del> // the user from ever typying ','. <add> // the user from ever typing ','. <ide> compileInput('<input type="text" ng-model="list" ng-list />'); <ide> <ide> changeInputValueTo('a '); <ide> describe('input', function() { <ide> it('should allow custom separator', function() { <ide> compileInput('<input type="text" ng-model="list" ng-list=":" />'); <ide> <add> scope.$apply(function() { <add> scope.list = ['x', 'y', 'z']; <add> }); <add> expect(inputElm.val()).toBe('x:y:z'); <add> <ide> changeInputValueTo('a,a'); <ide> expect(scope.list).toEqual(['a,a']); <ide> <ide> changeInputValueTo('a:b'); <ide> expect(scope.list).toEqual(['a', 'b']); <ide> }); <ide> <add> it('should ignore separator whitespace when splitting', function() { <add> compileInput('<input type="text" ng-model="list" ng-list=" | " />'); <ide> <del> it('should allow regexp as a separator', function() { <del> compileInput('<input type="text" ng-model="list" ng-list="/:|,/" />'); <del> <del> changeInputValueTo('a,b'); <add> changeInputValueTo('a|b'); <ide> expect(scope.list).toEqual(['a', 'b']); <del> <del> changeInputValueTo('a,b: c'); <del> expect(scope.list).toEqual(['a', 'b', 'c']); <ide> }); <ide> }); <ide>
2
Python
Python
remove testing changes
7b061670de8fe68c75ac282cd0355bd752f90d6c
<ide><path>integration/storage/test_azure_blobs.py <ide> from integration.storage.base import Integration, random_string <ide> <ide> # Prefix which is added to all the groups created by tests <del>RESOURCE_GROUP_NAME_PREFIX = 'libcloud' <del># RESOURCE_GROUP_NAME_PREFIX = 'libcloud-tests-' <add>RESOURCE_GROUP_NAME_PREFIX = 'libcloud-itests-' <ide> DEFAULT_TIMEOUT_SECONDS = 300 <ide> DEFAULT_AZURE_LOCATION = 'EastUS2' <ide> MAX_STORAGE_ACCOUNT_NAME_LENGTH = 24 <ide> def setUpClass(cls): <ide> <ide> for resource_group in resource_groups: <ide> resource_create_ts = resource_group.tags.get('create_ts', now_ts) <del> resource_create_ts = int(resource_group.tags.get('create_ts', <del> delete_threshold_ts - 100)) <ide> <ide> if resource_group.name.startswith(RESOURCE_GROUP_NAME_PREFIX) and \ <ide> resource_group.location.lower() == location.lower() and \
1
Python
Python
set version to v2.2.2.dev0
3f6cb618a9ec584dd8ac4bcfec97b2f8ec35a725
<ide><path>spacy/about.py <ide> # fmt: off <ide> __title__ = "spacy" <del>__version__ = "2.2.1" <add>__version__ = "2.2.2.dev0" <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
Javascript
Javascript
fix spec, cleanup
3123a926871c9ee25bf495bbf3828f7434851e47
<ide><path>spec/update-process-env-spec.js <ide> describe('updateProcessEnv(launchEnv)', function () { <ide> process.env = {FOO: 'bar'} <ide> <ide> await updateProcessEnv(process.env) <del> expect(child_process.execFile).not.toHaveBeenCalled() <add> expect(child_process.spawn).not.toHaveBeenCalled() <ide> expect(process.env).toEqual({FOO: 'bar'}) <ide> }) <ide> }) <ide><path>src/update-process-env.js <ide> async function getEnvFromShell (env) { <ide> console.log(error) <ide> } <ide> <del> if (stdout && stdout.trim() !== '') { <del> let result = {} <del> for (let line of stdout.split('\n')) { <del> if (line.includes('=')) { <del> let components = line.split('=') <del> let key = components.shift() <del> let value = components.join('=') <del> result[key] = value <del> } <add> if (!stdout || stdout.trim() === '') { <add> return null <add> } <add> <add> let result = {} <add> for (let line of stdout.split('\n')) { <add> if (line.includes('=')) { <add> let components = line.split('=') <add> let key = components.shift() <add> let value = components.join('=') <add> result[key] = value <ide> } <del> return result <ide> } <add> return result <ide> } <ide> <ide> export default { updateProcessEnv, shouldGetEnvFromShell }
2
Javascript
Javascript
remove copypasta comment
7991a00dcc2b2fb521324b0fddeca55d567d79e5
<ide><path>src/renderers/shared/fiber/ReactFiberClassComponent.js <ide> module.exports = function(scheduleUpdate : (fiber: Fiber, priorityLevel : Priori <ide> <ide> const state = instance.state || null; <ide> <del> // A class component update is the result of either new props or new state. <del> // Account for the possibly of missing pending props by falling back to the <del> // memoized props. <ide> let props = workInProgress.pendingProps; <ide> if (!props) { <ide> throw new Error('There must be pending props for an initial mount.');
1
PHP
PHP
refactor the session class
04a1e44e6e94e1b2176cf3d5a4c0af9198ea0a7f
<ide><path>system/session.php <ide> private static function age_flash() <ide> */ <ide> private static function write_cookie() <ide> { <del> extract(Config::get('session')); <del> <ide> if ( ! headers_sent()) <ide> { <add> extract(Config::get('session')); <add> <ide> $minutes = ($expire_on_close) ? 0 : $lifetime; <ide> <ide> Cookie::put('laravel_session', static::$session['id'], $minutes, $path, $domain, $https, $http_only);
1
Java
Java
clarify the format supported by @propertysource
d1a0b8d53f92ec410d51bdd89aee979107541bd4
<ide><path>spring-context/src/main/java/org/springframework/context/annotation/PropertySource.java <ide> <ide> /** <ide> * Indicate the resource location(s) of the properties file to be loaded. <del> * For example, {@code "classpath:/com/myco/app.properties"} or <del> * {@code "file:/path/to/file"}. <add> * <p>Both traditional and XML-based properties file formats are supported <add> * &mdash; for example, {@code "classpath:/com/myco/app.properties"} <add> * or {@code "file:/path/to/file.xml"}. <ide> * <p>Resource location wildcards (e.g. *&#42;/*.properties) are not permitted; <ide> * each location must evaluate to exactly one {@code .properties} resource. <ide> * <p>${...} placeholders will be resolved against any/all property sources already
1
Text
Text
update examples readme
b7b285971fb2e0f058e83ebebc4834cb670c4a7c
<ide><path>examples/README.md <ide> <ide> # spaCy examples <ide> <del>The examples are Python scripts with well-behaved command line interfaces. For a full list of spaCy tutorials and code snippets, see the [documentation](https://spacy.io/docs/usage/tutorials). <add>The examples are Python scripts with well-behaved command line interfaces. For <add>more detailed usage guides, see the [documentation](https://alpha.spacy.io/usage/). <ide> <del>## How to run an example <del> <del>For example, to run the [`nn_text_class.py`](nn_text_class.py) script, do: <add>To see the available arguments, you can use the `--help` or `-h` flag: <ide> <ide> ```bash <del>$ python examples/nn_text_class.py <del>usage: nn_text_class.py [-h] [-d 3] [-H 300] [-i 5] [-w 40000] [-b 24] <del> [-r 0.3] [-p 1e-05] [-e 0.005] <del> data_dir <del>nn_text_class.py: error: too few arguments <add>$ python examples/training/train_ner.py --help <ide> ``` <ide> <del>You can print detailed help with the `-h` argument. <del> <del>While we try to keep the examples up to date, they are not currently exercised by the test suite, as some of them require significant data downloads or take time to train. If you find that an example is no longer running, [please tell us](https://github.com/explosion/spaCy/issues)! We know there's nothing worse than trying to figure out what you're doing wrong, and it turns out your code was never the problem. <add>While we try to keep the examples up to date, they are not currently exercised <add>by the test suite, as some of them require significant data downloads or take <add>time to train. If you find that an example is no longer running, <add>[please tell us](https://github.com/explosion/spaCy/issues)! We know there's <add>nothing worse than trying to figure out what you're doing wrong, and it turns <add>out your code was never the problem.
1
Go
Go
move "stop" to daemon/stop.go
03c07617cce5167ac854ff84637be9cccef39328
<ide><path>daemon/daemon.go <ide> func (daemon *Daemon) Install(eng *engine.Engine) error { <ide> if err := eng.Register("create", daemon.ContainerCreate); err != nil { <ide> return err <ide> } <add> if err := eng.Register("stop", daemon.ContainerStop); err != nil { <add> return err <add> } <ide> return nil <ide> } <ide> <ide><path>daemon/stop.go <add>package daemon <add> <add>import ( <add> "github.com/docker/docker/engine" <add>) <add> <add>func (daemon *Daemon) ContainerStop(job *engine.Job) engine.Status { <add> if len(job.Args) != 1 { <add> return job.Errorf("Usage: %s CONTAINER\n", job.Name) <add> } <add> var ( <add> name = job.Args[0] <add> t = 10 <add> ) <add> if job.EnvExists("t") { <add> t = job.GetenvInt("t") <add> } <add> if container := daemon.Get(name); container != nil { <add> if !container.State.IsRunning() { <add> return job.Errorf("Container already stopped") <add> } <add> if err := container.Stop(int(t)); err != nil { <add> return job.Errorf("Cannot stop container %s: %s\n", name, err) <add> } <add> job.Eng.Job("log", "stop", container.ID, daemon.Repositories().ImageName(container.Image)).Run() <add> } else { <add> return job.Errorf("No such container: %s\n", name) <add> } <add> return engine.StatusOK <add>} <ide><path>server/container.go <ide> func (srv *Server) ContainerStart(job *engine.Job) engine.Status { <ide> return engine.StatusOK <ide> } <ide> <del>func (srv *Server) ContainerStop(job *engine.Job) engine.Status { <del> if len(job.Args) != 1 { <del> return job.Errorf("Usage: %s CONTAINER\n", job.Name) <del> } <del> var ( <del> name = job.Args[0] <del> t = 10 <del> ) <del> if job.EnvExists("t") { <del> t = job.GetenvInt("t") <del> } <del> if container := srv.daemon.Get(name); container != nil { <del> if !container.State.IsRunning() { <del> return job.Errorf("Container already stopped") <del> } <del> if err := container.Stop(int(t)); err != nil { <del> return job.Errorf("Cannot stop container %s: %s\n", name, err) <del> } <del> srv.LogEvent("stop", container.ID, srv.daemon.Repositories().ImageName(container.Image)) <del> } else { <del> return job.Errorf("No such container: %s\n", name) <del> } <del> return engine.StatusOK <del>} <del> <ide> func (srv *Server) ContainerWait(job *engine.Job) engine.Status { <ide> if len(job.Args) != 1 { <ide> return job.Errorf("Usage: %s", job.Name) <ide><path>server/init.go <ide> func InitServer(job *engine.Job) engine.Status { <ide> job.Eng.Hack_SetGlobalVar("httpapi.daemon", srv.daemon) <ide> <ide> for name, handler := range map[string]engine.Handler{ <del> "stop": srv.ContainerStop, <ide> "restart": srv.ContainerRestart, <ide> "start": srv.ContainerStart, <ide> "wait": srv.ContainerWait,
4
Javascript
Javascript
improve test coverage of native crypto code
7710235ec35586c15f83e826926ea8bfe2a35a22
<ide><path>test/parallel/test-crypto-cipheriv-decipheriv.js <ide> for (let n = 1; n < 256; n += 1) { <ide> if (common.hasFipsCrypto && n < 12) continue; <ide> crypto.createCipheriv('aes-128-gcm', Buffer.alloc(16), Buffer.alloc(n)); <ide> } <add> <add>{ <add> // Passing an invalid cipher name should throw. <add> assert.throws( <add> () => crypto.createCipheriv('aes-127', Buffer.alloc(16), null), <add> /Unknown cipher/); <add> <add> // Passing a key with an invalid length should throw. <add> assert.throws( <add> () => crypto.createCipheriv('aes-128-ecb', Buffer.alloc(17), null), <add> /Invalid key length/); <add>} <ide><path>test/parallel/test-crypto-hmac.js <ide> common.expectsError( <ide> assert.deepStrictEqual(h.digest('latin1'), ''); <ide> } <ide> } <add> <add>{ <add> assert.throws( <add> () => crypto.createHmac('sha7', 'key'), <add> /Unknown message digest/); <add>} <ide><path>test/parallel/test-crypto-sign-verify.js <ide> common.expectsError( <ide> assert.throws(() => verify.verify('test', input), errObj); <ide> }); <ide> } <add> <add>{ <add> assert.throws( <add> () => crypto.createSign('sha8'), <add> /Unknown message digest/); <add>}
3
Text
Text
fix style= formatting in v15 rc blog post
8c57fd9d311c62f71a6e54462f161e857c78a550
<ide><path>docs/_posts/2016-03-07-react-v15-rc1.md <ide> Each of these changes will continue to work as before with a new warning until t <ide> ### New helpful warnings <ide> <ide> - If you use a minified copy of the _development_ build, React DOM kindly encourages you to use the faster production build instead. <del>- React DOM: When specifying a unit-less CSS value as a string, a future version will not add `px` automatically. This version now warns in this case (ex: writing `style={{width: '300'}}`. (Unitless *number* values like `width: 300` are unchanged.) <add>- React DOM: When specifying a unit-less CSS value as a string, a future version will not add `px` automatically. This version now warns in this case (ex: writing `style={{'{{'}}width: '300'}}`. (Unitless *number* values like `width: 300` are unchanged.) <ide> - Synthetic Events will now warn when setting and accessing properties (which will not get cleared appropriately), as well as warn on access after an event has been returned to the pool. <ide> - Elements will now warn when attempting to read `ref` and `key` from the props. <ide> - React DOM now attempts to warn for mistyped event handlers on DOM elements (ex: `onclick` which should be `onClick`)
1
Python
Python
add example for np.ma.power as part of
723f0eb315cfb16f913ddc4d9ac16bde738809f6
<ide><path>numpy/ma/core.py <ide> def power(a, b, third=None): <ide> The *out* argument to `numpy.power` is not supported, `third` has to be <ide> None. <ide> <add> Examples <add> -------- <add> >>> import numpy.ma as ma <add> >>> x = [11.2, -3.973, 0.801, -1.41] <add> >>> mask = [0, 0, 0, 1] <add> >>> masked_x = ma.masked_array(x, mask) <add> >>> masked_x <add> masked_array(data=[11.2, -3.973, 0.801, --], <add> mask=[False, False, False, True], <add> fill_value=1e+20) <add> >>> ma.power(masked_x, 2) <add> masked_array(data=[125.43999999999998, 15.784728999999999, <add> 0.6416010000000001, --], <add> mask=[False, False, False, True], <add> fill_value=1e+20) <add> >>> y = [-0.5, 2, 0, 17] <add> >>> masked_y = ma.masked_array(y, mask) <add> >>> masked_y <add> masked_array(data=[-0.5, 2.0, 0.0, --], <add> mask=[False, False, False, True], <add> fill_value=1e+20) <add> >>> ma.power(masked_x, masked_y) <add> masked_array(data=[0.29880715233359845, 15.784728999999999, 1.0, --], <add> mask=[False, False, False, True], <add> fill_value=1e+20) <add> <ide> """ <ide> if third is not None: <ide> raise MaskError("3-argument power not supported.")
1
Go
Go
fix merge issue
76a568fc9717ff69999ab54fba9277a0d31c305d
<ide><path>utils/utils.go <ide> func (r *progressReader) Read(p []byte) (n int, err error) { <ide> } <ide> if r.readProgress-r.lastUpdate > updateEvery || err != nil { <ide> if r.readTotal > 0 { <del> fmt.Fprintf(r.output, r.template, HumanSize(r.readProgress), HumanSize(r.readTotal), fmt.Sprintf("%.0f%%", float64(r.readProgress)/float64(r.readTotal)*100)) <add> fmt.Fprintf(r.output, r.template, HumanSize(int64(r.readProgress)), HumanSize(int64(r.readTotal)), fmt.Sprintf("%.0f%%", float64(r.readProgress)/float64(r.readTotal)*100)) <ide> } else { <ide> fmt.Fprintf(r.output, r.template, r.readProgress, "?", "n/a") <ide> } <ide> func ProgressReader(r io.ReadCloser, size int, output io.Writer, template []byte <ide> return &progressReader{r, NewWriteFlusher(output), size, 0, 0, tpl, sf} <ide> } <ide> <del>func HumanSize(origSize int) string { <del> size := float64(origSize) <del> for _, unit := range []string{"b", "Kb", "Mb", "Gb", "Tb"} { <del> if int(size)/1024 == 0 { <del> return fmt.Sprintf("%.03f%s", size, unit) <del> } else { <del> size = size / 1024 <del> } <del> } <del> return strconv.Itoa(origSize) <del>} <del> <ide> // HumanDuration returns a human-readable approximation of a duration <ide> // (eg. "About a minute", "4 hours ago", etc.) <ide> func HumanDuration(d time.Duration) string {
1
PHP
PHP
remove trailing ;
30c4c54b5d973bd01a9e39085d35f5ad98048042
<ide><path>lib/Cake/Network/Http/Response.php <ide> protected function _parseHeaders($headers) { <ide> * @return void <ide> */ <ide> protected function _parseCookie($value) { <add> $value = rtrim($value, ';'); <ide> $nestedSemi = '";"'; <ide> if (strpos($value, $nestedSemi) !== false) { <ide> $value = str_replace($nestedSemi, "{__cookie_replace__}", $value); <ide><path>lib/Cake/Test/TestCase/Network/Http/ResponseTest.php <ide> public function testCookie() { <ide> 'HTTP/1.0 200 Ok', <ide> 'Set-Cookie: test=value', <ide> 'Set-Cookie: session=123abc', <del> 'Set-Cookie: expiring=soon; Expires=Wed, 09-Jun-2021 10:18:14 GMT; Path=/; HttpOnly; Secure', <add> 'Set-Cookie: expiring=soon; Expires=Wed, 09-Jun-2021 10:18:14 GMT; Path=/; HttpOnly; Secure;', <ide> ]; <ide> $response = new Response($headers, ''); <ide> $this->assertEquals('value', $response->cookie('test'));
2
PHP
PHP
move fromreadablesize to parsefilesize
0c0a2aacd53147d441b3c6cab2f3c90d678f7d45
<ide><path>src/I18n/Number.php <ide> */ <ide> namespace Cake\I18n; <ide> <del>use Cake\Core\Exception\Exception; <ide> use NumberFormatter; <ide> <ide> /** <ide> public static function toReadableSize($size) { <ide> return __d('cake', '{0,number,#,###.##} TB', $size / 1024 / 1024 / 1024 / 1024); <ide> } <ide> } <del> <del>/** <del> * Converts filesize from human readable string to bytes <del> * <del> * @param string $size Size in human readable string like '5MB', '5M', '500B', '50kb' etc. <del> * @param mixed $default Value to be returned when invalid size was used, for example 'Unknown type' <del> * @return mixed Number of bytes as integer on success, `$default` on failure if not false <del> * @throws \Cake\Core\Exception\Exception On invalid Unit type. <del> * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/number.html#NumberHelper::fromReadableSize <del> */ <del> public static function fromReadableSize($size, $default = false) { <del> if (ctype_digit($size)) { <del> return (int)$size; <del> } <del> $size = strtoupper($size); <del> <del> $l = -2; <del> $i = array_search(substr($size, -2), array('KB', 'MB', 'GB', 'TB', 'PB')); <del> if ($i === false) { <del> $l = -1; <del> $i = array_search(substr($size, -1), array('K', 'M', 'G', 'T', 'P')); <del> } <del> if ($i !== false) { <del> $size = substr($size, 0, $l); <del> return $size * pow(1024, $i + 1); <del> } <del> <del> if (substr($size, -1) === 'B' && ctype_digit(substr($size, 0, -1))) { <del> $size = substr($size, 0, -1); <del> return (int)$size; <del> } <del> <del> if ($default !== false) { <del> return $default; <del> } <del> throw new Exception('No unit type.'); <del> } <ide> <ide> /** <ide> * Formats a number into a percentage string. <ide><path>src/Utility/String.php <ide> */ <ide> namespace Cake\Utility; <ide> <add>use Cake\Core\Exception\Exception; <add> <ide> /** <ide> * String handling methods. <ide> * <ide> public static function ascii(array $array) { <ide> return $ascii; <ide> } <ide> <add>/** <add> * Converts filesize from human readable string to bytes <add> * <add> * @param string $size Size in human readable string like '5MB', '5M', '500B', '50kb' etc. <add> * @param mixed $default Value to be returned when invalid size was used, for example 'Unknown type' <add> * @return mixed Number of bytes as integer on success, `$default` on failure if not false <add> * @throws \Cake\Core\Exception\Exception On invalid Unit type. <add> * @link http://book.cakephp.org/3.0/en/core-libraries/helpers/text.html <add> */ <add> public static function parseFileSize($size, $default = false) { <add> if (ctype_digit($size)) { <add> return (int)$size; <add> } <add> $size = strtoupper($size); <add> <add> $l = -2; <add> $i = array_search(substr($size, -2), array('KB', 'MB', 'GB', 'TB', 'PB')); <add> if ($i === false) { <add> $l = -1; <add> $i = array_search(substr($size, -1), array('K', 'M', 'G', 'T', 'P')); <add> } <add> if ($i !== false) { <add> $size = substr($size, 0, $l); <add> return $size * pow(1024, $i + 1); <add> } <add> <add> if (substr($size, -1) === 'B' && ctype_digit(substr($size, 0, -1))) { <add> $size = substr($size, 0, -1); <add> return (int)$size; <add> } <add> <add> if ($default !== false) { <add> return $default; <add> } <add> throw new Exception('No unit type.'); <add> } <add> <add> <ide> } <ide><path>src/Validation/Validation.php <ide> */ <ide> namespace Cake\Validation; <ide> <del>use Cake\I18n\Number; <add>use Cake\Utility\String; <ide> use RuntimeException; <ide> <ide> /** <ide> public static function fileSize($check, $operator = null, $size = null) { <ide> } <ide> <ide> if (is_string($size)) { <del> $size = Number::fromReadableSize($size); <add> $size = String::parseFileSize($size); <ide> } <ide> $filesize = filesize($check); <ide> <ide><path>tests/TestCase/I18n/NumberTest.php <ide> public function testReadableSizeLocalized() { <ide> $this->assertEquals('512,05 GB', $result); <ide> } <ide> <del>/** <del> * testFromReadableSize <del> * <del> * @dataProvider filesizes <del> * @return void <del> */ <del> public function testFromReadableSize($params, $expected) { <del> $result = $this->Number->fromReadableSize($params['size'], $params['default']); <del> $this->assertEquals($expected, $result); <del> } <del> <del>/** <del> * testFromReadableSize <del> * <del> * @expectedException \Cake\Core\Exception\Exception <del> * @return void <del> */ <del> public function testFromReadableSizeException() { <del> $this->Number->fromReadableSize('bogus', false); <del> } <del> <del>/** <del> * filesizes dataprovider <del> * <del> * @return array <del> */ <del> public function filesizes() { <del> return array( <del> array(array('size' => '512B', 'default' => false), 512), <del> array(array('size' => '1KB', 'default' => false), 1024), <del> array(array('size' => '1.5KB', 'default' => false), 1536), <del> array(array('size' => '1MB', 'default' => false), 1048576), <del> array(array('size' => '1mb', 'default' => false), 1048576), <del> array(array('size' => '1.5MB', 'default' => false), 1572864), <del> array(array('size' => '1GB', 'default' => false), 1073741824), <del> array(array('size' => '1.5GB', 'default' => false), 1610612736), <del> array(array('size' => '1K', 'default' => false), 1024), <del> array(array('size' => '1.5K', 'default' => false), 1536), <del> array(array('size' => '1M', 'default' => false), 1048576), <del> array(array('size' => '1m', 'default' => false), 1048576), <del> array(array('size' => '1.5M', 'default' => false), 1572864), <del> array(array('size' => '1G', 'default' => false), 1073741824), <del> array(array('size' => '1.5G', 'default' => false), 1610612736), <del> array(array('size' => '512', 'default' => 'Unknown type'), 512), <del> array(array('size' => '2VB', 'default' => 'Unknown type'), 'Unknown type') <del> ); <del> } <del> <ide> } <ide><path>tests/TestCase/Utility/StringTest.php <ide> public function testAscii() { <ide> $this->assertEquals($expected, $result); <ide> } <ide> <add>/** <add> * testparseFileSize <add> * <add> * @dataProvider filesizes <add> * @return void <add> */ <add> public function testparseFileSize($params, $expected) { <add> $result = String::parseFileSize($params['size'], $params['default']); <add> $this->assertEquals($expected, $result); <add> } <add> <add>/** <add> * testFromReadableSize <add> * <add> * @expectedException \Cake\Core\Exception\Exception <add> * @return void <add> */ <add> public function testparseFileSizeException() { <add> String::parseFileSize('bogus', false); <add> } <add> <add>/** <add> * filesizes dataprovider <add> * <add> * @return array <add> */ <add> public function filesizes() { <add> return array( <add> array(array('size' => '512B', 'default' => false), 512), <add> array(array('size' => '1KB', 'default' => false), 1024), <add> array(array('size' => '1.5KB', 'default' => false), 1536), <add> array(array('size' => '1MB', 'default' => false), 1048576), <add> array(array('size' => '1mb', 'default' => false), 1048576), <add> array(array('size' => '1.5MB', 'default' => false), 1572864), <add> array(array('size' => '1GB', 'default' => false), 1073741824), <add> array(array('size' => '1.5GB', 'default' => false), 1610612736), <add> array(array('size' => '1K', 'default' => false), 1024), <add> array(array('size' => '1.5K', 'default' => false), 1536), <add> array(array('size' => '1M', 'default' => false), 1048576), <add> array(array('size' => '1m', 'default' => false), 1048576), <add> array(array('size' => '1.5M', 'default' => false), 1572864), <add> array(array('size' => '1G', 'default' => false), 1073741824), <add> array(array('size' => '1.5G', 'default' => false), 1610612736), <add> array(array('size' => '512', 'default' => 'Unknown type'), 512), <add> array(array('size' => '2VB', 'default' => 'Unknown type'), 'Unknown type') <add> ); <add> } <add> <ide> }
5
Ruby
Ruby
improve debugging output
1702b34f18f1244d913482d848fd64bb7a771009
<ide><path>Library/Homebrew/dev-cmd/update-test.rb <ide> def update_test <ide> safe_system "brew", "update", "--verbose" <ide> actual_end_commit = Utils.popen_read("git", "rev-parse", branch).chomp <ide> if actual_end_commit != end_commit <add> start_log = Utils.popen_read("git", "log", "-1", "--decorate", "--oneline", start_commit).chomp <add> end_log = Utils.popen_read("git", "log", "-1", "--decorate", "--oneline", end_commit).chomp <add> actual_log = Utils.popen_read("git", "log", "-1", "--decorate", "--oneline", actual_end_commit).chomp <ide> raise <<~EOS <ide> brew update didn't update #{branch}! <del> Start commit: #{start_commit} <del> Expected end commit: #{end_commit} <del> Actual end commit: #{actual_end_commit} <add> Start commit: #{start_log} <add> Expected end commit: #{end_log} <add> Actual end commit: #{actual_log} <ide> EOS <ide> end <ide> end
1
Java
Java
avoid npe on comment sse event
5d8c5b0d9bf1ecb3b902ed55c320a4ea4fae0b38
<ide><path>spring-web/src/main/java/org/springframework/http/codec/ServerSentEventHttpMessageReader.java <ide> public Flux<Object> read( <ide> return this.lineDecoder.decode(message.getBody(), STRING_TYPE, null, hints) <ide> .doOnNext(limitTracker::afterLineParsed) <ide> .bufferUntil(String::isEmpty) <del> .map(lines -> buildEvent(lines, valueType, shouldWrap, hints)); <add> .concatMap(lines -> { <add> Object event = buildEvent(lines, valueType, shouldWrap, hints); <add> return (event != null ? Mono.just(event) : Mono.empty()); <add> }); <ide> } <ide> <ide> @Nullable <ide> else if (line.startsWith(":")) { <ide> } <ide> } <ide> <del> Object decodedData = data != null ? decodeData(data.toString(), valueType, hints) : null; <add> Object decodedData = (data != null ? decodeData(data.toString(), valueType, hints) : null); <ide> <ide> if (shouldWrap) { <ide> if (comment != null) { <ide> else if (line.startsWith(":")) { <ide> return sseBuilder.build(); <ide> } <ide> else { <del> return decodedData; <add> return (decodedData); <ide> } <ide> } <ide> <ide><path>spring-web/src/test/java/org/springframework/http/codec/ServerSentEventHttpMessageReaderTests.java <ide> public void readPojo() { <ide> .verify(); <ide> } <ide> <add> @Test // gh-24389 <add> void readPojoWithCommentOnly() { <add> MockServerHttpRequest request = MockServerHttpRequest.post("/") <add> .body(Flux.just(stringBuffer(":ping\n"), stringBuffer("\n"))); <add> <add> Flux<Object> data = this.reader.read( <add> ResolvableType.forType(String.class), request, Collections.emptyMap()); <add> <add> StepVerifier.create(data).expectComplete().verify(); <add> } <add> <ide> @Test // SPR-15331 <ide> public void decodeFullContentAsString() { <ide> String body = "data:foo\ndata:bar\n\ndata:baz\n\n";
2
Ruby
Ruby
fix style problems in migrator
a29832484c8ccceeb5437d4793d3a6c186cb304c
<ide><path>Library/Homebrew/migrator.rb <ide> def initialize(formula, tap) <ide> end <ide> end <ide> <add> # instance of new name formula <ide> attr_reader :formula <del> attr_reader :oldname, :oldpath, :old_pin_record, :old_opt_record <del> attr_reader :old_linked_keg_record, :oldkeg, :old_tabs, :old_tap <del> attr_reader :newname, :newpath, :new_pin_record <add> <add> # old name of the formula <add> attr_reader :oldname <add> <add> # path to oldname's cellar <add> attr_reader :old_cellar <add> <add> # path to oldname pin <add> attr_reader :old_pin_record <add> <add> # path to oldname opt <add> attr_reader :old_opt_record <add> <add> # oldname linked keg <add> attr_reader :old_linked_keg <add> <add> # path to oldname's linked keg <add> attr_reader :old_linked_keg_record <add> <add> # tabs from oldname kegs <add> attr_reader :old_tabs <add> <add> # tap of the old name <add> attr_reader :old_tap <add> <add> # resolved path to oldname pin <ide> attr_reader :old_pin_link_record <ide> <del> # Path to new linked keg <del> attr_reader :new_keg <add> # new name of the formula <add> attr_reader :newname <add> <add> # path to newname cellar according to new name <add> attr_reader :new_cellar <add> <add> # path to newname pin <add> attr_reader :new_pin_record <add> <add> # path to newname keg that will be linked if old_linked_keg isn't nil <add> attr_reader :new_linked_keg_record <ide> <ide> def initialize(formula) <ide> @oldname = formula.oldname <ide> @newname = formula.name <ide> raise MigratorNoOldnameError.new(formula) unless oldname <ide> <ide> @formula = formula <del> @oldpath = HOMEBREW_CELLAR/formula.oldname <del> raise MigratorNoOldpathError.new(formula) unless oldpath.exist? <add> @old_cellar = HOMEBREW_CELLAR/formula.oldname <add> raise MigratorNoOldpathError.new(formula) unless old_cellar.exist? <ide> <del> @old_tabs = oldpath.subdirs.map { |d| Tab.for_keg(Keg.new(d)) } <add> @old_tabs = old_cellar.subdirs.map { |d| Tab.for_keg(Keg.new(d)) } <ide> @old_tap = old_tabs.first.tap <ide> <ide> if !ARGV.force? && !from_same_taps? <ide> raise MigratorDifferentTapsError.new(formula, old_tap) <ide> end <ide> <del> @newpath = HOMEBREW_CELLAR/formula.name <add> @new_cellar = HOMEBREW_CELLAR/formula.name <ide> <del> if @oldkeg = get_linked_oldkeg <del> @old_linked_keg_record = oldkeg.linked_keg_record if oldkeg.linked? <del> @old_opt_record = oldkeg.opt_record if oldkeg.optlinked? <del> @new_keg = HOMEBREW_CELLAR/"#{newname}/#{File.basename(oldkeg)}" <add> if @old_linked_keg = get_linked_old_linked_keg <add> @old_linked_keg_record = old_linked_keg.linked_keg_record if old_linked_keg.linked? <add> @old_opt_record = old_linked_keg.opt_record if old_linked_keg.optlinked? <add> @new_linked_keg_record = HOMEBREW_CELLAR/"#{newname}/#{File.basename(old_linked_keg)}" <ide> end <ide> <ide> @old_pin_record = HOMEBREW_LIBRARY/"PinnedKegs"/oldname <ide> def from_same_taps? <ide> end <ide> end <ide> <del> def get_linked_oldkeg <del> kegs = oldpath.subdirs.map { |d| Keg.new(d) } <add> def get_linked_old_linked_keg <add> kegs = old_cellar.subdirs.map { |d| Keg.new(d) } <ide> kegs.detect(&:linked?) || kegs.detect(&:optlinked?) <ide> end <ide> <ide> def pinned? <ide> @pinned <ide> end <ide> <del> def oldkeg_linked? <del> !!oldkeg <del> end <del> <ide> def migrate <del> if newpath.exist? <del> onoe "#{newpath} already exists; remove it manually and run brew migrate #{oldname}." <add> if new_cellar.exist? <add> onoe "#{new_cellar} already exists; remove it manually and run brew migrate #{oldname}." <ide> return <ide> end <ide> <ide> def migrate <ide> unlink_oldname <ide> move_to_new_directory <ide> repin <del> link_newname if oldkeg_linked? <add> link_newname unless old_linked_keg.nil? <ide> link_oldname_opt <ide> link_oldname_cellar <ide> update_tabs <ide> def migrate <ide> <ide> # move everything from Cellar/oldname to Cellar/newname <ide> def move_to_new_directory <del> puts "Moving to: #{newpath}" <del> FileUtils.mv(oldpath, newpath) <add> puts "Moving to: #{new_cellar}" <add> FileUtils.mv(old_cellar, new_cellar) <ide> end <ide> <ide> def repin <ide> def repin <ide> <ide> def unlink_oldname <ide> oh1 "Unlinking #{Tty.green}#{oldname}#{Tty.reset}" <del> oldpath.subdirs.each do |d| <add> old_cellar.subdirs.each do |d| <ide> keg = Keg.new(d) <ide> keg.unlink <ide> end <ide> end <ide> <ide> def link_newname <ide> oh1 "Linking #{Tty.green}#{newname}#{Tty.reset}" <del> keg = Keg.new(new_keg) <add> new_keg = Keg.new(new_linked_keg_record) <ide> <ide> # If old_keg wasn't linked then we just optlink a keg. <ide> # If old keg wasn't optlinked and linked, we don't call this method at all. <ide> # If formula is keg-only we also optlink it. <ide> if formula.keg_only? || !old_linked_keg_record <ide> begin <del> keg.optlink <add> new_keg.optlink <ide> rescue Keg::LinkError => e <ide> onoe "Failed to create #{formula.opt_prefix}" <ide> raise <ide> end <ide> return <ide> end <ide> <del> keg.remove_linked_keg_record if keg.linked? <add> new_keg.remove_linked_keg_record if new_keg.linked? <ide> <ide> begin <del> keg.link <add> new_keg.link <ide> rescue Keg::ConflictError => e <ide> onoe "Error while executing `brew link` step on #{newname}" <ide> puts e <ide> puts <ide> puts "Possible conflicting files are:" <ide> mode = OpenStruct.new(:dry_run => true, :overwrite => true) <del> keg.link(mode) <add> new_keg.link(mode) <ide> raise <ide> rescue Keg::LinkError => e <ide> onoe "Error while linking" <ide> def link_newname <ide> onoe "An unexpected error occurred during linking" <ide> puts e <ide> puts e.backtrace if ARGV.debug? <del> ignore_interrupts { keg.unlink } <add> ignore_interrupts { new_keg.unlink } <ide> raise <ide> end <ide> end <ide> def link_newname <ide> def link_oldname_opt <ide> if old_opt_record <ide> old_opt_record.delete if old_opt_record.symlink? <del> old_opt_record.make_relative_symlink(new_keg) <add> old_opt_record.make_relative_symlink(new_linked_keg_record) <ide> end <ide> end <ide> <ide> # After migtaion every INSTALL_RECEIPT.json has wrong path to the formula <ide> # so we must update INSTALL_RECEIPTs <ide> def update_tabs <del> new_tabs = newpath.subdirs.map { |d| Tab.for_keg(Keg.new(d)) } <add> new_tabs = new_cellar.subdirs.map { |d| Tab.for_keg(Keg.new(d)) } <ide> new_tabs.each do |tab| <ide> tab.source["path"] = formula.path.to_s if tab.source["path"] <ide> tab.write <ide> def update_tabs <ide> def unlink_oldname_opt <ide> return unless old_opt_record <ide> if old_opt_record.symlink? && old_opt_record.exist? \ <del> && new_keg.exist? \ <del> && new_keg.realpath == old_opt_record.realpath <add> && new_linked_keg_record.exist? \ <add> && new_linked_keg_record.realpath == old_opt_record.realpath <ide> old_opt_record.unlink <ide> old_opt_record.parent.rmdir_if_possible <ide> end <ide> end <ide> <del> # Remove oldpath if it exists <add> # Remove old_cellar if it exists <ide> def link_oldname_cellar <del> oldpath.delete if oldpath.symlink? || oldpath.exist? <del> oldpath.make_relative_symlink(formula.rack) <add> old_cellar.delete if old_cellar.symlink? || old_cellar.exist? <add> old_cellar.make_relative_symlink(formula.rack) <ide> end <ide> <ide> # Remove Cellar/oldname link if it belongs to newname. <ide> def unlink_oldname_cellar <del> if (oldpath.symlink? && !oldpath.exist?) || (oldpath.symlink? \ <del> && formula.rack.exist? && formula.rack.realpath == oldpath.realpath) <del> oldpath.unlink <add> if (old_cellar.symlink? && !old_cellar.exist?) || (old_cellar.symlink? \ <add> && formula.rack.exist? && formula.rack.realpath == old_cellar.realpath) <add> old_cellar.unlink <ide> end <ide> end <ide> <ide> def backup_oldname <ide> new_pin_record.delete <ide> end <ide> <del> if newpath.exist? <del> newpath.subdirs.each do |d| <add> if new_cellar.exist? <add> new_cellar.subdirs.each do |d| <ide> newname_keg = Keg.new(d) <ide> newname_keg.unlink <ide> newname_keg.uninstall <ide> end <ide> end <ide> <del> if oldkeg_linked? <add> unless old_linked_keg.nil? <ide> # The keg used to be linked and when we backup everything we restore <ide> # Cellar/oldname, the target also gets restored, so we are able to <ide> # create a keg using its old path <ide> if old_linked_keg_record <ide> begin <del> oldkeg.link <add> old_linked_keg.link <ide> rescue Keg::LinkError <del> oldkeg.unlink <add> old_linked_keg.unlink <ide> raise <ide> rescue Keg::AlreadyLinkedError <del> oldkeg.unlink <add> old_linked_keg.unlink <ide> retry <ide> end <ide> else <del> oldkeg.optlink <add> old_linked_keg.optlink <ide> end <ide> end <ide> end <ide> <ide> def backup_oldname_cellar <del> unless oldpath.exist? <del> FileUtils.mv(newpath, oldpath) <add> unless old_cellar.exist? <add> FileUtils.mv(new_cellar, old_cellar) <ide> end <ide> end <ide> <ide><path>Library/Homebrew/test/test_migrator.rb <ide> def test_backup_cellar <ide> assert_predicate @old_keg_record/"bin", :directory? <ide> end <ide> <del> def test_oldkeg_linked <del> assert_predicate @migrator, :oldkeg_linked? <del> end <del> <ide> def test_repin <ide> @new_keg_record.join("bin").mkpath <ide> expected_relative = @new_keg_record.relative_path_from HOMEBREW_LIBRARY/"PinnedKegs"
2
Ruby
Ruby
consider aliases in installed_prefixes
2afa8497c096ba85489b4f242c64a0cdf1b06214
<ide><path>Library/Homebrew/formula.rb <ide> def rack <ide> # All currently installed prefix directories. <ide> # @private <ide> def installed_prefixes <del> rack.directory? ? rack.subdirs.sort : [] <add> prefixes = rack.directory? ? rack.subdirs : [] <add> <add> prefixes += (aliases + Array(oldname)).flat_map do |alias_name| <add> rack_alias = HOMEBREW_CELLAR/alias_name <add> next unless rack_alias.directory? <add> <add> rack_alias.subdirs <add> end.compact <add> <add> prefixes.sort_by(&:basename) <ide> end <ide> <ide> # All currently installed kegs.
1
PHP
PHP
fix additional issues with saveall()
d9bf3cf9873ece2268a3cdac1a04b1205f642b05
<ide><path>lib/Cake/Model/Behavior/TranslateBehavior.php <ide> public function beforeValidate(Model $model) { <ide> /** <ide> * beforeSave callback. <ide> * <add> * Copies data into the runtime property when `$options['validate']` is <add> * disabled. Or the runtime data hasn't been set yet. <add> * <ide> * @param Model $model Model save was called on. <ide> * @return boolean true. <ide> */ <del> public function beforeSave(Model $model) { <add> public function beforeSave(Model $model, $options = array()) { <add> if (isset($options['validate']) && $options['validate'] == false) { <add> unset($this->runtime[$model->alias]['beforeSave']); <add> } <add> if (isset($this->runtime[$model->alias]['beforeSave'])) { <add> return true; <add> } <ide> $this->_setRuntimeData($model); <ide> return true; <ide> } <ide> public function beforeSave(Model $model) { <ide> */ <ide> protected function _setRuntimeData(Model $model) { <ide> $locale = $this->_getLocale($model); <del> if (empty($locale) || isset($this->runtime[$model->alias]['beforeSave'])) { <add> if (empty($locale)) { <ide> return true; <ide> } <ide> $fields = array_merge($this->settings[$model->alias], $this->runtime[$model->alias]['fields']); <ide> protected function _setRuntimeData(Model $model) { <ide> * @return void <ide> */ <ide> public function afterSave(Model $model, $created) { <del> if (!isset($this->runtime[$model->alias]['beforeSave'])) { <add> if (!isset($this->runtime[$model->alias]['beforeValidate']) && !isset($this->runtime[$model->alias]['beforeSave'])) { <ide> return true; <ide> } <ide> $locale = $this->_getLocale($model); <del> $tempData = $this->runtime[$model->alias]['beforeSave']; <del> unset($this->runtime[$model->alias]['beforeSave']); <add> if (isset($this->runtime[$model->alias]['beforeValidate'])) { <add> $tempData = $this->runtime[$model->alias]['beforeValidate']; <add> } else { <add> $tempData = $this->runtime[$model->alias]['beforeSave']; <add> } <add> <add> unset($this->runtime[$model->alias]['beforeValidate'], $this->runtime[$model->alias]['beforeSave']); <ide> $conditions = array('model' => $model->alias, 'foreign_key' => $model->id); <ide> $RuntimeModel = $this->translateModel($model); <ide> <ide><path>lib/Cake/Test/Case/Model/Behavior/TranslateBehaviorTest.php <ide> public function testSaveAllTranslatedAssociations() { <ide> 'conditions' => array('translated_article_id' => $Model->id) <ide> )); <ide> $this->assertCount(2, $result); <add> $this->assertEquals($data['TranslatedItem'][0]['title'], $result[0]['TranslatedItem']['title']); <add> $this->assertEquals($data['TranslatedItem'][1]['title'], $result[1]['TranslatedItem']['title']); <ide> } <ide> <ide> /**
2
PHP
PHP
fix simple test
fb58f1906e7a486759393aa6dbfdf35615c82add
<ide><path>tests/Database/DatabaseEloquentBuilderTest.php <ide> public function testQualifyColumns() <ide> <ide> $builder->setModel(new EloquentModelStub); <ide> <del> $this->assertEquals(['stub.column', 'stub.column2', 'stub.column3'], $builder->qualifyColumns('column', 'column2', 'column3')); <del> $this->assertEquals(['stub.column', 'stub.column2', 'stub.column3'], $builder->qualifyColumns(['column', 'column2', 'column3'])); <add> $this->assertEquals(['stub.column'], $builder->qualifyColumns('column')); <ide> } <ide> <ide> public function testGetMethodLoadsModelsAndHydratesEagerRelations()
1
Javascript
Javascript
fix a typo on test-fs-read-optional-params
fb254d2a838b8b5a73b29b0a214ac3945bb8160e
<ide><path>test/parallel/test-fs-read-optional-params.js <ide> fs.read(fd, common.mustCall((err, bytesRead, buffer) => { <ide> fs.read(fd, { <ide> buffer: bufferAsOption, <ide> offset: 0, <del> lenght: bufferAsOption.length, <add> length: bufferAsOption.length, <ide> position: 0 <ide> }, <ide> common.mustCall((err, bytesRead, buffer) => {
1
Text
Text
imrpove russian translation in article (react)
8ed5ea54e411e98f6eea4bcbe0d7122625df36d3
<ide><path>guide/russian/react/component/index.md <ide> --- <ide> title: React - Components <del>localeTitle: Реакция - Компоненты <add>localeTitle: React - Компоненты <ide> --- <del>## Реакция - Компоненты <add>## React - Компоненты <ide> <del>Компоненты могут повторно использоваться в реакции.js. Вы можете ввести значение в реквизиты, как указано ниже: <add>Компоненты могут повторно использоваться в React.js. Вы можете передать значение в компонент, как указано ниже: <ide> <ide> ```jsx <ide> function Welcome(props) { <ide> function Welcome(props) { <ide> <ide> ### Другие способы объявления компонентов <ide> <del>Существует много способов объявления компонентов при использовании React.js, но есть два вида компонентов, компоненты **_без_** учета **_состояния и_** компоненты с **_состоянием_** . <add>Существует много способов объявления компонентов при использовании React.js, но есть два вида компонентов, компоненты **_без_** внутреннего **_состояния и_** компоненты с **_состоянием_** . <ide> <ide> ### Stateful <ide> <del>#### Компоненты типа класса <add>#### Компоненты-классы <ide> <ide> ```jsx <ide> class Cat extends React.Component { <ide> class Cat extends React.Component { <ide> } <ide> ``` <ide> <del>### Безстоящие компоненты <add>### Компоненты без состояния <ide> <del>#### Функциональные компоненты (функция стрелок от ES6) <add>#### Функциональные компоненты (стрелочные функции из ES6) <ide> <ide> ```jsx <ide> const Cat = props => { <ide> const Cat = props => { <ide> }; <ide> ``` <ide> <del>#### Неявные возвращаемые компоненты <add>#### Неявно возвращаемые компоненты <ide> <ide> ```jsx <ide> const Cat = props => <ide> const Cat = props => <ide> <p>{props.color}</p> <ide> </div>; <ide> <del>``` <ide>\ No newline at end of file <add>```
1
Text
Text
add traversal methods
dfb5779820a1eab227c8f29f378921ca645eb4e6
<ide><path>guide/english/algorithms/binary-search-trees/index.md <ide> The BST is built upon the idea of the <a href='https://guide.freecodecamp.org/al <ide> - Insert: insert a node in the tree. <ide> - Search: Searches for a node in the tree. <ide> - Delete: deletes a node from the tree. <add>- Inorder: in-order traversal of the tree. <add>- Preorder: pre-order traversal of the tree. <add>- Postorder: post-order traversal of the tree. <ide> <ide> #### Create <ide> Initially an empty tree without any nodes is created. The variable/identifier which must point to the root node is initialized with a `NULL` value. <ide> int treeSize(struct node* node) <ide> } <ide> ``` <ide> <add>#### Traversal <add>There are 3 kinds of traversals that are done typically over a binary search tree. All these traversals have a somewhat common way of going over the nodes of the tree. <add>##### In-order <add>This traversal first goes over the left subtree of the root node, then accesses the current node, followed by the right subtree of the current node. The code represents the base case too, which says that an empty tree is also a binary search tree. <add>``` <add>void inOrder(struct node* root) { <add> // Base case <add> if (root == null) { <add> return; <add> } <add> // Travel the left sub-tree first. <add> inOrder(root.left); <add> // Print the current node value <add> printf("%d ", root.data); <add> // Travel the right sub-tree next. <add> inOrder(root.right); <add>} <add>``` <add>##### Pre-order <add>This traversal first accesses the current node value, then traverses the left and right sub-trees respectively. <add>``` <add>void preOrder(struct node* root) { <add> if (root == null) { <add> return; <add> } <add> // Print the current node value <add> printf("%d ", root.data); <add> // Travel the left sub-tree first. <add> preOrder(root.left); <add> // Travel the right sub-tree next. <add> preOrder(root.right); <add>} <add>``` <add>##### Post-order <add>This traversal puts the root value at last, and goes over the left and right sub-trees first. The relative order of the left and right sub-trees remain the same. Only the position of the root changes in all the above mentioned traversals. <add>``` <add>void postOrder(struct node* root) { <add> if (root == null) { <add> return; <add> } <add> // Travel the left sub-tree first. <add> postOrder(root.left); <add> // Travel the right sub-tree next. <add> postOrder(root.right); <add> // Print the current node value <add> printf("%d ", root.data); <add>} <add>``` <add> <ide> ### Relevant videos on freeCodeCamp YouTube channel <ide> * [Binary Search Tree](https://youtu.be/5cU1ILGy6dM) <ide> * [Binary Search Tree: Traversal and Height](https://youtu.be/Aagf3RyK3Lw)
1
Javascript
Javascript
fix typos and links
9f2ad53084e08f477477b6d6b4e482c2cc87dd68
<ide><path>src/ngMock/angular-mocks.js <ide> angular.mock.$Browser.prototype = { <ide> * <ide> * @description <ide> * Configures the mock implementation of {@link ng.$exceptionHandler} to rethrow or to log errors <del> * passed into the `$exceptionHandler`. <add> * passed to the `$exceptionHandler`. <ide> */ <ide> <ide> /** <ide> angular.mock.$Browser.prototype = { <ide> * <ide> * @description <ide> * Mock implementation of {@link ng.$exceptionHandler} that rethrows or logs errors passed <del> * into it. See {@link ngMock.$exceptionHandlerProvider $exceptionHandlerProvider} for configuration <add> * to it. See {@link ngMock.$exceptionHandlerProvider $exceptionHandlerProvider} for configuration <ide> * information. <ide> * <ide> * <ide> angular.mock.$ExceptionHandlerProvider = function() { <ide> * <ide> * @param {string} mode Mode of operation, defaults to `rethrow`. <ide> * <del> * - `rethrow`: If any errors are passed into the handler in tests, it typically <del> * means that there is a bug in the application or test, so this mock will <del> * make these tests fail. <add> * - `rethrow`: If any errors are passed to the handler in tests, it typically means that there <add> * is a bug in the application or test, so this mock will make these tests fail. <ide> * - `log`: Sometimes it is desirable to test that an error is thrown, for this case the `log` <ide> * mode stores an array of errors in `$exceptionHandler.errors`, to allow later <ide> * assertion of them. See {@link ngMock.$log#assertEmpty assertEmpty()} and <ide> angular.mock.$LogProvider = function() { <ide> * @name $log#log.logs <ide> * <ide> * @description <del> * Array of messages logged using {@link ngMock.$log#log}. <add> * Array of messages logged using {@link ng.$log#log log()}. <ide> * <ide> * @example <ide> * ```js <ide> angular.mock.$LogProvider = function() { <ide> * @name $log#info.logs <ide> * <ide> * @description <del> * Array of messages logged using {@link ngMock.$log#info}. <add> * Array of messages logged using {@link ng.$log#info info()}. <ide> * <ide> * @example <ide> * ```js <ide> angular.mock.$LogProvider = function() { <ide> * @name $log#warn.logs <ide> * <ide> * @description <del> * Array of messages logged using {@link ngMock.$log#warn}. <add> * Array of messages logged using {@link ng.$log#warn warn()}. <ide> * <ide> * @example <ide> * ```js <ide> angular.mock.$LogProvider = function() { <ide> * @name $log#error.logs <ide> * <ide> * @description <del> * Array of messages logged using {@link ngMock.$log#error}. <add> * Array of messages logged using {@link ng.$log#error error()}. <ide> * <ide> * @example <ide> * ```js <ide> angular.mock.$LogProvider = function() { <ide> * @name $log#debug.logs <ide> * <ide> * @description <del> * Array of messages logged using {@link ngMock.$log#debug}. <add> * Array of messages logged using {@link ng.$log#debug debug()}. <ide> * <ide> * @example <ide> * ```js <ide> angular.mock.$LogProvider = function() { <ide> * @name $log#assertEmpty <ide> * <ide> * @description <del> * Assert that the all of the logging methods have no logged messages. If messages present, an <del> * exception is thrown. <add> * Assert that all of the logging methods have no logged messages. If any messages are present, <add> * an exception is thrown. <ide> */ <ide> $log.assertEmpty = function() { <ide> var errors = [];
1
PHP
PHP
apply fixes from styleci
1d8ea077a93e7152be1f8d05dcdde7c4a0776cae
<ide><path>src/Illuminate/Foundation/Application.php <ide> use Illuminate\Filesystem\Filesystem; <ide> use Illuminate\Log\LogServiceProvider; <ide> use Illuminate\Support\ServiceProvider; <del>use Illuminate\Foundation\PackageManifest; <ide> use Illuminate\Events\EventServiceProvider; <ide> use Illuminate\Routing\RoutingServiceProvider; <ide> use Symfony\Component\HttpKernel\HttpKernelInterface;
1
Text
Text
correct typos in es6 guide for getters/setters
2113b44b8a109bd0241a739f1e109c0f36b5d370
<ide><path>guide/english/certifications/javascript-algorithms-and-data-structures/es6/use-getters-and-setters-to-control-access-to-an-object/index.md <ide> Create the class, Thermostat. You're going to put your constructor, getter, and <ide> <ide> ## Hint 2: <ide> <del>Give the constructor a parameter (which you can name anything you want). Set the parameter to an attribute of the same name. Remember, you are initially setting things in Farenheit temperature. <add>Give the constructor a parameter (which you can name anything you want). Set the parameter to an attribute of the same name. Remember, you are initially setting things in Fahrenheit temperature. <ide> <ide> ## Hint 3: <ide> <del>Create a get method that converts the Farenheit attribute to Celsius. Use the formula given to you. <add>Create a get method that converts the Fahrenheit attribute to Celsius. Use the formula given to you. <ide> <ide> ## Hint 4: <ide> <del>Create a set method of the same name as the get method. It should have a parameter that accepts celsius temperature. Convert it to farenheit, and set it to the attribute. <add>Create a set method of the same name as the get method. It should have a parameter that accepts celsius temperature. Convert it to fahrenheit, and set it to the attribute. <ide> <ide> ## Spoiler Alert - Solution Ahead! <ide> <ide> function makeClass() { <ide> /* Alter code below this line */ <ide> <ide> class Thermostat{ <del> constructor(farenheit){ <del> this.farenheit = farenheit; <add> constructor(fahrenheit){ <add> this.fahrenheit = fahrenheit; <ide> } <ide> get temperature(){ <del> return 5 / 9 * (this.farenheit - 32); <add> return 5 / 9 * (this.fahrenheit - 32); <ide> } <ide> set temperature(celsius){ <del> this.farenheit = celsius * 9.0 / 5 + 32; <add> this.fahrenheit = celsius * 9.0 / 5 + 32; <ide> } <ide> } <ide>
1
Javascript
Javascript
fix failing test
96791e2173b12b5730d1840b5946d09a5558da8a
<ide><path>packages/ember-handlebars/tests/helpers/with_test.js <ide> test("it should support #with Foo.bar as qux", function() { <ide> equal(view.$().text(), "updated", "should update"); <ide> }); <ide> <del>module("Handlebars {{#with this as foo}}"); <add>if (Ember.VIEW_PRESERVES_CONTEXT) { <add> module("Handlebars {{#with this as foo}}"); <ide> <del>test("it should support #with this as qux", function() { <del> var view = Ember.View.create({ <del> template: Ember.Handlebars.compile("{{#with this as person}}{{person.name}}{{/with}}"), <del> controller: Ember.Object.create({ name: "Los Pivots" }) <del> }); <del> <del> appendView(view); <del> equal(view.$().text(), "Los Pivots", "should be properly scoped"); <add> test("it should support #with this as qux", function() { <add> var view = Ember.View.create({ <add> template: Ember.Handlebars.compile("{{#with this as person}}{{person.name}}{{/with}}"), <add> controller: Ember.Object.create({ name: "Los Pivots" }) <add> }); <ide> <del> Ember.run(function() { <del> Ember.setPath(view, 'controller.name', "l'Pivots"); <del> }); <add> appendView(view); <add> equal(view.$().text(), "Los Pivots", "should be properly scoped"); <ide> <del> equal(view.$().text(), "l'Pivots", "should update"); <del>}); <add> Ember.run(function() { <add> Ember.setPath(view, 'controller.name', "l'Pivots"); <add> }); <ide> <add> equal(view.$().text(), "l'Pivots", "should update"); <add> }); <add>}
1
Text
Text
move who-to-cc to colaborator_guide.md
22884a7d23461f3256fd6352d20d0c6088375900
<ide><path>COLLABORATOR_GUIDE.md <ide> - [How are LTS Branches Managed?](#how-are-lts-branches-managed) <ide> - [How can I help?](#how-can-i-help) <ide> - [How is an LTS release cut?](#how-is-an-lts-release-cut) <add>* [Who to CC in the issue tracker](#who-to-cc-in-the-issue-tracker) <ide> <ide> This document contains information for Collaborators of the Node.js <ide> project regarding managing the project's code, documentation, and issue tracker. <ide> requests they feel qualified to handle. Make sure this is done while being <ide> mindful of these guidelines, the opinions of other Collaborators, and guidance <ide> of the [TSC][]. They may also notify other qualified parties for more input on <ide> an issue or a pull request. <del>[See "Who to CC in issues"](./doc/onboarding-extras.md#who-to-cc-in-issues) <add>See [Who to CC in the issue tracker](#who-to-cc-in-the-issue-tracker). <ide> <ide> ### Welcoming First-Time Contributors <ide> <ide> Collaborator, an additional Collaborator is required for sign-off. <ide> <ide> In some cases, it may be necessary to summon a GitHub team to a pull request for <ide> review by @-mention. <del>[See "Who to CC in issues"](./doc/onboarding-extras.md#who-to-cc-in-issues). <add>See [Who to CC in the issue tracker](#who-to-cc-in-the-issue-tracker). <ide> <ide> If you are unsure about the modification and are not prepared to take <ide> full responsibility for the change, defer to another Collaborator. <ide> selected commits will be picked from the staging branch to be included in the <ide> release. This process of making a release will be a collaboration between the <ide> LTS working group and the Release team. <ide> <add>## Who to CC in the issue tracker <add> <add>| Subsystem | Maintainers | <add>| --- | --- | <add>| `benchmark/*` | @nodejs/benchmarking, @mscdex | <add>| `bootstrap_node.js` | @nodejs/process | <add>| `doc/*`, `*.md` | @nodejs/documentation | <add>| `lib/assert` | @nodejs/testing | <add>| `lib/async_hooks` | @nodejs/async\_hooks for bugs/reviews (+ @nodejs/diagnostics for API) | <add>| `lib/buffer` | @nodejs/buffer | <add>| `lib/child_process` | @nodejs/child\_process | <add>| `lib/cluster` | @nodejs/cluster | <add>| `lib/{crypto,tls,https}` | @nodejs/crypto | <add>| `lib/dgram` | @nodejs/dgram | <add>| `lib/domains` | @nodejs/domains | <add>| `lib/fs`, `src/{fs,file}` | @nodejs/fs | <add>| `lib/{_}http{*}` | @nodejs/http | <add>| `lib/inspector.js`, `src/inspector_*` | @nodejs/V8-inspector | <add>| `lib/internal/url`, `src/node_url` | @nodejs/url | <add>| `lib/net` | @bnoordhuis, @indutny, @nodejs/streams | <add>| `lib/repl` | @nodejs/repl | <add>| `lib/{_}stream{*}` | @nodejs/streams | <add>| `lib/timers` | @nodejs/timers | <add>| `lib/util` | @nodejs/util | <add>| `lib/zlib` | @nodejs/zlib | <add>| `src/async-wrap.*` | @nodejs/async\_hooks | <add>| `src/node_api.*` | @nodejs/n-api | <add>| `src/node_crypto.*` | @nodejs/crypto | <add>| `test/*` | @nodejs/testing | <add>| `tools/node_modules/eslint`, `.eslintrc` | @nodejs/linting | <add>| build | @nodejs/build | <add>| `src/module_wrap.*`, `lib/internal/loader/*`, `lib/internal/vm/Module.js` | @nodejs/modules | <add>| GYP | @nodejs/gyp | <add>| performance | @nodejs/performance | <add>| platform specific | @nodejs/platform-{aix,arm,freebsd,macos,ppc,smartos,s390,windows} | <add>| python code | @nodejs/python | <add>| upgrading c-ares | @rvagg | <add>| upgrading http-parser | @nodejs/http, @nodejs/http2 | <add>| upgrading libuv | @nodejs/libuv | <add>| upgrading npm | @fishrock123, @MylesBorins | <add>| upgrading V8 | @nodejs/V8, @nodejs/post-mortem | <add>| Embedded use or delivery of Node.js | @nodejs/delivery-channels | <add> <add>When things need extra attention, are controversial, or `semver-major`: <add>@nodejs/tsc <add> <add>If you cannot find who to cc for a file, `git shortlog -n -s <file>` may help. <add> <ide> [backporting guide]: doc/guides/backporting-to-release-lines.md <ide> [contributing]: ./doc/guides/contributing/pull-requests.md#commit-message-guidelines <ide> [Stability Index]: doc/api/documentation.md#stability-index <ide><path>doc/onboarding-extras.md <ide> # Additional Onboarding Information <ide> <del>## Who to CC in issues <del> <del>| Subsystem | Maintainers | <del>| --- | --- | <del>| `benchmark/*` | @nodejs/benchmarking, @mscdex | <del>| `bootstrap_node.js` | @nodejs/process | <del>| `doc/*`, `*.md` | @nodejs/documentation | <del>| `lib/assert` | @nodejs/testing | <del>| `lib/async_hooks` | @nodejs/async\_hooks for bugs/reviews (+ @nodejs/diagnostics for API) | <del>| `lib/buffer` | @nodejs/buffer | <del>| `lib/child_process` | @nodejs/child\_process | <del>| `lib/cluster` | @nodejs/cluster | <del>| `lib/{crypto,tls,https}` | @nodejs/crypto | <del>| `lib/dgram` | @nodejs/dgram | <del>| `lib/domains` | @nodejs/domains | <del>| `lib/fs`, `src/{fs,file}` | @nodejs/fs | <del>| `lib/{_}http{*}` | @nodejs/http | <del>| `lib/inspector.js`, `src/inspector_*` | @nodejs/v8-inspector | <del>| `lib/internal/url`, `src/node_url` | @nodejs/url | <del>| `lib/net` | @bnoordhuis, @indutny, @nodejs/streams | <del>| `lib/repl` | @nodejs/repl | <del>| `lib/{_}stream{*}` | @nodejs/streams | <del>| `lib/timers` | @nodejs/timers | <del>| `lib/util` | @nodejs/util | <del>| `lib/zlib` | @nodejs/zlib | <del>| `src/async-wrap.*` | @nodejs/async\_hooks | <del>| `src/node_api.*` | @nodejs/n-api | <del>| `src/node_crypto.*` | @nodejs/crypto | <del>| `test/*` | @nodejs/testing | <del>| `tools/node_modules/eslint`, `.eslintrc` | @nodejs/linting | <del>| build | @nodejs/build | <del>| `src/module_wrap.*`, `lib/internal/loader/*`, `lib/internal/vm/Module.js` | @nodejs/modules | <del>| GYP | @nodejs/gyp | <del>| performance | @nodejs/performance | <del>| platform specific | @nodejs/platform-{aix,arm,freebsd,macos,ppc,smartos,s390,windows} | <del>| python code | @nodejs/python | <del>| upgrading c-ares | @rvagg | <del>| upgrading http-parser | @nodejs/http, @nodejs/http2 | <del>| upgrading libuv | @nodejs/libuv | <del>| upgrading npm | @fishrock123, @MylesBorins | <del>| upgrading V8 | @nodejs/v8, @nodejs/post-mortem | <del>| Embedded use or delivery of Node.js | @nodejs/delivery-channels | <del> <del>When things need extra attention, are controversial, or `semver-major`: <del>@nodejs/tsc <del> <del>If you cannot find who to cc for a file, `git shortlog -n -s <file>` may help. <del> <ide> ## Labels <ide> <ide> ### Subsystems <ide><path>doc/onboarding.md <ide> onboarding session. <ide> * Prior to the onboarding session, add the new Collaborator to <ide> [the Collaborators team](https://github.com/orgs/nodejs/teams/collaborators). <ide> * Ask them if they want to join any subsystem teams. See <del> [Who to CC for Issues][who-to-cc]. <add> [Who to CC in the issue tracker][who-to-cc]. <ide> <ide> ## Onboarding session <ide> <ide> onboarding session. <ide> * no outstanding review comments exist and <ide> * at least one collaborator approved the PR. <ide> <del>* [**See "Who to CC in issues"**][who-to-cc] <add>* See [Who to CC in the issue tracker][who-to-cc]. <ide> * This will come more naturally over time <ide> * For many of the teams listed there, you can ask to be added if you are <ide> interested <ide> needs to be pointed out separately during the onboarding. <ide> [two-factor authentication]: https://help.github.com/articles/securing-your-account-with-two-factor-authentication-2fa/ <ide> [Updating Node.js from Upstream]: ./onboarding-extras.md#updating-nodejs-from-upstream <ide> [using a TOTP mobile app]: https://help.github.com/articles/configuring-two-factor-authentication-via-a-totp-mobile-app/ <del>[who-to-cc]: ./onboarding-extras.md#who-to-cc-in-issues <add>[who-to-cc]: ../COLLABORATOR_GUIDE.md#who-to-cc-in-the-issue-tracker
3
Ruby
Ruby
freeze the header object
b3d1f5b630debcc2d0572a3e3af1855ef93300c2
<ide><path>actionpack/lib/action_controller/metal/live.rb <ide> def initialize(status = 200, header = {}, body = []) <ide> super(status, header, body) <ide> end <ide> <add> def commit! <add> headers.freeze <add> super <add> end <add> <ide> private <ide> <ide> def build_buffer(response, body) <ide><path>actionpack/test/dispatch/live_response_test.rb <ide> def test_content_length_is_removed <ide> def test_headers_cannot_be_written_after_write <ide> @response.stream.write 'omg' <ide> <add> assert @response.headers.frozen? <ide> e = assert_raises(ActionDispatch::IllegalStateError) do <ide> @response.headers['Content-Length'] = "zomg" <ide> end <ide> def test_headers_cannot_be_written_after_write <ide> def test_headers_cannot_be_written_after_close <ide> @response.stream.close <ide> <add> assert @response.headers.frozen? <ide> e = assert_raises(ActionDispatch::IllegalStateError) do <ide> @response.headers['Content-Length'] = "zomg" <ide> end
2
Javascript
Javascript
add missing word 'are' and period
fe697527b4a09cdba3e741ce2be6b47a8a426aec
<ide><path>src/Angular.js <ide> function copy(source, destination, stackSource, stackDest) { <ide> /** <ide> * Creates a shallow copy of an object, an array or a primitive. <ide> * <del> * Assumes that there no proto properties for objects <add> * Assumes that there are no proto properties for objects. <ide> */ <ide> function shallowCopy(src, dst) { <ide> if (isArray(src)) {
1
Javascript
Javascript
fix early end in writables on zero-length writes
c0d500102a0a11e9d07ed9f0396aae81011e58da
<ide><path>lib/_stream_writable.js <ide> Writable.prototype.end = function(chunk, encoding, cb) { <ide> }; <ide> <ide> function finishMaybe(stream, state) { <del> if (state.ending && state.length === 0 && !state.finished) { <add> if (state.ending && <add> state.length === 0 && <add> !state.finished && <add> !state.writing) { <ide> state.finished = true; <ide> stream.emit('finish'); <ide> } <ide><path>test/simple/test-stream2-writable.js <ide> test('end(chunk) two times is an error', function(t) { <ide> t.end(); <ide> }); <ide> }); <add> <add>test('dont end while writing', function(t) { <add> var w = new W(); <add> var wrote = false; <add> w._write = function(chunk, e, cb) { <add> assert(!this.writing); <add> wrote = true; <add> this.writing = true; <add> setTimeout(function() { <add> this.writing = false; <add> cb(); <add> }); <add> }; <add> w.on('finish', function() { <add> assert(wrote); <add> t.end(); <add> }); <add> w.write(Buffer(0)); <add> w.end(); <add>}); <ide><path>test/simple/test-zlib-zero-byte.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <add>var common = require('../common'); <add>var assert = require('assert'); <add> <add>var zlib = require('zlib'); <add>var gz = zlib.Gzip() <add>var emptyBuffer = new Buffer(0); <add>var received = 0; <add>gz.on('data', function(c) { <add> received += c.length; <add>}); <add>var ended = false; <add>gz.on('end', function() { <add> ended = true; <add>}); <add>var finished = false; <add>gz.on('finish', function() { <add> finished = true; <add>}); <add>gz.write(emptyBuffer); <add>gz.end(); <add> <add>process.on('exit', function() { <add> assert.equal(received, 20); <add> assert(ended); <add> assert(finished); <add> console.log('ok'); <add>});
3
Ruby
Ruby
fix fragile tests
8be22161edd7608acd5cae436e4278bfe9f05abf
<ide><path>activerecord/test/cases/tasks/database_tasks_test.rb <ide> def test_raises_an_error_when_called_with_protected_environment <ide> protected_environments = ActiveRecord::Base.protected_environments <ide> current_env = ActiveRecord::Base.connection.migration_context.current_environment <ide> <add> InternalMetadata.create_table <ide> InternalMetadata[:environment] = current_env <ide> <ide> assert_called_on_instance_of( <ide> def test_raises_an_error_when_called_with_protected_environment_which_name_is_a_ <ide> protected_environments = ActiveRecord::Base.protected_environments <ide> current_env = ActiveRecord::Base.connection.migration_context.current_environment <ide> <add> InternalMetadata.create_table <ide> InternalMetadata[:environment] = current_env <ide> <ide> assert_called_on_instance_of( <ide> class DatabaseTasksTruncateAllTest < ActiveRecord::TestCase <ide> <ide> def setup <ide> SchemaMigration.create_table <del> SchemaMigration.create!(version: "foo") <add> SchemaMigration.create!(version: SchemaMigration.table_name) <ide> InternalMetadata.create_table <del> InternalMetadata.create!(key: "foo", value: "bar") <add> InternalMetadata.create!(key: InternalMetadata.table_name) <ide> end <ide> <ide> def teardown
1
Text
Text
fix typo in documentation.
ba226c2d26347807daafc1ada3be81dd516569c6
<ide><path>readme.md <ide> module.exports = (phase, {defaultConfig}){ <ide> } <ide> ``` <ide> <del>`phase` is the current context in which the configuration is loaded. You can see all phases here: [contants](./lib/constants.js) <add>`phase` is the current context in which the configuration is loaded. You can see all phases here: [constants](./lib/constants.js) <ide> Phases can be imported from `next/constants`: <ide> <ide> ```js
1
Mixed
Javascript
add randomint function
6e8701b92335a0fbf2f732948c00202b4fa9bbfe
<ide><path>doc/api/crypto.md <ide> threadpool request. To minimize threadpool task length variation, partition <ide> large `randomFill` requests when doing so as part of fulfilling a client <ide> request. <ide> <add>### `crypto.randomInt([min, ]max[, callback])` <add><!-- YAML <add>added: REPLACEME <add>--> <add> <add>* `min` {integer} Start of random range (inclusive). **Default**: `0`. <add>* `max` {integer} End of random range (exclusive). <add>* `callback` {Function} `function(err, n) {}`. <add> <add>Return a random integer `n` such that `min <= n < max`. This <add>implementation avoids [modulo bias][]. <add> <add>The range (`max - min`) must be less than `2^48`. `min` and `max` must <add>be safe integers. <add> <add>If the `callback` function is not provided, the random integer is <add>generated synchronously. <add> <add>```js <add>// Asynchronous <add>crypto.randomInt(3, (err, n) => { <add> if (err) throw err; <add> console.log(`Random number chosen from (0, 1, 2): ${n}`); <add>}); <add>``` <add> <add>```js <add>// Synchronous <add>const n = crypto.randomInt(3); <add>console.log(`Random number chosen from (0, 1, 2): ${n}`); <add>``` <add> <add>```js <add>// With `min` argument <add>const n = crypto.randomInt(1, 7); <add>console.log(`The dice rolled: ${n}`); <add>``` <add> <ide> ### `crypto.scrypt(password, salt, keylen[, options], callback)` <ide> <!-- YAML <ide> added: v10.5.0 <ide> See the [list of SSL OP Flags][] for details. <ide> [NIST SP 800-131A]: https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-131Ar1.pdf <ide> [NIST SP 800-132]: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf <ide> [NIST SP 800-38D]: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf <add>[modulo bias]: https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#Modulo_bias <ide> [Nonce-Disrespecting Adversaries]: https://github.com/nonce-disrespect/nonce-disrespect <ide> [OpenSSL's SPKAC implementation]: https://www.openssl.org/docs/man1.1.0/apps/openssl-spkac.html <ide> [RFC 1421]: https://www.rfc-editor.org/rfc/rfc1421.txt <ide><path>lib/crypto.js <ide> const { <ide> const { <ide> randomBytes, <ide> randomFill, <del> randomFillSync <add> randomFillSync, <add> randomInt <ide> } = require('internal/crypto/random'); <ide> const { <ide> pbkdf2, <ide> module.exports = { <ide> randomBytes, <ide> randomFill, <ide> randomFillSync, <add> randomInt, <ide> scrypt, <ide> scryptSync, <ide> sign: signOneShot, <ide><path>lib/internal/crypto/random.js <ide> const { <ide> MathMin, <ide> NumberIsNaN, <add> NumberIsSafeInteger <ide> } = primordials; <ide> <ide> const { AsyncWrap, Providers } = internalBinding('async_wrap'); <ide> function randomFill(buf, offset, size, cb) { <ide> _randomBytes(buf, offset, size, wrap); <ide> } <ide> <add>// Largest integer we can read from a buffer. <add>// e.g.: Buffer.from("ff".repeat(6), "hex").readUIntBE(0, 6); <add>const RAND_MAX = 0xFFFF_FFFF_FFFF; <add> <add>// Generates an integer in [min, max) range where min is inclusive and max is <add>// exclusive. <add>function randomInt(min, max, cb) { <add> // Detect optional min syntax <add> // randomInt(max) <add> // randomInt(max, cb) <add> const minNotSpecified = typeof max === 'undefined' || <add> typeof max === 'function'; <add> <add> if (minNotSpecified) { <add> cb = max; <add> max = min; <add> min = 0; <add> } <add> <add> const isSync = typeof cb === 'undefined'; <add> if (!isSync && typeof cb !== 'function') { <add> throw new ERR_INVALID_CALLBACK(cb); <add> } <add> if (!NumberIsSafeInteger(min)) { <add> throw new ERR_INVALID_ARG_TYPE('min', 'safe integer', min); <add> } <add> if (!NumberIsSafeInteger(max)) { <add> throw new ERR_INVALID_ARG_TYPE('max', 'safe integer', max); <add> } <add> if (!(max >= min)) { <add> throw new ERR_OUT_OF_RANGE('max', `>= ${min}`, max); <add> } <add> <add> // First we generate a random int between [0..range) <add> const range = max - min; <add> <add> if (!(range <= RAND_MAX)) { <add> throw new ERR_OUT_OF_RANGE(`max${minNotSpecified ? '' : ' - min'}`, <add> `<= ${RAND_MAX}`, range); <add> } <add> <add> const excess = RAND_MAX % range; <add> const randLimit = RAND_MAX - excess; <add> <add> if (isSync) { <add> // Sync API <add> while (true) { <add> const x = randomBytes(6).readUIntBE(0, 6); <add> // If x > (maxVal - (maxVal % range)), we will get "modulo bias" <add> if (x > randLimit) { <add> // Try again <add> continue; <add> } <add> const n = (x % range) + min; <add> return n; <add> } <add> } else { <add> // Async API <add> const pickAttempt = () => { <add> randomBytes(6, (err, bytes) => { <add> if (err) return cb(err); <add> const x = bytes.readUIntBE(0, 6); <add> // If x > (maxVal - (maxVal % range)), we will get "modulo bias" <add> if (x > randLimit) { <add> // Try again <add> return pickAttempt(); <add> } <add> const n = (x % range) + min; <add> cb(null, n); <add> }); <add> }; <add> <add> pickAttempt(); <add> } <add>} <add> <ide> function handleError(ex, buf) { <ide> if (ex) throw ex; <ide> return buf; <ide> function handleError(ex, buf) { <ide> module.exports = { <ide> randomBytes, <ide> randomFill, <del> randomFillSync <add> randomFillSync, <add> randomInt <ide> }; <ide><path>test/parallel/test-crypto-random.js <ide> assert.throws( <ide> assert.strictEqual(desc.writable, true); <ide> assert.strictEqual(desc.enumerable, false); <ide> }); <add> <add> <add>{ <add> // Asynchronous API <add> const randomInts = []; <add> for (let i = 0; i < 100; i++) { <add> crypto.randomInt(3, common.mustCall((err, n) => { <add> assert.ifError(err); <add> assert.ok(n >= 0); <add> assert.ok(n < 3); <add> randomInts.push(n); <add> if (randomInts.length === 100) { <add> assert.ok(!randomInts.includes(-1)); <add> assert.ok(randomInts.includes(0)); <add> assert.ok(randomInts.includes(1)); <add> assert.ok(randomInts.includes(2)); <add> assert.ok(!randomInts.includes(3)); <add> } <add> })); <add> } <add>} <add>{ <add> // Synchronous API <add> const randomInts = []; <add> for (let i = 0; i < 100; i++) { <add> const n = crypto.randomInt(3); <add> assert.ok(n >= 0); <add> assert.ok(n < 3); <add> randomInts.push(n); <add> } <add> <add> assert.ok(!randomInts.includes(-1)); <add> assert.ok(randomInts.includes(0)); <add> assert.ok(randomInts.includes(1)); <add> assert.ok(randomInts.includes(2)); <add> assert.ok(!randomInts.includes(3)); <add>} <add>{ <add> // Positive range <add> const randomInts = []; <add> for (let i = 0; i < 100; i++) { <add> crypto.randomInt(1, 3, common.mustCall((err, n) => { <add> assert.ifError(err); <add> assert.ok(n >= 1); <add> assert.ok(n < 3); <add> randomInts.push(n); <add> if (randomInts.length === 100) { <add> assert.ok(!randomInts.includes(0)); <add> assert.ok(randomInts.includes(1)); <add> assert.ok(randomInts.includes(2)); <add> assert.ok(!randomInts.includes(3)); <add> } <add> })); <add> } <add>} <add>{ <add> // Negative range <add> const randomInts = []; <add> for (let i = 0; i < 100; i++) { <add> crypto.randomInt(-10, -8, common.mustCall((err, n) => { <add> assert.ifError(err); <add> assert.ok(n >= -10); <add> assert.ok(n < -8); <add> randomInts.push(n); <add> if (randomInts.length === 100) { <add> assert.ok(!randomInts.includes(-11)); <add> assert.ok(randomInts.includes(-10)); <add> assert.ok(randomInts.includes(-9)); <add> assert.ok(!randomInts.includes(-8)); <add> } <add> })); <add> } <add>} <add>{ <add> <add> ['10', true, NaN, null, {}, []].forEach((i) => { <add> const invalidMinError = { <add> code: 'ERR_INVALID_ARG_TYPE', <add> name: 'TypeError', <add> message: 'The "min" argument must be safe integer.' + <add> `${common.invalidArgTypeHelper(i)}`, <add> }; <add> const invalidMaxError = { <add> code: 'ERR_INVALID_ARG_TYPE', <add> name: 'TypeError', <add> message: 'The "max" argument must be safe integer.' + <add> `${common.invalidArgTypeHelper(i)}`, <add> }; <add> <add> assert.throws( <add> () => crypto.randomInt(i, 100), <add> invalidMinError <add> ); <add> assert.throws( <add> () => crypto.randomInt(i, 100, common.mustNotCall()), <add> invalidMinError <add> ); <add> assert.throws( <add> () => crypto.randomInt(i), <add> invalidMaxError <add> ); <add> assert.throws( <add> () => crypto.randomInt(i, common.mustNotCall()), <add> invalidMaxError <add> ); <add> assert.throws( <add> () => crypto.randomInt(0, i, common.mustNotCall()), <add> invalidMaxError <add> ); <add> assert.throws( <add> () => crypto.randomInt(0, i), <add> invalidMaxError <add> ); <add> }); <add> <add> const maxInt = Number.MAX_SAFE_INTEGER; <add> const minInt = Number.MIN_SAFE_INTEGER; <add> <add> crypto.randomInt(minInt, minInt + 5, common.mustCall()); <add> crypto.randomInt(maxInt - 5, maxInt, common.mustCall()); <add> <add> assert.throws( <add> () => crypto.randomInt(minInt - 1, minInt + 5, common.mustNotCall()), <add> { <add> code: 'ERR_INVALID_ARG_TYPE', <add> name: 'TypeError', <add> message: 'The "min" argument must be safe integer.' + <add> `${common.invalidArgTypeHelper(minInt - 1)}`, <add> } <add> ); <add> <add> assert.throws( <add> () => crypto.randomInt(maxInt + 1, common.mustNotCall()), <add> { <add> code: 'ERR_INVALID_ARG_TYPE', <add> name: 'TypeError', <add> message: 'The "max" argument must be safe integer.' + <add> `${common.invalidArgTypeHelper(maxInt + 1)}`, <add> } <add> ); <add> <add> crypto.randomInt(0, common.mustCall()); <add> crypto.randomInt(0, 0, common.mustCall()); <add> assert.throws(() => crypto.randomInt(-1, common.mustNotCall()), { <add> code: 'ERR_OUT_OF_RANGE', <add> name: 'RangeError', <add> message: 'The value of "max" is out of range. It must be >= 0. Received -1' <add> }); <add> <add> const MAX_RANGE = 0xFFFF_FFFF_FFFF; <add> crypto.randomInt(MAX_RANGE, common.mustCall()); <add> crypto.randomInt(1, MAX_RANGE + 1, common.mustCall()); <add> assert.throws( <add> () => crypto.randomInt(1, MAX_RANGE + 2, common.mustNotCall()), <add> { <add> code: 'ERR_OUT_OF_RANGE', <add> name: 'RangeError', <add> message: 'The value of "max - min" is out of range. ' + <add> `It must be <= ${MAX_RANGE}. ` + <add> 'Received 281_474_976_710_656' <add> } <add> ); <add> <add> assert.throws(() => crypto.randomInt(MAX_RANGE + 1, common.mustNotCall()), { <add> code: 'ERR_OUT_OF_RANGE', <add> name: 'RangeError', <add> message: 'The value of "max" is out of range. ' + <add> `It must be <= ${MAX_RANGE}. ` + <add> 'Received 281_474_976_710_656' <add> }); <add> <add> [true, NaN, null, {}, [], 10].forEach((i) => { <add> const cbError = { <add> code: 'ERR_INVALID_CALLBACK', <add> name: 'TypeError', <add> message: `Callback must be a function. Received ${inspect(i)}` <add> }; <add> assert.throws(() => crypto.randomInt(0, 1, i), cbError); <add> }); <add>}
4
Ruby
Ruby
ensure dir.glob is sorted
5c8be9eb864886d7ba9abba0d59786614cca2a5a
<ide><path>railties/lib/rails/paths.rb <ide> def expanded <ide> path = File.expand_path(p, @root.path) <ide> <ide> if @glob <del> result.concat Dir[File.join(path, @glob)] <add> result.concat Dir[File.join(path, @glob)].sort <ide> else <ide> result << path <ide> end
1
Text
Text
fix various nits
de0053cc3280bdf72c9010f383290f79120a1e98
<ide><path>doc/api/addons.md <ide> Addon module name is `addon`. <ide> Once the source code has been written, it must be compiled into the binary <ide> `addon.node` file. To do so, create a file called `binding.gyp` in the <ide> top-level of the project describing the build configuration of the module <del>using a JSON-like format. This file is used by [node-gyp][] -- a tool written <add>using a JSON-like format. This file is used by [node-gyp][] — a tool written <ide> specifically to compile Node.js Addons. <ide> <ide> ```json <ide><path>doc/api/async_hooks.md <ide> asyncResource.emitAfter(); <ide> * `type` {string} The type of async event. <ide> * `options` {Object} <ide> * `triggerAsyncId` {number} The ID of the execution context that created this <del> async event. **Default:** `executionAsyncId()`. <add> async event. **Default:** `executionAsyncId()`. <ide> * `requireManualDestroy` {boolean} Disables automatic `emitDestroy` when the <ide> object is garbage collected. This usually does not need to be set (even if <ide> `emitDestroy` is called manually), unless the resource's asyncId is retrieved <ide><path>doc/api/buffer.md <ide> differently based on what arguments are provided: <ide> entire `Buffer`. While this behavior is *intentional* to improve performance, <ide> development experience has demonstrated that a more explicit distinction is <ide> required between creating a fast-but-uninitialized `Buffer` versus creating a <del> slower-but-safer `Buffer`. Starting in Node.js 8.0.0, `Buffer(num)` and <add> slower-but-safer `Buffer`. Starting in Node.js 8.0.0, `Buffer(num)` and <ide> `new Buffer(num)` will return a `Buffer` with initialized memory. <ide> * Passing a string, array, or `Buffer` as the first argument copies the <ide> passed object's data into the `Buffer`. <ide> changes: <ide> <ide> * `size` {integer} The desired length of the new `Buffer`. <ide> <del>Allocates a new `Buffer` of `size` bytes. If the `size` is larger than <add>Allocates a new `Buffer` of `size` bytes. If the `size` is larger than <ide> [`buffer.constants.MAX_LENGTH`] or smaller than 0, a [`RangeError`] will be <ide> thrown. A zero-length `Buffer` will be created if `size` is 0. <ide> <ide> console.log(buf); <ide> // Prints: <Buffer 00 00 00 00 00> <ide> ``` <ide> <del>Allocates a new `Buffer` of `size` bytes. If the `size` is larger than <add>Allocates a new `Buffer` of `size` bytes. If the `size` is larger than <ide> [`buffer.constants.MAX_LENGTH`] or smaller than 0, a [`RangeError`] will be <ide> thrown. A zero-length `Buffer` will be created if `size` is 0. <ide> <ide> changes: <ide> <ide> * `size` {integer} The desired length of the new `Buffer`. <ide> <del>Allocates a new `Buffer` of `size` bytes. If the `size` is larger than <add>Allocates a new `Buffer` of `size` bytes. If the `size` is larger than <ide> [`buffer.constants.MAX_LENGTH`] or smaller than 0, a [`RangeError`] will be <ide> thrown. A zero-length `Buffer` will be created if `size` is 0. <ide> <ide> added: v5.12.0 <ide> <ide> * `size` {integer} The desired length of the new `Buffer`. <ide> <del>Allocates a new `Buffer` of `size` bytes. If the `size` is larger than <add>Allocates a new `Buffer` of `size` bytes. If the `size` is larger than <ide> [`buffer.constants.MAX_LENGTH`] or smaller than 0, a [`RangeError`] will be <ide> thrown. A zero-length `Buffer` will be created if `size` is 0. <ide> <ide> deprecated: v6.0.0 <ide> <ide> * `size` {integer} The desired length of the new `SlowBuffer`. <ide> <del>Allocates a new `Buffer` of `size` bytes. If the `size` is larger than <add>Allocates a new `Buffer` of `size` bytes. If the `size` is larger than <ide> [`buffer.constants.MAX_LENGTH`] or smaller than 0, a [`RangeError`] will be <ide> thrown. A zero-length `Buffer` will be created if `size` is 0. <ide> <ide><path>doc/api/child_process.md <ide> the event loop until the spawned process either exits or is terminated. <ide> <ide> For convenience, the `child_process` module provides a handful of synchronous <ide> and asynchronous alternatives to [`child_process.spawn()`][] and <del>[`child_process.spawnSync()`][]. *Note that each of these alternatives are <add>[`child_process.spawnSync()`][]. *Note that each of these alternatives are <ide> implemented on top of [`child_process.spawn()`][] or [`child_process.spawnSync()`][].* <ide> <ide> * [`child_process.exec()`][]: spawns a shell and runs a command within that shell, <ide> changes: <ide> * `timeout` {number} **Default:** `0` <ide> * `maxBuffer` {number} Largest amount of data in bytes allowed on stdout or <ide> stderr. If exceeded, the child process is terminated. See caveat at <del> [`maxBuffer` and Unicode][]. **Default:** `200*1024`. <add> [`maxBuffer` and Unicode][]. **Default:** `200 * 1024`. <ide> * `killSignal` {string|integer} **Default:** `'SIGTERM'` <ide> * `uid` {number} Sets the user identity of the process (see setuid(2)). <ide> * `gid` {number} Sets the group identity of the process (see setgid(2)). <ide> exec('cat *.js bad_file | wc -l', (error, stdout, stderr) => { <ide> ``` <ide> <ide> If a `callback` function is provided, it is called with the arguments <del>`(error, stdout, stderr)`. On success, `error` will be `null`. On error, <add>`(error, stdout, stderr)`. On success, `error` will be `null`. On error, <ide> `error` will be an instance of [`Error`][]. The `error.code` property will be <ide> the exit code of the child process while `error.signal` will be set to the <ide> signal that terminated the process. Any exit code other than `0` is considered <ide> changes: <ide> * `timeout` {number} **Default:** `0` <ide> * `maxBuffer` {number} Largest amount of data in bytes allowed on stdout or <ide> stderr. If exceeded, the child process is terminated. See caveat at <del> [`maxBuffer` and Unicode][]. **Default:** `200*1024`. <add> [`maxBuffer` and Unicode][]. **Default:** `200 * 1024`. <ide> * `killSignal` {string|integer} **Default:** `'SIGTERM'` <ide> * `uid` {number} Sets the user identity of the process (see setuid(2)). <ide> * `gid` {number} Sets the group identity of the process (see setgid(2)). <ide> disabled*. <ide> On non-Windows platforms, if `options.detached` is set to `true`, the child <ide> process will be made the leader of a new process group and session. Note that <ide> child processes may continue running after the parent exits regardless of <del>whether they are detached or not. See setsid(2) for more information. <add>whether they are detached or not. See setsid(2) for more information. <ide> <ide> By default, the parent will wait for the detached child to exit. To prevent <ide> the parent from waiting for a given `subprocess`, use the `subprocess.unref()` <ide> changes: <ide> process will be killed. **Default:** `'SIGTERM'`. <ide> * `maxBuffer` {number} Largest amount of data in bytes allowed on stdout or <ide> stderr. If exceeded, the child process is terminated. See caveat at <del> [`maxBuffer` and Unicode][]. **Default:** `200*1024`. <add> [`maxBuffer` and Unicode][]. **Default:** `200 * 1024`. <ide> * `encoding` {string} The encoding used for all stdio inputs and outputs. <ide> **Default:** `'buffer'`. <ide> * `windowsHide` {boolean} Hide the subprocess console window that would <ide> changes: <ide> process will be killed. **Default:** `'SIGTERM'`. <ide> * `maxBuffer` {number} Largest amount of data in bytes allowed on stdout or <ide> stderr. If exceeded, the child process is terminated. See caveat at <del> [`maxBuffer` and Unicode][]. **Default:** `200*1024`. <add> [`maxBuffer` and Unicode][]. **Default:** `200 * 1024`. <ide> * `encoding` {string} The encoding used for all stdio inputs and outputs. <ide> **Default:** `'buffer'`. <ide> * `windowsHide` {boolean} Hide the subprocess console window that would <ide> The `child_process.execSync()` method is generally identical to <ide> [`child_process.exec()`][] with the exception that the method will not return until <ide> the child process has fully closed. When a timeout has been encountered and <ide> `killSignal` is sent, the method won't return until the process has completely <del>exited. *Note that if the child process intercepts and handles the `SIGTERM` <add>exited. *Note that if the child process intercepts and handles the `SIGTERM` <ide> signal and doesn't exit, the parent process will wait until the child <ide> process has exited.* <ide> <ide> If the process times out or has a non-zero exit code, this method ***will*** <del>throw. The [`Error`][] object will contain the entire result from <add>throw. The [`Error`][] object will contain the entire result from <ide> [`child_process.spawnSync()`][] <ide> <ide> **Never pass unsanitized user input to this function. Any input containing shell <ide> changes: <ide> process will be killed. **Default:** `'SIGTERM'`. <ide> * `maxBuffer` {number} Largest amount of data in bytes allowed on stdout or <ide> stderr. If exceeded, the child process is terminated. See caveat at <del> [`maxBuffer` and Unicode][]. **Default:** `200*1024`. <add> [`maxBuffer` and Unicode][]. **Default:** `200 * 1024`. <ide> * `encoding` {string} The encoding used for all stdio inputs and outputs. <ide> **Default:** `'buffer'`. <ide> * `shell` {boolean|string} If `true`, runs `command` inside of a shell. Uses <ide> registered on the [`process.on('message')`][] event. Any data that is received <ide> and buffered in the socket will not be sent to the child. <ide> <ide> The optional `callback` is a function that is invoked after the message is <del>sent but before the child may have received it. The function is called with a <add>sent but before the child may have received it. The function is called with a <ide> single argument: `null` on success, or an [`Error`][] object on failure. <ide> <ide> If no `callback` function is provided and the message cannot be sent, an <ide><path>doc/api/cli.md <ide> added: v3.0.0 <ide> <ide> Path to the file used to store the persistent REPL history. The default path is <ide> `~/.node_repl_history`, which is overridden by this variable. Setting the value <del>to an empty string (`""` or `" "`) disables persistent REPL history. <add>to an empty string (`''` or `' '`) disables persistent REPL history. <ide> <ide> <ide> ### `NODE_EXTRA_CA_CERTS=file` <ide> reason any of these APIs takes a long time, other (seemingly unrelated) APIs <ide> that run in libuv's threadpool will experience degraded performance. In order to <ide> mitigate this issue, one potential solution is to increase the size of libuv's <ide> threadpool by setting the `'UV_THREADPOOL_SIZE'` environment variable to a value <del>greater than `4` (its current default value). For more information, see the <add>greater than `4` (its current default value). For more information, see the <ide> [libuv threadpool documentation][]. <ide> <ide> [`--openssl-config`]: #cli_openssl_config_file <ide><path>doc/api/cluster.md <ide> Node.js process and a cluster worker differs: <ide> process. <ide> 3. `server.listen(0)` Normally, this will cause servers to listen on a <ide> random port. However, in a cluster, each worker will receive the <del> same "random" port each time they do `listen(0)`. In essence, the <add> same "random" port each time they do `listen(0)`. In essence, the <ide> port is random the first time, but predictable thereafter. To listen <ide> on a unique port, generate a port number based on the cluster worker ID. <ide> <ide> things like sessions and login. <ide> <ide> Because workers are all separate processes, they can be killed or <ide> re-spawned depending on a program's needs, without affecting other <del>workers. As long as there are some workers still alive, the server will <del>continue to accept connections. If no workers are alive, existing connections <add>workers. As long as there are some workers still alive, the server will <add>continue to accept connections. If no workers are alive, existing connections <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> Emitted after the worker IPC channel has disconnected. This can occur when a <ide> worker exits gracefully, is killed, or is disconnected manually (such as with <ide> worker.disconnect()). <ide> <del>There may be a delay between the `'disconnect'` and `'exit'` events. These <add>There may be a delay between the `'disconnect'` and `'exit'` events. These <ide> events can be used to detect if the process is stuck in a cleanup or if there <ide> are long-living connections. <ide> <ide> The `addressType` is one of: <ide> * `4` (TCPv4) <ide> * `6` (TCPv6) <ide> * `-1` (unix domain socket) <del>* `"udp4"` or `"udp6"` (UDP v4 or v6) <add>* `'udp4'` or `'udp6'` (UDP v4 or v6) <ide> <ide> ## Event: 'message' <ide> <!-- YAML <ide> distribute IOCP handles without incurring a large performance hit. <ide> <ide> `cluster.schedulingPolicy` can also be set through the <ide> `NODE_CLUSTER_SCHED_POLICY` environment variable. Valid <del>values are `"rr"` and `"none"`. <add>values are `'rr'` and `'none'`. <ide> <ide> ## cluster.settings <ide> <!-- YAML <ide><path>doc/api/console.md <ide> The module exports two specific components: <ide> * A `Console` class with methods such as `console.log()`, `console.error()` and <ide> `console.warn()` that can be used to write to any Node.js stream. <ide> * A global `console` instance configured to write to [`process.stdout`][] and <del> [`process.stderr`][]. The global `console` can be used without calling <add> [`process.stderr`][]. The global `console` can be used without calling <ide> `require('console')`. <ide> <ide> ***Warning***: The global console object's methods are neither consistently <ide><path>doc/api/crypto.md <ide> Updates the cipher with `data`. If the `inputEncoding` argument is given, <ide> its value must be one of `'utf8'`, `'ascii'`, or `'latin1'` and the `data` <ide> argument is a string using the specified encoding. If the `inputEncoding` <ide> argument is not given, `data` must be a [`Buffer`][], `TypedArray`, or <del>`DataView`. If `data` is a [`Buffer`][], `TypedArray`, or `DataView`, then <add>`DataView`. If `data` is a [`Buffer`][], `TypedArray`, or `DataView`, then <ide> `inputEncoding` is ignored. <ide> <ide> The `outputEncoding` specifies the output format of the enciphered <ide> added: v0.5.0 <ide> - `encoding` {string} <ide> <ide> Returns the Diffie-Hellman generator in the specified `encoding`, which can <del>be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` is provided a string is <add>be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` is provided a string is <ide> returned; otherwise a [`Buffer`][] is returned. <ide> <ide> ### diffieHellman.getPrime([encoding]) <ide> console.log(key.toString('hex')); // '3745e48...08d59ae' <ide> ``` <ide> <ide> The `crypto.DEFAULT_ENCODING` property may be used to change the way the <del>`derivedKey` is returned. This property, however, has been deprecated and use <add>`derivedKey` is returned. This property, however, has been deprecated and use <ide> should be avoided. <ide> <ide> ```js <ide><path>doc/api/debugger.md <ide> debug> repl <ide> Press Ctrl + C to leave debug repl <ide> > x <ide> 5 <del>> 2+2 <add>> 2 + 2 <ide> 4 <ide> debug> next <ide> < world <ide><path>doc/api/deprecations.md <ide> Type: Runtime <ide> <ide> `Module._debug()` has been deprecated. <ide> <del>The `Module._debug()` function was never documented as an officially <add>The `Module._debug()` function was never documented as an officially <ide> supported API. <ide> <ide> <a id="DEP0078"></a> <ide><path>doc/api/dgram.md <ide> For UDP sockets, causes the `dgram.Socket` to listen for datagram <ide> messages on a named `port` and optional `address`. If `port` is not <ide> specified or is `0`, the operating system will attempt to bind to a <ide> random port. If `address` is not specified, the operating system will <del>attempt to listen on all addresses. Once binding is complete, a <add>attempt to listen on all addresses. Once binding is complete, a <ide> `'listening'` event is emitted and the optional `callback` function is <ide> called. <ide> <ide> messages on a named `port` and optional `address` that are passed as <ide> properties of an `options` object passed as the first argument. If <ide> `port` is not specified or is `0`, the operating system will attempt <ide> to bind to a random port. If `address` is not specified, the operating <del>system will attempt to listen on all addresses. Once binding is <add>system will attempt to listen on all addresses. Once binding is <ide> complete, a `'listening'` event is emitted and the optional `callback` <ide> function is called. <ide> <ide> drop membership on all valid interfaces. <ide> added: v8.7.0 <ide> --> <ide> <del>* Returns {number} the `SO_RCVBUF` socket receive buffer size in bytes. <add>* Returns: {number} the `SO_RCVBUF` socket receive buffer size in bytes. <ide> <ide> ### socket.getSendBufferSize() <ide> <!-- YAML <ide> added: v8.7.0 <ide> --> <ide> <del>* Returns {number} the `SO_SNDBUF` socket send buffer size in bytes. <add>* Returns: {number} the `SO_SNDBUF` socket send buffer size in bytes. <ide> <ide> ### socket.ref() <ide> <!-- YAML <ide> the `offset` and `length` specify the offset within the `Buffer` where the <ide> message begins and the number of bytes in the message, respectively. <ide> If `msg` is a `String`, then it is automatically converted to a `Buffer` <ide> with `'utf8'` encoding. With messages that <del>contain multi-byte characters, `offset` and `length` will be calculated with <add>contain multi-byte characters, `offset` and `length` will be calculated with <ide> respect to [byte length][] and not the character position. <ide> If `msg` is an array, `offset` and `length` must not be specified. <ide> <ide> The `address` argument is a string. If the value of `address` is a host name, <del>DNS will be used to resolve the address of the host. If `address` is not <add>DNS will be used to resolve the address of the host. If `address` is not <ide> provided or otherwise falsy, `'127.0.0.1'` (for `udp4` sockets) or `'::1'` <ide> (for `udp6` sockets) will be used by default. <ide> <ide> If the socket has not been previously bound with a call to `bind`, the socket <ide> is assigned a random port number and is bound to the "all interfaces" address <ide> (`'0.0.0.0'` for `udp4` sockets, `'::0'` for `udp6` sockets.) <ide> <del>An optional `callback` function may be specified to as a way of reporting <add>An optional `callback` function may be specified to as a way of reporting <ide> DNS errors or for determining when it is safe to reuse the `buf` object. <ide> Note that DNS lookups delay the time to send for at least one tick of the <ide> Node.js event loop. <ide> added: v0.6.9 <ide> <ide> * `flag` {boolean} <ide> <del>Sets or clears the `SO_BROADCAST` socket option. When set to `true`, UDP <add>Sets or clears the `SO_BROADCAST` socket option. When set to `true`, UDP <ide> packets may be sent to a local interface's broadcast address. <ide> <ide> ### socket.setMulticastInterface(multicastInterface) <ide> added: v0.3.8 <ide> <ide> * `flag` {boolean} <ide> <del>Sets or clears the `IP_MULTICAST_LOOP` socket option. When set to `true`, <add>Sets or clears the `IP_MULTICAST_LOOP` socket option. When set to `true`, <ide> multicast packets will also be received on the local interface. <ide> <ide> ### socket.setMulticastTTL(ttl) <ide> added: v0.3.8 <ide> <ide> * `ttl` {number} Integer. <ide> <del>Sets the `IP_MULTICAST_TTL` socket option. While TTL generally stands for <add>Sets the `IP_MULTICAST_TTL` socket option. While TTL generally stands for <ide> "Time to Live", in this context it specifies the number of IP hops that a <del>packet is allowed to travel through, specifically for multicast traffic. Each <add>packet is allowed to travel through, specifically for multicast traffic. Each <ide> router or gateway that forwards a packet decrements the TTL. If the TTL is <ide> decremented to 0 by a router, it will not be forwarded. <ide> <ide> added: v0.1.101 <ide> <ide> Sets the `IP_TTL` socket option. While TTL generally stands for "Time to Live", <ide> in this context it specifies the number of IP hops that a packet is allowed to <del>travel through. Each router or gateway that forwards a packet decrements the <del>TTL. If the TTL is decremented to 0 by a router, it will not be forwarded. <add>travel through. Each router or gateway that forwards a packet decrements the <add>TTL. If the TTL is decremented to 0 by a router, it will not be forwarded. <ide> Changing TTL values is typically done for network probes or when multicasting. <ide> <ide> The argument to `socket.setTTL()` is a number of hops between 1 and 255. <ide> changes: <ide> <ide> Creates a `dgram.Socket` object. Once the socket is created, calling <ide> [`socket.bind()`][] will instruct the socket to begin listening for datagram <del>messages. When `address` and `port` are not passed to [`socket.bind()`][] the <add>messages. When `address` and `port` are not passed to [`socket.bind()`][] the <ide> method will bind the socket to the "all interfaces" address on a random port <ide> (it does the right thing for both `udp4` and `udp6` sockets). The bound address <ide> and port can be retrieved using [`socket.address().address`][] and <ide> which is added as a listener for `'message'` events. <ide> <ide> Once the socket is created, calling [`socket.bind()`][] will instruct the <ide> socket to begin listening for datagram messages. When `address` and `port` are <del>not passed to [`socket.bind()`][] the method will bind the socket to the "all <add>not passed to [`socket.bind()`][] the method will bind the socket to the "all <ide> interfaces" address on a random port (it does the right thing for both `udp4` <ide> and `udp6` sockets). The bound address and port can be retrieved using <ide> [`socket.address().address`][] and [`socket.address().port`][]. <ide><path>doc/api/dns.md <ide> changes: <ide> - `all` {boolean} When `true`, the callback returns all resolved addresses in <ide> an array. Otherwise, returns a single address. **Default:** `false`. <ide> - `verbatim` {boolean} When `true`, the callback receives IPv4 and IPv6 <del> addresses in the order the DNS resolver returned them. When `false`, <add> addresses in the order the DNS resolver returned them. When `false`, <ide> IPv4 addresses are placed before IPv6 addresses. <ide> **Default:** currently `false` (addresses are reordered) but this is <ide> expected to change in the not too distant future. <ide> will be present on the object: <ide> <ide> | Type | Properties | <ide> |------|------------| <del>| `"A"` | `address` / `ttl` | <del>| `"AAAA"` | `address` / `ttl` | <del>| `"CNAME"` | `value` | <del>| `"MX"` | Refer to [`dns.resolveMx()`][] | <del>| `"NAPTR"` | Refer to [`dns.resolveNaptr()`][] | <del>| `"NS"` | `value` | <del>| `"PTR"` | `value` | <del>| `"SOA"` | Refer to [`dns.resolveSoa()`][] | <del>| `"SRV"` | Refer to [`dns.resolveSrv()`][] | <del>| `"TXT"` | This type of record contains an array property called `entries` which refers to [`dns.resolveTxt()`][], eg. `{ entries: ['...'], type: 'TXT' }` | <add>| `'A'` | `address` / `ttl` | <add>| `'AAAA'` | `address` / `ttl` | <add>| `'CNAME'` | `value` | <add>| `'MX'` | Refer to [`dns.resolveMx()`][] | <add>| `'NAPTR'` | Refer to [`dns.resolveNaptr()`][] | <add>| `'NS'` | `value` | <add>| `'PTR'` | `value` | <add>| `'SOA'` | Refer to [`dns.resolveSoa()`][] | <add>| `'SRV'` | Refer to [`dns.resolveSrv()`][] | <add>| `'TXT'` | This type of record contains an array property called `entries` which refers to [`dns.resolveTxt()`][], eg. `{ entries: ['...'], type: 'TXT' }` | <ide> <ide> Here is an example of the `ret` object passed to the callback: <ide> <ide><path>doc/api/domain.md <ide> but should expect to have to migrate to a different solution <ide> in the future. <ide> <ide> Domains provide a way to handle multiple different IO operations as a <del>single group. If any of the event emitters or callbacks registered to a <add>single group. If any of the event emitters or callbacks registered to a <ide> domain emit an `'error'` event, or throw an error, then the domain object <ide> will be notified, rather than losing the context of the error in the <ide> `process.on('uncaughtException')` handler, or causing the program to <ide> time, and stop listening for new requests in that worker. <ide> <ide> In this way, `domain` usage goes hand-in-hand with the cluster module, <ide> since the master process can fork a new worker when a worker <del>encounters an error. For Node.js programs that scale to multiple <add>encounters an error. For Node.js programs that scale to multiple <ide> machines, the terminating proxy or service registry can take note of <ide> the failure, and react accordingly. <ide> <ide> For example, this is not a good idea: <ide> <ide> ```js <del>// XXX WARNING! BAD IDEA! <add>// XXX WARNING! BAD IDEA! <ide> <ide> const d = require('domain').create(); <ide> d.on('error', (er) => { <ide> if (cluster.isMaster) { <ide> const domain = require('domain'); <ide> <ide> // See the cluster documentation for more details about using <del> // worker processes to serve requests. How it works, caveats, etc. <add> // worker processes to serve requests. How it works, caveats, etc. <ide> <ide> const server = require('http').createServer((req, res) => { <ide> const d = domain.create(); <ide> if (cluster.isMaster) { <ide> // Note: We're in dangerous territory! <ide> // By definition, something unexpected occurred, <ide> // which we probably didn't want. <del> // Anything can happen now! Be very careful! <add> // Anything can happen now! Be very careful! <ide> <ide> try { <ide> // make sure we close down within 30 seconds <ide> if (cluster.isMaster) { <ide> // stop taking new requests. <ide> server.close(); <ide> <del> // Let the master know we're dead. This will trigger a <add> // Let the master know we're dead. This will trigger a <ide> // 'disconnect' in the cluster master, and then it will fork <ide> // a new worker. <ide> cluster.worker.disconnect(); <ide> if (cluster.isMaster) { <ide> server.listen(PORT); <ide> } <ide> <del>// This part is not important. Just an example routing thing. <add>// This part is not important. Just an example routing thing. <ide> // Put fancy application logic here. <ide> function handleRequest(req, res) { <ide> switch (req.url) { <ide> bound to the active domain. If they throw, then the domain will catch <ide> the error. <ide> <ide> In order to prevent excessive memory usage, Domain objects themselves <del>are not implicitly added as children of the active domain. If they <add>are not implicitly added as children of the active domain. If they <ide> were, then it would be too easy to prevent request and response objects <ide> from being properly garbage collected. <ide> <ide> Implicit binding only takes care of thrown errors and `'error'` events. <ide> <!--type=misc--> <ide> <ide> Sometimes, the domain in use is not the one that ought to be used for a <del>specific event emitter. Or, the event emitter could have been created <add>specific event emitter. Or, the event emitter could have been created <ide> in the context of one domain, but ought to instead be bound to some <ide> other domain. <ide> <ide> Returns a new Domain object. <ide> The Domain class encapsulates the functionality of routing errors and <ide> uncaught exceptions to the active Domain object. <ide> <del>Domain is a child class of [`EventEmitter`][]. To handle the errors that it <add>Domain is a child class of [`EventEmitter`][]. To handle the errors that it <ide> catches, listen to its `'error'` event. <ide> <ide> ### domain.members <ide> to the domain. <ide> <ide> * `emitter` {EventEmitter|Timer} emitter or timer to be added to the domain <ide> <del>Explicitly adds an emitter to the domain. If any event handlers called by <add>Explicitly adds an emitter to the domain. If any event handlers called by <ide> the emitter throw an error, or if the emitter emits an `'error'` event, it <ide> will be routed to the domain's `'error'` event, just like with implicit <ide> binding. <ide> <ide> This also works with timers that are returned from [`setInterval()`][] and <del>[`setTimeout()`][]. If their callback function throws, it will be caught by <add>[`setTimeout()`][]. If their callback function throws, it will be caught by <ide> the domain 'error' handler. <ide> <ide> If the Timer or EventEmitter was already bound to a domain, it is removed <ide> from that one, and bound to this one instead. <ide> * Returns: {Function} The bound function <ide> <ide> The returned function will be a wrapper around the supplied callback <del>function. When the returned function is called, any errors that are <add>function. When the returned function is called, any errors that are <ide> thrown will be routed to the domain's `'error'` event. <ide> <ide> #### Example <ide> single domain. <ide> * `callback` {Function} The callback function <ide> * Returns: {Function} The intercepted function <ide> <del>This method is almost identical to [`domain.bind(callback)`][]. However, in <add>This method is almost identical to [`domain.bind(callback)`][]. However, in <ide> addition to catching thrown errors, it will also intercept [`Error`][] <ide> objects sent as the first argument to the function. <ide> <ide> d.on('error', (er) => { <ide> <ide> * `emitter` {EventEmitter|Timer} emitter or timer to be removed from the domain <ide> <del>The opposite of [`domain.add(emitter)`][]. Removes domain handling from the <add>The opposite of [`domain.add(emitter)`][]. Removes domain handling from the <ide> specified emitter. <ide> <ide> ### domain.run(fn[, ...args]) <ide><path>doc/api/errors.md <ide> pass or fail). <ide> <ide> For *all* [`EventEmitter`][] objects, if an `'error'` event handler is not <ide> provided, the error will be thrown, causing the Node.js process to report an <del>unhandled exception and crash unless either: The [`domain`][domains] module is <add>unhandled exception and crash unless either: The [`domain`][domains] module is <ide> used appropriately or a handler has been registered for the <ide> [`process.on('uncaughtException')`][] event. <ide> <ide> exactly how errors raised by those methods are propagated. <ide> <!--type=misc--> <ide> <ide> Most asynchronous methods exposed by the Node.js core API follow an idiomatic <del>pattern referred to as an _error-first callback_ (sometimes referred to as <add>pattern referred to as an _error-first callback_ (sometimes referred to as <ide> a _Node.js style callback_). With this pattern, a callback function is passed <ide> to the method as an argument. When the operation either completes or an error <ide> is raised, the callback function is called with <ide> fs.readFile('/some/file/that/does-exist', errorFirstCallback); <ide> ``` <ide> <ide> The JavaScript `try / catch` mechanism **cannot** be used to intercept errors <del>generated by asynchronous APIs. A common mistake for beginners is to try to <add>generated by asynchronous APIs. A common mistake for beginners is to try to <ide> use `throw` inside an error-first callback: <ide> <ide> ```js <ide> provided text message. If an object is passed as `message`, the text message <ide> is generated by calling `message.toString()`. The `error.stack` property will <ide> represent the point in the code at which `new Error()` was called. Stack traces <ide> are dependent on [V8's stack trace API][]. Stack traces extend only to either <del>(a) the beginning of *synchronous code execution*, or (b) the number of frames <add>(a) the beginning of *synchronous code execution*, or (b) the number of frames <ide> given by the property `Error.stackTraceLimit`, whichever is smaller. <ide> <ide> ### Error.captureStackTrace(targetObject[, constructorOpt]) <ide> found [here][online]. <ide> - `EACCES` (Permission denied): An attempt was made to access a file in a way <ide> forbidden by its file access permissions. <ide> <del>- `EADDRINUSE` (Address already in use): An attempt to bind a server <add>- `EADDRINUSE` (Address already in use): An attempt to bind a server <ide> ([`net`][], [`http`][], or [`https`][]) to a local address failed due to <ide> another server on the local system already occupying that address. <ide> <ide> found [here][online]. <ide> `ulimit -n 2048` in the same shell that will run the Node.js process. <ide> <ide> - `ENOENT` (No such file or directory): Commonly raised by [`fs`][] operations <del> to indicate that a component of the specified pathname does not exist -- no <add> to indicate that a component of the specified pathname does not exist — no <ide> entity (file or directory) could be found by the given path. <ide> <ide> - `ENOTDIR` (Not a directory): A component of the given pathname existed, but <ide> was not a directory as expected. Commonly raised by [`fs.readdir`][]. <ide> <ide> - `ENOTEMPTY` (Directory not empty): A directory with entries was the target <del> of an operation that requires an empty directory -- usually [`fs.unlink`][]. <add> of an operation that requires an empty directory — usually [`fs.unlink`][]. <ide> <ide> - `EPERM` (Operation not permitted): An attempt was made to perform an <ide> operation that requires elevated privileges. <ide> found [here][online]. <ide> <ide> - `ETIMEDOUT` (Operation timed out): A connect or send request failed because <ide> the connected party did not properly respond after a period of time. Usually <del> encountered by [`http`][] or [`net`][] -- often a sign that a `socket.end()` <add> encountered by [`http`][] or [`net`][] — often a sign that a `socket.end()` <ide> was not properly called. <ide> <ide> <a id="nodejs-error-codes"></a> <ide><path>doc/api/esm.md <ide> module. This can be one of the following: <ide> <ide> | `format` | Description | <ide> | --- | --- | <del>| `"esm"` | Load a standard JavaScript module | <del>| `"cjs"` | Load a node-style CommonJS module | <del>| `"builtin"` | Load a node builtin CommonJS module | <del>| `"json"` | Load a JSON file | <del>| `"addon"` | Load a [C++ Addon][addons] | <del>| `"dynamic"` | Use a [dynamic instantiate hook][] | <add>| `'esm'` | Load a standard JavaScript module | <add>| `'cjs'` | Load a node-style CommonJS module | <add>| `'builtin'` | Load a node builtin CommonJS module | <add>| `'json'` | Load a JSON file | <add>| `'addon'` | Load a [C++ Addon][addons] | <add>| `'dynamic'` | Use a [dynamic instantiate hook][] | <ide> <ide> For example, a dummy loader to load JavaScript restricted to browser resolution <ide> rules with only JS file extension and Node.js builtin modules support could <ide> would load the module `x.js` as an ES module with relative resolution support <ide> <ide> To create a custom dynamic module that doesn't correspond to one of the <ide> existing `format` interpretations, the `dynamicInstantiate` hook can be used. <del>This hook is called only for modules that return `format: "dynamic"` from <add>This hook is called only for modules that return `format: 'dynamic'` from <ide> the `resolve` hook. <ide> <ide> ```js <ide><path>doc/api/fs.md <ide> fs.rename('/tmp/hello', '/tmp/world', (err) => { <ide> <ide> In busy processes, the programmer is _strongly encouraged_ to use the <ide> asynchronous versions of these calls. The synchronous versions will block <del>the entire process until they complete--halting all connections. <add>the entire process until they complete — halting all connections. <ide> <ide> While it is not recommended, most fs functions allow the callback argument to <ide> be omitted, in which case a default callback is used that rethrows errors. To <ide> representation. <ide> <ide> The times in the stat object have the following semantics: <ide> <del>* `atime` "Access Time" - Time when file data last accessed. Changed <add>* `atime` "Access Time" - Time when file data last accessed. Changed <ide> by the mknod(2), utimes(2), and read(2) system calls. <ide> * `mtime` "Modified Time" - Time when file data last modified. <ide> Changed by the mknod(2), utimes(2), and write(2) system calls. <ide> * `ctime` "Change Time" - Time when file status was last changed <del> (inode data modification). Changed by the chmod(2), chown(2), <add> (inode data modification). Changed by the chmod(2), chown(2), <ide> link(2), mknod(2), rename(2), unlink(2), utimes(2), <ide> read(2), and write(2) system calls. <del>* `birthtime` "Birth Time" - Time of file creation. Set once when the <del> file is created. On filesystems where birthtime is not available, <add>* `birthtime` "Birth Time" - Time of file creation. Set once when the <add> file is created. On filesystems where birthtime is not available, <ide> this field may instead hold either the `ctime` or <ide> `1970-01-01T00:00Z` (ie, unix epoch timestamp `0`). Note that this <ide> value may be greater than `atime` or `mtime` in this case. On Darwin <ide> The times in the stat object have the following semantics: <ide> utimes(2) system call. <ide> <ide> Prior to Node.js v0.12, the `ctime` held the `birthtime` on Windows <del>systems. Note that as of v0.12, `ctime` is not "creation time", and <add>systems. Note that as of v0.12, `ctime` is not "creation time", and <ide> on Unix systems, it never was. <ide> <ide> ## Class: fs.WriteStream <ide> changes: <ide> * `callback` {Function} <ide> * `err` {Error} <ide> <del>Asynchronous close(2). No arguments other than a possible exception are given <add>Asynchronous close(2). No arguments other than a possible exception are given <ide> to the completion callback. <ide> <ide> ## fs.closeSync(fd) <ide> const defaults = { <ide> ``` <ide> <ide> `options` can include `start` and `end` values to read a range of bytes from <del>the file instead of the entire file. Both `start` and `end` are inclusive and <add>the file instead of the entire file. Both `start` and `end` are inclusive and <ide> start counting at 0. If `fd` is specified and `start` is omitted or `undefined`, <ide> `fs.createReadStream()` reads sequentially from the current file position. <ide> The `encoding` can be any one of those accepted by [`Buffer`][]. <ide> const defaults = { <ide> ``` <ide> <ide> `options` may also include a `start` option to allow writing data at <del>some position past the beginning of the file. Modifying a file rather <add>some position past the beginning of the file. Modifying a file rather <ide> than replacing it may require a `flags` mode of `r+` rather than the <ide> default mode `w`. The `encoding` can be any one of those accepted by <ide> [`Buffer`][]. <ide> deprecated: v1.0.0 <ide> * `exists` {boolean} <ide> <ide> Test whether or not the given path exists by checking with the file system. <del>Then call the `callback` argument with either true or false. Example: <add>Then call the `callback` argument with either true or false. Example: <ide> <ide> ```js <ide> fs.exists('/etc/passwd', (exists) => { <ide> to a non-existent file. The exclusive flag may or may not work with network file <ide> systems. <ide> <ide> `flags` can also be a number as documented by open(2); commonly used constants <del>are available from `fs.constants`. On Windows, flags are translated to <add>are available from `fs.constants`. On Windows, flags are translated to <ide> their equivalent ones where applicable, e.g. `O_WRONLY` to `FILE_GENERIC_WRITE`, <ide> or `O_EXCL|O_CREAT` to `CREATE_NEW`, as accepted by CreateFileW. <ide> <ide> changes: <ide> * `err` {Error} <ide> * `files` {string[]|Buffer[]} <ide> <del>Asynchronous readdir(3). Reads the contents of a directory. <add>Asynchronous readdir(3). Reads the contents of a directory. <ide> The callback gets two arguments `(err, files)` where `files` is an array of <ide> the names of the files in the directory excluding `'.'` and `'..'`. <ide> <ide> the path passed to the callback. If the `encoding` is set to `'buffer'`, <ide> the path returned will be passed as a `Buffer` object. <ide> <ide> On Linux, when Node.js is linked against musl libc, the procfs file system must <del>be mounted on `/proc` in order for this function to work. Glibc does not have <add>be mounted on `/proc` in order for this function to work. Glibc does not have <ide> this restriction. <ide> <ide> ## fs.realpathSync(path[, options]) <ide> the path passed to the callback. If the `encoding` is set to `'buffer'`, <ide> the path returned will be passed as a `Buffer` object. <ide> <ide> On Linux, when Node.js is linked against musl libc, the procfs file system must <del>be mounted on `/proc` in order for this function to work. Glibc does not have <add>be mounted on `/proc` in order for this function to work. Glibc does not have <ide> this restriction. <ide> <ide> ## fs.rename(oldPath, newPath, callback) <ide> Calling `fs.unwatchFile()` with a filename that is not being watched is a <ide> no-op, not an error. <ide> <ide> Using [`fs.watch()`][] is more efficient than `fs.watchFile()` and <del>`fs.unwatchFile()`. `fs.watch()` should be used instead of `fs.watchFile()` <add>`fs.unwatchFile()`. `fs.watch()` should be used instead of `fs.watchFile()` <ide> and `fs.unwatchFile()` when possible. <ide> <ide> ## fs.utimes(path, atime, mtime, callback) <ide> changes: <ide> * `filename` {string|Buffer} <ide> <ide> Watch for changes on `filename`, where `filename` is either a file or a <del>directory. The returned object is a [`fs.FSWatcher`][]. <add>directory. The returned object is a [`fs.FSWatcher`][]. <ide> <ide> The second argument is optional. If `options` is provided as a string, it <ide> specifies the `encoding`. Otherwise `options` should be passed as an object. <ide> <del>The listener callback gets two arguments `(eventType, filename)`. `eventType` <add>The listener callback gets two arguments `(eventType, filename)`. `eventType` <ide> is either `'rename'` or `'change'`, and `filename` is the name of the file <ide> which triggered the event. <ide> <ide> content, and one for truncation). <ide> <!--type=misc--> <ide> <ide> Providing `filename` argument in the callback is only supported on Linux, <del>macOS, Windows, and AIX. Even on supported platforms, `filename` is not always <add>macOS, Windows, and AIX. Even on supported platforms, `filename` is not always <ide> guaranteed to be provided. Therefore, don't assume that `filename` argument is <ide> always provided in the callback, and have some fallback logic if it is null. <ide> <ide> changes: <ide> * `written` {integer} <ide> * `string` {string} <ide> <del>Write `string` to the file specified by `fd`. If `string` is not a string, then <add>Write `string` to the file specified by `fd`. If `string` is not a string, then <ide> the value will be coerced to one. <ide> <ide> `position` refers to the offset from the beginning of the file where this data <ide> Instances of the `FileHandle` object are created internally by the <ide> `fsPromises.open()` method. <ide> <ide> Unlike callback-based such as `fs.fstat()`, `fs.fchown()`, `fs.fchmod()`, <del>`fs.ftruncate()`, `fs.read()`, and `fs.write()`, operations -- all of which <add>`fs.ftruncate()`, `fs.read()`, and `fs.write()`, operations — all of which <ide> use a simple numeric file descriptor, all `fsPromises.*` variations use the <ide> `FileHandle` class in order to help protect against accidental leaking of <ide> unclosed file descriptors after a `Promise` is resolved or rejected. <ide> added: REPLACEME <ide> * `path` {string|Buffer|URL} <ide> * `flags` {string|number} <ide> * `mode` {integer} **Default:** `0o666` (readable and writable) <del>* Return: {Promise} <add>* Returns: {Promise} <ide> <ide> Asynchronous file open that returns a `Promise` that, when resolved, yields a <ide> `FileHandle` object. See open(2). <ide> to a non-existent file. The exclusive flag may or may not work with network file <ide> systems. <ide> <ide> `flags` can also be a number as documented by open(2); commonly used constants <del>are available from `fs.constants`. On Windows, flags are translated to <add>are available from `fs.constants`. On Windows, flags are translated to <ide> their equivalent ones where applicable, e.g. `O_WRONLY` to `FILE_GENERIC_WRITE`, <ide> or `O_EXCL|O_CREAT` to `CREATE_NEW`, as accepted by CreateFileW. <ide> <ide> the path. If the `encoding` is set to `'buffer'`, the path returned will be <ide> passed as a `Buffer` object. <ide> <ide> On Linux, when Node.js is linked against musl libc, the procfs file system must <del>be mounted on `/proc` in order for this function to work. Glibc does not have <add>be mounted on `/proc` in order for this function to work. Glibc does not have <ide> this restriction. <ide> <ide> ### fsPromises.rename(oldPath, newPath) <ide><path>doc/api/http.md <ide> To use the HTTP server and client one must `require('http')`. <ide> The HTTP interfaces in Node.js are designed to support many features <ide> of the protocol which have been traditionally difficult to use. <ide> In particular, large, possibly chunk-encoded, messages. The interface is <del>careful to never buffer entire requests or responses--the <add>careful to never buffer entire requests or responses — the <ide> user is able to stream data. <ide> <ide> HTTP message headers are represented by an object like this: <ide> parse the actual headers or the body. <ide> See [`message.headers`][] for details on how duplicate headers are handled. <ide> <ide> The raw headers as they were received are retained in the `rawHeaders` <del>property, which is an array of `[key, value, key2, value2, ...]`. For <add>property, which is an array of `[key, value, key2, value2, ...]`. For <ide> example, the previous message header object might have a `rawHeaders` <ide> list like the following: <ide> <ide> added: v0.3.4 <ide> * `maxSockets` {number} Maximum number of sockets to allow per <ide> host. **Default:** `Infinity`. <ide> * `maxFreeSockets` {number} Maximum number of sockets to leave open <del> in a free state. Only relevant if `keepAlive` is set to `true`. <add> in a free state. Only relevant if `keepAlive` is set to `true`. <ide> **Default:** `256`. <ide> <ide> The default [`http.globalAgent`][] that is used by [`http.request()`][] has all <ide> added: v0.11.4 <ide> <ide> Destroy any sockets that are currently in use by the agent. <ide> <del>It is usually not necessary to do this. However, if using an <add>It is usually not necessary to do this. However, if using an <ide> agent with `keepAlive` enabled, then it is best to explicitly shut down <del>the agent when it will no longer be used. Otherwise, <add>the agent when it will no longer be used. Otherwise, <ide> sockets may hang open for quite a long time before the server <ide> terminates them. <ide> <ide> added: v0.11.4 <ide> * {Object} <ide> <ide> An object which contains arrays of sockets currently awaiting use by <del>the agent when `keepAlive` is enabled. Do not modify. <add>the agent when `keepAlive` is enabled. Do not modify. <ide> <ide> ### agent.getName(options) <ide> <!-- YAML <ide> added: v0.11.7 <ide> <ide> * {number} <ide> <del>By default set to 256. For agents with `keepAlive` enabled, this <add>By default set to 256. For agents with `keepAlive` enabled, this <ide> sets the maximum number of sockets that will be left open in the free <ide> state. <ide> <ide> added: v0.3.6 <ide> * {Object} <ide> <ide> An object which contains arrays of sockets currently in use by the <del>agent. Do not modify. <add>agent. Do not modify. <ide> <ide> ## Class: http.ClientRequest <ide> <!-- YAML <ide> added: v0.1.17 <ide> --> <ide> <del>This object is created internally and returned from [`http.request()`][]. It <del>represents an _in-progress_ request whose header has already been queued. The <add>This object is created internally and returned from [`http.request()`][]. It <add>represents an _in-progress_ request whose header has already been queued. The <ide> header is still mutable using the [`setHeader(name, value)`][], <del> [`getHeader(name)`][], [`removeHeader(name)`][] API. The actual header will <add> [`getHeader(name)`][], [`removeHeader(name)`][] API. The actual header will <ide> be sent along with the first data chunk or when calling [`request.end()`][]. <ide> <ide> To get the response, add a listener for [`'response'`][] to the request object. <ide> [`'response'`][] will be emitted from the request object when the response <del>headers have been received. The [`'response'`][] event is executed with one <add>headers have been received. The [`'response'`][] event is executed with one <ide> argument which is an instance of [`http.IncomingMessage`][]. <ide> <ide> During the [`'response'`][] event, one can add listeners to the <ide> response object; particularly to listen for the `'data'` event. <ide> <ide> If no [`'response'`][] handler is added, then the response will be <del>entirely discarded. However, if a [`'response'`][] event handler is added, <add>entirely discarded. However, if a [`'response'`][] event handler is added, <ide> then the data from the response object **must** be consumed, either by <ide> calling `response.read()` whenever there is a `'readable'` event, or <ide> by adding a `'data'` handler, or by calling the `.resume()` method. <del>Until the data is consumed, the `'end'` event will not fire. Also, until <add>Until the data is consumed, the `'end'` event will not fire. Also, until <ide> the data is read it will consume memory that can eventually lead to a <ide> 'process out of memory' error. <ide> <ide> For efficiency reasons, Node.js normally buffers the request headers until <ide> then tries to pack the request headers and data into a single TCP packet. <ide> <ide> That's usually desired (it saves a TCP round-trip), but not when the first <del>data is not sent until possibly much later. `request.flushHeaders()` bypasses <add>data is not sent until possibly much later. `request.flushHeaders()` bypasses <ide> the optimization and kickstarts the request. <ide> <ide> ### request.getHeader(name) <ide> added: v0.1.29 <ide> * `encoding` {string} <ide> * `callback` {Function} <ide> <del>Sends a chunk of the body. By calling this method <add>Sends a chunk of the body. By calling this method <ide> many times, a request body can be sent to a <del>server--in that case it is suggested to use the <add>server — in that case it is suggested to use the <ide> `['Transfer-Encoding', 'chunked']` header line when <ide> creating the request. <ide> <ide> added: v0.1.90 <ide> <ide> * `callback` {Function} <ide> <del>Stops the server from accepting new connections. See [`net.Server.close()`][]. <add>Stops the server from accepting new connections. See [`net.Server.close()`][]. <ide> <ide> ### server.listen() <ide> <ide> If there is a `'timeout'` event listener on the Server object, then it <ide> will be called with the timed-out socket as an argument. <ide> <ide> By default, the Server's timeout value is 2 minutes, and sockets are <del>destroyed automatically if they time out. However, if a callback is assigned <add>destroyed automatically if they time out. However, if a callback is assigned <ide> to the Server's `'timeout'` event, timeouts must be handled explicitly. <ide> <ide> Returns `server`. <ide> affects new connections to the server, not any existing connections. <ide> added: v0.1.17 <ide> --> <ide> <del>This object is created internally by an HTTP server--not by the user. It is <add>This object is created internally by an HTTP server — not by the user. It is <ide> passed as the second parameter to the [`'request'`][] event. <ide> <ide> The response implements, but does not inherit from, the [Writable Stream][] <ide> added: v0.4.0 <ide> * `name` {string} <ide> * `value` {string | string[]} <ide> <del>Sets a single header value for implicit headers. If this header already exists <del>in the to-be-sent headers, its value will be replaced. Use an array of strings <add>Sets a single header value for implicit headers. If this header already exists <add>in the to-be-sent headers, its value will be replaced. Use an array of strings <ide> here to send multiple headers with the same name. <ide> <ide> Example: <ide> added: v0.9.12 <ide> * `msecs` {number} <ide> * `callback` {Function} <ide> <del>Sets the Socket's timeout value to `msecs`. If a callback is <add>Sets the Socket's timeout value to `msecs`. If a callback is <ide> provided, then it is added as a listener on the `'timeout'` event on <ide> the response object. <ide> <ide> If no `'timeout'` listener is added to the request, the response, or <del>the server, then sockets are destroyed when they time out. If a handler is <add>the server, then sockets are destroyed when they time out. If a handler is <ide> assigned to the request, the response, or the server's `'timeout'` events, <ide> timed out sockets must be handled explicitly. <ide> <ide> added: v0.11.6 <ide> <ide> The raw request/response headers list exactly as they were received. <ide> <del>Note that the keys and values are in the same list. It is *not* a <del>list of tuples. So, the even-numbered offsets are key values, and the <add>Note that the keys and values are in the same list. It is *not* a <add>list of tuples. So, the even-numbered offsets are key values, and the <ide> odd-numbered offsets are the associated values. <ide> <ide> Header names are not lowercased, and duplicates are not merged. <ide> added: v0.11.6 <ide> * {Array} <ide> <ide> The raw request/response trailer keys and values exactly as they were <del>received. Only populated at the `'end'` event. <add>received. Only populated at the `'end'` event. <ide> <ide> ### message.setTimeout(msecs, callback) <ide> <!-- YAML <ide> Then `request.url` will be: <ide> ``` <ide> <ide> To parse the url into its parts `require('url').parse(request.url)` <del>can be used. Example: <add>can be used. Example: <ide> <ide> ```txt <ide> $ node <ide> added: v0.1.22 <ide> * {Object} <ide> <ide> A collection of all the standard HTTP response status codes, and the <del>short description of each. For example, `http.STATUS_CODES[404] === 'Not <add>short description of each. For example, `http.STATUS_CODES[404] === 'Not <ide> Found'`. <ide> <ide> ## http.createServer([options][, requestListener]) <ide><path>doc/api/http2.md <ide> added: v8.4.0 <ide> * Extends: {net.Server} <ide> <ide> In `Http2Server`, there are no `'clientError'` events as there are in <del>HTTP1. However, there are `'sessionError'`, and `'streamError'` events for <add>HTTP1. However, there are `'sessionError'`, and `'streamError'` events for <ide> errors emitted on the socket, or from `Http2Session` or `Http2Stream` instances. <ide> <ide> #### Event: 'checkContinue' <ide> changes: <ide> * ...: Any [`tls.createServer()`][] options can be provided. For <ide> servers, the identity options (`pfx` or `key`/`cert`) are usually required. <ide> * `onRequestHandler` {Function} See [Compatibility API][] <del>* Returns {Http2SecureServer} <add>* Returns: {Http2SecureServer} <ide> <ide> Returns a `tls.Server` instance that creates and manages `Http2Session` <ide> instances. <ide> changes: <ide> [`Duplex`][] stream that is to be used as the connection for this session. <ide> * ...: Any [`net.connect()`][] or [`tls.connect()`][] options can be provided. <ide> * `listener` {Function} <del>* Returns {ClientHttp2Session} <add>* Returns: {ClientHttp2Session} <ide> <ide> Returns a `ClientHttp2Session` instance. <ide> <ide> added: v8.4.0 <ide> <ide> The raw request/response headers list exactly as they were received. <ide> <del>Note that the keys and values are in the same list. It is *not* a <del>list of tuples. So, the even-numbered offsets are key values, and the <add>Note that the keys and values are in the same list. It is *not* a <add>list of tuples. So, the even-numbered offsets are key values, and the <ide> odd-numbered offsets are the associated values. <ide> <ide> Header names are not lowercased, and duplicates are not merged. <ide> added: v8.4.0 <ide> * {Array} <ide> <ide> The raw request/response trailer keys and values exactly as they were <del>received. Only populated at the `'end'` event. <add>received. Only populated at the `'end'` event. <ide> <ide> #### request.setTimeout(msecs, callback) <ide> <!-- YAML <ide> added: v8.4.0 <ide> * `msecs` {number} <ide> * `callback` {Function} <ide> <del>Sets the [`Http2Stream`]()'s timeout value to `msecs`. If a callback is <add>Sets the [`Http2Stream`]()'s timeout value to `msecs`. If a callback is <ide> provided, then it is added as a listener on the `'timeout'` event on <ide> the response object. <ide> <ide> Then `request.url` will be: <ide> ``` <ide> <ide> To parse the url into its parts `require('url').parse(request.url)` <del>can be used. Example: <add>can be used. Example: <ide> <ide> ```txt <ide> $ node <ide> Url { <ide> added: v8.4.0 <ide> --> <ide> <del>This object is created internally by an HTTP server--not by the user. It is <add>This object is created internally by an HTTP server — not by the user. It is <ide> passed as the second parameter to the [`'request'`][] event. <ide> <ide> The response implements, but does not inherit from, the [Writable Stream][] <ide> added: v8.4.0 <ide> * `name` {string} <ide> * `value` {string|string[]} <ide> <del>Sets a single header value for implicit headers. If this header already exists <del>in the to-be-sent headers, its value will be replaced. Use an array of strings <add>Sets a single header value for implicit headers. If this header already exists <add>in the to-be-sent headers, its value will be replaced. Use an array of strings <ide> here to send multiple headers with the same name. <ide> <ide> Example: <ide> added: v8.4.0 <ide> * `msecs` {number} <ide> * `callback` {Function} <ide> <del>Sets the [`Http2Stream`]()'s timeout value to `msecs`. If a callback is <add>Sets the [`Http2Stream`]()'s timeout value to `msecs`. If a callback is <ide> provided, then it is added as a listener on the `'timeout'` event on <ide> the response object. <ide> <ide> response.writeHead(200, { <ide> ``` <ide> <ide> Note that Content-Length is given in bytes not characters. The <del>`Buffer.byteLength()` API may be used to determine the number of bytes in a <add>`Buffer.byteLength()` API may be used to determine the number of bytes in a <ide> given encoding. On outbound messages, Node.js does not check if Content-Length <ide> and the length of the body being transmitted are equal or not. However, when <ide> receiving messages, Node.js will automatically reject messages when the <ide><path>doc/api/https.md <ide> separate module. <ide> added: v0.4.5 <ide> --> <ide> <del>An [`Agent`][] object for HTTPS similar to [`http.Agent`][]. See <add>An [`Agent`][] object for HTTPS similar to [`http.Agent`][]. See <ide> [`https.request()`][] for more information. <ide> <ide> ## Class: https.Server <ide><path>doc/api/modules.md <ide> the version that is symlinked into <ide> <ide> Furthermore, to make the module lookup process even more optimal, rather <ide> than putting packages directly in `/usr/lib/node`, we could put them in <del>`/usr/lib/node_modules/<name>/<version>`. Then Node.js will not bother <add>`/usr/lib/node_modules/<name>/<version>`. Then Node.js will not bother <ide> looking for missing dependencies in `/usr/node_modules` or `/node_modules`. <ide> <ide> In order to make modules available to the Node.js REPL, it might be useful to <ide> also add the `/usr/lib/node_modules` folder to the `$NODE_PATH` environment <del>variable. Since the module lookups using `node_modules` folders are all <add>variable. Since the module lookups using `node_modules` folders are all <ide> relative, and based on the real path of the files making the calls to <ide> `require()`, the packages themselves can be anywhere. <ide> <ide> NODE_MODULES_PATHS(START) <ide> <ide> <!--type=misc--> <ide> <del>Modules are cached after the first time they are loaded. This means <add>Modules are cached after the first time they are loaded. This means <ide> (among other things) that every call to `require('foo')` will get <ide> exactly the same object returned, if it would resolve to the same file. <ide> <ide> Multiple calls to `require('foo')` may not cause the module code to be <del>executed multiple times. This is an important feature. With it, <add>executed multiple times. This is an important feature. With it, <ide> "partially done" objects can be returned, thus allowing transitive <ide> dependencies to be loaded even when they would cause cycles. <ide> <ide> that function. <ide> <ide> <!--type=misc--> <ide> <del>Modules are cached based on their resolved filename. Since modules may <add>Modules are cached based on their resolved filename. Since modules may <ide> resolve to a different filename based on the location of the calling <ide> module (loading from `node_modules` folders), it is not a *guarantee* <ide> that `require('foo')` will always return the exact same object, if it <ide> irrespective of whether or not `./foo` and `./FOO` are the same file. <ide> <ide> <!--type=misc--> <ide> <del>Node.js has several modules compiled into the binary. These modules are <add>Node.js has several modules compiled into the binary. These modules are <ide> described in greater detail elsewhere in this documentation. <ide> <ide> The core modules are defined within Node.js's source and are located in the <ide> `lib/` folder. <ide> <ide> Core modules are always preferentially loaded if their identifier is <del>passed to `require()`. For instance, `require('http')` will always <add>passed to `require()`. For instance, `require('http')` will always <ide> return the built in HTTP module, even if there is a file by that name. <ide> <ide> ## Cycles <ide> console.log('b done'); <ide> console.log('main starting'); <ide> const a = require('./a.js'); <ide> const b = require('./b.js'); <del>console.log('in main, a.done=%j, b.done=%j', a.done, b.done); <add>console.log('in main, a.done = %j, b.done = %j', a.done, b.done); <ide> ``` <ide> <del>When `main.js` loads `a.js`, then `a.js` in turn loads `b.js`. At that <del>point, `b.js` tries to load `a.js`. In order to prevent an infinite <add>When `main.js` loads `a.js`, then `a.js` in turn loads `b.js`. At that <add>point, `b.js` tries to load `a.js`. In order to prevent an infinite <ide> loop, an **unfinished copy** of the `a.js` exports object is returned to the <del>`b.js` module. `b.js` then finishes loading, and its `exports` object is <add>`b.js` module. `b.js` then finishes loading, and its `exports` object is <ide> provided to the `a.js` module. <ide> <ide> By the time `main.js` has loaded both modules, they're both finished. <ide> in b, a.done = false <ide> b done <ide> in a, b.done = true <ide> a done <del>in main, a.done=true, b.done=true <add>in main, a.done = true, b.done = true <ide> ``` <ide> <ide> Careful planning is required to allow cyclic module dependencies to work <ide> required filename with the added extensions: `.js`, `.json`, and finally <ide> parsed as JSON text files. `.node` files are interpreted as compiled addon <ide> modules loaded with `dlopen`. <ide> <del>A required module prefixed with `'/'` is an absolute path to the file. For <add>A required module prefixed with `'/'` is an absolute path to the file. For <ide> example, `require('/home/marco/foo.js')` will load the file at <ide> `/home/marco/foo.js`. <ide> <ide> There are three ways in which a folder may be passed to `require()` as <ide> an argument. <ide> <ide> The first is to create a `package.json` file in the root of the folder, <del>which specifies a `main` module. An example package.json file might <add>which specifies a `main` module. An example package.json file might <ide> look like this: <ide> <ide> ```json <ide> If this was in a folder at `./some-library`, then <ide> <ide> This is the extent of Node.js's awareness of package.json files. <ide> <del>If the file specified by the `"main"` entry of `package.json` is missing and <add>If the file specified by the `'main'` entry of `package.json` is missing and <ide> can not be resolved, Node.js will report the entire module as missing with the <ide> default error: <ide> <ide> Error: Cannot find module 'some-library' <ide> <ide> If there is no package.json file present in the directory, then Node.js <ide> will attempt to load an `index.js` or `index.node` file out of that <del>directory. For example, if there was no package.json file in the above <add>directory. For example, if there was no package.json file in the above <ide> example, then `require('./some-library')` would attempt to load: <ide> <ide> * `./some-library/index.js` <ide> varying paths before the current [module resolution][] algorithm was frozen. <ide> `NODE_PATH` is still supported, but is less necessary now that the Node.js <ide> ecosystem has settled on a convention for locating dependent modules. <ide> Sometimes deployments that rely on `NODE_PATH` show surprising behavior <del>when people are unaware that `NODE_PATH` must be set. Sometimes a <add>when people are unaware that `NODE_PATH` must be set. Sometimes a <ide> module's dependencies change, causing a different version (or even a <ide> different module) to be loaded as the `NODE_PATH` is searched. <ide> <ide> Process files with the extension `.sjs` as `.js`: <ide> require.extensions['.sjs'] = require.extensions['.js']; <ide> ``` <ide> <del>**Deprecated** In the past, this list has been used to load <add>**Deprecated** In the past, this list has been used to load <ide> non-JavaScript modules into Node.js by compiling them on-demand. <ide> However, in practice, there are much better ways to do this, such as <ide> loading modules via some other Node.js program, or compiling them to <ide> JavaScript ahead of time. <ide> <ide> Since the module system is locked, this feature will probably never go <del>away. However, it may have subtle bugs and complexities that are best <add>away. However, it may have subtle bugs and complexities that are best <ide> left untouched. <ide> <ide> Note that the number of file system operations that the module system <ide> added: v0.1.16 <ide> * {Object} <ide> <ide> In each module, the `module` free variable is a reference to the object <del>representing the current module. For convenience, `module.exports` is <add>representing the current module. For convenience, `module.exports` is <ide> also accessible via the `exports` module-global. `module` is not actually <ide> a global but rather local to each module. <ide> <ide> a.on('ready', () => { <ide> <ide> <ide> Note that assignment to `module.exports` must be done immediately. It cannot be <del>done in any callbacks. This does not work: <add>done in any callbacks. This does not work: <ide> <ide> x.js: <ide> <ide> added: v0.1.16 <ide> <ide> * {string} <ide> <del>The identifier for the module. Typically this is the fully resolved <add>The identifier for the module. Typically this is the fully resolved <ide> filename. <ide> <ide> ### module.loaded <ide> added: v0.3.7 <ide> * {Object} <ide> <ide> Provides general utility methods when interacting with instances of <del>`Module` -- the `module` variable often seen in file modules. Accessed <add>`Module` — the `module` variable often seen in file modules. Accessed <ide> via `require('module')`. <ide> <ide> ### module.builtinModules <ide><path>doc/api/n-api.md <ide> compiled for one version to run on later versions of Node.js without <ide> recompilation. <ide> <ide> Addons are built/packaged with the same approach/tools <del>outlined in the section titled [C++ Addons](addons.html). <add>outlined in the section titled [C++ Addons](addons.html). <ide> The only difference is the set of APIs that are used by the native code. <ide> Instead of using the V8 or [Native Abstractions for Node.js][] APIs, <ide> the functions available in the N-API are used. <ide> where the native code can catch the exception, take the appropriate action, <ide> and then continue. This is only recommended in specific cases <ide> where it is known that the exception can be safely handled. In these <ide> cases [`napi_get_and_clear_last_exception`][] can be used to get and <del>clear the exception. On success, result will contain the handle to <add>clear the exception. On success, result will contain the handle to <ide> the last JavaScript Object thrown. If it is determined, after <ide> retrieving the exception, the exception cannot be handled after all <ide> it can be re-thrown it with [`napi_throw`][] where error is the <ide> JavaScript Error object to be thrown. <ide> <ide> The following utility functions are also available in case native code <ide> needs to throw an exception or determine if a `napi_value` is an instance <del>of a JavaScript `Error` object: [`napi_throw_error`][], <add>of a JavaScript `Error` object: [`napi_throw_error`][], <ide> [`napi_throw_type_error`][], [`napi_throw_range_error`][] and <ide> [`napi_is_error`][]. <ide> <ide> where result is the napi_value that refers to the newly created <ide> JavaScript Error object. <ide> <ide> The Node.js project is adding error codes to all of the errors <del>generated internally. The goal is for applications to use these <add>generated internally. The goal is for applications to use these <ide> error codes for all error checking. The associated error messages <ide> will remain, but will only be meant to be used for logging and <ide> display with the expectation that the message can change without <ide> SemVer applying. In order to support this model with N-API, both <ide> in internal functionality and for module specific functionality <ide> (as its good practice), the `throw_` and `create_` functions <ide> take an optional code parameter which is the string for the code <del>to be added to the error object. If the optional parameter is NULL <add>to be added to the error object. If the optional parameter is NULL <ide> then no code will be associated with the error. If a code is provided, <ide> the name associated with the error is also updated to be: <ide> <ide> originalName [code] <ide> ``` <ide> <ide> where originalName is the original name associated with the error <del>and code is the code that was provided. For example if the code <add>and code is the code that was provided. For example if the code <ide> is 'ERR_ERROR_1' and a TypeError is being created the name will be: <ide> <ide> ```text <ide> They can be one or more of the following bitflags: <ide> - `napi_default` - Used to indicate that no explicit attributes are set on the <ide> given property. By default, a property is read only, not enumerable and not <ide> configurable. <del>- `napi_writable` - Used to indicate that a given property is writable. <add>- `napi_writable` - Used to indicate that a given property is writable. <ide> - `napi_enumerable` - Used to indicate that a given property is enumerable. <ide> - `napi_configurable` - Used to indicate that a given property is configurable, <ide> as defined in [Section 6.1.7.1][] of the [ECMAScript Language Specification][]. <ide> typedef struct { <ide> encoded as UTF8. One of `utf8name` or `name` must be provided for the <ide> property. <ide> - `name`: Optional napi_value that points to a JavaScript string or symbol <del>to be used as the key for the property. One of `utf8name` or `name` must <add>to be used as the key for the property. One of `utf8name` or `name` must <ide> be provided for the property. <ide> - `value`: The value that's retrieved by a get access of the property if the <ide> property is a data property. If this is passed in, set `getter`, `setter`, <ide> napi_value Init(napi_env env, napi_value exports) { <ide> napi_status status; <ide> <ide> napi_value fn; <del> status = napi_create_function(env, NULL, 0, SayHello, NULL, &fn); <add> status = napi_create_function(env, NULL, 0, SayHello, NULL, &fn); <ide> if (status != napi_ok) return NULL; <ide> <ide> status = napi_set_named_property(env, exports, "sayHello", fn); <ide> napi_status napi_queue_async_work(napi_env env, <ide> napi_async_work work); <ide> ``` <ide> <del>[`napi_cancel_async_work`][] can be used if the work needs <add>[`napi_cancel_async_work`][] can be used if the work needs <ide> to be cancelled before the work has started execution. <ide> <ide> After calling [`napi_cancel_async_work`][], the `complete` callback <ide> napi_status napi_cancel_async_work(napi_env env, <ide> Returns `napi_ok` if the API succeeded. <ide> <ide> This API cancels queued work if it has not yet <del>been started. If it has already started executing, it cannot be <add>been started. If it has already started executing, it cannot be <ide> cancelled and `napi_generic_failure` will be returned. If successful, <ide> the `complete` callback will be invoked with a status value of <ide> `napi_cancelled`. The work should not be deleted before the `complete` <ide> from [`napi_async_init`][]. <ide> <ide> There are cases (for example resolving promises) where it is <ide> necessary to have the equivalent of the scope associated with a callback <del>in place when making certain N-API calls. If there is no other script on <add>in place when making certain N-API calls. If there is no other script on <ide> the stack the [`napi_open_callback_scope`][] and <ide> [`napi_close_callback_scope`][] functions can be used to open/close <ide> the required scope. <ide> napi_status napi_get_version(napi_env env, <ide> Returns `napi_ok` if the API succeeded. <ide> <ide> This API returns the highest N-API version supported by the <del>Node.js runtime. N-API is planned to be additive such that <add>Node.js runtime. N-API is planned to be additive such that <ide> newer releases of Node.js may support additional API functions. <ide> In order to allow an addon to use a newer function when running with <ide> versions of Node.js that support it, while providing <ide><path>doc/api/net.md <ide> Possible signatures: <ide> * [`server.listen([port][, host][, backlog][, callback])`][`server.listen(port, host)`] <ide> for TCP servers <ide> <del>This function is asynchronous. When the server starts listening, the <del>[`'listening'`][] event will be emitted. The last parameter `callback` <add>This function is asynchronous. When the server starts listening, the <add>[`'listening'`][] event will be emitted. The last parameter `callback` <ide> will be added as a listener for the [`'listening'`][] event. <ide> <ide> All `listen()` methods can take a `backlog` parameter to specify the maximum <ide> added: v0.1.90 <ide> <ide> * {Buffer} <ide> <del>Emitted when data is received. The argument `data` will be a `Buffer` or <del>`String`. Encoding of data is set by [`socket.setEncoding()`][]. <add>Emitted when data is received. The argument `data` will be a `Buffer` or <add>`String`. Encoding of data is set by [`socket.setEncoding()`][]. <ide> <ide> Note that the **data will be lost** if there is no listener when a `Socket` <ide> emits a `'data'` event. <ide> added: v0.1.90 <ide> <ide> * {Error} <ide> <del>Emitted when an error occurs. The `'close'` event will be called directly <add>Emitted when an error occurs. The `'close'` event will be called directly <ide> following this event. <ide> <ide> ### Event: 'lookup' <ide> changes: <ide> Emitted after resolving the hostname but before connecting. <ide> Not applicable to UNIX sockets. <ide> <del>* `err` {Error|null} The error object. See [`dns.lookup()`][]. <add>* `err` {Error|null} The error object. See [`dns.lookup()`][]. <ide> * `address` {string} The IP address. <del>* `family` {string|null} The address type. See [`dns.lookup()`][]. <add>* `family` {string|null} The address type. See [`dns.lookup()`][]. <ide> * `host` {string} The hostname. <ide> <ide> ### Event: 'timeout' <ide> added: v0.1.90 <ide> --> <ide> <ide> Sends data on the socket. The second parameter specifies the encoding in the <del>case of a string--it defaults to UTF8 encoding. <add>case of a string — it defaults to UTF8 encoding. <ide> <ide> Returns `true` if the entire data was flushed successfully to the kernel <ide> buffer. Returns `false` if all or part of the data was queued in user memory. <ide><path>doc/api/os.md <ide> The `os.loadavg()` method returns an array containing the 1, 5, and 15 minute <ide> load averages. <ide> <ide> The load average is a measure of system activity, calculated by the operating <del>system and expressed as a fractional number. As a rule of thumb, the load <add>system and expressed as a fractional number. As a rule of thumb, the load <ide> average should ideally be less than the number of logical CPUs in the system. <ide> <ide> The load average is a UNIX-specific concept with no real equivalent on <ide> added: v6.0.0 <ide> * Returns: {Object} <ide> <ide> The `os.userInfo()` method returns information about the currently effective <del>user -- on POSIX platforms, this is typically a subset of the password file. The <add>user — on POSIX platforms, this is typically a subset of the password file. The <ide> returned object includes the `username`, `uid`, `gid`, `shell`, and `homedir`. <ide> On Windows, the `uid` and `gid` fields are `-1`, and `shell` is `null`. <ide> <ide><path>doc/api/path.md <ide> changes: <ide> <ide> The `path.extname()` method returns the extension of the `path`, from the last <ide> occurrence of the `.` (period) character to end of string in the last portion of <del>the `path`. If there is no `.` in the last portion of the `path`, or if the <add>the `path`. If there is no `.` in the last portion of the `path`, or if the <ide> first character of the basename of `path` (see `path.basename()`) is `.`, then <ide> an empty string is returned. <ide> <ide> path.parse('/home/user/dir/file.txt'); <ide> │ root │ │ name │ ext │ <ide> " / home/user/dir / file .txt " <ide> └──────┴──────────────┴──────┴─────┘ <del>(all spaces in the "" line should be ignored -- they are purely for formatting) <add>(all spaces in the "" line should be ignored — they are purely for formatting) <ide> ``` <ide> <ide> On Windows: <ide> path.parse('C:\\path\\dir\\file.txt'); <ide> │ root │ │ name │ ext │ <ide> " C:\ path\dir \ file .txt " <ide> └──────┴──────────────┴──────┴─────┘ <del>(all spaces in the "" line should be ignored -- they are purely for formatting) <add>(all spaces in the "" line should be ignored — they are purely for formatting) <ide> ``` <ide> <ide> A [`TypeError`][] is thrown if `path` is not a string. <ide><path>doc/api/process.md <ide> process will exit with a non-zero exit code and the stack trace will be printed. <ide> This is to avoid infinite recursion. <ide> <ide> Attempting to resume normally after an uncaught exception can be similar to <del>pulling out of the power cord when upgrading a computer -- nine out of ten <add>pulling out of the power cord when upgrading a computer — nine out of ten <ide> times nothing happens - but the 10th time, the system becomes corrupted. <ide> <ide> The correct use of `'uncaughtException'` is to perform synchronous cleanup <ide> The name of each event will be the uppercase common name for the signal (e.g. <ide> process.stdin.resume(); <ide> <ide> process.on('SIGINT', () => { <del> console.log('Received SIGINT. Press Control-D to exit.'); <add> console.log('Received SIGINT. Press Control-D to exit.'); <ide> }); <ide> <ide> // Using a single function to handle multiple signals <ide> added: v0.1.27 <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 <ide> 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>`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> Windows platforms will throw an error if the `pid` is used to kill a process <ide> group. <ide> <ide> Even though the name of this function is `process.kill()`, it is really just a <del>signal sender, like the `kill` system call. The signal sent may do something <add>signal sender, like the `kill` system call. The signal sent may do something <ide> other than kill the target process. <ide> <ide> ```js <ide> Once the current turn of the event loop turn runs to completion, all callbacks <ide> currently in the next tick queue will be called. <ide> <ide> This is *not* a simple alias to [`setTimeout(fn, 0)`][]. It is much more <del>efficient. It runs before any additional I/O events (including <add>efficient. It runs before any additional I/O events (including <ide> timers) fire in subsequent ticks of the event loop. <ide> <ide> ```js <ide> thing.getReadyForStuff(); <ide> ``` <ide> <ide> It is very important for APIs to be either 100% synchronous or 100% <del>asynchronous. Consider this example: <add>asynchronous. Consider this example: <ide> <ide> ```js <ide> // WARNING! DO NOT USE! BAD UNSAFE HAZARD! <ide> function definitelyAsync(arg, cb) { <ide> ``` <ide> <ide> The next tick queue is completely drained on each pass of the event loop <del>**before** additional I/O is processed. As a result, recursively setting <add>**before** additional I/O is processed. As a result, recursively setting <ide> nextTick callbacks will block any I/O from happening, just like a <ide> `while(true);` loop. <ide> <ide> tarball. <ide> builds of Node.js and will be missing on all other platforms._ <ide> * `lts` {string} a string label identifying the [LTS][] label for this release. <ide> This property only exists for LTS releases and is `undefined` for all other <del> release types, including _Current_ releases. Currently the valid values are: <add> release types, including _Current_ releases. Currently the valid values are: <ide> - `'Argon'` for the 4.x LTS line beginning with 4.2.0. <ide> - `'Boron'` for the 6.x LTS line beginning with 6.9.0. <ide> - `'Carbon'` for the 8.x LTS line beginning with 8.9.1. <ide> added: v2.0.0 <ide> <ide> The `process.seteuid()` method sets the effective user identity of the process. <ide> (See seteuid(2).) The `id` can be passed as either a numeric ID or a username <del>string. If a username is specified, the method blocks while resolving the <add>string. If a username is specified, the method blocks while resolving the <ide> associated numeric ID. <ide> <ide> ```js <ide> added: v0.1.31 <ide> * `id` {string|number} The group name or ID <ide> <ide> The `process.setgid()` method sets the group identity of the process. (See <del>setgid(2).) The `id` can be passed as either a numeric ID or a group name <add>setgid(2).) The `id` can be passed as either a numeric ID or a group name <ide> string. If a group name is specified, this method blocks while resolving the <ide> associated numeric ID. <ide> <ide> added: v0.1.28 <ide> --> <ide> <ide> The `process.setuid(id)` method sets the user identity of the process. (See <del>setuid(2).) The `id` can be passed as either a numeric ID or a username string. <add>setuid(2).) The `id` can be passed as either a numeric ID or a username string. <ide> If a username is specified, the method blocks while resolving the associated <ide> numeric ID. <ide> <ide> When a new value is assigned, different platforms will impose different maximum <ide> length restrictions on the title. Usually such restrictions are quite limited. <ide> For instance, on Linux and macOS, `process.title` is limited to the size of the <ide> binary name plus the length of the command line arguments because setting the <del>`process.title` overwrites the `argv` memory of the process. Node.js v0.8 <add>`process.title` overwrites the `argv` memory of the process. Node.js v0.8 <ide> allowed for longer process title strings by also overwriting the `environ` <ide> memory but that was potentially insecure and confusing in some (rather obscure) <ide> cases. <ide> Will generate an object similar to: <ide> ## Exit Codes <ide> <ide> Node.js will normally exit with a `0` status code when no more async <del>operations are pending. The following status codes are used in other <add>operations are pending. The following status codes are used in other <ide> cases: <ide> <ide> * `1` **Uncaught Fatal Exception** - There was an uncaught exception, <ide> and it was not handled by a domain or an [`'uncaughtException'`][] event <ide> handler. <ide> * `2` - Unused (reserved by Bash for builtin misuse) <ide> * `3` **Internal JavaScript Parse Error** - The JavaScript source code <del> internal in Node.js's bootstrapping process caused a parse error. This <add> internal in Node.js's bootstrapping process caused a parse error. This <ide> is extremely rare, and generally can only happen during development <ide> of Node.js itself. <ide> * `4` **Internal JavaScript Evaluation Failure** - The JavaScript <ide> source code internal in Node.js's bootstrapping process failed to <del> return a function value when evaluated. This is extremely rare, and <add> return a function value when evaluated. This is extremely rare, and <ide> generally can only happen during development of Node.js itself. <ide> * `5` **Fatal Error** - There was a fatal unrecoverable error in V8. <ide> Typically a message will be printed to stderr with the prefix `FATAL <ide> cases: <ide> function was somehow set to a non-function, and could not be called. <ide> * `7` **Internal Exception Handler Run-Time Failure** - There was an <ide> uncaught exception, and the internal fatal exception handler <del> function itself threw an error while attempting to handle it. This <add> function itself threw an error while attempting to handle it. This <ide> can happen, for example, if a [`'uncaughtException'`][] or <ide> `domain.on('error')` handler throws an error. <del>* `8` - Unused. In previous versions of Node.js, exit code 8 sometimes <add>* `8` - Unused. In previous versions of Node.js, exit code 8 sometimes <ide> indicated an uncaught exception. <ide> * `9` - **Invalid Argument** - Either an unknown option was specified, <ide> or an option requiring a value was provided without a value. <ide> * `10` **Internal JavaScript Run-Time Failure** - The JavaScript <ide> source code internal in Node.js's bootstrapping process threw an error <del> when the bootstrapping function was called. This is extremely rare, <add> when the bootstrapping function was called. This is extremely rare, <ide> and generally can only happen during development of Node.js itself. <ide> * `12` **Invalid Debug Argument** - The `--inspect` and/or `--inspect-brk` <ide> options were set, but the port number chosen was invalid or unavailable. <ide> * `>128` **Signal Exits** - If Node.js receives a fatal signal such as <ide> `SIGKILL` or `SIGHUP`, then its exit code will be `128` plus the <del> value of the signal code. This is a standard POSIX practice, since <add> value of the signal code. This is a standard POSIX practice, since <ide> exit codes are defined to be 7-bit integers, and signal exits set <ide> the high-order bit, and then contain the value of the signal code. <ide> For example, signal `SIGABRT` has value `6`, so the expected exit <ide><path>doc/api/readline.md <ide> added: v0.1.98 <ide> * `shift` {boolean} `true` to indicate the `<Shift>` key. <ide> * `name` {string} The name of the a key. <ide> <del>The `rl.write()` method will write either `data` or a key sequence identified <add>The `rl.write()` method will write either `data` or a key sequence identified <ide> by `key` to the `output`. The `key` argument is supported only if `output` is <ide> a [TTY][] text terminal. <ide> <ide><path>doc/api/repl.md <ide> changes: <ide> stream upon instantiation. <ide> * `eval` {Function} The function to be used when evaluating each given line <ide> of input. **Default:** an async wrapper for the JavaScript `eval()` <del> function. An `eval` function can error with `repl.Recoverable` to indicate <add> function. An `eval` function can error with `repl.Recoverable` to indicate <ide> the input was incomplete and prompt for additional lines. <ide> * `useColors` {boolean} If `true`, specifies that the default `writer` <ide> function should include ANSI color styling to REPL output. If a custom <ide> environment variables: <ide> <ide> - `NODE_REPL_HISTORY` - When a valid path is given, persistent REPL history <ide> will be saved to the specified file rather than `.node_repl_history` in the <del> user's home directory. Setting this value to `""` will disable persistent <add> user's home directory. Setting this value to `''` will disable persistent <ide> REPL history. Whitespace will be trimmed from the value. <ide> - `NODE_REPL_HISTORY_SIZE` - Controls how many lines of history will be <ide> persisted if history is available. Must be a positive number. <ide> environment variables: <ide> By default, the Node.js REPL will persist history between `node` REPL sessions <ide> by saving inputs to a `.node_repl_history` file located in the user's home <ide> directory. This can be disabled by setting the environment variable <del>`NODE_REPL_HISTORY=""`. <add>`NODE_REPL_HISTORY=''`. <ide> <ide> ### Using the Node.js REPL with advanced line-editors <ide> <ide><path>doc/api/stream.md <ide> It is recommended that errors occurring during the processing of the <ide> the callback and passing the error as the first argument. This will cause an <ide> `'error'` event to be emitted by the Writable. Throwing an Error from within <ide> `writable._write()` can result in unexpected and inconsistent behavior depending <del>on how the stream is being used. Using the callback ensures consistent and <add>on how the stream is being used. Using the callback ensures consistent and <ide> predictable handling of errors. <ide> <ide> If a Readable stream pipes into a Writable stream when Writable emits an <ide> changes: <ide> read queue. For streams not operating in object mode, `chunk` must be a <ide> string, `Buffer` or `Uint8Array`. For object mode streams, `chunk` may be <ide> any JavaScript value. <del>* `encoding` {string} Encoding of string chunks. Must be a valid <add>* `encoding` {string} Encoding of string chunks. Must be a valid <ide> Buffer encoding, such as `'utf8'` or `'ascii'` <ide> * Returns: {boolean} `true` if additional chunks of data may continued to be <ide> pushed; `false` otherwise. <ide> The `transform._transform()` method is prefixed with an underscore because it <ide> is internal to the class that defines it, and should never be called directly by <ide> user programs. <ide> <del>`transform._transform()` is never called in parallel; streams implement a <add>`transform._transform()` is never called in parallel; streams implement a <ide> queue mechanism, and to receive the next chunk, `callback` must be <ide> called, either synchronously or asynchronously. <ide> <ide><path>doc/api/tls.md <ide> added: v0.6.0 <ide> --> <ide> <ide> Returns the bound address, the address family name, and port of the <del>server as reported by the operating system. See [`net.Server.address()`][] for <add>server as reported by the operating system. See [`net.Server.address()`][] for <ide> more information. <ide> <ide> ### server.close([callback]) <ide> For example: <ide> raw: < RAW DER buffer >, <ide> pubkey: < RAW DER buffer >, <ide> valid_from: 'Nov 11 09:52:22 2009 GMT', <del> valid_to: 'Nov 6 09:52:22 2029 GMT', <add> valid_to: 'Nov 6 09:52:22 2029 GMT', <ide> fingerprint: '2A:7A:C2:DD:E5:F9:CC:53:72:35:99:7A:02:5A:71:38:52:EC:8A:DF', <ide> fingerprint256: '2A:7A:C2:DD:E5:F9:CC:53:72:35:99:7A:02:5A:71:38:52:EC:8A:DF:00:11:22:33:44:55:66:77:88:99:AA:BB', <ide> serialNumber: 'B9B0D332A1AA5635' } <ide> changes: <ide> rather than creating a new socket. Typically, this is an instance of <ide> [`net.Socket`][], but any `Duplex` stream is allowed. <ide> If this option is specified, `path`, `host` and `port` are ignored, <del> except for certificate validation. Usually, a socket is already connected <add> except for certificate validation. Usually, a socket is already connected <ide> when passed to `tls.connect()`, but it can be connected later. Note that <ide> connection/disconnection/destruction of `socket` is the user's <ide> responsibility, calling `tls.connect()` will not cause `net.connect()` to be <ide> changes: <ide> it is not. <ide> * `key` {string|string[]|Buffer|Buffer[]|Object[]} Optional private keys in <ide> PEM format. PEM allows the option of private keys being encrypted. Encrypted <del> keys will be decrypted with `options.passphrase`. Multiple keys using <add> keys will be decrypted with `options.passphrase`. Multiple keys using <ide> different algorithms can be provided either as an array of unencrypted key <ide> strings or buffers, or an array of objects in the form `{pem: <ide> <string|buffer>[, passphrase: <string>]}`. The object form can only occur in <ide> changes: <ide> consist of the PEM formatted certificate for a provided private `key`, <ide> followed by the PEM formatted intermediate certificates (if any), in order, <ide> and not including the root CA (the root CA must be pre-known to the peer, <del> see `ca`). When providing multiple cert chains, they do not have to be in <add> see `ca`). When providing multiple cert chains, they do not have to be in <ide> the same order as their private keys in `key`. If the intermediate <ide> certificates are not provided, the peer will not be able to validate the <ide> certificate, and the handshake will fail. <ide> changes: <ide> using this option. The value can be a string or Buffer, or an Array of <ide> strings and/or Buffers. Any string or Buffer can contain multiple PEM CAs <ide> concatenated together. The peer's certificate must be chainable to a CA <del> trusted by the server for the connection to be authenticated. When using <add> trusted by the server for the connection to be authenticated. When using <ide> certificates that are not chainable to a well-known CA, the certificate's CA <ide> must be explicitly specified as a trusted or the connection will fail to <ide> authenticate. <ide> changes: <ide> For self-signed certificates, the certificate is its own CA, and must be <ide> provided. <ide> * `ciphers` {string} Optional cipher suite specification, replacing the <del> default. For more information, see [modifying the default cipher suite][]. <add> default. For more information, see [modifying the default cipher suite][]. <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> changes: <ide> servers, the identity options (`pfx` or `key`/`cert`) are usually required. <ide> * `secureConnectionListener` {Function} <ide> <del>Creates a new [tls.Server][]. The `secureConnectionListener`, if provided, is <add>Creates a new [tls.Server][]. The `secureConnectionListener`, if provided, is <ide> automatically set as a listener for the [`'secureConnection'`][] event. <ide> <ide> The `ticketKeys` options is automatically shared between `cluster` module <ide><path>doc/api/url.md <ide> WHATWG URL's `origin` property includes `protocol` and `host`, but not <ide> ├─────────────┴─────────────────────┴─────────────────────┴──────────┴────────────────┴───────┤ <ide> │ href │ <ide> └─────────────────────────────────────────────────────────────────────────────────────────────┘ <del>(all spaces in the "" line should be ignored -- they are purely for formatting) <add>(all spaces in the "" line should be ignored — they are purely for formatting) <ide> ``` <ide> <ide> Parsing the URL string using the WHATWG API: <ide> Instantiate a new `URLSearchParams` object with an iterable map in a way that <ide> is similar to [`Map`][]'s constructor. `iterable` can be an Array or any <ide> iterable object. That means `iterable` can be another `URLSearchParams`, in <ide> which case the constructor will simply create a clone of the provided <del>`URLSearchParams`. Elements of `iterable` are key-value pairs, and can <add>`URLSearchParams`. Elements of `iterable` are key-value pairs, and can <ide> themselves be any iterable object. <ide> <ide> Duplicate keys are allowed. <ide><path>doc/api/util.md <ide> added: v0.11.3 <ide> <ide> The `util.debuglog()` method is used to create a function that conditionally <ide> writes debug messages to `stderr` based on the existence of the `NODE_DEBUG` <del>environment variable. If the `section` name appears within the value of that <add>environment variable. If the `section` name appears within the value of that <ide> environment variable, then the returned function operates similar to <del>[`console.error()`][]. If not, then the returned function is a no-op. <add>[`console.error()`][]. If not, then the returned function is a no-op. <ide> <ide> ```js <ide> const util = require('util'); <ide> it will output something like: <ide> FOO 3245: hello from foo [123] <ide> ``` <ide> <del>where `3245` is the process id. If it is not run with that <add>where `3245` is the process id. If it is not run with that <ide> environment variable set, then it will not print anything. <ide> <ide> The `section` supports wildcard also: <ide> corresponding argument. Supported placeholders are: <ide> * `%d` - Number (integer or floating point value). <ide> * `%i` - Integer. <ide> * `%f` - Floating point value. <del>* `%j` - JSON. Replaced with the string `'[Circular]'` if the argument <add>* `%j` - JSON. Replaced with the string `'[Circular]'` if the argument <ide> contains circular references. <ide> * `%o` - Object. A string representation of an object <ide> with generic JavaScript object formatting. <ide> that the two styles are [semantically incompatible][]. <ide> * `constructor` {Function} <ide> * `superConstructor` {Function} <ide> <del>Inherit the prototype methods from one [constructor][] into another. The <add>Inherit the prototype methods from one [constructor][] into another. The <ide> prototype of `constructor` will be set to a new object created from <ide> `superConstructor`. <ide> <ide><path>doc/api/v8.md <ide> after the VM has started may result in unpredictable behavior, including <ide> crashes and data loss; or it may simply do nothing. <ide> <ide> The V8 options available for a version of Node.js may be determined by running <del>`node --v8-options`. An unofficial, community-maintained list of options <add>`node --v8-options`. An unofficial, community-maintained list of options <ide> and their effects is available [here][]. <ide> <ide> Usage: <ide><path>doc/api/vm.md <ide> The URL of the current module, as set in the constructor. <ide> will be thrown. <ide> * `breakOnSigint` {boolean} If `true`, the execution will be terminated when <ide> `SIGINT` (Ctrl+C) is received. Existing handlers for the event that have <del> been attached via `process.on("SIGINT")` will be disabled during script <add> been attached via `process.on('SIGINT')` will be disabled during script <ide> execution, but will continue to work after that. If execution is <ide> interrupted, an [`Error`][] will be thrown. <ide> * Returns: {Promise} <ide> changes: <ide> will be thrown. <ide> * `breakOnSigint`: if `true`, the execution will be terminated when <ide> `SIGINT` (Ctrl+C) is received. Existing handlers for the <del> event that have been attached via `process.on("SIGINT")` will be disabled <add> event that have been attached via `process.on('SIGINT')` will be disabled <ide> during script execution, but will continue to work after that. <ide> If execution is terminated, an [`Error`][] will be thrown. <ide> <ide><path>doc/api/zlib.md <ide> The memory requirements for deflate are (in bytes): <ide> (1 << (windowBits + 2)) + (1 << (memLevel + 9)) <ide> ``` <ide> <del>That is: 128K for windowBits=15 + 128K for memLevel = 8 <add>That is: 128K for windowBits = 15 + 128K for memLevel = 8 <ide> (default values) plus a few kilobytes for small objects. <ide> <ide> For example, to reduce the default memory requirements from 256K to 128K, the <ide> const options = { windowBits: 14, memLevel: 7 }; <ide> This will, however, generally degrade compression. <ide> <ide> The memory requirements for inflate are (in bytes) `1 << windowBits`. <del>That is, 32K for windowBits=15 (default value) plus a few kilobytes <add>That is, 32K for windowBits = 15 (default value) plus a few kilobytes <ide> for small objects. <ide> <ide> This is in addition to a single internal output slab buffer of size <ide> `chunkSize`, which defaults to 16K. <ide> <ide> The speed of `zlib` compression is affected most dramatically by the <del>`level` setting. A higher level will result in better compression, but <del>will take longer to complete. A lower level will result in less <add>`level` setting. A higher level will result in better compression, but <add>will take longer to complete. A lower level will result in less <ide> compression, but will be much faster. <ide> <ide> In general, greater memory usage options will mean that Node.js has to make <ide> fewer calls to `zlib` because it will be able to process more data on <del>each `write` operation. So, this is another factor that affects the <add>each `write` operation. So, this is another factor that affects the <ide> speed, at the cost of memory usage. <ide> <ide> ## Flushing <ide> added: v0.5.8 <ide> <ide> All of the constants defined in `zlib.h` are also defined on <ide> `require('zlib').constants`. In the normal course of operations, it will not be <del>necessary to use these constants. They are documented so that their presence is <add>necessary to use these constants. They are documented so that their presence is <ide> not surprising. This section is taken almost directly from the <del>[zlib documentation][]. See <https://zlib.net/manual.html#Constants> for more <add>[zlib documentation][]. See <https://zlib.net/manual.html#Constants> for more <ide> details. <ide> <ide> Previously, the constants were available directly from `require('zlib')`, for <ide> changes: <ide> <ide> <!--type=misc--> <ide> <del>Each class takes an `options` object. All options are optional. <add>Each class takes an `options` object. All options are optional. <ide> <ide> Note that some options are only relevant when compressing, and are <ide> ignored by the decompression classes.
34
Ruby
Ruby
make one function
2d4c792b0b6e74c06b9bc58ec93dbce50e89b67e
<ide><path>Library/Homebrew/extend/os/mac/keg.rb <ide> def codesign_patched_binary(file) <ide> end <ide> <ide> def dsymutil <del> binary_executable_or_library_files.each { |file| dsymutil_binary(file) } <del> end <del> <del> def dsymutil_binary(file) <del> odebug "Extracting symbols #{file}" <add> binary_executable_or_library_files.each do |file| <add> odebug "Extracting symbols #{file}" <ide> <del> result = system_command("dsymutil", args: [file]) <del> return if result.success? <add> result = system_command("dsymutil", args: [file]) <add> next if result.success? <ide> <del> # If it fails again, error out <del> onoe <<~EOS <del> Failed to extract symbols from #{file}: <del> #{result.stderr} <del> EOS <add> # If it fails again, error out <add> onoe <<~EOS <add> Failed to extract symbols from #{file}: <add> #{result.stderr} <add> EOS <add> end <ide> end <ide> end
1
Python
Python
fix speed report in table
b693d2d22406390a1ae4e745d8beade1d6476dd4
<ide><path>spacy/language.py <ide> def evaluate( <ide> util.logger.debug(doc) <ide> eg.predicted = doc <ide> results = scorer.score(examples) <del> n_words = sum(len(eg.predicted) for eg in examples) <add> n_words = sum(len(doc) for doc in docs) <ide> results["speed"] = n_words / (end_time - start_time) <ide> return results <ide> <ide><path>spacy/training/loggers.py <ide> def log_step(info: Dict[str, Any]): <ide> keys=list(info["losses"].keys()), <ide> ) <ide> ) from None <del> <del> try: <del> scores = [ <del> "{0:.2f}".format(float(info["other_scores"].get(col, 0.0)) * 100) <del> for col in score_cols <del> ] <del> except KeyError as e: <del> raise KeyError( <del> Errors.E983.format( <del> dict="scores (other)", <del> key=str(e), <del> keys=list(info["other_scores"].keys()), <del> ) <del> ) from None <add> scores = [] <add> for col in score_cols: <add> score = float(info["other_scores"].get(col, 0.0))) <add> if col != "speed": <add> score *= 100 <add> scores.append("{0:.2f}".format(score) <ide> data = ( <ide> [info["epoch"], info["step"]] <ide> + losses
2
PHP
PHP
add a function to simulate the php basename()
fb8d26480b2206bfc2f6d8de40cbcf1638110c65
<ide><path>src/Filesystem/File.php <ide> public function __construct($path, $create = false, $mode = 0755) <ide> $splInfo = new SplFileInfo($path); <ide> $this->Folder = new Folder($splInfo->getPath(), $create, $mode); <ide> if (!is_dir($path)) { <del> $this->name = ltrim($splInfo->getFilename(), '/'); <add> $this->name = ltrim($splInfo->getFilename(), DS); <ide> } <ide> $this->pwd(); <ide> $create && !$this->exists() && $this->safe($path) && $this->create(); <ide> public function name() <ide> $this->info(); <ide> } <ide> if (isset($this->info['extension'])) { <del> return basename($this->name, '.' . $this->info['extension']); <add> return $this->_basename($this->name, '.' . $this->info['extension']); <ide> } <ide> if ($this->name) { <ide> return $this->name; <ide> public function name() <ide> return false; <ide> } <ide> <add> /** <add> * Returns the file basename. simulate the php basename(). <add> * <add> * @return string the file basename. <add> */ <add> protected function _basename($name, $ext=null) <add> { <add> $splInfo = new SplFileInfo($name); <add> $name = ltrim($splInfo->getFilename(), DS); <add> if($ext===null || rtrim($name,$ext)===''){ <add> return $name; <add> } <add> return rtrim($name,$ext); <add> } <add> <ide> /** <ide> * Makes file name safe for saving <ide> * <ide> public function safe($name = null, $ext = null) <ide> $ext = $this->ext(); <ide> } <ide> <del> return preg_replace("/(?:[^\w\.-]+)/", '_', basename($name, $ext)); <add> return preg_replace("/(?:[^\w\.-]+)/", '_', $this->_basename($name, $ext)); <ide> } <ide> <ide> /**
1
Javascript
Javascript
add documentation for v3.3.1
a1c2ef7bd014409cb1452f28b98a1c650b864349
<ide><path>docs/source/_static/js/custom.js <ide> const stableVersion = "v3.3.0" <ide> // Dictionary doc folder to label <ide> const versionMapping = { <ide> "master": "master", <del> "": "v3.3.0", <add> "": "v3.3.0/v3.3.1", <ide> "v3.2.0": "v3.2.0", <ide> "v3.1.0": "v3.1.0 (stable)", <ide> "v3.0.2": "v3.0.0/v3.0.1/v3.0.2",
1
PHP
PHP
allow bulk storing/updating of mime types. closes
49f8e73ab347079089191d2138a2970424961aa7
<ide><path>lib/Cake/Network/CakeResponse.php <ide> class CakeResponse { <ide> <ide> /** <ide> * Holds cookies to be sent to the client <del> * <add> * <ide> * @var array <ide> */ <ide> protected $_cookies = array(); <ide> public function send() { <ide> * Sets the cookies that have been added via static method CakeResponse::addCookie() <ide> * before any other output is sent to the client. <ide> * Will set the cookies in the order they have been set. <del> * <add> * <ide> * @return void <ide> */ <ide> protected function _setCookies() { <ide> public function httpCodes($code = null) { <ide> * Sets the response content type. It can be either a file extension <ide> * which will be mapped internally to a mime-type or a string representing a mime-type <ide> * if $contentType is null the current content type is returned <del> * if $contentType is an associative array, it will be stored as a content type definition <add> * if $contentType is an associative array, content type definitions will be stored/replaced <ide> * <ide> * ### Setting the content type <ide> * <ide> public function httpCodes($code = null) { <ide> * <ide> * e.g `type();` <ide> * <del> * ### Storing a content type definition <add> * ### Storing content type definitions <ide> * <del> * e.g `type(array('keynote' => 'application/keynote'));` <add> * e.g `type(array('keynote' => 'application/keynote', 'bat' => 'application/bat'));` <ide> * <ide> * ### Replacing a content type definition <ide> * <ide> public function type($contentType = null) { <ide> return $this->_contentType; <ide> } <ide> if (is_array($contentType)) { <del> $type = key($contentType); <del> $defitition = current($contentType); <del> $this->_mimeTypes[$type] = $defitition; <add> foreach ($contentType as $type => $definition) { <add> $this->_mimeTypes[$type] = $definition; <add> } <ide> return $this->_contentType; <ide> } <ide> if (isset($this->_mimeTypes[$contentType])) { <ide> public function maxAge($seconds = null) { <ide> <ide> /** <ide> * Sets the Cache-Control must-revalidate directive. <del> * must-revalidate indicates that the response should not be served <del> * stale by a cache under any cirumstance without first revalidating <add> * must-revalidate indicates that the response should not be served <add> * stale by a cache under any cirumstance without first revalidating <ide> * with the origin. <ide> * If called with no parameters, this function will return wheter must-revalidate is present. <ide> * <del> * @param int $seconds if null, the method will return the current <add> * @param int $seconds if null, the method will return the current <ide> * must-revalidate value <ide> * @return boolean <ide> */ <ide> public function modified($time = null) { <ide> } <ide> <ide> /** <del> * Sets the response as Not Modified by removing any body contents <del> * setting the status code to "304 Not Modified" and removing all <add> * Sets the response as Not Modified by removing any body contents <add> * setting the status code to "304 Not Modified" and removing all <ide> * conflicting headers <ide> * <ide> * @return void <ide> public function notModified() { <ide> <ide> /** <ide> * Sets the Vary header for the response, if an array is passed, <del> * values will be imploded into a comma separated string. If no <del> * parameters are passed, then an array with the current Vary header <add> * values will be imploded into a comma separated string. If no <add> * parameters are passed, then an array with the current Vary header <ide> * value is returned <ide> * <del> * @param string|array $cacheVariances a single Vary string or a array <add> * @param string|array $cacheVariances a single Vary string or a array <ide> * containig the list for variances. <ide> * @return array <ide> **/ <ide> public function vary($cacheVariances = null) { <ide> <ide> /** <ide> * Sets the response Etag, Etags are a strong indicative that a response <del> * can be cached by a HTTP client. A bad way of generaing Etags is <del> * creating a hash of the response output, instead generate a unique <del> * hash of the unique components that identifies a request, such as a <del> * modification time, a resource Id, and anything else you consider it <add> * can be cached by a HTTP client. A bad way of generaing Etags is <add> * creating a hash of the response output, instead generate a unique <add> * hash of the unique components that identifies a request, such as a <add> * modification time, a resource Id, and anything else you consider it <ide> * makes it unique. <ide> * <del> * Second parameter is used to instuct clients that the content has <del> * changed, but sematicallly, it can be used as the same thing. Think <del> * for instance of a page with a hit counter, two different page views <del> * are equivalent, but they differ by a few bytes. This leaves off to <add> * Second parameter is used to instuct clients that the content has <add> * changed, but sematicallly, it can be used as the same thing. Think <add> * for instance of a page with a hit counter, two different page views <add> * are equivalent, but they differ by a few bytes. This leaves off to <ide> * the Client the decision of using or not the cached page. <ide> * <ide> * If no parameters are passed, current Etag header is returned. <ide> * <ide> * @param string $hash the unique has that identifies this resposnse <del> * @param boolean $weak whether the response is semantically the same as <add> * @param boolean $weak whether the response is semantically the same as <ide> * other with th same hash or not <ide> * @return string <ide> **/ <ide> public function etag($tag = null, $weak = false) { <ide> * Returns a DateTime object initialized at the $time param and using UTC <ide> * as timezone <ide> * <del> * @param string|int|DateTime $time <add> * @param string|int|DateTime $time <ide> * @return DateTime <ide> */ <ide> protected function _getUTCDate($time = null) { <ide> public function length($bytes = null) { <ide> } <ide> <ide> /** <del> * Checks whether a response has not been modified according to the 'If-None-Match' <del> * (Etags) and 'If-Modified-Since' (last modification date) request <del> * headers headers. If the response is detected to be not modified, it <add> * Checks whether a response has not been modified according to the 'If-None-Match' <add> * (Etags) and 'If-Modified-Since' (last modification date) request <add> * headers headers. If the response is detected to be not modified, it <ide> * is marked as so accordingly so the client can be informed of that. <ide> * <del> * In order to mark a response as not modified, you need to set at least <del> * the Last-Modified response header or a response etag to be compared <add> * In order to mark a response as not modified, you need to set at least <add> * the Last-Modified response header or a response etag to be compared <ide> * with the request itself <ide> * <del> * @return boolean whether the response was marked as not modified or <add> * @return boolean whether the response was marked as not modified or <ide> * not <ide> **/ <ide> public function checkNotModified(CakeRequest $request) { <ide> public function __toString() { <ide> <ide> /** <ide> * Getter/Setter for cookie configs <del> * <add> * <ide> * This method acts as a setter/getter depending on the type of the argument. <ide> * If the method is called with no arguments, it returns all configurations. <del> * <add> * <ide> * If the method is called with a string as argument, it returns either the <ide> * given configuration if it is set, or null, if it's not set. <del> * <add> * <ide> * If the method is called with an array as argument, it will set the cookie <ide> * configuration to the cookie container. <del> * <add> * <ide> * @param $options Either null to get all cookies, string for a specific cookie <ide> * or array to set cookie. <del> * <add> * <ide> * ### Options (when setting a configuration) <ide> * - name: The Cookie name <ide> * - value: Value of the cookie <ide> public function __toString() { <ide> * - domain: Domain the cookie is for. <ide> * - secure: Is the cookie https? <ide> * - httpOnly: Is the cookie available in the client? <del> * <add> * <ide> * ## Examples <del> * <add> * <ide> * ### Getting all cookies <del> * <add> * <ide> * `$this->cookie()` <del> * <add> * <ide> * ### Getting a certain cookie configuration <del> * <add> * <ide> * `$this->cookie('MyCookie')` <del> * <add> * <ide> * ### Setting a cookie configuration <del> * <add> * <ide> * `$this->cookie((array) $options)` <del> * <add> * <ide> * @return mixed <ide> */ <ide> public function cookie($options = null) { <ide><path>lib/Cake/Test/Case/Network/CakeResponseTest.php <ide> public function testType() { <ide> $this->assertEquals('application/vnd.wap.xhtml+xml', $response->type('xhtml-mobile')); <ide> $this->assertEquals('text/csv', $response->type('csv')); <ide> <del> $response->type(array('keynote' => 'application/keynote')); <add> $response->type(array('keynote' => 'application/keynote', 'bat' => 'application/bat')); <ide> $this->assertEquals('application/keynote', $response->type('keynote')); <add> $this->assertEquals('application/bat', $response->type('bat')); <ide> <ide> $this->assertFalse($response->type('wackytype')); <ide> } <ide> public function testCheckNotModifiedNoHints() { <ide> <ide> /** <ide> * Test cookie setting <del> * <add> * <ide> * @return void <ide> */ <ide> public function testCookieSettings() {
2
PHP
PHP
add test for escaped environment variable string
b0d163f078145c6f1ae943bd487bb512b4e493b5
<ide><path>tests/Support/SupportHelpersTest.php <ide> public function testEnvNull() <ide> $this->assertNull(env('foo')); <ide> } <ide> <add> public function testEnvEscapedString() <add> { <add> $_SERVER['foo'] = '"null"'; <add> $this->assertSame('null', env('foo')); <add> } <add> <ide> public function testGetFromENVFirst() <ide> { <ide> $_ENV['foo'] = 'From $_ENV';
1
Python
Python
update example of histogram2d to doctest format
f62522c610f334f86b1be2a586211d0e4dcdd934
<ide><path>numpy/lib/twodim_base.py <ide> def histogram2d(x, y, bins=10, range=None, normed=False, weights=None): <ide> -------- <ide> 2D-histogram with variable bin width: <ide> <del> import matplotlib as ml <del> import matplotlib.pyplot as plt <del> import numpy as np <add> >>> import matplotlib as mpl <add> >>> import matplotlib.pyplot as plt <ide> <ide> # First we define the bin edges <del> xedges = [0, 1, 1.5, 3, 5] <del> yedges = [0, 2, 3, 4, 6] <add> >>> xedges = [0, 1, 1.5, 3, 5] <add> >>> yedges = [0, 2, 3, 4, 6] <ide> <ide> # Next we create a histogram H with random bin content <del> x = np.random.normal(3, 1, 100) <del> y = np.random.normal(1, 1, 100) <del> H, xedges, yedges = np.histogram2d(y, x, bins=(xedges, yedges)) <add> >>> x = np.random.normal(3, 1, 100) <add> >>> y = np.random.normal(1, 1, 100) <add> >>> H, xedges, yedges = np.histogram2d(y, x, bins=(xedges, yedges)) <ide> <ide> # Or we fill the histogram H with a determined bin content <del> H = np.ones((4, 4)).cumsum().reshape(4, 4) <del> print H[::-1] # This shows the bin content in the order as plotted <add> >>> H = np.ones((4, 4)).cumsum().reshape(4, 4) <add> >>> print H[::-1] # This shows the bin content in the order as plotted <ide> <del> fig = plt.figure(figsize=(7, 3)) <add> >>> fig = plt.figure(figsize=(7, 3)) <ide> # Imshow can only do an equidistant representation of bins <del> ax = fig.add_subplot(131) <del> ax.set_title('imshow:\nequidistant') <del> im = plt.imshow(H, interpolation='nearest', origin='low', <del> extent=[xedges[0], xedges[-1], yedges[0], yedges[-1]]) <add> >>> ax = fig.add_subplot(131) <add> >>> ax.set_title('imshow:\nequidistant') <add> >>> im = plt.imshow(H, interpolation='nearest', origin='low', <add> extent=[xedges[0], xedges[-1], yedges[0], yedges[-1]]) <ide> <ide> # pcolormesh can displaying exact bin edges <del> ax = fig.add_subplot(132) <del> ax.set_title('pcolormesh:\nexact bin edges') <del> X, Y = np.meshgrid(xedges, yedges) <del> ax.pcolormesh(X, Y, H) <del> ax.set_aspect('equal') <add> >>> ax = fig.add_subplot(132) <add> >>> ax.set_title('pcolormesh:\nexact bin edges') <add> >>> X, Y = np.meshgrid(xedges, yedges) <add> >>> ax.pcolormesh(X, Y, H) <add> >>> ax.set_aspect('equal') <ide> <ide> # NonUniformImage displays exact bin edges with interpolation <del> ax = fig.add_subplot(133) <del> ax.set_title('NonUniformImage:\ninterpolated') <del> im = ml.image.NonUniformImage(ax, interpolation='bilinear') <del> xcenters = xedges[:-1] + 0.5 * (xedges[1:] - xedges[:-1]) <del> ycenters = yedges[:-1] + 0.5 * (yedges[1:] - yedges[:-1]) <del> im.set_data(xcenters, ycenters, H) <del> ax.images.append(im) <del> ax.set_xlim(xedges[0], xedges[-1]) <del> ax.set_ylim(yedges[0], yedges[-1]) <del> ax.set_aspect('equal') <del> plt.show() <add> >>> ax = fig.add_subplot(133) <add> >>> ax.set_title('NonUniformImage:\ninterpolated') <add> >>> im = mpl.image.NonUniformImage(ax, interpolation='bilinear') <add> >>> xcenters = xedges[:-1] + 0.5 * (xedges[1:] - xedges[:-1]) <add> >>> ycenters = yedges[:-1] + 0.5 * (yedges[1:] - yedges[:-1]) <add> >>> im.set_data(xcenters, ycenters, H) <add> >>> ax.images.append(im) <add> >>> ax.set_xlim(xedges[0], xedges[-1]) <add> >>> ax.set_ylim(yedges[0], yedges[-1]) <add> >>> ax.set_aspect('equal') <add> >>> plt.show() <ide> """ <ide> from numpy import histogramdd <ide>
1
Python
Python
fix flaky test
74c51f213c7a187b76098331ca10fee10c9e5e59
<ide><path>keras/backend/tensorflow_backend.py <ide> def eval(x): <ide> def zeros(shape, dtype=_FLOATX, name=None): <ide> '''Instantiates an all-zeros tensor variable. <ide> ''' <add> shape = map(int, shape) <ide> tf_dtype = _convert_string_dtype(dtype) <ide> return variable(tf.constant_initializer(0., dtype=tf_dtype)(shape), dtype, name) <ide> <ide> <ide> def ones(shape, dtype=_FLOATX, name=None): <ide> '''Instantiates an all-ones tensor variable. <ide> ''' <add> shape = map(int, shape) <ide> tf_dtype = _convert_string_dtype(dtype) <ide> return variable(tf.constant_initializer(1., dtype=tf_dtype)(shape), dtype, name) <ide> <ide> def ones_like(x, name=None): <ide> <ide> <ide> def random_uniform_variable(shape, low, high, dtype=_FLOATX, name=None): <add> shape = map(int, shape) <ide> tf_dtype = _convert_string_dtype(dtype) <ide> value = tf.random_uniform_initializer(low, high, dtype=tf_dtype)(shape) <ide> return variable(value, dtype=dtype, name=name) <ide> <ide> <ide> def random_normal_variable(shape, mean, scale, dtype=_FLOATX, name=None): <add> shape = map(int, shape) <ide> tf_dtype = _convert_string_dtype(dtype) <ide> value = tf.random_normal_initializer(mean, scale, dtype=tf_dtype)(shape) <ide> return variable(value, dtype=dtype, name=name) <ide><path>tests/keras/layers/test_embeddings.py <ide> @keras_test <ide> def test_embedding(): <ide> layer_test(Embedding, <del> kwargs={'output_dim': 4., 'input_dim': 10, 'input_length': 2}, <add> kwargs={'output_dim': 4, 'input_dim': 10, 'input_length': 2}, <ide> input_shape=(3, 2), <ide> input_dtype='int32', <ide> expected_output_dtype=K.floatx())
2
Python
Python
fix reproducible tests in trainer
2bf70e215032ed80fcb27891fa4062b123c13522
<ide><path>tests/test_trainer.py <ide> import numpy as np <ide> <ide> from transformers import AutoTokenizer, TrainingArguments, is_torch_available <del>from transformers.testing_utils import get_tests_dir, require_non_multigpu, require_torch <add>from transformers.testing_utils import get_tests_dir, require_torch <ide> <ide> <ide> if is_torch_available(): <ide> def get_regression_trainer(a=0, b=0, train_len=64, eval_len=64, **kwargs): <ide> <ide> @require_torch <ide> class TrainerIntegrationTest(unittest.TestCase): <del> def check_trained_model(self, model, alternate_seed=False): <del> # Checks a training seeded with learning_rate = 0.1 <del> if alternate_seed: <del> # With args.seed = 314 <del> self.assertTrue(torch.abs(model.a - 1.0171) < 1e-4) <del> self.assertTrue(torch.abs(model.b - 1.2494) < 1e-4) <del> else: <del> # With default args.seed <del> self.assertTrue(torch.abs(model.a - 0.6975) < 1e-4) <del> self.assertTrue(torch.abs(model.b - 1.2415) < 1e-4) <del> <ide> def setUp(self): <del> # Get the default values (in case they change): <ide> args = TrainingArguments(".") <ide> self.n_epochs = args.num_train_epochs <del> self.batch_size = args.per_device_train_batch_size <add> self.batch_size = args.train_batch_size <add> trainer = get_regression_trainer(learning_rate=0.1) <add> trainer.train() <add> self.default_trained_model = (trainer.model.a, trainer.model.b) <add> <add> trainer = get_regression_trainer(learning_rate=0.1, seed=314) <add> trainer.train() <add> self.alternate_trained_model = (trainer.model.a, trainer.model.b) <add> <add> def check_trained_model(self, model, alternate_seed=False): <add> # Checks a training seeded with learning_rate = 0.1 <add> (a, b) = self.alternate_trained_model if alternate_seed else self.default_trained_model <add> self.assertTrue(torch.allclose(model.a, a)) <add> self.assertTrue(torch.allclose(model.b, b)) <ide> <del> @require_non_multigpu <del> @unittest.skip("Change in seed by external dependency causing this test to fail.") <ide> def test_reproducible_training(self): <ide> # Checks that training worked, model trained and seed made a reproducible training. <ide> trainer = get_regression_trainer(learning_rate=0.1) <ide> def test_reproducible_training(self): <ide> trainer.train() <ide> self.check_trained_model(trainer.model, alternate_seed=True) <ide> <del> @require_non_multigpu <ide> def test_number_of_steps_in_training(self): <ide> # Regular training has n_epochs * len(train_dl) steps <ide> trainer = get_regression_trainer(learning_rate=0.1) <ide> def test_number_of_steps_in_training(self): <ide> train_output = trainer.train() <ide> self.assertEqual(train_output.global_step, 10) <ide> <del> @require_non_multigpu <ide> def test_train_and_eval_dataloaders(self): <add> n_gpu = max(1, torch.cuda.device_count()) <ide> trainer = get_regression_trainer(learning_rate=0.1, per_device_train_batch_size=16) <del> self.assertEqual(trainer.get_train_dataloader().batch_size, 16) <add> self.assertEqual(trainer.get_train_dataloader().batch_size, 16 * n_gpu) <ide> trainer = get_regression_trainer(learning_rate=0.1, per_device_eval_batch_size=16) <del> self.assertEqual(trainer.get_eval_dataloader().batch_size, 16) <add> self.assertEqual(trainer.get_eval_dataloader().batch_size, 16 * n_gpu) <ide> <ide> # Check drop_last works <ide> trainer = get_regression_trainer( <ide> train_len=66, eval_len=74, learning_rate=0.1, per_device_train_batch_size=16, per_device_eval_batch_size=32 <ide> ) <del> self.assertEqual(len(trainer.get_train_dataloader()), 66 // 16 + 1) <del> self.assertEqual(len(trainer.get_eval_dataloader()), 74 // 32 + 1) <add> self.assertEqual(len(trainer.get_train_dataloader()), 66 // (16 * n_gpu) + 1) <add> self.assertEqual(len(trainer.get_eval_dataloader()), 74 // (32 * n_gpu) + 1) <ide> <ide> trainer = get_regression_trainer( <ide> train_len=66, <ide> def test_train_and_eval_dataloaders(self): <ide> per_device_eval_batch_size=32, <ide> dataloader_drop_last=True, <ide> ) <del> self.assertEqual(len(trainer.get_train_dataloader()), 66 // 16) <del> self.assertEqual(len(trainer.get_eval_dataloader()), 74 // 32) <add> self.assertEqual(len(trainer.get_train_dataloader()), 66 // (16 * n_gpu)) <add> self.assertEqual(len(trainer.get_eval_dataloader()), 74 // (32 * n_gpu)) <ide> <del> # Check passing a new dataset fpr evaluation wors <add> # Check passing a new dataset for evaluation wors <ide> new_eval_dataset = RegressionDataset(length=128) <del> self.assertEqual(len(trainer.get_eval_dataloader(new_eval_dataset)), 128 // 32) <add> self.assertEqual(len(trainer.get_eval_dataloader(new_eval_dataset)), 128 // (32 * n_gpu)) <ide> <ide> def test_evaluate(self): <ide> trainer = get_regression_trainer(a=1.5, b=2.5, compute_metrics=AlmostAccuracy()) <ide> def test_predict(self): <ide> x = trainer.eval_dataset.x <ide> self.assertTrue(np.allclose(preds, 1.5 * x + 2.5)) <ide> <del> @require_non_multigpu <del> @unittest.skip("Change in seed by external dependency causing this test to fail.") <ide> def test_trainer_with_datasets(self): <ide> np.random.seed(42) <ide> x = np.random.normal(size=(64,)).astype(np.float32) <ide> def test_trainer_with_datasets(self): <ide> trainer.train() <ide> self.check_trained_model(trainer.model) <ide> <del> @require_non_multigpu <del> @unittest.skip("Change in seed by external dependency causing this test to fail.") <ide> def test_custom_optimizer(self): <ide> train_dataset = RegressionDataset() <ide> args = TrainingArguments("./regression") <ide> def test_custom_optimizer(self): <ide> trainer = Trainer(model, args, train_dataset=train_dataset, optimizers=(optimizer, lr_scheduler)) <ide> trainer.train() <ide> <del> self.assertTrue(torch.abs(trainer.model.a - 1.8950) < 1e-4) <del> self.assertTrue(torch.abs(trainer.model.b - 2.5656) < 1e-4) <add> (a, b) = self.default_trained_model <add> self.assertFalse(torch.allclose(trainer.model.a, a)) <add> self.assertFalse(torch.allclose(trainer.model.b, b)) <ide> self.assertEqual(trainer.optimizer.state_dict()["param_groups"][0]["lr"], 1.0) <ide> <del> @require_non_multigpu <del> @unittest.skip("Change in seed by external dependency causing this test to fail.") <ide> def test_model_init(self): <ide> train_dataset = RegressionDataset() <ide> args = TrainingArguments("./regression", learning_rate=0.1)
1
Javascript
Javascript
improve info about tracking
507185979f76a8075312b2ab3470bc199b3c3d35
<ide><path>src/ng/directive/ngRepeat.js <ide> * For example, if an item is added to the collection, `ngRepeat` will know that all other items <ide> * already have DOM elements, and will not re-render them. <ide> * <del> * The default tracking function (which tracks items by their identity) does not allow <del> * duplicate items in arrays. This is because when there are duplicates, it is not possible <del> * to maintain a one-to-one mapping between collection items and DOM elements. <del> * <del> * If you do need to repeat duplicate items, you can substitute the default tracking behavior <del> * with your own using the `track by` expression. <del> * <del> * For example, you may track items by the index of each item in the collection, using the <del> * special scope property `$index`: <del> * ```html <del> * <div ng-repeat="n in [42, 42, 43, 43] track by $index"> <del> * {{n}} <del> * </div> <del> * ``` <del> * <del> * You may also use arbitrary expressions in `track by`, including references to custom functions <del> * on the scope: <del> * ```html <del> * <div ng-repeat="n in [42, 42, 43, 43] track by myTrackingFunction(n)"> <del> * {{n}} <del> * </div> <del> * ``` <add> * All different types of tracking functions, their syntax, and and their support for duplicate <add> * items in collections can be found in the <add> * {@link ngRepeat#ngRepeat-arguments ngRepeat expression description}. <ide> * <ide> * <div class="alert alert-success"> <del> * If you are working with objects that have a unique identifier property, you should track <del> * by this identifier instead of the object instance. Should you reload your data later, `ngRepeat` <del> * will not have to rebuild the DOM elements for items it has already rendered, even if the <del> * JavaScript objects in the collection have been substituted for new ones. For large collections, <del> * this significantly improves rendering performance. If you don't have a unique identifier, <del> * `track by $index` can also provide a performance boost. <add> * **Best Practice:** If you are working with objects that have a unique identifier property, you <add> * should track by this identifier instead of the object instance, <add> * e.g. `item in items track by item.id`. <add> * Should you reload your data later, `ngRepeat` will not have to rebuild the DOM elements for items <add> * it has already rendered, even if the JavaScript objects in the collection have been substituted <add> * for new ones. For large collections, this significantly improves rendering performance. <ide> * </div> <ide> * <del> * ```html <del> * <div ng-repeat="model in collection track by model.id"> <del> * {{model.name}} <del> * </div> <del> * ``` <add> * ### Effects of DOM Element re-use <ide> * <del> * <br /> <del> * <div class="alert alert-warning"> <del> * Avoid using `track by $index` when the repeated template contains <del> * {@link guide/expression#one-time-binding one-time bindings}. In such cases, the `nth` DOM <del> * element will always be matched with the `nth` item of the array, so the bindings on that element <del> * will not be updated even when the corresponding item changes, essentially causing the view to get <del> * out-of-sync with the underlying data. <del> * </div> <add> * When DOM elements are re-used, ngRepeat updates the scope for the element, which will <add> * automatically update any active bindings on the template. However, other <add> * functionality will not be updated, because the element is not re-created: <ide> * <del> * When no `track by` expression is provided, it is equivalent to tracking by the built-in <del> * `$id` function, which tracks items by their identity: <del> * ```html <del> * <div ng-repeat="obj in collection track by $id(obj)"> <del> * {{obj.prop}} <del> * </div> <del> * ``` <add> * - Directives are not re-compiled <add> * - {@link guide/expression#one-time-binding one-time expressions} on the repeated template are not <add> * updated if they have stabilized. <ide> * <del> * <br /> <del> * <div class="alert alert-warning"> <del> * **Note:** `track by` must always be the last expression: <del> * </div> <del> * ``` <del> * <div ng-repeat="model in collection | orderBy: 'id' as filtered_result track by model.id"> <del> * {{model.name}} <del> * </div> <del> * ``` <add> * The above affects all kinds of element re-use due to tracking, but may be especially visible <add> * when tracking by `$index` due to the way ngRepeat re-uses elements. <ide> * <add> * The following example shows the effects of different actions with tracking: <add> <add> <example module="ngRepeat" name="ngRepeat-tracking" deps="angular-animate.js" animations="true"> <add> <file name="script.js"> <add> angular.module('ngRepeat', ['ngAnimate']).controller('repeatController', function($scope) { <add> var friends = [ <add> {name:'John', age:25}, <add> {name:'Mary', age:40}, <add> {name:'Peter', age:85} <add> ]; <add> <add> $scope.removeFirst = function() { <add> $scope.friends.shift(); <add> }; <add> <add> $scope.updateAge = function() { <add> $scope.friends.forEach(function(el) { <add> el.age = el.age + 5; <add> }); <add> }; <add> <add> $scope.copy = function() { <add> $scope.friends = angular.copy($scope.friends); <add> }; <add> <add> $scope.reset = function() { <add> $scope.friends = angular.copy(friends); <add> }; <add> <add> $scope.reset(); <add> }); <add> </file> <add> <file name="index.html"> <add> <div ng-controller="repeatController"> <add> <ol> <add> <li>When you click "Update Age", only the first list updates the age, because all others have <add> a one-time binding on the age property. If you then click "Copy", the current friend list <add> is copied, and now the second list updates the age, because the identity of the collection items <add> has changed and the list must be re-rendered. The 3rd and 4th list stay the same, because all the <add> items are already known according to their tracking functions. <add> </li> <add> <li>When you click "Remove First", the 4th list has the wrong age on both remaining items. This is <add> due to tracking by $index: when the first collection item is removed, ngRepeat reuses the first <add> DOM element for the new first collection item, and so on. Since the age property is one-time <add> bound, the value remains from the collection item which was previously at this index. <add> </li> <add> </ol> <add> <add> <button ng-click="removeFirst()">Remove First</button> <add> <button ng-click="updateAge()">Update Age</button> <add> <button ng-click="copy()">Copy</button> <add> <br><button ng-click="reset()">Reset List</button> <add> <br> <add> <code>track by $id(friend)</code> (default): <add> <ul class="example-animate-container"> <add> <li class="animate-repeat" ng-repeat="friend in friends"> <add> {{friend.name}} is {{friend.age}} years old. <add> </li> <add> </ul> <add> <code>track by $id(friend)</code> (default), with age one-time binding: <add> <ul class="example-animate-container"> <add> <li class="animate-repeat" ng-repeat="friend in friends"> <add> {{friend.name}} is {{::friend.age}} years old. <add> </li> <add> </ul> <add> <code>track by friend.name</code>, with age one-time binding: <add> <ul class="example-animate-container"> <add> <li class="animate-repeat" ng-repeat="friend in friends track by friend.name"> <add> {{friend.name}} is {{::friend.age}} years old. <add> </li> <add> </ul> <add> <code>track by $index</code>, with age one-time binding: <add> <ul class="example-animate-container"> <add> <li class="animate-repeat" ng-repeat="friend in friends track by $index"> <add> {{friend.name}} is {{::friend.age}} years old. <add> </li> <add> </ul> <add> </div> <add> </file> <add> <file name="animations.css"> <add> .example-animate-container { <add> background:white; <add> border:1px solid black; <add> list-style:none; <add> margin:0; <add> padding:0 10px; <add> } <add> <add> .animate-repeat { <add> line-height:30px; <add> list-style:none; <add> box-sizing:border-box; <add> } <add> <add> .animate-repeat.ng-move, <add> .animate-repeat.ng-enter, <add> .animate-repeat.ng-leave { <add> transition:all linear 0.5s; <add> } <add> <add> .animate-repeat.ng-leave.ng-leave-active, <add> .animate-repeat.ng-move, <add> .animate-repeat.ng-enter { <add> opacity:0; <add> max-height:0; <add> } <add> <add> .animate-repeat.ng-leave, <add> .animate-repeat.ng-move.ng-move-active, <add> .animate-repeat.ng-enter.ng-enter-active { <add> opacity:1; <add> max-height:30px; <add> } <add> </file> <add> </example> <add> <ide> * <ide> * ## Special repeat start and end points <ide> * To repeat a series of elements instead of just one parent element, ngRepeat (as well as other ng directives) supports extending <ide> * more than one tracking expression value resolve to the same key. (This would mean that two distinct objects are <ide> * mapped to the same DOM element, which is not possible.) <ide> * <del> * <div class="alert alert-warning"> <del> * <strong>Note:</strong> the `track by` expression must come last - after any filters, and the alias expression. <del> * </div> <add> * *Default tracking: $id()*: `item in items` is equivalent to `item in items track by $id(item)`. <add> * This implies that the DOM elements will be associated by item identity in the collection. <ide> * <del> * For example: `item in items` is equivalent to `item in items track by $id(item)`. This implies that the DOM elements <del> * will be associated by item identity in the array. <add> * The built-in `$id()` function can be used to assign a unique <add> * `$$hashKey` property to each item in the collection. This property is then used as a key to associated DOM elements <add> * with the corresponding item in the collection by identity. Moving the same object would move <add> * the DOM element in the same way in the DOM. <add> * Note that the default id function does not support duplicate primitive values (`number`, `string`), <add> * but supports duplictae non-primitive values (`object`) that are *equal* in shape. <ide> * <del> * For example: `item in items track by $id(item)`. A built in `$id()` function can be used to assign a unique <del> * `$$hashKey` property to each item in the array. This property is then used as a key to associated DOM elements <del> * with the corresponding item in the array by identity. Moving the same object in array would move the DOM <del> * element in the same way in the DOM. <add> * *Custom Expression*: It is possible to use any AngularJS expression to compute the tracking <add> * id, for example with a function, or using a property on the collection items. <add> * `item in items track by item.id` is a typical pattern when the items have a unique identifier, <add> * e.g. database id. In this case the object identity does not matter. Two objects are considered <add> * equivalent as long as their `id` property is same. <add> * Tracking by unique identifier is the most performant way and should be used whenever possible. <ide> * <del> * For example: `item in items track by item.id` is a typical pattern when the items come from the database. In this <del> * case the object identity does not matter. Two objects are considered equivalent as long as their `id` <del> * property is same. <add> * *$index*: This special property tracks the collection items by their index, and <add> * re-uses the DOM elements that match that index, e.g. `item in items track by $index`. This can <add> * be used for a performance improvement if no unique identfier is available and the identity of <add> * the collection items cannot be easily computed. It also allows duplicates. <ide> * <del> * For example: `item in items | filter:searchText track by item.id` is a pattern that might be used to apply a filter <del> * to items in conjunction with a tracking expression. <add> * <div class="alert alert-warning"> <add> * <strong>Note:</strong> Re-using DOM elements can have unforeseen effects. Read the <add> * {@link ngRepeat#tracking-and-duplicates section on tracking and duplicates} for <add> * more info. <add> * </div> <add> * <add> * <div class="alert alert-warning"> <add> * <strong>Note:</strong> the `track by` expression must come last - after any filters, and the alias expression: <add> * `item in items | filter:searchText as results track by item.id` <add> * </div> <ide> * <ide> * * `variable in expression as alias_expression` – You can also provide an optional alias expression which will then store the <ide> * intermediate results of the repeater after the filters have been applied. Typically this is used to render a special message <ide> * For example: `item in items | filter:x as results` will store the fragment of the repeated items as `results`, but only after <ide> * the items have been processed through the filter. <ide> * <del> * Please note that `as [variable name] is not an operator but rather a part of ngRepeat micro-syntax so it can be used only at the end <del> * (and not as operator, inside an expression). <add> * Please note that `as [variable name] is not an operator but rather a part of ngRepeat <add> * micro-syntax so it can be used only after all filters (and not as operator, inside an expression). <ide> * <del> * For example: `item in items | filter : x | orderBy : order | limitTo : limit as results` . <add> * For example: `item in items | filter : x | orderBy : order | limitTo : limit as results track by item.id` . <ide> * <ide> * @example <ide> * This example uses `ngRepeat` to display a list of people. A filter is used to restrict the displayed <ide> I have {{friends.length}} friends. They are: <ide> <input type="search" ng-model="q" placeholder="filter friends..." aria-label="filter friends" /> <ide> <ul class="example-animate-container"> <del> <li class="animate-repeat" ng-repeat="friend in friends | filter:q as results"> <add> <li class="animate-repeat" ng-repeat="friend in friends | filter:q as results track by friend.name"> <ide> [{{$index + 1}}] {{friend.name}} who is {{friend.age}} years old. <ide> </li> <ide> <li class="animate-repeat" ng-if="results.length === 0">
1
Ruby
Ruby
add keg-only to dsl
bdf245ff98e2c3498528d3f5f9ebb128fad5d700
<ide><path>Library/Homebrew/formula.rb <ide> def patches; end <ide> <ide> # rarely, you don't want your library symlinked into the main prefix <ide> # see gettext.rb for an example <del> def keg_only?; false end <add> def keg_only? <add> self.class.keg_only_reason || false <add> end <ide> <ide> # sometimes the clean process breaks things <ide> # skip cleaning paths in a formula with a class method like this: <ide> def #{attr}(val=nil) <ide> end <ide> end <ide> <del> attr_rw :version, :homepage, :specs, :deps, :external_deps <add> attr_rw :version, :homepage, :specs, :deps, :external_deps, :keg_only_reason <ide> attr_rw *CHECKSUM_TYPES <ide> <ide> def head val=nil, specs=nil <ide> def aka args <ide> puts "Aliases to Formula. The name of the symlink will be" <ide> puts "detected as an alias for the target formula." <ide> end <add> <add> def keg_only reason <add> @keg_only_reason = reason <add> end <ide> end <ide> end <ide>
1
Ruby
Ruby
move file action only to app generator
4f3e44fa03ab8fc47f75fa710b28c72b9b2328b9
<ide><path>railties/lib/generators/actions.rb <ide> def route(routing_code) <ide> <ide> protected <ide> <del> # Define file as an alias to create_file for backwards compatibility. <del> # <del> def file(*args, &block) <del> create_file(*args, &block) <del> end <del> <ide> # Define log for backwards compatibility. If just one argument is sent, <ide> # invoke say, otherwise invoke say_status. <ide> # <ide><path>railties/lib/generators/rails/app/app_generator.rb <ide> def freeze? <ide> <ide> protected <ide> <add> # Define file as an alias to create_file for backwards compatibility. <add> # TODO Add deprecation warning? <add> # <add> def file(*args, &block) <add> create_file(*args, &block) <add> end <add> <ide> def app_name <ide> @app_name ||= File.basename(root) <ide> end <ide><path>railties/test/generators/actions_test.rb <ide> def test_apply_loads_and_evaluates_a_template <ide> assert_equal generator.instance_variable_get("@foo"), "FOO" <ide> end <ide> <del> def test_file_should_write_data_to_file_path <del> action :file, 'lib/test_file.rb', 'heres test data' <add> def test_create_file_should_write_data_to_file_path <add> action :create_file, 'lib/test_file.rb', 'heres test data' <ide> assert_file 'lib/test_file.rb', 'heres test data' <ide> end <ide> <del> def test_file_should_write_block_contents_to_file_path <del> action(:file, 'lib/test_file.rb'){ 'heres block data' } <add> def test_create_file_should_write_block_contents_to_file_path <add> action(:create_file, 'lib/test_file.rb'){ 'heres block data' } <ide> assert_file 'lib/test_file.rb', 'heres block data' <ide> end <ide> <ide><path>railties/test/generators/app_generator_test.rb <ide> def test_default_namespace <ide> assert_match "rails:generators:app", Rails::Generators::AppGenerator.namespace <ide> end <ide> <add> def test_file_is_added_for_backwards_compatibility <add> action :file, 'lib/test_file.rb', 'heres test data' <add> assert_file 'lib/test_file.rb', 'heres test data' <add> end <add> <ide> protected <ide> <ide> def run_generator(args=[]) <ide> def generator(options={}) <ide> @generator ||= Rails::Generators::AppGenerator.new([destination_root], options, :root => destination_root) <ide> end <ide> <add> def action(*args, &block) <add> silence(:stdout){ generator.send(*args, &block) } <add> end <add> <ide> end
4
Ruby
Ruby
fix indent and remove extra white spaces
bbfddf8470fcea21f31b285f6d1ef1bb723e07e1
<ide><path>actionpack/test/template/form_options_helper_test.rb <ide> def test_time_zone_select_with_priority_zones_as_regexp <ide> "</select>", <ide> html <ide> end <del> <add> <ide> def test_time_zone_select_with_priority_zones_as_regexp_using_grep_finds_no_zones <ide> @firm = Firm.new("D") <del> <add> <ide> priority_zones = /A|D/ <ide> @fake_timezones.each do |tz| <ide> priority_zones.stubs(:===).with(tz).raises(Exception) <ide> end <del> <add> <ide> html = time_zone_select("firm", "time_zone", priority_zones) <ide> assert_dom_equal "<select id=\"firm_time_zone\" name=\"firm[time_zone]\">" + <ide> "<option value=\"\" disabled=\"disabled\">-------------</option>\n" + <ide> def test_time_zone_select_with_priority_zones_as_regexp_using_grep_finds_no_zone <ide> def test_time_zone_select_with_default_time_zone_and_nil_value <ide> @firm = Firm.new() <ide> @firm.time_zone = nil <del> html = time_zone_select( "firm", "time_zone", nil, :default => 'B' ) <del> assert_dom_equal "<select id=\"firm_time_zone\" name=\"firm[time_zone]\">" + <add> <add> html = time_zone_select( "firm", "time_zone", nil, :default => 'B' ) <add> assert_dom_equal "<select id=\"firm_time_zone\" name=\"firm[time_zone]\">" + <ide> "<option value=\"A\">A</option>\n" + <ide> "<option value=\"B\" selected=\"selected\">B</option>\n" + <ide> "<option value=\"C\">C</option>\n" + <ide> def test_time_zone_select_with_default_time_zone_and_nil_value <ide> end <ide> <ide> def test_time_zone_select_with_default_time_zone_and_value <del> @firm = Firm.new('D') <del> html = time_zone_select( "firm", "time_zone", nil, :default => 'B' ) <del> assert_dom_equal "<select id=\"firm_time_zone\" name=\"firm[time_zone]\">" + <del> "<option value=\"A\">A</option>\n" + <del> "<option value=\"B\">B</option>\n" + <del> "<option value=\"C\">C</option>\n" + <del> "<option value=\"D\" selected=\"selected\">D</option>\n" + <del> "<option value=\"E\">E</option>" + <del> "</select>", <del> html <add> @firm = Firm.new('D') <add> <add> html = time_zone_select( "firm", "time_zone", nil, :default => 'B' ) <add> assert_dom_equal "<select id=\"firm_time_zone\" name=\"firm[time_zone]\">" + <add> "<option value=\"A\">A</option>\n" + <add> "<option value=\"B\">B</option>\n" + <add> "<option value=\"C\">C</option>\n" + <add> "<option value=\"D\" selected=\"selected\">D</option>\n" + <add> "<option value=\"E\">E</option>" + <add> "</select>", <add> html <ide> end <ide> <ide> def test_options_for_select_with_element_attributes
1
Javascript
Javascript
use shallow copy instead of angular.copy
a55c1e79cf8894c2d348d4cf911b28dcc8a6995e
<ide><path>src/ngResource/resource.js <ide> function lookupDottedPath(obj, path) { <ide> return obj; <ide> } <ide> <add>/** <add> * Create a shallow copy of an object and clear other fields from the destination <add> */ <add>function shallowClearAndCopy(src, dst) { <add> dst = dst || {}; <add> <add> angular.forEach(dst, function(value, key){ <add> delete dst[key]; <add> }); <add> <add> for (var key in src) { <add> if (src.hasOwnProperty(key) && key.substr(0, 2) !== '$$') { <add> dst[key] = src[key]; <add> } <add> } <add> <add> return dst; <add>} <add> <ide> /** <ide> * @ngdoc overview <ide> * @name ngResource <ide> angular.module('ngResource', ['ng']). <ide> } <ide> <ide> function Resource(value){ <del> copy(value || {}, this); <add> shallowClearAndCopy(value || {}, this); <ide> } <ide> <ide> forEach(actions, function(action, name) { <ide> angular.module('ngResource', ['ng']). <ide> if (data) { <ide> // Need to convert action.isArray to boolean in case it is undefined <ide> // jshint -W018 <del> if ( angular.isArray(data) !== (!!action.isArray) ) { <add> if (angular.isArray(data) !== (!!action.isArray)) { <ide> throw $resourceMinErr('badcfg', 'Error in resource configuration. Expected ' + <ide> 'response to contain an {0} but got an {1}', <ide> action.isArray?'array':'object', angular.isArray(data)?'array':'object'); <ide> angular.module('ngResource', ['ng']). <ide> value.push(new Resource(item)); <ide> }); <ide> } else { <del> copy(data, value); <add> shallowClearAndCopy(data, value); <ide> value.$promise = promise; <ide> } <ide> }
1
Ruby
Ruby
add missing `require`s for `style` spec
2552ecb1e7b4148123e3b83990aee05a0a452271
<ide><path>Library/Homebrew/test/cask/cmd/style_spec.rb <ide> <ide> require "open3" <ide> <add>require "cli/args" <add>require "cli/named_args" <add> <ide> require_relative "shared_examples/invalid_option" <ide> <ide> describe Cask::Cmd::Style, :cask do
1
Javascript
Javascript
add spec for animationsdebugmodule
00fe438003150c4716d107f0bcd5610e364e4ff9
<ide><path>Libraries/NativeModules/specs/NativeAnimationsDebugModule.js <add>/** <add> * Copyright (c) Facebook, Inc. and its affiliates. <add> * <add> * This source code is licensed under the MIT license found in the <add> * LICENSE file in the root directory of this source tree. <add> * <add> * @flow <add> * @format <add> */ <add> <add>'use strict'; <add> <add>import type {TurboModule} from 'RCTExport'; <add>import * as TurboModuleRegistry from 'TurboModuleRegistry'; <add> <add>export interface Spec extends TurboModule { <add> +startRecordingFps: () => void; <add> +stopRecordingFps: (animationStopTimeMs: number) => void; <add>} <add> <add>export default TurboModuleRegistry.get<Spec>('AnimationsDebugModule');
1