content_type
stringclasses
8 values
main_lang
stringclasses
7 values
message
stringlengths
1
50
sha
stringlengths
40
40
patch
stringlengths
52
962k
file_count
int64
1
300
Ruby
Ruby
fix nil handling in `brew versions`
9cdfd2797fb547473d460c7b4a0f88a6a7d174b5
<ide><path>Library/Homebrew/cmd/versions.rb <ide> def self.old_versions f <ide> yielded = [] <ide> f.rev_list.each do |sha| <ide> version = f.version_for_sha sha <del> unless yielded.include? version <add> unless yielded.include? version or version.nil? <ide> yield version, sha <ide> yielded << version <ide> end <ide> def version_for_sha sha <ide> return version[1] unless version.nil? <ide> <ide> url = code.match(/class #{Formula.class_s name} < ?Formula.*?(?:url\s|@url\s*=)\s*(?:'|")(.+?)(?:'|").*?end\s/m) <del> return Pathname.new(url[1]).version unless url.nil? <add> unless url.nil? <add> version = Pathname.new(url[1]).version <add> return version unless version.to_s.empty? <add> end <ide> <ide> head = code.match(/class #{Formula.class_s name} < ?Formula.*?head\s'(.*?)'.*?end\s\s/m) <ide> return 'HEAD' unless head.nil?
1
Text
Text
escape asterisk in cctest gtest-filter
9afe2b60663685f7679c278f85220f41521d8215
<ide><path>doc/guides/writing-tests.md <ide> $ make cctest GTEST_FILTER=EnvironmentTest.AtExitWithArgument <ide> `cctest` can also be run directly which can be useful when debugging: <ide> <ide> ```console <del>$ out/Release/cctest --gtest_filter=EnvironmentTest.AtExit* <add>$ out/Release/cctest --gtest_filter=EnvironmentTest.AtExit\* <ide> ``` <ide> <ide> ### Node.js test fixture
1
Ruby
Ruby
add require to suppress warning; remove variable
4da888f38452d9727c77fd91cd7a267e4e1eec42
<ide><path>activesupport/lib/active_support/core_ext/big_decimal/conversions.rb <ide> require 'bigdecimal' <add>require 'bigdecimal/util' <ide> require 'yaml' <ide> <ide> class BigDecimal <ide><path>railties/lib/rails/generators/named_base.rb <ide> def module_namespacing(&block) <ide> <ide> def indent(content, multiplier = 2) <ide> spaces = " " * multiplier <del> content = content.each_line.map {|line| line.blank? ? line : "#{spaces}#{line}" }.join <add> content.each_line.map {|line| line.blank? ? line : "#{spaces}#{line}" }.join <ide> end <ide> <ide> def wrap_with_namespace(content)
2
Ruby
Ruby
check all dependents for broken dylibs
da34fba151ee33c1a2e14ab21ee0dc4ea451cc0f
<ide><path>Library/Homebrew/cmd/test-bot.rb <ide> def formula(formula_name) <ide> dependents -= @formulae <ide> dependents = dependents.map { |d| Formulary.factory(d) } <ide> <del> testable_dependents = dependents.select { |d| d.test_defined? && d.bottled? } <add> bottled_dependents = dependents.select { |d| d.bottled? } <add> testable_dependents = dependents.select { |d| d.bottled? && d.test_defined? } <ide> <ide> if (deps | reqs).any? { |d| d.name == "mercurial" && d.build? } <ide> run_as_not_developer { test "brew", "install", "mercurial" } <ide> def formula(formula_name) <ide> shared_test_args = ["--verbose"] <ide> shared_test_args << "--keep-tmp" if ARGV.keep_tmp? <ide> test "brew", "test", formula_name, *shared_test_args if formula.test_defined? <del> testable_dependents.each do |dependent| <add> bottled_dependents.each do |dependent| <ide> unless dependent.installed? <ide> test "brew", "fetch", "--retry", dependent.name <ide> next if steps.last.failed? <ide> def formula(formula_name) <ide> end <ide> end <ide> if dependent.installed? <del> test "brew", "test", "--verbose", dependent.name <add> test "brew", "linkage", "--test", dependent.name <add> if testable_dependents.include? dependent <add> test "brew", "test", "--verbose", dependent.name <add> end <ide> end <ide> end <ide> test "brew", "uninstall", "--force", formula_name <ide><path>Library/Homebrew/dev-cmd/linkage.rb <add># <add># Description: check linkage of installed keg <add># Usage: <add># brew linkage <formulae> <add># <add># Only works on installed formulae. An error is raised if it is run on uninstalled <add># formulae. <add># <add># Options: <add># --test - testing version: only display broken libs; exit non-zero if any <add># breakage was found. <add> <add>require "set" <add>require "keg" <add>require "formula" <add> <add>module Homebrew <add> <add> def linkage <add> found_broken_dylibs = false <add> ARGV.kegs.each do |keg| <add> ohai "Checking #{keg.name} linkage" if ARGV.kegs.size > 1 <add> result = LinkageChecker.new(keg) <add> if ARGV.include?("--test") <add> result.display_test_output <add> else <add> result.display_normal_output <add> end <add> found_broken_dylibs = true if !result.broken_dylibs.empty? <add> end <add> if ARGV.include?("--test") && found_broken_dylibs <add> exit 1 <add> end <add> end <add> <add> class LinkageChecker <add> attr_reader :keg <add> attr_reader :broken_dylibs <add> <add> def initialize(keg) <add> @keg = keg <add> @brewed_dylibs = Hash.new { |h, k| h[k] = Set.new } <add> @system_dylibs = Set.new <add> @broken_dylibs = Set.new <add> @variable_dylibs = Set.new <add> check_dylibs <add> end <add> <add> def check_dylibs <add> @keg.find do |file| <add> next unless file.dylib? || file.mach_o_executable? || file.mach_o_bundle? <add> file.dynamically_linked_libraries.each do |dylib| <add> if dylib.start_with? "@" <add> @variable_dylibs << dylib <add> else <add> begin <add> owner = Keg.for Pathname.new(dylib) <add> rescue NotAKegError <add> @system_dylibs << dylib <add> rescue Errno::ENOENT <add> @broken_dylibs << dylib <add> else <add> @brewed_dylibs[owner.name] << dylib <add> end <add> end <add> end <add> end <add> <add> begin <add> f = Formula[keg.name] <add> @undeclared_deps = @brewed_dylibs.keys - f.deps.map(&:name) <add> @undeclared_deps -= [f.name] <add> rescue FormulaUnavailableError <add> opoo "Formula unavailable: #{keg.name}" <add> @undeclared_deps = [] <add> end <add> <add> end <add> <add> def display_normal_output <add> unless @system_dylibs.empty? <add> display_items "System libraries", @system_dylibs <add> end <add> unless @brewed_dylibs.empty? <add> display_items "Homebrew libraries", @brewed_dylibs <add> end <add> unless @variable_dylibs.empty? <add> display_items "Variable-referenced libraries", @variable_dylibs <add> end <add> unless @broken_dylibs.empty? <add> display_items "Missing libraries", @broken_dylibs <add> end <add> unless @undeclared_deps.empty? <add> display_items "Possible undeclared dependencies", @undeclared_deps <add> end <add> end <add> <add> def display_test_output <add> if @broken_dylibs.empty? <add> puts "No broken dylib links" <add> else <add> display_items "Missing libraries", @broken_dylibs <add> end <add> end <add> <add> private <add> <add> # Display a list of things. <add> # Things may either be an array, or a hash of (label -> array) <add> def display_items(label, things) <add> puts "#{label}:" <add> if things.is_a? Hash <add> things.sort.each do |label, list| <add> list.sort.each do |item| <add> puts " #{item} (#{label})" <add> end <add> end <add> else <add> things.sort.each do |item| <add> puts " #{item}" <add> end <add> end <add> end <add> end <add>end <ide>\ No newline at end of file
2
Text
Text
fix typo in http2.md
d1d9e2fce521ae1deae4fa2b75a7f93a9c5bdafb
<ide><path>doc/api/http2.md <ide> changes: <ide> and the total frame length will *not* necessarily be aligned at 8 bytes. <ide> * `peerMaxConcurrentStreams` {number} Sets the maximum number of concurrent <ide> streams for the remote peer as if a SETTINGS frame had been received. Will <del> be overridden if the remote peer sets its own value for. <add> be overridden if the remote peer sets its own value for <ide> `maxConcurrentStreams`. **Default:** `100` <ide> * `selectPadding` {Function} When `options.paddingStrategy` is equal to <ide> `http2.constants.PADDING_STRATEGY_CALLBACK`, provides the callback function
1
PHP
PHP
fix a bunch more api doc errors
e9aba0ffb6797c074802da9fefd3760b174eb93c
<ide><path>src/Database/Dialect/PostgresDialectTrait.php <ide> protected function _transformDistinct($query) { <ide> * Modifies the original insert query to append a "RETURNING *" epilogue <ide> * so that the latest insert id can be retrieved <ide> * <del> * @param \Cake\Database\Query $query <add> * @param \Cake\Database\Query $query The query to translate. <ide> * @return \Cake\Database\Query <ide> */ <ide> protected function _insertQueryTranslator($query) { <ide> protected function _expressionTranslators() { <ide> * Receives a FunctionExpression and changes it so that it conforms to this <ide> * SQL dialect. <ide> * <del> * @param \Cake\Database\Expression\FunctionExpression <add> * @param \Cake\Database\Expression\FunctionExpression $expression The function expression to convert <add> * to postgres SQL. <ide> * @return void <ide> */ <ide> protected function _transformFunctionExpression(FunctionExpression $expression) { <ide><path>src/Database/Dialect/SqliteDialectTrait.php <ide> protected function _expressionTranslators() { <ide> * Receives a FunctionExpression and changes it so that it conforms to this <ide> * SQL dialect. <ide> * <del> * @param \Cake\Database\Expression\FunctionExpression <add> * @param \Cake\Database\Expression\FunctionExpression $expression The function expression <add> * to translate for SQLite. <ide> * @return void <ide> */ <ide> protected function _transformFunctionExpression(FunctionExpression $expression) { <ide><path>src/Database/Dialect/SqlserverDialectTrait.php <ide> public function _version() { <ide> * Prior to SQLServer 2012 there was no equivalent to LIMIT OFFSET, so a subquery must <ide> * be used. <ide> * <del> * @param \Cake\Database\Query $query The query to wrap in a subquery. <add> * @param \Cake\Database\Query $original The query to wrap in a subquery. <ide> * @param int $limit The number of rows to fetch. <ide> * @param int $offset The number of rows to offset. <ide> * @return \Cake\Database\Query Modified query object. <ide> protected function _expressionTranslators() { <ide> * Receives a FunctionExpression and changes it so that it conforms to this <ide> * SQL dialect. <ide> * <del> * @param Cake\Database\Expression\FunctionExpression <add> * @param Cake\Database\Expression\FunctionExpression $expression The function expression to convert to TSQL. <ide> * @return void <ide> */ <ide> protected function _transformFunctionExpression(FunctionExpression $expression) { <ide> public function rollbackSavePointSQL($name) { <ide> <ide> /** <ide> * {@inheritDoc} <add> * <add> * @return \Cake\Database\SqlserverCompiler <ide> */ <ide> public function newCompiler() { <ide> return new SqlserverCompiler(); <ide><path>src/Database/Dialect/TupleComparisonTranslatorTrait.php <ide> trait TupleComparisonTranslatorTrait { <ide> <ide> /** <del> * <ide> * Receives a TupleExpression and changes it so that it conforms to this <ide> * SQL dialect. <ide> * <ide> trait TupleComparisonTranslatorTrait { <ide> * <ide> * 1 = (SELECT 1 FROM a_table WHERE (a = c) AND (b = d)) <ide> * <del> * @param \Cake\Database\Expression\TupleComparison $expression <del> * @param \Cake\Database\Query $query <add> * @param \Cake\Database\Expression\TupleComparison $expression The expression to transform <add> * @param \Cake\Database\Query $query The query to update. <ide> * @return void <ide> */ <ide> protected function _transformTupleComparison(TupleComparison $expression, $query) { <ide><path>src/Database/IdentifierQuoter.php <ide> <ide> /** <ide> * Contains all the logic related to quoting identifiers in a Query object <del> * <ide> */ <ide> class IdentifierQuoter { <ide> <ide> class IdentifierQuoter { <ide> /** <ide> * Constructor <ide> * <del> * @param \Cake\Database\Driver The driver instance used to do the identifier quoting <add> * @param \Cake\Database\Driver $driver The driver instance used to do the identifier quoting <ide> */ <ide> public function __construct(Driver $driver) { <ide> $this->_driver = $driver; <ide> public function __construct(Driver $driver) { <ide> * Iterates over each of the clauses in a query looking for identifiers and <ide> * quotes them <ide> * <del> * @param Query $query The query to have its identifiers quoted <del> * @return Query <add> * @param \Cake\Database\Query $query The query to have its identifiers quoted <add> * @return \Cake\Database\Query <ide> */ <ide> public function quote(Query $query) { <ide> $binder = $query->valueBinder(); <ide> public function quote(Query $query) { <ide> /** <ide> * Quotes identifiers inside expression objects <ide> * <del> * @param \Cake\Database\ExpressionInterface $expression <add> * @param \Cake\Database\ExpressionInterface $expression The expression object to walk and quote. <ide> * @return void <ide> */ <ide> public function quoteExpression($expression) { <ide> public function quoteExpression($expression) { <ide> /** <ide> * Quotes all identifiers in each of the clauses of a query <ide> * <del> * @param Query <add> * @param \Cake\Database\Query $query The query to quote. <ide> * @return void <ide> */ <ide> protected function _quoteParts($query) { <ide> protected function _basicQuoter($part) { <ide> * Quotes both the table and alias for an array of joins as stored in a Query <ide> * object <ide> * <del> * @param array $joins <add> * @param array $joins The joins to quote. <ide> * @return array <ide> */ <ide> protected function _quoteJoins($joins) { <ide> protected function _quoteJoins($joins) { <ide> /** <ide> * Quotes the table name and columns for an insert query <ide> * <del> * @param Query $query <add> * @param \Cake\Database\Query $query The insert query to quote. <ide> * @return void <ide> */ <ide> protected function _quoteInsert($query) { <ide> protected function _quoteInsert($query) { <ide> /** <ide> * Quotes identifiers in comparison expression objects <ide> * <del> * @param \Cake\Database\Expression\Comparison $expression <add> * @param \Cake\Database\Expression\Comparison $expression The comparison expression to quote. <ide> * @return void <ide> */ <ide> protected function _quoteComparison(Comparison $expression) { <ide> protected function _quoteOrderBy(OrderByExpression $expression) { <ide> /** <ide> * Quotes identifiers in "order by" expression objects <ide> * <del> * @param \Cake\Database\Expression\IdentifierExpression $expression <add> * @param \Cake\Database\Expression\IdentifierExpression $expression The identifiers to quote. <ide> * @return void <ide> */ <ide> protected function _quoteIndetifierExpression(IdentifierExpression $expression) { <ide><path>src/Database/Log/QueryLogger.php <ide> protected function _log($query) { <ide> * Helper function used to replace query placeholders by the real <ide> * params used to execute the query <ide> * <del> * @param LoggedQuery $query <add> * @param LoggedQuery $query The query to log <ide> * @return string <ide> */ <ide> protected function _interpolate($query) { <ide><path>src/Database/Statement/BufferedStatement.php <ide> class BufferedStatement extends StatementDecorator { <ide> <ide> /** <ide> * Records count <add> * <ide> * @var int <ide> */ <ide> protected $_count = 0; <ide> public function execute($params = null) { <ide> <ide> /** <ide> * {@inheritDoc} <add> * <add> * @param string $type The type to fetch. <add> * @return mixed <ide> */ <ide> public function fetch($type = 'num') { <ide> if ($this->_allFetched) { <ide> public function fetch($type = 'num') { <ide> <ide> /** <ide> * {@inheritDoc} <add> * <add> * @param string $type The type to fetch. <add> * @return mixed <ide> */ <ide> public function fetchAll($type = 'num') { <ide> if ($this->_allFetched) { <ide> public function rowCount() { <ide> <ide> /** <ide> * Rewind the _counter property <add> * <add> * @return void <ide> */ <ide> public function rewind() { <ide> $this->_counter = 0; <ide> } <ide> <ide> /** <ide> * Reset all properties <add> * <add> * @return void <ide> */ <ide> protected function _reset() { <ide> $this->_count = $this->_counter = 0; <ide><path>src/Database/Statement/PDOStatement.php <ide> class PDOStatement extends StatementDecorator { <ide> /** <ide> * Constructor <ide> * <del> * @param \PDOStatement original statement to be decorated <del> * @param \Cake\Database\Driver instance $driver <add> * @param \PDOStatement $statement Original statement to be decorated. <add> * @param \Cake\Database\Driver $driver Driver instance. <ide> */ <ide> public function __construct(Statement $statement = null, $driver = null) { <ide> $this->_statement = $statement; <ide> public function __construct(Statement $statement = null, $driver = null) { <ide> * <ide> * ## Examples: <ide> * <del> * `$statement->bindValue(1, 'a title');` <del> * `$statement->bindValue(2, 5, PDO::INT);` <del> * `$statement->bindValue('active', true, 'boolean');` <del> * `$statement->bindValue(5, new \DateTime(), 'date');` <add> * {{{ <add> * $statement->bindValue(1, 'a title'); <add> * $statement->bindValue(2, 5, PDO::INT); <add> * $statement->bindValue('active', true, 'boolean'); <add> * $statement->bindValue(5, new \DateTime(), 'date'); <add> * }}} <ide> * <ide> * @param string|int $column name or param position to be bound <ide> * @param mixed $value The value to bind to variable in query <ide><path>src/Database/Statement/SqlserverStatement.php <ide> class SqlserverStatement extends PDOStatement { <ide> <ide> /** <del> * {@inheritDoc} <del> * <ide> * The SQL Server PDO driver requires that binary parameters be bound with the SQLSRV_ENCODING_BINARY attribute. <ide> * This overrides the PDOStatement::bindValue method in order to bind binary columns using the required attribute. <add> * <add> * {@inheritDoc} <ide> */ <ide> public function bindValue($column, $value, $type = 'string') { <ide> if ($type === null) { <ide><path>src/Database/Type.php <ide> public static function build($name) { <ide> * If $className is omitted it will return mapped class for $type <ide> * <ide> * @param string|array $type if string name of type to map, if array list of arrays to be mapped <del> * @param string $className <add> * @param string $className The classname to register. <ide> * @return array|string|null if $type is null then array with current map, if $className is null string <ide> * configured class name for give $type, null otherwise <ide> */
10
Python
Python
simplify fab table resetting
5e460cbed8a98d3217abe2423f16abe84a8a8a1a
<ide><path>airflow/models/__init__.py <ide> def import_all_models(): <ide> import airflow.models.dataset <ide> import airflow.models.serialized_dag <ide> import airflow.models.tasklog <add> import airflow.www.fab_security.sqla.models <ide> <ide> <ide> def __getattr__(name): <ide><path>airflow/utils/db.py <ide> def resetdb(session: Session = NEW_SESSION, skip_init: bool = False): <ide> <ide> with create_global_lock(session=session, lock=DBLocks.MIGRATIONS): <ide> drop_airflow_models(connection) <del> drop_flask_models(connection) <ide> drop_airflow_moved_tables(session) <ide> <ide> if not skip_init: <ide> def drop_airflow_moved_tables(session): <ide> Base.metadata.remove(tbl) <ide> <ide> <del>def drop_flask_models(connection): <del> """ <del> Drops all Flask models. <del> <del> :param connection: SQLAlchemy Connection <del> :return: None <del> """ <del> from airflow.www.fab_security.sqla.models import Base <del> <del> Base.metadata.drop_all(connection) <del> <del> <ide> @provide_session <ide> def check(session: Session = NEW_SESSION): <ide> """ <ide><path>tests/utils/test_db.py <ide> def test_downgrade_with_from(self, mock_om): <ide> @pytest.mark.parametrize("skip_init", [False, True]) <ide> @mock.patch("airflow.utils.db.create_global_lock", new=MagicMock) <ide> @mock.patch("airflow.utils.db.drop_airflow_models") <del> @mock.patch("airflow.utils.db.drop_flask_models") <ide> @mock.patch("airflow.utils.db.drop_airflow_moved_tables") <ide> @mock.patch("airflow.utils.db.initdb") <ide> @mock.patch("airflow.settings.engine.connect") <ide> def test_resetdb( <ide> mock_connect, <ide> mock_init, <ide> mock_drop_moved, <del> mock_drop_flask, <ide> mock_drop_airflow, <ide> skip_init, <ide> ): <ide> session_mock = MagicMock() <ide> resetdb(session_mock, skip_init=skip_init) <ide> mock_drop_airflow.assert_called_once_with(mock_connect.return_value) <del> mock_drop_flask.assert_called_once_with(mock_connect.return_value) <ide> mock_drop_moved.assert_called_once_with(session_mock) <ide> if skip_init: <ide> mock_init.assert_not_called()
3
Text
Text
fix links in nlp readme
8bc5a1a5aa9068820d1dfeb26b4887e0740833a2
<ide><path>official/nlp/README.md <ide> research ideas. Detailed intructions can be found in READMEs in each folder. <ide> <ide> We provide SoTA model implementations, pre-trained models, training and <ide> evaluation examples, and command lines. Detail instructions can be found in the <del>READMEs for specific papers. <add>READMEs for specific papers. Below are some papers implemented in the <add>repository and more NLP projects can be found in the <add>[`projects`](https://github.com/tensorflow/models/tree/master/official/projects) <add>folder: <ide> <ide> 1. [BERT](MODEL_GARDEN.md#available-model-configs): [BERT: Pre-training of Deep Bidirectional Transformers for <ide> Language Understanding](https://arxiv.org/abs/1810.04805) by Devlin et al., <ide> 2018 <ide> 2. [ALBERT](MODEL_GARDEN.md#available-model-configs): <ide> [A Lite BERT for Self-supervised Learning of Language Representations](https://arxiv.org/abs/1909.11942) <ide> by Lan et al., 2019 <del>3. [XLNet](xlnet): <add>3. [XLNet](MODEL_GARDEN.md): <ide> [XLNet: Generalized Autoregressive Pretraining for Language Understanding](https://arxiv.org/abs/1906.08237) <ide> by Yang et al., 2019 <del>4. [Transformer for translation](transformer): <add>4. [Transformer for translation](MODEL_GARDEN.md#available-model-configs): <ide> [Attention Is All You Need](https://arxiv.org/abs/1706.03762) by Vaswani et <ide> al., 2017 <ide>
1
Ruby
Ruby
recognize dist suffix
252605b2ae6ce344e88e946c7de6ef19f7e82121
<ide><path>Library/Homebrew/extend/pathname.rb <ide> def version <ide> return $1 if $1 <ide> <ide> # eg foobar-4.5.0-bin <del> /-((\d+\.)+\d+[abc]?)[-._](bin|stable|src|sources?)$/.match stem <add> /-((\d+\.)+\d+[abc]?)[-._](bin|dist|stable|src|sources?)$/.match stem <ide> return $1 if $1 <ide> <ide> # Debian style eg dash_0.5.5.1.orig.tar.gz
1
Text
Text
add request for os and version
ceaeef86755b50cf2e04ecc0ae1441d1d7c9c19e
<ide><path>ISSUE_TEMPLATE.md <ide> For more information on how to write a good [bug report](https://github.com/atom <ide> <ide> ### Versions <ide> <del>You can get this information from executing `atom --version` and `apm --version` at the command line. <add>You can get this information from executing `atom --version` and `apm --version` at the command line. Also, please include the OS and what version of the OS you're running.
1
Text
Text
add referecnes for translations
66f07cbd228b0c68a0e16022b18efc4e6c7cad06
<ide><path>threejs/lessons/threejs-fundamentals.md <ide> to support legacy browsers look into a <a href="https://babeljs.io">transpiler</ <ide> </div> <ide> <ide> <!-- needed for out of date translations --> <del><a href="threejs-geometry.html"></a> <ide>\ No newline at end of file <add><a href="threejs-geometry.html"></a> <add><a href="Geometry"></a> <ide>\ No newline at end of file
1
Python
Python
add additional test case
0aed5581837254ce96e14c1964c93002e17503da
<ide><path>libcloud/test/compute/test_digitalocean_v2.py <ide> def test_list_sizes_filter_by_location_success(self): <ide> self.assertEqual(size.name, '512mb') <ide> self.assertTrue(location.id in size.extra['regions']) <ide> <add> location = self.driver.list_locations()[1] <add> location.id = 'doesntexist' <add> sizes = self.driver.list_sizes(location=location) <add> self.assertEqual(len(sizes), 0) <add> <ide> def test_list_locations_success(self): <ide> locations = self.driver.list_locations() <ide> self.assertTrue(len(locations) == 2)
1
Ruby
Ruby
fix bad nodocs
9811c3624a3f5881069093ee55d53be2457d4c03
<ide><path>activeresource/lib/active_resource/exceptions.rb <ide> def to_s; @message ;end <ide> <ide> # 3xx Redirection <ide> class Redirection < ConnectionError # :nodoc: <del> def to_s; response['Location'] ? "#{super} => #{response['Location']}" : super; end <add> def to_s <add> response['Location'] ? "#{super} => #{response['Location']}" : super <add> end <ide> end <ide> <del> # Raised when ... <del> class MissingPrefixParam < ArgumentError; end # :nodoc: <add> class MissingPrefixParam < ArgumentError # :nodoc: <add> end <ide> <ide> # 4xx Client Error <del> class ClientError < ConnectionError; end # :nodoc: <add> class ClientError < ConnectionError # :nodoc: <add> end <ide> <ide> # 400 Bad Request <del> class BadRequest < ClientError; end # :nodoc <add> class BadRequest < ClientError # :nodoc: <add> end <ide> <ide> # 401 Unauthorized <del> class UnauthorizedAccess < ClientError; end # :nodoc <add> class UnauthorizedAccess < ClientError # :nodoc: <add> end <ide> <ide> # 403 Forbidden <del> class ForbiddenAccess < ClientError; end # :nodoc <add> class ForbiddenAccess < ClientError # :nodoc: <add> end <ide> <ide> # 404 Not Found <del> class ResourceNotFound < ClientError; end # :nodoc: <add> class ResourceNotFound < ClientError # :nodoc: <add> end <ide> <ide> # 409 Conflict <del> class ResourceConflict < ClientError; end # :nodoc: <add> class ResourceConflict < ClientError # :nodoc: <add> end <ide> <ide> # 410 Gone <del> class ResourceGone < ClientError; end # :nodoc: <add> class ResourceGone < ClientError # :nodoc: <add> end <ide> <ide> # 5xx Server Error <del> class ServerError < ConnectionError; end # :nodoc: <add> class ServerError < ConnectionError # :nodoc: <add> end <ide> <ide> # 405 Method Not Allowed <ide> class MethodNotAllowed < ClientError # :nodoc:
1
Text
Text
add changelogs for fs
d2e4742a8d15c6bb9e18cddfff56bb9d9b8e99f8
<ide><path>doc/api/fs.md <ide> checks fail, and does nothing otherwise. <ide> ## fs.appendFile(file, data[, options], callback) <ide> <!-- YAML <ide> added: v0.6.7 <add>changes: <add> - version: v7.0.0 <add> pr-url: https://github.com/nodejs/node/pull/7897 <add> description: The `callback` parameter is no longer optional. Not passing <add> it will emit a deprecation warning. <add> - version: v7.0.0 <add> pr-url: https://github.com/nodejs/node/pull/7831 <add> description: The passed `options` object will never be modified. <add> - version: v5.0.0 <add> pr-url: https://github.com/nodejs/node/pull/3163 <add> description: The `file` parameter can be a file descriptor now. <ide> --> <ide> <ide> * `file` {String | Buffer | Number} filename or file descriptor <ide> automatically._ <ide> ## fs.appendFileSync(file, data[, options]) <ide> <!-- YAML <ide> added: v0.6.7 <add>changes: <add> - version: v7.0.0 <add> pr-url: https://github.com/nodejs/node/pull/7831 <add> description: The passed `options` object will never be modified. <add> - version: v5.0.0 <add> pr-url: https://github.com/nodejs/node/pull/3163 <add> description: The `file` parameter can be a file descriptor now. <ide> --> <ide> <ide> * `file` {String | Buffer | Number} filename or file descriptor <ide> The synchronous version of [`fs.appendFile()`][]. Returns `undefined`. <ide> ## fs.chmod(path, mode, callback) <ide> <!-- YAML <ide> added: v0.1.30 <add>changes: <add> - version: v7.0.0 <add> pr-url: https://github.com/nodejs/node/pull/7897 <add> description: The `callback` parameter is no longer optional. Not passing <add> it will emit a deprecation warning. <ide> --> <ide> <ide> * `path` {String | Buffer} <ide> Synchronous chmod(2). Returns `undefined`. <ide> ## fs.chown(path, uid, gid, callback) <ide> <!-- YAML <ide> added: v0.1.97 <add>changes: <add> - version: v7.0.0 <add> pr-url: https://github.com/nodejs/node/pull/7897 <add> description: The `callback` parameter is no longer optional. Not passing <add> it will emit a deprecation warning. <ide> --> <ide> <ide> * `path` {String | Buffer} <ide> Synchronous chown(2). Returns `undefined`. <ide> ## fs.close(fd, callback) <ide> <!-- YAML <ide> added: v0.0.2 <add>changes: <add> - version: v7.0.0 <add> pr-url: https://github.com/nodejs/node/pull/7897 <add> description: The `callback` parameter is no longer optional. Not passing <add> it will emit a deprecation warning. <ide> --> <ide> <ide> * `fd` {Integer} <ide> operations. The specific constants currently defined are described in <ide> ## fs.createReadStream(path[, options]) <ide> <!-- YAML <ide> added: v0.1.31 <add>changes: <add> - version: v7.0.0 <add> pr-url: https://github.com/nodejs/node/pull/7831 <add> description: The passed `options` object will never be modified. <add> - version: v2.3.0 <add> pr-url: https://github.com/nodejs/node/pull/1845 <add> description: The passed `options` object can be a string now. <ide> --> <ide> <ide> * `path` {String | Buffer} <ide> If `options` is a string, then it specifies the encoding. <ide> ## fs.createWriteStream(path[, options]) <ide> <!-- YAML <ide> added: v0.1.31 <add>changes: <add> - version: v7.0.0 <add> pr-url: https://github.com/nodejs/node/pull/7831 <add> description: The passed `options` object will never be modified. <add> - version: v5.5.0 <add> pr-url: https://github.com/nodejs/node/pull/3679 <add> description: The `autoClose` option is supported now. <add> - version: v2.3.0 <add> pr-url: https://github.com/nodejs/node/pull/1845 <add> description: The passed `options` object can be a string now. <ide> --> <ide> <ide> * `path` {String | Buffer} <ide> a callback.) <ide> ## fs.fchmod(fd, mode, callback) <ide> <!-- YAML <ide> added: v0.4.7 <add>changes: <add> - version: v7.0.0 <add> pr-url: https://github.com/nodejs/node/pull/7897 <add> description: The `callback` parameter is no longer optional. Not passing <add> it will emit a deprecation warning. <ide> --> <ide> <ide> * `fd` {Integer} <ide> Synchronous fchmod(2). Returns `undefined`. <ide> ## fs.fchown(fd, uid, gid, callback) <ide> <!-- YAML <ide> added: v0.4.7 <add>changes: <add> - version: v7.0.0 <add> pr-url: https://github.com/nodejs/node/pull/7897 <add> description: The `callback` parameter is no longer optional. Not passing <add> it will emit a deprecation warning. <ide> --> <ide> <ide> * `fd` {Integer} <ide> Synchronous fchown(2). Returns `undefined`. <ide> ## fs.fdatasync(fd, callback) <ide> <!-- YAML <ide> added: v0.1.96 <add>changes: <add> - version: v7.0.0 <add> pr-url: https://github.com/nodejs/node/pull/7897 <add> description: The `callback` parameter is no longer optional. Not passing <add> it will emit a deprecation warning. <ide> --> <ide> <ide> * `fd` {Integer} <ide> Synchronous fdatasync(2). Returns `undefined`. <ide> ## fs.fstat(fd, callback) <ide> <!-- YAML <ide> added: v0.1.95 <add>changes: <add> - version: v7.0.0 <add> pr-url: https://github.com/nodejs/node/pull/7897 <add> description: The `callback` parameter is no longer optional. Not passing <add> it will emit a deprecation warning. <ide> --> <ide> <ide> * `fd` {Integer} <ide> Synchronous fstat(2). Returns an instance of [`fs.Stats`][]. <ide> ## fs.fsync(fd, callback) <ide> <!-- YAML <ide> added: v0.1.96 <add>changes: <add> - version: v7.0.0 <add> pr-url: https://github.com/nodejs/node/pull/7897 <add> description: The `callback` parameter is no longer optional. Not passing <add> it will emit a deprecation warning. <ide> --> <ide> <ide> * `fd` {Integer} <ide> Synchronous fsync(2). Returns `undefined`. <ide> ## fs.ftruncate(fd, len, callback) <ide> <!-- YAML <ide> added: v0.8.6 <add>changes: <add> - version: v7.0.0 <add> pr-url: https://github.com/nodejs/node/pull/7897 <add> description: The `callback` parameter is no longer optional. Not passing <add> it will emit a deprecation warning. <ide> --> <ide> <ide> * `fd` {Integer} <ide> Synchronous ftruncate(2). Returns `undefined`. <ide> ## fs.futimes(fd, atime, mtime, callback) <ide> <!-- YAML <ide> added: v0.4.2 <add>changes: <add> - version: v7.0.0 <add> pr-url: https://github.com/nodejs/node/pull/7897 <add> description: The `callback` parameter is no longer optional. Not passing <add> it will emit a deprecation warning. <add> - version: v4.1.0 <add> pr-url: https://github.com/nodejs/node/pull/2387 <add> description: Numeric strings, `NaN` and `Infinity` are now allowed <add> time specifiers. <ide> --> <ide> <ide> * `fd` {Integer} <ide> descriptor. <ide> ## fs.futimesSync(fd, atime, mtime) <ide> <!-- YAML <ide> added: v0.4.2 <add>changes: <add> - version: v4.1.0 <add> pr-url: https://github.com/nodejs/node/pull/2387 <add> description: Numeric strings, `NaN` and `Infinity` are now allowed <add> time specifiers. <ide> --> <ide> <ide> * `fd` {Integer} <ide> Synchronous version of [`fs.futimes()`][]. Returns `undefined`. <ide> ## fs.lchmod(path, mode, callback) <ide> <!-- YAML <ide> deprecated: v0.4.7 <add>changes: <add> - version: v7.0.0 <add> pr-url: https://github.com/nodejs/node/pull/7897 <add> description: The `callback` parameter is no longer optional. Not passing <add> it will emit a deprecation warning. <ide> --> <ide> <ide> * `path` {String | Buffer} <ide> Synchronous lchmod(2). Returns `undefined`. <ide> ## fs.lchown(path, uid, gid, callback) <ide> <!-- YAML <ide> deprecated: v0.4.7 <add>changes: <add> - version: v7.0.0 <add> pr-url: https://github.com/nodejs/node/pull/7897 <add> description: The `callback` parameter is no longer optional. Not passing <add> it will emit a deprecation warning. <ide> --> <ide> <ide> * `path` {String | Buffer} <ide> Synchronous lchown(2). Returns `undefined`. <ide> ## fs.link(existingPath, newPath, callback) <ide> <!-- YAML <ide> added: v0.1.31 <add>changes: <add> - version: v7.0.0 <add> pr-url: https://github.com/nodejs/node/pull/7897 <add> description: The `callback` parameter is no longer optional. Not passing <add> it will emit a deprecation warning. <ide> --> <ide> <ide> * `existingPath` {String | Buffer} <ide> Synchronous link(2). Returns `undefined`. <ide> ## fs.lstat(path, callback) <ide> <!-- YAML <ide> added: v0.1.30 <add>changes: <add> - version: v7.0.0 <add> pr-url: https://github.com/nodejs/node/pull/7897 <add> description: The `callback` parameter is no longer optional. Not passing <add> it will emit a deprecation warning. <ide> --> <ide> <ide> * `path` {String | Buffer} <ide> Synchronous lstat(2). Returns an instance of [`fs.Stats`][]. <ide> ## fs.mkdir(path[, mode], callback) <ide> <!-- YAML <ide> added: v0.1.8 <add>changes: <add> - version: v7.0.0 <add> pr-url: https://github.com/nodejs/node/pull/7897 <add> description: The `callback` parameter is no longer optional. Not passing <add> it will emit a deprecation warning. <ide> --> <ide> <ide> * `path` {String | Buffer} <ide> Synchronous mkdir(2). Returns `undefined`. <ide> ## fs.mkdtemp(prefix[, options], callback) <ide> <!-- YAML <ide> added: v5.10.0 <add>changes: <add> - version: v7.0.0 <add> pr-url: https://github.com/nodejs/node/pull/7897 <add> description: The `callback` parameter is no longer optional. Not passing <add> it will emit a deprecation warning. <add> - version: v6.2.1 <add> pr-url: https://github.com/nodejs/node/pull/6828 <add> description: The `callback` parameter is optional now. <ide> --> <ide> <ide> * `prefix` {String} <ide> descriptor. <ide> ## fs.read(fd, buffer, offset, length, position, callback) <ide> <!-- YAML <ide> added: v0.0.2 <add>changes: <add> - version: v7.4.0 <add> pr-url: https://github.com/nodejs/node/pull/10382 <add> description: The `buffer` parameter can now be a `Uint8Array`. <add> - version: v6.0.0 <add> pr-url: https://github.com/nodejs/node/pull/4518 <add> description: The `length` parameter can now be `0`. <ide> --> <ide> <ide> * `fd` {Integer} <ide> The callback is given the three arguments, `(err, bytesRead, buffer)`. <ide> ## fs.readdir(path[, options], callback) <ide> <!-- YAML <ide> added: v0.1.8 <add>changes: <add> - version: v7.0.0 <add> pr-url: https://github.com/nodejs/node/pull/7897 <add> description: The `callback` parameter is no longer optional. Not passing <add> it will emit a deprecation warning. <ide> --> <ide> <ide> * `path` {String | Buffer} <ide> the filenames returned will be passed as `Buffer` objects. <ide> ## fs.readFile(file[, options], callback) <ide> <!-- YAML <ide> added: v0.1.29 <add>changes: <add> - version: v7.0.0 <add> pr-url: https://github.com/nodejs/node/pull/7897 <add> description: The `callback` parameter is no longer optional. Not passing <add> it will emit a deprecation warning. <add> - version: v5.1.0 <add> pr-url: https://github.com/nodejs/node/pull/3740 <add> description: The `callback` will always be called with `null` as the `error` <add> parameter in case of success. <add> - version: v5.0.0 <add> pr-url: https://github.com/nodejs/node/pull/3163 <add> description: The `file` parameter can be a file descriptor now. <ide> --> <ide> <ide> * `file` {String | Buffer | Integer} filename or file descriptor <ide> automatically._ <ide> ## fs.readFileSync(file[, options]) <ide> <!-- YAML <ide> added: v0.1.8 <add>changes: <add> - version: v5.0.0 <add> pr-url: https://github.com/nodejs/node/pull/3163 <add> description: The `file` parameter can be a file descriptor now. <ide> --> <ide> <ide> * `file` {String | Buffer | Integer} filename or file descriptor <ide> string. Otherwise it returns a buffer. <ide> ## fs.readlink(path[, options], callback) <ide> <!-- YAML <ide> added: v0.1.31 <add>changes: <add> - version: v7.0.0 <add> pr-url: https://github.com/nodejs/node/pull/7897 <add> description: The `callback` parameter is no longer optional. Not passing <add> it will emit a deprecation warning. <ide> --> <ide> <ide> * `path` {String | Buffer} <ide> the link path returned will be passed as a `Buffer` object. <ide> ## fs.readSync(fd, buffer, offset, length, position) <ide> <!-- YAML <ide> added: v0.1.21 <add>changes: <add> - version: v6.0.0 <add> pr-url: https://github.com/nodejs/node/pull/4518 <add> description: The `length` parameter can now be `0`. <ide> --> <ide> <ide> * `fd` {Integer} <ide> Synchronous version of [`fs.read()`][]. Returns the number of `bytesRead`. <ide> ## fs.realpath(path[, options], callback) <ide> <!-- YAML <ide> added: v0.1.31 <add>changes: <add> - version: v7.0.0 <add> pr-url: https://github.com/nodejs/node/pull/7897 <add> description: The `callback` parameter is no longer optional. Not passing <add> it will emit a deprecation warning. <add> - version: v6.4.0 <add> pr-url: https://github.com/nodejs/node/pull/7899 <add> description: Calling `realpath` now works again for various edge cases <add> on Windows. <add> - version: v6.0.0 <add> pr-url: https://github.com/nodejs/node/pull/3594 <add> description: The `cache` parameter was removed. <ide> --> <ide> <ide> * `path` {String | Buffer} <ide> the path returned will be passed as a `Buffer` object. <ide> ## fs.realpathSync(path[, options]) <ide> <!-- YAML <ide> added: v0.1.31 <add>changes: <add> - version: v6.4.0 <add> pr-url: https://github.com/nodejs/node/pull/7899 <add> description: Calling `realpathSync` now works again for various edge cases <add> on Windows. <add> - version: v6.0.0 <add> pr-url: https://github.com/nodejs/node/pull/3594 <add> description: The `cache` parameter was removed. <ide> --> <ide> <ide> * `path` {String | Buffer}; <ide> will be passed as a `Buffer` object. <ide> ## fs.rename(oldPath, newPath, callback) <ide> <!-- YAML <ide> added: v0.0.2 <add>changes: <add> - version: v7.0.0 <add> pr-url: https://github.com/nodejs/node/pull/7897 <add> description: The `callback` parameter is no longer optional. Not passing <add> it will emit a deprecation warning. <ide> --> <ide> <ide> * `oldPath` {String | Buffer} <ide> Synchronous rename(2). Returns `undefined`. <ide> ## fs.rmdir(path, callback) <ide> <!-- YAML <ide> added: v0.0.2 <add>changes: <add> - version: v7.0.0 <add> pr-url: https://github.com/nodejs/node/pull/7897 <add> description: The `callback` parameter is no longer optional. Not passing <add> it will emit a deprecation warning. <ide> --> <ide> <ide> * `path` {String | Buffer} <ide> Synchronous rmdir(2). Returns `undefined`. <ide> ## fs.stat(path, callback) <ide> <!-- YAML <ide> added: v0.0.2 <add>changes: <add> - version: v7.0.0 <add> pr-url: https://github.com/nodejs/node/pull/7897 <add> description: The `callback` parameter is no longer optional. Not passing <add> it will emit a deprecation warning. <ide> --> <ide> <ide> * `path` {String | Buffer} <ide> Synchronous symlink(2). Returns `undefined`. <ide> ## fs.truncate(path, len, callback) <ide> <!-- YAML <ide> added: v0.8.6 <add>changes: <add> - version: v7.0.0 <add> pr-url: https://github.com/nodejs/node/pull/7897 <add> description: The `callback` parameter is no longer optional. Not passing <add> it will emit a deprecation warning. <ide> --> <ide> <ide> * `path` {String | Buffer} <ide> passed as the first argument. In this case, `fs.ftruncateSync()` is called. <ide> ## fs.unlink(path, callback) <ide> <!-- YAML <ide> added: v0.0.2 <add>changes: <add> - version: v7.0.0 <add> pr-url: https://github.com/nodejs/node/pull/7897 <add> description: The `callback` parameter is no longer optional. Not passing <add> it will emit a deprecation warning. <ide> --> <ide> <ide> * `path` {String | Buffer} <ide> when possible._ <ide> ## fs.utimes(path, atime, mtime, callback) <ide> <!-- YAML <ide> added: v0.4.2 <add>changes: <add> - version: v7.0.0 <add> pr-url: https://github.com/nodejs/node/pull/7897 <add> description: The `callback` parameter is no longer optional. Not passing <add> it will emit a deprecation warning. <add> - version: v4.1.0 <add> pr-url: https://github.com/nodejs/node/pull/2387 <add> description: Numeric strings, `NaN` and `Infinity` are now allowed <add> time specifiers. <ide> --> <ide> <ide> * `path` {String | Buffer} <ide> follow these rules: <ide> ## fs.utimesSync(path, atime, mtime) <ide> <!-- YAML <ide> added: v0.4.2 <add>changes: <add> - version: v4.1.0 <add> pr-url: https://github.com/nodejs/node/pull/2387 <add> description: Numeric strings, `NaN` and `Infinity` are now allowed <add> time specifiers. <ide> --> <ide> <ide> * `path` {String | Buffer} <ide> Synchronous version of [`fs.utimes()`][]. Returns `undefined`. <ide> ## fs.watch(filename[, options][, listener]) <ide> <!-- YAML <ide> added: v0.5.10 <add>changes: <add> - version: v7.0.0 <add> pr-url: https://github.com/nodejs/node/pull/7831 <add> description: The passed `options` object will never be modified. <ide> --> <ide> <ide> * `filename` {String | Buffer} <ide> _Note: [`fs.watch()`][] is more efficient than `fs.watchFile` and <ide> ## fs.write(fd, buffer[, offset[, length[, position]]], callback) <ide> <!-- YAML <ide> added: v0.0.2 <add>changes: <add> - version: v7.4.0 <add> pr-url: https://github.com/nodejs/node/pull/10382 <add> description: The `buffer` parameter can now be a `Uint8Array`. <add> - version: v7.2.0 <add> pr-url: https://github.com/nodejs/node/pull/7856 <add> description: The `offset` and `length` parameters are optional now. <add> - version: v7.0.0 <add> pr-url: https://github.com/nodejs/node/pull/7897 <add> description: The `callback` parameter is no longer optional. Not passing <add> it will emit a deprecation warning. <ide> --> <ide> <ide> * `fd` {Integer} <ide> the end of the file. <ide> ## fs.write(fd, string[, position[, encoding]], callback) <ide> <!-- YAML <ide> added: v0.11.5 <add>changes: <add> - version: v7.2.0 <add> pr-url: https://github.com/nodejs/node/pull/7856 <add> description: The `position` parameter is optional now. <add> - version: v7.0.0 <add> pr-url: https://github.com/nodejs/node/pull/7897 <add> description: The `callback` parameter is no longer optional. Not passing <add> it will emit a deprecation warning. <ide> --> <ide> <ide> * `fd` {Integer} <ide> the end of the file. <ide> ## fs.writeFile(file, data[, options], callback) <ide> <!-- YAML <ide> added: v0.1.29 <add>changes: <add> - version: v7.4.0 <add> pr-url: https://github.com/nodejs/node/pull/10382 <add> description: The `data` parameter can now be a `Uint8Array`. <add> - version: v7.0.0 <add> pr-url: https://github.com/nodejs/node/pull/7897 <add> description: The `callback` parameter is no longer optional. Not passing <add> it will emit a deprecation warning. <add> - version: v5.0.0 <add> pr-url: https://github.com/nodejs/node/pull/3163 <add> description: The `file` parameter can be a file descriptor now. <ide> --> <ide> <ide> * `file` {String | Buffer | Integer} filename or file descriptor <ide> automatically._ <ide> ## fs.writeFileSync(file, data[, options]) <ide> <!-- YAML <ide> added: v0.1.29 <add>changes: <add> - version: v7.4.0 <add> pr-url: https://github.com/nodejs/node/pull/10382 <add> description: The `data` parameter can now be a `Uint8Array`. <add> - version: v5.0.0 <add> pr-url: https://github.com/nodejs/node/pull/3163 <add> description: The `file` parameter can be a file descriptor now. <ide> --> <ide> <ide> * `file` {String | Buffer | Integer} filename or file descriptor <ide> The synchronous version of [`fs.writeFile()`][]. Returns `undefined`. <ide> ## fs.writeSync(fd, buffer[, offset[, length[, position]]]) <ide> <!-- YAML <ide> added: v0.1.21 <add>changes: <add> - version: v7.4.0 <add> pr-url: https://github.com/nodejs/node/pull/10382 <add> description: The `buffer` parameter can now be a `Uint8Array`. <add> - version: v7.2.0 <add> pr-url: https://github.com/nodejs/node/pull/7856 <add> description: The `offset` and `length` parameters are optional now. <ide> --> <ide> <ide> * `fd` {Integer} <ide> added: v0.1.21 <ide> ## fs.writeSync(fd, string[, position[, encoding]]) <ide> <!-- YAML <ide> added: v0.11.5 <add>changes: <add> - version: v7.2.0 <add> pr-url: https://github.com/nodejs/node/pull/7856 <add> description: The `position` parameter is optional now. <ide> --> <ide> <ide> * `fd` {Integer} <ide> The following constants are meant for use with the [`fs.Stats`][] object's <ide> [`ReadDirectoryChangesW`]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365465%28v=vs.85%29.aspx <ide> [`AHAFS`]: https://www.ibm.com/developerworks/aix/library/au-aix_event_infrastructure/ <ide> [Common System Errors]: errors.html#errors_common_system_errors <add>[`Uint8Array`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array
1
PHP
PHP
add tests for exceptiontrap
8c90e4f55d3db2a23b334b1f2baf45123ed10f98
<ide><path>src/Error/ExceptionRenderer.php <ide> use Cake\Http\Exception\HttpException; <ide> use Cake\Http\Exception\MissingControllerException; <ide> use Cake\Http\Response; <add>use Cake\Http\ResponseEmitter; <ide> use Cake\Http\ServerRequest; <ide> use Cake\Http\ServerRequestFactory; <ide> use Cake\Routing\Exception\MissingRouteException; <ide> public function render(): ResponseInterface <ide> return $this->_outputMessage($template); <ide> } <ide> <add> /** <add> * Emit the response content <add> * <add> * @param \Psr\Http\Message\ResponseInterface|string $output The response to output. <add> * @return void <add> */ <add> public function write($output): void <add> { <add> if (is_string($output)) { <add> echo $output; <add> <add> return; <add> } <add> <add> $emitter = new ResponseEmitter(); <add> $emitter->emit($output); <add> } <add> <ide> /** <ide> * Render a custom error method/template. <ide> * <ide><path>src/Error/ExceptionRendererInterface.php <ide> <ide> /** <ide> * Interface ExceptionRendererInterface <add> * <add> * @method render(): ResponseInterface|string Render the exception to a string or Http Response. <add> * @method write(\Psr\Http\Message\ResponseInterface|string $output): void Write the output to the output stream. <ide> */ <ide> interface ExceptionRendererInterface <ide> { <ide> /** <ide> * Renders the response for the exception. <ide> * <del> * @return \Cake\Http\Response The response to be sent. <add> * @return \Psr\Http\Message\ResponseInterface The response to be sent. <ide> */ <ide> public function render(): ResponseInterface; <ide> } <ide><path>src/Error/ExceptionTrap.php <ide> namespace Cake\Error; <ide> <ide> use Cake\Core\InstanceConfigTrait; <del>use Cake\Http\ResponseEmitter; <ide> use Cake\Http\ServerRequest; <ide> use Cake\Routing\Router; <ide> use Closure; <ide> use InvalidArgumentException; <del>use Psr\Http\Message\ResponseInterface; <ide> use Throwable; <ide> <ide> /** <ide> class ExceptionTrap <ide> */ <ide> protected $_defaultConfig = [ <ide> 'exceptionRenderer' => ExceptionRenderer::class, <add> 'logger' => ErrorLogger::class, <ide> // Used by ConsoleExceptionRenderer (coming soon) <ide> 'stderr' => null, <del> 'logger' => ErrorLogger::class, <ide> 'log' => true, <ide> 'trace' => false, <ide> ]; <ide> public function __construct(array $options = []) <ide> * @param \Throwable $exception Exception to render <ide> * @return \Cake\Error\ExceptionRendererInterface <ide> */ <del> public function renderer(Throwable $exception): ExceptionRendererInterface <add> public function renderer(Throwable $exception) <ide> { <add> // The return of this method is not defined because <add> // the desired interface has bad types that will be changing in 5.x <ide> $request = Router::getRequest(); <ide> $class = $this->_getConfig('exceptionRenderer'); <ide> <ide> if (is_string($class)) { <del> if (!in_array(ExceptionRendererInterface::class, class_implements($class))) { <add> if (!(method_exists($class, 'render') && method_exists($class, 'write'))) { <ide> throw new InvalidArgumentException( <ide> "Cannot use {$class} as an `exceptionRenderer`. " . <del> 'It must implement ' . ExceptionRendererInterface::class <add> 'It must implement render() and write() methods.' <ide> ); <ide> } <ide> <ide> public function handleException(Throwable $exception): void <ide> } <ide> <ide> try { <del> $response = $this->renderException($exception, $request); <del> $this->sendResponse($response); <add> $renderer = $this->renderer($exception); <add> $renderer->write($renderer->render()); <ide> } catch (Throwable $exception) { <ide> $this->logInternalError($exception); <ide> } <ide> } <ide> <del> <del> /** <del> * Render an exception <del> * <del> * @param \Throwable $exception Exception instance. <del> * @return \Psr\Http\Message\ResponseInterface|string An HTTP response or a string. <del> */ <del> public function renderException(Throwable $exception) <del> { <del> $renderer = $this->renderer($exception); <del> <del> return $renderer->render(); <del> } <del> <ide> /** <ide> * Log an exception. <ide> * <ide> public function logException(Throwable $exception, ?ServerRequest $request = nul <ide> $logger->log($exception, $request); <ide> } <ide> <del> /** <del> * Method that can be easily stubbed in testing. <del> * <del> * @param \Cake\Http\Response|string $response Either the message or response object. <del> * @return void <del> */ <del> protected function sendResponse($response) <del> { <del> if (is_string($response)) { <del> echo $response; <del> <del> return; <del> } <del> <del> $emitter = new ResponseEmitter(); <del> $emitter->emit($response); <del> } <del> <ide> /** <ide> * Trigger an error that occurred during rendering an exception. <ide> * <ide><path>src/Error/Renderer/TextExceptionRenderer.php <add><?php <add>declare(strict_types=1); <add> <add>/** <add> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <add> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <add> * <add> * Licensed under The MIT License <add> * For full copyright and license information, please see the LICENSE.txt <add> * Redistributions of files must retain the above copyright notice. <add> * <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <add> * @link https://cakephp.org CakePHP(tm) Project <add> * @since 4.4.0 <add> * @license https://opensource.org/licenses/mit-license.php MIT License <add> */ <add>namespace Cake\Error\Renderer; <add> <add>use Throwable; <add> <add>/** <add> * Plain text exception rendering with a stack trace. <add> * <add> * Useful in CI or plain text environments. <add> * <add> * @todo 5.0 Implement \Cake\Error\ErrorRendererInterface. This implementation can't implement <add> * the concrete interface because the return types are not compatible. <add> */ <add>class TextExceptionRenderer <add>{ <add> /** <add> * @var \Throwable <add> */ <add> private $error; <add> <add> /** <add> * Constructor. <add> * <add> * @param \Throwable $error The error to render. <add> */ <add> public function __construct(Throwable $error) <add> { <add> $this->error = $error; <add> } <add> <add> /** <add> * @inheritDoc <add> */ <add> public function render() <add> { <add> return sprintf( <add> "%s : %s on line %s of %s\nTrace:\n%s", <add> $this->error->getCode(), <add> $this->error->getMessage(), <add> $this->error->getLine() ?? '', <add> $this->error->getFile() ?? '', <add> $this->error->getTraceAsString(), <add> ); <add> } <add> <add> /** <add> * Write output to stdout. <add> * <add> * @param string $output The output to print. <add> * @return void <add> */ <add> public function write($output): void <add> { <add> echo $output; <add> } <add>} <ide><path>tests/TestCase/Error/ExceptionTrapTest.php <add><?php <add>declare(strict_types=1); <add> <add>/** <add> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <add> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <add> * <add> * Licensed under The MIT License <add> * For full copyright and license information, please see the LICENSE.txt <add> * Redistributions of files must retain the above copyright notice. <add> * <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <add> * @link https://cakephp.org CakePHP Project <add> * @since 4.4.0 <add> * @license https://opensource.org/licenses/mit-license.php MIT License <add> */ <add>namespace Cake\Test\TestCase\Error; <add> <add>use Cake\Core\Configure; <add>use Cake\Error\ErrorLogger; <add>use Cake\Error\ExceptionTrap; <add>use Cake\Error\PhpError; <add>use Cake\Error\ExceptionRenderer; <add>use Cake\Error\ExceptionRendererInterface; <add>use Cake\Error\Renderer\TextExceptionRenderer; <add>use Cake\Log\Log; <add>use Cake\TestSuite\TestCase; <add>use InvalidArgumentException; <add>use stdClass; <add>use Throwable; <add> <add>class ExceptionTrapTest extends TestCase <add>{ <add> public function setUp(): void <add> { <add> parent::setUp(); <add> <add> Log::drop('test_error'); <add> } <add> <add> public function testConfigRendererInvalid() <add> { <add> $trap = new ExceptionTrap(['exceptionRenderer' => stdClass::class]); <add> $this->expectException(InvalidArgumentException::class); <add> $error = new InvalidArgumentException('nope'); <add> $trap->renderer($error); <add> } <add> <add> public function testConfigExceptionRendererFallback() <add> { <add> $this->markTestIncomplete(); <add> $trap = new ExceptionTrap(['exceptionRenderer' => null]); <add> $error = new InvalidArgumentException('nope'); <add> $this->assertInstanceOf(ConsoleRenderer::class, $trap->renderer($error)); <add> } <add> <add> public function testConfigExceptionRenderer() <add> { <add> $trap = new ExceptionTrap(['exceptionRenderer' => ExceptionRenderer::class]); <add> $error = new InvalidArgumentException('nope'); <add> $this->assertInstanceOf(ExceptionRenderer::class, $trap->renderer($error)); <add> } <add> <add> public function testConfigRendererHandleUnsafeOverwrite() <add> { <add> $this->markTestIncomplete(); <add> $trap = new ExceptionTrap(); <add> $trap->setConfig('exceptionRenderer', null); <add> $error = new InvalidArgumentException('nope'); <add> $this->assertInstanceOf(ConsoleRenderer::class, $trap->renderer($error)); <add> } <add> <add> public function testLoggerConfigInvalid() <add> { <add> $trap = new ExceptionTrap(['logger' => stdClass::class]); <add> $this->expectException(InvalidArgumentException::class); <add> $trap->logger(); <add> } <add> <add> public function testLoggerConfig() <add> { <add> $trap = new ExceptionTrap(['logger' => ErrorLogger::class]); <add> $this->assertInstanceOf(ErrorLogger::class, $trap->logger()); <add> } <add> <add> public function testLoggerHandleUnsafeOverwrite() <add> { <add> $trap = new ExceptionTrap(); <add> $trap->setConfig('logger', null); <add> $this->assertInstanceOf(ErrorLogger::class, $trap->logger()); <add> } <add> <add> public function testRenderExceptionText() <add> { <add> $trap = new ExceptionTrap([ <add> 'exceptionRenderer' => TextExceptionRenderer::class, <add> ]); <add> $error = new InvalidArgumentException('nope'); <add> <add> ob_start(); <add> $trap->handleException($error); <add> $out = ob_get_clean(); <add> <add> $this->assertStringContainsString('nope', $out); <add> $this->assertStringContainsString('ExceptionTrapTest', $out); <add> } <add> <add> public function testLogException() <add> { <add> Log::setConfig('test_error', [ <add> 'className' => 'Array', <add> ]); <add> $trap = new ExceptionTrap(); <add> $error = new InvalidArgumentException('nope'); <add> $trap->logException($error); <add> <add> $logs = Log::engine('test_error')->read(); <add> $this->assertStringContainsString('nope', $logs[0]); <add> } <add> <add> public function testAddCallback() <add> { <add> $trap = new ExceptionTrap(['exceptionRenderer' => TextExceptionRenderer::class]); <add> $trap->addCallback(function (Throwable $error) { <add> $this->assertEquals(100, $error->getCode()); <add> $this->assertStringContainsString('nope', $error->getMessage()); <add> }); <add> $error = new InvalidArgumentException('nope', 100); <add> <add> ob_start(); <add> $trap->handleException($error); <add> $out = ob_get_clean(); <add> <add> $this->assertNotEmpty($out); <add> } <add>}
5
Java
Java
add option to extend exception resolvers
d53c04b4dfb08f8ac63d1c479f52a80f20942e0a
<ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport.java <ide> protected final List<HttpMessageConverter<?>> getMessageConverters() { <ide> protected void configureMessageConverters(List<HttpMessageConverter<?>> converters) { <ide> } <ide> <add> /** <add> * Override this method to extend or modify the list of converters after it <add> * has been configured. This may be useful for example to allow default <add> * converters to be registered and then insert a custom converter through <add> * this method. <add> * @param converters the list of configured converters to extend. <add> * @since 4.1.3 <add> */ <ide> protected void extendMessageConverters(List<HttpMessageConverter<?>> converters) { <ide> } <ide> <ide> public HandlerExceptionResolver handlerExceptionResolver() { <ide> addDefaultHandlerExceptionResolvers(exceptionResolvers); <ide> } <ide> <add> extendHandlerExceptionResolvers(exceptionResolvers); <ide> HandlerExceptionResolverComposite composite = new HandlerExceptionResolverComposite(); <ide> composite.setOrder(0); <ide> composite.setExceptionResolvers(exceptionResolvers); <ide> public HandlerExceptionResolver handlerExceptionResolver() { <ide> protected void configureHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers) { <ide> } <ide> <add> /** <add> * Override this method to extend or modify the list of <add> * {@link HandlerExceptionResolver}s after it has been configured. This may <add> * be useful for example to allow default resolvers to be registered and then <add> * insert a custom one through this method. <add> * @param exceptionResolvers the list of configured resolvers to extend. <add> * @since 4.3.1 <add> */ <add> protected void extendHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers) { <add> } <add> <ide> /** <ide> * A method available to subclasses for adding default {@link HandlerExceptionResolver}s. <ide> * <p>Adds the following exception resolvers: <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurer.java <ide> /* <del> * Copyright 2002-2014 the original author or authors. <add> * Copyright 2002-2016 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 interface WebMvcConfigurer { <ide> */ <ide> void configureHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers); <ide> <add> /** <add> * A hook for extending or modifying the list of <add> * {@link HandlerExceptionResolver}s after it has been configured. This may <add> * be useful for example to allow default resolvers to be registered and then <add> * insert a custom one through this method. <add> * @param exceptionResolvers the list of configured resolvers to extend. <add> * @since 4.3.1 <add> */ <add> void extendHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers); <add> <ide> /** <ide> * Add Spring MVC lifecycle interceptors for pre- and post-processing of <ide> * controller method invocations. Interceptors can be registered to apply <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurerAdapter.java <ide> public void addReturnValueHandlers(List<HandlerMethodReturnValueHandler> returnV <ide> public void configureHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers) { <ide> } <ide> <add> /** <add> * {@inheritDoc} <add> * <p>This implementation is empty. <add> */ <add> @Override <add> public void extendHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers) { <add> } <add> <ide> /** <ide> * {@inheritDoc} <ide> * <p>This implementation is empty. <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurerComposite.java <ide> /* <del> * Copyright 2002-2014 the original author or authors. <add> * Copyright 2002-2016 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 org.springframework.web.servlet.HandlerExceptionResolver; <ide> <ide> /** <del> * An {@link WebMvcConfigurer} implementation that delegates to other {@link WebMvcConfigurer} instances. <add> * A {@link WebMvcConfigurer} that delegates to one or more others. <ide> * <ide> * @author Rossen Stoyanchev <ide> * @since 3.1 <ide> public void configureHandlerExceptionResolvers(List<HandlerExceptionResolver> ex <ide> } <ide> } <ide> <add> @Override <add> public void extendHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers) { <add> for (WebMvcConfigurer delegate : this.delegates) { <add> delegate.configureHandlerExceptionResolvers(exceptionResolvers); <add> } <add> } <add> <ide> @Override <ide> public void addInterceptors(InterceptorRegistry registry) { <ide> for (WebMvcConfigurer delegate : this.delegates) { <ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupportExtensionTests.java <ide> /* <del> * Copyright 2002-2014 the original author or authors. <add> * Copyright 2002-2016 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 org.springframework.web.servlet.handler.HandlerExceptionResolverComposite; <ide> import org.springframework.web.servlet.handler.SimpleMappingExceptionResolver; <ide> import org.springframework.web.servlet.i18n.LocaleChangeInterceptor; <add>import org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver; <ide> import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter; <ide> import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; <ide> import org.springframework.web.servlet.resource.ResourceUrlProviderExposingInterceptor; <ide> public void contentNegotiation() throws Exception { <ide> <ide> @Test <ide> public void exceptionResolvers() throws Exception { <del> HandlerExceptionResolver exceptionResolver = this.config.handlerExceptionResolver(); <del> assertEquals(1, ((HandlerExceptionResolverComposite) exceptionResolver).getExceptionResolvers().size()); <add> List<HandlerExceptionResolver> resolvers = ((HandlerExceptionResolverComposite) <add> this.config.handlerExceptionResolver()).getExceptionResolvers(); <add> <add> assertEquals(2, resolvers.size()); <add> assertEquals(ResponseStatusExceptionResolver.class, resolvers.get(0).getClass()); <add> assertEquals(SimpleMappingExceptionResolver.class, resolvers.get(1).getClass()); <ide> } <ide> <ide> @SuppressWarnings("unchecked") <ide> public void configureHandlerExceptionResolvers(List<HandlerExceptionResolver> ex <ide> exceptionResolvers.add(new SimpleMappingExceptionResolver()); <ide> } <ide> <add> @Override <add> public void extendHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers) { <add> exceptionResolvers.add(0, new ResponseStatusExceptionResolver()); <add> } <add> <ide> @Override <ide> public void configurePathMatch(PathMatchConfigurer configurer) { <ide> configurer.setPathMatcher(new TestPathMatcher());
5
Javascript
Javascript
remove unused catch bindings
fcb8bf1d3525ccde1f6fcbf564649490f6c7c5a1
<ide><path>lib/internal/util/inspector.js <ide> function sendInspectorCommand(cb, onError) { <ide> } finally { <ide> session.disconnect(); <ide> } <del> } catch (e) { <add> } catch { <ide> return onError(); <ide> } <ide> }
1
Javascript
Javascript
use slice(0) to clone arrays
9e57ce0c7af742d15223b9d2aa1f9aed5792d007
<ide><path>src/Angular.js <ide> function copy(source, destination){ <ide> destination = source; <ide> if (source) { <ide> if (isArray(source)) { <del> // http://jsperf.com/copy-array-with-slice-vs-for <del> destination = source.slice(0); <add> destination = copy(source, []); <ide> } else if (isDate(source)) { <ide> destination = new Date(source.getTime()); <ide> } else if (isObject(source)) {
1
Python
Python
fix regression test
b94286de30fdd154cfcd1c88889819c047693f7a
<ide><path>spacy/tests/regression/test_issue595.py <ide> def test_issue595(): <ide> """Test lemmatization of base forms""" <ide> words = ["Do", "n't", "feed", "the", "dog"] <del> tag_map = {'VB': {POS: VERB, 'morph': VerbForm_inf}} <add> tag_map = {'VB': {POS: VERB, VerbForm_inf: True}} <ide> rules = {"verb": [["ed", "e"]]} <ide> <ide> lemmatizer = Lemmatizer({'verb': {}}, {'verb': {}}, rules)
1
Text
Text
fix brackets position
4fade6acb46ccf0a4f3f637586689019818d81ee
<ide><path>doc/api/fs.md <ide> number of bytes read is zero. <ide> If this method is invoked as its [`util.promisify()`][]ed version, it returns <ide> a promise for an `Object` with `bytesRead` and `buffer` properties. <ide> <del>### `fs.read(fd, [options,] callback)` <add>### `fs.read(fd[, options], callback)` <ide> <ide> <!-- YAML <ide> added:
1
PHP
PHP
fix session expiration on several drivers
0831312aec47d904a65039e07574f41ab7492418
<ide><path>src/Illuminate/Session/CookieSessionHandler.php <ide> <ide> namespace Illuminate\Session; <ide> <add>use Carbon\Carbon; <ide> use SessionHandlerInterface; <ide> use Symfony\Component\HttpFoundation\Request; <ide> use Illuminate\Contracts\Cookie\QueueingFactory as CookieJar; <ide> public function close() <ide> */ <ide> public function read($sessionId) <ide> { <del> return $this->request->cookies->get($sessionId) ?: ''; <add> $value = $this->request->cookies->get($sessionId) ?: ''; <add> <add> if (! is_null($decoded = json_decode($value, true)) && is_array($decoded)) { <add> if (isset($decoded['expires']) && time() <= $decoded['expires']) { <add> return $decoded['data']; <add> } <add> } <add> <add> return ''; <ide> } <ide> <ide> /** <ide> * {@inheritdoc} <ide> */ <ide> public function write($sessionId, $data) <ide> { <del> $this->cookie->queue($sessionId, $data, $this->minutes); <add> $this->cookie->queue($sessionId, json_encode([ <add> 'data' => $data, <add> 'expires' => Carbon::now()->addMinutes($this->minutes)->getTimestamp(), <add> ]), $this->minutes); <ide> } <ide> <ide> /** <ide><path>src/Illuminate/Session/DatabaseSessionHandler.php <ide> <ide> namespace Illuminate\Session; <ide> <add>use Carbon\Carbon; <ide> use SessionHandlerInterface; <ide> use Illuminate\Database\ConnectionInterface; <ide> <ide> class DatabaseSessionHandler implements SessionHandlerInterface, ExistenceAwareI <ide> */ <ide> protected $table; <ide> <add> /** <add> * The number of minutes the session should be valid. <add> * <add> * @var int <add> */ <add> protected $minutes; <add> <ide> /** <ide> * The existence state of the session. <ide> * <ide> class DatabaseSessionHandler implements SessionHandlerInterface, ExistenceAwareI <ide> * <ide> * @param \Illuminate\Database\ConnectionInterface $connection <ide> * @param string $table <add> * @param int $minutes <ide> * @return void <ide> */ <del> public function __construct(ConnectionInterface $connection, $table) <add> public function __construct(ConnectionInterface $connection, $table, $minutes) <ide> { <ide> $this->table = $table; <add> $this->minutes = $minutes; <ide> $this->connection = $connection; <ide> } <ide> <ide> public function read($sessionId) <ide> { <ide> $session = (object) $this->getQuery()->find($sessionId); <ide> <add> if (isset($session->last_activity)) { <add> if ($session->last_activity < Carbon::now()->subMinutes($this->minutes)->getTimestamp()) { <add> return; <add> } <add> } <add> <ide> if (isset($session->payload)) { <ide> $this->exists = true; <ide> <ide><path>src/Illuminate/Session/FileSessionHandler.php <ide> <ide> namespace Illuminate\Session; <ide> <add>use Carbon\Carbon; <ide> use SessionHandlerInterface; <ide> use Symfony\Component\Finder\Finder; <ide> use Illuminate\Filesystem\Filesystem; <ide> class FileSessionHandler implements SessionHandlerInterface <ide> */ <ide> protected $path; <ide> <add> /** <add> * The number of minutes the session should be valid. <add> * <add> * @var int <add> */ <add> protected $minutes; <add> <ide> /** <ide> * Create a new file driven handler instance. <ide> * <ide> * @param \Illuminate\Filesystem\Filesystem $files <ide> * @param string $path <add> * @param int $minutes <ide> * @return void <ide> */ <del> public function __construct(Filesystem $files, $path) <add> public function __construct(Filesystem $files, $path, $minutes) <ide> { <ide> $this->path = $path; <ide> $this->files = $files; <add> $this->minutes = $minutes; <ide> } <ide> <ide> /** <ide> public function close() <ide> public function read($sessionId) <ide> { <ide> if ($this->files->exists($path = $this->path.'/'.$sessionId)) { <del> return $this->files->get($path); <add> if (filemtime($path) >= Carbon::now()->subMinutes($this->minutes)->getTimestamp()) { <add> return $this->files->get($path); <add> } <ide> } <ide> <ide> return ''; <ide><path>src/Illuminate/Session/SessionManager.php <ide> protected function createNativeDriver() <ide> { <ide> $path = $this->app['config']['session.files']; <ide> <del> return $this->buildSession(new FileSessionHandler($this->app['files'], $path)); <add> $lifetime = $this->app['config']['session.lifetime']; <add> <add> return $this->buildSession(new FileSessionHandler($this->app['files'], $path, $lifetime)); <ide> } <ide> <ide> /** <ide> protected function createDatabaseDriver() <ide> <ide> $table = $this->app['config']['session.table']; <ide> <del> return $this->buildSession(new DatabaseSessionHandler($connection, $table)); <add> $lifetime = $this->app['config']['session.lifetime']; <add> <add> return $this->buildSession(new DatabaseSessionHandler($connection, $table, $lifetime)); <ide> } <ide> <ide> /**
4
Python
Python
fix trailing space
428630c19702172beba94a3381d91340aa5e3bd6
<ide><path>rest_framework/serializers.py <ide> def to_representation(self, data): <ide> """ <ide> List of object instances -> List of dicts of primitive datatypes. <ide> """ <del> # Dealing with nested relationships, data can be a Manager, <add> # Dealing with nested relationships, data can be a Manager, <ide> # so, first get a queryset from the Manager if needed <ide> iterable = data.all() if isinstance(data, models.Manager) else data <ide> return [
1
Ruby
Ruby
fix <h1> plain text conversion
7bbddb01738cd8c2a3bda65d32f30ec5e386b4a9
<ide><path>lib/action_text/plain_text_conversion.rb <ide> def plain_text_for_block(node, index = 0) <ide> "#{remove_trailing_newlines(plain_text_for_node_children(node))}\n\n" <ide> end <ide> <del> %i[ p ul ol ].each do |element| <add> %i[ h1 p ul ol ].each do |element| <ide> alias_method :"plain_text_for_#{element}_node", :plain_text_for_block <ide> end <ide>
1
Python
Python
add missing comma
1c408903213c268423f7824d2823e493c57f2f0b
<ide><path>spacy/bn/tokenizer_exceptions.py <ide> ], <ide> "কি.মি": [ <ide> {ORTH: "কি.মি", LEMMA: "কিলোমিটার"}, <del> ] <add> ], <ide> "সে.মি.": [ <ide> {ORTH: "সে.মি.", LEMMA: "সেন্টিমিটার"}, <ide> ],
1
Python
Python
remove unneeded arguments to save_object
56653111a6848f6ef5d4bb645b87cbcaf5bffba1
<ide><path>rest_framework/serializers.py <ide> def from_native(self, data, files): <ide> if instance: <ide> return self.full_clean(instance) <ide> <del> def save_object(self, obj, parent=None, fk_field=None, **kwargs): <add> def save_object(self, obj, **kwargs): <ide> """ <ide> Save the deserialized object and return it. <ide> """ <del> if parent and fk_field: <del> setattr(self.object, fk_field, parent) <del> <ide> obj.save(**kwargs) <ide> <ide> if getattr(obj, '_m2m_data', None):
1
Ruby
Ruby
use long options for `patch` command
b86fdfeb09e55678f5d35a738f55d7bc04dbfd54
<ide><path>Library/Homebrew/style.rb <ide> def run_rubocop(files, output_type, <ide> def run_shellcheck(files, output_type, fix: false) <ide> files = shell_scripts if files.blank? <ide> <del> files = files.map(&:realpath) <add> files = files.map(&:realpath) # use absolute file paths <ide> <ide> args = [ <ide> "--shell=bash", <ide> def run_shellcheck(files, output_type, fix: false) <ide> ] <ide> <ide> if fix <add> # patch options: <add> # --get=0 : suppress environment variable `PATCH_GET`, ignore RCS, ClearCase, Perforce, and SCCS <add> # --force : we know what we are doing, force apply patches <add> # --directory=/ : change to root directory, since we use absolute file paths <add> # --strip=0 : do not strip path prefixes, since we are at root directory <add> patch_command = %w[patch --get=0 --force --directory=/ --strip=0] <ide> patches = system_command(shellcheck, args: ["--format=diff", *args]).stdout <del> patch_command = %w[patch -g 0 -f -d / -p0] <ide> Utils.popen_write(*patch_command) { |p| p.write(patches) } <ide> end <ide>
1
Ruby
Ruby
remove dead code
25c672637206a2c48fd829c58596c788b6e31c5d
<ide><path>actionpack/lib/action_dispatch/journey/visitors.rb <ide> def visit_GROUP(node) <ide> end <ide> end <ide> <del> # Used for formatting urls (url_for) <del> class Formatter < Visitor # :nodoc: <del> attr_reader :options, :consumed <del> <del> def initialize(options) <del> @options = options <del> @consumed = {} <del> end <del> <del> private <del> def escape_path(value) <del> Router::Utils.escape_path(value) <del> end <del> <del> def escape_segment(value) <del> Router::Utils.escape_segment(value) <del> end <del> <del> def visit_GROUP(node) <del> if consumed == options <del> nil <del> else <del> route = visit(node.left) <del> route.include?("\0") ? nil : route <del> end <del> end <del> <del> def terminal(node) <del> node.left <del> end <del> <del> def binary(node) <del> [visit(node.left), visit(node.right)].join <del> end <del> <del> def nary(node) <del> node.children.map { |c| visit(c) }.join <del> end <del> <del> def visit_STAR(node) <del> if value = options[node.left.to_sym] <del> escape_path(value) <del> end <del> end <del> <del> def visit_SYMBOL(node) <del> key = node.to_sym <del> <del> if value = options[key] <del> consumed[key] = value <del> key == :controller ? escape_path(value) : escape_segment(value) <del> else <del> "\0" <del> end <del> end <del> end <del> <ide> class Dot < Visitor # :nodoc: <ide> def initialize <ide> @nodes = []
1
Text
Text
fix faq links
3754ad573754b8e1794217ebff9a7e1c656c8c2d
<ide><path>docs/misc/faq.md <ide> https://github.com/docker/docker/blob/master/LICENSE) <ide> <ide> Docker currently runs only on Linux, but you can use VirtualBox to run Docker in <ide> a virtual machine on your box, and get the best of both worlds. Check out the <del>[*Mac OS X*](../installation/mac/#macosx) and [*Microsoft <del>Windows*](../installation/windows/#windows) installation guides. The small Linux <add>[*Mac OS X*](/installation/mac/) and [*Microsoft <add>Windows*](/installation/windows/) installation guides. The small Linux <ide> distribution boot2docker can be run inside virtual machines on these two <ide> operating systems. <ide> <ide> with several powerful functionalities: <ide> <ide> - *Automatic build.* Docker includes [*a tool for developers to automatically <ide> assemble a container from their source <del> code*](../reference/builder/#dockerbuilder), with full control over application <add> code*](/reference/builder/), with full control over application <ide> dependencies, build tools, packaging etc. They are free to use `make`, `maven`, <ide> `chef`, `puppet`, `salt,` Debian packages, RPMs, source tarballs, or any <ide> combination of the above, regardless of the configuration of the machines. <ide> with several powerful functionalities: <ide> can be transferred by only sending diffs. <ide> <ide> - *Component re-use.* Any container can be used as a [*"base image"*]( <del> ../terms/image/#base-image-def) to create more specialized components. This can <add> /reference/glossary/#image) to create more specialized components. This can <ide> be done manually or as part of an automated build. For example you can prepare <ide> the ideal Python environment, and use it as a base for 10 different <ide> applications. Your ideal PostgreSQL setup can be re-used for all your future <ide> projects. And so on. <ide> <del> - *Sharing.* Docker has access to a [public registry](https://hub.docker.com) <add> - *Sharing.* Docker has access to a [public registry](https://registry.hub.docker.com/) <ide> where thousands of people have uploaded useful containers: anything from Redis, <ide> CouchDB, PostgreSQL to IRC bouncers to Rails app servers to Hadoop to base <ide> images for various Linux distros. The <del> [*registry*](../reference/api/registry_index_spec/#registryindexspec) also <add> [*registry*](/registry/) also <ide> includes an official "standard library" of useful containers maintained by the <ide> Docker team. The registry itself is open-source, so anyone can deploy their own <ide> registry to store and transfer private containers, for internal server
1
Python
Python
allow setting of load balancer port to none
9a07d7e47cd1125bee0e5c288b71950da4006ef3
<ide><path>libcloud/loadbalancer/drivers/dimensiondata.py <ide> def _ex_connection_class_kwargs(self): <ide> kwargs['region'] = self.selected_region <ide> return kwargs <ide> <del> def create_balancer(self, name, port, protocol, algorithm, members): <add> def create_balancer(self, name, port=None, protocol=None, <add> algorithm=None, members=None): <ide> """ <ide> Create a new load balancer instance <ide> <ide> :param name: Name of the new load balancer (required) <ide> :type name: ``str`` <ide> <del> :param port: Port the load balancer should listen on, <del> defaults to 80 (required) <del> :type port: ``str`` <add> :param port: An integer in the range of 1-65535. If not supplied, <add> it will be taken to mean 'Any Port' <add> :type port: ``int`` <ide> <ide> :param protocol: Loadbalancer protocol, defaults to http. <ide> :type protocol: ``str`` <ide> def create_balancer(self, name, port, protocol, algorithm, members): <ide> :rtype: :class:`LoadBalancer` <ide> """ <ide> network_domain_id = self.network_domain_id <del> if port is None: <del> port = 80 <ide> if protocol is None: <ide> protocol = 'http' <ide> if algorithm is None: <ide> def ex_create_virtual_listener(self, <ide> network_domain_id, <ide> name, <ide> ex_description, <del> port, <del> pool, <add> port=None, <add> pool=None, <ide> listener_ip_address=None, <ide> persistence_profile=None, <ide> fallback_persistence_profile=None, <ide> def ex_create_virtual_listener(self, <ide> :param ex_description: Description of the node (required) <ide> :type ex_description: ``str`` <ide> <del> :param port: Description of the node (required) <del> :type port: ``str`` <add> :param port: An integer in the range of 1-65535. If not supplied, <add> it will be taken to mean 'Any Port' <add> :type port: ``int`` <ide> <ide> :param pool: The pool to use for the listener <ide> :type pool: :class:`DimensionDataPool` <ide> def ex_create_virtual_listener(self, <ide> if listener_ip_address is not None: <ide> ET.SubElement(create_node_elm, "listenerIpAddress").text = \ <ide> str(listener_ip_address) <del> ET.SubElement(create_node_elm, "port").text = str(port) <add> if port is not None: <add> ET.SubElement(create_node_elm, "port").text = str(port) <ide> ET.SubElement(create_node_elm, "enabled").text = 'true' <ide> ET.SubElement(create_node_elm, "connectionLimit") \ <ide> .text = str(connection_limit) <ide> ET.SubElement(create_node_elm, "connectionRateLimit") \ <ide> .text = str(connection_rate_limit) <ide> ET.SubElement(create_node_elm, "sourcePortPreservation") \ <ide> .text = source_port_preservation <del> ET.SubElement(create_node_elm, "poolId") \ <del> .text = pool.id <add> if pool is not None: <add> ET.SubElement(create_node_elm, "poolId") \ <add> .text = pool.id <ide> if persistence_profile is not None: <ide> ET.SubElement(create_node_elm, "persistenceProfileId") \ <ide> .text = persistence_profile.id <ide><path>libcloud/test/loadbalancer/test_dimensiondata.py <ide> def test_create_balancer_with_defaults(self): <ide> self.assertEqual(balancer.name, 'test') <ide> self.assertEqual(balancer.id, '8334f461-0df0-42d5-97eb-f4678eb26bea') <ide> self.assertEqual(balancer.ip, '165.180.12.22') <del> self.assertEqual(balancer.port, 80) <add> self.assertEqual(balancer.port, None) <ide> self.assertEqual(balancer.extra['pool_id'], '9e6b496d-5261-4542-91aa-b50c7f569c54') <ide> self.assertEqual(balancer.extra['network_domain_id'], '1234') <ide> <ide> def test_balancer_attach_member(self): <ide> member = self.driver.balancer_attach_member(balancer, member) <ide> self.assertEqual(member.id, '3dd806a2-c2c8-4c0c-9a4f-5219ea9266c0') <ide> <add> def test_balancer_attach_member_without_port(self): <add> extra = {'pool_id': '4d360b1f-bc2c-4ab7-9884-1f03ba2768f7', <add> 'network_domain_id': '1234'} <add> balancer = LoadBalancer( <add> id='234', <add> name='test', <add> state=State.RUNNING, <add> ip='1.2.3.4', <add> port=1234, <add> driver=self.driver, <add> extra=extra <add> ) <add> member = Member( <add> id=None, <add> ip='112.12.2.2', <add> port=None, <add> balancer=balancer, <add> extra=None) <add> member = self.driver.balancer_attach_member(balancer, member) <add> self.assertEqual(member.id, '3dd806a2-c2c8-4c0c-9a4f-5219ea9266c0') <add> self.assertEqual(member.port, None) <add> <ide> def test_balancer_detach_member(self): <ide> extra = {'pool_id': '4d360b1f-bc2c-4ab7-9884-1f03ba2768f7', <ide> 'network_domain_id': '1234'} <ide> def test_ex_create_virtual_listener_unusual_port(self): <ide> self.assertEqual(listener.id, '8334f461-0df0-42d5-97eb-f4678eb26bea') <ide> self.assertEqual(listener.name, 'test') <ide> <add> def test_ex_create_virtual_listener_without_port(self): <add> listener = self.driver.ex_create_virtual_listener( <add> network_domain_id='12345', <add> name='test', <add> ex_description='test', <add> pool=DimensionDataPool( <add> id='1234', <add> name='test', <add> description='test', <add> status=State.RUNNING, <add> health_monitor_id=None, <add> load_balance_method=None, <add> service_down_action=None, <add> slow_ramp_time=None <add> )) <add> self.assertEqual(listener.id, '8334f461-0df0-42d5-97eb-f4678eb26bea') <add> self.assertEqual(listener.name, 'test') <add> <add> def test_ex_create_virtual_listener_without_pool(self): <add> listener = self.driver.ex_create_virtual_listener( <add> network_domain_id='12345', <add> name='test', <add> ex_description='test') <add> self.assertEqual(listener.id, '8334f461-0df0-42d5-97eb-f4678eb26bea') <add> self.assertEqual(listener.name, 'test') <add> <ide> def test_get_balancer(self): <ide> bal = self.driver.get_balancer('6115469d-a8bb-445b-bb23-d23b5283f2b9') <ide> self.assertEqual(bal.name, 'myProduction.Virtual.Listener')
2
Python
Python
remove compat for prohibitnullcharactersvalidator
aed74961ba03e3e6f53c468353f4e255eb788555
<ide><path>rest_framework/compat.py <ide> RegexURLResolver as URLResolver, <ide> ) <ide> <del>try: <del> from django.core.validators import ProhibitNullCharactersValidator # noqa <del>except ImportError: <del> ProhibitNullCharactersValidator = None <del> <ide> <ide> def get_original_route(urlpattern): <ide> """ <ide><path>rest_framework/fields.py <ide> from django.core.exceptions import ValidationError as DjangoValidationError <ide> from django.core.validators import ( <ide> EmailValidator, MaxLengthValidator, MaxValueValidator, MinLengthValidator, <del> MinValueValidator, RegexValidator, URLValidator, ip_address_validators <add> MinValueValidator, ProhibitNullCharactersValidator, RegexValidator, <add> URLValidator, ip_address_validators <ide> ) <ide> from django.forms import FilePathField as DjangoFilePathField <ide> from django.forms import ImageField as DjangoImageField <ide> from rest_framework import ( <ide> ISO_8601, RemovedInDRF313Warning, RemovedInDRF314Warning <ide> ) <del>from rest_framework.compat import ProhibitNullCharactersValidator <ide> from rest_framework.exceptions import ErrorDetail, ValidationError <ide> from rest_framework.settings import api_settings <ide> from rest_framework.utils import html, humanize_datetime, json, representation <ide> def __init__(self, **kwargs): <ide> self.validators.append( <ide> MinLengthValidator(self.min_length, message=message)) <ide> <del> # ProhibitNullCharactersValidator is None on Django < 2.0 <del> if ProhibitNullCharactersValidator is not None: <del> self.validators.append(ProhibitNullCharactersValidator()) <add> self.validators.append(ProhibitNullCharactersValidator()) <ide> self.validators.append(ProhibitSurrogateCharactersValidator()) <ide> <ide> def run_validation(self, data=empty): <ide><path>tests/test_fields.py <ide> <ide> import rest_framework <ide> from rest_framework import exceptions, serializers <del>from rest_framework.compat import ProhibitNullCharactersValidator <ide> from rest_framework.fields import ( <ide> BuiltinSignatureError, DjangoImageField, is_simple_callable <ide> ) <ide> def test_disallow_blank_with_trim_whitespace(self): <ide> field.run_validation(' ') <ide> assert exc_info.value.detail == ['This field may not be blank.'] <ide> <del> @pytest.mark.skipif(ProhibitNullCharactersValidator is None, reason="Skipped on Django < 2.0") <ide> def test_null_bytes(self): <ide> field = serializers.CharField() <ide> <ide> def test_surrogate_characters(self): <ide> field = serializers.CharField() <ide> <ide> for code_point, expected_message in ( <del> (0xD800, 'Surrogate characters are not allowed: U+D800.'), <del> (0xDFFF, 'Surrogate characters are not allowed: U+DFFF.'), <add> (0xD800, 'Surrogate characters are not allowed: U+D800.'), <add> (0xDFFF, 'Surrogate characters are not allowed: U+DFFF.'), <ide> ): <ide> with pytest.raises(serializers.ValidationError) as exc_info: <ide> field.run_validation(chr(code_point))
3
Go
Go
prefer error over panic where possible
4dd86a0b33b246d57507214cb5974e5359552f26
<ide><path>daemon/changes.go <ide> import ( <ide> "errors" <ide> "time" <ide> <add> "github.com/docker/docker/errdefs" <ide> "github.com/docker/docker/pkg/archive" <ide> ) <ide> <ide> func (daemon *Daemon) ContainerChanges(name string) ([]archive.Change, error) { <ide> return nil, errors.New("Windows does not support diff of a running container") <ide> } <ide> <add> if daemon.UsesSnapshotter() { <add> return nil, errdefs.NotImplemented(errors.New("not implemented")) <add> } <ide> container.Lock() <ide> defer container.Unlock() <ide> if container.RWLayer == nil { <ide><path>daemon/containerd/image.go <ide> package containerd <ide> <ide> import ( <ide> "context" <add> "errors" <ide> <ide> imagetype "github.com/docker/docker/api/types/image" <add> "github.com/docker/docker/errdefs" <ide> "github.com/docker/docker/image" <ide> ) <ide> <ide> // GetImage returns an image corresponding to the image referred to by refOrID. <ide> func (i *ImageService) GetImage(ctx context.Context, refOrID string, options imagetype.GetImageOpts) (retImg *image.Image, retErr error) { <del> panic("not implemented") <add> return nil, errdefs.NotImplemented(errors.New("not implemented")) <ide> } <ide><path>daemon/containerd/image_builder.go <ide> package containerd <ide> <ide> import ( <ide> "context" <add> "errors" <ide> <ide> "github.com/docker/docker/api/types/backend" <ide> "github.com/docker/docker/builder" <add> "github.com/docker/docker/errdefs" <ide> ) <ide> <ide> // GetImageAndReleasableLayer returns an image and releaseable layer for a <ide> // reference or ID. Every call to GetImageAndReleasableLayer MUST call <ide> // releasableLayer.Release() to prevent leaking of layers. <ide> func (i *ImageService) GetImageAndReleasableLayer(ctx context.Context, refOrID string, opts backend.GetImageAndLayerOptions) (builder.Image, builder.ROLayer, error) { <del> panic("not implemented") <add> return nil, nil, errdefs.NotImplemented(errors.New("not implemented")) <ide> } <ide> <ide> // CreateImage creates a new image by adding a config and ID to the image store. <ide> // This is similar to LoadImage() except that it receives JSON encoded bytes of <ide> // an image instead of a tar archive. <ide> func (i *ImageService) CreateImage(config []byte, parent string) (builder.Image, error) { <del> panic("not implemented") <add> return nil, errdefs.NotImplemented(errors.New("not implemented")) <ide> } <ide><path>daemon/containerd/image_commit.go <ide> package containerd <ide> <ide> import ( <add> "errors" <add> <ide> "github.com/docker/docker/api/types/backend" <add> "github.com/docker/docker/errdefs" <ide> "github.com/docker/docker/image" <ide> ) <ide> <ide> // CommitImage creates a new image from a commit config. <ide> func (i *ImageService) CommitImage(c backend.CommitConfig) (image.ID, error) { <del> panic("not implemented") <add> return "", errdefs.NotImplemented(errors.New("not implemented")) <ide> } <ide> <ide> // CommitBuildStep is used by the builder to create an image for each step in <ide> func (i *ImageService) CommitImage(c backend.CommitConfig) (image.ID, error) { <ide> // <ide> // This is a temporary shim. Should be removed when builder stops using commit. <ide> func (i *ImageService) CommitBuildStep(c backend.CommitConfig) (image.ID, error) { <del> panic("not implemented") <add> return "", errdefs.NotImplemented(errors.New("not implemented")) <ide> } <ide><path>daemon/containerd/image_history.go <ide> package containerd <ide> <del>import imagetype "github.com/docker/docker/api/types/image" <add>import ( <add> "errors" <add> <add> imagetype "github.com/docker/docker/api/types/image" <add> "github.com/docker/docker/errdefs" <add>) <ide> <ide> // ImageHistory returns a slice of ImageHistory structures for the specified <ide> // image name by walking the image lineage. <ide> func (i *ImageService) ImageHistory(name string) ([]*imagetype.HistoryResponseItem, error) { <del> panic("not implemented") <add> return nil, errdefs.NotImplemented(errors.New("not implemented")) <ide> } <ide><path>daemon/containerd/image_import.go <ide> package containerd <ide> <ide> import ( <add> "errors" <ide> "io" <ide> <add> "github.com/docker/docker/errdefs" <ide> specs "github.com/opencontainers/image-spec/specs-go/v1" <ide> ) <ide> <ide> import ( <ide> // written to outStream. Repository and tag names can optionally be given in <ide> // the repo and tag arguments, respectively. <ide> func (i *ImageService) ImportImage(src string, repository string, platform *specs.Platform, tag string, msg string, inConfig io.ReadCloser, outStream io.Writer, changes []string) error { <del> panic("not implemented") <add> return errdefs.NotImplemented(errors.New("not implemented")) <ide> } <ide><path>daemon/containerd/image_prune.go <ide> package containerd <ide> <ide> import ( <ide> "context" <add> "errors" <ide> <ide> "github.com/docker/docker/api/types" <ide> "github.com/docker/docker/api/types/filters" <add> "github.com/docker/docker/errdefs" <ide> ) <ide> <ide> // ImagesPrune removes unused images <ide> func (i *ImageService) ImagesPrune(ctx context.Context, pruneFilters filters.Args) (*types.ImagesPruneReport, error) { <del> panic("not implemented") <add> return nil, errdefs.NotImplemented(errors.New("not implemented")) <ide> } <ide><path>daemon/containerd/image_pull.go <ide> package containerd <ide> <ide> import ( <ide> "context" <add> "errors" <ide> "io" <ide> <ide> "github.com/containerd/containerd" <ide> func (i *ImageService) PullImage(ctx context.Context, image, tagOrDigest string, <ide> <ide> // GetRepository returns a repository from the registry. <ide> func (i *ImageService) GetRepository(ctx context.Context, ref reference.Named, authConfig *registry.AuthConfig) (distribution.Repository, error) { <del> panic("not implemented") <add> return nil, errdefs.NotImplemented(errors.New("not implemented")) <ide> } <ide><path>daemon/containerd/image_push.go <ide> package containerd <ide> <ide> import ( <ide> "context" <add> "errors" <ide> "io" <ide> <ide> "github.com/docker/docker/api/types/registry" <add> "github.com/docker/docker/errdefs" <ide> ) <ide> <ide> // PushImage initiates a push operation on the repository named localName. <ide> func (i *ImageService) PushImage(ctx context.Context, image, tag string, metaHeaders map[string][]string, authConfig *registry.AuthConfig, outStream io.Writer) error { <del> panic("not implemented") <add> return errdefs.NotImplemented(errors.New("not implemented")) <ide> } <ide><path>daemon/containerd/image_search.go <ide> package containerd <ide> <ide> import ( <ide> "context" <add> "errors" <ide> <ide> "github.com/docker/docker/api/types/filters" <ide> "github.com/docker/docker/api/types/registry" <add> "github.com/docker/docker/errdefs" <ide> ) <ide> <ide> // SearchRegistryForImages queries the registry for images matching <ide> import ( <ide> // TODO: this could be implemented in a registry service instead of the image <ide> // service. <ide> func (i *ImageService) SearchRegistryForImages(ctx context.Context, searchFilters filters.Args, term string, limit int, authConfig *registry.AuthConfig, metaHeaders map[string][]string) (*registry.SearchResults, error) { <del> panic("not implemented") <add> return nil, errdefs.NotImplemented(errors.New("not implemented")) <ide> } <ide><path>daemon/containerd/image_squash.go <ide> package containerd <ide> <add>import ( <add> "errors" <add> <add> "github.com/docker/docker/errdefs" <add>) <add> <ide> // SquashImage creates a new image with the diff of the specified image and <ide> // the specified parent. This new image contains only the layers from its <ide> // parent + 1 extra layer which contains the diff of all the layers in between. <ide> // The existing image(s) is not destroyed. If no parent is specified, a new <ide> // image with the diff of all the specified image's layers merged into a new <ide> // layer that has no parents. <ide> func (i *ImageService) SquashImage(id, parent string) (string, error) { <del> panic("not implemented") <add> return "", errdefs.NotImplemented(errors.New("not implemented")) <ide> } <ide><path>daemon/containerd/image_tag.go <ide> package containerd <ide> <ide> import ( <add> "errors" <add> <ide> "github.com/docker/distribution/reference" <add> "github.com/docker/docker/errdefs" <ide> "github.com/docker/docker/image" <ide> ) <ide> <ide> // TagImage creates the tag specified by newTag, pointing to the image named <ide> // imageName (alternatively, imageName can also be an image ID). <ide> func (i *ImageService) TagImage(imageName, repository, tag string) (string, error) { <del> panic("not implemented") <add> return "", errdefs.NotImplemented(errors.New("not implemented")) <ide> } <ide> <ide> // TagImageWithReference adds the given reference to the image ID provided. <ide> func (i *ImageService) TagImageWithReference(imageID image.ID, newTag reference.Named) error { <del> panic("not implemented") <add> return errdefs.NotImplemented(errors.New("not implemented")) <ide> } <ide><path>daemon/containerd/service.go <ide> package containerd <ide> <ide> import ( <ide> "context" <add> "errors" <ide> <ide> "github.com/containerd/containerd" <ide> "github.com/containerd/containerd/plugin" <ide> "github.com/docker/docker/api/types" <ide> "github.com/docker/docker/container" <ide> "github.com/docker/docker/daemon/images" <add> "github.com/docker/docker/errdefs" <ide> "github.com/docker/docker/image" <ide> "github.com/docker/docker/layer" <ide> ) <ide> func (i *ImageService) Children(id image.ID) []image.ID { <ide> // called from create.go <ide> // TODO: accept an opt struct instead of container? <ide> func (i *ImageService) CreateLayer(container *container.Container, initFunc layer.MountInit) (layer.RWLayer, error) { <del> panic("not implemented") <add> return nil, errdefs.NotImplemented(errdefs.NotImplemented(errors.New("not implemented"))) <ide> } <ide> <ide> // GetLayerByID returns a layer by ID <ide> // called from daemon.go Daemon.restore(), and Daemon.containerExport(). <ide> func (i *ImageService) GetLayerByID(cid string) (layer.RWLayer, error) { <del> panic("not implemented") <add> return nil, errdefs.NotImplemented(errors.New("not implemented")) <ide> } <ide> <ide> // LayerStoreStatus returns the status for each layer store <ide> func (i *ImageService) LayerStoreStatus() [][2]string { <ide> // called from daemon.go Daemon.Shutdown(), and Daemon.Cleanup() (cleanup is actually continerCleanup) <ide> // TODO: needs to be refactored to Unmount (see callers), or removed and replaced with GetLayerByID <ide> func (i *ImageService) GetLayerMountID(cid string) (string, error) { <del> panic("not implemented") <add> return "", errdefs.NotImplemented(errors.New("not implemented")) <ide> } <ide> <ide> // Cleanup resources before the process is shutdown. <ide> func (i *ImageService) StorageDriver() string { <ide> // ReleaseLayer releases a layer allowing it to be removed <ide> // called from delete.go Daemon.cleanupContainer(), and Daemon.containerExport() <ide> func (i *ImageService) ReleaseLayer(rwlayer layer.RWLayer) error { <del> panic("not implemented") <add> return errdefs.NotImplemented(errors.New("not implemented")) <ide> } <ide> <ide> // LayerDiskUsage returns the number of bytes used by layer stores <ide> // called from disk_usage.go <ide> func (i *ImageService) LayerDiskUsage(ctx context.Context) (int64, error) { <del> panic("not implemented") <add> return 0, errdefs.NotImplemented(errors.New("not implemented")) <ide> } <ide> <ide> // ImageDiskUsage returns information about image data disk usage. <ide> func (i *ImageService) ImageDiskUsage(ctx context.Context) ([]*types.ImageSummary, error) { <del> panic("not implemented") <add> return nil, errdefs.NotImplemented(errors.New("not implemented")) <ide> } <ide> <ide> // UpdateConfig values <ide> func (i *ImageService) UpdateConfig(maxDownloads, maxUploads int) { <ide> <ide> // GetLayerFolders returns the layer folders from an image RootFS. <ide> func (i *ImageService) GetLayerFolders(img *image.Image, rwLayer layer.RWLayer) ([]string, error) { <del> panic("not implemented") <add> return nil, errdefs.NotImplemented(errors.New("not implemented")) <ide> } <ide> <ide> // GetContainerLayerSize returns the real size & virtual size of the container.
13
Javascript
Javascript
preserve http method when following redirect
21ae22dbd3ae3d3a55d9efd4eead3dd7fb6d8e6e
<ide><path>lib/adapters/http.js <ide> module.exports = function httpAdapter(config) { <ide> <ide> var options = { <ide> path: buildURL(parsed.path, config.params, config.paramsSerializer).replace(/^\?/, ''), <del> method: config.method, <add> method: config.method.toUpperCase(), <ide> headers: headers, <ide> agent: agent, <ide> auth: auth <ide><path>test/unit/adapters/http.js <ide> describe('supports http with nodejs', function () { <ide> }); <ide> }); <ide> <add> it('should preserve the HTTP verb on redirect', function (done) { <add> server = http.createServer(function (req, res) { <add> if (req.method.toLowerCase() !== "head") { <add> res.statusCode = 400; <add> res.end(); <add> return; <add> } <add> <add> var parsed = url.parse(req.url); <add> if (parsed.pathname === '/one') { <add> res.setHeader('Location', '/two'); <add> res.statusCode = 302; <add> res.end(); <add> } else { <add> res.end(); <add> } <add> }).listen(4444, function () { <add> axios.head('http://localhost:4444/one').then(function (res) { <add> assert.equal(res.status, 200); <add> done(); <add> }).catch(function (err) { <add> done(err); <add> }); <add> }); <add> }); <add> <ide> it('should support transparent gunzip', function (done) { <ide> var data = { <ide> firstName: 'Fred',
2
Ruby
Ruby
fix directory leak in test_pathname_version
9f03b285738d5f82d4ecaaa1807eb1888177ce14
<ide><path>Library/Homebrew/test/test_versions.rb <ide> def test_pathname_version <ide> d = HOMEBREW_CELLAR/'foo-0.1.9' <ide> d.mkpath <ide> assert_equal version('0.1.9'), d.version <add> ensure <add> d.unlink <ide> end <ide> <ide> def test_no_version
1
PHP
PHP
fix unescaped entities
988a847f491730356a802d1801a2c8ed62aff6a9
<ide><path>lib/Cake/TestSuite/Reporter/CakeHtmlReporter.php <ide> protected function _paintLinks() { <ide> $show = $this->_queryString($show); <ide> $query = $this->_queryString($query); <ide> <del> echo "<p><a href='" . $this->baseUrl() . $show . "'>Run more tests</a> | <a href='" . $this->baseUrl() . $query . "&show_passes=1'>Show Passes</a> | \n"; <del> echo "<a href='" . $this->baseUrl() . $query . "&debug=1'>Enable Debug Output</a> | \n"; <add> echo "<p><a href='" . $this->baseUrl() . $show . "'>Run more tests</a> | <a href='" . $this->baseUrl() . $query . "&amp;show_passes=1'>Show Passes</a> | \n"; <add> echo "<a href='" . $this->baseUrl() . $query . "&amp;debug=1'>Enable Debug Output</a> | \n"; <ide> echo "<a href='" . $this->baseUrl() . $query . "&amp;code_coverage=true'>Analyze Code Coverage</a></p>\n"; <ide> } <ide>
1
Python
Python
use defaultdict for _uid_prefixes
f9a4f6f30658207ed4c0252d0e671bd2f8fdb53c
<ide><path>keras/backend/common.py <ide> import numpy as np <ide> <add>from collections import defaultdict <add> <ide> # the type of float to use throughout the session. <ide> _FLOATX = 'float32' <ide> _EPSILON = 10e-8 <del>_UID_PREFIXES = {} <add>_UID_PREFIXES = defaultdict(int) <ide> _IMAGE_DIM_ORDERING = 'th' <ide> <ide> <ide> def set_image_dim_ordering(dim_ordering): <ide> <ide> <ide> def get_uid(prefix=''): <del> if prefix not in _UID_PREFIXES: <del> _UID_PREFIXES[prefix] = 1 <del> return 1 <del> else: <del> _UID_PREFIXES[prefix] += 1 <del> return _UID_PREFIXES[prefix] <add> _UID_PREFIXES[prefix] += 1 <add> return _UID_PREFIXES[prefix]
1
Go
Go
improve error msg
9d00aedebc25507042c5afd4ab8fc6b333ca7c53
<ide><path>daemon/graphdriver/devmapper/driver.go <ide> import ( <ide> "github.com/docker/docker/pkg/locker" <ide> "github.com/docker/docker/pkg/mount" <ide> units "github.com/docker/go-units" <add> "github.com/pkg/errors" <ide> "github.com/sirupsen/logrus" <ide> "golang.org/x/sys/unix" <ide> ) <ide> func (d *Driver) GetMetadata(id string) (map[string]string, error) { <ide> // Cleanup unmounts a device. <ide> func (d *Driver) Cleanup() error { <ide> err := d.DeviceSet.Shutdown(d.home) <add> umountErr := mount.RecursiveUnmount(d.home) <ide> <del> if err2 := mount.RecursiveUnmount(d.home); err == nil { <del> err = err2 <add> // in case we have two errors, prefer the one from Shutdown() <add> if err != nil { <add> return err <ide> } <ide> <del> return err <add> if umountErr != nil { <add> return errors.Wrapf(umountErr, "error unmounting %s", d.home) <add> } <add> <add> return nil <ide> } <ide> <ide> // CreateReadWrite creates a layer that is writable for use as a container
1
Ruby
Ruby
call expand_path on the value of homebrew_cache
8bdc7b92d8f9b5bff1207b362295abc226d1d79c
<ide><path>Library/Homebrew/config.rb <ide> def cache <del> if ENV['HOMEBREW_CACHE'] <del> Pathname.new(ENV['HOMEBREW_CACHE']) <add> if ENV["HOMEBREW_CACHE"] <add> Pathname.new(ENV["HOMEBREW_CACHE"]).expand_path <ide> else <ide> # we do this for historic reasons, however the cache *should* be the same <ide> # directory whichever user is used and whatever instance of brew is executed
1
Text
Text
add parentheses to refreshtmpdir()
edebc902cf0191e02eb7d485d53cfd008a6d3336
<ide><path>test/common/README.md <ide> Port tests are running on. <ide> <ide> Logs '1..0 # Skipped: ' + `msg` <ide> <del>### refreshTmpDir <add>### refreshTmpDir() <ide> * return [&lt;String>] <ide> <del>Deletes the 'tmp' dir and recreates it <add>Deletes the testing 'tmp' directory and recreates it. <ide> <ide> ### restoreStderr() <ide>
1
Python
Python
fix yaml serialization for advanced activations
046a3c8a285be1c4b695aa3ea57cf7f8a9922024
<ide><path>keras/layers/advanced_activations.py <ide> def call(self, x, mask=None): <ide> return pos + self.alpha * (K.exp(neg) - 1.) <ide> <ide> def get_config(self): <del> config = {'alpha': self.alpha} <add> config = {'alpha': float(self.alpha)} <ide> base_config = super(ELU, self).get_config() <ide> return dict(list(base_config.items()) + list(config.items())) <ide> <ide> def call(self, x, mask=None): <ide> return K.softplus(self.betas * x) * self.alphas <ide> <ide> def get_config(self): <del> config = {'alpha_init': self.alpha_init, <del> 'beta_init': self.beta_init} <add> config = {'alpha_init': float(self.alpha_init), <add> 'beta_init': float(self.beta_init)} <ide> base_config = super(ParametricSoftplus, self).get_config() <ide> return dict(list(base_config.items()) + list(config.items())) <ide> <ide> def call(self, x, mask=None): <ide> return x * K.cast(x > self.theta, K.floatx()) <ide> <ide> def get_config(self): <del> config = {'theta': self.theta} <add> config = {'theta': float(self.theta)} <ide> base_config = super(ThresholdedReLU, self).get_config() <ide> return dict(list(base_config.items()) + list(config.items())) <ide>
1
Python
Python
fix style issues on master using black
a5ff3cd01b8a78b5ed2961a8095290fed4e2a0d5
<ide><path>flask/cli.py <ide> def show_server_banner(env, debug, app_import_path, eager_loading): <ide> <ide> if env == "production": <ide> click.secho( <del> ' WARNING: This is a development server. ' <del> 'Do not use it in a production deployment.', fg='red') <del> click.secho(' Use a production WSGI server instead.', dim=True) <add> " WARNING: This is a development server. " <add> "Do not use it in a production deployment.", <add> fg="red", <add> ) <add> click.secho(" Use a production WSGI server instead.", dim=True) <ide> <ide> if debug is not None: <ide> click.echo(" * Debug mode: {0}".format("on" if debug else "off")) <ide><path>tests/test_basic.py <ide> def from_response_status(): <ide> def from_wsgi(): <ide> return NotFound() <ide> <del> @app.route('/dict') <add> @app.route("/dict") <ide> def from_dict(): <ide> return {"foo": "bar"}, 201 <ide> <del> assert client.get('/text').data == u'Hällo Wörld'.encode('utf-8') <del> assert client.get('/bytes').data == u'Hällo Wörld'.encode('utf-8') <add> assert client.get("/text").data == u"Hällo Wörld".encode("utf-8") <add> assert client.get("/bytes").data == u"Hällo Wörld".encode("utf-8") <ide> <ide> rv = client.get("/full_tuple") <ide> assert rv.data == b"Meh" <ide> def from_dict(): <ide> assert b"Not Found" in rv.data <ide> assert rv.status_code == 404 <ide> <del> rv = client.get('/dict') <add> rv = client.get("/dict") <ide> assert rv.json == {"foo": "bar"} <ide> assert rv.status_code == 201 <ide> <ide> def test_jsonify_mimetype(app, req_ctx): <ide> @pytest.mark.skipif(sys.version_info < (3, 7), reason="requires Python >= 3.7") <ide> def test_json_dump_dataclass(app, req_ctx): <ide> from dataclasses import make_dataclass <add> <ide> Data = make_dataclass("Data", [("name", str)]) <ide> value = flask.json.dumps(Data("Flask"), app=app) <ide> value = flask.json.loads(value, app=app) <ide> assert value == {"name": "Flask"} <ide> <add> <ide> def test_jsonify_args_and_kwargs_check(app, req_ctx): <ide> with pytest.raises(TypeError) as e: <ide> flask.jsonify("fake args", kwargs="fake") <ide> def test_static_url_path_with_ending_slash(): <ide> <ide> <ide> def test_static_url_empty_path(app): <del> app = flask.Flask(__name__, static_folder='', static_url_path='') <del> rv = app.test_client().open('/static/index.html', method='GET') <add> app = flask.Flask(__name__, static_folder="", static_url_path="") <add> rv = app.test_client().open("/static/index.html", method="GET") <ide> assert rv.status_code == 200 <ide> rv.close() <ide> <ide> <ide> def test_static_url_empty_path_default(app): <del> app = flask.Flask(__name__, static_folder='') <del> rv = app.test_client().open('/static/index.html', method='GET') <add> app = flask.Flask(__name__, static_folder="") <add> rv = app.test_client().open("/static/index.html", method="GET") <ide> assert rv.status_code == 200 <ide> rv.close() <ide> <ide> def run_simple_mock(hostname, port, application, *args, **kwargs): <ide> (None, None, "localhost:0", "localhost", 0), <ide> ), <ide> ) <del>def test_run_from_config(monkeypatch, host, port, server_name, expect_host, expect_port, app): <add>def test_run_from_config( <add> monkeypatch, host, port, server_name, expect_host, expect_port, app <add>): <ide> def run_simple_mock(hostname, port, *args, **kwargs): <ide> assert hostname == expect_host <ide> assert port == expect_port <ide><path>tests/test_cli.py <ide> def test_load_dotenv(monkeypatch): <ide> assert os.environ["EGGS"] == "3" <ide> <ide> # Non existent file should not load <del> assert not load_dotenv('non-existent-file') <add> assert not load_dotenv("non-existent-file") <ide> <ide> <ide> @need_dotenv <ide><path>tests/test_helpers.py <ide> def test_safe_join_exceptions(self): <ide> print(flask.safe_join(*args)) <ide> <ide> <del> <ide> class TestHelpers(object): <ide> @pytest.mark.parametrize( <ide> "debug, expected_flag, expected_default_flag",
4
Ruby
Ruby
remove linux to homebrew-core label
f96f29f68ddfd0fd43049b1448b1d0e25c050f3c
<ide><path>Library/Homebrew/dev-cmd/pr-automerge.rb <ide> def pr_automerge_args <ide> description: "Pull requests must have this label." <ide> comma_array "--without-labels", <ide> description: "Pull requests must not have these labels (default: "\ <del> "`do not merge`, `new formula`, `automerge-skip`, "\ <del> "`linux to homebrew-core`)." <add> "`do not merge`, `new formula`, `automerge-skip`)." <ide> switch "--without-approval", <ide> description: "Pull requests do not require approval to be merged." <ide> switch "--publish", <ide> def pr_automerge <ide> "do not merge", <ide> "new formula", <ide> "automerge-skip", <del> "linux to homebrew-core", <ide> ] <ide> tap = Tap.fetch(args.tap || CoreTap.instance.name) <ide>
1
Javascript
Javascript
name anonymous functions
2ebd445e6130936362d7975743e6b7d725d2b0fb
<ide><path>lib/console.js <ide> function Console(stdout, stderr) { <ide> // As of v8 5.0.71.32, the combination of rest param, template string <ide> // and .apply(null, args) benchmarks consistently faster than using <ide> // the spread operator when calling util.format. <del>Console.prototype.log = function(...args) { <add>Console.prototype.log = function log(...args) { <ide> this._stdout.write(`${util.format.apply(null, args)}\n`); <ide> }; <ide> <ide> <ide> Console.prototype.info = Console.prototype.log; <ide> <ide> <del>Console.prototype.warn = function(...args) { <add>Console.prototype.warn = function warn(...args) { <ide> this._stderr.write(`${util.format.apply(null, args)}\n`); <ide> }; <ide> <ide> <ide> Console.prototype.error = Console.prototype.warn; <ide> <ide> <del>Console.prototype.dir = function(object, options) { <add>Console.prototype.dir = function dir(object, options) { <ide> options = Object.assign({customInspect: false}, options); <ide> this._stdout.write(`${util.inspect(object, options)}\n`); <ide> }; <ide> <ide> <del>Console.prototype.time = function(label) { <add>Console.prototype.time = function time(label) { <ide> this._times.set(label, process.hrtime()); <ide> }; <ide> <ide> <del>Console.prototype.timeEnd = function(label) { <add>Console.prototype.timeEnd = function timeEnd(label) { <ide> const time = this._times.get(label); <ide> if (!time) { <ide> process.emitWarning(`No such label '${label}' for console.timeEnd()`); <ide> Console.prototype.trace = function trace(...args) { <ide> }; <ide> <ide> <del>Console.prototype.assert = function(expression, ...args) { <add>Console.prototype.assert = function assert(expression, ...args) { <ide> if (!expression) { <ide> require('assert').ok(false, util.format.apply(null, args)); <ide> }
1
Python
Python
use temppath in test_not_closing_opened_fid
c4156cfbe9c22ab99473346b7757d2b54b46baa3
<ide><path>numpy/lib/tests/test_io.py <ide> from numpy.testing import ( <ide> TestCase, run_module_suite, assert_warns, assert_, <ide> assert_raises_regex, assert_raises, assert_allclose, <del> assert_array_equal, <add> assert_array_equal,temppath <ide> ) <ide> from numpy.testing.utils import tempdir <ide> <ide> def writer(error_list): <ide> def test_not_closing_opened_fid(self): <ide> # Test that issue #2178 is fixed: <ide> # verify could seek on 'loaded' file <del> <del> fd, tmp = mkstemp(suffix='.npz') <del> os.close(fd) <del> try: <del> fp = open(tmp, 'wb') <del> np.savez(fp, data='LOVELY LOAD') <del> fp.close() <del> <del> fp = open(tmp, 'rb', 10000) <del> fp.seek(0) <del> assert_(not fp.closed) <del> np.load(fp)['data'] <del> # fp must not get closed by .load <del> assert_(not fp.closed) <del> fp.seek(0) <del> assert_(not fp.closed) <del> <del> finally: <del> fp.close() <del> os.remove(tmp) <add> with temppath(suffix='.npz') as tmp: <add> with open(tmp, 'wb') as fp: <add> np.savez(fp, data='LOVELY LOAD') <add> with open(tmp, 'rb', 10000) as fp: <add> fp.seek(0) <add> assert_(not fp.closed) <add> np.load(fp)['data'] <add> # fp must not get closed by .load <add> assert_(not fp.closed) <add> fp.seek(0) <add> assert_(not fp.closed) <ide> <ide> def test_closing_fid(self): <ide> # Test that issue #1517 (too many opened files) remains closed <ide><path>numpy/testing/tests/test_utils.py <ide> def test_tempdir(): <ide> pass <ide> assert_(not os.path.isdir(tdir)) <ide> <add> raised = False <ide> try: <ide> with tempdir() as tdir: <ide> raise ValueError() <ide> except ValueError: <del> pass <add> raised = True <add> assert_(raised) <ide> assert_(not os.path.isdir(tdir)) <ide> <ide> <ide> def test_temppath(): <ide> pass <ide> assert_(not os.path.isfile(fpath)) <ide> <add> raised = False <ide> try: <ide> with temppath() as fpath: <ide> raise ValueError() <ide> except ValueError: <del> pass <add> raised = True <add> assert_(raised) <ide> assert_(not os.path.isfile(fpath)) <ide> <ide>
2
Javascript
Javascript
remove old jstd assertions
c594f75b4c59a5341741f012a4f2942a920bac8c
<ide><path>test/BinderSpec.js <ide> describe('Binder', function() { <ide> it('BindUpdate', inject(function($rootScope, $compile) { <ide> $compile('<div ng:init="a=123"/>')($rootScope); <ide> $rootScope.$digest(); <del> assertEquals(123, $rootScope.a); <add> expect($rootScope.a).toBe(123); <ide> })); <ide> <ide> it('ExecuteInitialization', inject(function($rootScope, $compile) { <ide> $compile('<div ng:init="a=123">')($rootScope); <del> assertEquals($rootScope.a, 123); <add> expect($rootScope.a).toBe(123); <ide> })); <ide> <ide> it('ExecuteInitializationStatements', inject(function($rootScope, $compile) { <ide> $compile('<div ng:init="a=123;b=345">')($rootScope); <del> assertEquals($rootScope.a, 123); <del> assertEquals($rootScope.b, 345); <add> expect($rootScope.a).toBe(123); <add> expect($rootScope.b).toBe(345); <ide> })); <ide> <ide> it('ApplyTextBindings', inject(function($rootScope, $compile) { <ide> var element = $compile('<div ng:bind="model.a">x</div>')($rootScope); <ide> $rootScope.model = {a:123}; <ide> $rootScope.$apply(); <del> assertEquals('123', element.text()); <add> expect(element.text()).toBe('123'); <ide> })); <ide> <ide> it('ReplaceBindingInTextWithSpan preserve surounding text', function() { <del> assertEquals(this.compileToHtml("<b>a{{b}}c</b>"), '<b>a<span ng:bind="b"></span>c</b>'); <add> expect(this.compileToHtml("<b>a{{b}}c</b>")).toBe('<b>a<span ng:bind="b"></span>c</b>'); <ide> }); <ide> <ide> it('ReplaceBindingInTextWithSpan', function() { <del> assertEquals(this.compileToHtml("<b>{{b}}</b>"), '<b><span ng:bind="b"></span></b>'); <add> expect(this.compileToHtml("<b>{{b}}</b>")).toBe('<b><span ng:bind="b"></span></b>'); <ide> }); <ide> <ide> it('BindingSpaceConfusesIE', inject(function($rootScope, $compile) { <ide> if (!msie) return; <ide> var span = document.createElement("span"); <ide> span.innerHTML = '&nbsp;'; <ide> var nbsp = span.firstChild.nodeValue; <del> assertEquals( <del> '<b><span ng:bind="a"></span><span>'+nbsp+'</span><span ng:bind="b"></span></b>', <del> this.compileToHtml("<b>{{a}} {{b}}</b>")); <add> expect(this.compileToHtml("<b>{{a}} {{b}}</b>")). <add> toBe('<b><span ng:bind="a"></span><span>' + nbsp + '</span><span ng:bind="b"></span></b>'); <ide> dealoc(($rootScope)); <del> assertEquals( <del> '<b><span ng:bind="A"></span><span>'+nbsp+'x </span><span ng:bind="B"></span><span>'+nbsp+'(</span><span ng:bind="C"></span>)</b>', <del> this.compileToHtml("<b>{{A}} x {{B}} ({{C}})</b>")); <add> expect(this.compileToHtml("<b>{{A}} x {{B}} ({{C}})</b>")). <add> toBe('<b><span ng:bind="A"></span><span>' + nbsp + 'x </span><span ng:bind="B"></span>' + <add> '<span>' + nbsp + '(</span><span ng:bind="C"></span>)</b>'); <ide> })); <ide> <ide> it('BindingOfAttributes', inject(function($rootScope, $compile) { <ide> var element = $compile("<a href='http://s/a{{b}}c' foo='x'></a>")($rootScope); <ide> var attrbinding = element.attr("ng:bind-attr"); <ide> var bindings = fromJson(attrbinding); <del> assertEquals("http://s/a{{b}}c", decodeURI(bindings.href)); <del> assertTrue(!bindings.foo); <add> expect(decodeURI(bindings.href)).toBe("http://s/a{{b}}c"); <add> expect(bindings.foo).toBeFalsy(); <ide> })); <ide> <ide> it('MarkMultipleAttributes', inject(function($rootScope, $compile) { <ide> var element = $compile('<a href="http://s/a{{b}}c" foo="{{d}}"></a>')($rootScope); <ide> var attrbinding = element.attr("ng:bind-attr"); <ide> var bindings = fromJson(attrbinding); <del> assertEquals(bindings.foo, "{{d}}"); <del> assertEquals(decodeURI(bindings.href), "http://s/a{{b}}c"); <add> expect(bindings.foo).toBe("{{d}}"); <add> expect(decodeURI(bindings.href)).toBe("http://s/a{{b}}c"); <ide> })); <ide> <ide> it('AttributesNoneBound', inject(function($rootScope, $compile) { <ide> var a = $compile("<a href='abc' foo='def'></a>")($rootScope); <del> assertEquals(a[0].nodeName, "A"); <del> assertTrue(!a.attr("ng:bind-attr")); <add> expect(a[0].nodeName).toBe("A"); <add> expect(a.attr("ng:bind-attr")).toBeFalsy(); <ide> })); <ide> <ide> it('ExistingAttrbindingIsAppended', inject(function($rootScope, $compile) { <ide> var a = $compile("<a href='http://s/{{abc}}' ng:bind-attr='{\"b\":\"{{def}}\"}'></a>")($rootScope); <del> assertEquals('{"b":"{{def}}","href":"http://s/{{abc}}"}', a.attr('ng:bind-attr')); <add> expect(a.attr('ng:bind-attr')).toBe('{"b":"{{def}}","href":"http://s/{{abc}}"}'); <ide> })); <ide> <ide> it('AttributesAreEvaluated', inject(function($rootScope, $compile) { <ide> var a = $compile('<a ng:bind-attr=\'{"a":"a", "b":"a+b={{a+b}}"}\'></a>')($rootScope); <ide> $rootScope.$eval('a=1;b=2'); <ide> $rootScope.$apply(); <del> assertEquals(a.attr('a'), 'a'); <del> assertEquals(a.attr('b'), 'a+b=3'); <add> expect(a.attr('a')).toBe('a'); <add> expect(a.attr('b')).toBe('a+b=3'); <ide> })); <ide> <ide> it('InputTypeButtonActionExecutesInScope', inject(function($rootScope, $compile) { <ide> describe('Binder', function() { <ide> savedCalled = true; <ide> }; <ide> browserTrigger(element, 'click'); <del> assertTrue(savedCalled); <add> expect(savedCalled).toBe(true); <ide> })); <ide> <ide> it('InputTypeButtonActionExecutesInScope2', inject(function($rootScope, $compile) { <ide> describe('Binder', function() { <ide> savedCalled = true; <ide> }; <ide> browserTrigger(element, 'click'); <del> assertTrue(savedCalled); <add> expect(savedCalled).toBe(true); <ide> })); <ide> <ide> it('RepeaterUpdateBindings', inject(function($rootScope, $compile) { <ide> describe('Binder', function() { <ide> $rootScope.model = {items:items}; <ide> <ide> $rootScope.$apply(); <del> assertEquals('<ul>' + <add> expect(sortedHtml(form)).toBe( <add> '<ul>' + <ide> '<#comment></#comment>' + <ide> '<li ng:bind="item.a">A</li>' + <ide> '<li ng:bind="item.a">B</li>' + <del> '</ul>', sortedHtml(form)); <add> '</ul>'); <ide> <ide> items.unshift({a:'C'}); <ide> $rootScope.$apply(); <del> assertEquals('<ul>' + <add> expect(sortedHtml(form)).toBe( <add> '<ul>' + <ide> '<#comment></#comment>' + <ide> '<li ng:bind="item.a">C</li>' + <ide> '<li ng:bind="item.a">A</li>' + <ide> '<li ng:bind="item.a">B</li>' + <del> '</ul>', sortedHtml(form)); <add> '</ul>'); <ide> <ide> items.shift(); <ide> $rootScope.$apply(); <del> assertEquals('<ul>' + <add> expect(sortedHtml(form)).toBe( <add> '<ul>' + <ide> '<#comment></#comment>' + <ide> '<li ng:bind="item.a">A</li>' + <ide> '<li ng:bind="item.a">B</li>' + <del> '</ul>', sortedHtml(form)); <add> '</ul>'); <ide> <ide> items.shift(); <ide> items.shift(); <ide> describe('Binder', function() { <ide> '</ul>')($rootScope); <ide> $rootScope.model = {items:[{a:"A"}]}; <ide> $rootScope.$apply(); <del> assertEquals('<ul>' + <add> expect(sortedHtml(element)).toBe( <add> '<ul>' + <ide> '<#comment></#comment>' + <ide> '<li><span ng:bind="item.a">A</span></li>' + <del> '</ul>', sortedHtml(element)); <add> '</ul>'); <ide> })); <ide> <ide> it('DoNotOverwriteCustomAction', function() { <ide> var html = this.compileToHtml('<input type="submit" value="Save" action="foo();">'); <del> assertTrue(html.indexOf('action="foo();"') > 0 ); <add> expect(html.indexOf('action="foo();"')).toBeGreaterThan(0); <ide> }); <ide> <ide> it('RepeaterAdd', inject(function($rootScope, $compile, $browser) { <ide> describe('Binder', function() { <ide> $rootScope.error['throw'] = function() {throw "MyError";}; <ide> errorLogs.length = 0; <ide> $rootScope.$apply(); <del> assertEquals(['MyError'], errorLogs.shift()); <add> expect(errorLogs.shift()).toBe('MyError'); <ide> <ide> $rootScope.error['throw'] = function() {return "ok";}; <ide> $rootScope.$apply(); <del> assertEquals(0, errorLogs.length); <add> expect(errorLogs.length).toBe(0); <ide> }) <ide> ); <ide> <ide> describe('Binder', function() { <ide> $rootScope.model = [{name:'a', item:['a1', 'a2']}, {name:'b', item:['b1', 'b2']}]; <ide> $rootScope.$apply(); <ide> <del> assertEquals('<div>'+ <del> '<#comment></#comment>'+ <del> '<div name="a" ng:bind-attr="{"name":"{{m.name}}"}">'+ <add> expect(sortedHtml(element)).toBe( <add> '<div>'+ <ide> '<#comment></#comment>'+ <del> '<ul name="a1" ng:bind-attr="{"name":"{{i}}"}"></ul>'+ <del> '<ul name="a2" ng:bind-attr="{"name":"{{i}}"}"></ul>'+ <del> '</div>'+ <del> '<div name="b" ng:bind-attr="{"name":"{{m.name}}"}">'+ <del> '<#comment></#comment>'+ <del> '<ul name="b1" ng:bind-attr="{"name":"{{i}}"}"></ul>'+ <del> '<ul name="b2" ng:bind-attr="{"name":"{{i}}"}"></ul>'+ <del> '</div></div>', sortedHtml(element)); <add> '<div name="a" ng:bind-attr="{"name":"{{m.name}}"}">'+ <add> '<#comment></#comment>'+ <add> '<ul name="a1" ng:bind-attr="{"name":"{{i}}"}"></ul>'+ <add> '<ul name="a2" ng:bind-attr="{"name":"{{i}}"}"></ul>'+ <add> '</div>'+ <add> '<div name="b" ng:bind-attr="{"name":"{{m.name}}"}">'+ <add> '<#comment></#comment>'+ <add> '<ul name="b1" ng:bind-attr="{"name":"{{i}}"}"></ul>'+ <add> '<ul name="b2" ng:bind-attr="{"name":"{{i}}"}"></ul>'+ <add> '</div>' + <add> '</div>'); <ide> })); <ide> <ide> it('HideBindingExpression', inject(function($rootScope, $compile) { <ide> describe('Binder', function() { <ide> $rootScope.clazz = 'testClass'; <ide> $rootScope.$apply(); <ide> <del> assertEquals('<div class="testClass" ng:class="clazz"></div>', sortedHtml(element)); <add> expect(sortedHtml(element)).toBe('<div class="testClass" ng:class="clazz"></div>'); <ide> <ide> $rootScope.clazz = ['a', 'b']; <ide> $rootScope.$apply(); <ide> <del> assertEquals('<div class="a b" ng:class="clazz"></div>', sortedHtml(element)); <add> expect(sortedHtml(element)).toBe('<div class="a b" ng:class="clazz"></div>'); <ide> })); <ide> <ide> it('BindClassEvenOdd', inject(function($rootScope, $compile) { <ide> describe('Binder', function() { <ide> var d2 = jqLite(element[0].childNodes[2]); <ide> expect(d1.hasClass('o')).toBeTruthy(); <ide> expect(d2.hasClass('e')).toBeTruthy(); <del> assertEquals( <add> expect(sortedHtml(element)).toBe( <ide> '<div><#comment></#comment>' + <ide> '<div class="o" ng:class-even="\'e\'" ng:class-odd="\'o\'"></div>' + <del> '<div class="e" ng:class-even="\'e\'" ng:class-odd="\'o\'"></div></div>', <del> sortedHtml(element)); <add> '<div class="e" ng:class-even="\'e\'" ng:class-odd="\'o\'"></div></div>'); <ide> })); <ide> <ide> it('BindStyle', inject(function($rootScope, $compile) { <ide> describe('Binder', function() { <ide> $rootScope.$eval('style={height: "10px"}'); <ide> $rootScope.$apply(); <ide> <del> assertEquals("10px", element.css('height')); <add> expect(element.css('height')).toBe("10px"); <ide> <ide> $rootScope.$eval('style={}'); <ide> $rootScope.$apply(); <ide> describe('Binder', function() { <ide> "</div>")($rootScope); <ide> $rootScope.a = 123; <ide> $rootScope.$apply(); <del> assertEquals('123{{a}}{{b}}{{c}}', element.text()); <add> expect(element.text()).toBe('123{{a}}{{b}}{{c}}'); <ide> })); <ide> <ide> it('ShouldTemplateBindPreElements', inject(function ($rootScope, $compile) { <ide> var element = $compile('<pre>Hello {{name}}!</pre>')($rootScope); <ide> $rootScope.name = "World"; <ide> $rootScope.$apply(); <ide> <del> assertEquals( <del> '<pre ng:bind-template="Hello {{name}}!">Hello World!</pre>', <del> sortedHtml(element)); <add> expect( sortedHtml(element)).toBe( <add> '<pre ng:bind-template="Hello {{name}}!">Hello World!</pre>'); <ide> })); <ide> <ide> it('FillInOptionValueWhenMissing', inject(function($rootScope, $compile) { <ide> describe('Binder', function() { <ide> '</div>')($rootScope); <ide> $rootScope.$apply(); <ide> function assertChild(index, disabled) { <del> var child = childNode(element, index); <del> assertEquals(sortedHtml(child), disabled, !!child.attr('disabled')); <add> expect(!!childNode(element, index).attr('disabled')).toBe(disabled); <ide> } <ide> <ide> assertChild(0, true); <ide> describe('Binder', function() { <ide> var errorLogs = $log.error.logs; <ide> <ide> browserTrigger(first, 'click'); <del> assertEquals("ABC", $rootScope.greeting); <add> expect($rootScope.greeting).toBe("ABC"); <ide> expect(errorLogs).toEqual([]); <ide> <ide> browserTrigger(second, 'click'); <ide> describe('Binder', function() { <ide> var male = jqLite(element[0].childNodes[1]); <ide> <ide> browserTrigger(female); <del> assertEquals("female", $rootScope.sex); <del> assertEquals(true, female[0].checked); <del> assertEquals(false, male[0].checked); <del> assertEquals("female", female.val()); <add> expect($rootScope.sex).toBe("female"); <add> expect(female[0].checked).toBe(true); <add> expect(male[0].checked).toBe(false); <add> expect(female.val()).toBe("female"); <ide> <ide> browserTrigger(male); <del> assertEquals("male", $rootScope.sex); <del> assertEquals(false, female[0].checked); <del> assertEquals(true, male[0].checked); <del> assertEquals("male", male.val()); <add> expect($rootScope.sex).toBe("male"); <add> expect(female[0].checked).toBe(false); <add> expect(male[0].checked).toBe(true); <add> expect(male.val()).toBe("male"); <ide> })); <ide> <ide> it('ItShouldRepeatOnHashes', inject(function($rootScope, $compile) { <ide> describe('Binder', function() { <ide> '<li ng:repeat="(k,v) in {a:0,b:1}" ng:bind=\"k + v\"></li>' + <ide> '</ul>')($rootScope); <ide> $rootScope.$apply(); <del> assertEquals('<ul>' + <del> '<#comment></#comment>' + <del> '<li ng:bind=\"k + v\">a0</li>' + <del> '<li ng:bind=\"k + v\">b1</li>' + <del> '</ul>', <del> sortedHtml(element)); <add> expect(sortedHtml(element)).toBe( <add> '<ul>' + <add> '<#comment></#comment>' + <add> '<li ng:bind=\"k + v\">a0</li>' + <add> '<li ng:bind=\"k + v\">b1</li>' + <add> '</ul>'); <ide> })); <ide> <ide> it('ItShouldFireChangeListenersBeforeUpdate', inject(function($rootScope, $compile) { <ide> describe('Binder', function() { <ide> $rootScope.$watch("watched", "name=123"); <ide> $rootScope.watched = "change"; <ide> $rootScope.$apply(); <del> assertEquals(123, $rootScope.name); <del> assertEquals( <del> '<div ng:bind="name">123</div>', <del> sortedHtml(element)); <add> expect($rootScope.name).toBe(123); <add> expect(sortedHtml(element)).toBe('<div ng:bind="name">123</div>'); <ide> })); <ide> <ide> it('ItShouldHandleMultilineBindings', inject(function($rootScope, $compile) { <ide> var element = $compile('<div>{{\n 1 \n + \n 2 \n}}</div>')($rootScope); <ide> $rootScope.$apply(); <del> assertEquals("3", element.text()); <add> expect(element.text()).toBe("3"); <ide> })); <ide> <ide> }); <ide><path>test/JsonSpec.js <ide> describe('json', function() { <ide> <ide> }); <ide> <del> <add> <ide> it('should read/write to date', function() { <ide> var date = new Date("Sep 10 2003 13:02:03 GMT"); <del> assertEquals("2003-09-10T13:02:03.000Z", jsonDateToString(date)); <del> assertEquals(date.getTime(), jsonStringToDate(jsonDateToString(date)).getTime()); <add> expect(jsonDateToString(date)).toBe("2003-09-10T13:02:03.000Z"); <add> expect(jsonStringToDate(jsonDateToString(date)).getTime()).toBe(date.getTime()); <ide> }); <del> <del> <add> <add> <ide> it('should convert to date', function() { <ide> //full ISO8061 <ide> expect(jsonStringToDate("2003-09-10T13:02:03.000Z")). <ide> describe('json', function() { <ide> toEqual(new Date("Sep 10 2003 00:00:00 GMT")); <ide> }); <ide> <del> <add> <ide> it('should parse date', function() { <ide> var date = jsonStringToDate("2003-09-10T13:02:03.000Z"); <del> assertEquals("2003-09-10T13:02:03.000Z", jsonDateToString(date)); <del> assertEquals("str", jsonStringToDate("str")); <add> expect(jsonDateToString(date)).toBe("2003-09-10T13:02:03.000Z"); <add> expect(jsonStringToDate("str")).toBe("str"); <ide> }); <ide> <ide> <ide> describe('string', function() { <ide> it('should quote', function() { <del> assertEquals(quoteUnicode('a'), '"a"'); <del> assertEquals(quoteUnicode('\\'), '"\\\\"'); <del> assertEquals(quoteUnicode("'a'"), '"\'a\'"'); <del> assertEquals(quoteUnicode('"a"'), '"\\"a\\""'); <del> assertEquals(quoteUnicode('\n\f\r\t'), '"\\n\\f\\r\\t"'); <add> expect(quoteUnicode('a')).toBe('"a"'); <add> expect(quoteUnicode('\\')).toBe('"\\\\"'); <add> expect(quoteUnicode("'a'")).toBe('"\'a\'"'); <add> expect(quoteUnicode('"a"')).toBe('"\\"a\\""'); <add> expect(quoteUnicode('\n\f\r\t')).toBe('"\\n\\f\\r\\t"'); <ide> }); <ide> <ide> it('should quote slashes', function() { <del> assertEquals('"7\\\\\\\"7"', quoteUnicode("7\\\"7")); <add> expect(quoteUnicode("7\\\"7")).toBe('"7\\\\\\\"7"'); <ide> }); <ide> <ide> it('should quote unicode', function() { <del> assertEquals('"abc\\u00a0def"', quoteUnicode('abc\u00A0def')); <add> expect(quoteUnicode('abc\u00A0def')).toBe('"abc\\u00a0def"'); <ide> }); <ide> <ide> }); <del> <add> <ide> }); <ide><path>test/markupSpec.js <ide> describe("markups", function() { <ide> <ide> it('should Parse Text With No Bindings', inject(function($rootScope, $compile) { <ide> var parts = parseBindings("a"); <del> assertEquals(parts.length, 1); <del> assertEquals(parts[0], "a"); <del> assertTrue(!binding(parts[0])); <add> expect(parts.length).toBe(1); <add> expect(parts[0]).toBe("a"); <add> expect(binding(parts[0])).toBeFalsy(); <ide> })); <ide> <ide> it('should Parse Empty Text', inject(function($rootScope, $compile) { <ide> var parts = parseBindings(""); <del> assertEquals(parts.length, 1); <del> assertEquals(parts[0], ""); <del> assertTrue(!binding(parts[0])); <add> expect(parts.length).toBe(1); <add> expect(parts[0]).toBe(""); <add> expect(binding(parts[0])).toBeFalsy(); <ide> })); <ide> <ide> it('should Parse Inner Binding', inject(function($rootScope, $compile) { <ide> var parts = parseBindings("a{{b}}C"); <del> assertEquals(parts.length, 3); <del> assertEquals(parts[0], "a"); <del> assertTrue(!binding(parts[0])); <del> assertEquals(parts[1], "{{b}}"); <del> assertEquals(binding(parts[1]), "b"); <del> assertEquals(parts[2], "C"); <del> assertTrue(!binding(parts[2])); <add> expect(parts.length).toBe(3); <add> expect(parts[0]).toBe("a"); <add> expect(binding(parts[0])).toBeFalsy(); <add> expect(parts[1]).toBe("{{b}}"); <add> expect(binding(parts[1])).toBe("b"); <add> expect(parts[2]).toBe("C"); <add> expect(binding(parts[2])).toBeFalsy(); <ide> })); <ide> <ide> it('should Parse Ending Binding', inject(function($rootScope, $compile) { <ide> var parts = parseBindings("a{{b}}"); <del> assertEquals(parts.length, 2); <del> assertEquals(parts[0], "a"); <del> assertTrue(!binding(parts[0])); <del> assertEquals(parts[1], "{{b}}"); <del> assertEquals(binding(parts[1]), "b"); <add> expect(parts.length).toBe(2); <add> expect(parts[0]).toBe("a"); <add> expect(binding(parts[0])).toBeFalsy(); <add> expect(parts[1]).toBe("{{b}}"); <add> expect(binding(parts[1])).toBe("b"); <ide> })); <ide> <ide> it('should Parse Begging Binding', inject(function($rootScope, $compile) { <ide> var parts = parseBindings("{{b}}c"); <del> assertEquals(parts.length, 2); <del> assertEquals(parts[0], "{{b}}"); <del> assertEquals(binding(parts[0]), "b"); <del> assertEquals(parts[1], "c"); <del> assertTrue(!binding(parts[1])); <add> expect(parts.length).toBe(2); <add> expect(parts[0]).toBe("{{b}}"); <add> expect(binding(parts[0])).toBe("b"); <add> expect(parts[1]).toBe("c"); <add> expect(binding(parts[1])).toBeFalsy(); <ide> })); <ide> <ide> it('should Parse Loan Binding', inject(function($rootScope, $compile) { <ide> var parts = parseBindings("{{b}}"); <del> assertEquals(parts.length, 1); <del> assertEquals(parts[0], "{{b}}"); <del> assertEquals(binding(parts[0]), "b"); <add> expect(parts.length).toBe(1); <add> expect(parts[0]).toBe("{{b}}"); <add> expect(binding(parts[0])).toBe("b"); <ide> })); <ide> <ide> it('should Parse Two Bindings', inject(function($rootScope, $compile) { <ide> var parts = parseBindings("{{b}}{{c}}"); <del> assertEquals(parts.length, 2); <del> assertEquals(parts[0], "{{b}}"); <del> assertEquals(binding(parts[0]), "b"); <del> assertEquals(parts[1], "{{c}}"); <del> assertEquals(binding(parts[1]), "c"); <add> expect(parts.length).toBe(2); <add> expect(parts[0]).toBe("{{b}}"); <add> expect(binding(parts[0])).toBe("b"); <add> expect(parts[1]).toBe("{{c}}"); <add> expect(binding(parts[1])).toBe("c"); <ide> })); <ide> <ide> it('should Parse Two Bindings With Text In Middle', inject(function($rootScope, $compile) { <ide> var parts = parseBindings("{{b}}x{{c}}"); <del> assertEquals(parts.length, 3); <del> assertEquals(parts[0], "{{b}}"); <del> assertEquals(binding(parts[0]), "b"); <del> assertEquals(parts[1], "x"); <del> assertTrue(!binding(parts[1])); <del> assertEquals(parts[2], "{{c}}"); <del> assertEquals(binding(parts[2]), "c"); <add> expect(parts.length).toBe(3); <add> expect(parts[0]).toBe("{{b}}"); <add> expect(binding(parts[0])).toBe("b"); <add> expect(parts[1]).toBe("x"); <add> expect(binding(parts[1])).toBeFalsy(); <add> expect(parts[2]).toBe("{{c}}"); <add> expect(binding(parts[2])).toBe("c"); <ide> })); <ide> <ide> it('should Parse Multiline', inject(function($rootScope, $compile) { <ide> var parts = parseBindings('"X\nY{{A\nB}}C\nD"'); <del> assertTrue(!!binding('{{A\nB}}')); <del> assertEquals(parts.length, 3); <del> assertEquals(parts[0], '"X\nY'); <del> assertEquals(parts[1], '{{A\nB}}'); <del> assertEquals(parts[2], 'C\nD"'); <add> expect(binding('{{A\nB}}')).toBeTruthy(); <add> expect(parts.length).toBe(3); <add> expect(parts[0]).toBe('"X\nY'); <add> expect(parts[1]).toBe('{{A\nB}}'); <add> expect(parts[2]).toBe('C\nD"'); <ide> })); <ide> <ide> it('should Has Binding', inject(function($rootScope, $compile) { <del> assertTrue(hasBindings(parseBindings("{{a}}"))); <del> assertTrue(!hasBindings(parseBindings("a"))); <del> assertTrue(hasBindings(parseBindings("{{b}}x{{c}}"))); <add> expect(hasBindings(parseBindings("{{a}}"))).toBe(true); <add> expect(hasBindings(parseBindings("a"))).toBeFalsy(); <add> expect(hasBindings(parseBindings("{{b}}x{{c}}"))).toBe(true); <ide> })); <ide> <ide> }); <ide><path>test/service/filter/filterSpec.js <ide> <ide> describe('Filter: filter', function() { <ide> var filter; <del> <add> <ide> beforeEach(inject(function($filter){ <ide> filter = $filter('filter'); <ide> })); <del> <add> <ide> it('should filter by string', function() { <del> var items = ["MIsKO", {name:"shyam"}, ["adam"], 1234]; <del> assertEquals(4, filter(items, "").length); <del> assertEquals(4, filter(items, undefined).length); <add> var items = ['MIsKO', {name: 'shyam'}, ['adam'], 1234]; <add> expect(filter(items, '').length).toBe(4); <add> expect(filter(items, undefined).length).toBe(4); <ide> <del> assertEquals(1, filter(items, 'iSk').length); <del> assertEquals("MIsKO", filter(items, 'isk')[0]); <add> expect(filter(items, 'iSk').length).toBe(1); <add> expect(filter(items, 'isk')[0]).toBe('MIsKO'); <ide> <del> assertEquals(1, filter(items, 'yam').length); <del> assertEquals(items[1], filter(items, 'yam')[0]); <add> expect(filter(items, 'yam').length).toBe(1); <add> expect(filter(items, 'yam')[0]).toEqual(items[1]); <ide> <del> assertEquals(1, filter(items, 'da').length); <del> assertEquals(items[2], filter(items, 'da')[0]); <add> expect(filter(items, 'da').length).toBe(1); <add> expect(filter(items, 'da')[0]).toEqual(items[2]); <ide> <del> assertEquals(1, filter(items, '34').length); <del> assertEquals(1234, filter(items, '34')[0]); <add> expect(filter(items, '34').length).toBe(1); <add> expect(filter(items, '34')[0]).toBe(1234); <ide> <del> assertEquals(0, filter(items, "I don't exist").length); <add> expect(filter(items, "I don't exist").length).toBe(0); <ide> }); <ide> <ide> it('should not read $ properties', function() { <del> assertEquals("", "".charAt(0)); // assumption <del> var items = [{$name:"misko"}]; <del> assertEquals(0, filter(items, "misko").length); <add> expect(''.charAt(0)).toBe(''); // assumption <add> <add> var items = [{$name: 'misko'}]; <add> expect(filter(items, 'misko').length).toBe(0); <ide> }); <ide> <ide> it('should filter on specific property', function() { <del> var items = [{ignore:"a", name:"a"}, {ignore:"a", name:"abc"}]; <del> assertEquals(2, filter(items, {}).length); <add> var items = [{ignore: 'a', name: 'a'}, {ignore: 'a', name: 'abc'}]; <add> expect(filter(items, {}).length).toBe(2); <ide> <del> assertEquals(2, filter(items, {name:'a'}).length); <add> expect(filter(items, {name: 'a'}).length).toBe(2); <ide> <del> assertEquals(1, filter(items, {name:'b'}).length); <del> assertEquals("abc", filter(items, {name:'b'})[0].name); <add> expect(filter(items, {name: 'b'}).length).toBe(1); <add> expect(filter(items, {name: 'b'})[0].name).toBe('abc'); <ide> }); <ide> <ide> it('should take function as predicate', function() { <del> var items = [{name:"a"}, {name:"abc", done:true}]; <del> assertEquals(1, filter(items, function(i) {return i.done;}).length); <add> var items = [{name: 'a'}, {name: 'abc', done: true}]; <add> expect(filter(items, function(i) {return i.done;}).length).toBe(1); <ide> }); <ide> <ide> it('should take object as perdicate', function() { <del> var items = [{first:"misko", last:"hevery"}, <del> {first:"adam", last:"abrons"}]; <del> <del> assertEquals(2, filter(items, {first:'', last:''}).length); <del> assertEquals(1, filter(items, {first:'', last:'hevery'}).length); <del> assertEquals(0, filter(items, {first:'adam', last:'hevery'}).length); <del> assertEquals(1, filter(items, {first:'misko', last:'hevery'}).length); <del> assertEquals(items[0], filter(items, {first:'misko', last:'hevery'})[0]); <add> var items = [{first: 'misko', last: 'hevery'}, <add> {first: 'adam', last: 'abrons'}]; <add> <add> expect(filter(items, {first:'', last:''}).length).toBe(2); <add> expect(filter(items, {first:'', last:'hevery'}).length).toBe(1); <add> expect(filter(items, {first:'adam', last:'hevery'}).length).toBe(0); <add> expect(filter(items, {first:'misko', last:'hevery'}).length).toBe(1); <add> expect(filter(items, {first:'misko', last:'hevery'})[0]).toEqual(items[0]); <ide> }); <ide> <ide> it('should support negation operator', function() { <del> var items = ["misko", "adam"]; <add> var items = ['misko', 'adam']; <ide> <del> assertEquals(1, filter(items, '!isk').length); <del> assertEquals(items[1], filter(items, '!isk')[0]); <add> expect(filter(items, '!isk').length).toBe(1); <add> expect(filter(items, '!isk')[0]).toEqual(items[1]); <ide> }); <ide> }); <ide><path>test/testabilityPatch.js <ide> function isCssVisible(node) { <ide> } <ide> <ide> function assertHidden(node) { <del> assertFalse("Node should be hidden but vas visible: " + <del> angular.module.ngMock.dump(node), isCssVisible(node)); <add> if (isCssVisible(node)) { <add> throw new Error('Node should be hidden but was visible: ' + angular.module.ngMock.dump(node)); <add> } <ide> } <ide> <ide> function assertVisible(node) { <del> assertTrue("Node should be visible but vas hidden: " + <del> angular.module.ngMock.dump(node), isCssVisible(node)); <add> if (!isCssVisible(node)) { <add> throw new Error('Node should be visible but was hidden: ' + angular.module.ngMock.dump(node)); <add> } <ide> } <ide>
5
PHP
PHP
set no timeout
2ec773802f75c20926a27b8b308b3ea2f13b8d7c
<ide><path>src/Illuminate/Database/Schema/MySqlSchemaState.php <ide> protected function baseVariables(array $config) <ide> protected function executeDumpProcess(Process $process, $output, array $variables) <ide> { <ide> try { <del> $process->mustRun($output, $variables); <add> $process->setTimeout(null)->mustRun($output, $variables); <ide> } catch (Exception $e) { <ide> if (Str::contains($e->getMessage(), ['column-statistics', 'column_statistics'])) { <ide> return $this->executeDumpProcess(Process::fromShellCommandLine( <ide><path>src/Illuminate/Database/Schema/PostgresSchemaState.php <ide> protected function appendMigrationData(string $path) <ide> { <ide> with($process = $this->makeProcess( <ide> $this->baseDumpCommand().' --table=migrations --data-only --inserts' <del> ))->mustRun(null, array_merge($this->baseVariables($this->connection->getConfig()), [ <add> ))->setTimeout(null)->mustRun(null, array_merge($this->baseVariables($this->connection->getConfig()), [ <ide> // <ide> ])); <ide> <ide><path>src/Illuminate/Database/Schema/SqliteSchemaState.php <ide> public function dump($path) <ide> { <ide> with($process = $this->makeProcess( <ide> $this->baseCommand().' .schema' <del> ))->mustRun(null, array_merge($this->baseVariables($this->connection->getConfig()), [ <add> ))->setTimeout(null)->mustRun(null, array_merge($this->baseVariables($this->connection->getConfig()), [ <ide> // <ide> ])); <ide>
3
PHP
PHP
use name() instead of hand quoting sequence names
ddc3eee84cc85eeabf51681ee501cbbd8818590a
<ide><path>lib/Cake/Model/Datasource/Database/Postgres.php <ide> public function truncate($table, $reset = false) { <ide> if ($this->execute('DELETE FROM ' . $this->fullTableName($table))) { <ide> if (isset($this->_sequenceMap[$table]) && $reset != true) { <ide> foreach ($this->_sequenceMap[$table] as $sequence) { <del> list($schema, $sequence) = explode('.', $sequence); <del> $this->_execute("ALTER SEQUENCE \"{$schema}\".\"{$sequence}\" RESTART WITH 1"); <add> $quoted = $this->name($sequence); <add> $this->_execute("ALTER SEQUENCE {$sequence} RESTART WITH 1"); <ide> } <ide> } <ide> return true;
1
PHP
PHP
add missing trim() around sqlserver queries
0f8dae55c9865fc2eeb1b2fe1d4dd66048236311
<ide><path>lib/Cake/Model/Datasource/Database/Sqlserver.php <ide> public function renderStatement($type, $data) { <ide> $offset = intval($limitOffset[2] * $page); <ide> <ide> $rowCounter = self::ROW_COUNTER; <del> return " <del> SELECT {$limit} * FROM ( <add> $sql = "SELECT {$limit} * FROM ( <ide> SELECT {$fields}, ROW_NUMBER() OVER ({$order}) AS {$rowCounter} <ide> FROM {$table} {$alias} {$joins} {$conditions} {$group} <ide> ) AS _cake_paging_ <ide> WHERE _cake_paging_.{$rowCounter} > {$offset} <ide> ORDER BY _cake_paging_.{$rowCounter} <ide> "; <add> return trim($sql); <ide> } <ide> if (strpos($limit, 'FETCH') !== false) { <del> return "SELECT {$fields} FROM {$table} {$alias} {$joins} {$conditions} {$group} {$order} {$limit}"; <add> return trim("SELECT {$fields} FROM {$table} {$alias} {$joins} {$conditions} {$group} {$order} {$limit}"); <ide> } <del> return "SELECT {$limit} {$fields} FROM {$table} {$alias} {$joins} {$conditions} {$group} {$order}"; <add> return trim("SELECT {$limit} {$fields} FROM {$table} {$alias} {$joins} {$conditions} {$group} {$order}"); <ide> case "schema": <ide> extract($data); <ide> <ide> public function renderStatement($type, $data) { <ide> ${$var} = "\t" . implode(",\n\t", array_filter(${$var})); <ide> } <ide> } <del> return "CREATE TABLE {$table} (\n{$columns});\n{$indexes}"; <add> return trim("CREATE TABLE {$table} (\n{$columns});\n{$indexes}"); <ide> default: <ide> return parent::renderStatement($type, $data); <ide> }
1
Javascript
Javascript
remove test to see if build passes
06207e0d0e6bc4a0fd49cf9732eda66c6ea1e023
<ide><path>spec/window-event-handler-spec.js <ide> describe('WindowEventHandler', () => { <ide> window.dispatchEvent(new CustomEvent('window:close')) <ide> expect(atom.close).toHaveBeenCalled() <ide> }) <del> <del> it ('saves the window state', () => { <del> spyOn(atom, 'storeWindowDimensions') <del> window.dispatchEvent(new CustomEvent('window:close')) <del> expect(atom.storeWindowDimensions).toHaveBeenCalled() <del> }) <add> <add>// TODO: add this back, commenting out to see if build passes. <add>// it ('saves the window state', () => { <add>// spyOn(atom, 'storeWindowDimensions') <add>// window.dispatchEvent(new CustomEvent('window:close')) <add>// expect(atom.storeWindowDimensions).toHaveBeenCalled() <add>// }) <ide> ) <ide> <ide> describe('when a link is clicked', () =>
1
Javascript
Javascript
remove an unused variable
5799f41c93b354c3529e2ab4259141a1c88cac37
<ide><path>lib/internal/bootstrap/node.js <ide> const { kExpandStackSymbol } = NativeModule.require('internal/util'); <ide> if (typeof er[kExpandStackSymbol] === 'function') <ide> er[kExpandStackSymbol](); <del> } catch (er) {} <add> } catch { <add> // Nothing to be done about it at this point. <add> } <ide> return false; <ide> } <ide>
1
Ruby
Ruby
test url generation for s3 and disk
5bb3f63b318932de0bc21b164d5eb2530a718c3d
<ide><path>test/service/disk_service_test.rb <ide> class ActiveStorage::Service::DiskServiceTest < ActiveSupport::TestCase <ide> SERVICE = ActiveStorage::Service::DiskService.new(root: File.join(Dir.tmpdir, "active_storage")) <ide> <ide> include ActiveStorage::Service::SharedServiceTests <add> <add> test "url generation" do <add> assert_match /rails\/blobs\/.*\/avatar\.png\?disposition=inline/, <add> @service.url(FIXTURE_KEY, expires_in: 5.minutes, disposition: :inline, filename: "avatar.png") <add> end <ide> end <ide><path>test/service/s3_service_test.rb <ide> class ActiveStorage::Service::S3ServiceTest < ActiveSupport::TestCase <ide> SERVICE = ActiveStorage::Service.configure(:s3, SERVICE_CONFIGURATIONS) <ide> <ide> include ActiveStorage::Service::SharedServiceTests <add> <add> test "signed URL generation" do <add> assert_match /rails-activestorage\.s3\.amazonaws\.com.*response-content-disposition=inline.*avatar\.png/, <add> @service.url(FIXTURE_KEY, expires_in: 5.minutes, disposition: :inline, filename: "avatar.png") <add> end <ide> end <ide> else <ide> puts "Skipping S3 Service tests because no S3 configuration was supplied"
2
Javascript
Javascript
fix regexp in defaultstatsprinterplugin
a8afd23578290885d467717aefa33d2d683c14bc
<ide><path>lib/stats/DefaultStatsPrinterPlugin.js <ide> const AVAILABLE_FORMATS = { <ide> }, <ide> { regExp: /(\(module has no exports\))/g, format: red }, <ide> { regExp: /\(possible exports: (.+)\)/g, format: green }, <del> { regExp: /\s*([^\s].* doesn't exist)/g, format: red }, <add> { regExp: /(?:^|\n)(.* doesn't exist)/g, format: red }, <ide> { regExp: /('\w+' option has not been set)/g, format: red }, <ide> { <ide> regExp: /(Emitted value instead of an instance of Error)/g,
1
Python
Python
remove erronous newline
e6ca0fcb4c610dcf4cac291b3b3ace1a5b3f2d90
<ide><path>rest_framework/filters.py <ide> class DjangoObjectPermissionsFilter(BaseFilterBackend): <ide> A filter backend that limits results to those where the requesting user <ide> has read object level permissions. <ide> """ <del> <ide> def __init__(self): <ide> assert guardian, 'Using DjangoObjectPermissionsFilter, but django-guardian is not installed' <ide>
1
Javascript
Javascript
reset haserror flag after hmr request
fdc62400185beeb5c35d9066fe561771096e3d09
<ide><path>packager/react-packager/src/Resolver/polyfills/require.js <ide> if (__DEV__) { <ide> if (factory) { <ide> mod.factory = factory; <ide> } <add> mod.hasError = false; <ide> mod.isInitialized = false; <ide> require(id); <ide>
1
Ruby
Ruby
add runtime_installed_formula_dependents method
7d77a9e97d43ee5bda273277da093078e00325b5
<ide><path>Library/Homebrew/formula.rb <ide> def runtime_formula_dependencies(read_from_tab: true, undeclared: true) <ide> end.compact <ide> end <ide> <add> def runtime_installed_formula_dependents <add> # `opt_or_installed_prefix_keg` and `runtime_dependencies` `select`s ensure <add> # that we don't end up with something `Formula#runtime_dependencies` can't <add> # read from a `Tab`. <add> Formula.cache[:runtime_installed_formula_dependents] = {} <add> Formula.cache[:runtime_installed_formula_dependents][name] ||= Formula.installed <add> .select(&:opt_or_installed_prefix_keg) <add> .select(&:runtime_dependencies) <add> .select do |f| <add> f.runtime_formula_dependencies.any? do |dep| <add> full_name == dep.full_name <add> rescue <add> name == dep.name <add> end <add> end <add> end <add> <ide> # Returns a list of formulae depended on by this formula that aren't <ide> # installed <ide> def missing_dependencies(hide: nil)
1
Ruby
Ruby
update service metadata for updated blobs only
601006c56d08f8ce168faf7b5875a9a19a026001
<ide><path>activestorage/app/models/active_storage/blob.rb <ide> class ActiveStorage::Blob < ActiveRecord::Base <ide> self.service_name ||= self.class.service.name <ide> end <ide> <del> after_commit :update_service_metadata, if: :content_type_previously_changed? <add> after_update_commit :update_service_metadata, if: :content_type_previously_changed? <ide> <ide> before_destroy(prepend: true) do <ide> raise ActiveRecord::InvalidForeignKey if attachments.exists?
1
PHP
PHP
apply fixes from styleci
0f3e5092c0e9b9628da951107365fd4a0a3d741e
<ide><path>src/Illuminate/Routing/Router.php <ide> use Illuminate\Support\Traits\Macroable; <ide> use Illuminate\Contracts\Events\Dispatcher; <ide> use Illuminate\Contracts\Routing\BindingRegistrar; <del>use Illuminate\Database\Eloquent\ModelNotFoundException; <ide> use Psr\Http\Message\ResponseInterface as PsrResponseInterface; <ide> use Illuminate\Contracts\Routing\Registrar as RegistrarContract; <ide> use Symfony\Bridge\PsrHttpMessage\Factory\HttpFoundationFactory;
1
Javascript
Javascript
fix lint error
a164854a4c082e76ec0783fc5261c4b66f4cb97f
<ide><path>lib/ErrorHelpers.js <ide> exports.cleanUpWebpackOptions = (stack, message) => { <ide> stack = exports.cutOffWebpackOptinos(stack); <ide> stack = exports.cutOffMultilineMessage(stack, message); <ide> return stack; <del>} <add>};
1
Ruby
Ruby
reorder unpack strategies
fc1586576021f20bc87526254044d31908503146
<ide><path>Library/Homebrew/unpack_strategy.rb <ide> def self.strategies <ide> Otf, <ide> Air, <ide> Executable, <del> SelfExtractingExecutable, <del> Jar, <del> LuaRock, <del> MicrosoftOfficeXml, <add> Jar, # needs to be before Zip <add> LuaRock, # needs to be before Zip <add> MicrosoftOfficeXml, # needs to be before Zip <ide> Zip, <del> Dmg, <ide> Xar, <ide> Compress, <del> Tar, <del> Bzip2, <add> Tar, # needs to be before Bzip2/Gzip/Xz/Lzma <ide> Gzip, <ide> Lzma, <ide> Xz, <ide> def self.strategies <ide> Mercurial, <ide> Subversion, <ide> Cvs, <add> Dmg, # needs to be before Bzip2 <add> Bzip2, <ide> Fossil, <ide> Bazaar, <add> SelfExtractingExecutable, # needs to be before Cab <ide> Cab, <ide> P7Zip, <ide> Sit,
1
Text
Text
add a changelog entry about runner hook
f7ed0af6c163b80041dfe02f783632b952b13d6d
<ide><path>railties/CHANGELOG.md <ide> ## Rails 4.0.0 (unreleased) ## <ide> <add>* Add runner to Rails::Railtie as a hook called just after runner starts. *José Valim & kennyj* <add> <ide> * Add `/rails/info/routes` path, displays same information as `rake routes` *Richard Schneeman & Andrew White* <ide> <ide> * Improved `rake routes` output for redirects *Łukasz Strzałkowski & Andrew White*
1
PHP
PHP
fix misnamed class
4479a8608c248bd3eca3a30112079f457bbc19d7
<ide><path>lib/Cake/Console/Shell.php <ide> public function runCommand($command, $argv) { <ide> $this->_useLogger(false); <ide> } <ide> if (!empty($this->params['plugin'])) { <del> CakePlugin::load($this->params['plugin']); <add> Plugin::load($this->params['plugin']); <ide> } <ide> $this->command = $command; <ide> if (!empty($this->params['help'])) {
1
Ruby
Ruby
add polymorphicreflection and constraints method
08acb4bccba5b64a233eb7c2ea1b0cd09881d2cb
<ide><path>activerecord/lib/active_record/associations/association_scope.rb <ide> def next_chain_scope(scope, table, reflection, connection, assoc_klass, foreign_ <ide> <ide> def add_constraints(scope, owner, assoc_klass, refl, tracker) <ide> chain = refl.chain <del> scope_chain = refl.scope_chain <del> connection = tracker.connection <ide> <ide> tables = construct_tables(chain, assoc_klass, refl, tracker) <ide> <ide> owner_reflection = chain.last <ide> table = tables.last <ide> scope = last_chain_scope(scope, table, owner_reflection, owner, connection, assoc_klass) <ide> <add> # chain.first always == refl <ide> chain.each_with_index do |reflection, i| <ide> table, foreign_table = tables.shift, tables.first <ide> <ide> def add_constraints(scope, owner, assoc_klass, refl, tracker) <ide> is_first_chain = i == 0 <ide> klass = is_first_chain ? assoc_klass : reflection.klass <ide> <add> items = reflection.constraints <add> <ide> # Exclude the scope of the association itself, because that <ide> # was already merged in the #scope method. <del> scope_chain[i].each do |scope_chain_item| <add> items.each do |scope_chain_item| <ide> item = eval_scope(klass, scope_chain_item, owner) <ide> <ide> if scope_chain_item == refl.scope <ide><path>activerecord/lib/active_record/reflection.rb <ide> def source_macro <ide> <ide> macro <ide> end <add> <add> def constraints <add> scope ? [scope] : [] <add> end <ide> end <add> <ide> # Base class for AggregateReflection and AssociationReflection. Objects of <ide> # AggregateReflection and AssociationReflection are returned by the Reflection::ClassMethods. <ide> # <ide> def through_reflection <ide> def chain <ide> @chain ||= begin <ide> a = source_reflection.chain <del> b = through_reflection.chain <add> b = through_reflection.chain.map(&:dup) <add> <add> if options[:source_type] <add> b[0] = PolymorphicReflection.new(b[0], self) <add> end <add> <ide> chain = a + b <ide> chain[0] = self # Use self so we don't lose the information from :source_type <ide> chain <ide> end <ide> end <ide> <add> class PolymorphicReflection <add> def initialize(reflection, prev_reflection) <add> @reflection = reflection <add> @prev_reflection = prev_reflection <add> end <add> <add> def klass <add> @reflection.klass <add> end <add> <add> def scope <add> @reflection.scope <add> end <add> <add> def table_name <add> @reflection.table_name <add> end <add> <add> def plural_name <add> @reflection.plural_name <add> end <add> <add> def join_keys(assoc_klass) <add> @reflection.join_keys(assoc_klass) <add> end <add> <add> def type <add> @reflection.type <add> end <add> <add> def constraints <add> [source_type_info] <add> end <add> <add> def source_type_info <add> type = @prev_reflection.foreign_type <add> source_type = @prev_reflection.options[:source_type] <add> lambda { |object| where(type => source_type) } <add> end <add> end <add> <ide> # Consider the following example: <ide> # <ide> # class Person <ide> def check_validity! <ide> check_validity_of_inverse! <ide> end <ide> <add> def constraints <add> scope_chain = source_reflection.constraints <add> scope_chain << scope if scope <add> scope_chain <add> end <add> <ide> protected <ide> <ide> def actual_source_reflection # FIXME: this is a horrible name
2
PHP
PHP
apply fixes from styleci
6061e9351c2e440fa51a7889a7558d63a81c0143
<ide><path>src/Illuminate/Foundation/Console/ServeCommand.php <ide> protected function serverCommand() <ide> return [ <ide> (new PhpExecutableFinder)->find(false), <ide> '-S', <del> $this->host() . ':' . $this->port(), <del> base_path('server.php') <add> $this->host().':'.$this->port(), <add> base_path('server.php'), <ide> ]; <ide> } <ide>
1
Ruby
Ruby
change useless gsub to delete
c6147113fabf64d58571e89d6661fe109aebc2b2
<ide><path>actionpack/lib/action_view/helpers/form_tag_helper.rb <ide> def form_tag_in_block(html_options, &block) <ide> <ide> # see http://www.w3.org/TR/html4/types.html#type-name <ide> def sanitize_to_id(name) <del> name.to_s.gsub(']','').gsub(/[^-a-zA-Z0-9:.]/, "_") <add> name.to_s.delete(']').gsub(/[^-a-zA-Z0-9:.]/, "_") <ide> end <ide> end <ide> end
1
Ruby
Ruby
detect name from github archives
90a630dcadb50829a17c6423b1af0bb2b4491f69
<ide><path>Library/Homebrew/cmd/create.rb <ide> def url= url <ide> @url = url <ide> path = Pathname.new(url) <ide> if @name.nil? <add> %r{github.com/\S+/(\S+)/archive/}.match url <add> @name ||= $1 <ide> /(.*?)[-_.]?#{path.version}/.match path.basename <del> @name = $1 <del> @path = Formula.path $1 unless $1.nil? <add> @name ||= $1 <add> @path = Formula.path @name unless @name.nil? <ide> else <ide> @path = Formula.path name <ide> end
1
Text
Text
fix gaussian noise doc
7c8d9aaf6b6873a67c6576e860df89b96ba09250
<ide><path>docs/sources/layers/noise.md <ide> ```python <ide> keras.layers.core.GaussianNoise(sigma) <ide> ``` <del>Apply to the input an additive zero-centred gaussian noise with standard deviation `sigma`. Gaussian Noise (GS) is a natural choise as corruption process for real valued inputs. <add>Apply to the input an additive zero-centred gaussian noise with standard deviation `sigma`. This is useful to mitigate overfitting (you could see it as a kind of random data augmentation). Gaussian Noise (GS) is a natural choice as corruption process for real valued inputs. <add> <add>The gaussian noise is only added at training time. <ide> <ide> - __Input shape__: This layer does not assume a specific input shape. <ide>
1
Python
Python
set version to v2.1.0a4
a31d557f2d5bd3d00d23972241cbcb6c6cbbdff7
<ide><path>spacy/about.py <ide> # fmt: off <ide> <ide> __title__ = "spacy-nightly" <del>__version__ = "2.1.0a3" <add>__version__ = "2.1.0a4" <ide> __summary__ = "Industrial-strength Natural Language Processing (NLP) with Python and Cython" <ide> __uri__ = "https://spacy.io" <ide> __author__ = "Explosion AI"
1
Ruby
Ruby
prefix => nil
cacb44874fd5dad608268325b00b4c0058950420
<ide><path>activesupport/lib/active_support/core_ext/module/delegation.rb <ide> def delegate(*methods) <ide> raise ArgumentError, "Can only automatically set the delegation prefix when delegating to a method." <ide> end <ide> <del> prefix = options[:prefix] && "#{options[:prefix] == true ? to : options[:prefix]}_" <add> prefix = options[:prefix] && "#{options[:prefix] == true ? to : options[:prefix]}_" || '' <ide> <ide> file, line = caller.first.split(':', 2) <ide> line = line.to_i <ide><path>activesupport/test/core_ext/module_test.rb <ide> class De <ide> delegate :to_f, :to => :description, :allow_nil => true <ide> end <ide> <add>Developer = Struct.new(:client) do <add> delegate :name, :to => :client, :prefix => nil <add>end <add> <add>Tester = Struct.new(:client) do <add> delegate :name, :to => :client, :prefix => false <add>end <add> <ide> class Name <ide> delegate :upcase, :to => :@full_name <ide> <ide> def test_delegation_custom_prefix <ide> assert_equal invoice.customer_city, "Chicago" <ide> end <ide> <add> def test_delegation_prefix_with_nil_or_false <add> assert_equal Developer.new(@david).name, "David" <add> assert_equal Tester.new(@david).name, "David" <add> end <add> <ide> def test_delegation_prefix_with_instance_variable <ide> assert_raise ArgumentError do <ide> Class.new do
2
Text
Text
translate 10.6-create-fragment.md to japanese
2b35ba6f406796752cb7d95d635e0d26358a05dc
<ide><path>docs/docs/10.6-create-fragment.ja-JP.md <add>--- <add>id: create-fragment <add>title: キー付けされたフラグメント <add>permalink: create-fragment-ja-JP.html <add>prev: clone-with-props-ja-JP.html <add>next: update-ja-JP.html <add>--- <add> <add>多くの場合、 `render` から返された要素のキーを特定するために、 `key` プロパティを使用します。しかし、以下のような特定の状況では、こういったことを行うことはできません。何度も並び替える必要のある2つの子要素を持っているときには、ラッパーの要素を加える以外にそれぞれのセットのキーを追加する方法はありません。 <add> <add>これは、以下のようなコンポーネントがある場合には、 <add> <add>```js <add>var Swapper = React.createClass({ <add> propTypes: { <add> // `leftChildren` と `rightChildren` は文字列や、要素や、配列などになり得ます。 <add> leftChildren: React.PropTypes.node, <add> rightChildren: React.PropTypes.node, <add> <add> swapped: React.PropTypes.bool <add> } <add> render: function() { <add> var children; <add> if (this.props.swapped) { <add> children = [this.props.rightChildren, this.props.leftChildren]; <add> } else { <add> children = [this.props.leftChildren, this.props.rightChildren]; <add> } <add> return <div>{children}</div>; <add> } <add>}); <add>``` <add> <add>2つの子要素のセットを表すキーがないため、 `swapped` プロパティを変更するたびに子要素はアンマウントされ、再度マウントされます。 <add> <add>この問題を解決するために、子要素のセットのキーを与える `React.addons.createFragment` を使用することができます。 <add> <add>#### `ReactFragment React.addons.createFragment(object children)` <add> <add>配列を作成する代わりに、以下のように記述することができます。 <add> <add>```js <add>if (this.props.swapped) { <add> children = React.addons.createFragment({ <add> right: this.props.rightChildren, <add> left: this.props.leftChildren <add> }); <add>} else { <add> children = React.addons.createFragment({ <add> left: this.props.leftChildren, <add> right: this.props.rightChildren <add> }); <add>} <add>``` <add> <add>渡されたオブジェクトのキー(`left` や `right` のことです)は子要素のセット全体のキーとして使用され、そのオブジェクトのキーの順序はレンダリングされた子要素の順序を決める際に使用されます。この変更により、2つの子要素のセットはアンマウントされることなく、DOMの中で適切に順序立てられます。 <add> <add>`createFragment` の戻り値は、不透明なオブジェクトとして扱われるべきです。つまり、 `React.Children` ヘルパーを、フラグメントのなかでループするために使用することはできますが、直接アクセスするべきではないということです。私たちはいまオブジェクトの一覧における順序を保存するのにJavaScriptのエンジンに頼っていることに注意してください。それは、仕様が保証されているわけではありませんが、数に関するものではないキーとオブジェクトは全てのメジャーなブラウザやVMで実行されます。 <add> <add>> **注意:** <add>> 将来、 `createFragment` は以下のようなAPIに変わるでしょう。 <add>> <add>> ```js <add>> return ( <add>> <div> <add>> <x:frag key="right">{this.props.rightChildren}</x:frag>, <add>> <x:frag key="left">{this.props.leftChildren}</x:frag> <add>> </div> <add>> ); <add>> ``` <add>> <add>> ラッパーの要素を加えることなく、JSXの中に直接キーをアサインすることができます。
1
Python
Python
fix empty tensor and create test
d9680f61c81d70de0687e38dd52a0338c2a75931
<ide><path>keras/layers/convolutional.py <ide> def compute_output_shape(self, input_shape): <ide> return tf.TensorShape([input_shape[0], length, input_shape[2]]) <ide> <ide> def call(self, inputs): <del> if sum(self.cropping) >= inputs.shape[1]: <add> if tf.not_equal(tf.size(inputs), 0) and sum(self.cropping) >= inputs.shape[1]: <ide> raise ValueError( <ide> 'cropping parameter of Cropping layer is too high,' + <ide> 'the result of crop' + str(inputs.shape) + ' with cropping ' + <ide><path>keras/layers/convolutional_test.py <ide> from tensorflow.python.framework import test_util <ide> from keras import keras_parameterized <ide> from keras import testing_utils <add>from tensorflow.python.types.core import Value <ide> <ide> <ide> @keras_parameterized.run_all_keras_modes <ide> def test_cropping_1d(self): <ide> keras.layers.Cropping1D(cropping=(1, 1, 1)) <ide> with self.assertRaises(ValueError): <ide> keras.layers.Cropping1D(cropping=None) <add> with self.assertRaises(ValueError): <add> input_layer = keras.layers.Input(shape=(num_samples, time_length, input_len_dim1)) <add> crop = keras.layers.Cropping1D(cropping=(2,3))(input_layer) <ide> <ide> def test_cropping_2d(self): <ide> num_samples = 2
2
PHP
PHP
pass getbindings through to querybuilder
f0efda482ebf0d76bc3478257655a2e079c11cd7
<ide><path>src/Illuminate/Database/Eloquent/Builder.php <ide> class Builder { <ide> * @var array <ide> */ <ide> protected $passthru = array( <del> 'toSql', 'lists', 'insert', 'insertGetId', 'pluck', <del> 'count', 'min', 'max', 'avg', 'sum', 'exists', <add> 'toSql', 'lists', 'insert', 'insertGetId', 'pluck', 'count', <add> 'min', 'max', 'avg', 'sum', 'exists', 'getBindings', <ide> ); <ide> <ide> /**
1
Ruby
Ruby
fix an ar test of relations_test when using oracle
66cc3c7aa7b3aa2593cf10df728ad5d8ce71adcd
<ide><path>activerecord/test/cases/relations_test.rb <ide> def test_presence <ide> end <ide> <ide> test "relations don't load all records in #inspect" do <del> assert_sql(/LIMIT/) do <add> assert_sql(/LIMIT|ROWNUM <=|FETCH FIRST/) do <ide> Post.all.inspect <ide> end <ide> end
1
Javascript
Javascript
use dots reporter by default
a83d64605f76128de7e208692c8b081d3f21fe59
<ide><path>karma-shared.conf.js <ide> module.exports = function(config, specificOptions) { <ide> browserDisconnectTimeout: 10000, <ide> browserDisconnectTolerance: 2, <ide> browserNoActivityTimeout: 30000, <del> reporters: ['spec'], <add> reporters: ['dots'], <ide> specReporter: { <ide> maxLogLines: 5, // limit number of lines logged per test <ide> suppressErrorSummary: true, // do not print error summary
1
Text
Text
fix netstat command for linux/macos/wsl
aea37058bf5b12c3b0a923e8b977a82b3ec55838
<ide><path>docs/how-to-setup-freecodecamp-locally.md <ide> If you can't sign in, and instead you see a banner with an error message that it <ide> **On Linux / macOS / WSL on Windows - From Terminal:** <ide> <ide> ```console <del>netstat -ab | grep "3000" <add>netstat -a | grep "3000" <ide> <ide> tcp4 0 0 0.0.0.0:3000 DESKTOP LISTEN <ide> ```
1
Ruby
Ruby
fix ruby warnings
f8bd01cdd9a0ce77cd51b43f82f85df33df762fb
<ide><path>activesupport/test/dependencies_test.rb <ide> def test_module_with_nested_inline_class <ide> <ide> def test_module_with_nested_class_requiring_lib_class <ide> with_autoloading_fixtures do <del> ModuleFolder::NestedWithRequire <add> _ = ModuleFolder::NestedWithRequire # assignment to silence parse-time warning "possibly useless use of :: in void context" <ide> <ide> assert defined?(ModuleFolder::LibClass) <ide> assert_not ActiveSupport::Dependencies.autoloaded_constants.include?("ModuleFolder::LibClass") <ide> def test_module_with_nested_class_requiring_lib_class <ide> <ide> def test_module_with_nested_class_and_parent_requiring_lib_class <ide> with_autoloading_fixtures do <del> NestedWithRequireParent <add> _ = NestedWithRequireParent # assignment to silence parse-time warning "possibly useless use of a constant in void context" <ide> <ide> assert defined?(ModuleFolder::LibClass) <ide> assert_not ActiveSupport::Dependencies.autoloaded_constants.include?("ModuleFolder::LibClass")
1
Mixed
Javascript
make early hints generic
37f1e4bf4fa8942f52b5b28bd678afd31d2d911c
<ide><path>doc/api/http.md <ide> Sends an HTTP/1.1 100 Continue message to the client, indicating that <ide> the request body should be sent. See the [`'checkContinue'`][] event on <ide> `Server`. <ide> <del>### `response.writeEarlyHints(links[, callback])` <add>### `response.writeEarlyHints(hints[, callback])` <ide> <ide> <!-- YAML <ide> added: REPLACEME <add>changes: <add> - version: REPLACEME <add> pr-url: https://github.com/nodejs/node/pull/44820 <add> description: Allow passing hints as an object. <ide> --> <ide> <del>* `links` {string|Array} <add>* `hints` {Object} <ide> * `callback` {Function} <ide> <ide> Sends an HTTP/1.1 103 Early Hints message to the client with a Link header, <ide> indicating that the user agent can preload/preconnect the linked resources. <del>The `links` can be a string or an array of strings containing the values <del>of the `Link` header. The optional `callback` argument will be called when <add>The `hints` is an object containing the values of headers to be sent with <add>early hints message. The optional `callback` argument will be called when <ide> the response message has been written. <ide> <ide> **Example** <ide> <ide> ```js <ide> const earlyHintsLink = '</styles.css>; rel=preload; as=style'; <del>response.writeEarlyHints(earlyHintsLink); <add>response.writeEarlyHints({ <add> 'link': earlyHintsLink, <add>}); <ide> <ide> const earlyHintsLinks = [ <ide> '</styles.css>; rel=preload; as=style', <ide> '</scripts.js>; rel=preload; as=script', <ide> ]; <del>response.writeEarlyHints(earlyHintsLinks); <add>response.writeEarlyHints({ <add> 'link': earlyHintsLinks, <add> 'x-trace-id': 'id for diagnostics' <add>}); <ide> <ide> const earlyHintsCallback = () => console.log('early hints message sent'); <ide> response.writeEarlyHints(earlyHintsLinks, earlyHintsCallback); <ide><path>lib/_http_server.js <ide> const { <ide> const { <ide> validateInteger, <ide> validateBoolean, <del> validateLinkHeaderValue <add> validateLinkHeaderValue, <add> validateObject <ide> } = require('internal/validators'); <ide> const Buffer = require('buffer').Buffer; <ide> const { setInterval, clearInterval } = require('timers'); <ide> ServerResponse.prototype.writeProcessing = function writeProcessing(cb) { <ide> this._writeRaw('HTTP/1.1 102 Processing\r\n\r\n', 'ascii', cb); <ide> }; <ide> <del>ServerResponse.prototype.writeEarlyHints = function writeEarlyHints(links, cb) { <add>ServerResponse.prototype.writeEarlyHints = function writeEarlyHints(hints, cb) { <ide> let head = 'HTTP/1.1 103 Early Hints\r\n'; <ide> <del> if (typeof links === 'string') { <del> validateLinkHeaderValue(links, 'links'); <del> head += 'Link: ' + links + '\r\n'; <del> } else if (ArrayIsArray(links)) { <del> if (!links.length) { <del> return; <del> } <add> validateObject(hints, 'hints'); <ide> <del> head += 'Link: '; <add> if (hints.link === null || hints.link === undefined) { <add> return; <add> } <ide> <del> for (let i = 0; i < links.length; i++) { <del> const link = links[i]; <del> validateLinkHeaderValue(link, 'links'); <del> head += link; <add> const link = validateLinkHeaderValue(hints.link); <ide> <del> if (i !== links.length - 1) { <del> head += ', '; <del> } <del> } <add> if (link.length === 0) { <add> return; <add> } <ide> <del> head += '\r\n'; <del> } else { <del> throw new ERR_INVALID_ARG_VALUE( <del> 'links', <del> links, <del> 'must be an array or string of format "</styles.css>; rel=preload; as=style"' <del> ); <add> head += 'Link: ' + link + '\r\n'; <add> <add> for (const key of ObjectKeys(hints)) { <add> if (key !== 'link') { <add> head += key + ': ' + hints[key] + '\r\n'; <add> } <ide> } <ide> <ide> head += '\r\n'; <ide><path>lib/internal/http2/compat.js <ide> const { <ide> validateFunction, <ide> validateString, <ide> validateLinkHeaderValue, <add> validateObject, <ide> } = require('internal/validators'); <ide> const { <ide> kSocket, <ide> class Http2ServerResponse extends Stream { <ide> return true; <ide> } <ide> <del> writeEarlyHints(links) { <del> let linkHeaderValue = ''; <add> writeEarlyHints(hints) { <add> validateObject(hints, 'hints'); <ide> <del> if (typeof links === 'string') { <del> validateLinkHeaderValue(links, 'links'); <del> linkHeaderValue += links; <del> } else if (ArrayIsArray(links)) { <del> if (!links.length) { <del> return; <del> } <del> <del> linkHeaderValue += ''; <add> const headers = ObjectCreate(null); <ide> <del> for (let i = 0; i < links.length; i++) { <del> const link = links[i]; <del> validateLinkHeaderValue(link, 'links'); <del> linkHeaderValue += link; <add> const linkHeaderValue = validateLinkHeaderValue(hints.link); <ide> <del> if (i !== links.length - 1) { <del> linkHeaderValue += ', '; <del> } <add> for (const key of ObjectKeys(hints)) { <add> if (key !== 'link') { <add> headers[key] = hints[key]; <ide> } <del> } else { <del> throw new ERR_INVALID_ARG_VALUE( <del> 'links', <del> links, <del> 'must be an array or string of format "</styles.css>; rel=preload; as=style"' <del> ); <add> } <add> <add> if (linkHeaderValue.length === 0) { <add> return false; <ide> } <ide> <ide> const stream = this[kStream]; <ide> class Http2ServerResponse extends Stream { <ide> return false; <ide> <ide> stream.additionalHeaders({ <add> ...headers, <ide> [HTTP2_HEADER_STATUS]: HTTP_STATUS_EARLY_HINTS, <del> 'Link': linkHeaderValue <add> 'Link': linkHeaderValue, <ide> }); <ide> <ide> return true; <ide><path>lib/internal/validators.js <ide> function validateUnion(value, name, union) { <ide> } <ide> } <ide> <del>function validateLinkHeaderValue(value, name) { <del> const linkValueRegExp = /^(?:<[^>]*>;)\s*(?:rel=(")?[^;"]*\1;?)\s*(?:(?:as|anchor|title)=(")?[^;"]*\2)?$/; <add>const linkValueRegExp = /^(?:<[^>]*>;)\s*(?:rel=(")?[^;"]*\1;?)\s*(?:(?:as|anchor|title)=(")?[^;"]*\2)?$/; <ide> <add>/** <add> * @param {any} value <add> * @param {string} name <add> */ <add>function validateLinkHeaderFormat(value, name) { <ide> if ( <ide> typeof value === 'undefined' || <ide> !RegExpPrototypeExec(linkValueRegExp, value) <ide> const validateInternalField = hideStackFrames((object, fieldKey, className) => { <ide> } <ide> }); <ide> <add>/** <add> * @param {any} hints <add> * @return {string} <add> */ <add>function validateLinkHeaderValue(hints) { <add> if (typeof hints === 'string') { <add> validateLinkHeaderFormat(hints, 'hints'); <add> return hints; <add> } else if (ArrayIsArray(hints)) { <add> const hintsLength = hints.length; <add> let result = ''; <add> <add> if (hintsLength === 0) { <add> return result; <add> } <add> <add> for (let i = 0; i < hintsLength; i++) { <add> const link = hints[i]; <add> validateLinkHeaderFormat(link, 'hints'); <add> result += link; <add> <add> if (i !== hintsLength - 1) { <add> result += ', '; <add> } <add> } <add> <add> return result; <add> } <add> <add> throw new ERR_INVALID_ARG_VALUE( <add> 'hints', <add> hints, <add> 'must be an array or string of format "</styles.css>; rel=preload; as=style"' <add> ); <add>} <add> <ide> module.exports = { <ide> isInt32, <ide> isUint32, <ide><path>test/parallel/test-http-early-hints-invalid-argument-type.js <del>'use strict'; <del>const common = require('../common'); <del>const assert = require('node:assert'); <del>const http = require('node:http'); <del>const debug = require('node:util').debuglog('test'); <del> <del>const testResBody = 'response content\n'; <del> <del>const server = http.createServer(common.mustCall((req, res) => { <del> debug('Server sending early hints...'); <del> res.writeEarlyHints({ links: 'bad argument object' }); <del> <del> debug('Server sending full response...'); <del> res.end(testResBody); <del>})); <del> <del>server.listen(0, common.mustCall(() => { <del> const req = http.request({ <del> port: server.address().port, path: '/' <del> }); <del> <del> req.end(); <del> debug('Client sending request...'); <del> <del> req.on('information', common.mustNotCall()); <del> <del> process.on('uncaughtException', (err) => { <del> debug(`Caught an exception: ${JSON.stringify(err)}`); <del> if (err.name === 'AssertionError') throw err; <del> assert.strictEqual(err.code, 'ERR_INVALID_ARG_VALUE'); <del> process.exit(0); <del> }); <del>})); <ide><path>test/parallel/test-http-early-hints-invalid-argument.js <ide> const testResBody = 'response content\n'; <ide> <ide> const server = http.createServer(common.mustCall((req, res) => { <ide> debug('Server sending early hints...'); <del> res.writeEarlyHints('bad argument value'); <add> res.writeEarlyHints('bad argument type'); <ide> <ide> debug('Server sending full response...'); <ide> res.end(testResBody); <ide> server.listen(0, common.mustCall(() => { <ide> process.on('uncaughtException', (err) => { <ide> debug(`Caught an exception: ${JSON.stringify(err)}`); <ide> if (err.name === 'AssertionError') throw err; <del> assert.strictEqual(err.code, 'ERR_INVALID_ARG_VALUE'); <add> assert.strictEqual(err.code, 'ERR_INVALID_ARG_TYPE'); <ide> process.exit(0); <ide> }); <ide> })); <ide><path>test/parallel/test-http-early-hints.js <ide> const testResBody = 'response content\n'; <ide> <ide> const server = http.createServer(common.mustCall((req, res) => { <ide> debug('Server sending early hints...'); <del> res.writeEarlyHints('</styles.css>; rel=preload; as=style'); <add> res.writeEarlyHints({ <add> link: '</styles.css>; rel=preload; as=style' <add> }); <ide> <ide> debug('Server sending full response...'); <ide> res.end(testResBody); <ide> const testResBody = 'response content\n'; <ide> <ide> const server = http.createServer(common.mustCall((req, res) => { <ide> debug('Server sending early hints...'); <del> res.writeEarlyHints([ <del> '</styles.css>; rel=preload; as=style', <del> '</scripts.js>; rel=preload; as=script', <del> ]); <add> res.writeEarlyHints({ <add> link: [ <add> '</styles.css>; rel=preload; as=style', <add> '</scripts.js>; rel=preload; as=script', <add> ] <add> }); <ide> <ide> debug('Server sending full response...'); <ide> res.end(testResBody); <ide> const testResBody = 'response content\n'; <ide> <ide> const server = http.createServer(common.mustCall((req, res) => { <ide> debug('Server sending early hints...'); <del> res.writeEarlyHints([]); <add> res.writeEarlyHints({ <add> link: [] <add> }); <add> <add> debug('Server sending full response...'); <add> res.end(testResBody); <add> })); <add> <add> server.listen(0, common.mustCall(() => { <add> const req = http.request({ <add> port: server.address().port, path: '/' <add> }); <add> debug('Client sending request...'); <add> <add> req.on('information', common.mustNotCall()); <add> <add> req.on('response', common.mustCall((res) => { <add> let body = ''; <add> <add> assert.strictEqual(res.statusCode, 200, `Final status code was ${res.statusCode}, not 200.`); <add> <add> res.on('data', (chunk) => { <add> body += chunk; <add> }); <add> <add> res.on('end', common.mustCall(() => { <add> debug('Got full response.'); <add> assert.strictEqual(body, testResBody); <add> server.close(); <add> })); <add> })); <add> <add> req.end(); <add> })); <add>} <add> <add>{ <add> // Happy flow - object argument with string <add> <add> const server = http.createServer(common.mustCall((req, res) => { <add> debug('Server sending early hints...'); <add> res.writeEarlyHints({ <add> 'link': '</styles.css>; rel=preload; as=style', <add> 'x-trace-id': 'id for diagnostics' <add> }); <add> <add> debug('Server sending full response...'); <add> res.end(testResBody); <add> })); <add> <add> server.listen(0, common.mustCall(() => { <add> const req = http.request({ <add> port: server.address().port, path: '/' <add> }); <add> debug('Client sending request...'); <add> <add> req.on('information', common.mustCall((res) => { <add> assert.strictEqual( <add> res.headers.link, <add> '</styles.css>; rel=preload; as=style' <add> ); <add> assert.strictEqual(res.headers['x-trace-id'], 'id for diagnostics'); <add> })); <add> <add> req.on('response', common.mustCall((res) => { <add> let body = ''; <add> <add> assert.strictEqual(res.statusCode, 200, `Final status code was ${res.statusCode}, not 200.`); <add> <add> res.on('data', (chunk) => { <add> body += chunk; <add> }); <add> <add> res.on('end', common.mustCall(() => { <add> debug('Got full response.'); <add> assert.strictEqual(body, testResBody); <add> server.close(); <add> })); <add> })); <add> <add> req.end(); <add> })); <add>} <add> <add>{ <add> // Happy flow - object argument with array of strings <add> <add> const server = http.createServer(common.mustCall((req, res) => { <add> debug('Server sending early hints...'); <add> res.writeEarlyHints({ <add> 'link': [ <add> '</styles.css>; rel=preload; as=style', <add> '</scripts.js>; rel=preload; as=script', <add> ], <add> 'x-trace-id': 'id for diagnostics' <add> }); <add> <add> debug('Server sending full response...'); <add> res.end(testResBody); <add> })); <add> <add> server.listen(0, common.mustCall(() => { <add> const req = http.request({ <add> port: server.address().port, path: '/' <add> }); <add> debug('Client sending request...'); <add> <add> req.on('information', common.mustCall((res) => { <add> assert.strictEqual( <add> res.headers.link, <add> '</styles.css>; rel=preload; as=style, </scripts.js>; rel=preload; as=script' <add> ); <add> assert.strictEqual(res.headers['x-trace-id'], 'id for diagnostics'); <add> })); <add> <add> req.on('response', common.mustCall((res) => { <add> let body = ''; <add> <add> assert.strictEqual(res.statusCode, 200, `Final status code was ${res.statusCode}, not 200.`); <add> <add> res.on('data', (chunk) => { <add> body += chunk; <add> }); <add> <add> res.on('end', common.mustCall(() => { <add> debug('Got full response.'); <add> assert.strictEqual(body, testResBody); <add> server.close(); <add> })); <add> })); <add> <add> req.end(); <add> })); <add>} <add> <add>{ <add> // Happy flow - empty object <add> <add> const server = http.createServer(common.mustCall((req, res) => { <add> debug('Server sending early hints...'); <add> res.writeEarlyHints({}); <ide> <ide> debug('Server sending full response...'); <ide> res.end(testResBody); <ide><path>test/parallel/test-http2-compat-write-early-hints-invalid-argument-type.js <ide> const debug = require('node:util').debuglog('test'); <ide> <ide> const testResBody = 'response content'; <ide> <del>const server = http2.createServer(); <add>{ <add> // Invalid object value <ide> <del>server.on('request', common.mustCall((req, res) => { <del> debug('Server sending early hints...'); <del> res.writeEarlyHints({ links: 'bad argument object' }); <add> const server = http2.createServer(); <ide> <del> debug('Server sending full response...'); <del> res.end(testResBody); <del>})); <add> server.on('request', common.mustCall((req, res) => { <add> debug('Server sending early hints...'); <add> res.writeEarlyHints('this should not be here'); <ide> <del>server.listen(0); <add> debug('Server sending full response...'); <add> res.end(testResBody); <add> })); <ide> <del>server.on('listening', common.mustCall(() => { <del> const client = http2.connect(`http://localhost:${server.address().port}`); <del> const req = client.request(); <add> server.listen(0); <ide> <del> debug('Client sending request...'); <add> server.on('listening', common.mustCall(() => { <add> const client = http2.connect(`http://localhost:${server.address().port}`); <add> const req = client.request(); <ide> <del> req.on('headers', common.mustNotCall()); <add> debug('Client sending request...'); <ide> <del> process.on('uncaughtException', (err) => { <del> debug(`Caught an exception: ${JSON.stringify(err)}`); <del> if (err.name === 'AssertionError') throw err; <del> assert.strictEqual(err.code, 'ERR_INVALID_ARG_VALUE'); <del> process.exit(0); <del> }); <del>})); <add> req.on('headers', common.mustNotCall()); <add> <add> process.on('uncaughtException', (err) => { <add> debug(`Caught an exception: ${JSON.stringify(err)}`); <add> if (err.name === 'AssertionError') throw err; <add> assert.strictEqual(err.code, 'ERR_INVALID_ARG_TYPE'); <add> process.exit(0); <add> }); <add> })); <add>} <ide><path>test/parallel/test-http2-compat-write-early-hints-invalid-argument-value.js <add>'use strict'; <add> <add>const common = require('../common'); <add>if (!common.hasCrypto) common.skip('missing crypto'); <add> <add>const assert = require('node:assert'); <add>const http2 = require('node:http2'); <add>const debug = require('node:util').debuglog('test'); <add> <add>const testResBody = 'response content'; <add> <add>{ <add> // Invalid link header value <add> <add> const server = http2.createServer(); <add> <add> server.on('request', common.mustCall((req, res) => { <add> debug('Server sending early hints...'); <add> res.writeEarlyHints({ link: BigInt(100) }); <add> <add> debug('Server sending full response...'); <add> res.end(testResBody); <add> })); <add> <add> server.listen(0); <add> <add> server.on('listening', common.mustCall(() => { <add> const client = http2.connect(`http://localhost:${server.address().port}`); <add> const req = client.request(); <add> <add> debug('Client sending request...'); <add> <add> req.on('headers', common.mustNotCall()); <add> <add> process.on('uncaughtException', (err) => { <add> debug(`Caught an exception: ${JSON.stringify(err)}`); <add> if (err.name === 'AssertionError') throw err; <add> assert.strictEqual(err.code, 'ERR_INVALID_ARG_VALUE'); <add> process.exit(0); <add> }); <add> })); <add>} <ide><path>test/parallel/test-http2-compat-write-early-hints-invalid-argument.js <del>'use strict'; <del> <del>const common = require('../common'); <del>if (!common.hasCrypto) common.skip('missing crypto'); <del> <del>const assert = require('node:assert'); <del>const http2 = require('node:http2'); <del>const debug = require('node:util').debuglog('test'); <del> <del>const testResBody = 'response content'; <del> <del>const server = http2.createServer(); <del> <del>server.on('request', common.mustCall((req, res) => { <del> debug('Server sending early hints...'); <del> res.writeEarlyHints('bad argument value'); <del> <del> debug('Server sending full response...'); <del> res.end(testResBody); <del>})); <del> <del>server.listen(0); <del> <del>server.on('listening', common.mustCall(() => { <del> const client = http2.connect(`http://localhost:${server.address().port}`); <del> const req = client.request(); <del> <del> debug('Client sending request...'); <del> <del> req.on('headers', common.mustNotCall()); <del> <del> process.on('uncaughtException', (err) => { <del> debug(`Caught an exception: ${JSON.stringify(err)}`); <del> if (err.name === 'AssertionError') throw err; <del> assert.strictEqual(err.code, 'ERR_INVALID_ARG_VALUE'); <del> process.exit(0); <del> }); <del>})); <ide><path>test/parallel/test-http2-compat-write-early-hints.js <ide> const testResBody = 'response content'; <ide> <ide> server.on('request', common.mustCall((req, res) => { <ide> debug('Server sending early hints...'); <del> res.writeEarlyHints('</styles.css>; rel=preload; as=style'); <add> res.writeEarlyHints({ <add> link: '</styles.css>; rel=preload; as=style' <add> }); <ide> <ide> debug('Server sending full response...'); <ide> res.end(testResBody); <ide> const testResBody = 'response content'; <ide> <ide> server.on('request', common.mustCall((req, res) => { <ide> debug('Server sending early hints...'); <del> res.writeEarlyHints([ <del> '</styles.css>; rel=preload; as=style', <del> '</scripts.js>; rel=preload; as=script', <del> ]); <add> res.writeEarlyHints({ <add> link: [ <add> '</styles.css>; rel=preload; as=style', <add> '</scripts.js>; rel=preload; as=script', <add> ] <add> }); <ide> <ide> debug('Server sending full response...'); <ide> res.end(testResBody); <ide> const testResBody = 'response content'; <ide> <ide> server.on('request', common.mustCall((req, res) => { <ide> debug('Server sending early hints...'); <del> res.writeEarlyHints([]); <add> res.writeEarlyHints({ <add> link: [] <add> }); <ide> <ide> debug('Server sending full response...'); <ide> res.end(testResBody);
11
Text
Text
unify ar changelog entries [ci skip]
de615b38b32273a26ccf3481dcabdcb9363521d6
<ide><path>activerecord/CHANGELOG.md <ide> internal operations to fail (sqlite3 adapter only). The method <ide> `allowed_index_name_length` defines the length limit enforced by <ide> rails. It's value defaults to `index_name_length` but can vary per adapter. <del> Fix #8264. <add> Fixes #8264. <ide> <ide> *Yves Senn* <ide> <ide> *John Wang* <ide> <ide> * Descriptive error message when the necessary AR adapter gem was not found. <del> Fix #7313 <add> Fixes #7313. <ide> <ide> *Yves Senn* <ide> <ide> *Lilibeth De La Cruz* <ide> <ide> * When `#count` is used in conjunction with `#uniq` we perform `count(:distinct => true)`. <del> Fix #6865. <add> Fixes #6865. <ide> <ide> Example: <ide> <ide> *John Wang* <ide> <ide> * Collection associations `#empty?` always respects builded records. <del> Fix #8879. <add> Fixes #8879. <ide> <ide> Example: <ide>
1
Javascript
Javascript
add dir and distdir to resolve log
4945740ac79a3d3296e31e59b93717dac02af401
<ide><path>packages/next/build/webpack.js <ide> export default async function getBaseWebpackConfig (dir: string, {dev = false, i <ide> } <ide> } <ide> <del> console.log('RESOLVE_CONFIG', resolveConfig) <add> console.log('RESOLVE_CONFIG', {dir, distDir}, resolveConfig) <ide> <ide> const webpackMode = dev ? 'development' : 'production' <ide>
1
Text
Text
add cors to the security guide [ci-skip]
bdcd0d35193052c3db82d28e415885c64bcccbc7
<ide><path>guides/source/security.md <ide> end <ide> <ide> [`Feature-Policy`]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy <ide> <add>### Cross-Origin Resource Sharing <add> <add>Browsers restrict cross-origin HTTP requests initiated from scripts. If you <add>want to run Rails as an API, and run a frontend app on a separate domain, you <add>need to enable [Cross-Origin Resource <add>Sharing](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) (CORS). <add> <add>You can use the [Rack CORS](https://github.com/cyu/rack-cors) middleware for <add>handling CORS. If you've generated your application with the `--api` option, <add>Rack CORS has probably already been configured and you can skip the following <add>steps. <add> <add>To get started, add the rack-cors gem to your Gemfile: <add> <add>```ruby <add>gem 'rack-cors' <add>``` <add> <add>Next, add an initializer to configure the middleware: <add> <add>```ruby <add># config/initializers/cors.rb <add>Rails.application.config.middleware.insert_before 0, "Rack::Cors" do <add> allow do <add> origins 'example.com' <add> <add> resource '*', <add> headers: :any, <add> methods: [:get, :post, :put, :patch, :delete, :options, :head] <add> end <add>end <add>``` <add> <ide> Environmental Security <ide> ---------------------- <ide>
1
Javascript
Javascript
fix pipe deadlock when starting with needdrain
ab895bd587ed47423a6baab0bd6934128aa8990d
<ide><path>lib/internal/streams/readable.js <ide> Readable.prototype.pipe = function(dest, pipeOpts) { <ide> ondrain(); <ide> } <ide> <add> function pause() { <add> // If the user unpiped during `dest.write()`, it is possible <add> // to get stuck in a permanently paused state if that write <add> // also returned false. <add> // => Check whether `dest` is still a piping destination. <add> if (!cleanedUp) { <add> if (state.pipes.length === 1 && state.pipes[0] === dest) { <add> debug('false write response, pause', 0); <add> state.awaitDrainWriters = dest; <add> state.multiAwaitDrain = false; <add> } else if (state.pipes.length > 1 && state.pipes.includes(dest)) { <add> debug('false write response, pause', state.awaitDrainWriters.size); <add> state.awaitDrainWriters.add(dest); <add> } <add> src.pause(); <add> } <add> if (!ondrain) { <add> // When the dest drains, it reduces the awaitDrain counter <add> // on the source. This would be more elegant with a .once() <add> // handler in flow(), but adding and removing repeatedly is <add> // too slow. <add> ondrain = pipeOnDrain(src, dest); <add> dest.on('drain', ondrain); <add> } <add> } <add> <ide> src.on('data', ondata); <ide> function ondata(chunk) { <ide> debug('ondata'); <ide> const ret = dest.write(chunk); <ide> debug('dest.write', ret); <ide> if (ret === false) { <del> // If the user unpiped during `dest.write()`, it is possible <del> // to get stuck in a permanently paused state if that write <del> // also returned false. <del> // => Check whether `dest` is still a piping destination. <del> if (!cleanedUp) { <del> if (state.pipes.length === 1 && state.pipes[0] === dest) { <del> debug('false write response, pause', 0); <del> state.awaitDrainWriters = dest; <del> state.multiAwaitDrain = false; <del> } else if (state.pipes.length > 1 && state.pipes.includes(dest)) { <del> debug('false write response, pause', state.awaitDrainWriters.size); <del> state.awaitDrainWriters.add(dest); <del> } <del> src.pause(); <del> } <del> if (!ondrain) { <del> // When the dest drains, it reduces the awaitDrain counter <del> // on the source. This would be more elegant with a .once() <del> // handler in flow(), but adding and removing repeatedly is <del> // too slow. <del> ondrain = pipeOnDrain(src, dest); <del> dest.on('drain', ondrain); <del> } <add> pause(); <ide> } <ide> } <ide> <ide> Readable.prototype.pipe = function(dest, pipeOpts) { <ide> <ide> if (dest.writableNeedDrain === true) { <ide> if (state.flowing) { <del> src.pause(); <add> pause(); <ide> } <ide> } else if (!state.flowing) { <ide> debug('pipe resume'); <ide><path>test/parallel/test-stream-pipe-needDrain.js <ide> const assert = require('assert'); <ide> const Readable = require('_stream_readable'); <ide> const Writable = require('_stream_writable'); <ide> <del>// Pipe should not continue writing if writable needs drain. <add>// Pipe should pause temporarily if writable needs drain. <ide> { <ide> const w = new Writable({ <ide> write(buf, encoding, callback) { <del> <del> } <add> process.nextTick(callback); <add> }, <add> highWaterMark: 1 <ide> }); <ide> <ide> while (w.write('asd')); <ide> const Writable = require('_stream_writable'); <ide> const r = new Readable({ <ide> read() { <ide> this.push('asd'); <add> this.push(null); <ide> } <ide> }); <ide> <del> w.write = common.mustNotCall(); <add> r.on('pause', common.mustCall(2)); <add> r.on('end', common.mustCall()); <ide> <ide> r.pipe(w); <ide> }
2
Python
Python
add type annotations to s3 hook module
0c77ea8a3c417805f66d10f0c757ca218bf8dee0
<ide><path>airflow/providers/amazon/aws/hooks/s3.py <ide> import shutil <ide> from functools import wraps <ide> from inspect import signature <add>from io import BytesIO <ide> from tempfile import NamedTemporaryFile <del>from typing import Callable, Optional, TypeVar, cast <add>from typing import Any, Callable, Dict, Optional, Tuple, TypeVar, Union, cast <ide> from urllib.parse import urlparse <ide> <add>from boto3.s3.transfer import S3Transfer <ide> from botocore.exceptions import ClientError <ide> <ide> from airflow.exceptions import AirflowException <ide> def provide_bucket_name(func: T) -> T: <ide> function_signature = signature(func) <ide> <ide> @wraps(func) <del> def wrapper(*args, **kwargs): <add> def wrapper(*args, **kwargs) -> T: <ide> bound_args = function_signature.bind(*args, **kwargs) <ide> <ide> if 'bucket_name' not in bound_args.arguments: <ide> def unify_bucket_name_and_key(func: T) -> T: <ide> function_signature = signature(func) <ide> <ide> @wraps(func) <del> def wrapper(*args, **kwargs): <add> def wrapper(*args, **kwargs) -> T: <ide> bound_args = function_signature.bind(*args, **kwargs) <ide> <del> def get_key_name(): <add> def get_key_name() -> Optional[str]: <ide> if 'wildcard_key' in bound_args.arguments: <ide> return 'wildcard_key' <ide> if 'key' in bound_args.arguments: <ide> def __init__(self, *args, **kwargs): <ide> super().__init__(client_type='s3', *args, **kwargs) <ide> <ide> @staticmethod <del> def parse_s3_url(s3url): <add> def parse_s3_url(s3url: str) -> Tuple[str, str]: <ide> """ <ide> Parses the S3 Url into a bucket name and key. <ide> <ide> def parse_s3_url(s3url): <ide> return bucket_name, key <ide> <ide> @provide_bucket_name <del> def check_for_bucket(self, bucket_name=None): <add> def check_for_bucket(self, bucket_name: Optional[str] = None) -> bool: <ide> """ <ide> Check if bucket_name exists. <ide> <ide> def check_for_bucket(self, bucket_name=None): <ide> return False <ide> <ide> @provide_bucket_name <del> def get_bucket(self, bucket_name=None): <add> def get_bucket(self, bucket_name: Optional[str] = None) -> str: <ide> """ <ide> Returns a boto3.S3.Bucket object <ide> <ide> def get_bucket(self, bucket_name=None): <ide> return s3_resource.Bucket(bucket_name) <ide> <ide> @provide_bucket_name <del> def create_bucket(self, bucket_name=None, region_name=None): <add> def create_bucket(self, <add> bucket_name: Optional[str] = None, <add> region_name: Optional[str] = None) -> None: <ide> """ <ide> Creates an Amazon S3 bucket. <ide> <ide> def create_bucket(self, bucket_name=None, region_name=None): <ide> }) <ide> <ide> @provide_bucket_name <del> def check_for_prefix(self, prefix, delimiter, bucket_name=None): <add> def check_for_prefix(self, <add> prefix: str, <add> delimiter: str, <add> bucket_name: Optional[str] = None) -> bool: <ide> """ <ide> Checks that a prefix exists in a bucket <ide> <ide> def check_for_prefix(self, prefix, delimiter, bucket_name=None): <ide> return False if plist is None else prefix in plist <ide> <ide> @provide_bucket_name <del> def list_prefixes(self, bucket_name=None, prefix='', delimiter='', <del> page_size=None, max_items=None): <add> def list_prefixes(self, <add> bucket_name: Optional[str] = None, <add> prefix: Optional[str] = None, <add> delimiter: Optional[str] = None, <add> page_size: Optional[int] = None, <add> max_items: Optional[int] = None) -> Optional[list]: <ide> """ <ide> Lists prefixes in a bucket under prefix <ide> <ide> def list_prefixes(self, bucket_name=None, prefix='', delimiter='', <ide> :return: a list of matched prefixes and None if there are none. <ide> :rtype: list <ide> """ <add> prefix = prefix or '' <add> delimiter = delimiter or '' <ide> config = { <ide> 'PageSize': page_size, <ide> 'MaxItems': max_items, <ide> def list_prefixes(self, bucket_name=None, prefix='', delimiter='', <ide> return None <ide> <ide> @provide_bucket_name <del> def list_keys(self, bucket_name=None, prefix='', delimiter='', <del> page_size=None, max_items=None): <add> def list_keys(self, <add> bucket_name: Optional[str] = None, <add> prefix: Optional[str] = None, <add> delimiter: Optional[str] = None, <add> page_size: Optional[int] = None, <add> max_items: Optional[int] = None) -> Optional[list]: <ide> """ <ide> Lists keys in a bucket under prefix and not containing delimiter <ide> <ide> def list_keys(self, bucket_name=None, prefix='', delimiter='', <ide> :return: a list of matched keys and None if there are none. <ide> :rtype: list <ide> """ <add> prefix = prefix or '' <add> delimiter = delimiter or '' <ide> config = { <ide> 'PageSize': page_size, <ide> 'MaxItems': max_items, <ide> def list_keys(self, bucket_name=None, prefix='', delimiter='', <ide> <ide> @provide_bucket_name <ide> @unify_bucket_name_and_key <del> def check_for_key(self, key, bucket_name=None): <add> def check_for_key(self, key: str, bucket_name: Optional[str] = None) -> bool: <ide> """ <ide> Checks if a key exists in a bucket <ide> <ide> def check_for_key(self, key, bucket_name=None): <ide> <ide> @provide_bucket_name <ide> @unify_bucket_name_and_key <del> def get_key(self, key, bucket_name=None): <add> def get_key(self, key: str, bucket_name: Optional[str] = None) -> S3Transfer: <ide> """ <ide> Returns a boto3.s3.Object <ide> <ide> def get_key(self, key, bucket_name=None): <ide> <ide> @provide_bucket_name <ide> @unify_bucket_name_and_key <del> def read_key(self, key, bucket_name=None): <add> def read_key(self, key: str, bucket_name: Optional[str] = None) -> S3Transfer: <ide> """ <ide> Reads a key from S3 <ide> <ide> def read_key(self, key, bucket_name=None): <ide> <ide> @provide_bucket_name <ide> @unify_bucket_name_and_key <del> def select_key(self, key, bucket_name=None, <del> expression='SELECT * FROM S3Object', <del> expression_type='SQL', <del> input_serialization=None, <del> output_serialization=None): <add> def select_key(self, <add> key: str, <add> bucket_name: Optional[str] = None, <add> expression: Optional[str] = None, <add> expression_type: Optional[str] = None, <add> input_serialization: Optional[Dict[str, Any]] = None, <add> output_serialization: Optional[Dict[str, Any]] = None) -> str: <ide> """ <ide> Reads a key with S3 Select. <ide> <ide> def select_key(self, key, bucket_name=None, <ide> For more details about S3 Select parameters: <ide> http://boto3.readthedocs.io/en/latest/reference/services/s3.html#S3.Client.select_object_content <ide> """ <add> expression = expression or 'SELECT * FROM S3Object' <add> expression_type = expression_type or 'SQL' <add> <ide> if input_serialization is None: <ide> input_serialization = {'CSV': {}} <ide> if output_serialization is None: <ide> def select_key(self, key, bucket_name=None, <ide> @provide_bucket_name <ide> @unify_bucket_name_and_key <ide> def check_for_wildcard_key(self, <del> wildcard_key, bucket_name=None, delimiter=''): <add> wildcard_key: str, <add> bucket_name: Optional[str] = None, <add> delimiter: str = '') -> bool: <ide> """ <ide> Checks that a key matching a wildcard expression exists in a bucket <ide> <ide> def check_for_wildcard_key(self, <ide> <ide> @provide_bucket_name <ide> @unify_bucket_name_and_key <del> def get_wildcard_key(self, wildcard_key, bucket_name=None, delimiter=''): <add> def get_wildcard_key(self, <add> wildcard_key: str, <add> bucket_name: Optional[str] = None, <add> delimiter: str = '') -> S3Transfer: <ide> """ <ide> Returns a boto3.s3.Object object matching the wildcard expression <ide> <ide> def get_wildcard_key(self, wildcard_key, bucket_name=None, delimiter=''): <ide> @provide_bucket_name <ide> @unify_bucket_name_and_key <ide> def load_file(self, <del> filename, <del> key, <del> bucket_name=None, <del> replace=False, <del> encrypt=False, <del> gzip=False, <del> acl_policy=None): <add> filename: str, <add> key: str, <add> bucket_name: Optional[str] = None, <add> replace: bool = False, <add> encrypt: bool = False, <add> gzip: bool = False, <add> acl_policy: Optional[str] = None) -> None: <ide> """ <ide> Loads a local file to S3 <ide> <ide> def load_file(self, <ide> @provide_bucket_name <ide> @unify_bucket_name_and_key <ide> def load_string(self, <del> string_data, <del> key, <del> bucket_name=None, <del> replace=False, <del> encrypt=False, <del> encoding='utf-8', <del> acl_policy=None): <add> string_data: str, <add> key: str, <add> bucket_name: Optional[str] = None, <add> replace: bool = False, <add> encrypt: bool = False, <add> encoding: Optional[str] = None, <add> acl_policy: Optional[str] = None) -> None: <ide> """ <ide> Loads a string to S3 <ide> <ide> def load_string(self, <ide> object to be uploaded <ide> :type acl_policy: str <ide> """ <add> encoding = encoding or 'utf-8' <add> <ide> bytes_data = string_data.encode(encoding) <ide> file_obj = io.BytesIO(bytes_data) <ide> self._upload_file_obj(file_obj, key, bucket_name, replace, encrypt, acl_policy) <ide> def load_string(self, <ide> @provide_bucket_name <ide> @unify_bucket_name_and_key <ide> def load_bytes(self, <del> bytes_data, <del> key, <del> bucket_name=None, <del> replace=False, <del> encrypt=False, <del> acl_policy=None): <add> bytes_data: bytes, <add> key: str, <add> bucket_name: Optional[str] = None, <add> replace: bool = False, <add> encrypt: bool = False, <add> acl_policy: Optional[str] = None) -> None: <ide> """ <ide> Loads bytes to S3 <ide> <ide> def load_bytes(self, <ide> @provide_bucket_name <ide> @unify_bucket_name_and_key <ide> def load_file_obj(self, <del> file_obj, <del> key, <del> bucket_name=None, <del> replace=False, <del> encrypt=False, <del> acl_policy=None): <add> file_obj: BytesIO, <add> key: str, <add> bucket_name: Optional[str] = None, <add> replace: bool = False, <add> encrypt: bool = False, <add> acl_policy: Optional[str] = None) -> None: <ide> """ <ide> Loads a file object to S3 <ide> <ide> def load_file_obj(self, <ide> self._upload_file_obj(file_obj, key, bucket_name, replace, encrypt, acl_policy) <ide> <ide> def _upload_file_obj(self, <del> file_obj, <del> key, <del> bucket_name=None, <del> replace=False, <del> encrypt=False, <del> acl_policy=None): <add> file_obj: BytesIO, <add> key: str, <add> bucket_name: Optional[str] = None, <add> replace: bool = False, <add> encrypt: bool = False, <add> acl_policy: Optional[str] = None) -> None: <ide> if not replace and self.check_for_key(key, bucket_name): <ide> raise ValueError("The key {key} already exists.".format(key=key)) <ide> <ide> def _upload_file_obj(self, <ide> client.upload_fileobj(file_obj, bucket_name, key, ExtraArgs=extra_args) <ide> <ide> def copy_object(self, <del> source_bucket_key, <del> dest_bucket_key, <del> source_bucket_name=None, <del> dest_bucket_name=None, <del> source_version_id=None, <del> acl_policy='private'): <add> source_bucket_key: str, <add> dest_bucket_key: str, <add> source_bucket_name: Optional[str] = None, <add> dest_bucket_name: Optional[str] = None, <add> source_version_id: Optional[str] = None, <add> acl_policy: Optional[str] = None) -> None: <ide> """ <ide> Creates a copy of an object that is already stored in S3. <ide> <ide> def copy_object(self, <ide> object to be copied which is private by default. <ide> :type acl_policy: str <ide> """ <add> acl_policy = acl_policy or 'private' <ide> <ide> if dest_bucket_name is None: <ide> dest_bucket_name, dest_bucket_key = self.parse_s3_url(dest_bucket_key) <ide> def delete_bucket(self, bucket_name: str, force_delete: bool = False) -> None: <ide> Bucket=bucket_name <ide> ) <ide> <del> def delete_objects(self, bucket, keys): <add> def delete_objects(self, bucket: str, keys: Union[str, list]) -> None: <ide> """ <ide> Delete keys from the bucket. <ide> <ide> def delete_objects(self, bucket, keys): <ide> <ide> @provide_bucket_name <ide> @unify_bucket_name_and_key <del> def download_file( <del> self, <del> key: str, <del> bucket_name: Optional[str] = None, <del> local_path: Optional[str] = None <del> ) -> str: <add> def download_file(self, <add> key: str, <add> bucket_name: Optional[str] = None, <add> local_path: Optional[str] = None) -> str: <ide> """ <ide> Downloads a file from the S3 location to the local file system. <ide> <ide> def download_file( <ide> <ide> return local_tmp_file.name <ide> <del> def generate_presigned_url(self, client_method, params=None, expires_in=3600, http_method=None): <add> def generate_presigned_url(self, <add> client_method: str, <add> params: Optional[dict] = None, <add> expires_in: int = 3600, <add> http_method: Optional[str] = None) -> Optional[str]: <ide> """ <ide> Generate a presigned url given a client, its method, and arguments <ide>
1
Ruby
Ruby
extend callbacks and rescuable with as concern
7b169ed1bb424929e332e998a75cdb4635c26f62
<ide><path>activesupport/lib/active_support/callbacks.rb <ide> module ActiveSupport <ide> # saved <ide> # <ide> module Callbacks <del> def self.included(klass) <del> klass.extend ClassMethods <del> end <add> extend Concern <ide> <ide> def run_callbacks(kind, *args, &block) <ide> send("_run_#{kind}_callbacks", *args, &block) <ide><path>activesupport/lib/active_support/rescuable.rb <ide> module ActiveSupport <ide> # Rescuable module adds support for easier exception handling. <ide> module Rescuable <del> def self.included(base) # :nodoc: <del> base.class_inheritable_accessor :rescue_handlers <del> base.rescue_handlers = [] <add> extend Concern <ide> <del> base.extend(ClassMethods) <add> included do <add> class_inheritable_accessor :rescue_handlers <add> self.rescue_handlers = [] <ide> end <ide> <ide> module ClassMethods
2
Javascript
Javascript
replace getinitialprops with getserversideprops
641976a471d64a99ca997af70f5add55509937b6
<ide><path>examples/with-firebase-authentication/pages/index.js <ide> import 'firebase/firestore' <ide> import 'isomorphic-unfetch' <ide> import clientCredentials from '../credentials/client' <ide> <del>export default class Index extends Component { <del> static async getInitialProps({ req, query }) { <del> const user = req && req.session ? req.session.decodedToken : null <del> // don't fetch anything from firebase if the user is not found <del> // const snap = user && await req.firebaseServer.database().ref('messages').once('value') <del> // const messages = snap && snap.val() <del> const messages = null <del> return { user, messages } <add>export async function getServerSideProps({ req, query }) { <add> const user = req && req.session ? req.session.decodedToken : null <add> // don't fetch anything from firebase if the user is not found <add> // const snap = user && await req.firebaseServer.database().ref('messages').once('value') <add> // const messages = snap && snap.val() <add> const messages = null <add> return { <add> props: { <add> user, <add> messages, <add> }, <ide> } <add>} <ide> <add>export default class Index extends Component { <ide> constructor(props) { <ide> super(props) <ide> this.state = {
1
Text
Text
improve sign/verify examples and docs
273d7dd8b85239c26256f2fbd1510bb5555e4075
<ide><path>doc/api/crypto.md <ide> This can be called many times with new data as it is streamed. <ide> added: v0.1.94 <ide> --> <ide> <del>The `Hmac` Class is a utility for creating cryptographic HMAC digests. It can <add>The `Hmac` class is a utility for creating cryptographic HMAC digests. It can <ide> be used in one of two ways: <ide> <ide> - As a [stream][] that is both readable and writable, where data is written <ide> or `'private'` for private (asymmetric) keys. <ide> added: v0.1.92 <ide> --> <ide> <del>The `Sign` Class is a utility for generating signatures. It can be used in one <add>The `Sign` class is a utility for generating signatures. It can be used in one <ide> of two ways: <ide> <ide> - As a writable [stream][], where data to be signed is written and the <ide> The [`crypto.createSign()`][] method is used to create `Sign` instances. The <ide> argument is the string name of the hash function to use. `Sign` objects are not <ide> to be created directly using the `new` keyword. <ide> <del>Example: Using `Sign` objects as streams: <add>Example: Using `Sign` and [`Verify`][] objects as streams: <ide> <ide> ```js <ide> const crypto = require('crypto'); <del>const sign = crypto.createSign('SHA256'); <ide> <add>const { privateKey, publicKey } = crypto.generateKeyPairSync('ec', { <add> namedCurve: 'sect239k1' <add>}); <add> <add>const sign = crypto.createSign('SHA256'); <ide> sign.write('some data to sign'); <ide> sign.end(); <add>const signature = sign.sign(privateKey, 'hex'); <ide> <del>const privateKey = getPrivateKeySomehow(); <del>console.log(sign.sign(privateKey, 'hex')); <del>// Prints: the calculated signature using the specified private key and <del>// SHA-256. For RSA keys, the algorithm is RSASSA-PKCS1-v1_5 (see padding <del>// parameter below for RSASSA-PSS). For EC keys, the algorithm is ECDSA. <add>const verify = crypto.createVerify('SHA256'); <add>verify.write('some data to sign'); <add>verify.end(); <add>console.log(verify.verify(publicKey, signature)); <add>// Prints: true or false <ide> ``` <ide> <del>Example: Using the [`sign.update()`][] and [`sign.sign()`][] methods: <add>Example: Using the [`sign.update()`][] and [`verify.update()`][] methods: <ide> <ide> ```js <ide> const crypto = require('crypto'); <del>const sign = crypto.createSign('SHA256'); <del> <del>sign.update('some data to sign'); <del> <del>const privateKey = getPrivateKeySomehow(); <del>console.log(sign.sign(privateKey, 'hex')); <del>// Prints: the calculated signature <del>``` <del> <del>In some cases, a `Sign` instance can also be created by passing in a signature <del>algorithm name, such as 'RSA-SHA256'. This will use the corresponding digest <del>algorithm. This does not work for all signature algorithms, such as <del>'ecdsa-with-SHA256'. Use digest names instead. <ide> <del>Example: signing using legacy signature algorithm name <del> <del>```js <del>const crypto = require('crypto'); <del>const sign = crypto.createSign('RSA-SHA256'); <add>const { privateKey, publicKey } = crypto.generateKeyPairSync('rsa', { <add> modulusLength: 2048, <add>}); <ide> <add>const sign = crypto.createSign('SHA256'); <ide> sign.update('some data to sign'); <add>sign.end(); <add>const signature = sign.sign(privateKey); <ide> <del>const privateKey = getPrivateKeySomehow(); <del>console.log(sign.sign(privateKey, 'hex')); <del>// Prints: the calculated signature <add>const verify = crypto.createVerify('SHA256'); <add>verify.update('some data to sign'); <add>verify.end(); <add>console.log(verify.verify(publicKey, signature)); <add>// Prints: true <ide> ``` <ide> <ide> ### sign.sign(privateKey[, outputEncoding]) <ide> of two ways: <ide> The [`crypto.createVerify()`][] method is used to create `Verify` instances. <ide> `Verify` objects are not to be created directly using the `new` keyword. <ide> <del>Example: Using `Verify` objects as streams: <del> <del>```js <del>const crypto = require('crypto'); <del>const verify = crypto.createVerify('SHA256'); <del> <del>verify.write('some data to sign'); <del>verify.end(); <del> <del>const publicKey = getPublicKeySomehow(); <del>const signature = getSignatureToVerify(); <del>console.log(verify.verify(publicKey, signature)); <del>// Prints: true or false <del>``` <del> <del>Example: Using the [`verify.update()`][] and [`verify.verify()`][] methods: <del> <del>```js <del>const crypto = require('crypto'); <del>const verify = crypto.createVerify('SHA256'); <del> <del>verify.update('some data to sign'); <del> <del>const publicKey = getPublicKeySomehow(); <del>const signature = getSignatureToVerify(); <del>console.log(verify.verify(publicKey, signature)); <del>// Prints: true or false <del>``` <add>See [`Sign`][] for examples. <ide> <ide> ### verify.update(data[, inputEncoding]) <ide> <!-- YAML <ide> added: v0.1.92 <ide> * `options` {Object} [`stream.Writable` options][] <ide> * Returns: {Sign} <ide> <del>Creates and returns a `Sign` object that uses the given `algorithm`. <del>Use [`crypto.getHashes()`][] to obtain an array of names of the available <del>signing algorithms. Optional `options` argument controls the <del>`stream.Writable` behavior. <add>Creates and returns a `Sign` object that uses the given `algorithm`. Use <add>[`crypto.getHashes()`][] to obtain the names of the available digest algorithms. <add>Optional `options` argument controls the `stream.Writable` behavior. <add> <add>In some cases, a `Sign` instance can be created using the name of a signature <add>algorithm, such as `'RSA-SHA256'`, instead of a digest algorithm. This will use <add>the corresponding digest algorithm. This does not work for all signature <add>algorithms, such as `'ecdsa-with-SHA256'`, so it is best to always use digest <add>algorithm names. <ide> <ide> ### crypto.createVerify(algorithm[, options]) <ide> <!-- YAML <ide> Use [`crypto.getHashes()`][] to obtain an array of names of the available <ide> signing algorithms. Optional `options` argument controls the <ide> `stream.Writable` behavior. <ide> <add>In some cases, a `Verify` instance can be created using the name of a signature <add>algorithm, such as `'RSA-SHA256'`, instead of a digest algorithm. This will use <add>the corresponding digest algorithm. This does not work for all signature <add>algorithms, such as `'ecdsa-with-SHA256'`, so it is best to always use digest <add>algorithm names. <add> <ide> ### crypto.generateKeyPair(type, options, callback) <ide> <!-- YAML <ide> added: v10.12.0 <ide> added: v10.0.0 <ide> added: v0.9.3 <ide> --> <ide> * Returns: {string[]} An array of the names of the supported hash algorithms, <del> such as `'RSA-SHA256'`. <add> such as `'RSA-SHA256'`. Hash algorithms are also called "digest" algorithms. <ide> <ide> ```js <ide> const hashes = crypto.getHashes(); <ide> the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL. <ide> [`Buffer`]: buffer.html <ide> [`EVP_BytesToKey`]: https://www.openssl.org/docs/man1.1.0/crypto/EVP_BytesToKey.html <ide> [`KeyObject`]: #crypto_class_keyobject <add>[`Sign`]: #crypto_class_sign <ide> [`UV_THREADPOOL_SIZE`]: cli.html#cli_uv_threadpool_size_size <add>[`Verify`]: #crypto_class_verify <ide> [`cipher.final()`]: #crypto_cipher_final_outputencoding <ide> [`cipher.update()`]: #crypto_cipher_update_data_inputencoding_outputencoding <ide> [`crypto.createCipher()`]: #crypto_crypto_createcipher_algorithm_password_options
1
PHP
PHP
remove statereset from emailtest
da4dbea76a6fe77694906a56e9fb740263a44e16
<ide><path>tests/TestCase/Mailer/EmailTest.php <ide> */ <ide> class EmailTest extends TestCase <ide> { <del> /** <del> * @inheritDoc <del> */ <del> protected $stateResetStrategy = TransactionStrategy::class; <del> <ide> protected $fixtures = ['core.Users']; <ide> <ide> /**
1
Javascript
Javascript
fix issue with minified version
3cfbf94245ad525ea46e9395c0f064b12042c87e
<ide><path>src/js/player.js <ide> vjs.Player.prototype.listenForUserActivity = function(){ <ide> if (!this.userActivity_) { <ide> this.userActive(false); <ide> } <del> }), vjs.options.inactivityTimeout); <add> }), vjs.options['inactivityTimeout']); <ide> } <ide> }), 250); <ide>
1
Javascript
Javascript
remove unused templates
2cf3fa8f8c7762285fd283dbe89ff822d0e4c0ea
<ide><path>templates/amd-named.js <del>/*global define:false*/ <del> <del>import moment from "./moment"; <del> <del>define("moment", [], function () { <del> return moment; <del>}); <ide><path>templates/amd.js <del>/*global define:false*/ <del> <del>import moment from "./moment"; <del> <del>define([], function () { <del> return moment; <del>}); <ide><path>templates/globals.js <del>/*global window:false*/ <del> <del>import moment from "./moment"; <del> <del>window.moment = moment;
3
Mixed
Ruby
remove slashes and backslashes from image paths
3c3b80eb96577dda1bfe336fed2bfc0e12bb4873
<ide><path>actionpack/CHANGELOG.md <add>* Replaces (back)slashes in failure screenshot image paths with dashes. <add> <add> If a failed test case contained a slash or a backslash, a screenshot would be created in a <add> nested directory, causing issues with `tmp:clear`. <add> <add> *Damir Zekic* <add> <ide> * Add `params.member?` to mimic Hash behavior <ide> <ide> *Younes Serraj* <ide><path>actionpack/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb <ide> def unique <ide> end <ide> <ide> def image_name <del> name = "#{unique}_#{method_name}" <add> sanitized_method_name = method_name.tr("/\\", "--") <add> name = "#{unique}_#{sanitized_method_name}" <ide> name[0...225] <ide> end <ide> <ide><path>actionpack/test/dispatch/system_testing/screenshot_helper_test.rb <ide> def setup <ide> assert_equal Rails.root.join("tmp/screenshots/0_x.png").to_s, @new_test.send(:image_path) <ide> end <ide> end <add> <add> test "slashes and backslashes are replaced with dashes in paths" do <add> slash_test = DrivenBySeleniumWithChrome.new("x/y\\z") <add> <add> Rails.stub :root, Pathname.getwd do <add> assert_equal Rails.root.join("tmp/screenshots/0_x-y-z.png").to_s, slash_test.send(:image_path) <add> assert_equal Rails.root.join("tmp/screenshots/0_x-y-z.html").to_s, slash_test.send(:html_path) <add> end <add> end <ide> end <ide> <ide> class RackTestScreenshotsTest < DrivenByRackTest
3
Text
Text
update plugin documentation to reflect icon usage
4cb14eb420270db1b136e3c85726b2a3376d64ee
<ide><path>docs/guides/plugins.md <ide> If you've already initialized your video tag, you can activate a plugin at any t <ide> video.examplePlugin({ exampleOption: true }); <ide> <ide> That's it. Head on over to the [Video.js wiki](https://github.com/videojs/video.js/wiki/Plugins) and add your plugin to the list so everyone else can check it out. <add> <add>## How should I use the Video.js icons in my plugin? <add> <add>If you'd like to use any of the icons available in the [Video.js icon set](http://videojs.github.io/font/), please target them via the CSS class names instead of codepoints. The codepoints *may* change between versions of the font, so using the class names ensures that your plugin will stay up to date with any font changes.
1
Ruby
Ruby
add forgotten test/abstract_unit
d954ee21b8d5718794d6e23c1d77e90b77bf0e34
<ide><path>actionmailer/test/abstract_unit.rb <add>require 'test/unit' <add> <add>$:.unshift "#{File.dirname(__FILE__)}/../lib" <add>require 'action_mailer' <add> <add>$:.unshift "#{File.dirname(__FILE__)}/fixtures/helpers" <add>ActionMailer::Base.template_root = "#{File.dirname(__FILE__)}/fixtures"
1
Text
Text
add 17.03.2 changelog
abb615b49ce7bdb6651a493781892f0cb0a94418
<ide><path>CHANGELOG.md <ide> be found. <ide> <ide> * Block pulling Windows images on non-Windows daemons [#29001](https://github.com/docker/docker/pull/29001) <ide> <add>## 17.03.2-ce (2017-05-29) <add> <add>### Networking <add> <add>- Fix a concurrency issue preventing network creation [#33273](https://github.com/moby/moby/pull/33273) <add> <add>### Runtime <add> <add>- Relabel secrets path to avoid a Permission Denied on selinux enabled systems [#33236](https://github.com/moby/moby/pull/33236) (ref [#32529](https://github.com/moby/moby/pull/32529) <add>- Fix cases where local volume were not properly relabeled if needed [#33236](https://github.com/moby/moby/pull/33236) (ref [#29428](https://github.com/moby/moby/pull/29428)) <add>- Fix an issue while upgrading if a plugin rootfs was still mounted [#33236](https://github.com/moby/moby/pull/33236) (ref [#32525](https://github.com/moby/moby/pull/32525)) <add>- Fix an issue where volume wouldn't default to the `rprivate` propagation mode [#33236](https://github.com/moby/moby/pull/33236) (ref [#32851](https://github.com/moby/moby/pull/32851)) <add>- Fix a panic that could occur when a volume driver could not be retrieved [#33236](https://github.com/moby/moby/pull/33236) (ref [#32347](https://github.com/moby/moby/pull/32347)) <add>+ Add a warning in `docker info` when the `overlay` or `overlay2` graphdriver is used on a filesystem without `d_type` support [#33236](https://github.com/moby/moby/pull/33236) (ref [#31290](https://github.com/moby/moby/pull/31290)) <add>- Fix an issue with backporting mount spec to older volumes [#33207](https://github.com/moby/moby/pull/33207) <add>- Fix issue where a failed unmount can lead to data loss on local volume remove [#33120](https://github.com/moby/moby/pull/33120) <add> <add>### Swarm Mode <add> <add>- Fix a case where tasks could get killed unexpectedly [#33118](https://github.com/moby/moby/pull/33118) <add>- Fix an issue preventing to deploy services if the registry cannot be reached despite the needed images being locally present [#33117](https://github.com/moby/moby/pull/33117) <add> <ide> ## 17.03.1-ce (2017-03-27) <ide> <ide> ### Remote API (v1.27) & Client
1
Text
Text
add pronoun for fhinkel
ed2c9a3c783652f9d75321c3309230372cada60f
<ide><path>README.md <ide> For more information about the governance of the Node.js project, see <ide> * [evanlucas](https://github.com/evanlucas) - <ide> **Evan Lucas** &lt;evanlucas@me.com&gt; (he/him) <ide> * [fhinkel](https://github.com/fhinkel) - <del>**Franziska Hinkelmann** &lt;franziska.hinkelmann@gmail.com&gt; <add>**Franziska Hinkelmann** &lt;franziska.hinkelmann@gmail.com&gt; (she/her) <ide> * [Fishrock123](https://github.com/Fishrock123) - <ide> **Jeremiah Senkpiel** &lt;fishrock123@rocketmail.com&gt; <ide> * [indutny](https://github.com/indutny) - <ide> For more information about the governance of the Node.js project, see <ide> * [evanlucas](https://github.com/evanlucas) - <ide> **Evan Lucas** &lt;evanlucas@me.com&gt; (he/him) <ide> * [fhinkel](https://github.com/fhinkel) - <del>**Franziska Hinkelmann** &lt;franziska.hinkelmann@gmail.com&gt; <add>**Franziska Hinkelmann** &lt;franziska.hinkelmann@gmail.com&gt; (she/her) <ide> * [firedfox](https://github.com/firedfox) - <ide> **Daniel Wang** &lt;wangyang0123@gmail.com&gt; <ide> * [Fishrock123](https://github.com/Fishrock123) -
1
Javascript
Javascript
add support for scripts with module type
5d3a968e031ab8dff5c07e1d6bb4f196fb82bfa0
<ide><path>src/core/DOMEval.js <ide> define( [ <ide> ], function( document ) { <ide> "use strict"; <ide> <del> function DOMEval( code, doc ) { <add> var preservedScriptAttributes = { <add> type: true, <add> src: true, <add> noModule: true <add> }; <add> <add> function DOMEval( code, doc, node ) { <ide> doc = doc || document; <ide> <del> var script = doc.createElement( "script" ); <add> var i, <add> script = doc.createElement( "script" ); <ide> <ide> script.text = code; <add> if ( node ) { <add> for ( i in preservedScriptAttributes ) { <add> if ( node[ i ] ) { <add> script[ i ] = node[ i ]; <add> } <add> } <add> } <ide> doc.head.appendChild( script ).parentNode.removeChild( script ); <ide> } <ide> <ide><path>src/manipulation.js <ide> function domManip( collection, args, callback, ignored ) { <ide> !dataPriv.access( node, "globalEval" ) && <ide> jQuery.contains( doc, node ) ) { <ide> <del> if ( node.src ) { <add> if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { <ide> <ide> // Optional AJAX dependency, but won't run scripts if not present <ide> if ( jQuery._evalUrl ) { <ide> jQuery._evalUrl( node.src ); <ide> } <ide> } else { <del> DOMEval( node.textContent.replace( rcleanScript, "" ), doc ); <add> DOMEval( node.textContent.replace( rcleanScript, "" ), doc, node ); <ide> } <ide> } <ide> } <ide><path>src/manipulation/var/rscriptType.js <ide> define( function() { <ide> "use strict"; <ide> <del> return ( /^$|\/(?:java|ecma)script/i ); <add> return ( /^$|^module$|\/(?:java|ecma)script/i ); <ide> } ); <ide><path>test/data/inner_module.js <add>window.ok( true, "evaluated: innert module with src" ); <ide><path>test/data/module.js <add>window.ok( true, "evaluated: module with src" ); <ide><path>test/unit/manipulation.js <ide> QUnit.test( "html(Function)", function( assert ) { <ide> testHtml( manipulationFunctionReturningObj, assert ); <ide> } ); <ide> <add>QUnit.test( "html(script type module)", function( assert ) { <add> assert.expect( 1 ); <add> var fixture = jQuery( "#qunit-fixture" ), <add> tmp = fixture.html( <add> [ <add> "<script type='module'>ok( true, 'evaluated: module' );</script>", <add> "<script type='module' src='./data/module.js'></script>", <add> "<div>", <add> "<script type='module'>ok( true, 'evaluated: inner module' );</script>", <add> "<script type='module' src='./data/inner_module.js'></script>", <add> "</div>" <add> ].join( "" ) <add> ).find( "script" ); <add> assert.equal( tmp.length, 4, "All script tags remain." ); <add>} ); <add> <ide> QUnit.test( "html(Function) with incoming value -- direct selection", function( assert ) { <ide> <ide> assert.expect( 4 );
6
PHP
PHP
add array type for callback
7f0bc56e29e6e20cd91726e7bbcab65f050dabd4
<ide><path>src/Illuminate/Database/Eloquent/Concerns/HasEvents.php <ide> public function removeObservableEvents($observables) <ide> * Register a model event with the dispatcher. <ide> * <ide> * @param string $event <del> * @param \Illuminate\Events\QueuedClosure|\Closure|string $callback <add> * @param \Illuminate\Events\QueuedClosure|\Closure|string|array $callback <ide> * @return void <ide> */ <ide> protected static function registerModelEvent($event, $callback) <ide> protected function filterModelEventResults($result) <ide> /** <ide> * Register a retrieved model event with the dispatcher. <ide> * <del> * @param \Illuminate\Events\QueuedClosure|\Closure|string $callback <add> * @param \Illuminate\Events\QueuedClosure|\Closure|string|array $callback <ide> * @return void <ide> */ <ide> public static function retrieved($callback) <ide> public static function retrieved($callback) <ide> /** <ide> * Register a saving model event with the dispatcher. <ide> * <del> * @param \Illuminate\Events\QueuedClosure|\Closure|string $callback <add> * @param \Illuminate\Events\QueuedClosure|\Closure|string|array $callback <ide> * @return void <ide> */ <ide> public static function saving($callback) <ide> public static function saving($callback) <ide> /** <ide> * Register a saved model event with the dispatcher. <ide> * <del> * @param \Illuminate\Events\QueuedClosure|\Closure|string $callback <add> * @param \Illuminate\Events\QueuedClosure|\Closure|string|array $callback <ide> * @return void <ide> */ <ide> public static function saved($callback) <ide> public static function saved($callback) <ide> /** <ide> * Register an updating model event with the dispatcher. <ide> * <del> * @param \Illuminate\Events\QueuedClosure|\Closure|string $callback <add> * @param \Illuminate\Events\QueuedClosure|\Closure|string|array $callback <ide> * @return void <ide> */ <ide> public static function updating($callback) <ide> public static function updating($callback) <ide> /** <ide> * Register an updated model event with the dispatcher. <ide> * <del> * @param \Illuminate\Events\QueuedClosure|\Closure|string $callback <add> * @param \Illuminate\Events\QueuedClosure|\Closure|string|array $callback <ide> * @return void <ide> */ <ide> public static function updated($callback) <ide> public static function updated($callback) <ide> /** <ide> * Register a creating model event with the dispatcher. <ide> * <del> * @param \Illuminate\Events\QueuedClosure|\Closure|string $callback <add> * @param \Illuminate\Events\QueuedClosure|\Closure|string|array $callback <ide> * @return void <ide> */ <ide> public static function creating($callback) <ide> public static function creating($callback) <ide> /** <ide> * Register a created model event with the dispatcher. <ide> * <del> * @param \Illuminate\Events\QueuedClosure|\Closure|string $callback <add> * @param \Illuminate\Events\QueuedClosure|\Closure|string|array $callback <ide> * @return void <ide> */ <ide> public static function created($callback) <ide> public static function created($callback) <ide> /** <ide> * Register a replicating model event with the dispatcher. <ide> * <del> * @param \Illuminate\Events\QueuedClosure|\Closure|string $callback <add> * @param \Illuminate\Events\QueuedClosure|\Closure|string|array $callback <ide> * @return void <ide> */ <ide> public static function replicating($callback) <ide> public static function replicating($callback) <ide> /** <ide> * Register a deleting model event with the dispatcher. <ide> * <del> * @param \Illuminate\Events\QueuedClosure|\Closure|string $callback <add> * @param \Illuminate\Events\QueuedClosure|\Closure|string|array $callback <ide> * @return void <ide> */ <ide> public static function deleting($callback) <ide> public static function deleting($callback) <ide> /** <ide> * Register a deleted model event with the dispatcher. <ide> * <del> * @param \Illuminate\Events\QueuedClosure|\Closure|string $callback <add> * @param \Illuminate\Events\QueuedClosure|\Closure|string|array $callback <ide> * @return void <ide> */ <ide> public static function deleted($callback)
1
Mixed
Go
fix typos in changelog.md and pull.go
1ac4c61c10b7753607d8cb17421b90475c1bd0d6
<ide><path>CHANGELOG.md <ide> be found. <ide> - Fix an issue where it would be impossible to update both `memory-swap` and `memory` value together ([#22255](https://github.com/docker/docker/pull/22255)) <ide> - Fix a regression from 1.11.0 where the `/auth` endpoint would not initialize `serveraddress` if it is not provided ([#22254](https://github.com/docker/docker/pull/22254)) <ide> - Add missing cleanup of container temporary files when cancelling a schedule restart ([#22237](https://github.com/docker/docker/pull/22237)) <del>- Removed scary error message when no restart policy is specified ([#21993](https://github.com/docker/docker/pull/21993)) <add>- Remove scary error message when no restart policy is specified ([#21993](https://github.com/docker/docker/pull/21993)) <ide> - Fix a panic that would occur when the plugins were activated via the json spec ([#22191](https://github.com/docker/docker/pull/22191)) <ide> - Fix restart backoff logic to correctly reset delay if container ran for at least 10secs ([#22125](https://github.com/docker/docker/pull/22125)) <ide> - Remove error message when a container restart get cancelled ([#22123](https://github.com/docker/docker/pull/22123)) <del>- Fix an issue where `docker` would not correcly clean up after `docker exec` ([#22121](https://github.com/docker/docker/pull/22121)) <del>- Fix a panic that could occur when servicing concurrent `docker stats` commands ([#22120](https://github.com/docker/docker/pull/22120))` <del>- Revert deprecation of non-existing host directories auto-creation ([#22065](https://github.com/docker/docker/pull/22065)) <add>- Fix an issue where `docker` would not correctly clean up after `docker exec` ([#22121](https://github.com/docker/docker/pull/22121)) <add>- Fix a panic that could occur when serving concurrent `docker stats` commands ([#22120](https://github.com/docker/docker/pull/22120))` <add>- Revert deprecation of non-existent host directories auto-creation ([#22065](https://github.com/docker/docker/pull/22065)) <ide> - Hide misleading rpc error on daemon shutdown ([#22058](https://github.com/docker/docker/pull/22058)) <ide> <ide> ## 1.11.0 (2016-04-13) <ide> by another client (#15489) <ide> <ide> #### Runtime <ide> * Support hairpin NAT without going through Docker server. <del>- devicemapper: succeed immediately when removing non-existing devices. <add>- devicemapper: succeed immediately when removing non-existent devices. <ide> - devicemapper: improve handling of devicemapper devices (add per device lock, increase sleep time and unlock while sleeping). <ide> - devicemapper: increase timeout in waitClose to 10 seconds. <ide> - devicemapper: ensure we shut down thin pool cleanly. <ide> by another client (#15489) <ide> - Improve deprecation message. <ide> - Fix attach exit on darwin. <ide> - devicemapper: improve handling of devicemapper devices (add per device lock, increase sleep time, unlock while sleeping). <del>- devicemapper: succeed immediately when removing non-existing devices. <add>- devicemapper: succeed immediately when removing non-existent devices. <ide> - devicemapper: increase timeout in waitClose to 10 seconds. <ide> - Remove goroutine leak on error. <ide> - Update parseLxcInfo to comply with new lxc1.0 format. <ide><path>distribution/pull.go <ide> func Pull(ctx context.Context, ref reference.Named, imagePullConfig *ImagePullCo <ide> lastErr error <ide> <ide> // discardNoSupportErrors is used to track whether an endpoint encountered an error of type registry.ErrNoSupport <del> // By default it is false, which means that if a ErrNoSupport error is encountered, it will be saved in lastErr. <add> // By default it is false, which means that if an ErrNoSupport error is encountered, it will be saved in lastErr. <ide> // As soon as another kind of error is encountered, discardNoSupportErrors is set to true, avoiding the saving of <ide> // any subsequent ErrNoSupport errors in lastErr. <ide> // It's needed for pull-by-digest on v1 endpoints: if there are only v1 endpoints configured, the error should be
2
Ruby
Ruby
allow other license symbols
24523f82250787e243fd2fc2ec9854ed43bd0d73
<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 <del> .to_s <del> .sub("Public Domain", "public_domain") <del> .split(" ") <del> .to_h do |license| <add> forbidden_licenses = Homebrew::EnvConfig.forbidden_licenses.to_s <add> SPDX::ALLOWED_LICENSE_SYMBOLS.each do |s| <add> pattern = /#{s.to_s.tr("_", " ")}/i <add> forbidden_licenses = forbidden_licenses.sub(pattern, s.to_s) <add> end <add> forbidden_licenses = forbidden_licenses.split(" ").to_h do |license| <ide> [license, SPDX.license_version_info(license)] <ide> end <ide> <ide><path>Library/Homebrew/test/utils/spdx_spec.rb <ide> it "returns :public_domain" do <ide> expect(described_class.parse_license_expression(:public_domain).first).to eq [:public_domain] <ide> end <add> <add> it "returns :cannot_represent" do <add> expect(described_class.parse_license_expression(:cannot_represent).first).to eq [:cannot_represent] <add> end <ide> end <ide> <ide> describe ".valid_license?" do <ide> it "returns true for :public_domain" do <ide> expect(described_class.valid_license?(:public_domain)).to eq true <ide> end <add> <add> it "returns true for :cannot_represent" do <add> expect(described_class.valid_license?(:cannot_represent)).to eq true <add> end <add> <add> it "returns false for invalid symbol" do <add> expect(described_class.valid_license?(:invalid_symbol)).to eq false <add> end <ide> end <ide> <ide> describe ".deprecated_license?" do <ide> it "returns false for :public_domain" do <ide> expect(described_class.deprecated_license?(:public_domain)).to eq false <ide> end <add> <add> it "returns false for :cannot_represent" do <add> expect(described_class.deprecated_license?(:cannot_represent)).to eq false <add> end <ide> end <ide> <ide> describe ".valid_license_exception?" do <ide> it "returns :public_domain" do <ide> expect(described_class.license_expression_to_string(:public_domain)).to eq "Public Domain" <ide> end <add> <add> it "returns :cannot_represent" do <add> expect(described_class.license_expression_to_string(:cannot_represent)).to eq "Cannot Represent" <add> end <ide> end <ide> <del> describe ".license_version_info_info" do <add> describe ".license_version_info" do <ide> it "returns license without version" do <ide> expect(described_class.license_version_info("MIT")).to eq ["MIT"] <ide> end <ide><path>Library/Homebrew/utils/spdx.rb <ide> module SPDX <ide> <ide> DATA_PATH = (HOMEBREW_DATA_PATH/"spdx").freeze <ide> API_URL = "https://api.github.com/repos/spdx/license-list-data/releases/latest" <add> ALLOWED_LICENSE_SYMBOLS = [ <add> :public_domain, <add> :cannot_represent, <add> ].freeze <ide> <ide> def license_data <ide> @license_data ||= JSON.parse (DATA_PATH/"spdx_licenses.json").read <ide> def parse_license_expression(license_expression) <ide> end <ide> <ide> def valid_license?(license) <del> return true if license == :public_domain <add> return ALLOWED_LICENSE_SYMBOLS.include? license if license.is_a? Symbol <ide> <ide> license = license.delete_suffix "+" <ide> license_data["licenses"].any? { |spdx_license| spdx_license["licenseId"] == license } <ide> end <ide> <ide> def deprecated_license?(license) <del> return false if license == :public_domain <add> return false if ALLOWED_LICENSE_SYMBOLS.include? license <ide> return false unless valid_license?(license) <ide> <ide> license_data["licenses"].none? do |spdx_license| <ide> def license_expression_to_string(license_expression, bracket: false, hash_type: <ide> case license_expression <ide> when String <ide> license_expression <del> when :public_domain <del> "Public Domain" <add> when Symbol <add> license_expression.to_s.tr("_", " ").titleize <ide> when Hash <ide> expressions = [] <ide> <ide> def license_expression_to_string(license_expression, bracket: false, hash_type: <ide> end <ide> <ide> def license_version_info(license) <del> return [license] if license == :public_domain <add> return [license] if ALLOWED_LICENSE_SYMBOLS.include? license <ide> <ide> match = license.match(/-(?<version>[0-9.]+)(?:-.*?)??(?<or_later>\+|-only|-or-later)?$/) <ide> return [license] if match.blank?
3
Python
Python
remove unused iswin64 in multiarray unit test
17e2f03173f00ed7caa87fff0d1cbeb83b95f20c
<ide><path>numpy/core/tests/test_multiarray.py <ide> <ide> from test_print import in_foreign_locale <ide> <del>def iswin64(): <del> import platform <del> return platform.architecture()[0] == "64bit" and sys.platform == "win32" <del> <ide> class TestFlags(TestCase): <ide> def setUp(self): <ide> self.a = arange(10)
1
Python
Python
fix shuffle=false in .fit()
c8a104b8faa3f5ced2c50a5c3ece3627b0af1542
<ide><path>keras/models.py <ide> def fit(self, X, y, batch_size=128, nb_epoch=100, verbose=1, <ide> <ide> batches = make_batches(len(X), batch_size) <ide> for batch_index, (batch_start, batch_end) in enumerate(batches): <del> if shuffle: <del> batch_ids = index_array[batch_start:batch_end] <del> else: <del> batch_ids = slice(batch_start, batch_end) <add> batch_ids = index_array[batch_start:batch_end] <ide> seen += len(batch_ids) <ide> X_batch = X[batch_ids] <ide> y_batch = y[batch_ids] <ide> def load_weights(self, filepath): <ide> weights = [g['param_{}'.format(p)] for p in range(g.attrs['nb_params'])] <ide> self.layers[k].set_weights(weights) <ide> f.close() <add> <add>
1
Python
Python
remove duplication in test/runtime dependencies
40babe7bc8122c99aafb1cd2fcc9d63df74da051
<ide><path>setup.py <ide> <ide> SUPPORTED_VERSIONS = ['2.7', 'PyPy', '3.3+'] <ide> <add>INSTALL_REQUIREMENTS = ['requests'] <add> <ide> TEST_REQUIREMENTS = [ <ide> 'mock', <del> 'requests', <ide> 'requests_mock', <ide> 'pytest', <ide> 'pytest-runner' <del>] <add>] + INSTALL_REQUIREMENTS <ide> <ide> if PY2_pre_279: <ide> TEST_REQUIREMENTS.append('backports.ssl_match_hostname') <ide> def run(self): <ide> <ide> forbid_publish() <ide> <del>install_requires = ['requests'] <del> <ide> if PY2_pre_279: <del> install_requires.append('backports.ssl_match_hostname') <add> INSTALL_REQUIREMENTS.append('backports.ssl_match_hostname') <ide> <ide> needs_pytest = {'pytest', 'test', 'ptr'}.intersection(sys.argv) <ide> pytest_runner = ['pytest-runner'] if needs_pytest else [] <ide> def run(self): <ide> long_description=open('README.rst').read(), <ide> author='Apache Software Foundation', <ide> author_email='dev@libcloud.apache.org', <del> install_requires=install_requires, <add> install_requires=INSTALL_REQUIREMENTS, <ide> python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4", <ide> packages=get_packages('libcloud'), <ide> package_dir={
1
Text
Text
fix output in routing.md [ci skip]
fe97612141a9926a6ecec38f8cefb7eea1a0c8e5
<ide><path>guides/source/routing.md <ide> class Video < ApplicationRecord <ide> end <ide> <ide> video = Video.find_by(identifier: "Roman-Holiday") <del>edit_videos_path(video) # => "/videos/Roman-Holiday" <add>edit_videos_path(video) # => "/videos/Roman-Holiday/edit" <ide> ``` <ide> <ide> Inspecting and Testing Routes
1
Python
Python
move python properties to decorator syntax
55ad09c9024d2f0d23123c934e505042516cc796
<ide><path>flask/app.py <ide> def open_instance_resource(self, resource, mode="rb"): <ide> """ <ide> return open(os.path.join(self.instance_path, resource), mode) <ide> <del> def _get_templates_auto_reload(self): <add> @property <add> def templates_auto_reload(self): <ide> """Reload templates when they are changed. Used by <ide> :meth:`create_jinja_environment`. <ide> <ide> def _get_templates_auto_reload(self): <ide> rv = self.config["TEMPLATES_AUTO_RELOAD"] <ide> return rv if rv is not None else self.debug <ide> <del> def _set_templates_auto_reload(self, value): <add> @templates_auto_reload.setter <add> def templates_auto_reload(self, value): <ide> self.config["TEMPLATES_AUTO_RELOAD"] = value <ide> <del> templates_auto_reload = property( <del> _get_templates_auto_reload, _set_templates_auto_reload <del> ) <del> del _get_templates_auto_reload, _set_templates_auto_reload <del> <ide> def create_jinja_environment(self): <ide> """Create the Jinja environment based on :attr:`jinja_options` <ide> and the various Jinja-related methods of the app. Changing <ide> def make_shell_context(self): <ide> #: Default: ``'production'`` <ide> env = ConfigAttribute("ENV") <ide> <del> def _get_debug(self): <add> @property <add> def debug(self): <add> """Whether debug mode is enabled. When using ``flask run`` to start <add> the development server, an interactive debugger will be shown for <add> unhandled exceptions, and the server will be reloaded when code <add> changes. This maps to the :data:`DEBUG` config key. This is <add> enabled when :attr:`env` is ``'development'`` and is overridden <add> by the ``FLASK_DEBUG`` environment variable. It may not behave as <add> expected if set in code. <add> <add> **Do not enable debug mode when deploying in production.** <add> <add> Default: ``True`` if :attr:`env` is ``'development'``, or <add> ``False`` otherwise. <add> """ <ide> return self.config["DEBUG"] <ide> <del> def _set_debug(self, value): <add> @debug.setter <add> def debug(self, value): <ide> self.config["DEBUG"] = value <ide> self.jinja_env.auto_reload = self.templates_auto_reload <ide> <del> #: Whether debug mode is enabled. When using ``flask run`` to start <del> #: the development server, an interactive debugger will be shown for <del> #: unhandled exceptions, and the server will be reloaded when code <del> #: changes. This maps to the :data:`DEBUG` config key. This is <del> #: enabled when :attr:`env` is ``'development'`` and is overridden <del> #: by the ``FLASK_DEBUG`` environment variable. It may not behave as <del> #: expected if set in code. <del> #: <del> #: **Do not enable debug mode when deploying in production.** <del> #: <del> #: Default: ``True`` if :attr:`env` is ``'development'``, or <del> #: ``False`` otherwise. <del> debug = property(_get_debug, _set_debug) <del> del _get_debug, _set_debug <del> <ide> def run(self, host=None, port=None, debug=None, load_dotenv=True, **options): <ide> """Runs the application on a local development server. <ide> <ide><path>flask/ctx.py <ide> def __init__(self, app, environ, request=None, session=None): <ide> if self.url_adapter is not None: <ide> self.match_request() <ide> <del> def _get_g(self): <add> @property <add> def g(self): <ide> return _app_ctx_stack.top.g <ide> <del> def _set_g(self, value): <add> @g.setter <add> def g(self, value): <ide> _app_ctx_stack.top.g = value <ide> <del> g = property(_get_g, _set_g) <del> del _get_g, _set_g <del> <ide> def copy(self): <ide> """Creates a copy of this request context with the same request object. <ide> This can be used to move a request context to a different greenlet. <ide><path>flask/helpers.py <ide> def __init__(self, import_name, template_folder=None, root_path=None): <ide> #: application has been discovered and blueprints registered. <ide> self.cli = AppGroup() <ide> <del> def _get_static_folder(self): <add> @property <add> def static_folder(self): <add> """The absolute path to the configured static folder.""" <ide> if self._static_folder is not None: <ide> return os.path.join(self.root_path, self._static_folder) <ide> <del> def _set_static_folder(self, value): <add> @static_folder.setter <add> def static_folder(self, value): <ide> self._static_folder = value <ide> <del> static_folder = property( <del> _get_static_folder, <del> _set_static_folder, <del> doc="The absolute path to the configured static folder.", <del> ) <del> del _get_static_folder, _set_static_folder <del> <ide> @property <ide> def static_url_path(self): <ide> """The URL prefix that the static route will be accessible from.
3