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 | simplify code, handle exceptions | dfa2c247e0dbdbf506f5175a1c839bfd09caecd9 | <ide><path>Library/Homebrew/keg.rb
<ide> def optlinked?
<ide>
<ide> def remove_opt_record
<ide> opt_record.unlink
<del> aliases.each do |a|
<del> (opt_record.parent/a).unlink
<del> end
<add> aliases.each { |a| (opt_record.parent/a).unlink }
<ide> opt_record.parent.rmdir_if_possible
<ide> end
<ide>
<ide> def remove_oldname_opt_record
<ide> end
<ide>
<ide> def aliases
<del> formula_name = rack.basename.to_s
<del> aliases_path = Formula[formula_name].tap.path/"Aliases"
<del> result = aliases_path.children.select do |c|
<del> c.symlink? && c.readlink.basename(".rb").to_s == formula_name
<del> end
<del> result.map(&:basename).map(&:to_s)
<add> Formula[rack.basename.to_s].aliases
<add> rescue FormulaUnavailableError
<add> []
<ide> end
<ide>
<ide> def optlink(mode = OpenStruct.new) | 1 |
Text | Text | fix typo in blog post | 991c1c1169141f9746416a9de4d8b8257c8b4be5 | <ide><path>docs/_posts/2014-06-27-community-roundup-19.md
<ide> Ever wanted to find developers who also share the same interest in React than yo
<ide>
<ide> If you don't live near San Francisco or London, why not start one in your community?
<ide>
<del>## Complimentary Tools
<add>## Complementary Tools
<ide> In case you haven't seen it, we've consolidated the tooling solution around React on [this wiki page](https://github.com/facebook/react/wiki/Complementary-Tools). Some of the notable recent entries include:
<ide>
<ide> - [Ryan Florence](https://github.com/rpflorence)'s [react-nested-router](https://github.com/rpflorence/react-nested-router), which is a translation of the Ember router API to React.
<ide>
<del>- [Stephen J. Collings](https://github.com/stevoland)'s [React-Bootstrap](https://github.com/react-bootstrap/react-bootstrap), which wraps the popular framework with a bit of React goodness. The [website](http://react-bootstrap.github.io/components.html) features live-editable demos.
<add>- [Stephen J. Collings](https://github.com/stevoland)'s [react-bootstrap](https://github.com/react-bootstrap/react-bootstrap), which wraps the popular framework with a bit of React goodness. The [website](http://react-bootstrap.github.io/components.html) features live-editable demos.
<ide>
<ide> - [Andrey Popp](https://github.com/andreypopp)'s [react-quickstart](https://github.com/andreypopp/react-quickstart), which gives you a quick template for server-side rendering and routing, among other features.
<ide> | 1 |
Text | Text | fix a tiny typo [ci skip] | f59de082bf2876b11e4f31c4d04f60cb4a331d8d | <ide><path>guides/source/debugging_rails_applications.md
<ide> Processing by ArticlesController#index as HTML
<ide> If we use `next`, we won't go deep inside method calls. Instead, `byebug` will
<ide> go to the next line within the same context. In this case, it is the last line
<ide> of the current method, so `byebug` will return to the next line of the caller
<del>+method.
<add>method.
<add>
<ide> ```
<ide> (byebug) next
<ide> | 1 |
Javascript | Javascript | add test for parsezone tz inference case | 4af458b11af764367c846660e8c13b9b3f483a6a | <ide><path>test/moment/zones.js
<ide> exports.zones = {
<ide> test.done();
<ide> },
<ide>
<del> "parse zone dependent on format string" : function (test) {
<add> "parse zone with a timezone from the format string" : function (test) {
<ide> test.expect(1);
<ide>
<ide> var m = moment("11-12-2013 -0400 +1100", "DD-MM-YYYY ZZ #####").parseZone();
<ide> exports.zones = {
<ide> test.done();
<ide> },
<ide>
<add> "parse zone without a timezone included in the format string" : function (test) {
<add> test.expect(1);
<add>
<add> var m = moment("11-12-2013 -0400 +1100", "DD-MM-YYYY").parseZone();
<add>
<add> test.equal(m.zone(), -11 * 60);
<add> test.done();
<add> },
<add>
<ide> "timezone format" : function (test) {
<ide> test.equal(moment().zone(-60).format('ZZ'), "+0100", "-60 -> +0100");
<ide> test.equal(moment().zone(-90).format('ZZ'), "+0130", "-90 -> +0130"); | 1 |
Ruby | Ruby | apply suggestions from code review | 00aa4b7a0bb5358dfc55107231b979407ba7140c | <ide><path>Library/Homebrew/cmd/upgrade.rb
<ide> def upgrade_formula(f)
<ide>
<ide> upgrade_version = if f.optlinked?
<ide> "#{Keg.new(f.opt_prefix).version} -> #{f.pkg_version}"
<del> " #{f.pkg_version} #{fi.options.to_a.join " "}"
<ide> else
<ide> "-> #{f.pkg_version}"
<ide> end | 1 |
Text | Text | add documentation for inherited methods | bde889bd4ed68d33163897b4175557fbc669b66f | <ide><path>doc/api/http.md
<ide> deprecated: v13.0.0
<ide>
<ide> See [`request.socket`][].
<ide>
<add>### `request.cork()`
<add>
<add><!-- YAML
<add>added:
<add> - v13.2.0
<add> - v12.16.0
<add>-->
<add>
<add>See [`writable.cork()`][].
<add>
<ide> ### `request.end([data[, encoding]][, callback])`
<ide>
<ide> <!-- YAML
<ide> const cookie = request.getHeader('Cookie');
<ide> // 'cookie' is of type string[]
<ide> ```
<ide>
<add>### `request.getHeaderNames()`
<add>
<add><!-- YAML
<add>added: v7.7.0
<add>-->
<add>
<add>* Returns: {string\[]}
<add>
<add>Returns an array containing the unique names of the current outgoing headers.
<add>All header names are lowercase.
<add>
<add>```js
<add>request.setHeader('Foo', 'bar');
<add>request.setHeader('Cookie', ['foo=bar', 'bar=baz']);
<add>
<add>const headerNames = request.getHeaderNames();
<add>// headerNames === ['foo', 'Cookie']
<add>```
<add>
<add>### `request.getHeaders()`
<add>
<add><!-- YAML
<add>added: v7.7.0
<add>-->
<add>
<add>* Returns: {Object}
<add>
<add>Returns a shallow copy of the current outgoing headers. Since a shallow copy
<add>is used, array values may be mutated without additional calls to various
<add>header-related http module methods. The keys of the returned object are the
<add>header names and the values are the respective header values. All header names
<add>are lowercase.
<add>
<add>The object returned by the `response.getHeaders()` method _does not_
<add>prototypically inherit from the JavaScript `Object`. This means that typical
<add>`Object` methods such as `obj.toString()`, `obj.hasOwnProperty()`, and others
<add>are not defined and _will not work_.
<add>
<add>```js
<add>request.setHeader('Foo', 'bar');
<add>request.setHeader('Cookie', ['foo=bar', 'bar=baz']);
<add>
<add>const headers = response.getHeaders();
<add>// headers === { foo: 'bar', 'cookie': ['foo=bar', 'bar=baz'] }
<add>```
<add>
<ide> ### `request.getRawHeaderNames()`
<ide>
<ide> <!-- YAML
<ide> const headerNames = request.getRawHeaderNames();
<ide> // headerNames === ['Foo', 'Set-Cookie']
<ide> ```
<ide>
<add>### `request.hasHeader(name)`
<add>
<add><!-- YAML
<add>added: v7.7.0
<add>-->
<add>
<add>* `name` {string}
<add>* Returns: {boolean}
<add>
<add>Returns `true` if the header identified by `name` is currently set in the
<add>outgoing headers. The header name matching is case-insensitive.
<add>
<add>```js
<add>const hasContentType = request.hasHeader('content-type');
<add>```
<add>
<ide> ### `request.maxHeadersCount`
<ide>
<ide> * {number} **Default:** `2000`
<ide> This property is guaranteed to be an instance of the {net.Socket} class,
<ide> a subclass of {stream.Duplex}, unless the user specified a socket
<ide> type other than {net.Socket}.
<ide>
<add>### `request.uncork()`
<add>
<add><!-- YAML
<add>added:
<add> - v13.2.0
<add> - v12.16.0
<add>-->
<add>
<add>See [`writable.uncork()`][].
<add>
<ide> ### `request.writableEnded`
<ide>
<ide> <!-- YAML | 1 |
PHP | PHP | fix coding standards | 99cbd22969bb73692d017f5fd962ee7f8b497117 | <ide><path>lib/Cake/Model/Datasource/DboSource.php
<ide> public function insertMulti($table, $fields, $values) {
<ide> * @return boolean success.
<ide> */
<ide> public function resetSequence($table, $column) {
<del>
<ide> }
<ide>
<ide> /**
<ide><path>lib/Cake/Utility/CakeNumber.php
<ide> public static function toReadableSize($size) {
<ide> * @param string $size Size in human readable string like '5MB'
<ide> * @param mixed $default Value to be returned when invalid size was used, for example 'Unknown type'
<ide> * @return integer Bytes
<add> * @throws CakeException On invalid Unit type.
<ide> */
<ide> public static function fromReadableSize($size, $default = false) {
<ide> if (ctype_digit($size)) { | 2 |
Javascript | Javascript | force local path | 7b82e88cda13b8cc378b51988010e6d818096e8c | <ide><path>lib/BaseWasmMainTemplatePlugin.js
<ide> class BaseWasmMainTemplatePlugin {
<ide> applyNode(mainTemplate) {
<ide> const generateLoadBinaryCode = path => `
<ide> new Promise(function (resolve, reject) {
<add> var {readFile} = require("fs");
<add> var {join} = require("path");
<add>
<ide> try {
<del> require("fs").readFile(${path}, function(err, buffer){
<add> readFile(join(__dirname, ${path}), function(err, buffer){
<ide> if (err) reject(err); else resolve(buffer);
<ide> });
<ide> } catch (err) { | 1 |
Text | Text | add good first issue section to readme | 5f30df2f061b4aad8199ea019990f4a1450acc75 | <ide><path>packages/next/README.md
<ide> Our [Code of Conduct](https://github.com/vercel/next.js/blob/canary/CODE_OF_COND
<ide>
<ide> Please see our [contributing.md](/contributing.md).
<ide>
<add>### Good First Issues
<add>
<add>We have a list of [good first issues](https://github.com/vercel/next.js/labels/good%20first%20issue) that contain bugs which have a relatively limited scope. This is a great place to get started, gain experience, and get familiar with our contribution process.
<add>
<ide> ## Authors
<ide>
<ide> - Tim Neutkens ([@timneutkens](https://twitter.com/timneutkens)) – [Vercel](https://vercel.com/about/timneutkens) | 1 |
Python | Python | remove unused import | dcec1046434ba792390c38f45c4de3d6a30f650a | <ide><path>spacy/cli/info.py
<ide> from __future__ import unicode_literals
<ide>
<ide> import platform
<del>import sys
<ide> from pathlib import Path
<add>
<ide> from .. import about
<ide> from .. import util
<ide> | 1 |
Go | Go | fix issue with goimport | b70632ec532d4a948e227a646f8286d7c439cb4f | <ide><path>pkg/mflag/flag_test.go
<ide> // Use of this source code is governed by a BSD-style
<ide> // license that can be found in the LICENSE file.
<ide>
<del>package mflag_test
<add>package mflag
<ide>
<ide> import (
<ide> "bytes"
<ide> import (
<ide> "strings"
<ide> "testing"
<ide> "time"
<del> . "github.com/docker/docker/pkg/mflag"
<ide> )
<ide>
<ide> // ResetForTesting clears all flag state and sets the usage function as directed. | 1 |
Javascript | Javascript | fix lint warning + turn off worker support | 50fe4f55e2f78320dc265f9cf828dc0d3a25666e | <ide><path>src/core.js
<ide> var globalScope = (typeof window === 'undefined') ? this : window;
<ide>
<ide> var ERRORS = 0, WARNINGS = 1, TODOS = 5;
<ide> var verbosity = WARNINGS;
<del>var useWorker = true;
<add>var useWorker = false;
<ide>
<ide> // The global PDFJS object exposes the API
<ide> // In production, it will be declared outside a global wrapper
<ide><path>src/worker_loader.js
<ide>
<ide> 'use strict';
<ide>
<del>this.onmessage = function(evt) {
<add>function onMessageLoader(evt) {
<ide> // Reset the `onmessage` function as it was only set to call
<ide> // this function the first time a message is passed to the worker
<ide> // but shouldn't get called anytime afterwards.
<ide> this.onmessage = function(evt) {
<ide> for (var i = 0; i < files.length; i++) {
<ide> importScripts(dir + files[i]);
<ide> }
<del>}.bind(this);
<add>}
<add>
<add>this.onmessage = onMessageLoader.bind(this); | 2 |
Python | Python | remove none handling from fields.get_attribute() | 07258ca032e062334310c112469d6432f6eeb818 | <ide><path>rest_framework/fields.py
<ide> def get_attribute(instance, attrs):
<ide> Also accepts either attribute lookup on objects or dictionary lookups.
<ide> """
<ide> for attr in attrs:
<del> if instance is None:
<del> # Break out early if we get `None` at any point in a nested lookup.
<del> return None
<ide> try:
<ide> if isinstance(instance, collections.Mapping):
<ide> instance = instance[attr] | 1 |
Python | Python | handle default=false for boolean fields | 160f912a60754c22b2e351bbd9e4b3b4879450f8 | <ide><path>rest_framework/schemas/openapi.py
<ide> def _map_serializer(self, serializer):
<ide> schema['writeOnly'] = True
<ide> if field.allow_null:
<ide> schema['nullable'] = True
<del> if field.default and field.default != empty and not callable(field.default):
<add> if field.default is not None and field.default != empty and not callable(field.default):
<ide> schema['default'] = field.default
<ide> if field.help_text:
<ide> schema['description'] = str(field.help_text)
<ide><path>tests/schemas/test_openapi.py
<ide> class Serializer(serializers.Serializer):
<ide> data = inspector._map_serializer(Serializer())
<ide> assert isinstance(data['properties']['text']['description'], str), "description must be str"
<ide>
<add> def test_boolean_default_field(self):
<add> class Serializer(serializers.Serializer):
<add> default_true = serializers.BooleanField(default=True)
<add> default_false = serializers.BooleanField(default=False)
<add> without_default = serializers.BooleanField()
<add>
<add> inspector = AutoSchema()
<add>
<add> data = inspector._map_serializer(Serializer())
<add> assert data['properties']['default_true']['default'] is True, "default must be true"
<add> assert data['properties']['default_false']['default'] is False, "default must be false"
<add> assert 'default' not in data['properties']['without_default'], "default must not be defined"
<add>
<ide>
<ide> @pytest.mark.skipif(uritemplate is None, reason='uritemplate not installed.')
<ide> class TestOperationIntrospection(TestCase): | 2 |
Python | Python | fix bug in format suffix patterns | 3e77090b2142e7802203b5e37f81b5d4cbb6f40d | <ide><path>rest_framework/urlpatterns.py
<ide> def format_suffix_patterns(urlpatterns, suffix_required=False, suffix_kwarg=None
<ide> include a '.format' suffix. Retains urlpattern ordering.
<ide> """
<ide> suffix_kwarg = suffix_kwarg or api_settings.FORMAT_SUFFIX_KWARG
<del> suffix_pattern = '\.(?P<%s>[a-z]+)$' % suffix_kwarg
<add> suffix_pattern = r'\.(?P<%s>[a-z]+)$' % suffix_kwarg
<ide>
<ide> ret = []
<ide> for urlpattern in urlpatterns: | 1 |
Python | Python | add stubs for reference documentation | 9a27253a10f8c1f9775b688eb65e41d227fa84e4 | <ide><path>numpy/doc/reference/basics.py
<add>"""
<add>
<add>============
<add>Array basics
<add>============
<add>
<add>Placeholder for array basics documentation.
<add>
<add>"""
<ide><path>numpy/doc/reference/creation.py
<add>"""
<add>
<add>==============
<add>Array creation
<add>==============
<add>
<add>Placeholder for array creation documentation.
<add>
<add>"""
<ide><path>numpy/doc/reference/howtofind.py
<add>"""
<add>
<add>=================
<add>How to Find Stuff
<add>=================
<add>
<add>How to find things in NumPy.
<add>
<add>"""
<ide><path>numpy/doc/reference/internals.py
<add>"""
<add>
<add>===============
<add>Array Internals
<add>===============
<add>
<add>Placeholder for Array Internals documentation.
<add>
<add>"""
<ide><path>numpy/doc/reference/io.py
<add>"""
<add>
<add>=========
<add>Array I/O
<add>=========
<add>
<add>Placeholder for array I/O documentation.
<add>
<add>"""
<ide><path>numpy/doc/reference/methods_vs_functions.py
<add>"""
<add>
<add>=====================
<add>Methods vs. Functions
<add>=====================
<add>
<add>Placeholder for Methods vs. Functions documentation.
<add>
<add>"""
<ide><path>numpy/doc/reference/misc.py
<add>"""
<add>
<add>=============
<add>Miscellaneous
<add>=============
<add>
<add>Placeholder for other tips.
<add>
<add>"""
<ide><path>numpy/doc/reference/performance.py
<add>"""
<add>
<add>===========
<add>Performance
<add>===========
<add>
<add>Placeholder for Improving Performance documentation.
<add>
<add>"""
<ide><path>numpy/doc/reference/structured_arrays.py
<add>"""
<add>
<add>=================
<add>Structured Arrays
<add>=================
<add>
<add>Placeholder for structured array documentation.
<add>
<add>"""
<ide><path>numpy/doc/reference/ufuncs.py
<add>"""
<add>
<add>===================
<add>Universal Functions
<add>===================
<add>
<add>Placeholder for ufunc documentation.
<add>
<add>"""
<ide><path>numpy/doc/reference/zen.py
<add>"""
<add>
<add>============
<add>Zen of NumPy
<add>============
<add>
<add>Placehold for Zen of NumPy documentation.
<add>
<add>""" | 11 |
Text | Text | remove typo (extra ' character) | 1405a9ea9ec29b1399c4cec19c37a829aaa1e3f9 | <ide><path>doc/api/crypto.md
<ide> changes:
<ide> * `key` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView}
<ide> * `key`: {string|ArrayBuffer|Buffer|TypedArray|DataView|Object} The key
<ide> material, either in PEM, DER, or JWK format.
<del> * `format`: {string} Must be `'pem'`, `'der'`, or '`'jwk'`.
<add> * `format`: {string} Must be `'pem'`, `'der'`, or `'jwk'`.
<ide> **Default:** `'pem'`.
<ide> * `type`: {string} Must be `'pkcs1'` or `'spki'`. This option is
<ide> required only if the `format` is `'der'` and ignored otherwise. | 1 |
Text | Text | add section on creating redux middleware | 49f5b96d4cbf2fdbff32b0a91bf9eae4f1bde615 | <ide><path>client/src/pages/guide/english/redux/redux-middleware/index.md
<ide> An error ocurred: There was an error on your application
<ide> ```
<ide>
<ide>
<del>
<del> #### More Information:
<del> [In depth Redux Middleware documentation](https://redux.js.org/advanced/middleware)
<add>#### Creating Middleware
<add>
<add>Redux middleware are just functions with the signature
<add>
<add>```js
<add>const reduxMiddleware = store => next => action => {
<add> // do some middleware stuff
<add>}
<add>```
<add>
<add>Side Note - The fact that this is a function that takes a store and returns a function that takes a next callback and returns a function that takes an action and performs some middlware operations might look a bit odd. why do that instead of three parameters? Well this is actually a very helpful technique from functional programming called currying and it enables a lot of goodness like partial application. The main difference though is how you call the middleware function.
<add>
<add>```js
<add>// calling an uncurried version - NOT how you call the function above
<add>reduxMiddleware(store, next, action)
<add>
<add>// vs calling the curried version - how you call the function above
<add>reduxMiddleware(store)(next)(action)
<add>```
<add>
<add>The parameters here are:
<ide>
<del> [In depth Redux ApplyMiddleware documentation](https://redux.js.org/api/applymiddleware)
<add>1.) store - your redux store and calling its "getState" method returns the current state of your store.
<add>```js
<add>let currentState = store.getState()
<add>```
<add>2.) next - a callback that you pass an action to continue with the flow of your redux middleware / reducers.
<add>```js
<add>next(action)
<add>```
<add>3.) action - the action dispatched to the store to update state
<add>
<add>Let's use the information above to create a simple logging middleware that will log "User Updated!" to the console every time an action with type "UPDATE_USER" is dispatched.
<add>
<add>```js
<add>const updateUserLogger = store => next => action => {
<add> if (action.type === "UPDATE_USER") {
<add> console.log("User Updated!");
<add> }
<add> next(action);
<add>};
<add>```
<ide>
<del> [Redux Middleware List](https://redux.js.org/introduction/ecosystem#middleware)
<ide>
<add>#### More Information:
<ide> <!-- Please add any articles you think might be helpful to read before writing the article -->
<del>
<del>
<del> [//]: # (These are reference links used in the body of this note and get stripped out when the markdown processor does its job. There is no need to format nicely because it shouldn't be seen. Thanks SO - http://stackoverflow.com/questions/4823468/store-comments-in-markdown-syntax)
<add>- [Middleware - Redux docs](https://redux.js.org/advanced/middleware)
<add>- [In depth Redux Middleware documentation](https://redux.js.org/advanced/middleware)
<add>- [In depth Redux ApplyMiddleware documentation](https://redux.js.org/api/applymiddleware)
<add>- [Redux Middleware List](https://redux.js.org/introduction/ecosystem#middleware)
<add>
<add>[//]: # (These are reference links used in the body of this note and get stripped out when the markdown processor does its job. There is no need to format nicely because it shouldn't be seen. Thanks SO - http://stackoverflow.com/questions/4823468/store-comments-in-markdown-syntax)
<ide>
<ide> [Express]: <https://expressjs.com/>
<ide> [node.js]: <http://nodejs.org> | 1 |
PHP | PHP | unserialize the data key within the data parameter | 5b03efd7958274b43b3a41811f94025ec77843a0 | <ide><path>src/Illuminate/Events/CallQueuedHandler.php
<ide> public function failed(array $data)
<ide>
<ide> if (method_exists($handler, 'failed'))
<ide> {
<del> call_user_func_array([$handler, 'failed'], unserialize($data));
<add> call_user_func_array([$handler, 'failed'], unserialize($data['data']));
<ide> }
<ide> }
<ide> | 1 |
Ruby | Ruby | build the `attributemutationtracker` lazily | ede244e2367c7988fa02f5e3b956d88211bb5ade | <ide><path>activerecord/lib/active_record/attribute_methods/dirty.rb
<ide> def save!(*)
<ide> # <tt>reload</tt> the record and clears changed attributes.
<ide> def reload(*)
<ide> super.tap do
<del> @mutation_tracker = AttributeMutationTracker.new(@attributes)
<add> @mutation_tracker = nil
<ide> @previous_mutation_tracker = nil
<ide> @changed_attributes = HashWithIndifferentAccess.new
<ide> end
<ide> end
<ide>
<del> def init_internals
<del> super
<del> @mutation_tracker = AttributeMutationTracker.new(@attributes)
<del> end
<del>
<ide> def initialize_dup(other) # :nodoc:
<ide> super
<ide> @attributes = self.class._default_attributes.map do |attr|
<ide> attr.with_value_from_user(@attributes.fetch_value(attr.name))
<ide> end
<del> @mutation_tracker = AttributeMutationTracker.new(@attributes)
<add> @mutation_tracker = nil
<ide> end
<ide>
<ide> def changes_applied
<del> @previous_mutation_tracker = @mutation_tracker
<add> @previous_mutation_tracker = mutation_tracker
<ide> @changed_attributes = HashWithIndifferentAccess.new
<ide> store_original_attributes
<ide> end
<ide> def changed_attributes
<ide> if defined?(@cached_changed_attributes)
<ide> @cached_changed_attributes
<ide> else
<del> super.reverse_merge(@mutation_tracker.changed_values).freeze
<add> super.reverse_merge(mutation_tracker.changed_values).freeze
<ide> end
<ide> end
<ide>
<ide> def previous_changes
<ide> end
<ide>
<ide> def attribute_changed_in_place?(attr_name)
<del> @mutation_tracker.changed_in_place?(attr_name)
<add> mutation_tracker.changed_in_place?(attr_name)
<ide> end
<ide>
<ide> private
<ide>
<add> def mutation_tracker
<add> unless defined?(@mutation_tracker)
<add> @mutation_tracker = nil
<add> end
<add> @mutation_tracker ||= AttributeMutationTracker.new(@attributes)
<add> end
<add>
<ide> def changes_include?(attr_name)
<del> super || @mutation_tracker.changed?(attr_name)
<add> super || mutation_tracker.changed?(attr_name)
<ide> end
<ide>
<ide> def clear_attribute_change(attr_name)
<del> @mutation_tracker.forget_change(attr_name)
<add> mutation_tracker.forget_change(attr_name)
<ide> end
<ide>
<ide> def _update_record(*)
<ide> def keys_for_partial_write
<ide>
<ide> def store_original_attributes
<ide> @attributes = @attributes.map(&:forgetting_assignment)
<del> @mutation_tracker = AttributeMutationTracker.new(@attributes)
<add> @mutation_tracker = nil
<ide> end
<ide>
<ide> def previous_mutation_tracker
<ide><path>activerecord/lib/active_record/persistence.rb
<ide> def destroy!
<ide> def becomes(klass)
<ide> became = klass.new
<ide> became.instance_variable_set("@attributes", @attributes)
<del> became.instance_variable_set("@mutation_tracker", @mutation_tracker)
<add> became.instance_variable_set("@mutation_tracker", @mutation_tracker) if defined?(@mutation_tracker)
<ide> became.instance_variable_set("@changed_attributes", attributes_changed_by_setter)
<ide> became.instance_variable_set("@new_record", new_record?)
<ide> became.instance_variable_set("@destroyed", destroyed?) | 2 |
Text | Text | use consistent indenting for unordered list items | a3307eac0e6fb276274e4e9bbaab1aa4433e795f | <ide><path>BUILDING.md
<ide> transition before the year-end deadline.
<ide> * `gcc` and `g++` >= 6.3 or newer, or
<ide> * GNU Make 3.81 or newer
<ide> * Python (see note above)
<del> * Python 2.7
<del> * Python 3.5, 3.6, and 3.7 are experimental.
<add> * Python 2.7
<add> * Python 3.5, 3.6, and 3.7 are experimental.
<ide>
<ide> Installation via Linux package manager can be achieved with:
<ide>
<ide> FreeBSD and OpenBSD users may also need to install `libexecinfo`.
<ide>
<ide> * Xcode Command Line Tools >= 8 for macOS
<ide> * Python (see note above)
<del> * Python 2.7
<del> * Python 3.5, 3.6, and 3.7 are experimental.
<add> * Python 2.7
<add> * Python 3.5, 3.6, and 3.7 are experimental.
<ide>
<ide> macOS users can install the `Xcode Command Line Tools` by running
<ide> `xcode-select --install`. Alternatively, if you already have the full Xcode
<ide><path>doc/api/http2.md
<ide> changes:
<ide> exceed this limit will result in a `'frameError'` event being emitted
<ide> and the stream being closed and destroyed.
<ide> * `paddingStrategy` {number} Identifies the strategy used for determining the
<del> amount of padding to use for `HEADERS` and `DATA` frames. **Default:**
<del> `http2.constants.PADDING_STRATEGY_NONE`. Value may be one of:
<del> * `http2.constants.PADDING_STRATEGY_NONE` - Specifies that no padding is
<del> to be applied.
<del> * `http2.constants.PADDING_STRATEGY_MAX` - Specifies that the maximum
<del> amount of padding, as determined by the internal implementation, is to
<del> be applied.
<del> * `http2.constants.PADDING_STRATEGY_ALIGNED` - Will *attempt* to apply
<del> enough padding to ensure that the total frame length, including the
<del> 9-byte header, is a multiple of 8. For each frame, however, there is a
<del> maximum allowed number of padding bytes that is determined by current
<del> flow control state and settings. If this maximum is less than the
<del> calculated amount needed to ensure alignment, the maximum will be used
<del> and the total frame length will *not* necessarily be aligned at 8 bytes.
<add> amount of padding to use for `HEADERS` and `DATA` frames. **Default:**
<add> `http2.constants.PADDING_STRATEGY_NONE`. Value may be one of:
<add> * `http2.constants.PADDING_STRATEGY_NONE` - Specifies that no padding is
<add> to be applied.
<add> * `http2.constants.PADDING_STRATEGY_MAX` - Specifies that the maximum
<add> amount of padding, as determined by the internal implementation, is to
<add> be applied.
<add> * `http2.constants.PADDING_STRATEGY_ALIGNED` - Will *attempt* to apply
<add> enough padding to ensure that the total frame length, including the
<add> 9-byte header, is a multiple of 8. For each frame, however, there is a
<add> maximum allowed number of padding bytes that is determined by current
<add> flow control state and settings. If this maximum is less than the
<add> calculated amount needed to ensure alignment, the maximum will be used
<add> 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
<ide> be overridden if the remote peer sets its own value for
<ide> changes:
<ide> exceed this limit will result in a `'frameError'` event being emitted
<ide> and the stream being closed and destroyed.
<ide> * `paddingStrategy` {number} Identifies the strategy used for determining the
<del> amount of padding to use for `HEADERS` and `DATA` frames. **Default:**
<del> `http2.constants.PADDING_STRATEGY_NONE`. Value may be one of:
<del> * `http2.constants.PADDING_STRATEGY_NONE` - Specifies that no padding is
<del> to be applied.
<del> * `http2.constants.PADDING_STRATEGY_MAX` - Specifies that the maximum
<del> amount of padding, as determined by the internal implementation, is to
<del> be applied.
<del> * `http2.constants.PADDING_STRATEGY_ALIGNED` - Will *attempt* to apply
<del> enough padding to ensure that the total frame length, including the
<del> 9-byte header, is a multiple of 8. For each frame, however, there is a
<del> maximum allowed number of padding bytes that is determined by current
<del> flow control state and settings. If this maximum is less than the
<del> calculated amount needed to ensure alignment, the maximum will be used
<del> and the total frame length will *not* necessarily be aligned at 8 bytes.
<add> amount of padding to use for `HEADERS` and `DATA` frames. **Default:**
<add> `http2.constants.PADDING_STRATEGY_NONE`. Value may be one of:
<add> * `http2.constants.PADDING_STRATEGY_NONE` - Specifies that no padding is
<add> to be applied.
<add> * `http2.constants.PADDING_STRATEGY_MAX` - Specifies that the maximum
<add> amount of padding, as determined by the internal implementation, is to
<add> be applied.
<add> * `http2.constants.PADDING_STRATEGY_ALIGNED` - Will *attempt* to apply
<add> enough padding to ensure that the total frame length, including the
<add> 9-byte header, is a multiple of 8. For each frame, however, there is a
<add> maximum allowed number of padding bytes that is determined by current
<add> flow control state and settings. If this maximum is less than the
<add> calculated amount needed to ensure alignment, the maximum will be used
<add> 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
<ide> be overridden if the remote peer sets its own value for
<ide> changes:
<ide> exceed this limit will result in a `'frameError'` event being emitted
<ide> and the stream being closed and destroyed.
<ide> * `paddingStrategy` {number} Identifies the strategy used for determining the
<del> amount of padding to use for `HEADERS` and `DATA` frames. **Default:**
<del> `http2.constants.PADDING_STRATEGY_NONE`. Value may be one of:
<del> * `http2.constants.PADDING_STRATEGY_NONE` - Specifies that no padding is
<del> to be applied.
<del> * `http2.constants.PADDING_STRATEGY_MAX` - Specifies that the maximum
<del> amount of padding, as determined by the internal implementation, is to
<del> be applied.
<del> * `http2.constants.PADDING_STRATEGY_ALIGNED` - Will *attempt* to apply
<del> enough padding to ensure that the total frame length, including the
<del> 9-byte header, is a multiple of 8. For each frame, however, there is a
<del> maximum allowed number of padding bytes that is determined by current
<del> flow control state and settings. If this maximum is less than the
<del> calculated amount needed to ensure alignment, the maximum will be used
<del> and the total frame length will *not* necessarily be aligned at 8 bytes.
<add> amount of padding to use for `HEADERS` and `DATA` frames. **Default:**
<add> `http2.constants.PADDING_STRATEGY_NONE`. Value may be one of:
<add> * `http2.constants.PADDING_STRATEGY_NONE` - Specifies that no padding is
<add> to be applied.
<add> * `http2.constants.PADDING_STRATEGY_MAX` - Specifies that the maximum
<add> amount of padding, as determined by the internal implementation, is to
<add> be applied.
<add> * `http2.constants.PADDING_STRATEGY_ALIGNED` - Will *attempt* to apply
<add> enough padding to ensure that the total frame length, including the
<add> 9-byte header, is a multiple of 8. For each frame, however, there is a
<add> maximum allowed number of padding bytes that is determined by current
<add> flow control state and settings. If this maximum is less than the
<add> calculated amount needed to ensure alignment, the maximum will be used
<add> 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
<ide> be overridden if the remote peer sets its own value for
<ide><path>doc/api/process.md
<ide> added: v6.1.0
<ide> * `previousValue` {Object} A previous return value from calling
<ide> `process.cpuUsage()`
<ide> * Returns: {Object}
<del> * `user` {integer}
<del> * `system` {integer}
<add> * `user` {integer}
<add> * `system` {integer}
<ide>
<ide> The `process.cpuUsage()` method returns the user and system CPU time usage of
<ide> the current process, in an object with properties `user` and `system`, whose
<ide> changes:
<ide> -->
<ide>
<ide> * Returns: {Object}
<del> * `rss` {integer}
<del> * `heapTotal` {integer}
<del> * `heapUsed` {integer}
<del> * `external` {integer}
<add> * `rss` {integer}
<add> * `heapTotal` {integer}
<add> * `heapUsed` {integer}
<add> * `external` {integer}
<ide>
<ide> The `process.memoryUsage()` method returns an object describing the memory usage
<ide> of the Node.js process measured in bytes.
<ide> added: v12.6.0
<ide> * Returns: {Object} the resource usage for the current process. All of these
<ide> values come from the `uv_getrusage` call which returns
<ide> a [`uv_rusage_t` struct][uv_rusage_t].
<del> * `userCPUTime` {integer} maps to `ru_utime` computed in microseconds.
<del> It is the same value as [`process.cpuUsage().user`][process.cpuUsage].
<del> * `systemCPUTime` {integer} maps to `ru_stime` computed in microseconds.
<del> It is the same value as [`process.cpuUsage().system`][process.cpuUsage].
<del> * `maxRSS` {integer} maps to `ru_maxrss` which is the maximum resident set
<del> size used in kilobytes.
<del> * `sharedMemorySize` {integer} maps to `ru_ixrss` but is not supported by
<del> any platform.
<del> * `unsharedDataSize` {integer} maps to `ru_idrss` but is not supported by
<del> any platform.
<del> * `unsharedStackSize` {integer} maps to `ru_isrss` but is not supported by
<del> any platform.
<del> * `minorPageFault` {integer} maps to `ru_minflt` which is the number of
<del> minor page faults for the process, see
<del> [this article for more details][wikipedia_minor_fault].
<del> * `majorPageFault` {integer} maps to `ru_majflt` which is the number of
<del> major page faults for the process, see
<del> [this article for more details][wikipedia_major_fault]. This field is not
<del> supported on Windows.
<del> * `swappedOut` {integer} maps to `ru_nswap` but is not supported by any
<del> platform.
<del> * `fsRead` {integer} maps to `ru_inblock` which is the number of times the
<del> file system had to perform input.
<del> * `fsWrite` {integer} maps to `ru_oublock` which is the number of times the
<del> file system had to perform output.
<del> * `ipcSent` {integer} maps to `ru_msgsnd` but is not supported by any
<del> platform.
<del> * `ipcReceived` {integer} maps to `ru_msgrcv` but is not supported by any
<del> platform.
<del> * `signalsCount` {integer} maps to `ru_nsignals` but is not supported by any
<del> platform.
<del> * `voluntaryContextSwitches` {integer} maps to `ru_nvcsw` which is the
<del> number of times a CPU context switch resulted due to a process voluntarily
<del> giving up the processor before its time slice was completed (usually to
<del> await availability of a resource). This field is not supported on Windows.
<del> * `involuntaryContextSwitches` {integer} maps to `ru_nivcsw` which is the
<del> number of times a CPU context switch resulted due to a higher priority
<del> process becoming runnable or because the current process exceeded its
<del> time slice. This field is not supported on Windows.
<add> * `userCPUTime` {integer} maps to `ru_utime` computed in microseconds.
<add> It is the same value as [`process.cpuUsage().user`][process.cpuUsage].
<add> * `systemCPUTime` {integer} maps to `ru_stime` computed in microseconds.
<add> It is the same value as [`process.cpuUsage().system`][process.cpuUsage].
<add> * `maxRSS` {integer} maps to `ru_maxrss` which is the maximum resident set
<add> size used in kilobytes.
<add> * `sharedMemorySize` {integer} maps to `ru_ixrss` but is not supported by
<add> any platform.
<add> * `unsharedDataSize` {integer} maps to `ru_idrss` but is not supported by
<add> any platform.
<add> * `unsharedStackSize` {integer} maps to `ru_isrss` but is not supported by
<add> any platform.
<add> * `minorPageFault` {integer} maps to `ru_minflt` which is the number of
<add> minor page faults for the process, see
<add> [this article for more details][wikipedia_minor_fault].
<add> * `majorPageFault` {integer} maps to `ru_majflt` which is the number of
<add> major page faults for the process, see
<add> [this article for more details][wikipedia_major_fault]. This field is not
<add> supported on Windows.
<add> * `swappedOut` {integer} maps to `ru_nswap` but is not supported by any
<add> platform.
<add> * `fsRead` {integer} maps to `ru_inblock` which is the number of times the
<add> file system had to perform input.
<add> * `fsWrite` {integer} maps to `ru_oublock` which is the number of times the
<add> file system had to perform output.
<add> * `ipcSent` {integer} maps to `ru_msgsnd` but is not supported by any
<add> platform.
<add> * `ipcReceived` {integer} maps to `ru_msgrcv` but is not supported by any
<add> platform.
<add> * `signalsCount` {integer} maps to `ru_nsignals` but is not supported by any
<add> platform.
<add> * `voluntaryContextSwitches` {integer} maps to `ru_nvcsw` which is the
<add> number of times a CPU context switch resulted due to a process voluntarily
<add> giving up the processor before its time slice was completed (usually to
<add> await availability of a resource). This field is not supported on Windows.
<add> * `involuntaryContextSwitches` {integer} maps to `ru_nivcsw` which is the
<add> number of times a CPU context switch resulted due to a higher priority
<add> process becoming runnable or because the current process exceeded its
<add> time slice. This field is not supported on Windows.
<ide>
<ide> ```js
<ide> console.log(process.resourceUsage());
<ide><path>doc/api/url.md
<ide> The formatting process operates as follows:
<ide> colon (`:`) character, the literal string `:` will be appended to `result`.
<ide> * If either of the following conditions is true, then the literal string `//`
<ide> will be appended to `result`:
<del> * `urlObject.slashes` property is true;
<del> * `urlObject.protocol` begins with `http`, `https`, `ftp`, `gopher`, or
<del> `file`;
<add> * `urlObject.slashes` property is true;
<add> * `urlObject.protocol` begins with `http`, `https`, `ftp`, `gopher`, or
<add> `file`;
<ide> * If the value of the `urlObject.auth` property is truthy, and either
<ide> `urlObject.host` or `urlObject.hostname` are not `undefined`, the value of
<ide> `urlObject.auth` will be coerced into a string and appended to `result`
<ide><path>doc/api/vm.md
<ide> changes:
<ide> `import()` will reject with [`ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING`][].
<ide> This option is part of the experimental API for the `--experimental-modules`
<ide> flag, and should not be considered stable.
<del> * `specifier` {string} specifier passed to `import()`
<del> * `module` {vm.SourceTextModule}
<del> * Returns: {Module Namespace Object|vm.SourceTextModule} Returning a
<del> `vm.SourceTextModule` is recommended in order to take advantage of error
<del> tracking, and to avoid issues with namespaces that contain `then`
<del> function exports.
<add> * `specifier` {string} specifier passed to `import()`
<add> * `module` {vm.SourceTextModule}
<add> * Returns: {Module Namespace Object|vm.SourceTextModule} Returning a
<add> `vm.SourceTextModule` is recommended in order to take advantage of error
<add> tracking, and to avoid issues with namespaces that contain `then`
<add> function exports.
<ide>
<ide> If `options` is a string, then it specifies the filename.
<ide>
<ide> const contextifiedSandbox = vm.createContext({ secret: 42 });
<ide> * `importModuleDynamically` {Function} Called during evaluation of this module
<ide> when `import()` is called. If this option is not specified, calls to
<ide> `import()` will reject with [`ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING`][].
<del> * `specifier` {string} specifier passed to `import()`
<del> * `module` {vm.SourceTextModule}
<del> * Returns: {Module Namespace Object|vm.SourceTextModule} Returning a
<del> `vm.SourceTextModule` is recommended in order to take advantage of error
<del> tracking, and to avoid issues with namespaces that contain `then`
<del> function exports.
<add> * `specifier` {string} specifier passed to `import()`
<add> * `module` {vm.SourceTextModule}
<add> * Returns: {Module Namespace Object|vm.SourceTextModule} Returning a
<add> `vm.SourceTextModule` is recommended in order to take advantage of error
<add> tracking, and to avoid issues with namespaces that contain `then`
<add> function exports.
<ide>
<ide> Creates a new ES `Module` object.
<ide>
<ide> changes:
<ide> `import()` will reject with [`ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING`][].
<ide> This option is part of the experimental API for the `--experimental-modules`
<ide> flag, and should not be considered stable.
<del> * `specifier` {string} specifier passed to `import()`
<del> * `module` {vm.SourceTextModule}
<del> * Returns: {Module Namespace Object|vm.SourceTextModule} Returning a
<del> `vm.SourceTextModule` is recommended in order to take advantage of error
<del> tracking, and to avoid issues with namespaces that contain `then`
<del> function exports.
<add> * `specifier` {string} specifier passed to `import()`
<add> * `module` {vm.SourceTextModule}
<add> * Returns: {Module Namespace Object|vm.SourceTextModule} Returning a
<add> `vm.SourceTextModule` is recommended in order to take advantage of error
<add> tracking, and to avoid issues with namespaces that contain `then`
<add> function exports.
<ide> * Returns: {any} the result of the very last statement executed in the script.
<ide>
<ide> The `vm.runInContext()` method compiles `code`, runs it within the context of
<ide> changes:
<ide> `import()` will reject with [`ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING`][].
<ide> This option is part of the experimental API for the `--experimental-modules`
<ide> flag, and should not be considered stable.
<del> * `specifier` {string} specifier passed to `import()`
<del> * `module` {vm.SourceTextModule}
<del> * Returns: {Module Namespace Object|vm.SourceTextModule} Returning a
<del> `vm.SourceTextModule` is recommended in order to take advantage of error
<del> tracking, and to avoid issues with namespaces that contain `then`
<del> function exports.
<add> * `specifier` {string} specifier passed to `import()`
<add> * `module` {vm.SourceTextModule}
<add> * Returns: {Module Namespace Object|vm.SourceTextModule} Returning a
<add> `vm.SourceTextModule` is recommended in order to take advantage of error
<add> tracking, and to avoid issues with namespaces that contain `then`
<add> function exports.
<ide> * Returns: {any} the result of the very last statement executed in the script.
<ide>
<ide> The `vm.runInNewContext()` first contextifies the given `sandbox` object (or
<ide> changes:
<ide> `import()` will reject with [`ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING`][].
<ide> This option is part of the experimental API for the `--experimental-modules`
<ide> flag, and should not be considered stable.
<del> * `specifier` {string} specifier passed to `import()`
<del> * `module` {vm.SourceTextModule}
<del> * Returns: {Module Namespace Object|vm.SourceTextModule} Returning a
<del> `vm.SourceTextModule` is recommended in order to take advantage of error
<del> tracking, and to avoid issues with namespaces that contain `then`
<del> function exports.
<add> * `specifier` {string} specifier passed to `import()`
<add> * `module` {vm.SourceTextModule}
<add> * Returns: {Module Namespace Object|vm.SourceTextModule} Returning a
<add> `vm.SourceTextModule` is recommended in order to take advantage of error
<add> tracking, and to avoid issues with namespaces that contain `then`
<add> function exports.
<ide> * Returns: {any} the result of the very last statement executed in the script.
<ide>
<ide> `vm.runInThisContext()` compiles `code`, runs it within the context of the
<ide><path>doc/changelogs/CHANGELOG_V10.md
<ide> Fixes for the following CVEs are included in this release:
<ide>
<ide> * **deps**: Upgrade to OpenSSL 1.1.0j, fixing CVE-2018-0734 and CVE-2019-0735
<ide> * **http**:
<del> * Headers received by HTTP servers must not exceed 8192 bytes in total to prevent possible Denial of Service attacks. Reported by Trevor Norris. (CVE-2018-12121 / Matteo Collina)
<del> * A timeout of 40 seconds now applies to servers receiving HTTP headers. This value can be adjusted with `server.headersTimeout`. Where headers are not completely received within this period, the socket is destroyed on the next received chunk. In conjunction with `server.setTimeout()`, this aids in protecting against excessive resource retention and possible Denial of Service. Reported by Jan Maybach ([liebdich.com](https://liebdich.com)). (CVE-2018-12122 / Matteo Collina)
<add> * Headers received by HTTP servers must not exceed 8192 bytes in total to prevent possible Denial of Service attacks. Reported by Trevor Norris. (CVE-2018-12121 / Matteo Collina)
<add> * A timeout of 40 seconds now applies to servers receiving HTTP headers. This value can be adjusted with `server.headersTimeout`. Where headers are not completely received within this period, the socket is destroyed on the next received chunk. In conjunction with `server.setTimeout()`, this aids in protecting against excessive resource retention and possible Denial of Service. Reported by Jan Maybach ([liebdich.com](https://liebdich.com)). (CVE-2018-12122 / Matteo Collina)
<ide> * **url**: Fix a bug that would allow a hostname being spoofed when parsing URLs with `url.parse()` with the `'javascript:'` protocol. Reported by [Martin Bajanik](https://twitter.com/_bayotop) ([Kentico](https://kenticocloud.com/)). (CVE-2018-12123 / Matteo Collina)
<ide>
<ide> ### Commits
<ide><path>doc/changelogs/CHANGELOG_V11.md
<ide> Fixes for the following CVEs are included in this release:
<ide>
<ide> * **deps**: Upgrade to OpenSSL 1.1.0j, fixing CVE-2018-0734 and CVE-2019-0735
<ide> * **http**:
<del> * Headers received by HTTP servers must not exceed 8192 bytes in total to prevent possible Denial of Service attacks. Reported by Trevor Norris. (CVE-2018-12121 / Matteo Collina)
<del> * A timeout of 40 seconds now applies to servers receiving HTTP headers. This value can be adjusted with `server.headersTimeout`. Where headers are not completely received within this period, the socket is destroyed on the next received chunk. In conjunction with `server.setTimeout()`, this aids in protecting against excessive resource retention and possible Denial of Service. Reported by Jan Maybach ([liebdich.com](https://liebdich.com)). (CVE-2018-12122 / Matteo Collina)
<add> * Headers received by HTTP servers must not exceed 8192 bytes in total to prevent possible Denial of Service attacks. Reported by Trevor Norris. (CVE-2018-12121 / Matteo Collina)
<add> * A timeout of 40 seconds now applies to servers receiving HTTP headers. This value can be adjusted with `server.headersTimeout`. Where headers are not completely received within this period, the socket is destroyed on the next received chunk. In conjunction with `server.setTimeout()`, this aids in protecting against excessive resource retention and possible Denial of Service. Reported by Jan Maybach ([liebdich.com](https://liebdich.com)). (CVE-2018-12122 / Matteo Collina)
<ide> * **url**: Fix a bug that would allow a hostname being spoofed when parsing URLs with `url.parse()` with the `'javascript:'` protocol. Reported by [Martin Bajanik](https://twitter.com/_bayotop) ([Kentico](https://kenticocloud.com/)). (CVE-2018-12123 / Matteo Collina)
<ide>
<ide> ### Commits
<ide><path>doc/changelogs/CHANGELOG_V12.md
<ide> Vulnerabilities fixed:
<ide> ### Notable Changes
<ide>
<ide> * **assert**:
<del> * validate required arguments (Ruben Bridgewater) [#26641](https://github.com/nodejs/node/pull/26641)
<del> * adjust loose assertions (Ruben Bridgewater) [#25008](https://github.com/nodejs/node/pull/25008)
<add> * validate required arguments (Ruben Bridgewater) [#26641](https://github.com/nodejs/node/pull/26641)
<add> * adjust loose assertions (Ruben Bridgewater) [#25008](https://github.com/nodejs/node/pull/25008)
<ide> * **async_hooks**:
<del> * remove deprecated `emitBefore` and `emitAfter` (Matteo Collina) [#26530](https://github.com/nodejs/node/pull/26530)
<del> * remove promise object from resource (Andreas Madsen) [#23443](https://github.com/nodejs/node/pull/23443)
<add> * remove deprecated `emitBefore` and `emitAfter` (Matteo Collina) [#26530](https://github.com/nodejs/node/pull/26530)
<add> * remove promise object from resource (Andreas Madsen) [#23443](https://github.com/nodejs/node/pull/23443)
<ide> * **bootstrap**: make Buffer and process non-enumerable (Ruben Bridgewater) [#24874](https://github.com/nodejs/node/pull/24874)
<ide> * **buffer**:
<del> * use stricter range checks (Ruben Bridgewater) [#27045](https://github.com/nodejs/node/pull/27045)
<del> * harden `SlowBuffer` creation (ZYSzys) [#26272](https://github.com/nodejs/node/pull/26272)
<del> * harden validation of buffer allocation size (ZYSzys) [#26162](https://github.com/nodejs/node/pull/26162)
<del> * do proper error propagation in addon methods (Anna Henningsen) [#23939](https://github.com/nodejs/node/pull/23939)
<add> * use stricter range checks (Ruben Bridgewater) [#27045](https://github.com/nodejs/node/pull/27045)
<add> * harden `SlowBuffer` creation (ZYSzys) [#26272](https://github.com/nodejs/node/pull/26272)
<add> * harden validation of buffer allocation size (ZYSzys) [#26162](https://github.com/nodejs/node/pull/26162)
<add> * do proper error propagation in addon methods (Anna Henningsen) [#23939](https://github.com/nodejs/node/pull/23939)
<ide> * **child_process**:
<del> * remove `options.customFds` (cjihrig) [#25279](https://github.com/nodejs/node/pull/25279)
<del> * harden fork arguments validation (ZYSzys) [#27039](https://github.com/nodejs/node/pull/27039)
<del> * use non-infinite `maxBuffer` defaults (kohta ito) [#23027](https://github.com/nodejs/node/pull/23027)
<add> * remove `options.customFds` (cjihrig) [#25279](https://github.com/nodejs/node/pull/25279)
<add> * harden fork arguments validation (ZYSzys) [#27039](https://github.com/nodejs/node/pull/27039)
<add> * use non-infinite `maxBuffer` defaults (kohta ito) [#23027](https://github.com/nodejs/node/pull/23027)
<ide> * **console**: don't use ANSI escape codes when `TERM=dumb` (Vladislav Kaminsky) [#26261](https://github.com/nodejs/node/pull/26261)
<ide> * **crypto**:
<del> * remove legacy native handles (Tobias Nießen) [#27011](https://github.com/nodejs/node/pull/27011)
<del> * decode missing passphrase errors (Tobias Nießen) [#25208](https://github.com/nodejs/node/pull/25208)
<del> * remove `Cipher.setAuthTag()` and `Decipher.getAuthTag()` (Tobias Nießen) [#26249](https://github.com/nodejs/node/pull/26249)
<del> * remove deprecated `crypto._toBuf()` (Tobias Nießen) [#25338](https://github.com/nodejs/node/pull/25338)
<del> * set `DEFAULT\_ENCODING` property to non-enumerable (Antoine du Hamel) [#23222](https://github.com/nodejs/node/pull/23222)
<add> * remove legacy native handles (Tobias Nießen) [#27011](https://github.com/nodejs/node/pull/27011)
<add> * decode missing passphrase errors (Tobias Nießen) [#25208](https://github.com/nodejs/node/pull/25208)
<add> * remove `Cipher.setAuthTag()` and `Decipher.getAuthTag()` (Tobias Nießen) [#26249](https://github.com/nodejs/node/pull/26249)
<add> * remove deprecated `crypto._toBuf()` (Tobias Nießen) [#25338](https://github.com/nodejs/node/pull/25338)
<add> * set `DEFAULT\_ENCODING` property to non-enumerable (Antoine du Hamel) [#23222](https://github.com/nodejs/node/pull/23222)
<ide> * **deps**:
<del> * update V8 to 7.4.288.13 (Michaël Zasso, cjihrig, Refael Ackermann, Anna Henningsen, Ujjwal Sharma) [#26685](https://github.com/nodejs/node/pull/26685)
<del> * bump minimum icu version to 63 (Ujjwal Sharma) [#25852](https://github.com/nodejs/node/pull/25852)
<del> * update OpenSSL to 1.1.1b (Sam Roberts, Shigeki Ohtsu) [#26327](https://github.com/nodejs/node/pull/26327)
<add> * update V8 to 7.4.288.13 (Michaël Zasso, cjihrig, Refael Ackermann, Anna Henningsen, Ujjwal Sharma) [#26685](https://github.com/nodejs/node/pull/26685)
<add> * bump minimum icu version to 63 (Ujjwal Sharma) [#25852](https://github.com/nodejs/node/pull/25852)
<add> * update OpenSSL to 1.1.1b (Sam Roberts, Shigeki Ohtsu) [#26327](https://github.com/nodejs/node/pull/26327)
<ide> * **errors**: update error name (Ruben Bridgewater) [#26738](https://github.com/nodejs/node/pull/26738)
<ide> * **fs**:
<del> * use proper .destroy() implementation for SyncWriteStream (Matteo Collina) [#26690](https://github.com/nodejs/node/pull/26690)
<del> * improve mode validation (Ruben Bridgewater) [#26575](https://github.com/nodejs/node/pull/26575)
<del> * harden validation of start option in `createWriteStream()` (ZYSzys) [#25579](https://github.com/nodejs/node/pull/25579)
<del> * make writeFile consistent with readFile wrt fd (Sakthipriyan Vairamani (thefourtheye)) [#23709](https://github.com/nodejs/node/pull/23709)
<add> * use proper .destroy() implementation for SyncWriteStream (Matteo Collina) [#26690](https://github.com/nodejs/node/pull/26690)
<add> * improve mode validation (Ruben Bridgewater) [#26575](https://github.com/nodejs/node/pull/26575)
<add> * harden validation of start option in `createWriteStream()` (ZYSzys) [#25579](https://github.com/nodejs/node/pull/25579)
<add> * make writeFile consistent with readFile wrt fd (Sakthipriyan Vairamani (thefourtheye)) [#23709](https://github.com/nodejs/node/pull/23709)
<ide> * **http**:
<del> * validate timeout in `ClientRequest()` (cjihrig) [#26214](https://github.com/nodejs/node/pull/26214)
<del> * return HTTP 431 on `HPE_HEADER_OVERFLOW` error (Albert Still) [#25605](https://github.com/nodejs/node/pull/25605)
<del> * switch default parser to llhttp (Anna Henningsen) [#24870](https://github.com/nodejs/node/pull/24870)
<del> * Runtime-deprecate `outgoingMessage._headers` and `outgoingMessage._headerNames` (Morgan Roderick) [#24167](https://github.com/nodejs/node/pull/24167)
<add> * validate timeout in `ClientRequest()` (cjihrig) [#26214](https://github.com/nodejs/node/pull/26214)
<add> * return HTTP 431 on `HPE_HEADER_OVERFLOW` error (Albert Still) [#25605](https://github.com/nodejs/node/pull/25605)
<add> * switch default parser to llhttp (Anna Henningsen) [#24870](https://github.com/nodejs/node/pull/24870)
<add> * Runtime-deprecate `outgoingMessage._headers` and `outgoingMessage._headerNames` (Morgan Roderick) [#24167](https://github.com/nodejs/node/pull/24167)
<ide> * **lib**:
<del> * remove `Atomics.wake()` (Gus Caplan) [#27033](https://github.com/nodejs/node/pull/27033)
<del> * move DTRACE\_\* probes out of global scope (James M Snell) [#26541](https://github.com/nodejs/node/pull/26541)
<del> * deprecate `_stream_wrap` (Sam Roberts) [#26245](https://github.com/nodejs/node/pull/26245)
<del> * use ES6 class inheritance style (Ruben Bridgewater) [#24755](https://github.com/nodejs/node/pull/24755)
<add> * remove `Atomics.wake()` (Gus Caplan) [#27033](https://github.com/nodejs/node/pull/27033)
<add> * move DTRACE\_\* probes out of global scope (James M Snell) [#26541](https://github.com/nodejs/node/pull/26541)
<add> * deprecate `_stream_wrap` (Sam Roberts) [#26245](https://github.com/nodejs/node/pull/26245)
<add> * use ES6 class inheritance style (Ruben Bridgewater) [#24755](https://github.com/nodejs/node/pull/24755)
<ide> * **module**:
<del> * remove unintended access to deps/ (Anna Henningsen) [#25138](https://github.com/nodejs/node/pull/25138)
<del> * improve error message for MODULE\_NOT\_FOUND (Ali Ijaz Sheikh) [#25690](https://github.com/nodejs/node/pull/25690)
<del> * requireStack property for MODULE\_NOT\_FOUND (Ali Ijaz Sheikh) [#25690](https://github.com/nodejs/node/pull/25690)
<del> * remove dead code (Ruben Bridgewater) [#26983](https://github.com/nodejs/node/pull/26983)
<del> * make `require('.')` never resolve outside the current directory (Ruben Bridgewater) [#26973](https://github.com/nodejs/node/pull/26973)
<del> * throw an error for invalid package.json main entries (Ruben Bridgewater) [#26823](https://github.com/nodejs/node/pull/26823)
<del> * don't search in `require.resolve.paths` (cjihrig) [#23683](https://github.com/nodejs/node/pull/23683)
<add> * remove unintended access to deps/ (Anna Henningsen) [#25138](https://github.com/nodejs/node/pull/25138)
<add> * improve error message for MODULE\_NOT\_FOUND (Ali Ijaz Sheikh) [#25690](https://github.com/nodejs/node/pull/25690)
<add> * requireStack property for MODULE\_NOT\_FOUND (Ali Ijaz Sheikh) [#25690](https://github.com/nodejs/node/pull/25690)
<add> * remove dead code (Ruben Bridgewater) [#26983](https://github.com/nodejs/node/pull/26983)
<add> * make `require('.')` never resolve outside the current directory (Ruben Bridgewater) [#26973](https://github.com/nodejs/node/pull/26973)
<add> * throw an error for invalid package.json main entries (Ruben Bridgewater) [#26823](https://github.com/nodejs/node/pull/26823)
<add> * don't search in `require.resolve.paths` (cjihrig) [#23683](https://github.com/nodejs/node/pull/23683)
<ide> * **net**:
<del> * remove `Server.listenFD()` (cjihrig) [#27127](https://github.com/nodejs/node/pull/27127)
<del> * do not add `.host` and `.port` properties to DNS error (Ruben Bridgewater) [#26751](https://github.com/nodejs/node/pull/26751)
<del> * emit "write after end" errors in the next tick (Ouyang Yadong) [#24457](https://github.com/nodejs/node/pull/24457)
<del> * deprecate `_setSimultaneousAccepts()` undocumented function (James M Snell) [#23760](https://github.com/nodejs/node/pull/23760)
<add> * remove `Server.listenFD()` (cjihrig) [#27127](https://github.com/nodejs/node/pull/27127)
<add> * do not add `.host` and `.port` properties to DNS error (Ruben Bridgewater) [#26751](https://github.com/nodejs/node/pull/26751)
<add> * emit "write after end" errors in the next tick (Ouyang Yadong) [#24457](https://github.com/nodejs/node/pull/24457)
<add> * deprecate `_setSimultaneousAccepts()` undocumented function (James M Snell) [#23760](https://github.com/nodejs/node/pull/23760)
<ide> * **os**:
<del> * implement `os.type()` using `uv_os_uname()` (cjihrig) [#25659](https://github.com/nodejs/node/pull/25659)
<del> * remove `os.getNetworkInterfaces()` (cjihrig) [#25280](https://github.com/nodejs/node/pull/25280)
<add> * implement `os.type()` using `uv_os_uname()` (cjihrig) [#25659](https://github.com/nodejs/node/pull/25659)
<add> * remove `os.getNetworkInterfaces()` (cjihrig) [#25280](https://github.com/nodejs/node/pull/25280)
<ide> * **process**:
<del> * make global.process, global.Buffer getters (Guy Bedford) [#26882](https://github.com/nodejs/node/pull/26882)
<del> * move DEP0062 (node --debug) to end-of-life (Joyee Cheung) [#25828](https://github.com/nodejs/node/pull/25828)
<del> * exit on --debug and --debug-brk after option parsing (Joyee Cheung) [#25828](https://github.com/nodejs/node/pull/25828)
<del> * improve `--redirect-warnings` handling (Ruben Bridgewater) [#24965](https://github.com/nodejs/node/pull/24965)
<add> * make global.process, global.Buffer getters (Guy Bedford) [#26882](https://github.com/nodejs/node/pull/26882)
<add> * move DEP0062 (node --debug) to end-of-life (Joyee Cheung) [#25828](https://github.com/nodejs/node/pull/25828)
<add> * exit on --debug and --debug-brk after option parsing (Joyee Cheung) [#25828](https://github.com/nodejs/node/pull/25828)
<add> * improve `--redirect-warnings` handling (Ruben Bridgewater) [#24965](https://github.com/nodejs/node/pull/24965)
<ide> * **readline**: support TERM=dumb (Vladislav Kaminsky) [#26261](https://github.com/nodejs/node/pull/26261)
<ide> * **repl**:
<del> * add welcome message (gengjiawen) [#25947](https://github.com/nodejs/node/pull/25947)
<del> * fix terminal default setting (Ruben Bridgewater) [#26518](https://github.com/nodejs/node/pull/26518)
<del> * check colors with `.getColorDepth()` (Vladislav Kaminsky) [#26261](https://github.com/nodejs/node/pull/26261)
<del> * deprecate REPLServer.rli (Ruben Bridgewater) [#26260](https://github.com/nodejs/node/pull/26260)
<add> * add welcome message (gengjiawen) [#25947](https://github.com/nodejs/node/pull/25947)
<add> * fix terminal default setting (Ruben Bridgewater) [#26518](https://github.com/nodejs/node/pull/26518)
<add> * check colors with `.getColorDepth()` (Vladislav Kaminsky) [#26261](https://github.com/nodejs/node/pull/26261)
<add> * deprecate REPLServer.rli (Ruben Bridgewater) [#26260](https://github.com/nodejs/node/pull/26260)
<ide> * **src**:
<del> * remove unused `INT_MAX` constant (Sam Roberts) [#27078](https://github.com/nodejs/node/pull/27078)
<del> * update `NODE_MODULE_VERSION` to 72 (Ujjwal Sharma) [#26685](https://github.com/nodejs/node/pull/26685)
<del> * remove `AddPromiseHook()` (Anna Henningsen) [#26574](https://github.com/nodejs/node/pull/26574)
<del> * clean up `MultiIsolatePlatform` interface (Anna Henningsen) [#26384](https://github.com/nodejs/node/pull/26384)
<del> * properly configure default heap limits (Ali Ijaz Sheikh) [#25576](https://github.com/nodejs/node/pull/25576)
<del> * remove `icuDataDir` from node config (GauthamBanasandra) [#24780](https://github.com/nodejs/node/pull/24780)
<add> * remove unused `INT_MAX` constant (Sam Roberts) [#27078](https://github.com/nodejs/node/pull/27078)
<add> * update `NODE_MODULE_VERSION` to 72 (Ujjwal Sharma) [#26685](https://github.com/nodejs/node/pull/26685)
<add> * remove `AddPromiseHook()` (Anna Henningsen) [#26574](https://github.com/nodejs/node/pull/26574)
<add> * clean up `MultiIsolatePlatform` interface (Anna Henningsen) [#26384](https://github.com/nodejs/node/pull/26384)
<add> * properly configure default heap limits (Ali Ijaz Sheikh) [#25576](https://github.com/nodejs/node/pull/25576)
<add> * remove `icuDataDir` from node config (GauthamBanasandra) [#24780](https://github.com/nodejs/node/pull/24780)
<ide> * **tls**:
<del> * support TLSv1.3 (Sam Roberts) [#26209](https://github.com/nodejs/node/pull/26209)
<del> * return correct version from `getCipher()` (Sam Roberts) [#26625](https://github.com/nodejs/node/pull/26625)
<del> * check arg types of renegotiate() (Sam Roberts) [#25876](https://github.com/nodejs/node/pull/25876)
<del> * add code for `ERR_TLS_INVALID_PROTOCOL_METHOD` (Sam Roberts) [#24729](https://github.com/nodejs/node/pull/24729)
<del> * emit a warning when servername is an IP address (Rodger Combs) [#23329](https://github.com/nodejs/node/pull/23329)
<del> * disable TLS v1.0 and v1.1 by default (Ben Noordhuis) [#23814](https://github.com/nodejs/node/pull/23814)
<del> * remove unused arg to createSecureContext() (Sam Roberts) [#24241](https://github.com/nodejs/node/pull/24241)
<del> * deprecate `Server.prototype.setOptions()` (cjihrig) [#23820](https://github.com/nodejs/node/pull/23820)
<del> * load `NODE_EXTRA_CA_CERTS` at startup (Ouyang Yadong) [#23354](https://github.com/nodejs/node/pull/23354)
<add> * support TLSv1.3 (Sam Roberts) [#26209](https://github.com/nodejs/node/pull/26209)
<add> * return correct version from `getCipher()` (Sam Roberts) [#26625](https://github.com/nodejs/node/pull/26625)
<add> * check arg types of renegotiate() (Sam Roberts) [#25876](https://github.com/nodejs/node/pull/25876)
<add> * add code for `ERR_TLS_INVALID_PROTOCOL_METHOD` (Sam Roberts) [#24729](https://github.com/nodejs/node/pull/24729)
<add> * emit a warning when servername is an IP address (Rodger Combs) [#23329](https://github.com/nodejs/node/pull/23329)
<add> * disable TLS v1.0 and v1.1 by default (Ben Noordhuis) [#23814](https://github.com/nodejs/node/pull/23814)
<add> * remove unused arg to createSecureContext() (Sam Roberts) [#24241](https://github.com/nodejs/node/pull/24241)
<add> * deprecate `Server.prototype.setOptions()` (cjihrig) [#23820](https://github.com/nodejs/node/pull/23820)
<add> * load `NODE_EXTRA_CA_CERTS` at startup (Ouyang Yadong) [#23354](https://github.com/nodejs/node/pull/23354)
<ide> * **util**:
<del> * remove `util.print()`, `util.puts()`, `util.debug()` and `util.error()` (cjihrig) [#25377](https://github.com/nodejs/node/pull/25377)
<del> * change inspect compact and breakLength default (Ruben Bridgewater) [#27109](https://github.com/nodejs/node/pull/27109)
<del> * improve inspect edge cases (Ruben Bridgewater) [#27109](https://github.com/nodejs/node/pull/27109)
<del> * only the first line of the error message (Simon Zünd) [#26685](https://github.com/nodejs/node/pull/26685)
<del> * don't set the prototype of callbackified functions (Ruben Bridgewater) [#26893](https://github.com/nodejs/node/pull/26893)
<del> * rename callbackified function (Ruben Bridgewater) [#26893](https://github.com/nodejs/node/pull/26893)
<del> * increase function length when using `callbackify()` (Ruben Bridgewater) [#26893](https://github.com/nodejs/node/pull/26893)
<del> * prevent tampering with internals in `inspect()` (Ruben Bridgewater) [#26577](https://github.com/nodejs/node/pull/26577)
<del> * prevent Proxy traps being triggered by `.inspect()` (Ruben Bridgewater) [#26241](https://github.com/nodejs/node/pull/26241)
<del> * prevent leaking internal properties (Ruben Bridgewater) [#24971](https://github.com/nodejs/node/pull/24971)
<del> * protect against monkeypatched Object prototype for inspect() (Rich Trott) [#25953](https://github.com/nodejs/node/pull/25953)
<del> * treat format arguments equally (Roman Reiss) [#23162](https://github.com/nodejs/node/pull/23162)
<add> * remove `util.print()`, `util.puts()`, `util.debug()` and `util.error()` (cjihrig) [#25377](https://github.com/nodejs/node/pull/25377)
<add> * change inspect compact and breakLength default (Ruben Bridgewater) [#27109](https://github.com/nodejs/node/pull/27109)
<add> * improve inspect edge cases (Ruben Bridgewater) [#27109](https://github.com/nodejs/node/pull/27109)
<add> * only the first line of the error message (Simon Zünd) [#26685](https://github.com/nodejs/node/pull/26685)
<add> * don't set the prototype of callbackified functions (Ruben Bridgewater) [#26893](https://github.com/nodejs/node/pull/26893)
<add> * rename callbackified function (Ruben Bridgewater) [#26893](https://github.com/nodejs/node/pull/26893)
<add> * increase function length when using `callbackify()` (Ruben Bridgewater) [#26893](https://github.com/nodejs/node/pull/26893)
<add> * prevent tampering with internals in `inspect()` (Ruben Bridgewater) [#26577](https://github.com/nodejs/node/pull/26577)
<add> * prevent Proxy traps being triggered by `.inspect()` (Ruben Bridgewater) [#26241](https://github.com/nodejs/node/pull/26241)
<add> * prevent leaking internal properties (Ruben Bridgewater) [#24971](https://github.com/nodejs/node/pull/24971)
<add> * protect against monkeypatched Object prototype for inspect() (Rich Trott) [#25953](https://github.com/nodejs/node/pull/25953)
<add> * treat format arguments equally (Roman Reiss) [#23162](https://github.com/nodejs/node/pull/23162)
<ide> * **win, fs**: detect if symlink target is a directory (Bartosz Sosnowski) [#23724](https://github.com/nodejs/node/pull/23724)
<ide> * **zlib**:
<del> * throw TypeError if callback is missing (Anna Henningsen) [#24929](https://github.com/nodejs/node/pull/24929)
<del> * make “bare” constants un-enumerable (Anna Henningsen) [#24824](https://github.com/nodejs/node/pull/24824)
<add> * throw TypeError if callback is missing (Anna Henningsen) [#24929](https://github.com/nodejs/node/pull/24929)
<add> * make “bare” constants un-enumerable (Anna Henningsen) [#24824](https://github.com/nodejs/node/pull/24824)
<ide>
<ide> ### Semver-Major Commits
<ide>
<ide><path>doc/changelogs/CHANGELOG_V6.md
<ide> Fixes for the following CVEs are included in this release:
<ide> * **debugger**: Backport of [nodejs/node#8106](https://github.com/nodejs/node/pull/8106) to prevent the debugger from listening on `0.0.0.0`. It now defaults to `127.0.0.1`. Reported by Ben Noordhuis. (CVE-2018-12120 / Ben Noordhuis).
<ide> * **deps**: Upgrade to OpenSSL 1.0.2q, fixing CVE-2018-0734 and CVE-2018-5407
<ide> * **http**:
<del> * Headers received by HTTP servers must not exceed 8192 bytes in total to prevent possible Denial of Service attacks. Reported by Trevor Norris. (CVE-2018-12121 / Matteo Collina)
<del> * A timeout of 40 seconds now applies to servers receiving HTTP headers. This value can be adjusted with `server.headersTimeout`. Where headers are not completely received within this period, the socket is destroyed on the next received chunk. In conjunction with `server.setTimeout()`, this aids in protecting against excessive resource retention and possible Denial of Service. Reported by Jan Maybach ([liebdich.com](https://liebdich.com)). (CVE-2018-12122 / Matteo Collina)
<del> * Two-byte characters are now strictly disallowed for the `path` option in HTTP client requests. Paths containing characters outside of the range `\u0021` - `\u00ff` will now be rejected with a `TypeError`. This behavior can be reverted if necessary by supplying the `--security-revert=CVE-2018-12116` command line argument (this is not recommended). Reported as security concern for Node.js 6 and 8 by [Arkadiy Tetelman](https://twitter.com/arkadiyt) ([Lob](https://lob.com)), fixed by backporting a change by Benno Fünfstück applied to Node.js 10 and later. (CVE-2018-12116 / Matteo Collina)
<add> * Headers received by HTTP servers must not exceed 8192 bytes in total to prevent possible Denial of Service attacks. Reported by Trevor Norris. (CVE-2018-12121 / Matteo Collina)
<add> * A timeout of 40 seconds now applies to servers receiving HTTP headers. This value can be adjusted with `server.headersTimeout`. Where headers are not completely received within this period, the socket is destroyed on the next received chunk. In conjunction with `server.setTimeout()`, this aids in protecting against excessive resource retention and possible Denial of Service. Reported by Jan Maybach ([liebdich.com](https://liebdich.com)). (CVE-2018-12122 / Matteo Collina)
<add> * Two-byte characters are now strictly disallowed for the `path` option in HTTP client requests. Paths containing characters outside of the range `\u0021` - `\u00ff` will now be rejected with a `TypeError`. This behavior can be reverted if necessary by supplying the `--security-revert=CVE-2018-12116` command line argument (this is not recommended). Reported as security concern for Node.js 6 and 8 by [Arkadiy Tetelman](https://twitter.com/arkadiyt) ([Lob](https://lob.com)), fixed by backporting a change by Benno Fünfstück applied to Node.js 10 and later. (CVE-2018-12116 / Matteo Collina)
<ide> * **url**: Fix a bug that would allow a hostname being spoofed when parsing URLs with `url.parse()` with the `'javascript:'` protocol. Reported by [Martin Bajanik](https://twitter.com/_bayotop) ([Kentico](https://kenticocloud.com/)). (CVE-2018-12123 / Matteo Collina)
<ide>
<ide> ### Commits
<ide> are updates to dependencies.
<ide>
<ide> * **build**: shared library support is now working for AIX builds (Stewart Addison) [#9675](https://github.com/nodejs/node/pull/9675)
<ide> * **deps**:
<del> - *npm*: upgrade npm to 3.10.10 (Rebecca Turner) [#9847](https://github.com/nodejs/node/pull/9847)
<del> - *V8*: Destructuring of arrow function arguments via computed property no longer throws (Michaël Zasso) [#10386](https://github.com/nodejs/node/pull/10386)
<add> - *npm*: upgrade npm to 3.10.10 (Rebecca Turner) [#9847](https://github.com/nodejs/node/pull/9847)
<add> - *V8*: Destructuring of arrow function arguments via computed property no longer throws (Michaël Zasso) [#10386](https://github.com/nodejs/node/pull/10386)
<ide> * **inspector**: /json/version returns object, not an object wrapped in an array (Ben Noordhuis) [#9762](https://github.com/nodejs/node/pull/9762)
<ide> * **module**: using --debug-brk and --eval together now works as expected (Kelvin Jin) [#8876](https://github.com/nodejs/node/pull/8876)
<ide> * **process**: improve performance of nextTick up to 20% (Evan Lucas) [#8932](https://github.com/nodejs/node/pull/8932)
<ide> * **repl**:
<del> - the division operator will no longer be accidentally parsed as regex (Teddy Katz) [#10103](https://github.com/nodejs/node/pull/10103)
<del> - improved support for generator functions (Teddy Katz) [#9852](https://github.com/nodejs/node/pull/9852)
<add> - the division operator will no longer be accidentally parsed as regex (Teddy Katz) [#10103](https://github.com/nodejs/node/pull/10103)
<add> - improved support for generator functions (Teddy Katz) [#9852](https://github.com/nodejs/node/pull/9852)
<ide> * **timers**: Re canceling a cancelled timers will no longer throw (Jeremiah Senkpiel) [#9685](https://github.com/nodejs/node/pull/9685)
<ide>
<ide> ### Commits
<ide> commits which are updates to dependencies.
<ide>
<ide> * **buffer**: coerce slice parameters consistently (Sakthipriyan Vairamani (thefourtheye)) [#9101](https://github.com/nodejs/node/pull/9101)
<ide> * **deps**:
<del> - *npm*: upgrade npm to 3.10.9 (Kat Marchán) [#9286](https://github.com/nodejs/node/pull/9286)
<del> - *V8*: Various fixes to destructuring edge cases
<del> - cherry-pick 3c39bac from V8 upstream (Cristian Cavalli) [#9138](https://github.com/nodejs/node/pull/9138)
<del> - cherry pick 7166503 from upstream v8 (Cristian Cavalli) [#9173](https://github.com/nodejs/node/pull/9173)
<add> - *npm*: upgrade npm to 3.10.9 (Kat Marchán) [#9286](https://github.com/nodejs/node/pull/9286)
<add> - *V8*: Various fixes to destructuring edge cases
<add> - cherry-pick 3c39bac from V8 upstream (Cristian Cavalli) [#9138](https://github.com/nodejs/node/pull/9138)
<add> - cherry pick 7166503 from upstream v8 (Cristian Cavalli) [#9173](https://github.com/nodejs/node/pull/9173)
<ide> * **gtest**: the test reporter now outputs tap comments as yamlish (Johan Bergström) [#9262](https://github.com/nodejs/node/pull/9262)
<ide> * **inspector**: inspector now prompts user to use 127.0.0.1 rather than localhost (Eugene Ostroukhov) [#9451](https://github.com/nodejs/node/pull/9451)
<ide> * **tls**: fix memory leak when writing data to TLSWrap instance during handshake (Fedor Indutny) [#9586](https://github.com/nodejs/node/pull/9586)
<ide><path>doc/changelogs/CHANGELOG_V7.md
<ide> This release contains **v8 5.5**, you can read more about this version in the of
<ide> ### Notable changes
<ide>
<ide> * **deps**:
<del> * update V8 to 5.5 (Michaël Zasso) [#11029](https://github.com/nodejs/node/pull/11029)
<del> * upgrade libuv to 1.11.0 (cjihrig) [#11094](https://github.com/nodejs/node/pull/11094)
<del> * add node-inspect 1.10.4 (Jan Krems) [#10187](https://github.com/nodejs/node/pull/10187)
<del> * upgrade zlib to 1.2.11 (Sam Roberts) [#10980](https://github.com/nodejs/node/pull/10980)
<add> * update V8 to 5.5 (Michaël Zasso) [#11029](https://github.com/nodejs/node/pull/11029)
<add> * upgrade libuv to 1.11.0 (cjihrig) [#11094](https://github.com/nodejs/node/pull/11094)
<add> * add node-inspect 1.10.4 (Jan Krems) [#10187](https://github.com/nodejs/node/pull/10187)
<add> * upgrade zlib to 1.2.11 (Sam Roberts) [#10980](https://github.com/nodejs/node/pull/10980)
<ide> * **lib**: build `node inspect` into `node` (Anna Henningsen) [#10187](https://github.com/nodejs/node/pull/10187)
<ide> * **crypto**: Remove expired certs from CNNIC whitelist (Shigeki Ohtsu) [#9469](https://github.com/nodejs/node/pull/9469)
<ide> * **inspector**: add --inspect-brk (Josh Gavant) [#11149](https://github.com/nodejs/node/pull/11149)
<ide><path>doc/changelogs/CHANGELOG_V8.md
<ide> Fixes for the following CVEs are included in this release:
<ide>
<ide> * **deps**: Upgrade to OpenSSL 1.0.2q, fixing CVE-2018-0734 and CVE-2018-5407
<ide> * **http**:
<del> * Headers received by HTTP servers must not exceed 8192 bytes in total to prevent possible Denial of Service attacks. Reported by Trevor Norris. (CVE-2018-12121 / Matteo Collina)
<del> * A timeout of 40 seconds now applies to servers receiving HTTP headers. This value can be adjusted with `server.headersTimeout`. Where headers are not completely received within this period, the socket is destroyed on the next received chunk. In conjunction with `server.setTimeout()`, this aids in protecting against excessive resource retention and possible Denial of Service. Reported by Jan Maybach ([liebdich.com](https://liebdich.com)). (CVE-2018-12122 / Matteo Collina)
<del> * Two-byte characters are now strictly disallowed for the `path` option in HTTP client requests. Paths containing characters outside of the range `\u0021` - `\u00ff` will now be rejected with a `TypeError`. This behavior can be reverted if necessary by supplying the `--security-revert=CVE-2018-12116` command line argument (this is not recommended). Reported as security concern for Node.js 6 and 8 by [Arkadiy Tetelman](https://twitter.com/arkadiyt) ([Lob](https://lob.com)), fixed by backporting a change by Benno Fünfstück applied to Node.js 10 and later. (CVE-2018-12116 / Matteo Collina)
<add> * Headers received by HTTP servers must not exceed 8192 bytes in total to prevent possible Denial of Service attacks. Reported by Trevor Norris. (CVE-2018-12121 / Matteo Collina)
<add> * A timeout of 40 seconds now applies to servers receiving HTTP headers. This value can be adjusted with `server.headersTimeout`. Where headers are not completely received within this period, the socket is destroyed on the next received chunk. In conjunction with `server.setTimeout()`, this aids in protecting against excessive resource retention and possible Denial of Service. Reported by Jan Maybach ([liebdich.com](https://liebdich.com)). (CVE-2018-12122 / Matteo Collina)
<add> * Two-byte characters are now strictly disallowed for the `path` option in HTTP client requests. Paths containing characters outside of the range `\u0021` - `\u00ff` will now be rejected with a `TypeError`. This behavior can be reverted if necessary by supplying the `--security-revert=CVE-2018-12116` command line argument (this is not recommended). Reported as security concern for Node.js 6 and 8 by [Arkadiy Tetelman](https://twitter.com/arkadiyt) ([Lob](https://lob.com)), fixed by backporting a change by Benno Fünfstück applied to Node.js 10 and later. (CVE-2018-12116 / Matteo Collina)
<ide> * **url**: Fix a bug that would allow a hostname being spoofed when parsing URLs with `url.parse()` with the `'javascript:'` protocol. Reported by [Martin Bajanik](https://twitter.com/_bayotop) ([Kentico](https://kenticocloud.com/)). (CVE-2018-12123 / Matteo Collina)
<ide>
<ide> ### Commits
<ide> Big thanks to @addaleax who prepared the vast majority of this release.
<ide> [[`dc3f6b9ac1`](https://github.com/nodejs/node/commit/dc3f6b9ac1)]
<ide> [#14235](https://github.com/nodejs/node/pull/14235)
<ide> * `npm` Changelogs:
<del> - [v5.0.4](https://github.com/npm/npm/releases/tag/v5.0.4)
<del> - [v5.1.0](https://github.com/npm/npm/releases/tag/v5.1.0)
<del> - [v5.2.0](https://github.com/npm/npm/releases/tag/v5.2.0)
<del> - [v5.3.0](https://github.com/npm/npm/releases/tag/v5.3.0)
<add> - [v5.0.4](https://github.com/npm/npm/releases/tag/v5.0.4)
<add> - [v5.1.0](https://github.com/npm/npm/releases/tag/v5.1.0)
<add> - [v5.2.0](https://github.com/npm/npm/releases/tag/v5.2.0)
<add> - [v5.3.0](https://github.com/npm/npm/releases/tag/v5.3.0)
<ide>
<ide> ### Commits
<ide>
<ide><path>doc/guides/adding-new-napi-api.md
<ide> a set of principles and guidelines to keep in mind while adding a new
<ide> N-API API.
<ide>
<ide> * A new API **must** adhere to N-API API shape and spirit.
<del> * **Must** be a C API.
<del> * **Must** not throw exceptions.
<del> * **Must** return `napi_status`.
<del> * **Should** consume `napi_env`.
<del> * **Must** operate only on primitive data types, pointers to primitive
<del> datatypes or opaque handles.
<del> * **Must** be a necessary API and not a nice to have. Convenience APIs
<del> belong in node-addon-api.
<del> * **Must** not change the signature of an existing N-API API or break
<del> ABI compatibility with other versions of Node.js.
<add> * **Must** be a C API.
<add> * **Must** not throw exceptions.
<add> * **Must** return `napi_status`.
<add> * **Should** consume `napi_env`.
<add> * **Must** operate only on primitive data types, pointers to primitive
<add> datatypes or opaque handles.
<add> * **Must** be a necessary API and not a nice to have. Convenience APIs
<add> belong in node-addon-api.
<add> * **Must** not change the signature of an existing N-API API or break
<add> ABI compatibility with other versions of Node.js.
<ide> * New API **should** be agnostic towards the underlying JavaScript VM.
<ide> * New API PRs **must** have a corresponding documentation update.
<ide> * New API PRs **must** be tagged as **n-api**.
<ide> N-API API.
<ide> * A new API **must** be considered experimental for at least one minor
<ide> version release of Node.js before it can be considered for promotion out
<ide> of experimental.
<del> * Experimental APIs **must** be documented as such.
<del> * Experimental APIs **must** require an explicit compile-time flag
<del> (`#define`) to be set to opt-in.
<del> * Experimental APIs **must** be considered for backport.
<del> * Experimental status exit criteria **must** involve at least the
<del> following:
<del> * A new PR **must** be opened in `nodejs/node` to remove experimental
<del> status. This PR **must** be tagged as **n-api** and **semver-minor**.
<del> * Exiting an API from experimental **must** be signed off by the team.
<del> * If a backport is merited, an API **must** have a down-level
<del> implementation.
<del> * The API **should** be used by a published real-world module. Use of
<del> the API by a real-world published module will contribute favorably
<del> to the decision to take an API out of experimental status.
<del> * The API **must** be implemented in a Node.js implementation with an
<del> alternate VM.
<add> * Experimental APIs **must** be documented as such.
<add> * Experimental APIs **must** require an explicit compile-time flag
<add> (`#define`) to be set to opt-in.
<add> * Experimental APIs **must** be considered for backport.
<add> * Experimental status exit criteria **must** involve at least the
<add> following:
<add> * A new PR **must** be opened in `nodejs/node` to remove experimental
<add> status. This PR **must** be tagged as **n-api** and **semver-minor**.
<add> * Exiting an API from experimental **must** be signed off by the team.
<add> * If a backport is merited, an API **must** have a down-level
<add> implementation.
<add> * The API **should** be used by a published real-world module. Use of
<add> the API by a real-world published module will contribute favorably
<add> to the decision to take an API out of experimental status.
<add> * The API **must** be implemented in a Node.js implementation with an
<add> alternate VM.
<ide><path>doc/guides/diagnostic-tooling-support-tiers.md
<ide> the following tiers.
<ide> early warning of potential issues. No commit to the current and LTS
<ide> release branches should break this tool/API if the next major release
<ide> is within 1 month. In addition:
<del> * The maintainers of the tool must remain responsive when there
<del> are problems;
<del> * The tool must be actively used by the ecosystem;
<del> * The tool must be heavily depended on;
<del> * The tool must have a guide or other documentation in the Node.js GitHub
<del> organization or website;
<del> * The tool must be working on all supported platforms;
<del> * The tool must only be using APIs exposed by Nodejs as opposed to
<del> its dependencies; and
<del> * The tool must be open source.
<add> * The maintainers of the tool must remain responsive when there
<add> are problems;
<add> * The tool must be actively used by the ecosystem;
<add> * The tool must be heavily depended on;
<add> * The tool must have a guide or other documentation in the Node.js GitHub
<add> organization or website;
<add> * The tool must be working on all supported platforms;
<add> * The tool must only be using APIs exposed by Nodejs as opposed to
<add> its dependencies; and
<add> * The tool must be open source.
<ide>
<ide> * Tier 2 - Must be working(CI tests passing) for all
<ide> LTS releases. An LTS release will not be shipped if the test
<ide> suite for the tool/API is not green. To be considered for inclusion
<ide> in this tier it must have a good test suite and that test suite and a job
<ide> must exist in the Node.js CI so that it can be run as part of the release
<ide> process. In addition:
<del> * The maintainers of the tool must remain responsive when
<del> there are problems;
<del> * The tool must be actively used by the ecosystem;
<del> * The tool must be heavily depended on;
<del> * The tool must have a guide or other documentation in the Node.js GitHub
<del> organization or website;
<del> * The tool must be open source.
<add> * The maintainers of the tool must remain responsive when
<add> there are problems;
<add> * The tool must be actively used by the ecosystem;
<add> * The tool must be heavily depended on;
<add> * The tool must have a guide or other documentation in the Node.js GitHub
<add> organization or website;
<add> * The tool must be open source.
<ide>
<ide> * Tier 3 - If possible its test suite
<ide> will be run at least nightly in the Node.js CI and issues opened for
<ide><path>doc/offboarding.md
<ide> Emeritus or leaves the project.
<ide> moving to Collaborator Emeritus.
<ide> * Determine what GitHub teams the Collaborator belongs to. In consultation with
<ide> the Collaborator, determine which of those teams they should be removed from.
<del> * Some teams may also require a pull request to remove the Collaborator from
<del> a team listing. For example, if someone is removed from @nodejs/build,
<del> they should also be removed from the Build WG README.md file in the
<del> https://github.com/nodejs/build repository.
<add> * Some teams may also require a pull request to remove the Collaborator from
<add> a team listing. For example, if someone is removed from @nodejs/build,
<add> they should also be removed from the Build WG README.md file in the
<add> https://github.com/nodejs/build repository. | 14 |
Go | Go | increase timeout for userland proxy starting | 72c55e82156843c73ab1405b565e63d947b66c10 | <ide><path>daemon/networkdriver/portmapper/proxy.go
<ide> func (p *proxyCommand) Start() error {
<ide> select {
<ide> case err := <-errchan:
<ide> return err
<del> case <-time.After(1 * time.Second):
<add> case <-time.After(16 * time.Second):
<ide> return fmt.Errorf("Timed out proxy starting the userland proxy")
<ide> }
<ide> } | 1 |
Javascript | Javascript | simulate arial black and arial narrow | 00d2366d1d64a8c0acd28f904aa5deaecb13ad51 | <ide><path>fonts.js
<ide> var kMaxWaitForFontFace = 1000;
<ide> * fonts and their acronyms.
<ide> */
<ide> var stdFontMap = {
<add> 'ArialNarrow': 'Helvetica',
<add> 'ArialNarrow_Bold': 'Helvetica-Bold',
<add> 'ArialNarrow_BoldItalic': 'Helvetica-BoldOblique',
<add> 'ArialNarrow_Italic': 'Helvetica-Oblique',
<add> 'ArialBlack': 'Helvetica',
<add> 'ArialBlack_Bold': 'Helvetica-Bold',
<add> 'ArialBlack_BoldItalic': 'Helvetica-BoldOblique',
<add> 'ArialBlack_Italic': 'Helvetica-Oblique',
<ide> 'Arial': 'Helvetica',
<ide> 'Arial_Bold': 'Helvetica-Bold',
<ide> 'Arial_BoldItalic': 'Helvetica-BoldOblique',
<ide> var Font = (function Font() {
<ide> this.bold = (fontName.indexOf('Bold') != -1);
<ide> this.italic = (fontName.indexOf('Oblique') != -1) ||
<ide> (fontName.indexOf('Italic') != -1);
<add>
<add> // Use 'name' instead of 'fontName' here because the original
<add> // name ArialNarrow for example will be replaced by Helvetica.
<add> this.narrow = (name.indexOf("Narrow") != -1)
<add> this.black = (name.indexOf("Black") != -1)
<add>
<ide> this.loadedName = fontName.split('-')[0];
<ide> this.loading = false;
<ide> return;
<ide><path>pdf.js
<ide> var PartialEvaluator = (function() {
<ide> }
<ide>
<ide> var descriptor = xref.fetch(fd);
<del> var fontName = fontDict.get('Name');
<del> if (!fontName)
<del> fontName = xref.fetchIfRef(descriptor.get('FontName'));
<add> var fontName = xref.fetchIfRef(descriptor.get('FontName'));
<ide> assertWellFormed(IsName(fontName), 'invalid font name');
<ide> fontName = fontName.name.replace(/[\+,\-]/g, '_');
<ide>
<ide> var CanvasGraphics = (function() {
<ide>
<ide> size = (size <= kRasterizerMin) ? size * kScalePrecision : size;
<ide>
<del> var bold = fontObj.bold ? 'bold' : 'normal';
<add> var bold = fontObj.black ? (fontObj.bold ? 'bolder' : 'bold')
<add> : (fontObj.bold ? 'bold' : 'normal');
<add>
<ide> var italic = fontObj.italic ? 'italic' : 'normal';
<ide> var rule = italic + ' ' + bold + ' ' + size + 'px "' + name + '"';
<ide> this.ctx.font = rule;
<ide> var CanvasGraphics = (function() {
<ide> this.moveText(0, this.current.leading);
<ide> },
<ide> showText: function(text) {
<del> // TODO: apply charSpacing, wordSpacing, textHScale
<del>
<ide> var ctx = this.ctx;
<ide> var current = this.current;
<ide>
<ide> var CanvasGraphics = (function() {
<ide> ctx.translate(current.x, -1 * current.y);
<ide>
<ide> var scaleFactorX = 1, scaleFactorY = 1;
<del> var font = this.current.font;
<add> var font = current.font;
<ide> if (font) {
<del> if (this.current.fontSize <= kRasterizerMin) {
<add> if (current.fontSize <= kRasterizerMin) {
<ide> scaleFactorX = scaleFactorY = kScalePrecision;
<ide> ctx.scale(1 / scaleFactorX, 1 / scaleFactorY);
<ide> }
<ide> var CanvasGraphics = (function() {
<ide> var wordSpacing = current.wordSpacing;
<ide> var textHScale = current.textHScale;
<ide>
<add> // This is a poor simulation for Arial Narrow while font-stretch
<add> // is not implemented (bug 3512)
<add> if (current.font.narrow) {
<add> textHScale += 0.2;
<add> charSpacing -= (0.09 * current.fontSize);
<add> }
<add>
<ide> if (charSpacing != 0 || wordSpacing != 0 || textHScale != 1) {
<ide> scaleFactorX *= textHScale;
<ide> ctx.scale(1 / textHScale, 1); | 2 |
Text | Text | update security guidelines to current branch | 94340c7b1a3d0a74c20f0df7a5d29cbd3ea40291 | <ide><path>SECURITY.md
<ide> # Security Policy
<ide>
<del>This document outlines our security policy for the codebase, and how to report vulnerability.
<add>This document outlines our security policy for the codebase, and how to report vulnerabilities.
<ide>
<ide> ## Versions
<ide>
<ide> | Version | Branch | Supported | Website active |
<ide> | ----------- | ------------------------ | ------------------ | ---------------- |
<del>| production | `production-legacy-2018` | :white_check_mark: | freecodecamp.org |
<add>| production | `production-current` | :white_check_mark: | freecodecamp.org |
<ide> | beta | `production-staging` | :white_check_mark: | freecodecamp.dev |
<ide> | development | `master` | | |
<ide> | 1 |
Javascript | Javascript | fix impression logging in virtualizedlist | 1bc06f18c613f9a85d5b631493a09682524016f2 | <ide><path>Libraries/Lists/VirtualizedList.js
<ide> const ViewabilityHelper = require('./ViewabilityHelper');
<ide> const flattenStyle = require('../StyleSheet/flattenStyle');
<ide> const infoLog = require('../Utilities/infoLog');
<ide> const invariant = require('invariant');
<add>import VirtualizedListInjection from './VirtualizedListInjection';
<ide>
<ide> const {computeWindowedRenderLimits} = require('./VirtualizeUtils');
<ide>
<ide> class VirtualizedList extends React.PureComponent<Props, State> {
<ide> const scrollMetrics = this._convertParentScrollMetrics(
<ide> this.context.getScrollMetrics(),
<ide> );
<del> this._scrollMetrics.visibleLength = scrollMetrics.visibleLength;
<del> this._scrollMetrics.offset = scrollMetrics.offset;
<add>
<add> const metricsChanged =
<add> this._scrollMetrics.visibleLength !== scrollMetrics.visibleLength ||
<add> this._scrollMetrics.offset !== scrollMetrics.offset;
<add>
<add> if (metricsChanged) {
<add> this._scrollMetrics.visibleLength = scrollMetrics.visibleLength;
<add> this._scrollMetrics.offset = scrollMetrics.offset;
<add>
<add> if (
<add> VirtualizedListInjection?.unstable_enableVirtualizedListRemeasureChildrenIfNeeded
<add> ) {
<add> // If metrics of the scrollView changed, then we triggered remeasure for child list
<add> // to ensure VirtualizedList has the right information.
<add> this._cellKeysToChildListKeys.forEach(childListKeys => {
<add> if (childListKeys) {
<add> for (let childKey of childListKeys) {
<add> const childList = this._nestedChildLists.get(childKey);
<add> childList &&
<add> childList.ref &&
<add> childList.ref.measureLayoutRelativeToContainingList();
<add> }
<add> }
<add> });
<add> }
<add> }
<ide> },
<ide> error => {
<ide> console.warn(
<ide><path>Libraries/Lists/VirtualizedListInjection.js
<add>/**
<add> * Copyright (c) Facebook, Inc. and its affiliates.
<add> *
<add> * This source code is licensed under the MIT license found in the
<add> * LICENSE file in the root directory of this source tree.
<add> *
<add> * @format
<add> * @flow
<add> */
<add>
<add>'use strict';
<add>
<add>export default {
<add> unstable_enableVirtualizedListRemeasureChildrenIfNeeded: (null: ?boolean),
<add>}; | 2 |
Text | Text | update parameter type for fspromises.chmod() | ba4d68c8f3525d2a3a0680ee64189b93d41548ec | <ide><path>doc/api/fs.md
<ide> added: v10.0.0
<ide> -->
<ide>
<ide> * `path` {string|Buffer|URL}
<del>* `mode` {integer}
<add>* `mode` {string|integer}
<ide> * Returns: {Promise}
<ide>
<ide> Changes the permissions of a file then resolves the `Promise` with no | 1 |
Mixed | Go | use binary frame for websocket attach endpoint | e82dcaab520cb5676091f31d90614d3988a725e4 | <ide><path>api/server/router/container/container_routes.go
<ide> func (s *containerRouter) wsContainersAttach(ctx context.Context, w http.Respons
<ide> done := make(chan struct{})
<ide> started := make(chan struct{})
<ide>
<add> version := httputils.VersionFromContext(ctx)
<add>
<ide> setupStreams := func() (io.ReadCloser, io.Writer, io.Writer, error) {
<ide> wsChan := make(chan *websocket.Conn)
<ide> h := func(conn *websocket.Conn) {
<ide> func (s *containerRouter) wsContainersAttach(ctx context.Context, w http.Respons
<ide> }()
<ide>
<ide> conn := <-wsChan
<add> // In case version is higher than 1.26, a binary frame will be sent.
<add> // See 28176 for details.
<add> if versions.GreaterThanOrEqualTo(version, "1.26") {
<add> conn.PayloadType = websocket.BinaryFrame
<add> }
<ide> return conn, conn, conn, nil
<ide> }
<ide>
<ide><path>docs/api/version-history.md
<ide> keywords: "API, Docker, rcli, REST, documentation"
<ide>
<ide> [Docker Engine API v1.26](v1.26/) documentation
<ide>
<add>* `GET /containers/(id or name)/attach/ws` now returns WebSocket in binary frame format for API version >= v1.26,
<add> and returns WebSocket in text frame format for API version< v1.26, for the purpose of backward-compatibility.
<add>
<ide> ## v1.25 API changes
<ide>
<ide> [Docker Engine API v1.25](v1.25.md) documentation | 2 |
Text | Text | add wix & wixanswers | 2c89fbc5c67755f4dd82d1ab9fe3cad21d929967 | <ide><path>INTHEWILD.md
<ide> Currently, **officially** using Airflow:
<ide> 1. [Whistle Labs](http://www.whistle.com) [[@ananya77041](https://github.com/ananya77041)]
<ide> 1. [Wildlifestudios](https://wildlifestudios.com/)
<ide> 1. [WiseBanyan](https://wisebanyan.com/)
<add>1. [WixAnswers](https://www.wixanswers.com/) [[@eladkal](https://github.com/eladkal)]
<add>1. [Wix](https://www.wix.com/) [[@eladkal](https://github.com/eladkal)]
<ide> 1. [Wooga](https://www.wooga.com/)
<ide> 1. [WorldRemit](https://www.worldremit.com/) [[@boittega](https://github.com/boittega)]
<ide> 1. [Wrike](https://www.wrike.com) [[@eliseealex](https://github.com/eliseealex) & [teoretic6](https://github.com/Teoretic6)] | 1 |
Python | Python | fix bugs in python 3.x | a804f4db2ae4e545fa7302b2cdd21bb39176165f | <ide><path>research/pcl_rl/env_spec.py
<ide> def __init__(self, env, try_combining_actions=True,
<ide> else:
<ide> self.combine_actions = False
<ide>
<del> self.obs_dims_and_types = zip(self.obs_dims, self.obs_types)
<del> self.act_dims_and_types = zip(self.act_dims, self.act_types)
<add> self.obs_dims_and_types = tuple(zip(self.obs_dims, self.obs_types))
<add> self.act_dims_and_types = tuple(zip(self.act_dims, self.act_types))
<ide>
<ide> self.total_obs_dim = sum(self.obs_dims)
<ide> self.total_sampling_act_dim = sum(self.sampling_dim(dim, typ) | 1 |
PHP | PHP | fix doc blocks for auto complete | e52cb7a23b8f589f1832000811b0bf42039e14b4 | <ide><path>src/Controller/Component.php
<ide> class Component implements EventListenerInterface
<ide> /**
<ide> * Request object
<ide> *
<del> * @var \Cake\Network\Request
<add> * @var \Cake\Http\ServerRequest
<ide> */
<ide> public $request;
<ide>
<ide><path>src/Controller/Component/SecurityComponent.php
<ide> class SecurityComponent extends Component
<ide> /**
<ide> * Request object
<ide> *
<del> * @var \Cake\Network\Request
<add> * @var \Cake\Http\ServerRequest
<ide> */
<ide> public $request;
<ide>
<ide><path>src/Controller/Controller.php
<ide> class Controller implements EventListenerInterface, EventDispatcherInterface
<ide> * This object contains all the information about a request and several methods for reading
<ide> * additional information about the request.
<ide> *
<del> * @var \Cake\Network\Request
<add> * @var \Cake\Http\ServerRequest
<ide> * @link http://book.cakephp.org/3.0/en/controllers/request-response.html#request
<ide> */
<ide> public $request;
<ide><path>src/View/Cell.php
<ide> abstract class Cell
<ide> * This object contains all the information about a request and several methods for reading
<ide> * additional information about the request.
<ide> *
<del> * @var \Cake\Network\Request
<add> * @var \Cake\Http\ServerRequest
<ide> */
<ide> public $request;
<ide>
<ide><path>src/View/Form/ArrayContext.php
<ide> class ArrayContext implements ContextInterface
<ide> /**
<ide> * The request object.
<ide> *
<del> * @var \Cake\Network\Request
<add> * @var \Cake\Http\ServerRequest
<ide> */
<ide> protected $_request;
<ide>
<ide><path>src/View/Form/EntityContext.php
<ide> class EntityContext implements ContextInterface
<ide> /**
<ide> * The request object.
<ide> *
<del> * @var \Cake\Network\Request
<add> * @var \Cake\Http\ServerRequest
<ide> */
<ide> protected $_request;
<ide>
<ide><path>src/View/Form/FormContext.php
<ide> class FormContext implements ContextInterface
<ide> /**
<ide> * The request object.
<ide> *
<del> * @var \Cake\Network\Request
<add> * @var \Cake\Http\ServerRequest
<ide> */
<ide> protected $_request;
<ide>
<ide><path>src/View/Form/NullContext.php
<ide> class NullContext implements ContextInterface
<ide> /**
<ide> * The request object.
<ide> *
<del> * @var \Cake\Network\Request
<add> * @var \Cake\Http\ServerRequest
<ide> */
<ide> protected $_request;
<ide>
<ide><path>src/View/Helper.php
<ide> class Helper implements EventListenerInterface
<ide> /**
<ide> * Request object
<ide> *
<del> * @var \Cake\Network\Request
<add> * @var \Cake\Http\ServerRequest
<ide> */
<ide> public $request = null;
<ide>
<ide><path>src/View/View.php
<ide> class View implements EventDispatcherInterface
<ide> * This object contains all the information about a request and several methods for reading
<ide> * additional information about the request.
<ide> *
<del> * @var \Cake\Network\Request
<add> * @var \Cake\Http\ServerRequest
<ide> */
<ide> public $request;
<ide>
<ide><path>tests/test_app/TestApp/View/Cell/ArticlesCell.php
<ide> class ArticlesCell extends \Cake\View\Cell
<ide> /**
<ide> * Counter used to test the cache cell feature
<ide> *
<del> * @return void
<add> * @var int
<ide> */
<ide> public $counter = 0;
<ide> | 11 |
Javascript | Javascript | fix ie specific test | 0960cd0613d0b3501ad724885492dddc7fc4c42a | <ide><path>test/ng/directive/booleanAttrsSpec.js
<ide> describe('ngSrc', function() {
<ide> // then calling element.setAttribute('src', 'foo') doesn't do anything, so we need
<ide> // to set the property as well to achieve the desired effect
<ide>
<del> var element = $compile('<div ng-src="some/{{id}}"></div>')($rootScope);
<add> var element = $compile('<div ng-src="{{id}}"></div>')($rootScope);
<ide>
<ide> $rootScope.$digest();
<del> expect(element.prop('src')).toEqual('some/');
<add> expect(element.prop('src')).toBeUndefined();
<ide>
<ide> $rootScope.$apply(function() {
<ide> $rootScope.id = 1;
<ide> });
<del> expect(element.prop('src')).toEqual('some/1');
<add> expect(element.prop('src')).toEqual('1');
<ide>
<ide> dealoc(element);
<ide> })); | 1 |
Javascript | Javascript | fix dir attribute for the extension | dbe633d3243507f6945a6a4c9e5bc7ba806847ad | <ide><path>extensions/firefox/tools/l10n.js
<ide> // get a localized string
<ide> get: translateString,
<ide>
<del> // get|set the document language and direction
<del> get language() {
<del> return {
<del> // get|set the document language (ISO-639-1)
<del> get code() { return gLanguage; },
<del>
<del> // get the direction (ltr|rtl) of the current language
<del> get direction() {
<del> // http://www.w3.org/International/questions/qa-scripts
<del> // Arabic, Hebrew, Farsi, Pashto, Urdu
<del> var rtlList = ['ar', 'he', 'fa', 'ps', 'ur'];
<del> return (rtlList.indexOf(gLanguage) >= 0) ? 'rtl' : 'ltr';
<del> }
<del> };
<add> // get the document language
<add> getLanguage: function() { return gLanguage; },
<add>
<add> // get the direction (ltr|rtl) of the current language
<add> getDirection: function() {
<add> // http://www.w3.org/International/questions/qa-scripts
<add> // Arabic, Hebrew, Farsi, Pashto, Urdu
<add> var rtlList = ['ar', 'he', 'fa', 'ps', 'ur'];
<add> return (rtlList.indexOf(gLanguage) >= 0) ? 'rtl' : 'ltr';
<ide> }
<ide> };
<ide> })(this); | 1 |
Ruby | Ruby | specify gem version in environment.rb | 53e1e50e0475fbb6009fc60ad374e9788ab710cd | <ide><path>railties/environments/boot.rb
<ide> require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
<ide> else
<ide> require 'rubygems'
<del> required_version = '<%= Rails::VERSION::STRING %>'
<del> rails_gem = Gem.cache.search('rails', "=#{required_version}").first
<del> unless rails_gem
<del> STDERR.puts "Cannot find gem for Rails =#{required_version}. Install missing gem or change config/boot.rb."
<add>
<add> if !defined?(RAILS_GEM_VERSION) && File.read(File.dirname(__FILE__) + '/environment.rb') =~ /RAILS_GEM_VERSION = '([\d.]+)'/
<add> RAILS_GEM_VERSION = $1
<add> end
<add>
<add> if defined?(RAILS_GEM_VERSION)
<add> rails_gem = Gem.cache.search('rails', "=#{RAILS_GEM_VERSION}").first
<add>
<add> if rails_gem
<add> require rails_gem.full_gem_path + '/lib/initializer'
<add> else
<add> STDERR.puts "Cannot find gem for Rails =#{RAILS_GEM_VERSION}. Install missing gem or change config/boot.rb."
<add> end
<add> else
<add> require 'initializer'
<ide> end
<del> require rails_gem.full_gem_path + '/lib/initializer'
<ide> end
<ide>
<del>Rails::Initializer.run(:set_load_path)
<add>Rails::Initializer.run(:set_load_path)
<ide>\ No newline at end of file
<ide><path>railties/environments/environment.rb
<ide> # you don't control web/app server and can't set it the proper way
<ide> # ENV['RAILS_ENV'] ||= 'production'
<ide>
<add># Specifies gem version of Rails to use when vendor/rails is not present
<add>RAILS_GEM_VERSION = '<%= Rails::VERSION::STRING %>'
<add>
<ide> # Bootstrap the Rails environment, frameworks, and default configuration
<ide> require File.join(File.dirname(__FILE__), 'boot')
<ide>
<ide><path>railties/lib/rails_generator/generators/applications/app/app_generator.rb
<ide> def manifest
<ide> m.template "configs/apache.conf", "public/.htaccess"
<ide>
<ide> # Environments
<del> m.template "environments/boot.rb", "config/boot.rb"
<del> m.file "environments/environment.rb", "config/environment.rb"
<add> m.file "environments/boot.rb", "config/boot.rb"
<add> m.template "environments/environment.rb", "config/environment.rb"
<ide> m.file "environments/production.rb", "config/environments/production.rb"
<ide> m.file "environments/development.rb", "config/environments/development.rb"
<ide> m.file "environments/test.rb", "config/environments/test.rb" | 3 |
Text | Text | add references to punycode.md | 7dea99b1e6850591454c31042ca5087608f43d6f | <ide><path>doc/api/punycode.md
<ide> deprecated: v7.0.0
<ide> **The version of the punycode module bundled in Node.js is being deprecated**.
<ide> In a future major version of Node.js this module will be removed. Users
<ide> currently depending on the `punycode` module should switch to using the
<del>userland-provided [Punycode.js][] module instead.
<add>userland-provided [Punycode.js][] module instead. For punycode-based URL
<add>encoding, see [`url.domainToASCII`][] or, more generally, the
<add>[WHATWG URL API][].
<ide>
<ide> The `punycode` module is a bundled version of the [Punycode.js][] module. It
<ide> can be accessed using:
<ide> Returns a string identifying the current [Punycode.js][] version number.
<ide>
<ide> [Punycode]: https://tools.ietf.org/html/rfc3492
<ide> [Punycode.js]: https://github.com/bestiejs/punycode.js
<add>[WHATWG URL API]: url.md#url_the_whatwg_url_api
<add>[`url.domainToASCII`]: url.md#url_url_domaintoascii_domain | 1 |
Ruby | Ruby | remove array allocation | 4d2ccc119cac2dc2757d3d977059feba9db858d2 | <ide><path>actionpack/lib/action_dispatch/journey/formatter.rb
<ide> def initialize(routes)
<ide>
<ide> def generate(name, options, path_parameters, parameterize = nil)
<ide> constraints = path_parameters.merge(options)
<del> missing_keys = []
<add> missing_keys = nil # need for variable scope
<ide>
<ide> match_route(name, constraints) do |route|
<ide> parameterized_parts = extract_parameterized_parts(route, options, path_parameters, parameterize)
<ide> def generate(name, options, path_parameters, parameterize = nil)
<ide> end
<ide>
<ide> message = "No route matches #{Hash[constraints.sort_by{|k,v| k.to_s}].inspect}"
<del> message << " missing required keys: #{missing_keys.sort.inspect}" unless missing_keys.empty?
<add> message << " missing required keys: #{missing_keys.sort.inspect}" if missing_keys && missing_keys.any?
<ide>
<ide> raise ActionController::UrlGenerationError, message
<ide> end | 1 |
Text | Text | add documentation for merge layer | 482bf236b32ee650f910e98c528ebd7212a7ba2f | <ide><path>docs/sources/layers/core.md
<ide> model.add(Dense(10, 100)) # output shape: (nb_samples, 100)
<ide> model.add(RepeatVector(2)) # output shape: (nb_samples, 2, 10)
<ide> ```
<ide>
<add>## Merge
<add>```python
<add>keras.layers.core.Merge(models, mode='sum')
<add>```
<add>
<add>Merge the output of a list of models into a single tensor, following one of two modes: `sum` or `concat`.
<add>
<add>- __Arguments__:
<add> - __models__: List of `Sequential` models.
<add> - __mode__: String, one of `{'sum', 'concat'}`. `sum` will simply sum the outputs of the models (therefore all models should have an output with the same shape). `concat` will concatenate the outputs along the last dimension (therefore all models should have an output that only differ along the last dimension).
<add>
<add>- __Example__:
<add>
<add>```python
<add>left = Sequential()
<add>left.add(Dense(784, 50))
<add>left.add(Activation('relu'))
<add>
<add>right = Sequential()
<add>right.add(Dense(784, 50))
<add>right.add(Activation('relu'))
<add>
<add>model = Sequential()
<add>model.add(Merge([left, right], mode='sum'))
<add>
<add>model.add(Dense(50, 10))
<add>model.add(Activation('softmax'))
<add>
<add>model.compile(loss='categorical_crossentropy', optimizer='rmsprop')
<add>
<add>model.fit([X_train, X_train], Y_train, batch_size=128, nb_epoch=20, validation_data=([X_test, X_test], Y_test))
<add>```
<add> | 1 |
Text | Text | fix typo in readme | ec76ef8069433dea3d23d8d7d69fec6c281497d5 | <ide><path>README.md
<ide> var map3 = map1.merge(map2, obj);
<ide> // Map { a: 20, b: 2, c: 10, d: 1000, t: 30, o: 2000, g: 300 }
<ide> ```
<ide>
<del>This is possible because `immutible` can treat any JavaScript Array or Object
<add>This is possible because `immutable` can treat any JavaScript Array or Object
<ide> as a Sequence. You can take advantage of this in order to get sophisticated
<ide> sequence methods on JavaScript Objects, which otherwise have a very sparse
<ide> native API. Because Sequences evaluate lazily and do not cache intermediate | 1 |
Go | Go | remove redundant "testrequires" | 7f37d99ef50b4046284ecb3c3b290319acf11405 | <ide><path>integration-cli/docker_cli_daemon_plugins_test.go
<ide> func (s *DockerDaemonSuite) TestDaemonShutdownLiveRestoreWithPlugins(c *check.C)
<ide>
<ide> // TestDaemonShutdownWithPlugins shuts down running plugins.
<ide> func (s *DockerDaemonSuite) TestDaemonShutdownWithPlugins(c *check.C) {
<del> testRequires(c, IsAmd64, Network, testEnv.IsLocalDaemon)
<add> testRequires(c, IsAmd64, Network)
<ide>
<ide> s.d.Start(c)
<ide> if out, err := s.d.Cmd("plugin", "install", "--grant-all-permissions", pName); err != nil {
<ide> func (s *DockerDaemonSuite) TestDaemonShutdownWithPlugins(c *check.C) {
<ide>
<ide> // TestDaemonKillWithPlugins leaves plugins running.
<ide> func (s *DockerDaemonSuite) TestDaemonKillWithPlugins(c *check.C) {
<del> testRequires(c, IsAmd64, Network, testEnv.IsLocalDaemon)
<add> testRequires(c, IsAmd64, Network)
<ide>
<ide> s.d.Start(c)
<ide> if out, err := s.d.Cmd("plugin", "install", "--grant-all-permissions", pName); err != nil {
<ide> func (s *DockerDaemonSuite) TestVolumePlugin(c *check.C) {
<ide> }
<ide>
<ide> func (s *DockerDaemonSuite) TestPluginVolumeRemoveOnRestart(c *check.C) {
<del> testRequires(c, DaemonIsLinux, Network, IsAmd64)
<add> testRequires(c, IsAmd64, Network)
<ide>
<ide> s.d.Start(c, "--live-restore=true")
<ide>
<ide><path>integration-cli/docker_cli_daemon_test.go
<ide> func (s *DockerDaemonSuite) TestDaemonDefaultGatewayIPv4ExplicitOutsideContainer
<ide> }
<ide>
<ide> func (s *DockerDaemonSuite) TestDaemonDefaultNetworkInvalidClusterConfig(c *check.C) {
<del> testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon)
<ide>
<ide> // Start daemon without docker0 bridge
<ide> defaultNetworkBridge := "docker0"
<ide> func (s *DockerDaemonSuite) TestDaemonLinksIpTablesRulesWhenLinkAndUnlink(c *che
<ide> }
<ide>
<ide> func (s *DockerDaemonSuite) TestDaemonUlimitDefaults(c *check.C) {
<del> testRequires(c, DaemonIsLinux)
<ide>
<ide> s.d.StartWithBusybox(c, "--default-ulimit", "nofile=42:42", "--default-ulimit", "nproc=1024:1024")
<ide>
<ide><path>integration-cli/docker_cli_events_unix_test.go
<ide> func (s *DockerSuite) TestEventsFilterNetworkID(c *check.C) {
<ide> }
<ide>
<ide> func (s *DockerDaemonSuite) TestDaemonEvents(c *check.C) {
<del> testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux)
<ide>
<ide> // daemon config file
<ide> configFilePath := "test.json"
<ide> func (s *DockerDaemonSuite) TestDaemonEvents(c *check.C) {
<ide> }
<ide>
<ide> func (s *DockerDaemonSuite) TestDaemonEventsWithFilters(c *check.C) {
<del> testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux)
<ide>
<ide> // daemon config file
<ide> configFilePath := "test.json"
<ide><path>integration-cli/docker_cli_exec_test.go
<ide> func (s *DockerSuite) TestExecAfterContainerRestart(c *check.C) {
<ide> }
<ide>
<ide> func (s *DockerDaemonSuite) TestExecAfterDaemonRestart(c *check.C) {
<del> // TODO Windows CI: Requires a little work to get this ported.
<del> testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon)
<add> // TODO Windows CI: DockerDaemonSuite doesn't run on Windows, and requires a little work to get this ported.
<ide> s.d.StartWithBusybox(c)
<ide>
<ide> out, err := s.d.Cmd("run", "-d", "--name", "top", "-p", "80", "busybox:latest", "top")
<ide><path>integration-cli/docker_cli_info_test.go
<ide> func (s *DockerSuite) TestInsecureRegistries(c *check.C) {
<ide> }
<ide>
<ide> func (s *DockerDaemonSuite) TestRegistryMirrors(c *check.C) {
<del> testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux)
<ide>
<ide> registryMirror1 := "https://192.168.1.2"
<ide> registryMirror2 := "http://registry.mirror.com:5000"
<ide><path>integration-cli/docker_cli_network_unix_test.go
<ide> func (s *DockerNetworkSuite) TestDockerNetworkCreateDeleteSpecialCharacters(c *c
<ide> }
<ide>
<ide> func (s *DockerDaemonSuite) TestDaemonRestartRestoreBridgeNetwork(t *check.C) {
<del> testRequires(t, DaemonIsLinux)
<ide> s.d.StartWithBusybox(t, "--live-restore")
<ide> defer s.d.Stop(t)
<ide> oldCon := "old"
<ide><path>integration-cli/docker_cli_proxy_test.go
<ide> func (s *DockerSuite) TestCLIProxyDisableProxyUnixSock(c *check.C) {
<ide> // Can't use localhost here since go has a special case to not use proxy if connecting to localhost
<ide> // See https://golang.org/pkg/net/http/#ProxyFromEnvironment
<ide> func (s *DockerDaemonSuite) TestCLIProxyProxyTCPSock(c *check.C) {
<del> testRequires(c, testEnv.IsLocalDaemon)
<ide> // get the IP to use to connect since we can't use localhost
<ide> addrs, err := net.InterfaceAddrs()
<ide> assert.NilError(c, err)
<ide><path>integration-cli/docker_cli_run_unix_test.go
<ide> func (s *DockerSuite) TestRunUserDeviceAllowed(c *check.C) {
<ide> }
<ide>
<ide> func (s *DockerDaemonSuite) TestRunSeccompJSONNewFormat(c *check.C) {
<del> testRequires(c, testEnv.IsLocalDaemon, seccompEnabled)
<add> testRequires(c, seccompEnabled)
<ide>
<ide> s.d.StartWithBusybox(c)
<ide>
<ide> func (s *DockerDaemonSuite) TestRunSeccompJSONNewFormat(c *check.C) {
<ide> }
<ide>
<ide> func (s *DockerDaemonSuite) TestRunSeccompJSONNoNameAndNames(c *check.C) {
<del> testRequires(c, testEnv.IsLocalDaemon, seccompEnabled)
<add> testRequires(c, seccompEnabled)
<ide>
<ide> s.d.StartWithBusybox(c)
<ide>
<ide> func (s *DockerDaemonSuite) TestRunSeccompJSONNoNameAndNames(c *check.C) {
<ide> }
<ide>
<ide> func (s *DockerDaemonSuite) TestRunSeccompJSONNoArchAndArchMap(c *check.C) {
<del> testRequires(c, testEnv.IsLocalDaemon, seccompEnabled)
<add> testRequires(c, seccompEnabled)
<ide>
<ide> s.d.StartWithBusybox(c)
<ide>
<ide> func (s *DockerDaemonSuite) TestRunSeccompJSONNoArchAndArchMap(c *check.C) {
<ide> }
<ide>
<ide> func (s *DockerDaemonSuite) TestRunWithDaemonDefaultSeccompProfile(c *check.C) {
<del> testRequires(c, testEnv.IsLocalDaemon, seccompEnabled)
<add> testRequires(c, seccompEnabled)
<ide>
<ide> s.d.StartWithBusybox(c)
<ide>
<ide><path>integration-cli/docker_cli_userns_test.go
<ide> import (
<ide> // 1. validate uid/gid maps are set properly
<ide> // 2. verify that files created are owned by remapped root
<ide> func (s *DockerDaemonSuite) TestDaemonUserNamespaceRootSetting(c *check.C) {
<del> testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon, UserNamespaceInKernel)
<add> testRequires(c, UserNamespaceInKernel)
<ide>
<ide> s.d.StartWithBusybox(c, "--userns-remap", "default")
<ide> | 9 |
Javascript | Javascript | add linkedin /auth and /auth/callback routes | b09223a0cca733b86beaaaf384dcaefbd0812bd5 | <ide><path>app.js
<ide> app.get('/auth/google', passport.authenticate('google', { scope: 'profile email'
<ide> app.get('/auth/google/callback', passport.authenticate('google', { successRedirect: '/', failureRedirect: '/login' }));
<ide> app.get('/auth/twitter', passport.authenticate('twitter'));
<ide> app.get('/auth/twitter/callback', passport.authenticate('twitter', { successRedirect: '/', failureRedirect: '/login' }));
<add>app.get('/auth/linkedin', passport.authenticate('linkedin', { scope: ['r_basicprofile', 'r_emailaddress'] }));
<add>app.get('/auth/linkedin/callback', passport.authenticate('linkedin', { successRedirect: '/', failureRedirect: '/login' }));
<ide>
<ide> /**
<ide> * OAuth routes for API examples that require authorization. | 1 |
Python | Python | fix vae example | 59bd2476038fa59760cdc4cb9c37e181762c2f19 | <ide><path>examples/variational_autoencoder.py
<ide> import numpy as np
<ide> import matplotlib.pyplot as plt
<ide>
<del>from keras.layers import Input, Dense, Lambda
<add>from keras.layers import Input, Dense, merge
<ide> from keras.models import Model
<ide> from keras import backend as K
<ide> from keras import objectives
<ide> from keras.datasets import mnist
<ide>
<del>batch_size = 16
<add>batch_size = 100
<ide> original_dim = 784
<ide> latent_dim = 2
<del>intermediate_dim = 128
<del>epsilon_std = 0.01
<del>nb_epoch = 40
<add>intermediate_dim = 500
<add>nb_epoch = 100
<ide>
<ide> x = Input(batch_shape=(batch_size, original_dim))
<ide> h = Dense(intermediate_dim, activation='relu')(x)
<ide> z_mean = Dense(latent_dim)(h)
<del>z_log_std = Dense(latent_dim)(h)
<add>z_log_var = Dense(latent_dim)(h)
<ide>
<ide> def sampling(args):
<del> z_mean, z_log_std = args
<del> epsilon = K.random_normal(shape=(batch_size, latent_dim),
<del> mean=0., std=epsilon_std)
<del> return z_mean + K.exp(z_log_std) * epsilon
<add> z_mean, z_log_var = args
<add> epsilon = K.random_normal(shape=(batch_size, latent_dim), mean=0.)
<add> return z_mean + K.exp(z_log_var/2) * epsilon
<ide>
<ide> # note that "output_shape" isn't necessary with the TensorFlow backend
<del># so you could write `Lambda(sampling)([z_mean, z_log_std])`
<del>z = Lambda(sampling, output_shape=(latent_dim,))([z_mean, z_log_std])
<add>z = merge([z_mean, z_log_var], mode=sampling, output_shape=(latent_dim,))
<ide>
<ide> # we instantiate these layers separately so as to reuse them later
<ide> decoder_h = Dense(intermediate_dim, activation='relu')
<ide> def sampling(args):
<ide> x_decoded_mean = decoder_mean(h_decoded)
<ide>
<ide> def vae_loss(x, x_decoded_mean):
<del> xent_loss = objectives.binary_crossentropy(x, x_decoded_mean)
<del> kl_loss = - 0.5 * K.mean(1 + z_log_std - K.square(z_mean) - K.exp(z_log_std), axis=-1)
<add> xent_loss = original_dim * objectives.binary_crossentropy(x, x_decoded_mean)
<add> kl_loss = - 0.5 * K.sum(1 + z_log_var - K.square(z_mean) - K.exp(z_log_var), axis=-1)
<ide> return xent_loss + kl_loss
<ide>
<ide> vae = Model(x, x_decoded_mean)
<ide> def vae_loss(x, x_decoded_mean):
<ide>
<ide> for i, yi in enumerate(grid_x):
<ide> for j, xi in enumerate(grid_y):
<del> z_sample = np.array([[xi, yi]]) * epsilon_std
<add> z_sample = np.array([[xi, yi]])
<ide> x_decoded = generator.predict(z_sample)
<ide> digit = x_decoded[0].reshape(digit_size, digit_size)
<ide> figure[i * digit_size: (i + 1) * digit_size, | 1 |
Text | Text | add v4.7.0-beta.1 to changelog | debe5f7be0ba6df5dfcee4082f10bee28b5f541c | <ide><path>CHANGELOG.md
<ide> # Ember Changelog
<ide>
<add>### v4.7.0-beta.1 (July 25, 2022)
<add>
<add>- [#20126](https://github.com/emberjs/ember.js/pull/20126) [BUGFIX] Replacing Firefox detection that used a deprecated browser API
<add>
<ide> ### v4.6.0 (July 25, 2022)
<ide>
<ide> - [#20125](https://github.com/emberjs/ember.js/pull/20125) [BUGFIX] Replace deprecated substr() method with substring() method. | 1 |
Python | Python | fix vocab script | 05a1dd570ec3a0d3e3493c9f183eb74fe57a053a | <ide><path>spacy/cli/vocab.py
<ide> vectors_loc=("location of vectors data, as numpy .npz (optional)",
<ide> "positional", None, str),
<ide> version=("Model version", "option", "V", str),
<del> meta_path=("Optional path to meta.json. All relevant properties will be "
<del> "overwritten.", "option", "m", Path))
<del>
<del>def make_vocab(lang, output_dir, lexemes_loc, vectors_loc=None):
<add>)
<add>def make_vocab(lang, output_dir, lexemes_loc, vectors_loc=None, version=None):
<ide> out_dir = ensure_path(output_dir)
<ide> jsonl_loc = ensure_path(lexemes_loc)
<ide> nlp = spacy.blank(lang) | 1 |
Python | Python | address random results in slow readers tests | 386dcada1cddecc13c499016a3cf5585a2dec088 | <ide><path>spacy/tests/training/test_readers.py
<ide> from typing import Dict, Iterable, Callable
<ide> import pytest
<del>from thinc.api import Config
<add>from thinc.api import Config, fix_random_seed
<ide> from spacy import Language
<ide> from spacy.util import load_model_from_config, registry, resolve_dot_names
<ide> from spacy.schemas import ConfigSchemaTraining
<ide> def reader(nlp: Language):
<ide> @pytest.mark.parametrize(
<ide> "reader,additional_config",
<ide> [
<del> ("ml_datasets.imdb_sentiment.v1", {"train_limit": 10, "dev_limit": 2}),
<del> ("ml_datasets.dbpedia.v1", {"train_limit": 10, "dev_limit": 2}),
<add> ("ml_datasets.imdb_sentiment.v1", {"train_limit": 10, "dev_limit": 10}),
<add> ("ml_datasets.dbpedia.v1", {"train_limit": 10, "dev_limit": 10}),
<ide> ("ml_datasets.cmu_movies.v1", {"limit": 10, "freq_cutoff": 200, "split": 0.8}),
<ide> ],
<ide> )
<ide> def test_cat_readers(reader, additional_config):
<ide> factory = "textcat_multilabel"
<ide> """
<ide> config = Config().from_str(nlp_config_string)
<add> fix_random_seed(config["training"]["seed"])
<ide> config["corpora"]["@readers"] = reader
<ide> config["corpora"].update(additional_config)
<ide> nlp = load_model_from_config(config, auto_fill=True) | 1 |
Java | Java | improve javadoc of exchangefunction | 962ec38a61302e1ace6425a7ea89aae993357905 | <ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ExchangeFunction.java
<ide> * <p>For example:
<ide> * <pre class="code">
<ide> * ExchangeFunction exchangeFunction = ExchangeFunctions.create(new ReactorClientHttpConnector());
<del> * ClientRequest<Void> request = ClientRequest.method(HttpMethod.GET, "https://example.com/resource").build();
<add> * ClientRequest request = ClientRequest.create(HttpMethod.GET, URI.create("https://example.com/resource")).build();
<ide> *
<ide> * Mono<String> result = exchangeFunction
<ide> * .exchange(request)
<del> * .then(response -> response.bodyToMono(String.class));
<add> * .flatMap(response -> response.bodyToMono(String.class));
<ide> * </pre>
<ide> *
<ide> * @author Arjen Poutsma | 1 |
Text | Text | modify test for dequeue method to check for fifo | 9999a8c9bc48b54c66aa21519e6f70340856f9b8 | <ide><path>curriculum/challenges/english/08-coding-interview-prep/data-structures/create-a-queue-class.english.md
<ide> tests:
<ide> - text: Your <code>Queue</code> class should have an <code>isEmpty</code> method.
<ide> testString: assert((function(){var test = new Queue(); return (typeof test.isEmpty === 'function')}()), 'Your <code>Queue</code> class should have an <code>isEmpty</code> method.');
<ide> - text: The <code>dequeue</code> method should remove and return the front element of the queue
<del> testString: assert((function(){var test = new Queue(); test.enqueue('Smith'); return (test.dequeue() === 'Smith')}()), 'The <code>dequeue</code> method should remove and return the front element of the queue');
<add> testString: assert((function(){var test = new Queue(); test.enqueue('Smith'); test.enqueue('John'); return (test.dequeue() === 'Smith')}()), 'The <code>dequeue</code> method should remove and return the front element of the queue');
<ide> - text: The <code>front</code> method should return value of the front element of the queue
<ide> testString: assert((function(){var test = new Queue(); test.enqueue('Smith'); test.enqueue('John'); return (test.front() === 'Smith')}()), 'The <code>front</code> method should return value of the front element of the queue');
<ide> - text: The <code>size</code> method should return the length of the queue | 1 |
Mixed | Ruby | support multiple preview paths for mailers | 64ad045e472a60872e5547a381c3af896a546dfd | <ide><path>actionmailer/CHANGELOG.md
<add>* Support multiple preview paths for mailers.
<ide>
<add> Option `config.action_mailer.preview_path` is deprecated in favor of
<add> `config.action_mailer.preview_paths`. Appending paths to this configuration option
<add> will cause those paths to be used in the search for mailer previews.
<add>
<add> *fatkodima*
<ide>
<ide> Please check [7-0-stable](https://github.com/rails/rails/blob/7-0-stable/actionmailer/CHANGELOG.md) for previous changes.
<ide><path>actionmailer/lib/action_mailer/base.rb
<ide> module ActionMailer
<ide> # = Previewing emails
<ide> #
<ide> # You can preview your email templates visually by adding a mailer preview file to the
<del> # <tt>ActionMailer::Base.preview_path</tt>. Since most emails do something interesting
<add> # <tt>ActionMailer::Base.preview_paths</tt>. Since most emails do something interesting
<ide> # with database data, you'll need to write some scenarios to load messages with fake data:
<ide> #
<ide> # class NotifierMailerPreview < ActionMailer::Preview
<ide> module ActionMailer
<ide> #
<ide> # Methods must return a <tt>Mail::Message</tt> object which can be generated by calling the mailer
<ide> # method without the additional <tt>deliver_now</tt> / <tt>deliver_later</tt>. The location of the
<del> # mailer previews directory can be configured using the <tt>preview_path</tt> option which has a default
<add> # mailer preview directories can be configured using the <tt>preview_paths</tt> option which has a default
<ide> # of <tt>test/mailers/previews</tt>:
<ide> #
<del> # config.action_mailer.preview_path = "#{Rails.root}/lib/mailer_previews"
<add> # config.action_mailer.preview_paths << "#{Rails.root}/lib/mailer_previews"
<ide> #
<ide> # An overview of all previews is accessible at <tt>http://localhost:3000/rails/mailers</tt>
<ide> # on a running development server instance.
<ide><path>actionmailer/lib/action_mailer/preview.rb
<ide> module Previews # :nodoc:
<ide> extend ActiveSupport::Concern
<ide>
<ide> included do
<del> # Set the location of mailer previews through app configuration:
<add> # Add the location of mailer previews through app configuration:
<ide> #
<del> # config.action_mailer.preview_path = "#{Rails.root}/lib/mailer_previews"
<add> # config.action_mailer.preview_paths << "#{Rails.root}/lib/mailer_previews"
<ide> #
<del> mattr_accessor :preview_path, instance_writer: false
<add> mattr_accessor :preview_paths, instance_writer: false, default: []
<ide>
<ide> # Enable or disable mailer previews through app configuration:
<ide> #
<ide> module Previews # :nodoc:
<ide> mattr_accessor :preview_interceptors, instance_writer: false, default: [ActionMailer::InlinePreviewInterceptor]
<ide> end
<ide>
<add> def preview_path
<add> ActiveSupport::Deprecation.warn(<<-MSG.squish)
<add> Using preview_path option is deprecated and will be removed in Rails 7.2.
<add> Please use preview_paths instead.
<add> MSG
<add> self.class.preview_paths.first
<add> end
<add>
<ide> module ClassMethods
<add> def preview_path=(value)
<add> ActiveSupport::Deprecation.warn(<<-MSG.squish)
<add> Using preview_path= option is deprecated and will be removed in Rails 7.2.
<add> Please use preview_paths= instead.
<add> MSG
<add> self.preview_paths << value
<add> end
<add>
<add> def preview_path
<add> ActiveSupport::Deprecation.warn(<<-MSG.squish)
<add> Using preview_path option is deprecated and will be removed in Rails 7.2.
<add> Please use preview_paths instead.
<add> MSG
<add> self.preview_paths.first
<add> end
<add>
<ide> # Register one or more Interceptors which will be called before mail is previewed.
<ide> def register_preview_interceptors(*interceptors)
<ide> interceptors.flatten.compact.each { |interceptor| register_preview_interceptor(interceptor) }
<ide> def preview_name
<ide>
<ide> private
<ide> def load_previews
<del> if preview_path
<add> preview_paths.each do |preview_path|
<ide> Dir["#{preview_path}/**/*_preview.rb"].sort.each { |file| require_dependency file }
<ide> end
<ide> end
<ide>
<del> def preview_path
<del> Base.preview_path
<add> def preview_paths
<add> Base.preview_paths
<ide> end
<ide>
<ide> def show_previews
<ide><path>actionmailer/lib/action_mailer/railtie.rb
<ide> module ActionMailer
<ide> class Railtie < Rails::Railtie # :nodoc:
<ide> config.action_mailer = ActiveSupport::OrderedOptions.new
<add> config.action_mailer.preview_paths = []
<ide> config.eager_load_namespaces << ActionMailer
<ide>
<ide> initializer "action_mailer.logger" do
<ide> class Railtie < Rails::Railtie # :nodoc:
<ide> options.stylesheets_dir ||= paths["public/stylesheets"].first
<ide> options.show_previews = Rails.env.development? if options.show_previews.nil?
<ide> options.cache_store ||= Rails.cache
<del>
<del> if options.show_previews
<del> options.preview_path ||= defined?(Rails.root) ? "#{Rails.root}/test/mailers/previews" : nil
<del> end
<add> options.preview_paths |= ["#{Rails.root}/test/mailers/previews"]
<ide>
<ide> # make sure readers methods get compiled
<ide> options.asset_host ||= app.config.asset_host
<ide> class Railtie < Rails::Railtie # :nodoc:
<ide> register_interceptors(options.delete(:interceptors))
<ide> register_preview_interceptors(options.delete(:preview_interceptors))
<ide> register_observers(options.delete(:observers))
<add> self.preview_paths |= options[:preview_paths]
<ide>
<ide> if delivery_job = options.delete(:delivery_job)
<ide> self.delivery_job = delivery_job.constantize
<ide> class Railtie < Rails::Railtie # :nodoc:
<ide> end
<ide> end
<ide>
<del> initializer "action_mailer.set_autoload_paths" do |app|
<add> initializer "action_mailer.set_autoload_paths", before: :set_autoload_paths do |app|
<ide> options = app.config.action_mailer
<del>
<del> if options.show_previews && options.preview_path
<del> ActiveSupport::Dependencies.autoload_paths << options.preview_path
<del> end
<add> app.config.paths["test/mailers/previews"].concat(options.preview_paths)
<ide> end
<ide>
<ide> initializer "action_mailer.compile_config_methods" do
<ide><path>guides/source/action_mailer_basics.md
<ide> visually see the new style instantly. A list of previews are also available
<ide> in <http://localhost:3000/rails/mailers>.
<ide>
<ide> By default, these preview classes live in `test/mailers/previews`.
<del>This can be configured using the `preview_path` option. For example, if you
<del>want to change it to `lib/mailer_previews`, you can configure it in
<add>This can be configured using the `preview_paths` option. For example, if you
<add>want to add `lib/mailer_previews` to it, you can configure it in
<ide> `config/application.rb`:
<ide>
<ide> ```ruby
<del>config.action_mailer.preview_path = "#{Rails.root}/lib/mailer_previews"
<add>config.action_mailer.preview_paths << "#{Rails.root}/lib/mailer_previews"
<ide> ```
<ide>
<ide> ### Generating URLs in Action Mailer Views
<ide><path>guides/source/configuring.md
<ide> Registers interceptors which will be called before mail is previewed.
<ide> config.action_mailer.preview_interceptors = ["MyPreviewMailInterceptor"]
<ide> ```
<ide>
<del>#### `config.action_mailer.preview_path`
<add>#### `config.action_mailer.preview_paths`
<ide>
<del>Specifies the location of mailer previews.
<add>Specifies the locations of mailer previews. Appending paths to this configuration option will cause those paths to be used in the search for mailer previews.
<ide>
<ide> ```ruby
<del>config.action_mailer.preview_path = "#{Rails.root}/lib/mailer_previews"
<add>config.action_mailer.preview_paths << "#{Rails.root}/lib/mailer_previews"
<ide> ```
<ide>
<ide> #### `config.action_mailer.show_previews`
<ide> Below is a comprehensive list of all the initializers found in Rails in the orde
<ide>
<ide> * `add_view_paths`: Adds the directory `app/views` from the application, railties, and engines to the lookup path for view files for the application.
<ide>
<add>* `add_mailer_preview_paths`: Adds the directory `test/mailers/previews` from the application, railties, and engines to the lookup path for mailer preview files for the application.
<add>
<ide> * `load_environment_config`: Loads the `config/environments` file for the current environment.
<ide>
<ide> * `prepend_helpers_path`: Adds the directory `app/helpers` from the application, railties, and engines to the lookup path for helpers for the application.
<ide><path>guides/source/upgrading_ruby_on_rails.md
<ide> If you don't want to use `SQLite3Adapter` in a strict mode, you can disable this
<ide> config.active_record.sqlite3_adapter_strict_strings_by_default = false
<ide> ```
<ide>
<add>### Support multiple preview paths for `ActionMailer::Preview`
<add>
<add>Option `config.action_mailer.preview_path` is deprecated in favor of `config.action_mailer.preview_paths`. Appending paths to this configuration option will cause those paths to be used in the search for mailer previews.
<add>
<add>```ruby
<add>config.action_mailer.preview_paths << "#{Rails.root}/lib/mailer_previews"
<add>```
<add>
<ide> Upgrading from Rails 6.1 to Rails 7.0
<ide> -------------------------------------
<ide>
<ide><path>railties/lib/rails/engine.rb
<ide> def load_seed
<ide> end
<ide> end
<ide>
<add> initializer :add_mailer_preview_paths do
<add> previews = paths["test/mailers/previews"].existent
<add> unless previews.empty?
<add> ActiveSupport.on_load(:action_mailer) { self.preview_paths |= previews }
<add> end
<add> end
<add>
<ide> initializer :prepend_helpers_path do |app|
<ide> if !isolated? || (app == self)
<ide> app.config.helpers_paths.unshift(*paths["app/helpers"].existent)
<ide><path>railties/lib/rails/engine/configuration.rb
<ide> def paths
<ide> paths.add "vendor", load_path: true
<ide> paths.add "vendor/assets", glob: "*"
<ide>
<add> paths.add "test/mailers/previews", eager_load: true
<add>
<ide> paths
<ide> end
<ide> end
<ide><path>railties/test/application/mailer_previews_test.rb
<ide> def teardown
<ide> assert_equal 200, last_response.status
<ide> end
<ide>
<del> test "mailer previews are loaded from the default preview_path" do
<add> test "mailer previews are loaded from the default preview_paths" do
<ide> mailer "notifier", <<-RUBY
<ide> class Notifier < ActionMailer::Base
<ide> default from: "[email protected]"
<ide> def foo
<ide> assert_match '<li><a href="/rails/mailers/notifier/foo">foo</a></li>', last_response.body
<ide> end
<ide>
<del> test "mailer previews are loaded from a custom preview_path" do
<add> test "mailer previews are loaded from custom preview_paths" do
<ide> app_dir "lib/mailer_previews"
<del> add_to_config "config.action_mailer.preview_path = '#{app_path}/lib/mailer_previews'"
<add> add_to_config "config.action_mailer.preview_paths = ['#{app_path}/lib/notifier_previews', '#{app_path}/lib/confirm_previews']"
<ide>
<del> mailer "notifier", <<-RUBY
<del> class Notifier < ActionMailer::Base
<del> default from: "[email protected]"
<add> ["notifier", "confirm"].each do |keyword|
<add> mailer keyword, <<-RUBY
<add> class #{keyword.camelize} < ActionMailer::Base
<add> default from: "[email protected]"
<ide>
<del> def foo
<del> mail to: "[email protected]"
<add> def foo
<add> mail to: "[email protected]"
<add> end
<ide> end
<del> end
<del> RUBY
<add> RUBY
<ide>
<del> text_template "notifier/foo", <<-RUBY
<del> Hello, World!
<del> RUBY
<add> text_template "#{keyword}/foo", <<-RUBY
<add> Hello, World!
<add> RUBY
<ide>
<del> app_file "lib/mailer_previews/notifier_preview.rb", <<-RUBY
<del> class NotifierPreview < ActionMailer::Preview
<del> def foo
<del> Notifier.foo
<add> app_file "lib/#{keyword}_previews/notifier_preview.rb", <<-RUBY
<add> class #{keyword.camelize}Preview < ActionMailer::Preview
<add> def foo
<add> #{keyword.camelize}.foo
<add> end
<ide> end
<del> end
<del> RUBY
<add> RUBY
<add> end
<ide>
<ide> app("development")
<ide>
<ide> get "/rails/mailers"
<ide> assert_match '<h3><a href="/rails/mailers/notifier">Notifier</a></h3>', last_response.body
<ide> assert_match '<li><a href="/rails/mailers/notifier/foo">foo</a></li>', last_response.body
<add> assert_match '<h3><a href="/rails/mailers/confirm">Confirm</a></h3>', last_response.body
<add> assert_match '<li><a href="/rails/mailers/confirm/foo">foo</a></li>', last_response.body
<ide> end
<ide>
<ide> test "mailer previews are reloaded across requests" do
<ide> def foo
<ide> assert_no_match '<li><a href="/rails/mailers/notifier/bar">bar</a></li>', last_response.body
<ide> end
<ide>
<del> test "mailer previews are reloaded from a custom preview_path" do
<add> test "mailer preview_path option is deprecated" do
<add> prev = ActionMailer::Base.preview_paths
<add> ActionMailer::Base.preview_paths = ["#{app_path}/lib/mailer/previews"]
<add> assert_deprecated do
<add> assert "#{app_path}/lib/mailer/previews", ActionMailer::Base.preview_path
<add> end
<add> ensure
<add> ActionMailer::Base.preview_paths = prev
<add> end
<add>
<add> test "mailer preview_path= option is deprecated" do
<add> prev = ActionMailer::Base.preview_paths
<add> assert_deprecated do
<add> ActionMailer::Base.preview_path = "#{app_path}/lib/mailer/previews"
<add> end
<add> assert ["#{app_path}/lib/mailer/previews"], ActionMailer::Base.preview_paths
<add> ensure
<add> ActionMailer::Base.preview_paths = prev
<add> end
<add>
<add> test "mailer previews are reloaded from custom preview_paths" do
<ide> app_dir "lib/mailer_previews"
<del> add_to_config "config.action_mailer.preview_path = '#{app_path}/lib/mailer_previews'"
<add> add_to_config "config.action_mailer.preview_paths = ['#{app_path}/lib/mailer_previews']"
<ide>
<ide> app("development")
<ide>
<ide><path>railties/test/application/paths_test.rb
<ide> def assert_not_in_load_path(*path)
<ide> assert_path @paths["config/environments"], "config/environments/development.rb"
<ide> assert_path @paths["config/routes.rb"], "config/routes.rb"
<ide> assert_path @paths["config/routes"], "config/routes"
<add> assert_path @paths["test/mailers/previews"], "test/mailers/previews"
<ide>
<ide> assert_equal root("app", "controllers"), @paths["app/controllers"].expanded.first
<ide> end
<ide><path>railties/test/railties/engine_test.rb
<ide> def index
<ide> assert_equal "Hi bukkits\n", response[2].body
<ide> end
<ide>
<add> test "adds its mailer previews to mailer preview paths" do
<add> @plugin.write "app/mailers/bukkit_mailer.rb", <<-RUBY
<add> class BukkitMailer < ActionMailer::Base
<add> def foo
<add> end
<add> end
<add> RUBY
<add>
<add> @plugin.write "test/mailers/previews/bukkit_mailer_preview.rb", <<-RUBY
<add> class BukkitMailerPreview < ActionMailer::Preview
<add> def foo
<add> end
<add> end
<add> RUBY
<add>
<add> @plugin.write "app/views/bukkit_mailer/foo.html.erb", "Bukkit"
<add>
<add> boot_rails
<add>
<add> get "/rails/mailers"
<add> assert_match '<h3><a href="/rails/mailers/bukkit_mailer">Bukkit Mailer</a></h3>', last_response.body
<add> assert_match '<li><a href="/rails/mailers/bukkit_mailer/foo">foo</a></li>', last_response.body
<add> end
<add>
<ide> test "adds helpers to controller views" do
<ide> @plugin.write "app/controllers/bukkit_controller.rb", <<-RUBY
<ide> class BukkitController < ActionController::Base | 12 |
Java | Java | fix exceptions in javadoc | f2351e22df729426a3cdbbbaeecf6ace18b94905 | <ide><path>src/main/java/io/reactivex/Flowable.java
<ide> public final <R> Flowable<R> flatMapSingle(Function<? super T, ? extends SingleS
<ide> * {@link Consumer} to execute for each item.
<ide> * @return
<ide> * a Disposable that allows cancelling an asynchronous sequence
<del> * @throws IllegalArgumentException
<add> * @throws NullPointerException
<ide> * if {@code onNext} is null
<ide> * @throws RuntimeException
<ide> * if the Publisher calls {@code onError}
<ide> public final Disposable subscribe(Consumer<? super T> onNext) {
<ide> * @return a {@link Disposable} reference with which the caller can stop receiving items before
<ide> * the Publisher has finished sending them
<ide> * @see <a href="http://reactivex.io/documentation/operators/subscribe.html">ReactiveX operators documentation: Subscribe</a>
<del> * @throws IllegalArgumentException
<add> * @throws NullPointerException
<ide> * if {@code onNext} is null, or
<ide> * if {@code onError} is null
<ide> */
<ide> public final Disposable subscribe(Consumer<? super T> onNext, Consumer<? super T
<ide> * Publisher
<ide> * @return a {@link Disposable} reference with which the caller can stop receiving items before
<ide> * the Publisher has finished sending them
<del> * @throws IllegalArgumentException
<add> * @throws NullPointerException
<ide> * if {@code onNext} is null, or
<ide> * if {@code onError} is null, or
<ide> * if {@code onComplete} is null
<ide> public final Disposable subscribe(Consumer<? super T> onNext, Consumer<? super T
<ide> * the {@code Consumer} that receives the upstream's Subscription
<ide> * @return a {@link Disposable} reference with which the caller can stop receiving items before
<ide> * the Publisher has finished sending them
<del> * @throws IllegalArgumentException
<add> * @throws NullPointerException
<ide> * if {@code onNext} is null, or
<ide> * if {@code onError} is null, or
<ide> * if {@code onComplete} is null
<ide><path>src/main/java/io/reactivex/Maybe.java
<ide> public final Disposable subscribe(Consumer<? super T> onSuccess) {
<ide> * @return a {@link Disposable} reference with which the caller can stop receiving items before
<ide> * the Maybe has finished sending them
<ide> * @see <a href="http://reactivex.io/documentation/operators/subscribe.html">ReactiveX operators documentation: Subscribe</a>
<del> * @throws IllegalArgumentException
<add> * @throws NullPointerException
<ide> * if {@code onSuccess} is null, or
<ide> * if {@code onError} is null
<ide> */
<ide> public final Disposable subscribe(Consumer<? super T> onSuccess, Consumer<? supe
<ide> * Maybe
<ide> * @return a {@link Disposable} reference with which the caller can stop receiving items before
<ide> * the Maybe has finished sending them
<del> * @throws IllegalArgumentException
<add> * @throws NullPointerException
<ide> * if {@code onSuccess} is null, or
<ide> * if {@code onError} is null, or
<ide> * if {@code onComplete} is null
<ide><path>src/main/java/io/reactivex/Observable.java
<ide> public final <R> Observable<R> flatMapSingle(Function<? super T, ? extends Singl
<ide> * {@link Consumer} to execute for each item.
<ide> * @return
<ide> * a Disposable that allows cancelling an asynchronous sequence
<del> * @throws IllegalArgumentException
<add> * @throws NullPointerException
<ide> * if {@code onNext} is null
<ide> * @throws RuntimeException
<ide> * if the ObservableSource calls {@code onError}
<ide> public final Disposable subscribe(Consumer<? super T> onNext) {
<ide> * @return a {@link Disposable} reference with which the caller can stop receiving items before
<ide> * the ObservableSource has finished sending them
<ide> * @see <a href="http://reactivex.io/documentation/operators/subscribe.html">ReactiveX operators documentation: Subscribe</a>
<del> * @throws IllegalArgumentException
<add> * @throws NullPointerException
<ide> * if {@code onNext} is null, or
<ide> * if {@code onError} is null
<ide> */
<ide> public final Disposable subscribe(Consumer<? super T> onNext, Consumer<? super T
<ide> * ObservableSource
<ide> * @return a {@link Disposable} reference with which the caller can stop receiving items before
<ide> * the ObservableSource has finished sending them
<del> * @throws IllegalArgumentException
<add> * @throws NullPointerException
<ide> * if {@code onNext} is null, or
<ide> * if {@code onError} is null, or
<ide> * if {@code onComplete} is null
<ide> public final Disposable subscribe(Consumer<? super T> onNext, Consumer<? super T
<ide> * the {@code Consumer} that receives the upstream's Disposable
<ide> * @return a {@link Disposable} reference with which the caller can stop receiving items before
<ide> * the ObservableSource has finished sending them
<del> * @throws IllegalArgumentException
<add> * @throws NullPointerException
<ide> * if {@code onNext} is null, or
<ide> * if {@code onError} is null, or
<ide> * if {@code onComplete} is null
<ide><path>src/main/java/io/reactivex/Single.java
<ide> public final Disposable subscribe() {
<ide> * (whichever is not null)
<ide> * @return a {@link Disposable} reference can request the {@link Single} stop work.
<ide> * @see <a href="http://reactivex.io/documentation/operators/subscribe.html">ReactiveX operators documentation: Subscribe</a>
<del> * @throws IllegalArgumentException
<add> * @throws NullPointerException
<ide> * if {@code onCallback} is null
<ide> */
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> public final Disposable subscribe(Consumer<? super T> onSuccess) {
<ide> * Single
<ide> * @return a {@link Disposable} reference can request the {@link Single} stop work.
<ide> * @see <a href="http://reactivex.io/documentation/operators/subscribe.html">ReactiveX operators documentation: Subscribe</a>
<del> * @throws IllegalArgumentException
<add> * @throws NullPointerException
<ide> * if {@code onSuccess} is null, or
<ide> * if {@code onError} is null
<ide> */ | 4 |
Python | Python | remove hack from gh-7659 for gh-7493 | 366b14c312aaaa983ad2345fd0c4165e159de475 | <ide><path>numpy/ma/core.py
<ide> def _recursive_printoption(result, mask, printopt):
<ide> names = result.dtype.names
<ide> for name in names:
<ide> (curdata, curmask) = (result[name], mask[name])
<del> if curdata.dtype.names:
<add> if result.dtype[name].names:
<ide> _recursive_printoption(curdata, curmask, printopt)
<ide> else:
<ide> np.copyto(curdata, printopt, where=curmask)
<ide> def __new__(self, data, mask=nomask, dtype=None, fill_value=None,
<ide>
<ide> def _get_data(self):
<ide> # Make sure that the _data part is a np.void
<del> return self.view(ndarray)[()]
<add> return super(mvoid, self)._data[()]
<ide>
<ide> _data = property(fget=_get_data)
<ide>
<ide> def __setitem__(self, indx, value):
<ide> def __str__(self):
<ide> m = self._mask
<ide> if m is nomask:
<del> return self._data.__str__()
<del> printopt = masked_print_option
<del> rdtype = _replace_dtype_fields(self._data.dtype, "O")
<del>
<del> # temporary hack to fix gh-7493. A more permanent fix
<del> # is proposed in gh-6053, after which the next two
<del> # lines should be changed to
<del> # res = np.array([self._data], dtype=rdtype)
<del> res = np.empty(1, rdtype)
<del> res[:1] = self._data
<add> return str(self._data)
<ide>
<del> _recursive_printoption(res, self._mask, printopt)
<del> return str(res[0])
<add> rdtype = _replace_dtype_fields(self._data.dtype, "O")
<add> data_arr = super(mvoid, self)._data
<add> res = data_arr.astype(rdtype)
<add> _recursive_printoption(res, self._mask, masked_print_option)
<add> return str(res)
<ide>
<ide> __repr__ = __str__
<ide> | 1 |
PHP | PHP | remove type getters | ebf7d31ce1979fbd071f36eaa19d2b36538ebdc9 | <ide><path>src/Database/Expression/CaseExpressionInterface.php
<ide> public function clause(string $clause);
<ide> */
<ide> public function value($value, ?string $valueType = null);
<ide>
<del> /**
<del> * Returns the case value type.
<del> *
<del> * @return string|null
<del> */
<del> public function getValueType(): ?string;
<del>
<ide> /**
<ide> * Sets the `WHEN` value for a `WHEN ... THEN ...` expression, or a
<ide> * self-contained expression that holds both the value for `WHEN`
<ide> public function then($result, ?string $type = null);
<ide> */
<ide> public function else($result, ?string $type = null);
<ide>
<del> /**
<del> * Returns the type of the `ELSE` result value.
<del> *
<del> * @return string|null The result type, or `null` if none has been set yet.
<del> */
<del> public function getElseType(): ?string;
<del>
<ide> /**
<ide> * Returns the abstract type that this expression will return.
<ide> *
<ide><path>src/Database/Expression/CaseStatementExpression.php
<ide> public function value($value, ?string $valueType = null)
<ide> return $this;
<ide> }
<ide>
<del> /**
<del> * @inheritDoc
<del> */
<del> public function getValueType(): ?string
<del> {
<del> return $this->valueType;
<del> }
<del>
<ide> /**
<ide> * @inheritDoc
<ide> */
<ide> public function else($result, ?string $type = null)
<ide> return $this;
<ide> }
<ide>
<del> /**
<del> * @inheritDoc
<del> */
<del> public function getElseType(): ?string
<del> {
<del> return $this->elseType;
<del> }
<del>
<ide> /**
<ide> * @inheritDoc
<ide> */
<ide> public function getReturnType(): string
<ide>
<ide> $types = [];
<ide> foreach ($this->when as $when) {
<del> $type = $when->getThenType();
<add> $type = $when->getResultType();
<ide> if ($type !== null) {
<ide> $types[] = $type;
<ide> }
<ide><path>src/Database/Expression/WhenThenExpression.php
<ide> public function when($when, $type = null)
<ide> return $this;
<ide> }
<ide>
<del> /**
<del> * @inheritDoc
<del> */
<del> public function getWhenType()
<del> {
<del> return $this->whenType;
<del> }
<del>
<ide> /**
<ide> * @inheritDoc
<ide> */
<ide> public function then($result, ?string $type = null)
<ide> /**
<ide> * @inheritDoc
<ide> */
<del> public function getThenType(): ?string
<add> public function getResultType(): ?string
<ide> {
<ide> return $this->thenType;
<ide> }
<ide><path>src/Database/Expression/WhenThenExpressionInterface.php
<ide> public function clause(string $clause);
<ide> */
<ide> public function when($when, $type = null);
<ide>
<del> /**
<del> * Returns the `WHEN` value type.
<del> *
<del> * @return array|string|null
<del> * @see when()
<del> */
<del> public function getWhenType();
<del>
<ide> /**
<ide> * Sets the `THEN` result value.
<ide> *
<ide> public function getWhenType();
<ide> public function then($result, ?string $type = null);
<ide>
<ide> /**
<del> * Returns the `THEN` result value type.
<add> * Returns the expression's result value type.
<ide> *
<ide> * @return string|null
<ide> * @see then()
<ide> */
<del> public function getThenType(): ?string;
<add> public function getResultType(): ?string;
<ide> }
<ide><path>tests/TestCase/Database/Expression/CaseStatementExpressionTest.php
<ide> use Cake\I18n\FrozenTime;
<ide> use Cake\I18n\Time;
<ide> use Cake\Test\test_app\TestApp\Database\Expression\CustomWhenThenExpression;
<add>use Cake\Test\test_app\TestApp\Stub\CaseStatementExpressionStub;
<add>use Cake\Test\test_app\TestApp\Stub\WhenThenExpressionStub;
<ide> use Cake\TestSuite\TestCase;
<ide> use InvalidArgumentException;
<ide> use LogicException;
<ide> public function typeInferenceDataProvider(): array
<ide> */
<ide> public function testInferValueType($value, ?string $type): void
<ide> {
<del> $expression = (new CaseStatementExpression(new TypeMap(['Table.column' => 'boolean'])))
<add> $expression = new CaseStatementExpressionStub(new TypeMap(['Table.column' => 'boolean']));
<add>
<add> $this->assertNull($expression->getValueType());
<add>
<add> $expression
<ide> ->value($value)
<ide> ->when(1)
<ide> ->then(2);
<add>
<ide> $this->assertSame($type, $expression->getValueType());
<ide> }
<ide>
<add> public function whenTypeInferenceDataProvider(): array
<add> {
<add> return [
<add> ['1', 'string'],
<add> [1, 'integer'],
<add> [1.0, 'float'],
<add> [true, 'boolean'],
<add> [ChronosDate::now(), 'date'],
<add> [Chronos::now(), 'datetime'],
<add> [new IdentifierExpression('Table.column'), 'boolean'],
<add> [['Table.column' => true], null],
<add> [new stdClass(), null],
<add> ];
<add> }
<add>
<ide> /**
<del> * @dataProvider typeInferenceDataProvider
<add> * @dataProvider whenTypeInferenceDataProvider
<ide> * @param mixed $value The value from which to infer the type.
<ide> * @param string|null $type The expected type.
<ide> */
<ide> public function testInferWhenType($value, ?string $type): void
<ide> {
<del> $this->skipIf(
<del> $value === null,
<del> '`\Cake\Database\Expression\CaseExpression::when()` does not accept `null`'
<del> );
<add> $expression = new CaseStatementExpressionStub(new TypeMap(['Table.column' => 'boolean']));
<add> $expression->when(new WhenThenExpressionStub($expression->getTypeMap()));
<add>
<add> $this->assertNull($expression->clause('when')[0]->getWhenType());
<ide>
<del> $expression = (new CaseStatementExpression(new TypeMap(['Table.column' => 'boolean'])))
<add> $expression->clause('when')[0]
<ide> ->when($value)
<ide> ->then(1);
<add>
<ide> $this->assertSame($type, $expression->clause('when')[0]->getWhenType());
<ide> }
<ide>
<ide> public function testInferWhenType($value, ?string $type): void
<ide> * @param mixed $value The value from which to infer the type.
<ide> * @param string|null $type The expected type.
<ide> */
<del> public function testInferThenType($value, ?string $type): void
<add> public function testInferResultType($value, ?string $type): void
<ide> {
<del> $expression = (new CaseStatementExpression(new TypeMap(['Table.column' => 'boolean'])))
<add> $expression = (new CaseStatementExpressionStub(new TypeMap(['Table.column' => 'boolean'])))
<add> ->when(function (WhenThenExpressionInterface $whenThen) {
<add> return $whenThen;
<add> });
<add>
<add> $this->assertNull($expression->clause('when')[0]->getResultType());
<add>
<add> $expression->clause('when')[0]
<ide> ->when(['Table.column' => true])
<ide> ->then($value);
<del> $this->assertSame($type, $expression->clause('when')[0]->getThenType());
<add>
<add> $this->assertSame($type, $expression->clause('when')[0]->getResultType());
<ide> }
<ide>
<ide> /**
<ide> public function testInferThenType($value, ?string $type): void
<ide> */
<ide> public function testInferElseType($value, ?string $type): void
<ide> {
<del> $expression = (new CaseStatementExpression(new TypeMap(['Table.column' => 'boolean'])))
<del> ->else($value);
<add> $expression = new CaseStatementExpressionStub(new TypeMap(['Table.column' => 'boolean']));
<add>
<add> $this->assertNull($expression->getElseType());
<add>
<add> $expression->else($value);
<add>
<ide> $this->assertSame($type, $expression->getElseType());
<ide> }
<ide>
<ide> public function testGetValueClause(): void
<ide> $this->assertSame(1, $expression->clause('value'));
<ide> }
<ide>
<del> public function testGetValueType(): void
<del> {
<del> $expression = new CaseStatementExpression();
<del>
<del> $this->assertNull($expression->getValueType());
<del>
<del> $expression->value(1);
<del>
<del> $this->assertSame('integer', $expression->getValueType());
<del> }
<del>
<ide> public function testGetWhenClause(): void
<ide> {
<ide> $when = ['Table.column' => true];
<ide> public function testWhenNonArrayValueGetWhenClause(): void
<ide> $this->assertSame(1, $expression->clause('when')[0]->clause('when'));
<ide> }
<ide>
<del> public function testWhenGetWhenType(): void
<del> {
<del> $expression = (new CaseStatementExpression())
<del> ->when(function (WhenThenExpressionInterface $whenThen) {
<del> return $whenThen;
<del> });
<del>
<del> $this->assertNull($expression->clause('when')[0]->getWhenType());
<del>
<del> $expression->clause('when')[0]->when(1);
<del>
<del> $this->assertSame('integer', $expression->clause('when')[0]->getWhenType());
<del>
<del> $types = [
<del> 'Table.column' => 'boolean',
<del> ];
<del> $expression->clause('when')[0]->when(['Table.column' => true], $types);
<del>
<del> $this->assertSame($types, $expression->clause('when')[0]->getWhenType());
<del> }
<del>
<ide> public function testWhenGetThenClause(): void
<ide> {
<ide> $expression = (new CaseStatementExpression())
<ide> public function testWhenGetThenClause(): void
<ide> $this->assertSame(1, $expression->clause('when')[0]->clause('then'));
<ide> }
<ide>
<del> public function testWhenGetThenType(): void
<del> {
<del> $expression = (new CaseStatementExpression())
<del> ->when(function (WhenThenExpressionInterface $whenThen) {
<del> return $whenThen;
<del> });
<del>
<del> $this->assertNull($expression->clause('when')[0]->getThenType());
<del>
<del> $expression->clause('when')[0]->then(1);
<del>
<del> $this->assertSame('integer', $expression->clause('when')[0]->getThenType());
<del> }
<del>
<ide> public function testGetElseClause(): void
<ide> {
<ide> $expression = new CaseStatementExpression();
<ide> public function testGetElseClause(): void
<ide> $this->assertSame(2, $expression->clause('else'));
<ide> }
<ide>
<del> public function testGetElseType(): void
<del> {
<del> $expression = new CaseStatementExpression();
<del>
<del> $this->assertNull($expression->getElseType());
<del>
<del> $expression->else(1);
<del>
<del> $this->assertSame('integer', $expression->getElseType());
<del> }
<del>
<ide> // endregion
<ide>
<ide> // region Order based syntax
<ide><path>tests/test_app/TestApp/Stub/CaseStatementExpressionStub.php
<add><?php
<add>
<add>namespace Cake\Test\test_app\TestApp\Stub;
<add>
<add>use Cake\Database\Expression\CaseStatementExpression;
<add>
<add>class CaseStatementExpressionStub extends CaseStatementExpression
<add>{
<add> /**
<add> * Returns the case value type.
<add> *
<add> * @return string|null
<add> */
<add> public function getValueType(): ?string
<add> {
<add> return $this->valueType;
<add> }
<add>
<add> /**
<add> * Returns the type of the `ELSE` result value.
<add> *
<add> * @return string|null The result type, or `null` if none has been set yet.
<add> */
<add> public function getElseType(): ?string
<add> {
<add> return $this->elseType;
<add> }
<add>}
<ide><path>tests/test_app/TestApp/Stub/WhenThenExpressionStub.php
<add><?php
<add>
<add>namespace Cake\Test\test_app\TestApp\Stub;
<add>
<add>use Cake\Database\Expression\WhenThenExpression;
<add>
<add>class WhenThenExpressionStub extends WhenThenExpression
<add>{
<add> /**
<add> * Returns the `WHEN` value type.
<add> *
<add> * @return array|string|null
<add> * @see when()
<add> */
<add> public function getWhenType(): ?string
<add> {
<add> return $this->whenType;
<add> }
<add>} | 7 |
Javascript | Javascript | remove unnecessary semi-colon from animationaction | 41158b56f3e77d29dfb49faefd554724ef2eadb5 | <ide><path>src/animation/AnimationAction.js
<ide> function AnimationAction( mixer, clip, localRoot ) {
<ide> this.zeroSlopeAtStart = true; // for smooth interpolation w/o separate
<ide> this.zeroSlopeAtEnd = true; // clips for start, loop and end
<ide>
<del>};
<add>}
<ide>
<ide> AnimationAction.prototype = {
<ide> | 1 |
Python | Python | change default threshold for matrix_rank | 78b7693d1a3381aabb23b244332e5a568f58909f | <ide><path>numpy/linalg/linalg.py
<ide> def matrix_rank(M, tol=None):
<ide> """
<ide> Return matrix rank of array using SVD method
<ide>
<del> Rank of the array is the number of SVD singular values of the
<del> array that are greater than `tol`.
<add> Rank of the array is the number of SVD singular values of the array that are
<add> greater than `tol`.
<ide>
<ide> Parameters
<ide> ----------
<ide> def matrix_rank(M, tol=None):
<ide> threshold below which SVD values are considered zero. If `tol` is
<ide> None, and ``S`` is an array with singular values for `M`, and
<ide> ``eps`` is the epsilon value for datatype of ``S``, then `tol` is
<del> set to ``S.max() * eps``.
<add> set to ``S.max() * max(M.shape) * eps``.
<ide>
<ide> Notes
<ide> -----
<del> Golub and van Loan [1]_ define "numerical rank deficiency" as using
<del> tol=eps*S[0] (where S[0] is the maximum singular value and thus the
<del> 2-norm of the matrix). This is one definition of rank deficiency,
<del> and the one we use here. When floating point roundoff is the main
<del> concern, then "numerical rank deficiency" is a reasonable choice. In
<del> some cases you may prefer other definitions. The most useful measure
<del> of the tolerance depends on the operations you intend to use on your
<del> matrix. For example, if your data come from uncertain measurements
<del> with uncertainties greater than floating point epsilon, choosing a
<del> tolerance near that uncertainty may be preferable. The tolerance
<del> may be absolute if the uncertainties are absolute rather than
<del> relative.
<add> The default threshold to detect rank deficiency is a test on the magnitude
<add> of the singular values of `M`. By default, we identify singular values less
<add> than ``S.max() * max(M.shape) * eps`` as indicating rank deficiency (with
<add> the symbols defined above). This is the algorithm MATLAB uses [1]. It also
<add> appears in *Numerical recipes* in the discussion of SVD solutions for linear
<add> least squares [2].
<add>
<add> This default threshold is designed to detect rank deficiency accounting for
<add> the numerical errors of the SVD computation. Imagine that there is a column
<add> in `M` that is an exact (in floating point) linear combination of other
<add> columns in `M`. Computing the SVD on `M` will not produce a singular value
<add> exactly equal to 0 in general: any difference of the smallest SVD value from
<add> 0 will be caused by numerical imprecision in the calculation of the SVD.
<add> Our threshold for small SVD values takes this numerical imprecision into
<add> account, and the default threshold will detect such numerical rank
<add> deficiency. The threshold may declare a matrix `M` rank deficient even if
<add> the linear combination of some columns of `M` is not exactly equal to
<add> another column of `M` but only numerically very close to another column of
<add> `M`.
<add>
<add> We chose our default threshold because it is in wide use. Other thresholds
<add> are possible. For example, elsewhere in the 2007 edition of *Numerical
<add> recipes* there is an alternative threshold of ``S.max() *
<add> np.finfo(M.dtype).eps / 2. * np.sqrt(m + n + 1.)``. The authors describe
<add> this threshold as being based on "expected roundoff error" (p 71).
<add>
<add> The thresholds above deal with floating point roundoff error in the
<add> calculation of the SVD. However, you may have more information about the
<add> sources of error in `M` that would make you consider other tolerance values
<add> to detect *effective* rank deficiency. The most useful measure of the
<add> tolerance depends on the operations you intend to use on your matrix. For
<add> example, if your data come from uncertain measurements with uncertainties
<add> greater than floating point epsilon, choosing a tolerance near that
<add> uncertainty may be preferable. The tolerance may be absolute if the
<add> uncertainties are absolute rather than relative.
<ide>
<ide> References
<ide> ----------
<del> .. [1] G. H. Golub and C. F. Van Loan, *Matrix Computations*.
<del> Baltimore: Johns Hopkins University Press, 1996.
<add> .. [1] MATLAB reference documention, "Rank"
<add> http://www.mathworks.com/help/techdoc/ref/rank.html
<add> .. [2] W. H. Press, S. A. Teukolsky, W. T. Vetterling and B. P. Flannery,
<add> "Numerical Recipes (3rd edition)", Cambridge University Press, 2007,
<add> page 795.
<ide>
<ide> Examples
<ide> --------
<ide> def matrix_rank(M, tol=None):
<ide> 1
<ide> >>> matrix_rank(np.zeros((4,)))
<ide> 0
<del>
<ide> """
<ide> M = asarray(M)
<ide> if M.ndim > 2:
<ide> def matrix_rank(M, tol=None):
<ide> return int(not all(M==0))
<ide> S = svd(M, compute_uv=False)
<ide> if tol is None:
<del> tol = S.max() * finfo(S.dtype).eps
<add> tol = S.max() * max(M.shape) * finfo(S.dtype).eps
<ide> return sum(S > tol)
<ide>
<ide>
<ide><path>numpy/linalg/tests/test_linalg.py
<ide> import sys
<ide>
<ide> import numpy as np
<del>from numpy.testing import *
<add>from numpy.testing import (TestCase, assert_, assert_equal, assert_raises,
<add> assert_array_equal, assert_almost_equal,
<add> run_module_suite)
<ide> from numpy import array, single, double, csingle, cdouble, dot, identity
<ide> from numpy import multiply, atleast_2d, inf, asarray, matrix
<ide> from numpy import linalg
<ide> def test_matrix_rank(self):
<ide> yield assert_equal, matrix_rank(1), 1
<ide>
<ide>
<add>def test_reduced_rank():
<add> # Test matrices with reduced rank
<add> rng = np.random.RandomState(20120714)
<add> for i in range(100):
<add> # Make a rank deficient matrix
<add> X = rng.normal(size=(40, 10))
<add> X[:, 0] = X[:, 1] + X[:, 2]
<add> # Assert that matrix_rank detected deficiency
<add> assert_equal(matrix_rank(X), 9)
<add> X[:, 3] = X[:, 4] + X[:, 5]
<add> assert_equal(matrix_rank(X), 8)
<add>
<add>
<ide> class TestQR(TestCase):
<ide> def test_qr_empty(self):
<ide> a = np.zeros((0,2)) | 2 |
PHP | PHP | remove use of webroot_dir from cakephp | 9245265dddc1e2d4877e466625c5f7771ce8b2f8 | <ide><path>tests/TestCase/Controller/Component/AuthComponentTest.php
<ide> public function testLoginRedirect() {
<ide>
<ide> Configure::write('App', array(
<ide> 'dir' => APP_DIR,
<del> 'webroot' => WEBROOT_DIR,
<add> 'webroot' => 'webroot',
<ide> 'base' => false,
<ide> 'baseUrl' => '/cake/index.php'
<ide> ));
<ide> public function testRedirectUrlWithBaseSet() {
<ide>
<ide> Configure::write('App', array(
<ide> 'dir' => APP_DIR,
<del> 'webroot' => WEBROOT_DIR,
<add> 'webroot' => 'webroot',
<ide> 'base' => false,
<ide> 'baseUrl' => '/cake/index.php'
<ide> ));
<ide><path>tests/TestCase/Network/RequestTest.php
<ide> public function testBaseUrlWithNoModRewrite() {
<ide>
<ide> Configure::write('App', array(
<ide> 'dir' => APP_DIR,
<del> 'webroot' => WEBROOT_DIR,
<add> 'webroot' => 'webroot',
<ide> 'base' => false,
<ide> 'baseUrl' => '/cake/index.php'
<ide> ));
<ide><path>tests/bootstrap.php
<ide> define('DS', DIRECTORY_SEPARATOR);
<ide> define('ROOT', dirname(__DIR__));
<ide> define('APP_DIR', 'TestApp');
<del>define('WEBROOT_DIR', 'webroot');
<ide>
<ide> define('TMP', sys_get_temp_dir() . DS);
<ide> define('LOGS', TMP . 'logs' . DS);
<ide>
<ide> // Point app constants to the test app.
<ide> define('APP', TEST_APP . 'TestApp' . DS);
<del>define('WWW_ROOT', TEST_APP . WEBROOT_DIR . DS);
<add>define('WWW_ROOT', TEST_APP . 'webroot' . DS);
<ide> define('TESTS', TEST_APP . 'tests' . DS);
<ide> define('CONFIG', TEST_APP . 'config' . DS);
<ide>
<ide> 'base' => false,
<ide> 'baseUrl' => false,
<ide> 'dir' => APP_DIR,
<del> 'webroot' => WEBROOT_DIR,
<add> 'webroot' => 'webroot',
<ide> 'www_root' => WWW_ROOT,
<ide> 'fullBaseUrl' => 'http://localhost',
<ide> 'imageBaseUrl' => 'img/', | 3 |
Javascript | Javascript | remove common.port from test-net-throttle | 76fd17a7dff6b89b8851044b17125a88a3043b4e | <ide><path>test/pummel/test-net-throttle.js
<ide> // USE OR OTHER DEALINGS IN THE SOFTWARE.
<ide>
<ide> 'use strict';
<del>const common = require('../common');
<add>require('../common');
<ide> const assert = require('assert');
<ide> const net = require('net');
<ide>
<ide> let npauses = 0;
<ide> console.log('build big string');
<ide> const body = 'C'.repeat(N);
<ide>
<del>console.log(`start server on port ${common.PORT}`);
<del>
<ide> const server = net.createServer((connection) => {
<ide> connection.write(body.slice(0, part_N));
<ide> connection.write(body.slice(part_N, 2 * part_N));
<ide> const server = net.createServer((connection) => {
<ide> connection.end();
<ide> });
<ide>
<del>server.listen(common.PORT, () => {
<add>server.listen(0, () => {
<add> const port = server.address().port;
<add> console.log(`server started on port ${port}`);
<ide> let paused = false;
<del> const client = net.createConnection(common.PORT);
<add> const client = net.createConnection(port);
<ide> client.setEncoding('ascii');
<ide> client.on('data', (d) => {
<ide> chars_recved += d.length; | 1 |
Python | Python | remove print stament which some how ended up there | 29e33873d9e072f75f407cbf32f0f09c5cf3b875 | <ide><path>libcloud/compute/drivers/ec2.py
<ide> def list_sizes(self, location=None):
<ide> attributes = copy.deepcopy(attributes)
<ide> price = self._get_size_price(size_id=instance_type)
<ide> attributes.update({'price': price})
<del> print attributes
<ide> sizes.append(NodeSize(driver=self, **attributes))
<ide> return sizes
<ide> | 1 |
Javascript | Javascript | cover util.inspect on boxed primitive with colors | c31ac419a902560ce619c599e2352b83660eb8e0 | <ide><path>test/parallel/test-util-inspect.js
<ide> assert.strictEqual(
<ide>
<ide> // Test boxed primitives output the correct values.
<ide> assert.strictEqual(util.inspect(new String('test')), "[String: 'test']");
<add>assert.strictEqual(
<add> util.inspect(new String('test'), { colors: true }),
<add> "\u001b[32m[String: 'test']\u001b[39m"
<add>);
<ide> assert.strictEqual(
<ide> util.inspect(Object(Symbol('test'))),
<ide> '[Symbol: Symbol(test)]' | 1 |
Go | Go | fix race condition in cmdstream | 89dd10b06efe93d4f427057f043abf560c461281 | <ide><path>pkg/archive/archive.go
<ide> func cmdStream(cmd *exec.Cmd, input io.Reader) (io.ReadCloser, error) {
<ide> return nil, err
<ide> }
<ide>
<add> // Ensure the command has exited before we clean anything up
<add> done := make(chan struct{})
<add>
<ide> // Copy stdout to the returned pipe
<ide> go func() {
<ide> if err := cmd.Wait(); err != nil {
<ide> pipeW.CloseWithError(fmt.Errorf("%s: %s", err, errBuf.String()))
<ide> } else {
<ide> pipeW.Close()
<ide> }
<add> close(done)
<ide> }()
<ide>
<del> return pipeR, nil
<add> return ioutils.NewReadCloserWrapper(pipeR, func() error {
<add> // Close pipeR, and then wait for the command to complete before returning. We have to close pipeR first, as
<add> // cmd.Wait waits for any non-file stdout/stderr/stdin to close.
<add> err := pipeR.Close()
<add> <-done
<add> return err
<add> }), nil
<ide> }
<ide>
<ide> // NewTempArchive reads the content of src into a temporary file, and returns the contents
<ide><path>pkg/archive/archive_test.go
<ide> func TestPigz(t *testing.T) {
<ide> _, err := exec.LookPath("unpigz")
<ide> if err == nil {
<ide> t.Log("Tested whether Pigz is used, as it installed")
<del> assert.Equal(t, reflect.TypeOf(contextReaderCloserWrapper.Reader), reflect.TypeOf(&io.PipeReader{}))
<add> // For the command wait wrapper
<add> cmdWaitCloserWrapper := contextReaderCloserWrapper.Reader.(*ioutils.ReadCloserWrapper)
<add> assert.Equal(t, reflect.TypeOf(cmdWaitCloserWrapper.Reader), reflect.TypeOf(&io.PipeReader{}))
<ide> } else {
<ide> t.Log("Tested whether Pigz is not used, as it not installed")
<ide> assert.Equal(t, reflect.TypeOf(contextReaderCloserWrapper.Reader), reflect.TypeOf(&gzip.Reader{})) | 2 |
PHP | PHP | add getstore to repository interface. | de438fb381df02ea048daa732fb3773618514ecb | <ide><path>src/Illuminate/Contracts/Cache/Repository.php
<ide> public function rememberForever($key, Closure $callback);
<ide> * @return bool
<ide> */
<ide> public function forget($key);
<add>
<add> /**
<add> * Get the cache store implementation.
<add> *
<add> * @return \Illuminate\Contracts\Cache\Store
<add> */
<add> public function getStore();
<ide> } | 1 |
Javascript | Javascript | append entire dom fragment at once | 9ac950f9a8a5cc4dd67fa71e6efdf1f478dd3d80 | <ide><path>web/text_layer_builder.js
<ide> var TextLayerBuilder = function textLayerBuilder(options) {
<ide> if ('isWhitespace' in textDiv.dataset) {
<ide> continue;
<ide> }
<del> textLayerFrag.appendChild(textDiv);
<ide>
<ide> ctx.font = textDiv.style.fontSize + ' ' + textDiv.style.fontFamily;
<ide> var width = ctx.measureText(textDiv.textContent).width;
<ide>
<ide> if (width > 0) {
<add> textLayerFrag.appendChild(textDiv);
<ide> var textScale = textDiv.dataset.canvasWidth / width;
<ide> var rotation = textDiv.dataset.angle;
<ide> var transform = 'scale(' + textScale + ', 1)';
<ide> transform = 'rotate(' + rotation + 'deg) ' + transform;
<ide> CustomStyle.setProp('transform' , textDiv, transform);
<ide> CustomStyle.setProp('transformOrigin' , textDiv, '0% 0%');
<del>
<del> textLayerDiv.appendChild(textDiv);
<ide> }
<ide> }
<ide>
<add> textLayerDiv.appendChild(textLayerFrag);
<ide> this.renderingDone = true;
<ide> this.updateMatches();
<del>
<del> textLayerDiv.appendChild(textLayerFrag);
<ide> };
<ide>
<ide> this.setupRenderLayoutTimer = function textLayerSetupRenderLayoutTimer() { | 1 |
Python | Python | add test for #844 (inner product pb with atlas) | ce5fc0af6285ca4ed1478c42c48fd1f6a7909f83 | <ide><path>numpy/core/tests/test_blasdot.py
<add>from numpy.core import zeros, float64
<add>from numpy.testing import TestCase, assert_almost_equal
<add>from numpy.core.multiarray import inner as inner_
<add>
<add>DECPREC = 14
<add>
<add>class TestInner(TestCase):
<add> def test_vecself(self):
<add> """Ticket 844."""
<add> # Inner product of a vector with itself segfaults or give meaningless
<add> # result
<add> a = zeros(shape = (1, 80), dtype = float64)
<add> p = inner_(a, a)
<add> assert_almost_equal(p, 0, decimal = DECPREC) | 1 |
Python | Python | add batteries info thanks to batinfo lib | c3803c0c1b597f719b7afcad62cf3a368d3c2b46 | <ide><path>glances/glances.py
<ide> else:
<ide> csv_lib_tag = True
<ide>
<add>if (is_Linux):
<add> try:
<add> # Import the batinfo lib (optionnal)
<add> import batinfo
<add> except ImportError:
<add> batinfo_lib_tag = False
<add> else:
<add> batinfo_lib_tag = True
<add>
<ide> # Default tag
<ide> sensors_tag = False
<ide> hddtemp_tag = False
<ide> def getlist(self):
<ide> return self.processlist
<ide>
<ide>
<add>class glancesGrabBat:
<add> """
<add> Get batteries stats using the Batinfo librairie
<add> """
<add>
<add> def __init__(self):
<add> """
<add> Init batteries stats
<add> """
<add>
<add> if (batinfo_lib_tag):
<add> try:
<add> self.bat = batinfo.batteries()
<add> except:
<add> self.initok = False
<add> else:
<add> self.initok = True
<add> self.__update__()
<add>
<add> def __update__(self):
<add> """
<add> Update the stats
<add> """
<add>
<add> if self.initok:
<add> self.bat.update()
<add> self.bat_list = self.bat.stat
<add> else:
<add> self.bat_list = []
<add>
<add> def get(self):
<add> # Update the stats
<add> self.__update__()
<add> return self.bat_list
<add>
<add> def getcapacitypercent(self):
<add>
<add> if not self.initok or self.bat_list == []:
<add> return []
<add> # Init the bsum (sum of percent) and bcpt (number of batteries)
<add> # and Loop over batteries (yes a computer could have more than 1 battery)
<add> bsum = 0
<add> for bcpt in range(len(self.get())):
<add> bsum = bsum + int(self.bat_list[bcpt].capacity)
<add> bcpt = bcpt + 1
<add> # Return the global percent
<add> return int(bsum / bcpt)
<add>
<add>
<ide> class GlancesStats:
<ide> """
<ide> This class store, update and give stats
<ide> def __init__(self):
<ide> except Exception:
<ide> self.hddtemp_tag = False
<ide>
<add> if batinfo_lib_tag:
<add> self.glancesgrabbat = glancesGrabBat()
<add>
<ide> # Init the process list
<ide> self.process_list_refresh = True
<ide> self.process_list_sortedby = ''
<ide> def __update__(self, input_stats):
<ide> if hddtemp_tag:
<ide> self.hddtemp = self.glancesgrabhddtemp.get()
<ide>
<add> # BATERRIES INFORMATION
<add> if batinfo_lib_tag:
<add> self.batpercent = self.glancesgrabbat.getcapacitypercent()
<add>
<ide> # DISK I/O
<ide> if diskio_tag and not self.diskio_error_tag:
<ide> time_since_update = getTimeSinceLastUpdate('disk')
<ide> def getHDDTemp(self):
<ide> else:
<ide> return []
<ide>
<add> def getBatPercent(self):
<add> if batinfo_lib_tag:
<add> return self.batpercent
<add> else:
<add> return []
<add>
<ide> def getDiskIO(self):
<ide> if diskio_tag:
<ide> return sorted(self.diskio, key=lambda diskio: diskio['disk_name'])
<ide> def __update__(self, input_stats):
<ide> self.all_stats["network"] = self.network if network_tag else []
<ide> self.all_stats["sensors"] = self.sensors if sensors_tag else []
<ide> self.all_stats["hddtemp"] = self.hddtemp if hddtemp_tag else []
<add> self.all_stats["batpercent"] = self.batpercent if batinfo_lib_tag else []
<ide> self.all_stats["diskio"] = self.diskio if diskio_tag else []
<ide> self.all_stats["fs"] = self.fs if fs_tag else []
<ide> self.all_stats["processcount"] = self.processcount if process_tag else 0
<ide> def __update__(self, input_stats):
<ide> self.hddtemp = input_stats["hddtemp"]
<ide> except:
<ide> self.hddtemp = []
<add> try:
<add> self.batpercent = input_stats["batpercent"]
<add> except:
<add> self.batpercent = []
<ide> try:
<ide> self.diskio = input_stats["diskio"]
<ide> except:
<ide> def __init__(self, refresh_time=1, use_bold=1):
<ide> self.help_y = 0
<ide> self.now_x = 79
<ide> self.now_y = 3
<add> self.bat_x = 0
<add> self.bat_y = 3
<ide> self.caption_x = 0
<ide> self.caption_y = 3
<ide>
<ide> def __getHDDTempColor2(self, current=0):
<ide> """
<ide> return self.__colors_list2[self.__getHDDTempAlert(current)]
<ide>
<del>
<ide> def __getProcessAlert(self, current=0, max=100, stat='', core=1):
<ide> # If current < CAREFUL of max then alert = OK
<ide> # If current > CAREFUL of max then alert = CAREFUL
<ide> def display(self, stats, cs_status="None"):
<ide> self.displayProcess(processcount, processlist, stats.getSortedBy(),
<ide> log_count=log_count, core=stats.getCore())
<ide> self.displayCaption(cs_status=cs_status)
<del> self.displayNow(stats.getNow())
<ide> self.displayHelp(core=stats.getCore())
<add> self.displayBat(stats.getBatPercent())
<add> self.displayNow(stats.getNow())
<ide>
<ide> def erase(self):
<ide> # Erase the content of the screen
<ide> def displayHelp(self, core):
<ide> '{0:{width}}{1}'.format(*key, width=width), 38)
<ide> key_table_y += 1
<ide>
<add>
<add> def displayBat(self, batpercent):
<add> # Display the current batteries capacities % - Center
<add> if not batinfo_lib_tag and batpercent != []:
<add> return 0
<add> screen_x = self.screen.getmaxyx()[1]
<add> screen_y = self.screen.getmaxyx()[0]
<add> # Build the message to display
<add> bat_msg = "%d%%" % batpercent
<add> # Display the message (if possible)
<add> if (screen_y > self.bat_y and
<add> screen_x > self.bat_x + len(bat_msg)):
<add> center = (screen_x // 2) - len(bat_msg) // 2
<add> self.term_window.addnstr(
<add> max(self.bat_y, screen_y - 1),
<add> self.bat_x + center,
<add> bat_msg, len(bat_msg))
<add>
<add>
<ide> def displayNow(self, now):
<del> # Display the current date and time (now...) - Center
<add> # Display the current date and time (now...) - Right
<ide> if not now:
<ide> return 0
<ide> screen_x = self.screen.getmaxyx()[1]
<ide> def getProcessList(self):
<ide> self.__update__()
<ide> return json.dumps(stats.getProcessList())
<ide>
<add> def getBatPercent(self):
<add> # Update and return total batteries percent stats
<add> self.__update__()
<add> return json.dumps(stats.getBatPercent())
<add>
<ide> def getNow(self):
<ide> # Update and return current date/hour
<ide> self.__update__()
<ide><path>setup.py
<ide> extras_require={
<ide> 'HTML': ['jinja2>=2.0'],
<ide> 'SENSORS': ['pysensors>=0.0.2']
<add> 'BATINFO': ['batinfo>=0.1.3']
<ide> },
<ide> packages=['glances'],
<ide> include_package_data=True, | 2 |
Python | Python | improve docker client connection | b0dce2c6a1ca68dbfe08d188cef8b554ef5196f0 | <ide><path>glances/plugins/glances_docker.py
<ide> def get_export(self):
<ide> def connect(self):
<ide> """Connect to the Docker server."""
<ide> try:
<del> ret = docker.from_env(timeout=int(self.get_conf_value('timeout', '1')))
<add> ret = docker.from_env(timeout=int(self.get_conf_value('timeout',
<add> default='1')))
<ide> except Exception as e:
<ide> logger.error("docker plugin - Can not connect to Docker ({})".format(e))
<ide> ret = None
<ide> def update(self):
<ide> # Init new stats
<ide> stats = self.get_init_value()
<ide>
<del> # The Docker-py lib is mandatory
<del> if import_error_tag:
<add> # The Docker-py lib is mandatory and connection should be ok
<add> if import_error_tag or self.docker_client is None:
<ide> return self.stats
<ide>
<ide> if self.input_method == 'local': | 1 |
Python | Python | improve python code in sequential doc | c09e753f26afc7ec85a5213df5c2ea52a4e63da2 | <ide><path>keras/engine/sequential.py
<ide> class Sequential(functional.Functional):
<ide> model.add(tf.keras.layers.Dense(8, input_shape=(16,)))
<ide> model.add(tf.keras.layers.Dense(4))
<ide> len(model.weights)
<del> 4
<add> # Returns "4"
<ide>
<ide> # When using the delayed-build pattern (no input shape specified), you can
<ide> # choose to manually build your model by calling
<ide> class Sequential(functional.Functional):
<ide> model.add(tf.keras.layers.Dense(4))
<ide> model.build((None, 16))
<ide> len(model.weights)
<del> 4
<add> # Returns "4"
<ide>
<ide> # Note that when using the delayed-build pattern (no input shape specified),
<ide> # the model gets built the first time you call `fit`, `eval`, or `predict`, | 1 |
PHP | PHP | fix build failures | 409fbb1b1818f72b352b894b30a48fa5e2d0fdd4 | <ide><path>tests/TestCase/Database/QueryTest.php
<ide> public function testSelectJoinWithCallback() {
<ide> $query = new Query($this->connection);
<ide> $types = ['created' => 'datetime'];
<ide> $result = $query
<del> ->select(['title', 'name' => 'c.comment'])
<add> ->select(['title', 'name' => 'comments.comment'])
<ide> ->from('articles')
<ide> ->innerJoin('comments', function($exp, $q) use ($query, $types) {
<ide> $this->assertSame($q, $query);
<ide><path>tests/TestCase/View/Helper/FormHelperTest.php
<ide> public function testFormValidationMultiRecord() {
<ide> TableRegistry::get('Contacts', [
<ide> 'className' => __NAMESPACE__ . '\ContactsTable'
<ide> ]);
<add> $one->set('email', '');
<ide> $one->errors('email', ['invalid email']);
<add>
<add> $two->set('name', '');
<ide> $two->errors('name', ['This is wrong']);
<ide> $this->Form->create([$one, $two], ['context' => ['table' => 'Contacts']]);
<ide>
<del> $result = $this->Form->input('Contacts.0.email');
<add> $result = $this->Form->input('0.email');
<ide> $expected = array(
<ide> 'div' => array('class' => 'input email error'),
<del> 'label' => array('for' => 'contacts-0-email'),
<add> 'label' => array('for' => '0-email'),
<ide> 'Email',
<ide> '/label',
<ide> 'input' => array(
<del> 'type' => 'text', 'name' => 'Contacts[0][email]', 'id' => 'contacts-0-email',
<del> 'class' => 'form-error', 'maxlength' => 255
<add> 'type' => 'email', 'name' => '0[email]', 'id' => '0-email',
<add> 'class' => 'form-error', 'maxlength' => 255, 'value' => '',
<ide> ),
<ide> array('div' => array('class' => 'error-message')),
<ide> 'invalid email',
<ide> '/div',
<ide> '/div'
<ide> );
<add> $this->assertTags($result, $expected);
<ide>
<del> $result = $this->Form->input('Contacts.1.name');
<add> $result = $this->Form->input('1.name');
<ide> $expected = array(
<ide> 'div' => array('class' => 'input text error'),
<del> 'label' => array('for' => 'contacts-1-name'),
<add> 'label' => array('for' => '1-name'),
<ide> 'Name',
<ide> '/label',
<ide> 'input' => array(
<del> 'type' => 'text', 'name' => 'Contacts[1][name]', 'id' => 'contacts-1-name',
<del> 'class' => 'form-error', 'maxlength' => 255
<add> 'type' => 'text', 'name' => '1[name]', 'id' => '1-name',
<add> 'class' => 'form-error', 'maxlength' => 255, 'value' => ''
<ide> ),
<ide> array('div' => array('class' => 'error-message')),
<ide> 'This is wrong',
<ide> public function testInputCustomization() {
<ide>
<ide> $entity = new Entity(['phone' => 'Hello & World > weird chars']);
<ide> $this->Form->create($entity, ['context' => ['table' => 'Contacts']]);
<del> $result = $this->Form->input('Contact.phone');
<add> $result = $this->Form->input('phone');
<ide> $expected = array(
<ide> 'div' => array('class' => 'input tel'),
<del> 'label' => array('for' => 'contact-phone'),
<add> 'label' => array('for' => 'phone'),
<ide> 'Phone',
<ide> '/label',
<ide> array('input' => array(
<del> 'type' => 'tel', 'name' => 'Contact[phone]',
<add> 'type' => 'tel', 'name' => 'phone',
<ide> 'value' => 'Hello & World > weird chars',
<del> 'id' => 'contact-phone', 'maxlength' => 255
<add> 'id' => 'phone', 'maxlength' => 255
<ide> )),
<ide> '/div'
<ide> );
<ide> public function testInputCustomization() {
<ide>
<ide> $entity->errors('field', 'Badness!');
<ide> $this->Form->create($entity, ['context' => ['table' => 'Contacts']]);
<del> $result = $this->Form->input('Contact.field');
<add> $result = $this->Form->input('field');
<ide> $expected = array(
<ide> 'div' => array('class' => 'input text error'),
<del> 'label' => array('for' => 'contact-field'),
<add> 'label' => array('for' => 'field'),
<ide> 'Field',
<ide> '/label',
<ide> 'input' => array(
<del> 'type' => 'text', 'name' => 'Contact[field]',
<del> 'id' => 'contact-field', 'class' => 'form-error'
<add> 'type' => 'text', 'name' => 'field',
<add> 'id' => 'field', 'class' => 'form-error'
<ide> ),
<ide> array('div' => array('class' => 'error-message')),
<ide> 'Badness!',
<ide> public function testInputCustomization() {
<ide> );
<ide> $this->assertTags($result, $expected);
<ide>
<del> $result = $this->Form->input('Contact.field', array(
<add> $result = $this->Form->input('field', array(
<ide> 'templates' => [
<ide> 'inputContainerError' => '{{content}}{{error}}',
<ide> 'error' => '<span class="error-message">{{content}}</span>'
<ide> ]
<ide> ));
<ide> $expected = array(
<del> 'label' => array('for' => 'contact-field'),
<add> 'label' => array('for' => 'field'),
<ide> 'Field',
<ide> '/label',
<ide> 'input' => array(
<del> 'type' => 'text', 'name' => 'Contact[field]',
<del> 'id' => 'contact-field', 'class' => 'form-error'
<add> 'type' => 'text', 'name' => 'field',
<add> 'id' => 'field', 'class' => 'form-error'
<ide> ),
<ide> array('span' => array('class' => 'error-message')),
<ide> 'Badness!',
<ide> public function testInputCustomization() {
<ide> $this->assertTags($result, $expected);
<ide>
<ide> $entity->errors('field', ['minLength']);
<del> $result = $this->Form->input('Contact.field', array(
<add> $result = $this->Form->input('field', array(
<ide> 'error' => array(
<ide> 'minLength' => 'Le login doit contenir au moins 2 caractères',
<ide> 'maxLength' => 'login too large'
<ide> )
<ide> ));
<ide> $expected = array(
<ide> 'div' => array('class' => 'input text error'),
<del> 'label' => array('for' => 'contact-field'),
<add> 'label' => array('for' => 'field'),
<ide> 'Field',
<ide> '/label',
<del> 'input' => array('type' => 'text', 'name' => 'Contact[field]', 'id' => 'contact-field', 'class' => 'form-error'),
<add> 'input' => array('type' => 'text', 'name' => 'field', 'id' => 'field', 'class' => 'form-error'),
<ide> array('div' => array('class' => 'error-message')),
<ide> 'Le login doit contenir au moins 2 caractères',
<ide> '/div',
<ide> public function testInputCustomization() {
<ide> $this->assertTags($result, $expected);
<ide>
<ide> $entity->errors('field', ['maxLength']);
<del> $result = $this->Form->input('Contact.field', array(
<add> $result = $this->Form->input('field', array(
<ide> 'error' => array(
<ide> 'minLength' => 'Le login doit contenir au moins 2 caractères',
<ide> 'maxLength' => 'login too large',
<ide> )
<ide> ));
<ide> $expected = array(
<ide> 'div' => array('class' => 'input text error'),
<del> 'label' => array('for' => 'contact-field'),
<add> 'label' => array('for' => 'field'),
<ide> 'Field',
<ide> '/label',
<del> 'input' => array('type' => 'text', 'name' => 'Contact[field]', 'id' => 'contact-field', 'class' => 'form-error'),
<add> 'input' => array('type' => 'text', 'name' => 'field', 'id' => 'field', 'class' => 'form-error'),
<ide> array('div' => array('class' => 'error-message')),
<ide> 'login too large',
<ide> '/div',
<ide> public function testInputMagicSelectForTypeNumber() {
<ide> $entity = new Entity(['balance' => 1]);
<ide> $this->Form->create($entity, ['context' => ['table' => 'ValidateUsers']]);
<ide> $this->View->viewVars['balances'] = array(0 => 'nothing', 1 => 'some', 100 => 'a lot');
<del> $result = $this->Form->input('ValidateUser.balance');
<add> $result = $this->Form->input('balance');
<ide> $expected = array(
<ide> 'div' => array('class' => 'input select'),
<del> 'label' => array('for' => 'validateuser-balance'),
<add> 'label' => array('for' => 'balance'),
<ide> 'Balance',
<ide> '/label',
<del> 'select' => array('name' => 'ValidateUser[balance]', 'id' => 'validateuser-balance'),
<add> 'select' => array('name' => 'balance', 'id' => 'balance'),
<ide> array('option' => array('value' => '0')),
<ide> 'nothing',
<ide> '/option', | 2 |
Javascript | Javascript | fix react.createfactory() crash | c932885e7972a4d363a62127355ceeafe18829e8 | <ide><path>packages/react-dom/src/__tests__/ReactDOMProduction-test.js
<ide> describe('ReactDOMProduction', () => {
<ide> expect(container.childNodes.length).toBe(0);
<ide> });
<ide>
<add> it('should support createFactory', () => {
<add> var span = React.createFactory('span');
<add> class Component extends React.Component {
<add> render() {
<add> return span({children: this.props.children});
<add> }
<add> }
<add>
<add> var ComponentFactory = React.createFactory(Component);
<add>
<add> var container = document.createElement('div');
<add> ReactDOM.render(
<add> ComponentFactory(null, span(null, 'Hello'), span(null, 'world')),
<add> container,
<add> );
<add> expect(container.firstChild.tagName).toBe('SPAN');
<add> expect(container.firstChild.childNodes[0].tagName).toBe('SPAN');
<add> expect(container.firstChild.childNodes[0].textContent).toBe('Hello');
<add> expect(container.firstChild.childNodes[1].tagName).toBe('SPAN');
<add> expect(container.firstChild.childNodes[1].textContent).toBe('world');
<add> });
<add>
<add> it('should support React public API methods', () => {
<add> expect(React.isValidElement(42)).toBe(false);
<add> expect(React.isValidElement(<div />)).toBe(true);
<add> expect(React.cloneElement(<div />, {foo: 42})).toEqual(<div foo={42} />);
<add>
<add> const mapped = React.Children.map(<div />, el =>
<add> React.cloneElement(el, {foo: 42}),
<add> );
<add> expect(mapped.length).toBe(1);
<add> expect(mapped[0].type).toBe('div');
<add> expect(mapped[0].props.foo).toBe(42);
<add>
<add> const arr = React.Children.toArray(<div />);
<add> expect(arr.length).toBe(1);
<add> expect(arr[0].type).toBe('div');
<add>
<add> let called = 0;
<add> React.Children.forEach(<div />, () => called++);
<add> expect(called).toBe(1);
<add>
<add> expect(React.Children.count(<div />)).toBe(1);
<add> expect(() => React.Children.only(42)).toThrowError();
<add> });
<add>
<ide> it('should handle a simple flow (ssr)', () => {
<ide> class Component extends React.Component {
<ide> render() {
<ide><path>packages/react/src/ReactElement.js
<ide> export function createElement(type, config, children) {
<ide> * See https://reactjs.org/docs/react-api.html#createfactory
<ide> */
<ide> export function createFactory(type) {
<del> var factory = ReactElement.createElement.bind(null, type);
<add> var factory = createElement.bind(null, type);
<ide> // Expose the type on the factory and the prototype so that it can be
<ide> // easily accessed on elements. E.g. `<Foo />.type === Foo`.
<ide> // This should not be named `constructor` since this may not be the function | 2 |
Ruby | Ruby | fix typo `s/trough/through/` | e0025fe34d7befaaafe44f0ba3a4c0d8f6c60cc4 | <ide><path>activerecord/test/cases/associations/has_many_through_associations_test.rb
<ide> def test_has_many_through_with_unscope_should_affect_to_through_scope
<ide> assert_equal [comments(:eager_other_comment1)], authors(:mary).unordered_comments
<ide> end
<ide>
<del> def test_has_many_trough_with_scope_should_accept_string_and_hash_join
<add> def test_has_many_through_with_scope_should_accept_string_and_hash_join
<ide> assert_equal authors(:david), Author.joins({ comments_for_first_author: :post }, "inner join posts posts_alias on authors.id = posts_alias.author_id").eager_load(:categories).take
<ide> end
<ide> | 1 |
Python | Python | add sun data | c00dd43fe0ad11f615476725c14fad3faec9b907 | <ide><path>setup.py
<ide> def setup_package():
<ide> name=about['__name__'],
<ide> zip_safe=False,
<ide> packages=PACKAGES,
<del> package_data={'': ['*.pyx', '*.pxd']},
<add> package_data={'': ['*.pyx', '*.pxd', '*.txt', '*.tokens']},
<ide> description=about['__summary__'],
<ide> author=about['__author__'],
<ide> author_email=about['__email__'], | 1 |
Java | Java | support custom headers for multipart async data | 646fcc5c2faf3df5905f7b1b5a62b4abd97a5d34 | <ide><path>spring-web/src/main/java/org/springframework/http/client/MultipartBodyBuilder.java
<ide> /*
<del> * Copyright 2002-2017 the original author or authors.
<add> * Copyright 2002-2018 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> import java.util.Arrays;
<ide> import java.util.List;
<ide> import java.util.Map;
<add>import java.util.function.Consumer;
<ide>
<ide> import org.reactivestreams.Publisher;
<ide>
<ide> public interface PartBuilder {
<ide> * @see HttpHeaders#add(String, String)
<ide> */
<ide> PartBuilder header(String headerName, String... headerValues);
<add>
<add> /**
<add> * Manipulate the part's headers with the given consumer.
<add> * @param headersConsumer a function that consumes the {@code HttpHeaders}
<add> * @return this builder
<add> */
<add> PartBuilder headers(Consumer<HttpHeaders> headersConsumer);
<ide> }
<ide>
<ide>
<ide> public PartBuilder header(String headerName, String... headerValues) {
<ide> return this;
<ide> }
<ide>
<add> @Override
<add> public PartBuilder headers(Consumer<HttpHeaders> headersConsumer) {
<add> Assert.notNull(headersConsumer, "'headersConsumer' must not be null");
<add> headersConsumer.accept(this.headers);
<add> return this;
<add> }
<add>
<ide> public HttpEntity<?> build() {
<ide> return new HttpEntity<>(this.body, this.headers);
<ide> }
<ide><path>spring-web/src/main/java/org/springframework/http/codec/multipart/MultipartHttpMessageWriter.java
<ide> /*
<del> * Copyright 2002-2017 the original author or authors.
<add> * Copyright 2002-2018 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> private Flux<DataBuffer> encodePartValues(byte[] boundary, String name, List<?>
<ide> @SuppressWarnings("unchecked")
<ide> private <T> Flux<DataBuffer> encodePart(byte[] boundary, String name, T value) {
<ide> MultipartHttpOutputMessage outputMessage = new MultipartHttpOutputMessage(this.bufferFactory, getCharset());
<add> HttpHeaders outputHeaders = outputMessage.getHeaders();
<ide>
<ide> T body;
<ide> ResolvableType resolvableType = null;
<ide> if (value instanceof HttpEntity) {
<ide> HttpEntity<T> httpEntity = (HttpEntity<T>) value;
<del> outputMessage.getHeaders().putAll(httpEntity.getHeaders());
<add> outputHeaders.putAll(httpEntity.getHeaders());
<ide> body = httpEntity.getBody();
<ide> Assert.state(body != null, "MultipartHttpMessageWriter only supports HttpEntity with body");
<ide>
<ide> private <T> Flux<DataBuffer> encodePart(byte[] boundary, String name, T value) {
<ide> else {
<ide> body = value;
<ide> }
<del>
<ide> if (resolvableType == null) {
<ide> resolvableType = ResolvableType.forClass(body.getClass());
<ide> }
<ide>
<del> if (body instanceof Resource) {
<del> outputMessage.getHeaders().setContentDispositionFormData(name, ((Resource) body).getFilename());
<del> }
<del> else if (Resource.class.equals(resolvableType.getRawClass())) {
<del> body = (T) Mono.from((Publisher<?>) body).doOnNext(o -> {
<del> outputMessage.getHeaders().setContentDispositionFormData(name, ((Resource) o).getFilename());
<del> });
<del> }
<del> else {
<del> outputMessage.getHeaders().setContentDispositionFormData(name, null);
<add> if (!outputHeaders.containsKey(HttpHeaders.CONTENT_DISPOSITION)) {
<add> if (body instanceof Resource) {
<add> outputHeaders.setContentDispositionFormData(name, ((Resource) body).getFilename());
<add> }
<add> else if (Resource.class.equals(resolvableType.getRawClass())) {
<add> body = (T) Mono.from((Publisher<?>) body).doOnNext(o -> outputHeaders
<add> .setContentDispositionFormData(name, ((Resource) o).getFilename()));
<add> }
<add> else {
<add> outputHeaders.setContentDispositionFormData(name, null);
<add> }
<ide> }
<ide>
<del> MediaType contentType = outputMessage.getHeaders().getContentType();
<add> MediaType contentType = outputHeaders.getContentType();
<ide>
<ide> final ResolvableType finalBodyType = resolvableType;
<ide> Optional<HttpMessageWriter<?>> writer = this.partWriters.stream()
<ide><path>spring-web/src/test/java/org/springframework/http/codec/multipart/MultipartHttpMessageWriterTests.java
<ide> /*
<del> * Copyright 2002-2017 the original author or authors.
<add> * Copyright 2002-2018 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> import org.springframework.core.codec.StringDecoder;
<ide> import org.springframework.core.io.ClassPathResource;
<ide> import org.springframework.core.io.Resource;
<add>import org.springframework.core.io.buffer.DataBuffer;
<add>import org.springframework.core.io.buffer.DataBufferUtils;
<add>import org.springframework.core.io.buffer.DefaultDataBufferFactory;
<ide> import org.springframework.http.HttpEntity;
<ide> import org.springframework.http.MediaType;
<ide> import org.springframework.http.client.MultipartBodyBuilder;
<ide> public void singleSubscriberWithStrings() {
<ide> this.writer.write(result, null, MediaType.MULTIPART_FORM_DATA, response, hints).block();
<ide> }
<ide>
<add> @Test // SPR-16376
<add> public void customContentDisposition() throws IOException {
<add> Resource logo = new ClassPathResource("/org/springframework/http/converter/logo.jpg");
<add> Flux<DataBuffer> buffers = DataBufferUtils.read(logo, new DefaultDataBufferFactory(), 1024);
<add> long contentLength = logo.contentLength();
<add>
<add> MultipartBodyBuilder bodyBuilder = new MultipartBodyBuilder();
<add> bodyBuilder.part("resource", logo)
<add> .headers(h -> h.setContentDispositionFormData("resource", "spring.jpg"));
<add> bodyBuilder.asyncPart("buffers", buffers, DataBuffer.class)
<add> .headers(h -> {
<add> h.setContentDispositionFormData("buffers", "buffers.jpg");
<add> h.setContentType(MediaType.IMAGE_JPEG);
<add> h.setContentLength(contentLength);
<add> });
<add>
<add> MultiValueMap<String, HttpEntity<?>> multipartData = bodyBuilder.build();
<add>
<add> MockServerHttpResponse response = new MockServerHttpResponse();
<add> Map<String, Object> hints = Collections.emptyMap();
<add> this.writer.write(Mono.just(multipartData), null, MediaType.MULTIPART_FORM_DATA, response, hints).block();
<add>
<add> MultiValueMap<String, Part> requestParts = parse(response, hints);
<add> assertEquals(2, requestParts.size());
<add>
<add> Part part = requestParts.getFirst("resource");
<add> assertTrue(part instanceof FilePart);
<add> assertEquals("spring.jpg", ((FilePart) part).filename());
<add> assertEquals(logo.getFile().length(), part.headers().getContentLength());
<add>
<add> part = requestParts.getFirst("buffers");
<add> assertTrue(part instanceof FilePart);
<add> assertEquals("buffers.jpg", ((FilePart) part).filename());
<add> assertEquals(logo.getFile().length(), part.headers().getContentLength());
<add> }
<add>
<ide> private MultiValueMap<String, Part> parse(MockServerHttpResponse response, Map<String, Object> hints) {
<ide> MediaType contentType = response.getHeaders().getContentType();
<ide> assertNotNull("No boundary found", contentType.getParameter("boundary")); | 3 |
Python | Python | expose hyper-param as keyword arg | ded0df5e2f718d0ee3d9f013f3c90d3c867bf97a | <ide><path>spacy/_ml.py
<ide> def uniqued_bwd(dY, sgd=None):
<ide>
<ide>
<ide> def build_text_classifier(nr_class, width=64, **cfg):
<add> nr_vector = cfg.get('nr_vector', 1000)
<ide> with Model.define_operators({'>>': chain, '+': add, '|': concatenate, '**': clone}):
<del> embed_lower = HashEmbed(width, 1000, column=1)
<del> embed_prefix = HashEmbed(width//2, 1000, column=2)
<del> embed_suffix = HashEmbed(width//2, 1000, column=3)
<del> embed_shape = HashEmbed(width//2, 1000, column=4)
<add> embed_lower = HashEmbed(width, nr_vector, column=1)
<add> embed_prefix = HashEmbed(width//2, nr_vector, column=2)
<add> embed_suffix = HashEmbed(width//2, nr_vector, column=3)
<add> embed_shape = HashEmbed(width//2, nr_vector, column=4)
<ide>
<ide> model = (
<ide> FeatureExtracter([ORTH, LOWER, PREFIX, SUFFIX, SHAPE]) | 1 |
PHP | PHP | use undeprecated constants | 3ca24494a1cb682aa06f691e7d54c1951a8da853 | <ide><path>src/Console/CommandRunner.php
<ide> public function run(array $argv, ConsoleIo $io = null)
<ide> list($name, $argv) = $this->longestCommandName($commands, $argv);
<ide> $name = $this->resolveName($commands, $io, $name);
<ide>
<del> $result = Shell::CODE_ERROR;
<add> $result = Command::CODE_ERROR;
<ide> $shell = $this->getShell($io, $commands, $name);
<ide> if ($shell instanceof Shell) {
<ide> $result = $this->runShell($shell, $argv);
<ide> public function run(array $argv, ConsoleIo $io = null)
<ide> }
<ide>
<ide> if ($result === null || $result === true) {
<del> return Shell::CODE_SUCCESS;
<add> return Command::CODE_SUCCESS;
<ide> }
<ide> if (is_int($result)) {
<ide> return $result;
<ide> }
<ide>
<del> return Shell::CODE_ERROR;
<add> return Command::CODE_ERROR;
<ide> }
<ide>
<ide> /** | 1 |
Text | Text | improve docs for api | 722d5d7703b4ac3ee0a9f426b3726e7e90dd9096 | <ide><path>packages/next/README.md
<ide> export default (req, res) => {
<ide>
<ide> - `res` refers to [NextApiResponse](https://github.com/zeit/next.js/blob/v9.0.0/packages/next-server/lib/utils.ts#L168-L178) which extends [http.ServerResponse](https://nodejs.org/api/http.html#http_class_http_serverresponse)
<ide>
<add>For [API routes](#api-routes) there are build in types `NextApiRequest` and `NextApiResponse`, which extend the `Node.js` request and response objects.
<add>
<add>```ts
<add>import { NextApiRequest, NextApiResponse } from 'next'
<add>
<add>export default (req: NextApiRequest, res: NextApiResponse) => {
<add> res.status(200).json({ title: 'Next.js' })
<add>}
<add>```
<add>
<ide> To handle different HTTP methods for API calls you can access `req.method` in your resolver function:
<ide>
<ide> ```js
<ide> Page.getInitialProps = async ({ req }) => {
<ide> export default Page
<ide> ```
<ide>
<del>For [API routes](#api-routes) types, we provide `NextApiRequest` and `NextApiResponse`, which extend the `Node.js` request and response objects.
<del>
<del>```ts
<del>import { NextApiRequest, NextApiResponse } from 'next'
<del>
<del>export default (req: NextApiRequest, res: NextApiResponse) => {
<del> res.status(200).json({ title: 'Next.js' })
<del>```
<del>
<ide> For `React.Component` you can use `NextPageContext`:
<ide>
<ide> ```tsx | 1 |
PHP | PHP | apply fixes from styleci | 1e956837e1f6c4fded69db19ee9e1484d08591f6 | <ide><path>src/Illuminate/Redis/RedisManager.php
<ide> use Illuminate\Redis\Connections\Connection;
<ide> use Illuminate\Redis\Connectors\PhpRedisConnector;
<ide> use Illuminate\Redis\Connectors\PredisConnector;
<del>use Illuminate\Support\ConfigurationUrlParser;
<ide> use Illuminate\Support\Arr;
<add>use Illuminate\Support\ConfigurationUrlParser;
<ide> use InvalidArgumentException;
<ide>
<ide> /**
<ide><path>tests/Redis/RedisConnectorTest.php
<ide> public function testPredisConfigurationWithUsername()
<ide> $this->assertEquals($username, $parameters->username);
<ide> $this->assertEquals($password, $parameters->password);
<ide> }
<del>
<add>
<ide> public function testPredisConfigurationWithSentinel()
<ide> {
<ide> $host = env('REDIS_HOST', '127.0.0.1');
<ide> public function testPredisConfigurationWithSentinel()
<ide> 'parameters' => [
<ide> 'default' => [
<ide> 'database' => 5,
<del> ]
<del> ]
<add> ],
<add> ],
<ide> ],
<ide> 'default' => [
<ide> "tcp://{$host}:{$port}", | 2 |
Javascript | Javascript | improve error message | 5d9163b87d288194fc910a9e0e8aeecc513717a3 | <ide><path>packager/react-packager/src/DependencyResolver/DependencyGraph/ResolutionRequest.js
<ide> class ResolutionRequest {
<ide> throw new UnableToResolveError(
<ide> fromModule,
<ide> toModule,
<del> `Invalid directory ${potentialDirPath}`,
<add>`Invalid directory ${potentialDirPath}
<add>
<add>This might related to https://github.com/facebook/react-native/issues/4968
<add>To resolve try the following:
<add> 1. Clear watchman watches: \`watchman watch-del-all\`.
<add> 2. Delete the \`node_modules\` folder: \`rm -rf node_modules && npm install\`.
<add> 3. Reset packager cache: \`rm -fr $TMPDIR/react-*\` or \`npm start -- --reset-cache\`.`,
<ide> );
<ide> }
<ide> | 1 |
Ruby | Ruby | check bintray mirror urls | 10a235d6abfed687236b14577a02df13a9b5adca | <ide><path>Library/Homebrew/dev-cmd/pull.rb
<ide> def pull
<ide> next
<ide> end
<ide>
<add> if f.stable
<add> stable_urls = [f.stable.url] + f.stable.mirrors
<add> stable_urls.grep(%r{^https://dl.bintray.com/homebrew/mirror/}) do |mirror_url|
<add> check_bintray_mirror(f.full_name, mirror_url)
<add> end
<add> end
<add>
<ide> if ARGV.include? "--bottle"
<ide> if f.bottle_unneeded?
<ide> ohai "#{f}: skipping unneeded bottle."
<ide> def verify_bintray_published(formulae_names)
<ide> end
<ide> end
<ide> end
<add>
<add> def check_bintray_mirror(name, url)
<add> headers = curl_output("--connect-timeout", "15", "--head", url)[0]
<add> status_code = headers.scan(%r{^HTTP\/.* (\d+)}).last.first
<add> return if status_code.start_with?("3")
<add> opoo "The Bintray mirror #{url} is not reachable (HTTP status code #{status_code})."
<add> opoo "Do you need to upload it with `brew mirror #{name}`?"
<add> end
<ide> end | 1 |
Go | Go | remove startcommand function, only used once, and | 7ba9a18ade7393d942d995d34a92d757ef4af0b7 | <ide><path>integration-cli/docker_cli_attach_test.go
<ide> func TestAttachMultipleAndRestart(t *testing.T) {
<ide> t.Fatal(err)
<ide> }
<ide>
<del> if _, err := startCommand(c); err != nil {
<add> if err := c.Start(); err != nil {
<ide> t.Fatal(err)
<ide> }
<ide>
<ide><path>integration-cli/utils.go
<ide> func runCommand(cmd *exec.Cmd) (exitCode int, err error) {
<ide> return
<ide> }
<ide>
<del>func startCommand(cmd *exec.Cmd) (exitCode int, err error) {
<del> exitCode = 0
<del> err = cmd.Start()
<del> exitCode = processExitCode(err)
<del> return
<del>}
<del>
<ide> func logDone(message string) {
<ide> fmt.Printf("[PASSED]: %s\n", message)
<ide> } | 2 |
PHP | PHP | use mocks to make test a bit more durable | dcbc1830ce0a2ee722d5355c3cd245fbf37e08d3 | <ide><path>lib/Cake/Test/TestCase/Utility/DebuggerTest.php
<ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
<ide> */
<ide> namespace Cake\Test\TestCase\Utility;
<add>
<ide> use Cake\Controller\Controller;
<ide> use Cake\Core\Configure;
<add>use Cake\Log\Log;
<ide> use Cake\TestSuite\TestCase;
<ide> use Cake\Utility\Debugger;
<ide> use Cake\View\View;
<ide> public function testExportVar() {
<ide> * @return void
<ide> */
<ide> public function testLog() {
<del> $this->skipIf(!is_writable(LOGS), 'Cannot write to logs dir');
<add> $mock = $this->getMock('Cake\Log\Engine\BaseLog', ['write']);
<add> Log::engine('test', $mock);
<add>
<add> $mock->expects($this->at(0))
<add> ->method('write')
<add> ->with('debug', $this->logicalAnd(
<add> $this->stringContains('DebuggerTest::testLog'),
<add> $this->stringContains('cool')
<add> ));
<add>
<add> $mock->expects($this->at(1))
<add> ->method('write')
<add> ->with('debug', $this->logicalAnd(
<add> $this->stringContains('DebuggerTest::testLog'),
<add> $this->stringContains('[main]'),
<add> $this->stringContains('array'),
<add> $this->stringContains("'whatever',"),
<add> $this->stringContains("'here'")
<add> ));
<ide>
<ide> Debugger::log('cool');
<del> $result = file_get_contents(LOGS . 'debug.log');
<del> $this->assertContains('DebuggerTest::testLog', $result);
<del> $this->assertContains("'cool'", $result);
<del>
<ide> Debugger::log(array('whatever', 'here'));
<del> $result = file_get_contents(LOGS . 'debug.log');
<del> $this->assertContains('DebuggerTest::testLog', $result);
<del> $this->assertContains('[main]', $result);
<del> $this->assertContains('array', $result);
<del> $this->assertContains("'whatever',", $result);
<del> $this->assertContains("'here'", $result);
<add>
<add> Log::drop('test');
<ide> }
<ide>
<ide> /** | 1 |
Go | Go | handle default v4/v6 gw setting | 35693a1a47d14c5d8be427394f6fef8f368a6c91 | <ide><path>libnetwork/drivers/bridge/bridge.go
<ide> type Configuration struct {
<ide> EnableIPForwarding bool
<ide> AllowNonDefaultBridge bool
<ide> Mtu int
<add> DefaultGatewayIPv4 net.IP
<add> DefaultGatewayIPv6 net.IP
<ide> }
<ide>
<ide> // EndpointConfiguration represents the user specified configuration for the sandbox endpoint
<ide> func New() (string, driverapi.Driver) {
<ide> return networkType, &driver{}
<ide> }
<ide>
<add>// Validate performs a static validation on the configuration parameters.
<add>// Whatever can be assessed a priori before attempting any programming.
<add>func (c *Configuration) Validate() error {
<add> if c.Mtu < 0 {
<add> return ErrInvalidMtu
<add> }
<add>
<add> // If bridge v4 subnet is specified
<add> if c.AddressIPv4 != nil {
<add> // If Container restricted subnet is specified, it must be a subset of bridge subnet
<add> if c.FixedCIDR != nil {
<add> // Check Network address
<add> if !c.AddressIPv4.Contains(c.FixedCIDR.IP) {
<add> return ErrInvalidContainerSubnet
<add> }
<add> // Check it is effectively a subset
<add> brNetLen, _ := c.AddressIPv4.Mask.Size()
<add> cnNetLen, _ := c.FixedCIDR.Mask.Size()
<add> if brNetLen > cnNetLen {
<add> return ErrInvalidContainerSubnet
<add> }
<add> }
<add> // If default gw is specified, it must be part of bridge subnet
<add> if c.DefaultGatewayIPv4 != nil {
<add> if !c.AddressIPv4.Contains(c.DefaultGatewayIPv4) {
<add> return ErrInvalidGateway
<add> }
<add> }
<add> }
<add>
<add> // If default v6 gw is specified, FixedCIDRv6 must be specified and gw must belong to FixedCIDRv6 subnet
<add> if c.EnableIPv6 && c.DefaultGatewayIPv6 != nil {
<add> if c.FixedCIDRv6 == nil || !c.FixedCIDRv6.Contains(c.DefaultGatewayIPv6) {
<add> return ErrInvalidGateway
<add> }
<add> }
<add>
<add> return nil
<add>}
<add>
<ide> func (n *bridgeNetwork) getEndpoint(eid types.UUID) (string, *bridgeEndpoint, error) {
<ide> n.Lock()
<ide> defer n.Unlock()
<ide> func (d *driver) Config(option interface{}) error {
<ide> config = opt
<ide> }
<ide>
<add> if err := config.Validate(); err != nil {
<add> return err
<add> }
<add>
<ide> d.config = config
<add>
<ide> return nil
<ide> }
<ide>
<ide> func (d *driver) CreateNetwork(id types.UUID, option interface{}) error {
<ide>
<ide> // Setup IP forwarding.
<ide> {config.EnableIPForwarding, setupIPForwarding},
<add>
<add> // Setup DefaultGatewayIPv4
<add> {config.DefaultGatewayIPv4 != nil, setupGatewayIPv4},
<add>
<add> // Setup DefaultGatewayIPv6
<add> {config.DefaultGatewayIPv6 != nil, setupGatewayIPv6},
<ide> } {
<ide> if step.Condition {
<ide> bridgeSetup.queueStep(step.Fn)
<ide> func (d *driver) CreateEndpoint(nid, eid types.UUID, sboxKey string, epOptions i
<ide> // Try to convert the options to endpoint configuration
<ide> epConfig, err := parseEndpointOptions(epOptions)
<ide> if err != nil {
<add> n.Unlock()
<ide> return nil, err
<ide> }
<ide>
<ide> func (d *driver) CreateEndpoint(nid, eid types.UUID, sboxKey string, epOptions i
<ide>
<ide> // Generate the sandbox info to return
<ide> sinfo := &sandbox.Info{Interfaces: []*sandbox.Interface{intf}}
<del> sinfo.Gateway = n.bridge.bridgeIPv4.IP
<add>
<add> // Set the default gateway(s) for the sandbox
<add> sinfo.Gateway = n.bridge.gatewayIPv4
<ide> if config.EnableIPv6 {
<ide> intf.AddressIPv6 = ipv6Addr
<del> sinfo.GatewayIPv6 = n.bridge.bridgeIPv6.IP
<add> sinfo.GatewayIPv6 = n.bridge.gatewayIPv6
<ide> }
<ide>
<ide> return sinfo, nil
<ide><path>libnetwork/drivers/bridge/bridge_test.go
<ide> func TestCreateLinkWithOptions(t *testing.T) {
<ide> t.Fatalf("Failed to parse and program endpoint configuration")
<ide> }
<ide> }
<add>
<add>func TestValidateConfig(t *testing.T) {
<add>
<add> // Test mtu
<add> c := Configuration{Mtu: -2}
<add> err := c.Validate()
<add> if err == nil {
<add> t.Fatalf("Failed to detect invalid MTU number")
<add> }
<add>
<add> c.Mtu = 9000
<add> err = c.Validate()
<add> if err != nil {
<add> t.Fatalf("unexpected validation error on MTU number")
<add> }
<add>
<add> // Bridge network
<add> _, network, _ := net.ParseCIDR("172.28.0.0/16")
<add>
<add> // Test FixedCIDR
<add> _, containerSubnet, _ := net.ParseCIDR("172.27.0.0/16")
<add> c = Configuration{
<add> AddressIPv4: network,
<add> FixedCIDR: containerSubnet,
<add> }
<add>
<add> err = c.Validate()
<add> if err == nil {
<add> t.Fatalf("Failed to detect invalid FixedCIDR network")
<add> }
<add>
<add> _, containerSubnet, _ = net.ParseCIDR("172.28.0.0/16")
<add> c.FixedCIDR = containerSubnet
<add> err = c.Validate()
<add> if err != nil {
<add> t.Fatalf("Unexpected validation error on FixedCIDR network")
<add> }
<add>
<add> _, containerSubnet, _ = net.ParseCIDR("172.28.0.0/15")
<add> c.FixedCIDR = containerSubnet
<add> err = c.Validate()
<add> if err == nil {
<add> t.Fatalf("Failed to detect invalid FixedCIDR network")
<add> }
<add>
<add> _, containerSubnet, _ = net.ParseCIDR("172.28.0.0/17")
<add> c.FixedCIDR = containerSubnet
<add> err = c.Validate()
<add> if err != nil {
<add> t.Fatalf("Unexpected validation error on FixedCIDR network")
<add> }
<add>
<add> // Test v4 gw
<add> c.DefaultGatewayIPv4 = net.ParseIP("172.27.30.234")
<add> err = c.Validate()
<add> if err == nil {
<add> t.Fatalf("Failed to detect invalid default gateway")
<add> }
<add>
<add> c.DefaultGatewayIPv4 = net.ParseIP("172.28.30.234")
<add> err = c.Validate()
<add> if err != nil {
<add> t.Fatalf("Unexpected validation error on default gateway")
<add> }
<add>
<add> // Test v6 gw
<add> _, containerSubnet, _ = net.ParseCIDR("2001:1234:ae:b004::/64")
<add> c = Configuration{
<add> EnableIPv6: true,
<add> FixedCIDRv6: containerSubnet,
<add> DefaultGatewayIPv6: net.ParseIP("2001:1234:ac:b004::bad:a55"),
<add> }
<add> err = c.Validate()
<add> if err == nil {
<add> t.Fatalf("Failed to detect invalid v6 default gateway")
<add> }
<add>
<add> c.DefaultGatewayIPv6 = net.ParseIP("2001:1234:ae:b004::bad:a55")
<add> err = c.Validate()
<add> if err != nil {
<add> t.Fatalf("Unexpected validation error on v6 default gateway")
<add> }
<add>
<add> c.FixedCIDRv6 = nil
<add> err = c.Validate()
<add> if err == nil {
<add> t.Fatalf("Failed to detect invalid v6 default gateway")
<add> }
<add>}
<add>
<add>func TestSetDefaultGw(t *testing.T) {
<add> defer netutils.SetupTestNetNS(t)()
<add> _, d := New()
<add>
<add> _, subnetv6, _ := net.ParseCIDR("2001:db8:ea9:9abc:b0c4::/80")
<add> gw4 := bridgeNetworks[0].IP.To4()
<add> gw4[3] = 254
<add> gw6 := net.ParseIP("2001:db8:ea9:9abc:b0c4::254")
<add>
<add> config := &Configuration{
<add> BridgeName: DefaultBridgeName,
<add> EnableIPv6: true,
<add> FixedCIDRv6: subnetv6,
<add> DefaultGatewayIPv4: gw4,
<add> DefaultGatewayIPv6: gw6,
<add> }
<add>
<add> if err := d.Config(config); err != nil {
<add> t.Fatalf("Failed to setup driver config: %v", err)
<add> }
<add>
<add> err := d.CreateNetwork("dummy", nil)
<add> if err != nil {
<add> t.Fatalf("Failed to create bridge: %v", err)
<add> }
<add>
<add> sinfo, err := d.CreateEndpoint("dummy", "ep", "sb2", nil)
<add> if err != nil {
<add> t.Fatalf("Failed to create endpoint: %v", err)
<add> }
<add>
<add> if !gw4.Equal(sinfo.Gateway) {
<add> t.Fatalf("Failed to configure default gateway. Expected %v. Found %v", gw4, sinfo.Gateway)
<add> }
<add>
<add> if !gw6.Equal(sinfo.GatewayIPv6) {
<add> t.Fatalf("Failed to configure default gateway. Expected %v. Found %v", gw6, sinfo.GatewayIPv6)
<add> }
<add>}
<ide><path>libnetwork/drivers/bridge/error.go
<ide> var (
<ide>
<ide> // ErrNoIPAddr error is returned when bridge has no IPv4 address configured.
<ide> ErrNoIPAddr = errors.New("bridge has no IPv4 address configured")
<add>
<add> // ErrInvalidGateway is returned when the user provided default gateway (v4/v6) is not not valid.
<add> ErrInvalidGateway = errors.New("default gateway ip must be part of the network")
<add>
<add> // ErrInvalidContainerSubnet is returned when the container subnet (FixedCIDR) is not valid.
<add> ErrInvalidContainerSubnet = errors.New("container subnet must be a subset of bridge network")
<add>
<add> // ErrInvalidMtu is returned when the user provided MTU is not valid
<add> ErrInvalidMtu = errors.New("invalid MTU number")
<ide> )
<ide>
<ide> // ActiveEndpointsError is returned when there are
<ide><path>libnetwork/drivers/bridge/interface.go
<ide> const (
<ide>
<ide> // Interface models the bridge network device.
<ide> type bridgeInterface struct {
<del> Link netlink.Link
<del> bridgeIPv4 *net.IPNet
<del> bridgeIPv6 *net.IPNet
<add> Link netlink.Link
<add> bridgeIPv4 *net.IPNet
<add> bridgeIPv6 *net.IPNet
<add> gatewayIPv4 net.IP
<add> gatewayIPv6 net.IP
<ide> }
<ide>
<ide> // newInterface creates a new bridge interface structure. It attempts to find
<ide><path>libnetwork/drivers/bridge/network_test.go
<ide> func TestLinkCreate(t *testing.T) {
<ide> config := &Configuration{
<ide> BridgeName: DefaultBridgeName,
<ide> Mtu: mtu,
<del> EnableIPv6: true}
<add> EnableIPv6: true,
<add> }
<ide> if err := d.Config(config); err != nil {
<ide> t.Fatalf("Failed to setup driver config: %v", err)
<ide> }
<ide> func TestLinkCreate(t *testing.T) {
<ide> t.Fatalf("IP %s is not a valid ip in the subnet %s", ip6.String(), bridgeIPv6.String())
<ide> }
<ide>
<del> if sinfo.Gateway.String() != n.bridge.bridgeIPv4.IP.String() {
<add> if !sinfo.Gateway.Equal(n.bridge.bridgeIPv4.IP) {
<ide> t.Fatalf("Invalid default gateway. Expected %s. Got %s", n.bridge.bridgeIPv4.IP.String(),
<ide> sinfo.Gateway.String())
<ide> }
<ide>
<del> if sinfo.GatewayIPv6.String() != n.bridge.bridgeIPv6.IP.String() {
<add> if !sinfo.GatewayIPv6.Equal(n.bridge.bridgeIPv6.IP) {
<ide> t.Fatalf("Invalid default gateway for IPv6. Expected %s. Got %s", n.bridge.bridgeIPv6.IP.String(),
<ide> sinfo.GatewayIPv6.String())
<ide> }
<ide><path>libnetwork/drivers/bridge/setup_ipv4.go
<ide> func setupBridgeIPv4(config *Configuration, i *bridgeInterface) error {
<ide> return &IPv4AddrAddError{ip: bridgeIPv4, err: err}
<ide> }
<ide>
<add> // Store bridge network and default gateway
<ide> i.bridgeIPv4 = bridgeIPv4
<add> i.gatewayIPv4 = i.bridgeIPv4.IP
<ide>
<ide> return nil
<ide> }
<ide> func electBridgeIPv4(config *Configuration) (*net.IPNet, error) {
<ide>
<ide> return nil, IPv4AddrRangeError(config.BridgeName)
<ide> }
<add>
<add>func setupGatewayIPv4(config *Configuration, i *bridgeInterface) error {
<add> if !i.bridgeIPv4.Contains(config.DefaultGatewayIPv4) {
<add> return ErrInvalidGateway
<add> }
<add> if _, err := ipAllocator.RequestIP(i.bridgeIPv4, config.DefaultGatewayIPv4); err != nil {
<add> return err
<add> }
<add>
<add> // Store requested default gateway
<add> i.gatewayIPv4 = config.DefaultGatewayIPv4
<add>
<add> return nil
<add>}
<ide><path>libnetwork/drivers/bridge/setup_ipv4_test.go
<ide> func TestSetupBridgeIPv4Auto(t *testing.T) {
<ide> t.Fatalf("Bridge device does not have the automatic IPv4 address %v", bridgeNetworks[0].String())
<ide> }
<ide> }
<add>
<add>func TestSetupGatewayIPv4(t *testing.T) {
<add> defer netutils.SetupTestNetNS(t)()
<add>
<add> ip, nw, _ := net.ParseCIDR("192.168.0.24/16")
<add> nw.IP = ip
<add> gw := net.ParseIP("192.168.0.254")
<add>
<add> config := &Configuration{
<add> BridgeName: DefaultBridgeName,
<add> DefaultGatewayIPv4: gw}
<add>
<add> br := &bridgeInterface{bridgeIPv4: nw}
<add>
<add> if err := setupGatewayIPv4(config, br); err != nil {
<add> t.Fatalf("Set Default Gateway failed: %v", err)
<add> }
<add>
<add> if !gw.Equal(br.gatewayIPv4) {
<add> t.Fatalf("Set Default Gateway failed. Expected %v, Found %v", gw, br.gatewayIPv4)
<add> }
<add>}
<ide><path>libnetwork/drivers/bridge/setup_ipv6.go
<ide> func setupBridgeIPv6(config *Configuration, i *bridgeInterface) error {
<ide> return &IPv6AddrAddError{ip: bridgeIPv6, err: err}
<ide> }
<ide>
<add> // Store bridge network and default gateway
<ide> i.bridgeIPv6 = bridgeIPv6
<add> i.gatewayIPv6 = i.bridgeIPv6.IP
<add>
<add> return nil
<add>}
<add>
<add>func setupGatewayIPv6(config *Configuration, i *bridgeInterface) error {
<add> if config.FixedCIDRv6 == nil {
<add> return ErrInvalidContainerSubnet
<add> }
<add> if !config.FixedCIDRv6.Contains(config.DefaultGatewayIPv6) {
<add> return ErrInvalidGateway
<add> }
<add> if _, err := ipAllocator.RequestIP(config.FixedCIDRv6, config.DefaultGatewayIPv6); err != nil {
<add> return err
<add> }
<add>
<add> // Store requested default gateway
<add> i.gatewayIPv6 = config.DefaultGatewayIPv6
<ide>
<ide> return nil
<ide> }
<ide><path>libnetwork/drivers/bridge/setup_ipv6_test.go
<ide> import (
<ide> "bytes"
<ide> "fmt"
<ide> "io/ioutil"
<add> "net"
<ide> "testing"
<ide>
<ide> "github.com/docker/libnetwork/netutils"
<ide> func TestSetupIPv6(t *testing.T) {
<ide> }
<ide>
<ide> }
<add>
<add>func TestSetupGatewayIPv6(t *testing.T) {
<add> defer netutils.SetupTestNetNS(t)()
<add>
<add> _, nw, _ := net.ParseCIDR("2001:db8:ea9:9abc:ffff::/80")
<add> gw := net.ParseIP("2001:db8:ea9:9abc:ffff::254")
<add>
<add> config := &Configuration{
<add> BridgeName: DefaultBridgeName,
<add> FixedCIDRv6: nw,
<add> DefaultGatewayIPv6: gw}
<add>
<add> br := &bridgeInterface{}
<add>
<add> if err := setupGatewayIPv6(config, br); err != nil {
<add> t.Fatalf("Set Default Gateway failed: %v", err)
<add> }
<add>
<add> if !gw.Equal(br.gatewayIPv6) {
<add> t.Fatalf("Set Default Gateway failed. Expected %v, Found %v", gw, br.gatewayIPv6)
<add> }
<add>} | 9 |
Text | Text | add article for vue.js declarative rendering | 8999a73919a001f68fb7ad2844d60cf22f7b6c7d | <ide><path>client/src/pages/guide/english/vue/declarative-rendering/index.md
<add>---
<add>title: Declarative Rendering
<add>---
<add>
<add>## Instalation
<add>
<add>Before we get started, there are a couple of ways to use Vue.js, namely via CDN and via
<add>installation. For a first experience, it's easier to use the CDN.
<add>
<add>For development, use this:
<add>```html
<add><!-- development version, includes helpful console warnings -->
<add><script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<add>```
<add>
<add>When jumping to production, this:
<add>```html
<add><!-- production version, optimized for size and speed -->
<add><script src="https://cdn.jsdelivr.net/npm/vue"></script>
<add>```
<add>
<add>As mentioned before, you can also install the `vue-cli`, but this is not
<add>recomended for beginners.
<add>
<add>## Declarative Rendering
<add>
<add>Vue.js is a great tool for creating dynamic pages, and a first way to get in
<add>touch with that is what's called Declarative Rendering.
<add>
<add>The use of term "declarative" intends to straighten this concept to
<add>declarative languages, such as SQL: you order something, it's not implied
<add>any implementation. Vue.js allows you to declare what data you want to be
<add>rendered, as simply as that:
<add>
<add>```html
<add><div id="app">
<add> {{ message }}
<add></div>
<add>```
<add>
<add>```javascript
<add>let app = new Vue({
<add> el: '#app',
<add> data: {
<add> message: 'Hello, world!'
<add> }
<add>});
<add>```
<add>
<add>With those snipets, you're telling Vue to dynamically render whatever is stored
<add>inside `message` variable. And the fun: whenever `message` is changed,
<add>Vue.js manages to reload that specific part of the DOM and you see the
<add>change.
<add>
<add>If you want to try this reactivity out, open the console and change de value
<add>of `app.message` to, say, `"Hello from console"`. Did you notice the change in
<add>the page?
<add>
<add>The `{{ ... }}` is the syntax for that behavior: outputting the value
<add>of a variable or of an expression. For instance, this is also a valid use and
<add>will result in `hello`:
<add>
<add>```html
<add><div id="app">
<add> {{ 1 < 2 ? "hello" : "goodbye" }}
<add></div>
<add>```
<add>
<add>There're cases which what we want is to set an attribute using our Vue app's
<add>variable. You might think that the same syntax applies, but Vue has something
<add>specific for that, what we call "binding".
<add>
<add>```html
<add><div id="app">
<add> <a v-bind:href="dynamicLink">This link</a>
<add></div>
<add>```
<add>
<add>```javascript
<add>let app = new Vue({
<add> el: '#app',
<add> data: {
<add> dynamicLink: 'medium.freecodecamp.org'
<add> }
<add>}
<add>```
<add>
<add>The syntax `v-bind` is what Vue.js calls a "directive". It's a way to set a new
<add>attribute to the tag that will be handled by Vue -- there are more
<add>directives, they all begin with `v-`. | 1 |
Go | Go | move "restart" to daemon/restart.go | bd54a73c42760cc94f90df253ecf0818a3006277 | <ide><path>daemon/daemon.go
<ide> func (daemon *Daemon) Install(eng *engine.Engine) error {
<ide> if err := eng.Register("start", daemon.ContainerStart); err != nil {
<ide> return err
<ide> }
<add> if err := eng.Register("restart", daemon.ContainerRestart); err != nil {
<add> return err
<add> }
<ide> return nil
<ide> }
<ide>
<ide><path>daemon/restart.go
<add>package daemon
<add>
<add>import (
<add> "github.com/docker/docker/engine"
<add>)
<add>
<add>func (daemon *Daemon) ContainerRestart(job *engine.Job) engine.Status {
<add> if len(job.Args) != 1 {
<add> return job.Errorf("Usage: %s CONTAINER\n", job.Name)
<add> }
<add> var (
<add> name = job.Args[0]
<add> t = 10
<add> )
<add> if job.EnvExists("t") {
<add> t = job.GetenvInt("t")
<add> }
<add> if container := daemon.Get(name); container != nil {
<add> if err := container.Restart(int(t)); err != nil {
<add> return job.Errorf("Cannot restart container %s: %s\n", name, err)
<add> }
<add> job.Eng.Job("log", "restart", container.ID, daemon.Repositories().ImageName(container.Image)).Run()
<add> } else {
<add> return job.Errorf("No such container: %s\n", name)
<add> }
<add> return engine.StatusOK
<add>}
<ide><path>server/container.go
<ide> func (srv *Server) ContainerCommit(job *engine.Job) engine.Status {
<ide> return engine.StatusOK
<ide> }
<ide>
<del>func (srv *Server) ContainerRestart(job *engine.Job) engine.Status {
<del> if len(job.Args) != 1 {
<del> return job.Errorf("Usage: %s CONTAINER\n", job.Name)
<del> }
<del> var (
<del> name = job.Args[0]
<del> t = 10
<del> )
<del> if job.EnvExists("t") {
<del> t = job.GetenvInt("t")
<del> }
<del> if container := srv.daemon.Get(name); container != nil {
<del> if err := container.Restart(int(t)); err != nil {
<del> return job.Errorf("Cannot restart container %s: %s\n", name, err)
<del> }
<del> srv.LogEvent("restart", container.ID, srv.daemon.Repositories().ImageName(container.Image))
<del> } else {
<del> return job.Errorf("No such container: %s\n", name)
<del> }
<del> return engine.StatusOK
<del>}
<del>
<ide> func (srv *Server) ContainerDestroy(job *engine.Job) engine.Status {
<ide> if len(job.Args) != 1 {
<ide> return job.Errorf("Not enough arguments. Usage: %s CONTAINER\n", job.Name)
<ide><path>server/init.go
<ide> func InitServer(job *engine.Job) engine.Status {
<ide> job.Eng.Hack_SetGlobalVar("httpapi.daemon", srv.daemon)
<ide>
<ide> for name, handler := range map[string]engine.Handler{
<del> "restart": srv.ContainerRestart,
<ide> "wait": srv.ContainerWait,
<ide> "tag": srv.ImageTag, // FIXME merge with "image_tag"
<ide> "resize": srv.ContainerResize, | 4 |
Java | Java | add containskey to servletresponsehttpheaders | 62af99a21c4599576cbdf93e51e0deb131bca4dd | <ide><path>spring-web/src/main/java/org/springframework/http/server/ServletServerHttpResponse.java
<ide> private class ServletResponseHttpHeaders extends HttpHeaders {
<ide>
<ide> private static final long serialVersionUID = 3410708522401046302L;
<ide>
<add> @Override
<add> public boolean containsKey(Object key) {
<add> return (super.containsKey(key) || (get(key) != null));
<add> }
<add>
<ide> @Override
<ide> public String getFirst(String headerName) {
<ide> String value = servletResponse.getHeader(headerName);
<ide><path>spring-web/src/test/java/org/springframework/http/server/ServletServerHttpResponseTests.java
<ide> /*
<del> * Copyright 2002-2014 the original author or authors.
<add> * Copyright 2002-2015 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> package org.springframework.http.server;
<ide>
<ide> import java.nio.charset.Charset;
<del>import java.util.Arrays;
<add>import java.util.Collections;
<ide> import java.util.List;
<ide>
<ide> import org.junit.Before;
<ide> import org.springframework.mock.web.test.MockHttpServletResponse;
<ide> import org.springframework.util.FileCopyUtils;
<ide>
<del>import static org.junit.Assert.*;
<add>import static org.junit.Assert.assertArrayEquals;
<add>import static org.junit.Assert.assertEquals;
<add>import static org.junit.Assert.assertTrue;
<ide>
<ide> /**
<ide> * @author Arjen Poutsma
<add> * @author Rossen Stoyanchev
<ide> */
<ide> public class ServletServerHttpResponseTests {
<ide>
<ide> private ServletServerHttpResponse response;
<ide>
<ide> private MockHttpServletResponse mockResponse;
<ide>
<add>
<ide> @Before
<ide> public void create() throws Exception {
<ide> mockResponse = new MockHttpServletResponse();
<ide> response = new ServletServerHttpResponse(mockResponse);
<ide> }
<ide>
<add>
<ide> @Test
<ide> public void setStatusCode() throws Exception {
<ide> response.setStatusCode(HttpStatus.NOT_FOUND);
<ide> public void getHeaders() throws Exception {
<ide> }
<ide>
<ide> @Test
<del> public void getHeadersFromHttpServletResponse() {
<add> public void preExistingHeadersFromHttpServletResponse() {
<ide>
<ide> String headerName = "Access-Control-Allow-Origin";
<ide> String headerValue = "localhost:8080";
<ide> public void getHeadersFromHttpServletResponse() {
<ide> this.response = new ServletServerHttpResponse(this.mockResponse);
<ide>
<ide> assertEquals(headerValue, this.response.getHeaders().getFirst(headerName));
<del> assertEquals(Arrays.asList(headerValue), this.response.getHeaders().get(headerName));
<add> assertEquals(Collections.singletonList(headerValue), this.response.getHeaders().get(headerName));
<add> assertTrue(this.response.getHeaders().containsKey(headerName));
<ide> }
<ide>
<ide> @Test | 2 |
Python | Python | add file for misc tests | 012ea594d171041a9ff064783b7c0a392a827d4c | <ide><path>spacy/tests/test_misc.py
<add># coding: utf-8
<add>from __future__ import unicode_literals
<add>
<add>from ..util import ensure_path
<add>
<add>from pathlib import Path
<add>import pytest
<add>
<add>
<add>@pytest.mark.parametrize('text', ['hello/world', 'hello world'])
<add>def test_util_ensure_path_succeeds(text):
<add> path = ensure_path(text)
<add> assert isinstance(path, Path)
<add>
<add>
<add>@pytest.mark.parametrize('text', [b'hello/world', True, False, None])
<add>def test_util_ensure_path_fails(text):
<add> path = ensure_path(text)
<add> assert not isinstance(path, Path) | 1 |
PHP | PHP | add data + options into aftermarshal | ca90a710af01fd62c42d3d4abacd17653fd4c5c7 | <ide><path>src/ORM/Marshaller.php
<ide> public function one(array $data, array $options = []): EntityInterface
<ide> }
<ide>
<ide> $entity->setErrors($errors);
<del> $this->_table->dispatchEvent('Model.afterMarshal', compact('entity'));
<add> $this->dispatchAfterMarshal($entity, $data, $options);
<ide>
<ide> return $entity;
<ide> }
<ide> public function merge(EntityInterface $entity, array $data, array $options = [])
<ide> $entity->setDirty($field, $value->isDirty());
<ide> }
<ide> }
<del> $this->_table->dispatchEvent('Model.afterMarshal', compact('entity'));
<add> $this->dispatchAfterMarshal($entity, $data, $options);
<ide>
<ide> return $entity;
<ide> }
<ide> public function merge(EntityInterface $entity, array $data, array $options = [])
<ide> $entity->setDirty($field, $properties[$field]->isDirty());
<ide> }
<ide> }
<del> $this->_table->dispatchEvent('Model.afterMarshal', compact('entity'));
<add> $this->dispatchAfterMarshal($entity, $data, $options);
<ide>
<ide> return $entity;
<ide> }
<ide> protected function _mergeJoinData(array $original, BelongsToMany $assoc, array $
<ide>
<ide> return $records;
<ide> }
<add>
<add> /**
<add> * dispatch Model.afterMarshal event.
<add> *
<add> * @param \Cake\Datasource\EntityInterface $entity The entity that was marshaled.
<add> * @param array $data readOnly $data to use.
<add> * @param array $options List of options that are readOnly.
<add> * @return void
<add> */
<add> protected function dispatchAfterMarshal(EntityInterface $entity, array $data, array $options = []): void
<add> {
<add> $data = new ArrayObject($data);
<add> $options = new ArrayObject($options);
<add> $this->_table->dispatchEvent('Model.afterMarshal', compact('entity', 'data', 'options'));
<add> }
<ide> } | 1 |
Text | Text | clarify instructions to remove confusion | db15a44160d9690f826101065603e77ede82aa34 | <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.english.md
<ide> Note that we do <em>not</em> use quotes around the variable name when using it t
<ide>
<ide> ## Instructions
<ide> <section id='instructions'>
<del>Use the <code>playerNumber</code> variable to look up player <code>16</code> in <code>testObj</code> using bracket notation. Then assign that name to the <code>player</code> variable.
<add>Set the <code>playerNumber</code> variable to <code>16</code>. Then, use the variable to look up the player's name and assign it to <code>player</code>.
<ide> </section>
<ide>
<ide> ## Tests | 1 |
Text | Text | fix typos in deprecation doc | ea3dcee913d5c76984354340239f97a725035e88 | <ide><path>docs/misc/deprecated.md
<ide> are deprecated and replaced with double-dash options (`--opt`):
<ide> docker search -trusted
<ide> docker tag -force
<ide>
<del>The following single-dash options are deprecated and have no replacement:
<add>The following double-dash options are deprecated and have no replacement:
<ide>
<ide> docker run --networking
<ide> docker ps --since-id
<ide><path>docs/misc/index.md
<ide> on the separate [Release Notes page](/release-notes/)
<ide> ## Feature Deprecation Policy
<ide>
<ide> As changes are made to Docker there may be times when existing features
<del>will need to be removed or replace with newer features. Before an existing
<add>will need to be removed or replaced with newer features. Before an existing
<ide> feature is removed it will be labeled as "deprecated" within the documentation
<ide> and will remain in Docker for, usually, at least 2 releases. After that time
<ide> it may be removed. | 2 |
Java | Java | fix cleanup bug | e171c2b92aa5cfe4634edb64c3cd7c9ab6167ce7 | <ide><path>ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/TurboModuleManager.java
<ide> public List<String> getEagerInitModuleNames() {
<ide> return mEagerInitModuleNames;
<ide> }
<ide>
<add> @DoNotStrip
<add> @Nullable
<add> private CxxModuleWrapper getLegacyCxxModule(String moduleName) {
<add> final TurboModule turboModule = getModule(moduleName);
<add> if (!(turboModule instanceof CxxModuleWrapper)) {
<add> return null;
<add> }
<add>
<add> return (CxxModuleWrapper) turboModule;
<add> }
<add>
<add> @DoNotStrip
<add> @Nullable
<add> private TurboModule getJavaModule(String moduleName) {
<add> final TurboModule turboModule = getModule(moduleName);
<add> if (turboModule instanceof CxxModuleWrapper) {
<add> return null;
<add> }
<add>
<add> return turboModule;
<add> }
<add>
<ide> /**
<del> * TurboModuleHolders are used as locks to ensure that when n threads race to create a
<del> * TurboModule, only the first thread creates that TurboModule. All other n - 1 threads wait until
<del> * the TurboModule is created and initialized.
<add> * Return the TurboModule instance that corresponds to the provided moduleName.
<add> *
<add> * <p>This method: - Creates and initializes the module if it doesn't already exist. - Returns
<add> * null after TurboModuleManager has been torn down.
<ide> */
<ide> @Nullable
<del> private TurboModuleHolder getOrMaybeCreateTurboModuleHolder(String moduleName) {
<add> public TurboModule getModule(String moduleName) {
<add> TurboModuleHolder moduleHolder;
<add>
<ide> synchronized (mTurboModuleCleanupLock) {
<ide> if (mTurboModuleCleanupStarted) {
<ide> /*
<ide> private TurboModuleHolder getOrMaybeCreateTurboModuleHolder(String moduleName) {
<ide> if (!mTurboModuleHolders.containsKey(moduleName)) {
<ide> mTurboModuleHolders.put(moduleName, new TurboModuleHolder());
<ide> }
<del> return mTurboModuleHolders.get(moduleName);
<add>
<add> moduleHolder = mTurboModuleHolders.get(moduleName);
<ide> }
<add>
<add> return getModule(moduleName, moduleHolder);
<ide> }
<ide>
<ide> /**
<del> * If n threads race to create TurboModule x, then only the first thread should create x. All n -
<del> * 1 other threads should wait until x is created and initialized.
<add> * Given a TurboModuleHolder, and the TurboModule's moduleName, return the TurboModule instance.
<ide> *
<del> * <p>Note: After we've started cleanup, getModule will always return null.
<add> * <p>Use the TurboModuleHolder to ensure that if n threads race to create TurboModule x, then
<add> * only the first thread creates x. All n - 1 other threads wait until the x is created and
<add> * initialized.
<ide> */
<ide> @Nullable
<del> public TurboModule getModule(String moduleName) {
<del> final TurboModuleHolder moduleHolder = getOrMaybeCreateTurboModuleHolder(moduleName);
<del>
<del> if (moduleHolder == null) {
<del> return null;
<del> }
<del>
<add> private TurboModule getModule(String moduleName, @NonNull TurboModuleHolder moduleHolder) {
<ide> boolean shouldCreateModule = false;
<ide>
<ide> synchronized (moduleHolder) {
<ide> public TurboModule getModule(String moduleName) {
<ide> }
<ide> }
<ide>
<del> @DoNotStrip
<del> @Nullable
<del> private CxxModuleWrapper getLegacyCxxModule(String moduleName) {
<del> final TurboModule turboModule = getModule(moduleName);
<del> if (!(turboModule instanceof CxxModuleWrapper)) {
<del> return null;
<del> }
<del>
<del> return (CxxModuleWrapper) turboModule;
<del> }
<del>
<del> @DoNotStrip
<del> @Nullable
<del> private TurboModule getJavaModule(String moduleName) {
<del> final TurboModule turboModule = getModule(moduleName);
<del> if (turboModule instanceof CxxModuleWrapper) {
<del> return null;
<del> }
<del>
<del> return turboModule;
<del> }
<del>
<ide> /** Which TurboModules have been created? */
<ide> public Collection<TurboModule> getModules() {
<ide> final List<TurboModuleHolder> turboModuleHolders = new ArrayList<>();
<ide> public void onCatalystInstanceDestroy() {
<ide> mTurboModuleCleanupStarted = true;
<ide> }
<ide>
<del> final Set<String> turboModuleNames = new HashSet<>(mTurboModuleHolders.keySet());
<add> for (final Map.Entry<String, TurboModuleHolder> moduleHolderEntry :
<add> mTurboModuleHolders.entrySet()) {
<add> final String moduleName = moduleHolderEntry.getKey();
<add> final TurboModuleHolder moduleHolder = moduleHolderEntry.getValue();
<ide>
<del> for (final String moduleName : turboModuleNames) {
<del> // Retrieve the TurboModule, possibly waiting for it to finish instantiating.
<del> final TurboModule turboModule = getModule(moduleName);
<add> /**
<add> * ReactNative could start tearing down before this particular TurboModule has been fully
<add> * initialized. In this case, we should wait for initialization to complete, before destroying
<add> * the TurboModule.
<add> */
<add> final TurboModule turboModule = getModule(moduleName, moduleHolder);
<ide>
<ide> if (turboModule != null) {
<ide> // TODO(T48014458): Rename this to invalidate() | 1 |
PHP | PHP | return entire string if search is not found | 4c4810a4192d764cea26f150b49d2a1c828488dd | <ide><path>src/Illuminate/Support/Str.php
<ide> class Str
<ide> public static function after($subject, $search)
<ide> {
<ide> if (! static::contains($subject, $search)) {
<del> return '';
<add> return $subject;
<ide> }
<ide>
<ide> $searchEndPos = strpos($subject, $search) + static::length($search);
<ide><path>tests/Support/SupportHelpersTest.php
<ide> public function testStrAfter()
<ide> {
<ide> $this->assertEquals('nah', str_after('hannah', 'han'));
<ide> $this->assertEquals('nah', str_after('hannah', 'n'));
<del> $this->assertEmpty(str_after('hannah', 'xxxx'));
<add> $this->assertEquals('hannah', str_after('hannah', 'xxxx'));
<ide> }
<ide>
<ide> public function testStrContains()
<ide><path>tests/Support/SupportStrTest.php
<ide> public function testStrAfter()
<ide> {
<ide> $this->assertEquals('nah', Str::after('hannah', 'han'));
<ide> $this->assertEquals('nah', Str::after('hannah', 'n'));
<del> $this->assertEmpty(Str::after('hannah', 'xxxx'));
<add> $this->assertEquals('hannah', Str::after('hannah', 'xxxx'));
<ide> }
<ide>
<ide> public function testStrContains() | 3 |
Ruby | Ruby | add notibility checks for casks | 3567892802a19870a1a7ec514c895af3e53de8e2 | <ide><path>Library/Homebrew/cask/audit.rb
<ide> require "digest"
<ide> require "utils/curl"
<ide> require "utils/git"
<add>require "utils/notability"
<ide>
<ide> module Cask
<ide> class Audit
<ide> class Audit
<ide>
<ide> attr_reader :cask, :commit_range, :download
<ide>
<del> attr_predicate :check_appcast?
<add> attr_predicate :appcast?
<ide>
<del> def initialize(cask, check_appcast: false, download: false, check_token_conflicts: false,
<del> commit_range: nil, command: SystemCommand)
<add> def initialize(cask, appcast: false, download: false,
<add> token_conflicts: false, online: false, strict: false,
<add> new_cask: false, commit_range: nil, command: SystemCommand)
<ide> @cask = cask
<del> @check_appcast = check_appcast
<add> @appcast = appcast
<ide> @download = download
<add> @online = online
<add> @strict = strict
<add> @new_cask = new_cask
<ide> @commit_range = commit_range
<del> @check_token_conflicts = check_token_conflicts
<add> @token_conflicts = token_conflicts
<ide> @command = command
<ide> end
<ide>
<del> def check_token_conflicts?
<del> @check_token_conflicts
<del> end
<del>
<ide> def run!
<ide> check_blacklist
<ide> check_required_stanzas
<ide> def run!
<ide> check_latest_with_auto_updates
<ide> check_stanza_requires_uninstall
<ide> check_appcast_contains_version
<add> check_github_repository
<add> check_gitlab_repository
<add> check_bitbucket_repository
<ide> self
<ide> rescue => e
<ide> odebug "#{e.message}\n#{e.backtrace.join("\n")}"
<ide> def check_generic_artifacts
<ide> end
<ide>
<ide> def check_token_conflicts
<del> return unless check_token_conflicts?
<add> return unless @token_conflicts
<ide> return unless core_formula_names.include?(cask.token)
<ide>
<ide> add_warning "possible duplicate, cask token conflicts with Homebrew core formula: #{core_formula_url}"
<ide> def check_download
<ide> end
<ide>
<ide> def check_appcast_contains_version
<del> return unless check_appcast?
<add> return unless appcast?
<ide> return if cask.appcast.to_s.empty?
<ide> return if cask.appcast.configuration == :no_check
<ide>
<ide> def check_appcast_contains_version
<ide> add_error "appcast at URL '#{appcast_stanza}' offline or looping"
<ide> end
<ide>
<add> def check_github_repository
<add> user, repo = get_repo_data(%r{https?://github\.com/([^/]+)/([^/]+)/?.*})
<add> return if user.nil?
<add>
<add> odebug "Auditing GitHub repo"
<add>
<add> error = SharedAudits.github(user, repo)
<add> add_error error if error
<add> end
<add>
<add> def check_gitlab_repository
<add> user, repo = get_repo_data(%r{https?://gitlab\.com/([^/]+)/([^/]+)/?.*})
<add> return if user.nil?
<add>
<add> odebug "Auditing GitLab repo"
<add>
<add> error = SharedAudits.gitlab(user, repo)
<add> add_error error if error
<add> end
<add>
<add> def check_bitbucket_repository
<add> user, repo = get_repo_data(%r{https?://bitbucket\.org/([^/]+)/([^/]+)/?.*})
<add> return if user.nil?
<add>
<add> odebug "Auditing Bitbucket repo"
<add>
<add> error = SharedAudits.bitbucket(user, repo)
<add> add_error error if error
<add> end
<add>
<add> def get_repo_data(regex)
<add> return unless @online
<add> return unless @new_cask
<add>
<add> _, user, repo = *regex.match(cask.url.to_s)
<add> _, user, repo = *regex.match(cask.homepage) unless user
<add> _, user, repo = *regex.match(cask.appcast.to_s) unless user
<add> return if !user || !repo
<add>
<add> repo.gsub!(/.git$/, "")
<add>
<add> [user, repo]
<add> end
<add>
<ide> def check_blacklist
<ide> return if cask.tap&.user != "Homebrew"
<ide> return unless reason = Blacklist.blacklisted_reason(cask.token)
<ide><path>Library/Homebrew/cask/auditor.rb
<ide> class Auditor
<ide> extend Predicable
<ide>
<ide> def self.audit(cask, audit_download: false, audit_appcast: false,
<del> check_token_conflicts: false, quarantine: true, commit_range: nil)
<add> audit_online: false, audit_strict: false,
<add> audit_token_conflicts: false, audit_new_cask: false,
<add> quarantine: true, commit_range: nil)
<ide> new(cask, audit_download: audit_download,
<ide> audit_appcast: audit_appcast,
<del> check_token_conflicts: check_token_conflicts,
<add> audit_online: audit_online,
<add> audit_new_cask: audit_new_cask,
<add> audit_strict: audit_strict,
<add> audit_token_conflicts: audit_token_conflicts,
<ide> quarantine: quarantine, commit_range: commit_range).audit
<ide> end
<ide>
<ide> attr_reader :cask, :commit_range
<ide>
<ide> def initialize(cask, audit_download: false, audit_appcast: false,
<del> check_token_conflicts: false, quarantine: true, commit_range: nil)
<add> audit_online: false, audit_strict: false,
<add> audit_token_conflicts: false, audit_new_cask: false,
<add> quarantine: true, commit_range: nil)
<ide> @cask = cask
<ide> @audit_download = audit_download
<ide> @audit_appcast = audit_appcast
<add> @audit_online = audit_online
<add> @audit_strict = audit_strict
<add> @audit_new_cask = audit_new_cask
<ide> @quarantine = quarantine
<ide> @commit_range = commit_range
<del> @check_token_conflicts = check_token_conflicts
<add> @audit_token_conflicts = audit_token_conflicts
<ide> end
<ide>
<del> def audit_download?
<del> @audit_download
<del> end
<del>
<del> attr_predicate :audit_appcast?, :quarantine?
<del>
<del> def check_token_conflicts?
<del> @check_token_conflicts
<del> end
<add> attr_predicate :audit_appcast?, :audit_download?, :audit_online?,
<add> :audit_strict?, :audit_new_cask?, :audit_token_conflicts?, :quarantine?
<ide>
<ide> def audit
<ide> if !Homebrew.args.value("language") && language_blocks
<ide> def audit_languages(languages)
<ide>
<ide> def audit_cask_instance(cask)
<ide> download = audit_download? && Download.new(cask, quarantine: quarantine?)
<del> audit = Audit.new(cask, check_appcast: audit_appcast?,
<del> download: download,
<del> check_token_conflicts: check_token_conflicts?,
<del> commit_range: commit_range)
<add> audit = Audit.new(cask, appcast: audit_appcast?,
<add> online: audit_online?,
<add> strict: audit_strict?,
<add> new_cask: audit_new_cask?,
<add> token_conflicts: audit_token_conflicts?,
<add> download: download,
<add> commit_range: commit_range)
<ide> audit.run!
<ide> puts audit.summary
<ide> audit.success?
<ide><path>Library/Homebrew/cask/cmd/audit.rb
<ide> # frozen_string_literal: true
<ide>
<add>require "cli/parser"
<add>
<ide> module Cask
<ide> class Cmd
<ide> class Audit < AbstractCommand
<del> option "--download", :download, false
<del> option "--appcast", :appcast, false
<del> option "--token-conflicts", :token_conflicts, false
<add> option "--download", :download_arg, false
<add> option "--appcast", :appcast_arg, false
<add> option "--token-conflicts", :token_conflicts_arg, false
<add> option "--strict", :strict_arg, false
<add> option "--online", :online_arg, false
<add> option "--new-cask", :new_cask_arg, false
<add>
<add> def self.usage
<add> <<~EOS
<add> `cask audit` [<options>] [<cask>]
<add>
<add> --strict - Run additional, stricter style checks.
<add> --online - Run additional, slower style checks that require a network connection.
<add> --new-cask - Run various additional style checks to determine if a new cask is eligible
<add> for Homebrew. This should be used when creating new casks and implies
<add> `--strict` and `--online`.
<add> --download - Audit the downloaded file
<add> --appcast - Audit the appcast
<add> --token-conflicts - Audit for token conflicts
<add>
<add> Check <cask> for Homebrew coding style violations. This should be run before
<add> submitting a new cask. If no <casks> are provided, check all locally
<add> available casks. Will exit with a non-zero status if any errors are
<add> found, which can be useful for implementing pre-commit hooks.
<add> EOS
<add> end
<ide>
<ide> def self.help
<ide> "verifies installability of Casks"
<ide> end
<ide>
<ide> def run
<add> Homebrew.auditing = true
<add> strict = new_cask_arg? || strict_arg?
<add> token_conflicts = strict || token_conflicts_arg?
<add>
<add> online = new_cask_arg? || online_arg?
<add> download = online || download_arg?
<add> appcast = online || appcast_arg?
<add>
<ide> failed_casks = casks(alternative: -> { Cask.to_a })
<del> .reject { |cask| audit(cask) }
<add> .reject do |cask|
<add> odebug "Auditing Cask #{cask}"
<add> Auditor.audit(cask, audit_download: download,
<add> audit_appcast: appcast,
<add> audit_online: online,
<add> audit_strict: strict,
<add> audit_new_cask: new_cask_arg?,
<add> audit_token_conflicts: token_conflicts,
<add> quarantine: quarantine?)
<add> end
<ide>
<ide> return if failed_casks.empty?
<ide>
<ide> raise CaskError, "audit failed for casks: #{failed_casks.join(" ")}"
<ide> end
<del>
<del> def audit(cask)
<del> odebug "Auditing Cask #{cask}"
<del> Auditor.audit(cask, audit_download: download?,
<del> audit_appcast: appcast?,
<del> check_token_conflicts: token_conflicts?,
<del> quarantine: quarantine?)
<del> end
<ide> end
<ide> end
<ide> end
<ide><path>Library/Homebrew/dev-cmd/audit.rb
<ide> require "formula"
<ide> require "formula_versions"
<ide> require "utils/curl"
<add>require "utils/notability"
<ide> require "extend/ENV"
<ide> require "formula_cellar_checks"
<ide> require "cmd/search"
<ide> def audit_github_repository
<ide> user, repo = get_repo_data(%r{https?://github\.com/([^/]+)/([^/]+)/?.*})
<ide> return if user.nil?
<ide>
<del> begin
<del> metadata = GitHub.repository(user, repo)
<del> rescue GitHub::HTTPNotFoundError
<del> return
<del> end
<del>
<del> return if metadata.nil?
<del>
<del> new_formula_problem "GitHub fork (not canonical repository)" if metadata["fork"]
<del> if (metadata["forks_count"] < 30) && (metadata["subscribers_count"] < 30) &&
<del> (metadata["stargazers_count"] < 75)
<del> new_formula_problem "GitHub repository not notable enough (<30 forks, <30 watchers and <75 stars)"
<del> end
<add> warning = SharedAudits.github(user, repo)
<add> return if warning.nil?
<ide>
<del> return if Date.parse(metadata["created_at"]) <= (Date.today - 30)
<del>
<del> new_formula_problem "GitHub repository too new (<30 days old)"
<add> new_formula_problem warning
<ide> end
<ide>
<ide> def audit_gitlab_repository
<ide> user, repo = get_repo_data(%r{https?://gitlab\.com/([^/]+)/([^/]+)/?.*})
<ide> return if user.nil?
<ide>
<del> out, _, status= curl_output("--request", "GET", "https://gitlab.com/api/v4/projects/#{user}%2F#{repo}")
<del> return unless status.success?
<del>
<del> metadata = JSON.parse(out)
<del> return if metadata.nil?
<del>
<del> new_formula_problem "GitLab fork (not canonical repository)" if metadata["fork"]
<del> if (metadata["forks_count"] < 30) && (metadata["star_count"] < 75)
<del> new_formula_problem "GitLab repository not notable enough (<30 forks and <75 stars)"
<del> end
<del>
<del> return if Date.parse(metadata["created_at"]) <= (Date.today - 30)
<add> warning = SharedAudits.gitlab(user, repo)
<add> return if warning.nil?
<ide>
<del> new_formula_problem "GitLab repository too new (<30 days old)"
<add> new_formula_problem warning
<ide> end
<ide>
<ide> def audit_bitbucket_repository
<ide> user, repo = get_repo_data(%r{https?://bitbucket\.org/([^/]+)/([^/]+)/?.*})
<ide> return if user.nil?
<ide>
<del> api_url = "https://api.bitbucket.org/2.0/repositories/#{user}/#{repo}"
<del> out, _, status= curl_output("--request", "GET", api_url)
<del> return unless status.success?
<del>
<del> metadata = JSON.parse(out)
<del> return if metadata.nil?
<del>
<del> new_formula_problem "Uses deprecated mercurial support in Bitbucket" if metadata["scm"] == "hg"
<del>
<del> new_formula_problem "Bitbucket fork (not canonical repository)" unless metadata["parent"].nil?
<del>
<del> if Date.parse(metadata["created_on"]) >= (Date.today - 30)
<del> new_formula_problem "Bitbucket repository too new (<30 days old)"
<del> end
<del>
<del> forks_out, _, forks_status= curl_output("--request", "GET", "#{api_url}/forks")
<del> return unless forks_status.success?
<del>
<del> watcher_out, _, watcher_status= curl_output("--request", "GET", "#{api_url}/watchers")
<del> return unless watcher_status.success?
<del>
<del> forks_metadata = JSON.parse(forks_out)
<del> return if forks_metadata.nil?
<del>
<del> watcher_metadata = JSON.parse(watcher_out)
<del> return if watcher_metadata.nil?
<del>
<del> return if (forks_metadata["size"] < 30) && (watcher_metadata["size"] < 75)
<add> warning = SharedAudits.bitbucket(user, repo)
<add> return if warning.nil?
<ide>
<del> new_formula_problem "Bitbucket repository not notable enough (<30 forks and <75 watchers)"
<add> new_formula_problem warning
<ide> end
<ide>
<ide> def get_repo_data(regex)
<ide><path>Library/Homebrew/test/cask/audit_spec.rb
<ide> def include_msg?(messages, msg)
<ide>
<ide> let(:cask) { instance_double(Cask::Cask) }
<ide> let(:download) { false }
<del> let(:check_token_conflicts) { false }
<add> let(:token_conflicts) { false }
<ide> let(:fake_system_command) { class_double(SystemCommand) }
<ide> let(:audit) {
<del> described_class.new(cask, download: download,
<del> check_token_conflicts: check_token_conflicts,
<del> command: fake_system_command)
<add> described_class.new(cask, download: download,
<add> token_conflicts: token_conflicts,
<add> command: fake_system_command)
<ide> }
<ide>
<ide> describe "#result" do
<ide> def include_msg?(messages, msg)
<ide>
<ide> describe "token conflicts" do
<ide> let(:cask_token) { "with-binary" }
<del> let(:check_token_conflicts) { true }
<add> let(:token_conflicts) { true }
<ide>
<ide> context "when cask token conflicts with a core formula" do
<ide> let(:formula_names) { %w[with-binary other-formula] }
<ide><path>Library/Homebrew/test/cask/cmd/audit_spec.rb
<ide> expect(Cask::CaskLoader).to receive(:load).with(cask_token).and_return(cask)
<ide>
<ide> expect(Cask::Auditor).to receive(:audit)
<del> .with(cask, audit_download: false, audit_appcast: false, check_token_conflicts: false, quarantine: true)
<add> .with(cask, audit_download: false,
<add> audit_appcast: false,
<add> audit_token_conflicts: false,
<add> audit_new_cask: false,
<add> audit_online: false,
<add> audit_strict: false,
<add> quarantine: true)
<ide> .and_return(true)
<ide>
<ide> described_class.run(cask_token)
<ide> it "does not download the Cask per default" do
<ide> allow(Cask::CaskLoader).to receive(:load).and_return(cask)
<ide> expect(Cask::Auditor).to receive(:audit)
<del> .with(cask, audit_download: false, audit_appcast: false, check_token_conflicts: false, quarantine: true)
<add> .with(cask, audit_download: false,
<add> audit_appcast: false,
<add> audit_token_conflicts: false,
<add> audit_new_cask: false,
<add> audit_online: false,
<add> audit_strict: false,
<add> quarantine: true)
<ide> .and_return(true)
<ide>
<ide> described_class.run("casktoken")
<ide> it "download a Cask if --download flag is set" do
<ide> allow(Cask::CaskLoader).to receive(:load).and_return(cask)
<ide> expect(Cask::Auditor).to receive(:audit)
<del> .with(cask, audit_download: true, audit_appcast: false, check_token_conflicts: false, quarantine: true)
<add> .with(cask, audit_download: true,
<add> audit_appcast: false,
<add> audit_token_conflicts: false,
<add> audit_new_cask: false,
<add> audit_online: false,
<add> audit_strict: false,
<add> quarantine: true)
<ide> .and_return(true)
<ide>
<ide> described_class.run("casktoken", "--download")
<ide> it "does not check for token conflicts per default" do
<ide> allow(Cask::CaskLoader).to receive(:load).and_return(cask)
<ide> expect(Cask::Auditor).to receive(:audit)
<del> .with(cask, audit_download: false, audit_appcast: false, check_token_conflicts: false, quarantine: true)
<add> .with(cask, audit_download: false,
<add> audit_appcast: false,
<add> audit_token_conflicts: false,
<add> audit_new_cask: false,
<add> audit_online: false,
<add> audit_strict: false,
<add> quarantine: true)
<ide> .and_return(true)
<ide>
<ide> described_class.run("casktoken")
<ide> it "checks for token conflicts if --token-conflicts flag is set" do
<ide> allow(Cask::CaskLoader).to receive(:load).and_return(cask)
<ide> expect(Cask::Auditor).to receive(:audit)
<del> .with(cask, audit_download: false, audit_appcast: false, check_token_conflicts: true, quarantine: true)
<add> .with(cask, audit_download: false,
<add> audit_appcast: false,
<add> audit_token_conflicts: true,
<add> audit_new_cask: false,
<add> audit_online: false,
<add> audit_strict: false,
<add> quarantine: true)
<ide> .and_return(true)
<ide>
<ide> described_class.run("casktoken", "--token-conflicts")
<ide> end
<ide> end
<add>
<add> describe "rules for checking strictly" do
<add> it "does not check strictly per default" do
<add> allow(Cask::CaskLoader).to receive(:load).and_return(cask)
<add> expect(Cask::Auditor).to receive(:audit)
<add> .with(cask, audit_download: false,
<add> audit_appcast: false,
<add> audit_token_conflicts: false,
<add> audit_new_cask: false,
<add> audit_online: false,
<add> audit_strict: false,
<add> quarantine: true)
<add> .and_return(true)
<add>
<add> described_class.run("casktoken")
<add> end
<add>
<add> it "checks strictly if --strict flag is set" do
<add> allow(Cask::CaskLoader).to receive(:load).and_return(cask)
<add> expect(Cask::Auditor).to receive(:audit)
<add> .with(cask, audit_download: false,
<add> audit_appcast: false,
<add> audit_token_conflicts: true,
<add> audit_new_cask: false,
<add> audit_online: false,
<add> audit_strict: true,
<add> quarantine: true)
<add> .and_return(true)
<add>
<add> described_class.run("casktoken", "--strict")
<add> end
<add> end
<add>
<add> describe "rules for checking online" do
<add> it "does not check online per default" do
<add> allow(Cask::CaskLoader).to receive(:load).and_return(cask)
<add> expect(Cask::Auditor).to receive(:audit)
<add> .with(cask, audit_download: false,
<add> audit_appcast: false,
<add> audit_token_conflicts: false,
<add> audit_new_cask: false,
<add> audit_online: false,
<add> audit_strict: false,
<add> quarantine: true)
<add> .and_return(true)
<add>
<add> described_class.run("casktoken")
<add> end
<add>
<add> it "checks online if --online flag is set" do
<add> allow(Cask::CaskLoader).to receive(:load).and_return(cask)
<add> expect(Cask::Auditor).to receive(:audit)
<add> .with(cask, audit_download: true,
<add> audit_appcast: true,
<add> audit_token_conflicts: false,
<add> audit_new_cask: false,
<add> audit_online: true,
<add> audit_strict: false,
<add> quarantine: true)
<add> .and_return(true)
<add>
<add> described_class.run("casktoken", "--online")
<add> end
<add> end
<add>
<add> describe "rules for checking new casks" do
<add> it "does not check new casks per default" do
<add> allow(Cask::CaskLoader).to receive(:load).and_return(cask)
<add> expect(Cask::Auditor).to receive(:audit)
<add> .with(cask, audit_download: false,
<add> audit_appcast: false,
<add> audit_token_conflicts: false,
<add> audit_new_cask: false,
<add> audit_online: false,
<add> audit_strict: false,
<add> quarantine: true)
<add> .and_return(true)
<add>
<add> described_class.run("casktoken")
<add> end
<add>
<add> it "checks new casks if --new-cask flag is set" do
<add> allow(Cask::CaskLoader).to receive(:load).and_return(cask)
<add> expect(Cask::Auditor).to receive(:audit)
<add> .with(cask, audit_download: true,
<add> audit_appcast: true,
<add> audit_token_conflicts: true,
<add> audit_new_cask: true,
<add> audit_online: true,
<add> audit_strict: true,
<add> quarantine: true)
<add> .and_return(true)
<add>
<add> described_class.run("casktoken", "--new-cask")
<add> end
<add> end
<ide> end
<ide><path>Library/Homebrew/utils/notability.rb
<add># frozen_string_literal: true
<add>
<add>require "utils/curl"
<add>
<add>module SharedAudits
<add> module_function
<add>
<add> def github(user, repo)
<add> begin
<add> metadata = GitHub.repository(user, repo)
<add> rescue GitHub::HTTPNotFoundError
<add> return
<add> end
<add>
<add> return if metadata.nil?
<add>
<add> return "GitHub fork (not canonical repository)" if metadata["fork"]
<add> if (metadata["forks_count"] < 30) && (metadata["subscribers_count"] < 30) &&
<add> (metadata["stargazers_count"] < 75)
<add> return "GitHub repository not notable enough (<30 forks, <30 watchers and <75 stars)"
<add> end
<add>
<add> return if Date.parse(metadata["created_at"]) <= (Date.today - 30)
<add>
<add> "GitHub repository too new (<30 days old)"
<add> end
<add>
<add> def gitlab(user, repo)
<add> out, _, status= curl_output("--request", "GET", "https://gitlab.com/api/v4/projects/#{user}%2F#{repo}")
<add> return unless status.success?
<add>
<add> metadata = JSON.parse(out)
<add> return if metadata.nil?
<add>
<add> return "GitLab fork (not canonical repository)" if metadata["fork"]
<add> if (metadata["forks_count"] < 30) && (metadata["star_count"] < 75)
<add> return "GitLab repository not notable enough (<30 forks and <75 stars)"
<add> end
<add>
<add> return if Date.parse(metadata["created_at"]) <= (Date.today - 30)
<add>
<add> "GitLab repository too new (<30 days old)"
<add> end
<add>
<add> def bitbucket(user, repo)
<add> api_url = "https://api.bitbucket.org/2.0/repositories/#{user}/#{repo}"
<add> out, _, status= curl_output("--request", "GET", api_url)
<add> return unless status.success?
<add>
<add> metadata = JSON.parse(out)
<add> return if metadata.nil?
<add>
<add> return "Uses deprecated mercurial support in Bitbucket" if metadata["scm"] == "hg"
<add>
<add> return "Bitbucket fork (not canonical repository)" unless metadata["parent"].nil?
<add>
<add> return "Bitbucket repository too new (<30 days old)" if Date.parse(metadata["created_on"]) >= (Date.today - 30)
<add>
<add> forks_out, _, forks_status= curl_output("--request", "GET", "#{api_url}/forks")
<add> return unless forks_status.success?
<add>
<add> watcher_out, _, watcher_status= curl_output("--request", "GET", "#{api_url}/watchers")
<add> return unless watcher_status.success?
<add>
<add> forks_metadata = JSON.parse(forks_out)
<add> return if forks_metadata.nil?
<add>
<add> watcher_metadata = JSON.parse(watcher_out)
<add> return if watcher_metadata.nil?
<add>
<add> return if (forks_metadata["size"] < 30) && (watcher_metadata["size"] < 75)
<add>
<add> "Bitbucket repository not notable enough (<30 forks and <75 watchers)"
<add> end
<add>end | 7 |
Javascript | Javascript | add next line operators for text collection | 2db0ee6ba3e7e4ae9a7df48cf275c72e40389ca1 | <ide><path>src/evaluator.js
<ide> var PartialEvaluator = (function PartialEvaluatorClosure() {
<ide> var args = [], obj;
<ide>
<ide> var text = '';
<add> var chunk = null;
<ide> var font = null;
<ide> while (!isEOF(obj = parser.getObj())) {
<ide> if (isCmd(obj)) {
<ide> var PartialEvaluator = (function PartialEvaluatorClosure() {
<ide> var items = args[0];
<ide> for (var j = 0, jj = items.length; j < jj; j++) {
<ide> if (typeof items[j] === 'string') {
<del> text += fontCharsToUnicode(items[j],
<del> font.translated.properties);
<add> chunk += items[j];
<ide> } else if (items[j] < 0) {
<ide> // making all negative offsets a space - better to have
<ide> // a space in incorrect place than not have them at all
<del> text += ' ';
<add> chunk += ' ';
<ide> }
<ide> }
<ide> break;
<ide> case 'Tj':
<del> text += fontCharsToUnicode(args[0], font.translated.properties);
<add> chunk += args[0];
<add> break;
<add> case "'":
<add> text += args[0] + ' ';
<add> break;
<add> case '"':
<add> text += args[2] + ' ';
<ide> break;
<ide> } // switch
<add> if (chunk !== null) {
<add> text += fontCharsToUnicode(chunk, font.translated.properties);
<add> chunk = null;
<add> }
<ide>
<ide> args = [];
<ide> } else if (obj != null) { | 1 |
Python | Python | improve tokenization for ud spanish ancora | e8be15e9b79ba66497b59947c31604b48793bde0 | <ide><path>spacy/lang/es/__init__.py
<ide> from .stop_words import STOP_WORDS
<ide> from .lex_attrs import LEX_ATTRS
<ide> from .syntax_iterators import SYNTAX_ITERATORS
<add>from .punctuation import TOKENIZER_INFIXES, TOKENIZER_SUFFIXES
<ide>
<ide> from ..tokenizer_exceptions import BASE_EXCEPTIONS
<ide> from ..norm_exceptions import BASE_NORMS
<ide> class SpanishDefaults(Language.Defaults):
<ide> )
<ide> tokenizer_exceptions = update_exc(BASE_EXCEPTIONS, TOKENIZER_EXCEPTIONS)
<ide> tag_map = TAG_MAP
<add> infixes = TOKENIZER_INFIXES
<add> suffixes = TOKENIZER_SUFFIXES
<ide> stop_words = STOP_WORDS
<ide> syntax_iterators = SYNTAX_ITERATORS
<ide>
<ide><path>spacy/lang/es/punctuation.py
<add># coding: utf8
<add>from __future__ import unicode_literals
<add>
<add>from ..char_classes import LIST_PUNCT, LIST_ELLIPSES, LIST_QUOTES
<add>from ..char_classes import LIST_ICONS, CURRENCY, LIST_UNITS, PUNCT
<add>from ..char_classes import CONCAT_QUOTES, ALPHA_LOWER, ALPHA_UPPER, ALPHA
<add>from ..char_classes import merge_chars
<add>from ..punctuation import TOKENIZER_PREFIXES as BASE_TOKENIZER_PREFIXES
<add>
<add>
<add>_list_units = [u for u in LIST_UNITS if u != "%"]
<add>_units = merge_chars(" ".join(_list_units))
<add>_concat_quotes = CONCAT_QUOTES + "—–"
<add>
<add>
<add>_suffixes = (
<add> ["—", "–"]
<add> + LIST_PUNCT
<add> + LIST_ELLIPSES
<add> + LIST_QUOTES
<add> + LIST_ICONS
<add> + [
<add> r"(?<=[0-9])\+",
<add> r"(?<=°[FfCcKk])\.",
<add> r"(?<=[0-9])(?:{c})".format(c=CURRENCY),
<add> r"(?<=[0-9])(?:{u})".format(u=_units),
<add> r"(?<=[0-9{al}{e}{p}(?:{q})])\.".format(
<add> al=ALPHA_LOWER, e=r"%²\-\+", q=_concat_quotes, p=PUNCT
<add> ),
<add> r"(?<=[{au}][{au}])\.".format(au=ALPHA_UPPER),
<add> ]
<add>)
<add>
<add>_infixes = (
<add> LIST_ELLIPSES
<add> + LIST_ICONS
<add> + [
<add> r"(?<=[0-9])[+\*^](?=[0-9-])",
<add> r"(?<=[{al}{q}])\.(?=[{au}{q}])".format(
<add> al=ALPHA_LOWER, au=ALPHA_UPPER, q=_concat_quotes
<add> ),
<add> r"(?<=[{a}]),(?=[{a}])".format(a=ALPHA),
<add> r"(?<=[{a}0-9])[:<>=/](?=[{a}])".format(a=ALPHA),
<add> ]
<add>)
<add>
<add>TOKENIZER_SUFFIXES = _suffixes
<add>TOKENIZER_INFIXES = _infixes
<ide><path>spacy/lang/es/tokenizer_exceptions.py
<ide> "Av.",
<ide> "Avda.",
<ide> "Cía.",
<add> "EE.UU.",
<ide> "etc.",
<add> "fig.",
<ide> "Gob.",
<ide> "Gral.",
<ide> "Ing.",
<ide> "J.C.",
<add> "km/h",
<ide> "Lic.",
<ide> "m.n.",
<del> "no.",
<ide> "núm.",
<ide> "P.D.",
<ide> "Prof.", | 3 |
Ruby | Ruby | use quiet_safe_system to silence submodule updates | 8560ad3ad01c7cbda18d1df81e85926f996dd449 | <ide><path>Library/Homebrew/download_strategy.rb
<ide> def reset
<ide> end
<ide>
<ide> def update_submodules
<del> safe_system 'git', 'submodule', 'update', '--init', '--recursive'
<add> quiet_safe_system "git", "submodule", "update", "--init", "--recursive"
<ide> end
<ide>
<ide> def checkout_submodules(dst) | 1 |
Javascript | Javascript | increase tolerance for ci | 56411bdcd48e9814c1a2d768e8c4eb0b449bd24a | <ide><path>test/scale.time.tests.js
<ide> describe('Time scale tests', function() {
<ide> var result = false;
<ide>
<ide> var diff = actual.diff(expected.value, expected.unit, true);
<del> result = Math.abs(diff) < 0.3;
<add> result = Math.abs(diff) < 0.5;
<ide>
<ide> return {
<ide> pass: result | 1 |
PHP | PHP | fix bug with relations | 17635d183e626f8d79d27297ae7dc6026865236d | <ide><path>src/Illuminate/Database/Eloquent/Model.php
<ide> public function getAttribute($key)
<ide>
<ide> if (method_exists($this, $camelKey))
<ide> {
<del> $relations = $this->$camelKey()->get();
<add> $relations = $this->$camelKey()->getResults();
<ide>
<ide> return $this->relations[$key] = $relations;
<ide> }
<ide><path>src/Illuminate/Database/Eloquent/Relations/BelongsTo.php
<ide> public function __construct(Builder $query, Model $parent, $foreignKey, $relatio
<ide> *
<ide> * @return mixed
<ide> */
<del> public function get()
<add> public function getResults()
<ide> {
<ide> return $this->query->first();
<ide> }
<ide> public function associate(Model $model)
<ide> */
<ide> public function update(array $attributes)
<ide> {
<del> $instance = $this->get();
<add> $instance = $this->getResults();
<ide>
<ide> return $instance->fill($attributes)->save();
<ide> }
<ide><path>src/Illuminate/Database/Eloquent/Relations/HasMany.php
<ide> class HasMany extends HasOneOrMany {
<ide> *
<ide> * @return mixed
<ide> */
<del> public function get()
<add> public function getResults()
<ide> {
<ide> return $this->query->get();
<ide> }
<ide><path>src/Illuminate/Database/Eloquent/Relations/HasOne.php
<ide> class HasOne extends HasOneOrMany {
<ide> *
<ide> * @return mixed
<ide> */
<del> public function get()
<add> public function getResults()
<ide> {
<ide> return $this->query->first();
<ide> }
<ide><path>src/Illuminate/Database/Eloquent/Relations/MorphMany.php
<ide> class MorphMany extends MorphOneOrMany {
<ide> *
<ide> * @return mixed
<ide> */
<del> public function get()
<add> public function getResults()
<ide> {
<ide> return $this->query->get();
<ide> }
<ide><path>src/Illuminate/Database/Eloquent/Relations/MorphOne.php
<ide> class MorphOne extends MorphOneOrMany {
<ide> *
<ide> * @return mixed
<ide> */
<del> public function get()
<add> public function getResults()
<ide> {
<ide> return $this->query->first();
<ide> }
<ide><path>src/Illuminate/Database/Eloquent/Relations/Relation.php
<ide> abstract public function match(array $models, Collection $results, $relation);
<ide> *
<ide> * @return mixed
<ide> */
<del> abstract public function get();
<add> abstract public function getResults();
<ide>
<ide> /**
<ide> * Touch all of the related models for the relationship. | 7 |
PHP | PHP | fix bug in query grammer | fda17884e186d1115eb30f957e28a85639899196 | <ide><path>src/Illuminate/Database/Query/Grammars/Grammar.php
<ide> protected function compileWheres(Builder $query)
<ide> {
<ide> $sql = array();
<ide>
<add> if (is_null($query->wheres)) return '';
<add>
<ide> // Each type of where clauses has its own compiler function which is responsible
<ide> // for actually creating the where clauses SQL. This helps keep the code nice
<ide> // and maintainable since each clause has a very small method that it uses. | 1 |
PHP | PHP | add more tests | e4d46c030628cbf06c48a5fb742a7fd1d8dc302b | <ide><path>tests/View/Blade/BladeIncludeWhenTest.php
<ide> public function testIncludeWhensAreCompiled()
<ide> $compiler = new BladeCompiler($this->getFiles(), __DIR__);
<ide> $this->assertEquals('<?php if (true) echo $__env->make(\'foo\', array_except(get_defined_vars(), array(\'__data\', \'__path\')))->render(); ?>', $compiler->compileString('@includeWhen(true, \'foo\')'));
<ide> $this->assertEquals('<?php if (true) echo $__env->make(name(foo), array_except(get_defined_vars(), array(\'__data\', \'__path\')))->render(); ?>', $compiler->compileString('@includeWhen(true, name(foo))'));
<add> $this->assertEquals('<?php if (foo((\'foo\'))) echo $__env->make(name(foo), array_except(get_defined_vars(), array(\'__data\', \'__path\')))->render(); ?>', $compiler->compileString('@includeWhen(foo((\'foo\')), name(foo))'));
<add> $this->assertEquals('<?php if (\'true, false\') echo $__env->make(name(foo), array_except(get_defined_vars(), array(\'__data\', \'__path\')))->render(); ?>', $compiler->compileString('@includeWhen(\'true, false\', name(foo))'));
<ide> }
<ide>
<ide> protected function getFiles() | 1 |
Text | Text | clarify the behavior of buffer.bytelength | 271d50a8925de3cf479b2e523b59f4d0a62f450d | <ide><path>doc/api/buffer.md
<ide> Returns the actual byte length of a string. This is not the same as
<ide> [`String.prototype.length`] since that returns the number of *characters* in
<ide> a string.
<ide>
<add>*Note* that for `'base64'` and `'hex'`, this function assumes valid input. For
<add>strings that contain non-Base64/Hex-encoded data (e.g. whitespace), the return
<add>value might be greater than the length of a `Buffer` created from the string.
<add>
<ide> Example:
<ide>
<ide> ```js | 1 |
Go | Go | fix error formatting | b087846c0e087fac24681148997582d4eb890fba | <ide><path>daemon/container_unix.go
<ide> func (container *Container) setupLinkedContainers() ([]string, error) {
<ide>
<ide> childBridgeSettings := child.NetworkSettings.Networks["bridge"]
<ide> if childBridgeSettings == nil {
<del> return nil, fmt.Errorf("container %d not attached to default bridge network", child.ID)
<add> return nil, fmt.Errorf("container %s not attached to default bridge network", child.ID)
<ide> }
<ide>
<ide> link := links.NewLink( | 1 |
Javascript | Javascript | add bracket for comments | d6bad9a8be90defc71b27c33e1348a4f6133b852 | <ide><path>src/createStore.js
<ide> import isPlainObject from './utils/isPlainObject'
<ide> * parts of the state tree respond to actions, you may combine several reducers
<ide> * into a single reducer function by using `combineReducers`.
<ide> *
<del> * @param {Function} reducer A function that returns the next state tree, given
<add> * @param {Function} [reducer] A function that returns the next state tree, given
<ide> * the current state tree and the action to handle.
<ide> *
<ide> * @param {any} [preloadedState] The initial state. You may optionally specify it | 1 |
Ruby | Ruby | fix bottle uploading | 9e2c0601e3d0c3f1eca3763c2f24d15e562ed0be | <ide><path>Library/Homebrew/cmd/test-bot.rb
<ide> def test_ci_upload(tap)
<ide> tag = pr ? "pr-#{pr}" : "testing-#{number}"
<ide> safe_system "git", "push", "--force", remote, "master:master", ":refs/tags/#{tag}"
<ide>
<del> bintray_repo = Bintray.repository(tap.name)
<add> bintray_repo = if tap
<add> Bintray.repository(tap)
<add> else
<add> Bintray.repository(tap.name)
<add> end
<ide> bintray_repo_url = "https://api.bintray.com/packages/homebrew/#{bintray_repo}"
<ide> formula_packaged = {}
<ide> | 1 |
Text | Text | simplify the docs branch process for now | 65fb2e77eb8c5fdb419a94058f7b4630c00871af | <ide><path>docs/README.md
<ide> documentation.
<ide> ## Branches
<ide>
<ide> **There are two branches related to editing docs**: ``master`` and a
<del>``doc*`` branch (currently ``doc0.8.1``). You should normally edit
<del>docs on a local branch of the ``master`` branch. That way your fixes
<add>``docs`` branch. You should always edit
<add>docs on a local branch of the ``master`` branch, and send a PR against ``master``.
<add>That way your fixes
<ide> will automatically get included in later releases, and docs maintainers
<del>can easily cherry-pick your changes to bring over to the current docs
<del>branch. In the rare case where your change is not forward-compatible,
<del>then you could base your change on the appropriate ``doc*`` branch.
<add>can easily cherry-pick your changes into the ``docs`` release branch.
<add>In the rare case where your change is not forward-compatible,
<add>you may need to base your changes on the ``docs`` branch.
<ide>
<del>Now that we have a ``doc*`` branch, we can keep the ``latest`` docs
<add>Now that we have a ``docs`` branch, we can keep the [http://docs.docker.io](http://docs.docker.io) docs
<ide> up to date with any bugs found between ``docker`` code releases.
<ide>
<del>**Warning**: When *reading* the docs, the ``master`` documentation may
<add>**Warning**: When *reading* the docs, the [http://beta-docs.docker.io](http://beta-docs.docker.io) documentation may
<ide> include features not yet part of any official docker
<del>release. ``Master`` docs should be used only for understanding
<del>bleeding-edge development and ``latest`` (which points to the ``doc*``
<add>release. The ``beta-docs`` site should be used only for understanding
<add>bleeding-edge development and ``docs.docker.io`` (which points to the ``docs``
<ide> branch``) should be used for the latest official release.
<ide>
<ide> Getting Started
<ide> ---------------
<ide>
<ide> Docker documentation builds are done in a docker container, which installs all
<ide> the required tools, adds the local ``docs/`` directory and builds the HTML
<del>docs. It then starts a simple HTTP server on port 8000 so that you can connect
<add>docs. It then starts a HTTP server on port 8000 so that you can connect
<ide> and see your changes.
<ide>
<ide> In the ``docker`` source directory, run: | 1 |
Javascript | Javascript | add flow to modernchangeeventplugin | 67eb6ff4a84204271232506aea77155507a32b17 | <ide><path>packages/react-dom/src/events/ReactSyntheticEventType.js
<ide> export type DispatchConfig = {|
<ide> captured: null | string,
<ide> |},
<ide> registrationName?: string,
<del> eventPriority: EventPriority,
<add> eventPriority?: EventPriority,
<ide> |};
<ide>
<ide> export type CustomDispatchConfig = {|
<ide><path>packages/react-dom/src/events/plugins/ModernChangeEventPlugin.js
<ide> *
<ide> * This source code is licensed under the MIT license found in the
<ide> * LICENSE file in the root directory of this source tree.
<add> *
<add> * @flow
<ide> */
<ide>
<del>import SyntheticEvent from '../../events/SyntheticEvent';
<add>import type {TopLevelType} from '../TopLevelEventTypes';
<add>import type {DispatchQueue} from '../PluginModuleType';
<add>import type {EventSystemFlags} from '../EventSystemFlags';
<add>
<add>import SyntheticEvent from '../SyntheticEvent';
<ide> import isTextInputElement from '../isTextInputElement';
<ide> import {canUseDOM} from 'shared/ExecutionEnvironment';
<ide>
<ide> function createAndAccumulateChangeEvent(
<ide> );
<ide> event.type = 'change';
<ide> // Flag this event loop as needing state restore.
<del> enqueueStateRestore(target);
<add> enqueueStateRestore(((target: any): Node));
<ide> accumulateTwoPhaseListeners(inst, dispatchQueue, event);
<del> return event;
<ide> }
<ide> /**
<ide> * For IE shims
<ide> let activeElementInst = null;
<ide> function shouldUseChangeEvent(elem) {
<ide> const nodeName = elem.nodeName && elem.nodeName.toLowerCase();
<ide> return (
<del> nodeName === 'select' || (nodeName === 'input' && elem.type === 'file')
<add> nodeName === 'select' ||
<add> (nodeName === 'input' && (elem: any).type === 'file')
<ide> );
<ide> }
<ide>
<ide> function manualDispatchChangeEvent(nativeEvent) {
<del> const event = createAndAccumulateChangeEvent(
<add> const dispatchQueue = [];
<add> createAndAccumulateChangeEvent(
<add> dispatchQueue,
<ide> activeElementInst,
<ide> nativeEvent,
<ide> getEventTarget(nativeEvent),
<ide> function manualDispatchChangeEvent(nativeEvent) {
<ide> // components don't work properly in conjunction with event bubbling because
<ide> // the component is rerendered and the value reverted before all the event
<ide> // handlers can run. See https://github.com/facebook/react/issues/708.
<del> batchedUpdates(runEventInBatch, event);
<add> batchedUpdates(runEventInBatch, dispatchQueue);
<ide> }
<ide>
<del>function runEventInBatch(event) {
<del> dispatchEventsInBatch([event]);
<add>function runEventInBatch(dispatchQueue) {
<add> dispatchEventsInBatch(dispatchQueue);
<ide> }
<ide>
<del>function getInstIfValueChanged(targetInst) {
<add>function getInstIfValueChanged(targetInst: Object) {
<ide> const targetNode = getNodeFromInstance(targetInst);
<del> if (updateValueIfChanged(targetNode)) {
<add> if (updateValueIfChanged(((targetNode: any): HTMLInputElement))) {
<ide> return targetInst;
<ide> }
<ide> }
<ide> if (canUseDOM) {
<ide> function startWatchingForValueChange(target, targetInst) {
<ide> activeElement = target;
<ide> activeElementInst = targetInst;
<del> activeElement.attachEvent('onpropertychange', handlePropertyChange);
<add> (activeElement: any).attachEvent('onpropertychange', handlePropertyChange);
<ide> }
<ide>
<ide> /**
<ide> function stopWatchingForValueChange() {
<ide> if (!activeElement) {
<ide> return;
<ide> }
<del> activeElement.detachEvent('onpropertychange', handlePropertyChange);
<add> (activeElement: any).detachEvent('onpropertychange', handlePropertyChange);
<ide> activeElement = null;
<ide> activeElementInst = null;
<ide> }
<ide> function getTargetInstForInputOrChangeEvent(topLevelType, targetInst) {
<ide> }
<ide> }
<ide>
<del>function handleControlledInputBlur(node) {
<del> const state = node._wrapperState;
<add>function handleControlledInputBlur(node: HTMLInputElement) {
<add> const state = (node: any)._wrapperState;
<ide>
<ide> if (!state || !state.controlled || node.type !== 'number') {
<ide> return;
<ide> }
<ide>
<ide> if (!disableInputAttributeSyncing) {
<ide> // If controlled, assign the value attribute to the current value on blur
<del> setDefaultValue(node, 'number', node.value);
<add> setDefaultValue((node: any), 'number', (node: any).value);
<ide> }
<ide> }
<ide>
<ide> const ChangeEventPlugin = {
<ide> _isInputEventSupported: isInputEventSupported,
<ide>
<ide> extractEvents: function(
<del> dispatchQueue,
<del> topLevelType,
<del> targetInst,
<del> nativeEvent,
<del> nativeEventTarget,
<del> eventSystemFlags,
<del> container,
<add> dispatchQueue: DispatchQueue,
<add> topLevelType: TopLevelType,
<add> targetInst: null | Fiber,
<add> nativeEvent: MouseEvent,
<add> nativeEventTarget: null | EventTarget,
<add> eventSystemFlags: EventSystemFlags,
<add> targetContainer: null | EventTarget,
<ide> ) {
<ide> const targetNode = targetInst ? getNodeFromInstance(targetInst) : window;
<ide>
<ide> let getTargetInstFunc, handleEventFunc;
<ide> if (shouldUseChangeEvent(targetNode)) {
<ide> getTargetInstFunc = getTargetInstForChangeEvent;
<del> } else if (isTextInputElement(targetNode)) {
<add> } else if (isTextInputElement(((targetNode: any): HTMLElement))) {
<ide> if (isInputEventSupported) {
<ide> getTargetInstFunc = getTargetInstForInputOrChangeEvent;
<ide> } else {
<ide> const ChangeEventPlugin = {
<ide>
<ide> // When blurring, set the value attribute for number inputs
<ide> if (topLevelType === TOP_BLUR) {
<del> handleControlledInputBlur(targetNode);
<add> handleControlledInputBlur(((targetNode: any): HTMLInputElement));
<ide> }
<ide> },
<ide> }; | 2 |
Text | Text | clarify justification for moving | 3a7ecccec7458d549fa1a41d84e2acd5d69179a7 | <ide><path>build/README.md
<ide>
<ide> This folder contains the grunt configuration and tasks to build Atom.
<ide>
<del>It was moved from the root of the repository so that native modules would be
<del>compiled against node's v8 headers instead of Atom's v8 headers.
<add>It was moved from the root of the repository so that any native modules used
<add>would be compiled against node's v8 headers since anything stored in
<add>`node_modules` at the root of the repo is compiled against atom's v8 headers.
<ide>
<ide> New build dependencies should be added to the `package.json` file located in
<ide> this folder. | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.