content_type
stringclasses
8 values
main_lang
stringclasses
7 values
message
stringlengths
1
50
sha
stringlengths
40
40
patch
stringlengths
52
962k
file_count
int64
1
300
Javascript
Javascript
remove use of private method makearray in examples
ceea31a86e38e16f1d5775cefabc2fa092dd192a
<ide><path>packages/ember-runtime/lib/utils.js <ide> export function isArray(obj) { <ide> Ember.typeOf(new Number(101)); // 'number' <ide> Ember.typeOf(true); // 'boolean' <ide> Ember.typeOf(new Boolean(true)); // 'boolean' <del> Ember.typeOf(Ember.makeArray); // 'function' <add> Ember.typeOf(Ember.A); // 'function' <ide> Ember.typeOf([1, 2, 90]); // 'array' <ide> Ember.typeOf(/abc/); // 'regexp' <ide> Ember.typeOf(new Date()); // 'date'
1
Python
Python
use shape utils for assertion in feature extractor
e25c014ed616ae9b14b6c2c924a2cc6b3036f068
<ide><path>research/object_detection/models/faster_rcnn_mobilenet_v1_feature_extractor.py <ide> import tensorflow as tf <ide> <ide> from object_detection.meta_architectures import faster_rcnn_meta_arch <add>from object_detection.utils import shape_utils <ide> from nets import mobilenet_v1 <ide> <ide> slim = tf.contrib.slim <ide> def _extract_proposal_features(self, preprocessed_inputs, scope): <ide> """ <ide> <ide> preprocessed_inputs.get_shape().assert_has_rank(4) <del> shape_assert = tf.Assert( <del> tf.logical_and(tf.greater_equal(tf.shape(preprocessed_inputs)[1], 33), <del> tf.greater_equal(tf.shape(preprocessed_inputs)[2], 33)), <del> ['image size must at least be 33 in both height and width.']) <del> <del> with tf.control_dependencies([shape_assert]): <del> with slim.arg_scope( <del> mobilenet_v1.mobilenet_v1_arg_scope( <del> is_training=self._train_batch_norm, <del> weight_decay=self._weight_decay)): <del> with tf.variable_scope('MobilenetV1', <del> reuse=self._reuse_weights) as scope: <del> params = {} <del> if self._skip_last_stride: <del> params['conv_defs'] = _MOBILENET_V1_100_CONV_NO_LAST_STRIDE_DEFS <del> _, activations = mobilenet_v1.mobilenet_v1_base( <del> preprocessed_inputs, <del> final_endpoint='Conv2d_11_pointwise', <del> min_depth=self._min_depth, <del> depth_multiplier=self._depth_multiplier, <del> scope=scope, <del> **params) <add> preprocessed_inputs = shape_utils.check_min_image_dim( <add> min_dim=33, image_tensor=preprocessed_inputs) <add> <add> with slim.arg_scope( <add> mobilenet_v1.mobilenet_v1_arg_scope( <add> is_training=self._train_batch_norm, <add> weight_decay=self._weight_decay)): <add> with tf.variable_scope('MobilenetV1', <add> reuse=self._reuse_weights) as scope: <add> params = {} <add> if self._skip_last_stride: <add> params['conv_defs'] = _MOBILENET_V1_100_CONV_NO_LAST_STRIDE_DEFS <add> _, activations = mobilenet_v1.mobilenet_v1_base( <add> preprocessed_inputs, <add> final_endpoint='Conv2d_11_pointwise', <add> min_depth=self._min_depth, <add> depth_multiplier=self._depth_multiplier, <add> scope=scope, <add> **params) <ide> return activations['Conv2d_11_pointwise'], activations <ide> <ide> def _extract_box_classifier_features(self, proposal_feature_maps, scope):
1
Ruby
Ruby
pass the route name explicitly
aa6637d140c2ebd28bbd23fc250af033a065dbe8
<ide><path>actionpack/lib/action_controller/test_case.rb <ide> def build_request_uri(action, parameters) <ide> :relative_url_root => nil, <ide> :_recall => @request.path_parameters) <ide> <del> url, query_string = @routes.path_for(options).split("?", 2) <add> route_name = options.delete :use_route <add> url, query_string = @routes.path_for(options, route_name).split("?", 2) <ide> <ide> @request.env["SCRIPT_NAME"] = @controller.config.relative_url_root <ide> @request.env["PATH_INFO"] = url <ide><path>actionpack/test/controller/test_case_test.rb <ide> def test_array_path_parameter_handled_properly <ide> end <ide> end <ide> <add> def test_use_route <add> with_routing do |set| <add> set.draw do <add> get 'via_unnamed_route', to: 'test_case_test/test#test_uri' <add> get 'via_named_route', as: :a_named_route, to: 'test_case_test/test#test_uri' <add> end <add> <add> get :test_uri, use_route: :a_named_route <add> assert_equal '/via_named_route', @response.body <add> end <add> end <add> <ide> def test_assert_realistic_path_parameters <ide> get :test_params, :id => 20, :foo => Object.new <ide>
2
Text
Text
add information about auth parameter to readme
f28ff933e491ad7b1dd77af6ad3abe126109bd9e
<ide><path>README.md <ide> These are the available config options for making requests. Only the `url` is re <ide> // `auth` indicates that HTTP Basic auth should be used, and supplies credentials. <ide> // This will set an `Authorization` header, overwriting any existing <ide> // `Authorization` custom headers you have set using `headers`. <add> // Please note that only HTTP Basic auth is configurable through this parameter. <add> // For Bearer tokens and such, use `Authorization` custom headers instead. <ide> auth: { <ide> username: 'janedoe', <ide> password: 's00pers3cret'
1
Text
Text
correct bad english
ad223520bf8dca33ced04a0af279527da49489fc
<ide><path>guides/source/getting_started.md <ide> TIP: The examples below use # and $ to denote superuser and regular user termina <ide> <ide> Open up a command line prompt. On Mac OS X open Terminal.app, on Windows choose <ide> "Run" from your Start menu and type 'cmd.exe'. Any commands prefaced with a <del>dollar sign `$` should be run in the command line. Verify sure you have a <add>dollar sign `$` should be run in the command line. Verify that you have a <ide> current version of Ruby installed: <ide> <ide> ```bash <ide> To verify that you have everything installed correctly, you should be able to ru <ide> $ rails --version <ide> ``` <ide> <del>If it says something like "Rails 3.2.9" you are ready to continue. <add>If it says something like "Rails 3.2.9", you are ready to continue. <ide> <ide> ### Creating the Blog Application <ide>
1
PHP
PHP
remove phpunit\util\invalidargumenthelper
fed2a297b89b8dadf3a3d95c608dfc3b025be532
<ide><path>src/Illuminate/Testing/Assert.php <ide> use PHPUnit\Framework\Constraint\LogicalNot; <ide> use PHPUnit\Framework\Constraint\RegularExpression; <ide> use PHPUnit\Framework\InvalidArgumentException; <del>use PHPUnit\Util\InvalidArgumentHelper; <ide> <ide> /** <ide> * @internal This class is not meant to be used or overwritten outside the framework itself. <ide> abstract class Assert extends PHPUnit <ide> public static function assertArraySubset($subset, $array, bool $checkForIdentity = false, string $msg = ''): void <ide> { <ide> if (! (is_array($subset) || $subset instanceof ArrayAccess)) { <del> if (class_exists(InvalidArgumentException::class)) { <del> throw InvalidArgumentException::create(1, 'array or ArrayAccess'); <del> } else { <del> throw InvalidArgumentHelper::factory(1, 'array or ArrayAccess'); <del> } <add> throw InvalidArgumentException::create(1, 'array or ArrayAccess'); <ide> } <ide> <ide> if (! (is_array($array) || $array instanceof ArrayAccess)) { <del> if (class_exists(InvalidArgumentException::class)) { <del> throw InvalidArgumentException::create(2, 'array or ArrayAccess'); <del> } else { <del> throw InvalidArgumentHelper::factory(2, 'array or ArrayAccess'); <del> } <add> throw InvalidArgumentException::create(2, 'array or ArrayAccess'); <ide> } <ide> <ide> $constraint = new ArraySubset($subset, $checkForIdentity);
1
Ruby
Ruby
add test? method
fed96385acc2ee10909870997950f2e48a86026f
<ide><path>Library/Homebrew/sandbox.rb <ide> def self.available? <ide> OS.mac? && File.executable?(SANDBOX_EXEC) <ide> end <ide> <add> def self.test? <add> return false unless available? <add> !ARGV.no_sandbox? <add> end <add> <ide> def self.print_sandbox_message <ide> unless @printed_sandbox_message <ide> ohai "Using the sandbox" <ide><path>Library/Homebrew/test/test_sandbox.rb <ide> def teardown <ide> @dir.rmtree <ide> end <ide> <add> def test_test? <add> ARGV.stubs(:no_sandbox?).returns false <add> assert Sandbox.test?, <add> "Tests should be sandboxed unless --no-sandbox was passed." <add> end <add> <ide> def test_allow_write <ide> @sandbox.allow_write @file <ide> @sandbox.exec "touch", @file
2
Text
Text
update image styling doc
c9efbe1818641f77996d53925bf1959f7d8384d8
<ide><path>docs/api-reference/next/image.md <ide> Other properties on the `<Image />` component will be passed to the underlying <ide> <ide> ## Styling <ide> <del>`next/image` wraps the `img` element with other `div` elements to maintain the aspect ratio of the image and prevent [Cumulative Layout Shift](https://vercel.com/blog/core-web-vitals#cumulative-layout-shift). <add>`next/image` wraps the `img` element with a single `div` element to maintain the aspect ratio of the image and prevent [Cumulative Layout Shift](https://vercel.com/blog/core-web-vitals#cumulative-layout-shift). <ide> <ide> To add styles to the underlying `img` element, pass the `className` prop to the `<Image />` component. Then, use Next.js' [built-in CSS support](/docs/basic-features/built-in-css-support.md) to add rules to that class. <ide>
1
Ruby
Ruby
allow ruby 2.6.8
943b79d2fbf6776067594a3f670bf7e045960707
<ide><path>Library/Homebrew/extend/os/mac/diagnostic.rb <ide> def check_if_xcode_needs_clt_installed <ide> end <ide> <ide> def check_ruby_version <del> return if RUBY_VERSION == HOMEBREW_REQUIRED_RUBY_VERSION <add> # TODO: require 2.6.8 for everyone once enough have updated to Monterey <add> required_version = if MacOS.version >= :monterey || <add> ENV["HOMEBREW_RUBY_PATH"].to_s.include?("/vendor/portable-ruby/") <add> "2.6.8" <add> else <add> HOMEBREW_REQUIRED_RUBY_VERSION <add> end <add> return if RUBY_VERSION == required_version <ide> return if Homebrew::EnvConfig.developer? && OS::Mac.version.prerelease? <ide> <ide> <<~EOS <ide> Ruby version #{RUBY_VERSION} is unsupported on #{MacOS.version}. Homebrew <del> is developed and tested on Ruby #{HOMEBREW_REQUIRED_RUBY_VERSION}, and may not work correctly <add> is developed and tested on Ruby #{required_version}, and may not work correctly <ide> on other Rubies. Patches are accepted as long as they don't cause breakage <ide> on supported Rubies. <ide> EOS
1
Javascript
Javascript
add removein to record
ae6f5bf55672d086f30d416a8505ab9caa65597a
<ide><path>dist/immutable.js <ide> var Record = function Record(defaultValues, name) { <ide> }, {}, KeyedCollection); <ide> var RecordPrototype = Record.prototype; <ide> RecordPrototype[DELETE] = RecordPrototype.remove; <add>RecordPrototype.removeIn = MapPrototype.removeIn; <ide> RecordPrototype.merge = MapPrototype.merge; <ide> RecordPrototype.mergeWith = MapPrototype.mergeWith; <ide> RecordPrototype.mergeIn = MapPrototype.mergeIn; <ide><path>dist/immutable.min.js <ide> return new Vr(function(){for(;e>s;)s++,u.next();var t=u.next();return r||n===Br? <ide> })},r}function Le(t,e,r){e||(e=Ne);var n=O(t),i=0,u=t.toSeq().map(function(e,n){return[n,e,i++,r?r(e,n,t):e]}).toArray();return u.sort(function(t,r){return e(t[3],r[3])||t[2]-r[2]}).forEach(n?function(t,e){u[e].length=2}:function(t,e){u[e]=t[1]}),n?on(u):E(t)?hn(u):fn(u)}function Te(t,e,r){if(e||(e=Ne),r){var n=t.toSeq().map(function(e,n){return[e,r(e,n,t)]}).reduce(function(t,r){return e(r[1],t[1])>0?r:t});return n&&n[0]}return t.reduce(function(t,r){return e(r,t)>0?r:t})}function Be(t,e){return V(t)?e:t.constructor(e)}function We(t){if(t!==Object(t))throw new TypeError("Expected [K, V] tuple: "+t)}function Je(t){return h(t.size),c(t)}function Pe(t){return O(t)?tn:E(t)?rn:nn}function He(t){return Object.create((O(t)?on:E(t)?hn:fn).prototype)}function Ve(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):un.prototype.cacheResult.call(this)}function Ne(t,e){return t>e?1:e>t?-1:0}function Ye(t){return!(!t||!t[Xn])}function Qe(t,e,r,n,i,u){var s,o=t&&t.array;if(0===e){var a=0>r?-r:0,h=n-r;for(h>qr&&(h=qr),s=a;h>s;s++)if(i(o&&o[u?a+h-1-s:s])===!1)return!1}else{var c=1<<e,f=e-br;for(s=0;Mr>=s;s++){var _=u?Mr-s:s,l=r+(_<<e);if(n>l&&l+c>0){var v=o&&o[_];if(!Qe(v,f,l,n,i,u))return!1}}}return!0}function Xe(t,e,r,n,i){return{array:t,level:e,offset:r,max:n,rawMax:n-r>>e,index:0,__prev:i}}function Fe(t,e,r,n,i,u,s){var o=Object.create(Fn);return o.size=e-t,o._origin=t,o._capacity=e,o._level=r,o._root=n,o._tail=i,o.__ownerID=u,o.__hash=s,o.__altered=!1,o}function Ge(){return ti||(ti=Fe(0,0,br))}function Ze(t,e,r){if(e=f(t,e),e>=t.size||0>e)return t.withMutations(function(t){0>e?rr(t,e).set(0,r):rr(t,0,e+1).set(e,r)});e+=t._origin;var n=t._tail,i=t._root,s=u(kr);return e>=ir(t._capacity)?n=$e(n,t.__ownerID,0,e,r,s):i=$e(i,t.__ownerID,t._level,e,r,s),s.value?t.__ownerID?(t._root=i,t._tail=n,t.__hash=void 0,t.__altered=!0,t):Fe(t._origin,t._capacity,t._level,i,n):t}function $e(t,e,r,n,i,u){var o=n>>>r&Mr,a=t&&t.array.length>o;if(!a&&void 0===i)return t;var h;if(r>0){var c=t&&t.array[o],f=$e(c,e,r-br,n,i,u); <ide> return f===c?t:(h=tr(t,e),h.array[o]=f,h)}return a&&t.array[o]===i?t:(s(u),h=tr(t,e),void 0===i&&o===h.array.length-1?h.array.pop():h.array[o]=i,h)}function tr(t,e){return e&&t&&e===t.ownerID?t:new Gn(t?t.array.slice():[],e)}function er(t,e){if(e>=ir(t._capacity))return t._tail;if(1<<t._level+br>e){for(var r=t._root,n=t._level;r&&n>0;)r=r.array[e>>>n&Mr],n-=br;return r}}function rr(t,e,r){var n=t.__ownerID||new o,i=t._origin,u=t._capacity,s=i+e,a=void 0===r?u:0>r?u+r:i+r;if(s===i&&a===u)return t;if(s>=a)return t.clear();for(var h=t._level,c=t._root,f=0;0>s+f;)c=new Gn(c&&c.array.length?[void 0,c]:[],n),h+=br,f+=1<<h;f&&(s+=f,i+=f,a+=f,u+=f);for(var _=ir(u),l=ir(a);l>=1<<h+br;)c=new Gn(c&&c.array.length?[c]:[],n),h+=br;var v=t._tail,p=_>l?er(t,a-1):l>_?new Gn([],n):v;if(v&&l>_&&u>s&&v.array.length){c=tr(c,n);for(var d=c,y=h;y>br;y-=br){var g=_>>>y&Mr;d=d.array[g]=tr(d.array[g],n)}d.array[_>>>br&Mr]=v}if(u>a&&(p=p&&p.removeAfter(n,0,a)),s>=l)s-=l,a-=l,h=br,c=null,p=p&&p.removeBefore(n,0,s);else if(s>i||_>l){for(f=0;c;){var m=s>>>h&Mr;if(m!==l>>>h&Mr)break;m&&(f+=(1<<h)*m),h-=br,c=c.array[m]}c&&s>i&&(c=c.removeBefore(n,h,s-f)),c&&_>l&&(c=c.removeAfter(n,h,l-f)),f&&(s-=f,a-=f)}return t.__ownerID?(t.size=a-s,t._origin=s,t._capacity=a,t._level=h,t._root=c,t._tail=p,t.__hash=void 0,t.__altered=!0,t):Fe(s,a,h,c,p)}function nr(t,e,r){for(var n=[],i=0,u=0;r.length>u;u++){var s=r[u],o=rn(s);o.size>i&&(i=o.size),k(s)||(o=o.map(function(t){return te(t)})),n.push(o)}return i>t.size&&(t=t.setSize(i)),ge(t,e,n)}function ir(t){return qr>t?0:t-1>>>br<<br}function ur(t){return ie(t)&&C(t)}function sr(t,e,r,n){var i=Object.create(ei.prototype);return i.size=t?t.size:0,i._map=t,i._list=e,i.__ownerID=r,i.__hash=n,i}function or(){return ri||(ri=sr(ae(),Ge()))}function ar(t,e,r){var n,i,u=t._map,s=t._list,o=u.get(e),a=void 0!==o;if(r===xr){if(!a)return t;s.size>=qr&&s.size>=2*u.size?(i=s.filter(function(t,e){return void 0!==t&&o!==e}),n=i.toKeyedSeq().map(function(t){return t[0]}).flip().toMap(),t.__ownerID&&(n.__ownerID=i.__ownerID=t.__ownerID)):(n=u.remove(e),i=o===s.size-1?s.pop():s.set(o,void 0)) <ide> }else if(a){if(r===s.get(o)[1])return t;n=u,i=s.set(o,[e,r])}else n=u.set(e,s.size),i=s.set(s.size,[e,r]);return t.__ownerID?(t.size=n.size,t._map=n,t._list=i,t.__hash=void 0,t):sr(n,i)}function hr(t){return!(!t||!t[ui])}function cr(t,e,r,n){var i=Object.create(si);return i.size=t,i._head=e,i.__ownerID=r,i.__hash=n,i.__altered=!1,i}function fr(){return oi||(oi=cr(0))}function _r(t){return!(!t||!t[hi])}function lr(t,e){return t.__ownerID?(t.size=e.size,t._map=e,t):e===t._map?t:0===e.size?t.__empty():t.__make(e)}function vr(t,e){var r=Object.create(ci);return r.size=t?t.size:0,r._map=t,r.__ownerID=e,r}function pr(){return fi||(fi=vr(ae()))}function dr(t){return _r(t)&&C(t)}function yr(t,e){var r=Object.create(li);return r.size=t?t.size:0,r._map=t,r.__ownerID=e,r}function gr(){return vi||(vi=yr(or()))}function mr(t,e,r){var n=Object.create(Object.getPrototypeOf(t));return n._map=e,n.__ownerID=r,n}function wr(t){return t._name||t.constructor.name}var Sr=Object,zr={};zr.createClass=t,zr.superCall=e,zr.defaultSuperCall=r;var Ir="delete",br=5,qr=1<<br,Mr=qr-1,xr={},Dr={value:!1},kr={value:!1},Or="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(t,e){t=0|t,e=0|e;var r=65535&t,n=65535&e;return r*n+((t>>>16)*n+r*(e>>>16)<<16>>>0)|0},Er=function(){try{return Object.defineProperty({},"x",{}),!0}catch(t){return!1}}(),Ar="function"==typeof WeakMap&&new WeakMap,Cr=0,jr="__immutablehash__";"function"==typeof Symbol&&(jr=Symbol(jr));var Kr=16,Rr=255,Ur=0,Lr={},Tr=0,Br=1,Wr=2,Jr="@@iterator",Pr="function"==typeof Symbol&&Symbol.iterator,Hr=Pr||Jr,Vr=function(t){this.next=t};zr.createClass(Vr,{toString:function(){return"[Iterator]"}},{}),Vr.KEYS=Tr,Vr.VALUES=Br,Vr.ENTRIES=Wr;var Nr=Vr.prototype;Nr.inspect=Nr.toSource=function(){return""+this},Nr[Hr]=function(){return this};var Yr=function(t){return k(t)?t:un(t)},Qr=Yr;zr.createClass(Yr,{toArray:function(){h(this.size);var t=Array(this.size||0);return this.valueSeq().__iterate(function(e,r){t[r]=e}),t},toIndexedSeq:function(){return new Vn(this)},toJS:function(){return this.toSeq().map(function(t){return t&&"function"==typeof t.toJS?t.toJS():t <del>}).__toJS()},toKeyedSeq:function(){return new Hn(this,!0)},toMap:function(){return h(this.size),Mn(this.toKeyedSeq())},toObject:function(){h(this.size);var t={};return this.__iterate(function(e,r){t[r]=e}),t},toOrderedMap:function(){return h(this.size),ei(this.toKeyedSeq())},toOrderedSet:function(){return h(this.size),_i(O(this)?this.valueSeq():this)},toSet:function(){return h(this.size),ai(O(this)?this.valueSeq():this)},toSetSeq:function(){return new Nn(this)},toSeq:function(){return E(this)?this.toIndexedSeq():O(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return h(this.size),ni(O(this)?this.valueSeq():this)},toList:function(){return h(this.size),Qn(O(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(t,e){return 0===this.size?t+e:t+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+e},concat:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return Be(this,je(this,t))},contains:function(t){return this.some(function(e){return n(e,t)})},entries:function(){return this.__iterator(Wr)},every:function(t,e){var r=!0;return this.__iterate(function(n,i,u){return t.call(e,n,i,u)?void 0:(r=!1,!1)}),r},filter:function(t,e){return Be(this,xe(this,t,e,!0))},find:function(t,e,r){var n=r;return this.__iterate(function(r,i,u){return t.call(e,r,i,u)?(n=r,!1):void 0}),n},forEach:function(t,e){return this.__iterate(e?t.bind(e):t)},join:function(t){t=void 0!==t?""+t:",";var e="",r=!0;return this.__iterate(function(n){r?r=!1:e+=t,e+=null!==n&&void 0!==n?n:""}),e},keys:function(){return this.__iterator(Tr)},map:function(t,e){return Be(this,qe(this,t,e))},reduce:function(t,e,r){var n,i;return 2>arguments.length?i=!0:n=e,this.__iterate(function(e,u,s){i?(i=!1,n=e):n=t.call(r,n,e,u,s)}),n},reduceRight:function(){var t=this.toKeyedSeq().reverse();return t.reduce.apply(t,arguments)},reverse:function(){return Be(this,Me(this,!0))},slice:function(t,e){if(l(t,e,this.size))return this;var r=v(t,this.size),n=p(e,this.size);if(r!==r||n!==n)return this.toSeq().cacheResult().slice(t,e); <add>}).__toJS()},toKeyedSeq:function(){return new Hn(this,!0)},toMap:function(){return h(this.size),Mn(this.toKeyedSeq())},toObject:function(){h(this.size);var t={};return this.__iterate(function(e,r){t[r]=e}),t},toOrderedMap:function(){return h(this.size),ei(this.toKeyedSeq())},toOrderedSet:function(){return h(this.size),_i(O(this)?this.valueSeq():this)},toSet:function(){return h(this.size),ai(O(this)?this.valueSeq():this)},toSetSeq:function(){return new Nn(this)},toSeq:function(){return E(this)?this.toIndexedSeq():O(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return h(this.size),ni(O(this)?this.valueSeq():this)},toList:function(){return h(this.size),Qn(O(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(t,e){return 0===this.size?t+e:t+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+e},concat:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Be(this,je(this,t))},contains:function(t){return this.some(function(e){return n(e,t)})},entries:function(){return this.__iterator(Wr)},every:function(t,e){var r=!0;return this.__iterate(function(n,i,u){return t.call(e,n,i,u)?void 0:(r=!1,!1)}),r},filter:function(t,e){return Be(this,xe(this,t,e,!0))},find:function(t,e,r){var n=r;return this.__iterate(function(r,i,u){return t.call(e,r,i,u)?(n=r,!1):void 0}),n},forEach:function(t,e){return this.__iterate(e?t.bind(e):t)},join:function(t){t=void 0!==t?""+t:",";var e="",r=!0;return this.__iterate(function(n){r?r=!1:e+=t,e+=null!==n&&void 0!==n?n:""}),e},keys:function(){return this.__iterator(Tr)},map:function(t,e){return Be(this,qe(this,t,e))},reduce:function(t,e,r){var n,i;return arguments.length<2?i=!0:n=e,this.__iterate(function(e,u,s){i?(i=!1,n=e):n=t.call(r,n,e,u,s)}),n},reduceRight:function(){var t=this.toKeyedSeq().reverse();return t.reduce.apply(t,arguments)},reverse:function(){return Be(this,Me(this,!0))},slice:function(t,e){if(l(t,e,this.size))return this;var r=v(t,this.size),n=p(e,this.size);if(r!==r||n!==n)return this.toSeq().cacheResult().slice(t,e); <ide> var i=0===r?this:this.skip(r);return Be(this,void 0===n||n===this.size?i:i.take(n-r))},some:function(t,e){return!this.every(R(t),e)},sort:function(t){return Be(this,Le(this,t))},values:function(){return this.__iterator(Br)},butLast:function(){return this.slice(0,-1)},count:function(t,e){return c(t?this.toSeq().filter(t,e):this)},countBy:function(t,e){return De(this,t,e)},equals:function(t){return B(this,t)},entrySeq:function(){var t=this;if(t._cache)return new vn(t._cache);var e=t.toSeq().map(K).toIndexedSeq();return e.fromEntrySeq=function(){return t.toSeq()},e},filterNot:function(t,e){return this.filter(R(t),e)},findLast:function(t,e,r){return this.toKeyedSeq().reverse().find(t,e,r)},first:function(){return this.find(_)},flatMap:function(t,e){return Be(this,Re(this,t,e))},flatten:function(t){return Be(this,Ke(this,t,!0))},fromEntrySeq:function(){return new Yn(this)},get:function(t,e){return this.find(function(e,r){return n(r,t)},void 0,e)},getIn:function(t,e){var r=this;if(t)for(var n,i=x(t)||x(Qr(t));!(n=i.next()).done;){var u=n.value;if(r=r&&r.get?r.get(u,xr):xr,r===xr)return e}return r},groupBy:function(t,e){return ke(this,t,e)},has:function(t){return this.get(t,xr)!==xr},isSubset:function(t){return t="function"==typeof t.contains?t:Qr(t),this.every(function(e){return t.contains(e)})},isSuperset:function(t){return t.isSubset(this)},keySeq:function(){return this.toSeq().map(j).toIndexedSeq()},last:function(){return this.toSeq().reverse().first()},max:function(t){return Te(this,t)},maxBy:function(t,e){return Te(this,e,t)},min:function(t){return Te(this,t?U(t):T)},minBy:function(t,e){return Te(this,e?U(e):T,t)},rest:function(){return this.slice(1)},skip:function(t){return Be(this,Ae(this,t,!0))},skipLast:function(t){return Be(this,this.toSeq().reverse().skip(t).reverse())},skipWhile:function(t,e){return Be(this,Ce(this,t,e,!0))},skipUntil:function(t,e){return this.skipWhile(R(t),e)},sortBy:function(t,e){return Be(this,Le(this,e,t))},take:function(t){return Be(this,Oe(this,t))},takeLast:function(t){return Be(this,this.toSeq().reverse().take(t).reverse()) <ide> },takeWhile:function(t,e){return Be(this,Ee(this,t,e))},takeUntil:function(t,e){return this.takeWhile(R(t),e)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=W(this))}},{});var Xr="",Fr="",Gr="",Zr="",$r=Yr.prototype;$r[Xr]=!0,$r[Hr]=$r.values,$r.toJSON=$r.toJS,$r.__toJS=$r.toArray,$r.__toStringMapper=L,$r.inspect=$r.toSource=function(){return""+this},$r.chain=$r.flatMap,function(){try{Object.defineProperty($r,"length",{get:function(){if(!Yr.noLengthWarning){var t;try{throw Error()}catch(e){t=e.stack}if(-1===t.indexOf("_wrapObject"))return console&&console.warn&&console.warn("iterable.length has been deprecated, use iterable.size or iterable.count(). This warning will become a silent error in a future version. "+t),this.size}}})}catch(t){}}();var tn=function(t){return O(t)?t:on(t)};zr.createClass(tn,{flip:function(){return Be(this,be(this))},findKey:function(t,e){var r;return this.__iterate(function(n,i,u){return t.call(e,n,i,u)?(r=i,!1):void 0}),r},findLastKey:function(t,e){return this.toSeq().reverse().findKey(t,e)},keyOf:function(t){return this.findKey(function(e){return n(e,t)})},lastKeyOf:function(t){return this.toSeq().reverse().keyOf(t)},mapEntries:function(t,e){var r=this,n=0;return Be(this,this.toSeq().map(function(i,u){return t.call(e,[u,i],n++,r)}).fromEntrySeq())},mapKeys:function(t,e){var r=this;return Be(this,this.toSeq().flip().map(function(n,i){return t.call(e,n,i,r)}).flip())}},{},Yr);var en=tn.prototype;en[Fr]=!0,en[Hr]=$r.entries,en.__toJS=$r.toObject,en.__toStringMapper=function(t,e){return e+": "+L(t)};var rn=function(t){return E(t)?t:hn(t)};zr.createClass(rn,{toKeyedSeq:function(){return new Hn(this,!1)},filter:function(t,e){return Be(this,xe(this,t,e,!1))},findIndex:function(t,e){var r=this.toKeyedSeq().findKey(t,e);return void 0===r?-1:r},indexOf:function(t){var e=this.toKeyedSeq().keyOf(t);return void 0===e?-1:e},lastIndexOf:function(t){var e=this.toKeyedSeq().lastKeyOf(t); <ide> return void 0===e?-1:e},reverse:function(){return Be(this,Me(this,!1))},splice:function(t,e){var r=arguments.length;if(e=Math.max(0|e,0),0===r||2===r&&!e)return this;t=v(t,this.size);var n=this.slice(0,t);return Be(this,1===r?n:n.concat(a(arguments,2),this.slice(t+e)))},findLastIndex:function(t,e){var r=this.toKeyedSeq().findLastKey(t,e);return void 0===r?-1:r},first:function(){return this.get(0)},flatten:function(t){return Be(this,Ke(this,t,!1))},get:function(t,e){return t=f(this,t),0>t||1/0===this.size||void 0!==this.size&&t>this.size?e:this.find(function(e,r){return r===t},void 0,e)},has:function(t){return t=f(this,t),t>=0&&(void 0!==this.size?1/0===this.size||this.size>t:-1!==this.indexOf(t))},interpose:function(t){return Be(this,Ue(this,t))},last:function(){return this.get(-1)},skip:function(t){var e=this,r=Ae(e,t,!1);return V(e)&&r!==e&&(r.get=function(r,n){return r=f(this,r),r>=0?e.get(r+t,n):n}),Be(this,r)},skipWhile:function(t,e){return Be(this,Ce(this,t,e,!1))},take:function(t){var e=this,r=Oe(e,t);return V(e)&&r!==e&&(r.get=function(r,n){return r=f(this,r),r>=0&&t>r?e.get(r,n):n}),Be(this,r)}},{},Yr),rn.prototype[Gr]=!0,rn.prototype[Zr]=!0;var nn=function(t){return k(t)&&!A(t)?t:fn(t)};zr.createClass(nn,{get:function(t,e){return this.has(t)?t:e},contains:function(t){return this.has(t)},keySeq:function(){return this.valueSeq()}},{},Yr),nn.prototype.has=$r.contains,Yr.isIterable=k,Yr.isKeyed=O,Yr.isIndexed=E,Yr.isAssociative=A,Yr.isOrdered=C,Yr.Keyed=tn,Yr.Indexed=rn,Yr.Set=nn,Yr.Iterator=Vr;var un=function(t){return null===t||void 0===t?N():k(t)?t.toSeq():X(t)},sn=un;zr.createClass(un,{toSeq:function(){return this},toString:function(){return this.__toString("Seq {","}")},cacheResult:function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},__iterate:function(t,e){return Z(this,t,e,!0)},__iterator:function(t,e){return $(this,t,e,!0)}},{of:function(){return sn(arguments)}},Yr);var on=function(t){return null===t||void 0===t?N().toKeyedSeq():k(t)?O(t)?t.toSeq():t.fromEntrySeq():Y(t) <ide> },an=on;zr.createClass(on,{toKeyedSeq:function(){return this},toSeq:function(){return this}},{of:function(){return an(arguments)}},un),H(on,tn.prototype);var hn=function(t){return null===t||void 0===t?N():k(t)?O(t)?t.entrySeq():t.toIndexedSeq():Q(t)},cn=hn;zr.createClass(hn,{toIndexedSeq:function(){return this},toString:function(){return this.__toString("Seq [","]")},__iterate:function(t,e){return Z(this,t,e,!1)},__iterator:function(t,e){return $(this,t,e,!1)}},{of:function(){return cn(arguments)}},un),H(hn,rn.prototype);var fn=function(t){return(null===t||void 0===t?N():k(t)?O(t)?t.entrySeq():t:Q(t)).toSetSeq()},_n=fn;zr.createClass(fn,{toSetSeq:function(){return this}},{of:function(){return _n(arguments)}},un),H(fn,nn.prototype),un.isSeq=V,un.Keyed=on,un.Set=fn,un.Indexed=hn;var ln="";un.prototype[ln]=!0;var vn=function(t){this._array=t,this.size=t.length};zr.createClass(vn,{get:function(t,e){return this.has(t)?this._array[f(this,t)]:e},__iterate:function(t,e){for(var r=this._array,n=r.length-1,i=0;n>=i;i++)if(t(r[e?n-i:i],i,this)===!1)return i+1;return i},__iterator:function(t,e){var r=this._array,n=r.length-1,i=0;return new Vr(function(){return i>n?b():I(t,i,r[e?n-i++:i++])})}},{},hn);var pn=function(t){var e=Object.keys(t);this._object=t,this._keys=e,this.size=e.length};zr.createClass(pn,{get:function(t,e){return void 0===e||this.has(t)?this._object[t]:e},has:function(t){return this._object.hasOwnProperty(t)},__iterate:function(t,e){for(var r=this._object,n=this._keys,i=n.length-1,u=0;i>=u;u++){var s=n[e?i-u:u];if(t(r[s],s,this)===!1)return u+1}return u},__iterator:function(t,e){var r=this._object,n=this._keys,i=n.length-1,u=0;return new Vr(function(){var s=n[e?i-u:u];return u++>i?b():I(t,s,r[s])})}},{},on),pn.prototype[Zr]=!0;var dn=function(t){this._iterable=t,this.size=t.length||t.size};zr.createClass(dn,{__iterateUncached:function(t,e){if(e)return this.cacheResult().__iterate(t,e);var r=this._iterable,n=x(r),i=0;if(M(n))for(var u;!(u=n.next()).done&&t(u.value,i++,this)!==!1;);return i <ide> },__iteratorUncached:function(t,e){if(e)return this.cacheResult().__iterator(t,e);var r=this._iterable,n=x(r);if(!M(n))return new Vr(b);var i=0;return new Vr(function(){var e=n.next();return e.done?e:I(t,i++,e.value)})}},{},hn);var yn=function(t){this._iterator=t,this._iteratorCache=[]};zr.createClass(yn,{__iterateUncached:function(t,e){if(e)return this.cacheResult().__iterate(t,e);for(var r=this._iterator,n=this._iteratorCache,i=0;n.length>i;)if(t(n[i],i++,this)===!1)return i;for(var u;!(u=r.next()).done;){var s=u.value;if(n[i]=s,t(s,i++,this)===!1)break}return i},__iteratorUncached:function(t,e){if(e)return this.cacheResult().__iterator(t,e);var r=this._iterator,n=this._iteratorCache,i=0;return new Vr(function(){if(i>=n.length){var e=r.next();if(e.done)return e;n[i]=e.value}return I(t,i,n[i++])})}},{},hn);var gn,mn=function(){throw TypeError("Abstract")};zr.createClass(mn,{},{},Yr);var wn=function(){zr.defaultSuperCall(this,Sn.prototype,arguments)},Sn=wn;zr.createClass(wn,{},{},mn),H(wn,tn.prototype);var zn=function(){zr.defaultSuperCall(this,In.prototype,arguments)},In=zn;zr.createClass(zn,{},{},mn),H(zn,rn.prototype);var bn=function(){zr.defaultSuperCall(this,qn.prototype,arguments)},qn=bn;zr.createClass(bn,{},{},mn),H(bn,nn.prototype),mn.Keyed=wn,mn.Indexed=zn,mn.Set=bn;var Mn=function(t){return null===t||void 0===t?ae():ie(t)?t:ae().withMutations(function(e){tn(t).forEach(function(t,r){return e.set(r,t)})})};zr.createClass(Mn,{toString:function(){return this.__toString("Map {","}")},get:function(t,e){return this._root?this._root.get(0,void 0,t,e):e},set:function(t,e){return he(this,t,e)},setIn:function(t,e){return this.updateIn(t,function(){return e})},remove:function(t){return he(this,t,xr)},removeIn:function(t){return this.updateIn(t,function(){return xr})},update:function(t,e,r){return 1===arguments.length?t(this):this.updateIn([t],e,r)},updateIn:function(t,e,r){r||(r=e,e=void 0);var n=me(this,x(t)||x(Yr(t)),e,r);return n===xr?void 0:n},clear:function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):ae() <del>},merge:function(){return de(this,void 0,arguments)},mergeWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return de(this,t,e)},mergeIn:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return this.updateIn(t,ae(),function(t){return t.merge.apply(t,e)})},mergeDeep:function(){return de(this,ye(void 0),arguments)},mergeDeepWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return de(this,ye(t),e)},mergeDeepIn:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return this.updateIn(t,ae(),function(t){return t.mergeDeep.apply(t,e)})},sort:function(t){return ei(Le(this,t))},sortBy:function(t,e){return ei(Le(this,e,t))},withMutations:function(t){var e=this.asMutable();return t(e),e.wasAltered()?e.__ensureOwner(this.__ownerID):this},asMutable:function(){return this.__ownerID?this:this.__ensureOwner(new o)},asImmutable:function(){return this.__ensureOwner()},wasAltered:function(){return this.__altered},__iterator:function(t,e){return new Tn(this,t,e)},__iterate:function(t,e){var r=this,n=0;return this._root&&this._root.iterate(function(e){return n++,t(e[1],e[0],r)},e),n},__ensureOwner:function(t){return t===this.__ownerID?this:t?oe(this.size,this._root,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)}},{},wn),Mn.isMap=ie;var xn="",Dn=Mn.prototype;Dn[xn]=!0,Dn[Ir]=Dn.remove;var kn=function(t,e){this.ownerID=t,this.entries=e},On=kn;zr.createClass(kn,{get:function(t,e,r,i){for(var u=this.entries,s=0,o=u.length;o>s;s++)if(n(r,u[s][0]))return u[s][1];return i},update:function(t,e,r,i,u,o,h){for(var c=u===xr,f=this.entries,_=0,l=f.length;l>_&&!n(i,f[_][0]);_++);var v=l>_;if(v?f[_][1]===u:c)return this;if(s(h),(c||!v)&&s(o),!c||1!==f.length){if(!v&&!c&&f.length>=Wn)return le(t,f,i,u);var p=t&&t===this.ownerID,d=p?f:a(f);return v?c?_===l-1?d.pop():d[_]=d.pop():d[_]=[i,u]:d.push([i,u]),p?(this.entries=d,this):new On(t,d)}}},{});var En=function(t,e,r){this.ownerID=t,this.bitmap=e,this.nodes=r},An=En;zr.createClass(En,{get:function(t,e,r,n){void 0===e&&(e=g(r)); <add>},merge:function(){return de(this,void 0,arguments)},mergeWith:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return de(this,t,e)},mergeIn:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return this.updateIn(t,ae(),function(t){return t.merge.apply(t,e)})},mergeDeep:function(){return de(this,ye(void 0),arguments)},mergeDeepWith:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return de(this,ye(t),e)},mergeDeepIn:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return this.updateIn(t,ae(),function(t){return t.mergeDeep.apply(t,e)})},sort:function(t){return ei(Le(this,t))},sortBy:function(t,e){return ei(Le(this,e,t))},withMutations:function(t){var e=this.asMutable();return t(e),e.wasAltered()?e.__ensureOwner(this.__ownerID):this},asMutable:function(){return this.__ownerID?this:this.__ensureOwner(new o)},asImmutable:function(){return this.__ensureOwner()},wasAltered:function(){return this.__altered},__iterator:function(t,e){return new Tn(this,t,e)},__iterate:function(t,e){var r=this,n=0;return this._root&&this._root.iterate(function(e){return n++,t(e[1],e[0],r)},e),n},__ensureOwner:function(t){return t===this.__ownerID?this:t?oe(this.size,this._root,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)}},{},wn),Mn.isMap=ie;var xn="",Dn=Mn.prototype;Dn[xn]=!0,Dn[Ir]=Dn.remove;var kn=function(t,e){this.ownerID=t,this.entries=e},On=kn;zr.createClass(kn,{get:function(t,e,r,i){for(var u=this.entries,s=0,o=u.length;o>s;s++)if(n(r,u[s][0]))return u[s][1];return i},update:function(t,e,r,i,u,o,h){for(var c=u===xr,f=this.entries,_=0,l=f.length;l>_&&!n(i,f[_][0]);_++);var v=l>_;if(v?f[_][1]===u:c)return this;if(s(h),(c||!v)&&s(o),!c||1!==f.length){if(!v&&!c&&f.length>=Wn)return le(t,f,i,u);var p=t&&t===this.ownerID,d=p?f:a(f);return v?c?_===l-1?d.pop():d[_]=d.pop():d[_]=[i,u]:d.push([i,u]),p?(this.entries=d,this):new On(t,d)}}},{});var En=function(t,e,r){this.ownerID=t,this.bitmap=e,this.nodes=r},An=En;zr.createClass(En,{get:function(t,e,r,n){void 0===e&&(e=g(r)); <ide> var i=1<<((0===t?e:e>>>t)&Mr),u=this.bitmap;return 0===(u&i)?n:this.nodes[we(u&i-1)].get(t+br,e,r,n)},update:function(t,e,r,n,i,u,s){void 0===r&&(r=g(n));var o=(0===e?r:r>>>e)&Mr,a=1<<o,h=this.bitmap,c=0!==(h&a);if(!c&&i===xr)return this;var f=we(h&a-1),_=this.nodes,l=c?_[f]:void 0,v=ce(l,t,e+br,r,n,i,u,s);if(v===l)return this;if(!c&&v&&_.length>=Jn)return pe(t,_,h,o,v);if(c&&!v&&2===_.length&&fe(_[1^f]))return _[1^f];if(c&&v&&1===_.length&&fe(v))return v;var p=t&&t===this.ownerID,d=c?v?h:h^a:h|a,y=c?v?Se(_,f,v,p):Ie(_,f,p):ze(_,f,v,p);return p?(this.bitmap=d,this.nodes=y,this):new An(t,d,y)}},{});var Cn=function(t,e,r){this.ownerID=t,this.count=e,this.nodes=r},jn=Cn;zr.createClass(Cn,{get:function(t,e,r,n){void 0===e&&(e=g(r));var i=(0===t?e:e>>>t)&Mr,u=this.nodes[i];return u?u.get(t+br,e,r,n):n},update:function(t,e,r,n,i,u,s){void 0===r&&(r=g(n));var o=(0===e?r:r>>>e)&Mr,a=i===xr,h=this.nodes,c=h[o];if(a&&!c)return this;var f=ce(c,t,e+br,r,n,i,u,s);if(f===c)return this;var _=this.count;if(c){if(!f&&(_--,Pn>_))return ve(t,h,_,o)}else _++;var l=t&&t===this.ownerID,v=Se(h,o,f,l);return l?(this.count=_,this.nodes=v,this):new jn(t,_,v)}},{});var Kn=function(t,e,r){this.ownerID=t,this.keyHash=e,this.entries=r},Rn=Kn;zr.createClass(Kn,{get:function(t,e,r,i){for(var u=this.entries,s=0,o=u.length;o>s;s++)if(n(r,u[s][0]))return u[s][1];return i},update:function(t,e,r,i,u,o,h){void 0===r&&(r=g(i));var c=u===xr;if(r!==this.keyHash)return c?this:(s(h),s(o),_e(this,t,e,r,[i,u]));for(var f=this.entries,_=0,l=f.length;l>_&&!n(i,f[_][0]);_++);var v=l>_;if(v?f[_][1]===u:c)return this;if(s(h),(c||!v)&&s(o),c&&2===l)return new Un(t,this.keyHash,f[1^_]);var p=t&&t===this.ownerID,d=p?f:a(f);return v?c?_===l-1?d.pop():d[_]=d.pop():d[_]=[i,u]:d.push([i,u]),p?(this.entries=d,this):new Rn(t,this.keyHash,d)}},{});var Un=function(t,e,r){this.ownerID=t,this.keyHash=e,this.entry=r},Ln=Un;zr.createClass(Un,{get:function(t,e,r,i){return n(r,this.entry[0])?this.entry[1]:i},update:function(t,e,r,i,u,o,a){var h=u===xr,c=n(i,this.entry[0]);return(c?u===this.entry[1]:h)?this:(s(a),h?void s(o):c?t&&t===this.ownerID?(this.entry[1]=u,this):new Ln(t,this.keyHash,[i,u]):(s(o),_e(this,t,e,g(i),[i,u]))) <ide> }},{}),kn.prototype.iterate=Kn.prototype.iterate=function(t,e){for(var r=this.entries,n=0,i=r.length-1;i>=n;n++)if(t(r[e?i-n:n])===!1)return!1},En.prototype.iterate=Cn.prototype.iterate=function(t,e){for(var r=this.nodes,n=0,i=r.length-1;i>=n;n++){var u=r[e?i-n:n];if(u&&u.iterate(t,e)===!1)return!1}},Un.prototype.iterate=function(t){return t(this.entry)};var Tn=function(t,e,r){this._type=e,this._reverse=r,this._stack=t._root&&se(t._root)};zr.createClass(Tn,{next:function(){for(var t=this._type,e=this._stack;e;){var r,n=e.node,i=e.index++;if(n.entry){if(0===i)return ue(t,n.entry)}else if(n.entries){if(r=n.entries.length-1,r>=i)return ue(t,n.entries[this._reverse?r-i:i])}else if(r=n.nodes.length-1,r>=i){var u=n.nodes[this._reverse?r-i:i];if(u){if(u.entry)return ue(t,u.entry);e=this._stack=se(u,e)}continue}e=this._stack=this._stack.__prev}return b()}},{},Vr);var Bn,Wn=qr/4,Jn=qr/2,Pn=qr/4,Hn=function(t,e){this._iter=t,this._useKeys=e,this.size=t.size};zr.createClass(Hn,{get:function(t,e){return this._iter.get(t,e)},has:function(t){return this._iter.has(t)},valueSeq:function(){return this._iter.valueSeq()},reverse:function(){var t=this,e=Me(this,!0);return this._useKeys||(e.valueSeq=function(){return t._iter.toSeq().reverse()}),e},map:function(t,e){var r=this,n=qe(this,t,e);return this._useKeys||(n.valueSeq=function(){return r._iter.toSeq().map(t,e)}),n},__iterate:function(t,e){var r,n=this;return this._iter.__iterate(this._useKeys?function(e,r){return t(e,r,n)}:(r=e?Je(this):0,function(i){return t(i,e?--r:r++,n)}),e)},__iterator:function(t,e){if(this._useKeys)return this._iter.__iterator(t,e);var r=this._iter.__iterator(Br,e),n=e?Je(this):0;return new Vr(function(){var i=r.next();return i.done?i:I(t,e?--n:n++,i.value,i)})}},{},on),Hn.prototype[Zr]=!0;var Vn=function(t){this._iter=t,this.size=t.size};zr.createClass(Vn,{contains:function(t){return this._iter.contains(t)},__iterate:function(t,e){var r=this,n=0;return this._iter.__iterate(function(e){return t(e,n++,r)},e)},__iterator:function(t,e){var r=this._iter.__iterator(Br,e),n=0; <ide> return new Vr(function(){var e=r.next();return e.done?e:I(t,n++,e.value,e)})}},{},hn);var Nn=function(t){this._iter=t,this.size=t.size};zr.createClass(Nn,{has:function(t){return this._iter.contains(t)},__iterate:function(t,e){var r=this;return this._iter.__iterate(function(e){return t(e,e,r)},e)},__iterator:function(t,e){var r=this._iter.__iterator(Br,e);return new Vr(function(){var e=r.next();return e.done?e:I(t,e.value,e.value,e)})}},{},fn);var Yn=function(t){this._iter=t,this.size=t.size};zr.createClass(Yn,{entrySeq:function(){return this._iter.toSeq()},__iterate:function(t,e){var r=this;return this._iter.__iterate(function(e){return e?(We(e),t(e[1],e[0],r)):void 0},e)},__iterator:function(t,e){var r=this._iter.__iterator(Br,e);return new Vr(function(){for(;;){var e=r.next();if(e.done)return e;var n=e.value;if(n)return We(n),t===Wr?e:I(t,n[0],n[1],e)}})}},{},on),Vn.prototype.cacheResult=Hn.prototype.cacheResult=Nn.prototype.cacheResult=Yn.prototype.cacheResult=Ve;var Qn=function(t){var e=Ge();if(null===t||void 0===t)return e;if(Ye(t))return t;t=rn(t);var r=t.size;return 0===r?e:r>0&&qr>r?Fe(0,r,br,null,new Gn(t.toArray())):e.withMutations(function(e){e.setSize(r),t.forEach(function(t,r){return e.set(r,t)})})};zr.createClass(Qn,{toString:function(){return this.__toString("List [","]")},get:function(t,e){if(t=f(this,t),0>t||t>=this.size)return e;t+=this._origin;var r=er(this,t);return r&&r.array[t&Mr]},set:function(t,e){return Ze(this,t,e)},remove:function(t){return this.has(t)?0===t?this.shift():t===this.size-1?this.pop():this.splice(t,1):this},clear:function(){return 0===this.size?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=br,this._root=this._tail=null,this.__hash=void 0,this.__altered=!0,this):Ge()},push:function(){var t=arguments,e=this.size;return this.withMutations(function(r){rr(r,0,e+t.length);for(var n=0;t.length>n;n++)r.set(e+n,t[n])})},pop:function(){return rr(this,0,-1)},unshift:function(){var t=arguments;return this.withMutations(function(e){rr(e,-t.length);for(var r=0;t.length>r;r++)e.set(r,t[r]) <del>})},shift:function(){return rr(this,1)},merge:function(){return nr(this,void 0,arguments)},mergeWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return nr(this,t,e)},mergeDeep:function(){return nr(this,ye(void 0),arguments)},mergeDeepWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return nr(this,ye(t),e)},setSize:function(t){return rr(this,0,t)},slice:function(t,e){var r=this.size;return l(t,e,r)?this:rr(this,v(t,r),p(e,r))},__iterator:function(t,e){return new $n(this,t,e)},__iterate:function(t,e){var r=this,n=0,i=function(e){return t(e,n++,r)},u=ir(this._capacity);return e?Qe(this._tail,0,u-this._origin,this._capacity-this._origin,i,e)&&Qe(this._root,this._level,-this._origin,u-this._origin,i,e):Qe(this._root,this._level,-this._origin,u-this._origin,i,e)&&Qe(this._tail,0,u-this._origin,this._capacity-this._origin,i,e),n},__ensureOwner:function(t){return t===this.__ownerID?this:t?Fe(this._origin,this._capacity,this._level,this._root,this._tail,t,this.__hash):(this.__ownerID=t,this)}},{of:function(){return this(arguments)}},zn),Qn.isList=Ye;var Xn="",Fn=Qn.prototype;Fn[Xn]=!0,Fn[Ir]=Fn.remove,Fn.setIn=Dn.setIn,Fn.removeIn=Dn.removeIn,Fn.update=Dn.update,Fn.updateIn=Dn.updateIn,Fn.mergeIn=Dn.mergeIn,Fn.mergeDeepIn=Dn.mergeDeepIn,Fn.withMutations=Dn.withMutations,Fn.asMutable=Dn.asMutable,Fn.asImmutable=Dn.asImmutable,Fn.wasAltered=Dn.wasAltered;var Gn=function(t,e){this.array=t,this.ownerID=e},Zn=Gn;zr.createClass(Gn,{removeBefore:function(t,e,r){if(r===e?1<<e:0||0===this.array.length)return this;var n=r>>>e&Mr;if(n>=this.array.length)return new Zn([],t);var i,u=0===n;if(e>0){var s=this.array[n];if(i=s&&s.removeBefore(t,e-br,r),i===s&&u)return this}if(u&&!i)return this;var o=tr(this,t);if(!u)for(var a=0;n>a;a++)o.array[a]=void 0;return i&&(o.array[n]=i),o},removeAfter:function(t,e,r){if(r===e?1<<e:0||0===this.array.length)return this;var n=r-1>>>e&Mr;if(n>=this.array.length)return this;var i,u=n===this.array.length-1;if(e>0){var s=this.array[n]; <add>})},shift:function(){return rr(this,1)},merge:function(){return nr(this,void 0,arguments)},mergeWith:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return nr(this,t,e)},mergeDeep:function(){return nr(this,ye(void 0),arguments)},mergeDeepWith:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return nr(this,ye(t),e)},setSize:function(t){return rr(this,0,t)},slice:function(t,e){var r=this.size;return l(t,e,r)?this:rr(this,v(t,r),p(e,r))},__iterator:function(t,e){return new $n(this,t,e)},__iterate:function(t,e){var r=this,n=0,i=function(e){return t(e,n++,r)},u=ir(this._capacity);return e?Qe(this._tail,0,u-this._origin,this._capacity-this._origin,i,e)&&Qe(this._root,this._level,-this._origin,u-this._origin,i,e):Qe(this._root,this._level,-this._origin,u-this._origin,i,e)&&Qe(this._tail,0,u-this._origin,this._capacity-this._origin,i,e),n},__ensureOwner:function(t){return t===this.__ownerID?this:t?Fe(this._origin,this._capacity,this._level,this._root,this._tail,t,this.__hash):(this.__ownerID=t,this)}},{of:function(){return this(arguments)}},zn),Qn.isList=Ye;var Xn="",Fn=Qn.prototype;Fn[Xn]=!0,Fn[Ir]=Fn.remove,Fn.setIn=Dn.setIn,Fn.removeIn=Dn.removeIn,Fn.update=Dn.update,Fn.updateIn=Dn.updateIn,Fn.mergeIn=Dn.mergeIn,Fn.mergeDeepIn=Dn.mergeDeepIn,Fn.withMutations=Dn.withMutations,Fn.asMutable=Dn.asMutable,Fn.asImmutable=Dn.asImmutable,Fn.wasAltered=Dn.wasAltered;var Gn=function(t,e){this.array=t,this.ownerID=e},Zn=Gn;zr.createClass(Gn,{removeBefore:function(t,e,r){if(r===e?1<<e:0||0===this.array.length)return this;var n=r>>>e&Mr;if(n>=this.array.length)return new Zn([],t);var i,u=0===n;if(e>0){var s=this.array[n];if(i=s&&s.removeBefore(t,e-br,r),i===s&&u)return this}if(u&&!i)return this;var o=tr(this,t);if(!u)for(var a=0;n>a;a++)o.array[a]=void 0;return i&&(o.array[n]=i),o},removeAfter:function(t,e,r){if(r===e?1<<e:0||0===this.array.length)return this;var n=r-1>>>e&Mr;if(n>=this.array.length)return this;var i,u=n===this.array.length-1;if(e>0){var s=this.array[n]; <ide> if(i=s&&s.removeAfter(t,e-br,r),i===s&&u)return this}if(u&&!i)return this;var o=tr(this,t);return u||o.array.pop(),i&&(o.array[n]=i),o}},{});var $n=function(t,e,r){this._type=e,this._reverse=!!r,this._maxIndex=t.size-1;var n=ir(t._capacity),i=Xe(t._root&&t._root.array,t._level,-t._origin,n-t._origin-1),u=Xe(t._tail&&t._tail.array,0,n-t._origin,t._capacity-t._origin-1);this._stack=r?u:i,this._stack.__prev=r?i:u};zr.createClass($n,{next:function(){for(var t=this._stack;t;){var e=t.array,r=t.index++;if(this._reverse&&(r=Mr-r,r>t.rawMax&&(r=t.rawMax,t.index=qr-r)),r>=0&&qr>r&&t.rawMax>=r){var n=e&&e[r];if(0===t.level){var i,u=this._type;return 1!==u&&(i=t.offset+(r<<t.level),this._reverse&&(i=this._maxIndex-i)),I(u,i,n)}this._stack=t=Xe(n&&n.array,t.level-br,t.offset+(r<<t.level),t.max,t)}else t=this._stack=this._stack.__prev}return b()}},{},Vr);var ti,ei=function(t){return null===t||void 0===t?or():ur(t)?t:or().withMutations(function(e){tn(t).forEach(function(t,r){return e.set(r,t)})})};zr.createClass(ei,{toString:function(){return this.__toString("OrderedMap {","}")},get:function(t,e){var r=this._map.get(t);return void 0!==r?this._list.get(r)[1]:e},clear:function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this):or()},set:function(t,e){return ar(this,t,e)},remove:function(t){return ar(this,t,xr)},wasAltered:function(){return this._map.wasAltered()||this._list.wasAltered()},__iterate:function(t,e){var r=this;return this._list.__iterate(function(e){return e&&t(e[1],e[0],r)},e)},__iterator:function(t,e){return this._list.fromEntrySeq().__iterator(t,e)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t),r=this._list.__ensureOwner(t);return t?sr(e,r,t,this.__hash):(this.__ownerID=t,this._map=e,this._list=r,this)}},{of:function(){return this(arguments)}},Mn),ei.isOrderedMap=ur,ei.prototype[Zr]=!0,ei.prototype[Ir]=ei.prototype.remove;var ri,ni=function(t){return null===t||void 0===t?fr():hr(t)?t:fr().unshiftAll(t)},ii=ni;zr.createClass(ni,{toString:function(){return this.__toString("Stack [","]") <ide> },get:function(t,e){for(var r=this._head;r&&t--;)r=r.next;return r?r.value:e},peek:function(){return this._head&&this._head.value},push:function(){if(0===arguments.length)return this;for(var t=this.size+arguments.length,e=this._head,r=arguments.length-1;r>=0;r--)e={value:arguments[r],next:e};return this.__ownerID?(this.size=t,this._head=e,this.__hash=void 0,this.__altered=!0,this):cr(t,e)},pushAll:function(t){if(t=rn(t),0===t.size)return this;var e=this.size,r=this._head;return t.reverse().forEach(function(t){e++,r={value:t,next:r}}),this.__ownerID?(this.size=e,this._head=r,this.__hash=void 0,this.__altered=!0,this):cr(e,r)},pop:function(){return this.slice(1)},unshift:function(){return this.push.apply(this,arguments)},unshiftAll:function(t){return this.pushAll(t)},shift:function(){return this.pop.apply(this,arguments)},clear:function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):fr()},slice:function(t,e){if(l(t,e,this.size))return this;var r=v(t,this.size),n=p(e,this.size);if(n!==this.size)return zr.superCall(this,ii.prototype,"slice",[t,e]);for(var i=this.size-r,u=this._head;r--;)u=u.next;return this.__ownerID?(this.size=i,this._head=u,this.__hash=void 0,this.__altered=!0,this):cr(i,u)},__ensureOwner:function(t){return t===this.__ownerID?this:t?cr(this.size,this._head,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)},__iterate:function(t,e){if(e)return this.toSeq().cacheResult.__iterate(t,e);for(var r=0,n=this._head;n&&t(n.value,r++,this)!==!1;)n=n.next;return r},__iterator:function(t,e){if(e)return this.toSeq().cacheResult().__iterator(t,e);var r=0,n=this._head;return new Vr(function(){if(n){var e=n.value;return n=n.next,I(t,r++,e)}return b()})}},{of:function(){return this(arguments)}},zn),ni.isStack=hr;var ui="",si=ni.prototype;si[ui]=!0,si.withMutations=Dn.withMutations,si.asMutable=Dn.asMutable,si.asImmutable=Dn.asImmutable,si.wasAltered=Dn.wasAltered;var oi,ai=function(t){return null===t||void 0===t?pr():_r(t)?t:pr().withMutations(function(e){nn(t).forEach(function(t){return e.add(t) <del>})})};zr.createClass(ai,{toString:function(){return this.__toString("Set {","}")},has:function(t){return this._map.has(t)},add:function(t){return lr(this,this._map.set(t,!0))},remove:function(t){return lr(this,this._map.remove(t))},clear:function(){return lr(this,this._map.clear())},union:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return t=t.filter(function(t){return 0!==t.size}),0===t.length?this:0===this.size&&1===t.length?this.constructor(t[0]):this.withMutations(function(e){for(var r=0;t.length>r;r++)nn(t[r]).forEach(function(t){return e.add(t)})})},intersect:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];if(0===t.length)return this;t=t.map(function(t){return nn(t)});var r=this;return this.withMutations(function(e){r.forEach(function(r){t.every(function(t){return t.contains(r)})||e.remove(r)})})},subtract:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];if(0===t.length)return this;t=t.map(function(t){return nn(t)});var r=this;return this.withMutations(function(e){r.forEach(function(r){t.some(function(t){return t.contains(r)})&&e.remove(r)})})},merge:function(){return this.union.apply(this,arguments)},mergeWith:function(){for(var t=[],e=1;arguments.length>e;e++)t[e-1]=arguments[e];return this.union.apply(this,t)},sort:function(t){return _i(Le(this,t))},sortBy:function(t,e){return _i(Le(this,e,t))},wasAltered:function(){return this._map.wasAltered()},__iterate:function(t,e){var r=this;return this._map.__iterate(function(e,n){return t(n,n,r)},e)},__iterator:function(t,e){return this._map.map(function(t,e){return e}).__iterator(t,e)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t);return t?this.__make(e,t):(this.__ownerID=t,this._map=e,this)}},{of:function(){return this(arguments)},fromKeys:function(t){return this(tn(t).keySeq())}},bn),ai.isSet=_r;var hi="",ci=ai.prototype;ci[hi]=!0,ci[Ir]=ci.remove,ci.mergeDeep=ci.merge,ci.mergeDeepWith=ci.mergeWith,ci.withMutations=Dn.withMutations,ci.asMutable=Dn.asMutable,ci.asImmutable=Dn.asImmutable,ci.__empty=pr,ci.__make=vr; <add>})})};zr.createClass(ai,{toString:function(){return this.__toString("Set {","}")},has:function(t){return this._map.has(t)},add:function(t){return lr(this,this._map.set(t,!0))},remove:function(t){return lr(this,this._map.remove(t))},clear:function(){return lr(this,this._map.clear())},union:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t=t.filter(function(t){return 0!==t.size}),0===t.length?this:0===this.size&&1===t.length?this.constructor(t[0]):this.withMutations(function(e){for(var r=0;t.length>r;r++)nn(t[r]).forEach(function(t){return e.add(t)})})},intersect:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(0===t.length)return this;t=t.map(function(t){return nn(t)});var r=this;return this.withMutations(function(e){r.forEach(function(r){t.every(function(t){return t.contains(r)})||e.remove(r)})})},subtract:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(0===t.length)return this;t=t.map(function(t){return nn(t)});var r=this;return this.withMutations(function(e){r.forEach(function(r){t.some(function(t){return t.contains(r)})&&e.remove(r)})})},merge:function(){return this.union.apply(this,arguments)},mergeWith:function(){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];return this.union.apply(this,t)},sort:function(t){return _i(Le(this,t))},sortBy:function(t,e){return _i(Le(this,e,t))},wasAltered:function(){return this._map.wasAltered()},__iterate:function(t,e){var r=this;return this._map.__iterate(function(e,n){return t(n,n,r)},e)},__iterator:function(t,e){return this._map.map(function(t,e){return e}).__iterator(t,e)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t);return t?this.__make(e,t):(this.__ownerID=t,this._map=e,this)}},{of:function(){return this(arguments)},fromKeys:function(t){return this(tn(t).keySeq())}},bn),ai.isSet=_r;var hi="",ci=ai.prototype;ci[hi]=!0,ci[Ir]=ci.remove,ci.mergeDeep=ci.merge,ci.mergeDeepWith=ci.mergeWith,ci.withMutations=Dn.withMutations,ci.asMutable=Dn.asMutable,ci.asImmutable=Dn.asImmutable,ci.__empty=pr,ci.__make=vr; <ide> var fi,_i=function(t){return null===t||void 0===t?gr():dr(t)?t:gr().withMutations(function(e){nn(t).forEach(function(t){return e.add(t)})})};zr.createClass(_i,{toString:function(){return this.__toString("OrderedSet {","}")}},{of:function(){return this(arguments)},fromKeys:function(t){return this(tn(t).keySeq())}},ai),_i.isOrderedSet=dr;var li=_i.prototype;li[Zr]=!0,li.__empty=gr,li.__make=yr;var vi,pi=function(t,e){var r=function(t){return this instanceof r?void(this._map=Mn(t)):new r(t)},n=Object.keys(t),u=r.prototype=Object.create(di);u.constructor=r,e&&(u._name=e),u._defaultValues=t,u._keys=n,u.size=n.length;try{n.forEach(function(t){Object.defineProperty(r.prototype,t,{get:function(){return this.get(t)},set:function(e){i(this.__ownerID,"Cannot set on an immutable record."),this.set(t,e)}})})}catch(s){}return r};zr.createClass(pi,{toString:function(){return this.__toString(wr(this)+" {","}")},has:function(t){return this._defaultValues.hasOwnProperty(t)},get:function(t,e){if(!this.has(t))return e;var r=this._defaultValues[t];return this._map?this._map.get(t,r):r},clear:function(){if(this.__ownerID)return this._map&&this._map.clear(),this;var t=Object.getPrototypeOf(this).constructor;return t._empty||(t._empty=mr(this,ae()))},set:function(t,e){if(!this.has(t))throw Error('Cannot set unknown key "'+t+'" on '+wr(this));var r=this._map&&this._map.set(t,e);return this.__ownerID||r===this._map?this:mr(this,r)},remove:function(t){if(!this.has(t))return this;var e=this._map&&this._map.remove(t);return this.__ownerID||e===this._map?this:mr(this,e)},wasAltered:function(){return this._map.wasAltered()},__iterator:function(t,e){var r=this;return tn(this._defaultValues).map(function(t,e){return r.get(e)}).__iterator(t,e)},__iterate:function(t,e){var r=this;return tn(this._defaultValues).map(function(t,e){return r.get(e)}).__iterate(t,e)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t);return t?mr(this,e,t):(this.__ownerID=t,this._map=e,this)}},{},wn);var di=pi.prototype; <del>di[Ir]=di.remove,di.merge=Dn.merge,di.mergeWith=Dn.mergeWith,di.mergeIn=Dn.mergeIn,di.mergeDeep=Dn.mergeDeep,di.mergeDeepWith=Dn.mergeDeepWith,di.mergeDeepIn=Dn.mergeDeepIn,di.setIn=Dn.setIn,di.update=Dn.update,di.updateIn=Dn.updateIn,di.withMutations=Dn.withMutations,di.asMutable=Dn.asMutable,di.asImmutable=Dn.asImmutable;var yi=function(t,e,r){return this instanceof gi?(i(0!==r,"Cannot step a Range by 0"),t=t||0,void 0===e&&(e=1/0),t===e&&wi?wi:(r=void 0===r?1:Math.abs(r),t>e&&(r=-r),this._start=t,this._end=e,this._step=r,void(this.size=Math.max(0,Math.ceil((e-t)/r-1)+1)))):new gi(t,e,r)},gi=yi;zr.createClass(yi,{toString:function(){return 0===this.size?"Range []":"Range [ "+this._start+"..."+this._end+(this._step>1?" by "+this._step:"")+" ]"},get:function(t,e){return this.has(t)?this._start+f(this,t)*this._step:e},contains:function(t){var e=(t-this._start)/this._step;return e>=0&&this.size>e&&e===Math.floor(e)},slice:function(t,e){return l(t,e,this.size)?this:(t=v(t,this.size),e=p(e,this.size),t>=e?wi:new gi(this.get(t,this._end),this.get(e,this._end),this._step))},indexOf:function(t){var e=t-this._start;if(e%this._step===0){var r=e/this._step;if(r>=0&&this.size>r)return r}return-1},lastIndexOf:function(t){return this.indexOf(t)},take:function(t){return this.slice(0,Math.max(0,t))},skip:function(t){return this.slice(Math.max(0,t))},__iterate:function(t,e){for(var r=this.size-1,n=this._step,i=e?this._start+r*n:this._start,u=0;r>=u;u++){if(t(i,u,this)===!1)return u+1;i+=e?-n:n}return u},__iterator:function(t,e){var r=this.size-1,n=this._step,i=e?this._start+r*n:this._start,u=0;return new Vr(function(){var s=i;return i+=e?-n:n,u>r?b():I(t,u++,s)})},equals:function(t){return t instanceof gi?this._start===t._start&&this._end===t._end&&this._step===t._step:B(this,t)}},{},hn);var mi=yi.prototype;mi.__toJS=mi.toArray,mi.first=Fn.first,mi.last=Fn.last;var wi=yi(0,0),Si=function(t,e){return 0>=e&&bi?bi:this instanceof zi?(this._value=t,this.size=void 0===e?1/0:Math.max(0,e),void(0===this.size&&(bi=this))):new zi(t,e)},zi=Si; <del>zr.createClass(Si,{toString:function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},get:function(t,e){return this.has(t)?this._value:e},contains:function(t){return n(this._value,t)},slice:function(t,e){var r=this.size;return l(t,e,r)?this:new zi(this._value,p(e,r)-v(t,r))},reverse:function(){return this},indexOf:function(t){return n(this._value,t)?0:-1},lastIndexOf:function(t){return n(this._value,t)?this.size:-1},__iterate:function(t){for(var e=0;this.size>e;e++)if(t(this._value,e,this)===!1)return e+1;return e},__iterator:function(t){var e=this,r=0;return new Vr(function(){return e.size>r?I(t,r++,e._value):b()})},equals:function(t){return t instanceof zi?n(this._value,t._value):B(t)}},{},hn);var Ii=Si.prototype;Ii.last=Ii.first,Ii.has=mi.has,Ii.take=mi.take,Ii.skip=mi.skip,Ii.__toJS=mi.__toJS;var bi,qi={Iterable:Yr,Seq:un,Collection:mn,Map:Mn,OrderedMap:ei,List:Qn,Stack:ni,Set:ai,OrderedSet:_i,Record:pi,Range:yi,Repeat:Si,is:n,fromJS:te};return qi}"object"==typeof exports?module.exports=t():"function"==typeof define&&define.amd?define(t):Immutable=t(); <ide>\ No newline at end of file <add>di[Ir]=di.remove,di.removeIn=Dn.removeIn,di.merge=Dn.merge,di.mergeWith=Dn.mergeWith,di.mergeIn=Dn.mergeIn,di.mergeDeep=Dn.mergeDeep,di.mergeDeepWith=Dn.mergeDeepWith,di.mergeDeepIn=Dn.mergeDeepIn,di.setIn=Dn.setIn,di.update=Dn.update,di.updateIn=Dn.updateIn,di.withMutations=Dn.withMutations,di.asMutable=Dn.asMutable,di.asImmutable=Dn.asImmutable;var yi=function(t,e,r){return this instanceof gi?(i(0!==r,"Cannot step a Range by 0"),t=t||0,void 0===e&&(e=1/0),t===e&&wi?wi:(r=void 0===r?1:Math.abs(r),t>e&&(r=-r),this._start=t,this._end=e,this._step=r,void(this.size=Math.max(0,Math.ceil((e-t)/r-1)+1)))):new gi(t,e,r)},gi=yi;zr.createClass(yi,{toString:function(){return 0===this.size?"Range []":"Range [ "+this._start+"..."+this._end+(this._step>1?" by "+this._step:"")+" ]"},get:function(t,e){return this.has(t)?this._start+f(this,t)*this._step:e},contains:function(t){var e=(t-this._start)/this._step;return e>=0&&this.size>e&&e===Math.floor(e)},slice:function(t,e){return l(t,e,this.size)?this:(t=v(t,this.size),e=p(e,this.size),t>=e?wi:new gi(this.get(t,this._end),this.get(e,this._end),this._step))},indexOf:function(t){var e=t-this._start;if(e%this._step===0){var r=e/this._step;if(r>=0&&this.size>r)return r}return-1},lastIndexOf:function(t){return this.indexOf(t)},take:function(t){return this.slice(0,Math.max(0,t))},skip:function(t){return this.slice(Math.max(0,t))},__iterate:function(t,e){for(var r=this.size-1,n=this._step,i=e?this._start+r*n:this._start,u=0;r>=u;u++){if(t(i,u,this)===!1)return u+1;i+=e?-n:n}return u},__iterator:function(t,e){var r=this.size-1,n=this._step,i=e?this._start+r*n:this._start,u=0;return new Vr(function(){var s=i;return i+=e?-n:n,u>r?b():I(t,u++,s)})},equals:function(t){return t instanceof gi?this._start===t._start&&this._end===t._end&&this._step===t._step:B(this,t)}},{},hn);var mi=yi.prototype;mi.__toJS=mi.toArray,mi.first=Fn.first,mi.last=Fn.last;var wi=yi(0,0),Si=function(t,e){return 0>=e&&bi?bi:this instanceof zi?(this._value=t,this.size=void 0===e?1/0:Math.max(0,e),void(0===this.size&&(bi=this))):new zi(t,e) <add>},zi=Si;zr.createClass(Si,{toString:function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},get:function(t,e){return this.has(t)?this._value:e},contains:function(t){return n(this._value,t)},slice:function(t,e){var r=this.size;return l(t,e,r)?this:new zi(this._value,p(e,r)-v(t,r))},reverse:function(){return this},indexOf:function(t){return n(this._value,t)?0:-1},lastIndexOf:function(t){return n(this._value,t)?this.size:-1},__iterate:function(t){for(var e=0;this.size>e;e++)if(t(this._value,e,this)===!1)return e+1;return e},__iterator:function(t){var e=this,r=0;return new Vr(function(){return e.size>r?I(t,r++,e._value):b()})},equals:function(t){return t instanceof zi?n(this._value,t._value):B(t)}},{},hn);var Ii=Si.prototype;Ii.last=Ii.first,Ii.has=mi.has,Ii.take=mi.take,Ii.skip=mi.skip,Ii.__toJS=mi.__toJS;var bi,qi={Iterable:Yr,Seq:un,Collection:mn,Map:Mn,OrderedMap:ei,List:Qn,Stack:ni,Set:ai,OrderedSet:_i,Record:pi,Range:yi,Repeat:Si,is:n,fromJS:te};return qi}"object"==typeof exports?module.exports=t():"function"==typeof define&&define.amd?define(t):Immutable=t(); <ide>\ No newline at end of file <ide><path>src/Record.js <ide> class Record extends KeyedCollection { <ide> <ide> var RecordPrototype = Record.prototype; <ide> RecordPrototype[DELETE] = RecordPrototype.remove; <add>RecordPrototype.removeIn = MapPrototype.removeIn; <ide> RecordPrototype.merge = MapPrototype.merge; <ide> RecordPrototype.mergeWith = MapPrototype.mergeWith; <ide> RecordPrototype.mergeIn = MapPrototype.mergeIn;
3
Text
Text
add documentation for optimizers
dc5482ae4691c95358574bebb410dee499326435
<ide><path>docs/sources/optimizers.md <ide> # Optimizers <ide> <add>## Usage of optimizers <add> <add>An optimizer is one of the two arguments required for compiling a Keras model: <add> <add>```python <add>model = Sequential() <add>model.add(Dense(20, 64, init='uniform')) <add>model.add(Activation('tanh')) <add>model.add(Activation('softmax')) <add> <add>sgd = SGD(lr=0.1, decay=1e-6, momentum=0.9, nesterov=True) <add>model.compile(loss='mean_squared_error', optimizer=sgd) <add>``` <add> <add>You can either instantiate an optimizer before passing it to `model.compile()` , as in the above example, or you can call it by its name. In the latter case, the default parameters for the optimizer will be used. <add> <add>```python <add># pass optimizer by name: default parameters will be used <add>model.compile(loss='mean_squared_error', optimizer='sgd') <add>``` <add> <ide> ## Base class <ide> <del>Optimizer <add>`keras.optimizers.Optimizer(**kwargs)` [[source](https://github.com/fchollet/keras/blob/master/keras/optimizers.py)] <add> <add>All optimizers descended from this class support the following keyword arguments: <ide> <del>All optimizers descending from this class support the following keyword arguments: <del>- l1 <del>- l2 <del>- clipnorm <del>- maxnorm <add>- __l1__: float >= 0. L1 regularization penalty. <add>- __l2__: float >= 0. L2 regularization penalty. <add>- __clipnorm__: float >= 0. <add>- __maxnorm__: float >= 0. <add> <add>Note: this is base class for building optimizers, not an actual optimizer that can be used for training models. <ide> <ide> ## SGD <ide> <del>SGD(lr=0.01, momentum=0., decay=0., nesterov=False) <add>`keras.optimizers.SGD(lr=0.01, momentum=0., decay=0., nesterov=False)` [[source](https://github.com/fchollet/keras/blob/master/keras/optimizers.py)] <add> <add>- __lr__: float >= 0. Learning rate. <add>- __momentum__: float >= 0. Parameter updates momentum. <add>- __decay__: float >= 0. Learning rate decay over each update. <add>- __nesterov__: boolean. Whether to apply Nesterov momentum. <ide> <ide> ## Adagrad <ide> <del>Adagrad(lr=0.01, epsilon=1e-6) <add>`keras.optimizers.Adagrad(lr=0.01, epsilon=1e-6)` [[source](https://github.com/fchollet/keras/blob/master/keras/optimizers.py)] <add> <add>It is recommended to leave the parameters of this optimizer at their default value. <add> <add>- __lr__: float >= 0. Learning rate. <add>- __epsilon__: float >= 0. <add> <ide> <ide> ## Adadelta <ide> <del>Adadelta(lr=1.0, rho=0.95, epsilon=1e-6) <add>`keras.optimizers.Adadelta(lr=1.0, rho=0.95, epsilon=1e-6)` [[source](https://github.com/fchollet/keras/blob/master/keras/optimizers.py)] <add> <add>It is recommended to leave the parameters of this optimizer at their default value. <add> <add>- __lr__: float >= 0. Learning rate. It is recommended to leave it at the default value. <add>- __rho__: float >= 0. <add>- __epsilon__: float >= 0. Fuzz factor. <add> <add>For more info, see *"Adadelta: an adaptive learning rate method"* by Matthew Zeiler. <ide> <ide> ## RMSprop <ide> <del>RMSprop(lr=0.001, rho=0.9, epsilon=1e-6) <ide>\ No newline at end of file <add>`keras.optimizers.RMSprop(lr=0.001, rho=0.9, epsilon=1e-6)` [[source](https://github.com/fchollet/keras/blob/master/keras/optimizers.py)] <add> <add>It is recommended to leave the parameters of this optimizer at their default value. <add> <add>- __lr__: float >= 0. Learning rate. <add>- __rho__: float >= 0. <add>- __epsilon__: float >= 0. Fuzz factor. <ide>\ No newline at end of file
1
Javascript
Javascript
add option to test-benchmark-timers
862a22ab490818909f5dc448e1805bc846c8c6d0
<ide><path>test/parallel/test-benchmark-timers.js <ide> const runBenchmark = require('../common/benchmark'); <ide> <ide> runBenchmark('timers', <ide> [ <add> 'direction=start', <add> 'n=1', <ide> 'type=depth', <del> 'n=1' <ide> ], <ide> { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
1
Go
Go
move the assertions outside of the goroutine
bb161b7789cf74541892282f18a4814ead4a34d2
<ide><path>integration-cli/docker_api_exec_resize_test.go <ide> import ( <ide> "io" <ide> "net/http" <ide> "strings" <add> "sync" <ide> <ide> "github.com/go-check/check" <ide> ) <ide> func (s *DockerSuite) TestExecResizeImmediatelyAfterExecStart(c *check.C) { <ide> name := "exec_resize_test" <ide> dockerCmd(c, "run", "-d", "-i", "-t", "--name", name, "--restart", "always", "busybox", "/bin/sh") <ide> <del> // The panic happens when daemon.ContainerExecStart is called but the <del> // container.Exec is not called. <del> // Because the panic is not 100% reproducible, we send the requests concurrently <del> // to increase the probability that the problem is triggered. <del> n := 10 <del> ch := make(chan struct{}) <del> for i := 0; i < n; i++ { <del> go func() { <del> defer func() { <del> ch <- struct{}{} <del> }() <add> testExecResize := func() error { <add> data := map[string]interface{}{ <add> "AttachStdin": true, <add> "Cmd": []string{"/bin/sh"}, <add> } <add> uri := fmt.Sprintf("/containers/%s/exec", name) <add> status, body, err := sockRequest("POST", uri, data) <add> if err != nil { <add> return err <add> } <add> if status != http.StatusCreated { <add> return fmt.Errorf("POST %s is expected to return %d, got %d", uri, http.StatusCreated, status) <add> } <ide> <del> data := map[string]interface{}{ <del> "AttachStdin": true, <del> "Cmd": []string{"/bin/sh"}, <del> } <del> status, body, err := sockRequest("POST", fmt.Sprintf("/containers/%s/exec", name), data) <del> c.Assert(err, check.IsNil) <del> c.Assert(status, check.Equals, http.StatusCreated) <add> out := map[string]string{} <add> err = json.Unmarshal(body, &out) <add> if err != nil { <add> return fmt.Errorf("ExecCreate returned invalid json. Error: %q", err.Error()) <add> } <ide> <del> out := map[string]string{} <del> err = json.Unmarshal(body, &out) <del> c.Assert(err, check.IsNil) <add> execID := out["Id"] <add> if len(execID) < 1 { <add> return fmt.Errorf("ExecCreate got invalid execID") <add> } <ide> <del> execID := out["Id"] <del> if len(execID) < 1 { <del> c.Fatal("ExecCreate got invalid execID") <del> } <add> payload := bytes.NewBufferString(`{"Tty":true}`) <add> conn, _, err := sockRequestHijack("POST", fmt.Sprintf("/exec/%s/start", execID), payload, "application/json") <add> if err != nil { <add> return fmt.Errorf("Failed to start the exec: %q", err.Error()) <add> } <add> defer conn.Close() <ide> <del> payload := bytes.NewBufferString(`{"Tty":true}`) <del> conn, _, err := sockRequestHijack("POST", fmt.Sprintf("/exec/%s/start", execID), payload, "application/json") <del> c.Assert(err, check.IsNil) <del> defer conn.Close() <add> _, rc, err := sockRequestRaw("POST", fmt.Sprintf("/exec/%s/resize?h=24&w=80", execID), nil, "text/plain") <add> // It's probably a panic of the daemon if io.ErrUnexpectedEOF is returned. <add> if err == io.ErrUnexpectedEOF { <add> return fmt.Errorf("The daemon might have crashed.") <add> } <ide> <del> _, rc, err := sockRequestRaw("POST", fmt.Sprintf("/exec/%s/resize?h=24&w=80", execID), nil, "text/plain") <del> // It's probably a panic of the daemon if io.ErrUnexpectedEOF is returned. <del> if err == io.ErrUnexpectedEOF { <del> c.Fatal("The daemon might have crashed.") <del> } <add> if err == nil { <add> rc.Close() <add> } <ide> <del> if err == nil { <del> rc.Close() <add> // We only interested in the io.ErrUnexpectedEOF error, so we return nil otherwise. <add> return nil <add> } <add> <add> // The panic happens when daemon.ContainerExecStart is called but the <add> // container.Exec is not called. <add> // Because the panic is not 100% reproducible, we send the requests concurrently <add> // to increase the probability that the problem is triggered. <add> var ( <add> n = 10 <add> ch = make(chan error, n) <add> wg sync.WaitGroup <add> ) <add> for i := 0; i < n; i++ { <add> wg.Add(1) <add> go func() { <add> defer wg.Done() <add> if err := testExecResize(); err != nil { <add> ch <- err <ide> } <ide> }() <ide> } <ide> <del> for i := 0; i < n; i++ { <del> <-ch <add> wg.Wait() <add> select { <add> case err := <-ch: <add> c.Fatal(err.Error()) <add> default: <ide> } <ide> }
1
Ruby
Ruby
fix bug in `brew list --pinned`
776c08490fdc6451e8c53e33cd22756d4f0477ed
<ide><path>Library/Homebrew/cmd/list.rb <ide> def list_pinned <ide> else <ide> ARGV.named.map{ |n| HOMEBREW_CELLAR+n }.select{ |pn| pn.exist? } <ide> end.select do |d| <del> (HOMEBREW_LIBRARY/"PinnedKegs"/d.basename.to_s).exist? <add> keg_pin = (HOMEBREW_LIBRARY/"PinnedKegs"/d.basename.to_s) <add> keg_pin.exist? or keg_pin.symlink? <ide> end.each do |d| <ide> puts d.basename <ide> end
1
Text
Text
improve readme, functional api guide
263de77a5a19c05f6108fcbf7e3499f51bf234b6
<ide><path>README.md <ide> Keras is compatible with: __Python 2.7-3.5__. <ide> <ide> ## Getting started: 30 seconds to Keras <ide> <del>The core data structure of Keras is a __model__, a way to organize layers. There are two types of models: [`Sequential`](http://keras.io/models/#sequential) and [`Graph`](http://keras.io/models/#graph). <add>The core data structure of Keras is a __model__, a way to organize layers. The main type of model is the [`Sequential`](http://keras.io/models/#sequential) model, a linear stack of layers. For more complex architectures, you should use the [Keras function API](). <ide> <del>Here's the `Sequential` model (a linear pile of layers): <add>Here's the `Sequential` model: <ide> <ide> ```python <ide> from keras.models import Sequential <ide> Stacking layers is as easy as `.add()`: <ide> ```python <ide> from keras.layers.core import Dense, Activation <ide> <del>model.add(Dense(output_dim=64, input_dim=100, init="glorot_uniform")) <add>model.add(Dense(output_dim=64, input_dim=100)) <ide> model.add(Activation("relu")) <del>model.add(Dense(output_dim=10, init="glorot_uniform")) <add>model.add(Dense(output_dim=10)) <ide> model.add(Activation("softmax")) <ide> ``` <ide> <ide> Once your model looks good, configure its learning process with `.compile()`: <ide> ```python <del>model.compile(loss='categorical_crossentropy', optimizer='sgd') <add>model.compile(loss='categorical_crossentropy', optimizer='sgd', metrics=['accuracy']) <ide> ``` <ide> <ide> If you need to, you can further configure your optimizer. A core principle of Keras is to make things reasonably simple, while allowing the user to be fully in control when they need to (the ultimate control being the easy extensibility of the source code). <ide> proba = model.predict_proba(X_test, batch_size=32) <ide> <ide> Building a network of LSTMs, a deep CNN, a Neural Turing Machine, a word2vec embedder or any other model is just as fast. The ideas behind deep learning are simple, so why should their implementation be painful? <ide> <del>Have a look at these [starter examples](http://keras.io/examples/). <add>For a more in-depth tutorial about Keras, you can check out: <ide> <del>In the [examples folder](https://github.com/fchollet/keras/tree/master/examples) of the repo, you will find more advanced models: question-answering with memory networks, text generation with stacked LSTMs, neural turing machines, etc. <add>- [Getting started with the Sequential model]() <add>- [Getting started with the functional API]() <add>- [Starter examples]() <add> <add>In the [examples folder](https://github.com/fchollet/keras/tree/master/examples) of the repository, you will find more advanced models: question-answering with memory networks, text generation with stacked LSTMs, etc. <ide> <ide> <ide> ------------------ <ide><path>docs/templates/getting-started/complete_guide_to_the_keras_functional_api.md <ide> processed_sequences = TimeDistributed(model)(input_sequences) <ide> <ide> Here's a good use case for the functional API: models with multiple inputs and outputs. The functional API makes it really easy to manipulate a large number of intertwinned datastreams. <ide> <del>Let's consider a model for question-answering. The model learns a "relevance" embedding space where questions and their answers will be embedded at close positions. This embedding will allow us to quickly query a database of answers to find those that are relevant to a new question, based on the distances between the new question and stored answers. <add>Let's consider the following model. We seek to predict how many retweets and likes a news headline will receive on Twitter. The main input to the model will be the headline itself, as a sequence of words, but to spice things up, our model will also have an auxiliary input, receiving extra data such as the time of day when the headline was posted, etc. <add>The model will also be supervised via two loss functions. Using the main loss function earlier in a model is a good regularization mechanism for deep models. <ide> <del>The model has three input branches: an embedding for the question, and two embeddings for two different answers, a relevant answer and an unrelated answer. We'll train the model with a triplet loss, teaching the model to maximize the dot product (i.e. cosine distance) between the question embedding and the embedding for the relevant answer, while minimizing the dot product between the question and the irrelevant answer. <add>Here's how our model looks like: <ide> <ide> [model graph] <ide> <del>Implementing this with the functional API is quick and simple: <add>Let's implement it with the functional API. <ide> <ide> ```python <del>from keras.layers import Input, Embedding, LSTM, merge, Lambda <del> <del># an input question will be a vector of 100 integers, <del># each being the index of a word in a vocabulary <del>question_input = Input(shape=(100,), dtype='int32') <del> <del>good_answer_input = Input(shape=(100,), dtype='int32') <del>bad_answer_input = Input(shape=(100,), dtype='int32') <del> <del>embedded_question = Embedding(output_dim=1024)(question_input) <del>encoded_question = LSTM(512)(embedded_question) <del> <del># the two layers below will be shared across the two answer inputs. <del># we'll go over shared layers in detail in the next section. <del>answer_embedding = Embedding(output_dim=1024) <del>answer_lstm = LSTM(512) <del> <del>embedded_good_answer = answer_embedding(good_answer_input) <del>encoded_good_answer = answer_lstm(embedded_good_answer) <del> <del>embedded_bad_answer = answer_embedding(bad_answer_input) <del>encoded_bad_answer = answer_lstm(embedded_bad_answer) <add>from keras.layers import Input, Embedding, LSTM, Dense, merge <add>from keras.models import Model <ide> <del># let's take the dot product between the question embedding <del># and the embedding of the answers <del>good_answer_score = merge([encoded_question, encoded_good_answer], mode='dot') <del>bad_answer_score = merge([encoded_question, encoded_bad_answer], mode='dot') <add># the main input will receive the headline, <add># as a sequence of integers (each integer encodes a word). <add># The integers will be between 1 and 10000 (a vocabuary of 10000 words) <add># and the sequences will be 100 words long. <add># Note that we can name any layer by passing it a "name" argument. <add>main_input = Input(shape=(10,), dtype='int32', name='main_input') <add># this embedding layer will encode the input sequence <add># into a sequence of dense 512-dimensional vectors <add>x = Embedding(output_dim=512, input_dim=10000, input_length=10)(main_input) <add># a LSTM will transform the vector sequence into a single vector, <add># containing information about the entire sequence <add>lstm_out = LSTM(32)(x) <add># here we insert the auxiliary loss, allowing the LSTM and Embedding layer <add># to be trained smoothly even the main loss will be much higher in the model <add>auxiliary_loss = Dense(1, activation='sigmoid', name='aux_output')(lstm_out) <add> <add># at this point we feed into the model our auxiliary input data <add># by concatenating it with the LSTM output <add>auxiliary_input = Input(shape=(5,), name='aux_input') <add>x = merge([lstm_out, auxiliary_input], mode='concat') <add># we stack a deep fully-connected network on top <add>x = Dense(64, activation='relu')(x) <add>x = Dense(64, activation='relu')(x) <add>x = Dense(64, activation='relu')(x) <add># and finally we add the main logistic regression layer <add>main_loss = Dense(1, activation='sigmoid', name='main_output')(x) <ide> <del># this is a lambda layer. It allows you to create <del># simple stateless layers on the fly to take care of basic operations. <del># Note how the layer below has multiple inputs. Also, here we are using <del># a function from `keras.backend` that squares the error. <del>output = Lambda(lambda x, y: K.square(x - y))([good_answer_score, bad_answer_score]) <del>``` <add># this defines a model with two inputs and two outputs <add>model = Model(input=[main_input, auxiliary_input], output=[main_loss, auxiliary_loss]) <ide> <del>Now let's say that we want our model to return not only the final output, but also each of the two previous scores (so you can apply auxilliary loss functions to them). <del>You can define the following model: <add># we compile the model and assign a weight of 0.2 to the auxiliary loss. <add># to specify `loss_weight` or `loss`, you can use a list or a dictionary. <add># here we pass a single loss so the same loss will be used on all outputs. <add>model.compile(optimizer='rmsprop', loss='binary_crossentropy', <add> loss_weight=[1., 0.2]) <ide> <del>```python <del>model = Model(input=[question_input, good_answer_input, bad_answer_input], <del> output=[output, good_answer_score, bad_answer_score]) <del>model.compile(optimizer='rmsprop', loss=[custom_loss_1, custom_loss_2, custom_loss_3]) <del>model.fit([q_data, good_ans_data, bad_ans_data], [custom_target_1, custom_target_2, custom_target_3]) <del>``` <add>headline_data = np.random.randint(5000, size=(20, 10)) <add>additional_data = np.random.random((20, 5)) <add>labels = np.random.randint(2, size=(20, 1)) <ide> <del>You can also define a separate model that just embeds a single question, using the same layers as trained with the model above: <del>```python <del>question_embedder = Model(input=question_input, output=encoded_question) <del>embedded_qs = question_embedder.predict(q_data) <del>``` <add># we can train the model by passing it lists of input arrays and target arrays: <add>model.fit([headline_data, additional_data], [labels, labels], <add> nb_epoch=50, batch_size=32) <ide> <del>And one that can embed any answer: <del>```python <del>answer_embedder = Model(input=good_answer_input, output=encoded_good_answer) <del>embedded_ans = answer_embedder.predict(ans_data) <add># since our inputs and outputs are named (we passed them a "name" argument), <add># we could also have compiled the model via: <add>model.compile(optimizer='rmsprop', <add> loss={'main_output': 'binary_crossentropy', 'aux_output': 'binary_crossentropy'}, <add> loss_weight={'main_output': 1., 'aux_output': 0.2}) <add># and trained it via: <add>model.fit({'main_input': headline_data, 'aux_input': additional_data}, <add> {'main_output': labels, 'aux_output': labels}, <add> nb_epoch=50, batch_size=32) <ide> ``` <ide> <del>Great! Now if you have some training data, you got yourself a question/answer matching model. <del> <ide> ## Shared layers <ide> <ide> Another good use for the functional API are models that use shared layers. Let's take a look at shared layers. <ide> Simple enough, right? <ide> The same is true for the properties `input_shape` and `output_shape`: as long as the layer has only one node, or as long as all nodes have the same input/output shape, then the notion of "layer output/input shape" is well defined, and that one shape will be returned by `layer.output_shape`/`layer.input_shape`. But if, for instance, you apply a same `Convolution2D` layer to an input of shape (3, 32, 32) then to an input of shape `(3, 64, 64)`, the layer will have multiple input/output shapes, and you will have to fetch them via the index of the node they belong to: <ide> <ide> ```python <del>from keras.layers import merge, Convolution2D <del> <ide> a = Input(shape=(3, 32, 32)) <ide> b = Input(shape=(3, 64, 64)) <ide> <ide> Code examples are still the best way to get started, so here are a few more. <ide> For more information about the Inception architecture, see [Going Deeper with Convolutions](http://arxiv.org/abs/1409.4842). <ide> <ide> ```python <add>from keras.layers import merge, Convolution2D, MaxPooling2D, Input <add> <ide> input_img = Input(shape=(3, 256, 256)) <ide> <ide> tower_1 = Convolution2D(64, 1, 1, border_mode='same', activation='relu')(input_img) <ide> z = merge([x, y], mode='sum') <ide> This model re-uses the same image-processing module on two inputs, to classify whether two MNIST digits are the same digit or different digits. <ide> <ide> ```python <add>from keras.layers import merge, Convolution2D, MaxPooling2D, Input, Dense, Flatten <add>from keras.models import Model <ide> <ide> # first, define the vision modules <ide> digit_input = Input(shape=(1, 27, 27)) <add>x = Convolution2D(64, 3, 3)(digit_input) <ide> x = Convolution2D(64, 3, 3)(x) <del>x = Convolution2D(64, 3, 3)(x) <del>out = MaxPooling2D((2, 2))(x) <add>x = MaxPooling2D((2, 2))(x) <add>out = Flatten()(x) <ide> <ide> vision_model = Model(digit_input, out) <ide> <ide> This model can select the correct one-word answer when asked a natural-language <ide> It works by encoding the question into a vector, encoding the image into a vector, concatenating the two, and training on top a logistic regression over some vocabulary of potential answers. <ide> <ide> ```python <del>[TODO] <add>from keras.layers import Convolution2D, MaxPooling2D, Flatten <add>from keras.layers import Input, LSTM, Embedding, Dense, merge <add>from keras.models import Model, Sequential <add> <add># first, let's define a vision model using a Sequential model. <add># this model will encode an image into a vector. <add>vision_model = Sequential() <add>vision_model.add(Convolution2D(64, 3, 3, activation='relu', border_mode='same', input_shape=(3, 224, 224))) <add>vision_model.add(Convolution2D(64, 3, 3, activation='relu')) <add>vision_model.add(MaxPooling2D((2, 2))) <add>vision_model.add(Convolution2D(128, 3, 3, activation='relu', border_mode='same')) <add>vision_model.add(Convolution2D(128, 3, 3, activation='relu')) <add>vision_model.add(MaxPooling2D((2, 2))) <add>vision_model.add(Convolution2D(256, 3, 3, activation='relu', border_mode='same')) <add>vision_model.add(Convolution2D(256, 3, 3, activation='relu')) <add>vision_model.add(Convolution2D(256, 3, 3, activation='relu')) <add>vision_model.add(MaxPooling2D((2, 2))) <add>vision_model.add(Flatten()) <add> <add># now let's get a tensor with the output of our vision model: <add>image_input = Input(shape=(3, 224, 224)) <add>encoded_image = vision_model(image_input) <add> <add># next, let's define a language model to encode the question into a vector. <add># each question will be at most 100 word long, <add># and we will index words as integers from 1 to 9999. <add>question_input = Input(shape=(100,), dtype='int32') <add>embedded_question = Embedding(input_dim=10000, output_dim=256, input_length=100)(question_input) <add>encoded_question = LSTM(256)(embedded_question) <add> <add># let's concatenate the question vector and the image vector: <add>merged = merge([encoded_question, encoded_image], mode='concat') <add> <add># and let's train a logistic regression over 1000 words on top: <add>output = Dense(1000, activation='softmax')(merged) <add> <add># this is our final model: <add>vqa_model = Model(input=[image_input, question_input], output=output) <add> <add># the next stage would be training this model on actual data. <ide> ``` <ide> <ide> ### Video question answering model. <ide> <ide> Now that we have trained our image QA model, we can quickly turn it into a video QA model. With appropriate training, you will be able to show it a short video (e.g. 100-frame human action) and ask a natural language question about the video (e.g. "what sport is the boy playing?" -> "footbal"). <ide> <ide> ```python <del>[TODO] <add>from keras.layers import TimeDistributed <add> <add>video_input = Input(shape=(100, 3, 224, 224)) <add># this is our video encoded via the previously trained vision_model (weights are reused) <add>encoded_frame_sequence = TimeDistributed(vision_model)(video_input) # the output will be a sequence of vectors <add>encoded_video = LSTM(256)(encoded_frame_sequence) # the output will be a vector <add> <add># this is a model-level representation of the question encoder, reusing the same weights as before: <add>question_encoder = Model(input=question_input, output=encoded_question) <add> <add># let's use it to encode the question: <add>video_question_input = Input(shape=(100,), dtype='int32') <add>encoded_video_question = question_encoder(video_question_input) <add> <add># and this is our video question answering model: <add>merged = merge([encoded_video, encoded_video_question], mode='concat') <add>output = Dense(1000, activation='softmax')(merged) <add>video_qa_model = Model(input=[video_input, video_question_input], output=output) <ide> ```
2
Go
Go
fix call to nil stat
811b138f7e6c742b821da15e34338651f33f9ec2
<ide><path>daemon/start.go <ide> func (daemon *Daemon) setHostConfig(container *Container, hostConfig *runconfig. <ide> if err := parseSecurityOpt(container, hostConfig); err != nil { <ide> return err <ide> } <add> <add> // FIXME: this should be handled by the volume subsystem <ide> // Validate the HostConfig binds. Make sure that: <ide> // the source exists <ide> for _, bind := range hostConfig.Binds { <ide><path>volumes/volume.go <ide> func (v *Volume) AddContainer(containerId string) { <ide> v.lock.Unlock() <ide> } <ide> <del>func (v *Volume) createIfNotExist() error { <del> if stat, err := os.Stat(v.Path); err != nil && os.IsNotExist(err) { <del> if stat.IsDir() { <del> os.MkdirAll(v.Path, 0755) <del> } <del> <del> if err := os.MkdirAll(filepath.Dir(v.Path), 0755); err != nil { <del> return err <del> } <del> f, err := os.OpenFile(v.Path, os.O_CREATE, 0755) <del> if err != nil { <del> return err <del> } <del> f.Close() <del> } <del> return nil <del>} <del> <ide> func (v *Volume) initialize() error { <ide> v.lock.Lock() <ide> defer v.lock.Unlock() <ide> <del> if err := v.createIfNotExist(); err != nil { <del> return err <add> if _, err := os.Stat(v.Path); err != nil && os.IsNotExist(err) { <add> if err := os.MkdirAll(v.Path, 0755); err != nil { <add> return err <add> } <ide> } <ide> <ide> if err := os.MkdirAll(v.configPath, 0755); err != nil { <ide> func (v *Volume) ToDisk() error { <ide> defer v.lock.Unlock() <ide> return v.toDisk() <ide> } <add> <ide> func (v *Volume) toDisk() error { <ide> data, err := json.Marshal(v) <ide> if err != nil { <ide> func (v *Volume) toDisk() error { <ide> <ide> return ioutil.WriteFile(pth, data, 0666) <ide> } <add> <ide> func (v *Volume) FromDisk() error { <ide> v.lock.Lock() <ide> defer v.lock.Unlock()
2
Ruby
Ruby
use 6.1 on mavericks."
f29376c867571c2416ef698ad11421a212caeb68
<ide><path>Library/Homebrew/os/mac/xcode.rb <ide> def latest_version <ide> when "10.6" then "3.2.6" <ide> when "10.7" then "4.6.3" <ide> when "10.8" then "5.1.1" <del> when "10.9" then "6.1" <add> when "10.9" then "6.0.1" <ide> when "10.10" then "6.1" <ide> else <ide> # Default to newest known version of Xcode for unreleased OSX versions. <ide> def installed? <ide> def latest_version <ide> case MacOS.version <ide> when "10.10" then "600.0.54" <del> when "10.9" then "600.0.54" <add> when "10.9" then "600.0.51" <ide> when "10.8" then "503.0.40" <ide> else <ide> "425.0.28"
1
Python
Python
fix ndpointer and add tests from ticket #245
a06ddf3e22ee65fe4009c8f0f304d4b26143e600
<ide><path>numpy/lib/tests/test_utils.py <add>from numpy.testing import * <add>set_package_path() <add>import numpy as N <add>restore_path() <add> <add>class test_ndpointer(NumpyTestCase): <add> def check_dtype(self): <add> dt = N.intc <add> p = N.ndpointer(dtype=dt) <add> self.assert_(p.from_param(N.array([1], dt))) <add> dt = '<i4' <add> p = N.ndpointer(dtype=dt) <add> self.assert_(p.from_param(N.array([1], dt))) <add> dt = N.dtype('>i4') <add> p = N.ndpointer(dtype=dt) <add> p.from_param(N.array([1], dt)) <add> self.assertRaises(TypeError, p.from_param, <add> N.array([1], dt.newbyteorder('swap'))) <add> dtnames = ['x', 'y'] <add> dtformats = [N.intc, N.float64] <add> dtdescr = {'names' : dtnames, 'formats' : dtformats} <add> dt = N.dtype(dtdescr) <add> p = N.ndpointer(dtype=dt) <add> self.assert_(p.from_param(N.zeros((10,), dt))) <add> samedt = N.dtype(dtdescr) <add> p = N.ndpointer(dtype=samedt) <add> self.assert_(p.from_param(N.zeros((10,), dt))) <add> dt2 = N.dtype(dtdescr, align=True) <add> if dt.itemsize != dt2.itemsize: <add> self.assertRaises(TypeError, p.from_param, N.zeros((10,), dt2)) <add> else: <add> self.assert_(p.from_param(N.zeros((10,), dt2))) <add> <add> def check_ndim(self): <add> p = N.ndpointer(ndim=0) <add> self.assert_(p.from_param(N.array(1))) <add> self.assertRaises(TypeError, p.from_param, N.array([1])) <add> p = N.ndpointer(ndim=1) <add> self.assertRaises(TypeError, p.from_param, N.array(1)) <add> self.assert_(p.from_param(N.array([1]))) <add> p = N.ndpointer(ndim=2) <add> self.assert_(p.from_param(N.array([[1]]))) <add> <add> def check_shape(self): <add> p = N.ndpointer(shape=(1,2)) <add> self.assert_(p.from_param(N.array([[1,2]]))) <add> self.assertRaises(TypeError, p.from_param, N.array([[1],[2]])) <add> p = N.ndpointer(shape=()) <add> self.assert_(p.from_param(N.array(1))) <add> <add> def check_flags(self): <add> x = N.array([[1,2,3]], order='F') <add> p = N.ndpointer(flags='FORTRAN') <add> self.assert_(p.from_param(x)) <add> p = N.ndpointer(flags='CONTIGUOUS') <add> self.assertRaises(TypeError, p.from_param, x) <add> p = N.ndpointer(flags=x.flags.num) <add> self.assert_(p.from_param(x)) <add> self.assertRaises(TypeError, p.from_param, N.array([[1,2,3]])) <add> <add>if __name__ == "__main__": <add> NumpyTest().run() <ide><path>numpy/lib/utils.py <ide> import inspect <ide> import types <ide> from numpy.core.numerictypes import obj2sctype, integer <del>from numpy.core.multiarray import dtype as _dtype, _flagdict <add>from numpy.core.multiarray import dtype as _dtype, _flagdict, flagsobj <ide> from numpy.core import product, ndarray <ide> <ide> __all__ = ['issubclass_', 'get_numpy_include', 'issubsctype', <ide> def from_param(cls, obj): <ide> raise TypeError, "array must have %d dimension(s)" % cls._ndim_ <ide> if cls._shape_ is not None \ <ide> and obj.shape != cls._shape_: <del> raise TypeError, "array must have shape %s" % cls._shape_ <add> raise TypeError, "array must have shape %s" % str(cls._shape_) <ide> if cls._flags_ is not None \ <ide> and ((obj.flags.num & cls._flags_) != cls._flags_): <ide> raise TypeError, "array must have flags %s" % \ <ide> def ndpointer(dtype=None, ndim=None, shape=None, flags=None): <ide> flags = flags.split(',') <ide> elif isinstance(flags, (int, integer)): <ide> num = flags <del> flags = _flags_fromnum(flags) <add> flags = _flags_fromnum(num) <add> elif isinstance(flags, flagsobj): <add> num = flags.num <add> flags = _flags_fromnum(num) <ide> if num is None: <del> flags = [x.strip().upper() for x in flags] <add> try: <add> flags = [x.strip().upper() for x in flags] <add> except: <add> raise TypeError, "invalid flags specification" <ide> num = _num_fromflags(flags) <ide> try: <ide> return _pointer_type_cache[(dtype, ndim, shape, num)]
2
Ruby
Ruby
make more `require`s in `namedargs` lazy
fddd589bc3f38378500bea962c2805e9db2c79fe
<ide><path>Library/Homebrew/cli/named_args.rb <ide> <ide> require "delegate" <ide> <del>require "cask/cask_loader" <ide> require "cli/args" <del>require "formula" <del>require "formulary" <del>require "keg" <del>require "missing_formula" <ide> <ide> module Homebrew <ide> module CLI <ide> class NamedArgs < Array <ide> extend T::Sig <ide> <ide> def initialize(*args, parent: Args.new, override_spec: nil, force_bottle: false, flags: []) <add> require "cask/cask" <add> require "cask/cask_loader" <add> require "formulary" <add> require "keg" <add> require "missing_formula" <add> <ide> @args = args <ide> @override_spec = override_spec <ide> @force_bottle = force_bottle <ide> def to_kegs <ide> @to_kegs ||= begin <ide> to_formulae_and_casks(only: :formula, method: :keg).freeze <ide> rescue NoSuchKegError => e <del> if (reason = Homebrew::MissingFormula.suggest_command(e.name, "uninstall")) <add> if (reason = MissingFormula.suggest_command(e.name, "uninstall")) <ide> $stderr.puts reason <ide> end <ide> raise e
1
Text
Text
add mesteery to triagers
e5670f49682ced87451e5fc1e56d7d3fc396c6f2
<ide><path>README.md <ide> maintaining the Node.js project. <ide> **Himadri Ganguly** &lt;[email protected]&gt; (he/him) <ide> * [marsonya](https://github.com/marsonya) - <ide> **Akhil Marsonya** &lt;[email protected]&gt; (he/him) <add>* [Mesteery](https://github.com/Mesteery) - <add>**Mestery** &lt;[email protected]&gt; <ide> * [PoojaDurgad](https://github.com/PoojaDurgad) - <ide> **Pooja Durgad** &lt;[email protected]&gt; <ide> * [RaisinTen](https://github.com/RaisinTen) -
1
Ruby
Ruby
make rackrequest#request_method respect _method
1d002f6bcbd4e4f5cc421ee4da5be18839ccc4cb
<ide><path>actionpack/lib/action_controller/rack_process.rb <ide> def remote_addr <ide> @env['REMOTE_ADDR'] <ide> end <ide> <del> def request_method <del> @env['REQUEST_METHOD'].downcase.to_sym <del> end <del> <ide> def server_port <ide> @env['SERVER_PORT'].to_i <ide> end <ide><path>actionpack/test/controller/cgi_test.rb <ide> def setup <ide> end <ide> <ide> def default_test; end <add> <add> private <add> <add> def set_content_data(data) <add> @request.env['CONTENT_LENGTH'] = data.length <add> @request.env['CONTENT_TYPE'] = 'application/x-www-form-urlencoded; charset=utf-8' <add> @request.env['RAW_POST_DATA'] = data <add> end <ide> end <ide> <ide> class CgiRequestTest < BaseCgiTest <ide> def test_xml_content_type_verification <ide> end <ide> end <ide> <add>class CgiRequestMethodTest < BaseCgiTest <add> def test_get <add> assert_equal :get, @request.request_method <add> end <add> <add> def test_post <add> @request.env['REQUEST_METHOD'] = 'POST' <add> assert_equal :post, @request.request_method <add> end <add> <add> def test_put <add> @request.env['REQUEST_METHOD'] = 'POST' <add> set_content_data '_method=put' <add> <add> assert_equal :put, @request.request_method <add> end <add> <add> def test_delete <add> @request.env['REQUEST_METHOD'] = 'POST' <add> set_content_data '_method=delete' <add> <add> assert_equal :delete, @request.request_method <add> end <add>end <add> <ide> class CgiRequestNeedsRewoundTest < BaseCgiTest <ide> def test_body_should_be_rewound <ide> data = 'foo' <ide><path>actionpack/test/controller/rack_test.rb <ide> def setup <ide> end <ide> <ide> def default_test; end <add> <add> private <add> <add> def set_content_data(data) <add> @request.env['CONTENT_LENGTH'] = data.length <add> @request.env['CONTENT_TYPE'] = 'application/x-www-form-urlencoded; charset=utf-8' <add> @request.env['RAW_POST_DATA'] = data <add> end <ide> end <ide> <ide> class RackRequestTest < BaseRackTest <ide> def test_xml_content_type_verification <ide> end <ide> end <ide> <add>class RackRequestMethodTest < BaseRackTest <add> def test_get <add> assert_equal :get, @request.request_method <add> end <add> <add> def test_post <add> @request.env['REQUEST_METHOD'] = 'POST' <add> assert_equal :post, @request.request_method <add> end <add> <add> def test_put <add> @request.env['REQUEST_METHOD'] = 'POST' <add> set_content_data '_method=put' <add> <add> assert_equal :put, @request.request_method <add> end <add> <add> def test_delete <add> @request.env['REQUEST_METHOD'] = 'POST' <add> set_content_data '_method=delete' <add> <add> assert_equal :delete, @request.request_method <add> end <add>end <add> <ide> class RackRequestNeedsRewoundTest < BaseRackTest <ide> def test_body_should_be_rewound <ide> data = 'foo'
3
Ruby
Ruby
use version token helper methods
e27f7b0ed101608fbcb5e36e3cef77f3ffbda40d
<ide><path>Library/Homebrew/dev-cmd/audit.rb <ide> def audit_file <ide> !(versioned_formulae = formula.versioned_formulae).empty? <ide> versioned_aliases = formula.aliases.grep(/.@\d/) <ide> _, last_alias_version = versioned_formulae.map(&:name).last.split("@") <del> major, minor, = formula.version.to_s.split(".") <del> alias_name_major = "#{formula.name}@#{major}" <del> alias_name_major_minor = "#{alias_name_major}.#{minor}" <add> alias_name_major = "#{formula.name}@#{formula.version.major}" <add> alias_name_major_minor = "#{alias_name_major}.#{formula.version.minor}" <ide> alias_name = if last_alias_version.split(".").length == 1 <ide> alias_name_major <ide> else <ide> def audit_postgresql <ide> return unless formula.name == "postgresql" <ide> return unless @core_tap <ide> <del> major_version = formula.version <del> .to_s <del> .split(".") <del> .first <del> .to_i <add> major_version = formula.version.major.to_i <ide> previous_major_version = major_version - 1 <ide> previous_formula_name = "postgresql@#{previous_major_version}" <ide> begin <ide> def get_repo_data(regex) <ide> }.freeze <ide> <ide> # version_prefix = stable_version_string.sub(/\d+$/, "") <del> # version_prefix = stable_version_string.split(".")[0..1].join(".") <add> # version_prefix = stable.version.major_minor <ide> <ide> def audit_specs <ide> problem "Head-only (no stable download)" if head_only?(formula) <ide> def audit_specs <ide> <ide> stable_version_string = stable.version.to_s <ide> stable_url_version = Version.parse(stable.url) <del> _, stable_url_minor_version, = stable_url_version.to_s <del> .split(".", 3) <del> .map(&:to_i) <add> stable_url_minor_version = stable_url_version.minor.to_i <ide> <del> formula_suffix = stable_version_string.split(".").last.to_i <add> formula_suffix = stable.version.patch.to_i <ide> throttled_rate = THROTTLED_FORMULAE[formula.name] <ide> if throttled_rate && formula_suffix.modulo(throttled_rate).nonzero? <ide> problem "should only be updated every #{throttled_rate} releases on multiples of #{throttled_rate}" <ide> def audit_specs <ide> <ide> problem "Stable version URLs should not contain #{matched}" <ide> when %r{download\.gnome\.org/sources}, %r{ftp\.gnome\.org/pub/GNOME/sources}i <del> version_prefix = stable_version_string.split(".")[0..1].join(".") <add> version_prefix = stable.version.major_minor <ide> return if GNOME_DEVEL_ALLOWLIST[formula.name] == version_prefix <ide> return if stable_url_version < Version.create("1.0") <ide> return if stable_url_minor_version.even?
1
Text
Text
fix spelling of built-in
c9b4add394970743fdfee3b4c8a84636a54c7f6e
<ide><path>readme.md <ide> export default class Error extends React.Component { <ide> } <ide> ``` <ide> <del>### Reusing the build in error page <add>### Reusing the built-in error page <ide> <del>If you want to render the build in error page you can by using `next/error`: <add>If you want to render the built-in error page you can by using `next/error`: <ide> <ide> ```jsx <ide> import React from 'react'
1
Ruby
Ruby
save flags in `with_full_permissions`
642e355b4f042de80a78036f66d5810dc392cfdc
<ide><path>Library/Homebrew/cask/lib/hbc/pkg.rb <ide> def rmdir(path) <ide> <ide> def with_full_permissions(path) <ide> original_mode = (path.stat.mode % 01000).to_s(8) <del> # TODO: similarly read and restore macOS flags (cf man chflags) <add> original_flags = @command.run!("/usr/bin/stat", args: ["-f", "%Of", "--", path]).stdout.chomp <add> <ide> @command.run!("/bin/chmod", args: ["--", "777", path], sudo: true) <ide> yield <ide> ensure <ide> if path.exist? # block may have removed dir <ide> @command.run!("/bin/chmod", args: ["--", original_mode, path], sudo: true) <add> @command.run!("/usr/bin/chflags", args: ["--", original_flags, path], sudo: true) <ide> end <ide> end <ide> <ide><path>Library/Homebrew/test/cask/pkg_spec.rb <ide> describe Hbc::Pkg, :cask do <ide> describe "#uninstall" do <ide> let(:fake_system_command) { Hbc::NeverSudoSystemCommand } <del> let(:empty_response) { double(stdout: "", plist: {"volume" => "/", "install-location" => "", "paths" => {}}) } <add> let(:empty_response) { double(stdout: "", plist: { "volume" => "/", "install-location" => "", "paths" => {} }) } <ide> let(:pkg) { described_class.new("my.fake.pkg", fake_system_command) } <ide> <ide> it "removes files and dirs referenced by the pkg" do <ide> <ide> it "removes broken symlinks" do <ide> fake_dir = Pathname.new(Dir.mktmpdir) <del> fake_root = Pathname.new(Dir.mktmpdir) <add> fake_root = Pathname.new(Dir.mktmpdir) <ide> fake_file = fake_dir.join("ima_file").tap { |path| FileUtils.touch(path) } <ide> <ide> intact_symlink = fake_dir.join("intact_symlink").tap { |path| path.make_symlink(fake_file) }
2
Text
Text
remove legacy in-page links in v8.md
61e60a5e88effaf14516f6b03c1be6d9b6160590
<ide><path>doc/api/v8.md <ide> Called when the promise receives a resolution or rejection value. This may <ide> occur synchronously in the case of `Promise.resolve()` or `Promise.reject()`. <ide> <ide> [HTML structured clone algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm <del>[Hook Callbacks]: #hook_callbacks <add>[Hook Callbacks]: #hook-callbacks <ide> [V8]: https://developers.google.com/v8/ <del>[`AsyncLocalStorage`]: async_context.md#class_asynclocalstorage <add>[`AsyncLocalStorage`]: async_context.md#class-asynclocalstorage <ide> [`Buffer`]: buffer.md <ide> [`DefaultDeserializer`]: #class-v8defaultdeserializer <ide> [`DefaultSerializer`]: #class-v8defaultserializer <ide> occur synchronously in the case of `Promise.resolve()` or `Promise.reject()`. <ide> [`GetHeapSpaceStatistics`]: https://v8docs.nodesource.com/node-13.2/d5/dda/classv8_1_1_isolate.html#ac673576f24fdc7a33378f8f57e1d13a4 <ide> [`NODE_V8_COVERAGE`]: cli.md#node_v8_coveragedir <ide> [`Serializer`]: #class-v8serializer <del>[`after` callback]: #after_promise <add>[`after` callback]: #afterpromise <ide> [`async_hooks`]: async_hooks.md <del>[`before` callback]: #before_promise <add>[`before` callback]: #beforepromise <ide> [`buffer.constants.MAX_LENGTH`]: buffer.md#bufferconstantsmax_length <ide> [`deserializer._readHostObject()`]: #deserializer_readhostobject <ide> [`deserializer.transferArrayBuffer()`]: #deserializertransferarraybufferid-arraybuffer <del>[`init` callback]: #init_promise_parent <add>[`init` callback]: #initpromise-parent <ide> [`serialize()`]: #v8serializevalue <ide> [`serializer._getSharedArrayBufferId()`]: #serializer_getsharedarraybufferidsharedarraybuffer <ide> [`serializer._writeHostObject()`]: #serializer_writehostobjectobject <ide> [`serializer.releaseBuffer()`]: #serializerreleasebuffer <ide> [`serializer.transferArrayBuffer()`]: #serializertransferarraybufferid-arraybuffer <ide> [`serializer.writeRawBytes()`]: #serializerwriterawbytesbuffer <del>[`settled` callback]: #settled_promise <add>[`settled` callback]: #settledpromise <ide> [`v8.stopCoverage()`]: #v8stopcoverage <ide> [`v8.takeCoverage()`]: #v8takecoverage <ide> [`vm.Script`]: vm.md#new-vmscriptcode-options
1
Python
Python
remove some comments out-dated
f97e0231ccf47f6b15152168fc5baae75134239c
<ide><path>official/nlp/bert/model_saving_utils.py <ide> def export_bert_model(model_export_path: typing.Text, <ide> raise ValueError('model must be a tf.keras.Model object.') <ide> <ide> if checkpoint_dir: <del> # Keras compile/fit() was used to save checkpoint using <del> # model.save_weights(). <ide> if restore_model_using_load_weights: <ide> model_weight_path = os.path.join(checkpoint_dir, 'checkpoint') <ide> assert tf.io.gfile.exists(model_weight_path) <ide> model.load_weights(model_weight_path) <del> <del> # tf.train.Checkpoint API was used via custom training loop logic. <ide> else: <ide> checkpoint = tf.train.Checkpoint(model=model) <ide>
1
Text
Text
add note that `next build` output is compressed.
8aa15a21f8f15faa5ea037b82e579d2cd7003878
<ide><path>docs/api-reference/cli.md <ide> NODE_OPTIONS='--inspect' next <ide> - **Size** – The number of assets downloaded when navigating to the page client-side. The size for each route only includes its dependencies. <ide> - **First Load JS** – The number of assets downloaded when visiting the page from the server. The amount of JS shared by all is shown as a separate metric. <ide> <del>The first load is indicated by green, yellow, or red. Aim for green for performant applications. <add>Both of these values are **compressed with gzip**. The first load is indicated by green, yellow, or red. Aim for green for performant applications. <ide> <ide> You can enable production profiling for React with the `--profile` flag in `next build`. This requires [Next.js 9.5](https://nextjs.org/blog/next-9-5): <ide>
1
Javascript
Javascript
fix vertex shader bug
48123a33b10f51729cdd86ac63605409e09e2811
<ide><path>src/renderers/shaders/ShaderLib.js <ide> THREE.ShaderLib = { <ide> "void main() {", <ide> <ide> THREE.ShaderChunk[ "color_vertex" ], <del> <del> " vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );", <add> THREE.ShaderChunk[ "begin_vertex" ], <add> THREE.ShaderChunk[ "project_vertex" ], <ide> <ide> " #ifdef USE_SIZEATTENUATION", <del> " gl_PointSize = size * ( scale / -mvPosition.z );", <add> " gl_PointSize = size * ( scale / - mvPosition.z );", <ide> " #else", <ide> " gl_PointSize = size;", <ide> " #endif", <ide> <del> " gl_Position = projectionMatrix * mvPosition;", <del> <ide> THREE.ShaderChunk[ "logdepthbuf_vertex" ], <ide> THREE.ShaderChunk[ "worldpos_vertex" ], <ide> THREE.ShaderChunk[ "shadowmap_vertex" ],
1
Text
Text
add 1.10 migration docs
c8f263c73d0f3efd1834427346b3c5b170fcdab5
<ide><path>docs/migration.md <add><!--[metadata]> <add>+++ <add>title = "Migrate to Engine 1.10" <add>description = "Migrate to Engine 1.10" <add>keywords = ["docker, documentation, engine, upgrade, migration"] <add>[menu.main] <add>parent = "engine_use" <add>weight=79 <add>+++ <add><![end-metadata]--> <add> <add>#Β Migrate to Engine 1.10 <add> <add>Starting from version 1.10 of Docker Engine, we completely change the way image <add>data is addressed on disk. Previously, every image and layer used a randomly <add>assigned UUID. In 1.10 we implemented a content addressable method using an ID, <add>based on a secure hash of the image and layer data. <add> <add>The new method gives users more security, provides a built-in way to avoid ID <add>collisions and guarantee data integrity after pull, push, load, or save. It also <add>brings better sharing of layers by allowing many images to freely share their <add>layers even if they didn’t come from the same build. <add> <add>Addressing images by their content also lets us more easily detect if something <add>has already been downloaded. Because we have separated images and layers, you <add>don’t have to pull the configurations for every image that was part of the <add>original build chain. We also don’t need to create layers for the build <add>instructions that didn’t modify the filesystem. <add> <add>Content addressability is the foundation for the new distribution features. The <add>image pull and push code has been reworked to use a download/upload manager <add>concept that makes pushing and pulling images much more stable and mitigate any <add>parallel request issues. The download manager also brings retries on failed <add>downloads and better prioritization for concurrent downloads. <add> <add>We are also introducing a new manifest format that is built on top of the <add>content addressable base. It directly references the content addressable image <add>configuration and layer checksums. The new manifest format also makes it <add>possible for a manifest list to be used for targeting multiple <add>architectures/platforms. Moving to the new manifest format will be completely <add>transparent. <add> <add>## Preparing for upgrade <add> <add>To make your current images accessible to the new model we have to migrate them <add>to content addressable storage. This means calculating the secure checksums for <add>your current data. <add> <add>All your current images, tags and containers are automatically migrated to the <add>new foundation the first time you start Docker Engine 1.10. Before loading your <add>container, the daemon will calculate all needed checksums for your current data, <add>and after it has completed, all your images and tags will have brand new secure <add>IDs. <add> <add>**While this is simple operation, calculating SHA256 checksums for your files <add>can take time if you have lots of image data.** On average you should assume <add>that migrator can process data at a speed of 100MB/s. During this time your <add>Docker daemon won’t be ready to respond to requests. <add> <add>## Minimizing migration time <add> <add>If you can accept this one time hit, then upgrading Docker Engine and restarting <add>the daemon will transparently migrate your images. However, if you want to <add>minimize the daemon’s downtime, a migration utility can be run while your old <add>daemon is still running. <add> <add>This tool will find all your current images and calculate the checksums for <add>them. After you upgrade and restart the daemon, the checksum data of the <add>migrated images will already exist, freeing the daemon from that computation <add>work. If new images appeared between the migration and the upgrade, those will <add>be processed at time of upgrade to 1.10. <add> <add>[You can download the migration tool <add>here.](https://github.com/docker/v1.10-migrator/releases) <add> <add>The migration tool can also be run as a Docker image. While running the migrator <add>image you need to expose your Docker data directory to the container. If you use <add>the default path then you would run: <add> <add> $ docker run --rm -v /var/lib/docker:/var/lib/docker docker/v1.10-migrator <add> <add>If you use the <add>devicemapper storage driver, you also need to pass the flag `--privileged` to <add>give the tool access to your storage devices.
1
Go
Go
remove unnecessary check for nil cstring
11fda783f85e1f6027c997c6b044c65288c89099
<ide><path>daemon/logger/journald/read.go <ide> func (s *journald) readLogs(logWatcher *logger.LogWatcher, config logger.ReadCon <ide> } <ide> // Add a match to have the library do the searching for us. <ide> cmatch = C.CString("CONTAINER_ID_FULL=" + s.vars["CONTAINER_ID_FULL"]) <del> if cmatch == nil { <del> logWatcher.Err <- fmt.Errorf("error reading container ID") <del> return <del> } <ide> defer C.free(unsafe.Pointer(cmatch)) <ide> rc = C.sd_journal_add_match(j, unsafe.Pointer(cmatch), C.strlen(cmatch)) <ide> if rc != 0 {
1
Ruby
Ruby
be4723fac8d2d6b317d5b1eaf2149de74299a3d5
<ide><path>Library/Homebrew/dev-cmd/audit.rb <ide> def audit_postgresql <ide> [email protected] <ide> [email protected] <ide> [email protected] <add> [email protected] <ide> [email protected] <ide> ].freeze <ide>
1
Ruby
Ruby
remove ivar only when defined
430b7c8b518fc628f2647323ba2bbb8dbb6cdd35
<ide><path>activerecord/test/cases/adapters/mysql/quoting_test.rb <ide> def test_type_cast_false <ide> <ide> def test_quoted_date_precision_for_gte_564 <ide> @conn.stubs(:full_version).returns('5.6.4') <del> @conn.remove_instance_variable(:@version) <add> @conn.remove_instance_variable(:@version) if @conn.instance_variable_defined?(:@version) <ide> t = Time.now.change(usec: 1) <ide> assert_match(/\.000001\z/, @conn.quoted_date(t)) <ide> end <ide> <ide> def test_quoted_date_precision_for_lt_564 <ide> @conn.stubs(:full_version).returns('5.6.3') <del> @conn.remove_instance_variable(:@version) <add> @conn.remove_instance_variable(:@version) if @conn.instance_variable_defined?(:@version) <ide> t = Time.now.change(usec: 1) <ide> refute_match(/\.000001\z/, @conn.quoted_date(t)) <ide> end
1
Python
Python
add tokenclassification test
e7b63eca61b69d4c344831abae25bcc61d638450
<ide><path>keras/tests/integration_test.py <ide> def test_serialization_v2_model(self): <ide> loaded_model = keras.models.load_model(output_path) <ide> self.assertEqual(model.summary(), loaded_model.summary()) <ide> <add>@test_combinations.run_with_all_model_types <add>@test_combinations.run_all_keras_modes <add>class TokenClassificationIntegrationTest(test_combinations.TestCase): <add> """Tests a very simple token classification model. <add> <add> The main purpose of this test is to verify that everything works as expected when <add> input sequences have variable length, and batches are padded only to the maximum length <add> of each batch. This is very common in NLP, and results in the sequence dimension varying <add> with each batch step for both the features and the labels. <add> """ <add> def test_token_classification(self): <add> np.random.seed(1337) <add> data = [np.random.randint(low=0, high=16, size=random.randint(4, 16)) for _ in range(100)] <add> labels = [np.random.randint(low=0, high=3, size=len(arr)) for arr in data] <add> features_dataset = tf.data.Dataset.from_tensor_slices(data) <add> labels_dataset = tf.data.Dataset.from_tensor_slices(labels) <add> dataset = tf.data.Dataset.zip(features_dataset, labels_dataset) <add> dataset = dataset.padded_batch(batch_size=10) # Pads with 0 values by default <add> <add> layers = [ <add> keras.layers.Embedding(16, 4), <add> keras.layers.Conv1D(4, 5, padding='same', activation='relu'), <add> keras.layers.Conv1D(8, 5, padding='same'), <add> keras.layers.BatchNormalization(), <add> keras.layers.Conv2D(3, 5, padding='same', activation='softmax'), <add> ] <add> model = test_utils.get_model_from_layers( <add> layers, input_shape=(None,)) <add> model.compile( <add> loss='categorical_crossentropy', <add> optimizer=keras.optimizers.optimizer_v2.adam.Adam(0.005), <add> metrics=['acc'], <add> run_eagerly=test_utils.should_run_eagerly()) <add> history = model.fit(dataset, epochs=10, <add> validation_data=dataset, <add> verbose=2) <add> self.assertGreater(history.history['val_acc'][-1], 0.7) <add> _, val_acc = model.evaluate(dataset) <add> self.assertAlmostEqual(history.history['val_acc'][-1], val_acc) <add> predictions = model.predict(dataset) <add> self.assertTrue(isinstance(predictions, tf.RaggedTensor)) <add> self.assertEqual(predictions.shape[0], len(dataset) * 10) <add> self.assertEqual(predictions.shape[-1], 3) <add> <ide> if __name__ == '__main__': <ide> tf.test.main()
1
PHP
PHP
fix tests that fail in phpunit 3.7
f89fe0e1efcd77877a3fab8f13e41a7e129639f9
<ide><path>lib/Cake/Test/Case/Event/CakeEventManagerTest.php <ide> public function testDispatchWithKeyName() { <ide> * @return void <ide> */ <ide> public function testDispatchReturnValue() { <add> $this->skipIf( <add> version_compare(PHPUnit_Runner_Version::VERSION, '3.7', '<'), <add> 'These tests fail in PHPUnit 3.6' <add> ); <ide> $manager = new CakeEventManager; <ide> $listener = $this->getMock('CakeEventTestListener'); <ide> $anotherListener = $this->getMock('CakeEventTestListener'); <ide> $manager->attach(array($listener, 'listenerFunction'), 'fake.event'); <ide> $manager->attach(array($anotherListener, 'listenerFunction'), 'fake.event'); <ide> $event = new CakeEvent('fake.event'); <ide> <del> $firstStep = clone $event; <ide> $listener->expects($this->at(0))->method('listenerFunction') <del> ->with($firstStep) <add> ->with($event) <ide> ->will($this->returnValue('something special')); <del> $anotherListener->expects($this->at(0))->method('listenerFunction')->with($event); <add> $anotherListener->expects($this->at(0)) <add> ->method('listenerFunction') <add> ->with($event); <ide> $manager->dispatch($event); <ide> $this->assertEquals('something special', $event->result); <ide> } <ide> public function testDispatchReturnValue() { <ide> * @return void <ide> */ <ide> public function testDispatchFalseStopsEvent() { <add> $this->skipIf( <add> version_compare(PHPUnit_Runner_Version::VERSION, '3.7', '<'), <add> 'These tests fail in PHPUnit 3.6' <add> ); <add> <ide> $manager = new CakeEventManager; <ide> $listener = $this->getMock('CakeEventTestListener'); <ide> $anotherListener = $this->getMock('CakeEventTestListener'); <ide> $manager->attach(array($listener, 'listenerFunction'), 'fake.event'); <ide> $manager->attach(array($anotherListener, 'listenerFunction'), 'fake.event'); <ide> $event = new CakeEvent('fake.event'); <ide> <del> $originalEvent = clone $event; <ide> $listener->expects($this->at(0))->method('listenerFunction') <del> ->with($originalEvent) <add> ->with($event) <ide> ->will($this->returnValue(false)); <del> $anotherListener->expects($this->never())->method('listenerFunction'); <add> $anotherListener->expects($this->never()) <add> ->method('listenerFunction'); <ide> $manager->dispatch($event); <ide> $this->assertTrue($event->isStopped()); <ide> }
1
Text
Text
convert bare email addresses to mailto links
414199d78d6df5e5fc22f6945f2fede29f376fb0
<ide><path>doc/guides/cve-management-process.md <ide> of contact points. Email aliases have been setup for these as follows: <ide> <ide> * **Public contact points**. Email address to which people will be directed <ide> by Mitre when they are asked for a way to contact the Node.js team about <del> CVE-related issues. **[email protected]** <add> CVE-related issues. **[[email protected]][]** <ide> <ide> * **Private contact points**. Administrative contacts that Mitre can reach out <ide> to directly in case there are issues that require immediate attention. <del> **[email protected]** <add> **[[email protected]][]** <ide> <ide> * **Email addresses to add to the CNA email discussion list**. This address has <ide> been added to a closed mailing list that is used for announcements, <ide> sharing documents, or discussion relevant to the CNA community. <ide> The list rarely has more than ten messages a week. <del> **[email protected]** <add> **[[email protected]][]** <ide> <ide> ## CNA management processes <ide> <ide> of CVEs should then be requested using the steps listed above. <ide> <ide> ### External CVE request process <ide> <del>When a request for a CVE is received via the [email protected] <add>When a request for a CVE is received via the [[email protected]][] <ide> email alias the following process will be followed (likely updated <ide> after we get HackerOne up and running). <ide> <ide> following steps are used to assign, announce and report a CVE. <ide> * Move the CVE from the Pending section to the Announced section along <ide> with a link to the Node.js blog post announcing that releases <ide> are available. <add> <add>[[email protected]]: mailto:[email protected] <add>[[email protected]]: mailto:[email protected] <add>[[email protected]]: mailto:[email protected]
1
Javascript
Javascript
fix typo in `unordered list`
ddef9c960a943f3ac81481caf45595a2977f331a
<ide><path>packages/ember-views/lib/views/collection_view.js <ide> var get = Ember.get, set = Ember.set, fmt = Ember.String.fmt; <ide> Given an empty `<body>` and the following code: <ide> <ide> ```javascript <del> anUndorderedListView = Ember.CollectionView.create({ <add> anUnorderedListView = Ember.CollectionView.create({ <ide> tagName: 'ul', <ide> content: ['A','B','C'], <ide> itemViewClass: Ember.View.extend({ <ide> template: Ember.Handlebars.compile("the letter: {{view.content}}") <ide> }) <ide> }); <ide> <del> anUndorderedListView.appendTo('body'); <add> anUnorderedListView.appendTo('body'); <ide> ``` <ide> <ide> Will result in the following HTML structure
1
Mixed
Ruby
implement h2 early hints for rails
59a02fb7bcbe68f26e1e7fdcec45c00c66e4a065
<ide><path>actionpack/CHANGELOG.md <add>* Add ability to enable Early Hints for HTTP/2 <add> <add> If supported by the server, and enabled in Puma this allows H2 Early Hints to be used. <add> <add> The `javascript_include_tag` and the `stylesheet_link_tag` automatically add Early Hints if requested. <add> <add> *Eileen M. Uchitelle*, *Aaron Patterson* <add> <ide> * Simplify cookies middleware with key rotation support <ide> <ide> Use the `rotate` method for both `MessageEncryptor` and <ide><path>actionpack/lib/action_dispatch/http/request.rb <ide> def headers <ide> @headers ||= Http::Headers.new(self) <ide> end <ide> <add> # Early Hints is an HTTP/2 status code that indicates hints to help a client start <add> # making preparations for processing the final response. <add> # <add> # If the env contains +rack.early_hints+ then the server accepts HTTP2 push for Link headers. <add> # <add> # The +send_early_hints+ method accepts an hash of links as follows: <add> # <add> # send_early_hints("Link" => "</style.css>; rel=preload; as=style\n</script.js>; rel=preload") <add> # <add> # If you are using +javascript_include_tag+ or +stylesheet_link_tag+ the <add> # Early Hints headers are included by default if supported. <add> def send_early_hints(links) <add> return unless env["rack.early_hints"] <add> <add> env["rack.early_hints"].call(links) <add> end <add> <ide> # Returns a +String+ with the last requested path including their params. <ide> # <ide> # # get '/foo' <ide><path>actionpack/test/dispatch/request_test.rb <ide> class RequestFormData < BaseRequestTest <ide> assert !request.form_data? <ide> end <ide> end <add> <add>class EarlyHintsRequestTest < BaseRequestTest <add> def setup <add> super <add> @env["rack.early_hints"] = lambda { |links| links } <add> @request = stub_request <add> end <add> <add> test "when early hints is set in the env link headers are sent" do <add> early_hints = @request.send_early_hints("Link" => "</style.css>; rel=preload; as=style\n</script.js>; rel=preload") <add> expected_hints = { "Link" => "</style.css>; rel=preload; as=style\n</script.js>; rel=preload" } <add> <add> assert_equal expected_hints, early_hints <add> end <add>end <ide><path>actionview/lib/action_view/helpers/asset_tag_helper.rb <ide> module AssetTagHelper <ide> # When the Asset Pipeline is enabled, you can pass the name of your manifest as <ide> # source, and include other JavaScript or CoffeeScript files inside the manifest. <ide> # <add> # If the server supports Early Hints header links for these assets will be <add> # automatically pushed. <add> # <ide> # ==== Options <ide> # <ide> # When the last parameter is a hash you can add HTML attributes using that <ide> module AssetTagHelper <ide> def javascript_include_tag(*sources) <ide> options = sources.extract_options!.stringify_keys <ide> path_options = options.extract!("protocol", "extname", "host", "skip_pipeline").symbolize_keys <del> sources.uniq.map { |source| <add> early_hints_links = [] <add> <add> sources_tags = sources.uniq.map { |source| <add> href = path_to_javascript(source, path_options) <add> early_hints_links << "<#{href}>; rel=preload; as=script" <ide> tag_options = { <del> "src" => path_to_javascript(source, path_options) <add> "src" => href <ide> }.merge!(options) <ide> content_tag("script".freeze, "", tag_options) <ide> }.join("\n").html_safe <add> <add> request.send_early_hints("Link" => early_hints_links.join("\n")) <add> <add> sources_tags <ide> end <ide> <ide> # Returns a stylesheet link tag for the sources specified as arguments. If <ide> def javascript_include_tag(*sources) <ide> # to "screen", so you must explicitly set it to "all" for the stylesheet(s) to <ide> # apply to all media types. <ide> # <add> # If the server supports Early Hints header links for these assets will be <add> # automatically pushed. <add> # <ide> # stylesheet_link_tag "style" <ide> # # => <link href="/assets/style.css" media="screen" rel="stylesheet" /> <ide> # <ide> def javascript_include_tag(*sources) <ide> def stylesheet_link_tag(*sources) <ide> options = sources.extract_options!.stringify_keys <ide> path_options = options.extract!("protocol", "host", "skip_pipeline").symbolize_keys <del> sources.uniq.map { |source| <add> early_hints_links = [] <add> <add> sources_tags = sources.uniq.map { |source| <add> href = path_to_stylesheet(source, path_options) <add> early_hints_links << "<#{href}>; rel=preload; as=stylesheet" <ide> tag_options = { <ide> "rel" => "stylesheet", <ide> "media" => "screen", <del> "href" => path_to_stylesheet(source, path_options) <add> "href" => href <ide> }.merge!(options) <ide> tag(:link, tag_options) <ide> }.join("\n").html_safe <add> <add> request.send_early_hints("Link" => early_hints_links.join("\n")) <add> <add> sources_tags <ide> end <ide> <ide> # Returns a link tag that browsers and feed readers can use to auto-detect <ide><path>actionview/test/template/asset_tag_helper_test.rb <ide> def protocol() "http://" end <ide> def ssl?() false end <ide> def host_with_port() "localhost" end <ide> def base_url() "http://www.example.com" end <add> def send_early_hints(links) end <ide> end.new <ide> <ide> @controller.request = @request <ide> def setup <ide> @controller = BasicController.new <ide> @controller.config.relative_url_root = "/collaboration/hieraki" <ide> <del> @request = Struct.new(:protocol, :base_url).new("gopher://", "gopher://www.example.com") <add> @request = Struct.new(:protocol, :base_url) do <add> def send_early_hints(links); end <add> end.new("gopher://", "gopher://www.example.com") <ide> @controller.request = @request <ide> end <ide> <ide><path>actionview/test/template/javascript_helper_test.rb <ide> class JavaScriptHelperTest < ActionView::TestCase <ide> tests ActionView::Helpers::JavaScriptHelper <ide> <ide> attr_accessor :output_buffer <add> attr_reader :request <ide> <ide> setup do <ide> @old_escape_html_entities_in_json = ActiveSupport.escape_html_entities_in_json <ide> ActiveSupport.escape_html_entities_in_json = true <ide> @template = self <add> @request = Class.new do <add> def send_early_hints(links) end <add> end.new <ide> end <ide> <ide> def teardown <ide><path>railties/lib/rails/commands/server/server_command.rb <ide> class ServerCommand < Base # :nodoc: <ide> class_option "dev-caching", aliases: "-C", type: :boolean, default: nil, <ide> desc: "Specifies whether to perform caching in development." <ide> class_option "restart", type: :boolean, default: nil, hide: true <add> class_option "early_hints", type: :boolean, default: nil, desc: "Enables HTTP/2 early hints." <ide> <ide> def initialize(args = [], local_options = {}, config = {}) <ide> @original_options = local_options <ide> def server_options <ide> daemonize: options[:daemon], <ide> pid: pid, <ide> caching: options["dev-caching"], <del> restart_cmd: restart_command <add> restart_cmd: restart_command, <add> early_hints: early_hints <ide> } <ide> end <ide> end <ide> def restart_command <ide> "bin/rails server #{@server} #{@original_options.join(" ")} --restart" <ide> end <ide> <add> def early_hints <add> options[:early_hints] <add> end <add> <ide> def pid <ide> File.expand_path(options[:pid]) <ide> end <ide><path>railties/test/commands/server_test.rb <ide> def test_caching_with_option <ide> assert_equal false, options[:caching] <ide> end <ide> <add> def test_early_hints_with_option <add> args = ["--early-hints"] <add> options = parse_arguments(args) <add> assert_equal true, options[:early_hints] <add> end <add> <add> def test_early_hints_is_nil_by_default <add> args = [] <add> options = parse_arguments(args) <add> assert_nil options[:early_hints] <add> end <add> <ide> def test_log_stdout <ide> with_rack_env nil do <ide> with_rails_env nil do
8
PHP
PHP
apply fixes from styleci
5c8255b2a4b10593fa86013737a55560b96c8341
<ide><path>src/Illuminate/Routing/CompiledRouteCollection.php <ide> <ide> namespace Illuminate\Routing; <ide> <del>use Exception; <ide> use Illuminate\Container\Container; <ide> use Illuminate\Http\Request; <ide> use Illuminate\Support\Collection;
1
Javascript
Javascript
add test to ensure 'undefined' children is used
fe2002c3d855904c8f272c402f7a321d5bac5c37
<ide><path>src/isomorphic/classic/element/__tests__/ReactElement-test.js <ide> describe('ReactElement', function() { <ide> expect(console.error.argsForCall.length).toBe(0); <ide> }); <ide> <add> it('overrides children if undefined is provided as an argument', function() { <add> var element = React.createElement(ComponentClass, { <add> children: 'text', <add> }, undefined); <add> expect(element.props.children).toBe(undefined); <add> <add> var element2 = React.cloneElement(React.createElement(ComponentClass, { <add> children: 'text', <add> }), {}, undefined); <add> expect(element2.props.children).toBe(undefined); <add> }); <add> <ide> it('merges rest arguments onto the children prop in an array', function() { <ide> spyOn(console, 'error'); <ide> var a = 1; <ide><path>src/isomorphic/modern/element/__tests__/ReactJSXElement-test.js <ide> describe('ReactJSXElement', function() { <ide> expect(console.error.argsForCall.length).toBe(0); <ide> }); <ide> <add> it('overrides children if undefined is provided as an argument', function() { <add> var element = <Component children="text">{undefined}</Component>; <add> expect(element.props.children).toBe(undefined); <add> <add> var element2 = React.cloneElement( <add> <Component children="text" />, <add> {}, <add> undefined <add> ); <add> expect(element2.props.children).toBe(undefined); <add> }); <add> <ide> it('merges JSX children onto the children prop in an array', function() { <ide> spyOn(console, 'error'); <ide> var a = 1;
2
Javascript
Javascript
add missing url prop
3949c82bdfe268f841178979800aa8e71bbf412c
<ide><path>examples/with-apollo/lib/withData.js <ide> export default ComposedComponent => { <ide> // and extract the resulting data <ide> const apollo = initApollo() <ide> try { <add> // create the url prop which is passed to every page <add> const url = { <add> query: ctx.query, <add> asPath: ctx.asPath, <add> pathname: ctx.pathname, <add> }; <add> <ide> // Run all GraphQL queries <ide> await getDataFromTree( <del> <ComposedComponent ctx={ctx} {...composedInitialProps} />, <add> <ComposedComponent ctx={ctx} url={url} {...composedInitialProps} />, <ide> { <ide> router: { <ide> asPath: ctx.asPath,
1
Go
Go
change argument order of register function
35df24c8e6195ebac6ea28ed4dda5b53b1021f38
<ide><path>graph/graph.go <ide> func (graph *Graph) Create(layerData archive.ArchiveReader, containerID, contain <ide> img.ContainerConfig = *containerConfig <ide> } <ide> <del> if err := graph.Register(nil, layerData, img); err != nil { <add> if err := graph.Register(img, nil, layerData); err != nil { <ide> return nil, err <ide> } <ide> return img, nil <ide> } <ide> <ide> // Register imports a pre-existing image into the graph. <del>// FIXME: pass img as first argument <del>func (graph *Graph) Register(jsonData []byte, layerData archive.ArchiveReader, img *image.Image) (err error) { <add>func (graph *Graph) Register(img *image.Image, jsonData []byte, layerData archive.ArchiveReader) (err error) { <ide> defer func() { <ide> // If any error occurs, remove the new dir from the driver. <ide> // Don't check for errors since the dir might not have been created. <ide><path>graph/load.go <ide> func (s *TagStore) recursiveLoad(eng *engine.Engine, address, tmpImageDir string <ide> } <ide> } <ide> } <del> if err := s.graph.Register(imageJson, layer, img); err != nil { <add> if err := s.graph.Register(img, imageJson, layer); err != nil { <ide> return err <ide> } <ide> } <ide><path>graph/pull.go <ide> func (s *TagStore) pullImage(r *registry.Session, out io.Writer, imgID, endpoint <ide> } <ide> defer layer.Close() <ide> <del> err = s.graph.Register(imgJSON, <del> utils.ProgressReader(layer, imgSize, out, sf, false, utils.TruncateID(id), "Downloading"), <del> img) <add> err = s.graph.Register(img, imgJSON, <add> utils.ProgressReader(layer, imgSize, out, sf, false, utils.TruncateID(id), "Downloading")) <ide> if terr, ok := err.(net.Error); ok && terr.Timeout() && j < retries { <ide> time.Sleep(time.Duration(j) * 500 * time.Millisecond) <ide> continue <ide><path>graph/service.go <ide> func (s *TagStore) CmdSet(job *engine.Job) engine.Status { <ide> if err != nil { <ide> return job.Error(err) <ide> } <del> if err := s.graph.Register(imgJSON, layer, img); err != nil { <add> if err := s.graph.Register(img, imgJSON, layer); err != nil { <ide> return job.Error(err) <ide> } <ide> return engine.StatusOK <ide><path>graph/tags_unit_test.go <ide> func mkTestTagStore(root string, t *testing.T) *TagStore { <ide> t.Fatal(err) <ide> } <ide> img := &image.Image{ID: testImageID} <del> if err := graph.Register(nil, archive, img); err != nil { <add> if err := graph.Register(img, nil, archive); err != nil { <ide> t.Fatal(err) <ide> } <ide> if err := store.Set(testImageName, "", testImageID, false); err != nil { <ide><path>integration/graph_test.go <ide> func TestInterruptedRegister(t *testing.T) { <ide> Created: time.Now(), <ide> } <ide> w.CloseWithError(errors.New("But I'm not a tarball!")) // (Nobody's perfect, darling) <del> graph.Register(nil, badArchive, image) <add> graph.Register(image, nil, badArchive) <ide> if _, err := graph.Get(image.ID); err == nil { <ide> t.Fatal("Image should not exist after Register is interrupted") <ide> } <ide> func TestInterruptedRegister(t *testing.T) { <ide> if err != nil { <ide> t.Fatal(err) <ide> } <del> if err := graph.Register(nil, goodArchive, image); err != nil { <add> if err := graph.Register(image, nil, goodArchive); err != nil { <ide> t.Fatal(err) <ide> } <ide> } <ide> func TestRegister(t *testing.T) { <ide> Comment: "testing", <ide> Created: time.Now(), <ide> } <del> err = graph.Register(nil, archive, image) <add> err = graph.Register(image, nil, archive) <ide> if err != nil { <ide> t.Fatal(err) <ide> } <ide> func TestDelete(t *testing.T) { <ide> t.Fatal(err) <ide> } <ide> // Test delete twice (pull -> rm -> pull -> rm) <del> if err := graph.Register(nil, archive, img1); err != nil { <add> if err := graph.Register(img1, nil, archive); err != nil { <ide> t.Fatal(err) <ide> } <ide> if err := graph.Delete(img1.ID); err != nil { <ide> func TestByParent(t *testing.T) { <ide> Created: time.Now(), <ide> Parent: parentImage.ID, <ide> } <del> _ = graph.Register(nil, archive1, parentImage) <del> _ = graph.Register(nil, archive2, childImage1) <del> _ = graph.Register(nil, archive3, childImage2) <add> _ = graph.Register(parentImage, nil, archive1) <add> _ = graph.Register(childImage1, nil, archive2) <add> _ = graph.Register(childImage2, nil, archive3) <ide> <ide> byParent, err := graph.ByParent() <ide> if err != nil {
6
Ruby
Ruby
replace "data store" with database [ci skip]
00824b09340e60c76d16550631ddccaecff03599
<ide><path>activerecord/lib/active_record/persistence.rb <ide> def discriminate_class_for_record(record) <ide> end <ide> <ide> # Returns true if this object hasn't been saved yet -- that is, a record <del> # for the object doesn't exist in the data store yet; otherwise, returns false. <add> # for the object doesn't exist in the database yet; otherwise, returns false. <ide> def new_record? <ide> sync_with_transaction_state <ide> @new_record
1
Javascript
Javascript
add test for transition.call
8cc290a00a12d742ed208ad8b8e3f8025d248b96
<ide><path>test/core/transition-test-call.js <add>require("../env"); <add>require("../../d3"); <add> <add>var assert = require("assert"); <add> <add>module.exports = { <add> topic: function() { <add> return d3.select("body").append("div").transition(); <add> }, <add> "calls the function once": function(transition) { <add> var count = 0; <add> transition.call(function() { ++count; }); <add> assert.equal(count, 1); <add> }, <add> "passes any optional arguments": function(transition) { <add> var abc; <add> transition.call(function(selection, a, b, c) { abc = [a, b, c]; }, "a", "b", "c"); <add> assert.deepEqual(abc, ["a", "b", "c"]); <add> }, <add> "passes the transition as the first argument": function(transition) { <add> var t; <add> transition.call(function(x) { t = x; }); <add> assert.isTrue(t === transition); <add> }, <add> "uses the transition as the context": function(transition) { <add> var t; <add> transition.call(function() { t = this; }); <add> assert.isTrue(t === transition); <add> }, <add> "returns the current transition": function(transition) { <add> assert.isTrue(transition.call(function() {}) === transition); <add> } <add>}; <ide><path>test/core/transition-test.js <ide> suite.addBatch({ <ide> "duration": require("./transition-test-duration"), <ide> <ide> // Control <del> "each": require("./transition-test-each") <add> "each": require("./transition-test-each"), <add> "call": require("./transition-test-call") <ide> // tween <del> // call <ide> <ide> }); <ide>
2
PHP
PHP
add reply-to on config for mailer
7b1474dcef74d1d0dd6bce8b73779c5508ed6be7
<ide><path>src/Illuminate/Mail/MailServiceProvider.php <ide> public function register() <ide> if (is_array($to) && isset($to['address'])) { <ide> $mailer->alwaysTo($to['address'], $to['name']); <ide> } <del> <add> <ide> $replyTo = $app['config']['mail.reply-to']; <ide> <ide> if (is_array($replyTo) && isset($replyTo['address'])) { <ide><path>src/Illuminate/Mail/Mailer.php <ide> class Mailer implements MailerContract, MailQueueContract <ide> * @var array <ide> */ <ide> protected $to; <del> <add> <ide> /** <ide> * The global reply-to address and name. <ide> * <ide> public function alwaysTo($address, $name = null) <ide> { <ide> $this->to = compact('address', 'name'); <ide> } <del> <add> <ide> /** <ide> * Set the global reply-to address and name. <ide> * <ide> protected function createMessage() <ide> if (! empty($this->from['address'])) { <ide> $message->from($this->from['address'], $this->from['name']); <ide> } <del> <add> <ide> // If a global reply-to address has been specified we will set it on every message <ide> // instances so the developer does not have to repeat themselves every time <ide> // they create a new message. We will just go ahead and push the address.
2
Ruby
Ruby
fix typo in --config.rb
0aea8d39e6a175a1cf6f81526928a2f4353cdc9a
<ide><path>Library/Homebrew/cmd/--config.rb <ide> def dump_build_config <ide> puts "/usr/bin/ruby => #{ruby.realpath}" unless ruby.realpath.to_s =~ %r{^/System} <ide> <ide> ponk = macports_or_fink_installed? <del> puts "MacPorts/Fink: #{ponk?}" if ponk <add> puts "MacPorts/Fink: #{ponk}" if ponk <ide> <ide> x11 = describe_x11 <ide> puts "X11: #{x11}" unless x11 == "/usr/X11"
1
Javascript
Javascript
give function names
c28bdec39586de3721c9e1d14a68696f4ac24159
<ide><path>packages/ember-handlebars/lib/helpers/binding.js <ide> var EmberHandlebars = Ember.Handlebars, helpers = EmberHandlebars.helpers; <ide> // Binds a property into the DOM. This will create a hook in DOM that the <ide> // KVO system will look for and update if the property changes. <ide> /** @private */ <del>var bind = function(property, options, preserveContext, shouldDisplay, valueNormalizer) { <add>function bind(property, options, preserveContext, shouldDisplay, valueNormalizer) { <ide> var data = options.data, <ide> fn = options.fn, <ide> inverse = options.inverse, <ide> var bind = function(property, options, preserveContext, shouldDisplay, valueNorm <ide> // be done with it. <ide> data.buffer.push(getPath(pathRoot, path, options)); <ide> } <del>}; <add>} <ide> <ide> /** <ide> '_triageMustache' is used internally select between a binding and helper for <ide><path>packages/ember-metal/lib/utils.js <ide> var GUID_DESC = { <ide> <ide> @returns {String} the guid <ide> */ <del>Ember.generateGuid = function(obj, prefix) { <add>Ember.generateGuid = function generateGuid(obj, prefix) { <ide> if (!prefix) prefix = 'ember'; <ide> var ret = (prefix + (uuid++)); <ide> if (obj) { <ide> Ember.generateGuid = function(obj, prefix) { <ide> @param obj {Object} any object, string, number, Element, or primitive <ide> @returns {String} the unique guid for this instance. <ide> */ <del>Ember.guidFor = function(obj) { <add>Ember.guidFor = function guidFor(obj) { <ide> <ide> // special cases where we don't want to add a key to object <ide> if (obj === undefined) return "(undefined)"; <ide> Ember.setMeta = function setMeta(obj, property, value) { <ide> (or meta property) if one does not already exist or if it's <ide> shared with its constructor <ide> */ <del>Ember.metaPath = function(obj, path, writable) { <add>Ember.metaPath = function metaPath(obj, path, writable) { <ide> var meta = Ember.meta(obj, writable), keyName, value; <ide> <ide> for (var i=0, l=path.length; i<l; i++) {
2
Python
Python
migrate the swao plugin to psutil 2.0
060de6439fee6b59ac48628ef1c93f03a539d284
<ide><path>glances/plugins/glances_mem.py <ide> def update(self): <ide> Update MEM (RAM) stats <ide> """ <ide> <del> # Grab CPU using the PSUtil cpu_times_percent method <del> # !!! the first time this function is called with interval = 0.0 or None <del> # !!! it will return a meaningless 0.0 value which you are supposed to ignore <add> # Grab MEM using the PSUtil virtual_memory method <ide> vm_stats = virtual_memory() <ide> <ide> # Get all the memory stats (copy/paste of the PsUtil documentation) <ide><path>glances/plugins/glances_memswap.py <ide> <ide> # Import system libs <ide> # Check for PSUtil already done in the glances_core script <del>import psutil <add>from psutil import swap_memory <ide> <ide> # from ..plugins.glances_plugin import GlancesPlugin <del>from glances_plugin import GlancesPlugin <add>from glances.plugins.glances_plugin import GlancesPlugin <ide> <ide> <ide> class Plugin(GlancesPlugin): <ide> def update(self): <ide> Update MEM (SWAP) stats <ide> """ <ide> <del> # SWAP <del> # psutil >= 0.6 <del> if hasattr(psutil, 'swap_memory'): <del> # Try... is an hack for issue #152 <del> try: <del> virtmem = psutil.swap_memory() <del> except Exception: <del> self.stats = {} <del> else: <del> self.stats = {'total': virtmem.total, <del> 'used': virtmem.used, <del> 'free': virtmem.free, <del> 'percent': virtmem.percent} <add> # Grab SWAP using the PSUtil swap_memory method <add> sm_stats = swap_memory() <ide> <del> # psutil < 0.6 <del> elif hasattr(psutil, 'virtmem_usage'): <del> virtmem = psutil.virtmem_usage() <del> self.stats = {'total': virtmem.total, <del> 'used': virtmem.used, <del> 'free': virtmem.free, <del> 'percent': virtmem.percent} <del> else: <del> self.stats = {} <add> # Get all the swap stats (copy/paste of the PsUtil documentation) <add> # total: total swap memory in bytes <add> # used: used swap memory in bytes <add> # free: free swap memory in bytes <add> # percent: the percentage usage <add> # sin: the number of bytes the system has swapped in from disk (cumulative) <add> # sout: the number of bytes the system has swapped out from disk (cumulative) <add> swap_stats = {} <add> for swap in ['total', 'used', 'free', 'percent', <add> 'sin', 'sout']: <add> if (hasattr(sm_stats, swap)): <add> swap_stats[swap] = getattr(sm_stats, swap) <add> <add> # Set the global variable to the new stats <add> self.stats = swap_stats <add> <add> return self.stats <ide> <ide> def msg_curse(self, args=None): <ide> """
2
Javascript
Javascript
document the new parameter
6dd7dcd83b568bde9b1f91256b6065ffa6fd3f4e
<ide><path>src/text-editor.js <ide> class TextEditor { <ide> // Controls where the view is positioned relative to the `TextEditorMarker`. <ide> // Values can be `'head'` (the default) or `'tail'` for overlay decorations, and <ide> // `'before'` (the default) or `'after'` for block decorations. <add> // * `order` (optional) Only applicable to decorations of type `block`. Controls <add> // where the view is positioned relative to other block decorations at the <add> // same screen row. If unspecified, block decorations render oldest to newest. <ide> // * `avoidOverflow` (optional) Only applicable to decorations of type <ide> // `overlay`. Determines whether the decoration adjusts its horizontal or <ide> // vertical position to remain fully visible when it would otherwise
1
Ruby
Ruby
add options missing from earlier changeset
91de20d6212b5203587d549ce2d63efcc5996eb0
<ide><path>activerecord/lib/active_record/test_case.rb <ide> <ide> module ActiveRecord <ide> class TestCase < ActiveSupport::TestCase #:nodoc: <del> self.fixture_path = FIXTURES_ROOT <del> self.use_instantiated_fixtures = false <add> self.fixture_path = FIXTURES_ROOT <add> self.use_instantiated_fixtures = false <add> self.use_transactional_fixtures = true <ide> <ide> def create_fixtures(*table_names, &block) <ide> Fixtures.create_fixtures(FIXTURES_ROOT, table_names, {}, &block)
1
Javascript
Javascript
add jdοΌˆζ‰‹ζœΊδΊ¬δΈœοΌ‰ to featured list in showcase
584bd0da24cf8fb8be29439063b1495bbc85d278
<ide><path>website/src/react-native/showcase.js <ide> var featured = [ <ide> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.sleeperbot&hl=en', <ide> infoLink: 'https://medium.com/sleeperbot-hq/switching-to-react-native-in-production-on-ios-and-android-e6b675402712#.cug6h6qhn', <ide> infoTitle: 'Switching to React Native in Production on iOS and Android', <add> }, <add> { <add> name: 'JDοΌˆζ‰‹ζœΊδΊ¬δΈœοΌ‰', <add> icon: 'https://lh3.googleusercontent.com/AIIAZsqyEG0KmCFruh1Ec374-2l7n1rfv_LG5RWjdAZOzUBCu-5MRqdLbzJfBnOdSFg=w300-rw', <add> linkAppStore: 'https://itunes.apple.com/cn/app/shou-ji-jing-dong-xin-ren/id414245413?mt=8', <add> linkPlayStore: 'https://app.jd.com/android.html', <add> infoLink: 'http://ir.jd.com/phoenix.zhtml?c=253315&p=irol-homeProfile', <add> infoTitle: 'JD.com is China’s largest ecommerce company by revenue and a member of the Fortune Global 500.', <ide> } <ide> ]; <ide>
1
PHP
PHP
remove test code
a39c52c67dae96854fe3addc95af68bddd95cb98
<ide><path>routes/web.php <ide> */ <ide> <ide> Route::get('/', function () { <del> dd(env('REDIS_PORT')); <ide> return view('welcome'); <ide> });
1
Java
Java
fix broken javadoc tags
ab2c78a9d58f38a5cc7f8e9ba27555b9ee2aa65a
<ide><path>spring-core/src/main/java/org/springframework/util/ClassUtils.java <ide> public static Method getInterfaceMethodIfPossible(Method method) { <ide> * Note that, despite being synthetic, bridge methods ({@link Method#isBridge()}) are considered <ide> * as user-level methods since they are eventually pointing to a user-declared generic method. <ide> * @param method the method to check <del> * @return {@code true} if the method can be considered as user-declared; [@code false} otherwise <add> * @return {@code true} if the method can be considered as user-declared; {@code false} otherwise <ide> */ <ide> public static boolean isUserLevelMethod(Method method) { <ide> Assert.notNull(method, "Method must not be null"); <ide><path>spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompClientSupport.java <ide> * Base class for STOMP client implementations. <ide> * <ide> * <p>Subclasses can connect over WebSocket or TCP using any library. When creating <del> * a new connection, a subclass can create an instance of @link DefaultStompSession} <add> * a new connection, a subclass can create an instance of {@link DefaultStompSession} <ide> * which extends {@link org.springframework.messaging.tcp.TcpConnectionHandler} <ide> * whose lifecycle methods the subclass must then invoke. <ide> * <ide><path>spring-r2dbc/src/main/java/org/springframework/r2dbc/connection/R2dbcTransactionManager.java <ide> public class R2dbcTransactionManager extends AbstractReactiveTransactionManager <ide> <ide> <ide> /** <del> * Create a new @link ConnectionFactoryTransactionManager} instance. <add> * Create a new {@link R2dbcTransactionManager} instance. <ide> * A ConnectionFactory has to be set to be able to use it. <ide> * @see #setConnectionFactory <ide> */ <ide><path>spring-r2dbc/src/main/java/org/springframework/r2dbc/connection/SingleConnectionFactory.java <ide> public SingleConnectionFactory(String url, boolean suppressClose) { <ide> * @param target underlying target {@link Connection}. <ide> * @param metadata {@link ConnectionFactory} metadata to be associated with this {@link ConnectionFactory}. <ide> * @param suppressClose if the {@link Connection} should be wrapped with a {@link Connection} that suppresses <del> * @code close()} calls (to allow for normal {@code close()} usage in applications that expect a pooled <del> * @link Connection}). <add> * {@code close()} calls (to allow for normal {@code close()} usage in applications that expect a pooled <add> * {@link Connection}). <ide> */ <ide> public SingleConnectionFactory(Connection target, ConnectionFactoryMetadata metadata, boolean suppressClose) { <ide> super(new ConnectionFactory() { <ide><path>spring-web/src/main/java/org/springframework/web/bind/annotation/CrossOrigin.java <ide> <ide> /** <ide> * Alternative to {@link #origins()} that supports more flexible origins <del> * patterns. Please, see @link CorsConfiguration#setAllowedOriginPatterns(List)} <add> * patterns. Please, see {@link CorsConfiguration#setAllowedOriginPatterns(List)} <ide> * for details. <ide> * <p>By default this is not set. <ide> * @since 5.3 <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/view/groovy/GroovyMarkupViewResolver.java <ide> import org.springframework.web.servlet.view.AbstractUrlBasedView; <ide> <ide> /** <del> * Convenience subclass of @link AbstractTemplateViewResolver} that supports <add> * Convenience subclass of {@link AbstractTemplateViewResolver} that supports <ide> * {@link GroovyMarkupView} (i.e. Groovy XML/XHTML markup templates) and <ide> * custom subclasses of it. <ide> *
6
Javascript
Javascript
add formatdatetime back into ti log
8fa976e514a411a1ecefa011f57416cf1fe09702
<ide><path>airflow/www/static/js/ti_log.js <ide> /* global document, window, $, */ <ide> import { escapeHtml } from './main'; <ide> import getMetaValue from './meta_value'; <add>import { formatDateTime } from './datetime_utils'; <ide> <ide> const executionDate = getMetaValue('execution_date'); <ide> const dagId = getMetaValue('dag_id'); <ide> function autoTailingLog(tryNumber, metadata = null, autoTailing = false) { <ide> const escapedMessage = escapeHtml(item[1]); <ide> const linkifiedMessage = escapedMessage <ide> .replace(urlRegex, (url) => `<a href="${url}" target="_blank">${url}</a>`) <del> .replaceAll(dateRegex, (date) => `<time datetime="${date}+00:00">${date}+00:00</time>`); <add> .replaceAll(dateRegex, (date) => `<time datetime="${date}+00:00">${formatDateTime(`${date}+00:00`)}</time>`); <ide> logBlock.innerHTML += `${linkifiedMessage}\n`; <ide> }); <ide>
1
Text
Text
update translation linear-search
ae66b222950da57458a6ce51cb0db0f30190cc10
<ide><path>guide/portuguese/algorithms/search-algorithms/linear-search/index.md <ide> def linear_search(array, num): <ide> return -1 <ide> ``` <ide> <add>### Exemplo em Swift <add>```swift <add>func linearSearch(for number: Int, in array: [Int]) -> Int? { <add> for (index, value) in array.enumerated() { <add> if value == number { return index } // return the index of the number <add> } <add> return nil // the number was not found in the array <add>} <add>``` <add> <add>### Exemplo em Java <add>```java <add>int linearSearch(int[] arr, int element) <add>{ <add> for(int i=0;i<arr.length;i++) <add> { <add> if(arr[i] == element) <add> return i; <add> } <add> return -1; <add>} <add> <add>``` <add> <add>### Exemplo em PHP <add> <add>```php <add>function linear_search($arr=[],$num=0) <add>{ <add> $n = count($arr); <add> for( $i=0; $i<$n; $i++){ <add> if($arr[$i] == $num) <add> return $i; <add> } <add> // Item not found in the array <add> return -1; <add>} <add> <add>$arr = array(1,3,2,8,5,7,4,0); <add>print("Linear search result for 2: "); <add>echo linear_search($arr,2); <add> <add>``` <add> <ide> ## Pesquisa Linear Global <ide> <ide> E se vocΓͺ estiver pesquisando as vΓ‘rias ocorrΓͺncias de um elemento? Por exemplo, vocΓͺ quer ver quantos 5 estΓ£o em uma matriz. <ide> NΓ£o hΓ‘ dΓΊvida de que a busca linear Γ© simples, mas porque compara cada eleme <ide> <ide> #### Outros recursos <ide> <del>[Pesquisa Linear - CS50](https://www.youtube.com/watch?v=vZWfKBdSgXI) <ide>\ No newline at end of file <add>[Pesquisa Linear - CS50](https://www.youtube.com/watch?v=vZWfKBdSgXI)
1
Text
Text
add release notes for 1.3
399a7afafefb8818f255d5b9e6a42b2b57aabf97
<ide><path>CHANGELOG.md <add><a name="1.3.0"></a> <add># 1.3.0 superluminal-nudge (2014-10-13) <add> <add> <add>## Bug Fixes <add> <add>- **$browser:** <add> - account for IE deserializing history.state on each read <add> ([1efaf3dc](https://github.com/angular/angular.js/commit/1efaf3dc136f822703a9cda55afac7895a923ccb), <add> [#9587](https://github.com/angular/angular.js/issues/9587), [#9545](https://github.com/angular/angular.js/issues/9545)) <add> - do not decode cookies that do not appear encoded <add> ([9c995905](https://github.com/angular/angular.js/commit/9c9959059eb84f0f1d748b70b50ec47b7d23d065), <add> [#9211](https://github.com/angular/angular.js/issues/9211), [#9225](https://github.com/angular/angular.js/issues/9225)) <add>- **$http:** <add> - allow empty json response <add> ([9ba24c54](https://github.com/angular/angular.js/commit/9ba24c54d60e643b1450cc5cfa8f990bd524c130), <add> [#9532](https://github.com/angular/angular.js/issues/9532), [#9562](https://github.com/angular/angular.js/issues/9562)) <add> - don't run transformData on HEAD methods <add> ([6e4955a3](https://github.com/angular/angular.js/commit/6e4955a3086555d8ca30c29955faa213b39c6f27), <add> [#9528](https://github.com/angular/angular.js/issues/9528), [#9529](https://github.com/angular/angular.js/issues/9529)) <add>- **$injector:** ensure $get method invoked with provider context <add> ([372fa699](https://github.com/angular/angular.js/commit/372fa6993b2b1b4848aa4be3c3e11f69244fca6f), <add> [#9511](https://github.com/angular/angular.js/issues/9511), [#9512](https://github.com/angular/angular.js/issues/9512)) <add>- **$location:** use clone of passed search() object <add> ([c7a9009e](https://github.com/angular/angular.js/commit/c7a9009e143299f0e45a85d715ff22fc676d3f93), <add> [#9445](https://github.com/angular/angular.js/issues/9445)) <add>- **$parse:** stabilize one-time literal expressions correctly <add> ([874cac82](https://github.com/angular/angular.js/commit/874cac825bf29a936cb1b35f9af239687bc5e036)) <add>- **formController:** remove scope reference when form is destroyed <add> ([01f50e1a](https://github.com/angular/angular.js/commit/01f50e1a7b2bff7070616494774ec493f8133204), <add> [#9315](https://github.com/angular/angular.js/issues/9315)) <add>- **jqLite:** remove native listener when all jqLite listeners were deregistered <add> ([d71fb6f2](https://github.com/angular/angular.js/commit/d71fb6f2713f1a636f6e9c25479870ee9941ad18), <add> [#9509](https://github.com/angular/angular.js/issues/9509)) <add>- **select:** <add> - add basic track by and select as support <add> ([addfff3c](https://github.com/angular/angular.js/commit/addfff3c46311f59bdcd100351260006d457316f), <add> [#6564](https://github.com/angular/angular.js/issues/6564)) <add> - manage select controller options correctly <add> ([2435e2b8](https://github.com/angular/angular.js/commit/2435e2b8f84fde9495b8e9440a2b4f865b1ff541), <add> [#9418](https://github.com/angular/angular.js/issues/9418)) <add> <add> <add>## Features <add> <add>- **$anchorScroll:** support a configurable vertical scroll offset <add> ([09c39d2c](https://github.com/angular/angular.js/commit/09c39d2ce687cdf0ac35dbb34a91f0d198c9d83a), <add> [#9368](https://github.com/angular/angular.js/issues/9368), [#2070](https://github.com/angular/angular.js/issues/2070), [#9360](https://github.com/angular/angular.js/issues/9360)) <add>- **$animate:** <add> - introduce the $animate.animate() method <add> ([02be700b](https://github.com/angular/angular.js/commit/02be700bda191b454de393f2805916f374a1d764)) <add> - allow $animate to pass custom styles into animations <add> ([e5f4d7b1](https://github.com/angular/angular.js/commit/e5f4d7b10ae5e6a17ab349995451c33b7d294245)) <add>- **currencyFilter:** add fractionSize as optional parameter <add> ([20685ffe](https://github.com/angular/angular.js/commit/20685ffe11036d4d604d13f0d792ca46497af4a1), <add> [#3642](https://github.com/angular/angular.js/issues/3642), [#3461](https://github.com/angular/angular.js/issues/3461), [#3642](https://github.com/angular/angular.js/issues/3642), [#7922](https://github.com/angular/angular.js/issues/7922)) <add>- **jqLite:** add private jqDocumentComplete function <add> ([0dd316ef](https://github.com/angular/angular.js/commit/0dd316efea209e5e5de3e456b4e6562f011a1294)) <add> <add> <add>## Breaking Changes <add> <add>- **$animate:** due to [e5f4d7b1](https://github.com/angular/angular.js/commit/e5f4d7b10ae5e6a17ab349995451c33b7d294245), <add> staggering animations that use transitions will now <add>always block the transition from starting (via `transition: 0s none`) <add>up until the stagger step kicks in. The former behaviour was that the <add>block was removed as soon as the pending class was added. This fix <add>allows for styles to be applied in the pending class without causing <add>an animation to trigger prematurely. <add> <add> <add> <ide> <a name="1.3.0-rc.5"></a> <ide> # 1.3.0-rc.5 impossible-choreography (2014-10-08) <ide>
1
Text
Text
clarify the section about dogfooding
6c9da395144d7595f9ef8eff522d1d3d22b8b420
<ide><path>docs/contributing/design-principles.md <ide> If we want to deprecate a pattern that we don't like, it is our responsibility t <ide> <ide> ### Stability <ide> <del>We value API stability because at Facebook we have more than 20 thousand components using React. This means that we are reluctant to change public APIs or behavior because teams depend on it both externally and internally. <add>We value API stability. At Facebook, we have more than 20 thousand components using React. Many other companies, including [Twitter](https://twitter.com/) and [Airbnb](https://www.airbnb.com/), are also heavy users of React. This is why we are usually reluctant to change public APIs or behavior. <ide> <ide> However we think stability in the sense of "nothing changes" is overrated. It quickly turns into stagnation. Instead, we prefer the stability in the sense of "It is heavily used in production, and when something changes, there is a clear (and preferably automated) migration path." <ide> <ide> When we deprecate a pattern, we study its internal usage at Facebook and add deprecation warnings. They let us assess the impact of the change. Sometimes we back out if we see that it is too early, and we need to think more strategically about getting the codebases to the point where they are ready for this change. <ide> <add>If we are confident that the change is not too disruptive and the migration strategy is viable for all use cases, we release the deprecation warning to the open source community. We are closely in touch with many users of React outside of Facebook, and we monitor popular open source projects and guide them in fixing those deprecations. <add> <add>Given the sheer size of the Facebook React codebase, successful internal migration is often a good indicator that other companies won't have problems either. Nevertheless sometimes people point out additional use cases we haven't thought of, and we add escape hatches for them or rethink our approach. <add> <ide> We don't deprecate anything without a good reason. We recognize that sometimes deprecations warnings cause frustration but we add them because deprecations clean up the road for the improvements and new features that we and many people in the community consider valuable. <ide> <ide> For example, we added a [warning about unknown DOM props](/react/warnings/unknown-prop.html) in React 15.2.0. Many projects were affected by this. However fixing this warning is important so that we can introduce the support for [custom attributes](https://github.com/facebook/react/issues/140) to React. There is a reason like this behind every deprecation that we add. <ide> Optimizing for search is also important because of our reliance on [codemods](ht <ide> <ide> In our codebase, JSX provides an unambigious hint to the tools that they are dealing with a React element tree. This makes it possible to add build-time optimizations such as [hoisting constant elements](http://babeljs.io/docs/plugins/transform-react-constant-elements/), safely lint and codemod internal component usage, and [include JSX source location](https://github.com/facebook/react/pull/6771) into the warnings. <ide> <del>### Driven by Facebook <del> <del>Ultimately React is driven by the needs of Facebook. We are more likely to spend time and energy on issues with React that people using it at Facebook are experiencing internally. <add>### Dogfooding <ide> <del>We think there are two ways to look at it. You could say that React is a Facebook project, and is not driven by the community. In a way, this is true. <add>We try our best to address the problems raised by the community. However we are likely to prioritize the issues that people are *also* experiencing internally at Facebook. Perhaps counter-intuitively, we think this is the main reason why the community can bet on React. <ide> <del>Another way to look at it is that it's very hard to make a large group of people happy. It is often recommended that you pick a small audience, focus on making them happy, and this will bring a positive net effect. So far we have found that solving the problems encountered by Facebook product teams translates well to the open source community. If you're building apps with dynamic UI comparable to the Facebook products, you might find that React solves your problems as well. <add>Heavy internal usage gives us the confidence that React won't disappear tomorrow. React was created at Facebook to solve its problems. It brings tangible business value to the company and is used in many of its products. [Dogfooding](https://en.wikipedia.org/wiki/Eating_your_own_dog_food) it means that our vision stays sharp and we have a focused direction going forward. <ide> <del>If you want to help us and implement a feature, fix a bug, or contribute to the documentation, we are excited to consider your contributions. React is a community project in the sense that pull requests are very welcome. However we encourage you to discuss your proposal in an issue first so that we can communicate the priority of your issue for us, and whether we agree with your general direction. <add>This doesn't mean that we ignore the issues raised by the community. For example, we added support for [web components](/react/docs/webcomponents.html) and [SVG](https://github.com/facebook/react/pull/6243) to React even though we don't rely on either of them internally. We are actively [listening to your pain points](https://github.com/facebook/react/issues/2686) and [address them](/react/blog/2016/07/11/introducing-reacts-error-code-system.html) to the best of our ability. The community is what makes React special to us, and we are honored to contribute back. <ide> <del>The downside of this approach is that we don't focus as much on things that Facebook teams don't have to deal with, such as the "getting started" experience. We are acutely aware of this and are trying to find the right balance between things that matter to Facebook and things that matter to the community. When we do a bad job at it, we rely on you to step up and plug the holes. <add>After releasing many open source projects at Facebook, we have learned that trying to make everyone happy at the same time produced projects with poor focus that didn't grow well. Instead, we found that picking a small audience and focusing on making them happy brings a positive net effect. That's exactly what we did with React, and so far solving the problems encountered by Facebook product teams has translated well to the open source community. <ide> <del>Thank you for helping us. <add>The downside of this approach is that sometimes we fail to give enough focus to the things that Facebook teams don't have to deal with, such as the "getting started" experience. We are acutely aware of this, and we are thinking of how to improve in a way that would benefit everyone in the community without making the same mistakes we did with open source projects before.
1
Java
Java
fix bad javadoc link
317662465fe7c8f5ae7c9541b4bb05a06a0e524e
<ide><path>src/main/java/io/reactivex/package-info.java <ide> * {@link io.reactivex.Flowable}, {@link io.reactivex.Observable}, {@link io.reactivex.Single} <ide> * or {@link io.reactivex.Completable} class which then allow consumers to subscribe to them <ide> * and receive events.</p> <del> * <p>Usage examples can be found on the {@link rx.Observable} and {@link org.reactivestreams.Subscriber} classes.</p> <add> * <p>Usage examples can be found on the {@link io.reactivex.Flowable}/{@link io.reactivex.Observable} and {@link org.reactivestreams.Subscriber} classes.</p> <ide> */ <ide> package io.reactivex; <ide>
1
Go
Go
fix flaky testapistatsnostreamgetcpu
c141574d5d9ea7bb5188764d5d193450dc2b9bc8
<ide><path>integration-cli/docker_api_stats_test.go <ide> import ( <ide> var expectedNetworkInterfaceStats = strings.Split("rx_bytes rx_dropped rx_errors rx_packets tx_bytes tx_dropped tx_errors tx_packets", " ") <ide> <ide> func (s *DockerSuite) TestAPIStatsNoStreamGetCpu(c *check.C) { <del> out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "while true;do echo 'Hello'; usleep 100000; done") <add> out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "while true;usleep 100; do echo 'Hello'; done") <ide> <ide> id := strings.TrimSpace(out) <ide> c.Assert(waitRun(id), checker.IsNil) <del> <ide> resp, body, err := request.Get(fmt.Sprintf("/containers/%s/stats?stream=false", id)) <ide> c.Assert(err, checker.IsNil) <ide> c.Assert(resp.StatusCode, checker.Equals, http.StatusOK)
1
Python
Python
enable specifying api version
f4caab373b18e3c02cdfe3e4580cb03efb7a9199
<ide><path>libcloud/common/dimensiondata.py <ide> class DimensionDataConnection(ConnectionUserAndKey): <ide> allow_insecure = False <ide> <ide> def __init__(self, user_id, key, secure=True, host=None, port=None, <del> url=None, timeout=None, proxy_url=None, **conn_kwargs): <add> url=None, timeout=None, proxy_url=None, <add> api_version=None, **conn_kwargs): <ide> super(DimensionDataConnection, self).__init__( <ide> user_id=user_id, <ide> key=key, <ide> def __init__(self, user_id, key, secure=True, host=None, port=None, <ide> if conn_kwargs['region']: <ide> self.host = conn_kwargs['region']['host'] <ide> <add> if api_version: <add> if api_version.startswith('2'): <add> self.api_version_2 = api_version <add> <ide> def add_default_headers(self, headers): <ide> headers['Authorization'] = \ <ide> ('Basic %s' % b64encode(b('%s:%s' % (self.user_id, <ide><path>libcloud/compute/drivers/dimensiondata.py <ide> def __init__(self, key, secret=None, secure=True, host=None, port=None, <ide> if region is not None: <ide> self.selected_region = API_ENDPOINTS[region] <ide> <add> if api_version is not None: <add> self.api_version = api_version <add> <ide> super(DimensionDataNodeDriver, self).__init__(key=key, secret=secret, <ide> secure=secure, host=host, <ide> port=port, <ide> def _ex_connection_class_kwargs(self): <ide> kwargs = super(DimensionDataNodeDriver, <ide> self)._ex_connection_class_kwargs() <ide> kwargs['region'] = self.selected_region <add> kwargs['api_version'] = self.api_version <ide> return kwargs <ide> <ide> def _create_node_mcp1(self, name, image, auth, ex_description,
2
Python
Python
add register method to autoprocessor
cdc51ffd27f8f5a3151da161ae2b5dbb410d2803
<ide><path>src/transformers/models/auto/processing_auto.py <ide> def processor_class_from_name(class_name: str): <ide> <ide> module = importlib.import_module(f".{module_name}", "transformers.models") <ide> return getattr(module, class_name) <del> break <add> <add> for processor in PROCESSOR_MAPPING._extra_content.values(): <add> if getattr(processor, "__name__", None) == class_name: <add> return processor <ide> <ide> return None <ide> <ide> def from_pretrained(cls, pretrained_model_name_or_path, **kwargs): <ide> f"its {FEATURE_EXTRACTOR_NAME}, or one of the following `model_type` keys in its {CONFIG_NAME}: " <ide> f"{', '.join(c for c in PROCESSOR_MAPPING_NAMES.keys())}" <ide> ) <add> <add> @staticmethod <add> def register(config_class, processor_class): <add> """ <add> Register a new processor for this class. <add> <add> Args: <add> config_class ([`PretrainedConfig`]): <add> The configuration corresponding to the model to register. <add> processor_class ([`FeatureExtractorMixin`]): The processor to register. <add> """ <add> PROCESSOR_MAPPING.register(config_class, processor_class) <ide><path>tests/test_processor_auto.py <ide> <ide> from huggingface_hub import Repository, delete_repo, login <ide> from requests.exceptions import HTTPError <del>from transformers import AutoProcessor, AutoTokenizer, Wav2Vec2Config, Wav2Vec2FeatureExtractor, Wav2Vec2Processor <add>from transformers import ( <add> CONFIG_MAPPING, <add> FEATURE_EXTRACTOR_MAPPING, <add> PROCESSOR_MAPPING, <add> TOKENIZER_MAPPING, <add> AutoConfig, <add> AutoFeatureExtractor, <add> AutoProcessor, <add> AutoTokenizer, <add> Wav2Vec2Config, <add> Wav2Vec2FeatureExtractor, <add> Wav2Vec2Processor, <add>) <ide> from transformers.file_utils import FEATURE_EXTRACTOR_NAME, is_tokenizers_available <ide> from transformers.testing_utils import PASS, USER, is_staging_test <ide> from transformers.tokenization_utils import TOKENIZER_CONFIG_FILE <ide> <ide> <ide> sys.path.append(str(Path(__file__).parent.parent / "utils")) <ide> <add>from test_module.custom_configuration import CustomConfig # noqa E402 <ide> from test_module.custom_feature_extraction import CustomFeatureExtractor # noqa E402 <ide> from test_module.custom_processing import CustomProcessor # noqa E402 <ide> from test_module.custom_tokenization import CustomTokenizer # noqa E402 <ide> <ide> <ide> class AutoFeatureExtractorTest(unittest.TestCase): <add> vocab_tokens = ["[UNK]", "[CLS]", "[SEP]", "[PAD]", "[MASK]", "bla", "blou"] <add> <ide> def test_processor_from_model_shortcut(self): <ide> processor = AutoProcessor.from_pretrained("facebook/wav2vec2-base-960h") <ide> self.assertIsInstance(processor, Wav2Vec2Processor) <ide> def test_from_pretrained_dynamic_processor(self): <ide> else: <ide> self.assertEqual(tokenizer.__class__.__name__, "NewTokenizer") <ide> <add> def test_new_processor_registration(self): <add> try: <add> AutoConfig.register("custom", CustomConfig) <add> AutoFeatureExtractor.register(CustomConfig, CustomFeatureExtractor) <add> AutoTokenizer.register(CustomConfig, slow_tokenizer_class=CustomTokenizer) <add> AutoProcessor.register(CustomConfig, CustomProcessor) <add> # Trying to register something existing in the Transformers library will raise an error <add> with self.assertRaises(ValueError): <add> AutoProcessor.register(Wav2Vec2Config, Wav2Vec2Processor) <add> <add> # Now that the config is registered, it can be used as any other config with the auto-API <add> feature_extractor = CustomFeatureExtractor.from_pretrained(SAMPLE_PROCESSOR_CONFIG_DIR) <add> <add> with tempfile.TemporaryDirectory() as tmp_dir: <add> vocab_file = os.path.join(tmp_dir, "vocab.txt") <add> with open(vocab_file, "w", encoding="utf-8") as vocab_writer: <add> vocab_writer.write("".join([x + "\n" for x in self.vocab_tokens])) <add> tokenizer = CustomTokenizer(vocab_file) <add> <add> processor = CustomProcessor(feature_extractor, tokenizer) <add> <add> with tempfile.TemporaryDirectory() as tmp_dir: <add> processor.save_pretrained(tmp_dir) <add> new_processor = AutoProcessor.from_pretrained(tmp_dir) <add> self.assertIsInstance(new_processor, CustomProcessor) <add> <add> finally: <add> if "custom" in CONFIG_MAPPING._extra_content: <add> del CONFIG_MAPPING._extra_content["custom"] <add> if CustomConfig in FEATURE_EXTRACTOR_MAPPING._extra_content: <add> del FEATURE_EXTRACTOR_MAPPING._extra_content[CustomConfig] <add> if CustomConfig in TOKENIZER_MAPPING._extra_content: <add> del TOKENIZER_MAPPING._extra_content[CustomConfig] <add> if CustomConfig in PROCESSOR_MAPPING._extra_content: <add> del PROCESSOR_MAPPING._extra_content[CustomConfig] <add> <ide> <ide> @is_staging_test <ide> class ProcessorPushToHubTester(unittest.TestCase):
2
Text
Text
fix typos in contributing.md
c553c3ec575033e28e514acded2d0bce0dacd4fc
<ide><path>CONTRIBUTING.md <ide> of documentation fix), then feel free to open a PR without discussion. <ide> ### The small print <ide> <ide> Contributions made by corporations are covered by a different agreement than <del>the one above, the <add>the one above, see the <ide> [Software Grant and Corporate Contributor License Agreement]( <ide> https://cla.developers.google.com/about/google-corporate). <ide> <ide> ### Tools needed for development <ide> <del>1. [Bazel](https://bazel.build/) is the tool to build and test Keras project. <del> See [installtation guild](https://docs.bazel.build/versions/4.0.0/install.html) <add>1. [Bazel](https://bazel.build/) is the tool to build and test Keras. <add> See the [installation guide](https://docs.bazel.build/versions/4.0.0/install.html) <ide> for how to install and config bazel for your local environment. <ide> 2. [git](https://github.com/) for code repository management. <del>3. [python](https://www.python.org/) for build and test Keras project. <add>3. [python](https://www.python.org/) to build and code in Keras. <ide> <del>### Setup and check local workspace <add>### Setup and configure local workspace <ide> <ide> Using Apple Mac as an example (and linux will be very similar), the following <ide> commands set up and check the configuration of a local workspace. <ide> scottzhu-macbookpro2:~ scottzhu$ mkdir workspace <ide> scottzhu-macbookpro2:~ scottzhu$ cd workspace/ <ide> ``` <ide> <del>### Download keras code and setup virtual environment <add>### Download code and set up virtual environment <ide> <ide> A [Python virtual environment](https://docs.python.org/3/tutorial/venv.html) is a <ide> powerful tool to create a self-contained environment that isolates any change <ide> INFO: Build completed successfully, 20 total actions <ide> INFO: Build completed successfully, 20 total actions <ide> ``` <ide> <del>### Creating PR and wait for review <add>### Create a PR and wait for review <ide> <ide> Once the local change is made and verified with tests, you can open a PR in <ide> [keras-team/keras](https://github.com/keras-team/keras). After the PR is sent,
1
Javascript
Javascript
add a separate button for logging values
5b120d6b24e29972ec8bc8b00638051c55f08a43
<ide><path>src/backend/agent.js <ide> export default class Agent extends EventEmitter { <ide> bridge.addListener('getProfilingSummary', this.getProfilingSummary); <ide> bridge.addListener('highlightElementInDOM', this.highlightElementInDOM); <ide> bridge.addListener('inspectElement', this.inspectElement); <add> bridge.addListener('logElementToConsole', this.logElementToConsole); <ide> bridge.addListener('overrideContext', this.overrideContext); <ide> bridge.addListener('overrideHookState', this.overrideHookState); <ide> bridge.addListener('overrideProps', this.overrideProps); <ide> export default class Agent extends EventEmitter { <ide> } <ide> }; <ide> <add> logElementToConsole = ({ id, rendererID }: InspectSelectParams) => { <add> const renderer = this._rendererInterfaces[rendererID]; <add> if (renderer == null) { <add> console.warn(`Invalid renderer id "${rendererID}" for element "${id}"`); <add> } else { <add> renderer.logElementToConsole(id); <add> } <add> }; <add> <ide> reloadAndProfile = () => { <ide> localStorage.setItem(LOCAL_STORAGE_RELOAD_AND_PROFILE_KEY, 'true'); <ide> <ide><path>src/backend/renderer.js <ide> export function attach( <ide> // Can view component source location. <ide> canViewSource, <ide> <add> displayName: getDataForFiber(fiber).displayName, <add> <ide> // Inspectable properties. <ide> // TODO Review sanitization approach for the below inspectable values. <ide> context, <ide> export function attach( <ide> return result; <ide> } <ide> <add> function logElementToConsole(id) { <add> const result = inspectElementRaw(id); <add> if (result === null) { <add> console.warn(`Could not find Fiber with id "${id}"`); <add> return; <add> } <add> <add> const supportsGroup = typeof console.groupCollapsed === 'function'; <add> const label = <add> '[Click to expand] <' + (result.displayName || 'Component') + ' />'; <add> <add> if (supportsGroup) { <add> console.groupCollapsed(label); <add> } <add> if (result.props !== null) { <add> console.log('Props:', result.props); <add> } <add> if (result.state !== null) { <add> console.log('State:', result.state); <add> } <add> if (result.hooks !== null) { <add> console.log('Hooks:', result.hooks); <add> } <add> const nativeNode = findNativeByFiberID(id); <add> if (nativeNode !== null) { <add> console.log('Node:', nativeNode); <add> } <add> if (window.chrome || /firefox/i.test(navigator.userAgent)) { <add> console.log( <add> 'Right-click any value to save it as a global variable for further inspection.' <add> ); <add> } <add> if (supportsGroup) { <add> console.groupEnd(); <add> } <add> } <add> <ide> function setInHook( <ide> id: number, <ide> index: number, <ide> export function attach( <ide> handleCommitFiberRoot, <ide> handleCommitFiberUnmount, <ide> inspectElement, <add> logElementToConsole, <ide> prepareViewElementSource, <ide> overrideSuspense, <ide> renderer, <ide><path>src/backend/types.js <ide> export type RendererInterface = { <ide> handleCommitFiberRoot: (fiber: Object) => void, <ide> handleCommitFiberUnmount: (fiber: Object) => void, <ide> inspectElement: (id: number) => InspectedElement | null, <add> logElementToConsole: (id: number) => void, <ide> overrideSuspense: (id: number, forceFallback: boolean) => void, <ide> prepareViewElementSource: (id: number) => void, <ide> renderer: ReactRenderer | null, <ide><path>src/devtools/views/ButtonIcon.js <ide> export type IconType = <ide> | 'export' <ide> | 'filter' <ide> | 'import' <add> | 'log-data' <ide> | 'more' <ide> | 'next' <ide> | 'previous' <ide> export default function ButtonIcon({ type }: Props) { <ide> case 'import': <ide> pathData = PATH_IMPORT; <ide> break; <add> case 'log-data': <add> pathData = PATH_EXPORT; // TODO: real icon <add> break; <ide> case 'more': <ide> pathData = PATH_MORE; <ide> break; <ide><path>src/devtools/views/Components/SelectedElement.js <ide> export default function SelectedElement(_: Props) { <ide> const inspectedElement = useInspectedElement(selectedElementID); <ide> <ide> const highlightElement = useCallback(() => { <del> if (element !== null && selectedElementID !== null) { <del> const rendererID = <del> store.getRendererIDForElement(selectedElementID) || null; <add> const id = selectedElementID; <add> if (element !== null && id !== null) { <add> const rendererID = store.getRendererIDForElement(id); <ide> if (rendererID !== null) { <ide> bridge.send('highlightElementInDOM', { <ide> displayName: element.displayName, <ide> hideAfterTimeout: true, <del> id: selectedElementID, <add> id, <ide> rendererID, <ide> scrollIntoView: true, <ide> }); <ide> } <ide> } <ide> }, [bridge, element, selectedElementID, store]); <ide> <add> const logElement = useCallback(() => { <add> const id = selectedElementID; <add> if (id !== null) { <add> const rendererID = store.getRendererIDForElement(id); <add> if (rendererID !== null) { <add> bridge.send('logElementToConsole', { <add> id, <add> rendererID, <add> }); <add> } <add> } <add> }, [bridge, selectedElementID, store]); <add> <ide> const viewSource = useCallback(() => { <ide> if (viewElementSource != null && selectedElementID !== null) { <ide> viewElementSource(selectedElementID); <ide> export default function SelectedElement(_: Props) { <ide> > <ide> <ButtonIcon type="view-dom" /> <ide> </Button> <add> <Button <add> className={styles.IconButton} <add> onClick={logElement} <add> title="Log this component data to the console" <add> > <add> <ButtonIcon type="log-data" /> <add> </Button> <ide> <Button <ide> className={styles.IconButton} <ide> disabled={!canViewSource} <ide><path>src/devtools/views/Components/types.js <ide> export type InspectedElement = {| <ide> <ide> // Location of component in source coude. <ide> source: Object | null, <add> <add> displayName: string | null, <ide> |}; <ide> <ide> // TODO: Add profiling type
6
Javascript
Javascript
fix dropdown [ci skip]
bb62e3c8fcdcf5c8b1d3da8104b68577981ec97b
<ide><path>website/src/components/dropdown.js <ide> import { navigate } from 'gatsby' <ide> import classes from '../styles/dropdown.module.sass' <ide> <ide> export default function Dropdown({ defaultValue, className, onChange, children }) { <del> const defaultOnChange = ({ target }) => navigate(target.value) <add> const defaultOnChange = ({ target }) => { <add> const isExternal = /((http(s?)):\/\/|mailto:)/gi.test(target.value) <add> if (isExternal) { <add> window.location.href = target.value <add> } else { <add> navigate(target.value) <add> } <add> } <ide> return ( <ide> <select <ide> defaultValue={defaultValue}
1
Javascript
Javascript
fix locale name
e96809208c9d1b1bbe22d605e76985770024de42
<ide><path>src/locale/ar-ly.js <ide> //! moment.js locale configuration <del>//! locale : Arabic (Lybia) [ar-ly] <add>//! locale : Arabic (Libya) [ar-ly] <ide> //! author : Ali Hmer: https://github.com/kikoanis <ide> <ide> import moment from '../moment';
1
Python
Python
remove certifi test
bd404be03672ed5a7a0bddb242aa92f597fab957
<ide><path>libcloud/test/test_httplib_ssl.py <ide> def test_setup_ca_cert(self, _): <ide> <ide> self.assertTrue(self.httplib_object.ca_cert is not None) <ide> <del> def test_certifi_ca_bundle_in_search_path(self): <del> mock_certifi_ca_bundle_path = '/certifi/bundle/path' <del> <del> # Certifi not available <del> import libcloud.security <del> reload(libcloud.security) <del> <del> original_length = len(libcloud.security.CA_CERTS_PATH) <del> <del> self.assertTrue(mock_certifi_ca_bundle_path not in <del> libcloud.security.CA_CERTS_PATH) <del> <del> # Certifi is available <del> mock_certifi = mock.Mock() <del> mock_certifi.where.return_value = mock_certifi_ca_bundle_path <del> sys.modules['certifi'] = mock_certifi <del> <del> # Certifi CA bundle path should be injected at the begining of search list <del> import libcloud.security <del> reload(libcloud.security) <del> <del> self.assertEqual(libcloud.security.CA_CERTS_PATH[0], <del> mock_certifi_ca_bundle_path) <del> self.assertEqual(len(libcloud.security.CA_CERTS_PATH), <del> (original_length + 1)) <del> <del> # Certifi is available, but USE_CERTIFI is set to False <del> os.environ['LIBCLOUD_SSL_USE_CERTIFI'] = 'false' <del> <del> import libcloud.security <del> reload(libcloud.security) <del> <del> self.assertTrue(mock_certifi_ca_bundle_path not in <del> libcloud.security.CA_CERTS_PATH) <del> self.assertEqual(len(libcloud.security.CA_CERTS_PATH), original_length) <del> <del> # And enabled <del> os.environ['LIBCLOUD_SSL_USE_CERTIFI'] = 'true' <del> <del> import libcloud.security <del> reload(libcloud.security) <del> <del> self.assertEqual(libcloud.security.CA_CERTS_PATH[0], <del> mock_certifi_ca_bundle_path) <del> self.assertEqual(len(libcloud.security.CA_CERTS_PATH), <del> (original_length + 1)) <del> <ide> if __name__ == '__main__': <ide> sys.exit(unittest.main())
1
Text
Text
use consistent naming in stream doc
1a9d6316b8e707ba4730ba421c7d1fb960dcb288
<ide><path>doc/api/stream.md <ide> method. This will be called when there is no more written data to be consumed, <ide> but before the [`'end'`][] event is emitted signaling the end of the <ide> [`Readable`][] stream. <ide> <del>Within the `transform._flush()` implementation, the `readable.push()` method <add>Within the `transform._flush()` implementation, the `transform.push()` method <ide> may be called zero or more times, as appropriate. The `callback` function must <ide> be called when the flush operation is complete. <ide> <ide> methods only. <ide> All `Transform` stream implementations must provide a `_transform()` <ide> method to accept input and produce output. The `transform._transform()` <ide> implementation handles the bytes being written, computes an output, then passes <del>that output off to the readable portion using the `readable.push()` method. <add>that output off to the readable portion using the `transform.push()` method. <ide> <ide> The `transform.push()` method may be called zero or more times to generate <ide> output from a single input chunk, depending on how much is to be output <ide> The `callback` function must be called only when the current chunk is completely <ide> consumed. The first argument passed to the `callback` must be an `Error` object <ide> if an error occurred while processing the input or `null` otherwise. If a second <ide> argument is passed to the `callback`, it will be forwarded on to the <del>`readable.push()` method. In other words, the following are equivalent: <add>`transform.push()` method. In other words, the following are equivalent: <ide> <ide> ```js <ide> transform.prototype._transform = function(data, encoding, callback) {
1
Javascript
Javascript
add example and clear up wording for cp get/set
3b0baff261c778c8b30f3a5b1b286a090663ba80
<ide><path>packages/ember-metal/lib/computed.js <ide> ComputedPropertyPrototype.teardown = function(obj, keyName) { <ide> computed property function. You can use this helper to define properties <ide> with mixins or via `Ember.defineProperty()`. <ide> <del> If you pass function as argument - it will be used as getter. <del> You can pass hash with two functions - instead of single function - as argument to provide both getter and setter. <del> <del> The `get` function should accept two parameters, `key` and `value`. If `value` is not <del> undefined you should set the `value` first. In either case return the <del> current value of the property. <del> <del> A computed property defined in this way might look like this: <add> If you pass a function as an argument, it will be used as a getter. A computed <add> property defined in this way might look like this: <ide> <ide> ```js <ide> let Person = Ember.Object.extend({ <del> firstName: 'Betty', <del> lastName: 'Jones', <add> init() { <add> this._super(...arguments); <add> <add> this.firstName = 'Betty'; <add> this.lastName = 'Jones'; <add> }, <ide> <ide> fullName: Ember.computed('firstName', 'lastName', function() { <del> return this.get('firstName') + ' ' + this.get('lastName'); <add> return `${this.get('firstName')} ${this.get('lastName')}`; <ide> }) <ide> }); <ide> <ide> ComputedPropertyPrototype.teardown = function(obj, keyName) { <ide> client.get('fullName'); // 'Betty Fuller' <ide> ``` <ide> <add> You can pass a hash with two functions, `get` and `set`, as an <add> argument to provide both a getter and setter: <add> <add> ```js <add> let Person = Ember.Object.extend({ <add> init() { <add> this._super(...arguments); <add> <add> this.firstName = 'Betty'; <add> this.lastName = 'Jones'; <add> }, <add> <add> fullName: Ember.computed({ <add> get(key) { <add> return `${this.get('firstName')} ${this.get('lastName')}`; <add> }, <add> set(key, value) { <add> let [firstName, lastName] = value.split(/\s+/); <add> this.setProperties({ firstName, lastName }); <add> return value; <add> } <add> }); <add> }) <add> <add> let client = Person.create(); <add> client.get('firstName'); // 'Betty' <add> <add> client.set('fullName', 'Carroll Fuller'); <add> client.get('firstName'); // 'Carroll' <add> ``` <add> <add> The `set` function should accept two parameters, `key` and `value`. The value <add> returned from `set` will be the new value of the property. <add> <ide> _Note: This is the preferred way to define computed properties when writing third-party <ide> libraries that depend on or use Ember, since there is no guarantee that the user <del> will have prototype extensions enabled._ <add> will have [prototype Extensions](http://emberjs.com/guides/configuring-ember/disabling-prototype-extensions/) enabled._ <ide> <del> You might use this method if you disabled <del> [Prototype Extensions](http://emberjs.com/guides/configuring-ember/disabling-prototype-extensions/). <del> The alternative syntax might look like this <del> (if prototype extensions are enabled, which is the default behavior): <add> The alternative syntax, with prototype extensions, might look like: <ide> <ide> ```js <ide> fullName() {
1
Text
Text
add bartosz sosnowski to colaborators
6ee9e296527b524309e92bbb91a386b49f525a2b
<ide><path>README.md <ide> information about the governance of the Node.js project, see <ide> * [benjamingr](https://github.com/benjamingr) - **Benjamin Gruenbaum** &lt;[email protected]&gt; <ide> * [bmeck](https://github.com/bmeck) - **Bradley Farias** &lt;[email protected]&gt; <ide> * [brendanashworth](https://github.com/brendanashworth) - **Brendan Ashworth** &lt;[email protected]&gt; <add>* [bzoz](https://github.com/bzoz) - **Bartosz Sosnowski** &lt;[email protected]&gt; <ide> * [calvinmetcalf](https://github.com/calvinmetcalf) - **Calvin Metcalf** &lt;[email protected]&gt; <ide> * [claudiorodriguez](https://github.com/claudiorodriguez) - **Claudio Rodriguez** &lt;[email protected]&gt; <ide> * [domenic](https://github.com/domenic) - **Domenic Denicola** &lt;[email protected]&gt;
1
Ruby
Ruby
add error handling for metadata server
dfd19e1a76bd313bdfb35dc02c2e53f71611b953
<ide><path>activestorage/lib/active_storage/service/gcs_service.rb <ide> module ActiveStorage <ide> # Wraps the Google Cloud Storage as an Active Storage service. See ActiveStorage::Service for the generic API <ide> # documentation that applies to all services. <ide> class Service::GCSService < Service <add> class MetadataServerError < ActiveStorage::Error; end <add> class MetadataServerNotFoundError < ActiveStorage::Error; end <add> <ide> def initialize(public: false, **config) <ide> @config = config <ide> @public = public <ide> def issuer <ide> request = Net::HTTP::Get.new(uri.request_uri) <ide> request["Metadata-Flavor"] = "Google" <ide> <del> http.request(request).body <add> begin <add> response = http.request(request) <add> rescue SocketError <add> raise MetadataServerNotFoundError <add> end <add> <add> if response.is_a?(Net::HTTPSuccess) <add> response.body <add> else <add> raise MetadataServerError <add> end <ide> end <ide> end <ide>
1
Python
Python
enable docstrings for fmin and fmax
8a455cbdae39233b18758d064f5959ae56e4922b
<ide><path>numpy/core/code_generators/generate_umath.py <ide> def __init__(self, nin, nout, identity, docstring, <ide> ), <ide> 'fmax' : <ide> Ufunc(2, 1, None, <del> "", <add> docstrings.get('numpy.core.umath.fmax'), <ide> TD(noobj), <ide> TD(O, f='npy_ObjectMax') <ide> ), <ide> 'fmin' : <ide> Ufunc(2, 1, None, <del> "", <add> docstrings.get('numpy.core.umath.fmin'), <ide> TD(noobj), <ide> TD(O, f='npy_ObjectMin') <ide> ),
1
Javascript
Javascript
provide api for retrieving function annotations
4361efb03b79e71bf0cea92b94ff377ed718bad4
<ide><path>src/auto/injector.js <ide> var FN_ARGS = /^function\s*[^\(]*\(\s*([^\)]*)\)/m; <ide> var FN_ARG_SPLIT = /,/; <ide> var FN_ARG = /^\s*(_?)(.+?)\1\s*$/; <ide> var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg; <del>function inferInjectionArgs(fn) { <del> assertArgFn(fn); <del> if (!fn.$inject) { <del> var args = fn.$inject = []; <del> var fnText = fn.toString().replace(STRIP_COMMENTS, ''); <del> var argDecl = fnText.match(FN_ARGS); <del> forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg){ <del> arg.replace(FN_ARG, function(all, underscore, name){ <del> args.push(name); <add>function annotate(fn) { <add> var $inject, <add> fnText, <add> argDecl, <add> last; <add> <add> if (typeof fn == 'function') { <add> if (!($inject = fn.$inject)) { <add> $inject = []; <add> fnText = fn.toString().replace(STRIP_COMMENTS, ''); <add> argDecl = fnText.match(FN_ARGS); <add> forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg){ <add> arg.replace(FN_ARG, function(all, underscore, name){ <add> $inject.push(name); <add> }); <ide> }); <del> }); <add> fn.$inject = $inject; <add> } <add> } else if (isArray(fn)) { <add> last = fn.length - 1; <add> assertArgFn(fn[last], 'fn') <add> $inject = fn.slice(0, last); <add> } else { <add> assertArgFn(fn, 'fn', true); <ide> } <del> return fn.$inject; <add> return $inject; <ide> } <ide> <ide> /////////////////////////////////////// <ide> function inferInjectionArgs(fn) { <ide> * @returns {Object} new instance of `Type`. <ide> */ <ide> <add>/** <add> * @ngdoc method <add> * @name angular.module.AUTO.$injector#annotate <add> * @methodOf angular.module.AUTO.$injector <add> * <add> * @description <add> * Returns an array of service names which the function is requesting for injection. This API is used by the injector <add> * to determine which services need to be injected into the function when the function is invoked. There are three <add> * ways in which the function can be annotated with the needed dependencies. <add> * <add> * # Argument names <add> * <add> * The simplest form is to extract the dependencies from the arguments of the function. This is done by converting <add> * the function into a string using `toString()` method and extracting the argument names. <add> * <pre> <add> * // Given <add> * function MyController($scope, $route) { <add> * // ... <add> * } <add> * <add> * // Then <add> * expect(injector.annotate(MyController)).toEqual(['$scope', '$route']); <add> * </pre> <add> * <add> * This method does not work with code minfication / obfuscation. For this reason the following annotation strategies <add> * are supported. <add> * <add> * # The `$injector` property <add> * <add> * If a function has an `$inject` property and its value is an array of strings, then the strings represent names of <add> * services to be injected into the function. <add> * <pre> <add> * // Given <add> * var MyController = function(obfuscatedScope, obfuscatedRoute) { <add> * // ... <add> * } <add> * // Define function dependencies <add> * MyController.$inject = ['$scope', '$route']; <add> * <add> * // Then <add> * expect(injector.annotate(MyController)).toEqual(['$scope', '$route']); <add> * </pre> <add> * <add> * # The array notation <add> * <add> * It is often desirable to inline Injected functions and that's when setting the `$inject` property is very <add> * inconvenient. In these situations using the array notation to specify the dependencies in a way that survives <add> * minification is a better choice: <add> * <add> * <pre> <add> * // We wish to write this (not minification / obfuscation safe) <add> * injector.invoke(function($compile, $rootScope) { <add> * // ... <add> * }); <add> * <add> * // We are forced to write break inlining <add> * var tmpFn = function(obfuscatedCompile, obfuscatedRootScope) { <add> * // ... <add> * }; <add> * tmpFn.$inject = ['$compile', '$rootScope']; <add> * injector.invoke(tempFn); <add> * <add> * // To better support inline function the inline annotation is supported <add> * injector.invoke(['$compile', '$rootScope', function(obfCompile, obfRootScope) { <add> * // ... <add> * }]); <add> * <add> * // Therefore <add> * expect(injector.annotate( <add> * ['$compile', '$rootScope', function(obfus_$compile, obfus_$rootScope) {}]) <add> * ).toEqual(['$compile', '$rootScope']); <add> * </pre> <add> * <add> * @param {function|Array.<string|Function>} fn Function for which dependent service names need to be retrieved as described <add> * above. <add> * <add> * @returns {Array.<string>} The names of the services which the function requires. <add> */ <add> <add> <add> <ide> <ide> /** <ide> * @ngdoc object <ide> function createInjector(modulesToLoad) { <ide> <ide> function invoke(fn, self, locals){ <ide> var args = [], <del> $inject, <del> length, <add> $inject = annotate(fn), <add> length, i, <ide> key; <ide> <del> if (typeof fn == 'function') { <del> $inject = inferInjectionArgs(fn); <del> length = $inject.length; <del> } else { <del> if (isArray(fn)) { <del> $inject = fn; <del> length = $inject.length - 1; <del> fn = $inject[length]; <del> } <del> assertArgFn(fn, 'fn'); <del> } <del> <del> for(var i = 0; i < length; i++) { <add> for(i = 0, length = $inject.length; i < length; i++) { <ide> key = $inject[i]; <ide> args.push( <ide> locals && locals.hasOwnProperty(key) <ide> ? locals[key] <ide> : getService(key, path) <ide> ); <ide> } <add> if (!fn.$inject) { <add> // this means that we must be an array. <add> fn = fn[length]; <add> } <add> <ide> <ide> // Performance optimization: http://jsperf.com/apply-vs-call-vs-invoke <ide> switch (self ? -1 : args.length) { <ide> function createInjector(modulesToLoad) { <ide> return { <ide> invoke: invoke, <ide> instantiate: instantiate, <del> get: getService <add> get: getService, <add> annotate: annotate <ide> }; <ide> } <ide> } <ide><path>test/auto/injectorSpec.js <ide> describe('injector', function() { <ide> it('should return $inject', function() { <ide> function fn() {} <ide> fn.$inject = ['a']; <del> expect(inferInjectionArgs(fn)).toBe(fn.$inject); <del> expect(inferInjectionArgs(function() {})).toEqual([]); <del> expect(inferInjectionArgs(function () {})).toEqual([]); <del> expect(inferInjectionArgs(function () {})).toEqual([]); <del> expect(inferInjectionArgs(function /* */ () {})).toEqual([]); <add> expect(annotate(fn)).toBe(fn.$inject); <add> expect(annotate(function() {})).toEqual([]); <add> expect(annotate(function () {})).toEqual([]); <add> expect(annotate(function () {})).toEqual([]); <add> expect(annotate(function /* */ () {})).toEqual([]); <ide> }); <ide> <ide> <ide> describe('injector', function() { <ide> */ <ide> _c, <ide> /* {some type} */ d) { extraParans();} <del> expect(inferInjectionArgs($f_n0)).toEqual(['$a', 'b_', '_c', 'd']); <add> expect(annotate($f_n0)).toEqual(['$a', 'b_', '_c', 'd']); <ide> expect($f_n0.$inject).toEqual(['$a', 'b_', '_c', 'd']); <ide> }); <ide> <ide> <ide> it('should strip leading and trailing underscores from arg name during inference', function() { <ide> function beforeEachFn(_foo_) { /* foo = _foo_ */ }; <del> expect(inferInjectionArgs(beforeEachFn)).toEqual(['foo']); <add> expect(annotate(beforeEachFn)).toEqual(['foo']); <ide> }); <ide> <ide> <ide> it('should handle no arg functions', function() { <ide> function $f_n0() {} <del> expect(inferInjectionArgs($f_n0)).toEqual([]); <add> expect(annotate($f_n0)).toEqual([]); <ide> expect($f_n0.$inject).toEqual([]); <ide> }); <ide> <ide> <ide> it('should handle no arg functions with spaces in the arguments list', function() { <ide> function fn( ) {} <del> expect(inferInjectionArgs(fn)).toEqual([]); <add> expect(annotate(fn)).toEqual([]); <ide> expect(fn.$inject).toEqual([]); <ide> }); <ide> <ide> <ide> it('should handle args with both $ and _', function() { <ide> function $f_n0($a_) {} <del> expect(inferInjectionArgs($f_n0)).toEqual(['$a_']); <add> expect(annotate($f_n0)).toEqual(['$a_']); <ide> expect($f_n0.$inject).toEqual(['$a_']); <ide> }); <ide> <ide> <ide> it('should throw on non function arg', function() { <ide> expect(function() { <del> inferInjectionArgs({}); <add> annotate({}); <ide> }).toThrow(); <ide> }); <add> <add> <add> it('should publish annotate API', function() { <add> expect(injector.annotate).toBe(annotate); <add> }); <ide> }); <ide> <ide>
2
Text
Text
add common cask issues
820e8303dfca47644b53467baba1c7bd7caa86b1
<ide><path>docs/Common-Issues.md <ide> xcode-select --install <ide> brew upgrade <ide> ``` <ide> <add>## Cask - cURL error <add> <add>First, let's tackle a common problem: do you have a `.curlrc` file? Check with `ls -A ~ | grep .curlrc` (if you get a result, the file exists). Those are a frequent cause of issues of this nature. Before anything else, remove that file and try again. If it now works, do not open an issue. Incompatible `.curlrc` configurations must be fixed on your side. <add> <add>If, however, you do not have a `.curlrc` or removing it did not work, let’s see if the issue is upstream: <add> <add>1. Go to the vendor’s website (`brew home <cask_name>`). <add>2. Find the download link for the app and click on it. <add> <add>### If the download works <add> <add>The cask is outdated. Let’s fix it: <add> <add>1. Look around the app’s website and find out what the latest version is. It will likely be expressed in the URL used to download it. <add>2. Take a look at the cask’s version (`brew cat {{cask_name}}`) and verify it is indeed outdated. If the app’s version is `:latest`, it means the `url` itself is outdated. It will need to be changed to the new one. <add> <add>Help us by [submitting a fix](https://github.com/Homebrew/homebrew-cask/blob/HEAD/CONTRIBUTING.md#updating-a-cask). If you get stumped, [open an issue](https://github.com/Homebrew/homebrew-cask/issues/new?template=01_bug_report.md) explaining your steps so far and where you’re having trouble. <add> <add>### If the download does not work <add> <add>The issue isn’t in any way related to Homebrew Cask, but with the vendor or your connection. <add> <add>Start by diagnosing your connection (try to download other casks, go around the web). If the problem is with your connection, try a website like [Ask Different](https://apple.stackexchange.com/) to ask for advice. <add> <add>If you’re sure the issue is not with your connection, contact the app’s vendor and let them know their link is down, so they can fix it. <add> <add>**Do not open an issue.** <add> <add>## Cask - checksum does not match <add> <add>First, check if the problem was with your download. Delete the downloaded file (its location will be pointed out in the error message) and try again. <add> <add>If the problem persists, the cask must be outdated. It’ll likely need a new version, but it’s possible the version has remained the same (happens occasionally when the vendor updates the app in place). <add> <add>1. Go to the vendor’s website (`brew home <cask_name>`). <add>2. Find out what the latest version is. It may be expressed in the URL used to download it. <add>3. Take a look at the cask’s version (`brew info <cask_name>`) and verify it is indeed outdated. If it is: <add> <add>Help us by [submitting a fix](https://github.com/Homebrew/homebrew-cask/blob/HEAD/CONTRIBUTING.md#updating-a-cask). If you get stumped, [open an issue](https://github.com/Homebrew/homebrew-cask/issues/new?template=01_bug_report.md) explaining your steps so far and where you’re having trouble. <add> <add>## Cask - permission denied <add> <add>In this case, it’s likely your user account has no admin rights so you don’t have permissions to write to `/Applications` (which is the default). You can use [`--appdir`](https://github.com/Homebrew/homebrew-cask/blob/HEAD/USAGE.md#options) to choose where to install your applications. <add> <add>If `--appdir` doesn’t fix the issue or you do have write permissions to `/Applications`, verify you’re the owner of the `Caskroom` directory by running `ls -dl "$(brew --prefix)/Caskroom"` and checking the third field. If you are not the owner, fix it with `sudo chown -R "$(whoami)" "$(brew --prefix)/Caskroom"`. If you are, the problem may lie in the app bundle itself. <add> <add>Some app bundles don’t have certain permissions that are necessary for us to move them to the appropriate location. You may check such permissions with `ls -ls <path_to_app_bundle>`. If you see something like `dr-xr-xr-x` at the start of the output, that may be the cause. To fix it, we change the app bundle’s permission to allow us to move it, and then set it back to what it was (in case the developer set those permissions deliberately). See [`litecoin`](https://github.com/Homebrew/homebrew-cask/blob/0cde71f1fea8ad62d6ec4732fcf35ac0c52d8792/Casks/litecoin.rb#L14L20) for an example of such a cask. <add> <add>Help us by [submitting a fix](https://github.com/Homebrew/homebrew-cask/blob/HEAD/CONTRIBUTING.md#updating-a-cask). If you get stumped, [open an issue](https://github.com/Homebrew/homebrew-cask/issues/new?template=01_bug_report.md) explaining your steps so far and where you’re having trouble. <add> <add>## Cask - source is not there <add> <add>First, you need to identify which artifact is not being handled correctly anymore. It’s explicit in the error message: if it says `It seems the App source…'` the problem is [`app`](https://docs.brew.sh/Cask-Cookbook#stanza-app). The pattern is the same across [all artifacts](https://docs.brew.sh/Cask-Cookbook#at-least-one-artifact-stanza-is-also-required). <add> <add>Fixing this error is typically easy, and requires only a bit of time on your part. Start by downloading the package for the cask: `brew fetch <cask_name>`. The last line of output will inform you of the location of the download. Navigate there and manually unpack it. As an example, lets say the structure inside the archive is as follows: <add> <add>``` <add>. <add>β”œβ”€ Files/SomeApp.app <add>β”œβ”€ Files/script.sh <add>└─ README.md <add>``` <add> <add>Now, let's look at the cask (`brew cat <cask_name>`): <add> <add>``` <add>(…) <add>app "SomeApp.app" <add>(…) <add>``` <add> <add>The cask was expecting `SomeApp.app` to be in the top directory of the archive (see how it says simply `SomeApp.app`) but the developer changed it to inside a `Files` directory. All we have to do is update that line of the cask to follow the new structure: `app 'Files/SomeApp.app'`. <add> <add>Note that occasionally the app’s name changes completely (from `SomeApp.app` to `OtherApp.app`, let's say). In these instances, the filename of the cask itself, as well as its token, must also change. Consult the [`token reference`](https://docs.brew.sh/Cask-Cookbook#token-reference) for complete instructions on the new name. <add> <add>Help us by [submitting a fix](https://github.com/Homebrew/homebrew-cask/blob/HEAD/CONTRIBUTING.md#updating-a-cask). If you get stumped, [open an issue](https://github.com/Homebrew/homebrew-cask/issues/new?template=01_bug_report.md) explaining your steps so far and where you’re having trouble. <add> <add>## Cask - wrong number of arguments <add> <add>Make sure the issue really lies with your macOS version. To do so, try to install the software manually. If it is incompatible with your macOS version, it will tell you. In that case, there is nothing we can do to help you install the software, but we can add a [`depends_on macos:`](https://docs.brew.sh/Cask-Cookbook#depends_on-macos) stanza to prevent the cask from trying to install on incompatible macOS versions. <add> <add>Help us by [submitting a fix](https://github.com/Homebrew/homebrew-cask/blob/HEAD/CONTRIBUTING.md#updating-a-cask). If you get stumped, [open an issue](https://github.com/Homebrew/homebrew-cask/issues/new?template=01_bug_report.md) explaining your steps so far and where you’re having trouble. <add> <add> <ide> ## Other local issues <ide> <ide> If your Homebrew installation gets messed up (and fixing the issues found by `brew doctor` doesn't solve the problem), reinstalling Homebrew may help to reset to a normal state. To easily reinstall Homebrew, use [Homebrew Bundle](https://github.com/Homebrew/homebrew-bundle) to automatically restore your installed formulae and casks. To do so, run `brew bundle dump`, [uninstall](https://docs.brew.sh/FAQ#how-do-i-uninstall-homebrew), [reinstall](https://docs.brew.sh/Installation) and run `brew bundle install`.
1
PHP
PHP
fix empty email with attachments
1a146d2c170390def0b017146b21c9f8c21691ce
<ide><path>src/Illuminate/Mail/Mailer.php <ide> protected function parseView($view) <ide> protected function addContent($message, $view, $plain, $raw, $data) <ide> { <ide> if (isset($view)) { <del> $message->setBody($this->renderView($view, $data), 'text/html'); <add> $message->setBody($this->renderView($view, $data) ?: ' ', 'text/html'); <ide> } <ide> <ide> if (isset($plain)) {
1
PHP
PHP
move view builder onto renderer instead of email
326f9e413c1e6b5da15d96891f44bfefe8ffa787
<ide><path>src/Mailer/Email.php <ide> use Cake\Core\StaticConfigTrait; <ide> use Cake\Log\Log; <ide> use Cake\Utility\Text; <del>use Cake\View\ViewVarsTrait; <ide> use InvalidArgumentException; <ide> use JsonSerializable; <ide> use LogicException; <ide> class Email implements JsonSerializable, Serializable <ide> { <ide> use StaticConfigTrait; <del> use ViewVarsTrait; <ide> <ide> /** <ide> * Type of message - HTML <ide> public function __construct($config = null) <ide> $this->_domain = php_uname('n'); <ide> } <ide> <del> $this->viewBuilder() <add> $this->getRenderer()->viewBuilder() <ide> ->setClassName('Cake\View\View') <ide> ->setTemplate('') <ide> ->setLayout('default') <ide> public function __construct($config = null) <ide> */ <ide> public function __clone() <ide> { <del> $this->_viewBuilder = clone $this->viewBuilder(); <add> $this->_viewBuilder = clone $this->getRenderer()->viewBuilder(); <ide> } <ide> <ide> /** <ide> protected function _formatAddress($address) <ide> */ <ide> public function setViewRenderer(string $viewClass): self <ide> { <del> $this->viewBuilder()->setClassName($viewClass); <add> $this->getRenderer()->viewBuilder()->setClassName($viewClass); <ide> <ide> return $this; <ide> } <ide> public function setViewRenderer(string $viewClass): self <ide> */ <ide> public function getViewRenderer(): string <ide> { <del> return $this->viewBuilder()->getClassName(); <add> return $this->getRenderer()->viewBuilder()->getClassName(); <ide> } <ide> <ide> /** <ide> public function getViewRenderer(): string <ide> */ <ide> public function setViewVars(array $viewVars): self <ide> { <del> $this->set($viewVars); <add> $this->getRenderer()->viewBuilder()->setVars($viewVars); <ide> <ide> return $this; <ide> } <ide> public function setViewVars(array $viewVars): self <ide> */ <ide> public function getViewVars(): array <ide> { <del> return $this->viewBuilder()->getVars(); <add> return $this->getRenderer()->viewBuilder()->getVars(); <ide> } <ide> <ide> /** <ide> public function send($content = null): array <ide> */ <ide> public function render(?string $content = null) <ide> { <del> if ($this->renderer === null) { <del> $this->renderer = new Renderer(); <del> } <del> <ide> list($this->_message, <ide> $this->_boundary, <ide> $this->_textMessage, <ide> $this->_htmlMessage <del> ) = $this->renderer->render($this, $content); <add> ) = $this->getRenderer()->render($this, $content); <add> } <add> <add> public function viewBuilder() <add> { <add> return $this->getRenderer()->viewBuilder(); <add> } <add> <add> protected function getRenderer() <add> { <add> if ($this->renderer === null) { <add> $this->renderer = new Renderer(); <add> } <add> <add> return $this->renderer; <add> } <add> <add> protected function setRenderer(Renderer $renderer) <add> { <add> $this->renderer = $renderer; <add> <add> return $this; <ide> } <ide> <ide> /** <ide> protected function _applyConfig($config) <ide> ]; <ide> foreach ($viewBuilderMethods as $method) { <ide> if (array_key_exists($method, $config)) { <del> $this->viewBuilder()->{'set' . ucfirst($method)}($config[$method]); <add> $this->getRenderer()->viewBuilder()->{'set' . ucfirst($method)}($config[$method]); <ide> } <ide> } <ide> <ide> if (array_key_exists('helpers', $config)) { <del> $this->viewBuilder()->setHelpers($config['helpers'], false); <add> $this->getRenderer()->viewBuilder()->setHelpers($config['helpers'], false); <ide> } <ide> if (array_key_exists('viewRender', $config)) { <del> $this->viewBuilder()->setClassName($config['viewRender']); <add> $this->getRenderer()->viewBuilder()->setClassName($config['viewRender']); <ide> } <ide> if (array_key_exists('viewVars', $config)) { <del> $this->set($config['viewVars']); <add> $this->getRenderer()->viewBuilder()->setVars($config['viewVars']); <ide> } <ide> } <ide> <ide> public function reset(): self <ide> $this->_profile = []; <ide> $this->_emailPattern = self::EMAIL_PATTERN; <ide> <del> $this->viewBuilder() <add> $this->getRenderer()->viewBuilder() <ide> ->setLayout('default') <ide> ->setTemplate('') <ide> ->setClassName('Cake\View\View') <ide> public function jsonSerialize(): array <ide> '_attachments', '_messageId', '_headers', '_appCharset', 'charset', 'headerCharset', <ide> ]; <ide> <del> $array = ['viewConfig' => $this->viewBuilder()->jsonSerialize()]; <add> $array = ['viewConfig' => $this->getRenderer()->viewBuilder()->jsonSerialize()]; <ide> <ide> foreach ($properties as $property) { <ide> $array[$property] = $this->{$property}; <ide> public function jsonSerialize(): array <ide> public function createFromArray(array $config): self <ide> { <ide> if (isset($config['viewConfig'])) { <del> $this->viewBuilder()->createFromArray($config['viewConfig']); <add> $this->getRenderer()->viewBuilder()->createFromArray($config['viewConfig']); <ide> unset($config['viewConfig']); <ide> } <ide> <ide><path>src/Mailer/Renderer.php <ide> use Cake\Utility\Hash; <ide> use Cake\Utility\Security; <ide> use Cake\Utility\Text; <add>use Cake\View\ViewVarsTrait; <ide> <ide> class Renderer <ide> { <add> use ViewVarsTrait; <add> <ide> /** <ide> * Line length - no should more - RFC 2822 - 2.1.1 <ide> * <ide> protected function renderTemplates(?string $content = null): array <ide> { <ide> $types = $this->getTypes(); <ide> $rendered = []; <del> $template = $this->email->viewBuilder()->getTemplate(); <add> $template = $this->viewBuilder()->getTemplate(); <ide> if (empty($template)) { <ide> foreach ($types as $type) { <ide> $content = str_replace(["\r\n", "\r"], "\n", $content); <ide> protected function renderTemplates(?string $content = null): array <ide> return $rendered; <ide> } <ide> <del> $view = $this->email->createView(); <add> $view = $this->createView(); <ide> <ide> list($templatePlugin) = pluginSplit($view->getTemplate()); <ide> list($layoutPlugin) = pluginSplit((string)$view->getLayout());
2
PHP
PHP
add type hints to database/expression
67d33c620f763952b0abdb89fc4e4c56bb27a5e4
<ide><path>src/Database/Expression/BetweenExpression.php <ide> public function __construct($field, $from, $to, $type = null) <ide> * @param \Cake\Database\ValueBinder $generator Placeholder generator object <ide> * @return string <ide> */ <del> public function sql(ValueBinder $generator) <add> public function sql(ValueBinder $generator): string <ide> { <ide> $parts = [ <ide> 'from' => $this->_from, <ide> public function traverse(callable $callable) <ide> * @param string $type The type of $value <ide> * @return string generated placeholder <ide> */ <del> protected function _bindValue($value, $generator, $type) <add> protected function _bindValue($value, $generator, $type): string <ide> { <ide> $placeholder = $generator->placeholder('c'); <ide> $generator->bind($placeholder, $value, $type); <ide><path>src/Database/Expression/CaseExpression.php <ide> public function add($conditions = [], $values = [], $types = []) <ide> * <ide> * @return void <ide> */ <del> protected function _addExpressions($conditions, $values, $types) <add> protected function _addExpressions($conditions, $values, $types): void <ide> { <ide> $rawValues = array_values($values); <ide> $keyValues = array_keys($values); <ide> protected function _addExpressions($conditions, $values, $types) <ide> * <ide> * @return void <ide> */ <del> public function elseValue($value = null, $type = null) <add> public function elseValue($value = null, $type = null): void <ide> { <ide> if (is_array($value)) { <ide> end($value); <ide> public function elseValue($value = null, $type = null) <ide> * <ide> * @return string <ide> */ <del> protected function _compile($part, ValueBinder $generator) <add> protected function _compile($part, ValueBinder $generator): string <ide> { <ide> if ($part instanceof ExpressionInterface) { <ide> $part = $part->sql($generator); <ide> protected function _compile($part, ValueBinder $generator) <ide> * <ide> * @return string <ide> */ <del> public function sql(ValueBinder $generator) <add> public function sql(ValueBinder $generator): string <ide> { <ide> $parts = []; <ide> $parts[] = 'CASE'; <ide><path>src/Database/Expression/Comparison.php <ide> public function __construct($field, $value, $type, $operator) <ide> * @param mixed $value The value to compare <ide> * @return void <ide> */ <del> public function setValue($value) <add> public function setValue($value): void <ide> { <ide> $hasType = isset($this->_type) && is_string($this->_type); <ide> $isMultiple = $hasType && strpos($this->_type, '[]') !== false; <ide> public function getValue() <ide> * @param string $operator The operator to be used for the comparison. <ide> * @return void <ide> */ <del> public function setOperator($operator) <add> public function setOperator(string $operator): void <ide> { <ide> $this->_operator = $operator; <ide> } <ide> public function setOperator($operator) <ide> * <ide> * @return string <ide> */ <del> public function getOperator() <add> public function getOperator(): string <ide> { <ide> return $this->_operator; <ide> } <ide> public function getOperator() <ide> * @param \Cake\Database\ValueBinder $generator Placeholder generator object <ide> * @return string <ide> */ <del> public function sql(ValueBinder $generator) <add> public function sql(ValueBinder $generator): string <ide> { <ide> $field = $this->_field; <ide> <ide> public function __clone() <ide> * @param \Cake\Database\ValueBinder $generator The value binder to use. <ide> * @return array First position containing the template and the second a placeholder <ide> */ <del> protected function _stringExpression($generator) <add> protected function _stringExpression(\Cake\Database\ValueBinder $generator): array <ide> { <ide> $template = '%s '; <ide> <ide> protected function _stringExpression($generator) <ide> * @param string $type The type of $value <ide> * @return string generated placeholder <ide> */ <del> protected function _bindValue($value, $generator, $type) <add> protected function _bindValue($value, ValueBinder $generator, $type): string <ide> { <ide> $placeholder = $generator->placeholder('c'); <ide> $generator->bind($placeholder, $value, $type); <ide> protected function _bindValue($value, $generator, $type) <ide> * @param string|array|null $type the type to cast values to <ide> * @return string <ide> */ <del> protected function _flattenValue($value, $generator, $type = 'string') <add> protected function _flattenValue($value, $generator, $type = 'string'): string <ide> { <ide> $parts = []; <ide> foreach ($this->_valueExpressions as $k => $v) { <ide> protected function _flattenValue($value, $generator, $type = 'string') <ide> * @param array|\Traversable $values The rows to insert <ide> * @return array <ide> */ <del> protected function _collectExpressions($values) <add> protected function _collectExpressions($values): array <ide> { <ide> if ($values instanceof ExpressionInterface) { <ide> return [$values, []]; <ide><path>src/Database/Expression/FieldInterface.php <ide> interface FieldInterface <ide> * @param string|\Cake\Database\ExpressionInterface $field The field to compare with. <ide> * @return void <ide> */ <del> public function setField($field); <add> public function setField($field): void; <ide> <ide> /** <ide> * Returns the field name <ide><path>src/Database/Expression/FieldTrait.php <ide> trait FieldTrait <ide> * @param string|\Cake\Database\ExpressionInterface $field The field to compare with. <ide> * @return void <ide> */ <del> public function setField($field) <add> public function setField($field): void <ide> { <ide> $this->_field = $field; <ide> } <ide><path>src/Database/Expression/FunctionExpression.php <ide> class FunctionExpression extends QueryExpression implements TypedResultInterface <ide> * passed arguments <ide> * @param string $returnType The return type of this expression <ide> */ <del> public function __construct($name, $params = [], $types = [], $returnType = 'string') <add> public function __construct(string $name, array $params = [], array $types = [], string $returnType = 'string') <ide> { <ide> $this->_name = $name; <ide> $this->_returnType = $returnType; <ide> public function __construct($name, $params = [], $types = [], $returnType = 'str <ide> * @param string $name The name of the function <ide> * @return $this <ide> */ <del> public function setName($name) <add> public function setName(string $name) <ide> { <ide> $this->_name = $name; <ide> <ide> public function setName($name) <ide> * <ide> * @return string <ide> */ <del> public function getName() <add> public function getName(): string <ide> { <ide> return $this->_name; <ide> } <ide> public function getName() <ide> * @see \Cake\Database\Expression\FunctionExpression::__construct() for more details. <ide> * @return $this <ide> */ <del> public function add($params, $types = [], $prepend = false) <add> public function add($params, $types = [], bool $prepend = false) <ide> { <ide> $put = $prepend ? 'array_unshift' : 'array_push'; <ide> $typeMap = $this->getTypeMap()->setTypes($types); <ide> public function add($params, $types = [], $prepend = false) <ide> * @param \Cake\Database\ValueBinder $generator Placeholder generator object <ide> * @return string <ide> */ <del> public function sql(ValueBinder $generator) <add> public function sql(ValueBinder $generator): string <ide> { <ide> $parts = []; <ide> foreach ($this->_conditions as $condition) { <ide> public function sql(ValueBinder $generator) <ide> * <ide> * @return int <ide> */ <del> public function count() <add> public function count(): int <ide> { <ide> return 1 + count($this->_conditions); <ide> } <ide><path>src/Database/Expression/IdentifierExpression.php <ide> class IdentifierExpression implements ExpressionInterface <ide> * <ide> * @param string $identifier The identifier this expression represents <ide> */ <del> public function __construct($identifier) <add> public function __construct(string $identifier) <ide> { <ide> $this->_identifier = $identifier; <ide> } <ide> public function __construct($identifier) <ide> * @param string $identifier The identifier <ide> * @return void <ide> */ <del> public function setIdentifier($identifier) <add> public function setIdentifier(string $identifier): void <ide> { <ide> $this->_identifier = $identifier; <ide> } <ide> public function setIdentifier($identifier) <ide> * <ide> * @return string <ide> */ <del> public function getIdentifier() <add> public function getIdentifier(): string <ide> { <ide> return $this->_identifier; <ide> } <ide> public function getIdentifier() <ide> * @param \Cake\Database\ValueBinder $generator Placeholder generator object <ide> * @return string <ide> */ <del> public function sql(ValueBinder $generator) <add> public function sql(ValueBinder $generator): string <ide> { <ide> return $this->_identifier; <ide> } <ide> public function sql(ValueBinder $generator) <ide> * @param callable $callable The callable to traverse with. <ide> * @return void <ide> */ <del> public function traverse(callable $callable) <add> public function traverse(callable $callable): void <ide> { <ide> } <ide> } <ide><path>src/Database/Expression/OrderByExpression.php <ide> public function __construct($conditions = [], $types = [], $conjunction = '') <ide> * @param \Cake\Database\ValueBinder $generator Placeholder generator object <ide> * @return string <ide> */ <del> public function sql(ValueBinder $generator) <add> public function sql(ValueBinder $generator): string <ide> { <ide> $order = []; <ide> foreach ($this->_conditions as $k => $direction) { <ide> public function sql(ValueBinder $generator) <ide> * @param array $types list of types associated on fields referenced in $conditions <ide> * @return void <ide> */ <del> protected function _addConditions(array $orders, array $types) <add> protected function _addConditions(array $orders, array $types): void <ide> { <ide> $this->_conditions = array_merge($this->_conditions, $orders); <ide> } <ide><path>src/Database/Expression/QueryExpression.php <ide> public function __construct($conditions = [], $types = [], $conjunction = 'AND') <ide> * @param string $conjunction Value to be used for joining conditions <ide> * @return $this <ide> */ <del> public function setConjunction($conjunction) <add> public function setConjunction(string $conjunction) <ide> { <ide> $this->_conjunction = strtoupper($conjunction); <ide> <ide> public function setConjunction($conjunction) <ide> * <ide> * @return string <ide> */ <del> public function getConjunction() <add> public function getConjunction(): string <ide> { <ide> return $this->_conjunction; <ide> } <ide> public function not($conditions, $types = []) <ide> * <ide> * @return int <ide> */ <del> public function count() <add> public function count(): int <ide> { <ide> return count($this->_conditions); <ide> } <ide> public function count() <ide> * @param string $right Right join condition field name. <ide> * @return $this <ide> */ <del> public function equalFields($left, $right) <add> public function equalFields(string $left, string $right) <ide> { <ide> $wrapIdentifier = function ($field) { <ide> if ($field instanceof ExpressionInterface) { <ide> public function equalFields($left, $right) <ide> * @param \Cake\Database\ValueBinder $generator Placeholder generator object <ide> * @return string <ide> */ <del> public function sql(ValueBinder $generator) <add> public function sql(ValueBinder $generator): string <ide> { <ide> $len = $this->count(); <ide> if ($len === 0) { <ide> public function sql(ValueBinder $generator) <ide> * @param callable $callable The callable to apply to all sub-expressions. <ide> * @return void <ide> */ <del> public function traverse(callable $callable) <add> public function traverse(callable $callable): void <ide> { <ide> foreach ($this->_conditions as $c) { <ide> if ($c instanceof ExpressionInterface) { <ide> public function iterateParts(callable $callable) <ide> * @return \Cake\Database\Expression\QueryExpression <ide> * @throws \BadMethodCallException <ide> */ <del> public function __call($method, $args) <add> public function __call(string $method, array $args): \Cake\Database\Expression\QueryExpression <ide> { <ide> if (in_array($method, ['and', 'or'])) { <ide> return call_user_func_array([$this, $method . '_'], $args); <ide> public function __call($method, $args) <ide> * as they often contain user input and arrays of strings <ide> * are easy to sneak in. <ide> * <del> * @param callable $c The callable to check. <add> * @param callable|string|array $c The callable to check. <ide> * @return bool Valid callable. <ide> */ <del> public function isCallable($c) <add> public function isCallable($c): bool <ide> { <ide> if (is_string($c)) { <ide> return false; <ide> public function isCallable($c) <ide> * <ide> * @return bool <ide> */ <del> public function hasNestedExpression() <add> public function hasNestedExpression(): bool <ide> { <ide> foreach ($this->_conditions as $c) { <ide> if ($c instanceof ExpressionInterface) { <ide> public function hasNestedExpression() <ide> * @param array $types list of types associated on fields referenced in $conditions <ide> * @return void <ide> */ <del> protected function _addConditions(array $conditions, array $types) <add> protected function _addConditions(array $conditions, array $types): void <ide> { <ide> $operators = ['and', 'or', 'xor']; <ide> <ide> protected function _addConditions(array $conditions, array $types) <ide> * @param mixed $value The value to be bound to a placeholder for the field <ide> * @return string|\Cake\Database\ExpressionInterface <ide> */ <del> protected function _parseCondition($field, $value) <add> protected function _parseCondition(string $field, $value) <ide> { <ide> $operator = '='; <ide> $expression = $field; <ide> protected function _parseCondition($field, $value) <ide> * @param string|\Cake\Database\Expression\IdentifierExpression $field The field name to get a type for. <ide> * @return string|null The computed type or null, if the type is unknown. <ide> */ <del> protected function _calculateType($field) <add> protected function _calculateType($field): ?string <ide> { <ide> $field = $field instanceof IdentifierExpression ? $field->getIdentifier() : $field; <ide> if (is_string($field)) { <ide><path>src/Database/Expression/TupleComparison.php <ide> public function __construct($fields, $values, $types = [], $conjunction = '=') <ide> * @param \Cake\Database\ValueBinder $generator Placeholder generator object <ide> * @return string <ide> */ <del> public function sql(ValueBinder $generator) <add> public function sql(ValueBinder $generator): string <ide> { <ide> $template = '(%s) %s (%s)'; <ide> $fields = []; <ide> public function sql(ValueBinder $generator) <ide> * @param \Cake\Database\ValueBinder $generator The value binder to convert expressions with. <ide> * @return string <ide> */ <del> protected function _stringifyValues($generator) <add> protected function _stringifyValues(\Cake\Database\ValueBinder $generator): string <ide> { <ide> $values = []; <ide> $parts = $this->getValue(); <ide> protected function _stringifyValues($generator) <ide> $bound = []; <ide> foreach ($value as $k => $val) { <ide> $valType = $multiType ? $type[$k] : $type; <del> $bound[] = $this->_bindValue($generator, $val, $valType); <add> $bound[] = $this->_bindValue($val, $generator, $valType); <ide> } <ide> <ide> $values[] = sprintf('(%s)', implode(',', $bound)); <ide> continue; <ide> } <ide> <ide> $valType = ($multiType && isset($type[$i])) ? $type[$i] : $type; <del> $values[] = $this->_bindValue($generator, $value, $valType); <add> $values[] = $this->_bindValue($value, $generator, $valType); <ide> } <ide> <ide> return implode(', ', $values); <ide> protected function _stringifyValues($generator) <ide> * Registers a value in the placeholder generator and returns the generated <ide> * placeholder <ide> * <del> * @param \Cake\Database\ValueBinder $generator The value binder <ide> * @param mixed $value The value to bind <add> * @param \Cake\Database\ValueBinder $generator The value binder <ide> * @param string $type The type to use <ide> * @return string generated placeholder <ide> */ <del> protected function _bindValue($generator, $value, $type) <add> protected function _bindValue($value, ValueBinder $generator, $type): string <ide> { <ide> $placeholder = $generator->placeholder('tuple'); <ide> $generator->bind($placeholder, $value, $type); <ide> protected function _bindValue($generator, $value, $type) <ide> * @param callable $callable The callable to apply to sub-expressions <ide> * @return void <ide> */ <del> public function traverse(callable $callable) <add> public function traverse(callable $callable): void <ide> { <ide> foreach ($this->getField() as $field) { <ide> $this->_traverseValue($field, $callable); <ide> public function traverse(callable $callable) <ide> * @param callable $callable The callable to use when traversing <ide> * @return void <ide> */ <del> protected function _traverseValue($value, $callable) <add> protected function _traverseValue($value, $callable): void <ide> { <ide> if ($value instanceof ExpressionInterface) { <ide> $callable($value); <ide> protected function _traverseValue($value, $callable) <ide> * <ide> * @return bool <ide> */ <del> public function isMulti() <add> public function isMulti(): bool <ide> { <ide> return in_array(strtolower($this->_operator), ['in', 'not in']); <ide> } <ide><path>src/Database/Expression/UnaryExpression.php <ide> class UnaryExpression implements ExpressionInterface <ide> * @param mixed $value the value to use as the operand for the expression <ide> * @param int $mode either UnaryExpression::PREFIX or UnaryExpression::POSTFIX <ide> */ <del> public function __construct($operator, $value, $mode = self::PREFIX) <add> public function __construct(string $operator, $value, $mode = self::PREFIX) <ide> { <ide> $this->_operator = $operator; <ide> $this->_value = $value; <ide> public function __construct($operator, $value, $mode = self::PREFIX) <ide> * @param \Cake\Database\ValueBinder $generator Placeholder generator object <ide> * @return string <ide> */ <del> public function sql(ValueBinder $generator) <add> public function sql(ValueBinder $generator): string <ide> { <ide> $operand = $this->_value; <ide> if ($operand instanceof ExpressionInterface) { <ide><path>src/Database/Expression/ValuesExpression.php <ide> use Cake\Database\ExpressionInterface; <ide> use Cake\Database\Query; <ide> use Cake\Database\Type\ExpressionTypeCasterTrait; <add>use Cake\Database\TypeMap; <ide> use Cake\Database\TypeMapTrait; <ide> use Cake\Database\ValueBinder; <ide> <ide> class ValuesExpression implements ExpressionInterface <ide> * @param array $columns The list of columns that are going to be part of the values. <ide> * @param \Cake\Database\TypeMap $typeMap A dictionary of column -> type names <ide> */ <del> public function __construct(array $columns, $typeMap) <add> public function __construct(array $columns, TypeMap $typeMap) <ide> { <ide> $this->_columns = $columns; <ide> $this->setTypeMap($typeMap); <ide> public function __construct(array $columns, $typeMap) <ide> * @return void <ide> * @throws \Cake\Database\Exception When mixing array + Query data types. <ide> */ <del> public function add($data) <add> public function add($data): void <ide> { <ide> if ((count($this->_values) && $data instanceof Query) || <ide> ($this->_query && is_array($data)) <ide> public function add($data) <ide> * @param array $cols Array with columns to be inserted. <ide> * @return $this <ide> */ <del> public function setColumns($cols) <add> public function setColumns(array $cols) <ide> { <ide> $this->_columns = $cols; <ide> $this->_castedExpressions = false; <ide> public function setColumns($cols) <ide> * <ide> * @return array <ide> */ <del> public function getColumns() <add> public function getColumns(): array <ide> { <ide> return $this->_columns; <ide> } <ide> public function getColumns() <ide> * <ide> * @return array <ide> */ <del> protected function _columnNames() <add> protected function _columnNames(): array <ide> { <ide> $columns = []; <ide> foreach ($this->_columns as $col) { <ide> protected function _columnNames() <ide> * @param array $values Array with values to be inserted. <ide> * @return $this <ide> */ <del> public function setValues($values) <add> public function setValues(array $values) <ide> { <ide> $this->_values = $values; <ide> $this->_castedExpressions = false; <ide> public function setValues($values) <ide> * <ide> * @return array <ide> */ <del> public function getValues() <add> public function getValues(): array <ide> { <ide> if (!$this->_castedExpressions) { <ide> $this->_processExpressions(); <ide> public function setQuery(Query $query) <ide> * <ide> * @return \Cake\Database\Query|null <ide> */ <del> public function getQuery() <add> public function getQuery(): ?Query <ide> { <ide> return $this->_query; <ide> } <ide> public function getQuery() <ide> * @param \Cake\Database\ValueBinder $generator Placeholder generator object <ide> * @return string <ide> */ <del> public function sql(ValueBinder $generator) <add> public function sql(ValueBinder $generator): string <ide> { <ide> if (empty($this->_values) && empty($this->_query)) { <ide> return ''; <ide> public function sql(ValueBinder $generator) <ide> * @param callable $visitor The visitor to traverse the expression with. <ide> * @return void <ide> */ <del> public function traverse(callable $visitor) <add> public function traverse(callable $visitor): void <ide> { <ide> if ($this->_query) { <ide> return; <ide> public function traverse(callable $visitor) <ide> * <ide> * @return void <ide> */ <del> protected function _processExpressions() <add> protected function _processExpressions(): void <ide> { <ide> $types = []; <ide> $typeMap = $this->getTypeMap(); <ide><path>tests/TestCase/Database/ExpressionTypeCastingTest.php <ide> use Cake\Database\Type\ExpressionTypeInterface; <ide> use Cake\Database\Type\StringType; <ide> use Cake\Database\TypeFactory; <add>use Cake\Database\TypeMap; <ide> use Cake\Database\ValueBinder; <ide> use Cake\TestSuite\TestCase; <ide> <ide> public function testFunctionExpression() <ide> */ <ide> public function testValuesExpression() <ide> { <del> $values = new ValuesExpression(['title'], ['title' => 'test']); <add> $values = new ValuesExpression(['title'], new TypeMap(['title' => 'test'])); <ide> $values->add(['title' => 'foo']); <ide> $values->add(['title' => 'bar']); <ide>
13
Ruby
Ruby
add launchctl_instructions method
d23366ae9a39390a31f5c1a424209c8169cfa7cb
<ide><path>Library/Homebrew/cmd/info.rb <ide> def info_formula f <ide> puts f.caveats <ide> end <ide> <add> f.launchctl_instructions <add> <ide> rescue FormulaUnavailableError <ide> # check for DIY installation <ide> d = HOMEBREW_PREFIX+name <ide><path>Library/Homebrew/formula.rb <ide> def prefix <ide> end <ide> def rack; prefix.parent end <ide> <add> def launchctl_instructions <add> if plist or Keg.new(prefix).plist_installed? <add> destination = plist_startup ? '/Library/LaunchDaemons' \ <add> : '~/Library/LaunchAgents' <add> <add> plist_filename = plist_path.basename <add> plist_link = "#{destination}/#{plist_filename}" <add> plist_domain = plist_path.basename('.plist') <add> destination_path = Pathname.new File.expand_path destination <add> plist_path = destination_path/plist_filename <add> s = [] <add> <add> # we readlink because this path probably doesn't exist since caveats <add> # occurs before the link step of installation <add> if not (plist_path).file? and not (plist_path).symlink? <add> if plist_startup <add> s << "To have launchd start #{name} at startup:" <add> s << " sudo mkdir -p #{destination}" unless destination_path.directory? <add> s << " sudo cp -fv #{HOMEBREW_PREFIX}/opt/#{name}/*.plist #{destination}" <add> else <add> s << "To have launchd start #{name} at login:" <add> s << " mkdir -p #{destination}" unless destination_path.directory? <add> s << " ln -sfv #{HOMEBREW_PREFIX}/opt/#{name}/*.plist #{destination}" <add> end <add> s << "Then to load #{name} now:" <add> if plist_startup <add> s << " sudo launchctl load #{plist_link}" <add> else <add> s << " launchctl load #{plist_link}" <add> end <add> if plist_manual <add> s << "Or, if you don't want/need launchctl, you can just run:" <add> s << " #{plist_manual}" <add> end <add> elsif Kernel.system "/bin/launchctl list #{plist_domain} &>/dev/null" <add> s << "You should reload #{name}:" <add> if plist_startup <add> s << " sudo launchctl unload #{plist_link}" <add> s << " sudo cp -fv #{HOMEBREW_PREFIX}/opt/#{name}/*.plist #{destination}" <add> s << " sudo launchctl load #{plist_link}" <add> else <add> s << " launchctl unload #{plist_link}" <add> s << " launchctl load #{plist_link}" <add> end <add> else <add> s << "To load #{name}:" <add> if plist_startup <add> s << " sudo launchctl load #{plist_link}" <add> else <add> s << " launchctl load #{plist_link}" <add> end <add> end <add> <add> ohai 'Caveats', s <add> <add> end <add> end <add> <ide> def bin; prefix+'bin' end <ide> def doc; share+'doc'+name end <ide> def include; prefix+'include' end <ide><path>Library/Homebrew/formula_installer.rb <ide> def caveats <ide> EOS <ide> end <ide> <del> if f.plist or keg.plist_installed? <del> destination = f.plist_startup ? '/Library/LaunchDaemons' \ <del> : '~/Library/LaunchAgents' <del> <del> plist_filename = f.plist_path.basename <del> plist_link = "#{destination}/#{plist_filename}" <del> plist_domain = f.plist_path.basename('.plist') <del> destination_path = Pathname.new File.expand_path destination <del> plist_path = destination_path/plist_filename <del> s = [] <del> <del> # we readlink because this path probably doesn't exist since caveats <del> # occurs before the link step of installation <del> if not (plist_path).file? and not (plist_path).symlink? <del> if f.plist_startup <del> s << "To have launchd start #{f.name} at startup:" <del> s << " sudo mkdir -p #{destination}" unless destination_path.directory? <del> s << " sudo cp -fv #{HOMEBREW_PREFIX}/opt/#{f.name}/*.plist #{destination}" <del> else <del> s << "To have launchd start #{f.name} at login:" <del> s << " mkdir -p #{destination}" unless destination_path.directory? <del> s << " ln -sfv #{HOMEBREW_PREFIX}/opt/#{f.name}/*.plist #{destination}" <del> end <del> s << "Then to load #{f.name} now:" <del> if f.plist_startup <del> s << " sudo launchctl load #{plist_link}" <del> else <del> s << " launchctl load #{plist_link}" <del> end <del> if f.plist_manual <del> s << "Or, if you don't want/need launchctl, you can just run:" <del> s << " #{f.plist_manual}" <del> end <del> elsif Kernel.system "/bin/launchctl list #{plist_domain} &>/dev/null" <del> s << "You should reload #{f.name}:" <del> if f.plist_startup <del> s << " sudo launchctl unload #{plist_link}" <del> s << " sudo cp -fv #{HOMEBREW_PREFIX}/opt/#{f.name}/*.plist #{destination}" <del> s << " sudo launchctl load #{plist_link}" <del> else <del> s << " launchctl unload #{plist_link}" <del> s << " launchctl load #{plist_link}" <del> end <del> else <del> s << "To load #{f.name}:" <del> if f.plist_startup <del> s << " sudo launchctl load #{plist_link}" <del> else <del> s << " launchctl load #{plist_link}" <del> end <del> end <del> <del> ohai 'Caveats', s <del> end <add> f.launchctl_instructions <ide> end <ide> <ide> def finish
3
Javascript
Javascript
deal ie8 out of size error
54a74d95bb19a1f1cbe36aeff42f20a302b53658
<ide><path>src/browser/ui/dom/DOMChildrenOperations.js <ide> function insertChildAt(parentNode, childNode, index) { <ide> // browsers so we must replace it with `null`. <ide> <ide> // fix render order error in safari <del> if (!(document.all && !document.addEventListener)) { <del> parentNode.insertBefore( <del> childNode, <del> parentNode.childNodes.item(index) || null <del> ); <del> } else { <del> //IE8 can't use `item` when childNodes is empty or dynamic insert. <del> //But read is well after insert. <del> parentNode.insertBefore( <del> childNode, <del> parentNode.childNodes[index] || null <del> ); <del> } <add> // IE8 can't use `item` when childNodes is empty or dynamic insert. <add> // Because index out of list <add> // But read is well after insert. <add> var beforeChild = index >= parentNode.childNodes.length ? <add> null : <add> parentNode.childNodes.item(index); <add> <add> parentNode.insertBefore( <add> childNode, <add> beforeChild <add> ); <ide> } <ide> <ide> /**
1
Mixed
Javascript
move queuemicrotask to stable
9f1282d536dc8f0a11714980b4b78ee0b979e1de
<ide><path>doc/api/globals.md <ide> added: v11.0.0 <ide> <ide> <!-- type=global --> <ide> <del>> Stability: 1 - Experimental <del> <ide> * `callback` {Function} Function to be queued. <ide> <ide> The `queueMicrotask()` method queues a microtask to invoke `callback`. If <ide><path>lib/internal/bootstrap/node.js <ide> function createGlobalConsole(consoleFromVM) { <ide> } <ide> <ide> function setupQueueMicrotask() { <add> const { queueMicrotask } = <add> NativeModule.require('internal/queue_microtask'); <ide> Object.defineProperty(global, 'queueMicrotask', { <del> get() { <del> process.emitWarning('queueMicrotask() is experimental.', <del> 'ExperimentalWarning'); <del> const { queueMicrotask } = <del> NativeModule.require('internal/queue_microtask'); <del> <del> Object.defineProperty(global, 'queueMicrotask', { <del> value: queueMicrotask, <del> writable: true, <del> enumerable: false, <del> configurable: true, <del> }); <del> return queueMicrotask; <del> }, <del> set(v) { <del> Object.defineProperty(global, 'queueMicrotask', { <del> value: v, <del> writable: true, <del> enumerable: false, <del> configurable: true, <del> }); <del> }, <del> enumerable: false, <add> value: queueMicrotask, <add> writable: true, <add> enumerable: true, <ide> configurable: true, <ide> }); <ide> } <ide><path>test/common/index.js <ide> let knownGlobals = [ <ide> global, <ide> setImmediate, <ide> setInterval, <del> setTimeout <add> setTimeout, <add> queueMicrotask, <ide> ]; <ide> <ide> if (global.gc) { <ide><path>test/parallel/test-global.js <ide> builtinModules.forEach((moduleName) => { <ide> { <ide> const expected = [ <ide> 'global', <add> 'queueMicrotask', <ide> 'clearImmediate', <ide> 'clearInterval', <ide> 'clearTimeout',
4
Text
Text
fix typo in docs
2a4492d74f425dd420a2c85e715cbd60974487a9
<ide><path>docs/templates/getting-started/sequential-model-guide.md <ide> Such a two-branch model can then be trained via e.g.: <ide> <ide> ```python <ide> final_model.compile(optimizer='rmsprop', loss='categorical_crossentropy') <del>final_model.fit([input_data_1, input_data_2], targets) # we pass on data array per model input <add>final_model.fit([input_data_1, input_data_2], targets) # we pass one data array per model input <ide> ``` <ide> <ide> The `Merge` layer supports a number of pre-defined modes:
1
Python
Python
use yaml to create metadata
255a17a089a507c23f0c786d704bf876d3eb5b4d
<ide><path>setup.py <ide> "parameterized", <ide> "protobuf", <ide> "psutil", <add> "pyyaml", <ide> "pydantic", <ide> "pytest", <ide> "pytest-sugar", <ide> def run(self): <ide> deps["huggingface-hub"], <ide> deps["numpy"], <ide> deps["packaging"], # utilities from PyPA to e.g., compare versions <add> deps["pyyaml"], # used for the model cards metadata <ide> deps["regex"], # for OpenAI GPT <ide> deps["requests"], # for downloading models over HTTPS <ide> deps["sacremoses"], # for XLM <ide><path>src/transformers/dependency_versions_table.py <ide> "parameterized": "parameterized", <ide> "protobuf": "protobuf", <ide> "psutil": "psutil", <add> "pyyaml": "pyyaml", <ide> "pydantic": "pydantic", <ide> "pytest": "pytest", <ide> "pytest-sugar": "pytest-sugar", <ide><path>src/transformers/modelcard.py <ide> from typing import Any, Dict, List, Optional, Union <ide> <ide> import requests <add>import yaml <ide> from huggingface_hub import HfApi <ide> <ide> from . import __version__ <ide> def _listify(obj): <ide> return obj <ide> <ide> <del>def _list_possibilities(name, tags): <del> if tags is None: <del> return "" <del> if isinstance(tags, str): <del> tags = [tags] <del> if len(tags) == 0: <del> return "" <del> name_tags = [f"- {tag}" for tag in tags] <del> return f"{name}:\n" + "\n".join(name_tags) + "\n" <add>def _insert_values_as_list(metadata, name, values): <add> if values is None: <add> return metadata <add> if isinstance(values, str): <add> values = [values] <add> if len(values) == 0: <add> return metadata <add> metadata[name] = values <add> return metadata <ide> <ide> <ide> def infer_metric_tags_from_eval_results(eval_results): <ide> def infer_metric_tags_from_eval_results(eval_results): <ide> return result <ide> <ide> <add>def _insert_value(metadata, name, value): <add> if value is None: <add> return metadata <add> metadata[name] = value <add> return metadata <add> <add> <ide> def is_hf_dataset(dataset): <ide> if not is_datasets_available(): <ide> return False <ide> def __post_init__(self): <ide> pass <ide> <ide> def create_model_index(self, metric_mapping): <del> model_index = f"model-index:\n- name: {self.model_name}\n" <add> model_index = {"name": self.model_name} <ide> <ide> # Dataset mapping tag -> name <ide> dataset_names = _listify(self.dataset) <ide> def create_model_index(self, metric_mapping): <ide> task_mapping = {None: None} <ide> if len(dataset_mapping) == 0: <ide> dataset_mapping = {None: None} <del> all_possibilities = [(task_tag, ds_tag) for task_tag in task_mapping for ds_tag in dataset_mapping] <ide> <del> model_index += " results:\n" <add> model_index["results"] = [] <add> <add> # One entry per dataset and per task <add> all_possibilities = [(task_tag, ds_tag) for task_tag in task_mapping for ds_tag in dataset_mapping] <ide> for task_tag, ds_tag in all_possibilities: <del> result = "" <add> result = {} <ide> if task_tag is not None: <del> result += f" - task:\n name: {task_mapping[task_tag]}\n type: {task_tag}\n" <add> result["task"] = {"name": task_mapping[task_tag], "type": task_tag} <add> <ide> if ds_tag is not None: <del> prefix = " - " if task_tag is None else " " <del> result += f"{prefix}dataset:\n name: {dataset_mapping[ds_tag]}\n type: {ds_tag}\n" <add> result["dataset"] = {"name": dataset_mapping[ds_tag], "type": ds_tag} <ide> if dataset_arg_mapping[ds_tag] is not None: <del> result += f" args: {dataset_arg_mapping[ds_tag]}\n" <add> result["dataset"]["args"] = dataset_arg_mapping[ds_tag] <add> <ide> if len(metric_mapping) > 0: <del> result += " metrics:\n" <ide> for metric_tag, metric_name in metric_mapping.items(): <del> value = self.eval_results[metric_name] <del> result += f" - name: {metric_name}\n type: {metric_tag}\n value: {value}\n" <add> result["metric"] = { <add> "name": metric_name, <add> "type": metric_tag, <add> "value": self.eval_results[metric_name], <add> } <add> <add> model_index["results"].append(result) <ide> <del> model_index += result <add> return [model_index] <add> <add> def create_metadata(self): <add> metric_mapping = infer_metric_tags_from_eval_results(self.eval_results) <ide> <del> return model_index <add> metadata = {} <add> metadata = _insert_values_as_list(metadata, "language", self.language) <add> metadata = _insert_value(metadata, "license", self.license) <add> metadata = _insert_values_as_list(metadata, "tags", self.tags) <add> metadata = _insert_values_as_list(metadata, "datasets", self.dataset_tags) <add> metadata = _insert_values_as_list(metadata, "metrics", list(metric_mapping.keys())) <add> metadata["model_index"] = self.create_model_index(metric_mapping) <add> <add> return metadata <ide> <ide> def to_model_card(self): <ide> model_card = "" <ide> <del> metric_mapping = infer_metric_tags_from_eval_results(self.eval_results) <del> <del> # Metadata <del> metadata = "" <del> metadata += _list_possibilities("language", self.language) <del> if self.license is not None: <del> metadata += f"license: {self.license}\n" <del> metadata += _list_possibilities("tags", self.tags) <del> metadata += _list_possibilities("datasets", self.dataset_tags) <del> metadata += _list_possibilities("metrics", list(metric_mapping.keys())) <del> metadata += "\n" + self.create_model_index(metric_mapping) <add> metadata = yaml.dump(self.create_metadata(), sort_keys=False) <ide> if len(metadata) > 0: <ide> model_card = f"---\n{metadata}---\n" <ide>
3
Javascript
Javascript
remove superfluous call to geterror
9124a941ae634d30b80b380e59b587d27e03efd8
<ide><path>schemas/ajv.absolutePath.js <ide> module.exports = (ajv) => ajv.addKeyword("absolutePath", { <ide> function callback(data) { <ide> const passes = expected === /^(?:[a-zA-Z]:)?(?:\/|\\)/.test(data); <ide> if(!passes) { <del> getErrorFor(expected, data, schema); <ide> callback.errors = [getErrorFor(expected, data, schema)]; <ide> } <ide> return passes;
1
Java
Java
remove unused field
7c433712d1149ddb11c31e4a9f31ba362ed6dbb5
<ide><path>org.springframework.context/src/main/java/org/springframework/ui/binding/UserValue.java <ide> public Object getValue() { <ide> return value; <ide> } <ide> <del> /** <del> * Is the user-entered value a String? <del> */ <del> public boolean isString() { <del> return value instanceof String; <del> } <del> <del> /** <del> * Is the user-entered value a String[]? <del> */ <del> public boolean isStringArray() { <del> return value instanceof String[]; <del> } <del> <ide> /** <ide> * Creates a new UserValue list with a single element. <ide> * @param property the property
1
Javascript
Javascript
fix duplicate react when running examples
7245b589262c56c6d3b4540c3cd3f17edda65467
<ide><path>examples/counter/webpack.config.js <ide> module.exports = { <ide> ], <ide> resolve: { <ide> alias: { <del> 'redux': path.join(__dirname, '../../src') <add> 'redux': path.join(__dirname, '..', '..', 'src'), <add> 'react': path.join(__dirname, '..', '..', 'node_modules', 'react') <ide> }, <ide> extensions: ['', '.js'] <ide> }, <ide><path>examples/todomvc/webpack.config.js <ide> module.exports = { <ide> ], <ide> resolve: { <ide> alias: { <del> 'redux': path.join(__dirname, '../../src') <add> 'redux': path.join(__dirname, '..', '..', 'src'), <add> 'react': path.join(__dirname, '..', '..', 'node_modules', 'react') <ide> }, <ide> extensions: ['', '.js'] <ide> },
2
Javascript
Javascript
fetch node to unmount separately from unmounting
622db4ee4fb61451b32fceb13d68a9589a2faecd
<ide><path>src/renderers/dom/client/__tests__/ReactMount-test.js <ide> describe('ReactMount', function() { <ide> 'render the new components instead of calling ReactDOM.render.' <ide> ); <ide> }); <add> <add> it('should not crash in node cache when unmounting', function() { <add> var Component = React.createClass({ <add> render: function() { <add> // Add refs to some nodes so that they get traversed and cached <add> return ( <add> <div ref="a"> <add> <div ref="b">b</div> <add> {this.props.showC && <div>c</div>} <add> </div> <add> ); <add> }, <add> }); <add> <add> var container = document.createElement('container'); <add> <add> ReactDOM.render(<div><Component showC={false} /></div>, container); <add> <add> // Right now, A and B are in the cache. When we add C, it won't get added to <add> // the cache (assuming markup-string mode). <add> ReactDOM.render(<div><Component showC={true} /></div>, container); <add> <add> // Remove A, B, and C. Unmounting C shouldn't cause B to get recached. <add> ReactDOM.render(<div></div>, container); <add> <add> // Add them back -- this shouldn't cause a cached node collision. <add> ReactDOM.render(<div><Component showC={true} /></div>, container); <add> <add> ReactDOM.unmountComponentAtNode(container); <add> }); <ide> }); <ide><path>src/renderers/dom/shared/ReactDOMComponent.js <ide> ReactDOMComponent.Mixin = { <ide> } <ide> }, <ide> <add> getNativeNode: function() { <add> return getNode(this); <add> }, <add> <ide> /** <ide> * Destroys all event registrations for this instance. Does not remove from <ide> * the DOM. That must be done by the parent. <ide> ReactDOMComponent.Mixin = { <ide> break; <ide> } <ide> <del> var nativeNode = getNode(this); <del> this._nativeNode = null; <ide> if (this._nodeHasLegacyProperties) { <del> nativeNode._reactInternalComponent = null; <add> this._nativeNode._reactInternalComponent = null; <ide> } <add> this._nativeNode = null; <ide> <ide> this.unmountChildren(); <ide> ReactBrowserEventEmitter.deleteAllListeners(this._rootNodeID); <ide> ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID); <ide> this._rootNodeID = null; <ide> this._wrapperState = null; <del> <del> return nativeNode; <ide> }, <ide> <ide> getPublicInstance: function() { <ide><path>src/renderers/dom/shared/ReactDOMTextComponent.js <ide> var escapeTextContentForBrowser = require('escapeTextContentForBrowser'); <ide> var setTextContent = require('setTextContent'); <ide> var validateDOMNesting = require('validateDOMNesting'); <ide> <add>function getNode(inst) { <add> if (inst._nativeNode) { <add> return inst._nativeNode; <add> } else { <add> return inst._nativeNode = ReactMount.getNode(inst._rootNodeID); <add> } <add>} <add> <ide> /** <ide> * Text nodes violate a couple assumptions that React makes about components: <ide> * <ide> assign(ReactDOMTextComponent.prototype, { <ide> // and/or updateComponent to do the actual update for consistency with <ide> // other component types? <ide> this._stringText = nextStringText; <del> var node = this._nativeNode; <del> if (!node) { <del> node = this._nativeNode = ReactMount.getNode(this._rootNodeID); <del> } <del> DOMChildrenOperations.updateTextContent(node, nextStringText); <add> DOMChildrenOperations.updateTextContent(getNode(this), nextStringText); <ide> } <ide> } <ide> }, <ide> <add> getNativeNode: function() { <add> return getNode(this); <add> }, <add> <ide> unmountComponent: function() { <del> var node = this._nativeNode || ReactMount.getNode(this._rootNodeID); <ide> this._nativeNode = null; <ide> ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID); <del> return node; <ide> }, <ide> <ide> }); <ide><path>src/renderers/shared/reconciler/ReactCompositeComponent.js <ide> var ReactCompositeComponentMixin = { <ide> return markup; <ide> }, <ide> <add> getNativeNode: function() { <add> return ReactReconciler.getNativeNode(this._renderedComponent); <add> }, <add> <ide> /** <ide> * Releases any resources allocated by `mountComponent`. <ide> * <ide> var ReactCompositeComponentMixin = { <ide> inst.componentWillUnmount(); <ide> } <ide> <del> var unmountedNativeNode = <del> ReactReconciler.unmountComponent(this._renderedComponent); <add> ReactReconciler.unmountComponent(this._renderedComponent); <ide> this._renderedComponent = null; <ide> this._instance = null; <ide> <ide> var ReactCompositeComponentMixin = { <ide> // TODO: inst.props = null; <ide> // TODO: inst.state = null; <ide> // TODO: inst.context = null; <del> return unmountedNativeNode; <ide> }, <ide> <ide> /** <ide> var ReactCompositeComponentMixin = { <ide> this._processChildContext(context) <ide> ); <ide> } else { <del> var oldNativeNode = <del> ReactReconciler.unmountComponent(prevComponentInstance); <add> // TODO: This is currently necessary due to the unfortunate caching <add> // that ReactMount does which makes it exceedingly difficult to unmount <add> // a set of siblings without accidentally repopulating the node cache (see <add> // #5151). Once ReactMount no longer stores the nodes by ID, this method <add> // can go away. <add> var oldNativeNode = ReactReconciler.getNativeNode(prevComponentInstance); <add> <add> ReactReconciler.unmountComponent(prevComponentInstance); <ide> <ide> this._renderedComponent = this._instantiateReactComponent( <ide> nextRenderedElement <ide><path>src/renderers/shared/reconciler/ReactEmptyComponent.js <ide> assign(ReactEmptyComponent.prototype, { <ide> }, <ide> receiveComponent: function() { <ide> }, <add> getNativeNode: function() { <add> return ReactReconciler.getNativeNode(this._renderedComponent); <add> }, <ide> unmountComponent: function(rootID, transaction, context) { <del> var nativeNode = ReactReconciler.unmountComponent(this._renderedComponent); <add> ReactReconciler.unmountComponent(this._renderedComponent); <ide> ReactEmptyComponentRegistry.deregisterNullComponentID(this._rootNodeID); <ide> this._rootNodeID = null; <ide> this._renderedComponent = null; <del> return nativeNode; <ide> }, <ide> }); <ide> <ide><path>src/renderers/shared/reconciler/ReactReconciler.js <ide> var ReactReconciler = { <ide> return markup; <ide> }, <ide> <add> /** <add> * Returns a value that can be passed to <add> * ReactComponentEnvironment.replaceNodeWithMarkup. <add> */ <add> getNativeNode: function(internalInstance) { <add> return internalInstance.getNativeNode(); <add> }, <add> <ide> /** <ide> * Releases any resources allocated by `mountComponent`. <ide> * <ide><path>src/renderers/shared/reconciler/instantiateReactComponent.js <ide> function instantiateReactComponent(node) { <ide> typeof instance.construct === 'function' && <ide> typeof instance.mountComponent === 'function' && <ide> typeof instance.receiveComponent === 'function' && <add> typeof instance.getNativeNode === 'function' && <ide> typeof instance.unmountComponent === 'function', <ide> 'Only React Components can be mounted.' <ide> ); <ide><path>src/test/ReactTestUtils.js <ide> NoopInternalComponent.prototype = { <ide> this._currentElement = element; <ide> }, <ide> <add> getNativeNode: function() { <add> return undefined; <add> }, <add> <ide> unmountComponent: function() { <ide> }, <ide>
8
PHP
PHP
add ability and command to clear queues
f34af246d57c51b320f9c5331936399daa9ee364
<ide><path>src/Illuminate/Contracts/Queue/ClearableQueue.php <add><?php <add> <add>namespace Illuminate\Contracts\Queue; <add> <add>interface ClearableQueue <add>{ <add> /** <add> * Clear all jobs from the queue. <add> * <add> * @param string $queue <add> * @return int <add> */ <add> public function clear($queue); <add>} <ide><path>src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php <ide> use Illuminate\Queue\Console\RestartCommand as QueueRestartCommand; <ide> use Illuminate\Queue\Console\RetryBatchCommand as QueueRetryBatchCommand; <ide> use Illuminate\Queue\Console\RetryCommand as QueueRetryCommand; <add>use Illuminate\Queue\Console\ClearCommand as QueueClearCommand; <ide> use Illuminate\Queue\Console\TableCommand; <ide> use Illuminate\Queue\Console\WorkCommand as QueueWorkCommand; <ide> use Illuminate\Routing\Console\ControllerMakeCommand; <ide> class ArtisanServiceProvider extends ServiceProvider implements DeferrableProvid <ide> 'Optimize' => 'command.optimize', <ide> 'OptimizeClear' => 'command.optimize.clear', <ide> 'PackageDiscover' => 'command.package.discover', <add> 'QueueClear' => 'command.queue.clear', <ide> 'QueueFailed' => 'command.queue.failed', <ide> 'QueueFlush' => 'command.queue.flush', <ide> 'QueueForget' => 'command.queue.forget', <ide> protected function registerQueueWorkCommand() <ide> }); <ide> } <ide> <add> /** <add> * Register the command. <add> * <add> * @return void <add> */ <add> protected function registerQueueClearCommand() <add> { <add> $this->app->singleton('command.queue.clear', function () { <add> return new QueueClearCommand; <add> }); <add> } <add> <ide> /** <ide> * Register the command. <ide> * <ide><path>src/Illuminate/Queue/Console/ClearCommand.php <add><?php <add> <add>namespace Illuminate\Queue\Console; <add> <add>use Illuminate\Console\Command; <add>use Illuminate\Console\ConfirmableTrait; <add>use Illuminate\Contracts\Queue\ClearableQueue; <add>use ReflectionClass; <add> <add>class ClearCommand extends Command <add>{ <add> use ConfirmableTrait; <add> <add> /** <add> * The console command name. <add> * <add> * @var string <add> */ <add> protected $signature = 'queue:clear <add> {connection? : The name of the queue connection to clear} <add> {--queue= : The name of the queue to clear}'; <add> <add> /** <add> * The console command description. <add> * <add> * @var string <add> */ <add> protected $description = 'Clear the queue'; <add> <add> /** <add> * Execute the console command. <add> * <add> * @return int|null <add> */ <add> public function handle() <add> { <add> if (! $this->confirmToProceed()) { <add> return 1; <add> } <add> <add> $connection = $this->argument('connection') <add> ?: $this->laravel['config']['queue.default']; <add> <add> // We need to get the right queue for the connection which is set in the queue <add> // configuration file for the application. We will pull it based on the set <add> // connection being run for the queue operation currently being executed. <add> $queueName = $this->getQueue($connection); <add> $queue = ($this->laravel['queue'])->connection($connection); <add> <add> if($queue instanceof ClearableQueue) { <add> $count = $queue->clear($queueName); <add> <add> $this->line('<info>Cleared '.$count.' jobs from the '.$queueName.' queue</info> '); <add> } else { <add> $this->line('<error>Clearing queues is not supported on '.(new ReflectionClass($queue))->getShortName().'</error> '); <add> } <add> <add> return 0; <add> } <add> <add> /** <add> * Get the queue name to clear. <add> * <add> * @param string $connection <add> * @return string <add> */ <add> protected function getQueue($connection) <add> { <add> return $this->option('queue') ?: $this->laravel['config']->get( <add> "queue.connections.{$connection}.queue", 'default' <add> ); <add> } <add>} <ide><path>src/Illuminate/Queue/DatabaseQueue.php <ide> protected function markJobAsReserved($job) <ide> return $job; <ide> } <ide> <add> /** <add> * Clear all jobs from the queue. <add> * <add> * @param string $queue <add> * @return int <add> */ <add> public function clear($queue) <add> { <add> return $this->database->table($this->table) <add> ->where('queue', $this->getQueue($queue)) <add> ->delete(); <add> } <add> <ide> /** <ide> * Delete a reserved job from the queue. <ide> * <ide><path>src/Illuminate/Queue/LuaScripts.php <ide> public static function size() <ide> LUA; <ide> } <ide> <add> /** <add> * Get the Lua script for clearing the queue. <add> * <add> * KEYS[1] - The name of the primary queue <add> * KEYS[2] - The name of the "delayed" queue <add> * KEYS[3] - The name of the "reserved" queue <add> * <add> * @return string <add> */ <add> public static function clear() <add> { <add> return <<<'LUA' <add>local size = redis.call('llen', KEYS[1]) + redis.call('zcard', KEYS[2]) + redis.call('zcard', KEYS[3]) <add>redis.call('del', KEYS[1], KEYS[2], KEYS[3]) <add>return size <add>LUA; <add> } <add> <ide> /** <ide> * Get the Lua script for pushing jobs onto the queue. <ide> * <ide><path>src/Illuminate/Queue/RedisQueue.php <ide> namespace Illuminate\Queue; <ide> <ide> use Illuminate\Contracts\Queue\Queue as QueueContract; <add>use Illuminate\Contracts\Queue\ClearableQueue; <ide> use Illuminate\Contracts\Redis\Factory as Redis; <ide> use Illuminate\Queue\Jobs\RedisJob; <ide> use Illuminate\Support\Str; <ide> <del>class RedisQueue extends Queue implements QueueContract <add>class RedisQueue extends Queue implements QueueContract, ClearableQueue <ide> { <ide> /** <ide> * The Redis factory implementation. <ide> protected function retrieveNextJob($queue, $block = true) <ide> return [$job, $reserved]; <ide> } <ide> <add> /** <add> * Clear all jobs from the queue. <add> * <add> * @param string $queue <add> * @return int <add> */ <add> public function clear($queue) <add> { <add> $queue = $this->getQueue($queue); <add> <add> return $this->getConnection()->eval( <add> LuaScripts::clear(), 3, $queue, $queue.':delayed', $queue.':reserved' <add> ); <add> } <add> <ide> /** <ide> * Delete a reserved job from the queue. <ide> * <ide><path>tests/Queue/QueueDatabaseQueueIntegrationTest.php <ide> public function testPoppedJobsIncrementAttempts() <ide> $this->assertEquals(1, $popped_job->attempts(), 'The "attempts" attribute of the Job object was not updated by pop!'); <ide> } <ide> <add> /** <add> * Test that the queue can be cleared. <add> */ <add> public function testThatQueueCanBeCleared() <add> { <add> $this->connection() <add> ->table('jobs') <add> ->insert([[ <add> 'id' => 1, <add> 'queue' => $mock_queue_name = 'mock_queue_name', <add> 'payload' => 'mock_payload', <add> 'attempts' => 0, <add> 'reserved_at' => Carbon::now()->addDay()->getTimestamp(), <add> 'available_at' => Carbon::now()->subDay()->getTimestamp(), <add> 'created_at' => Carbon::now()->getTimestamp(), <add> ], [ <add> 'id' => 2, <add> 'queue' => $mock_queue_name, <add> 'payload' => 'mock_payload 2', <add> 'attempts' => 0, <add> 'reserved_at' => null, <add> 'available_at' => Carbon::now()->subSeconds(1)->getTimestamp(), <add> 'created_at' => Carbon::now()->getTimestamp(), <add> ]]); <add> <add> $this->assertEquals(2, $this->queue->clear($mock_queue_name)); <add> $this->assertEquals(0, $this->queue->size()); <add> } <add> <ide> /** <ide> * Test that jobs that are not reserved and have an available_at value in the future, are not popped. <ide> */ <ide><path>tests/Queue/RedisQueueIntegrationTest.php <ide> public function testDelete($driver) <ide> $this->assertNull($this->queue->pop()); <ide> } <ide> <add> /** <add> * @dataProvider redisDriverProvider <add> * <add> * @param string $driver <add> */ <add> public function testClear($driver) <add> { <add> $this->setQueue($driver); <add> <add> $job1 = new RedisQueueIntegrationTestJob(30); <add> $job2 = new RedisQueueIntegrationTestJob(40); <add> <add> $this->queue->push($job1); <add> $this->queue->push($job2); <add> <add> $this->assertEquals(2, $this->queue->clear(null)); <add> $this->assertEquals(0, $this->queue->size()); <add> } <add> <ide> /** <ide> * @dataProvider redisDriverProvider <ide> *
8
Javascript
Javascript
add getenv to jest's type definition
e293f8e01fa605c5f6791ccbe1c65140862e1ace
<ide><path>flow/jest.js <ide> declare function spyOn(value: mixed, method: string): Object; <ide> /** Holds all functions related to manipulating test runner */ <ide> declare var jest: JestObjectType; <ide> <add>/** <add> * https://jasmine.github.io/2.4/custom_reporter.html <add> */ <add>type JasmineReporter = { <add> jasmineStarted?: (suiteInfo: mixed) => void, <add> suiteStarted?: (result: mixed) => void, <add> specStarted?: (result: mixed) => void, <add> specDone?: (result: mixed) => void, <add> suiteDone?: (result: mixed) => void, <add>}; <add> <ide> /** <ide> * The global Jasmine object, this is generally not exposed as the public API, <ide> * using features inside here could break in later versions of Jest. <ide> declare var jasmine: { <ide> baseName: string, <ide> methodNames: Array<string>, <ide> ): {[methodName: string]: JestSpyType}, <add> getEnv(): {addReporter: (jasmineReporter: JasmineReporter) => void}, <ide> objectContaining(value: Object): Object, <ide> stringMatching(value: string): string, <ide> };
1
Java
Java
fix a typo in package description
6900645d59b7fa808cac9bae369611b73793a8ce
<ide><path>spring-jdbc/src/main/java/org/springframework/jdbc/package-info.java <del> <ide> /** <ide> * <ide> * The classes in this package make JDBC easier to use and <ide> * reduce the likelihood of common errors. In particular, they: <ide> * <ul> <del> * <li>Simplify error handling, avoiding the need for try/catch/final <add> * <li>Simplify error handling, avoiding the need for try/catch/finally <ide> * blocks in application code. <ide> * <li>Present exceptions to application code in a generic hierarchy of <ide> * unchecked exceptions, enabling applications to catch data access
1
Ruby
Ruby
add homebrew_repository prefix for `brew up`
d3954d3d77e9e95327e2d54d98a9dae806acc24e
<ide><path>Library/Homebrew/global.rb <ide> <ide> HOMEBREW_PREFIX = (Pathname.getwd+__FILE__).dirname.parent.parent.cleanpath <ide> HOMEBREW_CELLAR = HOMEBREW_PREFIX+'Cellar' <add>HOMEBREW_REPOSITORY = HOMEBREW_CELLAR.realpath.parent <ide> HOMEBREW_VERSION = 0.4 <ide> HOMEBREW_WWW = 'http://bit.ly/Homebrew' <ide> <ide><path>Library/Homebrew/update.rb <ide> def current_revision <ide> private <ide> <ide> def in_prefix <del> Dir.chdir(HOMEBREW_PREFIX) { yield } <add> Dir.chdir(HOMEBREW_REPOSITORY) { yield } <ide> end <ide> <ide> def execute(cmd)
2
Python
Python
remove unused import
3c45bc35234faa07a4ac095fccbc4998c2481bdf
<ide><path>numpy/lib/scimath.py <ide> import numpy.core.numeric as nx <ide> import numpy.core.numerictypes as nt <ide> from numpy.core.numeric import asarray, any <del>from numpy.lib.type_check import isreal, asscalar <add>from numpy.lib.type_check import isreal <ide> <ide> <ide> __all__.extend([key for key in dir(nx.umath)
1
PHP
PHP
fix issues with stateless authentication
e457c14dec4dab203cb0cd38c0e9dca47ef0f549
<ide><path>lib/Cake/Controller/Component/AuthComponent.php <ide> class AuthComponent extends Component { <ide> */ <ide> public static $sessionKey = 'Auth.User'; <ide> <add>/** <add> * The current user, used for stateless authentication when <add> * sessions are not available. <add> * <add> * @var array <add> */ <add> protected static $_user = array(); <add> <ide> /** <ide> * A URL (defined as a string or array) to the controller action that handles <ide> * logins. Defaults to `/users/login` <ide> public function logout() { <ide> } <ide> <ide> /** <del> * Get the current user from the session. <add> * Get the current user. <add> * <add> * Will prefer the static user cache over sessions. The static user <add> * cache is primarily used for stateless authentication. For stateful authentication, <add> * cookies + sessions will be used. <ide> * <ide> * @param string $key field to retrieve. Leave null to get entire User record <ide> * @return mixed User record. or null if no user is logged in. <ide> * @link http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#accessing-the-logged-in-user <ide> */ <ide> public static function user($key = null) { <del> if (!CakeSession::check(self::$sessionKey)) { <add> if (empty(self::$_user) && !CakeSession::check(self::$sessionKey)) { <ide> return null; <ide> } <del> <del> if ($key == null) { <del> return CakeSession::read(self::$sessionKey); <add> if (!empty(self::$_user)) { <add> $user = self::$_user; <add> } else { <add> $user = CakeSession::read(self::$sessionKey); <add> } <add> if ($key === null) { <add> return $user; <ide> } <del> <del> $user = CakeSession::read(self::$sessionKey); <ide> if (isset($user[$key])) { <ide> return $user[$key]; <ide> } <ide> protected function _getUser() { <ide> foreach ($this->_authenticateObjects as $auth) { <ide> $result = $auth->getUser($this->request); <ide> if (!empty($result) && is_array($result)) { <add> self::$_user = $result; <ide> return true; <ide> } <ide> } <ide><path>lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php <ide> function _stop($status = 0) { <ide> $this->testStop = true; <ide> } <ide> <add> public static function clearUser() { <add> self::$_user = array(); <add> } <add> <ide> } <ide> <ide> /** <ide> public function tearDown() { <ide> $_SERVER = $this->_server; <ide> $_ENV = $this->_env; <ide> <add> TestAuthComponent::clearUser(); <ide> $this->Auth->Session->delete('Auth'); <ide> $this->Auth->Session->delete('Message.auth'); <ide> unset($this->Controller, $this->Auth); <ide> public function testLoginActionRedirect() { <ide> Configure::write('Routing.prefixes', $admin); <ide> } <ide> <add>/** <add> * Stateless auth methods like Basic should populate data that can be <add> * accessed by $this->user(). <add> * <add> * @return void <add> */ <add> public function testStatelessAuthWorksWithUser() { <add> $_SERVER['PHP_AUTH_USER'] = 'mariano'; <add> $_SERVER['PHP_AUTH_PW'] = 'cake'; <add> $url = '/auth_test/add'; <add> $this->Auth->request->addParams(Router::parse($url)); <add> <add> $this->Auth->authenticate = array( <add> 'Basic' => array('userModel' => 'AuthUser') <add> ); <add> $this->Auth->startup($this->Controller); <add> <add> $result = $this->Auth->user(); <add> $this->assertEquals('mariano', $result['username']); <add> <add> $result = $this->Auth->user('username'); <add> $this->assertEquals('mariano', $result); <add> } <add> <ide> /** <ide> * Tests that shutdown destroys the redirect session var <ide> * <ide> public function testLogout() { <ide> $this->assertNull($this->Auth->Session->read('Auth.redirect')); <ide> } <ide> <add>/** <add> * Logout should trigger a logout method on authentication objects. <add> * <add> * @return void <add> */ <ide> public function testLogoutTrigger() { <ide> $this->getMock('BaseAuthenticate', array('authenticate', 'logout'), array(), 'LogoutTriggerMockAuthenticate', false); <ide>
2
Text
Text
add 2.4.1 to changelog
e6de34d152b64c989a44f24cd7cd4cde63f94a9e
<ide><path>CHANGELOG.md <ide> - [#13024](https://github.com/emberjs/ember.js/pull/13024) [BUGFIX] Change internal async acceptance test helpers to be somewhat more efficient in determining router transition status. <ide> - [FEATURE] Add helper method named `Ember.assign` to roughly emulate `Object.assign`. <ide> <add>### 2.4.1 (February 29, 2016) <add> <add>- [#13030](https://github.com/emberjs/ember.js/pull/13030) [BUGFIX] Fix legacy addon deprecations <add> <ide> ### 2.4.0 (February 29, 2016) <ide> <ide> - [#12996](https://github.com/emberjs/ember.js/pull/12996) [BUGFIX] Fixes 12995 #with array yields true
1
Go
Go
fix a nil dereference in buildfile_test.go
aa8ea84d11ccac8f68fa1b0337633dd7d49a44fe
<ide><path>buildfile_test.go <ide> package docker <ide> <ide> import ( <ide> "io/ioutil" <add> "sync" <ide> "testing" <ide> ) <ide> <ide> func TestBuild(t *testing.T) { <ide> } <ide> defer nuke(runtime) <ide> <del> srv := &Server{runtime: runtime} <add> srv := &Server{ <add> runtime: runtime, <add> lock: &sync.Mutex{}, <add> pullingPool: make(map[string]struct{}), <add> pushingPool: make(map[string]struct{}), <add> } <ide> <ide> buildfile := NewBuildFile(srv, ioutil.Discard) <ide> if _, err := buildfile.Build(mkTestContext(ctx.dockerfile, ctx.files, t)); err != nil {
1
Python
Python
remove old comment
c8949ce88a8498d3b28466e39960a171e81954c3
<ide><path>spacy/lang/nb/__init__.py <ide> from ...attrs import LANG, NORM <ide> from ...util import update_exc, add_lookups <ide> <del># Borrowing french syntax parser because both languages use <del># universal dependencies for tagging/parsing. <del># Read here for more: <del># https://github.com/explosion/spaCy/pull/1882#issuecomment-361409573 <ide> from .syntax_iterators import SYNTAX_ITERATORS <ide> <ide>
1
Java
Java
fix typo in dispatcherservlet javadoc
1e0bdc0337843203f0971b2de7b9c5e2f221fbc5
<ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/DispatcherServlet.java <ide> public class DispatcherServlet extends FrameworkServlet { <ide> public static final String FLASH_MAP_MANAGER_ATTRIBUTE = DispatcherServlet.class.getName() + ".FLASH_MAP_MANAGER"; <ide> <ide> /** <del> * Name of request attribute that exposes an Exception resolved with an <add> * Name of request attribute that exposes an Exception resolved with a <ide> * {@link HandlerExceptionResolver} but where no view was rendered <ide> * (e.g. setting the status code). <ide> */
1
Javascript
Javascript
fix chunkasset hook call
7473ed490215d0a18b6062f4ea97f97b71789a4e
<ide><path>lib/HotModuleReplacementPlugin.js <ide> module.exports = class HotModuleReplacementPlugin { <ide> hotUpdateMainContent.c[chunkId] = true; <ide> currentChunk.files.push(filename); <ide> compilation.hooks.chunkAsset.call( <del> "HotModuleReplacementPlugin", <ide> currentChunk, <ide> filename <ide> );
1
Python
Python
remove unnecessary newline replace
d64cfce546739f498173ca1bfec5213ce4efc420
<ide><path>spacy/lang/it/punctuation.py <ide> from ..char_classes import ALPHA <ide> <ide> <del>ELISION = " ' ’ ".strip().replace(" ", "").replace("\n", "") <add>ELISION = " ' ’ ".strip().replace(" ", "") <ide> <ide> <ide> _infixes = TOKENIZER_INFIXES + [ <ide><path>spacy/lang/lb/punctuation.py <ide> from ..char_classes import ALPHA <ide> <ide> <del>ELISION = " ' ’ ".strip().replace(" ", "").replace("\n", "") <del>HYPHENS = r"- – β€” ‐ ‑".strip().replace(" ", "").replace("\n", "") <add>ELISION = " ' ’ ".strip().replace(" ", "") <add>HYPHENS = r"- – β€” ‐ ‑".strip().replace(" ", "") <ide> <ide> <ide> _infixes = TOKENIZER_INFIXES + [
2
Go
Go
fix bug in bitsequence.pushreservation
90711b0deff96169aafa8c5b9a25f0bb70a9123a
<ide><path>libnetwork/bitseq/sequence.go <ide> func pushReservation(bytePos, bitPos uint64, head *sequence, release bool) *sequ <ide> } <ide> removeCurrentIfEmpty(&newHead, newSequence, current) <ide> mergeSequences(previous) <del> } else if precBlocks == current.count-2 { // Last in sequence (B) <add> } else if precBlocks == current.count { // Last in sequence (B) <ide> newSequence.next = current.next <ide> current.next = newSequence <ide> mergeSequences(current) <ide><path>libnetwork/bitseq/sequence_test.go <ide> func TestPushReservation(t *testing.T) { <ide> {&sequence{block: 0xffff0000, count: 7}, 25, 7, &sequence{block: 0xffff0000, count: 7}}, <ide> {&sequence{block: 0xffffffff, count: 7, next: &sequence{block: 0xfffffffe, count: 1, next: &sequence{block: 0xffffffff, count: 1}}}, 7, 7, <ide> &sequence{block: 0xffffffff, count: 7, next: &sequence{block: 0xfffffffe, count: 1, next: &sequence{block: 0xffffffff, count: 1}}}}, <add> <add> // Set last bit <add> {&sequence{block: 0x0, count: 8}, 31, 7, &sequence{block: 0x0, count: 7, next: &sequence{block: 0x1, count: 1}}}, <add> <add> // Set bit in a middle sequence in the first block, first bit <add> {&sequence{block: 0x40000000, count: 1, next: &sequence{block: 0x0, count: 6, next: &sequence{block: 0x1, count: 1}}}, 4, 0, <add> &sequence{block: 0x40000000, count: 1, next: &sequence{block: 0x80000000, count: 1, next: &sequence{block: 0x0, count: 5, <add> next: &sequence{block: 0x1, count: 1}}}}}, <add> <add> // Set bit in a middle sequence in the first block, first bit (merge involved) <add> {&sequence{block: 0x80000000, count: 1, next: &sequence{block: 0x0, count: 6, next: &sequence{block: 0x1, count: 1}}}, 4, 0, <add> &sequence{block: 0x80000000, count: 2, next: &sequence{block: 0x0, count: 5, next: &sequence{block: 0x1, count: 1}}}}, <add> <add> // Set bit in a middle sequence in the first block, last bit <add> {&sequence{block: 0x80000000, count: 1, next: &sequence{block: 0x0, count: 6, next: &sequence{block: 0x1, count: 1}}}, 4, 31, <add> &sequence{block: 0x80000000, count: 1, next: &sequence{block: 0x1, count: 1, next: &sequence{block: 0x0, count: 5, <add> next: &sequence{block: 0x1, count: 1}}}}}, <add> <add> // Set bit in a middle sequence in the first block, middle bit <add> {&sequence{block: 0x80000000, count: 1, next: &sequence{block: 0x0, count: 6, next: &sequence{block: 0x1, count: 1}}}, 4, 16, <add> &sequence{block: 0x80000000, count: 1, next: &sequence{block: 0x8000, count: 1, next: &sequence{block: 0x0, count: 5, <add> next: &sequence{block: 0x1, count: 1}}}}}, <add> <add> // Set bit in a middle sequence in a middle block, first bit <add> {&sequence{block: 0x80000000, count: 1, next: &sequence{block: 0x0, count: 6, next: &sequence{block: 0x1, count: 1}}}, 16, 0, <add> &sequence{block: 0x80000000, count: 1, next: &sequence{block: 0x0, count: 3, next: &sequence{block: 0x80000000, count: 1, <add> next: &sequence{block: 0x0, count: 2, next: &sequence{block: 0x1, count: 1}}}}}}, <add> <add> // Set bit in a middle sequence in a middle block, last bit <add> {&sequence{block: 0x80000000, count: 1, next: &sequence{block: 0x0, count: 6, next: &sequence{block: 0x1, count: 1}}}, 16, 31, <add> &sequence{block: 0x80000000, count: 1, next: &sequence{block: 0x0, count: 3, next: &sequence{block: 0x1, count: 1, <add> next: &sequence{block: 0x0, count: 2, next: &sequence{block: 0x1, count: 1}}}}}}, <add> <add> // Set bit in a middle sequence in a middle block, middle bit <add> {&sequence{block: 0x80000000, count: 1, next: &sequence{block: 0x0, count: 6, next: &sequence{block: 0x1, count: 1}}}, 16, 15, <add> &sequence{block: 0x80000000, count: 1, next: &sequence{block: 0x0, count: 3, next: &sequence{block: 0x10000, count: 1, <add> next: &sequence{block: 0x0, count: 2, next: &sequence{block: 0x1, count: 1}}}}}}, <add> <add> // Set bit in a middle sequence in the last block, first bit <add> {&sequence{block: 0x80000000, count: 1, next: &sequence{block: 0x0, count: 6, next: &sequence{block: 0x1, count: 1}}}, 24, 0, <add> &sequence{block: 0x80000000, count: 1, next: &sequence{block: 0x0, count: 5, next: &sequence{block: 0x80000000, count: 1, <add> next: &sequence{block: 0x1, count: 1}}}}}, <add> <add> // Set bit in a middle sequence in the last block, last bit <add> {&sequence{block: 0x80000000, count: 1, next: &sequence{block: 0x0, count: 6, next: &sequence{block: 0x4, count: 1}}}, 24, 31, <add> &sequence{block: 0x80000000, count: 1, next: &sequence{block: 0x0, count: 5, next: &sequence{block: 0x1, count: 1, <add> next: &sequence{block: 0x4, count: 1}}}}}, <add> <add> // Set bit in a middle sequence in the last block, last bit (merge involved) <add> {&sequence{block: 0x80000000, count: 1, next: &sequence{block: 0x0, count: 6, next: &sequence{block: 0x1, count: 1}}}, 24, 31, <add> &sequence{block: 0x80000000, count: 1, next: &sequence{block: 0x0, count: 5, next: &sequence{block: 0x1, count: 2}}}}, <add> <add> // Set bit in a middle sequence in the last block, middle bit <add> {&sequence{block: 0x80000000, count: 1, next: &sequence{block: 0x0, count: 6, next: &sequence{block: 0x1, count: 1}}}, 24, 16, <add> &sequence{block: 0x80000000, count: 1, next: &sequence{block: 0x0, count: 5, next: &sequence{block: 0x8000, count: 1, <add> next: &sequence{block: 0x1, count: 1}}}}}, <ide> } <ide> <ide> for n, i := range input { <ide> func TestSetInRange(t *testing.T) { <ide> t.Fatalf("Unexpected error: %v", err) <ide> } <ide> } <add> <add>// This one tests an allocation pattern which unveiled an issue in pushReservation <add>// Specifically a failure in detecting when we are in the (B) case (the bit to set <add>// belongs to the last block of the current sequence). Because of a bug, code <add>// was assuming the bit belonged to a block in the middle of the current sequence. <add>// Which in turn caused an incorrect allocation when requesting a bit which is not <add>// in the first or last sequence block. <add>func TestSetAnyInRange(t *testing.T) { <add> numBits := uint64(8 * blockLen) <add> hnd, err := NewHandle("", nil, "", numBits) <add> if err != nil { <add> t.Fatal(err) <add> } <add> <add> if err := hnd.Set(0); err != nil { <add> t.Fatal(err) <add> } <add> <add> if err := hnd.Set(255); err != nil { <add> t.Fatal(err) <add> } <add> <add> o, err := hnd.SetAnyInRange(128, 255) <add> if err != nil { <add> t.Fatal(err) <add> } <add> if o != 128 { <add> t.Fatalf("Unexpected ordinal: %d", o) <add> } <add> <add> o, err = hnd.SetAnyInRange(128, 255) <add> if err != nil { <add> t.Fatal(err) <add> } <add> <add> if o != 129 { <add> t.Fatalf("Unexpected ordinal: %d", o) <add> } <add> <add> o, err = hnd.SetAnyInRange(246, 255) <add> if err != nil { <add> t.Fatal(err) <add> } <add> if o != 246 { <add> t.Fatalf("Unexpected ordinal: %d", o) <add> } <add> <add> o, err = hnd.SetAnyInRange(246, 255) <add> if err != nil { <add> t.Fatal(err) <add> } <add> if o != 247 { <add> t.Fatalf("Unexpected ordinal: %d", o) <add> } <add>}
2
Ruby
Ruby
fix some bottling logic
a24197bcc995781caa14855fecf7f31ac0ac43d8
<ide><path>Library/Homebrew/cmd/info.rb <ide> def info_formula(f) <ide> end <ide> <ide> if devel = f.devel <del> s = "devel #{devel.version}" <del> s += " (bottled)" if devel.bottled? <del> specs << s <add> specs << "devel #{devel.version}" <ide> end <ide> <ide> specs << "HEAD" if f.head <ide><path>Library/Homebrew/cmd/upgrade.rb <ide> def upgrade_formula(f) <ide> <ide> fi = FormulaInstaller.new(f) <ide> fi.options = options <del> fi.build_bottle = ARGV.build_bottle? || (!f.bottled? && f.build.bottle?) <add> fi.build_bottle = ARGV.build_bottle? || (!f.bottle_defined? && f.build.bottle?) <ide> fi.installed_on_request = !ARGV.named.empty? <ide> fi.link_keg ||= keg_was_linked if keg_had_linked_opt <ide> if tab <ide><path>Library/Homebrew/reinstall.rb <ide> def reinstall_formula(f, build_from_source: false) <ide> fi = FormulaInstaller.new(f) <ide> fi.options = options <ide> fi.invalid_option_names = build_options.invalid_option_names <del> fi.build_bottle = ARGV.build_bottle? || (!f.bottled? && f.build.bottle?) <add> fi.build_bottle = ARGV.build_bottle? || (!f.bottle_defined? && f.build.bottle?) <ide> fi.interactive = ARGV.interactive? <ide> fi.git = ARGV.git? <ide> fi.link_keg ||= keg_was_linked if keg_had_linked_opt
3
Javascript
Javascript
call ensurepage only in the dev mode
893884302507e01b1a44b3bedf06103cb142de51
<ide><path>server/index.js <ide> export default class Server { <ide> const paths = params.path || [''] <ide> const pathname = `/${paths.join('/')}` <ide> <del> await this.hotReloader.ensurePage(pathname) <add> if (this.dev) { <add> await this.hotReloader.ensurePage(pathname) <add> } <ide> <ide> if (!this.handleBuildId(params.buildId, res)) { <ide> res.setHeader('Content-Type', 'text/javascript')
1
Text
Text
fix docs for tension
568c61c56d733a5cc66fd128d1559b6b3cd075e9
<ide><path>docs/00-Getting-Started.md <ide> arc | Object | - | - <ide> *arc*.borderColor | Color | "#fff" | Default stroke color for arcs <ide> *arc*.borderWidth | Number | 2 | Default stroke width for arcs <ide> line | Object | - | - <del>*line*.lineTension | Number | 0.4 | Default bezier curve tension. Set to `0` for no bezier curves. <add>*line*.tension | Number | 0.4 | Default bezier curve tension. Set to `0` for no bezier curves. <ide> *line*.backgroundColor | Color | `Chart.defaults.global.defaultColor` | Default line fill color <ide> *line*.borderWidth | Number | 3 | Default line stroke width <ide> *line*.borderColor | Color | `Chart.defaults.global.defaultColor` | Default line stroke color
1