content_type
stringclasses
8 values
main_lang
stringclasses
7 values
message
stringlengths
1
50
sha
stringlengths
40
40
patch
stringlengths
52
962k
file_count
int64
1
300
Ruby
Ruby
avoid nil in url specs
248891fde17ec66751b460dfc2137ba9fb819395
<ide><path>Library/Homebrew/download_strategy.rb <ide> class AbstractDownloadStrategy <ide> def initialize name, package <ide> @url = package.url <del> @specs = package.specs <del> <del> case @specs <del> when Hash <del> @spec = @specs.keys.first # only use first spec <del> @ref = @specs.values.first <del> end <add> @spec, @ref = package.specs.dup.shift <ide> end <ide> <ide> def expand_safe_system_args args <ide><path>Library/Homebrew/formula.rb <ide> def build <ide> @build ||= BuildOptions.new(ARGV.options_only) <ide> end <ide> <del> def url val=nil, specs=nil <add> def url val=nil, specs={} <ide> if val.nil? <ide> return @stable.url if @stable <ide> return @url if @url <ide> def devel &block <ide> @devel.instance_eval(&block) <ide> end <ide> <del> def head val=nil, specs=nil <add> def head val=nil, specs={} <ide> return @head if val.nil? <ide> @head ||= HeadSoftwareSpec.new <ide> @head.url(val, specs) <ide><path>Library/Homebrew/formula_support.rb <ide> def initialize url=nil, version=nil <ide> @url = url <ide> @version = version <ide> @mirrors = [] <add> @specs = {} <ide> end <ide> <ide> def download_strategy <ide> def #{cksum}(val=nil) <ide> } <ide> end <ide> <del> def url val=nil, specs=nil <add> def url val=nil, specs={} <ide> return @url if val.nil? <ide> @url = val <del> unless specs.nil? <del> @using = specs.delete :using <del> @specs = specs <del> end <add> @using = specs.delete(:using) <add> @specs.merge!(specs) <ide> end <ide> <ide> def version val=nil <ide><path>Library/Homebrew/test/test_formula.rb <ide> def test_formula_specs <ide> assert_equal 'file:///foo.com/testball-0.2.tbz', f.devel.url <ide> assert_equal 'https://github.com/mxcl/homebrew.git', f.head.url <ide> <del> assert_nil f.stable.specs <del> assert_nil f.bottle.specs <del> assert_nil f.devel.specs <add> assert_empty f.stable.specs <add> assert_empty f.bottle.specs <add> assert_empty f.devel.specs <ide> assert_equal({ :tag => 'foo' }, f.head.specs) <ide> <ide> assert_equal CurlDownloadStrategy, f.stable.download_strategy
4
Javascript
Javascript
remove blank line from qunit test file
af1a6f5289a4ec08fa40e3c8357789fe904f4b37
<ide><path>blueprints/component-test/qunit-files/tests/__testType__/__path__/__test__.js <ide> moduleForComponent('<%= componentPathName %>', '<%= friendlyTestDescription %>', <ide> }); <ide> <ide> test('it renders', function(assert) { <del><% if (testType === 'integration' ) { %> <del> // Set any properties with this.set('myProperty', 'value'); <add> <% if (testType === 'integration' ) { %>// Set any properties with this.set('myProperty', 'value'); <ide> // Handle any actions with this.on('myAction', function(val) { ... }); <ide> <ide> this.render(hbs`{{<%= componentPathName %>}}`);
1
Javascript
Javascript
add test case for es2015 modules
d0bbf967fb51c031e16c5dfe040afce9a4113b5b
<ide><path>test/configCases/plugins/provide-plugin/harmony.js <add>export default "ECMAScript 2015"; <add>export const alias = "ECMAScript Harmony"; <add>export const year = 2015; <ide><path>test/configCases/plugins/provide-plugin/index.js <ide> it("should provide a module for a property request", function() { <ide> var x = dddeeefff; <ide> x.should.be.eql("fff"); <ide> }); <add> <add>it("should provide ES2015 modules", function() { <add> (es2015.default).should.be.eql("ECMAScript 2015"); <add> (es2015.alias).should.be.eql("ECMAScript Harmony"); <add> (es2015.year).should.be.eql(2015); <add> (es2015_name).should.be.eql("ECMAScript 2015"); <add> (es2015_alias).should.be.eql("ECMAScript Harmony"); <add> (es2015_year).should.be.eql(2015); <add>}); <ide><path>test/configCases/plugins/provide-plugin/webpack.config.js <ide> module.exports = { <ide> "bbb.ccc": "./bbbccc", <ide> "dddeeefff": ["./ddd", "eee", "3-f"], <ide> "process.env.NODE_ENV": "./env", <add> es2015: "./harmony", <add> es2015_name: ["./harmony", "default"], <add> es2015_alias: ["./harmony", "alias"], <add> es2015_year: ["./harmony", "year"], <ide> }) <ide> ] <ide> };
3
Ruby
Ruby
capture stdout during `popen_write`
246db8a134f162b764c36cd0050c8303a2197615
<ide><path>Library/Homebrew/utils/popen.rb <ide> def self.safe_popen_read(*args, **options, &block) <ide> raise ErrorDuringExecution.new(args, status: $CHILD_STATUS, output: [[:stdout, output]]) <ide> end <ide> <del> def self.popen_write(*args, **options, &block) <del> popen(args, "wb", options, &block) <add> def self.popen_write(*args, **options) <add> popen(args, "w+b", options) do |pipe| <add> output = "" <add> <add> # Before we yield to the block, capture as much output as we can <add> loop do <add> output += pipe.read_nonblock(4096) <add> rescue IO::WaitReadable, EOFError <add> break <add> end <add> <add> yield pipe <add> pipe.close_write <add> IO.select([pipe]) <add> <add> # Capture the rest of the output <add> output += pipe.read <add> output.freeze <add> end <ide> end <ide> <ide> def self.safe_popen_write(*args, **options, &block)
1
PHP
PHP
remove deprecated code from email class
c36f088e7697fa25e67338f6795f42b7de262e03
<ide><path>src/Mailer/Email.php <ide> protected function _constructTransport($name) <ide> } <ide> <ide> $className = App::className($config['className'], 'Mailer/Transport', 'Transport'); <del> if (!$className) { <del> $className = App::className($config['className'], 'Network/Email', 'Transport'); <del> if ($className) { <del> trigger_error( <del> 'Transports in "Network/Email" are deprecated, use "Mailer/Transport" instead.', <del> E_USER_DEPRECATED <del> ); <del> } <del> } <del> <ide> if (!$className) { <ide> throw new InvalidArgumentException(sprintf('Transport class "%s" not found.', $config['className'])); <ide> }
1
Javascript
Javascript
use double quotes
5f5dbd5c9506bfaa41b7897dca611fed895d167a
<ide><path>lib/EnvironmentPlugin.js <ide> class EnvironmentPlugin { <ide> if(value === undefined) { <ide> compiler.plugin("this-compilation", function(compilation) { <ide> const error = new Error( <del> 'EnvironmentPlugin - ' + key + ' environment variable is undefined. \n\n' + <del> 'You can pass an object with default values to suppress this warning. \n' + <del> 'See http://webpack.github.io/docs/list-of-plugins.html#environmentplugin for example.' <add> "EnvironmentPlugin - " + key + " environment variable is undefined. \n\n" + <add> "You can pass an object with default values to suppress this warning. \n" + <add> "See http://webpack.github.io/docs/list-of-plugins.html#environmentplugin for example." <ide> ); <ide> <ide> error.name = "EnvVariableNotDefinedError"; <ide> compilation.warnings.push(error); <ide> }); <ide> } <ide> <del> defs["process.env." + key] = typeof value === 'undefined' ? 'undefined' : JSON.stringify(value); <add> defs["process.env." + key] = value === undefined ? "undefined" : JSON.stringify(value); <ide> <ide> return defs; <ide> }.bind(this), {});
1
Javascript
Javascript
name anonymous functions for debugging purposes
335e86359dbb37cc309abeef2409490636628400
<ide><path>pdf.js <ide> var PDFFunction = (function pDFFunction() { <ide> return out; <ide> }; <ide> }, <del> constructStiched: function(fn, dict, xref) { <add> constructStiched: function pDFFunctionConstructStiched(fn, dict, xref) { <ide> var domain = dict.get('Domain'); <ide> var range = dict.get('Range'); <ide> <ide> var PDFFunction = (function pDFFunction() { <ide> var bounds = dict.get('Bounds'); <ide> var encode = dict.get('Encode'); <ide> <del> this.func = function(args) { <del> var clip = function(v, min, max) { <add> this.func = function pDFFunctionConstructStichedFunc(args) { <add> var clip = function pDFFunctionConstructStichedFuncClip(v, min, max) { <ide> if (v > max) <ide> v = max; <ide> else if (v < min) <ide> var PDFFunction = (function pDFFunction() { <ide> return fns[i].func([v2]); <ide> }; <ide> }, <del> constructPostScript: function() { <add> constructPostScript: function pDFFunctionConstructPostScript() { <ide> TODO('unhandled type of function'); <del> this.func = function() { <add> this.func = function pDFFunctionConstructPostScriptFunc() { <ide> return [255, 105, 180]; <ide> }; <ide> }
1
Text
Text
remove outdated arm information from release guide
7fa032b96bcb48f7d5514c9b24d39fc81febe27b
<ide><path>doc/guides/releases.md <ide> minutes which will prevent Jenkins from clearing the workspace to start a new <ide> one. This isn't a big deal, it's just a hassle because it'll result in another <ide> failed build if you start again! <ide> <del>ARMv7 takes the longest to compile. Unfortunately ccache isn't as effective on <del>release builds, I think it's because of the additional macro settings that go in <del>to a release build that nullify previous builds. Also most of the release build <del>machines are separate to the test build machines so they don't get any benefit <del>from ongoing compiles between releases. You can expect 1.5 hours for the ARMv7 <del>builder to complete and you should normally wait for this to finish. It is <del>possible to rush a release out if you want and add additional builds later but <del>we normally provide ARMv7 from initial promotion. <del> <del>You do not have to wait for the ARMv6 / Raspberry PI builds if they take longer <del>than the others. It is only necessary to have the main Linux (x64 and x86), <del>macOS .pkg and .tar.gz, Windows (x64 and x86) .msi and .exe, source, headers, <del>and docs (both produced currently by an macOS worker). **If you promote builds <del>_before_ ARM builds have finished, you must repeat the promotion step for the <del>ARM builds when they are ready**. If the ARMv6 build failed for some reason you <del>can use the <del>[`iojs-release-arm6-only`](https://ci-release.nodejs.org/job/iojs+release-arm6-only/) <del>build in the release CI to re-run the build only for ARMv6. When launching the <del>build make sure to use the same commit hash as for the original release. <del> <ide> ### 10. Test the build <ide> <ide> Jenkins collects the artifacts from the builds, allowing you to download and <ide> SHASUMS256.txt.sig. <ide> directory. <ide> </details> <ide> <del>If you didn't wait for ARM builds in the previous step before promoting the <del>release, you should re-run `tools/release.sh` after the ARM builds have <del>finished. That will move the ARM artifacts into the correct location. You will <del>be prompted to re-sign `SHASUMS256.txt`. <del> <ide> **It is possible to only sign a release by running `./tools/release.sh -s <ide> vX.Y.Z`.** <ide>
1
Ruby
Ruby
remove 1.8 backport
62456a35f15bb3a9c8883fac2c510480f3f276b7
<ide><path>activerecord/lib/active_record/base.rb <ide> def initialize_dup(other) <ide> super <ide> end <ide> <del> # Backport dup from 1.9 so that initialize_dup() gets called <del> unless Object.respond_to?(:initialize_dup) <del> def dup # :nodoc: <del> copy = super <del> copy.initialize_dup(self) <del> copy <del> end <del> end <del> <ide> # Populate +coder+ with attributes about this record that should be <ide> # serialized. The structure of +coder+ defined in this method is <ide> # guaranteed to match the structure of +coder+ passed to the +init_with+
1
Text
Text
add non-breaking space with example
1be6528d4b9360331cae0a17c940d791942d9aa0
<ide><path>guide/english/html/tutorials/how-to-insert-spaces-or-tabs-in-text-using-html-and-css/index.md <ide> Span Tags ``<span>`` are self closing tags meaning they do not need a ``/>``. <ide> <ide> An example of how a ``<span>`` tag inserts a space between text can be seen below. <ide> <del> ``<p>Hello may name is <span> James</p>`` <add> ``<p>Hello my name is <span> James</p>`` <ide> <ide> If you assign a class to your ``<span>`` then you could add some css to it. <ide> Like so, <ide> You can also give the ``<span>`` some inline-style properties, as shown below. <ide> <ide> ``<p>Hello my name is <span style="padding-left: 2px;"> James</p>`` <ide> <add>## Using Non-Breaking Space <add> <add>A non-breaking space is a space that will not break into a new line using **&nbsp**;. <add> <add>For example <add> <add>``<p>Hello my name is&nbsp;James</p>`` <add> <ide> ## More Information <ide> <ide> For more information on the <span> tag or on; How to Insert Spaces or Tabs in Text Using HTML and CSS, you can visit w3schools. https://www.w3schools.com/tags/tag_span.asp
1
Ruby
Ruby
fix bug where custom deprecators are not used
6c98fbd9c3cc28ccbfc1b46a9ce3d58fdb19f3c8
<ide><path>activesupport/lib/active_support/deprecation/method_wrappers.rb <ide> module MethodWrapper <ide> # module Fred <ide> # extend self <ide> # <del> # def foo; end <del> # def bar; end <del> # def baz; end <add> # def aaa; end <add> # def bbb; end <add> # def ccc; end <add> # def ddd; end <add> # def eee; end <ide> # end <ide> # <del> # ActiveSupport::Deprecation.deprecate_methods(Fred, :foo, bar: :qux, baz: 'use Bar#baz instead') <del> # # => [:foo, :bar, :baz] <add> # Using the default deprecator: <add> # ActiveSupport::Deprecation.deprecate_methods(Fred, :aaa, bbb: :zzz, ccc: 'use Bar#ccc instead') <add> # # => [:aaa, :bbb, :ccc] <ide> # <del> # Fred.foo <del> # # => "DEPRECATION WARNING: foo is deprecated and will be removed from Rails 4.1." <add> # Fred.aaa <add> # # DEPRECATION WARNING: aaa is deprecated and will be removed from Rails 5.0. (called from irb_binding at (irb):10) <add> # # => nil <ide> # <del> # Fred.bar <del> # # => "DEPRECATION WARNING: bar is deprecated and will be removed from Rails 4.1 (use qux instead)." <add> # Fred.bbb <add> # # DEPRECATION WARNING: bbb is deprecated and will be removed from Rails 5.0 (use zzz instead). (called from irb_binding at (irb):11) <add> # # => nil <ide> # <del> # Fred.baz <del> # # => "DEPRECATION WARNING: baz is deprecated and will be removed from Rails 4.1 (use Bar#baz instead)." <add> # Fred.ccc <add> # # DEPRECATION WARNING: ccc is deprecated and will be removed from Rails 5.0 (use Bar#ccc instead). (called from irb_binding at (irb):12) <add> # # => nil <add> # <add> # Passing in a custom deprecator: <add> # custom_deprecator = ActiveSupport::Deprecation.new('next-release', 'MyGem') <add> # ActiveSupport::Deprecation.deprecate_methods(Fred, ddd: :zzz, deprecator: custom_deprecator) <add> # # => [:ddd] <add> # <add> # Fred.ddd <add> # DEPRECATION WARNING: ddd is deprecated and will be removed from MyGem next-release (use zzz instead). (called from irb_binding at (irb):15) <add> # # => nil <add> # <add> # Using a custom deprecator directly: <add> # custom_deprecator = ActiveSupport::Deprecation.new('next-release', 'MyGem') <add> # custom_deprecator.deprecate_methods(Fred, eee: :zzz) <add> # # => [:eee] <add> # <add> # Fred.eee <add> # DEPRECATION WARNING: eee is deprecated and will be removed from MyGem next-release (use zzz instead). (called from irb_binding at (irb):18) <add> # # => nil <ide> def deprecate_methods(target_module, *method_names) <ide> options = method_names.extract_options! <del> deprecator = options.delete(:deprecator) || ActiveSupport::Deprecation.instance <add> deprecator = options.delete(:deprecator) || self <ide> method_names += options.keys <ide> <ide> mod = Module.new do <ide><path>activesupport/lib/active_support/testing/deprecation.rb <ide> module ActiveSupport <ide> module Testing <ide> module Deprecation #:nodoc: <del> def assert_deprecated(match = nil, &block) <del> result, warnings = collect_deprecations(&block) <add> def assert_deprecated(match = nil, deprecator = nil, &block) <add> result, warnings = collect_deprecations(deprecator, &block) <ide> assert !warnings.empty?, "Expected a deprecation warning within the block but received none" <ide> if match <ide> match = Regexp.new(Regexp.escape(match)) unless match.is_a?(Regexp) <ide> def assert_deprecated(match = nil, &block) <ide> result <ide> end <ide> <del> def assert_not_deprecated(&block) <del> result, deprecations = collect_deprecations(&block) <add> def assert_not_deprecated(deprecator = nil, &block) <add> result, deprecations = collect_deprecations(deprecator, &block) <ide> assert deprecations.empty?, "Expected no deprecation warning within the block but received #{deprecations.size}: \n #{deprecations * "\n "}" <ide> result <ide> end <ide> <del> def collect_deprecations <del> old_behavior = ActiveSupport::Deprecation.behavior <add> def collect_deprecations(deprecator = nil) <add> deprecator ||= ActiveSupport::Deprecation <add> old_behavior = deprecator.behavior <ide> deprecations = [] <del> ActiveSupport::Deprecation.behavior = Proc.new do |message, callstack| <add> deprecator.behavior = Proc.new do |message, callstack| <ide> deprecations << message <ide> end <ide> result = yield <ide> [result, deprecations] <ide> ensure <del> ActiveSupport::Deprecation.behavior = old_behavior <add> deprecator.behavior = old_behavior <ide> end <ide> end <ide> end <ide><path>activesupport/test/deprecation/method_wrappers_test.rb <add>require 'abstract_unit' <add>require 'active_support/deprecation' <add> <add>class MethodWrappersTest < ActiveSupport::TestCase <add> def setup <add> @klass = Class.new do <add> def new_method; "abc" end <add> alias_method :old_method, :new_method <add> end <add> end <add> <add> def test_deprecate_methods_warning_default <add> warning = /old_method is deprecated and will be removed from Rails \d.\d \(use new_method instead\)/ <add> ActiveSupport::Deprecation.deprecate_methods(@klass, :old_method => :new_method) <add> <add> assert_deprecated(warning) { assert_equal "abc", @klass.new.old_method } <add> end <add> <add> def test_deprecate_methods_warning_with_optional_deprecator <add> warning = /old_method is deprecated and will be removed from MyGem next-release \(use new_method instead\)/ <add> deprecator = ActiveSupport::Deprecation.new("next-release", "MyGem") <add> ActiveSupport::Deprecation.deprecate_methods(@klass, :old_method => :new_method, :deprecator => deprecator) <add> <add> assert_deprecated(warning, deprecator) { assert_equal "abc", @klass.new.old_method } <add> end <add> <add> def test_deprecate_methods_warning_when_deprecated_with_custom_deprecator <add> warning = /old_method is deprecated and will be removed from MyGem next-release \(use new_method instead\)/ <add> deprecator = ActiveSupport::Deprecation.new("next-release", "MyGem") <add> deprecator.deprecate_methods(@klass, :old_method => :new_method) <add> <add> assert_deprecated(warning, deprecator) { assert_equal "abc", @klass.new.old_method } <add> end <add>end <ide><path>activesupport/test/testing/deprecation_test.rb <add>require 'abstract_unit' <add>require 'active_support/deprecation' <add> <add>class DeprecationTestingTest < ActiveSupport::TestCase <add> def setup <add> @klass = Class.new do <add> def new_method; "abc" end <add> alias_method :old_method, :new_method <add> end <add> end <add> <add> def test_assert_deprecated_raises_when_method_not_deprecated <add> assert_raises(Minitest::Assertion) { assert_deprecated { @klass.new.old_method } } <add> end <add> <add> def test_assert_not_deprecated <add> ActiveSupport::Deprecation.deprecate_methods(@klass, :old_method => :new_method) <add> <add> assert_raises(Minitest::Assertion) { assert_not_deprecated { @klass.new.old_method } } <add> end <add>end
4
Ruby
Ruby
add missing dependency
944b4d57960569d5c9a08783044677721a6de4df
<ide><path>actionpack/lib/action_controller/metal/mime_responds.rb <ide> module ActionController #:nodoc: <ide> module MimeResponds <ide> extend ActiveSupport::Concern <ide> <add> include ActionController::ImplicitRender <add> <ide> included do <ide> class_attribute :responder, :mimes_for_respond_to <ide> self.responder = ActionController::Responder
1
PHP
PHP
fix cs error
9fb13bf865b19fc01918a50677d4d741c5daa876
<ide><path>src/ORM/Association/BelongsToMany.php <ide> <ide> use Cake\Core\App; <ide> use Cake\Database\Expression\IdentifierExpression; <del>use Cake\Database\ExpressionInterface; <ide> use Cake\Database\Expression\QueryExpression; <add>use Cake\Database\ExpressionInterface; <ide> use Cake\Datasource\EntityInterface; <ide> use Cake\ORM\Association; <ide> use Cake\ORM\Association\Loader\SelectWithPivotLoader;
1
Javascript
Javascript
reactcomponentexpect fails silently
39c3fb2b097c4d2d7b7bb9b5b1a33b88c180fd8f
<ide><path>src/test/reactComponentExpect.js <ide> function reactComponentExpect(instance) { <ide> } <ide> <ide> expect(instance).not.toBeNull(); <add> expect(instance).not.toBeUndefined(); <ide> <ide> invariant( <ide> ReactTestUtils.isCompositeComponent(instance),
1
Python
Python
add unit-test for record-arrays with object field
7ae3b470b424cd8f80fdf54eab22a7fa8ac127ac
<ide><path>numpy/core/records.py <ide> def __getattribute__(self, attr): <ide> fielddict = sb.ndarray.__getattribute__(self,'dtype').fields <ide> try: <ide> res = fielddict[attr][:2] <del> except KeyError: <add> except (TypeError, KeyError): <ide> raise AttributeError, "record array has no attribute %s" % attr <ide> obj = self.getfield(*res) <ide> # if it has fields return a recarray, otherwise return <ide> def __setattr__(self, attr, val): <ide> fielddict = sb.ndarray.__getattribute__(self,'dtype').fields <ide> try: <ide> res = fielddict[attr][:2] <del> except KeyError: <add> except (TypeError,KeyError): <ide> raise AttributeError, "record array has no attribute %s" % attr <ide> return self.setfield(val,*res) <ide> <add> def __getitem__(self, indx): <add> obj = sb.ndarray.__getitem__(self, indx) <add> if (isinstance(obj, sb.ndarray) and obj.dtype.isbuiltin): <add> return obj.view(sb.ndarray) <add> return obj <add> <ide> def field(self,attr, val=None): <ide> fielddict = sb.ndarray.__getattribute__(self,'dtype').fields <ide> <ide><path>numpy/core/tests/test_records.py <ide> def check_recarray_fromfile(self): <ide> fd.seek(2880*2) <ide> r = rec.fromfile(fd, formats='f8,i4,a5', shape=3, byteorder='big') <ide> <add> def check_recarray_from_obj(self): <add> count = 10 <add> a = zeros(count, dtype='O') <add> b = zeros(count, dtype='f8') <add> c = zeros(count, dtype='f8') <add> for i in range(len(a)): <add> a[i] = range(1,10) <add> <add> mine = numpy.rec.fromarrays([a,b,c], <add> names='date,data1,data2') <add> for i in range(len(a)): <add> assert(mine.date[i]==range(1,10)) <add> assert(mine.data1[i]==0.0) <add> assert(mine.data2[i]==0.0) <add> <ide> if __name__ == "__main__": <ide> NumpyTest().run()
2
Javascript
Javascript
fix tests in amd mode
56136897f241db22560b58c3518578ca1453d5c7
<ide><path>src/attributes/val.js <ide> define( [ <ide> "../core", <ide> "../core/stripAndCollapse", <ide> "./support", <del> "../core/init", <del> "../core/nodeName" <add> "../core/nodeName", <add> <add> "../core/init" <ide> ], function( jQuery, stripAndCollapse, support, nodeName ) { <ide> <ide> "use strict"; <ide><path>src/core/init.js <ide> define( [ <ide> "../core", <ide> "../var/document", <ide> "./var/rsingleTag", <add> <ide> "../traversing/findFilter" <ide> ], function( jQuery, document, rsingleTag ) { <ide> <ide><path>src/event.js <ide> define( [ <ide> "./var/rcheckableType", <ide> "./var/slice", <ide> "./data/var/dataPriv", <del> "./core/init", <ide> "./core/nodeName", <add> <add> "./core/init", <ide> "./selector" <del>], function( jQuery, document, documentElement, rnothtmlwhite, rcheckableType, slice, dataPriv, <del> nodeName ) { <add>], function( jQuery, document, documentElement, rnothtmlwhite, <add> rcheckableType, slice, dataPriv, nodeName ) { <ide> <ide> "use strict"; <ide> <ide><path>src/manipulation.js <ide> define( [ <ide> "./data/var/dataUser", <ide> "./data/var/acceptData", <ide> "./core/DOMEval", <add> "./core/nodeName", <ide> <ide> "./core/init", <del> "./core/nodeName", <ide> "./traversing", <ide> "./selector", <ide> "./event" <ide><path>src/offset.js <ide> define( [ <ide> "./css/curCSS", <ide> "./css/addGetHookIf", <ide> "./css/support", <add> "./core/nodeName", <ide> <ide> "./core/init", <del> "./core/nodeName", <ide> "./css", <ide> "./selector" // contains <del>], function( jQuery, access, document, documentElement, rnumnonpx, curCSS, addGetHookIf, support, <del> nodeName ) { <add>], function( jQuery, access, document, documentElement, rnumnonpx, <add> curCSS, addGetHookIf, support, nodeName ) { <ide> <ide> "use strict"; <ide> <ide><path>src/traversing.js <ide> define( [ <ide> "./traversing/var/dir", <ide> "./traversing/var/siblings", <ide> "./traversing/var/rneedsContext", <del> "./core/init", <ide> "./core/nodeName", <add> <add> "./core/init", <ide> "./traversing/findFilter", <ide> "./selector" <ide> ], function( jQuery, indexOf, dir, siblings, rneedsContext, nodeName ) {
6
Text
Text
add live samples back to docs for each chart type
9ea18065add95d80a807e67f27018caadcfeb44c
<ide><path>docs/charts/bar.md <ide> # Bar <ide> A bar chart provides a way of showing data values represented as vertical bars. It is sometimes used to show trend data, and the comparison of multiple data sets side by side. <ide> <add>{% chartjs %} <add>{ <add> "type": "bar", <add> "data": { <add> "labels": [ <add> "January", <add> "February", <add> "March", <add> "April", <add> "May", <add> "June", <add> "July" <add> ], <add> "datasets": [{ <add> "label": "My First Dataset", <add> "data": [65, 59, 80, 81, 56, 55, 40], <add> "fill": false, <add> "backgroundColor": [ <add> "rgba(255, 99, 132, 0.2)", <add> "rgba(255, 159, 64, 0.2)", <add> "rgba(255, 205, 86, 0.2)", <add> "rgba(75, 192, 192, 0.2)", <add> "rgba(54, 162, 235, 0.2)", <add> "rgba(153, 102, 255, 0.2)", <add> "rgba(201, 203, 207, 0.2)" <add> ], <add> "borderColor": [ <add> "rgb(255, 99, 132)", <add> "rgb(255, 159, 64)", <add> "rgb(255, 205, 86)", <add> "rgb(75, 192, 192)", <add> "rgb(54, 162, 235)", <add> "rgb(153, 102, 255)", <add> "rgb(201, 203, 207)" <add> ], <add> "borderWidth": 1 <add> }] <add> }, <add> "options": { <add> "scales": { <add> "yAxes": [{ <add> "ticks": { <add> "beginAtZero": true <add> } <add> }] <add> } <add> } <add>} <add>{% endchartjs %} <add> <ide> ## Example Usage <ide> ```javascript <ide> var myBarChart = new Chart(ctx, { <ide> The following dataset properties are specific to stacked bar charts. <ide> <ide> # Horizontal Bar Chart <ide> A horizontal bar chart is a variation on a vertical bar chart. It is sometimes used to show trend data, and the comparison of multiple data sets side by side. <add>{% chartjs %} <add>{ <add> "type": "horizontalBar", <add> "data": { <add> "labels": ["January", "February", "March", "April", "May", "June", "July"], <add> "datasets": [{ <add> "label": "My First Dataset", <add> "data": [65, 59, 80, 81, 56, 55, 40], <add> "fill": false, <add> "backgroundColor": [ <add> "rgba(255, 99, 132, 0.2)", <add> "rgba(255, 159, 64, 0.2)", <add> "rgba(255, 205, 86, 0.2)", <add> "rgba(75, 192, 192, 0.2)", <add> "rgba(54, 162, 235, 0.2)", <add> "rgba(153, 102, 255, 0.2)", <add> "rgba(201, 203, 207, 0.2)" <add> ], <add> "borderColor": [ <add> "rgb(255, 99, 132)", <add> "rgb(255, 159, 64)", <add> "rgb(255, 205, 86)", <add> "rgb(75, 192, 192)", <add> "rgb(54, 162, 235)", <add> "rgb(153, 102, 255)", <add> "rgb(201, 203, 207)" <add> ], <add> "borderWidth": 1 <add> }] <add> }, <add> "options": { <add> "scales": { <add> "xAxes": [{ <add> "ticks": { <add> "beginAtZero": true <add> } <add> }] <add> } <add> } <add>} <add>{% endchartjs %} <ide> <ide> ## Example <ide> ```javascript <ide><path>docs/charts/bubble.md <ide> <ide> A bubble chart is used to display three dimensions of data at the same time. The location of the bubble is determined by the first two dimensions and the corresponding horizontal and vertical axes. The third dimension is represented by the size of the individual bubbles. <ide> <add>{% chartjs %} <add>{ <add> "type": "bubble", <add> "data": { <add> "datasets": [{ <add> "label": "First Dataset", <add> "data": [{ <add> "x": 20, <add> "y": 30, <add> "r": 15 <add> }, { <add> "x": 40, <add> "y": 10, <add> "r": 10 <add> }], <add> "backgroundColor": "rgb(255, 99, 132)" <add> }] <add> }, <add>} <add>{% endchartjs %} <add> <ide> ## Example Usage <ide> <ide> ```javascript <ide><path>docs/charts/doughnut.md <ide> Pie and doughnut charts are effectively the same class in Chart.js, but have one <ide> <ide> They are also registered under two aliases in the `Chart` core. Other than their different default value, and different alias, they are exactly the same. <ide> <add>{% chartjs %} <add>{ <add> "type": "doughnut", <add> "data": { <add> "labels": [ <add> "Red", <add> "Blue", <add> "Yellow", <add> ], <add> "datasets": [{ <add> "label": "My First Dataset", <add> "data": [300, 50, 100], <add> "backgroundColor": [ <add> "rgb(255, 99, 132)", <add> "rgb(54, 162, 235)", <add> "rgb(255, 205, 86)", <add> ] <add> }] <add> }, <add>} <add>{% endchartjs %} <add> <ide> ## Example Usage <ide> <ide> ```javascript <ide><path>docs/charts/line.md <ide> # Line <ide> A line chart is a way of plotting data points on a line. Often, it is used to show trend data, or the comparison of two data sets. <ide> <add>{% chartjs %} <add>{ <add> "type": "line", <add> "data": { <add> "labels": [ <add> "January", <add> "February", <add> "March", <add> "April", <add> "May", <add> "June", <add> "July" <add> ], <add> "datasets": [{ <add> "label": "My First Dataset", <add> "data": [65, 59, 80, 81, 56, 55, 40], <add> "fill": false, <add> "borderColor": "rgb(75, 192, 192)", <add> "lineTension": 0.1 <add> }] <add> }, <add> "options": { <add> <add> } <add>} <add>{% endchartjs %} <add> <ide> ## Example Usage <ide> ```javascript <ide> var myLineChart = new Chart(ctx, { <ide><path>docs/charts/mixed.md <ide> var mixedChart = new Chart(ctx, { <ide> }); <ide> ``` <ide> <del>At this point we have a chart rendering how we'd like. It's important to note that the default options for a line chart are not merged in this case. Only the options for the default type are merged in. In this case, that means that the default options for a bar chart are merged because that is the type specified by the `type` field. <ide>\ No newline at end of file <add>At this point we have a chart rendering how we'd like. It's important to note that the default options for a line chart are not merged in this case. Only the options for the default type are merged in. In this case, that means that the default options for a bar chart are merged because that is the type specified by the `type` field. <add> <add>{% chartjs %} <add>{ <add> "type": "bar", <add> "data": { <add> "labels": [ <add> "January", <add> "February", <add> "March", <add> "April" <add> ], <add> "datasets": [{ <add> "label": "Bar Dataset", <add> "data": [10, 20, 30, 40], <add> "borderColor": "rgb(255, 99, 132)", <add> "backgroundColor": "rgba(255, 99, 132, 0.2)" <add> }, { <add> "label": "Line Dataset", <add> "data": [50, 50, 50, 50], <add> "type": "line", <add> "fill": false, <add> "borderColor": "rgb(54, 162, 235)" <add> }] <add> }, <add> "options": { <add> "scales": { <add> "yAxes": [{ <add> "ticks": { <add> "beginAtZero": true <add> } <add> }] <add> } <add> } <add>} <add>{% endchartjs %} <ide><path>docs/charts/polar.md <ide> Polar area charts are similar to pie charts, but each segment has the same angle <ide> <ide> This type of chart is often useful when we want to show a comparison data similar to a pie chart, but also show a scale of values for context. <ide> <add>{% chartjs %} <add>{ <add> "type": "polarArea", <add> "data": { <add> "labels": [ <add> "Red", <add> "Green", <add> "Yellow", <add> "Grey", <add> "Blue" <add> ], <add> "datasets": [{ <add> "label": "My First Dataset", <add> "data": [11, 16, 7, 3, 14], <add> "backgroundColor": [ <add> "rgb(255, 99, 132)", <add> "rgb(75, 192, 192)", <add> "rgb(255, 205, 86)", <add> "rgb(201, 203, 207)", <add> "rgb(54, 162, 235)" <add> ] <add> }] <add> }, <add>} <add>{% endchartjs %} <add> <ide> ## Example Usage <ide> <ide> ```javascript <ide><path>docs/charts/radar.md <ide> A radar chart is a way of showing multiple data points and the variation between <ide> <ide> They are often useful for comparing the points of two or more different data sets. <ide> <add>{% chartjs %} <add>{ <add> "type": "radar", <add> "data": { <add> "labels": [ <add> "Eating", <add> "Drinking", <add> "Sleeping", <add> "Designing", <add> "Coding", <add> "Cycling", <add> "Running" <add> ], <add> "datasets": [{ <add> "label": "My First Dataset", <add> "data": [65, 59, 90, 81, 56, 55, 40], <add> "fill": true, <add> "backgroundColor": "rgba(255, 99, 132, 0.2)", <add> "borderColor": "rgb(255, 99, 132)", <add> "pointBackgroundColor": "rgb(255, 99, 132)", <add> "pointBorderColor": "#fff", <add> "pointHoverBackgroundColor": "#fff", <add> "pointHoverBorderColor": "rgb(255, 99, 132)", <add> "fill": true <add> }, { <add> "label": "My Second Dataset", <add> "data": [28, 48, 40, 19, 96, 27, 100], <add> "fill": true, <add> "backgroundColor": "rgba(54, 162, 235, 0.2)", <add> "borderColor": "rgb(54, 162, 235)", <add> "pointBackgroundColor": "rgb(54, 162, 235)", <add> "pointBorderColor": "#fff", <add> "pointHoverBackgroundColor": "#fff", <add> "pointHoverBorderColor": "rgb(54, 162, 235)", <add> "fill": true <add> }] <add> }, <add> "options": { <add> "elements": { <add> "line": { <add> "tension": 0, <add> "borderWidth": 3 <add> } <add> } <add> } <add>} <add>{% endchartjs %} <add> <ide> ## Example Usage <ide> ```javascript <ide> var myRadarChart = new Chart(ctx, {
7
Javascript
Javascript
add mustcall in test-net-bytes-read.js
aacc046e6b2d3c4f26af2715151f5bd01cb2776c
<ide><path>test/parallel/test-net-bytes-read.js <ide> const net = require('net'); <ide> <ide> const big = Buffer.alloc(1024 * 1024); <ide> <del>const server = net.createServer((socket) => { <add>const handler = common.mustCall((socket) => { <ide> socket.end(big); <ide> server.close(); <del>}).listen(0, () => { <add>}); <add> <add>const onListen = common.mustCall(() => { <ide> let prev = 0; <ide> <ide> function checkRaise(value) { <ide> assert(value > prev); <ide> prev = value; <ide> } <ide> <del> const socket = net.connect(server.address().port, () => { <del> socket.on('data', (chunk) => { <del> checkRaise(socket.bytesRead); <del> }); <add> const onData = common.mustCallAtLeast((chunk) => { <add> checkRaise(socket.bytesRead); <add> }); <ide> <del> socket.on('end', common.mustCall(() => { <del> assert.strictEqual(socket.bytesRead, prev); <del> assert.strictEqual(big.length, prev); <del> })); <add> const onEnd = common.mustCall(() => { <add> assert.strictEqual(socket.bytesRead, prev); <add> assert.strictEqual(big.length, prev); <add> }); <ide> <del> socket.on('close', common.mustCall(() => { <del> assert(!socket._handle); <del> assert.strictEqual(socket.bytesRead, prev); <del> assert.strictEqual(big.length, prev); <del> })); <add> const onClose = common.mustCall(() => { <add> assert(!socket._handle); <add> assert.strictEqual(socket.bytesRead, prev); <add> assert.strictEqual(big.length, prev); <add> }); <ide> <add> const onConnect = common.mustCall(() => { <add> socket.on('data', onData); <add> socket.on('end', onEnd); <add> socket.on('close', onClose); <ide> socket.end(); <ide> }); <add> <add> const socket = net.connect(server.address().port, onConnect); <ide> }); <add> <add>const server = net.createServer(handler).listen(0, onListen);
1
Python
Python
use getboolean in jobs.py
b22ca52c2b32473272071440e1bf7c029187b66b
<ide><path>airflow/jobs.py <ide> <ide> # Setting up a statsd client if needed <ide> statsd = None <del>if conf.get('scheduler', 'statsd_on'): <add>if conf.getboolean('scheduler', 'statsd_on'): <ide> from statsd import StatsClient <ide> statsd = StatsClient( <ide> host=conf.get('scheduler', 'statsd_host'),
1
Python
Python
use np.copyto instead of np.fill in some places
76f9e50c9e40967d9a41cb6a630b2448af9e8687
<ide><path>numpy/add_newdocs.py <ide> def luf(lamdaexpr, *args, **kwargs): <ide> of `dst`, and selects elements to copy from `src` to `dst` <ide> wherever it contains the value True. <ide> <del> Returns <del> ------- <del> out : ndarray <del> Returns the array `dst`. <del> <ide> """) <ide> <ide> add_newdoc('numpy.core.multiarray', 'putmask', <ide><path>numpy/core/numeric.py <ide> def zeros_like(a, dtype=None, order='K', subok=True): <ide> <ide> """ <ide> res = empty_like(a, dtype=dtype, order=order, subok=subok) <del> res.fill(0) <add> multiarray.copyto(res, 0, casting='unsafe') <ide> return res <ide> <ide> # end Fernando's utilities <ide> def ones(shape, dtype=None, order='C'): <ide> <ide> """ <ide> a = empty(shape, dtype, order) <del> try: <del> a.fill(1) <del> # Above is faster now after addition of fast loops. <del> #a = zeros(shape, dtype, order) <del> #a+=1 <del> except TypeError: <del> obj = _maketup(dtype, 1) <del> a.fill(obj) <add> multiarray.copyto(a, 1, casting='unsafe') <ide> return a <ide> <ide> def identity(n, dtype=None):
2
Javascript
Javascript
fix documentation error
dc3f9d9c68c60cbbfd8abd8c0b2f439eb36aa4c7
<ide><path>packages/ember-runtime/lib/mixins/freezable.js <ide> var get = Ember.get, set = Ember.set; <ide> <ide> }); <ide> <del> c = Context.create({ firstName: "John", lastName: "Doe" }); <add> c = Contact.create({ firstName: "John", lastName: "Doe" }); <ide> c.swapNames(); // returns c <ide> c.freeze(); <ide> c.swapNames(); // EXCEPTION
1
Python
Python
raise warnings on implicit many serialization
388e6173669a295214a718e55dbf467559835dee
<ide><path>rest_framework/serializers.py <ide> def errors(self): <ide> many = self.many <ide> else: <ide> many = hasattr(data, '__iter__') and not isinstance(data, (Page, dict)) <add> if many: <add> warnings.warn('Implict list/queryset serialization is due to be deprecated. ' <add> 'Use the `many=True` flag when instantiating the serializer.', <add> PendingDeprecationWarning, stacklevel=2) <ide> <ide> # TODO: error data when deserializing lists <ide> if many: <ide> def data(self): <ide> many = self.many <ide> else: <ide> many = hasattr(obj, '__iter__') and not isinstance(obj, (Page, dict)) <add> if many: <add> warnings.warn('Implict list/queryset serialization is due to be deprecated. ' <add> 'Use the `many=True` flag when instantiating the serializer.', <add> PendingDeprecationWarning, stacklevel=2) <ide> <ide> if many: <ide> self._data = [self.to_native(item) for item in obj]
1
Javascript
Javascript
ignore managed prefs documented as "deprecated."
9d55a1edc7f6fd2bc44e8f5d5f7408e695fba035
<ide><path>gulpfile.js <ide> function getVersionJSON() { <ide> function checkChromePreferencesFile(chromePrefsPath, webPrefsPath) { <ide> var chromePrefs = JSON.parse(fs.readFileSync(chromePrefsPath).toString()); <ide> var chromePrefsKeys = Object.keys(chromePrefs.properties); <add> chromePrefsKeys = chromePrefsKeys.filter(function (key) { <add> var description = chromePrefs.properties[key].description; <add> // Deprecated keys are allowed in the managed preferences file. <add> // The code maintained is responsible for adding migration logic to <add> // extensions/chromium/options/migration.js and web/chromecom.js . <add> return !description || !description.startsWith('DEPRECATED.'); <add> }); <ide> chromePrefsKeys.sort(); <ide> var webPrefs = JSON.parse(fs.readFileSync(webPrefsPath).toString()); <ide> var webPrefsKeys = Object.keys(webPrefs);
1
PHP
PHP
add test for queued listener
d3ba921e5844a31e639f92188900e7b49424ec9e
<ide><path>tests/Events/EventsDispatcherTest.php <ide> use Illuminate\Contracts\Queue\ShouldQueue; <ide> use Illuminate\Events\CallQueuedListener; <ide> use Illuminate\Events\Dispatcher; <add>use Illuminate\Support\Testing\Fakes\QueueFake; <ide> use Mockery as m; <ide> use PHPUnit\Framework\TestCase; <ide> <ide> public function testQueuedEventHandlersAreQueued() <ide> $d->dispatch('some.event', ['foo', 'bar']); <ide> } <ide> <add> public function testCustomizedQueuedEventHandlersAreQueued() <add> { <add> $d = new Dispatcher; <add> <add> $fakeQueue = new QueueFake(new Container()); <add> <add> $d->setQueueResolver(function () use ($fakeQueue) { <add> return $fakeQueue; <add> }); <add> <add> $d->listen('some.event', TestDispatcherConnectionQueuedHandler::class.'@handle'); <add> $d->dispatch('some.event', ['foo', 'bar']); <add> <add> $fakeQueue->assertPushedOn('my_queue', CallQueuedListener::class); <add> } <add> <ide> public function testClassesWork() <ide> { <ide> unset($_SERVER['__event.test']); <ide> public function handle() <ide> } <ide> } <ide> <add>class TestDispatcherConnectionQueuedHandler implements ShouldQueue <add>{ <add> public $connection = 'redis'; <add> <add> public $delay = 10; <add> <add> public $queue = 'my_queue'; <add> <add> public function handle() <add> { <add> // <add> } <add>} <add> <ide> class TestDispatcherQueuedHandlerCustomQueue implements ShouldQueue <ide> { <ide> public function handle()
1
PHP
PHP
apply fixes from styleci
531c8dda902e0b9351e1004f06b49f81c3694337
<ide><path>src/Illuminate/Cache/MemcachedLock.php <ide> <ide> namespace Illuminate\Cache; <ide> <del>use Carbon\Carbon; <ide> use Illuminate\Contracts\Cache\Lock as LockContract; <ide> <ide> class MemcachedLock extends Lock implements LockContract <ide><path>src/Illuminate/Cache/RedisLock.php <ide> <ide> namespace Illuminate\Cache; <ide> <del>use Carbon\Carbon; <ide> use Illuminate\Contracts\Cache\Lock as LockContract; <ide> <ide> class RedisLock extends Lock implements LockContract <ide><path>tests/Integration/Cache/CacheLockTest.php <ide> public function test_locks_can_be_acquired_and_released() <ide> Cache::store('redis')->lock('foo')->release(); <ide> } <ide> <del> <ide> public function test_locks_can_run_callbacks() <ide> { <ide> Cache::store('memcached')->lock('foo')->release(); <ide> public function test_locks_can_run_callbacks() <ide> })); <ide> } <ide> <del> <ide> public function test_locks_can_block() <ide> { <ide> Cache::store('memcached')->lock('foo')->release(); <ide> public function test_locks_can_block() <ide> Cache::store('memcached')->lock('foo', 1)->get(); <ide> $this->assertTrue(Cache::store('memcached')->lock('foo', 10)->block()); <ide> <del> <ide> Cache::store('redis')->lock('foo')->release(); <ide> Cache::store('redis')->lock('foo', 1)->get(); <ide> $this->assertEquals('taylor', Cache::store('redis')->lock('foo', 10)->block(function () { <ide> public function test_locks_can_block() <ide> $this->assertTrue(Cache::store('redis')->lock('foo', 10)->block()); <ide> } <ide> <del> <ide> public function test_locks_can_block_for_seconds() <ide> { <ide> Carbon::setTestNow(); <ide> public function test_locks_can_block_for_seconds() <ide> Cache::store('memcached')->lock('foo')->release(); <ide> $this->assertTrue(Cache::store('memcached')->lock('foo', 10)->blockFor(1)); <ide> <del> <ide> Cache::store('redis')->lock('foo')->release(); <ide> $this->assertEquals('taylor', Cache::store('redis')->lock('foo', 10)->blockFor(1, function () { <ide> return 'taylor'; <ide> public function test_locks_can_block_for_seconds() <ide> $this->assertTrue(Cache::store('redis')->lock('foo', 10)->blockFor(1)); <ide> } <ide> <del> <ide> /** <ide> * @expectedException \Illuminate\Contracts\Cache\LockTimeoutException <ide> */
3
Javascript
Javascript
restore scrollbar positions correctly on reload
37b5d2eb4dbbf5a23baf70c0ee1994c77e6dc05b
<ide><path>spec/text-editor-component-spec.js <ide> describe('TextEditorComponent', () => { <ide> <ide> }) <ide> <del> it('updates the bottom/right of dummy scrollbars and client height/width measurements when scrollbar styles change', async () => { <add> it('updates the bottom/right of dummy scrollbars and client height/width measurements without forgetting the previous scroll top/left when scrollbar styles change', async () => { <ide> const {component, element, editor} = buildComponent({height: 100, width: 100}) <ide> expect(getHorizontalScrollbarHeight(component)).toBeGreaterThan(10) <ide> expect(getVerticalScrollbarWidth(component)).toBeGreaterThan(10) <add> setScrollTop(component, 20) <add> setScrollLeft(component, 10) <add> await component.getNextUpdatePromise() <ide> <ide> const style = document.createElement('style') <ide> style.textContent = '::-webkit-scrollbar { height: 10px; width: 10px; }' <ide> describe('TextEditorComponent', () => { <ide> expect(getVerticalScrollbarWidth(component)).toBe(10) <ide> expect(component.refs.horizontalScrollbar.element.style.right).toBe('10px') <ide> expect(component.refs.verticalScrollbar.element.style.bottom).toBe('10px') <add> expect(component.refs.horizontalScrollbar.element.scrollLeft).toBe(10) <add> expect(component.refs.verticalScrollbar.element.scrollTop).toBe(20) <ide> expect(component.getScrollContainerClientHeight()).toBe(100 - 10) <ide> expect(component.getScrollContainerClientWidth()).toBe(100 - component.getGutterContainerWidth() - 10) <ide> }) <ide><path>src/text-editor-component.js <ide> class TextEditorComponent { <ide> this.scrollTopPending = false <ide> this.scrollLeftPending = false <ide> if (this.remeasureScrollbars) { <add> // Flush stored scroll positions to the vertical and the horizontal <add> // scrollbars. This is because they have just been destroyed and recreated <add> // as a result of their remeasurement, but we could not assign the scroll <add> // top while they were initialized because they were not attached to the <add> // DOM yet. <add> this.refs.verticalScrollbar.flushScrollPosition() <add> this.refs.horizontalScrollbar.flushScrollPosition() <add> <ide> this.measureScrollbarDimensions() <ide> this.remeasureScrollbars = false <ide> etch.updateSync(this) <ide> class DummyScrollbarComponent { <ide> constructor (props) { <ide> this.props = props <ide> etch.initialize(this) <del> if (this.props.orientation === 'horizontal') { <del> this.element.scrollLeft = this.props.scrollLeft <del> } else { <del> this.element.scrollTop = this.props.scrollTop <del> } <ide> } <ide> <ide> update (newProps) { <ide> const oldProps = this.props <ide> this.props = newProps <ide> etch.updateSync(this) <del> if (this.props.orientation === 'horizontal') { <del> if (newProps.scrollLeft !== oldProps.scrollLeft) { <del> this.element.scrollLeft = this.props.scrollLeft <del> } <del> } else { <del> if (newProps.scrollTop !== oldProps.scrollTop) { <del> this.element.scrollTop = this.props.scrollTop <del> } <del> } <add> <add> const shouldFlushScrollPosition = ( <add> newProps.scrollTop !== oldProps.scrollTop || <add> newProps.scrollLeft !== oldProps.scrollLeft <add> ) <add> if (shouldFlushScrollPosition) this.flushScrollPosition() <ide> } <ide> <del> // Scroll position must be updated after the inner element is updated to <del> // ensure the element has an adequate scrollHeight/scrollWidth <del> updateScrollPosition () { <add> flushScrollPosition () { <ide> if (this.props.orientation === 'horizontal') { <ide> this.element.scrollLeft = this.props.scrollLeft <ide> } else {
2
Python
Python
fix combined alters on postgresql
f343cbf06cba0e2ace0157224f85b89488093fa1
<ide><path>django/db/backends/schema.py <ide> import sys <ide> import hashlib <add>import operator <ide> from django.db.backends.creation import BaseDatabaseCreation <ide> from django.db.backends.util import truncate_name <ide> from django.utils.log import getLogger <ide> from django.db.models.fields.related import ManyToManyField <ide> from django.db.transaction import atomic <add>from django.utils.six.moves import reduce <ide> <ide> logger = getLogger('django.db.backends.schema') <ide> <ide> def alter_field(self, model, old_field, new_field, strict=False): <ide> # Combine actions together if we can (e.g. postgres) <ide> if self.connection.features.supports_combined_alters: <ide> sql, params = tuple(zip(*actions)) <del> actions = [(", ".join(sql), params)] <add> actions = [(", ".join(sql), reduce(operator.add, params))] <ide> # Apply those actions <ide> for sql, params in actions: <ide> self.execute(
1
Java
Java
fix failing test
6659e96104a02c7a8cc3b4287928b9081ab33a5c
<ide><path>spring-websocket/src/test/java/org/springframework/web/socket/sockjs/transport/session/SockJsSessionTests.java <ide> import org.springframework.web.socket.CloseStatus; <ide> import org.springframework.web.socket.TextMessage; <ide> import org.springframework.web.socket.handler.ExceptionWebSocketHandlerDecorator; <del>import org.springframework.web.socket.sockjs.SockJsMessageDeliveryException; <ide> import org.springframework.web.socket.sockjs.SockJsTransportFailureException; <ide> import org.springframework.web.socket.sockjs.frame.SockJsFrame; <ide> <ide> public void delegateMessagesWithError() throws Exception { <ide> willThrow(new IOException()).given(this.webSocketHandler).handleMessage(session, new TextMessage(msg2)); <ide> <ide> session.delegateConnectionEstablished(); <del> <del> assertThatExceptionOfType(SockJsMessageDeliveryException.class) <del> .isThrownBy(() -> session.delegateMessages(msg1, msg2, msg3)) <del> .satisfies(ex -> assertThat(ex.getUndeliveredMessages()).containsExactly(msg3)); <add> session.delegateMessages(msg1, msg2, msg3); <ide> <ide> verify(this.webSocketHandler).afterConnectionEstablished(session); <ide> verify(this.webSocketHandler).handleMessage(session, new TextMessage(msg1));
1
Javascript
Javascript
add reactupdates.setimmediate for async callbacks
12b532c253e6efc3d077b35f9c3aa88ed94fc435
<ide><path>src/core/ReactUpdates.js <ide> var mixInto = require('mixInto'); <ide> var warning = require('warning'); <ide> <ide> var dirtyComponents = []; <add>var setImmediateCallbackQueue = CallbackQueue.getPooled(); <add>var setImmediateEnqueued = false; <ide> <ide> var batchingStrategy = null; <ide> <ide> var TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING]; <ide> function ReactUpdatesFlushTransaction() { <ide> this.reinitializeTransaction(); <ide> this.dirtyComponentsLength = null; <del> this.callbackQueue = CallbackQueue.getPooled(null); <add> this.callbackQueue = CallbackQueue.getPooled(); <ide> this.reconcileTransaction = <ide> ReactUpdates.ReactReconcileTransaction.getPooled(); <ide> } <ide> var flushBatchedUpdates = ReactPerf.measure( <ide> // ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents <ide> // array and perform any updates enqueued by mount-ready handlers (i.e., <ide> // componentDidUpdate) but we need to check here too in order to catch <del> // updates enqueued by setState callbacks. <del> while (dirtyComponents.length) { <del> var transaction = ReactUpdatesFlushTransaction.getPooled(); <del> transaction.perform(runBatchedUpdates, null, transaction); <del> ReactUpdatesFlushTransaction.release(transaction); <add> // updates enqueued by setState callbacks and setImmediate calls. <add> while (dirtyComponents.length || setImmediateEnqueued) { <add> if (dirtyComponents.length) { <add> var transaction = ReactUpdatesFlushTransaction.getPooled(); <add> transaction.perform(runBatchedUpdates, null, transaction); <add> ReactUpdatesFlushTransaction.release(transaction); <add> } <add> <add> if (setImmediateEnqueued) { <add> setImmediateEnqueued = false; <add> var queue = setImmediateCallbackQueue; <add> setImmediateCallbackQueue = CallbackQueue.getPooled(); <add> queue.notifyAll(); <add> CallbackQueue.release(queue); <add> } <ide> } <ide> } <ide> ); <ide> function enqueueUpdate(component, callback) { <ide> } <ide> } <ide> <add>/** <add> * Enqueue a callback to be run at the end of the current batching cycle. Throws <add> * if no updates are currently being performed. <add> */ <add>function setImmediate(callback, context) { <add> invariant( <add> batchingStrategy.isBatchingUpdates, <add> 'ReactUpdates.setImmediate: Can\'t enqueue an immediate callback in a ' + <add> 'context where updates are not being batched.' <add> ); <add> setImmediateCallbackQueue.enqueue(callback, context); <add> setImmediateEnqueued = true; <add>} <add> <ide> var ReactUpdatesInjection = { <ide> injectReconcileTransaction: function(ReconcileTransaction) { <ide> invariant( <ide> var ReactUpdates = { <ide> batchedUpdates: batchedUpdates, <ide> enqueueUpdate: enqueueUpdate, <ide> flushBatchedUpdates: flushBatchedUpdates, <del> injection: ReactUpdatesInjection <add> injection: ReactUpdatesInjection, <add> setImmediate: setImmediate <ide> }; <ide> <ide> module.exports = ReactUpdates; <ide><path>src/core/__tests__/ReactUpdates-test.js <ide> describe('ReactUpdates', function() { <ide> React.renderComponent(<A x={2} />, container); <ide> expect(callbackCount).toBe(1); <ide> }); <add> <add> it('calls setImmediate callbacks properly', function() { <add> var callbackCount = 0; <add> var A = React.createClass({ <add> render: function() { <add> return <div />; <add> }, <add> componentDidUpdate: function() { <add> var component = this; <add> ReactUpdates.setImmediate(function() { <add> expect(this).toBe(component); <add> callbackCount++; <add> ReactUpdates.setImmediate(function() { <add> callbackCount++; <add> }); <add> expect(callbackCount).toBe(1); <add> }, this); <add> expect(callbackCount).toBe(0); <add> } <add> }); <add> <add> var container = document.createElement('div'); <add> var component = React.renderComponent(<A />, container); <add> component.forceUpdate(); <add> expect(callbackCount).toBe(2); <add> }); <add> <add> it('calls setImmediate callbacks with queued updates', function() { <add> var log = []; <add> var A = React.createClass({ <add> getInitialState: () => ({updates: 0}), <add> render: function() { <add> log.push('render-' + this.state.updates); <add> return <div />; <add> }, <add> componentDidUpdate: function() { <add> if (this.state.updates === 1) { <add> ReactUpdates.setImmediate(function() { <add> this.setState({updates: 2}, function() { <add> ReactUpdates.setImmediate(function() { <add> log.push('setImmediate-1.2'); <add> }); <add> log.push('setState-cb'); <add> }); <add> log.push('setImmediate-1.1'); <add> }, this); <add> } else if (this.state.updates === 2) { <add> ReactUpdates.setImmediate(function() { <add> log.push('setImmediate-2'); <add> }); <add> } <add> log.push('didUpdate-' + this.state.updates); <add> } <add> }); <add> <add> var container = document.createElement('div'); <add> var component = React.renderComponent(<A />, container); <add> component.setState({updates: 1}); <add> expect(log).toEqual([ <add> 'render-0', <add> // We do the first update... <add> 'render-1', <add> 'didUpdate-1', <add> // ...which calls a setImmediate and enqueues a second update... <add> 'setImmediate-1.1', <add> // ...which runs and enqueues the setImmediate-2 log in its didUpdate... <add> 'render-2', <add> 'didUpdate-2', <add> // ...and runs the setState callback, which enqueues the log for <add> // setImmediate-1.2. <add> 'setState-cb', <add> 'setImmediate-2', <add> 'setImmediate-1.2' <add> ]); <add> }); <ide> });
2
Python
Python
allow 'tf' ordering in imagedatagenerator
cb65139aa8857421e70920422844db8a2d6b0a87
<ide><path>keras/preprocessing/image.py <ide> import threading <ide> <ide> <del>def random_rotation(x, rg, fill_mode='nearest', cval=0.): <add>def random_rotation(x, rg, fill_mode='nearest', cval=0., axes=(1,2)): <ide> angle = np.random.uniform(-rg, rg) <ide> x = ndimage.interpolation.rotate(x, angle, <del> axes=(1, 2), <add> axes=axes, <ide> reshape=False, <ide> mode=fill_mode, <ide> cval=cval) <ide> return x <ide> <ide> <del>def random_shift(x, wrg, hrg, fill_mode='nearest', cval=0.): <add>def random_shift(x, wrg, hrg, fill_mode='nearest', cval=0., row_index=1, col_index=2): <ide> shift_x = shift_y = 0 <del> <ide> if wrg: <del> shift_x = np.random.uniform(-wrg, wrg) * x.shape[2] <add> shift_x = np.random.uniform(-wrg, wrg) * x.shape[col_index] <ide> if hrg: <del> shift_y = np.random.uniform(-hrg, hrg) * x.shape[1] <add> shift_y = np.random.uniform(-hrg, hrg) * x.shape[row_index] <ide> x = ndimage.interpolation.shift(x, (0, shift_y, shift_x), <ide> order=0, <ide> mode=fill_mode, <ide> cval=cval) <ide> return x <ide> <del> <del>def horizontal_flip(x): <del> for i in range(x.shape[0]): <del> x[i] = np.fliplr(x[i]) <add>def flip_axis(x, axis): <add> x = np.asarray(x).swapaxes(axis, 0) <add> x = x[::-1,...] <add> x = x.swapaxes(0, axis) <ide> return x <ide> <del> <del>def vertical_flip(x): <del> for i in range(x.shape[0]): <del> x[i] = np.flipud(x[i]) <del> return x <del> <del> <ide> def random_barrel_transform(x, intensity): <ide> # TODO <ide> pass <ide> class ImageDataGenerator(object): <ide> shear_range: shear intensity (shear angle in radians). <ide> horizontal_flip: whether to randomly flip images horizontally. <ide> vertical_flip: whether to randomly flip images vertically. <add> dim_ordering: 'th' or 'tf'. In 'th' mode, the channels dimension <add> (the depth) is at index 1, in 'tf' mode it is at index 3. <ide> ''' <ide> def __init__(self, <ide> featurewise_center=True, <ide> def __init__(self, <ide> height_shift_range=0., <ide> shear_range=0., <ide> horizontal_flip=False, <del> vertical_flip=False): <add> vertical_flip=False, <add> dim_ordering='th'): <ide> self.__dict__.update(locals()) <ide> self.mean = None <ide> self.std = None <ide> self.principal_components = None <ide> self.lock = threading.Lock() <add> if dim_ordering not in {'tf', 'th'}: <add> raise Exception('dim_ordering should be "tf" (channel after row and \ <add> column) or "th" (channel before row and column). Received arg: ', dim_ordering) <add> self.dim_ordering = dim_ordering <add> if dim_ordering == "th": <add> self.channel_index = 1 <add> self.row_index = 2 <add> self.col_index = 3 <add> if dim_ordering == "tf": <add> self.channel_index = 3 <add> self.row_index = 1 <add> self.col_index = 2 <ide> <ide> def _flow_index(self, N, batch_size=32, shuffle=False, seed=None): <ide> b = 0 <ide> def __next__(self): <ide> <ide> def standardize(self, x): <ide> if self.samplewise_center: <del> x -= np.mean(x, axis=1, keepdims=True) <add> x -= np.mean(x, axis=self.channel_index, keepdims=True) <ide> if self.samplewise_std_normalization: <del> x /= (np.std(x, axis=1, keepdims=True) + 1e-7) <add> x /= (np.std(x, axis=self.channel_index, keepdims=True) + 1e-7) <ide> <ide> if self.featurewise_center: <ide> x -= self.mean <ide> if self.featurewise_std_normalization: <ide> x /= (self.std + 1e-7) <ide> <ide> if self.zca_whitening: <del> flatx = np.reshape(x, (x.shape[0] * x.shape[1] * x.shape[2])) <add> flatx = np.reshape(x, (x.size)) <ide> whitex = np.dot(flatx, self.principal_components) <ide> x = np.reshape(whitex, (x.shape[0], x.shape[1], x.shape[2])) <ide> <ide> return x <ide> <ide> def random_transform(self, x): <add> # x is a single image, so it doesn't have image number at index 0 <add> img_col_index = self.col_index - 1 <add> img_row_index = self.row_index - 1 <add> <ide> if self.rotation_range: <del> x = random_rotation(x, self.rotation_range) <add> x = random_rotation(x, self.rotation_range, <add> axes=(img_row_index, img_col_index)) <ide> if self.width_shift_range or self.height_shift_range: <del> x = random_shift(x, self.width_shift_range, self.height_shift_range) <add> x = random_shift(x, self.width_shift_range, self.height_shift_range, <add> row_index=img_row_index, col_index=img_col_index) <ide> if self.horizontal_flip: <ide> if np.random.random() < 0.5: <del> x = horizontal_flip(x) <add> x = flip_axis(x, img_col_index) <ide> if self.vertical_flip: <ide> if np.random.random() < 0.5: <del> x = vertical_flip(x) <add> x = flip_axis(x, img_row_index) <ide> if self.shear_range: <ide> x = random_shear(x, self.shear_range) <ide> # TODO: <ide><path>tests/keras/preprocessing/test_image.py <ide> def test_image_data_generator(): <ide> assert x.shape[1:] == images.shape[1:] <ide> break <ide> <add>def test_img_flip(): <add> x = np.array(range(4)).reshape([1,1,2,2]) <add> assert (flip_axis(x, 0) == x).all() <add> assert (flip_axis(x, 1) == x).all() <add> assert (flip_axis(x, 2) == [[[[2, 3], [0, 1]]]]).all() <add> assert (flip_axis(x, 3) == [[[[1, 0], [3, 2]]]]).all() <add> <add> dim_ordering_and_col_index = (('tf', 2), ('th', 3)) <add> for dim_ordering, col_index in dim_ordering_and_col_index: <add> image_generator_th = ImageDataGenerator( <add> featurewise_center=False, <add> samplewise_center=False, <add> featurewise_std_normalization=False, <add> samplewise_std_normalization=False, <add> zca_whitening=False, <add> rotation_range=0, <add> width_shift_range=0, <add> height_shift_range=0, <add> shear_range=0, <add> horizontal_flip=True, <add> vertical_flip=False, <add> dim_ordering=dim_ordering).flow(x, [1]) <add> for i in range(10): <add> potentially_flipped_x, _ = next(image_generator_th) <add> assert (potentially_flipped_x==x).all() or \ <add> (potentially_flipped_x==flip_axis(x, col_index)).all() <add> <add> <ide> if __name__ == '__main__': <ide> pytest.main([__file__])
2
Python
Python
remove reference to args in xla check
129fdae04033fe4adfe013b734deaec6ec34ae2e
<ide><path>src/transformers/training_args_tf.py <ide> class TFTrainingArguments(TrainingArguments): <ide> def _setup_strategy(self) -> Tuple["tf.distribute.Strategy", int]: <ide> logger.info("Tensorflow: setting up strategy") <ide> <del> if self.args.xla: <add> if self.xla: <ide> tf.config.optimizer.set_jit(True) <ide> <ide> gpus = tf.config.list_physical_devices("GPU")
1
Ruby
Ruby
add test coverage for devel spec version style
a5fff4547f460642728c88dbad76267f83afa170
<ide><path>Library/Homebrew/test/version_spec.rb <ide> .to be_detected_from("https://example.com/dada-v2017-04-17.tar.gz") <ide> end <ide> <add> specify "devel spec version style" do <add> expect(Version.create("1.3.0-beta.1")) <add> .to be_detected_from("https://registry.npmjs.org/@angular/cli/-/cli-1.3.0-beta.1.tgz") <add> expect(Version.create("2.074.0-beta1")) <add> .to be_detected_from("https://github.com/dlang/dmd/archive/v2.074.0-beta1.tar.gz") <add> expect(Version.create("2.074.0-rc1")) <add> .to be_detected_from("https://github.com/dlang/dmd/archive/v2.074.0-rc1.tar.gz") <add> expect(Version.create("5.0.0-alpha10")) <add> .to be_detected_from("https://github.com/premake/premake-core/releases/download/v5.0.0-alpha10/premake-5.0.0-alpha10-src.zip") <add> end <add> <ide> specify "jenkins version style" do <ide> expect(Version.create("1.486")) <ide> .to be_detected_from("http://mirrors.jenkins-ci.org/war/1.486/jenkins.war") <ide> specify "dash version style" do <ide> expect(Version.create("3.4")) <ide> .to be_detected_from("http://www.antlr.org/download/antlr-3.4-complete.jar") <add> expect(Version.create("9.2")) <add> .to be_detected_from("https://cdn.nuxeo.com/nuxeo-9.2/nuxeo-server-9.2-tomcat.zip") <add> expect(Version.create("0.181")) <add> .to be_detected_from("https://search.maven.org/remotecontent?filepath=com/facebook/presto/presto-cli/0.181/presto-cli-0.181-executable.jar") <add> expect(Version.create("1.2.3")) <add> .to be_detected_from("https://search.maven.org/remotecontent?filepath=org/apache/orc/orc-tools/1.2.3/orc-tools-1.2.3-uber.jar") <ide> end <ide> <ide> specify "apache version style" do
1
Go
Go
remove unused movetosubdir() utility
26659d5eb83330269ef634713435a995caa1e2e6
<ide><path>pkg/directory/directory.go <ide> package directory // import "github.com/docker/docker/pkg/directory" <ide> <del>import ( <del> "context" <del> "os" <del> "path/filepath" <del>) <del> <del>// MoveToSubdir moves all contents of a directory to a subdirectory underneath the original path <del>func MoveToSubdir(oldpath, subdir string) error { <del> infos, err := os.ReadDir(oldpath) <del> if err != nil { <del> return err <del> } <del> for _, info := range infos { <del> if info.Name() != subdir { <del> oldName := filepath.Join(oldpath, info.Name()) <del> newName := filepath.Join(oldpath, subdir, info.Name()) <del> if err := os.Rename(oldName, newName); err != nil { <del> return err <del> } <del> } <del> } <del> return nil <del>} <add>import "context" <ide> <ide> // Size walks a directory tree and returns its total size in bytes. <ide> func Size(ctx context.Context, dir string) (int64, error) { <ide><path>pkg/directory/directory_test.go <ide> package directory // import "github.com/docker/docker/pkg/directory" <ide> import ( <ide> "context" <ide> "os" <del> "path/filepath" <del> "reflect" <del> "sort" <ide> "testing" <ide> ) <ide> <ide> func TestSizeFileAndNestedDirectoryNonempty(t *testing.T) { <ide> } <ide> } <ide> <del>// Test migration of directory to a subdir underneath itself <del>func TestMoveToSubdir(t *testing.T) { <del> var outerDir, subDir string <del> var err error <del> <del> if outerDir, err = os.MkdirTemp(os.TempDir(), "TestMoveToSubdir"); err != nil { <del> t.Fatalf("failed to create directory: %v", err) <del> } <del> <del> if subDir, err = os.MkdirTemp(outerDir, "testSub"); err != nil { <del> t.Fatalf("failed to create subdirectory: %v", err) <del> } <del> <del> // write 4 temp files in the outer dir to get moved <del> filesList := []string{"a", "b", "c", "d"} <del> for _, fName := range filesList { <del> if file, err := os.Create(filepath.Join(outerDir, fName)); err != nil { <del> t.Fatalf("couldn't create temp file %q: %v", fName, err) <del> } else { <del> file.WriteString(fName) <del> file.Close() <del> } <del> } <del> <del> if err = MoveToSubdir(outerDir, filepath.Base(subDir)); err != nil { <del> t.Fatalf("Error during migration of content to subdirectory: %v", err) <del> } <del> // validate that the files were moved to the subdirectory <del> infos, err := os.ReadDir(subDir) <del> if err != nil { <del> t.Fatal(err) <del> } <del> if len(infos) != 4 { <del> t.Fatalf("Should be four files in the subdir after the migration: actual length: %d", len(infos)) <del> } <del> var results []string <del> for _, info := range infos { <del> results = append(results, info.Name()) <del> } <del> sort.Strings(results) <del> if !reflect.DeepEqual(filesList, results) { <del> t.Fatalf("Results after migration do not equal list of files: expected: %v, got: %v", filesList, results) <del> } <del>} <del> <ide> // Test a non-existing directory <ide> func TestSizeNonExistingDirectory(t *testing.T) { <ide> if _, err := Size(context.Background(), "/thisdirectoryshouldnotexist/TestSizeNonExistingDirectory"); err == nil {
2
Python
Python
add default_model to about
ccd87ad7fb8066ba11b479a4bbab5597d4c1dd49
<ide><path>setup.py <ide> from distutils.core import Extension, setup <ide> <ide> <del>MAJOR = 0 <del>MINOR = 100 <del>MICRO = 0 <del>ISRELEASED = False <del>VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO) <add>MAJOR = 0 <add>MINOR = 100 <add>MICRO = 0 <add>ISRELEASE = False <add>VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO) <add>DEFAULT_MODEL = 'en_default==1.0.4' <ide> <ide> <ide> PACKAGES = [ <ide> def get_version_info(): <ide> else: <ide> GIT_REVISION = 'Unknown' <ide> <del> if not ISRELEASED: <add> if not ISRELEASE: <ide> FULLVERSION += '.dev0+' + GIT_REVISION[:7] <ide> <ide> return FULLVERSION, GIT_REVISION <ide> def write_version(path): <ide> full_version = '%(full_version)s' <ide> git_revision = '%(git_revision)s' <ide> release = %(isrelease)s <del>default_model = 'en_default==1.0.4' <add>default_model = '%(default_model)s' <ide> if not release: <ide> version = full_version <ide> """ <ide> def write_version(path): <ide> f.write(cnt % {'version': VERSION, <ide> 'full_version' : FULLVERSION, <ide> 'git_revision' : GIT_REVISION, <del> 'isrelease': str(ISRELEASED)}) <add> 'isrelease': str(ISRELEASE), <add> 'default_model': DEFAULT_MODEL}) <ide> <ide> <ide> def generate_cython(root, source):
1
Ruby
Ruby
remove duplicate method
e18e7d9253736616862ca0c164497c3617b07da4
<ide><path>activerecord/test/cases/finder_test.rb <ide> def with_env_tz(new_tz = 'US/Eastern') <ide> ensure <ide> old_tz ? ENV['TZ'] = old_tz : ENV.delete('TZ') <ide> end <del> <del> def with_active_record_default_timezone(zone) <del> old_zone, ActiveRecord::Base.default_timezone = ActiveRecord::Base.default_timezone, zone <del> yield <del> ensure <del> ActiveRecord::Base.default_timezone = old_zone <del> end <ide> end
1
Python
Python
fix print statements in fcompiler for python3
bee85b21cb5a7263d09e9ea58081c1c4cac55089
<ide><path>numpy/distutils/fcompiler/__init__.py <ide> def dump_properties(self): <ide> % (self.__class__.__name__)): <ide> if l[:4]==' --': <ide> l = ' ' + l[4:] <del> print l <add> print(l) <ide> <ide> ################### <ide> <ide> def module_options(self, module_dirs, module_build_dir): <ide> else: <ide> options.append(self.module_dir_switch.strip()+module_build_dir) <ide> else: <del> print 'XXX: module_build_dir=%r option ignored' % (module_build_dir) <del> print 'XXX: Fix module_dir_switch for ',self.__class__.__name__ <add> print('XXX: module_build_dir=%r option ignored' % (module_build_dir)) <add> print('XXX: Fix module_dir_switch for ',self.__class__.__name__) <ide> if self.module_include_switch is not None: <ide> for d in [module_build_dir]+module_dirs: <ide> options.append('%s%s' % (self.module_include_switch, d)) <ide> else: <del> print 'XXX: module_dirs=%r option ignored' % (module_dirs) <del> print 'XXX: Fix module_include_switch for ',self.__class__.__name__ <add> print('XXX: module_dirs=%r option ignored' % (module_dirs)) <add> print('XXX: Fix module_include_switch for ',self.__class__.__name__) <ide> return options <ide> <ide> def library_option(self, lib): <ide> def show_fcompilers(dist=None): <ide> if compilers_ni: <ide> pretty_printer = FancyGetopt(compilers_ni) <ide> pretty_printer.print_help("Compilers not available on this platform:") <del> print "For compiler details, run 'config_fc --verbose' setup command." <add> print("For compiler details, run 'config_fc --verbose' setup command.") <ide> <ide> <ide> def dummy_fortran_file(): <ide><path>numpy/distutils/fcompiler/absoft.py <ide> def get_flags_opt(self): <ide> from numpy.distutils.fcompiler import new_fcompiler <ide> compiler = new_fcompiler(compiler='absoft') <ide> compiler.customize() <del> print compiler.get_version() <add> print(compiler.get_version()) <ide><path>numpy/distutils/fcompiler/compaq.py <ide> class CompaqVisualFCompiler(FCompiler): <ide> pass <ide> except AttributeError, msg: <ide> if '_MSVCCompiler__root' in str(msg): <del> print 'Ignoring "%s" (I think it is msvccompiler.py bug)' % (msg) <add> print('Ignoring "%s" (I think it is msvccompiler.py bug)' % (msg)) <ide> else: <ide> raise <ide> except IOError, e: <ide> if not "vcvarsall.bat" in str(e): <del> print "Unexpected IOError in", __file__ <add> print("Unexpected IOError in", __file__) <ide> raise e <ide> except ValueError, e: <ide> if not "path']" in str(e): <del> print "Unexpected ValueError in", __file__ <add> print("Unexpected ValueError in", __file__) <ide> raise e <ide> <ide> executables = { <ide> def get_flags_debug(self): <ide> from numpy.distutils.fcompiler import new_fcompiler <ide> compiler = new_fcompiler(compiler='compaq') <ide> compiler.customize() <del> print compiler.get_version() <add> print(compiler.get_version()) <ide><path>numpy/distutils/fcompiler/g95.py <ide> def get_flags_debug(self): <ide> log.set_verbosity(2) <ide> compiler = G95FCompiler() <ide> compiler.customize() <del> print compiler.get_version() <add> print(compiler.get_version()) <ide><path>numpy/distutils/fcompiler/gnu.py <ide> def _can_target(cmd, arch): <ide> log.set_verbosity(2) <ide> compiler = GnuFCompiler() <ide> compiler.customize() <del> print compiler.get_version() <add> print(compiler.get_version()) <ide> raw_input('Press ENTER to continue...') <ide> try: <ide> compiler = Gnu95FCompiler() <ide> compiler.customize() <del> print compiler.get_version() <add> print(compiler.get_version()) <ide> except Exception, msg: <del> print msg <add> print(msg) <ide> raw_input('Press ENTER to continue...') <ide><path>numpy/distutils/fcompiler/hpux.py <ide> def get_version(self, force=0, ok_status=[256,0,1]): <ide> from numpy.distutils.fcompiler import new_fcompiler <ide> compiler = new_fcompiler(compiler='hpux') <ide> compiler.customize() <del> print compiler.get_version() <add> print(compiler.get_version()) <ide><path>numpy/distutils/fcompiler/ibm.py <ide> def get_flags_opt(self): <ide> log.set_verbosity(2) <ide> compiler = IBMFCompiler() <ide> compiler.customize() <del> print compiler.get_version() <add> print(compiler.get_version()) <ide><path>numpy/distutils/fcompiler/intel.py <ide> class IntelItaniumVisualFCompiler(IntelVisualFCompiler): <ide> from numpy.distutils.fcompiler import new_fcompiler <ide> compiler = new_fcompiler(compiler='intel') <ide> compiler.customize() <del> print compiler.get_version() <add> print(compiler.get_version()) <ide><path>numpy/distutils/fcompiler/lahey.py <ide> def get_libraries(self): <ide> from numpy.distutils.fcompiler import new_fcompiler <ide> compiler = new_fcompiler(compiler='lahey') <ide> compiler.customize() <del> print compiler.get_version() <add> print(compiler.get_version()) <ide><path>numpy/distutils/fcompiler/mips.py <ide> def get_flags_arch_f90(self): <ide> from numpy.distutils.fcompiler import new_fcompiler <ide> compiler = new_fcompiler(compiler='mips') <ide> compiler.customize() <del> print compiler.get_version() <add> print(compiler.get_version()) <ide><path>numpy/distutils/fcompiler/nag.py <ide> def get_flags_debug(self): <ide> from numpy.distutils.fcompiler import new_fcompiler <ide> compiler = new_fcompiler(compiler='nag') <ide> compiler.customize() <del> print compiler.get_version() <add> print(compiler.get_version()) <ide><path>numpy/distutils/fcompiler/none.py <ide> def find_executables(self): <ide> log.set_verbosity(2) <ide> compiler = NoneFCompiler() <ide> compiler.customize() <del> print compiler.get_version() <add> print(compiler.get_version()) <ide><path>numpy/distutils/fcompiler/pg.py <ide> def get_flags_debug(self): <ide> from numpy.distutils.fcompiler import new_fcompiler <ide> compiler = new_fcompiler(compiler='pg') <ide> compiler.customize() <del> print compiler.get_version() <add> print(compiler.get_version()) <ide><path>numpy/distutils/fcompiler/sun.py <ide> def get_libraries(self): <ide> from numpy.distutils.fcompiler import new_fcompiler <ide> compiler = new_fcompiler(compiler='sun') <ide> compiler.customize() <del> print compiler.get_version() <add> print(compiler.get_version()) <ide><path>numpy/distutils/fcompiler/vast.py <ide> def get_flags_arch(self): <ide> from numpy.distutils.fcompiler import new_fcompiler <ide> compiler = new_fcompiler(compiler='vast') <ide> compiler.customize() <del> print compiler.get_version() <add> print(compiler.get_version())
15
Ruby
Ruby
add hooks for pouring bottles
e2fbfc83901fbd885c7a1cc1f471b0f3fe071c15
<ide><path>Library/Homebrew/formula_installer.rb <ide> require 'formula_cellar_checks' <ide> require 'install_renamed' <ide> require 'cmd/tap' <add>require 'hooks/bottles' <ide> <ide> class FormulaInstaller <ide> include FormulaCellarChecks <ide> def initialize ff <ide> end <ide> <ide> def pour_bottle? install_bottle_options={:warn=>false} <add> return true if Homebrew::Hooks::Bottles.formula_has_bottle?(f) <add> <ide> return false if @pour_failed <ide> return true if force_bottle? && f.bottle <ide> return false if build_from_source? || build_bottle? || interactive? <ide> def post_install <ide> end <ide> <ide> def pour <add> if Homebrew::Hooks::Bottles.formula_has_bottle?(f) <add> return if Homebrew::Hooks::Bottles.pour_formula_bottle(f) <add> end <add> <ide> if f.local_bottle_path <ide> downloader = LocalBottleDownloadStrategy.new(f) <ide> else <ide><path>Library/Homebrew/hooks/bottles.rb <add># Boxen (and perhaps others) want to override our bottling infrastructure so <add># they can avoid declaring checksums in formulae files. <add># Instead of periodically breaking their monkeypatches let's add some hooks that <add># we can query to allow their own behaviour. <add> <add># PLEASE DO NOT EVER RENAME THIS CLASS OR ADD/REMOVE METHOD ARGUMENTS! <add>module Homebrew <add> module Hooks <add> module Bottles <add> def self.setup_formula_has_bottle &block <add> @has_bottle = block <add> true <add> end <add> <add> def self.setup_pour_formula_bottle &block <add> @pour_bottle = block <add> true <add> end <add> <add> def self.formula_has_bottle?(formula) <add> return false unless @has_bottle <add> @has_bottle.call formula <add> end <add> <add> def self.pour_formula_bottle(formula) <add> return false unless @pour_bottle <add> @pour_bottle.call formula <add> end <add> end <add> end <add>end
2
Javascript
Javascript
add playsinline as an allowed html property
7b11aa9450e3040199ca83faa8c191956e82e99c
<ide><path>src/renderers/dom/shared/HTMLDOMPropertyConfig.js <ide> var HTMLDOMPropertyConfig = { <ide> optimum: 0, <ide> pattern: 0, <ide> placeholder: 0, <add> playsInline: HAS_BOOLEAN_VALUE, <ide> poster: 0, <ide> preload: 0, <ide> profile: 0,
1
Java
Java
fix bug with custom requestcondition
64ee5e579adcec97122fc0ee1414031da3be0c6e
<ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/RequestConditionHolder.java <ide> /** <ide> * A holder for a {@link RequestCondition} useful when the type of the held <ide> * request condition is not known ahead of time - e.g. custom condition. <del> * <del> * <p>An implementation of {@code RequestCondition} itself, a <del> * {@code RequestConditionHolder} decorates the held request condition allowing <del> * it to be combined and compared with other custom request conditions while <add> * <add> * <p>An implementation of {@code RequestCondition} itself, a <add> * {@code RequestConditionHolder} decorates the held request condition allowing <add> * it to be combined and compared with other custom request conditions while <ide> * ensuring type and null safety. <del> * <add> * <ide> * @author Rossen Stoyanchev <ide> * @since 3.1 <ide> */ <ide> public final class RequestConditionHolder extends AbstractRequestCondition<RequestConditionHolder> { <ide> <ide> @SuppressWarnings("rawtypes") <ide> private final RequestCondition condition; <del> <add> <ide> /** <del> * Create a new holder to wrap the given request condition. <add> * Create a new holder to wrap the given request condition. <ide> * @param requestCondition the condition to hold, may be {@code null} <ide> */ <ide> public RequestConditionHolder(RequestCondition<?> requestCondition) { <ide> protected String getToStringInfix() { <ide> } <ide> <ide> /** <del> * Combine the request conditions held by the two RequestConditionHolder <add> * Combine the request conditions held by the two RequestConditionHolder <ide> * instances after making sure the conditions are of the same type. <ide> * Or if one holder is empty, the other holder is returned. <ide> */ <ide> private void assertIsCompatible(RequestConditionHolder other) { <ide> throw new ClassCastException("Incompatible request conditions: " + clazz + " and " + otherClazz); <ide> } <ide> } <del> <add> <ide> /** <del> * Get the matching condition for the held request condition wrap it in a <add> * Get the matching condition for the held request condition wrap it in a <ide> * new RequestConditionHolder instance. Or otherwise if this is an empty <ide> * holder, return the same holder instance. <ide> */ <ide> public RequestConditionHolder getMatchingCondition(HttpServletRequest request) { <ide> return this; <ide> } <ide> RequestCondition<?> match = (RequestCondition<?>) condition.getMatchingCondition(request); <del> return new RequestConditionHolder(match); <add> return (match != null) ? new RequestConditionHolder(match) : null; <ide> } <ide> <ide> /** <del> * Compare the request conditions held by the two RequestConditionHolder <add> * Compare the request conditions held by the two RequestConditionHolder <ide> * instances after making sure the conditions are of the same type. <ide> * Or if one holder is empty, the other holder is preferred. <ide> */ <ide> else if (other.condition == null) { <ide> return condition.compareTo(other.condition, request); <ide> } <ide> } <del> <add> <ide> } <ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/condition/RequestConditionHolderTests.java <ide> package org.springframework.web.servlet.mvc.condition; <ide> <ide> import static org.junit.Assert.assertEquals; <add>import static org.junit.Assert.assertNull; <ide> import static org.junit.Assert.assertSame; <ide> <ide> import javax.servlet.http.HttpServletRequest; <ide> <ide> import org.junit.Test; <ide> import org.springframework.mock.web.MockHttpServletRequest; <ide> import org.springframework.web.bind.annotation.RequestMethod; <del>import org.springframework.web.servlet.mvc.condition.HeadersRequestCondition; <del>import org.springframework.web.servlet.mvc.condition.ParamsRequestCondition; <del>import org.springframework.web.servlet.mvc.condition.RequestConditionHolder; <del>import org.springframework.web.servlet.mvc.condition.RequestMethodsRequestCondition; <ide> <ide> /** <del> * A test fixture for <add> * A test fixture for <ide> * {code org.springframework.web.servlet.mvc.method.RequestConditionHolder} tests. <del> * <add> * <ide> * @author Rossen Stoyanchev <ide> */ <ide> public class RequestConditionHolderTests { <ide> public class RequestConditionHolderTests { <ide> public void combineEmpty() { <ide> RequestConditionHolder empty = new RequestConditionHolder(null); <ide> RequestConditionHolder notEmpty = new RequestConditionHolder(new ParamsRequestCondition("name")); <del> <add> <ide> assertSame(empty, empty.combine(new RequestConditionHolder(null))); <ide> assertSame(notEmpty, notEmpty.combine(empty)); <ide> assertSame(notEmpty, empty.combine(notEmpty)); <ide> public void combine() { <ide> RequestConditionHolder params1 = new RequestConditionHolder(new ParamsRequestCondition("name1")); <ide> RequestConditionHolder params2 = new RequestConditionHolder(new ParamsRequestCondition("name2")); <ide> RequestConditionHolder expected = new RequestConditionHolder(new ParamsRequestCondition("name1", "name2")); <del> <add> <ide> assertEquals(expected, params1.combine(params2)); <ide> } <ide> <ide> public void combineIncompatible() { <ide> public void match() { <ide> MockHttpServletRequest request = new MockHttpServletRequest("GET", "/"); <ide> request.setParameter("name1", "value1"); <del> <add> <ide> RequestMethodsRequestCondition rm = new RequestMethodsRequestCondition(RequestMethod.GET, RequestMethod.POST); <ide> RequestConditionHolder custom = new RequestConditionHolder(rm); <ide> RequestMethodsRequestCondition expected = new RequestMethodsRequestCondition(RequestMethod.GET); <del> <add> <ide> assertEquals(expected, custom.getMatchingCondition(request).getCondition()); <ide> } <del> <add> <add> @Test <add> public void noMatch() { <add> MockHttpServletRequest request = new MockHttpServletRequest("GET", "/"); <add> <add> RequestMethodsRequestCondition rm = new RequestMethodsRequestCondition(RequestMethod.POST); <add> RequestConditionHolder custom = new RequestConditionHolder(rm); <add> <add> assertNull(custom.getMatchingCondition(request)); <add> } <add> <ide> @Test <ide> public void matchEmpty() { <ide> RequestConditionHolder empty = new RequestConditionHolder(null); <ide> public void compare() { <ide> assertEquals(1, params11.compareTo(params12, request)); <ide> assertEquals(-1, params12.compareTo(params11, request)); <ide> } <del> <add> <ide> @Test <ide> public void compareEmpty() { <ide> HttpServletRequest request = new MockHttpServletRequest();
2
Python
Python
remove unused import
a6370bb2a2e0bfc8e5f8474b1002e8f4cb34fa24
<ide><path>celery/worker/consumer.py <ide> def receive_message(self, body, message): <ide> :param message: The kombu message object. <ide> <ide> """ <del> print 'I am in receive_message' <ide> try: <ide> name = body['task'] <ide> except (KeyError, TypeError): <ide><path>celery/worker/control.py <ide> from celery.utils.compat import UserDict <ide> from celery.utils.log import get_logger <ide> from celery.utils import jsonify <del>from celery.utils.imports import instantiate <ide> <ide> from . import state <ide> from .state import revoked <ide> def start_actor(panel, name): <ide> <ide> @Panel.register <ide> def stop_actor(panel, id): <del> #instantiate(name).stop() <ide> return panel.consumer.stop_actor(id)
2
Ruby
Ruby
implement argv.named in terms of argv.options_only
e18da89f3c4331d65ef32f75c3271242b41246dc
<ide><path>Library/Homebrew/extend/ARGV.rb <ide> module HomebrewArgvExtension <ide> def named <del> @named ||= reject{|arg| arg[0..0] == '-'} <add> @named ||= self - options_only <ide> end <ide> <ide> def options_only <del> select {|arg| arg[0..0] == '-'} <add> select { |arg| arg.start_with?("-") } <ide> end <ide> <ide> def formulae <ide><path>Library/Homebrew/test/test_ARGV.rb <ide> def test_argv_kegs <ide> end <ide> <ide> def test_argv_named <del> @argv << 'mxcl' << '--debug' << '-v' <del> assert_equal 1, @argv.named.length <add> @argv << "foo" << "--debug" << "-v" <add> assert_equal %w[foo], @argv.named <add> end <add> <add> def test_options_only <add> @argv << "--foo" << "-vds" << "a" << "b" << "cdefg" <add> assert_equal %w[--foo -vds], @argv.options_only <ide> end <ide> <ide> def test_empty_argv
2
Javascript
Javascript
use common owner symbol to access js wrapper
a9bb653ecc9cab6317f931fe39d4cfe5642ab37b
<ide><path>lib/zlib.js <ide> const { <ide> Buffer, <ide> kMaxLength <ide> } = require('buffer'); <add>const { owner_symbol } = require('internal/async_hooks').symbols; <ide> <ide> const constants = process.binding('constants').zlib; <ide> const { <ide> function zlibBufferSync(engine, buffer) { <ide> } <ide> <ide> function zlibOnError(message, errno) { <del> var self = this.jsref; <add> var self = this[owner_symbol]; <ide> // there is no way to cleanly recover. <ide> // continuing only obscures problems. <ide> _close(self); <ide> function Zlib(opts, mode) { <ide> Transform.call(this, opts); <ide> this.bytesWritten = 0; <ide> this._handle = new binding.Zlib(mode); <del> this._handle.jsref = this; // Used by processCallback() and zlibOnError() <add> // Used by processCallback() and zlibOnError() <add> this._handle[owner_symbol] = this; <ide> this._handle.onerror = zlibOnError; <ide> this._hadError = false; <ide> this._writeState = new Uint32Array(2); <ide> function createProperty(ctor) { <ide> }; <ide> } <ide> <add>// Legacy alias on the C++ wrapper object. This is not public API, so we may <add>// want to runtime-deprecate it at some point. There's no hurry, though. <add>Object.defineProperty(binding.Zlib.prototype, 'jsref', { <add> get() { return this[owner_symbol]; }, <add> set(v) { return this[owner_symbol] = v; } <add>}); <add> <ide> module.exports = { <ide> Deflate, <ide> Inflate,
1
PHP
PHP
use proper assertions
e1aa4f27542adf21b4755b5f296b3639bc821fc1
<ide><path>tests/Auth/AuthDatabaseReminderRepositoryTest.php <ide> public function testCreateInsertsNewRecordIntoTable() <ide> <ide> $results = $repo->create($user); <ide> <del> $this->assertTrue(is_string($results) and strlen($results) > 1); <add> $this->assertInternalType('string', $results); <add> $this->assertGreaterThan(1, strlen($results)); <ide> } <ide> <ide> <ide><path>tests/Encryption/EncrypterTest.php <ide> class EncrypterTest extends PHPUnit_Framework_TestCase { <ide> public function testEncryption() <ide> { <ide> $e = $this->getEncrypter(); <del> $this->assertFalse('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' == $e->encrypt('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')); <add> $this->assertNotEquals('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', $e->encrypt('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')); <ide> $encrypted = $e->encrypt('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); <del> $this->assertTrue('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' == $e->decrypt($encrypted)); <add> $this->assertEquals('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', $e->decrypt($encrypted)); <ide> } <ide> <ide> <ide> public function testEncryptionWithCustomCipher() <ide> { <ide> $e = $this->getEncrypter(); <ide> $e->setCipher(MCRYPT_RIJNDAEL_256); <del> $this->assertFalse('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' == $e->encrypt('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')); <add> $this->assertNotEquals('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', $e->encrypt('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')); <ide> $encrypted = $e->encrypt('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); <del> $this->assertTrue('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' == $e->decrypt($encrypted)); <add> $this->assertEquals('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', $e->decrypt($encrypted)); <ide> } <ide> <ide> /** <ide><path>tests/Session/SessionStoreTest.php <ide> public function testSessionMigration() <ide> $oldId = $session->getId(); <ide> $session->getHandler()->shouldReceive('destroy')->never(); <ide> $this->assertTrue($session->migrate()); <del> $this->assertFalse($oldId == $session->getId()); <add> $this->assertNotEquals($oldId, $session->getId()); <ide> <ide> <ide> $session = $this->getSession(); <ide> $oldId = $session->getId(); <ide> $session->getHandler()->shouldReceive('destroy')->once()->with($oldId); <ide> $this->assertTrue($session->migrate(true)); <del> $this->assertFalse($oldId == $session->getId()); <add> $this->assertNotEquals($oldId, $session->getId()); <ide> } <ide> <ide> <ide> public function testSessionRegeneration() <ide> $oldId = $session->getId(); <ide> $session->getHandler()->shouldReceive('destroy')->never(); <ide> $this->assertTrue($session->regenerate()); <del> $this->assertFalse($oldId == $session->getId()); <add> $this->assertNotEquals($oldId, $session->getId()); <ide> } <ide> <ide> <ide> public function testSessionInvalidate() <ide> $session = $this->getSession(); <ide> $oldId = $session->getId(); <ide> $session->set('foo','bar'); <del> $this->assertTrue(count($session->all()) > 0); <add> $this->assertGreaterThan(0, count($session->all())); <ide> $session->getHandler()->shouldReceive('destroy')->never(); <ide> $this->assertTrue($session->invalidate()); <del> $this->assertFalse($oldId == $session->getId()); <del> $this->assertTrue(count($session->all()) == 0); <add> $this->assertNotEquals($oldId, $session->getId()); <add> $this->assertCount(0, $session->all()); <ide> } <ide> <ide> <ide> public function testReplace() <ide> $session->set('foo', 'bar'); <ide> $session->set('qu', 'ux'); <ide> $session->replace(array('foo' => 'baz')); <del> $this->assertTrue($session->get('foo') == 'baz'); <del> $this->assertTrue($session->get('qu') == 'ux'); <add> $this->assertEquals('baz', $session->get('foo')); <add> $this->assertEquals('ux', $session->get('qu')); <ide> } <ide> <ide> <ide> public function testRemove() <ide> $session->set('foo', 'bar'); <ide> $pulled = $session->remove('foo'); <ide> $this->assertFalse($session->has('foo')); <del> $this->assertTrue($pulled == 'bar'); <add> $this->assertEquals('bar', $pulled); <ide> } <ide> <ide> <ide> public function testHandlerNeedsRequest() <ide> public function testToken() <ide> { <ide> $session = $this->getSession(); <del> $this->assertTrue($session->token() == $session->getToken()); <add> $this->assertEquals($session->token(), $session->getToken()); <ide> } <ide> <ide>
3
Javascript
Javascript
remove broken string-creation.js
d525e6c92aa4a5806a12cfc9206e85724cafa9bc
<ide><path>benchmark/misc/string-creation.js <del>'use strict'; <del> <del>var common = require('../common.js'); <del>var bench = common.createBenchmark(main, { <del> millions: [100] <del>}); <del> <del>function main(conf) { <del> var n = +conf.millions * 1e6; <del> bench.start(); <del> var s; <del> for (var i = 0; i < n; i++) { <del> s = '01234567890'; <del> s[1] = 'a'; <del> } <del> bench.end(n / 1e6); <del>}
1
Java
Java
expose combine method in corsconfiguration
b9ef5416b9af95b8739e0b977e55310ef9eaed11
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/config/CorsRegistration.java <ide> public CorsRegistration maxAge(long maxAge) { <ide> return this; <ide> } <ide> <add> /** <add> * Apply the given {@code CorsConfiguration} to the one being configured via <add> * {@link CorsConfiguration#combine(CorsConfiguration)} which in turn has been <add> * initialized with {@link CorsConfiguration#applyPermitDefaultValues()}. <add> * @param other the configuration to apply <add> * @since 5.3 <add> */ <add> public CorsRegistration combine(CorsConfiguration other) { <add> this.config.combine(other); <add> return this; <add> } <add> <ide> protected String getPathPattern() { <ide> return this.pathPattern; <ide> } <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/CorsRegistration.java <ide> public CorsRegistration maxAge(long maxAge) { <ide> return this; <ide> } <ide> <add> /** <add> * Apply the given {@code CorsConfiguration} to the one being configured via <add> * {@link CorsConfiguration#combine(CorsConfiguration)} which in turn has been <add> * initialized with {@link CorsConfiguration#applyPermitDefaultValues()}. <add> * @param other the configuration to apply <add> * @since 5.3 <add> */ <add> public CorsRegistration combine(CorsConfiguration other) { <add> this.config.combine(other); <add> return this; <add> } <add> <ide> protected String getPathPattern() { <ide> return this.pathPattern; <ide> }
2
Javascript
Javascript
add uncaughtexception handler to kill child
53f29d86c0eb5e991097b24a62b5937acca682b0
<ide><path>lib/_debugger.js <ide> exports.port = 5858; <ide> <ide> exports.start = function() { <ide> var interface = new Interface(); <add> process.on('uncaughtException', function (e) { <add> console.error("There was an internal error in Node's debugger. " + <add> "Please report this bug."); <add> console.error(e.message); <add> console.error(e.stack); <add> if (interface.child) interface.child.kill(); <add> process.exit(1); <add> }); <ide> }; <ide> <ide>
1
Text
Text
remove repl.it links chinese challenge articles
015424b2a55c3d4a8498ab33104c80b6cc737c3b
<ide><path>guide/chinese/certifications/coding-interview-prep/algorithms/find-the-symmetric-difference/index.md <ide> A = {1, 2, 3} <ide> <ide> ```](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce) <ide> <del> [![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:")](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce) [运行代码](https://repl.it/C4II/0) <add> [![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:")](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce) <ide> <ide> ### 代码说明: <ide> <ide> A = {1, 2, 3} <ide> sym([1, 2, 3], [5, 2, 1, 4]); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLoc/0) <del> <ide> ### 代码说明: <ide> <ide> * `slice()`方法用于将_arguments_对象分解为数组_args_ 。 <ide> A = {1, 2, 3} <ide> sym([1, 2, 3], [5, 2, 1, 4]); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/@ashenm/Symmetric-Difference) <ide> <ide> ### 代码说明: <ide> <ide><path>guide/chinese/certifications/coding-interview-prep/algorithms/implement-bubble-sort/index.md <ide> function swap(a, b, arr){ <ide> <ide> `js function bubbleSort(array) { for (let i = 0; i < array.length; i++){ for (let j = 0; j < array.length-1-i; j++){ if (array[j] > array[j+1]) [array[j], array[j+1]] = [array[j+1], array[j]]; // Using ES6 array destructuring to swap } } return array; }` <ide> <del>* [运行代码](https://repl.it/@ezioda004/Bubble-Sort) <ide> <ide> ### 参考文献: <ide> <ide><path>guide/chinese/certifications/coding-interview-prep/algorithms/implement-insertion-sort/index.md <ide> function insertionSort(array) { <ide> } <ide> ``` <ide> <del>* [运行代码](https://repl.it/@ezioda004/Insertion-Sort) <ide> <ide> ### 参考文献: <ide> <ide><path>guide/chinese/certifications/coding-interview-prep/algorithms/implement-merge-sort/index.md <ide> localeTitle: 实现合并排序 <ide> } <ide> ``` <ide> <del>* [运行代码](https://repl.it/@ezioda004/Merge-Sort) <ide> <ide> ### 参考文献: <ide> <ide><path>guide/chinese/certifications/coding-interview-prep/algorithms/implement-quick-sort/index.md <ide> localeTitle: 实施快速排序 <ide> } <ide> ``` <ide> <del>* [运行代码](https://repl.it/@ezioda004/Quick-Sort) <ide> <ide> ### 参考: <ide> <ide><path>guide/chinese/certifications/coding-interview-prep/algorithms/inventory-update/index.md <ide> localeTitle: 库存更新 <ide> updateInventory(curInv, newInv); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLok/0) <ide> <ide> ### 代码说明: <ide> <ide> localeTitle: 库存更新 <ide> updateInventory(curInv, newInv); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLol/0) <ide> <ide> ### 代码说明: <ide> <ide> localeTitle: 库存更新 <ide> updateInventory(curInv, newInv); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/MQvv/latest) <ide> <ide> ### 代码说明: <ide> <ide><path>guide/chinese/certifications/coding-interview-prep/algorithms/no-repeats-please/index.md <ide> function permAlone(str) { <ide> permAlone('aab'); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLop/0) <ide> <ide> ### 代码说明: <ide> <ide><path>guide/chinese/certifications/coding-interview-prep/project-euler/problem-1-multiples-of-3-and-5/index.md <ide> function multiplesOf3and5(number) { <ide> } <ide> ``` <ide> <del>* [运行代码](https://repl.it/@ezioda004/Project-Euler-Problem-1-Multiples-of-3-and-5) <ide> <ide> ### 参考: <ide> <ide><path>guide/chinese/certifications/coding-interview-prep/project-euler/problem-2-even-fibonacci-numbers/index.md <ide> function fiboEvenSum(n) { <ide> } <ide> ``` <ide> <del>* [运行代码](https://repl.it/@ezioda004/Project-Euler-Problem-2-Even-Fibonacci-Numbers) <ide> <ide> ### 参考文献: <ide> <ide><path>guide/chinese/certifications/coding-interview-prep/project-euler/problem-3-largest-prime-factor/index.md <ide> function largestPrimeFactor(number) { <ide> } <ide> ``` <ide> <del>* [运行代码](https://repl.it/@ezioda004/Problem-3-Largest-prime-factor) <ide> <ide> ### 资源: <ide> <ide><path>guide/chinese/certifications/coding-interview-prep/project-euler/problem-4-largest-palindrome-product/index.md <ide> function largestPalindromeProduct(n) { <ide> } <ide> ``` <ide> <del>* [运行代码](https://repl.it/@ezioda004/Problem-4-Largest-palindrome-product) <ide> <ide> ### 参考文献: <ide> <ide><path>guide/chinese/certifications/coding-interview-prep/project-euler/problem-5-smallest-multiple/index.md <ide> localeTitle: 最小的倍数 <ide> } <ide> ``` <ide> <del>* [运行代码](https://repl.it/@ezioda004/Problem-5-Smallest-multiple) <ide> <ide> ### 参考文献: <ide> <ide><path>guide/chinese/certifications/coding-interview-prep/project-euler/problem-6-sum-square-difference/index.md <ide> function sumSquareDifference(n) { <ide> } <ide> ``` <ide> <del>* [运行代码](https://repl.it/@ezioda004/Problem-6-Sum-square-difference) <ide> <ide> ### 参考文献: <ide> <ide><path>guide/chinese/certifications/coding-interview-prep/project-euler/problem-7-10001st-prime/index.md <ide> function nthPrime(n) { <ide> } <ide> ``` <ide> <del>\- [运行代码](https://repl.it/@ezioda004/Project-Euler-Problem-7-10001st-prime) <ide> <ide> ### 参考文献: <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/basic-algorithm-scripting/boo-who/index.md <ide> localeTitle: 嘘谁 <ide> booWho(null); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLnK/0) <ide> <ide> # 代码说明: <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/basic-algorithm-scripting/chunky-monkey/index.md <ide> localeTitle: 矮胖的猴子 <ide> } <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLjU/24) <ide> <ide> ### 代码说明: <ide> <ide> localeTitle: 矮胖的猴子 <ide> } <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/Cj9x/3) <ide> <ide> ### 代码说明: <ide> <ide> localeTitle: 矮胖的猴子 <ide> chunkArrayInGroups(["a", "b", "c", "d"], 2); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLjU/26) <ide> <ide> ### 代码说明: <ide> <ide> localeTitle: 矮胖的猴子 <ide> } <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLjU/579) <ide> <ide> ### 代码说明: <ide> <ide> localeTitle: 矮胖的猴子 <ide> } <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLjU/579) <ide> <ide> ### 代码说明: <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending/index.md <ide> function confirmEnding(str, target) { <ide> confirmEnding("He has to give me a new name", "name"); <ide> ``` <ide> <del>#### 🚀 [运行代码](https://repl.it/repls/SardonicRoundAfkgaming) <ide> <ide> # 代码说明: <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/basic-algorithm-scripting/factorialize-a-number/index.md <ide> function factorialize(num) { <ide> factorialize(5); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLjU/1) <ide> <ide> ## 代码说明: <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/basic-algorithm-scripting/falsy-bouncer/index.md <ide> function bouncer(arr) { <ide> } <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLjU/32) <ide> <ide> ### 代码说明: <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/basic-algorithm-scripting/find-the-longest-word-in-a-string/index.md <ide> function findLongestWordLength(str) { <ide> } <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLjU/5) <ide> <ide> ### 代码说明: <ide> <ide> function findLongestWordLength(s) { <ide> } <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLjU/6) <ide> <ide> ### 代码说明: <ide> <ide> function findLongestWordLength(str) { <ide> } <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLjU/7) <ide> <ide> ### 代码说明: <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/basic-algorithm-scripting/mutations/index.md <ide> function mutation(arr) { <ide> } <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLjU/30) <ide> <ide> ### 代码说明: <ide> <ide> function mutation(arr) { <ide> } <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLjU/31) <ide> <ide> ### 代码说明: <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string/index.md <ide> function repeatStringNumTimes(str, num) { <ide> } <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLjU/19) <ide> <ide> ### 代码说明: <ide> <ide> function repeatStringNumTimes(str, num) { <ide> } <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLjU/21) <ide> <ide> ### 代码说明: <ide> <ide> function repeatStringNumTimes(str, num) { <ide> repeatStringNumTimes("abc", 3); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLjU/85) <ide> <ide> ### 代码说明: <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/basic-algorithm-scripting/return-largest-numbers-in-arrays/index.md <ide> function largestOfFour(arr) { <ide> } <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLjU/734) <ide> <ide> ### 代码说明: <ide> <ide> function largestOfFour(arr) { <ide> } <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLjU/733) <ide> <ide> ### 代码说明: <ide> <ide> function largestOfFour(arr) { <ide> } <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLjU/17) <ide> <ide> ### 代码说明: <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/basic-algorithm-scripting/reverse-a-string/index.md <ide> function reverseString(str) { <ide> } <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLjU) <ide> <ide> ### 代码说明: <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/basic-algorithm-scripting/slice-and-splice/index.md <ide> function frankenSplice(arr1, arr2, n) { <ide> } <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLjU) <ide> <ide> ### 代码说明: <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/basic-algorithm-scripting/title-case-a-sentence/index.md <ide> String.prototype.replaceAt = function(index, character) { <ide> } <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLjU/8) <ide> <ide> ### 代码说明: <ide> <ide> function titleCase(str) { <ide> titleCase("I'm a little tea pot"); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLjU/9) <ide> <ide> ### 代码说明: <ide> <ide> function titleCase(str) { <ide> } <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLjU/14) <ide> <ide> ### 代码说明: <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/basic-algorithm-scripting/truncate-a-string/index.md <ide> function truncateString(str, num) { <ide> } <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLjU/55) <ide> <ide> ### 代码说明: <ide> <ide> function truncateString(str, num) { <ide> } <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLjU/54) <ide> <ide> ### 代码说明: <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/basic-algorithm-scripting/where-do-i-belong/index.md <ide> function getIndexToIns(arr, num) { <ide> } <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLjU/36) <ide> <ide> ## 代码说明: <ide> <ide> function getIndexToIns(arr, num) { <ide> getIndexToIns([40, 60], 50); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLjU/2547) <ide> <ide> ## 代码说明: <ide> <ide> function getIndexToIns(arr, num) { <ide> getIndexToIns([40, 60], 50); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLjU/4135) <ide> <ide> ## 代码说明: <ide> <ide> function getIndexToIns(arr, num) { <ide> } <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/EB10/1) <ide> <ide> ## 代码说明: <ide> <ide> function getIndexToIns(arr, num) { <ide> getIndexToIns([40, 60], 500); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLjU/63) <ide> <ide> ## 代码说明: <ide> <ide> function getIndexToIns(arr, num) { <ide> getIndexToIns([1,3,4],2); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/IUJE/0) <ide> <ide> ## 代码说明: <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements/index.md <ide> function testSize(num) { <ide> } <ide> ``` <ide> <del>·在[repl.it上](https://repl.it/@AdrianSkar/Basic-JS-Chaining-ifelse-statements)运行代码 <del> <ide> ### 代码说明 <ide> <ide> 该函数首先检查`if`条件`(num < 5)` 。如果它的计算结果为`true` ,则返回花括号之间的语句(“Tiny”)。如果没有,则检查下一个条件,直到最后一个`else`语句。 <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator/index.md <ide> function testEqual(val) { <ide> testEqual(10); <ide> ``` <ide> <del>· [在repl.it上运行代码](https://repl.it/@AdrianSkar/Basic-JS-Equality-operator) <ide> <ide> ### 代码说明 <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator/index.md <ide> function testLogicalAnd(val) { <ide> testLogicalAnd(10); <ide> ``` <ide> <del>· [在repl.it上运行代码](https://repl.it/@AdrianSkar/Basic-JS-Comparison-with-the-and-operator) <ide> <ide> ### 代码说明 <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/basic-javascript/counting-cards/index.md <ide> function cc(card) { <ide> } <ide> ``` <ide> <del>·在[repl.it上](https://repl.it/@AdrianSkar/Basic-JS-Counting-cards)运行代码。 <ide> <ide> ### 代码说明 <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/basic-javascript/golf-code/index.md <ide> var names = ["Hole-in-one!", "Eagle", "Birdie", "Par", "Bogey", "Double Bogey", <ide> golfScore(5, 4); <ide> ``` <ide> <del>·在[repl.it](https://repl.it/@AdrianSkar/Basic-JS-Golf-code)运行 <ide> <ide> ##代码说明 由于我们已经在变量`names`定义了一个数组,我们可以利用它并将它用于使用索引的返回语句(例如: `names[0] is the first one` )。这样,如果您需要更改特定结果,则不需要在函数内部查找它,它将位于数组的开头。 <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements/index.md <ide> function testElseIf(val) { <ide> testElseIf(7); <ide> ``` <ide> <del>:rocket: [运行代码](https://repl.it/@RyanPisuena/GoldenWorriedRuntime) ##代码说明 **else-if逻辑流**的结构是一个初始`if`语句,一个`if-else`语句和一个final `else`语句。 <add>##代码说明 **else-if逻辑流**的结构是一个初始`if`语句,一个`if-else`语句和一个final `else`语句。 <ide> <ide> ### 资源 <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements/index.md <ide> function testElse(val) { <ide> testElse(4); <ide> ``` <ide> <del>· [在repl.it上运行代码](https://repl.it/@AdrianSkar/Introducing-else-statements) <del> <ide> ### 代码说明 <ide> <ide> 功能首先评估`if`条件`val > 5`的计算结果为`true` 。如果没有,则执行下一个语句( `else { return "5 or smaller";})` 。 <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements/index.md <ide> function sequentialSizes(val) { <ide> sequentialSizes(1); <ide> ``` <ide> <del>·在[repl.it上](https://repl.it/@AdrianSkar/Basic-JS-Multiple-opts-in-switch)运行代码。 <ide> <ide> ### 代码说明 <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/basic-javascript/record-collection/index.md <ide> function updateRecords(id, prop, value) { <ide> } <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/C2AZ/0) <ide> <ide> ### 代码说明: <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions/index.md <ide> function isLess(a, b) { <ide> isLess(10, 15); <ide> ``` <ide> <del>在[repl.it上](https://repl.it/@AdrianSkar/Basic-Js-Returning-boolean-from-function)运行代码。 <del> <ide> ### 资源 <ide> <ide> * [“小于或等于运算符(<=)” - _MDN Javascript参考_](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Less_than_or_equal_operator_(%3C)) <ide>\ No newline at end of file <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements/index.md <ide> function caseInSwitch(val) { <ide> caseInSwitch(1); <ide> ``` <ide> <del>·在[repl.it上](https://repl.it/@AdrianSkar/Basic-JS-Switch-statements)运行代码。 <ide> <ide> ### 代码说明 <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups/index.md <ide> function phoneticLookup(val) { <ide> <ide> JavaScript的 result = lookup \[val\]; \`\`\` <ide> <del>·在[repl.it上](https://repl.it/@AdrianSkar/Using-objects-for-lookups)运行代码。 <ide> <ide> ### 资源 <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions/index.md <ide> const increment = (function() { <ide> console.log(increment(5)); // returns NaN <ide> ``` <ide> <del>:rocket: [运行代码](https://repl.it/@RyanPisuena/PleasingFumblingThings) <ide> <ide> ## 代码说明 <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/arguments-optional/index.md <ide> localeTitle: 参数可选 <ide> addTogether(2,3); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLnz/0) <ide> <ide> ### 代码说明: <ide> <ide> localeTitle: 参数可选 <ide> addTogether(2,3); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLoA/0) <ide> <ide> ### 代码说明: <ide> <ide> localeTitle: 参数可选 <ide> addTogether(2,3); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLoB/0) <ide> <ide> ### 代码说明: <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/binary-agents/index.md <ide> localeTitle: 二元代理商 <ide> binaryAgent("01000001 01110010 01100101 01101110 00100111 01110100 00100000 01100010 01101111 01101110 01100110 01101001 01110010 01100101 01110011 00100000 01100110 01110101 01101110 00100001 00111111"); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLnm/0) <ide> <ide> # 代码说明: <ide> <ide> localeTitle: 二元代理商 <ide> binaryAgent("01000001 01110010 01100101 01101110 00100111 01110100 00100000 01100010 01101111 01101110 01100110 01101001 01110010 01100101 01110011 00100000 01100110 01110101 01101110 00100001 00111111"); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLno/0) <ide> <ide> # 代码说明 <ide> <ide> localeTitle: 二元代理商 <ide> binaryAgent("01000001 01110010 01100101 01101110 00100111 01110100 00100000 01100010 01101111 01101110 01100110 01101001 01110010 01100101 01110011 00100000 01100110 01110101 01101110 00100001 00111111"); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLnp/0) <ide> <ide> # 代码说明 <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/convert-html-entities/index.md <ide> localeTitle: 转换HTML实体 <ide> * [arr.join()](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/join) <ide> * [切换声明](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Statements/switch) <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLnP/0) <ide> <ide> ## ![:sunflower:](https://forum.freecodecamp.com/images/emoji/emoji_one/sunflower.png?v=3 ":向日葵:")中级代码解决方案: <ide> ``` <ide> function convertHTML(str) { <ide> convertHTML("Dolce & Gabbana"); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLnQ/0) <ide> <ide> ### 代码说明: <ide> <ide> function convertHTML(str) { <ide> convertHTML("Dolce & Gabbana"); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLnR/0) <ide> <ide> ### 代码说明: <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/diff-two-arrays/index.md <ide> localeTitle: 差分两个阵列 <ide> diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5]); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLme/0) <ide> <ide> ### 代码说明: <ide> <ide> localeTitle: 差分两个阵列 <ide> diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5]); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CNYb/0) <ide> <ide> ### 代码说明: <ide> <ide> function diffArray(arr1, arr2) { <ide> diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5]); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CNYU/0) <ide> <ide> ### 代码说明: <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/dna-pairing/index.md <ide> localeTitle: Dna配对 <ide> pairElement("GCG"); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLmz/0) <ide> <ide> ### 代码说明: <ide> <ide> localeTitle: Dna配对 <ide> pairElement("GCG"); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/repls/ThoroughSphericalComputeranimation) <ide> <ide> ## 代码说明: <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/drop-it/index.md <ide> function dropElements(arr, func) { <ide> dropElements([1, 2, 3, 4], function(n) {return n >= 3;}) <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLna/0) <ide> <ide> ### 代码说明: <ide> <ide> function dropElements(arr, func) { <ide> dropElements([1, 2, 3, 4], function(n) {return n >= 3;}); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLnc/0) <ide> <ide> ### 代码说明: <ide> <ide> function dropElements(arr, func) { <ide> dropElements([1, 2, 3, 4], function(n) {return n >= 3;}); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLnf/0) <ide> <ide> ### 代码说明 <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/everything-be-true/index.md <ide> function truthCheck(collection, pre) { <ide> truthCheck([{"user": "Tinky-Winky", "sex": "male"}, {"user": "Dipsy", "sex": "male"}, {"user": "Laa-Laa", "sex": "female"}, {"user": "Po", "sex": "female"}], "sex"); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLnw/0) <ide> <ide> ### 代码说明: <ide> <ide> function truthCheck(collection, pre) { <ide> truthCheck([{"user": "Tinky-Winky", "sex": "male"}, {"user": "Dipsy", "sex": "male"}, {"user": "Laa-Laa", "sex": "female"}, {"user": "Po", "sex": "female"}], "sex"); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLny/0) <ide> <ide> ### 代码说明: <ide> <ide> function truthCheck(collection, pre) { <ide> truthCheck([{"user": "Tinky-Winky", "sex": "male"}, {"user": "Dipsy", "sex": "male"}, {"user": "Laa-Laa", "sex": "female"}, {"user": "Po", "sex": "female"}], "sex"); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/E2u6/0) <ide> <ide> ### 代码说明: <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/make-a-person/index.md <ide> var Person = function(firstAndLast) { <ide> bob.getFullName(); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLov/0) <ide> <ide> ### 代码说明: <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/map-the-debris/index.md <ide> function orbitalPeriod(arr) { <ide> orbitalPeriod([{name : "sputnik", avgAlt : 35873.5553}]); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLow/0) <ide> <ide> ### 代码说明: <ide> <ide> function orbitalPeriod(arr) { <ide> orbitalPeriod([{name : "sputnik", avgAlt : 35873.5553}]); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLoy/0) <ide> <ide> ### 代码说明: <ide> <ide> function orbitalPeriod(arr) { <ide> orbitalPeriod([{name : "sputnik", avgAlt : 35873.5553}]); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLoz/0) <ide> <ide> ### 代码说明: <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/missing-letters/index.md <ide> function fearNotLetter(str) { <ide> fearNotLetter("abce"); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLnD/0) <ide> <ide> ### 代码说明: <ide> <ide> function fearNotLetter(str) { <ide> fearNotLetter("abce"); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLnE/0) <ide> <ide> ### 代码说明: <ide> <ide> function fearNotLetter(str) { <ide> fearNotLetter("abce"); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLnG/0) <ide> <ide> ### 代码说明: <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/pig-latin/index.md <ide> function translatePigLatin(str) { <ide> translatePigLatin("consonant"); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLmt/0) <ide> <ide> ### 代码说明: <ide> <ide> function translatePigLatin(str) { <ide> translatePigLatin("consonant"); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLmw/0) <ide> <ide> ### 代码说明: <ide> <ide> function translatePigLatin(str) { <ide> translatePigLatin("consonant"); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLmv/0) <ide> <ide> ### 代码说明: <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/search-and-replace/index.md <ide> function myReplace(str, before, after) { <ide> myReplace("A quick brown fox jumped over the lazy dog", "jumped", "leaped"); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLmo/0) <ide> <ide> ### 代码说明: <ide> <ide> function myReplace(str, before, after) { <ide> myReplace("A quick brown fox jumped over the lazy dog", "jumped", "leaped"); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLmp/0) <ide> <ide> ### 代码说明: <ide> <ide> function myReplace(str, before, after) { <ide> myReplace("A quick brown fox jumped over the lazy dog", "jumped", "leaped"); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLmq/0) <ide> <ide> ### 代码说明: <ide> <ide> function myReplace(str, before, after) { <ide> } <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/@kr3at0/SearchAndReplace) <ide> <ide> ## ![:rotating_light:](https://forum.freecodecamp.com/images/emoji/emoji_one/rotating_light.png?v=3 ":rotating_light:")高级代码解决方案备选2: <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/seek-and-destroy/index.md <ide> function destroyer(arr) { <ide> } <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLjU/95) <ide> <ide> ### 代码说明: <ide> <ide> function destroyer(arr) { <ide> } <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/Ck2m/0) <ide> <ide> ### 代码说明: <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/smallest-common-multiple/index.md <ide> function smallestCommons(arr) { <ide> smallestCommons([1,5]); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLn2/0) <ide> <ide> ### 代码说明: <ide> <ide> function smallestCommons(arr) { <ide> smallestCommons([1,5]); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLn4/0) <ide> <ide> ### 代码说明: <ide> <ide> function smallestCommons(arr) { <ide> smallestCommons([1,5]); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/MR9P/latest) <ide> <ide> ### 代码说明: <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sorted-union/index.md <ide> function uniteUnique(arr1, arr2, arr3) { <ide> uniteUnique([1, 3, 2], [5, 2, 1, 4], [2, 1]); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLnM/0) <ide> <ide> ### 代码说明: <ide> <ide> function uniteUnique(arr1, arr2, arr3) { <ide> uniteUnique([1, 3, 2], [5, 2, 1, 4], [2, 1]); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLnO/0) <ide> <ide> ### 代码说明: <ide> <ide> function uniteUnique() { <ide> uniteUnique([1, 3, 2], [5, 2, 1, 4], [2, 1]); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLnN/0) <ide> <ide> ### 代码说明: <ide> <ide> function uniteUnique() { <ide> uniteUnique([1, 3, 2], [5, 2, 1, 4], [2, 1]); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CcWk/0) <ide> <ide> ### 代码说明: <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/spinal-tap-case/index.md <ide> function spinalCase(str) { <ide> spinalCase('This Is Spinal Tap'); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLnS/0) <ide> <ide> ### 代码说明: <ide> <ide> function spinalCase(str) { <ide> spinalCase('This Is Spinal Tap'); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLnT/0) <ide> <ide> ### 代码说明: <ide> <ide> function spinalCase(str) { <ide> } <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/EUZV) <ide> <ide> ### 代码说明: <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller/index.md <ide> function steamrollArray(arr) { <ide> steamrollArray([1, [2], [3, [[4]]]]); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLnh/0) <ide> <ide> ### 代码说明: <ide> <ide> function steamrollArray(arr) { <ide> flattenArray([1, [2], [3, [[4]]]]); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLni/0) <ide> <ide> ### 代码说明: <ide> <ide> function steamrollArray(arr) { <ide> } <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CpDy/4) <ide> <ide> ### 代码说明: <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sum-all-numbers-in-a-range/index.md <ide> function sumAll(arr) { <ide> sumAll([1, 4]); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLm6/0) <ide> <ide> ### 代码说明: <ide> <ide> function sumAll(arr) { <ide> } <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLm7/0) <ide> <ide> ### 代码说明: <ide> <ide> function sumAll(arr) { <ide> sumAll([1, 4]); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLm8/0) <ide> <ide> ### 代码说明: <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sum-all-odd-fibonacci-numbers/index.md <ide> function sumFibs(num) { <ide> sumFibs(4); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLnV/0) <ide> <ide> ### 代码说明: <ide> <ide> function sumFibs(num) { <ide> sumFibs(4); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/repls/ImpassionedFineConnection) <ide> <ide> ### 代码说明: <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sum-all-primes/index.md <ide> function sumPrimes(num) { <ide> sumPrimes(10); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLnZ/0) <ide> <ide> ### 代码说明: <ide> <ide> function sumPrimes(num) { <ide> sumPrimes(10); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLn0/0) <ide> <ide> ### 代码说明: <ide> <ide> function sumPrimes(num) { <ide> sumPrimes(977); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/DoOo/3) <ide> <ide> ### 代码说明: <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/wherefore-art-thou/index.md <ide> function whatIsInAName(collection, source) { <ide> whatIsInAName([{ first: "Romeo", last: "Montague" }, { first: "Mercutio", last: null }, { first: "Tybalt", last: "Capulet" }], { last: "Capulet" }); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLmh/0) <ide> <ide> ### 代码说明: <ide> <ide> function whatIsInAName(collection, source) { <ide> whatIsInAName([{ first: "Romeo", last: "Montague" }, { first: "Mercutio", last: null }, { first: "Tybalt", last: "Capulet" }], { last: "Capulet" }); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLmi/0) <ide> <ide> ### 代码说明: <ide> <ide> function whatIsInAName(collection, source) { <ide> whatIsInAName([{ first: "Romeo", last: "Montague" }, { first: "Mercutio", last: null }, { first: "Tybalt", last: "Capulet" }], { last: "Capulet" }); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLmj/0) <ide> <ide> ### 代码说明: <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/caesars-cipher/index.md <ide> localeTitle: 凯撒密码 <ide> } <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLjU/38) <ide> <ide> ### 代码说明: <ide> <ide> ALPHA KEY BASE ROTATED ROT13 <ide> * [正则表达式](https://forum.freecodecamp.com/t/regular-expressions-resources/15931) <ide> * [Regex.test](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test) <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLjU/39) <ide> <ide> ## ![:rotating_light:](https://forum.freecodecamp.com/images/emoji/emoji_one/rotating_light.png?v=3 ":rotating_light:")高级代码解决方案 <ide> ``` <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/cash-register/index.md <ide> localeTitle: 收银机 <ide> checkCashRegister(19.50, 20.00, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.10], ["QUARTER", 4.25], ["ONE", 90.00], ["FIVE", 55.00], ["TEN", 20.00], ["TWENTY", 60.00], ["ONE HUNDRED", 100.00]]); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/@scissorsneedfoo/cash-register-example) <ide> <ide> ### 代码说明: <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/palindrome-checker/index.md <ide> localeTitle: 回文检查 <ide> } <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLjU/2) <ide> <ide> ### 代码说明: <ide> <ide> localeTitle: 回文检查 <ide> } <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLjU/3) <ide> <ide> ### 代码说明: <ide> <ide> localeTitle: 回文检查 <ide> } <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLjU/4) <ide> <ide> ### 代码说明: <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/roman-numeral-converter/index.md <ide> var convertToRoman = function(num) { <ide> convertToRoman(36); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLmf/0) <ide> <ide> ### 代码说明: <ide> <ide> function convertToRoman(num) { <ide> convertToRoman(97); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/C1YV) <ide> <ide> ### 代码说明: <ide> <ide> function convertToRoman(num) { <ide> convertToRoman(36); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/C1YV) <ide> <ide> ### 代码说明: <ide> <ide><path>guide/chinese/certifications/javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/telephone-number-validator/index.md <ide> function telephoneCheck(str) { <ide> telephoneCheck("555-555-5555"); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLo9/0) <ide> <ide> ### 代码说明: <ide> <ide> function telephoneCheck(str) { <ide> telephoneCheck("555-555-5555"); <ide> ``` <ide> <del>![:rocket:](https://forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=3 ":火箭:") [运行代码](https://repl.it/CLoa/0) <ide> <ide> ### 代码说明: <ide>
67
Python
Python
change default value of path to true
08e913476073392c8ad1fabd12d4de2be658fd0e
<ide><path>spacy/language.py <ide> def train(cls, path, gold_tuples, *configs): <ide> self.end_training() <ide> <ide> def __init__(self, <del> path=None, <add> path=True, <ide> vocab=True, <ide> tokenizer=True, <ide> tagger=True, <ide> def __init__(self, <ide> path = data_dir <ide> if isinstance(path, basestring): <ide> path = pathlib.Path(path) <del> if path is None: <add> if path is True: <ide> path = util.match_best_version(self.lang, '', util.get_data_path()) <ide> self.path = path <ide> defaults = defaults if defaults is not True else self.get_defaults(self.path)
1
Java
Java
fix doc typo in abstractautowirecapablebeanfactory
34956d30b3f628f6a48451eb43911d5665548127
<ide><path>org.springframework.beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java <ide> protected Class getTypeForFactoryMethod(String beanName, RootBeanDefinition mbd, <ide> <ide> /** <ide> * This implementation attempts to query the FactoryBean's generic parameter metadata <del> * if present to determin the object type. If not present, i.e. the FactoryBean is <add> * if present to determine the object type. If not present, i.e. the FactoryBean is <ide> * declared as a raw type, checks the FactoryBean's <code>getObjectType</code> method <ide> * on a plain instance of the FactoryBean, without bean properties applied yet. <ide> * If this doesn't return a type yet, a full creation of the FactoryBean is
1
Javascript
Javascript
add feature flag for setting update lane priority
32ff4286872d1a6bb8ce71730064f60ebbdd1509
<ide><path>packages/react-dom/src/events/ReactDOMEventListener.js <ide> import { <ide> import getEventTarget from './getEventTarget'; <ide> import {getClosestInstanceFromNode} from '../client/ReactDOMComponentTree'; <ide> <del>import {enableLegacyFBSupport} from 'shared/ReactFeatureFlags'; <add>import { <add> enableLegacyFBSupport, <add> decoupleUpdatePriorityFromScheduler, <add>} from 'shared/ReactFeatureFlags'; <ide> import { <ide> UserBlockingEvent, <ide> ContinuousEvent, <ide> function dispatchUserBlockingUpdate( <ide> container, <ide> nativeEvent, <ide> ) { <del> // TODO: Double wrapping is necessary while we decouple Scheduler priority. <del> const previousPriority = getCurrentUpdateLanePriority(); <del> try { <del> setCurrentUpdateLanePriority(InputContinuousLanePriority); <add> if (decoupleUpdatePriorityFromScheduler) { <add> const previousPriority = getCurrentUpdateLanePriority(); <add> try { <add> // TODO: Double wrapping is necessary while we decouple Scheduler priority. <add> setCurrentUpdateLanePriority(InputContinuousLanePriority); <add> runWithPriority( <add> UserBlockingPriority, <add> dispatchEvent.bind( <add> null, <add> domEventName, <add> eventSystemFlags, <add> container, <add> nativeEvent, <add> ), <add> ); <add> } finally { <add> setCurrentUpdateLanePriority(previousPriority); <add> } <add> } else { <ide> runWithPriority( <ide> UserBlockingPriority, <ide> dispatchEvent.bind( <ide> function dispatchUserBlockingUpdate( <ide> nativeEvent, <ide> ), <ide> ); <del> } finally { <del> setCurrentUpdateLanePriority(previousPriority); <ide> } <ide> } <ide> <ide><path>packages/react-reconciler/src/ReactFiberHooks.new.js <ide> import { <ide> enableDebugTracing, <ide> enableSchedulingProfiler, <ide> enableNewReconciler, <add> decoupleUpdatePriorityFromScheduler, <ide> } from 'shared/ReactFeatureFlags'; <ide> <ide> import {NoMode, BlockingMode, DebugTracingMode} from './ReactTypeOfMode'; <ide> function rerenderDeferredValue<T>( <ide> <ide> function startTransition(setPending, config, callback) { <ide> const priorityLevel = getCurrentPriorityLevel(); <del> const previousLanePriority = getCurrentUpdateLanePriority(); <del> setCurrentUpdateLanePriority( <del> higherLanePriority(previousLanePriority, InputContinuousLanePriority), <del> ); <del> runWithPriority( <del> priorityLevel < UserBlockingPriority ? UserBlockingPriority : priorityLevel, <del> () => { <del> setPending(true); <del> }, <del> ); <add> if (decoupleUpdatePriorityFromScheduler) { <add> const previousLanePriority = getCurrentUpdateLanePriority(); <add> setCurrentUpdateLanePriority( <add> higherLanePriority(previousLanePriority, InputContinuousLanePriority), <add> ); <ide> <del> // If there's no SuspenseConfig set, we'll use the DefaultLanePriority for this transition. <del> setCurrentUpdateLanePriority(DefaultLanePriority); <add> runWithPriority( <add> priorityLevel < UserBlockingPriority <add> ? UserBlockingPriority <add> : priorityLevel, <add> () => { <add> setPending(true); <add> }, <add> ); <ide> <del> runWithPriority( <del> priorityLevel > NormalPriority ? NormalPriority : priorityLevel, <del> () => { <del> const previousConfig = ReactCurrentBatchConfig.suspense; <del> ReactCurrentBatchConfig.suspense = config === undefined ? null : config; <del> try { <del> setPending(false); <del> callback(); <del> } finally { <del> setCurrentUpdateLanePriority(previousLanePriority); <del> ReactCurrentBatchConfig.suspense = previousConfig; <del> } <del> }, <del> ); <add> // If there's no SuspenseConfig set, we'll use the DefaultLanePriority for this transition. <add> setCurrentUpdateLanePriority(DefaultLanePriority); <add> <add> runWithPriority( <add> priorityLevel > NormalPriority ? NormalPriority : priorityLevel, <add> () => { <add> const previousConfig = ReactCurrentBatchConfig.suspense; <add> ReactCurrentBatchConfig.suspense = config === undefined ? null : config; <add> try { <add> setPending(false); <add> callback(); <add> } finally { <add> if (decoupleUpdatePriorityFromScheduler) { <add> setCurrentUpdateLanePriority(previousLanePriority); <add> } <add> ReactCurrentBatchConfig.suspense = previousConfig; <add> } <add> }, <add> ); <add> } else { <add> runWithPriority( <add> priorityLevel < UserBlockingPriority <add> ? UserBlockingPriority <add> : priorityLevel, <add> () => { <add> setPending(true); <add> }, <add> ); <add> <add> runWithPriority( <add> priorityLevel > NormalPriority ? NormalPriority : priorityLevel, <add> () => { <add> const previousConfig = ReactCurrentBatchConfig.suspense; <add> ReactCurrentBatchConfig.suspense = config === undefined ? null : config; <add> try { <add> setPending(false); <add> callback(); <add> } finally { <add> ReactCurrentBatchConfig.suspense = previousConfig; <add> } <add> }, <add> ); <add> } <ide> } <ide> <ide> function mountTransition( <ide><path>packages/react-reconciler/src/ReactFiberHooks.old.js <ide> import { <ide> enableDebugTracing, <ide> enableSchedulingProfiler, <ide> enableNewReconciler, <add> decoupleUpdatePriorityFromScheduler, <ide> } from 'shared/ReactFeatureFlags'; <ide> <ide> import {NoMode, BlockingMode, DebugTracingMode} from './ReactTypeOfMode'; <ide> function rerenderDeferredValue<T>( <ide> <ide> function startTransition(setPending, config, callback) { <ide> const priorityLevel = getCurrentPriorityLevel(); <del> const previousLanePriority = getCurrentUpdateLanePriority(); <del> setCurrentUpdateLanePriority( <del> higherLanePriority(previousLanePriority, InputContinuousLanePriority), <del> ); <del> runWithPriority( <del> priorityLevel < UserBlockingPriority ? UserBlockingPriority : priorityLevel, <del> () => { <del> setPending(true); <del> }, <del> ); <add> if (decoupleUpdatePriorityFromScheduler) { <add> const previousLanePriority = getCurrentUpdateLanePriority(); <add> setCurrentUpdateLanePriority( <add> higherLanePriority(previousLanePriority, InputContinuousLanePriority), <add> ); <ide> <del> // If there's no SuspenseConfig set, we'll use the DefaultLanePriority for this transition. <del> setCurrentUpdateLanePriority(DefaultLanePriority); <add> runWithPriority( <add> priorityLevel < UserBlockingPriority <add> ? UserBlockingPriority <add> : priorityLevel, <add> () => { <add> setPending(true); <add> }, <add> ); <ide> <del> runWithPriority( <del> priorityLevel > NormalPriority ? NormalPriority : priorityLevel, <del> () => { <del> const previousConfig = ReactCurrentBatchConfig.suspense; <del> ReactCurrentBatchConfig.suspense = config === undefined ? null : config; <del> try { <del> setPending(false); <del> callback(); <del> } finally { <del> setCurrentUpdateLanePriority(previousLanePriority); <del> ReactCurrentBatchConfig.suspense = previousConfig; <del> } <del> }, <del> ); <add> // If there's no SuspenseConfig set, we'll use the DefaultLanePriority for this transition. <add> setCurrentUpdateLanePriority(DefaultLanePriority); <add> <add> runWithPriority( <add> priorityLevel > NormalPriority ? NormalPriority : priorityLevel, <add> () => { <add> const previousConfig = ReactCurrentBatchConfig.suspense; <add> ReactCurrentBatchConfig.suspense = config === undefined ? null : config; <add> try { <add> setPending(false); <add> callback(); <add> } finally { <add> if (decoupleUpdatePriorityFromScheduler) { <add> setCurrentUpdateLanePriority(previousLanePriority); <add> } <add> ReactCurrentBatchConfig.suspense = previousConfig; <add> } <add> }, <add> ); <add> } else { <add> runWithPriority( <add> priorityLevel < UserBlockingPriority <add> ? UserBlockingPriority <add> : priorityLevel, <add> () => { <add> setPending(true); <add> }, <add> ); <add> <add> runWithPriority( <add> priorityLevel > NormalPriority ? NormalPriority : priorityLevel, <add> () => { <add> const previousConfig = ReactCurrentBatchConfig.suspense; <add> ReactCurrentBatchConfig.suspense = config === undefined ? null : config; <add> try { <add> setPending(false); <add> callback(); <add> } finally { <add> ReactCurrentBatchConfig.suspense = previousConfig; <add> } <add> }, <add> ); <add> } <ide> } <ide> <ide> function mountTransition( <ide><path>packages/react-reconciler/src/ReactFiberWorkLoop.new.js <ide> export function flushDiscreteUpdates() { <ide> } <ide> <ide> export function deferredUpdates<A>(fn: () => A): A { <del> // TODO: Remove in favor of Scheduler.next <del> const previousLanePriority = getCurrentUpdateLanePriority(); <del> try { <del> setCurrentUpdateLanePriority(DefaultLanePriority); <add> if (decoupleUpdatePriorityFromScheduler) { <add> const previousLanePriority = getCurrentUpdateLanePriority(); <add> try { <add> setCurrentUpdateLanePriority(DefaultLanePriority); <add> return runWithPriority(NormalSchedulerPriority, fn); <add> } finally { <add> setCurrentUpdateLanePriority(previousLanePriority); <add> } <add> } else { <ide> return runWithPriority(NormalSchedulerPriority, fn); <del> } finally { <del> setCurrentUpdateLanePriority(previousLanePriority); <ide> } <ide> } <ide> <ide> export function discreteUpdates<A, B, C, D, R>( <ide> ): R { <ide> const prevExecutionContext = executionContext; <ide> executionContext |= DiscreteEventContext; <del> const previousLanePriority = getCurrentUpdateLanePriority(); <del> try { <del> setCurrentUpdateLanePriority(InputDiscreteLanePriority); <del> // Should this <del> return runWithPriority( <del> UserBlockingSchedulerPriority, <del> fn.bind(null, a, b, c, d), <del> ); <del> } finally { <del> setCurrentUpdateLanePriority(previousLanePriority); <del> executionContext = prevExecutionContext; <del> if (executionContext === NoContext) { <del> // Flush the immediate callbacks that were scheduled during this batch <del> flushSyncCallbackQueue(); <add> <add> if (decoupleUpdatePriorityFromScheduler) { <add> const previousLanePriority = getCurrentUpdateLanePriority(); <add> try { <add> setCurrentUpdateLanePriority(InputDiscreteLanePriority); <add> return runWithPriority( <add> UserBlockingSchedulerPriority, <add> fn.bind(null, a, b, c, d), <add> ); <add> } finally { <add> setCurrentUpdateLanePriority(previousLanePriority); <add> executionContext = prevExecutionContext; <add> if (executionContext === NoContext) { <add> // Flush the immediate callbacks that were scheduled during this batch <add> flushSyncCallbackQueue(); <add> } <add> } <add> } else { <add> try { <add> return runWithPriority( <add> UserBlockingSchedulerPriority, <add> fn.bind(null, a, b, c, d), <add> ); <add> } finally { <add> executionContext = prevExecutionContext; <add> if (executionContext === NoContext) { <add> // Flush the immediate callbacks that were scheduled during this batch <add> flushSyncCallbackQueue(); <add> } <ide> } <ide> } <ide> } <ide> export function flushSync<A, R>(fn: A => R, a: A): R { <ide> return fn(a); <ide> } <ide> executionContext |= BatchedContext; <del> const previousLanePriority = getCurrentUpdateLanePriority(); <del> try { <del> setCurrentUpdateLanePriority(SyncLanePriority); <del> if (fn) { <del> return runWithPriority(ImmediateSchedulerPriority, fn.bind(null, a)); <del> } else { <del> return (undefined: $FlowFixMe); <add> <add> if (decoupleUpdatePriorityFromScheduler) { <add> const previousLanePriority = getCurrentUpdateLanePriority(); <add> try { <add> setCurrentUpdateLanePriority(SyncLanePriority); <add> if (fn) { <add> return runWithPriority(ImmediateSchedulerPriority, fn.bind(null, a)); <add> } else { <add> return (undefined: $FlowFixMe); <add> } <add> } finally { <add> setCurrentUpdateLanePriority(previousLanePriority); <add> executionContext = prevExecutionContext; <add> // Flush the immediate callbacks that were scheduled during this batch. <add> // Note that this will happen even if batchedUpdates is higher up <add> // the stack. <add> flushSyncCallbackQueue(); <add> } <add> } else { <add> try { <add> if (fn) { <add> return runWithPriority(ImmediateSchedulerPriority, fn.bind(null, a)); <add> } else { <add> return (undefined: $FlowFixMe); <add> } <add> } finally { <add> executionContext = prevExecutionContext; <add> // Flush the immediate callbacks that were scheduled during this batch. <add> // Note that this will happen even if batchedUpdates is higher up <add> // the stack. <add> flushSyncCallbackQueue(); <ide> } <del> } finally { <del> setCurrentUpdateLanePriority(previousLanePriority); <del> executionContext = prevExecutionContext; <del> // Flush the immediate callbacks that were scheduled during this batch. <del> // Note that this will happen even if batchedUpdates is higher up <del> // the stack. <del> flushSyncCallbackQueue(); <ide> } <ide> } <ide> <ide> export function flushControlled(fn: () => mixed): void { <ide> const prevExecutionContext = executionContext; <ide> executionContext |= BatchedContext; <del> const previousLanePriority = getCurrentUpdateLanePriority(); <del> try { <del> setCurrentUpdateLanePriority(SyncLanePriority); <del> runWithPriority(ImmediateSchedulerPriority, fn); <del> } finally { <del> setCurrentUpdateLanePriority(previousLanePriority); <del> executionContext = prevExecutionContext; <del> if (executionContext === NoContext) { <del> // Flush the immediate callbacks that were scheduled during this batch <del> flushSyncCallbackQueue(); <add> if (decoupleUpdatePriorityFromScheduler) { <add> const previousLanePriority = getCurrentUpdateLanePriority(); <add> try { <add> setCurrentUpdateLanePriority(SyncLanePriority); <add> runWithPriority(ImmediateSchedulerPriority, fn); <add> } finally { <add> setCurrentUpdateLanePriority(previousLanePriority); <add> <add> executionContext = prevExecutionContext; <add> if (executionContext === NoContext) { <add> // Flush the immediate callbacks that were scheduled during this batch <add> flushSyncCallbackQueue(); <add> } <add> } <add> } else { <add> try { <add> runWithPriority(ImmediateSchedulerPriority, fn); <add> } finally { <add> executionContext = prevExecutionContext; <add> if (executionContext === NoContext) { <add> // Flush the immediate callbacks that were scheduled during this batch <add> flushSyncCallbackQueue(); <add> } <ide> } <ide> } <ide> } <ide> function commitRootImpl(root, renderPriorityLevel) { <ide> } <ide> <ide> if (firstEffect !== null) { <del> const previousLanePriority = getCurrentUpdateLanePriority(); <del> setCurrentUpdateLanePriority(SyncLanePriority); <add> let previousLanePriority; <add> if (decoupleUpdatePriorityFromScheduler) { <add> previousLanePriority = getCurrentUpdateLanePriority(); <add> setCurrentUpdateLanePriority(SyncLanePriority); <add> } <ide> <ide> const prevExecutionContext = executionContext; <ide> executionContext |= CommitContext; <ide> function commitRootImpl(root, renderPriorityLevel) { <ide> } <ide> executionContext = prevExecutionContext; <ide> <del> // Reset the priority to the previous non-sync value. <del> setCurrentUpdateLanePriority(previousLanePriority); <add> if (decoupleUpdatePriorityFromScheduler && previousLanePriority != null) { <add> // Reset the priority to the previous non-sync value. <add> setCurrentUpdateLanePriority(previousLanePriority); <add> } <ide> } else { <ide> // No effects. <ide> root.current = finishedWork; <ide> export function flushPassiveEffects(): boolean { <ide> ? NormalSchedulerPriority <ide> : pendingPassiveEffectsRenderPriority; <ide> pendingPassiveEffectsRenderPriority = NoSchedulerPriority; <del> const previousLanePriority = getCurrentUpdateLanePriority(); <del> try { <del> setCurrentUpdateLanePriority( <del> schedulerPriorityToLanePriority(priorityLevel), <del> ); <add> if (decoupleUpdatePriorityFromScheduler) { <add> const previousLanePriority = getCurrentUpdateLanePriority(); <add> try { <add> setCurrentUpdateLanePriority( <add> schedulerPriorityToLanePriority(priorityLevel), <add> ); <add> return runWithPriority(priorityLevel, flushPassiveEffectsImpl); <add> } finally { <add> setCurrentUpdateLanePriority(previousLanePriority); <add> } <add> } else { <ide> return runWithPriority(priorityLevel, flushPassiveEffectsImpl); <del> } finally { <del> setCurrentUpdateLanePriority(previousLanePriority); <ide> } <ide> } <ide> return false; <ide><path>packages/react-reconciler/src/ReactFiberWorkLoop.old.js <ide> export function flushDiscreteUpdates() { <ide> } <ide> <ide> export function deferredUpdates<A>(fn: () => A): A { <del> // TODO: Remove in favor of Scheduler.next <del> const previousLanePriority = getCurrentUpdateLanePriority(); <del> try { <del> setCurrentUpdateLanePriority(DefaultLanePriority); <add> if (decoupleUpdatePriorityFromScheduler) { <add> const previousLanePriority = getCurrentUpdateLanePriority(); <add> try { <add> setCurrentUpdateLanePriority(DefaultLanePriority); <add> return runWithPriority(NormalSchedulerPriority, fn); <add> } finally { <add> setCurrentUpdateLanePriority(previousLanePriority); <add> } <add> } else { <ide> return runWithPriority(NormalSchedulerPriority, fn); <del> } finally { <del> setCurrentUpdateLanePriority(previousLanePriority); <ide> } <ide> } <ide> <ide> export function discreteUpdates<A, B, C, D, R>( <ide> ): R { <ide> const prevExecutionContext = executionContext; <ide> executionContext |= DiscreteEventContext; <del> const previousLanePriority = getCurrentUpdateLanePriority(); <del> try { <del> setCurrentUpdateLanePriority(InputDiscreteLanePriority); <del> // Should this <del> return runWithPriority( <del> UserBlockingSchedulerPriority, <del> fn.bind(null, a, b, c, d), <del> ); <del> } finally { <del> setCurrentUpdateLanePriority(previousLanePriority); <del> executionContext = prevExecutionContext; <del> if (executionContext === NoContext) { <del> // Flush the immediate callbacks that were scheduled during this batch <del> flushSyncCallbackQueue(); <add> <add> if (decoupleUpdatePriorityFromScheduler) { <add> const previousLanePriority = getCurrentUpdateLanePriority(); <add> try { <add> setCurrentUpdateLanePriority(InputDiscreteLanePriority); <add> return runWithPriority( <add> UserBlockingSchedulerPriority, <add> fn.bind(null, a, b, c, d), <add> ); <add> } finally { <add> setCurrentUpdateLanePriority(previousLanePriority); <add> executionContext = prevExecutionContext; <add> if (executionContext === NoContext) { <add> // Flush the immediate callbacks that were scheduled during this batch <add> flushSyncCallbackQueue(); <add> } <add> } <add> } else { <add> try { <add> return runWithPriority( <add> UserBlockingSchedulerPriority, <add> fn.bind(null, a, b, c, d), <add> ); <add> } finally { <add> executionContext = prevExecutionContext; <add> if (executionContext === NoContext) { <add> // Flush the immediate callbacks that were scheduled during this batch <add> flushSyncCallbackQueue(); <add> } <ide> } <ide> } <ide> } <ide> export function flushSync<A, R>(fn: A => R, a: A): R { <ide> return fn(a); <ide> } <ide> executionContext |= BatchedContext; <del> const previousLanePriority = getCurrentUpdateLanePriority(); <del> try { <del> setCurrentUpdateLanePriority(SyncLanePriority); <del> if (fn) { <del> return runWithPriority(ImmediateSchedulerPriority, fn.bind(null, a)); <del> } else { <del> return (undefined: $FlowFixMe); <add> <add> if (decoupleUpdatePriorityFromScheduler) { <add> const previousLanePriority = getCurrentUpdateLanePriority(); <add> try { <add> setCurrentUpdateLanePriority(SyncLanePriority); <add> if (fn) { <add> return runWithPriority(ImmediateSchedulerPriority, fn.bind(null, a)); <add> } else { <add> return (undefined: $FlowFixMe); <add> } <add> } finally { <add> setCurrentUpdateLanePriority(previousLanePriority); <add> executionContext = prevExecutionContext; <add> // Flush the immediate callbacks that were scheduled during this batch. <add> // Note that this will happen even if batchedUpdates is higher up <add> // the stack. <add> flushSyncCallbackQueue(); <add> } <add> } else { <add> try { <add> if (fn) { <add> return runWithPriority(ImmediateSchedulerPriority, fn.bind(null, a)); <add> } else { <add> return (undefined: $FlowFixMe); <add> } <add> } finally { <add> executionContext = prevExecutionContext; <add> // Flush the immediate callbacks that were scheduled during this batch. <add> // Note that this will happen even if batchedUpdates is higher up <add> // the stack. <add> flushSyncCallbackQueue(); <ide> } <del> } finally { <del> setCurrentUpdateLanePriority(previousLanePriority); <del> executionContext = prevExecutionContext; <del> // Flush the immediate callbacks that were scheduled during this batch. <del> // Note that this will happen even if batchedUpdates is higher up <del> // the stack. <del> flushSyncCallbackQueue(); <ide> } <ide> } <ide> <ide> export function flushControlled(fn: () => mixed): void { <ide> const prevExecutionContext = executionContext; <ide> executionContext |= BatchedContext; <del> const previousLanePriority = getCurrentUpdateLanePriority(); <del> try { <del> setCurrentUpdateLanePriority(SyncLanePriority); <del> runWithPriority(ImmediateSchedulerPriority, fn); <del> } finally { <del> setCurrentUpdateLanePriority(previousLanePriority); <del> executionContext = prevExecutionContext; <del> if (executionContext === NoContext) { <del> // Flush the immediate callbacks that were scheduled during this batch <del> flushSyncCallbackQueue(); <add> if (decoupleUpdatePriorityFromScheduler) { <add> const previousLanePriority = getCurrentUpdateLanePriority(); <add> try { <add> setCurrentUpdateLanePriority(SyncLanePriority); <add> runWithPriority(ImmediateSchedulerPriority, fn); <add> } finally { <add> setCurrentUpdateLanePriority(previousLanePriority); <add> <add> executionContext = prevExecutionContext; <add> if (executionContext === NoContext) { <add> // Flush the immediate callbacks that were scheduled during this batch <add> flushSyncCallbackQueue(); <add> } <add> } <add> } else { <add> try { <add> runWithPriority(ImmediateSchedulerPriority, fn); <add> } finally { <add> executionContext = prevExecutionContext; <add> if (executionContext === NoContext) { <add> // Flush the immediate callbacks that were scheduled during this batch <add> flushSyncCallbackQueue(); <add> } <ide> } <ide> } <ide> } <ide> function commitRootImpl(root, renderPriorityLevel) { <ide> } <ide> <ide> if (firstEffect !== null) { <del> const previousLanePriority = getCurrentUpdateLanePriority(); <del> setCurrentUpdateLanePriority(SyncLanePriority); <add> let previousLanePriority; <add> if (decoupleUpdatePriorityFromScheduler) { <add> previousLanePriority = getCurrentUpdateLanePriority(); <add> setCurrentUpdateLanePriority(SyncLanePriority); <add> } <ide> <ide> const prevExecutionContext = executionContext; <ide> executionContext |= CommitContext; <ide> function commitRootImpl(root, renderPriorityLevel) { <ide> } <ide> executionContext = prevExecutionContext; <ide> <del> // Reset the priority to the previous non-sync value. <del> setCurrentUpdateLanePriority(previousLanePriority); <add> if (decoupleUpdatePriorityFromScheduler && previousLanePriority != null) { <add> // Reset the priority to the previous non-sync value. <add> setCurrentUpdateLanePriority(previousLanePriority); <add> } <ide> } else { <ide> // No effects. <ide> root.current = finishedWork; <ide> export function flushPassiveEffects(): boolean { <ide> ? NormalSchedulerPriority <ide> : pendingPassiveEffectsRenderPriority; <ide> pendingPassiveEffectsRenderPriority = NoSchedulerPriority; <del> const previousLanePriority = getCurrentUpdateLanePriority(); <del> try { <del> setCurrentUpdateLanePriority( <del> schedulerPriorityToLanePriority(priorityLevel), <del> ); <add> if (decoupleUpdatePriorityFromScheduler) { <add> const previousLanePriority = getCurrentUpdateLanePriority(); <add> try { <add> setCurrentUpdateLanePriority( <add> schedulerPriorityToLanePriority(priorityLevel), <add> ); <add> return runWithPriority(priorityLevel, flushPassiveEffectsImpl); <add> } finally { <add> setCurrentUpdateLanePriority(previousLanePriority); <add> } <add> } else { <ide> return runWithPriority(priorityLevel, flushPassiveEffectsImpl); <del> } finally { <del> setCurrentUpdateLanePriority(previousLanePriority); <ide> } <ide> } <ide> return false; <ide><path>packages/react-reconciler/src/SchedulerWithReactIntegration.new.js <ide> import type {ReactPriorityLevel} from './ReactInternalTypes'; <ide> // CommonJS interop named imports. <ide> import * as Scheduler from 'scheduler'; <ide> import {__interactionsRef} from 'scheduler/tracing'; <del>import {enableSchedulerTracing} from 'shared/ReactFeatureFlags'; <add>import { <add> enableSchedulerTracing, <add> decoupleUpdatePriorityFromScheduler, <add>} from 'shared/ReactFeatureFlags'; <ide> import invariant from 'shared/invariant'; <ide> import { <ide> SyncLanePriority, <ide> function flushSyncCallbackQueueImpl() { <ide> // Prevent re-entrancy. <ide> isFlushingSyncQueue = true; <ide> let i = 0; <del> const previousLanePriority = getCurrentUpdateLanePriority(); <del> try { <del> const isSync = true; <del> const queue = syncQueue; <del> setCurrentUpdateLanePriority(SyncLanePriority); <del> runWithPriority(ImmediatePriority, () => { <del> for (; i < queue.length; i++) { <del> let callback = queue[i]; <del> do { <del> callback = callback(isSync); <del> } while (callback !== null); <add> if (decoupleUpdatePriorityFromScheduler) { <add> const previousLanePriority = getCurrentUpdateLanePriority(); <add> try { <add> const isSync = true; <add> const queue = syncQueue; <add> setCurrentUpdateLanePriority(SyncLanePriority); <add> runWithPriority(ImmediatePriority, () => { <add> for (; i < queue.length; i++) { <add> let callback = queue[i]; <add> do { <add> callback = callback(isSync); <add> } while (callback !== null); <add> } <add> }); <add> syncQueue = null; <add> } catch (error) { <add> // If something throws, leave the remaining callbacks on the queue. <add> if (syncQueue !== null) { <add> syncQueue = syncQueue.slice(i + 1); <add> } <add> // Resume flushing in the next tick <add> Scheduler_scheduleCallback( <add> Scheduler_ImmediatePriority, <add> flushSyncCallbackQueue, <add> ); <add> throw error; <add> } finally { <add> setCurrentUpdateLanePriority(previousLanePriority); <add> isFlushingSyncQueue = false; <add> } <add> } else { <add> try { <add> const isSync = true; <add> const queue = syncQueue; <add> runWithPriority(ImmediatePriority, () => { <add> for (; i < queue.length; i++) { <add> let callback = queue[i]; <add> do { <add> callback = callback(isSync); <add> } while (callback !== null); <add> } <add> }); <add> syncQueue = null; <add> } catch (error) { <add> // If something throws, leave the remaining callbacks on the queue. <add> if (syncQueue !== null) { <add> syncQueue = syncQueue.slice(i + 1); <ide> } <del> }); <del> syncQueue = null; <del> } catch (error) { <del> // If something throws, leave the remaining callbacks on the queue. <del> if (syncQueue !== null) { <del> syncQueue = syncQueue.slice(i + 1); <add> // Resume flushing in the next tick <add> Scheduler_scheduleCallback( <add> Scheduler_ImmediatePriority, <add> flushSyncCallbackQueue, <add> ); <add> throw error; <add> } finally { <add> isFlushingSyncQueue = false; <ide> } <del> // Resume flushing in the next tick <del> Scheduler_scheduleCallback( <del> Scheduler_ImmediatePriority, <del> flushSyncCallbackQueue, <del> ); <del> throw error; <del> } finally { <del> setCurrentUpdateLanePriority(previousLanePriority); <del> isFlushingSyncQueue = false; <ide> } <ide> } <ide> } <ide><path>packages/react-reconciler/src/SchedulerWithReactIntegration.old.js <ide> import type {ReactPriorityLevel} from './ReactInternalTypes'; <ide> // CommonJS interop named imports. <ide> import * as Scheduler from 'scheduler'; <ide> import {__interactionsRef} from 'scheduler/tracing'; <del>import {enableSchedulerTracing} from 'shared/ReactFeatureFlags'; <add>import { <add> enableSchedulerTracing, <add> decoupleUpdatePriorityFromScheduler, <add>} from 'shared/ReactFeatureFlags'; <ide> import invariant from 'shared/invariant'; <ide> import { <ide> SyncLanePriority, <ide> function flushSyncCallbackQueueImpl() { <ide> // Prevent re-entrancy. <ide> isFlushingSyncQueue = true; <ide> let i = 0; <del> const previousLanePriority = getCurrentUpdateLanePriority(); <del> try { <del> const isSync = true; <del> const queue = syncQueue; <del> setCurrentUpdateLanePriority(SyncLanePriority); <del> runWithPriority(ImmediatePriority, () => { <del> for (; i < queue.length; i++) { <del> let callback = queue[i]; <del> do { <del> callback = callback(isSync); <del> } while (callback !== null); <add> if (decoupleUpdatePriorityFromScheduler) { <add> const previousLanePriority = getCurrentUpdateLanePriority(); <add> try { <add> const isSync = true; <add> const queue = syncQueue; <add> setCurrentUpdateLanePriority(SyncLanePriority); <add> runWithPriority(ImmediatePriority, () => { <add> for (; i < queue.length; i++) { <add> let callback = queue[i]; <add> do { <add> callback = callback(isSync); <add> } while (callback !== null); <add> } <add> }); <add> syncQueue = null; <add> } catch (error) { <add> // If something throws, leave the remaining callbacks on the queue. <add> if (syncQueue !== null) { <add> syncQueue = syncQueue.slice(i + 1); <add> } <add> // Resume flushing in the next tick <add> Scheduler_scheduleCallback( <add> Scheduler_ImmediatePriority, <add> flushSyncCallbackQueue, <add> ); <add> throw error; <add> } finally { <add> setCurrentUpdateLanePriority(previousLanePriority); <add> isFlushingSyncQueue = false; <add> } <add> } else { <add> try { <add> const isSync = true; <add> const queue = syncQueue; <add> runWithPriority(ImmediatePriority, () => { <add> for (; i < queue.length; i++) { <add> let callback = queue[i]; <add> do { <add> callback = callback(isSync); <add> } while (callback !== null); <add> } <add> }); <add> syncQueue = null; <add> } catch (error) { <add> // If something throws, leave the remaining callbacks on the queue. <add> if (syncQueue !== null) { <add> syncQueue = syncQueue.slice(i + 1); <ide> } <del> }); <del> syncQueue = null; <del> } catch (error) { <del> // If something throws, leave the remaining callbacks on the queue. <del> if (syncQueue !== null) { <del> syncQueue = syncQueue.slice(i + 1); <add> // Resume flushing in the next tick <add> Scheduler_scheduleCallback( <add> Scheduler_ImmediatePriority, <add> flushSyncCallbackQueue, <add> ); <add> throw error; <add> } finally { <add> isFlushingSyncQueue = false; <ide> } <del> // Resume flushing in the next tick <del> Scheduler_scheduleCallback( <del> Scheduler_ImmediatePriority, <del> flushSyncCallbackQueue, <del> ); <del> throw error; <del> } finally { <del> setCurrentUpdateLanePriority(previousLanePriority); <del> isFlushingSyncQueue = false; <ide> } <ide> } <ide> }
7
PHP
PHP
remove unnecessary return
f093a31740a1c6a841980e1606c966d3ac9f3a13
<ide><path>lib/Cake/Cache/Engine/MemcachedEngine.php <ide> public function init($settings = array()) { <ide> $this->_Memcached->setSaslAuthData($this->settings['login'], $this->settings['password']); <ide> } <ide> } <del> <del> return true; <ide> } <ide> <ide> return true;
1
Python
Python
add simplest possible failing test
43458944452fe11132fa1ab5f2bf1934b8fc108f
<ide><path>tests/test_model_serializer.py <ide> class Meta: <ide> self.maxDiff = None <ide> self.assertEqual(unicode_repr(TestSerializer()), expected) <ide> <del> def test_nested_hyperlinked_relations_named_source(self): <del> class TestSerializer(serializers.HyperlinkedModelSerializer): <del> class Meta: <del> model = RelationalModel <del> depth = 1 <del> fields = '__all__' <del> <del> extra_kwargs = { <del> 'url': { <del> 'source': 'url' <del> }} <del> <del> expected = dedent(""" <del> TestSerializer(): <del> url = HyperlinkedIdentityField(source='url', view_name='relationalmodel-detail') <del> foreign_key = NestedSerializer(read_only=True): <del> url = HyperlinkedIdentityField(view_name='foreignkeytargetmodel-detail') <del> name = CharField(max_length=100) <del> one_to_one = NestedSerializer(read_only=True): <del> url = HyperlinkedIdentityField(view_name='onetoonetargetmodel-detail') <del> name = CharField(max_length=100) <del> many_to_many = NestedSerializer(many=True, read_only=True): <del> url = HyperlinkedIdentityField(view_name='manytomanytargetmodel-detail') <del> name = CharField(max_length=100) <del> through = NestedSerializer(many=True, read_only=True): <del> url = HyperlinkedIdentityField(view_name='throughtargetmodel-detail') <del> name = CharField(max_length=100) <del> """) <del> self.maxDiff = None <del> self.assertEqual(unicode_repr(TestSerializer()), expected) <del> <del> <del> <ide> def test_nested_unique_together_relations(self): <ide> class TestSerializer(serializers.HyperlinkedModelSerializer): <ide> class Meta: <ide> class Meta: <ide> serializer = TestUniqueChoiceSerializer(data={'name': 'choice1'}) <ide> assert not serializer.is_valid() <ide> assert serializer.errors == {'name': ['unique choice model with this name already exists.']} <add> <add>class TestFieldSource(TestCase): <add> <add> def test_named_field_source(self): <add> class TestSerializer(serializers.ModelSerializer): <add> <add> class Meta: <add> model = RegularFieldsModel <add> fields = ('number_field',) <add> extra_kwargs = { <add> 'number_field': { <add> 'source': 'integer_field' <add> } <add> } <add> <add> expected = dedent(""" <add> TestSerializer(): <add> number_field = IntegerField(source='integer_field') <add> """) <add> self.maxDiff = None <add> self.assertEqual(unicode_repr(TestSerializer()), expected) <add>
1
Javascript
Javascript
add redirect for users blocked by okta
092d7d04d65e9ca76b7065b97522c5019425bbe8
<ide><path>api-server/src/server/component-passport.js <ide> export const createPassportCallbackAuthenticator = <ide> return next(err); <ide> } <ide> <add> const state = req && req.query && req.query.state; <add> // returnTo, origin and pathPrefix are audited by getReturnTo <add> let { returnTo, origin, pathPrefix } = getReturnTo(state, jwtSecret); <add> const redirectBase = getPrefixedLandingPath(origin, pathPrefix); <add> <add> const { error, error_description } = req.query; <add> if (error === 'access_denied') { <add> const blockedByLaw = <add> error_description === 'Access denied from your location'; <add> <add> // Do not show any error message, instead redirect to the blocked page, with details. <add> if (blockedByLaw) { <add> return res.redirectWithFlash(`${redirectBase}/blocked`); <add> } <add> <add> req.flash('info', dedent`${error_description}.`); <add> return res.redirectWithFlash(`${redirectBase}/learn`); <add> } <add> <ide> if (!user || !userInfo) { <ide> return res.redirect('/signin'); <ide> } <ide> we recommend using your email address: ${user.email} to sign in instead. <ide> req.login(user); <ide> } <ide> <del> const state = req && req.query && req.query.state; <del> // returnTo, origin and pathPrefix are audited by getReturnTo <del> let { returnTo, origin, pathPrefix } = getReturnTo(state, jwtSecret); <del> const redirectBase = getPrefixedLandingPath(origin, pathPrefix); <del> <ide> // TODO: getReturnTo could return a success flag to show a flash message, <ide> // but currently it immediately gets overwritten by a second message. We <ide> // should either change the message if the flag is present or allow
1
PHP
PHP
correct doc block
cbbd3ec6b38e7b9526ef0370d1b2dffc0499c45f
<ide><path>lib/Cake/TestSuite/Coverage/BaseCoverageReport.php <ide> public function setCoverage($coverage) { <ide> /** <ide> * Gets the base path that the files we are interested in live in. <ide> * <del> * @return void <add> * @return string Path <ide> */ <ide> public function getPathFilter() { <ide> $path = ROOT . DS;
1
Javascript
Javascript
fix output.globalobject value in node-webkit
70d48256d7031e5cd557f4238a2ee9abbbab32b3
<ide><path>lib/WebpackOptionsDefaulter.js <ide> class WebpackOptionsDefaulter extends OptionsDefaulter { <ide> switch (options.target) { <ide> case "web": <ide> case "electron-renderer": <add> case "node-webkit": <ide> return "window"; <ide> case "webworker": <ide> return "self"; <ide> case "node": <ide> case "async-node": <del> case "node-webkit": <ide> case "electron-main": <ide> return "global"; <ide> default:
1
Javascript
Javascript
add sendaction() to ember.component
9d051c2a1b751494575fa06b9ebc73af8ed59ac3
<ide><path>packages/ember-views/lib/views/component.js <ide> require("ember-views/views/view"); <ide> <del>var set = Ember.set; <add>var get = Ember.get, set = Ember.set, isNone = Ember.isNone; <ide> <ide> /** <ide> @module ember <ide> var set = Ember.set; <ide> @namespace Ember <ide> @extends Ember.View <ide> */ <del>Ember.Component = Ember.View.extend({ <add>Ember.Component = Ember.View.extend(Ember.TargetActionSupport, { <ide> init: function() { <ide> this._super(); <ide> set(this, 'context', this); <ide> set(this, 'controller', this); <ide> set(this, 'templateData', {keywords: {}}); <add> }, <add> <add> targetObject: Ember.computed(function(key) { <add> var parentView = get(this, '_parentView'); <add> return parentView ? get(parentView, 'controller') : null; <add> }).property('_parentView'), <add> <add> /** <add> Sends an action to component's controller. A component inherits its <add> controller from the context in which it is used. <add> <add> By default, calling `sendAction()` will send an action with the name <add> of the component's `action` property. <add> <add> For example, if the component had a property `action` with the value <add> `"addItem"`, calling `sendAction()` would send the `addItem` action <add> to the component's controller. <add> <add> If you provide an argument to `sendAction()`, that key will be used to look <add> up the action name. <add> <add> For example, if the component had a property `playing` with the value <add> `didStartPlaying`, calling `sendAction('playing')` would send the <add> `didStartPlaying` action to the component's controller. <add> <add> Whether or not you are using the default action or a named action, if <add> the action name is not defined on the component, calling `sendAction()` <add> does not have any effect. <add> <add> For example, if you call `sendAction()` on a component that does not have <add> an `action` property defined, no action will be sent to the controller, <add> nor will an exception be raised. <add> <add> @param [action] {String} the action to trigger <add> */ <add> sendAction: function(action) { <add> var actionName; <add> <add> // Send the default action <add> if (action === undefined) { <add> actionName = get(this, 'action'); <add> Ember.assert("The default action was triggered on the component " + this.toString() + ", but the action name (" + actionName + ") was not a string.", isNone(actionName) || typeof actionName === 'string'); <add> } else { <add> actionName = get(this, action); <add> Ember.assert("The " + action + " action was triggered on the component " + this.toString() + ", but the action name (" + actionName + ") was not a string.", isNone(actionName) || typeof actionName === 'string'); <add> } <add> <add> <add> // If no action name for that action could be found, just abort. <add> if (actionName === undefined) { return; } <add> <add> this.triggerAction({ <add> action: actionName <add> }); <ide> } <ide> }); <ide><path>packages/ember-views/tests/views/component_test.js <add>var get = Ember.get, set = Ember.set; <add> <ide> module("Ember.Component"); <ide> <ide> var Component = Ember.Component.extend(); <ide> test("The controller (target of `action`) of an Ember.Component is itself", func <ide> var control = Component.create(); <ide> strictEqual(control, control.get('controller'), "A control's controller is itself"); <ide> }); <add> <add>var component, controller, actionCounts, sendCount; <add> <add>module("Ember.Component - Actions", { <add> setup: function() { <add> actionCounts = {}; <add> sendCount = 0; <add> <add> controller = Ember.Object.create({ <add> send: function(actionName) { <add> sendCount++; <add> actionCounts[actionName] = actionCounts[actionName] || 0; <add> actionCounts[actionName]++; <add> } <add> }); <add> <add> component = Ember.Component.create({ <add> _parentView: Ember.View.create({ <add> controller: controller <add> }) <add> }); <add> }, <add> <add> teardown: function() { <add> Ember.run(function() { <add> component.destroy(); <add> controller.destroy(); <add> }); <add> } <add>}); <add> <add>test("Calling sendAction on a component without an action defined does nothing", function() { <add> component.sendAction(); <add> equal(sendCount, 0, "addItem action was not invoked"); <add>}); <add> <add>test("Calling sendAction on a component with an action defined calls send on the controller", function() { <add> set(component, 'action', "addItem"); <add> <add> component.sendAction(); <add> <add> equal(sendCount, 1, "send was called once"); <add> equal(actionCounts['addItem'], 1, "addItem event was sent once"); <add>}); <add> <add>test("Calling sendAction with a named action uses the component's property as the action name", function() { <add> set(component, 'playing', "didStartPlaying"); <add> set(component, 'action', "didDoSomeBusiness"); <add> <add> component.sendAction('playing'); <add> <add> equal(sendCount, 1, "send was called once"); <add> equal(actionCounts['didStartPlaying'], 1, "named action was sent"); <add> <add> component.sendAction('playing'); <add> <add> equal(sendCount, 2, "send was called twice"); <add> equal(actionCounts['didStartPlaying'], 2, "named action was sent"); <add> <add> component.sendAction(); <add> <add> equal(sendCount, 3, "send was called three times"); <add> equal(actionCounts['didDoSomeBusiness'], 1, "default action was sent"); <add>}); <add> <add>test("Calling sendAction when the action name is not a string raises an exception", function() { <add> set(component, 'action', {}); <add> set(component, 'playing', {}); <add> <add> expectAssertion(function() { <add> component.sendAction(); <add> }); <add> <add> expectAssertion(function() { <add> component.sendAction('playing'); <add> }); <add>});
2
Javascript
Javascript
destroy singleuse context immediately
178741637693a95f9e81200b486df2e6aee06986
<ide><path>lib/_tls_common.js <ide> exports.createSecureContext = function createSecureContext(options, context) { <ide> } <ide> <ide> // Do not keep read/write buffers in free list <del> if (options.singleUse) <add> if (options.singleUse) { <add> c.singleUse = true; <ide> c.context.setFreeListLength(0); <add> } <ide> <ide> return c; <ide> }; <ide><path>lib/_tls_wrap.js <ide> TLSSocket.prototype._wrapHandle = function(handle) { <ide> }; <ide> <ide> TLSSocket.prototype._destroySSL = function _destroySSL() { <del> return this.ssl.destroySSL(); <add> this.ssl.destroySSL(); <add> if (this.ssl._secureContext.singleUse) <add> this.ssl._secureContext.context.close(); <ide> }; <ide> <ide> TLSSocket.prototype._init = function(socket, wrap) {
2
Javascript
Javascript
swap .child and .statenode in coroutines
648d6e190cf44870ab62a0e8a65189975ef44ee6
<ide><path>src/renderers/shared/fiber/ReactFiberBeginWork.js <ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>( <ide> } else if (nextCoroutine === null || workInProgress.memoizedProps === nextCoroutine) { <ide> return bailoutOnAlreadyFinishedWork(current, workInProgress); <ide> } <del> reconcileChildren(current, workInProgress, nextCoroutine.children); <add> <add> const nextChildren = nextCoroutine.children; <add> const priorityLevel = workInProgress.pendingWorkPriority; <add> <add> // The following is a fork of reconcileChildrenAtPriority but using <add> // stateNode to store the child. <add> <add> // At this point any memoization is no longer valid since we'll have changed <add> // the children. <add> workInProgress.memoizedProps = null; <add> if (!current) { <add> workInProgress.stateNode = mountChildFibersInPlace( <add> workInProgress, <add> workInProgress.stateNode, <add> nextChildren, <add> priorityLevel <add> ); <add> } else if (current.child === workInProgress.child) { <add> clearDeletions(workInProgress); <add> <add> workInProgress.stateNode = reconcileChildFibers( <add> workInProgress, <add> workInProgress.stateNode, <add> nextChildren, <add> priorityLevel <add> ); <add> <add> transferDeletions(workInProgress); <add> } else { <add> workInProgress.stateNode = reconcileChildFibersInPlace( <add> workInProgress, <add> workInProgress.stateNode, <add> nextChildren, <add> priorityLevel <add> ); <add> <add> transferDeletions(workInProgress); <add> } <add> <ide> memoizeProps(workInProgress, nextCoroutine); <ide> // This doesn't take arbitrary time so we could synchronously just begin <ide> // eagerly do the work of workInProgress.child as an optimization. <del> return workInProgress.child; <add> return workInProgress.stateNode; <ide> } <ide> <ide> function updatePortalComponent(current, workInProgress) { <ide><path>src/renderers/shared/fiber/ReactFiberCommitWork.js <ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>( <ide> while (node.tag !== HostComponent && node.tag !== HostText) { <ide> // If it is not host node and, we might have a host node inside it. <ide> // Try to search down until we find one. <del> // TODO: For coroutines, this will have to search the stateNode. <ide> if (node.effectTag & Placement) { <ide> // If we don't have a child, try the siblings instead. <ide> continue siblings; <ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>( <ide> // down its children. Instead, we'll get insertions from each child in <ide> // the portal directly. <ide> } else if (node.child) { <del> // TODO: Coroutines need to visit the stateNode. <ide> node.child.return = node; <ide> node = node.child; <ide> continue; <ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>( <ide> // Visit children because they may contain more composite or host nodes. <ide> // Skip portals because commitUnmount() currently visits them recursively. <ide> if (node.child && node.tag !== HostPortal) { <del> // TODO: Coroutines need to visit the stateNode. <ide> node.child.return = node; <ide> node = node.child; <ide> continue; <ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>( <ide> commitUnmount(node); <ide> // Visit children because we may find more host components below. <ide> if (node.child) { <del> // TODO: Coroutines need to visit the stateNode. <ide> node.child.return = node; <ide> node = node.child; <ide> continue; <ide><path>src/renderers/shared/fiber/ReactFiberCompleteWork.js <ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>( <ide> popHostContainer, <ide> } = hostContext; <ide> <add> function markChildAsProgressed(current, workInProgress, priorityLevel) { <add> // We now have clones. Let's store them as the currently progressed work. <add> workInProgress.progressedChild = workInProgress.child; <add> workInProgress.progressedPriority = priorityLevel; <add> if (current) { <add> // We also store it on the current. When the alternate swaps in we can <add> // continue from this point. <add> current.progressedChild = workInProgress.progressedChild; <add> current.progressedPriority = workInProgress.progressedPriority; <add> } <add> } <add> <ide> function markUpdate(workInProgress : Fiber) { <ide> // Tag the fiber with an update effect. This turns a Placement into <ide> // an UpdateAndPlacement. <ide> workInProgress.effectTag |= Update; <ide> } <ide> <ide> function appendAllYields(yields : Array<ReifiedYield>, workInProgress : Fiber) { <del> let node = workInProgress.child; <add> let node = workInProgress.stateNode; <ide> while (node) { <ide> if (node.tag === HostComponent || node.tag === HostText || <ide> node.tag === HostPortal) { <ide> throw new Error('A coroutine cannot have host component children.'); <ide> } else if (node.tag === YieldComponent) { <ide> yields.push(node.type); <ide> } else if (node.child) { <del> // TODO: Coroutines need to visit the stateNode. <ide> node.child.return = node; <ide> node = node.child; <ide> continue; <ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>( <ide> var props = coroutine.props; <ide> var nextChildren = fn(props, yields); <ide> <del> var currentFirstChild = current ? current.stateNode : null; <add> var currentFirstChild = current ? current.child : null; <ide> // Inherit the priority of the returnFiber. <ide> const priority = workInProgress.pendingWorkPriority; <del> workInProgress.stateNode = reconcileChildFibers( <add> workInProgress.child = reconcileChildFibers( <ide> workInProgress, <ide> currentFirstChild, <ide> nextChildren, <ide> priority <ide> ); <del> return workInProgress.stateNode; <add> markChildAsProgressed(current, workInProgress, priority); <add> return workInProgress.child; <ide> } <ide> <ide> function appendAllChildren(parent : I, workInProgress : Fiber) { <ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>( <ide> // down its children. Instead, we'll get insertions from each child in <ide> // the portal directly. <ide> } else if (node.child) { <del> // TODO: Coroutines need to visit the stateNode. <ide> node = node.child; <ide> continue; <ide> } <ide><path>src/renderers/shared/fiber/ReactFiberScheduler.js <ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>(config : HostConfig<T, P, <ide> newPriority = getPendingPriority(queue); <ide> } <ide> <add> // TODO: Coroutines need to visit stateNode <add> <ide> // progressedChild is going to be the child set with the highest priority. <ide> // Either it is the same as child, or it just bailed out because it choose <ide> // not to do the work. <ide><path>src/renderers/shared/fiber/ReactFiberTreeReflection.js <ide> exports.findCurrentHostFiber = function(parent : Fiber) : Fiber | null { <ide> return node; <ide> } else if (node.child) { <ide> // TODO: If we hit a Portal, we're supposed to skip it. <del> // TODO: Coroutines need to visit the stateNode. <ide> node.child.return = node; <ide> node = node.child; <ide> continue; <ide><path>src/renderers/shared/fiber/__tests__/ReactCoroutine-test.js <ide> describe('ReactCoroutine', () => { <ide> <ide> expect(ops).toEqual([ <ide> 'Unmount Parent', <del> // TODO: This should happen in the order Child, Continuation which it <del> // will once we swap stateNode and child positions of these. <del> 'Unmount Continuation', <ide> 'Unmount Child', <add> 'Unmount Continuation', <ide> ]); <ide> <ide> }); <ide><path>src/test/ReactTestUtils.js <ide> function findAllInRenderedFiberTreeInternal(fiber, test) { <ide> } <ide> } <ide> if (node.child) { <del> // TODO: Coroutines need to visit the stateNode. <ide> node.child.return = node; <ide> node = node.child; <ide> continue;
7
Javascript
Javascript
fix merge issue
8bd62c353cd4a8adc479d4948eaa4fdf462ee445
<ide><path>test/Errors.test.js <ide> Object { <ide> "errors": Array [], <ide> "warnings": Array [ <ide> Object { <del> "message": "configuration\\nThe 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment.\\nYou can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/concepts/mode/", <add> "message": "configuration\\nThe 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment.\\nYou can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/", <ide> }, <ide> ], <ide> }
1
Javascript
Javascript
improve documentation on directive $scope usage
159bbf11ac80bff27bbbecee61a741a3b894f58e
<ide><path>src/ng/compile.js <ide> * and other directives used in the directive's template will also be excluded from execution. <ide> * <ide> * #### `scope` <del> * **If set to `true`,** then a new scope will be created for this directive. If multiple directives on the <del> * same element request a new scope, only one new scope is created. The new scope rule does not <del> * apply for the root of the template since the root of the template always gets a new scope. <add> * The scope property can be `true`, an object or a falsy value: <ide> * <del> * **If set to `{}` (object hash),** then a new "isolate" scope is created. The 'isolate' scope differs from <del> * normal scope in that it does not prototypically inherit from the parent scope. This is useful <del> * when creating reusable components, which should not accidentally read or modify data in the <del> * parent scope. <add> * * **falsy:** No scope will be created for the directive. The directive will use its parent's scope. <ide> * <del> * The 'isolate' scope takes an object hash which defines a set of local scope properties <del> * derived from the parent scope. These local properties are useful for aliasing values for <del> * templates. Locals definition is a hash of local scope property to its source: <add> * * **`true`:** A new scope will be created for the directive's element. If multiple directives on the <add> * same element request a new scope, only one new scope is created. The new scope rule does not apply <add> * for the root of the template since the root of the template always gets a new scope. <add> * <add> * * **`{...}` (an object hash):** A new "isolate" scope is created for the directive's element. The <add> * 'isolate' scope differs from normal scope in that it does not prototypically inherit from its parent <add> * scope. This is useful when creating reusable components, which should not accidentally read or modify <add> * data in the parent scope. <add> * <add> * The 'isolate' scope object hash defines a set of local scope properties derived from attributes on the <add> * directive's element. These local properties are useful for aliasing values for templates. The keys in <add> * the object hash map to the name of the property on the isolate scope; the values define how the property <add> * is bound to the parent scope, via matching attributes on the directive's element: <ide> * <ide> * * `@` or `@attr` - bind a local scope property to the value of DOM attribute. The result is <ide> * always a string since DOM attributes are strings. If no `attr` name is specified then the <ide> * For example, if the expression is `increment(amount)` then we can specify the amount value <ide> * by calling the `localFn` as `localFn({amount: 22})`. <ide> * <add> * In general it's possible to apply more than one directive to one element, but there might be limitations <add> * depending on the type of scope required by the directives. The following points will help explain these limitations. <add> * For simplicity only two directives are taken into account, but it is also applicable for several directives: <add> * <add> * * **no scope** + **no scope** => Two directives which don't require their own scope will use their parent's scope <add> * * **child scope** + **no scope** => Both directives will share one single child scope <add> * * **child scope** + **child scope** => Both directives will share one single child scope <add> * * **isolated scope** + **no scope** => The isolated directive will use it's own created isolated scope. The other directive will use <add> * its parent's scope <add> * * **isolated scope** + **child scope** => **Won't work!** Only one scope can be related to one element. Therefore these directives cannot <add> * be applied to the same element. <add> * * **isolated scope** + **isolated scope** => **Won't work!** Only one scope can be related to one element. Therefore these directives <add> * cannot be applied to the same element. <add> * <ide> * <ide> * #### `bindToController` <ide> * When an isolate scope is used for a component (see above), and `controllerAs` is used, `bindToController: true` will
1
Mixed
Javascript
remove `streamerror` from docs
c8aa83c6ddfaa794b390858c8eaf65e18571595d
<ide><path>doc/api/http2.md <ide> added: v8.4.0 <ide> <ide> * Extends: {net.Server} <ide> <del>In `Http2Server`, there are no `'clientError'` events as there are in <del>HTTP1. However, there are `'sessionError'`, and `'streamError'` events for <del>errors emitted on the socket, or from `Http2Session` or `Http2Stream` instances. <del> <ide> #### Event: 'checkContinue' <ide> <!-- YAML <ide> added: v8.5.0 <ide> added: v8.4.0 <ide> The `'sessionError'` event is emitted when an `'error'` event is emitted by <ide> an `Http2Session` object associated with the `Http2Server`. <ide> <del>#### Event: 'streamError' <del><!-- YAML <del>added: v8.5.0 <del>--> <del> <del>If a `ServerHttp2Stream` emits an `'error'` event, it will be forwarded here. <del>The stream will already be destroyed when this event is triggered. <del> <ide> #### Event: 'stream' <ide> <!-- YAML <ide> added: v8.4.0 <ide><path>lib/internal/http2/compat.js <ide> function onStreamError(error) { <ide> // <ide> // errors in compatibility mode are <ide> // not forwarded to the request <del> // and response objects. However, <del> // they are forwarded to 'streamError' <del> // on the server by Http2Stream <add> // and response objects. <ide> } <ide> <ide> function onRequestPause() { <ide><path>test/parallel/test-http2-compat-serverresponse-destroy.js <ide> const http2 = require('http2'); <ide> const Countdown = require('../common/countdown'); <ide> <ide> // Check that destroying the Http2ServerResponse stream produces <del>// the expected result, including the ability to throw an error <del>// which is emitted on server.streamError <add>// the expected result. <ide> <ide> const errors = [ <ide> 'test-error',
3
PHP
PHP
add method hasbag to viewerrorbag
9b9d1eda4a287c59eba6a3f4ac5585966702a795
<ide><path>src/Illuminate/Support/ViewErrorBag.php <ide> class ViewErrorBag implements Countable { <ide> * @var array <ide> */ <ide> protected $bags = []; <add> <add> /** <add> * Checks if a MessageBag exists. <add> * <add> * @param string $key <add> * @return boolean <add> */ <add> public function hasBag($key = "default") <add> { <add> return isset($this->bags[$key]); <add> } <ide> <ide> /** <ide> * Get a MessageBag instance from the bags.
1
Text
Text
remove file name from self-reference links
e0a954e65798c393a67699cff1af6f96b684233a
<ide><path>doc/api/fs.md <ide> the file contents. <ide> [`fs.copyFile()`]: #fs_fs_copyfile_src_dest_mode_callback <ide> [`fs.createReadStream()`]: #fs_fs_createreadstream_path_options <ide> [`fs.createWriteStream()`]: #fs_fs_createwritestream_path_options <del>[`fs.exists()`]: fs.md#fs_fs_exists_path_callback <add>[`fs.exists()`]: #fs_fs_exists_path_callback <ide> [`fs.fstat()`]: #fs_fs_fstat_fd_options_callback <ide> [`fs.ftruncate()`]: #fs_fs_ftruncate_fd_len_callback <ide> [`fs.futimes()`]: #fs_fs_futimes_fd_atime_mtime_callback <ide><path>doc/api/process.md <ide> cases: <ide> [`process.hrtime()`]: #process_process_hrtime_time <ide> [`process.hrtime.bigint()`]: #process_process_hrtime_bigint <ide> [`process.kill()`]: #process_process_kill_pid_signal <del>[`process.setUncaughtExceptionCaptureCallback()`]: process.md#process_process_setuncaughtexceptioncapturecallback_fn <add>[`process.setUncaughtExceptionCaptureCallback()`]: #process_process_setuncaughtexceptioncapturecallback_fn <ide> [`promise.catch()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch <ide> [`queueMicrotask()`]: globals.md#globals_queuemicrotask_callback <ide> [`readable.read()`]: stream.md#stream_readable_read_size <ide> cases: <ide> [`v8.setFlagsFromString()`]: v8.md#v8_v8_setflagsfromstring_flags <ide> [debugger]: debugger.md <ide> [deprecation code]: deprecations.md <del>[note on process I/O]: process.md#process_a_note_on_process_i_o <add>[note on process I/O]: #process_a_note_on_process_i_o <ide> [process.cpuUsage]: #process_process_cpuusage_previousvalue <ide> [process_emit_warning]: #process_process_emitwarning_warning_type_code_ctor <ide> [process_warning]: #process_event_warning <ide><path>doc/api/readline.md <ide> const { createInterface } = require('readline'); <ide> [TTY]: tty.md <ide> [TTY keybindings]: #readline_tty_keybindings <ide> [Writable]: stream.md#stream_writable_streams <del>[`'SIGCONT'`]: readline.md#readline_event_sigcont <del>[`'SIGTSTP'`]: readline.md#readline_event_sigtstp <add>[`'SIGCONT'`]: #readline_event_sigcont <add>[`'SIGTSTP'`]: #readline_event_sigtstp <ide> [`'line'`]: #readline_event_line <ide> [`fs.ReadStream`]: fs.md#fs_class_fs_readstream <ide> [`process.stdin`]: process.md#process_process_stdin <ide><path>doc/api/timers.md <ide> const interval = 100; <ide> [Event Loop]: https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#setimmediate-vs-settimeout <ide> [`AbortController`]: globals.md#globals_class_abortcontroller <ide> [`TypeError`]: errors.md#errors_class_typeerror <del>[`clearImmediate()`]: timers.md#timers_clearimmediate_immediate <del>[`clearInterval()`]: timers.md#timers_clearinterval_timeout <del>[`clearTimeout()`]: timers.md#timers_cleartimeout_timeout <del>[`setImmediate()`]: timers.md#timers_setimmediate_callback_args <del>[`setInterval()`]: timers.md#timers_setinterval_callback_delay_args <del>[`setTimeout()`]: timers.md#timers_settimeout_callback_delay_args <add>[`clearImmediate()`]: #timers_clearimmediate_immediate <add>[`clearInterval()`]: #timers_clearinterval_timeout <add>[`clearTimeout()`]: #timers_cleartimeout_timeout <add>[`setImmediate()`]: #timers_setimmediate_callback_args <add>[`setInterval()`]: #timers_setinterval_callback_delay_args <add>[`setTimeout()`]: #timers_settimeout_callback_delay_args <ide> [`util.promisify()`]: util.md#util_util_promisify_original <ide> [`worker_threads`]: worker_threads.md <del>[primitive]: timers.md#timers_timeout_symbol_toprimitive <add>[primitive]: #timers_timeout_symbol_toprimitive <ide><path>doc/api/tty.md <ide> added: v0.7.7 <ide> <ide> * Returns: {number[]} <ide> <del>`writeStream.getWindowSize()` returns the size of the [TTY](tty.md) <add>`writeStream.getWindowSize()` returns the size of the TTY <ide> corresponding to this `WriteStream`. The array is of the type <ide> `[numColumns, numRows]` where `numColumns` and `numRows` represent the number <del>of columns and rows in the corresponding [TTY](tty.md). <add>of columns and rows in the corresponding TTY. <ide> <ide> ### `writeStream.hasColors([count][, env])` <ide> <!-- YAML
5
Ruby
Ruby
use full paths to mdfind and pkgutil
05094060692616040e5ef6bcd9bb996d4dd46cd0
<ide><path>Library/Homebrew/macos.rb <ide> def app_with_bundle_id id <ide> end <ide> <ide> def mdfind attribute, id <del> path = `mdfind "#{attribute} == '#{id}'"`.split("\n").first <add> path = `/usr/bin/mdfind "#{attribute} == '#{id}'"`.split("\n").first <ide> Pathname.new(path) unless path.nil? or path.empty? <ide> end <ide> <ide> def pkgutil_info id <del> `pkgutil --pkg-info #{id} 2>/dev/null`.strip <add> `/usr/sbin/pkgutil --pkg-info "#{id}" 2>/dev/null`.strip <ide> end <ide> <ide> def bottles_supported?
1
Ruby
Ruby
remove unused config option
1acdc4d930b9e575d56e3ca15a7efa7eaa257540
<ide><path>railties/test/application/middleware/session_test.rb <ide> def read_raw_cookie <ide> <ide> add_to_config <<-RUBY <ide> config.session_store :encrypted_cookie_store, key: '_myapp_session' <del> config.action_dispatch.derive_signed_cookie_key = true <ide> RUBY <ide> <ide> require "#{app_path}/config/environment"
1
Go
Go
register container as late as possible
114be249f022535f0800bd45987c4e9cd1b321a4
<ide><path>daemon/create.go <ide> func (daemon *Daemon) create(params types.ContainerCreateConfig) (retC *containe <ide> } <ide> defer func() { <ide> if retErr != nil { <del> if err := daemon.ContainerRm(container.ID, &types.ContainerRmConfig{ForceRemove: true}); err != nil { <del> logrus.Errorf("Clean up Error! Cannot destroy container %s: %v", container.ID, err) <add> if err := daemon.cleanupContainer(container, true); err != nil { <add> logrus.Errorf("failed to cleanup container on create error: %v", err) <ide> } <ide> } <ide> }() <ide> func (daemon *Daemon) create(params types.ContainerCreateConfig) (retC *containe <ide> return nil, err <ide> } <ide> <del> if err := daemon.Register(container); err != nil { <del> return nil, err <del> } <ide> rootUID, rootGID, err := idtools.GetRootUIDGID(daemon.uidMaps, daemon.gidMaps) <ide> if err != nil { <ide> return nil, err <ide> func (daemon *Daemon) create(params types.ContainerCreateConfig) (retC *containe <ide> return nil, err <ide> } <ide> <del> if err := container.ToDiskLocking(); err != nil { <add> if err := container.ToDisk(); err != nil { <ide> logrus.Errorf("Error saving new container to disk: %v", err) <ide> return nil, err <ide> } <add> if err := daemon.Register(container); err != nil { <add> return nil, err <add> } <ide> daemon.LogContainerEvent(container, "create") <ide> return container, nil <ide> }
1
Text
Text
break long command to avoid cropping
16b5b6e49f3ee1a327216ec9b6fe4b857f3ea7a2
<ide><path>docs/installation/mac.md <ide> The next exercise demonstrates how to do this. <ide> <ide> 5. Start a new `nginx` container and replace the `html` folder with your `site` directory. <ide> <del> $ docker run -d -P -v $HOME/site:/usr/share/nginx/html --name mysite nginx <add> $ docker run -d -P -v $HOME/site:/usr/share/nginx/html \ <add> --name mysite nginx <ide> <ide> 6. Get the `mysite` container's port. <ide>
1
Javascript
Javascript
use recursion to traverse during layout phase
b641d0209717d1127296d26b53b8dc056d9e6952
<ide><path>packages/react-reconciler/src/ReactFiberCommitWork.new.js <ide> function commitLayoutEffectOnFiber( <ide> case FunctionComponent: <ide> case ForwardRef: <ide> case SimpleMemoComponent: { <add> recursivelyTraverseLayoutEffects( <add> finishedRoot, <add> finishedWork, <add> committedLanes, <add> ); <ide> if (flags & Update) { <ide> if (!offscreenSubtreeWasHidden) { <ide> // At this point layout effects have already been destroyed (during mutation phase). <ide> function commitLayoutEffectOnFiber( <ide> break; <ide> } <ide> case ClassComponent: { <add> recursivelyTraverseLayoutEffects( <add> finishedRoot, <add> finishedWork, <add> committedLanes, <add> ); <ide> if (flags & Update) { <ide> if (!offscreenSubtreeWasHidden) { <ide> const instance = finishedWork.stateNode; <ide> function commitLayoutEffectOnFiber( <ide> break; <ide> } <ide> case HostRoot: { <add> recursivelyTraverseLayoutEffects( <add> finishedRoot, <add> finishedWork, <add> committedLanes, <add> ); <ide> if (flags & Callback) { <ide> // TODO: I think this is now always non-null by the time it reaches the <ide> // commit phase. Consider removing the type check. <ide> function commitLayoutEffectOnFiber( <ide> break; <ide> } <ide> case HostComponent: { <add> recursivelyTraverseLayoutEffects( <add> finishedRoot, <add> finishedWork, <add> committedLanes, <add> ); <ide> if (flags & Update) { <ide> const instance: Instance = finishedWork.stateNode; <ide> <ide> function commitLayoutEffectOnFiber( <ide> } <ide> break; <ide> } <del> case HostText: { <del> // We have no life-cycles associated with text. <del> break; <del> } <del> case HostPortal: { <del> // We have no life-cycles associated with portals. <del> break; <del> } <ide> case Profiler: { <add> recursivelyTraverseLayoutEffects( <add> finishedRoot, <add> finishedWork, <add> committedLanes, <add> ); <ide> if (enableProfilerTimer) { <ide> if (flags & Update) { <ide> try { <ide> function commitLayoutEffectOnFiber( <ide> break; <ide> } <ide> case SuspenseComponent: { <add> recursivelyTraverseLayoutEffects( <add> finishedRoot, <add> finishedWork, <add> committedLanes, <add> ); <ide> if (flags & Update) { <ide> try { <ide> commitSuspenseHydrationCallbacks(finishedRoot, finishedWork); <ide> function commitLayoutEffectOnFiber( <ide> } <ide> break; <ide> } <del> case SuspenseListComponent: <del> case IncompleteClassComponent: <del> case ScopeComponent: <del> case OffscreenComponent: <del> case LegacyHiddenComponent: <del> case TracingMarkerComponent: { <add> case OffscreenComponent: { <add> const isModernRoot = (finishedWork.mode & ConcurrentMode) !== NoMode; <add> if (isModernRoot) { <add> const isHidden = finishedWork.memoizedState !== null; <add> const newOffscreenSubtreeIsHidden = <add> isHidden || offscreenSubtreeIsHidden; <add> if (newOffscreenSubtreeIsHidden) { <add> // The Offscreen tree is hidden. Skip over its layout effects. <add> } else { <add> // The Offscreen tree is visible. <add> <add> const wasHidden = current !== null && current.memoizedState !== null; <add> const newOffscreenSubtreeWasHidden = <add> wasHidden || offscreenSubtreeWasHidden; <add> const prevOffscreenSubtreeIsHidden = offscreenSubtreeIsHidden; <add> const prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden; <add> offscreenSubtreeIsHidden = newOffscreenSubtreeIsHidden; <add> offscreenSubtreeWasHidden = newOffscreenSubtreeWasHidden; <add> <add> if (offscreenSubtreeWasHidden && !prevOffscreenSubtreeWasHidden) { <add> // This is the root of a reappearing boundary. Turn its layout <add> // effects back on. <add> // TODO: Convert this to use recursion <add> nextEffect = finishedWork; <add> reappearLayoutEffects_begin(finishedWork); <add> } <add> <add> recursivelyTraverseLayoutEffects( <add> finishedRoot, <add> finishedWork, <add> committedLanes, <add> ); <add> offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden; <add> offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; <add> } <add> } else { <add> recursivelyTraverseLayoutEffects( <add> finishedRoot, <add> finishedWork, <add> committedLanes, <add> ); <add> } <ide> break; <ide> } <del> <del> default: <del> throw new Error( <del> 'This unit of work tag should not have side-effects. This error is ' + <del> 'likely caused by a bug in React. Please file an issue.', <add> default: { <add> recursivelyTraverseLayoutEffects( <add> finishedRoot, <add> finishedWork, <add> committedLanes, <ide> ); <add> break; <add> } <ide> } <ide> } <ide> <ide> export function commitLayoutEffects( <ide> ): void { <ide> inProgressLanes = committedLanes; <ide> inProgressRoot = root; <del> nextEffect = finishedWork; <ide> <del> commitLayoutEffects_begin(finishedWork, root, committedLanes); <add> const current = finishedWork.alternate; <add> commitLayoutEffectOnFiber(root, current, finishedWork, committedLanes); <ide> <ide> inProgressLanes = null; <ide> inProgressRoot = null; <ide> } <ide> <del>function commitLayoutEffects_begin( <del> subtreeRoot: Fiber, <add>function recursivelyTraverseLayoutEffects( <ide> root: FiberRoot, <del> committedLanes: Lanes, <del>) { <del> // Suspense layout effects semantics don't change for legacy roots. <del> const isModernRoot = (subtreeRoot.mode & ConcurrentMode) !== NoMode; <del> <del> while (nextEffect !== null) { <del> const fiber = nextEffect; <del> const firstChild = fiber.child; <del> <del> if (fiber.tag === OffscreenComponent && isModernRoot) { <del> // Keep track of the current Offscreen stack's state. <del> const isHidden = fiber.memoizedState !== null; <del> const newOffscreenSubtreeIsHidden = isHidden || offscreenSubtreeIsHidden; <del> if (newOffscreenSubtreeIsHidden) { <del> // The Offscreen tree is hidden. Skip over its layout effects. <del> commitLayoutMountEffects_complete(subtreeRoot, root, committedLanes); <del> continue; <del> } else { <del> // TODO (Offscreen) Also check: subtreeFlags & LayoutMask <del> const current = fiber.alternate; <del> const wasHidden = current !== null && current.memoizedState !== null; <del> const newOffscreenSubtreeWasHidden = <del> wasHidden || offscreenSubtreeWasHidden; <del> const prevOffscreenSubtreeIsHidden = offscreenSubtreeIsHidden; <del> const prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden; <del> <del> // Traverse the Offscreen subtree with the current Offscreen as the root. <del> offscreenSubtreeIsHidden = newOffscreenSubtreeIsHidden; <del> offscreenSubtreeWasHidden = newOffscreenSubtreeWasHidden; <del> <del> if (offscreenSubtreeWasHidden && !prevOffscreenSubtreeWasHidden) { <del> // This is the root of a reappearing boundary. Turn its layout effects <del> // back on. <del> nextEffect = fiber; <del> reappearLayoutEffects_begin(fiber); <del> } <del> <del> let child = firstChild; <del> while (child !== null) { <del> nextEffect = child; <del> commitLayoutEffects_begin( <del> child, // New root; bubble back up to here and stop. <del> root, <del> committedLanes, <del> ); <del> child = child.sibling; <del> } <del> <del> // Restore Offscreen state and resume in our-progress traversal. <del> nextEffect = fiber; <del> offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden; <del> offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; <del> commitLayoutMountEffects_complete(subtreeRoot, root, committedLanes); <del> <del> continue; <del> } <del> } <del> <del> if ((fiber.subtreeFlags & LayoutMask) !== NoFlags && firstChild !== null) { <del> firstChild.return = fiber; <del> nextEffect = firstChild; <del> } else { <del> commitLayoutMountEffects_complete(subtreeRoot, root, committedLanes); <del> } <del> } <del>} <del> <del>function commitLayoutMountEffects_complete( <del> subtreeRoot: Fiber, <del> root: FiberRoot, <del> committedLanes: Lanes, <add> parentFiber: Fiber, <add> lanes: Lanes, <ide> ) { <del> while (nextEffect !== null) { <del> const fiber = nextEffect; <del> if ((fiber.flags & LayoutMask) !== NoFlags) { <del> const current = fiber.alternate; <del> setCurrentDebugFiberInDEV(fiber); <del> commitLayoutEffectOnFiber(root, current, fiber, committedLanes); <del> resetCurrentDebugFiberInDEV(); <del> } <del> <del> if (fiber === subtreeRoot) { <del> nextEffect = null; <del> return; <del> } <del> <del> const sibling = fiber.sibling; <del> if (sibling !== null) { <del> sibling.return = fiber.return; <del> nextEffect = sibling; <del> return; <add> const prevDebugFiber = getCurrentDebugFiberInDEV(); <add> if (parentFiber.subtreeFlags & LayoutMask) { <add> let child = parentFiber.child; <add> while (child !== null) { <add> setCurrentDebugFiberInDEV(child); <add> const current = child.alternate; <add> commitLayoutEffectOnFiber(root, current, child, lanes); <add> child = child.sibling; <ide> } <del> <del> nextEffect = fiber.return; <ide> } <add> setCurrentDebugFiberInDEV(prevDebugFiber); <ide> } <ide> <ide> function disappearLayoutEffects_begin(subtreeRoot: Fiber) { <ide><path>packages/react-reconciler/src/ReactFiberCommitWork.old.js <ide> function commitLayoutEffectOnFiber( <ide> case FunctionComponent: <ide> case ForwardRef: <ide> case SimpleMemoComponent: { <add> recursivelyTraverseLayoutEffects( <add> finishedRoot, <add> finishedWork, <add> committedLanes, <add> ); <ide> if (flags & Update) { <ide> if (!offscreenSubtreeWasHidden) { <ide> // At this point layout effects have already been destroyed (during mutation phase). <ide> function commitLayoutEffectOnFiber( <ide> break; <ide> } <ide> case ClassComponent: { <add> recursivelyTraverseLayoutEffects( <add> finishedRoot, <add> finishedWork, <add> committedLanes, <add> ); <ide> if (flags & Update) { <ide> if (!offscreenSubtreeWasHidden) { <ide> const instance = finishedWork.stateNode; <ide> function commitLayoutEffectOnFiber( <ide> break; <ide> } <ide> case HostRoot: { <add> recursivelyTraverseLayoutEffects( <add> finishedRoot, <add> finishedWork, <add> committedLanes, <add> ); <ide> if (flags & Callback) { <ide> // TODO: I think this is now always non-null by the time it reaches the <ide> // commit phase. Consider removing the type check. <ide> function commitLayoutEffectOnFiber( <ide> break; <ide> } <ide> case HostComponent: { <add> recursivelyTraverseLayoutEffects( <add> finishedRoot, <add> finishedWork, <add> committedLanes, <add> ); <ide> if (flags & Update) { <ide> const instance: Instance = finishedWork.stateNode; <ide> <ide> function commitLayoutEffectOnFiber( <ide> } <ide> break; <ide> } <del> case HostText: { <del> // We have no life-cycles associated with text. <del> break; <del> } <del> case HostPortal: { <del> // We have no life-cycles associated with portals. <del> break; <del> } <ide> case Profiler: { <add> recursivelyTraverseLayoutEffects( <add> finishedRoot, <add> finishedWork, <add> committedLanes, <add> ); <ide> if (enableProfilerTimer) { <ide> if (flags & Update) { <ide> try { <ide> function commitLayoutEffectOnFiber( <ide> break; <ide> } <ide> case SuspenseComponent: { <add> recursivelyTraverseLayoutEffects( <add> finishedRoot, <add> finishedWork, <add> committedLanes, <add> ); <ide> if (flags & Update) { <ide> try { <ide> commitSuspenseHydrationCallbacks(finishedRoot, finishedWork); <ide> function commitLayoutEffectOnFiber( <ide> } <ide> break; <ide> } <del> case SuspenseListComponent: <del> case IncompleteClassComponent: <del> case ScopeComponent: <del> case OffscreenComponent: <del> case LegacyHiddenComponent: <del> case TracingMarkerComponent: { <add> case OffscreenComponent: { <add> const isModernRoot = (finishedWork.mode & ConcurrentMode) !== NoMode; <add> if (isModernRoot) { <add> const isHidden = finishedWork.memoizedState !== null; <add> const newOffscreenSubtreeIsHidden = <add> isHidden || offscreenSubtreeIsHidden; <add> if (newOffscreenSubtreeIsHidden) { <add> // The Offscreen tree is hidden. Skip over its layout effects. <add> } else { <add> // The Offscreen tree is visible. <add> <add> const wasHidden = current !== null && current.memoizedState !== null; <add> const newOffscreenSubtreeWasHidden = <add> wasHidden || offscreenSubtreeWasHidden; <add> const prevOffscreenSubtreeIsHidden = offscreenSubtreeIsHidden; <add> const prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden; <add> offscreenSubtreeIsHidden = newOffscreenSubtreeIsHidden; <add> offscreenSubtreeWasHidden = newOffscreenSubtreeWasHidden; <add> <add> if (offscreenSubtreeWasHidden && !prevOffscreenSubtreeWasHidden) { <add> // This is the root of a reappearing boundary. Turn its layout <add> // effects back on. <add> // TODO: Convert this to use recursion <add> nextEffect = finishedWork; <add> reappearLayoutEffects_begin(finishedWork); <add> } <add> <add> recursivelyTraverseLayoutEffects( <add> finishedRoot, <add> finishedWork, <add> committedLanes, <add> ); <add> offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden; <add> offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; <add> } <add> } else { <add> recursivelyTraverseLayoutEffects( <add> finishedRoot, <add> finishedWork, <add> committedLanes, <add> ); <add> } <ide> break; <ide> } <del> <del> default: <del> throw new Error( <del> 'This unit of work tag should not have side-effects. This error is ' + <del> 'likely caused by a bug in React. Please file an issue.', <add> default: { <add> recursivelyTraverseLayoutEffects( <add> finishedRoot, <add> finishedWork, <add> committedLanes, <ide> ); <add> break; <add> } <ide> } <ide> } <ide> <ide> export function commitLayoutEffects( <ide> ): void { <ide> inProgressLanes = committedLanes; <ide> inProgressRoot = root; <del> nextEffect = finishedWork; <ide> <del> commitLayoutEffects_begin(finishedWork, root, committedLanes); <add> const current = finishedWork.alternate; <add> commitLayoutEffectOnFiber(root, current, finishedWork, committedLanes); <ide> <ide> inProgressLanes = null; <ide> inProgressRoot = null; <ide> } <ide> <del>function commitLayoutEffects_begin( <del> subtreeRoot: Fiber, <add>function recursivelyTraverseLayoutEffects( <ide> root: FiberRoot, <del> committedLanes: Lanes, <del>) { <del> // Suspense layout effects semantics don't change for legacy roots. <del> const isModernRoot = (subtreeRoot.mode & ConcurrentMode) !== NoMode; <del> <del> while (nextEffect !== null) { <del> const fiber = nextEffect; <del> const firstChild = fiber.child; <del> <del> if (fiber.tag === OffscreenComponent && isModernRoot) { <del> // Keep track of the current Offscreen stack's state. <del> const isHidden = fiber.memoizedState !== null; <del> const newOffscreenSubtreeIsHidden = isHidden || offscreenSubtreeIsHidden; <del> if (newOffscreenSubtreeIsHidden) { <del> // The Offscreen tree is hidden. Skip over its layout effects. <del> commitLayoutMountEffects_complete(subtreeRoot, root, committedLanes); <del> continue; <del> } else { <del> // TODO (Offscreen) Also check: subtreeFlags & LayoutMask <del> const current = fiber.alternate; <del> const wasHidden = current !== null && current.memoizedState !== null; <del> const newOffscreenSubtreeWasHidden = <del> wasHidden || offscreenSubtreeWasHidden; <del> const prevOffscreenSubtreeIsHidden = offscreenSubtreeIsHidden; <del> const prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden; <del> <del> // Traverse the Offscreen subtree with the current Offscreen as the root. <del> offscreenSubtreeIsHidden = newOffscreenSubtreeIsHidden; <del> offscreenSubtreeWasHidden = newOffscreenSubtreeWasHidden; <del> <del> if (offscreenSubtreeWasHidden && !prevOffscreenSubtreeWasHidden) { <del> // This is the root of a reappearing boundary. Turn its layout effects <del> // back on. <del> nextEffect = fiber; <del> reappearLayoutEffects_begin(fiber); <del> } <del> <del> let child = firstChild; <del> while (child !== null) { <del> nextEffect = child; <del> commitLayoutEffects_begin( <del> child, // New root; bubble back up to here and stop. <del> root, <del> committedLanes, <del> ); <del> child = child.sibling; <del> } <del> <del> // Restore Offscreen state and resume in our-progress traversal. <del> nextEffect = fiber; <del> offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden; <del> offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; <del> commitLayoutMountEffects_complete(subtreeRoot, root, committedLanes); <del> <del> continue; <del> } <del> } <del> <del> if ((fiber.subtreeFlags & LayoutMask) !== NoFlags && firstChild !== null) { <del> firstChild.return = fiber; <del> nextEffect = firstChild; <del> } else { <del> commitLayoutMountEffects_complete(subtreeRoot, root, committedLanes); <del> } <del> } <del>} <del> <del>function commitLayoutMountEffects_complete( <del> subtreeRoot: Fiber, <del> root: FiberRoot, <del> committedLanes: Lanes, <add> parentFiber: Fiber, <add> lanes: Lanes, <ide> ) { <del> while (nextEffect !== null) { <del> const fiber = nextEffect; <del> if ((fiber.flags & LayoutMask) !== NoFlags) { <del> const current = fiber.alternate; <del> setCurrentDebugFiberInDEV(fiber); <del> commitLayoutEffectOnFiber(root, current, fiber, committedLanes); <del> resetCurrentDebugFiberInDEV(); <del> } <del> <del> if (fiber === subtreeRoot) { <del> nextEffect = null; <del> return; <del> } <del> <del> const sibling = fiber.sibling; <del> if (sibling !== null) { <del> sibling.return = fiber.return; <del> nextEffect = sibling; <del> return; <add> const prevDebugFiber = getCurrentDebugFiberInDEV(); <add> if (parentFiber.subtreeFlags & LayoutMask) { <add> let child = parentFiber.child; <add> while (child !== null) { <add> setCurrentDebugFiberInDEV(child); <add> const current = child.alternate; <add> commitLayoutEffectOnFiber(root, current, child, lanes); <add> child = child.sibling; <ide> } <del> <del> nextEffect = fiber.return; <ide> } <add> setCurrentDebugFiberInDEV(prevDebugFiber); <ide> } <ide> <ide> function disappearLayoutEffects_begin(subtreeRoot: Fiber) {
2
Javascript
Javascript
refine ember.aliasmethod tests
494bbbb33154e8bd3201959112974b008657e557
<ide><path>packages/ember-metal/tests/mixin/alias_method_test.js <ide> module('Ember.aliasMethod'); <ide> <ide> function validateAliasMethod(obj) { <del> var get = Ember.get; <del> equal(get(obj, 'foo'), 'foo', 'obj.foo'); <del> equal(get(obj, 'bar'), 'foo', 'obj.bar should be a copy of foo'); <del> <ide> equal(obj.fooMethod(), 'FOO', 'obj.fooMethod()'); <ide> equal(obj.barMethod(), 'FOO', 'obj.barMethod should be a copy of foo'); <ide> } <ide> <del>test('copies the property values from another key when the mixin is applied', function() { <add>test('methods of another name are aliased when the mixin is applied', function() { <ide> <ide> var MyMixin = Ember.Mixin.create({ <del> foo: 'foo', <del> bar: Ember.aliasMethod('foo'), <del> <ide> fooMethod: function() { return 'FOO'; }, <ide> barMethod: Ember.aliasMethod('fooMethod') <ide> }); <ide> test('copies the property values from another key when the mixin is applied', fu <ide> test('should follow aliasMethods all the way down', function() { <ide> var MyMixin = Ember.Mixin.create({ <ide> bar: Ember.aliasMethod('foo'), // put first to break ordered iteration <del> baz: 'baz', <add> baz: function(){ return 'baz'; }, <ide> foo: Ember.aliasMethod('baz') <ide> }); <ide> <ide> var obj = MyMixin.apply({}); <del> equal(Ember.get(obj, 'bar'), 'baz', 'should have followed aliasMethods'); <add> equal(Ember.get(obj, 'bar')(), 'baz', 'should have followed aliasMethods'); <ide> }); <ide> <del>test('should copy from other dependent mixins', function() { <add>test('should alias methods from other dependent mixins', function() { <ide> <ide> var BaseMixin = Ember.Mixin.create({ <del> foo: 'foo', <del> <ide> fooMethod: function() { return 'FOO'; } <ide> }); <ide> <ide> var MyMixin = Ember.Mixin.create(BaseMixin, { <del> bar: Ember.aliasMethod('foo'), <ide> barMethod: Ember.aliasMethod('fooMethod') <ide> }); <ide> <ide> var obj = MyMixin.apply({}); <ide> validateAliasMethod(obj); <ide> }); <ide> <del>test('should copy from other mixins applied at same time', function() { <add>test('should alias methods from other mixins applied at same time', function() { <ide> <ide> var BaseMixin = Ember.Mixin.create({ <del> foo: 'foo', <del> <ide> fooMethod: function() { return 'FOO'; } <ide> }); <ide> <ide> var MyMixin = Ember.Mixin.create({ <del> bar: Ember.aliasMethod('foo'), <ide> barMethod: Ember.aliasMethod('fooMethod') <ide> }); <ide> <ide> var obj = Ember.mixin({}, BaseMixin, MyMixin); <ide> validateAliasMethod(obj); <ide> }); <ide> <del>test('should copy from properties already applied on object', function() { <add>test('should alias methods from mixins already applied on object', function() { <ide> <ide> var BaseMixin = Ember.Mixin.create({ <del> foo: 'foo' <add> quxMethod: function() { return 'qux'; } <ide> }); <ide> <ide> var MyMixin = Ember.Mixin.create({
1
Mixed
Ruby
add `srcset` option to `image_tag` helper
43efae22a7a59d5fe0be599bd074c5e7d881266a
<ide><path>actionview/CHANGELOG.md <add>* Add `srcset` option to `image_tag` helper <add> <add> *Roberto Miranda* <add> <ide> * Fix issues with scopes and engine on `current_page?` method. <ide> <ide> Fixes #29401. <ide><path>actionview/lib/action_view/helpers/asset_tag_helper.rb <ide> def favicon_link_tag(source = "favicon.ico", options = {}) <ide> # # => <img alt="Icon" class="menu_icon" src="/icons/icon.gif" /> <ide> # image_tag("/icons/icon.gif", data: { title: 'Rails Application' }) <ide> # # => <img data-title="Rails Application" src="/icons/icon.gif" /> <add> # image_tag("icon.png", srcset: "/assets/pic_640.jpg 640w, /assets/pic_1024.jpg 1024w, /assets/pic_1980.jpg 1980w", sizes: '100vw', class: 'my-image') <add> # <img src="/assets/ants_1980.jpg" srcset="/assets/pic_640.jpg 640w, /assets/pic_1024.jpg 1024w, /assets/pic_1980.jpg 1980w" sizes="100vw" class="my-image"> <add> # image_tag("icon.png", srcset: { 'pic_640.jpg' => '640w', 'pic_1024.jpg' => '1024w', 'pic_1980.jpg' => '1980w' }, sizes: '100vw', class: 'my-image') <add> # <img src="/assets/ants_1980.jpg" srcset="/assets/pic_640.jpg 640w, /assets/pic_1024.jpg 1024w, /assets/pic_1980.jpg 1980w" sizes="100vw" class="my-image"> <add> # image_tag("icon.png", srcset: [['pic_640.jpg', '640w'], ['pic_1024.jpg', '1024w'], ['pic_1980.jpg', '1980w']], sizes: '100vw', class: 'my-image') <add> # <img src="/assets/ants_1980.jpg" srcset="/assets/pic_640.jpg 640w, /assets/pic_1024.jpg 1024w, /assets/pic_1980.jpg 1980w" sizes="100vw" class="my-image"> <ide> def image_tag(source, options = {}) <ide> options = options.symbolize_keys <ide> check_for_image_tag_errors(options) <add> skip_pipeline = options.delete(:skip_pipeline) <ide> <del> src = options[:src] = path_to_image(source, skip_pipeline: options.delete(:skip_pipeline)) <add> src = options[:src] = path_to_image(source, skip_pipeline: skip_pipeline) <ide> <ide> unless src.start_with?("cid:") || src.start_with?("data:") || src.blank? <ide> options[:alt] = options.fetch(:alt) { image_alt(src) } <ide> end <ide> <add> if options[:srcset] && !options[:srcset].is_a?(String) <add> options[:srcset] = options[:srcset].map do |src, size| <add> src_path = path_to_image(src, skip_pipeline: skip_pipeline) <add> "#{src_path} #{size}" <add> end.join(", ") <add> end <add> <ide> options[:width], options[:height] = extract_dimensions(options.delete(:size)) if options[:size] <ide> tag("img", options) <ide> end <ide><path>actionview/test/template/asset_tag_helper_test.rb <ide> def url_for(*args) <ide> %(image_tag("mouse.png", :alt => nil)) => %(<img src="/images/mouse.png" />), <ide> %(image_tag("data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==", :alt => nil)) => %(<img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" />), <ide> %(image_tag("")) => %(<img src="" />), <del> %(image_tag("gold.png", data: { title: 'Rails Application' })) => %(<img data-title="Rails Application" src="/images/gold.png" alt="Gold" />) <add> %(image_tag("gold.png", data: { title: 'Rails Application' })) => %(<img data-title="Rails Application" src="/images/gold.png" alt="Gold" />), <add> %(image_tag("rss.gif", srcset: "/assets/pic_640.jpg 640w, /assets/pic_1024.jpg 1024w")) => %(<img srcset="/assets/pic_640.jpg 640w, /assets/pic_1024.jpg 1024w" src="/images/rss.gif" alt="Rss" />), <add> %(image_tag("rss.gif", srcset: { "pic_640.jpg" => "640w", "pic_1024.jpg" => "1024w" })) => %(<img srcset="/images/pic_640.jpg 640w, /images/pic_1024.jpg 1024w" src="/images/rss.gif" alt="Rss" />), <add> %(image_tag("rss.gif", srcset: [["pic_640.jpg", "640w"], ["pic_1024.jpg", "1024w"]])) => %(<img srcset="/images/pic_640.jpg 640w, /images/pic_1024.jpg 1024w" src="/images/rss.gif" alt="Rss" />) <ide> } <ide> <ide> FaviconLinkToTag = {
3
Python
Python
add test for urlquote_wrapper
8043ff3fefd1b59bb1d3c93595fdc10b7ae04abc
<ide><path>tests/test_templatetags.py <ide> from django.test import TestCase <ide> <ide> from rest_framework.relations import Hyperlink <add>from rest_framework.templatetags import rest_framework <ide> from rest_framework.templatetags.rest_framework import ( <ide> add_nested_class, add_query_param, as_string, break_long_headers, <ide> format_value, get_pagination_html, urlize_quoted_links <ide> def test_issue_1386(self): <ide> # example from issue #1386, this shouldn't raise an exception <ide> urlize_quoted_links("asdf:[/p]zxcv.com") <ide> <add> def test_smart_urlquote_wrapper_handles_value_error(self): <add> def mock_smart_urlquote(url): <add> raise ValueError <add> <add> old = rest_framework.smart_urlquote <add> rest_framework.smart_urlquote = mock_smart_urlquote <add> assert rest_framework.smart_urlquote_wrapper('test') is None <add> rest_framework.smart_urlquote = old <add> <ide> <ide> class URLizerTests(TestCase): <ide> """
1
Javascript
Javascript
change everything over to jasmine
0305b6746e2c50960b042c5d687794e030930f8b
<ide><path>src/Scope.js <ide> function createScope(parent, services, existing) { <ide> var watch = expressionCompile(watchExp), <ide> last; <ide> function watcher(){ <del> var value = watch.call(instance); <add> var value = watch.call(instance), <add> lastValue = last; <ide> if (last !== value) { <ide> last = value; <del> instance.$tryEval(listener, exceptionHandler, value, last); <add> instance.$tryEval(listener, exceptionHandler, value, lastValue); <ide> } <ide> } <ide> instance.$onEval(PRIORITY_WATCH, watcher); <ide><path>src/directives.js <ide> angularDirective("ng-bind", function(expression){ <ide> value = this.$tryEval(expression, function(e){ <ide> error = toJson(e); <ide> }), <del> isHtml = value instanceof HTML; <del> if (!isHtml && isObject(value)) { <add> isHtml = value instanceof HTML, <add> isDomElement = isElement(value); <add> if (!isHtml && !isDomElement && isObject(value)) { <ide> value = toJson(value); <ide> } <ide> if (value != lastValue || error != lastError) { <ide> angularDirective("ng-bind", function(expression){ <ide> if (error) value = error; <ide> if (isHtml) { <ide> element.html(value.html); <add> } else if (isDomElement) { <add> element.html(''); <add> element.append(value); <ide> } else { <ide> element.text(value); <ide> } <ide><path>test/directivesSpec.js <ide> describe("directives", function(){ <ide> expect(lowercase(element.html())).toEqual('<div>hello</div>'); <ide> }); <ide> <add> it('should ng-bind element', function() { <add> angularFilter.myElement = function() { <add> return jqLite('<a>hello</a>'); <add> }; <add> var scope = compile('<div ng-bind="0|myElement"></div>'); <add> scope.$eval(); <add> expect(lowercase(element.html())).toEqual('<a>hello</a>'); <add> }); <add> <ide> it('should ng-bind-template', function() { <ide> var scope = compile('<div ng-bind-template="Hello {{name}}!"></div>'); <ide> scope.$set('name', 'Misko');
3
Ruby
Ruby
adjust test value so that timezone has no effect
3f90787cd25a45a621fbb7238f69ee96f26e8f74
<ide><path>activerecord/test/cases/adapters/postgresql/timestamp_test.rb <ide> def test_postgres_agrees_with_activerecord_about_precision <ide> end <ide> <ide> def test_bc_timestamp <del> date = Date.new(0) - 1.second <add> date = Date.new(0) - 1.week <ide> Developer.create!(:name => "aaron", :updated_at => date) <ide> assert_equal date, Developer.find_by_name("aaron").updated_at <ide> end
1
Ruby
Ruby
remove obsolete text
b2b74260dbf7ea106e9b905fb68419dc17f3ab7a
<ide><path>Library/Homebrew/cmd/sh.rb <ide> def sh <ide> gem and pip will ignore our configuration and insist on using the <ide> environment they were built under (mostly). Sadly, scons will also <ide> ignore our configuration. <del> All toolchain use will be logged to: ~/Library/Homebrew/Logs/cc.log <ide> When done, type `exit'. <ide> EOS <ide> exec ENV['SHELL']
1
Python
Python
add test for chain-in-chain
7f48a6dd2a79dffa247892ef8c593ff7d24b22d3
<ide><path>t/integration/test_canvas.py <ide> def test_chord_in_chain_with_args(self, manager): <ide> res1 = c1.apply(args=(1,)) <ide> assert res1.get(timeout=TIMEOUT) == [1, 1] <ide> <add> @pytest.mark.xfail(reason="Issue #6200") <add> def test_chain_in_chain_with_args(self): <add> try: <add> manager.app.backend.ensure_chords_allowed() <add> except NotImplementedError as e: <add> raise pytest.skip(e.args[0]) <add> <add> c1 = chain( # NOTE: This chain should have only 1 chain inside it <add> chain( <add> identity.s(), <add> identity.s(), <add> ), <add> ) <add> <add> res1 = c1.apply_async(args=(1,)) <add> assert res1.get(timeout=TIMEOUT) == 1 <add> res1 = c1.apply(args=(1,)) <add> assert res1.get(timeout=TIMEOUT) == 1 <add> <ide> @flaky <ide> def test_large_header(self, manager): <ide> try:
1
Javascript
Javascript
remove createmutablesource from stable exports
1f3f6db73caf72a7d2287241212b7669d0c2dd2f
<ide><path>packages/react/index.stable.js <ide> export { <ide> createContext, <ide> createElement, <ide> createFactory, <del> createMutableSource as unstable_createMutableSource, <ide> createRef, <ide> forwardRef, <ide> isValidElement,
1
Text
Text
use release azure-core gem
d4f0b1031940b2cd7ceb9ab5a7665f44458917cb
<ide><path>activestorage/README.md <ide> Variation of image attachment: <ide> 1. Run `rails activestorage:install` to create needed directories, migrations, and configuration. <ide> 2. Optional: Add `gem "aws-sdk", "~> 2"` to your Gemfile if you want to use AWS S3. <ide> 3. Optional: Add `gem "google-cloud-storage", "~> 1.3"` to your Gemfile if you want to use Google Cloud Storage. <del>4. Optional: Add `gem "azure-core", git: "https://github.com/dixpac/azure-ruby-asm-core.git"` and `gem "azure-storage", require: false` to your Gemfile if you want to use Microsoft Azure. <add>4. Optional: Add `gem "azure-core"` and `gem "azure-storage", require: false` to your Gemfile if you want to use Microsoft Azure. <ide> 5. Optional: Add `gem "mini_magick"` to your Gemfile if you want to use variants. <ide> <ide> ## Direct uploads
1
Python
Python
optimize l2 regularizer
c38a617ec9f9321b097ddb1e6ba801eacc1b6e77
<ide><path>keras/regularizers.py <ide> def __call__(self, x): <ide> if self.l1: <ide> regularization += self.l1 * tf.reduce_sum(tf.abs(x)) <ide> if self.l2: <del> regularization += self.l2 * tf.reduce_sum(tf.square(x)) <add> regularization += 2.0 * self.l2 * tf.nn.l2_loss(x) <ide> return regularization <ide> <ide> def get_config(self): <ide> def __init__(self, l2=0.01, **kwargs): # pylint: disable=redefined-outer-name <ide> self.l2 = backend.cast_to_floatx(l2) <ide> <ide> def __call__(self, x): <del> return self.l2 * tf.reduce_sum(tf.square(x)) <add> return 2.0 * self.l2 * tf.nn.l2_loss(x) <ide> <ide> def get_config(self): <ide> return {'l2': float(self.l2)}
1
Mixed
Ruby
deliver parameterized mail with deliveryjob
60339da5bcb76489576321fa12e665f176d8d692
<ide><path>actionmailer/CHANGELOG.md <add>* Deliver parameterized mail with `ActionMailer::DeliveryJob` and remove `ActionMailer::Parameterized::DeliveryJob`. <add> <add> *Gannon McGibbon* <add> <ide> * Fix ActionMailer assertions not working when a Mail defines <ide> a custom delivery job class <ide> <ide> <ide> *Marcus Ilgner* <ide> <del>* Allow ActionMailer classes to configure the parameterized delivery job <del> Example: <del> ``` <del> class MyMailer < ApplicationMailer <del> self.parameterized_delivery_job = MyCustomDeliveryJob <del> ... <del> end <del> ``` <del> <del> *Luke Pearce* <del> <ide> * `ActionDispatch::IntegrationTest` includes `ActionMailer::TestHelper` module by default. <ide> <ide> *Ricardo Díaz* <ide><path>actionmailer/lib/action_mailer/base.rb <ide> def _protected_ivars # :nodoc: <ide> helper ActionMailer::MailHelper <ide> <ide> class_attribute :delivery_job, default: ::ActionMailer::DeliveryJob <del> class_attribute :parameterized_delivery_job, default: ::ActionMailer::Parameterized::DeliveryJob <ide> class_attribute :default_params, default: { <ide> mime_version: "1.0", <ide> charset: "UTF-8", <ide><path>actionmailer/lib/action_mailer/delivery_job.rb <ide> class DeliveryJob < ActiveJob::Base # :nodoc: <ide> <ide> rescue_from StandardError, with: :handle_exception_with_mailer_class <ide> <del> def perform(mailer, mail_method, delivery_method, *args) #:nodoc: <del> mailer.constantize.public_send(mail_method, *args).send(delivery_method) <add> def perform(mailer, mail_method, delivery_method, params, *args) #:nodoc: <add> mailer_class = params ? mailer.constantize.with(params) : mailer.constantize <add> mailer_class.public_send(mail_method, *args).send(delivery_method) <ide> end <ide> <ide> private <ide><path>actionmailer/lib/action_mailer/message_delivery.rb <ide> def enqueue_delivery(delivery_method, options = {}) <ide> "#deliver_later, 2. only touch the message *within your mailer " \ <ide> "method*, or 3. use a custom Active Job instead of #deliver_later." <ide> else <del> args = @mailer_class.name, @action.to_s, delivery_method.to_s, *@args <add> args = @mailer_class.name, @action.to_s, delivery_method.to_s, nil, *@args <ide> job = @mailer_class.delivery_job <ide> job.set(options).perform_later(*args) <ide> end <ide><path>actionmailer/lib/action_mailer/parameterized.rb <ide> def enqueue_delivery(delivery_method, options = {}) <ide> super <ide> else <ide> args = @mailer_class.name, @action.to_s, delivery_method.to_s, @params, *@args <del> job = @mailer_class.parameterized_delivery_job <add> job = @mailer_class.delivery_job <ide> job.set(options).perform_later(*args) <ide> end <ide> end <ide> end <del> <del> class DeliveryJob < ActionMailer::DeliveryJob # :nodoc: <del> def perform(mailer, mail_method, delivery_method, params, *args) <del> mailer.constantize.with(params).public_send(mail_method, *args).send(delivery_method) <del> end <del> end <ide> end <ide> end <ide><path>actionmailer/lib/action_mailer/test_helper.rb <ide> def assert_enqueued_emails(number, &block) <ide> # end <ide> # end <ide> def assert_enqueued_email_with(mailer, method, args: nil, queue: "mailers", &block) <del> if args.is_a? Hash <del> job = mailer.parameterized_delivery_job <del> args = [mailer.to_s, method.to_s, "deliver_now", args] <add> args = if args.is_a?(Hash) <add> [mailer.to_s, method.to_s, "deliver_now", args] <ide> else <del> job = mailer.delivery_job <del> args = [mailer.to_s, method.to_s, "deliver_now", *args] <add> [mailer.to_s, method.to_s, "deliver_now", nil, *args] <ide> end <del> <del> assert_enqueued_with(job: job, args: args, queue: queue, &block) <add> assert_enqueued_with(job: mailer.delivery_job, args: args, queue: queue, &block) <ide> end <ide> <ide> # Asserts that no emails are enqueued for later delivery. <ide> def assert_no_enqueued_emails(&block) <ide> def delivery_job_filter(job) <ide> job_class = job.is_a?(Hash) ? job.fetch(:job) : job.class <ide> <del> Base.descendants.map(&:delivery_job).include?(job_class) || <del> Base.descendants.map(&:parameterized_delivery_job).include?(job_class) <add> Base.descendants.map(&:delivery_job).include?(job_class) <ide> end <ide> end <ide> end <ide><path>actionmailer/test/message_delivery_test.rb <ide> def test_should_enqueue_and_run_correctly_in_activejob <ide> end <ide> <ide> test "should enqueue the email with :deliver_now delivery method" do <del> assert_performed_with(job: ActionMailer::DeliveryJob, args: ["DelayedMailer", "test_message", "deliver_now", 1, 2, 3]) do <add> assert_performed_with(job: ActionMailer::DeliveryJob, args: ["DelayedMailer", "test_message", "deliver_now", nil, 1, 2, 3]) do <ide> @mail.deliver_later <ide> end <ide> end <ide> <ide> test "should enqueue the email with :deliver_now! delivery method" do <del> assert_performed_with(job: ActionMailer::DeliveryJob, args: ["DelayedMailer", "test_message", "deliver_now!", 1, 2, 3]) do <add> assert_performed_with(job: ActionMailer::DeliveryJob, args: ["DelayedMailer", "test_message", "deliver_now!", nil, 1, 2, 3]) do <ide> @mail.deliver_later! <ide> end <ide> end <ide> <ide> test "should enqueue a delivery with a delay" do <ide> travel_to Time.new(2004, 11, 24, 01, 04, 44) do <del> assert_performed_with(job: ActionMailer::DeliveryJob, at: Time.current + 10.minutes, args: ["DelayedMailer", "test_message", "deliver_now", 1, 2, 3]) do <add> assert_performed_with(job: ActionMailer::DeliveryJob, at: Time.current + 10.minutes, args: ["DelayedMailer", "test_message", "deliver_now", nil, 1, 2, 3]) do <ide> @mail.deliver_later wait: 10.minutes <ide> end <ide> end <ide> end <ide> <ide> test "should enqueue a delivery at a specific time" do <ide> later_time = Time.current + 1.hour <del> assert_performed_with(job: ActionMailer::DeliveryJob, at: later_time, args: ["DelayedMailer", "test_message", "deliver_now", 1, 2, 3]) do <add> assert_performed_with(job: ActionMailer::DeliveryJob, at: later_time, args: ["DelayedMailer", "test_message", "deliver_now", nil, 1, 2, 3]) do <ide> @mail.deliver_later wait_until: later_time <ide> end <ide> end <ide> <ide> test "should enqueue the job on the correct queue" do <del> assert_performed_with(job: ActionMailer::DeliveryJob, args: ["DelayedMailer", "test_message", "deliver_now", 1, 2, 3], queue: "test_queue") do <add> assert_performed_with(job: ActionMailer::DeliveryJob, args: ["DelayedMailer", "test_message", "deliver_now", nil, 1, 2, 3], queue: "test_queue") do <ide> @mail.deliver_later <ide> end <ide> end <ide> def test_should_enqueue_and_run_correctly_in_activejob <ide> old_delivery_job = DelayedMailer.delivery_job <ide> DelayedMailer.delivery_job = DummyJob <ide> <del> assert_performed_with(job: DummyJob, args: ["DelayedMailer", "test_message", "deliver_now", 1, 2, 3]) do <add> assert_performed_with(job: DummyJob, args: ["DelayedMailer", "test_message", "deliver_now", nil, 1, 2, 3]) do <ide> @mail.deliver_later <ide> end <ide> <ide> def test_should_enqueue_and_run_correctly_in_activejob <ide> class DummyJob < ActionMailer::DeliveryJob; end <ide> <ide> test "can override the queue when enqueuing mail" do <del> assert_performed_with(job: ActionMailer::DeliveryJob, args: ["DelayedMailer", "test_message", "deliver_now", 1, 2, 3], queue: "another_queue") do <add> assert_performed_with(job: ActionMailer::DeliveryJob, args: ["DelayedMailer", "test_message", "deliver_now", nil, 1, 2, 3], queue: "another_queue") do <ide> @mail.deliver_later(queue: :another_queue) <ide> end <ide> end <ide><path>actionmailer/test/parameterized_test.rb <ide> class ParameterizedTest < ActiveSupport::TestCase <ide> include ActiveJob::TestHelper <ide> <add> class DummyDeliveryJob < ActionMailer::DeliveryJob <add> end <add> <ide> setup do <ide> @previous_logger = ActiveJob::Base.logger <ide> ActiveJob::Base.logger = Logger.new(nil) <ide> class ParameterizedTest < ActiveSupport::TestCase <ide> end <ide> <ide> test "enqueue the email with params" do <del> assert_performed_with(job: ActionMailer::Parameterized::DeliveryJob, args: ["ParamsMailer", "invitation", "deliver_now", { inviter: "david@basecamp.com", invitee: "jason@basecamp.com" } ]) do <add> args = [ <add> "ParamsMailer", <add> "invitation", <add> "deliver_now", <add> { inviter: "david@basecamp.com", invitee: "jason@basecamp.com" }, <add> ] <add> assert_performed_with(job: ActionMailer::DeliveryJob, args: args) do <ide> @mail.deliver_later <ide> end <ide> end <ide> class ParameterizedTest < ActiveSupport::TestCase <ide> end <ide> <ide> test "should enqueue a parameterized request with the correct delivery job" do <del> old_delivery_job = ParamsMailer.parameterized_delivery_job <del> ParamsMailer.parameterized_delivery_job = ParameterizedDummyJob <del> <del> assert_performed_with(job: ParameterizedDummyJob, args: ["ParamsMailer", "invitation", "deliver_now", { inviter: "david@basecamp.com", invitee: "jason@basecamp.com" } ]) do <del> @mail.deliver_later <add> args = [ <add> "ParamsMailer", <add> "invitation", <add> "deliver_now", <add> { inviter: "david@basecamp.com", invitee: "jason@basecamp.com" }, <add> ] <add> <add> with_delivery_job DummyDeliveryJob do <add> assert_performed_with(job: DummyDeliveryJob, args: args) do <add> @mail.deliver_later <add> end <ide> end <del> <del> ParamsMailer.parameterized_delivery_job = old_delivery_job <ide> end <ide> <del> class ParameterizedDummyJob < ActionMailer::Parameterized::DeliveryJob; end <add> private <add> <add> def with_delivery_job(job) <add> old_delivery_job = ParamsMailer.delivery_job <add> ParamsMailer.delivery_job = job <add> ensure <add> ParamsMailer.delivery_job = old_delivery_job <add> end <ide> end <ide><path>actionmailer/test/test_helper_test.rb <ide> def test_parameter_args <ide> class CustomDeliveryJob < ActionMailer::DeliveryJob <ide> end <ide> <del>class CustomParameterizedDeliveryJob < ActionMailer::Parameterized::DeliveryJob <del>end <del> <ide> class CustomDeliveryMailer < TestHelperMailer <ide> self.delivery_job = CustomDeliveryJob <del> self.parameterized_delivery_job = CustomParameterizedDeliveryJob <ide> end <ide> <ide> class TestHelperMailerTest < ActionMailer::TestCase
9
Javascript
Javascript
exclude tests from warning print script
6a48f32f2194423d905bd2e475e093638e12e299
<ide><path>scripts/print-warnings/print-warnings.js <ide> const through = require('through2'); <ide> const traverse = require('babel-traverse').default; <ide> const gs = require('glob-stream'); <ide> const Bundles = require('../rollup/bundles'); <add>const Modules = require('../rollup/modules'); <ide> <ide> const evalToString = require('../shared/evalToString'); <ide> <ide> const sourcePaths = Bundles.bundles <ide> bundle.bundleTypes.indexOf(Bundles.bundleTypes.FB_DEV) !== -1 || <ide> bundle.bundleTypes.indexOf(Bundles.bundleTypes.FB_PROD) !== -1 <ide> ) <del> .reduce((allPaths, bundle) => allPaths.concat(bundle.paths), []); <add> .reduce((allPaths, bundle) => allPaths.concat(bundle.paths), []) <add> .concat(Modules.getExcludedHasteGlobs().map(glob => `!${glob}`)); <ide> <ide> gs(sourcePaths).pipe( <ide> through.obj(transform, cb => { <ide><path>scripts/rollup/modules.js <ide> function getDefaultReplaceModules(bundleType) { <ide> ); <ide> } <ide> <add>function getExcludedHasteGlobs() { <add> return exclude; <add>} <add> <ide> module.exports = { <add> getExcludedHasteGlobs, <ide> getDefaultReplaceModules, <ide> getAliases, <ide> createModuleMap,
2
Text
Text
improve wording of test text
18ac05884058d034c8c07bf94ce4467e22cafe7d
<ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/use-rgb-values-to-color-elements.md <ide> Instead of using six hexadecimal digits like you do with hex code, with `RGB` yo <ide> <ide> If you do the math, the two digits for one color equal 16 times 16, which gives us 256 total values. So `RGB`, which starts counting from zero, has the exact same number of possible values as hex code. <ide> <del>Here's an example of how you'd change the body background to orange using its RGB code. <add>Here's an example of how you'd change the `body` background to orange using its RGB code. <ide> <ide> ```css <ide> body { <ide> Your `body` element should have a black background. <ide> assert($('body').css('background-color') === 'rgb(0, 0, 0)'); <ide> ``` <ide> <del>You should use `rgb` to give your `body` element a color of black. <add>You should use `rgb` to give your `body` element a background of black. <ide> <ide> ```js <ide> assert(code.match(/rgb\s*\(\s*0\s*,\s*0\s*,\s*0\s*\)/gi));
1
Python
Python
raise atol for mt5onnxconfig
9a9a525be8310a374b6543f7ddaa4c48c9893828
<ide><path>src/transformers/models/mt5/configuration_mt5.py <ide> def num_hidden_layers(self): <ide> return self.num_layers <ide> <ide> <del># Copied from transformers.models.t5.configuration_t5.T5OnnxConfig <ide> class MT5OnnxConfig(OnnxSeq2SeqConfigWithPast): <ide> @property <add> # Copied from transformers.models.t5.configuration_t5.T5OnnxConfig.inputs <ide> def inputs(self) -> Mapping[str, Mapping[int, str]]: <ide> common_inputs = { <ide> "input_ids": {0: "batch", 1: "encoder_sequence"}, <ide> def inputs(self) -> Mapping[str, Mapping[int, str]]: <ide> return common_inputs <ide> <ide> @property <add> # Copied from transformers.models.t5.configuration_t5.T5OnnxConfig.default_onnx_opset <ide> def default_onnx_opset(self) -> int: <ide> return 13 <add> <add> @property <add> def atol_for_validation(self) -> float: <add> return 5e-4
1
Text
Text
add ja translation with orginal script
87e8946694297c8751a3941160f513b1cb4227e2
<ide><path>threejs/lessons/ja/threejs-primitives.md <add>Title: Three.js のプリミティブ  <add>Description: three.js プリミティブの旅。 <add>TOC: プリミティブ <add> <add>This article is one in a series of articles about three.js. <add>The first article was [about fundamentals](threejs-fundamentals.html). <add>If you haven't read that yet you might want to start there. <add>この記事はthree.jsについてのシリーズ記事の一つです。 <add>最初の記事は[about fundamentals](threejs-fundamentals.html)です。 <add>もしまだ読まれていない場合は、そちらを先に始めるのが良いでしょう。 <add> <add>Three.js has a large number of primitives. Primitives <add>are generally 3D shapes that are generated at runtime <add>with a bunch of parameters. <add>Three.jsは多くのプリミティブがあります。 <add>プリミティブは、一般的に実行時にパラメータ群を指定して生成される、3D形状のことです。 <add> <add> <add>It's common to use primitives for things like a sphere <add>for a globe or a bunch of boxes to draw a 3D graph. It's <add>especially common to use primitives to experiment <add>and get started with 3D. For the majority of 3D apps <add>it's more common to have an artist make 3D models <add>in a 3D modeling program like [Blender](https://blender.org) <add>or [Maya](https://www.autodesk.com/products/maya/) or [Cinema 4D](https://www.maxon.net/en-us/products/cinema-4d/). Later in this series we'll <add>cover making and loading data from several 3D modeling <add>programs. For now let's go over some of the available <add>primitives. <add>地球儀の球体や、3Dグラフを描くための箱の集まりのようなものに、プリミティブを使うのは一般的です。 <add>実験したり3Dを始めたりするために、プリミティブを使うことは、とても普通です。 <add>3Dアプリケーションの多くは、3Dモデルを[Blender](https://blender.org)や <add>[Maya](https://www.autodesk.com/products/maya/)や <add>[Cinema 4D](https://www.maxon.net/en-us/products/cinema-4d/)といった <add>3Dモデリングプログラムでを使って、アーティストに作ってもらう方が一般的です。 <add>このシリーズの後半では、いくつかの3Dモデリングプログラムからデータを作って <add>読み込む方法にも言及するつもりです。 <add>では、利用できるプリミティブについて説明しましょう。 <add> <add> <add>Many of the primitives below have defaults for some or all of their <add>parameters so you can use more or less depending on your needs. <add>以下のプリミティブの多くは、一部または全てのパラメーターのデフォルト値があり、 <add>必要に応じて、多かれ少なかれ使うことができるでしょう。 <add> <add> <add><div id="Diagram-BoxBufferGeometry" data-primitive="BoxBufferGeometry">立方体</div> <add><div id="Diagram-CircleBufferGeometry" data-primitive="CircleBufferGeometry">2次元の円</div> <add><div id="Diagram-ConeBufferGeometry" data-primitive="ConeBufferGeometry">A Cone円錐</div> <add><div id="Diagram-CylinderBufferGeometry" data-primitive="CylinderBufferGeometry">A Cylinder円筒</div> <add><div id="Diagram-DodecahedronBufferGeometry" data-primitive="DodecahedronBufferGeometry">A dodecahedron (12 sides)十二面体(12面)</div> <add><div id="Diagram-ExtrudeBufferGeometry" data-primitive="ExtrudeBufferGeometry">An extruded 2d shape with optional bevelling. <add>Here we are extruding a heart shape. Note this is the basis <add>for <code>TextBufferGeometry</code> and <code>TextGeometry</code> respectively. <add>ベベルのオプション付きの、押し出された2次元形状。 <add>これは<code>TextBufferGeometry</code>と<code>TextGeometry</code>のそれぞれの基礎になることに注意してください。</div> <add><div id="Diagram-IcosahedronBufferGeometry" data-primitive="IcosahedronBufferGeometry">An icosahedron (20 sides)二十面体(20面)</div> <add><div id="Diagram-LatheBufferGeometry" data-primitive="LatheBufferGeometry">A shape generated by spinning a line. Examples would be: lamps, bowling pins, candles, candle holders, wine glasses, drinking glasses, etc... You provide the 2d silhouette as series of points and then tell three.js how many subdivisions to make as it spins the silhouette around an axis.ある軸の周りを回転してできた形状。例としてはこんなところでしょうか:ランプやボーリングのピン、ろうそく、ろうそく立て、ワイングラス、ドリンクグラス、などなど...。点の連続として2次元の輪郭を与え、その輪郭を軸の周りで回転させる際に、どのくらい細かくするかthree.jsに指示することができます。</div> <add><div id="Diagram-OctahedronBufferGeometry" data-primitive="OctahedronBufferGeometry">An Octahedron (8 sides)八面体(8面)</div> <add><div id="Diagram-ParametricBufferGeometry" data-primitive="ParametricBufferGeometry">A surface generated by providing a function that takes a 2D point from a grid and returns the corresponding 3d point.グリッドから2次元の点を取得し、対応する3次元の点を返す関数を作ることでできた表面。</div> <add><div id="Diagram-PlaneBufferGeometry" data-primitive="PlaneBufferGeometry">A 2D plane 2次元の四角形</div> <add><div id="Diagram-PolyhedronBufferGeometry" data-primitive="PolyhedronBufferGeometry">Takes a set of triangles centered around a point and projects them onto a sphereある点の周りに三角形の集まりを集めて球にする</div> <add><div id="Diagram-RingBufferGeometry" data-primitive="RingBufferGeometry">A 2D disc with a hole in the center 真ん中に穴のあいた円盤</div> <add><div id="Diagram-ShapeBufferGeometry" data-primitive="ShapeBufferGeometry">A 2D outline that gets triangulated 三角形分割された2次元の輪郭</div> <add><div id="Diagram-SphereBufferGeometry" data-primitive="SphereBufferGeometry">A sphere 球</div> <add><div id="Diagram-TetrahedronBufferGeometry" data-primitive="TetrahedronBufferGeometry">A tetrahedron (4 sides) 四面体(4面)</div> <add><div id="Diagram-TextBufferGeometry" data-primitive="TextBufferGeometry">3D text generated from a 3D font and a string 3Dフォントと文字による3Dテキスト</div> <add><div id="Diagram-TorusBufferGeometry" data-primitive="TorusBufferGeometry">A torus (donut) 円環(ドーナツ)</div> <add><div id="Diagram-TorusKnotBufferGeometry" data-primitive="TorusKnotBufferGeometry">A torus knot 円環(結び目)</div> <add><div id="Diagram-TubeBufferGeometry" data-primitive="TubeBufferGeometry">A circle traced down a path 経路をなぞった円</div> <add><div id="Diagram-EdgesGeometry" data-primitive="EdgesGeometry">A helper object that takes another geometry as input and generates edges only if the angle between faces is greater than some threshold. For example if you look at the box at the top it shows a line going through each face showing every triangle that makes the box. Using an <code>EdgesGeometry</code> instead the middle lines are removed. Adjust the thresholdAngle below and you'll see the edges below that threshold disappear.異なるジオメトリを入力として、その面同士の角度が閾値以上なら角を作り出した補助オブジェクト。例えば、記事の最初の方で紹介した立方体を見てみると、それぞれの面に、立方体を作っている全ての三角形の線が表示されています。<code>EdgesGeometry</code>を代わりに使うことで、面内の線はす全て除去されます。下記のthresholdAngleを調整してみてください。閾値以下の角が消えて見えるでしょう。</div> <add><div id="Diagram-WireframeGeometry" data-primitive="WireframeGeometry">Generates geometry that contains one line segment (2 points) per edge in the given geometry. Without this you'd often be missing edges or get extra edges since WebGL generally requires 2 points per line segment. For example if all you had was a single triangle there would only be 3 points. If you tried to draw it using a material with <code>wireframe: true</code> you would only get a single line. Passing that triangle geometry to a <code>WireframeGeometry</code> will generate a new geometry that has 3 lines segments using 6 points.. <add>1つの角ごとに1つの線分(2点)を持つジオメトリを生成する。WebGLは線分を作るのに2点が必要なので、この機能がないと、しばしば角を忘れたり、余分な角を作ってしまうでしょう。例えば、たった3点しかない1つの三角形あるとします。<code>wireframe: true</code>のマテリアルを使ってそれを描こうとした場合、1本の線分しか得られません。<code>WireframeGeometry</code>にその三角形のジオメトリを渡すと、6点からなる3つの線分を持った新しいジオメトリを生成します。</div> <add> <add>You might notice of most of them come in pairs of `Geometry` <add>or `BufferGeometry`. The difference between the 2 types is effectively flexibility <add>vs performance. <add>ほとんどのプリミティブは`Geometry`か`BufferGeometry`の2つがあることに気づいたかもしれません。 <add>この2つの違いは、効果的な柔軟性とパフォーマンスです。 <add> <add>`BufferGeometry` based primitives are the performance oriented <add>types. The vertices for the geometry are generated directly <add>into an efficient typed array format ready to be uploaded to the GPU <add>for rendering. This means they are faster to start up <add>and take less memory but if you want to modify their <add>data they take what is often considered more complex <add>programming to manipulate. <add>`BufferGeometry`に基づいた基本形状はパフォーマンス志向の種類です。 <add>形状の頂点は、レンダリングのためGPUにアップロードするのに適した配列形式に、直接生成されます。 <add>これは、起動が速く省メモリであることを意味しますが、データの修正により複雑なプログラミングが必要になることが多いです。 <add> <add>`Geometry` based primitives are the more flexible, easier to manipulate <add>type. They are built from JavaScript based classes like `Vector3` for <add>3D points, `Face3` for triangles. <add>They take quite a bit of memory and before they can be rendered three.js will need to <add>convert them to something similar to the corresponding `BufferGeometry` representation. <add>`Geometry`に基づいた基本形状はより柔軟で、操作しやすい種類です。 <add>これらは、3次元の点のための`Vector3`、三角形のための`Face3`のようなJavaScriptに基づくクラスからできています。結構メモリを必要としますし、three.jsにレンダリングされる前に、対応する`BufferGeometry`表現の類似物に変換する必要があります。 <add> <add>If you know you are not going to manipulate a primitive or <add>if you're comfortable doing the math to manipulate their <add>internals then it's best to go with the `BufferGeometry` <add>based primitives. If on the other hand you want to change <add>a few things before rendering you might find the `Geometry` <add>based primitives easier to deal with. <add>プリミティブを操作しないことが分かっているか、計算をして内部を操作することに抵抗がないなら、 <add>`BufferGeometry`に基づいたプリミティブを使うのがベストです。 <add>一方で、レンダリング前に少なからず変更を入れたいなら、`Geometry`に基づいたプリミティブを使うと、 <add>より簡単に扱うことができます。 <add> <add>As an simple example a `BufferGeometry` <add>can not have new vertices easily added. The number of vertices used is <add>decided at creation time, storage is created, and then data for vertices <add>are filled in. Whereas for `Geometry` you can add vertices as you go. <add>単純な例だと、`BufferGeometry`は新しい頂点群を簡単に追加できません。 <add>使う頂点の数は作成時に宣言され、記憶領域が確保され、頂点群に関するデータが書き込まれます。 <add>一方、`Geometry`は、あなたがしたいように頂点群を追加できます。 <add> <add>We'll go over creating custom geometry in [another article](threejs-custom-geometry.html). For now <add>let's make an example creating each type of primitive. We'll start <add>with the [examples from the previous article](threejs-responsive.html). <add>[another article](threejs-custom-geometry.html)にカスタムジオメトリの作成について説明します。 <add>今は、それぞれの種類のプリミティブを作成する例を作ってみましょう。 <add>[examples from the previous article](threejs-responsive.html)から始めます。 <add> <add>Near the top let's set a background color <add>最初の方で、背景色を指定しましょう。 <add> <add>```js <add>const scene = new THREE.Scene(); <add>+scene.background = new THREE.Color(0xAAAAAA); <add>``` <add> <add>This tells three.js to clear to lightish gray. <add>これでthree.jsに、透明からライトグレーに変えるように伝えます。 <add> <add>The camera needs to change position so that we can see all the <add>objects. <add>全てのオブジェクトを見られるよう、カメラも位置を変える必要があります。 <add> <add>```js <add>-const fov = 75; <add>+const fov = 40; <add>const aspect = 2; // the canvas default <add>const near = 0.1; <add>-const far = 5; <add>+const far = 1000; <add>const camera = new THREE.PerspectiveCamera(fov, aspect, near, far); <add>-camera.position.z = 2; <add>+camera.position.z = 120; <add>``` <add> <add>Let's add a function, `addObject`, that takes an x, y position and an `Object3D` and adds <add>the object to the scene. <add>`addObject`関数を加えましょう。これはx座標とy座標と`Object3D`を取り、sceneにオブジェクトを追加します。 <add> <add>```js <add>const objects = []; <add>const spread = 15; <add> <add>function addObject(x, y, obj) { <add> obj.position.x = x * spread; <add> obj.position.y = y * spread; <add> <add> scene.add(obj); <add> objects.push(obj); <add>} <add>``` <add> <add>Let's also make a function to create a random colored material. <add>We'll use a feature of `Color` that lets you set a color <add>based on hue, saturation, and luminance. <add>ランダムに色付けされたマテリアルを作る関数も作成してみましょう。 <add>色相、彩度、輝度に基づいて色を設定できる、`Color`の機能を使ってみます。 <add> <add>`hue` goes from 0 to 1 around the color wheel with <add>red at 0, green at .33 and blue at .66. `saturation` <add>goes from 0 to 1 with 0 having no color and 1 being <add>most saturated. `luminance` goes from 0 to 1 <add>with 0 being black, 1 being white and 0.5 being <add>the maximum amount of color. In other words <add>as `luminance` goes from 0.0 to 0.5 the color <add>will go from black to `hue`. From 0.5 to 1.0 <add>the color will go from `hue` to white. <add>`hue`は色相環を0から1まで変化します。赤は0、緑は.33、青は.66です。 <add>`saturation`は0から1まで変化します。0 は無色で、1は最も彩度の高いです。 <add>`luminance`は0から1まで変化します。0は黒、1は白、0.5が色の最大量になります。 <add>言い換えると、`luminance`が0.0から0.5に変化するにつれて、色は黒から`hue`に <add>変わります。0.5から1.0までは`hue`から白に変化します。 <add> <add>```js <add>function createMaterial() { <add> const material = new THREE.MeshPhongMaterial({ <add> side: THREE.DoubleSide, <add> }); <add> <add> const hue = Math.random(); <add> const saturation = 1; <add> const luminance = .5; <add> material.color.setHSL(hue, saturation, luminance); <add> <add> return material; <add>} <add>``` <add> <add>We also passed `side: THREE.DoubleSide` to the material. <add>This tells three to draw both sides of the triangles <add>that make up a shape. For a solid shape like a sphere <add>or a cube there's usually no reason to draw the <add>back sides of triangles as they all face inside the <add>shape. In our case though we are drawing a few things <add>like the `PlaneBufferGeometry` and the `ShapeBufferGeometry` <add>which are 2 dimensional and so have no inside. Without <add>setting `side: THREE.DoubleSide` they would disappear <add>when looking at their back sides. <add>私たちは`side: THREE.DoubleSide`もマテリアルに渡しました。 <add>これはthreeに形状を作るときに三角形の両面を描くように指示します。 <add>球体や立方体のような立体形状には、形状の内側を向いている裏側を描く <add>理由がないのです。 <add>しかしこの例では、2次元で裏側が存在しない`PlaneBufferGeometry`や`ShapeBufferGeometry`のような <add>ものを描こうとしています。 <add>`side: THREE.DoubleSide`を設定しないと、裏側を見たときに消滅してしまうでしょう。 <add> <add>I should note that it's faster to draw when **not** setting <add>`side: THREE.DoubleSide` so ideally we'd set it only on <add>the materials that really need it but in this case we <add>are not drawing too much so there isn't much reason to <add>worry about it. <add>`side: THREE.DoubleSide`に**not**が設定された方が、描画が速くなるため、 <add>理想的には本当に必要な時だけ設定するのが良いことを注記しておきます。 <add>しかし、この例だと、そんなにたくさん描画しないので、心配ありません。 <add> <add>Let's make a function, `addSolidGeometry`, that <add>we pass a geometry and it creates a random colored <add>material via `createMaterial` and adds it to the scene <add>via `addObject`. <add>ジオメトリを渡すと`createMaterial`によってランダムに色が付いたマテリアルを作り、 <add>`addObject`によってシーンに追加する`addSolidGeometry`関数を作りましょう。 <add> <add>```js <add>function addSolidGeometry(x, y, geometry) { <add> const mesh = new THREE.Mesh(geometry, createMaterial()); <add> addObject(x, y, mesh); <add>} <add>``` <add> <add>Now we can use this for the majority of the primitives we create. <add>For example creating a box <add>さて、私たちの作るプリミティブの大多数に、この関数が使用できます。 <add>例えば、立方体を作ってみます。 <add> <add>```js <add>{ <add> const width = 8; <add> const height = 8; <add> const depth = 8; <add> addSolidGeometry(-2, -2, new THREE.BoxBufferGeometry(width, height, depth)); <add>} <add>``` <add> <add>If you look in the code below you'll see a similar section for each type of geometry. <add>下記のコードを覗いてみると、それぞれの種類のジオメトリに対して、同じようなセクションがあります。 <add> <add>Here's the result: <add>結果はこのようになります: <add> <add>{{{example url="../threejs-primitives.html" }}} <add> <add>There are a couple of notable exceptions to the pattern above. <add>The biggest is probably the `TextBufferGeometry`. It needs to load <add>3D font data before it can generate a mesh for the text. <add>That data loads asynchronously so we need to wait for it <add>to load before trying to create the geometry. By promisifiying <add>font loading we can make it mush easier. <add>We create a `FontLoader` and then a function `loadFont` that returns <add>a promise that on resolve will give us the font. We then create <add>an `async` function called `doit` and load the font using `await`. <add>And finally create the geometry and call `addObject` to add it the scene. <add>上記のパターンには、2つの特筆すべき例外があります。 <add>最大のものは、おそらく`TextBufferGeometry`です。テキストのためのメッシュを作る前に、 <add>3Dフォントデータを読み込む必要があります。フォントの読み込みにpromiseを使えば、 <add>もっと速くすることができます。 <add>`FontLoader`を作ると、promiseを返す`loadFont`関数は解決時にフォントを提供してくれるでしょう。 <add>次に、`doit` と呼ばれる`async`関数を作り、`await`を使ってフォントを読み込みます。 <add>最後に、ジオメトリを作り、`addObject`を呼んでシーンに追加します。 <add> <add>```js <add>{ <add> const loader = new THREE.FontLoader(); <add> // promisify font loading <add> function loadFont(url) { <add> return new Promise((resolve, reject) => { <add> loader.load(url, resolve, undefined, reject); <add> }); <add> } <add> <add> async function doit() { <add> const font = await loadFont('resources/threejs/fonts/helvetiker_regular.typeface.json'); /* threejsfundamentals: url */ <add> const geometry = new THREE.TextBufferGeometry('three.js', { <add> font: font, <add> size: 3.0, <add> height: .2, <add> curveSegments: 12, <add> bevelEnabled: true, <add> bevelThickness: 0.15, <add> bevelSize: .3, <add> bevelSegments: 5, <add> }); <add> const mesh = new THREE.Mesh(geometry, createMaterial()); <add> geometry.computeBoundingBox(); <add> geometry.boundingBox.getCenter(mesh.position).multiplyScalar(-1); <add> <add> const parent = new THREE.Object3D(); <add> parent.add(mesh); <add> <add> addObject(-1, -1, parent); <add> } <add> doit(); <add>} <add>``` <add> <add>There's one other difference. We want to spin the text around its <add>center but by default three.js creates the text such that its center of rotation <add>is on the left edge. To work around this we can ask three.js to compute the bounding <add>box of the geometry. We can then call the `getCenter` method <add>of the bounding box and pass it our mesh's position object. <add>`getCenter` copies the center of the box into the position. <add>It also returns the position object so we can call `multiplyScalar(-1)` <add>to position the entire object such that its center of rotation <add>is at the center of the object. <add>もう一つ違いがあります。私たちはテキストをそれ自身の中心の周りで回転させたかったのですが、 <add>three.jsはデフォルトではテキストを左端を中心に回転するように作成します。 <add>これを回避するため、three.jsにジオメトリのバウンディングボックスの計算をさせることができます。 <add>そこで、バウンディングボックスの`getCenter`メソッドを呼んで、それをメッシュの位置オブジェクトに <add>渡すことができます。 <add>`getCenter`が箱の中心をその位置にコピーします。位置オブジェクトも返すので、 <add>`multiplyScalar(-1)`を呼んでオブジェクト全体を置くことができます。 <add>結果、回転の中心は物体の中心になります。 <add> <add>If we then just called `addSolidGeometry` like with previous <add>examples it would set the position again which is <add>no good. So, in this case we create an `Object3D` which <add>is the standard node for the three.js scene graph. `Mesh` <add>is inherited from `Object3D` as well. We'll cover [how the scene graph <add>works in another article](threejs-scenegraph.html). <add>For now it's enough to know that <add>like DOM nodes, children are drawn relative to their parent. <add>By making an `Object3D` and making our mesh a child of that <add>we can position the `Object3D` wherever we want and still <add>keep the center offset we set earlier. <add>これだと、もし先の例のように`addSolidGeometry`を呼ぶと、 <add>再び位置が設定されてしまいますが、それはよくありません。 <add>そのため、この例では、three.jsのシーングラフでは標準的なノードである <add>`Object3D`を作ります。`Mesh`は同様に`Object3D`を継承しています。 <add>[別の記事でどのようにシーングラフが働くか](threejs-scenegraph.html)扱います。 <add>とりあえず、DOMノードのように、子ノードは親ノードと関連して描かれるというように、 <add>知っていれば十分です。 <add>`Object3D`を作成し、メッシュをその子にすることで、どこにでも`Object3D`に配置し、 <add>先ほど設定した中心のオフセットを維持したままにできます。 <add> <add>If we didn't do this the text would spin off center. <add>こうしないと、テキストが中央からずれて回ってしまいます。 <add> <add>{{{example url="../threejs-primitives-text.html" }}} <add> <add>Notice the one on the left is not spinning around its center <add>whereas the one on the right is. <add>左側のものは自身の中心の周りを回転していませんが、右側のものはそうなっていることに <add>気づいてください。 <add> <add>The other exceptions are the 2 line based examples for `EdgesGeometry` <add>and `WireframeGeometry`. Instead of calling `addSolidGeometry` they call <add>`addLineGeometry` which looks like this <add>もう一つの例外は、`EdgesGeometry`と`WireframeGeometry`の、2つの直線に基づいた例です。 <add>`addSolidGeometry`を呼ぶ代わりに、このように`addLineGeometry`を呼んでいます。 <add> <add>```js <add>function addLineGeometry(x, y, geometry) { <add> const material = new THREE.LineBasicMaterial({color: 0x000000}); <add> const mesh = new THREE.LineSegments(geometry, material); <add> addObject(x, y, mesh); <add>} <add>``` <add> <add>It creates a black `LineBasicMaterial` and then creates a `LineSegments` <add>object which is a wrapper for `Mesh` that helps three know you're rendering <add>line segments (2 points per segment). <add>黒色の`LineBasicMaterial`を作り、次に`LineSegments`オブジェクトを作成します。 <add>これは`Mesh`のラッパーで、あなたが線分(線分あたり2点)をレンダリングしようとしていることを <add>threeが知る補助をします。 <add> <add>Each of the primitives has several parameters you can pass on creation <add>and it's best to [look in the documentation](https://threejs.org/docs/) for all of them rather than <add>repeat them here. You can also click the links above next to each shape <add>to take you directly to the docs for that shape. <add>プリミティブのそれぞれは、作成する際に渡すことができる複数のパラメーターを持っていて、 <add>ここで繰り返すよりも[このドキュメントを覗いてもらう](https://threejs.org/docs/)ことが一番良いです。 <add>また、各形状の横にある上記のリンクをクリックすると、その形状のドキュメントに直接案内されます。 <add> <add>There is one other pair of classes that doesn't really fit the patterns above. Those are <add>the `PointsMaterial` and the `Points` class. `Points` is like `LineSegments` above in that it takes a <add>a `Geometry` or `BufferGeometry` but draws points at each vertex instead of lines. <add>To use it you also need to pass it a `PointsMaterial` which <add>take a [`size`](PointsMaterial.size) for how large to make the points. <add> <add>上記のパターンに全然はまらない1組のクラスがほかにあります。 <add>それは`PointsMaterial`と`Points`クラスです。`Points`は`LineSegments`に似ていて、 <add>`Geometry`か`BufferGeometry`を引数に取ります。しかし、線の代わりに各頂点の点を描画します。 <add>使うためには、`PointsMaterial`も渡す必要があります。 <add>これは、点をどれくらい大きくするか決めるため[`size`](PointsMaterial.size) を取ります。 <add> <add>```js <add>const radius = 7; <add>const widthSegments = 12; <add>const heightSegments = 8; <add>const geometry = new THREE.SphereBufferGeometry(radius, widthSegments, heightSegments); <add>const material = new THREE.PointsMaterial({ <add> color: 'red', <add> size: 0.2, // in world units <add>}); <add>const points = new THREE.Points(geometry, material); <add>scene.add(points); <add>``` <add> <add><div class="spread"> <add><div data-diagram="Points"></div> <add></div> <add> <add>You can turn off [`sizeAttenuation`](PointsMaterial.sizeAttenuation) by setting it to false if you want the points to <add>be the same size regardless of their distance from the camera. <add>カメラからの距離に関わらず店の大きさを同じにしたいのであれば、 <add> [`sizeAttenuation`](PointsMaterial.sizeAttenuation) をfalseにすることで、止めることができます。 <add> <add>```js <add>const material = new THREE.PointsMaterial({ <add> color: 'red', <add>+ sizeAttenuation: false, <add>+ size: 3, // in pixels <add>- size: 0.2, // in world units <add>}); <add>... <add>``` <add> <add><div class="spread"> <add><div data-diagram="PointsUniformSize"></div> <add></div> <add> <add>One other thing that's important to cover is that almost all shapes <add>have various settings for how much to subdivide them. A good example <add>might be the sphere geometries. Spheres take parameters for <add>how many divisions to make around and how many top to bottom. For example <add>説明が必要なもう一つの大切なことは、ほとんど全部の形状が、 <add>どのくらい小分けにするか決める、様々な設定を持っていることです。 <add>球体のジオメトリが良い例かもしれません。 <add>球体は周囲と上下にどのくらい分割するかのパラメータがあります。 <add>例えば、 <add> <add><div class="spread"> <add><div data-diagram="SphereBufferGeometryLow"></div> <add><div data-diagram="SphereBufferGeometryMedium"></div> <add><div data-diagram="SphereBufferGeometryHigh"></div> <add></div> <add> <add>The first sphere has 5 segments around and 3 high which is 15 segments <add>or 30 triangles. The second sphere has 24 segments by 10. That's 240 segments <add>or 480 triangles. The last one has 50 by 50 which is 2500 segments or 5000 triangles. <add>最初の球体は、周囲に5セグメント、高さ3なので、15セグメントまたは30個の三角形です。。 <add>二つ目の球体は、周囲に24セグメント、高さが10です。240セグメントか480個の三角形です。 <add>最後の球体は、周囲に50セグメント、高さが50で、2500セグメントか5000個の三角形です。 <add> <add>It's up to you to decide how many subdivisions you need. It might <add>look like you need a high number of segments but remove the lines <add>and the flat shading and we get this <add>どのくらい分割が必要かは、あなたが決めることです。 <add>多くのセグメントが必要なように見えるかもしれませんが、線を除去して、 <add>影をならすことで、このようになります。 <add> <add><div class="spread"> <add><div data-diagram="SphereBufferGeometryLowSmooth"></div> <add><div data-diagram="SphereBufferGeometryMediumSmooth"></div> <add><div data-diagram="SphereBufferGeometryHighSmooth"></div> <add></div> <add> <add>It's now not so clear that the one on the right with 5000 triangles <add>is entirely better than the one in the middle with only 480. <add>If you're only drawing a few spheres, like say a single globe for <add>a map of the earth, then a single 10000 triangle sphere is not a bad <add>choice. If on the other hand you're trying to draw 1000 spheres <add>then 1000 spheres times 10000 triangles each is 10 million triangles. <add>To animate smoothly you need the browser to draw at 60 frames per <add>second so you'd be asking the browser to draw 600 million triangles <add>per second. That's a lot of computing. <add>5000個の三角形による右側の球体の方が、たった480の真ん中の球体よりも <add>全くもって良いかは、明らかではありません。 <add>地球の地図として一個の地球儀というように、もし、いくつかの球体を描くだけなら、 <add>10000個の三角形の球体でも悪い選択ではありません。 <add>一方で、1000個の球体を書こうとしているなら、1000個の球体におのおの10000個の三角形が <add>かかり、一千万個の三角形になります。 <add>滑らかに動かすにはブラウザが一秒間に60フレーム描画する必要があるため、 <add>ブラウザは1秒間に6億個の三角形を描画する必要があります。 <add>それは計算が多すぎます。 <add> <add>Sometimes it's easy to choose. For example you can also choose <add>to subdivide a plane. <add>選ぶのが簡単な時もあります。例えば、平面の細分化を選ぶこともできます。 <add> <add><div class="spread"> <add><div data-diagram="PlaneBufferGeometryLow"></div> <add><div data-diagram="PlaneBufferGeometryHigh"></div> <add></div> <add> <add>The plane on the left is 2 triangles. The plane on the right <add>is 200 triangles. Unlike the sphere there is really no trade off in quality for most <add>use cases of a plane. You'd most likely only subdivide a plane <add>if you expected to want to modify or warp it in some way. A box <add>is similar. <add>左側の四角形は2つの三角形から成ります。右側の四角形は200個の三角形から成ります。 <add>球体の時と異なり、四角形の場合だと、質的なトレードオフは全くありません。 <add>いくつかの用途で、大抵の場合、四角形を改造したり歪めたりしたいと思っている時に、 <add>四角形を細分化するだけで良いでしょう。 <add>立方体も同様です。 <add> <add>So, choose whatever is appropriate for your situation. The less <add>subdivisions you choose the more likely things will run smoothly and the less <add>memory they'll take. You'll have to decide for yourself what the correct <add>tradeoff is for your particular situation. <add>あなたの状況にふさわしいものを選びましょう。 <add>選んだ細分化が少ないほど、より滑らかに動いて、省メモリになることでしょう。 <add>あなたの特定の状況にふさわしい、正しいトレードオフは何か、決めなければいけません。 <add> <add>If none of the shapes above fit your use case you can load <add>geometry for example from a [.obj file](threejs-load-obj.html) <add>or a [.gltf file](threejs-load-gltf.html). <add>You can also create your own [custom Geometry](threejs-custom-geometry.html) <add>or [custom BufferGeometry](threejs-custom-buffergeometry.html). <add>あなたの用途に適した形状がないなら、例えば、[.obj file](threejs-load-obj.html) <add>や[.gltf file](threejs-load-gltf.html)からジオメトリを読み込むことができます。 <add>[カスタムジオメトリ](threejs-custom-geometry.html) <add>や[カスタムBufferGeometry](threejs-custom-buffergeometry.html)を作ることもできます。 <add> <add>Next up let's go over [how three's scene graph works and how <add>to use it](threejs-scenegraph.html). <add>次は、[threeのシーングラフの動き方と使い方](threejs-scenegraph.html)を説明します。 <add> <add><link rel="stylesheet" href="../resources/threejs-primitives.css"> <add><script type="module" src="../resources/threejs-primitives.js"></script> <add>
1
Ruby
Ruby
fix syntax error
84afbbbc037e7d55a6d6092c1f6d5516b8bb4e9d
<ide><path>actionpack/lib/action_view/helpers/benchmark_helper.rb <ide> def benchmark(message = "Benchmarking", &block) <ide> block.call <ide> end <ide> <del> @logger.info("#{message} (#{sprintf("%.5f", bm.real})") <add> @logger.info("#{message} (#{sprintf("%.5f", bm.real)})") <ide> end <ide> end <ide> end
1
Text
Text
update default spans_key to sc in api docs
0d0153db63442ef4523e7e33ac5c863172a61422
<ide><path>website/docs/api/spancategorizer.md <ide> architectures and their arguments and hyperparameters. <ide> | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | <ide> | `suggester` | A function that [suggests spans](#suggesters). Spans are returned as a ragged array with two integer columns, for the start and end positions. Defaults to [`ngram_suggester`](#ngram_suggester). ~~Callable[[Iterable[Doc], Optional[Ops]], Ragged]~~ | <ide> | `model` | A model instance that is given a a list of documents and `(start, end)` indices representing candidate span offsets. The model predicts a probability for each category for each span. Defaults to [SpanCategorizer](/api/architectures#SpanCategorizer). ~~Model[Tuple[List[Doc], Ragged], Floats2d]~~ | <del>| `spans_key` | Key of the [`Doc.spans`](/api/doc#spans) dict to save the spans under. During initialization and training, the component will look for spans on the reference document under the same key. Defaults to `"spans"`. ~~str~~ | <add>| `spans_key` | Key of the [`Doc.spans`](/api/doc#spans) dict to save the spans under. During initialization and training, the component will look for spans on the reference document under the same key. Defaults to `"sc"`. ~~str~~ | <ide> | `threshold` | Minimum probability to consider a prediction positive. Spans with a positive prediction will be saved on the Doc. Defaults to `0.5`. ~~float~~ | <ide> | `max_positive` | Maximum number of labels to consider positive per span. Defaults to `None`, indicating no limit. ~~Optional[int]~~ | <ide> | `scorer` | The scoring method. Defaults to [`Scorer.score_spans`](/api/scorer#score_spans) for `Doc.spans[spans_key]` with overlapping spans allowed. ~~Optional[Callable]~~ | <ide> shortcut for this and instantiate the component using its string name and <ide> | `suggester` | A function that [suggests spans](#suggesters). Spans are returned as a ragged array with two integer columns, for the start and end positions. ~~Callable[[Iterable[Doc], Optional[Ops]], Ragged]~~ | <ide> | `name` | String name of the component instance. Used to add entries to the `losses` during training. ~~str~~ | <ide> | _keyword-only_ | | <del>| `spans_key` | Key of the [`Doc.spans`](/api/doc#sans) dict to save the spans under. During initialization and training, the component will look for spans on the reference document under the same key. Defaults to `"spans"`. ~~str~~ | <add>| `spans_key` | Key of the [`Doc.spans`](/api/doc#sans) dict to save the spans under. During initialization and training, the component will look for spans on the reference document under the same key. Defaults to `"sc"`. ~~str~~ | <ide> | `threshold` | Minimum probability to consider a prediction positive. Spans with a positive prediction will be saved on the Doc. Defaults to `0.5`. ~~float~~ | <ide> | `max_positive` | Maximum number of labels to consider positive per span. Defaults to `None`, indicating no limit. ~~Optional[int]~~ | <ide>
1
Javascript
Javascript
add null prototype support for date
81b25eac21c15aa8fffda92f1501b9ffd593df5e
<ide><path>lib/internal/util/inspect.js <ide> function uncurryThis(func) { <ide> const propertyIsEnumerable = uncurryThis(Object.prototype.propertyIsEnumerable); <ide> const regExpToString = uncurryThis(RegExp.prototype.toString); <ide> const dateToISOString = uncurryThis(Date.prototype.toISOString); <add>const dateToString = uncurryThis(Date.prototype.toString); <ide> const errorToString = uncurryThis(Error.prototype.toString); <ide> <ide> const bigIntValueOf = uncurryThis(BigInt.prototype.valueOf); <ide> function formatRaw(ctx, value, recurseTimes, typedArray) { <ide> return ctx.stylize(base, 'regexp'); <ide> } else if (isDate(value)) { <ide> // Make dates with properties first say the date <add> base = Number.isNaN(dateGetTime(value)) ? <add> dateToString(value) : <add> dateToISOString(value); <add> const prefix = getPrefix(constructor, tag, 'Date'); <add> if (prefix !== 'Date ') <add> base = `${prefix}${base}`; <ide> if (keys.length === 0) { <del> if (Number.isNaN(dateGetTime(value))) <del> return ctx.stylize(String(value), 'date'); <del> return ctx.stylize(dateToISOString(value), 'date'); <add> return ctx.stylize(base, 'date'); <ide> } <del> base = dateToISOString(value); <ide> } else if (isError(value)) { <ide> // Make error with message first say the error. <ide> base = formatError(value); <ide><path>test/parallel/test-assert-deep.js <ide> assert.throws( <ide> { <ide> code: 'ERR_ASSERTION', <ide> message: `${defaultMsgStartFull}\n\n` + <del> '+ 2016-01-01T00:00:00.000Z\n- 2016-01-01T00:00:00.000Z {\n' + <del> "- '0': '1'\n- }" <add> '+ 2016-01-01T00:00:00.000Z\n- MyDate 2016-01-01T00:00:00.000Z' + <add> " {\n- '0': '1'\n- }" <ide> } <ide> ); <ide> assert.throws( <ide> () => assert.deepStrictEqual(date2, date), <ide> { <ide> code: 'ERR_ASSERTION', <ide> message: `${defaultMsgStartFull}\n\n` + <del> '+ 2016-01-01T00:00:00.000Z {\n' + <add> '+ MyDate 2016-01-01T00:00:00.000Z {\n' + <ide> "+ '0': '1'\n+ }\n- 2016-01-01T00:00:00.000Z" <ide> } <ide> ); <ide><path>test/parallel/test-util-inspect.js <ide> assert.strictEqual(util.inspect('"\'${a}'), "'\"\\'${a}'"); <ide> 'byteOffset: undefined,\n buffer: undefined }'], <ide> [new SharedArrayBuffer(2), '[SharedArrayBuffer: null prototype] ' + <ide> '{ [Uint8Contents]: <00 00>, byteLength: undefined }'], <del> [/foobar/, '[RegExp: null prototype] /foobar/'] <add> [/foobar/, '[RegExp: null prototype] /foobar/'], <add> [new Date('Sun, 14 Feb 2010 11:48:40 GMT'), <add> '[Date: null prototype] 2010-02-14T11:48:40.000Z'] <ide> ].forEach(([value, expected]) => { <ide> assert.strictEqual( <ide> util.inspect(Object.setPrototypeOf(value, null)), <ide> assert.strictEqual(util.inspect('"\'${a}'), "'\"\\'${a}'"); <ide> assert(/\[Symbol\(foo\)]: 'yeah'/.test(res), res); <ide> }); <ide> <add>// Date null prototype checks <add>{ <add> class CustomDate extends Date { <add> } <add> <add> const date = new CustomDate('Sun, 14 Feb 2010 11:48:40 GMT'); <add> assert.strictEqual(util.inspect(date), 'CustomDate 2010-02-14T11:48:40.000Z'); <add> <add> // add properties <add> date.foo = 'bar'; <add> assert.strictEqual(util.inspect(date), <add> '{ CustomDate 2010-02-14T11:48:40.000Z foo: \'bar\' }'); <add> <add> // check for null prototype <add> Object.setPrototypeOf(date, null); <add> assert.strictEqual(util.inspect(date), <add> '{ [Date: null prototype] 2010-02-14T11:48:40.000Z' + <add> ' foo: \'bar\' }'); <add> <add> const anotherDate = new CustomDate('Sun, 14 Feb 2010 11:48:40 GMT'); <add> Object.setPrototypeOf(anotherDate, null); <add> assert.strictEqual(util.inspect(anotherDate), <add> '[Date: null prototype] 2010-02-14T11:48:40.000Z'); <add>} <add> <add>// Check for invalid dates and null prototype <add>{ <add> class CustomDate extends Date { <add> } <add> <add> const date = new CustomDate('invalid_date'); <add> assert.strictEqual(util.inspect(date), 'CustomDate Invalid Date'); <add> <add> // add properties <add> date.foo = 'bar'; <add> assert.strictEqual(util.inspect(date), <add> '{ CustomDate Invalid Date foo: \'bar\' }'); <add> <add> // check for null prototype <add> Object.setPrototypeOf(date, null); <add> assert.strictEqual(util.inspect(date), <add> '{ [Date: null prototype] Invalid Date foo: \'bar\' }'); <add>} <add> <ide> assert.strictEqual(inspect(1n), '1n'); <ide> assert.strictEqual(inspect(Object(-1n)), '[BigInt: -1n]'); <ide> assert.strictEqual(inspect(Object(13n)), '[BigInt: 13n]');
3
Text
Text
add ryzokuken to collaborators
fb2d9df75718dd2707e68063e8d74783e7e19e12
<ide><path>README.md <ide> For more information about the governance of the Node.js project, see <ide> **Ingvar Stepanyan** &lt;me@rreverser.com&gt; <ide> * [rvagg](https://github.com/rvagg) - <ide> **Rod Vagg** &lt;rod@vagg.org&gt; <add>* [ryzokuken](https://github.com/ryzokuken) - <add>**Ujjwal Sharma** &lt;usharma1998@gmail.com&gt; (he/him) <ide> * [saghul](https://github.com/saghul) - <ide> **Saúl Ibarra Corretgé** &lt;saghul@gmail.com&gt; <ide> * [sam-github](https://github.com/sam-github) -
1
Ruby
Ruby
fix rubocop warnings
7e42c5d08003fd38addbcd84af17df84e14a69b2
<ide><path>Library/Homebrew/requirements/emacs_requirement.rb <ide> class EmacsRequirement < Requirement <ide> default_formula "emacs" <ide> <ide> def initialize(tags) <del> @version = tags.shift if /\d+\.*\d*/ === tags.first <add> @version = tags.shift if /\d+\.*\d*/ =~ tags.first <ide> super <ide> end <ide>
1
Ruby
Ruby
remove unused ignore_missing_templates option
3f8d3cd04ff0bd7cbf70c11d49a3dc009dfa98a0
<ide><path>actionpack/lib/action_controller/base.rb <ide> class Base <ide> # Can be set to nil for no logging. Compatible with both Ruby's own Logger and Log4r loggers. <ide> cattr_accessor :logger <ide> <del> # Turn on +ignore_missing_templates+ if you want to unit test actions without making the associated templates. <del> cattr_accessor :ignore_missing_templates <del> <ide> # Controls the resource action separator <ide> @@resource_action_separator = "/" <ide> cattr_accessor :resource_action_separator <ide> def add_instance_variables_to_assigns <ide> end <ide> <ide> def add_class_variables_to_assigns <del> %w(view_paths logger ignore_missing_templates).each do |cvar| <add> %w(view_paths logger).each do |cvar| <ide> @assigns[cvar] = self.send(cvar) <ide> end <ide> end <ide><path>actionpack/test/abstract_unit.rb <ide> ActiveSupport::Deprecation.debug = true <ide> <ide> ActionController::Base.logger = nil <del>ActionController::Base.ignore_missing_templates = false <ide> ActionController::Routing::Routes.reload rescue nil <ide> <ide>
2
PHP
PHP
fix typo in documentation
57e7877ba2d19e3df7e6973982fc6488f2da7a3d
<ide><path>src/View/Form/ArrayContext.php <ide> public function isCreate() <ide> * @param array $options Options: <ide> * - `default`: Default value to return if no value found in request <ide> * data or context record. <del> * - `schemaDefault`: Boolen indicating whether default value from <add> * - `schemaDefault`: Boolean indicating whether default value from <ide> * context's schema should be used if it's not explicitly provided. <ide> * @return mixed <ide> */
1
Javascript
Javascript
add flow types rntester examples
bd32234e6ec0006ede180d09b464f1277737e789
<ide><path>RNTester/js/ARTExample.js <ide> const {Surface, Path, Group, Shape} = ART; <ide> <ide> const scale = Platform.isTV ? 4 : 1; <ide> <del>class ARTExample extends React.Component<{}> { <add>type Props = $ReadOnly<{||}>; <add>class ARTExample extends React.Component<Props> { <ide> render() { <ide> const pathRect = new Path() <ide> .moveTo(scale * 0, scale * 0) <ide><path>RNTester/js/AccessibilityAndroidExample.android.js <ide> const importantForAccessibilityValues = [ <ide> ]; <ide> <ide> class AccessibilityAndroidExample extends React.Component { <del> static title = 'Accessibility'; <del> static description = 'Examples of using Accessibility API.'; <del> <ide> state = { <ide> count: 0, <ide> backgroundImportantForAcc: 0, <ide> const styles = StyleSheet.create({ <ide> }, <ide> }); <ide> <del>module.exports = AccessibilityAndroidExample; <add>exports.title = 'Accessibility'; <add>exports.description = 'Examples of using Accessibility API.'; <add>exports.examples = [ <add> { <add> title: 'Accessibility elements', <add> render(): React.Element<typeof AccessibilityAndroidExample> { <add> return <AccessibilityAndroidExample />; <add> }, <add> }, <add>]; <ide><path>RNTester/js/AccessibilityIOSExample.js <ide> const React = require('react'); <ide> const ReactNative = require('react-native'); <ide> const {AccessibilityInfo, Text, View, TouchableOpacity, Alert} = ReactNative; <ide> <del>class AccessibilityIOSExample extends React.Component<{}> { <add>type Props = $ReadOnly<{||}>; <add>class AccessibilityIOSExample extends React.Component<Props> { <ide> render() { <ide> return ( <ide> <View> <ide><path>RNTester/js/ActionSheetIOSExample.js <ide> const BUTTONS = ['Option 0', 'Option 1', 'Option 2', 'Delete', 'Cancel']; <ide> const DESTRUCTIVE_INDEX = 3; <ide> const CANCEL_INDEX = 4; <ide> <del>class ActionSheetExample extends React.Component<{}, $FlowFixMeState> { <add>type Props = $ReadOnly<{||}>; <add>type State = {|clicked: string|}; <add>class ActionSheetExample extends React.Component<Props, State> { <ide> state = { <ide> clicked: 'none', <ide> }; <ide><path>RNTester/js/ActivityIndicatorExample.js <ide> import React, {Component} from 'react'; <ide> import {ActivityIndicator, StyleSheet, View} from 'react-native'; <ide> <del>/** <del> * Optional Flowtype state and timer types definition <del> */ <del>type State = {animating: boolean}; <del>type Timer = number; <add>type State = {|animating: boolean|}; <add>type Props = $ReadOnly<{||}>; <add>type Timer = TimeoutID; <ide> <del>class ToggleAnimatingActivityIndicator extends Component< <del> $FlowFixMeProps, <del> State, <del>> { <add>class ToggleAnimatingActivityIndicator extends Component<Props, State> { <ide> _timer: Timer; <ide> <del> /* $FlowFixMe(>=0.85.0 site=react_native_fb) This comment suppresses an error <del> * found when Flow v0.85 was deployed. To see the error, delete this comment <del> * and run Flow. */ <del> constructor(props) { <add> constructor(props: Props) { <ide> super(props); <ide> this.state = { <ide> animating: true, <ide> class ToggleAnimatingActivityIndicator extends Component< <ide> } <ide> <ide> componentWillUnmount() { <del> /* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment suppresses an <del> * error found when Flow v0.63 was deployed. To see the error delete this <del> * comment and run Flow. */ <ide> clearTimeout(this._timer); <ide> } <ide> <ide> setToggleTimeout() { <del> /* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment suppresses an <del> * error found when Flow v0.63 was deployed. To see the error delete this <del> * comment and run Flow. */ <ide> this._timer = setTimeout(() => { <ide> this.setState({animating: !this.state.animating}); <ide> this.setToggleTimeout(); <ide> class ToggleAnimatingActivityIndicator extends Component< <ide> } <ide> } <ide> <add>const styles = StyleSheet.create({ <add> centering: { <add> alignItems: 'center', <add> justifyContent: 'center', <add> padding: 8, <add> }, <add> gray: { <add> backgroundColor: '#cccccc', <add> }, <add> horizontal: { <add> flexDirection: 'row', <add> justifyContent: 'space-around', <add> padding: 8, <add> }, <add>}); <add> <ide> exports.displayName = (undefined: ?string); <ide> exports.framework = 'React'; <ide> exports.title = '<ActivityIndicator>'; <ide> exports.examples = [ <ide> }, <ide> }, <ide> ]; <del> <del>const styles = StyleSheet.create({ <del> centering: { <del> alignItems: 'center', <del> justifyContent: 'center', <del> padding: 8, <del> }, <del> gray: { <del> backgroundColor: '#cccccc', <del> }, <del> horizontal: { <del> flexDirection: 'row', <del> justifyContent: 'space-around', <del> padding: 8, <del> }, <del>}); <ide><path>RNTester/js/AlertExample.js <ide> const alertMessage = <ide> /** <ide> * Simple alert examples. <ide> */ <del>class SimpleAlertExampleBlock extends React.Component { <add>type Props = $ReadOnly<{||}>; <add> <add>class SimpleAlertExampleBlock extends React.Component<Props> { <ide> render() { <ide> return ( <ide> <View> <ide><path>RNTester/js/AlertIOSExample.js <ide> const {StyleSheet, View, Text, TouchableHighlight, AlertIOS} = ReactNative; <ide> <ide> const {SimpleAlertExampleBlock} = require('./AlertExample'); <ide> <del>exports.framework = 'React'; <del>exports.title = 'AlertIOS'; <del>exports.description = 'iOS alerts and action sheets'; <del>exports.examples = [ <del> { <del> title: 'Alerts', <del> render() { <del> return <SimpleAlertExampleBlock />; <del> }, <del> }, <del> { <del> title: 'Prompt Options', <del> render(): React.Element<any> { <del> return <PromptOptions />; <del> }, <del> }, <del> { <del> title: 'Prompt Types', <del> render() { <del> return ( <del> <View> <del> <TouchableHighlight <del> style={styles.wrapper} <del> onPress={() => AlertIOS.prompt('Plain Text Entry')}> <del> <View style={styles.button}> <del> <Text>plain-text</Text> <del> </View> <del> </TouchableHighlight> <del> <TouchableHighlight <del> style={styles.wrapper} <del> onPress={() => <del> AlertIOS.prompt('Secure Text', null, null, 'secure-text') <del> }> <del> <View style={styles.button}> <del> <Text>secure-text</Text> <del> </View> <del> </TouchableHighlight> <del> <TouchableHighlight <del> style={styles.wrapper} <del> onPress={() => <del> AlertIOS.prompt('Login & Password', null, null, 'login-password') <del> }> <del> <View style={styles.button}> <del> <Text>login-password</Text> <del> </View> <del> </TouchableHighlight> <del> </View> <del> ); <del> }, <del> }, <del>]; <add>type Props = $ReadOnly<{||}>; <add>type State = {|promptValue: ?string|}; <ide> <del>class PromptOptions extends React.Component<$FlowFixMeProps, any> { <add>class PromptOptions extends React.Component<Props, State> { <ide> customButtons: Array<Object>; <ide> <ide> constructor(props) { <ide> const styles = StyleSheet.create({ <ide> fontWeight: 'bold', <ide> }, <ide> }); <add> <add>exports.framework = 'React'; <add>exports.title = 'AlertIOS'; <add>exports.description = 'iOS alerts and action sheets'; <add>exports.examples = [ <add> { <add> title: 'Alerts', <add> render() { <add> return <SimpleAlertExampleBlock />; <add> }, <add> }, <add> { <add> title: 'Prompt Options', <add> render(): React.Element<any> { <add> return <PromptOptions />; <add> }, <add> }, <add> { <add> title: 'Prompt Types', <add> render() { <add> return ( <add> <View> <add> <TouchableHighlight <add> style={styles.wrapper} <add> onPress={() => AlertIOS.prompt('Plain Text Entry')}> <add> <View style={styles.button}> <add> <Text>plain-text</Text> <add> </View> <add> </TouchableHighlight> <add> <TouchableHighlight <add> style={styles.wrapper} <add> onPress={() => <add> AlertIOS.prompt('Secure Text', null, null, 'secure-text') <add> }> <add> <View style={styles.button}> <add> <Text>secure-text</Text> <add> </View> <add> </TouchableHighlight> <add> <TouchableHighlight <add> style={styles.wrapper} <add> onPress={() => <add> AlertIOS.prompt('Login & Password', null, null, 'login-password') <add> }> <add> <View style={styles.button}> <add> <Text>login-password</Text> <add> </View> <add> </TouchableHighlight> <add> </View> <add> ); <add> }, <add> }, <add>]; <ide><path>RNTester/js/AnimatedExample.js <ide> const ReactNative = require('react-native'); <ide> const {Animated, Easing, StyleSheet, Text, View} = ReactNative; <ide> const RNTesterButton = require('./RNTesterButton'); <ide> <add>const styles = StyleSheet.create({ <add> content: { <add> backgroundColor: 'deepskyblue', <add> borderWidth: 1, <add> borderColor: 'dodgerblue', <add> padding: 20, <add> margin: 20, <add> borderRadius: 10, <add> alignItems: 'center', <add> }, <add> rotatingImage: { <add> width: 70, <add> height: 70, <add> }, <add>}); <add> <ide> exports.framework = 'React'; <ide> exports.title = 'Animated - Examples'; <ide> exports.description = <ide> exports.examples = [ <ide> ); <ide> } <ide> } <del> class FadeInExample extends React.Component<$FlowFixMeProps, any> { <del> /* $FlowFixMe(>=0.85.0 site=react_native_fb) This comment suppresses an <del> * error found when Flow v0.85 was deployed. To see the error, delete <del> * this comment and run Flow. */ <del> constructor(props) { <add> <add> type Props = $ReadOnly<{||}>; <add> type State = {|show: boolean|}; <add> class FadeInExample extends React.Component<Props, State> { <add> constructor(props: Props) { <ide> super(props); <ide> this.state = { <ide> show: true, <ide> exports.examples = [ <ide> render: () => <Text>Checkout the Gratuitous Animation App!</Text>, <ide> }, <ide> ]; <del> <del>const styles = StyleSheet.create({ <del> content: { <del> backgroundColor: 'deepskyblue', <del> borderWidth: 1, <del> borderColor: 'dodgerblue', <del> padding: 20, <del> margin: 20, <del> borderRadius: 10, <del> alignItems: 'center', <del> }, <del> rotatingImage: { <del> width: 70, <del> height: 70, <del> }, <del>}); <ide><path>RNTester/js/AnimatedGratuitousApp/AnExApp.js <ide> class Circle extends React.Component<any, any> { <ide> } <ide> <ide> class AnExApp extends React.Component<any, any> { <del> static title = 'Animated - Gratuitous App'; <del> static description = <del> 'Bunch of Animations - tap a circle to ' + <del> 'open a view with more animations, or longPress and drag to reorder circles.'; <del> <ide> _onMove: (position: Point) => void; <ide> constructor(props: any): void { <ide> super(props); <ide> const styles = StyleSheet.create({ <ide> }, <ide> }); <ide> <del>module.exports = AnExApp; <add>exports.title = 'Animated - Gratuitous App'; <add>exports.description = <add> 'Bunch of Animations - tap a circle to open a view with more animations, or longPress and drag to reorder circles.'; <add>exports.examples = [ <add> { <add> title: 'And example app', <add> render(): React.Element<typeof AnExApp> { <add> return <AnExApp />; <add> }, <add> }, <add>]; <ide><path>RNTester/js/CheckBoxExample.js <ide> const React = require('react'); <ide> const ReactNative = require('react-native'); <ide> const {CheckBox, Text, View, StyleSheet} = ReactNative; <ide> <del>class BasicCheckBoxExample extends React.Component<{}, $FlowFixMeState> { <add>type BasicState = {| <add> trueCheckBoxIsOn: boolean, <add> falseCheckBoxIsOn: boolean, <add>|}; <add> <add>type BasicProps = $ReadOnly<{||}>; <add>class BasicCheckBoxExample extends React.Component<BasicProps, BasicState> { <ide> state = { <ide> trueCheckBoxIsOn: true, <ide> falseCheckBoxIsOn: false, <ide> class BasicCheckBoxExample extends React.Component<{}, $FlowFixMeState> { <ide> } <ide> } <ide> <del>class DisabledCheckBoxExample extends React.Component<{}, $FlowFixMeState> { <add>type DisabledProps = $ReadOnly<{||}>; <add>class DisabledCheckBoxExample extends React.Component<DisabledProps> { <ide> render() { <ide> return ( <ide> <View> <ide> class DisabledCheckBoxExample extends React.Component<{}, $FlowFixMeState> { <ide> } <ide> } <ide> <del>class EventCheckBoxExample extends React.Component<{}, $FlowFixMeState> { <add>type EventProps = $ReadOnly<{||}>; <add>type EventState = {| <add> eventCheckBoxIsOn: boolean, <add> eventCheckBoxRegressionIsOn: boolean, <add>|}; <add> <add>class EventCheckBoxExample extends React.Component<EventProps, EventState> { <ide> state = { <ide> eventCheckBoxIsOn: false, <ide> eventCheckBoxRegressionIsOn: true, <ide> class EventCheckBoxExample extends React.Component<{}, $FlowFixMeState> { <ide> } <ide> } <ide> <del>let examples = [ <add>const styles = StyleSheet.create({ <add> container: { <add> flexDirection: 'row', <add> justifyContent: 'space-around', <add> }, <add> checkbox: { <add> marginBottom: 10, <add> }, <add>}); <add> <add>exports.title = '<CheckBox>'; <add>exports.displayName = 'CheckBoxExample'; <add>exports.description = 'Native boolean input'; <add>exports.examples = [ <ide> { <ide> title: 'CheckBoxes can be set to true or false', <ide> render(): React.Element<any> { <ide> let examples = [ <ide> }, <ide> }, <ide> ]; <del> <del>exports.title = '<CheckBox>'; <del>exports.displayName = 'CheckBoxExample'; <del>exports.description = 'Native boolean input'; <del>exports.examples = examples; <del> <del>const styles = StyleSheet.create({ <del> container: { <del> flexDirection: 'row', <del> justifyContent: 'space-around', <del> }, <del> checkbox: { <del> marginBottom: 10, <del> }, <del>}); <ide><path>RNTester/js/ClipboardExample.js <ide> const React = require('react'); <ide> const ReactNative = require('react-native'); <ide> const {Clipboard, View, Text, StyleSheet} = ReactNative; <ide> <del>class ClipboardExample extends React.Component<{}, $FlowFixMeState> { <add>type Props = $ReadOnly<{||}>; <add>type State = {| <add> content: string, <add>|}; <add> <add>class ClipboardExample extends React.Component<Props, State> { <ide> state = { <ide> content: 'Content will appear here', <ide> }; <ide> class ClipboardExample extends React.Component<{}, $FlowFixMeState> { <ide> } <ide> } <ide> <add>const styles = StyleSheet.create({ <add> label: { <add> color: 'blue', <add> }, <add> content: { <add> color: 'red', <add> marginTop: 20, <add> }, <add>}); <add> <ide> exports.title = 'Clipboard'; <ide> exports.description = 'Show Clipboard contents.'; <ide> exports.examples = [ <ide> exports.examples = [ <ide> }, <ide> }, <ide> ]; <del> <del>const styles = StyleSheet.create({ <del> label: { <del> color: 'blue', <del> }, <del> content: { <del> color: 'red', <del> marginTop: 20, <del> }, <del>}); <ide><path>RNTester/js/DatePickerAndroidExample.js <ide> const { <ide> const RNTesterBlock = require('./RNTesterBlock'); <ide> const RNTesterPage = require('./RNTesterPage'); <ide> <del>class DatePickerAndroidExample extends React.Component { <del> static title = 'DatePickerAndroid'; <del> static description = 'Standard Android date picker dialog'; <add>type Props = $ReadOnly<{||}>; <add>type State = {| <add> presetDate: Date, <add> simpleDate: Date, <add> spinnerDate: Date, <add> calendarDate: Date, <add> defaultDate: Date, <add> allDate: Date, <add> simpleText: string, <add> spinnerText: string, <add> calendarText: string, <add> defaultText: string, <add> minText: string, <add> maxText: string, <add> presetText: string, <add> allText: string, <add>|}; <ide> <add>class DatePickerAndroidExample extends React.Component<Props, State> { <ide> state = { <ide> presetDate: new Date(2020, 4, 5), <ide> simpleDate: new Date(2020, 4, 5), <ide> const styles = StyleSheet.create({ <ide> }, <ide> }); <ide> <del>module.exports = DatePickerAndroidExample; <add>exports.title = 'DatePickerAndroid'; <add>exports.description = 'Standard Android date picker dialog'; <add>exports.examples = [ <add> { <add> title: 'Simple date picker', <add> render: function(): React.Element<typeof DatePickerAndroidExample> { <add> return <DatePickerAndroidExample />; <add> }, <add> }, <add>]; <ide><path>RNTester/js/ExampleTypes.js <del>/** <del> * Copyright (c) Facebook, Inc. and its affiliates. <del> * <del> * This source code is licensed under the MIT license found in the <del> * LICENSE file in the root directory of this source tree. <del> * <del> * @format <del> * @flow <del> */ <del> <del>'use strict'; <del> <del>import type React from 'react'; <del> <del>export type Example = { <del> title: string, <del> /* $FlowFixMe(>=0.89.0 site=react_native_fb) This comment suppresses an error <del> * found when Flow v0.89 was deployed. To see the error, delete this comment <del> * and run Flow. */ <del> render: () => ?React.Element<any>, <del> description?: string, <del> platform?: string, <del>}; <del> <del>export type ExampleModule = { <del> title: string, <del> description: string, <del> examples: Array<Example>, <del>}; <ide><path>RNTester/js/FlatListExample.js <ide> <ide> 'use strict'; <ide> <add>import type {Item} from './ListExampleShared'; <add> <ide> const Alert = require('Alert'); <ide> const React = require('react'); <ide> const ReactNative = require('react-native'); <ide> const VIEWABILITY_CONFIG = { <ide> waitForInteraction: true, <ide> }; <ide> <del>class FlatListExample extends React.PureComponent<{}, $FlowFixMeState> { <del> static title = '<FlatList>'; <del> static description = 'Performant, scrollable list of data.'; <add>type Props = $ReadOnly<{||}>; <add>type State = {| <add> data: Array<Item>, <add> debug: boolean, <add> horizontal: boolean, <add> inverted: boolean, <add> filterText: string, <add> fixedHeight: boolean, <add> logViewable: boolean, <add> virtualized: boolean, <add> empty: boolean, <add>|}; <ide> <add>class FlatListExample extends React.PureComponent<Props, State> { <ide> state = { <ide> data: genItemData(100), <ide> debug: false, <ide> const styles = StyleSheet.create({ <ide> }, <ide> }); <ide> <del>module.exports = FlatListExample; <add>exports.title = '<FlatList>'; <add>exports.description = 'Performant, scrollable list of data.'; <add>exports.examples = [ <add> { <add> title: 'Simple list of items', <add> render: function(): React.Element<typeof FlatListExample> { <add> return <FlatListExample />; <add> }, <add> }, <add>]; <ide><path>RNTester/js/GeolocationExample.js <ide> const React = require('react'); <ide> const ReactNative = require('react-native'); <ide> const {StyleSheet, Text, View, Alert} = ReactNative; <ide> <del>exports.framework = 'React'; <del>exports.title = 'Geolocation'; <del>exports.description = 'Examples of using the Geolocation API.'; <del> <del>exports.examples = [ <del> { <del> title: 'navigator.geolocation', <del> render: function(): React.Element<any> { <del> return <GeolocationExample />; <del> }, <del> }, <del>]; <del> <ide> class GeolocationExample extends React.Component<{}, $FlowFixMeState> { <ide> state = { <ide> initialPosition: 'unknown', <ide> const styles = StyleSheet.create({ <ide> fontWeight: '500', <ide> }, <ide> }); <add> <add>exports.framework = 'React'; <add>exports.title = 'Geolocation'; <add>exports.description = 'Examples of using the Geolocation API.'; <add> <add>exports.examples = [ <add> { <add> title: 'navigator.geolocation', <add> render: function(): React.Element<any> { <add> return <GeolocationExample />; <add> }, <add> }, <add>]; <ide><path>RNTester/js/ImageCapInsetsExample.js <ide> const ReactNative = require('react-native'); <ide> const nativeImageSource = require('nativeImageSource'); <ide> const {Image, StyleSheet, Text, View} = ReactNative; <ide> <del>class ImageCapInsetsExample extends React.Component<{}> { <add>type Props = $ReadOnly<{||}>; <add>class ImageCapInsetsExample extends React.Component<Props> { <ide> render() { <ide> return ( <ide> <View> <ide><path>RNTester/js/ImageEditingExample.js <ide> class ImageCropper extends React.Component<$FlowFixMeProps, $FlowFixMeState> { <ide> } <ide> } <ide> <del>exports.framework = 'React'; <del>exports.title = 'ImageEditor'; <del>exports.description = 'Cropping and scaling with ImageEditor'; <del>exports.examples = [ <del> { <del> title: 'Image Cropping', <del> render() { <del> return <SquareImageCropper />; <del> }, <del> }, <del>]; <del> <ide> const styles = StyleSheet.create({ <ide> container: { <ide> flex: 1, <ide> const styles = StyleSheet.create({ <ide> fontWeight: '500', <ide> }, <ide> }); <add> <add>exports.framework = 'React'; <add>exports.title = 'ImageEditor'; <add>exports.description = 'Cropping and scaling with ImageEditor'; <add>exports.examples = [ <add> { <add> title: 'Image Cropping', <add> render() { <add> return <SquareImageCropper />; <add> }, <add> }, <add>]; <ide><path>RNTester/js/ImageExample.js <ide> class MultipleSourcesExample extends React.Component< <ide> } <ide> } <ide> <add>const fullImage = { <add> uri: 'https://facebook.github.io/react-native/img/opengraph.png', <add>}; <add>const smallImage = { <add> uri: 'https://facebook.github.io/react-native/img/favicon.png', <add>}; <add> <add>const styles = StyleSheet.create({ <add> base: { <add> width: 38, <add> height: 38, <add> }, <add> progress: { <add> flex: 1, <add> alignItems: 'center', <add> flexDirection: 'row', <add> width: 100, <add> }, <add> leftMargin: { <add> marginLeft: 10, <add> }, <add> background: { <add> backgroundColor: '#222222', <add> }, <add> sectionText: { <add> marginVertical: 6, <add> }, <add> nestedText: { <add> marginLeft: 12, <add> marginTop: 20, <add> backgroundColor: 'transparent', <add> color: 'white', <add> }, <add> resizeMode: { <add> width: 90, <add> height: 60, <add> borderWidth: 0.5, <add> borderColor: 'black', <add> }, <add> resizeModeText: { <add> fontSize: 11, <add> marginBottom: 3, <add> }, <add> icon: { <add> width: 15, <add> height: 15, <add> }, <add> horizontal: { <add> flexDirection: 'row', <add> }, <add> gif: { <add> flex: 1, <add> height: 200, <add> }, <add> base64: { <add> flex: 1, <add> height: 50, <add> resizeMode: 'contain', <add> }, <add> touchableText: { <add> fontWeight: '500', <add> color: 'blue', <add> }, <add>}); <add> <ide> exports.displayName = (undefined: ?string); <ide> exports.framework = 'React'; <ide> exports.title = '<Image>'; <ide> exports.examples = [ <ide> }, <ide> }, <ide> ]; <del> <del>const fullImage = { <del> uri: 'https://facebook.github.io/react-native/img/opengraph.png', <del>}; <del>const smallImage = { <del> uri: 'https://facebook.github.io/react-native/img/favicon.png', <del>}; <del> <del>const styles = StyleSheet.create({ <del> base: { <del> width: 38, <del> height: 38, <del> }, <del> progress: { <del> flex: 1, <del> alignItems: 'center', <del> flexDirection: 'row', <del> width: 100, <del> }, <del> leftMargin: { <del> marginLeft: 10, <del> }, <del> background: { <del> backgroundColor: '#222222', <del> }, <del> sectionText: { <del> marginVertical: 6, <del> }, <del> nestedText: { <del> marginLeft: 12, <del> marginTop: 20, <del> backgroundColor: 'transparent', <del> color: 'white', <del> }, <del> resizeMode: { <del> width: 90, <del> height: 60, <del> borderWidth: 0.5, <del> borderColor: 'black', <del> }, <del> resizeModeText: { <del> fontSize: 11, <del> marginBottom: 3, <del> }, <del> icon: { <del> width: 15, <del> height: 15, <del> }, <del> horizontal: { <del> flexDirection: 'row', <del> }, <del> gif: { <del> flex: 1, <del> height: 200, <del> }, <del> base64: { <del> flex: 1, <del> height: 50, <del> resizeMode: 'contain', <del> }, <del> touchableText: { <del> fontWeight: '500', <del> color: 'blue', <del> }, <del>}); <ide><path>RNTester/js/InputAccessoryViewExample.js <ide> const { <ide> View, <ide> } = ReactNative; <ide> <del>class Message extends React.PureComponent<*> { <add>type MessageProps = $ReadOnly<{||}>; <add>class Message extends React.PureComponent<MessageProps> { <ide> render() { <ide> return ( <ide> <View style={styles.textBubbleBackground}> <ide> class Message extends React.PureComponent<*> { <ide> } <ide> } <ide> <del>class TextInputBar extends React.PureComponent<*, *> { <add>type TextInputProps = $ReadOnly<{||}>; <add>type TextInputState = {|text: string|}; <add>class TextInputBar extends React.PureComponent<TextInputProps, TextInputState> { <ide> state = {text: ''}; <ide> <ide> render() { <ide> class TextInputBar extends React.PureComponent<*, *> { <ide> } <ide> <ide> const BAR_HEIGHT = 44; <del> <del>class InputAccessoryViewExample extends React.Component<*> { <del> static title = '<InputAccessoryView>'; <del> static description = <del> 'Example showing how to use an InputAccessoryView to build an iMessage-like sticky text input'; <del> <add>type InputAccessoryProps = $ReadOnly<{||}>; <add>class InputAccessoryViewExample extends React.Component<InputAccessoryProps> { <ide> render() { <ide> return ( <ide> <> <ide> const styles = StyleSheet.create({ <ide> }, <ide> }); <ide> <del>module.exports = InputAccessoryViewExample; <add>exports.title = '<InputAccessoryView>'; <add>exports.description = <add> 'Example showing how to use an InputAccessoryView to build an iMessage-like sticky text input'; <add>exports.examples = [ <add> { <add> title: 'Simple view with sticky input', <add> render: function(): React.Node { <add> return <InputAccessoryViewExample />; <add> }, <add> }, <add>]; <ide><path>RNTester/js/KeyboardAvoidingViewExample.js <ide> const { <ide> const RNTesterBlock = require('./RNTesterBlock'); <ide> const RNTesterPage = require('./RNTesterPage'); <ide> <del>class KeyboardAvoidingViewExample extends React.Component { <del> static title = '<KeyboardAvoidingView>'; <del> static description = <del> 'Base component for views that automatically adjust their height or position to move out of the way of the keyboard.'; <add>type Props = $ReadOnly<{||}>; <add>type State = {| <add> behavior: string, <add> modalOpen: boolean, <add>|}; <ide> <add>class KeyboardAvoidingViewExample extends React.Component<Props, State> { <ide> state = { <ide> behavior: 'padding', <ide> modalOpen: false, <ide> const styles = StyleSheet.create({ <ide> }, <ide> }); <ide> <del>module.exports = KeyboardAvoidingViewExample; <add>exports.title = '<KeyboardAvoidingView>'; <add>exports.description = <add> 'Base component for views that automatically adjust their height or position to move out of the way of the keyboard.'; <add>exports.examples = [ <add> { <add> title: 'Simple keyboard view', <add> render: function(): React.Element<typeof KeyboardAvoidingViewExample> { <add> return <KeyboardAvoidingViewExample />; <add> }, <add> }, <add>]; <ide><path>RNTester/js/LayoutEventsExample.js <ide> const {Image, LayoutAnimation, StyleSheet, Text, View} = ReactNative; <ide> <ide> import type {ViewLayout, ViewLayoutEvent} from 'ViewPropTypes'; <ide> <add>type Props = $ReadOnly<{||}>; <ide> type State = { <ide> containerStyle?: {|width: number|}, <ide> extraText?: string, <ide> type State = { <ide> viewStyle: {|margin: number|}, <ide> }; <ide> <del>class LayoutEventExample extends React.Component<{}, State> { <add>class LayoutEventExample extends React.Component<Props, State> { <ide> state: State = { <ide> viewStyle: { <ide> margin: 20, <ide><path>RNTester/js/LayoutExample.js <ide> class CircleBlock extends React.Component<$FlowFixMeProps> { <ide> } <ide> <ide> class LayoutExample extends React.Component<$FlowFixMeProps> { <del> static title = 'Layout - Flexbox'; <del> static description = 'Examples of using the flexbox API to layout views.'; <del> static displayName = 'LayoutExample'; <del> <ide> render() { <ide> const fiveColoredCircles = [ <ide> <Circle bgColor="#527fe4" key="blue" />, <ide> const styles = StyleSheet.create({ <ide> }, <ide> }); <ide> <del>module.exports = LayoutExample; <add>exports.title = 'Layout - Flexbox'; <add>exports.description = 'Examples of using the flexbox API to layout views.'; <add>exports.displayName = 'LayoutExample'; <add>exports.examples = [ <add> { <add> title: 'Simple layout using flexbox', <add> render: function(): React.Element<typeof LayoutExample> { <add> return <LayoutExample />; <add> }, <add> }, <add>]; <ide><path>RNTester/js/LinkingExample.js <ide> class SendIntentButton extends React.Component<Props> { <ide> } <ide> <ide> class IntentAndroidExample extends React.Component { <del> static title = 'Linking'; <del> static description = 'Shows how to use Linking to open URLs.'; <del> <ide> render() { <ide> return ( <ide> <View> <ide> const styles = StyleSheet.create({ <ide> }, <ide> }); <ide> <del>module.exports = IntentAndroidExample; <add>exports.title = 'Linking'; <add>exports.description = 'Shows how to use Linking to open URLs.'; <add>exports.examples = [ <add> { <add> title: 'Simple list of items', <add> render: function(): React.Element<typeof IntentAndroidExample> { <add> return <IntentAndroidExample />; <add> }, <add> }, <add>]; <ide><path>RNTester/js/ListExampleShared.js <ide> const { <ide> View, <ide> } = ReactNative; <ide> <del>type Item = { <add>export type Item = { <ide> title: string, <ide> text: string, <ide> key: string, <ide><path>RNTester/js/ListViewExample.js <ide> type State = {| <ide> dataSource: ListViewDataSource, <ide> |}; <ide> <del>class ListViewSimpleExample extends React.Component<RNTesterProps, State> { <del> static title = '<ListView>'; <del> static description = 'Performant, scrollable list of data.'; <del> <add>class ListViewExample extends React.Component<RNTesterProps, State> { <ide> state = { <ide> dataSource: this.getInitialDataSource(), <ide> }; <ide> const styles = StyleSheet.create({ <ide> }, <ide> }); <ide> <del>module.exports = ListViewSimpleExample; <add>exports.title = '<ListView>'; <add>exports.description = 'Performant, scrollable list of data.'; <add>exports.examples = [ <add> { <add> title: 'Simple list of items', <add> render: function(): React.Element<typeof ListViewExample> { <add> return <ListViewExample />; <add> }, <add> }, <add>]; <ide><path>RNTester/js/ListViewGridLayoutExample.js <ide> type State = {| <ide> |}; <ide> <ide> class ListViewGridLayoutExample extends React.Component<RNTesterProps, State> { <del> static title = '<ListView> - Grid Layout'; <del> static description = 'Flexbox grid layout.'; <del> <ide> state = { <ide> dataSource: this.getInitialDataSource(), <ide> }; <ide> const styles = StyleSheet.create({ <ide> }, <ide> }); <ide> <del>module.exports = ListViewGridLayoutExample; <add>exports.title = '<ListView> - Grid Layout'; <add>exports.description = 'Flexbox grid layout.'; <add>exports.examples = [ <add> { <add> title: 'Simple list view with grid layout', <add> render: function(): React.Element<typeof ListViewGridLayoutExample> { <add> return <ListViewGridLayoutExample />; <add> }, <add> }, <add>]; <ide><path>RNTester/js/ListViewPagingExample.js <ide> class Thumb extends React.Component<{}, $FlowFixMeState> { <ide> } <ide> <ide> class ListViewPagingExample extends React.Component<$FlowFixMeProps, *> { <del> static title = '<ListView> - Paging'; <del> static description = 'Floating headers & layout animations.'; <del> <ide> // $FlowFixMe found when converting React.createClass to ES6 <ide> constructor(props) { <ide> super(props); <ide> const layoutAnimationConfigs = [ <ide> animations.layout.easeInEaseOut, <ide> ]; <ide> <del>module.exports = ListViewPagingExample; <add>exports.title = '<ListView> - Paging'; <add>exports.description = 'Floating headers & layout animations.'; <add>exports.examples = [ <add> { <add> title: 'Simple list view with pagination', <add> render: function(): React.Element<typeof ListViewPagingExample> { <add> return <ListViewPagingExample />; <add> }, <add> }, <add>]; <ide><path>RNTester/js/MaskedViewExample.js <ide> const { <ide> View, <ide> } = require('react-native'); <ide> <del>class MaskedViewExample extends React.Component<{}, $FlowFixMeState> { <del> static title = '<MaskedViewIOS>'; <del> static description = <del> 'Renders the child view with a mask specified in the `renderMask` prop.'; <add>type Props = $ReadOnly<{||}>; <add>type State = {| <add> alternateChildren: boolean, <add>|}; <ide> <add>class MaskedViewExample extends React.Component<Props, State> { <ide> state = { <ide> alternateChildren: true, <ide> }; <ide> const styles = StyleSheet.create({ <ide> }, <ide> }); <ide> <del>module.exports = MaskedViewExample; <add>exports.title = '<MaskedViewIOS>'; <add>exports.description = <add> 'Renders the child view with a mask specified in the `renderMask` prop.'; <add>exports.examples = [ <add> { <add> title: 'Simple masked view', <add> render: function(): React.Element<typeof MaskedViewExample> { <add> return <MaskedViewExample />; <add> }, <add> }, <add>]; <ide><path>RNTester/js/MultiColumnExample.js <ide> class MultiColumnExample extends React.PureComponent< <ide> $FlowFixMeProps, <ide> $FlowFixMeState, <ide> > { <del> static title = '<FlatList> - MultiColumn'; <del> static description = 'Performant, scrollable grid of data.'; <del> <ide> state = { <ide> data: genItemData(1000), <ide> filterText: '', <ide> const styles = StyleSheet.create({ <ide> }, <ide> }); <ide> <del>module.exports = MultiColumnExample; <add>exports.title = '<FlatList> - MultiColumn'; <add>exports.description = 'Performant, scrollable grid of data.'; <add>exports.examples = [ <add> { <add> title: 'Simple flat list multi column', <add> render: function(): React.Element<typeof MultiColumnExample> { <add> return <MultiColumnExample />; <add> }, <add> }, <add>]; <ide><path>RNTester/js/PanResponderExample.js <ide> const CIRCLE_SIZE = 80; <ide> type Props = $ReadOnly<{||}>; <ide> <ide> class PanResponderExample extends React.Component<Props> { <del> static title = 'PanResponder Sample'; <del> static description = <del> 'Shows the Use of PanResponder to provide basic gesture handling'; <del> <ide> _handleStartShouldSetPanResponder = ( <ide> event: PressEvent, <ide> gestureState: GestureState, <ide> const styles = StyleSheet.create({ <ide> }, <ide> }); <ide> <del>module.exports = PanResponderExample; <add>exports.title = 'PanResponder Sample'; <add>exports.description = <add> 'Shows the Use of PanResponder to provide basic gesture handling'; <add>exports.examples = [ <add> { <add> title: 'Basic gresture handling', <add> render: function(): React.Element<typeof PanResponderExample> { <add> return <PanResponderExample />; <add> }, <add> }, <add>]; <ide><path>RNTester/js/PermissionsExampleAndroid.android.js <ide> const { <ide> <ide> const Item = Picker.Item; <ide> <del>exports.displayName = (undefined: ?string); <del>exports.framework = 'React'; <del>exports.title = 'PermissionsAndroid'; <del>exports.description = 'Permissions example for API 23+.'; <del> <ide> class PermissionsExample extends React.Component<{}, $FlowFixMeState> { <ide> state = { <ide> permission: PermissionsAndroid.PERMISSIONS.CAMERA, <ide> class PermissionsExample extends React.Component<{}, $FlowFixMeState> { <ide> }; <ide> } <ide> <add>exports.displayName = (undefined: ?string); <add>exports.framework = 'React'; <add>exports.title = 'PermissionsAndroid'; <add>exports.description = 'Permissions example for API 23+.'; <ide> exports.examples = [ <ide> { <ide> title: 'Permissions Example', <ide><path>RNTester/js/ProgressBarAndroidExample.android.js <ide> class MovingBar extends React.Component<MovingBarProps, MovingBarState> { <ide> } <ide> <ide> class ProgressBarAndroidExample extends React.Component<{}> { <del> static title = '<ProgressBarAndroid>'; <del> static description = 'Horizontal bar to show the progress of some operation.'; <del> <ide> render() { <ide> return ( <ide> <RNTesterPage title="ProgressBar Examples"> <ide> class ProgressBarAndroidExample extends React.Component<{}> { <ide> } <ide> } <ide> <del>module.exports = ProgressBarAndroidExample; <add>exports.title = '<ProgressBarAndroid>'; <add>exports.description = 'Horizontal bar to show the progress of some operation.'; <add>exports.examples = [ <add> { <add> title: 'Simple progress bar', <add> render: function(): React.Element<typeof ProgressBarAndroidExample> { <add> return <ProgressBarAndroidExample />; <add> }, <add> }, <add>]; <ide><path>RNTester/js/ProgressViewIOSExample.js <ide> class ProgressViewExample extends React.Component<Props, State> { <ide> } <ide> } <ide> <add>const styles = StyleSheet.create({ <add> container: { <add> marginTop: -20, <add> backgroundColor: 'transparent', <add> }, <add> progressView: { <add> marginTop: 20, <add> }, <add>}); <add> <ide> exports.displayName = (undefined: ?string); <ide> exports.framework = 'React'; <ide> exports.title = 'ProgressViewIOS'; <ide> exports.examples = [ <ide> }, <ide> }, <ide> ]; <del> <del>const styles = StyleSheet.create({ <del> container: { <del> marginTop: -20, <del> backgroundColor: 'transparent', <del> }, <del> progressView: { <del> marginTop: 20, <del> }, <del>}); <ide><path>RNTester/js/RNTesterApp.ios.js <ide> const { <ide> YellowBox, <ide> } = ReactNative; <ide> <del>import type {RNTesterExample} from './RNTesterList.ios'; <add>import type {RNTesterExample} from 'RNTesterTypes'; <ide> import type {RNTesterAction} from './RNTesterActions'; <ide> import type {RNTesterNavigationState} from './RNTesterNavigationReducer'; <ide> <ide><path>RNTester/js/RNTesterExampleContainer.js <ide> class RNTesterExampleContainer extends React.Component { <ide> } <ide> <ide> render(): React.Element<any> { <del> if (!this.props.module.examples) { <del> return <this.props.module />; <del> } <del> <ide> if (this.props.module.examples.length === 1) { <ide> const Example = this.props.module.examples[0].render; <ide> return <Example />; <ide><path>RNTester/js/RNTesterExampleList.js <ide> const View = require('View'); <ide> <ide> /* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found when <ide> * making Flow check .android.js files. */ <del>import type {RNTesterExample} from './RNTesterList.ios'; <add>import type {RNTesterExample} from 'RNTesterTypes'; <ide> import type {ViewStyleProp} from 'StyleSheet'; <ide> <ide> type Props = { <ide><path>RNTester/js/RNTesterList.android.js <ide> <ide> 'use strict'; <ide> <del>export type RNTesterExample = { <del> key: string, <del> module: Object, <del>}; <add>import type {RNTesterExample} from 'RNTesterTypes'; <ide> <ide> const ComponentExamples: Array<RNTesterExample> = [ <ide> { <ide><path>RNTester/js/RNTesterList.ios.js <ide> <ide> 'use strict'; <ide> <del>export type RNTesterExample = { <del> key: string, <del> module: Object, <del> supportsTVOS: boolean, <del>}; <add>import type {RNTesterExample} from 'RNTesterTypes'; <ide> <ide> const ComponentExamples: Array<RNTesterExample> = [ <ide> { <ide><path>RNTester/js/RTLExample.js <ide> const BorderExample = withRTLState(({isRTL, setRTL}) => { <ide> }); <ide> <ide> class RTLExample extends React.Component<any, State> { <del> static title = 'RTLExample'; <del> static description = <del> 'Examples to show how to apply components to RTL layout.'; <del> <ide> _panResponder: Object; <ide> <ide> constructor(props: Object) { <ide> const styles = StyleSheet.create({ <ide> }, <ide> }); <ide> <del>module.exports = RTLExample; <add>exports.title = 'RTLExample'; <add>exports.description = 'Examples to show how to apply components to RTL layout.'; <add>exports.examples = [ <add> { <add> title: 'Simple RTL', <add> render: function(): React.Element<typeof RTLExample> { <add> return <RTLExample />; <add> }, <add> }, <add>]; <ide><path>RNTester/js/RefreshControlExample.js <ide> class Row extends React.Component { <ide> } <ide> <ide> class RefreshControlExample extends React.Component { <del> static title = '<RefreshControl>'; <del> static description = 'Adds pull-to-refresh support to a scrollview.'; <del> <ide> state = { <ide> isRefreshing: false, <ide> loaded: 0, <ide> class RefreshControlExample extends React.Component { <ide> }; <ide> } <ide> <del>module.exports = RefreshControlExample; <add>exports.title = '<RefreshControl>'; <add>exports.description = 'Adds pull-to-refresh support to a scrollview.'; <add>exports.examples = [ <add> { <add> title: 'Simple refresh', <add> render: function(): React.Element<typeof RefreshControlExample> { <add> return <RefreshControlExample />; <add> }, <add> }, <add>]; <ide><path>RNTester/js/SafeAreaViewExample.js <ide> const Switch = require('Switch'); <ide> const Text = require('Text'); <ide> const View = require('View'); <ide> <del>exports.displayName = (undefined: ?string); <del>exports.framework = 'React'; <del>exports.title = '<SafeAreaView>'; <del>exports.description = <del> 'SafeAreaView automatically applies paddings reflect the portion of the view that is not covered by other (special) ancestor views.'; <del> <ide> class SafeAreaViewExample extends React.Component< <ide> {}, <ide> {| <ide> class IsIPhoneXExample extends React.Component<{}> { <ide> } <ide> } <ide> <add>const styles = StyleSheet.create({ <add> modal: { <add> flex: 1, <add> }, <add> safeArea: { <add> flex: 1, <add> height: 1000, <add> }, <add> safeAreaContent: { <add> flex: 1, <add> backgroundColor: '#ffaaaa', <add> alignItems: 'center', <add> justifyContent: 'center', <add> }, <add>}); <add> <add>exports.displayName = (undefined: ?string); <add>exports.framework = 'React'; <add>exports.title = '<SafeAreaView>'; <add>exports.description = <add> 'SafeAreaView automatically applies paddings reflect the portion of the view that is not covered by other (special) ancestor views.'; <ide> exports.examples = [ <ide> { <ide> title: '<SafeAreaView> Example', <ide> exports.examples = [ <ide> render: () => <IsIPhoneXExample />, <ide> }, <ide> ]; <del> <del>const styles = StyleSheet.create({ <del> modal: { <del> flex: 1, <del> }, <del> safeArea: { <del> flex: 1, <del> height: 1000, <del> }, <del> safeAreaContent: { <del> flex: 1, <del> backgroundColor: '#ffaaaa', <del> alignItems: 'center', <del> justifyContent: 'center', <del> }, <del>}); <ide><path>RNTester/js/ScrollViewSimpleExample.js <ide> const {ScrollView, StyleSheet, Text, TouchableOpacity} = ReactNative; <ide> const NUM_ITEMS = 20; <ide> <ide> class ScrollViewSimpleExample extends React.Component<{}> { <del> static title = '<ScrollView>'; <del> static description = <del> 'Component that enables scrolling through child components.'; <del> <ide> /* $FlowFixMe(>=0.85.0 site=react_native_fb) This comment suppresses an error <ide> * found when Flow v0.85 was deployed. To see the error, delete this comment <ide> * and run Flow. */ <ide> const styles = StyleSheet.create({ <ide> }, <ide> }); <ide> <del>module.exports = ScrollViewSimpleExample; <add>exports.title = '<ScrollView>'; <add>exports.description = <add> 'Component that enables scrolling through child components.'; <add> <add>exports.examples = [ <add> { <add> title: 'Simple scroll view', <add> render: function(): React.Element<typeof ScrollViewSimpleExample> { <add> return <ScrollViewSimpleExample />; <add> }, <add> }, <add>]; <ide><path>RNTester/js/SectionListExample.js <ide> const CustomSeparatorComponent = ({highlighted, text}) => ( <ide> ); <ide> <ide> class SectionListExample extends React.PureComponent<{}, $FlowFixMeState> { <del> static title = '<SectionList>'; <del> static description = 'Performant, scrollable list of data.'; <del> <ide> state = { <ide> data: genItemData(1000), <ide> debug: false, <ide> const styles = StyleSheet.create({ <ide> }, <ide> }); <ide> <del>module.exports = SectionListExample; <add>exports.title = '<SectionList>'; <add>exports.description = 'Performant, scrollable list of data.'; <add>exports.examples = [ <add> { <add> title: 'Simple scrollable list', <add> render: function(): React.Element<typeof SectionListExample> { <add> return <SectionListExample />; <add> }, <add> }, <add>]; <ide><path>RNTester/js/ShareExample.js <ide> const React = require('react'); <ide> const ReactNative = require('react-native'); <ide> const {StyleSheet, View, Text, TouchableHighlight, Share} = ReactNative; <ide> <del>exports.framework = 'React'; <del>exports.title = 'Share'; <del>exports.description = 'Share data with other Apps.'; <del>exports.examples = [ <del> { <del> title: 'Share Text Content', <del> render() { <del> return <ShareMessageExample />; <del> }, <del> }, <del>]; <add>type Props = $ReadOnly<{||}>; <add>type State = {|result: string|}; <ide> <del>class ShareMessageExample extends React.Component<$FlowFixMeProps, any> { <add>class ShareMessageExample extends React.Component<Props, State> { <ide> _shareMessage: Function; <ide> _shareText: Function; <ide> _showResult: Function; <ide> const styles = StyleSheet.create({ <ide> padding: 10, <ide> }, <ide> }); <add> <add>exports.framework = 'React'; <add>exports.title = 'Share'; <add>exports.description = 'Share data with other Apps.'; <add>exports.examples = [ <add> { <add> title: 'Share Text Content', <add> render() { <add> return <ShareMessageExample />; <add> }, <add> }, <add>]; <ide><path>RNTester/js/Shared/RNTesterTypes.js <ide> 'use strict'; <ide> <ide> import type {ComponentType} from 'React'; <add>import * as React from 'react'; <ide> <ide> export type RNTesterProps = $ReadOnly<{| <ide> navigator?: ?$ReadOnlyArray< <ide> export type RNTesterProps = $ReadOnly<{| <ide> |}>, <ide> >, <ide> |}>; <add> <add>export type RNTesterExampleModuleItem = $ReadOnly<{| <add> title: string, <add> platform?: string, <add> description?: string, <add> render: () => React.Node, <add>|}>; <add> <add>export type RNTesterExampleModule = $ReadOnly<{| <add> title: string, <add> description: string, <add> displayName?: ?string, <add> framework?: string, <add> examples: Array<RNTesterExampleModuleItem>, <add>|}>; <add> <add>export type RNTesterExample = $ReadOnly<{| <add> key: string, <add> module: RNTesterExampleModule, <add> supportsTVOS?: boolean, <add>|}>; <ide><path>RNTester/js/StatusBarExample.js <ide> const { <ide> Modal, <ide> } = ReactNative; <ide> <del>exports.framework = 'React'; <del>exports.title = '<StatusBar>'; <del>exports.description = 'Component for controlling the status bar'; <del> <ide> const colors = ['#ff0000', '#00ff00', '#0000ff', 'rgba(0, 0, 0, 0.4)']; <ide> <ide> const barStyles = ['default', 'light-content']; <ide> class ModalExample extends React.Component<{}, $FlowFixMeState> { <ide> } <ide> } <ide> <del>const examples = [ <add>exports.framework = 'React'; <add>exports.title = '<StatusBar>'; <add>exports.description = 'Component for controlling the status bar'; <add>exports.examples = [ <ide> { <ide> title: 'StatusBar hidden', <ide> render() { <ide> const examples = [ <ide> }, <ide> ]; <ide> <del>exports.examples = examples; <del> <ide> const styles = StyleSheet.create({ <ide> container: { <ide> flex: 1, <ide><path>RNTester/js/SwipeableFlatListExample.js <ide> const data = [ <ide> ]; <ide> <ide> class SwipeableFlatListExample extends React.Component<RNTesterProps> { <del> static title = '<SwipeableFlatList>'; <del> static description = 'Performant, scrollable, swipeable list of data.'; <del> <ide> render() { <ide> return ( <ide> <RNTesterPage <ide> const styles = StyleSheet.create({ <ide> }, <ide> }); <ide> <del>module.exports = SwipeableFlatListExample; <add>exports.title = '<SwipeableFlatList>'; <add>exports.description = 'Performant, scrollable, swipeable list of data.'; <add>exports.examples = [ <add> { <add> title: 'Simple swipable list', <add> render: function(): React.Element<typeof SwipeableFlatListExample> { <add> return <SwipeableFlatListExample />; <add> }, <add> }, <add>]; <ide><path>RNTester/js/SwipeableListViewExample.js <ide> type State = {| <ide> dataSource: SwipeableListViewDataSource, <ide> |}; <ide> <del>class SwipeableListViewSimpleExample extends React.Component< <del> RNTesterProps, <del> State, <del>> { <del> static title = '<SwipeableListView>'; <del> static description = 'Performant, scrollable, swipeable list of data.'; <del> <add>class SwipeableListViewExample extends React.Component<RNTesterProps, State> { <ide> state = { <ide> dataSource: SwipeableListView.getNewDataSource().cloneWithRowsAndSections( <ide> ...this._genDataSource({}), <ide> const styles = StyleSheet.create({ <ide> }, <ide> }); <ide> <del>module.exports = SwipeableListViewSimpleExample; <add>exports.title = '<SwipeableListView>'; <add>exports.description = 'Performant, scrollable, swipeable list of data.'; <add>exports.examples = [ <add> { <add> title: 'Simple swipable list', <add> render: function(): React.Element<typeof SwipeableListViewExample> { <add> return <SwipeableListViewExample />; <add> }, <add> }, <add>]; <ide><path>RNTester/js/TVEventHandlerExample.js <ide> const ReactNative = require('react-native'); <ide> <ide> const {Platform, View, Text, TouchableOpacity, TVEventHandler} = ReactNative; <ide> <del>exports.framework = 'React'; <del>exports.title = 'TVEventHandler example'; <del>exports.description = 'iOS alerts and action sheets'; <del>exports.examples = [ <del> { <del> title: 'TVEventHandler', <del> render() { <del> return <TVEventHandlerView />; <del> }, <del> }, <del>]; <del> <del>class TVEventHandlerView extends React.Component< <del> $FlowFixMeProps, <del> { <del> lastEventType: string, <del> }, <del>> { <del> /* $FlowFixMe(>=0.85.0 site=react_native_fb) This comment suppresses an error <del> * found when Flow v0.85 was deployed. To see the error, delete this comment <del> * and run Flow. */ <del> constructor(props) { <add>type Props = $ReadOnly<{||}>; <add>type State = {|lastEventType: string|}; <add>class TVEventHandlerView extends React.Component<Props, State> { <add> constructor(props: Props) { <ide> super(props); <ide> this.state = { <ide> lastEventType: '', <ide> class TVEventHandlerView extends React.Component< <ide> } <ide> } <ide> } <add> <add>exports.framework = 'React'; <add>exports.title = 'TVEventHandler example'; <add>exports.description = 'iOS alerts and action sheets'; <add>exports.examples = [ <add> { <add> title: 'TVEventHandler', <add> render() { <add> return <TVEventHandlerView />; <add> }, <add> }, <add>]; <ide><path>RNTester/js/TabBarIOSBarStyleExample.js <ide> const base64Icon = <ide> 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEsAAABLCAQAAACSR7JhAAADtUlEQVR4Ac3YA2Bj6QLH0XPT1Fzbtm29tW3btm3bfLZtv7e2ObZnms7d8Uw098tuetPzrxv8wiISrtVudrG2JXQZ4VOv+qUfmqCGGl1mqLhoA52oZlb0mrjsnhKpgeUNEs91Z0pd1kvihA3ULGVHiQO2narKSHKkEMulm9VgUyE60s1aWoMQUbpZOWE+kaqs4eLEjdIlZTcFZB0ndc1+lhB1lZrIuk5P2aib1NBpZaL+JaOGIt0ls47SKzLC7CqrlGF6RZ09HGoNy1lYl2aRSWL5GuzqWU1KafRdoRp0iOQEiDzgZPnG6DbldcomadViflnl/cL93tOoVbsOLVM2jylvdWjXolWX1hmfZbGR/wjypDjFLSZIRov09BgYmtUqPQPlQrPapecLgTIy0jMgPKtTeob2zWtrGH3xvjUkPCtNg/tm1rjwrMa+mdUkPd3hWbH0jArPGiU9ufCsNNWFZ40wpwn+62/66R2RUtoso1OB34tnLOcy7YB1fUdc9e0q3yru8PGM773vXsuZ5YIZX+5xmHwHGVvlrGPN6ZSiP1smOsMMde40wKv2VmwPPVXNut4sVpUreZiLBHi0qln/VQeI/LTMYXpsJtFiclUN+5HVZazim+Ky+7sAvxWnvjXrJFneVtLWLyPJu9K3cXLWeOlbMTlrIelbMDlrLenrjEQOtIF+fuI9xRp9ZBFp6+b6WT8RrxEpdK64BuvHgDk+vUy+b5hYk6zfyfs051gRoNO1usU12WWRWL73/MMEy9pMi9qIrR4ZpV16Rrvduxazmy1FSvuFXRkqTnE7m2kdb5U8xGjLw/spRr1uTov4uOgQE+0N/DvFrG/Jt7i/FzwxbA9kDanhf2w+t4V97G8lrT7wc08aA2QNUkuTfW/KimT01wdlfK4yEw030VfT0RtZbzjeMprNq8m8tnSTASrTLti64oBNdpmMQm0eEwvfPwRbUBywG5TzjPCsdwk3IeAXjQblLCoXnDVeoAz6SfJNk5TTzytCNZk/POtTSV40NwOFWzw86wNJRpubpXsn60NJFlHeqlYRbslqZm2jnEZ3qcSKgm0kTli3zZVS7y/iivZTweYXJ26Y+RTbV1zh3hYkgyFGSTKPfRVbRqWWVReaxYeSLarYv1Qqsmh1s95S7G+eEWK0f3jYKTbV6bOwepjfhtafsvUsqrQvrGC8YhmnO9cSCk3yuY984F1vesdHYhWJ5FvASlacshUsajFt2mUM9pqzvKGcyNJW0arTKN1GGGzQlH0tXwLDgQTurS8eIQAAAABJRU5ErkJggg=='; <ide> <ide> class TabBarIOSBarStyleExample extends React.Component<{}> { <del> static title = '<TabBarIOS> - Custom Bar Style'; <del> static description = 'Tab-based navigation.'; <del> static displayName = 'TabBarIOSBarStyleExample'; <del> <ide> render() { <ide> return ( <ide> <TabBarIOS barStyle="black"> <ide> const styles = StyleSheet.create({ <ide> }, <ide> }); <ide> <del>module.exports = TabBarIOSBarStyleExample; <add>exports.title = '<TabBarIOS> - Custom Bar Style'; <add>exports.description = 'Tab-based navigation.'; <add>exports.displayName = 'TabBarIOSBarStyleExample'; <add>exports.examples = [ <add> { <add> title: 'Custom tab bar navigation', <add> render: function(): React.Element<typeof TabBarIOSBarStyleExample> { <add> return <TabBarIOSBarStyleExample />; <add> }, <add> }, <add>]; <ide><path>RNTester/js/TabBarIOSExample.js <ide> const {StyleSheet, TabBarIOS, Text, View} = ReactNative; <ide> const base64Icon = <ide> 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEsAAABLCAQAAACSR7JhAAADtUlEQVR4Ac3YA2Bj6QLH0XPT1Fzbtm29tW3btm3bfLZtv7e2ObZnms7d8Uw098tuetPzrxv8wiISrtVudrG2JXQZ4VOv+qUfmqCGGl1mqLhoA52oZlb0mrjsnhKpgeUNEs91Z0pd1kvihA3ULGVHiQO2narKSHKkEMulm9VgUyE60s1aWoMQUbpZOWE+kaqs4eLEjdIlZTcFZB0ndc1+lhB1lZrIuk5P2aib1NBpZaL+JaOGIt0ls47SKzLC7CqrlGF6RZ09HGoNy1lYl2aRSWL5GuzqWU1KafRdoRp0iOQEiDzgZPnG6DbldcomadViflnl/cL93tOoVbsOLVM2jylvdWjXolWX1hmfZbGR/wjypDjFLSZIRov09BgYmtUqPQPlQrPapecLgTIy0jMgPKtTeob2zWtrGH3xvjUkPCtNg/tm1rjwrMa+mdUkPd3hWbH0jArPGiU9ufCsNNWFZ40wpwn+62/66R2RUtoso1OB34tnLOcy7YB1fUdc9e0q3yru8PGM773vXsuZ5YIZX+5xmHwHGVvlrGPN6ZSiP1smOsMMde40wKv2VmwPPVXNut4sVpUreZiLBHi0qln/VQeI/LTMYXpsJtFiclUN+5HVZazim+Ky+7sAvxWnvjXrJFneVtLWLyPJu9K3cXLWeOlbMTlrIelbMDlrLenrjEQOtIF+fuI9xRp9ZBFp6+b6WT8RrxEpdK64BuvHgDk+vUy+b5hYk6zfyfs051gRoNO1usU12WWRWL73/MMEy9pMi9qIrR4ZpV16Rrvduxazmy1FSvuFXRkqTnE7m2kdb5U8xGjLw/spRr1uTov4uOgQE+0N/DvFrG/Jt7i/FzwxbA9kDanhf2w+t4V97G8lrT7wc08aA2QNUkuTfW/KimT01wdlfK4yEw030VfT0RtZbzjeMprNq8m8tnSTASrTLti64oBNdpmMQm0eEwvfPwRbUBywG5TzjPCsdwk3IeAXjQblLCoXnDVeoAz6SfJNk5TTzytCNZk/POtTSV40NwOFWzw86wNJRpubpXsn60NJFlHeqlYRbslqZm2jnEZ3qcSKgm0kTli3zZVS7y/iivZTweYXJ26Y+RTbV1zh3hYkgyFGSTKPfRVbRqWWVReaxYeSLarYv1Qqsmh1s95S7G+eEWK0f3jYKTbV6bOwepjfhtafsvUsqrQvrGC8YhmnO9cSCk3yuY984F1vesdHYhWJ5FvASlacshUsajFt2mUM9pqzvKGcyNJW0arTKN1GGGzQlH0tXwLDgQTurS8eIQAAAABJRU5ErkJggg=='; <ide> <del>class TabBarExample extends React.Component<{}, $FlowFixMeState> { <del> static title = '<TabBarIOS>'; <del> static description = 'Tab-based navigation.'; <del> static displayName = 'TabBarExample'; <add>type Props = $ReadOnly<{||}>; <add>type State = {| <add> selectedTab: string, <add> notifCount: number, <add> presses: number, <add>|}; <ide> <add>class TabBarExample extends React.Component<Props, State> { <ide> state = { <ide> selectedTab: 'redTab', <ide> notifCount: 0, <ide> const styles = StyleSheet.create({ <ide> }, <ide> }); <ide> <del>module.exports = TabBarExample; <add>exports.title = '<TabBarIOS>'; <add>exports.description = 'Tab-based navigation.'; <add>exports.displayName = 'TabBarExample'; <add>exports.examples = [ <add> { <add> title: 'Simple tab navigation', <add> render: function(): React.Element<typeof TabBarExample> { <add> return <TabBarExample />; <add> }, <add> }, <add>]; <ide><path>RNTester/js/TextExample.android.js <ide> const RNTesterBlock = require('./RNTesterBlock'); <ide> const RNTesterPage = require('./RNTesterPage'); <ide> const TextLegend = require('./Shared/TextLegend'); <ide> <del>class Entity extends React.Component<$FlowFixMeProps> { <add>class Entity extends React.Component<{|children: React.Node|}> { <ide> render() { <ide> return ( <ide> <Text style={{fontWeight: 'bold', color: '#527fe4'}}> <ide> class Entity extends React.Component<$FlowFixMeProps> { <ide> ); <ide> } <ide> } <del> <ide> class AttributeToggler extends React.Component<{}, $FlowFixMeState> { <ide> state = {fontWeight: 'bold', fontSize: 15}; <ide> <ide> class AttributeToggler extends React.Component<{}, $FlowFixMeState> { <ide> } <ide> <ide> class TextExample extends React.Component<{}> { <del> static title = '<Text>'; <del> static description = 'Base component for rendering styled text.'; <del> <ide> render() { <ide> return ( <ide> <RNTesterPage title="<Text>"> <ide> const styles = StyleSheet.create({ <ide> }, <ide> }); <ide> <del>module.exports = TextExample; <add>exports.title = '<Text>'; <add>exports.description = 'Base component for rendering styled text.'; <add>exports.examples = [ <add> { <add> title: 'Basic text', <add> render: function(): React.Element<typeof TextExample> { <add> return <TextExample />; <add> }, <add> }, <add>]; <ide><path>RNTester/js/TimePickerAndroidExample.js <ide> const RNTesterBlock = require('./RNTesterBlock'); <ide> const RNTesterPage = require('./RNTesterPage'); <ide> <ide> class TimePickerAndroidExample extends React.Component { <del> static title = 'TimePickerAndroid'; <del> static description = 'Standard Android time picker dialog'; <del> <ide> state = { <ide> isoFormatText: 'pick a time (24-hour format)', <ide> presetHour: 4, <ide> const styles = StyleSheet.create({ <ide> }, <ide> }); <ide> <del>module.exports = TimePickerAndroidExample; <add>exports.title = 'TimePickerAndroid'; <add>exports.description = 'Standard Android time picker dialog'; <add>exports.examples = [ <add> { <add> title: 'Simple time picker', <add> render: function(): React.Element<typeof TimePickerAndroidExample> { <add> return <TimePickerAndroidExample />; <add> }, <add> }, <add>]; <ide><path>RNTester/js/ToastAndroidExample.android.js <ide> const {StyleSheet, Text, ToastAndroid, TouchableWithoutFeedback} = ReactNative; <ide> const RNTesterBlock = require('RNTesterBlock'); <ide> const RNTesterPage = require('RNTesterPage'); <ide> <del>class ToastExample extends React.Component<{}, $FlowFixMeState> { <del> static title = 'Toast Example'; <del> static description = <del> 'Example that demonstrates the use of an Android Toast to provide feedback.'; <del> state = {}; <del> <add>type Props = $ReadOnly<{||}>; <add>class ToastExample extends React.Component<Props> { <ide> render() { <ide> return ( <ide> <RNTesterPage title="ToastAndroid"> <ide> const styles = StyleSheet.create({ <ide> }, <ide> }); <ide> <del>module.exports = ToastExample; <add>exports.title = 'Toast Example'; <add>exports.description = <add> 'Example that demonstrates the use of an Android Toast to provide feedback.'; <add>exports.examples = [ <add> { <add> title: 'Basic toast', <add> render: function(): React.Element<typeof ToastExample> { <add> return <ToastExample />; <add> }, <add> }, <add>]; <ide><path>RNTester/js/ToolbarAndroidExample.android.js <ide> const Switch = require('Switch'); <ide> const ToolbarAndroid = require('ToolbarAndroid'); <ide> <ide> class ToolbarAndroidExample extends React.Component<{}, $FlowFixMeState> { <del> static title = '<ToolbarAndroid>'; <del> static description = 'Examples of using the Android toolbar.'; <del> <ide> state = { <ide> actionText: 'Example app with toolbar component', <ide> toolbarSwitch: false, <ide> const styles = StyleSheet.create({ <ide> }, <ide> }); <ide> <del>module.exports = ToolbarAndroidExample; <add>exports.title = '<ToolbarAndroid>'; <add>exports.description = 'Examples of using the Android toolbar.'; <add>exports.examples = [ <add> { <add> title: 'Basic toolbar', <add> render: function(): React.Element<typeof ToolbarAndroidExample> { <add> return <ToolbarAndroidExample />; <add> }, <add> }, <add>]; <ide><path>RNTester/js/ViewPagerAndroidExample.android.js <ide> const IMAGE_URIS = [ <ide> 'https://apod.nasa.gov/apod/image/1510/lunareclipse_27Sep_beletskycrop4.jpg', <ide> ]; <ide> <del>class LikeCount extends React.Component { <add>type Props = $ReadOnly<{||}>; <add>type State = {|likes: number|}; <add>class LikeCount extends React.Component<Props, State> { <ide> state = { <ide> likes: 7, <ide> }; <ide> class ProgressBar extends React.Component { <ide> } <ide> <ide> class ViewPagerAndroidExample extends React.Component { <del> static title = '<ViewPagerAndroid>'; <del> static description = <del> 'Container that allows to flip left and right between child views.'; <del> <ide> state = { <ide> page: 0, <ide> animationsAreEnabled: true, <ide> const styles = StyleSheet.create({ <ide> }, <ide> }); <ide> <del>module.exports = ViewPagerAndroidExample; <add>exports.title = '<ViewPagerAndroid>'; <add>exports.description = <add> 'Container that allows to flip left and right between child views.'; <add> <add>exports.examples = [ <add> { <add> title: 'Basic pager', <add> render(): React.Element<typeof ViewPagerAndroidExample> { <add> return <ViewPagerAndroidExample />; <add> }, <add> }, <add>]; <ide><path>RNTester/js/WebSocketExample.js <ide> type State = { <ide> }; <ide> <ide> class WebSocketExample extends React.Component<any, any, State> { <del> static title = 'WebSocket'; <del> static description = 'WebSocket API'; <del> <ide> state: State = { <ide> url: DEFAULT_WS_URL, <ide> httpUrl: DEFAULT_HTTP_URL, <ide> const styles = StyleSheet.create({ <ide> }, <ide> }); <ide> <del>module.exports = WebSocketExample; <add>exports.title = 'WebSocket'; <add>exports.description = 'WebSocket API'; <add>exports.examples = [ <add> { <add> title: 'Basic websocket', <add> render(): React.Element<typeof WebSocketExample> { <add> return <WebSocketExample />; <add> }, <add> }, <add>]; <ide><path>RNTester/js/createExamplePage.js <ide> const React = require('react'); <ide> <ide> const RNTesterExampleContainer = require('./RNTesterExampleContainer'); <del> <del>import type {ExampleModule} from 'ExampleTypes'; <add>import type {RNTesterExample} from 'RNTesterTypes'; <ide> <ide> const createExamplePage = function( <ide> title: ?string, <del> exampleModule: ExampleModule, <add> exampleModule: RNTesterExample, <ide> ): React.ComponentType<any> { <ide> class ExamplePage extends React.Component<{}> { <ide> render() {
58
PHP
PHP
remove unnecessary findorfail method
2f59c2c5459530e9a0be8c40ac536c06f3e99973
<ide><path>src/Illuminate/Database/Eloquent/Model.php <ide> public static function findOrNew($id, $columns = array('*')) <ide> return new static; <ide> } <ide> <del> /** <del> * Find a model by its primary key or throw an exception. <del> * <del> * @param mixed $id <del> * @param array $columns <del> * @return \Illuminate\Support\Collection|static <del> * <del> * @throws \Illuminate\Database\Eloquent\ModelNotFoundException <del> */ <del> public static function findOrFail($id, $columns = array('*')) <del> { <del> return static::query()->findOrFail($id, $columns); <del> } <del> <ide> /** <ide> * Reload a fresh model instance from the database. <ide> * <ide><path>tests/Database/DatabaseEloquentIntegrationTest.php <ide> public function testBasicModelCollectionRetrieval() <ide> } <ide> <ide> <add> public function testFindOrFail() <add> { <add> EloquentTestUser::create(['id' => 1, 'email' => 'taylorotwell@gmail.com']); <add> EloquentTestUser::create(['id' => 2, 'email' => 'abigailotwell@gmail.com']); <add> <add> $single = EloquentTestUser::findOrFail(1); <add> $multiple = EloquentTestUser::findOrFail([1, 2]); <add> <add> $this->assertInstanceOf('EloquentTestUser', $single); <add> $this->assertEquals('taylorotwell@gmail.com', $single->email); <add> $this->assertInstanceOf('Illuminate\Database\Eloquent\Collection', $multiple); <add> $this->assertInstanceOf('EloquentTestUser', $multiple[0]); <add> $this->assertInstanceOf('EloquentTestUser', $multiple[1]); <add> } <add> <add> /** <add> * @expectedException Illuminate\Database\Eloquent\ModelNotFoundException <add> */ <add> public function testFindOrFailWithSingleIdThrowsModelNotFoundException() <add> { <add> EloquentTestUser::findOrFail(1); <add> } <add> <add> /** <add> * @expectedException Illuminate\Database\Eloquent\ModelNotFoundException <add> */ <add> public function testFindOrFailWithMultipleIdsThrowsModelNotFoundException() <add> { <add> EloquentTestUser::create(['id' => 1, 'email' => 'taylorotwell@gmail.com']); <add> EloquentTestUser::findOrFail([1, 2]); <add> } <add> <add> <ide> public function testHasOnSelfReferencingBelongsToManyRelationship() <ide> { <ide> $user = EloquentTestUser::create(['email' => 'taylorotwell@gmail.com']); <ide><path>tests/Database/DatabaseEloquentModelTest.php <ide> public function testFindMethodUseWritePdo() <ide> } <ide> <ide> <del> /** <del> * @expectedException Illuminate\Database\Eloquent\ModelNotFoundException <del> */ <del> public function testFindOrFailMethodThrowsModelNotFoundException() <del> { <del> $result = EloquentModelFindNotFoundStub::findOrFail(1); <del> } <del> <del> <ide> public function testFindMethodWithArrayCallsQueryBuilderCorrectly() <ide> { <ide> $result = EloquentModelFindManyStub::find(array(1, 2)); <ide> public function newQuery() <ide> } <ide> } <ide> <del>class EloquentModelFindNotFoundStub extends Illuminate\Database\Eloquent\Model { <del> public static function query() <del> { <del> $mock = m::mock('Illuminate\Database\Eloquent\Builder'); <del> $mock->shouldReceive('findOrFail')->once()->with(1, array('*'))->andThrow(new ModelNotFoundException); <del> return $mock; <del> } <del>} <del> <ide> class EloquentModelDestroyStub extends Illuminate\Database\Eloquent\Model { <ide> public function newQuery() <ide> {
3
Text
Text
buffer allocation throws for negative size
bc335c0a8d68164fd978192409ab6c4986cfe374
<ide><path>doc/api/buffer.md <ide> deprecated: v6.0.0 <ide> <ide> * `size` {Integer} The desired length of the new `Buffer` <ide> <del>Allocates a new `Buffer` of `size` bytes. The `size` must be less than or equal <del>to the value of [`buffer.kMaxLength`]. Otherwise, a [`RangeError`] is thrown. <del>A zero-length `Buffer` will be created if `size <= 0`. <add>Allocates a new `Buffer` of `size` bytes. If the `size` is larger than <add>[`buffer.kMaxLength`] or smaller than 0, a [`RangeError`] will be thrown. <add>A zero-length `Buffer` will be created if `size` is 0. <ide> <ide> Unlike [`ArrayBuffers`][`ArrayBuffer`], the underlying memory for `Buffer` instances <ide> created in this way is *not initialized*. The contents of a newly created `Buffer` <ide> const buf = Buffer.alloc(5); <ide> console.log(buf); <ide> ``` <ide> <del>The `size` must be less than or equal to the value of [`buffer.kMaxLength`]. <del>Otherwise, a [`RangeError`] is thrown. A zero-length `Buffer` will be created if <del>`size <= 0`. <add>Allocates a new `Buffer` of `size` bytes. If the `size` is larger than <add>[`buffer.kMaxLength`] or smaller than 0, a [`RangeError`] will be thrown. <add>A zero-length `Buffer` will be created if `size` is 0. <ide> <ide> If `fill` is specified, the allocated `Buffer` will be initialized by calling <ide> [`buf.fill(fill)`][`buf.fill()`]. <ide> added: v5.10.0 <ide> <ide> * `size` {Integer} The desired length of the new `Buffer` <ide> <del>Allocates a new *non-zero-filled* `Buffer` of `size` bytes. The `size` must <del>be less than or equal to the value of [`buffer.kMaxLength`]. Otherwise, a <del>[`RangeError`] is thrown. A zero-length `Buffer` will be created if `size <= 0`. <add>Allocates a new `Buffer` of `size` bytes. If the `size` is larger than <add>[`buffer.kMaxLength`] or smaller than 0, a [`RangeError`] will be thrown. <add>A zero-length `Buffer` will be created if `size` is 0. <ide> <ide> The underlying memory for `Buffer` instances created in this way is *not <ide> initialized*. The contents of the newly created `Buffer` are unknown and <ide> added: v5.10.0 <ide> <ide> * `size` {Integer} The desired length of the new `Buffer` <ide> <del>Allocates a new *non-zero-filled* and non-pooled `Buffer` of `size` bytes. The <del>`size` must be less than or equal to the value of [`buffer.kMaxLength`]. <del>Otherwise, a [`RangeError`] is thrown. A zero-length `Buffer` will be created if <del>`size <= 0`. <add>Allocates a new `Buffer` of `size` bytes. If the `size` is larger than <add>[`buffer.kMaxLength`] or smaller than 0, a [`RangeError`] will be thrown. <add>A zero-length `Buffer` will be created if `size` is 0. <ide> <ide> The underlying memory for `Buffer` instances created in this way is *not <ide> initialized*. The contents of the newly created `Buffer` are unknown and <ide> deprecated: v6.0.0 <ide> <ide> * `size` {Integer} The desired length of the new `SlowBuffer` <ide> <del>Allocates a new `SlowBuffer` of `size` bytes. The `size` must be less than <del>or equal to the value of [`buffer.kMaxLength`]. Otherwise, a [`RangeError`] is <del>thrown. A zero-length `Buffer` will be created if `size <= 0`. <add>Allocates a new `Buffer` of `size` bytes. If the `size` is larger than <add>[`buffer.kMaxLength`] or smaller than 0, a [`RangeError`] will be thrown. <add>A zero-length `Buffer` will be created if `size` is 0. <ide> <ide> The underlying memory for `SlowBuffer` instances is *not initialized*. The <ide> contents of a newly created `SlowBuffer` are unknown and could contain
1
Javascript
Javascript
implement normals loading
91dfdffddd7e2875ea12d21816bd0c333ecdd972
<ide><path>examples/js/loaders/AMFLoader.js <ide> THREE.AMFLoader.prototype = { <ide> function loadMeshVertices( node ) { <ide> <ide> var vertArray = []; <add> var normalArray = []; <ide> var currVerticesNode = node.firstElementChild; <ide> <ide> while ( currVerticesNode ) { <ide> THREE.AMFLoader.prototype = { <ide> <ide> } <ide> <add> } else if ( vNode.nodeName === "normal" ) { <add> <add> var nx = vNode.getElementsByTagName("nx")[0].textContent; <add> var ny = vNode.getElementsByTagName("ny")[0].textContent; <add> var nz = vNode.getElementsByTagName("nz")[0].textContent; <add> <add> normalArray.push(nx); <add> normalArray.push(ny); <add> normalArray.push(nz); <add> <ide> } <add> <ide> vNode = vNode.nextElementSibling; <ide> <ide> } <ide> THREE.AMFLoader.prototype = { <ide> <ide> } <ide> <del> return vertArray; <add> return { "vertices": vertArray, "normals": normalArray }; <ide> <ide> } <ide> <ide> THREE.AMFLoader.prototype = { <ide> } else if ( currObjNode.nodeName === "mesh" ) { <ide> <ide> var currMeshNode = currObjNode.firstElementChild; <del> var mesh = { "vertices": [], "volumes": [], "color": currColor }; <add> var mesh = { "vertices": [], "normals": [], "volumes": [], "color": currColor }; <ide> <ide> while ( currMeshNode ) { <ide> <ide> if ( currMeshNode.nodeName === "vertices" ) { <ide> <del> mesh.vertices = mesh.vertices.concat( loadMeshVertices( currMeshNode ) ); <add> var loadedVertices = loadMeshVertices( currMeshNode ); <add> <add> mesh.normals = mesh.normals.concat( loadedVertices.normals ); <add> mesh.vertices = mesh.vertices.concat( loadedVertices.vertices ); <ide> <ide> } else if ( currMeshNode.nodeName === "volume" ) { <ide> <ide> THREE.AMFLoader.prototype = { <ide> <ide> for ( var i = 0; i < meshes.length; i ++ ) { <ide> <add> var objDefaultMaterial = defaultMaterial; <ide> var mesh = meshes[ i ]; <ide> var meshVertices = Float32Array.from( mesh.vertices ); <ide> var vertices = new THREE.BufferAttribute( Float32Array.from( meshVertices ), 3 ); <del> var objDefaultMaterial = defaultMaterial; <add> var meshNormals = null; <add> var normals = null; <add> <add> if ( mesh.normals.length ) { <add> <add> meshNormals = Float32Array.from( mesh.normals ); <add> normals = new THREE.BufferAttribute( Float32Array.from( meshNormals ), 3 ); <add> <add> } <ide> <ide> if ( mesh.color ) { <ide> <ide> THREE.AMFLoader.prototype = { <ide> var volume = volumes[ j ]; <ide> var newGeometry = new THREE.BufferGeometry(); <ide> var indexes = Uint32Array.from( volume.triangles ); <del> var normals = new Uint32Array( vertices.array.length ); <ide> var material = objDefaultMaterial; <ide> <ide> newGeometry.setIndex( new THREE.BufferAttribute( indexes, 1 ) ); <ide> newGeometry.addAttribute( 'position', vertices.clone() ); <ide> <add> if( normals ) { <add> <add> newGeometry.addAttribute( 'normal', normals.clone() ); <add> <add> } <add> <ide> if ( amfMaterials[ volume.materialid ] !== undefined ) { <ide> <ide> material = amfMaterials[ volume.materialid ];
1
Ruby
Ruby
restore cleaning of lib/charset.alias
d60f4ffcd80a984018c61f9ca60269d42a055bf8
<ide><path>Library/Homebrew/cleaner.rb <ide> def clean_dir d <ide> elsif path.extname == '.la' <ide> # *.la files are stupid <ide> path.unlink unless @f.skip_clean? path <add> elsif path == @f.lib+'charset.alias' <add> path.unlink unless @f.skip_clean? path <ide> elsif not path.symlink? <ide> clean_file path <ide> end
1
Go
Go
enable some commit tests
ac59dfa761b0681cb67d11184ef62cc16ec93570
<ide><path>integration-cli/docker_cli_commit_test.go <ide> import ( <ide> ) <ide> <ide> func (s *DockerSuite) TestCommitAfterContainerIsDone(c *check.C) { <del> testRequires(c, DaemonIsLinux) <ide> out, _ := dockerCmd(c, "run", "-i", "-a", "stdin", "busybox", "echo", "foo") <ide> <ide> cleanedContainerID := strings.TrimSpace(out) <ide> func (s *DockerSuite) TestCommitPausedContainer(c *check.C) { <ide> } <ide> <ide> func (s *DockerSuite) TestCommitNewFile(c *check.C) { <del> testRequires(c, DaemonIsLinux) <ide> dockerCmd(c, "run", "--name", "commiter", "busybox", "/bin/sh", "-c", "echo koye > /foo") <ide> <ide> imageID, _ := dockerCmd(c, "commit", "commiter") <ide> func (s *DockerSuite) TestCommitHardlink(c *check.C) { <ide> } <ide> <ide> func (s *DockerSuite) TestCommitTTY(c *check.C) { <del> testRequires(c, DaemonIsLinux) <ide> dockerCmd(c, "run", "-t", "--name", "tty", "busybox", "/bin/ls") <ide> <ide> imageID, _ := dockerCmd(c, "commit", "tty", "ttytest")
1
Ruby
Ruby
remove invalid docker tag characters
d707c0bbd8e925fe9ad1c02e515effc435353b41
<ide><path>Library/Homebrew/github_packages.rb <ide> def self.image_formula_name(formula_name) <ide> .tr("+", "x") <ide> end <ide> <add> def self.image_version_rebuild(version_rebuild) <add> # invalid docker tag characters <add> version_rebuild.tr("+", ".") <add> end <add> <ide> private <ide> <ide> IMAGE_CONFIG_SCHEMA_URI = "https://opencontainers.org/schema/image/config" <ide> def upload_bottle(user, token, skopeo, formula_full_name, bottle_hash, dry_run:, <ide> rebuild = bottle_hash["bottle"]["rebuild"] <ide> version_rebuild = GitHubPackages.version_rebuild(version, rebuild) <ide> <del> image_formula_name = GitHubPackages.image_formula_name(formula_name) <del> image_tag = "#{GitHubPackages.root_url(org, repo, DOCKER_PREFIX)}/#{image_formula_name}:#{version_rebuild}" <add> image_name = GitHubPackages.image_formula_name(formula_name) <add> image_tag = GitHubPackages.image_version_rebuild(version_rebuild) <add> image_uri = "#{GitHubPackages.root_url(org, repo, DOCKER_PREFIX)}/#{image_name}:#{image_tag}" <ide> <ide> puts <del> inspect_args = ["inspect", image_tag.to_s] <add> inspect_args = ["inspect", image_uri.to_s] <ide> if dry_run <ide> puts "#{skopeo} #{inspect_args.join(" ")} --dest-creds=#{user}:$HOMEBREW_GITHUB_PACKAGES_TOKEN" <ide> else <ide> inspect_args << "--dest-creds=#{user}:#{token}" <ide> inspect_result = system_command(skopeo, args: args) <ide> if inspect_result.status.success? <ide> if warn_on_error <del> opoo "#{image_tag} already exists, skipping upload!" <add> opoo "#{image_uri} already exists, skipping upload!" <ide> return <ide> else <del> odie "#{image_tag} already exists!" <add> odie "#{image_uri} already exists!" <ide> end <ide> end <ide> end <ide> def upload_bottle(user, token, skopeo, formula_full_name, bottle_hash, dry_run:, <ide> "org.opencontainers.image.ref.name" => version_rebuild) <ide> <ide> puts <del> args = ["copy", "--all", "oci:#{root}", image_tag.to_s] <add> args = ["copy", "--all", "oci:#{root}", image_uri.to_s] <ide> if dry_run <ide> puts "#{skopeo} #{args.join(" ")} --dest-creds=#{user}:$HOMEBREW_GITHUB_PACKAGES_TOKEN" <ide> else <ide><path>Library/Homebrew/software_spec.rb <ide> def github_packages_manifest_resource <ide> resource.version(version_rebuild) <ide> <ide> image_name = GitHubPackages.image_formula_name(@name) <del> resource.url("#{@spec.root_url}/#{image_name}/manifests/#{version_rebuild}", { <add> image_tag = GitHubPackages.image_version_rebuild(version_rebuild) <add> resource.url("#{@spec.root_url}/#{image_name}/manifests/#{image_tag}", { <ide> using: CurlGitHubPackagesDownloadStrategy, <ide> headers: ["Accept: application/vnd.oci.image.index.v1+json"], <ide> })
2
Ruby
Ruby
fix flaky advisory lock test
d2215580d892df7da82880c4d1cfd7edf3314dc6
<ide><path>activerecord/test/cases/migration_test.rb <ide> def migrate(x) <ide> }.new <ide> <ide> migrator = ActiveRecord::Migrator.new(:up, [migration], @schema_migration, 100) <del> query = "SELECT query FROM pg_stat_activity WHERE datname = '#{ActiveRecord::Base.connection_db_config.database}' AND state = 'idle'" <add> lock_id = migrator.send(:generate_migrator_advisory_lock_id) <add> <add> query = <<~SQL <add> SELECT query <add> FROM pg_stat_activity <add> WHERE datname = '#{ActiveRecord::Base.connection_db_config.database}' <add> AND state = 'idle' <add> AND query LIKE '%#{lock_id}%' <add> SQL <ide> <ide> assert_no_changes -> { ActiveRecord::Base.connection.exec_query(query).rows.flatten } do <ide> migrator.migrate
1
Javascript
Javascript
add tests for source map generator
a116dbf4a422cef25dca599710b633d4ebd57f7f
<ide><path>packager/react-packager/src/Bundler/source-map/B64Builder.js <ide> class B64Builder { <ide> * Adds `n` markers for generated lines to the mappings. <ide> */ <ide> markLines(n: number) { <add> if (n < 1) { <add> return this; <add> } <ide> this.hasSegment = false; <ide> if (this.pos + n >= this.buffer.length) { <ide> this._realloc(); <ide><path>packager/react-packager/src/Bundler/source-map/__tests__/B64Builder-test.js <add>/** <add> * Copyright (c) 2017-present, Facebook, Inc. <add> * All rights reserved. <add> * <add> * This source code is licensed under the BSD-style license found in the <add> * LICENSE file in the root directory of this source tree. An additional grant <add> * of patent rights can be found in the PATENTS file in the same directory. <add> */ <add>'use strict'; <add> <add>jest.disableAutomock(); <add> <add>const B64Builder = require('../B64Builder'); <add> <add>let builder; <add>beforeEach(() => { <add> builder = new B64Builder(); <add>}); <add> <add>it('exposes a fluent interface', () => { <add> expect(builder.markLines(0)).toBe(builder); <add> expect(builder.markLines(3)).toBe(builder); <add> expect(builder.startSegment()).toBe(builder); <add> expect(builder.append(4)).toBe(builder); <add>}); <add> <add>it('can create an empty string', () => { <add> expect(builder.toString()).toEqual(''); <add>}); <add> <add>it('can mark a new line in the generated code', () => { <add> builder.markLines(1); <add> expect(builder.toString()).toEqual(';'); <add>}); <add> <add>it('can mark multiple new lines in the generated code', () => { <add> builder.markLines(4); <add> expect(builder.toString()).toEqual(';;;;'); <add>}); <add> <add>it('can mark zero new lines in the generated code', () => { <add> builder.markLines(0); <add> expect(builder.toString()).toEqual(''); <add>}); <add> <add>it('does not add commas when just starting a segment', () => { <add> builder.startSegment(0); <add> expect(builder.toString()).toEqual('A'); <add>}); <add> <add>it('adds a comma when starting a segment after another segment', () => { <add> builder.startSegment(0); <add> builder.startSegment(1); <add> expect(builder.toString()).toEqual('A,C'); <add>}); <add> <add>it('does not add a comma when starting a segment after marking a line', () => { <add> builder.startSegment(0); <add> builder.markLines(1); <add> builder.startSegment(0); <add> expect(builder.toString()).toEqual('A;A'); <add>}); <add> <add>it('adds a comma when starting a segment after calling `markLines(0)`', () => { <add> builder.startSegment(0); <add> builder.markLines(0); <add> builder.startSegment(1); <add> expect(builder.toString()).toEqual('A,C'); <add>}); <add> <add>it('can append values that fit within 5 bits (including sign bit)', () => { <add> builder.append(0b1111); <add> builder.append(-0b1111); <add> expect(builder.toString()).toEqual('ef'); <add>}); <add> <add>it('can append values that fit within 10 bits (including sign bit)', () => { <add> builder.append(0b111100110); <add> builder.append(-0b110110011); <add> expect(builder.toString()).toEqual('senb'); <add>}); <add> <add>it('can append values that fit within 15 bits (including sign bit)', () => { <add> builder.append(0b10011111011001); <add> builder.append(-0b11001010001001); <add> expect(builder.toString()).toEqual('y9TzoZ'); <add>}); <add> <add>it('can append values that fit within 20 bits (including sign bit)', () => { <add> builder.append(0b1110010011101110110); <add> builder.append(-0b1011000010100100110); <add> expect(builder.toString()).toEqual('s3zctyiW'); <add>}); <add> <add>it('can append values that fit within 25 bits (including sign bit)', () => { <add> builder.append(0b100010001111011010110111); <add> builder.append(-0b100100111100001110101111); <add> expect(builder.toString()).toEqual('ur7jR/6hvS'); <add>}); <add> <add>it('can append values that fit within 30 bits (including sign bit)', () => { <add> builder.append(0b10001100100001101010001011111); <add> builder.append(-0b11111000011000111110011111101); <add> expect(builder.toString()).toEqual('+lqjyR7v+xhf'); <add>}); <add> <add>it('can append values that fit within 32 bits (including sign bit)', () => { <add> builder.append(0b1001100101000101001011111110011); <add> builder.append(-0b1101101101011000110011001110000); <add> expect(builder.toString()).toEqual('m/rq0sChnzx1tD'); <add>}); <add> <add>it('can handle multiple operations', () => { <add> builder <add> .markLines(3) <add> .startSegment(4) <add> .append(2) <add> .append(2) <add> .append(0) <add> .append(2345) <add> .startSegment(12) <add> .append(987543) <add> .markLines(1) <add> .startSegment(0); <add> expect(builder.toString()).toEqual(';;;IEEAyyE,Yu5o8B;A'); <add>}); <ide><path>packager/react-packager/src/Bundler/source-map/__tests__/Generator-test.js <add>/** <add> * Copyright (c) 2017-present, Facebook, Inc. <add> * All rights reserved. <add> * <add> * This source code is licensed under the BSD-style license found in the <add> * LICENSE file in the root directory of this source tree. An additional grant <add> * of patent rights can be found in the PATENTS file in the same directory. <add> */ <add>'use strict'; <add> <add>jest.disableAutomock(); <add> <add>const Generator = require('../Generator'); <add> <add>const {objectContaining} = expect; <add> <add>let generator; <add>beforeEach(() => { <add> generator = new Generator(); <add>}); <add> <add>it('adds file name and source code when starting a file', () => { <add> const file1 = 'just/a/file'; <add> const file2 = 'another/file'; <add> const source1 = 'var a = 1;'; <add> const source2 = 'var a = 2;'; <add> <add> generator.startFile(file1, source1); <add> generator.startFile(file2, source2); <add> <add> expect(generator.toMap()) <add> .toEqual(objectContaining({ <add> sources: [file1, file2], <add> sourcesContent: [source1, source2], <add> })); <add>}); <add> <add>it('throws when adding a mapping without starting a file', () => { <add> expect(() => generator.addSimpleMapping(1, 2)).toThrow(); <add>}); <add> <add>it('throws when adding a mapping after ending a file', () => { <add> generator.startFile('apples', 'pears'); <add> generator.endFile(); <add> expect(() => generator.addSimpleMapping(1, 2)).toThrow(); <add>}); <add> <add>it('can add a mapping for generated code without corresponding original source', () => { <add> generator.startFile('apples', 'pears'); <add> generator.addSimpleMapping(12, 87); <add> expect(generator.toMap()) <add> .toEqual(objectContaining({ <add> mappings: ';;;;;;;;;;;uF', <add> })); <add>}); <add> <add>it('can add a mapping with corresponding location in the original source', () => { <add> generator.startFile('apples', 'pears'); <add> generator.addSourceMapping(2, 3, 456, 7); <add> expect(generator.toMap()) <add> .toEqual(objectContaining({ <add> mappings: ';GAucO', <add> })); <add>}); <add> <add>it('can add a mapping with source location and symbol name', () => { <add> generator.startFile('apples', 'pears'); <add> generator.addNamedSourceMapping(9, 876, 54, 3, 'arbitrary'); <add> expect(generator.toMap()) <add> .toEqual(objectContaining({ <add> mappings: ';;;;;;;;42BAqDGA', <add> names: ['arbitrary'], <add> })); <add>}); <add> <add>describe('full map generation', () => { <add> beforeEach(() => { <add> generator.startFile('apples', 'pears'); <add> generator.addSimpleMapping(1, 2); <add> generator.addNamedSourceMapping(3, 4, 5, 6, 'plums'); <add> generator.endFile(); <add> generator.startFile('lemons', 'oranges'); <add> generator.addNamedSourceMapping(7, 8, 9, 10, 'tangerines'); <add> generator.addNamedSourceMapping(11, 12, 13, 14, 'tangerines'); <add> generator.addSimpleMapping(15, 16); <add> }); <add> <add> it('can add multiple mappings for each file', () => { <add> expect(generator.toMap()).toEqual({ <add> version: 3, <add> mappings: 'E;;IAIMA;;;;QCIIC;;;;YAIIA;;;;gB', <add> sources: ['apples', 'lemons'], <add> sourcesContent: ['pears', 'oranges'], <add> names: ['plums', 'tangerines'], <add> }); <add> }); <add> <add> it('can add a `file` property to the map', () => { <add> expect(generator.toMap('arbitrary')) <add> .toEqual(objectContaining({ <add> file: 'arbitrary', <add> })); <add> }); <add> <add> it('supports direct JSON serialization', () => { <add> expect(JSON.parse(generator.toString())).toEqual(generator.toMap()); <add> }); <add> <add> it('supports direct JSON serialization with a file name', () => { <add> const file = 'arbitrary/file'; <add> expect(JSON.parse(generator.toString(file))).toEqual(generator.toMap(file)); <add> }); <add>}); <ide><path>packager/react-packager/src/Bundler/source-map/__tests__/source-map-test.js <add> /** <add> * Copyright (c) 2017-present, Facebook, Inc. <add> * All rights reserved. <add> * <add> * This source code is licensed under the BSD-style license found in the <add> * LICENSE file in the root directory of this source tree. An additional grant <add> * of patent rights can be found in the PATENTS file in the same directory. <add> */ <add>'use strict'; <add> <add>jest.disableAutomock(); <add> <add>const Generator = require('../Generator'); <add>const {compactMapping, fromRawMappings} = require('..'); <add> <add>describe('flattening mappings / compacting', () => { <add> it('flattens simple mappings', () => { <add> expect(compactMapping({generated: {line: 12, column: 34}})) <add> .toEqual([12, 34]); <add> }); <add> <add> it('flattens mappings with a source location', () => { <add> expect(compactMapping({ <add> generated: {column: 34, line: 12}, <add> original: {column: 78, line: 56}, <add> })).toEqual([12, 34, 56, 78]); <add> }); <add> <add> it('flattens mappings with a source location and a symbol name', () => { <add> expect(compactMapping({ <add> generated: {column: 34, line: 12}, <add> name: 'arbitrary', <add> original: {column: 78, line: 56}, <add> })).toEqual([12, 34, 56, 78, 'arbitrary']); <add> }); <add>}); <add> <add>describe('build map from raw mappings', () => { <add> it('returns a `Generator` instance', () => { <add> expect(fromRawMappings([])).toBeInstanceOf(Generator); <add> }); <add> <add> it('returns a working source map containing all mappings', () => { <add> const input = [{ <add> code: lines(11), <add> map: [ <add> [1, 2], <add> [3, 4, 5, 6, 'apples'], <add> [7, 8, 9, 10], <add> [11, 12, 13, 14, 'pears'] <add> ], <add> sourceCode: 'code1', <add> sourcePath: 'path1', <add> }, { <add> code: lines(3), <add> map: [ <add> [1, 2], <add> [3, 4, 15, 16, 'bananas'], <add> ], <add> sourceCode: 'code2', <add> sourcePath: 'path2', <add> }, { <add> code: lines(23), <add> map: [ <add> [11, 12], <add> [13, 14, 15, 16, 'bananas'], <add> [17, 18, 19, 110], <add> [21, 112, 113, 114, 'pears'] <add> ], <add> sourceCode: 'code3', <add> sourcePath: 'path3', <add> }]; <add> <add> expect(fromRawMappings(input).toMap()) <add> .toEqual({ <add> mappings: 'E;;IAIMA;;;;QAII;;;;YAIIC;E;;ICEEC;;;;;;;;;;;Y;;cCAAA;;;;kBAI8F;;;;gHA8FID', <add> names: ['apples', 'pears', 'bananas'], <add> sources: ['path1', 'path2', 'path3'], <add> sourcesContent: ['code1', 'code2', 'code3'], <add> version: 3, <add> }); <add> }); <add>}); <add> <add>const lines = n => Array(n).join('\n');
4
PHP
PHP
add exit instructions to servershell
04c774831c696d17572972fb1366c6c64b627085
<ide><path>src/Console/Command/ServerShell.php <ide> <?php <ide> /** <del> * built-in Server Shell <del> * <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> public function main() { <ide> <ide> $port = ($this->_port == static::DEFAULT_PORT) ? '' : ':' . $this->_port; <ide> $this->out(__d('cake_console', 'built-in server is running in http://%s%s/', $this->_host, $port)); <add> $this->out(__d('cake_console', 'You can exit with <info>CTRL-C</info>')); <ide> system($command); <ide> } <ide>
1