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
PHP
PHP
apply fixes from styleci
7bdf8674651ad21bcf647a1a64efd569356313ef
<ide><path>tests/Database/DatabaseQueryBuilderTest.php <ide> public function testDeleteMethod() <ide> $result = $builder->from('users')->where('email', '=', 'foo')->orderBy('id')->take(1)->delete(); <ide> $this->assertEquals(1, $result); <ide> <del> <ide> $builder = $this->getMySqlBuilder(); <ide> $builder->getConnection()->shouldReceive('delete')->once()->with('delete from `users` where `email` = ? order by `id` asc limit 1', ['foo'])->andReturn(1); <ide> $result = $builder->from('users')->where('email', '=', 'foo')->orderBy('id')->take(1)->delete(); <ide><path>tests/Integration/Database/EloquentDeleteTest.php <ide> public function setUp() <ide> <ide> public function testOnlyDeleteWhatGiven() <ide> { <del> for($i = 1; $i <= 10; $i++) { <add> for ($i = 1; $i <= 10; $i++) { <ide> Comment::create([ <del> 'post_id' => Post::create()->id <add> 'post_id' => Post::create()->id, <ide> ]); <ide> } <del> <add> <ide> Post::latest('id')->limit(1)->delete(); <ide> $this->assertEquals(9, Post::all()->count()); <ide>
2
Javascript
Javascript
allow dots in a controller name
de2cdb0658b8b8cff5a59e26c5ec1c9b470efb9b
<ide><path>src/ng/controller.js <ide> */ <ide> function $ControllerProvider() { <ide> var controllers = {}, <del> CNTRL_REG = /^(\w+)(\s+as\s+(\w+))?$/; <add> CNTRL_REG = /^(\S+)(\s+as\s+(\w+))?$/; <ide> <ide> <ide> /** <ide><path>test/ng/controllerSpec.js <ide> describe('$controller', function() { <ide> }); <ide> <ide> <del> it('should publish controller instance into scope', function() { <del> var scope = {}; <add> describe('ctrl as syntax', function() { <ide> <del> $controllerProvider.register('FooCtrl', function() { this.mark = 'foo'; }); <add> it('should publish controller instance into scope', function() { <add> var scope = {}; <ide> <del> var foo = $controller('FooCtrl as foo', {$scope: scope}); <del> expect(scope.foo).toBe(foo); <del> expect(scope.foo.mark).toBe('foo'); <add> $controllerProvider.register('FooCtrl', function() { this.mark = 'foo'; }); <add> <add> var foo = $controller('FooCtrl as foo', {$scope: scope}); <add> expect(scope.foo).toBe(foo); <add> expect(scope.foo.mark).toBe('foo'); <add> }); <add> <add> <add> it('should allow controllers with dots', function() { <add> var scope = {}; <add> <add> $controllerProvider.register('a.b.FooCtrl', function() { this.mark = 'foo'; }); <add> <add> var foo = $controller('a.b.FooCtrl as foo', {$scope: scope}); <add> expect(scope.foo).toBe(foo); <add> expect(scope.foo.mark).toBe('foo'); <add> }); <ide> }); <ide> });
2
Javascript
Javascript
use onselect fallback in ie
2ff75129756388c96c90eb03b72b3ba3dcc5475c
<ide><path>src/renderers/dom/client/eventPlugins/SelectEventPlugin.js <ide> <ide> var EventConstants = require('EventConstants'); <ide> var EventPropagators = require('EventPropagators'); <add>var ExecutionEnvironment = require('ExecutionEnvironment'); <ide> var ReactInputSelection = require('ReactInputSelection'); <ide> var SyntheticEvent = require('SyntheticEvent'); <ide> <ide> var shallowEqual = require('shallowEqual'); <ide> <ide> var topLevelTypes = EventConstants.topLevelTypes; <ide> <add>var skipSelectionChangeEvent = ( <add> ExecutionEnvironment.canUseDOM && <add> 'documentMode' in document && <add> document.documentMode <= 11 <add>); <add> <ide> var eventTypes = { <ide> select: { <ide> phasedRegistrationNames: { <ide> var SelectEventPlugin = { <ide> return constructSelectEvent(nativeEvent, nativeEventTarget); <ide> <ide> // Chrome and IE fire non-standard event when selection is changed (and <del> // sometimes when it hasn't). <add> // sometimes when it hasn't). IE's event fires out of order with respect <add> // to key and input events on deletion, so we discard it. <add> // <ide> // Firefox doesn't support selectionchange, so check selection status <ide> // after each key entry. The selection changes after keydown and before <ide> // keyup, but we check on keydown as well in the case of holding down a <ide> // key, when multiple keydown events are fired but only one keyup is. <add> // This is also our approach for IE handling, for the reason above. <ide> case topLevelTypes.topSelectionChange: <add> if (skipSelectionChangeEvent) { <add> break; <add> } <ide> case topLevelTypes.topKeyDown: <ide> case topLevelTypes.topKeyUp: <ide> return constructSelectEvent(nativeEvent, nativeEventTarget);
1
Javascript
Javascript
remove prop types from `layoutanimation`
e873809222468e04ceb79a74e52c79ce447d9052
<ide><path>Libraries/LayoutAnimation/LayoutAnimation.js <ide> * @flow <ide> * @format <ide> */ <add> <ide> 'use strict'; <ide> <del>const PropTypes = require('prop-types'); <ide> const UIManager = require('UIManager'); <ide> <del>/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error <del> * found when Flow v0.54 was deployed. To see the error delete this comment and <del> * run Flow. */ <del>const keyMirror = require('fbjs/lib/keyMirror'); <del> <del>const {checkPropTypes} = PropTypes; <del> <del>const TypesEnum = { <del> spring: true, <del> linear: true, <del> easeInEaseOut: true, <del> easeIn: true, <del> easeOut: true, <del> keyboard: true, <del>}; <del>const Types = keyMirror(TypesEnum); <del> <del>const PropertiesEnum = { <del> opacity: true, <del> scaleX: true, <del> scaleY: true, <del> scaleXY: true, <del>}; <del>const Properties = keyMirror(PropertiesEnum); <add>type Type = <add> | 'spring' <add> | 'linear' <add> | 'easeInEaseOut' <add> | 'easeIn' <add> | 'easeOut' <add> | 'keyboard'; <ide> <del>const animType = PropTypes.shape({ <del> duration: PropTypes.number, <del> delay: PropTypes.number, <del> springDamping: PropTypes.number, <del> initialVelocity: PropTypes.number, <del> type: PropTypes.oneOf(Object.keys(Types)).isRequired, <del> property: PropTypes.oneOf( <del> // Only applies to create/delete <del> Object.keys(Properties), <del> ), <del>}); <add>type Property = 'opacity' | 'scaleX' | 'scaleY' | 'scaleXY'; <ide> <del>type Anim = { <add>type AnimationConfig = $ReadOnly<{| <ide> duration?: number, <ide> delay?: number, <ide> springDamping?: number, <ide> initialVelocity?: number, <del> type?: $Enum<typeof TypesEnum>, <del> property?: $Enum<typeof PropertiesEnum>, <del>}; <del> <del>const configType = PropTypes.shape({ <del> duration: PropTypes.number.isRequired, <del> create: animType, <del> update: animType, <del> delete: animType, <del>}); <add> type?: Type, <add> property?: Property, <add>|}>; <ide> <del>type Config = { <add>type LayoutAnimationConfig = $ReadOnly<{| <ide> duration: number, <del> create?: Anim, <del> update?: Anim, <del> delete?: Anim, <del>}; <add> create?: AnimationConfig, <add> update?: AnimationConfig, <add> delete?: AnimationConfig, <add>|}>; <ide> <del>function checkConfig(config: Config, location: string, name: string) { <del> checkPropTypes({config: configType}, {config}, location, name); <del>} <del> <del>function configureNext(config: Config, onAnimationDidEnd?: Function) { <del> if (__DEV__) { <del> checkConfig(config, 'config', 'LayoutAnimation.configureNext'); <del> } <add>function configureNext( <add> config: LayoutAnimationConfig, <add> onAnimationDidEnd?: Function, <add>) { <ide> UIManager.configureNextLayoutAnimation( <ide> config, <del> onAnimationDidEnd || function() {}, <add> onAnimationDidEnd ?? function() {}, <ide> function() { <ide> /* unused */ <ide> }, <ide> ); <ide> } <ide> <del>function create(duration: number, type, creationProp): Config { <add>function create( <add> duration: number, <add> type: Type, <add> property: Property, <add>): LayoutAnimationConfig { <ide> return { <ide> duration, <del> create: { <del> type, <del> property: creationProp, <del> }, <del> update: { <del> type, <del> }, <del> delete: { <del> type, <del> property: creationProp, <del> }, <add> create: {type, property}, <add> update: {type}, <add> delete: {type, property}, <ide> }; <ide> } <ide> <ide> const Presets = { <del> easeInEaseOut: create(300, Types.easeInEaseOut, Properties.opacity), <del> linear: create(500, Types.linear, Properties.opacity), <add> easeInEaseOut: create(300, 'easeInEaseOut', 'opacity'), <add> linear: create(500, 'linear', 'opacity'), <ide> spring: { <ide> duration: 700, <ide> create: { <del> type: Types.linear, <del> property: Properties.opacity, <add> type: 'linear', <add> property: 'opacity', <ide> }, <ide> update: { <del> type: Types.spring, <add> type: 'spring', <ide> springDamping: 0.4, <ide> }, <ide> delete: { <del> type: Types.linear, <del> property: Properties.opacity, <add> type: 'linear', <add> property: 'opacity', <ide> }, <ide> }, <ide> }; <ide> const LayoutAnimation = { <ide> * @param config Specifies animation properties: <ide> * <ide> * - `duration` in milliseconds <del> * - `create`, config for animating in new views (see `Anim` type) <del> * - `update`, config for animating views that have been updated <del> * (see `Anim` type) <add> * - `create`, `AnimationConfig` for animating in new views <add> * - `update`, `AnimationConfig` for animating views that have been updated <ide> * <ide> * @param onAnimationDidEnd Called when the animation finished. <ide> * Only supported on iOS. <ide> const LayoutAnimation = { <ide> * Helper for creating a config for `configureNext`. <ide> */ <ide> create, <del> Types, <del> Properties, <del> checkConfig, <add> Types: Object.freeze({ <add> spring: 'spring', <add> linear: 'linear', <add> easeInEaseOut: 'easeInEaseOut', <add> easeIn: 'easeIn', <add> easeOut: 'easeOut', <add> keyboard: 'keyboard', <add> }), <add> Properties: Object.freeze({ <add> opacity: 'opacity', <add> scaleX: 'scaleX', <add> scaleY: 'scaleY', <add> scaleXY: 'scaleXY', <add> }), <add> checkConfig(...args: Array<mixed>) { <add> console.error('LayoutAnimation.checkConfig(...) has been disabled.'); <add> }, <ide> Presets, <ide> easeInEaseOut: configureNext.bind(null, Presets.easeInEaseOut), <ide> linear: configureNext.bind(null, Presets.linear),
1
PHP
PHP
show a pretty diff for assertexactjson()
abab1c87a2e54710e44d562d2ab3ac2dc67c6631
<ide><path>src/Illuminate/Testing/AssertableJsonString.php <ide> public function assertExact(array $data) <ide> <ide> $expected = $this->reorderAssocKeys($data); <ide> <del> PHPUnit::assertEquals(json_encode($expected), json_encode($actual)); <add> PHPUnit::assertEquals( <add> json_encode($expected, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), <add> json_encode($actual, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) <add> ); <ide> <ide> return $this; <ide> }
1
Javascript
Javascript
prevent dupe events on enabled clickablecomponents
03bab83dde2c4213e7e9cdddb046be4bf92f759b
<ide><path>src/js/clickable-component.js <ide> class ClickableComponent extends Component { <ide> * Enable this `Component`s element. <ide> */ <ide> enable() { <del> this.removeClass('vjs-disabled'); <del> this.el_.setAttribute('aria-disabled', 'false'); <del> if (typeof this.tabIndex_ !== 'undefined') { <del> this.el_.setAttribute('tabIndex', this.tabIndex_); <add> if (!this.enabled_) { <add> this.enabled_ = true; <add> this.removeClass('vjs-disabled'); <add> this.el_.setAttribute('aria-disabled', 'false'); <add> if (typeof this.tabIndex_ !== 'undefined') { <add> this.el_.setAttribute('tabIndex', this.tabIndex_); <add> } <add> this.on(['tap', 'click'], this.handleClick); <add> this.on('focus', this.handleFocus); <add> this.on('blur', this.handleBlur); <ide> } <del> this.on('tap', this.handleClick); <del> this.on('click', this.handleClick); <del> this.on('focus', this.handleFocus); <del> this.on('blur', this.handleBlur); <ide> } <ide> <ide> /** <ide> * Disable this `Component`s element. <ide> */ <ide> disable() { <add> this.enabled_ = false; <ide> this.addClass('vjs-disabled'); <ide> this.el_.setAttribute('aria-disabled', 'true'); <ide> if (typeof this.tabIndex_ !== 'undefined') { <ide> this.el_.removeAttribute('tabIndex'); <ide> } <del> this.off('tap', this.handleClick); <del> this.off('click', this.handleClick); <add> this.off(['tap', 'click'], this.handleClick); <ide> this.off('focus', this.handleFocus); <ide> this.off('blur', this.handleBlur); <ide> } <ide><path>test/unit/clickable-component.test.js <ide> QUnit.test('handleClick should not be triggered when disabled', function() { <ide> testClickableComponent.dispose(); <ide> player.dispose(); <ide> }); <add> <add>QUnit.test('handleClick should not be triggered more than once when enabled', function() { <add> let clicks = 0; <add> <add> class TestClickableComponent extends ClickableComponent { <add> handleClick() { <add> clicks++; <add> } <add> } <add> <add> const player = TestHelpers.makePlayer({}); <add> const testClickableComponent = new TestClickableComponent(player); <add> const el = testClickableComponent.el(); <add> <add> testClickableComponent.enable(); <add> // Click should still be handled just once <add> Events.trigger(el, 'click'); <add> QUnit.equal(clicks, 1, 'no additional click handler when already enabled ClickableComponent has been enabled again'); <add> <add> testClickableComponent.dispose(); <add> player.dispose(); <add>});
2
Python
Python
update error string
d200a23b08f376ca8ad45efd6ebcdb85f2f13c0b
<ide><path>setup.py <ide> def get_data_files(dname, ignore=None, parent=None): <ide> <ide> if PY_pre_35: <ide> version = '.'.join([str(x) for x in sys.version_info[:3]]) <del> print('Version ' + version + ' is not supported. Supported versions are: %s.' <add> print('Version ' + version + ' is not supported. Supported versions are: %s. ' <ide> 'Latest version which supports Python 2.7 and Python 3 < 3.5.0 is ' <del> 'Libcloud v2.8.0' % ', '.join(SUPPORTED_VERSIONS)) <add> 'Libcloud v2.8.2' % ', '.join(SUPPORTED_VERSIONS)) <ide> sys.exit(1) <ide> <ide>
1
Text
Text
remove link to "breaking changes" wiki
422ac61535fd190836b174bb6ad8ec2af76e1f05
<ide><path>doc/guides/contributing/pull-requests.md <ide> use `Refs:`. <ide> contain an explanation about the reason of the breaking change, which <ide> situation would trigger the breaking change and what is the exact change. <ide> <del>Breaking changes will be listed in the wiki with the aim to make upgrading <del>easier. Please have a look at [Breaking Changes](https://github.com/nodejs/node/wiki/Breaking-changes-between-v4-LTS-and-v6-LTS) <del>for the level of detail that's suitable. <del> <ide> Sample complete commit message: <ide> <ide> ```txt
1
Javascript
Javascript
reverse subpath direction for annulus
3d064526d4bc21dffbd0024f7a099bd49e8aa3f7
<ide><path>d3.js <ide> d3.svg.arc = function() { <ide> + "A" + r1 + "," + r1 + " 0 1,1 0," + (-r1) <ide> + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 <ide> + "M0," + r0 <del> + "A" + r0 + "," + r0 + " 0 1,1 0," + (-r0) <del> + "A" + r0 + "," + r0 + " 0 1,1 0," + r0 <add> + "A" + r0 + "," + r0 + " 0 1,0 0," + (-r0) <add> + "A" + r0 + "," + r0 + " 0 1,0 0," + r0 <ide> + "Z" <ide> : "M0," + r1 <ide> + "A" + r1 + "," + r1 + " 0 1,1 0," + (-r1) <ide><path>d3.min.js <del>(function(){function dp(a,b,c){function i(a,b){var c=a.__domain||(a.__domain=a.domain()),d=a.range().map(function(a){return(a-b)/h});a.domain(c).domain(d.map(a.invert))}var d=Math.pow(2,(db[2]=a)-c[2]),e=db[0]=b[0]-d*c[0],f=db[1]=b[1]-d*c[1],g=d3.event,h=Math.pow(2,a);d3.event={scale:h,translate:[e,f],transform:function(a,b){a&&i(a,e),b&&i(b,f)}};try{dc.apply(dd,de)}finally{d3.event=g}g.preventDefault()}function dn(){dg&&(d3.event.stopPropagation(),d3.event.preventDefault(),dg=!1)}function dm(){cZ&&(df&&(dg=!0),dl(),cZ=null)}function dl(){c$=null,cZ&&(df=!0,dp(db[2],d3.svg.mouse(dd),cZ))}function dk(){var a=d3.svg.touches(dd);switch(a.length){case 1:var b=a[0];dp(db[2],b,c_[b.identifier]);break;case 2:var c=a[0],d=a[1],e=[(c[0]+d[0])/2,(c[1]+d[1])/2],f=c_[c.identifier],g=c_[d.identifier],h=[(f[0]+g[0])/2,(f[1]+g[1])/2,f[2]];dp(Math.log(d3.event.scale)/Math.LN2+f[2],e,h)}}function dj(){var a=d3.svg.touches(dd),b=-1,c=a.length,d;while(++b<c)c_[(d=a[b]).identifier]=dh(d);return a}function di(){cY||(cY=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{cY.scrollTop=1e3,cY.dispatchEvent(a),b=1e3-cY.scrollTop}catch(c){b=a.wheelDelta||-a.detail*5}return b*.005}function dh(a){return[a[0]-db[0],a[1]-db[1],db[2]]}function cX(){d3.event.stopPropagation(),d3.event.preventDefault()}function cW(){cR&&(cX(),cR=!1)}function cV(){!cN||(cS("dragend"),cN=null,cQ&&(cR=!0,cX()))}function cU(){if(!!cN){var a=cN.parentNode;if(!a)return cV();cS("drag"),cX()}}function cT(a){return d3.event.touches?d3.svg.touches(a)[0]:d3.svg.mouse(a)}function cS(a){var b=d3.event,c=cN.parentNode,d=0,e=0;c&&(c=cT(c),d=c[0]-cP[0],e=c[1]-cP[1],cP=c,cQ|=d|e);try{d3.event={dx:d,dy:e},cM[a].dispatch.apply(cN,cO)}finally{d3.event=b}b.preventDefault()}function cL(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 cK(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function cJ(a,b){a.attr("transform",function(a){return"translate("+b(a)+",0)"})}function cF(){return"circle"}function cE(){return 64}function cD(a,b){var c=(a.ownerSVGElement||a).createSVGPoint();if(cC<0&&(window.scrollX||window.scrollY)){var d=d3.select(document.body).append("svg:svg").style("position","absolute").style("top",0).style("left",0),e=d[0][0].getScreenCTM();cC=!e.f&&!e.e,d.remove()}cC?(c.x=b.pageX,c.y=b.pageY):(c.x=b.clientX,c.y=b.clientY),c=c.matrixTransform(a.getScreenCTM().inverse());return[c.x,c.y]}function cB(a){return function(){var b=a.apply(this,arguments),c=b[0],d=b[1]+bN;return[c*Math.cos(d),c*Math.sin(d)]}}function cA(a){return[a.x,a.y]}function cz(a){return a.endAngle}function cy(a){return a.startAngle}function cx(a){return a.radius}function cw(a){return a.target}function cv(a){return a.source}function cu(a){return function(b,c){return a[c][1]}}function ct(a){return function(b,c){return a[c][0]}}function cs(a){function i(f){if(f.length<1)return null;var i=bU(this,f,b,d),j=bU(this,f,b===c?ct(i):c,d===e?cu(i):e);return"M"+g(a(j),h)+"L"+g(a(i.reverse()),h)+"Z"}var b=bV,c=bV,d=0,e=bW,f="linear",g=bX[f],h=.7;i.x=function(a){if(!arguments.length)return c;b=c=a;return i},i.x0=function(a){if(!arguments.length)return b;b=a;return i},i.x1=function(a){if(!arguments.length)return c;c=a;return i},i.y=function(a){if(!arguments.length)return e;d=e=a;return i},i.y0=function(a){if(!arguments.length)return d;d=a;return i},i.y1=function(a){if(!arguments.length)return e;e=a;return i},i.interpolate=function(a){if(!arguments.length)return f;g=bX[f=a];return i},i.tension=function(a){if(!arguments.length)return h;h=a;return i};return i}function cr(a){var b,c=-1,d=a.length,e,f;while(++c<d)b=a[c],e=b[0],f=b[1]+bN,b[0]=e*Math.cos(f),b[1]=e*Math.sin(f);return a}function cq(a){return a.length<3?bY(a):a[0]+cc(a,cp(a))}function cp(a){var b=[],c,d,e,f,g=co(a),h=-1,i=a.length-1;while(++h<i)c=cn(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 co(a){var b=0,c=a.length-1,d=[],e=a[0],f=a[1],g=d[0]=cn(e,f);while(++b<c)d[b]=g+(g=cn(e=f,f=a[b+1]));d[b]=g;return d}function cn(a,b){return(b[1]-a[1])/(b[0]-a[0])}function cm(a,b,c){a.push("C",ci(cj,b),",",ci(cj,c),",",ci(ck,b),",",ci(ck,c),",",ci(cl,b),",",ci(cl,c))}function ci(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function ch(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 ce(a)}function cg(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=[ci(cl,g),",",ci(cl,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),cm(b,g,h);return b.join("")}function cf(a){if(a.length<4)return bY(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(ci(cl,f)+","+ci(cl,g)),--c;while(++c<d)e=a[c],f.shift(),f.push(e[0]),g.shift(),g.push(e[1]),cm(b,f,g);return b.join("")}function ce(a){if(a.length<3)return bY(a);var b=[],c=1,d=a.length,e=a[0],f=e[0],g=e[1],h=[f,f,f,(e=a[1])[0]],i=[g,g,g,e[1]];b.push(f,",",g),cm(b,h,i);while(++c<d)e=a[c],h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),cm(b,h,i);c=-1;while(++c<2)h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),cm(b,h,i);return b.join("")}function cd(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 cc(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return bY(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 cb(a,b,c){return a.length<3?bY(a):a[0]+cc(a,cd(a,b))}function ca(a,b){return a.length<3?bY(a):a[0]+cc((a.push(a[0]),a),cd([a[a.length-2]].concat(a,[a[1]]),b))}function b_(a,b){return a.length<4?bY(a):a[1]+cc(a.slice(1,a.length-1),cd(a,b))}function b$(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("H",(e=a[c])[0],"V",e[1]);return b.join("")}function bZ(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("V",(e=a[c])[1],"H",e[0]);return b.join("")}function bY(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("L",(e=a[c])[0],",",e[1]);return b.join("")}function bW(a){return a[1]}function bV(a){return a[0]}function bU(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 bT(a){function g(d){return d.length<1?null:"M"+e(a(bU(this,d,b,c)),f)}var b=bV,c=bW,d="linear",e=bX[d],f=.7;g.x=function(a){if(!arguments.length)return b;b=a;return g},g.y=function(a){if(!arguments.length)return c;c=a;return g},g.interpolate=function(a){if(!arguments.length)return d;e=bX[d=a];return g},g.tension=function(a){if(!arguments.length)return f;f=a;return g};return g}function bS(a){return a.endAngle}function bR(a){return a.startAngle}function bQ(a){return a.outerRadius}function bP(a){return a.innerRadius}function bM(a,b,c){function g(){d=c.length/(b-a),e=c.length-1;return f}function f(b){return c[Math.max(0,Math.min(e,Math.floor(d*(b-a))))]}var d,e;f.domain=function(c){if(!arguments.length)return[a,b];a=+c[0],b=+c[c.length-1];return g()},f.range=function(a){if(!arguments.length)return c;c=a;return g()},f.copy=function(){return bM(a,b,c)};return g()}function bL(a,b){function e(a){return isNaN(a=+a)?NaN:b[d3.bisect(c,a)]}function d(){var d=0,f=a.length,g=b.length;c=[];while(++d<g)c[d-1]=d3.quantile(a,d/g);return e}var c;e.domain=function(b){if(!arguments.length)return a;a=b.filter(function(a){return!isNaN(a)}).sort(d3.ascending);return d()},e.range=function(a){if(!arguments.length)return b;b=a;return d()},e.quantiles=function(){return c},e.copy=function(){return bL(a,b)};return d()}function bG(a,b){function f(b){return d[((c[b]||(c[b]=a.push(b)))-1)%d.length]}var c,d,e;f.domain=function(d){if(!arguments.length)return a;a=[],c={};var e=-1,g=d.length,h;while(++e<g)c[h=d[e]]||(c[h]=a.push(h));return f[b.t](b.x,b.p)},f.range=function(a){if(!arguments.length)return d;d=a,e=0,b={t:"range",x:a};return f},f.rangePoints=function(c,g){arguments.length<2&&(g=0);var h=c[0],i=c[1],j=(i-h)/(a.length-1+g);d=a.length<2?[(h+i)/2]:d3.range(h+j*g/2,i+j/2,j),e=0,b={t:"rangePoints",x:c,p:g};return f},f.rangeBands=function(c,g){arguments.length<2&&(g=0);var h=c[0],i=c[1],j=(i-h)/(a.length+g);d=d3.range(h+j*g,i,j),e=j*(1-g),b={t:"rangeBands",x:c,p:g};return f},f.rangeRoundBands=function(c,g){arguments.length<2&&(g=0);var h=c[0],i=c[1],j=Math.floor((i-h)/(a.length+g)),k=i-h-(a.length-g)*j;d=d3.range(h+Math.round(k/2),i,j),e=Math.round(j*(1-g)),b={t:"rangeRoundBands",x:c,p:g};return f},f.rangeBand=function(){return e},f.copy=function(){return bG(a,b)};return f.domain(a)}function bF(a){return function(b){return b<0?-Math.pow(-b,a):Math.pow(b,a)}}function bE(a,b){function e(b){return a(c(b))}var c=bF(b),d=bF(1/b);e.invert=function(b){return d(a.invert(b))},e.domain=function(b){if(!arguments.length)return a.domain().map(d);a.domain(b.map(c));return e},e.ticks=function(a){return bw(e.domain(),a)},e.tickFormat=function(a){return bx(e.domain(),a)},e.nice=function(){return e.domain(bq(e.domain(),bu))},e.exponent=function(a){if(!arguments.length)return b;var f=e.domain();c=bF(b=a),d=bF(1/b);return e.domain(f)},e.copy=function(){return bE(a.copy(),b)};return bt(e,a)}function bD(a){return a.toPrecision(1)}function bC(a){return-Math.log(-a)/Math.LN10}function bB(a){return Math.log(a)/Math.LN10}function bA(a,b){function d(c){return a(b(c))}var c=b.pow;d.invert=function(b){return c(a.invert(b))},d.domain=function(e){if(!arguments.length)return a.domain().map(c);b=e[0]<0?bC:bB,c=b.pow,a.domain(e.map(b));return d},d.nice=function(){a.domain(bq(a.domain(),br));return 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===bC){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(){return bD},d.copy=function(){return bA(a.copy(),b)};return bt(d,a)}function bz(a,b,c,d){var e=[],f=[],g=0,h=a.length;while(++g<h)e.push(c(a[g-1],a[g])),f.push(d(b[g-1],b[g]));return function(b){var c=d3.bisect(a,b,1,a.length-1)-1;return f[c](e[c](b))}}function by(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 bx(a,b){return d3.format(",."+Math.max(0,-Math.floor(Math.log(bv(a,b)[2])/Math.LN10+.01))+"f")}function bw(a,b){return d3.range.apply(d3,bv(a,b))}function bv(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;f<=.15?e*=10:f<=.35?e*=5:f<=.75&&(e*=2),c[0]=Math.ceil(c[0]/e)*e,c[1]=Math.floor(c[1]/e)*e+e*.5,c[2]=e;return c}function bu(a){a=Math.pow(10,Math.round(Math.log(a)/Math.LN10)-1);return{floor:function(b){return Math.floor(b/a)*a},ceil:function(b){return Math.ceil(b/a)*a}}}function bt(a,b){a.range=d3.rebind(a,b.range),a.rangeRound=d3.rebind(a,b.rangeRound),a.interpolate=d3.rebind(a,b.interpolate),a.clamp=d3.rebind(a,b.clamp);return a}function bs(a,b,c,d){function h(a){return e(a)}function g(){var g=a.length==2?by:bz,i=d?G:F;e=g(a,b,i,c),f=g(b,a,i,d3.interpolate);return h}var e,f;h.invert=function(a){return f(a)},h.domain=function(b){if(!arguments.length)return a;a=b.map(Number);return g()},h.range=function(a){if(!arguments.length)return b;b=a;return g()},h.rangeRound=function(a){return h.range(a).interpolate(d3.interpolateRound)},h.clamp=function(a){if(!arguments.length)return d;d=a;return g()},h.interpolate=function(a){if(!arguments.length)return c;c=a;return g()},h.ticks=function(b){return bw(a,b)},h.tickFormat=function(b){return bx(a,b)},h.nice=function(){bq(a,bu);return g()},h.copy=function(){return bs(a,b,c,d)};return g()}function br(){return Math}function bq(a,b){var c=0,d=a.length-1,e=a[c],f=a[d],g;f<e&&(g=c,c=d,d=g,g=e,e=f,f=g),b=b(f-e),a[c]=b.floor(e),a[d]=b.ceil(f);return a}function bp(a){var b=a[0],c=a[a.length-1];return b<c?[b,c]:[c,b]}function bo(){}function bm(){var a=null,b=bi,c=Infinity;while(b)b.flush?b=a?a.next=b.next:bi=b.next:(c=Math.min(c,b.then+b.delay),b=(a=b).next);return c}function bl(){var a,b=Date.now(),c=bi;while(c)a=b-c.then,a>=c.delay&&(c.flush=c.callback(a)),c=c.next;var d=bm()-b;d>24?(isFinite(d)&&(clearTimeout(bk),bk=setTimeout(bl,d)),bj=0):(bj=1,bn(bl))}function bh(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 bc(a){return typeof a=="function"?function(b,c,d){var e=a.call(this,b,c)+"";return d!=e&&d3.interpolate(d,e)}:(a=a+"",function(b,c,d){return d!=a&&d3.interpolate(d,a)})}function bb(a,b){d(a,bd);var c={},e=d3.dispatch("start","end"),f=bg,g=Date.now();a.id=b,a.tween=function(b,d){if(arguments.length<2)return c[b];d==null?delete c[b]:c[b]=d;return a},a.ease=function(b){if(!arguments.length)return f;f=typeof b=="function"?b:d3.ease.apply(d3,arguments);return a},a.each=function(b,c){if(arguments.length<2)return bh.call(a,b);e[b].add(c);return a},d3.timer(function(d){a.each(function(h,i,j){function r(){--o.count||delete l.__transition__;return 1}function q(a){if(o.active!==b)return r();var c=Math.min(1,(a-m)/n),d=f(c),g=k.length;while(g>0)k[--g].call(l,d);if(c===1){r(),bf=b,e.end.dispatch.call(l,h,i),bf=0;return 1}}function p(a){if(o.active>b)return r();o.active=b;for(var d in c)(d=c[d].call(l,h,i))&&k.push(d);e.start.dispatch.call(l,h,i),q(a)||d3.timer(q,0,g);return 1}var k=[],l=this,m=a[j][i].delay,n=a[j][i].duration,o=l.__transition__||(l.__transition__={active:0,count:0});++o.count,m<=d?p(d):d3.timer(p,m,g)});return 1},0,g);return a}function _(a){arguments.length||(a=d3.ascending);return function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function Z(a){d(a,$);return a}function Y(a){return{__data__:a}}function X(a){return function(){return U(a,this)}}function W(a){return function(){return T(a,this)}}function S(a){d(a,V);return a}function R(a,b,c){function g(a){return Math.round(f(a)*255)}function f(a){a>360?a-=360:a<0&&(a+=360);return a<60?d+(e-d)*a/60:a<180?e:a<240?d+(e-d)*(240-a)/60:d}var d,e;a=a%360,a<0&&(a+=360),b=b<0?0:b>1?1:b,c=c<0?0:c>1?1:c,e=c<=.5?c*(1+b):c+b-c*b,d=2*c-e;return H(g(a+120),g(a),g(a-120))}function Q(a,b,c){this.h=a,this.s=b,this.l=c}function P(a,b,c){return new Q(a,b,c)}function M(a){var b=parseFloat(a);return a.charAt(a.length-1)==="%"?Math.round(b*2.55):b}function L(a,b,c){var d=Math.min(a/=255,b/=255,c/=255),e=Math.max(a,b,c),f=e-d,g,h,i=(e+d)/2;f?(h=i<.5?f/(e+d):f/(2-e-d),a==e?g=(b-c)/f+(b<c?6:0):b==e?g=(c-a)/f+2:g=(a-b)/f+4,g*=60):h=g=0;return P(g,h,i)}function K(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(M(h[0]),M(h[1]),M(h[2]))}}if(i=N[a])return b(i.r,i.g,i.b);a!=null&&a.charAt(0)==="#"&&(a.length===4?(d=a.charAt(1),d+=d,e=a.charAt(2),e+=e,f=a.charAt(3),f+=f):a.length===7&&(d=a.substring(1,3),e=a.substring(3,5),f=a.substring(5,7)),d=parseInt(d,16),e=parseInt(e,16),f=parseInt(f,16));return b(d,e,f)}function J(a){return a<16?"0"+a.toString(16):a.toString(16)}function I(a,b,c){this.r=a,this.g=b,this.b=c}function H(a,b,c){return new I(a,b,c)}function G(a,b){b=b-(a=+a)?1/(b-a):0;return function(c){return Math.max(0,Math.min(1,(c-a)*b))}}function F(a,b){b=b-(a=+a)?1/(b-a):0;return function(c){return(c-a)*b}}function E(a){return a in D||/\bcolor\b/.test(a)?d3.interpolateRgb:d3.interpolate}function B(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 A(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}}function z(a,b){var c;arguments.length<2&&(b=.45),arguments.length<1?(a=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/a);return function(d){return 1+a*Math.pow(2,10*-d)*Math.sin((d-c)*2*Math.PI/b)}}function y(a){return 1-Math.sqrt(1-a*a)}function x(a){return Math.pow(2,10*(a-1))}function w(a){return 1-Math.cos(a*Math.PI/2)}function v(a){return function(b){return Math.pow(b,a)}}function u(a){return a}function t(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function s(a){return function(b){return 1-a(1-b)}}function n(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 m(a){return a+""}function j(a){var b={},c=[];b.add=function(a){for(var d=0;d<c.length;d++)if(c[d].listener==a)return b;c.push({listener:a,on:!0});return b},b.remove=function(a){for(var d=0;d<c.length;d++){var e=c[d];if(e.listener==a){e.on=!1,c=c.slice(0,d).concat(c.slice(d+1));break}}return b},b.dispatch=function(){var a=c;for(var b=0,d=a.length;b<d;b++){var e=a[b];e.on&&e.listener.apply(this,arguments)}};return b}function h(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function g(a){return a==null}function f(a){return a.length}function e(){return this}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.1.1"};var d=[].__proto__?function(a,b){a.__proto__=b}:function(a,b){for(var c in b)a[c]=b[c]};d3.functor=function(a){return typeof a=="function"?a:function(){return a}},d3.rebind=function(a,b){return function(){var c=b.apply(a,arguments);return arguments.length?a:c}},d3.ascending=function(a,b){return a<b?-1:a>b?1:a>=b?0:NaN},d3.descending=function(a,b){return b<a?-1:b>a?1:b>=a?0:NaN},d3.min=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&e>f&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&e>f&&(e=f)}return e},d3.max=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&f>e&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&f>e&&(e=f)}return e},d3.sum=function(a,b){var c=0,d=a.length,e,f=-1;if(arguments.length===1)while(++f<d)isNaN(e=+a[f])||(c+=e);else while(++f<d)isNaN(e=+b.call(a,a[f],f))||(c+=e);return c},d3.quantile=function(a,b){var c=(a.length-1)*b+1,d=Math.floor(c),e=a[d-1],f=c-d;return f?e+f*(a[d]-e):e},d3.zip=function(){if(!(e=arguments.length))return[];for(var a=-1,b=d3.min(arguments,f),c=Array(b);++a<b;)for(var d=-1,e,g=c[a]=Array(e);++d<e;)g[d]=arguments[d][a];return c},d3.bisectLeft=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;a[e]<b?c=e+1:d=e}return c},d3.bisect=d3.bisectRight=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;b<a[e]?d=e:c=e+1}return c},d3.first=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])>0&&(e=f);return e},d3.last=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])<=0&&(e=f);return e},d3.nest=function(){function g(a,d){if(d>=b.length)return a;var e=[],f=c[d++],h;for(h in a)e.push({key:h,values:g(a[h],d)});f&&e.sort(function(a,b){return f(a.key,b.key)});return e}function f(c,g){if(g>=b.length)return e?e.call(a,c):d?c.sort(d):c;var h=-1,i=c.length,j=b[g++],k,l,m={};while(++h<i)(k=j(l=c[h]))in m?m[k].push(l):m[k]=[l];for(k in m)m[k]=f(m[k],g);return m}var a={},b=[],c=[],d,e;a.map=function(a){return f(a,0)},a.entries=function(a){return g(f(a,0),0)},a.key=function(c){b.push(c);return a},a.sortKeys=function(d){c[b.length-1]=d;return a},a.sortValues=function(b){d=b;return a},a.rollup=function(b){e=b;return a};return a},d3.keys=function(a){var b=[];for(var c in a)b.push(c);return b},d3.values=function(a){var b=[];for(var c in a)b.push(a[c]);return b},d3.entries=function(a){var b=[];for(var c in a)b.push({key:c,value:a[c]});return b},d3.permute=function(a,b){var c=[],d=-1,e=b.length;while(++d<e)c[d]=a[b[d]];return c},d3.merge=function(a){return Array.prototype.concat.apply([],a)},d3.split=function(a,b){var c=[],d=[],e,f=-1,h=a.length;arguments.length<2&&(b=g);while(++f<h)b.call(d,e=a[f],f)?d=[]:(d.length||c.push(d),d.push(e));return c},d3.range=function(a,b,c){arguments.length<3&&(c=1,arguments.length<2&&(b=a,a=0));if((b-a)/c==Infinity)throw new Error("infinite range");var d=[],e=-1,f;if(c<0)while((f=a+c*++e)>b)d.push(f);else while((f=a+c*++e)<b)d.push(f);return d},d3.requote=function(a){return a.replace(i,"\\$&")};var i=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;d3.round=function(a,b){return b?Math.round(a*Math.pow(10,b))*Math.pow(10,-b):Math.round(a)},d3.xhr=function(a,b,c){var d=new XMLHttpRequest;arguments.length<3?c=b:b&&d.overrideMimeType&&d.overrideMimeType(b),d.open("GET",a,!0),d.onreadystatechange=function(){d.readyState===4&&c(d.status<300?d:null)},d.send(null)},d3.text=function(a,b,c){function d(a){c(a&&a.responseText)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.json=function(a,b){d3.text(a,"application/json",function(a){b(a?JSON.parse(a):null)})},d3.html=function(a,b){d3.text(a,"text/html",function(a){if(a!=null){var c=document.createRange();c.selectNode(document.body),a=c.createContextualFragment(a)}b(a)})},d3.xml=function(a,b,c){function d(a){c(a&&a.responseXML)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.ns={prefix:{svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},qualify:function(a){var b=a.indexOf(":");return b<0?a:{space:d3.ns.prefix[a.substring(0,b)],local:a.substring(b+1)}}},d3.dispatch=function(a){var b={},c;for(var d=0,e=arguments.length;d<e;d++)c=arguments[d],b[c]=j(c);return b},d3.format=function(a){var b=k.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,o=!1;h&&(h=h.substring(1)),e&&(c="0",g&&(f-=Math.floor((f-1)/4)));switch(i){case"n":g=!0,i="g";break;case"%":j=!0,i="f";break;case"p":j=!0,i="r";break;case"d":o=!0,h="0"}i=l[i]||m;return function(a){var b=j?a*100:+a,k=b<0&&(b=-b)?"−":d;if(o&&b%1)return"";a=i(b,h);if(e){var l=a.length+k.length;l<f&&(a=Array(f-l+1).join(c)+a),g&&(a=n(a)),a=k+a}else{g&&(a=n(a)),a=k+a;var l=a.length;l<f&&(a=Array(f-l+1).join(c)+a)}j&&(a+="%");return a}};var k=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,l={g:function(a,b){return a.toPrecision(b)},e:function(a,b){return a.toExponential(b)},f:function(a,b){return a.toFixed(b)},r:function(a,b){var c=1+Math.floor(1e-15+Math.log(a)/Math.LN10);return d3.round(a,b-c).toFixed(Math.max(0,Math.min(20,b-c)))}},o=v(2),p=v(3),q={linear:function(){return u},poly:v,quad:function(){return o},cubic:function(){return p},sin:function(){return w},exp:function(){return x},circle:function(){return y},elastic:z,back:A,bounce:function(){return B}},r={"in":function(a){return a},out:s,"in-out":t,"out-in":function(a){return t(s(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 r[d](q[c].apply(null,Array.prototype.slice.call(arguments,1)))},d3.event=null,d3.interpolate=function(a,b){var c=d3.interpolators.length,d;while(--c>=0&&!(d=d3.interpolators[c](a,b)));return d},d3.interpolateNumber=function(a,b){b-=a;return function(c){return a+b*c}},d3.interpolateRound=function(a,b){b-=a;return function(c){return Math.round(a+b*c)}},d3.interpolateString=function(a,b){var c,d,e,f=0,g=0,h=[],i=[],j,k;C.lastIndex=0;for(d=0;c=C.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=C.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=C.exec(a))&&d<j;++d){k=i[d];if(k.x==c[0]){if(k.i)if(h[k.i+1]==null){h[k.i-1]+=k.x,h.splice(k.i,1);for(e=d+1;e<j;++e)i[e].i--}else{h[k.i-1]+=k.x+h[k.i+1],h.splice(k.i,2);for(e=d+1;e<j;++e)i[e].i-=2}else if(h[k.i+1]==null)h[k.i]=k.x;else{h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1);for(e=d+1;e<j;++e)i[e].i--}i.splice(d,1),j--,d--}else k.x=d3.interpolateNumber(parseFloat(c[0]),parseFloat(k.x))}while(d<j)k=i.pop(),h[k.i+1]==null?h[k.i]=k.x:(h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1)),j--;return h.length===1?h[0]==null?i[0].x:function(){return b}:function(a){for(d=0;d<j;++d)h[(k=i[d]).i]=k.x(a);return h.join("")}},d3.interpolateRgb=function(a,b){a=d3.rgb(a),b=d3.rgb(b);var c=a.r,d=a.g,e=a.b,f=b.r-c,g=b.g-d,h=b.b-e;return function(a){return"rgb("+Math.round(c+f*a)+","+Math.round(d+g*a)+","+Math.round(e+h*a)+")"}},d3.interpolateHsl=function(a,b){a=d3.hsl(a),b=d3.hsl(b);var c=a.h,d=a.s,e=a.l,f=b.h-c,g=b.s-d,h=b.l-e;return function(a){return R(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]=E(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 C=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,D={background:1,fill:1,stroke:1};d3.interpolators=[d3.interpolateObject,function(a,b){return b instanceof Array&&d3.interpolateArray(a,b)},function(a,b){return typeof b=="string"&&d3.interpolateString(String(a),b)},function(a,b){return(typeof b=="string"?b in N||/^(#|rgb\(|hsl\()/.test(b):b instanceof I||b instanceof Q)&&d3.interpolateRgb(String(a),b)},function(a,b){return typeof b=="number"&&d3.interpolateNumber(+a,b)}],d3.rgb=function(a,b,c){return arguments.length===1?K(""+a,H,R):H(~~a,~~b,~~c)},I.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);var b=this.r,c=this.g,d=this.b,e=30;if(!b&&!c&&!d)return H(e,e,e);b&&b<e&&(b=e),c&&c<e&&(c=e),d&&d<e&&(d=e);return H(Math.min(255,Math.floor(b/a)),Math.min(255,Math.floor(c/a)),Math.min(255,Math.floor(d/a)))},I.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return H(Math.max(0,Math.floor(a*this.r)),Math.max(0,Math.floor(a*this.g)),Math.max(0,Math.floor(a*this.b)))},I.prototype.hsl=function(){return L(this.r,this.g,this.b)},I.prototype.toString=function(){return"#"+J(this.r)+J(this.g)+J(this.b)};var N={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 O in N)N[O]=K(N[O],H,R);d3.hsl=function(a,b,c){return arguments.length===1?K(""+a,L,P):P(+a,+b,+c)},Q.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);return P(this.h,this.s,this.l/a)},Q.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return P(this.h,this.s,a*this.l)},Q.prototype.rgb=function(){return R(this.h,this.s,this.l)},Q.prototype.toString=function(){return"hsl("+this.h+","+this.s*100+"%,"+this.l*100+"%)"};var T=function(a,b){return b.querySelector(a)},U=function(a,b){return b.querySelectorAll(a)};typeof Sizzle=="function"&&(T=function(a,b){return Sizzle(a,b)[0]},U=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))});var V=[];d3.selection=function(){return ba},d3.selection.prototype=V,V.select=function(a){var b=[],c,d,e,f;typeof a!="function"&&(a=W(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 S(b)},V.selectAll=function(a){var b=[],c,d;typeof a!="function"&&(a=X(a));for(var e=-1,f=this.length;++e<f;)for(var g=this[e],h=-1,i=g.length;++h<i;)if(d=g[h])b.push(c=a.call(d,d.__data__,h)),c.parentNode=d;return S(b)},V.attr=function(a,b){function i(){var c=b.apply(this,arguments);c==null?this.removeAttributeNS(a.space,a.local):this.setAttributeNS(a.space,a.local,c)}function h(){var c=b.apply(this,arguments);c==null?this.removeAttribute(a):this.setAttribute(a,c)}function g(){this.setAttributeNS(a.space,a.local,b)}function f(){this.setAttribute(a,b)}function e(){this.removeAttributeNS(a.space,a.local)}function d(){this.removeAttribute(a)}a=d3.ns.qualify(a);if(arguments.length<2){var c=this.node();return a.local?c.getAttributeNS(a.space,a.local):c.getAttribute(a)}return this.each(b==null?a.local?e:d:typeof b=="function"?a.local?i:h:a.local?g:f)},V.classed=function(a,b){function i(){(b.apply(this,arguments)?f:g).call(this)}function g(){if(b=this.classList)return b.remove(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;e=h(e.replace(c," ")),d?b.baseVal=e:this.className=e}function f(){if(b=this.classList)return b.add(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;c.lastIndex=0,c.test(e)||(e=h(e+" "+a),d?b.baseVal=e:this.className=e)}var c=new RegExp("(^|\\s+)"+d3.requote(a)+"(\\s+|$)","g");if(arguments.length<2){var d=this.node();if(e=d.classList)return e.contains(a);var e=d.className;c.lastIndex=0;return c.test( <del>e.baseVal!=null?e.baseVal:e)}return this.each(typeof b=="function"?i:b?f:g)},V.style=function(a,b,c){function f(){var d=b.apply(this,arguments);d==null?this.style.removeProperty(a):this.style.setProperty(a,d,c)}function e(){this.style.setProperty(a,b,c)}function d(){this.style.removeProperty(a)}arguments.length<3&&(c="");return arguments.length<2?window.getComputedStyle(this.node(),null).getPropertyValue(a):this.each(b==null?d:typeof b=="function"?f:e)},V.property=function(a,b){function e(){var c=b.apply(this,arguments);c==null?delete this[a]:this[a]=c}function d(){this[a]=b}function c(){delete this[a]}return arguments.length<2?this.node()[a]:this.each(b==null?c:typeof b=="function"?e:d)},V.text=function(a){return arguments.length<1?this.node().textContent:this.each(typeof a=="function"?function(){this.textContent=a.apply(this,arguments)}:function(){this.textContent=a})},V.html=function(a){return arguments.length<1?this.node().innerHTML:this.each(typeof a=="function"?function(){this.innerHTML=a.apply(this,arguments)}:function(){this.innerHTML=a})},V.append=function(a){function c(){return this.appendChild(document.createElementNS(a.space,a.local))}function b(){return this.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return this.select(a.local?c:b)},V.insert=function(a,b){function d(){return this.insertBefore(document.createElementNS(a.space,a.local),T(b,this))}function c(){return this.insertBefore(document.createElement(a),T(b,this))}a=d3.ns.qualify(a);return this.select(a.local?d:c)},V.remove=function(){return this.each(function(){var a=this.parentNode;a&&a.removeChild(this)})},V.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]=Y(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]=Y(p),l[g]=n[g]=null);for(;g<i;++g)m[g]=Y(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=S(d);j.enter=function(){return Z(c)},j.exit=function(){return S(e)};return j};var $=[];$.append=V.append,$.insert=V.insert,$.empty=V.empty,$.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 S(b)},V.filter=function(a){var b=[],c,d,e;for(var f=0,g=this.length;f<g;f++){b.push(c=[]),c.parentNode=(d=this[f]).parentNode;for(var h=0,i=d.length;h<i;h++)(e=d[h])&&a.call(e,e.__data__,h)&&c.push(e)}return S(b)},V.map=function(a){return this.each(function(){this.__data__=a.apply(this,arguments)})},V.sort=function(a){a=_.apply(this,arguments);for(var b=0,c=this.length;b<c;b++)for(var d=this[b].sort(a),e=1,f=d.length,g=d[0];e<f;e++){var h=d[e];h&&(g&&g.parentNode.insertBefore(h,g.nextSibling),g=h)}return this},V.on=function(a,b,c){arguments.length<3&&(c=!1);var d="__on"+a,e=a.indexOf(".");e>0&&(a=a.substring(0,e));return arguments.length<2?(e=this.node()[d])&&e._:this.each(function(e,f){function h(a){var c=d3.event;d3.event=a;try{b.call(g,g.__data__,f)}finally{d3.event=c}}var g=this;g[d]&&g.removeEventListener(a,g[d],c),b&&g.addEventListener(a,g[d]=h,c),h._=b})},V.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},V.call=function(a){a.apply(this,(arguments[0]=this,arguments));return this},V.empty=function(){return!this.node()},V.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},V.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 bb(a,bf||++be)};var ba=S([[document]]);ba[0].parentNode=document.documentElement,d3.select=function(a){return typeof a=="string"?ba.select(a):S([[a]])},d3.selectAll=function(a){return typeof a=="string"?ba.selectAll(a):S([a])};var bd=[],be=0,bf=0,bg=d3.ease("cubic-in-out");bd.call=V.call,d3.transition=function(){return ba.transition()},d3.transition.prototype=bd,bd.select=function(a){var b=[],c,d,e;typeof a!="function"&&(a=W(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 bb(b,this.id).ease(this.ease())},bd.selectAll=function(a){var b=[],c,d;typeof a!="function"&&(a=X(a));for(var e=-1,f=this.length;++e<f;)for(var g=this[e],h=-1,i=g.length;++h<i;)if(d=g[h]){b.push(c=a.call(d.node,d.node.__data__,h));for(var j=-1,k=c.length;++j<k;)c[j]={node:c[j],delay:d.delay,duration:d.duration}}return bb(b,this.id).ease(this.ease())},bd.attr=function(a,b){return this.attrTween(a,bc(b))},bd.attrTween=function(a,b){function d(c,d){var e=b.call(this,c,d,this.getAttributeNS(a.space,a.local));return e&&function(b){this.setAttributeNS(a.space,a.local,e(b))}}function c(c,d){var e=b.call(this,c,d,this.getAttribute(a));return e&&function(b){this.setAttribute(a,e(b))}}a=d3.ns.qualify(a);return this.tween("attr."+a,a.local?d:c)},bd.style=function(a,b,c){arguments.length<3&&(c="");return this.styleTween(a,bc(b),c)},bd.styleTween=function(a,b,c){arguments.length<3&&(c="");return this.tween("style."+a,function(d,e){var f=b.call(this,d,e,window.getComputedStyle(this,null).getPropertyValue(a));return f&&function(b){this.style.setProperty(a,f(b),c)}})},bd.text=function(a){return this.tween("text",function(b,c){this.textContent=typeof a=="function"?a.call(this,b,c):a})},bd.remove=function(){return this.each("end",function(){var a;!this.__transition__&&(a=this.parentNode)&&a.removeChild(this)})},bd.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}))},bd.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}))},bd.transition=function(){return this.select(e)};var bi=null,bj,bk;d3.timer=function(a,b,c){var d=!1,e,f=bi;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||(bi={callback:a,then:c,delay:b,next:bi}),bj||(bk=clearTimeout(bk),bj=1,bn(bl))},d3.timer.flush=function(){var a,b=Date.now(),c=bi;while(c)a=b-c.then,c.delay||(c.flush=c.callback(a)),c=c.next;bm()};var bn=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.scale={},d3.scale.linear=function(){return bs([0,1],[0,1],d3.interpolate,!1)},d3.scale.log=function(){return bA(d3.scale.linear(),bB)},bB.pow=function(a){return Math.pow(10,a)},bC.pow=function(a){return-Math.pow(10,-a)},d3.scale.pow=function(){return bE(d3.scale.linear(),1)},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){return bG([],{t:"range",x:[]})},d3.scale.category10=function(){return d3.scale.ordinal().range(bH)},d3.scale.category20=function(){return d3.scale.ordinal().range(bI)},d3.scale.category20b=function(){return d3.scale.ordinal().range(bJ)},d3.scale.category20c=function(){return d3.scale.ordinal().range(bK)};var bH=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],bI=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],bJ=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],bK=["#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 bL([],[])},d3.scale.quantize=function(){return bM(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)+bN,h=d.apply(this,arguments)+bN,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>=bO?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,1 0,"+ -e+"A"+e+","+e+" 0 1,1 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=bP,b=bQ,c=bR,d=bS;e.innerRadius=function(b){if(!arguments.length)return a;a=d3.functor(b);return e},e.outerRadius=function(a){if(!arguments.length)return b;b=d3.functor(a);return e},e.startAngle=function(a){if(!arguments.length)return c;c=d3.functor(a);return e},e.endAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return e},e.centroid=function(){var e=(a.apply(this,arguments)+b.apply(this,arguments))/2,f=(c.apply(this,arguments)+d.apply(this,arguments))/2+bN;return[Math.cos(f)*e,Math.sin(f)*e]};return e};var bN=-Math.PI/2,bO=2*Math.PI-1e-6;d3.svg.line=function(){return bT(Object)};var bX={linear:bY,"step-before":bZ,"step-after":b$,basis:ce,"basis-open":cf,"basis-closed":cg,bundle:ch,cardinal:cb,"cardinal-open":b_,"cardinal-closed":ca,monotone:cq},cj=[0,2/3,1/3,0],ck=[0,1/3,2/3,0],cl=[0,1/6,2/3,1/6];d3.svg.line.radial=function(){var a=bT(cr);a.radius=a.x,delete a.x,a.angle=a.y,delete a.y;return a},d3.svg.area=function(){return cs(Object)},d3.svg.area.radial=function(){var a=cs(cr);a.radius=a.x,delete a.x,a.innerRadius=a.x0,delete a.x0,a.outerRadius=a.x1,delete a.x1,a.angle=a.y,delete a.y,a.startAngle=a.y0,delete a.y0,a.endAngle=a.y1,delete a.y1;return a},d3.svg.chord=function(){function j(a,b,c,d){return"Q 0,0 "+d}function i(a,b){return"A"+a+","+a+" 0 0,1 "+b}function h(a,b){return a.a0==b.a0&&a.a1==b.a1}function g(a,b,f,g){var h=b.call(a,f,g),i=c.call(a,h,g),j=d.call(a,h,g)+bN,k=e.call(a,h,g)+bN;return{r:i,a0:j,a1:k,p0:[i*Math.cos(j),i*Math.sin(j)],p1:[i*Math.cos(k),i*Math.sin(k)]}}function f(c,d){var e=g(this,a,c,d),f=g(this,b,c,d);return"M"+e.p0+i(e.r,e.p1)+(h(e,f)?j(e.r,e.p1,e.r,e.p0):j(e.r,e.p1,f.r,f.p0)+i(f.r,f.p1)+j(f.r,f.p1,e.r,e.p0))+"Z"}var a=cv,b=cw,c=cx,d=bR,e=bS;f.radius=function(a){if(!arguments.length)return c;c=d3.functor(a);return f},f.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return f},f.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return f},f.startAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return f},f.endAngle=function(a){if(!arguments.length)return e;e=d3.functor(a);return f};return f},d3.svg.diagonal=function(){function d(d,e){var f=a.call(this,d,e),g=b.call(this,d,e),h=(f.y+g.y)/2,i=[f,{x:f.x,y:h},{x:g.x,y:h},g];i=i.map(c);return"M"+i[0]+"C"+i[1]+" "+i[2]+" "+i[3]}var a=cv,b=cw,c=cA;d.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return d},d.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return d},d.projection=function(a){if(!arguments.length)return c;c=a;return d};return d},d3.svg.diagonal.radial=function(){var a=d3.svg.diagonal(),b=cA,c=a.projection;a.projection=function(a){return arguments.length?c(cB(b=a)):b};return a},d3.svg.mouse=function(a){return cD(a,d3.event)};var cC=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.touches=function(a){var b=d3.event.touches;return b?Array.prototype.map.call(b,function(b){var c=cD(a,b);c.identifier=b.identifier;return c}):[]},d3.svg.symbol=function(){function c(c,d){return(cG[a.call(this,c,d)]||cG.circle)(b.call(this,c,d))}var a=cF,b=cE;c.type=function(b){if(!arguments.length)return a;a=d3.functor(b);return c},c.size=function(a){if(!arguments.length)return b;b=d3.functor(a);return c};return c};var cG={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*cI)),c=b*cI;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/cH),c=b*cH/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.sqrt(a/cH),c=b*cH/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}};d3.svg.symbolTypes=d3.keys(cG);var cH=Math.sqrt(3),cI=Math.tan(30*Math.PI/180);d3.svg.axis=function(){function j(j){j.each(function(k,l,m){function F(a){return j.delay?a.transition().delay(j[m][l].delay).duration(j[m][l].duration).ease(j.ease()):a}var n=d3.select(this),o=a.ticks.apply(a,g),p=h==null?a.tickFormat.apply(a,g):h,q=cL(a,o,i),r=n.selectAll(".minor").data(q,String),s=r.enter().insert("svg:line","g").attr("class","tick minor").style("opacity",1e-6),t=F(r.exit()).style("opacity",1e-6).remove(),u=F(r).style("opacity",1),v=n.selectAll("g").data(o,String),w=v.enter().insert("svg:g","path").style("opacity",1e-6),x=F(v.exit()).style("opacity",1e-6).remove(),y=F(v).style("opacity",1),z,A=bp(a.range()),B=n.selectAll(".domain").data([]),C=B.enter().append("svg:path").attr("class","domain"),D=F(B),E=this.__chart__||a;this.__chart__=a.copy(),w.append("svg:line").attr("class","tick"),w.append("svg:text"),y.select("text").text(p);switch(b){case"bottom":z=cJ,u.attr("y2",d),w.select("text").attr("dy",".71em").attr("text-anchor","middle"),y.select("line").attr("y2",c),y.select("text").attr("y",Math.max(c,0)+f),D.attr("d","M"+A[0]+","+e+"V0H"+A[1]+"V"+e);break;case"top":z=cJ,u.attr("y2",-d),w.select("text").attr("text-anchor","middle"),y.select("line").attr("y2",-c),y.select("text").attr("y",-(Math.max(c,0)+f)),D.attr("d","M"+A[0]+","+ -e+"V0H"+A[1]+"V"+ -e);break;case"left":z=cK,u.attr("x2",-d),w.select("text").attr("dy",".32em").attr("text-anchor","end"),y.select("line").attr("x2",-c),y.select("text").attr("x",-(Math.max(c,0)+f)),D.attr("d","M"+ -e+","+A[0]+"H0V"+A[1]+"H"+ -e);break;case"right":z=cK,u.attr("x2",d),w.select("text").attr("dy",".32em"),y.select("line").attr("x2",c),y.select("text").attr("x",Math.max(c,0)+f),D.attr("d","M"+e+","+A[0]+"H0V"+A[1]+"H"+e)}w.call(z,E),y.call(z,a),x.call(z,a),s.call(z,E),u.call(z,a),t.call(z,a)})}var a=d3.scale.linear(),b="bottom",c=6,d=6,e=6,f=3,g=[10],h,i=0;j.scale=function(b){if(!arguments.length)return a;a=b;return j},j.orient=function(a){if(!arguments.length)return b;b=a;return j},j.ticks=function(){if(!arguments.length)return g;g=arguments;return j},j.tickFormat=function(a){if(!arguments.length)return h;h=a;return j},j.tickSize=function(a,b,f){if(!arguments.length)return c;var g=arguments.length-1;c=+a,d=g>1?+b:c,e=g>0?+arguments[g]:c;return j},j.tickPadding=function(a){if(!arguments.length)return f;f=+a;return j},j.tickSubdivide=function(a){if(!arguments.length)return i;i=+a;return j};return j},d3.behavior={},d3.behavior.drag=function(){function d(){c.apply(this,arguments),cS("dragstart")}function c(){cM=a,cP=cT((cN=this).parentNode),cQ=0,cO=arguments}function b(){this.on("mousedown.drag",d).on("touchstart.drag",d),d3.select(window).on("mousemove.drag",cU).on("touchmove.drag",cU).on("mouseup.drag",cV,!0).on("touchend.drag",cV,!0).on("click.drag",cW,!0)}var a=d3.dispatch("drag","dragstart","dragend");b.on=function(c,d){a[c].add(d);return b};return b};var cM,cN,cO,cP,cQ,cR;d3.behavior.zoom=function(){function h(){d.apply(this,arguments);var b=dj(),c,e=Date.now();b.length===1&&e-da<300&&dp(1+Math.floor(a[2]),c=b[0],c_[c.identifier]),da=e}function g(){d.apply(this,arguments);var b=d3.svg.mouse(dd);dp(d3.event.shiftKey?Math.ceil(a[2]-1):Math.floor(a[2]+1),b,dh(b))}function f(){d.apply(this,arguments),c$||(c$=dh(d3.svg.mouse(dd))),dp(di()+a[2],d3.svg.mouse(dd),c$)}function e(){d.apply(this,arguments),cZ=dh(d3.svg.mouse(dd)),df=!1,d3.event.preventDefault(),window.focus()}function d(){db=a,dc=b.zoom.dispatch,dd=this,de=arguments}function c(){this.on("mousedown.zoom",e).on("mousewheel.zoom",f).on("DOMMouseScroll.zoom",f).on("dblclick.zoom",g).on("touchstart.zoom",h),d3.select(window).on("mousemove.zoom",dl).on("mouseup.zoom",dm).on("touchmove.zoom",dk).on("touchend.zoom",dj).on("click.zoom",dn,!0)}var a=[0,0,0],b=d3.dispatch("zoom");c.on=function(a,d){b[a].add(d);return c};return c};var cY,cZ,c$,c_={},da=0,db,dc,dd,de,df,dg})() <ide>\ No newline at end of file <add>(function(){function e(){return this}function f(a){return a.length}function g(a){return a==null}function h(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function j(a){var b={},c=[];return b.add=function(a){for(var d=0;d<c.length;d++)if(c[d].listener==a)return b;return c.push({listener:a,on:!0}),b},b.remove=function(a){for(var d=0;d<c.length;d++){var e=c[d];if(e.listener==a){e.on=!1,c=c.slice(0,d).concat(c.slice(d+1));break}}return b},b.dispatch=function(){var a=c;for(var b=0,d=a.length;b<d;b++){var e=a[b];e.on&&e.listener.apply(this,arguments)}},b}function m(a){return a+""}function n(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 s(a){return function(b){return 1-a(1-b)}}function t(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function u(a){return a}function v(a){return function(b){return Math.pow(b,a)}}function w(a){return 1-Math.cos(a*Math.PI/2)}function x(a){return Math.pow(2,10*(a-1))}function y(a){return 1-Math.sqrt(1-a*a)}function z(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 A(a){return a||(a=1.70158),function(b){return b*b*((a+1)*b-a)}}function B(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 E(a){return a in D||/\bcolor\b/.test(a)?d3.interpolateRgb:d3.interpolate}function F(a,b){return b=b-(a=+a)?1/(b-a):0,function(c){return(c-a)*b}}function G(a,b){return b=b-(a=+a)?1/(b-a):0,function(c){return Math.max(0,Math.min(1,(c-a)*b))}}function H(a,b,c){return new I(a,b,c)}function I(a,b,c){this.r=a,this.g=b,this.b=c}function J(a){return a<16?"0"+a.toString(16):a.toString(16)}function K(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(M(h[0]),M(h[1]),M(h[2]))}}return(i=N[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 L(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,P(g,h,i)}function M(a){var b=parseFloat(a);return a.charAt(a.length-1)==="%"?Math.round(b*2.55):b}function P(a,b,c){return new Q(a,b,c)}function Q(a,b,c){this.h=a,this.s=b,this.l=c}function R(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=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,H(g(a+120),g(a),g(a-120))}function S(a){return d(a,V),a}function W(a){return function(){return T(a,this)}}function X(a){return function(){return U(a,this)}}function Y(a){return{__data__:a}}function Z(a){return d(a,$),a}function _(a){return arguments.length||(a=d3.ascending),function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function bb(a,b){d(a,bd);var c={},e=d3.dispatch("start","end"),f=bg,g=Date.now();return a.id=b,a.tween=function(b,d){return arguments.length<2?c[b]:(d==null?delete c[b]:c[b]=d,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?bh.call(a,b):(e[b].add(c),a)},d3.timer(function(d){return a.each(function(h,i,j){function p(a){if(o.active>b)return r();o.active=b;for(var d in c)(d=c[d].call(l,h,i))&&k.push(d);return e.start.dispatch.call(l,h,i),q(a)||d3.timer(q,0,g),1}function q(a){if(o.active!==b)return r();var c=Math.min(1,(a-m)/n),d=f(c),g=k.length;while(g>0)k[--g].call(l,d);if(c===1)return r(),bf=b,e.end.dispatch.call(l,h,i),bf=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<=d?p(d):d3.timer(p,m,g)}),1},0,g),a}function bc(a){return typeof a=="function"?function(b,c,d){var e=a.call(this,b,c)+"";return d!=e&&d3.interpolate(d,e)}:(a=a+"",function(b,c,d){return d!=a&&d3.interpolate(d,a)})}function bh(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 bl(){var a,b=Date.now(),c=bi;while(c)a=b-c.then,a>=c.delay&&(c.flush=c.callback(a)),c=c.next;var d=bm()-b;d>24?(isFinite(d)&&(clearTimeout(bk),bk=setTimeout(bl,d)),bj=0):(bj=1,bn(bl))}function bm(){var a=null,b=bi,c=Infinity;while(b)b.flush?b=a?a.next=b.next:bi=b.next:(c=Math.min(c,b.then+b.delay),b=(a=b).next);return c}function bo(){}function bp(a){var b=a[0],c=a[a.length-1];return b<c?[b,c]:[c,b]}function bq(a,b){var c=0,d=a.length-1,e=a[c],f=a[d],g;return f<e&&(g=c,c=d,d=g,g=e,e=f,f=g),b=b(f-e),a[c]=b.floor(e),a[d]=b.ceil(f),a}function br(){return Math}function bs(a,b,c,d){function g(){var g=a.length==2?by:bz,i=d?G:F;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 bw(a,b)},h.tickFormat=function(b){return bx(a,b)},h.nice=function(){return bq(a,bu),g()},h.copy=function(){return bs(a,b,c,d)},g()}function bt(a,b){return a.range=d3.rebind(a,b.range),a.rangeRound=d3.rebind(a,b.rangeRound),a.interpolate=d3.rebind(a,b.interpolate),a.clamp=d3.rebind(a,b.clamp),a}function bu(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 bv(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 bw(a,b){return d3.range.apply(d3,bv(a,b))}function bx(a,b){return d3.format(",."+Math.max(0,-Math.floor(Math.log(bv(a,b)[2])/Math.LN10+.01))+"f")}function by(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 bz(a,b,c,d){var e=[],f=[],g=0,h=a.length;while(++g<h)e.push(c(a[g-1],a[g])),f.push(d(b[g-1],b[g]));return function(b){var c=d3.bisect(a,b,1,a.length-1)-1;return f[c](e[c](b))}}function bA(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?bC:bB,c=b.pow,a.domain(e.map(b)),d):a.domain().map(c)},d.nice=function(){return a.domain(bq(a.domain(),br)),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===bC){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(){return bD},d.copy=function(){return bA(a.copy(),b)},bt(d,a)}function bB(a){return Math.log(a)/Math.LN10}function bC(a){return-Math.log(-a)/Math.LN10}function bD(a){return a.toPrecision(1)}function bE(a,b){function e(b){return a(c(b))}var c=bF(b),d=bF(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 bw(e.domain(),a)},e.tickFormat=function(a){return bx(e.domain(),a)},e.nice=function(){return e.domain(bq(e.domain(),bu))},e.exponent=function(a){if(!arguments.length)return b;var f=e.domain();return c=bF(b=a),d=bF(1/b),e.domain(f)},e.copy=function(){return bE(a.copy(),b)},bt(e,a)}function bF(a){return function(b){return b<0?-Math.pow(-b,a):Math.pow(b,a)}}function bG(a,b){function f(b){return d[((c[b]||(c[b]=a.push(b)))-1)%d.length]}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,g){arguments.length<2&&(g=0);var h=c[0],i=c[1],j=(i-h)/(a.length-1+g);return d=a.length<2?[(h+i)/2]:d3.range(h+j*g/2,i+j/2,j),e=0,b={t:"rangePoints",x:c,p:g},f},f.rangeBands=function(c,g){arguments.length<2&&(g=0);var h=c[0],i=c[1],j=(i-h)/(a.length+g);return d=d3.range(h+j*g,i,j),e=j*(1-g),b={t:"rangeBands",x:c,p:g},f},f.rangeRoundBands=function(c,g){arguments.length<2&&(g=0);var h=c[0],i=c[1],j=Math.floor((i-h)/(a.length+g)),k=i-h-(a.length-g)*j;return d=d3.range(h+Math.round(k/2),i,j),e=Math.round(j*(1-g)),b={t:"rangeRoundBands",x:c,p:g},f},f.rangeBand=function(){return e},f.copy=function(){return bG(a,b)},f.domain(a)}function bL(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 bL(a,b)},d()}function bM(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 bM(a,b,c)},g()}function bP(a){return a.innerRadius}function bQ(a){return a.outerRadius}function bR(a){return a.startAngle}function bS(a){return a.endAngle}function bT(a){function g(d){return d.length<1?null:"M"+e(a(bU(this,d,b,c)),f)}var b=bV,c=bW,d="linear",e=bX[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=bX[d=a],g):d},g.tension=function(a){return arguments.length?(f=a,g):f},g}function bU(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 bV(a){return a[0]}function bW(a){return a[1]}function bY(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("L",(e=a[c])[0],",",e[1]);return b.join("")}function bZ(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("V",(e=a[c])[1],"H",e[0]);return b.join("")}function b$(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("H",(e=a[c])[0],"V",e[1]);return b.join("")}function b_(a,b){return a.length<4?bY(a):a[1]+cc(a.slice(1,a.length-1),cd(a,b))}function ca(a,b){return a.length<3?bY(a):a[0]+cc((a.push(a[0]),a),cd([a[a.length-2]].concat(a,[a[1]]),b))}function cb(a,b,c){return a.length<3?bY(a):a[0]+cc(a,cd(a,b))}function cc(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return bY(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 cd(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 ce(a){if(a.length<3)return bY(a);var b=[],c=1,d=a.length,e=a[0],f=e[0],g=e[1],h=[f,f,f,(e=a[1])[0]],i=[g,g,g,e[1]];b.push(f,",",g),cm(b,h,i);while(++c<d)e=a[c],h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),cm(b,h,i);c=-1;while(++c<2)h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),cm(b,h,i);return b.join("")}function cf(a){if(a.length<4)return bY(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(ci(cl,f)+","+ci(cl,g)),--c;while(++c<d)e=a[c],f.shift(),f.push(e[0]),g.shift(),g.push(e[1]),cm(b,f,g);return b.join("")}function cg(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=[ci(cl,g),",",ci(cl,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),cm(b,g,h);return b.join("")}function ch(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 ce(a)}function ci(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function cm(a,b,c){a.push("C",ci(cj,b),",",ci(cj,c),",",ci(ck,b),",",ci(ck,c),",",ci(cl,b),",",ci(cl,c))}function cn(a,b){return(b[1]-a[1])/(b[0]-a[0])}function co(a){var b=0,c=a.length-1,d=[],e=a[0],f=a[1],g=d[0]=cn(e,f);while(++b<c)d[b]=g+(g=cn(e=f,f=a[b+1]));return d[b]=g,d}function cp(a){var b=[],c,d,e,f,g=co(a),h=-1,i=a.length-1;while(++h<i)c=cn(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 cq(a){return a.length<3?bY(a):a[0]+cc(a,cp(a))}function cr(a){var b,c=-1,d=a.length,e,f;while(++c<d)b=a[c],e=b[0],f=b[1]+bN,b[0]=e*Math.cos(f),b[1]=e*Math.sin(f);return a}function cs(a){function i(f){if(f.length<1)return null;var i=bU(this,f,b,d),j=bU(this,f,b===c?ct(i):c,d===e?cu(i):e);return"M"+g(a(j),h)+"L"+g(a(i.reverse()),h)+"Z"}var b=bV,c=bV,d=0,e=bW,f="linear",g=bX[f],h=.7;return i.x=function(a){return arguments.length?(b=c=a,i):c},i.x0=function(a){return arguments.length?(b=a,i):b},i.x1=function(a){return arguments.length?(c=a,i):c},i.y=function(a){return arguments.length?(d=e=a,i):e},i.y0=function(a){return arguments.length?(d=a,i):d},i.y1=function(a){return arguments.length?(e=a,i):e},i.interpolate=function(a){return arguments.length?(g=bX[f=a],i):f},i.tension=function(a){return arguments.length?(h=a,i):h},i}function ct(a){return function(b,c){return a[c][0]}}function cu(a){return function(b,c){return a[c][1]}}function cv(a){return a.source}function cw(a){return a.target}function cx(a){return a.radius}function cy(a){return a.startAngle}function cz(a){return a.endAngle}function cA(a){return[a.x,a.y]}function cB(a){return function(){var b=a.apply(this,arguments),c=b[0],d=b[1]+bN;return[c*Math.cos(d),c*Math.sin(d)]}}function cD(a,b){var c=(a.ownerSVGElement||a).createSVGPoint();if(cC<0&&(window.scrollX||window.scrollY)){var d=d3.select(document.body).append("svg:svg").style("position","absolute").style("top",0).style("left",0),e=d[0][0].getScreenCTM();cC=!e.f&&!e.e,d.remove()}return cC?(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 cE(){return 64}function cF(){return"circle"}function cJ(a,b){a.attr("transform",function(a){return"translate("+b(a)+",0)"})}function cK(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function cL(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 cS(a){var b=d3.event,c=cN.parentNode,d=0,e=0;c&&(c=cT(c),d=c[0]-cP[0],e=c[1]-cP[1],cP=c,cQ|=d|e);try{d3.event={dx:d,dy:e},cM[a].dispatch.apply(cN,cO)}finally{d3.event=b}b.preventDefault()}function cT(a){return d3.event.touches?d3.svg.touches(a)[0]:d3.svg.mouse(a)}function cU(){if(!cN)return;var a=cN.parentNode;if(!a)return cV();cS("drag"),cX()}function cV(){if(!cN)return;cS("dragend"),cN=null,cQ&&(cR=!0,cX())}function cW(){cR&&(cX(),cR=!1)}function cX(){d3.event.stopPropagation(),d3.event.preventDefault()}function dh(a){return[a[0]-db[0],a[1]-db[1],db[2]]}function di(){cY||(cY=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{cY.scrollTop=1e3,cY.dispatchEvent(a),b=1e3-cY.scrollTop}catch(c){b=a.wheelDelta||-a.detail*5}return b*.005}function dj(){var a=d3.svg.touches(dd),b=-1,c=a.length,d;while(++b<c)c_[(d=a[b]).identifier]=dh(d);return a}function dk(){var a=d3.svg.touches(dd);switch(a.length){case 1:var b=a[0];dp(db[2],b,c_[b.identifier]);break;case 2:var c=a[0],d=a[1],e=[(c[0]+d[0])/2,(c[1]+d[1])/2],f=c_[c.identifier],g=c_[d.identifier],h=[(f[0]+g[0])/2,(f[1]+g[1])/2,f[2]];dp(Math.log(d3.event.scale)/Math.LN2+f[2],e,h)}}function dl(){c$=null,cZ&&(df=!0,dp(db[2],d3.svg.mouse(dd),cZ))}function dm(){cZ&&(df&&(dg=!0),dl(),cZ=null)}function dn(){dg&&(d3.event.stopPropagation(),d3.event.preventDefault(),dg=!1)}function dp(a,b,c){function i(a,b){var c=a.__domain||(a.__domain=a.domain()),d=a.range().map(function(a){return(a-b)/h});a.domain(c).domain(d.map(a.invert))}var d=Math.pow(2,(db[2]=a)-c[2]),e=db[0]=b[0]-d*c[0],f=db[1]=b[1]-d*c[1],g=d3.event,h=Math.pow(2,a);d3.event={scale:h,translate:[e,f],transform:function(a,b){a&&i(a,e),b&&i(b,f)}};try{dc.apply(dd,de)}finally{d3.event=g}g.preventDefault()}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.1.1"};var d=[].__proto__?function(a,b){a.__proto__=b}:function(a,b){for(var c in b)a[c]=b[c]};d3.functor=function(a){return typeof a=="function"?a:function(){return a}},d3.rebind=function(a,b){return function(){var c=b.apply(a,arguments);return arguments.length?a:c}},d3.ascending=function(a,b){return a<b?-1:a>b?1:a>=b?0:NaN},d3.descending=function(a,b){return b<a?-1:b>a?1:b>=a?0:NaN},d3.min=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&e>f&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&e>f&&(e=f)}return e},d3.max=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&f>e&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&f>e&&(e=f)}return e},d3.sum=function(a,b){var c=0,d=a.length,e,f=-1;if(arguments.length===1)while(++f<d)isNaN(e=+a[f])||(c+=e);else while(++f<d)isNaN(e=+b.call(a,a[f],f))||(c+=e);return c},d3.quantile=function(a,b){var c=(a.length-1)*b+1,d=Math.floor(c),e=a[d-1],f=c-d;return f?e+f*(a[d]-e):e},d3.zip=function(){if(!(e=arguments.length))return[];for(var a=-1,b=d3.min(arguments,f),c=new Array(b);++a<b;)for(var d=-1,e,g=c[a]=new Array(e);++d<e;)g[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,h=a.length;arguments.length<2&&(b=g);while(++f<h)b.call(d,e=a[f],f)?d=[]:(d.length||c.push(d),d.push(e));return c},d3.range=function(a,b,c){arguments.length<3&&(c=1,arguments.length<2&&(b=a,a=0));if((b-a)/c==Infinity)throw new Error("infinite range");var d=[],e=-1,f;if(c<0)while((f=a+c*++e)>b)d.push(f);else while((f=a+c*++e)<b)d.push(f);return d},d3.requote=function(a){return a.replace(i,"\\$&")};var i=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;d3.round=function(a,b){return b?Math.round(a*Math.pow(10,b))*Math.pow(10,-b):Math.round(a)},d3.xhr=function(a,b,c){var d=new XMLHttpRequest;arguments.length<3?c=b:b&&d.overrideMimeType&&d.overrideMimeType(b),d.open("GET",a,!0),d.onreadystatechange=function(){d.readyState===4&&c(d.status<300?d:null)},d.send(null)},d3.text=function(a,b,c){function d(a){c(a&&a.responseText)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.json=function(a,b){d3.text(a,"application/json",function(a){b(a?JSON.parse(a):null)})},d3.html=function(a,b){d3.text(a,"text/html",function(a){if(a!=null){var c=document.createRange();c.selectNode(document.body),a=c.createContextualFragment(a)}b(a)})},d3.xml=function(a,b,c){function d(a){c(a&&a.responseXML)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.ns={prefix:{svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},qualify:function(a){var b=a.indexOf(":");return b<0?a:{space:d3.ns.prefix[a.substring(0,b)],local:a.substring(b+1)}}},d3.dispatch=function(a){var b={},c;for(var d=0,e=arguments.length;d<e;d++)c=arguments[d],b[c]=j(c);return b},d3.format=function(a){var b=k.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,o=!1;h&&(h=h.substring(1)),e&&(c="0",g&&(f-=Math.floor((f-1)/4)));switch(i){case"n":g=!0,i="g";break;case"%":j=!0,i="f";break;case"p":j=!0,i="r";break;case"d":o=!0,h="0"}return i=l[i]||m,function(a){var b=j?a*100:+a,k=b<0&&(b=-b)?"−":d;if(o&&b%1)return"";a=i(b,h);if(e){var l=a.length+k.length;l<f&&(a=(new Array(f-l+1)).join(c)+a),g&&(a=n(a)),a=k+a}else{g&&(a=n(a)),a=k+a;var l=a.length;l<f&&(a=(new Array(f-l+1)).join(c)+a)}return j&&(a+="%"),a}};var k=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,l={g:function(a,b){return a.toPrecision(b)},e:function(a,b){return a.toExponential(b)},f:function(a,b){return a.toFixed(b)},r:function(a,b){var c=1+Math.floor(1e-15+Math.log(a)/Math.LN10);return d3.round(a,b-c).toFixed(Math.max(0,Math.min(20,b-c)))}},o=v(2),p=v(3),q={linear:function(){return u},poly:v,quad:function(){return o},cubic:function(){return p},sin:function(){return w},exp:function(){return x},circle:function(){return y},elastic:z,back:A,bounce:function(){return B}},r={"in":function(a){return a},out:s,"in-out":t,"out-in":function(a){return t(s(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 r[d](q[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;C.lastIndex=0;for(d=0;c=C.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=C.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=C.exec(a))&&d<j;++d){k=i[d];if(k.x==c[0]){if(k.i)if(h[k.i+1]==null){h[k.i-1]+=k.x,h.splice(k.i,1);for(e=d+1;e<j;++e)i[e].i--}else{h[k.i-1]+=k.x+h[k.i+1],h.splice(k.i,2);for(e=d+1;e<j;++e)i[e].i-=2}else if(h[k.i+1]==null)h[k.i]=k.x;else{h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1);for(e=d+1;e<j;++e)i[e].i--}i.splice(d,1),j--,d--}else k.x=d3.interpolateNumber(parseFloat(c[0]),parseFloat(k.x))}while(d<j)k=i.pop(),h[k.i+1]==null?h[k.i]=k.x:(h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1)),j--;return h.length===1?h[0]==null?i[0].x:function(){return b}:function(a){for(d=0;d<j;++d)h[(k=i[d]).i]=k.x(a);return h.join("")}},d3.interpolateRgb=function(a,b){a=d3.rgb(a),b=d3.rgb(b);var c=a.r,d=a.g,e=a.b,f=b.r-c,g=b.g-d,h=b.b-e;return function(a){return"rgb("+Math.round(c+f*a)+","+Math.round(d+g*a)+","+Math.round(e+h*a)+")"}},d3.interpolateHsl=function(a,b){a=d3.hsl(a),b=d3.hsl(b);var c=a.h,d=a.s,e=a.l,f=b.h-c,g=b.s-d,h=b.l-e;return function(a){return R(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]=E(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 C=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,D={background:1,fill:1,stroke:1};d3.interpolators=[d3.interpolateObject,function(a,b){return b instanceof Array&&d3.interpolateArray(a,b)},function(a,b){return typeof b=="string"&&d3.interpolateString(String(a),b)},function(a,b){return(typeof b=="string"?b in N||/^(#|rgb\(|hsl\()/.test(b):b instanceof I||b instanceof Q)&&d3.interpolateRgb(String(a),b)},function(a,b){return typeof b=="number"&&d3.interpolateNumber(+a,b)}],d3.rgb=function(a,b,c){return arguments.length===1?K(""+a,H,R):H(~~a,~~b,~~c)},I.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?H(e,e,e):(b&&b<e&&(b=e),c&&c<e&&(c=e),d&&d<e&&(d=e),H(Math.min(255,Math.floor(b/a)),Math.min(255,Math.floor(c/a)),Math.min(255,Math.floor(d/a))))},I.prototype.darker=function(a){return a=Math.pow(.7,arguments.length?a:1),H(Math.max(0,Math.floor(a*this.r)),Math.max(0,Math.floor(a*this.g)),Math.max(0,Math.floor(a*this.b)))},I.prototype.hsl=function(){return L(this.r,this.g,this.b)},I.prototype.toString=function(){return"#"+J(this.r)+J(this.g)+J(this.b)};var N={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 O in N)N[O]=K(N[O],H,R);d3.hsl=function(a,b,c){return arguments.length===1?K(""+a,L,P):P(+a,+b,+c)},Q.prototype.brighter=function(a){return a=Math.pow(.7,arguments.length?a:1),P(this.h,this.s,this.l/a)},Q.prototype.darker=function(a){return a=Math.pow(.7,arguments.length?a:1),P(this.h,this.s,a*this.l)},Q.prototype.rgb=function(){return R(this.h,this.s,this.l)},Q.prototype.toString=function(){return"hsl("+this.h+","+this.s*100+"%,"+this.l*100+"%)"};var T=function(a,b){return b.querySelector(a)},U=function(a,b){return b.querySelectorAll(a)};typeof Sizzle=="function"&&(T=function(a,b){return Sizzle(a,b)[0]},U=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))});var V=[];d3.selection=function(){return ba},d3.selection.prototype=V,V.select=function(a){var b=[],c,d,e,f;typeof a!="function"&&(a=W(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 S(b)},V.selectAll=function(a){var b=[],c,d;typeof a!="function"&&(a=X(a));for(var e=-1,f=this.length;++e<f;)for(var g=this[e],h=-1,i=g.length;++h<i;)if(d=g[h])b.push(c=a.call(d,d.__data__,h)),c.parentNode=d;return S(b)},V.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)},V.classed=function(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=h(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=h(e.replace(c," ")),d?b.baseVal=e:this.className=e}function i(){(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"?i:b?f:g)},V.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 <add>,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)},V.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)},V.text=function(a){return arguments.length<1?this.node().textContent:this.each(typeof a=="function"?function(){this.textContent=a.apply(this,arguments)}:function(){this.textContent=a})},V.html=function(a){return arguments.length<1?this.node().innerHTML:this.each(typeof a=="function"?function(){this.innerHTML=a.apply(this,arguments)}:function(){this.innerHTML=a})},V.append=function(a){function b(){return this.appendChild(document.createElement(a))}function c(){return this.appendChild(document.createElementNS(a.space,a.local))}return a=d3.ns.qualify(a),this.select(a.local?c:b)},V.insert=function(a,b){function c(){return this.insertBefore(document.createElement(a),T(b,this))}function d(){return this.insertBefore(document.createElementNS(a.space,a.local),T(b,this))}return a=d3.ns.qualify(a),this.select(a.local?d:c)},V.remove=function(){return this.each(function(){var a=this.parentNode;a&&a.removeChild(this)})},V.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]=Y(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]=Y(p),l[g]=n[g]=null);for(;g<i;++g)m[g]=Y(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=S(d);return j.enter=function(){return Z(c)},j.exit=function(){return S(e)},j};var $=[];$.append=V.append,$.insert=V.insert,$.empty=V.empty,$.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 S(b)},V.filter=function(a){var b=[],c,d,e;for(var f=0,g=this.length;f<g;f++){b.push(c=[]),c.parentNode=(d=this[f]).parentNode;for(var h=0,i=d.length;h<i;h++)(e=d[h])&&a.call(e,e.__data__,h)&&c.push(e)}return S(b)},V.map=function(a){return this.each(function(){this.__data__=a.apply(this,arguments)})},V.sort=function(a){a=_.apply(this,arguments);for(var b=0,c=this.length;b<c;b++)for(var d=this[b].sort(a),e=1,f=d.length,g=d[0];e<f;e++){var h=d[e];h&&(g&&g.parentNode.insertBefore(h,g.nextSibling),g=h)}return this},V.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})},V.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},V.call=function(a){return a.apply(this,(arguments[0]=this,arguments)),this},V.empty=function(){return!this.node()},V.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},V.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 bb(a,bf||++be)};var ba=S([[document]]);ba[0].parentNode=document.documentElement,d3.select=function(a){return typeof a=="string"?ba.select(a):S([[a]])},d3.selectAll=function(a){return typeof a=="string"?ba.selectAll(a):S([a])};var bd=[],be=0,bf=0,bg=d3.ease("cubic-in-out");bd.call=V.call,d3.transition=function(){return ba.transition()},d3.transition.prototype=bd,bd.select=function(a){var b=[],c,d,e;typeof a!="function"&&(a=W(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 bb(b,this.id).ease(this.ease())},bd.selectAll=function(a){var b=[],c,d;typeof a!="function"&&(a=X(a));for(var e=-1,f=this.length;++e<f;)for(var g=this[e],h=-1,i=g.length;++h<i;)if(d=g[h]){b.push(c=a.call(d.node,d.node.__data__,h));for(var j=-1,k=c.length;++j<k;)c[j]={node:c[j],delay:d.delay,duration:d.duration}}return bb(b,this.id).ease(this.ease())},bd.attr=function(a,b){return this.attrTween(a,bc(b))},bd.attrTween=function(a,b){function c(c,d){var e=b.call(this,c,d,this.getAttribute(a));return e&&function(b){this.setAttribute(a,e(b))}}function d(c,d){var e=b.call(this,c,d,this.getAttributeNS(a.space,a.local));return e&&function(b){this.setAttributeNS(a.space,a.local,e(b))}}return a=d3.ns.qualify(a),this.tween("attr."+a,a.local?d:c)},bd.style=function(a,b,c){return arguments.length<3&&(c=""),this.styleTween(a,bc(b),c)},bd.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&&function(b){this.style.setProperty(a,f(b),c)}})},bd.text=function(a){return this.tween("text",function(b,c){this.textContent=typeof a=="function"?a.call(this,b,c):a})},bd.remove=function(){return this.each("end",function(){var a;!this.__transition__&&(a=this.parentNode)&&a.removeChild(this)})},bd.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}))},bd.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}))},bd.transition=function(){return this.select(e)};var bi=null,bj,bk;d3.timer=function(a,b,c){var d=!1,e,f=bi;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||(bi={callback:a,then:c,delay:b,next:bi}),bj||(bk=clearTimeout(bk),bj=1,bn(bl))},d3.timer.flush=function(){var a,b=Date.now(),c=bi;while(c)a=b-c.then,c.delay||(c.flush=c.callback(a)),c=c.next;bm()};var bn=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.scale={},d3.scale.linear=function(){return bs([0,1],[0,1],d3.interpolate,!1)},d3.scale.log=function(){return bA(d3.scale.linear(),bB)},bB.pow=function(a){return Math.pow(10,a)},bC.pow=function(a){return-Math.pow(10,-a)},d3.scale.pow=function(){return bE(d3.scale.linear(),1)},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){return bG([],{t:"range",x:[]})},d3.scale.category10=function(){return d3.scale.ordinal().range(bH)},d3.scale.category20=function(){return d3.scale.ordinal().range(bI)},d3.scale.category20b=function(){return d3.scale.ordinal().range(bJ)},d3.scale.category20c=function(){return d3.scale.ordinal().range(bK)};var bH=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],bI=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],bJ=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],bK=["#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 bL([],[])},d3.scale.quantize=function(){return bM(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)+bN,h=d.apply(this,arguments)+bN,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>=bO?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=bP,b=bQ,c=bR,d=bS;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+bN;return[Math.cos(f)*e,Math.sin(f)*e]},e};var bN=-Math.PI/2,bO=2*Math.PI-1e-6;d3.svg.line=function(){return bT(Object)};var bX={linear:bY,"step-before":bZ,"step-after":b$,basis:ce,"basis-open":cf,"basis-closed":cg,bundle:ch,cardinal:cb,"cardinal-open":b_,"cardinal-closed":ca,monotone:cq},cj=[0,2/3,1/3,0],ck=[0,1/3,2/3,0],cl=[0,1/6,2/3,1/6];d3.svg.line.radial=function(){var a=bT(cr);return a.radius=a.x,delete a.x,a.angle=a.y,delete a.y,a},d3.svg.area=function(){return cs(Object)},d3.svg.area.radial=function(){var a=cs(cr);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)+(h(e,f)?j(e.r,e.p1,e.r,e.p0):j(e.r,e.p1,f.r,f.p0)+i(f.r,f.p1)+j(f.r,f.p1,e.r,e.p0))+"Z"}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)+bN,k=e.call(a,h,g)+bN;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){return"A"+a+","+a+" 0 0,1 "+b}function j(a,b,c,d){return"Q 0,0 "+d}var a=cv,b=cw,c=cx,d=bR,e=bS;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=cv,b=cw,c=cA;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=cA,c=a.projection;return a.projection=function(a){return arguments.length?c(cB(b=a)):b},a},d3.svg.mouse=function(a){return cD(a,d3.event)};var cC=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.touches=function(a){var b=d3.event.touches;return b?Array.prototype.map.call(b,function(b){var c=cD(a,b);return c.identifier=b.identifier,c}):[]},d3.svg.symbol=function(){function c(c,d){return(cG[a.call(this,c,d)]||cG.circle)(b.call(this,c,d))}var a=cF,b=cE;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 cG={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*cI)),c=b*cI;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/cH),c=b*cH/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.sqrt(a/cH),c=b*cH/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}};d3.svg.symbolTypes=d3.keys(cG);var cH=Math.sqrt(3),cI=Math.tan(30*Math.PI/180);d3.svg.axis=function(){function j(j){j.each(function(k,l,m){function F(a){return j.delay?a.transition().delay(j[m][l].delay).duration(j[m][l].duration).ease(j.ease()):a}var n=d3.select(this),o=a.ticks.apply(a,g),p=h==null?a.tickFormat.apply(a,g):h,q=cL(a,o,i),r=n.selectAll(".minor").data(q,String),s=r.enter().insert("svg:line","g").attr("class","tick minor").style("opacity",1e-6),t=F(r.exit()).style("opacity",1e-6).remove(),u=F(r).style("opacity",1),v=n.selectAll("g").data(o,String),w=v.enter().insert("svg:g","path").style("opacity",1e-6),x=F(v.exit()).style("opacity",1e-6).remove(),y=F(v).style("opacity",1),z,A=bp(a.range()),B=n.selectAll(".domain").data([]),C=B.enter().append("svg:path").attr("class","domain"),D=F(B),E=this.__chart__||a;this.__chart__=a.copy(),w.append("svg:line").attr("class","tick"),w.append("svg:text"),y.select("text").text(p);switch(b){case"bottom":z=cJ,u.attr("y2",d),w.select("text").attr("dy",".71em").attr("text-anchor","middle"),y.select("line").attr("y2",c),y.select("text").attr("y",Math.max(c,0)+f),D.attr("d","M"+A[0]+","+e+"V0H"+A[1]+"V"+e);break;case"top":z=cJ,u.attr("y2",-d),w.select("text").attr("text-anchor","middle"),y.select("line").attr("y2",-c),y.select("text").attr("y",-(Math.max(c,0)+f)),D.attr("d","M"+A[0]+","+ -e+"V0H"+A[1]+"V"+ -e);break;case"left":z=cK,u.attr("x2",-d),w.select("text").attr("dy",".32em").attr("text-anchor","end"),y.select("line").attr("x2",-c),y.select("text").attr("x",-(Math.max(c,0)+f)),D.attr("d","M"+ -e+","+A[0]+"H0V"+A[1]+"H"+ -e);break;case"right":z=cK,u.attr("x2",d),w.select("text").attr("dy",".32em"),y.select("line").attr("x2",c),y.select("text").attr("x",Math.max(c,0)+f),D.attr("d","M"+e+","+A[0]+"H0V"+A[1]+"H"+e)}w.call(z,E),y.call(z,a),x.call(z,a),s.call(z,E),u.call(z,a),t.call(z,a)})}var a=d3.scale.linear(),b="bottom",c=6,d=6,e=6,f=3,g=[10],h,i=0;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.behavior={},d3.behavior.drag=function(){function b(){this.on("mousedown.drag",d).on("touchstart.drag",d),d3.select(window).on("mousemove.drag",cU).on("touchmove.drag",cU).on("mouseup.drag",cV,!0).on("touchend.drag",cV,!0).on("click.drag",cW,!0)}function c(){cM=a,cP=cT((cN=this).parentNode),cQ=0,cO=arguments}function d(){c.apply(this,arguments),cS("dragstart")}var a=d3.dispatch("drag","dragstart","dragend");return b.on=function(c,d){return a[c].add(d),b},b};var cM,cN,cO,cP,cQ,cR;d3.behavior.zoom=function(){function c(){this.on("mousedown.zoom",e).on("mousewheel.zoom",f).on("DOMMouseScroll.zoom",f).on("dblclick.zoom",g).on("touchstart.zoom",h),d3.select(window).on("mousemove.zoom",dl).on("mouseup.zoom",dm).on("touchmove.zoom",dk).on("touchend.zoom",dj).on("click.zoom",dn,!0)}function d(){db=a,dc=b.zoom.dispatch,dd=this,de=arguments}function e(){d.apply(this,arguments),cZ=dh(d3.svg.mouse(dd)),df=!1,d3.event.preventDefault(),window.focus()}function f(){d.apply(this,arguments),c$||(c$=dh(d3.svg.mouse(dd))),dp(di()+a[2],d3.svg.mouse(dd),c$)}function g(){d.apply(this,arguments);var b=d3.svg.mouse(dd);dp(d3.event.shiftKey?Math.ceil(a[2]-1):Math.floor(a[2]+1),b,dh(b))}function h(){d.apply(this,arguments);var b=dj(),c,e=Date.now();b.length===1&&e-da<300&&dp(1+Math.floor(a[2]),c=b[0],c_[c.identifier]),da=e}var a=[0,0,0],b=d3.dispatch("zoom");return c.on=function(a,d){return b[a].add(d),c},c};var cY,cZ,c$,c_={},da=0,db,dc,dd,de,df,dg})() <ide>\ No newline at end of file <ide><path>src/svg/arc.js <ide> d3.svg.arc = function() { <ide> + "A" + r1 + "," + r1 + " 0 1,1 0," + (-r1) <ide> + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 <ide> + "M0," + r0 <del> + "A" + r0 + "," + r0 + " 0 1,1 0," + (-r0) <del> + "A" + r0 + "," + r0 + " 0 1,1 0," + r0 <add> + "A" + r0 + "," + r0 + " 0 1,0 0," + (-r0) <add> + "A" + r0 + "," + r0 + " 0 1,0 0," + r0 <ide> + "Z" <ide> : "M0," + r1 <ide> + "A" + r1 + "," + r1 + " 0 1,1 0," + (-r1) <ide><path>test/svg/arc-test.js <ide> suite.addBatch({ <ide> }, <ide> "draws an annulus when inner radius is non-zero and angle is approximately 2π": function(arc) { <ide> var a = arc().innerRadius(100).outerRadius(200); <del> assert.pathEqual(a.startAngle(0).endAngle(2 * Math.PI - 1e-9)(), "M0,200A200,200 0 1,1 0,-200A200,200 0 1,1 0,200M0,100A100,100 0 1,1 0,-100A100,100 0 1,1 0,100Z"); <del> assert.pathEqual(a.startAngle(Math.PI + 1e-9).endAngle(3 * Math.PI - 1e-9)(), "M0,200A200,200 0 1,1 0,-200A200,200 0 1,1 0,200M0,100A100,100 0 1,1 0,-100A100,100 0 1,1 0,100Z"); <add> assert.pathEqual(a.startAngle(0).endAngle(2 * Math.PI - 1e-9)(), "M0,200A200,200 0 1,1 0,-200A200,200 0 1,1 0,200M0,100A100,100 0 1,0 0,-100A100,100 0 1,0 0,100Z"); <add> assert.pathEqual(a.startAngle(Math.PI + 1e-9).endAngle(3 * Math.PI - 1e-9)(), "M0,200A200,200 0 1,1 0,-200A200,200 0 1,1 0,200M0,100A100,100 0 1,0 0,-100A100,100 0 1,0 0,100Z"); <ide> }, <ide> "draws an annulus when inner radius is non-zero and angle is greater than 2π": function(arc) { <ide> var a = arc().innerRadius(100).outerRadius(200); <del> assert.pathEqual(a.startAngle(0).endAngle(7)(), "M0,200A200,200 0 1,1 0,-200A200,200 0 1,1 0,200M0,100A100,100 0 1,1 0,-100A100,100 0 1,1 0,100Z"); <del> assert.pathEqual(a.startAngle(-1).endAngle(6)(), "M0,200A200,200 0 1,1 0,-200A200,200 0 1,1 0,200M0,100A100,100 0 1,1 0,-100A100,100 0 1,1 0,100Z"); <add> assert.pathEqual(a.startAngle(0).endAngle(7)(), "M0,200A200,200 0 1,1 0,-200A200,200 0 1,1 0,200M0,100A100,100 0 1,0 0,-100A100,100 0 1,0 0,100Z"); <add> assert.pathEqual(a.startAngle(-1).endAngle(6)(), "M0,200A200,200 0 1,1 0,-200A200,200 0 1,1 0,200M0,100A100,100 0 1,0 0,-100A100,100 0 1,0 0,100Z"); <ide> }, <ide> "draws an annular sector when both radii are non-zero and angle is less than 2π": function(arc) { <ide> var a = arc().innerRadius(100).outerRadius(200);
4
Mixed
Text
add edgetpu deeplab
34a3581c0e09c293cd67b5ac2d64e8bc753cefce
<ide><path>research/deeplab/README.md <ide> under tensorflow/models. Please refer to the LICENSE for details. <ide> <ide> ## Change Logs <ide> <add>### March 26, 2020 <add>* Supported EdgeTPU-DeepLab and EdgeTPU-DeepLab-slim on Cityscapes. <add>**Contributor**: Yun Long. <add> <ide> ### November 20, 2019 <ide> * Supported MobileNetV3 large and small model variants on Cityscapes. <ide> **Contributor**: Yukun Zhu. <ide> and Cityscapes. <ide> Chenxi Liu, Barret Zoph, Maxim Neumann, Jonathon Shlens, Wei Hua, Li-Jia Li, Li Fei-Fei, Alan Yuille, Jonathan Huang, Kevin Murphy. <br /> <ide> [[link]](https://arxiv.org/abs/1712.00559). In ECCV, 2018. <ide> <del>16 **Searching for MobileNetV3**<br /> <add>16. **Searching for MobileNetV3**<br /> <ide> Andrew Howard, Mark Sandler, Grace Chu, Liang-Chieh Chen, Bo Chen, Mingxing Tan, Weijun Wang, Yukun Zhu, Ruoming Pang, Vijay Vasudevan, Quoc V. Le, Hartwig Adam. <br /> <ide> [[link]](https://arxiv.org/abs/1905.02244). In ICCV, 2019. <ide><path>research/deeplab/core/feature_extractor.py <ide> import copy <ide> import functools <ide> <del>import tensorflow as tf <add>import tensorflow.compat.v1 as tf <ide> from tensorflow.contrib import slim as contrib_slim <ide> <ide> from deeplab.core import nas_network <ide> <ide> slim = contrib_slim <ide> <del># Default end point for MobileNetv2. <add># Default end point for MobileNetv2 (one-based indexing). <ide> _MOBILENET_V2_FINAL_ENDPOINT = 'layer_18' <add># Default end point for MobileNetv3. <ide> _MOBILENET_V3_LARGE_FINAL_ENDPOINT = 'layer_17' <ide> _MOBILENET_V3_SMALL_FINAL_ENDPOINT = 'layer_13' <add># Default end point for EdgeTPU Mobilenet. <add>_MOBILENET_EDGETPU = 'layer_24' <ide> <ide> <ide> def _mobilenet_v2(net, <ide> def mobilenet_v3_large_seg(net, <ide> final_endpoint=_MOBILENET_V3_LARGE_FINAL_ENDPOINT) <ide> <ide> <add>def mobilenet_edgetpu(net, <add> depth_multiplier, <add> output_stride, <add> divisible_by=None, <add> reuse=None, <add> scope=None, <add> final_endpoint=None): <add> """EdgeTPU version of mobilenet model for segmentation task.""" <add> del divisible_by <add> del final_endpoint <add> conv_defs = copy.deepcopy(mobilenet_v3.V3_EDGETPU) <add> <add> return _mobilenet_v3( <add> net, <add> depth_multiplier=depth_multiplier, <add> output_stride=output_stride, <add> divisible_by=8, <add> conv_defs=conv_defs, <add> reuse=reuse, <add> scope=scope, # the scope is 'MobilenetEdgeTPU' <add> final_endpoint=_MOBILENET_EDGETPU) <add> <add> <ide> def mobilenet_v3_small_seg(net, <ide> depth_multiplier, <ide> output_stride, <ide> def mobilenet_v3_small_seg(net, <ide> # A map from network name to network function. <ide> networks_map = { <ide> 'mobilenet_v2': _mobilenet_v2, <add> 'mobilenet_edgetpu': mobilenet_edgetpu, <ide> 'mobilenet_v3_large_seg': mobilenet_v3_large_seg, <ide> 'mobilenet_v3_small_seg': mobilenet_v3_small_seg, <ide> 'resnet_v1_18': resnet_v1_beta.resnet_v1_18, <ide> def mobilenet_v2_arg_scope(is_training=True, <ide> # A map from network name to network arg scope. <ide> arg_scopes_map = { <ide> 'mobilenet_v2': mobilenet_v2.training_scope, <add> 'mobilenet_edgetpu': mobilenet_v2_arg_scope, <ide> 'mobilenet_v3_large_seg': mobilenet_v2_arg_scope, <ide> 'mobilenet_v3_small_seg': mobilenet_v2_arg_scope, <ide> 'resnet_v1_18': resnet_v1_beta.resnet_arg_scope, <ide> def mobilenet_v2_arg_scope(is_training=True, <ide> # ImageNet pretrained versions of these models. <ide> name_scope = { <ide> 'mobilenet_v2': 'MobilenetV2', <add> 'mobilenet_edgetpu': 'MobilenetEdgeTPU', <ide> 'mobilenet_v3_large_seg': 'MobilenetV3', <ide> 'mobilenet_v3_small_seg': 'MobilenetV3', <ide> 'resnet_v1_18': 'resnet_v1_18', <ide> def _preprocess_zero_mean_unit_range(inputs, dtype=tf.float32): <ide> <ide> _PREPROCESS_FN = { <ide> 'mobilenet_v2': _preprocess_zero_mean_unit_range, <add> 'mobilenet_edgetpu': _preprocess_zero_mean_unit_range, <ide> 'mobilenet_v3_large_seg': _preprocess_zero_mean_unit_range, <ide> 'mobilenet_v3_small_seg': _preprocess_zero_mean_unit_range, <ide> 'resnet_v1_18': _preprocess_subtract_imagenet_mean, <ide><path>research/deeplab/g3doc/model_zoo.md <ide> xception71_dpc_cityscapes_trainval | Xception_71 | ImageNet <br> MS <ide> <ide> In the table, **OS** denotes output stride. <ide> <add>Note for mobilenet v3 models, we use additional commandline flags as follows: <add> <add>``` <add>--model_variant={ mobilenet_v3_large_seg | mobilenet_v3_small_seg } <add>--image_pooling_crop_size=769,769 <add>--image_pooling_stride=4,5 <add>--add_image_level_feature=1 <add>--aspp_convs_filters=128 <add>--aspp_with_concat_projection=0 <add>--aspp_with_squeeze_and_excitation=1 <add>--decoder_use_sum_merge=1 <add>--decoder_filters=19 <add>--decoder_output_is_logits=1 <add>--image_se_uses_qsigmoid=1 <add>--decoder_output_stride=8 <add>--output_stride=32 <add>``` <add> <ide> Checkpoint name | Eval OS | Eval scales | Left-right Flip | Multiply-Adds | Runtime (sec) | Cityscapes mIOU | File Size <ide> -------------------------------------------------------------------------------------------------------------------------------- | :-------: | :-------------------------: | :-------------: | :-------------------: | :------------: | :----------------------------: | :-------: <ide> [mobilenetv2_coco_cityscapes_trainfine](http://download.tensorflow.org/models/deeplabv3_mnv2_cityscapes_train_2018_02_05.tar.gz) | 16 <br> 8 | [1.0] <br> [0.75:0.25:1.25] | No <br> Yes | 21.27B <br> 433.24B | 0.8 <br> 51.12 | 70.71% (val) <br> 73.57% (val) | 23MB <ide> Checkpoint name <ide> [xception71_dpc_cityscapes_trainfine](http://download.tensorflow.org/models/deeplab_cityscapes_xception71_trainfine_2018_09_08.tar.gz) | 16 | [1.0] | No | 502.07B | - | 80.31% (val) | 445MB <ide> [xception71_dpc_cityscapes_trainval](http://download.tensorflow.org/models/deeplab_cityscapes_xception71_trainvalfine_2018_09_08.tar.gz) | 8 | [0.75:0.25:2] | Yes | - | - | 82.66% (**test**) | 446MB <ide> <del> <add>### EdgeTPU-DeepLab models on Cityscapes <add> <add>EdgeTPU is Google's machine learning accelerator architecture for edge devices <add>(exists in Coral devices and Pixel4's Neural Core). Leveraging nerual <add>architecture search (NAS, also named as Auto-ML) algorithms, <add>[EdgeTPU-Mobilenet](https://github.com/tensorflow/models/tree/master/research/slim/nets/mobilenet) <add>has been released which yields higher hardware utilization, lower latency, as <add>well as better accuracy over Mobilenet-v2/v3. We use EdgeTPU-Mobilenet as the <add>backbone and provide checkpoints that have been pretrained on Cityscapes <add>train_fine set. We named them as EdgeTPU-DeepLab models. <add> <add>Checkpoint name | Network backbone | Pretrained dataset | ASPP | Decoder <add>-------------------- | :----------------: | :----------------: | :--: | :-----: <add>EdgeTPU-DeepLab | EdgeMobilenet-1.0 | ImageNet | N/A | N/A <add>EdgeTPU-DeepLab-slim | EdgeMobilenet-0.75 | ImageNet | N/A | N/A <add> <add>For EdgeTPU-DeepLab-slim, the backbone feature extractor has depth multiplier = <add>0.75 and aspp_convs_filters = 128. We do not employ ASPP nor decoder modules to <add>further reduce the latency. We employ the same train/eval flags used for <add>MobileNet-v2 DeepLab model. Flags changed for EdgeTPU-DeepLab model are listed <add>here. <add> <add>``` <add>--decoder_output_stride='' <add>--aspp_convs_filters=256 <add>--model_variant=mobilenet_edgetpu <add>``` <add> <add>For EdgeTPU-DeepLab-slim, also include the following flags. <add> <add>``` <add>--depth_multiplier=0.75 <add>--aspp_convs_filters=128 <add>``` <add> <add>Checkpoint name | Eval OS | Eval scales | Cityscapes mIOU | Multiply-Adds | Simulator latency on Pixel 4 EdgeTPU <add>---------------------------------------------------------------------------------------------------- | :--------: | :---------: | :--------------------------: | :------------: | :----------------------------------: <add>[EdgeTPU-DeepLab](http://download.tensorflow.org/models/edgetpu-deeplab_2020_03_09.tar.gz) | 32 <br> 16 | [1.0] | 70.6% (val) <br> 74.1% (val) | 5.6B <br> 7.1B | 13.8 ms <br> 17.5 ms <add>[EdgeTPU-DeepLab-slim](http://download.tensorflow.org/models/edgetpu-deeplab-slim_2020_03_09.tar.gz) | 32 <br> 16 | [1.0] | 70.0% (val) <br> 73.2% (val) | 3.5B <br> 4.3B | 9.9 ms <br> 13.2 ms <ide> <ide> ## DeepLab models trained on ADE20K <ide>
3
Python
Python
add check response for put actions
5c26e61b311924418cafe4d73d478abc2a571796
<ide><path>libcloud/container/drivers/lxd.py <ide> def deploy_container(self, name, image, cluster=None, <ide> # return this container? <ide> <ide> if isinstance(image, ContainerImage): <del> return self._deploy_container_from_image(name=name, image=image, parameters=parameters) <add> container = self._deploy_container_from_image(name=name, image=image, parameters=parameters) <ide> elif image is not None: <ide> # assume that the image is a fingerprint <ide> image = self.get_image(fingerprint=image) <del> return self._deploy_container_from_image(name=name, image=image, parameters=parameters) <add> container = self._deploy_container_from_image(name=name, image=image, parameters=parameters) <add> else: <add> raise ValueError(" image parameter must either be a footprint or a ContainerImage") <add> <add> if start: <add> container.start() <add> return container <ide> <ide> def get_container(self, id): <ide> <ide> def _do_container_action(self, container, action, <ide> if action not in LXD_API_STATE_ACTIONS: <ide> raise ValueError("Invalid action specified") <ide> <del> if action == 'start' or action == 'restart': <del> force = False <add> #if action == 'start' or action == 'restart': <add> # force = False <ide> <ide> json = {"action":action, "timeout":timeout, "force":force} <ide> <ide> def _do_container_action(self, container, action, <ide> # in the response when stateful is True so remove it for now <ide> #"stateful":stateful, "force":force} <ide> <del> result = self.connection.request('/%s/containers/%s/state' % <add> response = self.connection.request('/%s/containers/%s/state' % <ide> (self.version, container.name), method='PUT', json=json) <ide> <add> response_dict = response.parse_body() <add> <add> # a background operation is expected to be returned status_code = 100 --> Operation created <add> assert_response(response_dict=response_dict, status_code=100) <add> <ide> return self.get_container(id=container.name) <ide> <ide> def _do_get_image(self, metadata):
1
Python
Python
remove builtins from __all__
9ce99dd8b682754ca0efe0cb2fc1dad9f03fb234
<ide><path>numpy/__init__.py <ide> <ide> # Make these accessible from numpy name-space <ide> # but not imported in from numpy import * <add> # TODO[gh-6103]: Deprecate these <ide> if sys.version_info[0] >= 3: <ide> from builtins import bool, int, float, complex, object, str <ide> unicode = str <ide> # now that numpy modules are imported, can initialize limits <ide> core.getlimits._register_known_types() <ide> <del> __all__.extend(['bool', 'int', 'float', 'complex', 'object', 'unicode', <del> 'str']) <ide> __all__.extend(['__version__', 'show_config']) <ide> __all__.extend(core.__all__) <ide> __all__.extend(_mat.__all__) <ide> __all__.extend(lib.__all__) <ide> __all__.extend(['linalg', 'fft', 'random', 'ctypeslib', 'ma']) <ide> <add> # These are added by `from .core import *` and `core.__all__`, but we <add> # overwrite them above with builtins we do _not_ want to export. <add> __all__.remove('long') <add> __all__.remove('unicode') <add> <ide> # Remove things that are in the numpy.lib but not in the numpy namespace <ide> # Note that there is a test (numpy/tests/test_public_api.py:test_numpy_namespace) <ide> # that prevents adding more things to the main namespace by accident.
1
Go
Go
remove unused withstdout(), withsterr() opts"
92eca900b086200b4f270cf438a8a5ff9c8c2a3b
<ide><path>testutil/registry/ops.go <ide> package registry <ide> <add>import "io" <add> <ide> // Schema1 sets the registry to serve v1 api <ide> func Schema1(c *Config) { <ide> c.schema1 = true <ide> func URL(registryURL string) func(*Config) { <ide> c.registryURL = registryURL <ide> } <ide> } <add> <add>// WithStdout sets the stdout of the registry command to the passed in writer. <add>func WithStdout(w io.Writer) func(c *Config) { <add> return func(c *Config) { <add> c.stdout = w <add> } <add>} <add> <add>// WithStderr sets the stdout of the registry command to the passed in writer. <add>func WithStderr(w io.Writer) func(c *Config) { <add> return func(c *Config) { <add> c.stderr = w <add> } <add>}
1
Javascript
Javascript
remove unnecessary assertion
85d6b783432e1c58084c3bdebf15cf45384f6572
<ide><path>test/simple/test-http-client-agent.js <ide> function request(i) { <ide> socket.on('close', function() { <ide> ++count; <ide> if (count < max) { <del> assert.equal(http.globalAgent.sockets[name].length, max - count); <ide> assert.equal(http.globalAgent.sockets[name].indexOf(socket), -1); <ide> } else { <ide> assert(!http.globalAgent.sockets.hasOwnProperty(name));
1
Javascript
Javascript
run focus test only if document has focus
33c80f3dd4334c9b490c6e7dc69ffbda2c6a7fcf
<ide><path>test/unit/event.js <ide> test( "make sure events cloned correctly", 18, function() { <ide> clone.find("#check1").trigger("change"); // 0 events should fire <ide> }); <ide> <del>asyncTest( "Check order of focusin/focusout events", 2, function() { <del> var focus, blur, <del> input = jQuery("#name"); <add>// This test fails in some browsers if document does not have focus <add>if ( !document.hasFocus || document.hasFocus && document.hasFocus() ) { <add> test( "Check order of focusin/focusout events", 2, function() { <add> var focus, blur, <add> input = jQuery( "#name" ); <ide> <del> input.on("focus", function() { <del> focus = true; <add> input.on( "focus", function() { <add> focus = true; <ide> <del> }).on("focusin", function() { <del> ok( !focus, "Focusin event should fire before focus does" ); <add> }).on( "focusin", function() { <add> ok( !focus, "Focusin event should fire before focus does" ); <ide> <del> }).on("blur", function() { <del> blur = true; <add> }).on( "blur", function() { <add> blur = true; <ide> <del> }).on("focusout", function() { <del> ok( !blur, "Focusout event should fire before blur does" ); <del> }); <add> }).on( "focusout", function() { <add> ok( !blur, "Focusout event should fire before blur does" ); <add> }); <ide> <del> // gain focus <del> input.trigger("focus"); <add> // gain focus <add> input.trigger( "focus" ); <ide> <del> // then lose it <del> jQuery("#search").trigger("focus"); <add> // then lose it <add> jQuery( "#search" ).trigger( "focus" ); <ide> <del> // cleanup <del> setTimeout(function() { <add> // cleanup <ide> input.off(); <del> start(); <del> }, 50 ); <del>}); <add> }); <add>} <ide> <ide> test( "String.prototype.namespace does not cause trigger() to throw (#13360)", function() { <ide> expect( 1 );
1
Javascript
Javascript
add jsdoc comments to pdfattachmentview
818b7fc3069ef02b48b60071bf53c9faabb690c0
<ide><path>web/pdf_attachment_view.js <ide> <ide> 'use strict'; <ide> <add>/** <add> * @typedef {Object} PDFAttachmentViewOptions <add> * @property {HTMLDivElement} container - The viewer element. <add> * @property {Array} attachments - An array of attachment objects. <add> * @property {DownloadManager} downloadManager - The download manager. <add> */ <add> <add>/** <add> * @class <add> */ <ide> var PDFAttachmentView = (function PDFAttachmentViewClosure() { <add> /** <add> * @constructs PDFAttachmentView <add> * @param {PDFAttachmentViewOptions} options <add> */ <ide> function PDFAttachmentView(options) { <ide> this.container = options.container; <ide> this.attachments = options.attachments; <ide> var PDFAttachmentView = (function PDFAttachmentViewClosure() { <ide> } <ide> }, <ide> <add> /** <add> * @private <add> */ <ide> _bindLink: function PDFAttachmentView_bindLink(button, item) { <ide> button.onclick = function downloadFile(e) { <ide> var content = item.content;
1
Text
Text
fix typos [ci-skip]
4ae7acf00dd28c07db016bb844f82a991f16a1a9
<ide><path>guides/source/action_cable_overview.md <ide> You can use `ActionCable.createConsumer()` to connect to the cable <ide> server if `action_cable_meta_tag` is invoked in the layout. Otherwise, A path is <ide> specified as first argument to `createConsumer` (e.g. `ActionCable.createConsumer("/websocket")`). <ide> <del>For every instance of your server, you create and for every worker your server <add>For every instance of your server you create, and for every worker your server <ide> spawns, you will also have a new instance of Action Cable, but the Redis or <ide> PostgreSQL adapter keeps messages synced across connections. <ide> <ide><path>guides/source/active_record_migrations.md <ide> class AddUserRefToProducts < ActiveRecord::Migration[7.1] <ide> end <ide> ``` <ide> <del>This migration will create a `user_id` column, [references](#references) are a <add>This migration will create a `user_id` column. [References](#references) are a <ide> shorthand for creating columns, indexes, foreign keys or even polymorphic <ide> association columns. <ide> <ide> If the `from_table` column name cannot be derived from the `to_table` name, <ide> you can use the `:column` option. Use the `:primary_key` option if the <ide> referenced primary key is not `:id`. <ide> <del>For example add a foreign key on `articles.reviewer` referencing `authors.email`: <add>For example, to add a foreign key on `articles.reviewer` referencing `authors.email`: <ide> <ide> ```ruby <ide> add_foreign_key :articles, :authors, column: :reviewer, primary_key: :email <ide><path>guides/source/active_support_core_extensions.md <ide> t.advance(seconds: 1) <ide> # => Sun Mar 28 03:00:00 +0200 2010 <ide> ``` <ide> <del>* If [`since`][Time#since] or [`ago`][Time#ago] jump to a time that can't be expressed with `Time` a `DateTime` object is returned instead. <add>* If [`since`][Time#since] or [`ago`][Time#ago] jumps to a time that can't be expressed with `Time` a `DateTime` object is returned instead. <ide> <ide> [Time#ago]: https://api.rubyonrails.org/classes/Time.html#method-i-ago <ide> [Time#change]: https://api.rubyonrails.org/classes/Time.html#method-i-change <ide><path>guides/source/api_app.md <ide> This will do three main things for you: <ide> If you want to take an existing application and make it an API one, read the <ide> following steps. <ide> <del>In `config/application.rb` add the following line at the top of the `Application` <add>In `config/application.rb`, add the following line at the top of the `Application` <ide> class definition: <ide> <ide> ```ruby <ide><path>guides/source/caching_with_rails.md <ide> NOTE: Notice that in this example we used the `cache_key_with_version` method, s <ide> Consider this example, which stores a list of Active Record objects representing superusers in the cache: <ide> <ide> ```ruby <del> # super_admins is an expensive SQL query, so don't run it too often <add># super_admins is an expensive SQL query, so don't run it too often <ide> Rails.cache.fetch("super_admin_users", expires_in: 12.hours) do <ide> User.super_admins.to_a <ide> end <ide> cache stores that reload code when you make changes. <ide> Instead, cache the ID or some other primitive data type. For example: <ide> <ide> ```ruby <del> # super_admins is an expensive SQL query, so don't run it too often <add># super_admins is an expensive SQL query, so don't run it too often <ide> ids = Rails.cache.fetch("super_admin_user_ids", expires_in: 12.hours) do <ide> User.super_admins.pluck(:id) <ide> end <ide><path>guides/source/configuring.md <ide> Configures lookup path for encrypted credentials. <ide> <ide> Configures lookup path for encryption key. <ide> <del>#### `secret_key_base`` <add>#### `secret_key_base` <ide> <ide> Is used for specifying a key which allows sessions for the application to be verified against a known secure key to prevent tampering. Applications get a random generated key in test and development environments, other environments should set one in `config/credentials.yml.enc`. <ide> <ide> Defines the CSS compressor to use. It is set by default by `sass-rails`. The uni <ide> <ide> #### `config.assets.js_compressor` <ide> <del>Defines the JavaScript compressor to use. Possible values are `:terser`, `:closure`, `:uglifier` and `:yui` which require the use of the `terser`, `closure-compiler`, `uglifier` or `yui-compressor` gems respectively. <add>Defines the JavaScript compressor to use. Possible values are `:terser`, `:closure`, `:uglifier` and `:yui`, which require the use of the `terser`, `closure-compiler`, `uglifier` or `yui-compressor` gems respectively. <ide> <ide> #### `config.assets.gzip` <ide> <ide> The default value depends on the `config.load_defaults` target version: <ide> <ide> Specifies what serializer the `MessageEncryptor` class will use by default. <ide> <del>Options are `:json`, `:hybrid` and `:marshal`. `:hybrid` uses the `JsonWithMarshalFallback` class. <add>Options are `:json`, `:hybrid` and `:marshal`. `:hybrid` uses the `JsonWithMarshalFallback` class. <ide> <ide> The default value depends on the `config.load_defaults` target version: <ide> <ide> Below is a comprehensive list of all the initializers found in Rails in the orde <ide> <ide> * `engines_blank_point`: Provides a point-in-initialization to hook into if you wish to do anything before engines are loaded. After this point, all railtie and engine initializers are run. <ide> <del>* `add_generator_templates`: Finds templates for generators at `lib/templates` for the application, railties, and engines and adds these to the `config.generators.templates` setting, which will make the templates available for all generators to reference. <add>* `add_generator_templates`: Finds templates for generators at `lib/templates` for the application, railties, and engines, and adds these to the `config.generators.templates` setting, which will make the templates available for all generators to reference. <ide> <ide> * `ensure_autoload_once_paths_as_subset`: Ensures that the `config.autoload_once_paths` only contains paths from `config.autoload_paths`. If it contains extra paths, then an exception will be raised. <ide> <ide><path>guides/source/debugging_rails_applications.md <ide> Please check its [documentation](https://github.com/ruby/debug) for usage. <ide> <ide> By default, a debugging session will start after the `debug` library is required, which happens when your app boots. But don't worry, the session won't interfere your program. <ide> <del> To enter the debugging session, you can use `binding.break` and its aliases: `binding.b` and `debugger`. The following examples will use `debugger`: <add>To enter the debugging session, you can use `binding.break` and its aliases: `binding.b` and `debugger`. The following examples will use `debugger`: <ide> <ide> ```rb <ide> class PostsController < ApplicationController <ide><path>guides/source/form_helpers.md <ide> Let's say we want to render a form with a set of fields for each of a person's a <ide> <% end %> <ide> ``` <ide> <del>Assuming the person had two addresses, with ids 23 and 45 this would create output similar to this: <add>Assuming the person had two addresses with ids 23 and 45, this would create output similar to this: <ide> <ide> ```html <ide> <form accept-charset="UTF-8" action="/people/1" method="post"> <ide><path>guides/source/generators.md <ide> $ bin/rails generate scaffold User name:string <ide> create test/system/users_test.rb <ide> ``` <ide> <del>Looking at this output, it's easy to understand how generators work in Rails 3.0 and above. The scaffold generator doesn't actually generate anything, it just invokes others to do the work. This allows us to add/replace/remove any of those invocations. For instance, the scaffold generator invokes the scaffold_controller generator, which invokes erb, test_unit and helper generators. Since each generator has a single responsibility, they are easy to reuse, avoiding code duplication. <add>Looking at this output, it's easy to understand how generators work in Rails 3.0 and above. The scaffold generator doesn't actually generate anything; it just invokes others to do the work. This allows us to add/replace/remove any of those invocations. For instance, the scaffold generator invokes the scaffold_controller generator, which invokes erb, test_unit and helper generators. Since each generator has a single responsibility, they are easy to reuse, avoiding code duplication. <ide> <ide> The next customization on the workflow will be to stop generating stylesheet and test fixture files for scaffolds altogether. We can achieve that by changing our configuration to the following: <ide>
9
Text
Text
fix broken links to contributor's guide
c5e76fc592cddfe81cec2c9978f56c2a485552b2
<ide><path>README.md <ide> <ide> ## Contributing <ide> <del>Instructions on building and testing Chart.js can be found in [the documentation](https://github.com/chartjs/Chart.js/blob/master/docs/developers/contributing.md#building-and-testing). Before submitting an issue or a pull request, please take a moment to look over the [contributing guidelines](https://github.com/chartjs/Chart.js/blob/master/docs/developers/contributing.md) first. For support, please post questions on [Stack Overflow](https://stackoverflow.com/questions/tagged/chartjs) with the `chartjs` tag. <add>Instructions on building and testing Chart.js can be found in [the documentation](https://www.chartjs.org/docs/latest/developers/contributing.html#building-and-testing). Before submitting an issue or a pull request, please take a moment to look over the [contributing guidelines](https://www.chartjs.org/docs/latest/developers/contributing.html) first. For support, please post questions on [Stack Overflow](https://stackoverflow.com/questions/tagged/chartjs) with the `chartjs` tag. <ide> <ide> ## License <ide>
1
PHP
PHP
use two spaces for docblock params
49dad6f80092711af5e72a04c0f480feadd26a91
<ide><path>src/Illuminate/Database/Query/Grammars/Grammar.php <ide> public function compileInsertGetId(Builder $query, $values, $sequence) <ide> * Compile an insert statement with subquery into SQL. <ide> * <ide> * @param \Illuminate\Database\Query\Builder $query <del> * @param array $columns <add> * @param array $columns <ide> * @param string $sql <ide> * @return string <ide> */
1
Javascript
Javascript
remove use of `promise.finally` in polyfill
c59218c4d88e2a42c161b209dad3aad9960fc6ab
<ide><path>packages/next/client/event-source-polyfill.js <ide> FetchTransport.prototype.open = function (xhr, onStartCallback, onProgressCallba <ide> } <ide> readNextChunk() <ide> }) <del> })['finally'](function () { <add> }).then(function(result) { <ide> onFinishCallback() <add> return result <add> })['catch'](function(error) { <add> onFinishCallback() <add> return Promise.reject(error) <ide> }) <ide> } <ide>
1
Python
Python
add a docstring to the mypy plugin entry-point
0917df2953ebe716c45c92671cb652eacd7dd8fd
<ide><path>numpy/typing/mypy_plugin.py <ide> def get_type_analyze_hook(self, fullname: str) -> t.Optional[HookFunc]: <ide> <ide> <ide> def plugin(version: str) -> t.Type[_NumpyPlugin]: <add> """An entry-point for mypy.""" <ide> return _NumpyPlugin
1
Ruby
Ruby
remove unused code that was copied from actionpack
0e3b4d64c0a61793204873d844a546a88b10940b
<ide><path>actionview/test/abstract_unit.rb <ide> <ide> require "pp" # require 'pp' early to prevent hidden_methods from not picking up the pretty-print methods until too late <ide> <del>module Rails <del> class << self <del> def env <del> @_env ||= ActiveSupport::StringInquirer.new(ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "test") <del> end <del> end <del>end <del> <ide> ActiveSupport::Dependencies.hook! <ide> <ide> Thread.abort_on_exception = true <ide> def before_setup <ide> end <ide> end <ide> <del>module ActiveSupport <del> class TestCase <del> include ActionDispatch::DrawOnce <del> end <del>end <del> <ide> class RoutedRackApp <ide> attr_reader :routes <ide> <ide> def self.build_app(routes = nil) <ide> <ide> self.app = build_app <ide> <del> # Stub Rails dispatcher so it does not get controller references and <del> # simply return the controller#action as Rack::Body. <del> class StubDispatcher < ::ActionDispatch::Routing::RouteSet::Dispatcher <del> private <del> def controller_reference(controller_param) <del> controller_param <del> end <del> <del> def dispatch(controller, action, env) <del> [200, { "Content-Type" => "text/html" }, ["#{controller}##{action}"]] <del> end <del> end <del> <del> def self.stub_controllers <del> old_dispatcher = ActionDispatch::Routing::RouteSet::Dispatcher <del> ActionDispatch::Routing::RouteSet.module_eval { remove_const :Dispatcher } <del> ActionDispatch::Routing::RouteSet.module_eval { const_set :Dispatcher, StubDispatcher } <del> yield ActionDispatch::Routing::RouteSet.new <del> ensure <del> ActionDispatch::Routing::RouteSet.module_eval { remove_const :Dispatcher } <del> ActionDispatch::Routing::RouteSet.module_eval { const_set :Dispatcher, old_dispatcher } <del> end <del> <ide> def with_routing(&block) <ide> temporary_routes = ActionDispatch::Routing::RouteSet.new <ide> old_app, self.class.app = self.class.app, self.class.build_app(temporary_routes) <ide> def with_routing(&block) <ide> self.class.app = old_app <ide> silence_warnings { Object.const_set(:SharedTestRoutes, old_routes) } <ide> end <del> <del> def with_autoload_path(path) <del> path = File.join(File.expand_path("fixtures", __dir__), path) <del> if ActiveSupport::Dependencies.autoload_paths.include?(path) <del> yield <del> else <del> begin <del> ActiveSupport::Dependencies.autoload_paths << path <del> yield <del> ensure <del> ActiveSupport::Dependencies.autoload_paths.reject! { |p| p == path } <del> ActiveSupport::Dependencies.clear <del> end <del> end <del> end <ide> end <ide> <ide> ActionView::RoutingUrlFor.include(ActionDispatch::Routing::UrlFor) <ide> def self.test_routes(&block) <ide> class TestCase <ide> include ActionDispatch::TestProcess <ide> include ActionDispatch::SharedRoutes <add> include ActionDispatch::DrawOnce <ide> end <ide> end <ide>
1
PHP
PHP
add frameworks compatible breadcrumbs
a0f323eb4cfe3238f79e59119360f99f697e11bb
<ide><path>lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php <ide> public function testCrumbListFirstLink() { <ide> ); <ide> } <ide> <add>/** <add> * test getCrumbList() in Twitter Bootstrap style. <add> * <add> * <add> * @return void <add> */ <add> public function testCrumbListBootstrapStyle() { <add> <add> $this->Html->addCrumb('Home', '/', array('class'=>'home')); <add> $this->Html->addCrumb('Library', '/lib'); <add> $this->Html->addCrumb('Data'); <add> $result = $this->Html->getCrumbList( <add> array('class' => 'breadcrumb', 'separator'=>'<span class="divider">/</span>', 'firstClass'=>false, 'lastClass'=>'active') <add> ); <add> $this->assertTags( <add> $result, <add> array( <add> array('ul' => array('class' => 'breadcrumb')), <add> '<li', <add> array('a' => array('href' => '/')), 'Home', '/a', <add> array('span'=>array('class'=>'divider')),'preg:/\//','/span', <add> '/li', <add> '<li', <add> array('a' => array('href' => '/lib')), 'Library', '/a', <add> array('span'=>array('class'=>'divider')),'preg:/\//','/span', <add> '/li', <add> array('li' => array('class' => 'active')),'Data','/li', <add> '/ul' <add> ), true <add> ); <add> } <add> <add>/** <add> * Test GetCrumbList using style of Zurb Foundation. <add> * <add> * @return void <add> */ <add> public function testCrumbListZurbStyle() { <add> <add> $this->Html->addCrumb('Home', '#'); <add> $this->Html->addCrumb('Features', '#'); <add> $this->Html->addCrumb('Gene Splicing', '#'); <add> $this->Html->addCrumb('Home', '#'); <add> $result = $this->Html->getCrumbList( <add> array( 'class'=>'breadcrumbs', 'firstClass'=>false, 'lastClass'=>'current') <add> ); <add> $this->assertTags( <add> $result, <add> array( <add> array('ul' => array('class' => 'breadcrumbs')), <add> '<li', <add> array('a' => array('href' => '#')), 'Home', '/a', <add> '/li', <add> '<li', <add> array('a' => array('href' => '#')), 'Features', '/a', <add> '/li', <add> '<li', <add> array('a' => array('href' => '#')), 'Gene Splicing', '/a', <add> '/li', <add> array('li' => array('class' => 'current')), <add> array('a' => array('href' => '#')), 'Home', '/a', <add> '/li', <add> '/ul' <add> ), true <add> ); <add> } <add> <ide> /** <ide> * testLoadConfig method <ide> * <ide> public function testParseAttributeCompact() { <ide> $this->assertEquals('', $helper->parseAttributes(array('require' => false))); <ide> } <ide> <del>} <add>} <ide>\ No newline at end of file <ide><path>lib/Cake/View/Helper/HtmlHelper.php <ide> public function getCrumbs($separator = '&raquo;', $startText = false) { <ide> * similar to HtmlHelper::getCrumbs(), so it uses options which every <ide> * crumb was added with. <ide> * <add> * ### Options <add> * - `separator` Separator content to insert in between breadcrumbs, defaults to '' <add> * - `firstClass` Class for wrapper tag on the first breadcrumb, defaults to 'first' <add> * - `lastClass` Class for wrapper tag on current active page, defaults to 'last' <add> * <ide> * @param array $options Array of html attributes to apply to the generated list elements. <ide> * @param string|array|boolean $startText This will be the first crumb, if false it defaults to first crumb in array. Can <ide> * also be an array, see `HtmlHelper::getCrumbs` for details. <ide> * @return string breadcrumbs html list <ide> * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/html.html#creating-breadcrumb-trails-with-htmlhelper <ide> */ <ide> public function getCrumbList($options = array(), $startText = false) { <add> $defaults = array('firstClass'=>'first', 'lastClass'=>'last', 'separator' => ''); <add> $options = array_merge($defaults, (array)$options); <add> $firstClass = $options['firstClass']; <add> $lastClass = $options['lastClass']; <add> $separator = $options['separator']; <add> unset($options['firstClass'], $options['lastClass'], $options['separator']); <ide> $crumbs = $this->_prepareCrumbs($startText); <ide> if (!empty($crumbs)) { <ide> $result = ''; <ide> public function getCrumbList($options = array(), $startText = false) { <ide> $elementContent = $this->link($crumb[0], $crumb[1], $crumb[2]); <ide> } <ide> if (!$which) { <del> $options['class'] = 'first'; <add> if ($firstClass !== false) { <add> $options['class'] = $firstClass; <add> } <ide> } elseif ($which == $crumbCount - 1) { <del> $options['class'] = 'last'; <add> if ($lastClass !== false) { <add> $options['class'] = $lastClass; <add> } <add> } <add> if (!empty($separator) && ($crumbCount - $which >= 2)) { <add> $elementContent .= $separator; <ide> } <ide> $result .= $this->tag('li', $elementContent, $options); <ide> } <ide> public function loadConfig($configFile, $path = null) { <ide> return $configs; <ide> } <ide> <del>} <add>} <ide>\ No newline at end of file
2
PHP
PHP
use artisan for seeding
acb7f0e409b0088d0b318cf7df063754bb28a9fe
<ide><path>src/Illuminate/Foundation/Testing/TestCase.php <ide> public function be(UserInterface $user, $driver = null) <ide> */ <ide> public function seed($class = 'DatabaseSeeder') <ide> { <del> $this->app[$class]->run(); <add> $this->app['artisan']->call('seed', array('--class' => $class)); <ide> } <ide> <ide> /**
1
Ruby
Ruby
use the attributes hash explicitly
08db3d5af3ac6a36036083e80f7bb33e65cc9dd3
<ide><path>railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb <ide> def create_test_files <ide> <ide> private <ide> <del> def accessible_attributes <del> attributes.reject(&:reference?).map {|a| "\"#{a.name}\"" }.sort.join(', ') <del> end <add> def resource_attributes <add> key_value singular_table_name, "{ #{attributes_hash} }" <add> end <add> <add> def attributes_hash <add> return if accessible_attributes.empty? <add> <add> accessible_attributes.map do |a| <add> name = a.name <add> "#{name}: @#{singular_table_name}.#{name}" <add> end.sort.join(', ') <add> end <add> <add> def accessible_attributes <add> attributes.reject(&:reference?) <add> end <ide> end <ide> end <ide> end <ide><path>railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb <ide> class <%= controller_class_name %>ControllerTest < ActionController::TestCase <ide> setup do <ide> @<%= singular_table_name %> = <%= table_name %>(:one) <del> @valid_attributes = @<%= singular_table_name %>.attributes.slice(<%= accessible_attributes %>) <ide> end <ide> <ide> test "should get index" do <ide> class <%= controller_class_name %>ControllerTest < ActionController::TestCase <ide> <ide> test "should create <%= singular_table_name %>" do <ide> assert_difference('<%= class_name %>.count') do <del> post :create, <%= key_value singular_table_name, "@valid_attributes" %> <add> post :create, <%= resource_attributes %> <ide> end <ide> <ide> assert_redirected_to <%= singular_table_name %>_path(assigns(:<%= singular_table_name %>)) <ide> class <%= controller_class_name %>ControllerTest < ActionController::TestCase <ide> end <ide> <ide> test "should update <%= singular_table_name %>" do <del> put :update, <%= key_value :id, "@#{singular_table_name}" %>, <%= key_value singular_table_name, "@valid_attributes" %> <add> put :update, <%= key_value :id, "@#{singular_table_name}" %>, <%= resource_attributes %> <ide> assert_redirected_to <%= singular_table_name %>_path(assigns(:<%= singular_table_name %>)) <ide> end <ide> <ide><path>railties/test/generators/scaffold_controller_generator_test.rb <ide> def test_functional_tests <ide> assert_file "test/functional/users_controller_test.rb" do |content| <ide> assert_match(/class UsersControllerTest < ActionController::TestCase/, content) <ide> assert_match(/test "should get index"/, content) <del> assert_match(/@valid_attributes = @user\.attributes\.slice\("age", "name"\)/, content) <del> assert_match(/post :create, user: @valid_attributes/, content) <del> assert_match(/put :update, id: @user, user: @valid_attributes/, content) <add> assert_match(/post :create, user: { age: @user.age, name: @user.name }/, content) <add> assert_match(/put :update, id: @user, user: { age: @user.age, name: @user.name }/, content) <add> end <add> end <add> <add> def test_functional_tests_without_attributes <add> run_generator ["User"] <add> <add> assert_file "test/functional/users_controller_test.rb" do |content| <add> assert_match(/class UsersControllerTest < ActionController::TestCase/, content) <add> assert_match(/test "should get index"/, content) <add> assert_match(/post :create, user: { }/, content) <add> assert_match(/put :update, id: @user, user: { }/, content) <ide> end <ide> end <ide> <ide><path>railties/test/generators/scaffold_generator_test.rb <ide> def test_scaffold_on_invoke <ide> <ide> assert_file "test/functional/product_lines_controller_test.rb" do |test| <ide> assert_match(/class ProductLinesControllerTest < ActionController::TestCase/, test) <del> assert_match(/@valid_attributes = @product_line\.attributes\.slice\("title"\)/, test) <del> assert_match(/post :create, product_line: @valid_attributes/, test) <del> assert_match(/put :update, id: @product_line, product_line: @valid_attributes/, test) <add> assert_match(/post :create, product_line: { title: @product_line.title }/, test) <add> assert_match(/put :update, id: @product_line, product_line: { title: @product_line.title }/, test) <ide> end <ide> <ide> # Views <ide> def test_scaffold_on_invoke <ide> assert_file "app/assets/stylesheets/product_lines.css" <ide> end <ide> <add> def test_functional_tests_without_attributes <add> run_generator ["product_line"] <add> <add> assert_file "test/functional/product_lines_controller_test.rb" do |content| <add> assert_match(/class ProductLinesControllerTest < ActionController::TestCase/, content) <add> assert_match(/test "should get index"/, content) <add> assert_match(/post :create, product_line: { }/, content) <add> assert_match(/put :update, id: @product_line, product_line: { }/, content) <add> end <add> end <add> <ide> def test_scaffold_on_revoke <ide> run_generator <ide> run_generator ["product_line"], :behavior => :revoke
4
Python
Python
update available record types enum
401b929739a5158206c24eeda6616580f5686fb5
<ide><path>libcloud/dns/types.py <ide> class RecordType(object): <ide> SOA = 8 <ide> SPF = 9 <ide> SRV = 10 <add> PTR = 11 <add> NAPTR = 12 <add> REDIRECT = 13 <ide> <ide> @classmethod <ide> def __repr__(self, value):
1
Python
Python
incorporate image_shape and filter_shape in convs
cb77f7d7e2933078838e836018fdfa7075e5385f
<ide><path>examples/imdb_cnn.py <ide> <ide> # we start off with an efficient embedding layer which maps <ide> # our vocab indices into embedding_dims dimensions <del>model.add(Embedding(max_features, embedding_dims, max_length=maxlen)) <add>model.add(Embedding(max_features, embedding_dims, input_length=maxlen)) <ide> model.add(Dropout(0.25)) <ide> <ide> # we add a Convolution1D, which will learn nb_filter <ide><path>keras/layers/convolutional.py <ide> def get_output(self, train=False): <ide> assert(self.subsample_length == 1) <ide> border_mode = 'full' <ide> <add> input_shape = self.input_shape <add> image_shape = (input_shape[0], input_shape[2], input_shape[1], 1) <ide> conv_out = T.nnet.conv.conv2d(X, self.W, <ide> border_mode=border_mode, <del> subsample=self.subsample) <add> subsample=self.subsample, <add> image_shape=image_shape, <add> filter_shape=self.W_shape) <ide> if self.border_mode == 'same': <ide> shift_x = (self.filter_length - 1) // 2 <ide> conv_out = conv_out[:, :, shift_x:X.shape[2] + shift_x, :] <ide> def get_output(self, train=False): <ide> conv_out = dnn.dnn_conv(img=X, <ide> kerns=self.W, <ide> border_mode=border_mode, <del> subsample=self.subsample) <add> subsample=self.subsample, <add> image_shape=self.input_shape, <add> filter_shape=self.W_shape) <ide> else: <ide> if border_mode == 'same': <ide> border_mode = 'full'
2
Text
Text
expand changelog for [ci skip]
e0b19a3622e9d6d328dde174165ac03719f565c4
<ide><path>activerecord/CHANGELOG.md <del>* Allow matches_regex on MySQL <add>* Allow `matches_regex` and `does_not_match_regexp` on the MySQL Arel visitor. <ide> <ide> *James Pearson* <del> <add> <ide> * Allow specifying fixtures to be ignored by setting `ignore` in YAML file's '_fixture' section. <ide> <ide> *Tongfei Gao*
1
Python
Python
fix some tests in pr #192
5b4e61b8a18d79385d503624886d9d5f2038b31b
<ide><path>numpy/lib/tests/test_function_base.py <ide> def test_indexing(self): <ide> x = [1, 2, 3] <ide> y = [4, 5, 6, 7] <ide> [X, Y] = meshgrid(x, y, indexing='ij') <del> assert_(all(X == array([[1, 1, 1, 1], <del> [2, 2, 2, 2], <del> [3, 3, 3, 3]]))) <del> assert_(all(Y == array([[4, 5, 6, 7], <del> [4, 5, 6, 7], <del> [4, 5, 6, 7]]))) <add> assert_(np.all(X == np.array([[1, 1, 1, 1], <add> [2, 2, 2, 2], <add> [3, 3, 3, 3]]))) <add> assert_(np.all(Y == np.array([[4, 5, 6, 7], <add> [4, 5, 6, 7], <add> [4, 5, 6, 7]]))) <ide> <ide> # Test expected shapes: <ide> z = [8, 9] <ide> def test_indexing(self): <ide> <ide> def test_sparse(self): <ide> [X, Y] = meshgrid([1, 2, 3], [4, 5, 6, 7], sparse=True) <del> assert_(all(X == array([[1, 2, 3]]))) <del> assert_(all(Y == array([[4], [5], [6], [7]]))) <add> assert_(np.all(X == np.array([[1, 2, 3]]))) <add> assert_(np.all(Y == np.array([[4], [5], [6], [7]]))) <ide> <ide> <ide> class TestPiecewise(TestCase):
1
Ruby
Ruby
support fontforge scheme
6ef3bab4a35f0a085670d29341c65862796665ef
<ide><path>Library/Homebrew/bottle_version.rb <ide> def self._parse spec <ide> m = /-(\d+_\d+(_\d+)+)/.match(stem) <ide> return m.captures.first unless m.nil? <ide> <add> # e.g. 20120731 from fontforge-20120731.mavericks.bottle.tar.gz <add> m = /-(\d+)/.match(stem) <add> return m.captures.first unless m.nil? <add> <ide> super <ide> end <ide> end <ide><path>Library/Homebrew/test/test_bottle_versions.rb <ide> def test_zpython_style <ide> assert_version_detected '00-5.0.5', <ide> '/usr/local/zpython-00-5.0.5.mavericks.bottle.tar.gz' <ide> end <add> <add> def test_fontforge_style <add> assert_version_detected '20120731', <add> '/usr/local/fontforge-20120731.mavericks.bottle.tar.gz' <add> end <ide> end
2
PHP
PHP
remove useless backups
c15259f49c0a268141eec84f779d8b7c611177f5
<ide><path>lib/Cake/Test/Case/Network/CakeRequestTest.php <ide> class CakeRequestTest extends CakeTestCase { <ide> */ <ide> public function setUp() { <ide> parent::setUp(); <del> $this->_server = $_SERVER; <del> $this->_get = $_GET; <del> $this->_post = $_POST; <del> $this->_files = $_FILES; <ide> $this->_app = Configure::read('App'); <ide> $this->_case = null; <ide> if (isset($_GET['case'])) { <ide> public function setUp() { <ide> */ <ide> public function tearDown() { <ide> parent::tearDown(); <del> $_SERVER = $this->_server; <del> $_GET = $this->_get; <del> $_POST = $this->_post; <del> $_FILES = $this->_files; <ide> if (!empty($this->_case)) { <ide> $_GET['case'] = $this->_case; <ide> } <ide> public function testPostParsing() { <ide> * <ide> * @return void <ide> */ <del> public function testFILESParsing() { <del> $_FILES = array('data' => array('name' => array( <del> 'File' => array( <del> array('data' => 'cake_sqlserver_patch.patch'), <del> array('data' => 'controller.diff'), <del> array('data' => ''), <del> array('data' => ''), <del> ), <del> 'Post' => array('attachment' => 'jquery-1.2.1.js'), <del> ), <del> 'type' => array( <del> 'File' => array( <del> array('data' => ''), <del> array('data' => ''), <del> array('data' => ''), <del> array('data' => ''), <add> public function testFilesParsing() { <add> $_FILES = array( <add> 'data' => array( <add> 'name' => array( <add> 'File' => array( <add> array('data' => 'cake_sqlserver_patch.patch'), <add> array('data' => 'controller.diff'), <add> array('data' => ''), <add> array('data' => ''), <add> ), <add> 'Post' => array('attachment' => 'jquery-1.2.1.js'), <add> ), <add> 'type' => array( <add> 'File' => array( <add> array('data' => ''), <add> array('data' => ''), <add> array('data' => ''), <add> array('data' => ''), <add> ), <add> 'Post' => array('attachment' => 'application/x-javascript'), <ide> ), <del> 'Post' => array('attachment' => 'application/x-javascript'), <del> ), <del> 'tmp_name' => array( <del> 'File' => array( <del> array('data' => '/private/var/tmp/phpy05Ywj'), <del> array('data' => '/private/var/tmp/php7MBztY'), <del> array('data' => ''), <del> array('data' => ''), <add> 'tmp_name' => array( <add> 'File' => array( <add> array('data' => '/private/var/tmp/phpy05Ywj'), <add> array('data' => '/private/var/tmp/php7MBztY'), <add> array('data' => ''), <add> array('data' => ''), <add> ), <add> 'Post' => array('attachment' => '/private/var/tmp/phpEwlrIo'), <ide> ), <del> 'Post' => array('attachment' => '/private/var/tmp/phpEwlrIo'), <del> ), <del> 'error' => array( <del> 'File' => array( <del> array('data' => 0), <del> array('data' => 0), <del> array('data' => 4), <del> array('data' => 4) <add> 'error' => array( <add> 'File' => array( <add> array('data' => 0), <add> array('data' => 0), <add> array('data' => 4), <add> array('data' => 4) <add> ), <add> 'Post' => array('attachment' => 0) <ide> ), <del> 'Post' => array('attachment' => 0) <del> ), <del> 'size' => array( <del> 'File' => array( <del> array('data' => 6271), <del> array('data' => 350), <del> array('data' => 0), <del> array('data' => 0), <add> 'size' => array( <add> 'File' => array( <add> array('data' => 6271), <add> array('data' => 350), <add> array('data' => 0), <add> array('data' => 0), <add> ), <add> 'Post' => array('attachment' => 80469) <ide> ), <del> 'Post' => array('attachment' => 80469) <del> ), <del> )); <add> ) <add> ); <ide> <ide> $request = new CakeRequest('some/path'); <ide> $expected = array( <ide> 'File' => array( <del> array('data' => array( <del> 'name' => 'cake_sqlserver_patch.patch', <del> 'type' => '', <del> 'tmp_name' => '/private/var/tmp/phpy05Ywj', <del> 'error' => 0, <del> 'size' => 6271, <del> )), <ide> array( <ide> 'data' => array( <del> 'name' => 'controller.diff', <del> 'type' => '', <del> 'tmp_name' => '/private/var/tmp/php7MBztY', <del> 'error' => 0, <del> 'size' => 350, <del> )), <del> array('data' => array( <del> 'name' => '', <del> 'type' => '', <del> 'tmp_name' => '', <del> 'error' => 4, <del> 'size' => 0, <del> )), <del> array('data' => array( <del> 'name' => '', <del> 'type' => '', <del> 'tmp_name' => '', <del> 'error' => 4, <del> 'size' => 0, <del> )), <add> 'name' => 'cake_sqlserver_patch.patch', <add> 'type' => '', <add> 'tmp_name' => '/private/var/tmp/phpy05Ywj', <add> 'error' => 0, <add> 'size' => 6271, <add> ) <add> ), <add> array( <add> 'data' => array( <add> 'name' => 'controller.diff', <add> 'type' => '', <add> 'tmp_name' => '/private/var/tmp/php7MBztY', <add> 'error' => 0, <add> 'size' => 350, <add> ) <add> ), <add> array( <add> 'data' => array( <add> 'name' => '', <add> 'type' => '', <add> 'tmp_name' => '', <add> 'error' => 4, <add> 'size' => 0, <add> ) <add> ), <add> array( <add> 'data' => array( <add> 'name' => '', <add> 'type' => '', <add> 'tmp_name' => '', <add> 'error' => 4, <add> 'size' => 0, <add> ) <add> ), <ide> ), <del> 'Post' => array('attachment' => array( <del> 'name' => 'jquery-1.2.1.js', <del> 'type' => 'application/x-javascript', <del> 'tmp_name' => '/private/var/tmp/phpEwlrIo', <del> 'error' => 0, <del> 'size' => 80469, <del> )) <add> 'Post' => array( <add> 'attachment' => array( <add> 'name' => 'jquery-1.2.1.js', <add> 'type' => 'application/x-javascript', <add> 'tmp_name' => '/private/var/tmp/phpEwlrIo', <add> 'error' => 0, <add> 'size' => 80469, <add> ) <add> ) <ide> ); <ide> $this->assertEquals($expected, $request->data); <ide> <ide> public function testFILESParsing() { <ide> 1 => array( <ide> 'birth_cert' => '/private/var/tmp/phpbsUWfH', <ide> 'passport' => '/private/var/tmp/php7f5zLt', <del> 'drivers_license' => '/private/var/tmp/phpMXpZgT', <add> 'drivers_license' => '/private/var/tmp/phpMXpZgT', <ide> ), <ide> 2 => array( <ide> 'birth_cert' => '/private/var/tmp/php5kHZt0', <del> 'passport' => '/private/var/tmp/phpnYkOuM', <del> 'drivers_license' => '/private/var/tmp/php9Rq0P3', <add> 'passport' => '/private/var/tmp/phpnYkOuM', <add> 'drivers_license' => '/private/var/tmp/php9Rq0P3', <ide> ) <ide> ) <ide> ), <ide> public function testFILESParsing() { <ide> 1 => array( <ide> 'birth_cert' => 0, <ide> 'passport' => 0, <del> 'drivers_license' => 0, <add> 'drivers_license' => 0, <ide> ), <ide> 2 => array( <ide> 'birth_cert' => 0, <del> 'passport' => 0, <del> 'drivers_license' => 0, <add> 'passport' => 0, <add> 'drivers_license' => 0, <ide> ) <ide> ) <ide> ), <ide> public function testFILESParsing() { <ide> 1 => array( <ide> 'birth_cert' => 123, <ide> 'passport' => 458, <del> 'drivers_license' => 875, <add> 'drivers_license' => 875, <ide> ), <ide> 2 => array( <ide> 'birth_cert' => 876, <del> 'passport' => 976, <del> 'drivers_license' => 9783, <add> 'passport' => 976, <add> 'drivers_license' => 9783, <ide> ) <ide> ) <ide> )
1
Javascript
Javascript
fix some bugs in the animation stuff
98253fea5d0e2ecc1dcdad6321e5bf3137fd7ae2
<ide><path>src/Chart.Core.js <ide> var stepDecimal = animationObject.currentStep / animationObject.numSteps; <ide> var easeDecimal = easingFunction(stepDecimal); <ide> <del> chartInstance.draw(chartInstance, easeDecimal, stepDecimal, currentStep); <add> chartInstance.draw(easeDecimal, stepDecimal, animationObject.currentStep); <ide> }; <ide> <ide> // user events <ide> <ide> // If there are no animations queued, manually kickstart a digest, for lack of a better word <ide> if (this.animations.length) { <del> helpers.requestAnimFrame(this.startDigest); <add> helpers.requestAnimFrame.call(window, this.digestWrapper); <ide> } <ide> }, <add> // calls startDigest with the proper context <add> digestWrapper: function() { <add> Chart.animationService.startDigest.call(Chart.animationService); <add> }, <ide> startDigest: function() { <ide> <ide> for (var i = 0; i < this.animations.length; i++) { <ide> <ide> // Do we have more stuff to animate? <ide> if (this.animations.length > 0){ <del> requestAnimationFrame(this.startDigest); <add> helpers.requestAnimFrame.call(window, this.digestWrapper); <ide> } <ide> } <ide> };
1
Java
Java
use pre-parsed pathcontainer in webmvc.fn
8e81360eba8cca33522872cdf48eb5f0b84644cb
<ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/function/DefaultServerRequest.java <ide> import org.springframework.http.MediaType; <ide> import org.springframework.http.converter.GenericHttpMessageConverter; <ide> import org.springframework.http.converter.HttpMessageConverter; <add>import org.springframework.http.server.PathContainer; <ide> import org.springframework.http.server.ServletServerHttpRequest; <ide> import org.springframework.lang.Nullable; <ide> import org.springframework.util.CollectionUtils; <ide> class DefaultServerRequest implements ServerRequest { <ide> <ide> private final ServletServerHttpRequest serverHttpRequest; <ide> <add> private final PathContainer pathContainer; <add> <ide> private final Headers headers; <ide> <ide> private final List<HttpMessageConverter<?>> messageConverters; <ide> public DefaultServerRequest(HttpServletRequest servletRequest, List<HttpMessageC <ide> this.headers = new DefaultRequestHeaders(this.serverHttpRequest.getHeaders()); <ide> this.params = CollectionUtils.toMultiValueMap(new ServletParametersMap(servletRequest)); <ide> this.attributes = new ServletAttributesMap(servletRequest); <add> <add> this.pathContainer = PathContainer.parsePath(path()); <ide> } <ide> <ide> private static List<MediaType> allSupportedMediaTypes(List<HttpMessageConverter<?>> messageConverters) { <ide> public String path() { <ide> return path; <ide> } <ide> <add> @Override <add> public PathContainer pathContainer() { <add> return this.pathContainer; <add> } <add> <ide> @Override <ide> public Headers headers() { <ide> return this.headers;
1
PHP
PHP
move sqlite code into schema/dialect
60a829f52b3ee6fa83a9ad94b134be106aacd542
<ide><path>lib/Cake/Database/Dialect/SqliteDialectTrait.php <ide> protected function _insertQueryTranslator($query) { <ide> return $query->values($v); <ide> } <ide> <del>/** <del> * Convert a column definition to the abstract types. <del> * <del> * The returned type will be a type that <del> * Cake\Database\Type can handle. <del> * <del> * @param string $column The column type + length <del> * @throws Cake\Error\Exception <del> * @return array List of (type, length) <del> */ <del> public function convertColumn($column) { <del> preg_match('/([a-z]+)(?:\(([0-9,]+)\))?/i', $column, $matches); <del> if (empty($matches)) { <del> throw new Error\Exception(__d('cake_dev', 'Unable to parse column type from "%s"', $column)); <del> } <del> $col = strtolower($matches[1]); <del> $length = null; <del> if (isset($matches[2])) { <del> $length = (int)$matches[2]; <del> } <del> <del> if ($col === 'bigint') { <del> return ['biginteger', $length]; <del> } <del> if (in_array($col, ['blob', 'clob'])) { <del> return ['binary', null]; <del> } <del> if (in_array($col, ['date', 'time', 'timestamp', 'datetime'])) { <del> return [$col, null]; <del> } <del> if (strpos($col, 'decimal') !== false) { <del> return ['decimal', null]; <del> } <del> <del> if (strpos($col, 'boolean') !== false) { <del> return ['boolean', null]; <del> } <del> if (strpos($col, 'int') !== false) { <del> return ['integer', $length]; <del> } <del> if (strpos($col, 'char') !== false) { <del> return ['string', $length]; <del> } <del> if (in_array($col, ['float', 'real', 'double'])) { <del> return ['float', null]; <del> } <del> return ['text', null]; <del> } <del> <del>/** <del> * Get the SQL to list the tables in Sqlite <del> * <del> * @param array $config The connection configuration to use for <del> * getting tables from. <del> * @return array An array of (sql, params) to execute. <del> */ <del> public function listTablesSql() { <del> return ["SELECT name FROM sqlite_master WHERE type='table' ORDER BY name", []]; <del> } <del> <del>/** <del> * Additional metadata columns in table descriptions. <del> * <del> * @return array <del> */ <del> public function extraSchemaColumns() { <del> return []; <del> } <del> <del>/** <del> * Get the SQL to describe a table in Sqlite. <del> * <del> * @param string $table The table name to describe <del> * @return array An array of (sql, params) to execute. <del> */ <del> public function describeTableSql($table) { <del> return ["PRAGMA table_info(" . $this->quoteIdentifier($table) . ")", []]; <del> } <del> <del>/** <del> * Convert field description results into abstract schema fields. <del> * <del> * @return array An array of with the key/values of schema data. <del> */ <del> public function convertFieldDescription($row, $fieldParams = []) { <del> list($type, $length) = $this->convertColumn($row['type']); <del> $schema = []; <del> $schema[$row['name']] = [ <del> 'type' => $type, <del> 'null' => !$row['notnull'], <del> 'default' => $row['dflt_value'] === null ? null : trim($row['dflt_value'], "'"), <del> 'length' => $length, <del> ]; <del> if ($row['pk'] == true) { <del> $schema[$row['name']]['key'] = 'primary'; <del> $schema[$row['name']]['null'] = false; <del> } <del> return $schema; <del> } <del> <ide> /** <ide> * Get the schema dialect. <ide> * <ide><path>lib/Cake/Database/Schema/Dialect/Sqlite.php <add><?php <add>/** <add> * PHP Version 5.4 <add> * <add> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * <add> * Licensed under The MIT License <add> * For full copyright and license information, please see the LICENSE.txt <add> * Redistributions of files must retain the above copyright notice. <add> * <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @link http://cakephp.org CakePHP(tm) Project <add> * @since CakePHP(tm) v 3.0.0 <add> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <add> */ <add>namespace Cake\Database\Schema\Dialect; <add> <add>class Sqlite { <add> <add>/** <add> * The driver instance being used. <add> * <add> * @var Cake\Database\Driver\Sqlite <add> */ <add> protected $driver; <add> <add> public function __construct($driver) { <add> $this->_driver = $driver; <add> } <add> <add>/** <add> * Convert a column definition to the abstract types. <add> * <add> * The returned type will be a type that <add> * Cake\Database\Type can handle. <add> * <add> * @param string $column The column type + length <add> * @throws Cake\Error\Exception <add> * @return array List of (type, length) <add> */ <add> public function convertColumn($column) { <add> preg_match('/([a-z]+)(?:\(([0-9,]+)\))?/i', $column, $matches); <add> if (empty($matches)) { <add> throw new Error\Exception(__d('cake_dev', 'Unable to parse column type from "%s"', $column)); <add> } <add> $col = strtolower($matches[1]); <add> $length = null; <add> if (isset($matches[2])) { <add> $length = (int)$matches[2]; <add> } <add> <add> if ($col === 'bigint') { <add> return ['biginteger', $length]; <add> } <add> if (in_array($col, ['blob', 'clob'])) { <add> return ['binary', null]; <add> } <add> if (in_array($col, ['date', 'time', 'timestamp', 'datetime'])) { <add> return [$col, null]; <add> } <add> if (strpos($col, 'decimal') !== false) { <add> return ['decimal', null]; <add> } <add> <add> if (strpos($col, 'boolean') !== false) { <add> return ['boolean', null]; <add> } <add> if (strpos($col, 'int') !== false) { <add> return ['integer', $length]; <add> } <add> if (strpos($col, 'char') !== false) { <add> return ['string', $length]; <add> } <add> if (in_array($col, ['float', 'real', 'double'])) { <add> return ['float', null]; <add> } <add> return ['text', null]; <add> } <add> <add>/** <add> * Get the SQL to list the tables in Sqlite <add> * <add> * @param array $config The connection configuration to use for <add> * getting tables from. <add> * @return array An array of (sql, params) to execute. <add> */ <add> public function listTablesSql() { <add> return ["SELECT name FROM sqlite_master WHERE type='table' ORDER BY name", []]; <add> } <add> <add>/** <add> * Get the SQL to describe a table in Sqlite. <add> * <add> * @param string $table The table name to describe <add> * @return array An array of (sql, params) to execute. <add> */ <add> public function describeTableSql($table) { <add> return ["PRAGMA table_info(" . $this->_driver->quoteIdentifier($table) . ")", []]; <add> } <add> <add>/** <add> * Additional metadata columns in table descriptions. <add> * <add> * @return array <add> */ <add> public function extraSchemaColumns() { <add> return []; <add> } <add> <add>/** <add> * Convert field description results into abstract schema fields. <add> * <add> * @return array An array of with the key/values of schema data. <add> */ <add> public function convertFieldDescription($row, $fieldParams = []) { <add> list($type, $length) = $this->convertColumn($row['type']); <add> $schema = []; <add> $schema[$row['name']] = [ <add> 'type' => $type, <add> 'null' => !$row['notnull'], <add> 'default' => $row['dflt_value'] === null ? null : trim($row['dflt_value'], "'"), <add> 'length' => $length, <add> ]; <add> if ($row['pk'] == true) { <add> $schema[$row['name']]['key'] = 'primary'; <add> $schema[$row['name']]['null'] = false; <add> } <add> return $schema; <add> } <add> <add>} <ide><path>lib/Cake/Test/TestCase/Database/Driver/SqliteTest.php <ide> */ <ide> class SqliteTest extends TestCase { <ide> <del>/** <del> * Helper method for skipping tests that need a real connection. <del> * <del> * @return void <del> */ <del> protected function _needsConnection() { <del> $config = Configure::read('Datasource.test'); <del> $this->skipIf(strpos($config['datasource'], 'Sqlite') === false, 'Not using Sqlite for test config'); <del> } <del> <ide> /** <ide> * Test connecting to Sqlite with default configuration <ide> * <ide> public function testConnectionConfigCustom() { <ide> $driver->connect($config); <ide> } <ide> <del>/** <del> * Dataprovider for column testing <del> * <del> * @return array <del> */ <del> public static function columnProvider() { <del> return [ <del> [ <del> 'DATETIME', <del> ['datetime', null] <del> ], <del> [ <del> 'DATE', <del> ['date', null] <del> ], <del> [ <del> 'TIME', <del> ['time', null] <del> ], <del> [ <del> 'BOOLEAN', <del> ['boolean', null] <del> ], <del> [ <del> 'BIGINT', <del> ['biginteger', null] <del> ], <del> [ <del> 'VARCHAR(255)', <del> ['string', 255] <del> ], <del> [ <del> 'CHAR(25)', <del> ['string', 25] <del> ], <del> [ <del> 'BLOB', <del> ['binary', null] <del> ], <del> [ <del> 'INTEGER(11)', <del> ['integer', 11] <del> ], <del> [ <del> 'TINYINT(5)', <del> ['integer', 5] <del> ], <del> [ <del> 'MEDIUMINT(10)', <del> ['integer', 10] <del> ], <del> [ <del> 'FLOAT', <del> ['float', null] <del> ], <del> [ <del> 'DOUBLE', <del> ['float', null] <del> ], <del> [ <del> 'REAL', <del> ['float', null] <del> ], <del> [ <del> 'DECIMAL(11,2)', <del> ['decimal', null] <del> ], <del> ]; <del> } <del> <del>/** <del> * Test parsing SQLite column types. <del> * <del> * @dataProvider columnProvider <del> * @return void <del> */ <del> public function testConvertColumnType($input, $expected) { <del> $driver = new Sqlite(); <del> $this->assertEquals($expected, $driver->convertColumn($input)); <del> } <del> <del>/** <del> * Creates tables for testing listTables/describe() <del> * <del> * @param Connection $connection <del> * @return void <del> */ <del> protected function _createTables($connection) { <del> $this->_needsConnection(); <del> $connection->execute('DROP TABLE IF EXISTS articles'); <del> $connection->execute('DROP TABLE IF EXISTS authors'); <del> <del> $table = <<<SQL <del>CREATE TABLE authors( <del>id INTEGER PRIMARY KEY AUTOINCREMENT, <del>name VARCHAR(50), <del>bio TEXT, <del>created DATETIME <del>) <del>SQL; <del> $connection->execute($table); <del> <del> $table = <<<SQL <del>CREATE TABLE articles( <del>id INTEGER PRIMARY KEY AUTOINCREMENT, <del>title VARCHAR(20) DEFAULT 'testing', <del>body TEXT, <del>author_id INT(11) NOT NULL, <del>published BOOLEAN DEFAULT 0, <del>created DATETIME <del>) <del>SQL; <del> $connection->execute($table); <del> } <del> <del>/** <del> * Test listing tables with Sqlite <del> * <del> * @return void <del> */ <del> public function testListTables() { <del> $connection = new Connection(Configure::read('Datasource.test')); <del> $this->_createTables($connection); <del> <del> $result = $connection->listTables(); <del> $this->assertInternalType('array', $result); <del> $this->assertCount(3, $result); <del> $this->assertEquals('articles', $result[0]); <del> $this->assertEquals('authors', $result[1]); <del> $this->assertEquals('sqlite_sequence', $result[2]); <del> } <del> <del>/** <del> * Test describing a table with Sqlite <del> * <del> * @return void <del> */ <del> public function testDescribeTable() { <del> $connection = new Connection(Configure::read('Datasource.test')); <del> $this->_createTables($connection); <del> <del> $result = $connection->describe('articles'); <del> $expected = [ <del> 'id' => [ <del> 'type' => 'integer', <del> 'null' => false, <del> 'default' => null, <del> 'length' => null, <del> 'key' => 'primary', <del> ], <del> 'title' => [ <del> 'type' => 'string', <del> 'null' => true, <del> 'default' => 'testing', <del> 'length' => 20, <del> ], <del> 'body' => [ <del> 'type' => 'text', <del> 'null' => true, <del> 'default' => null, <del> 'length' => null, <del> ], <del> 'author_id' => [ <del> 'type' => 'integer', <del> 'null' => false, <del> 'default' => null, <del> 'length' => 11, <del> ], <del> 'published' => [ <del> 'type' => 'boolean', <del> 'null' => true, <del> 'default' => 0, <del> 'length' => null, <del> ], <del> 'created' => [ <del> 'type' => 'datetime', <del> 'null' => true, <del> 'default' => null, <del> 'length' => null, <del> ], <del> ]; <del> $this->assertEquals($expected, $result); <del> } <ide> <ide> } <ide><path>lib/Cake/Test/TestCase/Database/Schema/Dialect/SqliteTest.php <add><?php <add>/** <add> * PHP Version 5.4 <add> * <add> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * <add> * Licensed under The MIT License <add> * For full copyright and license information, please see the LICENSE.txt <add> * Redistributions of files must retain the above copyright notice. <add> * <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @link http://cakephp.org CakePHP(tm) Project <add> * @since CakePHP(tm) v 3.0.0 <add> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <add> */ <add>namespace Cake\Test\TestCase\Database\Schema\Dialect; <add> <add>use Cake\Core\Configure; <add>use Cake\Database\Connection; <add>use Cake\Database\Schema\Collection as SchemaCollection; <add>use Cake\Database\Schema\Dialect\Sqlite; <add>use Cake\Database\Schema\Driver\Sqlite as SqliteDriver; <add>use Cake\TestSuite\TestCase; <add> <add> <add>/** <add> * Test case for Sqlite Schema Dialect. <add> */ <add>class SqliteTest extends TestCase { <add> <add>/** <add> * Helper method for skipping tests that need a real connection. <add> * <add> * @return void <add> */ <add> protected function _needsConnection() { <add> $config = Configure::read('Datasource.test'); <add> $this->skipIf(strpos($config['datasource'], 'Sqlite') === false, 'Not using Sqlite for test config'); <add> } <add> <add>/** <add> * Dataprovider for column testing <add> * <add> * @return array <add> */ <add> public static function columnProvider() { <add> return [ <add> [ <add> 'DATETIME', <add> ['datetime', null] <add> ], <add> [ <add> 'DATE', <add> ['date', null] <add> ], <add> [ <add> 'TIME', <add> ['time', null] <add> ], <add> [ <add> 'BOOLEAN', <add> ['boolean', null] <add> ], <add> [ <add> 'BIGINT', <add> ['biginteger', null] <add> ], <add> [ <add> 'VARCHAR(255)', <add> ['string', 255] <add> ], <add> [ <add> 'CHAR(25)', <add> ['string', 25] <add> ], <add> [ <add> 'BLOB', <add> ['binary', null] <add> ], <add> [ <add> 'INTEGER(11)', <add> ['integer', 11] <add> ], <add> [ <add> 'TINYINT(5)', <add> ['integer', 5] <add> ], <add> [ <add> 'MEDIUMINT(10)', <add> ['integer', 10] <add> ], <add> [ <add> 'FLOAT', <add> ['float', null] <add> ], <add> [ <add> 'DOUBLE', <add> ['float', null] <add> ], <add> [ <add> 'REAL', <add> ['float', null] <add> ], <add> [ <add> 'DECIMAL(11,2)', <add> ['decimal', null] <add> ], <add> ]; <add> } <add> <add>/** <add> * Test parsing SQLite column types. <add> * <add> * @dataProvider columnProvider <add> * @return void <add> */ <add> public function testConvertColumnType($input, $expected) { <add> $driver = $this->getMock('Cake\Database\Driver\Sqlite'); <add> $dialect = new Sqlite($driver); <add> $this->assertEquals($expected, $dialect->convertColumn($input)); <add> } <add> <add>/** <add> * Creates tables for testing listTables/describe() <add> * <add> * @param Connection $connection <add> * @return void <add> */ <add> protected function _createTables($connection) { <add> $this->_needsConnection(); <add> $connection->execute('DROP TABLE IF EXISTS articles'); <add> $connection->execute('DROP TABLE IF EXISTS authors'); <add> <add> $table = <<<SQL <add>CREATE TABLE authors( <add>id INTEGER PRIMARY KEY AUTOINCREMENT, <add>name VARCHAR(50), <add>bio TEXT, <add>created DATETIME <add>) <add>SQL; <add> $connection->execute($table); <add> <add> $table = <<<SQL <add>CREATE TABLE articles( <add>id INTEGER PRIMARY KEY AUTOINCREMENT, <add>title VARCHAR(20) DEFAULT 'testing', <add>body TEXT, <add>author_id INT(11) NOT NULL, <add>published BOOLEAN DEFAULT 0, <add>created DATETIME <add>) <add>SQL; <add> $connection->execute($table); <add> } <add> <add>/** <add> * Test SchemaCollection listing tables with Sqlite <add> * <add> * @return void <add> */ <add> public function testListTables() { <add> $connection = new Connection(Configure::read('Datasource.test')); <add> $this->_createTables($connection); <add> <add> $schema = new SchemaCollection($connection); <add> $result = $schema->listTables(); <add> <add> $this->assertInternalType('array', $result); <add> $this->assertCount(3, $result); <add> $this->assertEquals('articles', $result[0]); <add> $this->assertEquals('authors', $result[1]); <add> $this->assertEquals('sqlite_sequence', $result[2]); <add> } <add> <add>/** <add> * Test describing a table with Sqlite <add> * <add> * @return void <add> */ <add> public function testDescribeTable() { <add> $connection = new Connection(Configure::read('Datasource.test')); <add> $this->_createTables($connection); <add> <add> $schema = new SchemaCollection($connection); <add> $result = $schema->describe('articles'); <add> $expected = [ <add> 'id' => [ <add> 'type' => 'integer', <add> 'null' => false, <add> 'default' => null, <add> 'length' => null, <add> 'fixed' => null, <add> 'charset' => null, <add> 'comment' => null, <add> 'collate' => null, <add> ], <add> 'title' => [ <add> 'type' => 'string', <add> 'null' => true, <add> 'default' => 'testing', <add> 'length' => 20, <add> 'fixed' => null, <add> 'charset' => null, <add> 'comment' => null, <add> 'collate' => null, <add> ], <add> 'body' => [ <add> 'type' => 'text', <add> 'null' => true, <add> 'default' => null, <add> 'length' => null, <add> 'fixed' => null, <add> 'charset' => null, <add> 'comment' => null, <add> 'collate' => null, <add> ], <add> 'author_id' => [ <add> 'type' => 'integer', <add> 'null' => false, <add> 'default' => null, <add> 'length' => 11, <add> 'fixed' => null, <add> 'charset' => null, <add> 'comment' => null, <add> 'collate' => null, <add> ], <add> 'published' => [ <add> 'type' => 'boolean', <add> 'null' => true, <add> 'default' => 0, <add> 'length' => null, <add> 'fixed' => null, <add> 'charset' => null, <add> 'comment' => null, <add> 'collate' => null, <add> ], <add> 'created' => [ <add> 'type' => 'datetime', <add> 'null' => true, <add> 'default' => null, <add> 'length' => null, <add> 'fixed' => null, <add> 'charset' => null, <add> 'comment' => null, <add> 'collate' => null, <add> ], <add> ]; <add> $this->assertInstanceOf('Cake\Database\Schema\Table', $result); <add> foreach ($expected as $field => $definition) { <add> $this->assertEquals($definition, $result->column($field)); <add> } <add> } <add>}
4
PHP
PHP
fix optional routing keys with braced placeholders
63d990384911b753701c4cd1341a2966ffcaf6ef
<ide><path>src/Routing/Route/Route.php <ide> public function match(array $url, array $context = []): ?string <ide> } <ide> $url += $hostOptions; <ide> <add> // Ensure controller/action keys are not null. <add> if ( <add> (isset($keyNames['controller']) && !isset($url['controller'])) || <add> (isset($keyNames['action']) && !isset($url['action'])) <add> ) { <add> return null; <add> } <add> <ide> return $this->_writeUrl($url, $pass, $query); <ide> } <ide> <ide> protected function _writeUrl(array $params, array $pass = [], array $query = []) <ide> <ide> $search = $replace = []; <ide> foreach ($this->keys as $key) { <del> $string = null; <del> if (isset($params[$key])) { <del> $string = $params[$key]; <del> } elseif (strpos($out, $key) !== strlen($out) - strlen($key)) { <del> $key .= '/'; <add> if (!array_key_exists($key, $params)) { <add> throw new InvalidArgumentException("Missing required route key `{$key}`"); <ide> } <add> $string = $params[$key]; <ide> if ($this->braceKeys) { <ide> $search[] = "{{$key}}"; <ide> } else { <ide><path>tests/TestCase/Routing/Route/RouteTest.php <ide> public function testMatchTrailing() <ide> $this->assertEquals($expected, $result); <ide> } <ide> <add> /** <add> * Test match handles optional keys <add> * <add> * @return void <add> */ <add> public function testMatchNullValueOptionalKey() <add> { <add> $route = new Route('/path/:optional/fixed'); <add> $this->assertSame('/path/fixed', $route->match(['optional' => null])); <add> <add> $route = new Route('/path/{optional}/fixed'); <add> $this->assertSame('/path/fixed', $route->match(['optional' => null])); <add> } <add> <add> /** <add> * Test matching fails on required keys (controller/action) <add> * <add> * @return void <add> */ <add> public function testMatchControllerRequiredKeys() <add> { <add> $route = new Route('/:controller/', ['action' => 'index']); <add> $this->assertNull($route->match(['controller' => null, 'action' => 'index'])); <add> <add> $route = new Route('/test/:action', ['controller' => 'thing']); <add> $this->assertNull($route->match(['action' => null, 'controller' => 'thing'])); <add> } <add> <ide> /** <ide> * Test restructuring args with pass key <ide> * <ide><path>tests/TestCase/Routing/RouterTest.php <ide> public function testBaseUrl() <ide> }); <ide> $this->assertRegExp('/^http(s)?:\/\//', Router::url('/', true)); <ide> $this->assertRegExp('/^http(s)?:\/\//', Router::url(null, true)); <del> $this->assertRegExp('/^http(s)?:\/\//', Router::url(['_full' => true])); <add> $this->assertRegExp('/^http(s)?:\/\//', Router::url(['controller' => 'test', '_full' => true])); <ide> } <ide> <ide> /** <ide> public function testFullBaseURLFromRequest() <ide> $this->assertSame('http://cake.local', Router::fullBaseUrl()); <ide> } <ide> <del> /** <del> * testRouteDefaultParams method <del> * <del> * @return void <del> */ <del> public function testRouteDefaultParams() <del> { <del> Router::connect('/:controller', ['controller' => 'posts']); <del> $this->assertEquals(Router::url(['action' => 'index']), '/'); <del> } <del> <ide> /** <ide> * testRouteExists method <ide> * <ide> * @return void <ide> */ <ide> public function testRouteExists() <ide> { <del> Router::connect('/:controller/:action', ['controller' => 'posts']); <del> $this->assertTrue(Router::routeExists(['action' => 'view'])); <add> Router::connect('/posts/:action', ['controller' => 'posts']); <add> $this->assertTrue(Router::routeExists(['controller' => 'posts', 'action' => 'view'])); <ide> <ide> $this->assertFalse(Router::routeExists(['action' => 'view', 'controller' => 'users', 'plugin' => 'test'])); <ide> } <ide><path>tests/TestCase/View/Helper/HtmlHelperTest.php <ide> public function tearDown(): void <ide> public function testLink() <ide> { <ide> Router::reload(); <add> Router::connect('/:controller', ['action' => 'index']); <ide> Router::connect('/:controller/:action/*'); <add> Router::setRequest(new ServerRequest()); <ide> <ide> $this->View->setRequest($this->View->getRequest()->withAttribute('webroot', '')); <ide> <ide> $result = $this->Html->link('/home'); <ide> $expected = ['a' => ['href' => '/home'], 'preg:/\/home/', '/a']; <ide> $this->assertHtml($expected, $result); <ide> <del> $result = $this->Html->link(['action' => 'login', '<[You]>']); <add> $result = $this->Html->link(['controller' => 'users', 'action' => 'login', '<[You]>']); <ide> $expected = [ <del> 'a' => ['href' => '/login/%3C%5BYou%5D%3E'], <del> 'preg:/\/login\/&lt;\[You\]&gt;/', <add> 'a' => ['href' => '/users/login/%3C%5BYou%5D%3E'], <add> 'preg:/\/users\/login\/&lt;\[You\]&gt;/', <ide> '/a', <ide> ]; <ide> $this->assertHtml($expected, $result); <ide> <del> Router::reload(); <del> Router::setRequest(new ServerRequest()); <del> Router::connect('/:controller', ['action' => 'index']); <del> Router::connect('/:controller/:action/*'); <del> <ide> $result = $this->Html->link('Posts', ['controller' => 'posts', 'action' => 'index', '_full' => true]); <ide> $expected = ['a' => ['href' => Router::fullBaseUrl() . '/posts'], 'Posts', '/a']; <ide> $this->assertHtml($expected, $result); <ide><path>tests/TestCase/View/Helper/PaginatorHelperTest.php <ide> public function setUp(): void <ide> Configure::write('Config.language', 'eng'); <ide> $request = new ServerRequest([ <ide> 'url' => '/', <add> 'params' => [ <add> 'plugin' => null, <add> 'controller' => '', <add> 'action' => 'index', <add> ] <ide> ]); <ide> $request = $request->withAttribute('paging', [ <ide> 'Article' => [ <ide> public function setUp(): void <ide> Router::reload(); <ide> Router::connect('/:controller/:action/*'); <ide> Router::connect('/:plugin/:controller/:action/*'); <add> Router::setRequest($request); <ide> <ide> $this->locale = I18n::getLocale(); <ide> } <ide> public function testRoutePlaceholder() <ide> { <ide> Router::reload(); <ide> Router::connect('/:controller/:action/:page'); <del> <del> $this->View->setRequest($this->View->getRequest()->withAttribute('paging', [ <del> 'Client' => [ <del> 'page' => 8, <del> 'current' => 3, <del> 'count' => 30, <del> 'prevPage' => false, <del> 'nextPage' => 2, <del> 'pageCount' => 15, <del> ], <del> ])); <add> $request = $this->View <add> ->getRequest() <add> ->withAttribute('params', [ <add> 'plugin' => null, <add> 'controller' => 'clients', <add> 'action' => 'index', <add> ]) <add> ->withAttribute('paging', [ <add> 'Client' => [ <add> 'page' => 8, <add> 'current' => 3, <add> 'count' => 30, <add> 'prevPage' => false, <add> 'nextPage' => 2, <add> 'pageCount' => 15, <add> ], <add> ]); <add> $this->View->setRequest($request); <add> Router::setRequest($request); <ide> <ide> $this->Paginator->options(['routePlaceholders' => ['page']]); <ide> <ide> $result = $this->Paginator->numbers(); <ide> $expected = [ <del> ['li' => []], ['a' => ['href' => '/index/4']], '4', '/a', '/li', <del> ['li' => []], ['a' => ['href' => '/index/5']], '5', '/a', '/li', <del> ['li' => []], ['a' => ['href' => '/index/6']], '6', '/a', '/li', <del> ['li' => []], ['a' => ['href' => '/index/7']], '7', '/a', '/li', <add> ['li' => []], ['a' => ['href' => '/clients/index/4']], '4', '/a', '/li', <add> ['li' => []], ['a' => ['href' => '/clients/index/5']], '5', '/a', '/li', <add> ['li' => []], ['a' => ['href' => '/clients/index/6']], '6', '/a', '/li', <add> ['li' => []], ['a' => ['href' => '/clients/index/7']], '7', '/a', '/li', <ide> ['li' => ['class' => 'active']], '<a href=""', '8', '/a', '/li', <del> ['li' => []], ['a' => ['href' => '/index/9']], '9', '/a', '/li', <del> ['li' => []], ['a' => ['href' => '/index/10']], '10', '/a', '/li', <del> ['li' => []], ['a' => ['href' => '/index/11']], '11', '/a', '/li', <del> ['li' => []], ['a' => ['href' => '/index/12']], '12', '/a', '/li', <add> ['li' => []], ['a' => ['href' => '/clients/index/9']], '9', '/a', '/li', <add> ['li' => []], ['a' => ['href' => '/clients/index/10']], '10', '/a', '/li', <add> ['li' => []], ['a' => ['href' => '/clients/index/11']], '11', '/a', '/li', <add> ['li' => []], ['a' => ['href' => '/clients/index/12']], '12', '/a', '/li', <ide> ]; <ide> $this->assertHtml($expected, $result); <ide> <ide> Router::reload(); <ide> Router::connect('/:controller/:action/:sort/:direction'); <add> Router::setRequest($request); <ide> <ide> $this->Paginator->options(['routePlaceholders' => ['sort', 'direction']]); <ide> $result = $this->Paginator->sort('title'); <ide> $expected = [ <del> 'a' => ['href' => '/index/title/asc'], <add> 'a' => ['href' => '/clients/index/title/asc'], <ide> 'Title', <ide> '/a', <ide> ];
5
Javascript
Javascript
add limited support for setfill/strokecolorspace
5c1262e13bb44f28489c080081bb9b3f7fc12b1e
<ide><path>pdf.js <ide> var PartialEvaluator = (function() { <ide> <ide> if ('Form' == type.name) { <ide> // console.log("got xobj that is a Form"); <del> args[0].raw = this.evalRaw(xobj, xref, xobj.dict.get('Resources'), <add> var raw = this.evalRaw(xobj, xref, xobj.dict.get('Resources'), <ide> fonts, images, uniquePrefix); <add> var matrix = xobj.dict.get('Matrix'); <add> var bbox = xobj.dict.get('BBox'); <add> args = [raw, matrix, bbox]; <add> fn = "paintReadyFormXObject"; <ide> } <ide> if (xobj instanceof JpegStream) { <ide> images.bind(xobj); // monitoring image load <ide> var PartialEvaluator = (function() { <ide> fn = "paintReadyImageXObject"; <ide> args = [ imgData ]; <ide> <del> console.log("xobj subtype image", w, h, imageObj.imageMask); <add> // console.log("xobj subtype image", w, h, imageObj.imageMask); <ide> } <ide> } <del> console.log("xobj subtype", xobj.dict.get('Subtype').name); <add> // console.log("xobj subtype", xobj.dict.get('Subtype').name); <ide> <ide> } <ide> } else if (cmd == 'Tf') { // eagerly collect all fonts <ide> var PartialEvaluator = (function() { <ide> } <ide> } <ide> <del> // var skips = ["paintXObject"]; <del> // <del> // if (skips.indexOf(fn) != -1) { <del> // // console.log("skipping", fn); <del> // args = []; <del> // continue; <del> // } <add> // Transform some cmds. <add> switch (fn) { <add> // Parse the ColorSpace data to a raw format. <add> case "setFillColorSpace": <add> case "setStrokeColorSpace": <add> args = [ ColorSpace.parseRaw(args[0], xref, resources) ]; <add> break; <add> } <add> <add> var skips = []; <add> //var skips = ["setFillColorSpace", "setFillColor", "setStrokeColorSpace", "setStrokeColor"]; <add> <add> if (skips.indexOf(fn) != -1) { <add> // console.log("skipping", fn); <add> args = []; <add> continue; <add> } <ide> <ide> fnArray.push(fn); <ide> argsArray.push(args); <ide> var CanvasGraphics = (function() { <ide> }, <ide> <ide> // Color <del> setStrokeColorSpace: function(space) { <add> setStrokeColorSpace: function(raw) { <ide> this.current.strokeColorSpace = <del> ColorSpace.parse(space, this.xref, this.res); <add> ColorSpace.fromRaw(raw); <add> // ColorSpace.parse(space, this.xref, this.res); <ide> }, <del> setFillColorSpace: function(space) { <add> setFillColorSpace: function(raw) { <ide> this.current.fillColorSpace = <del> ColorSpace.parse(space, this.xref, this.res); <add> ColorSpace.fromRaw(raw); <add> // ColorSpace.parse(space, this.xref, this.res); <ide> }, <ide> setStrokeColor: function(/*...*/) { <ide> var cs = this.current.strokeColorSpace; <ide> var CanvasGraphics = (function() { <ide> malformed('Unknown XObject subtype ' + type.name); <ide> } <ide> }, <add> <add> paintReadyFormXObject: function(raw, matrix, bbox) { <add> this.save(); <add> <add> if (matrix && IsArray(matrix) && 6 == matrix.length) <add> this.transform.apply(this, matrix); <add> <add> if (bbox && IsArray(bbox) && 4 == bbox.length) { <add> this.rectangle.apply(this, bbox); <add> this.clip(); <add> this.endPath(); <add> } <add> <add> var code = this.pe.evalFromRaw(raw) <add> // this.execute(code, this.xref, stream.dict.get('Resources')); <add> this.execute(code, this.xref, null); <add> <add> this.restore(); <add> }, <ide> <ide> paintFormXObject: function(ref, stream) { <ide> this.save(); <ide> var ColorSpace = (function() { <ide> } <ide> return null; <ide> }; <add> <add> constructor.fromRaw = function(raw) { <add> var name; <add> if (IsArray(raw)) { <add> name = raw[0]; <add> } else { <add> name = raw; <add> } <add> <add> switch (name) { <add> case "DeviceGrayCS": <add> return new DeviceGrayCS(); <add> case "DeviceRgbCS": <add> return new DeviceRgbCS(); <add> case "DeviceCmykCS": <add> return new DeviceCmykCS(); <add> case "Pattern": <add> return new PatternCS(raw[1]); <add> default: <add> error("Unkown name " + name); <add> } <add> } <add> <add> constructor.parseRaw = function colorspace_parse(cs, xref, res) { <add> if (IsName(cs)) { <add> var colorSpaces = res.get('ColorSpace'); <add> if (IsDict(colorSpaces)) { <add> var refcs = colorSpaces.get(cs.name); <add> if (refcs) <add> cs = refcs; <add> } <add> } <add> <add> cs = xref.fetchIfRef(cs); <add> <add> if (IsName(cs)) { <add> var mode = cs.name; <add> this.mode = mode; <add> <add> switch (mode) { <add> case 'DeviceGray': <add> case 'G': <add> return "DeviceGrayCS"; <add> case 'DeviceRGB': <add> case 'RGB': <add> return "DeviceRgbCS"; <add> case 'DeviceCMYK': <add> case 'CMYK': <add> return "DeviceCmykCS"; <add> case 'Pattern': <add> return ["PatternCS", null]; <add> default: <add> error('unrecognized colorspace ' + mode); <add> } <add> } else if (IsArray(cs)) { <add> var mode = cs[0].name; <add> this.mode = mode; <add> <add> switch (mode) { <add> case 'DeviceGray': <add> case 'G': <add> return "DeviceGrayCS"; <add> case 'DeviceRGB': <add> case 'RGB': <add> return "DeviceRgbCS"; <add> case 'DeviceCMYK': <add> case 'CMYK': <add> return "DeviceCmykCS"; <add> case 'CalGray': <add> return "DeviceGrayCS"; <add> case 'CalRGB': <add> return "DeviceRgbCS"; <add> case 'ICCBased': <add> var stream = xref.fetchIfRef(cs[1]); <add> var dict = stream.dict; <add> var numComps = dict.get('N'); <add> if (numComps == 1) <add> return "DeviceGrayCS"; <add> if (numComps == 3) <add> return "DeviceRgbCS"; <add> if (numComps == 4) <add> return "DeviceCmykCS"; <add> break; <add> case 'Pattern': <add> // TODO: IMPLEMENT ME <add> <add> // var baseCS = cs[1]; <add> // if (baseCS) <add> // baseCS = ColorSpace.parse(baseCS, xref, res); <add> // return new PatternCS(baseCS); <add> case 'Indexed': <add> // TODO: IMPLEMENT ME <add> <add> // var base = ColorSpace.parse(cs[1], xref, res); <add> // var hiVal = cs[2] + 1; <add> // var lookup = xref.fetchIfRef(cs[3]); <add> // return new IndexedCS(base, hiVal, lookup); <add> case 'Separation': <add> // TODO: IMPLEMENT ME <add> <add> // var name = cs[1]; <add> // var alt = ColorSpace.parse(cs[2], xref, res); <add> // var tintFn = new PDFFunction(xref, xref.fetchIfRef(cs[3])); <add> // return new SeparationCS(alt, tintFn); <add> case 'Lab': <add> case 'DeviceN': <add> default: <add> error('unimplemented color space object "' + mode + '"'); <add> } <add> } else { <add> error('unrecognized color space object: "' + cs + '"'); <add> } <add> return null; <add> }; <ide> <ide> return constructor; <ide> })();
1
Javascript
Javascript
improve flow types
bee33a4400bda89ce80b8cf9fd74d6a07a42459b
<ide><path>Libraries/Lists/SectionList.js <ide> import type {Props as VirtualizedSectionListProps} from 'VirtualizedSectionList' <ide> <ide> type Item = any; <ide> <del>type SectionBase<SectionItemT> = { <add>export type SectionBase<SectionItemT> = { <ide> /** <ide> * The data for rendering items in this section. <ide> */ <ide> type OptionalProps<SectionT: SectionBase<any>> = { <ide> legacyImplementation?: ?boolean, <ide> }; <ide> <del>export type Props<SectionT> = RequiredProps<SectionT> & <del> OptionalProps<SectionT> & <del> VirtualizedSectionListProps<SectionT>; <del> <add>export type Props<SectionT> = { <add> ...$Exact<RequiredProps<SectionT>>, <add> ...$Exact<OptionalProps<SectionT>>, <add> ...$Exact<VirtualizedSectionListProps<SectionT>>, <add>}; <ide> const defaultProps = { <ide> ...VirtualizedSectionList.defaultProps, <ide> stickySectionHeadersEnabled: Platform.OS === 'ios',
1
Text
Text
fix documentation (missing backslashes)
8edc898f63eb9fe3739c2d8f518788a7a5f13ce0
<ide><path>README.md <ide> Training one epoch on this corpus takes about 1:20h on 4 x NVIDIA Tesla P100 wit <ide> <ide> ```shell <ide> python run_lm_finetuning.py \ <del> --bert_model bert-base-cased <del> --do_train <del> --train_file samples/sample_text.txt <del> --output_dir models <del> --num_train_epochs 5.0 <del> --learning_rate 3e-5 <del> --train_batch_size 32 <add> --bert_model bert-base-cased \ <add> --do_train \ <add> --train_file samples/sample_text.txt \ <add> --output_dir models \ <add> --num_train_epochs 5.0 \ <add> --learning_rate 3e-5 \ <add> --train_batch_size 32 \ <ide> --max_seq_length 128 <ide> ``` <ide>
1
Ruby
Ruby
remove unused methods
41c8e41ff16b629ca520ccc3d098b440fa6df1ef
<ide><path>railties/test/isolation/abstract_unit.rb <ide> def assert_welcome(resp) <ide> assert_match "charset=utf-8", resp[1]["Content-Type"] <ide> assert extract_body(resp).match(/Yay! You.*re on Rails!/) <ide> end <del> <del> def assert_success(resp) <del> assert_equal 202, resp[0] <del> end <del> <del> def assert_missing(resp) <del> assert_equal 404, resp[0] <del> end <del> <del> def assert_header(key, value, resp) <del> assert_equal value, resp[1][key.to_s] <del> end <del> <del> def assert_body(expected, resp) <del> assert_equal expected, extract_body(resp) <del> end <ide> end <ide> <ide> module Generation
1
Javascript
Javascript
fix bug in example
1c0241e5b210c14ea09ed9626072ead33bb183a9
<ide><path>src/ng/interpolate.js <ide> function $InterpolateProvider() { <ide> * <ide> * ```js <ide> * var $interpolate = ...; // injected <del> * var context = {greeting: 'Hey', name: undefined }; <add> * var context = {greeting: 'Hello', name: undefined }; <ide> * <ide> * // default "forgiving" mode <ide> * var exp = $interpolate('{{greeting}} {{name}}!');
1
Javascript
Javascript
use peekmeta + deletemeta is isolate the code-base
e46e056f1d5ed3136efbdf2136febebacd0461c6
<ide><path>packages/ember-metal/lib/chains.js <ide> import { warn } from 'ember-metal/debug'; <ide> import { get, normalizeTuple } from 'ember-metal/property_get'; <del>import { meta as metaFor } from 'ember-metal/meta'; <add>import { meta as metaFor, peekMeta } from 'ember-metal/meta'; <ide> import { watchKey, unwatchKey } from 'ember-metal/watch_key'; <ide> import EmptyObject from 'ember-metal/empty_object'; <ide> <ide> function removeChainWatcher(obj, keyName, node) { <ide> return; <ide> } <ide> <del> let m = obj.__ember_meta__; <add> let m = peekMeta(obj); <ide> <ide> if (!m || !m.readableChainWatchers()) { <ide> return; <ide> function lazyGet(obj, key) { <ide> return; <ide> } <ide> <del> var meta = obj['__ember_meta__']; <add> var meta = peekMeta(obj); <ide> <ide> // check if object meant only to be a prototype <ide> if (meta && meta.proto === obj) { <ide> ChainNode.prototype = { <ide> <ide> export function finishChains(obj) { <ide> // We only create meta if we really have to <del> let m = obj.__ember_meta__; <add> let m = peekMeta(obj); <ide> if (m) { <ide> m = metaFor(obj); <ide> <ide><path>packages/ember-metal/lib/computed.js <ide> import { assert } from 'ember-metal/debug'; <ide> import { set } from 'ember-metal/property_set'; <ide> import { inspect } from 'ember-metal/utils'; <del>import { meta as metaFor } from 'ember-metal/meta'; <add>import { meta as metaFor, peekMeta } from 'ember-metal/meta'; <ide> import expandProperties from 'ember-metal/expand_properties'; <ide> import EmberError from 'ember-metal/error'; <ide> import { <ide> ComputedPropertyPrototype.didChange = function(obj, keyName) { <ide> } <ide> <ide> // don't create objects just to invalidate <del> let meta = obj.__ember_meta__; <add> let meta = peekMeta(obj); <ide> if (!meta || meta.source !== obj) { <ide> return; <ide> } <ide> export default function computed(func) { <ide> @public <ide> */ <ide> function cacheFor(obj, key) { <del> var meta = obj.__ember_meta__; <add> var meta = peekMeta(obj); <ide> var cache = meta && meta.source === obj && meta.readableCache(); <ide> var ret = cache && cache[key]; <ide> <ide><path>packages/ember-metal/lib/events.js <ide> import { <ide> apply, <ide> applyStr <ide> } from 'ember-metal/utils'; <del>import { meta as metaFor } from 'ember-metal/meta'; <add>import { meta as metaFor, peekMeta } from 'ember-metal/meta'; <ide> <ide> import { ONCE, SUSPENDED } from 'ember-metal/meta_listeners'; <ide> <ide> function indexOf(array, target, method) { <ide> } <ide> <ide> export function accumulateListeners(obj, eventName, otherActions) { <del> var meta = obj['__ember_meta__']; <add> var meta = peekMeta(obj); <ide> if (!meta) { return; } <ide> var actions = meta.matchingListeners(eventName); <ide> var newActions = []; <ide> export function watchedEvents(obj) { <ide> */ <ide> export function sendEvent(obj, eventName, params, actions) { <ide> if (!actions) { <del> var meta = obj['__ember_meta__']; <add> var meta = peekMeta(obj); <ide> actions = meta && meta.matchingListeners(eventName); <ide> } <ide> <ide> export function sendEvent(obj, eventName, params, actions) { <ide> @param {String} eventName <ide> */ <ide> export function hasListeners(obj, eventName) { <del> var meta = obj['__ember_meta__']; <add> var meta = peekMeta(obj); <ide> if (!meta) { return false; } <ide> return meta.matchingListeners(eventName).length > 0; <ide> } <ide> export function hasListeners(obj, eventName) { <ide> */ <ide> export function listenersFor(obj, eventName) { <ide> var ret = []; <del> var meta = obj['__ember_meta__']; <add> var meta = peekMeta(obj); <ide> var actions = meta && meta.matchingListeners(eventName); <ide> <ide> if (!actions) { return ret; } <ide><path>packages/ember-metal/lib/meta.js <ide> let setMeta = function(obj, meta) { <ide> obj[META_FIELD] = meta; <ide> }; <ide> <del>export let peekMeta = function(obj) { <del> return obj[META_FIELD]; <del>}; <del> <ide> /** <ide> Retrieves the meta hash for an object. If `writable` is true ensures the <ide> hash is writable for this object as well. <ide> export function meta(obj) { <ide> export function peekMeta(obj) { <ide> return obj[META_FIELD]; <ide> } <add> <add>export function deleteMeta(obj) { <add> if (typeof obj[META_FIELD] !== 'object') { <add> return; <add> } <add> obj[META_FIELD] = null; <add>} <ide><path>packages/ember-metal/lib/mixin.js <ide> import { <ide> wrap, <ide> makeArray <ide> } from 'ember-metal/utils'; <del>import { meta as metaFor } from 'ember-metal/meta'; <add>import { meta as metaFor, peekMeta } from 'ember-metal/meta'; <ide> import expandProperties from 'ember-metal/expand_properties'; <ide> import { <ide> Descriptor, <ide> function _detect(curMixin, targetMixin, seen) { <ide> MixinPrototype.detect = function(obj) { <ide> if (!obj) { return false; } <ide> if (obj instanceof Mixin) { return _detect(obj, this, {}); } <del> var m = obj.__ember_meta__; <add> var m = peekMeta(obj); <ide> if (!m) { return false; } <ide> return !!m.peekMixins(guidFor(this)); <ide> }; <ide> MixinPrototype.keys = function() { <ide> // returns the mixins currently applied to the specified object <ide> // TODO: Make Ember.mixin <ide> Mixin.mixins = function(obj) { <del> var m = obj['__ember_meta__']; <add> var m = peekMeta(obj); <ide> var ret = []; <ide> if (!m) { return ret; } <ide> <ide><path>packages/ember-metal/lib/property_events.js <ide> import { <del> guidFor <add> guidFor, <ide> } from 'ember-metal/utils'; <add>import { <add> peekMeta <add>} from 'ember-metal/meta'; <ide> import { <ide> sendEvent, <ide> accumulateListeners <ide> var deferred = 0; <ide> @private <ide> */ <ide> function propertyWillChange(obj, keyName) { <del> var m = obj['__ember_meta__']; <add> var m = peekMeta(obj); <ide> var watching = (m && m.peekWatching(keyName) > 0) || keyName === 'length'; <ide> var proto = m && m.proto; <ide> var possibleDesc = obj[keyName]; <ide> function propertyWillChange(obj, keyName) { <ide> @private <ide> */ <ide> function propertyDidChange(obj, keyName) { <del> var m = obj['__ember_meta__']; <add> var m = peekMeta(obj); <ide> var watching = (m && m.peekWatching(keyName) > 0) || keyName === 'length'; <ide> var proto = m && m.proto; <ide> var possibleDesc = obj[keyName]; <ide><path>packages/ember-metal/lib/property_get.js <ide> import { <ide> isPath, <ide> hasThis as pathHasThis <ide> } from 'ember-metal/path_cache'; <add>import { <add> peekMeta <add>} from 'ember-metal/meta'; <ide> <ide> var FIRST_KEY = /^([^\.]+)/; <ide> <ide> export function get(obj, keyName) { <ide> return obj; <ide> } <ide> <del> var meta = obj['__ember_meta__']; <add> var meta = peekMeta(obj); <ide> var possibleDesc = obj[keyName]; <ide> var desc = (possibleDesc !== null && typeof possibleDesc === 'object' && possibleDesc.isDescriptor) ? possibleDesc : undefined; <ide> var ret; <ide><path>packages/ember-metal/lib/property_set.js <ide> import { <ide> isPath, <ide> hasThis as pathHasThis <ide> } from 'ember-metal/path_cache'; <add>import { <add> peekMeta <add>} from 'ember-metal/meta'; <ide> <ide> /** <ide> Sets the value of a property on an object, respecting computed properties <ide> export function set(obj, keyName, value, tolerant) { <ide> <ide> var meta, possibleDesc, desc; <ide> if (obj) { <del> meta = obj['__ember_meta__']; <add> meta = peekMeta(obj); <ide> possibleDesc = obj[keyName]; <ide> desc = (possibleDesc !== null && typeof possibleDesc === 'object' && possibleDesc.isDescriptor) ? possibleDesc : undefined; <ide> } <ide><path>packages/ember-metal/lib/watching.js <ide> import { <ide> import { <ide> isPath <ide> } from 'ember-metal/path_cache'; <add>import { <add> peekMeta, <add> deleteMeta <add>} from 'ember-metal/meta'; <ide> <ide> /** <ide> Starts watching a property on an object. Whenever the property changes, <ide> function watch(obj, _keyPath, m) { <ide> export { watch }; <ide> <ide> export function isWatching(obj, key) { <del> var meta = obj['__ember_meta__']; <add> var meta = peekMeta(obj); <ide> return (meta && meta.peekWatching(key)) > 0; <ide> } <ide> <ide> var NODE_STACK = []; <ide> @private <ide> */ <ide> export function destroy(obj) { <del> var meta = obj['__ember_meta__']; <add> var meta = peekMeta(obj); <ide> var node, nodes, key, nodeObject; <ide> <ide> if (meta) { <del> obj['__ember_meta__'] = null; <add> deleteMeta(obj); <ide> // remove chainWatchers to remove circular references that would prevent GC <ide> node = meta.readableChains(); <ide> if (node) { <ide><path>packages/ember-metal/tests/chains_test.js <ide> import { finishChains } from 'ember-metal/chains'; <ide> import { defineProperty } from 'ember-metal/properties'; <ide> import computed from 'ember-metal/computed'; <ide> import { propertyDidChange } from 'ember-metal/property_events'; <add>import { peekMeta } from 'ember-metal/meta'; <add> <ide> QUnit.module('Chains'); <ide> <ide> QUnit.test('finishChains should properly copy chains from prototypes to instances', function() { <ide> QUnit.test('finishChains should properly copy chains from prototypes to instance <ide> <ide> var childObj = Object.create(obj); <ide> finishChains(childObj); <del> ok(obj['__ember_meta__'].readableChains() !== childObj['__ember_meta__'].readableChains(), 'The chains object is copied'); <add> ok(peekMeta(obj) !== peekMeta(childObj).readableChains(), 'The chains object is copied'); <ide> }); <ide> <ide> <ide><path>packages/ember-runtime/tests/system/object/destroy_test.js <ide> import { <ide> } from 'ember-metal/property_events'; <ide> import { testBoth } from 'ember-metal/tests/props_helper'; <ide> import EmberObject from 'ember-runtime/system/object'; <del> <add>import { peekMeta } from 'ember-metal/meta'; <ide> QUnit.module('ember-runtime/system/object/destroy_test'); <ide> <ide> testBoth('should schedule objects to be destroyed at the end of the run loop', function(get, set) { <ide> testBoth('should schedule objects to be destroyed at the end of the run loop', f <ide> <ide> run(function() { <ide> obj.destroy(); <del> meta = obj['__ember_meta__']; <add> meta = peekMeta(obj); <ide> ok(meta, 'meta is not destroyed immediately'); <ide> ok(get(obj, 'isDestroying'), 'object is marked as destroying immediately'); <ide> ok(!get(obj, 'isDestroyed'), 'object is not destroyed immediately'); <ide> }); <ide> <del> meta = obj['__ember_meta__']; <add> meta = peekMeta(obj); <ide> ok(!meta, 'meta is destroyed after run loop finishes'); <ide> ok(get(obj, 'isDestroyed'), 'object is destroyed after run loop finishes'); <ide> });
11
Python
Python
add test for array priorities involving scalars
5a9fe508e8df1f5a9ed2e0fc33da1b2d72ef4590
<ide><path>numpy/core/tests/test_umath.py <ide> def __array_wrap__(self, arr, context): <ide> self.failUnless(isinstance(x, with_wrap)) <ide> assert_array_equal(x, np.array((1, 2, 3))) <ide> <add> def test_priority_with_scalar(self): <add> # test fix for bug #826: <add> class A(np.ndarray): <add> __array_priority__ = 10 <add> def __new__(cls): <add> return np.asarray(1.0, 'float64').view(cls).copy() <add> a = A() <add> x = np.float64(1)*a <add> self.failUnless(isinstance(x, A)) <add> assert_array_equal(x, np.array(1)) <add> <ide> def test_old_wrap(self): <ide> class with_wrap(object): <ide> def __array__(self):
1
Java
Java
remove logical adjustments from flatviewgroup
28654aef65913c8c14bd1102c69ca576fe3518e8
<ide><path>ReactAndroid/src/main/java/com/facebook/react/flat/DrawView.java <ide> <ide> // These should only ever be set from within the DrawView, their only purpose is to prevent <ide> // excessive rounding on the UI thread in FlatViewGroup, and they are left package protected to <del> // speed up direct access. <add> // speed up direct access. For overflow visible, these are the adjusted bounds while taking <add> // overflowing elements into account. <ide> /* package */ int mLogicalLeft; <ide> /* package */ int mLogicalTop; <ide> /* package */ int mLogicalRight; <ide><path>ReactAndroid/src/main/java/com/facebook/react/flat/FlatNativeViewHierarchyManager.java <ide> public void addRootView( <ide> int reactTag, <ide> @Nullable DrawCommand[] drawCommands, <ide> @Nullable AttachDetachListener[] listeners, <del> @Nullable NodeRegion[] nodeRegions, <del> Rect logicalAdjustment) { <add> @Nullable NodeRegion[] nodeRegions) { <ide> FlatViewGroup view = (FlatViewGroup) resolveView(reactTag); <ide> if (drawCommands != null) { <del> view.mountDrawCommands(drawCommands, logicalAdjustment); <add> view.mountDrawCommands(drawCommands); <ide> } <ide> if (listeners != null) { <ide> view.mountAttachDetachListeners(listeners); <ide><path>ReactAndroid/src/main/java/com/facebook/react/flat/FlatShadowNode.java <ide> protected final void invalidate() { <ide> } <ide> } <ide> <del> /* package */ final Rect getLogicalOffset() { <del> return mLogicalOffset; <del> } <del> <ide> /* package */ void updateNodeRegion( <ide> float left, <ide> float top, <ide><path>ReactAndroid/src/main/java/com/facebook/react/flat/FlatUIViewOperationQueue.java <ide> private final class UpdateMountState implements UIOperation { <ide> private final @Nullable DrawCommand[] mDrawCommands; <ide> private final @Nullable AttachDetachListener[] mAttachDetachListeners; <ide> private final @Nullable NodeRegion[] mNodeRegions; <del> private final Rect mLogicalAdjustment; <ide> <ide> private UpdateMountState( <ide> int reactTag, <ide> @Nullable DrawCommand[] drawCommands, <ide> @Nullable AttachDetachListener[] listeners, <del> @Nullable NodeRegion[] nodeRegions, <del> Rect logicalAdjustment) { <add> @Nullable NodeRegion[] nodeRegions) { <ide> mReactTag = reactTag; <ide> mDrawCommands = drawCommands; <ide> mAttachDetachListeners = listeners; <ide> mNodeRegions = nodeRegions; <del> mLogicalAdjustment = logicalAdjustment; <ide> } <ide> <ide> @Override <ide> public void execute() { <ide> mReactTag, <ide> mDrawCommands, <ide> mAttachDetachListeners, <del> mNodeRegions, <del> mLogicalAdjustment); <add> mNodeRegions); <ide> } <ide> } <ide> <ide> public void enqueueUpdateMountState( <ide> int reactTag, <ide> @Nullable DrawCommand[] drawCommands, <ide> @Nullable AttachDetachListener[] listeners, <del> @Nullable NodeRegion[] nodeRegions, <del> Rect logicalOffset) { <add> @Nullable NodeRegion[] nodeRegions) { <ide> enqueueUIOperation(new UpdateMountState( <ide> reactTag, <ide> drawCommands, <ide> listeners, <del> nodeRegions, <del> logicalOffset)); <add> nodeRegions)); <ide> } <ide> <ide> public void enqueueUpdateViewGroup(int reactTag, int[] viewsToAdd, int[] viewsToDetach) { <ide><path>ReactAndroid/src/main/java/com/facebook/react/flat/FlatViewGroup.java <ide> public void dispatchImageLoadEvent(int reactTag, int imageLoadEvent) { <ide> private static final ArrayList<View> EMPTY_DETACHED_VIEWS = new ArrayList<>(0); <ide> private @Nullable DrawCommandManager mDrawCommandManager; <ide> <del> // for overflow visible, these adjustments are what we can apply to know the actual bounds of <del> // a ViewGroup while taking overflowing elements into account. <del> /* package */ Rect mLogicalAdjustments = EMPTY_RECT; <del> <ide> /* package */ FlatViewGroup(Context context) { <ide> super(context); <ide> setClipChildren(false); <ide> public PointerEvents getPointerEvents() { <ide> ++mDrawChildIndex; <ide> } <ide> <del> /* package */ void mountDrawCommands(DrawCommand[] drawCommands, Rect logicalAdjustments) { <del> mLogicalAdjustments = logicalAdjustments; <add> /* package */ void mountDrawCommands(DrawCommand[] drawCommands) { <ide> if (mDrawCommandManager != null) { <ide> mDrawCommandManager.mountDrawCommands(drawCommands); <ide> } else { <ide><path>ReactAndroid/src/main/java/com/facebook/react/flat/StateBuilder.java <ide> private boolean collectStateForMountableNode( <ide> node.getReactTag(), <ide> drawCommands, <ide> listeners, <del> nodeRegions, <del> node.getLogicalOffset()); <add> nodeRegions); <ide> } <ide> <ide> if (node.hasUnseenUpdates()) {
6
Javascript
Javascript
move common code into separate module
42c0214254df5ade315daf4a51580f0424a1792f
<ide><path>lib/wasm/WasmMainTemplatePlugin.js <ide> <ide> const Template = require("../Template"); <ide> const WebAssemblyImportDependency = require("../dependencies/WebAssemblyImportDependency"); <add>const WebAssemblyUtils = require("./WebAssemblyUtils"); <add> <add>/** @typedef {import("../Module")} Module */ <ide> <ide> // Get all wasm modules <ide> function getAllWasmModules(chunk) { <ide> function getAllWasmModules(chunk) { <ide> return array; <ide> } <ide> <add>/** <add> * generates the import object function for a module <add> * @param {Module} module the module <add> * @returns {string} source code <add> */ <ide> function generateImportObject(module) { <ide> const waitForInstances = new Map(); <ide> const properties = []; <del> let importIndex = 0; <del> for (const dep of module.dependencies) { <del> if (dep instanceof WebAssemblyImportDependency) { <del> // Ignore global they will be handled later <del> if (dep.description.type === "GlobalType") { <del> continue; <del> } <del> <del> if (dep.module === null) { <del> // Dependency was not found, an error will be thrown later <del> continue; <del> } <add> const usedWasmDependencies = WebAssemblyUtils.getUsedDependencies(module); <add> for (const usedDep of usedWasmDependencies) { <add> const dep = usedDep.dependency; <add> const importedModule = dep.module; <add> const exportName = dep.name; <add> const usedName = importedModule && importedModule.isUsed(exportName); <add> const description = dep.description; <add> const direct = dep.onlyDirectImport; <ide> <del> const importedModule = dep.module; <del> const exportName = dep.name; <del> const usedName = importedModule && importedModule.isUsed(exportName); <del> if (usedName !== false) { <del> const description = dep.description; <del> const direct = dep.onlyDirectImport; <add> const propertyName = usedDep.name; <ide> <del> const index = importIndex++; <add> if (direct) { <add> const instanceVar = `m${waitForInstances.size}`; <add> waitForInstances.set(instanceVar, importedModule.id); <add> properties.push( <add> `${JSON.stringify(propertyName)}: ${instanceVar}` + <add> `[${JSON.stringify(usedName)}]` <add> ); <add> } else { <add> const params = description.signature.params.map( <add> (param, k) => "p" + k + param.valtype <add> ); <ide> <del> const propertyName = Template.numberToIdentifer(index); <add> const mod = `installedModules[${JSON.stringify(importedModule.id)}]`; <add> const func = `${mod}.exports[${JSON.stringify(usedName)}]`; <ide> <del> if (direct) { <del> const instanceVar = `m${waitForInstances.size}`; <del> waitForInstances.set(instanceVar, importedModule.id); <del> properties.push( <del> `${JSON.stringify(propertyName)}: ${instanceVar}` + <del> `[${JSON.stringify(usedName)}]` <del> ); <del> } else { <del> const params = description.signature.params.map( <del> (param, k) => "p" + k + param.valtype <del> ); <del> <del> const mod = `installedModules[${JSON.stringify(importedModule.id)}]`; <del> const func = `${mod}.exports[${JSON.stringify(usedName)}]`; <del> <del> properties.push( <del> Template.asString([ <del> `${JSON.stringify(propertyName)}: ` + <del> (importedModule.type.startsWith("webassembly") <del> ? `${mod} ? ${func} : ` <del> : "") + <del> `function(${params}) {`, <del> Template.indent([`return ${func}(${params});`]), <del> "}" <del> ]) <del> ); <del> } <del> } <add> properties.push( <add> Template.asString([ <add> `${JSON.stringify(propertyName)}: ` + <add> (importedModule.type.startsWith("webassembly") <add> ? `${mod} ? ${func} : ` <add> : "") + <add> `function(${params}) {`, <add> Template.indent([`return ${func}(${params});`]), <add> "}" <add> ]) <add> ); <ide> } <ide> } <ide> <ide> class WasmMainTemplatePlugin { <ide> Template.indent([ <ide> "promise = Promise.all([WebAssembly.compileStreaming(req), importObject]).then(function(items) {", <ide> Template.indent([ <del> "return WebAssembly.instantiate(items[0], {a:items[1]});" <add> "return WebAssembly.instantiate(items[0], " + <add> `{ ${WebAssemblyUtils.MANGLED_MODULE}: items[1] });` <ide> ]), <ide> "});" <ide> ]), <ide> "} else if(typeof WebAssembly.instantiateStreaming === 'function') {", <ide> Template.indent([ <del> "promise = WebAssembly.instantiateStreaming(req, {a:importObject});" <add> "promise = WebAssembly.instantiateStreaming(req, " + <add> `{ ${WebAssemblyUtils.MANGLED_MODULE}: importObject });` <ide> ]) <ide> ]) <ide> : Template.asString([ <ide> class WasmMainTemplatePlugin { <ide> ]), <ide> "]).then(function(items) {", <ide> Template.indent([ <del> "return WebAssembly.instantiate(items[0], {a:items[1]});" <add> "return WebAssembly.instantiate(items[0], " + <add> `{ ${WebAssemblyUtils.MANGLED_MODULE}: items[1] });` <ide> ]), <ide> "});" <ide> ]) <ide> class WasmMainTemplatePlugin { <ide> "var bytesPromise = req.then(function(x) { return x.arrayBuffer(); });", <ide> "promise = bytesPromise.then(function(bytes) {", <ide> Template.indent([ <del> "return WebAssembly.instantiate(bytes, {a:importObject});" <add> "return WebAssembly.instantiate(bytes, " + <add> `{ ${WebAssemblyUtils.MANGLED_MODULE}: importObject });` <ide> ]), <ide> "});" <ide> ]), <ide><path>lib/wasm/WebAssemblyGenerator.js <ide> <ide> const Generator = require("../Generator"); <ide> const Template = require("../Template"); <del>const WebAssemblyImportDependency = require("../dependencies/WebAssemblyImportDependency"); <add>const WebAssemblyUtils = require("./WebAssemblyUtils"); <ide> const { RawSource } = require("webpack-sources"); <ide> <ide> const { editWithAST, addWithAST } = require("@webassemblyjs/wasm-edit"); <ide> const { decode } = require("@webassemblyjs/wasm-parser"); <ide> const t = require("@webassemblyjs/ast"); <ide> <add>/** @typedef {import("../Module")} Module */ <add>/** @typedef {import("./WebAssemblyUtils").UsedWasmDependency} UsedWasmDependency */ <add> <ide> function compose(...fns) { <ide> return fns.reduce((prevFn, nextFn) => { <ide> return value => nextFn(prevFn(value)); <ide> const rewriteExportNames = ({ ast, module }) => bin => { <ide> }); <ide> }; <ide> <del>const rewriteImports = state => bin => { <del> const importMangleMap = state.importMangleMap; <del> return edit(bin, { <add>/** <add> * Mangle import names and modules <add> * @param {Object} state state <add> * @param {Object} state.ast Module's ast <add> * @param {Map<string, UsedWasmDependency>} state.usedDependencyMap mappings to mangle names <add> * @returns {ArrayBufferTransform} transform <add> */ <add>const rewriteImports = ({ ast, usedDependencyMap }) => bin => { <add> return editWithAST(ast, bin, { <ide> ModuleImport(path) { <del> const result = importMangleMap.get( <add> const result = usedDependencyMap.get( <ide> path.node.module + ":" + path.node.name <ide> ); <ide> if (result === undefined) { <ide> path.remove(); <ide> } else { <del> path.node.module = "a"; <del> path.node.name = result; <add> path.node.module = WebAssemblyUtils.MANGLED_MODULE; <add> path.node.name = result.name; <ide> if (path.node.descr.id) <ide> path.node.descr.id = t.numberLiteral(+path.node.descr.id.raw); <ide> if (path.node.descr.name) <ide> const addInitFunction = ({ <ide> return addWithAST(ast, bin, [func, moduleExport, funcindex, functype]); <ide> }; <ide> <del>const getImportMangleMap = module => { <del> /** @type {Map<string,string>} */ <add>/** <add> * Extract mangle mappings from module <add> * @param {Module} module current module <add> * @returns {Map<string, UsedWasmDependency>} mappings to mangled names <add> */ <add>const getUsedDependencyMap = module => { <add> /** @type {Map<string, UsedWasmDependency>} */ <ide> const map = new Map(); <del> let importIndex = 0; <del> for (const dep of module.dependencies) { <del> if (dep instanceof WebAssemblyImportDependency) { <del> if (dep.description.type === "GlobalType" || dep.module === null) { <del> continue; <del> } <del> <del> const importedModule = dep.module; <del> const request = dep.request; <del> const exportName = dep.name; <del> const usedName = importedModule && importedModule.isUsed(exportName); <del> if (usedName !== false) { <del> map.set( <del> request + ":" + exportName, <del> Template.numberToIdentifer(importIndex++) <del> ); <del> } <del> } <add> for (const usedDep of WebAssemblyUtils.getUsedDependencies(module)) { <add> const dep = usedDep.dependency; <add> const request = dep.request; <add> const exportName = dep.name; <add> map.set(request + ":" + exportName, usedDep); <ide> } <ide> return map; <ide> }; <ide> class WebAssemblyGenerator extends Generator { <ide> const nextFuncIndex = getNextFuncIndex(ast, countImportedFunc); <ide> const nextTypeIndex = getNextTypeIndex(ast); <ide> <del> const importMangleMap = getImportMangleMap(module); <add> const usedDependencyMap = getUsedDependencyMap(module); <ide> <ide> const transform = compose( <ide> rewriteExportNames({ <ide> class WebAssemblyGenerator extends Generator { <ide> rewriteImportedGlobals({ ast }), <ide> <ide> rewriteImports({ <del> importMangleMap <add> ast, <add> usedDependencyMap <ide> }), <ide> <ide> addInitFunction({ <ide><path>lib/wasm/WebAssemblyUtils.js <add>/* <add> MIT License http://www.opensource.org/licenses/mit-license.php <add> Author Tobias Koppers @sokra <add>*/ <add>"use strict"; <add> <add>const Template = require("../Template"); <add>const WebAssemblyImportDependency = require("../dependencies/WebAssemblyImportDependency"); <add> <add>/** @typedef {import("../Module")} Module */ <add> <add>/** @typedef {Object} UsedWasmDependency <add> * @property {WebAssemblyImportDependency} dependency the dependency <add> * @property {string} name the export name <add> */ <add> <add>const MANGLED_MODULE = "a"; <add> <add>/** <add> * @param {Module} module the module <add> * @returns {UsedWasmDependency[]} used dependencies and mangled name <add> */ <add>const getUsedDependencies = module => { <add> /** @type {UsedWasmDependency[]} */ <add> const array = []; <add> let importIndex = 0; <add> for (const dep of module.dependencies) { <add> if (dep instanceof WebAssemblyImportDependency) { <add> if (dep.description.type === "GlobalType" || dep.module === null) { <add> continue; <add> } <add> <add> const importedModule = dep.module; <add> const exportName = dep.name; <add> const usedName = importedModule && importedModule.isUsed(exportName); <add> if (usedName !== false) { <add> array.push({ <add> dependency: dep, <add> name: Template.numberToIdentifer(importIndex++) <add> }); <add> } <add> } <add> } <add> return array; <add>}; <add> <add>exports.getUsedDependencies = getUsedDependencies; <add>exports.MANGLED_MODULE = MANGLED_MODULE;
3
Mixed
Javascript
add strict functionality export
a319e90807bbc74b6d0e85ee9bec697acb68ebcb
<ide><path>doc/api/assert.md <ide> The `assert` module provides a simple set of assertion tests that can be used to <ide> test invariants. <ide> <add>A `strict` and a `legacy` mode exist, while it is recommended to only use <add>[`strict mode`][]. <add> <ide> For more information about the used equality comparisons see <ide> [MDN's guide on equality comparisons and sameness][mdn-equality-guide]. <ide> <add>## Strict mode <add><!-- YAML <add>added: REPLACEME <add>changes: <add> - version: REPLACEME <add> pr-url: https://github.com/nodejs/node/pull/17002 <add> description: Added strict mode to the assert module. <add>--> <add> <add>When using the `strict mode`, any `assert` function will use the equality used in <add>the strict function mode. So [`assert.deepEqual()`][] will, for example, work the <add>same as [`assert.deepStrictEqual()`][]. <add> <add>It can be accessed using: <add> <add>```js <add>const assert = require('assert').strict; <add>``` <add> <add>## Legacy mode <add> <add>> Stability: 0 - Deprecated: Use strict mode instead. <add> <add>When accessing `assert` directly instead of using the `strict` property, the <add>[Abstract Equality Comparison][] will be used for any function without a <add>"strict" in its name (e.g. [`assert.deepEqual()`][]). <add> <add>It can be accessed using: <add> <add>```js <add>const assert = require('assert'); <add>``` <add> <add>It is recommended to use the [`strict mode`][] instead as the <add>[Abstract Equality Comparison][] can often have surprising results. Especially <add>in case of [`assert.deepEqual()`][] as the used comparison rules there are very <add>lax. <add> <add>E.g. <add> <add>```js <add>// WARNING: This does not throw an AssertionError! <add>assert.deepEqual(/a/gi, new Date()); <add>``` <add> <ide> ## assert(value[, message]) <ide> <!-- YAML <ide> added: v0.5.9 <ide> changes: <ide> * `expected` {any} <ide> * `message` {any} <ide> <add>**Strict mode** <add> <add>An alias of [`assert.deepStrictEqual()`][]. <add> <add>**Legacy mode** <add> <add>> Stability: 0 - Deprecated: Use [`assert.deepStrictEqual()`][] instead. <add> <ide> Tests for deep equality between the `actual` and `expected` parameters. <ide> Primitive values are compared with the [Abstract Equality Comparison][] <ide> ( `==` ). <ide> are recursively evaluated also by the following rules. <ide> [`Object.is()`][]. <ide> * [Type tags][Object.prototype.toString()] of objects should be the same. <ide> * [`[[Prototype]]`][prototype-spec] of objects are compared using <del> the [Strict Equality Comparison][] too. <add> the [Strict Equality Comparison][]. <ide> * Only [enumerable "own" properties][] are considered. <ide> * [`Error`][] names and messages are always compared, even if these are not <ide> enumerable properties. <ide> are recursively evaluated also by the following rules. <ide> reference. <ide> <ide> ```js <del>const assert = require('assert'); <add>const assert = require('assert').strict; <ide> <ide> assert.deepStrictEqual({ a: 1 }, { a: '1' }); <ide> // AssertionError: { a: 1 } deepStrictEqual { a: '1' } <ide> added: v0.1.21 <ide> * `expected` {any} <ide> * `message` {any} <ide> <add>**Strict mode** <add> <add>An alias of [`assert.strictEqual()`][]. <add> <add>**Legacy mode** <add> <add>> Stability: 0 - Deprecated: Use [`assert.strictEqual()`][] instead. <add> <ide> Tests shallow, coercive equality between the `actual` and `expected` parameters <ide> using the [Abstract Equality Comparison][] ( `==` ). <ide> <ide> all stack frames above that function will be removed from stacktrace (see <ide> `Failed` will be used. <ide> <ide> ```js <del>const assert = require('assert'); <add>const assert = require('assert').strict; <ide> <ide> assert.fail(1, 2, undefined, '>'); <ide> // AssertionError [ERR_ASSERTION]: 1 > 2 <ide> Throws `value` if `value` is truthy. This is useful when testing the `error` <ide> argument in callbacks. <ide> <ide> ```js <del>const assert = require('assert'); <add>const assert = require('assert').strict; <ide> <ide> assert.ifError(0); <ide> // OK <ide> changes: <ide> * `expected` {any} <ide> * `message` {any} <ide> <add>**Strict mode** <add> <add>An alias of [`assert.notDeepStrictEqual()`][]. <add> <add>**Legacy mode** <add> <add>> Stability: 0 - Deprecated: Use [`assert.notDeepStrictEqual()`][] instead. <add> <ide> Tests for any deep inequality. Opposite of [`assert.deepEqual()`][]. <ide> <ide> ```js <ide> changes: <ide> Tests for deep strict inequality. Opposite of [`assert.deepStrictEqual()`][]. <ide> <ide> ```js <del>const assert = require('assert'); <add>const assert = require('assert').strict; <ide> <ide> assert.notDeepStrictEqual({ a: 1 }, { a: '1' }); <ide> // OK <ide> added: v0.1.21 <ide> * `expected` {any} <ide> * `message` {any} <ide> <add>**Strict mode** <add> <add>An alias of [`assert.notStrictEqual()`][]. <add> <add>**Legacy mode** <add> <add>> Stability: 0 - Deprecated: Use [`assert.notStrictEqual()`][] instead. <add> <ide> Tests shallow, coercive inequality with the [Abstract Equality Comparison][] <ide> ( `!=` ). <ide> <ide> Tests strict inequality between the `actual` and `expected` parameters as <ide> determined by the [SameValue Comparison][]. <ide> <ide> ```js <del>const assert = require('assert'); <add>const assert = require('assert').strict; <ide> <ide> assert.notStrictEqual(1, 2); <ide> // OK <ide> parameter is an instance of an [`Error`][] then it will be thrown instead of the <ide> `AssertionError`. <ide> <ide> ```js <del>const assert = require('assert'); <add>const assert = require('assert').strict; <ide> <ide> assert.ok(true); <ide> // OK <ide> Tests strict equality between the `actual` and `expected` parameters as <ide> determined by the [SameValue Comparison][]. <ide> <ide> ```js <del>const assert = require('assert'); <add>const assert = require('assert').strict; <ide> <ide> assert.strictEqual(1, 2); <ide> // AssertionError: 1 strictEqual 2 <ide> assert.throws(myFunction, /missing foo/, 'did not throw with expected message'); <ide> [`TypeError`]: errors.html#errors_class_typeerror <ide> [`assert.deepEqual()`]: #assert_assert_deepequal_actual_expected_message <ide> [`assert.deepStrictEqual()`]: #assert_assert_deepstrictequal_actual_expected_message <add>[`assert.notDeepStrictEqual()`]: #assert_assert_notdeepstrictequal_actual_expected_message <add>[`assert.notStrictEqual()`]: #assert_assert_notstrictequal_actual_expected_message <ide> [`assert.ok()`]: #assert_assert_ok_value_message <add>[`assert.strictEqual()`]: #assert_assert_strictequal_actual_expected_message <ide> [`assert.throws()`]: #assert_assert_throws_block_error_message <add>[`strict mode`]: #assert_strict_mode <ide> [Abstract Equality Comparison]: https://tc39.github.io/ecma262/#sec-abstract-equality-comparison <ide> [Object.prototype.toString()]: https://tc39.github.io/ecma262/#sec-object.prototype.tostring <ide> [SameValue Comparison]: https://tc39.github.io/ecma262/#sec-samevalue <ide><path>doc/api/deprecations.md <ide> Type: End-of-Life <ide> cause a lot of issues. See https://github.com/nodejs/node/issues/14328 for more <ide> details. <ide> <add><a id="DEP0089"></a> <add>### DEP0089: require('assert') <add> <add>Type: Documentation-only <add> <add>Importing assert directly is not recommended as the exposed functions will use <add>loose equality checks. Use `require('assert').strict` instead. The API is the <add>same as the legacy assert but it will always use strict equality checks. <add> <ide> [`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size <ide> [`Buffer.from(array)`]: buffer.html#buffer_class_method_buffer_from_array <ide> [`Buffer.from(buffer)`]: buffer.html#buffer_class_method_buffer_from_buffer <ide><path>lib/assert.js <ide> assert.doesNotThrow = function doesNotThrow(block, error, message) { <ide> }; <ide> <ide> assert.ifError = function ifError(err) { if (err) throw err; }; <add> <add>// Expose a strict only variant of assert <add>function strict(value, message) { <add> if (!value) innerFail(value, true, message, '==', strict); <add>} <add>assert.strict = Object.assign(strict, assert, { <add> equal: assert.strictEqual, <add> deepEqual: assert.deepStrictEqual, <add> notEqual: assert.notStrictEqual, <add> notDeepEqual: assert.notDeepStrictEqual <add>}); <add>assert.strict.strict = assert.strict; <ide><path>test/parallel/test-assert.js <ide> common.expectsError( <ide> message: /^'Error: foo' strictEqual 'Error: foobar'$/ <ide> } <ide> ); <add> <add>// Test strict assert <add>{ <add> const a = require('assert'); <add> const assert = require('assert').strict; <add> /* eslint-disable no-restricted-properties */ <add> assert.throws(() => assert.equal(1, true), assert.AssertionError); <add> assert.notEqual(0, false); <add> assert.throws(() => assert.deepEqual(1, true), assert.AssertionError); <add> assert.notDeepEqual(0, false); <add> assert.equal(assert.strict, assert.strict.strict); <add> assert.equal(assert.equal, assert.strictEqual); <add> assert.equal(assert.deepEqual, assert.deepStrictEqual); <add> assert.equal(assert.notEqual, assert.notStrictEqual); <add> assert.equal(assert.notDeepEqual, assert.notDeepStrictEqual); <add> assert.equal(Object.keys(assert).length, Object.keys(a).length); <add> /* eslint-enable no-restricted-properties */ <add> assert(7); <add>}
4
Java
Java
throw a proper exception if no convert is found
12a9df8a1c1a24afdaabd615de33ed265250fa4d
<ide><path>spring-jms/src/main/java/org/springframework/jms/messaging/JmsMessagingTemplate.java <ide> public Message<?> receive(String destinationName) throws MessagingException { <ide> } <ide> <ide> @Override <del> @SuppressWarnings("unchecked") <ide> public <T> T receiveAndConvert(String destinationName, Class<T> targetClass) throws MessagingException { <ide> Message<?> message = doReceive(destinationName); <ide> if (message != null) { <del> return (T) getMessageConverter().fromMessage(message, targetClass); <add> return doConvert(message, targetClass); <ide> } <ide> else { <ide> return null; <ide><path>spring-jms/src/test/java/org/springframework/jms/messaging/JmsMessagingTemplateTests.java <ide> import javax.jms.TextMessage; <ide> <ide> import org.junit.Before; <del>import org.junit.Ignore; <ide> import org.junit.Rule; <ide> import org.junit.Test; <ide> import org.junit.rules.ExpectedException; <ide> public void receiveAndConvertWithConversion() { <ide> } <ide> <ide> @Test <del> @Ignore("SPR-11817") <ide> public void receiveAndConvertNoConverter() { <ide> javax.jms.Message jmsMessage = createJmsTextMessage("Hello"); <ide> given(jmsTemplate.receive("myQueue")).willReturn(jmsMessage); <ide> <del> thrown.expect(MessageConversionException.class); <add> thrown.expect(org.springframework.messaging.converter.MessageConversionException.class); <ide> messagingTemplate.receiveAndConvert("myQueue", Writer.class); <ide> } <ide> <ide><path>spring-messaging/src/main/java/org/springframework/messaging/core/AbstractMessageReceivingTemplate.java <ide> package org.springframework.messaging.core; <ide> <ide> import org.springframework.messaging.Message; <add>import org.springframework.messaging.converter.MessageConversionException; <add>import org.springframework.messaging.converter.MessageConverter; <ide> <ide> /** <ide> * An extension of {@link AbstractMessageSendingTemplate} that adds support for <ide> public <T> T receiveAndConvert(Class<T> targetClass) { <ide> public <T> T receiveAndConvert(D destination, Class<T> targetClass) { <ide> Message<?> message = doReceive(destination); <ide> if (message != null) { <del> return (T) getMessageConverter().fromMessage(message, targetClass); <add> return doConvert(message, targetClass); <ide> } <ide> else { <ide> return null; <ide> } <ide> } <ide> <add> @SuppressWarnings("unchecked") <add> protected <T> T doConvert(Message<?> message, Class<T> targetClass) { <add> MessageConverter messageConverter = getMessageConverter(); <add> T value = (T) messageConverter.fromMessage(message, targetClass); <add> if (value == null) { <add> throw new MessageConversionException("Unable to convert payload='" <add> + message.getPayload() + "' to type='" + targetClass <add> + "', converter=[" + messageConverter + "]"); <add> } <add> return value; <add> } <add> <ide> } <ide><path>spring-messaging/src/test/java/org/springframework/messaging/core/MessageReceivingTemplateTests.java <ide> package org.springframework.messaging.core; <ide> <ide> import org.junit.Before; <add>import org.junit.Rule; <ide> import org.junit.Test; <add>import org.junit.rules.ExpectedException; <add> <add>import org.springframework.core.convert.ConversionFailedException; <add>import org.springframework.core.convert.support.DefaultConversionService; <ide> import org.springframework.messaging.Message; <add>import org.springframework.messaging.converter.GenericMessageConverter; <add>import org.springframework.messaging.converter.MessageConversionException; <ide> import org.springframework.messaging.support.GenericMessage; <ide> <add>import static org.hamcrest.CoreMatchers.isA; <ide> import static org.junit.Assert.assertEquals; <ide> import static org.junit.Assert.assertSame; <ide> <add>import java.io.Writer; <add> <ide> /** <ide> * Unit tests for receiving operations in {@link AbstractMessagingTemplate}. <ide> * <ide> */ <ide> public class MessageReceivingTemplateTests { <ide> <add> @Rule <add> public final ExpectedException thrown = ExpectedException.none(); <add> <ide> private TestMessagingTemplate template; <ide> <ide> <ide> public void receiveAndConvertFromDestination() { <ide> assertSame("payload", payload); <ide> } <ide> <add> @Test <add> public void receiveAndConvertFailed() { <add> Message<?> expected = new GenericMessage<Object>("not a number test"); <add> this.template.setReceiveMessage(expected); <add> this.template.setMessageConverter(new GenericMessageConverter(new DefaultConversionService())); <add> <add> thrown.expect(MessageConversionException.class); <add> thrown.expectCause(isA(ConversionFailedException.class)); <add> this.template.receiveAndConvert("somewhere", Integer.class); <add> } <add> <add> @Test <add> public void receiveAndConvertNoConverter() { <add> Message<?> expected = new GenericMessage<Object>("payload"); <add> this.template.setDefaultDestination("home"); <add> this.template.setReceiveMessage(expected); <add> this.template.setMessageConverter(new GenericMessageConverter(new DefaultConversionService())); <add> <add> thrown.expect(MessageConversionException.class); <add> thrown.expectMessage("payload"); <add> this.template.receiveAndConvert(Writer.class); <add> } <add> <ide> <ide> <ide> private static class TestMessagingTemplate extends AbstractMessagingTemplate<String> {
4
Javascript
Javascript
improve smartgrouping performance
a89deee176d10f39f40ae35df4bd03974f064151
<ide><path>lib/util/smartGrouping.js <ide> <ide> /** <ide> * @template T <add> * @template R <ide> * @typedef {Object} ItemWithGroups <ide> * @property {T} item <del> * @property {Set<string>} groups <add> * @property {Set<Group<T, R>>} groups <add> */ <add> <add>/** <add> * @template T <add> * @template R <add> * @typedef {{ config: GroupConfig<T, R>, name: string, alreadyGrouped: boolean, items: Set<ItemWithGroups<T, R>> | undefined }} Group <ide> */ <ide> <ide> /** <ide> * @returns {(R | T)[]} grouped items <ide> */ <ide> const smartGrouping = (items, groupConfigs) => { <del> /** @type {Set<ItemWithGroups<T>>} */ <add> /** @type {Set<ItemWithGroups<T, R>>} */ <ide> const itemsWithGroups = new Set(); <del> /** @type {Map<string, [GroupConfig<T, R>, string]>} */ <del> const groupConfigMap = new Map(); <add> /** @type {Map<string, Group<T, R>>} */ <add> const allGroups = new Map(); <ide> for (const item of items) { <add> /** @type {Set<Group<T, R>>} */ <ide> const groups = new Set(); <ide> for (let i = 0; i < groupConfigs.length; i++) { <ide> const groupConfig = groupConfigs[i]; <ide> const keys = groupConfig.getKeys(item); <ide> if (keys) { <del> for (const group of keys) { <del> const fullGroup = `${i}:${group}`; <del> if (!groupConfigMap.has(fullGroup)) { <del> groupConfigMap.set(fullGroup, [groupConfig, group]); <add> for (const name of keys) { <add> const key = `${i}:${name}`; <add> let group = allGroups.get(key); <add> if (group === undefined) { <add> allGroups.set( <add> key, <add> (group = { <add> config: groupConfig, <add> name, <add> alreadyGrouped: false, <add> items: undefined <add> }) <add> ); <ide> } <del> groups.add(fullGroup); <add> groups.add(group); <ide> } <ide> } <ide> } <ide> const smartGrouping = (items, groupConfigs) => { <ide> groups <ide> }); <ide> } <del> const alreadyGrouped = new Set(); <ide> /** <del> * @param {Set<ItemWithGroups<T>>} itemsWithGroups input items with groups <add> * @param {Set<ItemWithGroups<T, R>>} itemsWithGroups input items with groups <ide> * @returns {(T | R)[]} groups items <ide> */ <ide> const runGrouping = itemsWithGroups => { <ide> const totalSize = itemsWithGroups.size; <del> /** @type {Map<string, Set<ItemWithGroups<T>>>} */ <del> const groupMap = new Map(); <ide> for (const entry of itemsWithGroups) { <ide> for (const group of entry.groups) { <del> if (alreadyGrouped.has(group)) continue; <del> const list = groupMap.get(group); <del> if (list === undefined) { <del> groupMap.set(group, new Set([entry])); <add> if (group.alreadyGrouped) continue; <add> const items = group.items; <add> if (items === undefined) { <add> group.items = new Set([entry]); <ide> } else { <del> list.add(entry); <add> items.add(entry); <ide> } <ide> } <ide> } <del> /** @type {Set<string>} */ <del> const usedGroups = new Set(); <add> /** @type {Map<Group<T, R>, { items: Set<ItemWithGroups<T, R>>, options: GroupOptions | false | undefined, used: boolean }>} */ <add> const groupMap = new Map(); <add> for (const group of allGroups.values()) { <add> if (group.items) { <add> const items = group.items; <add> group.items = undefined; <add> groupMap.set(group, { <add> items, <add> options: undefined, <add> used: false <add> }); <add> } <add> } <ide> /** @type {(T | R)[]} */ <ide> const results = []; <ide> for (;;) { <add> /** @type {Group<T, R>} */ <ide> let bestGroup = undefined; <ide> let bestGroupSize = -1; <ide> let bestGroupItems = undefined; <ide> let bestGroupOptions = undefined; <del> for (const [group, items] of groupMap) { <del> if (items.size === 0) continue; <del> const [groupConfig, groupKey] = groupConfigMap.get(group); <del> const options = <del> groupConfig.getOptions && <del> groupConfig.getOptions( <del> groupKey, <del> Array.from(items, ({ item }) => item) <del> ); <add> for (const [group, state] of groupMap) { <add> const { items, used } = state; <add> let options = state.options; <add> if (options === undefined) { <add> const groupConfig = group.config; <add> state.options = options = <add> (groupConfig.getOptions && <add> groupConfig.getOptions( <add> group.name, <add> Array.from(items, ({ item }) => item) <add> )) || <add> false; <add> } <add> <ide> const force = options && options.force; <ide> if (!force) { <ide> if (bestGroupOptions && bestGroupOptions.force) continue; <del> if (usedGroups.has(group)) continue; <add> if (used) continue; <ide> if (items.size <= 1 || totalSize - items.size <= 1) { <ide> continue; <ide> } <ide> const smartGrouping = (items, groupConfigs) => { <ide> itemsWithGroups.delete(item); <ide> // Remove all groups that items have from the map to not select them again <ide> for (const group of item.groups) { <del> const list = groupMap.get(group); <del> if (list !== undefined) list.delete(item); <del> if (groupChildren) { <del> usedGroups.add(group); <add> const state = groupMap.get(group); <add> if (state !== undefined) { <add> state.items.delete(item); <add> if (state.items.size === 0) { <add> groupMap.delete(group); <add> } else { <add> state.options = undefined; <add> if (groupChildren) { <add> state.used = true; <add> } <add> } <ide> } <ide> } <ide> } <ide> groupMap.delete(bestGroup); <ide> <del> const idx = bestGroup.indexOf(":"); <del> const configKey = bestGroup.slice(0, idx); <del> const key = bestGroup.slice(idx + 1); <del> const groupConfig = groupConfigs[+configKey]; <add> const key = bestGroup.name; <add> const groupConfig = bestGroup.config; <ide> <ide> const allItems = Array.from(items, ({ item }) => item); <ide> <del> alreadyGrouped.add(bestGroup); <add> bestGroup.alreadyGrouped = true; <ide> const children = groupChildren ? runGrouping(items) : allItems; <del> alreadyGrouped.delete(bestGroup); <add> bestGroup.alreadyGrouped = false; <ide> <ide> results.push(groupConfig.createGroup(key, children, allItems)); <ide> }
1
Python
Python
add map, foldl, foldr to the backend
2878f606342d1ee8167e316ae9b0d3e2870d3caf
<ide><path>keras/backend/tensorflow_backend.py <ide> def ctc_decode(y_pred, input_length, greedy=True, beam_width=100, <ide> for st in decoded] <ide> <ide> return (decoded_dense, log_prob) <add> <add> <add># HIGH ORDER FUNCTIONS <add> <add>def map_fn(fn, elems, name=None): <add> '''Map the function fn over the elements elems and return the outputs. <add> <add> # Arguments <add> fn: Callable that will be called upon each element in elems <add> elems: tensor <add> name: A string name for the map node in the graph <add> <add> # Returns <add> Tensor with first dimension equal to the elems and second depending on <add> fn <add> ''' <add> return tf.map_fn(fn, elems, name=name) <add> <add> <add>def foldl(fn, elems, initializer=None, name=None): <add> '''Reduce elems using fn to combine them from left to right. <add> <add> # Arguments <add> fn: Callable that will be called upon each element in elems and an <add> accumulator, for instance lambda acc, x: acc + x <add> elems: tensor <add> initializer: The first value used (elems[0] in case of None) <add> name: A string name for the foldl node in the graph <add> <add> # Returns <add> Same type and shape as initializer <add> ''' <add> return tf.foldl(fn, elems, initializer=initializer, name=name) <add> <add> <add>def foldr(fn, elems, initializer=None, name=None): <add> '''Reduce elems using fn to combine them from right to left. <add> <add> # Arguments <add> fn: Callable that will be called upon each element in elems and an <add> accumulator, for instance lambda acc, x: acc + x <add> elems: tensor <add> initializer: The first value used (elems[-1] in case of None) <add> name: A string name for the foldr node in the graph <add> <add> # Returns <add> Same type and shape as initializer <add> ''' <add> return tf.foldr(fn, elems, initializer=initializer, name=name) <ide><path>keras/backend/theano_backend.py <ide> def ctc_step(y_true_step, y_pred_step, input_length_step, label_length_step): <ide> <ide> ret = ret.dimshuffle('x', 0) <ide> return ret <add> <add> <add># HIGH ORDER FUNCTIONS <add> <add>def map_fn(fn, elems, name=None): <add> '''Map the function fn over the elements elems and return the outputs. <add> <add> # Arguments <add> fn: Callable that will be called upon each element in elems <add> elems: tensor, at least 2 dimensional <add> name: A string name for the map node in the graph <add> <add> # Returns <add> Tensor with first dimension equal to the elems and second depending on <add> fn <add> ''' <add> return theano.map(fn, elems, name=name)[0] <add> <add> <add>def foldl(fn, elems, initializer=None, name=None): <add> '''Reduce elems using fn to combine them from left to right. <add> <add> # Arguments <add> fn: Callable that will be called upon each element in elems and an <add> accumulator, for instance lambda acc, x: acc + x <add> elems: tensor <add> initializer: The first value used (elems[0] in case of None) <add> name: A string name for the foldl node in the graph <add> <add> # Returns <add> Same type and shape as initializer <add> ''' <add> if initializer is None: <add> initializer = elems[0] <add> elems = elems[1:] <add> <add> # We need to change the order of the arguments because theano accepts x as <add> # first parameter and accumulator as second <add> fn2 = lambda x, acc: fn(acc, x) <add> <add> return theano.foldl(fn2, elems, initializer, name=name)[0] <add> <add> <add>def foldr(fn, elems, initializer=None, name=None): <add> '''Reduce elems using fn to combine them from right to left. <add> <add> # Arguments <add> fn: Callable that will be called upon each element in elems and an <add> accumulator, for instance lambda acc, x: acc + x <add> elems: tensor <add> initializer: The first value used (elems[-1] in case of None) <add> name: A string name for the foldr node in the graph <add> <add> # Returns <add> Same type and shape as initializer <add> ''' <add> if initializer is None: <add> initializer = elems[-1] <add> elems = elems[:-1] <add> <add> # We need to change the order of the arguments because theano accepts x as <add> # first parameter and accumulator as second <add> fn2 = lambda x, acc: fn(acc, x) <add> <add> return theano.foldr(fn2, elems, initializer, name=name)[0] <ide><path>tests/keras/backend/test_backends.py <ide> def test_sparse_concat(self): <ide> assert k_s_d.shape == k_d.shape <ide> assert_allclose(k_s_d, k_d, atol=1e-05) <ide> <add> def test_map(self): <add> x = np.random.rand(10, 3).astype(np.float32) <add> for K in [KTF, KTH]: <add> kx = K.eval(K.map_fn(K.sum, x)) <add> <add> assert (10,) == kx.shape <add> assert_allclose(x.sum(axis=1), kx, atol=1e-05) <add> <add> def test_foldl(self): <add> x = np.random.rand(10, 3).astype(np.float32) <add> for K in [KTF, KTH]: <add> kx = K.eval(K.foldl(lambda a, b: a+b, x)) <add> <add> assert (3,) == kx.shape <add> assert_allclose(x.sum(axis=0), kx, atol=1e-05) <add> <add> def test_foldr(self): <add> # This test aims to make sure that we walk the array from right to left <add> # and checks it in the following way: multiplying left to right 1e-40 <add> # cannot be held into a float32 so it causes an underflow while from <add> # right to left we have no such problem and the result is larger <add> x = np.array([1e-20, 1e-20, 10, 10, 10], dtype=np.float32) <add> for K in [KTF, KTH]: <add> p1 = K.eval(K.foldl(lambda a, b: a*b, x)) <add> p2 = K.eval(K.foldr(lambda a, b: a*b, x)) <add> <add> assert p1 < p2 <add> assert 9e-38 < p2 <= 1e-37 <add> <ide> <ide> if __name__ == '__main__': <ide> pytest.main([__file__])
3
Mixed
Javascript
move pbkdf2 without digest to eol
bffa5044c576003198ccfee5a751c23036d0744f
<ide><path>doc/api/deprecations.md <ide> to the `constants` property exposed by the relevant module. For instance, <ide> ### DEP0009: `crypto.pbkdf2` without digest <ide> <!-- YAML <ide> changes: <add> - version: REPLACEME <add> pr-url: https://github.com/nodejs/node/pull/31166 <add> description: End-of-Life (for `digest === null`) <ide> - version: v11.0.0 <ide> pr-url: https://github.com/nodejs/node/pull/22861 <ide> description: Runtime deprecation (for `digest === null`). <ide> changes: <ide> description: Runtime deprecation (for `digest === undefined`). <ide> --> <ide> <del>Type: Runtime <add>Type: End-of-Life <ide> <ide> Use of the [`crypto.pbkdf2()`][] API without specifying a digest was deprecated <ide> in Node.js 6.0 because the method defaulted to using the non-recommended <ide> Node.js 8.0.0, calling `crypto.pbkdf2()` or `crypto.pbkdf2Sync()` with <ide> `digest` set to `undefined` will throw a `TypeError`. <ide> <ide> Beginning in Node.js v11.0.0, calling these functions with `digest` set to <del>`null` will print a deprecation warning to align with the behavior when `digest` <add>`null` would print a deprecation warning to align with the behavior when `digest` <ide> is `undefined`. <ide> <add>Now, however, passing either `undefined` or `null` will throw a `TypeError`. <add> <ide> <a id="DEP0010"></a> <ide> ### DEP0010: `crypto.createCredentials` <ide> <!-- YAML <ide><path>lib/internal/crypto/pbkdf2.js <ide> const { AsyncWrap, Providers } = internalBinding('async_wrap'); <ide> const { Buffer } = require('buffer'); <ide> const { pbkdf2: _pbkdf2 } = internalBinding('crypto'); <ide> const { validateUint32 } = require('internal/validators'); <del>const { deprecate } = require('internal/util'); <ide> const { <ide> ERR_CRYPTO_INVALID_DIGEST, <ide> ERR_CRYPTO_PBKDF2_ERROR, <ide> function pbkdf2Sync(password, salt, iterations, keylen, digest) { <ide> return keybuf.toString(encoding); <ide> } <ide> <del>const defaultDigest = deprecate(() => 'sha1', <del> 'Calling pbkdf2 or pbkdf2Sync with "digest" ' + <del> 'set to null is deprecated.', <del> 'DEP0009'); <del> <ide> function check(password, salt, iterations, keylen, digest) { <del> if (typeof digest !== 'string') { <del> if (digest !== null) <del> throw new ERR_INVALID_ARG_TYPE('digest', ['string', 'null'], digest); <del> digest = defaultDigest(); <del> } <add> if (typeof digest !== 'string') <add> throw new ERR_INVALID_ARG_TYPE('digest', 'string', digest); <ide> <ide> password = getArrayBufferView(password, 'password'); <ide> salt = getArrayBufferView(salt, 'salt'); <ide><path>test/parallel/test-crypto-pbkdf2.js <ide> if (!common.hasCrypto) <ide> const assert = require('assert'); <ide> const crypto = require('crypto'); <ide> <del>common.expectWarning( <del> 'DeprecationWarning', <del> 'Calling pbkdf2 or pbkdf2Sync with "digest" set to null is deprecated.', <del> 'DEP0009'); <del> <ide> // <ide> // Test PBKDF2 with RFC 6070 test vectors (except #4) <ide> // <ide> function ondone(err, key) { <ide> <ide> // Error path should not leak memory (check with valgrind). <ide> assert.throws( <del> () => crypto.pbkdf2('password', 'salt', 1, 20, null), <add> () => crypto.pbkdf2('password', 'salt', 1, 20, 'sha1'), <ide> { <ide> code: 'ERR_INVALID_CALLBACK', <ide> name: 'TypeError' <ide> assert.throws( <ide> { <ide> code: 'ERR_INVALID_ARG_TYPE', <ide> name: 'TypeError', <del> message: 'The "digest" argument must be of type string or null. ' + <add> message: 'The "digest" argument must be of type string. ' + <ide> 'Received undefined' <ide> }); <ide> <ide> assert.throws( <ide> { <ide> code: 'ERR_INVALID_ARG_TYPE', <ide> name: 'TypeError', <del> message: 'The "digest" argument must be of type string or null. ' + <add> message: 'The "digest" argument must be of type string. ' + <ide> 'Received undefined' <ide> }); <ide> <add>assert.throws( <add> () => crypto.pbkdf2Sync('password', 'salt', 8, 8, null), <add> { <add> code: 'ERR_INVALID_ARG_TYPE', <add> name: 'TypeError', <add> message: 'The "digest" argument must be of type string. ' + <add> 'Received null' <add> }); <ide> [1, {}, [], true, undefined, null].forEach((input) => { <ide> const msgPart2 = 'an instance of Buffer, TypedArray, or DataView.' + <ide> common.invalidArgTypeHelper(input);
3
Go
Go
fix issue with exit code in non-tty mode
fd38de2818d959a9f5591537515e923a3ac56632
<ide><path>commands.go <ide> func (cli *DockerCli) CmdRun(args ...string) error { <ide> return err <ide> } <ide> } else { <del> // No Autoremove: Simply retrieve the exit code <del> if _, status, err = getExitCode(cli, runResult.ID); err != nil { <del> return err <add> if !config.Tty { <add> // In non-tty mode, we can't dettach, so we know we need to wait. <add> if status, err = waitForExit(cli, runResult.ID); err != nil { <add> return err <add> } <add> } else { <add> // In TTY mode, there is a race. If the process dies too slowly, the state can be update after the getExitCode call <add> // and result in a wrong exit code. <add> // No Autoremove: Simply retrieve the exit code <add> if _, status, err = getExitCode(cli, runResult.ID); err != nil { <add> return err <add> } <ide> } <ide> } <ide> if status != 0 {
1
Python
Python
fix ma.median for empty ndarrays
05aa44d53f4f9528847a0c014fe4bda5caa5fd3d
<ide><path>numpy/ma/extras.py <ide> def _median(a, axis=None, out=None, overwrite_input=False): <ide> else: <ide> axis = normalize_axis_index(axis, asorted.ndim) <ide> <add> if asorted.shape[axis] == 0: <add> # for empty axis integer indices fail so use slicing to get same result <add> # as median (which is mean of empty slice = nan) <add> indexer = [slice(None)] * asorted.ndim <add> indexer[axis] = slice(0, 0) <add> return np.ma.mean(asorted[indexer], axis=axis, out=out) <add> <ide> if asorted.ndim == 1: <ide> counts = count(asorted) <ide> idx, odd = divmod(count(asorted), 2) <ide><path>numpy/ma/tests/test_extras.py <ide> def test_empty(self): <ide> <ide> # axis 0 and 1 <ide> b = np.ma.masked_array(np.array([], dtype=float, ndmin=2)) <del> assert_equal(np.median(a, axis=0), b) <del> assert_equal(np.median(a, axis=1), b) <add> assert_equal(np.ma.median(a, axis=0), b) <add> assert_equal(np.ma.median(a, axis=1), b) <ide> <ide> # axis 2 <ide> b = np.ma.masked_array(np.array(np.nan, dtype=float, ndmin=2)) <ide> with warnings.catch_warnings(record=True) as w: <ide> warnings.filterwarnings('always', '', RuntimeWarning) <del> assert_equal(np.median(a, axis=2), b) <add> assert_equal(np.ma.median(a, axis=2), b) <ide> assert_(w[0].category is RuntimeWarning) <ide> <ide> def test_object(self):
2
Text
Text
remove unused imports
3d163d32142eab73cb4c5472ea7920b79b640d9d
<ide><path>doc/api/esm.md <ide> purposes. <ide> ```js <ide> // coffeescript-loader.mjs <ide> import { readFile } from 'fs/promises'; <del>import { readFileSync } from 'fs'; <del>import { createRequire } from 'module'; <ide> import { dirname, extname, resolve as resolvePath } from 'path'; <ide> import { cwd } from 'process'; <ide> import { fileURLToPath, pathToFileURL } from 'url';
1
Go
Go
execute buildportmapinfo after endpoint.join()
e03daebb48221bae84bfc48b0f9b652ced6d93f3
<ide><path>daemon/container_unix.go <ide> func (container *Container) buildEndpointInfo(n libnetwork.Network, ep libnetwor <ide> return networkSettings, nil <ide> } <ide> <add> if iface.MacAddress() != nil { <add> networkSettings.Networks[n.Name()].MacAddress = iface.MacAddress().String() <add> } <add> <ide> if iface.Address() != nil { <ide> ones, _ := iface.Address().Mask.Size() <ide> networkSettings.Networks[n.Name()].IPAddress = iface.Address().IP.String() <ide> func (container *Container) buildEndpointInfo(n libnetwork.Network, ep libnetwor <ide> networkSettings.Networks[n.Name()].GlobalIPv6PrefixLen = onesv6 <ide> } <ide> <del> driverInfo, err := ep.DriverInfo() <del> if err != nil { <del> return nil, err <del> } <del> <del> if driverInfo == nil { <del> // It is not an error for epInfo to be nil <del> return networkSettings, nil <del> } <del> if mac, ok := driverInfo[netlabel.MacAddress]; ok { <del> networkSettings.Networks[n.Name()].MacAddress = mac.(net.HardwareAddr).String() <del> } <del> <ide> return networkSettings, nil <ide> } <ide> <ide> func (container *Container) updateJoinInfo(n libnetwork.Network, ep libnetwork.Endpoint) error { <add> if _, err := container.buildPortMapInfo(ep, container.NetworkSettings); err != nil { <add> return err <add> } <add> <ide> epInfo := ep.Info() <ide> if epInfo == nil { <ide> // It is not an error to get an empty endpoint info <ide> func (container *Container) updateNetworkSettings(n libnetwork.Network) error { <ide> } <ide> <ide> func (container *Container) updateEndpointNetworkSettings(n libnetwork.Network, ep libnetwork.Endpoint) error { <del> networkSettings, err := container.buildPortMapInfo(ep, container.NetworkSettings) <del> if err != nil { <del> return err <del> } <del> <del> networkSettings, err = container.buildEndpointInfo(n, ep, networkSettings) <add> networkSettings, err := container.buildEndpointInfo(n, ep, container.NetworkSettings) <ide> if err != nil { <ide> return err <ide> } <ide><path>integration-cli/docker_cli_network_unix_test.go <ide> import ( <ide> remoteipam "github.com/docker/libnetwork/ipams/remote/api" <ide> "github.com/docker/libnetwork/netlabel" <ide> "github.com/go-check/check" <add> "github.com/vishvananda/netlink" <ide> ) <ide> <ide> const dummyNetworkDriver = "dummy-network-driver" <ide> func (s *DockerNetworkSuite) SetUpSuite(c *check.C) { <ide> fmt.Fprintf(w, "null") <ide> }) <ide> <add> mux.HandleFunc(fmt.Sprintf("/%s.CreateEndpoint", driverapi.NetworkPluginEndpointType), func(w http.ResponseWriter, r *http.Request) { <add> w.Header().Set("Content-Type", "application/vnd.docker.plugins.v1+json") <add> fmt.Fprintf(w, `{"Interface":{"MacAddress":"a0:b1:c2:d3:e4:f5"}}`) <add> }) <add> <add> mux.HandleFunc(fmt.Sprintf("/%s.Join", driverapi.NetworkPluginEndpointType), func(w http.ResponseWriter, r *http.Request) { <add> w.Header().Set("Content-Type", "application/vnd.docker.plugins.v1+json") <add> <add> veth := &netlink.Veth{ <add> LinkAttrs: netlink.LinkAttrs{Name: "randomIfName", TxQLen: 0}, PeerName: "cnt0"} <add> if err := netlink.LinkAdd(veth); err != nil { <add> fmt.Fprintf(w, `{"Error":"failed to add veth pair: `+err.Error()+`"}`) <add> } else { <add> fmt.Fprintf(w, `{"InterfaceName":{ "SrcName":"cnt0", "DstPrefix":"veth"}}`) <add> } <add> }) <add> <add> mux.HandleFunc(fmt.Sprintf("/%s.Leave", driverapi.NetworkPluginEndpointType), func(w http.ResponseWriter, r *http.Request) { <add> w.Header().Set("Content-Type", "application/vnd.docker.plugins.v1+json") <add> fmt.Fprintf(w, "null") <add> }) <add> <add> mux.HandleFunc(fmt.Sprintf("/%s.DeleteEndpoint", driverapi.NetworkPluginEndpointType), func(w http.ResponseWriter, r *http.Request) { <add> w.Header().Set("Content-Type", "application/vnd.docker.plugins.v1+json") <add> if link, err := netlink.LinkByName("cnt0"); err == nil { <add> netlink.LinkDel(link) <add> } <add> fmt.Fprintf(w, "null") <add> }) <add> <ide> // Ipam Driver implementation <ide> var ( <ide> poolRequest remoteipam.RequestPoolRequest <ide> func (s *DockerNetworkSuite) TestDockerNetworkLinkOndefaultNetworkOnly(c *check. <ide> dockerCmd(c, "network", "connect", "bridge", cnt2) <ide> dockerCmd(c, "run", "-d", "--link", fmt.Sprintf("%s:%s", cnt2, cnt2), "busybox", "top") <ide> } <add> <add>func (s *DockerNetworkSuite) TestDockerNetworkOverlayPortMapping(c *check.C) { <add> // Verify exposed ports are present in ps output when running a container on <add> // a network managed by a driver which does not provide the default gateway <add> // for the container <add> nwn := "ov" <add> ctn := "bb" <add> port1 := 80 <add> port2 := 443 <add> expose1 := fmt.Sprintf("--expose=%d", port1) <add> expose2 := fmt.Sprintf("--expose=%d", port2) <add> <add> dockerCmd(c, "network", "create", "-d", dummyNetworkDriver, nwn) <add> assertNwIsAvailable(c, nwn) <add> <add> dockerCmd(c, "run", "-d", "--net", nwn, "--name", ctn, expose1, expose2, "busybox", "top") <add> <add> // Check docker ps o/p for last created container reports the unpublished ports <add> unpPort1 := fmt.Sprintf("%d/tcp", port1) <add> unpPort2 := fmt.Sprintf("%d/tcp", port2) <add> out, _ := dockerCmd(c, "ps", "-n=1") <add> // Missing unpublished ports in docker ps output <add> c.Assert(out, checker.Contains, unpPort1) <add> // Missing unpublished ports in docker ps output <add> c.Assert(out, checker.Contains, unpPort2) <add>} <add> <add>func (s *DockerNetworkSuite) TestDockerNetworkMacInspect(c *check.C) { <add> // Verify endpoint MAC address is correctly populated in container's network settings <add> nwn := "ov" <add> ctn := "bb" <add> <add> dockerCmd(c, "network", "create", "-d", dummyNetworkDriver, nwn) <add> assertNwIsAvailable(c, nwn) <add> <add> dockerCmd(c, "run", "-d", "--net", nwn, "--name", ctn, "busybox", "top") <add> <add> mac, err := inspectField(ctn, "NetworkSettings.Networks."+nwn+".MacAddress") <add> c.Assert(err, checker.IsNil) <add> c.Assert(mac, checker.Equals, "a0:b1:c2:d3:e4:f5") <add>}
2
Text
Text
add anaconda logo to python/anaconda/index.md
69ec2781a330202b0a2f46f408ec654b0ee445dc
<ide><path>guide/english/python/anaconda/index.md <ide> --- <ide> title: Anaconda <ide> --- <add>![alt text](https://www.anaconda.com/wp-content/themes/anaconda/images/logo-dark.png) <ide> <del>## Anaconda <ide> **Anaconda** is a package manager, environment manager and Python distribution with a collection of numerous packages. Anaconda is platform-agnostic, so you can use it whether you are on Windows, macOS or Linux. <ide> Anaconda easily creates, saves, loads and switches between environments on your local computer. It was created for Python programs, but it can package and distribute software for any language. <ide> Anaconda as a package manager helps you find and install packages. If you need a package that requires a different version of Python, you do not need to switch to a different environment manager, because Anaconda is also an environment manager. With just a few commands, you can set up a totally separate environment to run that different version of Python, while continuing to run your usual version of Python in your normal environment.
1
Text
Text
add note about yarn 2 support.
843252b8211f14ba9c2aa422f3feed728a827836
<ide><path>docs/getting-started.md <ide> npm install next react react-dom <ide> yarn add next react react-dom <ide> ``` <ide> <add>> **Note**: [Yarn 2](https://yarnpkg.com/getting-started/install) is supported as best-effort within Next.js. For best results, use NPM or Yarn 1. <add> <ide> Open `package.json` and add the following `scripts`: <ide> <ide> ```json
1
PHP
PHP
add strict_types to collection test cases
cb4fcfe9d2ad97009e415b13080aaef8d51591d8
<ide><path>tests/TestCase/Collection/CollectionTest.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide><path>tests/TestCase/Collection/Iterator/BufferedIteratorTest.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide><path>tests/TestCase/Collection/Iterator/ExtractIteratorTest.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide><path>tests/TestCase/Collection/Iterator/FilterIteratorTest.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide><path>tests/TestCase/Collection/Iterator/InsertIteratorTest.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide><path>tests/TestCase/Collection/Iterator/MapReduceTest.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide><path>tests/TestCase/Collection/Iterator/ReplaceIteratorTest.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide><path>tests/TestCase/Collection/Iterator/SortIteratorTest.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide><path>tests/TestCase/Collection/Iterator/TreeIteratorTest.php <ide> <?php <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
9
Java
Java
add closestatus to indicate unreliable session
cbd5af3a0352e408bccac7763a9ea7f1e94fc516
<ide><path>spring-websocket/src/main/java/org/springframework/web/socket/CloseStatus.java <ide> public final class CloseStatus { <ide> public static final CloseStatus TLS_HANDSHAKE_FAILURE = new CloseStatus(1015); <ide> <ide> <add> /** <add> * Indicates that a session has become unreliable (e.g. timed out while sending <add> * a message) and extra care should be exercised while closing the session in <add> * order to avoid locking additional threads. <add> * <add> * <p><strong>NOTE:</strong> Spring Framework specific status code. <add> */ <add> public static final CloseStatus SESSION_NOT_RELIABLE = new CloseStatus(4500); <add> <add> <add> <ide> private final int code; <ide> <ide> private final String reason; <ide><path>spring-websocket/src/main/java/org/springframework/web/socket/handler/ConcurrentWebSocketSessionDecorator.java <ide> <ide> import org.apache.commons.logging.Log; <ide> import org.apache.commons.logging.LogFactory; <add>import org.springframework.web.socket.CloseStatus; <ide> import org.springframework.web.socket.WebSocketMessage; <ide> import org.springframework.web.socket.WebSocketSession; <ide> <ide> public class ConcurrentWebSocketSessionDecorator extends WebSocketSessionDecorat <ide> private final int sendTimeLimit; <ide> <ide> <del> private volatile boolean sessionLimitExceeded; <add> private volatile boolean limitExceeded; <ide> <ide> <ide> private final Lock flushLock = new ReentrantLock(); <ide> public long getTimeSinceSendStarted() { <ide> <ide> public void sendMessage(WebSocketMessage<?> message) throws IOException { <ide> <del> if (this.sessionLimitExceeded) { <add> if (this.limitExceeded) { <ide> return; <ide> } <ide> <ide> public void sendMessage(WebSocketMessage<?> message) throws IOException { <ide> <ide> do { <ide> if (!tryFlushMessageBuffer()) { <del> if (logger.isDebugEnabled()) { <del> logger.debug("Another send already in progress, session id '" + <add> if (logger.isTraceEnabled()) { <add> logger.trace("Another send already in progress, session id '" + <ide> getId() + "'" + ", in-progress send time " + getTimeSinceSendStarted() + <ide> " (ms)" + ", buffer size " + this.bufferSize + " bytes"); <ide> } <ide> public void sendMessage(WebSocketMessage<?> message) throws IOException { <ide> } <ide> <ide> private boolean tryFlushMessageBuffer() throws IOException { <del> if (this.flushLock.tryLock() && !this.sessionLimitExceeded) { <add> if (this.flushLock.tryLock() && !this.limitExceeded) { <ide> try { <ide> while (true) { <ide> WebSocketMessage<?> messageToSend = this.buffer.poll(); <ide> private boolean tryFlushMessageBuffer() throws IOException { <ide> } <ide> <ide> private void checkSessionLimits() throws IOException { <del> if (this.closeLock.tryLock() && !this.sessionLimitExceeded) { <add> if (this.closeLock.tryLock() && !this.limitExceeded) { <ide> try { <ide> if (getTimeSinceSendStarted() > this.sendTimeLimit) { <del> sessionLimitReached( <del> "Message send time " + getTimeSinceSendStarted() + <del> " (ms) exceeded the allowed limit " + this.sendTimeLimit); <add> <add> String errorMessage = "Message send time " + getTimeSinceSendStarted() + <add> " (ms) exceeded the allowed limit " + this.sendTimeLimit; <add> <add> sessionLimitReached(errorMessage, CloseStatus.SESSION_NOT_RELIABLE); <ide> } <ide> else if (this.bufferSize.get() > this.bufferSizeLimit) { <del> sessionLimitReached( <del> "The send buffer size " + this.bufferSize.get() + " bytes for " + <del> "session '" + getId() + " exceeded the allowed limit " + this.bufferSizeLimit); <add> <add> String errorMessage = "The send buffer size " + this.bufferSize.get() + " bytes for " + <add> "session '" + getId() + " exceeded the allowed limit " + this.bufferSizeLimit; <add> <add> sessionLimitReached(errorMessage, <add> (getTimeSinceSendStarted() >= 10000 ? CloseStatus.SESSION_NOT_RELIABLE : null)); <ide> } <ide> } <ide> finally { <ide> else if (this.bufferSize.get() > this.bufferSizeLimit) { <ide> } <ide> } <ide> <del> private void sessionLimitReached(String reason) { <del> this.sessionLimitExceeded = true; <del> throw new SessionLimitExceededException(reason); <add> private void sessionLimitReached(String reason, CloseStatus status) { <add> this.limitExceeded = true; <add> throw new SessionLimitExceededException(reason, status); <ide> } <ide> <ide> } <ide><path>spring-websocket/src/main/java/org/springframework/web/socket/handler/SessionLimitExceededException.java <ide> <ide> package org.springframework.web.socket.handler; <ide> <add>import org.springframework.web.socket.CloseStatus; <add> <ide> /** <ide> * Raised when a WebSocket session has exceeded limits it has been configured <ide> * for, e.g. timeout, buffer size, etc. <ide> @SuppressWarnings("serial") <ide> public class SessionLimitExceededException extends RuntimeException { <ide> <add> private final CloseStatus status; <add> <ide> <del> public SessionLimitExceededException(String message) { <add> public SessionLimitExceededException(String message, CloseStatus status) { <ide> super(message); <add> this.status = (status != null) ? status : CloseStatus.NO_STATUS_CODE; <add> } <add> <add> <add> public CloseStatus getStatus() { <add> return this.status; <ide> } <ide> <ide> } <ide><path>spring-websocket/src/main/java/org/springframework/web/socket/messaging/SubProtocolWebSocketHandler.java <ide> public void afterConnectionEstablished(WebSocketSession session) throws Exceptio <ide> } <ide> <ide> protected final SubProtocolHandler findProtocolHandler(WebSocketSession session) { <add> <add> String protocol = null; <add> try { <add> protocol = session.getAcceptedProtocol(); <add> } <add> catch (Exception ex) { <add> logger.warn("Ignoring protocol in WebSocket session after failure to obtain it: " + ex.toString()); <add> } <add> <ide> SubProtocolHandler handler; <del> String protocol = session.getAcceptedProtocol(); <ide> if (!StringUtils.isEmpty(protocol)) { <ide> handler = this.protocolHandlers.get(protocol); <ide> Assert.state(handler != null, <ide> public void handleMessage(Message<?> message) throws MessagingException { <ide> try { <ide> findProtocolHandler(session).handleMessageToClient(session, message); <ide> } <del> catch (SessionLimitExceededException e) { <add> catch (SessionLimitExceededException ex) { <ide> try { <del> logger.error("Terminating session id '" + sessionId + "'", e); <add> logger.error("Terminating session id '" + sessionId + "'", ex); <ide> <ide> // Session may be unresponsive so clear first <del> clearSession(session, CloseStatus.NO_STATUS_CODE); <del> session.close(); <add> clearSession(session, ex.getStatus()); <add> session.close(ex.getStatus()); <ide> } <ide> catch (Exception secondException) { <ide> logger.error("Exception terminating session id '" + sessionId + "'", secondException); <ide><path>spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/session/AbstractSockJsSession.java <ide> public abstract class AbstractSockJsSession implements SockJsSession { <ide> <ide> private final Map<String, Object> attributes; <ide> <add> <ide> private volatile State state = State.NEW; <ide> <ide> private final long timeCreated = System.currentTimeMillis(); <ide> public final void close(CloseStatus status) throws IOException { <ide> logger.debug("Closing " + this + ", " + status); <ide> } <ide> try { <del> if (isActive()) { <add> if (isActive() && !CloseStatus.SESSION_NOT_RELIABLE.equals(status)) { <ide> try { <ide> // bypass writeFrame <ide> writeFrameInternal(SockJsFrame.closeFrame(status.getCode(), status.getReason())); <ide> public final void close(CloseStatus status) throws IOException { <ide> } <ide> } <ide> <add> /** <add> * Actually close the underlying WebSocket session or in the case of HTTP <add> * transports complete the underlying request. <add> */ <ide> protected abstract void disconnect(CloseStatus status) throws IOException; <ide> <ide> /** <ide><path>spring-websocket/src/test/java/org/springframework/web/socket/handler/ConcurrentWebSocketSessionDecoratorTests.java <ide> package org.springframework.web.socket.handler; <ide> <ide> import org.junit.Test; <add>import org.springframework.web.socket.CloseStatus; <ide> import org.springframework.web.socket.TextMessage; <ide> import org.springframework.web.socket.WebSocketMessage; <ide> <ide> public void run() { <ide> fail("Expected exception"); <ide> } <ide> catch (SessionLimitExceededException ex) { <add> assertEquals(CloseStatus.SESSION_NOT_RELIABLE, ex.getStatus()); <ide> } <ide> } <ide>
6
Javascript
Javascript
fix select tests on ie8
0bc406cc0096f58b6f428afce4fdfb200c643fe5
<ide><path>packages/ember-handlebars/tests/controls/select_test.js <ide> var map = Ember.EnumerableUtils.map; <ide> <del>var dispatcher, select; <add>var dispatcher, wrapper, select; <ide> <ide> module("Ember.Select", { <ide> setup: function() { <ide> dispatcher = Ember.EventDispatcher.create(); <ide> dispatcher.setup(); <add> wrapper = Ember.ContainerView.create(); <ide> select = Ember.Select.create(); <add> wrapper.get('childViews').pushObject(select); <ide> }, <ide> <ide> teardown: function() { <ide> Ember.run(function() { <ide> dispatcher.destroy(); <ide> select.destroy(); <add> wrapper.destroy(); <ide> }); <ide> } <ide> }); <ide> function setAndFlush(view, key, value) { <ide> <ide> function append() { <ide> Ember.run(function() { <del> select.appendTo('#qunit-fixture'); <add> wrapper.appendTo('#qunit-fixture'); <ide> }); <ide> } <ide> <ide><path>packages/ember-views/lib/system/render_buffer.js <ide> var setInnerHTML = function(element, html) { <ide> <ide> /*** END METAMORPH HELPERS */ <ide> <add>var allowedTags = {}; <add>var allowedAsRoot = function(tagName) { <add> if (allowedTags[tagName] !== undefined) { <add> return allowedTags[tagName]; <add> } <add> <add> var allowed = true; <add> <add> // IE 8 and earlier don't allow us to do innerHTML on select <add> if (tagName.toLowerCase() === 'select') { <add> var el = document.createElement('select'); <add> setInnerHTML(el, '<option value="test">Test</option>'); <add> allowed = el.options.length === 1; <add> } <add> <add> allowedTags[tagName] = allowed; <add> <add> return allowed; <add>}; <add> <add> <ide> <ide> var ClassSet = function() { <ide> this.seen = {}; <ide> Ember._RenderBuffer.prototype = <ide> style = this.elementStyle, <ide> styleBuffer = '', prop; <ide> <add> Ember.assert("Can't create a RenderBuffer for "+tagName+" in this browser.", allowedAsRoot(tagName)); <add> <ide> if (id) { <ide> $element.attr('id', id); <ide> this.elementId = null;
2
Ruby
Ruby
combine detection logic
3005582f15237393d6dd9df5e8b6429112b2e12a
<ide><path>Library/Homebrew/gpg.rb <ide> require "utils" <ide> <ide> class Gpg <del> # Should ideally be using `GPGRequirement.new.gpg2`, etc to get path here but <del> # calling that directly leads to: <del> # requirement.rb:139:in `which_all': uninitialized constant Requirement::ORIGINAL_PATHS (NameError) <del> # when i.e. including the gpg syntax in wget. Not problematic if not used by formula code. <del> # For now, the path determination blob of code has been semi-modified for here. <del> # Look into this more. <del> def self.gpg <del> which("gpg") do |gpg| <add> def self.find_gpg(executable) <add> which_all(executable).detect do |gpg| <ide> gpg_short_version = Utils.popen_read(gpg, "--version")[/\d\.\d/, 0] <ide> next unless gpg_short_version <ide> Version.create(gpg_short_version.to_s) == Version.create("2.0") <ide> end <ide> end <ide> <add> def self.gpg <add> find_gpg("gpg") <add> end <add> <ide> def self.gpg2 <del> which("gpg2") do |gpg2| <del> gpg2_short_version = Utils.popen_read(gpg2, "--version")[/\d\.\d/, 0] <del> next unless gpg2_short_version <del> Version.create(gpg2_short_version.to_s) == Version.create("2.0") <del> end <add> find_gpg("gpg2") <ide> end <ide> <ide> GPG_EXECUTABLE = gpg2 || gpg <ide> <ide> def self.available? <del> File.exist?(GPG_EXECUTABLE.to_s) && File.executable?(GPG_EXECUTABLE) <add> File.exist?(GPG_EXECUTABLE.to_s) && File.executable?(GPG_EXECUTABLE.to_s) <ide> end <ide> <ide> def self.create_test_key(path)
1
Text
Text
revise dependency redirection text in policy.md
163030eded94c010837e8cf62a618b5d973e0305
<ide><path>doc/api/policy.md <ide> replaced. <ide> ``` <ide> <ide> The dependencies are keyed by the requested specifier string and have values <del>of either `true`, `null`, a string pointing to a module that will be resolved, <add>of either `true`, `null`, a string pointing to a module to be resolved, <ide> or a conditions object. <ide> <ide> The specifier string does not perform any searching and must match exactly <ide> what is provided to the `require()` or `import`. Therefore, multiple specifiers <ide> may be needed in the policy if it uses multiple different strings to point <ide> to the same module (such as excluding the extension). <ide> <del>If the value of the redirection is `true` the default searching algorithms will <del>be used to find the module. <add>If the value of the redirection is `true` the default searching algorithms are <add>used to find the module. <ide> <del>If the value of the redirection is a string, it will be resolved relative to <del>the manifest and then immediately be used without searching. <add>If the value of the redirection is a string, it is resolved relative to <add>the manifest and then immediately used without searching. <ide> <del>Any specifier string that is attempted to resolve and not listed in the <del>dependencies will result in an error according to the policy. <add>Any specifier string for which resolution is attempted and that is not listed in <add>the dependencies results in an error according to the policy. <ide> <del>Redirection will not prevent access to APIs through means such as direct access <del>to `require.cache` and/or through `module.constructor` which allow access to <add>Redirection does not prevent access to APIs through means such as direct access <add>to `require.cache` or through `module.constructor` which allow access to <ide> loading modules. Policy redirection only affects specifiers to `require()` and <del>`import`. Other means such as to prevent undesired access to APIs through <del>variables are necessary to lock down that path of loading modules. <add>`import`. Other means, such as to prevent undesired access to APIs through <add>variables, are necessary to lock down that path of loading modules. <ide> <ide> A boolean value of `true` for the dependencies map can be specified to allow a <ide> module to load any specifier without redirection. This can be useful for local <ide> only with care after auditing a module to ensure its behavior is valid. <ide> <ide> Similar to `"exports"` in `package.json`, dependencies can also be specified to <ide> be objects containing conditions which branch how dependencies are loaded. In <del>the preceding example, `"http"` will be allowed when the `"import"` condition is <add>the preceding example, `"http"` is allowed when the `"import"` condition is <ide> part of loading it. <ide> <del>A value of `null` for the resolved value will cause the resolution to fail. This <add>A value of `null` for the resolved value causes the resolution to fail. This <ide> can be used to ensure some kinds of dynamic access are explicitly prevented. <ide> <del>Unknown values for the resolved module location will cause failure but are <del>not guaranteed to be forwards compatible. <add>Unknown values for the resolved module location cause failures but are <add>not guaranteed to be forward compatible. <ide> <ide> #### Example: Patched dependency <ide>
1
Python
Python
decorate regression tests
addeb34bc4538cada8f373a16ea89c46dcf63f07
<ide><path>spacy/tests/regression/test_issue1-1000.py <ide> from ..util import make_tempdir <ide> <ide> <add>@pytest.mark.issue(118) <ide> @pytest.mark.parametrize( <ide> "patterns", <ide> [ <ide> def test_issue118(en_tokenizer, patterns): <ide> assert ents[0].end == 11 <ide> <ide> <add>@pytest.mark.issue(118) <ide> @pytest.mark.parametrize( <ide> "patterns", <ide> [ <ide> def test_issue118_prefix_reorder(en_tokenizer, patterns): <ide> assert ents[0].end == 11 <ide> <ide> <add>@pytest.mark.issue(242) <ide> def test_issue242(en_tokenizer): <ide> """Test overlapping multi-word phrases.""" <ide> text = "There are different food safety standards in different countries." <ide> def test_issue242(en_tokenizer): <ide> doc.ents += tuple(matches) <ide> <ide> <add>@pytest.mark.issue(309) <ide> def test_issue309(en_vocab): <ide> """Test Issue #309: SBD fails on empty string""" <ide> doc = Doc(en_vocab, words=[" "], heads=[0], deps=["ROOT"]) <ide> def test_issue309(en_vocab): <ide> assert len(sents) == 1 <ide> <ide> <add>@pytest.mark.issue(351) <ide> def test_issue351(en_tokenizer): <ide> doc = en_tokenizer(" This is a cat.") <ide> assert doc[0].idx == 0 <ide> assert len(doc[0]) == 3 <ide> assert doc[1].idx == 3 <ide> <ide> <add>@pytest.mark.issue(360) <ide> def test_issue360(en_tokenizer): <ide> """Test tokenization of big ellipsis""" <ide> tokens = en_tokenizer("$45...............Asking") <ide> assert len(tokens) > 2 <ide> <ide> <add>@pytest.mark.issue(361) <ide> @pytest.mark.parametrize("text1,text2", [("cat", "dog")]) <ide> def test_issue361(en_vocab, text1, text2): <ide> """Test Issue #361: Equality of lexemes""" <ide> assert en_vocab[text1] == en_vocab[text1] <ide> assert en_vocab[text1] != en_vocab[text2] <ide> <ide> <add>@pytest.mark.issue(587) <ide> def test_issue587(en_tokenizer): <ide> """Test that Matcher doesn't segfault on particular input""" <ide> doc = en_tokenizer("a b; c") <ide> def test_issue587(en_tokenizer): <ide> assert len(matches) == 2 <ide> <ide> <add>@pytest.mark.issue(588) <ide> def test_issue588(en_vocab): <ide> matcher = Matcher(en_vocab) <ide> with pytest.raises(ValueError): <ide> matcher.add("TEST", [[]]) <ide> <ide> <add>@pytest.mark.issue(590) <ide> def test_issue590(en_vocab): <ide> """Test overlapping matches""" <ide> doc = Doc(en_vocab, words=["n", "=", "1", ";", "a", ":", "5", "%"]) <ide> def test_issue590(en_vocab): <ide> assert len(matches) == 2 <ide> <ide> <add>@pytest.mark.issue(595) <ide> @pytest.mark.skip(reason="Old vocab-based lemmatization") <ide> def test_issue595(): <ide> """Test lemmatization of base forms""" <ide> def test_issue595(): <ide> assert doc[2].lemma_ == "feed" <ide> <ide> <add>@pytest.mark.issue(599) <ide> def test_issue599(en_vocab): <ide> doc = Doc(en_vocab) <ide> doc2 = Doc(doc.vocab) <ide> doc2.from_bytes(doc.to_bytes()) <ide> assert doc2.has_annotation("DEP") <ide> <ide> <add>@pytest.mark.issue(600) <ide> def test_issue600(): <ide> vocab = Vocab(tag_map={"NN": {"pos": "NOUN"}}) <ide> doc = Doc(vocab, words=["hello"]) <ide> doc[0].tag_ = "NN" <ide> <ide> <add>@pytest.mark.issue(615) <ide> def test_issue615(en_tokenizer): <ide> def merge_phrases(matcher, doc, i, matches): <ide> """Merge a phrase. We have to be careful here because we'll change the <ide> def merge_phrases(matcher, doc, i, matches): <ide> assert entities[0].label != 0 <ide> <ide> <add>@pytest.mark.issue(736) <ide> @pytest.mark.parametrize("text,number", [("7am", "7"), ("11p.m.", "11")]) <ide> def test_issue736(en_tokenizer, text, number): <ide> """Test that times like "7am" are tokenized correctly and that numbers are <ide> def test_issue736(en_tokenizer, text, number): <ide> assert tokens[0].text == number <ide> <ide> <add>@pytest.mark.issue(740) <ide> @pytest.mark.parametrize("text", ["3/4/2012", "01/12/1900"]) <ide> def test_issue740(en_tokenizer, text): <ide> """Test that dates are not split and kept as one token. This behaviour is <ide> def test_issue740(en_tokenizer, text): <ide> assert len(tokens) == 1 <ide> <ide> <add>@pytest.mark.issue(743) <ide> def test_issue743(): <ide> doc = Doc(Vocab(), ["hello", "world"]) <ide> token = doc[0] <ide> def test_issue743(): <ide> assert items[0] is token <ide> <ide> <add>@pytest.mark.issue(744) <ide> @pytest.mark.parametrize("text", ["We were scared", "We Were Scared"]) <ide> def test_issue744(en_tokenizer, text): <ide> """Test that 'were' and 'Were' are excluded from the contractions <ide> def test_issue744(en_tokenizer, text): <ide> assert tokens[1].text.lower() == "were" <ide> <ide> <add>@pytest.mark.issue(759) <ide> @pytest.mark.parametrize( <ide> "text,is_num", [("one", True), ("ten", True), ("teneleven", False)] <ide> ) <ide> def test_issue759(en_tokenizer, text, is_num): <ide> assert tokens[0].like_num == is_num <ide> <ide> <add>@pytest.mark.issue(775) <ide> @pytest.mark.parametrize("text", ["Shell", "shell", "Shed", "shed"]) <ide> def test_issue775(en_tokenizer, text): <ide> """Test that 'Shell' and 'shell' are excluded from the contractions <ide> def test_issue775(en_tokenizer, text): <ide> assert tokens[0].text == text <ide> <ide> <add>@pytest.mark.issue(792) <ide> @pytest.mark.parametrize("text", ["This is a string ", "This is a string\u0020"]) <ide> def test_issue792(en_tokenizer, text): <ide> """Test for Issue #792: Trailing whitespace is removed after tokenization.""" <ide> doc = en_tokenizer(text) <ide> assert "".join([token.text_with_ws for token in doc]) == text <ide> <ide> <add>@pytest.mark.issue(792) <ide> @pytest.mark.parametrize("text", ["This is a string", "This is a string\n"]) <ide> def test_control_issue792(en_tokenizer, text): <ide> """Test base case for Issue #792: Non-trailing whitespace""" <ide> doc = en_tokenizer(text) <ide> assert "".join([token.text_with_ws for token in doc]) == text <ide> <ide> <add>@pytest.mark.issue(801) <ide> @pytest.mark.skip( <ide> reason="Can not be fixed unless with variable-width lookbehinds, cf. PR #3218" <ide> ) <ide> def test_issue801(en_tokenizer, text, tokens): <ide> assert [t.text for t in doc] == tokens <ide> <ide> <add>@pytest.mark.issue(805) <ide> @pytest.mark.parametrize( <ide> "text,expected_tokens", <ide> [ <ide> def test_issue805(sv_tokenizer, text, expected_tokens): <ide> assert expected_tokens == token_list <ide> <ide> <add>@pytest.mark.issue(850) <ide> def test_issue850(): <ide> """The variable-length pattern matches the succeeding token. Check we <ide> handle the ambiguity correctly.""" <ide> def test_issue850(): <ide> assert end == 4 <ide> <ide> <add>@pytest.mark.issue(850) <ide> def test_issue850_basic(): <ide> """Test Matcher matches with '*' operator and Boolean flag""" <ide> vocab = Vocab(lex_attr_getters={LOWER: lambda string: string.lower()}) <ide> def test_issue850_basic(): <ide> assert end == 4 <ide> <ide> <add>@pytest.mark.issue(852) <ide> @pytest.mark.skip( <ide> reason="French exception list is not enabled in the default tokenizer anymore" <ide> ) <ide> def test_issue852(fr_tokenizer, text): <ide> assert len(tokens) == 1 <ide> <ide> <add>@pytest.mark.issue(859) <ide> @pytest.mark.parametrize( <ide> "text", ["aaabbb@ccc.com\nThank you!", "aaabbb@ccc.com \nThank you!"] <ide> ) <ide> def test_issue859(en_tokenizer, text): <ide> assert doc.text == text <ide> <ide> <add>@pytest.mark.issue(886) <ide> @pytest.mark.parametrize("text", ["Datum:2014-06-02\nDokument:76467"]) <ide> def test_issue886(en_tokenizer, text): <ide> """Test that token.idx matches the original text index for texts with newlines.""" <ide> def test_issue886(en_tokenizer, text): <ide> assert text[token.idx] == token.text[0] <ide> <ide> <add>@pytest.mark.issue(891) <ide> @pytest.mark.parametrize("text", ["want/need"]) <ide> def test_issue891(en_tokenizer, text): <ide> """Test that / infixes are split correctly.""" <ide> def test_issue891(en_tokenizer, text): <ide> assert tokens[1].text == "/" <ide> <ide> <add>@pytest.mark.issue(912) <ide> @pytest.mark.skip(reason="Old vocab-based lemmatization") <ide> @pytest.mark.parametrize( <ide> "text,tag,lemma", <ide> def test_issue912(en_vocab, text, tag, lemma): <ide> assert doc[0].lemma_ == lemma <ide> <ide> <add>@pytest.mark.issue(957) <ide> @pytest.mark.slow <ide> def test_issue957(en_tokenizer): <ide> """Test that spaCy doesn't hang on many punctuation characters. <ide> def test_issue957(en_tokenizer): <ide> assert doc <ide> <ide> <add>@pytest.mark.issue(999) <ide> def test_issue999(): <ide> """Test that adding entities and resuming training works passably OK. <ide> There are two issues here: <ide><path>spacy/tests/regression/test_issue1001-1500.py <ide> from spacy.symbols import ORTH, LEMMA, POS <ide> <ide> <add>@pytest.mark.issue(1061) <ide> def test_issue1061(): <ide> """Test special-case works after tokenizing. Was caching problem.""" <ide> text = "I like _MATH_ even _MATH_ when _MATH_, except when _MATH_ is _MATH_! but not _MATH_." <ide> def test_issue1061(): <ide> @pytest.mark.skip( <ide> reason="Can not be fixed without variable-width look-behind (which we don't want)" <ide> ) <add>@pytest.mark.issue(1235) <ide> def test_issue1235(): <ide> """Test that g is not split of if preceded by a number and a letter""" <ide> nlp = English() <ide> def test_issue1235(): <ide> assert doc[4].text == "g" <ide> <ide> <add>@pytest.mark.issue(1242) <ide> def test_issue1242(): <ide> nlp = English() <ide> doc = nlp("") <ide> def test_issue1242(): <ide> <ide> <ide> @pytest.mark.skip(reason="v3 no longer supports LEMMA/POS in tokenizer special cases") <add>@pytest.mark.issue(1250) <ide> def test_issue1250(): <ide> """Test cached special cases.""" <ide> special_case = [{ORTH: "reimbur", LEMMA: "reimburse", POS: "VERB"}] <ide> def test_issue1250(): <ide> assert lemmas == ["reimburse", ",", "reimburse", "..."] <ide> <ide> <add>@pytest.mark.issue(1257) <ide> def test_issue1257(): <ide> """Test that tokens compare correctly.""" <ide> doc1 = Doc(Vocab(), words=["a", "b", "c"]) <ide> def test_issue1257(): <ide> assert not doc1[0] == doc2[0] <ide> <ide> <add>@pytest.mark.issue(1375) <ide> def test_issue1375(): <ide> """Test that token.nbor() raises IndexError for out-of-bounds access.""" <ide> doc = Doc(Vocab(), words=["0", "1", "2"]) <ide> def test_issue1375(): <ide> assert doc[1].nbor(1).text == "2" <ide> <ide> <add>@pytest.mark.issue(1434) <ide> def test_issue1434(): <ide> """Test matches occur when optional element at end of short doc.""" <ide> pattern = [{"ORTH": "Hello"}, {"IS_ALPHA": True, "OP": "?"}] <ide> def test_issue1434(): <ide> ("a b b", 0, 3), <ide> ], <ide> ) <add>@pytest.mark.issue(1450) <ide> def test_issue1450(string, start, end): <ide> """Test matcher works when patterns end with * operator.""" <ide> pattern = [{"ORTH": "a"}, {"ORTH": "b", "OP": "*"}] <ide> def test_issue1450(string, start, end): <ide> assert matches[-1][2] == end <ide> <ide> <add>@pytest.mark.issue(1488) <ide> def test_issue1488(): <ide> prefix_re = re.compile(r"""[\[\("']""") <ide> suffix_re = re.compile(r"""[\]\)"']""") <ide> def my_tokenizer(nlp): <ide> assert token.text <ide> <ide> <add>@pytest.mark.issue(1494) <ide> def test_issue1494(): <ide> infix_re = re.compile(r"""[^a-z]""") <ide> test_cases = [ <ide><path>spacy/tests/regression/test_issue1501-2000.py <ide> from ..util import make_tempdir <ide> <ide> <add>@pytest.mark.issue(1506) <ide> def test_issue1506(): <ide> def string_generator(): <ide> for _ in range(10001): <ide> def string_generator(): <ide> str(t.lemma_) <ide> <ide> <add>@pytest.mark.issue(1518) <ide> def test_issue1518(): <ide> """Test vectors.resize() works.""" <ide> vectors = Vectors(shape=(10, 10)) <ide> vectors.add("hello", row=2) <ide> vectors.resize((5, 9)) <ide> <ide> <add>@pytest.mark.issue(1537) <ide> def test_issue1537(): <ide> """Test that Span.as_doc() doesn't segfault.""" <ide> string = "The sky is blue . The man is pink . The dog is purple ." <ide> def test_issue1537(): <ide> <ide> <ide> # TODO: Currently segfaulting, due to l_edge and r_edge misalignment <add>@pytest.mark.issue(1537) <ide> # def test_issue1537_model(): <ide> # nlp = load_spacy('en') <ide> # doc = nlp('The sky is blue. The man is pink. The dog is purple.') <ide> def test_issue1537(): <ide> # print(list(sents[1].noun_chunks)) <ide> <ide> <add>@pytest.mark.issue(1539) <ide> def test_issue1539(): <ide> """Ensure vectors.resize() doesn't try to modify dictionary during iteration.""" <ide> v = Vectors(shape=(10, 10), keys=[5, 3, 98, 100]) <ide> v.resize((100, 100)) <ide> <ide> <add>@pytest.mark.issue(1547) <ide> def test_issue1547(): <ide> """Test that entity labels still match after merging tokens.""" <ide> words = ["\n", "worda", ".", "\n", "wordb", "-", "Biosphere", "2", "-", " \n"] <ide> def test_issue1547(): <ide> assert [ent.text for ent in doc.ents] <ide> <ide> <add>@pytest.mark.issue(1612) <ide> def test_issue1612(en_tokenizer): <ide> doc = en_tokenizer("The black cat purrs.") <ide> span = doc[1:3] <ide> assert span.orth_ == span.text <ide> <ide> <add>@pytest.mark.issue(1654) <ide> def test_issue1654(): <ide> nlp = Language(Vocab()) <ide> assert not nlp.pipeline <ide> def component(doc): <ide> <ide> <ide> @pytest.mark.parametrize("text", ["test@example.com", "john.doe@example.co.uk"]) <add>@pytest.mark.issue(1698) <ide> def test_issue1698(en_tokenizer, text): <ide> doc = en_tokenizer(text) <ide> assert len(doc) == 1 <ide> assert not doc[0].like_url <ide> <ide> <add>@pytest.mark.issue(1727) <ide> def test_issue1727(): <ide> """Test that models with no pretrained vectors can be deserialized <ide> correctly after vectors are added.""" <ide> def test_issue1727(): <ide> assert tagger.cfg.get("pretrained_dims", 0) == 0 <ide> <ide> <add>@pytest.mark.issue(1757) <ide> def test_issue1757(): <ide> """Test comparison against None doesn't cause segfault.""" <ide> doc = Doc(Vocab(), words=["a", "b", "c"]) <ide> def test_issue1757(): <ide> assert not doc.vocab["a"] < None <ide> <ide> <add>@pytest.mark.issue(1758) <ide> def test_issue1758(en_tokenizer): <ide> """Test that "would've" is handled by the English tokenizer exceptions.""" <ide> tokens = en_tokenizer("would've") <ide> assert len(tokens) == 2 <ide> <ide> <add>@pytest.mark.issue(1773) <ide> def test_issue1773(en_tokenizer): <ide> """Test that spaces don't receive a POS but no TAG. This is the root cause <ide> of the serialization issue reported in #1773.""" <ide> def test_issue1773(en_tokenizer): <ide> assert doc[0].tag_ != "" <ide> <ide> <add>@pytest.mark.issue(1799) <ide> def test_issue1799(): <ide> """Test sentence boundaries are deserialized correctly, even for <ide> non-projective sentences.""" <ide> def test_issue1799(): <ide> assert len(list(doc.sents)) == 1 <ide> <ide> <add>@pytest.mark.issue(1807) <ide> def test_issue1807(): <ide> """Test vocab.set_vector also adds the word to the vocab.""" <ide> vocab = Vocab(vectors_name="test_issue1807") <ide> def test_issue1807(): <ide> assert "hello" in vocab <ide> <ide> <add>@pytest.mark.issue(1834) <ide> def test_issue1834(): <ide> """Test that sentence boundaries & parse/tag flags are not lost <ide> during serialization.""" <ide> def test_issue1834(): <ide> assert new_doc.has_annotation("TAG") <ide> <ide> <add>@pytest.mark.issue(1868) <ide> def test_issue1868(): <ide> """Test Vocab.__contains__ works with int keys.""" <ide> vocab = Vocab() <ide> def test_issue1868(): <ide> assert int_id not in vocab <ide> <ide> <add>@pytest.mark.issue(1883) <ide> def test_issue1883(): <ide> matcher = Matcher(Vocab()) <ide> matcher.add("pat1", [[{"orth": "hello"}]]) <ide> def test_issue1883(): <ide> <ide> <ide> @pytest.mark.parametrize("word", ["the"]) <add>@pytest.mark.issue(1889) <ide> def test_issue1889(word): <ide> assert is_stop(word, STOP_WORDS) == is_stop(word.upper(), STOP_WORDS) <ide> <ide> <ide> @pytest.mark.skip(reason="obsolete with the config refactor of v.3") <add>@pytest.mark.issue(1915) <ide> def test_issue1915(): <ide> cfg = {"hidden_depth": 2} # should error out <ide> nlp = Language() <ide> def test_issue1915(): <ide> nlp.initialize(**cfg) <ide> <ide> <add>@pytest.mark.issue(1945) <ide> def test_issue1945(): <ide> """Test regression in Matcher introduced in v2.0.6.""" <ide> matcher = Matcher(Vocab()) <ide> def test_issue1945(): <ide> assert matches[1][1:] == (1, 3) <ide> <ide> <add>@pytest.mark.issue(1963) <ide> def test_issue1963(en_tokenizer): <ide> """Test that doc.merge() resizes doc.tensor""" <ide> doc = en_tokenizer("a b c d") <ide> def test_issue1963(en_tokenizer): <ide> <ide> <ide> @pytest.mark.parametrize("label", ["U-JOB-NAME"]) <add>@pytest.mark.issue(1967) <ide> def test_issue1967(label): <ide> nlp = Language() <ide> config = {} <ide> def test_issue1967(label): <ide> assert "JOB-NAME" in ner.moves.get_actions(examples=[example])[1] <ide> <ide> <add>@pytest.mark.issue(1971) <ide> def test_issue1971(en_vocab): <ide> # Possibly related to #2675 and #2671? <ide> matcher = Matcher(en_vocab) <ide><path>spacy/tests/regression/test_issue2001-2500.py <ide> @pytest.mark.skip( <ide> reason="Can not be fixed without iterative looping between prefix/suffix and infix" <ide> ) <add>@pytest.mark.issue(2070) <ide> def test_issue2070(): <ide> """Test that checks that a dot followed by a quote is handled <ide> appropriately. <ide> def test_issue2070(): <ide> assert len(doc) == 11 <ide> <ide> <add>@pytest.mark.issue(2179) <ide> def test_issue2179(): <ide> """Test that spurious 'extra_labels' aren't created when initializing NER.""" <ide> nlp = Italian() <ide> def test_issue2179(): <ide> assert nlp2.get_pipe("ner").labels == ("CITIZENSHIP",) <ide> <ide> <add>@pytest.mark.issue(2203) <ide> def test_issue2203(en_vocab): <ide> """Test that lemmas are set correctly in doc.from_array.""" <ide> words = ["I", "'ll", "survive"] <ide> def test_issue2203(en_vocab): <ide> assert [t.lemma_ for t in new_doc] == lemmas <ide> <ide> <add>@pytest.mark.issue(2219) <ide> def test_issue2219(en_vocab): <ide> vectors = [("a", [1, 2, 3]), ("letter", [4, 5, 6])] <ide> add_vecs_to_vocab(en_vocab, vectors) <ide> def test_issue2219(en_vocab): <ide> assert doc[0].similarity(doc[1]) == doc[1].similarity(doc[0]) <ide> <ide> <add>@pytest.mark.issue(2361) <ide> def test_issue2361(de_vocab): <ide> chars = ("&lt;", "&gt;", "&amp;", "&quot;") <ide> words = ["<", ">", "&", '"'] <ide> def test_issue2361(de_vocab): <ide> assert char in html <ide> <ide> <add>@pytest.mark.issue(2385) <ide> def test_issue2385(): <ide> """Test that IOB tags are correctly converted to BILUO tags.""" <ide> # fix bug in labels with a 'b' character <ide> def test_issue2385(): <ide> ("U-BRAWLER", "U-BRAWLER"), <ide> ], <ide> ) <add>@pytest.mark.issue(2385) <ide> def test_issue2385_biluo(tags): <ide> """Test that BILUO-compatible tags aren't modified.""" <ide> assert iob_to_biluo(tags) == list(tags) <ide> <ide> <add>@pytest.mark.issue(2396) <ide> def test_issue2396(en_vocab): <ide> words = ["She", "created", "a", "test", "for", "spacy"] <ide> heads = [1, 1, 3, 1, 3, 4] <ide> def test_issue2396(en_vocab): <ide> assert (span.get_lca_matrix() == matrix).all() <ide> <ide> <add>@pytest.mark.issue(2464) <ide> def test_issue2464(en_vocab): <ide> """Test problem with successive ?. This is the same bug, so putting it here.""" <ide> matcher = Matcher(en_vocab) <ide> def test_issue2464(en_vocab): <ide> assert len(matches) == 3 <ide> <ide> <add>@pytest.mark.issue(2482) <ide> def test_issue2482(): <ide> """Test we can serialize and deserialize a blank NER or parser model.""" <ide> nlp = Italian() <ide><path>spacy/tests/regression/test_issue2501-3000.py <ide> import random <ide> <ide> <add>@pytest.mark.issue(2564) <ide> def test_issue2564(): <ide> """Test the tagger sets has_annotation("TAG") correctly when used via Language.pipe.""" <ide> nlp = Language() <ide> def test_issue2564(): <ide> assert piped_doc.has_annotation("TAG") <ide> <ide> <add>@pytest.mark.issue(2569) <ide> def test_issue2569(en_tokenizer): <ide> """Test that operator + is greedy.""" <ide> doc = en_tokenizer("It is May 15, 1993.") <ide> def test_issue2569(en_tokenizer): <ide> "oow.jspsearch.eventoracleopenworldsearch.technologyoraclesolarissearch.technologystoragesearch.technologylinuxsearch.technologyserverssearch.technologyvirtualizationsearch.technologyengineeredsystemspcodewwmkmppscem:", <ide> ], <ide> ) <add>@pytest.mark.issue(2626) <ide> def test_issue2626_2835(en_tokenizer, text): <ide> """Check that sentence doesn't cause an infinite loop in the tokenizer.""" <ide> doc = en_tokenizer(text) <ide> assert doc <ide> <ide> <add>@pytest.mark.issue(2656) <ide> def test_issue2656(en_tokenizer): <ide> """Test that tokenizer correctly splits off punctuation after numbers with <ide> decimal points. <ide> def test_issue2656(en_tokenizer): <ide> assert doc[10].text == "." <ide> <ide> <add>@pytest.mark.issue(2671) <ide> def test_issue2671(): <ide> """Ensure the correct entity ID is returned for matches with quantifiers. <ide> See also #2675 <ide> def test_issue2671(): <ide> assert nlp.vocab.strings[match_id] == pattern_id <ide> <ide> <add>@pytest.mark.issue(2728) <ide> def test_issue2728(en_vocab): <ide> """Test that displaCy ENT visualizer escapes HTML correctly.""" <ide> doc = Doc(en_vocab, words=["test", "<RELEASE>", "test"]) <ide> def test_issue2728(en_vocab): <ide> assert "&lt;RELEASE&gt;" in html <ide> <ide> <add>@pytest.mark.issue(2754) <ide> def test_issue2754(en_tokenizer): <ide> """Test that words like 'a' and 'a.m.' don't get exceptional norm values.""" <ide> a = en_tokenizer("a") <ide> def test_issue2754(en_tokenizer): <ide> assert am[0].norm_ == "am" <ide> <ide> <add>@pytest.mark.issue(2772) <ide> def test_issue2772(en_vocab): <ide> """Test that deprojectivization doesn't mess up sentence boundaries.""" <ide> # fmt: off <ide> def test_issue2772(en_vocab): <ide> <ide> @pytest.mark.parametrize("text", ["-0.23", "+123,456", "±1"]) <ide> @pytest.mark.parametrize("lang_cls", [English, MultiLanguage]) <add>@pytest.mark.issue(2782) <ide> def test_issue2782(text, lang_cls): <ide> """Check that like_num handles + and - before number.""" <ide> nlp = lang_cls() <ide> def test_issue2782(text, lang_cls): <ide> assert doc[0].like_num <ide> <ide> <add>@pytest.mark.issue(2800) <ide> def test_issue2800(): <ide> """Test issue that arises when too many labels are added to NER model. <ide> Used to cause segfault. <ide> def test_issue2800(): <ide> nlp.update([example], sgd=optimizer, losses=losses, drop=0.5) <ide> <ide> <add>@pytest.mark.issue(2822) <ide> def test_issue2822(it_tokenizer): <ide> """Test that the abbreviation of poco is kept as one word.""" <ide> doc = it_tokenizer("Vuoi un po' di zucchero?") <ide> def test_issue2822(it_tokenizer): <ide> assert doc[5].text == "?" <ide> <ide> <add>@pytest.mark.issue(2833) <ide> def test_issue2833(en_vocab): <ide> """Test that a custom error is raised if a token or span is pickled.""" <ide> doc = Doc(en_vocab, words=["Hello", "world"]) <ide> def test_issue2833(en_vocab): <ide> pickle.dumps(doc[0:2]) <ide> <ide> <add>@pytest.mark.issue(2871) <ide> def test_issue2871(): <ide> """Test that vectors recover the correct key for spaCy reserved words.""" <ide> words = ["dog", "cat", "SUFFIX"] <ide> def test_issue2871(): <ide> assert vocab.vectors.find(key="SUFFIX") == 2 <ide> <ide> <add>@pytest.mark.issue(2901) <ide> def test_issue2901(): <ide> """Test that `nlp` doesn't fail.""" <ide> try: <ide> def test_issue2901(): <ide> assert doc <ide> <ide> <add>@pytest.mark.issue(2926) <ide> def test_issue2926(fr_tokenizer): <ide> """Test that the tokenizer correctly splits tokens separated by a slash (/) <ide> ending in a digit. <ide><path>spacy/tests/regression/test_issue3001-3500.py <ide> import numpy <ide> <ide> <add>@pytest.mark.issue(3002) <ide> def test_issue3002(): <ide> """Test that the tokenizer doesn't hang on a long list of dots""" <ide> nlp = German() <ide> def test_issue3002(): <ide> assert len(doc) == 5 <ide> <ide> <add>@pytest.mark.issue(3009) <ide> def test_issue3009(en_vocab): <ide> """Test problem with matcher quantifiers""" <ide> patterns = [ <ide> def test_issue3009(en_vocab): <ide> assert matches <ide> <ide> <add>@pytest.mark.issue(3012) <ide> def test_issue3012(en_vocab): <ide> """Test that the is_tagged attribute doesn't get overwritten when we from_array <ide> without tag information.""" <ide> def test_issue3012(en_vocab): <ide> assert (doc2[2].text, doc2[2].pos_, doc2[2].tag_, doc2[2].ent_type_) == expected <ide> <ide> <add>@pytest.mark.issue(3199) <ide> def test_issue3199(): <ide> """Test that Span.noun_chunks works correctly if no noun chunks iterator <ide> is available. To make this test future-proof, we're constructing a Doc <ide> def test_issue3199(): <ide> list(doc[0:3].noun_chunks) <ide> <ide> <add>@pytest.mark.issue(3209) <ide> def test_issue3209(): <ide> """Test issue that occurred in spaCy nightly where NER labels were being <ide> mapped to classes incorrectly after loading the model, when the labels <ide> def test_issue3209(): <ide> assert ner2.move_names == move_names <ide> <ide> <add>@pytest.mark.issue(3248) <ide> def test_issue3248_1(): <ide> """Test that the PhraseMatcher correctly reports its number of rules, not <ide> total number of patterns.""" <ide> def test_issue3248_1(): <ide> assert len(matcher) == 2 <ide> <ide> <add>@pytest.mark.issue(3248) <ide> def test_issue3248_2(): <ide> """Test that the PhraseMatcher can be pickled correctly.""" <ide> nlp = English() <ide> def test_issue3248_2(): <ide> assert len(new_matcher) == len(matcher) <ide> <ide> <add>@pytest.mark.issue(3277) <ide> def test_issue3277(es_tokenizer): <ide> """Test that hyphens are split correctly as prefixes.""" <ide> doc = es_tokenizer("—Yo me llamo... –murmuró el niño– Emilio Sánchez Pérez.") <ide> def test_issue3277(es_tokenizer): <ide> assert doc[9].text == "\u2013" <ide> <ide> <add>@pytest.mark.issue(3288) <ide> def test_issue3288(en_vocab): <ide> """Test that retokenization works correctly via displaCy when punctuation <ide> is merged onto the preceeding token and tensor is resized.""" <ide> def test_issue3288(en_vocab): <ide> displacy.render(doc) <ide> <ide> <add>@pytest.mark.issue(3289) <ide> def test_issue3289(): <ide> """Test that Language.to_bytes handles serializing a pipeline component <ide> with an uninitialized model.""" <ide> def test_issue3289(): <ide> new_nlp.from_bytes(bytes_data) <ide> <ide> <add>@pytest.mark.issue(3328) <ide> def test_issue3328(en_vocab): <ide> doc = Doc(en_vocab, words=["Hello", ",", "how", "are", "you", "doing", "?"]) <ide> matcher = Matcher(en_vocab) <ide> def test_issue3328(en_vocab): <ide> assert matched_texts == ["Hello", "how", "you", "doing"] <ide> <ide> <add>@pytest.mark.issue(3331) <ide> def test_issue3331(en_vocab): <ide> """Test that duplicate patterns for different rules result in multiple <ide> matches, one per rule. <ide> def test_issue3331(en_vocab): <ide> assert sorted(match_ids) == ["A", "B"] <ide> <ide> <add>@pytest.mark.issue(3345) <ide> def test_issue3345(): <ide> """Test case where preset entity crosses sentence boundary.""" <ide> nlp = English() <ide> def test_issue3345(): <ide> assert ner.moves.is_valid(state, "B-GPE") <ide> <ide> <add>@pytest.mark.issue(3412) <ide> def test_issue3412(): <ide> data = numpy.asarray([[0, 0, 0], [1, 2, 3], [9, 8, 7]], dtype="f") <ide> vectors = Vectors(data=data, keys=["A", "B", "C"]) <ide> def test_issue3412(): <ide> <ide> <ide> @pytest.mark.skip(reason="default suffix rules avoid one upper-case letter before dot") <add>@pytest.mark.issue(3449) <ide> def test_issue3449(): <ide> nlp = English() <ide> nlp.add_pipe("sentencizer") <ide> def test_issue3449(): <ide> assert t3[5].text == "I" <ide> <ide> <add>@pytest.mark.issue(3456) <ide> def test_issue3456(): <ide> # this crashed because of a padding error in layer.ops.unflatten in thinc <ide> nlp = English() <ide> def test_issue3456(): <ide> list(nlp.pipe(["hi", ""])) <ide> <ide> <add>@pytest.mark.issue(3468) <ide> def test_issue3468(): <ide> """Test that sentence boundaries are set correctly so Doc.has_annotation("SENT_START") can <ide> be restored after serialization.""" <ide><path>spacy/tests/regression/test_issue3501-4000.py <ide> <ide> <ide> @pytest.mark.parametrize("word", ["don't", "don’t", "I'd", "I’d"]) <add>@pytest.mark.issue(3521) <ide> def test_issue3521(en_tokenizer, word): <ide> tok = en_tokenizer(word)[1] <ide> # 'not' and 'would' should be stopwords, also in their abbreviated forms <ide> def test_issue_3526_4(en_vocab): <ide> assert new_ruler.overwrite is True <ide> <ide> <add>@pytest.mark.issue(3531) <ide> def test_issue3531(): <ide> """Test that displaCy renderer doesn't require "settings" key.""" <ide> example_dep = { <ide> def test_issue3531(): <ide> assert ent_html <ide> <ide> <add>@pytest.mark.issue(3540) <ide> def test_issue3540(en_vocab): <ide> words = ["I", "live", "in", "NewYork", "right", "now"] <ide> tensor = numpy.asarray( <ide> def test_issue3540(en_vocab): <ide> assert vectors_1[5].tolist() == vectors_2[6].tolist() <ide> <ide> <add>@pytest.mark.issue(3549) <ide> def test_issue3549(en_vocab): <ide> """Test that match pattern validation doesn't raise on empty errors.""" <ide> matcher = Matcher(en_vocab, validate=True) <ide> def test_issue3549(en_vocab): <ide> <ide> <ide> @pytest.mark.skip("Matching currently only works on strings and integers") <add>@pytest.mark.issue(3555) <ide> def test_issue3555(en_vocab): <ide> """Test that custom extensions with default None don't break matcher.""" <ide> Token.set_extension("issue3555", default=None) <ide> def test_issue3555(en_vocab): <ide> matcher(doc) <ide> <ide> <add>@pytest.mark.issue(3611) <ide> def test_issue3611(): <ide> """Test whether adding n-grams in the textcat works even when n > token length of some docs""" <ide> unique_classes = ["offensive", "inoffensive"] <ide> def test_issue3611(): <ide> nlp.update(examples=batch, sgd=optimizer, drop=0.1, losses=losses) <ide> <ide> <add>@pytest.mark.issue(3625) <ide> def test_issue3625(): <ide> """Test that default punctuation rules applies to hindi unicode characters""" <ide> nlp = Hindi() <ide> def test_issue3625(): <ide> assert [token.text for token in doc] == expected <ide> <ide> <add>@pytest.mark.issue(3803) <ide> def test_issue3803(): <ide> """Test that spanish num-like tokens have True for like_num attribute.""" <ide> nlp = Spanish() <ide> def _parser_example(parser): <ide> return Example.from_dict(doc, gold) <ide> <ide> <add>@pytest.mark.issue(3830) <ide> def test_issue3830_no_subtok(): <ide> """Test that the parser doesn't have subtok label if not learn_tokens""" <ide> config = { <ide> def test_issue3830_no_subtok(): <ide> assert "subtok" not in parser.labels <ide> <ide> <add>@pytest.mark.issue(3830) <ide> def test_issue3830_with_subtok(): <ide> """Test that the parser does have subtok label if learn_tokens=True.""" <ide> config = { <ide> def test_issue3830_with_subtok(): <ide> assert "subtok" in parser.labels <ide> <ide> <add>@pytest.mark.issue(3839) <ide> def test_issue3839(en_vocab): <ide> """Test that match IDs returned by the matcher are correct, are in the string""" <ide> doc = Doc(en_vocab, words=["terrific", "group", "of", "people"]) <ide> def test_issue3839(en_vocab): <ide> "It was a missed assignment, but it shouldn't have resulted in a turnover ...", <ide> ], <ide> ) <add>@pytest.mark.issue(3869) <ide> def test_issue3869(sentence): <ide> """Test that the Doc's count_by function works consistently""" <ide> nlp = English() <ide> def test_issue3869(sentence): <ide> assert count == doc.count_by(IS_ALPHA).get(1, 0) <ide> <ide> <add>@pytest.mark.issue(3879) <ide> def test_issue3879(en_vocab): <ide> doc = Doc(en_vocab, words=["This", "is", "a", "test", "."]) <ide> assert len(doc) == 5 <ide> def test_issue3879(en_vocab): <ide> assert len(matcher(doc)) == 2 # fails because of a FP match 'is a test' <ide> <ide> <add>@pytest.mark.issue(3880) <ide> def test_issue3880(): <ide> """Test that `nlp.pipe()` works when an empty string ends the batch. <ide> <ide> def test_issue3880(): <ide> pass <ide> <ide> <add>@pytest.mark.issue(3882) <ide> def test_issue3882(en_vocab): <ide> """Test that displaCy doesn't serialize the doc.user_data when making a <ide> copy of the Doc. <ide> def test_issue3882(en_vocab): <ide> parse_deps(doc) <ide> <ide> <add>@pytest.mark.issue(3951) <ide> def test_issue3951(en_vocab): <ide> """Test that combinations of optional rules are matched correctly.""" <ide> matcher = Matcher(en_vocab) <ide> def test_issue3951(en_vocab): <ide> assert len(matches) == 0 <ide> <ide> <add>@pytest.mark.issue(3959) <ide> def test_issue3959(): <ide> """Ensure that a modified pos attribute is serialized correctly.""" <ide> nlp = English() <ide> def test_issue3959(): <ide> assert doc2[0].pos_ == "NOUN" <ide> <ide> <add>@pytest.mark.issue(3962) <ide> def test_issue3962(en_vocab): <ide> """Ensure that as_doc does not result in out-of-bound access of tokens. <ide> This is achieved by setting the head to itself if it would lie out of the span otherwise.""" <ide> def test_issue3962(en_vocab): <ide> assert len(list(doc3.sents)) == 1 <ide> <ide> <add>@pytest.mark.issue(3962) <ide> def test_issue3962_long(en_vocab): <ide> """Ensure that as_doc does not result in out-of-bound access of tokens. <ide> This is achieved by setting the head to itself if it would lie out of the span otherwise.""" <ide> def test_issue3962_long(en_vocab): <ide> assert sents[1].text == "They never" <ide> <ide> <add>@pytest.mark.issue(3972) <ide> def test_issue3972(en_vocab): <ide> """Test that the PhraseMatcher returns duplicates for duplicate match IDs.""" <ide> matcher = PhraseMatcher(en_vocab) <ide><path>spacy/tests/regression/test_issue4001-4500.py <ide> from ..util import make_tempdir <ide> <ide> <add>@pytest.mark.issue(4002) <ide> def test_issue4002(en_vocab): <ide> """Test that the PhraseMatcher can match on overwritten NORM attributes.""" <ide> matcher = PhraseMatcher(en_vocab, attr="NORM") <ide> def test_issue4002(en_vocab): <ide> assert len(matches) == 1 <ide> <ide> <add>@pytest.mark.issue(4030) <ide> def test_issue4030(): <ide> """Test whether textcat works fine with empty doc""" <ide> unique_classes = ["offensive", "inoffensive"] <ide> def test_issue4030(): <ide> assert doc.cats["inoffensive"] == 0.0 <ide> <ide> <add>@pytest.mark.issue(4042) <ide> def test_issue4042(): <ide> """Test that serialization of an EntityRuler before NER works fine.""" <ide> nlp = English() <ide> def test_issue4042(): <ide> assert doc2.ents[0].label_ == "MY_ORG" <ide> <ide> <add>@pytest.mark.issue(4042) <ide> def test_issue4042_bug2(): <ide> """ <ide> Test that serialization of an NER works fine when new labels were added. <ide> def test_issue4042_bug2(): <ide> assert len(ner2.labels) == 2 <ide> <ide> <add>@pytest.mark.issue(4054) <ide> def test_issue4054(en_vocab): <ide> """Test that a new blank model can be made with a vocab from file, <ide> and that serialization does not drop the language at any point.""" <ide> def test_issue4054(en_vocab): <ide> assert nlp3.lang == "en" <ide> <ide> <add>@pytest.mark.issue(4120) <ide> def test_issue4120(en_vocab): <ide> """Test that matches without a final {OP: ?} token are returned.""" <ide> matcher = Matcher(en_vocab) <ide> def test_issue4120(en_vocab): <ide> assert len(matcher(doc4)) == 3 # fixed <ide> <ide> <add>@pytest.mark.issue(4133) <ide> def test_issue4133(en_vocab): <ide> nlp = English() <ide> vocab_bytes = nlp.vocab.to_bytes() <ide> def test_issue4133(en_vocab): <ide> assert actual == pos <ide> <ide> <add>@pytest.mark.issue(4190) <ide> def test_issue4190(): <ide> def customize_tokenizer(nlp): <ide> prefix_re = compile_prefix_regex(nlp.Defaults.prefixes) <ide> def customize_tokenizer(nlp): <ide> assert result_1b == result_2 <ide> <ide> <add>@pytest.mark.issue(4267) <ide> def test_issue4267(): <ide> """Test that running an entity_ruler after ner gives consistent results""" <ide> nlp = English() <ide> def test_issue4267(): <ide> <ide> <ide> @pytest.mark.skip(reason="lemmatizer lookups no longer in vocab") <add>@pytest.mark.issue(4272) <ide> def test_issue4272(): <ide> """Test that lookup table can be accessed from Token.lemma if no POS tags <ide> are available.""" <ide> def set_annotations(self, docs, scores): <ide> dummy_pipe(doc) <ide> <ide> <add>@pytest.mark.issue(4313) <ide> def test_issue4313(): <ide> """This should not crash or exit with some strange error code""" <ide> beam_width = 16 <ide> def test_issue4313(): <ide> assert "MY_ORG" in ner.labels <ide> <ide> <add>@pytest.mark.issue(4348) <ide> def test_issue4348(): <ide> """Test that training the tagger with empty data, doesn't throw errors""" <ide> nlp = English() <ide> def test_issue4348(): <ide> nlp.update(batch, sgd=optimizer, losses=losses) <ide> <ide> <add>@pytest.mark.issue(4367) <ide> def test_issue4367(): <ide> """Test that docbin init goes well""" <ide> DocBin() <ide> DocBin(attrs=["LEMMA"]) <ide> DocBin(attrs=["LEMMA", "ENT_IOB", "ENT_TYPE"]) <ide> <ide> <add>@pytest.mark.issue(4373) <ide> def test_issue4373(): <ide> """Test that PhraseMatcher.vocab can be accessed (like Matcher.vocab).""" <ide> matcher = Matcher(Vocab()) <ide> def test_issue4373(): <ide> assert isinstance(matcher.vocab, Vocab) <ide> <ide> <add>@pytest.mark.issue(4402) <ide> def test_issue4402(): <ide> json_data = { <ide> "id": 0, <ide><path>spacy/tests/regression/test_issue4501-5000.py <ide> from ..util import make_tempdir <ide> <ide> <add>@pytest.mark.issue(4528) <ide> def test_issue4528(en_vocab): <ide> """Test that user_data is correctly serialized in DocBin.""" <ide> doc = Doc(en_vocab, words=["hello", "world"]) <ide> def test_gold_misaligned(en_tokenizer, text, words): <ide> Example.from_dict(doc, {"words": words}) <ide> <ide> <add>@pytest.mark.issue(4651) <ide> def test_issue4651_with_phrase_matcher_attr(): <ide> """Test that the EntityRuler PhraseMatcher is deserialized correctly using <ide> the method from_disk when the EntityRuler argument phrase_matcher_attr is <ide> def test_issue4651_with_phrase_matcher_attr(): <ide> assert res == res_reloaded <ide> <ide> <add>@pytest.mark.issue(4651) <ide> def test_issue4651_without_phrase_matcher_attr(): <ide> """Test that the EntityRuler PhraseMatcher is deserialized correctly using <ide> the method from_disk when the EntityRuler argument phrase_matcher_attr is <ide> def test_issue4651_without_phrase_matcher_attr(): <ide> assert res == res_reloaded <ide> <ide> <add>@pytest.mark.issue(4665) <ide> def test_issue4665(): <ide> """ <ide> conllu_to_docs should not raise an exception if the HEAD column contains an <ide> def test_issue4665(): <ide> conllu_to_docs(input_data) <ide> <ide> <add>@pytest.mark.issue(4674) <ide> def test_issue4674(): <ide> """Test that setting entities with overlapping identifiers does not mess up IO""" <ide> nlp = English() <ide> def test_issue4674(): <ide> <ide> <ide> @pytest.mark.skip(reason="API change: disable just disables, new exclude arg") <add>@pytest.mark.issue(4707) <ide> def test_issue4707(): <ide> """Tests that disabled component names are also excluded from nlp.from_disk <ide> by default when loading a model. <ide> def test_issue4707(): <ide> assert "entity_ruler" in new_nlp.pipe_names <ide> <ide> <add>@pytest.mark.issue(4725) <ide> def test_issue4725_1(): <ide> """Ensure the pickling of the NER goes well""" <ide> vocab = Vocab(vectors_name="test_vocab_add_vector") <ide> def test_issue4725_1(): <ide> assert ner2.cfg["update_with_oracle_cut_size"] == 111 <ide> <ide> <add>@pytest.mark.issue(4725) <ide> def test_issue4725_2(): <ide> if isinstance(get_current_ops, NumpyOps): <ide> # ensures that this runs correctly and doesn't hang or crash because of the global vectors <ide> def test_issue4725_2(): <ide> pass <ide> <ide> <add>@pytest.mark.issue(4849) <ide> def test_issue4849(): <ide> nlp = English() <ide> patterns = [ <ide> def _get_my_ext(span): <ide> return str(span.end) <ide> <ide> <add>@pytest.mark.issue(4903) <ide> def test_issue4903(): <ide> """Ensure that this runs correctly and doesn't hang or crash on Windows / <ide> macOS.""" <ide> def test_issue4903(): <ide> assert docs[2].text == "No, I prefer wasabi." <ide> <ide> <add>@pytest.mark.issue(4924) <ide> def test_issue4924(): <ide> nlp = Language() <ide> example = Example.from_dict(nlp.make_doc(""), {}) <ide><path>spacy/tests/regression/test_issue5001-5500.py <ide> from ...util import make_tempdir <ide> <ide> <add>@pytest.mark.issue(5048) <ide> def test_issue5048(en_vocab): <ide> words = ["This", "is", "a", "sentence"] <ide> pos_s = ["DET", "VERB", "DET", "NOUN"] <ide> def test_issue5048(en_vocab): <ide> assert v1 == v2 <ide> <ide> <add>@pytest.mark.issue(5082) <ide> def test_issue5082(): <ide> # Ensure the 'merge_entities' pipeline does something sensible for the vectors of the merged tokens <ide> nlp = English() <ide> def test_issue5082(): <ide> numpy.testing.assert_array_equal(ops.to_numpy(parsed_vectors_2[2]), array34) <ide> <ide> <add>@pytest.mark.issue(5137) <ide> def test_issue5137(): <ide> factory_name = "test_issue5137" <ide> pipe_name = "my_component" <ide> def from_disk(self, path, **cfg): <ide> assert nlp2.get_pipe(pipe_name).categories == "my_categories" <ide> <ide> <add>@pytest.mark.issue(5141) <ide> def test_issue5141(en_vocab): <ide> """Ensure an empty DocBin does not crash on serialization""" <ide> doc_bin = DocBin(attrs=["DEP", "HEAD"]) <ide> def test_issue5141(en_vocab): <ide> assert list(doc_bin_2.get_docs(en_vocab)) == [] <ide> <ide> <add>@pytest.mark.issue(5152) <ide> def test_issue5152(): <ide> # Test that the comparison between a Span and a Token, goes well <ide> # There was a bug when the number of tokens in the span equaled the number of characters in the token (!) <ide> def test_issue5152(): <ide> assert span_2.similarity(span_3) < 1.0 <ide> <ide> <add>@pytest.mark.issue(5458) <ide> def test_issue5458(): <ide> # Test that the noun chuncker does not generate overlapping spans <ide> # fmt: off <ide><path>spacy/tests/regression/test_issue5501-6000.py <ide> multi_label_cnn_config, <ide> ], <ide> ) <add>@pytest.mark.issue(5551) <ide> def test_issue5551(textcat_config): <ide> """Test that after fixing the random seed, the results of the pipeline are truly identical""" <ide> component = "textcat" <ide> def test_issue5551(textcat_config): <ide> assert_almost_equal(ops.to_numpy(results[0]), ops.to_numpy(results[2]), decimal=5) <ide> <ide> <add>@pytest.mark.issue(5838) <ide> def test_issue5838(): <ide> # Displacy's EntityRenderer break line <ide> # not working after last entity <ide> def test_issue5838(): <ide> assert found == 4 <ide> <ide> <add>@pytest.mark.issue(5918) <ide> def test_issue5918(): <ide> # Test edge case when merging entities. <ide> nlp = English() <ide><path>spacy/tests/regression/test_issue6001-6500.py <ide> import pytest <ide> <ide> <add>@pytest.mark.issue(6207) <ide> def test_issue6207(en_tokenizer): <ide> doc = en_tokenizer("zero one two three four five six") <ide> <ide> def test_issue6207(en_tokenizer): <ide> assert s3 in result <ide> <ide> <add>@pytest.mark.issue(6258) <ide> def test_issue6258(): <ide> """Test that the non-empty constraint pattern field is respected""" <ide> # These one is valid <ide><path>spacy/tests/regression/test_issue6501-7000.py <ide> from ..util import make_tempdir <ide> <ide> <add>@pytest.mark.issue(6730) <ide> def test_issue6730(en_vocab): <ide> """Ensure that the KB does not accept empty strings, but otherwise IO works fine.""" <ide> from spacy.kb import KnowledgeBase <ide> def test_issue6730(en_vocab): <ide> assert set(kb.get_alias_strings()) == {"x", "y"} <ide> <ide> <add>@pytest.mark.issue(6755) <ide> def test_issue6755(en_tokenizer): <ide> doc = en_tokenizer("This is a magnificent sentence.") <ide> span = doc[:0] <ide> def test_issue6755(en_tokenizer): <ide> "sentence, start_idx,end_idx,label", <ide> [("Welcome to Mumbai, my friend", 11, 17, "GPE")], <ide> ) <add>@pytest.mark.issue(6815) <ide> def test_issue6815_1(sentence, start_idx, end_idx, label): <ide> nlp = English() <ide> doc = nlp(sentence) <ide> def test_issue6815_1(sentence, start_idx, end_idx, label): <ide> @pytest.mark.parametrize( <ide> "sentence, start_idx,end_idx,kb_id", [("Welcome to Mumbai, my friend", 11, 17, 5)] <ide> ) <add>@pytest.mark.issue(6815) <ide> def test_issue6815_2(sentence, start_idx, end_idx, kb_id): <ide> nlp = English() <ide> doc = nlp(sentence) <ide> def test_issue6815_2(sentence, start_idx, end_idx, kb_id): <ide> "sentence, start_idx,end_idx,vector", <ide> [("Welcome to Mumbai, my friend", 11, 17, np.array([0.1, 0.2, 0.3]))], <ide> ) <add>@pytest.mark.issue(6815) <ide> def test_issue6815_3(sentence, start_idx, end_idx, vector): <ide> nlp = English() <ide> doc = nlp(sentence) <ide> span = doc[:].char_span(start_idx, end_idx, vector=vector) <ide> assert (span.vector == vector).all() <ide> <ide> <add>@pytest.mark.issue(6839) <ide> def test_issue6839(en_vocab): <ide> """Ensure that PhraseMatcher accepts Span as input""" <ide> # fmt: off <ide> def test_issue6839(en_vocab): <ide> "component_name", <ide> ["textcat", "textcat_multilabel"], <ide> ) <add>@pytest.mark.issue(6908) <ide> def test_issue6908(component_name): <ide> """Test intializing textcat with labels in a list""" <ide> <ide> def create_data(out_file): <ide> """ <ide> <ide> <add>@pytest.mark.issue(6950) <ide> def test_issue6950(): <ide> """Test that the nlp object with initialized tok2vec with listeners pickles <ide> correctly (and doesn't have lambdas). <ide><path>spacy/tests/regression/test_issue7001-8000.py <ide> from ..util import make_tempdir <ide> <ide> <add>@pytest.mark.issue(7019) <ide> def test_issue7019(): <ide> scores = {"LABEL_A": 0.39829102, "LABEL_B": 0.938298329382, "LABEL_C": None} <ide> print_textcats_auc_per_cat(msg, scores) <ide> def test_issue7019(): <ide> """ <ide> <ide> <add>@pytest.mark.issue(7029) <ide> def test_issue7029(): <ide> """Test that an empty document doesn't mess up an entire batch.""" <ide> TRAIN_DATA = [ <ide> def test_issue7029(): <ide> assert [doc[0].tag_ for doc in docs1[:-1]] == [doc[0].tag_ for doc in docs2[:-1]] <ide> <ide> <add>@pytest.mark.issue(7055) <ide> def test_issue7055(): <ide> """Test that fill-config doesn't turn sourced components into factories.""" <ide> source_cfg = { <ide> def test_issue7055(): <ide> assert "model" in filled_cfg["components"]["ner"] <ide> <ide> <add>@pytest.mark.issue(7056) <ide> def test_issue7056(): <ide> """Test that the Unshift transition works properly, and doesn't cause <ide> sentence segmentation errors.""" <ide> def create_kb(vocab): <ide> assert "ORG" not in results["nel_f_per_type"] <ide> <ide> <add>@pytest.mark.issue(7065) <ide> def test_issue7065(): <ide> text = "Kathleen Battle sang in Mahler 's Symphony No. 8 at the Cincinnati Symphony Orchestra 's May Festival." <ide> nlp = English() <ide> def test_issue7065(): <ide> assert sentences.index(ent.sent) == 0 <ide> <ide> <add>@pytest.mark.issue(7065) <ide> def test_issue7065_b(): <ide> # Test that the NEL doesn't crash when an entity crosses a sentence boundary <ide> nlp = English() <ide><path>spacy/tests/regression/test_issue7716.py <ide> def parser(vocab): <ide> return parser <ide> <ide> <add>@pytest.mark.issue(7716) <ide> @pytest.mark.xfail(reason="Not fixed yet") <ide> def test_partial_annotation(parser): <ide> doc = Doc(parser.vocab, words=["a", "b", "c", "d"]) <ide><path>spacy/tests/regression/test_issue8190.py <ide> from ..util import make_tempdir <ide> <ide> <add>@pytest.mark.issue(8190) <ide> def test_issue8190(): <ide> """Test that config overrides are not lost after load is complete.""" <ide> source_cfg = { <ide><path>spacy/tests/regression/test_issue8216.py <ide> def patterns(): <ide> ] <ide> <ide> <add>@pytest.mark.issue(8216) <ide> def test_entity_ruler_fix8216(nlp, patterns): <ide> """Test that patterns don't get added excessively.""" <ide> ruler = nlp.add_pipe("entity_ruler", config={"validate": True})
17
Go
Go
add support for srv query in embedded dns
0051e39750559340e667ae7712afc18f81a45cb6
<ide><path>libnetwork/libnetwork_internal_test.go <ide> func TestAuxAddresses(t *testing.T) { <ide> } <ide> } <ide> <add>func TestSRVServiceQuery(t *testing.T) { <add> c, err := New() <add> if err != nil { <add> t.Fatal(err) <add> } <add> defer c.Stop() <add> <add> n, err := c.NewNetwork("bridge", "net1", "", nil) <add> if err != nil { <add> t.Fatal(err) <add> } <add> defer func() { <add> if err := n.Delete(); err != nil { <add> t.Fatal(err) <add> } <add> }() <add> <add> ep, err := n.CreateEndpoint("testep") <add> if err != nil { <add> t.Fatal(err) <add> } <add> <add> sb, err := c.NewSandbox("c1") <add> if err != nil { <add> t.Fatal(err) <add> } <add> defer func() { <add> if err := sb.Delete(); err != nil { <add> t.Fatal(err) <add> } <add> }() <add> <add> err = ep.Join(sb) <add> if err != nil { <add> t.Fatal(err) <add> } <add> <add> sr := svcInfo{ <add> svcMap: make(map[string][]net.IP), <add> svcIPv6Map: make(map[string][]net.IP), <add> ipMap: make(map[string]string), <add> service: make(map[string][]servicePorts), <add> } <add> // backing container for the service <add> cTarget := serviceTarget{ <add> name: "task1.web.swarm", <add> ip: net.ParseIP("192.168.10.2"), <add> port: 80, <add> } <add> // backing host for the service <add> hTarget := serviceTarget{ <add> name: "node1.docker-cluster", <add> ip: net.ParseIP("10.10.10.2"), <add> port: 45321, <add> } <add> httpPort := servicePorts{ <add> portName: "_http", <add> proto: "_tcp", <add> target: []serviceTarget{cTarget}, <add> } <add> <add> extHTTPPort := servicePorts{ <add> portName: "_host_http", <add> proto: "_tcp", <add> target: []serviceTarget{hTarget}, <add> } <add> sr.service["web.swarm"] = append(sr.service["web.swarm"], httpPort) <add> sr.service["web.swarm"] = append(sr.service["web.swarm"], extHTTPPort) <add> <add> c.(*controller).svcRecords[n.ID()] = sr <add> <add> _, ip, err := ep.Info().Sandbox().ResolveService("_http._tcp.web.swarm") <add> if err != nil { <add> t.Fatal(err) <add> } <add> if len(ip) == 0 { <add> t.Fatal(err) <add> } <add> if ip[0].String() != "192.168.10.2" { <add> t.Fatal(err) <add> } <add> <add> _, ip, err = ep.Info().Sandbox().ResolveService("_host_http._tcp.web.swarm") <add> if err != nil { <add> t.Fatal(err) <add> } <add> if len(ip) == 0 { <add> t.Fatal(err) <add> } <add> if ip[0].String() != "10.10.10.2" { <add> t.Fatal(err) <add> } <add> <add> // Try resolving a service name with invalid protocol, should fail.. <add> _, _, err = ep.Info().Sandbox().ResolveService("_http._icmp.web.swarm") <add> if err == nil { <add> t.Fatal(err) <add> } <add>} <add> <ide> func TestIpamReleaseOnNetDriverFailures(t *testing.T) { <ide> if !testutils.IsRunningInContainer() { <ide> defer testutils.SetupTestOSContext(t)() <ide><path>libnetwork/libnetwork_test.go <ide> func (f *fakeSandbox) ResolveIP(ip string) string { <ide> return "" <ide> } <ide> <add>func (f *fakeSandbox) ResolveService(name string) ([]*net.SRV, []net.IP, error) { <add> return nil, nil, nil <add>} <add> <ide> func (f *fakeSandbox) Endpoints() []libnetwork.Endpoint { <ide> return nil <ide> } <ide><path>libnetwork/network.go <ide> type svcInfo struct { <ide> svcMap map[string][]net.IP <ide> svcIPv6Map map[string][]net.IP <ide> ipMap map[string]string <add> service map[string][]servicePorts <ide> } <ide> <ide> // IpamConf contains all the ipam related configurations for a network <ide><path>libnetwork/resolver.go <ide> func (r *resolver) handlePTRQuery(ptr string, query *dns.Msg) (*dns.Msg, error) <ide> return resp, nil <ide> } <ide> <add>func (r *resolver) handleSRVQuery(svc string, query *dns.Msg) (*dns.Msg, error) { <add> srv, ip, err := r.sb.ResolveService(svc) <add> <add> if err != nil { <add> return nil, err <add> } <add> if len(srv) != len(ip) { <add> return nil, fmt.Errorf("invalid reply for SRV query %s", svc) <add> } <add> <add> resp := createRespMsg(query) <add> <add> for i, r := range srv { <add> rr := new(dns.SRV) <add> rr.Hdr = dns.RR_Header{Name: svc, Rrtype: dns.TypePTR, Class: dns.ClassINET, Ttl: respTTL} <add> rr.Port = r.Port <add> rr.Target = r.Target <add> resp.Answer = append(resp.Answer, rr) <add> <add> rr1 := new(dns.A) <add> rr1.Hdr = dns.RR_Header{Name: r.Target, Rrtype: dns.TypeA, Class: dns.ClassINET, Ttl: respTTL} <add> rr1.A = ip[i] <add> resp.Extra = append(resp.Extra, rr1) <add> } <add> return resp, nil <add> <add>} <add> <ide> func truncateResp(resp *dns.Msg, maxSize int, isTCP bool) { <ide> if !isTCP { <ide> resp.Truncated = true <ide> } <ide> <add> srv := resp.Question[0].Qtype == dns.TypeSRV <ide> // trim the Answer RRs one by one till the whole message fits <ide> // within the reply size <ide> for resp.Len() > maxSize { <ide> resp.Answer = resp.Answer[:len(resp.Answer)-1] <add> <add> if srv && len(resp.Extra) > 0 { <add> resp.Extra = resp.Extra[:len(resp.Extra)-1] <add> } <ide> } <ide> } <ide> <ide> func (r *resolver) ServeDNS(w dns.ResponseWriter, query *dns.Msg) { <ide> return <ide> } <ide> name := query.Question[0].Name <del> if query.Question[0].Qtype == dns.TypeA { <add> <add> switch query.Question[0].Qtype { <add> case dns.TypeA: <ide> resp, err = r.handleIPQuery(name, query, types.IPv4) <del> } else if query.Question[0].Qtype == dns.TypeAAAA { <add> case dns.TypeAAAA: <ide> resp, err = r.handleIPQuery(name, query, types.IPv6) <del> } else if query.Question[0].Qtype == dns.TypePTR { <add> case dns.TypePTR: <ide> resp, err = r.handlePTRQuery(name, query) <add> case dns.TypeSRV: <add> resp, err = r.handleSRVQuery(name, query) <ide> } <ide> <ide> if err != nil { <ide><path>libnetwork/sandbox.go <ide> type Sandbox interface { <ide> // ResolveIP returns the service name for the passed in IP. IP is in reverse dotted <ide> // notation; the format used for DNS PTR records <ide> ResolveIP(name string) string <add> // ResolveService returns all the backend details about the containers or hosts <add> // backing a service. Its purpose is to satisfy an SRV query <add> ResolveService(name string) ([]*net.SRV, []net.IP, error) <ide> // Endpoints returns all the endpoints connected to the sandbox <ide> Endpoints() []Endpoint <ide> } <ide> func (sb *sandbox) execFunc(f func()) { <ide> sb.osSbox.InvokeFunc(f) <ide> } <ide> <add>func (sb *sandbox) ResolveService(name string) ([]*net.SRV, []net.IP, error) { <add> srv := []*net.SRV{} <add> ip := []net.IP{} <add> <add> log.Debugf("Service name To resolve: %v", name) <add> <add> parts := strings.Split(name, ".") <add> if len(parts) < 3 { <add> return nil, nil, fmt.Errorf("invalid service name, %s", name) <add> } <add> <add> portName := parts[0] <add> proto := parts[1] <add> if proto != "_tcp" && proto != "_udp" { <add> return nil, nil, fmt.Errorf("invalid protocol in service, %s", name) <add> } <add> svcName := strings.Join(parts[2:], ".") <add> <add> for _, ep := range sb.getConnectedEndpoints() { <add> n := ep.getNetwork() <add> <add> sr, ok := n.getController().svcRecords[n.ID()] <add> if !ok { <add> continue <add> } <add> <add> svcs, ok := sr.service[svcName] <add> if !ok { <add> continue <add> } <add> <add> for _, svc := range svcs { <add> if svc.portName != portName { <add> continue <add> } <add> if svc.proto != proto { <add> continue <add> } <add> for _, t := range svc.target { <add> srv = append(srv, <add> &net.SRV{ <add> Target: t.name, <add> Port: t.port, <add> }) <add> <add> ip = append(ip, t.ip) <add> } <add> } <add> if len(srv) > 0 { <add> break <add> } <add> } <add> return srv, ip, nil <add>} <add> <ide> func (sb *sandbox) ResolveName(name string, ipType int) ([]net.IP, bool) { <ide> // Embedded server owns the docker network domain. Resolution should work <ide> // for both container_name and container_name.network_name <ide><path>libnetwork/service.go <ide> package libnetwork <ide> <ide> import "net" <ide> <add>// backing container or host's info <add>type serviceTarget struct { <add> name string <add> ip net.IP <add> port uint16 <add>} <add> <add>type servicePorts struct { <add> portName string <add> proto string <add> target []serviceTarget <add>} <add> <ide> type service struct { <ide> name string <ide> id string
6
Python
Python
fix tokenizer to tensors
78863f6b36e975f718eeae01a6cea3681ff735aa
<ide><path>pytorch_transformers/tokenization_utils.py <ide> <ide> if is_tf_available(): <ide> import tensorflow as tf <add>if is_torch_available() <add> import torch <ide> <ide> logger = logging.getLogger(__name__) <ide> <ide> def prepare_for_model(self, ids, pair_ids=None, max_length=None, add_special_tok <ide> if return_tensors == 'tf' and is_tf_available(): <ide> sequence = tf.constant(sequence) <ide> token_type_ids = tf.constant(token_type_ids) <del> elif return_tensors = 'pt' and is <add> elif return_tensors == 'pt' and is_torch_available(): <add> sequence = torch.tensor(sequence) <add> token_type_ids = torch.tensor(token_type_ids) <add> elif return_tensors is not None: <add> logger.warning("Unable to convert output to tensors format {}, PyTorch or TensorFlow is not available.".format(return_tensors)) <ide> <ide> encoded_inputs["input_ids"] = sequence <ide> encoded_inputs["token_type_ids"] = token_type_ids
1
PHP
PHP
add missing methods to queuefake
6bfa29e220adbd35523e897d813524b4c3928dde
<ide><path>src/Illuminate/Support/Testing/Fakes/QueueFake.php <ide> public function pop($queue = null) <ide> { <ide> // <ide> } <add> <add> /** <add> * Push an array of jobs onto the queue. <add> * <add> * @param array $jobs <add> * @param mixed $data <add> * @param string $queue <add> * @return mixed <add> */ <add> public function bulk($jobs, $data = '', $queue = null) <add> { <add> // <add> } <add> <add> /** <add> * Get the connection name for the queue. <add> * <add> * @return string <add> */ <add> public function getConnectionName() <add> { <add> // <add> } <add> <add> /** <add> * Set the connection name for the queue. <add> * <add> * @param string $name <add> * @return $this <add> */ <add> public function setConnectionName($name) <add> { <add> return $this; <add> } <ide> }
1
Text
Text
fix doc styling and formatting issues
107d6228db87a0bfded66b06f54f674e1d123e67
<ide><path>docs/_posts/2015-12-16-ismounted-antipattern.md <ide> const makeCancelable = (promise) => { <ide> }; <ide> }; <ide> ``` <del>As an added bonus for getting your code cleaned up early, getting rid of `isMounted()` makes it one step easier for you to upgrade to ES6 classes, where using `isMounted()` is already prohibited. Happy coding! <ide> <del>* _Update 2017-05-12: altered `#makeCancelable` implementation so rejected promises won't go uncaught._ <add>As an added bonus for getting your code cleaned up early, getting rid of `isMounted()` makes it one step easier for you to upgrade to ES6 classes, where using `isMounted()` is already prohibited. Happy coding! <ide><path>docs/docs/addons-animation.md <ide> redirect_from: <ide> - "docs/animation-zh-CN.html" <ide> --- <ide> <del>>Note: <del>> `ReactTransitionGroup` and `ReactCSSTransitionGroup` are both deprecated as of React v15.5.0. The recommendation is to use `TransitionGroup` and `CSSTransitionGroup` from ['react-transition-group'](https://github.com/reactjs/react-transition-group) instead. <add>> Note: <add>> <add>> `ReactTransitionGroup` and `ReactCSSTransitionGroup` are both deprecated as of React v15.5.0. The recommendation is to use `TransitionGroup` and `CSSTransitionGroup` from [`react-transition-group`](https://github.com/reactjs/react-transition-group) instead. <ide> <ide> The [`ReactTransitionGroup`](#low-level-api-reacttransitiongroup) add-on component is a low-level API for animation, and [`ReactCSSTransitionGroup`](#high-level-api-reactcsstransitiongroup) is an add-on component for easily implementing basic CSS animations and transitions. <ide> <ide><path>docs/docs/addons-pure-render-mixin.md <ide> category: Add-Ons <ide> --- <ide> <ide> > Note: <add>> <ide> > `PureRenderMixin` is a legacy add-on. Use [`React.PureComponent`](/react/docs/react-api.html#react.purecomponent) instead. <ide> <ide> **Importing** <ide><path>docs/docs/addons-shallow-compare.md <ide> category: Reference <ide> --- <ide> <ide> > Note: <add>> <ide> > `shallowCompare` is a legacy add-on. Use [`React.PureComponent`](/react/docs/react-api.html#react.purecomponent) instead. <ide> <ide> **Importing** <ide><path>docs/docs/addons-shallow-renderer.md <ide> category: Reference <ide> **Importing** <ide> <ide> ```javascript <del>import ReactShallowRenderer from 'react-test-renderer/shallow'; // ES6 <del>var ReactShallowRenderer = require('react-test-renderer/shallow'); // ES5 with npm <add>import ShallowRenderer from 'react-test-renderer/shallow'; // ES6 <add>var ShallowRenderer = require('react-test-renderer/shallow'); // ES5 with npm <ide> ``` <del>### Shallow Rendering <ide> <del>When writing unit tests for React, shallow rendering can be helpful. Shallow rendering lets you render a component "one level deep" and assert facts about what its render method returns, without worrying about the behavior of child components, which are not instantiated or rendered. This does not require a DOM. <del> <del> - [`shallowRenderer.render()`](#shallowrenderer.render) <del> - [`shallowRenderer.getRenderOutput()`](#shallowrenderer.getrenderoutput) <del> <del>You can think of the shallowRenderer as a "place" to render the component you're testing, and from which you can extract the component's output. <add>## Overview <ide> <del>[`shallowRenderer.render()`](#shallowrenderer.render) is similar to [`ReactDOM.render()`](/react/docs/react-dom.html#render) but it doesn't require DOM and only renders a single level deep. This means you can test components isolated from how their children are implemented. <del> <del>After `shallowRenderer.render()` has been called, you can use [`shallowRenderer.getRenderOutput()`](#shallowrenderer.getrenderoutput) to get the shallowly rendered output. <add>When writing unit tests for React, shallow rendering can be helpful. Shallow rendering lets you render a component "one level deep" and assert facts about what its render method returns, without worrying about the behavior of child components, which are not instantiated or rendered. This does not require a DOM. <ide> <del>You can then begin to assert facts about the output. For example, if you have the following component: <add>For example, if you have the following component: <ide> <ide> ```javascript <ide> function MyComponent() { <ide> function MyComponent() { <ide> Then you can assert: <ide> <ide> ```javascript <del>const ReactShallowRenderer = require('react-test-renderer/shallow'); <del>const shallowRenderer = new ReactShallowRenderer(); <del>shallowRenderer.render(<MyComponent />); <del>const result = shallowRenderer.getRenderOutput(); <add>import ShallowRenderer from 'react-test-renderer/shallow'; <add> <add>// in your test: <add>const renderer = new ShallowRenderer(); <add>renderer.render(<MyComponent />); <add>const result = renderer.getRenderOutput(); <ide> <ide> expect(result.type).toBe('div'); <ide> expect(result.props.children).toEqual([ <ide> expect(result.props.children).toEqual([ <ide> <ide> Shallow testing currently has some limitations, namely not supporting refs. <ide> <del>We also recommend checking out Enzyme's [Shallow Rendering API](http://airbnb.io/enzyme/docs/api/shallow.html). It provides a nicer higher-level API over the same functionality. <add>> Note: <add>> <add>> We also recommend checking out Enzyme's [Shallow Rendering API](http://airbnb.io/enzyme/docs/api/shallow.html). It provides a nicer higher-level API over the same functionality. <add> <add>## Reference <add> <add>### `shallowRenderer.render()` <add> <add>You can think of the shallowRenderer as a "place" to render the component you're testing, and from which you can extract the component's output. <add> <add>`shallowRenderer.render()` is similar to [`ReactDOM.render()`](/react/docs/react-dom.html#render) but it doesn't require DOM and only renders a single level deep. This means you can test components isolated from how their children are implemented. <add> <add>### `shallowRenderer.getRenderOutput()` <add> <add>After `shallowRenderer.render()` has been called, you can use `shallowRenderer.getRenderOutput()` to get the shallowly rendered output. <ide> <add>You can then begin to assert facts about the output. <ide><path>docs/docs/addons-test-utils.md <ide> var ReactTestUtils = require('react-dom/test-utils'); // ES5 with npm <ide> <ide> ## Shallow Rendering <ide> <add>When writing unit tests for React, shallow rendering can be helpful. Shallow rendering lets you render a component "one level deep" and assert facts about what its render method returns, without worrying about the behavior of child components, which are not instantiated or rendered. This does not require a DOM. <add> <ide> > Note: <del>> The shallow renderer has moved to `react-test-renderer/shallow`. [Please see the updated documentation.](/react/docs/shallow-renderer.html) <add>> <add>> The shallow renderer has moved to `react-test-renderer/shallow`.<br> <add>> [Learn more about shallow rendering on its reference page.](/react/docs/shallow-renderer.html) <add> <add>## Other Utilities <ide> <ide> ### `Simulate` <ide> <ide><path>docs/docs/addons-two-way-binding-helpers.md <ide> category: Add-Ons <ide> --- <ide> <ide> > Note: <add>> <ide> > `LinkedStateMixin` is deprecated as of React v15. The recommendation is to explicitly set the value and change handler, instead of using `LinkedStateMixin`. <ide> <ide> **Importing** <ide><path>docs/docs/addons-update.md <ide> category: Add-Ons <ide> --- <ide> <ide> > Note: <del>> `update` is a legacy add-on. Use [kolodny/immutability-helper](https://github.com/kolodny/immutability-helper) instead. <add>> <add>> `update` is a legacy add-on. Use [`immutability-helper`](https://github.com/kolodny/immutability-helper) instead. <ide> <ide> **Importing** <ide> <ide><path>docs/docs/lifting-state-up.md <ide> Now, when the `TemperatureInput` wants to update its temperature, it calls `this <ide> this.props.onTemperatureChange(e.target.value); <ide> ``` <ide> <del>> Note that there is no special meaning to either `temperature` or `onTemperatureChange` prop names in custom components. We could have called them anything else, like name them `value` and `onChange` which is a common convention. <add>>Note: <add>> <add>>There is no special meaning to either `temperature` or `onTemperatureChange` prop names in custom components. We could have called them anything else, like name them `value` and `onChange` which is a common convention. <ide> <ide> The `onTemperatureChange` prop will be provided together with the `temperature` prop by the parent `Calculator` component. It will handle the change by modifying its own local state, thus re-rendering both inputs with the new values. We will look at the new `Calculator` implementation very soon. <ide>
9
Javascript
Javascript
fix shallow renderer with ref as function
f00d45d65f27f2b719c9b48f972f4ae015ada7dd
<ide><path>src/test/ReactTestUtils.js <ide> NoopInternalComponent.prototype = { <ide> unmountComponent: function() { <ide> }, <ide> <add> getPublicInstance: function() { <add> return null; <add> }, <ide> }; <ide> <ide> var ShallowComponentWrapper = function() { }; <ide><path>src/test/__tests__/ReactTestUtils-test.js <ide> describe('ReactTestUtils', function() { <ide> expect(result).toEqual(<div />); <ide> }); <ide> <add> it('can shallowly render components with ref as function', function() { <add> var SimpleComponent = React.createClass({ <add> getInitialState: function() { <add> return {clicked: false}; <add> }, <add> handleUserClick: function() { <add> this.setState({ clicked: true }); <add> }, <add> render: function() { <add> return <div ref={() => {}} onClick={this.handleUserClick} className={this.state.clicked ? 'clicked' : ''}></div>; <add> }, <add> }); <add> <add> var shallowRenderer = ReactTestUtils.createRenderer(); <add> shallowRenderer.render(<SimpleComponent />); <add> var result = shallowRenderer.getRenderOutput(); <add> expect(result.type).toEqual('div'); <add> expect(result.props.className).toEqual(''); <add> result.props.onClick(); <add> <add> result = shallowRenderer.getRenderOutput(); <add> expect(result.type).toEqual('div'); <add> expect(result.props.className).toEqual('clicked'); <add> }); <add> <ide> it('can pass context when shallowly rendering', function() { <ide> var SimpleComponent = React.createClass({ <ide> contextTypes: {
2
Javascript
Javascript
add hascrypto when using binding('crypto')
6fc9c331c624ceef5efcce19b1d610340e1f39be
<ide><path>test/parallel/test-accessor-properties.js <ide> 'use strict'; <ide> <del>require('../common'); <add>const common = require('../common'); <ide> <ide> // This tests that the accessor properties do not raise assertions <ide> // when called with incompatible receivers. <ide> const assert = require('assert'); <ide> const TTY = process.binding('tty_wrap').TTY; <ide> const UDP = process.binding('udp_wrap').UDP; <ide> <del>// There are accessor properties in crypto too <del>const crypto = process.binding('crypto'); <del> <ide> { <ide> // Should throw instead of raise assertions <ide> assert.throws(() => { <ide> const crypto = process.binding('crypto'); <ide> UDP.prototype.fd; <ide> }, TypeError); <ide> <del> assert.throws(() => { <del> crypto.SecureContext.prototype._external; <del> }, TypeError); <del> <del> assert.throws(() => { <del> crypto.Connection.prototype._external; <del> }, TypeError); <del> <del> <ide> // Should not throw for Object.getOwnPropertyDescriptor <ide> assert.strictEqual( <ide> typeof Object.getOwnPropertyDescriptor(TTY.prototype, 'bytesRead'), <ide> const crypto = process.binding('crypto'); <ide> 'object' <ide> ); <ide> <del> assert.strictEqual( <del> typeof Object.getOwnPropertyDescriptor( <del> crypto.SecureContext.prototype, '_external'), <del> 'object' <del> ); <del> <del> assert.strictEqual( <del> typeof Object.getOwnPropertyDescriptor( <del> crypto.Connection.prototype, '_external'), <del> 'object' <del> ); <add> if (common.hasCrypto) { // eslint-disable-line crypto-check <add> // There are accessor properties in crypto too <add> const crypto = process.binding('crypto'); <add> <add> assert.throws(() => { <add> crypto.SecureContext.prototype._external; <add> }, TypeError); <add> <add> assert.throws(() => { <add> crypto.Connection.prototype._external; <add> }, TypeError); <add> <add> assert.strictEqual( <add> typeof Object.getOwnPropertyDescriptor( <add> crypto.SecureContext.prototype, '_external'), <add> 'object' <add> ); <add> <add> assert.strictEqual( <add> typeof Object.getOwnPropertyDescriptor( <add> crypto.Connection.prototype, '_external'), <add> 'object' <add> ); <add> } <ide> } <ide><path>test/parallel/test-http2-util-headers-list.js <ide> // to pass to the internal binding layer. <ide> <ide> const common = require('../common'); <add>if (!common.hasCrypto) <add> common.skip('missing crypto'); <ide> const assert = require('assert'); <ide> const { mapToHeaders } = require('internal/http2/util'); <ide> <ide><path>test/parallel/test-http2-util-update-options-buffer.js <ide> // Flags: --expose-internals <ide> 'use strict'; <ide> <del>require('../common'); <add>const common = require('../common'); <add>if (!common.hasCrypto) <add> common.skip('missing crypto'); <ide> <ide> // Test coverage for the updateOptionsBuffer method used internally <ide> // by the http2 implementation.
3
Text
Text
fix docs for sample query parameters
9a3a0da319f566caba7fcfa225ab9214e92c935b
<ide><path>docs/routing/dynamic-routes.md <ide> Similarly, the route `/post/abc?foo=bar` will have the following `query` object: <ide> However, route parameters will override query parameters with the same name. For example, the route `/post/abc?pid=123` will have the following `query` object: <ide> <ide> ```json <del>{ "pid": "abc" } <add>{ "pid": "123" } <ide> ``` <ide> <ide> Multiple dynamic route segments work the same way. The page `pages/post/[pid]/[comment].js` will match the route `/post/abc/a-comment` and its `query` object will be:
1
Python
Python
add blank line for pep8
a3b990df1bb535064e31c099be19290e9c684ce6
<ide><path>benchmarks/benchmarks/bench_shape_base.py <ide> <ide> import numpy as np <ide> <add> <ide> class Block(Benchmark): <ide> params = [1, 10, 100] <ide> param_names = ['size']
1
PHP
PHP
fix inconsistency between app and skel directory
3f778d8936dcca010d59f2d76dc25bd7abbcf152
<ide><path>lib/Cake/Console/Templates/skel/webroot/index.php <ide> * This should point at the directory containg `Cake`. <ide> * <ide> * For ease of development CakePHP uses PHP's include_path. If you <del> * need to squeeze a bit more performance you can set this path. <add> * cannot modify your include_path set this value. <ide> * <ide> * Leaving this constant undefined will result in it being defined in Cake/bootstrap.php <ide> */ <ide> } <ide> <ide> if (!defined('CAKE_CORE_INCLUDE_PATH')) { <add> if (function_exists('ini_set')) { <add> ini_set('include_path', ROOT . DS . 'lib' . PATH_SEPARATOR . ini_get('include_path')); <add> } <ide> if (!include('Cake' . DS . 'bootstrap.php')) { <ide> $failed = true; <ide> }
1
Ruby
Ruby
use response_body rather than performed?
e28e0611652e4d2c4fc2e8afdf866264c1583154
<ide><path>actionpack/lib/action_controller/base.rb <ide> class Base < Metal <ide> module ImplicitRender <ide> def send_action(*) <ide> ret = super <del> default_render unless performed? <add> default_render unless response_body <ide> ret <ide> end <ide> <ide><path>actionpack/test/template/body_parts_test.rb <ide> class BodyPartsTest < ActionController::TestCase <ide> RENDERINGS = [Object.new, Object.new, Object.new] <ide> <ide> class TestController < ActionController::Base <del> def performed?() true end <add> def response_body() "" end <ide> <ide> def index <ide> RENDERINGS.each do |rendering|
2
Java
Java
remove unused imports
b43bc8659aa9d0da6598b3e2385af1a2496cb55e
<ide><path>spring-aop/src/main/java/org/springframework/aop/support/AbstractRegexpMethodPointcut.java <ide> /* <del> * Copyright 2002-2009 the original author or authors. <add> * Copyright 2002-2012 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> <ide> package org.springframework.aop.support; <ide> <del>import java.io.IOException; <del>import java.io.ObjectInputStream; <ide> import java.io.Serializable; <ide> import java.lang.reflect.Method; <ide> import java.util.Arrays; <ide><path>spring-aop/src/main/java/org/springframework/aop/support/AopUtils.java <ide> /* <del> * Copyright 2002-2010 the original author or authors. <add> * Copyright 2002-2012 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> import java.util.LinkedList; <ide> import java.util.List; <ide> import java.util.Set; <del>import java.util.regex.Matcher; <del>import java.util.regex.Pattern; <ide> <ide> import org.springframework.aop.Advisor; <ide> import org.springframework.aop.AopInvocationException;
2
Javascript
Javascript
use faster variant for rss in test-crypto-dh-leak
f4ef517debd90a95916da7178df4dcda02c93a80
<ide><path>test/parallel/test-crypto-dh-leak.js <ide> if (process.config.variables.asan) <ide> const assert = require('assert'); <ide> const crypto = require('crypto'); <ide> <del>const before = process.memoryUsage().rss; <add>const before = process.memoryUsage.rss(); <ide> { <ide> const dh = crypto.createDiffieHellman(common.hasFipsCrypto ? 1024 : 256); <ide> const publicKey = dh.generateKeys(); <ide> const before = process.memoryUsage().rss; <ide> } <ide> } <ide> global.gc(); <del>const after = process.memoryUsage().rss; <add>const after = process.memoryUsage.rss(); <ide> <ide> // RSS should stay the same, ceteris paribus, but allow for <ide> // some slop because V8 mallocs memory during execution.
1
Ruby
Ruby
add sponsors graphql api
286488f753b547d06f7f10cbba305df603480551
<ide><path>Library/Homebrew/utils/github.rb <ide> def get_artifact_url(user, repo, pr, workflow_id: "tests.yml", artifact_name: "b <ide> artifact.first["archive_download_url"] <ide> end <ide> <add> def sponsors_by_tier(user) <add> url = "https://api.github.com/graphql" <add> data = { <add> query: <<~EOS, <add> { <add> organization(login: "#{user}") { <add> sponsorsListing { <add> tiers(first: 100) { <add> nodes { <add> monthlyPriceInDollars <add> adminInfo { <add> sponsorships(first: 100) { <add> totalCount <add> nodes { <add> sponsor { login } <add> } <add> } <add> } <add> } <add> } <add> } <add> } <add> } <add> EOS <add> } <add> open_api(url, scopes: ["admin:org", "user"], data: data, request_method: "POST") <add> end <add> <ide> def api_errors <ide> [GitHub::AuthenticationFailedError, GitHub::HTTPNotFoundError, <ide> GitHub::RateLimitExceededError, GitHub::Error, JSON::ParserError].freeze
1
Python
Python
remove `has_key` use that was missed
046d0575d0c052c9012221f36c3a2d0ccf34abb5
<ide><path>doc/sphinxext/docscrape.py <ide> def __getitem__(self,key): <ide> return self._parsed_data[key] <ide> <ide> def __setitem__(self,key,val): <del> if not self._parsed_data.has_key(key): <add> if not key in self._parsed_data: <ide> warn("Unknown section %s" % key) <ide> else: <ide> self._parsed_data[key] = val <ide> def __str__(self): <ide> 'meth': 'method'} <ide> <ide> if self._role: <del> if not roles.has_key(self._role): <add> if not self._role in roles: <ide> print "Warning: invalid role %s" % self._role <ide> out += '.. %s:: %s\n \n\n' % (roles.get(self._role,''), <ide> func_name) <ide><path>doc/sphinxext/plot_directive.py <ide> <ide> include-source : bool <ide> Whether to display the source code. Default can be changed in conf.py <del> <add> <ide> and the ``image`` directive options ``alt``, ``height``, ``width``, <ide> ``scale``, ``align``, ``class``. <ide> <ide> def run(arguments, content, options, state_machine, state, lineno): <ide> <ide> # is it in doctest format? <ide> is_doctest = contains_doctest(code) <del> if options.has_key('format'): <add> if 'format' in options: <ide> if options['format'] == 'python': <ide> is_doctest = False <ide> else:
2
Javascript
Javascript
add a cache for invokeforstate in ember.view
9050fabac7f7b3e302893ce3312d241805514ee0
<ide><path>packages/ember-views/lib/views/view.js <ide> var childViewsProperty = Ember.computed(function() { <ide> */ <ide> Ember.TEMPLATES = {}; <ide> <add>var invokeForState = { <add> preRender: {}, <add> inBuffer: {}, <add> hasElement: {}, <add> inDOM: {}, <add> destroyed: {} <add>}; <add> <ide> /** <ide> @class <ide> @since Ember 0.9 <ide> Ember.View = Ember.Object.extend(Ember.Evented, <ide> }, <ide> <ide> invokeForState: function(name) { <del> var parent = this, states = parent.states; <del> var stateName = get(this, 'state'), state; <add> var stateName = this.state, args; <add> <add> // try to find the function for the state in the cache <add> if (fn = invokeForState[stateName][name]) { <add> args = a_slice.call(arguments) <add> args[0] = this; <add> <add> return fn.apply(this, args); <add> } <add> <add> // otherwise, find and cache the function for this state <add> var parent = this, states = parent.states, state; <ide> <ide> while (states) { <ide> state = states[stateName]; <ide> Ember.View = Ember.Object.extend(Ember.Evented, <ide> var fn = state[name]; <ide> <ide> if (fn) { <del> var args = a_slice.call(arguments, 1); <add> invokeForState[stateName][name] = fn; <add> <add> args = a_slice.call(arguments, 1); <ide> args.unshift(this); <ide> <ide> return fn.apply(this, args); <ide> Ember.View = Ember.Object.extend(Ember.Evented, <ide> }, <ide> <ide> transitionTo: function(state, children) { <del> set(this, 'state', state); <add> this.state = state; <ide> <ide> if (children !== false) { <ide> this.forEachChildView(function(view) {
1
Javascript
Javascript
fix backtrace with no frames
c26cf84a088fae435d9a9a71cca40cfc7cc57b17
<ide><path>lib/_debugger.js <ide> Client.prototype.fullTrace = function(cb) { <ide> <ide> this.reqBacktrace(function(err, trace) { <ide> if (err) return cb(err); <add> if (trace.totalFrames <= 0) return cb(Error('No frames')); <ide> <ide> var refs = []; <ide> <ide> Client.prototype.fullTrace = function(cb) { <ide> } <ide> <ide> self.reqLookup(refs, function(res) { <add> if (!res.success) return cb(res.message || true); <add> <ide> for (var i = 0; i < trace.frames.length; i++) { <ide> var frame = trace.frames[i]; <ide> frame.script = res.body[frame.script.ref]; <ide> Interface.prototype.backtrace = function() { <ide> <ide> self.pause(); <ide> client.fullTrace(function(err, bt) { <del> if (err) return self.error(err); <add> if (err) return self.error('Can\'t request backtrace now'); <ide> if (bt.totalFrames == 0) { <ide> self.print('(empty stack)'); <ide> } else { <ide><path>test/fixtures/breakpoints.js <ide> a(); <ide> a(1); <ide> b(); <ide> b(); <add> <add> <add> <add>setInterval(function() { <add>}, 5000); <ide><path>test/simple/test-debugger-repl.js <ide> child.stderr.pipe(process.stdout); <ide> var expected = []; <ide> <ide> child.on('line', function(line) { <add> console.log(JSON.stringify(line)); <ide> assert.ok(expected.length > 0, 'Got unexpected line: ' + line); <ide> <ide> var expectedLine = expected[0].lines.shift(); <ide> addTest('o', [ <ide> "\b 16 b();" <ide> ]); <ide> <add>// Continue <add>addTest('c', [ <add> "debug> debug> debug> \bbreak in [unnamed]:7", <add> "\b 5 var i = 10;", <add> "\b 6 while (--i != 0);", <add> "\b 7 debugger;", <add> "\b 8 return i;", <add> "\b 9 };" <add>]); <add> <add>// Continue <add>addTest('c, bt', [ <add> "debug> \bCan't request backtrace now" <add>]); <add> <ide> <ide> function finish() { <ide> process.exit(0);
3
Ruby
Ruby
add skylake cpu
37e423ebb2885f9f5799b9914357124b98e79643
<ide><path>Library/Homebrew/os/mac/hardware.rb <ide> def family <ide> :haswell <ide> when 0x582ed09c # Broadwell <ide> :broadwell <add> when 0x37fc219f # Skylake <add> :skylake <ide> else <ide> :dunno <ide> end <ide><path>Library/Homebrew/test/test_hardware.rb <ide> def test_hardware_cpu_type <ide> end <ide> <ide> def test_hardware_intel_family <del> families = [:core, :core2, :penryn, :nehalem, :arrandale, :sandybridge, :ivybridge, :haswell, :broadwell] <add> families = [:core, :core2, :penryn, :nehalem, :arrandale, :sandybridge, :ivybridge, :haswell, :broadwell, :skylake] <ide> assert_includes families, Hardware::CPU.family <ide> end if Hardware::CPU.intel? <ide> end
2
Ruby
Ruby
fix pending migration checks for multi-db
6793482df90805247fc5b9fd3417bb5161077adc
<ide><path>activerecord/lib/active_record/migration.rb <ide> def call(env) <ide> @mutex.synchronize do <ide> @watcher ||= build_watcher do <ide> @needs_check = true <del> ActiveRecord::Migration.check_pending!(connection) <add> ActiveRecord::Migration.check_pending_migrations <ide> @needs_check = false <ide> end <ide> <ide> def call(env) <ide> <ide> private <ide> def build_watcher(&block) <del> paths = Array(connection.migration_context.migrations_paths) <add> current_environment = ActiveRecord::ConnectionHandling::DEFAULT_ENV.call <add> all_configs = ActiveRecord::Base.configurations.configs_for(env_name: current_environment) <add> paths = all_configs.flat_map { |config| config.migrations_paths || Migrator.migrations_paths }.uniq <ide> @file_watcher.new([], paths.index_with(["rb"]), &block) <ide> end <del> <del> def connection <del> ActiveRecord::Base.connection <del> end <ide> end <ide> <ide> class << self <ide> def check_pending!(connection = Base.connection) <ide> <ide> def load_schema_if_pending! <ide> current_db_config = Base.connection_db_config <del> all_configs = ActiveRecord::Base.configurations.configs_for(env_name: Rails.env) <add> all_configs = db_configs_in_current_env <ide> <ide> needs_update = !all_configs.all? do |db_config| <ide> Tasks::DatabaseTasks.schema_up_to_date?(db_config, ActiveRecord.schema_format) <ide> def load_schema_if_pending! <ide> # Establish a new connection, the old database may be gone (db:test:prepare uses purge) <ide> Base.establish_connection(current_db_config) <ide> <del> check_pending! <add> # Ensure all migrations have succeeded <add> check_pending_migrations(db_configs: all_configs) <ide> end <ide> <ide> def maintain_test_schema! # :nodoc: <ide> def migrate(direction) <ide> def disable_ddl_transaction! <ide> @disable_ddl_transaction = true <ide> end <add> <add> def check_pending_migrations(db_configs: db_configs_in_current_env) # :nodoc: <add> prev_db_config = Base.connection_db_config <add> db_configs.each do |db_config| <add> Base.establish_connection(db_config) <add> check_pending! <add> end <add> ensure <add> Base.establish_connection(prev_db_config) <add> end <add> <add> private <add> def db_configs_in_current_env <add> current_environment = ActiveRecord::ConnectionHandling::DEFAULT_ENV.call <add> ActiveRecord::Base.configurations.configs_for(env_name: current_environment) <add> end <ide> end <ide> <ide> def disable_ddl_transaction # :nodoc: <ide><path>activerecord/test/cases/migration/pending_migrations_test.rb <ide> module ActiveRecord <ide> class Migration <ide> if current_adapter?(:SQLite3Adapter) && !in_memory_db? <ide> class PendingMigrationsTest < ActiveRecord::TestCase <add> self.use_transactional_tests = false <add> <ide> setup do <ide> @migration_dir = Dir.mktmpdir("activerecord-migrations-") <add> @secondary_migration_dir = Dir.mktmpdir("activerecord-migrations-secondary-") <add> @original_configurations = ActiveRecord::Base.configurations <add> ActiveRecord::Base.configurations = base_config <add> ActiveRecord::Base.establish_connection(:primary) <ide> <ide> file = ActiveRecord::Base.connection.raw_connection.filename <del> @conn = ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:", migrations_paths: @migration_dir <ide> source_db = SQLite3::Database.new file <ide> dest_db = ActiveRecord::Base.connection.raw_connection <ide> backup = SQLite3::Backup.new(dest_db, "main", source_db, "main") <ide> class PendingMigrationsTest < ActiveRecord::TestCase <ide> end <ide> <ide> teardown do <del> @conn.release_connection if @conn <del> ActiveRecord::Base.establish_connection :arunit <add> ActiveRecord::Base.configurations = @original_configurations <add> ActiveRecord::Base.establish_connection(:arunit) <ide> FileUtils.rm_rf(@migration_dir) <add> FileUtils.rm_rf(@secondary_migration_dir) <ide> end <ide> <ide> def run_migrations <ide> migrator = Base.connection.migration_context <ide> capture(:stdout) { migrator.migrate } <ide> end <ide> <del> def create_migration(number, name) <add> def create_migration(number, name, migration_dir: nil) <ide> filename = "#{number}_#{name.underscore}.rb" <del> File.write(File.join(@migration_dir, filename), <<~RUBY) <add> File.write(File.join(migration_dir || @migration_dir, filename), <<~RUBY) <ide> class #{name.classify} < ActiveRecord::Migration::Current <ide> end <ide> RUBY <ide> def test_okay_with_no_migrations <ide> def test_understands_migrations_created_out_of_order <ide> # With a prior file before even initialization <ide> create_migration "05", "create_bar" <del> run_migrations <add> quietly { run_migrations } <ide> <ide> check_pending = CheckPending.new(@app) <ide> <ide> def test_understands_migrations_created_out_of_order <ide> check_pending.call({}) <ide> end <ide> end <add> <add> def test_with_multiple_database <add> create_migration "01", "create_bar", migration_dir: @secondary_migration_dir <add> <add> assert_raises ActiveRecord::PendingMigrationError do <add> CheckPending.new(@app).call({}) <add> end <add> <add> begin <add> ActiveRecord::Base.establish_connection(:secondary) <add> quietly { run_migrations } <add> end <add> ActiveRecord::Base.establish_connection(:primary) <add> <add> @app.expect :call, nil, [{}] <add> CheckPending.new(@app).call({}) <add> @app.verify <add> <add> # Now check exclusion if database_tasks is set to false for the db_config <add> create_migration "02", "create_foo", migration_dir: @secondary_migration_dir <add> assert_raises ActiveRecord::PendingMigrationError do <add> CheckPending.new(@app).call({}) <add> end <add> <add> new_config = base_config <add> new_config[ActiveRecord::ConnectionHandling::DEFAULT_ENV.call][:secondary][:database_tasks] = false <add> ActiveRecord::Base.configurations = new_config <add> <add> @app.expect :call, nil, [{}] <add> CheckPending.new(@app).call({}) <add> @app.verify <add> end <add> <add> def test_with_stdlib_logger <add> old, ActiveRecord::Base.logger = ActiveRecord::Base.logger, ::Logger.new($stdout) <add> quietly do <add> assert_nothing_raised { ActiveRecord::Migration::CheckPending.new(Proc.new { }).call({}) } <add> end <add> ensure <add> ActiveRecord::Base.logger = old <add> end <add> <add> private <add> def base_config <add> { <add> ActiveRecord::ConnectionHandling::DEFAULT_ENV.call => { <add> primary: { <add> adapter: "sqlite3", <add> database: "test/fixtures/fixture_database.sqlite3", <add> migrations_paths: @migration_dir <add> }, <add> secondary: { <add> adapter: "sqlite3", <add> database: "test/fixtures/fixture_database.sqlite3", <add> migrations_paths: @secondary_migration_dir <add> } <add> } <add> } <add> end <ide> end <ide> end <ide> end
2
Javascript
Javascript
fix lint rules
7e078d6a923783bc4914c16ad90cc6fb1c93274d
<ide><path>.eslintrc.js <ide> module.exports = { <ide> 'dot-notation': ERROR, <ide> 'eol-last': ERROR, <ide> 'eqeqeq': [ERROR, 'allow-null'], <del> 'indent': [ERROR, 2, {SwitchCase: 1}], <add> 'indent': OFF, <ide> 'jsx-quotes': [ERROR, 'prefer-double'], <ide> 'keyword-spacing': [ERROR, {after: true, before: true}], <ide> 'no-bitwise': OFF, <ide> module.exports = { <ide> 'no-shadow': ERROR, <ide> 'no-unused-expressions': ERROR, <ide> 'no-unused-vars': [ERROR, {args: 'none'}], <add> 'no-useless-concat': OFF, <ide> 'quotes': [ERROR, 'single', {avoidEscape: true, allowTemplateLiterals: true }], <ide> 'space-before-blocks': ERROR, <del> 'space-before-function-paren': [ERROR, {anonymous: 'never', named: 'never'}], <add> 'space-before-function-paren': OFF, <ide> <ide> // React & JSX <ide> // Our transforms set this automatically <ide><path>src/renderers/shared/shared/event/SyntheticEvent.js <ide> * @providesModule SyntheticEvent <ide> */ <ide> <add>/* eslint valid-typeof: 0 */ <add> <ide> 'use strict'; <ide> <ide> var PooledClass = require('PooledClass'); <ide> Object.assign(SyntheticEvent.prototype, { <ide> if (event.preventDefault) { <ide> event.preventDefault(); <ide> } else if (typeof event.returnValue !== 'unknown') { <del> // eslint-disable-line valid-typeof <ide> event.returnValue = false; <ide> } <ide> this.isDefaultPrevented = emptyFunction.thatReturnsTrue; <ide> Object.assign(SyntheticEvent.prototype, { <ide> if (event.stopPropagation) { <ide> event.stopPropagation(); <ide> } else if (typeof event.cancelBubble !== 'unknown') { <del> // eslint-disable-line valid-typeof <ide> // The ChangeEventPlugin registers a "propertychange" event for <ide> // IE. This event does not support bubbling or cancelling, and <ide> // any references to cancelBubble throw "Member not found". A <ide><path>src/renderers/shared/stack/reconciler/Transaction.js <ide> var TransactionImpl = { <ide> e: E, <ide> f: F, <ide> ) => G>(method: T, scope: any, a: A, b: B, c: C, d: D, e: E, f: F): G { <del> // eslint-disable-line space-before-function-paren <ide> invariant( <ide> !this.isInTransaction(), <ide> 'Transaction.perform(...): Cannot initialize a transaction when there ' +
3
Ruby
Ruby
build an ast rather than slapping strings together
6518f12b73546ee566ecef76f8d13da6f16272a0
<ide><path>activerecord/lib/active_record/relation/calculations.rb <ide> def calculate(operation, column_name, options = {}) <ide> # <ide> def pluck(*column_names) <ide> column_names.map! do |column_name| <del> if column_name.is_a?(Symbol) <del> if attribute_alias?(column_name) <del> column_name = attribute_alias(column_name).to_sym <del> end <del> <del> if self.columns_hash.key?(column_name.to_s) <del> column_name = "#{connection.quote_table_name(table_name)}.#{connection.quote_column_name(column_name)}" <del> end <add> if column_name.is_a?(Symbol) && attribute_alias?(column_name) <add> attribute_alias(column_name).to_sym <add> else <add> column_name <ide> end <del> <del> column_name <ide> end <ide> <ide> if has_include?(column_names.first) <ide> construct_relation_for_association_calculations.pluck(*column_names) <ide> else <ide> relation = spawn <del> relation.select_values = column_names <add> relation.select_values = column_names.map { |cn| <add> columns_hash.key?(cn.to_s) ? arel_table[cn] : cn <add> } <ide> result = klass.connection.select_all(relation.arel, nil, bind_values) <ide> columns = result.columns.map do |key| <ide> klass.column_types.fetch(key) {
1
PHP
PHP
use an associative array to improve readability
98aafb428ae4eeb56ad2e8368bc6fe5e2315a62a
<ide><path>src/Cache/Engine/ArrayEngine.php <ide> class ArrayEngine extends CacheEngine <ide> /** <ide> * Cached data. <ide> * <del> * Structured as [key => [expiration, value]] <add> * Structured as [key => [exp => expiration, val => value]] <ide> * <ide> * @var array <ide> */ <ide> public function write($key, $value) <ide> { <ide> $key = $this->_key($key); <ide> $expires = time() + $this->_config['duration']; <del> $this->data[$key] = [$expires, $value]; <add> $this->data[$key] = ['exp' => $expires, 'val' => $value]; <ide> <ide> return true; <ide> } <ide> public function read($key) <ide> <ide> // Check expiration <ide> $now = time(); <del> if ($data[0] <= $now) { <add> if ($data['exp'] <= $now) { <ide> unset($this->data[$key]); <ide> <ide> return false; <ide> } <ide> <del> return $data[1]; <add> return $data['val']; <ide> } <ide> <ide> /** <ide> public function increment($key, $offset = 1) <ide> $this->write($key, 0); <ide> } <ide> $key = $this->_key($key); <del> $this->data[$key][1] += $offset; <add> $this->data[$key]['val'] += $offset; <ide> <del> return $this->data[$key][1]; <add> return $this->data[$key]['val']; <ide> } <ide> <ide> /** <ide> public function decrement($key, $offset = 1) <ide> $this->write($key, 0); <ide> } <ide> $key = $this->_key($key); <del> $this->data[$key][1] -= $offset; <add> $this->data[$key]['val'] -= $offset; <ide> <del> return $this->data[$key][1]; <add> return $this->data[$key]['val']; <ide> } <ide> <ide> /** <ide> public function groups() <ide> foreach ($this->_config['groups'] as $group) { <ide> $key = $this->_config['prefix'] . $group; <ide> if (!isset($this->data[$key])) { <del> $this->data[$key] = [PHP_INT_MAX, 1]; <add> $this->data[$key] = ['exp' => PHP_INT_MAX, 'val' => 1]; <ide> } <del> $value = $this->data[$key][1]; <add> $value = $this->data[$key]['val']; <ide> $result[] = $group . $value; <ide> } <ide> <ide> public function clearGroup($group) <ide> { <ide> $key = $this->_config['prefix'] . $group; <ide> if (isset($this->data[$key])) { <del> $this->data[$key][1] += 1; <add> $this->data[$key]['val'] += 1; <ide> } <ide> <ide> return true;
1
Mixed
Text
use assert_nil instead of testing for equality
0f8fe64c4e70698b75b0fb7e0566ded41a0573ec
<ide><path>activerecord/CHANGELOG.md <ide> * Removed redundant override of `xml` column definition for PG, <del> in order to use `xml` column type instead of `text` <add> in order to use `xml` column type instead of `text`. <ide> <ide> *Paul Nikitochkin*, *Michael Nikitochkin* <ide> <ide><path>activerecord/test/cases/adapters/postgresql/xml_test.rb <ide> def test_column <ide> <ide> def test_null_xml <ide> @connection.execute %q|insert into xml_data_type (payload) VALUES(null)| <del> x = XmlDataType.first <del> assert_equal(nil, x.payload) <add> assert_nil XmlDataType.first.payload <ide> end <ide> end
2
Python
Python
remove the log group associated to the test
7d760f39d542c302a85967708d5ec8c88335aa55
<ide><path>tests/system/providers/amazon/aws/example_sagemaker_endpoint.py <ide> def delete_endpoint(endpoint_name): <ide> <ide> @task(trigger_rule=TriggerRule.ALL_DONE) <ide> def delete_logs(env_id, endpoint_name): <del> generated_logs = [ <del> # Format: ('log group name', 'log stream prefix') <del> ("/aws/sagemaker/TrainingJobs", env_id), <del> (f"/aws/sagemaker/Endpoints/{endpoint_name}", env_id), <del> ] <add> purge_logs( <add> [ <add> # Format: ('log group name', 'log stream prefix') <add> ("/aws/sagemaker/TrainingJobs", env_id), <add> ] <add> ) <ide> <del> purge_logs(generated_logs) <add> purge_logs(test_logs=[(f"/aws/sagemaker/Endpoints/{endpoint_name}", None)], force_delete=True) <ide> <ide> <ide> @task
1
PHP
PHP
fix mistake in path
7c4b7a2cbe758b4e237387f9a390a4fc67bbd0a7
<ide><path>lib/Cake/Test/Case/Configure/PhpReaderTest.php <ide> public function testDump() { <ide> PHP; <ide> $file = $this->path . 'test.php'; <ide> $contents = file_get_contents($file); <del> @unlink($contents); <add> <add> unlink($file); <ide> $this->assertEquals($expected, $contents); <ide> } <ide> <ide><path>lib/Cake/Test/test_app/Config/test.php <del><?php <del>$config = array ( <del> 'One' => <del> array ( <del> 'two' => 'value', <del> 'three' => <del> array ( <del> 'four' => 'value four', <del> ), <del> 'null' => NULL, <del> ), <del> 'Asset' => <del> array ( <del> 'timestamp' => 'force', <del> ), <del>); <ide>\ No newline at end of file
2
Javascript
Javascript
use bodystyle var instead of document.body.style
66ceecc2956ae4550cb3c2493be760184bc18777
<ide><path>src/ng/sniffer.js <ide> function $SnifferProvider() { <ide> animations = !!(('animation' in bodyStyle) || (vendorPrefix + 'Animation' in bodyStyle)); <ide> <ide> if (android && (!transitions || !animations)) { <del> transitions = isString(document.body.style.webkitTransition); <del> animations = isString(document.body.style.webkitAnimation); <add> transitions = isString(bodyStyle.webkitTransition); <add> animations = isString(bodyStyle.webkitAnimation); <ide> } <ide> } <ide>
1
Text
Text
remove unnecessary comments
a9a68fa4984eb9929f4eba5f4f10da92ac239c41
<ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md <ide> if(typeof myArray !== "undefined" && typeof myData !== "undefined"){(function(y, <ide> ## --seed-contents-- <ide> <ide> ```js <del>// Setup <ide> var myArray = [50,60,70]; <ide> <del>// Only change code below this line <add> <ide> ``` <ide> <ide> # --solutions--
1
Javascript
Javascript
pick the right attribute name for ngform
0fcd1e3b1fa6244d02f08631d9ef81bf79996fab
<ide><path>src/ng/directive/form.js <ide> var nullFormCtrl = { <ide> * <ide> * - keys are validation tokens (error names) — such as `required`, `url` or `email`), <ide> * - values are arrays of controls or forms that are invalid with given error. <del> * <add> * <ide> * @description <ide> * `FormController` keeps track of all its controls and nested forms as well as state of them, <ide> * such as being valid/invalid or dirty/pristine. <ide> function FormController(element, attrs) { <ide> controls = []; <ide> <ide> // init state <del> form.$name = attrs.name; <add> form.$name = attrs.name || attrs.ngForm; <ide> form.$dirty = false; <ide> form.$pristine = true; <ide> form.$valid = true; <ide> function FormController(element, attrs) { <ide> * <ide> * @description <ide> * Sets the validity of a form control. <del> * <add> * <ide> * This method will also propagate to parent forms. <ide> */ <ide> form.$setValidity = function(validationToken, isValid, control) { <ide><path>test/ng/directive/formSpec.js <ide> describe('form', function() { <ide> expect(scope.myForm.alias).toBeDefined(); <ide> }); <ide> <add> it('should use ngForm value as form name when nested inside form', function () { <add> doc = $compile( <add> '<form name="myForm">' + <add> '<div ng-form="nestedForm"><input type="text" name="alias" ng-model="value"/></div>' + <add> '</form>')(scope); <add> <add> expect(scope.myForm).toBeDefined(); <add> expect(scope.myForm.nestedForm).toBeDefined(); <add> expect(scope.myForm.nestedForm.alias).toBeDefined(); <add> }); <add> <ide> <ide> it('should publish form to scope when name attr is defined', function() { <ide> doc = $compile('<form name="myForm"></form>')(scope);
2
Ruby
Ruby
try #2 at handling backed up casks
9227c8fe3c09cecf551cca060ee45c37cfc30be6
<ide><path>Library/Homebrew/cask/lib/hbc/installer.rb <ide> def initialize(cask, command: SystemCommand, force: false, skip_cask_deps: false <ide> @require_sha = require_sha <ide> @reinstall = false <ide> @upgrade = upgrade <del> @backed_up = false <ide> end <ide> <ide> attr_predicate :binaries?, :force?, :skip_cask_deps?, :require_sha?, :upgrade?, :verbose?, :backed_up? <ide> def start_upgrade <ide> end <ide> <ide> def backup <del> @backed_up = true <ide> @cask.staged_path.rename backup_path <ide> end <ide> <ide> def restore_backup <ide> Pathname.new(@cask.staged_path).rmtree if @cask.staged_path.exist? <ide> <ide> backup_path.rename @cask.staged_path <del> @backed_up = false <ide> end <ide> <ide> def revert_upgrade <ide> def revert_upgrade <ide> end <ide> <ide> def finalize_upgrade <del> purge_versioned_files <add> purge_backed_versioned_files <ide> <ide> puts summary <ide> end <ide> def zap <ide> <ide> def backup_path <ide> return nil if @cask.staged_path.nil? <del> if backed_up? <del> Pathname.new "#{@cask.staged_path}.upgrading" <del> else <del> @cask.staged_path <del> end <add> Pathname.new "#{@cask.staged_path}.upgrading" <ide> end <ide> <ide> def version_is_latest? <ide> def gain_permissions_remove(path) <ide> Utils.gain_permissions_remove(path, command: @command) <ide> end <ide> <del> def purge_versioned_files <add> def purge_backed_versioned_files <ide> ohai "Purging files for version #{@cask.version} of Cask #{@cask}" <ide> <ide> # versioned staged distribution <del> if upgrade? <del> staged_path = backup_path <del> else <del> staged_path = @cask.staged_path <del> end <add> gain_permissions_remove(backup_path) if !backup_path.nil? && backup_path.exist? <ide> <del> gain_permissions_remove(staged_path) if !staged_path.nil? && staged_path.exist? <add> # Homebrew-Cask metadata <add> purge_metadata <add> end <add> <add> def purge_versioned_files <add> ohai "Purging files for version #{@cask.version} of Cask #{@cask}" <add> <add> # versioned staged distribution <add> gain_permissions_remove(@cask.staged_path) if !@cask.staged_path.nil? && @cask.staged_path.exist? <ide> <ide> # Homebrew-Cask metadata <add> purge_metadata <add> end <add> <add> def purge_metadata <ide> if @cask.metadata_versioned_path.respond_to?(:children) && <ide> @cask.metadata_versioned_path.exist? && <ide> !(upgrade? && version_is_latest?)
1
Python
Python
add some docstrings
a19b3b585034d0dc33e6361b75c5c3e9901a3eca
<ide><path>libcloud/compute/drivers/rackspace.py <ide> def create_node(self, **kwargs): <ide> return self._to_node(resp.object) <ide> <ide> def ex_resize(self, node, image): <add> """ <add> Change an existing server flavor / scale the server up or down. <add> <add> @keyword node: node to resize. <add> @param node: C{Node} <add> <add> @keyword name: new image. <add> @param name: C{NodeImage} <add> """ <ide> elm = ET.Element( <ide> 'resize', <ide> {'xmlns': NAMESPACE, <ide> def ex_resize(self, node, image): <ide> return resp.status == 202 <ide> <ide> def ex_confirm_resize(self, node): <add> """ <add> Confirm a resize request which is currently in progress. If a resize <add> request is not explicitly confirmed or reverted it's automatically <add> confirmed after 24 hours. <add> <add> For more info refer to the API documentation: http://goo.gl/zjFI1 <add> <add> @keyword node: node for which the resize request will be confirmed. <add> @param node: C{Node} <add> """ <ide> elm = ET.Element( <ide> 'confirmResize', <ide> {'xmlns': NAMESPACE} <ide> def ex_confirm_resize(self, node): <ide> return resp.status == 204 <ide> <ide> def ex_revert_resize(self, node): <add> """ <add> Revert a resize request which is currently in progress. <add> All resizes are automatically confirmed after 24 hours if they have <add> not already been confirmed explicitly or reverted. <add> <add> For more info refer to the API documentation: http://goo.gl/AizBu <add> <add> @keyword node: node for which the resize request will be reverted. <add> @param node: C{Node} <add> """ <ide> elm = ET.Element( <ide> 'revertResize', <ide> {'xmlns': NAMESPACE}
1
Text
Text
improve text for breakonsigint
6bf213936596250b7531e01c564a15d290eb38eb
<ide><path>doc/api/vm.md <ide> changes: <ide> * `timeout` {integer} Specifies the number of milliseconds to execute `code` <ide> before terminating execution. If execution is terminated, an [`Error`][] <ide> will be thrown. This value must be a strictly positive integer. <del> * `breakOnSigint` {boolean} If `true`, the execution will be terminated when <del> `SIGINT` (Ctrl+C) is received. Existing handlers for the <del> event that have been attached via `process.on('SIGINT')` will be disabled <del> during script execution, but will continue to work after that. If execution <del> is terminated, an [`Error`][] will be thrown. **Default:** `false`. <add> * `breakOnSigint` {boolean} If `true`, execution is terminated when `SIGINT` <add> (<kbd>Ctrl</kbd>+<kbd>C</kbd>) is received. Existing handlers for the <add> event that have been attached via `process.on('SIGINT')` are disabled <add> during script execution, but continue to work after that. If execution <add> is terminated, an [`Error`][] is thrown. **Default:** `false`. <ide> * Returns: {any} the result of the very last statement executed in the script. <ide> <ide> Runs the compiled code contained by the `vm.Script` object within the given <ide> changes: <ide> * `timeout` {integer} Specifies the number of milliseconds to execute `code` <ide> before terminating execution. If execution is terminated, an [`Error`][] <ide> will be thrown. This value must be a strictly positive integer. <del> * `breakOnSigint` {boolean} If `true`, the execution will be terminated when <del> `SIGINT` (Ctrl+C) is received. Existing handlers for the <del> event that have been attached via `process.on('SIGINT')` will be disabled <del> during script execution, but will continue to work after that. If execution <del> is terminated, an [`Error`][] will be thrown. **Default:** `false`. <add> * `breakOnSigint` {boolean} If `true`, execution is terminated when `SIGINT` <add> (<kbd>Ctrl</kbd>+<kbd>C</kbd>) is received. Existing handlers for the <add> event that have been attached via `process.on('SIGINT')` are disabled <add> during script execution, but continue to work after that. If execution <add> is terminated, an [`Error`][] is thrown. **Default:** `false`. <ide> * `contextName` {string} Human-readable name of the newly created context. <ide> **Default:** `'VM Context i'`, where `i` is an ascending numerical index of <ide> the created context. <ide> changes: <ide> * `timeout` {integer} Specifies the number of milliseconds to execute `code` <ide> before terminating execution. If execution is terminated, an [`Error`][] <ide> will be thrown. This value must be a strictly positive integer. <del> * `breakOnSigint` {boolean} If `true`, the execution will be terminated when <del> `SIGINT` (Ctrl+C) is received. Existing handlers for the <del> event that have been attached via `process.on('SIGINT')` will be disabled <del> during script execution, but will continue to work after that. If execution <del> is terminated, an [`Error`][] will be thrown. **Default:** `false`. <add> * `breakOnSigint` {boolean} If `true`, execution is terminated when `SIGINT` <add> (<kbd>Ctrl</kbd>+<kbd>C</kbd>) is received. Existing handlers for the <add> event that have been attached via `process.on('SIGINT')` are disabled <add> during script execution, but continue to work after that. If execution <add> is terminated, an [`Error`][] is thrown. **Default:** `false`. <ide> * Returns: {any} the result of the very last statement executed in the script. <ide> <ide> Runs the compiled code contained by the `vm.Script` within the context of the <ide> in the ECMAScript specification. <ide> * `timeout` {integer} Specifies the number of milliseconds to evaluate <ide> before terminating execution. If execution is interrupted, an [`Error`][] <ide> will be thrown. This value must be a strictly positive integer. <del> * `breakOnSigint` {boolean} If `true`, the execution will be terminated when <del> `SIGINT` (Ctrl+C) is received. Existing handlers for the event that have <del> been attached via `process.on('SIGINT')` will be disabled during script <del> execution, but will continue to work after that. If execution is <del> interrupted, an [`Error`][] will be thrown. **Default:** `false`. <add> * `breakOnSigint` {boolean} If `true`, execution is terminated when `SIGINT` <add> (<kbd>Ctrl</kbd>+<kbd>C</kbd>) is received. Existing handlers for the <add> event that have been attached via `process.on('SIGINT')` are disabled <add> during script execution, but continue to work after that. If execution <add> is interrupted, an [`Error`][] is thrown. **Default:** `false`. <ide> * Returns: {Promise} <ide> <ide> Evaluate the module. <ide> changes: <ide> * `timeout` {integer} Specifies the number of milliseconds to execute `code` <ide> before terminating execution. If execution is terminated, an [`Error`][] <ide> will be thrown. This value must be a strictly positive integer. <del> * `breakOnSigint` {boolean} If `true`, the execution will be terminated when <del> `SIGINT` (Ctrl+C) is received. Existing handlers for the <del> event that have been attached via `process.on('SIGINT')` will be disabled <del> during script execution, but will continue to work after that. If execution <del> is terminated, an [`Error`][] will be thrown. **Default:** `false`. <add> * `breakOnSigint` {boolean} If `true`, execution is terminated when `SIGINT` <add> (<kbd>Ctrl</kbd>+<kbd>C</kbd>) is received. Existing handlers for the <add> event that have been attached via `process.on('SIGINT')` are disabled <add> during script execution, but continue to work after that. If execution <add> is terminated, an [`Error`][] is thrown. **Default:** `false`. <ide> * `cachedData` {Buffer|TypedArray|DataView} Provides an optional `Buffer` or <ide> `TypedArray`, or `DataView` with V8's code cache data for the supplied <ide> source. When supplied, the `cachedDataRejected` value will be set to <ide> changes: <ide> * `timeout` {integer} Specifies the number of milliseconds to execute `code` <ide> before terminating execution. If execution is terminated, an [`Error`][] <ide> will be thrown. This value must be a strictly positive integer. <del> * `breakOnSigint` {boolean} If `true`, the execution will be terminated when <del> `SIGINT` (Ctrl+C) is received. Existing handlers for the <del> event that have been attached via `process.on('SIGINT')` will be disabled <del> during script execution, but will continue to work after that. If execution <del> is terminated, an [`Error`][] will be thrown. **Default:** `false`. <add> * `breakOnSigint` {boolean} If `true`, execution is terminated when `SIGINT` <add> (<kbd>Ctrl</kbd>+<kbd>C</kbd>) is received. Existing handlers for the <add> event that have been attached via `process.on('SIGINT')` are disabled <add> during script execution, but continue to work after that. If execution <add> is terminated, an [`Error`][] is thrown. **Default:** `false`. <ide> * `contextName` {string} Human-readable name of the newly created context. <ide> **Default:** `'VM Context i'`, where `i` is an ascending numerical index of <ide> the created context. <ide> changes: <ide> * `timeout` {integer} Specifies the number of milliseconds to execute `code` <ide> before terminating execution. If execution is terminated, an [`Error`][] <ide> will be thrown. This value must be a strictly positive integer. <del> * `breakOnSigint` {boolean} If `true`, the execution will be terminated when <del> `SIGINT` (Ctrl+C) is received. Existing handlers for the <del> event that have been attached via `process.on('SIGINT')` will be disabled <del> during script execution, but will continue to work after that. If execution <del> is terminated, an [`Error`][] will be thrown. **Default:** `false`. <add> * `breakOnSigint` {boolean} If `true`, execution is terminated when `SIGINT` <add> (<kbd>Ctrl</kbd>+<kbd>C</kbd>) is received. Existing handlers for the <add> event that have been attached via `process.on('SIGINT')` are disabled <add> during script execution, but continue to work after that. If execution <add> is terminated, an [`Error`][] is thrown. **Default:** `false`. <ide> * `cachedData` {Buffer|TypedArray|DataView} Provides an optional `Buffer` or <ide> `TypedArray`, or `DataView` with V8's code cache data for the supplied <ide> source. When supplied, the `cachedDataRejected` value will be set to
1
Python
Python
add converter for jsonl ner data
6ea981c83904bd082d4a37d75dd02fe86b615b12
<ide><path>spacy/cli/_messages.py <ide> class Messages(object): <ide> M051 = ("Development data not found") <ide> M052 = ("Not a valid meta.json format") <ide> M053 = ("Expected dict but got: {meta_type}") <add> M054 = ("No --lang specified, but tokenization required.") <ide><path>spacy/cli/convert.py <ide> from pathlib import Path <ide> <ide> from .converters import conllu2json, conllubio2json, iob2json, conll_ner2json <add>from .converters import ner_jsonl2json <ide> from ._messages import Messages <ide> from ..util import prints <ide> <ide> 'conll': conllu2json, <ide> 'ner': conll_ner2json, <ide> 'iob': iob2json, <add> 'jsonl': ner_jsonl2json <ide> } <ide> <ide> <ide> output_dir=("output directory for converted file", "positional", None, str), <ide> n_sents=("Number of sentences per doc", "option", "n", int), <ide> converter=("Name of converter (auto, iob, conllu or ner)", "option", "c", str), <add> lang=("Language (if tokenizer required)", "option", "l", str), <ide> morphology=("Enable appending morphology to tags", "flag", "m", bool)) <del>def convert(input_file, output_dir, n_sents=1, morphology=False, converter='auto'): <add>def convert(input_file, output_dir, n_sents=1, morphology=False, converter='auto', <add> lang=None): <ide> """ <ide> Convert files into JSON format for use with train command and other <ide> experiment management functions. <ide> def convert(input_file, output_dir, n_sents=1, morphology=False, converter='auto <ide> title=Messages.M030, exits=1) <ide> func = CONVERTERS[converter] <ide> func(input_path, output_path, <del> n_sents=n_sents, use_morphology=morphology) <add> n_sents=n_sents, use_morphology=morphology, lang=lang) <ide><path>spacy/cli/converters/__init__.py <ide> from .conllubio2json import conllubio2json <ide> from .iob2json import iob2json <ide> from .conll_ner2json import conll_ner2json <add>from .jsonl2json import ner_jsonl2json <ide><path>spacy/cli/converters/conll_ner2json.py <ide> from ...gold import iob_to_biluo <ide> <ide> <del>def conll_ner2json(input_path, output_path, n_sents=10, use_morphology=False): <add>def conll_ner2json(input_path, output_path, n_sents=10, use_morphology=False, lang=None): <ide> """ <ide> Convert files in the CoNLL-2003 NER format into JSON format for use with <ide> train cli. <ide><path>spacy/cli/converters/conllu2json.py <ide> import re <ide> <ide> <del>def conllu2json(input_path, output_path, n_sents=10, use_morphology=False): <add>def conllu2json(input_path, output_path, n_sents=10, use_morphology=False, lang=None): <ide> <ide> """ <ide> Convert conllu files into JSON format for use with train cli. <ide><path>spacy/cli/converters/conllubio2json.py <ide> from ...util import prints <ide> from ...gold import iob_to_biluo <ide> <del>def conllubio2json(input_path, output_path, n_sents=10, use_morphology=False): <add>def conllubio2json(input_path, output_path, n_sents=10, use_morphology=False, lang=None): <ide> """ <ide> Convert conllu files into JSON format for use with train cli. <ide> use_morphology parameter enables appending morphology to tags, which is <ide><path>spacy/cli/converters/jsonl2json.py <add># coding: utf8 <add>from __future__ import unicode_literals <add>import ujson as json <add> <add>from .._messages import Messages <add>from ...compat import json_dumps, path2str <add>from ...util import prints, get_lang_class <add>from ...gold import docs_to_json <add> <add> <add>def ner_jsonl2json(input_path, output_path, lang=None, n_sents=10, use_morphology=False): <add> if lang is None: <add> prints(Messages.M054, exits=True) <add> json_docs = [] <add> input_tuples = list(read_jsonl(input_path)) <add> nlp = get_lang_class(lang)() <add> for i, (raw_text, ents) in enumerate(input_tuples): <add> doc = nlp.make_doc(raw_text) <add> doc[0].is_sent_start = True <add> doc.ents = [doc.char_span(s, e, label=L) for s, e, L in ents['entities']] <add> json_docs.append(docs_to_json(i, [doc])) <add> <add> output_filename = input_path.parts[-1].replace(".jsonl", ".json") <add> output_loc = output_path / output_filename <add> with (output_loc).open('w', encoding='utf8') as file_: <add> file_.write(json_dumps(json_docs)) <add> prints(Messages.M033.format(n_docs=len(json_docs)), <add> title=Messages.M032.format(name=path2str(output_loc))) <add> <add>def read_jsonl(input_path): <add> with input_path.open('r', encoding='utf8') as file_: <add> for line in file_: <add> yield json.loads(line)
7
Javascript
Javascript
remove hydrate option from createroot
5041c37d27ee8f80bf152951d20bf861f817c7c6
<ide><path>fixtures/ssr/src/index.js <ide> import React from 'react'; <del>import {createRoot} from 'react-dom'; <add>import {hydrateRoot} from 'react-dom'; <ide> <ide> import App from './components/App'; <ide> <del>let root = createRoot(document, {hydrate: true}); <del>root.render(<App assets={window.assetManifest} />); <add>let root = hydrateRoot(document, <App assets={window.assetManifest} />); <ide><path>packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js <ide> describe('ReactDOMFizzServer', () => { <ide> expect(loggedErrors).toEqual([]); <ide> <ide> // Attempt to hydrate the content. <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render(<App isClient={true} />); <add> ReactDOM.hydrateRoot(container, <App isClient={true} />); <ide> Scheduler.unstable_flushAll(); <ide> <ide> // We're still loading because we're waiting for the server to stream more content. <ide> describe('ReactDOMFizzServer', () => { <ide> expect(loggedErrors).toEqual([]); <ide> <ide> // Attempt to hydrate the content. <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render(<App />); <add> ReactDOM.hydrateRoot(container, <App />); <ide> Scheduler.unstable_flushAll(); <ide> <ide> // We're still loading because we're waiting for the server to stream more content. <ide> describe('ReactDOMFizzServer', () => { <ide> pipe(writable); <ide> }); <ide> <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render(<App showMore={false} />); <add> const root = ReactDOM.hydrateRoot(container, <App showMore={false} />); <ide> Scheduler.unstable_flushAll(); <ide> <ide> // We're not hydrated yet. <ide> describe('ReactDOMFizzServer', () => { <ide> // We're still showing a fallback. <ide> <ide> // Attempt to hydrate the content. <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render(<App />); <add> ReactDOM.hydrateRoot(container, <App />); <ide> Scheduler.unstable_flushAll(); <ide> <ide> // We're still loading because we're waiting for the server to stream more content. <ide> describe('ReactDOMFizzServer', () => { <ide> // We're still showing a fallback. <ide> <ide> // Attempt to hydrate the content. <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render(<App isClient={true} />); <add> ReactDOM.hydrateRoot(container, <App isClient={true} />); <ide> Scheduler.unstable_flushAll(); <ide> <ide> // We're still loading because we're waiting for the server to stream more content. <ide><path>packages/react-dom/src/__tests__/ReactDOMServerPartialHydration-test.internal.js <ide> describe('ReactDOMServerPartialHydration', () => { <ide> // On the client we don't have all data yet but we want to start <ide> // hydrating anyway. <ide> suspend = true; <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render(<App />); <add> ReactDOM.hydrateRoot(container, <App />); <ide> Scheduler.unstable_flushAll(); <ide> jest.runAllTimers(); <ide> <ide> describe('ReactDOMServerPartialHydration', () => { <ide> // hydrating anyway. <ide> suspend = true; <ide> suspend2 = true; <del> const root = ReactDOM.createRoot(container, { <del> hydrate: true, <del> hydrationOptions: { <del> onHydrated(node) { <del> hydrated.push(node); <del> }, <del> onDeleted(node) { <del> deleted.push(node); <del> }, <add> const root = ReactDOM.hydrateRoot(container, <App />, { <add> onHydrated(node) { <add> hydrated.push(node); <add> }, <add> onDeleted(node) { <add> deleted.push(node); <ide> }, <ide> }); <del> act(() => { <del> root.render(<App />); <del> }); <add> Scheduler.unstable_flushAll(); <ide> <ide> expect(hydrated.length).toBe(0); <ide> expect(deleted.length).toBe(0); <ide> describe('ReactDOMServerPartialHydration', () => { <ide> // On the client we don't have all data yet but we want to start <ide> // hydrating anyway. <ide> suspend = true; <del> const root = ReactDOM.createRoot(container, { <del> hydrate: true, <del> hydrationOptions: { <del> onDeleted(node) { <del> deleted.push(node); <del> }, <add> const root = ReactDOM.hydrateRoot(container, <App />, { <add> onDeleted(node) { <add> deleted.push(node); <ide> }, <ide> }); <del> act(() => { <del> root.render(<App />); <del> }); <add> Scheduler.unstable_flushAll(); <ide> <ide> expect(deleted.length).toBe(0); <ide> <ide> describe('ReactDOMServerPartialHydration', () => { <ide> }).toErrorDev( <ide> 'Warning: Cannot hydrate Suspense in legacy mode. Switch from ' + <ide> 'ReactDOM.hydrate(element, container) to ' + <del> 'ReactDOM.createRoot(container, { hydrate: true })' + <add> 'ReactDOM.hydrateRoot(container, <App />)' + <ide> '.render(element) or remove the Suspense components from the server ' + <ide> 'rendered components.' + <ide> '\n in Suspense (at **)' + <ide> describe('ReactDOMServerPartialHydration', () => { <ide> suspend = true; <ide> <ide> act(() => { <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render(<App />); <add> ReactDOM.hydrateRoot(container, <App />); <ide> }); <ide> <ide> expect(container.firstChild.firstChild.tagName).not.toBe('DIV'); <ide> describe('ReactDOMServerPartialHydration', () => { <ide> // hydrating anyway. <ide> suspend = true; <ide> act(() => { <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render(<App />); <add> ReactDOM.hydrateRoot(container, <App />); <ide> }); <ide> <ide> expect(container.firstChild.children[1].textContent).toBe('Middle'); <ide> describe('ReactDOMServerPartialHydration', () => { <ide> // On the client we don't have all data yet but we want to start <ide> // hydrating anyway. <ide> suspend = true; <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render(<App text="Hello" className="hello" />); <add> const root = ReactDOM.hydrateRoot( <add> container, <add> <App text="Hello" className="hello" />, <add> ); <ide> Scheduler.unstable_flushAll(); <ide> jest.runAllTimers(); <ide> <ide> describe('ReactDOMServerPartialHydration', () => { <ide> // On the client we don't have all data yet but we want to start <ide> // hydrating anyway. <ide> suspend = true; <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render(<App text="Hello" className="hello" />); <add> const root = ReactDOM.hydrateRoot( <add> container, <add> <App text="Hello" className="hello" />, <add> ); <ide> Scheduler.unstable_flushAll(); <ide> jest.runAllTimers(); <ide> <ide> describe('ReactDOMServerPartialHydration', () => { <ide> // On the client we don't have all data yet but we want to start <ide> // hydrating anyway. <ide> suspend = true; <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render(<App text="Hello" className="hello" />); <add> const root = ReactDOM.hydrateRoot( <add> container, <add> <App text="Hello" className="hello" />, <add> ); <ide> Scheduler.unstable_flushAll(); <ide> jest.runAllTimers(); <ide> <ide> describe('ReactDOMServerPartialHydration', () => { <ide> // On the client we don't have all data yet but we want to start <ide> // hydrating anyway. <ide> suspend = true; <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render(<App text="Hello" className="hello" />); <add> const root = ReactDOM.hydrateRoot( <add> container, <add> <App text="Hello" className="hello" />, <add> ); <ide> Scheduler.unstable_flushAll(); <ide> jest.runAllTimers(); <ide> <ide> describe('ReactDOMServerPartialHydration', () => { <ide> // On the client we don't have all data yet but we want to start <ide> // hydrating anyway. <ide> suspend = true; <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render(<App text="Hello" className="hello" />); <add> const root = ReactDOM.hydrateRoot( <add> container, <add> <App text="Hello" className="hello" />, <add> ); <ide> Scheduler.unstable_flushAll(); <ide> jest.runAllTimers(); <ide> <ide> describe('ReactDOMServerPartialHydration', () => { <ide> // On the client we don't have all data yet but we want to start <ide> // hydrating anyway. <ide> suspend = true; <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render(<App text="Hello" className="hello" />); <add> const root = ReactDOM.hydrateRoot( <add> container, <add> <App text="Hello" className="hello" />, <add> ); <ide> Scheduler.unstable_flushAll(); <ide> jest.runAllTimers(); <ide> <ide> describe('ReactDOMServerPartialHydration', () => { <ide> const container = document.createElement('div'); <ide> container.innerHTML = finalHTML; <ide> <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <add> ReactDOM.hydrateRoot(container, <App text="Hello" className="hello" />); <ide> <ide> await act(async () => { <ide> suspend = true; <del> root.render(<App />); <ide> expect(Scheduler).toFlushAndYieldThrough(['Child']); <ide> <ide> // While we're part way through the hydration, we update the state. <ide> describe('ReactDOMServerPartialHydration', () => { <ide> // On the client we don't have all data yet but we want to start <ide> // hydrating anyway. <ide> suspend = true; <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render( <add> const root = ReactDOM.hydrateRoot( <add> container, <ide> <Context.Provider value={{text: 'Hello', className: 'hello'}}> <ide> <App /> <ide> </Context.Provider>, <ide> describe('ReactDOMServerPartialHydration', () => { <ide> // On the client we don't have all data yet but we want to start <ide> // hydrating anyway. <ide> suspend = true; <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render( <add> const root = ReactDOM.hydrateRoot( <add> container, <ide> <Context.Provider value={{text: 'Hello', className: 'hello'}}> <ide> <App /> <ide> </Context.Provider>, <ide> describe('ReactDOMServerPartialHydration', () => { <ide> <ide> // On the client we have the data available quickly for some reason. <ide> suspend = false; <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render(<App />); <add> ReactDOM.hydrateRoot(container, <App />); <ide> Scheduler.unstable_flushAll(); <ide> jest.runAllTimers(); <ide> <ide> describe('ReactDOMServerPartialHydration', () => { <ide> <ide> // On the client we have the data available quickly for some reason. <ide> suspend = false; <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render(<App />); <add> ReactDOM.hydrateRoot(container, <App />); <ide> Scheduler.unstable_flushAll(); <ide> // This will have exceeded the suspended time so we should timeout. <ide> jest.advanceTimersByTime(500); <ide> describe('ReactDOMServerPartialHydration', () => { <ide> <ide> // On the client we have the data available quickly for some reason. <ide> suspend = false; <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render(<App />); <add> ReactDOM.hydrateRoot(container, <App />); <ide> Scheduler.unstable_flushAll(); <ide> // This will have exceeded the suspended time so we should timeout. <ide> jest.advanceTimersByTime(500); <ide> describe('ReactDOMServerPartialHydration', () => { <ide> <ide> const spanB = container.getElementsByTagName('span')[1]; <ide> <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> <add> const root = ReactDOM.hydrateRoot(container, <App showMore={false} />); <ide> suspend = true; <del> act(() => { <del> root.render(<App showMore={false} />); <del> }); <add> Scheduler.unstable_flushAll(); <ide> <ide> // We're not hydrated yet. <ide> expect(ref.current).toBe(null); <ide> describe('ReactDOMServerPartialHydration', () => { <ide> <ide> const spanA = container.getElementsByTagName('span')[0]; <ide> <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <add> const root = ReactDOM.hydrateRoot(container, <App showMore={false} />); <ide> <ide> suspend = true; <del> act(() => { <del> root.render(<App showMore={false} />); <del> }); <add> Scheduler.unstable_flushAll(); <ide> <ide> // We're not hydrated yet. <ide> expect(ref.current).toBe(null); <ide> describe('ReactDOMServerPartialHydration', () => { <ide> const container = document.createElement('div'); <ide> container.innerHTML = html; <ide> <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <add> ReactDOM.hydrateRoot(container, <App />); <ide> <ide> suspend = true; <del> <del> await act(async () => { <del> root.render(<App />); <del> }); <add> Scheduler.unstable_flushAll(); <ide> <ide> // We haven't hydrated the second child but the placeholder is still in the list. <ide> expect(container.textContent).toBe('ALoading B'); <ide> describe('ReactDOMServerPartialHydration', () => { <ide> const span = container.getElementsByTagName('span')[1]; <ide> <ide> suspend = false; <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render(<App />); <add> ReactDOM.hydrateRoot(container, <App />); <ide> Scheduler.unstable_flushAll(); <ide> jest.runAllTimers(); <ide> <ide> describe('ReactDOMServerPartialHydration', () => { <ide> <ide> // On the client we don't have all data yet but we want to start <ide> // hydrating anyway. <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render(<App />); <add> ReactDOM.hydrateRoot(container, <App />); <ide> Scheduler.unstable_flushAll(); <ide> jest.runAllTimers(); <ide> <ide> describe('ReactDOMServerPartialHydration', () => { <ide> // On the client we don't have all data yet but we want to start <ide> // hydrating anyway. <ide> suspend = true; <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render( <add> const root = ReactDOM.hydrateRoot( <add> container, <ide> <ClassName.Provider value={'hello'}> <ide> <App text="Hello" /> <ide> </ClassName.Provider>, <ide> describe('ReactDOMServerPartialHydration', () => { <ide> // On the client we don't have all data yet but we want to start <ide> // hydrating anyway. <ide> suspend = true; <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render(<App />); <add> ReactDOM.hydrateRoot(container, <App />); <ide> Scheduler.unstable_flushAll(); <ide> jest.runAllTimers(); <ide> <ide> describe('ReactDOMServerPartialHydration', () => { <ide> // hydrating anyway. <ide> suspend = true; <ide> isServerRendering = false; <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render(<App />); <add> ReactDOM.hydrateRoot(container, <App />); <ide> <ide> // We'll do one click before hydrating. <ide> a.click(); <ide> describe('ReactDOMServerPartialHydration', () => { <ide> // On the client we don't have all data yet but we want to start <ide> // hydrating anyway. <ide> suspend = true; <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render(<App />); <add> ReactDOM.hydrateRoot(container, <App />); <ide> <ide> // We'll do one click before hydrating. <ide> await act(async () => { <ide> describe('ReactDOMServerPartialHydration', () => { <ide> // hydrating anyway. <ide> suspend = true; <ide> isServerRendering = false; <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render(<App />); <add> ReactDOM.hydrateRoot(container, <App />); <ide> <ide> // We'll do one click before hydrating. <ide> a.click(); <ide> describe('ReactDOMServerPartialHydration', () => { <ide> // On the client we don't have all data yet but we want to start <ide> // hydrating anyway. <ide> suspend = true; <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render(<App />); <add> ReactDOM.hydrateRoot(container, <App />); <ide> Scheduler.unstable_flushAll(); <ide> jest.runAllTimers(); <ide> <ide> describe('ReactDOMServerPartialHydration', () => { <ide> suspend = true; <ide> <ide> // Hydrate asynchronously. <del> const root = ReactDOM.createRoot(childContainer, {hydrate: true}); <del> root.render(<App />); <add> ReactDOM.hydrateRoot(childContainer, <App />); <ide> jest.runAllTimers(); <ide> Scheduler.unstable_flushAll(); <ide> <ide> describe('ReactDOMServerPartialHydration', () => { <ide> // hydrating anyway. <ide> suspend1 = true; <ide> suspend2 = true; <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render(<App />); <add> ReactDOM.hydrateRoot(container, <App />); <ide> <ide> Scheduler.unstable_flushAll(); <ide> jest.runAllTimers(); <ide> describe('ReactDOMServerPartialHydration', () => { <ide> container.innerHTML = finalHTML; <ide> <ide> suspend = true; <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render(<App showSibling={false} />); <add> const root = ReactDOM.hydrateRoot(container, <App showSibling={false} />); <ide> expect(Scheduler).toFlushAndYield([]); <ide> <ide> expect(ref.current).toBe(null); <ide> describe('ReactDOMServerPartialHydration', () => { <ide> // On the client we don't have all data yet but we want to start <ide> // hydrating anyway. <ide> suspend = true; <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render(<App />); <add> ReactDOM.hydrateRoot(container, <App />); <ide> Scheduler.unstable_flushAll(); <ide> jest.runAllTimers(); <ide> <ide> describe('ReactDOMServerPartialHydration', () => { <ide> const span = container.getElementsByTagName('span')[0]; <ide> expect(span.innerHTML).toBe('Hidden child'); <ide> <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render(<App />); <add> ReactDOM.hydrateRoot(container, <App />); <add> <ide> Scheduler.unstable_flushAll(); <ide> expect(ref.current).toBe(span); <ide> expect(span.innerHTML).toBe('Hidden child'); <ide> describe('ReactDOMServerPartialHydration', () => { <ide> const span = container.getElementsByTagName('span')[0]; <ide> expect(span.innerHTML).toBe('Hidden child'); <ide> <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render(<App />); <add> ReactDOM.hydrateRoot(container, <App />); <ide> Scheduler.unstable_flushAll(); <ide> expect(ref.current).toBe(span); <ide> expect(span.innerHTML).toBe('Hidden child'); <ide> describe('ReactDOMServerPartialHydration', () => { <ide> <ide> const span = container.getElementsByTagName('span')[0]; <ide> <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render(<App />); <add> ReactDOM.hydrateRoot(container, <App />); <ide> Scheduler.unstable_flushAll(); <ide> expect(ref.current).toBe(span); <ide> expect(ref.current.innerHTML).toBe('Hidden child'); <ide><path>packages/react-dom/src/__tests__/ReactDOMServerSelectiveHydration-test.internal.js <ide> describe('ReactDOMServerSelectiveHydration', () => { <ide> <ide> const span = container.getElementsByTagName('span')[1]; <ide> <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render(<App />); <add> ReactDOM.hydrateRoot(container, <App />); <ide> <ide> // Nothing has been hydrated so far. <ide> expect(Scheduler).toHaveYielded([]); <ide> describe('ReactDOMServerSelectiveHydration', () => { <ide> <ide> // A and D will be suspended. We'll click on D which should take <ide> // priority, after we unsuspend. <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render(<App />); <add> ReactDOM.hydrateRoot(container, <App />); <ide> <ide> // Nothing has been hydrated so far. <ide> expect(Scheduler).toHaveYielded([]); <ide> describe('ReactDOMServerSelectiveHydration', () => { <ide> <ide> // A and D will be suspended. We'll click on D which should take <ide> // priority, after we unsuspend. <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render(<App />); <add> ReactDOM.hydrateRoot(container, <App />); <ide> <ide> // Nothing has been hydrated so far. <ide> expect(Scheduler).toHaveYielded([]); <ide> describe('ReactDOMServerSelectiveHydration', () => { <ide> <ide> isServerRendering = false; <ide> <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> <del> root.render(<App />); <add> ReactDOM.hydrateRoot(container, <App />); <ide> <ide> // Nothing has been hydrated so far. <ide> expect(Scheduler).toHaveYielded([]); <ide> describe('ReactDOMServerSelectiveHydration', () => { <ide> <ide> // A and D will be suspended. We'll click on D which should take <ide> // priority, after we unsuspend. <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render(<App />); <add> ReactDOM.hydrateRoot(container, <App />); <ide> <ide> // Nothing has been hydrated so far. <ide> expect(Scheduler).toHaveYielded([]); <ide> describe('ReactDOMServerSelectiveHydration', () => { <ide> <ide> // A and D will be suspended. We'll click on D which should take <ide> // priority, after we unsuspend. <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render(<App />); <add> ReactDOM.hydrateRoot(container, <App />); <ide> <ide> // Nothing has been hydrated so far. <ide> expect(Scheduler).toHaveYielded([]); <ide> describe('ReactDOMServerSelectiveHydration', () => { <ide> <ide> // A and D will be suspended. We'll click on D which should take <ide> // priority, after we unsuspend. <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render(<App />); <add> ReactDOM.hydrateRoot(container, <App />); <ide> <ide> // Nothing has been hydrated so far. <ide> expect(Scheduler).toHaveYielded([]); <ide> describe('ReactDOMServerSelectiveHydration', () => { <ide> <ide> // A and D will be suspended. We'll click on D which should take <ide> // priority, after we unsuspend. <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render(<App />); <add> ReactDOM.hydrateRoot(container, <App />); <ide> <ide> // Nothing has been hydrated so far. <ide> expect(Scheduler).toHaveYielded([]); <ide> describe('ReactDOMServerSelectiveHydration', () => { <ide> const spanB = container.getElementsByTagName('span')[2]; <ide> const spanC = container.getElementsByTagName('span')[4]; <ide> <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <ide> act(() => { <del> root.render(<App a="A" />); <del> <add> const root = ReactDOM.hydrateRoot(container, <App a="A" />); <ide> // Hydrate the shell. <ide> expect(Scheduler).toFlushAndYieldThrough(['App', 'Commit']); <ide> <ide><path>packages/react-dom/src/__tests__/ReactDOMServerSuspense-test.internal.js <ide> describe('ReactDOMServerSuspense', () => { <ide> expect(divB.textContent).toBe('B'); <ide> <ide> act(() => { <del> const root = ReactDOM.createRoot(parent, {hydrate: true}); <del> root.render(example); <add> ReactDOM.hydrateRoot(parent, example); <ide> }); <ide> <ide> const parent2 = element.parentNode; <ide><path>packages/react-dom/src/__tests__/ReactServerRenderingHydration-test.js <ide> describe('ReactDOMServerHydration', () => { <ide> const finalHTML = ReactDOMServer.renderToString(<div />); <ide> const container = document.createElement('div'); <ide> container.innerHTML = finalHTML; <del> const root = ReactDOM.createRoot(container, {hydrate: true}); <del> root.render(<div />); <add> const root = ReactDOM.hydrateRoot(container, <div />); <ide> Scheduler.unstable_flushAll(); <ide> root.render(null); <ide> Scheduler.unstable_flushAll(); <ide><path>packages/react-dom/src/client/ReactDOMRoot.js <ide> export type RootType = { <ide> }; <ide> <ide> export type CreateRootOptions = { <del> // TODO: Remove these options. <del> hydrate?: boolean, <del> hydrationOptions?: { <del> onHydrated?: (suspenseNode: Comment) => void, <del> onDeleted?: (suspenseNode: Comment) => void, <del> mutableSources?: Array<MutableSource<any>>, <del> ... <del> }, <del> // END OF TODO <ide> unstable_strictMode?: boolean, <ide> unstable_concurrentUpdatesByDefault?: boolean, <ide> identifierPrefix?: string, <ide> export function createRoot( <ide> <ide> warnIfReactDOMContainerInDEV(container); <ide> <del> // TODO: Delete these options <del> const hydrate = options != null && options.hydrate === true; <del> const hydrationCallbacks = <del> (options != null && options.hydrationOptions) || null; <del> const mutableSources = <del> (options != null && <del> options.hydrationOptions != null && <del> options.hydrationOptions.mutableSources) || <del> null; <del> // END TODO <del> <ide> let isStrictMode = false; <ide> let concurrentUpdatesByDefaultOverride = false; <ide> let identifierPrefix = ''; <ide> if (options !== null && options !== undefined) { <add> if (__DEV__) { <add> if ((options: any).hydrate) { <add> console.warn( <add> 'hydrate through createRoot is deprecated. Use ReactDOM.hydrateRoot(container, <App />) instead.', <add> ); <add> } <add> } <ide> if (options.unstable_strictMode === true) { <ide> isStrictMode = true; <ide> } <ide> export function createRoot( <ide> const root = createContainer( <ide> container, <ide> ConcurrentRoot, <del> hydrate, <del> hydrationCallbacks, <add> false, <add> null, <ide> isStrictMode, <ide> concurrentUpdatesByDefaultOverride, <ide> identifierPrefix, <ide> export function createRoot( <ide> container.nodeType === COMMENT_NODE ? container.parentNode : container; <ide> listenToAllSupportedEvents(rootContainerElement); <ide> <del> // TODO: Delete this path <del> if (mutableSources) { <del> for (let i = 0; i < mutableSources.length; i++) { <del> const mutableSource = mutableSources[i]; <del> registerMutableSourceForHydration(root, mutableSource); <del> } <del> } <del> // END TODO <del> <ide> return new ReactDOMRoot(root); <ide> } <ide> <ide><path>packages/react-dom/src/events/__tests__/DOMPluginEventSystem-test.internal.js <ide> describe('DOMPluginEventSystem', () => { <ide> suspend = true; <ide> <ide> // Hydrate asynchronously. <del> const root = ReactDOM.createRoot(childContainer, {hydrate: true}); <del> root.render(<App />); <add> ReactDOM.hydrateRoot(childContainer, <App />); <ide> jest.runAllTimers(); <ide> Scheduler.unstable_flushAll(); <ide> <ide><path>packages/react-reconciler/src/ReactFiberBeginWork.new.js <ide> function mountDehydratedSuspenseComponent( <ide> console.error( <ide> 'Cannot hydrate Suspense in legacy mode. Switch from ' + <ide> 'ReactDOM.hydrate(element, container) to ' + <del> 'ReactDOM.createRoot(container, { hydrate: true })' + <add> 'ReactDOM.hydrateRoot(container, <App />)' + <ide> '.render(element) or remove the Suspense components from ' + <ide> 'the server rendered components.', <ide> ); <ide><path>packages/react-reconciler/src/ReactFiberBeginWork.old.js <ide> function mountDehydratedSuspenseComponent( <ide> console.error( <ide> 'Cannot hydrate Suspense in legacy mode. Switch from ' + <ide> 'ReactDOM.hydrate(element, container) to ' + <del> 'ReactDOM.createRoot(container, { hydrate: true })' + <add> 'ReactDOM.hydrateRoot(container, <App />)' + <ide> '.render(element) or remove the Suspense components from ' + <ide> 'the server rendered components.', <ide> ); <ide><path>packages/react-reconciler/src/__tests__/ReactScope-test.internal.js <ide> describe('ReactScope', () => { <ide> // On the client we don't have all data yet but we want to start <ide> // hydrating anyway. <ide> suspend = true; <del> const root = ReactDOM.createRoot(container2, {hydrate: true}); <del> root.render(<App />); <add> ReactDOM.hydrateRoot(container2, <App />); <ide> Scheduler.unstable_flushAll(); <ide> jest.runAllTimers(); <ide> <ide><path>packages/react-reconciler/src/__tests__/useMutableSourceHydration-test.js <ide> describe('useMutableSourceHydration', () => { <ide> expect(Scheduler).toHaveYielded(['only:one']); <ide> expect(source.listenerCount).toBe(0); <ide> <del> const root = ReactDOM.createRoot(container, { <del> hydrate: true, <del> hydrationOptions: { <del> mutableSources: [mutableSource], <del> }, <del> }); <ide> act(() => { <del> root.render(<TestComponent />); <add> ReactDOM.hydrateRoot(container, <TestComponent />, { <add> mutableSources: [mutableSource], <add> }); <ide> }); <ide> expect(Scheduler).toHaveYielded(['only:one']); <ide> expect(source.listenerCount).toBe(1); <ide> describe('useMutableSourceHydration', () => { <ide> expect(Scheduler).toHaveYielded(['only:one']); <ide> expect(source.listenerCount).toBe(0); <ide> <del> const root = ReactDOM.createRoot(container, { <del> hydrate: true, <del> hydrationOptions: { <del> mutableSources: [mutableSource], <del> }, <del> }); <ide> expect(() => { <ide> act(() => { <del> root.render(<TestComponent />); <add> ReactDOM.hydrateRoot(container, <TestComponent />, { <add> mutableSources: [mutableSource], <add> }); <ide> <ide> source.value = 'two'; <ide> }); <ide> }).toErrorDev( <del> 'Warning: An error occurred during hydration. ' + <del> 'The server HTML was replaced with client content in <div>.', <del> {withoutStack: true}, <add> 'Warning: Text content did not match. Server: "only:one" Client: "only:two"', <ide> ); <ide> expect(Scheduler).toHaveYielded(['only:two']); <ide> expect(source.listenerCount).toBe(1); <ide> describe('useMutableSourceHydration', () => { <ide> expect(Scheduler).toHaveYielded(['a:one', 'b:one']); <ide> expect(source.listenerCount).toBe(0); <ide> <del> const root = ReactDOM.createRoot(container, { <del> hydrate: true, <del> hydrationOptions: { <del> mutableSources: [mutableSource], <del> }, <del> }); <ide> expect(() => { <ide> act(() => { <ide> if (gate(flags => flags.enableSyncDefaultUpdates)) { <ide> React.startTransition(() => { <del> root.render(<TestComponent />); <add> ReactDOM.hydrateRoot(container, <TestComponent />, { <add> mutableSources: [mutableSource], <add> }); <ide> }); <ide> } else { <del> root.render(<TestComponent />); <add> ReactDOM.hydrateRoot(container, <TestComponent />, { <add> mutableSources: [mutableSource], <add> }); <ide> } <ide> expect(Scheduler).toFlushAndYieldThrough(['a:one']); <ide> source.value = 'two'; <ide> describe('useMutableSourceHydration', () => { <ide> container.innerHTML = htmlString; <ide> expect(Scheduler).toHaveYielded(['0:a:one', '1:b:one']); <ide> <del> const root = ReactDOM.createRoot(container, { <del> hydrate: true, <del> hydrationOptions: { <del> mutableSources: [mutableSource], <del> }, <del> }); <ide> expect(() => { <ide> act(() => { <add> const fragment = ( <add> <> <add> <Component <add> label="0" <add> getSnapshot={getSnapshotA} <add> mutableSource={mutableSource} <add> subscribe={subscribeA} <add> /> <add> <Component <add> label="1" <add> getSnapshot={getSnapshotB} <add> mutableSource={mutableSource} <add> subscribe={subscribeB} <add> /> <add> </> <add> ); <ide> if (gate(flags => flags.enableSyncDefaultUpdates)) { <ide> React.startTransition(() => { <del> root.render( <del> <> <del> <Component <del> label="0" <del> getSnapshot={getSnapshotA} <del> mutableSource={mutableSource} <del> subscribe={subscribeA} <del> /> <del> <Component <del> label="1" <del> getSnapshot={getSnapshotB} <del> mutableSource={mutableSource} <del> subscribe={subscribeB} <del> /> <del> </>, <del> ); <add> ReactDOM.hydrateRoot(container, fragment, { <add> mutableSources: [mutableSource], <add> }); <ide> }); <ide> } else { <del> root.render( <del> <> <del> <Component <del> label="0" <del> getSnapshot={getSnapshotA} <del> mutableSource={mutableSource} <del> subscribe={subscribeA} <del> /> <del> <Component <del> label="1" <del> getSnapshot={getSnapshotB} <del> mutableSource={mutableSource} <del> subscribe={subscribeB} <del> /> <del> </>, <del> ); <add> ReactDOM.hydrateRoot(container, fragment, { <add> mutableSources: [mutableSource], <add> }); <ide> } <ide> expect(Scheduler).toFlushAndYieldThrough(['0:a:one']); <ide> source.valueB = 'b:two'; <ide> describe('useMutableSourceHydration', () => { <ide> expect(Scheduler).toHaveYielded([1, 'a:one']); <ide> expect(source.listenerCount).toBe(0); <ide> <del> const root = ReactDOM.createRoot(container, { <del> hydrate: true, <del> hydrationOptions: { <del> mutableSources: [mutableSource], <del> }, <del> }); <del> <ide> expect(() => { <ide> act(() => { <add> let root; <ide> if (gate(flags => flags.enableSyncDefaultUpdates)) { <ide> React.startTransition(() => { <del> root.render(<TestComponent flag={1} />); <add> root = ReactDOM.hydrateRoot(container, <TestComponent flag={1} />, { <add> mutableSources: [mutableSource], <add> }); <ide> }); <ide> } else { <del> root.render(<TestComponent flag={1} />); <add> root = ReactDOM.hydrateRoot(container, <TestComponent flag={1} />, { <add> mutableSources: [mutableSource], <add> }); <ide> } <ide> expect(Scheduler).toFlushAndYieldThrough([1]); <ide> <ide> describe('useMutableSourceHydration', () => { <ide> dispatchAndSetCurrentEvent(arbitraryElement, mouseOverEvent); <ide> <ide> expect(Scheduler).toFlushAndYieldThrough([2]); <del> <ide> source.value = 'two'; <ide> }); <ide> }).toErrorDev( <del> [ <del> 'Warning: An error occurred during hydration. ' + <del> 'The server HTML was replaced with client content in <div>.', <del> <del> 'Warning: Text content did not match. Server: "1" Client: "2"', <del> ], <del> {withoutStack: 1}, <add> 'Warning: Text content did not match. Server: "1" Client: "2"', <ide> ); <del> expect(Scheduler).toHaveYielded([2, 'a:two']); <ide> expect(source.listenerCount).toBe(1); <add> if (gate(flags => flags.enableSyncDefaultUpdates)) { <add> expect(Scheduler).toHaveYielded([2, 'a:two']); <add> } else { <add> expect(Scheduler).toHaveYielded(['a:two']); <add> } <ide> }); <ide> });
12
PHP
PHP
fix signatures of test classes
3423f9b664d54aca65118730eef0040ab70fc56e
<ide><path>tests/test_app/Plugin/TestPlugin/src/Http/Session/TestPluginSession.php <ide> <ide> namespace TestPlugin\Http\Session; <ide> <add>use ReturnTypeWillChange; <ide> use SessionHandlerInterface; <ide> <ide> /** <ide> * Test suite plugin session handler <ide> */ <ide> class TestPluginSession implements SessionHandlerInterface <ide> { <del> public function open($savePath, $name) <add> public function open($path, $name): bool <ide> { <ide> return true; <ide> } <ide> <del> public function close() <add> public function close(): bool <ide> { <add> return true; <ide> } <ide> <add> #[ReturnTypeWillChange] <ide> public function read($id) <ide> { <ide> } <ide> <del> public function write($id, $data) <add> public function write($id, $data): bool <ide> { <add> return true; <ide> } <ide> <del> public function destroy($id) <add> public function destroy($id): bool <ide> { <add> return true; <ide> } <ide> <add> #[ReturnTypeWillChange] <ide> public function gc($maxlifetime) <ide> { <add> return 0; <ide> } <ide> } <ide><path>tests/test_app/TestApp/Http/Session/TestAppLibSession.php <ide> <ide> namespace TestApp\Http\Session; <ide> <add>use ReturnTypeWillChange; <ide> use SessionHandlerInterface; <ide> <ide> /** <ide> public function __construct($options = []) <ide> $this->options = $options; <ide> } <ide> <del> public function open($savePath, $name) <add> public function open($path, $name): bool <ide> { <ide> return true; <ide> } <ide> <del> public function close() <add> public function close(): bool <ide> { <add> return true; <ide> } <ide> <add> #[ReturnTypeWillChange] <ide> public function read($id) <ide> { <ide> } <ide> <del> public function write($id, $data) <add> public function write($id, $data): bool <ide> { <add> return true; <ide> } <ide> <del> public function destroy($id) <add> public function destroy($id): bool <ide> { <add> return true; <ide> } <ide> <add> #[ReturnTypeWillChange] <ide> public function gc($maxlifetime) <ide> { <add> return 0; <ide> } <ide> }
2
Ruby
Ruby
move bottle stdlib tracking post-pour
2775a4b12cce406c85b97b70ed424852bf3bc783
<ide><path>Library/Homebrew/formula_installer.rb <ide> def install <ide> raise "Unrecognized architecture for --bottle-arch: #{arch}" <ide> end <ide> <del> if pour_bottle? <del> # This assumes that bottles are built with <del> # a) the OS's default compiler, and <del> # b) the OS's default C++ stdlib <del> # This is probably accurate, but could possibly stand to be <del> # more robust. <del> stdlib_in_use = CxxStdlib.new(MacOS.default_cxx_stdlib, MacOS.default_compiler) <del> stdlib_in_use.check_dependencies(f, f.recursive_dependencies) <del> end <del> <ide> oh1 "Installing #{Tty.green}#{f}#{Tty.reset}" if show_header <ide> <ide> @@attempted << f <ide> def install <ide> if pour_bottle? :warn => true <ide> pour <ide> @poured_bottle = true <add> <add> stdlibs = Keg.new(f.prefix).detect_cxx_stdlibs <add> stdlib_in_use = CxxStdlib.new(stdlibs.first, MacOS.default_compiler) <add> stdlib_in_use.check_dependencies(f, f.recursive_dependencies) <add> <ide> tab = Tab.for_keg f.prefix <ide> tab.poured_from_bottle = true <ide> tab.tabfile.delete if tab.tabfile
1
Text
Text
move the changelog entry to the proper place
e24e086ef1de73beffc0870cb37d6ae42cbbd2c8
<ide><path>actionpack/CHANGELOG.md <ide> ## Rails 4.0.0 (unreleased) ## <ide> <add>* Make `ActionDispatch::Journey::Path::Pattern#new` raise more meaningful exception message. <add> <add> *Thierry Zires* <ide> <del>## Rails 4.0.0.beta1 (February 25, 2013) ## <ide> <del>* Make ActionDispatch::Journey::Path::Pattern#new raise more meaningful exception message. *Thierry Zires* <add>## Rails 4.0.0.beta1 (February 25, 2013) ## <ide> <ide> * Fix `respond_to` not using formats that have no block if all is present. *Michael Grosser* <ide>
1
Text
Text
add missed quote
e14baf9a24e7045a32ac9dc7b7eb01752d91cf7f
<ide><path>docs/tutorials/essentials/part-5-async-logic.md <ide> If we try calling `dispatch(fetchPosts())`, the `fetchPosts` thunk will first di <ide> <ide> We can listen for this action in our reducer and mark the request status as `'loading'`. <ide> <del>Once the `Promise` resolves, the `fetchPosts` thunk takes the `response.posts` array we returned from the callback, and dispatches a `posts/fetchPosts/fulfilled'` action containing the posts array as `action.payload`: <add>Once the `Promise` resolves, the `fetchPosts` thunk takes the `response.posts` array we returned from the callback, and dispatches a `'posts/fetchPosts/fulfilled'` action containing the posts array as `action.payload`: <ide> <ide> ![`createAsyncThunk`: posts pending action](/img/tutorials/essentials/devtools-posts-fulfilled.png) <ide>
1
PHP
PHP
unskip tests for minute()
abecb49321c0b8fe332fecaf3553e9f67e1df886
<ide><path>tests/TestCase/View/Helper/FormHelperTest.php <ide> public function testDay() { <ide> * @return void <ide> */ <ide> public function testMinute() { <del> $this->markTestIncomplete('Need to revisit once models work again.'); <ide> extract($this->dateRegex); <ide> <ide> $result = $this->Form->minute('Model.field'); <ide> $expected = array( <del> array('select' => array('name' => 'Model[field][min]', 'id' => 'ModelFieldMin')), <add> array('select' => array('name' => 'Model[field][min]')), <ide> array('option' => array('value' => '')), <ide> '/option', <ide> array('option' => array('value' => '00')), <ide> public function testMinute() { <ide> $this->Form->request->data['Model']['field'] = '2006-10-10 00:12:32'; <ide> $result = $this->Form->minute('Model.field'); <ide> $expected = array( <del> array('select' => array('name' => 'Model[field][min]', 'id' => 'ModelFieldMin')), <add> array('select' => array('name' => 'Model[field][min]')), <ide> array('option' => array('value' => '')), <ide> '/option', <ide> array('option' => array('value' => '00')), <ide> public function testMinute() { <ide> $this->Form->request->data['Model']['field'] = ''; <ide> $result = $this->Form->minute('Model.field', array('interval' => 5)); <ide> $expected = array( <del> array('select' => array('name' => 'Model[field][min]', 'id' => 'ModelFieldMin')), <add> array('select' => array('name' => 'Model[field][min]')), <ide> array('option' => array('value' => '')), <ide> '/option', <ide> array('option' => array('value' => '00')), <ide> public function testMinute() { <ide> $this->Form->request->data['Model']['field'] = '2006-10-10 00:10:32'; <ide> $result = $this->Form->minute('Model.field', array('interval' => 5)); <ide> $expected = array( <del> array('select' => array('name' => 'Model[field][min]', 'id' => 'ModelFieldMin')), <add> array('select' => array('name' => 'Model[field][min]')), <ide> array('option' => array('value' => '')), <ide> '/option', <ide> array('option' => array('value' => '00')),
1
Python
Python
improve tf backend docstrings
0bf2b1b075223d9e53bc16e63e2ee11fa839508e
<ide><path>keras/backend/tensorflow_backend.py <ide> def switch(condition, then_expression, else_expression): <ide> def relu(x, alpha=0., max_value=None): <ide> '''ReLU. <ide> <del> alpha: slope of negative section. <add> # Arguments <add> alpha: slope of negative section. <add> max_value: saturation threshold. <ide> ''' <ide> negative_part = tf.nn.relu(-x) <ide> x = tf.nn.relu(x) <ide> def l2_normalize(x, axis): <ide> <ide> def conv2d(x, kernel, strides=(1, 1), border_mode='valid', dim_ordering='th', <ide> image_shape=None, filter_shape=None): <del> ''' <del> Run on cuDNN if available. <del> border_mode: string, "same" or "valid". <del> dim_ordering: whether to use Theano or TensorFlow dimension ordering <del> in inputs/kernels/ouputs. <add> '''Runs on cuDNN if available. <add> <add> # Arguments <add> border_mode: string, "same" or "valid". <add> dim_ordering: whether to use Theano or TensorFlow dimension ordering <add> in inputs/kernels/ouputs. <ide> ''' <ide> if border_mode == 'same': <ide> padding = 'SAME' <ide> def conv2d(x, kernel, strides=(1, 1), border_mode='valid', dim_ordering='th', <ide> def pool2d(x, pool_size, strides=(1, 1), <ide> border_mode='valid', dim_ordering='th', pool_mode='max'): <ide> ''' <del> pool_size: tuple of 2 integers. <del> strides: tuple of 2 integers. <del> border_mode: one of "valid", "same". <del> dim_ordering: one of "th", "tf". <add> # Arguments <add> pool_size: tuple of 2 integers. <add> strides: tuple of 2 integers. <add> border_mode: one of "valid", "same". <add> dim_ordering: one of "th", "tf". <ide> ''' <ide> if border_mode == 'same': <ide> padding = 'SAME'
1
PHP
PHP
remove unnecessary assertions
2e35feac5294fdca5171f3fa7dbd75f3592f47df
<ide><path>tests/TestCase/ORM/Behavior/TranslateBehaviorTest.php <ide> public function testLocalePropertyIsSetInMatchingData() <ide> ->first(); <ide> <ide> $this->assertArrayNotHasKey('_locale', $result->comments); <del> $this->assertArrayHasKey('_locale', $result->_matchingData['Comments']); <ide> $this->assertEquals('abc', $result->_matchingData['Comments']->_locale); <ide> } <ide> <ide> public function testLocalePropertyIsSetInMatchingDataWhenUsingDeepMatching() <ide> ->first(); <ide> <ide> $this->assertArrayNotHasKey('_locale', $result->comments); <del> $this->assertArrayHasKey('_locale', $result->_matchingData['Comments']); <del> $this->assertArrayHasKey('_locale', $result->_matchingData['Authors']); <ide> $this->assertEquals('abc', $result->_matchingData['Comments']->_locale); <ide> $this->assertEquals('xyz', $result->_matchingData['Authors']->_locale); <ide> } <ide> public function testLocalePropertyIsSetInMatchingDataWhenUsingContainedMatching( <ide> <ide> $this->assertArrayNotHasKey('_locale', $result->articles); <ide> $this->assertArrayNotHasKey('_locale', $result->articles[0]->tags); <del> $this->assertArrayHasKey('_locale', $result->articles[0]->_matchingData['Tags']); <ide> $this->assertEquals('abc', $result->articles[0]->_locale); <ide> $this->assertEquals('xyz', $result->articles[0]->_matchingData['Tags']->_locale); <ide> }
1