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
Python
Python
fix invalid syntax
7651f312c06070b7d08e582649eca5ef2f32a6d6
<ide><path>libcloud/test/compute/test_gridscale.py <ide> def test_get_image_success(self): <ide> <ide> def test_list_nodes_fills_created_datetime(self): <ide> nodes = self.driver.list_nodes() <del> self.assertEqual(nodes[0].created_at, datetime(2019, 6, 7, 12, 56, 44, tzinfo=UTC) <add> self.assertEqual(nodes[0].created_at, datetime(2019, 6, 7, 12, 56, 44, tzinfo=UTC)) <ide> <ide> class GridscaleMockHttp(MockHttp): <ide> fixtures = ComputeFileFixtures('gridscale')
1
Ruby
Ruby
add tests for formula path string 1
9c9c280c8aeb97a6ec8956242727208d80247826
<ide><path>Library/Homebrew/rubocops/lines_cop.rb <ide> def audit_formula(_node, _class_node, _parent_class_node, body_node) <ide> end <ide> end <ide> <del> # # Prefer formula path shortcuts in strings <del> # formula_path_strings(body_node, :prefix) do |p| <del> # next unless match = regex_match_group(p, %r{(/(man))[/'"]}) <del> # problem "\"\#\{prefix}#{match[1]}\" should be \"\#{#{match[3]}}\"" <del> # end <del> # <del> # formula_path_strings(body_node, :share) do |p| <del> # if match = regex_match_group(p, %r{/(bin|include|libexec|lib|sbin|share|Frameworks)}i) <del> # problem "\"\#\{prefix}#{match[1]}\" should be \"\#{#{match[1].downcase}}\"" <del> # end <del> # if match = regex_match_group(p, %r{((/share/man/|\#\{man\}/)(man[1-8]))}) <del> # problem "\"\#\{prefix}#{match[1]}\" should be \"\#{#{match[3]}}\"" <del> # end <del> # if match = regex_match_group(p, %r{(/share/(info|man))}) <del> # problem "\"\#\{prefix}#{match[1]}\" should be \"\#{#{match[2]}}\"" <del> # end <del> # end <del> # <add> # Prefer formula path shortcuts in strings <add> formula_path_strings(body_node, :share) do |p| <add> next unless match = regex_match_group(p, %r{(/(man))/?}) <add> problem "\"\#\{share}#{match[1]}\" should be \"\#{#{match[2]}}\"" <add> end <add> <add> formula_path_strings(body_node, :share) do |p| <add> if match = regex_match_group(p, %r{/(bin|include|libexec|lib|sbin|share|Frameworks)}i) <add> problem "\"\#\{prefix}#{match[1]}\" should be \"\#{#{match[1].downcase}}\"" <add> end <add> if match = regex_match_group(p, %r{((/share/man/|\#\{man\}/)(man[1-8]))}) <add> problem "\"\#\{prefix}#{match[1]}\" should be \"\#{#{match[3]}}\"" <add> end <add> if match = regex_match_group(p, %r{(/share/(info|man))}) <add> problem "\"\#\{prefix}#{match[1]}\" should be \"\#{#{match[2]}}\"" <add> end <add> end <add> <ide> # find_every_method_call_by_name(body_node, :depends_on) do |m| <ide> # key, value = destructure_hash(paramters(m).first) <ide> # next unless key.str_type? <ide> def modifier?(node) <ide> (hash (pair $_ $_)) <ide> EOS <ide> <del> def_node_matcher :formula_path_strings, <<-EOS.undent <add> def_node_search :formula_path_strings, <<-EOS.undent <ide> (dstr (begin (send nil %1)) $(str _ )) <ide> EOS <ide> <ide><path>Library/Homebrew/test/rubocops/lines_cop_spec.rb <ide> def install <ide> expect_offense(expected, actual) <ide> end <ide> end <add> <add> it "with formula path shortcut long form" do <add> source = <<-EOS.undent <add> class Foo < Formula <add> desc "foo" <add> url 'http://example.com/foo-1.0.tgz' <add> def install <add> mv "\#{share}/man", share <add> end <add> end <add> EOS <add> <add> expected_offenses = [{ message: "\"\#\{share}/man\" should be \"\#{man}\"", <add> severity: :convention, <add> line: 5, <add> column: 17, <add> source: source }] <add> <add> inspect_source(cop, source) <add> <add> expected_offenses.zip(cop.offenses).each do |expected, actual| <add> expect_offense(expected, actual) <add> end <add> end <ide> end <ide> def expect_offense(expected, actual) <ide> expect(actual.message).to eq(expected[:message])
2
Ruby
Ruby
fix `test_two_classes_autoloading` failure
1494fadd0df6d29ead33280977786e694b37bf75
<ide><path>activesupport/lib/active_support/cache/mem_cache_store.rb <ide> end <ide> <ide> require "active_support/core_ext/enumerable" <add>require "active_support/core_ext/marshal" <ide> require "active_support/core_ext/array/extract_options" <ide> <ide> module ActiveSupport
1
PHP
PHP
fix failing test from merge with 2.3
1c1701813bfc965f3d61bef4886a04fa2dcf0c94
<ide><path>lib/Cake/Utility/CakeTime.php <ide> public static function timeAgoInWords($dateTime, $options = array()) { <ide> ); <ide> <ide> // When time has passed <add> if (!$backwards && $relativeDate) { <add> return sprintf($relativeString, $relativeDate); <add> } <ide> if (!$backwards) { <del> if ($relativeDate) { <del> return __d('cake', '%s ago', $relativeDate); <del> } <del> <ide> return $aboutAgo[$fWord]; <ide> } <ide>
1
Go
Go
add test for validation
c1671abf14595923c6930d284c55689709efd34b
<ide><path>volume/local/local_linux_test.go <ide> package local // import "github.com/docker/docker/volume/local" <ide> import ( <ide> "os" <ide> "path/filepath" <add> "strconv" <ide> "testing" <ide> <add> "github.com/docker/docker/errdefs" <ide> "github.com/docker/docker/pkg/idtools" <ide> "github.com/docker/docker/quota" <ide> "gotest.tools/v3/assert" <ide> func testVolQuotaUnsupported(t *testing.T, mountPoint, backingFsDev, testDir str <ide> _, err = vol.Mount("1234") <ide> assert.ErrorContains(t, err, "no quota support") <ide> } <add> <add>func TestVolCreateValidation(t *testing.T) { <add> r, err := New(t.TempDir(), idtools.Identity{UID: os.Geteuid(), GID: os.Getegid()}) <add> if err != nil { <add> t.Fatal(err) <add> } <add> <add> mandatoryOpts = map[string][]string{ <add> "device": {"type"}, <add> "type": {"device"}, <add> "o": {"device", "type"}, <add> } <add> <add> tests := []struct { <add> doc string <add> name string <add> opts map[string]string <add> expectedErr string <add> }{ <add> { <add> doc: "invalid: name too short", <add> name: "a", <add> opts: map[string]string{ <add> "type": "foo", <add> "device": "foo", <add> }, <add> expectedErr: `volume name is too short, names should be at least two alphanumeric characters`, <add> }, <add> { <add> doc: "invalid: name invalid characters", <add> name: "hello world", <add> opts: map[string]string{ <add> "type": "foo", <add> "device": "foo", <add> }, <add> expectedErr: `"hello world" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to pass a host directory, use absolute path`, <add> }, <add> { <add> doc: "invalid: size, but no quotactl", <add> opts: map[string]string{"size": "1234"}, <add> expectedErr: `quota size requested but no quota support`, <add> }, <add> { <add> doc: "invalid: device without type", <add> opts: map[string]string{ <add> "device": "foo", <add> }, <add> expectedErr: `missing required option: "type"`, <add> }, <add> { <add> doc: "invalid: type without device", <add> opts: map[string]string{ <add> "type": "foo", <add> }, <add> expectedErr: `missing required option: "device"`, <add> }, <add> { <add> doc: "invalid: o without device", <add> opts: map[string]string{ <add> "o": "foo", <add> "type": "foo", <add> }, <add> expectedErr: `missing required option: "device"`, <add> }, <add> { <add> doc: "invalid: o without type", <add> opts: map[string]string{ <add> "o": "foo", <add> "device": "foo", <add> }, <add> expectedErr: `missing required option: "type"`, <add> }, <add> { <add> doc: "valid: short name, no options", <add> name: "ab", <add> }, <add> { <add> doc: "valid: device and type", <add> opts: map[string]string{ <add> "type": "foo", <add> "device": "foo", <add> }, <add> }, <add> { <add> doc: "valid: device, type, and o", <add> opts: map[string]string{ <add> "type": "foo", <add> "device": "foo", <add> "o": "foo", <add> }, <add> }, <add> } <add> <add> for i, tc := range tests { <add> tc := tc <add> t.Run(tc.doc, func(t *testing.T) { <add> if tc.name == "" { <add> tc.name = "vol-" + strconv.Itoa(i) <add> } <add> v, err := r.Create(tc.name, tc.opts) <add> if v != nil { <add> defer assert.Check(t, r.Remove(v)) <add> } <add> if tc.expectedErr == "" { <add> assert.NilError(t, err) <add> } else { <add> assert.Check(t, errdefs.IsInvalidParameter(err), "got: %T", err) <add> assert.ErrorContains(t, err, tc.expectedErr) <add> } <add> }) <add> } <add>}
1
Ruby
Ruby
remove unused variable
a4697b0cc310fd8986b9dfa226fc5c921cde603e
<ide><path>activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb <ide> def transaction(options = {}) <ide> @_current_transaction_records.last.concat(save_point_records) <ide> end <ide> end <del> rescue Exception => database_transaction_rollback <add> rescue Exception <ide> if open_transactions == 0 <ide> rollback_db_transaction <ide> rollback_transaction_records(true)
1
Ruby
Ruby
add documentation for indexdefinition
92887ca315d20d55959d950438b98e4c876fc57b
<ide><path>activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb <ide> <ide> module ActiveRecord <ide> module ConnectionAdapters #:nodoc: <add> # Abstract representation of an index definition on a table. Instances of <add> # this type are typically created and returned by methods in database <add> # adapters. e.g. ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter#indexes <ide> class IndexDefinition < Struct.new(:table, :name, :unique, :columns, :lengths, :orders, :where) #:nodoc: <ide> end <ide>
1
Text
Text
add node_debug_native to api docs
399bb3c95af821350774c18f469ab700387f38e1
<ide><path>doc/api/cli.md <ide> added: v0.1.32 <ide> <ide> `','`-separated list of core modules that should print debug information. <ide> <add>### `NODE_DEBUG_NATIVE=module[,…]` <add> <add>`','`-separated list of core C++ modules that should print debug information. <add> <ide> ### `NODE_DISABLE_COLORS=1` <ide> <!-- YAML <ide> added: v0.3.0
1
Javascript
Javascript
bind mousedown listener with capture=true
dc6e2ed6f8c451a9dbb4ca58df0df7303d8cb265
<ide><path>web/pdf_scripting_manager.js <ide> class PDFScriptingManager { <ide> this._eventBus._on(name, listener); <ide> } <ide> for (const [name, listener] of this._domEvents) { <del> window.addEventListener(name, listener); <add> window.addEventListener(name, listener, true); <ide> } <ide> <ide> try { <ide> class PDFScriptingManager { <ide> this._internalEvents.clear(); <ide> <ide> for (const [name, listener] of this._domEvents) { <del> window.removeEventListener(name, listener); <add> window.removeEventListener(name, listener, true); <ide> } <ide> this._domEvents.clear(); <ide>
1
PHP
PHP
add collation to identifierexpression
8d0f3807e5f49ab605f3921ef7d67951d5aa727c
<ide><path>src/Database/Driver/Postgres.php <ide> <ide> use Cake\Database\Driver; <ide> use Cake\Database\Expression\FunctionExpression; <add>use Cake\Database\Expression\IdentifierExpression; <ide> use Cake\Database\Expression\StringExpression; <ide> use Cake\Database\PostgresCompiler; <ide> use Cake\Database\Query; <ide> protected function _insertQueryTranslator(Query $query): Query <ide> protected function _expressionTranslators(): array <ide> { <ide> return [ <add> IdentifierExpression::class => '_transformIdentifierExpression', <ide> FunctionExpression::class => '_transformFunctionExpression', <ide> StringExpression::class => '_transformStringExpression', <ide> ]; <ide> } <ide> <add> /** <add> * Changes identifer expression into postgresql format. <add> * <add> * @param \Cake\Database\Expression\IdentifierExpression $expression The expression to tranform. <add> * @return void <add> */ <add> protected function _transformIdentifierExpression(IdentifierExpression $expression): void <add> { <add> $collation = $expression->getCollation(); <add> if ($collation) { <add> // use trim() to work around expression being transformed multiple times <add> $expression->setCollation('"' . trim($collation, '"') . '"'); <add> } <add> } <add> <ide> /** <ide> * Receives a FunctionExpression and changes it so that it conforms to this <ide> * SQL dialect. <ide><path>src/Database/Expression/IdentifierExpression.php <ide> class IdentifierExpression implements ExpressionInterface <ide> */ <ide> protected $_identifier; <ide> <add> /** <add> * @var string|null <add> */ <add> protected $collation; <add> <ide> /** <ide> * Constructor <ide> * <ide> * @param string $identifier The identifier this expression represents <add> * @param string|null $collation The identifier collation <ide> */ <del> public function __construct(string $identifier) <add> public function __construct(string $identifier, ?string $collation = null) <ide> { <ide> $this->_identifier = $identifier; <add> $this->collation = $collation; <ide> } <ide> <ide> /** <ide> public function getIdentifier(): string <ide> return $this->_identifier; <ide> } <ide> <add> /** <add> * Sets the collation. <add> * <add> * @param string $collation Identifier collation <add> * @return void <add> */ <add> public function setCollation(string $collation): void <add> { <add> $this->collation = $collation; <add> } <add> <add> /** <add> * Returns the collation. <add> * <add> * @return string|null <add> */ <add> public function getCollation(): ?string <add> { <add> return $this->collation; <add> } <add> <ide> /** <ide> * @inheritDoc <ide> */ <ide> public function sql(ValueBinder $binder): string <ide> { <del> return $this->_identifier; <add> $sql = $this->_identifier; <add> if ($this->collation) { <add> $sql .= ' COLLATE ' . $this->collation; <add> } <add> <add> return $sql; <ide> } <ide> <ide> /** <ide><path>tests/TestCase/Database/Expression/IdentifierExpressionTest.php <ide> public function testSQL() <ide> $expression = new IdentifierExpression('foo'); <ide> $this->assertSame('foo', $expression->sql(new ValueBinder())); <ide> } <add> <add> /** <add> * Tests setting collation. <add> * <add> * @return void <add> */ <add> public function testCollation() <add> { <add> $expresssion = new IdentifierExpression('test', 'utf8_general_ci'); <add> $this->assertSame('test COLLATE utf8_general_ci', $expresssion->sql(new ValueBinder())); <add> } <ide> } <ide><path>tests/TestCase/Database/QueryTest.php <ide> public function testStringExpression() <ide> $this->assertSame('testString', $statement->fetchColumn(0)); <ide> $statement->closeCursor(); <ide> } <add> <add> /** <add> * Tests setting identifier collation. <add> * <add> * @return void <add> */ <add> public function testIdentifierCollation() <add> { <add> $this->loadFixtures('Articles'); <add> $driver = $this->connection->getDriver(); <add> if ($driver instanceof Mysql) { <add> if (version_compare($this->connection->getDriver()->version(), '5.7.0', '<')) { <add> $collation = 'utf8_general_ci'; <add> } else { <add> $collation = 'utf8mb4_general_ci'; <add> } <add> } elseif ($driver instanceof Postgres) { <add> $collation = 'en_US.utf8'; <add> } elseif ($driver instanceof Sqlite) { <add> $collation = 'BINARY'; <add> } elseif ($driver instanceof Sqlserver) { <add> $collation = 'Latin1_general_CI_AI'; <add> } <add> <add> $query = (new Query($this->connection)) <add> ->select(['test_string' => new IdentifierExpression('title', $collation)]) <add> ->from('articles') <add> ->where(['id' => 1]); <add> <add> if ($driver instanceof Postgres) { <add> // Older postgres versions throw an error on the parameter type without a cast <add> $expected = "SELECT \(<title> COLLATE \"${collation}\"\) AS <test_string>"; <add> } else { <add> $expected = "SELECT \(<title> COLLATE ${collation}\) AS <test_string>"; <add> } <add> $this->assertRegExpSql($expected, $query->sql(new ValueBinder()), !$this->autoQuote); <add> <add> $statement = $query->execute(); <add> $this->assertSame('First Article', $statement->fetchColumn(0)); <add> $statement->closeCursor(); <add> } <ide> }
4
Python
Python
add support for s3 ap-southeast2 region
5585a26d11f1683db577d064daf599709cb5c5eb
<ide><path>libcloud/storage/drivers/s3.py <ide> S3_CN_NORTH_HOST = 's3.cn-north-1.amazonaws.com.cn' <ide> S3_EU_WEST_HOST = 's3-eu-west-1.amazonaws.com' <ide> S3_AP_SOUTHEAST_HOST = 's3-ap-southeast-1.amazonaws.com' <add>S3_AP_SOUTHEAST2_HOST = 's3-ap-southeast-2.amazonaws.com' <ide> S3_AP_NORTHEAST1_HOST = 's3-ap-northeast-1.amazonaws.com' <ide> S3_AP_NORTHEAST2_HOST = 's3-ap-northeast-2.amazonaws.com' <ide> S3_AP_NORTHEAST_HOST = S3_AP_NORTHEAST1_HOST <ide> S3_SA_EAST_HOST = 's3-sa-east-1.amazonaws.com' <add>S3_SA_SOUTHEAST2_HOST = 's3-sa-east-2.amazonaws.com' <ide> <ide> API_VERSION = '2006-03-01' <ide> NAMESPACE = 'http://s3.amazonaws.com/doc/%s/' % (API_VERSION) <ide> class S3APSEStorageDriver(S3StorageDriver): <ide> ex_location_name = 'ap-southeast-1' <ide> <ide> <add>class S3APSE2Connection(S3Connection): <add> host = S3_AP_SOUTHEAST2_HOST <add> <add> <add>class S3APSE2StorageDriver(S3StorageDriver): <add> name = 'Amazon S3 (ap-southeast-2)' <add> connectionCls = S3APSE2Connection <add> ex_location_name = 'ap-southeast-2' <add> <add> <ide> class S3APNE1Connection(S3Connection): <ide> host = S3_AP_NORTHEAST1_HOST <ide> <ide><path>libcloud/storage/providers.py <ide> ('libcloud.storage.drivers.s3', 'S3EUWestStorageDriver'), <ide> Provider.S3_AP_SOUTHEAST: <ide> ('libcloud.storage.drivers.s3', 'S3APSEStorageDriver'), <add> Provider.S3_AP_SOUTHEAST2: <add> ('libcloud.storage.drivers.s3', 'S3APSE2StorageDriver'), <ide> Provider.S3_AP_NORTHEAST: <ide> ('libcloud.storage.drivers.s3', 'S3APNE1StorageDriver'), <ide> Provider.S3_AP_NORTHEAST1: <ide><path>libcloud/storage/types.py <ide> class Provider(object): <ide> :cvar S3: Amazon S3 US <ide> :cvar S3_AP_NORTHEAST_HOST: Amazon S3 Asia South East (Tokyo) <ide> :cvar S3_AP_SOUTHEAST_HOST: Amazon S3 Asia South East (Singapore) <add> :cvar S3_AP_SOUTHEAST2_HOST: Amazon S3 Asia South East 2 (Sydney) <ide> :cvar S3_CN_NORTH: Amazon S3 CN North (Beijing) <ide> :cvar S3_EU_WEST: Amazon S3 EU West (Ireland) <ide> :cvar S3_US_WEST: Amazon S3 US West (Northern California) <ide> class Provider(object): <ide> S3_AP_NORTHEAST1 = 's3_ap_northeast_1' <ide> S3_AP_NORTHEAST2 = 's3_ap_northeast_2' <ide> S3_AP_SOUTHEAST = 's3_ap_southeast' <add> S3_AP_SOUTHEAST2 = 's3_ap_southeast2' <ide> S3_CN_NORTH = 's3_cn_north' <ide> S3_EU_WEST = 's3_eu_west' <ide> S3_SA_EAST = 's3_sa_east'
3
Text
Text
add apapirovski to collaborators
0a090d324f03227e71af3d8c4d5b341fc609160d
<ide><path>README.md <ide> For more information about the governance of the Node.js project, see <ide> **Andreas Madsen** &lt;amwebdk@gmail.com&gt; (he/him) <ide> * [AnnaMag](https://github.com/AnnaMag) - <ide> **Anna M. Kedzierska** &lt;anna.m.kedzierska@gmail.com&gt; <add>* [apapirovski](https://github.com/apapirovski) - <add>**Anatoli Papirovski** &lt;apapirovski@mac.com&gt; (he/him) <ide> * [aqrln](https://github.com/aqrln) - <ide> **Alexey Orlenko** &lt;eaglexrlnk@gmail.com&gt; (he/him) <ide> * [bengl](https://github.com/bengl) -
1
PHP
PHP
fix bad error message in sqlite driver
794395163fd060cb0be3798637edbf6dcd03b75e
<ide><path>src/Database/Driver/Sqlite.php <ide> use Cake\Database\Statement\PDOStatement; <ide> use Cake\Database\Statement\SqliteStatement; <ide> use Cake\Database\StatementInterface; <add>use InvalidArgumentException; <ide> use PDO; <ide> <ide> /** <ide> public function connect(): bool <ide> PDO::ATTR_EMULATE_PREPARES => false, <ide> PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, <ide> ]; <add> if (!is_string($config['database']) || !strlen($config['database'])) { <add> $name = $config['name'] ?? 'unknown'; <add> throw new InvalidArgumentException( <add> "The `database` key for the `{$name}` SQLite connection needs to be a non-empty string." <add> ); <add> } <ide> <ide> $databaseExists = file_exists($config['database']); <ide>
1
Python
Python
fix syntax error for dimensiondatastatus object
4632db2d1ee5329ab2c7421c1c5c7ee1ef1e36b4
<ide><path>libcloud/common/dimensiondata.py <ide> def __repr__(self): <ide> return (('<DimensionDataStatus: action=%s, request_time=%s, ' <ide> 'user_name=%s, number_of_steps=%s, update_time=%s, ' <ide> 'step_name=%s, step_number=%s, ' <del> 'step_percent_complete=%s, failure_reason=%s') <add> 'step_percent_complete=%s, failure_reason=%s>') <ide> % (self.action, self.request_time, self.user_name, <ide> self.number_of_steps, self.update_time, self.step_name, <ide> self.step_number, self.step_percent_complete,
1
Ruby
Ruby
prefer self.class.name to self.class.to_s
502078099fb59212164d757fe2b66e58adfaa0d4
<ide><path>Library/Homebrew/debrew.rb <ide> def debrew(exception, formula=nil) <ide> raise exception unless $debugged_exceptions.add?(exception) <ide> <ide> puts "#{exception.backtrace.first}" <del> puts "#{Tty.red}#{exception.class.to_s}#{Tty.reset}: #{exception.to_s}" <add> puts "#{Tty.red}#{exception.class.name}#{Tty.reset}: #{exception}" <ide> <ide> begin <ide> again = false <ide><path>Library/Homebrew/requirement.rb <ide> def to_dependency <ide> private <ide> <ide> def infer_name <del> klass = self.class.to_s <add> klass = self.class.name || self.class.to_s <ide> klass.sub!(/(Dependency|Requirement)$/, '') <ide> klass.sub!(/^(\w+::)*/, '') <ide> klass.downcase
2
Python
Python
add ex_fetch_status option to list_nodes()
419352ca427e8234143ff04e587979138beadedf
<ide><path>libcloud/common/azure_arm.py <ide> def get_token_from_credentials(self): <ide> Log in and get bearer token used to authorize API requests. <ide> """ <ide> <del> conn = self.conn_class(self.login_host, 443) <add> conn = self.conn_class(self.login_host, 443, timeout=self.timeout) <ide> conn.connect() <ide> params = urlencode({ <ide> "grant_type": "client_credentials", <ide><path>libcloud/compute/drivers/azure_arm.py <ide> def get_image(self, image_id, location=None): <ide> ex_offer, ex_sku, ex_version) <ide> return i[0] if i else None <ide> <del> def list_nodes(self, ex_resource_group=None, ex_fetch_nic=True): <add> def list_nodes(self, ex_resource_group=None, ex_fetch_nic=True, ex_fetch_status=True): <ide> """ <ide> List all nodes. <ide> <ide> def list_nodes(self, ex_resource_group=None, ex_fetch_nic=True): <ide> IP address information for nodes (requires extra API calls). <ide> :type ex_urn: ``bool`` <ide> <add> :param ex_fetch_status: Fetch node instance status (requires extra API calls). <add> :type ex_urn: ``bool`` <add> <ide> :return: list of node objects <ide> :rtype: ``list`` of :class:`.Node` <ide> """ <ide> def list_nodes(self, ex_resource_group=None, ex_fetch_nic=True): <ide> % (self.subscription_id) <ide> r = self.connection.request(action, <ide> params={"api-version": "2015-06-15"}) <del> return [self._to_node(n, fetch_nic=ex_fetch_nic) <add> return [self._to_node(n, fetch_nic=ex_fetch_nic, fetch_status=ex_fetch_status) <ide> for n in r.object["value"]] <ide> <ide> def create_node(self, <ide> def _ex_connection_class_kwargs(self): <ide> kwargs["cloud_environment"] = self.cloud_environment <ide> return kwargs <ide> <del> def _to_node(self, data, fetch_nic=True): <add> def _to_node(self, data, fetch_nic=True, fetch_status=True): <ide> private_ips = [] <ide> public_ips = [] <ide> nics = data["properties"]["networkProfile"]["networkInterfaces"] <ide> def _to_node(self, data, fetch_nic=True): <ide> pass <ide> <ide> state = NodeState.UNKNOWN <del> try: <del> action = "%s/InstanceView" % (data["id"]) <del> r = self.connection.request(action, <del> params={"api-version": "2015-06-15"}) <del> for status in r.object["statuses"]: <del> if status["code"] in ["ProvisioningState/creating"]: <del> state = NodeState.PENDING <del> break <del> elif status["code"] == "ProvisioningState/deleting": <del> state = NodeState.TERMINATED <del> break <del> elif status["code"].startswith("ProvisioningState/failed"): <del> state = NodeState.ERROR <del> break <del> elif status["code"] == "ProvisioningState/updating": <del> state = NodeState.UPDATING <del> break <del> elif status["code"] == "ProvisioningState/succeeded": <del> pass <add> if fetch_status: <add> try: <add> action = "%s/InstanceView" % (data["id"]) <add> r = self.connection.request(action, <add> params={"api-version": "2015-06-15"}) <add> for status in r.object["statuses"]: <add> if status["code"] in ["ProvisioningState/creating"]: <add> state = NodeState.PENDING <add> break <add> elif status["code"] == "ProvisioningState/deleting": <add> state = NodeState.TERMINATED <add> break <add> elif status["code"].startswith("ProvisioningState/failed"): <add> state = NodeState.ERROR <add> break <add> elif status["code"] == "ProvisioningState/updating": <add> state = NodeState.UPDATING <add> break <add> elif status["code"] == "ProvisioningState/succeeded": <add> pass <ide> <del> if status["code"] == "PowerState/deallocated": <del> state = NodeState.STOPPED <del> break <del> elif status["code"] == "PowerState/stopped": <del> state = NodeState.PAUSED <del> break <del> elif status["code"] == "PowerState/deallocating": <del> state = NodeState.PENDING <del> break <del> elif status["code"] == "PowerState/running": <del> state = NodeState.RUNNING <del> except BaseHTTPError: <del> pass <add> if status["code"] == "PowerState/deallocated": <add> state = NodeState.STOPPED <add> break <add> elif status["code"] == "PowerState/stopped": <add> state = NodeState.PAUSED <add> break <add> elif status["code"] == "PowerState/deallocating": <add> state = NodeState.PENDING <add> break <add> elif status["code"] == "PowerState/running": <add> state = NodeState.RUNNING <add> except BaseHTTPError: <add> pass <ide> <ide> node = Node(data["id"], <ide> data["name"],
2
PHP
PHP
update sqs config
41ea79f20e4e31a9078b37a6dabff81478c8b345
<ide><path>config/queue.php <ide> <ide> 'sqs' => [ <ide> 'driver' => 'sqs', <del> 'key' => 'your-public-key', <del> 'secret' => 'your-secret-key', <del> 'prefix' => 'https://sqs.us-east-1.amazonaws.com/your-account-id', <del> 'queue' => 'your-queue-name', <del> 'region' => 'us-east-1', <add> 'key' => env('SQS_KEY', 'your-public-key'), <add> 'secret' => env('SQS_SECRET', 'your-secret-key'), <add> 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), <add> 'queue' => env('SQS_QUEUE_NAME', 'your-queue-name'), <add> 'region' => env('SQS_QUEUE_REGION', 'us-east-1'), <ide> ], <ide> <ide> 'redis' => [
1
Python
Python
fix some compat issues with json/simplejson
762a52edde09297e87c640797219c9bb8255d50a
<ide><path>djangorestframework/compat.py <ide> def http_method_not_allowed(self, request, *args, **kwargs): <ide> # 'request': self.request <ide> # } <ide> #) <del> return http.HttpResponseNotAllowed(allowed_methods) <ide>\ No newline at end of file <add> return http.HttpResponseNotAllowed(allowed_methods) <add> <add># parse_qs <add>try: <add> # python >= ? <add> from urlparse import parse_qs <add>except ImportError: <add> # python <= ? <add> from cgi import parse_qs <ide>\ No newline at end of file <ide><path>djangorestframework/emitters.py <ide> """ <ide> from django.conf import settings <ide> from django.template import RequestContext, loader <add>from django.utils import simplejson as json <ide> from django import forms <ide> <ide> from djangorestframework.response import ErrorResponse <ide> import string <ide> import re <ide> <del>try: <del> import json <del>except ImportError: <del> import simplejson as json <del> <ide> <ide> <ide> # TODO: Rename verbose to something more appropriate <ide><path>djangorestframework/parsers.py <ide> and multipart/form-data. (eg also handle multipart/json) <ide> """ <ide> from django.http.multipartparser import MultiPartParser as DjangoMPParser <add>from django.utils import simplejson as json <add> <ide> from djangorestframework.response import ErrorResponse <ide> from djangorestframework import status <ide> from djangorestframework.utils import as_tuple <ide> from djangorestframework.mediatypes import MediaType <del> <del>try: <del> import json <del>except ImportError: <del> import simplejson as json <del> <del>try: <del> from urlparse import parse_qs <del>except ImportError: <del> from cgi import parse_qs <add>from djangorestframework.compat import parse_qs <ide> <ide> <ide> <ide><path>djangorestframework/tests/authentication.py <ide> from django.conf.urls.defaults import patterns <ide> from django.test import TestCase <ide> from django.test import Client <del>from djangorestframework.compat import RequestFactory <del>from djangorestframework.resource import Resource <ide> from django.contrib.auth.models import User <ide> from django.contrib.auth import login <add>from django.utils import simplejson as json <add> <add>from djangorestframework.compat import RequestFactory <add>from djangorestframework.resource import Resource <ide> <ide> import base64 <del>try: <del> import json <del>except ImportError: <del> import simplejson as json <add> <ide> <ide> class MockResource(Resource): <ide> def post(self, request): <ide> def test_post_form_session_auth_failing(self): <ide> """Ensure POSTing form over session authentication without logged in user fails.""" <ide> response = self.csrf_client.post('/', {'example': 'example'}) <ide> self.assertEqual(response.status_code, 403) <add> <ide><path>djangorestframework/tests/reverse.py <ide> from django.conf.urls.defaults import patterns, url <ide> from django.core.urlresolvers import reverse <ide> from django.test import TestCase <add>from django.utils import simplejson as json <ide> <ide> from djangorestframework.resource import Resource <ide> <del>try: <del> import json <del>except ImportError: <del> import simplejson as json <ide> <ide> <ide> class MockResource(Resource): <ide><path>examples/blogpost/tests.py <ide> """Test a range of REST API usage of the example application. <ide> """ <ide> <del>from django.test import TestCase <ide> from django.core.urlresolvers import reverse <add>from django.test import TestCase <add>from django.utils import simplejson as json <add> <add>from djangorestframework.compat import RequestFactory <add> <ide> from blogpost import views, models <ide> import blogpost <ide> <del>#import json <del>#from rest.utils import xml2dict, dict2xml <ide> <ide> class AcceptHeaderTests(TestCase): <ide> """Test correct behaviour of the Accept header as specified by RFC 2616: <ide> def dont_test_writing_to_read_only_resource_is_not_allowed(self): <ide> <ide> <ide> #above testcases need to probably moved to the core <del>from djangorestframework.compat import RequestFactory <del>try: <del> import json <del>except ImportError: <del> import simplejson as json <ide> <ide> class TestRotation(TestCase): <ide> """For the example the maximum amount of Blogposts is capped off at views.MAX_POSTS. <ide><path>examples/pygments_api/tests.py <ide> from django.test import TestCase <add>from django.utils import simplejson as json <add> <ide> from djangorestframework.compat import RequestFactory <add> <ide> from pygments_api import views <ide> import tempfile, shutil <ide> <del>try: <del> import json <del>except ImportError: <del> import simplejson as json <add> <ide> <ide> class TestPygmentsExample(TestCase): <ide>
7
Javascript
Javascript
fix popover problem for rtl 1/n
a527ef2032747a88e705ef7fa3047b6db48cbbe3
<ide><path>Libraries/Modal/Modal.js <ide> */ <ide> 'use strict'; <ide> <add>const I18nManager = require('I18nManager'); <ide> const Platform = require('Platform'); <ide> const PropTypes = require('react/lib/ReactPropTypes'); <ide> const React = require('React'); <ide> class Modal extends React.Component { <ide> } <ide> } <ide> <add>const side = I18nManager.isRTL ? 'right' : 'left'; <ide> const styles = StyleSheet.create({ <ide> modal: { <ide> position: 'absolute', <ide> }, <ide> container: { <ide> position: 'absolute', <del> left: 0, <add> [side] : 0, <ide> top: 0, <ide> } <ide> });
1
Python
Python
add batch option to `sqssensor`
9b4a053bc6496e5e35caabb3f68ef64c1381e48b
<ide><path>airflow/providers/amazon/aws/sensors/sqs.py <ide> """Reads and then deletes the message from SQS queue""" <ide> import json <ide> import warnings <del>from typing import TYPE_CHECKING, Any, Optional, Sequence <add>from typing import TYPE_CHECKING, Any, Collection, List, Optional, Sequence <ide> <ide> from jsonpath_ng import parse <ide> from typing_extensions import Literal <ide> <ide> from airflow.exceptions import AirflowException <add>from airflow.providers.amazon.aws.hooks.base_aws import BaseAwsConnection <ide> from airflow.providers.amazon.aws.hooks.sqs import SqsHook <ide> from airflow.sensors.base import BaseSensorOperator <ide> <ide> class SqsSensor(BaseSensorOperator): <ide> """ <ide> Get messages from an Amazon SQS queue and then delete the messages from the queue. <del> If deletion of messages fails an AirflowException is thrown. Otherwise, the messages <add> If deletion of messages fails, an AirflowException is thrown. Otherwise, the messages <ide> are pushed through XCom with the key ``messages``. <ide> <add> By default,the sensor performs one and only one SQS call per poke, which limits the result to <add> a maximum of 10 messages. However, the total number of SQS API calls per poke can be controlled <add> by num_batches param. <add> <ide> .. seealso:: <ide> For more information on how to use this sensor, take a look at the guide: <ide> :ref:`howto/sensor:SqsSensor` <ide> <ide> :param aws_conn_id: AWS connection id <ide> :param sqs_queue: The SQS queue url (templated) <ide> :param max_messages: The maximum number of messages to retrieve for each poke (templated) <add> :param num_batches: The number of times the sensor will call the SQS API to receive messages (default: 1) <ide> :param wait_time_seconds: The time in seconds to wait for receiving messages (default: 1 second) <ide> :param visibility_timeout: Visibility timeout, a period of time during which <ide> Amazon SQS prevents other consumers from receiving and processing the message. <ide> def __init__( <ide> sqs_queue, <ide> aws_conn_id: str = 'aws_default', <ide> max_messages: int = 5, <add> num_batches: int = 1, <ide> wait_time_seconds: int = 1, <ide> visibility_timeout: Optional[int] = None, <ide> message_filtering: Optional[Literal["literal", "jsonpath"]] = None, <ide> def __init__( <ide> self.sqs_queue = sqs_queue <ide> self.aws_conn_id = aws_conn_id <ide> self.max_messages = max_messages <add> self.num_batches = num_batches <ide> self.wait_time_seconds = wait_time_seconds <ide> self.visibility_timeout = visibility_timeout <ide> <ide> def __init__( <ide> <ide> self.hook: Optional[SqsHook] = None <ide> <del> def poke(self, context: 'Context'): <add> def poll_sqs(self, sqs_conn: BaseAwsConnection) -> Collection: <ide> """ <del> Check for message on subscribed queue and write to xcom the message with key ``messages`` <add> Poll SQS queue to retrieve messages. <ide> <del> :param context: the context object <del> :return: ``True`` if message is available or ``False`` <add> :param sqs_conn: SQS connection <add> :return: A list of messages retrieved from SQS <ide> """ <del> sqs_conn = self.get_hook().get_conn() <del> <ide> self.log.info('SqsSensor checking for message on queue: %s', self.sqs_queue) <ide> <ide> receive_message_kwargs = { <ide> def poke(self, context: 'Context'): <ide> response = sqs_conn.receive_message(**receive_message_kwargs) <ide> <ide> if "Messages" not in response: <del> return False <add> return [] <ide> <ide> messages = response['Messages'] <ide> num_messages = len(messages) <ide> def poke(self, context: 'Context'): <ide> messages = self.filter_messages(messages) <ide> num_messages = len(messages) <ide> self.log.info("There are %d messages left after filtering", num_messages) <add> return messages <ide> <del> if not num_messages: <del> return False <add> def poke(self, context: 'Context'): <add> """ <add> Check subscribed queue for messages and write them to xcom with the ``messages`` key. <ide> <del> if not self.delete_message_on_reception: <del> context['ti'].xcom_push(key='messages', value=messages) <del> return True <add> :param context: the context object <add> :return: ``True`` if message is available or ``False`` <add> """ <add> sqs_conn = self.get_hook().get_conn() <ide> <del> self.log.info("Deleting %d messages", num_messages) <add> message_batch: List[Any] = [] <ide> <del> entries = [ <del> {'Id': message['MessageId'], 'ReceiptHandle': message['ReceiptHandle']} for message in messages <del> ] <del> response = sqs_conn.delete_message_batch(QueueUrl=self.sqs_queue, Entries=entries) <add> # perform multiple SQS call to retrieve messages in series <add> for _ in range(self.num_batches): <add> messages = self.poll_sqs(sqs_conn=sqs_conn) <ide> <del> if 'Successful' in response: <del> context['ti'].xcom_push(key='messages', value=messages) <del> return True <del> else: <del> raise AirflowException( <del> 'Delete SQS Messages failed ' + str(response) + ' for messages ' + str(messages) <del> ) <add> if not len(messages): <add> continue <add> <add> message_batch.extend(messages) <add> <add> if self.delete_message_on_reception: <add> <add> self.log.info("Deleting %d messages", len(messages)) <add> <add> entries = [ <add> {'Id': message['MessageId'], 'ReceiptHandle': message['ReceiptHandle']} <add> for message in messages <add> ] <add> response = sqs_conn.delete_message_batch(QueueUrl=self.sqs_queue, Entries=entries) <add> <add> if 'Successful' not in response: <add> raise AirflowException( <add> 'Delete SQS Messages failed ' + str(response) + ' for messages ' + str(messages) <add> ) <add> if not len(message_batch): <add> return False <add> <add> context['ti'].xcom_push(key='messages', value=message_batch) <add> return True <ide> <ide> def get_hook(self) -> SqsHook: <ide> """Create and return an SqsHook""" <ide><path>tests/providers/amazon/aws/sensors/test_sqs.py <ide> def test_poke_do_not_delete_message_on_received(self, mock_conn): <ide> ) <ide> self.sensor.poke(self.mock_context) <ide> assert mock_conn.delete_message_batch.called is False <add> <add> @mock_sqs <add> def test_poke_batch_messages(self): <add> messages = ["hello", "brave", "world"] <add> <add> self.sqs_hook.create_queue(QUEUE_NAME) <add> # Do publish 3 messages <add> for message in messages: <add> self.sqs_hook.send_message(queue_url=QUEUE_URL, message_body=message) <add> <add> # Init batch sensor to get 1 message for each SQS poll <add> # and perform 3 polls <add> self.sensor = SqsSensor( <add> task_id='test_task3', <add> dag=self.dag, <add> sqs_queue=QUEUE_URL, <add> aws_conn_id='aws_default', <add> max_messages=1, <add> num_batches=3, <add> ) <add> result = self.sensor.poke(self.mock_context) <add> assert result <add> <add> # expect all messages are retrieved <add> for message in messages: <add> assert f"'Body': '{message}'" in str( <add> self.mock_context['ti'].method_calls <add> ), "context call should contain message '{message}'" <ide><path>tests/system/providers/amazon/aws/example_sqs.py <ide> def delete_queue(queue_url): <ide> sqs_queue = create_queue() <ide> <ide> # [START howto_operator_sqs] <del> publish_to_queue = SqsPublishOperator( <del> task_id='publish_to_queue', <add> publish_to_queue_1 = SqsPublishOperator( <add> task_id='publish_to_queue_1', <add> sqs_queue=sqs_queue, <add> message_content='{{ task_instance }}-{{ logical_date }}', <add> ) <add> publish_to_queue_2 = SqsPublishOperator( <add> task_id='publish_to_queue_2', <ide> sqs_queue=sqs_queue, <ide> message_content='{{ task_instance }}-{{ logical_date }}', <ide> ) <ide> def delete_queue(queue_url): <ide> task_id='read_from_queue', <ide> sqs_queue=sqs_queue, <ide> ) <add> # Retrieve multiple batches of messages from SQS. <add> # The SQS API only returns a maximum of 10 messages per poll. <add> read_from_queue_in_batch = SqsSensor( <add> task_id='read_from_queue_in_batch', <add> sqs_queue=create_queue, <add> # Get maximum 10 messages each poll <add> max_messages=10, <add> # Combine 3 polls before returning results <add> num_batches=3, <add> ) <ide> # [END howto_sensor_sqs] <ide> <ide> chain( <ide> # TEST SETUP <ide> sqs_queue, <ide> # TEST BODY <del> publish_to_queue, <add> publish_to_queue_1, <ide> read_from_queue, <add> publish_to_queue_2, <add> read_from_queue_in_batch, <ide> # TEST TEARDOWN <ide> delete_queue(sqs_queue), <ide> )
3
Text
Text
add v3.22.0-beta.2 to changelog
6b4f58971096decca38849b7081a56178b83d2b1
<ide><path>CHANGELOG.md <ide> # Ember Changelog <ide> <add>### v3.22.0-beta.2 (August 31, 2020) <add> <add>- [#19106](https://github.com/emberjs/ember.js/pull/19106) [BUGFIX] Ensure `destroy` methods on `CoreObject` are invoked. <add>- [#19111](https://github.com/emberjs/ember.js/pull/19111) [BUGFIX] Fixes `ArrayProxy` length reactivity. <add> <ide> ### v3.22.0-beta.1 (August 24, 2020) <ide> <ide> - [#19062](https://github.com/emberjs/ember.js/pull/19062) / [#19068](https://github.com/emberjs/ember.js/pull/19068) [FEATURE] Add @ember/destroyable feature from the [Destroyables RFC](https://github.com/emberjs/rfcs/blob/master/text/0580-destroyables.md).
1
Python
Python
remove unused kwargs
2b8b6c929e282958a920ba2aa26ee59106986ec3
<ide><path>src/transformers/modeling_utils.py <ide> def generate( <ide> repetition_penalty=repetition_penalty, <ide> no_repeat_ngram_size=no_repeat_ngram_size, <ide> bad_words_ids=bad_words_ids, <del> bos_token_id=bos_token_id, <ide> pad_token_id=pad_token_id, <del> decoder_start_token_id=decoder_start_token_id, <ide> eos_token_id=eos_token_id, <ide> batch_size=effective_batch_size, <ide> num_return_sequences=num_return_sequences, <ide> def generate( <ide> repetition_penalty=repetition_penalty, <ide> no_repeat_ngram_size=no_repeat_ngram_size, <ide> bad_words_ids=bad_words_ids, <del> bos_token_id=bos_token_id, <ide> pad_token_id=pad_token_id, <del> decoder_start_token_id=decoder_start_token_id, <ide> eos_token_id=eos_token_id, <ide> batch_size=effective_batch_size, <ide> encoder_outputs=encoder_outputs, <ide> def _generate_no_beam_search( <ide> repetition_penalty, <ide> no_repeat_ngram_size, <ide> bad_words_ids, <del> bos_token_id, <ide> pad_token_id, <ide> eos_token_id, <del> decoder_start_token_id, <ide> batch_size, <ide> encoder_outputs, <ide> attention_mask, <ide> def _generate_beam_search( <ide> repetition_penalty, <ide> no_repeat_ngram_size, <ide> bad_words_ids, <del> bos_token_id, <ide> pad_token_id, <ide> eos_token_id, <del> decoder_start_token_id, <ide> batch_size, <ide> num_return_sequences, <ide> length_penalty,
1
Python
Python
fix syntax error
5bee0fe0f43a8a8dd11177a3b7fe2b831077a51a
<ide><path>celery/management/commands/celerystats.py <ide> class Command(BaseCommand): <ide> """Run the celery daemon.""" <ide> option_list = BaseCommand.option_list <del> help = "Collect/flush and dump a report from the currently available " <del> "statistics" <add> help = "Collect/flush and dump a report from the currently available " + \ <add> "statistics" <ide> <ide> def handle(self, *args, **options): <ide> """Handle the management command."""
1
Text
Text
add gpg fingerprint for fishrock123
8c6c376a9403496a7e4aab3a667c708e3e65ea33
<ide><path>README.md <ide> information about the governance of the io.js project, see <ide> * **Thorsten Lorenz** ([@thlorenz](https://github.com/thlorenz)) &lt;thlorenz@gmx.de&gt; <ide> * **Stephen Belanger** ([@qard](https://github.com/qard)) &lt;admin@stephenbelanger.com&gt; <ide> * **Jeremiah Senkpiel** ([@fishrock123](https://github.com/fishrock123)) &lt;fishrock123@rocketmail.com&gt; <add> - Release GPG key: FD3A5288F042B6850C66B31F09FE44734EB7990E <ide> * **Evan Lucas** ([@evanlucas](https://github.com/evanlucas)) &lt;evanlucas@me.com&gt; <ide> * **Brendan Ashworth** ([@brendanashworth](https://github.com/brendanashworth)) &lt;brendan.ashworth@me.com&gt; <ide> * **Vladimir Kurchatkin** ([@vkurchatkin](https://github.com/vkurchatkin)) &lt;vladimir.kurchatkin@gmail.com&gt;
1
Text
Text
clarify availability of renderers
b36f4af69db693a4c2a6466352b1bbfc0062380a
<ide><path>README.md <ide> three.js <ide> <ide> #### JavaScript 3D library #### <ide> <del>The aim of the project is to create an easy to use, lightweight, 3D library. The library provides Canvas 2D, SVG, CSS3D and WebGL renderers. <add>The aim of the project is to create an easy to use, lightweight, 3D library with a default WebGL renderer. The library also provides Canvas 2D, SVG and CSS3D renderers in the examples. <ide> <ide> [Examples](http://threejs.org/examples/) &mdash; <ide> [Documentation](http://threejs.org/docs/) &mdash;
1
Text
Text
add universal moderators handbook
7140a48787bd73629f1f58d73be6a506fe10df01
<ide><path>docs/_sidebar.md <ide> - **<i class="fad fa-hourglass-start"></i> Getting Started** <ide> - [Introduction](/index.md 'Contribute to the freeCodeCamp.org Community') <del>- **<i class="fad fa-code"></i> Code Contribution Guides** <add>- **<i class="fad fa-code"></i> Code Contribution** <ide> - [Work on coding challenges](/how-to-work-on-coding-challenges.md) <ide> - [Help with video challenges](/how-to-help-with-video-challenges.md) <ide> - [Set up freeCodeCamp locally](/how-to-setup-freecodecamp-locally.md) <ide> - [Work on the docs theme](/how-to-work-on-the-docs-theme.md) <ide> - [Catch outgoing emails locally](/how-to-catch-outgoing-emails-locally.md) <ide> - [Set up WSL](/how-to-setup-wsl.md) <del>- **<i class="fad fa-language"></i> Chinese Community Contribution Guides** (中文社区贡献指南) <del> - [成为专栏作者](/chinese-guides/news-author-application.md) <del> - [文章翻译计划](/chinese-guides/news-translations.md) <del> - [视频翻译计划](/chinese-guides/video-translations.md) <add> <add>--- <add> <ide> - **<i class="fad fa-plane-alt"></i> Flight Manuals** (for Staff & Mods) <del> - [DevOps Overview](/devops.md) <add> - [Moderator Handbook](/flight-manuals/moderator-handbook.md) <ide> - [Reply Templates](/flight-manuals/using-reply-templates.md) <add> - [DevOps Overview](/devops.md) <ide> - [Working on Servers](/flight-manuals/working-on-virtual-machines.md) <ide> <ide> --- <ide> <add>- **<i class="fad fa-language"></i> 中文社区贡献指南** <add> - [成为专栏作者](/chinese-guides/news-author-application.md) <add> - [文章翻译计划](/chinese-guides/news-translations.md) <add> - [视频翻译计划](/chinese-guides/video-translations.md) <add> <add>--- <add> <ide> - **<i class="fad fa-user-friends"></i> Our Community** <ide> - [**<i class="fab fa-github"></i> GitHub Repository**](https://github.com/freecodecamp/freecodecamp) <ide> - [**<i class="fab fa-discourse"></i> Contributors category on Forum**](https://freecodecamp.org/forum/c/contributors) <ide><path>docs/flight-manuals/moderator-handbook.md <add># The official freeCodeCamp Moderator Handbook. <add> <add>This will help you moderate different places in our community, including: <add> <add>- GitHub issues & pull requests <add>- The forum, chat rooms, Facebook groups, and other online meeting places <add>- In-person events like study groups, hackathons, and conferences <add> <add>**All freeCodeCamp Moderators are community-wide moderators. That means that we trust you to oversee any of these places.** <add> <add>This said, you can serve as a moderator in whichever places are of the most interest to you. Some moderators just help out on GitHub. Others just help out on the forum. Some moderators are active everywhere. <add> <add>The bottom line is that we want you to enjoy being a moderator, and invest your scarce time in places that are of interest to you. <add> <add>> [!NOTE] <add>> "With great power comes great responsibility." - Uncle Ben <add> <add>As a moderator, temperament is more important than technical skill. <add> <add>Listen. Be Helpful. Don't abuse your power. <add> <add>freeCodeCamp is an inclusive community, and we need to keep it that way. <add> <add>We have a single code of conduct that governs our entire community. The fewer the rules, the easier they are to remember. You can read those rules and commit them to memory [here](https://code-of-conduct.freecodecamp.org). <add> <add># Moderating GitHub <add> <add>Moderators have the ability to close issues and accept or close pull requests. <add> <add>Moderators have two primary responsibilities regarding GitHub: <add> <add>1. QA'ing and merging pull requests <add>2. Evaluating and responding to issues <add> <add>## Moderating Pull Requests <add> <add>Pull Requests (PRs) are how contributors submit changes to freeCodeCamp's repository. It's important that we perform Quality Assurance (QA) on pull requests before we decide whether to merge them or close them. <add> <add>### Types of Pull Requests <add> <add>1. **Challenge Instruction Edits** These are changes to the text of challenges - the Description, Instructions, or Test Text. You can also review these right on GitHub and decide whether to merge them. We need to be a bit more careful about these, because millions of people will encounter this text as they work through the freeCodeCamp curriculum. Does the pull request make the text more clear without making it much longer? Are the edits relevant and not overly pedantic? Remember that our goal is for challenges to be as clear and as short as possible. They aren't the place for obscure details. Also, contributors may try to add links to resources to the challenges. You can close these pull requests and reply to them with this: <add> <add> > Thank you for your pull request. <add> > <add> > I am closing this pull request. Please add links and other details to the challenge's corresponding guide article instead. <add> > <add> > If you think I'm wrong in closing this issue, please reopen it and add further clarification. Thank you, and happy coding. <add> <add>2. **Challenge Code Edits** These are changes to the code in a challenge - the Challenge Seed, Challenge Solution, and Test Strings. These pull requests need to be pulled down from GitHub and tested on your local computer to make sure the challenge tests can still be passed with the current solution, and the new code doesn't introduce any errors. Some contributors may try to add additional tests to cover pedantic corner-cases. We need to be careful to not make the challenge too complicated. These challenges and their tests should be as simple and intuitive as possible. Aside from the algorithm challenges and interview prep section, learners should be able to solve each challenge within about 2 minutes. <add> <add>3. **Codebase Changes** These code edits change the functionality of the freeCodeCamp platform itself. Sometimes contributors try to make changes without much explanation, but for code changes we need to make sure there's a genuine need for the change. So these pull requests should reference an existing GitHub issue where the reasons for the change are discussed. Then you can open the pull request on your computer and test them out locally. After you've done so, if the changes look good, don't merge them quite yet. You can comment on the pull request saying "LGTM", then mention @raisedadead so he can take a final look. <add> <add>### How to merge or close pull requests <add> <add>First of all, when you choose a pull request to QA, you should assign yourself to it. You can do this by clicking the "assign yourself" link below the "assignees" part on the right hand column of GitHub's interface. <add> <add>Depending on the type of pull request it is, follow the corresponding rules listed above. <add> <add>Before merging any pull request, make sure that GitHub has green checkmarks for everything. If there are any X's, investigate them first and figure out how to get them turned into green checkmarks first. <add> <add>Sometimes there will be a Merge Conflict. This means that another pull request has made a change to that exact same part of that same file. GitHub has a tool for addressing these merge conflicts right on GitHub. You can try to address these conflicts. Just use your best judgement. The pull request's changes will be on top, and the Master branch's changes will be on bottom. Sometimes there will be redundant information in there that can be deleted. Before you finish, be sure to delete the `<<<<<<`, `======`, and `>>>>>>` that Git adds to indicate areas of conflict. <add> <add>If the pull request looks ready to merge (and doesn't require approval from @raisedadead), you can go ahead and merge it. Be sure to use the default "Squash and Merge" functionality on GitHub. This will squash all the pull requests commits down into a single commit, which makes the Git history much easier to read. <add> <add>You should then comment on the pull request, thanking the contributor in your own personal way. <add> <add>If the author of the pull request is a "first time contributor" you should also congratulate them on their first merged pull request to the repository. You can look at the upper right-hand corner of the PR's body to determine a first-time contributor. It will show `First-time contributor` as shown below: <add> <add>![Copy_edits_for_Java_arrays_article_by_karentobo_%C2%B7_Pull_Request__20615_%C2%B7_freeCodeCamp_freeCodeCamp|690x281](https://i.imgur.com/dTQMjGM.png) <add> <add>If the pull request doesn't look ready to merge you can politely reply telling the author what they should do to get it ready. Hopefully they will reply and get their pull request closer to ready. <add> <add>Often, a pull request will be obviously low effort. You can often tell this immediately when the contributor didn't bother checking the checkboxes in the Pull Request Template, or used a generic pull request title like "made changes" or "Update index.md". <add> <add>There are also situations where the contributor is trying to add a link to their own website, or include a library they themselves created, or has a frivolous edit that doesn't serve to help anyone but themselves. <add> <add>In both of these situations, you should go ahead and close their pull request and reply with this standard message: <add> <add>> Thank you for opening this pull request. <add>> <add>> This is a standard message notifying you that we've reviewed your pull request and have decided not to merge it. We would welcome future pull requests from you. <add>> <add>> Thank you and happy coding. <add> <add>If you need a second opinion on a pull request, go ahead and leave your comments on the pull request, then add the "discussing" label to the pull request. <add> <add>## Moderating GitHub Issues <add> <add>freeCodeCamp is an active open source project. We get new issues every day, all of which need to be triaged and labeled. <add> <add>### Types of GitHub Issues <add> <add>1. **Code Help Requests**, which people have mistakenly created GitHub issues for. If someone is asking for help, paste the following message, then close the issue. <add> <add> > Thank you for reporting this issue. <add> > <add> > This is a standard message notifying you that this issue seems to be a request for help. Instead of asking for help here, please click the \*\*"Help"\*\* button on the challenge on freeCodeCamp, which will help you create a question in the right part of the forum. Volunteers on the forum usually respond to questions within a few hours and can help determine if there is an issue with your code or the challenge's tests. <add> > <add> > If the forum members determine there is nothing wrong with your code, you can request this issue to be reopened. <add> > <add> > Thank you and happy coding. <add> <add>2. **Bug or Clarification issues** Try to reproduce the bug yourself if you can. If not, ask them for the steps to reproduce the bug, and whether they have any screenshots, videos, or additional details that can help you reproduce the issue. Once you can reproduce the issue - or at least confirm it's a legit issue - label it `confirmed`. Then: <add> <add>- If it's a simple change to an existing challenge, label as `first timers only`, otherwise label as `help wanted`. Use other labels as appropriate. <add>- If the issue is more significant, flag as `bug`. <add> &nbsp; <add> If there is any ambiguity as to the proper course of action on an issue, feel free to tag @raisedadead on the issue get his opinion on it, then add the `Discussing` label. <add> <add>3. **Duplicate Issues** If an issue is the same as another reported issue, the prior reported issue should take precedence. Flag as `Duplicate`, paste the following message replacing `#XXXXX` with the issue number, then close the issue. <add> <add> > Thank you for reporting this issue. <add> > <add> > This is a standard message notifying you that this issue appears to be very similar to issue #XXXXX, so I am closing it as a duplicate. <add> > <add> > If you think I'm wrong in closing this issue, please reopen it and add further clarification. Thank you and happy coding. <add> <add>4. **Fixed in staging** Some problems may have already been fixed in staging, but don't have a GitHub issue associated with them. If this is the case, you can paste the following message, close the issue, and add a `status: resolved/shipping` label: <add> > Thank you for reporting this issue. <add> > <add> > This is a standard message notifying you that the problem you mentioned here is present in production, but that it has already been fixed in staging. This means that the next time we push our staging branch to production, this problem should be fixed. Because of this, I'm closing this issue. <add> > <add> > If you think I'm wrong in closing this issue, please reopen it and add further clarification. Thank you and happy coding. <add> <add>### Closing Stale, Outdated, Inactive Issues and Pull Requests <add> <add>- Stale Issues or PRs are those that have not seen any activity from the OP for 21 days (3 weeks from the last activity), but only after a moderator has requested more information/changes. These can be closed in an automated/bot script or by the moderators themselves. <add> <add>- Activity is defined as: Comments requesting an update on the PR and triages like `status: update needed` label etc. <add> <add>- If the OP asks for additional assistance or even time, the above can be relaxed and revisited after a response is given. In any case the mods should use their best judgement to resolve the outstanding PR's status. <add> <add>### Other guidelines for Moderators on GitHub <add> <add>Though you will have write access to freeCodeCamp's repository, **you should never push code directly to freeCodeCamp repositories**. All code should enter freeCodeCamp's codebase in the form of a pull request from a fork of the repository. <add> <add>Also, you should never accept your own PRs. They must be QA'd by another moderator, just like with any other PR. <add> <add>If you notice anyone breaking the [code of conduct](https://code-of-conduct.freecodecamp.org) on GitHub issues, or opening pull requests with malicious content or code, email dev@freecodecamp.org with a link to the offending pull request and we can consider banning them from freeCodeCamp's GitHub organization entirely. <add> <add># Moderating the Forum <add> <add>As a Moderator, you help keep our community an enjoyable place for anyone to learn and get help. You will deal with flagged posts and handle spam, off-topic, and other inappropriate conversations. <add> <add>Note that once you are a moderator on the forum, you will start to see blue moderator hints about forum members, like "this is the first time [person] has posted - let's welcome them to the community!" or "[person] hasn't posted in a long time - let's welcome them back." <add> <add>![A blue text message saying "this is the first time [person] has posted - let's welcome them to the community!](https://i.imgur.com/mPmVgzK.png) <add> <add>These are opportunities for you to welcome them and make them feel extra special. You never know which person who's marginally involved may become our next super-helper, helping many other people in their coding journey. Even the smallest kindness may trigger a cascade of good deeds. <add> <add>### Deleting forum posts <add> <add>Forum moderators have the ability to delete user's posts. You should only do this for the following instances: <add> <add>1. Someone has posted a pornographic or graphically violent image. <add>2. Someone has posted a link or code that is malicious in nature, and could harm other campers who click on it. <add>3. Someone has flooded a thread with lots of spam messages. <add> <add>### Dealing with spam <add> <add>For the first spam post of a user, send them a message explaining the problem, and remove the link or post as appropriate. Leave a note on the user's profile explaining the action you have taken. If the problem persists, then follow the process above. Quietly block the user from posting (using the silence option on the User Admin panel), then send a warning with the Code of Conduct. Check the box in the private message indicating that your message is a "formal warning." <add> <add>You can ask questions and report incidents in the in the [staff forum section](https://forum.freecodecamp.com/c/staff). <add> <add>### Dealing with off-topic conversations <add> <add>Posts or topics that seems to be in the wrong place can be re-categorized or renamed to whatever would be appropriate. <add> <add>In exceptional circumstances, it may be appropriate for a moderator to fork a discussion into multiple threads. <add> <add>Again, if you have any problems or questions, make a post with your actions in the Staff category, and tag another moderator if you want them to review your moderating actions. <add> <add>### Underage Users <add> <add>Our Terms of Service require that freeCodeCamp users be at least 13 years of age. In the event that a user reveals that they are under the age of 13, send them the below message and delete their forum account (if deletion is not available, suspending the account is sufficient). Then email [Quincy](https://forum.freecodecamp.org/u/QuincyLarson) (quincy@freecodecamp.org) or [Mrugesh](https://forum.freecodecamp.org/u/raisedadead) (mrugesh@freecodecamp.org) to delete the user's freeCodeCamp account as well. <add> <add>```markdown <add>SUBJECT: Users under 13 are not allowed to use the forum per Terms of Service <add> <add>It has come to our attention that you are under 13 years of age. Per the [freeCodeCamp terms of service](https://www.freecodecamp.org/news/terms-of-service), you must be at least 13 years old to use the site or the forum. We will be deleting both your freeCodeCamp account and your forum account. This restriction keeps us in compliance with United States laws. <add> <add>Please rejoin once you have reached at least 13 years of age. <add> <add>Thank you for understanding. <add>``` <add> <add># Moderating Facebook <add> <add>If you see anything that seems to break our [Code of Conduct](https://code-of-conduct.freecodecamp.org/), you should delete it immediately. <add> <add>Sometimes people will post things that they think are funny. They don't realize that what they said or what they shared could be interpreted as offensive. In these cases, their post should be deleted, but the person who posted it doesn't necessarily need to be banned. By getting their post deleted, they will hopefully come to understand that what they posted was inappropriate. <add> <add>But if it is an egregious offense that can't reasonably be attributed to a cultural difference or a misunderstanding of the English language, then you should strongly consider blocking the member from the Facebook group. <add> <add># Moderating Discord <add> <add>Here's how moderators deal with violations of our [Code of Conduct](https://code-of-conduct.freecodecamp.org/) on Discord: <add> <add>1. **Make sure it was intended to violate the Code of Conduct.** <add> Not all violations of the CoC were intended as such. A new camper might post a large amount of code for help, unaware that this can be considered spamming. In these cases, you can just ask them to paste their code with services like Codepen or Pastebin. <add> <add>2. **If the camper clearly violates the Code of Conduct, the moderator will proceed as follows:** <add> <add>- Suspend the offending camper, but don't warn or threaten them. Instead, quietly give them the Suspended role on Discord, then send them the following message: <add> <add>``` <add>This is a standard message notifying you that I had to temporarily suspend you from talking on the freeCodeCamp Discord server. <add> <add>I am a moderator acting on behalf of our open source community. I can consider removing your suspension, but I need you to take the following 3 steps first: <add> <add>1. Read our Code of Conduct: https://code-of-conduct.freecodecamp.org/ <add>2. Message me back confirming that you have finished reading it. <add>3. Explain to me why you think I suspended you, and why I should remove your suspension. <add>``` <add> <add>- Report a short summary of the event and how they responded to it in the #admin channel. Here's an example of what such a summary might look like: <add> <add>``` <add>Suspended: _@username_ <add>Reason(s): _Spamming, trolling_ <add>Evidence: _One or more links to the offending message(s)_ <add>CoC: _Sent_ <add>``` <add> <add>- A report for removing a suspension should look like: <add> <add>``` <add>I’ve removed the suspension from ` @username `. I sent them the Code of Conduct. They just today realized they were suspended and apologized for what they did. <add>``` <add> <add>- Based on the offenders reply, the moderator will decide whether to remove the suspension from the offending camper. If they seem respectful and apologetic, the moderator can remove the suspension. As a matter of policy, moderators will be polite during this process, no matter how poorly the offending camper has behaved. If they aren't respectful or unwilling to accept the CoC, the suspension should be followed with a ban from the Discord server. Use the same summary as above, but replace "Suspended:" with "Banned:". <add> <add>3. **How to ban and/or unban** <add> <add>- In order to ban someone, right click on their username/profile picture and select "Ban <username>". You will be given the option to delete their previous messages - select "Don't delete any", as the messages should remain present as a historic record. <add>- If you decide to ban someone, it means they're unwilling to abide to our Code of Conduct. Therefore unbanning a Camper should rarely occur. However, if the need arises, you can do so by clicking on the server name, choosing "Server Settings", choosing "Bans", selecting the user you wish to unban, and clicking "Revoke Ban". <add> <add>Discord Bans are global - you cannot ban a user from a specific channel, only from the entire server. <add> <add>4. **Deleting messages** <add> Moderators have the ability to delete messages on Discord. They should only exercise this ability in four very specific situations: <add> <add>- Someone has posted a pornographic or graphically violent image. <add>- Someone has posted a link or code that is malicious in nature, and could harm other campers who click on it. <add>- Someone has flooded the chat with lots of spam messages to such an extreme extent (usually involving bots) as to render chat completely unusable. <add>- Someone has posted advertisement and / or a self-promoting message / image (social media). <add> <add>In all other situations - even situations where the code of conduct is violated - Moderators should not delete the message as these are an important historic record. When you do delete a message, make sure you take a screenshot of it first! The screenshot can be logged in the #mod-log channel, but for the #activity-log it is sufficient to say the evidence was "removed due to sensitive content". Note: If the message contains material that would be illegal to take a screenshot of, copy the message link instead - provide that message link to @raisedadead to forward to Discord's Trust and Safety team. <add> <add>5. **Don’t use @everyone or @here** <add> Don’t use @everyone or @here under any circumstances! Every single person in that chat room will get a notification. In some cases, tens of thousands of people. <add> Instead, if you want people to see an announcement, you can pin it to the channel to allow everyone to read it. <add> <add>6. **Don’t threaten to ban or suspend** <add> If a camper is breaking the code of conduct, don’t threaten to ban or suspend them, and never warn them in public. Instead, talk to them privately, or send them a DM and issue a suspension (per the above protocol). No one else in that channel needs to know that you banned / suspended the person - campers can view the summary in the #activity-log channel if they want to keep up on that information. If a violation was clearly unintended and doesn't warrant a suspension or private conversation, make the offending camper aware of his / her actions without making it come across as a warning. For example: <add> <add>- Camper posts a wall of code to request help <add> <add> Moderator: @username Please use Codepen or Pastebin when posting large amounts of code. <add> <add>- Or if you really have to explain why: <add> <add> Moderator: @username Please use Codepen or Pastebin when posting large amounts of code, because it disrupts the chat for everyone and could be considered spamming according to our Code of Conduct. <add> <add>- For mild and unintentional violations of the code of conduct <add> <add> Moderator: This is a friendly reminder for everyone to follow the code of conduct: https://code-of-conduct.freecodecamp.org/ <add> <add>7. **Don’t brag about being a moderator** <add> Do not see yourself as above the community. You are the community. And the community has trusted you to help protect something rare that we all share - a _welcoming_ place for new developers. <add> If you brag about being a moderator, people may feel uneasy around you, in the same way that people may feel uneasy around a police officer, even if they’re doing nothing wrong. This is just human nature. <add> <add>8. **Don’t contradict other moderators** <add> If you disagree with the action of a moderator, talk with them in private or bring it up in the #mod-chat channel. Never override a ban, and never contradict the other moderator(s) publicly. Instead, have a cool-headed discussion in mod-chat and convince the moderator that they themselves should reverse their ban or change their point of view. <add> Remember: we’re all on the same team. We want to dignify the role of moderators and present a unified front. <add> <add>9. **Talk with other moderators** <add> We have a room for moderators only. Use it! If you feel uncomfortable with how to handle a certain situation, ask other moderators for help. If you think something should be discussed, do it. You're part of the team and we value the input of every team member! Even if you totally disagree with anything in these guidelines or the Code of Conduct! <add> <add>10. **Temporarily inactive** <add> If you're not going to be active as a Moderator for a while due to vacation, illness or any other reason, make sure to let the others know in the #mod-chat channel. This is so we know if we can count on you to be regularly active in the server or not. <add> <add># How to become a moderator <add> <add>If you are helping people in the community consistently over time, our Moderator Team will eventually take notice, and one of them will mention you as a possible moderator to [our staff](https://forum.freecodecamp.org/g/Team). There are no shortcuts to becoming a moderator. <add> <add>If you are approved, we will add you to our Moderator Teams on [GitHub](https://github.com/orgs/freeCodeCamp/teams/moderators), [forum](https://forum.freecodecamp.org/g/moderators), etc. <add> <add>> [!NOTE] > **For GitHub:** After you've been accepted as a moderator, you will receive a Github repository invitation. You'll need to head over towards [freeCodeCamp GitHub Organisation Invitation](https://github.com/orgs/freeCodeCamp/invitation) to be able to accept the invitation. This is required for us to be able to give you write access on some of our repositories. <add> <add># How we retire inactive moderators <add> <add>Please note that we will frequently remove mods whom we think are inactive. When we do this we will send the following message: <add> <add>> This is a standard message notifying you that, since you don't seem to have been an active moderator recently, we're removing you from our Moderator team. We deeply appreciate your help in the past. <add> <add>> If you think we did this in error, or once you're ready to come back and contribute more, just reply to this message letting me know. <add> <add># How our Contributors room works <add> <add>Anyone is welcome in the [Contributors room on our Discord](https://discord.gg/KVUmVXA). It is the designated chat room for moderators and other campers who are contributing to our community in any number of ways, including through study groups. <add> <add>Our assumption is that contributors will read anything in this room that directly mentions them with an `@username`. Everything else is optional. But feel free to read anything anyone posts in there and interact. <add> <add># Dealing with solicitors <add> <add>You may be approached by organizations who want to partner or co-brand with freeCodeCamp in some way. Once you realize that this is what they're after, please stop talking to them and tell them to email quincy@freecodecamp.org. He gets proposals like this all the time and is in the best position to judge whether such a relationship will be worth it for our community (and it rarely is). <add> <add># A note on free speech <add> <add>Sometimes people will defend something offensive or incendiary that they said as "free speech." <add> <add>This XKCD comic perfectly summarizes most communities' thoughts on free speech. So if someone defends something they're saying as "free speech" feel free to send it to them. <add> <add><div align="center"><img src='https://aws1.discourse-cdn.com/freecodecamp/original/3X/4/3/43a8b2eafe4c8622e02838f66f1dc6227de32c70.png' width="400" height="400" /></div> <add> <add>Thanks for reading this, and thanks for helping the developer community!
2
Ruby
Ruby
fix unexpected wrong variable name
cfc1821e2c6b0c162cb2d675fae33ca6f08a62bb
<ide><path>Library/Homebrew/tap.rb <ide> def fix_remote_configuration(requested_remote: nil, quiet: false) <ide> path.git_origin_set_head_auto <ide> <ide> new_upstream_head = path.git_origin_branch <del> return if new_upstream_head == old_upstream_head <add> return if new_upstream_head == current_upstream_head <ide> <ide> path.git_rename_branch old: current_upstream_head, new: new_upstream_head <ide> path.git_branch_set_upstream local: new_upstream_head, origin: new_upstream_head
1
Text
Text
use es6 in animation examples
6a133d78a8fe78f92f1c33dfa969896b96e2e38d
<ide><path>docs/Animations.md <ide> UIManager.setLayoutAnimationEnabledExperimental && UIManager.setLayoutAnimationE <ide> ![](img/LayoutAnimationExample.gif) <ide> <ide> ```javascript <del>var App = React.createClass({ <add>class App extends React.Component { <add> constructor(props) { <add> super(props); <add> this.state = { w: 100, h: 100 }; <add> this._onPress = this._onPress.bind(this); <add> } <add> <ide> componentWillMount() { <ide> // Animate creation <ide> LayoutAnimation.spring(); <ide> }, <ide> <del> getInitialState() { <del> return { w: 100, h: 100 } <del> }, <del> <ide> _onPress() { <ide> // Animate the update <ide> LayoutAnimation.spring(); <ide> this.setState({w: this.state.w + 15, h: this.state.h + 15}) <del> }, <add> } <ide> <del> render: function() { <add> render() { <ide> return ( <ide> <View style={styles.container}> <ide> <View style={[styles.box, {width: this.state.w, height: this.state.h}]} /> <ide> var App = React.createClass({ <ide> </View> <ide> ); <ide> } <del>}); <add>}; <ide> ``` <ide> [Run this example](https://rnplay.org/apps/uaQrGQ) <ide> <ide> your project, you will need to install it with `npm i react-tween-state <ide> <ide> ```javascript <ide> import tweenState from 'react-tween-state'; <add>import reactMixin from 'react-mixin'; // https://github.com/brigand/react-mixin <ide> <del>var App = React.createClass({ <del> mixins: [tweenState.Mixin], <del> <del> getInitialState() { <del> return { opacity: 1 } <del> }, <add>class App extends React.Component { <add> constructor(props) { <add> super(props); <add> this.state = { opacity: 1 }; <add> this._animateOpacity = this._animateOpacity.bind(this); <add> } <ide> <ide> _animateOpacity() { <ide> this.tweenState('opacity', { <ide> easing: tweenState.easingTypes.easeOutQuint, <ide> duration: 1000, <ide> endValue: this.state.opacity === 0.2 ? 1 : 0.2, <ide> }); <del> }, <add> } <ide> <ide> render() { <ide> return ( <ide> var App = React.createClass({ <ide> </TouchableWithoutFeedback> <ide> </View> <ide> ) <del> }, <del>}); <add> } <add>} <add> <add>reactMixin.onClass(App, tweenState.Mixin); <ide> ``` <ide> [Run this example](https://rnplay.org/apps/4FUQ-A) <ide> <ide> the original value. <ide> ```javascript <ide> import rebound from 'rebound'; <ide> <del>var App = React.createClass({ <add>class App extends React.Component { <add> constructor(props) { <add> super(props); <add> this._onPressIn = this._onPressIn.bind(this); <add> this._onPressOut = this._onPressOut.bind(this); <add> } <ide> // First we initialize the spring and add a listener, which calls <ide> // setState whenever it updates <ide> componentWillMount() { <ide> var App = React.createClass({ <ide> <ide> // Initialize the spring value at 1 <ide> this._scrollSpring.setCurrentValue(1); <del> }, <add> } <ide> <ide> _onPressIn() { <ide> this._scrollSpring.setEndValue(0.5); <del> }, <add> } <ide> <ide> _onPressOut() { <ide> this._scrollSpring.setEndValue(1); <del> }, <add> } <ide> <del> render: function() { <add> render() { <ide> var imageStyle = { <ide> width: 250, <ide> height: 200, <ide> var App = React.createClass({ <ide> </View> <ide> ); <ide> } <del>}); <add>} <ide> ``` <ide> [Run this example](https://rnplay.org/apps/NNI5eA) <ide> <ide> this._scrollSpring.addListener({ <ide> // Lastly, we update the render function to no longer pass in the <ide> // transform via style (avoid clashes when re-rendering) and to set the <ide> // photo ref <del>render: function() { <add>render() { <ide> return ( <ide> <View style={styles.container}> <ide> <TouchableWithoutFeedback onPressIn={this._onPressIn} onPressOut={this._onPressOut}>
1
Ruby
Ruby
use grep instead of select + is_a?
828bb94d5a41695d30cb46ccafb152c98cdeae0a
<ide><path>activerecord/lib/active_record/reflection.rb <ide> def reflections <ide> <ide> # Returns an array of AggregateReflection objects for all the aggregations in the class. <ide> def reflect_on_all_aggregations <del> reflections.values.select { |reflection| reflection.is_a?(AggregateReflection) } <add> reflections.values.grep(AggregateReflection) <ide> end <ide> <ide> # Returns the AggregateReflection object for the named +aggregation+ (use the symbol). <ide> def reflect_on_aggregation(aggregation) <ide> # Account.reflect_on_all_associations(:has_many) # returns an array of all has_many associations <ide> # <ide> def reflect_on_all_associations(macro = nil) <del> association_reflections = reflections.values.select { |reflection| reflection.is_a?(AssociationReflection) } <add> association_reflections = reflections.values.grep(AssociationReflection) <ide> macro ? association_reflections.select { |reflection| reflection.macro == macro } : association_reflections <ide> end <ide>
1
Javascript
Javascript
support meridiemhour in locales
c70661abc8e98a9ce872abfe1185d5bff101d6d3
<ide><path>moment.js <ide> formatTokenFunctions.DDDD = padToken(formatTokenFunctions.DDD, 3); <ide> <ide> <add> function meridiemFixWrap(locale, hour, meridiem) { <add> var isPm; <add> <add> if (meridiem == null) { <add> // nothing to do <add> return hour; <add> } <add> if (locale.meridiemHour != null) { <add> return locale.meridiemHour(hour, meridiem); <add> } else if (locale.isPM != null) { <add> // Fallback <add> isPm = locale.isPM(meridiem); <add> if (isPm && hour < 12) { <add> hour += 12; <add> } <add> if (!isPm && hour === 12) { <add> hour = 0; <add> } <add> return hour; <add> } else { <add> // thie is not supposed to happen <add> return hour; <add> } <add> } <add> <ide> /************************************ <ide> Constructors <ide> ************************************/ <ide> } <ide> }, <ide> <add> <ide> _calendar : { <ide> sameDay : '[Today at] LT', <ide> nextDay : '[Tomorrow at] LT', <ide> // AM / PM <ide> case 'a' : // fall through to A <ide> case 'A' : <del> config._isPm = config._locale.isPM(input); <add> config._meridiem = input; <add> // config._isPm = config._locale.isPM(input); <ide> break; <ide> // HOUR <ide> case 'h' : // fall through to hh <ide> if (config._pf.bigHour === true && config._a[HOUR] <= 12) { <ide> config._pf.bigHour = undefined; <ide> } <del> // handle am pm <del> if (config._isPm && config._a[HOUR] < 12) { <del> config._a[HOUR] += 12; <del> } <del> // if is 12 am, change hours to 0 <del> if (config._isPm === false && config._a[HOUR] === 12) { <del> config._a[HOUR] = 0; <del> } <add> // handle meridiem <add> config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], <add> config._meridiem); <ide> dateFromConfig(config); <ide> checkOverflow(config); <ide> }
1
Mixed
Javascript
overhaul the flexbox documentation
64cdc3547c7253114435870621209ad51f3c8e01
<ide><path>Libraries/StyleSheet/LayoutPropTypes.js <ide> var ReactPropTypes = require('ReactPropTypes'); <ide> * <ide> * The implementation in css-layout is slightly different from what the <ide> * Flexbox spec defines - for example, we chose more sensible default <del> * values. Please refer to the css-layout README for details. <add> * values. Since our layout docs are generated from the comments in this <add> * file, please keep a brief comment describing each prop type. <ide> * <ide> * These properties are a subset of our styles that are consumed by the layout <ide> * algorithm and affect the positioning and sizing of views. <ide> */ <ide> var LayoutPropTypes = { <add> /** `width` sets the width of this component. <add> * <add> * It works similarly to `width` in CSS, but in React Native you <add> * must use logical pixel units, rather than percents, ems, or any of that. <add> * See http://www.w3schools.com/cssref/pr_dim_width.asp for more details. <add> */ <ide> width: ReactPropTypes.number, <add> <add> /** `height` sets the height of this component. <add> * <add> * It works similarly to `height` in CSS, but in React Native you <add> * must use logical pixel units, rather than percents, ems, or any of that. <add> * See http://www.w3schools.com/cssref/pr_dim_width.asp for more details. <add> */ <ide> height: ReactPropTypes.number, <add> <add> /** `top` is the number of logical pixels to offset the top edge of <add> * this component. <add> * <add> * It works similarly to `top` in CSS, but in React Native you must <add> * use logical pixel units, rather than percents, ems, or any of that. <add> * <add> * See https://developer.mozilla.org/en-US/docs/Web/CSS/top <add> * for more details of how `top` affects layout. <add> */ <ide> top: ReactPropTypes.number, <add> <add> /** `left` is the number of logical pixels to offset the left edge of <add> * this component. <add> * <add> * It works similarly to `left` in CSS, but in React Native you must <add> * use logical pixel units, rather than percents, ems, or any of that. <add> * <add> * See https://developer.mozilla.org/en-US/docs/Web/CSS/left <add> * for more details of how `left` affects layout. <add> */ <ide> left: ReactPropTypes.number, <add> <add> /** `right` is the number of logical pixels to offset the right edge of <add> * this component. <add> * <add> * It works similarly to `right` in CSS, but in React Native you must <add> * use logical pixel units, rather than percents, ems, or any of that. <add> * <add> * See https://developer.mozilla.org/en-US/docs/Web/CSS/right <add> * for more details of how `right` affects layout. <add> */ <ide> right: ReactPropTypes.number, <add> <add> /** `bottom` is the number of logical pixels to offset the bottom edge of <add> * this component. <add> * <add> * It works similarly to `bottom` in CSS, but in React Native you must <add> * use logical pixel units, rather than percents, ems, or any of that. <add> * <add> * See https://developer.mozilla.org/en-US/docs/Web/CSS/bottom <add> * for more details of how `top` affects layout. <add> */ <ide> bottom: ReactPropTypes.number, <add> <add> /** `minWidth` is the minimum width for this component, in logical pixels. <add> * <add> * It works similarly to `min-width` in CSS, but in React Native you <add> * must use logical pixel units, rather than percents, ems, or any of that. <add> * <add> * See http://www.w3schools.com/cssref/pr_dim_min-width.asp <add> * for more details. <add> */ <ide> minWidth: ReactPropTypes.number, <add> <add> /** `maxWidth` is the maximum width for this component, in logical pixels. <add> * <add> * It works similarly to `max-width` in CSS, but in React Native you <add> * must use logical pixel units, rather than percents, ems, or any of that. <add> * <add> * See http://www.w3schools.com/cssref/pr_dim_max-width.asp <add> * for more details. <add> */ <ide> maxWidth: ReactPropTypes.number, <add> <add> /** `minHeight` is the minimum height for this component, in logical pixels. <add> * <add> * It works similarly to `min-height` in CSS, but in React Native you <add> * must use logical pixel units, rather than percents, ems, or any of that. <add> * <add> * See http://www.w3schools.com/cssref/pr_dim_min-height.asp <add> * for more details. <add> */ <ide> minHeight: ReactPropTypes.number, <add> <add> /** `maxHeight` is the maximum height for this component, in logical pixels. <add> * <add> * It works similarly to `max-height` in CSS, but in React Native you <add> * must use logical pixel units, rather than percents, ems, or any of that. <add> * <add> * See http://www.w3schools.com/cssref/pr_dim_max-height.asp <add> * for more details. <add> */ <ide> maxHeight: ReactPropTypes.number, <add> <add> /** Setting `margin` has the same effect as setting each of <add> * `marginTop`, `marginLeft`, `marginBottom`, and `marginRight`. <add> */ <ide> margin: ReactPropTypes.number, <add> <add> /** Setting `marginVertical` has the same effect as setting both <add> * `marginTop` and `marginBottom`. <add> */ <ide> marginVertical: ReactPropTypes.number, <add> <add> /** Setting `marginHorizontal` has the same effect as setting <add> * both `marginLeft` and `marginRight`. <add> */ <ide> marginHorizontal: ReactPropTypes.number, <add> <add> /** `marginTop` works like `margin-top` in CSS. <add> * See http://www.w3schools.com/cssref/pr_margin-top.asp <add> * for more details. <add> */ <ide> marginTop: ReactPropTypes.number, <add> <add> /** `marginBottom` works like `margin-bottom` in CSS. <add> * See http://www.w3schools.com/cssref/pr_margin-bottom.asp <add> * for more details. <add> */ <ide> marginBottom: ReactPropTypes.number, <add> <add> /** `marginLeft` works like `margin-left` in CSS. <add> * See http://www.w3schools.com/cssref/pr_margin-left.asp <add> * for more details. <add> */ <ide> marginLeft: ReactPropTypes.number, <add> <add> /** `marginRight` works like `margin-right` in CSS. <add> * See http://www.w3schools.com/cssref/pr_margin-right.asp <add> * for more details. <add> */ <ide> marginRight: ReactPropTypes.number, <add> <add> /** `padding` works like `padding` in CSS. <add> * It's like setting each of `paddingTop`, `paddingBottom`, <add> * `paddingLeft`, and `paddingRight` to the same thing. <add> * See http://www.w3schools.com/css/css_padding.asp <add> * for more details. <add> */ <ide> padding: ReactPropTypes.number, <add> <add> /** Setting `paddingVertical` is like setting both of <add> * `paddingTop` and `paddingBottom`. <add> */ <ide> paddingVertical: ReactPropTypes.number, <add> <add> /** Setting `paddingHorizontal` is like setting both of <add> * `paddingLeft` and `paddingRight`. <add> */ <ide> paddingHorizontal: ReactPropTypes.number, <add> <add> /** `paddingTop` works like `padding-top` in CSS. <add> * See http://www.w3schools.com/cssref/pr_padding-top.asp <add> * for more details. <add> */ <ide> paddingTop: ReactPropTypes.number, <add> <add> /** `paddingBottom` works like `padding-bottom` in CSS. <add> * See http://www.w3schools.com/cssref/pr_padding-bottom.asp <add> * for more details. <add> */ <ide> paddingBottom: ReactPropTypes.number, <add> <add> /** `paddingLeft` works like `padding-left` in CSS. <add> * See http://www.w3schools.com/cssref/pr_padding-left.asp <add> * for more details. <add> */ <ide> paddingLeft: ReactPropTypes.number, <add> <add> /** `paddingRight` works like `padding-right` in CSS. <add> * See http://www.w3schools.com/cssref/pr_padding-right.asp <add> * for more details. <add> */ <ide> paddingRight: ReactPropTypes.number, <add> <add> /** `borderWidth` works like `border-width` in CSS. <add> * See http://www.w3schools.com/cssref/pr_border-width.asp <add> * for more details. <add> */ <ide> borderWidth: ReactPropTypes.number, <add> <add> /** `borderTopWidth` works like `border-top-width` in CSS. <add> * See http://www.w3schools.com/cssref/pr_border-top_width.asp <add> * for more details. <add> */ <ide> borderTopWidth: ReactPropTypes.number, <add> <add> /** `borderRightWidth` works like `border-right-width` in CSS. <add> * See http://www.w3schools.com/cssref/pr_border-right_width.asp <add> * for more details. <add> */ <ide> borderRightWidth: ReactPropTypes.number, <add> <add> /** `borderBottomWidth` works like `border-bottom-width` in CSS. <add> * See http://www.w3schools.com/cssref/pr_border-bottom_width.asp <add> * for more details. <add> */ <ide> borderBottomWidth: ReactPropTypes.number, <add> <add> /** `borderLeftWidth` works like `border-left-width` in CSS. <add> * See http://www.w3schools.com/cssref/pr_border-bottom_width.asp <add> * for more details. <add> */ <ide> borderLeftWidth: ReactPropTypes.number, <ide> <add> /** `position` in React Native is similar to regular CSS, but <add> * everything is set to `relative` by default, so `absolute` <add> * positioning is always just relative to the parent. <add> * <add> * If you want to position a child using specific numbers of logical <add> * pixels relative to its parent, set the child to have `absolute` <add> * position. <add> * <add> * If you want to position a child relative to something <add> * that is not its parent, just don't use styles for that. Use the <add> * component tree. <add> * <add> * See https://github.com/facebook/css-layout <add> * for more details on how `position` differs between React Native <add> * and CSS. <add> */ <ide> position: ReactPropTypes.oneOf([ <ide> 'absolute', <ide> 'relative' <ide> ]), <ide> <del> // https://developer.mozilla.org/en-US/docs/Web/CSS/flex-direction <add> /** `flexDirection` controls which directions children of a container go. <add> * `row` goes left to right, `column` goes top to bottom, and you may <add> * be able to guess what the other two do. It works like `flex-direction` <add> * in CSS, except the default is `column`. See <add> * https://css-tricks.com/almanac/properties/f/flex-direction/ <add> * for more detail. <add> */ <ide> flexDirection: ReactPropTypes.oneOf([ <ide> 'row', <ide> 'row-reverse', <ide> 'column', <ide> 'column-reverse' <ide> ]), <ide> <del> // https://developer.mozilla.org/en-US/docs/Web/CSS/flex-wrap <add> /** `flexWrap` controls whether children can wrap around after they <add> * hit the end of a flex container. <add> * It works like `flex-wrap` in CSS. See <add> * https://css-tricks.com/almanac/properties/f/flex-wrap/ <add> * for more detail. <add> */ <ide> flexWrap: ReactPropTypes.oneOf([ <ide> 'wrap', <ide> 'nowrap' <ide> ]), <ide> <del> // How to align children in the main direction <del> // https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content <add> /** `justifyContent` aligns children in the main direction. <add> * For example, if children are flowing vertically, `justifyContent` <add> * controls how they align vertically. <add> * It works like `justify-content` in CSS. See <add> * https://css-tricks.com/almanac/properties/j/justify-content/ <add> * for more detail. <add> */ <ide> justifyContent: ReactPropTypes.oneOf([ <ide> 'flex-start', <ide> 'flex-end', <ide> var LayoutPropTypes = { <ide> 'space-around' <ide> ]), <ide> <del> // How to align children in the cross direction <del> // https://developer.mozilla.org/en-US/docs/Web/CSS/align-items <add> /** `alignItems` aligns children in the cross direction. <add> * For example, if children are flowing vertically, `alignItems` <add> * controls how they align horizontally. <add> * It works like `align-items` in CSS, except the default value <add> * is `stretch` instead of `flex-start`. See <add> * https://css-tricks.com/almanac/properties/a/align-items/ <add> * for more detail. <add> */ <ide> alignItems: ReactPropTypes.oneOf([ <ide> 'flex-start', <ide> 'flex-end', <ide> 'center', <ide> 'stretch' <ide> ]), <ide> <del> // How to align the element in the cross direction <del> // https://developer.mozilla.org/en-US/docs/Web/CSS/align-items <add> /** `alignSelf` controls how a child aligns in the cross direction, <add> * overriding the `alignItems` of the parent. It works like `align-self` <add> * in CSS. See <add> * https://css-tricks.com/almanac/properties/a/align-self/ <add> * for more detail. <add> */ <ide> alignSelf: ReactPropTypes.oneOf([ <ide> 'auto', <ide> 'flex-start', <ide> var LayoutPropTypes = { <ide> 'stretch' <ide> ]), <ide> <del> // https://developer.mozilla.org/en-US/docs/Web/CSS/flex <add> /** In React Native `flex` does not work the same way that it does in CSS. <add> * `flex` is a number rather than a string, and it works <add> * according to the `css-layout` library <add> * at https://github.com/facebook/css-layout . <add> * <add> * When `flex` is a positive number, it makes the component flexible <add> * and it will be sized proportional to its flex value. So a <add> * component with `flex` set to 2 will take twice the space as a <add> * component with `flex` set to 1. <add> * <add> * When `flex` is 0, the component is sized according to `width` <add> * and `height` and it is inflexible. <add> * <add> * When `flex` is -1, the component is normally sized according <add> * `width` and `height`. However, if there's not enough space, <add> * the component will shrink to its `minWidth` and `minHeight`. <add> */ <ide> flex: ReactPropTypes.number, <ide> <del> // https://developer.mozilla.org/en-US/docs/Web/CSS/z-index <add> /** `zIndex` controls which components display on top of others. <add> * Normally, you don't use `zIndex`. Components render according to <add> * their order in the document tree, so later components draw over <add> * earlier ones. `zIndex` may be useful if you have animations or custom <add> * modal interfaces where you don't want this behavior. <add> * <add> * It works like the CSS `z-index` property - components with a larger <add> * `zIndex` will render on top. Think of the z-direction like it's <add> * pointing from the phone into your eyeball. See <add> * https://developer.mozilla.org/en-US/docs/Web/CSS/z-index for <add> * more detail. <add> */ <ide> zIndex: ReactPropTypes.number, <ide> }; <ide> <ide><path>docs/Basics-Layout.md <ide> --- <ide> id: basics-layout <del>title: Layout <add>title: Layout with Flexbox <ide> layout: docs <ide> category: The Basics <del>permalink: docs/basics-layout.html <add>permalink: docs/flexbox.html <ide> next: basics-component-textinput <ide> --- <ide> <ide> A component can specify the layout of its children using the flexbox algorithm. Flexbox is designed to provide a consistent layout on different screen sizes. <ide> <ide> You will normally use a combination of `flexDirection`, `alignItems`, and `justifyContent` to achieve the right layout. <ide> <del>> Flexbox works the same way in React Native as it does in CSS on the web, with a few exceptions. The most notable one: the defaults are different, with `flexDirection` defaulting to `column` instead of `row`, and `alignItems` defaulting to `stretch` instead of `flex-start`. <add>> Flexbox works the same way in React Native as it does in CSS on the web, with a few exceptions. The defaults are different, with `flexDirection` defaulting to `column` instead of `row`, and `alignItems` defaulting to `stretch` instead of `flex-start`, and the `flex` parameter only supports a single number. <ide> <ide> #### Flex Direction <ide> <ide> class AlignItemsBasics { <ide> AppRegistry.registerComponent('AwesomeProject', () => AlignItemsBasics); <ide> ``` <ide> <del>#### API Reference <add>#### Going Deeper <ide> <del>We've covered the basics, but there are many other styles you may need for layouts. The full list is available [here](./docs/flexbox.html). <add>We've covered the basics, but there are many other styles you may need for layouts. The full list of props that control layout is documented [here](./docs/layout-props.html). <ide><path>website/server/extractDocs.js <ide> function removeExtName(filepath) { <ide> function getNameFromPath(filepath) { <ide> filepath = removeExtName(filepath); <ide> if (filepath === 'LayoutPropTypes') { <del> return 'Flexbox'; <add> return 'Layout Props'; <add> } else if (filepath == 'ShadowPropTypesIOS') { <add> return 'Shadow Props'; <ide> } else if (filepath === 'TransformPropTypes') { <ide> return 'Transforms'; <ide> } else if (filepath === 'TabBarItemIOS') {
3
Python
Python
add sdist command
252299ca2a518ea2d6e1e04208bce516e9d1ef59
<ide><path>fabfile.py <ide> def make(): <ide> local('pip install -r requirements.txt') <ide> local('python setup.py build_ext --inplace') <ide> <add>def sdist(): <add> with virtualenv(VENV_DIR): <add> with lcd(path.dirname(__file__)): <add> local('python setup.py sdist') <ide> <ide> def clean(): <ide> with lcd(path.dirname(__file__)):
1
Python
Python
add unit tests for mssqlhook
42fbf9df4751f64a0ff71762466388a676de5946
<ide><path>tests/providers/microsoft/mssql/hooks/__init__.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. <ide><path>tests/providers/microsoft/mssql/hooks/test_mssql.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>import unittest <add> <add>import mock <add> <add>from airflow import PY38 <add>from airflow.models import Connection <add> <add>if not PY38: <add> from airflow.providers.microsoft.mssql.hooks.mssql import MsSqlHook <add> <add>PYMSSQL_CONN = Connection(host='ip', schema='share', login='username', password='password', port=8081) <add> <add> <add>class TestMsSqlHook(unittest.TestCase): <add> @unittest.skipIf(PY38, "Mssql package not available when Python >= 3.8.") <add> @mock.patch('airflow.providers.microsoft.mssql.hooks.mssql.MsSqlHook.get_conn') <add> @mock.patch('airflow.hooks.dbapi_hook.DbApiHook.get_connection') <add> def test_get_conn_should_return_connection(self, get_connection, mssql_get_conn): <add> get_connection.return_value = PYMSSQL_CONN <add> mssql_get_conn.return_value = mock.Mock() <add> <add> hook = MsSqlHook() <add> conn = hook.get_conn() <add> <add> self.assertEqual(mssql_get_conn.return_value, conn) <add> mssql_get_conn.assert_called_once() <add> <add> @unittest.skipIf(PY38, "Mssql package not available when Python >= 3.8.") <add> @mock.patch('airflow.providers.microsoft.mssql.hooks.mssql.MsSqlHook.get_conn') <add> @mock.patch('airflow.hooks.dbapi_hook.DbApiHook.get_connection') <add> def test_set_autocommit_should_invoke_autocommit(self, get_connection, mssql_get_conn): <add> get_connection.return_value = PYMSSQL_CONN <add> mssql_get_conn.return_value = mock.Mock() <add> autocommit_value = mock.Mock() <add> <add> hook = MsSqlHook() <add> conn = hook.get_conn() <add> <add> hook.set_autocommit(conn, autocommit_value) <add> mssql_get_conn.assert_called_once() <add> mssql_get_conn.return_value.autocommit.assert_called_once_with(autocommit_value) <add> <add> @unittest.skipIf(PY38, "Mssql package not available when Python >= 3.8.") <add> @mock.patch('airflow.providers.microsoft.mssql.hooks.mssql.MsSqlHook.get_conn') <add> @mock.patch('airflow.hooks.dbapi_hook.DbApiHook.get_connection') <add> def test_get_autocommit_should_return_autocommit_state(self, get_connection, mssql_get_conn): <add> get_connection.return_value = PYMSSQL_CONN <add> mssql_get_conn.return_value = mock.Mock() <add> mssql_get_conn.return_value.autocommit_state = 'autocommit_state' <add> <add> hook = MsSqlHook() <add> conn = hook.get_conn() <add> <add> mssql_get_conn.assert_called_once() <add> self.assertEqual(hook.get_autocommit(conn), 'autocommit_state') <ide><path>tests/test_project_structure.py <ide> 'tests/providers/google/cloud/utils/test_mlengine_prediction_summary.py', <ide> 'tests/providers/microsoft/azure/sensors/test_azure_cosmos.py', <ide> 'tests/providers/microsoft/azure/log/test_wasb_task_handler.py', <del> 'tests/providers/microsoft/mssql/hooks/test_mssql.py', <ide> 'tests/providers/samba/hooks/test_samba.py' <ide> } <ide>
3
Mixed
Javascript
revise image example with layouts near the top
17a53e27656cb74700d1da3296179e94f3646e59
<ide><path>examples/image-component/README.md <ide> <ide> This example shows how to use the [Image Component in Next.js](https://nextjs.org/docs/api-reference/next/image) serve optimized, responsive images. <ide> <del>The index page ([`pages/index.js`](pages/index.js)) has a couple images, one internal image and one external image. In [`next.config.js`](next.config.js), the `domains` property is used to enable external images. Run or deploy the app to see how it works! <add>The index page ([`pages/index.js`](pages/index.js)) has a couple images, one internal image and one external image. In [`next.config.js`](next.config.js), the `domains` property is used to enable external images. The other pages demonstrate the different layouts. Run or deploy the app to see how it works! <ide> <ide> ## Deploy your own <ide> <ide><path>examples/image-component/pages/index.js <ide> const Index = () => ( <ide> <div className={styles.card}> <ide> <h1>Image Component with Next.js</h1> <ide> <p> <del> The images below use the{' '} <add> This page demonstrates the usage of the{' '} <ide> <a href="https://nextjs.org/docs/api-reference/next/image"> <ide> next/image <ide> </a>{' '} <del> component to ensure optimal format and size for this browser. <add> component with live examples. <ide> </p> <ide> <p> <del> Images are also lazy loaded by default which means they don't load until <del> scrolled into view. <del> </p> <del> <p>Try scolling down to try it out!</p> <del> <hr className={styles.hr} /> <del> <p> <del> The following is an example of a reference to an interal image from the{' '} <del> <Code>public</Code> directory. <del> </p> <del> <p> <del> Notice that the image is responsive. As you adjust your browser width, a <del> different sized image is loaded. <del> </p> <del> <Image alt="Vercel logo" src="/vercel.png" width={1000} height={1000} /> <del> <hr className={styles.hr} /> <del> <p> <del> The following is an example of a reference to an external image at{' '} <del> <Code>assets.vercel.com</Code>. <del> </p> <del> <p> <del> External domains must be configured in <Code>next.config.js</Code> using <del> the <Code>domains</Code> property. <add> This component is designed to{' '} <add> <a href="https://nextjs.org/docs/basic-features/image-optimization"> <add> automatically optimizate <add> </a>{' '} <add> images on-demand as the browser requests them. <ide> </p> <del> <Image <del> alt="Next.js logo" <del> src="https://assets.vercel.com/image/upload/v1538361091/repositories/next-js/next-js-bg.png" <del> width={1200} <del> height={400} <del> /> <ide> <hr className={styles.hr} /> <del> <h2>Layouts</h2> <add> <h2 id="layout">Layout</h2> <ide> <p> <del> The following pages demonstrate possible <Code>layout</Code> property <del> values. <add> The <Code>layout</Code> property tells the image to respond differently <add> depending on the device size or the container size. <ide> </p> <ide> <p> <del> Click on one to try it out with your current device and be sure to <del> change the window size or rotate your device to see how the image <del> reacts. <add> Select a layout below and try resizing the window or rotating your <add> device to see how the image reacts. <ide> </p> <ide> <ul> <ide> <li> <ide> const Index = () => ( <ide> </li> <ide> </ul> <ide> <hr className={styles.hr} /> <del> Checkout the documentation for{' '} <del> <a href="https://nextjs.org/docs/basic-features/image-optimization"> <del> Image Optimization <del> </a>{' '} <del> to learn more. <add> <h2 id="internal">Internal Image</h2> <add> <p> <add> The following is an example of a reference to an interal image from the{' '} <add> <Code>public</Code> directory. <add> </p> <add> <p> <add> This image is intentionally large so you have to scroll down to the next <add> image. <add> </p> <add> <Image alt="Vercel logo" src="/vercel.png" width={1000} height={1000} /> <add> <hr className={styles.hr} /> <add> <h2 id="external">External Image</h2> <add> <p> <add> The following is an example of a reference to an external image at{' '} <add> <Code>assets.vercel.com</Code>. <add> </p> <add> <p> <add> External domains must be configured in <Code>next.config.js</Code> using <add> the <Code>domains</Code> property. <add> </p> <add> <Image <add> alt="Next.js logo" <add> src="https://assets.vercel.com/image/upload/v1538361091/repositories/next-js/next-js-bg.png" <add> width={1200} <add> height={400} <add> /> <add> <hr className={styles.hr} /> <add> <h2 id="more">Learn More</h2> <add> <p> <add> You can optionally configure a cloud provider, device sizes, and more! <add> </p> <add> <p> <add> Checkout the{' '} <add> <a href="https://nextjs.org/docs/basic-features/image-optimization"> <add> Image Optimization documentation <add> </a>{' '} <add> to learn more. <add> </p> <ide> </div> <ide> </div> <ide> )
2
Java
Java
introduce write aggregator to databufferutils
69ccba30e978351acdee12b990f989e97b8a72b0
<ide><path>spring-core/src/main/java/org/springframework/core/io/buffer/DataBufferUtils.java <ide> /* <del> * Copyright 2002-2017 the original author or authors. <add> * Copyright 2002-2018 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> import java.util.concurrent.atomic.AtomicBoolean; <ide> import java.util.concurrent.atomic.AtomicLong; <ide> import java.util.function.BiFunction; <add>import java.util.function.BinaryOperator; <ide> import java.util.function.Consumer; <ide> <ide> import org.reactivestreams.Publisher; <ide> public abstract class DataBufferUtils { <ide> <ide> private static final Consumer<DataBuffer> RELEASE_CONSUMER = DataBufferUtils::release; <ide> <add> private static final BinaryOperator<DataBuffer> WRITE_AGGREGATOR = <add> (dataBuffer1, dataBuffer2) -> { <add> DataBuffer result = dataBuffer1.write(dataBuffer2); <add> release(dataBuffer2); <add> return result; <add> }; <add> <ide> //--------------------------------------------------------------------- <ide> // Reading <ide> //--------------------------------------------------------------------- <ide> private static void closeChannel(@Nullable Channel channel) { <ide> } <ide> } <ide> <add> //--------------------------------------------------------------------- <add> // Various <add> //--------------------------------------------------------------------- <add> <ide> /** <ide> * Relay buffers from the given {@link Publisher} until the total <ide> * {@linkplain DataBuffer#readableByteCount() byte count} reaches <ide> public static Flux<DataBuffer> takeUntilByteCount(Publisher<DataBuffer> publishe <ide> }); <ide> } <ide> <del> //--------------------------------------------------------------------- <del> // Various <del> //--------------------------------------------------------------------- <del> <ide> /** <ide> * Skip buffers from the given {@link Publisher} until the total <ide> * {@linkplain DataBuffer#readableByteCount() byte count} reaches <ide> public static boolean release(@Nullable DataBuffer dataBuffer) { <ide> } <ide> <ide> /** <del> * Returns a consumer that calls {@link #release(DataBuffer)} on all <add> * Return a consumer that calls {@link #release(DataBuffer)} on all <ide> * passed data buffers. <ide> */ <ide> public static Consumer<DataBuffer> releaseConsumer() { <ide> return RELEASE_CONSUMER; <ide> } <ide> <add> /** <add> * Return an aggregator function that can be used to {@linkplain Flux#reduce(BiFunction) reduce} <add> * a {@code Flux} of data buffers into a single data buffer by writing all subsequent buffers <add> * into the first buffer. All buffers except the first buffer are <add> * {@linkplain #release(DataBuffer) released}. <add> * <p>For example: <add> * <pre class="code"> <add> * Flux&lt;DataBuffer&gt; flux = ... <add> * Mono&lt;DataBuffer&gt; mono = flux.reduce(DataBufferUtils.writeAggregator()); <add> * </pre> <add> * @see Flux#reduce(BiFunction) <add> */ <add> public static BinaryOperator<DataBuffer> writeAggregator() { <add> return WRITE_AGGREGATOR; <add> } <add> <ide> <ide> private static class ReadableByteChannelGenerator <ide> implements BiFunction<ReadableByteChannel, SynchronousSink<DataBuffer>, ReadableByteChannel> { <ide> public ReadableByteChannel apply(ReadableByteChannel channel, <ide> } <ide> } <ide> <add> <ide> private static class AsynchronousFileChannelReadCompletionHandler <ide> implements CompletionHandler<Integer, DataBuffer> { <ide> <ide> public void failed(Throwable exc, DataBuffer dataBuffer) { <ide> } <ide> } <ide> <add> <ide> private static class AsynchronousFileChannelWriteCompletionHandler <ide> extends BaseSubscriber<DataBuffer> <ide> implements CompletionHandler<Integer, ByteBuffer> { <ide><path>spring-core/src/test/java/org/springframework/core/io/buffer/DataBufferUtilsTests.java <ide> /* <del> * Copyright 2002-2017 the original author or authors. <add> * Copyright 2002-2018 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> import java.nio.channels.FileChannel; <ide> import java.nio.channels.ReadableByteChannel; <ide> import java.nio.channels.WritableByteChannel; <add>import java.nio.charset.StandardCharsets; <ide> import java.nio.file.Files; <ide> import java.nio.file.Path; <ide> import java.nio.file.Paths; <ide> import java.nio.file.StandardOpenOption; <ide> import java.time.Duration; <ide> import java.util.stream.Collectors; <ide> <add>import io.netty.buffer.ByteBuf; <ide> import org.junit.Test; <ide> import org.mockito.stubbing.Answer; <ide> import reactor.core.publisher.Flux; <ide> import reactor.test.StepVerifier; <ide> <ide> import org.springframework.core.io.ClassPathResource; <ide> import org.springframework.core.io.Resource; <add>import org.springframework.core.io.buffer.support.DataBufferTestUtils; <ide> <ide> import static org.junit.Assert.*; <ide> import static org.mockito.ArgumentMatchers.any; <ide> public void releaseConsumer() { <ide> <ide> flux.subscribe(DataBufferUtils.releaseConsumer()); <ide> <del> // AbstractDataBufferAllocatingTestCase.LeakDetector will assert the release of the buffers <add> assertReleased(foo); <add> assertReleased(bar); <add> assertReleased(baz); <add> } <add> <add> private static void assertReleased(DataBuffer dataBuffer) { <add> if (dataBuffer instanceof NettyDataBuffer) { <add> ByteBuf byteBuf = ((NettyDataBuffer) dataBuffer).getNativeBuffer(); <add> assertEquals(0, byteBuf.refCnt()); <add> } <add> } <add> <add> @Test <add> public void writeAggregator() { <add> DataBuffer foo = stringBuffer("foo"); <add> DataBuffer bar = stringBuffer("bar"); <add> DataBuffer baz = stringBuffer("baz"); <add> Flux<DataBuffer> flux = Flux.just(foo, bar, baz); <add> <add> DataBuffer result = <add> flux.reduce(DataBufferUtils.writeAggregator()).block(Duration.ofSeconds(1)); <add> <add> assertEquals("foobarbaz", DataBufferTestUtils.dumpString(result, StandardCharsets.UTF_8)); <add> <add> release(result); <ide> } <ide> <ide> @Test <ide> public void SPR16070() throws Exception { <ide> ReadableByteChannel channel = mock(ReadableByteChannel.class); <ide> when(channel.read(any())) <del> .thenAnswer(putByte(1)) <del> .thenAnswer(putByte(2)) <del> .thenAnswer(putByte(3)) <add> .thenAnswer(putByte('a')) <add> .thenAnswer(putByte('b')) <add> .thenAnswer(putByte('c')) <ide> .thenReturn(-1); <ide> <ide> Flux<DataBuffer> read = DataBufferUtils.read(channel, this.bufferFactory, 1); <ide> <del> StepVerifier.create( <del> read.reduce(DataBuffer::write) <del> .map(this::dataBufferToBytes) <del> .map(this::encodeHexString) <del> ) <del> .expectNext("010203") <del> .verifyComplete(); <add> StepVerifier.create(read) <add> .consumeNextWith(stringConsumer("a")) <add> .consumeNextWith(stringConsumer("b")) <add> .consumeNextWith(stringConsumer("c")) <add> .expectComplete() <add> .verify(Duration.ofSeconds(5)); <ide> <ide> } <ide> <ide> private Answer<Integer> putByte(int b) { <ide> }; <ide> } <ide> <del> private byte[] dataBufferToBytes(DataBuffer buffer) { <del> try { <del> int byteCount = buffer.readableByteCount(); <del> byte[] bytes = new byte[byteCount]; <del> buffer.read(bytes); <del> return bytes; <del> } <del> finally { <del> release(buffer); <del> } <del> } <del> <del> private String encodeHexString(byte[] data) { <del> StringBuilder builder = new StringBuilder(); <del> for (byte b : data) { <del> builder.append((0xF0 & b) >>> 4); <del> builder.append(0x0F & b); <del> } <del> return builder.toString(); <del> } <del> <del> <ide> <ide> }
2
Python
Python
fix type annotations in skipmixin
93cd12747bb0355f68e65880b199ecf03fcc643b
<ide><path>airflow/models/skipmixin.py <ide> # under the License. <ide> <ide> import warnings <del>from typing import TYPE_CHECKING, Iterable, List, Optional, Sequence, Union, cast <add>from typing import TYPE_CHECKING, Iterable, Optional, Sequence, Union <ide> <ide> from airflow.models.taskinstance import TaskInstance <ide> from airflow.utils import timezone <ide> from pendulum import DateTime <ide> from sqlalchemy import Session <ide> <del> from airflow.models.baseoperator import BaseOperator <ide> from airflow.models.dagrun import DagRun <add> from airflow.models.operator import Operator <add> from airflow.models.taskmixin import DAGNode <ide> <ide> # The key used by SkipMixin to store XCom data. <ide> XCOM_SKIPMIXIN_KEY = "skipmixin_key" <ide> XCOM_SKIPMIXIN_FOLLOWED = "followed" <ide> <ide> <add>def _ensure_tasks(nodes: Iterable["DAGNode"]) -> Sequence["Operator"]: <add> from airflow.models.baseoperator import BaseOperator <add> from airflow.models.mappedoperator import MappedOperator <add> <add> return [n for n in nodes if isinstance(n, (BaseOperator, MappedOperator))] <add> <add> <ide> class SkipMixin(LoggingMixin): <ide> """A Mixin to skip Tasks Instances""" <ide> <del> def _set_state_to_skipped(self, dag_run: "DagRun", tasks: "Iterable[BaseOperator]", session: "Session"): <add> def _set_state_to_skipped( <add> self, <add> dag_run: "DagRun", <add> tasks: Iterable["Operator"], <add> session: "Session", <add> ) -> None: <ide> """Used internally to set state of task instances to skipped from the same dag run.""" <del> task_ids = [d.task_id for d in tasks] <ide> now = timezone.utcnow() <ide> <ide> session.query(TaskInstance).filter( <ide> TaskInstance.dag_id == dag_run.dag_id, <ide> TaskInstance.run_id == dag_run.run_id, <del> TaskInstance.task_id.in_(task_ids), <add> TaskInstance.task_id.in_(d.task_id for d in tasks), <ide> ).update( <ide> { <ide> TaskInstance.state: State.SKIPPED, <ide> def skip( <ide> self, <ide> dag_run: "DagRun", <ide> execution_date: "DateTime", <del> tasks: Sequence["BaseOperator"], <add> tasks: Iterable["DAGNode"], <ide> session: "Session" = NEW_SESSION, <ide> ): <ide> """ <ide> def skip( <ide> :param tasks: tasks to skip (not task_ids) <ide> :param session: db session to use <ide> """ <del> if not tasks: <add> task_list = _ensure_tasks(tasks) <add> if not task_list: <ide> return <ide> <ide> if execution_date and not dag_run: <ide> def skip( <ide> dag_run = ( <ide> session.query(DagRun) <ide> .filter( <del> DagRun.dag_id == tasks[0].dag_id, <add> DagRun.dag_id == task_list[0].dag_id, <ide> DagRun.execution_date == execution_date, <ide> ) <ide> .one() <ide> def skip( <ide> if dag_run is None: <ide> raise ValueError("dag_run is required") <ide> <del> self._set_state_to_skipped(dag_run, tasks, session) <add> self._set_state_to_skipped(dag_run, task_list, session) <ide> session.commit() <ide> <ide> # SkipMixin may not necessarily have a task_id attribute. Only store to XCom if one is available. <ide> def skip( <ide> <ide> XCom.set( <ide> key=XCOM_SKIPMIXIN_KEY, <del> value={XCOM_SKIPMIXIN_SKIPPED: [d.task_id for d in tasks]}, <add> value={XCOM_SKIPMIXIN_SKIPPED: [d.task_id for d in task_list]}, <ide> task_id=task_id, <ide> dag_id=dag_run.dag_id, <ide> run_id=dag_run.run_id, <ide> def skip_all_except(self, ti: TaskInstance, branch_task_ids: Union[None, str, It <ide> """ <ide> self.log.info("Following branch %s", branch_task_ids) <ide> if isinstance(branch_task_ids, str): <del> branch_task_ids = {branch_task_ids} <add> branch_task_id_set = {branch_task_ids} <ide> elif branch_task_ids is None: <del> branch_task_ids = () <del> <del> branch_task_ids = set(branch_task_ids) <add> branch_task_id_set = set() <add> else: <add> branch_task_id_set = set(branch_task_ids) <ide> <ide> dag_run = ti.get_dagrun() <ide> task = ti.task <ide> dag = task.dag <ide> if TYPE_CHECKING: <ide> assert dag <ide> <del> # At runtime, the downstream list will only be operators <del> downstream_tasks = cast("List[BaseOperator]", task.downstream_list) <add> downstream_tasks = _ensure_tasks(task.downstream_list) <ide> <ide> if downstream_tasks: <ide> # For a branching workflow that looks like this, when "branch" does skip_all_except("task1"), <ide> def skip_all_except(self, ti: TaskInstance, branch_task_ids: Union[None, str, It <ide> # v / <ide> # task1 <ide> # <del> for branch_task_id in list(branch_task_ids): <del> branch_task_ids.update(dag.get_task(branch_task_id).get_flat_relative_ids(upstream=False)) <add> for branch_task_id in list(branch_task_id_set): <add> branch_task_id_set.update(dag.get_task(branch_task_id).get_flat_relative_ids(upstream=False)) <ide> <del> skip_tasks = [t for t in downstream_tasks if t.task_id not in branch_task_ids] <del> follow_task_ids = [t.task_id for t in downstream_tasks if t.task_id in branch_task_ids] <add> skip_tasks = [t for t in downstream_tasks if t.task_id not in branch_task_id_set] <add> follow_task_ids = [t.task_id for t in downstream_tasks if t.task_id in branch_task_id_set] <ide> <ide> self.log.info("Skipping tasks %s", [t.task_id for t in skip_tasks]) <ide> with create_session() as session:
1
Text
Text
update relation to other libraries.md
1096c55ae670303ad6bbcf238e13fee495569e9e
<ide><path>docs/Basics/Relation to Other Libraries.md <ide> Most of the functionality Baobab provides is related to updating the data with c <ide> <ide> Unlike Immutable, Baobab doesn’t yet implement any special efficient data structures under the hood, so you don’t really win anything from using it together with Redux. It’s easier to just use plain objects in this case. <ide> <add>### Rx <add> <add>[Reactive Extensions](https://github.com/Reactive-Extensions/RxJS) (and their undergoing [modern rewrite](https://github.com/ReactiveX/RxJS)) are a superb way to manage the complexity of asynchronous apps. In fact [there is an effort to create a library that models human-computer interaction as interdependent observables](http://cycle.js.org). <add> <add>Does it make sense to use Redux together with Rx? Sure! They work great together. For example, it is easy to expose a Redux store as an observable: <add> <add>```js <add>function toObservable(store) { <add> return { <add> subscribe({ onNext }) { <add> let dispose = store.subscribe(() => onNext(store.getState())); <add> onNext(store.getState()); <add> return { dispose }; <add> } <add> } <add>} <add>``` <add> <add>Similarly, you can compose different asynchronous streams to turn them into actions before feeding them to `store.dispatch()`. <add> <add>The question is: do you really need Redux if you already use Rx? Maybe not. It's not hard to [re-implement Redux in Rx](https://github.com/jas-chen/rx-redux). Some say it's a two-liner using Rx `.scan()` method. It may very well be! <add> <add>If you’re in doubt, check out the Redux source code (there isn’t much going on there), as well as its ecosystem (for example, [the developer tools](github.com/gaearon/redux-devtools)). If you don’t care too much about it and want to go with the reactive data flow all the way, you might want to explore something like [Cycle](http://cycle.js.org) instead, or even combine it with Redux. Let us know how it goes! <add> <ide> -------------------------- <ide> Next: [The Redux Flow](The Redux Flow.md)
1
Python
Python
show arch in the log when building import library
6ce9a33b042965a8c536f46b3494a6cae699ccfa
<ide><path>numpy/distutils/mingw32ccompiler.py <ide> def build_import_library(): <ide> raise ValueError("Unhandled arch %s" % arch) <ide> <ide> def _build_import_library_amd64(): <del> pass <add> log.info('Building import library (arch=AMD64): "%s"' % (out_file)) <ide> <ide> def _build_import_library_x86(): <ide> """ Build the import libraries for Mingw32-gcc on Windows <ide> def _build_import_library_x86(): <ide> if os.path.isfile(out_file): <ide> log.debug('Skip building import library: "%s" exists' % (out_file)) <ide> return <del> log.info('Building import library: "%s"' % (out_file)) <add> log.info('Building import library (ARCH=x86): "%s"' % (out_file)) <ide> <ide> from numpy.distutils import lib2def <ide>
1
Text
Text
add eugeneo to collaborators
b35f22b135e8110a4468e7e5ee1e83f9237a9fde
<ide><path>README.md <ide> more information about the governance of the Node.js project, see <ide> **Robert Jefe Lindstaedt** &lt;robert.lindstaedt@gmail.com&gt; <ide> * [estliberitas](https://github.com/estliberitas) - <ide> **Alexander Makarenko** &lt;estliberitas@gmail.com&gt; <add>* [eugeneo](https://github.com/eugeneo) - <add>**Eugene Ostroukhov** &lt;eostroukhov@google.com&gt; <ide> * [fhinkel](https://github.com/fhinkel) - <ide> **Franziska Hinkelmann** &lt;franziska.hinkelmann@gmail.com&gt; <ide> * [firedfox](https://github.com/firedfox) -
1
Javascript
Javascript
add support for inspector overlay
8ac467c51b94c82d81930b4802b2978c85539925
<ide><path>Libraries/Components/Pressable/Pressable.js <ide> import type { <ide> AccessibilityState, <ide> AccessibilityValue, <ide> } from '../View/ViewAccessibility'; <add>import {PressabilityDebugView} from '../../Pressability/PressabilityDebug'; <ide> import usePressability from '../../Pressability/usePressability'; <ide> import {normalizeRect, type RectOrSize} from '../../StyleSheet/Rect'; <ide> import type {LayoutEvent, PressEvent} from '../../Types/CoreEventTypes'; <ide> function Pressable(props: Props, forwardedRef): React.Node { <ide> ref={viewRef} <ide> style={typeof style === 'function' ? style({pressed}) : style}> <ide> {typeof children === 'function' ? children({pressed}) : children} <add> {__DEV__ ? <PressabilityDebugView color="red" hitSlop={hitSlop} /> : null} <ide> </View> <ide> ); <ide> }
1
Go
Go
simplify control flow
7ff4b643199757f301b9d8f98fd4431044b219ea
<ide><path>daemon/logger/journald/read.go <ide> drain: <ide> } <ide> <ide> func (s *journald) followJournal(logWatcher *logger.LogWatcher, j *C.sd_journal, cursor *C.char, untilUnixMicro uint64) *C.char { <del> defer close(logWatcher.Msg) <del> <ide> waitTimeout := C.uint64_t(250000) // 0.25s <ide> <ide> LOOP: <ide> func (s *journald) readLogs(logWatcher *logger.LogWatcher, config logger.ReadCon <ide> sinceUnixMicro uint64 <ide> untilUnixMicro uint64 <ide> ) <add> <add> defer close(logWatcher.Msg) <add> <ide> // Quoting https://www.freedesktop.org/software/systemd/man/sd-journal.html: <ide> // Functions that operate on sd_journal objects are thread <ide> // agnostic — given sd_journal pointer may only be used from one <ide> func (s *journald) readLogs(logWatcher *logger.LogWatcher, config logger.ReadCon <ide> // Get a handle to the journal. <ide> if rc := C.sd_journal_open(&j, C.int(0)); rc != 0 { <ide> logWatcher.Err <- errors.New("error opening journal: " + CErr(rc)) <del> close(logWatcher.Msg) <ide> return <ide> } <add> defer C.sd_journal_close(j) <add> <ide> if config.Follow { <ide> // Initialize library inotify watches early <ide> if rc := C.sd_journal_get_fd(j); rc < 0 { <ide> logWatcher.Err <- errors.New("error getting journald fd: " + CErr(rc)) <del> close(logWatcher.Msg) <ide> return <ide> } <ide> } <del> // If we end up following the log, we can set the journal context <del> // pointer and the channel pointer to nil so that we won't close them <del> // here, potentially while the goroutine that uses them is still <del> // running. Otherwise, close them when we return from this function. <del> following := false <del> defer func() { <del> if !following { <del> close(logWatcher.Msg) <del> } <del> C.sd_journal_close(j) <del> }() <add> <ide> // Remove limits on the size of data items that we'll retrieve. <ide> if rc := C.sd_journal_set_data_threshold(j, C.size_t(0)); rc != 0 { <ide> logWatcher.Err <- errors.New("error setting journal data threshold: " + CErr(rc)) <ide> func (s *journald) readLogs(logWatcher *logger.LogWatcher, config logger.ReadCon <ide> } <ide> if config.Follow { <ide> cursor = s.followJournal(logWatcher, j, cursor, untilUnixMicro) <del> // Let followJournal handle freeing the journal context <del> // object and closing the channel. <del> following = true <ide> } <del> <ide> C.free(unsafe.Pointer(cursor)) <ide> } <ide>
1
Python
Python
add assertjsonequal method to testcase
089d9ca1df43fb36eaa857e2d617a94a82c6b906
<ide><path>django/test/testcases.py <ide> def assertInHTML(self, needle, haystack, count = None, msg_prefix=''): <ide> self.assertTrue(real_count != 0, <ide> msg_prefix + "Couldn't find '%s' in response" % needle) <ide> <add> def assertJSONEqual(self, raw, expected_data, msg=None): <add> try: <add> data = json.loads(raw) <add> except ValueError: <add> self.fail("First argument is not valid JSON: %r" % raw) <add> if isinstance(expected_data, six.string_types): <add> try: <add> expected_data = json.loads(expected_data) <add> except ValueError: <add> self.fail("Second argument is not valid JSON: %r" % expected_data) <add> self.assertEqual(data, expected_data, msg=msg) <add> <ide> def assertXMLEqual(self, xml1, xml2, msg=None): <ide> """ <ide> Asserts that two XML snippets are semantically the same.
1
Text
Text
add hiding comments note to contributor guide
810597d3353c85eb0aebdf16509a75e4f7dfb6e1
<ide><path>doc/guides/contributing/pull-requests.md <ide> opportunity for the contributor to learn a bit more about the project. <ide> It is always good to clearly indicate nits when you comment: e.g. <ide> `Nit: change foo() to bar(). But this is not blocking.` <ide> <add>If your comments were addressed but were not folded automatically after new <add>commits or if they proved to be mistaken, please, [hide them][hiding-a-comment] <add>with the appropriate reason to keep the conversation flow concise and relevant. <add> <ide> ### Be aware of the person behind the code <ide> <ide> Be aware that *how* you communicate requests and reviews in your feedback can <ide> you can take a look at the <ide> [https://ci.nodejs.org/]: https://ci.nodejs.org/ <ide> [IRC in the #node-dev channel]: https://webchat.freenode.net?channels=node-dev&uio=d4 <ide> [Onboarding guide]: ../../onboarding.md <add>[hiding-a-comment]: https://help.github.com/articles/managing-disruptive-comments/#hiding-a-comment
1
Javascript
Javascript
remove unconditional getpeername() call
1bb820a339e64898a4b1d66cfc3e7a6d2e6b8ef0
<ide><path>lib/net_uv.js <ide> Socket.prototype.setEncoding = function(encoding) { <ide> }; <ide> <ide> <add>Socket.prototype._getpeername = function() { <add> if (!this._handle || !this._handle.getpeername) { <add> return {}; <add> } <add> if (!this._peername) { <add> this._peername = this._handle.getpeername(); <add> } <add> return this._peername; <add>}; <add> <add> <add>Socket.prototype.__defineGetter__('remoteAddress', function() { <add> return this._getpeername().address; <add>}); <add> <add> <add>Socket.prototype.__defineGetter__('remotePort', function() { <add> return this._getpeername().port; <add>}); <add> <add> <ide> Socket.prototype.write = function(data /* [encoding], [fd], [cb] */) { <ide> var encoding, fd, cb; <ide> <ide> Server.prototype.address = function() { <ide> function onconnection(clientHandle) { <ide> var handle = this; <ide> var self = handle.socket; <del> var peername; <ide> <ide> debug('onconnection'); <ide> <ide> function onconnection(clientHandle) { <ide> return; <ide> } <ide> <del> // Todo: implement this for unix sockets <del> if (clientHandle.getpeername) { <del> peername = clientHandle.getpeername(); <del> if (!peername.address || !peername.port) { <del> var err = errnoException(errno, 'accept'); <del> clientHandle.close(); <del> self.emit('error', err); <del> return; <del> } <del> } <del> <ide> var socket = new Socket({ <ide> handle: clientHandle, <ide> allowHalfOpen: self.allowHalfOpen <ide> }); <ide> socket.readable = socket.writable = true; <ide> <del> if (peername) { <del> socket.remoteAddress = peername.address; <del> socket.remotePort = peername.port; <del> // TODO: set family as well <del> } <del> <ide> socket.resume(); <ide> <ide> self.connections++;
1
Text
Text
fix a typo in 5.10.1's changelog
31524d73106624e218d5d79c2c8496609d0606e8
<ide><path>CHANGELOG.md <ide> ### Notable changes <ide> <ide> **http**: <del> * Enclose IPv6 Host header in square brackets. This will enable proper seperation of the host adress from any port reference (Mihai Potra) [#5314](https://github.com/nodejs/node/pull/5314) <add> * Enclose IPv6 Host header in square brackets. This will enable proper separation of the host adress from any port reference (Mihai Potra) [#5314](https://github.com/nodejs/node/pull/5314) <ide> <ide> **path**: <ide> * Make win32.isAbsolute more consistent (Brian White) [#6028](https://github.com/nodejs/node/pull/6028)
1
Javascript
Javascript
adjust params from uvexceptionwithhostport
4aec4216a0e3c24fffc428f11ed40b0157401365
<ide><path>lib/internal/errors.js <ide> function uvException(ctx) { <ide> * @param {string} syscall <ide> * @param {string} address <ide> * @param {number} [port] <del> * @param {string} [additional] <ide> * @returns {Error} <ide> */ <del>function uvExceptionWithHostPort(err, syscall, address, port, additional) { <add>function uvExceptionWithHostPort(err, syscall, address, port) { <ide> const [ code, uvmsg ] = errmap.get(err); <ide> const message = `${syscall} ${code}: ${uvmsg}`; <ide> let details = ''; <ide> function uvExceptionWithHostPort(err, syscall, address, port, additional) { <ide> } else if (address) { <ide> details = ` ${address}`; <ide> } <del> if (additional) { <del> details += ` - Local (${additional})`; <del> } <ide> <ide> // eslint-disable-next-line no-restricted-syntax <ide> const ex = new Error(`${message}${details}`);
1
Javascript
Javascript
add tests for hasitems method in freelist
ac56dc96e32a4f9468c869fc5af293129c20a6cd
<ide><path>test/parallel/test-freelist.js <ide> assert.strictEqual(flist1.free({ id: 'test5' }), false); <ide> assert.strictEqual(flist1.alloc().id, 'test3'); <ide> assert.strictEqual(flist1.alloc().id, 'test2'); <ide> assert.strictEqual(flist1.alloc().id, 'test1'); <add> <add>// Check list has elements <add>const flist2 = new FreeList('flist2', 2, Object); <add>assert.strictEqual(flist2.hasItems(), false); <add> <add>flist2.free({ id: 'test1' }); <add>assert.strictEqual(flist2.hasItems(), true); <add> <add>flist2.alloc(); <add>assert.strictEqual(flist2.hasItems(), false);
1
Javascript
Javascript
add hascrypto check to https-agent-constructor
b5ae22dd1c7455178178c56a1eca3d5f72eff39e
<ide><path>test/parallel/test-https-agent-constructor.js <ide> 'use strict'; <del>require('../common'); <add>const common = require('../common'); <add>if (!common.hasCrypto) { <add> common.skip('missing crypto'); <add> return; <add>} <ide> const assert = require('assert'); <ide> const https = require('https'); <ide>
1
Text
Text
add changelog entry for [ci skip]
159dc60bee254d981fdd3958b5f1c7a415114f81
<ide><path>activemodel/CHANGELOG.md <add>* Fix `ActiveModel::Serializers::JSON#as_json` method for timestamps. <add> <add> Before: <add> ``` <add> contact = Contact.new(created_at: Time.utc(2006, 8, 1)) <add> contact.as_json["created_at"] # => 2006-08-01 00:00:00 UTC <add> ``` <add> <add> After: <add> ``` <add> contact = Contact.new(created_at: Time.utc(2006, 8, 1)) <add> contact.as_json["created_at"] # => "2006-08-01T00:00:00.000Z" <add> ``` <add> <add> *Bogdan Gusiev* <add> <ide> * Allows configurable attribute name for `#has_secure_password`. This <ide> still defaults to an attribute named 'password', causing no breaking <ide> change. There is a new method `#authenticate_XXX` where XXX is the
1
Mixed
Go
add support to accepting arbitrary network id
7d7b9f2405ad7f0bf5d08513788119153f5fe7b9
<ide><path>libnetwork/README.md <ide> func main() { <ide> <ide> // Create a network for containers to join. <ide> // NewNetwork accepts Variadic optional arguments that libnetwork and Drivers can use. <del> network, err := controller.NewNetwork(networkType, "network1") <add> network, err := controller.NewNetwork(networkType, "network1", "") <ide> if err != nil { <ide> log.Fatalf("controller.NewNetwork: %s", err) <ide> } <ide><path>libnetwork/api/api.go <ide> func procCreateNetwork(c libnetwork.NetworkController, vars map[string]string, b <ide> if len(create.DriverOpts) > 0 { <ide> options = append(options, libnetwork.NetworkOptionDriverOpts(create.DriverOpts)) <ide> } <del> nw, err := c.NewNetwork(create.NetworkType, create.Name, options...) <add> nw, err := c.NewNetwork(create.NetworkType, create.Name, "", options...) <ide> if err != nil { <ide> return nil, convertNetworkError(err) <ide> } <ide><path>libnetwork/api/api_test.go <ide> func createTestNetwork(t *testing.T, network string) (libnetwork.NetworkControll <ide> }, <ide> } <ide> netGeneric := libnetwork.NetworkOptionGeneric(netOption) <del> nw, err := c.NewNetwork(bridgeNetType, network, netGeneric) <add> nw, err := c.NewNetwork(bridgeNetType, network, "", netGeneric) <ide> if err != nil { <ide> t.Fatal(err) <ide> } <ide> func TestProcGetServices(t *testing.T) { <ide> "BridgeName": netName1, <ide> }, <ide> } <del> nw1, err := c.NewNetwork(bridgeNetType, netName1, libnetwork.NetworkOptionGeneric(netOption)) <add> nw1, err := c.NewNetwork(bridgeNetType, netName1, "", libnetwork.NetworkOptionGeneric(netOption)) <ide> if err != nil { <ide> t.Fatal(err) <ide> } <ide> func TestProcGetServices(t *testing.T) { <ide> "BridgeName": netName2, <ide> }, <ide> } <del> nw2, err := c.NewNetwork(bridgeNetType, netName2, libnetwork.NetworkOptionGeneric(netOption)) <add> nw2, err := c.NewNetwork(bridgeNetType, netName2, "", libnetwork.NetworkOptionGeneric(netOption)) <ide> if err != nil { <ide> t.Fatal(err) <ide> } <ide> func TestHttpHandlerUninit(t *testing.T) { <ide> t.Fatalf("Expected empty list. Got %v", list) <ide> } <ide> <del> n, err := c.NewNetwork(bridgeNetType, "didietro", nil) <add> n, err := c.NewNetwork(bridgeNetType, "didietro", "", nil) <ide> if err != nil { <ide> t.Fatal(err) <ide> } <ide><path>libnetwork/cmd/dnet/dnet.go <ide> func createDefaultNetwork(c libnetwork.NetworkController) { <ide> } <ide> } <ide> <del> _, err := c.NewNetwork(d, nw, createOptions...) <add> _, err := c.NewNetwork(d, nw, "", createOptions...) <ide> if err != nil { <ide> logrus.Errorf("Error creating default network : %s : %v", nw, err) <ide> } <ide><path>libnetwork/cmd/readme_test/readme.go <ide> func main() { <ide> <ide> // Create a network for containers to join. <ide> // NewNetwork accepts Variadic optional arguments that libnetwork and Drivers can use. <del> network, err := controller.NewNetwork(networkType, "network1") <add> network, err := controller.NewNetwork(networkType, "network1", "") <ide> if err != nil { <ide> log.Fatalf("controller.NewNetwork: %s", err) <ide> } <ide><path>libnetwork/controller.go <ide> create network namespaces and allocate interfaces for containers to use. <ide> <ide> // Create a network for containers to join. <ide> // NewNetwork accepts Variadic optional arguments that libnetwork and Drivers can make use of <del> network, err := controller.NewNetwork(networkType, "network1") <add> network, err := controller.NewNetwork(networkType, "network1", "") <ide> if err != nil { <ide> return <ide> } <ide> type NetworkController interface { <ide> Config() config.Config <ide> <ide> // Create a new network. The options parameter carries network specific options. <del> NewNetwork(networkType, name string, options ...NetworkOption) (Network, error) <add> NewNetwork(networkType, name string, id string, options ...NetworkOption) (Network, error) <ide> <ide> // Networks returns the list of Network(s) managed by this controller. <ide> Networks() []Network <ide> func (c *controller) RegisterDriver(networkType string, driver driverapi.Driver, <ide> <ide> // NewNetwork creates a new network of the specified network type. The options <ide> // are network specific and modeled in a generic way. <del>func (c *controller) NewNetwork(networkType, name string, options ...NetworkOption) (Network, error) { <add>func (c *controller) NewNetwork(networkType, name string, id string, options ...NetworkOption) (Network, error) { <ide> if !config.IsValidName(name) { <ide> return nil, ErrInvalidName(name) <ide> } <ide> <add> if id == "" { <add> id = stringid.GenerateRandomID() <add> } <add> <ide> // Construct the network object <ide> network := &network{ <ide> name: name, <ide> networkType: networkType, <ide> generic: map[string]interface{}{netlabel.GenericData: make(map[string]string)}, <ide> ipamType: ipamapi.DefaultIPAM, <del> id: stringid.GenerateRandomID(), <add> id: id, <ide> ctrlr: c, <ide> persist: true, <ide> drvOnce: &sync.Once{}, <ide><path>libnetwork/default_gateway_linux.go <ide> func (c *controller) createGWNetwork() (Network, error) { <ide> bridge.EnableIPMasquerade: strconv.FormatBool(true), <ide> } <ide> <del> n, err := c.NewNetwork("bridge", libnGWNetwork, <add> n, err := c.NewNetwork("bridge", libnGWNetwork, "", <ide> NetworkOptionDriverOpts(netOption), <ide> NetworkOptionEnableIPv6(false), <ide> ) <ide><path>libnetwork/libnetwork_internal_test.go <ide> func TestIpamReleaseOnNetDriverFailures(t *testing.T) { <ide> // Test whether ipam state release is invoked on network create failure from net driver <ide> // by checking whether subsequent network creation requesting same gateway IP succeeds <ide> ipamOpt := NetworkOptionIpam(ipamapi.DefaultIPAM, "", []*IpamConf{{PreferredPool: "10.34.0.0/16", Gateway: "10.34.255.254"}}, nil, nil) <del> if _, err := c.NewNetwork(badDriverName, "badnet1", ipamOpt); err == nil { <add> if _, err := c.NewNetwork(badDriverName, "badnet1", "", ipamOpt); err == nil { <ide> t.Fatalf("bad network driver should have failed network creation") <ide> } <ide> <del> gnw, err := c.NewNetwork("bridge", "goodnet1", ipamOpt) <add> gnw, err := c.NewNetwork("bridge", "goodnet1", "", ipamOpt) <ide> if err != nil { <ide> t.Fatal(err) <ide> } <ide> gnw.Delete() <ide> <ide> // Now check whether ipam release works on endpoint creation failure <ide> bd.failNetworkCreation = false <del> bnw, err := c.NewNetwork(badDriverName, "badnet2", ipamOpt) <add> bnw, err := c.NewNetwork(badDriverName, "badnet2", "", ipamOpt) <ide> if err != nil { <ide> t.Fatal(err) <ide> } <ide> func TestIpamReleaseOnNetDriverFailures(t *testing.T) { <ide> <ide> // Now create good bridge network with different gateway <ide> ipamOpt2 := NetworkOptionIpam(ipamapi.DefaultIPAM, "", []*IpamConf{{PreferredPool: "10.34.0.0/16", Gateway: "10.34.255.253"}}, nil, nil) <del> gnw, err = c.NewNetwork("bridge", "goodnet2", ipamOpt2) <add> gnw, err = c.NewNetwork("bridge", "goodnet2", "", ipamOpt2) <ide> if err != nil { <ide> t.Fatal(err) <ide> } <ide><path>libnetwork/libnetwork_test.go <ide> func createController() error { <ide> } <ide> <ide> func createTestNetwork(networkType, networkName string, netOption options.Generic, ipamV4Configs, ipamV6Configs []*libnetwork.IpamConf) (libnetwork.Network, error) { <del> return controller.NewNetwork(networkType, networkName, <add> return controller.NewNetwork(networkType, networkName, "", <ide> libnetwork.NetworkOptionGeneric(netOption), <ide> libnetwork.NetworkOptionIpam(ipamapi.DefaultIPAM, "", ipamV4Configs, ipamV6Configs, nil)) <ide> } <ide> func TestBridgeIpv6FromMac(t *testing.T) { <ide> ipamV4ConfList := []*libnetwork.IpamConf{{PreferredPool: "192.168.100.0/24", Gateway: "192.168.100.1"}} <ide> ipamV6ConfList := []*libnetwork.IpamConf{{PreferredPool: "fe90::/64", Gateway: "fe90::22"}} <ide> <del> network, err := controller.NewNetwork(bridgeNetType, "testipv6mac", <add> network, err := controller.NewNetwork(bridgeNetType, "testipv6mac", "", <ide> libnetwork.NetworkOptionGeneric(netOption), <ide> libnetwork.NetworkOptionEnableIPv6(true), <ide> libnetwork.NetworkOptionIpam(ipamapi.DefaultIPAM, "", ipamV4ConfList, ipamV6ConfList, nil), <ide> func TestUnknownDriver(t *testing.T) { <ide> } <ide> <ide> func TestNilRemoteDriver(t *testing.T) { <del> _, err := controller.NewNetwork("framerelay", "dummy", <add> _, err := controller.NewNetwork("framerelay", "dummy", "", <ide> libnetwork.NetworkOptionGeneric(getEmptyGenericOption())) <ide> if err == nil { <ide> t.Fatal("Expected to fail. But instead succeeded") <ide> func TestEndpointJoin(t *testing.T) { <ide> }, <ide> } <ide> ipamV6ConfList := []*libnetwork.IpamConf{{PreferredPool: "fe90::/64", Gateway: "fe90::22"}} <del> n1, err := controller.NewNetwork(bridgeNetType, "testnetwork1", <add> n1, err := controller.NewNetwork(bridgeNetType, "testnetwork1", "", <ide> libnetwork.NetworkOptionGeneric(netOption), <ide> libnetwork.NetworkOptionEnableIPv6(true), <ide> libnetwork.NetworkOptionIpam(ipamapi.DefaultIPAM, "", nil, ipamV6ConfList, nil), <ide> func TestInvalidRemoteDriver(t *testing.T) { <ide> } <ide> defer ctrlr.Stop() <ide> <del> _, err = ctrlr.NewNetwork("invalid-network-driver", "dummy", <add> _, err = ctrlr.NewNetwork("invalid-network-driver", "dummy", "", <ide> libnetwork.NetworkOptionGeneric(getEmptyGenericOption())) <ide> if err == nil { <ide> t.Fatal("Expected to fail. But instead succeeded") <ide> func TestValidRemoteDriver(t *testing.T) { <ide> t.Fatal(err) <ide> } <ide> <del> n, err := controller.NewNetwork("valid-network-driver", "dummy", <add> n, err := controller.NewNetwork("valid-network-driver", "dummy", "", <ide> libnetwork.NetworkOptionGeneric(getEmptyGenericOption())) <ide> if err != nil { <ide> // Only fail if we could not find the plugin driver <ide> func TestParallel3(t *testing.T) { <ide> } <ide> <ide> func TestNullIpam(t *testing.T) { <del> _, err := controller.NewNetwork(bridgeNetType, "testnetworkinternal", libnetwork.NetworkOptionIpam(ipamapi.NullIPAM, "", nil, nil, nil)) <add> _, err := controller.NewNetwork(bridgeNetType, "testnetworkinternal", "", libnetwork.NetworkOptionIpam(ipamapi.NullIPAM, "", nil, nil, nil)) <ide> if err == nil || err.Error() != "ipv4 pool is empty" { <ide> t.Fatal("bridge network should complain empty pool") <ide> } <ide><path>libnetwork/sandbox_test.go <ide> func getTestEnv(t *testing.T) (NetworkController, Network, Network) { <ide> "BridgeName": name1, <ide> }, <ide> } <del> n1, err := c.NewNetwork(netType, name1, NetworkOptionGeneric(netOption1)) <add> n1, err := c.NewNetwork(netType, name1, "", NetworkOptionGeneric(netOption1)) <ide> if err != nil { <ide> t.Fatal(err) <ide> } <ide> func getTestEnv(t *testing.T) (NetworkController, Network, Network) { <ide> "BridgeName": name2, <ide> }, <ide> } <del> n2, err := c.NewNetwork(netType, name2, NetworkOptionGeneric(netOption2)) <add> n2, err := c.NewNetwork(netType, name2, "", NetworkOptionGeneric(netOption2)) <ide> if err != nil { <ide> t.Fatal(err) <ide> } <ide><path>libnetwork/store_test.go <ide> func testLocalBackend(t *testing.T, provider, url string, storeConfig *store.Con <ide> if err != nil { <ide> t.Fatalf("Error new controller: %v", err) <ide> } <del> nw, err := ctrl.NewNetwork("host", "host") <add> nw, err := ctrl.NewNetwork("host", "host", "") <ide> if err != nil { <ide> t.Fatalf("Error creating default \"host\" network: %v", err) <ide> } <ide> func TestNoPersist(t *testing.T) { <ide> if err != nil { <ide> t.Fatalf("Error new controller: %v", err) <ide> } <del> nw, err := ctrl.NewNetwork("host", "host", NetworkOptionPersist(false)) <add> nw, err := ctrl.NewNetwork("host", "host", "", NetworkOptionPersist(false)) <ide> if err != nil { <ide> t.Fatalf("Error creating default \"host\" network: %v", err) <ide> }
11
Text
Text
use cookie in request.setheader() examples
862b7a1c7be9322c565a40a3e18f06b0e927bda9
<ide><path>doc/api/http.md <ide> The type of the return value depends on the arguments provided to <ide> ```js <ide> request.setHeader('content-type', 'text/html'); <ide> request.setHeader('Content-Length', Buffer.byteLength(body)); <del>request.setHeader('Set-Cookie', ['type=ninja', 'language=javascript']); <add>request.setHeader('Cookie', ['type=ninja', 'language=javascript']); <ide> const contentType = request.getHeader('Content-Type'); <ide> // contentType is 'text/html' <ide> const contentLength = request.getHeader('Content-Length'); <ide> // contentLength is of type number <del>const setCookie = request.getHeader('set-cookie'); <del>// setCookie is of type string[] <add>const cookie = request.getHeader('Cookie'); <add>// cookie is of type string[] <ide> ``` <ide> <ide> ### request.maxHeadersCount <ide> request.setHeader('Content-Type', 'application/json'); <ide> or <ide> <ide> ```js <del>request.setHeader('Set-Cookie', ['type=ninja', 'language=javascript']); <add>request.setHeader('Cookie', ['type=ninja', 'language=javascript']); <ide> ``` <ide> <ide> ### request.setNoDelay([noDelay])
1
Python
Python
remove image_shape in conv layers
76b28524d15cf05f935d7063687b119b5db59858
<ide><path>keras/layers/convolutional.py <ide> class Convolution1D(Layer): <ide> def __init__(self, nb_filter, stack_size, filter_length, <ide> init='uniform', activation='linear', weights=None, <del> image_shape=None, border_mode='valid', subsample_length=1, <add> border_mode='valid', subsample_length=1, <ide> W_regularizer=None, b_regularizer=None, activity_regularizer=None, W_constraint=None, b_constraint=None): <ide> <ide> nb_row = 1 <ide> def __init__(self, nb_filter, stack_size, filter_length, <ide> self.activation = activations.get(activation) <ide> self.subsample = (1, subsample_length) <ide> self.border_mode = border_mode <del> self.image_shape = image_shape <ide> <ide> self.input = T.tensor4() <ide> self.W_shape = (nb_filter, stack_size, nb_row, nb_col) <ide> def get_output(self, train): <ide> X = self.get_input(train) <ide> <ide> conv_out = theano.tensor.nnet.conv.conv2d(X, self.W, <del> border_mode=self.border_mode, subsample=self.subsample, image_shape=self.image_shape) <add> border_mode=self.border_mode, subsample=self.subsample) <ide> output = self.activation(conv_out + self.b.dimshuffle('x', 0, 'x', 'x')) <ide> return output <ide> <ide> def get_config(self): <ide> "filter_length":self.filter_length, <ide> "init":self.init.__name__, <ide> "activation":self.activation.__name__, <del> "image_shape":self.image_shape, <ide> "border_mode":self.border_mode, <ide> "subsample_length":self.subsample_length} <ide> <ide> def get_config(self): <ide> class Convolution2D(Layer): <ide> def __init__(self, nb_filter, stack_size, nb_row, nb_col, <ide> init='glorot_uniform', activation='linear', weights=None, <del> image_shape=None, border_mode='valid', subsample=(1,1), <add> border_mode='valid', subsample=(1, 1), <ide> W_regularizer=None, b_regularizer=None, activity_regularizer=None, W_constraint=None, b_constraint=None): <ide> super(Convolution2D,self).__init__() <ide> <ide> self.init = initializations.get(init) <ide> self.activation = activations.get(activation) <ide> self.subsample = subsample <ide> self.border_mode = border_mode <del> self.image_shape = image_shape <ide> self.nb_filter = nb_filter <ide> self.stack_size = stack_size <ide> self.nb_row = nb_row <ide> def get_output(self, train): <ide> X = self.get_input(train) <ide> <ide> conv_out = theano.tensor.nnet.conv.conv2d(X, self.W, <del> border_mode=self.border_mode, subsample=self.subsample, image_shape=self.image_shape) <add> border_mode=self.border_mode, subsample=self.subsample) <ide> output = self.activation(conv_out + self.b.dimshuffle('x', 0, 'x', 'x')) <ide> return output <ide> <ide> def get_config(self): <ide> "nb_col":self.nb_col, <ide> "init":self.init.__name__, <ide> "activation":self.activation.__name__, <del> "image_shape":self.image_shape, <ide> "border_mode":self.border_mode, <ide> "subsample":self.subsample} <ide>
1
Javascript
Javascript
provide docs for the core $animator service
9f3935baffa9faaec0cac9b6b41cd845fa41d6fc
<ide><path>src/ng/animate.js <ide> var $AnimateProvider = ['$provide', function($provide) { <ide> }; <ide> <ide> this.$get = ['$timeout', function($timeout) { <add> <add> /** <add> * @ngdoc object <add> * @name ng.$animate <add> * <add> * @description <add> * The $animate service provides rudimentary DOM manipulation functions to insert, remove, move elements within <add> * the DOM as well as adding and removing classes. This service is the core service used by the ngAnimate $animator <add> * service which provides high-level animation hooks for CSS and JavaScript. <add> * <add> * $animate is available in the AngularJS core, however, the ngAnimate module must be included to enable full out <add> * animation support. Otherwise, $animate will only perform simple DOM manipulation operations. <add> * <add> * To learn more about enabling animation support, click here to visit the {@link ngAnimate ngAnimate module page} <add> * as well as the {@link ngAnimate.$animate ngAnimate $animate service page}. <add> */ <ide> return { <add> <add> /** <add> * @ngdoc function <add> * @name ng.$animate#enter <add> * @methodOf ng.$animate <add> * @function <add> * <add> * @description <add> * Inserts the element into the DOM either after the `after` element or within the `parent` element. Once complete, <add> * the done() callback will be fired (if provided). <add> * <add> * @param {jQuery/jqLite element} element the element which will be inserted into the DOM <add> * @param {jQuery/jqLite element} parent the parent element which will append the element as a child (if the after element is not present) <add> * @param {jQuery/jqLite element} after the sibling element which will append the element after itself <add> * @param {function=} done callback function that will be called after the element has been inserted into the DOM <add> */ <ide> enter : function(element, parent, after, done) { <ide> var afterNode = after && after[after.length - 1]; <ide> var parentNode = parent && parent[0] || afterNode && afterNode.parentNode; <ide> var $AnimateProvider = ['$provide', function($provide) { <ide> $timeout(done || noop, 0, false); <ide> }, <ide> <add> /** <add> * @ngdoc function <add> * @name ng.$animate#leave <add> * @methodOf ng.$animate <add> * @function <add> * <add> * @description <add> * Removes the element from the DOM. Once complete, the done() callback will be fired (if provided). <add> * <add> * @param {jQuery/jqLite element} element the element which will be removed from the DOM <add> * @param {function=} done callback function that will be called after the element has been removed from the DOM <add> */ <ide> leave : function(element, done) { <ide> element.remove(); <ide> $timeout(done || noop, 0, false); <ide> }, <ide> <add> /** <add> * @ngdoc function <add> * @name ng.$animate#move <add> * @methodOf ng.$animate <add> * @function <add> * <add> * @description <add> * Moves the position of the provided element within the DOM to be placed either after the `after` element or inside of the `parent` element. <add> * Once complete, the done() callback will be fired (if provided). <add> * <add> * @param {jQuery/jqLite element} element the element which will be moved around within the DOM <add> * @param {jQuery/jqLite element} parent the parent element where the element will be inserted into (if the after element is not present) <add> * @param {jQuery/jqLite element} after the sibling element where the element will be positioned next to <add> * @param {function=} done the callback function (if provided) that will be fired after the element has been moved to it's new position <add> */ <ide> move : function(element, parent, after, done) { <ide> // Do not remove element before insert. Removing will cause data associated with the <ide> // element to be dropped. Insert will implicitly do the remove. <ide> this.enter(element, parent, after, done); <ide> }, <ide> <add> /** <add> * @ngdoc function <add> * @name ng.$animate#addClass <add> * @methodOf ng.$animate <add> * @function <add> * <add> * @description <add> * Adds the provided className CSS class value to the provided element. Once complete, the done() callback will be fired (if provided). <add> * <add> * @param {jQuery/jqLite element} element the element which will have the className value added to it <add> * @param {string} className the CSS class which will be added to the element <add> * @param {function=} done the callback function (if provided) that will be fired after the className value has been added to the element <add> */ <ide> addClass : function(element, className, done) { <ide> className = isString(className) ? <ide> className : <ide> var $AnimateProvider = ['$provide', function($provide) { <ide> $timeout(done || noop, 0, false); <ide> }, <ide> <add> /** <add> * @ngdoc function <add> * @name ng.$animate#removeClass <add> * @methodOf ng.$animate <add> * @function <add> * <add> * @description <add> * Removes the provided className CSS class value from the provided element. Once complete, the done() callback will be fired (if provided). <add> * <add> * @param {jQuery/jqLite element} element the element which will have the className value removed from it <add> * @param {string} className the CSS class which will be removed from the element <add> * @param {function=} done the callback function (if provided) that will be fired after the className value has been removed from the element <add> */ <ide> removeClass : function(element, className, done) { <ide> className = isString(className) ? <ide> className :
1
Java
Java
fix touchevents on text after state changes
00681c3660809887644c5abfaf018a5e46b06547
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.java <ide> public class TextLayoutManager { <ide> private static final int spannableCacheSize = 100; <ide> <ide> private static final Object sSpannableCacheLock = new Object(); <del> private static LruCache<Double, Spannable> sSpannableCache = new LruCache<>(spannableCacheSize); <add> private static LruCache<String, Spannable> sSpannableCache = new LruCache<>(spannableCacheSize); <ide> <ide> private static void buildSpannableFromFragment( <ide> Context context, <ide> protected static Spannable getOrCreateSpannableForText( <ide> Context context, <ide> ReadableMap attributedString) { <ide> <del> Double hash = attributedString.getDouble("hash"); <ide> Spannable preparedSpannableText; <del> <add> String attributedStringPayload = attributedString.toString(); <ide> synchronized (sSpannableCacheLock) { <del> preparedSpannableText = sSpannableCache.get(hash); <del> //TODO: T31905686 the hash does not guarantee equality of texts <add> preparedSpannableText = sSpannableCache.get(attributedStringPayload); <add> //TODO: T31905686 implement proper equality of attributedStrings <ide> if (preparedSpannableText != null) { <ide> return preparedSpannableText; <ide> } <ide> } <ide> <ide> preparedSpannableText = createSpannableFromAttributedString(context, attributedString); <ide> synchronized (sSpannableCacheLock) { <del> sSpannableCache.put(hash, preparedSpannableText); <add> sSpannableCache.put(attributedStringPayload, preparedSpannableText); <ide> } <ide> return preparedSpannableText; <ide> }
1
Ruby
Ruby
add missing require for `remove_possible_method`
001fc80d8784670277af3b9dd3d22f16cbf965f9
<ide><path>activesupport/lib/active_support/core_ext/date_time/compatibility.rb <ide> require "active_support/core_ext/date_and_time/compatibility" <add>require "active_support/core_ext/module/remove_method" <ide> <ide> class DateTime <ide> include DateAndTime::Compatibility
1
Text
Text
update hall of fame
7f550a61d121b56943fecef49266c37ff7d9be9b
<ide><path>docs/security-hall-of-fame.md <ide> While we do not offer any bounties or swags at the moment, we are grateful to th <ide> <ide> - Mehul Mohan from [codedamn](https://codedamn.com) ([@mehulmpt](https://twitter.com/mehulmpt)) - [Vulnerability Fix](https://github.com/freeCodeCamp/freeCodeCamp/blob/bb5a9e815313f1f7c91338e171bfe5acb8f3e346/client/src/components/Flash/index.js) <ide> - Peter Samir https://www.linkedin.com/in/peter-samir/ <add>- Laurence Tennant ([@hyperreality](https://github.com/hyperreality)) working with IncludeSecurity.com - [GHSA-cc3r-grh4-27gj](https://github.com/freeCodeCamp/freeCodeCamp/security/advisories/GHSA-cc3r-grh4-27gj) <ide> <del> > ### Thank you for your contributions :pray: <add>> ### Thank you for your contributions :pray:
1
Go
Go
add hostconfig to container inspect
c4c90e9cec1b3f3cc5aa652e4e9155f6a2e687aa
<ide><path>api.go <ide> func getContainersByName(srv *Server, version float64, w http.ResponseWriter, r <ide> return fmt.Errorf("Conflict between containers and images") <ide> } <ide> <del> return writeJSON(w, http.StatusOK, container) <add> container.readHostConfig() <add> c := APIContainer{container, container.hostConfig} <add> <add> return writeJSON(w, http.StatusOK, c) <ide> } <ide> <ide> func getImagesByName(srv *Server, version float64, w http.ResponseWriter, r *http.Request, vars map[string]string) error { <ide><path>api_params.go <ide> type ( <ide> Resource string <ide> HostPath string <ide> } <add> APIContainer struct { <add> *Container <add> HostConfig *HostConfig <add> } <ide> ) <ide> <ide> func (api APIImages) ToLegacy() []APIImagesOld {
2
Text
Text
remove mentions of bower support
39fd73f781b45836c637a0883f58f4de9484940c
<ide><path>COLLABORATOR_GUIDE.md <ide> git reset --hard upstream/master <ide> <ide> Releasing video.js is partially automated through [`conrib.json`](/contrib.json) scripts. To do a release, you need a couple of things: npm access, GitHub personal access token. <ide> <del>Releases in video.js are done on npm and bower and GitHub and eventually posted on the CDN. This is the instruction for the npm/bower/GitHub releases. <add>Releases in video.js are done on npm and GitHub and eventually posted on the CDN. These <add>are the instructions for the npm/GitHub releases. <ide> <ide> When we do a release, we release it as a `next` tag on npm first and then at least a week later, we promote this release to `latest` on npm. <ide> <ide><path>docs/guides/faq.md <ide> video.js is an extendable framework/library around the native video element. It <ide> <ide> ## Q: How do I install video.js? <ide> <del>Currently video.js can be installed using bower, npm, serving a release file from <add>Currently video.js can be installed using npm, serving a release file from <ide> a github tag, or even using a CDN hosted version. For information on doing any of those <ide> see the [install guide][install-guide]. <ide> <ide> ## Q: Is video.js on bower? <ide> <del>Yes! See the [install guide][install-guide] for more information. <add>Versions prior to video.js 6 do support bower, however, as of video.js 6, bower is no <add>longer officially supported. Please see https://github.com/videojs/video.js/issues/4012 <add>for more information. <ide> <ide> ## Q: What do video.js version numbers mean? <ide> <ide><path>docs/guides/setup.md <ide> <ide> ## Getting Video.js <ide> <del>Video.js is officially available via CDN, npm, and Bower. <add>Video.js is officially available via CDN and npm. <ide> <ide> Video.js works out of the box with not only HTML `<script>` and `<link>` tags, but also all major bundlers/packagers/builders, such as Browserify, Node, WebPack, etc. <ide>
3
PHP
PHP
add afterdeletecommit event
bafd922f6006a3379440128ad52979bb6cffc143
<ide><path>src/ORM/Table.php <ide> public function delete(EntityInterface $entity, $options = []) <ide> }; <ide> <ide> if ($options['atomic']) { <del> return $this->connection()->transactional($process); <add> $connection = $this->connection(); <add> $success = $connection->transactional($process); <add> if ($success && !$connection->inTransaction()) { <add> $this->dispatchEvent('Model.afterDeleteCommit', [ <add> 'entity' => $entity, <add> 'options' => $options <add> ]); <add> } <add> return $success; <ide> } <ide> return $process(); <ide> } <ide> public function implementedEvents() <ide> 'Model.afterSaveCommit' => 'afterSaveCommit', <ide> 'Model.beforeDelete' => 'beforeDelete', <ide> 'Model.afterDelete' => 'afterDelete', <add> 'Model.afterDeleteCommit' => 'afterDeleteCommit', <ide> 'Model.beforeRules' => 'beforeRules', <ide> 'Model.afterRules' => 'afterRules', <ide> ]; <ide><path>tests/TestCase/ORM/TableTest.php <ide> public function testDeleteCallbacks() <ide> ) <ide> )); <ide> <add> $mock->expects($this->at(4)) <add> ->method('dispatch') <add> ->with($this->logicalAnd( <add> $this->attributeEqualTo('_name', 'Model.afterDeleteCommit'), <add> $this->attributeEqualTo( <add> 'data', <add> ['entity' => $entity, 'options' => $options] <add> ) <add> )); <add> <ide> $table = TableRegistry::get('users', ['eventManager' => $mock]); <ide> $entity->isNew(false); <ide> $table->delete($entity, ['checkRules' => false]); <ide> } <ide> <add> /** <add> * Test afterDeleteCommit not called for non-atomic delete <add> * <add> * @return void <add> */ <add> public function testDeleteCallbacksNonAtomic() <add> { <add> $table = TableRegistry::get('users'); <add> <add> $data = $table->get(1); <add> $options = new \ArrayObject(['atomic' => false, 'checkRules' => false]); <add> <add> $called = false; <add> $listener = function ($e, $entity, $options) use ($data, &$called) { <add> $this->assertSame($data, $entity); <add> $called = true; <add> }; <add> $table->eventManager()->attach($listener, 'Model.afterDelete'); <add> <add> $calledAfterCommit = false; <add> $listenerAfterCommit = function ($e, $entity, $options) use ($data, &$calledAfterCommit) { <add> $calledAfterCommit = true; <add> }; <add> $table->eventManager()->attach($listenerAfterCommit, 'Model.afterDeleteCommit'); <add> <add> $table->delete($data, ['atomic' => false]); <add> $this->assertTrue($called); <add> $this->assertFalse($calledAfterCommit); <add> } <add> <add> /** <add> * Test that afterDeleteCommit is only triggered for primary table <add> * <add> * @return void <add> */ <add> public function testAfterDeleteCommitTriggeredOnlyForPrimaryTable() <add> { <add> $table = TableRegistry::get('authors'); <add> $table->hasOne('articles', [ <add> 'foreignKey' => 'author_id', <add> 'dependent' => true, <add> ]); <add> <add> $called = false; <add> $listener = function ($e, $entity, $options) use (&$called) { <add> $called = true; <add> }; <add> $table->eventManager()->attach($listener, 'Model.afterDeleteCommit'); <add> <add> $called2 = false; <add> $listener = function ($e, $entity, $options) use (&$called2) { <add> $called2 = true; <add> }; <add> $table->articles->eventManager()->attach($listener, 'Model.afterDeleteCommit'); <add> <add> $entity = $table->get(1); <add> $this->assertTrue($table->delete($entity)); <add> <add> $this->assertTrue($called); <add> $this->assertFalse($called2); <add> } <add> <ide> /** <ide> * Test delete beforeDelete can abort the delete. <ide> *
2
Python
Python
log the number of errors when importing dags
e94a5de80cce16b7e2bd73a57ff1a6e73466a2c6
<ide><path>airflow/models.py <ide> def collect_dags( <ide> 'collect_dags', (datetime.now() - start_dttm).total_seconds(), 1) <ide> Stats.gauge( <ide> 'dagbag_size', len(self.dags), 1) <add> Stats.gauge( <add> 'dagbag_import_errors', len(self.import_errors), 1) <ide> <ide> def deactivate_inactive_dags(self): <ide> active_dag_ids = [dag.dag_id for dag in list(self.dags.values())]
1
Javascript
Javascript
improve tests for streaming and server components
66af3cee556945f29cdf5178430d3827282cda66
<ide><path>test/integration/react-streaming-and-server-components/test/index.test.js <ide> /* eslint-env jest */ <ide> <del>import cheerio from 'cheerio' <ide> import { join } from 'path' <ide> import fs from 'fs-extra' <ide> import webdriver from 'next-webdriver' <ide> import { <ide> nextBuild as _nextBuild, <ide> nextStart as _nextStart, <ide> renderViaHTTP, <del> check, <ide> } from 'next-test-utils' <ide> <ide> import css from './css' <add>import rsc from './rsc' <add>import streaming from './streaming' <ide> <ide> const nodeArgs = ['-r', join(__dirname, '../../react-18/test/require-hook.js')] <ide> const appDir = join(__dirname, '../app') <ide> async function nextDev(dir, port) { <ide> }) <ide> } <ide> <del>async function resolveStreamResponse(response, onData) { <del> let result = '' <del> onData = onData || (() => {}) <del> await new Promise((resolve) => { <del> response.body.on('data', (chunk) => { <del> result += chunk.toString() <del> onData(chunk.toString(), result) <del> }) <del> <del> response.body.on('end', resolve) <del> }) <del> return result <del>} <del> <ide> describe('concurrentFeatures - basic', () => { <ide> it('should warn user for experimental risk with server components', async () => { <ide> const edgeRuntimeWarning = <ide> runSuite('document', 'dev', documentSuite) <ide> runSuite('document', 'prod', documentSuite) <ide> <ide> async function runBasicTests(context, env) { <del> const isDev = env === 'dev' <del> it('should render html correctly', async () => { <del> const homeHTML = await renderViaHTTP(context.appPort, '/', null, { <del> headers: { <del> 'x-next-test-client': 'test-util', <del> }, <del> }) <del> <del> // should have only 1 DOCTYPE <del> expect(homeHTML).toMatch(/^<!DOCTYPE html><html/) <del> <del> // dynamic routes <del> const dynamicRouteHTML1 = await renderViaHTTP( <del> context.appPort, <del> '/routes/dynamic1' <del> ) <del> const dynamicRouteHTML2 = await renderViaHTTP( <del> context.appPort, <del> '/routes/dynamic2' <del> ) <del> <del> const path404HTML = await renderViaHTTP(context.appPort, '/404') <add> it('should render 500 error correctly', async () => { <ide> const path500HTML = await renderViaHTTP(context.appPort, '/err') <del> const pathNotFoundHTML = await renderViaHTTP( <del> context.appPort, <del> '/this-is-not-found' <del> ) <del> <del> const page404Content = 'custom-404-page' <del> <del> expect(homeHTML).toContain('component:index.server') <del> expect(homeHTML).toContain('env:env_var_test') <del> expect(homeHTML).toContain('header:test-util') <del> expect(homeHTML).toContain('path:/') <del> expect(homeHTML).toContain('foo.client') <del> <del> expect(dynamicRouteHTML1).toContain('query: dynamic1') <del> expect(dynamicRouteHTML2).toContain('query: dynamic2') <del> <del> const $404 = cheerio.load(path404HTML) <del> expect($404('#__next').text()).toBe(page404Content) <ide> <del> // In dev mode: it should show the error popup. <add> // In dev mode it should show the error popup. <add> const isDev = env === 'dev' <ide> expect(path500HTML).toContain(isDev ? 'Error: oops' : 'custom-500-page') <del> expect(pathNotFoundHTML).toContain(page404Content) <ide> }) <ide> <del> it('should disable cache for fizz pages', async () => { <del> const urls = ['/', '/next-api/image', '/next-api/link'] <del> await Promise.all( <del> urls.map(async (url) => { <del> const { headers } = await fetchViaHTTP(context.appPort, url) <del> expect(headers.get('cache-control')).toBe( <del> 'no-cache, no-store, max-age=0, must-revalidate' <del> ) <del> }) <del> ) <del> }) <del> <del> it('should support next/link', async () => { <del> const linkHTML = await renderViaHTTP(context.appPort, '/next-api/link') <del> const $ = cheerio.load(linkHTML) <del> const linkText = $('div[hidden] > a[href="/"]').text() <del> <del> expect(linkText).toContain('go home') <del> <del> const browser = await webdriver(context.appPort, '/next-api/link') <del> <del> // We need to make sure the app is fully hydrated before clicking, otherwise <del> // it will be a full redirection instead of being taken over by the next <del> // router. This timeout prevents it being flaky caused by fast refresh's <del> // rebuilding event. <del> await new Promise((res) => setTimeout(res, 1000)) <del> await browser.eval('window.beforeNav = 1') <del> <del> await browser.waitForElementByCss('#next_id').click() <del> await check(() => browser.elementByCss('#query').text(), 'query:1') <del> <del> await browser.waitForElementByCss('#next_id').click() <del> await check(() => browser.elementByCss('#query').text(), 'query:2') <del> <del> expect(await browser.eval('window.beforeNav')).toBe(1) <del> }) <del> <del> it('should suspense next/image on server side', async () => { <del> const imageHTML = await renderViaHTTP(context.appPort, '/next-api/image') <del> const $ = cheerio.load(imageHTML) <del> const imageTag = $('div[hidden] > span > span > img') <add> it('should render 404 error correctly', async () => { <add> const path404HTML = await renderViaHTTP(context.appPort, '/404') <add> const pathNotFoundHTML = await renderViaHTTP(context.appPort, '/not-found') <ide> <del> expect(imageTag.attr('src')).toContain('data:image') <add> expect(path404HTML).toContain('custom-404-page') <add> expect(pathNotFoundHTML).toContain('custom-404-page') <ide> }) <ide> <del> it('should handle multiple named exports correctly', async () => { <del> const clientExportsHTML = await renderViaHTTP( <add> it('should render dynamic routes correctly', async () => { <add> const dynamicRoute1HTML = await renderViaHTTP( <ide> context.appPort, <del> '/client-exports' <del> ) <del> const $clientExports = cheerio.load(clientExportsHTML) <del> expect($clientExports('div[hidden] > div').text()).toBe('abcde') <del> <del> const browser = await webdriver(context.appPort, '/client-exports') <del> const text = await browser.waitForElementByCss('#__next').text() <del> expect(text).toBe('abcde') <del> }) <del> <del> it('should support multi-level server component imports', async () => { <del> const html = await renderViaHTTP(context.appPort, '/multi') <del> expect(html).toContain('bar.server.js:') <del> expect(html).toContain('foo.client') <del> }) <del> <del> it('should support streaming', async () => { <del> await fetchViaHTTP(context.appPort, '/streaming', null, {}).then( <del> async (response) => { <del> let gotFallback = false <del> let gotData = false <del> <del> await resolveStreamResponse(response, (_, result) => { <del> gotData = result.includes('next_streaming_data') <del> if (!gotFallback) { <del> gotFallback = result.includes('next_streaming_fallback') <del> if (gotFallback) { <del> expect(gotData).toBe(false) <del> } <del> } <del> }) <del> <del> expect(gotFallback).toBe(true) <del> expect(gotData).toBe(true) <del> } <del> ) <del> <del> // Should end up with "next_streaming_data". <del> const browser = await webdriver(context.appPort, '/streaming') <del> const content = await browser.eval(`window.document.body.innerText`) <del> expect(content).toMatchInlineSnapshot('"next_streaming_data"') <del> }) <del> <del> it('should support streaming flight request', async () => { <del> await fetchViaHTTP(context.appPort, '/?__flight__=1').then( <del> async (response) => { <del> const result = await resolveStreamResponse(response) <del> expect(result).toContain('component:index.server') <del> } <add> '/routes/dynamic1' <ide> ) <del> }) <del> <del> it('should support partial hydration with inlined server data', async () => { <del> await fetchViaHTTP(context.appPort, '/partial-hydration', null, {}).then( <del> async (response) => { <del> let gotFallback = false <del> let gotData = false <del> let gotInlinedData = false <del> <del> await resolveStreamResponse(response, (_, result) => { <del> gotInlinedData = result.includes('self.__next_s=') <del> gotData = result.includes('next_streaming_data') <del> if (!gotFallback) { <del> gotFallback = result.includes('next_streaming_fallback') <del> if (gotFallback) { <del> expect(gotData).toBe(false) <del> expect(gotInlinedData).toBe(false) <del> } <del> } <del> }) <del> <del> expect(gotFallback).toBe(true) <del> expect(gotData).toBe(true) <del> expect(gotInlinedData).toBe(true) <del> } <add> const dynamicRoute2HTML = await renderViaHTTP( <add> context.appPort, <add> '/routes/dynamic2' <ide> ) <ide> <del> // Should end up with "next_streaming_data". <del> const browser = await webdriver(context.appPort, '/partial-hydration') <del> const content = await browser.eval(`window.document.body.innerText`) <del> expect(content).toContain('next_streaming_data') <del> <del> // Should support partial hydration: the boundary should still be pending <del> // while another part is hydrated already. <del> expect(await browser.eval(`window.partial_hydration_suspense_result`)).toBe( <del> 'next_streaming_fallback' <del> ) <del> expect(await browser.eval(`window.partial_hydration_counter_result`)).toBe( <del> 'count: 1' <del> ) <add> expect(dynamicRoute1HTML).toContain('query: dynamic1') <add> expect(dynamicRoute2HTML).toContain('query: dynamic2') <ide> }) <ide> <ide> it('should support api routes', async () => { <ide> const res = await renderViaHTTP(context.appPort, '/api/ping') <ide> expect(res).toContain('pong') <ide> }) <add> <add> rsc(context) <add> streaming(context) <ide> } <ide> <ide> function runSuite(suiteName, env, { runTests, before, after }) { <ide><path>test/integration/react-streaming-and-server-components/test/rsc.js <add>/* eslint-env jest */ <add>import webdriver from 'next-webdriver' <add>import cheerio from 'cheerio' <add>import { renderViaHTTP, check } from 'next-test-utils' <add> <add>export default function (context) { <add> it('should render server components correctly', async () => { <add> const homeHTML = await renderViaHTTP(context.appPort, '/', null, { <add> headers: { <add> 'x-next-test-client': 'test-util', <add> }, <add> }) <add> <add> // should have only 1 DOCTYPE <add> expect(homeHTML).toMatch(/^<!DOCTYPE html><html/) <add> <add> expect(homeHTML).toContain('component:index.server') <add> expect(homeHTML).toContain('env:env_var_test') <add> expect(homeHTML).toContain('header:test-util') <add> expect(homeHTML).toContain('path:/') <add> expect(homeHTML).toContain('foo.client') <add> }) <add> <add> it('should support multi-level server component imports', async () => { <add> const html = await renderViaHTTP(context.appPort, '/multi') <add> expect(html).toContain('bar.server.js:') <add> expect(html).toContain('foo.client') <add> }) <add> <add> it('should support next/link in server components', async () => { <add> const linkHTML = await renderViaHTTP(context.appPort, '/next-api/link') <add> const $ = cheerio.load(linkHTML) <add> const linkText = $('div[hidden] > a[href="/"]').text() <add> <add> expect(linkText).toContain('go home') <add> <add> const browser = await webdriver(context.appPort, '/next-api/link') <add> <add> // We need to make sure the app is fully hydrated before clicking, otherwise <add> // it will be a full redirection instead of being taken over by the next <add> // router. This timeout prevents it being flaky caused by fast refresh's <add> // rebuilding event. <add> await new Promise((res) => setTimeout(res, 1000)) <add> await browser.eval('window.beforeNav = 1') <add> <add> await browser.waitForElementByCss('#next_id').click() <add> await check(() => browser.elementByCss('#query').text(), 'query:1') <add> <add> await browser.waitForElementByCss('#next_id').click() <add> await check(() => browser.elementByCss('#query').text(), 'query:2') <add> <add> expect(await browser.eval('window.beforeNav')).toBe(1) <add> }) <add> <add> it('should suspense next/image in server components', async () => { <add> const imageHTML = await renderViaHTTP(context.appPort, '/next-api/image') <add> const $ = cheerio.load(imageHTML) <add> const imageTag = $('div[hidden] > span > span > img') <add> <add> expect(imageTag.attr('src')).toContain('data:image') <add> }) <add> <add> it('should handle multiple named exports correctly', async () => { <add> const clientExportsHTML = await renderViaHTTP( <add> context.appPort, <add> '/client-exports' <add> ) <add> const $clientExports = cheerio.load(clientExportsHTML) <add> expect($clientExports('div[hidden] > div').text()).toBe('abcde') <add> <add> const browser = await webdriver(context.appPort, '/client-exports') <add> const text = await browser.waitForElementByCss('#__next').text() <add> expect(text).toBe('abcde') <add> }) <add>} <ide><path>test/integration/react-streaming-and-server-components/test/streaming.js <add>/* eslint-env jest */ <add>import webdriver from 'next-webdriver' <add>import { fetchViaHTTP } from 'next-test-utils' <add> <add>async function resolveStreamResponse(response, onData) { <add> let result = '' <add> onData = onData || (() => {}) <add> await new Promise((resolve) => { <add> response.body.on('data', (chunk) => { <add> result += chunk.toString() <add> onData(chunk.toString(), result) <add> }) <add> <add> response.body.on('end', resolve) <add> }) <add> return result <add>} <add> <add>export default function (context) { <add> it('should disable cache for fizz pages', async () => { <add> const urls = ['/', '/next-api/image', '/next-api/link'] <add> await Promise.all( <add> urls.map(async (url) => { <add> const { headers } = await fetchViaHTTP(context.appPort, url) <add> expect(headers.get('cache-control')).toBe( <add> 'no-cache, no-store, max-age=0, must-revalidate' <add> ) <add> }) <add> ) <add> }) <add> <add> it('should support streaming for fizz response', async () => { <add> await fetchViaHTTP(context.appPort, '/streaming', null, {}).then( <add> async (response) => { <add> let gotFallback = false <add> let gotData = false <add> <add> await resolveStreamResponse(response, (_, result) => { <add> gotData = result.includes('next_streaming_data') <add> if (!gotFallback) { <add> gotFallback = result.includes('next_streaming_fallback') <add> if (gotFallback) { <add> expect(gotData).toBe(false) <add> } <add> } <add> }) <add> <add> expect(gotFallback).toBe(true) <add> expect(gotData).toBe(true) <add> } <add> ) <add> <add> // Should end up with "next_streaming_data". <add> const browser = await webdriver(context.appPort, '/streaming') <add> const content = await browser.eval(`window.document.body.innerText`) <add> expect(content).toMatchInlineSnapshot('"next_streaming_data"') <add> }) <add> <add> it('should support streaming for flight response', async () => { <add> await fetchViaHTTP(context.appPort, '/?__flight__=1').then( <add> async (response) => { <add> const result = await resolveStreamResponse(response) <add> expect(result).toContain('component:index.server') <add> } <add> ) <add> }) <add> <add> it('should support partial hydration with inlined server data', async () => { <add> await fetchViaHTTP(context.appPort, '/partial-hydration', null, {}).then( <add> async (response) => { <add> let gotFallback = false <add> let gotData = false <add> let gotInlinedData = false <add> <add> await resolveStreamResponse(response, (_, result) => { <add> gotInlinedData = result.includes('self.__next_s=') <add> gotData = result.includes('next_streaming_data') <add> if (!gotFallback) { <add> gotFallback = result.includes('next_streaming_fallback') <add> if (gotFallback) { <add> expect(gotData).toBe(false) <add> expect(gotInlinedData).toBe(false) <add> } <add> } <add> }) <add> <add> expect(gotFallback).toBe(true) <add> expect(gotData).toBe(true) <add> expect(gotInlinedData).toBe(true) <add> } <add> ) <add> <add> // Should end up with "next_streaming_data". <add> const browser = await webdriver(context.appPort, '/partial-hydration') <add> const content = await browser.eval(`window.document.body.innerText`) <add> expect(content).toContain('next_streaming_data') <add> <add> // Should support partial hydration: the boundary should still be pending <add> // while another part is hydrated already. <add> expect(await browser.eval(`window.partial_hydration_suspense_result`)).toBe( <add> 'next_streaming_fallback' <add> ) <add> expect(await browser.eval(`window.partial_hydration_counter_result`)).toBe( <add> 'count: 1' <add> ) <add> }) <add>}
3
Javascript
Javascript
fix baseuri for hottestcases
e2706b8508dcc03d0de5c55d2edaa93856dd95b3
<ide><path>test/HotTestCases.template.js <ide> const describeCases = config => { <ide> if (name === "script") return []; <ide> throw new Error("Not supported"); <ide> } <add> }, <add> location: { <add> href: "https://test.cases/path/index.html", <add> origin: "https://test.cases", <add> toString() { <add> return "https://test.cases/path/index.html"; <add> } <ide> } <ide> }; <ide>
1
Python
Python
add tests for polyfit with deg specified as list
fd5d1a4893d1a4b04d6df94ff83e09a6e4f12df6
<ide><path>numpy/polynomial/tests/test_polynomial.py <ide> def test_polyfit(self): <ide> def f(x): <ide> return x*(x - 1)*(x - 2) <ide> <add> def f2(x): <add> return x**4 + x**2 + 1 <add> <ide> # Test exceptions <ide> assert_raises(ValueError, poly.polyfit, [1], [1], -1) <ide> assert_raises(TypeError, poly.polyfit, [[1]], [1], 0) <ide> def f(x): <ide> assert_raises(TypeError, poly.polyfit, [1], [1, 2], 0) <ide> assert_raises(TypeError, poly.polyfit, [1], [1], 0, w=[[1]]) <ide> assert_raises(TypeError, poly.polyfit, [1], [1], 0, w=[1, 1]) <add> assert_raises(ValueError, poly.polyfit, [1], [1], [-1,]) <add> assert_raises(ValueError, poly.polyfit, [1], [1], [2, -1, 6]) <add> assert_raises(TypeError, poly.polyfit, [1], [1], []) <ide> <ide> # Test fit <ide> x = np.linspace(0, 2) <ide> def f(x): <ide> coef3 = poly.polyfit(x, y, 3) <ide> assert_equal(len(coef3), 4) <ide> assert_almost_equal(poly.polyval(x, coef3), y) <add> coef3 = poly.polyfit(x, y, [0, 1, 2, 3]) <add> assert_equal(len(coef3), 4) <add> assert_almost_equal(poly.polyval(x, coef3), y) <ide> # <ide> coef4 = poly.polyfit(x, y, 4) <ide> assert_equal(len(coef4), 5) <ide> assert_almost_equal(poly.polyval(x, coef4), y) <add> coef4 = poly.polyfit(x, y, [0, 1, 2, 3, 4]) <add> assert_equal(len(coef4), 5) <add> assert_almost_equal(poly.polyval(x, coef4), y) <ide> # <ide> coef2d = poly.polyfit(x, np.array([y, y]).T, 3) <ide> assert_almost_equal(coef2d, np.array([coef3, coef3]).T) <add> coef2d = poly.polyfit(x, np.array([y, y]).T, [0, 1, 2, 3]) <add> assert_almost_equal(coef2d, np.array([coef3, coef3]).T) <ide> # test weighting <ide> w = np.zeros_like(x) <ide> yw = y.copy() <ide> w[1::2] = 1 <ide> yw[0::2] = 0 <ide> wcoef3 = poly.polyfit(x, yw, 3, w=w) <ide> assert_almost_equal(wcoef3, coef3) <add> wcoef3 = poly.polyfit(x, yw, [0, 1, 2, 3], w=w) <add> assert_almost_equal(wcoef3, coef3) <ide> # <ide> wcoef2d = poly.polyfit(x, np.array([yw, yw]).T, 3, w=w) <ide> assert_almost_equal(wcoef2d, np.array([coef3, coef3]).T) <add> wcoef2d = poly.polyfit(x, np.array([yw, yw]).T, [0, 1, 2, 3], w=w) <add> assert_almost_equal(wcoef2d, np.array([coef3, coef3]).T) <ide> # test scaling with complex values x points whose square <ide> # is zero when summed. <ide> x = [1, 1j, -1, -1j] <ide> assert_almost_equal(poly.polyfit(x, x, 1), [0, 1]) <add> assert_almost_equal(poly.polyfit(x, x, [0, 1]), [0, 1]) <add> # test fitting only even Polyendre polynomials <add> x = np.linspace(-1, 1) <add> y = f2(x) <add> coef1 = poly.polyfit(x, y, 4) <add> assert_almost_equal(poly.polyval(x, coef1), y) <add> coef2 = poly.polyfit(x, y, [0, 2, 4]) <add> assert_almost_equal(poly.polyval(x, coef2), y) <add> assert_almost_equal(coef1, coef2) <ide> <ide> def test_polytrim(self): <ide> coef = [2, -1, 1, 0]
1
Python
Python
improve the benchmarkfilelogger performance.
add588d68888e8ba869ffce17d214c48e41ca019
<ide><path>official/utils/logs/logger.py <ide> def __init__(self, logging_dir): <ide> self._logging_dir = logging_dir <ide> if not tf.gfile.IsDirectory(self._logging_dir): <ide> tf.gfile.MakeDirs(self._logging_dir) <add> self._metric_file_handler = tf.gfile.GFile( <add> os.path.join(self._logging_dir, METRIC_LOG_FILE_NAME), "a") <ide> <ide> def log_metric(self, name, value, unit=None, global_step=None, extras=None): <ide> """Log the benchmark metric information to local file. <ide> def log_metric(self, name, value, unit=None, global_step=None, extras=None): <ide> """ <ide> metric = _process_metric_to_json(name, value, unit, global_step, extras) <ide> if metric: <del> with tf.gfile.GFile( <del> os.path.join(self._logging_dir, METRIC_LOG_FILE_NAME), "a") as f: <del> try: <del> json.dump(metric, f) <del> f.write("\n") <del> except (TypeError, ValueError) as e: <del> tf.logging.warning("Failed to dump metric to log file: " <del> "name %s, value %s, error %s", name, value, e) <add> try: <add> json.dump(metric, self._metric_file_handler) <add> self._metric_file_handler.write("\n") <add> self._metric_file_handler.flush() <add> except (TypeError, ValueError) as e: <add> tf.logging.warning("Failed to dump metric to log file: " <add> "name %s, value %s, error %s", name, value, e) <ide> <ide> def log_run_info(self, model_name, dataset_name, run_params, test_id=None): <ide> """Collect most of the TF runtime information for the local env. <ide> def log_run_info(self, model_name, dataset_name, run_params, test_id=None): <ide> e) <ide> <ide> def on_finish(self, status): <del> pass <add> self._metric_file_handler.flush() <add> self._metric_file_handler.close() <ide> <ide> <ide> class BenchmarkBigQueryLogger(BaseBenchmarkLogger):
1
PHP
PHP
add isempty method to messagebag. closes
7b3f3fb32ac08a72b2e91134d6bd9ad5746bf3b4
<ide><path>src/Illuminate/Support/MessageBag.php <ide> public function setFormat($format = ':message') <ide> $this->format = $format; <ide> } <ide> <add> /** <add> * Determine if the message bag has any messages. <add> * <add> * @return bool <add> */ <add> public function isEmpty() <add> { <add> return $this->any(); <add> } <add> <ide> /** <ide> * Determine if the message bag has any messages. <ide> *
1
Javascript
Javascript
fix pixel swimming
6c687f4c8f0a8b7e6d46d3cea68502e0e5a0eb10
<ide><path>examples/jsm/csm/CSM.js <ide> export default class CSM { <ide> _bbox.getSize( _size ); <ide> _bbox.getCenter( _center ); <ide> _center.z = _bbox.max.z + this.lightMargin; <del> _center.applyMatrix4( light.shadow.camera.matrixWorld ); <ide> <del> let squaredBBWidth = Math.max( _size.x, _size.y ); <add> let squaredBBWidth = _lightSpaceFrustum.vertices.far[ 0 ].distanceTo( _lightSpaceFrustum.vertices.far[ 2 ] ); <ide> if ( this.fade ) { <ide> <ide> // expand the shadow extents by the fade margin if fade is enabled. <ide> export default class CSM { <ide> <ide> } <ide> <add> const texelSize = squaredBBWidth / this.shadowMapSize; <add> _center.x = Math.floor( _center.x / texelSize ) * texelSize; <add> _center.y = Math.floor( _center.y / texelSize ) * texelSize; <add> _center.z = Math.floor( _center.z / texelSize ) * texelSize; <add> _center.applyMatrix4( light.shadow.camera.matrixWorld ); <add> <ide> light.shadow.camera.left = - squaredBBWidth / 2; <ide> light.shadow.camera.right = squaredBBWidth / 2; <ide> light.shadow.camera.top = squaredBBWidth / 2;
1
Java
Java
add perf marker for i18n assets module creation
904afaf8c7ceb387b2c4c995a9e58cfc4eaaed90
<ide><path>ReactAndroid/src/main/java/com/facebook/react/bridge/ReactMarkerConstants.java <ide> public class ReactMarkerConstants { <ide> "I18N_MODULE_CONSTANTS_CONVERT_START"; <ide> public static final String I18N_MODULE_CONSTANTS_CONVERT_END = <ide> "I18N_MODULE_CONSTANTS_CONVERT_END"; <add> public static final String CREATE_I18N_ASSETS_MODULE_START = <add> "CREATE_I18N_ASSETS_MODULE_START"; <add> public static final String CREATE_I18N_ASSETS_MODULE_END = <add> "CREATE_I18N_ASSETS_MODULE_END"; <ide> }
1
Text
Text
add text overflow to text docs
1cd44868aa82e137d00ab9db9114c4eb4bf494ae
<ide><path>guide/english/css/text/index.md <ide> p { <ide> } <ide> ``` <ide> <add> <add>#### Text overflow <add> <add>``` css <add>p { <add> text-overflow: ellipsis; <add>} <add>``` <add> <add>The `text-overflow` property is used to specify how hidden overflowed content is ended, to communicate to users that the content has been cut off. For the property to work, it must be used with two other CSS properties: overflow and white-space. For example, `overflow: hidden` and `white-space: nowrap`. <add> <ide> #### More Information: <ide> <!-- Please add any articles you think might be helpful to read before writing the article --> <ide> - [W3Schools CSS text](https://w3schools.com/css/css_text.asp)
1
Javascript
Javascript
fix handling of zero-sized nodes
7c3adbd771ed787e93b499bf7e304f4b18986f6c
<ide><path>d3.layout.js <ide> d3.layout.treemap = function() { <ide> n = row.length; <ide> while (++i < n) { <ide> r = row[i].area; <add> if (r <= 0 || isNaN(r)) continue; <ide> if (r < rmin) rmin = r; <ide> if (r > rmax) rmax = r; <ide> } <ide> s *= s; <ide> u *= u; <del> return rmin || rmax <add> return s && (rmin || rmax) <ide> ? Math.max((u * rmax * ratio) / s, s / (u * rmin * ratio)) <ide> : Infinity; <ide> } <ide><path>d3.layout.min.js <del>(function(){function bj(a,b){var c=a.x+b[3],d=a.y+b[0],e=a.dx-b[1]-b[3],f=a.dy-b[0]-b[2];e<0&&(c+=e/2,e=0),f<0&&(d+=f/2,f=0);return{x:c,y:d,dx:e,dy:f}}function bi(a){return{x:a.x,y:a.y,dx:a.dx,dy:a.dy}}function bh(a,b,c){return a._tree.ancestor.parent==b.parent?a._tree.ancestor:c}function bg(a,b,c){a=a._tree,b=b._tree;var d=c/(b.number-a.number);a.change+=d,b.change-=d,b.shift+=c,b.prelim+=c,b.mod+=c}function bf(a){var b=0,c=0,d=a.children,e=d.length,f;while(--e>=0)f=d[e]._tree,f.prelim+=b,f.mod+=b,b+=f.shift+(c+=f.change)}function be(a,b){function c(a,d){var e=a.children;if(e){var f,g=null,h=-1,i=e.length;while(++h<i)f=e[h],c(f,g),g=f}b(a,d)}c(a,null)}function bd(a,b){return a.depth-b.depth}function bc(a,b){return b.x-a.x}function bb(a,b){return a.x-b.x}function ba(a,b){var c=a.children;if(c){var d,e=c.length,f=-1;while(++f<e)b(d=ba(c[f],b),a)>0&&(a=d)}return a}function _(a){return a.children?a.children[a.children.length-1]:a._tree.thread}function $(a){return a.children?a.children[0]:a._tree.thread}function Z(a,b){return a.parent==b.parent?1:2}function Y(a){var b=a.children;return b?Y(b[b.length-1]):a}function X(a){var b=a.children;return b?X(b[0]):a}function W(a){return a.reduce(function(a,b){return a+b.x},0)/a.length}function V(a){return 1+d3.max(a,function(a){return a.y})}function U(a,b,c){var d=b.r+c.r,e=a.r+c.r,f=b.x-a.x,g=b.y-a.y,h=Math.sqrt(f*f+g*g),i=(e*e+h*h-d*d)/(2*e*h),j=Math.acos(i),k=i*e,l=Math.sin(j)*e;f/=h,g/=h,c.x=a.x+k*f+l*g,c.y=a.y+k*g-l*f}function T(a,b,c,d){var e=a.children;a.x=b+=d*a.x,a.y=c+=d*a.y,a.r*=d;if(e){var f=-1,g=e.length;while(++f<g)T(e[f],b,c,d)}}function S(a){var b=a.children;b?(b.forEach(S),a.r=P(b)):a.r=Math.sqrt(a.value)}function R(a){delete a._pack_next,delete a._pack_prev}function Q(a){a._pack_next=a._pack_prev=a}function P(a){function l(a){b=Math.min(a.x-a.r,b),c=Math.max(a.x+a.r,c),d=Math.min(a.y-a.r,d),e=Math.max(a.y+a.r,e)}var b=Infinity,c=-Infinity,d=Infinity,e=-Infinity,f=a.length,g,h,i,j,k;a.forEach(Q),g=a[0],g.x=-g.r,g.y=0,l(g);if(f>1){h=a[1],h.x=h.r,h.y=0,l(h);if(f>2){i=a[2],U(g,h,i),l(i),M(g,i),g._pack_prev=i,M(i,h),h=g._pack_next;for(var m=3;m<f;m++){U(g,h,i=a[m]);var n=0,o=1,p=1;for(j=h._pack_next;j!==h;j=j._pack_next,o++)if(O(j,i)){n=1;break}if(n==1)for(k=g._pack_prev;k!==j._pack_prev;k=k._pack_prev,p++)if(O(k,i)){p<o&&(n=-1,j=k);break}n==0?(M(g,i),h=i,l(i)):n>0?(N(g,j),h=j,m--):(N(j,h),g=j,m--)}}}var q=(b+c)/2,r=(d+e)/2,s=0;for(var m=0;m<f;m++){var t=a[m];t.x-=q,t.y-=r,s=Math.max(s,t.r+Math.sqrt(t.x*t.x+t.y*t.y))}a.forEach(R);return s}function O(a,b){var c=b.x-a.x,d=b.y-a.y,e=a.r+b.r;return e*e-c*c-d*d>.001}function N(a,b){a._pack_next=b,b._pack_prev=a}function M(a,b){var c=a._pack_next;a._pack_next=b,b._pack_prev=a,b._pack_next=c,c._pack_prev=b}function L(a,b){return a.value-b.value}function J(a){return d3.merge(a.map(function(a){return(a.children||[]).map(function(b){return{source:a,target:b}})}))}function I(a,b){return b.value-a.value}function H(a){return a.value}function G(a){return a.children}function F(a,b){a.sort=d3.rebind(a,b.sort),a.children=d3.rebind(a,b.children),a.links=J,a.value=d3.rebind(a,b.value),a.nodes=function(b){K=!0;return(a.nodes=a)(b)};return a}function E(a){return[d3.min(a),d3.max(a)]}function D(a,b){var c=-1,d=+a[0],e=(a[1]-d)/b,f=[];while(++c<=b)f[c]=e*c+d;return f}function C(a,b){return D(a,Math.ceil(Math.log(b.length)/Math.LN2+1))}function B(a,b){return a+b[1]}function A(a){return a.reduce(B,0)}function z(a){var b=1,c=0,d=a[0][1],e,f=a.length;for(;b<f;++b)(e=a[b][1])>d&&(c=b,d=e);return c}function w(a,b,c){a.y0=b,a.y=c}function v(a){return a.y}function u(a){return a.x}function t(a){return 1}function s(a){return 20}function r(a){var b=0,c=0;a.count=0;if(!a.leaf){var d=a.nodes,e=d.length,f=-1,g;while(++f<e){g=d[f];if(g==null)continue;r(g),a.count+=g.count,b+=g.count*g.cx,c+=g.count*g.cy}}a.point&&(a.leaf||(a.point.x+=Math.random()-.5,a.point.y+=Math.random()-.5),a.count++,b+=a.point.x,c+=a.point.y),a.cx=b/a.count,a.cy=c/a.count}function q(){d3.event.stopPropagation(),d3.event.preventDefault()}function p(){i&&(q(),i=!1)}function o(){!f||(g&&(i=!0,q()),d3.event.type==="mouseup"&&n(),f.fixed=!1,e=h=f=j=null)}function n(){if(!!f){var a=j.parentNode;if(!a){f.fixed=!1,h=f=j=null;return}var b=m(a);g=!0,f.px=b[0]-h[0],f.py=b[1]-h[1],q(),e.resume()}}function m(a){return d3.event.touches?d3.svg.touches(a)[0]:d3.svg.mouse(a)}function l(a){a!==f&&(a.fixed=!1)}function k(a){a.fixed=!0}function c(a,c){if(a===c)return a;var d=b(a),e=b(c),f=d.pop(),g=e.pop(),h=null;while(f===g)h=f,f=d.pop(),g=e.pop();return h}function b(a){var b=[],c=a.parent;while(c!=null)b.push(a),a=c,c=c.parent;b.push(a);return b}function a(a){var b=a.source,d=a.target,e=c(b,d),f=[b];while(b!==e)b=b.parent,f.push(b);var g=f.length;while(d!==e)f.splice(g,0,d),d=d.parent;return f}d3.layout={},d3.layout.bundle=function(){return function(b){var c=[],d=-1,e=b.length;while(++d<e)c.push(a(b[d]));return c}},d3.layout.chord=function(){function k(){b.sort(function(a,b){return i(a.target.value,b.target.value)})}function j(){var a={},j=[],l=d3.range(e),m=[],n,o,p,q,r;b=[],c=[],n=0,q=-1;while(++q<e){o=0,r=-1;while(++r<e)o+=d[q][r];j.push(o),m.push(d3.range(e)),n+=o}g&&l.sort(function(a,b){return g(j[a],j[b])}),h&&m.forEach(function(a,b){a.sort(function(a,c){return h(d[b][a],d[b][c])})}),n=(2*Math.PI-f*e)/n,o=0,q=-1;while(++q<e){p=o,r=-1;while(++r<e){var s=l[q],t=m[q][r],u=d[s][t];a[s+"-"+t]={index:s,subindex:t,startAngle:o,endAngle:o+=u*n,value:u}}c.push({index:s,startAngle:p,endAngle:o,value:(o-p)/n}),o+=f}q=-1;while(++q<e){r=q-1;while(++r<e){var v=a[q+"-"+r],w=a[r+"-"+q];(v.value||w.value)&&b.push(v.value<w.value?{source:w,target:v}:{source:v,target:w})}}i&&k()}var a={},b,c,d,e,f=0,g,h,i;a.matrix=function(f){if(!arguments.length)return d;e=(d=f)&&d.length,b=c=null;return a},a.padding=function(d){if(!arguments.length)return f;f=d,b=c=null;return a},a.sortGroups=function(d){if(!arguments.length)return g;g=d,b=c=null;return a},a.sortSubgroups=function(c){if(!arguments.length)return h;h=c,b=null;return a},a.sortChords=function(c){if(!arguments.length)return i;i=c,b&&k();return a},a.chords=function(){b||j();return b},a.groups=function(){c||j();return c};return a},d3.layout.force=function(){function G(b,c){var d=m(this.parentNode);(f=b).fixed=!0,g=!1,j=this,e=a,h=[d[0]-b.x,d[1]-b.y],q()}function F(){var a=A.length,e=B.length,f=d3.geom.quadtree(A),g,h,j,k,l,m,n;for(g=0;g<e;++g){h=B[g],j=h.source,k=h.target,m=k.x-j.x,n=k.y-j.y;if(l=m*m+n*n)l=d*D[g]*((l=Math.sqrt(l))-C[g])/l,m*=l,n*=l,k.x-=m,k.y-=n,j.x+=m,j.y+=n}var o=d*x;m=c[0]/2,n=c[1]/2,g=-1;while(++g<a)h=A[g],h.x+=(m-h.x)*o,h.y+=(n-h.y)*o;r(f);var p=d*w;g=-1;while(++g<a)f.visit(E(A[g],p));g=-1;while(++g<a)h=A[g],h.fixed?(h.x=h.px,h.y=h.py):(h.x-=(h.px-(h.px=h.x))*i,h.y-=(h.py-(h.py=h.y))*i);b.tick.dispatch({type:"tick",alpha:d});return(d*=.99)<.005}function E(a,b){return function(c,d,e,f,g){if(c.point!==a){var h=c.cx-a.x,i=c.cy-a.y,j=1/Math.sqrt(h*h+i*i);if((f-d)*j<y){var k=b*c.count*j*j;a.x+=h*k,a.y+=i*k;return!0}if(c.point&&isFinite(j)){var k=b*j*j;a.x+=h*k,a.y+=i*k}}}}var a={},b=d3.dispatch("tick"),c=[1,1],d,i=.9,u=s,v=t,w=-30,x=.1,y=.8,z,A=[],B=[],C,D;a.on=function(c,d){b[c].add(d);return a},a.nodes=function(b){if(!arguments.length)return A;A=b;return a},a.links=function(b){if(!arguments.length)return B;B=b;return a},a.size=function(b){if(!arguments.length)return c;c=b;return a},a.linkDistance=function(b){if(!arguments.length)return u;u=d3.functor(b);return a},a.distance=a.linkDistance,a.linkStrength=function(b){if(!arguments.length)return v;v=d3.functor(b);return a},a.friction=function(b){if(!arguments.length)return i;i=b;return a},a.charge=function(b){if(!arguments.length)return w;w=b;return a},a.gravity=function(b){if(!arguments.length)return x;x=b;return a},a.theta=function(b){if(!arguments.length)return y;y=b;return a},a.start=function(){function l(){if(!i){i=[];for(d=0;d<e;++d)i[d]=[];for(d=0;d<f;++d){var a=B[d];i[a.source.index].push(a.target),i[a.target.index].push(a.source)}}return i[b]}function k(a,c){var d=l(b),e=-1,f=d.length,g;while(++e<f)if(!isNaN(g=d[e][a]))return g;return Math.random()*c}var b,d,e=A.length,f=B.length,g=c[0],h=c[1],i,j;for(b=0;b<e;++b)(j=A[b]).index=b;C=[],D=[];for(b=0;b<f;++b)j=B[b],typeof j.source=="number"&&(j.source=A[j.source]),typeof j.target=="number"&&(j.target=A[j.target]),C[b]=u.call(this,j,b),D[b]=v.call(this,j,b);for(b=0;b<e;++b)j=A[b],isNaN(j.x)&&(j.x=k("x",g)),isNaN(j.y)&&(j.y=k("y",h)),isNaN(j.px)&&(j.px=j.x),isNaN(j.py)&&(j.py=j.y);return a.resume()},a.resume=function(){d=.1,d3.timer(F);return a},a.stop=function(){d=0;return a},a.drag=function(){this.on("mouseover.force",k).on("mouseout.force",l).on("mousedown.force",G).on("touchstart.force",G),d3.select(window).on("mousemove.force",n).on("touchmove.force",n).on("mouseup.force",o,!0).on("touchend.force",o,!0).on("click.force",p,!0);return a};return a};var e,f,g,h,i,j;d3.layout.partition=function(){function e(e,f){var g=a.call(this,e,f);c(g[0],0,b[0],b[1]/d(g[0]));return g}function d(a){var b=a.children,c=0;if(b){var e=-1,f=b.length;while(++e<f)c=Math.max(c,d(b[e]))}return 1+c}function c(a,b,d,e){var f=a.children;a.x=b,a.y=a.depth*e,a.dx=d,a.dy=e;if(f){var g=-1,h=f.length,i,j;d/=a.value;while(++g<h)c(i=f[g],b,j=i.value*d,e),b+=j}}var a=d3.layout.hierarchy(),b=[1,1];e.size=function(a){if(!arguments.length)return b;b=a;return e};return F(e,a)},d3.layout.pie=function(){function f(f,g){var h=+(typeof c=="function"?c.apply(this,arguments):c),i=(typeof e=="function"?e.apply(this,arguments):e)-c,j=d3.range(f.length);b!=null&&j.sort(function(a,c){return b(f[a],f[c])});var k=f.map(a);i/=k.reduce(function(a,b){return a+b},0);var l=j.map(function(a){return{data:f[a],value:d=k[a],startAngle:h,endAngle:h+=d*i}});return f.map(function(a,b){return l[j[b]]})}var a=Number,b=null,c=0,e=2*Math.PI;f.value=function(b){if(!arguments.length)return a;a=b;return f},f.sort=function(a){if(!arguments.length)return b;b=a;return f},f.startAngle=function(a){if(!arguments.length)return c;c=a;return f},f.endAngle=function(a){if(!arguments.length)return e;e=a;return f};return f},d3.layout.stack=function(){function g(h,i){var j=h.map(function(b,c){return a.call(g,b,c)}),k=j.map(function(a,b){return a.map(function(a,b){return[e.call(g,a,b),f.call(g,a,b)]})}),l=b.call(g,k,i);j=d3.permute(j,l),k=d3.permute(k,l);var m=c.call(g,k,i),n=j.length,o=j[0].length,p,q,r;for(q=0;q<o;++q){d.call(g,j[0][q],r=m[q],k[0][q][1]);for(p=1;p<n;++p)d.call(g,j[p][q],r+=k[p-1][q][1],k[p][q][1])}return h}var a=Object,b=x["default"],c=y.zero,d=w,e=u,f=v;g.values=function(b){if(!arguments.length)return a;a=b;return g},g.order=function(a){if(!arguments.length)return b;b=typeof a=="function"?a:x[a];return g},g.offset=function(a){if(!arguments.length)return c;c=typeof a=="function"?a:y[a];return g},g.x=function(a){if(!arguments.length)return e;e=a;return g},g.y=function(a){if(!arguments.length)return f;f=a;return g},g.out=function(a){if(!arguments.length)return d;d=a;return g};return g};var x={"inside-out":function(a){var b=a.length,c,d,e=a.map(z),f=a.map(A),g=d3.range(b).sort(function(a,b){return e[a]-e[b]}),h=0,i=0,j=[],k=[];for(c=0;c<b;++c)d=g[c],h<i?(h+=f[d],j.push(d)):(i+=f[d],k.push(d));return k.reverse().concat(j)},reverse:function(a){return d3.range(a.length).reverse()},"default":function(a){return d3.range(a.length)}},y={silhouette:function(a){var b=a.length,c=a[0].length,d=[],e=0,f,g,h,i=[];for(g=0;g<c;++g){for(f=0,h=0;f<b;f++)h+=a[f][g][1];h>e&&(e=h),d.push(h)}for(g=0;g<c;++g)i[g]=(e-d[g])/2;return i},wiggle:function(a){var b=a.length,c=a[0],d=c.length,e=0,f,g,h,i,j,k,l,m,n,o=[];o[0]=m=n=0;for(g=1;g<d;++g){for(f=0,i=0;f<b;++f)i+=a[f][g][1];for(f=0,j=0,l=c[g][0]-c[g-1][0];f<b;++f){for(h=0,k=(a[f][g][1]-a[f][g-1][1])/(2*l);h<f;++h)k+=(a[h][g][1]-a[h][g-1][1])/l;j+=k*a[f][g][1]}o[g]=m-=i?j/i*l:0,m<n&&(n=m)}for(g=0;g<d;++g)o[g]-=n;return o},expand:function(a){var b=a.length,c=a[0].length,d=1/b,e,f,g,h=[];for(f=0;f<c;++f){for(e=0,g=0;e<b;e++)g+=a[e][f][1];if(g)for(e=0;e<b;e++)a[e][f][1]/=g;else for(e=0;e<b;e++)a[e][f][1]=d}for(f=0;f<c;++f)h[f]=0;return h},zero:function(a){var b=-1,c=a[0].length,d=[];while(++b<c)d[b]=0;return d}};d3.layout.histogram=function(){function e(e,f){var g=[],h=e.map(b,this),i=c.call(this,h,f),j=d.call(this,i,h,f),k,f=-1,l=h.length,m=j.length-1,n=a?1:1/l,o;while(++f<m)k=g[f]=[],k.dx=j[f+1]-(k.x=j[f]),k.y=0;f=-1;while(++f<l)o=h[f],o>=i[0]&&o<=i[1]&&(k=g[d3.bisect(j,o,1,m)-1],k.y+=n,k.push(e[f]));return g}var a=!0,b=Number,c=E,d=C;e.value=function(a){if(!arguments.length)return b;b=a;return e},e.range=function(a){if(!arguments.length)return c;c=d3.functor(a);return e},e.bins=function(a){if(!arguments.length)return d;d=typeof a=="number"?function(b){return D(b,a)}:d3.functor(a);return e},e.frequency=function(b){if(!arguments.length)return a;a=!!b;return e};return e},d3.layout.hierarchy=function(){function g(a){var b=[];e(a,0,b);return b}function f(a,b){var d=a.children,e=0;if(d){var h=-1,i=d.length,j=b+1;while(++h<i)e+=f(d[h],j)}else c&&(e=c.call(g,K?a:a.data,b));c&&(a.value=e);return e}function e(f,h,i){var j=b.call(g,f,h),k=K?f:{data:f};k.depth=h,i.push(k);if(j){var l=-1,m=j.length,n=k.children=[],o=0,p=h+1;while(++l<m)d=e(j[l],p,i),d.parent=k,n.push(d),o+=d.value;a&&n.sort(a),c&&(k.value=o)}else c&&(k.value=c.call(g,f,h));return k}var a=I,b=G,c=H;g.sort=function(b){if(!arguments.length)return a;a=b;return g},g.children=function(a){if(!arguments.length)return b;b=a;return g},g.value=function(a){if(!arguments.length)return c;c=a;return g},g.revalue=function(a){f(a,0);return a};return g};var K=!1;d3.layout.pack=function(){function c(c,d){var e=a.call(this,c,d),f=e[0];f.x=0,f.y=0,S(f);var g=b[0],h=b[1],i=1/Math.max(2*f.r/g,2*f.r/h);T(f,g/2,h/2,i);return e}var a=d3.layout.hierarchy().sort(L),b=[1,1];c.size=function(a){if(!arguments.length)return b;b=a;return c};return F(c,a)},d3.layout.cluster=function(){function d(d,e){var f=a.call(this,d,e),g=f[0],h,i=0,j,k;be(g,function(a){a.children?(a.x=W(a.children),a.y=V(a.children)):(a.x=h?i+=b(a,h):0,a.y=0,h=a)});var l=X(g),m=Y(g),n=l.x-b(l,m)/2,o=m.x+b(m,l)/2;be(g,function(a){a.x=(a.x-n)/(o-n)*c[0],a.y=(1-a.y/g.y)*c[1]});return f}var a=d3.layout.hierarchy().sort(null).value(null),b=Z,c=[1,1];d.separation=function(a){if(!arguments.length)return b;b=a;return d},d.size=function(a){if(!arguments.length)return c;c=a;return d};return F(d,a)},d3.layout.tree=function(){function d(d,e){function j(a,c,d){if(c){var e=a,f=a,g=c,h=a.parent.children[0],i=e._tree.mod,j=f._tree.mod,k=g._tree.mod,l=h._tree.mod,m;while(g=_(g),e=$(e),g&&e)h=$(h),f=_(f),f._tree.ancestor=a,m=g._tree.prelim+k-e._tree.prelim-i+b(g,e),m>0&&(bg(bh(g,a,d),a,m),i+=m,j+=m),k+=g._tree.mod,i+=e._tree.mod,l+=h._tree.mod,j+=f._tree.mod;g&&!_(f)&&(f._tree.thread=g,f._tree.mod+=k-j),e&&!$(h)&&(h._tree.thread=e,h._tree.mod+=i-l,d=a)}return d}function i(a,b){a.x=a._tree.prelim+b;var c=a.children;if(c){var d=-1,e=c.length;b+=a._tree.mod;while(++d<e)i(c[d],b)}}function h(a,c){var d=a.children,e=a._tree;if(d){var f=d.length,g=d[0],i,k=g,l,m=-1;while(++m<f)l=d[m],h(l,i),k=j(l,i,k),i=l;bf(a);var n=.5*(g._tree.prelim+l._tree.prelim);c?(e.prelim=c._tree.prelim+b(a,c),e.mod=e.prelim-n):e.prelim=n}else c&&(e.prelim=c._tree.prelim+b(a,c))}var f=a.call(this,d,e),g=f[0];be(g,function(a,b){a._tree={ancestor:a,prelim:0,mod:0,change:0,shift:0,number:b?b._tree.number+1:0}}),h(g),i(g,-g._tree.prelim);var k=ba(g,bc),l=ba(g,bb),m=ba(g,bd),n=k.x-b(k,l)/2,o=l.x+b(l,k)/2,p=m.depth||1;be(g,function(a){a.x=(a.x-n)/(o-n)*c[0],a.y=a.depth/p*c[1],delete a._tree});return f}var a=d3.layout.hierarchy().sort(null).value(null),b=Z,c=[1,1];d.separation=function(a){if(!arguments.length)return b;b=a;return d},d.size=function(a){if(!arguments.length)return c;c=a;return d};return F(d,a)},d3.layout.treemap=function(){function n(b){var d=g||a(b),e=d[0];e.x=0,e.y=0,e.dx=c[0],e.dy=c[1],g&&a.revalue(e),i([e],e.dx*e.dy/e.value),(g?k:j)(e),f&&(g=d);return d}function m(a,c,d,e){var f=-1,g=a.length,h=d.x,i=d.y,j=c?b(a.area/c):0,k;if(c==d.dx){if(e||j>d.dy)j=d.dy;while(++f<g)k=a[f],k.x=h,k.y=i,k.dy=j,h+=k.dx=j?b(k.area/j):0;k.z=!0,k.dx+=d.x+d.dx-h,d.y+=j,d.dy-=j}else{if(e||j>d.dx)j=d.dx;while(++f<g)k=a[f],k.x=h,k.y=i,k.dx=j,i+=k.dy=j?b(k.area/j):0;k.z=!1,k.dy+=d.y+d.dy-i,d.x+=j,d.dx-=j}}function l(a,b){var c=a.area,d,e=0,f=Infinity,g=-1,i=a.length;while(++g<i)d=a[g].area,d<f&&(f=d),d>e&&(e=d);c*=c,b*=b;return f||e?Math.max(b*e*h/c,c/(b*f*h)):Infinity}function k(a){if(!!a.children){var b=e(a),c=a.children.slice(),d,f=[];i(c,b.dx*b.dy/a.value),f.area=0;while(d=c.pop())f.push(d),f.area+=d.area,d.z!=null&&(m(f,d.z?b.dx:b.dy,b,!c.length),f.length=f.area=0);a.children.forEach(k)}}function j(a){if(!!a.children){var b=e(a),c=[],d=a.children.slice(),f,g=Infinity,h,k=Math.min(b.dx,b.dy),n;i(d,b.dx*b.dy/a.value),c.area=0;while((n=d.length)>0)c.push(f=d[n-1]),c.area+=f.area,(h=l(c,k))<=g?(d.pop(),g=h):(c.area-=c.pop().area,m(c,k,b,!1),k=Math.min(b.dx,b.dy),c.length=c.area=0,g=Infinity);c.length&&(m(c,k,b,!0),c.length=c.area=0),a.children.forEach(j)}}function i(a,b){var c=-1,d=a.length,e,f;while(++c<d)f=(e=a[c]).value*(b<0?0:b),e.area=isNaN(f)||f<=0?0:f}var a=d3.layout.hierarchy(),b=Math.round,c=[1,1],d=null,e=bi,f=!1,g,h=.5*(1+Math.sqrt(5));n.size=function(a){if(!arguments.length)return c;c=a;return n},n.padding=function(a){function c(b){return bj(b,a)}function b(b){var c=a.call(n,b,b.depth);return c==null?bi(b):bj(b,typeof c=="number"?[c,c,c,c]:c)}if(!arguments.length)return d;var f;e=(d=a)==null?bi:(f=typeof a)==="function"?b:f==="number"?(a=[a,a,a,a],c):c;return n},n.round=function(a){if(!arguments.length)return b!=Number;b=a?Math.round:Number;return n},n.sticky=function(a){if(!arguments.length)return f;f=a,g=null;return n},n.ratio=function(a){if(!arguments.length)return h;h=a;return n};return F(n,a)}})() <ide>\ No newline at end of file <add>(function(){function bj(a,b){var c=a.x+b[3],d=a.y+b[0],e=a.dx-b[1]-b[3],f=a.dy-b[0]-b[2];e<0&&(c+=e/2,e=0),f<0&&(d+=f/2,f=0);return{x:c,y:d,dx:e,dy:f}}function bi(a){return{x:a.x,y:a.y,dx:a.dx,dy:a.dy}}function bh(a,b,c){return a._tree.ancestor.parent==b.parent?a._tree.ancestor:c}function bg(a,b,c){a=a._tree,b=b._tree;var d=c/(b.number-a.number);a.change+=d,b.change-=d,b.shift+=c,b.prelim+=c,b.mod+=c}function bf(a){var b=0,c=0,d=a.children,e=d.length,f;while(--e>=0)f=d[e]._tree,f.prelim+=b,f.mod+=b,b+=f.shift+(c+=f.change)}function be(a,b){function c(a,d){var e=a.children;if(e){var f,g=null,h=-1,i=e.length;while(++h<i)f=e[h],c(f,g),g=f}b(a,d)}c(a,null)}function bd(a,b){return a.depth-b.depth}function bc(a,b){return b.x-a.x}function bb(a,b){return a.x-b.x}function ba(a,b){var c=a.children;if(c){var d,e=c.length,f=-1;while(++f<e)b(d=ba(c[f],b),a)>0&&(a=d)}return a}function _(a){return a.children?a.children[a.children.length-1]:a._tree.thread}function $(a){return a.children?a.children[0]:a._tree.thread}function Z(a,b){return a.parent==b.parent?1:2}function Y(a){var b=a.children;return b?Y(b[b.length-1]):a}function X(a){var b=a.children;return b?X(b[0]):a}function W(a){return a.reduce(function(a,b){return a+b.x},0)/a.length}function V(a){return 1+d3.max(a,function(a){return a.y})}function U(a,b,c){var d=b.r+c.r,e=a.r+c.r,f=b.x-a.x,g=b.y-a.y,h=Math.sqrt(f*f+g*g),i=(e*e+h*h-d*d)/(2*e*h),j=Math.acos(i),k=i*e,l=Math.sin(j)*e;f/=h,g/=h,c.x=a.x+k*f+l*g,c.y=a.y+k*g-l*f}function T(a,b,c,d){var e=a.children;a.x=b+=d*a.x,a.y=c+=d*a.y,a.r*=d;if(e){var f=-1,g=e.length;while(++f<g)T(e[f],b,c,d)}}function S(a){var b=a.children;b?(b.forEach(S),a.r=P(b)):a.r=Math.sqrt(a.value)}function R(a){delete a._pack_next,delete a._pack_prev}function Q(a){a._pack_next=a._pack_prev=a}function P(a){function l(a){b=Math.min(a.x-a.r,b),c=Math.max(a.x+a.r,c),d=Math.min(a.y-a.r,d),e=Math.max(a.y+a.r,e)}var b=Infinity,c=-Infinity,d=Infinity,e=-Infinity,f=a.length,g,h,i,j,k;a.forEach(Q),g=a[0],g.x=-g.r,g.y=0,l(g);if(f>1){h=a[1],h.x=h.r,h.y=0,l(h);if(f>2){i=a[2],U(g,h,i),l(i),M(g,i),g._pack_prev=i,M(i,h),h=g._pack_next;for(var m=3;m<f;m++){U(g,h,i=a[m]);var n=0,o=1,p=1;for(j=h._pack_next;j!==h;j=j._pack_next,o++)if(O(j,i)){n=1;break}if(n==1)for(k=g._pack_prev;k!==j._pack_prev;k=k._pack_prev,p++)if(O(k,i)){p<o&&(n=-1,j=k);break}n==0?(M(g,i),h=i,l(i)):n>0?(N(g,j),h=j,m--):(N(j,h),g=j,m--)}}}var q=(b+c)/2,r=(d+e)/2,s=0;for(var m=0;m<f;m++){var t=a[m];t.x-=q,t.y-=r,s=Math.max(s,t.r+Math.sqrt(t.x*t.x+t.y*t.y))}a.forEach(R);return s}function O(a,b){var c=b.x-a.x,d=b.y-a.y,e=a.r+b.r;return e*e-c*c-d*d>.001}function N(a,b){a._pack_next=b,b._pack_prev=a}function M(a,b){var c=a._pack_next;a._pack_next=b,b._pack_prev=a,b._pack_next=c,c._pack_prev=b}function L(a,b){return a.value-b.value}function J(a){return d3.merge(a.map(function(a){return(a.children||[]).map(function(b){return{source:a,target:b}})}))}function I(a,b){return b.value-a.value}function H(a){return a.value}function G(a){return a.children}function F(a,b){a.sort=d3.rebind(a,b.sort),a.children=d3.rebind(a,b.children),a.links=J,a.value=d3.rebind(a,b.value),a.nodes=function(b){K=!0;return(a.nodes=a)(b)};return a}function E(a){return[d3.min(a),d3.max(a)]}function D(a,b){var c=-1,d=+a[0],e=(a[1]-d)/b,f=[];while(++c<=b)f[c]=e*c+d;return f}function C(a,b){return D(a,Math.ceil(Math.log(b.length)/Math.LN2+1))}function B(a,b){return a+b[1]}function A(a){return a.reduce(B,0)}function z(a){var b=1,c=0,d=a[0][1],e,f=a.length;for(;b<f;++b)(e=a[b][1])>d&&(c=b,d=e);return c}function w(a,b,c){a.y0=b,a.y=c}function v(a){return a.y}function u(a){return a.x}function t(a){return 1}function s(a){return 20}function r(a){var b=0,c=0;a.count=0;if(!a.leaf){var d=a.nodes,e=d.length,f=-1,g;while(++f<e){g=d[f];if(g==null)continue;r(g),a.count+=g.count,b+=g.count*g.cx,c+=g.count*g.cy}}a.point&&(a.leaf||(a.point.x+=Math.random()-.5,a.point.y+=Math.random()-.5),a.count++,b+=a.point.x,c+=a.point.y),a.cx=b/a.count,a.cy=c/a.count}function q(){d3.event.stopPropagation(),d3.event.preventDefault()}function p(){i&&(q(),i=!1)}function o(){!f||(g&&(i=!0,q()),d3.event.type==="mouseup"&&n(),f.fixed=!1,e=h=f=j=null)}function n(){if(!!f){var a=j.parentNode;if(!a){f.fixed=!1,h=f=j=null;return}var b=m(a);g=!0,f.px=b[0]-h[0],f.py=b[1]-h[1],q(),e.resume()}}function m(a){return d3.event.touches?d3.svg.touches(a)[0]:d3.svg.mouse(a)}function l(a){a!==f&&(a.fixed=!1)}function k(a){a.fixed=!0}function c(a,c){if(a===c)return a;var d=b(a),e=b(c),f=d.pop(),g=e.pop(),h=null;while(f===g)h=f,f=d.pop(),g=e.pop();return h}function b(a){var b=[],c=a.parent;while(c!=null)b.push(a),a=c,c=c.parent;b.push(a);return b}function a(a){var b=a.source,d=a.target,e=c(b,d),f=[b];while(b!==e)b=b.parent,f.push(b);var g=f.length;while(d!==e)f.splice(g,0,d),d=d.parent;return f}d3.layout={},d3.layout.bundle=function(){return function(b){var c=[],d=-1,e=b.length;while(++d<e)c.push(a(b[d]));return c}},d3.layout.chord=function(){function k(){b.sort(function(a,b){return i(a.target.value,b.target.value)})}function j(){var a={},j=[],l=d3.range(e),m=[],n,o,p,q,r;b=[],c=[],n=0,q=-1;while(++q<e){o=0,r=-1;while(++r<e)o+=d[q][r];j.push(o),m.push(d3.range(e)),n+=o}g&&l.sort(function(a,b){return g(j[a],j[b])}),h&&m.forEach(function(a,b){a.sort(function(a,c){return h(d[b][a],d[b][c])})}),n=(2*Math.PI-f*e)/n,o=0,q=-1;while(++q<e){p=o,r=-1;while(++r<e){var s=l[q],t=m[q][r],u=d[s][t];a[s+"-"+t]={index:s,subindex:t,startAngle:o,endAngle:o+=u*n,value:u}}c.push({index:s,startAngle:p,endAngle:o,value:(o-p)/n}),o+=f}q=-1;while(++q<e){r=q-1;while(++r<e){var v=a[q+"-"+r],w=a[r+"-"+q];(v.value||w.value)&&b.push(v.value<w.value?{source:w,target:v}:{source:v,target:w})}}i&&k()}var a={},b,c,d,e,f=0,g,h,i;a.matrix=function(f){if(!arguments.length)return d;e=(d=f)&&d.length,b=c=null;return a},a.padding=function(d){if(!arguments.length)return f;f=d,b=c=null;return a},a.sortGroups=function(d){if(!arguments.length)return g;g=d,b=c=null;return a},a.sortSubgroups=function(c){if(!arguments.length)return h;h=c,b=null;return a},a.sortChords=function(c){if(!arguments.length)return i;i=c,b&&k();return a},a.chords=function(){b||j();return b},a.groups=function(){c||j();return c};return a},d3.layout.force=function(){function G(b,c){var d=m(this.parentNode);(f=b).fixed=!0,g=!1,j=this,e=a,h=[d[0]-b.x,d[1]-b.y],q()}function F(){var a=A.length,e=B.length,f=d3.geom.quadtree(A),g,h,j,k,l,m,n;for(g=0;g<e;++g){h=B[g],j=h.source,k=h.target,m=k.x-j.x,n=k.y-j.y;if(l=m*m+n*n)l=d*D[g]*((l=Math.sqrt(l))-C[g])/l,m*=l,n*=l,k.x-=m,k.y-=n,j.x+=m,j.y+=n}var o=d*x;m=c[0]/2,n=c[1]/2,g=-1;while(++g<a)h=A[g],h.x+=(m-h.x)*o,h.y+=(n-h.y)*o;r(f);var p=d*w;g=-1;while(++g<a)f.visit(E(A[g],p));g=-1;while(++g<a)h=A[g],h.fixed?(h.x=h.px,h.y=h.py):(h.x-=(h.px-(h.px=h.x))*i,h.y-=(h.py-(h.py=h.y))*i);b.tick.dispatch({type:"tick",alpha:d});return(d*=.99)<.005}function E(a,b){return function(c,d,e,f,g){if(c.point!==a){var h=c.cx-a.x,i=c.cy-a.y,j=1/Math.sqrt(h*h+i*i);if((f-d)*j<y){var k=b*c.count*j*j;a.x+=h*k,a.y+=i*k;return!0}if(c.point&&isFinite(j)){var k=b*j*j;a.x+=h*k,a.y+=i*k}}}}var a={},b=d3.dispatch("tick"),c=[1,1],d,i=.9,u=s,v=t,w=-30,x=.1,y=.8,z,A=[],B=[],C,D;a.on=function(c,d){b[c].add(d);return a},a.nodes=function(b){if(!arguments.length)return A;A=b;return a},a.links=function(b){if(!arguments.length)return B;B=b;return a},a.size=function(b){if(!arguments.length)return c;c=b;return a},a.linkDistance=function(b){if(!arguments.length)return u;u=d3.functor(b);return a},a.distance=a.linkDistance,a.linkStrength=function(b){if(!arguments.length)return v;v=d3.functor(b);return a},a.friction=function(b){if(!arguments.length)return i;i=b;return a},a.charge=function(b){if(!arguments.length)return w;w=b;return a},a.gravity=function(b){if(!arguments.length)return x;x=b;return a},a.theta=function(b){if(!arguments.length)return y;y=b;return a},a.start=function(){function l(){if(!i){i=[];for(d=0;d<e;++d)i[d]=[];for(d=0;d<f;++d){var a=B[d];i[a.source.index].push(a.target),i[a.target.index].push(a.source)}}return i[b]}function k(a,c){var d=l(b),e=-1,f=d.length,g;while(++e<f)if(!isNaN(g=d[e][a]))return g;return Math.random()*c}var b,d,e=A.length,f=B.length,g=c[0],h=c[1],i,j;for(b=0;b<e;++b)(j=A[b]).index=b;C=[],D=[];for(b=0;b<f;++b)j=B[b],typeof j.source=="number"&&(j.source=A[j.source]),typeof j.target=="number"&&(j.target=A[j.target]),C[b]=u.call(this,j,b),D[b]=v.call(this,j,b);for(b=0;b<e;++b)j=A[b],isNaN(j.x)&&(j.x=k("x",g)),isNaN(j.y)&&(j.y=k("y",h)),isNaN(j.px)&&(j.px=j.x),isNaN(j.py)&&(j.py=j.y);return a.resume()},a.resume=function(){d=.1,d3.timer(F);return a},a.stop=function(){d=0;return a},a.drag=function(){this.on("mouseover.force",k).on("mouseout.force",l).on("mousedown.force",G).on("touchstart.force",G),d3.select(window).on("mousemove.force",n).on("touchmove.force",n).on("mouseup.force",o,!0).on("touchend.force",o,!0).on("click.force",p,!0);return a};return a};var e,f,g,h,i,j;d3.layout.partition=function(){function e(e,f){var g=a.call(this,e,f);c(g[0],0,b[0],b[1]/d(g[0]));return g}function d(a){var b=a.children,c=0;if(b){var e=-1,f=b.length;while(++e<f)c=Math.max(c,d(b[e]))}return 1+c}function c(a,b,d,e){var f=a.children;a.x=b,a.y=a.depth*e,a.dx=d,a.dy=e;if(f){var g=-1,h=f.length,i,j;d/=a.value;while(++g<h)c(i=f[g],b,j=i.value*d,e),b+=j}}var a=d3.layout.hierarchy(),b=[1,1];e.size=function(a){if(!arguments.length)return b;b=a;return e};return F(e,a)},d3.layout.pie=function(){function f(f,g){var h=+(typeof c=="function"?c.apply(this,arguments):c),i=(typeof e=="function"?e.apply(this,arguments):e)-c,j=d3.range(f.length);b!=null&&j.sort(function(a,c){return b(f[a],f[c])});var k=f.map(a);i/=k.reduce(function(a,b){return a+b},0);var l=j.map(function(a){return{data:f[a],value:d=k[a],startAngle:h,endAngle:h+=d*i}});return f.map(function(a,b){return l[j[b]]})}var a=Number,b=null,c=0,e=2*Math.PI;f.value=function(b){if(!arguments.length)return a;a=b;return f},f.sort=function(a){if(!arguments.length)return b;b=a;return f},f.startAngle=function(a){if(!arguments.length)return c;c=a;return f},f.endAngle=function(a){if(!arguments.length)return e;e=a;return f};return f},d3.layout.stack=function(){function g(h,i){var j=h.map(function(b,c){return a.call(g,b,c)}),k=j.map(function(a,b){return a.map(function(a,b){return[e.call(g,a,b),f.call(g,a,b)]})}),l=b.call(g,k,i);j=d3.permute(j,l),k=d3.permute(k,l);var m=c.call(g,k,i),n=j.length,o=j[0].length,p,q,r;for(q=0;q<o;++q){d.call(g,j[0][q],r=m[q],k[0][q][1]);for(p=1;p<n;++p)d.call(g,j[p][q],r+=k[p-1][q][1],k[p][q][1])}return h}var a=Object,b=x["default"],c=y.zero,d=w,e=u,f=v;g.values=function(b){if(!arguments.length)return a;a=b;return g},g.order=function(a){if(!arguments.length)return b;b=typeof a=="function"?a:x[a];return g},g.offset=function(a){if(!arguments.length)return c;c=typeof a=="function"?a:y[a];return g},g.x=function(a){if(!arguments.length)return e;e=a;return g},g.y=function(a){if(!arguments.length)return f;f=a;return g},g.out=function(a){if(!arguments.length)return d;d=a;return g};return g};var x={"inside-out":function(a){var b=a.length,c,d,e=a.map(z),f=a.map(A),g=d3.range(b).sort(function(a,b){return e[a]-e[b]}),h=0,i=0,j=[],k=[];for(c=0;c<b;++c)d=g[c],h<i?(h+=f[d],j.push(d)):(i+=f[d],k.push(d));return k.reverse().concat(j)},reverse:function(a){return d3.range(a.length).reverse()},"default":function(a){return d3.range(a.length)}},y={silhouette:function(a){var b=a.length,c=a[0].length,d=[],e=0,f,g,h,i=[];for(g=0;g<c;++g){for(f=0,h=0;f<b;f++)h+=a[f][g][1];h>e&&(e=h),d.push(h)}for(g=0;g<c;++g)i[g]=(e-d[g])/2;return i},wiggle:function(a){var b=a.length,c=a[0],d=c.length,e=0,f,g,h,i,j,k,l,m,n,o=[];o[0]=m=n=0;for(g=1;g<d;++g){for(f=0,i=0;f<b;++f)i+=a[f][g][1];for(f=0,j=0,l=c[g][0]-c[g-1][0];f<b;++f){for(h=0,k=(a[f][g][1]-a[f][g-1][1])/(2*l);h<f;++h)k+=(a[h][g][1]-a[h][g-1][1])/l;j+=k*a[f][g][1]}o[g]=m-=i?j/i*l:0,m<n&&(n=m)}for(g=0;g<d;++g)o[g]-=n;return o},expand:function(a){var b=a.length,c=a[0].length,d=1/b,e,f,g,h=[];for(f=0;f<c;++f){for(e=0,g=0;e<b;e++)g+=a[e][f][1];if(g)for(e=0;e<b;e++)a[e][f][1]/=g;else for(e=0;e<b;e++)a[e][f][1]=d}for(f=0;f<c;++f)h[f]=0;return h},zero:function(a){var b=-1,c=a[0].length,d=[];while(++b<c)d[b]=0;return d}};d3.layout.histogram=function(){function e(e,f){var g=[],h=e.map(b,this),i=c.call(this,h,f),j=d.call(this,i,h,f),k,f=-1,l=h.length,m=j.length-1,n=a?1:1/l,o;while(++f<m)k=g[f]=[],k.dx=j[f+1]-(k.x=j[f]),k.y=0;f=-1;while(++f<l)o=h[f],o>=i[0]&&o<=i[1]&&(k=g[d3.bisect(j,o,1,m)-1],k.y+=n,k.push(e[f]));return g}var a=!0,b=Number,c=E,d=C;e.value=function(a){if(!arguments.length)return b;b=a;return e},e.range=function(a){if(!arguments.length)return c;c=d3.functor(a);return e},e.bins=function(a){if(!arguments.length)return d;d=typeof a=="number"?function(b){return D(b,a)}:d3.functor(a);return e},e.frequency=function(b){if(!arguments.length)return a;a=!!b;return e};return e},d3.layout.hierarchy=function(){function g(a){var b=[];e(a,0,b);return b}function f(a,b){var d=a.children,e=0;if(d){var h=-1,i=d.length,j=b+1;while(++h<i)e+=f(d[h],j)}else c&&(e=c.call(g,K?a:a.data,b));c&&(a.value=e);return e}function e(f,h,i){var j=b.call(g,f,h),k=K?f:{data:f};k.depth=h,i.push(k);if(j){var l=-1,m=j.length,n=k.children=[],o=0,p=h+1;while(++l<m)d=e(j[l],p,i),d.parent=k,n.push(d),o+=d.value;a&&n.sort(a),c&&(k.value=o)}else c&&(k.value=c.call(g,f,h));return k}var a=I,b=G,c=H;g.sort=function(b){if(!arguments.length)return a;a=b;return g},g.children=function(a){if(!arguments.length)return b;b=a;return g},g.value=function(a){if(!arguments.length)return c;c=a;return g},g.revalue=function(a){f(a,0);return a};return g};var K=!1;d3.layout.pack=function(){function c(c,d){var e=a.call(this,c,d),f=e[0];f.x=0,f.y=0,S(f);var g=b[0],h=b[1],i=1/Math.max(2*f.r/g,2*f.r/h);T(f,g/2,h/2,i);return e}var a=d3.layout.hierarchy().sort(L),b=[1,1];c.size=function(a){if(!arguments.length)return b;b=a;return c};return F(c,a)},d3.layout.cluster=function(){function d(d,e){var f=a.call(this,d,e),g=f[0],h,i=0,j,k;be(g,function(a){a.children?(a.x=W(a.children),a.y=V(a.children)):(a.x=h?i+=b(a,h):0,a.y=0,h=a)});var l=X(g),m=Y(g),n=l.x-b(l,m)/2,o=m.x+b(m,l)/2;be(g,function(a){a.x=(a.x-n)/(o-n)*c[0],a.y=(1-a.y/g.y)*c[1]});return f}var a=d3.layout.hierarchy().sort(null).value(null),b=Z,c=[1,1];d.separation=function(a){if(!arguments.length)return b;b=a;return d},d.size=function(a){if(!arguments.length)return c;c=a;return d};return F(d,a)},d3.layout.tree=function(){function d(d,e){function j(a,c,d){if(c){var e=a,f=a,g=c,h=a.parent.children[0],i=e._tree.mod,j=f._tree.mod,k=g._tree.mod,l=h._tree.mod,m;while(g=_(g),e=$(e),g&&e)h=$(h),f=_(f),f._tree.ancestor=a,m=g._tree.prelim+k-e._tree.prelim-i+b(g,e),m>0&&(bg(bh(g,a,d),a,m),i+=m,j+=m),k+=g._tree.mod,i+=e._tree.mod,l+=h._tree.mod,j+=f._tree.mod;g&&!_(f)&&(f._tree.thread=g,f._tree.mod+=k-j),e&&!$(h)&&(h._tree.thread=e,h._tree.mod+=i-l,d=a)}return d}function i(a,b){a.x=a._tree.prelim+b;var c=a.children;if(c){var d=-1,e=c.length;b+=a._tree.mod;while(++d<e)i(c[d],b)}}function h(a,c){var d=a.children,e=a._tree;if(d){var f=d.length,g=d[0],i,k=g,l,m=-1;while(++m<f)l=d[m],h(l,i),k=j(l,i,k),i=l;bf(a);var n=.5*(g._tree.prelim+l._tree.prelim);c?(e.prelim=c._tree.prelim+b(a,c),e.mod=e.prelim-n):e.prelim=n}else c&&(e.prelim=c._tree.prelim+b(a,c))}var f=a.call(this,d,e),g=f[0];be(g,function(a,b){a._tree={ancestor:a,prelim:0,mod:0,change:0,shift:0,number:b?b._tree.number+1:0}}),h(g),i(g,-g._tree.prelim);var k=ba(g,bc),l=ba(g,bb),m=ba(g,bd),n=k.x-b(k,l)/2,o=l.x+b(l,k)/2,p=m.depth||1;be(g,function(a){a.x=(a.x-n)/(o-n)*c[0],a.y=a.depth/p*c[1],delete a._tree});return f}var a=d3.layout.hierarchy().sort(null).value(null),b=Z,c=[1,1];d.separation=function(a){if(!arguments.length)return b;b=a;return d},d.size=function(a){if(!arguments.length)return c;c=a;return d};return F(d,a)},d3.layout.treemap=function(){function n(b){var d=g||a(b),e=d[0];e.x=0,e.y=0,e.dx=c[0],e.dy=c[1],g&&a.revalue(e),i([e],e.dx*e.dy/e.value),(g?k:j)(e),f&&(g=d);return d}function m(a,c,d,e){var f=-1,g=a.length,h=d.x,i=d.y,j=c?b(a.area/c):0,k;if(c==d.dx){if(e||j>d.dy)j=d.dy;while(++f<g)k=a[f],k.x=h,k.y=i,k.dy=j,h+=k.dx=j?b(k.area/j):0;k.z=!0,k.dx+=d.x+d.dx-h,d.y+=j,d.dy-=j}else{if(e||j>d.dx)j=d.dx;while(++f<g)k=a[f],k.x=h,k.y=i,k.dx=j,i+=k.dy=j?b(k.area/j):0;k.z=!1,k.dy+=d.y+d.dy-i,d.x+=j,d.dx-=j}}function l(a,b){var c=a.area,d,e=0,f=Infinity,g=-1,i=a.length;while(++g<i){d=a[g].area;if(d<=0||isNaN(d))continue;d<f&&(f=d),d>e&&(e=d)}c*=c,b*=b;return c&&(f||e)?Math.max(b*e*h/c,c/(b*f*h)):Infinity}function k(a){if(!!a.children){var b=e(a),c=a.children.slice(),d,f=[];i(c,b.dx*b.dy/a.value),f.area=0;while(d=c.pop())f.push(d),f.area+=d.area,d.z!=null&&(m(f,d.z?b.dx:b.dy,b,!c.length),f.length=f.area=0);a.children.forEach(k)}}function j(a){if(!!a.children){var b=e(a),c=[],d=a.children.slice(),f,g=Infinity,h,k=Math.min(b.dx,b.dy),n;i(d,b.dx*b.dy/a.value),c.area=0;while((n=d.length)>0)c.push(f=d[n-1]),c.area+=f.area,(h=l(c,k))<=g?(d.pop(),g=h):(c.area-=c.pop().area,m(c,k,b,!1),k=Math.min(b.dx,b.dy),c.length=c.area=0,g=Infinity);c.length&&(m(c,k,b,!0),c.length=c.area=0),a.children.forEach(j)}}function i(a,b){var c=-1,d=a.length,e,f;while(++c<d)f=(e=a[c]).value*(b<0?0:b),e.area=isNaN(f)||f<=0?0:f}var a=d3.layout.hierarchy(),b=Math.round,c=[1,1],d=null,e=bi,f=!1,g,h=.5*(1+Math.sqrt(5));n.size=function(a){if(!arguments.length)return c;c=a;return n},n.padding=function(a){function c(b){return bj(b,a)}function b(b){var c=a.call(n,b,b.depth);return c==null?bi(b):bj(b,typeof c=="number"?[c,c,c,c]:c)}if(!arguments.length)return d;var f;e=(d=a)==null?bi:(f=typeof a)==="function"?b:f==="number"?(a=[a,a,a,a],c):c;return n},n.round=function(a){if(!arguments.length)return b!=Number;b=a?Math.round:Number;return n},n.sticky=function(a){if(!arguments.length)return f;f=a,g=null;return n},n.ratio=function(a){if(!arguments.length)return h;h=a;return n};return F(n,a)}})() <ide>\ No newline at end of file <ide><path>src/layout/treemap.js <ide> d3.layout.treemap = function() { <ide> n = row.length; <ide> while (++i < n) { <ide> r = row[i].area; <add> if (r <= 0 || isNaN(r)) continue; <ide> if (r < rmin) rmin = r; <ide> if (r > rmax) rmax = r; <ide> } <ide> s *= s; <ide> u *= u; <del> return rmin || rmax <add> return s && (rmin || rmax) <ide> ? Math.max((u * rmax * ratio) / s, s / (u * rmin * ratio)) <ide> : Infinity; <ide> }
3
PHP
PHP
return specified default value in entitycontext
f4b90755f2a79841df888a204ac9bfec56d418ba
<ide><path>src/View/Form/EntityContext.php <ide> public function val($field, $options = []) <ide> if (is_array($entity)) { <ide> $key = array_pop($parts); <ide> <del> return isset($entity[$key]) ? $entity[$key] : null; <add> return isset($entity[$key]) ? $entity[$key] : $options['default']; <ide> } <ide> <ide> return null;
1
Javascript
Javascript
fix some repl context issues
7e977d7cd41cd57ce6bc6b7b639e88377d725cf3
<ide><path>lib/repl.js <ide> REPLServer.prototype.createContext = function() { <ide> context = vm.createContext(); <ide> }); <ide> for (const name of Object.getOwnPropertyNames(global)) { <del> Object.defineProperty(context, name, <del> Object.getOwnPropertyDescriptor(global, name)); <add> // Only set properties on the context that do not exist as primordial. <add> if (!(name in primordials)) { <add> Object.defineProperty(context, name, <add> Object.getOwnPropertyDescriptor(global, name)); <add> } <ide> } <ide> context.global = context; <ide> const _console = new Console(this.outputStream); <ide><path>test/parallel/test-repl-context.js <ide> const stream = new ArrayStream(); <ide> useGlobal: false <ide> }); <ide> <add> let output = ''; <add> stream.write = function(d) { <add> output += d; <add> }; <add> <ide> // Ensure that the repl context gets its own "console" instance. <ide> assert(r.context.console); <ide> <ide> // Ensure that the repl console instance is not the global one. <ide> assert.notStrictEqual(r.context.console, console); <add> assert.notStrictEqual(r.context.Object, Object); <add> <add> stream.run(['({} instanceof Object)']); <add> <add> assert.strictEqual(output, 'true\n> '); <ide> <ide> const context = r.createContext(); <ide> // Ensure that the repl context gets its own "console" instance.
2
Javascript
Javascript
use blocks instead of async iife
ba4466e1b18cbcf56ac357974c09e1ccf9248c02
<ide><path>test/parallel/test-stream-readable-async-iterators.js <ide> async function tests() { <ide> AsyncIteratorPrototype); <ide> } <ide> <del> await (async function() { <add> { <ide> const readable = new Readable({ objectMode: true, read() {} }); <ide> readable.push(0); <ide> readable.push(1); <ide> async function tests() { <ide> for await (const d of iter) { <ide> assert.strictEqual(d, 1); <ide> } <del> })(); <add> } <ide> <del> await (async function() { <add> { <ide> console.log('read without for..await'); <ide> const max = 5; <ide> const readable = new Readable({ <ide> async function tests() { <ide> <ide> const last = await iter.next(); <ide> assert.strictEqual(last.done, true); <del> })(); <add> } <ide> <del> await (async function() { <add> { <ide> console.log('read without for..await deferred'); <ide> const readable = new Readable({ <ide> objectMode: true, <ide> async function tests() { <ide> <ide> const last = await iter.next(); <ide> assert.strictEqual(last.done, true); <del> })(); <add> } <ide> <del> await (async function() { <add> { <ide> console.log('read without for..await with errors'); <ide> const max = 3; <ide> const readable = new Readable({ <ide> async function tests() { <ide> }); <ide> <ide> readable.destroy(new Error('kaboom')); <del> })(); <add> } <ide> <del> await (async function() { <add> { <ide> console.log('call next() after error'); <ide> const readable = new Readable({ <ide> read() {} <ide> async function tests() { <ide> const err = new Error('kaboom'); <ide> readable.destroy(new Error('kaboom')); <ide> await assert.rejects(iterator.next.bind(iterator), err); <del> })(); <add> } <ide> <del> await (async function() { <add> { <ide> console.log('read object mode'); <ide> const max = 42; <ide> let readed = 0; <ide> async function tests() { <ide> } <ide> <ide> assert.strictEqual(readed, received); <del> })(); <add> } <ide> <del> await (async function() { <add> { <ide> console.log('destroy sync'); <ide> const readable = new Readable({ <ide> objectMode: true, <ide> async function tests() { <ide> err = e; <ide> } <ide> assert.strictEqual(err.message, 'kaboom from read'); <del> })(); <add> } <ide> <del> await (async function() { <add> { <ide> console.log('destroy async'); <ide> const readable = new Readable({ <ide> objectMode: true, <ide> async function tests() { <ide> <ide> assert.strictEqual(err.message, 'kaboom'); <ide> assert.strictEqual(received, 1); <del> })(); <add> } <ide> <del> await (async function() { <add> { <ide> console.log('destroyed by throw'); <ide> const readable = new Readable({ <ide> objectMode: true, <ide> async function tests() { <ide> <ide> assert.strictEqual(err.message, 'kaboom'); <ide> assert.strictEqual(readable.destroyed, true); <del> })(); <add> } <ide> <del> await (async function() { <add> { <ide> console.log('destroyed sync after push'); <ide> const readable = new Readable({ <ide> objectMode: true, <ide> async function tests() { <ide> <ide> assert.strictEqual(err.message, 'kaboom'); <ide> assert.strictEqual(received, 1); <del> })(); <add> } <ide> <del> await (async function() { <add> { <ide> console.log('push async'); <ide> const max = 42; <ide> let readed = 0; <ide> async function tests() { <ide> } <ide> <ide> assert.strictEqual(readed, received); <del> })(); <add> } <ide> <del> await (async function() { <add> { <ide> console.log('push binary async'); <ide> const max = 42; <ide> let readed = 0; <ide> async function tests() { <ide> } <ide> <ide> assert.strictEqual(data, expected); <del> })(); <add> } <ide> <del> await (async function() { <add> { <ide> console.log('.next() on destroyed stream'); <ide> const readable = new Readable({ <ide> read() { <ide> async function tests() { <ide> <ide> const { done } = await readable[Symbol.asyncIterator]().next(); <ide> assert.strictEqual(done, true); <del> })(); <add> } <ide> <del> await (async function() { <add> { <ide> console.log('.next() on pipelined stream'); <ide> const readable = new Readable({ <ide> read() { <ide> async function tests() { <ide> } catch (e) { <ide> assert.strictEqual(e, err); <ide> } <del> })(); <add> } <ide> <del> await (async () => { <add> { <ide> console.log('iterating on an ended stream completes'); <ide> const r = new Readable({ <ide> objectMode: true, <ide> async function tests() { <ide> // eslint-disable-next-line no-unused-vars <ide> for await (const b of r) { <ide> } <del> })(); <add> } <ide> <del> await (async () => { <add> { <ide> console.log('destroy mid-stream does not error'); <ide> const r = new Readable({ <ide> objectMode: true, <ide> async function tests() { <ide> for await (const a of r) { <ide> r.destroy(null); <ide> } <del> })(); <add> } <ide> <del> await (async () => { <add> { <ide> console.log('all next promises must be resolved on end'); <ide> const r = new Readable({ <ide> objectMode: true, <ide> async function tests() { <ide> r.push(null); <ide> assert.deepStrictEqual(await c, { done: true, value: undefined }); <ide> assert.deepStrictEqual(await d, { done: true, value: undefined }); <del> })(); <add> } <ide> <del> await (async () => { <add> { <ide> console.log('all next promises must be resolved on destroy'); <ide> const r = new Readable({ <ide> objectMode: true, <ide> async function tests() { <ide> r.destroy(); <ide> assert.deepStrictEqual(await c, { done: true, value: undefined }); <ide> assert.deepStrictEqual(await d, { done: true, value: undefined }); <del> })(); <add> } <ide> <del> await (async () => { <add> { <ide> console.log('all next promises must be resolved on destroy with error'); <ide> const r = new Readable({ <ide> objectMode: true, <ide> async function tests() { <ide> } <ide> assert.strictEqual(e, err); <ide> })()]); <del> })(); <add> } <ide> } <ide> <ide> // to avoid missing some tests if a promise does not resolve
1
Javascript
Javascript
add validateposition and use in read and readsync
0aaa804f4399ea4728971ff9ce3e7af5e9886436
<ide><path>lib/fs.js <ide> const { <ide> ERR_INVALID_ARG_VALUE, <ide> ERR_INVALID_ARG_TYPE, <ide> ERR_FEATURE_UNAVAILABLE_ON_PLATFORM, <del> ERR_OUT_OF_RANGE, <ide> }, <ide> hideStackFrames, <ide> uvErrmapGet, <ide> const { <ide> validateOffsetLengthRead, <ide> validateOffsetLengthWrite, <ide> validatePath, <add> validatePosition, <ide> validateRmOptions, <ide> validateRmOptionsSync, <ide> validateRmdirOptions, <ide> function read(fd, buffer, offset, length, position, callback) { <ide> if (position == null) <ide> position = -1; <ide> <del> if (typeof position === 'number') { <del> validateInteger(position, 'position'); <del> } else if (typeof position === 'bigint') { <del> if (!(position >= -(2n ** 63n) && position <= 2n ** 63n - 1n)) { <del> throw new ERR_OUT_OF_RANGE('position', <del> `>= ${-(2n ** 63n)} && <= ${2n ** 63n - 1n}`, <del> position); <del> } <del> } else { <del> throw new ERR_INVALID_ARG_TYPE('position', <del> ['integer', 'bigint'], <del> position); <del> } <add> validatePosition(position, 'position'); <ide> <ide> function wrapper(err, bytesRead) { <ide> // Retain a reference to buffer so that it can't be GC'ed too soon. <ide> function readSync(fd, buffer, offset, length, position) { <ide> if (position == null) <ide> position = -1; <ide> <del> if (typeof position === 'number') { <del> validateInteger(position, 'position'); <del> } else if (typeof position === 'bigint') { <del> if (!(position >= -(2n ** 63n) && position <= 2n ** 63n - 1n)) { <del> throw new ERR_OUT_OF_RANGE('position', <del> `>= ${-(2n ** 63n)} && <= ${2n ** 63n - 1n}`, <del> position); <del> } <del> } else { <del> throw new ERR_INVALID_ARG_TYPE('position', <del> ['integer', 'bigint'], <del> position); <del> } <add> validatePosition(position, 'position'); <ide> <ide> const ctx = {}; <ide> const result = binding.read(fd, buffer, offset, length, position, <ide><path>lib/internal/fs/utils.js <ide> const { <ide> validateAbortSignal, <ide> validateBoolean, <ide> validateInt32, <del> validateUint32 <add> validateInteger, <add> validateUint32, <ide> } = require('internal/validators'); <ide> const pathModule = require('path'); <ide> const kType = Symbol('type'); <ide> const validateStringAfterArrayBufferView = hideStackFrames((buffer, name) => { <ide> ); <ide> }); <ide> <add>const validatePosition = hideStackFrames((position, name) => { <add> if (typeof position === 'number') { <add> validateInteger(position, 'position'); <add> } else if (typeof position === 'bigint') { <add> if (!(position >= -(2n ** 63n) && position <= 2n ** 63n - 1n)) { <add> throw new ERR_OUT_OF_RANGE('position', <add> `>= ${-(2n ** 63n)} && <= ${2n ** 63n - 1n}`, <add> position); <add> } <add> } else { <add> throw new ERR_INVALID_ARG_TYPE('position', <add> ['integer', 'bigint'], <add> position); <add> } <add>}); <add> <ide> module.exports = { <ide> assertEncoding, <ide> BigIntStats, // for testing <ide> module.exports = { <ide> validateOffsetLengthRead, <ide> validateOffsetLengthWrite, <ide> validatePath, <add> validatePosition, <ide> validateRmOptions, <ide> validateRmOptionsSync, <ide> validateRmdirOptions,
2
Ruby
Ruby
use ternary instead explicit return
c91a13f8f557cc1d21fccb5f964d50438cd60a52
<ide><path>activerecord/lib/active_record/associations/association_collection.rb <ide> def include?(record) <ide> return false unless record.is_a?(@reflection.klass) <ide> return include_in_memory?(record) unless record.persisted? <ide> load_target if @reflection.options[:finder_sql] && !loaded? <del> return @target.include?(record) if loaded? <del> exists?(record) <add> loaded? ? @target.include?(record) : exists?(record) <ide> end <ide> <ide> def proxy_respond_to?(method, include_private = false)
1
PHP
PHP
fix failing test
0e7b0ad11173bb3c814eef092a2a8dfc35d29381
<ide><path>lib/Cake/Test/Case/View/Helper/RssHelperTest.php <ide> public function testElementNamespaceWithoutPrefix() { <ide> <ide> public function testElementNamespaceWithPrefix() { <ide> $item = array( <del> 'title' => 'Title', <del> 'dc:creator' => 'Alex', <del> 'xy:description' => 'descriptive words' <del> ); <add> 'title' => 'Title', <add> 'dc:creator' => 'Alex', <add> 'xy:description' => 'descriptive words' <add> ); <ide> $attributes = array( <del> 'namespace' => array( <del> 'prefix' => 'dc', <del> 'url' => 'http://link.com' <del> ) <add> 'namespace' => array( <add> 'prefix' => 'dc', <add> 'url' => 'http://link.com' <add> ) <ide> ); <ide> $result = $this->Rss->item($attributes, $item); <ide> $expected = array( <ide> 'item' => array( <del> 'xmlns:dc' => 'http://link.com' <add> 'xmlns:dc' => 'http://link.com' <ide> ), <ide> 'title' => array( <del> 'xmlns:dc' => 'http://link.com' <add> 'xmlns:dc' => 'http://link.com' <ide> ), <ide> 'Title', <ide> '/title', <ide> 'dc:creator' => array( <del> 'xmlns:dc' => 'http://link.com' <add> 'xmlns:dc' => 'http://link.com' <ide> ), <ide> 'Alex', <ide> '/dc:creator', <del> 'description' => array( <del> 'xmlns:dc' => 'http://link.com' <add> 'xy:description' => array( <add> 'xmlns:dc' => 'http://link.com' <ide> ), <ide> 'descriptive words', <del> '/description', <add> '/xy:description', <ide> '/item' <ide> ); <ide> $this->assertTags($result, $expected, true);
1
Ruby
Ruby
add tap to formula json output
a20b60112059a2f807406a79505bc066c86712d8
<ide><path>Library/Homebrew/formula.rb <ide> def to_hash <ide> hsh = { <ide> "name" => name, <ide> "full_name" => full_name, <add> "tap" => tap.name, <ide> "oldname" => oldname, <ide> "aliases" => aliases.sort, <ide> "versioned_formulae" => versioned_formulae.map(&:name),
1
Java
Java
fix links and tests broken during merge
66e9095ee9b9293a1879f47326ca5c666f7414dc
<ide><path>spring-beans/src/main/java/org/springframework/beans/factory/support/RootBeanDefinition.java <ide> public Set<Member> getExternallyManagedConfigMembers() { <ide> /** <ide> * Register an externally managed configuration initialization method &mdash; <ide> * for example, a method annotated with JSR-250's <del> * {@link javax.annotation.PostConstruct} annotation. <add> * {@link jakarta.annotation.PostConstruct} annotation. <ide> * <p>The supplied {@code initMethod} may be the <ide> * {@linkplain Method#getName() simple method name} for non-private methods or the <ide> * {@linkplain org.springframework.util.ClassUtils#getQualifiedMethodName(Method) <ide> public Set<String> getExternallyManagedInitMethods() { <ide> /** <ide> * Register an externally managed configuration destruction method &mdash; <ide> * for example, a method annotated with JSR-250's <del> * {@link javax.annotation.PreDestroy} annotation. <add> * {@link jakarta.annotation.PreDestroy} annotation. <ide> * <p>The supplied {@code destroyMethod} may be the <ide> * {@linkplain Method#getName() simple method name} for non-private methods or the <ide> * {@linkplain org.springframework.util.ClassUtils#getQualifiedMethodName(Method) <ide><path>spring-context/src/test/java/org/springframework/context/annotation/InitDestroyMethodLifecycleTests.java <ide> import java.util.ArrayList; <ide> import java.util.List; <ide> <del>import javax.annotation.PostConstruct; <del>import javax.annotation.PreDestroy; <del> <add>import jakarta.annotation.PostConstruct; <add>import jakarta.annotation.PreDestroy; <ide> import org.junit.jupiter.api.Test; <ide> <ide> import org.springframework.beans.factory.DisposableBean; <ide> * <li>{@link InitializingBean} &amp; {@link DisposableBean} interfaces</li> <ide> * <li>Custom {@link RootBeanDefinition#getInitMethodName() init} &amp; <ide> * {@link RootBeanDefinition#getDestroyMethodName() destroy} methods</li> <del> * <li>JSR 250's {@link javax.annotation.PostConstruct @PostConstruct} &amp; <del> * {@link javax.annotation.PreDestroy @PreDestroy} annotations</li> <add> * <li>JSR 250's {@link jakarta.annotation.PostConstruct @PostConstruct} &amp; <add> * {@link jakarta.annotation.PreDestroy @PreDestroy} annotations</li> <ide> * </ul> <ide> * <ide> * @author Sam Brannen <ide> public void destroy() throws Exception { <ide> } <ide> } <ide> <del> <ide> static class CustomInitDestroyBean { <ide> <ide> final List<String> initMethods = new ArrayList<>(); <ide><path>spring-context/src/test/java/org/springframework/context/annotation/Spr3775InitDestroyLifecycleTests.java <del>/* <del> * Copyright 2002-2022 the original author or authors. <del> * <del> * Licensed under the Apache License, Version 2.0 (the "License"); <del> * you may not use this file except in compliance with the License. <del> * You may obtain a copy of the License at <del> * <del> * https://www.apache.org/licenses/LICENSE-2.0 <del> * <del> * Unless required by applicable law or agreed to in writing, software <del> * distributed under the License is distributed on an "AS IS" BASIS, <del> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <del> * See the License for the specific language governing permissions and <del> * limitations under the License. <del> */ <del> <del>package org.springframework.context.annotation; <del> <del>import java.util.ArrayList; <del>import java.util.Arrays; <del>import java.util.List; <del> <del>import jakarta.annotation.PostConstruct; <del>import jakarta.annotation.PreDestroy; <del>import org.junit.jupiter.api.Test; <del> <del>import org.springframework.beans.factory.DisposableBean; <del>import org.springframework.beans.factory.InitializingBean; <del>import org.springframework.beans.factory.support.DefaultListableBeanFactory; <del>import org.springframework.beans.factory.support.RootBeanDefinition; <del>import org.springframework.util.ObjectUtils; <del> <del>import static org.assertj.core.api.Assertions.assertThat; <del> <del>/** <del> * Unit test which verifies expected <em>init</em> and <em>destroy</em> <del> * bean lifecycle behavior as requested in <del> * <a href="https://opensource.atlassian.com/projects/spring/browse/SPR-3775" <del> * target="_blank">SPR-3775</a>. <del> * <del> * <p>Specifically, combinations of the following are tested: <del> * <ul> <del> * <li>{@link InitializingBean} &amp; {@link DisposableBean} interfaces</li> <del> * <li>Custom {@link RootBeanDefinition#getInitMethodName() init} &amp; <del> * {@link RootBeanDefinition#getDestroyMethodName() destroy} methods</li> <del> * <li>JSR 250's {@link jakarta.annotation.PostConstruct @PostConstruct} &amp; <del> * {@link jakarta.annotation.PreDestroy @PreDestroy} annotations</li> <del> * </ul> <del> * <del> * @author Sam Brannen <del> * @since 2.5 <del> */ <del>public class Spr3775InitDestroyLifecycleTests { <del> <del> private static final String LIFECYCLE_TEST_BEAN = "lifecycleTestBean"; <del> <del> <del> private void assertMethodOrdering(String category, List<String> expectedMethods, List<String> actualMethods) { <del> assertThat(ObjectUtils.nullSafeEquals(expectedMethods, actualMethods)). <del> as("Verifying " + category + ": expected<" + expectedMethods + "> but got<" + actualMethods + ">.").isTrue(); <del> } <del> <del> private DefaultListableBeanFactory createBeanFactoryAndRegisterBean( <del> Class<?> beanClass, String initMethodName, String destroyMethodName) { <del> <del> DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(); <del> RootBeanDefinition beanDefinition = new RootBeanDefinition(beanClass); <del> beanDefinition.setInitMethodName(initMethodName); <del> beanDefinition.setDestroyMethodName(destroyMethodName); <del> beanFactory.addBeanPostProcessor(new CommonAnnotationBeanPostProcessor()); <del> beanFactory.registerBeanDefinition(LIFECYCLE_TEST_BEAN, beanDefinition); <del> return beanFactory; <del> } <del> <del> @Test <del> public void testInitDestroyMethods() { <del> Class<?> beanClass = InitDestroyBean.class; <del> DefaultListableBeanFactory beanFactory = createBeanFactoryAndRegisterBean(beanClass, <del> "afterPropertiesSet", "destroy"); <del> InitDestroyBean bean = (InitDestroyBean) beanFactory.getBean(LIFECYCLE_TEST_BEAN); <del> assertMethodOrdering("init-methods", Arrays.asList("afterPropertiesSet"), bean.initMethods); <del> beanFactory.destroySingletons(); <del> assertMethodOrdering("destroy-methods", Arrays.asList("destroy"), bean.destroyMethods); <del> } <del> <del> @Test <del> public void testInitializingDisposableInterfaces() { <del> Class<?> beanClass = CustomInitializingDisposableBean.class; <del> DefaultListableBeanFactory beanFactory = createBeanFactoryAndRegisterBean(beanClass, "customInit", <del> "customDestroy"); <del> CustomInitializingDisposableBean bean = (CustomInitializingDisposableBean) beanFactory.getBean(LIFECYCLE_TEST_BEAN); <del> assertMethodOrdering("init-methods", Arrays.asList("afterPropertiesSet", "customInit"), <del> bean.initMethods); <del> beanFactory.destroySingletons(); <del> assertMethodOrdering("destroy-methods", Arrays.asList("destroy", "customDestroy"), <del> bean.destroyMethods); <del> } <del> <del> @Test <del> public void testInitializingDisposableInterfacesWithShadowedMethods() { <del> Class<?> beanClass = InitializingDisposableWithShadowedMethodsBean.class; <del> DefaultListableBeanFactory beanFactory = createBeanFactoryAndRegisterBean(beanClass, <del> "afterPropertiesSet", "destroy"); <del> InitializingDisposableWithShadowedMethodsBean bean = <del> (InitializingDisposableWithShadowedMethodsBean) beanFactory.getBean(LIFECYCLE_TEST_BEAN); <del> assertMethodOrdering("init-methods", Arrays.asList("InitializingBean.afterPropertiesSet"), <del> bean.initMethods); <del> beanFactory.destroySingletons(); <del> assertMethodOrdering("destroy-methods", Arrays.asList("DisposableBean.destroy"), bean.destroyMethods); <del> } <del> <del> @Test <del> public void testJsr250Annotations() { <del> Class<?> beanClass = CustomAnnotatedInitDestroyBean.class; <del> DefaultListableBeanFactory beanFactory = createBeanFactoryAndRegisterBean(beanClass, "customInit", <del> "customDestroy"); <del> CustomAnnotatedInitDestroyBean bean = (CustomAnnotatedInitDestroyBean) beanFactory.getBean(LIFECYCLE_TEST_BEAN); <del> assertMethodOrdering("init-methods", Arrays.asList("postConstruct", "afterPropertiesSet", <del> "customInit"), bean.initMethods); <del> beanFactory.destroySingletons(); <del> assertMethodOrdering("destroy-methods", Arrays.asList("preDestroy", "destroy", "customDestroy"), <del> bean.destroyMethods); <del> } <del> <del> @Test <del> public void testJsr250AnnotationsWithShadowedMethods() { <del> Class<?> beanClass = CustomAnnotatedInitDestroyWithShadowedMethodsBean.class; <del> DefaultListableBeanFactory beanFactory = createBeanFactoryAndRegisterBean(beanClass, "customInit", <del> "customDestroy"); <del> CustomAnnotatedInitDestroyWithShadowedMethodsBean bean = <del> (CustomAnnotatedInitDestroyWithShadowedMethodsBean) beanFactory.getBean(LIFECYCLE_TEST_BEAN); <del> assertMethodOrdering("init-methods", <del> Arrays.asList("@PostConstruct.afterPropertiesSet", "customInit"), bean.initMethods); <del> beanFactory.destroySingletons(); <del> assertMethodOrdering("destroy-methods", Arrays.asList("@PreDestroy.destroy", "customDestroy"), <del> bean.destroyMethods); <del> } <del> <del> @Test <del> public void testAllLifecycleMechanismsAtOnce() { <del> Class<?> beanClass = AllInOneBean.class; <del> DefaultListableBeanFactory beanFactory = createBeanFactoryAndRegisterBean(beanClass, <del> "afterPropertiesSet", "destroy"); <del> AllInOneBean bean = (AllInOneBean) beanFactory.getBean(LIFECYCLE_TEST_BEAN); <del> assertMethodOrdering("init-methods", Arrays.asList("afterPropertiesSet"), bean.initMethods); <del> beanFactory.destroySingletons(); <del> assertMethodOrdering("destroy-methods", Arrays.asList("destroy"), bean.destroyMethods); <del> } <del> <del> <del> public static class InitDestroyBean { <del> <del> final List<String> initMethods = new ArrayList<>(); <del> final List<String> destroyMethods = new ArrayList<>(); <del> <del> public void afterPropertiesSet() throws Exception { <del> this.initMethods.add("afterPropertiesSet"); <del> } <del> <del> public void destroy() throws Exception { <del> this.destroyMethods.add("destroy"); <del> } <del> } <del> <del> <del> public static class InitializingDisposableWithShadowedMethodsBean extends InitDestroyBean <del> implements InitializingBean, DisposableBean { <del> <del> @Override <del> public void afterPropertiesSet() throws Exception { <del> this.initMethods.add("InitializingBean.afterPropertiesSet"); <del> } <del> <del> @Override <del> public void destroy() throws Exception { <del> this.destroyMethods.add("DisposableBean.destroy"); <del> } <del> } <del> <del> <del> public static class CustomInitDestroyBean { <del> <del> final List<String> initMethods = new ArrayList<>(); <del> final List<String> destroyMethods = new ArrayList<>(); <del> <del> public void customInit() throws Exception { <del> this.initMethods.add("customInit"); <del> } <del> <del> public void customDestroy() throws Exception { <del> this.destroyMethods.add("customDestroy"); <del> } <del> } <del> <del> <del> public static class CustomInitializingDisposableBean extends CustomInitDestroyBean <del> implements InitializingBean, DisposableBean { <del> <del> @Override <del> public void afterPropertiesSet() throws Exception { <del> this.initMethods.add("afterPropertiesSet"); <del> } <del> <del> @Override <del> public void destroy() throws Exception { <del> this.destroyMethods.add("destroy"); <del> } <del> } <del> <del> <del> public static class CustomAnnotatedInitDestroyBean extends CustomInitializingDisposableBean { <del> <del> @PostConstruct <del> public void postConstruct() throws Exception { <del> this.initMethods.add("postConstruct"); <del> } <del> <del> @PreDestroy <del> public void preDestroy() throws Exception { <del> this.destroyMethods.add("preDestroy"); <del> } <del> } <del> <del> <del> public static class CustomAnnotatedInitDestroyWithShadowedMethodsBean extends CustomInitializingDisposableBean { <del> <del> @PostConstruct <del> @Override <del> public void afterPropertiesSet() throws Exception { <del> this.initMethods.add("@PostConstruct.afterPropertiesSet"); <del> } <del> <del> @PreDestroy <del> @Override <del> public void destroy() throws Exception { <del> this.destroyMethods.add("@PreDestroy.destroy"); <del> } <del> } <del> <del> <del> public static class AllInOneBean implements InitializingBean, DisposableBean { <del> <del> final List<String> initMethods = new ArrayList<>(); <del> final List<String> destroyMethods = new ArrayList<>(); <del> <del> @PostConstruct <del> @Override <del> public void afterPropertiesSet() throws Exception { <del> this.initMethods.add("afterPropertiesSet"); <del> } <del> <del> @PreDestroy <del> @Override <del> public void destroy() throws Exception { <del> this.destroyMethods.add("destroy"); <del> } <del> } <del> <del>}
3
Python
Python
fix broken uplo of eigh in python3
e549e69020e3dcec08185695db6f7001a62dc934
<ide><path>numpy/linalg/linalg.py <ide> def eigvalsh(a, UPLO='L'): <ide> A complex- or real-valued matrix whose eigenvalues are to be <ide> computed. <ide> UPLO : {'L', 'U'}, optional <del> Same as `lower`, wth 'L' for lower and 'U' for upper triangular. <add> Same as `lower`, with 'L' for lower and 'U' for upper triangular. <ide> Deprecated. <ide> <ide> Returns <ide> def eigvalsh(a, UPLO='L'): <ide> array([ 0.17157288+0.j, 5.82842712+0.j]) <ide> <ide> """ <add> UPLO = asbytes(UPLO) <ide> <ide> extobj = get_linalg_error_extobj( <ide> _raise_linalgerror_eigenvalues_nonconvergence) <del> if UPLO == 'L': <add> if UPLO == _L: <ide> gufunc = _umath_linalg.eigvalsh_lo <ide> else: <ide> gufunc = _umath_linalg.eigvalsh_up <ide> def eigh(a, UPLO='L'): <ide> <ide> extobj = get_linalg_error_extobj( <ide> _raise_linalgerror_eigenvalues_nonconvergence) <del> if 'L' == UPLO: <add> if _L == UPLO: <ide> gufunc = _umath_linalg.eigh_lo <ide> else: <ide> gufunc = _umath_linalg.eigh_up <ide><path>numpy/linalg/tests/test_linalg.py <ide> def do(self, a, b): <ide> <ide> assert_allclose(dot_generalized(a, evc2), <ide> np.asarray(ev2)[...,None,:] * np.asarray(evc2), <del> rtol=get_rtol(ev.dtype)) <add> rtol=get_rtol(ev.dtype), err_msg=repr(a)) <ide> <ide> def test_types(self): <ide> def check(dtype): <ide> def check(dtype): <ide> for dtype in [single, double, csingle, cdouble]: <ide> yield check, dtype <ide> <add> def test_half_filled(self): <add> expect = np.array([-0.33333333, -0.33333333, -0.33333333, 0.99999999]) <add> K = np.array([[ 0. , 0. , 0. , 0. ], <add> [-0.33333333, 0. , 0. , 0. ], <add> [ 0.33333333, -0.33333333, 0. , 0. ], <add> [ 0.33333333, -0.33333333, 0.33333333, 0. ]]) <add> Kr = np.rot90(K, k=2) <add> w, V = np.linalg.eigh(K) <add> assert_allclose(np.sort(w), expect, rtol=get_rtol(K.dtype)) <add> w, V = np.linalg.eigh(UPLO='L', a=K) <add> assert_allclose(np.sort(w), expect, rtol=get_rtol(K.dtype)) <add> w, V = np.linalg.eigh(Kr, 'U') <add> assert_allclose(np.sort(w), expect, rtol=get_rtol(K.dtype)) <add> <add> w = np.linalg.eigvalsh(K) <add> assert_allclose(np.sort(w), expect, rtol=get_rtol(K.dtype)) <add> w = np.linalg.eigvalsh(UPLO='L', a=K) <add> assert_allclose(np.sort(w), expect, rtol=get_rtol(K.dtype)) <add> w = np.linalg.eigvalsh(Kr, 'U') <add> assert_allclose(np.sort(w), expect, rtol=get_rtol(K.dtype)) <add> <ide> <ide> class _TestNorm(object): <ide>
2
Python
Python
update comments to reflect new functionality
5f64971731cfb0b8fbac5783e6ac4615aae2c16d
<ide><path>scripts/flaskext_migrate.py <ide> # <ide> # "import flask.ext.foo" <ide> # <del># these are converted to "import flask_foo" in the <del># main import statement, but does not handle function calls in the source. <ide> # <ide> # Run in the terminal by typing: `python flaskext_migrate.py <source_file.py>` <ide> #
1
Text
Text
fix incorrect markdown by removing extra space
1a6b0828085eac4a9e9ee1d003a927e7476c5af3
<ide><path>activerecord/CHANGELOG.md <ide> * Fix AR#dup to nullify the validation errors in the dup'ed object. Previously the original <ide> and the dup'ed object shared the same errors. <ide> <del> * Christian Seiler* <add> *Christian Seiler* <ide> <ide> * Raise `ArgumentError` if list of attributes to change is empty in `update_all`. <ide>
1
PHP
PHP
rename some methods
3615fa377dfab765b17e200566869a95502b2697
<ide><path>src/Illuminate/Database/Eloquent/Builder.php <ide> public function has($relation, $operator = '>=', $count = 1, $boolean = 'and', C <ide> * @param \Closure $callback <ide> * @return \Illuminate\Database\Eloquent\Builder|static <ide> */ <del> public function hasNot($relation, $boolean = 'and', Closure $callback = null) <add> public function doesntHave($relation, $boolean = 'and', Closure $callback = null) <ide> { <ide> return $this->has($relation, '<', 1, $boolean, $callback); <ide> } <ide> public function whereHas($relation, Closure $callback, $operator = '>=', $count <ide> * @param \Closure $callback <ide> * @return \Illuminate\Database\Eloquent\Builder|static <ide> */ <del> public function whereHasNot($relation, Closure $callback) <add> public function whereDoesntHave($relation, Closure $callback) <ide> { <ide> return $this->hasNot($relation, 'and', $callback); <ide> }
1
Text
Text
fix outdated head hash syntax
681f5a5914b3d0c4fb05ae63628e8d372959e18c
<ide><path>docs/Formula-Cookbook.md <ide> To use a specific commit, tag, or branch from a repository, specify [`head`](htt <ide> <ide> ```ruby <ide> class Foo < Formula <del> head "https://github.com/some/package.git", :revision => "090930930295adslfknsdfsdaffnasd13" <del> # or :branch => "develop" (the default is "master") <del> # or :tag => "1_0_release", <del> # :revision => "090930930295adslfknsdfsdaffnasd13" <add> head "https://github.com/some/package.git", revision: "090930930295adslfknsdfsdaffnasd13" <add> # or branch: "main" (the default is "master") <add> # or tag: "1_0_release", revision: "090930930295adslfknsdfsdaffnasd13" <ide> end <ide> ``` <ide>
1
Python
Python
add test for multilevel
eef5dd14611a08691a961360d6fd7adcfb38cd78
<ide><path>research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py <ide> <ide> from google.protobuf import text_format <ide> from object_detection.anchor_generators import grid_anchor_generator <add>from object_detection.anchor_generators import multiscale_grid_anchor_generator <ide> from object_detection.builders import box_predictor_builder <ide> from object_detection.builders import hyperparams_builder <ide> from object_detection.builders import post_processing_builder <ide> def image_resizer_fn(image, masks=None): <ide> <ide> # anchors in this test are designed so that a subset of anchors are inside <ide> # the image and a subset of anchors are outside. <del> first_stage_anchor_scales = (0.001, 0.005, 0.1) <del> first_stage_anchor_aspect_ratios = (0.5, 1.0, 2.0) <del> first_stage_anchor_strides = (1, 1) <del> first_stage_anchor_generator = grid_anchor_generator.GridAnchorGenerator( <del> first_stage_anchor_scales, <del> first_stage_anchor_aspect_ratios, <del> anchor_stride=first_stage_anchor_strides) <add> first_stage_anchor_generator = None <add> if multi_level: <add> min_level = 0 <add> max_level = 1 <add> anchor_scale = 0.1 <add> aspect_ratios = [1.0, 2.0, 0.5] <add> scales_per_octave = 2 <add> normalize_coordinates = False <add> first_stage_anchor_generator = multiscale_grid_anchor_generator.MultiscaleGridAnchorGenerator( <add> min_level, max_level, anchor_scale, aspect_ratios, scales_per_octave, <add> normalize_coordinates) <add> else: <add> first_stage_anchor_scales = (0.001, 0.005, 0.1) <add> first_stage_anchor_aspect_ratios = (0.5, 1.0, 2.0) <add> first_stage_anchor_strides = (1, 1) <add> first_stage_anchor_generator = grid_anchor_generator.GridAnchorGenerator( <add> first_stage_anchor_scales, <add> first_stage_anchor_aspect_ratios, <add> anchor_stride=first_stage_anchor_strides) <ide> first_stage_target_assigner = target_assigner.create_target_assigner( <ide> 'FasterRCNN', <ide> 'proposal', <ide> def graph_fn(images): <ide> def test_predict_shape_in_inference_mode_first_stage_only_multi_level( <ide> self, use_static_shapes=False): <ide> batch_size = 2 <del> height = 10 <del> width = 12 <add> height = 50 <add> width = 52 <ide> input_image_shape = (batch_size, height, width, 3) <ide> <ide> with test_utils.GraphContextOrNone() as g: <ide> def graph_fn(images): <ide> # pruned. Since MockFasterRCNN.extract_proposal_features returns a <ide> # tensor with the same shape as its input, the expected number of anchors <ide> # is height * width * the number of anchors per location (i.e. 3x3). <del> expected_num_anchors = height * width * 3 * 3 <add> expected_num_anchors = ((height-2) * (width-2) + (height-4) * (width-4)) * 6 <ide> expected_output_shapes = { <ide> 'rpn_box_predictor_features_0': (batch_size, height-2, width-2, 512), <ide> 'rpn_box_predictor_features_1': (batch_size, height-4, width-4, 512), <ide> def graph_fn(images): <ide> 'rpn_box_encodings': (batch_size, expected_num_anchors, 4), <ide> 'rpn_objectness_predictions_with_background': <ide> (batch_size, expected_num_anchors, 2), <del> 'anchors': (expected_num_anchors, 4) <add> 'anchors': (18300, 4) <ide> } <del> print(expected_output_shapes) <ide> <ide> if use_static_shapes: <ide> results = self.execute(graph_fn, [images], graph=g) <ide> else: <ide> results = self.execute_cpu(graph_fn, [images], graph=g) <del> print(results) <del> self.assertAllEqual(0, 1) <ide> <ide> self.assertAllEqual(results[0].shape, <ide> expected_output_shapes['rpn_box_predictor_features_0'])
1
Python
Python
allow tokenization of sequences > 512 for caching
9775b2eb277c246f27dda08c6b1df29abee3da5b
<ide><path>pytorch_pretrained_bert/tokenization_openai.py <ide> def convert_tokens_to_ids(self, tokens): <ide> else: <ide> ids.append(self.encoder.get(token, 0)) <ide> if len(ids) > self.max_len: <del> raise ValueError( <add> logger.warning( <ide> "Token indices sequence length is longer than the specified maximum " <ide> " sequence length for this OpenAI GPT model ({} > {}). Running this" <ide> " sequence through the model will result in indexing errors".format(len(ids), self.max_len)
1
PHP
PHP
fix typo in docblock
4224d0d878a5dee7a7ecae2c1728a6e79c8cfce8
<ide><path>src/Illuminate/Routing/RouteCollection.php <ide> public function match(Request $request) <ide> * Determine if a route in the array matches the request. <ide> * <ide> * @param array $routes <del> * @param \Illuminate\http\Request $request <add> * @param \Illuminate\Http\Request $request <ide> * @param bool $includingMethod <ide> * @return \Illuminate\Routing\Route|null <ide> */
1
Ruby
Ruby
add uniq to check multiple tap
a43633e0948dbbb1fceeebcad965c7ccbdc498cb
<ide><path>Library/Homebrew/cask/cask_loader.rb <ide> def self.for(ref) <ide> when 2..Float::INFINITY <ide> loaders = possible_tap_casks.map(&FromTapPathLoader.method(:new)) <ide> <del> raise TapCaskAmbiguityError.new(ref, loaders) if loaders.map(&:tap).map(&:name).size == 1 <add> raise TapCaskAmbiguityError.new(ref, loaders) if loaders.map(&:tap).map(&:name).uniq.size == 1 <ide> <ide> return FromTapPathLoader.new(possible_tap_casks.first) <ide> end
1
Text
Text
add v3.9.0-beta.4 to changelog
9b907dbf0a22be04943656dc43836f8bc495fdec
<ide><path>CHANGELOG.md <ide> # Ember Changelog <ide> <add>### v3.9.0-beta.4 (March 11, 2019) <add> <add>- [#17710](https://github.com/emberjs/ember.js/pull/17710) [BUGFIX] Allow accessors in mixins <add> <ide> ### v3.9.0-beta.3 (March 4, 2019) <ide> <ide> - [#17684](https://github.com/emberjs/ember.js/pull/17684) [BUGFIX] Enable maximum rerendering limit to be customized.
1
PHP
PHP
update serialization logic
c5dc9c870a8a1af6c7e827dd81bd15f0a1561cc4
<ide><path>src/Illuminate/Cookie/Middleware/EncryptCookies.php <ide> class EncryptCookies <ide> * <ide> * @var bool <ide> */ <del> protected $serialize = false; <add> protected static $serialize = false; <ide> <ide> /** <ide> * Create a new CookieGuard instance. <ide> protected function decryptCookie($name, $cookie) <ide> { <ide> return is_array($cookie) <ide> ? $this->decryptArray($cookie) <del> : $this->encrypter->decrypt($cookie, $this->serialize); <add> : $this->encrypter->decrypt($cookie, static::serialized($name)); <ide> } <ide> <ide> /** <ide> protected function decryptArray(array $cookie) <ide> <ide> foreach ($cookie as $key => $value) { <ide> if (is_string($value)) { <del> $decrypted[$key] = $this->encrypter->decrypt($value, $this->serialize); <add> $decrypted[$key] = $this->encrypter->decrypt($value, static::serialized($key)); <ide> } <ide> } <ide> <ide> protected function encrypt(Response $response) <ide> } <ide> <ide> $response->headers->setCookie($this->duplicate( <del> $cookie, $this->encrypter->encrypt($cookie->getValue(), $this->serialize) <add> $cookie, $this->encrypter->encrypt($cookie->getValue(), static::serialized($cookie->getName())) <ide> )); <ide> } <ide> <ide> public function isDisabled($name) <ide> { <ide> return in_array($name, $this->except); <ide> } <add> <add> /** <add> * Determine if the cookie contents should be serialized. <add> * <add> * @param string $name <add> * @return bool <add> */ <add> public static function serialized($name) <add> { <add> return static::$serialize; <add> } <ide> } <ide><path>src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php <ide> use Symfony\Component\HttpFoundation\Cookie; <ide> use Illuminate\Contracts\Encryption\Encrypter; <ide> use Illuminate\Session\TokenMismatchException; <add>use Illuminate\Cookie\Middleware\EncryptCookies; <ide> <ide> class VerifyCsrfToken <ide> { <ide> protected function getTokenFromRequest($request) <ide> $token = $request->input('_token') ?: $request->header('X-CSRF-TOKEN'); <ide> <ide> if (! $token && $header = $request->header('X-XSRF-TOKEN')) { <del> $token = $this->encrypter->decrypt($header, false); <add> $token = $this->encrypter->decrypt($header, static::serialized()); <ide> } <ide> <ide> return $token; <ide> protected function addCookieToResponse($request, $response) <ide> <ide> return $response; <ide> } <add> <add> /** <add> * Determine if the cookie contents should be serialized. <add> * <add> * @return bool <add> */ <add> public static function serialized() <add> { <add> return EncryptCookies::serialized('XSRF-TOKEN'); <add> } <ide> }
2
Javascript
Javascript
use an array not an object to cache objects
5c06cd1de5547036a9733c63622ef01d7345ada8
<ide><path>pdf.js <ide> var XRef = (function() { <ide> error("Invalid root reference"); <ide> <ide> // prepare the XRef cache <del> this.cache = Object.create(null); <add> this.cache = []; <ide> } <ide> <ide> constructor.prototype = {
1
Javascript
Javascript
add test for addition of trailing newline
c5cba6e9c15aa2d6cd065b4fba7166cc58d37c84
<ide><path>changelog.js <ide> var generate = function(version, file) { <ide> <ide> // publish for testing <ide> exports.parseRawCommit = parseRawCommit; <add>exports.printSection = printSection; <ide> <ide> // hacky start if not run by jasmine :-D <ide> if (process.argv.join('').indexOf('jasmine-node') === -1) { <ide><path>changelog.spec.js <del>/* global describe: false, it: false, expect: false */ <add>/* global describe: false, beforeEach: false, afterEach: false, it: false, expect: false */ <ide> <ide> 'use strict'; <ide> <ide> describe('changelog.js', function() { <ide> expect(msg.breaking).toEqual(' first breaking change\nsomething else\nanother line with more info\n'); <ide> }); <ide> }); <add> <add> describe('printSection', function() { <add> var output; <add> var streamMock = { <add> write: function(str) { <add> output += str; <add> } <add> }; <add> <add> beforeEach(function() { <add> output = ''; <add> }); <add> <add> it('should add a new line at the end of each breaking change list item ' + <add> 'when there is 1 item per component', function() { <add> var title = 'test'; <add> var printCommitLinks = false; <add> <add> var section = { <add> module1: [{subject: 'breaking change 1'}], <add> module2: [{subject: 'breaking change 2'}] <add> }; <add> var expectedOutput = <add> '\n' + '## test\n\n' + <add> '- **module1:** breaking change 1\n' + <add> '- **module2:** breaking change 2\n' + <add> '\n'; <add> <add> ch.printSection(streamMock, title, section, printCommitLinks); <add> expect(output).toBe(expectedOutput); <add> }); <add> <add> it('should add a new line at the end of each breaking change list item ' + <add> 'when there are multiple items per component', function() { <add> var title = 'test'; <add> var printCommitLinks = false; <add> <add> var section = { <add> module1: [ <add> {subject: 'breaking change 1.1'}, <add> {subject: 'breaking change 1.2'} <add> ], <add> module2: [ <add> {subject: 'breaking change 2.1'}, <add> {subject: 'breaking change 2.2'} <add> ] <add> }; <add> var expectedOutput = <add> '\n' + '## test\n\n' + <add> '- **module1:**\n' + <add> ' - breaking change 1.1\n' + <add> ' - breaking change 1.2\n' + <add> '- **module2:**\n' + <add> ' - breaking change 2.1\n' + <add> ' - breaking change 2.2\n' + <add> '\n'; <add> <add> ch.printSection(streamMock, title, section, printCommitLinks); <add> expect(output).toBe(expectedOutput); <add> }); <add> }); <ide> });
2
Go
Go
pass info rather than hash to setinitialized
74edcaf1e84aa8bf35e496b2bead833172a79fca
<ide><path>runtime/graphdriver/devmapper/deviceset.go <ide> func (devices *DeviceSet) MountDevice(hash, path string, mountLabel string) erro <ide> info.mountPath = path <ide> info.floating = false <ide> <del> return devices.setInitialized(hash) <add> return devices.setInitialized(info) <ide> } <ide> <ide> func (devices *DeviceSet) UnmountDevice(hash string, mode UnmountMode) error { <ide> func (devices *DeviceSet) HasActivatedDevice(hash string) bool { <ide> return devinfo != nil && devinfo.Exists != 0 <ide> } <ide> <del>func (devices *DeviceSet) setInitialized(hash string) error { <del> info := devices.Devices[hash] <del> if info == nil { <del> return fmt.Errorf("Unknown device %s", hash) <del> } <del> <add>func (devices *DeviceSet) setInitialized(info *DevInfo) error { <ide> info.Initialized = true <ide> if err := devices.saveMetadata(); err != nil { <ide> info.Initialized = false
1
Ruby
Ruby
unfreeze forbidden licenses string
b06bcf3db154cfb27fc7ce240136719284e95b09
<ide><path>Library/Homebrew/formula_installer.rb <ide> def puts_requirement_messages <ide> end <ide> <ide> def forbidden_license_check <del> forbidden_licenses = Homebrew::EnvConfig.forbidden_licenses.to_s <add> forbidden_licenses = Homebrew::EnvConfig.forbidden_licenses.dup <ide> SPDX::ALLOWED_LICENSE_SYMBOLS.each do |s| <ide> pattern = /#{s.to_s.tr("_", " ")}/i <del> forbidden_licenses = forbidden_licenses.sub(pattern, s.to_s) <add> forbidden_licenses.sub!(pattern, s.to_s) <ide> end <ide> forbidden_licenses = forbidden_licenses.split(" ").to_h do |license| <ide> [license, SPDX.license_version_info(license)]
1
Text
Text
add missing links to blog article
24d789deb6f0ee74ff7058bc6f132f8187317954
<ide><path>blog/2017-08-30-react-native-monthly-3.md <ide> Here are the notes from each team: <ide> <ide> - Released support for installing npm packages on [Snack](https://snack.expo.io). Usual Expo restrictions apply -- packages can't depend on custom native APIs that aren't already included in Expo. We are also working on supporting multiple files and uploading assets in Snack. [Satyajit](https://github.com/satya164) will talk about Snack at [React Native Europe](https://react-native.eu/). <ide> - Released SDK20 with camera, payments, secure storage, magnetometer, pause/resume fs downloads, and improved splash/loading screen. <del>- Continuing to work with [Krzysztof](https://github.com/kmagiera/react-native-gesture-handler) on [react-native-gesture-handler](https://github.com/kmagiera/react-native-gesture-handler). Please give it a try, rebuild some gesture that you have previously built using PanResponder or native gesture recognizers and let us know what issues you encounter. <add>- Continuing to work with [Krzysztof](https://github.com/kmagiera) on [react-native-gesture-handler](https://github.com/kmagiera/react-native-gesture-handler). Please give it a try, rebuild some gesture that you have previously built using PanResponder or native gesture recognizers and let us know what issues you encounter. <ide> - Experimenting with JSC debugging protocol, working on a bunch of feature requests on [Canny](https://expo.canny.io/feature-requests). <ide> <ide> ### Facebook <ide> Here are the notes from each team: <ide> ### Microsoft <ide> <ide> - The new Skype app is built on top of React Native in order to facilitate sharing as much code between platforms as possible. The React Native-based Skype app is currently available in the iOS and Android app stores. <del>- While building the Skype app on React Native, we send pull requests to React Native in order to address bugs and missing features that we come across. So far, we've gotten about 70 pull requests merged. <del>- React Native enabled us to power both the iOS and Android Skype apps from the same codebase. We also want to use that codebase to power the Skype web app. To help us achieve that goal, we built and open sourced a thin layer on top of React/React Native called ReactXP. ReactXP provides a set of cross platform components that get mapped to React Native when targeting iOS/Android and to react-dom when targeting the web. ReactXP's goals are similar to another open source library called React Native for Web. There's a brief description of how the approaches of these libraries differ in the ReactXP FAQ. <add>- While building the Skype app on React Native, we send pull requests to React Native in order to address bugs and missing features that we come across. So far, we've gotten about [70 pull requests merged](https://github.com/facebook/react-native/pulls?utf8=%E2%9C%93&q=is%3Apr%20author%3Arigdern%20). <add>- React Native enabled us to power both the iOS and Android Skype apps from the same codebase. We also want to use that codebase to power the Skype web app. To help us achieve that goal, we built and open sourced a thin layer on top of React/React Native called [ReactXP](https://microsoft.github.io/reactxp/blog/2017/04/06/introducing-reactxp.html). ReactXP provides a set of cross platform components that get mapped to React Native when targeting iOS/Android and to react-dom when targeting the web. ReactXP's goals are similar to another open source library called React Native for Web. There's a brief description of how the approaches of these libraries differ in the [ReactXP FAQ](https://microsoft.github.io/reactxp/docs/faq.html). <ide> <ide> ### Shoutem <ide> <del>- We are continuing are efforts on improving and simplifying the developer experience when building apps using Shoutem. <add>- We are continuing our efforts on improving and simplifying the developer experience when building apps using [Shoutem](https://shoutem.github.io/). <ide> - Started migrating all our apps to react-navigation, but we ended postponing this until a more stable version is released, or one of the native navigation solutions becomes stable. <del>- Updating all our extensions and most of our open source libraries (animation, theme, ui) to React Native 0.47.1. <add>- Updating all our [extensions](https://github.com/shoutem/extensions) and most of our open source libraries ([animation](https://github.com/shoutem/animation), [theme](https://github.com/shoutem/theme), [ui](https://github.com/shoutem/ui)) to React Native 0.47.1. <ide> <ide> ## Next session <ide>
1
Ruby
Ruby
prefer gcc 5 on linux
221983dbcff442fa98d28c36cb2fb74af376d937
<ide><path>Library/Homebrew/compilers.rb <ide> def inspect <ide> # <ide> # @api private <ide> class CompilerSelector <add> extend T::Sig <ide> include CompilerConstants <ide> <ide> Compiler = Struct.new(:name, :version) <ide> def compiler <ide> <ide> private <ide> <add> sig { returns(String) } <add> def preferred_gcc <add> "gcc" <add> end <add> <ide> def gnu_gcc_versions <ide> # prioritize gcc version provided by gcc formula. <del> v = Formulary.factory("gcc").version.to_s.slice(/\d+/) <add> v = Formulary.factory(preferred_gcc).version.to_s.slice(/\d+/) <ide> GNU_GCC_VERSIONS - [v] + [v] # move the version to the end of the list <ide> rescue FormulaUnavailableError <ide> GNU_GCC_VERSIONS <ide> def compiler_version(name) <ide> end <ide> end <ide> end <add> <add>require "extend/os/compilers" <ide><path>Library/Homebrew/extend/os/compilers.rb <add># typed: strict <add># frozen_string_literal: true <add> <add>require "extend/os/linux/compilers" if OS.linux? <ide><path>Library/Homebrew/extend/os/linux/compilers.rb <add># typed: strict <add># frozen_string_literal: true <add> <add>class CompilerSelector <add> sig { returns(String) } <add> def preferred_gcc <add> # gcc-5 is the lowest gcc version we support on Linux. <add> # gcc-5 is the default gcc in Ubuntu 16.04 (used for our CI) <add> "gcc@5" <add> end <add>end <ide><path>Library/Homebrew/test/compiler_selector_spec.rb <ide> case name <ide> when "gcc-7" then Version.create("7.1") <ide> when "gcc-6" then Version.create("6.1") <add> when "gcc-5" then Version.create("5.1") <ide> else Version::NULL <ide> end <ide> end <ide> expect(selector.compiler).to eq("gcc-7") <ide> end <ide> <del> it "returns gcc-6 if gcc formula offers gcc-6" do <add> it "returns gcc-6 if gcc formula offers gcc-6 on mac", :needs_macos do <ide> software_spec.fails_with(:clang) <ide> allow(Formulary).to receive(:factory).with("gcc").and_return(double(version: "6.0")) <ide> expect(selector.compiler).to eq("gcc-6") <ide> end <ide> <add> it "returns gcc-5 if gcc formula offers gcc-5 on linux", :needs_linux do <add> software_spec.fails_with(:clang) <add> allow(Formulary).to receive(:factory).with("gcc@5").and_return(double(version: "5.0")) <add> expect(selector.compiler).to eq("gcc-5") <add> end <add> <add> it "returns gcc-6 if gcc formula offers gcc-6 and fails with gcc-5 and gcc-7 on linux", :needs_linux do <add> software_spec.fails_with(:clang) <add> software_spec.fails_with(gcc: "5") <add> software_spec.fails_with(gcc: "7") <add> allow(Formulary).to receive(:factory).with("gcc@5").and_return(double(version: "5.0")) <add> expect(selector.compiler).to eq("gcc-6") <add> end <add> <ide> it "raises an error when gcc or llvm is missing" do <ide> software_spec.fails_with(:clang) <ide> software_spec.fails_with(gcc: "7") <ide> software_spec.fails_with(gcc: "6") <add> software_spec.fails_with(gcc: "5") <ide> <ide> expect { selector.compiler }.to raise_error(CompilerSelectionError) <ide> end
4
PHP
PHP
avoid code duplication
ab31e72dd271766fe6aaceab09816e334479a8f8
<ide><path>src/I18n/Translator.php <ide> * <ide> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> * @link https://cakephp.org CakePHP(tm) Project <del> * <del> * This file contains sections from the Aura Project <del> * @license https://github.com/auraphp/Aura.Intl/blob/3.x/LICENSE <del> * <del> * The Aura Project for PHP. <del> * <del> * @package Aura.Intl <del> * @license https://opensource.org/licenses/bsd-license.php BSD <ide> */ <ide> namespace Cake\I18n; <ide> <ide> use Aura\Intl\FormatterInterface; <ide> use Aura\Intl\Package; <del>use Aura\Intl\TranslatorInterface; <add>use Aura\Intl\Translator as BaseTranslator; <ide> <ide> /** <ide> * Provides missing message behavior for CakePHP internal message formats. <ide> * <ide> * @internal <ide> */ <del>class Translator implements TranslatorInterface <add>class Translator extends BaseTranslator <ide> { <del> /** <del> * A fallback translator. <del> * <del> * @var \Aura\Intl\TranslatorInterface <del> */ <del> protected $fallback; <del> <del> /** <del> * The formatter to use when translating messages. <del> * <del> * @var \Aura\Intl\FormatterInterface <del> */ <del> protected $formatter; <del> <del> /** <del> * The locale being used for translations. <del> * <del> * @var string <del> */ <del> protected $locale; <del> <del> /** <del> * The Package containing keys and translations. <del> * <del> * @var \Aura\Intl\Package <del> */ <del> protected $package; <del> <del> /** <del> * Constructor <del> * <del> * @param string $locale The locale being used. <del> * @param \Aura\Intl\Package $package The Package containing keys and translations. <del> * @param \Aura\Intl\FormatterInterface $formatter A message formatter. <del> * @param \Aura\Intl\TranslatorInterface|null $fallback A fallback translator. <del> */ <del> public function __construct( <del> $locale, <del> Package $package, <del> FormatterInterface $formatter, <del> TranslatorInterface $fallback = null <del> ) { <del> $this->locale = $locale; <del> $this->package = $package; <del> $this->formatter = $formatter; <del> $this->fallback = $fallback; <del> } <del> <del> /** <del> * Gets the message translation by its key. <del> * <del> * @param string $key The message key. <del> * @return string|bool The message translation string, or false if not found. <del> */ <del> protected function getMessage($key) <del> { <del> $message = $this->package->getMessage($key); <del> if ($message) { <del> return $message; <del> } <del> <del> if ($this->fallback) { <del> // get the message from the fallback translator <del> $message = $this->fallback->getMessage($key); <del> if ($message) { <del> // speed optimization: retain locally <del> $this->package->addMessage($key, $message); <del> // done! <del> return $message; <del> } <del> } <del> <del> // no local message, no fallback <del> return false; <del> } <ide> <ide> /** <ide> * Translates the message formatting any placeholders <ide> protected function resolveContext($key, $message, array $vars) <ide> <ide> return $message['_context'][$context]; <ide> } <del> <del> /** <del> * An object of type Package <del> * <del> * @return \Aura\Intl\Package <del> */ <del> public function getPackage() <del> { <del> return $this->package; <del> } <ide> }
1
Javascript
Javascript
fix reverse behavior for range and repeat
7dcd1ab80b85a59144acbc6f013265077d594d9e
<ide><path>dist/Immutable.js <ide> var $Range = Range; <ide> } <ide> value += reverse ? -step : step; <ide> } <del> return flipIndices ? this.length : ii; <add> return ii; <ide> }, <ide> __deepEquals: function(other) { <ide> return this._start === other._start && this._end === other._end && this._step === other._step; <ide> var $Repeat = Repeat; <ide> first: function() { <ide> return this._value; <ide> }, <add> last: function() { <add> return this._value; <add> }, <ide> contains: function(searchValue) { <ide> return is(this._value, searchValue); <ide> }, <ide> var $Repeat = Repeat; <ide> return -1; <ide> }, <ide> __iterate: function(fn, reverse, flipIndices) { <del> var reversedIndices = reverse ^ flipIndices; <del> invariant(!reversedIndices || this.length < Infinity, 'Cannot access end of infinite range.'); <add> invariant(!flipIndices || this.length < Infinity, 'Cannot access end of infinite range.'); <ide> var maxIndex = this.length - 1; <ide> for (var ii = 0; ii <= maxIndex; ii++) { <del> if (fn(this._value, reversedIndices ? maxIndex - ii : ii, this) === false) { <add> if (fn(this._value, flipIndices ? maxIndex - ii : ii, this) === false) { <ide> break; <ide> } <ide> } <del> return reversedIndices ? this.length : ii; <add> return ii; <ide> }, <ide> __deepEquals: function(other) { <ide> return is(this._value, other._value); <ide><path>dist/Immutable.min.js <ide> return r&&r[0]===n&&z(r[1],t)})},__ensureOwner:function(t){return t===this.__own <ide> }this._stack=t=ie(r&&r.array,t.level-Ie,t.offset+(n<<t.level),t.max,t)}else t=this._stack=this._stack.__prev}return o()}},{},Qe);var yn,wn=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return Sn.from(t)},Sn=wn;Se.createClass(wn,{toString:function(){return this.__toString("Set {","}")},has:function(t){return this._map.has(t)},get:function(t,e){return this.has(t)?t:e},add:function(t){var e=this._map.set(t,null);return this.__ownerID?(this.length=e.length,this._map=e,this):e===this._map?this:le(e)},remove:function(t){var e=this._map.remove(t);return this.__ownerID?(this.length=e.length,this._map=e,this):e===this._map?this:0===e.length?Sn.empty():le(e)},clear:function(){return 0===this.length?this:this.__ownerID?(this.length=0,this._map.clear(),this):Sn.empty()},union:function(){var t=arguments;return 0===t.length?this:this.withMutations(function(e){for(var n=0;t.length>n;n++)ze(t[n]).forEach(function(t){return e.add(t)})})},intersect:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];if(0===t.length)return this;t=t.map(function(t){return ze(t)});var n=this;return this.withMutations(function(e){n.forEach(function(n){t.every(function(t){return t.contains(n)})||e.remove(n)})})},subtract:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];if(0===t.length)return this;t=t.map(function(t){return ze(t)});var n=this;return this.withMutations(function(e){n.forEach(function(n){t.some(function(t){return t.contains(n)})&&e.remove(n)})})},isSubset:function(t){return t=ze(t),this.every(function(e){return t.contains(e)})},isSuperset:function(t){var e=this;return t=ze(t),t.every(function(t){return e.contains(t)})},wasAltered:function(){return this._map.wasAltered()},values:function(){return this._map.keys()},entries:function(){return U(this.values(),function(t){return[t,t]})},hashCode:function(){return this._map.hashCode()},__iterate:function(t,e){var n=this;return this._map.__iterate(function(e,r){return t(r,r,n)},e)},__deepEquals:function(t){return this.isSuperset(t)},__ensureOwner:function(t){if(t===this.__ownerID)return this; <ide> var e=this._map.__ensureOwner(t);return t?le(e,t):(this.__ownerID=t,this._map=e,this)}},{empty:function(){return kn||(kn=le(Ye.empty()))},from:function(t){var e=Sn.empty();return t?t.constructor===Sn?t:e.union(t):e},fromKeys:function(t){return Sn.from(ze(t).flip())}},ze);var In=wn.prototype;In[Ae]=In.remove,In[xe]=In.keys=In.values,In.contains=In.has,In.mergeDeep=In.merge=In.union,In.mergeDeepWith=In.mergeWith=function(){for(var t=[],e=1;arguments.length>e;e++)t[e-1]=arguments[e];return this.merge.apply(this,t)},In.withMutations=$e.withMutations,In.asMutable=$e.asMutable,In.asImmutable=$e.asImmutable,In.__toJS=Ne.__toJS,In.__toStringMapper=Ne.__toStringMapper;var kn,bn=function(t){var e=Mn.empty();return t?t.constructor===Mn?t:e.merge(t):e},Mn=bn;Se.createClass(bn,{toString:function(){return this.__toString("OrderedMap {","}")},get:function(t,e){var n=this._map.get(t);return null!=n?this._vector.get(n)[1]:e},clear:function(){return 0===this.length?this:this.__ownerID?(this.length=0,this._map.clear(),this._vector.clear(),this):Mn.empty()},set:function(t,e){return ge(this,t,e)},remove:function(t){return ge(this,t,Me)},wasAltered:function(){return this._map.wasAltered()||this._vector.wasAltered()},keys:function(){return U(this.entries(),function(t){return t[0]})},values:function(){return U(this.entries(),function(t){return t[1]})},entries:function(){return this._vector.values(!0)},__iterate:function(t,e){return this._vector.fromEntrySeq().__iterate(t,e)},__deepEquals:function(t){var e=this.entries();return t.every(function(t,n){var r=e.next().value;return r&&z(r[0],n)&&z(r[1],t)})},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t),n=this._vector.__ensureOwner(t);return t?ve(e,n,t,this.__hash):(this.__ownerID=t,this._map=e,this._vector=n,this)}},{empty:function(){return qn||(qn=ve(Ye.empty(),ln.empty()))}},Ye),bn.from=bn,bn.prototype[Ae]=bn.prototype.remove;var qn,Dn=function(t,e){var n=function(t){return this instanceof n?void(this._map=Ye(t)):new n(t)};t=ze(t);var r=n.prototype=Object.create(An); <ide> r.constructor=n,r._name=e,r._defaultValues=t;var i=Object.keys(t);return n.prototype.length=i.length,Object.defineProperty&&t.forEach(function(t,e){Object.defineProperty(n.prototype,e,{get:function(){return this.get(e)},set:function(t){h(this.__ownerID,"Cannot set on an immutable record."),this.set(e,t)}})}),n},On=Dn;Se.createClass(Dn,{toString:function(){return this.__toString((this._name||"Record")+" {","}")},has:function(t){return this._defaultValues.has(t)},get:function(t,e){return void 0===e||this.has(t)?this._map.get(t,this._defaultValues.get(t)):e},clear:function(){if(this.__ownerID)return this._map.clear(),this;Object.getPrototypeOf(this).constructor;return On._empty||(On._empty=pe(this,Ye.empty()))},set:function(t,e){if(null==t||!this.has(t))return this;var n=this._map.set(t,e);return this.__ownerID||n===this._map?this:pe(this,n)},remove:function(t){if(null==t||!this.has(t))return this;var e=this._map.remove(t);return this.__ownerID||e===this._map?this:pe(this,e)},keys:function(){return this._map.keys()},values:function(){return this._map.values()},entries:function(){return this._map.entries()},wasAltered:function(){return this._map.wasAltered()},__iterate:function(t,e){var n=this;return this._defaultValues.map(function(t,e){return n.get(e)}).__iterate(t,e)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t);return t?pe(this,e,t):(this.__ownerID=t,this._map=e,this)}},{},ze);var An=Dn.prototype;An[Ae]=An.remove,An[xe]=$e[xe],An.merge=$e.merge,An.mergeWith=$e.mergeWith,An.mergeDeep=$e.mergeDeep,An.mergeDeepWith=$e.mergeDeepWith,An.update=$e.update,An.updateIn=$e.updateIn,An.cursor=$e.cursor,An.withMutations=$e.withMutations,An.asMutable=$e.asMutable,An.asImmutable=$e.asImmutable,An.__deepEquals=$e.__deepEquals;var xn=function(t,e,n){return this instanceof Cn?(h(0!==n,"Cannot step a Range by 0"),t=t||0,null==e&&(e=1/0),t===e&&jn?jn:(n=null==n?1:Math.abs(n),t>e&&(n=-n),this._start=t,this._end=e,this._step=n,void(this.length=Math.max(0,Math.ceil((e-t)/n-1)+1)))):new Cn(t,e,n) <del>},Cn=xn;Se.createClass(xn,{toString:function(){return 0===this.length?"Range []":"Range [ "+this._start+"..."+this._end+(this._step>1?" by "+this._step:"")+" ]"},has:function(t){return t=j(this,t),t>=0&&(1/0===this.length||this.length>t)},get:function(t,e){return t=j(this,t),this.has(t)?this._start+t*this._step:e},contains:function(t){var e=(t-this._start)/this._step;return e>=0&&this.length>e&&e===Math.floor(e)},slice:function(t,e){return m(t,e,this.length)?this:(t=d(t,this.length),e=y(e,this.length),t>=e?jn:new Cn(this.get(t,this._end),this.get(e,this._end),this._step))},indexOf:function(t){var e=t-this._start;if(e%this._step===0){var n=e/this._step;if(n>=0&&this.length>n)return n}return-1},lastIndexOf:function(t){return this.indexOf(t)},take:function(t){return this.slice(0,t)},skip:function(t){return this.slice(t)},__iterate:function(t,e,n){for(var r=this.length-1,i=this._step,u=e?this._start+r*i:this._start,s=0;r>=s&&t(u,n?r-s:s,this)!==!1;s++)u+=e?-i:i;return n?this.length:s},__deepEquals:function(t){return this._start===t._start&&this._end===t._end&&this._step===t._step}},{},Le);var En=xn.prototype;En.__toJS=En.toArray,En.first=gn.first,En.last=gn.last;var jn=xn(0,0),Rn=function(t,e){return 0===e&&Pn?Pn:this instanceof Un?(this._value=t,void(this.length=null==e?1/0:Math.max(0,e))):new Un(t,e)},Un=Rn;Se.createClass(Rn,{toString:function(){return 0===this.length?"Repeat []":"Repeat [ "+this._value+" "+this.length+" times ]"},get:function(t,e){return this.has(t)?this._value:e},first:function(){return this._value},contains:function(t){return z(this._value,t)},slice:function(t,e){var n=this.length;return t=0>t?Math.max(0,n+t):Math.min(n,t),e=null==e?n:e>0?Math.min(n,e):Math.max(0,n+e),e>t?new Un(this._value,e-t):Pn},reverse:function(){return this},indexOf:function(t){return z(this._value,t)?0:-1},lastIndexOf:function(t){return z(this._value,t)?this.length:-1},__iterate:function(t,e,n){var r=e^n;h(!r||1/0>this.length,"Cannot access end of infinite range.");for(var i=this.length-1,u=0;i>=u&&t(this._value,r?i-u:u,this)!==!1;u++);return r?this.length:u <add>},Cn=xn;Se.createClass(xn,{toString:function(){return 0===this.length?"Range []":"Range [ "+this._start+"..."+this._end+(this._step>1?" by "+this._step:"")+" ]"},has:function(t){return t=j(this,t),t>=0&&(1/0===this.length||this.length>t)},get:function(t,e){return t=j(this,t),this.has(t)?this._start+t*this._step:e},contains:function(t){var e=(t-this._start)/this._step;return e>=0&&this.length>e&&e===Math.floor(e)},slice:function(t,e){return m(t,e,this.length)?this:(t=d(t,this.length),e=y(e,this.length),t>=e?jn:new Cn(this.get(t,this._end),this.get(e,this._end),this._step))},indexOf:function(t){var e=t-this._start;if(e%this._step===0){var n=e/this._step;if(n>=0&&this.length>n)return n}return-1},lastIndexOf:function(t){return this.indexOf(t)},take:function(t){return this.slice(0,t)},skip:function(t){return this.slice(t)},__iterate:function(t,e,n){for(var r=this.length-1,i=this._step,u=e?this._start+r*i:this._start,s=0;r>=s&&t(u,n?r-s:s,this)!==!1;s++)u+=e?-i:i;return s},__deepEquals:function(t){return this._start===t._start&&this._end===t._end&&this._step===t._step}},{},Le);var En=xn.prototype;En.__toJS=En.toArray,En.first=gn.first,En.last=gn.last;var jn=xn(0,0),Rn=function(t,e){return 0===e&&Pn?Pn:this instanceof Un?(this._value=t,void(this.length=null==e?1/0:Math.max(0,e))):new Un(t,e)},Un=Rn;Se.createClass(Rn,{toString:function(){return 0===this.length?"Repeat []":"Repeat [ "+this._value+" "+this.length+" times ]"},get:function(t,e){return this.has(t)?this._value:e},first:function(){return this._value},last:function(){return this._value},contains:function(t){return z(this._value,t)},slice:function(t,e){var n=this.length;return t=0>t?Math.max(0,n+t):Math.min(n,t),e=null==e?n:e>0?Math.min(n,e):Math.max(0,n+e),e>t?new Un(this._value,e-t):Pn},reverse:function(){return this},indexOf:function(t){return z(this._value,t)?0:-1},lastIndexOf:function(t){return z(this._value,t)?this.length:-1},__iterate:function(t,e,n){h(!n||1/0>this.length,"Cannot access end of infinite range.");for(var r=this.length-1,i=0;r>=i&&t(this._value,n?r-i:i,this)!==!1;i++);return i <ide> },__deepEquals:function(t){return z(this._value,t._value)}},{},Le);var Wn=Rn.prototype;Wn.last=Wn.first,Wn.has=En.has,Wn.take=En.take,Wn.skip=En.skip,Wn.__toJS=En.__toJS;var Pn=new Rn(void 0,0),Jn={Sequence:ze,Map:Ye,Vector:ln,Set:wn,OrderedMap:bn,Record:Dn,Range:xn,Repeat:Rn,is:z,fromJS:me};return Jn}"object"==typeof exports?module.exports=t():"function"==typeof define&&define.amd?define(t):Immutable=t(); <ide>\ No newline at end of file <ide><path>src/Range.js <ide> class Range extends IndexedSequence { <ide> } <ide> value += reverse ? -step : step; <ide> } <del> return flipIndices ? this.length : ii; <add> return ii; <ide> } <ide> <ide> __deepEquals(other) { <ide><path>src/Repeat.js <ide> class Repeat extends IndexedSequence { <ide> return this._value; <ide> } <ide> <add> last() { <add> return this._value; <add> } <add> <ide> contains(searchValue) { <ide> return is(this._value, searchValue); <ide> } <ide> class Repeat extends IndexedSequence { <ide> } <ide> <ide> __iterate(fn, reverse, flipIndices) { <del> var reversedIndices = reverse ^ flipIndices; <del> invariant(!reversedIndices || this.length < Infinity, 'Cannot access end of infinite range.'); <add> invariant(!flipIndices || this.length < Infinity, 'Cannot access end of infinite range.'); <ide> var maxIndex = this.length - 1; <ide> for (var ii = 0; ii <= maxIndex; ii++) { <del> if (fn(this._value, reversedIndices ? maxIndex - ii : ii, this) === false) { <add> if (fn(this._value, flipIndices ? maxIndex - ii : ii, this) === false) { <ide> break; <ide> } <ide> } <del> return reversedIndices ? this.length : ii; <add> return ii; <ide> } <ide> <ide> __deepEquals(other) {
4
Python
Python
remove the collectstatisticstask (was not optimal)
69e117791a84a1f3b3cfe08548d29d7867603c7f
<ide><path>celery/bin/celeryd.py <ide> def run_worker(concurrency=DAEMON_CONCURRENCY, detach=False, <ide> print(". Launching celery, please hold on to something...") <ide> <ide> if statistics: <del> from celery.task import tasks, CollectStatisticsTask <del> tasks.register(CollectStatisticsTask) <del> <ide> settings.CELERY_STATISTICS = statistics <ide> <ide> if not concurrency: <ide><path>celery/task.py <ide> def ping(): <ide> 'pong' <ide> """ <ide> return PingTask.apply_async().get() <del> <del> <del>class CollectStatisticsTask(PeriodicTask): <del> name = "celery.collect-statistics" <del> run_every = timedelta(seconds=STATISTICS_COLLECT_INTERVAL) <del> <del> def run(self, **kwargs): <del> from celery.monitoring import StatsCollector <del> stats = StatsCollector() <del> stats.collect() <del> stats.dump_to_cache() <del> return True
2
Text
Text
fix markdown syntax error in aufs-driver
ea047640597929436f13099fb3dc1e52f98f685b
<ide><path>docs/userguide/storagedriver/aufs-driver.md <ide> Storage Driver: aufs <ide> Dirperm1 Supported: false <ide> Execution Driver: native-0.2 <ide> ...output truncated... <del>```` <add>``` <ide> <ide> The output above shows that the Docker daemon is running the AUFS storage driver on top of an existing ext4 backing filesystem. <ide>
1
Java
Java
remove unnecessary iteration over headers
a7bb5ca473e55cd7fe1aaddfb30c4ec1ee913054
<ide><path>spring-test/src/main/java/org/springframework/mock/web/HeaderValueHolder.java <ide> /* <del> * Copyright 2002-2018 the original author or authors. <add> * Copyright 2002-2019 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> public String toString() { <ide> * @param headers the Map of header names to HeaderValueHolders <ide> * @param name the name of the desired header <ide> * @return the corresponding HeaderValueHolder, or {@code null} if none found <add> * @deprecated as of 5.1.10 in favor of using <add> * {@link org.springframework.util.LinkedCaseInsensitiveMap}. <ide> */ <ide> @Nullable <add> @Deprecated <ide> public static HeaderValueHolder getByName(Map<String, HeaderValueHolder> headers, String name) { <ide> Assert.notNull(name, "Header name must not be null"); <ide> for (String headerName : headers.keySet()) { <ide><path>spring-test/src/main/java/org/springframework/mock/web/MockHttpServletRequest.java <ide> else if (HttpHeaders.ACCEPT_LANGUAGE.equalsIgnoreCase(name) && <ide> } <ide> <ide> private void doAddHeaderValue(String name, @Nullable Object value, boolean replace) { <del> HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name); <add> HeaderValueHolder header = this.headers.get(name); <ide> Assert.notNull(value, "Header value must not be null"); <ide> if (header == null || replace) { <ide> header = new HeaderValueHolder(); <ide> public void removeHeader(String name) { <ide> */ <ide> @Override <ide> public long getDateHeader(String name) { <del> HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name); <add> HeaderValueHolder header = this.headers.get(name); <ide> Object value = (header != null ? header.getValue() : null); <ide> if (value instanceof Date) { <ide> return ((Date) value).getTime(); <ide> private long parseDateHeader(String name, String value) { <ide> @Override <ide> @Nullable <ide> public String getHeader(String name) { <del> HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name); <add> HeaderValueHolder header = this.headers.get(name); <ide> return (header != null ? header.getStringValue() : null); <ide> } <ide> <ide> @Override <ide> public Enumeration<String> getHeaders(String name) { <del> HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name); <add> HeaderValueHolder header = this.headers.get(name); <ide> return Collections.enumeration(header != null ? header.getStringValues() : new LinkedList<>()); <ide> } <ide> <ide> public Enumeration<String> getHeaderNames() { <ide> <ide> @Override <ide> public int getIntHeader(String name) { <del> HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name); <add> HeaderValueHolder header = this.headers.get(name); <ide> Object value = (header != null ? header.getValue() : null); <ide> if (value instanceof Number) { <ide> return ((Number) value).intValue(); <ide><path>spring-test/src/main/java/org/springframework/mock/web/MockHttpServletResponse.java <ide> /* <del> * Copyright 2002-2018 the original author or authors. <add> * Copyright 2002-2019 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> public Cookie getCookie(String name) { <ide> <ide> @Override <ide> public boolean containsHeader(String name) { <del> return (HeaderValueHolder.getByName(this.headers, name) != null); <add> return (this.headers.get(name) != null); <ide> } <ide> <ide> /** <ide> public Collection<String> getHeaderNames() { <ide> @Override <ide> @Nullable <ide> public String getHeader(String name) { <del> HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name); <add> HeaderValueHolder header = this.headers.get(name); <ide> return (header != null ? header.getStringValue() : null); <ide> } <ide> <ide> public String getHeader(String name) { <ide> */ <ide> @Override <ide> public List<String> getHeaders(String name) { <del> HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name); <add> HeaderValueHolder header = this.headers.get(name); <ide> if (header != null) { <ide> return header.getStringValues(); <ide> } <ide> public List<String> getHeaders(String name) { <ide> */ <ide> @Nullable <ide> public Object getHeaderValue(String name) { <del> HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name); <add> HeaderValueHolder header = this.headers.get(name); <ide> return (header != null ? header.getValue() : null); <ide> } <ide> <ide> public Object getHeaderValue(String name) { <ide> * @return the associated header values, or an empty List if none <ide> */ <ide> public List<Object> getHeaderValues(String name) { <del> HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name); <add> HeaderValueHolder header = this.headers.get(name); <ide> if (header != null) { <ide> return header.getValues(); <ide> } <ide> else if (HttpHeaders.SET_COOKIE.equalsIgnoreCase(name)) { <ide> } <ide> <ide> private void doAddHeaderValue(String name, Object value, boolean replace) { <del> HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name); <add> HeaderValueHolder header = this.headers.get(name); <ide> Assert.notNull(value, "Header value must not be null"); <ide> if (header == null) { <ide> header = new HeaderValueHolder(); <ide><path>spring-web/src/test/java/org/springframework/mock/web/test/MockHttpServletRequest.java <ide> else if (HttpHeaders.ACCEPT_LANGUAGE.equalsIgnoreCase(name) && <ide> } <ide> <ide> private void doAddHeaderValue(String name, @Nullable Object value, boolean replace) { <del> HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name); <add> HeaderValueHolder header = this.headers.get(name); <ide> Assert.notNull(value, "Header value must not be null"); <ide> if (header == null || replace) { <ide> header = new HeaderValueHolder(); <ide> public void removeHeader(String name) { <ide> */ <ide> @Override <ide> public long getDateHeader(String name) { <del> HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name); <add> HeaderValueHolder header = this.headers.get(name); <ide> Object value = (header != null ? header.getValue() : null); <ide> if (value instanceof Date) { <ide> return ((Date) value).getTime(); <ide> private long parseDateHeader(String name, String value) { <ide> @Override <ide> @Nullable <ide> public String getHeader(String name) { <del> HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name); <add> HeaderValueHolder header = this.headers.get(name); <ide> return (header != null ? header.getStringValue() : null); <ide> } <ide> <ide> @Override <ide> public Enumeration<String> getHeaders(String name) { <del> HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name); <add> HeaderValueHolder header = this.headers.get(name); <ide> return Collections.enumeration(header != null ? header.getStringValues() : new LinkedList<>()); <ide> } <ide> <ide> public Enumeration<String> getHeaderNames() { <ide> <ide> @Override <ide> public int getIntHeader(String name) { <del> HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name); <add> HeaderValueHolder header = this.headers.get(name); <ide> Object value = (header != null ? header.getValue() : null); <ide> if (value instanceof Number) { <ide> return ((Number) value).intValue(); <ide><path>spring-web/src/test/java/org/springframework/mock/web/test/MockHttpServletResponse.java <ide> /* <del> * Copyright 2002-2018 the original author or authors. <add> * Copyright 2002-2019 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> public Cookie getCookie(String name) { <ide> <ide> @Override <ide> public boolean containsHeader(String name) { <del> return (HeaderValueHolder.getByName(this.headers, name) != null); <add> return (this.headers.get(name) != null); <ide> } <ide> <ide> /** <ide> public Collection<String> getHeaderNames() { <ide> @Override <ide> @Nullable <ide> public String getHeader(String name) { <del> HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name); <add> HeaderValueHolder header = this.headers.get(name); <ide> return (header != null ? header.getStringValue() : null); <ide> } <ide> <ide> public String getHeader(String name) { <ide> */ <ide> @Override <ide> public List<String> getHeaders(String name) { <del> HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name); <add> HeaderValueHolder header = this.headers.get(name); <ide> if (header != null) { <ide> return header.getStringValues(); <ide> } <ide> public List<String> getHeaders(String name) { <ide> */ <ide> @Nullable <ide> public Object getHeaderValue(String name) { <del> HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name); <add> HeaderValueHolder header = this.headers.get(name); <ide> return (header != null ? header.getValue() : null); <ide> } <ide> <ide> public Object getHeaderValue(String name) { <ide> * @return the associated header values, or an empty List if none <ide> */ <ide> public List<Object> getHeaderValues(String name) { <del> HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name); <add> HeaderValueHolder header = this.headers.get(name); <ide> if (header != null) { <ide> return header.getValues(); <ide> } <ide> else if (HttpHeaders.SET_COOKIE.equalsIgnoreCase(name)) { <ide> } <ide> <ide> private void doAddHeaderValue(String name, Object value, boolean replace) { <del> HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name); <add> HeaderValueHolder header = this.headers.get(name); <ide> Assert.notNull(value, "Header value must not be null"); <ide> if (header == null) { <ide> header = new HeaderValueHolder();
5
Javascript
Javascript
improve err_invalid_opt_value error
8da8ec9c7e66e8f249757d3bdccc8588135c2ed7
<ide><path>lib/internal/child_process.js <ide> function getValidStdio(stdio, sync) { <ide> if (typeof stdio === 'string') { <ide> stdio = stdioStringToArray(stdio); <ide> } else if (!ArrayIsArray(stdio)) { <del> throw new ERR_INVALID_OPT_VALUE('stdio', inspect(stdio)); <add> throw new ERR_INVALID_OPT_VALUE('stdio', stdio); <ide> } <ide> <ide> // At least 3 stdio will be created <ide> function getValidStdio(stdio, sync) { <ide> } else { <ide> // Cleanup <ide> cleanup(); <del> throw new ERR_INVALID_OPT_VALUE('stdio', inspect(stdio)); <add> throw new ERR_INVALID_OPT_VALUE('stdio', stdio); <ide> } <ide> <ide> return acc; <ide><path>lib/internal/errors.js <ide> E('ERR_INVALID_MODULE_SPECIFIER', (request, reason, base = undefined) => { <ide> return `Invalid module "${request}" ${reason}${base ? <ide> ` imported from ${base}` : ''}`; <ide> }, TypeError); <del>E('ERR_INVALID_OPT_VALUE', (name, value) => <del> `The value "${String(value)}" is invalid for option "${name}"`, <del> TypeError, <del> RangeError); <add>E('ERR_INVALID_OPT_VALUE', (name, value, reason = '') => { <add> let inspected = typeof value === 'string' ? <add> value : lazyInternalUtilInspect().inspect(value); <add> if (inspected.length > 128) inspected = `${inspected.slice(0, 128)}...`; <add> if (reason) reason = '. ' + reason; <add> return `The value "${inspected}" is invalid for option "${name}"` + reason; <add>}, TypeError, RangeError); <ide> E('ERR_INVALID_OPT_VALUE_ENCODING', <ide> 'The value "%s" is invalid for option "encoding"', TypeError); <ide> E('ERR_INVALID_PACKAGE_CONFIG', (path, base, message) => { <ide><path>lib/net.js <ide> const { <ide> <ide> const EventEmitter = require('events'); <ide> const stream = require('stream'); <del>const { inspect } = require('internal/util/inspect'); <ide> let debug = require('internal/util/debuglog').debuglog('net', (fn) => { <ide> debug = fn; <ide> }); <ide> Server.prototype.listen = function(...args) { <ide> 'must have the property "port" or "path"'); <ide> } <ide> <del> throw new ERR_INVALID_OPT_VALUE('options', inspect(options)); <add> throw new ERR_INVALID_OPT_VALUE('options', options); <ide> }; <ide> <ide> function lookupAndListen(self, port, address, backlog, exclusive, flags) { <ide><path>test/parallel/test-crypto-keygen.js <ide> const { <ide> sign, <ide> verify <ide> } = require('crypto'); <del>const { promisify } = require('util'); <add>const { inspect, promisify } = require('util'); <ide> <ide> // Asserts that the size of the given key (in chars or bytes) is within 10% of <ide> // the expected size. <ide> const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); <ide> }), { <ide> name: 'TypeError', <ide> code: 'ERR_INVALID_OPT_VALUE', <del> message: `The value "${type}" is invalid for option ` + <add> message: `The value "${inspect(type)}" is invalid for option ` + <ide> '"publicKeyEncoding.type"' <ide> }); <ide> } <ide> <ide> // Missing / invalid publicKeyEncoding.format. <ide> for (const format of [undefined, null, 0, false, 'a', {}]) { <add> const expected = typeof format === 'string' ? format : inspect(format); <ide> assert.throws(() => generateKeyPairSync('rsa', { <ide> modulusLength: 4096, <ide> publicKeyEncoding: { <ide> const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); <ide> }), { <ide> name: 'TypeError', <ide> code: 'ERR_INVALID_OPT_VALUE', <del> message: `The value "${format}" is invalid for option ` + <add> message: `The value "${expected}" is invalid for option ` + <ide> '"publicKeyEncoding.format"' <ide> }); <ide> } <ide> const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); <ide> }), { <ide> name: 'TypeError', <ide> code: 'ERR_INVALID_OPT_VALUE', <del> message: `The value "${type}" is invalid for option ` + <add> message: `The value "${inspect(type)}" is invalid for option ` + <ide> '"privateKeyEncoding.type"' <ide> }); <ide> } <ide> <ide> // Missing / invalid privateKeyEncoding.format. <ide> for (const format of [undefined, null, 0, false, 'a', {}]) { <add> const expected = typeof format === 'string' ? format : inspect(format); <ide> assert.throws(() => generateKeyPairSync('rsa', { <ide> modulusLength: 4096, <ide> publicKeyEncoding: { <ide> const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); <ide> }), { <ide> name: 'TypeError', <ide> code: 'ERR_INVALID_OPT_VALUE', <del> message: `The value "${format}" is invalid for option ` + <add> message: `The value "${expected}" is invalid for option ` + <ide> '"privateKeyEncoding.format"' <ide> }); <ide> } <ide> const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); <ide> }), { <ide> name: 'TypeError', <ide> code: 'ERR_INVALID_OPT_VALUE', <del> message: `The value "${cipher}" is invalid for option ` + <add> message: `The value "${inspect(cipher)}" is invalid for option ` + <ide> '"privateKeyEncoding.cipher"' <ide> }); <ide> } <ide> const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); <ide> { <ide> // Test invalid modulus lengths. <ide> for (const modulusLength of [undefined, null, 'a', true, {}, [], 512.1, -1]) { <add> const expected = typeof modulusLength === 'string' ? <add> modulusLength : inspect(modulusLength); <ide> assert.throws(() => generateKeyPair('rsa', { <ide> modulusLength <ide> }), { <ide> name: 'TypeError', <ide> code: 'ERR_INVALID_OPT_VALUE', <del> message: `The value "${modulusLength}" is invalid for option ` + <add> message: `The value "${expected}" is invalid for option ` + <ide> '"modulusLength"' <ide> }); <ide> } <ide> <ide> // Test invalid exponents. <ide> for (const publicExponent of ['a', true, {}, [], 3.5, -1]) { <add> const expected = typeof publicExponent === 'string' ? <add> publicExponent : inspect(publicExponent); <ide> assert.throws(() => generateKeyPair('rsa', { <ide> modulusLength: 4096, <ide> publicExponent <ide> }), { <ide> name: 'TypeError', <ide> code: 'ERR_INVALID_OPT_VALUE', <del> message: `The value "${publicExponent}" is invalid for option ` + <add> message: `The value "${expected}" is invalid for option ` + <ide> '"publicExponent"' <ide> }); <ide> } <ide> const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); <ide> { <ide> // Test invalid modulus lengths. <ide> for (const modulusLength of [undefined, null, 'a', true, {}, [], 4096.1]) { <add> const expected = typeof modulusLength === 'string' ? <add> modulusLength : inspect(modulusLength); <ide> assert.throws(() => generateKeyPair('dsa', { <ide> modulusLength <ide> }), { <ide> name: 'TypeError', <ide> code: 'ERR_INVALID_OPT_VALUE', <del> message: `The value "${modulusLength}" is invalid for option ` + <add> message: `The value "${expected}" is invalid for option ` + <ide> '"modulusLength"' <ide> }); <ide> } <ide> <ide> // Test invalid divisor lengths. <ide> for (const divisorLength of ['a', true, {}, [], 4096.1]) { <add> const expected = typeof divisorLength === 'string' ? <add> divisorLength : inspect(divisorLength); <ide> assert.throws(() => generateKeyPair('dsa', { <ide> modulusLength: 2048, <ide> divisorLength <ide> }), { <ide> name: 'TypeError', <ide> code: 'ERR_INVALID_OPT_VALUE', <del> message: `The value "${divisorLength}" is invalid for option ` + <add> message: `The value "${expected}" is invalid for option ` + <ide> '"divisorLength"' <ide> }); <ide> } <ide> const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); <ide> }, { <ide> name: 'TypeError', <ide> code: 'ERR_INVALID_OPT_VALUE', <del> message: `The value "${namedCurve}" is invalid for option ` + <add> message: `The value "${inspect(namedCurve)}" is invalid for option ` + <ide> '"namedCurve"' <ide> }); <ide> } <ide> const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); <ide> }, { <ide> name: 'TypeError', <ide> code: 'ERR_INVALID_OPT_VALUE', <del> message: `The value "${hashValue}" is invalid for option "hash"` <add> message: `The value "${inspect(hashValue)}" is invalid for option "hash"` <ide> }); <ide> } <ide> <ide> const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); <ide> ); <ide> <ide> for (const mgf1Hash of [null, 0, false, {}, []]) { <add> const expected = inspect(mgf1Hash); <ide> assert.throws( <ide> () => { <ide> generateKeyPair('rsa-pss', { <ide> const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); <ide> { <ide> name: 'TypeError', <ide> code: 'ERR_INVALID_OPT_VALUE', <del> message: `The value "${mgf1Hash}" is invalid for option "mgf1Hash"` <add> message: `The value "${expected}" is invalid for option "mgf1Hash"` <ide> } <ide> ); <ide> } <ide><path>test/parallel/test-http2-client-request-options-errors.js <ide> if (!common.hasCrypto) <ide> common.skip('missing crypto'); <ide> const assert = require('assert'); <ide> const http2 = require('http2'); <add>const { inspect } = require('util'); <ide> <ide> // Check if correct errors are emitted when wrong type of data is passed <ide> // to certain options of ClientHttp2Session request method <ide> server.listen(0, common.mustCall(() => { <ide> }), { <ide> name: 'TypeError', <ide> code: 'ERR_INVALID_OPT_VALUE', <del> message: `The value "${String(types[type])}" is invalid ` + <add> message: `The value "${inspect(types[type])}" is invalid ` + <ide> `for option "${option}"` <ide> }); <ide> }); <ide><path>test/parallel/test-http2-respond-file-errors.js <ide> if (!common.hasCrypto) <ide> const fixtures = require('../common/fixtures'); <ide> const assert = require('assert'); <ide> const http2 = require('http2'); <add>const { inspect } = require('util'); <ide> <ide> const optionsWithTypeError = { <ide> offset: 'number', <ide> server.on('stream', common.mustCall((stream) => { <ide> { <ide> name: 'TypeError', <ide> code: 'ERR_INVALID_OPT_VALUE', <del> message: `The value "${String(types[type])}" is invalid ` + <add> message: `The value "${inspect(types[type])}" is invalid ` + <ide> `for option "${option}"` <ide> } <ide> ); <ide><path>test/parallel/test-http2-respond-file-fd-errors.js <ide> const fixtures = require('../common/fixtures'); <ide> const assert = require('assert'); <ide> const http2 = require('http2'); <ide> const fs = require('fs'); <add>const { inspect } = require('util'); <ide> <ide> const optionsWithTypeError = { <ide> offset: 'number', <ide> server.on('stream', common.mustCall((stream) => { <ide> { <ide> name: 'TypeError', <ide> code: 'ERR_INVALID_OPT_VALUE', <del> message: `The value "${String(types[type])}" is invalid ` + <add> message: `The value "${inspect(types[type])}" is invalid ` + <ide> `for option "${option}"` <ide> } <ide> ); <ide><path>test/parallel/test-performanceobserver.js <ide> assert.strictEqual(counts[NODE_PERFORMANCE_ENTRY_TYPE_FUNCTION], 0); <ide> { <ide> code: 'ERR_INVALID_OPT_VALUE', <ide> name: 'TypeError', <del> message: `The value "${i}" is invalid ` + <add> message: `The value "${inspect(i)}" is invalid ` + <ide> 'for option "entryTypes"' <ide> }); <ide> }); <ide><path>test/parallel/test-streams-highwatermark.js <ide> const common = require('../common'); <ide> <ide> const assert = require('assert'); <ide> const stream = require('stream'); <add>const { inspect } = require('util'); <ide> <ide> { <ide> // This test ensures that the stream implementation correctly handles values <ide> const stream = require('stream'); <ide> assert.strictEqual(writable._writableState.highWaterMark, ovfl); <ide> <ide> for (const invalidHwm of [true, false, '5', {}, -5, NaN]) { <add> const expected = typeof invalidHwm === 'string' ? <add> invalidHwm : inspect(invalidHwm); <ide> for (const type of [stream.Readable, stream.Writable]) { <ide> assert.throws(() => { <ide> type({ highWaterMark: invalidHwm }); <ide> }, { <ide> name: 'TypeError', <ide> code: 'ERR_INVALID_OPT_VALUE', <ide> message: <del> `The value "${invalidHwm}" is invalid for option "highWaterMark"` <add> `The value "${expected}" is invalid for option "highWaterMark"` <ide> }); <ide> } <ide> }
9