content_type
stringclasses
8 values
main_lang
stringclasses
7 values
message
stringlengths
1
50
sha
stringlengths
40
40
patch
stringlengths
52
962k
file_count
int64
1
300
PHP
PHP
remove unused import
afbc5ac7c32f3ad5d862a6d6c4063bdde964b966
<ide><path>src/Illuminate/Filesystem/FilesystemManager.php <ide> use League\Flysystem\Adapter\Local as LocalAdapter; <ide> use League\Flysystem\AwsS3v3\AwsS3Adapter as S3Adapter; <ide> use League\Flysystem\Cached\Storage\Memory as MemoryStore; <del>use League\Flysystem\Cached\Storage\Predis as PredisStore; <ide> use Illuminate\Contracts\Filesystem\Factory as FactoryContract; <ide> <ide> /**
1
Javascript
Javascript
clarify reason for settextcontent helper
4e044f553f0704c0603f857165ea2acbb0940b2b
<ide><path>packages/react-dom/src/client/ReactDOM.js <ide> import warning from 'fbjs/lib/warning'; <ide> import * as ReactDOMComponentTree from './ReactDOMComponentTree'; <ide> import * as ReactDOMFiberComponent from './ReactDOMFiberComponent'; <ide> import * as ReactInputSelection from './ReactInputSelection'; <add>import setTextContent from './setTextContent'; <ide> import validateDOMNesting from './validateDOMNesting'; <ide> import * as ReactBrowserEventEmitter from '../events/ReactBrowserEventEmitter'; <ide> import * as ReactDOMEventListener from '../events/ReactDOMEventListener'; <ide> const DOMRenderer = ReactFiberReconciler({ <ide> }, <ide> <ide> resetTextContent(domElement: Instance): void { <del> domElement.textContent = ''; <add> setTextContent(domElement, ''); <ide> }, <ide> <ide> commitTextUpdate( <ide><path>packages/react-dom/src/client/setTextContent.js <ide> * <ide> * This source code is licensed under the MIT license found in the <ide> * LICENSE file in the root directory of this source tree. <add> * <add> * @flow <ide> */ <ide> <ide> import {TEXT_NODE} from '../shared/HTMLNodeType'; <ide> <ide> /** <del> * Set the textContent property of a node, ensuring that whitespace is preserved <del> * even in IE8. innerText is a poor substitute for textContent and, among many <del> * issues, inserts <br> instead of the literal newline chars. innerHTML behaves <del> * as it should. <add> * Set the textContent property of a node. For text updates, it's faster <add> * to set the `nodeValue` of the Text node directly instead of using <add> * `.textContent` which will remove the existing node and create a new one. <ide> * <ide> * @param {DOMElement} node <ide> * @param {string} text <ide> * @internal <ide> */ <del>let setTextContent = function(node, text) { <add>let setTextContent = function(node: Element, text: string): void { <ide> if (text) { <ide> let firstChild = node.firstChild; <ide>
2
Ruby
Ruby
fix rubocop errors
c3844a9dc0a4432c5dc50aa2fbfd705bc09fd725
<ide><path>activestorage/lib/active_storage/transformers/image_processing_transformer.rb <ide> def operations <ide> end <ide> <ide> def validate_transformation(name, argument) <del> method_name = name.to_s.gsub("-","_") <add> method_name = name.to_s.tr("-", "_") <ide> <ide> unless SUPPORTED_IMAGE_PROCESSING_METHODS.any? { |method| method_name == method } <ide> raise UnsupportedImageProcessingMethod, <<~ERROR.squish <ide><path>activestorage/test/models/variant_test.rb <ide> class ActiveStorage::VariantTest < ActiveSupport::TestCase <ide> end <ide> <ide> assert_raise(ActiveStorage::Transformers::ImageProcessingTransformer::UnsupportedImageProcessingArgument) do <del> blob.variant(resize: [123, {"-write /tmp/file.erb": "something"}, "/tmp/file.erb"]).processed <add> blob.variant(resize: [123, { "-write /tmp/file.erb": "something" }, "/tmp/file.erb"]).processed <ide> end <ide> end <ide> end <ide> class ActiveStorage::VariantTest < ActiveSupport::TestCase <ide> process_variants_with :mini_magick do <ide> blob = create_file_blob(filename: "racecar.jpg") <ide> assert_raise(ActiveStorage::Transformers::ImageProcessingTransformer::UnsupportedImageProcessingArgument) do <del> blob.variant(saver: {"-write": "/tmp/file.erb"}).processed <add> blob.variant(saver: { "-write": "/tmp/file.erb" }).processed <ide> end <ide> end <ide> end <ide> class ActiveStorage::VariantTest < ActiveSupport::TestCase <ide> process_variants_with :mini_magick do <ide> blob = create_file_blob(filename: "racecar.jpg") <ide> assert_raise(ActiveStorage::Transformers::ImageProcessingTransformer::UnsupportedImageProcessingArgument) do <del> blob.variant(saver: {"something": {"-write": "/tmp/file.erb"}}).processed <add> blob.variant(saver: { "something": { "-write": "/tmp/file.erb" } }).processed <ide> end <ide> <ide> assert_raise(ActiveStorage::Transformers::ImageProcessingTransformer::UnsupportedImageProcessingArgument) do <del> blob.variant(saver: {"something": ["-write", "/tmp/file.erb"]}).processed <add> blob.variant(saver: { "something": ["-write", "/tmp/file.erb"] }).processed <ide> end <ide> end <ide> end <ide><path>railties/test/application/configuration_test.rb <ide> class MyLogger < ::Logger <ide> app "development" <ide> <ide> assert ActiveStorage.unsupported_image_processing_arguments.include?("-danger") <del> refute ActiveStorage.unsupported_image_processing_arguments.include?("-set") <add> assert_not ActiveStorage.unsupported_image_processing_arguments.include?("-set") <ide> end <ide> <ide> test "hosts include .localhost in development" do
3
Java
Java
remove flaky check in mbeanclientinterceptortests
9bd74c270f880b8c2d98f13eefda0fe98f372029
<ide><path>spring-context/src/test/java/org/springframework/jmx/access/MBeanClientInterceptorTests.java <ide> import java.net.BindException; <ide> import java.util.HashMap; <ide> import java.util.Map; <del>import java.util.concurrent.TimeUnit; <ide> <ide> import javax.management.Descriptor; <ide> import javax.management.MBeanServerConnection; <ide> import javax.management.remote.JMXConnectorServer; <ide> import javax.management.remote.JMXConnectorServerFactory; <ide> import javax.management.remote.JMXServiceURL; <ide> <del>import org.awaitility.Awaitility; <ide> import org.junit.jupiter.api.Test; <ide> <ide> import org.springframework.aop.framework.ProxyFactory; <ide> import org.springframework.jmx.AbstractMBeanServerTests; <ide> import org.springframework.jmx.IJmxTestBean; <del>import org.springframework.jmx.JmxException; <ide> import org.springframework.jmx.JmxTestBean; <ide> import org.springframework.jmx.export.MBeanExporter; <ide> import org.springframework.jmx.export.assembler.AbstractReflectiveMBeanInfoAssembler; <ide> void testTestLazyConnectionToRemote() throws Exception { <ide> finally { <ide> connector.stop(); <ide> } <del> <del> try { <del> Awaitility.await() <del> .atMost(500, TimeUnit.MILLISECONDS) <del> .pollInterval(10, TimeUnit.MILLISECONDS) <del> .until(() -> !connector.isActive()); <del> bean.getName(); <del> } <del> catch (JmxException ex) { <del> // expected <del> } <ide> } <ide> <ide> public void testMXBeanAttributeAccess() throws Exception {
1
Ruby
Ruby
remove unneded tests
46a2917deda5207ff208ac03b85c7ae8396c8501
<ide><path>activerecord/test/cases/dirty_test.rb <ide> def test_time_attributes_changes_with_time_zone <ide> assert_equal old_created_on, pirate.created_on_was <ide> end <ide> end <del> <add> <ide> def test_setting_time_attributes_with_time_zone_field_to_itself_should_not_be_marked_as_a_change <ide> in_time_zone 'Paris' do <ide> target = Class.new(ActiveRecord::Base) <ide> def test_previous_changes <ide> assert_not_nil pirate.previous_changes['updated_on'][1] <ide> assert !pirate.previous_changes.key?('parrot_id') <ide> assert !pirate.previous_changes.key?('created_on') <del> <del> pirate = Pirate.find_by_catchphrase("Ahoy!") <del> pirate.update_column(:catchphrase, "Ninjas suck!") <del> <del> assert_equal 2, pirate.previous_changes.size <del> assert_equal ["Ahoy!", "Ninjas suck!"], pirate.previous_changes['catchphrase'] <del> assert_not_nil pirate.previous_changes['updated_on'][0] <del> assert_not_nil pirate.previous_changes['updated_on'][1] <del> assert !pirate.previous_changes.key?('parrot_id') <del> assert !pirate.previous_changes.key?('created_on') <ide> end <ide> <ide> if ActiveRecord::Base.connection.supports_migrations?
1
PHP
PHP
fix phpstan error
3cc9bc7294aba0aefb7c50a124e6abc2f75d6e8d
<ide><path>src/Shell/HelpShell.php <ide> public function main() <ide> } <ide> <ide> if ($this->param('xml')) { <del> return $this->asXml($this->commands); <add> $this->asXml($this->commands); <add> <add> return; <ide> } <ide> $this->asText($this->commands); <ide> }
1
Javascript
Javascript
fix lint warnings in jstransformer
8e803643ec92e59fcbf40d262cc8384492e9b028
<ide><path>packager/react-packager/src/JSTransformer/__tests__/Transformer-test.js <ide> describe('Transformer', function() { <ide> workerFarm.mockClear(); <ide> workerFarm.mockImpl((opts, path, methods) => { <ide> const api = workers = {}; <del> methods.forEach(method => api[method] = jest.fn()); <add> methods.forEach(method => {api[method] = jest.fn();}); <ide> return api; <ide> }); <ide> }); <ide> <del> it('passes transform module path, file path, source code, and options to the worker farm when transforming', () => { <add> it('passes transform module path, file path, source code,' + <add> ' and options to the worker farm when transforming', () => { <ide> const transformOptions = {arbitrary: 'options'}; <ide> const code = 'arbitrary(code)'; <ide> new Transformer(options).transformFile(fileName, code, transformOptions, transformCacheKey); <ide> describe('Transformer', function() { <ide> var snippet = 'snippet'; <ide> <ide> workers.transformAndExtractDependencies.mockImpl( <del> function(transformPath, filename, code, options, transformCacheKey, callback) { <add> function(transformPath, filename, code, opts, transfCacheKey, callback) { <ide> var babelError = new SyntaxError(message); <ide> babelError.type = 'SyntaxError'; <ide> babelError.description = message; <ide><path>packager/react-packager/src/JSTransformer/worker/__tests__/constant-folding-test.js <ide> describe('constant expressions', () => { <ide> f() ? g() : h() <ide> );`; <ide> expect(normalize(constantFolding('arbitrary.js', parse(code)))) <del> .toEqual(`a(true,true,2,true,{},{a:1},c,f()?g():h());`); <add> .toEqual('a(true,true,2,true,{},{a:1},c,f()?g():h());'); <ide> }); <ide> <ide> it('can optimize ternary expressions with constant conditions', () => { <ide> describe('constant expressions', () => { <ide> ? ('production' != 'production' ? 'a' : 'A') <ide> : 'i';`; <ide> expect(normalize(constantFolding('arbitrary.js', parse(code)))) <del> .toEqual(`var a=1;var b='A';`); <add> .toEqual('var a=1;var b=\'A\';'); <ide> }); <ide> <ide> it('can optimize logical operator expressions with constant conditions', () => { <ide> describe('constant expressions', () => { <ide> var b = 'android' == 'android' && <ide> 'production' != 'production' || null || "A";`; <ide> expect(normalize(constantFolding('arbitrary.js', parse(code)))) <del> .toEqual(`var a=true;var b="A";`); <add> .toEqual('var a=true;var b="A";'); <ide> }); <ide> <ide> it('can optimize logical operators with partly constant operands', () => { <ide> describe('constant expressions', () => { <ide> var e = !1 && z(); <ide> `; <ide> expect(normalize(constantFolding('arbitrary.js', parse(code)))) <del> .toEqual(`var a="truthy";var b=z();var c=null;var d=z();var e=false;`); <add> .toEqual('var a="truthy";var b=z();var c=null;var d=z();var e=false;'); <ide> }); <ide> <ide> it('can remode an if statement with a falsy constant test', () => { <ide> describe('constant expressions', () => { <ide> } <ide> `; <ide> expect(normalize(constantFolding('arbitrary.js', parse(code)))) <del> .toEqual(``); <add> .toEqual(''); <ide> }); <ide> <ide> it('can optimize if-else-branches with constant conditions', () => { <ide> describe('constant expressions', () => { <ide> } <ide> `; <ide> expect(normalize(constantFolding('arbitrary.js', parse(code)))) <del> .toEqual(`{var a=3;var b=a+4;}`); <add> .toEqual('{var a=3;var b=a+4;}'); <ide> }); <ide> <ide> it('can optimize nested if-else constructs', () => { <ide> describe('constant expressions', () => { <ide> } <ide> `; <ide> expect(normalize(constantFolding('arbitrary.js', parse(code)))) <del> .toEqual(`{{require('c');}}`); <add> .toEqual('{{require(\'c\');}}'); <ide> }); <ide> }); <ide><path>packager/react-packager/src/JSTransformer/worker/__tests__/extract-dependencies-test.js <ide> describe('Dependency extraction:', () => { <ide> }); <ide> <ide> it('does not extract calls to function with names that start with "require"', () => { <del> const code = `arbitraryrequire('foo');`; <add> const code = 'arbitraryrequire(\'foo\');'; <ide> <ide> const {dependencies, dependencyOffsets} = extractDependencies(code); <ide> expect(dependencies).toEqual([]); <ide> expect(dependencyOffsets).toEqual([]); <ide> }); <ide> <ide> it('does not extract calls to require with non-static arguments', () => { <del> const code = `require('foo/' + bar)`; <add> const code = 'require(\'foo/\' + bar)'; <ide> <ide> const {dependencies, dependencyOffsets} = extractDependencies(code); <ide> expect(dependencies).toEqual([]); <ide> describe('Dependency extraction:', () => { <ide> <ide> it('does not get confused by previous states', () => { <ide> // yes, this was a bug <del> const code = `require("a");/* a comment */ var a = /[a]/.test('a');`; <add> const code = 'require("a");/* a comment */ var a = /[a]/.test(\'a\');'; <ide> <ide> const {dependencies, dependencyOffsets} = extractDependencies(code); <ide> expect(dependencies).toEqual(['a']); <ide> expect(dependencyOffsets).toEqual([8]); <ide> }); <ide> <ide> it('can handle regular expressions', () => { <del> const code = `require('a'); /["']/.test('foo'); require("b");`; <add> const code = 'require(\'a\'); /["\']/.test(\'foo\'); require("b");'; <ide> <ide> const {dependencies, dependencyOffsets} = extractDependencies(code); <ide> expect(dependencies).toEqual(['a', 'b']);
3
PHP
PHP
regeneratetoken
f5d9bc0a6662b40cdbecea7a7f8ff6a9819954c7
<ide><path>tests/Session/SessionStoreTest.php <ide> public function testToken() <ide> } <ide> <ide> <add> public function testRegenerateToken() <add> { <add> $session = $this->getSession(); <add> $token = $session->getToken(); <add> $session->regenerateToken(); <add> $this->assertNotEquals($token, $session->getToken()); <add> } <add> <add> <ide> public function testName() <ide> { <ide> $session = $this->getSession();
1
Text
Text
improve alt text
525b6dd0be23716e9d46886b1d222c8826c9d000
<ide><path>COLLABORATOR_GUIDE.md <ide> or a pull request. <ide> <ide> Courtesy should always be shown to individuals submitting issues and pull <ide> requests to the Node.js project. Be welcoming to first-time contributors, <del>identified by the GitHub ![badge](./doc/first_timer_badge.png) badge. <add>identified by the GitHub ![First-time contributor](./doc/first_timer_badge.png) badge. <ide> <ide> For first-time contributors, check if the commit author is the same as the <ide> pull request author, and ask if they have configured their git
1
Mixed
Ruby
add compatibility for ruby 2.4 `to_time` changes
c9c5788a527b70d7f983e2b4b47e3afd863d9f48
<ide><path>activesupport/CHANGELOG.md <add>* Add `ActiveSupport.to_time_preserves_timezone` config option to control <add> how `to_time` handles timezones. In Ruby 2.4+ the behavior will change <add> from converting to the local system timezone to preserving the timezone <add> of the receiver. This config option defaults to false so that apps made <add> with earlier versions of Rails are not affected when upgrading, e.g: <add> <add> >> ENV['TZ'] = 'US/Eastern' <add> <add> >> "2016-04-23T10:23:12.000Z".to_time <add> => "2016-04-23T06:23:12.000-04:00" <add> <add> >> ActiveSupport.to_time_preserves_timezone = true <add> <add> >> "2016-04-23T10:23:12.000Z".to_time <add> => "2016-04-23T10:23:12.000Z" <add> <add> Fixes #24617. <add> <add> *Andrew White* <add> <ide> * `ActiveSupport::TimeZone.country_zones(country_code)` looks up the <ide> country's time zones by its two-letter ISO3166 country code, e.g. <ide> <ide><path>activesupport/lib/active_support.rb <ide> require "active_support/version" <ide> require "active_support/logger" <ide> require "active_support/lazy_load_hooks" <add>require "active_support/core_ext/date_and_time/compatibility" <ide> <ide> module ActiveSupport <ide> extend ActiveSupport::Autoload <ide> def self.halt_callback_chains_on_return_false <ide> def self.halt_callback_chains_on_return_false=(value) <ide> Callbacks.halt_and_display_warning_on_return_false = value <ide> end <add> <add> def self.to_time_preserves_timezone <add> DateAndTime::Compatibility.preserve_timezone <add> end <add> <add> def self.to_time_preserves_timezone=(value) <add> DateAndTime::Compatibility.preserve_timezone = value <add> end <ide> end <ide> <ide> autoload :I18n, "active_support/i18n" <ide><path>activesupport/lib/active_support/core_ext/date_and_time/compatibility.rb <add>module DateAndTime <add> module Compatibility <add> # If true, +to_time+ preserves the the timezone offset. <add> # <add> # NOTE: With Ruby 2.4+ the default for +to_time+ changed from <add> # converting to the local system time to preserving the offset <add> # of the receiver. For backwards compatibility we're overriding <add> # this behavior but new apps will have an initializer that sets <add> # this to true because the new behavior is preferred. <add> mattr_accessor(:preserve_timezone, instance_writer: false) { false } <add> <add> def to_time <add> preserve_timezone ? getlocal(utc_offset) : getlocal <add> end <add> end <add>end <ide><path>activesupport/lib/active_support/core_ext/date_time.rb <ide> require 'active_support/core_ext/date_time/acts_like' <ide> require 'active_support/core_ext/date_time/blank' <ide> require 'active_support/core_ext/date_time/calculations' <add>require 'active_support/core_ext/date_time/compatibility' <ide> require 'active_support/core_ext/date_time/conversions' <ide><path>activesupport/lib/active_support/core_ext/date_time/compatibility.rb <add>require 'active_support/core_ext/date_and_time/compatibility' <add> <add>class DateTime <add> prepend DateAndTime::Compatibility <add> <add> # Returns a <tt>Time.local()</tt> instance of the simultaneous time in your <add> # system's <tt>ENV['TZ']</tt> zone. <add> def getlocal(utc_offset = nil) <add> utc = getutc <add> <add> Time.utc( <add> utc.year, utc.month, utc.day, <add> utc.hour, utc.min, utc.sec + utc.sec_fraction <add> ).getlocal(utc_offset) <add> end <add>end <ide><path>activesupport/lib/active_support/core_ext/string/conversions.rb <ide> def to_time(form = :local) <ide> parts.fetch(:offset, form == :utc ? 0 : nil) <ide> ) <ide> <del> form == :utc ? time.utc : time.getlocal <add> form == :utc ? time.utc : time.to_time <ide> end <ide> <ide> # Converts a string to a Date value. <ide><path>activesupport/lib/active_support/core_ext/time.rb <ide> require 'active_support/core_ext/time/acts_like' <ide> require 'active_support/core_ext/time/calculations' <add>require 'active_support/core_ext/time/compatibility' <ide> require 'active_support/core_ext/time/conversions' <ide> require 'active_support/core_ext/time/zones' <ide><path>activesupport/lib/active_support/core_ext/time/compatibility.rb <add>require 'active_support/core_ext/date_and_time/compatibility' <add> <add>class Time <add> prepend DateAndTime::Compatibility <add>end <ide><path>activesupport/lib/active_support/time_with_zone.rb <ide> require 'active_support/duration' <ide> require 'active_support/values/time_zone' <ide> require 'active_support/core_ext/object/acts_like' <add>require 'active_support/core_ext/date_and_time/compatibility' <ide> <ide> module ActiveSupport <ide> # A Time-like class that can represent a time in any time zone. Necessary <ide> def self.name <ide> PRECISIONS = Hash.new { |h, n| h[n] = "%FT%T.%#{n}N".freeze } <ide> PRECISIONS[0] = '%FT%T'.freeze <ide> <del> include Comparable <add> include Comparable, DateAndTime::Compatibility <ide> attr_reader :time_zone <ide> <ide> def initialize(utc_time, time_zone, local_time = nil, period = nil) <ide> def to_r <ide> utc.to_r <ide> end <ide> <del> # Returns an instance of Time in the system timezone. <del> def to_time <del> utc.to_time <del> end <del> <ide> # Returns an instance of DateTime with the timezone's UTC offset <ide> # <ide> # Time.zone.now.to_datetime # => Tue, 18 Aug 2015 02:32:20 +0000 <ide><path>activesupport/test/core_ext/date_and_time_compatibility_test.rb <add>require 'abstract_unit' <add>require 'active_support/time' <add>require 'time_zone_test_helpers' <add> <add>class DateAndTimeCompatibilityTest < ActiveSupport::TestCase <add> include TimeZoneTestHelpers <add> <add> def setup <add> @utc_time = Time.utc(2016, 4, 23, 14, 11, 12) <add> @utc_offset = 3600 <add> @system_offset = -14400 <add> @zone = ActiveSupport::TimeZone['London'] <add> end <add> <add> def test_time_to_time_preserves_timezone <add> with_preserve_timezone(true) do <add> with_env_tz 'US/Eastern' do <add> time = Time.new(2016, 4, 23, 15, 11, 12, 3600).to_time <add> <add> assert_instance_of Time, time <add> assert_equal @utc_time, time.getutc <add> assert_equal @utc_offset, time.utc_offset <add> end <add> end <add> end <add> <add> def test_time_to_time_does_not_preserve_time_zone <add> with_preserve_timezone(false) do <add> with_env_tz 'US/Eastern' do <add> time = Time.new(2016, 4, 23, 15, 11, 12, 3600).to_time <add> <add> assert_instance_of Time, time <add> assert_equal @utc_time, time.getutc <add> assert_equal @system_offset, time.utc_offset <add> end <add> end <add> end <add> <add> def test_datetime_to_time_preserves_timezone <add> with_preserve_timezone(true) do <add> with_env_tz 'US/Eastern' do <add> time = DateTime.new(2016, 4, 23, 15, 11, 12, Rational(1,24)).to_time <add> <add> assert_instance_of Time, time <add> assert_equal @utc_time, time.getutc <add> assert_equal @utc_offset, time.utc_offset <add> end <add> end <add> end <add> <add> def test_datetime_to_time_does_not_preserve_time_zone <add> with_preserve_timezone(false) do <add> with_env_tz 'US/Eastern' do <add> time = DateTime.new(2016, 4, 23, 15, 11, 12, Rational(1,24)).to_time <add> <add> assert_instance_of Time, time <add> assert_equal @utc_time, time.getutc <add> assert_equal @system_offset, time.utc_offset <add> end <add> end <add> end <add> <add> def test_twz_to_time_preserves_timezone <add> with_preserve_timezone(true) do <add> with_env_tz 'US/Eastern' do <add> time = ActiveSupport::TimeWithZone.new(@utc_time, @zone).to_time <add> <add> assert_instance_of Time, time <add> assert_equal @utc_time, time.getutc <add> assert_equal @utc_offset, time.utc_offset <add> end <add> end <add> end <add> <add> def test_twz_to_time_does_not_preserve_time_zone <add> with_preserve_timezone(false) do <add> with_env_tz 'US/Eastern' do <add> time = ActiveSupport::TimeWithZone.new(@utc_time, @zone).to_time <add> <add> assert_instance_of Time, time <add> assert_equal @utc_time, time.getutc <add> assert_equal @system_offset, time.utc_offset <add> end <add> end <add> end <add> <add> def test_string_to_time_preserves_timezone <add> with_preserve_timezone(true) do <add> with_env_tz 'US/Eastern' do <add> time = "2016-04-23T15:11:12+01:00".to_time <add> <add> assert_instance_of Time, time <add> assert_equal @utc_time, time.getutc <add> assert_equal @utc_offset, time.utc_offset <add> end <add> end <add> end <add> <add> def test_string_to_time_does_not_preserve_time_zone <add> with_preserve_timezone(false) do <add> with_env_tz 'US/Eastern' do <add> time = "2016-04-23T15:11:12+01:00".to_time <add> <add> assert_instance_of Time, time <add> assert_equal @utc_time, time.getutc <add> assert_equal @system_offset, time.utc_offset <add> end <add> end <add> end <add>end <ide><path>activesupport/test/core_ext/date_time_ext_test.rb <ide> def test_custom_date_format <ide> Time::DATE_FORMATS.delete(:custom) <ide> end <ide> <add> def test_getlocal <add> with_env_tz 'US/Eastern' do <add> assert_equal Time.local(2016, 3, 11, 10, 11, 12), DateTime.new(2016, 3, 11, 15, 11, 12, 0).getlocal <add> assert_equal Time.local(2016, 3, 21, 11, 11, 12), DateTime.new(2016, 3, 21, 15, 11, 12, 0).getlocal <add> assert_equal Time.local(2016, 4, 1, 11, 11, 12), DateTime.new(2016, 4, 1, 16, 11, 12, Rational(1,24)).getlocal <add> end <add> end <add> <ide> def test_to_date <ide> assert_equal Date.new(2005, 2, 21), DateTime.new(2005, 2, 21, 14, 30, 0).to_date <ide> end <ide><path>activesupport/test/time_zone_test_helpers.rb <ide> def with_env_tz(new_tz = 'US/Eastern') <ide> ensure <ide> old_tz ? ENV['TZ'] = old_tz : ENV.delete('TZ') <ide> end <add> <add> def with_preserve_timezone(value) <add> old_preserve_tz = ActiveSupport.to_time_preserves_timezone <add> ActiveSupport.to_time_preserves_timezone = value <add> yield <add> ensure <add> ActiveSupport.to_time_preserves_timezone = old_preserve_tz <add> end <ide> end <ide><path>railties/CHANGELOG.md <add>* Add `config/initializers/to_time_preserves_timezone.rb`, which tells <add> Active Support to preserve the receiver's timezone when calling `to_time`. <add> This matches the new behavior that will be part of Ruby 2.4. <add> <add> Fixes #24617. <add> <add> *Andrew White* <add> <ide> * Make `rails restart` command work with Puma by passing the restart command <ide> which Puma can use to restart rails server. <ide> <ide><path>railties/lib/rails/generators/rails/app/app_generator.rb <ide> def config_when_updating <ide> cookie_serializer_config_exist = File.exist?('config/initializers/cookies_serializer.rb') <ide> callback_terminator_config_exist = File.exist?('config/initializers/callback_terminator.rb') <ide> active_record_belongs_to_required_by_default_config_exist = File.exist?('config/initializers/active_record_belongs_to_required_by_default.rb') <add> to_time_preserves_timezone_config_exist = File.exist?('config/initializers/to_time_preserves_timezone.rb') <ide> action_cable_config_exist = File.exist?('config/cable.yml') <ide> ssl_options_exist = File.exist?('config/initializers/ssl_options.rb') <ide> rack_cors_config_exist = File.exist?('config/initializers/cors.rb') <ide> def config_when_updating <ide> remove_file 'config/initializers/active_record_belongs_to_required_by_default.rb' <ide> end <ide> <add> unless to_time_preserves_timezone_config_exist <add> remove_file 'config/initializers/to_time_preserves_timezone.rb' <add> end <add> <ide> unless action_cable_config_exist <ide> template 'config/cable.yml' <ide> end <ide><path>railties/lib/rails/generators/rails/app/templates/config/initializers/to_time_preserves_timezone.rb <add># Be sure to restart your server when you modify this file. <add> <add># Preserve the timezone of the receiver when calling to `to_time`. <add># Ruby 2.4 will change the behavior of `to_time` to preserve the timezone <add># when converting to an instance of `Time` instead of the previous behavior <add># of converting to the local system timezone. <add># <add># Rails 5.0 introduced this config option so that apps made with earlier <add># versions of Rails are not affected when upgrading. <add>ActiveSupport.to_time_preserves_timezone = true <ide><path>railties/test/generators/app_generator_test.rb <ide> def test_rails_update_does_not_remove_active_record_belongs_to_required_by_defau <ide> end <ide> end <ide> <add> def test_rails_update_does_not_create_to_time_preserves_timezone <add> app_root = File.join(destination_root, 'myapp') <add> run_generator [app_root] <add> <add> FileUtils.rm("#{app_root}/config/initializers/to_time_preserves_timezone.rb") <add> <add> stub_rails_application(app_root) do <add> generator = Rails::Generators::AppGenerator.new ["rails"], [], destination_root: app_root, shell: @shell <add> generator.send(:app_const) <add> quietly { generator.send(:update_config_files) } <add> assert_no_file "#{app_root}/config/initializers/to_time_preserves_timezone.rb" <add> end <add> end <add> <add> def test_rails_update_does_not_remove_to_time_preserves_timezone_if_already_present <add> app_root = File.join(destination_root, 'myapp') <add> run_generator [app_root] <add> <add> FileUtils.touch("#{app_root}/config/initializers/to_time_preserves_timezone.rb") <add> <add> stub_rails_application(app_root) do <add> generator = Rails::Generators::AppGenerator.new ["rails"], [], destination_root: app_root, shell: @shell <add> generator.send(:app_const) <add> quietly { generator.send(:update_config_files) } <add> assert_file "#{app_root}/config/initializers/to_time_preserves_timezone.rb" <add> end <add> end <add> <ide> def test_rails_update_does_not_create_ssl_options_by_default <ide> app_root = File.join(destination_root, 'myapp') <ide> run_generator [app_root]
16
PHP
PHP
remove assignment in conditional
776fcad341fb01c4fd8df13e38dc37c172321513
<ide><path>Cake/Database/Statement/StatementDecorator.php <ide> public function bind($params, $types) { <ide> * @return string <ide> */ <ide> public function lastInsertId($table = null, $column = null) { <del> if ($column && $row = $this->fetch('assoc')) { <add> $row = null; <add> if ($column) { <add> $row = $this->fetch('assoc'); <add> } <add> if ($column && $row) { <ide> return $row[$column]; <ide> } <ide> return $this->_driver->lastInsertId($table, $column);
1
Python
Python
prevent head method mapping to coerce action name
df584350b4f77143d84615f05000f71408aec9c0
<ide><path>rest_framework/schemas/coreapi.py <ide> def get_keys(self, subpath, method, view): <ide> <ide> if is_custom_action(action): <ide> # Custom action, eg "/users/{pk}/activate/", "/users/active/" <del> if len(view.action_map) > 1: <add> mapped_methods = { <add> # Don't count head mapping, e.g. not part of the schema <add> method for method in view.action_map if method != 'head' <add> } <add> if len(mapped_methods) > 1: <ide> action = self.default_mapping[method.lower()] <ide> if action in self.coerce_method_names: <ide> action = self.coerce_method_names[action] <ide><path>tests/schemas/test_coreapi.py <ide> def test_schema_for_regular_views(self): <ide> assert schema == expected <ide> <ide> <add>@unittest.skipUnless(coreapi, 'coreapi is not installed') <add>@override_settings(REST_FRAMEWORK={'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.AutoSchema'}) <add>class TestSchemaGeneratorActionKeysViewSets(TestCase): <add> def test_action_not_coerced_for_get_and_head(self): <add> """ <add> Ensure that action name is preserved when action map contains "head". <add> """ <add> class CustomViewSet(GenericViewSet): <add> serializer_class = EmptySerializer <add> <add> @action(methods=['get', 'head'], detail=True) <add> def custom_read(self, request, pk): <add> raise NotImplementedError <add> <add> @action(methods=['put', 'patch'], detail=True) <add> def custom_mixed_update(self, request, pk): <add> raise NotImplementedError <add> <add> self.router = DefaultRouter() <add> self.router.register('example', CustomViewSet, basename='example') <add> self.patterns = [ <add> path('', include(self.router.urls)) <add> ] <add> <add> generator = SchemaGenerator(title='Example API', patterns=self.patterns) <add> schema = generator.get_schema() <add> <add> expected = coreapi.Document( <add> url='', <add> title='Example API', <add> content={ <add> 'example': { <add> 'custom_read': coreapi.Link( <add> url='/example/{id}/custom_read/', <add> action='get', <add> fields=[ <add> coreapi.Field('id', required=True, location='path', schema=coreschema.String()), <add> ] <add> ), <add> 'custom_mixed_update': { <add> 'update': coreapi.Link( <add> url='/example/{id}/custom_mixed_update/', <add> action='put', <add> fields=[ <add> coreapi.Field('id', required=True, location='path', schema=coreschema.String()), <add> ] <add> ), <add> 'partial_update': coreapi.Link( <add> url='/example/{id}/custom_mixed_update/', <add> action='patch', <add> fields=[ <add> coreapi.Field('id', required=True, location='path', schema=coreschema.String()), <add> ] <add> ) <add> } <add> } <add> } <add> ) <add> assert schema == expected <add> <add> <ide> @unittest.skipUnless(coreapi, 'coreapi is not installed') <ide> @override_settings(REST_FRAMEWORK={'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.AutoSchema'}) <ide> class Test4605Regression(TestCase):
2
Go
Go
fix a typo in graph/graph.go
883fcfe4256d5d5bf1b3bfbced61fa585fe07a73
<ide><path>graph/graph.go <ide> func (graph *Graph) walkAll(handler func(*image.Image)) { <ide> } <ide> <ide> // ByParent returns a lookup table of images by their parent. <del>// If an image of id ID has 3 children images, then the value for key ID <add>// If an image of key ID has 3 children images, then the value for key ID <ide> // will be a list of 3 images. <ide> // If an image has no children, it will not have an entry in the table. <ide> func (graph *Graph) ByParent() map[string][]*image.Image {
1
Python
Python
add vectors.pyx in setup
b4cdd054669baced2f55337ac33556817f7dc272
<ide><path>setup.py <ide> 'spacy.syntax.ner', <ide> 'spacy.symbols', <ide> 'spacy.vectors', <del> 'spacy.syntax.iterators'] <add>] <ide> <ide> <ide> COMPILE_OPTIONS = { <ide><path>spacy/tests/regression/test_issue704.py <ide> def test_issue704(EN): <ide> <ide> text = '“Atticus said to Jem one day, “I’d rather you shot at tin cans in the backyard, but I know you’ll go after birds. Shoot all the blue jays you want, if you can hit ‘em, but remember it’s a sin to kill a mockingbird.”' <ide> doc = EN(text) <del> sents = [sent for sent in doc.sents] <add> sents = list([sent for sent in doc.sents]) <ide> assert len(sents) == 3
2
Javascript
Javascript
fix the regression at 6073a03
49a3bae05b5432adf9c504bb836119a0eb5a49cf
<ide><path>fonts.js <ide> var Font = (function () { <ide> } <ide> <ide> Fonts[name] = { <del> data: file, <add> data: data, <ide> properties: properties, <ide> loading: true, <ide> cache: Object.create(null)
1
Ruby
Ruby
fix variable names and speed up relation ordering
b4aae5a8e6a3d65b11490261b445faf9e38bbcd2
<ide><path>activerecord/lib/active_record/associations/preloader/association.rb <ide> def options <ide> reflection.options <ide> end <ide> <del> def preloaded_records1 <del> associated_records_by_owner.values.flatten <del> end <del> <ide> def preloaded_records <del> if owners.first.association(reflection.name).loaded? <del> [] <del> else <del> associated_records_by_owner.values.flatten <del> end <add> associated_records_by_owner.values.flatten <ide> end <ide> <ide> def loaded? <ide><path>activerecord/lib/active_record/associations/preloader/through_association.rb <ide> def associated_records_by_owner <ide> through_records = owners.map do |owner, h| <ide> association = owner.association through_reflection.name <ide> <del> x = [owner, Array(association.reader), association] <add> x = [owner, Array(association.reader)] <ide> <ide> # Dont cache the association - we would only be caching a subset <ide> association.reset if should_reset <ide> <ide> x <ide> end <ide> <del> middle_records = through_records.map { |rec| rec[1] }.flatten <add> middle_records = through_records.map { |(_,rec)| rec }.flatten <ide> <ide> preloader = Preloader.new(middle_records, <ide> source_reflection.name, <ide> def associated_records_by_owner <ide> } <ide> end <ide> <del> @associated_records_by_owner = through_records.each_with_object({}) { |(lhs,middles,assoc),h| <del> x = middle_to_pl[middles.first] <add> @associated_records_by_owner = through_records.each_with_object({}) { |(lhs,middles),h| <add> preloader = middle_to_pl[middles.first] <ide> <ide> rhs_records = middles.flat_map { |r| <ide> r.send(source_reflection.name) <ide> }.compact <ide> <del> if x && x.loaded? <del> rs = rhs_records.sort_by { |rhs| <del> x.preloaded_records1.index(rhs) <add> if preloader && preloader.loaded? <add> loaded_records = preloader.preloaded_records <add> i = 0 <add> record_index = loaded_records.each_with_object({}) { |r,indexes| <add> indexes[r] = i <add> i += 1 <ide> } <add> rs = rhs_records.sort_by { |rhs| record_index[rhs] } <ide> else <ide> rs = rhs_records <ide> end
2
Javascript
Javascript
remove dup camelkey path
8f7218198dad5dd1a93dc44087159b2c34b86292
<ide><path>src/data.js <ide> jQuery.fn.extend({ <ide> return data; <ide> } <ide> <del> // As a last resort, attempt to find <del> // the data by checking AGAIN, but with <del> // a camelCased key. <del> data = data_user.get( elem, camelKey ); <del> if ( data !== undefined ) { <del> return data; <del> } <del> <ide> // We tried really hard, but the data doesn't exist. <ide> return undefined; <ide> }
1
Text
Text
add 0.67.1 changelog & fix 0.67.0
293fb51e3aef0155fd2cd107e9a58fa86fb19ab9
<ide><path>CHANGELOG.md <ide> # Changelog <ide> <add>## v0.67.1 <add> <add>### Fixed <add> <add>#### Android specific <add> <add>- Do not remove libjscexecutor.so from release builds ([574a773f8f](https://github.com/facebook/react-native/commit/574a773f8f55fe7808fbb672066be8174c64d76d) by [@cortinico](https://github.com/cortinico)) <add> <add>#### iOS specific <add> <add>- Remove alert's window when call to `hide`. ([a46a99e120](https://github.com/facebook/react-native/commit/a46a99e12039c2b92651af1996489d660e237f1b) by [@asafkorem](https://github.com/asafkorem)) <add> <ide> ## v0.67.0 <ide> <ide> ### Added <ide> <ide> #### iOS specific <ide> - Added `cancelButtonTintColor` prop for `ActionSheetIOS` to change only the text color of the cancel button ([01856633a1](https://github.com/facebook/react-native/commit/01856633a1d42ed3b26e7cc93a007d7948e1f76e) by [@nomi9995](https://github.com/nomi9995)) <del>- ScrollView: Respect `contentInset` when animating new items with `autoscrollToTopThreshold`, make `automaticallyAdjustKeyboardInsets` work with `autoscrollToTopThreshold` (includes vertical, vertical-inverted, horizontal and horizontal-inverted ScrollViews) ([6e903b07fa](https://github.com/facebook/react-native/commit/6e903b07fa8e8d9b78cae0e031bb8022f7a63195) by [@mrousavy](https://github.com/mrousavy)) <ide> - Added [`LSApplicationQueriesSchemes`](https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#//apple_ref/doc/uid/TP40009250-SW14) in info.plist with entries tel, telprompt, http, fb, geo ([b26f277262](https://github.com/facebook/react-native/commit/b26f2772624c863c91fa1ff627b481c92d7562fb) by [@utkarsh-dixit](https://github.com/utkarsh-dixit)) <ide> - Add `UIAccessibilityTraitUpdatesFrequently` to progressBar role ([1a42bd6e97](https://github.com/facebook/react-native/commit/1a42bd6e97ae44a3b38ca552865bac63a6f35da5) by [@jimmy623](https://github.com/jimmy623)) <ide> - Add `asdf-vm` support in `find-node.sh` ([3e7c310b1d](https://github.com/facebook/react-native/commit/3e7c310b1dcf5643920535eea70afa451888792a) by [@pastleo](https://github.com/pastleo))
1
Javascript
Javascript
remove test that belonged in ajaxtest.js
19b21ff10ae5f4800f367306cb589c5fe201eed3
<ide><path>src/jquery/coreTest.js <ide> test("removeAttr(String", function() { <ide> ok( $('#mark').removeAttr("class")[0].className == "", "remove class" ); <ide> }); <ide> <del>test("evalScripts() with no script elements", function() { <del> expect(2); <del> stop(); <del> $.ajax({ <del> url: 'data/text.php?' + new Date().getTime(), <del> success: function(data, status) { <del> ok ( true, 'before evalScripts()'); <del> jQuery('#foo').html(data).evalScripts(); <del> ok ( true, 'after evalScripts()'); <del> start(); <del> } <del> }); <del>});
1
Go
Go
fix runtime issue for testeventsfiltercontainer
07795c3f5db3aa8ff592b0606ab76d32db4c6d25
<ide><path>integration-cli/docker_cli_events_test.go <ide> func (s *DockerSuite) TestEventsFilterContainer(c *check.C) { <ide> nameID := make(map[string]string) <ide> <ide> for _, name := range []string{"container_1", "container_2"} { <del> out, _, err := runCommandWithOutput(exec.Command(dockerBinary, "run", "-d", "--name", name, "busybox", "true")) <add> out, _, err := runCommandWithOutput(exec.Command(dockerBinary, "run", "--name", name, "busybox", "true")) <add> if err != nil { <add> c.Fatalf("Error: %v, Output: %s", err, out) <add> } <add> id, err := inspectField(name, "Id") <ide> if err != nil { <ide> c.Fatal(err) <ide> } <del> nameID[name] = strings.TrimSpace(out) <del> waitInspect(name, "{{.State.Runing }}", "false", 5) <add> nameID[name] = id <ide> } <ide> <ide> until := fmt.Sprintf("%d", daemonTime(c).Unix())
1
Python
Python
add regression test for
1a735e0f1f079f79f3d5a673e3d641f3916f7ad1
<ide><path>spacy/tests/regression/test_issue3328.py <add># coding: utf-8 <add>from __future__ import unicode_literals <add> <add>import pytest <add>from spacy.matcher import Matcher <add>from spacy.tokens import Doc <add> <add> <add>@pytest.mark.xfail <add>def test_issue3328(en_vocab): <add> doc = Doc(en_vocab, words=["Hello", ",", "how", "are", "you", "doing", "?"]) <add> matcher = Matcher(en_vocab) <add> patterns = [ <add> [{"LOWER": {"IN": ["hello", "how"]}}], <add> [{"LOWER": {"IN": ["you", "doing"]}}], <add> ] <add> matcher.add("TEST", None, *patterns) <add> matches = matcher(doc) <add> assert len(matches) == 4 <add> matched_texts = [doc[start:end].text for _, start, end in matches] <add> assert matched_texts == ["Hello", "how", "you", "doing"]
1
Javascript
Javascript
remove extra debugs
fa47ed9afbeb977b37b1f2e1d25df06876c9d2c5
<ide><path>common/models/user.js <ide> module.exports = function(User) { <ide> } <ide> }) <ide> .flatMap(({ progressTimestamps = [] }) => { <del> debug('progressTimestamps', progressTimestamps); <ide> return Observable.from(progressTimestamps); <ide> }) <ide> // filter out non objects <ide> .filter((timestamp) => !!timestamp || typeof timestamp === 'object') <ide> // filterout timestamps older then an hour <ide> .filter(({ timestamp = 0 }) => { <del> debug('timestamp', timestamp); <ide> return timestamp >= oneHourAgo; <ide> }) <ide> // filter out brownie points given by giver <ide> .filter((browniePoint) => { <del> debug('browniePoint', browniePoint); <ide> return browniePoint.giver === giver; <ide> }) <ide> // no results means this is the first brownie point given by giver <ide> // so return -1 to indicate receiver should receive point <ide> .firstOrDefault(null, -1) <ide> .flatMap((browniePointsFromGiver) => { <del> debug('bronie points from giver', browniePointsFromGiver, giver); <ide> if (browniePointsFromGiver === -1) { <ide> <ide> return user$.flatMap((user) => {
1
Ruby
Ruby
allow formula names with '+' in them
53d6f617d7246a40c8991653a6b166ec320880c2
<ide><path>Library/Homebrew/formula.rb <ide> def std_cmake_parameters <ide> <ide> def self.class_s name <ide> #remove invalid characters and camelcase <del> name.capitalize.gsub(/[-_\s]([a-zA-Z0-9])/) { $1.upcase } <add> name.capitalize.gsub(/[-_\s]([a-zA-Z0-9])/) { $1.upcase }.gsub('+', 'x') <ide> end <ide> <ide> def self.factory name
1
Text
Text
add russian translation for introduction of tips
4dd44e77f8fc368218f3c1f22f32263cc6cbd7b7
<ide><path>docs/tips/01-introduction.ru-RU.md <add>--- <add>id: introduction-ru-RU <add>title: Введение <add>layout: tips <add>permalink: tips/introduction-ru-RU.html <add>next: inline-styles.html <add>--- <add> <add>Данный раздел советов по React содержит краткую информацию, которая поможет ответить на многие ваши вопросы и предостеречь вас от распространенных ошибок. <add> <add>## Как принять участие <add> <add>Отправьте pull request в [репозиторий React](https://github.com/facebook/react) следуя [данной инструкции](https://github.com/facebook/react/tree/master/docs). Если у вас есть решение, которое нуждается в обсуждении перед тем как сделать PR, вы можете обратиться за помощью на [#reactjs канал на freenode](irc://chat.freenode.net/reactjs) или [discuss.reactjs.org форум](https://discuss.reactjs.org/).
1
PHP
PHP
consolidate doc block lines around chaining
48a61305d6e1c2150c8c40fc6a22b548f04697a8
<ide><path>src/Database/Expression/FunctionExpression.php <ide> public function __construct($name, $params = [], $types = []) { <ide> * if no value is passed it will return current name <ide> * <ide> * @param string $name The name of the function <del> * @return string <add> * @return string|$this <ide> */ <ide> public function name($name = null) { <ide> if ($name === null) { <ide> public function name($name = null) { <ide> * passed arguments <ide> * @param bool $prepend Whether to prepend or append to the list of arguments <ide> * @see FunctionExpression::__construct() for more details. <del> * @return FunctionExpression <add> * @return $this <ide> */ <ide> public function add($params, $types = [], $prepend = false) { <ide> $put = $prepend ? 'array_unshift' : 'array_push'; <ide><path>src/Database/Expression/ValuesExpression.php <ide> public function add($data) { <ide> * the currently stored columns <ide> * <ide> * @param array $cols arrays with columns to be inserted <del> * @return array|ValuesExpression <add> * @return array|$this <ide> */ <ide> public function columns($cols = null) { <ide> if ($cols === null) { <ide> public function columns($cols = null) { <ide> * the currently stored values <ide> * <ide> * @param array $values arrays with values to be inserted <del> * @return array|ValuesExpression <add> * @return array|$this <ide> */ <ide> public function values($values = null) { <ide> if ($values === null) { <ide><path>src/Database/Schema/Table.php <ide> public function name() { <ide> * <ide> * @param string $name The name of the column <ide> * @param array $attrs The attributes for the column. <del> * @return Table this <add> * @return $this <ide> */ <ide> public function addColumn($name, $attrs) { <ide> if (is_string($attrs)) { <ide> public function defaultValues() { <ide> * <ide> * @param string $name The name of the index. <ide> * @param array $attrs The attributes for the index. <del> * @return Table this <add> * @return $this <ide> * @throws \Cake\Database\Exception <ide> */ <ide> public function addIndex($name, $attrs) { <ide> public function primaryKey() { <ide> * <ide> * @param string $name The name of the constraint. <ide> * @param array $attrs The attributes for the constraint. <del> * @return Table this <add> * @return $this <ide> * @throws \Cake\Database\Exception <ide> */ <ide> public function addConstraint($name, $attrs) { <ide><path>src/Datasource/EntityTrait.php <ide> public function __unset($property) { <ide> * first argument is also an array, in which case will be treated as $options <ide> * @param array $options options to be used for setting the property. Allowed option <ide> * keys are `setter` and `guard` <del> * @return \Cake\Datasource\EntityInterface this object <add> * @return $this <ide> * @throws \InvalidArgumentException <ide> */ <ide> public function set($property, $value = null, $options = []) { <ide> public function getOriginal($property) { <ide> * $entity->has('last_name'); // false <ide> * }}} <ide> * <del> * When checking multiple properties. All properties must not be null <add> * When checking multiple properties. All properties must not be null <ide> * in order for true to be returned. <ide> * <ide> * @param string|array $property The property or properties to check. <ide> public function has($property) { <ide> * }}} <ide> * <ide> * @param string|array $property The property to unset. <del> * @return \Cake\DataSource\EntityInterface <add> * @return $this <ide> */ <ide> public function unsetProperty($property) { <ide> $property = (array)$property; <ide> public function unsetProperty($property) { <ide> * will be returned. Otherwise the hidden properties will be set. <ide> * <ide> * @param null|array $properties Either an array of properties to hide or null to get properties <del> * @return array|\Cake\DataSource\EntityInterface <add> * @return array|$this <ide> */ <ide> public function hiddenProperties($properties = null) { <ide> if ($properties === null) { <ide> public function hiddenProperties($properties = null) { <ide> * will be returned. Otherwise the virtual properties will be set. <ide> * <ide> * @param null|array $properties Either an array of properties to treat as virtual or null to get properties <del> * @return array|\Cake\DataSource\EntityInterface <add> * @return array|$this <ide> */ <ide> public function virtualProperties($properties = null) { <ide> if ($properties === null) { <ide> public function validate(Validator $validator) { <ide> * <ide> * @param string|array $field The field to get errors for, or the array of errors to set. <ide> * @param string|array $errors The errors to be set for $field <del> * @return array|\Cake\Datasource\EntityInterface <add> * @return array|$this <ide> */ <ide> public function errors($field = null, $errors = null) { <ide> if ($field === null) { <ide> protected function _readError($object, $path = null) { <ide> * @param string|array $property single or list of properties to change its accessibility <ide> * @param bool $set true marks the property as accessible, false will <ide> * mark it as protected. <del> * @return \Cake\Datasource\EntityInterface|bool <add> * @return $this|bool <ide> */ <ide> public function accessible($property, $set = null) { <ide> if ($set === null) { <ide><path>src/Datasource/QueryTrait.php <ide> trait QueryTrait { <ide> * and this query object will be returned for chaining. <ide> * <ide> * @param \Cake\Datasource\RepositoryInterface $table The default table object to use <del> * @return \Cake\Datasource\RepositoryInterface|\Cake\ORM\Query <add> * @return \Cake\Datasource\RepositoryInterface|$this <ide> */ <ide> public function repository(RepositoryInterface $table = null) { <ide> if ($table === null) { <ide> public function repository(RepositoryInterface $table = null) { <ide> * This method is most useful when combined with results stored in a persistent cache. <ide> * <ide> * @param \Cake\Datasource\ResultSetInterface $results The results this query should return. <del> * @return \Cake\ORM\Query The query instance. <add> * @return $this The query instance. <ide> */ <ide> public function setResult($results) { <ide> $this->_results = $results; <ide> public function getIterator() { <ide> * When using a function, this query instance will be supplied as an argument. <ide> * @param string|\Cake\Cache\CacheEngine $config Either the name of the cache config to use, or <ide> * a cache config instance. <del> * @return \Cake\Datasource\QueryTrait This same object <add> * @return $this This instance <ide> */ <ide> public function cache($key, $config = 'default') { <ide> if ($key === false) { <ide> public function cache($key, $config = 'default') { <ide> * passed, the current configured query `_eagerLoaded` value is returned. <ide> * <ide> * @param bool $value Whether or not to eager load. <del> * @return \Cake\ORM\Query <add> * @return $this|\Cake\ORM\Query <ide> */ <ide> public function eagerLoaded($value = null) { <ide> if ($value === null) { <ide> public function toArray() { <ide> * @param callable $mapper The mapper callable. <ide> * @param callable $reducer The reducing function. <ide> * @param bool $overwrite Set to true to overwrite existing map + reduce functions. <del> * @return \Cake\Datasource\QueryTrait|array <add> * @return $this|array <ide> * @see \Cake\Collection\Iterator\MapReduce for details on how to use emit data to the map reducer. <ide> */ <ide> public function mapReduce(callable $mapper = null, callable $reducer = null, $overwrite = false) { <ide> public function mapReduce(callable $mapper = null, callable $reducer = null, $ov <ide> * <ide> * @param callable $formatter The formatting callable. <ide> * @param bool|int $mode Whether or not to overwrite, append or prepend the formatter. <del> * @return \Cake\Datasource\QueryTrait|array <add> * @return $this|array <ide> */ <ide> public function formatResults(callable $formatter = null, $mode = 0) { <ide> if ($mode === self::OVERWRITE) { <ide><path>src/Model/Behavior/Translate/TranslateTrait.php <ide> trait TranslateTrait { <ide> * it. <ide> * <ide> * @param string $language Language to return entity for. <del> * @return \Cake\ORM\Entity <add> * @return $this|\Cake\ORM\Entity <ide> */ <ide> public function translation($language) { <ide> if ($language === $this->get('_locale')) { <ide><path>src/Network/Http/FormData.php <ide> public function newPart($name, $value) { <ide> * <ide> * @param string $name The name of the part. <ide> * @param mixed $value The value for the part. <del> * @return FormData this <add> * @return $this <ide> */ <ide> public function add($name, $value) { <ide> if (is_array($value)) { <ide> public function add($name, $value) { <ide> * Iterates the parameter and adds all the key/values. <ide> * <ide> * @param array $data Array of data to add. <del> * @return FormData this <add> * @return $this <ide> */ <ide> public function addMany(array $data) { <ide> foreach ($data as $name => $value) { <ide><path>src/Network/Http/Request.php <ide> class Request extends Message { <ide> * Get/Set the HTTP method. <ide> * <ide> * @param string|null $method The method for the request. <del> * @return mixed Either this or the current method. <add> * @return $this|string Either this or the current method. <ide> * @throws \Cake\Core\Exception\Exception On invalid methods. <ide> */ <ide> public function method($method = null) { <ide> public function method($method = null) { <ide> * Get/Set the url for the request. <ide> * <ide> * @param string|null $url The url for the request. Leave null for get <del> * @return mixed Either $this or the url value. <add> * @return $this|string Either $this or the url value. <ide> */ <ide> public function url($url = null) { <ide> if ($url === null) { <ide><path>src/Validation/ValidationSet.php <ide> public function rules() { <ide> * <ide> * @param string $name The name under which the rule should be set <ide> * @param \Cake\Validation\ValidationRule|array $rule The validation rule to be set <del> * @return \Cake\Validation\ValidationSet this instance <add> * @return $this <ide> */ <ide> public function add($name, $rule) { <ide> if (!($rule instanceof ValidationRule)) { <ide> public function add($name, $rule) { <ide> * }}} <ide> * <ide> * @param string $name The name under which the rule should be unset <del> * @return \Cake\Validation\ValidationSet this instance <add> * @return $this <ide> */ <ide> public function remove($name) { <ide> unset($this->_rules[$name]); <ide><path>src/Validation/Validator.php <ide> public function hasField($name) { <ide> * <ide> * @param string $name The name under which the provider should be set. <ide> * @param null|object|string $object Provider object or class name. <del> * @return Validator|object|string|null <add> * @return $this|object|string|null <ide> */ <ide> public function provider($name, $object = null) { <ide> if ($object === null) { <ide> public function count() { <ide> * @param string $field The name of the field from which the rule will be removed <ide> * @param array|string $name The alias for a single rule or multiple rules array <ide> * @param array|\Cake\Validation\ValidationRule $rule the rule to add <del> * @return Validator this instance <add> * @return $this <ide> */ <ide> public function add($field, $name, $rule = []) { <ide> $field = $this->field($field); <ide> public function add($field, $name, $rule = []) { <ide> * <ide> * @param string $field The name of the field from which the rule will be removed <ide> * @param string $rule the name of the rule to be removed <del> * @return Validator this instance <add> * @return $this <ide> */ <ide> public function remove($field, $rule = null) { <ide> if ($rule === null) { <ide> public function remove($field, $rule = null) { <ide> * @param string $field the name of the field <ide> * @param bool|string $mode Valid values are true, false, 'create', 'update' <ide> * @param string $message The message to show if the field presence validation fails. <del> * @return Validator this instance <add> * @return $this <ide> */ <ide> public function requirePresence($field, $mode = true, $message = null) { <ide> $this->field($field)->isPresenceRequired($mode); <ide> public function requirePresence($field, $mode = true, $message = null) { <ide> * @param string $field the name of the field <ide> * @param bool|string $mode Valid values are true, false, 'create', 'update' <ide> * @param string $message The message to show if the field presence validation fails. <del> * @return Validator this instance <add> * @return $this <ide> * @deprecated 3.0.0 Will be removed in 3.0.0. <ide> */ <ide> public function validatePresence($field, $mode = true, $message = null) { <ide> public function validatePresence($field, $mode = true, $message = null) { <ide> * @param bool|string|callable $when Indicates when the field is allowed to be empty <ide> * Valid values are true (always), 'create', 'update'. If a callable is passed then <ide> * the field will allowed to be empty only when the callaback returns true. <del> * @return Validator this instance <add> * @return $this <ide> */ <ide> public function allowEmpty($field, $when = true) { <ide> $this->field($field)->isEmptyAllowed($when); <ide> public function allowEmpty($field, $when = true) { <ide> * to be empty. Valid values are true (always), 'create', 'update'. If a <ide> * callable is passed then the field will allowed be empty only when <ide> * the callaback returns false. <del> * @return Validator this instance <add> * @return $this <ide> */ <ide> public function notEmpty($field, $message = null, $when = false) { <ide> if ($when === 'create' || $when === 'update') { <ide><path>src/View/Helper/StringTemplateTrait.php <ide> trait StringTemplateTrait { <ide> * <ide> * @param string|null|array $templates null or string allow reading templates. An array <ide> * allows templates to be added. <del> * @return void|string|array <add> * @return $this|string|array <ide> */ <ide> public function templates($templates = null) { <ide> if ($templates === null || is_string($templates)) {
11
Text
Text
remove whitespace in docs
7342f56c8d427832ccd29fe25c7be8529631c6df
<ide><path>docs/basics/UsageWithReact.md <ide> export default class App extends Component { <ide> { <ide> text: 'Use Redux', <ide> completed: true <del> }, <add> }, <ide> { <ide> text: 'Learn to connect it to React', <ide> completed: false
1
Ruby
Ruby
fix the named_scope deprecation notice
8ba2902dd4c3e9a3715130c499d78c4fc79fbf16
<ide><path>activerecord/lib/active_record/named_scope.rb <ide> def scope(name, options = {}, &block) <ide> end <ide> <ide> def named_scope(*args, &block) <del> ActiveSupport::Deprecation.warn("Base#named_scope has been deprecated, please use Base.scope instead.", caller) <add> ActiveSupport::Deprecation.warn("Base.named_scope has been deprecated, please use Base.scope instead.", caller) <ide> scope(*args, &block) <ide> end <ide> end
1
Javascript
Javascript
remove proptypes from maskedviewios.ios.js
8487e8fc45a6179d0f2345d20f7aad0ac7f5cf71
<ide><path>Libraries/Components/MaskedView/MaskedViewIOS.ios.js <ide> * @flow <ide> */ <ide> <del>const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes'); <del>const PropTypes = require('prop-types'); <ide> const React = require('React'); <ide> const StyleSheet = require('StyleSheet'); <ide> const View = require('View'); <ide> import type {ViewProps} from 'ViewPropTypes'; <ide> <ide> const RCTMaskedView = requireNativeComponent('RCTMaskedView'); <ide> <del>type Props = { <add>type Props = $ReadOnly<{| <ide> ...ViewProps, <ide> <del> children: any, <add> children: React.Node, <ide> /** <ide> * Should be a React element to be rendered and applied as the <ide> * mask for the child element. <ide> */ <ide> maskElement: React.Element<any>, <del>}; <add>|}>; <ide> <ide> /** <ide> * Renders the child view with a mask specified in the `maskElement` prop. <ide> type Props = { <ide> * <ide> */ <ide> class MaskedViewIOS extends React.Component<Props> { <del> static propTypes = { <del> ...DeprecatedViewPropTypes, <del> maskElement: PropTypes.element.isRequired, <del> }; <del> <ide> _hasWarnedInvalidRenderMask = false; <ide> <ide> render() {
1
Ruby
Ruby
checkout last branch when done
59f926cfd3da207d53e5ebc168fbff54a36edb6a
<ide><path>Library/Homebrew/dev-cmd/boneyard-formula-pr.rb <ide> def boneyard_formula_pr <ide> ohai "git push $HUB_REMOTE #{branch}:#{branch}" <ide> ohai "hub pull-request -m $'#{formula.name}: migrate to boneyard\\n\\nCreated with `brew boneyard-formula-pr`#{reason}.'" <ide> end <add> <add> ohai "git checkout -" <ide> else <ide> cd formula.tap.path <ide> safe_system "git", "checkout", "--no-track", "-b", branch, "origin/master" <ide> def boneyard_formula_pr <ide> EOS <ide> pr_url = Utils.popen_read("hub", "pull-request", "-m", pr_message).chomp <ide> end <add> <add> safe_system "git", "checkout", "-" <ide> end <ide> <ide> if ARGV.dry_run? <ide> def boneyard_formula_pr <ide> ohai "git push $HUB_REMOTE #{branch}:#{branch}" <ide> ohai "hub pull-request --browse -m $'#{formula.name}: migrate from #{formula.tap.repo}\\n\\nGoes together with $PR_URL\\n\\nCreated with `brew boneyard-formula-pr`#{reason}.'" <ide> end <add> <add> ohai "git checkout -" <ide> else <ide> cd boneyard_tap.formula_dir <ide> safe_system "git", "checkout", "--no-track", "-b", branch, "origin/master" <ide> def boneyard_formula_pr <ide> Created with `brew boneyard-formula-pr`#{reason}. <ide> EOS <ide> end <add> <add> safe_system "git", "checkout", "-" <ide> end <ide> end <ide> end
1
Ruby
Ruby
use regex captures instead of string#split
b2870c2480744aa7d202c4975e3169b05035f7ed
<ide><path>Library/Homebrew/cask/lib/hbc/qualified_token.rb <ide> module Hbc <ide> module QualifiedToken <ide> def self.parse(arg) <ide> return nil unless arg.is_a?(String) <del> return nil unless arg.downcase =~ HOMEBREW_TAP_CASK_REGEX <del> # eg caskroom/cask/google-chrome <del> # per https://github.com/Homebrew/brew/blob/master/docs/brew-tap.md <del> user, repo, token = arg.downcase.split("/") <add> return nil unless match = arg.downcase.match(HOMEBREW_TAP_CASK_REGEX) <add> user, repo, token = match.captures <ide> odebug "[user, repo, token] might be [#{user}, #{repo}, #{token}]" <ide> [user, repo, token] <ide> end
1
Javascript
Javascript
unbreak doc generation for sectionlist
e50464d1d79b936a84e0e59a02b408c69536fb93
<ide><path>Libraries/Lists/SectionList.js <ide> type OptionalProps<SectionT: SectionBase<any>> = { <ide> legacyImplementation?: ?boolean, <ide> }; <ide> <del>export type Props<SectionT> = { <del> ...$Exact<RequiredProps<SectionT>>, <del> ...$Exact<OptionalProps<SectionT>>, <del> ...$Exact<VirtualizedSectionListProps<SectionT>>, <del>}; <add>export type Props<SectionT> = RequiredProps<SectionT> & <add> OptionalProps<SectionT> & <add> VirtualizedSectionListProps<SectionT>; <add> <ide> const defaultProps = { <ide> ...VirtualizedSectionList.defaultProps, <ide> stickySectionHeadersEnabled: Platform.OS === 'ios',
1
Ruby
Ruby
use regexp instead exact match for atom test
82e478836f593d481a949381c50e351d4327b5ae
<ide><path>actionview/test/template/atom_feed_helper_test.rb <ide> def test_feed_xml_processing_instructions_duplicate_targets <ide> end <ide> <ide> def test_feed_xhtml <del> skip "Pending. There are two xml namespaces in the response body, as such Nokogiri doesn't know which one to pick and can't find the elements." <ide> with_restful_routing(:scrolls) do <ide> get :index, :id => "feed_with_xhtml_content" <ide> assert_match %r{xmlns="http://www.w3.org/1999/xhtml"}, @response.body <del> assert_select "summary div p", :text => "Something Boring" <del> assert_select "summary div p", :text => "after 2" <add> assert_select "summary", :text => /Something Boring/ <add> assert_select "summary", :text => /after 2/ <ide> end <ide> end <ide>
1
PHP
PHP
extract removable symlink check to method
e4b509e6571bbdc99db0725ce3ca897d47afccf1
<ide><path>src/Illuminate/Foundation/Console/StorageLinkCommand.php <ide> public function handle() <ide> $force = $this->option('force'); <ide> <ide> foreach ($this->links() as $link => $target) { <del> if (file_exists($link) && ! (is_link($link) && $force)) { <add> if (file_exists($link) && ! $this->removableSymlink($link, $force)) { <ide> $this->error("The [$link] link already exists."); <ide> continue; <ide> } <ide> protected function links() <ide> return $this->laravel['config']['filesystems.links'] ?? <ide> [public_path('storage') => storage_path('app/public')]; <ide> } <add> <add> /** <add> * Checks that the provided path is a symlink and force option is turned on. <add> * <add> * @param string $link <add> * @param bool $force <add> * @return bool <add> */ <add> protected function removableSymlink(string $link, bool $force): bool <add> { <add> return is_link($link) && $force; <add> } <ide> }
1
Ruby
Ruby
fix rails root in sqlite adapter
4cebd41d9e9764b29a5673a298a71b0c530b2bf6
<ide><path>activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb <ide> def parse_sqlite_config!(config) <ide> raise ArgumentError, "No database file specified. Missing argument: database" <ide> end <ide> <del> # Allow database path relative to RAILS_ROOT, but only if <add> # Allow database path relative to Rails.root, but only if <ide> # the database path is not the special path that tells <ide> # Sqlite to build a database only in memory. <del> if Object.const_defined?(:RAILS_ROOT) && ':memory:' != config[:database] <del> config[:database] = File.expand_path(config[:database], RAILS_ROOT) <add> if Object.const_defined?(:Rails) && ':memory:' != config[:database] <add> config[:database] = File.expand_path(config[:database], Rails.root) <ide> end <ide> end <ide> end
1
Ruby
Ruby
add aliases for reverse_merge to with_defaults
0117810cdab34d168b0579a6736c5d58c5ab84c7
<ide><path>actionpack/lib/action_controller/metal/strong_parameters.rb <ide> def reverse_merge(other_hash) <ide> other_hash.to_h.merge(@parameters) <ide> ) <ide> end <add> alias_method :with_defaults, :reverse_merge <ide> <ide> # Returns current <tt>ActionController::Parameters</tt> instance with <ide> # current hash merged into +other_hash+. <ide> def reverse_merge!(other_hash) <ide> @parameters.merge!(other_hash.to_h) { |key, left, right| left } <ide> self <ide> end <add> alias_method :with_defaults!, :reverse_merge! <ide> <ide> # This is required by ActiveModel attribute assignment, so that user can <ide> # pass +Parameters+ to a mass assignment methods in a model. It should not <ide><path>actionpack/test/controller/parameters/parameters_permit_test.rb <ide> def walk_permitted(params) <ide> refute_predicate merged_params[:person], :empty? <ide> end <ide> <add> test "#with_defaults is an alias of reverse_merge" do <add> default_params = ActionController::Parameters.new(id: "1234", person: {}).permit! <add> merged_params = @params.with_defaults(default_params) <add> <add> assert_equal "1234", merged_params[:id] <add> refute_predicate merged_params[:person], :empty? <add> end <add> <ide> test "not permitted is sticky beyond reverse_merge" do <ide> refute_predicate @params.reverse_merge(a: "b"), :permitted? <ide> end <ide> def walk_permitted(params) <ide> refute_predicate @params[:person], :empty? <ide> end <ide> <add> test "#with_defaults! is an alias of reverse_merge!" do <add> default_params = ActionController::Parameters.new(id: "1234", person: {}).permit! <add> @params.with_defaults!(default_params) <add> <add> assert_equal "1234", @params[:id] <add> refute_predicate @params[:person], :empty? <add> end <add> <ide> test "modifying the parameters" do <ide> @params[:person][:hometown] = "Chicago" <ide> @params[:person][:family] = { brother: "Jonas" } <ide><path>activesupport/lib/active_support/core_ext/hash/reverse_merge.rb <ide> class Hash <ide> def reverse_merge(other_hash) <ide> other_hash.merge(self) <ide> end <add> alias_method :with_defaults, :reverse_merge <ide> <ide> # Destructive +reverse_merge+. <ide> def reverse_merge!(other_hash) <ide> # right wins if there is no left <ide> merge!(other_hash) { |key, left, right| left } <ide> end <ide> alias_method :reverse_update, :reverse_merge! <add> alias_method :with_defaults!, :reverse_merge! <ide> end <ide><path>activesupport/lib/active_support/hash_with_indifferent_access.rb <ide> def merge(hash, &block) <ide> def reverse_merge(other_hash) <ide> super(self.class.new(other_hash)) <ide> end <add> alias_method :with_defaults, :reverse_merge <ide> <ide> # Same semantics as +reverse_merge+ but modifies the receiver in-place. <ide> def reverse_merge!(other_hash) <ide> replace(reverse_merge(other_hash)) <ide> end <add> alias_method :with_defaults!, :reverse_merge! <ide> <ide> # Replaces the contents of this hash with other_hash. <ide> # <ide><path>activesupport/test/core_ext/hash_ext_test.rb <ide> def test_indifferent_reverse_merging <ide> assert_equal "clobber", hash[:another] <ide> end <ide> <add> def test_indifferent_with_defaults_aliases_reverse_merge <add> hash = HashWithIndifferentAccess.new key: :old_value <add> actual = hash.with_defaults key: :new_value <add> assert_equal :old_value, actual[:key] <add> <add> hash = HashWithIndifferentAccess.new key: :old_value <add> hash.with_defaults! key: :new_value <add> assert_equal :old_value, hash[:key] <add> end <add> <ide> def test_indifferent_deleting <ide> get_hash = proc { { a: "foo" }.with_indifferent_access } <ide> hash = get_hash.call <ide> def test_reverse_merge <ide> assert_equal expected, merged <ide> end <ide> <add> def test_with_defaults_aliases_reverse_merge <add> defaults = { a: "x", b: "y", c: 10 }.freeze <add> options = { a: 1, b: 2 } <add> expected = { a: 1, b: 2, c: 10 } <add> <add> # Should be an alias for reverse_merge <add> assert_equal expected, options.with_defaults(defaults) <add> assert_not_equal expected, options <add> <add> # Should be an alias for reverse_merge! <add> merged = options.dup <add> assert_equal expected, merged.with_defaults!(defaults) <add> assert_equal expected, merged <add> end <add> <ide> def test_slice <ide> original = { a: "x", b: "y", c: 10 } <ide> expected = { a: "x", b: "y" }
5
Javascript
Javascript
move priority context change to findnextunitofwork
e1b733fa8382f74dd790964993856ce5a85bf363
<ide><path>src/renderers/shared/fiber/ReactFiberScheduler.js <ide> module.exports = function<T, P, I, TI, C, CX>(config : HostConfig<T, P, I, TI, C <ide> } <ide> } <ide> <add> // findNextUnitOfWork mutates the current priority context. It is reset after <add> // after the workLoop exits, so never call findNextUnitOfWork from outside <add> // the work loop. <ide> function findNextUnitOfWork() { <ide> // Clear out roots with no more work on them, or if they have uncaught errors <ide> while (nextScheduledRoot && nextScheduledRoot.current.pendingWorkPriority === NoWork) { <ide> module.exports = function<T, P, I, TI, C, CX>(config : HostConfig<T, P, I, TI, C <ide> } <ide> if (highestPriorityRoot) { <ide> nextPriorityLevel = highestPriorityLevel; <add> priorityContext = nextPriorityLevel; <ide> return cloneFiber( <ide> highestPriorityRoot.current, <ide> highestPriorityLevel <ide> module.exports = function<T, P, I, TI, C, CX>(config : HostConfig<T, P, I, TI, C <ide> ReactFiberInstrumentation.debugTool.onWillBeginWork(workInProgress); <ide> } <ide> // See if beginning this work spawns more work. <del> <del> priorityContextBeforeReconciliation = priorityContext; <del> priorityContext = nextPriorityLevel; <ide> let next = beginWork(current, workInProgress, nextPriorityLevel); <del> priorityContext = priorityContextBeforeReconciliation; <ide> <ide> if (__DEV__ && ReactFiberInstrumentation.debugTool) { <ide> ReactFiberInstrumentation.debugTool.onDidBeginWork(workInProgress); <ide> module.exports = function<T, P, I, TI, C, CX>(config : HostConfig<T, P, I, TI, C <ide> ReactFiberInstrumentation.debugTool.onWillBeginWork(workInProgress); <ide> } <ide> // See if beginning this work spawns more work. <del> priorityContextBeforeReconciliation = priorityContext; <del> priorityContext = nextPriorityLevel; <ide> let next = beginFailedWork(current, workInProgress, nextPriorityLevel); <del> priorityContext = priorityContextBeforeReconciliation; <ide> <ide> if (__DEV__ && ReactFiberInstrumentation.debugTool) { <ide> ReactFiberInstrumentation.debugTool.onDidBeginWork(workInProgress); <ide> module.exports = function<T, P, I, TI, C, CX>(config : HostConfig<T, P, I, TI, C <ide> // operations must happen within workLoop, which is extracted to a <ide> // separate function so that it can be optimized by the JS engine. <ide> try { <add> priorityContextBeforeReconciliation = priorityContext; <add> priorityContext = nextPriorityLevel; <ide> deadlineHasExpired = workLoop(priorityLevel, deadline, deadlineHasExpired); <ide> } catch (error) { <ide> // We caught an error during either the begin or complete phases. <ide> module.exports = function<T, P, I, TI, C, CX>(config : HostConfig<T, P, I, TI, C <ide> } <ide> // Continue performing work <ide> continue; <add> } finally { <add> priorityContext = priorityContextBeforeReconciliation; <ide> } <ide> <ide> // Stop performing work
1
Text
Text
add additional information to airflow release doc
7a9c03caaf5b954057f7a566b7406982e67f9749
<ide><path>dev/README_RELEASE_AIRFLOW.md <ide> - [Selecting what to cherry-pick](#selecting-what-to-cherry-pick) <ide> - [Reviewing cherry-picked PRs and assigning labels](#reviewing-cherry-picked-prs-and-assigning-labels) <ide> - [Prepare the Apache Airflow Package RC](#prepare-the-apache-airflow-package-rc) <add> - [Update the milestone](#update-the-milestone) <ide> - [Build RC artifacts](#build-rc-artifacts) <ide> - [[\Optional\] Prepare new release branches and cache](#%5Coptional%5C-prepare-new-release-branches-and-cache) <ide> - [Prepare PyPI convenience "snapshot" packages](#prepare-pypi-convenience-snapshot-packages) <ide> if you do this, update the milestone in the issue to the "next" minor release. <ide> Many issues will be marked with the target release as their Milestone; this is a good shortlist <ide> to start with for what to cherry-pick. <ide> <add>For a patch release, find out other bug fixes that are not marked with the target release as their Milestone <add>and mark those as well. You can accomplish this by running the following command: <add> <add>``` <add> ./dev/airflow-github needs-categorization 2.3.2 HEAD <add> ``` <add> <ide> Often you also want to cherry-pick changes related to CI and development tools, to include the latest <ide> stability fixes in CI and improvements in development tools. Usually you can see the list of such <ide> changes via (this will exclude already merged changes: <ide> You cn review the list of PRs cherry-picked and produce a nice summary with `--p <ide> assumes the `--skip-assigned` flag, so that the summary can be produced without questions: <ide> <ide> ```shell <del>,/dev/assign_cherry_picked_prs_with_milestone.py assign-prs --previous-release v2-2-stable \ <add>./dev/assign_cherry_picked_prs_with_milestone.py assign-prs --previous-release v2-2-stable \ <ide> --current-release apache/v2-2-test --milestone-number 48 --skip-assigned --assume-yes --print-summary \ <ide> --output-folder /tmp <ide> ``` <ide> git log apache/v2-2-test --format="%H" -- airflow/sensors/base.py | grep -f /tmp <ide> <ide> # Prepare the Apache Airflow Package RC <ide> <add>## Update the milestone <add> <add>Before cutting an RC, we should look at the milestone and merge anything ready, or if we aren't going to include it in the release we should update the milestone for those issues. We should do that before cutting the RC so the milestone gives us an accurate view of what is going to be in the release as soon as we know what it will be. <add> <ide> ## Build RC artifacts <ide> <ide> The Release Candidate artifacts we vote upon should be the exact ones we vote against, without any modification other than renaming – i.e. the contents of the files must be the same between voted release candidate and final release. Because of this the version in the built artifacts that will become the official Apache releases must not include the rcN suffix. <ide> The Release Candidate artifacts we vote upon should be the exact ones we vote ag <ide> - Make sure you have the latest CI image <ide> <ide> ```shell script <del> breeze pull-image --python 3.7 <add> breeze build-image --python 3.7 <ide> ``` <ide> <ide> - Tarball the repo
1
Python
Python
update animation.py
b4bc76723f85ef523fc5c7418184c461003ef5ab
<ide><path>utils/exporters/blender/addons/io_three/exporter/api/animation.py <ide> """ <ide> Module for handling the parsing of skeletal animation data. <add>updated on 2/07/2016: bones scaling support (@uthor verteAzur verteAzur@multivers3d.fr) <ide> """ <ide> <ide> import math <ide> def _parse_rest_action(action, armature, options): <ide> action, rotation_matrix) <ide> rot = _normalize_quaternion(rot) <ide> <add> sca, schange = _scale(bone, computed_frame, <add> action, armature.matrix_world) <add> <ide> pos_x, pos_y, pos_z = pos.x, pos.z, -pos.y <ide> rot_x, rot_y, rot_z, rot_w = rot.x, rot.z, -rot.y, rot.w <add> sca_x, sca_y, sca_z = sca.x, sca.z, sca.y <ide> <ide> if frame == start_frame: <ide> <ide> time = (frame * frame_step - start_frame) / fps <del> # @TODO: missing scale values <add> <ide> keyframe = { <ide> constants.TIME: time, <ide> constants.POS: [pos_x, pos_y, pos_z], <ide> constants.ROT: [rot_x, rot_y, rot_z, rot_w], <del> constants.SCL: [1, 1, 1] <add> constants.SCL: [sca_x, sca_y, sca_z] <ide> } <ide> keys.append(keyframe) <ide> <ide> def _parse_rest_action(action, armature, options): <ide> constants.TIME: time, <ide> constants.POS: [pos_x, pos_y, pos_z], <ide> constants.ROT: [rot_x, rot_y, rot_z, rot_w], <del> constants.SCL: [1, 1, 1] <add> constants.SCL: [sca_x, sca_y, sca_z] <ide> } <ide> keys.append(keyframe) <ide> <ide> # MIDDLE-FRAME: needs only one of the attributes, <ide> # can be an empty frame (optional frame) <ide> <del> elif pchange is True or rchange is True: <add> elif pchange is True or rchange is True or schange is True: <ide> <ide> time = (frame * frame_step - start_frame) / fps <ide> <ide> if pchange is True and rchange is True: <ide> keyframe = { <ide> constants.TIME: time, <ide> constants.POS: [pos_x, pos_y, pos_z], <del> constants.ROT: [rot_x, rot_y, rot_z, rot_w] <add> constants.ROT: [rot_x, rot_y, rot_z, rot_w], <add> constants.SCL: [sca_x, sca_y, sca_z] <ide> } <ide> elif pchange is True: <ide> keyframe = { <ide> def _parse_rest_action(action, armature, options): <ide> constants.TIME: time, <ide> constants.ROT: [rot_x, rot_y, rot_z, rot_w] <ide> } <add> elif schange is True: <add> keyframe = { <add> constants.TIME: time, <add> constants.SCL: [sca_x, sca_y, sca_z] <add> } <ide> <ide> keys.append(keyframe) <ide> <ide> def _rotation(bone, frame, action, armature_matrix): <ide> <ide> return rotation, change <ide> <add>def _scale(bone, frame, action, armature_matrix): <add> """ <add> <add> :param bone: <add> :param frame: <add> :param action: <add> :param armature_matrix: <add> <add> """ <add> scale = mathutils.Vector((0.0, 0.0, 0.0)) <add> <add> change = False <add> <add> ngroups = len(action.groups) <add> <add> # animation grouped by bones <add> <add> if ngroups > 0: <add> <add> index = -1 <add> <add> for i in range(ngroups): <add> if action.groups[i].name == bone.name: <add> <add> print(action.groups[i].name) <add> <add> index = i <add> <add> if index > -1: <add> for channel in action.groups[index].channels: <add> <add> if "scale" in channel.data_path: <add> has_changed = _handle_scale_channel( <add> channel, frame, scale) <add> change = change or has_changed <add> <add> # animation in raw fcurves <add> <add> else: <add> <add> bone_label = '"%s"' % bone.name <add> <add> for channel in action.fcurves: <add> data_path = channel.data_path <add> if bone_label in data_path and "scale" in data_path: <add> has_changed = _handle_scale_channel( <add> channel, frame, scale) <add> change = change or has_changed <add> <add> <add> #scale.xyz = armature_matrix * scale.xyz <add> <add> return scale, change <add> <ide> <ide> def _handle_rotation_channel(channel, frame, rotation): <ide> """ <ide> def _handle_position_channel(channel, frame, position): <ide> <ide> return change <ide> <add>def _handle_scale_channel(channel, frame, scale): <add> """ <add> <add> :param channel: <add> :param frame: <add> :param position: <add> <add> """ <add> change = False <add> <add> if channel.array_index in [0, 1, 2]: <add> for keyframe in channel.keyframe_points: <add> if keyframe.co[0] == frame: <add> change = True <add> <add> value = channel.evaluate(frame) <add> <add> if channel.array_index == 0: <add> scale.x = value <add> <add> if channel.array_index == 1: <add> scale.y = value <add> <add> if channel.array_index == 2: <add> scale.z = value <add> <add> return change <add> <ide> <ide> def _quaternion_length(quat): <ide> """Calculate the length of a quaternion
1
Javascript
Javascript
add comments to flagincludedchunksplugin
ff814e91b5ca90b2a7d69f4c370ebfbda658698c
<ide><path>lib/optimize/FlagIncludedChunksPlugin.js <ide> class FlagIncludedChunksPlugin { <ide> compilation.plugin("optimize-chunk-ids", (chunks) => { <ide> chunks.forEach((chunkA) => { <ide> chunks.forEach((chunkB) => { <add> // as we iterate the same iterables twice <add> // skip if we find ourselves <ide> if(chunkA === chunkB) return; <del> // is chunkB in chunkA? <add> <add> // instead of swapping A and B just bail <add> // as we loop twice the current A will be B and B then A <ide> if(chunkA.modules.length < chunkB.modules.length) return; <add> <add> // is chunkB in chunkA? <ide> for(let i = 0; i < chunkB.modules.length; i++) { <ide> if(chunkA.modules.indexOf(chunkB.modules[i]) < 0) return; <ide> }
1
Python
Python
test simple indexing for span
5cc2f2b01ab26e313a7035f998fc1b4373cb6cc5
<ide><path>tests/tokens/test_tokens_api.py <ide> def to_str(span): <ide> span = tokens[40:50] <ide> assert span.start == span.end == 7 and not to_str(span) <ide> <add> span = tokens[1:4] <add> assert span[0].orth_ == 'it' <add> <ide> <ide> @pytest.mark.models <ide> def test_serialize(EN):
1
Python
Python
move `importlib` fallback into compat
c5eb5b22018e55bffe080bb3f14e34ab6b493073
<ide><path>rest_framework/compat.py <ide> from django.utils import six <ide> import django <ide> import inspect <del> <add>try: <add> import importlib <add>except ImportError: <add> from django.utils import importlib <ide> <ide> def unicode_repr(instance): <ide> # Get the repr of an instance, but ensure it is a unicode string <ide><path>rest_framework/settings.py <ide> from __future__ import unicode_literals <ide> from django.test.signals import setting_changed <ide> from django.conf import settings <del>try: <del> import importlib <del>except ImportError: <del> from django.utils import importlib <ide> from django.utils import six <ide> from rest_framework import ISO_8601 <del> <add>from rest_framework.compat import importlib <ide> <ide> USER_SETTINGS = getattr(settings, 'REST_FRAMEWORK', None) <ide>
2
Python
Python
use s3 location for xlm-roberta model
5c5f67a256b558b470f03cf36edc5ea35dec2fba
<ide><path>transformers/modeling_xlm_roberta.py <ide> logger = logging.getLogger(__name__) <ide> <ide> XLM_ROBERTA_PRETRAINED_MODEL_ARCHIVE_MAP = { <del> 'xlm-roberta-base': "https://schweter.eu/cloud/transformers/xlm-roberta-base-pytorch_model.bin", <del> 'xlm-roberta-large': "https://schweter.eu/cloud/transformers/xlm-roberta-large-pytorch_model.bin", <add> 'xlm-roberta-base': "https://s3.amazonaws.com/models.huggingface.co/bert/xlm-roberta-base-pytorch_model.bin", <add> 'xlm-roberta-large': "https://s3.amazonaws.com/models.huggingface.co/bert/xlm-roberta-large-pytorch_model.bin", <ide> } <ide> <ide>
1
Javascript
Javascript
provide full cert details to checkserveridentity
853f0bdf1908f754a0e7a7486339e79578c2c68b
<ide><path>lib/_tls_wrap.js <ide> function onConnectSecure() { <ide> options.host || <ide> (options.socket && options.socket._host) || <ide> 'localhost'; <del> const cert = this.getPeerCertificate(); <add> const cert = this.getPeerCertificate(true); <ide> verifyError = options.checkServerIdentity(hostname, cert); <ide> } <ide>
1
Python
Python
fix the rest of the flake8 errors
5867895d6eb162066dc8b4a188e36345016745ff
<ide><path>celery/app/trace.py <ide> def get_log_policy(task, einfo, exc): <ide> <ide> def get_task_name(request, default): <ide> """Use 'shadow' in request for the task name if applicable.""" <del> # request.shadow could be None or an empty string. If so, we should use default. <add> # request.shadow could be None or an empty string. <add> # If so, we should use default. <ide> return getattr(request, 'shadow', None) or default <ide> <ide> <ide> def trace_task(uuid, args, kwargs, request=None): <ide> send_success(sender=task, result=retval) <ide> if _does_info: <ide> info(LOG_SUCCESS, { <del> 'id': uuid, 'name': get_task_name(task_request, name), <del> 'return_value': Rstr, 'runtime': T, <add> 'id': uuid, <add> 'name': get_task_name(task_request, name), <add> 'return_value': Rstr, <add> 'runtime': T, <ide> }) <ide> <ide> # -* POST *-
1
Text
Text
fix references to cli
95870ef3349920efc981a703d52f5832b79ee18e
<ide><path>docs/sources/reference/run.md <ide> its own networking, and its own isolated process tree. The <ide> defaults related to the binary to run, the networking to expose, and <ide> more, but `docker run` gives final control to the operator who starts <ide> the container from the image. That's the main reason <del>[*run*](/reference/commandline/cli/#cli-run) has more options than any <add>[*run*](/reference/commandline/cli/#run) has more options than any <ide> other `docker` command. <ide> <ide> ## General Form <ide> The basic `docker run` command takes this form: <ide> $ docker run [OPTIONS] IMAGE[:TAG] [COMMAND] [ARG...] <ide> <ide> To learn how to interpret the types of `[OPTIONS]`, <del>see [*Option types*](/reference/commandline/cli/#cli-options). <add>see [*Option types*](/reference/commandline/cli/#option-types). <ide> <ide> The list of `[OPTIONS]` breaks down into two groups: <ide>
1
Ruby
Ruby
add azure to the available services list
b334ac80cf07d4ce6ba20b3ee45c3e58711f9a91
<ide><path>activestorage/lib/active_storage/service.rb <ide> # * +Disk+, to manage attachments saved directly on the hard drive. <ide> # * +GCS+, to manage attachments through Google Cloud Storage. <ide> # * +S3+, to manage attachments through Amazon S3. <add># * +Azure+, to manage attachments through Microsoft Azure Storage. <ide> # * +Mirror+, to be able to use several services to manage attachments. <ide> # <ide> # Inside a Rails application, you can set-up your services through the
1
PHP
PHP
fix a phpdoc typo
36baff397d6ef4cb0f3980cdfeacc90fe3661b67
<ide><path>src/Illuminate/Support/Facades/Blade.php <ide> * @method static bool check(string $name, array ...$parameters) <ide> * @method static void component(string $class, string|null $alias = null, string $prefix = '') <ide> * @method static void components(array $components, string $prefix = '') <del> * @method statuc array getClassComponentAliases() <add> * @method static array getClassComponentAliases() <ide> * @method static void aliasComponent(string $path, string|null $alias = null) <ide> * @method static void include(string $path, string|null $alias = null) <ide> * @method static void aliasInclude(string $path, string|null $alias = null)
1
Javascript
Javascript
add custom annotations to the controller
7e112c1fc3ab5651e9a36aa024200dc82b18a05d
<ide><path>src/ng/compile.js <ide> function $CompileProvider($provide, $$sanitizeUriProvider) { <ide> * See {@link ng.$compile#-bindtocontroller- `bindToController`}. <ide> * - `transclude` – `{boolean=}` – whether {@link $compile#transclusion content transclusion} is enabled. <ide> * Disabled by default. <del> * - `$...` – `{function()=}` – additional annotations to provide to the directive factory function. <add> * - `$...` – additional properties to attach to the directive factory function and the controller <add> * constructor function. (This is used by the component router to annotate) <ide> * <ide> * @returns {ng.$compileProvider} the compile provider itself, for chaining of function calls. <ide> * @description <ide> function $CompileProvider($provide, $$sanitizeUriProvider) { <ide> forEach(options, function(val, key) { <ide> if (key.charAt(0) === '$') { <ide> factory[key] = val; <add> controller[key] = val; <ide> } <ide> }); <ide> <ide><path>test/ng/compileSpec.js <ide> describe('$compile', function() { <ide> })); <ide> }); <ide> <add> it('should add additional annotations to the controller constructor', function() { <add> var myModule = angular.module('my', []).component('myComponent', { <add> $canActivate: 'canActivate', <add> $routeConfig: 'routeConfig', <add> $customAnnotation: 'XXX' <add> }); <add> module('my'); <add> inject(function(myComponentDirective) { <add> expect(myComponentDirective[0].controller).toEqual(jasmine.objectContaining({ <add> $canActivate: 'canActivate', <add> $routeConfig: 'routeConfig', <add> $customAnnotation: 'XXX' <add> })); <add> }); <add> }); <add> <ide> it('should return ddo with reasonable defaults', function() { <ide> angular.module('my', []).component('myComponent', {}); <ide> module('my');
2
Text
Text
fix a typo in the pr template
4d33285d90ec0587c3517f2a8339cd830f68372b
<ide><path>.github/PULL_REQUEST_TEMPLATE.md <ide> - [ ] I have read [freeCodeCamp's contribution guidelines](https://github.com/freeCodeCamp/freeCodeCamp/blob/master/CONTRIBUTING.md). <ide> - [ ] My pull request has a descriptive title (not a vague title like `Update index.md`) <ide> - [ ] My pull request targets the `master` branch of freeCodeCamp. <del>- [ ] None of my changes are plagiarized from another source without proper attirbution. <add>- [ ] None of my changes are plagiarized from another source without proper attribution. <ide> - [ ] My article does not contain shortened URLs or affiliate links. <ide> <ide> If your pull request addresses a currently open issue, replace the XXXXX below with that issue number.
1
Javascript
Javascript
fix euler accessors
e0f8526922ae92a9e3eb289c58e9a19ba92de6f6
<ide><path>src/math/Euler.js <ide> Euler.RotationOrders = [ 'XYZ', 'YZX', 'ZXY', 'XZY', 'YXZ', 'ZYX' ]; <ide> <ide> Euler.DefaultOrder = 'XYZ'; <ide> <del>Object.assign( Euler.prototype, { <add>Object.defineProperties( Euler.prototype, { <ide> <del> constructor: Euler, <add> "x" : { <ide> <del> isEuler: true, <add> get: function () { <ide> <del> get x () { <add> return this._x; <ide> <del> return this._x; <add> }, <ide> <del> }, <add> set: function ( value ) { <ide> <del> set x ( value ) { <add> this._x = value; <add> this.onChangeCallback(); <ide> <del> this._x = value; <del> this.onChangeCallback(); <add> } <ide> <ide> }, <ide> <del> get y () { <add> "y" : { <ide> <del> return this._y; <add> get: function () { <ide> <del> }, <add> return this._y; <ide> <del> set y ( value ) { <add> }, <ide> <del> this._y = value; <del> this.onChangeCallback(); <add> set: function ( value ) { <add> <add> this._y = value; <add> this.onChangeCallback(); <add> <add> } <ide> <ide> }, <ide> <del> get z () { <add> "z" : { <ide> <del> return this._z; <add> get: function () { <ide> <del> }, <add> return this._z; <ide> <del> set z ( value ) { <add> }, <ide> <del> this._z = value; <del> this.onChangeCallback(); <add> set: function ( value ) { <add> <add> this._z = value; <add> this.onChangeCallback(); <add> <add> } <ide> <ide> }, <ide> <del> get order () { <add> "order" : { <ide> <del> return this._order; <add> get: function () { <ide> <del> }, <add> return this._order; <ide> <del> set order ( value ) { <add> }, <ide> <del> this._order = value; <del> this.onChangeCallback(); <add> set: function ( value ) { <ide> <del> }, <add> this._order = value; <add> this.onChangeCallback(); <add> <add> } <add> <add> } <add> <add>}); <add> <add>Object.assign( Euler.prototype, { <add> <add> constructor: Euler, <add> <add> isEuler: true, <ide> <ide> set: function ( x, y, z, order ) { <ide>
1
PHP
PHP
fix issues with sqlserver + boolean columns
4e67698506ea489532dd6bd662f2c38c09f4f90a
<ide><path>lib/Cake/Model/Datasource/Database/Sqlserver.php <ide> public function insertMulti($table, $fields, $values) { <ide> /** <ide> * Generate a database-native column schema string <ide> * <del> * @param array $column An array structured like the following: array('name'=>'value', 'type'=>'value'[, options]), <add> * @param array $column An array structured like the <add> * following: array('name'=>'value', 'type'=>'value'[, options]), <ide> * where options can be 'default', 'length', or 'key'. <ide> * @return string <ide> */ <ide> public function buildColumn($column) { <del> $result = preg_replace('/(int|integer)\([0-9]+\)/i', '$1', parent::buildColumn($column)); <add> $result = parent::buildColumn($column); <add> $result = preg_replace('/(int|integer)\([0-9]+\)/i', '$1', $result); <add> $result = preg_replace('/(bit)\([0-9]+\)/i', '$1', $result); <ide> if (strpos($result, 'DEFAULT NULL') !== false) { <ide> if (isset($column['default']) && $column['default'] === '') { <ide> $result = str_replace('DEFAULT NULL', "DEFAULT ''", $result); <ide><path>lib/Cake/Test/Case/Model/Datasource/Database/SqlserverTest.php <ide> public function testBuildColumn() { <ide> $result = $this->db->buildColumn($column); <ide> $expected = '[body] nvarchar(MAX)'; <ide> $this->assertEquals($expected, $result); <add> <add> $column = array( <add> 'name' => 'checked', <add> 'type' => 'boolean', <add> 'length' => 10, <add> 'default' => '1' <add> ); <add> $result = $this->db->buildColumn($column); <add> $expected = "[checked] bit DEFAULT '1'"; <add> $this->assertEquals($expected, $result); <ide> } <ide> <ide> /**
2
Javascript
Javascript
pass initial props to wrappercomponent
4f5a092bf68a0cd825328ce4a1e6bb41a8fad2e3
<ide><path>Libraries/ReactNative/AppContainer.js <ide> type Props = $ReadOnly<{| <ide> children?: React.Node, <ide> fabric?: boolean, <ide> rootTag: number, <add> initialProps?: {...}, <ide> showArchitectureIndicator?: boolean, <ide> WrapperComponent?: ?React.ComponentType<any>, <ide> internal_excludeLogBox?: ?boolean, <ide> class AppContainer extends React.Component<Props, State> { <ide> if (Wrapper != null) { <ide> innerView = ( <ide> <Wrapper <add> initialProps={this.props.initialProps} <ide> fabric={this.props.fabric === true} <ide> showArchitectureIndicator={ <ide> this.props.showArchitectureIndicator === true <ide><path>Libraries/ReactNative/renderApplication.js <ide> function renderApplication<Props: Object>( <ide> fabric={fabric} <ide> showArchitectureIndicator={showArchitectureIndicator} <ide> WrapperComponent={WrapperComponent} <add> initialProps={initialProps} <ide> internal_excludeLogBox={isLogBox}> <ide> <RootComponent {...initialProps} rootTag={rootTag} /> <ide> </AppContainer>
2
PHP
PHP
remove extra space in htmlhelper radio tag
c34bf673d5eec7e133748deab89635973cffa28f
<ide><path>lib/Cake/View/Helper/CacheHelper.php <ide> protected function _writeFile($content, $timestamp, $useCallbacks = false) { <ide> $controller = new ' . $this->_View->name . 'Controller($request, $response); <ide> $controller->plugin = $this->plugin = \'' . $this->_View->plugin . '\'; <ide> $controller->helpers = $this->helpers = unserialize(base64_decode(\'' . base64_encode(serialize($this->_View->helpers)) . '\')); <del> $controller->layout = $this->layout = \'' . $this->_View->layout. '\'; <add> $controller->layout = $this->layout = \'' . $this->_View->layout . '\'; <ide> $controller->theme = $this->theme = \'' . $this->_View->theme . '\'; <ide> $controller->viewVars = unserialize(base64_decode(\'' . base64_encode(serialize($this->_View->viewVars)) . '\')); <ide> Router::setRequestInfo($controller->request); <ide><path>lib/Cake/View/Helper/HtmlHelper.php <ide> class HtmlHelper extends AppHelper { <ide> 'hidden' => '<input type="hidden" name="%s"%s/>', <ide> 'checkbox' => '<input type="checkbox" name="%s" %s/>', <ide> 'checkboxmultiple' => '<input type="checkbox" name="%s[]"%s />', <del> 'radio' => '<input type="radio" name="%s" id="%s" %s />%s', <add> 'radio' => '<input type="radio" name="%s" id="%s"%s />%s', <ide> 'selectstart' => '<select name="%s"%s>', <ide> 'selectmultiplestart' => '<select name="%s[]"%s>', <ide> 'selectempty' => '<option value=""%s>&nbsp;</option>', <ide> public function meta($type, $url = null, $options = array()) { <ide> <ide> if (!is_array($type)) { <ide> $types = array( <del> 'rss' => array('type' => 'application/rss+xml', 'rel' => 'alternate', 'title' => $type, 'link' => $url), <del> 'atom' => array('type' => 'application/atom+xml', 'title' => $type, 'link' => $url), <del> 'icon' => array('type' => 'image/x-icon', 'rel' => 'icon', 'link' => $url), <add> 'rss' => array('type' => 'application/rss+xml', 'rel' => 'alternate', 'title' => $type, 'link' => $url), <add> 'atom' => array('type' => 'application/atom+xml', 'title' => $type, 'link' => $url), <add> 'icon' => array('type' => 'image/x-icon', 'rel' => 'icon', 'link' => $url), <ide> 'keywords' => array('name' => 'keywords', 'content' => $url), <ide> 'description' => array('name' => 'description', 'content' => $url), <ide> );
2
Go
Go
fix comments and handle err
cc054f3195308da471c252d755dacfe446cb1066
<ide><path>api/client/inspect.go <ide> func (cli *DockerCli) inspectAll(ctx context.Context, getSize bool) inspect.GetR <ide> } <ide> return nil, nil, err <ide> } <del> return i, rawImage, err <add> return i, rawImage, nil <ide> } <ide> return nil, nil, err <ide> } <del> return c, rawContainer, err <add> return c, rawContainer, nil <ide> } <ide> } <ide><path>api/client/plugin/install.go <ide> func runInstall(dockerCli *client.DockerCli, opts pluginOptions) error { <ide> ctx := context.Background() <ide> <ide> repoInfo, err := registry.ParseRepositoryInfo(named) <add> if err != nil { <add> return err <add> } <add> <ide> authConfig := dockerCli.ResolveAuthConfig(ctx, repoInfo.Index) <ide> <ide> encodedAuth, err := client.EncodeAuthToBase64(authConfig) <ide><path>api/client/plugin/push.go <ide> func runPush(dockerCli *client.DockerCli, name string) error { <ide> ctx := context.Background() <ide> <ide> repoInfo, err := registry.ParseRepositoryInfo(named) <add> if err != nil { <add> return err <add> } <ide> authConfig := dockerCli.ResolveAuthConfig(ctx, repoInfo.Index) <ide> <ide> encodedAuth, err := client.EncodeAuthToBase64(authConfig) <ide><path>api/client/registry.go <ide> func EncodeAuthToBase64(authConfig types.AuthConfig) (string, error) { <ide> return base64.URLEncoding.EncodeToString(buf), nil <ide> } <ide> <del>// RegistryAuthenticationPrivilegedFunc return a RequestPrivilegeFunc from the specified registry index info <add>// RegistryAuthenticationPrivilegedFunc returns a RequestPrivilegeFunc from the specified registry index info <ide> // for the given command. <ide> func (cli *DockerCli) RegistryAuthenticationPrivilegedFunc(index *registrytypes.IndexInfo, cmdName string) types.RequestPrivilegeFunc { <ide> return func() (string, error) { <ide> func (cli *DockerCli) ConfigureAuth(flUser, flPassword, serverAddress string, is <ide> // will hit this if you attempt docker login from mintty where stdin <ide> // is a pipe, not a character based console. <ide> if flPassword == "" && !cli.isTerminalIn { <del> return authconfig, fmt.Errorf("Error: Cannot perform an interactive logon from a non TTY device") <add> return authconfig, fmt.Errorf("Error: Cannot perform an interactive login from a non TTY device") <ide> } <ide> <ide> authconfig.Username = strings.TrimSpace(authconfig.Username) <ide><path>api/client/stack/cmd_stub.go <ide> import ( <ide> "github.com/spf13/cobra" <ide> ) <ide> <del>// NewStackCommand returns nocommand <add>// NewStackCommand returns no command <ide> func NewStackCommand(dockerCli *client.DockerCli) *cobra.Command { <ide> return &cobra.Command{} <ide> } <ide> <del>// NewTopLevelDeployCommand return no command <add>// NewTopLevelDeployCommand returns no command <ide> func NewTopLevelDeployCommand(dockerCli *client.DockerCli) *cobra.Command { <ide> return &cobra.Command{} <ide> }
5
Text
Text
add v3.13.0-beta.5 to changelog
7ae73e69fcf9c0a5ae18bc25f98460f0c5270bca
<ide><path>CHANGELOG.md <ide> # Ember Changelog <ide> <add>### v3.13.0-beta.5 (September 3, 2019) <add> <add>- [#18314](https://github.com/emberjs/ember.js/pull/18314) [BUGFIX] Use class inheritance for getters and setters <add>- [#18329](https://github.com/emberjs/ember.js/pull/18329) [BUGFIX] Eagerly consume aliases <add> <ide> ### v3.13.0-beta.4 (August 26, 2019) <ide> <ide> - [#18278](https://github.com/emberjs/ember.js/pull/18278) [BUGFIX] Bump ember-router-generator from v1.2.3 to v2.0.0 to support parsing `app/router.js` with native class.
1
Javascript
Javascript
allow directory browsing
241d57aa9eb2d74bb400bd9e5339fe0a6b58ccff
<ide><path>grunt/config/server.js <ide> module.exports = function(grunt){ <ide> connect.bodyParser(), <ide> testResultLoggerMiddleware, <ide> <del> connect.static(options.base) <add> connect.static(options.base), <add> connect.directory(options.base) <ide> ]; <ide> }, <ide> }
1
Javascript
Javascript
keep test iframes around for assertions
0fb84fa8ccefcd07febf282fd7b80262ad70add7
<ide><path>test/data/testinit.js <ide> this.testIframeWithCallback = function( title, fileName, func ) { <ide> setTimeout( function() { <ide> this.iframeCallback = undefined; <ide> <del> iframe.remove(); <ide> func.apply( this, args ); <ide> func = function() {}; <add> iframe.remove(); <ide> <ide> done(); <ide> } );
1
PHP
PHP
remove unused property
50138f77231ee294c1b3289d41743ca01b614ca8
<ide><path>src/Controller/Controller.php <ide> class Controller implements EventListenerInterface, EventDispatcherInterface <ide> */ <ide> protected $response; <ide> <del> /** <del> * The class name to use for creating the response object. <del> * <del> * @var string <del> */ <del> protected $_responseClass = Response::class; <del> <ide> /** <ide> * Settings for pagination. <ide> *
1
Text
Text
fix typo in config-json man page
c75581c8552745f989d0ff6ed7dff86e26e55767
<ide><path>man/config-json.5.md <ide> % Docker Community <ide> % JANUARY 2016 <ide> # NAME <del>HOME/.docker/confg.json - Default Docker configuration file <add>HOME/.docker/config.json - Default Docker configuration file <ide> <ide> # INTRODUCTION <ide>
1
Javascript
Javascript
add test for categorical scales
72c9cd4ddeb5cf4bbadc57cb996bafc0401a52fb
<ide><path>test/scale/category-test.js <add>require("../env"); <add>require("../../d3"); <add> <add>var vows = require("vows"), <add> assert = require("assert"); <add> <add>var suite = vows.describe("d3.scale.category"); <add> <add>suite.addBatch({ <add> "category10": category(d3.scale.category10, 10), <add> "category20": category(d3.scale.category20, 20), <add> "category20b": category(d3.scale.category20b, 20), <add> "category20c": category(d3.scale.category20c, 20) <add>}); <add> <add>function category(category, n) { <add> return { <add> "is an ordinal scale": function() { <add> var x = category(); <add> assert.length(x.domain(), 0); <add> assert.length(x.range(), n); <add> }, <add> "each instance is isolated": function() { <add> var a = category(), b = category(), colors = a.range(); <add> assert.equal(a(1), colors[0]); <add> assert.equal(b(2), colors[0]); <add> assert.equal(b(1), colors[1]); <add> assert.equal(a(1), colors[0]); <add> }, <add> "discrete domain values are remembered": function() { <add> var x = category(), colors = x.range(); <add> assert.equal(x(1), colors[0]); <add> assert.equal(x(2), colors[1]); <add> assert.equal(x(1), colors[0]); <add> }, <add> "recycles range values when exhausted": function() { <add> var x = category(); <add> for (var i = 0; i < n; ++i) x(i); <add> for (; i < 2 * n; ++i) assert.equal(x(i), x(i - n)); <add> }, <add> "contains the expected number of values in the range": function() { <add> var x = category(); <add> assert.length(x.range(), n); <add> }, <add> "each range value is distinct": function() { <add> var map = {}, count = 0, x = category(); <add> x.range().forEach(function(v) { <add> if (!(v in map)) { <add> map[v] = ++count; <add> } <add> }); <add> assert.equal(count, x.range().length); <add> }, <add> "each range value is a hexadecimal color": function() { <add> var x = category(); <add> x.range().forEach(function(v) { <add> assert.match(v, /#[0-9a-f]{6}/); <add> v = d3.rgb(v); <add> assert.isFalse(isNaN(v.r)); <add> assert.isFalse(isNaN(v.g)); <add> assert.isFalse(isNaN(v.b)); <add> }); <add> }, <add> "no range values are very dark or very light": function() { <add> var x = category(); <add> x.range().forEach(function(v) { <add> var c = d3.hsl(v); <add> assert.isTrue(c.l >= .34, "expected " + v + " to be lighter (l = " + c.l + ")"); <add> assert.isTrue(c.l <= .89, "expected " + v + " to be darker (l = " + c.l + ")"); <add> }); <add> } <add> }; <add>} <add> <add>suite.export(module);
1
Go
Go
fix regressions in attach
0fec3e19dbff15b3cd8fa3693f694e34d8dcc5a9
<ide><path>api/server/server.go <ide> func postContainersAttach(eng *engine.Engine, version version.Version, w http.Re <ide> } else { <ide> errStream = outStream <ide> } <del> logs := r.Form.Get("logs") != "" <del> stream := r.Form.Get("stream") != "" <add> logs := toBool(r.Form.Get("logs")) <add> stream := toBool(r.Form.Get("stream")) <ide> <del> if err := cont.AttachWithLogs(inStream, outStream, errStream, logs, stream); err != nil { <add> var stdin io.ReadCloser <add> var stdout, stderr io.Writer <add> <add> if toBool(r.Form.Get("stdin")) { <add> stdin = inStream <add> } <add> if toBool(r.Form.Get("stdout")) { <add> stdout = outStream <add> } <add> if toBool(r.Form.Get("stderr")) { <add> stderr = errStream <add> } <add> <add> if err := cont.AttachWithLogs(stdin, stdout, stderr, logs, stream); err != nil { <ide> fmt.Fprintf(outStream, "Error attaching: %s\n", err) <ide> } <ide> return nil <ide><path>daemon/attach.go <ide> func (c *Container) AttachWithLogs(stdin io.ReadCloser, stdout, stderr io.Writer <ide> //stream <ide> if stream { <ide> var stdinPipe io.ReadCloser <del> r, w := io.Pipe() <del> go func() { <del> defer w.Close() <del> defer logrus.Debugf("Closing buffered stdin pipe") <del> io.Copy(w, stdin) <del> }() <del> stdinPipe = r <add> if stdin != nil { <add> r, w := io.Pipe() <add> go func() { <add> defer w.Close() <add> defer logrus.Debugf("Closing buffered stdin pipe") <add> io.Copy(w, stdin) <add> }() <add> stdinPipe = r <add> } <ide> <-c.Attach(stdinPipe, stdout, stderr) <ide> // If we are in stdinonce mode, wait for the process to end <ide> // otherwise, simply return
2
PHP
PHP
add use at top and use assertnull
ffe113148597c248f5090facef298b9855fcc089
<ide><path>src/Routing/Router.php <ide> use Cake\Core\Configure; <ide> use Cake\Http\ServerRequest; <ide> use Cake\Utility\Inflector; <add>use Cake\Routing\Exception\MissingRouteException; <ide> use Psr\Http\Message\ServerRequestInterface; <ide> <ide> /** <ide> public static function urlOrNull($url = null, $full = false) <ide> { <ide> try { <ide> return static::url($url, $full); <del> } catch (\Cake\Routing\Exception\MissingRouteException $e) { <add> } catch (MissingRouteException $e) { <ide> return null; <ide> } <ide> } <ide><path>tests/TestCase/Routing/RouterTest.php <ide> public function testRouteUrlOrNull() <ide> Router::connect('/:controller/:action', ['controller' => 'posts']); <ide> $this->assertEquals(Router::urlOrNull(['action' => 'view']), '/view'); <ide> <del> $this->assertEquals(Router::urlOrNull(['action' => 'view', 'controller' => 'users', 'plugin' => 'test']), null); <add> $this->assertNull(Router::urlOrNull(['action' => 'view', 'controller' => 'users', 'plugin' => 'test'])); <ide> } <ide> <ide> /**
2
Python
Python
add reference to resource variables
93cef86d705e6718ff0d914e303e29cec23195ae
<ide><path>keras/engine/base_layer.py <ide> def add_weight(self, <ide> Note that `trainable` cannot be `True` if `synchronization` <ide> is set to `ON_READ`. <ide> constraint: Constraint instance (callable). <del> use_resource: Whether to use `ResourceVariable`. <add> use_resource: Whether to use [ResourceVariable]( <add> https://www.tensorflow.org/guide/migrate/tf1_vs_tf2#resourcevariables_instead_of_referencevariables). <ide> synchronization: Indicates when a distributed a variable will be <ide> aggregated. Accepted values are constants defined in the class <ide> `tf.VariableSynchronization`. By default the synchronization is set to
1
Python
Python
use mock.patch in migrations tests
88d7fcebdebb726c6dc561bcce7916ed1d5256d7
<ide><path>tests/auth_tests/test_tokens.py <del>import sys <ide> import unittest <ide> from datetime import date, timedelta <ide> <ide> from django.conf import settings <ide> from django.contrib.auth.models import User <ide> from django.contrib.auth.tokens import PasswordResetTokenGenerator <ide> from django.test import TestCase <add>from django.utils.six import PY3 <ide> <ide> <ide> class TokenGeneratorTest(TestCase): <ide> def _today(self): <ide> p2 = Mocked(date.today() + timedelta(settings.PASSWORD_RESET_TIMEOUT_DAYS + 1)) <ide> self.assertFalse(p2.check_token(user, tk1)) <ide> <del> @unittest.skipIf(sys.version_info[:2] >= (3, 0), "Unnecessary test with Python 3") <add> @unittest.skipIf(PY3, "Unnecessary test with Python 3") <ide> def test_date_length(self): <ide> """ <ide> Make sure we don't allow overly long dates, causing a potential DoS. <ide><path>tests/migrations/test_commands.py <ide> from django.apps import apps <ide> from django.core.management import CommandError, call_command <ide> from django.db import DatabaseError, connection, models <del>from django.db.migrations import questioner <ide> from django.test import ignore_warnings, mock, override_settings <ide> from django.utils import six <ide> from django.utils.deprecation import RemovedInDjango20Warning <ide> def test_makemigrations_interactive_reject(self): <ide> Makes sure that makemigrations enters and exits interactive mode properly. <ide> """ <ide> # Monkeypatch interactive questioner to auto reject <del> old_input = questioner.input <del> questioner.input = lambda _: "N" <del> try: <del> with self.temporary_migration_module(module="migrations.test_migrations_conflict") as migration_dir: <del> call_command("makemigrations", "migrations", merge=True, interactive=True, verbosity=0) <del> merge_file = os.path.join(migration_dir, '0003_merge.py') <del> self.assertFalse(os.path.exists(merge_file)) <del> except CommandError: <del> self.fail("Makemigrations failed while running interactive questioner") <del> finally: <del> questioner.input = old_input <add> with mock.patch('django.db.migrations.questioner.input', mock.Mock(return_value='N')): <add> try: <add> with self.temporary_migration_module(module="migrations.test_migrations_conflict") as migration_dir: <add> call_command("makemigrations", "migrations", merge=True, interactive=True, verbosity=0) <add> merge_file = os.path.join(migration_dir, '0003_merge.py') <add> self.assertFalse(os.path.exists(merge_file)) <add> except CommandError: <add> self.fail("Makemigrations failed while running interactive questioner") <ide> <ide> def test_makemigrations_interactive_accept(self): <ide> """ <ide> Makes sure that makemigrations enters interactive mode and merges properly. <ide> """ <ide> # Monkeypatch interactive questioner to auto accept <del> old_input = questioner.input <del> questioner.input = lambda _: "y" <del> out = six.StringIO() <del> try: <del> with self.temporary_migration_module(module="migrations.test_migrations_conflict") as migration_dir: <del> call_command("makemigrations", "migrations", merge=True, interactive=True, stdout=out) <del> merge_file = os.path.join(migration_dir, '0003_merge.py') <del> self.assertTrue(os.path.exists(merge_file)) <del> except CommandError: <del> self.fail("Makemigrations failed while running interactive questioner") <del> finally: <del> questioner.input = old_input <del> self.assertIn("Created new merge migration", force_text(out.getvalue())) <add> with mock.patch('django.db.migrations.questioner.input', mock.Mock(return_value='y')): <add> out = six.StringIO() <add> try: <add> with self.temporary_migration_module(module="migrations.test_migrations_conflict") as migration_dir: <add> call_command("makemigrations", "migrations", merge=True, interactive=True, stdout=out) <add> merge_file = os.path.join(migration_dir, '0003_merge.py') <add> self.assertTrue(os.path.exists(merge_file)) <add> except CommandError: <add> self.fail("Makemigrations failed while running interactive questioner") <add> self.assertIn("Created new merge migration", force_text(out.getvalue())) <ide> <ide> def test_makemigrations_non_interactive_not_null_addition(self): <ide> """ <ide> def test_makemigrations_interactive_by_default(self): <ide> behavior when --noinput is specified. <ide> """ <ide> # Monkeypatch interactive questioner to auto reject <del> old_input = questioner.input <del> questioner.input = lambda _: "N" <ide> out = six.StringIO() <del> try: <del> with self.temporary_migration_module(module="migrations.test_migrations_conflict") as migration_dir: <del> call_command("makemigrations", "migrations", merge=True, stdout=out) <del> merge_file = os.path.join(migration_dir, '0003_merge.py') <del> # This will fail if interactive is False by default <del> self.assertFalse(os.path.exists(merge_file)) <del> except CommandError: <del> self.fail("Makemigrations failed while running interactive questioner") <del> finally: <del> questioner.input = old_input <del> self.assertNotIn("Created new merge migration", out.getvalue()) <add> with mock.patch('django.db.migrations.questioner.input', mock.Mock(return_value='N')): <add> try: <add> with self.temporary_migration_module(module="migrations.test_migrations_conflict") as migration_dir: <add> call_command("makemigrations", "migrations", merge=True, stdout=out) <add> merge_file = os.path.join(migration_dir, '0003_merge.py') <add> # This will fail if interactive is False by default <add> self.assertFalse(os.path.exists(merge_file)) <add> except CommandError: <add> self.fail("Makemigrations failed while running interactive questioner") <add> self.assertNotIn("Created new merge migration", out.getvalue()) <ide> <ide> @override_settings( <ide> INSTALLED_APPS=[ <ide> def test_makemigrations_unspecified_app_with_conflict_merge(self): <ide> unspecified app even if it has conflicting migrations. <ide> """ <ide> # Monkeypatch interactive questioner to auto accept <del> old_input = questioner.input <del> questioner.input = lambda _: "y" <del> out = six.StringIO() <del> try: <del> with self.temporary_migration_module(app_label="migrated_app") as migration_dir: <del> call_command("makemigrations", "migrated_app", merge=True, interactive=True, stdout=out) <del> merge_file = os.path.join(migration_dir, '0003_merge.py') <del> self.assertFalse(os.path.exists(merge_file)) <del> self.assertIn("No conflicts detected to merge.", out.getvalue()) <del> except CommandError: <del> self.fail("Makemigrations fails resolving conflicts in an unspecified app") <del> finally: <del> questioner.input = old_input <add> with mock.patch('django.db.migrations.questioner.input', mock.Mock(return_value='y')): <add> out = six.StringIO() <add> try: <add> with self.temporary_migration_module(app_label="migrated_app") as migration_dir: <add> call_command("makemigrations", "migrated_app", merge=True, interactive=True, stdout=out) <add> merge_file = os.path.join(migration_dir, '0003_merge.py') <add> self.assertFalse(os.path.exists(merge_file)) <add> self.assertIn("No conflicts detected to merge.", out.getvalue()) <add> except CommandError: <add> self.fail("Makemigrations fails resolving conflicts in an unspecified app") <ide> <ide> def test_makemigrations_with_custom_name(self): <ide> """
2
Ruby
Ruby
refactor the optimized build_query a bit
37b77c6ae7effdba51ecd8b3b91e2cdb0020b6aa
<ide><path>actionpack/lib/action_view/template/resolver.rb <ide> def eql?(resolver) <ide> class OptimizedFileSystemResolver < FileSystemResolver #:nodoc: <ide> def build_query(path, details) <ide> exts = EXTENSIONS.map { |ext| details[ext] } <del> query = File.join(@path, path) <ide> <del> exts.each do |ext| <del> query << "{" <del> ext.compact.uniq.each { |e| query << ".#{e}," } <del> query << "}" <del> end <del> <del> query <add> File.join(@path, path) + exts.map { |ext| <add> "{#{ext.compact.uniq.map { |e| ".#{e}," }.join}}" <add> }.join <ide> end <ide> end <ide>
1
PHP
PHP
remove windows carriage return chars from package
f47f8481ff8b485aede9db27fe09aa4e4a93a718
<ide><path>src/Illuminate/Workbench/Package.php <del><?php namespace Illuminate\Workbench; <del> <del>class Package { <del> <del> /** <del> * The vendor name of the package. <del> * <del> * @var string <del> */ <del> public $vendor; <del> <del> /** <del> * The snake-cased version of the vendor. <del> * <del> * @var string <del> */ <del> public $lowerVendor; <del> <del> /** <del> * The name of the package. <del> * <del> * @var string <del> */ <del> public $name; <del> <del> /** <del> * The snake-cased version of the package. <del> * <del> * @var string <del> */ <del> public $lowerName; <del> <del> /** <del> * The name of the author. <del> * <del> * @var string <del> */ <del> public $author; <del> <del> /** <del> * The email address of the author. <del> * <del> * @var string <del> */ <del> public $email; <del> <del> /** <del> * Create a new package instance. <del> * <del> * @param string $vendor <del> * @param string $name <del> * @param string $author <del> * @param string $email <del> * @return void <del> */ <del> public function __construct($vendor, $name, $author, $email) <del> { <del> $this->name = $name; <del> $this->email = $email; <del> $this->vendor = $vendor; <del> $this->author = $author; <del> $this->lowerName = snake_case($name, '-'); <del> $this->lowerVendor = snake_case($vendor, '-'); <del> } <del> <del> /** <del> * Get the full package name. <del> * <del> * @return string <del> */ <del> public function getFullName() <del> { <del> return $this->lowerVendor.'/'.$this->lowerName; <del> } <del> <add><?php namespace Illuminate\Workbench; <add> <add>class Package { <add> <add> /** <add> * The vendor name of the package. <add> * <add> * @var string <add> */ <add> public $vendor; <add> <add> /** <add> * The snake-cased version of the vendor. <add> * <add> * @var string <add> */ <add> public $lowerVendor; <add> <add> /** <add> * The name of the package. <add> * <add> * @var string <add> */ <add> public $name; <add> <add> /** <add> * The snake-cased version of the package. <add> * <add> * @var string <add> */ <add> public $lowerName; <add> <add> /** <add> * The name of the author. <add> * <add> * @var string <add> */ <add> public $author; <add> <add> /** <add> * The email address of the author. <add> * <add> * @var string <add> */ <add> public $email; <add> <add> /** <add> * Create a new package instance. <add> * <add> * @param string $vendor <add> * @param string $name <add> * @param string $author <add> * @param string $email <add> * @return void <add> */ <add> public function __construct($vendor, $name, $author, $email) <add> { <add> $this->name = $name; <add> $this->email = $email; <add> $this->vendor = $vendor; <add> $this->author = $author; <add> $this->lowerName = snake_case($name, '-'); <add> $this->lowerVendor = snake_case($vendor, '-'); <add> } <add> <add> /** <add> * Get the full package name. <add> * <add> * @return string <add> */ <add> public function getFullName() <add> { <add> return $this->lowerVendor.'/'.$this->lowerName; <add> } <add> <ide> }
1
Text
Text
fix changelog entry about fast_string_to_time fix
d23c761f5a514e10676aa3e0e1632946aaebcbf7
<ide><path>activerecord/CHANGELOG.md <ide> <ide> *kennyj* <ide> <del>* Use inversed parent for first and last child of has_many association. <add>* Use inversed parent for first and last child of `has_many` association. <ide> <ide> *Ravil Bayramgalin* <ide> <del>* Fix Column.microseconds and Column.fast_string_to_date to avoid converting <add>* Fix `Column.microseconds` and `Column.fast_string_to_time` to avoid converting <ide> timestamp seconds to a float, since it occasionally results in inaccuracies <ide> with microsecond-precision times. Fixes #7352. <ide>
1
Java
Java
use registry to convert to completablefuture
3303a68436c23fa4928c402bbec52d2da88818b0
<ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/function/AsyncServerResponse.java <ide> import javax.servlet.http.HttpServletResponse; <ide> <ide> import org.reactivestreams.Publisher; <del>import org.reactivestreams.Subscriber; <del>import org.reactivestreams.Subscription; <ide> <ide> import org.springframework.core.ReactiveAdapter; <ide> import org.springframework.core.ReactiveAdapterRegistry; <ide> public static ServerResponse create(Object o) { <ide> return new AsyncServerResponse(futureResponse); <ide> } <ide> else if (reactiveStreamsPresent) { <del> ReactiveAdapter adapter = ReactiveAdapterRegistry.getSharedInstance().getAdapter(o.getClass()); <del> if (adapter != null) { <del> Publisher<ServerResponse> publisher = adapter.toPublisher(o); <del> CompletableFuture<ServerResponse> futureResponse = new CompletableFuture<>(); <del> publisher.subscribe(new ToFutureSubscriber(futureResponse)); <del> return new AsyncServerResponse(futureResponse); <add> ReactiveAdapterRegistry registry = ReactiveAdapterRegistry.getSharedInstance(); <add> ReactiveAdapter publisherAdapter = registry.getAdapter(o.getClass()); <add> if (publisherAdapter != null) { <add> Publisher<ServerResponse> publisher = publisherAdapter.toPublisher(o); <add> ReactiveAdapter futureAdapter = registry.getAdapter(CompletableFuture.class); <add> if (futureAdapter != null) { <add> CompletableFuture<ServerResponse> futureResponse = <add> (CompletableFuture<ServerResponse>) futureAdapter.fromPublisher(publisher); <add> return new AsyncServerResponse(futureResponse); <add> } <ide> } <ide> } <ide> throw new IllegalArgumentException("Asynchronous type not supported: " + o.getClass()); <ide> } <ide> <ide> <del> /** <del> * Subscriber that exposes the first result it receives via a CompletableFuture. <del> */ <del> private static final class ToFutureSubscriber implements Subscriber<ServerResponse> { <del> <del> private final CompletableFuture<ServerResponse> future; <del> <del> @Nullable <del> private Subscription subscription; <del> <del> <del> public ToFutureSubscriber(CompletableFuture<ServerResponse> future) { <del> this.future = future; <del> } <del> <del> @Override <del> public void onSubscribe(Subscription s) { <del> if (this.subscription == null) { <del> this.subscription = s; <del> s.request(1); <del> } <del> else { <del> s.cancel(); <del> } <del> } <del> <del> @Override <del> public void onNext(ServerResponse serverResponse) { <del> if (!this.future.isDone()) { <del> this.future.complete(serverResponse); <del> } <del> } <del> <del> @Override <del> public void onError(Throwable t) { <del> if (!this.future.isDone()) { <del> this.future.completeExceptionally(t); <del> } <del> } <del> <del> @Override <del> public void onComplete() { <del> if (!this.future.isDone()) { <del> this.future.completeExceptionally(new IllegalStateException("Did not receive ServerResponse")); <del> } <del> } <del> } <del> <del> <ide> /** <ide> * HttpServletRequestWrapper that shares its AsyncContext between this <ide> * AsyncServerResponse class and other, subsequent ServerResponse
1
Javascript
Javascript
improve example, correct browser compat note
122d89b2401fadf4f6a07a906d3d25324b7d859e
<ide><path>src/ng/directive/attrs.js <ide> * <ide> * ## A note about browser compatibility <ide> * <del> * Edge, Firefox, and Internet Explorer do not support the `details` element, it is <add> * Internet Explorer and Edge do not support the `details` element, it is <ide> * recommended to use {@link ng.ngShow} and {@link ng.ngHide} instead. <ide> * <ide> * @example <ide> <example name="ng-open"> <ide> <file name="index.html"> <del> <label>Check me check multiple: <input type="checkbox" ng-model="open"></label><br/> <add> <label>Toggle details: <input type="checkbox" ng-model="open"></label><br/> <ide> <details id="details" ng-open="open"> <del> <summary>Show/Hide me</summary> <add> <summary>List</summary> <add> <ul> <add> <li>Apple</li> <add> <li>Orange</li> <add> <li>Durian</li> <add> </ul> <ide> </details> <ide> </file> <ide> <file name="protractor.js" type="protractor">
1
Python
Python
fix tensorboard callback with unit test
bcf0031b54d555179be81c088cc3df0a723d7907
<ide><path>keras/callbacks.py <ide> def is_indexed_slices(grad): <ide> tf.summary.image(mapped_weight_name, w_img) <ide> <ide> if hasattr(layer, 'output'): <del> tf.summary.histogram('{}_out'.format(layer.name), <del> layer.output) <add> if isinstance(layer.output, list): <add> for i, output in enumerate(layer.output): <add> tf.summary.histogram('{}_out_{}'.format(layer.name, i), output) <add> else: <add> tf.summary.histogram('{}_out'.format(layer.name), <add> layer.output) <ide> self.merged = tf.summary.merge_all() <ide> <ide> if self.write_graph: <ide><path>tests/keras/test_callbacks.py <ide> from keras import initializers <ide> from keras import callbacks <ide> from keras.models import Sequential, Model <del>from keras.layers import Input, Dense, Dropout, add <add>from keras.layers import Input, Dense, Dropout, add, dot, Lambda <ide> from keras.layers.convolutional import Conv2D <del>from keras.layers.pooling import MaxPooling2D, GlobalAveragePooling2D <add>from keras.layers.pooling import MaxPooling2D, GlobalAveragePooling1D, GlobalAveragePooling2D <ide> from keras.utils.test_utils import get_test_data <ide> from keras.utils.test_utils import keras_test <ide> from keras import backend as K <ide> def test_TensorBoard_multi_input_output(tmpdir): <ide> (X_train, y_train), (X_test, y_test) = get_test_data( <ide> num_train=train_samples, <ide> num_test=test_samples, <del> input_shape=(input_dim,), <add> input_shape=(input_dim, input_dim), <ide> classification=True, <ide> num_classes=num_classes) <ide> y_test = np_utils.to_categorical(y_test) <ide> def data_generator(train): <ide> i += 1 <ide> i = i % max_batch_index <ide> <del> inp1 = Input((input_dim,)) <del> inp2 = Input((input_dim,)) <del> inp = add([inp1, inp2]) <del> hidden = Dense(num_hidden, activation='relu')(inp) <add> inp1 = Input((input_dim, input_dim)) <add> inp2 = Input((input_dim, input_dim)) <add> inp_3d = add([inp1, inp2]) <add> inp_2d = GlobalAveragePooling1D()(inp_3d) <add> inp_pair = Lambda(lambda x: x)([inp_3d, inp_2d]) # test a layer with a list of output tensors <add> hidden = dot(inp_pair, axes=-1) <add> hidden = Dense(num_hidden, activation='relu')(hidden) <ide> hidden = Dropout(0.1)(hidden) <ide> output1 = Dense(num_classes, activation='softmax')(hidden) <ide> output2 = Dense(num_classes, activation='softmax')(hidden)
2
Go
Go
remove unused error return
f9a1846ca23f462b0e5d7e8f111c7ab322c53b44
<ide><path>distribution/config.go <ide> type PushLayer interface { <ide> DiffID() layer.DiffID <ide> Parent() PushLayer <ide> Open() (io.ReadCloser, error) <del> Size() (int64, error) <add> Size() int64 <ide> MediaType() string <ide> Release() <ide> } <ide> func (l *storeLayer) Open() (io.ReadCloser, error) { <ide> return l.Layer.TarStream() <ide> } <ide> <del>func (l *storeLayer) Size() (int64, error) { <del> return l.Layer.DiffSize(), nil <add>func (l *storeLayer) Size() int64 { <add> return l.Layer.DiffSize() <ide> } <ide> <ide> func (l *storeLayer) MediaType() string { <ide><path>distribution/push_v2.go <ide> func (pd *v2PushDescriptor) uploadUsingSession( <ide> return distribution.Descriptor{}, retryOnError(err) <ide> } <ide> <del> size, _ := pd.layer.Size() <del> <del> reader = progress.NewProgressReader(ioutils.NewCancelReadCloser(ctx, contentReader), progressOutput, size, pd.ID(), "Pushing") <add> reader = progress.NewProgressReader(ioutils.NewCancelReadCloser(ctx, contentReader), progressOutput, pd.layer.Size(), pd.ID(), "Pushing") <ide> <ide> switch m := pd.layer.MediaType(); m { <ide> case schema2.MediaTypeUncompressedLayer: <ide> attempts: <ide> // decision is based on layer size. The smaller the layer, the fewer attempts shall be made because the cost <ide> // of upload does not outweigh a latency. <ide> func getMaxMountAndExistenceCheckAttempts(layer PushLayer) (maxMountAttempts, maxExistenceCheckAttempts int, checkOtherRepositories bool) { <del> size, err := layer.Size() <add> size := layer.Size() <ide> switch { <ide> // big blob <ide> case size > middleLayerMaximumSize: <ide> func getMaxMountAndExistenceCheckAttempts(layer PushLayer) (maxMountAttempts, ma <ide> return 4, 3, true <ide> <ide> // middle sized blobs; if we could not get the size, assume we deal with middle sized blob <del> case size > smallLayerMaximumSize, err != nil: <add> case size > smallLayerMaximumSize: <ide> // 1st attempt to mount blobs of average size few times <ide> // 2nd try at most 1 existence check if there's an existing mapping to the target repository <ide> // then fallback to upload
2
Javascript
Javascript
throttle more timers and use native bind
6a93c8afacc66eec77447498ae10866398cd5815
<ide><path>src/js/control-bar/progress-control/mouse-time-display.js <ide> class MouseTimeDisplay extends Component { <ide> */ <ide> constructor(player, options) { <ide> super(player, options); <del> this.update = Fn.throttle(Fn.bind(this, this.update), 25); <add> this.update = Fn.throttle(Fn.bind(this, this.update), Fn.UPDATE_REFRESH_INTERVAL); <ide> } <ide> <ide> /** <ide><path>src/js/control-bar/progress-control/play-progress-bar.js <ide> */ <ide> import Component from '../../component.js'; <ide> import {IS_IOS, IS_ANDROID} from '../../utils/browser.js'; <add>import * as Fn from '../../utils/fn.js'; <ide> <ide> import './time-tooltip'; <ide> <ide> import './time-tooltip'; <ide> */ <ide> class PlayProgressBar extends Component { <ide> <add> /** <add> * Creates an instance of this class. <add> * <add> * @param {Player} player <add> * The {@link Player} that this class should be attached to. <add> * <add> * @param {Object} [options] <add> * The key/value store of player options. <add> */ <add> constructor(player, options) { <add> super(player, options); <add> this.update = Fn.throttle(Fn.bind(this, this.update), Fn.UPDATE_REFRESH_INTERVAL); <add> } <add> <ide> /** <ide> * Create the the DOM element for this class. <ide> * <ide><path>src/js/control-bar/progress-control/progress-control.js <ide> */ <ide> import Component from '../../component.js'; <ide> import * as Dom from '../../utils/dom.js'; <del>import {throttle, bind} from '../../utils/fn.js'; <add>import {bind, throttle, UPDATE_REFRESH_INTERVAL} from '../../utils/fn.js'; <ide> <ide> import './seek-bar.js'; <ide> <ide> class ProgressControl extends Component { <ide> */ <ide> constructor(player, options) { <ide> super(player, options); <del> this.handleMouseMove = throttle(bind(this, this.handleMouseMove), 25); <del> this.throttledHandleMouseSeek = throttle(bind(this, this.handleMouseSeek), 25); <add> this.handleMouseMove = throttle(bind(this, this.handleMouseMove), UPDATE_REFRESH_INTERVAL); <add> this.throttledHandleMouseSeek = throttle(bind(this, this.handleMouseSeek), UPDATE_REFRESH_INTERVAL); <ide> <ide> this.enable(); <ide> } <ide><path>src/js/control-bar/progress-control/time-tooltip.js <ide> import Component from '../../component'; <ide> import * as Dom from '../../utils/dom.js'; <ide> import formatTime from '../../utils/format-time.js'; <add>import * as Fn from '../../utils/fn.js'; <ide> <ide> /** <ide> * Time tooltips display a time above the progress bar. <ide> import formatTime from '../../utils/format-time.js'; <ide> */ <ide> class TimeTooltip extends Component { <ide> <add> /** <add> * Creates an instance of this class. <add> * <add> * @param {Player} player <add> * The {@link Player} that this class should be attached to. <add> * <add> * @param {Object} [options] <add> * The key/value store of player options. <add> */ <add> constructor(player, options) { <add> super(player, options); <add> this.update = Fn.throttle(Fn.bind(this, this.update), Fn.UPDATE_REFRESH_INTERVAL); <add> } <add> <ide> /** <ide> * Create the time tooltip DOM element <ide> * <ide> class TimeTooltip extends Component { <ide> /** <ide> * Write the time to the tooltip DOM element. <ide> * <del> * @param {String} content <add> * @param {string} content <ide> * The formatted time for the tooltip. <ide> */ <ide> write(content) { <ide><path>src/js/control-bar/time-controls/time-display.js <ide> import document from 'global/document'; <ide> import Component from '../../component.js'; <ide> import * as Dom from '../../utils/dom.js'; <del>import {bind, throttle} from '../../utils/fn.js'; <add>import {bind, throttle, UPDATE_REFRESH_INTERVAL} from '../../utils/fn.js'; <ide> import formatTime from '../../utils/format-time.js'; <ide> <ide> /** <ide> class TimeDisplay extends Component { <ide> */ <ide> constructor(player, options) { <ide> super(player, options); <del> this.throttledUpdateContent = throttle(bind(this, this.updateContent), 25); <add> this.throttledUpdateContent = throttle(bind(this, this.updateContent), UPDATE_REFRESH_INTERVAL); <ide> this.on(player, 'timeupdate', this.throttledUpdateContent); <ide> } <ide> <ide><path>src/js/control-bar/volume-control/volume-control.js <ide> import Component from '../../component.js'; <ide> import checkVolumeSupport from './check-volume-support'; <ide> import {isPlain} from '../../utils/obj'; <del>import { throttle, bind } from '../../utils/fn.js'; <add>import {throttle, bind, UPDATE_REFRESH_INTERVAL} from '../../utils/fn.js'; <ide> <ide> // Required children <ide> import './volume-bar.js'; <ide> class VolumeControl extends Component { <ide> // hide this control if volume support is missing <ide> checkVolumeSupport(this, player); <ide> <del> this.throttledHandleMouseMove = throttle(bind(this, this.handleMouseMove), 25); <add> this.throttledHandleMouseMove = throttle(bind(this, this.handleMouseMove), UPDATE_REFRESH_INTERVAL); <ide> <ide> this.on('mousedown', this.handleMouseDown); <ide> this.on('touchstart', this.handleMouseDown); <ide><path>src/js/slider/slider.js <ide> class Slider extends Component { <ide> this.on('keydown', this.handleKeyDown); <ide> this.on('click', this.handleClick); <ide> <add> // TODO: deprecated, controlsvisible does not seem to be fired <ide> this.on(this.player_, 'controlsvisible', this.update); <ide> <ide> if (this.playerEvent) { <ide> class Slider extends Component { <ide> const style = bar.el().style; <ide> <ide> // Set the new bar width or height <del> if (this.vertical()) { <del> style.height = percentage; <del> } else { <del> style.width = percentage; <add> const sizeKey = this.vertical() ? 'height' : 'width'; <add> <add> if (style[sizeKey] !== percentage) { <add> style[sizeKey] = percentage; <ide> } <ide> <ide> return progress; <ide><path>src/js/utils/fn.js <ide> import { newGUID } from './guid.js'; <ide> import window from 'global/window'; <ide> <add>export const UPDATE_REFRESH_INTERVAL = 30; <add> <ide> /** <ide> * Bind (a.k.a proxy or context). A simple method for changing the context of <ide> * a function. <ide> export const bind = function(context, fn, uid) { <ide> } <ide> <ide> // Create the new function that changes the context <del> const bound = function() { <del> return fn.apply(context, arguments); <del> }; <add> const bound = fn.bind(context); <ide> <ide> // Allow for the ability to individualize this function <ide> // Needed in the case where multiple objects might share the same prototype
8
PHP
PHP
return previous app namespace
92f50b4536e9df85d773924e4f9807d113fe543f
<ide><path>src/TestSuite/TestCase.php <ide> protected function _getTableClassName(string $alias, array $options): string <ide> * Set the app namespace <ide> * <ide> * @param string $appNamespace The app namespace, defaults to "TestApp". <del> * @return void <add> * @return string|null The previous app namespace or null if not set. <ide> */ <del> public static function setAppNamespace(string $appNamespace = 'TestApp'): void <add> public static function setAppNamespace(string $appNamespace = 'TestApp'): ?string <ide> { <add> $previous = Configure::read('App.namespace'); <ide> Configure::write('App.namespace', $appNamespace); <add> <add> return $previous; <ide> } <ide> <ide> /**
1
PHP
PHP
implement dump() and dd() methods
6699a47565146cd318a22435f99104d54a90c2c1
<ide><path>src/Illuminate/Http/Client/PendingRequest.php <ide> use Illuminate\Support\Collection; <ide> use Illuminate\Support\Str; <ide> use Illuminate\Support\Traits\Macroable; <add>use Symfony\Component\VarDumper\VarDumper; <ide> <ide> class PendingRequest <ide> { <ide> public function beforeSending($callback) <ide> }); <ide> } <ide> <add> /** <add> * Dump the request. <add> * <add> * @return $this <add> */ <add> public function dump() <add> { <add> $values = func_get_args(); <add> <add> return $this->beforeSending(function (Request $request, array $options) use ($values) { <add> foreach (array_merge($values, [$request, $options]) as $value) { <add> VarDumper::dump($value); <add> } <add> }); <add> } <add> <add> /** <add> * Dump the request and end the script. <add> * <add> * @return $this <add> */ <add> public function dd() <add> { <add> $values = func_get_args(); <add> <add> return $this->beforeSending(function (Request $request, array $options) use ($values) { <add> foreach (array_merge($values, [$request, $options]) as $value) { <add> VarDumper::dump($value); <add> } <add> <add> exit(1); <add> }); <add> } <add> <ide> /** <ide> * Issue a GET request to the given URL. <ide> *
1
Ruby
Ruby
add method to retrieve formula and casks
72ebd2127f65d3edf0951b5b3e39b277808ce9cb
<ide><path>Library/Homebrew/cli/args.rb <ide> def freeze_named_args!(named_args) <ide> @resolved_formulae = nil <ide> @formulae_paths = nil <ide> @casks = nil <add> @formulae_and_casks = nil <ide> @kegs = nil <ide> <ide> self[:named_args] = named_args <ide> def casks <ide> .freeze <ide> end <ide> <add> def formulae_and_casks <add> require "cask/cask_loader" <add> require "cask/exceptions" <add> <add> @formulae_and_casks ||= downcased_unique_named.map do |name| <add> begin <add> Formulary.factory(name, spec) <add> rescue FormulaUnavailableError => e <add> begin <add> Cask::CaskLoader.load(name) <add> rescue Cask::CaskUnavailableError <add> raise e <add> end <add> end <add> end.uniq.freeze <add> end <add> <ide> def kegs <ide> require "keg" <ide> require "formula"
1
Mixed
Text
add part 3 skeleton
e8e6eefcfa6b237175e87f6979f61d357984e6b8
<ide><path>docs/tutorials/fundamentals/part-1-overview.md <ide> Welcome to the Redux Fundamentals tutorial! **This tutorial will introduce you t <ide> <ide> In Part 1 of this tutorial, we'll briefly look at a minimal example of a working Redux app to see what the pieces are, and in [Part 2](./part-2-concepts-data-flow.md) we'll look at those pieces in more detail and how data flows in a Redux application. <ide> <del>Starting in [Part 3](./part-3-actions-reducers.md), we'll use that knowledge to build a small example app that demonstrates how these pieces fit together and talk about how Redux works in practice. After we finish building the working example app "by hand" so that you can see exactly what's happening, we'll talk about some of the standard patterns and abstractions typically used with Redux. Finally, we'll see how these lower-level examples translate into the higher-level patterns that we recommend for actual usage in real applications. <add>Starting in [Part 3](./part-3-state-reducers-actions.md), we'll use that knowledge to build a small example app that demonstrates how these pieces fit together and talk about how Redux works in practice. After we finish building the working example app "by hand" so that you can see exactly what's happening, we'll talk about some of the standard patterns and abstractions typically used with Redux. Finally, we'll see how these lower-level examples translate into the higher-level patterns that we recommend for actual usage in real applications. <ide> <ide> ### How to Read This Tutorial <ide> <ide> With that in mind, let's review what we've learned so far: <ide> <ide> ## What's Next? <ide> <del>Now that you know what the basic pieces of a Redux app are, step ahead to [Part 2](./part-2-concepts-data-flow), <add>Now that you know what the basic pieces of a Redux app are, step ahead to [Part 2](./part-2-concepts-data-flow.md), <ide> where we'll look at how data flows through a Redux app in more detail. <ide><path>docs/tutorials/fundamentals/part-2-concepts-data-flow.md <ide> the pieces that make up the app. We also briefly mentioned some of the terms and <ide> In this section, we'll look at those terms and concepts in more detail, and talk more about how data flows <ide> through a Redux application. <ide> <del>## Redux Terms and Concepts <add>## Background Concepts <ide> <ide> Before we dive into some actual code, let's talk about some of the terms and concepts you'll need to know to use Redux. <ide> <ide> For more info on how immutability works in JavaScript, see: <ide> <ide> ::: <ide> <del>### Terminology <add>## Redux Terminology <ide> <ide> There's some important Redux terms that you'll need to be familiar with before we continue: <ide> <del>#### Actions <add>### Actions <ide> <ide> An **action** is a plain JavaScript object that has a `type` field. **You can think of an action as an event that describes something that happened in the application**. <ide> <ide> const addTodoAction = { <ide> } <ide> ``` <ide> <del>#### Reducers <add>### Reducers <ide> <ide> A **reducer** is a function that receives the current `state` and an `action` object, decides how to update the state if necessary, and returns the new state: `(state, action) => newState`. **You can think of a reducer as an event listener which handles events based on the received action (event) type.** <ide> <ide> We can say that **Redux reducers reduce a set of actions (over time) into a sing <ide> <ide> </DetailedExplanation> <ide> <del>#### Store <add>### Store <ide> <ide> The current Redux application state lives in an object called the **store** . <ide> <ide> console.log(store.getState()) <ide> // {value: 0} <ide> ``` <ide> <del>#### Dispatch <add>### Dispatch <ide> <ide> The Redux store has a method called `dispatch`. **The only way to update the state is to call `store.dispatch()` and pass in an action object**. The store will run its reducer function and save the new state value inside, and we can call `getState()` to retrieve the updated value: <ide> <ide> console.log(store.getState()) <ide> <ide> **You can think of dispatching actions as "triggering an event"** in the application. Something happened, and we want the store to know about it. Reducers act like event listeners, and when they hear an action they are interested in, they update the state in response. <ide> <del>#### Selectors <add>### Selectors <ide> <ide> **Selectors** are functions that know how to extract specific pieces of information from a store state value. As an application grows bigger, this can help avoid repeating logic as different parts of the app need to read the same data: <ide> <ide> console.log(currentValue) <ide> // 2 <ide> ``` <ide> <del>### Redux Application Data Flow <add>## Core Concepts and Principles <add> <add>**TODO** Something from the "Core Concepts" and "Three Principles" pages here? <add> <add>## Redux Application Data Flow <ide> <ide> Earlier, we talked about "one-way data flow", which describes this sequence of steps to update the app: <ide> <ide><path>website/sidebars.js <ide> module.exports = { <ide> label: 'Redux Fundamentals', <ide> items: [ <ide> 'tutorials/fundamentals/part-1-overview', <del> 'tutorials/fundamentals/part-2-concepts-data-flow' <add> 'tutorials/fundamentals/part-2-concepts-data-flow', <add> 'tutorials/fundamentals/part-3-state-reducers-actions' <ide> ] <ide> }, <ide> {
3
Ruby
Ruby
close the websocket on exception
f29a14207aa3084cb2f0a73cb5672729aa0c6d62
<ide><path>lib/action_cable/server.rb <ide> def worker_pool <ide> self.class.worker_pool <ide> end <ide> <add> def handle_exception <add> logger.error "[ActionCable] Closing connection" <add> <add> @websocket.close <add> end <add> <ide> private <ide> def initialize_client <ide> connect if respond_to?(:connect) <ide><path>lib/action_cable/worker.rb <ide> def invoke(receiver, method, *args) <ide> run_callbacks :work do <ide> receiver.send method, *args <ide> end <add> rescue Exception => e <add> logger.error "[ActionCable] There was an exception - #{e.class}(#{e.message})" <add> logger.error e.backtrace.join("\n") <add> <add> receiver.handle_exception if receiver.respond_to?(:handle_exception) <ide> end <ide> <ide> def run_periodic_timer(channel, callback) <ide> def run_periodic_timer(channel, callback) <ide> end <ide> end <ide> <add> private <add> def logger <add> ActionCable::Server.logger <add> end <ide> end <ide> end
2
Text
Text
fix broken link for academic honesty policy
be6325a3f0ed9cd4475b0e46a256216d288177b5
<ide><path>README.md <ide> You can pull in these test suites through [freeCodeCamp's CDN](https://cdn.freec <ide> <ide> Once you’ve earned a certification, you will always have it. You will always be able to link to it from your LinkedIn or résumé. And when your prospective employers or freelance clients click that link, they’ll see a verified certification specific to you. <ide> <del>The one exception to this is in the event that we discover violations of our [Academic Honesty Policy](https://www.freecodecamp.org/academic-honesty-policy). When we catch people unambiguously plagiarizing (submitting other people's code or projects as their own without citation), we do what all rigorous institutions of learning should do - we revoke their certifications and ban those people. <add>The one exception to this is in the event that we discover violations of our [Academic Honesty Policy](https://www.freecodecamp.org/academic-honesty). When we catch people unambiguously plagiarizing (submitting other people's code or projects as their own without citation), we do what all rigorous institutions of learning should do - we revoke their certifications and ban those people. <ide> <ide> Here are our six core certifications: <ide>
1
PHP
PHP
add islocale method
17d6293ba52093ff71f464da7785206dde148158
<ide><path>src/Illuminate/Foundation/Application.php <ide> public function setLocale($locale) <ide> $this['events']->fire('locale.changed', [$locale]); <ide> } <ide> <add> /** <add> * Determine if application locale equals the given locale. <add> * <add> * @param string $locale <add> * @return bool <add> */ <add> public function isLocale($locale) <add> { <add> return $this->getLocale() == $locale; <add> } <add> <ide> /** <ide> * Register the core class aliases in the container. <ide> *
1
Ruby
Ruby
compare cellar and prefix against constants
7b1ca1d152b732fad3fa74651da8c4baff273b15
<ide><path>Library/Homebrew/cmd/bottle.rb <ide> <% if root_url != BottleSpecification::DEFAULT_ROOT_URL %> <ide> root_url "<%= root_url %>" <ide> <% end %> <del> <% if prefix.to_s != "/usr/local" %> <add> <% if prefix != BottleSpecification::DEFAULT_PREFIX %> <ide> prefix "<%= prefix %>" <ide> <% end %> <ide> <% if cellar.is_a? Symbol %> <ide> cellar :<%= cellar %> <del> <% elsif cellar.to_s != "/usr/local/Cellar" %> <add> <% elsif cellar != BottleSpecification::DEFAULT_CELLAR %> <ide> cellar "<%= cellar %>" <ide> <% end %> <ide> <% if revision > 0 %> <ide> def bottle_formula f <ide> <ide> bottle = BottleSpecification.new <ide> bottle.root_url(root_url) if root_url <del> bottle.prefix HOMEBREW_PREFIX <del> bottle.cellar relocatable ? :any : HOMEBREW_CELLAR <add> bottle.prefix HOMEBREW_PREFIX.to_s <add> bottle.cellar relocatable ? :any : HOMEBREW_CELLAR.to_s <ide> bottle.revision bottle_revision <ide> bottle.sha1 bottle_path.sha1 => bottle_tag <ide>
1
Text
Text
fix broken link in testing documentation
15adead428afd290baa196daa132fd44a116cfd7
<ide><path>docs/Testing.md <ide> You can run integration tests locally with cmd+U in the IntegrationTest and UIEx <ide> <ide> A common type of integration test is the snapshot test. These tests render a component, and verify snapshots of the screen against reference images using `TestModule.verifySnapshot()`, using the [`FBSnapshotTestCase`](https://github.com/facebook/ios-snapshot-test-case) library behind the scenes. Reference images are recorded by setting `recordMode = YES` on the `RCTTestRunner`, then running the tests. Snapshots will differ slightly between 32 and 64 bit, and various OS versions, so it's recommended that you enforce tests are run with the correct configuration. It's also highly recommended that all network data be mocked out, along with other potentially troublesome dependencies. See [`SimpleSnapshotTest`](https://github.com/facebook/react-native/blob/master/Examples/UIExplorer/UIExplorerIntegrationTests/js/SimpleSnapshotTest.js) for a basic example. <ide> <del>If you make a change that affects a snapshot test in a PR, such as adding a new example case to one of the examples that is snapshotted, you'll need to re-record the snapshotshot reference image. To do this, simply change to `_runner.recordMode = YES;` in [UIExplorer/IntegrationTests.m](https://github.com/facebook/react-native/blob/master/Examples/UIExplorer/UIExplorerIntegrationTests/IntegrationTests.m#L46), re-run the failing tests, then flip record back to `NO` and submit/update your PR and wait to see if the Travis build passes. <add>If you make a change that affects a snapshot test in a PR, such as adding a new example case to one of the examples that is snapshotted, you'll need to re-record the snapshotshot reference image. To do this, simply change to `_runner.recordMode = YES;` in [UIExplorer/UIExplorerSnapshotTests.m](https://github.com/facebook/react-native/blob/master/Examples/UIExplorer/UIExplorerIntegrationTests/UIExplorerSnapshotTests.m#L42), re-run the failing tests, then flip record back to `NO` and submit/update your PR and wait to see if the Travis build passes.
1
PHP
PHP
implement basics of scoped middleware
7b752864a0ef1d156e4a0bceb24fe8f49d4ed848
<ide><path>src/Routing/RouteCollection.php <ide> use Cake\Routing\Exception\MissingRouteException; <ide> use Cake\Routing\Route\Route; <ide> use Psr\Http\Message\ServerRequestInterface; <add>use RuntimeException; <ide> <ide> /** <ide> * Contains a collection of routes. <ide> class RouteCollection <ide> */ <ide> protected $_paths = []; <ide> <add> /** <add> * A map of middleware names and the related objects. <add> * <add> * @var array <add> */ <add> protected $_middleware = []; <add> <add> /** <add> * A map of paths and the list of applicable middleware. <add> * <add> * @var array <add> */ <add> protected $_middlewarePaths = []; <add> <ide> /** <ide> * Route extensions <ide> * <ide> public function extensions($extensions = null, $merge = true) <ide> <ide> return $this->_extensions = $extensions; <ide> } <add> <add> /** <add> * Register a middleware with the RouteCollection. <add> * <add> * Once middleware has been registered, it can be applied to the current routing <add> * scope or any child scopes that share the same RoutingCollection. <add> * <add> * @param string $name The name of the middleware. Used when applying middleware to a scope. <add> * @param callable $middleware The middleware object to register. <add> * @return $this <add> */ <add> public function registerMiddleware($name, callable $middleware) <add> { <add> if (is_string($middleware)) { <add> throw new RuntimeException("The '$name' middleware is not a callable object."); <add> } <add> $this->_middleware[$name] = $middleware; <add> <add> return $this; <add> } <add> <add> /** <add> * Check if the named middleware has been registered. <add> * <add> * @param string $name The name of the middleware to check. <add> * @return void <add> */ <add> public function hasMiddleware($name) <add> { <add> return isset($this->_middleware[$name]); <add> } <add> <add> /** <add> * Enable a registered middleware(s) for the provided path <add> * <add> * @param string $path The URL path to register middleware for. <add> * @param string[] $names The middleware names to add for the path. <add> * @return $this <add> */ <add> public function enableMiddleware($path, array $middleware) <add> { <add> foreach ($middleware as $name) { <add> if (!$this->hasMiddleware($name)) { <add> $message = "Cannot apply '$name' middleware to path '$path'. It has not been registered."; <add> throw new RuntimeException($message); <add> } <add> } <add> if (!isset($this->_middlewarePaths[$path])) { <add> $this->_middlewarePaths[$path] = []; <add> } <add> $this->_middlewarePaths[$path] = array_merge($this->_middlewarePaths[$path], $middleware); <add> <add> return $this; <add> } <add> <add> /** <add> * Get an array of middleware that matches the provided URL. <add> * <add> * All middleware lists that match the URL will be merged together from shortest <add> * path to longest path. If a middleware would be added to the set more than <add> * once because it is connected to multiple path substrings match, it will only <add> * be added once at its first occurrence. <add> * <add> * @param string $needle The URL path to find middleware for. <add> * @return array <add> */ <add> public function getMatchingMiddleware($needle) <add> { <add> $matching = []; <add> foreach ($this->_middlewarePaths as $path => $middleware) { <add> if (strpos($needle, $path) === 0) { <add> $matching = array_merge($matching, $middleware); <add> } <add> } <add> <add> $resolved = []; <add> foreach ($matching as $name) { <add> if (!isset($resolved[$name])) { <add> $resolved[$name] = $this->_middleware[$name]; <add> } <add> } <add> <add> return array_values($resolved); <add> } <ide> } <ide><path>tests/TestCase/Routing/RouteCollectionTest.php <ide> use Cake\Routing\RouteCollection; <ide> use Cake\Routing\Route\Route; <ide> use Cake\TestSuite\TestCase; <add>use \stdClass; <ide> <ide> class RouteCollectionTest extends TestCase <ide> { <ide> public function testExtensions() <ide> $this->collection->extensions(['csv'], false); <ide> $this->assertEquals(['csv'], $this->collection->extensions()); <ide> } <add> <add> /** <add> * String methods are not acceptable. <add> * <add> * @expectedException \RuntimeException <add> * @expectedExceptionMessage The 'bad' middleware is not a callable object. <add> * @return void <add> */ <add> public function testRegisterMiddlewareNoCallableString() <add> { <add> $this->collection->registerMiddleware('bad', 'strlen'); <add> } <add> <add> /** <add> * Test adding middleware to the collection. <add> * <add> * @return void <add> */ <add> public function testRegisterMiddleware() <add> { <add> $result = $this->collection->registerMiddleware('closure', function () { <add> }); <add> $this->assertSame($result, $this->collection); <add> <add> $mock = $this->getMockBuilder('\stdClass') <add> ->setMethods(['__invoke']) <add> ->getMock(); <add> $result = $this->collection->registerMiddleware('callable', $mock); <add> $this->assertSame($result, $this->collection); <add> <add> $this->assertTrue($this->collection->hasMiddleware('closure')); <add> $this->assertTrue($this->collection->hasMiddleware('callable')); <add> } <add> <add> /** <add> * Test adding middleware with a placeholder in the path. <add> * <add> * @return void <add> */ <add> public function testEnableMiddlewareBasic() <add> { <add> $mock = $this->getMockBuilder('\stdClass') <add> ->setMethods(['__invoke']) <add> ->getMock(); <add> $this->collection->registerMiddleware('callable', $mock); <add> $this->collection->registerMiddleware('callback_two', $mock); <add> <add> $result = $this->collection->enableMiddleware('/api', ['callable', 'callback_two']); <add> $this->assertSame($result, $this->collection); <add> } <add> <add> /** <add> * Test adding middleware with a placeholder in the path. <add> * <add> * @return void <add> */ <add> public function testGetMatchingMiddlewareBasic() <add> { <add> $mock = $this->getMockBuilder('\stdClass') <add> ->setMethods(['__invoke']) <add> ->getMock(); <add> $this->collection->registerMiddleware('callable', $mock); <add> $this->collection->registerMiddleware('callback_two', $mock); <add> <add> $result = $this->collection->enableMiddleware('/api', ['callable']); <add> $middleware = $this->collection->getMatchingMiddleware('/api/v1/articles'); <add> $this->assertCount(1, $middleware); <add> $this->assertSame($middleware[0], $mock); <add> } <add> <add> /** <add> * Test enabling and matching <add> * <add> * @return void <add> */ <add> public function testGetMatchingMiddlewareMultiplePaths() <add> { <add> $mock = $this->getMockBuilder('\stdClass') <add> ->setMethods(['__invoke']) <add> ->getMock(); <add> $mockTwo = $this->getMockBuilder('\stdClass') <add> ->setMethods(['__invoke']) <add> ->getMock(); <add> $this->collection->registerMiddleware('callable', $mock); <add> $this->collection->registerMiddleware('callback_two', $mockTwo); <add> <add> $this->collection->enableMiddleware('/api', ['callable']); <add> $this->collection->enableMiddleware('/api/v1/articles', ['callback_two']); <add> <add> $middleware = $this->collection->getMatchingMiddleware('/articles'); <add> $this->assertCount(0, $middleware); <add> <add> $middleware = $this->collection->getMatchingMiddleware('/api/v1/articles/1'); <add> $this->assertCount(2, $middleware); <add> $this->assertEquals([$mock, $mockTwo], $middleware, 'Both middleware match'); <add> <add> $middleware = $this->collection->getMatchingMiddleware('/api/v1/comments'); <add> $this->assertCount(1, $middleware); <add> $this->assertEquals([$mock], $middleware, 'Should not match /articles middleware'); <add> } <add> <add> /** <add> * Test enabling and matching <add> * <add> * @return void <add> */ <add> public function testGetMatchingMiddlewareDeduplicate() <add> { <add> $mock = $this->getMockBuilder('\stdClass') <add> ->setMethods(['__invoke']) <add> ->getMock(); <add> $mockTwo = $this->getMockBuilder('\stdClass') <add> ->setMethods(['__invoke']) <add> ->getMock(); <add> $this->collection->registerMiddleware('callable', $mock); <add> $this->collection->registerMiddleware('callback_two', $mockTwo); <add> <add> $this->collection->enableMiddleware('/api', ['callable']); <add> $this->collection->enableMiddleware('/api/v1/articles', ['callback_two', 'callable']); <add> <add> $middleware = $this->collection->getMatchingMiddleware('/api/v1/articles/1'); <add> $this->assertCount(2, $middleware); <add> $this->assertEquals([$mock, $mockTwo], $middleware, 'Both middleware match'); <add> } <add> <add> /** <add> * Test adding middleware with a placeholder in the path. <add> * <add> * @return void <add> */ <add> public function testEnableMiddlewareWithPlaceholder() <add> { <add> $mock = $this->getMockBuilder('\stdClass') <add> ->setMethods(['__invoke']) <add> ->getMock(); <add> $this->collection->registerMiddleware('callable', $mock); <add> <add> $this->collection->enableMiddleware('/articles/:article_id/comments', ['callable']); <add> $this->markTestIncomplete(); <add> <add> $middleware = $this->collection->getMatchingMiddleware('/articles/123/comments'); <add> $this->assertEquals([$mock], $middleware); <add> <add> $middleware = $this->collection->getMatchingMiddleware('/articles/abc-123/comments/99'); <add> $this->assertEquals([$mock], $middleware); <add> } <add> <add> /** <add> * Test applying middleware to a scope when it doesn't exist <add> * <add> * @expectedException \RuntimeException <add> * @expectedExceptionMessage Cannot apply 'bad' middleware to path '/api'. It has not been registered. <add> * @return void <add> */ <add> public function testEnableMiddlewareUnregistered() <add> { <add> $mock = $this->getMockBuilder('\stdClass') <add> ->setMethods(['__invoke']) <add> ->getMock(); <add> $this->collection->registerMiddleware('callable', $mock); <add> $this->collection->enableMiddleware('/api', ['callable', 'bad']); <add> } <ide> }
2
Mixed
Javascript
truncate inspect array and typed array
a2e57192ebf79084f34766a89e8082067f48af14
<ide><path>doc/api/util.md <ide> formatted string: <ide> will be introspected to show their `target` and `hander` objects. Defaults to <ide> `false`. <ide> <add> - `maxArrayLength` - specifies the maximum number of Array and TypedArray <add> elements to include when formatting. Defaults to `100`. Set to `null` to <add> show all array elements. Set to `0` or negative to show no array elements. <add> <ide> Example of inspecting all properties of the `util` object: <ide> <ide> ```js <ide><path>lib/util.js <ide> const internalUtil = require('internal/util'); <ide> const binding = process.binding('util'); <ide> <ide> const isError = internalUtil.isError; <add>const kDefaultMaxLength = 100; <ide> <ide> var Debug; <ide> <ide> function inspect(obj, opts) { <ide> if (ctx.customInspect === undefined) ctx.customInspect = true; <ide> if (ctx.showProxy === undefined) ctx.showProxy = false; <ide> if (ctx.colors) ctx.stylize = stylizeWithColor; <add> if (ctx.maxArrayLength === undefined) ctx.maxArrayLength = kDefaultMaxLength; <add> if (ctx.maxArrayLength === null) ctx.maxArrayLength = Infinity; <ide> return formatValue(ctx, obj, ctx.depth); <ide> } <ide> exports.inspect = inspect; <ide> function formatObject(ctx, value, recurseTimes, visibleKeys, keys) { <ide> <ide> function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { <ide> var output = []; <del> for (var i = 0, l = value.length; i < l; ++i) { <add> const maxLength = Math.min(Math.max(0, ctx.maxArrayLength), value.length); <add> const remaining = value.length - maxLength; <add> for (var i = 0; i < maxLength; ++i) { <ide> if (hasOwnProperty(value, String(i))) { <ide> output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, <ide> String(i), true)); <ide> } else { <ide> output.push(''); <ide> } <ide> } <add> if (remaining > 0) { <add> output.push(`... ${remaining} more item${remaining > 1 ? 's' : ''}`); <add> } <ide> keys.forEach(function(key) { <ide> if (typeof key === 'symbol' || !key.match(/^\d+$/)) { <ide> output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, <ide> function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { <ide> <ide> <ide> function formatTypedArray(ctx, value, recurseTimes, visibleKeys, keys) { <del> var output = new Array(value.length); <del> for (var i = 0, l = value.length; i < l; ++i) <add> const maxLength = Math.min(Math.max(0, ctx.maxArrayLength), value.length); <add> const remaining = value.length - maxLength; <add> var output = new Array(maxLength); <add> for (var i = 0; i < maxLength; ++i) <ide> output[i] = formatNumber(ctx, value[i]); <add> if (remaining > 0) { <add> output.push(`... ${remaining} more item${remaining > 1 ? 's' : ''}`); <add> } <ide> for (const key of keys) { <ide> if (typeof key === 'symbol' || !key.match(/^\d+$/)) { <ide> output.push( <ide><path>test/parallel/test-util-inspect.js <ide> checkAlignment(new Map(big_array.map(function(y) { return [y, null]; }))); <ide> const x = Object.create(null); <ide> assert.equal(util.inspect(x), '{}'); <ide> } <add> <add>// The following maxArrayLength tests were introduced after v6.0.0 was released. <add>// Do not backport to v5/v4 unless all of <add>// https://github.com/nodejs/node/pull/6334 is backported. <add>{ <add> const x = Array(101); <add> assert(/1 more item/.test(util.inspect(x))); <add>} <add> <add>{ <add> const x = Array(101); <add> assert(!/1 more item/.test(util.inspect(x, {maxArrayLength: 101}))); <add>} <add> <add>{ <add> const x = Array(101); <add> assert(/^\[ ... 101 more items \]$/.test( <add> util.inspect(x, {maxArrayLength: 0}))); <add>} <add> <add>{ <add> const x = new Uint8Array(101); <add> assert(/1 more item/.test(util.inspect(x))); <add>} <add> <add>{ <add> const x = new Uint8Array(101); <add> assert(!/1 more item/.test(util.inspect(x, {maxArrayLength: 101}))); <add>} <add> <add>{ <add> const x = new Uint8Array(101); <add> assert(/\[ ... 101 more items \]$/.test( <add> util.inspect(x, {maxArrayLength: 0}))); <add>} <add> <add>{ <add> const x = Array(101); <add> assert(!/1 more item/.test(util.inspect(x, {maxArrayLength: null}))); <add>} <add> <add>{ <add> const x = Array(101); <add> assert(!/1 more item/.test(util.inspect(x, {maxArrayLength: Infinity}))); <add>} <add> <add>{ <add> const x = new Uint8Array(101); <add> assert(!/1 more item/.test(util.inspect(x, {maxArrayLength: null}))); <add>} <add> <add>{ <add> const x = new Uint8Array(101); <add> assert(!/1 more item/.test(util.inspect(x, {maxArrayLength: Infinity}))); <add>}
3
Ruby
Ruby
remove extra loop in view_assigns
f6bf17058e30675e92689f4bf9605983b4cafc92
<ide><path>actionpack/lib/abstract_controller/rendering.rb <ide> def rendered_format <ide> # You can overwrite this configuration per controller. <ide> def view_assigns <ide> protected_vars = _protected_ivars <del> variables = instance_variables <ide> <del> variables.reject! { |s| protected_vars.include? s } <del> variables.each_with_object({}) { |name, hash| <del> hash[name.slice(1, name.length)] = instance_variable_get(name) <del> } <add> instance_variables.each_with_object({}) do |name, hash| <add> unless protected_vars.include?(name) <add> hash[name.slice(1, name.length)] = instance_variable_get(name) <add> end <add> end <ide> end <ide> <ide> private
1
Java
Java
add nonnull annotation to fabricuimanager api
a1a56fe4e5ca6214fe10a5925fcfb3222573206b
<ide><path>ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java <ide> @SuppressLint("MissingNativeLoadLibrary") <ide> public class FabricUIManager implements UIManager, LifecycleEventListener { <ide> <del> public static final String TAG = FabricUIManager.class.getSimpleName(); <add> public static final String TAG = "FabricUIManager"; <ide> public static final boolean DEBUG = <ide> ReactFeatureFlags.enableFabricLogs <ide> || PrinterHolder.getPrinter() <ide> private long measure( <ide> @SuppressWarnings("unused") <ide> private long measure( <ide> String componentName, <del> ReadableMap localData, <del> ReadableMap props, <del> ReadableMap state, <add> @NonNull ReadableMap localData, <add> @NonNull ReadableMap props, <add> @NonNull ReadableMap state, <ide> float minWidth, <ide> float maxWidth, <ide> float minHeight, <ide> private long measure( <ide> <ide> @Override <ide> @ThreadConfined(UI) <del> public void synchronouslyUpdateViewOnUIThread(int reactTag, ReadableMap props) { <add> public void synchronouslyUpdateViewOnUIThread(int reactTag, @NonNull ReadableMap props) { <ide> UiThreadUtil.assertOnUiThread(); <ide> long time = SystemClock.uptimeMillis(); <ide> int commitNumber = mCurrentSynchronousCommitNumber++; <ide> public void synchronouslyUpdateViewOnUIThread(int reactTag, ReadableMap props) { <ide> @DoNotStrip <ide> @SuppressWarnings("unused") <ide> private void scheduleMountItem( <del> final MountItem mountItem, <add> @NonNull final MountItem mountItem, <ide> int commitNumber, <ide> long commitStartTime, <ide> long diffStartTime,
1
Python
Python
update vector meta in meta.json
37e62ab0e21757751b9606cefbc9f1deec8f2300
<ide><path>spacy/cli/package.py <ide> def generate_meta(model_path, existing_meta): <ide> nlp = util.load_model_from_path(Path(model_path)) <ide> meta['pipeline'] = nlp.pipe_names <ide> meta['vectors'] = {'width': nlp.vocab.vectors_length, <del> 'entries': len(nlp.vocab.vectors)} <add> 'vectors': len(nlp.vocab.vectors), <add> 'keys': nlp.vocab.vectors.n_keys} <ide> prints("Enter the package settings for your model. The following " <ide> "information will be read from your model data: pipeline, vectors.", <ide> title="Generating meta.json") <ide><path>spacy/cli/train.py <ide> def train(cmd, lang, output_dir, train_data, dev_data, n_iter=30, n_sents=0, <ide> meta['speed'] = {'nwords': nwords, 'cpu': cpu_wps, <ide> 'gpu': gpu_wps} <ide> meta['vectors'] = {'width': nlp.vocab.vectors_length, <del> 'entries': len(nlp.vocab.vectors)} <add> 'vectors': len(nlp.vocab.vectors), <add> 'keys': nlp.vocab.vectors.n_keys} <ide> meta['lang'] = nlp.lang <ide> meta['pipeline'] = pipeline <ide> meta['spacy_version'] = '>=%s' % about.__version__ <ide><path>spacy/language.py <ide> def meta(self): <ide> self._meta.setdefault('url', '') <ide> self._meta.setdefault('license', '') <ide> self._meta['vectors'] = {'width': self.vocab.vectors_length, <del> 'entries': len(self.vocab.vectors)} <add> 'vectors': len(self.vocab.vectors), <add> 'keys': self.vocab.vectors.n_keys} <ide> self._meta['pipeline'] = self.pipe_names <ide> return self._meta <ide>
3
Java
Java
clarify @enablescheduling javadoc
9a856c09f322b8ae821ff5e6a86dc0b0aeaf618d
<ide><path>spring-context/src/main/java/org/springframework/scheduling/annotation/EnableScheduling.java <ide> /* <del> * Copyright 2002-2011 the original author or authors. <add> * Copyright 2002-2012 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> * taskRegistrar.setScheduler(taskExecutor()); <ide> * } <ide> * <del> * &#064;Bean <add> * &#064;Bean(destroyMethod="shutdown") <ide> * public Executor taskExecutor() { <ide> * return Executors.newScheduledThreadPool(100); <ide> * } <ide> * }</pre> <ide> * <add> * Note in the example above the use of {@code @Bean(destroyMethod="shutdown")}. This <add> * ensures that the task executor is properly shut down when the Spring application <add> * context itself is closed. <add> * <ide> * Implementing {@code SchedulingConfigurer} also allows for fine-grained <ide> * control over task registration via the {@code ScheduledTaskRegistrar}. <ide> * For example, the following configures the execution of a particular bean <ide> * ); <ide> * } <ide> * <del> * &#064;Bean <add> * &#064;Bean(destroyMethod="shutdown") <ide> * public Executor taskScheduler() { <ide> * return Executors.newScheduledThreadPool(42); <ide> * }
1
Python
Python
add note to rint docstrings
eeba278c401dea4f38d92897ced61ec49775def4
<ide><path>numpy/core/code_generators/ufunc_docstrings.py <ide> def add_newdoc(place, name, doc): <ide> -------- <ide> fix, ceil, floor, trunc <ide> <add> Notes <add> ----- <add> For values exactly halfway between rounded decimal values, NumPy <add> rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, <add> -0.5 and 0.5 round to 0.0, etc. <add> <ide> Examples <ide> -------- <ide> >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0])
1
PHP
PHP
fix duplicate model name
358827f3b0e44eeb166e6ef70d720213b5b5d3a7
<ide><path>tests/Integration/Database/EloquentModelScopeTest.php <ide> class EloquentModelScopeTest extends DatabaseTestCase <ide> { <ide> public function testModelHasScope() <ide> { <del> $model = new TestModel1; <add> $model = new TestScopeModel1; <ide> <ide> $this->assertTrue($model->hasScope("exists")); <ide> } <ide> <ide> public function testModelDoesNotHaveScope() <ide> { <del> $model = new TestModel1; <add> $model = new TestScopeModel1; <ide> <ide> $this->assertFalse($model->hasScope("doesNotExist")); <ide> } <ide> } <ide> <del>class TestModel1 extends Model <add>class TestScopeModel1 extends Model <ide> { <ide> public function scopeExists() <ide> {
1
Java
Java
introduce nonnull to package-info
0e5f27c94e5fa33a294d342dbc9ed61e6c032468
<ide><path>spring-websocket/src/main/java/org/springframework/web/socket/server/jetty/JettyRequestUpgradeStrategy.java <ide> import org.springframework.http.server.ServerHttpResponse; <ide> import org.springframework.http.server.ServletServerHttpRequest; <ide> import org.springframework.http.server.ServletServerHttpResponse; <add>import org.springframework.lang.Nullable; <ide> import org.springframework.util.Assert; <ide> import org.springframework.util.ClassUtils; <ide> import org.springframework.util.CollectionUtils; <ide> public class JettyRequestUpgradeStrategy implements RequestUpgradeStrategy, Serv <ide> private static final ThreadLocal<WebSocketHandlerContainer> containerHolder = <ide> new NamedThreadLocal<>("WebSocketHandlerContainer"); <ide> <del> <add> @Nullable <ide> private WebSocketPolicy policy; <ide> <add> @Nullable <ide> private WebSocketServerFactory factory; <ide> <add> @Nullable <ide> private ServletContext servletContext; <ide> <ide> private volatile boolean running = false; <ide> <add> @Nullable <ide> private volatile List<WebSocketExtension> supportedExtensions; <ide> <ide> <ide> private Set<String> getExtensionNames() { <ide> <ide> @Override <ide> public void upgrade(ServerHttpRequest request, ServerHttpResponse response, <del> String selectedProtocol, List<WebSocketExtension> selectedExtensions, Principal user, <add> @Nullable String selectedProtocol, List<WebSocketExtension> selectedExtensions, @Nullable Principal user, <ide> WebSocketHandler wsHandler, Map<String, Object> attributes) throws HandshakeFailureException { <ide> <ide> Assert.isInstanceOf(ServletServerHttpRequest.class, request, "ServletServerHttpRequest required"); <ide><path>spring-websocket/src/main/java/org/springframework/web/socket/server/jetty/package-info.java <ide> /** <ide> * Server-side support for the Jetty 9+ WebSocket API. <ide> */ <add>@NonNullApi <add>@NonNullFields <ide> package org.springframework.web.socket.server.jetty; <add> <add>import org.springframework.lang.NonNullApi; <add>import org.springframework.lang.NonNullFields;
2
Javascript
Javascript
add xhr statustext to completerequest callback
1d2414ca93a0340840ea1e80c48edb51ec55cd48
<ide><path>src/ng/http.js <ide> function $HttpProvider() { <ide> * - **status** – `{number}` – HTTP status code of the response. <ide> * - **headers** – `{function([headerName])}` – Header getter function. <ide> * - **config** – `{Object}` – The configuration object that was used to generate the request. <add> * - **statusText** – `{string}` – HTTP status text of the response. <ide> * <ide> * @property {Array.<Object>} pendingRequests Array of config objects for currently pending <ide> * requests. This is primarily meant to be used for debugging purposes. <ide> function $HttpProvider() { <ide> } else { <ide> // serving from cache <ide> if (isArray(cachedResp)) { <del> resolvePromise(cachedResp[1], cachedResp[0], copy(cachedResp[2])); <add> resolvePromise(cachedResp[1], cachedResp[0], copy(cachedResp[2]), cachedResp[3]); <ide> } else { <del> resolvePromise(cachedResp, 200, {}); <add> resolvePromise(cachedResp, 200, {}, 'OK'); <ide> } <ide> } <ide> } else { <ide> function $HttpProvider() { <ide> * - resolves the raw $http promise <ide> * - calls $apply <ide> */ <del> function done(status, response, headersString) { <add> function done(status, response, headersString, statusText) { <ide> if (cache) { <ide> if (isSuccess(status)) { <del> cache.put(url, [status, response, parseHeaders(headersString)]); <add> cache.put(url, [status, response, parseHeaders(headersString), statusText]); <ide> } else { <ide> // remove promise from the cache <ide> cache.remove(url); <ide> } <ide> } <ide> <del> resolvePromise(response, status, headersString); <add> resolvePromise(response, status, headersString, statusText); <ide> if (!$rootScope.$$phase) $rootScope.$apply(); <ide> } <ide> <ide> <ide> /** <ide> * Resolves the raw $http promise. <ide> */ <del> function resolvePromise(response, status, headers) { <add> function resolvePromise(response, status, headers, statusText) { <ide> // normalize internal statuses to 0 <ide> status = Math.max(status, 0); <ide> <ide> (isSuccess(status) ? deferred.resolve : deferred.reject)({ <ide> data: response, <ide> status: status, <ide> headers: headersGetter(headers), <del> config: config <add> config: config, <add> statusText : statusText <ide> }); <ide> } <ide> <ide><path>src/ng/httpBackend.js <ide> function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc <ide> completeRequest(callback, <ide> status || xhr.status, <ide> response, <del> responseHeaders); <add> responseHeaders, <add> xhr.statusText || ''); <ide> } <ide> }; <ide> <ide> function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc <ide> xhr && xhr.abort(); <ide> } <ide> <del> function completeRequest(callback, status, response, headersString) { <add> function completeRequest(callback, status, response, headersString, statusText) { <ide> // cancel timeout and subsequent timeout promise resolution <ide> timeoutId && $browserDefer.cancel(timeoutId); <ide> jsonpDone = xhr = null; <ide> function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc <ide> } <ide> <ide> // normalize IE bug (http://bugs.jquery.com/ticket/1450) <del> status = status == 1223 ? 204 : status; <add> status = status === 1223 ? 204 : status; <add> statusText = statusText || ''; <ide> <del> callback(status, response, headersString); <add> callback(status, response, headersString, statusText); <ide> $browser.$$completeOutstandingRequest(noop); <ide> } <ide> }; <ide><path>src/ngMock/angular-mocks.js <ide> function createHttpBackendMock($rootScope, $delegate, $browser) { <ide> responsesPush = angular.bind(responses, responses.push), <ide> copy = angular.copy; <ide> <del> function createResponse(status, data, headers) { <add> function createResponse(status, data, headers, statusText) { <ide> if (angular.isFunction(status)) return status; <ide> <ide> return function() { <ide> return angular.isNumber(status) <del> ? [status, data, headers] <add> ? [status, data, headers, statusText] <ide> : [200, status, data]; <ide> }; <ide> } <ide> function createHttpBackendMock($rootScope, $delegate, $browser) { <ide> function handleResponse() { <ide> var response = wrapped.response(method, url, data, headers); <ide> xhr.$$respHeaders = response[2]; <del> callback(copy(response[0]), copy(response[1]), xhr.getAllResponseHeaders()); <add> callback(copy(response[0]), copy(response[1]), xhr.getAllResponseHeaders(), <add> copy(response[3] || '')); <ide> } <ide> <ide> function handleTimeout() { <ide> function createHttpBackendMock($rootScope, $delegate, $browser) { <ide> * request is handled. <ide> * <ide> * - respond – <del> * `{function([status,] data[, headers])|function(function(method, url, data, headers)}` <del> * – The respond method takes a set of static data to be returned or a function that can return <del> * an array containing response status (number), response data (string) and response headers <del> * (Object). <add> * `{function([status,] data[, headers, statusText]) <add> * | function(function(method, url, data, headers)}` <add> * – The respond method takes a set of static data to be returned or a function that can <add> * return an array containing response status (number), response data (string), response <add> * headers (Object), and the text for the status (string). <ide> */ <ide> $httpBackend.when = function(method, url, data, headers) { <ide> var definition = new MockHttpExpectation(method, url, data, headers), <ide> chain = { <del> respond: function(status, data, headers) { <del> definition.response = createResponse(status, data, headers); <add> respond: function(status, data, headers, statusText) { <add> definition.response = createResponse(status, data, headers, statusText); <ide> } <ide> }; <ide> <ide> function createHttpBackendMock($rootScope, $delegate, $browser) { <ide> * request is handled. <ide> * <ide> * - respond – <del> * `{function([status,] data[, headers])|function(function(method, url, data, headers)}` <del> * – The respond method takes a set of static data to be returned or a function that can return <del> * an array containing response status (number), response data (string) and response headers <del> * (Object). <add> * `{function([status,] data[, headers, statusText]) <add> * | function(function(method, url, data, headers)}` <add> * – The respond method takes a set of static data to be returned or a function that can <add> * return an array containing response status (number), response data (string), response <add> * headers (Object), and the text for the status (string). <ide> */ <ide> $httpBackend.expect = function(method, url, data, headers) { <ide> var expectation = new MockHttpExpectation(method, url, data, headers); <ide> expectations.push(expectation); <ide> return { <del> respond: function(status, data, headers) { <del> expectation.response = createResponse(status, data, headers); <add> respond: function (status, data, headers, statusText) { <add> expectation.response = createResponse(status, data, headers, statusText); <ide> } <ide> }; <ide> }; <ide> angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { <ide> * control how a matched request is handled. <ide> * <ide> * - respond – <del> * `{function([status,] data[, headers])|function(function(method, url, data, headers)}` <add> * `{function([status,] data[, headers, statusText]) <add> * | function(function(method, url, data, headers)}` <ide> * – The respond method takes a set of static data to be returned or a function that can return <del> * an array containing response status (number), response data (string) and response headers <del> * (Object). <del> * - passThrough – `{function()}` – Any request matching a backend definition with `passThrough` <del> * handler will be passed through to the real backend (an XHR request will be made to the <del> * server.) <add> * an array containing response status (number), response data (string), response headers <add> * (Object), and the text for the status (string). <add> * - passThrough – `{function()}` – Any request matching a backend definition with <add> * `passThrough` handler will be passed through to the real backend (an XHR request will be made <add> * to the server.) <ide> */ <ide> <ide> /** <ide><path>test/ng/httpBackendSpec.js <ide> describe('$httpBackend', function() { <ide> expect(xhr.$$data).toBe(null); <ide> }); <ide> <add> it('should call completion function with xhr.statusText if present', function() { <add> callback.andCallFake(function(status, response, headers, statusText) { <add> expect(statusText).toBe('OK'); <add> }); <add> <add> $backend('GET', '/some-url', null, callback); <add> xhr = MockXhr.$$lastInstance; <add> xhr.statusText = 'OK'; <add> xhr.readyState = 4; <add> xhr.onreadystatechange(); <add> expect(callback).toHaveBeenCalledOnce(); <add> }); <add> <add> it('should call completion function with empty string if not present', function() { <add> callback.andCallFake(function(status, response, headers, statusText) { <add> expect(statusText).toBe(''); <add> }); <add> <add> $backend('GET', '/some-url', null, callback); <add> xhr = MockXhr.$$lastInstance; <add> xhr.readyState = 4; <add> xhr.onreadystatechange(); <add> expect(callback).toHaveBeenCalledOnce(); <add> }); <add> <add> <ide> it('should normalize IE\'s 1223 status code into 204', function() { <ide> callback.andCallFake(function(status) { <ide> expect(status).toBe(204); <ide><path>test/ng/httpSpec.js <ide> describe('$http', function() { <ide> }); <ide> <ide> <add> it('should pass statusText in response object when a request is successful', function() { <add> $httpBackend.expect('GET', '/url').respond(200, 'SUCCESS', {}, 'OK'); <add> $http({url: '/url', method: 'GET'}).then(function(response) { <add> expect(response.statusText).toBe('OK'); <add> callback(); <add> }); <add> <add> $httpBackend.flush(); <add> expect(callback).toHaveBeenCalledOnce(); <add> }); <add> <add> <add> it('should pass statusText in response object when a request fails', function() { <add> $httpBackend.expect('GET', '/url').respond(404, 'ERROR', {}, 'Not Found'); <add> $http({url: '/url', method: 'GET'}).then(null, function(response) { <add> expect(response.statusText).toBe('Not Found'); <add> callback(); <add> }); <add> <add> $httpBackend.flush(); <add> expect(callback).toHaveBeenCalledOnce(); <add> }); <add> <add> <ide> it('should pass in the response object when a request failed', function() { <ide> $httpBackend.expect('GET', '/url').respond(543, 'bad error', {'request-id': '123'}); <ide> $http({url: '/url', method: 'GET'}).then(null, function(response) { <ide><path>test/ngMock/angular-mocksSpec.js <ide> describe('ngMock', function() { <ide> hb.flush(); <ide> <ide> expect(callback.callCount).toBe(2); <del> expect(callback.argsForCall[0]).toEqual([201, 'second', '']); <del> expect(callback.argsForCall[1]).toEqual([200, 'first', '']); <add> expect(callback.argsForCall[0]).toEqual([201, 'second', '', '']); <add> expect(callback.argsForCall[1]).toEqual([200, 'first', '', '']); <ide> }); <ide> <ide> <ide> describe('respond()', function() { <ide> it('should take values', function() { <del> hb.expect('GET', '/url1').respond(200, 'first', {'header': 'val'}); <add> hb.expect('GET', '/url1').respond(200, 'first', {'header': 'val'}, 'OK'); <ide> hb('GET', '/url1', undefined, callback); <ide> hb.flush(); <ide> <del> expect(callback).toHaveBeenCalledOnceWith(200, 'first', 'header: val'); <add> expect(callback).toHaveBeenCalledOnceWith(200, 'first', 'header: val', 'OK'); <ide> }); <ide> <ide> it('should take function', function() { <del> hb.expect('GET', '/some').respond(function(m, u, d, h) { <del> return [301, m + u + ';' + d + ';a=' + h.a, {'Connection': 'keep-alive'}]; <add> hb.expect('GET', '/some').respond(function (m, u, d, h) { <add> return [301, m + u + ';' + d + ';a=' + h.a, {'Connection': 'keep-alive'}, 'Moved Permanently']; <ide> }); <ide> <ide> hb('GET', '/some', 'data', callback, {a: 'b'}); <ide> hb.flush(); <ide> <del> expect(callback).toHaveBeenCalledOnceWith(301, 'GET/some;data;a=b', 'Connection: keep-alive'); <add> expect(callback).toHaveBeenCalledOnceWith(301, 'GET/some;data;a=b', 'Connection: keep-alive', 'Moved Permanently'); <ide> }); <ide> <ide> it('should default status code to 200', function() { <ide> describe('ngMock', function() { <ide> hb.flush(); <ide> <ide> expect(callback.callCount).toBe(2); <del> expect(callback.argsForCall[0]).toEqual([200, 'first', '']); <del> expect(callback.argsForCall[1]).toEqual([200, 'second', '']); <add> expect(callback.argsForCall[0]).toEqual([200, 'first', '', '']); <add> expect(callback.argsForCall[1]).toEqual([200, 'second', '', '']); <ide> }); <ide> }); <ide> <ide> describe('ngMock', function() { <ide> hb[shortcut]('/foo').respond('bar'); <ide> hb(method, '/foo', undefined, callback); <ide> hb.flush(); <del> expect(callback).toHaveBeenCalledOnceWith(200, 'bar', ''); <add> expect(callback).toHaveBeenCalledOnceWith(200, 'bar', '', ''); <ide> }); <ide> }); <ide> });
6
Python
Python
ignore a deprecationwarning
b6ed5b24e6edf7627d212216df963e120d20347f
<ide><path>numpy/core/tests/test_multiarray.py <ide> def test_multiarray_writable_attributes_deletion(self): <ide> """ticket #2046, should not seqfault, raise AttributeError""" <ide> a = np.ones(2) <ide> attr = ['shape', 'strides', 'data', 'dtype', 'real', 'imag', 'flat'] <del> for s in attr: <del> assert_raises(AttributeError, delattr, a, s) <add> with warnings.catch_warnings(): <add> warnings.simplefilter('ignore') <add> for s in attr: <add> assert_raises(AttributeError, delattr, a, s) <ide> <ide> def test_multiarray_not_writable_attributes_deletion(self): <ide> a = np.ones(2)
1
Javascript
Javascript
fix dd command tests for windows
3b0f2cecffb9b4a8be63185394064adb989d5ac8
<ide><path>test/common.js <ide> exports.indirectInstanceOf = function(obj, cls) { <ide> }; <ide> <ide> <add>exports.ddCommand = function(filename, kilobytes) { <add> if (process.platform == 'win32') { <add> return 'fsutil.exe file createnew "' + filename + '" ' + (kilobytes * 1024); <add> } else { <add> var blocks = Integer(size / 1024); <add> return 'dd if=/dev/zero of="' + filename + '" bs=1024 count=' + kilobytes; <add> } <add>}; <add> <add> <add> <ide> // Turn this off if the test should not check for global leaks. <ide> exports.globalCheck = true; <ide> <ide><path>test/simple/test-http-curl-chunk-problem.js <ide> function maybeMakeRequest() { <ide> } <ide> <ide> <del>cp.exec('dd if=/dev/zero of="' + filename + '" bs=1024 count=10240', <del> function(err, stdout, stderr) { <del> if (err) throw err; <del> maybeMakeRequest(); <del> }); <add>var ddcmd = common.ddCommand(filename, 10240); <add>console.log("dd command: ", ddcmd); <add> <add>cp.exec(ddcmd, function(err, stdout, stderr) { <add> if (err) throw err; <add> maybeMakeRequest(); <add>}); <ide> <ide> <ide> var server = http.createServer(function(req, res) { <ide><path>test/simple/test-pipe-file-to-http.js <ide> var server = http.createServer(function(req, res) { <ide> server.listen(common.PORT); <ide> <ide> server.on('listening', function() { <del> var cmd = 'dd if=/dev/zero of="' + filename + '" bs=1024 count=10240'; <add> var cmd = common.ddCommand(filename, 10240); <add> console.log("dd command: ", cmd); <add> <ide> cp.exec(cmd, function(err, stdout, stderr) { <ide> if (err) throw err; <ide> makeRequest();
3
Mixed
Javascript
add completion preview
21ecaa47eed39a4ede527e0b340d102ba8e1972b
<ide><path>doc/api/repl.md <ide> changes: <ide> * `breakEvalOnSigint` {boolean} Stop evaluating the current piece of code when <ide> `SIGINT` is received, such as when `Ctrl+C` is pressed. This cannot be used <ide> together with a custom `eval` function. **Default:** `false`. <del> * `preview` {boolean} Defines if the repl prints output previews or not. <del> **Default:** `true`. Always `false` in case `terminal` is falsy. <add> * `preview` {boolean} Defines if the repl prints autocomplete and output <add> previews or not. **Default:** `true`. If `terminal` is falsy, then there are <add> no previews and the value of `preview` has no effect. <ide> * Returns: {repl.REPLServer} <ide> <ide> The `repl.start()` method creates and starts a [`repl.REPLServer`][] instance. <ide><path>lib/internal/repl/utils.js <ide> const { <ide> moveCursor, <ide> } = require('readline'); <ide> <add>const { <add> commonPrefix <add>} = require('internal/readline/utils'); <add> <ide> const { inspect } = require('util'); <ide> <ide> const debug = require('internal/util/debuglog').debuglog('repl'); <ide> function isRecoverableError(e, code) { <ide> function setupPreview(repl, contextSymbol, bufferSymbol, active) { <ide> // Simple terminals can't handle previews. <ide> if (process.env.TERM === 'dumb' || !active) { <del> return { showInputPreview() {}, clearPreview() {} }; <add> return { showPreview() {}, clearPreview() {} }; <ide> } <ide> <del> let preview = null; <del> let lastPreview = ''; <add> let inputPreview = null; <add> let lastInputPreview = ''; <add> <add> let previewCompletionCounter = 0; <add> let completionPreview = null; <ide> <ide> const clearPreview = () => { <del> if (preview !== null) { <add> if (inputPreview !== null) { <ide> moveCursor(repl.output, 0, 1); <ide> clearLine(repl.output); <ide> moveCursor(repl.output, 0, -1); <del> lastPreview = preview; <del> preview = null; <add> lastInputPreview = inputPreview; <add> inputPreview = null; <add> } <add> if (completionPreview !== null) { <add> // Prevent cursor moves if not necessary! <add> const move = repl.line.length !== repl.cursor; <add> if (move) { <add> cursorTo(repl.output, repl._prompt.length + repl.line.length); <add> } <add> clearLine(repl.output, 1); <add> if (move) { <add> cursorTo(repl.output, repl._prompt.length + repl.cursor); <add> } <add> completionPreview = null; <ide> } <ide> }; <ide> <add> function showCompletionPreview(line, insertPreview) { <add> previewCompletionCounter++; <add> <add> const count = previewCompletionCounter; <add> <add> repl.completer(line, (error, data) => { <add> // Tab completion might be async and the result might already be outdated. <add> if (count !== previewCompletionCounter) { <add> return; <add> } <add> <add> if (error) { <add> debug('Error while generating completion preview', error); <add> return; <add> } <add> <add> // Result and the text that was completed. <add> const [rawCompletions, completeOn] = data; <add> <add> if (!rawCompletions || rawCompletions.length === 0) { <add> return; <add> } <add> <add> // If there is a common prefix to all matches, then apply that portion. <add> const completions = rawCompletions.filter((e) => e); <add> const prefix = commonPrefix(completions); <add> <add> // No common prefix found. <add> if (prefix.length <= completeOn.length) { <add> return; <add> } <add> <add> const suffix = prefix.slice(completeOn.length); <add> <add> const totalLength = repl.line.length + <add> repl._prompt.length + <add> suffix.length + <add> (repl.useColors ? 0 : 4); <add> <add> // TODO(BridgeAR): Fix me. This should not be necessary. See similar <add> // comment in `showPreview()`. <add> if (totalLength > repl.columns) { <add> return; <add> } <add> <add> if (insertPreview) { <add> repl._insertString(suffix); <add> return; <add> } <add> <add> completionPreview = suffix; <add> <add> const result = repl.useColors ? <add> `\u001b[90m${suffix}\u001b[39m` : <add> ` // ${suffix}`; <add> <add> if (repl.line.length !== repl.cursor) { <add> cursorTo(repl.output, repl._prompt.length + repl.line.length); <add> } <add> repl.output.write(result); <add> cursorTo(repl.output, repl._prompt.length + repl.cursor); <add> }); <add> } <add> <ide> // This returns a code preview for arbitrary input code. <del> function getPreviewInput(input, callback) { <add> function getInputPreview(input, callback) { <ide> // For similar reasons as `defaultEval`, wrap expressions starting with a <ide> // curly brace with parenthesis. <ide> if (input.startsWith('{') && !input.endsWith(';')) { <ide> function setupPreview(repl, contextSymbol, bufferSymbol, active) { <ide> }, () => callback(new ERR_INSPECTOR_NOT_AVAILABLE())); <ide> } <ide> <del> const showInputPreview = () => { <add> const showPreview = () => { <ide> // Prevent duplicated previews after a refresh. <del> if (preview !== null) { <add> if (inputPreview !== null) { <ide> return; <ide> } <ide> <ide> const line = repl.line.trim(); <ide> <del> // Do not preview if the command is buffered or if the line is empty. <del> if (repl[bufferSymbol] || line === '') { <add> // Do not preview in case the line only contains whitespace. <add> if (line === '') { <add> return; <add> } <add> <add> // Add the autocompletion preview. <add> // TODO(BridgeAR): Trigger the input preview after the completion preview. <add> // That way it's possible to trigger the input prefix including the <add> // potential completion suffix. To do so, we also have to change the <add> // behavior of `enter` and `escape`: <add> // Enter should automatically add the suffix to the current line as long as <add> // escape was not pressed. We might even remove the preview in case any <add> // cursor movement is triggered. <add> if (typeof repl.completer === 'function') { <add> const insertPreview = false; <add> showCompletionPreview(repl.line, insertPreview); <add> } <add> <add> // Do not preview if the command is buffered. <add> if (repl[bufferSymbol]) { <ide> return; <ide> } <ide> <del> getPreviewInput(line, (error, inspected) => { <add> getInputPreview(line, (error, inspected) => { <ide> // Ignore the output if the value is identical to the current line and the <ide> // former preview is not identical to this preview. <del> if ((line === inspected && lastPreview !== inspected) || <add> if ((line === inspected && lastInputPreview !== inspected) || <ide> inspected === null) { <ide> return; <ide> } <ide> function setupPreview(repl, contextSymbol, bufferSymbol, active) { <ide> return; <ide> } <ide> <del> preview = inspected; <add> inputPreview = inspected; <ide> <ide> // Limit the output to maximum 250 characters. Otherwise it becomes a) <ide> // difficult to read and b) non terminal REPLs would visualize the whole <ide> function setupPreview(repl, contextSymbol, bufferSymbol, active) { <ide> <ide> repl.output.write(`\n${result}`); <ide> moveCursor(repl.output, 0, -1); <del> cursorTo(repl.output, repl.cursor + repl._prompt.length); <add> cursorTo(repl.output, repl._prompt.length + repl.cursor); <ide> }); <ide> }; <ide> <add> // -------------------------------------------------------------------------// <add> // Replace multiple interface functions. This is required to fully support // <add> // previews without changing readlines behavior. // <add> // -------------------------------------------------------------------------// <add> <ide> // Refresh prints the whole screen again and the preview will be removed <ide> // during that procedure. Print the preview again. This also makes sure <ide> // the preview is always correct after resizing the terminal window. <del> const tmpRefresh = repl._refreshLine.bind(repl); <add> const originalRefresh = repl._refreshLine.bind(repl); <ide> repl._refreshLine = () => { <del> preview = null; <del> tmpRefresh(); <del> showInputPreview(); <add> inputPreview = null; <add> originalRefresh(); <add> showPreview(); <add> }; <add> <add> let insertCompletionPreview = true; <add> // Insert the longest common suffix of the current input in case the user <add> // moves to the right while already being at the current input end. <add> const originalMoveCursor = repl._moveCursor.bind(repl); <add> repl._moveCursor = (dx) => { <add> const currentCursor = repl.cursor; <add> originalMoveCursor(dx); <add> if (currentCursor + dx > repl.line.length && <add> typeof repl.completer === 'function' && <add> insertCompletionPreview) { <add> const insertPreview = true; <add> showCompletionPreview(repl.line, insertPreview); <add> } <add> }; <add> <add> // This is the only function that interferes with the completion insertion. <add> // Monkey patch it to prevent inserting the completion when it shouldn't be. <add> const originalClearLine = repl.clearLine.bind(repl); <add> repl.clearLine = () => { <add> insertCompletionPreview = false; <add> originalClearLine(); <add> insertCompletionPreview = true; <ide> }; <ide> <del> return { showInputPreview, clearPreview }; <add> return { showPreview, clearPreview }; <ide> } <ide> <ide> module.exports = { <ide><path>lib/readline.js <ide> function charLengthLeft(str, i) { <ide> } <ide> <ide> function charLengthAt(str, i) { <del> if (str.length <= i) <del> return 0; <add> if (str.length <= i) { <add> // Pretend to move to the right. This is necessary to autocomplete while <add> // moving to the right. <add> return 1; <add> } <ide> return str.codePointAt(i) >= kUTF16SurrogateThreshold ? 2 : 1; <ide> } <ide> <ide> Interface.prototype._ttyWrite = function(s, key) { <ide> } <ide> break; <ide> <add> // TODO(BridgeAR): This seems broken? <ide> case 'w': // Delete backwards to a word boundary <ide> case 'backspace': <ide> this._deleteWordLeft(); <ide><path>lib/repl.js <ide> function REPLServer(prompt, <ide> <ide> const { <ide> clearPreview, <del> showInputPreview <add> showPreview <ide> } = setupPreview( <ide> this, <ide> kContextId, <ide> function REPLServer(prompt, <ide> // Wrap readline tty to enable editor mode and pausing. <ide> const ttyWrite = self._ttyWrite.bind(self); <ide> self._ttyWrite = (d, key) => { <del> clearPreview(); <ide> key = key || {}; <ide> if (paused && !(self.breakEvalOnSigint && key.ctrl && key.name === 'c')) { <ide> pausedBuffer.push(['key', [d, key]]); <ide> function REPLServer(prompt, <ide> self.cursor === 0 && self.line.length === 0) { <ide> self.clearLine(); <ide> } <add> clearPreview(); <ide> ttyWrite(d, key); <del> showInputPreview(); <add> showPreview(); <ide> return; <ide> } <ide> <ide> // Editor mode <ide> if (key.ctrl && !key.shift) { <ide> switch (key.name) { <add> // TODO(BridgeAR): There should not be a special mode necessary for full <add> // multiline support. <ide> case 'd': // End editor mode <ide> _turnOffEditorMode(self); <ide> sawCtrlD = true; <ide><path>test/parallel/test-repl-editor.js <ide> const assert = require('assert'); <ide> const repl = require('repl'); <ide> const ArrayStream = require('../common/arraystream'); <ide> <del>// \u001b[1G - Moves the cursor to 1st column <add>// \u001b[nG - Moves the cursor to n st column <ide> // \u001b[0J - Clear screen <del>// \u001b[3G - Moves the cursor to 3rd column <add>// \u001b[0K - Clear to line end <ide> const terminalCode = '\u001b[1G\u001b[0J> \u001b[3G'; <add>const previewCode = (str, n) => ` // ${str}\x1B[${n}G\x1B[0K`; <ide> const terminalCodeRegex = new RegExp(terminalCode.replace(/\[/g, '\\['), 'g'); <ide> <ide> function run({ input, output, event, checkTerminalCodes = true }) { <ide> function run({ input, output, event, checkTerminalCodes = true }) { <ide> <ide> stream.write = (msg) => found += msg.replace('\r', ''); <ide> <del> let expected = `${terminalCode}.editor\n` + <add> let expected = `${terminalCode}.ed${previewCode('itor', 6)}i` + <add> `${previewCode('tor', 7)}t${previewCode('or', 8)}o` + <add> `${previewCode('r', 9)}r\n` + <ide> '// Entering editor mode (^D to finish, ^C to cancel)\n' + <ide> `${input}${output}\n${terminalCode}`; <ide> <ide><path>test/parallel/test-repl-multiline.js <ide> function run({ useColors }) { <ide> r.on('exit', common.mustCall(() => { <ide> const actual = output.split('\n'); <ide> <add> const firstLine = useColors ? <add> '\x1B[1G\x1B[0J \x1B[1Gco\x1B[90mn\x1B[39m\x1B[3G\x1B[0Knst ' + <add> 'fo\x1B[90mr\x1B[39m\x1B[9G\x1B[0Ko = {' : <add> '\x1B[1G\x1B[0J \x1B[1Gco // n\x1B[3G\x1B[0Knst ' + <add> 'fo // r\x1B[9G\x1B[0Ko = {'; <add> <ide> // Validate the output, which contains terminal escape codes. <ide> assert.strictEqual(actual.length, 6 + process.features.inspector); <del> assert.ok(actual[0].endsWith(input[0])); <add> assert.strictEqual(actual[0], firstLine); <ide> assert.ok(actual[1].includes('... ')); <ide> assert.ok(actual[1].endsWith(input[1])); <ide> assert.ok(actual[2].includes('undefined')); <del> assert.ok(actual[3].endsWith(input[2])); <ide> if (process.features.inspector) { <add> assert.ok( <add> actual[3].endsWith(input[2]), <add> `"${actual[3]}" should end with "${input[2]}"` <add> ); <ide> assert.ok(actual[4].includes(actual[5])); <ide> assert.strictEqual(actual[4].includes('//'), !useColors); <ide> } <ide><path>test/parallel/test-repl-preview.js <ide> async function tests(options) { <ide> '\x1B[36m[Function: foo]\x1B[39m', <ide> '\x1B[1G\x1B[0Jrepl > \x1B[8G'], <ide> ['koo', [2, 4], '[Function: koo]', <del> 'koo', <add> 'k\x1B[90moo\x1B[39m\x1B[9G\x1B[0Ko\x1B[90mo\x1B[39m\x1B[10G\x1B[0Ko', <ide> '\x1B[90m[Function: koo]\x1B[39m\x1B[1A\x1B[11G\x1B[1B\x1B[2K\x1B[1A\r', <ide> '\x1B[36m[Function: koo]\x1B[39m', <ide> '\x1B[1G\x1B[0Jrepl > \x1B[8G'], <ide> ['a', [1, 2], undefined], <ide> ['{ a: true }', [2, 3], '{ a: \x1B[33mtrue\x1B[39m }', <del> '{ a: true }\r', <add> '{ a: tru\x1B[90me\x1B[39m\x1B[16G\x1B[0Ke }\r', <ide> '{ a: \x1B[33mtrue\x1B[39m }', <ide> '\x1B[1G\x1B[0Jrepl > \x1B[8G'], <ide> ['1n + 2n', [2, 5], '\x1B[33m3n\x1B[39m', <ide> async function tests(options) { <ide> '\x1B[33m3n\x1B[39m', <ide> '\x1B[1G\x1B[0Jrepl > \x1B[8G'], <ide> ['{ a: true };', [2, 4], '\x1B[33mtrue\x1B[39m', <del> '{ a: true };', <add> '{ a: tru\x1B[90me\x1B[39m\x1B[16G\x1B[0Ke };', <ide> '\x1B[90mtrue\x1B[39m\x1B[1A\x1B[20G\x1B[1B\x1B[2K\x1B[1A\r', <ide> '\x1B[33mtrue\x1B[39m', <ide> '\x1B[1G\x1B[0Jrepl > \x1B[8G'], <ide> [' \t { a: true};', [2, 5], '\x1B[33mtrue\x1B[39m', <del> ' \t { a: true}', <add> ' \t { a: tru\x1B[90me\x1B[39m\x1B[19G\x1B[0Ke}', <ide> '\x1B[90m{ a: true }\x1B[39m\x1B[1A\x1B[21G\x1B[1B\x1B[2K\x1B[1A;', <ide> '\x1B[90mtrue\x1B[39m\x1B[1A\x1B[22G\x1B[1B\x1B[2K\x1B[1A\r', <ide> '\x1B[33mtrue\x1B[39m', <ide><path>test/parallel/test-repl-top-level-await.js <ide> const testMe = repl.start({ <ide> prompt: PROMPT, <ide> stream: putIn, <ide> terminal: true, <del> useColors: false, <add> useColors: true, <ide> breakEvalOnSigint: true <ide> }); <ide> <ide> async function ordinaryTests() { <ide> 'function koo() { return Promise.resolve(4); }' <ide> ]); <ide> const testCases = [ <del> [ 'await Promise.resolve(0)', '0' ], <del> [ '{ a: await Promise.resolve(1) }', '{ a: 1 }' ], <del> [ '_', '// { a: 1 }\r', { line: 0 } ], <add> [ 'await Promise.resolve(0)', <add> // Auto completion preview with colors stripped. <add> ['awaitaititt Proroomiseisesee.resolveolvelvevee(0)\r', '0'] <add> ], <add> [ '{ a: await Promise.resolve(1) }', <add> // Auto completion preview with colors stripped. <add> ['{ a: awaitaititt Proroomiseisesee.resolveolvelvevee(1) }\r', <add> '{ a: 1 }'] <add> ], <add> [ '_', '{ a: 1 }\r', { line: 0 } ], <ide> [ 'let { aa, bb } = await Promise.resolve({ aa: 1, bb: 2 }), f = 5;', <del> 'undefined' ], <del> [ 'aa', ['// 1\r', '1'] ], <del> [ 'bb', ['// 2\r', '2'] ], <del> [ 'f', ['// 5\r', '5'] ], <del> [ 'let cc = await Promise.resolve(2)', 'undefined' ], <del> [ 'cc', ['// 2\r', '2'] ], <del> [ 'let dd;', 'undefined' ], <del> [ 'dd', 'undefined' ], <del> [ 'let [ii, { abc: { kk } }] = [0, { abc: { kk: 1 } }];', 'undefined' ], <del> [ 'ii', ['// 0\r', '0'] ], <del> [ 'kk', ['// 1\r', '1'] ], <del> [ 'var ll = await Promise.resolve(2);', 'undefined' ], <del> [ 'll', ['// 2\r', '2'] ], <add> [ <add> 'letett { aa, bb } = awaitaititt Proroomiseisesee.resolveolvelvevee' + <add> '({ aa: 1, bb: 2 }), f = 5;\r' <add> ] <add> ], <add> [ 'aa', ['1\r', '1'] ], <add> [ 'bb', ['2\r', '2'] ], <add> [ 'f', ['5\r', '5'] ], <add> [ 'let cc = await Promise.resolve(2)', <add> ['letett cc = awaitaititt Proroomiseisesee.resolveolvelvevee(2)\r'] <add> ], <add> [ 'cc', ['2\r', '2'] ], <add> [ 'let dd;', ['letett dd;\r'] ], <add> [ 'dd', ['undefined\r'] ], <add> [ 'let [ii, { abc: { kk } }] = [0, { abc: { kk: 1 } }];', <add> ['letett [ii, { abc: { kook } }] = [0, { abc: { kook: 1 } }];\r'] ], <add> [ 'ii', ['0\r', '0'] ], <add> [ 'kk', ['1\r', '1'] ], <add> [ 'var ll = await Promise.resolve(2);', <add> ['var letl = awaitaititt Proroomiseisesee.resolveolvelvevee(2);\r'] <add> ], <add> [ 'll', ['2\r', '2'] ], <ide> [ 'foo(await koo())', <del> [ 'f', '// 5oo', '// [Function: foo](await koo())\r', '4' ] ], <del> [ '_', ['// 4\r', '4'] ], <add> ['f', '5oo', '[Function: foo](awaitaititt kooo())\r', '4'] ], <add> [ '_', ['4\r', '4'] ], <ide> [ 'const m = foo(await koo());', <del> [ 'const m = foo(await koo());\r', 'undefined' ] ], <del> [ 'm', ['// 4\r', '4' ] ], <add> ['connst module = foo(awaitaititt kooo());\r'] ], <add> [ 'm', ['4\r', '4' ] ], <ide> [ 'const n = foo(await\nkoo());', <del> [ 'const n = foo(await\r', '... koo());\r', 'undefined' ] ], <del> [ 'n', ['// 4\r', '4' ] ], <add> ['connst n = foo(awaitaititt\r', '... kooo());\r', 'undefined'] ], <add> [ 'n', ['4\r', '4'] ], <ide> // eslint-disable-next-line no-template-curly-in-string <ide> [ '`status: ${(await Promise.resolve({ status: 200 })).status}`', <del> "'status: 200'"], <add> [ <add> '`stratus: ${(awaitaititt Proroomiseisesee.resolveolvelvevee' + <add> '({ stratus: 200 })).stratus}`\r', <add> "'status: 200'" <add> ] <add> ], <ide> [ 'for (let i = 0; i < 2; ++i) await i', <del> ['f', '// 5or (let i = 0; i < 2; ++i) await i\r', 'undefined'] ], <add> ['f', '5or (lett i = 0; i < 2; ++i) awaitaititt i\r', 'undefined'] ], <ide> [ 'for (let i = 0; i < 2; ++i) { await i }', <del> [ 'f', '// 5or (let i = 0; i < 2; ++i) { await i }\r', 'undefined' ] ], <del> [ 'await 0', ['await 0\r', '0'] ], <add> ['f', '5or (lett i = 0; i < 2; ++i) { awaitaititt i }\r', 'undefined'] <add> ], <add> [ 'await 0', ['awaitaititt 0\r', '0'] ], <ide> [ 'await 0; function foo() {}', <del> ['await 0; function foo() {}\r', 'undefined'] ], <add> ['awaitaititt 0; functionnctionctiontioniononn foo() {}\r'] <add> ], <ide> [ 'foo', <del> ['f', '// 5oo', '// [Function: foo]\r', '[Function: foo]'] ], <del> [ 'class Foo {}; await 1;', ['class Foo {}; await 1;\r', '1'] ], <del> [ 'Foo', ['// [Function: Foo]\r', '[Function: Foo]'] ], <add> ['f', '5oo', '[Function: foo]\r', '[Function: foo]'] ], <add> [ 'class Foo {}; await 1;', ['class Foo {}; awaitaititt 1;\r', '1'] ], <add> [ 'Foo', ['Fooo', '[Function: Foo]\r', '[Function: Foo]'] ], <ide> [ 'if (await true) { function bar() {}; }', <del> ['if (await true) { function bar() {}; }\r', 'undefined'] ], <del> [ 'bar', ['// [Function: bar]\r', '[Function: bar]'] ], <del> [ 'if (await true) { class Bar {}; }', 'undefined' ], <add> ['if (awaitaititt truee) { functionnctionctiontioniononn bar() {}; }\r'] <add> ], <add> [ 'bar', ['barr', '[Function: bar]\r', '[Function: bar]'] ], <add> [ 'if (await true) { class Bar {}; }', <add> ['if (awaitaititt truee) { class Bar {}; }\r'] <add> ], <ide> [ 'Bar', 'Uncaught ReferenceError: Bar is not defined' ], <del> [ 'await 0; function* gen(){}', 'undefined' ], <add> [ 'await 0; function* gen(){}', <add> ['awaitaititt 0; functionnctionctiontioniononn* globalen(){}\r'] <add> ], <ide> [ 'for (var i = 0; i < 10; ++i) { await i; }', <del> ['f', '// 5or (var i = 0; i < 10; ++i) { await i; }\r', 'undefined'] ], <del> [ 'i', ['// 10\r', '10'] ], <add> ['f', '5or (var i = 0; i < 10; ++i) { awaitaititt i; }\r', 'undefined'] ], <add> [ 'i', ['10\r', '10'] ], <ide> [ 'for (let j = 0; j < 5; ++j) { await j; }', <del> ['f', '// 5or (let j = 0; j < 5; ++j) { await j; }\r', 'undefined'] ], <add> ['f', '5or (lett j = 0; j < 5; ++j) { awaitaititt j; }\r', 'undefined'] ], <ide> [ 'j', 'Uncaught ReferenceError: j is not defined', { line: 0 } ], <del> [ 'gen', ['// [GeneratorFunction: gen]\r', '[GeneratorFunction: gen]'] ], <add> [ 'gen', <add> ['genn', '[GeneratorFunction: gen]\r', '[GeneratorFunction: gen]'] <add> ], <ide> [ 'return 42; await 5;', 'Uncaught SyntaxError: Illegal return statement', <ide> { line: 3 } ], <del> [ 'let o = await 1, p', 'undefined' ], <del> [ 'p', 'undefined' ], <del> [ 'let q = 1, s = await 2', 'undefined' ], <del> [ 's', ['// 2\r', '2'] ], <add> [ 'let o = await 1, p', ['lett os = awaitaititt 1, p\r'] ], <add> [ 'p', ['undefined\r'] ], <add> [ 'let q = 1, s = await 2', ['lett que = 1, s = awaitaititt 2\r'] ], <add> [ 's', ['2\r', '2'] ], <ide> [ 'for await (let i of [1,2,3]) console.log(i)', <ide> [ <ide> 'f', <del> '// 5or await (let i of [1,2,3]) console.log(i)\r', <add> '5or awaitaititt (lett i of [1,2,3]) connsolelee.logogg(i)\r', <ide> '1', <ide> '2', <ide> '3', <ide> async function ordinaryTests() { <ide> const toBeRun = input.split('\n'); <ide> const lines = await runAndWait(toBeRun); <ide> if (Array.isArray(expected)) { <add> if (expected.length === 1) <add> expected.push('undefined'); <ide> if (lines[0] === input) <ide> lines.shift(); <ide> assert.deepStrictEqual(lines, [...expected, PROMPT]); <ide> async function ctrlCTest() { <ide> 'await timeout(100000)', <ide> { ctrl: true, name: 'c' } <ide> ]), [ <del> 'await timeout(100000)\r', <add> 'awaitaititt timeoutmeouteoutoututt(100000)\r', <ide> 'Uncaught:', <ide> '[Error [ERR_SCRIPT_EXECUTION_INTERRUPTED]: ' + <ide> 'Script execution was interrupted by `SIGINT`] {',
8
PHP
PHP
try catch failjob
c1de4911bba6ad3b273106f3af26b14bafc8a204
<ide><path>src/Illuminate/Queue/Worker.php <ide> namespace Illuminate\Queue; <ide> <ide> use Exception; <add>use RuntimeException; <ide> use Throwable; <ide> use Illuminate\Contracts\Queue\Job; <ide> use Illuminate\Contracts\Events\Dispatcher; <ide> protected function handleJobException($connectionName, $job, WorkerOptions $opti <ide> $this->raiseExceptionOccurredJobEvent( <ide> $connectionName, $job, $e <ide> ); <del> } catch(Exception $exception) { <del> $this->raiseFailedJobEvent($connectionName, $job, $exception); <ide> } finally { <ide> if (! $job->isDeleted()) { <ide> $job->release($options->delay); <ide> protected function markJobAsFailedIfAlreadyExceedsMaxAttempts($connectionName, $ <ide> ); <ide> <ide> $this->failJob($connectionName, $job, $e); <del> <del> throw $e; <ide> } <ide> <ide> /** <ide> protected function failJob($connectionName, $job, $e) <ide> return; <ide> } <ide> <del> // If the job has failed, we will delete it, call the "failed" method and then call <del> // an event indicating the job has failed so it can be logged if needed. This is <del> // to allow every developer to better keep monitor of their failed queue jobs. <del> $job->delete(); <add> try { <add> // If the job has failed, we will delete it, call the "failed" method and then call <add> // an event indicating the job has failed so it can be logged if needed. This is <add> // to allow every developer to better keep monitor of their failed queue jobs. <add> $job->delete(); <ide> <del> $job->failed($e); <add> $job->failed($e); <add> } catch(Exception $exception) { <add> $e = new RuntimeException($exception->getMessage(), $exception->getCode(), $e); <add> } <ide> <ide> $this->raiseFailedJobEvent($connectionName, $job, $e); <add> <add> throw $e; <ide> } <ide> <ide> /**
1
Java
Java
adjust error response in resourceurlencodingfilter
4e4ec266b2899422b4afe8290a1afd3732d2cad1
<ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceUrlEncodingFilter.java <ide> private void initLookupPath(ResourceUrlProvider urlProvider) { <ide> String lookupPath = pathHelper.getLookupPathForRequest(this); <ide> this.indexLookupPath = requestUri.lastIndexOf(lookupPath); <ide> if (this.indexLookupPath == -1) { <del> throw new IllegalStateException( <del> "Failed to find lookupPath '" + lookupPath + "' within requestUri '" + requestUri + "'. " + <del> "Does the path have invalid encoded characters for characterEncoding '" + <del> getRequest().getCharacterEncoding() + "'?"); <add> throw new LookupPathIndexException(lookupPath, requestUri); <ide> } <ide> this.prefixLookupPath = requestUri.substring(0, this.indexLookupPath); <ide> if ("/".equals(lookupPath) && !"/".equals(requestUri)) { <ide> public String encodeURL(String url) { <ide> } <ide> } <ide> <add> <add> @SuppressWarnings("serial") <add> static class LookupPathIndexException extends IllegalArgumentException { <add> <add> LookupPathIndexException(String lookupPath, String requestUri) { <add> super("Failed to find lookupPath '" + lookupPath + "' within requestUri '" + requestUri + "'. " + <add> "This could be because the path has invalid encoded characters or isn't normalized."); <add> } <add> } <add> <ide> } <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceUrlProviderExposingInterceptor.java <ide> /* <del> * Copyright 2002-2015 the original author or authors. <add> * Copyright 2002-2019 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> import javax.servlet.http.HttpServletResponse; <ide> <ide> import org.springframework.util.Assert; <add>import org.springframework.web.bind.ServletRequestBindingException; <ide> import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; <ide> <ide> /** <ide> public ResourceUrlProviderExposingInterceptor(ResourceUrlProvider resourceUrlPro <ide> public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) <ide> throws Exception { <ide> <del> request.setAttribute(RESOURCE_URL_PROVIDER_ATTR, this.resourceUrlProvider); <add> try { <add> request.setAttribute(RESOURCE_URL_PROVIDER_ATTR, this.resourceUrlProvider); <add> } <add> catch (ResourceUrlEncodingFilter.LookupPathIndexException ex) { <add> throw new ServletRequestBindingException(ex.getMessage(), ex); <add> } <ide> return true; <ide> } <ide> <ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/resource/ResourceUrlEncodingFilterTests.java <ide> /* <del> * Copyright 2002-2018 the original author or authors. <add> * Copyright 2002-2019 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> import java.util.ArrayList; <ide> import java.util.Collections; <ide> import java.util.List; <add>import javax.servlet.FilterChain; <ide> import javax.servlet.ServletException; <add>import javax.servlet.http.HttpServletRequest; <ide> import javax.servlet.http.HttpServletResponse; <ide> <ide> import org.junit.Before; <ide> import org.springframework.core.io.ClassPathResource; <ide> import org.springframework.mock.web.test.MockHttpServletRequest; <ide> import org.springframework.mock.web.test.MockHttpServletResponse; <add>import org.springframework.web.bind.ServletRequestBindingException; <ide> <ide> import static org.junit.Assert.*; <ide> <ide> public void encodeUrlWithFragment() throws Exception { <ide> "/resources/bar-11e16cf79faee7ac698c805cf28248d2.css?foo=bar&url=https://example.org#something"); <ide> } <ide> <add> @Test // gh-23508 <add> public void invalidLookupPath() throws Exception { <add> MockHttpServletRequest request = new MockHttpServletRequest(); <add> request.setRequestURI("/a/b/../logo.png"); <add> request.setServletPath("/a/logo.png"); <add> <add> this.filter.doFilter(request, new MockHttpServletResponse(), (req, res) -> { <add> try { <add> ResourceUrlProviderExposingInterceptor interceptor = <add> new ResourceUrlProviderExposingInterceptor(this.urlProvider); <add> <add> interceptor.preHandle((HttpServletRequest) req, (HttpServletResponse) res, new Object()); <add> fail(); <add> } <add> catch (Exception ex) { <add> assertEquals(ServletRequestBindingException.class, ex.getClass()); <add> } <add> }); <add> } <add> <ide> private void testEncodeUrl(MockHttpServletRequest request, String url, String expected) <ide> throws ServletException, IOException { <ide> <del> this.filter.doFilter(request, new MockHttpServletResponse(), (req, res) -> { <add> FilterChain chain = (req, res) -> { <ide> req.setAttribute(ResourceUrlProviderExposingInterceptor.RESOURCE_URL_PROVIDER_ATTR, this.urlProvider); <ide> String result = ((HttpServletResponse) res).encodeURL(url); <ide> assertEquals(expected, result); <del> }); <add> }; <add> <add> this.filter.doFilter(request, new MockHttpServletResponse(), chain); <ide> } <ide> <ide> }
3
Python
Python
improve the efficiency of indices
82ce0a1e8ccf1b83badb9fac3c2160e5896051b5
<ide><path>numpy/core/numeric.py <ide> def indices(dimensions, dtype=int): <ide> """ <ide> dimensions = tuple(dimensions) <ide> N = len(dimensions) <del> if N == 0: <del> return array([], dtype=dtype) <add> shape = (1,)*N <ide> res = empty((N,)+dimensions, dtype=dtype) <ide> for i, dim in enumerate(dimensions): <del> tmp = arange(dim, dtype=dtype) <del> tmp.shape = (1,)*i + (dim,)+(1,)*(N-i-1) <del> newdim = dimensions[:i] + (1,) + dimensions[i+1:] <del> val = zeros(newdim, dtype) <del> add(tmp, val, res[i]) <add> res[i] = arange(dim, dtype=dtype).reshape( <add> shape[:i] + (dim,) + shape[i+1:] <add> ) <ide> return res <ide> <ide>
1
Java
Java
treat mariadb as an independent database type
21577c47776f8bb12aae87351d73624cadb87aef
<ide><path>spring-jdbc/src/main/java/org/springframework/jdbc/support/JdbcUtils.java <ide> /* <del> * Copyright 2002-2021 the original author or authors. <add> * Copyright 2002-2022 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> * <ide> * @author Thomas Risberg <ide> * @author Juergen Hoeller <add> * @author Ben Blinebury <ide> */ <ide> public abstract class JdbcUtils { <ide> <ide> public static String commonDatabaseName(@Nullable String source) { <ide> if (source != null && source.startsWith("DB2")) { <ide> name = "DB2"; <ide> } <del> else if ("MariaDB".equals(source)) { <del> name = "MySQL"; <del> } <ide> else if ("Sybase SQL Server".equals(source) || <ide> "Adaptive Server Enterprise".equals(source) || <ide> "ASE".equals(source) || <ide><path>spring-jdbc/src/test/java/org/springframework/jdbc/support/JdbcUtilsTests.java <ide> /* <del> * Copyright 2002-2019 the original author or authors. <add> * Copyright 2002-2022 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> * <ide> * @author Thomas Risberg <ide> * @author Juergen Hoeller <add> * @author Ben Blinebury <ide> */ <ide> public class JdbcUtilsTests { <ide> <ide> public void commonDatabaseName() { <ide> assertThat(JdbcUtils.commonDatabaseName("Sybase SQL Server")).isEqualTo("Sybase"); <ide> assertThat(JdbcUtils.commonDatabaseName("Adaptive Server Enterprise")).isEqualTo("Sybase"); <ide> assertThat(JdbcUtils.commonDatabaseName("MySQL")).isEqualTo("MySQL"); <add> assertThat(JdbcUtils.commonDatabaseName("MariaDB")).isEqualTo("MariaDB"); <ide> } <ide> <ide> @Test
2
Python
Python
fix part of google system tests
9279c44c91274b7ee31c244d41090c93e5753394
<ide><path>airflow/providers/google/cloud/example_dags/example_cloud_build.py <ide> <ide> # [START howto_operator_create_build_from_repo_body] <ide> create_build_from_repo_body = { <del> "source": {"repo_source": {"repo_name": GCP_SOURCE_REPOSITORY_NAME, "branch_name": "master"}}, <add> "source": {"repo_source": {"repo_name": GCP_SOURCE_REPOSITORY_NAME, "branch_name": "main"}}, <ide> "steps": [ <ide> { <ide> "name": "gcr.io/cloud-builders/docker", <ide><path>airflow/providers/google/cloud/example_dags/example_cloud_sql_query.py <ide> from airflow.utils.dates import days_ago <ide> <ide> GCP_PROJECT_ID = os.environ.get('GCP_PROJECT_ID', 'example-project') <del>GCP_REGION = os.environ.get('GCP_REGION', 'europe-west-1b') <add>GCP_REGION = os.environ.get('GCP_REGION', 'europe-west1') <ide> <ide> GCSQL_POSTGRES_INSTANCE_NAME_QUERY = os.environ.get('GCSQL_POSTGRES_INSTANCE_NAME_QUERY', 'testpostgres') <ide> GCSQL_POSTGRES_DATABASE_NAME = os.environ.get('GCSQL_POSTGRES_DATABASE_NAME', 'postgresdb') <ide><path>airflow/providers/google/cloud/example_dags/example_datacatalog.py <ide> """ <ide> Example Airflow DAG that interacts with Google Data Catalog service <ide> """ <add>import os <add> <ide> from google.cloud.datacatalog_v1beta1 import FieldType, TagField, TagTemplateField <ide> <ide> from airflow import models <ide> ) <ide> from airflow.utils.dates import days_ago <ide> <del>PROJECT_ID = "polidea-airflow" <add>PROJECT_ID = os.getenv("GCP_PROJECT_ID") <add>BUCKET_ID = os.getenv("GCP_TEST_DATA_BUCKET", "INVALID BUCKET NAME") <ide> LOCATION = "us-central1" <ide> ENTRY_GROUP_ID = "important_data_jan_2019" <ide> ENTRY_ID = "python_files" <ide> entry={ <ide> "display_name": "Wizard", <ide> "type_": "FILESET", <del> "gcs_fileset_spec": {"file_patterns": ["gs://INVALID BUCKET NAME/**"]}, <add> "gcs_fileset_spec": {"file_patterns": [f"gs://{BUCKET_ID}/**"]}, <ide> }, <ide> ) <ide> # [END howto_operator_gcp_datacatalog_create_entry_gcs] <ide><path>airflow/providers/google/cloud/example_dags/example_dataflow.py <ide> # [START howto_operator_start_python_job_async] <ide> start_python_job_async = BeamRunPythonPipelineOperator( <ide> task_id="start-python-job-async", <add> runner="DataflowRunner", <ide> py_file=GCS_PYTHON, <ide> py_options=[], <ide> pipeline_options={ <ide> py_requirements=['apache-beam[gcp]==2.25.0'], <ide> py_interpreter='python3', <ide> py_system_site_packages=False, <del> dataflow_config={"location": 'europe-west3', "wait_until_finished": False}, <add> dataflow_config={ <add> "job_name": "start-python-job-async", <add> "location": 'europe-west3', <add> "wait_until_finished": False, <add> }, <ide> ) <ide> # [END howto_operator_start_python_job_async] <ide> <ide> # [START howto_sensor_wait_for_job_status] <ide> wait_for_python_job_async_done = DataflowJobStatusSensor( <ide> task_id="wait-for-python-job-async-done", <del> job_id="{{task_instance.xcom_pull('start-python-job-async')['job_id']}}", <add> job_id="{{task_instance.xcom_pull('start-python-job-async')['dataflow_job_id']}}", <ide> expected_statuses={DataflowJobStatus.JOB_STATE_DONE}, <ide> location='europe-west3', <ide> ) <ide> def callback(metrics: List[Dict]) -> bool: <ide> <ide> wait_for_python_job_async_metric = DataflowJobMetricsSensor( <ide> task_id="wait-for-python-job-async-metric", <del> job_id="{{task_instance.xcom_pull('start-python-job-async')['job_id']}}", <add> job_id="{{task_instance.xcom_pull('start-python-job-async')['dataflow_job_id']}}", <ide> location='europe-west3', <ide> callback=check_metric_scalar_gte(metric_name="Service-cpu_num_seconds", value=100), <add> fail_on_terminal_state=False, <ide> ) <ide> # [END howto_sensor_wait_for_job_metric] <ide> <ide> def check_message(messages: List[dict]) -> bool: <ide> <ide> wait_for_python_job_async_message = DataflowJobMessagesSensor( <ide> task_id="wait-for-python-job-async-message", <del> job_id="{{task_instance.xcom_pull('start-python-job-async')['job_id']}}", <add> job_id="{{task_instance.xcom_pull('start-python-job-async')['dataflow_job_id']}}", <ide> location='europe-west3', <ide> callback=check_message, <add> fail_on_terminal_state=False, <ide> ) <ide> # [END howto_sensor_wait_for_job_message] <ide> <ide> def check_autoscaling_event(autoscaling_events: List[dict]) -> bool: <ide> <ide> wait_for_python_job_async_autoscaling_event = DataflowJobAutoScalingEventsSensor( <ide> task_id="wait-for-python-job-async-autoscaling-event", <del> job_id="{{task_instance.xcom_pull('start-python-job-async')['job_id']}}", <add> job_id="{{task_instance.xcom_pull('start-python-job-async')['dataflow_job_id']}}", <ide> location='europe-west3', <ide> callback=check_autoscaling_event, <add> fail_on_terminal_state=False, <ide> ) <ide> # [END howto_sensor_wait_for_job_autoscaling_event] <ide> <ide><path>airflow/providers/google/cloud/example_dags/example_datafusion.py <ide> from airflow.utils.state import State <ide> <ide> # [START howto_data_fusion_env_variables] <add>SERVICE_ACCOUNT = os.environ.get("GCP_DATAFUSION_SERVICE_ACCOUNT") <ide> LOCATION = "europe-north1" <ide> INSTANCE_NAME = "airflow-test-instance" <del>INSTANCE = {"type": "BASIC", "displayName": INSTANCE_NAME} <add>INSTANCE = { <add> "type": "BASIC", <add> "displayName": INSTANCE_NAME, <add> "dataprocServiceAccount": SERVICE_ACCOUNT, <add>} <ide> <ide> BUCKET_1 = os.environ.get("GCP_DATAFUSION_BUCKET_1", "test-datafusion-bucket-1") <ide> BUCKET_2 = os.environ.get("GCP_DATAFUSION_BUCKET_2", "test-datafusion-bucket-2") <ide> <del>BUCKET_1_URI = f"gs//{BUCKET_1}" <del>BUCKET_2_URI = f"gs//{BUCKET_2}" <add>BUCKET_1_URI = f"gs://{BUCKET_1}" <add>BUCKET_2_URI = f"gs://{BUCKET_2}" <ide> <ide> PIPELINE_NAME = os.environ.get("GCP_DATAFUSION_PIPELINE_NAME", "airflow_test") <ide> PIPELINE = { <ide> "name": "test-pipe", <ide> "description": "Data Pipeline Application", <del> "artifact": {"name": "cdap-data-pipeline", "version": "6.1.2", "scope": "SYSTEM"}, <add> "artifact": {"name": "cdap-data-pipeline", "version": "6.4.1", "scope": "SYSTEM"}, <ide> "config": { <ide> "resources": {"memoryMB": 2048, "virtualCores": 1}, <ide> "driverResources": {"memoryMB": 2048, "virtualCores": 1}, <ide> "label": "GCS", <ide> "artifact": { <ide> "name": "google-cloud", <del> "version": "0.14.2", <add> "version": "0.17.3", <ide> "scope": "SYSTEM", <ide> }, <ide> "properties": { <ide> "label": "GCS2", <ide> "artifact": { <ide> "name": "google-cloud", <del> "version": "0.14.2", <add> "version": "0.17.3", <ide> "scope": "SYSTEM", <ide> }, <ide> "properties": { <ide> location=LOCATION, <ide> instance_name=INSTANCE_NAME, <ide> instance=INSTANCE, <del> update_mask="instance.displayName", <add> update_mask="", <ide> task_id="update_instance", <ide> ) <ide> # [END howto_cloud_data_fusion_update_instance_operator] <ide> pipeline_name=PIPELINE_NAME, <ide> pipeline_id=start_pipeline_async.output, <ide> expected_statuses=["COMPLETED"], <add> failure_statuses=["FAILED"], <ide> instance_name=INSTANCE_NAME, <ide> location=LOCATION, <ide> ) <ide><path>airflow/providers/google/cloud/example_dags/example_functions.py <ide> ) <ide> GCF_ZIP_PATH = os.environ.get('GCF_ZIP_PATH', '') <ide> GCF_ENTRYPOINT = os.environ.get('GCF_ENTRYPOINT', 'helloWorld') <del>GCF_RUNTIME = 'nodejs6' <add>GCF_RUNTIME = 'nodejs14' <ide> GCP_VALIDATE_BODY = os.environ.get('GCP_VALIDATE_BODY', "True") == "True" <ide> <ide> # [START howto_operator_gcf_deploy_body] <ide><path>airflow/providers/google/cloud/hooks/datafusion.py <ide> def create_pipeline( <ide> url = os.path.join(self._base_url(instance_url, namespace), quote(pipeline_name)) <ide> response = self._cdap_request(url=url, method="PUT", body=pipeline) <ide> if response.status != 200: <del> raise AirflowException(f"Creating a pipeline failed with code {response.status}") <add> raise AirflowException( <add> f"Creating a pipeline failed with code {response.status} while calling {url}" <add> ) <ide> <ide> def delete_pipeline( <ide> self, <ide><path>airflow/providers/google/cloud/sensors/datafusion.py <ide> class CloudDataFusionPipelineStateSensor(BaseSensorOperator): <ide> :type pipeline_name: str <ide> :param expected_statuses: State that is expected <ide> :type expected_statuses: set[str] <add> :param failure_statuses: State that will terminate the sensor with an exception <add> :type failure_statuses: set[str] <ide> :param instance_name: The name of the instance. <ide> :type instance_name: str <ide> :param location: The Cloud Data Fusion location in which to handle the request. <ide> def __init__( <ide> expected_statuses: Set[str], <ide> instance_name: str, <ide> location: str, <add> failure_statuses: Set[str] = None, <ide> project_id: Optional[str] = None, <ide> namespace: str = "default", <ide> gcp_conn_id: str = 'google_cloud_default', <ide> def __init__( <ide> self.pipeline_name = pipeline_name <ide> self.pipeline_id = pipeline_id <ide> self.expected_statuses = expected_statuses <add> self.failure_statuses = failure_statuses <ide> self.instance_name = instance_name <ide> self.location = location <ide> self.project_id = project_id <ide> def poke(self, context: dict) -> bool: <ide> except AirflowException: <ide> pass # Because the pipeline may not be visible in system yet <ide> <add> if self.failure_statuses and pipeline_status in self.failure_statuses: <add> raise AirflowException( <add> f"Pipeline with id '{self.pipeline_id}' state is: {pipeline_status}. " <add> f"Terminating sensor..." <add> ) <add> <ide> self.log.debug( <ide> "Current status of the pipeline workflow for %s: %s.", self.pipeline_id, pipeline_status <ide> ) <ide><path>tests/providers/google/cloud/operators/test_cloud_build_system_helper.py <ide> def create_repository_and_bucket(self): <ide> GCP_PROJECT_ID, GCP_REPOSITORY_NAME <ide> ) <ide> self.execute_cmd(["git", "remote", "add", "origin", repo_url], cwd=tmp_dir) <del> self.execute_cmd(["git", "push", "--force", "origin", "main"], cwd=tmp_dir) <add> self.execute_cmd(["git", "push", "--force", "origin", "master"], cwd=tmp_dir) <ide> <ide> def delete_repo(self): <ide> """Delete repository in Google Cloud Source Repository service""" <ide><path>tests/providers/google/cloud/operators/test_dataprep_system.py <ide> from tests.test_utils.db import clear_db_connections <ide> from tests.test_utils.gcp_system_helpers import CLOUD_DAG_FOLDER, GoogleSystemTest <ide> <del>TOKEN = environ.get("DATAPREP_TOKEN", "dataprep-system-test-token") <add>TOKEN = environ.get("DATAPREP_TOKEN") <ide> EXTRA = {"extra__dataprep__token": TOKEN} <ide> <ide> <del>@pytest.mark.skipif(environ.get("DATAPREP_TOKEN") is None, reason='Dataprep token not present') <add>@pytest.mark.skipif(TOKEN is None, reason='Dataprep token not present') <ide> class DataprepExampleDagsTest(GoogleSystemTest): <ide> """ <ide> System tests for Dataprep operators. <ide><path>tests/providers/google/cloud/operators/test_gcs_system_helper.py <ide> def create_test_file(): <ide> <ide> @staticmethod <ide> def remove_test_files(): <del> os.remove(PATH_TO_UPLOAD_FILE) <del> os.remove(PATH_TO_SAVED_FILE) <del> os.remove(PATH_TO_TRANSFORM_SCRIPT) <add> if os.path.exists(PATH_TO_UPLOAD_FILE): <add> os.remove(PATH_TO_UPLOAD_FILE) <add> if os.path.exists(PATH_TO_SAVED_FILE): <add> os.remove(PATH_TO_SAVED_FILE) <add> if os.path.exists(PATH_TO_TRANSFORM_SCRIPT): <add> os.remove(PATH_TO_TRANSFORM_SCRIPT) <ide> <ide> def remove_bucket(self): <ide> self.execute_cmd(["gsutil", "rm", "-r", f"gs://{BUCKET_1}"]) <ide><path>tests/providers/google/cloud/sensors/test_datafusion.py <ide> import unittest <ide> from unittest import mock <ide> <add>import pytest <ide> from parameterized.parameterized import parameterized <ide> <add>from airflow import AirflowException <ide> from airflow.providers.google.cloud.hooks.datafusion import PipelineStates <ide> from airflow.providers.google.cloud.sensors.datafusion import CloudDataFusionPipelineStateSensor <ide> <ide> GCP_CONN_ID = "test_conn_id" <ide> DELEGATE_TO = "test_delegate_to" <ide> IMPERSONATION_CHAIN = ["ACCOUNT_1", "ACCOUNT_2", "ACCOUNT_3"] <add>FAILURE_STATUSES = {"FAILED"} <ide> <ide> <ide> class TestCloudDataFusionPipelineStateSensor(unittest.TestCase): <ide> def test_poke(self, expected_status, current_status, sensor_return, mock_hook): <ide> pipeline_name=PIPELINE_NAME, <ide> pipeline_id=PIPELINE_ID, <ide> project_id=PROJECT_ID, <del> expected_statuses=[expected_status], <add> expected_statuses={expected_status}, <ide> instance_name=INSTANCE_NAME, <ide> location=LOCATION, <ide> gcp_conn_id=GCP_CONN_ID, <ide> def test_poke(self, expected_status, current_status, sensor_return, mock_hook): <ide> mock_hook.return_value.get_instance.assert_called_once_with( <ide> instance_name=INSTANCE_NAME, location=LOCATION, project_id=PROJECT_ID <ide> ) <add> <add> @mock.patch("airflow.providers.google.cloud.sensors.datafusion.DataFusionHook") <add> def test_assertion(self, mock_hook): <add> mock_hook.return_value.get_instance.return_value = {"apiEndpoint": INSTANCE_URL} <add> <add> task = CloudDataFusionPipelineStateSensor( <add> task_id="test_task_id", <add> pipeline_name=PIPELINE_NAME, <add> pipeline_id=PIPELINE_ID, <add> project_id=PROJECT_ID, <add> expected_statuses={PipelineStates.COMPLETED}, <add> failure_statuses=FAILURE_STATUSES, <add> instance_name=INSTANCE_NAME, <add> location=LOCATION, <add> gcp_conn_id=GCP_CONN_ID, <add> delegate_to=DELEGATE_TO, <add> impersonation_chain=IMPERSONATION_CHAIN, <add> ) <add> <add> with pytest.raises( <add> AirflowException, <add> match=f"Pipeline with id '{PIPELINE_ID}' state is: FAILED. Terminating sensor...", <add> ): <add> mock_hook.return_value.get_pipeline_workflow.return_value = {"status": 'FAILED'} <add> task.poke(mock.MagicMock())
12
Text
Text
fix function syntax for api routes documentation
61ca7369c61b3a084e31fdb84ee6cede4c87f9b2
<ide><path>docs/api-routes/response-helpers.md <ide> type ResponseData { <ide> message: string <ide> } <ide> <del>export default function handler(req: NextApiRequest, res: NextApiResponse<ResponseData>) => { <add>export default function handler(req: NextApiRequest, res: NextApiResponse<ResponseData>) { <ide> res.status(200).json({ message: 'Hello from Next.js!' }) <ide> } <ide> ```
1