content_type
stringclasses
8 values
main_lang
stringclasses
7 values
message
stringlengths
1
50
sha
stringlengths
40
40
patch
stringlengths
52
962k
file_count
int64
1
300
Javascript
Javascript
remove legacypromise in src/core/core.js
034f1102dae10c94161c25665d7d76d9f931fdc4
<ide><path>src/core/core.js <ide> * limitations under the License. <ide> */ <ide> /* globals assert, calculateMD5, Catalog, Dict, error, info, isArray, <del> isArrayBuffer, isName, isStream, isString, LegacyPromise, <add> isArrayBuffer, isName, isStream, isString, createPromiseCapability, <ide> Linearization, NullStream, PartialEvaluator, shadow, Stream, Lexer, <ide> StreamsSequenceStream, stringToPDFString, stringToBytes, Util, XRef, <ide> MissingDataException, Promise, Annotation, ObjectLoader, OperatorList <ide> var Page = (function PageClosure() { <ide> return stream; <ide> }, <ide> <del> loadResources: function(keys) { <add> loadResources: function Page_loadResources(keys) { <ide> if (!this.resourcesPromise) { <ide> // TODO: add async getInheritedPageProp and remove this. <ide> this.resourcesPromise = this.pdfManager.ensure(this, 'resources'); <ide> } <del> var promise = new LegacyPromise(); <del> this.resourcesPromise.then(function resourceSuccess() { <add> return this.resourcesPromise.then(function resourceSuccess() { <ide> var objectLoader = new ObjectLoader(this.resources.map, <ide> keys, <ide> this.xref); <del> objectLoader.load().then(function objectLoaderSuccess() { <del> promise.resolve(); <del> }); <add> return objectLoader.load(); <ide> }.bind(this)); <del> return promise; <ide> }, <ide> <ide> getOperatorList: function Page_getOperatorList(handler, intent) { <ide> var self = this; <del> var promise = new LegacyPromise(); <add> var capability = createPromiseCapability(); <ide> <ide> function reject(e) { <del> promise.reject(e); <add> capability.reject(e); <ide> } <ide> <del> var pageListPromise = new LegacyPromise(); <add> var pageListCapability = createPromiseCapability(); <ide> <ide> var pdfManager = this.pdfManager; <ide> var contentStreamPromise = pdfManager.ensure(this, 'getContentStream', <ide> var Page = (function PageClosure() { <ide> intent: intent <ide> }); <ide> partialEvaluator.getOperatorList(contentStream, self.resources, opList); <del> pageListPromise.resolve(opList); <add> pageListCapability.resolve(opList); <ide> }); <ide> <ide> var annotationsPromise = pdfManager.ensure(this, 'annotations'); <del> Promise.all([pageListPromise, annotationsPromise]).then(function(datas) { <add> Promise.all([pageListCapability.promise, annotationsPromise]).then( <add> function(datas) { <ide> var pageOpList = datas[0]; <ide> var annotations = datas[1]; <ide> <ide> if (annotations.length === 0) { <ide> pageOpList.flush(true); <del> promise.resolve(pageOpList); <add> capability.resolve(pageOpList); <ide> return; <ide> } <ide> <ide> var annotationsReadyPromise = Annotation.appendToOperatorList( <ide> annotations, pageOpList, pdfManager, partialEvaluator, intent); <ide> annotationsReadyPromise.then(function () { <ide> pageOpList.flush(true); <del> promise.resolve(pageOpList); <add> capability.resolve(pageOpList); <ide> }, reject); <ide> }, reject); <ide> <del> return promise; <add> return capability.promise; <ide> }, <ide> <ide> extractTextContent: function Page_extractTextContent() {
1
PHP
PHP
use the registryalias when setting entity source
0c3f904dd635edc72a5d15538b459fe0f65601a8
<ide><path>src/ORM/ResultSet.php <ide> protected function _groupResult($row) <ide> ) <ide> ); <ide> if ($this->_hydrate) { <del> $options['source'] = $alias; <add> $options['source'] = $matching['instance']->registryAlias(); <ide> $entity = new $matching['entityClass']($results['_matchingData'][$alias], $options); <ide> $entity->clean(); <ide> $results['_matchingData'][$alias] = $entity; <ide> protected function _groupResult($row) <ide> } <ide> <ide> $target = $instance->target(); <del> $options['source'] = $target->alias(); <add> $options['source'] = $target->registryAlias(); <ide> unset($presentAliases[$alias]); <ide> <ide> if ($assoc['canBeJoined']) { <ide><path>tests/TestCase/ORM/ResultSetTest.php <ide> namespace Cake\Test\TestCase\ORM; <ide> <ide> use Cake\Core\Configure; <add>use Cake\Core\Plugin; <ide> use Cake\Datasource\ConnectionManager; <ide> use Cake\ORM\Entity; <ide> use Cake\ORM\Query; <ide> class ResultSetTest extends TestCase <ide> { <ide> <del> public $fixtures = ['core.articles', 'core.comments']; <add> public $fixtures = ['core.authors', 'core.articles', 'core.comments']; <ide> <ide> /** <ide> * setup <ide> public function testFetchMissingDefaultAlias() <ide> $result->valid(); <ide> $data = $result->current(); <ide> } <add> <add> /** <add> * Test that associations have source() correctly set. <add> * <add> * @return void <add> */ <add> public function testSourceOnContainAssociations() <add> { <add> Plugin::load('TestPlugin'); <add> $comments = TableRegistry::get('TestPlugin.Comments'); <add> $comments->belongsTo('Authors', [ <add> 'className' => 'TestPlugin.Authors', <add> 'foreignKey' => 'user_id' <add> ]); <add> $result = $comments->find()->contain(['Authors'])->first(); <add> $this->assertEquals('TestPlugin.Comments', $result->source()); <add> $this->assertEquals('TestPlugin.Authors', $result->author->source()); <add> <add> $result = $comments->find()->matching('Authors', function ($q) { <add> return $q->where(['Authors.id' => 1]); <add> })->first(); <add> $this->assertEquals('TestPlugin.Comments', $result->source()); <add> $this->assertEquals('TestPlugin.Authors', $result->_matchingData['Authors']->source()); <add> } <ide> }
2
Ruby
Ruby
fix human_attribute_name to handle names with dots
dff19f7be2584d9eaa869de14a919aa70d029d92
<ide><path>activemodel/lib/active_model/translation.rb <ide> def lookup_ancestors <ide> # <ide> # Specify +options+ with additional translating options. <ide> def human_attribute_name(attribute, options = {}) <del> defaults = lookup_ancestors.map do |klass| <del> :"#{self.i18n_scope}.attributes.#{klass.model_name.i18n_key}.#{attribute}" <add> defaults = [] <add> lookup_ancestors.each do |klass| <add> if attribute.match(/\./) <add> defaults << :"#{self.i18n_scope}.attributes.#{klass.model_name.i18n_key}.#{attribute.gsub(/\./, '/')}" <add> end <add> defaults << :"#{self.i18n_scope}.attributes.#{klass.model_name.i18n_key}.#{attribute}" <ide> end <ide> <ide> defaults << :"attributes.#{attribute}" <ide><path>activemodel/test/cases/translation_test.rb <ide> def test_translated_model_attributes_with_attribute_matching_namespaced_model_na <ide> assert_equal 'person gender attribute', Person::Gender.human_attribute_name('attribute') <ide> end <ide> <add> def test_translated_nested_model_attributes <add> I18n.backend.store_translations 'en', :activemodel => {:attributes => {:person => {:"addresses/street" => 'Street'}}} <add> assert_equal 'Street', Person.human_attribute_name('addresses.street') <add> end <add> <add> def test_translated_nested_model_attributes_with_deprecated_lookup_style <add> I18n.backend.store_translations 'en', :activemodel => {:attributes => {:person => {:addresses => {:street => 'Street'}}}} <add> assert_equal 'Street', Person.human_attribute_name('addresses.street') <add> end <add> <ide> def test_translated_model_names <ide> I18n.backend.store_translations 'en', :activemodel => {:models => {:person => 'person model'} } <ide> assert_equal 'person model', Person.model_name.human
2
Javascript
Javascript
fix typo in test description
9f25c5f55efba145fb3e47ef7cf5f3c99d42ed58
<ide><path>test/geo/path-test.js <ide> suite.addBatch({ <ide> assert.inDelta(bounds[1][0], 794.602, 1e-3); <ide> assert.inDelta(bounds[1][1], 856.501, 1e-3); <ide> }, <del> "renders a line string": function(p) { <add> "centroid of a line string": function(p) { <ide> var centroid = p.centroid({type: "LineString", coordinates: [[-122, 37], [-74, 40], [-100, 0]]}); <ide> assert.inDelta(centroid[0], 434.655, 1e-3); <ide> assert.inDelta(centroid[1], 397.940, 1e-3);
1
Text
Text
save option in validations
9616849ccb52b517614fcd964c0f074e16a805c9
<ide><path>guides/source/active_record_validations.md <ide> class Person < ActiveRecord::Base <ide> validates :age, numericality: true, on: :update <ide> <ide> # the default (validates on both create and update) <add> The following line is in review state and as of now, it is not running in any version of Rails 3.2.x as discussed in this [issue](https://github.com/rails/rails/issues/10248) <add> <ide> validates :name, presence: true, on: :save <ide> end <ide> ```
1
Text
Text
fix a typo in the working-with-the-browser docs
79b00591f162a9edaa761058ce40bbea0b2bbd08
<ide><path>docs/docs/07-working-with-the-browser.md <ide> Although React is pretty good at abstracting browser differences, some browsers <ide> <ide> #### onScroll event on IE8 <ide> <del>On IE8 the `onScroll` event doesn't bubbles and IE8 doesn't have an API to define handlers to the capturing phase of an event, meaning there is no way for React to listen to these events. <add>On IE8 the `onScroll` event doesn't bubble and IE8 doesn't have an API to define handlers to the capturing phase of an event, meaning there is no way for React to listen to these events. <ide> Currently a handler to this event is ignored on IE8. <ide> <ide> See the [onScroll doesn't work in IE8](https://github.com/facebook/react/issues/631) GitHub issue for more information.
1
Text
Text
add typescript execution requirements
dcc9589e5ed36d511466fd43ea1f4b9c1f567899
<ide><path>doc/contributing/maintaining-types-for-nodejs.md <ide> code of their JavaScript projects. While many people don't annotate their code, <ide> or make use of annotations at all, there are enough who do that the project has <ide> agreed it's important to work towards having [suitable types for end-users][]. <ide> <del>## High level approach <add>## High level approach - maintaining types <ide> <ide> There are a number of ways that types could be maintained for Node.js ranging <ide> from shipping them with the Node.js runtime to having them be externally <ide> The agreement was that the ideal flow would be as follows: <ide> * Automation within external type projects consumes the JSON and automatically <ide> generates a PR to add the API. <ide> <add>## High level approach - development workflow <add> <add>The number of people using TypeScript with Node.js is significant enough <add>that providing a good developer experience is important. While TypeScript <add>is identified specifically, a secondary goal is that what we provide to improve <add>development experience with TypeScript would apply to other type <add>systems and transpiled languages as well. <add> <add>We have agreed that the approach will **NOT** include bundling TypeScript <add>tools with Node.js but instead improve the developer experience for how <add>those tools are installed/configured to work with Node.js. <add> <add>The high level developer experience we are working towards was captured in the <add>[next-10 TypeScript mini-summit](https://github.com/nodejs/next-10/pull/150) <add>and is as follows: <add> <add>1. When Node.js is started with an entry point that is not a file type that <add> Node.js recognizes, for example `node script.ts`, an informative error <add> message is printed that directs users to a webpage where they can <add> learn how to configure Node.js to support that file type. <add> * If the file was a TypeScript file, a TypeScript specific message with a <add> reference to a link on Nodejs.org specific on learning how to <add> configure TypeScript will be provided. <add> * For other file types a generic message and shared webpage will be <add> used. <add>2. Node.js gains support for loading configuration from a file. Most, if not <add> all, of the configuration supported by `NODE_OPTIONS` would be <add> supported in this file (which might be the `package.json` that lives <add> near the entry point file). The webpage with instructions would tell <add> users what configuration to put in this file to get Node.js to support <add> their file type. <add>3. When Node.js is run with the correct configuration, either in a file or <add> `NODE_OPTIONS` or flags, the unknown file type is executed as expected. <add> <add>Some additional specifics around the current approach include: <add> <add>* Loaders already provide a number of the components needed to <add> satisfy the requirements above. They already provide the Node.js <add> options that are needed to achieve many of the requirements above. <add>* `package.json` as the location for the config is potentially a good <add> choice as Node.js already looks for it as part of startup. <add>* The implementation chosen should allow for different configuration <add> in/for different environments/conditions such as production <add> versus development, or different types of hosted environments <add> such as serverless vs traditional, etc.; Node.js would not make <add> any recommendations or have any expectations as to what the <add> separate configuration blocks should be named or what their <add> purposes should be, just that a configuration file should have <add> the ability to provide different configurations for user-defined <add> conditions. <add>* There is no plan to define a default tsconfig.json for all Node.js users <add>* We don't have consensus on provding an opinionated default but <add> that should be explored after the initial steps are complete. <add>* It will be important that as part of the messaging around this <add> functionality that we avoid confusion that could lead people to ship <add> TypeScript files (e.g. `script.ts`) instead of the processed files <add> (e.g. `script.js`). <add> <ide> ## Generation/Consumption of machine readable JSON files <ide> <ide> When you run `make doc` the canonical markdown files used to
1
Javascript
Javascript
fix jshint failure
109da39c9b645b7232988bd7def912d6fc48ddb3
<ide><path>packages/ember-runtime/lib/mixins/sortable.js <ide> Ember.SortableMixin = Ember.Mixin.create(Ember.MutableEnumerable, <ide> oldIndex = arrangedContent.indexOf(item), <ide> newIndex = this._binarySearch(item, 0, get(arrangedContent, 'length')); <ide> <del> if (newIndex != oldIndex) { <add> if (newIndex !== oldIndex) { <ide> arrangedContent.removeObject(item); <ide> this.insertItemSorted(item); <ide> }
1
PHP
PHP
remove unused helper
2c7e7609d27fe8789e264cd44d8bd2d53a3f47b5
<ide><path>tests/Fixture/AfterTreesFixture.php <del><?php <del>/** <del> * CakePHP(tm) : Rapid Development Framework (http://cakephp.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. (http://cakefoundation.org) <del> * @link http://www.cakephp.org <del> * @since 1.2.0 <del> * @license http://www.opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\Test\Fixture; <del> <del>use Cake\TestSuite\Fixture\TestFixture; <del> <del>/** <del> * AfterTreeFixture class <del> * <del> */ <del>class AfterTreesFixture extends TestFixture { <del> <del>/** <del> * fields property <del> * <del> * @var array <del> */ <del> public $fields = array( <del> 'id' => ['type' => 'integer'], <del> 'parent_id' => ['type' => 'integer'], <del> 'lft' => ['type' => 'integer'], <del> 'rght' => ['type' => 'integer'], <del> 'name' => ['type' => 'string', 'length' => 255, 'null' => false], <del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]] <del> ); <del> <del>/** <del> * records property <del> * <del> * @var array <del> */ <del> public $records = array( <del> array('parent_id' => null, 'lft' => 1, 'rght' => 2, 'name' => 'One'), <del> array('parent_id' => null, 'lft' => 3, 'rght' => 4, 'name' => 'Two'), <del> array('parent_id' => null, 'lft' => 5, 'rght' => 6, 'name' => 'Three'), <del> array('parent_id' => null, 'lft' => 7, 'rght' => 12, 'name' => 'Four'), <del> array('parent_id' => null, 'lft' => 8, 'rght' => 9, 'name' => 'Five'), <del> array('parent_id' => null, 'lft' => 10, 'rght' => 11, 'name' => 'Six'), <del> array('parent_id' => null, 'lft' => 13, 'rght' => 14, 'name' => 'Seven') <del> ); <del>} <ide><path>tests/Fixture/AuthUserCustomFieldsFixture.php <del><?php <del>/** <del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html> <del> * Copyright (c) Cake Software Foundation, Inc. (http://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. (http://cakefoundation.org) <del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests <del> * @since 1.2.1 <del> * @license http://www.opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\Test\Fixture; <del> <del>use Cake\TestSuite\Fixture\TestFixture; <del> <del>/** <del> * Short description for class. <del> * <del> */ <del>class AuthUserCustomFieldsFixture extends TestFixture { <del> <del>/** <del> * fields property <del> * <del> * @var array <del> */ <del> public $fields = array( <del> 'id' => ['type' => 'integer'], <del> 'email' => ['type' => 'string', 'null' => false], <del> 'password' => ['type' => 'string', 'null' => false], <del> 'created' => 'datetime', <del> 'updated' => 'datetime', <del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]] <del> ); <del> <del>/** <del> * records property <del> * <del> * @var array <del> */ <del> public $records = array( <del> array('email' => 'mariano@example.com', 'password' => '$2a$10$u05j8FjsvLBNdfhBhc21LOuVMpzpabVXQ9OpC2wO3pSO0q6t7HHMO', 'created' => '2007-03-17 01:16:23', 'updated' => '2007-03-17 01:18:31'), <del> array('email' => 'nate@example.com', 'password' => '$2a$10$u05j8FjsvLBNdfhBhc21LOuVMpzpabVXQ9OpC2wO3pSO0q6t7HHMO', 'created' => '2007-03-17 01:18:23', 'updated' => '2007-03-17 01:20:31'), <del> array('email' => 'larry@example.com', 'password' => '$2a$10$u05j8FjsvLBNdfhBhc21LOuVMpzpabVXQ9OpC2wO3pSO0q6t7HHMO', 'created' => '2007-03-17 01:20:23', 'updated' => '2007-03-17 01:22:31'), <del> array('email' => 'garrett@example.com', 'password' => '$2a$10$u05j8FjsvLBNdfhBhc21LOuVMpzpabVXQ9OpC2wO3pSO0q6t7HHMO', 'created' => '2007-03-17 01:22:23', 'updated' => '2007-03-17 01:24:31'), <del> array('email' => 'chartjes@example.com', 'password' => '$2a$10$u05j8FjsvLBNdfhBhc21LOuVMpzpabVXQ9OpC2wO3pSO0q6t7HHMO', 'created' => '2007-03-17 01:22:23', 'updated' => '2007-03-17 01:24:31'), <del> <del> ); <del>} <ide><path>tests/Fixture/FlagTreesFixture.php <del><?php <del>/** <del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html> <del> * Copyright (c) Cake Software Foundation, Inc. (http://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. (http://cakefoundation.org) <del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests <del> * @since 1.2.0 <del> * @license http://www.opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\Test\Fixture; <del> <del>use Cake\TestSuite\Fixture\TestFixture; <del> <del>/** <del> * Flag Tree Test Fixture <del> * <del> * Like Number Tree, but uses a flag for testing scope parameters <del> * <del> */ <del>class FlagTreesFixture extends TestFixture { <del> <del>/** <del> * fields property <del> * <del> * @var array <del> */ <del> public $fields = array( <del> 'id' => ['type' => 'integer'], <del> 'name' => ['type' => 'string', 'null' => false], <del> 'parent_id' => 'integer', <del> 'lft' => ['type' => 'integer', 'null' => false], <del> 'rght' => ['type' => 'integer', 'null' => false], <del> 'flag' => ['type' => 'integer', 'null' => false, 'length' => 1, 'default' => 0], <del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]] <del> ); <del>} <ide><path>tests/Fixture/NumberTreeTwoFixture.php <del><?php <del>/** <del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html> <del> * Copyright (c) Cake Software Foundation, Inc. (http://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. (http://cakefoundation.org) <del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests <del> * @since 1.2.0 <del> * @license http://www.opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\Test\Fixture; <del> <del>use Cake\TestSuite\Fixture\TestFixture; <del> <del>/** <del> * Class NumberTreeTwoFixture <del> * <del> * Generates a tree of data for use testing the tree behavior <del> * <del> */ <del>class NumberTreeTwoFixture extends TestFixture { <del> <del>/** <del> * fields property <del> * <del> * @var array <del> */ <del> public $fields = array( <del> 'id' => ['type' => 'integer'], <del> 'name' => ['type' => 'string', 'null' => false], <del> 'number_tree_id' => ['type' => 'integer', 'null' => false], <del> 'parent_id' => 'integer', <del> 'lft' => ['type' => 'integer', 'null' => false], <del> 'rght' => ['type' => 'integer', 'null' => false], <del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]] <del> ); <del>} <ide><path>tests/Fixture/PeopleFixture.php <del><?php <del>/** <del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html> <del> * Copyright (c) Cake Software Foundation, Inc. (http://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. (http://cakefoundation.org) <del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests <del> * @since 1.2.0 <del> * @license http://www.opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\Test\Fixture; <del> <del>use Cake\TestSuite\Fixture\TestFixture; <del> <del>/** <del> * Class PersonFixture <del> * <del> */ <del>class PeopleFixture extends TestFixture { <del> <del>/** <del> * fields property <del> * <del> * @var array <del> */ <del> public $fields = array( <del> 'id' => ['type' => 'integer', 'null' => false], <del> 'name' => ['type' => 'string', 'null' => false, 'length' => 32], <del> 'mother_id' => ['type' => 'integer', 'null' => true], <del> 'father_id' => ['type' => 'integer', 'null' => true], <del> '_constraints' => [ <del> 'primary' => ['type' => 'primary', 'columns' => ['id']], <del> 'mother_idx' => ['type' => 'unique', 'columns' => ['mother_id', 'father_id']], <del> ] <del> ); <del> <del>/** <del> * records property <del> * <del> * @var array <del> */ <del> public $records = array( <del> array('name' => 'person', 'mother_id' => 2, 'father_id' => 3), <del> array('name' => 'mother', 'mother_id' => 4, 'father_id' => 5), <del> array('name' => 'father', 'mother_id' => 6, 'father_id' => 7), <del> array('name' => 'mother - grand mother', 'mother_id' => null, 'father_id' => null), <del> array('name' => 'mother - grand father', 'mother_id' => null, 'father_id' => null), <del> array('name' => 'father - grand mother', 'mother_id' => null, 'father_id' => null), <del> array('name' => 'father - grand father', 'mother_id' => null, 'father_id' => null) <del> ); <del>} <ide><path>tests/Fixture/PostsTagFixture.php <del><?php <del>/** <del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html> <del> * Copyright (c) Cake Software Foundation, Inc. (http://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. (http://cakefoundation.org) <del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests <del> * @since 1.2.0 <del> * @license http://www.opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\Test\Fixture; <del> <del>use Cake\TestSuite\Fixture\TestFixture; <del> <del>/** <del> * Class PostsTagFixture <del> * <del> */ <del>class PostsTagFixture extends TestFixture { <del> <del>/** <del> * fields property <del> * <del> * @var array <del> */ <del> public $fields = array( <del> 'post_id' => ['type' => 'integer', 'null' => false], <del> 'tag_id' => ['type' => 'string', 'null' => false], <del> '_constraints' => ['posts_tag' => ['type' => 'unique', 'columns' => ['tag_id', 'post_id']]] <del> ); <del> <del>/** <del> * records property <del> * <del> * @var array <del> */ <del> public $records = array( <del> array('post_id' => 1, 'tag_id' => 'tag1'), <del> array('post_id' => 1, 'tag_id' => 'tag2'), <del> array('post_id' => 2, 'tag_id' => 'tag1'), <del> array('post_id' => 2, 'tag_id' => 'tag3') <del> ); <del>} <ide><path>tests/Fixture/TestPluginArticlesFixture.php <del><?php <del>/** <del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html> <del> * Copyright (c) Cake Software Foundation, Inc. (http://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. (http://cakefoundation.org) <del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests <del> * @since 0.0.1 <del> * @license http://www.opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\Test\Fixture; <del> <del>use Cake\TestSuite\Fixture\TestFixture; <del> <del>/** <del> * Class TestPluginArticleFixture <del> * <del> */ <del>class TestPluginArticlesFixture extends TestFixture { <del> <del>/** <del> * fields property <del> * <del> * @var array <del> */ <del> public $fields = array( <del> 'id' => ['type' => 'integer'], <del> 'user_id' => ['type' => 'integer', 'null' => false], <del> 'title' => ['type' => 'string', 'null' => false], <del> 'body' => 'text', <del> 'published' => ['type' => 'string', 'length' => 1, 'default' => 'N'], <del> 'created' => 'datetime', <del> 'updated' => 'datetime', <del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]] <del> ); <del> <del>/** <del> * records property <del> * <del> * @var array <del> */ <del> public $records = array( <del> array('user_id' => 1, 'title' => 'First Plugin Article', 'body' => 'First Plugin Article Body', 'published' => 'Y', 'created' => '2008-09-24 10:39:23', 'updated' => '2008-09-24 10:41:31'), <del> array('user_id' => 3, 'title' => 'Second Plugin Article', 'body' => 'Second Plugin Article Body', 'published' => 'Y', 'created' => '2008-09-24 10:41:23', 'updated' => '2008-09-24 10:43:31'), <del> array('user_id' => 1, 'title' => 'Third Plugin Article', 'body' => 'Third Plugin Article Body', 'published' => 'Y', 'created' => '2008-09-24 10:43:23', 'updated' => '2008-09-24 10:45:31') <del> ); <del>} <ide><path>tests/Fixture/TranslateArticlesFixture.php <del><?php <del>/** <del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html> <del> * Copyright (c) Cake Software Foundation, Inc. (http://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. (http://cakefoundation.org) <del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests <del> * @since 1.2.0 <del> * @license http://www.opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\Test\Fixture; <del> <del>use Cake\TestSuite\Fixture\TestFixture; <del> <del>/** <del> * Class TranslateArticleFixture <del> * <del> */ <del>class TranslateArticlesFixture extends TestFixture { <del> <del>/** <del> * table property <del> * <del> * @var string <del> */ <del> public $table = 'article_i18n'; <del> <del>/** <del> * fields property <del> * <del> * @var array <del> */ <del> public $fields = array( <del> 'id' => ['type' => 'integer'], <del> 'locale' => ['type' => 'string', 'length' => 6, 'null' => false], <del> 'model' => ['type' => 'string', 'null' => false], <del> 'foreign_key' => ['type' => 'integer', 'null' => false], <del> 'field' => ['type' => 'string', 'null' => false], <del> 'content' => ['type' => 'text'], <del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]] <del> ); <del> <del>/** <del> * records property <del> * <del> * @var array <del> */ <del> public $records = array( <del> array('locale' => 'eng', 'model' => 'TranslatedArticle', 'foreign_key' => 1, 'field' => 'title', 'content' => 'Title (eng) #1'), <del> array('locale' => 'eng', 'model' => 'TranslatedArticle', 'foreign_key' => 1, 'field' => 'body', 'content' => 'Body (eng) #1'), <del> array('locale' => 'deu', 'model' => 'TranslatedArticle', 'foreign_key' => 1, 'field' => 'title', 'content' => 'Title (deu) #1'), <del> array('locale' => 'deu', 'model' => 'TranslatedArticle', 'foreign_key' => 1, 'field' => 'body', 'content' => 'Body (deu) #1'), <del> array('locale' => 'cze', 'model' => 'TranslatedArticle', 'foreign_key' => 1, 'field' => 'title', 'content' => 'Title (cze) #1'), <del> array('locale' => 'cze', 'model' => 'TranslatedArticle', 'foreign_key' => 1, 'field' => 'body', 'content' => 'Body (cze) #1'), <del> array('locale' => 'eng', 'model' => 'TranslatedArticle', 'foreign_key' => 2, 'field' => 'title', 'content' => 'Title (eng) #2'), <del> array('locale' => 'eng', 'model' => 'TranslatedArticle', 'foreign_key' => 2, 'field' => 'body', 'content' => 'Body (eng) #2'), <del> array('locale' => 'deu', 'model' => 'TranslatedArticle', 'foreign_key' => 2, 'field' => 'title', 'content' => 'Title (deu) #2'), <del> array('locale' => 'deu', 'model' => 'TranslatedArticle', 'foreign_key' => 2, 'field' => 'body', 'content' => 'Body (deu) #2'), <del> array('locale' => 'cze', 'model' => 'TranslatedArticle', 'foreign_key' => 2, 'field' => 'title', 'content' => 'Title (cze) #2'), <del> array('locale' => 'cze', 'model' => 'TranslatedArticle', 'foreign_key' => 2, 'field' => 'body', 'content' => 'Body (cze) #2'), <del> array('locale' => 'eng', 'model' => 'TranslatedArticle', 'foreign_key' => 3, 'field' => 'title', 'content' => 'Title (eng) #3'), <del> array('locale' => 'eng', 'model' => 'TranslatedArticle', 'foreign_key' => 3, 'field' => 'body', 'content' => 'Body (eng) #3'), <del> array('locale' => 'deu', 'model' => 'TranslatedArticle', 'foreign_key' => 3, 'field' => 'title', 'content' => 'Title (deu) #3'), <del> array('locale' => 'deu', 'model' => 'TranslatedArticle', 'foreign_key' => 3, 'field' => 'body', 'content' => 'Body (deu) #3'), <del> array('locale' => 'cze', 'model' => 'TranslatedArticle', 'foreign_key' => 3, 'field' => 'title', 'content' => 'Title (cze) #3'), <del> array('locale' => 'cze', 'model' => 'TranslatedArticle', 'foreign_key' => 3, 'field' => 'body', 'content' => 'Body (cze) #3') <del> ); <del>} <ide><path>tests/Fixture/TranslateTableFixture.php <del><?php <del>/** <del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html> <del> * Copyright (c) Cake Software Foundation, Inc. (http://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. (http://cakefoundation.org) <del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests <del> * @since 1.2.0 <del> * @license http://www.opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\Test\Fixture; <del> <del>use Cake\TestSuite\Fixture\TestFixture; <del> <del>/** <del> * Class TranslateTableFixture <del> * <del> */ <del>class TranslateTablesFixture extends TestFixture { <del> <del>/** <del> * table property <del> * <del> * @var string <del> */ <del> public $table = 'another_i18n'; <del> <del>/** <del> * fields property <del> * <del> * @var array <del> */ <del> public $fields = array( <del> 'id' => ['type' => 'integer'], <del> 'locale' => ['type' => 'string', 'length' => 6, 'null' => false], <del> 'model' => ['type' => 'string', 'null' => false], <del> 'foreign_key' => ['type' => 'integer', 'null' => false], <del> 'field' => ['type' => 'string', 'null' => false], <del> 'content' => ['type' => 'text'], <del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]] <del> ); <del> <del>/** <del> * records property <del> * <del> * @var array <del> */ <del> public $records = array( <del> array('locale' => 'eng', 'model' => 'TranslatedItemWithTable', 'foreign_key' => 1, 'field' => 'title', 'content' => 'Another Title #1'), <del> array('locale' => 'eng', 'model' => 'TranslatedItemWithTable', 'foreign_key' => 1, 'field' => 'content', 'content' => 'Another Content #1') <del> ); <del>} <ide><path>tests/Fixture/TranslateWithPrefixesFixture.php <del><?php <del>/** <del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html> <del> * Copyright (c) Cake Software Foundation, Inc. (http://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. (http://cakefoundation.org) <del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests <del> * @since 1.2.0 <del> * @license http://www.opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\Test\Fixture; <del> <del>use Cake\TestSuite\Fixture\TestFixture; <del> <del>/** <del> * Class TranslateWithPrefixFixture <del> * <del> */ <del>class TranslateWithPrefixesFixture extends TestFixture { <del> <del>/** <del> * table property <del> * <del> * @var string <del> */ <del> public $table = 'i18n_translate_with_prefixes'; <del> <del>/** <del> * fields property <del> * <del> * @var array <del> */ <del> public $fields = array( <del> 'id' => ['type' => 'integer'], <del> 'locale' => ['type' => 'string', 'length' => 6, 'null' => false], <del> 'model' => ['type' => 'string', 'null' => false], <del> 'foreign_key' => ['type' => 'integer', 'null' => false], <del> 'field' => ['type' => 'string', 'null' => false], <del> 'content' => ['type' => 'text'], <del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]] <del> ); <del> <del>/** <del> * records property <del> * <del> * @var array <del> */ <del> public $records = array( <del> array('id' => 1, 'locale' => 'eng', 'model' => 'TranslatedItem', 'foreign_key' => 1, 'field' => 'title', 'content' => 'Title #1'), <del> array('id' => 2, 'locale' => 'eng', 'model' => 'TranslatedItem', 'foreign_key' => 1, 'field' => 'content', 'content' => 'Content #1'), <del> array('id' => 3, 'locale' => 'deu', 'model' => 'TranslatedItem', 'foreign_key' => 1, 'field' => 'title', 'content' => 'Titel #1'), <del> array('id' => 4, 'locale' => 'deu', 'model' => 'TranslatedItem', 'foreign_key' => 1, 'field' => 'content', 'content' => 'Inhalt #1'), <del> array('id' => 5, 'locale' => 'cze', 'model' => 'TranslatedItem', 'foreign_key' => 1, 'field' => 'title', 'content' => 'Titulek #1'), <del> array('id' => 6, 'locale' => 'cze', 'model' => 'TranslatedItem', 'foreign_key' => 1, 'field' => 'content', 'content' => 'Obsah #1'), <del> array('id' => 7, 'locale' => 'eng', 'model' => 'TranslatedItem', 'foreign_key' => 2, 'field' => 'title', 'content' => 'Title #2'), <del> array('id' => 8, 'locale' => 'eng', 'model' => 'TranslatedItem', 'foreign_key' => 2, 'field' => 'content', 'content' => 'Content #2'), <del> array('id' => 9, 'locale' => 'deu', 'model' => 'TranslatedItem', 'foreign_key' => 2, 'field' => 'title', 'content' => 'Titel #2'), <del> array('id' => 10, 'locale' => 'deu', 'model' => 'TranslatedItem', 'foreign_key' => 2, 'field' => 'content', 'content' => 'Inhalt #2'), <del> array('id' => 11, 'locale' => 'cze', 'model' => 'TranslatedItem', 'foreign_key' => 2, 'field' => 'title', 'content' => 'Titulek #2'), <del> array('id' => 12, 'locale' => 'cze', 'model' => 'TranslatedItem', 'foreign_key' => 2, 'field' => 'content', 'content' => 'Obsah #2'), <del> array('id' => 13, 'locale' => 'eng', 'model' => 'TranslatedItem', 'foreign_key' => 3, 'field' => 'title', 'content' => 'Title #3'), <del> array('id' => 14, 'locale' => 'eng', 'model' => 'TranslatedItem', 'foreign_key' => 3, 'field' => 'content', 'content' => 'Content #3'), <del> array('id' => 15, 'locale' => 'deu', 'model' => 'TranslatedItem', 'foreign_key' => 3, 'field' => 'title', 'content' => 'Titel #3'), <del> array('id' => 16, 'locale' => 'deu', 'model' => 'TranslatedItem', 'foreign_key' => 3, 'field' => 'content', 'content' => 'Inhalt #3'), <del> array('id' => 17, 'locale' => 'cze', 'model' => 'TranslatedItem', 'foreign_key' => 3, 'field' => 'title', 'content' => 'Titulek #3'), <del> array('id' => 18, 'locale' => 'cze', 'model' => 'TranslatedItem', 'foreign_key' => 3, 'field' => 'content', 'content' => 'Obsah #3') <del> ); <del>} <ide><path>tests/Fixture/TranslatedArticlesFixture.php <del><?php <del>/** <del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html> <del> * Copyright (c) Cake Software Foundation, Inc. (http://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. (http://cakefoundation.org) <del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests <del> * @since 1.2.0 <del> * @license http://www.opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\Test\Fixture; <del> <del>use Cake\TestSuite\Fixture\TestFixture; <del> <del>/** <del> * Class TranslatedArticleFixture <del> * <del> */ <del>class TranslatedArticlesFixture extends TestFixture { <del> <del>/** <del> * fields property <del> * <del> * @var array <del> */ <del> public $fields = array( <del> 'id' => ['type' => 'integer'], <del> 'user_id' => ['type' => 'integer', 'null' => false], <del> 'published' => ['type' => 'string', 'length' => 1, 'default' => 'N'], <del> 'created' => 'datetime', <del> 'updated' => 'datetime', <del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]] <del> ); <del> <del>/** <del> * records property <del> * <del> * @var array <del> */ <del> public $records = array( <del> array('id' => 1, 'user_id' => 1, 'published' => 'Y', 'created' => '2007-03-18 10:39:23', 'updated' => '2007-03-18 10:41:31'), <del> array('id' => 2, 'user_id' => 3, 'published' => 'Y', 'created' => '2007-03-18 10:41:23', 'updated' => '2007-03-18 10:43:31'), <del> array('id' => 3, 'user_id' => 1, 'published' => 'Y', 'created' => '2007-03-18 10:43:23', 'updated' => '2007-03-18 10:45:31') <del> ); <del>} <ide><path>tests/Fixture/TranslatedItemFixture.php <del><?php <del>/** <del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html> <del> * Copyright (c) Cake Software Foundation, Inc. (http://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. (http://cakefoundation.org) <del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests <del> * @since 1.2.0 <del> * @license http://www.opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\Test\Fixture; <del> <del>use Cake\TestSuite\Fixture\TestFixture; <del> <del>/** <del> * Class TranslatedItemFixture <del> * <del> */ <del>class TranslatedItemFixture extends TestFixture { <del> <del>/** <del> * fields property <del> * <del> * @var array <del> */ <del> public $fields = array( <del> 'id' => ['type' => 'integer'], <del> 'translated_article_id' => ['type' => 'integer'], <del> 'slug' => ['type' => 'string', 'null' => false], <del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]] <del> ); <del> <del>/** <del> * records property <del> * <del> * @var array <del> */ <del> public $records = array( <del> array('translated_article_id' => 1, 'slug' => 'first_translated'), <del> array('translated_article_id' => 1, 'slug' => 'second_translated'), <del> array('translated_article_id' => 1, 'slug' => 'third_translated') <del> ); <del>} <ide><path>tests/Fixture/UnconventionalTreeFixture.php <del><?php <del>/** <del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html> <del> * Copyright (c) Cake Software Foundation, Inc. (http://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. (http://cakefoundation.org) <del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests <del> * @since 1.2.0 <del> * @license http://www.opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\Test\Fixture; <del> <del>use Cake\TestSuite\Fixture\TestFixture; <del> <del>/** <del> * UnconventionalTreeFixture class <del> * <del> * Like Number tree, but doesn't use the default values for lft and rght or parent_id <del> * <del> * @uses TestFixture <del> */ <del>class UnconventionalTreesFixture extends TestFixture { <del> <del>/** <del> * fields property <del> * <del> * @var array <del> */ <del> public $fields = array( <del> 'id' => ['type' => 'integer'], <del> 'name' => ['type' => 'string', 'null' => false], <del> 'join' => 'integer', <del> 'left' => ['type' => 'integer', 'null' => false], <del> 'right' => ['type' => 'integer', 'null' => false], <del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]] <del> ); <del>} <ide><path>tests/Fixture/UnsignedFixture.php <del><?php <del>/** <del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html> <del> * Copyright (c) Cake Software Foundation, Inc. (http://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. (http://cakefoundation.org) <del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests <del> * @since 2.5.0 <del> * @license http://www.opensource.org/licenses/mit-license.php MIT License <del> */ <del> <del>/** <del> * Short description for class. <del> * <del> */ <del>class UnsignedFixture extends CakeTestFixture { <del> <del>/** <del> * table property <del> * <del> * @var array <del> */ <del> public $table = 'unsigned'; <del> <del>/** <del> * fields property <del> * <del> * @var array <del> */ <del> public $fields = array( <del> 'uinteger' => array('type' => 'integer', 'null' => '', 'default' => '1', 'length' => '8', 'key' => 'primary', 'unsigned' => true), <del> 'integer' => array('type' => 'integer', 'length' => '8', 'unsigned' => false), <del> 'udecimal' => array('type' => 'decimal', 'length' => '4', 'unsigned' => true), <del> 'decimal' => array('type' => 'decimal', 'length' => '4'), <del> 'biginteger' => array('type' => 'biginteger', 'length' => '20', 'default' => 3), <del> 'ubiginteger' => array('type' => 'biginteger', 'length' => '20', 'default' => 3, 'unsigned' => true), <del> 'float' => array('type' => 'float', 'length' => '4'), <del> 'ufloat' => array('type' => 'float', 'length' => '4', 'unsigned' => true), <del> 'string' => array('type' => 'string', 'length' => '4'), <del> 'tableParameters' => array( <del> 'engine' => 'MyISAM' <del> ) <del> ); <del> <del>/** <del> * records property <del> * <del> * @var array <del> */ <del> public $records = array(); <del>} <ide><path>tests/Fixture/UuidFixture.php <del><?php <del>/** <del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html> <del> * Copyright (c) Cake Software Foundation, Inc. (http://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. (http://cakefoundation.org) <del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests <del> * @since 1.2.0 <del> * @license http://www.opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\Test\Fixture; <del> <del>use Cake\TestSuite\Fixture\TestFixture; <del> <del>/** <del> * Class UuidFixture. <del> * <del> */ <del>class UuidFixture extends TestFixture { <del> <del>/** <del> * fields property <del> * <del> * @var array <del> */ <del> public $fields = array( <del> 'id' => ['type' => 'uuid'], <del> 'title' => 'string', <del> 'count' => ['type' => 'integer', 'default' => 0], <del> 'created' => 'datetime', <del> 'updated' => 'datetime', <del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]] <del> ); <del> <del>/** <del> * records property <del> * <del> * @var array <del> */ <del> public $records = array( <del> array('id' => '47c36f9c-bc00-4d17-9626-4e183ca6822b', 'title' => 'Unique record 1', 'count' => 2, 'created' => '2008-03-13 01:16:23', 'updated' => '2008-03-13 01:18:31'), <del> array('id' => '47c36f9c-f2b0-43f5-b3f7-4e183ca6822b', 'title' => 'Unique record 2', 'count' => 4, 'created' => '2008-03-13 01:18:24', 'updated' => '2008-03-13 01:20:32'), <del> array('id' => '47c36f9c-0ffc-4084-9b03-4e183ca6822b', 'title' => 'Unique record 3', 'count' => 5, 'created' => '2008-03-13 01:20:25', 'updated' => '2008-03-13 01:22:33'), <del> array('id' => '47c36f9c-2578-4c2e-aeab-4e183ca6822b', 'title' => 'Unique record 4', 'count' => 3, 'created' => '2008-03-13 01:22:26', 'updated' => '2008-03-13 01:24:34'), <del> ); <del>} <ide><path>tests/Fixture/UuidTagsFixture.php <del><?php <del>/** <del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html> <del> * Copyright (c) Cake Software Foundation, Inc. (http://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. (http://cakefoundation.org) <del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests <del> * @since 1.2.0 <del> * @license http://www.opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\Test\Fixture; <del> <del>use Cake\TestSuite\Fixture\TestFixture; <del> <del>/** <del> * Class UuidTagFixture <del> * <del> */ <del>class UuidTagsFixture extends TestFixture { <del> <del>/** <del> * fields property <del> * <del> * @var array <del> */ <del> public $fields = array( <del> 'id' => ['type' => 'uuid'], <del> 'name' => ['type' => 'string', 'length' => 255], <del> 'created' => ['type' => 'datetime'], <del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]] <del> ); <del> <del>/** <del> * records property <del> * <del> * @var array <del> */ <del> public $records = array( <del> array('id' => '481fc6d0-b920-43e0-e50f-6d1740cf8569', 'name' => 'MyTag', 'created' => '2009-12-09 12:30:00') <del> ); <del>} <ide><path>tests/Fixture/UuidTreesFixture.php <del><?php <del>/** <del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html> <del> * Copyright (c) Cake Software Foundation, Inc. (http://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. (http://cakefoundation.org) <del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests <del> * @since 1.2.0 <del> * @license http://www.opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\Test\Fixture; <del> <del>use Cake\TestSuite\Fixture\TestFixture; <del> <del>/** <del> * UuidTreeFixture class <del> * <del> * @uses TestFixture <del> */ <del>class UuidTreesFixture extends TestFixture { <del> <del>/** <del> * fields property <del> * <del> * @var array <del> */ <del> public $fields = array( <del> 'id' => ['type' => 'uuid'], <del> 'name' => ['type' => 'string', 'null' => false], <del> 'parent_id' => ['type' => 'uuid', 'null' => true], <del> 'lft' => ['type' => 'integer', 'null' => false], <del> 'rght' => ['type' => 'integer', 'null' => false], <del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]] <del> ); <del>} <ide><path>tests/Fixture/UuiditemsUuidportfolioNumericidsFixture.php <del><?php <del>/** <del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html> <del> * Copyright (c) Cake Software Foundation, Inc. (http://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. (http://cakefoundation.org) <del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests <del> * @since 1.2.0 <del> * @license http://www.opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\Test\Fixture; <del> <del>use Cake\TestSuite\Fixture\TestFixture; <del> <del>/** <del> * Class UuiditemsUuidportfolioNumericidFixture <del> * <del> */ <del>class UuiditemsUuidportfolioNumericidsFixture extends TestFixture { <del> <del>/** <del> * fields property <del> * <del> * @var array <del> */ <del> public $fields = array( <del> 'id' => ['type' => 'integer', 'length' => 10], <del> 'uuiditem_id' => ['type' => 'uuid', 'null' => false], <del> 'uuidportfolio_id' => ['type' => 'uuid', 'null' => false], <del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]] <del> ); <del> <del>/** <del> * records property <del> * <del> * @var array <del> */ <del> public $records = array( <del> array('uuiditem_id' => '481fc6d0-b920-43e0-a40d-6d1740cf8569', 'uuidportfolio_id' => '4806e091-6940-4d2b-b227-303740cf8569'), <del> array('uuiditem_id' => '48298a29-81c0-4c26-a7fb-413140cf8569', 'uuidportfolio_id' => '480af662-eb8c-47d3-886b-230540cf8569'), <del> array('uuiditem_id' => '482b7756-8da0-419a-b21f-27da40cf8569', 'uuidportfolio_id' => '4806e091-6940-4d2b-b227-303740cf8569'), <del> array('uuiditem_id' => '482cfd4b-0e7c-4ea3-9582-4cec40cf8569', 'uuidportfolio_id' => '4806e091-6940-4d2b-b227-303740cf8569') <del> ); <del>} <ide><path>tests/Fixture/UuiditemsUuidportfoliosFixture.php <del><?php <del>/** <del> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html> <del> * Copyright (c) Cake Software Foundation, Inc. (http://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. (http://cakefoundation.org) <del> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests <del> * @since 1.2.0 <del> * @license http://www.opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\Test\Fixture; <del> <del>use Cake\TestSuite\Fixture\TestFixture; <del> <del>/** <del> * Class UuiditemsUuidportfolioFixture <del> * <del> */ <del>class UuiditemsUuidportfoliosFixture extends TestFixture { <del> <del>/** <del> * fields property <del> * <del> * @var array <del> */ <del> public $fields = array( <del> 'id' => ['type' => 'uuid'], <del> 'uuiditem_id' => ['type' => 'uuid', 'null' => false], <del> 'uuidportfolio_id' => ['type' => 'uuid', 'null' => false], <del> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]] <del> ); <del> <del>/** <del> * records property <del> * <del> * @var array <del> */ <del> public $records = array( <del> array('id' => '4850fd8f-cc5c-449f-bf34-0c5240cf8569', 'uuiditem_id' => '481fc6d0-b920-43e0-a40d-6d1740cf8569', 'uuidportfolio_id' => '4806e091-6940-4d2b-b227-303740cf8569'), <del> array('id' => '4850fee5-d24c-4ea0-9759-0c2e40cf8569', 'uuiditem_id' => '48298a29-81c0-4c26-a7fb-413140cf8569', 'uuidportfolio_id' => '480af662-eb8c-47d3-886b-230540cf8569'), <del> array('id' => '4851af6e-fa18-403d-b57e-437d40cf8569', 'uuiditem_id' => '482b7756-8da0-419a-b21f-27da40cf8569', 'uuidportfolio_id' => '4806e091-6940-4d2b-b227-303740cf8569'), <del> array('id' => '4851b94c-9790-42dc-b760-4f9240cf8569', 'uuiditem_id' => '482cfd4b-0e7c-4ea3-9582-4cec40cf8569', 'uuidportfolio_id' => '4806e091-6940-4d2b-b227-303740cf8569') <del> ); <del>}
19
Javascript
Javascript
fix jshint warnings in grunt/
42e20a1488031ce0f6d10bfcb89ec4b56a33e578
<ide><path>grunt/config/webdriver-all.js <ide> module.exports = function(props){ <ide> } <ide> <ide> return exports; <del>} <add>}; <ide><path>grunt/config/webdriver-perf.js <ide> var params = [] <ide> ) <ide> .concat(reactVersions <ide> .map(encodeURIComponent) <del> .map(function(version){ return 'react=' + version } <add> .map(function(version){ return 'react=' + version; } <ide> ) <ide> ); <ide> <ide><path>grunt/tasks/npm-react-tools.js <ide> var fs = require('fs'); <ide> var grunt = require('grunt'); <ide> <ide> function pack() { <add> /*jshint validthis:true */ <ide> var done = this.async(); <ide> var spawnCmd = { <ide> cmd: 'npm', <ide><path>grunt/tasks/npm-react.js <ide> function buildRelease() { <ide> } <ide> <ide> function packRelease() { <add> /*jshint validthis:true */ <ide> var done = this.async(); <ide> var spawnCmd = { <ide> cmd: 'npm', <ide> function packRelease() { <ide> } <ide> }; <ide> grunt.util.spawn(spawnCmd, function() { <del> var src = 'build/react-' + grunt.config.data.pkg.version + '.tgz' <add> var src = 'build/react-' + grunt.config.data.pkg.version + '.tgz'; <ide> var dest = 'build/react.tgz'; <ide> fs.rename(src, dest, done); <ide> });
4
Text
Text
add 2 testing communities for women
8c0ad877abe1eb63d868ef3ac84f408cf6cb82d8
<ide><path>guide/english/working-in-tech/women-in-tech/index.md <ide> Encouraging girls in elementary, middle, and high school can also help to increa <ide> - [1 Million Women To Tech](https://1millionwomentotech.com/) <ide> - [Women Techmakers](https://www.womentechmakers.com/) <ide> <del> <ide> ### Podcasts on Women-in-tech: <ide> If you're interested in podcasts, check out Esperee Devora's on women in tech [here](http://podcast.womenintechshow.com/episodes).
1
Java
Java
remove unused code in reacttextview
48ba44087f3de8fe8a90e758cc3d49e490e7461a
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java <ide> public class ReactTextView extends TextView implements ReactCompoundView { <ide> private boolean mContainsImages; <ide> private int mDefaultGravityHorizontal; <ide> private int mDefaultGravityVertical; <del> private boolean mTextIsSelectable; <del> private float mLineHeight = Float.NaN; <ide> private int mTextAlign = Gravity.NO_GRAVITY; <ide> private int mNumberOfLines = ViewDefaults.NUMBER_OF_LINES; <ide> private TextUtils.TruncateAt mEllipsizeLocation = TextUtils.TruncateAt.END; <ide> public int reactTagForTouch(float touchX, float touchY) { <ide> return target; <ide> } <ide> <del> @Override <del> public void setTextIsSelectable(boolean selectable) { <del> mTextIsSelectable = selectable; <del> super.setTextIsSelectable(selectable); <del> } <del> <ide> @Override <ide> protected boolean verifyDrawable(Drawable drawable) { <ide> if (mContainsImages && getText() instanceof Spanned) {
1
PHP
PHP
fix code style
0749932b7914edd551ffa8a8ec420a09b71b325f
<ide><path>src/Illuminate/Notifications/Messages/SlackAttachment.php <ide> public function footer($footer) <ide> public function footerIcon($icon) <ide> { <ide> $this->footerIcon = $icon; <del> <add> <ide> return $this; <ide> } <ide>
1
Javascript
Javascript
improve buffer transcode
9f58e029087b73609fb19a0f226996a4cc019789
<ide><path>test/parallel/test-icu-transcode.js <ide> for (const test in tests) { <ide> utf8_to_ucs2.toString('ucs2')); <ide> } <ide> <add>assert.throws( <add> () => buffer.transcode(null, 'utf8', 'ascii'), <add> /^TypeError: "source" argument must be a Buffer$/ <add>); <add> <ide> assert.throws( <ide> () => buffer.transcode(Buffer.from('a'), 'b', 'utf8'), <del> /Unable to transcode Buffer \[U_ILLEGAL_ARGUMENT_ERROR\]/ <add> /^Error: Unable to transcode Buffer \[U_ILLEGAL_ARGUMENT_ERROR\]/ <ide> ); <add> <ide> assert.throws( <ide> () => buffer.transcode(Buffer.from('a'), 'uf8', 'b'), <del> /Unable to transcode Buffer \[U_ILLEGAL_ARGUMENT_ERROR\]/ <add> /^Error: Unable to transcode Buffer \[U_ILLEGAL_ARGUMENT_ERROR\]$/ <ide> ); <ide> <ide> assert.deepStrictEqual(
1
Python
Python
add ec2 ap southeast
1b9150fd60048c8c290e8bddd32a6ca172721de9
<ide><path>libcloud/drivers/ec2.py <ide> EC2_US_EAST_HOST = 'ec2.us-east-1.amazonaws.com' <ide> EC2_US_WEST_HOST = 'ec2.us-west-1.amazonaws.com' <ide> EC2_EU_WEST_HOST = 'ec2.eu-west-1.amazonaws.com' <add>EC2_AP_SOUTHEAST_HOST = 'ec2.ap-southeast-1.amazonaws.com' <ide> <ide> API_VERSION = '2009-11-30' <ide> <ide> EC2_US_EAST_INSTANCE_TYPES = dict(EC2_INSTANCE_TYPES) <ide> EC2_US_WEST_INSTANCE_TYPES = dict(EC2_INSTANCE_TYPES) <ide> EC2_EU_WEST_INSTANCE_TYPES = dict(EC2_INSTANCE_TYPES) <add>EC2_AP_SOUTHEAST_INSTANCE_TYPES = dict(EC2_INSTANCE_TYPES) <ide> <ide> EC2_US_EAST_INSTANCE_TYPES['m1.small']['price'] = '.085' <ide> EC2_US_EAST_INSTANCE_TYPES['m1.large']['price'] = '.34' <ide> EC2_EU_WEST_INSTANCE_TYPES['m2.2xlarge']['price'] = '1.34' <ide> EC2_EU_WEST_INSTANCE_TYPES['m2.4xlarge']['price'] = '2.68' <ide> <add># prices are the same <add>EC2_AP_SOUTHEAST_INSTANCE_TYPES = dict(EC2_EU_WEST_INSTANCE_TYPES) <add> <ide> class EC2Response(Response): <ide> <ide> def parse_body(self): <ide> class EC2EUConnection(EC2Connection): <ide> <ide> class EC2EUNodeDriver(EC2NodeDriver): <ide> <del> name = 'Amazon EC2 (eu-east-1)' <add> name = 'Amazon EC2 (eu-west-1)' <ide> connectionCls = EC2EUConnection <ide> _instance_types = EC2_EU_WEST_INSTANCE_TYPES <ide> def list_locations(self): <ide> class EC2USWestNodeDriver(EC2NodeDriver): <ide> def list_locations(self): <ide> return [NodeLocation(0, 'Amazon US N. California', 'US', self)] <ide> <add>class EC2APSEConnection(EC2Connection): <add> <add> host = EC2_AP_SOUTHEAST_HOST <add> <add>class EC2APSENodeDriver(EC2NodeDriver): <add> <add> name = 'Amazon EC2 (ap-southeast-1)' <add> connectionCls = EC2APSEConnection <add> _instance_types = EC2_AP_SOUTHEAST_INSTANCE_TYPES <add> def list_locations(self): <add> return [NodeLocation(0, 'Amazon Asia-Pacific Singapore', 'SG', self)] <add> <ide> class EucConnection(EC2Connection): <ide> <ide> host = None <ide><path>test/test_ec2.py <ide> import sys <ide> import unittest <ide> <del>from libcloud.drivers.ec2 import EC2NodeDriver <add>from libcloud.drivers.ec2 import EC2NodeDriver, EC2APSENodeDriver <ide> from libcloud.base import Node, NodeImage, NodeSize <ide> <ide> from test import MockHttp, TestCaseMixin <ide> def _TerminateInstances(self, method, url, body, headers): <ide> body = self.fixtures.load('terminate_instances.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <add>class EC2APSETests(EC2Tests): <add> def setUp(self): <add> EC2APSENodeDriver.connectionCls.conn_classes = (None, EC2MockHttp) <add> EC2MockHttp.use_param = 'Action' <add> self.driver = EC2APSENodeDriver(EC2_ACCESS_ID, EC2_SECRET) <add> <ide> if __name__ == '__main__': <ide> sys.exit(unittest.main())
2
PHP
PHP
fix more incorrect mocks
cae89bfc868d12ccf3da5d87fe4327b8e3ca1bc0
<ide><path>tests/TestCase/Cache/Engine/MemcachedEngineTest.php <ide> public function testMsgpackSerializerSetting() <ide> public function testJsonSerializerThrowException() <ide> { <ide> $this->skipIf( <del> Memcached::HAVE_JSON, <add> (bool)Memcached::HAVE_JSON, <ide> 'Memcached extension is compiled with json support' <ide> ); <ide> <ide> public function testMsgpackSerializerThrowException() <ide> public function testIgbinarySerializerThrowException() <ide> { <ide> $this->skipIf( <del> Memcached::HAVE_IGBINARY, <add> (bool)Memcached::HAVE_IGBINARY, <ide> 'Memcached extension is compiled with igbinary support' <ide> ); <ide> <ide><path>tests/TestCase/Shell/SchemaCacheShellTest.php <ide> public function testBuildEnablesMetadataCache() <ide> */ <ide> public function testBuildNoArgs() <ide> { <add> $this->cache->method('write') <add> ->will($this->returnValue(true)); <add> <ide> $this->cache->expects($this->at(3)) <ide> ->method('write') <del> ->with('test_articles'); <add> ->with('test_articles') <add> ->will($this->returnValue(true)); <ide> <ide> $this->shell->params['connection'] = 'test'; <ide> $this->shell->build(); <ide> public function testBuildNamedModel() <ide> { <ide> $this->cache->expects($this->once()) <ide> ->method('write') <del> ->with('test_articles'); <add> ->with('test_articles') <add> ->will($this->returnValue(true)); <ide> $this->cache->expects($this->never()) <ide> ->method('delete'); <ide> <ide> public function testBuildOverwritesExistingData() <ide> { <ide> $this->cache->expects($this->once()) <ide> ->method('write') <del> ->with('test_articles'); <add> ->with('test_articles') <add> ->will($this->returnValue(true)); <ide> $this->cache->expects($this->never()) <ide> ->method('read'); <ide> $this->cache->expects($this->never()) <ide> public function testClearNoArgs() <ide> public function testClearNamedModel() <ide> { <ide> $this->cache->expects($this->never()) <del> ->method('write'); <add> ->method('write') <add> ->will($this->returnValue(true)); <ide> $this->cache->expects($this->once()) <ide> ->method('delete') <ide> ->with('test_articles');
2
Java
Java
refine json encoding of non-streaming flux
ce568468aed09147e335b5d5a717e1b2dac581a8
<ide><path>spring-web/src/main/java/org/springframework/http/codec/json/AbstractJackson2Encoder.java <ide> import com.fasterxml.jackson.databind.SequenceWriter; <ide> import com.fasterxml.jackson.databind.exc.InvalidDefinitionException; <ide> import com.fasterxml.jackson.databind.ser.FilterProvider; <add>import org.apache.commons.logging.Log; <ide> import org.reactivestreams.Publisher; <ide> import reactor.core.publisher.Flux; <ide> import reactor.core.publisher.Mono; <ide> public abstract class AbstractJackson2Encoder extends Jackson2CodecSupport imple <ide> <ide> private static final byte[] NEWLINE_SEPARATOR = {'\n'}; <ide> <add> private static final byte[] EMPTY_BYTES = new byte[0]; <add> <ide> private static final Map<String, JsonEncoding> ENCODINGS; <ide> <ide> static { <ide> public Flux<DataBuffer> encode(Publisher<?> inputStream, DataBufferFactory buffe <ide> .map(value -> encodeValue(value, bufferFactory, elementType, mimeType, hints)) <ide> .flux(); <ide> } <del> else { <add> <add> try { <add> ObjectMapper mapper = selectObjectMapper(elementType, mimeType); <add> if (mapper == null) { <add> throw new IllegalStateException("No ObjectMapper for " + elementType); <add> } <add> ObjectWriter writer = createObjectWriter(mapper, elementType, mimeType, null, hints); <add> ByteArrayBuilder byteBuilder = new ByteArrayBuilder(writer.getFactory()._getBufferRecycler()); <add> JsonEncoding encoding = getJsonEncoding(mimeType); <add> JsonGenerator generator = mapper.getFactory().createGenerator(byteBuilder, encoding); <add> SequenceWriter sequenceWriter = writer.writeValues(generator); <add> <ide> byte[] separator = getStreamingMediaTypeSeparator(mimeType); <del> if (separator != null) { // streaming <del> try { <del> ObjectMapper mapper = selectObjectMapper(elementType, mimeType); <del> if (mapper == null) { <del> throw new IllegalStateException("No ObjectMapper for " + elementType); <del> } <del> ObjectWriter writer = createObjectWriter(mapper, elementType, mimeType, null, hints); <del> ByteArrayBuilder byteBuilder = new ByteArrayBuilder(writer.getFactory()._getBufferRecycler()); <del> JsonEncoding encoding = getJsonEncoding(mimeType); <del> JsonGenerator generator = mapper.getFactory().createGenerator(byteBuilder, encoding); <del> SequenceWriter sequenceWriter = writer.writeValues(generator); <del> <del> return Flux.from(inputStream) <del> .map(value -> encodeStreamingValue(value, bufferFactory, hints, sequenceWriter, byteBuilder, <del> separator)) <del> .doAfterTerminate(() -> { <del> try { <del> byteBuilder.release(); <del> generator.close(); <del> } <del> catch (IOException ex) { <del> logger.error("Could not close Encoder resources", ex); <del> } <del> }); <del> } <del> catch (IOException ex) { <del> return Flux.error(ex); <del> } <add> Flux<DataBuffer> dataBufferFlux; <add> <add> if (separator != null) { <add> dataBufferFlux = Flux.from(inputStream).map(value -> encodeStreamingValue( <add> value, bufferFactory, hints, sequenceWriter, byteBuilder, EMPTY_BYTES, separator)); <ide> } <del> else { // non-streaming <del> ResolvableType listType = ResolvableType.forClassWithGenerics(List.class, elementType); <del> return Flux.from(inputStream) <del> .collectList() <del> .map(list -> encodeValue(list, bufferFactory, listType, mimeType, hints)) <del> .flux(); <add> else { <add> JsonArrayJoinHelper helper = new JsonArrayJoinHelper(); <add> return Flux.concat( <add> helper.getPrefix(bufferFactory, hints, logger), <add> Flux.from(inputStream).map(value -> encodeStreamingValue( <add> value, bufferFactory, hints, sequenceWriter, byteBuilder, helper.getDelimiter(), EMPTY_BYTES)), <add> helper.getSuffix(bufferFactory, hints, logger)); <ide> } <ide> <add> return dataBufferFlux <add> .doAfterTerminate(() -> { <add> try { <add> byteBuilder.release(); <add> generator.close(); <add> } <add> catch (IOException ex) { <add> logger.error("Could not close Encoder resources", ex); <add> } <add> }); <add> } <add> catch (IOException ex) { <add> return Flux.error(ex); <ide> } <ide> } <ide> <ide> public DataBuffer encodeValue(Object value, DataBufferFactory bufferFactory, <ide> } <ide> } <ide> <del> private DataBuffer encodeStreamingValue(Object value, DataBufferFactory bufferFactory, @Nullable Map<String, Object> hints, <del> SequenceWriter sequenceWriter, ByteArrayBuilder byteArrayBuilder, byte[] separator) { <add> private DataBuffer encodeStreamingValue( <add> Object value, DataBufferFactory bufferFactory, @Nullable Map<String, Object> hints, <add> SequenceWriter sequenceWriter, ByteArrayBuilder byteArrayBuilder, <add> byte[] prefix, byte[] suffix) { <ide> <ide> logValue(hints, value); <ide> <ide> private DataBuffer encodeStreamingValue(Object value, DataBufferFactory bufferFa <ide> offset = 0; <ide> length = bytes.length; <ide> } <del> DataBuffer buffer = bufferFactory.allocateBuffer(length + separator.length); <add> DataBuffer buffer = bufferFactory.allocateBuffer(length + prefix.length + suffix.length); <add> if (prefix.length != 0) { <add> buffer.write(prefix); <add> } <ide> buffer.write(bytes, offset, length); <del> buffer.write(separator); <add> if (suffix.length != 0) { <add> buffer.write(suffix); <add> } <ide> Hints.touchDataBuffer(buffer, hints, logger); <ide> <ide> return buffer; <ide> protected <A extends Annotation> A getAnnotation(MethodParameter parameter, Clas <ide> return parameter.getMethodAnnotation(annotType); <ide> } <ide> <add> <add> private static class JsonArrayJoinHelper { <add> <add> private static final byte[] COMMA_SEPARATOR = {','}; <add> <add> private static final byte[] OPEN_BRACKET = {'['}; <add> <add> private static final byte[] CLOSE_BRACKET = {']'}; <add> <add> <add> private boolean afterFirstItem = false; <add> <add> public byte[] getDelimiter() { <add> if (this.afterFirstItem) { <add> return COMMA_SEPARATOR; <add> } <add> this.afterFirstItem = true; <add> return EMPTY_BYTES; <add> } <add> <add> public Mono<DataBuffer> getPrefix(DataBufferFactory factory, @Nullable Map<String, Object> hints, Log logger) { <add> return wrapBytes(OPEN_BRACKET, factory, hints, logger); <add> } <add> <add> public Mono<DataBuffer> getSuffix(DataBufferFactory factory, @Nullable Map<String, Object> hints, Log logger) { <add> return wrapBytes(CLOSE_BRACKET, factory, hints, logger); <add> } <add> <add> private Mono<DataBuffer> wrapBytes( <add> byte[] bytes, DataBufferFactory bufferFactory, @Nullable Map<String, Object> hints, Log logger) { <add> <add> return Mono.fromCallable(() -> { <add> DataBuffer buffer = bufferFactory.wrap(bytes); <add> Hints.touchDataBuffer(buffer, hints, logger); <add> return buffer; <add> }); <add> } <add> } <add> <ide> } <ide><path>spring-web/src/test/java/org/springframework/http/codec/json/Jackson2JsonEncoderTests.java <ide> <ide> import org.springframework.core.ResolvableType; <ide> import org.springframework.core.io.buffer.DataBuffer; <del>import org.springframework.core.io.buffer.DataBufferUtils; <ide> import org.springframework.core.testfixture.codec.AbstractEncoderTests; <ide> import org.springframework.http.MediaType; <ide> import org.springframework.http.codec.ServerSentEvent; <ide> public void encodeNonStream() { <ide> ); <ide> <ide> testEncode(input, Pojo.class, step -> step <del> .consumeNextWith(expectString("[" + <del> "{\"foo\":\"foo\",\"bar\":\"bar\"}," + <del> "{\"foo\":\"foofoo\",\"bar\":\"barbar\"}," + <del> "{\"foo\":\"foofoofoo\",\"bar\":\"barbarbar\"}]") <del> .andThen(DataBufferUtils::release)) <add> .consumeNextWith(expectString("[")) <add> .consumeNextWith(expectString("{\"foo\":\"foo\",\"bar\":\"bar\"}")) <add> .consumeNextWith(expectString(",{\"foo\":\"foofoo\",\"bar\":\"barbar\"}")) <add> .consumeNextWith(expectString(",{\"foo\":\"foofoofoo\",\"bar\":\"barbarbar\"}")) <add> .consumeNextWith(expectString("]")) <ide> .verifyComplete()); <ide> } <ide> <ide> public void encodeWithType() { <ide> Flux<ParentClass> input = Flux.just(new Foo(), new Bar()); <ide> <ide> testEncode(input, ParentClass.class, step -> step <del> .consumeNextWith(expectString("[{\"type\":\"foo\"},{\"type\":\"bar\"}]") <del> .andThen(DataBufferUtils::release)) <add> .consumeNextWith(expectString("[")) <add> .consumeNextWith(expectString("{\"type\":\"foo\"}")) <add> .consumeNextWith(expectString(",{\"type\":\"bar\"}")) <add> .consumeNextWith(expectString("]")) <ide> .verifyComplete()); <ide> } <ide> <ide> public void encodeAsStreamWithCustomStreamingType() { <ide> ); <ide> <ide> testEncode(input, ResolvableType.forClass(Pojo.class), barMediaType, null, step -> step <del> .consumeNextWith(expectString("{\"foo\":\"foo\",\"bar\":\"bar\"}\n") <del> .andThen(DataBufferUtils::release)) <del> .consumeNextWith(expectString("{\"foo\":\"foofoo\",\"bar\":\"barbar\"}\n") <del> .andThen(DataBufferUtils::release)) <del> .consumeNextWith(expectString("{\"foo\":\"foofoofoo\",\"bar\":\"barbarbar\"}\n") <del> .andThen(DataBufferUtils::release)) <add> .consumeNextWith(expectString("{\"foo\":\"foo\",\"bar\":\"bar\"}\n")) <add> .consumeNextWith(expectString("{\"foo\":\"foofoo\",\"bar\":\"barbar\"}\n")) <add> .consumeNextWith(expectString("{\"foo\":\"foofoofoo\",\"bar\":\"barbarbar\"}\n")) <ide> .verifyComplete() <ide> ); <ide> } <ide> public void fieldLevelJsonView() { <ide> Map<String, Object> hints = singletonMap(JSON_VIEW_HINT, MyJacksonView1.class); <ide> <ide> testEncode(input, type, null, hints, step -> step <del> .consumeNextWith(expectString("{\"withView1\":\"with\"}").andThen(DataBufferUtils::release)) <add> .consumeNextWith(expectString("{\"withView1\":\"with\"}")) <ide> .verifyComplete() <ide> ); <ide> } <ide> public void classLevelJsonView() { <ide> Map<String, Object> hints = singletonMap(JSON_VIEW_HINT, MyJacksonView3.class); <ide> <ide> testEncode(input, type, null, hints, step -> step <del> .consumeNextWith(expectString("{\"withoutView\":\"without\"}").andThen(DataBufferUtils::release)) <add> .consumeNextWith(expectString("{\"withoutView\":\"without\"}")) <ide> .verifyComplete() <ide> ); <ide> } <ide> public void jacksonValue() { <ide> ResolvableType type = ResolvableType.forClass(MappingJacksonValue.class); <ide> <ide> testEncode(Mono.just(jacksonValue), type, null, Collections.emptyMap(), step -> step <del> .consumeNextWith(expectString("{\"withView1\":\"with\"}").andThen(DataBufferUtils::release)) <add> .consumeNextWith(expectString("{\"withView1\":\"with\"}")) <ide> .verifyComplete() <ide> ); <ide> } <ide> public void jacksonValueUnwrappedBeforeObjectMapperSelection() { <ide> String ls = System.lineSeparator(); // output below is different between Unix and Windows <ide> testEncode(Mono.just(jacksonValue), type, halMediaType, Collections.emptyMap(), step -> step <ide> .consumeNextWith(expectString("{" + ls + " \"withView1\" : \"with\"" + ls + "}") <del> .andThen(DataBufferUtils::release)) <add> ) <ide> .verifyComplete() <ide> ); <ide> } <ide> public void encodeWithFlushAfterWriteOff() { <ide> ResolvableType.forClass(Pojo.class), MimeTypeUtils.APPLICATION_JSON, Collections.emptyMap()); <ide> <ide> StepVerifier.create(result) <del> .consumeNextWith(expectString("[{\"foo\":\"foo\",\"bar\":\"bar\"}]")) <add> .consumeNextWith(expectString("[")) <add> .consumeNextWith(expectString("{\"foo\":\"foo\",\"bar\":\"bar\"}")) <add> .consumeNextWith(expectString("]")) <ide> .expectComplete() <ide> .verify(Duration.ofSeconds(5)); <ide> }
2
Javascript
Javascript
improve performance of callbacks
bd1bd7e38d9613d995d273f542cdf6bd2cff1da4
<ide><path>lib/timers.js <ide> exports.active = function(item) { <ide> */ <ide> <ide> <del>exports.setTimeout = function(callback, after) { <del> var timer; <add>exports.setTimeout = function(callback, after, arg1, arg2, arg3) { <add> var timer, i, args; <add> var len = arguments.length; <ide> <ide> after *= 1; // coalesce to number or NaN <ide> <ide> exports.setTimeout = function(callback, after) { <ide> <ide> timer = new Timeout(after); <ide> <del> if (arguments.length <= 2) { <del> timer._onTimeout = callback; <del> } else { <del> /* <del> * Sometimes setTimeout is called with arguments, EG <del> * <del> * setTimeout(callback, 2000, "hello", "world") <del> * <del> * If that's the case we need to call the callback with <del> * those args. The overhead of an extra closure is not <del> * desired in the normal case. <del> */ <del> var args = Array.prototype.slice.call(arguments, 2); <del> timer._onTimeout = function() { <del> callback.apply(timer, args); <del> }; <add> switch (len) { <add> // fast cases <add> case 0: <add> case 1: <add> case 2: <add> timer._onTimeout = callback; <add> break; <add> case 3: <add> timer._onTimeout = function() { <add> callback.call(timer, arg1); <add> }; <add> break; <add> case 4: <add> timer._onTimeout = function() { <add> callback.call(timer, arg1, arg2); <add> }; <add> break; <add> case 5: <add> timer._onTimeout = function() { <add> callback.call(timer, arg1, arg2, arg3); <add> }; <add> break; <add> // slow case <add> default: <add> args = new Array(len - 2); <add> for (i = 2; i < len; i++) <add> args[i - 2] = arguments[i]; <add> <add> timer._onTimeout = function() { <add> callback.apply(timer, args); <add> }; <add> break; <ide> } <ide> <ide> if (process.domain) timer.domain = process.domain; <ide> exports.clearTimeout = function(timer) { <ide> }; <ide> <ide> <del>exports.setInterval = function(callback, repeat) { <add>exports.setInterval = function(callback, repeat, arg1, arg2, arg3) { <ide> repeat *= 1; // coalesce to number or NaN <ide> <ide> if (!(repeat >= 1 && repeat <= TIMEOUT_MAX)) { <ide> repeat = 1; // schedule on next tick, follows browser behaviour <ide> } <ide> <add> var args, i; <ide> var timer = new Timeout(repeat); <del> var args = Array.prototype.slice.call(arguments, 2); <add> var len = arguments.length - 2; <ide> timer._onTimeout = wrapper; <ide> timer._repeat = true; <add> // Initialize args once for repeated invocation of slow case below <add> if (len > 3) { <add> args = new Array(len); <add> for (i = 0; i < len; i++) <add> args[i] = arguments[i + 2]; <add> } <ide> <ide> if (process.domain) timer.domain = process.domain; <ide> exports.active(timer); <ide> <ide> return timer; <ide> <ide> function wrapper() { <del> callback.apply(this, args); <add> switch (len) { <add> // fast cases <add> case 0: <add> callback.call(this); <add> break; <add> case 1: <add> callback.call(this, arg1); <add> break; <add> case 2: <add> callback.call(this, arg1, arg2); <add> break; <add> case 3: <add> callback.call(this, arg1, arg2, arg3); <add> break; <add> // slow case <add> default: <add> callback.apply(this, args); <add> break; <add> } <ide> // If callback called clearInterval(). <ide> if (timer._repeat === false) return; <ide> // If timer is unref'd (or was - it's permanently removed from the list.) <ide> Immediate.prototype._idleNext = undefined; <ide> Immediate.prototype._idlePrev = undefined; <ide> <ide> <del>exports.setImmediate = function(callback) { <add>exports.setImmediate = function(callback, arg1, arg2, arg3) { <add> var i, args; <add> var len = arguments.length; <ide> var immediate = new Immediate(); <del> var args, index; <ide> <ide> L.init(immediate); <ide> <del> immediate._onImmediate = callback; <del> <del> if (arguments.length > 1) { <del> args = []; <del> for (index = 1; index < arguments.length; index++) <del> args.push(arguments[index]); <del> <del> immediate._onImmediate = function() { <del> callback.apply(immediate, args); <del> }; <add> switch (len) { <add> // fast cases <add> case 0: <add> case 1: <add> immediate._onImmediate = callback; <add> break; <add> case 2: <add> immediate._onImmediate = function() { <add> callback.call(immediate, arg1); <add> }; <add> break; <add> case 3: <add> immediate._onImmediate = function() { <add> callback.call(immediate, arg1, arg2); <add> }; <add> break; <add> case 4: <add> immediate._onImmediate = function() { <add> callback.call(immediate, arg1, arg2, arg3); <add> }; <add> break; <add> // slow case <add> default: <add> args = new Array(len - 1); <add> for (i = 1; i < len; i++) <add> args[i - 1] = arguments[i]; <add> <add> immediate._onImmediate = function() { <add> callback.apply(immediate, args); <add> }; <add> break; <ide> } <ide> <ide> if (!process._needImmediateCallback) {
1
Text
Text
improve grammar for the 1st paragraph
01915f5013017254f3982867f4bf699504f73b68
<ide><path>curriculum/challenges/spanish/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/convert-html-entities.spanish.md <ide> localeTitle: Convertir entidades HTML <ide> --- <ide> <ide> ## Description <del><section id="description"> Convierta los caracteres <code>&amp;</code> , <code>&lt;</code> , <code>&gt;</code> , <code>&quot;</code> (comillas dobles) y <code>&#39;</code> (apóstrofe), en una cadena a sus correspondientes entidades HTML. Recuerde usar <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514" target="_blank">Lectura-Búsqueda-Preguntar</a> si se atasca. Intente vincular el programa. Escriba su código propio. </section> <add><section id="description"> Convierta los caracteres <code>&amp;</code> , <code>&lt;</code> , <code>&gt;</code> , <code>&quot;</code> (comillas dobles) y <code>&#39;</code> (apóstrofe), en una cadena con sus correspondientes entidades en HTML. Recuerde usar la <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514" target="_blank">Lectura-Búsqueda-Preguntar</a> si tiene dificultades. Intente vincular el programa. Escriba su propio código. </section> <ide> <ide> ## Instructions <ide> <section id="instructions">
1
Ruby
Ruby
fix style issues in extract command
bd2ac70c0fb9442f6fa8195d9b8cf899dba66481
<ide><path>Library/Homebrew/dev-cmd/extract.rb <ide> module Homebrew <ide> module_function <ide> <ide> def extract <del> Homebrew::CLI::Parser.parse do <add> Homebrew::CLI::Parser.parse do <ide> switch "--stdout", description: "Output to stdout on terminal instead of file" <ide> switch :debug <ide> switch :force <del> end <add> end <ide> <ide> odie "Cannot use a tap and --stdout at the same time!" if ARGV.named.length == 3 && args.stdout? <ide> raise UsageError unless (ARGV.named.length == 3 && !args.stdout?) || (ARGV.named.length == 2 && args.stdout?) <ide> <ide> formula = Formulary.factory(ARGV.named.first) <ide> version = ARGV.named[1] <ide> destination_tap = Tap.fetch(ARGV.named[2]) unless args.stdout? <del> destination_tap.install unless destination_tap.installed? unless args.stdout? <add> destination_tap.install unless destination_tap.installed? || args.stdout? <ide> <ide> unless args.stdout? <ide> path = Pathname.new("#{destination_tap.path}/Formula/#{formula}@#{version}.rb")
1
Go
Go
move sethostconfig to daemon file
dde0cc78bdec31be1ecbd7def6a83111224ccc55
<ide><path>daemon/daemon.go <ide> func (daemon *Daemon) verifyHostConfig(hostConfig *runconfig.HostConfig) ([]stri <ide> <ide> return warnings, nil <ide> } <add> <add>func (daemon *Daemon) setHostConfig(container *Container, hostConfig *runconfig.HostConfig) error { <add> container.Lock() <add> defer container.Unlock() <add> if err := parseSecurityOpt(container, hostConfig); err != nil { <add> return err <add> } <add> <add> // Register any links from the host config before starting the container <add> if err := daemon.RegisterLinks(container, hostConfig); err != nil { <add> return err <add> } <add> <add> container.hostConfig = hostConfig <add> container.toDisk() <add> <add> return nil <add>} <ide><path>daemon/start.go <ide> func (daemon *Daemon) ContainerStart(name string, hostConfig *runconfig.HostConf <ide> <ide> return nil <ide> } <del> <del>func (daemon *Daemon) setHostConfig(container *Container, hostConfig *runconfig.HostConfig) error { <del> container.Lock() <del> defer container.Unlock() <del> if err := parseSecurityOpt(container, hostConfig); err != nil { <del> return err <del> } <del> <del> // Register any links from the host config before starting the container <del> if err := daemon.RegisterLinks(container, hostConfig); err != nil { <del> return err <del> } <del> <del> container.hostConfig = hostConfig <del> container.toDisk() <del> <del> return nil <del>}
2
Text
Text
note consensus and final say
ff711fcfad68eec3f40ac7206a8fde7fd1982a99
<ide><path>docs/Maintainer-Guidelines.md <ide> All communication should ideally occur in public on GitHub. Where this is not po <ide> This makes it easier for other maintainers, contributors and users to follow along with what we're doing (and, more importantly, why we're doing it) and means that decisions have a linkable URL. <ide> <ide> ## Lead maintainer guidelines <del>There should be one lead maintainer for Homebrew. This person should (sparingly) be the tiebreaker for decisions where a mutual consensus cannot be reached amongst other maintainers. They should also be seen as the product manager for Homebrew itself and ensuring that changes made to the entire Homebrew ecosystem are consistent and providing an increasingly positive experience for Homebrew's users. <add>There should be one lead maintainer for Homebrew. Decisions are determined by a consensus of the maintainers. When a consensus is not reached, the lead maintainer has the final say in determining the outcome of any decision (though this power should be used sparingly). They should also be seen as the product manager for Homebrew itself and ensuring that changes made to the entire Homebrew ecosystem are consistent and providing an increasingly positive experience for Homebrew's users. <ide> <ide> In the same way that Homebrew maintainers are expected to be spending more of their time reviewing and merging contributions from non-maintainer contributors than making their own contributions, the lead maintainer should be spending most of their time reviewing work from and mentoring other maintainers. <ide>
1
PHP
PHP
add missing argument
f5ae9622e6965fc2f8e0ab6d70ef01bc39a445e8
<ide><path>lib/Cake/Console/Command/TestShell.php <ide> public function getOptionParser() { <ide> $parser = new ConsoleOptionParser($this->name); <ide> $parser->description(array( <ide> __d('cake_console', 'The CakePHP Testsuite allows you to run test cases from the command line'), <add> ))->addArgument('category', array( <add> 'help' => __d('cake_console', 'The category for the test, or test file, to test.'), <add> 'required' => false, <ide> ))->addArgument('file', array( <ide> 'help' => __d('cake_console', 'The path to the file, or test file, to test.'), <ide> 'required' => false,
1
Python
Python
support boolean in extra__snowflake__insecure_mode
534e9ae117641b4147542f2deec2a077f0a42e2f
<ide><path>airflow/providers/snowflake/hooks/snowflake.py <ide> from airflow.utils.strings import to_boolean <ide> <ide> <add>def _try_to_boolean(value: Any): <add> if isinstance(value, (str, type(None))): <add> return to_boolean(value) <add> return value <add> <add> <ide> class SnowflakeHook(DbApiHook): <ide> """ <ide> A client to interact with Snowflake. <ide> def _get_conn_params(self) -> Dict[str, Optional[str]]: <ide> schema = conn.schema or '' <ide> authenticator = conn.extra_dejson.get('authenticator', 'snowflake') <ide> session_parameters = conn.extra_dejson.get('session_parameters') <del> insecure_mode = to_boolean( <add> insecure_mode = _try_to_boolean( <ide> conn.extra_dejson.get( <ide> 'extra__snowflake__insecure_mode', conn.extra_dejson.get('insecure_mode', None) <ide> ) <ide><path>tests/providers/snowflake/hooks/test_snowflake.py <ide> class TestPytestSnowflakeHook: <ide> 'warehouse': 'af_wh', <ide> }, <ide> ), <add> ( <add> { <add> **BASE_CONNECTION_KWARGS, <add> 'extra': { <add> **BASE_CONNECTION_KWARGS['extra'], <add> 'extra__snowflake__insecure_mode': False, <add> }, <add> }, <add> ( <add> 'snowflake://user:pw@airflow.af_region/db/public?' <add> 'application=AIRFLOW&authenticator=snowflake&role=af_role&warehouse=af_wh' <add> ), <add> { <add> 'account': 'airflow', <add> 'application': 'AIRFLOW', <add> 'authenticator': 'snowflake', <add> 'database': 'db', <add> 'password': 'pw', <add> 'region': 'af_region', <add> 'role': 'af_role', <add> 'schema': 'public', <add> 'session_parameters': None, <add> 'user': 'user', <add> 'warehouse': 'af_wh', <add> }, <add> ), <ide> ], <ide> ) <ide> def test_hook_should_support_prepare_basic_conn_params_and_uri(
2
PHP
PHP
remove unused import
fc3deb532e558abdcec6f6f91e43e5e743e400ad
<ide><path>tests/Integration/Database/MigrateWithRealpathTest.php <ide> <ide> namespace Illuminate\Tests\Integration\Database; <ide> <del>use Orchestra\Testbench\TestCase; <ide> use Illuminate\Support\Facades\Schema; <del>use Illuminate\Contracts\Console\Kernel as ConsoleKernel; <ide> <ide> class MigrateWithRealpathTest extends DatabaseTestCase <ide> {
1
Javascript
Javascript
replace concatenation with template literal
66a6a15561e50cfc61a101cbe226a476919ef5b3
<ide><path>test/parallel/test-http-upgrade-client2.js <ide> const CRLF = '\r\n'; <ide> <ide> const server = http.createServer(); <ide> server.on('upgrade', function(req, socket, head) { <del> socket.write('HTTP/1.1 101 Ok' + CRLF + <del> 'Connection: Upgrade' + CRLF + <del> 'Upgrade: Test' + CRLF + CRLF + 'head'); <add> socket.write(`HTTP/1.1 101 Ok${CRLF}` + <add> `Connection: Upgrade${CRLF}` + <add> `Upgrade: Test${CRLF}${CRLF}` + <add> 'head'); <ide> socket.on('end', function() { <ide> socket.end(); <ide> });
1
PHP
PHP
use array_values to rekey filtered array
8654da2892cf4fbd629d99bbf410925d07379cd9
<ide><path>src/Illuminate/Http/Request.php <ide> public function segment($index, $default = null) <ide> { <ide> $segments = explode('/', trim($this->getPathInfo(), '/')); <ide> <del> $segments = array_filter($segments, function($v) { return $v != ''; }); <add> $segments = array_values(array_filter($segments)); <ide> <ide> return array_get($segments, $index - 1, $default); <ide> } <ide><path>tests/Http/HttpRequestTest.php <ide> public function testDecodedPathMethod() <ide> } <ide> <ide> <del> public function testSegmentMethod() <add> /** <add> * @dataProvider segmentProvider <add> */ <add> public function testSegmentMethod($path, $segment, $expected) <ide> { <del> $request = Request::create('', 'GET'); <del> $this->assertEquals('default', $request->segment(1, 'default')); <del> <del> $request = Request::create('foo/bar', 'GET'); <del> $this->assertEquals('foo', $request->segment(1, 'default')); <del> $this->assertEquals('bar', $request->segment(2, 'default')); <add> $request = Request::create($path, 'GET'); <add> $this->assertEquals($expected, $request->segment($segment, 'default')); <ide> } <ide> <add> public function segmentProvider() <add> { <add> return array( <add> array('', 1, 'default'), <add> array('foo/bar//baz', '1', 'foo'), <add> array('foo/bar//baz', '2', 'bar'), <add> array('foo/bar//baz', '3', 'baz') <add> ); <add> } <ide> <ide> public function testSegmentsMethod() <ide> {
2
Ruby
Ruby
simplify class_attribute implementation
dfa439eefc7bfaa2f00bc8d2bd712d115dd0ef33
<ide><path>activesupport/lib/active_support/core_ext/class/attribute.rb <ide> class Class <ide> # To set a default value for the attribute, pass <tt>default:</tt>, like so: <ide> # <ide> # class_attribute :settings, default: {} <del> def class_attribute(*attrs) <del> options = attrs.extract_options! <del> instance_reader = options.fetch(:instance_accessor, true) && options.fetch(:instance_reader, true) <del> instance_writer = options.fetch(:instance_accessor, true) && options.fetch(:instance_writer, true) <del> instance_predicate = options.fetch(:instance_predicate, true) <del> default_value = options.fetch(:default, nil) <del> <add> def class_attribute( <add> *attrs, <add> instance_accessor: true, <add> instance_reader: instance_accessor, <add> instance_writer: instance_accessor, <add> instance_predicate: true, <add> default: nil <add> ) <ide> attrs.each do |name| <ide> singleton_class.silence_redefinition_of_method(name) <del> define_singleton_method(name) { nil } <add> define_singleton_method(name) { default } <ide> <ide> singleton_class.silence_redefinition_of_method("#{name}?") <ide> define_singleton_method("#{name}?") { !!public_send(name) } if instance_predicate <ide> def class_attribute(*attrs) <ide> <ide> singleton_class.silence_redefinition_of_method("#{name}=") <ide> define_singleton_method("#{name}=") do |val| <del> singleton_class.class_eval do <del> redefine_method(name) { val } <del> end <add> redefine_singleton_method(name) { val } <ide> <ide> if singleton_class? <ide> class_eval do <ide> def class_attribute(*attrs) <ide> instance_variable_set ivar, val <ide> end <ide> end <del> <del> unless default_value.nil? <del> self.send("#{name}=", default_value) <del> end <ide> end <ide> end <ide> end
1
Javascript
Javascript
fix the order of the showcase
7baf7ef65708516755a13b625621a211bfc64a51
<ide><path>website/src/react-native/showcase.js <ide> var apps = [ <ide> link: 'https://geo.itunes.apple.com/us/app/spero-for-cancer/id1033923573?mt=8', <ide> author: 'Spero.io', <ide> }, <del> { <del> name: 'Start - medication manager for depression', <del> icon: 'http://a1.mzstatic.com/us/r30/Purple49/v4/de/9b/6f/de9b6fe8-84ea-7a12-ba2c-0a6d6c7b10b0/icon175x175.png', <del> link: 'https://itunes.apple.com/us/app/start-medication-manager-for/id1012099928?mt=8', <del> author: 'Iodine Inc.', <del> }, <ide> { <ide> name: 'Squad', <ide> icon: 'http://a4.mzstatic.com/us/r30/Purple69/v4/e8/5b/3f/e85b3f52-72f3-f427-a32e-a73efe2e9682/icon175x175.jpeg', <ide> link: 'https://itunes.apple.com/us/app/squad-snaps-for-groups-friends/id1043626975?mt=8', <ide> author: 'Tackk Inc.', <ide> }, <add> { <add> name: 'Start - medication manager for depression', <add> icon: 'http://a1.mzstatic.com/us/r30/Purple49/v4/de/9b/6f/de9b6fe8-84ea-7a12-ba2c-0a6d6c7b10b0/icon175x175.png', <add> link: 'https://itunes.apple.com/us/app/start-medication-manager-for/id1012099928?mt=8', <add> author: 'Iodine Inc.', <add> }, <ide> { <ide> name: 'Tabtor Parent', <ide> icon: 'http://a1.mzstatic.com/us/r30/Purple4/v4/80/50/9d/80509d05-18f4-a0b8-0cbb-9ba927d04477/icon175x175.jpeg',
1
Java
Java
improve httphandlerconnection completion
21b2fc1f0129420a8da521cd1e7f33f19beffbc1
<ide><path>spring-test/src/main/java/org/springframework/mock/http/client/reactive/MockClientHttpResponse.java <ide> private Charset getCharset() { <ide> return (charset != null ? charset : StandardCharsets.UTF_8); <ide> } <ide> <add> <add> @Override <add> public String toString() { <add> HttpStatus code = HttpStatus.resolve(this.status); <add> return (code != null ? code.name() + "(" + this.status + ")" : "Status (" + this.status + ")") + this.headers; <add> } <ide> } <ide><path>spring-test/src/main/java/org/springframework/test/web/reactive/server/HttpHandlerConnector.java <ide> public Mono<ClientHttpResponse> connect(HttpMethod httpMethod, URI uri, <ide> private Mono<ClientHttpResponse> doConnect( <ide> HttpMethod httpMethod, URI uri, Function<? super ClientHttpRequest, Mono<Void>> requestCallback) { <ide> <del> MonoProcessor<ClientHttpResponse> result = MonoProcessor.create(); <add> MonoProcessor<Void> requestWriteCompletion = MonoProcessor.create(); <add> MonoProcessor<Void> handlerCompletion = MonoProcessor.create(); <add> ClientHttpResponse[] savedResponse = new ClientHttpResponse[1]; <ide> <ide> MockClientHttpRequest mockClientRequest = new MockClientHttpRequest(httpMethod, uri); <ide> MockServerHttpResponse mockServerResponse = new MockServerHttpResponse(); <ide> private Mono<ClientHttpResponse> doConnect( <ide> log("Invoking HttpHandler for ", httpMethod, uri); <ide> ServerHttpRequest mockServerRequest = adaptRequest(mockClientRequest, requestBody); <ide> ServerHttpResponse responseToUse = prepareResponse(mockServerResponse, mockServerRequest); <del> this.handler.handle(mockServerRequest, responseToUse).subscribe(aVoid -> {}, result::onError); <add> this.handler.handle(mockServerRequest, responseToUse).subscribe(handlerCompletion); <ide> return Mono.empty(); <ide> }); <ide> <ide> mockServerResponse.setWriteHandler(responseBody -> <ide> Mono.fromRunnable(() -> { <ide> log("Creating client response for ", httpMethod, uri); <del> result.onNext(adaptResponse(mockServerResponse, responseBody)); <add> savedResponse[0] = adaptResponse(mockServerResponse, responseBody); <ide> })); <ide> <ide> log("Writing client request for ", httpMethod, uri); <del> requestCallback.apply(mockClientRequest).subscribe(aVoid -> {}, result::onError); <del> <del> return result; <add> requestCallback.apply(mockClientRequest).subscribe(requestWriteCompletion); <add> <add> return Mono.when(requestWriteCompletion, handlerCompletion) <add> .onErrorMap(ex -> { <add> ClientHttpResponse response = savedResponse[0]; <add> return response != null ? new FailureAfterResponseCompletedException(response, ex) : ex; <add> }) <add> .then(Mono.fromCallable(() -> savedResponse[0] != null ? <add> savedResponse[0] : adaptResponse(mockServerResponse, Flux.empty()))); <ide> } <ide> <ide> private void log(String message, HttpMethod httpMethod, URI uri) { <ide> private ClientHttpResponse adaptResponse(MockServerHttpResponse response, Flux<D <ide> return clientResponse; <ide> } <ide> <add> <add> /** <add> * Indicates that an error occurred after the server response was completed, <add> * via {@link ServerHttpResponse#writeWith} or {@link ServerHttpResponse#setComplete()}, <add> * and can no longer be changed. This exception wraps the error and also <add> * provides {@link #getCompletedResponse() access} to the response. <add> * <p>What happens on an actual running server depends on when the server <add> * commits the response and the error may or may not change the response. <add> * Therefore in tests without a server the exception is wrapped and allowed <add> * to propagate so the application is alerted. <add> * @since 5.2.2 <add> */ <add> @SuppressWarnings("serial") <add> public static final class FailureAfterResponseCompletedException extends RuntimeException { <add> <add> private final ClientHttpResponse completedResponse; <add> <add> <add> private FailureAfterResponseCompletedException(ClientHttpResponse response, Throwable cause) { <add> super("Error occurred after response was completed: " + response, cause); <add> this.completedResponse = response; <add> } <add> <add> <add> public ClientHttpResponse getCompletedResponse() { <add> return this.completedResponse; <add> } <add> } <add> <ide> } <ide><path>spring-web/src/test/java/org/springframework/mock/http/client/reactive/test/MockClientHttpResponse.java <ide> public MockClientHttpResponse(HttpStatus status) { <ide> } <ide> <ide> public MockClientHttpResponse(int status) { <del> Assert.isTrue(status >= 100 && status < 600, "Status must be between 1xx and 5xx"); <add> Assert.isTrue(status > 99 && status < 1000, "Status must be between 100 and 999"); <ide> this.status = status; <ide> } <ide> <ide> private Charset getCharset() { <ide> return (charset != null ? charset : StandardCharsets.UTF_8); <ide> } <ide> <add> <add> @Override <add> public String toString() { <add> HttpStatus code = HttpStatus.resolve(this.status); <add> return (code != null ? code.name() + "(" + this.status + ")" : "Status (" + this.status + ")") + this.headers; <add> } <ide> }
3
PHP
PHP
clarify octal input instead
eedefb9dec3564ef466b4ddedad573a895ebe590
<ide><path>lib/Cake/Utility/Folder.php <ide> public function inPath($path = '', $reverse = false) { <ide> /** <ide> * Change the mode on a directory structure recursively. This includes changing the mode on files as well. <ide> * <del> * @param string $path The path to chmod <del> * @param int $mode octal value 0755 <del> * @param bool $recursive chmod recursively, set to false to only change the current directory. <del> * @param array $exceptions array of files, directories to skip <del> * @return bool Returns TRUE on success, FALSE on failure <add> * @param string $path The path to chmod. <add> * @param int $mode Octal value, e.g. 0755. <add> * @param bool $recursive Chmod recursively, set to false to only change the current directory. <add> * @param array $exceptions Array of files, directories to skip. <add> * @return bool Success. <ide> * @link http://book.cakephp.org/2.0/en/core-utility-libraries/file-folder.html#Folder::chmod <ide> */ <ide> public function chmod($path, $mode = false, $recursive = true, $exceptions = array()) { <ide> public function chmod($path, $mode = false, $recursive = true, $exceptions = arr <ide> <ide> if ($recursive === false && is_dir($path)) { <ide> //@codingStandardsIgnoreStart <del> if (@chmod($path, intval((string)$mode, 8))) { <add> if (@chmod($path, intval($mode, 8))) { <ide> //@codingStandardsIgnoreEnd <ide> $this->_messages[] = __d('cake_dev', '%s changed to %s', $path, $mode); <ide> return true; <ide> public function chmod($path, $mode = false, $recursive = true, $exceptions = arr <ide> } <ide> <ide> //@codingStandardsIgnoreStart <del> if (@chmod($fullpath, intval((string)$mode, 8))) { <add> if (@chmod($fullpath, intval($mode, 8))) { <ide> //@codingStandardsIgnoreEnd <ide> $this->_messages[] = __d('cake_dev', '%s changed to %s', $fullpath, $mode); <ide> } else { <ide> public function delete($path = null) { <ide> * <ide> * - `to` The directory to copy to. <ide> * - `from` The directory to copy from, this will cause a cd() to occur, changing the results of pwd(). <del> * - `mode` The mode to copy the files/directories with. <add> * - `mode` The mode to copy the files/directories with, e.g. 0775. <ide> * - `skip` Files/directories to skip. <ide> * - `scheme` Folder::MERGE, Folder::OVERWRITE, Folder::SKIP <ide> * <ide> * @param array|string $options Either an array of options (see above) or a string of the destination directory. <del> * @return bool Success <add> * @return bool Success. <ide> * @link http://book.cakephp.org/2.0/en/core-utility-libraries/file-folder.html#Folder::copy <ide> */ <ide> public function copy($options) { <ide> public function copy($options) { <ide> $from = Folder::addPathElement($fromDir, $item); <ide> if (is_file($from) && (!is_file($to) || $options['scheme'] != Folder::SKIP)) { <ide> if (copy($from, $to)) { <del> chmod($to, intval((string)$mode, 8)); <add> chmod($to, intval($mode, 8)); <ide> touch($to, filemtime($from)); <ide> $this->_messages[] = __d('cake_dev', '%s copied to %s', $from, $to); <ide> } else {
1
Javascript
Javascript
drop the replacein api
c5ec6debf53c183f2c259a2c1dda6180c0f44f1c
<ide><path>packages/ember-views/lib/mixins/view_support.js <ide> export default Mixin.create({ <ide> return element; <ide> }, <ide> <del> /** <del> Replaces the content of the specified parent element with this view's <del> element. If the view does not have an HTML representation yet, <del> the element will be generated automatically. <del> <del> Note that this method just schedules the view to be appended; the DOM <del> element will not be appended to the given element until all bindings have <del> finished synchronizing <del> <del> @method replaceIn <del> @param {String|DOMElement|jQuery} target A selector, element, HTML string, or jQuery object <del> @return {Ember.View} received <del> @private <del> */ <del> replaceIn(selector) { <del> let target = jQuery(selector); <del> <del> assert(`You tried to replace in (${selector}) but that isn't in the DOM`, target.length > 0); <del> assert('You cannot replace an existing Ember.View.', !target.is('.ember-view') && !target.parents().is('.ember-view')); <del> <del> this.renderer.replaceIn(this, target[0]); <del> <del> return this; <del> }, <del> <ide> /** <ide> Appends the view's element to the document body. If the view does <ide> not have an HTML representation yet
1
Javascript
Javascript
use reserved invalid hostname for tests
0309619aa74206baee301946177de47cc4f61ed9
<ide><path>test/parallel/test-net-better-error-messages-port-hostname.js <ide> const net = require('net'); <ide> const assert = require('assert'); <ide> <ide> // Using port 0 as hostname used is already invalid. <del>const c = net.createConnection(0, '***'); <add>const c = net.createConnection(0, 'this.hostname.is.invalid'); <ide> <ide> c.on('connect', common.mustNotCall()); <ide> <ide> c.on('error', common.mustCall(function(e) { <ide> assert.strictEqual(e.code, 'ENOTFOUND'); <ide> assert.strictEqual(e.port, 0); <del> assert.strictEqual(e.hostname, '***'); <add> assert.strictEqual(e.hostname, 'this.hostname.is.invalid'); <ide> })); <ide><path>test/parallel/test-net-connect-immediate-finish.js <ide> const common = require('../common'); <ide> const assert = require('assert'); <ide> const net = require('net'); <ide> <del>const client = net.connect({ host: '***', port: common.PORT }); <add>const client = net.connect({ <add> host: 'this.hostname.is.invalid', <add> port: common.PORT <add>}); <ide> <ide> client.once('error', common.mustCall((err) => { <ide> assert(err); <ide> assert.strictEqual(err.code, err.errno); <ide> assert.strictEqual(err.code, 'ENOTFOUND'); <ide> assert.strictEqual(err.host, err.hostname); <del> assert.strictEqual(err.host, '***'); <add> assert.strictEqual(err.host, 'this.hostname.is.invalid'); <ide> assert.strictEqual(err.syscall, 'getaddrinfo'); <ide> })); <ide>
2
Javascript
Javascript
remove duplicated comments
0329e036952c5c2839ea61ed5e23cf8b0c615ba9
<ide><path>packages/ember-glimmer/lib/component.js <ide> const Component = CoreView.extend( <ide> @since 1.13.0 <ide> */ <ide> <del> /** <del> Called when the attributes passed into the component have been updated. <del> Called both during the initial render of a container and during a rerender. <del> Can be used in place of an observer; code placed here will be executed <del> every time any attribute updates. <del> @event didReceiveAttrs <del> @public <del> @since 1.13.0 <del> */ <del> <del> /** <del> Called after a component has been rendered, both on initial render and <del> in subsequent rerenders. <del> @method didRender <del> @public <del> @since 1.13.0 <del> */ <del> <ide> /** <ide> Called after a component has been rendered, both on initial render and <ide> in subsequent rerenders. <ide> const Component = CoreView.extend( <ide> @since 1.13.0 <ide> */ <ide> <del> /** <del> Called before a component has been rendered, both on initial render and <del> in subsequent rerenders. <del> @method willRender <del> @public <del> @since 1.13.0 <del> */ <del> <ide> /** <ide> Called before a component has been rendered, both on initial render and <ide> in subsequent rerenders. <ide> const Component = CoreView.extend( <ide> @since 1.13.0 <ide> */ <ide> <del> /** <del> Called when the attributes passed into the component have been changed. <del> Called only during a rerender, not during an initial render. <del> @method didUpdateAttrs <del> @public <del> @since 1.13.0 <del> */ <del> <ide> /** <ide> Called when the attributes passed into the component have been changed. <ide> Called only during a rerender, not during an initial render. <ide> const Component = CoreView.extend( <ide> @since 1.13.0 <ide> */ <ide> <del> /** <del> Called when the component is about to update and rerender itself. <del> Called only during a rerender, not during an initial render. <del> @method willUpdate <del> @public <del> @since 1.13.0 <del> */ <del> <ide> /** <ide> Called when the component is about to update and rerender itself. <ide> Called only during a rerender, not during an initial render. <ide> const Component = CoreView.extend( <ide> @since 1.13.0 <ide> */ <ide> <del> /** <del> Called when the component has updated and rerendered itself. <del> Called only during a rerender, not during an initial render. <del> @method didUpdate <del> @public <del> @since 1.13.0 <del> */ <del> <ide> /** <ide> Called when the component has updated and rerendered itself. <ide> Called only during a rerender, not during an initial render.
1
Text
Text
correct markdown to show tag
bb5735acdc4ceb6563b8a8389e00936c80708f37
<ide><path>guide/english/bootstrap/index.md <ide> You can add Bootstrap CSS by using a `<link>` element inside the `<head>` of you <ide> <ide> `<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">` <ide> <del>Adding the JavaScript elements of Bootstrap is similar with `<script>` elements usually placed at the bottom of your ‘<body>’ tag. You may need to include some dependencies first. Pay special attention to the order listed: <add>Adding the JavaScript elements of Bootstrap is similar with `<script>` elements usually placed at the bottom of your `<body>` tag. You may need to include some dependencies first. Pay special attention to the order listed: <ide> <ide> ```html <ide> <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
1
Ruby
Ruby
remove warning due to duplicated declaration
9341ef2f65a8ab7f946003c75a6c1c0dc36ba942
<ide><path>activerecord/lib/active_record/encryption/configurable.rb <ide> module Configurable <ide> <ide> class_methods do <ide> # Expose getters for context properties <del> Context::PROPERTIES.including(:encryptor).each do |name| <add> Context::PROPERTIES.each do |name| <ide> delegate name, to: :context <ide> end <ide>
1
Text
Text
add job suffix to sample's job file name
f82ed2dab41acc9a8f0abf3c22f3baa50e2d4cb8
<ide><path>guides/source/active_job_basics.md <ide> module YourApp <ide> end <ide> end <ide> <del># app/jobs/guests_cleanup.rb <add># app/jobs/guests_cleanup_job.rb <ide> class GuestsCleanupJob < ActiveJob::Base <ide> queue_as :low_priority <ide> #.... <ide> module YourApp <ide> end <ide> end <ide> <del># app/jobs/guests_cleanup.rb <add># app/jobs/guests_cleanup_job.rb <ide> class GuestsCleanupJob < ActiveJob::Base <ide> queue_as :low_priority <ide> #....
1
Ruby
Ruby
drop schema_migrations table only when exists
4b7ac2e83eb5776855b4abe02ca6060e73290e42
<ide><path>activerecord/test/cases/migration_test.rb <ide> def test_migrator_versions <ide> end <ide> <ide> def test_migration_detection_without_schema_migration_table <del> ActiveRecord::Base.connection.drop_table :schema_migrations <add> ActiveRecord::Base.connection.drop_table('schema_migrations') if ActiveRecord::Base.connection.table_exists?('schema_migrations') <ide> <ide> migrations_path = MIGRATIONS_ROOT + "/valid" <ide> old_path = ActiveRecord::Migrator.migrations_paths
1
Python
Python
add ma.convolve and ma.correlate for
3ebbbb07285dec67cd89f410be4dd3b426c13f10
<ide><path>numpy/ma/core.py <ide> 'argmax', 'argmin', 'argsort', 'around', 'array', 'asanyarray', <ide> 'asarray', 'bitwise_and', 'bitwise_or', 'bitwise_xor', 'bool_', 'ceil', <ide> 'choose', 'clip', 'common_fill_value', 'compress', 'compressed', <del> 'concatenate', 'conjugate', 'copy', 'cos', 'cosh', 'count', 'cumprod', <del> 'cumsum', 'default_fill_value', 'diag', 'diagonal', 'diff', 'divide', <del> 'dump', 'dumps', 'empty', 'empty_like', 'equal', 'exp', 'expand_dims', <del> 'fabs', 'filled', 'fix_invalid', 'flatten_mask', <add> 'concatenate', 'conjugate', 'convolve', 'copy', 'correlate', 'cos', 'cosh', <add> 'count', 'cumprod', 'cumsum', 'default_fill_value', 'diag', 'diagonal', <add> 'diff', 'divide', 'dump', 'dumps', 'empty', 'empty_like', 'equal', 'exp', <add> 'expand_dims', 'fabs', 'filled', 'fix_invalid', 'flatten_mask', <ide> 'flatten_structured_array', 'floor', 'floor_divide', 'fmod', <ide> 'frombuffer', 'fromflex', 'fromfunction', 'getdata', 'getmask', <ide> 'getmaskarray', 'greater', 'greater_equal', 'harden_mask', 'hypot', <ide> def outer(a, b): <ide> outerproduct = outer <ide> <ide> <add>def _convolve_or_correlate(f, a, v, mode, contagious): <add> if contagious: <add> # results which are contributed to by either item in any pair being invalid <add> mask = ( <add> f(getmaskarray(a), np.ones(v.shape, dtype=np.bool), mode=mode) <add> | f(np.ones(a.shape, dtype=np.bool), getmaskarray(v), mode=mode) <add> ) <add> data = f(getdata(a), getdata(v), mode=mode) <add> else: <add> # results which are not contributed to by any pair of valid elements <add> mask = ~f(~getmaskarray(a), ~getmaskarray(v)) <add> data = f(filled(a, 0), filled(v, 0), mode=mode) <add> <add> return masked_array(data, mask=mask) <add> <add> <add>def correlate(a, v, mode='valid', contagious=True): <add> """ <add> Cross-correlation of two 1-dimensional sequences. <add> <add> Parameters <add> ---------- <add> a, v : array_like <add> Input sequences. <add> mode : {'valid', 'same', 'full'}, optional <add> Refer to the `np.convolve` docstring. Note that the default <add> is 'valid', unlike `convolve`, which uses 'full'. <add> contagious : bool <add> If True, then if any masked element is included in the sum for a result <add> element, then the result is masked. <add> If False, then the result element is only masked if no non-masked cells <add> contribute towards it <add> <add> Returns <add> ------- <add> out : ndarray <add> Discrete cross-correlation of `a` and `v`. <add> <add> See Also <add> -------- <add> numpy.correlate : Equivalent function in the top-level NumPy module. <add> """ <add> return _convolve_or_correlate(np.correlate, a, v, mode, contagious) <add> <add> <add>def convolve(a, v, mode='full', contagious=True): <add> """ <add> Returns the discrete, linear convolution of two one-dimensional sequences. <add> <add> Parameters <add> ---------- <add> a, v : array_like <add> Input sequences. <add> mode : {'valid', 'same', 'full'}, optional <add> Refer to the `np.convolve` docstring. <add> contagious : bool <add> If True, then if any masked element is included in the sum for a result <add> element, then the result is masked. <add> If False, then the result element is only masked if no non-masked cells <add> contribute towards it <add> <add> Returns <add> ------- <add> out : ndarray <add> Discrete, linear convolution of `a` and `v`. <add> <add> See Also <add> -------- <add> numpy.convolve : Equivalent function in the top-level NumPy module. <add> """ <add> return _convolve_or_correlate(np.convolve, a, v, mode, contagious) <add> <add> <ide> def allequal(a, b, fill_value=True): <ide> """ <ide> Return True if all entries of a and b are equal, using <ide><path>numpy/ma/tests/test_core.py <ide> def compressed(self): <ide> test = np.ma.compressed(M(shape=(0,1,2))) <ide> assert_equal(test, 42) <ide> <add> def test_convolve(self): <add> a = masked_equal(np.arange(5), 2) <add> b = np.array([1, 1]) <add> test = np.ma.convolve(a, b) <add> assert_equal(test, masked_equal([0, 1, -1, -1, 7, 4], -1)) <add> <add> test = np.ma.convolve(a, b, contagious=False) <add> assert_equal(test, masked_equal([0, 1, 1, 3, 7, 4], -1)) <add> <ide> <ide> class TestMaskedFields(TestCase): <ide>
2
Javascript
Javascript
fix xhr for webworker env
aaca1244eb2d1229cb093acc16fb9a3c06f16d42
<ide><path>lib/adapters/xhr.js <ide> var buildURL = require('./../helpers/buildURL'); <ide> var parseHeaders = require('./../helpers/parseHeaders'); <ide> var transformData = require('./../helpers/transformData'); <ide> var isURLSameOrigin = require('./../helpers/isURLSameOrigin'); <del>var btoa = window.btoa || require('./../helpers/btoa'); <add>var btoa = window && window.btoa || require('./../helpers/btoa'); <ide> <ide> module.exports = function xhrAdapter(resolve, reject, config) { <ide> var requestData = config.data;
1
PHP
PHP
create cakerequest in view instead of in cakeemail
8966f1b324c1967326cc9f57729eefe7883947f6
<ide><path>lib/Cake/Network/Email/CakeEmail.php <ide> protected function _renderTemplates($content) { <ide> $View = new $viewClass(null); <ide> $View->viewVars = $this->_viewVars; <ide> $View->helpers = $this->_helpers; <del> if (!$request = Router::getRequest(true)) { <del> $request = new CakeRequest('/', false); <del> $request->base = ''; <del> $request->here = $request->webroot = '/'; <del> } <del> $View->request = $request; <ide> <ide> list($templatePlugin, $template) = pluginSplit($this->_template); <ide> list($layoutPlugin, $layout) = pluginSplit($this->_layout); <ide><path>lib/Cake/Test/Case/Network/Email/CakeEmailTest.php <ide> public function testSendRenderWithImage() { <ide> $this->CakeEmail->template('image'); <ide> $this->CakeEmail->emailFormat('html'); <ide> <del> $View = new View(); <del> $View->request = new CakeRequest('/', true); <del> $View->request->base = ''; <del> $View->request->webroot = '/'; <del> $View->request->here = '/'; <del> $View->Helpers->load('Html'); <del> <del> $expected = $View->Html->image('image.gif', array( <del> 'fullBase' => true, 'alt' => 'cool image', <del> 'width' => 100, 'height' => 100, <del> )); <del> <add> $expected = '<img src="http://localhost/img/image.gif" alt="cool image" width="100" height="100" />'; <ide> $result = $this->CakeEmail->send(); <ide> $this->assertContains($expected, $result['message']); <ide> } <ide><path>lib/Cake/Test/Case/Utility/DebuggerTest.php <ide> public function testExportVar() { <ide> validationErrors => array() <ide> hasRendered => false <ide> uuids => array() <del> request => null <add> request => object(CakeRequest) {} <ide> response => object(CakeResponse) {} <ide> elementCache => 'default' <ide> int => (int) 2 <ide><path>lib/Cake/View/View.php <ide> public function __construct(Controller $controller = null) { <ide> } <ide> $this->_eventManager = $controller->getEventManager(); <ide> } <add> if (empty($this->request) && !($this->request = Router::getRequest(true))) { <add> $this->request = new CakeRequest(null, false); <add> $this->request->base = ''; <add> $this->request->here = $this->request->webroot = '/'; <add> } <ide> if (is_object($controller) && isset($controller->response)) { <ide> $this->response = $controller->response; <ide> } else {
4
Javascript
Javascript
cover thrown errors from exec() kill
9ac363b5d65e02bc4b5d86b28e8b6dc232dcaa8d
<ide><path>test/parallel/test-child-process-exec-kill-throws.js <add>'use strict'; <add>// Flags: --expose_internals <add>const common = require('../common'); <add>const assert = require('assert'); <add>const cp = require('child_process'); <add>const internalCp = require('internal/child_process'); <add> <add>if (process.argv[2] === 'child') { <add> // Keep the process alive and printing to stdout. <add> setInterval(() => { console.log('foo'); }, 1); <add>} else { <add> // Monkey patch ChildProcess#kill() to kill the process and then throw. <add> const kill = internalCp.ChildProcess.prototype.kill; <add> <add> internalCp.ChildProcess.prototype.kill = function() { <add> kill.apply(this, arguments); <add> throw new Error('mock error'); <add> }; <add> <add> const cmd = `${process.execPath} ${__filename} child`; <add> const options = { maxBuffer: 0 }; <add> const child = cp.exec(cmd, options, common.mustCall((err, stdout, stderr) => { <add> // Verify that if ChildProcess#kill() throws, the error is reported. <add> assert(/^Error: mock error$/.test(err)); <add> assert.strictEqual(stdout, ''); <add> assert.strictEqual(stderr, ''); <add> assert.strictEqual(child.killed, true); <add> })); <add>}
1
Ruby
Ruby
fix error when building from source
03c83749c5fdf47436f5a1d2c94a20e6b9ae9540
<ide><path>Library/Homebrew/reinstall.rb <ide> def reinstall_formula(f, build_from_source: false, args:) <ide> options |= f.build.used_options <ide> options &= f.options <ide> <add> build_from_source_formulae = args.build_from_source_formulae <add> build_from_source_formulae << f.full_name if build_from_source <add> <ide> fi = FormulaInstaller.new(f, force_bottle: args.force_bottle?, <del> build_from_source_formulae: args.build_from_source_formulae, <add> build_from_source_formulae: build_from_source_formulae, <ide> debug: args.debug?, quiet: args.quiet?, verbose: args.verbose?) <ide> fi.options = options <ide> fi.force = args.force? <ide> def reinstall_formula(f, build_from_source: false, args:) <ide> fi.interactive = args.interactive? <ide> fi.git = args.git? <ide> fi.link_keg ||= keg_was_linked if keg_had_linked_opt <del> fi.build_from_source = true if build_from_source <ide> if tab <ide> fi.build_bottle ||= tab.built_bottle? <ide> fi.installed_as_dependency = tab.installed_as_dependency
1
Ruby
Ruby
fix typos in the documentation [ci skip]
b4a9c59a47dd619ea0d446e47edde14b3740e483
<ide><path>actionpack/lib/action_controller/form_builder.rb <ide> module ActionController <ide> # Override the default form builder for all views rendered by this <del> # controller and any of its descendents. Accepts a sublcass of <add> # controller and any of its descendants. Accepts a subclass of <ide> # +ActionView::Helpers::FormBuilder+. <ide> # <ide> # For example, given a form builder:
1
Javascript
Javascript
fix dag dependency search
6f8c204b21d6c01a192bda524db72517d41bf6e9
<ide><path>airflow/www/static/js/dag_dependencies.js <ide> function setUpNodeHighlighting(focusItem = null) { <ide> function searchboxHighlighting(s) { <ide> let match = null; <ide> <del> d3.selectAll('g.nodes g.node').forEach(function forEach(d) { <add> d3.selectAll('g.nodes g.node').filter(function forEach(d) { <ide> if (s === '') { <ide> d3.select('g.edgePaths') <ide> .transition().duration(duration) <ide> function searchboxHighlighting(s) { <ide> .style('stroke-width', initialStrokeWidth); <ide> } <ide> } <add> return null; <ide> }); <ide> <ide> // This moves the matched node to the center of the graph area
1
Text
Text
remove unnecessary trailing comma
0e860b19012e17d8b0231f8b321f0eec0e4d8cdd
<ide><path>research/object_detection/g3doc/exporting_models.md <ide> After your model has been trained, you should export it to a Tensorflow <ide> graph proto. A checkpoint will typically consist of three files: <ide> <del>* model.ckpt-${CHECKPOINT_NUMBER}.data-00000-of-00001, <add>* model.ckpt-${CHECKPOINT_NUMBER}.data-00000-of-00001 <ide> * model.ckpt-${CHECKPOINT_NUMBER}.index <ide> * model.ckpt-${CHECKPOINT_NUMBER}.meta <ide>
1
Python
Python
remove unused helper function
40ae499f32df69f53d6735746243a3f83120f339
<ide><path>spacy/util.py <ide> def is_json_serializable(obj): <ide> return False <ide> <ide> <del>def get_raw_input(description, default=False): <del> """Get user input from the command line via raw_input / input. <del> <del> description (unicode): Text to display before prompt. <del> default (unicode or False/None): Default value to display with prompt. <del> RETURNS (unicode): User input. <del> """ <del> additional = " (default: %s)" % default if default else "" <del> prompt = " %s%s: " % (description, additional) <del> user_input = input_(prompt) <del> return user_input <del> <del> <ide> def to_bytes(getters, exclude): <ide> serialized = OrderedDict() <ide> for key, getter in getters.items():
1
Text
Text
add link to @mjumbewu's csv package
a7e7c441a4e4eb058c0b879e62d976b848b618c6
<ide><path>docs/api-guide/renderers.md <ide> The following third party packages are also available. <ide> ## MessagePack <ide> <ide> [MessagePack][messagepack] is a fast, efficient binary serialization format. [Juan Riaza][juanriaza] maintains the `djangorestframework-msgpack` package which provides MessagePack renderer and parser support for REST framework. Documentation is [available here][djangorestframework-msgpack]. <add>## CSV <add> <add>Comma-separated values are a plain-text tabular data format, that can be easily imported into spreadsheet applications. [Mjumbe Poe][mjumbewu] maintains the [djangorestframework-csv][djangorestframework-csv] package which provides CSV renderer support for REST framework. <ide> <ide> [cite]: https://docs.djangoproject.com/en/dev/ref/template-response/#the-rendering-process <ide> [conneg]: content-negotiation.md <ide> The following third party packages are also available. <ide> [django-error-views]: https://docs.djangoproject.com/en/dev/topics/http/views/#customizing-error-views <ide> [messagepack]: https://github.com/juanriaza/django-rest-framework-msgpack <ide> [juanriaza]: https://github.com/juanriaza <del>[djangorestframework-msgpack]: https://github.com/juanriaza/django-rest-framework-msgpack <ide>\ No newline at end of file <add>[djangorestframework-msgpack]: https://github.com/juanriaza/django-rest-framework-msgpack[mjumbewu]: https://github.com/mjumbewu <add>[djangorestframework-csv]: https://github.com/mjumbewu/django-rest-framework-csv <ide>\ No newline at end of file
1
Javascript
Javascript
use es6 import for scroll view
d7b1d3359f2cf4b0f21d061cae97b48125454244
<ide><path>Libraries/Components/ScrollView/AndroidHorizontalScrollContentViewNativeComponent.js <ide> <ide> 'use strict'; <ide> <del>const registerGeneratedViewConfig = require('../../Utilities/registerGeneratedViewConfig'); <del>const requireNativeComponent = require('../../ReactNative/requireNativeComponent'); <add>import registerGeneratedViewConfig from '../../Utilities/registerGeneratedViewConfig'; <add>import requireNativeComponent from '../../ReactNative/requireNativeComponent'; <ide> <ide> import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes'; <ide> import type {ViewProps} from '../View/ViewPropTypes'; <ide><path>Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js <ide> <ide> 'use strict'; <ide> <del>const registerGeneratedViewConfig = require('../../Utilities/registerGeneratedViewConfig'); <del>const requireNativeComponent = require('../../ReactNative/requireNativeComponent'); <add>import registerGeneratedViewConfig from '../../Utilities/registerGeneratedViewConfig'; <add>import requireNativeComponent from '../../ReactNative/requireNativeComponent'; <ide> <ide> import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes'; <ide> import type {ScrollViewNativeProps} from './ScrollViewNativeComponentType'; <ide><path>Libraries/Components/ScrollView/ScrollContentViewNativeComponent.js <ide> <ide> 'use strict'; <ide> <del>const registerGeneratedViewConfig = require('../../Utilities/registerGeneratedViewConfig'); <del>const requireNativeComponent = require('../../ReactNative/requireNativeComponent'); <add>import registerGeneratedViewConfig from '../../Utilities/registerGeneratedViewConfig'; <add>import requireNativeComponent from '../../ReactNative/requireNativeComponent'; <ide> <ide> import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes'; <ide> import type {ViewProps} from '../View/ViewPropTypes'; <ide><path>Libraries/Components/ScrollView/ScrollView.js <ide> <ide> 'use strict'; <ide> <del>const AnimatedImplementation = require('../../Animated/src/AnimatedImplementation'); <del>const Platform = require('../../Utilities/Platform'); <del>const React = require('react'); <del>const ReactNative = require('../../Renderer/shims/ReactNative'); <add>import AnimatedImplementation from '../../Animated/src/AnimatedImplementation'; <add>import Platform from '../../Utilities/Platform'; <add>import * as React from 'react'; <add>import ReactNative from '../../Renderer/shims/ReactNative'; <ide> require('../../Renderer/shims/ReactNative'); // Force side effects to prevent T55744311 <del>const ScrollResponder = require('../ScrollResponder'); <del>const ScrollViewStickyHeader = require('./ScrollViewStickyHeader'); <del>const StyleSheet = require('../../StyleSheet/StyleSheet'); <del>const View = require('../View/View'); <del> <del>const dismissKeyboard = require('../../Utilities/dismissKeyboard'); <del>const flattenStyle = require('../../StyleSheet/flattenStyle'); <del>const invariant = require('invariant'); <del>const processDecelerationRate = require('./processDecelerationRate'); <del>const resolveAssetSource = require('../../Image/resolveAssetSource'); <del>const splitLayoutProps = require('../../StyleSheet/splitLayoutProps'); <del>const setAndForwardRef = require('../../Utilities/setAndForwardRef'); <add>import ScrollResponder from '../ScrollResponder'; <add>import ScrollViewStickyHeader from './ScrollViewStickyHeader'; <add>import StyleSheet from '../../StyleSheet/StyleSheet'; <add>import View from '../View/View'; <add> <add>import dismissKeyboard from '../../Utilities/dismissKeyboard'; <add>import flattenStyle from '../../StyleSheet/flattenStyle'; <add>import invariant from 'invariant'; <add>import processDecelerationRate from './processDecelerationRate'; <add>import resolveAssetSource from '../../Image/resolveAssetSource'; <add>import splitLayoutProps from '../../StyleSheet/splitLayoutProps'; <add>import setAndForwardRef from '../../Utilities/setAndForwardRef'; <ide> <ide> import type {EdgeInsetsProp} from '../../StyleSheet/EdgeInsetsPropType'; <ide> import type {PointProp} from '../../StyleSheet/PointPropType'; <ide><path>Libraries/Components/ScrollView/ScrollViewNativeComponent.js <ide> <ide> 'use strict'; <ide> <del>const registerGeneratedViewConfig = require('../../Utilities/registerGeneratedViewConfig'); <del>const requireNativeComponent = require('../../ReactNative/requireNativeComponent'); <add>import registerGeneratedViewConfig from '../../Utilities/registerGeneratedViewConfig'; <add>import requireNativeComponent from '../../ReactNative/requireNativeComponent'; <ide> import ScrollViewViewConfig from './ScrollViewViewConfig'; <ide> <ide> import type { <ide><path>Libraries/Components/ScrollView/ScrollViewStickyHeader.js <ide> <ide> 'use strict'; <ide> <del>const AnimatedImplementation = require('../../Animated/src/AnimatedImplementation'); <del>const React = require('react'); <del>const StyleSheet = require('../../StyleSheet/StyleSheet'); <del>const View = require('../View/View'); <del>const Platform = require('../../Utilities/Platform'); <add>import AnimatedImplementation from '../../Animated/src/AnimatedImplementation'; <add>import * as React from 'react'; <add>import StyleSheet from '../../StyleSheet/StyleSheet'; <add>import View from '../View/View'; <add>import Platform from '../../Utilities/Platform'; <ide> <ide> import type {LayoutEvent} from '../../Types/CoreEventTypes'; <ide> <ide><path>Libraries/Components/ScrollView/processDecelerationRate.js <ide> <ide> 'use strict'; <ide> <del>const Platform = require('../../Utilities/Platform'); <add>import Platform from '../../Utilities/Platform'; <ide> <ide> function processDecelerationRate( <ide> decelerationRate: number | 'normal' | 'fast',
7
Python
Python
set softmax attr in tagger model
c9b118a7e99f45708708f8ce051144005fd27ba6
<ide><path>spacy/_ml.py <ide> def build_tagger_model(nr_class, **cfg): <ide> ) <ide> model.nI = None <ide> model.tok2vec = tok2vec <del> model.softmax <add> model.softmax = softmax <ide> return model <ide> <ide>
1
Ruby
Ruby
define recursive deps and reqs
cbf89e50bb948989f3f19ed92f3251283a918e4b
<ide><path>Library/Homebrew/software_spec.rb <ide> def deps <ide> dependency_collector.deps <ide> end <ide> <add> def recursive_dependencies <add> recursive_dependencies = deps <add> deps.map(&:to_formula).compact.uniq.each do |f| <add> f.recursive_dependencies.each do |dep| <add> recursive_dependencies << dep unless recursive_dependencies.include?(dep) <add> end <add> end <add> recursive_dependencies <add> end <add> <ide> def requirements <ide> dependency_collector.requirements <ide> end <ide> <add> def recursive_requirements <add> Requirement.expand(self) <add> end <add> <ide> def patch(strip = :p1, src = nil, &block) <ide> p = Patch.create(strip, src, &block) <ide> dependency_collector.add(p.resource) if p.is_a? ExternalPatch
1
Javascript
Javascript
resolve gcs file stream on 'finish'
3f95ae21efba54e78c6cc0445043ac3654b340c6
<ide><path>scripts/code.angularjs.org-firebase/functions/index.js <ide> function sendStoredFile(request, response) { <ide> return new Promise((resolve, reject) => { <ide> <ide> const readStream = file.createReadStream() <del> .on('error', error => { <del> reject(error); <del> }) <del> .on('response', () => { <del> resolve(response); <del> }); <add> .on('error', reject) <add> .on('finish', resolve); <ide> <ide> response <ide> .status(200) <ide> function sendStoredFile(request, response) { <ide> 'Cache-Control': `public, max-age=${BROWSER_CACHE_DURATION}, s-maxage=${CDN_CACHE_DURATION}` <ide> }); <ide> <del> readStream.pipe(response); <add> readStream.pipe(response); <ide> }); <ide> <ide> });
1
Text
Text
update xhr information for android
04d86d819e7082206ba765d1db4da507817f46e4
<ide><path>docs/Network.md <ide> ws.onclose = (e) => { <ide> <ide> ## XMLHttpRequest <ide> <del>XMLHttpRequest API is implemented on-top of [iOS networking apis](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/URLLoadingSystem/URLLoadingSystem.html). The notable difference from web is the security model: you can read from arbitrary websites on the internet since there is no concept of [CORS](http://en.wikipedia.org/wiki/Cross-origin_resource_sharing). <add>XMLHttpRequest API is implemented on-top of [iOS networking apis](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/URLLoadingSystem/URLLoadingSystem.html) and [OkHttp](http://square.github.io/okhttp/). The notable difference from web is the security model: you can read from arbitrary websites on the internet since there is no concept of [CORS](http://en.wikipedia.org/wiki/Cross-origin_resource_sharing). <ide> <ide> ```js <ide> var request = new XMLHttpRequest();
1
Ruby
Ruby
update doc for taghelper
589d1ed722a3add255adc5636eab7dcc262dd0ca
<ide><path>actionview/lib/action_view/helpers/tag_helper.rb <ide> module TagHelper <ide> # For example, a key +user_id+ would render as <tt>data-user-id</tt> and <ide> # thus accessed as <tt>dataset.userId</tt>. <ide> # <del> # Values are encoded to JSON, with the exception of strings and symbols. <add> # Values are encoded to JSON, with the exception of strings, symbols and <add> # BigDecimals. <ide> # This may come in handy when using jQuery's HTML5-aware <tt>.data()</tt> <ide> # from 1.4.3. <ide> # <ide> module TagHelper <ide> # tag("input", type: 'text', disabled: true) <ide> # # => <input type="text" disabled="disabled" /> <ide> # <add> # tag("input", type: 'text', class: ["strong", "highlight"]) <add> # # => <input class="strong highlight" type="text" /> <add> # <ide> # tag("img", src: "open & shut.png") <ide> # # => <img src="open &amp; shut.png" /> <ide> # <ide> def tag(name, options = nil, open = false, escape = true) <ide> # Set escape to false to disable attribute value escaping. <ide> # <ide> # ==== Options <del> # The +options+ hash is used with attributes with no value like (<tt>disabled</tt> and <add> # The +options+ hash can be used with attributes with no value like (<tt>disabled</tt> and <ide> # <tt>readonly</tt>), which you can give a value of true in the +options+ hash. You can use <ide> # symbols or strings for the attribute names. <ide> # <ide> def tag(name, options = nil, open = false, escape = true) <ide> # # => <p>Hello world!</p> <ide> # content_tag(:div, content_tag(:p, "Hello world!"), class: "strong") <ide> # # => <div class="strong"><p>Hello world!</p></div> <add> # content_tag(:div, "Hello world!", class: ["strong", "highlight"]) <add> # # => <div class="strong highlight">Hello world!</div> <ide> # content_tag("select", options, multiple: true) <ide> # # => <select multiple="multiple">...options...</select> <ide> #
1
Text
Text
fix prettier linting
b69f3b79c5f9b9d10085b428c1942f1ff6b1324e
<ide><path>docs/advanced-features/compiler.md <ide> If you have feedback about `swcMinify`, please share it on the [feedback discuss <ide> <ide> We're working to port `babel-plugin-styled-components` to the Next.js Compiler. <ide> <del>First, update to the latest version of Next.js: `npm install next@latest`. Then, update your `next.config.js` file: <add>First, update to the latest version of Next.js: `npm install next@latest`. Then, update your `next.config.js` file: <ide> <ide> ```js <ide> // next.config.js
1
Javascript
Javascript
fix lazy initialization of clienthello parser
166c405b33320a0d6aceca6dc356fc26dc8a1da1
<ide><path>lib/_tls_wrap.js <ide> function Server(/* [options], listener */) { <ide> requestCert: self.requestCert, <ide> rejectUnauthorized: self.rejectUnauthorized, <ide> NPNProtocols: self.NPNProtocols, <del> SNICallback: self.SNICallback <add> SNICallback: options.SNICallback || SNICallback <ide> }); <ide> <ide> function listener() { <ide> Server.prototype.setOptions = function(options) { <ide> } <ide> if (secureOptions) this.secureOptions = secureOptions; <ide> if (options.NPNProtocols) tls.convertNPNProtocols(options.NPNProtocols, this); <del> if (options.SNICallback) { <del> this.SNICallback = options.SNICallback; <del> } else { <del> this.SNICallback = this.SNICallback.bind(this); <del> } <ide> if (options.sessionIdContext) { <ide> this.sessionIdContext = options.sessionIdContext; <ide> } else if (this.requestCert) { <ide> Server.prototype.addContext = function(servername, credentials) { <ide> function SNICallback(servername, callback) { <ide> var ctx; <ide> <del> this._contexts.some(function(elem) { <add> this.server._contexts.some(function(elem) { <ide> if (!util.isNull(servername.match(elem[0]))) { <ide> ctx = elem[1]; <ide> return true; <ide> function SNICallback(servername, callback) { <ide> callback(null, ctx); <ide> } <ide> <del>Server.prototype.SNICallback = SNICallback; <del> <ide> <ide> // Target API: <ide> //
1
Python
Python
use renamed threading event api in python 3.3
f7b69665fd0ce21adae7cfaed7fade63f8aae1fd
<ide><path>django/test/testcases.py <ide> def log_message(*args): <ide> pass <ide> <ide> <del>if sys.version_info >= (2, 7, 0): <add>if sys.version_info >= (3, 3, 0): <add> _ImprovedEvent = threading.Event <add>elif sys.version_info >= (2, 7, 0): <ide> _ImprovedEvent = threading._Event <ide> else: <ide> class _ImprovedEvent(threading._Event):
1
Python
Python
remove another deepcopy
3de5a34a8875159f7b2d0e0450404300a13ffea2
<ide><path>celery/utils/serialization.py <ide> def __init__(self, exc_module, exc_cls_name, exc_args, text=None): <ide> safe_exc_args = [] <ide> for arg in exc_args: <ide> try: <del> pickle.dumps(deepcopy(arg)) <add> pickle.dumps(arg) <ide> safe_exc_args.append(arg) <ide> except Exception: <ide> safe_exc_args.append(safe_repr(arg))
1
Javascript
Javascript
fix backpressure when multiple sync
d37e59fa6aee7f5b38696726b0145741ef3eb95b
<ide><path>lib/_stream_readable.js <ide> function chunkInvalid(state, chunk) { <ide> // 'readable' event will be triggered. <ide> function needMoreData(state) { <ide> return !state.ended && <del> (state.needReadable || <del> state.length < state.highWaterMark || <add> (state.length < state.highWaterMark || <ide> state.length === 0); <ide> } <ide> <ide> function emitReadable_(stream) { <ide> if (!state.destroyed && (state.length || state.ended)) { <ide> stream.emit('readable'); <ide> } <del> state.needReadable = !state.flowing && !state.ended; <add> <add> // The stream needs another readable event if <add> // 1. It is not flowing, as the flow mechanism will take <add> // care of it. <add> // 2. It is not ended. <add> // 3. It is below the highWaterMark, so we can schedule <add> // another readable later. <add> state.needReadable = <add> !state.flowing && <add> !state.ended && <add> state.length <= state.highWaterMark; <ide> flow(stream); <ide> } <ide> <ide><path>test/parallel/test-stream-backpressure.js <add>'use strict'; <add> <add>const common = require('../common'); <add>const assert = require('assert'); <add>const stream = require('stream'); <add> <add>let pushes = 0; <add>const total = 65500 + 40 * 1024; <add>const rs = new stream.Readable({ <add> read: common.mustCall(function() { <add> if (pushes++ === 10) { <add> this.push(null); <add> return; <add> } <add> <add> const length = this._readableState.length; <add> <add> // We are at most doing two full runs of _reads <add> // before stopping, because Readable is greedy <add> // to keep its buffer full <add> assert(length <= total); <add> <add> this.push(Buffer.alloc(65500)); <add> for (let i = 0; i < 40; i++) { <add> this.push(Buffer.alloc(1024)); <add> } <add> <add> // We will be over highWaterMark at this point <add> // but a new call to _read is scheduled anyway. <add> }, 11) <add>}); <add> <add>const ws = stream.Writable({ <add> write: common.mustCall(function(data, enc, cb) { <add> setImmediate(cb); <add> }, 41 * 10) <add>}); <add> <add>rs.pipe(ws);
2
Python
Python
add a new mode for backend.randomgenerator
800eba154f6259c0da2e6317bd655bfd82f67bd5
<ide><path>keras/backend.py <ide> class RandomGenerator(tf.__internal__.tracking.AutoTrackable): <ide> new stateless random ops with seeds and tf.random.Generator. Any class that <ide> relies on RNG (eg initializer, shuffle, dropout) should use this class to <ide> handle the transition from legacy RNGs to new RNGs. <del> """ <ide> <del> def __init__(self, seed=None, force_generator=False): <add> Args: <add> seed: Optional int seed. When `rng_type` is "stateful", the seed is used <add> to create `tf.random.Generator` to produce deterministic sequences. <add> When `rng_type` is "stateless", new seed will be created if it is not <add> provided by user, and it will be passed down to stateless random ops. <add> When `rng_type` is "legacy_stateful", the seed will be passed down to <add> stateful random ops. <add> rng_type: Type of RNG to use, one of "stateful", "stateless", <add> "legacy_stateful". It defaults to "stateful" if <add> `enable_tf_random_generator` has been activated, or to <add> "legacy_stateful" otherwise. <add> - When using "stateless", the random ops outputs are constant (the same <add> inputs result in the same outputs). <add> - When using "stateful" or "legacy_stateful", the random ops outputs are <add> non-constant, but deterministic: calling the same random op multiple <add> times with the same inputs results in a deterministic sequence of <add> different outputs. <add> - "legacy_stateful" is backed by TF1 stateful RNG ops <add> (e.g. `tf.random.uniform`), while "stateful" <add> is backed by TF2 APIs (e.g. `tf.random.Generator.uniform`). <add> """ <add> RNG_STATELESS = 'stateless' <add> RNG_STATEFUL = 'stateful' <add> RNG_LEGACY_STATEFUL = 'legacy_stateful' <add> <add> def __init__(self, seed=None, rng_type=None, **kwargs): <ide> self._seed = seed <del> self._force_generator = force_generator <add> self._set_rng_type(rng_type, **kwargs) <ide> self._built = False <ide> <add> def _set_rng_type(self, rng_type, **kwargs): <add> # Only supported kwargs is "force_generator", which we will remove once we <add> # clean up all the caller. <add> # TODO(scottzhu): Remove the kwargs for force_generator. <add> if kwargs.get('force_generator', False): <add> rng_type = self.RNG_STATEFUL <add> if rng_type is None: <add> if is_tf_random_generator_enabled(): <add> self._rng_type = self.RNG_STATEFUL <add> else: <add> self._rng_type = self.RNG_LEGACY_STATEFUL <add> else: <add> if rng_type not in [self.RNG_STATEFUL, <add> self.RNG_LEGACY_STATEFUL, self.RNG_STATELESS]: <add> raise ValueError( <add> 'Invalid `rng_type` received. ' <add> 'Valid `rng_type` are ["stateless", "stateful", "legacy_stateful"].' <add> f' Got: {rng_type}') <add> self._rng_type = rng_type <add> <ide> def _maybe_init(self): <ide> """Lazily init the RandomGenerator. <ide> <ide> def _maybe_init(self): <ide> if self._built: <ide> return <ide> <del> if (tf.compat.v1.executing_eagerly_outside_functions() and <del> (is_tf_random_generator_enabled() or self._force_generator)): <del> # In the case of V2, we use tf.random.Generator to create all the random <del> # numbers and seeds. <add> if (self._rng_type == self.RNG_STATEFUL and <add> not tf.compat.v1.executing_eagerly_outside_functions()): <add> # Fall back to legacy stateful since the generator need to work in tf2. <add> self._rng_type = self.RNG_LEGACY_STATEFUL <add> <add> if self._rng_type == self.RNG_STATELESS: <add> self._seed = self._create_seed(self._seed) <add> self._generator = None <add> elif self._rng_type == self.RNG_STATEFUL: <ide> from keras.utils import tf_utils # pylint: disable=g-import-not-at-top <ide> with tf_utils.maybe_init_scope(self): <del> if self._seed is not None: <del> self._generator = tf.random.Generator.from_seed(self._seed) <del> else: <del> if getattr(_SEED_GENERATOR, 'generator', None): <del> seed = _SEED_GENERATOR.generator.randint(1, 1e9) <del> else: <del> seed = random.randint(1, 1e9) <del> self._generator = tf.random.Generator.from_seed(seed) <add> seed = self._create_seed(self._seed) <add> self._generator = tf.random.Generator.from_seed(seed) <ide> else: <del> # In the v1 case, we use stateful op, regardless whether user provide a <add> # In legacy stateful, we use stateful op, regardless whether user provide <ide> # seed or not. Seeded stateful op will ensure generating same sequences. <ide> self._generator = None <ide> self._built = True <ide> def make_seed_for_stateless_op(self): <ide> A tensor with shape [2,]. <ide> """ <ide> self._maybe_init() <del> if self._generator: <add> if self._rng_type == self.RNG_STATELESS: <add> return [self._seed, 0] <add> elif self._rng_type == self.RNG_STATEFUL: <ide> return self._generator.make_seeds()[:, 0] <ide> return None <ide> <ide> def make_legacy_seed(self): <ide> When user didn't provide any original seed, this method will return None. <ide> Otherwise it will increment the counter and return as the new seed. <ide> <del> Note that it is important the generate different seed for stateful ops in <add> Note that it is important to generate different seed for stateful ops in <ide> the `tf.function`. The random ops will return same value when same seed is <ide> provided in the `tf.function`. <ide> <ide> def make_legacy_seed(self): <ide> return result <ide> return None <ide> <add> def _create_seed(self, user_specified_seed): <add> if user_specified_seed is not None: <add> return user_specified_seed <add> elif getattr(_SEED_GENERATOR, 'generator', None): <add> return _SEED_GENERATOR.generator.randint(1, 1e9) <add> else: <add> return random.randint(1, 1e9) <add> <ide> def random_normal(self, shape, mean=0., stddev=1., dtype=None): <ide> self._maybe_init() <ide> dtype = dtype or floatx() <del> if self._generator: <add> if self._rng_type == self.RNG_STATEFUL: <ide> return self._generator.normal( <ide> shape=shape, mean=mean, stddev=stddev, dtype=dtype) <add> elif self._rng_type == self.RNG_STATELESS: <add> return tf.random.stateless_normal( <add> shape=shape, mean=mean, stddev=stddev, dtype=dtype, <add> seed=self.make_seed_for_stateless_op()) <ide> return tf.random.normal( <ide> shape=shape, mean=mean, stddev=stddev, dtype=dtype, <ide> seed=self.make_legacy_seed()) <ide> <ide> def random_uniform(self, shape, minval=0., maxval=None, dtype=None): <ide> self._maybe_init() <ide> dtype = dtype or floatx() <del> if self._generator: <add> if self._rng_type == self.RNG_STATEFUL: <ide> return self._generator.uniform( <ide> shape=shape, minval=minval, maxval=maxval, dtype=dtype) <add> elif self._rng_type == self.RNG_STATELESS: <add> return tf.random.stateless_uniform( <add> shape=shape, minval=minval, maxval=maxval, dtype=dtype, <add> seed=self.make_seed_for_stateless_op()) <ide> return tf.random.uniform( <ide> shape=shape, minval=minval, maxval=maxval, dtype=dtype, <ide> seed=self.make_legacy_seed()) <ide> <ide> def truncated_normal(self, shape, mean=0., stddev=1., dtype=None): <ide> self._maybe_init() <ide> dtype = dtype or floatx() <del> if self._generator: <add> if self._rng_type == self.RNG_STATEFUL: <ide> return self._generator.truncated_normal( <ide> shape=shape, mean=mean, stddev=stddev, dtype=dtype) <add> elif self._rng_type == self.RNG_STATELESS: <add> return tf.random.stateless_truncated_normal( <add> shape=shape, mean=mean, stddev=stddev, dtype=dtype, <add> seed=self.make_seed_for_stateless_op()) <ide> return tf.random.truncated_normal( <ide> shape=shape, mean=mean, stddev=stddev, dtype=dtype, <ide> seed=self.make_legacy_seed()) <ide> <ide> def dropout(self, inputs, rate, noise_shape=None): <ide> self._maybe_init() <del> if self._generator: <add> if self._rng_type == self.RNG_STATEFUL: <add> return tf.nn.experimental.stateless_dropout( <add> inputs, rate=rate, noise_shape=noise_shape, <add> seed=self.make_seed_for_stateless_op()) <add> elif self._rng_type == self.RNG_STATELESS: <ide> return tf.nn.experimental.stateless_dropout( <ide> inputs, rate=rate, noise_shape=noise_shape, <ide> seed=self.make_seed_for_stateless_op()) <add> # We don't support stateless in this case, otherwise the dropout <add> # will always have identical behavior across the batches. <ide> return tf.nn.dropout(inputs, rate=rate, noise_shape=noise_shape, <ide> seed=self.make_legacy_seed()) <ide> <ide><path>keras/backend_test.py <ide> class RandomGeneratorTest(tf.test.TestCase): <ide> <ide> def test_generator_reproducibility(self): <ide> seed = 1337 <del> gen1 = backend.RandomGenerator(seed, force_generator=True) <add> gen1 = backend.RandomGenerator(seed, rng_type='stateful') <ide> output1 = gen1.random_normal(shape=[2, 3]) <ide> output2 = gen1.random_normal(shape=[2, 3]) <ide> <ide> self.assertNotAllClose(output1, output2) <ide> <del> gen2 = backend.RandomGenerator(seed, force_generator=True) <add> gen2 = backend.RandomGenerator(seed, rng_type='stateful') <ide> output3 = gen2.random_normal(shape=[2, 3]) <ide> output4 = gen2.random_normal(shape=[2, 3]) <ide> <ide> def test_generator_reproducibility(self): <ide> <ide> def test_unseeded(self): <ide> seed = None <del> gen1 = backend.RandomGenerator(seed, force_generator=True) <add> gen1 = backend.RandomGenerator(seed, rng_type='stateful') <ide> output1 = gen1.random_normal(shape=[2, 3]) <ide> <del> gen2 = backend.RandomGenerator(seed, force_generator=True) <add> gen2 = backend.RandomGenerator(seed, rng_type='stateful') <ide> output2 = gen2.random_normal(shape=[2, 3]) <ide> <ide> self.assertNotAllClose(output1, output2) <ide> <ide> def test_implementation(self): <ide> seed = 1337 <del> seeded = backend.RandomGenerator(seed, force_generator=True) <add> seeded = backend.RandomGenerator(seed, rng_type='stateful') <ide> seeded._maybe_init() <del> unseeded = backend.RandomGenerator(None, force_generator=True) <add> unseeded = backend.RandomGenerator(None, rng_type='stateful') <ide> unseeded._maybe_init() <ide> if tf.compat.v1.executing_eagerly(): <ide> # Make sure we use tf.random.Generator in v2. <ide> def test_implementation(self): <ide> def test_unseeded_with_utils_set_random_seed(self): <ide> keras_seed = 1337 <ide> tf_utils.set_random_seed(keras_seed) <del> gen1 = backend.RandomGenerator(seed=None, force_generator=True) <add> gen1 = backend.RandomGenerator(seed=None, rng_type='stateful') <ide> output1 = gen1.random_normal(shape=[2, 3]) <ide> output2 = gen1.random_normal(shape=[2, 3]) <ide> <ide> def test_unseeded_with_utils_set_random_seed(self): <ide> # sequence. This will ensure all the client are in sync in the multi-client <ide> # setting, when they all set the keras seed. <ide> tf_utils.set_random_seed(keras_seed) <del> gen2 = backend.RandomGenerator(seed=None, force_generator=True) <add> gen2 = backend.RandomGenerator(seed=None, rng_type='stateful') <ide> output3 = gen2.random_normal(shape=[2, 3]) <ide> output4 = gen2.random_normal(shape=[2, 3]) <ide> <del> gen3 = backend.RandomGenerator(seed=None, force_generator=True) <add> gen3 = backend.RandomGenerator(seed=None, rng_type='stateful') <ide> output5 = gen3.random_normal(shape=[2, 3]) <ide> output6 = gen3.random_normal(shape=[2, 3]) <ide> <ide> def test_unseeded_with_utils_set_random_seed(self): <ide> self.assertNotAllEqual(output3, output5) <ide> self.assertNotAllEqual(output4, output6) <ide> <add> def test_force_stateless(self): <add> gen = backend.RandomGenerator(seed=None, rng_type='stateless') <add> output1 = gen.random_normal(shape=[2, 3]) <add> seed1 = gen._seed <add> output2 = gen.random_normal(shape=[2, 3]) <add> seed2 = gen._seed <add> <add> self.assertAllClose(output1, output2) <add> # Make sure we always use the same seed, and it is not None <add> self.assertEqual(seed1, seed2) <add> self.assertIsNotNone(seed1) <add> <add> # Make sure a new seed is used when creating a new generator instance. <add> gen2 = backend.RandomGenerator(seed=None, rng_type='stateless') <add> output3 = gen2.random_normal(shape=[2, 3]) <add> seed3 = gen2._seed <add> output4 = gen2.random_normal(shape=[2, 3]) <add> seed4 = gen2._seed <add> <add> self.assertAllClose(output3, output4) <add> self.assertEqual(seed3, seed4) <add> self.assertNotEqual(seed1, seed3) <add> <add> def test_force_stateless_with_seed(self): <add> seed = 1337 <add> gen = backend.RandomGenerator(seed=seed, rng_type='stateless') <add> output1 = gen.random_normal(shape=[2, 3]) <add> seed1 = gen._seed <add> output2 = gen.random_normal(shape=[2, 3]) <add> seed2 = gen._seed <add> <add> self.assertAllClose(output1, output2) <add> # Make sure we always use the same seed, and it is not None <add> self.assertEqual(seed, seed1) <add> self.assertEqual(seed, seed2) <add> <add> # Make sure RandomGenerator always generate same value with same seed. <add> gen2 = backend.RandomGenerator(seed=seed, rng_type='stateless') <add> output3 = gen2.random_normal(shape=[2, 3]) <add> self.assertAllClose(output3, output1) <add> <add> def test_unknown_rng_type(self): <add> with self.assertRaisesRegex(ValueError, 'Got: unknown'): <add> backend.RandomGenerator(seed=None, rng_type='unknown') <add> <add> def test_prefer_stateless_over_global_generator(self): <add> try: <add> generator_enabled = backend.is_tf_random_generator_enabled() <add> if not generator_enabled: <add> backend.enable_tf_random_generator() <add> <add> seed = 1337 <add> gen = backend.RandomGenerator(seed=seed, rng_type='stateless') <add> output1 = gen.random_normal(shape=[2, 3]) <add> output2 = gen.random_normal(shape=[2, 3]) <add> <add> self.assertIsNone(gen._generator) <add> self.assertAllClose(output1, output2) <add> finally: <add> if not generator_enabled: <add> # Change the global flag back. <add> backend.disable_tf_random_generator() <add> <ide> <ide> if __name__ == '__main__': <ide> tf.test.main() <ide><path>keras/initializers/initializers_v2.py <ide> # pylint: disable=g-classes-have-attributes, missing-docstring, g-direct-tensorflow-import <ide> <ide> import math <add> <ide> from keras import backend <ide> from keras.dtensor import utils <ide> <ide> def __call__(self, shape, dtype=None, **kwargs): <ide> shape = kwargs[_PARTITION_SHAPE] <ide> layout = kwargs.pop('layout', None) <ide> if layout: <del> self._random_generator._force_generator = True <add> self._random_generator._rng_type = self._random_generator.RNG_STATEFUL <ide> _ensure_keras_seeded() <ide> return utils.call_with_layout( <ide> self._random_generator.random_uniform, layout, shape, self.minval, <ide> def __call__(self, shape, dtype=None, **kwargs): <ide> shape = kwargs[_PARTITION_SHAPE] <ide> layout = kwargs.pop('layout', None) <ide> if layout: <del> self._random_generator._force_generator = True <add> self._random_generator._rng_type = self._random_generator.RNG_STATEFUL <ide> _ensure_keras_seeded() <ide> return utils.call_with_layout( <ide> self._random_generator.random_normal, layout, shape, self.mean, <ide> def __call__(self, shape, dtype=None, **kwargs): <ide> shape = kwargs[_PARTITION_SHAPE] <ide> layout = kwargs.pop('layout', None) <ide> if layout: <del> self._random_generator._force_generator = True <add> self._random_generator._rng_type = self._random_generator.RNG_STATEFUL <ide> _ensure_keras_seeded() <ide> return utils.call_with_layout( <ide> self._random_generator.truncated_normal, layout, shape, self.mean, <ide> def __call__(self, shape, dtype=None, **kwargs): <ide> shape = kwargs[_PARTITION_SHAPE] <ide> layout = kwargs.pop('layout', None) <ide> if layout: <del> self._random_generator._force_generator = True <add> self._random_generator._rng_type = self._random_generator.RNG_STATEFUL <ide> _ensure_keras_seeded() <ide> return utils.call_with_layout(self._generate_init_val, layout, <ide> shape=shape, dtype=dtype) <ide> def __call__(self, shape, dtype=None, **kwargs): <ide> f'shape={shape} of rank {len(shape)}.') <ide> layout = kwargs.pop('layout', None) <ide> if layout: <del> self._random_generator._force_generator = True <add> self._random_generator._rng_type = self._random_generator.RNG_STATEFUL <ide> _ensure_keras_seeded() <ide> return utils.call_with_layout( <ide> self._generate_init_val, layout, shape=shape, dtype=dtype) <ide><path>keras/layers/core/core_test.py <ide> def test_dropout_partial_noise_shape(self): <ide> <ide> def test_dropout_with_savemodel(self): <ide> inputs = keras.Input(shape=(5, 10)) <del> layer = keras.layers.Dropout(0.5) <del> layer._random_generator._force_generator = True <add> layer = keras.layers.Dropout(0.5, force_generator=True) <ide> outputs = layer(inputs) <ide> model = keras.Model(inputs, outputs) <ide> train = model(np.ones((20, 5, 10)), training=True) <ide> def test_lambda_skip_state_variable_from_initializer(self): <ide> # Force the initializers to use the tf.random.Generator, which will contain <ide> # the state variable. <ide> kernel_initializer = initializers.RandomNormalV2() <del> kernel_initializer._random_generator._force_generator = True <add> kernel_initializer._random_generator._rng_type \ <add> = kernel_initializer._random_generator.RNG_STATEFUL <ide> dense = keras.layers.Dense(1, use_bias=False, <ide> kernel_initializer=kernel_initializer) <ide> <ide><path>keras/layers/regularization/dropout_test.py <ide> def test_dropout_partial_noise_shape(self): <ide> <ide> def test_dropout_with_savemodel(self): <ide> inputs = keras.Input(shape=(5, 10)) <del> layer = keras.layers.Dropout(0.5) <del> layer._random_generator._force_generator = True <add> layer = keras.layers.Dropout(0.5, force_generator=True) <ide> outputs = layer(inputs) <ide> model = keras.Model(inputs, outputs) <ide> train = model(np.ones((20, 5, 10)), training=True)
5
PHP
PHP
controller
62133950ecc88520e6aca3e5edcf8c9c4b6de8a6
<ide><path>src/Illuminate/Routing/Console/ControllerMakeCommand.php <ide> protected function buildClass($name) <ide> if ($this->option('model')) { <ide> $modelClass = $this->parseModel($this->option('model')); <ide> <add> if (! class_exists($modelClass)) { <add> if ($this->confirm("The model $modelClass does not exist. Do you want to generate it?")) { <add> $this->call('make:model', ['name' => $modelClass]); <add> } <add> } <add> <ide> $replace = [ <ide> 'DummyFullModelClass' => $modelClass, <ide> 'DummyModelClass' => class_basename($modelClass),
1
Text
Text
fix typo in export-all-in-page
2c424446b80ff503a6c5853f6a3b42d03acf1abc
<ide><path>errors/export-all-in-page.md <ide> export function getStaticProps() { <ide> export * from './one' <ide> ``` <ide> <del>Would cause cause the following error: <add>Would cause the following error: <ide> <ide> ``` <ide> Module not found: Can't resolve 'fs' in './pages/two.js'
1
Ruby
Ruby
use redis#mget for rediscachestore#fetch_multi
83c1ed9a1a11196cab66d9c44a56a902ca0710e4
<ide><path>activesupport/lib/active_support/cache/redis_cache_store.rb <ide> def read_entry(key, options = nil) <ide> end <ide> end <ide> <add> def read_multi_entries(names, _options) <add> if mget_capable? <add> read_multi_mget(*names) <add> else <add> super <add> end <add> end <add> <ide> def read_multi_mget(*names) <ide> options = names.extract_options! <ide> options = merged_options(options) <ide><path>activesupport/test/cache/stores/redis_cache_store_test.rb <ide> class RedisCacheStoreCommonBehaviorTest < StoreTest <ide> include CacheIncrementDecrementBehavior <ide> include CacheInstrumentationBehavior <ide> include AutoloadingCacheBehavior <add> <add> def test_fetch_multi_uses_redis_mget <add> assert_called(@cache.redis, :mget, returns: []) do <add> @cache.fetch_multi("a", "b", "c") do |key| <add> key * 2 <add> end <add> end <add> end <ide> end <ide> <ide> # Separate test class so we can omit the namespace which causes expected,
2
Python
Python
add csrf and fix tests
ade0e4db7dea69b22560d3e2586a4846883746d2
<ide><path>tests/core.py <ide> def get_csrf(self, response): <ide> <ide> def login(self, username, password): <ide> response = self.app.get('/admin/airflow/login') <del> print(response.data.decode('utf-8')) <del> <ide> csrf_token = self.get_csrf(response) <ide> <ide> return self.app.post('/admin/airflow/login', data=dict( <ide> def test_login_logout_ldap(self): <ide> assert configuration.getboolean('webserver', 'authenticate') is True <ide> <ide> response = self.login('user1', 'userx') <del> print(response.data.decode('utf-8')) <ide> assert 'Incorrect login details' in response.data.decode('utf-8') <ide> <ide> response = self.login('userz', 'user1') <del> print(response.data.decode('utf-8')) <ide> assert 'Incorrect login details' in response.data.decode('utf-8') <ide> <ide> response = self.login('user1', 'user1') <del> print(response.data.decode('utf-8')) <ide> assert 'Data Profiling' in response.data.decode('utf-8') <ide> <ide> response = self.logout() <del> print(response.data.decode('utf-8')) <ide> assert 'form-signin' in response.data.decode('utf-8') <ide> <ide> def test_unauthorized(self):
1
Python
Python
add example dag using timedeltasensorasync
c596ef43456429d80bef24ff3755b1c1bc31bc1c
<ide><path>airflow/example_dags/example_time_delta_sensor_async.py <add># <add># Licensed to the Apache Software Foundation (ASF) under one <add># or more contributor license agreements. See the NOTICE file <add># distributed with this work for additional information <add># regarding copyright ownership. The ASF licenses this file <add># to you under the Apache License, Version 2.0 (the <add># "License"); you may not use this file except in compliance <add># with the License. You may obtain a copy of the License at <add># <add># http://www.apache.org/licenses/LICENSE-2.0 <add># <add># Unless required by applicable law or agreed to in writing, <add># software distributed under the License is distributed on an <add># "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY <add># KIND, either express or implied. See the License for the <add># specific language governing permissions and limitations <add># under the License. <add> <add>""" <add>Example DAG demonstrating ``TimeDeltaSensorAsync``, a drop in replacement for ``TimeDeltaSensor`` that <add>defers and doesn't occupy a worker slot while it waits <add>""" <add> <add>from datetime import datetime, timedelta <add> <add>from airflow import DAG <add>from airflow.operators.dummy import DummyOperator <add>from airflow.sensors.time_delta import TimeDeltaSensorAsync <add> <add>with DAG( <add> dag_id="example_time_delta_sensor_async", <add> schedule_interval=None, <add> start_date=datetime(2021, 1, 1), <add> catchup=False, <add> tags=["example"], <add>) as dag: <add> wait = TimeDeltaSensorAsync(task_id="wait", delta=timedelta(seconds=10)) <add> finish = DummyOperator(task_id="finish") <add> wait >> finish
1
Ruby
Ruby
add check for disabling weak imports
b33fe79478992da827317111370ab15d280e72c5
<ide><path>Library/Homebrew/extend/os/mac/extend/ENV/shared.rb <ide> module SharedEnvExtension <add> def no_weak_imports? <add> return false unless compiler == :clang <add> MacOS::Xcode.version >= "8.0" || MacOS::CLT.version >= "8.0" <add> end <ide> end
1
Text
Text
extend v2.3 migration guide
d777d9cc382a23a598b2a11a3a3902251a894b4a
<ide><path>website/docs/usage/v2-3.md <ide> If you're adding data for a new language, the normalization table should be <ide> added to `spacy-lookups-data`. See <ide> [adding norm exceptions](/usage/adding-languages#norm-exceptions). <ide> <del>#### No preloaded lexemes/vocab for models with vectors <add>#### No preloaded vocab for models with vectors <ide> <ide> To reduce the initial loading time, the lexemes in `nlp.vocab` are no longer <ide> loaded on initialization for models with vectors. As you process texts, the <del>lexemes will be added to the vocab automatically, just as in models without <del>vectors. <add>lexemes will be added to the vocab automatically, just as in small models <add>without vectors. <ide> <ide> To see the number of unique vectors and number of words with vectors, see <ide> `nlp.meta['vectors']`, for example for `en_core_web_md` there are `20000` <ide> for orth in nlp.vocab.vectors: <ide> _ = nlp.vocab[orth] <ide> ``` <ide> <add>If your workflow previously iterated over `nlp.vocab`, a similar alternative <add>is to iterate over words with vectors instead: <add> <add>```diff <add>- lexemes = [w for w in nlp.vocab] <add>+ lexemes = [nlp.vocab[orth] for orth in nlp.vocab.vectors] <add>``` <add> <add>Be aware that the set of preloaded lexemes in a v2.2 model is not equivalent to <add>the set of words with vectors. For English, v2.2 `md/lg` models have 1.3M <add>provided lexemes but only 685K words with vectors. The vectors have been <add>updated for most languages in v2.2, but the English models contain the same <add>vectors for both v2.2 and v2.3. <add> <ide> #### Lexeme.is_oov and Token.is_oov <ide> <ide> <Infobox title="Important note" variant="warning"> <ide> model vocab, which will take a few seconds on initial loading. When you save <ide> this model after loading the `prob` table, the full `prob` table will be saved <ide> as part of the model vocab. <ide> <add>To load the probability table into a provided model, first make sure you have <add>`spacy-lookups-data` installed. To load the table, remove the empty provided <add>`lexeme_prob` table and then access `Lexeme.prob` for any word to load the <add>table from `spacy-lookups-data`: <add> <add>```diff <add>+ # prerequisite: pip install spacy-lookups-data <add>import spacy <add> <add>nlp = spacy.load("en_core_web_md") <add> <add># remove the empty placeholder prob table <add>+ if nlp.vocab.lookups_extra.has_table("lexeme_prob"): <add>+ nlp.vocab.lookups_extra.remove_table("lexeme_prob") <add> <add># access any `.prob` to load the full table into the model <add>assert nlp.vocab["a"].prob == -3.9297883511 <add> <add># if desired, save this model with the probability table included <add>nlp.to_disk("/path/to/model") <add>``` <add> <ide> If you'd like to include custom `cluster`, `prob`, or `sentiment` tables as part <ide> of a new model, add the data to <ide> [`spacy-lookups-data`](https://github.com/explosion/spacy-lookups-data) under <ide> When you initialize a new model with [`spacy init-model`](/api/cli#init-model), <ide> the `prob` table from `spacy-lookups-data` may be loaded as part of the <ide> initialization. If you'd like to omit this extra data as in spaCy's provided <ide> v2.3 models, use the new flag `--omit-extra-lookups`. <add> <add>#### Tag maps in provided models vs. blank models <add> <add>The tag maps in the provided models may differ from the tag maps in the spaCy <add>library. You can access the tag map in a loaded model under <add>`nlp.vocab.morphology.tag_map`. <add> <add>The tag map from `spacy.lang.lg.tag_map` is still used when a blank model is <add>initialized. If you want to provide an alternate tag map, update <add>`nlp.vocab.morphology.tag_map` after initializing the model or if you're using <add>the [train CLI](/api/cli#train), you can use the new `--tag-map-path` option to <add>provide in the tag map as a JSON dict. <add> <add>If you want to export a tag map from a provided model for use with the train <add>CLI, you can save it as a JSON dict. To only use string keys as required by <add>JSON and to make it easier to read and edit, any internal integer IDs need to <add>be converted back to strings: <add> <add>```python <add>import spacy <add>import srsly <add> <add>nlp = spacy.load("en_core_web_sm") <add>tag_map = {} <add> <add># convert any integer IDs to strings for JSON <add>for tag, morph in nlp.vocab.morphology.tag_map.items(): <add> tag_map[tag] = {} <add> for feat, val in morph.items(): <add> feat = nlp.vocab.strings.as_string(feat) <add> if not isinstance(val, bool): <add> val = nlp.vocab.strings.as_string(val) <add> tag_map[tag][feat] = val <add> <add>srsly.write_json("tag_map.json", tag_map) <add>```
1
PHP
PHP
add test for userfields and related models
60917974bfa5da328a814f05b81069a978cebd52
<ide><path>lib/Cake/Test/Case/Controller/Component/Auth/BasicAuthenticateTest.php <ide> public function testAuthenticateUserFieldsSuccess() { <ide> $this->assertEquals($expected, $result); <ide> } <ide> <add>/** <add> * test userFields and related models success <add> * <add> * @return void <add> */ <add> public function testAuthenticateUserFieldsRelatedModelsSuccess() { <add> $User = ClassRegistry::init('User'); <add> $User->bindModel(array('hasOne' => array('Article'))); <add> $this->auth->settings['recursive'] = 0; <add> $this->auth->settings['userFields'] = array('Article.id', 'Article.title'); <add> $request = new CakeRequest('posts/index', false); <add> $request->addParams(array('pass' => array(), 'named' => array())); <add> <add> $_SERVER['PHP_AUTH_USER'] = 'mariano'; <add> $_SERVER['PHP_AUTH_PW'] = 'password'; <add> <add> $result = $this->auth->authenticate($request, $this->response); <add> $expected = array( <add> 'id' => 1, <add> 'title' => 'First Article', <add> ); <add> $this->assertEquals($expected, $result['Article']); <add> } <add> <ide> /** <ide> * test scope failure. <ide> *
1
Text
Text
fill contributer agreement
378280039b300bf53dfda8d3bd77e87829564404
<ide><path>.github/contributors/ligser.md <add># spaCy contributor agreement <add> <add>This spaCy Contributor Agreement (**"SCA"**) is based on the <add>[Oracle Contributor Agreement](http://www.oracle.com/technetwork/oca-405177.pdf). <add>The SCA applies to any contribution that you make to any product or project <add>managed by us (the **"project"**), and sets out the intellectual property rights <add>you grant to us in the contributed materials. The term **"us"** shall mean <add>[ExplosionAI UG (haftungsbeschränkt)](https://explosion.ai/legal). The term <add>**"you"** shall mean the person or entity identified below. <add> <add>If you agree to be bound by these terms, fill in the information requested <add>below and include the filled-in version with your first pull request, under the <add>folder [`.github/contributors/`](/.github/contributors/). The name of the file <add>should be your GitHub username, with the extension `.md`. For example, the user <add>example_user would create the file `.github/contributors/example_user.md`. <add> <add>Read this agreement carefully before signing. These terms and conditions <add>constitute a binding legal agreement. <add> <add>## Contributor Agreement <add> <add>1. The term "contribution" or "contributed materials" means any source code, <add>object code, patch, tool, sample, graphic, specification, manual, <add>documentation, or any other material posted or submitted by you to the project. <add> <add>2. With respect to any worldwide copyrights, or copyright applications and <add>registrations, in your contribution: <add> <add> * you hereby assign to us joint ownership, and to the extent that such <add> assignment is or becomes invalid, ineffective or unenforceable, you hereby <add> grant to us a perpetual, irrevocable, non-exclusive, worldwide, no-charge, <add> royalty-free, unrestricted license to exercise all rights under those <add> copyrights. This includes, at our option, the right to sublicense these same <add> rights to third parties through multiple levels of sublicensees or other <add> licensing arrangements; <add> <add> * you agree that each of us can do all things in relation to your <add> contribution as if each of us were the sole owners, and if one of us makes <add> a derivative work of your contribution, the one who makes the derivative <add> work (or has it made will be the sole owner of that derivative work; <add> <add> * you agree that you will not assert any moral rights in your contribution <add> against us, our licensees or transferees; <add> <add> * you agree that we may register a copyright in your contribution and <add> exercise all ownership rights associated with it; and <add> <add> * you agree that neither of us has any duty to consult with, obtain the <add> consent of, pay or render an accounting to the other for any use or <add> distribution of your contribution. <add> <add>3. With respect to any patents you own, or that you can license without payment <add>to any third party, you hereby grant to us a perpetual, irrevocable, <add>non-exclusive, worldwide, no-charge, royalty-free license to: <add> <add> * make, have made, use, sell, offer to sell, import, and otherwise transfer <add> your contribution in whole or in part, alone or in combination with or <add> included in any product, work or materials arising out of the project to <add> which your contribution was submitted, and <add> <add> * at our option, to sublicense these same rights to third parties through <add> multiple levels of sublicensees or other licensing arrangements. <add> <add>4. Except as set out above, you keep all right, title, and interest in your <add>contribution. The rights that you grant to us under these terms are effective <add>on the date you first submitted a contribution to us, even if your submission <add>took place before the date you sign these terms. <add> <add>5. You covenant, represent, warrant and agree that: <add> <add> * Each contribution that you submit is and shall be an original work of <add> authorship and you can legally grant the rights set out in this SCA; <add> <add> * to the best of your knowledge, each contribution will not violate any <add> third party's copyrights, trademarks, patents, or other intellectual <add> property rights; and <add> <add> * each contribution shall be in compliance with U.S. export control laws and <add> other applicable export and import laws. You agree to notify us if you <add> become aware of any circumstance which would make any of the foregoing <add> representations inaccurate in any respect. We may publicly disclose your <add> participation in the project, including the fact that you have signed the SCA. <add> <add>6. This SCA is governed by the laws of the State of California and applicable <add>U.S. Federal law. Any choice of law rules will not apply. <add> <add>7. Please place an “x” on one of the applicable statement below. Please do NOT <add>mark both statements: <add> <add> * [x] I am signing on behalf of myself as an individual and no other person <add> or entity, including my employer, has or will have rights with respect to my <add> contributions. <add> <add> * [ ] I am signing on behalf of my employer or a legal entity and I have the <add> actual authority to contractually bind that entity. <add> <add>## Contributor Details <add> <add>| Field | Entry | <add>|------------------------------- | -------------------- | <add>| Name | Roman Domrachev | <add>| Company name (if applicable) | | <add>| Title or role (if applicable) | | <add>| Date | 11 November 2017 | <add>| GitHub username | ligser | <add>| Website (optional) | |
1
Python
Python
add fp16 end-to-end tests
58a3de6c68639c3eac95f7c84089f320d32a85bb
<ide><path>official/transformer/v2/transformer_benchmark.py <ide> def benchmark_8_gpu_static_batch(self): <ide> FLAGS.batch_size = 3072*8 <ide> FLAGS.static_batch = True <ide> FLAGS.max_length = 64 <del> FLAGS.train_steps = 100000 <del> FLAGS.steps_between_evals = 5000 <add> FLAGS.train_steps = 400000 <add> FLAGS.steps_between_evals = 20000 <ide> FLAGS.model_dir = self._get_model_dir('benchmark_8_gpu_static_batch') <ide> self._run_and_report_benchmark(total_batch_size=FLAGS.batch_size, <ide> log_steps=FLAGS.log_steps, <ide> bleu_min=28, <ide> bleu_max=29) <ide> <add> def benchmark_8_gpu_static_batch_fp16(self): <add> """Benchmark 8 gpu with static batch and fp16. <add> <add> Should converge to 28.4 BLEU (uncased). This has not be verified yet." <add> """ <add> self._setup() <add> FLAGS.num_gpus = 8 <add> FLAGS.dtype = 'fp16' <add> FLAGS.data_dir = self.train_data_dir <add> FLAGS.vocab_file = self.vocab_file <add> # Sets values directly to avoid validation check. <add> FLAGS['bleu_source'].value = self.bleu_source <add> FLAGS['bleu_ref'].value = self.bleu_ref <add> FLAGS.param_set = 'big' <add> FLAGS.batch_size = 3072*8 <add> FLAGS.static_batch = True <add> FLAGS.max_length = 64 <add> FLAGS.train_steps = 400000 <add> FLAGS.steps_between_evals = 20000 <add> FLAGS.model_dir = self._get_model_dir('benchmark_8_gpu_static_batch_fp16') <add> self._run_and_report_benchmark(total_batch_size=FLAGS.batch_size, <add> log_steps=FLAGS.log_steps, <add> bleu_min=28, <add> bleu_max=29) <add> <add> def benchmark_xla_8_gpu_static_batch_fp16(self): <add> """Benchmark 8 gpu with static batch, XLA, and FP16. <add> <add> Should converge to 28.4 BLEU (uncased). This has not be verified yet." <add> """ <add> self._setup() <add> FLAGS.num_gpus = 8 <add> FLAGS.dtype = 'fp16' <add> FLAGS.enable_xla = True <add> FLAGS.data_dir = self.train_data_dir <add> FLAGS.vocab_file = self.vocab_file <add> # Sets values directly to avoid validation check. <add> FLAGS['bleu_source'].value = self.bleu_source <add> FLAGS['bleu_ref'].value = self.bleu_ref <add> FLAGS.param_set = 'big' <add> FLAGS.batch_size = 3072*8 <add> FLAGS.static_batch = True <add> FLAGS.max_length = 64 <add> FLAGS.train_steps = 400000 <add> FLAGS.steps_between_evals = 20000 <add> FLAGS.model_dir = self._get_model_dir( <add> 'benchmark_xla_8_gpu_static_batch_fp16') <add> self._run_and_report_benchmark(total_batch_size=FLAGS.batch_size, <add> log_steps=FLAGS.log_steps, <add> bleu_min=28, <add> bleu_max=29) <add> <ide> <ide> class TransformerKerasBenchmark(TransformerBenchmark): <ide> """Benchmarks for Transformer (Base and Big) using Keras."""
1
Python
Python
move _repr_latex tests to test_printing
95c14c271f69333ce3e405ddeae1fa99024d0060
<ide><path>numpy/polynomial/tests/test_classes.py <ide> def test_ufunc_override(Poly): <ide> assert_raises(TypeError, np.add, x, p) <ide> <ide> <del> <del>class TestLatexRepr: <del> """Test the latex repr used by ipython """ <del> <del> def as_latex(self, obj): <del> # right now we ignore the formatting of scalars in our tests, since <del> # it makes them too verbose. Ideally, the formatting of scalars will <del> # be fixed such that tests below continue to pass <del> obj._repr_latex_scalar = lambda x: str(x) <del> try: <del> return obj._repr_latex_() <del> finally: <del> del obj._repr_latex_scalar <del> <del> def test_simple_polynomial(self): <del> # default input <del> p = Polynomial([1, 2, 3]) <del> assert_equal(self.as_latex(p), <del> r'$x \mapsto 1.0 + 2.0\,x + 3.0\,x^{2}$') <del> <del> # translated input <del> p = Polynomial([1, 2, 3], domain=[-2, 0]) <del> assert_equal(self.as_latex(p), <del> r'$x \mapsto 1.0 + 2.0\,\left(1.0 + x\right) + 3.0\,\left(1.0 + x\right)^{2}$') <del> <del> # scaled input <del> p = Polynomial([1, 2, 3], domain=[-0.5, 0.5]) <del> assert_equal(self.as_latex(p), <del> r'$x \mapsto 1.0 + 2.0\,\left(2.0x\right) + 3.0\,\left(2.0x\right)^{2}$') <del> <del> # affine input <del> p = Polynomial([1, 2, 3], domain=[-1, 0]) <del> assert_equal(self.as_latex(p), <del> r'$x \mapsto 1.0 + 2.0\,\left(1.0 + 2.0x\right) + 3.0\,\left(1.0 + 2.0x\right)^{2}$') <del> <del> def test_basis_func(self): <del> p = Chebyshev([1, 2, 3]) <del> assert_equal(self.as_latex(p), <del> r'$x \mapsto 1.0\,{T}_{0}(x) + 2.0\,{T}_{1}(x) + 3.0\,{T}_{2}(x)$') <del> # affine input - check no surplus parens are added <del> p = Chebyshev([1, 2, 3], domain=[-1, 0]) <del> assert_equal(self.as_latex(p), <del> r'$x \mapsto 1.0\,{T}_{0}(1.0 + 2.0x) + 2.0\,{T}_{1}(1.0 + 2.0x) + 3.0\,{T}_{2}(1.0 + 2.0x)$') <del> <del> def test_multichar_basis_func(self): <del> p = HermiteE([1, 2, 3]) <del> assert_equal(self.as_latex(p), <del> r'$x \mapsto 1.0\,{He}_{0}(x) + 2.0\,{He}_{1}(x) + 3.0\,{He}_{2}(x)$') <del> <del> <ide> # <ide> # Test class method that only exists for some classes <ide> # <ide><path>numpy/polynomial/tests/test_printing.py <ide> def test_laguerre_repr(self): <ide> res = repr(poly.Laguerre([0, 1])) <ide> tgt = 'Laguerre([0., 1.], domain=[0, 1], window=[0, 1])' <ide> assert_equal(res, tgt) <add> <add> <add>class TestLatexRepr: <add> """Test the latex repr used by Jupyter""" <add> <add> def as_latex(self, obj): <add> # right now we ignore the formatting of scalars in our tests, since <add> # it makes them too verbose. Ideally, the formatting of scalars will <add> # be fixed such that tests below continue to pass <add> obj._repr_latex_scalar = lambda x: str(x) <add> try: <add> return obj._repr_latex_() <add> finally: <add> del obj._repr_latex_scalar <add> <add> def test_simple_polynomial(self): <add> # default input <add> p = poly.Polynomial([1, 2, 3]) <add> assert_equal(self.as_latex(p), <add> r'$x \mapsto 1.0 + 2.0\,x + 3.0\,x^{2}$') <add> <add> # translated input <add> p = poly.Polynomial([1, 2, 3], domain=[-2, 0]) <add> assert_equal(self.as_latex(p), <add> r'$x \mapsto 1.0 + 2.0\,\left(1.0 + x\right) + 3.0\,\left(1.0 + x\right)^{2}$') <add> <add> # scaled input <add> p = poly.Polynomial([1, 2, 3], domain=[-0.5, 0.5]) <add> assert_equal(self.as_latex(p), <add> r'$x \mapsto 1.0 + 2.0\,\left(2.0x\right) + 3.0\,\left(2.0x\right)^{2}$') <add> <add> # affine input <add> p = poly.Polynomial([1, 2, 3], domain=[-1, 0]) <add> assert_equal(self.as_latex(p), <add> r'$x \mapsto 1.0 + 2.0\,\left(1.0 + 2.0x\right) + 3.0\,\left(1.0 + 2.0x\right)^{2}$') <add> <add> def test_basis_func(self): <add> p = poly.Chebyshev([1, 2, 3]) <add> assert_equal(self.as_latex(p), <add> r'$x \mapsto 1.0\,{T}_{0}(x) + 2.0\,{T}_{1}(x) + 3.0\,{T}_{2}(x)$') <add> # affine input - check no surplus parens are added <add> p = poly.Chebyshev([1, 2, 3], domain=[-1, 0]) <add> assert_equal(self.as_latex(p), <add> r'$x \mapsto 1.0\,{T}_{0}(1.0 + 2.0x) + 2.0\,{T}_{1}(1.0 + 2.0x) + 3.0\,{T}_{2}(1.0 + 2.0x)$') <add> <add> def test_multichar_basis_func(self): <add> p = poly.HermiteE([1, 2, 3]) <add> assert_equal(self.as_latex(p), <add> r'$x \mapsto 1.0\,{He}_{0}(x) + 2.0\,{He}_{1}(x) + 3.0\,{He}_{2}(x)$')
2
Python
Python
handle non-login shell case in stdout utility
e61c0ebc0c54c9e5768cd59752b330c591cc6d7d
<ide><path>official/utils/flags/_conventions.py <ide> def _stdout_utf8(): <ide> codecs.lookup("utf-8") <ide> except LookupError: <ide> return False <del> return sys.stdout.encoding == "UTF-8" <add> return getattr(sys.stdout, 'encoding', '') == "UTF-8" <ide> <ide> <ide> if _stdout_utf8():
1
Java
Java
fix checkstyle violation
734db23f4eb99e4489a9349dd77de78e53f7f33d
<ide><path>spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/NamedParameterJdbcTemplate.java <ide> protected ParsedSql getParsedSql(String sql) { <ide> return NamedParameterUtils.parseSqlStatement(sql); <ide> } <ide> synchronized (this.parsedSqlCache) { <del> return parsedSqlCache.computeIfAbsent(sql, NamedParameterUtils::parseSqlStatement); <add> return this.parsedSqlCache.computeIfAbsent(sql, NamedParameterUtils::parseSqlStatement); <ide> } <ide> } <ide>
1
Python
Python
remove tensorizer from pre-set pipe_names
5f661a1b3a509626ddaba55e95956d1a8968a974
<ide><path>spacy/language.py <ide> def create_tokenizer(cls, nlp=None): <ide> infix_finditer=infix_finditer, <ide> token_match=token_match) <ide> <del> pipe_names = ['tensorizer', 'tagger', 'parser', 'ner'] <add> pipe_names = ['tagger', 'parser', 'ner'] <ide> token_match = TOKEN_MATCH <ide> prefixes = tuple(TOKENIZER_PREFIXES) <ide> suffixes = tuple(TOKENIZER_SUFFIXES)
1
Ruby
Ruby
add force/debug/verbose to cask
03d3f9d292808f7af908726a450629adca78c182
<ide><path>Library/Homebrew/cmd/install.rb <ide> def install <ide> if ARGV.casks.any? <ide> brew_cask = Formulary.factory("brew-cask") <ide> install_formula(brew_cask) unless brew_cask.installed? <add> args = [] <add> args << "--force" if ARGV.force? <add> args << "--debug" if ARGV.debug? <add> args << "--verbose" if ARGV.verbose? <ide> <ide> ARGV.casks.each do |c| <del> cmd = "brew", "cask", "install", c <add> cmd = "brew", "cask", "install", c, *args <ide> ohai cmd.join " " <ide> system(*cmd) <ide> end
1
Go
Go
provide query api for network and endpoint
6a5e4a83e4d055b10256d2f99e9881487073e933
<ide><path>libnetwork/libnetwork_test.go <ide> func TestNetworkEndpointsWalkers(t *testing.T) { <ide> t.Fatal(err) <ide> } <ide> } <add> <add>func TestControllerQuery(t *testing.T) { <add> defer netutils.SetupTestNetNS(t)() <add> controller := libnetwork.New() <add> netType := "bridge" <add> <add> option := options.Generic{} <add> err := controller.ConfigureNetworkDriver(netType, option) <add> if err != nil { <add> t.Fatal(err) <add> } <add> <add> // Create network 1 <add> net1, err := controller.NewNetwork(netType, "network1", "") <add> if err != nil { <add> t.Fatal(err) <add> } <add> <add> g := controller.NetworkByName("") <add> if g != nil { <add> t.Fatalf("NetworkByName() succeeded with invalid target name") <add> } <add> <add> g = controller.NetworkByID("") <add> if g != nil { <add> t.Fatalf("NetworkByID() succeeded with invalid target id: %v", g) <add> } <add> <add> g = controller.NetworkByID("network1") <add> if g != nil { <add> t.Fatalf("NetworkByID() succeeded with invalid target name") <add> } <add> <add> g = controller.NetworkByName("network1") <add> if g == nil { <add> t.Fatalf("NetworkByName() did not find the network") <add> } <add> if g != net1 { <add> t.Fatalf("NetworkByName() returned the wrong network") <add> } <add> <add> g = controller.NetworkByID(net1.ID()) <add> if net1 != g { <add> t.Fatalf("NetworkByID() returned unexpected element: %v", g) <add> } <add>} <add> <add>func TestNetworkQuery(t *testing.T) { <add> defer netutils.SetupTestNetNS(t)() <add> controller := libnetwork.New() <add> netType := "bridge" <add> <add> option := options.Generic{} <add> err := controller.ConfigureNetworkDriver(netType, option) <add> if err != nil { <add> t.Fatal(err) <add> } <add> <add> // Create network 1 and add 2 endpoint: ep11, ep12 <add> net1, err := controller.NewNetwork(netType, "network1", "") <add> if err != nil { <add> t.Fatal(err) <add> } <add> ep11, err := net1.CreateEndpoint("ep11", "sbox1", nil) <add> if err != nil { <add> t.Fatal(err) <add> } <add> ep12, err := net1.CreateEndpoint("ep12", "sbox2", nil) <add> if err != nil { <add> t.Fatal(err) <add> } <add> <add> e := net1.EndpointByName("ep11") <add> if ep11 != e { <add> t.Fatalf("EndpointByName() returned %v instead of %v", e, ep11) <add> } <add> <add> e = net1.EndpointByName("") <add> if e != nil { <add> t.Fatalf("EndpointByName(): expected nil, got %v", e) <add> } <add> <add> e = net1.EndpointByName("IamNotAnEndpoint") <add> if e != nil { <add> t.Fatalf("EndpointByName(): expected nil, got %v", e) <add> } <add> <add> e = net1.EndpointByID(ep12.ID()) <add> if ep12 != e { <add> t.Fatalf("EndpointByID() returned %v instead of %v", e, ep12) <add> } <add> <add> e = net1.EndpointByID("") <add> if e != nil { <add> t.Fatalf("EndpointByID(): expected nil, got %v", e) <add> } <add> <add>} <ide><path>libnetwork/network.go <ide> create network namespaces and allocate interfaces for containers to use. <ide> // This option is only needed for in-tree drivers. Plugins(in future) will get <ide> // their options through plugin infrastructure. <ide> option := options.Generic{} <del> driver, err := controller.NewNetworkDriver("bridge", option) <add> err := controller.NewNetworkDriver("bridge", option) <ide> if err != nil { <ide> return <ide> } <ide> <ide> netOptions := options.Generic{} <ide> // Create a network for containers to join. <del> network, err := controller.NewNetwork(driver, "network1", netOptions) <add> network, err := controller.NewNetwork("bridge", "network1", netOptions) <ide> if err != nil { <ide> return <ide> } <ide> type NetworkController interface { <ide> <ide> // WalkNetworks uses the provided function to walk the Network(s) managed by this controller. <ide> WalkNetworks(walker NetworkWalker) <add> <add> // NetworkByName returns the Network which has the passed name, if it exists otherwise nil is returned <add> NetworkByName(name string) Network <add> <add> // NetworkByID returns the Network which has the passed id, if it exists otherwise nil is returned <add> NetworkByID(id string) Network <ide> } <ide> <ide> // A Network represents a logical connectivity zone that containers may <ide> type Network interface { <ide> // Labels support will be added in the near future. <ide> CreateEndpoint(name string, sboxKey string, options interface{}) (Endpoint, error) <ide> <add> // Delete the network. <add> Delete() error <add> <ide> // Endpoints returns the list of Endpoint(s) in this network. <ide> Endpoints() []Endpoint <ide> <ide> // WalkEndpoints uses the provided function to walk the Endpoints <ide> WalkEndpoints(walker EndpointWalker) <ide> <del> // Delete the network. <del> Delete() error <add> // EndpointByName returns the Endpoint which has the passed name, if it exists otherwise nil is returned <add> EndpointByName(name string) Endpoint <add> <add> // EndpointByID returns the Endpoint which has the passed id, if it exists otherwise nil is returned <add> EndpointByID(id string) Endpoint <ide> } <ide> <ide> // NetworkWalker is a client provided function which will be used to walk the Networks. <ide> func (c *controller) WalkNetworks(walker NetworkWalker) { <ide> } <ide> } <ide> <add>func (c *controller) NetworkByName(name string) Network { <add> var n Network <add> <add> if name != "" { <add> s := func(current Network) bool { <add> if current.Name() == name { <add> n = current <add> return true <add> } <add> return false <add> } <add> <add> c.WalkNetworks(s) <add> } <add> <add> return n <add>} <add> <add>func (c *controller) NetworkByID(id string) Network { <add> c.Lock() <add> defer c.Unlock() <add> if n, ok := c.networks[types.UUID(id)]; ok { <add> return n <add> } <add> return nil <add>} <add> <ide> func (n *network) Name() string { <ide> return n.name <ide> } <ide> func (n *network) WalkEndpoints(walker EndpointWalker) { <ide> } <ide> } <ide> <add>func (n *network) EndpointByName(name string) Endpoint { <add> var e Endpoint <add> <add> if name != "" { <add> s := func(current Endpoint) bool { <add> if current.Name() == name { <add> e = current <add> return true <add> } <add> return false <add> } <add> <add> n.WalkEndpoints(s) <add> } <add> <add> return e <add>} <add> <add>func (n *network) EndpointByID(id string) Endpoint { <add> n.Lock() <add> defer n.Unlock() <add> if e, ok := n.endpoints[types.UUID(id)]; ok { <add> return e <add> } <add> return nil <add>} <add> <ide> func (ep *endpoint) ID() string { <ide> return string(ep.id) <ide> }
2
PHP
PHP
remove unneeded "use" declaration
2fb85eb7d145f06a01b31c6e96f185d32a5e41a3
<ide><path>src/Datasource/SimplePaginator.php <ide> */ <ide> namespace Cake\Datasource; <ide> <del>use Cake\Datasource\Exception\PageOutOfBoundsException; <del> <ide> /** <ide> * Simplified paginator which avoids potentially expensives queries <ide> * to get the total count of records.
1
Javascript
Javascript
update hr.js and tests
dfd513bac58f90c1f0aab1a664e52724d5913f8f
<ide><path>locale/hr.js <ide> } <ide> } <ide> <del> var hr = moment.defineLocale('hr', { <del> months : 'sječanj_veljača_ožujak_travanj_svibanj_lipanj_srpanj_kolovoz_rujan_listopad_studeni_prosinac'.split('_'), <del> monthsShort : 'sje._vel._ožu._tra._svi._lip._srp._kol._ruj._lis._stu._pro.'.split('_'), <add> return moment.defineLocale('hr', { <add> months : 'siječanj_veljača_ožujak_travanj_svibanj_lipanj_srpanj_kolovoz_rujan_listopad_studeni_prosinac'.split('_'), <add> monthsShort : 'sij._velj._ožu._tra._svi._lip._srp._kol._ruj._lis._stu._pro.'.split('_'), <ide> weekdays : 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split('_'), <ide> weekdaysShort : 'ned._pon._uto._sri._čet._pet._sub.'.split('_'), <ide> weekdaysMin : 'ne_po_ut_sr_če_pe_su'.split('_'), <ide><path>src/locale/hr.js <ide> function translate(number, withoutSuffix, key) { <ide> } <ide> <ide> export default moment.defineLocale('hr', { <del> months : 'sječanj_veljača_ožujak_travanj_svibanj_lipanj_srpanj_kolovoz_rujan_listopad_studeni_prosinac'.split('_'), <del> monthsShort : 'sje._vel._ožu._tra._svi._lip._srp._kol._ruj._lis._stu._pro.'.split('_'), <add> months : 'siječanj_veljača_ožujak_travanj_svibanj_lipanj_srpanj_kolovoz_rujan_listopad_studeni_prosinac'.split('_'), <add> monthsShort : 'sij._velj._ožu._tra._svi._lip._srp._kol._ruj._lis._stu._pro.'.split('_'), <ide> weekdays : 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split('_'), <ide> weekdaysShort : 'ned._pon._uto._sri._čet._pet._sub.'.split('_'), <ide> weekdaysMin : 'ne_po_ut_sr_če_pe_su'.split('_'), <ide><path>src/test/locale/hr.js <ide> import {moment} from '../../moment'; <ide> localeModule('hr'); <ide> <ide> test('parse', function (assert) { <del> var tests = 'sječanj sje._veljača vel._ožujak ožu._travanj tra._svibanj svi._lipanj lip._srpanj srp._kolovoz kol._rujan ruj._listopad lis._studeni stu._prosinac pro.'.split('_'), i; <add> var tests = 'siječanj sij._veljača velj._ožujak ožu._travanj tra._svibanj svi._lipanj lip._srpanj srp._kolovoz kol._rujan ruj._listopad lis._studeni stu._prosinac pro.'.split('_'), i; <ide> function equalTest(input, mmm, i) { <ide> assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); <ide> } <ide> test('format', function (assert) { <ide> var a = [ <ide> ['dddd, Do MMMM YYYY, h:mm:ss a', 'nedjelja, 14. veljača 2010, 3:25:50 pm'], <ide> ['ddd, hA', 'ned., 3PM'], <del> ['M Mo MM MMMM MMM', '2 2. 02 veljača vel.'], <add> ['M Mo MM MMMM MMM', '2 2. 02 veljača velj.'], <ide> ['YYYY YY', '2010 10'], <ide> ['D Do DD', '14 14. 14'], <ide> ['d do dddd ddd dd', '0 0. nedjelja ned. ne'], <ide> test('format', function (assert) { <ide> ['LLL', '14. veljača 2010 15:25'], <ide> ['LLLL', 'nedjelja, 14. veljača 2010 15:25'], <ide> ['l', '14. 2. 2010'], <del> ['ll', '14. vel. 2010'], <del> ['lll', '14. vel. 2010 15:25'], <del> ['llll', 'ned., 14. vel. 2010 15:25'] <add> ['ll', '14. velj. 2010'], <add> ['lll', '14. velj. 2010 15:25'], <add> ['llll', 'ned., 14. velj. 2010 15:25'] <ide> ], <ide> b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), <ide> i; <ide> test('format ordinal', function (assert) { <ide> }); <ide> <ide> test('format month', function (assert) { <del> var expected = 'sječanj sje._veljača vel._ožujak ožu._travanj tra._svibanj svi._lipanj lip._srpanj srp._kolovoz kol._rujan ruj._listopad lis._studeni stu._prosinac pro.'.split('_'), i; <add> var expected = 'siječanj sij._veljača velj._ožujak ožu._travanj tra._svibanj svi._lipanj lip._srpanj srp._kolovoz kol._rujan ruj._listopad lis._studeni stu._prosinac pro.'.split('_'), i; <ide> for (i = 0; i < expected.length; i++) { <ide> assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); <ide> }
3
Python
Python
add unitest script for the restful api
b31d824ff368db769199d8a42bdfc963d17a3457
<ide><path>glances/core/glances_main.py <ide> def init_args(self): <ide> help=_('connect to a Glances server by IPv4/IPv6 address or hostname')) <ide> parser.add_argument('-s', '--server', action='store_true', default=False, <ide> dest='server', help=_('run Glances in server mode')) <del> parser.add_argument('-p', '--port', default=self.server_port, type=int, dest='port', <add> parser.add_argument('-p', '--port', default=None, type=int, dest='port', <ide> help=_('define the client/server TCP port [default: {0}]').format(self.server_port)) <ide> parser.add_argument('-B', '--bind', default='0.0.0.0', dest='bind_address', <ide> help=_('bind server to the given IPv4/IPv6 address or hostname')) <ide> def parse_args(self): <ide> from logging import DEBUG <ide> logger.setLevel(DEBUG) <ide> <del> # In web server mode, default: <del> # - refresh time: 5 sec <del> # - host port: 61208 <add> # Client/server Port <add> if args.port is None: <add> if args.webserver: <add> args.port = self.web_server_port <add> else: <add> args.port = self.server_port <add> <add> # In web server mode, defaul refresh time: 5 sec <ide> if args.webserver: <del> args.time = 5 <del> args.port = self.web_server_port <add> args.time = 5 <ide> <ide> # Server or client login/password <ide> args.username = self.username <ide><path>unitest-restful.py <add>#!/usr/bin/env python <add># -*- coding: utf-8 -*- <add># <add># Glances - An eye on your system <add># <add># Copyright (C) 2014 Nicolargo <nicolas@nicolargo.com> <add># <add># Glances is free software; you can redistribute it and/or modify <add># it under the terms of the GNU Lesser General Public License as published by <add># the Free Software Foundation, either version 3 of the License, or <add># (at your option) any later version. <add># <add># Glances is distributed in the hope that it will be useful, <add># but WITHOUT ANY WARRANTY; without even the implied warranty of <add># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the <add># GNU Lesser General Public License for more details. <add># <add># You should have received a copy of the GNU Lesser General Public License <add># along with this program. If not, see <http://www.gnu.org/licenses/>. <add> <add>"""Glances unitary tests suite for the RESTFul API.""" <add> <add>import gettext <add>import locale <add>import sys <add>import time <add>import unittest <add>import shlex <add>import subprocess <add>import requests <add>import json <add>import types <add> <add>from glances.core.glances_globals import ( <add> appname, <add> is_linux, <add> version <add>) <add> <add>SERVER_PORT = 61234 <add>URL = "http://localhost:%s/api/2" % SERVER_PORT <add>pid = None <add> <add># Global variables <add># ================= <add> <add># Unitary test is only available from a GNU/Linus machine <add>if not is_linux: <add> print('ERROR: RESTFul API unitaries tests should be ran on GNU/Linux operating system') <add> sys.exit(2) <add>else: <add> print('Unitary tests for {0} {1}'.format(appname, version)) <add> <add># Import local settings <add>from glances.core.glances_globals import gettext_domain, locale_dir <add>locale.setlocale(locale.LC_ALL, '') <add>gettext.install(gettext_domain, locale_dir) <add> <add># Init Glances core <add>from glances.core.glances_main import GlancesMain <add>core = GlancesMain() <add>if not core.is_standalone(): <add> print('ERROR: Glances core should be ran in standalone mode') <add> sys.exit(1) <add> <add># Init Glances stats <add>from glances.core.glances_stats import GlancesStats <add>stats = GlancesStats() <add> <add> <add># Unitest class <add># ============== <add> <add>class TestGlances(unittest.TestCase): <add> <add> """Test Glances class.""" <add> <add> def setUp(self): <add> """The function is called *every time* before test_*.""" <add> print('\n' + '=' * 78) <add> <add> def test_000_start_server(self): <add> """Start the Glances Web Server""" <add> print('INFO: [TEST_000] Start the Glances Web Server') <add> <add> global pid <add> <add> cmdline = "/usr/bin/python -m glances -w -p %s" % SERVER_PORT <add> print("Run the Glances Web Server on port %s" % SERVER_PORT) <add> args = shlex.split(cmdline) <add> pid = subprocess.Popen(args) <add> print("Please wait...") <add> time.sleep(1) <add> <add> self.assertTrue(pid is not None) <add> <add> def test_001_all(self): <add> """All""" <add> method = "all" <add> print('INFO: [TEST_001] Connection test') <add> <add> print("HTTP RESTFul request: %s/%s" % (URL, method)) <add> req = requests.get("%s/%s" % (URL, method)) <add> <add> self.assertTrue(req.ok) <add> <add> def test_002_pluginslist(self): <add> """Plugins list""" <add> method = "pluginslist" <add> print('INFO: [TEST_002] Plugins list') <add> <add> print("HTTP RESTFul request: %s/%s" % (URL, method)) <add> req = requests.get("%s/%s" % (URL, method)) <add> <add> self.assertTrue(req.ok) <add> self.assertIsInstance(req.json, types.ListType) <add> self.assertIn('cpu', req.json) <add> <add> def test_003_plugins(self): <add> """Plugins""" <add> method = "pluginslist" <add> print('INFO: [TEST_003] Plugins') <add> <add> plist = requests.get("%s/%s" % (URL, method)) <add> <add> for p in plist.json: <add> print("HTTP RESTFul request: %s/%s" % (URL, p)) <add> req = requests.get("%s/%s" % (URL, p)) <add> self.assertTrue(req.ok) <add> if p in ('uptime', 'now'): <add> self.assertIsInstance(req.json, types.UnicodeType) <add> elif p in ('fs', 'monitor', 'percpu', 'sensors', 'alert', 'processlist', 'diskio', 'hddtemp', 'batpercent', 'network'): <add> self.assertIsInstance(req.json, types.ListType) <add> elif p in ('psutilversion', 'help'): <add> pass <add> else: <add> self.assertIsInstance(req.json, types.DictType) <add> <add> def test_004_items(self): <add> """Items""" <add> method = "cpu" <add> print('INFO: [TEST_004] Items for the CPU method') <add> <add> ilist = requests.get("%s/%s" % (URL, method)) <add> <add> for i in ilist.json: <add> print("HTTP RESTFul request: %s/%s/%s" % (URL, method,i)) <add> req = requests.get("%s/%s/%s" % (URL, method, i)) <add> self.assertTrue(req.ok) <add> self.assertIsInstance(req.json, types.DictType) <add> self.assertIsInstance(req.json[i], types.FloatType) <add> <add> def test_005_values(self): <add> """Valuess""" <add> method = "processlist" <add> print('INFO: [TEST_005] Item=Value for the PROCESSLIST method') <add> <add> print("%s/%s/pid/0" % (URL, method)) <add> req = requests.get("%s/%s/pid/0" % (URL, method)) <add> <add> self.assertTrue(req.ok) <add> self.assertIsInstance(req.json, types.DictType) <add> <add> def test_999_stop_server(self): <add> """Stop the Glances Web Server""" <add> print('INFO: [TEST_999] Stop the Glances Web Server') <add> <add> print("Stop the Glances Web Server") <add> pid.terminate() <add> print("Please wait...") <add> time.sleep(1) <add> <add> self.assertTrue(True) <add> <add>if __name__ == '__main__': <add> unittest.main()
2
Text
Text
fix header on xml syntax's paragraph
b8cb54004d632285f180ec8e64de9bfa5f251c75
<ide><path>guide/portuguese/xml/index.md <ide> localeTitle: Extensible Markup Language (XML) <ide> <ide> XML significa eXtensible Markup Language. Ele é extensível, porque não usa um conjunto predefinido de tags para identificar componentes estruturais; em vez disso, fornece um mecanismo para definir esses conjuntos de tags. O principal objetivo da linguagem é compartilhar os dados. Ao contrário do HTML, no XML não há um conjunto predefinido de tags e tags especificam o significado, em vez da apresentação. <ide> <del>\## Sintaxe do XML A sintaxe XML refere-se às regras que determinam como um aplicativo XML pode ser gravado. A sintaxe XML é muito simples e isso torna o XML muito fácil de aprender. Documentos XML devem conter um elemento raiz que seja o pai de todos os outros elementos: <add>## Sintaxe do XML <add> <add>A sintaxe XML refere-se às regras que determinam como um aplicativo XML pode ser gravado. A sintaxe XML é muito simples e isso torna o XML muito fácil de aprender. Documentos XML devem conter um elemento raiz que seja o pai de todos os outros elementos: <ide> ``` <ide> <root> <ide> <child> <ide> E a principal conquista foi que se tornou uma recomendação do W3C já em fever <ide> ### Mais Informações <ide> <ide> * [Introdução XML](https://developer.mozilla.org/en-US/docs/XML_introduction) <del>* [Introdução ao XML](https://www.w3schools.com/xml/xml_whatis.asp) <ide>\ No newline at end of file <add>* [Introdução ao XML](https://www.w3schools.com/xml/xml_whatis.asp)
1
Text
Text
fix wrong history entry in deepstrictequal
a5916107dd6de6d744949feefda90b96af30a210
<ide><path>doc/api/assert.md <ide> changes: <ide> - version: REPLACEME <ide> pr-url: https://github.com/nodejs/node/pull/15036 <ide> description: NaN is now compared using the [SameValueZero][] comparison. <del> - version: REPLACEME <del> pr-url: https://github.com/nodejs/node/pull/15001 <ide> - version: v8.5.0 <ide> pr-url: https://github.com/nodejs/node/pull/15001 <ide> description: Error names and messages are now properly compared
1
PHP
PHP
add response as argument for auth storage classes
84c599a87efc3674cac9020fee11b9164772a599
<ide><path>src/Auth/Storage/SessionStorage.php <ide> <ide> use Cake\Core\InstanceConfigTrait; <ide> use Cake\Network\Request; <add>use Cake\Network\Response; <ide> <ide> /** <ide> * Session based persistent storage for authenticated user record. <ide> class SessionStorage implements StorageInterface <ide> * Constructor. <ide> * <ide> * @param \Cake\Network\Request $request Request instance. <add> * @param \Cake\Netowrk\Response $respose Response instance. <ide> * @param array $config Configuration list. <ide> */ <del> public function __construct(Request $request, array $config = []) <add> public function __construct(Request $request, Response $respose, array $config = []) <ide> { <ide> $this->_session = $request->session(); <ide> $this->config($config); <ide><path>src/Controller/Component/AuthComponent.php <ide> public function storage(StorageInterface $storage = null) <ide> if (!class_exists($className)) { <ide> throw new Exception(sprintf('Auth storage adapter "%s" was not found.', $class)); <ide> } <del> $this->_storage = new $className($this->request, $config); <add> $this->_storage = new $className($this->request, $this->response, $config); <ide> <ide> return $this->_storage; <ide> } <ide><path>tests/TestCase/Auth/Storage/SessionStorageTest.php <ide> <ide> use Cake\Auth\Storage\SessionStorage; <ide> use Cake\Network\Request; <add>use Cake\Network\Response; <ide> use Cake\TestSuite\TestCase; <ide> <ide> /** <ide> public function setUp() <ide> <ide> $this->session = $this->getMock('Cake\Network\Session'); <ide> $this->request = new Request(['session' => $this->session]); <del> $this->storage = new SessionStorage($this->request, ['key' => 'Auth.AuthUser']); <add> $this->response = new Response(); <add> $this->storage = new SessionStorage($this->request, $this->response, ['key' => 'Auth.AuthUser']); <ide> $this->user = ['id' => 1]; <ide> } <ide> <ide><path>tests/TestCase/Controller/Component/AuthComponentTest.php <ide> public function testSetUser() <ide> $storage = $this->getMock( <ide> 'Cake\Auth\Storage\SessionStorage', <ide> ['write'], <del> [$this->Auth->request] <add> [$this->Auth->request, $this->Auth->response] <ide> ); <ide> $this->Auth->storage($storage); <ide>
4
Python
Python
add some missing docstrings for celery.task.base
c6a4a209e57888d9e2a0c55f238efdbc5da0b76c
<ide><path>celery/task/base.py <ide> class Task(object): <ide> limit), ``"100/s"`` (hundred tasks a second), ``"100/m"`` (hundred <ide> tasks a minute), ``"100/h"`` (hundred tasks an hour) <ide> <add> .. attribute:: rate_limit_queue_type <add> <add> Type of queue used by the rate limiter for this kind of tasks. <add> Default is a :class:`Queue.Queue`, but you can change this to <add> a :class:`Queue.LifoQueue` or an invention of your own. <add> <ide> .. attribute:: ignore_result <ide> <ide> Don't store the return value of this task. <ide> class Task(object): <ide> <ide> The result store backend used for this task. <ide> <add> .. attribute:: autoregister <add> If ``True`` the task is automatically registered in the task <add> registry, which is the default behaviour. <add> <add> <ide> The resulting class is callable, which if called will apply the <ide> :meth:`run` method. <ide> <ide> def run(self, *args, **kwargs): <ide> arguments (\*\*kwargs). <ide> <ide> """ <del> raise NotImplementedError("Tasks must define a run method.") <add> raise NotImplementedError("Tasks must define the run method.") <ide> <del> def get_logger(self, **kwargs): <add> def get_logger(self, loglevel=None, logfile=None, **kwargs): <ide> """Get process-aware logger object. <ide> <ide> See :func:`celery.log.setup_logger`. <ide> <ide> """ <del> logfile = kwargs.get("logfile") <del> loglevel = kwargs.get("loglevel") <ide> return setup_logger(loglevel=loglevel, logfile=logfile) <ide> <ide> def establish_connection(self,
1
Text
Text
add line 159 (regarding stricmp) to the article
6656ac26bad0d10531325afc137bf89d6e77f230
<ide><path>guide/english/c/arrays-and-strings/index.md <ide> Notice the `!`, which is needed because this function returns 0 if they are the <ide> if(strcmp(first, second) == 0){ <ide> ``` <ide> <add>We also have `stricmp` and `strcmpi` which compare two strings without case sensitivity. Similar to `strcmp`, `stricmp/strcmpi` will return `0` if the strings are equivalent, a negative value if first string is smaller, and a positive value if first string is greater. <add> <ide> #### Compare 'n' bytes: `strncmp` <ide> `strncmp` compares two strings for 'n' characters. The integer value it returns is 0 if they are the same, but it will also return negative if the value of the first (by adding up characters) is less than the value of the second, and positive if the first is greater than the second. Take a look at an example of how this might be used: <ide> ```C
1
Python
Python
add json option into the request parameter list
ed3649e22498a8ab3b4ff065f5e6ca48c00494b6
<ide><path>libcloud/common/base.py <ide> def user_agent_append(self, token): <ide> self.ua.append(token) <ide> <ide> def request(self, action, params=None, data=None, headers=None, <del> method='GET', raw=False, stream=False): <add> method='GET', raw=False, stream=False, json=None): <ide> """ <ide> Request a given `action`. <ide> <ide> def request(self, action, params=None, data=None, headers=None, <ide> stream=stream) <ide> else: <ide> self.connection.request(method=method, url=url, body=data, <del> headers=headers, stream=stream) <add> headers=headers, stream=stream, json=json) <ide> except socket.gaierror as e: <ide> message = str(e) <ide> errno = getattr(e, 'errno', None) <ide><path>libcloud/http.py <ide> def verification(self): <ide> return self.ca_cert if self.ca_cert is not None else self.verify <ide> <ide> def request(self, method, url, body=None, headers=None, raw=False, <del> stream=False): <add> stream=False, json=None): <ide> url = urlparse.urljoin(self.host, url) <ide> headers = self._normalize_headers(headers=headers) <ide> <ide> def request(self, method, url, body=None, headers=None, raw=False, <ide> headers=headers, <ide> allow_redirects=ALLOW_REDIRECTS, <ide> stream=stream, <del> verify=self.verification <add> verify=self.verification, <add> json=json <ide> ) <ide> <ide> def prepared_request(self, method, url, body=None,
2
Ruby
Ruby
fix typo in thread_mattr_accessor doco [ci skip]
dee03ae028a33935ea09a35bc6599cbad45f425c
<ide><path>activesupport/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb <ide> def #{sym}=(obj) <ide> # class Customer < Account <ide> # end <ide> # <del> # Customer.user = "CHH" <add> # Customer.user = "DHH" <ide> # Account.user # => "DHH" <ide> # <ide> # To opt out of the instance writer method, pass <tt>instance_writer: false</tt>.
1
Text
Text
improve text in fs docs about omitting callbacks
f902170af6e19ab0f2d5cefdf7111580238cbeb7
<ide><path>doc/api/fs.md <ide> In busy processes, use the asynchronous versions of these calls. The synchronous <ide> versions will block the entire process until they complete, halting all <ide> connections. <ide> <del>While it is not recommended, most fs functions allow the callback argument to <del>be omitted, in which case a default callback is used that rethrows errors. To <del>get a trace to the original call site, set the `NODE_DEBUG` environment <del>variable: <del> <del>Omitting the callback function on asynchronous fs functions is deprecated and <del>may result in an error being thrown in the future. <add>Most asynchronous `fs` functions allow the callback argument to be omitted. <add>However, this usage is deprecated. When the callback is omitted, a default <add>callback is used that rethrows errors. To get a trace to the original call site, <add>set the `NODE_DEBUG` environment variable: <ide> <ide> ```console <ide> $ cat script.js
1
PHP
PHP
update docblock on redirect facade
5faa69f3e38f1fdb3437b9a2365b51ad22e9d3a2
<ide><path>src/Illuminate/Support/Facades/Redirect.php <ide> * @method static \Illuminate\Http\RedirectResponse away(string $path, int $status = 302, array $headers = []) <ide> * @method static \Illuminate\Http\RedirectResponse secure(string $path, int $status = 302, array $headers = []) <ide> * @method static \Illuminate\Http\RedirectResponse route(string $route, array $parameters = [], int $status = 302, array $headers = []) <add> * @method static \Illuminate\Http\RedirectResponse signedRoute(string $name, array $parameters = [], \DateTimeInterface|\DateInterval|int $expiration = null, int $status = 302, array $headers = []) <add> * @method static \Illuminate\Http\RedirectResponse temporarySignedRoute(string $name, \DateTimeInterface|\DateInterval|int $expiration, array $parameters = [], int $status = 302, array $headers = []) <ide> * @method static \Illuminate\Http\RedirectResponse action(string $action, array $parameters = [], int $status = 302, array $headers = []) <ide> * @method static \Illuminate\Routing\UrlGenerator getUrlGenerator() <ide> * @method static void setSession(\Illuminate\Session\Store $session)
1
Javascript
Javascript
replace var with let in lib/url.js
87cef760006aa29a6ce372ada26bcbae477c55da
<ide><path>lib/url.js <ide> Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) { <ide> // Copy chrome, IE, opera backslash-handling behavior. <ide> // Back slashes before the query string get converted to forward slashes <ide> // See: https://code.google.com/p/chromium/issues/detail?id=25916 <del> var hasHash = false; <del> var start = -1; <del> var end = -1; <del> var rest = ''; <del> var lastPos = 0; <del> var i = 0; <del> for (var inWs = false, split = false; i < url.length; ++i) { <add> let hasHash = false; <add> let start = -1; <add> let end = -1; <add> let rest = ''; <add> let lastPos = 0; <add> let i = 0; <add> for (let inWs = false, split = false; i < url.length; ++i) { <ide> const code = url.charCodeAt(i); <ide> <ide> // Find first and last non-whitespace characters for trimming <ide> Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) { <ide> // http://a@b@c/ => user:a@b host:c <ide> // http://a@b?@c => user:a host:b path:/?@c <ide> <del> var hostEnd = -1; <del> var atSign = -1; <del> var nonHost = -1; <add> let hostEnd = -1; <add> let atSign = -1; <add> let nonHost = -1; <ide> for (i = 0; i < rest.length; ++i) { <ide> switch (rest.charCodeAt(i)) { <ide> case CHAR_TAB: <ide> Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) { <ide> if (typeof this.hostname !== 'string') <ide> this.hostname = ''; <ide> <del> var hostname = this.hostname; <add> const hostname = this.hostname; <ide> <ide> // If hostname begins with [ and ends with ] <ide> // assume that it's an IPv6 address. <del> var ipv6Hostname = hostname.charCodeAt(0) === CHAR_LEFT_SQUARE_BRACKET && <add> const ipv6Hostname = hostname.charCodeAt(0) === CHAR_LEFT_SQUARE_BRACKET && <ide> hostname.charCodeAt(hostname.length - 1) === CHAR_RIGHT_SQUARE_BRACKET; <ide> <ide> // validate a little. <ide> Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) { <ide> this.hostname = toASCII(this.hostname, true); <ide> } <ide> <del> var p = this.port ? ':' + this.port : ''; <del> var h = this.hostname || ''; <add> const p = this.port ? ':' + this.port : ''; <add> const h = this.hostname || ''; <ide> this.host = h + p; <ide> <ide> // strip [ and ] from the hostname <ide> Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) { <ide> rest = autoEscapeStr(rest); <ide> } <ide> <del> var questionIdx = -1; <del> var hashIdx = -1; <add> let questionIdx = -1; <add> let hashIdx = -1; <ide> for (i = 0; i < rest.length; ++i) { <ide> const code = rest.charCodeAt(i); <ide> if (code === CHAR_HASH) { <ide> Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) { <ide> }; <ide> <ide> function getHostname(self, rest, hostname) { <del> for (var i = 0; i < hostname.length; ++i) { <add> for (let i = 0; i < hostname.length; ++i) { <ide> const code = hostname.charCodeAt(i); <ide> const isValid = (code >= CHAR_LOWERCASE_A && code <= CHAR_LOWERCASE_Z) || <ide> code === CHAR_DOT || <ide> const escapedCodes = [ <ide> // Also escape single quotes in case of an XSS attack. <ide> // Return the escaped string. <ide> function autoEscapeStr(rest) { <del> var escaped = ''; <del> var lastEscapedPos = 0; <del> for (var i = 0; i < rest.length; ++i) { <add> let escaped = ''; <add> let lastEscapedPos = 0; <add> for (let i = 0; i < rest.length; ++i) { <ide> // `escaped` contains substring up to the last escaped character. <del> var escapedChar = escapedCodes[rest.charCodeAt(i)]; <add> const escapedChar = escapedCodes[rest.charCodeAt(i)]; <ide> if (escapedChar) { <ide> // Concat if there are ordinary characters in the middle. <ide> if (i > lastEscapedPos) <ide> function urlFormat(urlObject, options) { <ide> throw new ERR_INVALID_ARG_TYPE('urlObject', <ide> ['Object', 'string'], urlObject); <ide> } else if (!(urlObject instanceof Url)) { <del> var format = urlObject[formatSymbol]; <add> const format = urlObject[formatSymbol]; <ide> return format ? <ide> format.call(urlObject, options) : <ide> Url.prototype.format.call(urlObject); <ide> const noEscapeAuth = [ <ide> ]; <ide> <ide> Url.prototype.format = function format() { <del> var auth = this.auth || ''; <add> let auth = this.auth || ''; <ide> if (auth) { <ide> auth = encodeStr(auth, noEscapeAuth, hexTable); <ide> auth += '@'; <ide> } <ide> <del> var protocol = this.protocol || ''; <del> var pathname = this.pathname || ''; <del> var hash = this.hash || ''; <del> var host = ''; <del> var query = ''; <add> let protocol = this.protocol || ''; <add> let pathname = this.pathname || ''; <add> let hash = this.hash || ''; <add> let host = ''; <add> let query = ''; <ide> <ide> if (this.host) { <ide> host = auth + this.host; <ide> Url.prototype.format = function format() { <ide> query = querystring.stringify(this.query); <ide> } <ide> <del> var search = this.search || (query && ('?' + query)) || ''; <add> let search = this.search || (query && ('?' + query)) || ''; <ide> <ide> if (protocol && protocol.charCodeAt(protocol.length - 1) !== 58/* : */) <ide> protocol += ':'; <ide> <del> var newPathname = ''; <del> var lastPos = 0; <del> for (var i = 0; i < pathname.length; ++i) { <add> let newPathname = ''; <add> let lastPos = 0; <add> for (let i = 0; i < pathname.length; ++i) { <ide> switch (pathname.charCodeAt(i)) { <ide> case CHAR_HASH: <ide> if (i - lastPos > 0) <ide> function urlResolveObject(source, relative) { <ide> <ide> Url.prototype.resolveObject = function resolveObject(relative) { <ide> if (typeof relative === 'string') { <del> var rel = new Url(); <add> const rel = new Url(); <ide> rel.parse(relative, false, true); <ide> relative = rel; <ide> } <ide> <ide> const result = new Url(); <ide> const tkeys = Object.keys(this); <del> for (var tk = 0; tk < tkeys.length; tk++) { <del> var tkey = tkeys[tk]; <add> for (let tk = 0; tk < tkeys.length; tk++) { <add> const tkey = tkeys[tk]; <ide> result[tkey] = this[tkey]; <ide> } <ide> <ide> Url.prototype.resolveObject = function resolveObject(relative) { <ide> // Hrefs like //foo/bar always cut to the protocol. <ide> if (relative.slashes && !relative.protocol) { <ide> // Take everything except the protocol from relative <del> var rkeys = Object.keys(relative); <del> for (var rk = 0; rk < rkeys.length; rk++) { <del> var rkey = rkeys[rk]; <add> const rkeys = Object.keys(relative); <add> for (let rk = 0; rk < rkeys.length; rk++) { <add> const rkey = rkeys[rk]; <ide> if (rkey !== 'protocol') <ide> result[rkey] = relative[rkey]; <ide> } <ide> Url.prototype.resolveObject = function resolveObject(relative) { <ide> // because that's known to be hostless. <ide> // anything else is assumed to be absolute. <ide> if (!slashedProtocol.has(relative.protocol)) { <del> var keys = Object.keys(relative); <del> for (var v = 0; v < keys.length; v++) { <del> var k = keys[v]; <add> const keys = Object.keys(relative); <add> for (let v = 0; v < keys.length; v++) { <add> const k = keys[v]; <ide> result[k] = relative[k]; <ide> } <ide> result.href = result.format(); <ide> Url.prototype.resolveObject = function resolveObject(relative) { <ide> result.port = relative.port; <ide> // To support http.request <ide> if (result.pathname || result.search) { <del> var p = result.pathname || ''; <del> var s = result.search || ''; <add> const p = result.pathname || ''; <add> const s = result.search || ''; <ide> result.path = p + s; <ide> } <ide> result.slashes = result.slashes || relative.slashes; <ide> Url.prototype.resolveObject = function resolveObject(relative) { <ide> const isRelAbs = ( <ide> relative.host || (relative.pathname && relative.pathname.charAt(0) === '/') <ide> ); <del> var mustEndAbs = (isRelAbs || isSourceAbs || <add> let mustEndAbs = (isRelAbs || isSourceAbs || <ide> (result.host && relative.pathname)); <ide> const removeAllDots = mustEndAbs; <del> var srcPath = (result.pathname && result.pathname.split('/')) || []; <add> let srcPath = (result.pathname && result.pathname.split('/')) || []; <ide> const relPath = (relative.pathname && relative.pathname.split('/')) || []; <ide> const noLeadingSlashes = result.protocol && <ide> !slashedProtocol.has(result.protocol); <ide> Url.prototype.resolveObject = function resolveObject(relative) { <ide> // If a url ENDs in . or .., then it must get a trailing slash. <ide> // however, if it ends in anything else non-slashy, <ide> // then it must NOT get a trailing slash. <del> var last = srcPath.slice(-1)[0]; <add> let last = srcPath.slice(-1)[0]; <ide> const hasTrailingSlash = ( <ide> ((result.host || relative.host || srcPath.length > 1) && <ide> (last === '.' || last === '..')) || last === ''); <ide> <ide> // Strip single dots, resolve double dots to parent dir <ide> // if the path tries to go above the root, `up` ends up > 0 <del> var up = 0; <del> for (var i = srcPath.length - 1; i >= 0; i--) { <add> let up = 0; <add> for (let i = srcPath.length - 1; i >= 0; i--) { <ide> last = srcPath[i]; <ide> if (last === '.') { <ide> spliceOne(srcPath, i); <ide> Url.prototype.resolveObject = function resolveObject(relative) { <ide> }; <ide> <ide> Url.prototype.parseHost = function parseHost() { <del> var host = this.host; <del> var port = portPattern.exec(host); <add> let host = this.host; <add> let port = portPattern.exec(host); <ide> if (port) { <ide> port = port[0]; <ide> if (port !== ':') {
1
Python
Python
trigger both code paths
6d4715e5358bc639faa8ddff9be19ff05823a0c3
<ide><path>numpy/core/tests/test_shape_base.py <ide> array, arange, atleast_1d, atleast_2d, atleast_3d, block, vstack, hstack, <ide> newaxis, concatenate, stack <ide> ) <add> <add>from numpy.core.shape_base import (_block_setup, <add> _block_concatenate, _block_slicing) <ide> from numpy.testing import ( <ide> assert_, assert_raises, assert_array_equal, assert_equal, <ide> assert_raises_regex, assert_almost_equal <ide> def test_stack(): <ide> stack, [np.arange(2), np.arange(3)]) <ide> <ide> <add># See for more information on how to parametrize a whole class <add># https://docs.pytest.org/en/latest/example/parametrize.html#parametrizing-test-methods-through-per-class-configuration <add>def pytest_generate_tests(metafunc): <add> # called once per each test function <add> if hasattr(metafunc.cls, 'params'): <add> arglist = metafunc.cls.params <add> argnames = sorted(arglist[0]) <add> metafunc.parametrize(argnames, <add> [[funcargs[name] for name in argnames] <add> for funcargs in arglist]) <add> <add> <add># blocking small arrays and large arrays go through different paths. <add># the algorithm is triggered depending on the number of element <add># copies required. <add># We define a test fixture that forces most tests to go through <add># both code paths. <add># Ultimately, this should be removed if a single algorithm is found <add># to be faster for both small and large arrays.s <add>def _block_force_concatenate(arrays): <add> arrays, list_ndim, result_ndim, _ = _block_setup(arrays) <add> return _block_concatenate(arrays, list_ndim, result_ndim) <add> <add> <add>def _block_force_slicing(arrays): <add> arrays, list_ndim, result_ndim, _ = _block_setup(arrays) <add> return _block_slicing(arrays, list_ndim, result_ndim) <add> <add> <ide> class TestBlock(object): <del> def test_returns_copy(self): <add> params = [dict(block=block), <add> dict(block=_block_force_concatenate), <add> dict(block=_block_force_slicing)] <add> <add> def test_returns_copy(self, block): <ide> a = np.eye(3) <del> b = np.block(a) <add> b = block(a) <ide> b[0, 0] = 2 <ide> assert b[0, 0] != a[0, 0] <ide> <del> def test_block_simple_row_wise(self): <add> def test_block_total_size_estimate(self, block): <add> _, _, _, total_size = _block_setup([1]) <add> assert total_size == 1 <add> <add> _, _, _, total_size = _block_setup([[1]]) <add> assert total_size == 1 <add> <add> _, _, _, total_size = _block_setup([[1, 1]]) <add> assert total_size == 2 <add> <add> _, _, _, total_size = _block_setup([[1], [1]]) <add> assert total_size == 2 <add> <add> _, _, _, total_size = _block_setup([[1, 2], [3, 4]]) <add> assert total_size == 4 <add> <add> def test_block_simple_row_wise(self, block): <ide> a_2d = np.ones((2, 2)) <ide> b_2d = 2 * a_2d <ide> desired = np.array([[1, 1, 2, 2], <ide> [1, 1, 2, 2]]) <ide> result = block([a_2d, b_2d]) <ide> assert_equal(desired, result) <ide> <del> def test_block_simple_column_wise(self): <add> def test_block_simple_column_wise(self, block): <ide> a_2d = np.ones((2, 2)) <ide> b_2d = 2 * a_2d <ide> expected = np.array([[1, 1], <ide> def test_block_simple_column_wise(self): <ide> result = block([[a_2d], [b_2d]]) <ide> assert_equal(expected, result) <ide> <del> def test_block_with_1d_arrays_row_wise(self): <add> def test_block_with_1d_arrays_row_wise(self, block): <ide> # # # 1-D vectors are treated as row arrays <ide> a = np.array([1, 2, 3]) <ide> b = np.array([2, 3, 4]) <ide> expected = np.array([1, 2, 3, 2, 3, 4]) <ide> result = block([a, b]) <ide> assert_equal(expected, result) <ide> <del> def test_block_with_1d_arrays_multiple_rows(self): <add> def test_block_with_1d_arrays_multiple_rows(self, block): <ide> a = np.array([1, 2, 3]) <ide> b = np.array([2, 3, 4]) <ide> expected = np.array([[1, 2, 3, 2, 3, 4], <ide> [1, 2, 3, 2, 3, 4]]) <ide> result = block([[a, b], [a, b]]) <ide> assert_equal(expected, result) <ide> <del> def test_block_with_1d_arrays_column_wise(self): <add> def test_block_with_1d_arrays_column_wise(self, block): <ide> # # # 1-D vectors are treated as row arrays <ide> a_1d = np.array([1, 2, 3]) <ide> b_1d = np.array([2, 3, 4]) <ide> def test_block_with_1d_arrays_column_wise(self): <ide> result = block([[a_1d], [b_1d]]) <ide> assert_equal(expected, result) <ide> <del> def test_block_mixed_1d_and_2d(self): <add> def test_block_mixed_1d_and_2d(self, block): <ide> a_2d = np.ones((2, 2)) <ide> b_1d = np.array([2, 2]) <ide> result = block([[a_2d], [b_1d]]) <ide> def test_block_mixed_1d_and_2d(self): <ide> [2, 2]]) <ide> assert_equal(expected, result) <ide> <del> def test_block_complicated(self): <add> def test_block_complicated(self, block): <ide> # a bit more complicated <ide> one_2d = np.array([[1, 1, 1]]) <ide> two_2d = np.array([[2, 2, 2]]) <ide> def test_block_complicated(self): <ide> [zero_2d]]) <ide> assert_equal(result, expected) <ide> <del> def test_nested(self): <add> def test_nested(self, block): <ide> one = np.array([1, 1, 1]) <ide> two = np.array([[2, 2, 2], [2, 2, 2], [2, 2, 2]]) <ide> three = np.array([3, 3, 3]) <ide> def test_nested(self): <ide> six = np.array([6, 6, 6, 6, 6]) <ide> zero = np.zeros((2, 6)) <ide> <del> result = np.block([ <add> result = block([ <ide> [ <del> np.block([ <add> block([ <ide> [one], <ide> [three], <ide> [four] <ide> def test_nested(self): <ide> <ide> assert_equal(result, expected) <ide> <del> def test_3d(self): <add> def test_3d(self, block): <ide> a000 = np.ones((2, 2, 2), int) * 1 <ide> <ide> a100 = np.ones((3, 2, 2), int) * 2 <ide> def test_3d(self): <ide> <ide> a111 = np.ones((3, 3, 3), int) * 8 <ide> <del> result = np.block([ <add> result = block([ <ide> [ <ide> [a000, a001], <ide> [a010, a011], <ide> def test_3d(self): <ide> <ide> assert_array_equal(result, expected) <ide> <del> def test_block_with_mismatched_shape(self): <add> def test_block_with_mismatched_shape(self, block): <ide> a = np.array([0, 0]) <ide> b = np.eye(2) <del> assert_raises(ValueError, np.block, [a, b]) <del> assert_raises(ValueError, np.block, [b, a]) <add> assert_raises(ValueError, block, [a, b]) <add> assert_raises(ValueError, block, [b, a]) <ide> <del> def test_no_lists(self): <del> assert_equal(np.block(1), np.array(1)) <del> assert_equal(np.block(np.eye(3)), np.eye(3)) <add> def test_no_lists(self, block): <add> assert_equal(block(1), np.array(1)) <add> assert_equal(block(np.eye(3)), np.eye(3)) <ide> <del> def test_invalid_nesting(self): <add> def test_invalid_nesting(self, block): <ide> msg = 'depths are mismatched' <del> assert_raises_regex(ValueError, msg, np.block, [1, [2]]) <del> assert_raises_regex(ValueError, msg, np.block, [1, []]) <del> assert_raises_regex(ValueError, msg, np.block, [[1], 2]) <del> assert_raises_regex(ValueError, msg, np.block, [[], 2]) <del> assert_raises_regex(ValueError, msg, np.block, [ <add> assert_raises_regex(ValueError, msg, block, [1, [2]]) <add> assert_raises_regex(ValueError, msg, block, [1, []]) <add> assert_raises_regex(ValueError, msg, block, [[1], 2]) <add> assert_raises_regex(ValueError, msg, block, [[], 2]) <add> assert_raises_regex(ValueError, msg, block, [ <ide> [[1], [2]], <ide> [[3, 4]], <ide> [5] # missing brackets <ide> ]) <ide> <del> def test_empty_lists(self): <del> assert_raises_regex(ValueError, 'empty', np.block, []) <del> assert_raises_regex(ValueError, 'empty', np.block, [[]]) <del> assert_raises_regex(ValueError, 'empty', np.block, [[1], []]) <add> def test_empty_lists(self, block): <add> assert_raises_regex(ValueError, 'empty', block, []) <add> assert_raises_regex(ValueError, 'empty', block, [[]]) <add> assert_raises_regex(ValueError, 'empty', block, [[1], []]) <ide> <del> def test_tuple(self): <del> assert_raises_regex(TypeError, 'tuple', np.block, ([1, 2], [3, 4])) <del> assert_raises_regex(TypeError, 'tuple', np.block, [(1, 2), (3, 4)]) <add> def test_tuple(self, block): <add> assert_raises_regex(TypeError, 'tuple', block, ([1, 2], [3, 4])) <add> assert_raises_regex(TypeError, 'tuple', block, [(1, 2), (3, 4)]) <ide> <del> def test_different_ndims(self): <add> def test_different_ndims(self, block): <ide> a = 1. <ide> b = 2 * np.ones((1, 2)) <ide> c = 3 * np.ones((1, 1, 3)) <ide> <del> result = np.block([a, b, c]) <add> result = block([a, b, c]) <ide> expected = np.array([[[1., 2., 2., 3., 3., 3.]]]) <ide> <ide> assert_equal(result, expected) <ide> <del> def test_different_ndims_depths(self): <add> def test_different_ndims_depths(self, block): <ide> a = 1. <ide> b = 2 * np.ones((1, 2)) <ide> c = 3 * np.ones((1, 2, 3)) <ide> <del> result = np.block([[a, b], [c]]) <add> result = block([[a, b], [c]]) <ide> expected = np.array([[[1., 2., 2.], <ide> [3., 3., 3.], <ide> [3., 3., 3.]]])
1
Javascript
Javascript
delete node_channel_fd from env
bd907174e8082afd6dd8553940aac09cae3dcfb7
<ide><path>src/node.js <ide> // start parsing data from that stream. <ide> if (process.env.NODE_CHANNEL_FD) { <ide> assert(parseInt(process.env.NODE_CHANNEL_FD) >= 0); <add> <add> // Make sure it's not accidentally inherited by child processes. <add> delete process.env.NODE_CHANNEL_FD; <add> <ide> var cp = NativeModule.require('child_process'); <ide> <ide> // Load tcp_wrap to avoid situation where we might immediately receive <ide><path>test/simple/test-child-process-fork-and-spawn.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <add>var common = require('../common'); <add>var assert = require('assert'); <add>var spawn = require('child_process').spawn; <add>var fork = require('child_process').fork; <add> <add>// Fork, then spawn. The spawned process should not hang. <add>switch (process.argv[2] || '') { <add>case '': <add> fork(__filename, ['fork']).on('exit', checkExit); <add> process.on('exit', haveExit); <add> break; <add>case 'fork': <add> spawn(process.execPath, [__filename, 'spawn']).on('exit', checkExit); <add> process.on('exit', haveExit); <add> break; <add>case 'spawn': <add> break; <add>default: <add> assert(0); <add>} <add> <add>var seenExit = false; <add> <add>function checkExit(statusCode) { <add> seenExit = true; <add> assert.equal(statusCode, 0); <add> process.nextTick(process.exit); <add>} <add> <add>function haveExit() { <add> assert.equal(seenExit, true); <add>}
2
Javascript
Javascript
remove unnecessary bool conversion
bcde849be9f4a4593d99d77cbc1d87ba9fdc27ba
<ide><path>lib/internal/quic/core.js <ide> function onSocketClose(err) { <ide> // Called by the C++ internals when the server busy state of <ide> // the QuicSocket has been changed. <ide> function onSocketServerBusy(on) { <del> this[owner_symbol][kServerBusy](!!on); <add> this[owner_symbol][kServerBusy](on); <ide> } <ide> <ide> // Called by the C++ internals when a new server QuicSession has been created.
1
Python
Python
add some basic metrics to the triggerer
fe6a769399e19c17731aa1fc4f1dc6b796d85bd9
<ide><path>airflow/jobs/triggerer_job.py <ide> from airflow.configuration import conf <ide> from airflow.jobs.base_job import BaseJob <ide> from airflow.models.trigger import Trigger <add>from airflow.stats import Stats <ide> from airflow.triggers.base import BaseTrigger, TriggerEvent <ide> from airflow.typing_compat import TypedDict <ide> from airflow.utils.log.logging_mixin import LoggingMixin <ide> def _run_trigger_loop(self) -> None: <ide> self.handle_failed_triggers() <ide> # Handle heartbeat <ide> self.heartbeat(only_if_necessary=True) <add> # Collect stats <add> self.emit_metrics() <ide> # Idle sleep <ide> time.sleep(1) <ide> <ide> def handle_events(self): <ide> trigger_id, event = self.runner.events.popleft() <ide> # Tell the model to wake up its tasks <ide> Trigger.submit_event(trigger_id=trigger_id, event=event) <add> # Emit stat event <add> Stats.incr('triggers.succeeded') <ide> <ide> def handle_failed_triggers(self): <ide> """ <ide> def handle_failed_triggers(self): <ide> # Tell the model to fail this trigger's deps <ide> trigger_id = self.runner.failed_triggers.popleft() <ide> Trigger.submit_failure(trigger_id=trigger_id) <add> # Emit stat event <add> Stats.incr('triggers.failed') <add> <add> def emit_metrics(self): <add> Stats.gauge('triggers.running', len(self.runner.triggers)) <ide> <ide> <ide> class TriggerDetails(TypedDict): <ide> async def block_watchdog(self): <ide> "to get more information on overrunning coroutines.", <ide> time_elapsed, <ide> ) <add> Stats.incr('triggers.blocked_main_thread') <ide> <ide> # Async trigger logic <ide>
1
Javascript
Javascript
use readable.push() instead of private methods
840401c024a31e35515e76155693131f6de0ea86
<ide><path>lib/net.js <ide> function onread(buffer, offset, length) { <ide> self.bytesRead += length; <ide> <ide> // Optimization: emit the original buffer with end points <add> var ret = true; <ide> if (self.ondata) self.ondata(buffer, offset, end); <del> else self._readableState.onread(null, buffer.slice(offset, end)); <add> else ret = self.push(buffer.slice(offset, end)); <ide> <del> if (handle.reading && !self._readableState.reading) { <add> if (handle.reading && !ret) { <ide> handle.reading = false; <ide> debug('readStop'); <ide> var r = handle.readStop(); <ide> function onread(buffer, offset, length) { <ide> if (self.onend) self.once('end', self.onend); <ide> <ide> // send a null to the _read cb to signal the end of data. <del> self._readableState.onread(null, null); <add> self.push(null); <ide> <ide> // internal end event so that we know that the actual socket <ide> // is no longer readable, and we can start the shutdown
1
Go
Go
fix nits and defers
d55e977cf5963f8ae5efdfbee458727f704be398
<ide><path>docker/daemon.go <ide> func init() { <ide> registryCfg.InstallFlags() <ide> } <ide> <del>func migrateKey() error { <add>func migrateKey() (err error) { <ide> // Migrate trust key if exists at ~/.docker/key.json and owned by current user <ide> oldPath := filepath.Join(getHomeDir(), ".docker", defaultTrustKeyFile) <ide> newPath := filepath.Join(getDaemonConfDir(), defaultTrustKeyFile) <del> if _, err := os.Stat(newPath); os.IsNotExist(err) && utils.IsFileOwner(oldPath) { <add> if _, statErr := os.Stat(newPath); os.IsNotExist(statErr) && utils.IsFileOwner(oldPath) { <add> defer func() { <add> // Ensure old path is removed if no error occurred <add> if err == nil { <add> err = os.Remove(oldPath) <add> } else { <add> log.Warnf("Key migration failed, key file not removed at %s", oldPath) <add> } <add> }() <add> <ide> if err := os.MkdirAll(getDaemonConfDir(), os.FileMode(0644)); err != nil { <del> return fmt.Errorf("Unable to create daemon configuraiton directory: %s", err) <add> return fmt.Errorf("Unable to create daemon configuration directory: %s", err) <ide> } <ide> <ide> newFile, err := os.OpenFile(newPath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600) <ide> func migrateKey() error { <ide> <ide> oldFile, err := os.Open(oldPath) <ide> if err != nil { <del> return fmt.Errorf("error opening open key file %q: %s", oldPath, err) <add> return fmt.Errorf("error opening key file %q: %s", oldPath, err) <ide> } <add> defer oldFile.Close() <ide> <ide> if _, err := io.Copy(newFile, oldFile); err != nil { <ide> return fmt.Errorf("error copying key: %s", err) <ide> } <ide> <del> oldFile.Close() <del> log.Debugf("Migrated key from %s to %s", oldPath, newPath) <del> return os.Remove(oldPath) <add> log.Infof("Migrated key from %s to %s", oldPath, newPath) <ide> } <ide> <ide> return nil
1
Text
Text
expand the editable regions
fc22061a9e74085c9edfd949773a5bd85ef7a63d
<ide><path>curriculum/challenges/english/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dfb6250eacea3f48c6300b2.md <ide> After the unordered list, add a new image with an `src` attribute value set to ` <ide> <ide> # --hints-- <ide> <del>There should be an `img` element right above the second `section` element's closing tag. <add>There should be an `img` element right after the closing `</ul>` tag. <ide> <ide> ```js <ide> assert($('section')[1].lastElementChild.nodeName === 'IMG'); <ide><path>curriculum/challenges/english/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dfb6a35eacea3f48c6300b4.md <ide> assert( <ide> <li>laser pointers</li> <ide> <li>lasagna</li> <ide> </ul> <del> <figure> <ide> --fcc-editable-region-- <add> <figure> <ide> <img src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/lasagna.jpg" alt="A slice of lasagna on a plate."> <del>--fcc-editable-region-- <ide> </figure> <add>--fcc-editable-region-- <ide> </section> <ide> </main> <ide> </body> <ide><path>curriculum/challenges/english/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5f0d48e7b435f13ab6550051.md <ide> assert(extraSpacesRemoved.match(/Is your cat an indoor or outdoor cat\??$/i)); <ide> <section> <ide> <h2>Cat Form</h2> <ide> <form action="https://freecatphotoapp.com/submit-cat-photo"> <del> <fieldset> <ide> --fcc-editable-region-- <add> <fieldset> <ide> <label><input id="indoor" type="radio" name="indoor-outdoor" value="indoor"> Indoor</label> <ide> <label><input id="outdoor" type="radio" name="indoor-outdoor" value="outdoor"> Outdoor</label> <del>--fcc-editable-region-- <ide> </fieldset> <add>--fcc-editable-region-- <ide> <input type="text" name="catphotourl" placeholder="cat photo URL" required> <ide> <button type="submit">Submit</button> <ide> </form>
3
Mixed
Ruby
add a warning for enum elements with 'not_' prefix
77daacf94d7d26c713d4412b68edb64260fc22d9
<ide><path>activerecord/CHANGELOG.md <add>* Add a warning for enum elements with 'not_' prefix. <add> <add> class Foo <add> enum status: [:sent, :not_sent] <add> end <add> <add> *Edu Depetris* <add> <ide> * Loading the schema for a model that has no `table_name` raises a `TableNotSpecified` error. <ide> <ide> *Guilherme Mansur*, *Eugene Kenny* <ide><path>activerecord/lib/active_record/enum.rb <ide> def enum(definitions) <ide> # scope :active, -> { where(status: 0) } <ide> # scope :not_active, -> { where.not(status: 0) } <ide> if enum_scopes != false <add> klass.send(:detect_negative_condition!, value_method_name) <add> <ide> klass.send(:detect_enum_conflict!, name, value_method_name, true) <ide> klass.scope value_method_name, -> { where(attr => value) } <ide> <ide> def raise_conflict_error(enum_name, method_name, type: "instance", source: "Acti <ide> source: source <ide> } <ide> end <add> <add> def detect_negative_condition!(method_name) <add> if method_name.start_with?("not_") && logger <add> logger.warn "An enum element in #{self.name} uses the prefix 'not_'." \ <add> " This will cause a conflict with auto generated negative scopes." <add> end <add> end <ide> end <ide> end <ide><path>activerecord/test/cases/enum_test.rb <ide> require "cases/helper" <ide> require "models/author" <ide> require "models/book" <add>require "active_support/log_subscriber/test_helper" <ide> <ide> class EnumTest < ActiveRecord::TestCase <ide> fixtures :books, :authors, :author_addresses <ide> def self.name; "Book"; end <ide> <ide> assert_raises(NoMethodError) { klass.proposed } <ide> end <add> <add> test "enums with a negative condition log a warning" do <add> old_logger = ActiveRecord::Base.logger <add> logger = ActiveSupport::LogSubscriber::TestHelper::MockLogger.new <add> <add> ActiveRecord::Base.logger = logger <add> <add> expected_message = "An enum element in Book uses the prefix 'not_'."\ <add> " This will cause a conflict with auto generated negative scopes." <add> <add> Class.new(ActiveRecord::Base) do <add> def self.name <add> "Book" <add> end <add> enum status: [:sent, :not_sent] <add> end <add> <add> assert_match(expected_message, logger.logged(:warn).first) <add> ensure <add> ActiveRecord::Base.logger = old_logger <add> end <ide> end
3
Javascript
Javascript
use triple equals
006d42786e3123efb619210fb819b04f2b8b286f
<ide><path>lib/_http_client.js <ide> function parserOnIncomingClient(res, shouldKeepAlive) { <ide> // but *can* have a content-length which actually corresponds <ide> // to the content-length of the entity-body had the request <ide> // been a GET. <del> var isHeadResponse = req.method == 'HEAD'; <add> var isHeadResponse = req.method === 'HEAD'; <ide> debug('AGENT isHeadResponse', isHeadResponse); <ide> <del> if (res.statusCode == 100) { <add> if (res.statusCode === 100) { <ide> // restart the parser, as this is a continue message. <ide> delete req.res; // Clear res so that we don't hit double-responses. <ide> req.emit('continue'); <ide><path>lib/_http_outgoing.js <ide> OutgoingMessage.prototype._storeHeader = function(firstLine, headers) { <ide> } <ide> <ide> // Date header <del> if (this.sendDate == true && state.sentDateHeader == false) { <add> if (this.sendDate === true && state.sentDateHeader === false) { <ide> state.messageHeader += 'Date: ' + utcDate() + CRLF; <ide> } <ide> <ide> OutgoingMessage.prototype._storeHeader = function(firstLine, headers) { <ide> // of creating security liabilities, so suppress the zero chunk and force <ide> // the connection to close. <ide> var statusCode = this.statusCode; <del> if ((statusCode == 204 || statusCode === 304) && <add> if ((statusCode === 204 || statusCode === 304) && <ide> this.chunkedEncoding === true) { <ide> debug(statusCode + ' response should not use chunked encoding,' + <ide> ' closing connection.'); <ide> OutgoingMessage.prototype._storeHeader = function(firstLine, headers) { <ide> } <ide> } <ide> <del> if (state.sentContentLengthHeader == false && <del> state.sentTransferEncodingHeader == false) { <add> if (state.sentContentLengthHeader === false && <add> state.sentTransferEncodingHeader === false) { <ide> if (this._hasBody && !this._removedHeader['transfer-encoding']) { <ide> if (this.useChunkedEncodingByDefault) { <ide> state.messageHeader += 'Transfer-Encoding: chunked\r\n'; <ide><path>lib/_http_server.js <ide> ServerResponse.prototype.assignSocket = function(socket) { <ide> }; <ide> <ide> ServerResponse.prototype.detachSocket = function(socket) { <del> assert(socket._httpMessage == this); <add> assert(socket._httpMessage === this); <ide> socket.removeListener('close', onServerResponseClose); <ide> socket._httpMessage = null; <ide> this.socket = this.connection = null; <ide> function connectionListener(socket) { <ide> // Usually the first incoming element should be our request. it may <ide> // be that in the case abortIncoming() was called that the incoming <ide> // array will be empty. <del> assert(incoming.length == 0 || incoming[0] === req); <add> assert(incoming.length === 0 || incoming[0] === req); <ide> <ide> incoming.shift(); <ide> <ide><path>lib/url.js <ide> Url.prototype.resolveObject = function(relative) { <ide> var up = 0; <ide> for (var i = srcPath.length; i >= 0; i--) { <ide> last = srcPath[i]; <del> if (last == '.') { <add> if (last === '.') { <ide> srcPath.splice(i, 1); <ide> } else if (last === '..') { <ide> srcPath.splice(i, 1); <ide><path>lib/util.js <ide> function formatValue(ctx, value, recurseTimes) { <ide> base = ' ' + '[Boolean: ' + formatted + ']'; <ide> } <ide> <del> if (keys.length === 0 && (!array || value.length == 0)) { <add> if (keys.length === 0 && (!array || value.length === 0)) { <ide> return braces[0] + base + braces[1]; <ide> } <ide>
5
Text
Text
remove asyncwrap mentions from async_hooks.md
dab51dddc8b928a67ad35e93ab2b8f6458fdb8c1
<ide><path>doc/api/async_hooks.md <ide> function before(asyncId) { } <ide> // After is called just after the resource's callback has finished. <ide> function after(asyncId) { } <ide> <del>// Destroy is called when an AsyncWrap instance is destroyed. <add>// Destroy is called when the resource is destroyed. <ide> function destroy(asyncId) { } <ide> <ide> // promiseResolve is called only for promise resources, when the <ide> see the details of the V8 [PromiseHooks][] API. <ide> <ide> Library developers that handle their own asynchronous resources performing tasks <ide> like I/O, connection pooling, or managing callback queues may use the <del>`AsyncWrap` JavaScript API so that all the appropriate callbacks are called. <add>`AsyncResource` JavaScript API so that all the appropriate callbacks are called. <ide> <ide> ### Class: `AsyncResource` <ide>
1
Ruby
Ruby
remove duplicated test
0cb1d87cd5e2a76c9cd12b5387dd8f25318d494b
<ide><path>actionpack/test/dispatch/routing_test.rb <ide> def test_index <ide> end <ide> end <ide> <del> def test_index <del> with_test_routes do <del> assert_equal '/info', info_path <del> get '/info' <del> assert_equal 'projects#info', @response.body <del> end <del> end <del> <ide> def test_match_shorthand_with_no_scope <ide> with_test_routes do <ide> assert_equal '/account/overview', account_overview_path
1