content_type
stringclasses
8 values
main_lang
stringclasses
7 values
message
stringlengths
1
50
sha
stringlengths
40
40
patch
stringlengths
52
962k
file_count
int64
1
300
Javascript
Javascript
update forum links in navlinks
34c26c495001095f606499da9a16ac181398687e
<ide><path>client/src/components/Header/Header.test.js <ide> describe('<NavLinks />', () => { <ide> return acc; <ide> }, []); <ide> <del> const expectedLinks = ['/learn', '/news', '/forum']; <add> const expectedLinks = ['/learn', '/news', 'https://forum.freecodecamp.org']; <ide> <ide> it('renders to the DOM', () => { <ide> expect(root).toBeTruthy(); <ide><path>client/src/components/Header/components/NavLinks.js <ide> function NavLinks({ displayMenu }) { <ide> </Link> <ide> </li> <ide> <li className='nav-forum'> <del> <Link external={true} sameTab={true} to='/forum'> <add> <Link <add> external={true} <add> sameTab={true} <add> to='https://forum.freecodecamp.org' <add> > <ide> /forum <ide> </Link> <ide> </li>
2
Python
Python
handle hddtemp error
c6c32513dc137264a5fadaeff7aceeb8d396a3b4
<ide><path>glances/plugins/glances_hddtemp.py <ide> def __update__(self): <ide> offset = item * 5 <ide> hddtemp_current = {} <ide> device = os.path.basename(nativestr(fields[offset + 1])) <del> temperature = float(fields[offset + 3]) <add> temperature = fields[offset + 3] <ide> unit = nativestr(fields[offset + 4]) <ide> hddtemp_current['label'] = device <del> hddtemp_current['value'] = temperature <add> hddtemp_current['value'] = float(temperature) if temperature != b'ERR' else temperature <ide> hddtemp_current['unit'] = unit <ide> self.hddtemp_list.append(hddtemp_current) <ide> <ide><path>glances/plugins/glances_sensors.py <ide> def msg_curse(self, args=None): <ide> ret.append(self.curse_add_line(msg, "TITLE")) <ide> <ide> for i in self.stats: <del> if i['value']: <add> if i['value'] != b'ERR': <ide> # New line <ide> ret.append(self.curse_new_line()) <ide> # Alias for the lable name ? <ide> def __update__(self): <ide> try: <ide> sensors_current['label'] = feature.label <ide> sensors_current['value'] = int(feature.get_value()) <del> except Exception as e: <add> except SensorsError as e: <ide> logger.debug("Cannot grab sensor stat(%s)" % e) <ide> else: <ide> self.sensors_list.append(sensors_current)
2
Ruby
Ruby
enable flipper for custom xcode configurations
1bc9ddbce393be9466cb87124d3e34a19abb8e5d
<ide><path>scripts/cocoapods/__tests__/flipper-test.rb <ide> def test_postInstall_updatesThePodCorrectly <ide> <ide> reactCore_target = installer.target_with_name("React-Core") <ide> reactCore_target.build_configurations.each do |config| <del> if config.name == 'Debug' then <add> if config.name == 'Debug' || config.name == 'CustomConfig' then <ide> assert_equal(config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'], ['$(inherited)', 'FB_SONARKIT_ENABLED=1']) <ide> else <ide> assert_true(config.build_settings.empty?) <ide> def prepare_mocked_installer <ide> TargetMock.new( <ide> "YogaKit", <ide> [ <del> BuildConfigurationMock.new("Debug"), <del> BuildConfigurationMock.new("Release"), <add> BuildConfigurationMock.new("Debug", is_debug: true), <add> BuildConfigurationMock.new("Release", is_debug: false), <add> BuildConfigurationMock.new("CustomConfig", is_debug: true), <ide> ] <ide> ), <ide> TargetMock.new( <ide> "React-Core", <ide> [ <del> BuildConfigurationMock.new("Debug"), <del> BuildConfigurationMock.new("Release"), <add> BuildConfigurationMock.new("Debug", is_debug: true), <add> BuildConfigurationMock.new("Release", is_debug: false), <add> BuildConfigurationMock.new("CustomConfig", is_debug: true), <ide> ] <ide> ) <ide> ] <ide><path>scripts/cocoapods/__tests__/test_utils/InstallerMock.rb <ide> def resolved_build_setting(key, resolve_against_xcconfig: false) <ide> class BuildConfigurationMock <ide> attr_reader :name <ide> attr_reader :build_settings <add> @is_debug <ide> <del> def initialize(name, build_settings = {}) <add> def initialize(name, build_settings = {}, is_debug: false) <ide> @name = name <ide> @build_settings = build_settings <add> @is_debug = is_debug <add> end <add> <add> def debug? <add> return @is_debug <ide> end <ide> end <ide> <ide><path>scripts/cocoapods/flipper.rb <ide> def flipper_post_install(installer) <ide> # Enable flipper for React-Core Debug configuration <ide> if target.name == 'React-Core' <ide> target.build_configurations.each do |config| <del> if config.name == 'Debug' <add> if config.debug? <ide> config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = ['$(inherited)', 'FB_SONARKIT_ENABLED=1'] <ide> end <ide> end
3
Ruby
Ruby
restore memoization when preloading associations
89711d99b08b5ace8aa5b7394e2ccedb302d118f
<ide><path>activerecord/lib/active_record/reflection.rb <ide> def compute_class(name) <ide> <ide> def initialize(name, scope, options, active_record) <ide> super <del> @automatic_inverse_of = nil <ide> @type = options[:as] && (options[:foreign_type] || "#{options[:as]}_type") <ide> @foreign_type = options[:foreign_type] || "#{name}_type" <ide> @constructable = calculate_constructable(macro, options) <ide> def calculate_constructable(macro, options) <ide> # If it cannot find a suitable inverse association name, it returns <ide> # +nil+. <ide> def inverse_name <del> options.fetch(:inverse_of) do <del> @automatic_inverse_of ||= automatic_inverse_of <add> unless defined?(@inverse_name) <add> @inverse_name = options.fetch(:inverse_of) { automatic_inverse_of } <ide> end <add> <add> @inverse_name <ide> end <ide> <del> # returns either false or the inverse association name that it finds. <add> # returns either +nil+ or the inverse association name that it finds. <ide> def automatic_inverse_of <ide> if can_find_inverse_of_automatically?(self) <ide> inverse_name = ActiveSupport::Inflector.underscore(options[:as] || active_record.name.demodulize).to_sym <ide> def automatic_inverse_of <ide> return inverse_name <ide> end <ide> end <del> <del> false <ide> end <ide> <ide> # Checks if the inverse reflection that is returned from the
1
Python
Python
add learning rate summary in eval mode in model.py
bfd15ec1482bd1fa370da3e78ed58d47280c5bca
<ide><path>research/object_detection/model_lib.py <ide> def tpu_scaffold(): <ide> losses.append(regularization_loss) <ide> losses_dict['Loss/regularization_loss'] = regularization_loss <ide> total_loss = tf.add_n(losses, name='total_loss') <add> losses_dict['Loss/total_loss'] = total_loss <ide> <del> if mode == tf.estimator.ModeKeys.TRAIN: <add> if mode in [tf.estimator.ModeKeys.TRAIN, tf.estimator.ModeKeys.EVAL]: <add> # TODO(rathodv): Stop creating optimizer summary vars in EVAL mode once we <add> # can write learning rate summaries on TPU without host calls. <ide> global_step = tf.train.get_or_create_global_step() <ide> training_optimizer, optimizer_summary_vars = optimizer_builder.build( <ide> train_config.optimizer) <ide> <add> if mode == tf.estimator.ModeKeys.TRAIN: <ide> if use_tpu: <ide> training_optimizer = tpu_optimizer.CrossShardOptimizer( <ide> training_optimizer) <ide> def tpu_scaffold(): <ide> include_metrics_per_category=False) <ide> for loss_key, loss_tensor in iter(losses_dict.items()): <ide> eval_metric_ops[loss_key] = tf.metrics.mean(loss_tensor) <add> for var in optimizer_summary_vars: <add> eval_metric_ops[str(var.op.name)] = (var, tf.no_op()) <ide> if img_summary is not None: <ide> eval_metric_ops['Detections_Left_Groundtruth_Right'] = ( <ide> img_summary, tf.no_op())
1
Ruby
Ruby
use cask with name for basic info command test
efbfb90c42b6c106ab71c7a5340e05b81e7a133b
<ide><path>Library/Homebrew/test/cask/cmd/home_spec.rb <ide> <ide> it "works for multiple Casks" do <ide> expect(described_class).to receive(:open_url).with("https://brew.sh/") <del> expect(described_class).to receive(:open_url).with("https://brew.sh/") <add> expect(described_class).to receive(:open_url).with("https://transmissionbt.com/") <ide> described_class.run("local-caffeine", "local-transmission") <ide> end <ide> <ide><path>Library/Homebrew/test/cask/cmd/info_spec.rb <ide> <ide> it "displays some nice info about the specified Cask" do <ide> expect { <del> described_class.run("local-caffeine") <add> described_class.run("local-transmission") <ide> }.to output(<<~EOS).to_stdout <del> local-caffeine: 1.2.3 <del> https://brew.sh/ <add> local-transmission: 2.61 <add> https://transmissionbt.com/ <ide> Not installed <del> From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/local-caffeine.rb <add> From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/local-transmission.rb <ide> ==> Name <del> None <add> Transmission <ide> ==> Artifacts <del> Caffeine.app (App) <add> Transmission.app (App) <ide> EOS <ide> end <ide> <ide> Caffeine.app (App) <ide> <ide> local-transmission: 2.61 <del> https://brew.sh/ <add> https://transmissionbt.com/ <ide> Not installed <ide> From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/local-transmission.rb <ide> ==> Name <ide><path>Library/Homebrew/test/cask/cmd/list_spec.rb <ide> let(:casks) { ["local-caffeine", "local-transmission"] } <ide> let(:expected_output) { <ide> <<~EOS <del> [{"token":"local-caffeine","name":[],"desc":null,"homepage":"https://brew.sh/","url":"file:///usr/local/Homebrew/Library/Homebrew/test/support/fixtures/cask/caffeine.zip","appcast":null,"version":"1.2.3","sha256":"67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94","artifacts":[["Caffeine.app"]],"caveats":null,"depends_on":{},"conflicts_with":null,"container":null,"auto_updates":null},{"token":"local-transmission","name":["Transmission"],"desc":null,"homepage":"https://brew.sh/","url":"file:///usr/local/Homebrew/Library/Homebrew/test/support/fixtures/cask/transmission-2.61.dmg","appcast":null,"version":"2.61","sha256":"e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68","artifacts":[["Transmission.app"]],"caveats":null,"depends_on":{},"conflicts_with":null,"container":null,"auto_updates":null}] <add> [{"token":"local-caffeine","name":[],"desc":null,"homepage":"https://brew.sh/","url":"file:///usr/local/Homebrew/Library/Homebrew/test/support/fixtures/cask/caffeine.zip","appcast":null,"version":"1.2.3","sha256":"67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94","artifacts":[["Caffeine.app"]],"caveats":null,"depends_on":{},"conflicts_with":null,"container":null,"auto_updates":null},{"token":"local-transmission","name":["Transmission"],"desc":null,"homepage":"https://transmissionbt.com/","url":"file:///usr/local/Homebrew/Library/Homebrew/test/support/fixtures/cask/transmission-2.61.dmg","appcast":null,"version":"2.61","sha256":"e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68","artifacts":[["Transmission.app"]],"caveats":null,"depends_on":{},"conflicts_with":null,"container":null,"auto_updates":null}] <ide> EOS <ide> } <ide> <ide><path>Library/Homebrew/test/support/fixtures/cask/Casks/local-transmission.rb <ide> <ide> url "file://#{TEST_FIXTURE_DIR}/cask/transmission-2.61.dmg" <ide> name "Transmission" <del> homepage "https://brew.sh/" <add> homepage "https://transmissionbt.com/" <ide> <ide> app "Transmission.app" <ide> end
4
Text
Text
fix links in getting started docs
adf31a19147a238541bf3b5996e532d8bdf22c87
<ide><path>docs/Basics/Getting Started.md <ide> let boundAddTodo = text => dispatch(addTodo(text)); <ide> let boundRemoveTodo = id => dispatch(addTodo(id)); <ide> ``` <ide> <del>The `dispatch()` function can be accessed directly from the store as `store.dispatch()`, but more likely you’ll access it using a helper like `connect` from [react-redux](http://github.com/gaearon/react-redux). <add>The `dispatch()` function can be accessed directly from the store as `store.dispatch()`, but more likely you’ll access it using a helper like `connect` from [react-redux](https://github.com/gaearon/react-redux). <ide> <ide> ### Reducers <ide> <ide> Yes, you read that correctly. [Read more about how middleware works here.](../Re <ide> <ide> You’ll rarely interact with the store object directly. Most often, you’ll use some sort of binding to your preferred view library. <ide> <del>Flux is most popular within the React community, but Redux works with any kind of view layer. The React bindings for Redux are available as [react-redux](github.com/gaearon/react-redux) — see that project for details on how to integrate with React. <add>Flux is most popular within the React community, but Redux works with any kind of view layer. The React bindings for Redux are available as [react-redux](https://github.com/gaearon/react-redux) — see that project for details on how to integrate with React. <ide> <ide> However, if you do find yourself needing to access the store directly, the API for doing so is very simple: <ide>
1
Ruby
Ruby
improve documentation for connectionpool
5e4be17c3ac5f50496520049117c809fde35a568
<ide><path>activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb <ide> module ConnectionAdapters <ide> # Connection pool base class for managing ActiveRecord database <ide> # connections. <ide> # <add> # A connection pool synchronizes thread access to a limited number of <add> # database connections. The basic idea is that each thread checks out a <add> # database connection from the pool, uses that connection, and checks the <add> # connection back in. ConnectionPool is completely thread-safe, and will <add> # ensure that a connection cannot be used by two threads at the same time, <add> # as long as ConnectionPool's contract is correctly followed. It will also <add> # handle cases in which there are more threads than connections: if all <add> # connections have been checked out, and a thread tries to checkout a <add> # connection anyway, then ConnectionPool will wait until some other thread <add> # has checked in a connection. <add> # <ide> # Connections can be obtained and used from a connection pool in several <ide> # ways: <ide> # <ide> module ConnectionAdapters <ide> # * +pool+: number indicating size of connection pool (default 5) <ide> # * +wait_timeout+: number of seconds to block and wait for a connection <ide> # before giving up and raising a timeout error (default 5 seconds). <add> # <add> # *Note*: connections in the pool are AbstractAdapter objects. <ide> class ConnectionPool <ide> attr_reader :spec <ide> <add> # Creates a new ConnectionPool object. +spec+ is a ConnectionSpecification <add> # object which describes database connection information (e.g. adapter, <add> # host name, username, password, etc), as well as the maximum size for <add> # this ConnectionPool. <add> # <add> # The default ConnectionPool maximum size is 5. <ide> def initialize(spec) <ide> @spec = spec <ide> # The cache of reserved connections mapped to threads <ide> def clear_stale_cached_connections! <ide> end <ide> end <ide> <del> # Check-out a database connection from the pool. <add> # Check-out a database connection from the pool, indicating that you want <add> # to use it. You should call #checkin when you no longer need this. <add> # <add> # This is done by either returning an existing connection, or by creating <add> # a new connection. If the maximum number of connections for this pool has <add> # already been reached, but the pool is empty (i.e. they're all being used), <add> # then this method will wait until a thread has checked in a connection. <ide> def checkout <ide> # Checkout an available connection <ide> conn = @connection_mutex.synchronize do <ide> def checkout <ide> end <ide> end <ide> <del> # Check-in a database connection back into the pool. <add> # Check-in a database connection back into the pool, indicating that you <add> # no longer need this connection. <ide> def checkin(conn) <ide> @connection_mutex.synchronize do <ide> conn.run_callbacks :checkin <ide> def retrieve_connection_pool(klass) <ide> end <ide> end <ide> end <del>end <ide>\ No newline at end of file <add>end
1
PHP
PHP
refactor some code
30373c0685fdb06de8333cf8f19fa12e33094577
<ide><path>src/Illuminate/Database/Eloquent/Collection.php <ide> protected function buildDictionary() <ide> */ <ide> public function modelKeys() <ide> { <del> if(count($this->dictionary) === 0) <del> { <del> $this->buildDictionary(); <del> } <add> if (count($this->dictionary) === 0) $this->buildDictionary(); <ide> <ide> return array_keys($this->dictionary); <ide> }
1
Ruby
Ruby
fix parens warning in ajax test
70d0b7c87a492aef141859127d1b9fec6b4b09f3
<ide><path>actionpack/test/template/ajax_test.rb <ide> class AjaxTestCase < ActiveSupport::TestCase <ide> <ide> def assert_html(html, matches) <ide> matches.each do |match| <del> assert_match Regexp.new(Regexp.escape(match)), html <add> assert_match(Regexp.new(Regexp.escape(match)), html) <ide> end <ide> end <ide> <ide> def link(options = {}) <ide> <ide> test "with a hash for :update" do <ide> link = link(:update => {:success => "#posts", :failure => "#error"}) <del> assert_match /data-update-success="#posts"/, link <del> assert_match /data-update-failure="#error"/, link <add> assert_match(/data-update-success="#posts"/, link) <add> assert_match(/data-update-failure="#error"/, link) <ide> end <ide> <ide> test "with positional parameters" do <ide> link = link(:position => :top, :update => "#posts") <del> assert_match /data\-update\-position="top"/, link <add> assert_match(/data\-update\-position="top"/, link) <ide> end <ide> <ide> test "with an optional method" do <ide> link = link(:method => "delete") <del> assert_match /data-method="delete"/, link <add> assert_match(/data-method="delete"/, link) <ide> end <ide> <ide> class LegacyLinkToRemoteTest < AjaxTestCase <ide> class StandardTest < ButtonToRemoteTest <ide> button = button({:url => {:action => "whatnot"}}, {:class => "fine"}) <ide> [/input/, /class="fine"/, /type="button"/, /value="Remote outpost"/, <ide> /data-url="\/whatnot"/].each do |match| <del> assert_match match, button <add> assert_match(match, button) <ide> end <ide> end <ide> end
1
Text
Text
amend the changelog
b53da9e90b697d5ed648e34db1ed9219d2f2feb9
<ide><path>activejob/CHANGELOG.md <add>## Rails 5.1.0.alpha ## <add> <add>* Added declarative exception handling via ActiveJob::Base.retry_on and ActiveJob::Base.discard_on. <add> <add> Examples: <add> <add> class RemoteServiceJob < ActiveJob::Base <add> retry_on CustomAppException # defaults to 3s wait, 5 attempts <add> retry_on AnotherCustomAppException, wait: ->(executions) { executions * 2 } <add> retry_on ActiveRecord::StatementInvalid, wait: 5.seconds, attempts: 3 <add> retry_on Net::OpenTimeout, wait: :exponentially_longer, attempts: 10 <add> discard_on ActiveJob::DeserializationError <add> <add> def perform(*args) <add> # Might raise CustomAppException or AnotherCustomAppException for something domain specific <add> # Might raise ActiveRecord::StatementInvalid when a local db deadlock is detected <add> # Might raise Net::OpenTimeout when the remote service is down <add> end <add> end <add> <add> *DHH* <ide> <ide> Please check [5-0-stable](https://github.com/rails/rails/blob/5-0-stable/activejob/CHANGELOG.md) for previous changes.
1
PHP
PHP
remove deprecated code used in fixtures
ecf162c5413d93bd8b9edfc39e244127b6e556d7
<ide><path>src/Datasource/TableSchemaInterface.php <del><?php <del>/** <del> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <del> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * <del> * Licensed under The MIT License <del> * For full copyright and license information, please see the LICENSE.txt <del> * Redistributions of files must retain the above copyright notice. <del> * <del> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * @link https://cakephp.org CakePHP(tm) Project <del> * @since 3.2.12 <del> * @license https://opensource.org/licenses/mit-license.php MIT License <del> * @deprecated 3.5.0 Use Cake\Database\Schema\TableSchemaAwareInterface instead. <del> */ <del>namespace Cake\Datasource; <del> <del>use Cake\Database\Schema\TableSchema; <del> <del>/** <del> * Defines the interface for getting the schema. <del> * <del> * @method \Cake\Database\Schema\TableSchema|null getTableSchema() <del> */ <del>interface TableSchemaInterface <del>{ <del> <del> /** <del> * Get and set the schema for this fixture. <del> * <del> * @param \Cake\Database\Schema\TableSchema|null $schema The table to set. <del> * @return \Cake\Database\Schema\TableSchema|null <del> */ <del> public function schema(TableSchema $schema = null); <del>} <ide><path>src/TestSuite/EmailAssertTrait.php <del><?php <del>/** <del> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <del> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * <del> * Licensed under The MIT License <del> * For full copyright and license information, please see the LICENSE.txt <del> * Redistributions of files must retain the above copyright notice. <del> * <del> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * @link https://cakephp.org CakePHP(tm) Project <del> * @since 3.3.3 <del> * @license https://opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\TestSuite; <del> <del>use Cake\Mailer\Email; <del> <del>/** <del> * Email and mailer assertions. <del> * <del> * @method \PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount any() <del> * @method void assertSame($expected, $result, $message) <del> * @method void assertTextContains($needle, $haystack, $message) <del> * @method \PHPUnit_Framework_MockObject_MockBuilder getMockBuilder($className) <del> * <del> * @deprecated 3.7.0 Use Cake\TestSuite\EmailTrait instead <del> */ <del>trait EmailAssertTrait <del>{ <del> <del> /** <del> * @var \Cake\Mailer\Email <del> */ <del> protected $_email; <del> <del> /** <del> * Sends email using the test email instance. <del> * <del> * @param array|string|null $content The email's content to send. <del> * @return void <del> */ <del> public function send($content = null) <del> { <del> $this->email(true)->send($content); <del> } <del> <del> /** <del> * Creates an email instance overriding its transport for testing purposes. <del> * <del> * @param bool $new Tells if new instance should forcibly be created. <del> * @return \Cake\Mailer\Email <del> */ <del> public function email($new = false) <del> { <del> if ($new || !$this->_email) { <del> $this->_email = new Email(); <del> $this->_email->setProfile(['transport' => 'debug'] + $this->_email->getProfile()); <del> } <del> <del> return $this->_email; <del> } <del> <del> /** <del> * Generates mock for given mailer class. <del> * <del> * @param string $className The mailer's FQCN. <del> * @param array $methods The methods to mock on the mailer. <del> * @return \Cake\Mailer\Mailer|\PHPUnit_Framework_MockObject_MockObject <del> */ <del> public function getMockForMailer($className, array $methods = []) <del> { <del> $name = current(array_slice(explode('\\', $className), -1)); <del> <del> if (!in_array('profile', $methods)) { <del> $methods[] = 'profile'; <del> } <del> <del> $mailer = $this->getMockBuilder($className) <del> ->setMockClassName($name) <del> ->setMethods($methods) <del> ->setConstructorArgs([$this->email()]) <del> ->getMock(); <del> <del> $mailer->expects($this->any()) <del> ->method('profile') <del> ->willReturn($mailer); <del> <del> return $mailer; <del> } <del> <del> /** <del> * Asserts email content (both text and HTML) contains `$needle`. <del> * <del> * @param string $needle Text to look for. <del> * @param string|null $message The failure message to define. <del> * @return void <del> */ <del> public function assertEmailMessageContains($needle, $message = null) <del> { <del> $this->assertEmailHtmlMessageContains($needle, $message); <del> $this->assertEmailTextMessageContains($needle, $message); <del> } <del> <del> /** <del> * Asserts HTML email content contains `$needle`. <del> * <del> * @param string $needle Text to look for. <del> * @param string|null $message The failure message to define. <del> * @return void <del> */ <del> public function assertEmailHtmlMessageContains($needle, $message = null) <del> { <del> $haystack = $this->email()->message('html'); <del> $this->assertTextContains($needle, $haystack, $message); <del> } <del> <del> /** <del> * Asserts text email content contains `$needle`. <del> * <del> * @param string $needle Text to look for. <del> * @param string|null $message The failure message to define. <del> * @return void <del> */ <del> public function assertEmailTextMessageContains($needle, $message = null) <del> { <del> $haystack = $this->email()->message('text'); <del> $this->assertTextContains($needle, $haystack, $message); <del> } <del> <del> /** <del> * Asserts email's subject contains `$expected`. <del> * <del> * @param string $expected Email's subject. <del> * @param string|null $message The failure message to define. <del> * @return void <del> */ <del> public function assertEmailSubject($expected, $message = null) <del> { <del> $result = $this->email()->getSubject(); <del> $this->assertSame($expected, $result, $message); <del> } <del> <del> /** <del> * Asserts email's sender email address and optionally name. <del> * <del> * @param string $email Sender's email address. <del> * @param string|null $name Sender's name. <del> * @param string|null $message The failure message to define. <del> * @return void <del> */ <del> public function assertEmailFrom($email, $name = null, $message = null) <del> { <del> if ($name === null) { <del> $name = $email; <del> } <del> <del> $expected = [$email => $name]; <del> $result = $this->email()->getFrom(); <del> $this->assertSame($expected, $result, $message); <del> } <del> <del> /** <del> * Asserts email is CC'd to only one email address (and optionally name). <del> * <del> * @param string $email CC'd email address. <del> * @param string|null $name CC'd person name. <del> * @param string|null $message The failure message to define. <del> * @return void <del> */ <del> public function assertEmailCc($email, $name = null, $message = null) <del> { <del> if ($name === null) { <del> $name = $email; <del> } <del> <del> $expected = [$email => $name]; <del> $result = $this->email()->getCc(); <del> $this->assertSame($expected, $result, $message); <del> } <del> <del> /** <del> * Asserts email CC'd addresses contain given email address (and <del> * optionally name). <del> * <del> * @param string $email CC'd email address. <del> * @param string|null $name CC'd person name. <del> * @param string|null $message The failure message to define. <del> * @return void <del> */ <del> public function assertEmailCcContains($email, $name = null, $message = null) <del> { <del> $result = $this->email()->getCc(); <del> $this->assertNotEmpty($result[$email], $message); <del> if ($name !== null) { <del> $this->assertEquals($result[$email], $name, $message); <del> } <del> } <del> <del> /** <del> * Asserts email is BCC'd to only one email address (and optionally name). <del> * <del> * @param string $email BCC'd email address. <del> * @param string|null $name BCC'd person name. <del> * @param string|null $message The failure message to define. <del> * @return void <del> */ <del> public function assertEmailBcc($email, $name = null, $message = null) <del> { <del> if ($name === null) { <del> $name = $email; <del> } <del> <del> $expected = [$email => $name]; <del> $result = $this->email()->getBcc(); <del> $this->assertSame($expected, $result, $message); <del> } <del> <del> /** <del> * Asserts email BCC'd addresses contain given email address (and <del> * optionally name). <del> * <del> * @param string $email BCC'd email address. <del> * @param string|null $name BCC'd person name. <del> * @param string|null $message The failure message to define. <del> * @return void <del> */ <del> public function assertEmailBccContains($email, $name = null, $message = null) <del> { <del> $result = $this->email()->getBcc(); <del> $this->assertNotEmpty($result[$email], $message); <del> if ($name !== null) { <del> $this->assertEquals($result[$email], $name, $message); <del> } <del> } <del> <del> /** <del> * Asserts email is sent to only the given recipient's address (and <del> * optionally name). <del> * <del> * @param string $email Recipient's email address. <del> * @param string|null $name Recipient's name. <del> * @param string|null $message The failure message to define. <del> * @return void <del> */ <del> public function assertEmailTo($email, $name = null, $message = null) <del> { <del> if ($name === null) { <del> $name = $email; <del> } <del> <del> $expected = [$email => $name]; <del> $result = $this->email()->getTo(); <del> $this->assertSame($expected, $result, $message); <del> } <del> <del> /** <del> * Asserts email recipients' list contains given email address (and <del> * optionally name). <del> * <del> * @param string $email Recipient's email address. <del> * @param string|null $name Recipient's name. <del> * @param string|null $message The failure message to define. <del> * @return void <del> */ <del> public function assertEmailToContains($email, $name = null, $message = null) <del> { <del> $result = $this->email()->getTo(); <del> $this->assertNotEmpty($result[$email], $message); <del> if ($name !== null) { <del> $this->assertEquals($result[$email], $name, $message); <del> } <del> } <del> <del> /** <del> * Asserts the email attachments contain the given filename (and optionally <del> * file info). <del> * <del> * @param string $filename Expected attachment's filename. <del> * @param array|null $file Expected attachment's file info. <del> * @param string|null $message The failure message to define. <del> * @return void <del> */ <del> public function assertEmailAttachmentsContains($filename, array $file = null, $message = null) <del> { <del> $result = $this->email()->getAttachments(); <del> $this->assertNotEmpty($result[$filename], $message); <del> if ($file === null) { <del> return; <del> } <del> $this->assertContains($file, $result, $message); <del> $this->assertEquals($file, $result[$filename], $message); <del> } <del>} <ide><path>src/TestSuite/Fixture/TestFixture.php <ide> use Cake\Core\Exception\Exception as CakeException; <ide> use Cake\Database\Schema\TableSchema; <ide> use Cake\Database\Schema\TableSchemaAwareInterface; <del>use Cake\Database\Schema\TableSchemaInterface as DatabaseTableSchemaInterface; <add>use Cake\Database\Schema\TableSchemaInterface; <ide> use Cake\Datasource\ConnectionInterface; <ide> use Cake\Datasource\ConnectionManager; <ide> use Cake\Datasource\FixtureInterface; <del>use Cake\Datasource\TableSchemaInterface; <ide> use Cake\Log\Log; <ide> use Cake\ORM\Locator\LocatorAwareTrait; <ide> use Cake\Utility\Inflector; <ide> * Cake TestFixture is responsible for building and destroying tables to be used <ide> * during testing. <ide> */ <del>class TestFixture implements FixtureInterface, TableSchemaInterface, TableSchemaAwareInterface <add>class TestFixture implements FixtureInterface, TableSchemaAwareInterface <ide> { <ide> <ide> use LocatorAwareTrait; <ide> protected function _schemaFromReflection() <ide> $this->_schema = $schemaCollection->describe($this->table); <ide> } <ide> <del> /** <del> * Gets/Sets the TableSchema instance used by this fixture. <del> * <del> * @param \Cake\Database\Schema\TableSchema|null $schema The table to set. <del> * @return \Cake\Database\Schema\TableSchema|null <del> * @deprecated 3.5.0 Use getTableSchema/setTableSchema instead. <del> */ <del> public function schema(TableSchema $schema = null) <del> { <del> deprecationWarning( <del> 'TestFixture::schema() is deprecated. ' . <del> 'Use TestFixture::setTableSchema()/getTableSchema() instead.' <del> ); <del> if ($schema) { <del> $this->setTableSchema($schema); <del> } <del> <del> return $this->getTableSchema(); <del> } <del> <ide> /** <ide> * {@inheritDoc} <ide> */ <ide> public function getTableSchema() <ide> /** <ide> * {@inheritDoc} <ide> */ <del> public function setTableSchema(DatabaseTableSchemaInterface $schema) <add> public function setTableSchema(TableSchemaInterface $schema) <ide> { <ide> $this->_schema = $schema; <ide> <ide><path>src/TestSuite/TestCase.php <ide> public function assertTextNotContains($needle, $haystack, $message = '', $ignore <ide> $this->assertNotContains($needle, $haystack, $message, $ignoreCase); <ide> } <ide> <del> /** <del> * Asserts HTML tags. <del> * <del> * @param string $string An HTML/XHTML/XML string <del> * @param array $expected An array, see above <del> * @param bool $fullDebug Whether or not more verbose output should be used. <del> * @return void <del> * @deprecated 3.0. Use assertHtml() instead. <del> */ <del> public function assertTags($string, $expected, $fullDebug = false) <del> { <del> deprecationWarning('TestCase::assertTags() is deprecated. Use TestCase::assertHtml() instead.'); <del> $this->assertHtml($expected, $string, $fullDebug); <del> } <del> <ide> /** <ide> * Asserts HTML tags. <ide> * <ide><path>tests/TestCase/TestSuite/EmailAssertTraitTest.php <del><?php <del>/** <del> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <del> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * <del> * Licensed under The MIT License <del> * For full copyright and license information, please see the LICENSE.txt <del> * Redistributions of files must retain the above copyright notice <del> * <del> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * @link https://cakephp.org CakePHP(tm) Project <del> * @since 3.3.3 <del> * @license https://opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\Test\TestCase\TestSuite; <del> <del>use Cake\Mailer\Email; <del>use Cake\Mailer\Transport\DebugTransport; <del>use Cake\TestSuite\EmailAssertTrait; <del>use Cake\TestSuite\TestCase; <del>use TestApp\Mailer\TestUserMailer; <del> <del>class EmailAssertTraitTest extends TestCase <del>{ <del> <del> use EmailAssertTrait; <del> <del> public function setUp() <del> { <del> parent::setUp(); <del> Email::setConfigTransport('debug', ['className' => DebugTransport::class]); <del> } <del> <del> public function tearDown() <del> { <del> parent::tearDown(); <del> Email::dropTransport('debug'); <del> } <del> <del> public function testFunctional() <del> { <del> $mailer = $this->getMockForMailer(TestUserMailer::class); <del> $email = $mailer->getEmailForAssertion(); <del> $this->assertSame($this->_email, $email); <del> <del> $mailer->invite('lorenzo@cakephp.org'); <del> $this->assertEmailSubject('CakePHP'); <del> $this->assertEmailFrom('jadb@cakephp.org'); <del> $this->assertEmailTo('lorenzo@cakephp.org'); <del> $this->assertEmailToContains('lorenzo@cakephp.org'); <del> $this->assertEmailToContains('lorenzo@cakephp.org', 'lorenzo@cakephp.org'); <del> $this->assertEmailCcContains('markstory@cakephp.org'); <del> $this->assertEmailCcContains('admad@cakephp.org', 'Adnan'); <del> $this->assertEmailBccContains('dereuromark@cakephp.org'); <del> $this->assertEmailBccContains('antograssiot@cakephp.org'); <del> $this->assertEmailTextMessageContains('Hello lorenzo@cakephp.org'); <del> $this->assertEmailAttachmentsContains('TestUserMailer.php'); <del> $this->assertEmailAttachmentsContains('TestMailer.php', [ <del> 'file' => dirname(dirname(__DIR__)) . DS . 'test_app' . DS . 'TestApp' . DS . 'Mailer' . DS . 'TestMailer.php', <del> 'mimetype' => 'text/x-php', <del> ]); <del> } <del>}
5
Text
Text
fix spelling error
d138ab9d778572807de265afd3bf3f27669ea7a3
<ide><path>guide/english/agile/delivery-team/index.md <ide> A scrum team is made up of the Product Owner (PO), the Scrum Master (SM), and th <ide> <ide> The delivery team is everyone but the PO and SM; the developers, testers, system analysts, database analysts, UI / UX analysts, and so on. <ide> <del>For a scrum delivery team to be effective, it should be nimble (or agile!) enough for decisions to be agreed upon quickly while diverse enough so the vast majority of specalities required for software development can be covered by the entire team. Idealy, a team between 3 and 9 people generally works well for a scrum development team. <add>For a scrum delivery team to be effective, it should be nimble (or agile!) enough for decisions to be agreed upon quickly while diverse enough so the vast majority of specialties required for software development can be covered by the entire team. Idealy, a team between 3 and 9 people generally works well for a scrum development team. <ide> <ide> The team must also foster mutual respect throughout every member of the team. An effective scrum team will be able to share the workload and put the accomplishments of the team ahead of the accomplishments of the individual. <ide>
1
Javascript
Javascript
add callback to fs.close() in test-fs-chmod
712596fc45794dacf428a525081338546b0b8291
<ide><path>test/parallel/test-fs-chmod.js <ide> fs.open(file2, 'a', common.mustCall((err, fd) => { <ide> assert.strictEqual(mode_sync, fs.fstatSync(fd).mode & 0o777); <ide> } <ide> <del> fs.close(fd); <add> fs.close(fd, assert.ifError); <ide> })); <ide> })); <ide>
1
Ruby
Ruby
drop todo that nobody has ever worked on
33f344bdd42eb22733645b5adc22a723045b0f75
<ide><path>Library/Homebrew/utils.rb <ide> def uri_escape(query) <ide> end <ide> <ide> def issues_for_formula name <del> # bit basic as depends on the issue at github having the exact name of the <del> # formula in it. Which for stuff like objective-caml is unlikely. So we <del> # really should search for aliases too. <del> <ide> # don't include issues that just refer to the tool in their body <ide> issues_matching(name).select { |issue| <ide> issue["state"] == "open" && issue["title"].include?(name)
1
Javascript
Javascript
fix a typo in monday
7ddde05056bcc7ebb3a43fa502c60bce91edbbb7
<ide><path>src/locale/ar-ma.js <ide> import moment from '../moment'; <ide> export default moment.defineLocale('ar-ma', { <ide> months : 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split('_'), <ide> monthsShort : 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split('_'), <del> weekdays : 'الأحد_الإتنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), <del> weekdaysShort : 'احد_اتنين_ثلاثاء_اربعاء_خميس_جمعة_سبت'.split('_'), <add> weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), <add> weekdaysShort : 'احد_اثنين_ثلاثاء_اربعاء_خميس_جمعة_سبت'.split('_'), <ide> weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'), <ide> weekdaysParseExact : true, <ide> longDateFormat : { <ide><path>src/test/locale/ar-ma.js <ide> test('format month', function (assert) { <ide> }); <ide> <ide> test('format week', function (assert) { <del> var expected = 'الأحد احد ح_الإتنين اتنين ن_الثلاثاء ثلاثاء ث_الأربعاء اربعاء ر_الخميس خميس خ_الجمعة جمعة ج_السبت سبت س'.split('_'), i; <add> var expected = 'الأحد احد ح_الإثنين اثنين ن_الثلاثاء ثلاثاء ث_الأربعاء اربعاء ر_الخميس خميس خ_الجمعة جمعة ج_السبت سبت س'.split('_'), i; <ide> for (i = 0; i < expected.length; i++) { <ide> assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); <ide> }
2
Text
Text
fix curl response
4599cd97cbbfd2f569408cbadef3a3753d19f406
<ide><path>docs/tutorial/4-authentication-and-permissions.md <ide> We can make a successful request by including the username and password of one o <ide> <ide> curl -X POST http://127.0.0.1:8000/snippets/ -d "code=print 789" -u tom:password <ide> <del> {"url": "http://127.0.0.1:8000/snippets/5/", "highlight": "http://127.0.0.1:8000/snippets/5/highlight/", "owner": "tom", "title": "foo", "code": "print 789", "linenos": false, "language": "python", "style": "friendly"} <add> {"id": 5, "owner": "tom", "title": "foo", "code": "print 789", "linenos": false, "language": "python", "style": "friendly"} <ide> <ide> ## Summary <ide>
1
Java
Java
add top offset for react loading view on kitkat
7ff6657985a09bd2572615d16403fba3af709859
<ide><path>ReactAndroid/src/main/java/com/facebook/react/devsupport/DevLoadingViewController.java <ide> import android.app.Activity; <ide> import android.content.Context; <ide> import android.graphics.Color; <add>import android.graphics.Rect; <add>import android.os.Build; <ide> import android.view.Gravity; <ide> import android.view.LayoutInflater; <ide> import android.view.ViewGroup; <add>import android.view.Window; <ide> import android.widget.PopupWindow; <ide> import android.widget.TextView; <ide> <ide> public DevLoadingViewController(Context context, ReactInstanceManagerDevHelper r <ide> } <ide> <ide> public void showMessage(final String message, final int color, final int backgroundColor) { <del> if (!sEnabled ) { <add> if (!sEnabled) { <ide> return; <ide> } <ide> <ide> private void showInternal() { <ide> return; <ide> } <ide> <add> int topOffset = 0; <add> if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) { <add> // On Android SDK <= 19 PopupWindow#showAtLocation uses absolute screen position. In order for <add> // loading view to be placed below status bar (if the status bar is present) we need to pass <add> // an appropriate Y offset. <add> Rect rectangle = new Rect(); <add> currentActivity.getWindow().getDecorView().getWindowVisibleDisplayFrame(rectangle); <add> topOffset = rectangle.top; <add> } <add> <ide> mDevLoadingPopup = new PopupWindow( <ide> mDevLoadingView, <ide> ViewGroup.LayoutParams.MATCH_PARENT, <ide> private void showInternal() { <ide> mDevLoadingPopup.showAtLocation( <ide> currentActivity.getWindow().getDecorView(), <ide> Gravity.NO_GRAVITY, <add> <ide> 0, <del> 0); <add> topOffset); <ide> } <ide> <ide> private void hideInternal() {
1
Go
Go
support docker diff
4fac603682747476a12dba0df79c10e919eddefb
<ide><path>daemon/changes.go <ide> package daemon <ide> <ide> import ( <add> "errors" <add> "runtime" <ide> "time" <ide> <ide> "github.com/docker/docker/pkg/archive" <ide> func (daemon *Daemon) ContainerChanges(name string) ([]archive.Change, error) { <ide> return nil, err <ide> } <ide> <add> if runtime.GOOS == "windows" && container.IsRunning() { <add> return nil, errors.New("Windows does not support diff of a running container") <add> } <add> <ide> container.Lock() <ide> defer container.Unlock() <ide> c, err := container.RWLayer.Changes() <ide><path>daemon/graphdriver/windows/windows.go <ide> func (d *Driver) Diff(id, parent string) (_ io.ReadCloser, err error) { <ide> <ide> // Changes produces a list of changes between the specified layer <ide> // and its parent layer. If parent is "", then all changes will be ADD changes. <del>// The layer should be mounted when calling this function <add>// The layer should not be mounted when calling this function. <ide> func (d *Driver) Changes(id, parent string) ([]archive.Change, error) { <ide> rID, err := d.resolveID(id) <ide> if err != nil { <ide> func (d *Driver) Changes(id, parent string) ([]archive.Change, error) { <ide> return nil, err <ide> } <ide> <del> // this is assuming that the layer is unmounted <del> if err := hcsshim.UnprepareLayer(d.info, rID); err != nil { <add> if err := hcsshim.ActivateLayer(d.info, rID); err != nil { <ide> return nil, err <ide> } <ide> defer func() { <del> if err := hcsshim.PrepareLayer(d.info, rID, parentChain); err != nil { <del> logrus.Warnf("Failed to Deactivate %s: %s", rID, err) <add> if err2 := hcsshim.DeactivateLayer(d.info, rID); err2 != nil { <add> logrus.Errorf("changes() failed to DeactivateLayer %s %s: %s", id, rID, err2) <ide> } <ide> }() <ide>
2
Ruby
Ruby
add tests for language/python
3ce4caeb1aa8d5b9cd818bc114b4810b717ced3b
<ide><path>Library/Homebrew/test/language/python_spec.rb <ide> require "language/python" <ide> require "resource" <ide> <add>describe Language::Python, :needs_python do <add> describe "#major_minor_version" do <add> it "returns a Version for Python 2" do <add> expect(subject).to receive(:major_minor_version).and_return(Version) <add> subject.major_minor_version("python") <add> end <add> end <add> <add> describe "#site_packages" do <add> it "gives a different location between PyPy and Python 2" do <add> expect(subject.site_packages("python")).not_to eql(subject.site_packages("pypy")) <add> end <add> end <add> <add> describe "#homebrew_site_packages" do <add> it "returns the Homebrew site packages location" do <add> expect(subject).to receive(:site_packages).and_return(Pathname) <add> subject.site_packages("python") <add> end <add> end <add> <add> describe "#user_site_packages" do <add> it "can determine user site packages location" do <add> expect(subject).to receive(:user_site_packages).and_return(Pathname) <add> subject.user_site_packages("python") <add> end <add> end <add>end <add> <ide> describe Language::Python::Virtualenv::Virtualenv do <ide> subject { described_class.new(formula, dir, "python") } <ide>
1
Javascript
Javascript
use fqdn for img[src]
a22596c925a41c6f9b78cb21e18894987bbbc84b
<ide><path>test/ng/compileSpec.js <ide> describe('$compile', function() { <ide> $rootScope.$apply(); <ide> expect(element.attr('src')).toBe('#foo'); <ide> <del> $rootScope.testUrl = "http://foo/bar"; <add> $rootScope.testUrl = "http://foo.com/bar"; <ide> $rootScope.$apply(); <del> expect(element.attr('src')).toBe('http://foo/bar'); <add> expect(element.attr('src')).toBe('http://foo.com/bar'); <ide> <del> $rootScope.testUrl = " http://foo/bar"; <add> $rootScope.testUrl = " http://foo.com/bar"; <ide> $rootScope.$apply(); <del> expect(element.attr('src')).toBe(' http://foo/bar'); <add> expect(element.attr('src')).toBe(' http://foo.com/bar'); <ide> <del> $rootScope.testUrl = "https://foo/bar"; <add> $rootScope.testUrl = "https://foo.com/bar"; <ide> $rootScope.$apply(); <del> expect(element.attr('src')).toBe('https://foo/bar'); <add> expect(element.attr('src')).toBe('https://foo.com/bar'); <ide> <del> $rootScope.testUrl = "ftp://foo/bar"; <add> $rootScope.testUrl = "ftp://foo.com/bar"; <ide> $rootScope.$apply(); <del> expect(element.attr('src')).toBe('ftp://foo/bar'); <add> expect(element.attr('src')).toBe('ftp://foo.com/bar'); <ide> <ide> // Fails on IE < 10 with "TypeError: Access is denied" when trying to set img[src] <ide> if (!msie || msie > 10) {
1
Ruby
Ruby
add a missing require
3af8a91c384761ab8772c57ab1ee0ea1b8fe69e7
<ide><path>railties/test/rack_logger_test.rb <add>require 'abstract_unit' <ide> require 'active_support/testing/autorun' <ide> require 'active_support/test_case' <ide> require 'rails/rack/logger'
1
Javascript
Javascript
remove extra space
b5b0357dca98233981c00523943f95388084d5b2
<ide><path>pdf.js <ide> var PartialEvaluator = (function() { <ide> } <ide> } <ide> <del> // TODO implement default widths for standard fonts metrics <add> // TODO implement default widths for standard fonts metrics <ide> var defaultWidth = 1000; <ide> var widths = Metrics[stdFontMap[baseFontName] || baseFontName]; <ide> if (IsNum(widths)) {
1
Java
Java
update resttemplate javadoc
c4d7976c371ea4ed9e596439a22486eed7941767
<ide><path>spring-web/src/main/java/org/springframework/web/client/RestTemplate.java <ide> * <tr><td>any</td><td>{@link #exchange}</td></tr> <ide> * <tr><td></td><td>{@link #execute}</td></tr> </table> <ide> * <del> * <p>The {@code exchange} and {@code execute} methods are generalized versions of the more specific methods listed <del> * above them. They support additional, less frequently used combinations including support for requests using the <del> * HTTP PATCH method. However, note that the underlying HTTP library must also support the desired combination. <add> * <p>In addition the {@code exchange} and {@code execute} methods are generalized versions of <add> * the above methods and can be used to support additional, less frequent combinations (e.g. <add> * HTTP PATCH, HTTP PUT with response body, etc.). Note however that the underlying HTTP <add> * library used must also support the desired combination. <ide> * <del> * <p>For each of these HTTP methods, there are three corresponding Java methods in the {@code RestTemplate}. <del> * Two variants take a {@code String} URI as first argument (eg. {@link #getForObject(String, Class, Object[])}, <del> * {@link #getForObject(String, Class, Map)}), and are capable of substituting any {@linkplain UriTemplate URI templates} <del> * in that URL using either a {@code String} variable arguments array, or a {@code Map<String, String>}. <del> * The string varargs variant expands the given template variables in order, so that <del> * <pre class="code"> <del> * String result = restTemplate.getForObject("http://example.com/hotels/{hotel}/bookings/{booking}", String.class, "42", <del> * "21"); <del> * </pre> <del> * will perform a GET on {@code http://example.com/hotels/42/bookings/21}. The map variant expands the template based <del> * on variable name, and is therefore more useful when using many variables, or when a single variable is used multiple <del> * times. For example: <del> * <pre class="code"> <del> * Map&lt;String, String&gt; vars = Collections.singletonMap("hotel", "42"); <del> * String result = restTemplate.getForObject("http://example.com/hotels/{hotel}/rooms/{hotel}", String.class, vars); <del> * </pre> <del> * will perform a GET on {@code http://example.com/hotels/42/rooms/42}. Alternatively, there are {@link URI} variant <del> * methods ({@link #getForObject(URI, Class)}), which do not allow for URI templates, but allow you to reuse a single, <del> * expanded URI multiple times. <add> * <p>For each HTTP method there are 3 variants -- two accept a URI template string <add> * and URI variables (array or map) while a third accepts a {@link URI}. <add> * Note that for URI templates it is assumed encoding is necessary, e.g. <add> * {@code restTemplate.getForObject("http://example.com/hotel list")} becomes <add> * {@code "http://example.com/hotel%20list"}. This also means if the URI template <add> * or URI variables are already encoded, double encoding will occur, e.g. <add> * {@code http://example.com/hotel%20list} becomes <add> * {@code http://example.com/hotel%2520list}). To avoid that use a {@code URI} method <add> * variant to provide (or re-use) a previously encoded URI. To prepare such an URI <add> * with full control over encoding, consider using <add> * {@link org.springframework.web.util.UriComponentsBuilder}. <ide> * <del> * <p>Furthermore, the {@code String}-argument methods assume that the URL String is unencoded. This means that <del> * <pre class="code"> <del> * restTemplate.getForObject("http://example.com/hotel list"); <del> * </pre> <del> * will perform a GET on {@code http://example.com/hotel%20list}. As a result, any URL passed that is already encoded <del> * will be encoded twice (i.e. {@code http://example.com/hotel%20list} will become {@code <del> * http://example.com/hotel%2520list}). If this behavior is undesirable, use the {@code URI}-argument methods, which <del> * will not perform any URL encoding. <add> * <p>Internally the template uses {@link HttpMessageConverter} instances to <add> * convert HTTP messages to and from POJOs. Converters for the main mime types <add> * are registered by default but you can also register additional converters <add> * via {@link #setMessageConverters}. <ide> * <del> * <p>Objects passed to and returned from these methods are converted to and from HTTP messages by <del> * {@link HttpMessageConverter} instances. Converters for the main mime types are registered by default, <del> * but you can also write your own converter and register it via the {@link #setMessageConverters messageConverters} <del> * bean property. <del> * <del> * <p>This template uses a {@link org.springframework.http.client.SimpleClientHttpRequestFactory} and a <del> * {@link DefaultResponseErrorHandler} as default strategies for creating HTTP connections or handling HTTP errors, <del> * respectively. These defaults can be overridden through the {@link #setRequestFactory(ClientHttpRequestFactory) <del> * requestFactory} and {@link #setErrorHandler(ResponseErrorHandler) errorHandler} bean properties. <add> * <p>This template uses a <add> * {@link org.springframework.http.client.SimpleClientHttpRequestFactory} and a <add> * {@link DefaultResponseErrorHandler} as default strategies for creating HTTP <add> * connections or handling HTTP errors, respectively. These defaults can be overridden <add> * through {@link #setRequestFactory} and {@link #setErrorHandler} respectively. <ide> * <ide> * @author Arjen Poutsma <ide> * @author Brian Clozel
1
Text
Text
add corrected text
b1ee46d2035d5d8cb25e3d9183685ee457f59739
<ide><path>guide/russian/css/css3-nth-child-selector/index.md <ide> title: CSS3 Nth Child Selector <ide> localeTitle: CSS3 N-й детский селектор <ide> --- <del>## CSS3 N-й детский селектор <add>## CSS3 Nth Child селектор <ide> <del>Селектор `nth-child` - это css psuedo-class, в котором используется шаблон, позволяющий сопоставить один или несколько элементов относительно их положения среди братьев и сестер. <add>Селектор `nth-child` - это превдокласс, находит один или более элементов, основываясь на их позиции среди группы соседних элементов. <ide> <ide> ## Синтаксис <ide> <ide> CSS a: nth-childe (3n) { / \* CSS идет здесь \* / } \`\` \` <ide> <ide> ### Дополнительная информация: <ide> <del>[Документация MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/%3Anth-child) [CSS-трюки - n-й дочерний селектор](https://css-tricks.com/almanac/selectors/n/nth-child/) [CSS Tricks - n-й детский тестер](https://css-tricks.com/examples/nth-child-tester/) [W3Scools - n-й дочерний селектор](https://www.w3schools.com/cssref/sel_nth-child.asp) <ide>\ No newline at end of file <add>[Документация MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/%3Anth-child) [CSS-трюки - n-й дочерний селектор](https://css-tricks.com/almanac/selectors/n/nth-child/) [CSS Tricks - n-й детский тестер](https://css-tricks.com/examples/nth-child-tester/) [W3Scools - n-й дочерний селектор](https://www.w3schools.com/cssref/sel_nth-child.asp)
1
Javascript
Javascript
improve unicode handling
fedc31bb3c46511d1fd1c906ee149d60f1c51bbf
<ide><path>lib/readline.js <ide> Interface.prototype._wordLeft = function() { <ide> Interface.prototype._wordRight = function() { <ide> if (this.cursor < this.line.length) { <ide> var trailing = this.line.slice(this.cursor); <del> var match = trailing.match(/^(?:\s+|\W+|\w+)\s*/); <add> var match = trailing.match(/^(?:\s+|[^\w\s]+|\w+)\s*/); <ide> this._moveCursor(match[0].length); <ide> } <ide> }; <ide> <add>function charLengthLeft(str, i) { <add> if (i <= 0) <add> return 0; <add> if (i > 1 && str.codePointAt(i - 2) >= 2 ** 16 || <add> str.codePointAt(i - 1) >= 2 ** 16) { <add> return 2; <add> } <add> return 1; <add>} <add> <add>function charLengthAt(str, i) { <add> if (str.length <= i) <add> return 0; <add> return str.codePointAt(i) >= 2 ** 16 ? 2 : 1; <add>} <ide> <ide> Interface.prototype._deleteLeft = function() { <ide> if (this.cursor > 0 && this.line.length > 0) { <del> this.line = this.line.slice(0, this.cursor - 1) + <add> // The number of UTF-16 units comprising the character to the left <add> const charSize = charLengthLeft(this.line, this.cursor); <add> this.line = this.line.slice(0, this.cursor - charSize) + <ide> this.line.slice(this.cursor, this.line.length); <ide> <del> this.cursor--; <add> this.cursor -= charSize; <ide> this._refreshLine(); <ide> } <ide> }; <ide> <ide> <ide> Interface.prototype._deleteRight = function() { <del> this.line = this.line.slice(0, this.cursor) + <del> this.line.slice(this.cursor + 1, this.line.length); <del> this._refreshLine(); <add> if (this.cursor < this.line.length) { <add> // The number of UTF-16 units comprising the character to the left <add> const charSize = charLengthAt(this.line, this.cursor); <add> this.line = this.line.slice(0, this.cursor) + <add> this.line.slice(this.cursor + charSize, this.line.length); <add> this._refreshLine(); <add> } <ide> }; <ide> <ide> <ide> Interface.prototype._ttyWrite = function(s, key) { <ide> break; <ide> <ide> case 'b': // back one character <del> this._moveCursor(-1); <add> this._moveCursor(-charLengthLeft(this.line, this.cursor)); <ide> break; <ide> <ide> case 'f': // forward one character <del> this._moveCursor(+1); <add> this._moveCursor(+charLengthAt(this.line, this.cursor)); <ide> break; <ide> <ide> case 'l': // clear the whole screen <ide> Interface.prototype._ttyWrite = function(s, key) { <ide> break; <ide> <ide> case 'left': <del> this._moveCursor(-1); <add> // obtain the code point to the left <add> this._moveCursor(-charLengthLeft(this.line, this.cursor)); <ide> break; <ide> <ide> case 'right': <del> this._moveCursor(+1); <add> this._moveCursor(+charLengthAt(this.line, this.cursor)); <ide> break; <ide> <ide> case 'home': <ide><path>test/parallel/test-readline-interface.js <ide> function isWarned(emitter) { <ide> rli.close(); <ide> } <ide> <add> // Back and Forward one astral character <add> { <add> const fi = new FakeInput(); <add> const rli = new readline.Interface({ <add> input: fi, <add> output: fi, <add> prompt: '', <add> terminal: terminal <add> }); <add> fi.emit('data', '💻'); <add> <add> // move left one character/code point <add> fi.emit('keypress', '.', { name: 'left' }); <add> let cursorPos = rli._getCursorPos(); <add> assert.strictEqual(cursorPos.rows, 0); <add> assert.strictEqual(cursorPos.cols, 0); <add> <add> // move right one character/code point <add> fi.emit('keypress', '.', { name: 'right' }); <add> cursorPos = rli._getCursorPos(); <add> assert.strictEqual(cursorPos.rows, 0); <add> if (common.hasIntl) { <add> assert.strictEqual(cursorPos.cols, 2); <add> } else { <add> assert.strictEqual(cursorPos.cols, 1); <add> } <add> <add> rli.on('line', common.mustCall((line) => { <add> assert.strictEqual(line, '💻'); <add> })); <add> fi.emit('data', '\n'); <add> rli.close(); <add> } <add> <add> // Two astral characters left <add> { <add> const fi = new FakeInput(); <add> const rli = new readline.Interface({ <add> input: fi, <add> output: fi, <add> prompt: '', <add> terminal: terminal <add> }); <add> fi.emit('data', '💻'); <add> <add> // move left one character/code point <add> fi.emit('keypress', '.', { name: 'left' }); <add> let cursorPos = rli._getCursorPos(); <add> assert.strictEqual(cursorPos.rows, 0); <add> assert.strictEqual(cursorPos.cols, 0); <add> <add> fi.emit('data', '🐕'); <add> cursorPos = rli._getCursorPos(); <add> assert.strictEqual(cursorPos.rows, 0); <add> <add> if (common.hasIntl) { <add> assert.strictEqual(cursorPos.cols, 2); <add> } else { <add> assert.strictEqual(cursorPos.cols, 1); <add> // Fix cursor position without internationalization <add> fi.emit('keypress', '.', { name: 'left' }); <add> } <add> <add> rli.on('line', common.mustCall((line) => { <add> assert.strictEqual(line, '🐕💻'); <add> })); <add> fi.emit('data', '\n'); <add> rli.close(); <add> } <add> <add> // Two astral characters right <add> { <add> const fi = new FakeInput(); <add> const rli = new readline.Interface({ <add> input: fi, <add> output: fi, <add> prompt: '', <add> terminal: terminal <add> }); <add> fi.emit('data', '💻'); <add> <add> // move left one character/code point <add> fi.emit('keypress', '.', { name: 'right' }); <add> let cursorPos = rli._getCursorPos(); <add> assert.strictEqual(cursorPos.rows, 0); <add> if (common.hasIntl) { <add> assert.strictEqual(cursorPos.cols, 2); <add> } else { <add> assert.strictEqual(cursorPos.cols, 1); <add> // Fix cursor position without internationalization <add> fi.emit('keypress', '.', { name: 'right' }); <add> } <add> <add> fi.emit('data', '🐕'); <add> cursorPos = rli._getCursorPos(); <add> assert.strictEqual(cursorPos.rows, 0); <add> if (common.hasIntl) { <add> assert.strictEqual(cursorPos.cols, 4); <add> } else { <add> assert.strictEqual(cursorPos.cols, 2); <add> } <add> <add> rli.on('line', common.mustCall((line) => { <add> assert.strictEqual(line, '💻🐕'); <add> })); <add> fi.emit('data', '\n'); <add> rli.close(); <add> } <add> <ide> { <ide> // `wordLeft` and `wordRight` <ide> const fi = new FakeInput(); <ide> function isWarned(emitter) { <ide> rli.close(); <ide> } <ide> <add> // deleteLeft astral character <add> { <add> const fi = new FakeInput(); <add> const rli = new readline.Interface({ <add> input: fi, <add> output: fi, <add> prompt: '', <add> terminal: terminal <add> }); <add> fi.emit('data', '💻'); <add> let cursorPos = rli._getCursorPos(); <add> assert.strictEqual(cursorPos.rows, 0); <add> if (common.hasIntl) { <add> assert.strictEqual(cursorPos.cols, 2); <add> } else { <add> assert.strictEqual(cursorPos.cols, 1); <add> } <add> // Delete left character <add> fi.emit('keypress', '.', { ctrl: true, name: 'h' }); <add> cursorPos = rli._getCursorPos(); <add> assert.strictEqual(cursorPos.rows, 0); <add> assert.strictEqual(cursorPos.cols, 0); <add> rli.on('line', common.mustCall((line) => { <add> assert.strictEqual(line, ''); <add> })); <add> fi.emit('data', '\n'); <add> rli.close(); <add> } <add> <ide> // deleteRight <ide> { <ide> const fi = new FakeInput(); <ide> function isWarned(emitter) { <ide> rli.close(); <ide> } <ide> <add> // deleteRight astral character <add> { <add> const fi = new FakeInput(); <add> const rli = new readline.Interface({ <add> input: fi, <add> output: fi, <add> prompt: '', <add> terminal: terminal <add> }); <add> fi.emit('data', '💻'); <add> <add> // Go to the start of the line <add> fi.emit('keypress', '.', { ctrl: true, name: 'a' }); <add> let cursorPos = rli._getCursorPos(); <add> assert.strictEqual(cursorPos.rows, 0); <add> assert.strictEqual(cursorPos.cols, 0); <add> <add> // Delete right character <add> fi.emit('keypress', '.', { ctrl: true, name: 'd' }); <add> cursorPos = rli._getCursorPos(); <add> assert.strictEqual(cursorPos.rows, 0); <add> assert.strictEqual(cursorPos.cols, 0); <add> rli.on('line', common.mustCall((line) => { <add> assert.strictEqual(line, ''); <add> })); <add> fi.emit('data', '\n'); <add> rli.close(); <add> } <ide> <ide> // deleteLineLeft <ide> {
2
Ruby
Ruby
remove unused callbacks in the `topic` model
b33ccaa6c335e2ce482c9de1aa05e4a612aa84bc
<ide><path>activerecord/test/models/topic.rb <ide> def topic_id <ide> <ide> alias_attribute :heading, :title <ide> <del> before_validation :before_validation_for_transaction <ide> before_save :before_save_for_transaction <del> before_destroy :before_destroy_for_transaction <ide> <ide> after_save :after_save_for_transaction <ide> after_create :after_create_for_transaction <ide> def set_email_address <ide> end <ide> end <ide> <del> def before_validation_for_transaction; end <ide> def before_save_for_transaction; end <del> def before_destroy_for_transaction; end <ide> def after_save_for_transaction; end <ide> def after_create_for_transaction; end <ide>
1
Python
Python
remove unused token_type_ids in mpnet
8eba1f8ca84c9558e3873b3181086d98852747f1
<ide><path>src/transformers/models/mpnet/modeling_mpnet.py <ide> def forward( <ide> self, <ide> input_ids=None, <ide> attention_mask=None, <del> token_type_ids=None, <ide> position_ids=None, <ide> head_mask=None, <ide> inputs_embeds=None, <ide> def forward( <ide> outputs = self.mpnet( <ide> input_ids, <ide> attention_mask=attention_mask, <del> token_type_ids=token_type_ids, <ide> position_ids=position_ids, <ide> head_mask=head_mask, <ide> inputs_embeds=inputs_embeds, <ide> def forward( <ide> self, <ide> input_ids=None, <ide> attention_mask=None, <del> token_type_ids=None, <ide> position_ids=None, <ide> head_mask=None, <ide> inputs_embeds=None, <ide> def forward( <ide> config.num_labels - 1]`. If :obj:`config.num_labels == 1` a regression loss is computed (Mean-Square loss), <ide> If :obj:`config.num_labels > 1` a classification loss is computed (Cross-Entropy). <ide> """ <add> <ide> return_dict = return_dict if return_dict is not None else self.config.use_return_dict <ide> <ide> outputs = self.mpnet( <ide> input_ids, <ide> attention_mask=attention_mask, <del> token_type_ids=token_type_ids, <ide> position_ids=position_ids, <ide> head_mask=head_mask, <ide> inputs_embeds=inputs_embeds, <ide> def __init__(self, config): <ide> def forward( <ide> self, <ide> input_ids=None, <del> token_type_ids=None, <ide> attention_mask=None, <ide> position_ids=None, <ide> head_mask=None, <ide> def forward( <ide> num_choices-1]`` where :obj:`num_choices` is the size of the second dimension of the input tensors. (See <ide> :obj:`input_ids` above) <ide> """ <add> <ide> return_dict = return_dict if return_dict is not None else self.config.use_return_dict <ide> num_choices = input_ids.shape[1] if input_ids is not None else inputs_embeds.shape[1] <ide> <ide> flat_input_ids = input_ids.view(-1, input_ids.size(-1)) if input_ids is not None else None <ide> flat_position_ids = position_ids.view(-1, position_ids.size(-1)) if position_ids is not None else None <del> flat_token_type_ids = token_type_ids.view(-1, token_type_ids.size(-1)) if token_type_ids is not None else None <ide> flat_attention_mask = attention_mask.view(-1, attention_mask.size(-1)) if attention_mask is not None else None <ide> flat_inputs_embeds = ( <ide> inputs_embeds.view(-1, inputs_embeds.size(-2), inputs_embeds.size(-1)) <ide> def forward( <ide> outputs = self.mpnet( <ide> flat_input_ids, <ide> position_ids=flat_position_ids, <del> token_type_ids=flat_token_type_ids, <ide> attention_mask=flat_attention_mask, <ide> head_mask=head_mask, <ide> inputs_embeds=flat_inputs_embeds, <ide> def forward( <ide> self, <ide> input_ids=None, <ide> attention_mask=None, <del> token_type_ids=None, <ide> position_ids=None, <ide> head_mask=None, <ide> inputs_embeds=None, <ide> def forward( <ide> Labels for computing the token classification loss. Indices should be in ``[0, ..., config.num_labels - <ide> 1]``. <ide> """ <add> <ide> return_dict = return_dict if return_dict is not None else self.config.use_return_dict <ide> <ide> outputs = self.mpnet( <ide> input_ids, <ide> attention_mask=attention_mask, <del> token_type_ids=token_type_ids, <ide> position_ids=position_ids, <ide> head_mask=head_mask, <ide> inputs_embeds=inputs_embeds, <ide> def forward( <ide> self, <ide> input_ids=None, <ide> attention_mask=None, <del> token_type_ids=None, <ide> position_ids=None, <ide> head_mask=None, <ide> inputs_embeds=None, <ide> def forward( <ide> outputs = self.mpnet( <ide> input_ids, <ide> attention_mask=attention_mask, <del> token_type_ids=token_type_ids, <ide> position_ids=position_ids, <ide> head_mask=head_mask, <ide> inputs_embeds=inputs_embeds, <ide><path>src/transformers/models/mpnet/modeling_tf_mpnet.py <ide> def call( <ide> self, <ide> input_ids=None, <ide> position_ids=None, <del> token_type_ids=None, <ide> inputs_embeds=None, <ide> mode="embedding", <ide> training=False, <ide> def call( <ide> Get token embeddings of inputs <ide> <ide> Args: <del> inputs: list of three int64 tensors with shape [batch_size, length]: (input_ids, position_ids, token_type_ids) <add> inputs: list of two int64 tensors with shape [batch_size, length]: (input_ids, position_ids) <ide> mode: string, a valid value is one of "embedding" and "linear" <ide> <ide> Returns: <ide> def call( <ide> https://github.com/tensorflow/models/blob/a009f4fb9d2fc4949e32192a944688925ef78659/official/transformer/v2/embedding_layer.py#L24 <ide> """ <ide> if mode == "embedding": <del> return self._embedding(input_ids, position_ids, token_type_ids, inputs_embeds, training=training) <add> return self._embedding(input_ids, position_ids, inputs_embeds, training=training) <ide> elif mode == "linear": <ide> return self._linear(input_ids) <ide> else: <ide> raise ValueError("mode {} is not valid.".format(mode)) <ide> <del> def _embedding(self, input_ids, position_ids, token_type_ids, inputs_embeds, training=False): <add> def _embedding(self, input_ids, position_ids, inputs_embeds, training=False): <ide> """Applies embedding based on inputs tensor.""" <ide> assert not (input_ids is None and inputs_embeds is None) <ide> <ide> class PreTrainedModel <ide> """ <ide> raise NotImplementedError <ide> <del> # Copied from transformers.models.bert.modeling_tf_bert.TFBertMainLayer.call <ide> def call( <ide> self, <ide> input_ids=None, <ide> attention_mask=None, <del> token_type_ids=None, <ide> position_ids=None, <ide> head_mask=None, <ide> inputs_embeds=None, <ide> def call( <ide> config=self.config, <ide> input_ids=input_ids, <ide> attention_mask=attention_mask, <del> token_type_ids=token_type_ids, <ide> position_ids=position_ids, <ide> head_mask=head_mask, <ide> inputs_embeds=inputs_embeds, <ide> def call( <ide> training=training, <ide> kwargs_call=kwargs, <ide> ) <add> <ide> if inputs["input_ids"] is not None and inputs["inputs_embeds"] is not None: <ide> raise ValueError("You cannot specify both input_ids and inputs_embeds at the same time") <ide> elif inputs["input_ids"] is not None: <ide> def call( <ide> if inputs["attention_mask"] is None: <ide> inputs["attention_mask"] = tf.fill(input_shape, 1) <ide> <del> if inputs["token_type_ids"] is None: <del> inputs["token_type_ids"] = tf.fill(input_shape, 0) <del> <ide> embedding_output = self.embeddings( <ide> inputs["input_ids"], <ide> inputs["position_ids"], <del> inputs["token_type_ids"], <ide> inputs["inputs_embeds"], <ide> training=inputs["training"], <ide> ) <ide> def call( <ide> <ide> - a single Tensor with :obj:`input_ids` only and nothing else: :obj:`model(inputs_ids)` <ide> - a list of varying length with one or several input Tensors IN THE ORDER given in the docstring: <del> :obj:`model([input_ids, attention_mask])` or :obj:`model([input_ids, attention_mask, token_type_ids])` <add> :obj:`model([input_ids, attention_mask])` <ide> - a dictionary with one or several input Tensors associated to the input names given in the docstring: <del> :obj:`model({"input_ids": input_ids, "token_type_ids": token_type_ids})` <add> :obj:`model({"input_ids": input_ids, "attention_mask": attention_mask})` <ide> <ide> Args: <ide> config (:class:`~transformers.MPNetConfig`): Model configuration class with all the parameters of the model. <ide> def call( <ide> - 0 for tokens that are **masked**. <ide> <ide> `What are attention masks? <../glossary.html#attention-mask>`__ <del> token_type_ids (:obj:`Numpy array` or :obj:`tf.Tensor` of shape :obj:`({0})`, `optional`): <del> Segment token indices to indicate first and second portions of the inputs. Indices are selected in ``[0, <del> 1]``: <del> <del> - 0 corresponds to a `sentence A` token, <del> - 1 corresponds to a `sentence B` token. <del> <del> `What are token type IDs? <../glossary.html#token-type-ids>`__ <ide> position_ids (:obj:`Numpy array` or :obj:`tf.Tensor` of shape :obj:`({0})`, `optional`): <ide> Indices of positions of each input sequence tokens in the position embeddings. Selected in the range ``[0, <ide> config.max_position_embeddings - 1]``. <ide> def call( <ide> self, <ide> input_ids=None, <ide> attention_mask=None, <del> token_type_ids=None, <ide> position_ids=None, <ide> head_mask=None, <ide> inputs_embeds=None, <ide> def call( <ide> config=self.config, <ide> input_ids=input_ids, <ide> attention_mask=attention_mask, <del> token_type_ids=token_type_ids, <ide> position_ids=position_ids, <ide> head_mask=head_mask, <ide> inputs_embeds=inputs_embeds, <ide> def call( <ide> outputs = self.mpnet( <ide> input_ids=inputs["input_ids"], <ide> attention_mask=inputs["attention_mask"], <del> token_type_ids=inputs["token_type_ids"], <ide> position_ids=inputs["position_ids"], <ide> head_mask=inputs["head_mask"], <ide> inputs_embeds=inputs["inputs_embeds"], <ide> def call( <ide> self, <ide> input_ids=None, <ide> attention_mask=None, <del> token_type_ids=None, <ide> position_ids=None, <ide> head_mask=None, <ide> inputs_embeds=None, <ide> def call( <ide> config.vocab_size]`` (see ``input_ids`` docstring) Tokens with indices set to ``-100`` are ignored <ide> (masked), the loss is only computed for the tokens with labels in ``[0, ..., config.vocab_size]`` <ide> """ <add> <ide> inputs = input_processing( <ide> func=self.call, <ide> config=self.config, <ide> input_ids=input_ids, <ide> attention_mask=attention_mask, <del> token_type_ids=token_type_ids, <ide> position_ids=position_ids, <ide> head_mask=head_mask, <ide> inputs_embeds=inputs_embeds, <ide> def call( <ide> outputs = self.mpnet( <ide> inputs["input_ids"], <ide> attention_mask=inputs["attention_mask"], <del> token_type_ids=inputs["token_type_ids"], <ide> position_ids=inputs["position_ids"], <ide> head_mask=inputs["head_mask"], <ide> inputs_embeds=inputs["inputs_embeds"], <ide> def call( <ide> self, <ide> input_ids=None, <ide> attention_mask=None, <del> token_type_ids=None, <ide> position_ids=None, <ide> head_mask=None, <ide> inputs_embeds=None, <ide> def call( <ide> config.num_labels - 1]`. If :obj:`config.num_labels == 1` a regression loss is computed (Mean-Square loss), <ide> If :obj:`config.num_labels > 1` a classification loss is computed (Cross-Entropy). <ide> """ <add> <ide> inputs = input_processing( <ide> func=self.call, <ide> config=self.config, <ide> input_ids=input_ids, <ide> attention_mask=attention_mask, <del> token_type_ids=token_type_ids, <ide> position_ids=position_ids, <ide> head_mask=head_mask, <ide> inputs_embeds=inputs_embeds, <ide> def call( <ide> outputs = self.mpnet( <ide> inputs["input_ids"], <ide> attention_mask=inputs["attention_mask"], <del> token_type_ids=inputs["token_type_ids"], <ide> position_ids=inputs["position_ids"], <ide> head_mask=inputs["head_mask"], <ide> inputs_embeds=inputs["inputs_embeds"], <ide> def call( <ide> self, <ide> input_ids=None, <ide> attention_mask=None, <del> token_type_ids=None, <ide> position_ids=None, <ide> head_mask=None, <ide> inputs_embeds=None, <ide> def call( <ide> config=self.config, <ide> input_ids=input_ids, <ide> attention_mask=attention_mask, <del> token_type_ids=token_type_ids, <ide> position_ids=position_ids, <ide> head_mask=head_mask, <ide> inputs_embeds=inputs_embeds, <ide> def call( <ide> flat_attention_mask = ( <ide> tf.reshape(inputs["attention_mask"], (-1, seq_length)) if inputs["attention_mask"] is not None else None <ide> ) <del> flat_token_type_ids = ( <del> tf.reshape(inputs["token_type_ids"], (-1, seq_length)) if inputs["token_type_ids"] is not None else None <del> ) <ide> flat_position_ids = ( <ide> tf.reshape(inputs["position_ids"], (-1, seq_length)) if inputs["position_ids"] is not None else None <ide> ) <ide> def call( <ide> outputs = self.mpnet( <ide> flat_input_ids, <ide> flat_attention_mask, <del> flat_token_type_ids, <ide> flat_position_ids, <ide> inputs["head_mask"], <ide> flat_inputs_embeds, <ide> def call( <ide> self, <ide> input_ids=None, <ide> attention_mask=None, <del> token_type_ids=None, <ide> position_ids=None, <ide> head_mask=None, <ide> inputs_embeds=None, <ide> def call( <ide> Labels for computing the token classification loss. Indices should be in ``[0, ..., config.num_labels - <ide> 1]``. <ide> """ <add> <ide> inputs = input_processing( <ide> func=self.call, <ide> config=self.config, <ide> input_ids=input_ids, <ide> attention_mask=attention_mask, <del> token_type_ids=token_type_ids, <ide> position_ids=position_ids, <ide> head_mask=head_mask, <ide> inputs_embeds=inputs_embeds, <ide> def call( <ide> outputs = self.mpnet( <ide> input_ids=inputs["input_ids"], <ide> attention_mask=inputs["attention_mask"], <del> token_type_ids=inputs["token_type_ids"], <ide> position_ids=inputs["position_ids"], <ide> head_mask=inputs["head_mask"], <ide> inputs_embeds=inputs["inputs_embeds"], <ide> def call( <ide> self, <ide> input_ids=None, <ide> attention_mask=None, <del> token_type_ids=None, <ide> position_ids=None, <ide> head_mask=None, <ide> inputs_embeds=None, <ide> def call( <ide> Positions are clamped to the length of the sequence (:obj:`sequence_length`). Position outside of the <ide> sequence are not taken into account for computing the loss. <ide> """ <add> <ide> inputs = input_processing( <ide> func=self.call, <ide> config=self.config, <ide> input_ids=input_ids, <ide> attention_mask=attention_mask, <del> token_type_ids=token_type_ids, <ide> position_ids=position_ids, <ide> head_mask=head_mask, <ide> inputs_embeds=inputs_embeds, <ide> def call( <ide> outputs = self.mpnet( <ide> inputs["input_ids"], <ide> attention_mask=inputs["attention_mask"], <del> token_type_ids=inputs["token_type_ids"], <ide> position_ids=inputs["position_ids"], <ide> head_mask=inputs["head_mask"], <ide> inputs_embeds=inputs["inputs_embeds"], <ide><path>src/transformers/models/mpnet/tokenization_mpnet.py <ide> class MPNetTokenizer(PreTrainedTokenizer): <ide> pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP <ide> pretrained_init_configuration = PRETRAINED_INIT_CONFIGURATION <ide> max_model_input_sizes = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES <add> model_input_names = ["attention_mask"] <ide> <ide> def __init__( <ide> self, <ide><path>src/transformers/models/mpnet/tokenization_mpnet_fast.py <ide> class MPNetTokenizerFast(PreTrainedTokenizerFast): <ide> pretrained_init_configuration = PRETRAINED_INIT_CONFIGURATION <ide> max_model_input_sizes = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES <ide> slow_tokenizer_class = MPNetTokenizer <add> model_input_names = ["attention_mask"] <ide> <ide> def __init__( <ide> self,
4
Javascript
Javascript
update chrome.tabs.executescriptinframe dependency
18e4d32c114014af4d6aae215c635fd2560c6ee6
<ide><path>extensions/chromium/chrome.tabs.executeScriptInFrame.js <ide> var callbacks = {}; <ide> <ide> chrome.webRequest.onBeforeRequest.addListener(function showFrameId(details) { <ide> // Positive integer frameId >= 0 <del> // Since an image is used as a data transport, we add 1 to get a non-zero height. <add> // Since an image is used as a data transport, we add 1 to get a non-zero width. <ide> var frameId = details.frameId + 1; <del> // Assume that the frameId fits in two bytes - which is a very reasonable assumption. <del> var width = String.fromCharCode(frameId & 0xFF, frameId & 0xFF00); <del> var height = '\x01\x00'; <add> // Assume that the frameId fits in three bytes - which is a very reasonable assumption. <add> var width = String.fromCharCode(frameId & 0xFF, (frameId >> 8) & 0xFF); <add> // When frameId > 0xFFFF, use the height to convey the additional information. <add> // Again, add 1 to make sure that the height is non-zero. <add> var height = String.fromCharCode((frameId >> 16) + 1, 0); <ide> // Convert data to base64 to avoid loss of bytes <ide> var image = 'data:image/gif;base64,' + btoa( <ide> // 4749 4638 3961 (GIF header) <ide> var DETECT_FRAME = '' + function checkFrame(window, identifier, frameId, code) { <ide> // Do NOT use new Image(), because of http://crbug.com/245296 in Chrome 27-29 <ide> i = window.document.createElement('img'); <ide> i.onload = function() { <del> window.__executeScript_frameId__ = this.naturalWidth - 1; <add> window.__executeScript_frameId__ = (this.naturalWidth - 1) + <add> (this.naturalHeight - 1 << 16); <ide> evalAsContentScript(); <ide> }; <ide> // Trigger webRequest event to get frameId
1
Text
Text
add the description
8192a989afc251788c471b2b81acadd8d5b97d99
<ide><path>guide/russian/css/css-position/index.md <ide> localeTitle: Позиция CSS <ide> Свойство position указывает тип метода позиционирования, используемый для элемента. Он имеет 5 значений ключевых слов: <ide> <ide> ```css <del>.static { position: static; } // default value <del> .relative { position: relative; } <del> .sticky { position: sticky; } <del> .fixed { position: fixed; } <del> .absolute { position: absolute; } <add>.static { position: static; } // Элементы отображаются как обычно. <add> .relative { position: relative; } // Положение элемента устанавливается относительно его начального места. <add> .sticky { position: sticky; } <add> .fixed { position: fixed; } // Привязывается к указанной точке на экране и не меняет своего положения даже при пролистывании веб-страницы. <add> .absolute { position: absolute; } // Указывает, что элемент абсолютно позиционирован. Положение элемента задается атрибутами left, top, right и bottom относительно края окна браузера. <ide> ``` <ide> <ide> ### Дополнительная информация: <ide> MDN Документация: [MDN](https://developer.mozilla.org/en-US/docs/Web <ide> <ide> Поддержка браузера: [caniuse](http://caniuse.com/#search=position) <ide> <del>YouTube: [Part1](https://www.youtube.com/watch?v=kejG8G0dr5U) | [Часть 2](https://www.youtube.com/watch?v=Rf6zAP4YnZA) <ide>\ No newline at end of file <add>YouTube: [Part1](https://www.youtube.com/watch?v=kejG8G0dr5U) | [Часть 2](https://www.youtube.com/watch?v=Rf6zAP4YnZA)
1
PHP
PHP
make use of the instance config trait
b81ebffeb4b207f36a675433b6ccd218228b53c0
<ide><path>src/Controller/Component.php <ide> */ <ide> namespace Cake\Controller; <ide> <add>use Cake\Core\InstanceConfigTrait; <ide> use Cake\Core\Object; <ide> use Cake\Event\Event; <ide> use Cake\Event\EventListener; <ide> */ <ide> class Component extends Object implements EventListener { <ide> <add> use InstanceConfigTrait; <add> <ide> /** <ide> * Component registry class used to lazy load components. <ide> * <ide> class Component extends Object implements EventListener { <ide> */ <ide> public $components = array(); <ide> <del>/** <del> * Runtime config for this Component <del> * <del> * @var array <del> */ <del> protected $_config = []; <del> <ide> /** <ide> * Default config <ide> * <ide> class Component extends Object implements EventListener { <ide> public function __construct(ComponentRegistry $registry, $config = []) { <ide> $this->_registry = $registry; <ide> <del> $this->_config = array_merge($this->_defaultConfig, $config); <add> $this->config($config); <ide> <del> $this->_set($this->_config); //@TODO get rid of public properties and remove this <add> $this->_set($this->config()); //@TODO get rid of public properties and remove this <ide> <ide> if (!empty($this->components)) { <ide> $this->_componentMap = $registry->normalizeArray($this->components); <ide> public function __get($name) { <ide> } <ide> } <ide> <del>/** <del> * Component config getter and setter <del> * <del> * Usage: <del> * {{{ <del> * $instance->config(); will return full config <del> * $instance->config('foo'); will return configured foo <del> * $instance->config('notset'); will return null <del> * $instance->config('foo', $x); will set ['foo' $x] to the existing config <del> * $instance->config('foo.bar', $x); will set/add ['foo' => ['bar' => $x]] to the existing config <del> * }}} <del> * <del> * @param string|null $key to return <del> * @param mixed $val value to set <del> * @return mixed array or config value <del> */ <del> public function config($key = null, $val = null) { <del> if ($key === null) { <del> return $this->_config; <del> } <del> <del> if ($val !== null) { <del> return $this->_configSet([$key => $val]); <del> } elseif (is_array($key)) { <del> return $this->_configSet($key); <del> } <del> <del> return array_key_exists($key, $this->_config) ? $this->_config[$key] : null; <del> } <del> <del>/** <del> * Update config with passed argument <del> * <del> * Overriden in subclasses if the component config shouldn't be modified at runtime <del> * <del> * @param array $config <del> * @return void <del> */ <del> protected function _configSet($config) { <del> foreach ($config as $key => $val) { <del> if (strpos($key, '.')) { <del> $this->_config = Hash::insert($this->_config, $key, $val); <del> } else { <del> $this->_config[$key] = $val; <del> } <del> } <del> } <del> <ide> /** <ide> * Get the Controller callbacks this Component is interested in. <ide> * <ide><path>src/Controller/Component/Auth/AbstractPasswordHasher.php <ide> */ <ide> namespace Cake\Controller\Component\Auth; <ide> <add>use Cake\Core\InstanceConfigTrait; <add> <ide> /** <ide> * Abstract password hashing class <ide> * <ide> */ <ide> abstract class AbstractPasswordHasher { <ide> <del>/** <del> * Runtime config for this object <del> * <del> * @var array <del> */ <del> protected $_config = array(); <add> use InstanceConfigTrait; <ide> <ide> /** <ide> * Default config <ide> abstract class AbstractPasswordHasher { <ide> * @param array $config Array of config. <ide> */ <ide> public function __construct($config = array()) { <del> $this->_config = array_merge($this->_defaultConfig, $config); <del> } <del> <del>/** <del> * config getter and setter <del> * <del> * Usage: <del> * {{{ <del> * $instance->config(); will return full config <del> * $instance->config('foo'); will return configured foo <del> * $instance->config('notset'); will return null <del> * }}} <del> * <del> * @param string|null $key to return <del> * @return mixed array or config value <del> */ <del> public function config($key = null) { <del> if ($key === null) { <del> return $this->_config; <del> } <del> <del> return array_key_exists($key, $this->_config) ? $this->_config[$key] : null; <add> $this->config($config); <ide> } <ide> <ide> /** <ide><path>src/Controller/Component/Auth/BaseAuthenticate.php <ide> use Cake\Controller\ComponentRegistry; <ide> use Cake\Controller\Component\Auth\AbstractPasswordHasher; <ide> use Cake\Core\App; <add>use Cake\Core\InstanceConfigTrait; <ide> use Cake\Error; <ide> use Cake\Network\Request; <ide> use Cake\Network\Response; <ide> */ <ide> abstract class BaseAuthenticate { <ide> <del>/** <del> * Runtime config for this object <del> * <del> * @var array <del> */ <del> protected $_config = []; <add> use InstanceConfigTrait; <ide> <ide> /** <ide> * Default config for this object. <ide> abstract class BaseAuthenticate { <ide> */ <ide> public function __construct(ComponentRegistry $registry, $config) { <ide> $this->_registry = $registry; <del> $this->_config = Hash::merge($this->_defaultConfig, $config); <add> $this->config($config); <ide> } <ide> <ide> /** <ide> protected function _findUser($username, $password = null) { <ide> return $result; <ide> } <ide> <del>/** <del> * config getter and setter <del> * <del> * Usage: <del> * {{{ <del> * $instance->config(); will return full config <del> * $instance->config('foo'); will return configured foo <del> * $instance->config('notset'); will return null <del> * }}} <del> * <del> * @param string|null $key to return <del> * @param mixed $val value to set <del> * @return mixed array or config value <del> */ <del> public function config($key = null, $val = null) { <del> if ($key === null) { <del> return $this->_config; <del> } <del> <del> if ($val !== null) { <del> return $this->_configSet([$key => $val]); <del> } elseif (is_array($key)) { <del> return $this->_configSet($key); <del> } <del> <del> return Hash::get($this->_config, $key); <del> } <del> <del>/** <del> * Update config with passed argument <del> * <del> * @param array $config <del> * @return void <del> */ <del> protected function _configSet($config) { <del> foreach ($config as $key => $val) { <del> if (strpos($key, '.')) { <del> $this->_config = Hash::insert($this->_config, $key, $val); <del> } else { <del> $this->_config[$key] = $val; <del> } <del> } <del> } <del> <ide> /** <ide> * Return password hasher object <ide> * <ide><path>src/Controller/Component/Auth/BaseAuthorize.php <ide> <ide> use Cake\Controller\ComponentRegistry; <ide> use Cake\Controller\Controller; <add>use Cake\Core\InstanceConfigTrait; <ide> use Cake\Error; <ide> use Cake\Network\Request; <ide> use Cake\Network\Response; <ide> */ <ide> abstract class BaseAuthorize { <ide> <add> use InstanceConfigTrait; <add> <ide> /** <ide> * Controller for the request. <ide> * <ide> abstract class BaseAuthorize { <ide> */ <ide> protected $_registry; <ide> <del>/** <del> * Runtime config for this object <del> * <del> * @var array <del> */ <del> protected $_config = []; <del> <ide> /** <ide> * Default config for authorize objects. <ide> * <ide> public function __construct(ComponentRegistry $registry, $config = array()) { <ide> $this->_registry = $registry; <ide> $controller = $registry->getController(); <ide> $this->controller($controller); <del> $this->_config = Hash::merge($this->_defaultConfig, $config); <add> $this->config($config); <ide> } <ide> <ide> /** <ide> public function __construct(ComponentRegistry $registry, $config = array()) { <ide> */ <ide> abstract public function authorize($user, Request $request); <ide> <del>/** <del> * config getter and setter <del> * <del> * Usage: <del> * {{{ <del> * $instance->config(); will return full config <del> * $instance->config('foo'); will return configured foo <del> * $instance->config('notset'); will return null <del> * }}} <del> * <del> * @param string|null $key to return <del> * @param mixed $val value to set <del> * @return mixed array or config value <del> */ <del> public function config($key = null, $val = null) { <del> if ($key === null) { <del> return $this->_config; <del> } <del> <del> if ($val !== null) { <del> return $this->_configSet([$key => $val]); <del> } elseif (is_array($key)) { <del> return $this->_configSet($key); <del> } <del> <del> return Hash::get($this->_config, $key); <del> } <del> <del>/** <del> * Update config with passed argument <del> * <del> * @param array $config <del> * @return void <del> */ <del> protected function _configSet($config) { <del> foreach ($config as $key => $val) { <del> if (strpos($key, '.')) { <del> $this->_config = Hash::insert($this->_config, $key, $val); <del> } else { <del> $this->_config[$key] = $val; <del> } <del> } <del> } <del> <ide> /** <ide> * Accessor to the controller object. <ide> * <ide><path>src/Controller/Component/Auth/CrudAuthorize.php <ide> protected function _setPrefixMappings() { <ide> * @return boolean <ide> */ <ide> public function authorize($user, Request $request) { <del> if (!isset($this->_config['actionMap'][$request->params['action']])) { <add> $mapped = $this->config('actionMap.' . $request->params['action']); <add> <add> if (!$mapped) { <ide> trigger_error(sprintf( <ide> 'CrudAuthorize::authorize() - Attempted access of un-mapped action "%1$s" in controller "%2$s"', <ide> $request->action, <ide> public function authorize($user, Request $request) { <ide> ); <ide> return false; <ide> } <del> $user = array($this->_config['userModel'] => $user); <add> $user = array($this->config('userModel') => $user); <ide> $Acl = $this->_registry->load('Acl'); <ide> return $Acl->check( <ide> $user, <ide> $this->action($request, ':controller'), <del> $this->_config['actionMap'][$request->params['action']] <add> $mapped <ide> ); <ide> } <ide> <ide><path>src/Controller/Component/Auth/DigestAuthenticate.php <ide> public function getUser(Request $request) { <ide> return false; <ide> } <ide> <del> $field = $this->_config['fields']['password']; <add> $field = $this->config('fields.password'); <ide> $password = $user[$field]; <ide> unset($user[$field]); <ide> <ide><path>src/Controller/Component/Auth/SimplePasswordHasher.php <ide> class SimplePasswordHasher extends AbstractPasswordHasher { <ide> <ide> /** <del> * Config for this object. <add> * Default config for this object. <ide> * <ide> * @var array <ide> */ <del> protected $_config = array('hashType' => null); <add> protected $_defaultConfig = [ <add> 'hashType' => null <add> ]; <ide> <ide> /** <ide> * Generates password hash. <ide> class SimplePasswordHasher extends AbstractPasswordHasher { <ide> * @link http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#hashing-passwords <ide> */ <ide> public function hash($password) { <del> return Security::hash($password, $this->_config['hashType'], true); <add> return Security::hash($password, $this->config('hashType'), true); <ide> } <ide> <ide> /**
7
Text
Text
add the syntax
f6494ac55535e82da85b996072b4ed42afba0508
<ide><path>guide/english/html/attributes/a-target-attribute/index.md <ide> title: A Target Attribute <ide> The `<a target>` attribute specifies where to open the linked document in an `a` (anchor) tag. <ide> <br> <ide> <add>#### Syntax <add> <add>```html <add> <a target="_blank|_self|_parent|_top|framname"> <add>``` <add> <ide> #### Examples: <ide> <ide>
1
Text
Text
add docs for router.back and router.reload
960c18da53af89115c7e96dc8188646a51c53c15
<ide><path>docs/api-reference/next/router.md <ide> Router.beforePopState(({ url, as, options }) => { <ide> <ide> If the function you pass into `beforePopState` returns `false`, `Router` will not handle `popstate` and you'll be responsible for handling it, in that case. See [Disabling file-system routing](/docs/advanced-features/custom-server.md#disabling-file-system-routing). <ide> <add>### Router.back <add> <add>Navigate back in history, equivalent to clicking the back button. It executes `window.history.back()`. <add> <add>```jsx <add>import Router from 'next/router' <add> <add>Router.back() <add>``` <add> <add>### Router.reload <add> <add>Reload the current URL, equivalent to clicking the refresh button. It executes `window.location.reload()`. <add> <add>```jsx <add>import Router from 'next/router' <add> <add>Router.reload() <add>``` <add> <ide> ### Router.events <ide> <ide> <details>
1
Go
Go
add wait() calls in the appropriate spots
92e41a02ce40c7d3446b8ca7ec5c5671ac3d8917
<ide><path>daemon/container.go <ide> func (container *Container) Stop(seconds int) error { <ide> log.Printf("Container %v failed to exit within %d seconds of SIGTERM - using the force", container.ID, seconds) <ide> // 3. If it doesn't, then send SIGKILL <ide> if err := container.Kill(); err != nil { <add> container.Wait() <ide> return err <ide> } <ide> } <ide><path>daemon/execdriver/lxc/driver.go <ide> func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba <ide> if err != nil { <ide> if c.Process != nil { <ide> c.Process.Kill() <add> c.Process.Wait() <ide> } <ide> return -1, err <ide> } <ide><path>pkg/libcontainer/nsinit/exec.go <ide> func Exec(container *libcontainer.Container, term Terminal, rootfs, dataPath str <ide> } <ide> <ide> command := createCommand(container, console, rootfs, dataPath, os.Args[0], syncPipe.child, args) <add> <ide> if err := term.Attach(command); err != nil { <add> command.Wait() <ide> return -1, err <ide> } <ide> defer term.Close() <ide> func Exec(container *libcontainer.Container, term Terminal, rootfs, dataPath str <ide> } <ide> if err := WritePid(dataPath, command.Process.Pid, started); err != nil { <ide> command.Process.Kill() <add> command.Process.Wait() <ide> return -1, err <ide> } <ide> defer DeletePid(dataPath) <ide> func Exec(container *libcontainer.Container, term Terminal, rootfs, dataPath str <ide> cleaner, err := SetupCgroups(container, command.Process.Pid) <ide> if err != nil { <ide> command.Process.Kill() <add> command.Process.Wait() <ide> return -1, err <ide> } <ide> if cleaner != nil { <ide> func Exec(container *libcontainer.Container, term Terminal, rootfs, dataPath str <ide> <ide> if err := InitializeNetworking(container, command.Process.Pid, syncPipe); err != nil { <ide> command.Process.Kill() <add> command.Process.Wait() <ide> return -1, err <ide> } <ide> <ide><path>pkg/libcontainer/nsinit/init.go <ide> func RestoreParentDeathSignal(old int) error { <ide> // Signal self if parent is already dead. Does nothing if running in a new <ide> // PID namespace, as Getppid will always return 0. <ide> if syscall.Getppid() == 1 { <del> return syscall.Kill(syscall.Getpid(), syscall.Signal(old)) <add> err := syscall.Kill(syscall.Getpid(), syscall.Signal(old)) <add> syscall.Wait4(syscall.Getpid(), nil, 0, nil) <add> return err <ide> } <ide> <ide> return nil
4
Ruby
Ruby
support jruby external dependencies
cfc8fca74d642d5b09d8b45a802f3114948ed32f
<ide><path>Library/Homebrew/formula.rb <ide> def aka *args <ide> <ide> def depends_on name <ide> @deps ||= [] <del> @external_deps ||= {:python => [], :ruby => [], :perl => []} <add> @external_deps ||= {:python => [], :perl => [], :ruby => [], :jruby => []} <ide> <ide> case name <ide> when String <ide> # noop <ide> when Hash <ide> key, value = name.shift <ide> case value <del> when :python, :ruby, :perl <add> when :python, :perl, :ruby, :jruby <ide> @external_deps[value] << key <ide> return <ide> when :optional, :recommended <ide><path>Library/Homebrew/formula_installer.rb <ide> def rberr dep; <<-EOS <ide> gem install #{dep} <ide> EOS <ide> end <add> def jrberr dep; <<-EOS <add>Unsatisfied dependency "#{dep}" <add>Homebrew does not provide formulae for JRuby dependencies, rubygems does: <add> <add> jruby -S gem install #{dep} <add> EOS <add> end <ide> <ide> def check_external_deps f <ide> return unless f.external_deps <ide> def check_external_deps f <ide> f.external_deps[:ruby].each do |dep| <ide> raise rberr(dep) unless quiet_system "/usr/bin/env", "ruby", "-rubygems", "-e", "require '#{dep}'" <ide> end <add> f.external_deps[:jruby].each do |dep| <add> raise rberr(dep) unless quiet_system "/usr/bin/env", "jruby", "-rubygems", "-e", "require '#{dep}'" <add> end <ide> end <ide> <ide> def check_formula_deps f <ide><path>Library/Homebrew/test/test_external_deps.rb <ide> def plerr dep <ide> def rberr dep <ide> "Ruby module install message." <ide> end <add> <add> def jrberr dep <add> "JRuby module install message." <add> end <ide> end <ide> <ide> <ide> def initialize name=nil <ide> end <ide> end <ide> <add>class BadJRubyBall <TestBall <add> depends_on "notapackage" => :jruby <add> <add> def initialize name=nil <add> super "uses_jruby_ball" <add> end <add>end <add> <add>class GoodJRubyBall <TestBall <add> depends_on "date" => :jruby <add> <add> def initialize name=nil <add> super "uses_jruby_ball" <add> end <add>end <add> <ide> <ide> class ExternalDepsTests < Test::Unit::TestCase <ide> def check_deps_fail f <ide> def test_bad_ruby_deps <ide> def test_good_ruby_deps <ide> check_deps_pass GoodRubyBall <ide> end <add> <add> # Only run these next two tests if jruby is installed. <add> def test_bad_jruby_deps <add> check_deps_fail BadJRubyBall unless `/usr/bin/which jruby`.chomp.empty? <add> end <add> <add> def test_good_jruby_deps <add> check_deps_pass GoodJRubyBall unless `/usr/bin/which jruby`.chomp.empty? <add> end <ide> end
3
Go
Go
fix port forwarding with ipv6.disable=1
325668315cef185fcec282fc67ed96b753c339c2
<ide><path>libnetwork/drivers/bridge/port_mapping.go <ide> import ( <ide> "errors" <ide> "fmt" <ide> "net" <add> "sync" <ide> <ide> "github.com/docker/libnetwork/types" <ide> "github.com/ishidawataru/sctp" <ide> func (n *bridgeNetwork) allocatePortsInternal(bindings []types.PortBinding, cont <ide> bs = append(bs, bIPv4) <ide> } <ide> <add> // skip adding implicit v6 addr, when the kernel was booted with `ipv6.disable=1` <add> // https://github.com/moby/moby/issues/42288 <add> isV6Binding := c.HostIP != nil && c.HostIP.To4() == nil <add> if !isV6Binding && !IsV6Listenable() { <add> continue <add> } <add> <ide> // Allocate IPv6 Port mappings <ide> // If the container has no IPv6 address, allow proxying host IPv6 traffic to it <ide> // by setting up the binding with the IPv4 interface if the userland proxy is enabled <ide> func (n *bridgeNetwork) releasePort(bnd types.PortBinding) error { <ide> <ide> return portmapper.Unmap(host) <ide> } <add> <add>var ( <add> v6ListenableCached bool <add> v6ListenableOnce sync.Once <add>) <add> <add>// IsV6Listenable returns true when `[::1]:0` is listenable. <add>// IsV6Listenable returns false mostly when the kernel was booted with `ipv6.disable=1` option. <add>func IsV6Listenable() bool { <add> v6ListenableOnce.Do(func() { <add> ln, err := net.Listen("tcp6", "[::1]:0") <add> if err != nil { <add> // When the kernel was booted with `ipv6.disable=1`, <add> // we get err "listen tcp6 [::1]:0: socket: address family not supported by protocol" <add> // https://github.com/moby/moby/issues/42288 <add> logrus.Debugf("port_mapping: v6Listenable=false (%v)", err) <add> } else { <add> v6ListenableCached = true <add> ln.Close() <add> } <add> }) <add> return v6ListenableCached <add>} <ide><path>libnetwork/libnetwork_test.go <ide> import ( <ide> "github.com/docker/libnetwork/config" <ide> "github.com/docker/libnetwork/datastore" <ide> "github.com/docker/libnetwork/driverapi" <add> "github.com/docker/libnetwork/drivers/bridge" <ide> "github.com/docker/libnetwork/ipamapi" <ide> "github.com/docker/libnetwork/netlabel" <ide> "github.com/docker/libnetwork/options" <ide> func TestBridge(t *testing.T) { <ide> if !ok { <ide> t.Fatalf("Unexpected format for port mapping in endpoint operational data") <ide> } <del> if len(pm) != 10 { <add> expectedLen := 10 <add> if !bridge.IsV6Listenable() { <add> expectedLen = 5 <add> } <add> if len(pm) != expectedLen { <ide> t.Fatalf("Incomplete data for port mapping in endpoint operational data: %d", len(pm)) <ide> } <ide> }
2
Text
Text
fix time documentation
ca9d3175c5fa9da69434cf7ed40b299fd221b667
<ide><path>docs/axes/cartesian/time.md <ide> The time scale is used to display times and dates. When building its ticks, it w <ide> <ide> ### Input Data <ide> <del>The x-axis data points may additionally be specified via the `t` attribute when using the time scale. <add>The x-axis data points may additionally be specified via the `t` or `x` attribute when using the time scale. <ide> <ide> data: [{ <ide> x: new Date(), <ide> var chart = new Chart(ctx, { <ide> options: { <ide> scales: { <ide> xAxes: [{ <add> type: 'time', <ide> time: { <ide> unit: 'month' <ide> }
1
Python
Python
preserve types of empty arrays when known
24960daf3e326591047eb099af840da6e95d0910
<ide><path>numpy/lib/index_tricks.py <ide> def ix_(*args): <ide> out = [] <ide> nd = len(args) <ide> for k, new in enumerate(args): <del> new = asarray(new) <add> if not isinstance(new, _nx.ndarray): <add> new = asarray(new) <add> if new.size == 0: <add> # Explicitly type empty arrays to avoid float default <add> new = new.astype(_nx.intp) <ide> if new.ndim != 1: <ide> raise ValueError("Cross index must be 1 dimensional") <del> if new.size == 0: <del> # Explicitly type empty arrays to avoid float default <del> new = new.astype(_nx.intp) <ide> if issubdtype(new.dtype, _nx.bool_): <ide> new, = new.nonzero() <ide> new = new.reshape((1,)*k + (new.size,) + (1,)*(nd-k-1)) <ide><path>numpy/lib/tests/test_index_tricks.py <ide> def test_simple_1(self): <ide> <ide> class TestIx_(TestCase): <ide> def test_regression_1(self): <del> # Test empty inputs create ouputs of indexing type, gh-5804 <del> # Test both lists and arrays <del> for func in (range, np.arange): <del> a, = np.ix_(func(0)) <del> assert_equal(a.dtype, np.intp) <add> # Test empty untyped inputs create ouputs of indexing type, gh-5804 <add> a, = np.ix_(range(0)) <add> assert_equal(a.dtype, np.intp) <add> <add> a, = np.ix_([]) <add> assert_equal(a.dtype, np.intp) <add> <add> # but if the type is specified, don't change it <add> a, = np.ix_(np.array([], dtype=np.float32)) <add> assert_equal(a.dtype, np.float32) <ide> <ide> def test_shape_and_dtype(self): <ide> sizes = (4, 5, 3, 2)
2
Javascript
Javascript
pass disabled prop down to native implementation
fa9ff07017edbc76595fe2f2d964ee13c5f4088a
<ide><path>Libraries/Components/Slider/Slider.js <ide> const Slider = ( <ide> return ( <ide> <SliderNativeComponent <ide> {...localProps} <add> // TODO: Reconcile these across the two platforms. <ide> enabled={!disabled} <add> disabled={disabled} <ide> maximumValue={maximumValue} <ide> minimumValue={minimumValue} <ide> onChange={onChangeEvent}
1
Text
Text
fix minor typo
672e5a0f96c4e860f4eeee85f9cd26c8c4070d63
<ide><path>docs/api-guide/fields.md <ide> This field is used by default with `ModelSerializer` when including field names <ide> <ide> **Signature**: `ReadOnlyField()` <ide> <del>For example, is `has_expired` was a property on the `Account` model, then the following serializer would automatically generate it as a `ReadOnlyField`: <add>For example, if `has_expired` was a property on the `Account` model, then the following serializer would automatically generate it as a `ReadOnlyField`: <ide> <ide> class AccountSerializer(serializers.ModelSerializer): <ide> class Meta:
1
Javascript
Javascript
add regression test for keepalive 'end' event
b3172f834f418f4f2656d851e585f17aece73333
<ide><path>test/parallel/test-http-server-keepalive-end.js <add>'use strict'; <add> <add>const common = require('../common'); <add>const { createServer } = require('http'); <add>const { connect } = require('net'); <add> <add>const server = createServer(common.mustCall((req, res) => { <add> req.on('end', common.mustCall()); <add> res.end('hello world'); <add>})); <add> <add>server.unref(); <add> <add>server.listen(0, common.mustCall(() => { <add> <add> const client = connect(server.address().port); <add> <add> const req = [ <add> 'POST / HTTP/1.1', <add> `Host: localhost:${server.address().port}`, <add> 'Connection: keep-alive', <add> 'Content-Length: 11', <add> '', <add> 'hello world', <add> '' <add> ].join('\r\n'); <add> <add> client.end(req); <add>}));
1
Javascript
Javascript
fix concat error message
4f094c0ae60beb8a3eb569a6a2d8c608bff1dbeb
<ide><path>lib/buffer.js <ide> Buffer[kIsEncodingSymbol] = Buffer.isEncoding; <ide> Buffer.concat = function concat(list, length) { <ide> let i; <ide> if (!Array.isArray(list)) { <del> throw new ERR_INVALID_ARG_TYPE( <del> 'list', ['Array', 'Buffer', 'Uint8Array'], list); <add> throw new ERR_INVALID_ARG_TYPE('list', 'Array', list); <ide> } <ide> <ide> if (list.length === 0) <ide><path>test/parallel/test-buffer-concat.js <ide> assert.strictEqual(flatLongLen.toString(), check); <ide> Buffer.concat(value); <ide> }, { <ide> code: 'ERR_INVALID_ARG_TYPE', <del> message: 'The "list" argument must be one of type Array, Buffer, ' + <del> `or Uint8Array. Received type ${typeof value}` <add> message: 'The "list" argument must be of type Array. ' + <add> `Received type ${typeof value}` <ide> }); <ide> }); <ide>
2
PHP
PHP
add fallback_locale to config
b5d60260fbf7fe1b0592b127dbf4e8082962897f
<ide><path>app/config/app.php <ide> <ide> 'locale' => 'en', <ide> <add> /* <add> |-------------------------------------------------------------------------- <add> | Application Fallback Locale <add> |-------------------------------------------------------------------------- <add> | <add> | The fallback locale determines the locale to use when the current one <add> | is not available. You may change the value to correspond to any of <add> | the language folders that are provided through your application. <add> | <add> */ <add> <add> 'fallback_locale' => 'en', <add> <ide> /* <ide> |-------------------------------------------------------------------------- <ide> | Encryption Key
1
Python
Python
fix deprecation messages in airflow.utils.helpers
583f21304021cf95121168b4e6d9872ba7e25452
<ide><path>airflow/utils/helpers.py <ide> def partition(pred: Callable, iterable: Iterable): <ide> <ide> <ide> def chain(*args, **kwargs): <del> """This module is deprecated. Please use `airflow.models.baseoperator.chain`.""" <add> """This function is deprecated. Please use `airflow.models.baseoperator.chain`.""" <ide> warnings.warn( <del> "This module is deprecated. Please use `airflow.models.baseoperator.chain`.", <add> "This function is deprecated. Please use `airflow.models.baseoperator.chain`.", <ide> DeprecationWarning, stacklevel=2 <ide> ) <ide> return import_string('airflow.models.baseoperator.chain')(*args, **kwargs) <ide> <ide> <ide> def cross_downstream(*args, **kwargs): <del> """This module is deprecated. Please use `airflow.models.baseoperator.cross_downstream`.""" <add> """This function is deprecated. Please use `airflow.models.baseoperator.cross_downstream`.""" <ide> warnings.warn( <del> "This module is deprecated. Please use `airflow.models.baseoperator.cross_downstream`.", <add> "This function is deprecated. Please use `airflow.models.baseoperator.cross_downstream`.", <ide> DeprecationWarning, stacklevel=2 <ide> ) <ide> return import_string('airflow.models.baseoperator.cross_downstream')(*args, **kwargs)
1
Javascript
Javascript
reduce deplicated codes in `autoescapestr`
3cef3e61d647d3dd2107087d876a3a02e0c3961e
<ide><path>benchmark/url/url-parse.js <add>'use strict'; <add>const common = require('../common.js'); <add>const url = require('url'); <add> <add>const inputs = { <add> normal: 'http://foo.com/bar', <add> escaped: 'https://foo.bar/{}^`/abcd' <add>}; <add> <add>const bench = common.createBenchmark(main, { <add> type: Object.keys(inputs), <add> n: [1e7] <add>}); <add> <add>function main({ type, n }) { <add> const input = inputs[type] || ''; <add> <add> bench.start(); <add> for (var i = 0; i < n; i += 1) <add> url.parse(input); <add> bench.end(n); <add>} <ide><path>lib/url.js <ide> function validateHostname(self, rest, hostname) { <ide> } <ide> } <ide> <add>// Escaped characters. Use empty strings to fill up unused entries. <add>// Using Array is faster than Object/Map <add>const escapedCodes = [ <add> /*0 - 9*/ '', '', '', '', '', '', '', '', '', '%09', <add> /*10 - 19*/ '%0A', '', '', '%0D', '', '', '', '', '', '', <add> /*20 - 29*/ '', '', '', '', '', '', '', '', '', '', <add> /*30 - 39*/ '', '', '%20', '', '%22', '', '', '', '', '%27', <add> /*40 - 49*/ '', '', '', '', '', '', '', '', '', '', <add> /*50 - 59*/ '', '', '', '', '', '', '', '', '', '', <add> /*60 - 69*/ '%3C', '', '%3E', '', '', '', '', '', '', '', <add> /*70 - 79*/ '', '', '', '', '', '', '', '', '', '', <add> /*80 - 89*/ '', '', '', '', '', '', '', '', '', '', <add> /*90 - 99*/ '', '', '%5C', '', '%5E', '', '%60', '', '', '', <add> /*100 - 109*/ '', '', '', '', '', '', '', '', '', '', <add> /*110 - 119*/ '', '', '', '', '', '', '', '', '', '', <add> /*120 - 125*/ '', '', '', '%7B', '%7C', '%7D' <add>]; <add> <ide> // Automatically escape all delimiters and unwise characters from RFC 2396. <ide> // Also escape single quotes in case of an XSS attack. <ide> // Return the escaped string. <ide> function autoEscapeStr(rest) { <ide> var escaped = ''; <ide> var lastEscapedPos = 0; <ide> for (var i = 0; i < rest.length; ++i) { <del> // Manual switching is faster than using a Map/Object. <ide> // `escaped` contains substring up to the last escaped character. <del> switch (rest.charCodeAt(i)) { <del> case 9: // '\t' <del> // Concat if there are ordinary characters in the middle. <del> if (i > lastEscapedPos) <del> escaped += rest.slice(lastEscapedPos, i); <del> escaped += '%09'; <del> lastEscapedPos = i + 1; <del> break; <del> case 10: // '\n' <del> if (i > lastEscapedPos) <del> escaped += rest.slice(lastEscapedPos, i); <del> escaped += '%0A'; <del> lastEscapedPos = i + 1; <del> break; <del> case 13: // '\r' <del> if (i > lastEscapedPos) <del> escaped += rest.slice(lastEscapedPos, i); <del> escaped += '%0D'; <del> lastEscapedPos = i + 1; <del> break; <del> case 32: // ' ' <del> if (i > lastEscapedPos) <del> escaped += rest.slice(lastEscapedPos, i); <del> escaped += '%20'; <del> lastEscapedPos = i + 1; <del> break; <del> case 34: // '"' <del> if (i > lastEscapedPos) <del> escaped += rest.slice(lastEscapedPos, i); <del> escaped += '%22'; <del> lastEscapedPos = i + 1; <del> break; <del> case 39: // '\'' <del> if (i > lastEscapedPos) <del> escaped += rest.slice(lastEscapedPos, i); <del> escaped += '%27'; <del> lastEscapedPos = i + 1; <del> break; <del> case 60: // '<' <del> if (i > lastEscapedPos) <del> escaped += rest.slice(lastEscapedPos, i); <del> escaped += '%3C'; <del> lastEscapedPos = i + 1; <del> break; <del> case 62: // '>' <del> if (i > lastEscapedPos) <del> escaped += rest.slice(lastEscapedPos, i); <del> escaped += '%3E'; <del> lastEscapedPos = i + 1; <del> break; <del> case 92: // '\\' <del> if (i > lastEscapedPos) <del> escaped += rest.slice(lastEscapedPos, i); <del> escaped += '%5C'; <del> lastEscapedPos = i + 1; <del> break; <del> case 94: // '^' <del> if (i > lastEscapedPos) <del> escaped += rest.slice(lastEscapedPos, i); <del> escaped += '%5E'; <del> lastEscapedPos = i + 1; <del> break; <del> case 96: // '`' <del> if (i > lastEscapedPos) <del> escaped += rest.slice(lastEscapedPos, i); <del> escaped += '%60'; <del> lastEscapedPos = i + 1; <del> break; <del> case 123: // '{' <del> if (i > lastEscapedPos) <del> escaped += rest.slice(lastEscapedPos, i); <del> escaped += '%7B'; <del> lastEscapedPos = i + 1; <del> break; <del> case 124: // '|' <del> if (i > lastEscapedPos) <del> escaped += rest.slice(lastEscapedPos, i); <del> escaped += '%7C'; <del> lastEscapedPos = i + 1; <del> break; <del> case 125: // '}' <del> if (i > lastEscapedPos) <del> escaped += rest.slice(lastEscapedPos, i); <del> escaped += '%7D'; <del> lastEscapedPos = i + 1; <del> break; <add> var escapedChar = escapedCodes[rest.charCodeAt(i)]; <add> if (escapedChar) { <add> // Concat if there are ordinary characters in the middle. <add> if (i > lastEscapedPos) <add> escaped += rest.slice(lastEscapedPos, i); <add> escaped += escapedChar; <add> lastEscapedPos = i + 1; <ide> } <ide> } <ide> if (lastEscapedPos === 0) // Nothing has been escaped.
2
Ruby
Ruby
implement new bottle syntax in formula.rb
aa91bd27d20a34ca5337639c7e97d7a38e048bd7
<ide><path>Library/Homebrew/formula.rb <ide> def bottle url=nil, &block <ide> eval <<-EOCLASS <ide> module BottleData <ide> def self.url url; @url = url; end <del> def self.sha1 sha1; @sha1 = sha1; end <del> def self.return_data; [@url,@sha1]; end <add> def self.sha1 sha1 <add> case sha1 <add> when Hash <add> key, value = sha1.shift <add> @sha1 = key if value == MacOS.cat <add> when String <add> @sha1 = sha1 <add> end <add> end <add> def self.return_data <add> if @sha1 && @url <add> [@url,@sha1] <add> elsif @sha1 <add> [nil,@sha1] <add> end <add> end <ide> end <ide> EOCLASS <ide> BottleData.instance_eval &block <ide> @bottle_url, @bottle_sha1 = BottleData.return_data <add> @bottle_url ||= "https://downloads.sf.net/project/machomebrew/Bottles/#{name.downcase}-#{@version||@standard.detect_version}.bottle-#{MacOS.cat}.tar.gz" if @bottle_sha1 <ide> end <ide> end <ide>
1
PHP
PHP
improve missing template errors
78d6e1ba5fec5a5707453ed0685057cd57e8b533
<ide><path>src/View/Cell.php <ide> public function render(?string $template = null): string <ide> $attributes = $e->getAttributes(); <ide> throw new MissingCellTemplateException( <ide> $name, <del> basename($attributes['file']), <add> $attributes['file'], <ide> $attributes['paths'], <ide> null, <ide> $e <ide><path>src/View/Exception/MissingTemplateException.php <ide> public function __construct($file, array $paths = [], ?int $code = null, ?Throwa <ide> */ <ide> public function formatMessage(): string <ide> { <del> $message = "{$this->type} file '{$this->file}' could not be found."; <add> $message = "{$this->type} file `{$this->file}` could not be found."; <ide> if ($this->paths) { <ide> $message .= "\n\nThe following paths were searched:\n\n"; <ide> foreach ($this->paths as $path) { <del> $message .= "- {$path}\n"; <add> $message .= "- `{$path}{$this->file}`\n"; <ide> } <ide> } <ide> <ide><path>src/View/View.php <ide> public function element(string $name, array $data = [], array $options = []): st <ide> <ide> if (empty($options['ignoreMissing'])) { <ide> [$plugin] = $this->pluginSplit($name, $pluginCheck); <del> throw new MissingElementException($name, $this->_paths($plugin)); <add> $paths = iterator_to_array($this->getElementPaths($plugin)); <add> throw new MissingElementException($name . $this->_ext, $paths); <ide> } <ide> <ide> return ''; <ide> protected function _getLayoutFileName(?string $name = null): string <ide> } <ide> $name = $this->layout; <ide> } <add> [$plugin, $name] = $this->pluginSplit($name); <add> $name .= $this->_ext; <ide> <add> foreach ($this->getLayoutPaths($plugin) as $path) { <add> if (file_exists($path . $name)) { <add> return $this->_checkFilePath($path . $name, $path); <add> } <add> } <add> <add> $paths = iterator_to_array($this->getLayoutPaths($plugin)); <add> throw new MissingLayoutException($name, $paths); <add> } <add> <add> /** <add> * Get an iterator for layout paths. <add> * <add> * @param string|null $plugin The plugin to fetch paths for. <add> * @return \Generator <add> */ <add> protected function getLayoutPaths(?string $plugin) <add> { <ide> $subDir = ''; <ide> if ($this->layoutPath) { <ide> $subDir = $this->layoutPath . DIRECTORY_SEPARATOR; <ide> } <del> [$plugin, $name] = $this->pluginSplit($name); <del> <ide> $layoutPaths = $this->_getSubPaths(static::TYPE_LAYOUT . DIRECTORY_SEPARATOR . $subDir); <del> $name .= $this->_ext; <ide> <ide> foreach ($this->_paths($plugin) as $path) { <ide> foreach ($layoutPaths as $layoutPath) { <del> $currentPath = $path . $layoutPath; <del> if (file_exists($currentPath . $name)) { <del> return $this->_checkFilePath($currentPath . $name, $currentPath); <del> } <add> yield $path . $layoutPath; <ide> } <ide> } <del> <del> // Generate the searched paths so we can give a more helpful error. <del> $paths = []; <del> foreach ($this->_paths($plugin) as $path) { <del> foreach ($layoutPaths as $layoutPath) { <del> $paths[] = $path . $layoutPath; <del> } <del> } <del> throw new MissingLayoutException($name, $paths); <ide> } <ide> <ide> /** <ide> protected function _getElementFileName(string $name, bool $pluginCheck = true) <ide> { <ide> [$plugin, $name] = $this->pluginSplit($name, $pluginCheck); <ide> <del> $paths = $this->_paths($plugin); <del> $elementPaths = $this->_getSubPaths(static::TYPE_ELEMENT); <del> <del> foreach ($paths as $path) { <del> foreach ($elementPaths as $elementPath) { <del> if (file_exists($path . $elementPath . DIRECTORY_SEPARATOR . $name . $this->_ext)) { <del> return $path . $elementPath . DIRECTORY_SEPARATOR . $name . $this->_ext; <del> } <add> $name .= $this->_ext; <add> foreach ($this->getElementPaths($plugin) as $path) { <add> if (file_exists($path . $name)) { <add> return $path . $name; <ide> } <ide> } <ide> <ide> return false; <ide> } <ide> <add> /** <add> * Get an iterator for element paths. <add> * <add> * @param string|null $plugin The plugin to fetch paths for. <add> * @return \Generator <add> */ <add> protected function getElementPaths(?string $plugin) <add> { <add> $elementPaths = $this->_getSubPaths(static::TYPE_ELEMENT); <add> foreach ($this->_paths($plugin) as $path) { <add> foreach ($elementPaths as $subdir) { <add> yield $path . $subdir . DIRECTORY_SEPARATOR; <add> } <add> } <add> } <add> <ide> /** <ide> * Find all sub templates path, based on $basePath <ide> * If a prefix is defined in the current request, this method will prepend <ide><path>tests/TestCase/View/CellTest.php <ide> public function testCellManualRenderError() <ide> <ide> $this->assertNotNull($e); <ide> $message = $e->getMessage(); <del> $this->assertStringContainsString("Cell template file 'foo_bar.php' could not be found.", $message); <add> $this->assertStringContainsString( <add> str_replace(DS, '/', "Cell template file `cell/Articles/foo_bar.php` could not be found."), <add> $message <add> ); <ide> $this->assertStringContainsString('The following paths', $message); <ide> $this->assertStringContainsString(ROOT . DS . 'templates', $message); <ide> $this->assertInstanceOf(MissingTemplateException::class, $e->getPrevious()); <ide><path>tests/TestCase/View/ViewTest.php <ide> public function testGetLayoutFileNameDirectoryTraversal() <ide> public function testMissingTemplate() <ide> { <ide> $this->expectException(\Cake\View\Exception\MissingTemplateException::class); <del> $this->expectExceptionMessage("Template file 'does_not_exist' could not be found"); <add> $this->expectExceptionMessage("Template file `does_not_exist.php` could not be found"); <ide> $this->expectExceptionMessage('The following paths were searched'); <del> $this->expectExceptionMessage('- ' . ROOT . DS . 'templates'); <add> $this->expectExceptionMessage('- `' . ROOT . DS . 'templates' . DS . 'does_not_exist.php`'); <ide> $viewOptions = ['plugin' => null, <ide> 'name' => 'Pages', <ide> 'viewPath' => 'Pages', <ide> public function testMissingTemplate() <ide> public function testMissingLayout() <ide> { <ide> $this->expectException(\Cake\View\Exception\MissingLayoutException::class); <del> $this->expectExceptionMessage("Layout file 'whatever' could not be found"); <add> $this->expectExceptionMessage("Layout file `whatever.php` could not be found"); <ide> $this->expectExceptionMessage('The following paths were searched'); <del> $this->expectExceptionMessage('- ' . ROOT . DS . 'templates' . DS . 'layout'); <add> $this->expectExceptionMessage('- `' . ROOT . DS . 'templates' . DS . 'layout' . DS . 'whatever.php`'); <ide> $viewOptions = ['plugin' => null, <ide> 'name' => 'Pages', <ide> 'viewPath' => 'Pages', <ide> public function testPrefixElement() <ide> public function testElementMissing() <ide> { <ide> $this->expectException(\Cake\View\Exception\MissingElementException::class); <del> $this->expectExceptionMessage("Element file 'non_existent_element' could not be found"); <add> $this->expectExceptionMessage("Element file `non_existent_element.php` could not be found"); <ide> <ide> $this->View->element('non_existent_element'); <ide> } <ide> public function testElementMissing() <ide> public function testElementMissingPluginElement() <ide> { <ide> $this->expectException(\Cake\View\Exception\MissingElementException::class); <del> $this->expectExceptionMessage("Element file 'TestPlugin.nope' could not be found"); <add> $this->expectExceptionMessage("Element file `TestPlugin.nope.php` could not be found"); <ide> <ide> $this->View->element('TestPlugin.nope'); <ide> }
5
Text
Text
mark napi_auto_length as code
a1bab826c49e880c3771146dd916076b8a223431
<ide><path>doc/api/n-api.md <ide> NAPI_NO_RETURN void napi_fatal_error(const char* location, <ide> <ide> - `[in] location`: Optional location at which the error occurred. <ide> - `[in] location_len`: The length of the location in bytes, or <del>NAPI_AUTO_LENGTH if it is null-terminated. <add>`NAPI_AUTO_LENGTH` if it is null-terminated. <ide> - `[in] message`: The message associated with the error. <ide> - `[in] message_len`: The length of the message in bytes, or <del>NAPI_AUTO_LENGTH if it is <add>`NAPI_AUTO_LENGTH` if it is <ide> null-terminated. <ide> <ide> The function call does not return, the process will be terminated. <ide> napi_status napi_create_function(napi_env env, <ide> - `[in] utf8name`: A string representing the name of the function encoded as <ide> UTF8. <ide> - `[in] length`: The length of the utf8name in bytes, or <del>NAPI_AUTO_LENGTH if it is null-terminated. <add>`NAPI_AUTO_LENGTH` if it is null-terminated. <ide> - `[in] cb`: A function pointer to the native function to be invoked when the <ide> created function is invoked from JavaScript. <ide> - `[in] data`: Optional arbitrary context data to be passed into the native <ide> napi_status napi_create_string_latin1(napi_env env, <ide> - `[in] env`: The environment that the API is invoked under. <ide> - `[in] str`: Character buffer representing a ISO-8859-1-encoded string. <ide> - `[in] length`: The length of the string in bytes, or <del>NAPI_AUTO_LENGTH if it is null-terminated. <add>`NAPI_AUTO_LENGTH` if it is null-terminated. <ide> - `[out] result`: A `napi_value` representing a JavaScript String. <ide> <ide> Returns `napi_ok` if the API succeeded. <ide> napi_status napi_create_string_utf16(napi_env env, <ide> - `[in] env`: The environment that the API is invoked under. <ide> - `[in] str`: Character buffer representing a UTF16-LE-encoded string. <ide> - `[in] length`: The length of the string in two-byte code units, or <del>NAPI_AUTO_LENGTH if it is null-terminated. <add>`NAPI_AUTO_LENGTH` if it is null-terminated. <ide> - `[out] result`: A `napi_value` representing a JavaScript String. <ide> <ide> Returns `napi_ok` if the API succeeded. <ide> napi_status napi_create_string_utf8(napi_env env, <ide> <ide> - `[in] env`: The environment that the API is invoked under. <ide> - `[in] str`: Character buffer representing a UTF8-encoded string. <del>- `[in] length`: The length of the string in bytes, or NAPI_AUTO_LENGTH <add>- `[in] length`: The length of the string in bytes, or `NAPI_AUTO_LENGTH` <ide> if it is null-terminated. <ide> - `[out] result`: A `napi_value` representing a JavaScript String. <ide> <ide> napi_status napi_define_class(napi_env env, <ide> - `[in] utf8name`: Name of the JavaScript constructor function; this is <ide> not required to be the same as the C++ class name, though it is recommended <ide> for clarity. <del> - `[in] length`: The length of the utf8name in bytes, or NAPI_AUTO_LENGTH <add> - `[in] length`: The length of the utf8name in bytes, or `NAPI_AUTO_LENGTH` <ide> if it is null-terminated. <ide> - `[in] constructor`: Callback function that handles constructing instances <ide> of the class. (This should be a static method on the class, not an actual
1
Ruby
Ruby
generalize frozenerror on write attribute
1f08fec27e14092bdbe7c6cde9d33d1bd9faa057
<ide><path>activemodel/lib/active_model/attribute_set.rb <ide> def write_from_database(name, value) <ide> end <ide> <ide> def write_from_user(name, value) <add> raise FrozenError, "can't modify frozen attributes" if frozen? <ide> attributes[name] = self[name].with_value_from_user(value) <ide> end <ide> <ide><path>activemodel/lib/active_model/attribute_set/builder.rb <ide> def [](key) <ide> end <ide> <ide> def []=(key, value) <del> if frozen? <del> raise RuntimeError, "Can't modify frozen hash" <del> end <ide> delegate_hash[key] = value <ide> end <ide> <ide><path>activemodel/lib/active_model/attributes.rb <ide> def define_method_attribute=(name) <ide> ) do |temp_method_name, attr_name_expr| <ide> generated_attribute_methods.module_eval <<-RUBY, __FILE__, __LINE__ + 1 <ide> def #{temp_method_name}(value) <del> raise FrozenError, "can't modify frozen #{self.class.name}" if frozen? <ide> name = #{attr_name_expr} <ide> write_attribute(name, value) <ide> end <ide> def attribute_names <ide> @attributes.keys <ide> end <ide> <add> def freeze <add> @attributes = @attributes.clone.freeze <add> super <add> end <add> <ide> private <ide> def write_attribute(attr_name, value) <ide> name = attr_name.to_s <ide><path>activerecord/test/cases/clone_test.rb <ide> def test_stays_frozen <ide> assert cloned.persisted?, "topic persisted" <ide> assert_not cloned.new_record?, "topic is not new" <ide> assert cloned.frozen?, "topic should be frozen" <add> assert_raise(FrozenError) { cloned.author_name = "Aaron" } <ide> end <ide> <ide> def test_shallow <ide> def test_freezing_a_cloned_model_does_not_freeze_clone <ide> clone = cloned.clone <ide> cloned.freeze <ide> assert_not_predicate clone, :frozen? <add> assert_raise(FrozenError) { cloned.author_name = "Aaron" } <ide> end <ide> end <ide> end
4
Javascript
Javascript
remove dependencies from inner graph
8cbb4ed72c66cf0342d17d31cfe4ef4ace199dc8
<ide><path>lib/dependencies/HarmonyImportDependencyParserPlugin.js <ide> module.exports = class HarmonyImportDependencyParserPlugin { <ide> return true; <ide> } <ide> ); <del> /** <del> * @param {HarmonyImportSpecifierDependency} dep dependency <del> * @returns {void} <del> */ <del> const addDepToInnerGraph = dep => { <del> if (!InnerGraph.isEnabled(parser.state)) return; <del> <del> const currentTopLevelSymbol = InnerGraph.getTopLevelSymbol(parser.state); <del> <del> InnerGraph.addDependency( <del> parser.state, <del> dep, <del> InnerGraph.defaultUsageCallback <del> ); <del> if (!currentTopLevelSymbol) { <del> InnerGraph.addUsage(parser.state, dep, true); <del> } else { <del> InnerGraph.addUsage(parser.state, dep, currentTopLevelSymbol); <del> } <del> }; <ide> parser.hooks.expression <ide> .for(harmonySpecifierTag) <ide> .tap("HarmonyImportDependencyParserPlugin", expr => { <ide> module.exports = class HarmonyImportDependencyParserPlugin { <ide> dep.await = settings.await; <ide> dep.loc = expr.loc; <ide> parser.state.module.addDependency(dep); <del> addDepToInnerGraph(dep); <add> InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e)); <ide> return true; <ide> }); <ide> parser.hooks.expressionMemberChain <ide> module.exports = class HarmonyImportDependencyParserPlugin { <ide> dep.asiSafe = !parser.isAsiPosition(expr.range[0]); <ide> dep.loc = expr.loc; <ide> parser.state.module.addDependency(dep); <del> addDepToInnerGraph(dep); <add> InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e)); <ide> return true; <ide> }); <ide> parser.hooks.callMemberChain <ide> module.exports = class HarmonyImportDependencyParserPlugin { <ide> dep.loc = expr.loc; <ide> parser.state.module.addDependency(dep); <ide> if (args) parser.walkExpressions(args); <del> addDepToInnerGraph(dep); <add> InnerGraph.onUsage(parser.state, e => (dep.usedByExports = e)); <ide> return true; <ide> }); <ide> const { <ide><path>lib/dependencies/PureExpressionDependency.js <ide> class PureExpressionDependency extends NullDependency { <ide> constructor(range) { <ide> super(); <ide> this.range = range; <del> /** @type {Set<string> | boolean} */ <del> this.usedByExports = undefined; <add> /** @type {Set<string> | false} */ <add> this.usedByExports = false; <ide> } <ide> <ide> /** <ide> PureExpressionDependency.Template = class PureExpressionDependencyTemplate exten <ide> apply(dependency, source, { moduleGraph }) { <ide> const dep = /** @type {PureExpressionDependency} */ (dependency); <ide> <del> if (dep.usedByExports === true) return; <del> if (dep.usedByExports === undefined) return; <del> <ide> if (dep.usedByExports !== false) { <ide> const selfModule = moduleGraph.getParentModule(dep); <ide> const exportsInfo = moduleGraph.getExportsInfo(selfModule); <ide><path>lib/optimize/InnerGraph.js <ide> "use strict"; <ide> <ide> /** @typedef {import("estree").Node} AnyNode */ <del>/** @typedef {import("../Dependency")} Dependency */ <ide> /** @typedef {import("../Parser").ParserState} ParserState */ <ide> /** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */ <ide> <del>/** @typedef {Map<TopLevelSymbol | Dependency, Set<string | TopLevelSymbol> | true>} InnerGraph */ <del>/** @typedef {function(TopLevelSymbol | Dependency, true | Set<string>): void} UsageCallback */ <add>/** @typedef {Map<TopLevelSymbol, Set<string | TopLevelSymbol> | true>} InnerGraph */ <add>/** @typedef {function(boolean | Set<string> | undefined): void} UsageCallback */ <ide> <ide> /** <ide> * @typedef {Object} StateObject <ide> * @property {InnerGraph} innerGraph <del> * @property {Set<Dependency>} allExportDependentDependencies <ide> * @property {TopLevelSymbol=} currentTopLevelSymbol <del> * @property {WeakMap<TopLevelSymbol | Dependency, Set<UsageCallback>>} usageCallbackMap <add> * @property {Map<TopLevelSymbol, Set<UsageCallback>>} usageCallbackMap <ide> */ <ide> <ide> /** @typedef {false|StateObject} State */ <ide> function getState(parserState) { <ide> return parserStateMap.get(parserState); <ide> } <ide> <del>/** <del> * @param {State} state inner graph state <del> * @param {TopLevelSymbol | Dependency} symbol a symbol <del> * @param {UsageCallback} callback a function that will be executed when the symbol will be used <del> */ <del>function onUsage(state, symbol, callback) { <del> if (!state) { <del> return; <del> } <del> <del> let callbacks = state.usageCallbackMap.get(symbol); <del> <del> if (!callbacks) { <del> callbacks = new Set(); <del> state.usageCallbackMap.set(symbol, callbacks); <del> } <del> <del> callbacks.add(callback); <del>} <del> <del>/** <del> * @param {State} state inner graph state <del> * @param {TopLevelSymbol | Dependency} dep dependency <del> * @param {Set<string | TopLevelSymbol> | true} usage usage <del> */ <del>function flushOnUsage(state, dep, usage) { <del> if (!state) { <del> return; <del> } <del> <del> const list = state.usageCallbackMap.get(dep) || []; <del> <del> for (const callback of list) { <del> callback(dep, usage === undefined ? false : usage); <del> } <del>} <del> <ide> /** <ide> * @param {ParserState} parserState parser state <ide> * @returns {void} <ide> exports.enable = parserState => { <ide> } <ide> parserStateMap.set(parserState, { <ide> innerGraph: new Map(), <del> allExportDependentDependencies: new Set(), <ide> currentTopLevelSymbol: undefined, <del> usageCallbackMap: new WeakMap() <add> usageCallbackMap: new Map() <ide> }); <ide> }; <ide> <ide> exports.isEnabled = parserState => { <ide> <ide> /** <ide> * @param {ParserState} state parser state <del> * @param {TopLevelSymbol | Dependency} symbol the symbol <add> * @param {TopLevelSymbol} symbol the symbol <ide> * @param {string | TopLevelSymbol | true} usage usage data <ide> * @returns {void} <ide> */ <ide> exports.addVariableUsage = (parser, name, usage) => { <ide> <ide> /** <ide> * @param {ParserState} state parser state <del> * @returns {Map<Dependency, Set<string> | true>} usage data <add> * @returns {void} <ide> */ <ide> exports.inferDependencyUsage = state => { <ide> const innerGraphState = getState(state); <ide> exports.inferDependencyUsage = state => { <ide> return; <ide> } <ide> <del> const { allExportDependentDependencies, innerGraph } = innerGraphState; <add> const { innerGraph, usageCallbackMap } = innerGraphState; <ide> // flatten graph to terminal nodes (string, undefined or true) <ide> const nonTerminal = new Set(innerGraph.keys()); <ide> while (nonTerminal.size > 0) { <ide> exports.inferDependencyUsage = state => { <ide> } <ide> <ide> /** @type {Map<Dependency, true | Set<string>>} */ <del> const result = new Map(); <del> for (const dep of allExportDependentDependencies) { <del> const value = /** @type {true | Set<string>} */ (innerGraph.get(dep)); <del> result.set(dep, value); <del> flushOnUsage(innerGraphState, dep, value); <add> for (const [symbol, callbacks] of usageCallbackMap) { <add> const usage = /** @type {true | Set<string> | undefined} */ (innerGraph.get( <add> symbol <add> )); <add> for (const callback of callbacks) { <add> callback(usage === undefined ? false : usage); <add> } <ide> } <del> return result; <ide> }; <ide> <ide> /** <ide> * @param {ParserState} state parser state <del> * @param {Dependency} dep dependency <del> * @param {UsageCallback} [onUsageCallback] on usage callback <add> * @param {UsageCallback} onUsageCallback on usage callback <ide> */ <del>exports.addDependency = (state, dep, onUsageCallback) => { <add>exports.onUsage = (state, onUsageCallback) => { <ide> const innerGraphState = getState(state); <ide> <ide> if (innerGraphState) { <del> innerGraphState.allExportDependentDependencies.add(dep); <del> if (onUsage) onUsage(innerGraphState, dep, onUsageCallback); <del> } <del>}; <add> const { usageCallbackMap, currentTopLevelSymbol } = innerGraphState; <add> if (currentTopLevelSymbol) { <add> let callbacks = usageCallbackMap.get(currentTopLevelSymbol); <ide> <del>/** <del> * @param {Dependency & { usedByExports: boolean | Set<string> }} dependency dependency <del> * @param {true | Set<string>} usage usage <del> */ <del>exports.defaultUsageCallback = (dependency, usage) => { <del> dependency.usedByExports = usage; <add> if (callbacks === undefined) { <add> callbacks = new Set(); <add> usageCallbackMap.set(currentTopLevelSymbol, callbacks); <add> } <add> <add> callbacks.add(onUsageCallback); <add> } else { <add> onUsageCallback(true); <add> } <add> } else { <add> onUsageCallback(undefined); <add> } <ide> }; <ide> <ide> /** <ide><path>lib/optimize/InnerGraphPlugin.js <ide> class InnerGraphPlugin { <ide> if (!InnerGraph.isEnabled(parser.state)) return; <ide> const fn = declWithTopLevelSymbol.get(decl); <ide> if (fn) { <add> InnerGraph.setTopLevelSymbol(parser.state, fn); <ide> if (pureDeclarators.has(decl)) { <del> const dep = new PureExpressionDependency(decl.init.range); <del> dep.loc = decl.loc; <del> parser.state.module.addDependency(dep); <del> InnerGraph.addUsage(parser.state, dep, fn); <del> InnerGraph.addDependency( <del> parser.state, <del> dep, <del> InnerGraph.defaultUsageCallback <del> ); <add> InnerGraph.onUsage(parser.state, usedByExports => { <add> switch (usedByExports) { <add> case undefined: <add> case true: <add> return; <add> default: { <add> const dep = new PureExpressionDependency(decl.init.range); <add> dep.loc = decl.loc; <add> dep.usedByExports = usedByExports; <add> parser.state.module.addDependency(dep); <add> break; <add> } <add> } <add> }); <ide> } <del> InnerGraph.setTopLevelSymbol(parser.state, fn); <ide> parser.walkExpression(decl.init); <ide> InnerGraph.setTopLevelSymbol(parser.state, undefined); <ide> return true;
4
Python
Python
add unit test for negative complex powers
15dea0280a1c9eaf6acfd488679ab60ca88671c0
<ide><path>numpy/core/tests/test_umath.py <ide> def check_power_complex(self): <ide> assert_equal(x**1, x) <ide> assert_equal(x**2, [-3+4j, -5+12j, -7+24j]) <ide> assert_almost_equal(x**(-1), [1/(1+2j), 1/(2+3j), 1/(3+4j)]) <add> assert_almost_equal(x**(-3), [(-11+2j)/125, (-46-9j)/2197, <add> (-117-44j)/15625]) <ide> assert_almost_equal(x**(0.5), [ncu.sqrt(1+2j), ncu.sqrt(2+3j), <ide> ncu.sqrt(3+4j)]) <ide> assert_almost_equal(x**14, [-76443+16124j, 23161315+58317492j,
1
Javascript
Javascript
handle double and triple click on lines
2996500d9027804358b8e1a0c746ee99425dabe2
<ide><path>spec/text-editor-component-spec.js <ide> describe('TextEditorComponent', () => { <ide> }) <ide> <ide> describe('mouse input', () => { <del> it('positions the cursor on single click', async () => { <add> it('positions the cursor on single-click', async () => { <ide> const {component, element, editor} = buildComponent() <del> const {lineHeight, baseCharacterWidth} = component.measurements <add> const {lineHeight} = component.measurements <ide> <ide> component.didMouseDownOnLines({ <ide> detail: 1, <ide> describe('TextEditorComponent', () => { <ide> }) <ide> expect(editor.getCursorScreenPosition()).toEqual([3, 16]) <ide> }) <add> <add> it('selects words on double-click', () => { <add> const {component, editor} = buildComponent() <add> const clientX = clientLeftForCharacter(component, 1, 16) <add> const clientY = clientTopForLine(component, 1) <add> <add> component.didMouseDownOnLines({detail: 1, clientX, clientY}) <add> component.didMouseDownOnLines({detail: 2, clientX, clientY}) <add> expect(editor.getSelectedScreenRange()).toEqual([[1, 13], [1, 21]]) <add> }) <add> <add> it('selects lines on triple-click', () => { <add> const {component, editor} = buildComponent() <add> const clientX = clientLeftForCharacter(component, 1, 16) <add> const clientY = clientTopForLine(component, 1) <add> <add> component.didMouseDownOnLines({detail: 1, clientX, clientY}) <add> component.didMouseDownOnLines({detail: 2, clientX, clientY}) <add> expect(editor.getSelectedScreenRange()).toEqual([[1, 0], [2, 0]]) <add> }) <ide> }) <ide> }) <ide> <ide><path>src/text-editor-component.js <ide> class TextEditorComponent { <ide> } <ide> <ide> didMouseDownOnLines (event) { <add> const {model} = this.props <ide> const screenPosition = this.screenPositionForMouseEvent(event) <ide> <del> if (event.detail === 1) { <del> this.props.model.setCursorScreenPosition(screenPosition) <add> switch (event.detail) { <add> case 1: <add> model.setCursorScreenPosition(screenPosition) <add> break <add> case 2: <add> model.getLastSelection().selectWord({autoscroll: false}) <add> break <add> case 3: <add> model.getLastSelection().selectLine(null, {autoscroll: false}) <add> break <ide> } <ide> } <ide>
2
Python
Python
change doc string for rpn_box_predictor_features
4dcc11d1e192277009701b64792a78fb9e4266f2
<ide><path>research/object_detection/meta_architectures/faster_rcnn_meta_arch.py <ide> def _extract_rpn_feature_maps(self, preprocessed_inputs): <ide> <ide> Returns: <ide> rpn_box_predictor_features: A list of 4-D float32 tensor with shape <del> [batch, height, width, depth] to be used for predicting proposal boxes <add> [batch, height_i, width_j, depth] to be used for predicting proposal boxes <ide> and corresponding objectness scores. <ide> rpn_features_to_crop: A list of 4-D float32 tensor with shape <ide> [batch, height, width, depth] representing image features to crop using <ide> def _predict_rpn_proposals(self, rpn_box_predictor_features): <ide> <ide> Args: <ide> rpn_box_predictor_features: A list of 4-D float32 tensor with shape <del> [batch, height, width, depth] to be used for predicting proposal boxes <add> [batch, height_i, width_j, depth] to be used for predicting proposal boxes <ide> and corresponding objectness scores. <ide> <ide> Returns:
1
Python
Python
use optiongroup to separate worker arguments
55d4a4c3eb15640fbfcda016ffac79fa0252286a
<ide><path>celery/bin/base.py <ide> from collections import defaultdict <ide> from heapq import heappush <ide> from inspect import getargspec <del>from optparse import OptionParser, IndentedHelpFormatter, make_option as Option <add>from optparse import ( <add> OptionParser, OptionGroup, IndentedHelpFormatter, make_option as Option, <add>) <ide> from pprint import pformat <ide> <ide> from celery import VERSION_BANNER, Celery, maybe_patch_concurrency <ide> def get_options(self): <ide> """Get supported command-line options.""" <ide> return self.option_list <ide> <add> def prepare_arguments(self, parser): <add> pass <add> <ide> def expanduser(self, value): <ide> if isinstance(value, string_t): <ide> return os.path.expanduser(value) <ide> def parse_options(self, prog_name, arguments, command=None): <ide> return self.parser.parse_args(arguments) <ide> <ide> def create_parser(self, prog_name, command=None): <del> option_list = ( <del> self.preload_options + <del> self.get_options() + <del> tuple(self.app.user_options['preload']) <del> ) <del> return self.prepare_parser(self.Parser( <add> parser = self.Parser( <ide> prog=prog_name, <ide> usage=self.usage(command), <ide> version=self.version, <ide> epilog=self.epilog, <ide> formatter=HelpFormatter(), <ide> description=self.description, <del> option_list=option_list, <del> )) <add> ) <add> parser.option_list.extend(self.preload_options) <add> self.prepare_arguments(parser) <add> option_list = self.get_options() <add> if option_list: <add> parser.option_lisat.extend(option_list) <add> parser.option_list.extend(self.app.user_options['preload']) <add> return self.prepare_parser(parser) <ide> <ide> def prepare_parser(self, parser): <ide> docs = [self.parse_doc(doc) for doc in (self.doc, __doc__) if doc] <ide> def no_color(self, value): <ide> self._colored.enabled = not self._no_color <ide> <ide> <del>def daemon_options(default_pidfile=None, default_logfile=None): <del> return ( <del> Option('-f', '--logfile', default=default_logfile), <del> Option('--pidfile', default=default_pidfile), <del> Option('--uid', default=None), <del> Option('--gid', default=None), <del> Option('--umask', default=None), <del> Option('--executable', default=None), <del> ) <add>def daemon_options(parser, default_pidfile=None, default_logfile=None): <add> group = OptionGroup(parser, "Daemonization Options") <add> group.add_option('-f', '--logfile', default=default_logfile), <add> group.add_option('--pidfile', default=default_pidfile), <add> group.add_option('--uid', default=None), <add> group.add_option('--gid', default=None), <add> group.add_option('--umask', default=None), <add> group.add_option('--executable', default=None), <add> parser.add_option_group(group) <ide><path>celery/bin/beat.py <ide> <ide> from celery.platforms import detached, maybe_drop_privileges <ide> <del>from celery.bin.base import Command, Option, daemon_options <add>from celery.bin.base import Command, daemon_options <ide> <ide> __all__ = ['beat'] <ide> <ide> def run(self, detach=False, logfile=None, pidfile=None, uid=None, <ide> else: <ide> return beat().run() <ide> <del> def get_options(self): <add> def prepare_arguments(self, parser): <ide> c = self.app.conf <del> <del> return ( <del> (Option('--detach', action='store_true'), <del> Option('-s', '--schedule', <del> default=c.beat_schedule_filename), <del> Option('--max-interval', type='float'), <del> Option('-S', '--scheduler', dest='scheduler_cls'), <del> Option('-l', '--loglevel', default='WARN')) + <del> daemon_options(default_pidfile='celerybeat.pid') + <del> tuple(self.app.user_options['beat']) <del> ) <add> parser.add_option('--detach', action='store_true') <add> parser.add_option('-s', '--schedule', default=c.beat_schedule_filename) <add> parser.add_option('--max-interval', type='float') <add> parser.add_option('-S', '--scheduler', dest='scheduler_cls') <add> parser.add_option('-l', '--loglevel', default='WARN') <add> daemon_options(parser, default_pidfile='celerybeat.pid') <add> parser.option_list.extend(self.app.user_options['beat']) <ide> <ide> <ide> def main(app=None): <ide><path>celery/bin/celery.py <ide> class multi(Command): <ide> respects_app_option = False <ide> <ide> def get_options(self): <del> return () <add> pass <ide> <ide> def run_from_argv(self, prog_name, argv, command=None): <ide> from celery.bin.multi import MultiTool <ide><path>celery/bin/celeryd_detach.py <ide> from celery.platforms import EX_FAILURE, detached <ide> from celery.utils.log import get_logger <ide> <del>from celery.bin.base import daemon_options, Option <add>from celery.bin.base import daemon_options <ide> <ide> __all__ = ['detached_celeryd', 'detach'] <ide> <ide> logger = get_logger(__name__) <ide> <ide> C_FAKEFORK = os.environ.get('C_FAKEFORK') <ide> <del>OPTION_LIST = daemon_options(default_pidfile='celeryd.pid') + ( <del> Option('--workdir', default=None, dest='working_directory'), <del> Option('--fake', <del> default=False, action='store_true', dest='fake', <del> help="Don't fork (for debugging purposes)"), <del>) <del> <ide> <ide> def detach(path, argv, logfile=None, pidfile=None, uid=None, <ide> gid=None, umask=None, working_directory=None, fake=False, app=None, <ide> def _process_short_opts(self, rargs, values): <ide> <ide> <ide> class detached_celeryd(object): <del> option_list = OPTION_LIST <ide> usage = '%prog [options] [celeryd options]' <ide> version = celery.VERSION_BANNER <ide> description = ('Detaches Celery worker nodes. See `celery worker --help` ' <ide> def __init__(self, app=None): <ide> <ide> def Parser(self, prog_name): <ide> return PartialOptionParser(prog=prog_name, <del> option_list=self.option_list, <ide> usage=self.usage, <ide> description=self.description, <ide> version=self.version) <ide> <ide> def parse_options(self, prog_name, argv): <ide> parser = self.Parser(prog_name) <add> self.prepare_arguments(parser) <ide> options, values = parser.parse_args(argv) <ide> if options.logfile: <ide> parser.leftovers.append('--logfile={0}'.format(options.logfile)) <ide> def execute_from_commandline(self, argv=None): <ide> **vars(options) <ide> )) <ide> <add> def prepare_arguments(self, parser): <add> daemon_options(parser, default_pidfile='celeryd.pid') <add> parser.add_option('--workdir', default=None, dest='working_directory') <add> parser.add_option( <add> '--fake', <add> default=False, action='store_true', dest='fake', <add> help="Don't fork (for debugging purposes)", <add> ) <add> <ide> <ide> def main(app=None): <ide> detached_celeryd(app).execute_from_commandline() <ide><path>celery/bin/events.py <ide> from functools import partial <ide> <ide> from celery.platforms import detached, set_process_title, strargv <del>from celery.bin.base import Command, Option, daemon_options <add>from celery.bin.base import Command, daemon_options <ide> <ide> __all__ = ['events'] <ide> <ide> def set_process_status(self, prog, info=''): <ide> info = '{0} {1}'.format(info, strargv(sys.argv)) <ide> return set_process_title(prog, info=info) <ide> <del> def get_options(self): <del> return ( <del> (Option('-d', '--dump', action='store_true'), <del> Option('-c', '--camera'), <del> Option('--detach', action='store_true'), <del> Option('-F', '--frequency', '--freq', <del> type='float', default=1.0), <del> Option('-r', '--maxrate'), <del> Option('-l', '--loglevel', default='INFO')) + <del> daemon_options(default_pidfile='celeryev.pid') + <del> tuple(self.app.user_options['events']) <del> ) <add> def prepare_arguments(self, parser): <add> parser.add_option('-d', '--dump', action='store_true') <add> parser.add_option('-c', '--camera') <add> parser.add_option('--detach', action='store_true') <add> parser.add_option('-F', '--frequency', '--freq', <add> type='float', default=1.0) <add> parser.add_option('-r', '--maxrate') <add> parser.add_option('-l', '--loglevel', default='INFO') <add> daemon_options(parser, default_pidfile='celeryev.pid') <add> parser.option_list.extend(self.app.user_options['events']) <ide> <ide> <ide> def main(): <ide><path>celery/bin/worker.py <ide> <ide> import sys <ide> <add>from optparse import OptionGroup <add> <ide> from celery import concurrency <del>from celery.bin.base import Command, Option, daemon_options <add>from celery.bin.base import Command, daemon_options <ide> from celery.bin.celeryd_detach import detached_celeryd <ide> from celery.five import string_t <ide> from celery.platforms import maybe_drop_privileges <ide> def with_pool_option(self, argv): <ide> # that may have to be loaded as early as possible. <ide> return (['-P'], ['--pool']) <ide> <del> def get_options(self): <add> def prepare_arguments(self, parser): <ide> conf = self.app.conf <del> return ( <del> Option('-c', '--concurrency', <del> default=conf.worker_concurrency, type='int'), <del> Option('-P', '--pool', default=conf.worker_pool, dest='pool_cls'), <del> Option('--purge', '--discard', default=False, action='store_true'), <del> Option('-l', '--loglevel', default='WARN'), <del> Option('-n', '--hostname'), <del> Option('-B', '--beat', action='store_true'), <del> Option('-s', '--schedule', dest='schedule_filename', <del> default=conf.beat_schedule_filename), <del> Option('--scheduler', dest='scheduler_cls'), <del> Option('-S', '--statedb', <del> default=conf.worker_state_db, dest='state_db'), <del> Option('-E', '--events', default=conf.worker_send_task_events, <del> action='store_true', dest='send_events'), <del> Option('--time-limit', type='float', dest='task_time_limit', <del> default=conf.task_time_limit), <del> Option('--soft-time-limit', dest='task_soft_time_limit', <del> default=conf.task_soft_time_limit, type='float'), <del> Option('--maxtasksperchild', dest='max_tasks_per_child', <del> default=conf.worker_max_tasks_per_child, type='int'), <del> Option('--prefetch-multiplier', dest='prefetch_multiplier', <del> default=conf.worker_prefetch_multiplier, type='int'), <del> Option('--maxmemperchild', dest='max_memory_per_child', <del> default=conf.worker_max_memory_per_child, type='int'), <del> Option('--queues', '-Q', default=[]), <del> Option('--exclude-queues', '-X', default=[]), <del> Option('--include', '-I', default=[]), <del> Option('--autoscale'), <del> Option('--autoreload', action='store_true'), <del> Option('--no-execv', action='store_true', default=False), <del> Option('--without-gossip', action='store_true', default=False), <del> Option('--without-mingle', action='store_true', default=False), <del> Option('--without-heartbeat', action='store_true', default=False), <del> Option('--heartbeat-interval', type='int'), <del> Option('-O', dest='optimization'), <del> Option('-D', '--detach', action='store_true'), <del> ) + daemon_options() + tuple(self.app.user_options['worker']) <add> <add> wopts = OptionGroup(parser, 'Worker Options') <add> wopts.add_option('-n', '--hostname') <add> wopts.add_option('-D', '--detach', action='store_true') <add> wopts.add_option( <add> '-S', '--statedb', <add> default=conf.worker_state_db, dest='state_db', <add> ) <add> wopts.add_option('-l', '--loglevel', default='WARN') <add> wopts.add_option('-O', dest='optimization') <add> wopts.add_option( <add> '--prefetch-multiplier', <add> dest='prefetch_multiplier', type='int', <add> default=conf.worker_prefetch_multiplier, <add> ) <add> parser.add_option_group(wopts) <add> <add> topts = OptionGroup(parser, 'Pool Options') <add> topts.add_option( <add> '-c', '--concurrency', <add> default=conf.worker_concurrency, type='int', <add> ) <add> topts.add_option( <add> '-P', '--pool', <add> default=conf.worker_pool, dest='pool_cls', <add> ) <add> topts.add_option( <add> '-E', '--events', <add> default=conf.worker_send_task_events, <add> action='store_true', dest='send_events', <add> ) <add> topts.add_option( <add> '--time-limit', <add> type='float', dest='task_time_limit', <add> default=conf.task_time_limit, <add> ) <add> topts.add_option( <add> '--soft-time-limit', <add> dest='task_soft_time_limit', type='float', <add> default=conf.task_soft_time_limit, <add> ) <add> topts.add_option( <add> '--maxtasksperchild', <add> dest='max_tasks_per_child', type='int', <add> default=conf.worker_max_tasks_per_child, <add> ) <add> topts.add_option( <add> '--maxmemperchild', <add> dest='max_memory_per_child', type='int', <add> default=conf.worker_max_memory_per_child, <add> ) <add> parser.add_option_group(topts) <add> <add> qopts = OptionGroup(parser, 'Queue Options') <add> qopts.add_option( <add> '--purge', '--discard', <add> default=False, action='store_true', <add> ) <add> qopts.add_option('--queues', '-Q', default=[]) <add> qopts.add_option('--exclude-queues', '-X', default=[]) <add> qopts.add_option('--include', '-I', default=[]) <add> parser.add_option_group(qopts) <add> <add> fopts = OptionGroup(parser, 'Features') <add> fopts.add_option('--autoscale') <add> fopts.add_option('--autoreload', action='store_true') <add> fopts.add_option( <add> '--without-gossip', action='store_true', default=False, <add> ) <add> fopts.add_option( <add> '--without-mingle', action='store_true', default=False, <add> ) <add> fopts.add_option( <add> '--without-heartbeat', action='store_true', default=False, <add> ) <add> fopts.add_option('--heartbeat-interval', type='int') <add> parser.add_option_group(fopts) <add> <add> daemon_options(parser) <add> <add> bopts = OptionGroup(parser, 'Embedded Beat Options') <add> bopts.add_option('-B', '--beat', action='store_true') <add> bopts.add_option( <add> '-s', '--schedule', dest='schedule_filename', <add> default=conf.beat_schedule_filename, <add> ) <add> bopts.add_option('--scheduler', dest='scheduler_cls') <add> parser.add_option_group(bopts) <add> <add> user_options = self.app.user_options['worker'] <add> if user_options: <add> uopts = OptionGroup(parser, 'User Options') <add> uopts.options_list.extend(user_options) <add> parser.add_option_group(uopts) <ide> <ide> <ide> def main(app=None):
6
Python
Python
fix layer __call__ kwargs update issue
edaa1d479dc27c30898bd00c09caf7c8a1ae1ed4
<ide><path>keras/engine/topology.py <ide> def __call__(self, inputs, **kwargs): <ide> <ide> # Handle mask propagation. <ide> previous_mask = _collect_previous_mask(inputs) <add> user_kwargs = copy.copy(kwargs) <ide> if not _is_all_none(previous_mask): <ide> # The previous layer generated a mask. <ide> if 'mask' in inspect.getargspec(self.call).args: <ide> def __call__(self, inputs, **kwargs): <ide> self._add_inbound_node(input_tensors=inputs, output_tensors=output, <ide> input_masks=previous_mask, output_masks=output_mask, <ide> input_shapes=input_shape, output_shapes=output_shape, <del> arguments=kwargs) <add> arguments=user_kwargs) <ide> <ide> # Apply activity regularizer if any: <ide> if hasattr(self, 'activity_regularizer') and self.activity_regularizer is not None:
1
Javascript
Javascript
use fs-plus instead of fs in atomprotocolhandler
52631bab98becc59754fdfd5a491a5feb38243ff
<ide><path>src/main-process/atom-protocol-handler.js <ide> const {protocol} = require('electron') <del>const fs = require('fs') <add>const fs = require('fs-plus') <ide> const path = require('path') <ide> <ide> // Handles requests with 'atom' protocol.
1
PHP
PHP
fix method name
e057f68d5f3672ab4b63cc58b1c2d6ffd7adc4e6
<ide><path>src/Illuminate/Foundation/Auth/ResetsPasswords.php <ide> public function postReset(Request $request) <ide> <ide> $response = Password::reset($credentials, function($user, $password) <ide> { <del> $this->passwordReset($user, $password); <add> $this->resetPassword($user, $password); <ide> }); <ide> <ide> switch ($response) <ide> public function postReset(Request $request) <ide> } <ide> <ide> /** <del> * Actually reset user's password <add> * Reset the given user's password. <ide> * <ide> * @param \Illuminate\Contracts\Auth\CanResetPassword $user <ide> * @param string $password <add> * @return void <ide> */ <del> protected function passwordReset($user, $password) <add> protected function resetPassword($user, $password) <ide> { <ide> $user->password = bcrypt($password); <ide>
1
Text
Text
add thredup to list of airflow users
817e1ac938667eef9cea4ae6d0502f3ec571bd4a
<ide><path>README.md <ide> Currently **officially** using Airflow: <ide> 1. [Thinking Machines](https://thinkingmachin.es) [[@marksteve](https://github.com/marksteve)] <ide> 1. [Thinknear](https://www.thinknear.com/) [[@d3cay1](https://github.com/d3cay1), [@ccson](https://github.com/ccson), & [@ababian](https://github.com/ababian)] <ide> 1. [ThoughtWorks](https://www.thoughtworks.com/) [[@sann3](https://github.com/sann3)] <add>1. [ThredUP](https://www.thredup.com/) [[@kosteev](https://github.com/kosteev)] <ide> 1. [Thumbtack](https://www.thumbtack.com/) [[@kamalacharya](https://github.com/kamalacharya), [@dwjoss](https://github.com/dwjoss)] <ide> 1. [Tictail](https://tictail.com/) <ide> 1. [Tile](https://tile.com/) [[@ranjanmanish](https://github.com/ranjanmanish)]
1
Javascript
Javascript
remove unused methods
10490c947d4c4274f6d35c64ce962f450543b5f0
<ide><path>lib/Parser.js <ide> class Parser extends Tapable { <ide> }; <ide> } <ide> <del> parseStringArray(expression) { <del> if(expression.type !== "ArrayExpression") { <del> return [this.parseString(expression)]; <del> } <del> <del> const arr = []; <del> if(expression.elements) <del> for(const expr of expression.elements) <del> arr.push(this.parseString(expr)); <del> return arr; <del> } <del> <del> parseCalculatedStringArray(expression) { <del> if(expression.type !== "ArrayExpression") { <del> return [this.parseCalculatedString(expression)]; <del> } <del> <del> const arr = []; <del> if(expression.elements) <del> for(const expr of expression.elements) <del> arr.push(this.parseCalculatedString(expr)); <del> return arr; <del> } <del> <ide> parse(source, initialState) { <ide> let ast; <ide> let comments = [];
1
Javascript
Javascript
fix handling of flags 1-3 in tensor shading
6d1e0f7e8d1f220a602ad4ec05769a7f0223078d
<ide><path>src/core/pattern.js <ide> Shadings.Mesh = (function MeshClosure() { <ide> break; <ide> case 1: <ide> tmp1 = ps[12]; tmp2 = ps[13]; tmp3 = ps[14]; tmp4 = ps[15]; <del> ps[12] = pi + 5; ps[13] = pi + 4; ps[14] = pi + 3; ps[15] = pi + 2; <del> ps[ 8] = pi + 6; ps[ 9] = pi + 11; ps[10] = pi + 10; ps[11] = pi + 1; <del> ps[ 4] = pi + 7; ps[ 5] = pi + 8; ps[ 6] = pi + 9; ps[ 7] = pi; <del> ps[ 0] = tmp1; ps[ 1] = tmp2; ps[ 2] = tmp3; ps[ 3] = tmp4; <add> ps[12] = tmp4; ps[13] = pi + 0; ps[14] = pi + 1; ps[15] = pi + 2; <add> ps[ 8] = tmp3; ps[ 9] = pi + 9; ps[10] = pi + 10; ps[11] = pi + 3; <add> ps[ 4] = tmp2; ps[ 5] = pi + 8; ps[ 6] = pi + 11; ps[ 7] = pi + 4; <add> ps[ 0] = tmp1; ps[ 1] = pi + 7; ps[ 2] = pi + 6; ps[ 3] = pi + 5; <ide> tmp1 = cs[2]; tmp2 = cs[3]; <del> cs[2] = ci + 1; cs[3] = ci; <del> cs[0] = tmp1; cs[1] = tmp2; <add> cs[2] = tmp2; cs[3] = ci; <add> cs[0] = tmp1; cs[1] = ci + 1; <ide> break; <ide> case 2: <del> ps[12] = ps[15]; ps[13] = pi + 7; ps[14] = pi + 6; ps[15] = pi + 5; <del> ps[ 8] = ps[11]; ps[ 9] = pi + 8; ps[10] = pi + 11; ps[11] = pi + 4; <del> ps[ 4] = ps[7]; ps[ 5] = pi + 9; ps[ 6] = pi + 10; ps[ 7] = pi + 3; <del> ps[ 0] = ps[3]; ps[ 1] = pi; ps[ 2] = pi + 1; ps[ 3] = pi + 2; <del> cs[2] = cs[3]; cs[3] = ci + 1; <del> cs[0] = cs[1]; cs[1] = ci; <add> tmp1 = ps[15]; <add> tmp2 = ps[11]; <add> ps[12] = ps[3]; ps[13] = pi + 0; ps[14] = pi + 1; ps[15] = pi + 2; <add> ps[ 8] = ps[7]; ps[ 9] = pi + 9; ps[10] = pi + 10; ps[11] = pi + 3; <add> ps[ 4] = tmp2; ps[ 5] = pi + 8; ps[ 6] = pi + 11; ps[ 7] = pi + 4; <add> ps[ 0] = tmp1; ps[ 1] = pi + 7; ps[ 2] = pi + 6; ps[ 3] = pi + 5; <add> tmp1 = cs[3]; <add> cs[2] = cs[1]; cs[3] = ci; <add> cs[0] = tmp1; cs[1] = ci + 1; <ide> break; <ide> case 3: <del> ps[12] = ps[0]; ps[13] = ps[1]; ps[14] = ps[2]; ps[15] = ps[3]; <del> ps[ 8] = pi; ps[ 9] = pi + 9; ps[10] = pi + 8; ps[11] = pi + 7; <del> ps[ 4] = pi + 1; ps[ 5] = pi + 10; ps[ 6] = pi + 11; ps[ 7] = pi + 6; <del> ps[ 0] = pi + 2; ps[ 1] = pi + 3; ps[ 2] = pi + 4; ps[ 3] = pi + 5; <del> cs[2] = cs[0]; cs[3] = cs[1]; <del> cs[0] = ci; cs[1] = ci + 1; <add> ps[12] = ps[0]; ps[13] = pi + 0; ps[14] = pi + 1; ps[15] = pi + 2; <add> ps[ 8] = ps[1]; ps[ 9] = pi + 9; ps[10] = pi + 10; ps[11] = pi + 3; <add> ps[ 4] = ps[2]; ps[ 5] = pi + 8; ps[ 6] = pi + 11; ps[ 7] = pi + 4; <add> ps[ 0] = ps[3]; ps[ 1] = pi + 7; ps[ 2] = pi + 6; ps[ 3] = pi + 5; <add> cs[2] = cs[0]; cs[3] = ci; <add> cs[0] = cs[1]; cs[1] = ci + 1; <ide> break; <ide> } <ide> mesh.figures.push({
1
Text
Text
use serial comma in util docs
5e6f9c3e346b196ab299a3fce485d7aa5fbf3802
<ide><path>doc/api/util.md <ide> changes: <ide> was not a string. <ide> - version: v11.4.0 <ide> pr-url: https://github.com/nodejs/node/pull/23708 <del> description: The `%d`, `%f` and `%i` specifiers now support Symbols <add> description: The `%d`, `%f`, and `%i` specifiers now support Symbols <ide> properly. <ide> - version: v11.4.0 <ide> pr-url: https://github.com/nodejs/node/pull/24806 <ide> changes: <ide> * `showProxy` {boolean} If `true`, `Proxy` inspection includes <ide> the [`target` and `handler`][] objects. **Default:** `false`. <ide> * `maxArrayLength` {integer} Specifies the maximum number of `Array`, <del> [`TypedArray`][], [`WeakMap`][] and [`WeakSet`][] elements to include when <add> [`TypedArray`][], [`WeakMap`][], and [`WeakSet`][] elements to include when <ide> formatting. Set to `null` or `Infinity` to show all elements. Set to `0` or <ide> negative to show no elements. **Default:** `100`. <ide> * `maxStringLength` {integer} Specifies the maximum number of characters to <ide> changes: <ide> * `ignoreBOM` {boolean} When `true`, the `TextDecoder` will include the byte <ide> order mark in the decoded result. When `false`, the byte order mark will <ide> be removed from the output. This option is only used when `encoding` is <del> `'utf-8'`, `'utf-16be'` or `'utf-16le'`. **Default:** `false`. <add> `'utf-8'`, `'utf-16be'`, or `'utf-16le'`. **Default:** `false`. <ide> <ide> Creates a new `TextDecoder` instance. The `encoding` may specify one of the <ide> supported encodings or an alias. <ide> The `TextDecoder` class is also available on the global object. <ide> <ide> ### `textDecoder.decode([input[, options]])` <ide> <del>* `input` {ArrayBuffer|DataView|TypedArray} An `ArrayBuffer`, `DataView` or <add>* `input` {ArrayBuffer|DataView|TypedArray} An `ArrayBuffer`, `DataView`, or <ide> `TypedArray` instance containing the encoded data. <ide> * `options` {Object} <ide> * `stream` {boolean} `true` if additional chunks of data are expected.
1
Java
Java
kill @uiprop in favor of @reactprop
137a0b86113510b52cc931cc32f5b24f400115c1
<ide><path>ReactAndroid/src/main/java/com/facebook/react/uimanager/UIProp.java <del>/** <del> * Copyright (c) 2015-present, Facebook, Inc. <del> * All rights reserved. <del> * <del> * This source code is licensed under the BSD-style license found in the <del> * LICENSE file in the root directory of this source tree. An additional grant <del> * of patent rights can be found in the PATENTS file in the same directory. <del> */ <del> <del>package com.facebook.react.uimanager; <del> <del>import java.lang.annotation.ElementType; <del>import java.lang.annotation.Retention; <del>import java.lang.annotation.Target; <del> <del>import static java.lang.annotation.RetentionPolicy.RUNTIME; <del> <del>/** <del> * Annotation which is used to mark native UI properties that are exposed to <del> * JS. {@link ViewManager#getNativeProps} traverses the fields of its <del> * subclasses and extracts the {@code UIProp} annotation data to generate the <del> * {@code NativeProps} map. Example: <del> * <del> * {@code <del> * @UIProp(UIProp.Type.BOOLEAN) public static final String PROP_FOO = "foo"; <del> * @UIProp(UIProp.Type.STRING) public static final String PROP_BAR = "bar"; <del> * } <del> * <del> * TODO(krzysztof): Kill this class once @ReactProp refactoring is done <del> */ <del>@Target(ElementType.FIELD) <del>@Retention(RUNTIME) <del>public @interface UIProp { <del> Type value(); <del> <del> public static enum Type { <del> BOOLEAN("boolean"), <del> NUMBER("number"), <del> STRING("String"), <del> MAP("Map"), <del> ARRAY("Array"), <del> COLOR("Color"); <del> <del> private final String mType; <del> <del> Type(String type) { <del> mType = type; <del> } <del> <del> @Override <del> public String toString() { <del> return mType; <del> } <del> } <del>} <ide><path>ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManager.java <ide> <ide> import javax.annotation.Nullable; <ide> <del>import java.lang.reflect.Field; <del>import java.util.HashMap; <ide> import java.util.Map; <ide> <ide> import android.view.View; <ide> */ <ide> public abstract class ViewManager<T extends View, C extends ReactShadowNode> { <ide> <del> private static final Map<Class, Map<String, UIProp.Type>> CLASS_PROP_CACHE = new HashMap<>(); <del> <ide> public final void updateProperties(T viewToUpdate, CatalystStylesDiffMap props) { <ide> Map<String, ViewManagersPropertyCache.PropSetter> propSetters = <ide> ViewManagersPropertyCache.getNativePropSettersForViewManagerClass(getClass()); <ide> public void receiveCommand(T root, int commandId, @Nullable ReadableArray args) <ide> } <ide> <ide> public Map<String, String> getNativeProps() { <del> // TODO(krzysztof): This method will just delegate to ViewManagersPropertyRegistry once <del> // refactoring is finished <del> Class cls = getClass(); <del> Map<String, String> nativeProps = <del> ViewManagersPropertyCache.getNativePropsForView(cls, getShadowNodeClass()); <del> while (cls.getSuperclass() != null) { <del> Map<String, UIProp.Type> props = getNativePropsForClass(cls); <del> for (Map.Entry<String, UIProp.Type> entry : props.entrySet()) { <del> nativeProps.put(entry.getKey(), entry.getValue().toString()); <del> } <del> cls = cls.getSuperclass(); <del> } <del> return nativeProps; <del> } <del> <del> private Map<String, UIProp.Type> getNativePropsForClass(Class cls) { <del> // TODO(krzysztof): Blow up this method once refactoring is finished <del> Map<String, UIProp.Type> props = CLASS_PROP_CACHE.get(cls); <del> if (props != null) { <del> return props; <del> } <del> props = new HashMap<>(); <del> for (Field f : cls.getDeclaredFields()) { <del> UIProp annotation = f.getAnnotation(UIProp.class); <del> if (annotation != null) { <del> UIProp.Type type = annotation.value(); <del> try { <del> String name = (String) f.get(this); <del> props.put(name, type); <del> } catch (IllegalAccessException e) { <del> throw new RuntimeException( <del> "UIProp " + cls.getName() + "." + f.getName() + " must be public."); <del> } <del> } <del> } <del> CLASS_PROP_CACHE.put(cls, props); <del> return props; <add> return ViewManagersPropertyCache.getNativePropsForView(getClass(), getShadowNodeClass()); <ide> } <ide> } <ide><path>ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ReactProgressBarViewManager.java <ide> import com.facebook.react.uimanager.BaseViewManager; <ide> import com.facebook.react.uimanager.ReactProp; <ide> import com.facebook.react.uimanager.ThemedReactContext; <del>import com.facebook.react.uimanager.UIProp; <ide> <ide> /** <ide> * Manages instances of ProgressBar. ProgressBar is wrapped in a FrameLayout because the style of <ide><path>ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManager.java <ide> <ide> import com.facebook.react.bridge.JSApplicationIllegalArgumentException; <ide> import com.facebook.react.uimanager.BaseViewManager; <del>import com.facebook.react.uimanager.CatalystStylesDiffMap; <ide> import com.facebook.react.uimanager.PixelUtil; <ide> import com.facebook.react.uimanager.ReactProp; <ide> import com.facebook.react.uimanager.ThemedReactContext; <del>import com.facebook.react.uimanager.UIProp; <ide> import com.facebook.react.uimanager.ViewDefaults; <ide> import com.facebook.react.uimanager.ViewProps; <ide> import com.facebook.react.common.annotations.VisibleForTesting; <ide><path>ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java <ide> import com.facebook.react.uimanager.ReactProp; <ide> import com.facebook.react.uimanager.ThemedReactContext; <ide> import com.facebook.react.uimanager.UIManagerModule; <del>import com.facebook.react.uimanager.UIProp; <ide> import com.facebook.react.uimanager.ViewDefaults; <ide> import com.facebook.react.uimanager.ViewProps; <ide> import com.facebook.react.uimanager.events.EventDispatcher;
5
Python
Python
decrease timeout in test.py
1ce906c16ba09885fb372962a3a56ce64ef06a20
<ide><path>tools/test.py <ide> def Run(self, tasks): <ide> # Wait for the remaining threads <ide> for thread in threads: <ide> # Use a timeout so that signals (ctrl-c) will be processed. <del> thread.join(timeout=10000000) <add> thread.join(timeout=1000000) <ide> except (KeyboardInterrupt, SystemExit): <ide> self.shutdown_event.set() <ide> except Exception:
1
Ruby
Ruby
fix an error message in the subscription tests
06b59451ffadd2c93c0dec9520c1664448c6cfa4
<ide><path>test/channel/stream_test.rb <ide> def subscribed <ide> <ide> EM::Timer.new(0.1) do <ide> expected = ActiveSupport::JSON.encode "identifier" => "{id: 1}", "type" => "confirm_subscription" <del> assert_equal expected, connection.last_transmission, "Did not receive verification confirmation within 0.1s" <add> assert_equal expected, connection.last_transmission, "Did not receive subscription confirmation within 0.1s" <ide> <ide> EM.run_deferred_callbacks <ide> EM.stop
1
PHP
PHP
add better error message for missing app key
3a4fdd041c226c0299f0de8047d23ac3d1fbe675
<ide><path>src/Illuminate/Encryption/EncryptionServiceProvider.php <ide> <ide> namespace Illuminate\Encryption; <ide> <add>use RuntimeException; <ide> use Illuminate\Support\Str; <ide> use Illuminate\Support\ServiceProvider; <ide> <ide> public function register() <ide> $key = base64_decode(substr($key, 7)); <ide> } <ide> <add> if (is_null($key) || $key === '') { <add> throw new RuntimeException( <add> 'The application encryption key is missing. Run php artisan key:generate to generate it.' <add> ); <add> } <add> <ide> return new Encrypter($key, $config['cipher']); <ide> }); <ide> }
1
Javascript
Javascript
remove excess debug statements from flattenuser.js
d6ddd632d03f41704fd7ff774b5e278a5fda9551
<ide><path>seed/flattenUser.js <ide> function createConnection(URI) { <ide> <ide> function createQuery(db, collection, options, batchSize) { <ide> return Rx.Observable.create(function (observer) { <del> console.log('Creating cursor...'); <ide> var cursor = db.collection(collection).find({}, options); <ide> cursor.batchSize(batchSize || 20); <ide> // Cursor.each will yield all doc from a batch in the same tick, <ide> // or schedule getting next batch on nextTick <ide> cursor.each(function (err, doc) { <ide> if (err) { <del> console.log(err); <ide> return observer.onError(err); <ide> } <ide> if (!doc) { <del> console.log('hit complete'); <ide> return observer.onCompleted(); <ide> } <del> console.log('calling onnext'); <ide> observer.onNext(doc); <ide> }); <ide> <ide> return Rx.Disposable.create(function () { <del> console.log('Disposing cursor...'); <ide> cursor.close(); <ide> }); <ide> }); <ide> var userSavesCount = users <ide> }) <ide> .flatMap(function(dats) { <ide> // bulk insert into new collection for loopback <del> console.log(dats); <ide> return insertMany(dats.db, 'user', dats.users, { w: 1 }); <ide> }) <ide> // count how many times insert completes <ide> Rx.Observable.merge( <ide> count += _count * 20; <ide> }, <ide> function(err) { <del> console.log('an error occured', err, err.stack); <add> console.error('an error occured', err, err.stack); <ide> }, <ide> function() { <ide> console.log('finished with %s documents processed', count);
1
Ruby
Ruby
fix indentation of caskcommandfailederror
4f1ef16cbf09fc1b98143ff672859dcefda00e1b
<ide><path>Library/Homebrew/cask/lib/hbc/exceptions.rb <ide> def initialize(cmd, stdout, stderr, status) <ide> end <ide> <ide> def to_s <del> <<-EOS <del> Command failed to execute! <del> <del> ==> Failed command: <del> #{@cmd} <del> <del> ==> Standard Output of failed command: <del> #{@stdout} <del> <del> ==> Standard Error of failed command: <del> #{@stderr} <del> <del> ==> Exit status of failed command: <del> #{@status.inspect} <del> EOS <add> s = "Command failed to execute!\n" <add> s.concat("\n") <add> s.concat("==> Failed command:\n") <add> s.concat(@cmd).concat("\n") <add> s.concat("\n") <add> s.concat("==> Standard Output of failed command:\n") <add> s.concat(@stdout).concat("\n") <add> s.concat("\n") <add> s.concat("==> Standard Error of failed command:\n") <add> s.concat(@stderr).concat("\n") <add> s.concat("\n") <add> s.concat("==> Exit status of failed command:\n") <add> s.concat(@status.inspect).concat("\n") <ide> end <ide> end <ide>
1
Text
Text
replace github -> github (chinese)
2eb5683c9b18b05235401a69d1beef8037f61454
<ide><path>curriculum/challenges/chinese/06-information-security-and-quality-assurance/advanced-node-and-express/implementation-of-social-authentication.chinese.md <ide> localeTitle: 社会认证的实施 <ide> --- <ide> <ide> ## Description <del><section id="description">提醒一下,这个项目是基于<a href="https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-socialauth/">Glitch</a>的以下入门项目构建的,或者是从<a href="https://github.com/freeCodeCamp/boilerplate-socialauth/">GitHub</a>克隆的。此类身份验证在您的应用中遵循的基本路径是: <ol><li>用户单击按钮或链接将它们发送到我们使用特定策略进行身份验证的路由(EG.Github) </li><li>您的路由呼叫<code>passport.authenticate(&#39;github&#39;)</code> ,将其重定向到Github。 </li><li>用户登陆的页面,在Github上,允许他们登录,如果他们还没有。然后它要求他们批准从我们的应用程序访问他们的个人资料。 </li><li>然后,如果用户获得批准,则会使用他们的个人资料将该用户返回到我们的应用。 </li><li>它们现在已经过身份验证,您的应用应检查它是否为返回的配置文件,如果不是,则将其保存在数据库中。 </li></ol> OAuth策略要求您至少拥有<em>客户端ID</em>和<em>客户端密钥</em> ,以便他们验证身份验证请求的来源以及是否有效。这些是从您尝试使用Github实现身份验证的站点获得的,并且对您的应用程序是唯一的 - 它们不会被<b>共享</b> ,不应该上传到公共存储库或直接在您的代码中编写。通常的做法是将它们放在<em>.env</em>文件中并引用它们: <code>process.env.GITHUB_CLIENT_ID</code> 。对于这个挑战,我们将使用Github策略。 <em><em>从Github</em></em>获取您的<em>客户ID和密码<em>是在“开发者设置”下的帐户配置文件设置中完成的,然后是“ <a href="https://github.com/settings/developers">OAuth应用程序</a> ”。点击“注册一个新的应用程序”,为您的应用命名,将网址粘贴到您的故障主页( <b>不是项目代码的网址</b> ),最后为回调网址,粘贴到与主页相同的网址,但使用&#39;/ auth / github / callback&#39;已添加。这是用户将被重定向到我们在Github上进行身份验证后处理的地方。将返回的信息保存为.env文件中的“GITHUB_CLIENT_ID”和“GITHUB_CLIENT_SECRET”。在重新混合的项目中,创建2条接受GET请求的路由:/ auth / github和/ auth / github / callback。第一个应该只调用护照来验证&#39;github&#39;,第二个应该调用护照来验证&#39;github&#39;,失败重定向到&#39;/&#39;然后如果成功重定向到&#39;/ profile&#39;(类似于我们的上一个项目)。 &#39;/ auth / github / callback&#39;应该如何看待的示例与我们在上一个项目中处理正常登录的方式类似:</em></em> <pre> <em><em>app.route( &#39;/登录&#39;) <add><section id="description">提醒一下,这个项目是基于<a href="https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-socialauth/">Glitch</a>的以下入门项目构建的,或者是从<a href="https://github.com/freeCodeCamp/boilerplate-socialauth/">GitHub</a>克隆的。此类身份验证在您的应用中遵循的基本路径是: <ol><li>用户单击按钮或链接将它们发送到我们使用特定策略进行身份验证的路由(EG.GitHub) </li><li>您的路由呼叫<code>passport.authenticate(&#39;github&#39;)</code> ,将其重定向到Github。 </li><li>用户登陆的页面,在Github上,允许他们登录,如果他们还没有。然后它要求他们批准从我们的应用程序访问他们的个人资料。 </li><li>然后,如果用户获得批准,则会使用他们的个人资料将该用户返回到我们的应用。 </li><li>它们现在已经过身份验证,您的应用应检查它是否为返回的配置文件,如果不是,则将其保存在数据库中。 </li></ol> OAuth策略要求您至少拥有<em>客户端ID</em>和<em>客户端密钥</em> ,以便他们验证身份验证请求的来源以及是否有效。这些是从您尝试使用Github实现身份验证的站点获得的,并且对您的应用程序是唯一的 - 它们不会被<b>共享</b> ,不应该上传到公共存储库或直接在您的代码中编写。通常的做法是将它们放在<em>.env</em>文件中并引用它们: <code>process.env.GITHUB_CLIENT_ID</code> 。对于这个挑战,我们将使用Github策略。 <em><em>从Github</em></em>获取您的<em>客户ID和密码<em>是在“开发者设置”下的帐户配置文件设置中完成的,然后是“ <a href="https://github.com/settings/developers">OAuth应用程序</a> ”。点击“注册一个新的应用程序”,为您的应用命名,将网址粘贴到您的故障主页( <b>不是项目代码的网址</b> ),最后为回调网址,粘贴到与主页相同的网址,但使用&#39;/ auth / github / callback&#39;已添加。这是用户将被重定向到我们在Github上进行身份验证后处理的地方。将返回的信息保存为.env文件中的“GITHUB_CLIENT_ID”和“GITHUB_CLIENT_SECRET”。在重新混合的项目中,创建2条接受GET请求的路由:/ auth / github和/ auth / github / callback。第一个应该只调用护照来验证&#39;github&#39;,第二个应该调用护照来验证&#39;github&#39;,失败重定向到&#39;/&#39;然后如果成功重定向到&#39;/ profile&#39;(类似于我们的上一个项目)。 &#39;/ auth / github / callback&#39;应该如何看待的示例与我们在上一个项目中处理正常登录的方式类似:</em></em> <pre> <em><em>app.route( &#39;/登录&#39;) <ide> .post(passport.authenticate(&#39;local&#39;,{failureRedirect:&#39;/&#39;}),(req,res)=&gt; { <ide> res.redirect( &#39;/简档&#39;); <ide> });</em></em> </pre> <em><em>当您认为自己已经做对时,请提交您的页面。如果您遇到错误,可以<a href="https://gist.github.com/JosephLivengood/28ea2cae7e1dc6a53d7f0c42d987313b">在此处</a>查看项目。</em></em> </section> <ide><path>guide/chinese/electron/index.md <ide> Electron基于Chromium(谷歌浏览器的开源版本)。Electron是在2013 <ide> * [Skype](https://www.skype.com/) (微软流行的视频聊天应用程序) <ide> * [Slack](https://slack.com/) (团队的消息传递应用程序) <ide> * [Discord](https://discordapp.com) (适合游戏玩家的流行消息应用) <del>* [Github Desktop](https://desktop.github.com/) (官方Github桌面客户端) <add>* [GitHub Desktop](https://desktop.github.com/) (官方Github桌面客户端) <ide> <ide> 您可以从[Electron的网页](https://electronjs.org/apps)查询更多使用Electron构建的应用。 <ide> <ide><path>guide/chinese/javascript/async-messaging-with-rabbitmq-tortoise/index.md <ide> RabbitMQ恰好是目前使用AMQ协议的最简单,性能最高的消息代理 <ide> <ide> ## 入门 <ide> <del>我们将编写一个非常简单的示例,其中发布者脚本向Rabbit发布消息,其中包含URL,消费者脚本侦听Rabbit,获取已发布的U​​RL,调用它并显示结果。您可以在[Github](https://github.com/rudimk/freecodecamp-guides-rabbitmq-tortoise)上找到完成的样本。 <add>我们将编写一个非常简单的示例,其中发布者脚本向Rabbit发布消息,其中包含URL,消费者脚本侦听Rabbit,获取已发布的U​​RL,调用它并显示结果。您可以在[GitHub](https://github.com/rudimk/freecodecamp-guides-rabbitmq-tortoise)上找到完成的样本。 <ide> <ide> 首先,让我们初始化一个npm项目: <ide> <ide> tortoise <ide> <ide> ## 结论 <ide> <del>与使用RabbitMQ进行消息传递相关的简单性是无与伦比的,只需几行代码就可以很容易地得到非常复杂的微服务模式。最好的部分是消息传递背后的逻辑并没有真正改变语言--Crystal或Go或Python或Ruby以几乎相同的方式与Rabbit一起工作 - 这意味着您可以使用不同语言编写的服务可以毫不费力地相互通信,使您能够使用最好的语言来完成工作。 <ide>\ No newline at end of file <add>与使用RabbitMQ进行消息传递相关的简单性是无与伦比的,只需几行代码就可以很容易地得到非常复杂的微服务模式。最好的部分是消息传递背后的逻辑并没有真正改变语言--Crystal或Go或Python或Ruby以几乎相同的方式与Rabbit一起工作 - 这意味着您可以使用不同语言编写的服务可以毫不费力地相互通信,使您能够使用最好的语言来完成工作。 <ide><path>guide/chinese/miscellaneous/creating-a-new-github-issue/index.md <ide> --- <del>title: Creating a New Github Issue <add>title: Creating a New GitHub Issue <ide> localeTitle: 创建一个新的Github问题 <ide> --- <ide> 在提交问题之前,请尝试[在Github上搜索您的问题](https://forum.freecodecamp.com/t/searching-for-existing-issues-in-github/18390) <ide> <ide> 制定一个好的问题将使开发团队更容易复制和解决您的问题。请按照以下步骤操作: <ide> <del>1. 转到FreeCodeCamp的[Github Issues](https://github.com/FreeCodeCamp/FreeCodeCamp/issues)页面,然后单击`New Issue` 。 <add>1. 转到FreeCodeCamp的[GitHub Issues](https://github.com/FreeCodeCamp/FreeCodeCamp/issues)页面,然后单击`New Issue` 。 <ide> <ide> 2. **有一个有用的标题** <ide> <ide> localeTitle: 创建一个新的Github问题 <ide> <ide> 6. **截取**该问题**的屏幕截图**并将其包含在帖子中。 <ide> <del>7. 点击`Submit New Issue` ,你就完成了!您将自动订阅任何更新或未来评论的通知。 <ide>\ No newline at end of file <add>7. 点击`Submit New Issue` ,你就完成了!您将自动订阅任何更新或未来评论的通知。 <ide><path>guide/chinese/miscellaneous/emojis-for-gitter-and-github/index.md <ide> --- <del>title: Emojis for Gitter and Github <add>title: Emojis for Gitter and GitHub <ide> localeTitle: Gitter和Github的Emojis <ide> --- <del>Gitter IM和GitHub都支持一系列酷表情符号(表情符号)。来自`:sunny:` ![:sunny:](//forum.freecodecamp.com/images/emoji/emoji_one/sunny.png?v=2 ":晴天:") to `:poop:` ![:poop:](//forum.freecodecamp.com/images/emoji/emoji_one/poop.png?v=2 ":船尾:")你可以表达一系列的情感! <ide>\ No newline at end of file <add>Gitter IM和GitHub都支持一系列酷表情符号(表情符号)。来自`:sunny:` ![:sunny:](//forum.freecodecamp.com/images/emoji/emoji_one/sunny.png?v=2 ":晴天:") to `:poop:` ![:poop:](//forum.freecodecamp.com/images/emoji/emoji_one/poop.png?v=2 ":船尾:")你可以表达一系列的情感! <ide><path>guide/chinese/miscellaneous/learn-a-little-about-latex/index.md <ide> $$\huge\textstyle\color{#F00}{BigRed}\small\textstyle\color{#0F0}{SmallGreen}$$ <ide> <ide> ## 细节 <ide> <del>[KaTeX Github Repo](https://github.com/Khan/KaTeX) LaTeX是一种高品质的排版系统;它包括为生产技术和科学文档而设计的功能。 LaTeX是科学文献交流和出版的事实标准。他的优点在书籍,论文或论文等长篇文件中都很明显。 <add>[KaTeX GitHub Repo](https://github.com/Khan/KaTeX) LaTeX是一种高品质的排版系统;它包括为生产技术和科学文档而设计的功能。 LaTeX是科学文献交流和出版的事实标准。他的优点在书籍,论文或论文等长篇文件中都很明显。 <ide> <ide> Gitter使用Katex(LaTeX的自定义实现),可以使用它来介绍以下代码: <ide> ``` <ide> $$\begin{array} {cc} <ide> 文本: <ide> <ide> * `$$\huge\textstyle{some text}$$` - > $$ \\ huge \\ textstyle {some text} $$ <del>* `$$\color{#F90}{some text}$$` - > $$ \\ color {#F90} {some text} $$ <ide>\ No newline at end of file <add>* `$$\color{#F90}{some text}$$` - > $$ \\ color {#F90} {some text} $$ <ide><path>guide/chinese/miscellaneous/learn-about-the-latex-language/index.md <ide> $$\huge\textstyle\color{#F00}{BigRed}\small\textstyle\color{#0F0}{SmallGreen}$$ <ide> <ide> ## 细节 <ide> <del>[KaTeX Github Repo](https://github.com/Khan/KaTeX) LaTeX是一种高品质的排版系统;它包括为生产技术和科学文档而设计的功能。 LaTeX是科学文献交流和出版的事实标准。他的优点在书籍,论文或论文等长文档中都很明显。 <add>[KaTeX GitHub Repo](https://github.com/Khan/KaTeX) LaTeX是一种高品质的排版系统;它包括为生产技术和科学文档而设计的功能。 LaTeX是科学文献交流和出版的事实标准。他的优点在书籍,论文或论文等长文档中都很明显。 <ide> <ide> Gitter使用Katex(LaTeX的自定义实现),可以使用它来介绍以下代码: <ide> ``` <ide> $$\begin{array} {cc} <ide> 文本: <ide> <ide> * `$$\huge\textstyle{some text}$$` - > $$ \\ huge \\ textstyle {some text} $$ <del>* `$$\color{#F90}{some text}$$` - > $$ \\ color {#F90} {some text} $$ <ide>\ No newline at end of file <add>* `$$\color{#F90}{some text}$$` - > $$ \\ color {#F90} {some text} $$ <ide><path>guide/chinese/miscellaneous/linking-your-account-with-github/index.md <ide> --- <del>title: Linking Your Account with Github <add>title: Linking Your Account with GitHub <ide> localeTitle: 将您的帐户与Github链接 <ide> --- <ide> 2015年8月,我们推动了一些为我们的许多露营者带来麻烦的变化。 <ide> localeTitle: 将您的帐户与Github链接 <ide> 1)使用您当前的帐户退出并尝试使用GitHub登录。 <ide> 2)检查您的挑战地图。您的帐户应该没有进展。在此处删除该帐户: [http](http://freecodecamp.com/account) : [//freecodecamp.com/account](http://freecodecamp.com/account) <ide> 3)以通常的方式登录免费代码营(Facebook,电子邮件等)。你应该看到你原来的进步。 <del>3)现在将GitHub添加到该帐户,您应该全部设置。 <ide>\ No newline at end of file <add>3)现在将GitHub添加到该帐户,您应该全部设置。 <ide><path>guide/chinese/miscellaneous/running-webpack-and-webpack-dev-server/index.md <ide> This is one cool app! <ide> <ide> [Webpack网站](https://webpack.js.org/) <ide> <del>[Webpack Github](https://github.com/webpack/webpack) <add>[Webpack GitHub](https://github.com/webpack/webpack) <ide> <del>[webpack-dev-server Github](https://github.com/webpack/webpack-dev-server) <ide>\ No newline at end of file <add>[webpack-dev-server GitHub](https://github.com/webpack/webpack-dev-server) <ide><path>guide/chinese/miscellaneous/searching-for-existing-issues-in-github/index.md <ide> --- <del>title: Searching for Existing Issues in Github <add>title: Searching for Existing Issues in GitHub <ide> localeTitle: 在Github中搜索现有问题 <ide> --- <ide> 如果在获得Gitter帮助后仍然看到问题,您将需要尝试查看是否有其他人发布了类似问题。 <ide> localeTitle: 在Github中搜索现有问题 <ide> <ide> * 如果找到一个,请阅读!您可以通过单击侧栏中的“ `Subscribe`来订阅以获取有关该特定问题的更新。如果您要添加某些内容,也可以对此问题发表评论。 <ide> <del> * 如果您找不到任何相关问题,您应该创建一个新的Github问题 。 <ide>\ No newline at end of file <add> * 如果您找不到任何相关问题,您应该创建一个新的Github问题 。 <ide><path>guide/chinese/miscellaneous/use-github-static-pages-to-host-your-front-end-projects/index.md <ide> --- <del>title: Use Github Static Pages to Host Your Front End Projects <add>title: Use GitHub Static Pages to Host Your Front End Projects <ide> localeTitle: 使用Github静态页面来托管您的前端项目 <ide> --- <ide> **优点** <ide> localeTitle: 使用Github静态页面来托管您的前端项目 <ide> <ide> ## Git到Github <ide> <del>由于我已经在本地保存,并使用git进行版本控制,我想也可以上传到Github。此外,Github还为前端项目提供了一个非常棒的免费服务,称为[Github Pages](https://pages.github.com/) 。只需更新您的仓库,您的更改即会生效。 <add>由于我已经在本地保存,并使用git进行版本控制,我想也可以上传到Github。此外,Github还为前端项目提供了一个非常棒的免费服务,称为[GitHub Pages](https://pages.github.com/) 。只需更新您的仓库,您的更改即会生效。 <ide> <ide> 它的工作原理很简单。 Github检查您的存储库是否有一个名为`gh-pages`的分支,并提供位于该分支中的任何代码。这里没有后端内容,但HTML,CSS和JS就像魅力一样。 <ide> <ide> localeTitle: 使用Github静态页面来托管您的前端项目 <ide> <ide> 快乐的编码! <ide> <del>PS。感谢Roger Dudler的[这本指南](http://rogerdudler.github.io/git-guide/) ,让事情变得简单。 <ide>\ No newline at end of file <add>PS。感谢Roger Dudler的[这本指南](http://rogerdudler.github.io/git-guide/) ,让事情变得简单。 <ide><path>guide/chinese/miscellaneous/writing-a-markdown-file-for-github-using-atom/index.md <ide> --- <del>title: Writing a Markdown File for Github Using Atom <add>title: Writing a Markdown File for GitHub Using Atom <ide> localeTitle: 使用Atom为Github写一个Markdown文件 <ide> --- <ide> Markdown是一种在Web上设置文本样式的方法,GitHub用户使用markdown为其存储库提供文档。 <ide> Markdown文件很容易编写,你可以[在这里](https://github.com/adam-p/m <ide> <ide> 要将项目或文件添加到GitHub,请转到[此页面](https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/) 。 <ide> <del>**奖金步骤:** Atom有一个名为[Markdown Preview Plus](https://atom.io/packages/markdown-preview-plus)的软件包。它与普通的降价预览器相同,但预览文件的样式更准确地符合GitHub样式。继续安装此软件包,看看你得到了什么。 <ide>\ No newline at end of file <add>**奖金步骤:** Atom有一个名为[Markdown Preview Plus](https://atom.io/packages/markdown-preview-plus)的软件包。它与普通的降价预览器相同,但预览文件的样式更准确地符合GitHub样式。继续安装此软件包,看看你得到了什么。 <ide><path>guide/chinese/react/what-are-react-props/index.md <del>--- <del>title: React TypeChecking with PropTypes <del>localeTitle: 使用PropTypes进行React TypeChecking <del>--- <ide>## 反应PropTypes <add>--- <add>title: React TypeChecking with PropTypes <add>localeTitle: 使用PropTypes进行React TypeChecking <add>--- <add>## 反应PropTypes <ide> <ide> 当应用程序趋于增长时,这些可以作为一种类型检查的方法,通过使用此功能,可以纠正非常大的错误基础。 <ide> <ide> import React,{Component} from 'react'; <ide> <ide> 有关React上PropTypes和其他文档的更多信息。 <ide> <del>访问[官方网站](https://reactjs.org/)并阅读文档或[Github Repo](https://github.com/facebook/react/) <ide>\ No newline at end of file <add>访问[官方网站](https://reactjs.org/)并阅读文档或[GitHub Repo](https://github.com/facebook/react/) <ide><path>guide/chinese/redux/redux-thunk/index.md <ide> import { createStore, applyMiddleware } from 'redux'; <ide> <ide> ### 参考 <ide> <del>* [Redux Thunk Github Repo](https://github.com/reduxjs/redux-thunk) <add>* [Redux Thunk GitHub Repo](https://github.com/reduxjs/redux-thunk) <ide> * [Redux中间件](https://redux.js.org/advanced/middleware) <ide> <ide> ### 来源 <ide> <del>1. [增量计数器示例引自Redux Thunk Documentation,10/02/201](#https://github.com/reduxjs/redux-thunk) <ide>\ No newline at end of file <add>1. [增量计数器示例引自Redux Thunk Documentation,10/02/201](#https://github.com/reduxjs/redux-thunk) <ide><path>guide/chinese/ruby/index.md <ide> Ruby有几个用于快速搭建应用程序的框架(gem)。到目前为止 <ide> <ide> ## 学习Ruby之后会怎么样? <ide> <del>每种编程语言都扮演着重要的角色。您可以为许多开源项目做出贡献,或者在掌握了Ruby之后可以申请一些大公司。许多大型互联网网站,如Basecamp,Airbnb,Bleacher Report,Fab.com,Scribd,Groupon,Gumroad,Hulu,Kickstarter,Pitchfork,Sendgrid,Soundcloud,Square,Yammer,Crunchbase,Slideshare,Funny or Die,Zendesk,Github, Shopify建立在Ruby之上,因此有很多选择。 此外,许多初创公司正在招聘RUby on Rails技能的人,因为没有多少程序员试图学习Ruby。所以,你可能有一个明确的工作在一家初创公司工作。 因此,Ruby是初学者友好的,并且非常难以发现你有很多空缺可以作为开发人员工作。 <ide>\ No newline at end of file <add>每种编程语言都扮演着重要的角色。您可以为许多开源项目做出贡献,或者在掌握了Ruby之后可以申请一些大公司。许多大型互联网网站,如Basecamp,Airbnb,Bleacher Report,Fab.com,Scribd,Groupon,Gumroad,Hulu,Kickstarter,Pitchfork,Sendgrid,Soundcloud,Square,Yammer,Crunchbase,Slideshare,Funny or Die,Zendesk,GitHub, Shopify建立在Ruby之上,因此有很多选择。 此外,许多初创公司正在招聘RUby on Rails技能的人,因为没有多少程序员试图学习Ruby。所以,你可能有一个明确的工作在一家初创公司工作。 因此,Ruby是初学者友好的,并且非常难以发现你有很多空缺可以作为开发人员工作。 <ide><path>guide/chinese/wordpress/index.md <ide> WordPress的优点包括: <ide> * [WordPress: 官方网站](https://wordpress.org/) <ide> * [WordPress Codex:在线手册](https://codex.wordpress.org/) <ide> * [WordPress代码参考](https://developer.wordpress.org/reference/) <del>* [WordPress Github Repository](https://github.com/WordPress/WordPress) <add>* [WordPress GitHub Repository](https://github.com/WordPress/WordPress) <ide>
16
Go
Go
use netlink directly instead of /bin/ip in sysinit
607c1a520e6d39d0f0ee21f1d281931484206b57
<ide><path>sysinit.go <ide> package docker <ide> import ( <ide> "flag" <ide> "fmt" <add> "github.com/dotcloud/docker/netlink" <ide> "github.com/dotcloud/docker/utils" <ide> "log" <add> "net" <ide> "os" <ide> "os/exec" <ide> "strconv" <ide> func setupNetworking(gw string) { <ide> if gw == "" { <ide> return <ide> } <del> if _, err := ip("route", "add", "default", "via", gw); err != nil { <add> <add> ip := net.ParseIP(gw) <add> if ip == nil { <add> log.Fatalf("Unable to set up networking, %s is not a valid IP", gw) <add> return <add> } <add> <add> if err := netlink.AddDefaultGw(ip); err != nil { <ide> log.Fatalf("Unable to set up networking: %v", err) <ide> } <ide> }
1
Text
Text
add extends for derived classes
89aea1514b3b44d4b60c6c556aa70e9ffed46391
<ide><path>doc/api/child_process.md <ide> arbitrary command execution.** <ide> added: v2.2.0 <ide> --> <ide> <del>Instances of the `ChildProcess` class are [`EventEmitters`][`EventEmitter`] that <del>represent spawned child processes. <add>* Extends: {EventEmitter} <add> <add>Instances of the `ChildProcess` represent spawned child processes. <ide> <ide> Instances of `ChildProcess` are not intended to be created directly. Rather, <ide> use the [`child_process.spawn()`][], [`child_process.exec()`][], <ide><path>doc/api/cluster.md <ide> also be used for other use cases requiring worker processes. <ide> added: v0.7.0 <ide> --> <ide> <add>* Extends: {EventEmitter} <add> <ide> A `Worker` object contains all public information and method about a worker. <ide> In the master it can be obtained using `cluster.workers`. In a worker <ide> it can be obtained using `cluster.worker`. <ide><path>doc/api/dgram.md <ide> server.bind(41234); <ide> added: v0.1.99 <ide> --> <ide> <del>The `dgram.Socket` object is an [`EventEmitter`][] that encapsulates the <del>datagram functionality. <add>* Extends: {EventEmitter} <add> <add>Encapsulates the datagram functionality. <ide> <ide> New instances of `dgram.Socket` are created using [`dgram.createSocket()`][]. <ide> The `new` keyword is not to be used to create `dgram.Socket` instances. <ide> and `udp6` sockets). The bound address and port can be retrieved using <ide> [`Error`]: errors.html#errors_class_error <ide> [`ERR_SOCKET_DGRAM_IS_CONNECTED`]: errors.html#errors_err_socket_dgram_is_connected <ide> [`ERR_SOCKET_DGRAM_NOT_CONNECTED`]: errors.html#errors_err_socket_dgram_not_connected <del>[`EventEmitter`]: events.html <ide> [`System Error`]: errors.html#errors_class_systemerror <ide> [`close()`]: #dgram_socket_close_callback <ide> [`cluster`]: cluster.html <ide><path>doc/api/domain.md <ide> serverDomain.run(() => { <ide> <ide> ## Class: Domain <ide> <add>* Extends: {EventEmitter} <add> <ide> The `Domain` class encapsulates the functionality of routing errors and <ide> uncaught exceptions to the active `Domain` object. <ide> <del>`Domain` is a child class of [`EventEmitter`][]. To handle the errors that it <del>catches, listen to its `'error'` event. <add>To handle the errors that it catches, listen to its `'error'` event. <ide> <ide> ### domain.members <ide> <ide> Promises. In other words, no `'error'` event will be emitted for unhandled <ide> `Promise` rejections. <ide> <ide> [`Error`]: errors.html#errors_class_error <del>[`EventEmitter`]: events.html#events_class_eventemitter <ide> [`domain.add(emitter)`]: #domain_domain_add_emitter <ide> [`domain.bind(callback)`]: #domain_domain_bind_callback <ide> [`domain.exit()`]: #domain_domain_exit <ide><path>doc/api/inspector.md <ide> An exception will be thrown if there is no active inspector. <ide> <ide> ## Class: inspector.Session <ide> <add>* Extends: {EventEmitter} <add> <ide> The `inspector.Session` is used for dispatching messages to the V8 inspector <ide> back-end and receiving message responses and notifications. <ide> <ide> Create a new instance of the `inspector.Session` class. The inspector session <ide> needs to be connected through [`session.connect()`][] before the messages <ide> can be dispatched to the inspector backend. <ide> <del>`inspector.Session` is an [`EventEmitter`][] with the following events: <del> <ide> ### Event: 'inspectorNotification' <ide> <!-- YAML <ide> added: v8.0.0 <ide> session.post('HeapProfiler.takeHeapSnapshot', null, (err, r) => { <ide> ``` <ide> <ide> [`'Debugger.paused'`]: https://chromedevtools.github.io/devtools-protocol/v8/Debugger#event-paused <del>[`EventEmitter`]: events.html#events_class_eventemitter <ide> [`session.connect()`]: #inspector_session_connect <ide> [CPU Profiler]: https://chromedevtools.github.io/devtools-protocol/v8/Profiler <ide> [Chrome DevTools Protocol Viewer]: https://chromedevtools.github.io/devtools-protocol/v8/ <ide><path>doc/api/net.md <ide> net.createServer().listen( <ide> added: v0.1.90 <ide> --> <ide> <add>* Extends: {EventEmitter} <add> <ide> This class is used to create a TCP or [IPC][] server. <ide> <ide> ### new net.Server([options][, connectionListener]) <ide> active server in the event system. If the server is already `unref`ed calling <ide> added: v0.3.4 <ide> --> <ide> <add>* Extends: {stream.Duplex} <add> <ide> This class is an abstraction of a TCP socket or a streaming [IPC][] endpoint <del>(uses named pipes on Windows, and Unix domain sockets otherwise). A <del>`net.Socket` is also a [duplex stream][], so it can be both readable and <del>writable, and it is also an [`EventEmitter`][]. <add>(uses named pipes on Windows, and Unix domain sockets otherwise). It is also <add>an [`EventEmitter`][]. <ide> <ide> A `net.Socket` can be created by the user and used directly to interact with <ide> a server. For example, it is returned by [`net.createConnection()`][], <ide> Returns `true` if input is a version 6 IP address, otherwise returns `false`. <ide> [IPC]: #net_ipc_support <ide> [Identifying paths for IPC connections]: #net_identifying_paths_for_ipc_connections <ide> [Readable Stream]: stream.html#stream_class_stream_readable <del>[duplex stream]: stream.html#stream_class_stream_duplex <ide> [half-closed]: https://tools.ietf.org/html/rfc1122 <ide> [stream_writable_write]: stream.html#stream_writable_write_chunk_encoding_callback <ide> [unspecified IPv4 address]: https://en.wikipedia.org/wiki/0.0.0.0 <ide><path>doc/api/readline.md <ide> received on the `input` stream. <ide> added: v0.1.104 <ide> --> <ide> <add>* Extends: {EventEmitter} <add> <ide> Instances of the `readline.Interface` class are constructed using the <ide> `readline.createInterface()` method. Every instance is associated with a <ide> single `input` [Readable][] stream and a single `output` [Writable][] stream. <ide><path>doc/api/repl.md <ide> function myWriter(output) { <ide> added: v0.1.91 <ide> --> <ide> <del>The `repl.REPLServer` class inherits from the [`readline.Interface`][] class. <add>* Extends: {readline.Interface} <add> <ide> Instances of `repl.REPLServer` are created using the `repl.start()` method and <ide> *should not* be created directly using the JavaScript `new` keyword. <ide> <ide> For an example of running a REPL instance over [curl(1)][], see: <ide> [`domain`]: domain.html <ide> [`process.setUncaughtExceptionCaptureCallback()`]: process.html#process_process_setuncaughtexceptioncapturecallback_fn <ide> [`readline.InterfaceCompleter`]: readline.html#readline_use_of_the_completer_function <del>[`readline.Interface`]: readline.html#readline_class_interface <ide> [`repl.ReplServer`]: #repl_class_replserver <ide> [`util.inspect()`]: util.html#util_util_inspect_object_options <ide> [curl(1)]: https://curl.haxx.se/docs/manpage.html <ide><path>doc/api/tty.md <ide> classes. <ide> added: v0.5.8 <ide> --> <ide> <del>The `tty.ReadStream` class is a subclass of [`net.Socket`][] that represents the <del>readable side of a TTY. In normal circumstances [`process.stdin`][] will be the <del>only `tty.ReadStream` instance in a Node.js process and there should be no <del>reason to create additional instances. <add>* Extends: {net.Socket} <add> <add>Represents the readable side of a TTY. In normal circumstances <add>[`process.stdin`][] will be the only `tty.ReadStream` instance in a Node.js <add>process and there should be no reason to create additional instances. <ide> <ide> ### readStream.isRaw <ide> <!-- YAML <ide> terminal is disabled, including echoing input characters. <ide> added: v0.5.8 <ide> --> <ide> <del>The `tty.WriteStream` class is a subclass of [`net.Socket`][] that represents <del>the writable side of a TTY. In normal circumstances, [`process.stdout`][] and <del>[`process.stderr`][] will be the only `tty.WriteStream` instances created for a <del>Node.js process and there should be no reason to create additional instances. <add>* Extends: {net.Socket} <add> <add>Represents the writable side of a TTY. In normal circumstances, <add>[`process.stdout`][] and [`process.stderr`][] will be the only <add>`tty.WriteStream` instances created for a Node.js process and there <add>should be no reason to create additional instances. <ide> <ide> ### Event: 'resize' <ide> <!-- YAML <ide> The `tty.isatty()` method returns `true` if the given `fd` is associated with <ide> a TTY and `false` if it is not, including whenever `fd` is not a non-negative <ide> integer. <ide> <del>[`net.Socket`]: net.html#net_class_net_socket <ide> [`process.stderr`]: process.html#process_process_stderr <ide> [`process.stdin`]: process.html#process_process_stdin <ide> [`process.stdout`]: process.html#process_process_stdout
9
Javascript
Javascript
increase coverage for modulemap
d1a9c029a09165ea7b9ae799d701fab8a204fe05
<ide><path>test/es-module/test-esm-loader-modulemap.js <add>'use strict'; <add>// Flags: --expose-internals <add> <add>// This test ensures that the type checking of ModuleMap throws <add>// errors appropriately <add> <add>const common = require('../common'); <add> <add>const { URL } = require('url'); <add>const Loader = require('internal/loader/Loader'); <add>const ModuleMap = require('internal/loader/ModuleMap'); <add>const ModuleJob = require('internal/loader/ModuleJob'); <add>const { createDynamicModule } = require('internal/loader/ModuleWrap'); <add> <add>const stubModuleUrl = new URL('file://tmp/test'); <add>const stubModule = createDynamicModule(['default'], stubModuleUrl); <add>const loader = new Loader(); <add>const moduleMap = new ModuleMap(); <add>const moduleJob = new ModuleJob(loader, stubModule.module, <add> () => new Promise(() => {})); <add> <add>common.expectsError( <add> () => moduleMap.get(1), <add> { <add> code: 'ERR_INVALID_ARG_TYPE', <add> type: TypeError, <add> message: 'The "url" argument must be of type string' <add> } <add>); <add> <add>common.expectsError( <add> () => moduleMap.set(1, moduleJob), <add> { <add> code: 'ERR_INVALID_ARG_TYPE', <add> type: TypeError, <add> message: 'The "url" argument must be of type string' <add> } <add>); <add> <add>common.expectsError( <add> () => moduleMap.set('somestring', 'notamodulejob'), <add> { <add> code: 'ERR_INVALID_ARG_TYPE', <add> type: TypeError, <add> message: 'The "job" argument must be of type ModuleJob' <add> } <add>); <add> <add>common.expectsError( <add> () => moduleMap.has(1), <add> { <add> code: 'ERR_INVALID_ARG_TYPE', <add> type: TypeError, <add> message: 'The "url" argument must be of type string' <add> } <add>);
1
Text
Text
fix a typo in data-structures.md
16f6b8cb413ef59ac8eaf4235e230e5efe8b7c3c
<ide><path>docs/general/data-structures.md <ide> The `data` property of a dataset can be passed in various formats. By default, that `data` is parsed using the associated chart type and scales. <ide> <ide> If the `labels` property of the main `data` property is used, it has to contain the same amount of elements as the dataset with the most values. These labels are used to label the index axis (default x axes). The values for the labels have to be provided in an array. <del>The provides labels can be of the type string or number to be rendered correctly. In case you want multiline labels you can provide an array with each line as one entry in the array. <add>The provided labels can be of the type string or number to be rendered correctly. In case you want multiline labels you can provide an array with each line as one entry in the array. <ide> <ide> ## Primitive[] <ide>
1
Javascript
Javascript
fix a test
39c6536bccf2ff6d51f5ab91b3883df72400ba11
<ide><path>test/index.js <ide> test(async t => { <ide> <ide> test(async t => { <ide> const html = await render('/css') <del> t.true(html.includes('.css-im3wl1')) <del> t.true(html.includes('<div class="css-im3wl1">This is red</div>')) <add> t.regex(html, /\.css-\w+/) <add> t.regex(html, /<div class="css-\w+">This is red<\/div>/) <ide> }) <ide> <ide> test(async t => {
1
Javascript
Javascript
remove warning for dangling passive effects
3c4c1c4703e8f7362370c44a48ac9348229e3791
<ide><path>packages/react-dom/src/__tests__/ReactTestUtilsAct-test.js <ide> describe('ReactTestUtils.act()', () => { <ide> }).toErrorDev([]); <ide> }); <ide> <del> it('warns in strict mode', () => { <del> expect(() => { <del> ReactDOM.render( <del> <React.StrictMode> <del> <App /> <del> </React.StrictMode>, <del> document.createElement('div'), <del> ); <del> }).toErrorDev([ <del> 'An update to App ran an effect, but was not wrapped in act(...)', <del> ]); <del> }); <del> <ide> // @gate __DEV__ <ide> it('does not warn in concurrent mode', () => { <ide> const root = ReactDOM.createRoot(document.createElement('div')); <ide> act(() => root.render(<App />)); <ide> Scheduler.unstable_flushAll(); <ide> }); <del> <del> it('warns in concurrent mode if root is strict', () => { <del> // TODO: We don't need this error anymore in concurrent mode because <del> // effects can only be scheduled as the result of an update, and we now <del> // enforce all updates must be wrapped with act, not just hook updates. <del> expect(() => { <del> const root = ReactDOM.createRoot(document.createElement('div'), { <del> unstable_strictMode: true, <del> }); <del> root.render(<App />); <del> }).toErrorDev( <del> 'An update to Root inside a test was not wrapped in act(...)', <del> {withoutStack: true}, <del> ); <del> expect(() => Scheduler.unstable_flushAll()).toErrorDev( <del> 'An update to App ran an effect, but was not wrapped in act(...)', <del> ); <del> }); <ide> }); <ide> }); <ide> <ide><path>packages/react-reconciler/src/ReactFiberHooks.new.js <ide> import { <ide> scheduleUpdateOnFiber, <ide> requestUpdateLane, <ide> requestEventTime, <del> warnIfNotCurrentlyActingEffectsInDEV, <ide> markSkippedUpdateLanes, <ide> isInterleavedUpdate, <ide> } from './ReactFiberWorkLoop.new'; <ide> function mountEffect( <ide> create: () => (() => void) | void, <ide> deps: Array<mixed> | void | null, <ide> ): void { <del> if (__DEV__) { <del> warnIfNotCurrentlyActingEffectsInDEV(currentlyRenderingFiber); <del> } <ide> if ( <ide> __DEV__ && <ide> enableStrictEffects && <ide> function updateEffect( <ide> create: () => (() => void) | void, <ide> deps: Array<mixed> | void | null, <ide> ): void { <del> if (__DEV__) { <del> warnIfNotCurrentlyActingEffectsInDEV(currentlyRenderingFiber); <del> } <ide> return updateEffectImpl(PassiveEffect, HookPassive, create, deps); <ide> } <ide> <ide><path>packages/react-reconciler/src/ReactFiberHooks.old.js <ide> import { <ide> scheduleUpdateOnFiber, <ide> requestUpdateLane, <ide> requestEventTime, <del> warnIfNotCurrentlyActingEffectsInDEV, <ide> markSkippedUpdateLanes, <ide> isInterleavedUpdate, <ide> } from './ReactFiberWorkLoop.old'; <ide> function mountEffect( <ide> create: () => (() => void) | void, <ide> deps: Array<mixed> | void | null, <ide> ): void { <del> if (__DEV__) { <del> warnIfNotCurrentlyActingEffectsInDEV(currentlyRenderingFiber); <del> } <ide> if ( <ide> __DEV__ && <ide> enableStrictEffects && <ide> function updateEffect( <ide> create: () => (() => void) | void, <ide> deps: Array<mixed> | void | null, <ide> ): void { <del> if (__DEV__) { <del> warnIfNotCurrentlyActingEffectsInDEV(currentlyRenderingFiber); <del> } <ide> return updateEffectImpl(PassiveEffect, HookPassive, create, deps); <ide> } <ide> <ide><path>packages/react-reconciler/src/ReactFiberWorkLoop.new.js <ide> import { <ide> createWorkInProgress, <ide> assignFiberPropertiesInDEV, <ide> } from './ReactFiber.new'; <del>import { <del> NoMode, <del> StrictLegacyMode, <del> ProfileMode, <del> ConcurrentMode, <del>} from './ReactTypeOfMode'; <add>import {NoMode, ProfileMode, ConcurrentMode} from './ReactTypeOfMode'; <ide> import { <ide> HostRoot, <ide> IndeterminateComponent, <ide> function shouldForceFlushFallbacksInDEV() { <ide> return __DEV__ && ReactCurrentActQueue.current !== null; <ide> } <ide> <del>export function warnIfNotCurrentlyActingEffectsInDEV(fiber: Fiber): void { <del> if (__DEV__) { <del> const isActEnvironment = <del> fiber.mode & ConcurrentMode <del> ? isConcurrentActEnvironment() <del> : isLegacyActEnvironment(fiber); <del> if ( <del> isActEnvironment && <del> (fiber.mode & StrictLegacyMode) !== NoMode && <del> ReactCurrentActQueue.current === null <del> ) { <del> console.error( <del> 'An update to %s ran an effect, but was not wrapped in act(...).\n\n' + <del> 'When testing, code that causes React state updates should be ' + <del> 'wrapped into act(...):\n\n' + <del> 'act(() => {\n' + <del> ' /* fire events that update state */\n' + <del> '});\n' + <del> '/* assert on the output */\n\n' + <del> "This ensures that you're testing the behavior the user would see " + <del> 'in the browser.' + <del> ' Learn more at https://reactjs.org/link/wrap-tests-with-act', <del> getComponentNameFromFiber(fiber), <del> ); <del> } <del> } <del>} <del> <ide> function warnIfUpdatesNotWrappedWithActDEV(fiber: Fiber): void { <ide> if (__DEV__) { <ide> if (fiber.mode & ConcurrentMode) { <ide><path>packages/react-reconciler/src/ReactFiberWorkLoop.old.js <ide> import { <ide> createWorkInProgress, <ide> assignFiberPropertiesInDEV, <ide> } from './ReactFiber.old'; <del>import { <del> NoMode, <del> StrictLegacyMode, <del> ProfileMode, <del> ConcurrentMode, <del>} from './ReactTypeOfMode'; <add>import {NoMode, ProfileMode, ConcurrentMode} from './ReactTypeOfMode'; <ide> import { <ide> HostRoot, <ide> IndeterminateComponent, <ide> function shouldForceFlushFallbacksInDEV() { <ide> return __DEV__ && ReactCurrentActQueue.current !== null; <ide> } <ide> <del>export function warnIfNotCurrentlyActingEffectsInDEV(fiber: Fiber): void { <del> if (__DEV__) { <del> const isActEnvironment = <del> fiber.mode & ConcurrentMode <del> ? isConcurrentActEnvironment() <del> : isLegacyActEnvironment(fiber); <del> if ( <del> isActEnvironment && <del> (fiber.mode & StrictLegacyMode) !== NoMode && <del> ReactCurrentActQueue.current === null <del> ) { <del> console.error( <del> 'An update to %s ran an effect, but was not wrapped in act(...).\n\n' + <del> 'When testing, code that causes React state updates should be ' + <del> 'wrapped into act(...):\n\n' + <del> 'act(() => {\n' + <del> ' /* fire events that update state */\n' + <del> '});\n' + <del> '/* assert on the output */\n\n' + <del> "This ensures that you're testing the behavior the user would see " + <del> 'in the browser.' + <del> ' Learn more at https://reactjs.org/link/wrap-tests-with-act', <del> getComponentNameFromFiber(fiber), <del> ); <del> } <del> } <del>} <del> <ide> function warnIfUpdatesNotWrappedWithActDEV(fiber: Fiber): void { <ide> if (__DEV__) { <ide> if (fiber.mode & ConcurrentMode) {
5
Javascript
Javascript
fix bug in breakpoint regex escaping
5ddf7f4200894a7304d7c07bbbd8773fac3509d1
<ide><path>lib/_debugger.js <ide> Interface.prototype.setBreakpoint = function(script, line, <ide> }; <ide> } else { <ide> this.print('Warning: script \'' + script + '\' was not loaded yet.'); <del> var normalizedPath = script.replace('([/.?*])', '\\$1'); <del> var scriptPathRegex = '^(.*[\\/\\\\])?' + normalizedPath + '$'; <add> var escapedPath = script.replace(/([/\\.?*()^${}|[\]])/g, '\\$1'); <add> var scriptPathRegex = '^(.*[\\/\\\\])?' + escapedPath + '$'; <ide> req = { <ide> type: 'scriptRegExp', <ide> target: scriptPathRegex, <ide><path>test/simple/test-debugger-repl-break-in-module.js <ide> repl.addTest('sb("mod.js", 23)', [ <ide> /1/, /2/, /3/, /4/, /5/, /6/ <ide> ]); <ide> <add>// Check escaping of regex characters <add>repl.addTest('sb(")^$*+?}{|][(.js\\\\", 1)', [ <add> /Warning: script '[^']+' was not loaded yet\./, <add> /1/, /2/, /3/, /4/, /5/, /6/ <add>]); <add> <ide> // continue - the breakpoint should be triggered <ide> repl.addTest('c', [ <ide> /break in .*[\\\/]mod\.js:23/, <ide> repl.addTest('restart', [].concat( <ide> repl.handshakeLines, <ide> [ <ide> /Restoring breakpoint mod.js:23/, <del> /Warning: script 'mod\.js' was not loaded yet\./ <add> /Warning: script 'mod\.js' was not loaded yet\./, <add> /Restoring breakpoint \).*:\d+/, <add> /Warning: script '\)[^']*' was not loaded yet\./ <ide> ], <ide> repl.initialBreakLines)); <ide>
2
PHP
PHP
fix failing test
9d52aab32a178c7ffbaec9e4e780784b01550ff8
<ide><path>lib/Cake/Core/App.php <ide> public static function classname($class, $type = '', $suffix = '') { <ide> */ <ide> public static function path($type, $plugin = null) { <ide> if (!empty($plugin)) { <del> return [static::pluginPath($plugin)]; <add> return [static::pluginPath($plugin) . $type . DS]; <ide> } <ide> if (!isset(static::$_packages[$type])) { <ide> return [APP . $type . DS];
1
Python
Python
add comments about nvidia hpc sdk and pgi
155248f763db534abde85ce382716cf0ab3347b9
<ide><path>numpy/distutils/fcompiler/nv.py <ide> <ide> compilers = ['NVHPCFCompiler'] <ide> <add>""" <add>Since august 2020 the NVIDIA HPC SDK includes the compilers formely known as The Portland Group compilers. <add>https://www.pgroup.com/index.htm <add>""" <ide> class NVHPCFCompiler(FCompiler): <ide> <ide> compiler_type = 'nv'
1
Javascript
Javascript
fix incorrect usage of assert.fail()
b7f4b1ba4cca320cf576aa73fae15902fd801190
<ide><path>lib/internal/process/promises.js <ide> function setupPromises(scheduleMicrotasks) { <ide> else if (event === promiseRejectEvent.handled) <ide> rejectionHandled(promise); <ide> else <del> require('assert').fail('unexpected PromiseRejectEvent'); <add> require('assert').fail(null, null, 'unexpected PromiseRejectEvent'); <ide> }); <ide> <ide> function unhandledRejection(promise, reason) {
1
Text
Text
add 2.7.0-beta.2 to changelog
9e807f3e119f16eece09de5600d02574a5e5886f
<ide><path>CHANGELOG.md <ide> # Ember Changelog <ide> <add>### 2.7.0-beta.2 (June 27, 2016) <add> <add>- [#13634](https://github.com/emberjs/ember.js/pull/13634) [BUGFIX] Fix issues with rerendering blockless and tagless components. <add>- [#13605](https://github.com/emberjs/ember.js/pull/13605) [BUGFIX] Ensure `pauseTest` runs after other async helpers. <add>- [#13655](https://github.com/emberjs/ember.js/pull/13655) [BUGFIX] Make debugging `this._super` much easier (remove manual `.call` / `.apply` optimizations). <add>- [#13672](https://github.com/emberjs/ember.js/pull/13672) [BUGFIX] Fix issue with `this.render` and `this.disconnectOutlet` in routes. <add>- [#13716](https://github.com/emberjs/ember.js/pull/13716) [BUGFIX] Ensure that `Ember.Test.waiters` allows access to configured test waiters. <add>- [#13273](https://github.com/emberjs/ember.js/pull/13273) [BUGFIX] Fix a number of query param related issues reported. <add> <ide> ### 2.7.0-beta.1 (June 8, 2016) <ide> <ide> - [#13424](https://github.com/emberjs/ember.js/pull/13424) [DEPRECATE] Deprecate Ember.Binding. See [the deprecation guide](http://emberjs.com/deprecations/v2.x/#toc_ember-binding) for more details.
1
PHP
PHP
use studly case for controller names
8fb3cfe5a44ea2fbc9d5961f5afe33c23e108c7c
<ide><path>src/Illuminate/Foundation/Console/ModelMakeCommand.php <ide> public function fire() <ide> } <ide> <ide> if ($this->option('controller')) { <del> $controller = Str::camel(class_basename($this->argument('name'))); <add> $controller = Str::studly(class_basename($this->argument('name'))); <ide> <ide> $this->call('make:controller', ['name' => "{$controller}Controller", '--resource' => true]); <ide> }
1
Python
Python
add german lemmatizer tests
453c47ca24c7e8d3cd71afc3fe2ef4b501c25e27
<ide><path>spacy/tests/lang/de/test_lemma.py <add># coding: utf-8 <add>from __future__ import unicode_literals <add> <add>import pytest <add> <add> <add>@pytest.mark.parametrize('string,lemma', [('Abgehängten', 'Abgehängte'), <add> ('engagierte', 'engagieren'), <add> ('schließt', 'schließen'), <add> ('vorgebenden', 'vorgebend')]) <add>def test_lemmatizer_lookup_assigns(de_tokenizer, string, lemma): <add> tokens = de_tokenizer(string) <add> assert tokens[0].lemma_ == lemma
1
Javascript
Javascript
fix typo and remove commented out assertion
28dfe9060cfe3af5e855d140903238e09ba264eb
<ide><path>packages/ember-handlebars/tests/helpers/each_test.js <ide> test("it supports {{itemView=}}", function() { <ide> }); <ide> <ide> <del>test("it defers all normaization of itemView names to the resolver", function() { <add>test("it defers all normalization of itemView names to the resolver", function() { <ide> var container = new Ember.Container(); <ide> <ide> var itemView = Ember.View.extend({ <ide> test("it defers all normaization of itemView names to the resolver", function() <ide> }; <ide> append(view); <ide> <del> // assertText(view, "itemView:Steve HoltitemView:Annabelle"); <ide> }); <ide> <ide> test("it supports {{itemViewClass=}}", function() {
1
Javascript
Javascript
allow support for custom timestamps in events
acc2fb84869ac1097434485d56bdc0265120fe34
<ide><path>src/ngScenario/browserTrigger.js <ide> } <ide> catch(e) { <ide> evnt = document.createEvent('TransitionEvent'); <del> evnt.initTransitionEvent(eventType, null, null, null, eventData.elapsedTime); <add> evnt.initTransitionEvent(eventType, null, null, null, eventData.elapsedTime || 0); <ide> } <ide> } <ide> } <ide> } <ide> catch(e) { <ide> evnt = document.createEvent('AnimationEvent'); <del> evnt.initAnimationEvent(eventType, null, null, null, eventData.elapsedTime); <add> evnt.initAnimationEvent(eventType, null, null, null, eventData.elapsedTime || 0); <ide> } <ide> } <ide> } <ide> pressed('shift'), pressed('meta'), 0, element); <ide> } <ide> <add> /* we're unable to change the timeStamp value directly so this <add> * is only here to allow for testing where the timeStamp value is <add> * read */ <add> evnt.$manualTimeStamp = eventData.timeStamp; <add> <ide> if(!evnt) return; <ide> <ide> var originalPreventDefault = evnt.preventDefault,
1
Javascript
Javascript
manage select controller options correctly
2435e2b8f84fde9495b8e9440a2b4f865b1ff541
<ide><path>src/ng/directive/select.js <ide> var selectDirective = ['$compile', '$parse', function($compile, $parse) { <ide> // Workaround for https://code.google.com/p/chromium/issues/detail?id=381459 <ide> // Adding an <option selected="selected"> element to a <select required="required"> should <ide> // automatically select the new element <del> if (element[0].hasAttribute('selected')) { <add> if (element && element[0].hasAttribute('selected')) { <ide> element[0].selected = true; <ide> } <ide> }; <ide> var selectDirective = ['$compile', '$parse', function($compile, $parse) { <ide> } <ide> } <ide> <add> /** <add> * A new labelMap is created with each render. <add> * This function is called for each existing option with added=false, <add> * and each new option with added=true. <add> * - Labels that are passed to this method twice, <add> * (once with added=true and once with added=false) will end up with a value of 0, and <add> * will cause no change to happen to the corresponding option. <add> * - Labels that are passed to this method only once with added=false will end up with a <add> * value of -1 and will eventually be passed to selectCtrl.removeOption() <add> * - Labels that are passed to this method only once with added=true will end up with a <add> * value of 1 and will eventually be passed to selectCtrl.addOption() <add> */ <add> function updateLabelMap(labelMap, label, added) { <add> labelMap[label] = labelMap[label] || 0; <add> labelMap[label] += (added ? 1 : -1); <add> } <add> <ide> function render() { <ide> renderScheduled = false; <ide> <ide> var selectDirective = ['$compile', '$parse', function($compile, $parse) { <ide> value, <ide> groupLength, length, <ide> groupIndex, index, <add> labelMap = {}, <ide> selected, <ide> isSelected = createIsSelectedFn(viewValue), <ide> anySelected = false, <ide> var selectDirective = ['$compile', '$parse', function($compile, $parse) { <ide> // reuse elements <ide> lastElement = existingOption.element; <ide> if (existingOption.label !== option.label) { <add> updateLabelMap(labelMap, existingOption.label, false); <add> updateLabelMap(labelMap, option.label, true); <ide> lastElement.text(existingOption.label = option.label); <ide> } <ide> if (existingOption.id !== option.id) { <ide> var selectDirective = ['$compile', '$parse', function($compile, $parse) { <ide> id: option.id, <ide> selected: option.selected <ide> }); <del> selectCtrl.addOption(option.label, element); <add> updateLabelMap(labelMap, option.label, true); <ide> if (lastElement) { <ide> lastElement.after(element); <ide> } else { <ide> var selectDirective = ['$compile', '$parse', function($compile, $parse) { <ide> index++; // increment since the existingOptions[0] is parent element not OPTION <ide> while(existingOptions.length > index) { <ide> option = existingOptions.pop(); <del> selectCtrl.removeOption(option.label); <add> updateLabelMap(labelMap, option.label, false); <ide> option.element.remove(); <ide> } <add> forEach(labelMap, function (count, label) { <add> if (count > 0) { <add> selectCtrl.addOption(label); <add> } else if (count < 0) { <add> selectCtrl.removeOption(label); <add> } <add> }); <ide> } <ide> // remove any excessive OPTGROUPs from select <ide> while(optionGroupsCache.length > groupIndex) { <ide><path>test/ng/directive/selectSpec.js <ide> describe('select', function() { <ide> }); <ide> <ide> describe('selectController.hasOption', function() { <del> it('should return true for options added via ngOptions', function() { <add> it('should return false for options shifted via ngOptions', function() { <ide> scope.robots = [ <del> {key: 1, value: 'c3p0'}, <del> {key: 2, value: 'r2d2'} <add> {value: 1, label: 'c3p0'}, <add> {value: 2, label: 'r2d2'} <ide> ]; <del> scope.robot = 'r2d2'; <ide> <ide> compile('<select ng-model="robot" ' + <del> 'ng-options="item.key as item.value for item in robots">' + <add> 'ng-options="item.value as item.label for item in robots">' + <ide> '</select>'); <ide> <ide> var selectCtrl = element.data().$selectController; <ide> <del> expect(selectCtrl.hasOption('c3p0')).toBe(true); <add> scope.$apply(function() { <add> scope.robots.shift(); <add> }); <add> <add> expect(selectCtrl.hasOption('c3p0')).toBe(false); <ide> expect(selectCtrl.hasOption('r2d2')).toBe(true); <add> }); <add> <add> it('should return false for options popped via ngOptions', function() { <add> scope.robots = [ <add> {value: 1, label: 'c3p0'}, <add> {value: 2, label: 'r2d2'} <add> ]; <add> <add> compile('<select ng-model="robot" ' + <add> 'ng-options="item.value as item.label for item in robots">' + <add> '</select>'); <add> <add> var selectCtrl = element.data().$selectController; <ide> <ide> scope.$apply(function() { <ide> scope.robots.pop(); <ide> }); <ide> <ide> expect(selectCtrl.hasOption('c3p0')).toBe(true); <ide> expect(selectCtrl.hasOption('r2d2')).toBe(false); <add> }); <add> <add> it('should return true for options added via ngOptions', function() { <add> scope.robots = [ <add> {value: 2, label: 'r2d2'} <add> ]; <add> <add> compile('<select ng-model="robot" ' + <add> 'ng-options="item.value as item.label for item in robots">' + <add> '</select>'); <add> <add> var selectCtrl = element.data().$selectController; <ide> <ide> scope.$apply(function() { <del> scope.robots.push({key: 2, value: 'r2d2'}); <add> scope.robots.unshift({value: 1, label: 'c3p0'}); <ide> }); <ide> <ide> expect(selectCtrl.hasOption('c3p0')).toBe(true); <ide> describe('select', function() { <ide> }); <ide> <ide> describe('selectController.hasOption', function() { <del> it('should return true for options added via ngOptions', function() { <add> it('should return false for options shifted via ngOptions', function() { <ide> scope.robots = [ <del> {key: 1, value: 'c3p0'}, <del> {key: 2, value: 'r2d2'} <add> {value: 1, label: 'c3p0'}, <add> {value: 2, label: 'r2d2'} <ide> ]; <del> scope.robot = 'r2d2'; <ide> <ide> compile('<select ng-model="robot" multiple ' + <del> 'ng-options="item.key as item.value for item in robots">' + <add> 'ng-options="item.value as item.label for item in robots">' + <ide> '</select>'); <ide> <ide> var selectCtrl = element.data().$selectController; <ide> <del> expect(selectCtrl.hasOption('c3p0')).toBe(true); <add> scope.$apply(function() { <add> scope.robots.shift(); <add> }); <add> <add> expect(selectCtrl.hasOption('c3p0')).toBe(false); <ide> expect(selectCtrl.hasOption('r2d2')).toBe(true); <add> }); <add> <add> it('should return false for options popped via ngOptions', function() { <add> scope.robots = [ <add> {value: 1, label: 'c3p0'}, <add> {value: 2, label: 'r2d2'} <add> ]; <add> <add> compile('<select ng-model="robot" multiple ' + <add> 'ng-options="item.value as item.label for item in robots">' + <add> '</select>'); <add> <add> var selectCtrl = element.data().$selectController; <ide> <ide> scope.$apply(function() { <ide> scope.robots.pop(); <ide> }); <ide> <ide> expect(selectCtrl.hasOption('c3p0')).toBe(true); <ide> expect(selectCtrl.hasOption('r2d2')).toBe(false); <add> }); <add> <add> it('should return true for options added via ngOptions', function() { <add> scope.robots = [ <add> {value: 2, label: 'r2d2'} <add> ]; <add> <add> compile('<select ng-model="robot" multiple ' + <add> 'ng-options="item.value as item.label for item in robots">' + <add> '</select>'); <add> <add> var selectCtrl = element.data().$selectController; <ide> <ide> scope.$apply(function() { <del> scope.robots.push({key: 2, value: 'r2d2'}); <add> scope.robots.unshift({value: 1, label: 'c3p0'}); <ide> }); <ide> <ide> expect(selectCtrl.hasOption('c3p0')).toBe(true);
2
Javascript
Javascript
show context when exclude holds `undefined`
6dd2863899f6d3893270d92b50566054fa719618
<ide><path>lib/RuleSet.js <ide> <condition>: { and: [<condition>] } <ide> <condition>: { or: [<condition>] } <ide> <condition>: { not: [<condition>] } <del><condition>: { test: <condition>, include: <condition>, exclude: <codition> } <add><condition>: { test: <condition>, include: <condition>, exclude: <condition> } <ide> <ide> <ide> normalized: <ide> RuleSet.normalizeRule = function(rule) { <ide> <ide> if(rule.test || rule.include || rule.exclude) { <ide> checkResourceSource("test + include + exclude"); <del> newRule.resource = RuleSet.normalizeCondition({ <add> var condition = { <ide> test: rule.test, <ide> include: rule.include, <ide> exclude: rule.exclude <del> }); <add> }; <add> try { <add> newRule.resource = RuleSet.normalizeCondition(condition); <add> } catch (error) { <add> var conditionAsText = JSON.stringify(condition, function(key, value) { <add> return (value === undefined) ? "undefined" : value; <add> }, 2) <add> var message = error.message + " in " + conditionAsText; <add> throw new Error(message); <add> } <ide> } <ide> <ide> if(rule.resource) { <ide><path>test/RuleSet.test.js <ide> describe("RuleSet", function() { <ide> (match(loader, 'style.css')).should.eql(['css']); <ide> }, /No loader specified/) <ide> }); <add> it('should throw with context if exclude array holds an undefined item', function() { <add> should.throws(function() { <add> var loader = new RuleSet([{ <add> test: /\.css$/, <add> loader: 'css', <add> include: [ <add> 'src', <add> ], <add> exclude: [ <add> 'node_modules', <add> undefined, <add> ], <add> }]); <add> (match(loader, 'style.css')).should.eql(['css']); <add> }, function(err) { <add> if (/Expected condition but got falsy value/.test(err) <add> && /test/.test(err) <add> && /include/.test(err) <add> && /exclude/.test(err) <add> && /node_modules/.test(err) <add> && /undefined/.test(err)) { <add> return true; <add> } <add> }) <add> }); <ide> });
2
Python
Python
correct the shape of trajectory
7e3dff17c5046aad1c67fa689e5146a13e8cc052
<ide><path>physics/horizontal_projectile_motion.py <ide> This algorithm solves a specific problem in which <ide> the motion starts from the ground as can be seen below: <ide> (v = 0) <del> ** <del> * * <del> * * <del> * * <del> * * <del> * * <del>GROUND GROUND <add> * * <add> * * <add> * * <add> * * <add> * * <add> * * <add>GROUND GROUND <ide> For more info: https://en.wikipedia.org/wiki/Projectile_motion <ide> """ <ide>
1
Javascript
Javascript
fix syntax error in action_url_test
d1d4a47d1d6291ad596a2b8c1d4a6f18f7a5191d
<ide><path>packages/ember-application/tests/system/action_url_test.js <ide> // FIXME: Move this to an integration test pacakge with proper requires <ide> try { <ide> require('ember-handlebars'); <del>} catch() { } <add>} catch(e) { } <ide> <ide> module("the {{action}} helper with href attribute"); <ide>
1
Text
Text
add missing link import to routing doc
98f368f545617b3d15c39d30d9c4549ea3656dba
<ide><path>packages/next/README.md <ide> export default Home <ide> <ide> ```jsx <ide> // pages/about.js <add>import Link from 'next/link' <add> <ide> function About() { <ide> return ( <ide> <>
1
Go
Go
fix pr13278 compile break
71eadd4176a968399671e5cb4c8de52c40992b01
<ide><path>daemon/volumes.go <ide> import ( <ide> "path/filepath" <ide> "strings" <ide> <del> "github.com/Sirupsen/logrus" <ide> "github.com/docker/docker/pkg/chrootarchive" <ide> "github.com/docker/docker/runconfig" <ide> "github.com/docker/docker/volume" <ide> func (daemon *Daemon) verifyVolumesInfo(container *Container) error { <ide> return container.ToDisk() <ide> } <ide> <del>// migrateVolume moves the contents of a volume created pre Docker 1.7 <del>// to the location expected by the local driver. Steps: <del>// 1. Save old directory that includes old volume's config json file. <del>// 2. Move virtual directory with content to where the local driver expects it to be. <del>// 3. Remove the backup of the old volume config. <del>func (daemon *Daemon) migrateVolume(id, vfs string) error { <del> volumeInfo := filepath.Join(daemon.root, defaultVolumesPathName, id) <del> backup := filepath.Join(daemon.root, defaultVolumesPathName, id+".back") <del> <del> var err error <del> if err = os.Rename(volumeInfo, backup); err != nil { <del> return err <del> } <del> defer func() { <del> // Put old configuration back in place in case one of the next steps fails. <del> if err != nil { <del> os.Rename(backup, volumeInfo) <del> } <del> }() <del> <del> if err = os.Rename(vfs, volumeInfo); err != nil { <del> return err <del> } <del> <del> if err = os.RemoveAll(backup); err != nil { <del> logrus.Errorf("Unable to remove volume info backup directory %s: %v", backup, err) <del> } <del> <del> return nil <del>} <del> <ide> func createVolume(name, driverName string) (volume.Volume, error) { <ide> vd, err := getVolumeDriver(driverName) <ide> if err != nil { <ide><path>daemon/volumes_linux.go <ide> import ( <ide> "sort" <ide> "strings" <ide> <add> "github.com/Sirupsen/logrus" <ide> "github.com/docker/docker/daemon/execdriver" <ide> "github.com/docker/docker/pkg/system" <ide> ) <ide> func (m mounts) Swap(i, j int) { <ide> func (m mounts) parts(i int) int { <ide> return len(strings.Split(filepath.Clean(m[i].Destination), string(os.PathSeparator))) <ide> } <add> <add>// migrateVolume moves the contents of a volume created pre Docker 1.7 <add>// to the location expected by the local driver. Steps: <add>// 1. Save old directory that includes old volume's config json file. <add>// 2. Move virtual directory with content to where the local driver expects it to be. <add>// 3. Remove the backup of the old volume config. <add>func (daemon *Daemon) migrateVolume(id, vfs string) error { <add> volumeInfo := filepath.Join(daemon.root, defaultVolumesPathName, id) <add> backup := filepath.Join(daemon.root, defaultVolumesPathName, id+".back") <add> <add> var err error <add> if err = os.Rename(volumeInfo, backup); err != nil { <add> return err <add> } <add> defer func() { <add> // Put old configuration back in place in case one of the next steps fails. <add> if err != nil { <add> os.Rename(backup, volumeInfo) <add> } <add> }() <add> <add> if err = os.Rename(vfs, volumeInfo); err != nil { <add> return err <add> } <add> <add> if err = os.RemoveAll(backup); err != nil { <add> logrus.Errorf("Unable to remove volume info backup directory %s: %v", backup, err) <add> } <add> <add> return nil <add>} <ide><path>daemon/volumes_windows.go <ide> func copyOwnership(source, destination string) error { <ide> func (container *Container) setupMounts() ([]execdriver.Mount, error) { <ide> return nil, nil <ide> } <add> <add>func (daemon *Daemon) migrateVolume(id, vfs string) error { <add> return nil <add>}
3
Mixed
Javascript
add a way to filter items in the tooltip
5ae268e94236b921d6cc966c580cd4984d5f4f94
<ide><path>docs/01-Chart-Configuration.md <ide> mode | String | 'nearest' | Sets which elements appear in the tooltip. See [Inte <ide> intersect | Boolean | true | if true, the tooltip mode applies only when the mouse position intersects with an element. If false, the mode will be applied at all times. <ide> position | String | 'average' | The mode for positioning the tooltip. 'average' mode will place the tooltip at the average position of the items displayed in the tooltip. 'nearest' will place the tooltip at the position of the element closest to the event position. New modes can be defined by adding functions to the Chart.Tooltip.positioners map. <ide> itemSort | Function | undefined | Allows sorting of [tooltip items](#chart-configuration-tooltip-item-interface). Must implement at minimum a function that can be passed to [Array.prototype.sort](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort). This function can also accept a third parameter that is the data object passed to the chart. <add>filter | Function | undefined | Allows filtering of [tooltip items](#chart-configuration-tooltip-item-interface). Must implement at minimum a function that can be passed to [Array.prototype.filter](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/filter). This function can also accept a second parameter that is the data object passed to the chart. <ide> backgroundColor | Color | 'rgba(0,0,0,0.8)' | Background color of the tooltip <ide> titleFontFamily | String | "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif" | Font family for tooltip title inherited from global font family <ide> titleFontSize | Number | 12 | Font size for tooltip title inherited from global font size <ide><path>src/core/core.tooltip.js <ide> module.exports = function(Chart) { <ide> tooltipItems.push(createTooltipItem(active[i])); <ide> } <ide> <add> // If the user provided a filter function, use it to modify the tooltip items <add> if (opts.filter) { <add> tooltipItems = tooltipItems.filter(function(a) { <add> return opts.filter(a, data); <add> }); <add> } <add> <ide> // If the user provided a sorting function, use it to modify the tooltip items <ide> if (opts.itemSort) { <ide> tooltipItems = tooltipItems.sort(function(a, b) { <ide><path>test/core.tooltip.tests.js <ide> describe('Core.Tooltip', function() { <ide> expect(tooltip._view.y).toBeCloseToPixel(155); <ide> }); <ide> <add> it('should filter items from the tooltip using the callback', function() { <add> var chartInstance = window.acquireChart({ <add> type: 'line', <add> data: { <add> datasets: [{ <add> label: 'Dataset 1', <add> data: [10, 20, 30], <add> pointHoverBorderColor: 'rgb(255, 0, 0)', <add> pointHoverBackgroundColor: 'rgb(0, 255, 0)', <add> tooltipHidden: true <add> }, { <add> label: 'Dataset 2', <add> data: [40, 40, 40], <add> pointHoverBorderColor: 'rgb(0, 0, 255)', <add> pointHoverBackgroundColor: 'rgb(0, 255, 255)' <add> }], <add> labels: ['Point 1', 'Point 2', 'Point 3'] <add> }, <add> options: { <add> tooltips: { <add> mode: 'label', <add> filter: function(tooltipItem, data) { <add> // For testing purposes remove the first dataset that has a tooltipHidden property <add> return !data.datasets[tooltipItem.datasetIndex].tooltipHidden; <add> } <add> } <add> } <add> }); <add> <add> // Trigger an event over top of the <add> var meta0 = chartInstance.getDatasetMeta(0); <add> var point0 = meta0.data[1]; <add> <add> var node = chartInstance.chart.canvas; <add> var rect = node.getBoundingClientRect(); <add> <add> var evt = new MouseEvent('mousemove', { <add> view: window, <add> bubbles: true, <add> cancelable: true, <add> clientX: rect.left + point0._model.x, <add> clientY: rect.top + point0._model.y <add> }); <add> <add> // Manully trigger rather than having an async test <add> node.dispatchEvent(evt); <add> <add> // Check and see if tooltip was displayed <add> var tooltip = chartInstance.tooltip; <add> <add> expect(tooltip._view).toEqual(jasmine.objectContaining({ <add> // Positioning <add> xAlign: 'left', <add> yAlign: 'center', <add> <add> // Text <add> title: ['Point 2'], <add> beforeBody: [], <add> body: [{ <add> before: [], <add> lines: ['Dataset 2: 40'], <add> after: [] <add> }], <add> afterBody: [], <add> footer: [], <add> labelColors: [{ <add> borderColor: 'rgb(0, 0, 255)', <add> backgroundColor: 'rgb(0, 255, 255)' <add> }] <add> })); <add> }); <add> <ide> it('Should have dataPoints', function() { <ide> var chartInstance = window.acquireChart({ <ide> type: 'line',
3
Ruby
Ruby
preserve cached queries name in as notifications
84d35da86c14767c737783cb95dd4624632cc1bd
<ide><path>activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb <ide> def select_all(arel, name = nil, binds = [], preparable: nil) <ide> if @query_cache_enabled && !locked?(arel) <ide> arel, binds = binds_from_relation arel, binds <ide> sql = to_sql(arel, binds) <del> cache_sql(sql, binds) { super(sql, name, binds, preparable: preparable) } <add> cache_sql(sql, name, binds) { super(sql, name, binds, preparable: preparable) } <ide> else <ide> super <ide> end <ide> end <ide> <ide> private <ide> <del> def cache_sql(sql, binds) <add> def cache_sql(sql, name, binds) <ide> result = <ide> if @query_cache[sql].key?(binds) <del> ActiveSupport::Notifications.instrument("sql.active_record", <del> sql: sql, binds: binds, name: "CACHE", connection_id: object_id) <add> ActiveSupport::Notifications.instrument( <add> "sql.active_record", <add> sql: sql, <add> binds: binds, <add> name: name, <add> connection_id: object_id, <add> cached: true, <add> ) <ide> @query_cache[sql][binds] <ide> else <ide> @query_cache[sql][binds] = yield <ide><path>activerecord/lib/active_record/explain_subscriber.rb <ide> def finish(name, id, payload) <ide> # <ide> # On the other hand, we want to monitor the performance of our real database <ide> # queries, not the performance of the access to the query cache. <del> IGNORED_PAYLOADS = %w(SCHEMA EXPLAIN CACHE) <add> IGNORED_PAYLOADS = %w(SCHEMA EXPLAIN) <ide> EXPLAINED_SQLS = /\A\s*(with|select|update|delete|insert)\b/i <ide> def ignore_payload?(payload) <del> payload[:exception] || IGNORED_PAYLOADS.include?(payload[:name]) || payload[:sql] !~ EXPLAINED_SQLS <add> payload[:exception] || <add> payload[:cached] || <add> IGNORED_PAYLOADS.include?(payload[:name]) || <add> payload[:sql] !~ EXPLAINED_SQLS <ide> end <ide> <ide> ActiveSupport::Notifications.subscribe("sql.active_record", new) <ide><path>activerecord/lib/active_record/log_subscriber.rb <ide> def sql(event) <ide> return if IGNORE_PAYLOAD_NAMES.include?(payload[:name]) <ide> <ide> name = "#{payload[:name]} (#{event.duration.round(1)}ms)" <add> name = "CACHE #{name}" if payload[:cached] <ide> sql = payload[:sql] <ide> binds = nil <ide> <ide><path>activerecord/test/cases/test_case.rb <ide> def initialize(ignore = Regexp.union(self.class.ignored_sql)) <ide> end <ide> <ide> def call(name, start, finish, message_id, values) <del> sql = values[:sql] <del> <del> # FIXME: this seems bad. we should probably have a better way to indicate <del> # the query was cached <del> return if "CACHE" == values[:name] <add> return if values[:cached] <ide> <add> sql = values[:sql] <ide> self.class.log_all << sql <ide> self.class.log << sql unless ignore.match?(sql) <ide> end
4
Javascript
Javascript
remove unused variable
a065d17ff04fc25e90927c3134a2a28cf32bbcfe
<ide><path>packages/ember-metal/lib/properties.js <ide> var USE_ACCESSORS = Ember.USE_ACCESSORS, <ide> GUID_KEY = Ember.GUID_KEY, <ide> META_KEY = Ember.META_KEY, <ide> meta = Ember.meta, <del> o_create = Ember.create, <ide> objectDefineProperty = Ember.platform.defineProperty, <ide> SIMPLE_PROPERTY, WATCHED_PROPERTY; <ide>
1
Ruby
Ruby
add formula name to llvm warning
18f9969b65d3a9a39ae721c1d967d596b7aef898
<ide><path>Library/Homebrew/formula.rb <ide> def std_cmake_parameters <ide> "-DCMAKE_INSTALL_PREFIX='#{prefix}' -DCMAKE_BUILD_TYPE=None -Wno-dev" <ide> end <ide> <add> def fails_with_llvm msg="", data=nil <add> return unless (ENV['HOMEBREW_USE_LLVM'] or ARGV.include? '--use-llvm') <add> <add> build = data.delete :build rescue nil <add> msg = "(No specific reason was given)" if msg.empty? <add> <add> opoo "LLVM was requested, but this formula is reported as not working with LLVM:" <add> puts msg <add> puts "Tested with LLVM build #{build}" unless build == nil <add> puts <add> <add> if ARGV.force? <add> puts "Continuing anyway. If this works, let us know so we can update the\n"+ <add> "formula to remove the warning." <add> else <add> puts "Continuing with GCC 4.2 instead.\n"+ <add> "(Use `brew install --force #{name}` to force use of LLVM.)" <add> ENV.gcc_4_2 <add> end <add> end <add> <ide> def self.class_s name <ide> #remove invalid characters and then camelcase it <ide> name.capitalize.gsub(/[-_.\s]([a-zA-Z0-9])/) { $1.upcase } \ <ide> def external_deps <ide> self.class.external_deps <ide> end <ide> <del> def fails_with_llvm msg="", data=nil <del> return unless (ENV['HOMEBREW_USE_LLVM'] or ARGV.include? '--use-llvm') <del> <del> build = data.delete :build rescue nil <del> msg = "(No specific reason was given)" if msg.empty? <del> <del> opoo "LLVM was requested, but this formula is reported as not working with LLVM:" <del> puts msg <del> puts "Tested with LLVM build #{build}" unless build == nil <del> puts <del> <del> if ARGV.force? <del> puts "Continuing anyway. If this works, let us know so we can update the\n"+ <del> "formula to remove the warning." <del> else <del> puts "Continuing with GCC 4.2 instead.\n"+ <del> "(Use `brew install --force ...` to force use of LLVM.)" <del> ENV.gcc_4_2 <del> end <del> end <del> <ide> protected <ide> # Pretty titles the command and buffers stdout/stderr <ide> # Throws if there's an error
1
Python
Python
add missing import
c304834e459f2536e788e845178de46551e1d7b0
<ide><path>spacy/tests/regression/test_issue792.py <ide> # coding: utf-8 <ide> from __future__ import unicode_literals <ide> <add>import pytest <ide> <ide> @pytest.mark.xfail <ide> @pytest.mark.parametrize('text', ["This is a string ", "This is a string\u0020"])
1
PHP
PHP
add underscore to prefix in database cache key
19f4e346d4e50eeab3a8840b93f89c9f1ffe2a42
<ide><path>config/cache.php <ide> | <ide> */ <ide> <del> 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'), <add> 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'), <ide> <ide> ];
1
Javascript
Javascript
add examples to array#objectsat
0dddf2d70cf7bff3dffbd9b0ae9be3af2220e798
<ide><path>packages/ember-runtime/lib/mixins/array.js <ide> Ember.Array = Ember.Mixin.create(Ember.Enumerable, /** @scope Ember.Array.protot <ide> }, <ide> <ide> /** <del> This returns the objects at the specified indexes, using objectAt. <add> This returns the objects at the specified indexes, using `objectAt`. <add> <add> var arr = ['a', 'b', 'c', 'd']; <add> arr.objectsAt([0, 1, 2]) => ["a", "b", "c"] <add> arr.objectsAt([2, 3, 4]) => ["c", "d", undefined] <ide> <ide> @param {Array} indexes <ide> An array of indexes of items to return.
1
Javascript
Javascript
fix some missing spaces
e14ac2c3b0c08df381618e92145eadd125aad03f
<ide><path>src/angular-bootstrap.js <ide> document.write('<script type="text/javascript" src="' + serverPath + '../angularFiles.js' + '" ' + <ide> 'onload="addScripts(angularFiles.angularSrc)"></script>'); <ide> <del> function onLoadListener(){ <add> function onLoadListener() { <ide> // empty the cache to prevent mem leaks <ide> globalVars = {}; <ide> <ide> angularInit(config, document); <ide> } <ide> <del> if (window.addEventListener){ <add> if (window.addEventListener) { <ide> window.addEventListener('load', onLoadListener, false); <del> } else if (window.attachEvent){ <add> } else if (window.attachEvent) { <ide> window.attachEvent('onload', onLoadListener); <ide> } <ide>
1
Java
Java
improve 404 "handler not found" handling
f7d4688b8457f9ce3527dc70cb69c3fe3f7762a2
<ide><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/DispatcherHandler.java <ide> public class DispatcherHandler implements WebHandler, ApplicationContextAware { <ide> <ide> private static final Log logger = LogFactory.getLog(DispatcherHandler.class); <ide> <add> @SuppressWarnings("ThrowableInstanceNeverThrown") <add> private static final Exception HANDLER_NOT_FOUND_EXCEPTION = <add> new ResponseStatusException(HttpStatus.NOT_FOUND, "No matching handler"); <add> <ide> <ide> private List<HandlerMapping> handlerMappings; <ide> <ide> protected void initStrategies(ApplicationContext context) { <ide> context, HandlerMapping.class, true, false); <ide> <ide> this.handlerMappings = new ArrayList<>(mappingBeans.values()); <del> this.handlerMappings.add(new NotFoundHandlerMapping()); <ide> AnnotationAwareOrderComparator.sort(this.handlerMappings); <ide> <ide> Map<String, HandlerAdapter> adapterBeans = BeanFactoryUtils.beansOfTypeIncludingAncestors( <ide> public Mono<Void> handle(ServerWebExchange exchange) { <ide> return Flux.fromIterable(this.handlerMappings) <ide> .concatMap(mapping -> mapping.getHandler(exchange)) <ide> .next() <add> .otherwiseIfEmpty(Mono.error(HANDLER_NOT_FOUND_EXCEPTION)) <ide> .then(handler -> invokeHandler(exchange, handler)) <ide> .then(result -> handleResult(exchange, result)); <ide> } <ide> private HandlerResultHandler getResultHandler(HandlerResult handlerResult) { <ide> throw new IllegalStateException("No HandlerResultHandler for " + handlerResult.getReturnValue()); <ide> } <ide> <del> <del> private static class NotFoundHandlerMapping implements HandlerMapping { <del> <del> @SuppressWarnings("ThrowableInstanceNeverThrown") <del> private static final Exception HANDLER_NOT_FOUND_EXCEPTION = <del> new ResponseStatusException(HttpStatus.NOT_FOUND, "No matching handler"); <del> <del> <del> @Override <del> public Mono<Object> getHandler(ServerWebExchange exchange) { <del> return Mono.error(HANDLER_NOT_FOUND_EXCEPTION); <del> } <del> } <del> <ide> } <ide>\ No newline at end of file
1
Text
Text
expand permissions docs. closes
c9a2ce07037475359712104a8a68624e99bdfeb1
<ide><path>docs/api-guide/permissions.md <ide> Together with [authentication] and [throttling], permissions determine whether a <ide> <ide> Permission checks are always run at the very start of the view, before any other code is allowed to proceed. Permission checks will typically use the authentication information in the `request.user` and `request.auth` properties to determine if the incoming request should be permitted. <ide> <add>Permissions are used to grant or deny access different classes of users to different parts of the API. <add> <add>The simplest style of permission would be to allow access to any authenticated user, and deny access to any unauthenticated user. This corresponds the `IsAuthenticated` class in REST framework. <add> <add>A slightly less strict style of permission would be to allow full access to authenticated users, but allow read-only access to unauthenticated users. This corresponds to the `IsAuthenticatedOrReadOnly` class in REST framework. <add> <ide> ## How permissions are determined <ide> <ide> Permissions in REST framework are always defined as a list of permission classes. <ide> <ide> Before running the main body of the view each permission in the list is checked. <del>If any permission check fails an `exceptions.PermissionDenied` exception will be raised, and the main body of the view will not run. <add>If any permission check fails an `exceptions.PermissionDenied` or `exceptions.NotAuthenticated` exception will be raised, and the main body of the view will not run. <add> <add>When the permissions checks fail either a "403 Forbidden" or a "401 Unauthorized" response will be returned, according to the following rules: <add> <add>* The request was successfully authenticated, but permission was denied. *&mdash; An HTTP 403 Forbidden response will be returned.* <add>* The request was not successfully authenticated, and the highest priority authentication class *does not* use `WWW-Authenticate` headers. *&mdash; An HTTP 403 Forbidden response will be returned.* <add>* The request was not successfully authenticated, and the highest priority authentication class *does* use `WWW-Authenticate` headers. *&mdash; An HTTP 401 Unauthorized response, with an appropriate `WWW-Authenticate` header will be returned.* <ide> <ide> ## Object level permissions <ide>
1
Text
Text
clarify ambiguous instructions in "stack class"
0bbbd16aa9a709a2622a8f22cc6dfb0dcb772fa5
<ide><path>curriculum/challenges/english/10-coding-interview-prep/data-structures/create-a-stack-class.english.md <ide> Apart from the <code>push</code> and <code>pop</code> method, stacks have other <ide> ## Instructions <ide> <section id='instructions'> <ide> <del>Write a <code>push</code> method that pushes an element to the top of the stack, a <code>pop</code> method that removes the element on the top of the stack, a <code>peek</code> method that looks at the first element in the stack, an <code>isEmpty</code> method that checks if the stack is empty, and a <code>clear</code> method that removes all elements from the stack. <add>Write a <code>push</code> method that pushes an element to the top of the stack, a <code>pop</code> method that removes and returns the element on the top of the stack, a <code>peek</code> method that looks at the top element in the stack, an <code>isEmpty</code> method that checks if the stack is empty, and a <code>clear</code> method that removes all elements from the stack. <ide> Normally stacks don't have this, but we've added a <code>print</code> helper method that console logs the collection. <ide> </section> <ide>
1