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
PHP
PHP
use same default queue name for all drivers
2b8f3aa506f1f2463dfdb43b063d17674b86c8cd
<ide><path>config/queue.php <ide> 'key' => env('AWS_ACCESS_KEY_ID'), <ide> 'secret' => env('AWS_SECRET_ACCESS_KEY'), <ide> 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), <del> 'queue' => env('SQS_QUEUE', 'your-queue-name'), <add> 'queue' => env('SQS_QUEUE', 'default'), <ide> 'suffix' => env('SQS_SUFFIX'), <ide> 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), <ide> ],
1
Ruby
Ruby
use pkg_version when publishing bottles
e1611c4c224e83a1231cd1e5726bda37834feb87
<ide><path>Library/Homebrew/cmd/pull.rb <ide> def pull <ide> changed_formulae.each do |f| <ide> ohai "Publishing on Bintray:" <ide> package = Bintray.package f.name <del> bottle = Bottle.new(f, f.bottle_specification) <del> version = Bintray.version(bottle.url) <add> version = f.pkg_version <ide> curl "--silent", "--fail", <ide> "-u#{bintray_user}:#{bintray_key}", "-X", "POST", <ide> "https://api.bintray.com/content/homebrew/#{repo}/#{package}/#{version}/publish"
1
PHP
PHP
add default to collection property
78a494e6399758008c4c7e304ac9e30fbb324611
<ide><path>src/Illuminate/Support/Collection.php <ide> class Collection implements ArrayAccess, ArrayableInterface, Countable, Iterator <ide> * <ide> * @var array <ide> */ <del> protected $items; <add> protected $items = array(); <ide> <ide> /** <ide> * Create a new collection.
1
Javascript
Javascript
simplify jsdom.jsdom invocation
dcdcd6b7b8cee6f86320790aa05cc52bf87cee62
<ide><path>test/load.js <ide> module.exports = function() { <ide> }; <ide> <ide> topic.document = function(_) { <del> var document = jsdom.jsdom("<html><head></head><body></body></html>"); <add> var document = jsdom.jsdom(); <ide> <ide> // Monkey-patch createRange support to JSDOM. <ide> document.createRange = function() {
1
PHP
PHP
trim double quotes from section name
99c6db84fa621a0f8dfa7c30d37ad55705002b9f
<ide><path>src/Illuminate/View/Compilers/Concerns/CompilesLayouts.php <ide> protected function compileExtends($expression) <ide> */ <ide> protected function compileSection($expression) <ide> { <del> $this->lastSection = trim($expression, "()'"); <add> $this->lastSection = trim($expression, "()'\""); <ide> <ide> return "<?php \$__env->startSection{$expression}; ?>"; <ide> }
1
Ruby
Ruby
copy env_proc when merging deps
6b5e73a2c343ac9947c5d7df2c4aaf99e7aca7e6
<ide><path>Library/Homebrew/dependency.rb <ide> def merge_repeats(deps) <ide> grouped = deps.group_by(&:name) <ide> <ide> deps.uniq.map do |dep| <del> dep.class.new(dep.name, grouped.fetch(dep.name).map(&:tags).flatten) <add> tags = grouped.fetch(dep.name).map(&:tags).flatten <add> merged_dep = dep.class.new(dep.name, tags) <add> merged_dep.env_proc = dep.env_proc <add> merged_dep <ide> end <ide> end <ide> end <ide><path>Library/Homebrew/test/test_dependency_expansion.rb <ide> def test_merges_repeated_deps_with_differing_options <ide> deps = [@foo2, @bar, @baz2, @qux] <ide> assert_equal deps, Dependency.expand(@f) <ide> end <add> <add> def test_merger_preserves_env_proc <add> env_proc = @foo.env_proc = stub <add> assert_equal env_proc, Dependency.expand(@f).first.env_proc <add> end <ide> end
2
Ruby
Ruby
add rewrite function for generic shebangs
79a3d3568b5f5880947d7f857fbe9630b55cc492
<ide><path>Library/Homebrew/language/python.rb <ide> def self.setup_install_args(prefix) <ide> ] <ide> end <ide> <add> def self.rewrite_python_shebang(python_path) <add> Pathname(".").find do |f| <add> regex = %r{^#! ?/usr/bin/(env )?python([23](\.\d{1,2})?)$} <add> maximum_regex_length = "#! /usr/bin/env pythonx.yyy$".length <add> next unless f.file? <add> next unless regex.match?(f.read(maximum_regex_length)) <add> <add> Utils::Inreplace.inreplace f.to_s, regex, "#!#{python_path}" <add> end <add> end <add> <ide> # Mixin module for {Formula} adding virtualenv support features. <ide> module Virtualenv <ide> def self.included(base)
1
Javascript
Javascript
improve error message of _errnoexception
c64ca56def8651c2ad679bcdf1283fa7560e88f3
<ide><path>lib/util.js <ide> function error(...args) { <ide> } <ide> <ide> function _errnoException(err, syscall, original) { <del> if (typeof err !== 'number' || err >= 0 || !Number.isSafeInteger(err)) { <del> throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'err', <del> 'negative number'); <add> if (typeof err !== 'number') { <add> throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'err', 'number', err); <add> } <add> if (err >= 0 || !Number.isSafeInteger(err)) { <add> throw new errors.RangeError('ERR_OUT_OF_RANGE', 'err', <add> 'a negative integer', err); <ide> } <ide> const name = errname(err); <ide> var message = `${syscall} ${name}`; <ide><path>test/parallel/test-uv-errno.js <ide> keys.forEach((key) => { <ide> }); <ide> }); <ide> <del>[0, 1, 'test', {}, [], Infinity, -Infinity, NaN].forEach((key) => { <add>['test', {}, []].forEach((key) => { <ide> common.expectsError( <ide> () => util._errnoException(key), <ide> { <ide> code: 'ERR_INVALID_ARG_TYPE', <ide> type: TypeError, <del> message: 'The "err" argument must be of type negative number' <add> message: 'The "err" argument must be of type number. ' + <add> `Received type ${typeof key}` <add> }); <add>}); <add> <add>[0, 1, Infinity, -Infinity, NaN].forEach((key) => { <add> common.expectsError( <add> () => util._errnoException(key), <add> { <add> code: 'ERR_OUT_OF_RANGE', <add> type: RangeError, <add> message: 'The value of "err" is out of range. ' + <add> 'It must be a negative integer. ' + <add> `Received ${key}` <ide> }); <ide> });
2
PHP
PHP
fix collection import on notificationfake
2fb90f4c66ecc5bee876e701bbef1879dbb8b2be
<ide><path>src/Illuminate/Support/Testing/Fakes/NotificationFake.php <ide> namespace Illuminate\Support\Testing\Fakes; <ide> <ide> use Ramsey\Uuid\Uuid; <add>use Illuminate\Support\Collection; <ide> use PHPUnit_Framework_Assert as PHPUnit; <ide> use Illuminate\Contracts\Notifications\Factory as NotificationFactory; <ide>
1
PHP
PHP
add exception for dbo classes
ade85c1cd0db52d0bbf9e823a146a2243ad5d050
<ide><path>lib/Cake/Console/Command/UpgradeShell.php <ide> protected function _movePhpFiles($path, $options) { <ide> <ide> $class = $match[1]; <ide> <del> preg_match('@([A-Z][^A-Z]*)$@', $class, $match); <del> if ($match) { <del> $type = $match[1]; <add> if (substr($class, 0, 3) === 'Dbo') { <add> $type = 'Dbo'; <ide> } else { <del> $type = 'unknown'; <add> preg_match('@([A-Z][^A-Z]*)$@', $class, $match); <add> if ($match) { <add> $type = $match[1]; <add> } else { <add> $type = 'unknown'; <add> } <ide> } <ide> <ide> preg_match('@^.*[\\\/]plugins[\\\/](.*?)[\\\/]@', $file, $match);
1
Text
Text
fix typos in buffer geometry article
c3c06f93798d2f92707d4f4c2ecc701a19070930
<ide><path>threejs/lessons/threejs-custom-buffergeometry.md <ide> of the face. <ide> <ide> <div class="threejs_center"><img src="resources/threejs-geometry.svg" style="width: 700px"></div> <ide> <del>`BufferGeometry` on the other hand uses *named* `BufferAttribute`s <del>Each `BufferAttribute` represents an array of one type of data, positions, <del>normals, colors, uv, and togther the all the added `BufferAttribute`s represent <del>*parallel arrays* of all the data for each vertex. <add>`BufferGeometry` on the other hand uses *named* `BufferAttribute`s. <add>Each `BufferAttribute` represents an array of one type of data: positions, <add>normals, colors, and uv. Togther, the added `BufferAttribute`s represent <add>*parallel arrays* of all the data for each vertex. <ide> <ide> <div class="threejs_center"><img src="resources/threejs-attributes.svg" style="width: 700px"></div> <ide> <del>Above you can see we have 4 attributes, `position`, `normal`, `color`, `uv`. <add>Above you can see we have 4 attributes: `position`, `normal`, `color`, `uv`. <ide> They represent *parallel arrays* which means that the Nth set of data in each <del>attribute belongs to the same vertex. Above the vertex at index = 4 is highlighted <add>attribute belongs to the same vertex. The vertex at index = 4 is highlighted <ide> to show that the parallel data across all attributes defines one vertex. <ide> <ide> This brings up a point, here's a diagram of a cube with one corner highlighted. <ide> That is where the extra memory and time comes from when using `Geometry`. Extra <ide> memory for all the `Vector3`s, `Vector2`s, `Face3`s and array objects and then <ide> extra time to translate all of that data into parallel arrays in the form of <ide> `BufferAttribute`s like above. Somtimes that makes using `Geometry` easier. <del>With `BufferGeometry` is up to us to supply the data already turned into this format. <add>With `BufferGeometry` it is up to us to supply the data already turned into this format. <ide> <ide> As a simple example let's make a cube using `BufferGeometry`. A cube is interesting <ide> because it appears to share vertices at the corners but really <ide> does not. For our example we'll list out all the vertices with all their data <ide> and then convert that data into parallel arrays and finally use those to make <ide> `BufferAttribute`s and add them to a `BufferGeometry`. <ide> <del>Starting with the texture coordinate example from [the previous article](threejs-custom-geometry.html) we've delete all the code related to setting up <add>Starting with the texture coordinate example from [the previous article](threejs-custom-geometry.html) we've deleted all the code related to setting up <ide> a `Geometry`. Then we list all the data needed for the cube. Remember again <ide> that if a vertex has any unique parts it has to be a separate vertex. As such <del>to make a cube requires 36 vertex. 2 triangles per face, 3 vertices per triangle, <del>6 faces = 36 vertices <add>to make a cube requires 36 vertices. 2 triangles per face, 3 vertices per triangle, <add>6 faces = 36 vertices. <ide> <ide> ```js <ide> const vertices = [ <ide> for (const vertex of vertices) { <ide> } <ide> ``` <ide> <del>Finally we can create a `BufferGeometry` and then a `BufferAttribute` for each array <add>Finally we can create a `BufferGeometry` and then a `BufferAttribute` for each array <ide> and add it to the `BufferGeometry`. <ide> <ide> ```js <ide> name your attribute `color`. <ide> Above we created 3 JavaScript native arrays, `positions`, `normals` and `uvs`. <ide> We then convert those into <ide> [TypedArrays](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) <del>of type `Float32Array`. A `BufferAttribute` requires a typedarray not a native <del>array. A `BufferAttribute` also requires you tell it how many components there <add>of type `Float32Array`. A `BufferAttribute` requires a TypedArray not a native <add>array. A `BufferAttribute` also requires you to tell it how many components there <ide> are per vertex. For the positions and normals we have 3 components per vertex, <ide> x, y, and z. For the UVs we have 2, u and v. <ide> <ide> {{{example url="../threejs-custom-buffergeometry-cube.html"}}} <ide> <ide> That's a lot of data. A small thing we can do is use indices to reference <ide> the vertices. Looking back at our cube data, each face is made from 2 triangles <del>with 3 vertices each, 6 vertices total, but 2 of those vertices are exactly the same; <del>The same position, the same normal, and the same uv. <add>with 3 vertices each, 6 vertices total, but 2 of those vertices are exactly the same; <add>The same position, the same normal, and the same uv. <ide> So, we can remove the matching vertices and then <ide> reference them by index. First we remove the matching vertices. <ide> <ide> is no way to share the vertices at the start and end of the cylinder since they <ide> require different UVs. Just a small thing to be aware of. The solution is <ide> to supply your own normals. <ide> <del>We can also use [typedarrays](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) from the start instead of native JavaScript arrays. <del>The disadvantage to typedarrays is you must specify their size up front. Of <add>We can also use [TypedArrays](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) from the start instead of native JavaScript arrays. <add>The disadvantage to TypedArrays is you must specify their size up front. Of <ide> course that's not that large of a burden but with native arrays we can just <ide> `push` values onto them and look at what size they end up by checking their <del>`length` at the end. With typedarrays there is no push function so we need <del>to do our own bookkeeping when adding values do them. <add>`length` at the end. With TypedArrays there is no push function so we need <add>to do our own bookkeeping when adding values to them. <ide> <ide> In this example knowing the length up front is pretty easy since we're using <ide> a big block of static data to start. <ide> geometry.setIndex([ <ide> {{{example url="../threejs-custom-buffergeometry-cube-typedarrays.html"}}} <ide> <ide> A good reason to use typedarrays is if you want to dynamically update any <del>part of the vertices. <add>part of the vertices. <ide> <ide> I couldn't think of a really good example of dynamically updating the vertices <ide> so I decided to make a sphere and move each quad in and out from the center. Hopefully <ide> And we set `positionAttribute.needsUpdate` to tell THREE.js to use our changes. <ide> <ide> {{{example url="../threejs-custom-buffergeometry-dynamic.html"}}} <ide> <del>I hope these were useful example of how to use `BufferGeometry` directly to <add>I hope these were useful examples of how to use `BufferGeometry` directly to <ide> make your own geometry and how to dynamically update the contents of a <del>`BufferAttribute`. Which you use, `Geometry` or `BufferGeometry` really <add>`BufferAttribute`. Which you use, `Geometry` or `BufferGeometry`, really <ide> depends on your needs. <ide> <ide> <canvas id="c"></canvas>
1
Ruby
Ruby
remove obsolete hacks from updater report
87850d00cda177e15d94c48655b182cc74cb7af2
<ide><path>Library/Homebrew/cmd/update.rb <ide> def dump <ide> end <ide> <ide> def tapped_formula_for key <del> fetch(key, []).select do |path| <del> case path.to_s <del> when HOMEBREW_TAP_PATH_REGEX <del> valid_formula_location?("#{$1}/#{$2}/#{$3}") <del> else <del> false <del> end <del> end.compact <del> end <del> <del> def valid_formula_location?(relative_path) <del> parts = relative_path.split('/')[2..-1] <del> return false unless File.extname(parts.last) == ".rb" <del> case parts.first <del> when "Formula", "HomebrewFormula" <del> parts.length == 2 <del> else <del> parts.length == 1 <del> end <add> fetch(key, []).select { |path| HOMEBREW_TAP_PATH_REGEX === path.to_s } <ide> end <ide> <ide> def new_tapped_formula <ide> def removed_tapped_formula <ide> def select_formula key <ide> fetch(key, []).map do |path| <ide> case path.to_s <del> when %r{^#{Regexp.escape(HOMEBREW_LIBRARY.to_s)}/Formula}o <del> path.basename(".rb").to_s <ide> when HOMEBREW_TAP_PATH_REGEX <ide> "#{$1}/#{$2.sub("homebrew-", "")}/#{path.basename(".rb")}" <add> else <add> path.basename(".rb").to_s <ide> end <del> end.compact.sort <add> end.sort <ide> end <ide> <ide> def dump_formula_report key, title <ide> formula = select_formula(key) <ide> unless formula.empty? <ide> ohai title <del> puts_columns formula.uniq <add> puts_columns formula <ide> end <ide> end <ide> end
1
Javascript
Javascript
use setimmediate to defer value restoration
354fb4429978a8d77df72781ce1754c2ffcce9b3
<ide><path>src/browser/ui/dom/components/ReactDOMInput.js <ide> var ReactBrowserComponentMixin = require('ReactBrowserComponentMixin'); <ide> var ReactCompositeComponent = require('ReactCompositeComponent'); <ide> var ReactDOM = require('ReactDOM'); <ide> var ReactMount = require('ReactMount'); <add>var ReactUpdates = require('ReactUpdates'); <ide> <ide> var invariant = require('invariant'); <ide> var merge = require('merge'); <ide> var input = ReactDOM.input; <ide> <ide> var instancesByReactID = {}; <ide> <add>function forceUpdateIfMounted() { <add> /*jshint validthis:true */ <add> if (this.isMounted()) { <add> this.forceUpdate(); <add> } <add>} <add> <ide> /** <ide> * Implements an <input> native component that allows setting these optional <ide> * props: `checked`, `value`, `defaultChecked`, and `defaultValue`. <ide> var ReactDOMInput = ReactCompositeComponent.createClass({ <ide> getInitialState: function() { <ide> var defaultValue = this.props.defaultValue; <ide> return { <del> checked: this.props.defaultChecked || false, <del> value: defaultValue != null ? defaultValue : null <add> initialChecked: this.props.defaultChecked || false, <add> initialValue: defaultValue != null ? defaultValue : null <ide> }; <ide> }, <ide> <del> shouldComponentUpdate: function() { <del> // Defer any updates to this component during the `onChange` handler. <del> return !this._isChanging; <del> }, <del> <ide> render: function() { <ide> // Clone `this.props` so we don't mutate the input. <ide> var props = merge(this.props); <ide> var ReactDOMInput = ReactCompositeComponent.createClass({ <ide> props.defaultValue = null; <ide> <ide> var value = LinkedValueUtils.getValue(this); <del> props.value = value != null ? value : this.state.value; <add> props.value = value != null ? value : this.state.initialValue; <ide> <ide> var checked = LinkedValueUtils.getChecked(this); <del> props.checked = checked != null ? checked : this.state.checked; <add> props.checked = checked != null ? checked : this.state.initialChecked; <ide> <ide> props.onChange = this._handleChange; <ide> <ide> var ReactDOMInput = ReactCompositeComponent.createClass({ <ide> var returnValue; <ide> var onChange = LinkedValueUtils.getOnChange(this); <ide> if (onChange) { <del> this._isChanging = true; <ide> returnValue = onChange.call(this, event); <del> this._isChanging = false; <ide> } <del> this.setState({ <del> checked: event.target.checked, <del> value: event.target.value <del> }); <add> // Here we use setImmediate to wait until all updates have propagated, which <add> // is important when using controlled components within layers: <add> // https://github.com/facebook/react/issues/1698 <add> ReactUpdates.setImmediate(forceUpdateIfMounted, this); <ide> <ide> var name = this.props.name; <ide> if (this.props.type === 'radio' && name != null) { <ide> var ReactDOMInput = ReactCompositeComponent.createClass({ <ide> 'ReactDOMInput: Unknown radio button ID %s.', <ide> otherID <ide> ); <del> // In some cases, this will actually change the `checked` state value. <del> // In other cases, there's no change but this forces a reconcile upon <del> // which componentDidUpdate will reset the DOM property to whatever it <del> // should be. <del> otherInstance.setState({ <del> checked: false <del> }); <add> // If this is a controlled radio button group, forcing the input that <add> // was previously checked to update will cause it to be come re-checked <add> // as appropriate. <add> ReactUpdates.setImmediate(forceUpdateIfMounted, otherInstance); <ide> } <ide> } <ide> <ide><path>src/browser/ui/dom/components/ReactDOMSelect.js <ide> var LinkedValueUtils = require('LinkedValueUtils'); <ide> var ReactBrowserComponentMixin = require('ReactBrowserComponentMixin'); <ide> var ReactCompositeComponent = require('ReactCompositeComponent'); <ide> var ReactDOM = require('ReactDOM'); <add>var ReactUpdates = require('ReactUpdates'); <ide> <ide> var merge = require('merge'); <ide> <ide> // Store a reference to the <select> `ReactDOMComponent`. <ide> var select = ReactDOM.select; <ide> <add>function updateWithPendingValueIfMounted() { <add> /*jshint validthis:true */ <add> if (this.isMounted()) { <add> this.setState({value: this._pendingValue}); <add> this._pendingValue = 0; <add> } <add>} <add> <ide> /** <ide> * Validation function for `value` and `defaultValue`. <ide> * @private <ide> var ReactDOMSelect = ReactCompositeComponent.createClass({ <ide> return {value: this.props.defaultValue || (this.props.multiple ? [] : '')}; <ide> }, <ide> <add> componentWillMount: function() { <add> this._pendingValue = null; <add> }, <add> <ide> componentWillReceiveProps: function(nextProps) { <ide> if (!this.props.multiple && nextProps.multiple) { <ide> this.setState({value: [this.state.value]}); <ide> var ReactDOMSelect = ReactCompositeComponent.createClass({ <ide> } <ide> }, <ide> <del> shouldComponentUpdate: function() { <del> // Defer any updates to this component during the `onChange` handler. <del> return !this._isChanging; <del> }, <del> <ide> render: function() { <ide> // Clone `this.props` so we don't mutate the input. <ide> var props = merge(this.props); <ide> var ReactDOMSelect = ReactCompositeComponent.createClass({ <ide> var returnValue; <ide> var onChange = LinkedValueUtils.getOnChange(this); <ide> if (onChange) { <del> this._isChanging = true; <ide> returnValue = onChange.call(this, event); <del> this._isChanging = false; <ide> } <ide> <ide> var selectedValue; <ide> var ReactDOMSelect = ReactCompositeComponent.createClass({ <ide> selectedValue = event.target.value; <ide> } <ide> <del> this.setState({value: selectedValue}); <add> this._pendingValue = selectedValue; <add> ReactUpdates.setImmediate(updateWithPendingValueIfMounted, this); <ide> return returnValue; <ide> } <ide> <ide><path>src/browser/ui/dom/components/ReactDOMTextarea.js <ide> var LinkedValueUtils = require('LinkedValueUtils'); <ide> var ReactBrowserComponentMixin = require('ReactBrowserComponentMixin'); <ide> var ReactCompositeComponent = require('ReactCompositeComponent'); <ide> var ReactDOM = require('ReactDOM'); <add>var ReactUpdates = require('ReactUpdates'); <ide> <ide> var invariant = require('invariant'); <ide> var merge = require('merge'); <ide> var warning = require('warning'); <ide> // Store a reference to the <textarea> `ReactDOMComponent`. <ide> var textarea = ReactDOM.textarea; <ide> <add>function forceUpdateIfMounted() { <add> /*jshint validthis:true */ <add> if (this.isMounted()) { <add> this.forceUpdate(); <add> } <add>} <add> <ide> /** <ide> * Implements a <textarea> native component that allows setting `value`, and <ide> * `defaultValue`. This differs from the traditional DOM API because value is <ide> var ReactDOMTextarea = ReactCompositeComponent.createClass({ <ide> }; <ide> }, <ide> <del> shouldComponentUpdate: function() { <del> // Defer any updates to this component during the `onChange` handler. <del> return !this._isChanging; <del> }, <del> <ide> render: function() { <ide> // Clone `this.props` so we don't mutate the input. <ide> var props = merge(this.props); <ide> var ReactDOMTextarea = ReactCompositeComponent.createClass({ <ide> var returnValue; <ide> var onChange = LinkedValueUtils.getOnChange(this); <ide> if (onChange) { <del> this._isChanging = true; <ide> returnValue = onChange.call(this, event); <del> this._isChanging = false; <ide> } <del> this.setState({value: event.target.value}); <add> ReactUpdates.setImmediate(forceUpdateIfMounted, this); <ide> return returnValue; <ide> } <ide>
3
Javascript
Javascript
remove redundant version from test sandbox
67dce478dabaabf0f291556d51803b0c3ab1fae6
<ide><path>test/load.js <ide> process.env.TZ = "America/Los_Angeles"; <ide> <ide> var smash = require("smash"), <del> jsdom = require("jsdom"), <del> version = require("../package.json").version; <add> jsdom = require("jsdom"); <ide> <ide> require("./XMLHttpRequest"); <ide> <ide> module.exports = function() { <ide> var files = [].slice.call(arguments).map(function(d) { return "src/" + d; }), <ide> expression = "d3", <del> sandbox = {VERSION: version}; <add> sandbox = null; <ide> <ide> files.unshift("src/start"); <ide> files.push("src/end"); <ide> module.exports = function() { <ide> }; <ide> <ide> sandbox = { <del> VERSION: version, <ide> console: console, <ide> XMLHttpRequest: XMLHttpRequest, <ide> document: document,
1
Ruby
Ruby
favor composition over inheritance
b14f1c3ad72f7aeef4f725637b835da56bcd7d39
<ide><path>actionpack/lib/action_view/path_set.rb <ide> module ActionView #:nodoc: <ide> # = Action View PathSet <del> class PathSet < Array #:nodoc: <del> %w(initialize << concat insert push unshift).each do |method| <add> class PathSet #:nodoc: <add> include Enumerable <add> <add> attr_reader :paths <add> <add> def initialize(paths = []) <add> @paths = paths <add> typecast! <add> end <add> <add> def initialize_copy(other) <add> @paths = other.paths.dup <add> self <add> end <add> <add> def to_ary <add> paths.dup <add> end <add> <add> def +(array) <add> PathSet.new(paths + array) <add> end <add> <add> def include?(item) <add> paths.include? item <add> end <add> <add> def pop <add> paths.pop <add> end <add> <add> def size <add> paths.size <add> end <add> <add> def compact <add> PathSet.new paths.compact <add> end <add> <add> def each(&block) <add> paths.each(&block) <add> end <add> <add> %w(<< concat push insert unshift).each do |method| <ide> class_eval <<-METHOD, __FILE__, __LINE__ + 1 <ide> def #{method}(*args) <del> super <add> paths.#{method}(*args) <ide> typecast! <ide> end <ide> METHOD <ide> def find(*args) <ide> def find_all(path, prefixes = [], *args) <ide> prefixes = [prefixes] if String === prefixes <ide> prefixes.each do |prefix| <del> each do |resolver| <add> paths.each do |resolver| <ide> templates = resolver.find_all(path, prefix, *args) <ide> return templates unless templates.empty? <ide> end <ide> def exists?(path, prefixes, *args) <ide> protected <ide> <ide> def typecast! <del> each_with_index do |path, i| <add> paths.each_with_index do |path, i| <ide> path = path.to_s if path.is_a?(Pathname) <ide> next unless path.is_a?(String) <del> self[i] = OptimizedFileSystemResolver.new(path) <add> paths[i] = OptimizedFileSystemResolver.new(path) <ide> end <ide> end <ide> end
1
Javascript
Javascript
remove unused var
5ac298f764f417d64bfd8e7b85322bfcdcd7940e
<ide><path>packages/ember-runtime/lib/system/core_object.js <ide> function makeCtor() { <ide> // method a lot faster. This is glue code so we want it to be as fast as <ide> // possible. <ide> <del> var wasApplied = false, initMixins, init = false; <add> var wasApplied = false, initMixins; <ide> <ide> var Class = function() { <ide> if (!wasApplied) {
1
Python
Python
fix model parallelism test
98f6e1ee87e83355affd7951d7d69347e1945294
<ide><path>tests/test_modeling_common.py <ide> def check_device_map_is_respected(self, model, device_map): <ide> @require_torch_gpu <ide> def test_cpu_offload(self): <ide> config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common() <del> if config.num_hidden_layers < 5: <add> if isinstance(getattr(config, "num_hidden_layers", None), int) and config.num_hidden_layers < 5: <ide> config.num_hidden_layers = 5 <ide> <ide> for model_class in self.all_model_classes: <ide> def test_cpu_offload(self): <ide> @require_torch_multi_gpu <ide> def test_model_parallelism(self): <ide> config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common() <del> if config.num_hidden_layers < 5: <add> if isinstance(getattr(config, "num_hidden_layers", None), int) and config.num_hidden_layers < 5: <ide> config.num_hidden_layers = 5 <ide> <ide> for model_class in self.all_model_classes:
1
Go
Go
fix race in setting plugin refcounts
4c088d1e2ebfcc384a365734017988f4fd1c4605
<ide><path>plugin/store/store.go <ide> func (ps *Store) Get(name, capability string, mode int) (plugingetter.CompatPlug <ide> } <ide> p, err = ps.GetByName(fullName) <ide> if err == nil { <del> p.SetRefCount(mode + p.GetRefCount()) <add> p.AddRefCount(mode) <ide> if p.IsEnabled() { <ide> return p.FilterByCap(capability) <ide> } <ide><path>plugin/v2/plugin.go <ide> func (p *Plugin) GetRefCount() int { <ide> return p.refCount <ide> } <ide> <del>// SetRefCount sets the reference count. <del>func (p *Plugin) SetRefCount(count int) { <add>// AddRefCount adds to reference count. <add>func (p *Plugin) AddRefCount(count int) { <ide> p.mu.Lock() <ide> defer p.mu.Unlock() <ide> <del> p.refCount = count <add> p.refCount += count <ide> } <ide> <ide> // InitSpec creates an OCI spec from the plugin's config.
2
Python
Python
catch error message in docker plugin
80db8225c4257889be303deeaa3872566bc7e387
<ide><path>glances/plugins/glances_docker.py <ide> def get_export(self): <ide> <ide> def connect(self): <ide> """Connect to the Docker server.""" <del> if import_error_tag: <del> return None <add> try: <add> ret = docker.from_env() <add> except Exception as e: <add> logger.error("docker plugin - Can not connect to Docker ({})".format(e)) <add> ret = None <ide> <del> return docker.from_env() <add> return ret <ide> <ide> def reset(self): <ide> """Reset/init the stats."""
1
Python
Python
use tf.eye(), instead of np.eye()
e87384eddf463e4cf4a7f4f3e881634fafc480ee
<ide><path>keras/backend/tensorflow_backend.py <ide> def eye(size, dtype=None, name=None): <ide> ``` <ide> <ide> """ <del> return variable(np.eye(size), dtype, name) <add> if dtype is None: <add> dtype = floatx() <add> tf_dtype = tf.as_dtype(dtype) <add> return variable(tf.eye(size, dtype=tf_dtype), dtype, name) <ide> <ide> <ide> def zeros_like(x, dtype=None, name=None):
1
Python
Python
move matrix tests in core, polynomial to matrixlib
d7e0c7e34b293ab32a46960c65d063446115d4e8
<ide><path>numpy/core/fromnumeric.py <ide> def diagonal(a, offset=0, axis1=0, axis2=1): <ide> Returns <ide> ------- <ide> array_of_diagonals : ndarray <del> If `a` is 2-D and not a `matrix`, a 1-D array of the same type as `a` <del> containing the diagonal is returned. If `a` is a `matrix`, a 1-D <add> If `a` is 2-D, a 1-D array of the same type as `a` containing the <add> diagonal is returned (except if `a` is a `matrix`, in which case a 1-D <ide> array containing the diagonal is returned in order to maintain <del> backward compatibility. <add> backward compatibility). <ide> If ``a.ndim > 2``, then the dimensions specified by `axis1` and `axis2` <ide> are removed, and a new axis inserted at the end corresponding to the <ide> diagonal. <ide> def ravel(a, order='C'): <ide> Returns <ide> ------- <ide> y : array_like <del> If `a` is a matrix, y is a 1-D ndarray, otherwise y is an array of <del> the same subtype as `a`. The shape of the returned array is <del> ``(a.size,)``. Matrices are special cased for backward <del> compatibility. <add> y is an array of the same subtype as `a`, with shape ``(a.size,)`` <add> (Note: matrices are special-cases for backward compatibility: if `a` <add> is a matrix, y is a 1-D ndarray.) <ide> <ide> See Also <ide> -------- <ide><path>numpy/core/numeric.py <ide> def asarray(a, dtype=None, order=None): <ide> <ide> Contrary to `asanyarray`, ndarray subclasses are not passed through: <ide> <del> >>> issubclass(np.matrix, np.ndarray) <add> >>> issubclass(np.recarray, np.ndarray) <ide> True <del> >>> a = np.matrix([[1, 2]]) <add> >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) <ide> >>> np.asarray(a) is a <ide> False <ide> >>> np.asanyarray(a) is a <ide> def asanyarray(a, dtype=None, order=None): <ide> <ide> Instances of `ndarray` subclasses are passed through as-is: <ide> <del> >>> a = np.matrix([1, 2]) <add> >>> a = np.array([(1.0, 2), (3.0, 4)], dtype='f4,i4').view(np.recarray) <ide> >>> np.asanyarray(a) is a <ide> True <ide> <ide> def isclose(a, b, rtol=1.e-5, atol=1.e-8, equal_nan=False): <ide> relative difference (`rtol` * abs(`b`)) and the absolute difference <ide> `atol` are added together to compare against the absolute difference <ide> between `a` and `b`. <del> <add> <ide> .. warning:: The default `atol` is not appropriate for comparing numbers <ide> that are much smaller than one (see Notes). <ide> <ide><path>numpy/core/tests/test_api.py <ide> def test_array_astype(): <ide> b = a.astype('f4', subok=0, copy=False) <ide> assert_(a is b) <ide> <del> a = np.matrix([[0, 1, 2], [3, 4, 5]], dtype='f4') <add> class MyNDArray(np.ndarray): <add> pass <ide> <del> # subok=True passes through a matrix <add> a = np.array([[0, 1, 2], [3, 4, 5]], dtype='f4').view(MyNDArray) <add> <add> # subok=True passes through a subclass <ide> b = a.astype('f4', subok=True, copy=False) <ide> assert_(a is b) <ide> <ide> # subok=True is default, and creates a subtype on a cast <ide> b = a.astype('i4', copy=False) <ide> assert_equal(a, b) <del> assert_equal(type(b), np.matrix) <add> assert_equal(type(b), MyNDArray) <ide> <del> # subok=False never returns a matrix <add> # subok=False never returns a subclass <ide> b = a.astype('f4', subok=False, copy=False) <ide> assert_equal(a, b) <ide> assert_(not (a is b)) <del> assert_(type(b) is not np.matrix) <add> assert_(type(b) is not MyNDArray) <ide> <ide> # Make sure converting from string object to fixed length string <ide> # does not truncate. <ide><path>numpy/core/tests/test_indexing.py <ide> class SubClass(np.ndarray): <ide> assert_(isinstance(s[[0, 1, 2]], SubClass)) <ide> assert_(isinstance(s[s > 0], SubClass)) <ide> <del> def test_matrix_fancy(self): <del> # The matrix class messes with the shape. While this is always <del> # weird (getitem is not used, it does not have setitem nor knows <del> # about fancy indexing), this tests gh-3110 <del> m = np.matrix([[1, 2], [3, 4]]) <del> <del> assert_(isinstance(m[[0,1,0], :], np.matrix)) <del> <del> # gh-3110. Note the transpose currently because matrices do *not* <del> # support dimension fixing for fancy indexing correctly. <del> x = np.asmatrix(np.arange(50).reshape(5,10)) <del> assert_equal(x[:2, np.array(-1)], x[:2, -1].T) <del> <ide> def test_finalize_gets_full_info(self): <ide> # Array finalize should be called on the filled array. <ide> class SubClass(np.ndarray): <ide><path>numpy/core/tests/test_multiarray.py <ide> def test_sort_order(self): <ide> assert_equal(r, np.array([('a', 1), ('c', 3), ('b', 255), ('d', 258)], <ide> dtype=mydtype)) <ide> <del> def test_sort_matrix_none(self): <del> a = np.matrix([[2, 1, 0]]) <del> actual = np.sort(a, axis=None) <del> expected = np.matrix([[0, 1, 2]]) <del> assert_equal(actual, expected) <del> assert_(type(expected) is np.matrix) <del> <ide> def test_argsort(self): <ide> # all c scalar argsorts use the same code with different types <ide> # so it suffices to run a quick check with one type. The number <ide> def test_partition_fuzz(self): <ide> assert_array_equal(np.partition(d, kth)[kth], tgt, <ide> err_msg="data: %r\n kth: %r" % (d, kth)) <ide> <del> def test_partition_matrix_none(self): <del> # gh-4301 <del> a = np.matrix([[2, 1, 0]]) <del> actual = np.partition(a, 1, axis=None) <del> expected = np.matrix([[0, 1, 2]]) <del> assert_equal(actual, expected) <del> assert_(type(expected) is np.matrix) <del> <ide> def test_argpartition_gh5524(self): <ide> # A test for functionality of argpartition on lists. <ide> d = [6,7,3,2,9,0] <ide> def test_dot_array_order(self): <ide> assert_equal(np.dot(b, a), res) <ide> assert_equal(np.dot(b, b), res) <ide> <del> def test_dot_scalar_and_matrix_of_objects(self): <del> # Ticket #2469 <del> arr = np.matrix([1, 2], dtype=object) <del> desired = np.matrix([[3, 6]], dtype=object) <del> assert_equal(np.dot(arr, 3), desired) <del> assert_equal(np.dot(3, arr), desired) <del> <ide> def test_accelerate_framework_sgemv_fix(self): <ide> <ide> def aligned_array(shape, align, dtype, order='C'): <ide> def test_inner_scalar_and_vector(self): <ide> assert_equal(np.inner(vec, sca), desired) <ide> assert_equal(np.inner(sca, vec), desired) <ide> <del> def test_inner_scalar_and_matrix(self): <del> for dt in np.typecodes['AllInteger'] + np.typecodes['AllFloat'] + '?': <del> sca = np.array(3, dtype=dt)[()] <del> arr = np.matrix([[1, 2], [3, 4]], dtype=dt) <del> desired = np.matrix([[3, 6], [9, 12]], dtype=dt) <del> assert_equal(np.inner(arr, sca), desired) <del> assert_equal(np.inner(sca, arr), desired) <del> <del> def test_inner_scalar_and_matrix_of_objects(self): <del> # Ticket #4482 <del> arr = np.matrix([1, 2], dtype=object) <del> desired = np.matrix([[3, 6]], dtype=object) <del> assert_equal(np.inner(arr, 3), desired) <del> assert_equal(np.inner(3, arr), desired) <del> <ide> def test_vecself(self): <ide> # Ticket 844. <ide> # Inner product of a vector with itself segfaults or give <ide><path>numpy/core/tests/test_nditer.py <ide> def test_iter_allocate_output_types_scalar(): <ide> <ide> def test_iter_allocate_output_subtype(): <ide> # Make sure that the subtype with priority wins <add> class MyNDArray(np.ndarray): <add> __array_priority__ = 15 <ide> <del> # matrix vs ndarray <del> a = np.matrix([[1, 2], [3, 4]]) <add> # subclass vs ndarray <add> a = np.array([[1, 2], [3, 4]]).view(MyNDArray) <ide> b = np.arange(4).reshape(2, 2).T <ide> i = nditer([a, b, None], [], <del> [['readonly'], ['readonly'], ['writeonly', 'allocate']]) <add> [['readonly'], ['readonly'], ['writeonly', 'allocate']]) <ide> assert_equal(type(a), type(i.operands[2])) <del> assert_(type(b) != type(i.operands[2])) <add> assert_(type(b) is not type(i.operands[2])) <ide> assert_equal(i.operands[2].shape, (2, 2)) <ide> <del> # matrix always wants things to be 2D <del> b = np.arange(4).reshape(1, 2, 2) <del> assert_raises(RuntimeError, nditer, [a, b, None], [], <del> [['readonly'], ['readonly'], ['writeonly', 'allocate']]) <del> # but if subtypes are disabled, the result can still work <add> # If subtypes are disabled, we should get back an ndarray. <ide> i = nditer([a, b, None], [], <del> [['readonly'], ['readonly'], ['writeonly', 'allocate', 'no_subtype']]) <add> [['readonly'], ['readonly'], <add> ['writeonly', 'allocate', 'no_subtype']]) <ide> assert_equal(type(b), type(i.operands[2])) <del> assert_(type(a) != type(i.operands[2])) <del> assert_equal(i.operands[2].shape, (1, 2, 2)) <add> assert_(type(a) is not (i.operands[2])) <add> assert_equal(i.operands[2].shape, (2, 2)) <ide> <ide> def test_iter_allocate_output_errors(): <ide> # Check that the iterator will throw errors for bad output allocations <ide><path>numpy/core/tests/test_numeric.py <ide> def test_can_cast_values(self): <ide> fi = np.finfo(dt) <ide> assert_(np.can_cast(fi.min, dt)) <ide> assert_(np.can_cast(fi.max, dt)) <del> <add> <ide> <ide> # Custom exception class to test exception propagation in fromiter <ide> class NIterError(Exception): <ide> def check_like_function(self, like_function, value, fill_value=False): <ide> self.compare_array_value(dz, value, fill_value) <ide> <ide> # Test the 'subok' parameter <del> a = np.matrix([[1, 2], [3, 4]]) <add> class MyNDArray(np.ndarray): <add> pass <add> <add> a = np.array([[1, 2], [3, 4]]).view(MyNDArray) <ide> <ide> b = like_function(a, **fill_kwarg) <del> assert_(type(b) is np.matrix) <add> assert_(type(b) is MyNDArray) <ide> <ide> b = like_function(a, subok=False, **fill_kwarg) <del> assert_(type(b) is not np.matrix) <add> assert_(type(b) is not MyNDArray) <ide> <ide> def test_ones_like(self): <ide> self.check_like_function(np.ones_like, 1) <ide><path>numpy/core/tests/test_shape_base.py <ide> def test_stack(): <ide> stack, [np.zeros((3, 3)), np.zeros(3)], axis=1) <ide> assert_raises_regex(ValueError, 'must have the same shape', <ide> stack, [np.arange(2), np.arange(3)]) <del> # np.matrix <del> m = np.matrix([[1, 2], [3, 4]]) <del> assert_raises_regex(ValueError, 'shape too large to be a matrix', <del> stack, [m, m]) <ide> <ide> <ide> class TestBlock(object): <ide><path>numpy/core/tests/test_ufunc.py <ide> def test_object_array_reduceat_inplace(self): <ide> np.add.reduceat(arr, np.arange(4), out=arr, axis=-1) <ide> assert_array_equal(arr, out) <ide> <del> def test_object_scalar_multiply(self): <del> # Tickets #2469 and #4482 <del> arr = np.matrix([1, 2], dtype=object) <del> desired = np.matrix([[3, 6]], dtype=object) <del> assert_equal(np.multiply(arr, 3), desired) <del> assert_equal(np.multiply(3, arr), desired) <del> <ide> def test_zerosize_reduction(self): <ide> # Test with default dtype and object dtype <ide> for a in [[], np.array([], dtype=object)]: <ide><path>numpy/core/tests/test_umath.py <ide> def __array__(self): <ide> assert_equal(ncu.maximum(a, C()), 0) <ide> <ide> def test_ufunc_override(self): <del> <add> # check override works even with instance with high priority. <ide> class A(object): <ide> def __array_ufunc__(self, func, method, *inputs, **kwargs): <ide> return self, func, method, inputs, kwargs <ide> <add> class MyNDArray(np.ndarray): <add> __array_priority__ = 100 <add> <ide> a = A() <del> b = np.matrix([1]) <add> b = np.array([1]).view(MyNDArray) <ide> res0 = np.multiply(a, b) <ide> res1 = np.multiply(b, b, out=a) <ide> <ide><path>numpy/matrixlib/tests/test_interaction.py <add>"""Tests of interaction of matrix with other parts of numpy. <add> <add>Note that tests with MaskedArray and linalg are done in separate files. <add>""" <add>from __future__ import division, absolute_import, print_function <add> <add>import numpy as np <add>from numpy.testing import (assert_, assert_equal, assert_raises, <add> assert_raises_regex) <add> <add> <add>def test_fancy_indexing(): <add> # The matrix class messes with the shape. While this is always <add> # weird (getitem is not used, it does not have setitem nor knows <add> # about fancy indexing), this tests gh-3110 <add> # 2018-04-29: moved here from core.tests.test_index. <add> m = np.matrix([[1, 2], [3, 4]]) <add> <add> assert_(isinstance(m[[0, 1, 0], :], np.matrix)) <add> <add> # gh-3110. Note the transpose currently because matrices do *not* <add> # support dimension fixing for fancy indexing correctly. <add> x = np.asmatrix(np.arange(50).reshape(5, 10)) <add> assert_equal(x[:2, np.array(-1)], x[:2, -1].T) <add> <add> <add>def test_polynomial_mapdomain(): <add> # test that polynomial preserved matrix subtype. <add> # 2018-04-29: moved here from polynomial.tests.polyutils. <add> dom1 = [0, 4] <add> dom2 = [1, 3] <add> x = np.matrix([dom1, dom1]) <add> res = np.polynomial.mapdomain(x, dom1, dom2) <add> assert_(isinstance(res, np.matrix)) <add> <add> <add>def test_sort_matrix_none(): <add> # 2018-04-29: moved here from core.tests.test_multiarray <add> a = np.matrix([[2, 1, 0]]) <add> actual = np.sort(a, axis=None) <add> expected = np.matrix([[0, 1, 2]]) <add> assert_equal(actual, expected) <add> assert_(type(expected) is np.matrix) <add> <add> <add>def test_partition_matrix_none(): <add> # gh-4301 <add> # 2018-04-29: moved here from core.tests.test_multiarray <add> a = np.matrix([[2, 1, 0]]) <add> actual = np.partition(a, 1, axis=None) <add> expected = np.matrix([[0, 1, 2]]) <add> assert_equal(actual, expected) <add> assert_(type(expected) is np.matrix) <add> <add> <add>def test_dot_scalar_and_matrix_of_objects(): <add> # Ticket #2469 <add> # 2018-04-29: moved here from core.tests.test_multiarray <add> arr = np.matrix([1, 2], dtype=object) <add> desired = np.matrix([[3, 6]], dtype=object) <add> assert_equal(np.dot(arr, 3), desired) <add> assert_equal(np.dot(3, arr), desired) <add> <add> <add>def test_inner_scalar_and_matrix(): <add> # 2018-04-29: moved here from core.tests.test_multiarray <add> for dt in np.typecodes['AllInteger'] + np.typecodes['AllFloat'] + '?': <add> sca = np.array(3, dtype=dt)[()] <add> arr = np.matrix([[1, 2], [3, 4]], dtype=dt) <add> desired = np.matrix([[3, 6], [9, 12]], dtype=dt) <add> assert_equal(np.inner(arr, sca), desired) <add> assert_equal(np.inner(sca, arr), desired) <add> <add> <add>def test_inner_scalar_and_matrix_of_objects(self): <add> # Ticket #4482 <add> # 2018-04-29: moved here from core.tests.test_multiarray <add> arr = np.matrix([1, 2], dtype=object) <add> desired = np.matrix([[3, 6]], dtype=object) <add> assert_equal(np.inner(arr, 3), desired) <add> assert_equal(np.inner(3, arr), desired) <add> <add> <add>def test_iter_allocate_output_subtype(): <add> # Make sure that the subtype with priority wins <add> # 2018-04-29: moved here from core.tests.test_nditer, given the <add> # matrix specific shape test. <add> <add> # matrix vs ndarray <add> a = np.matrix([[1, 2], [3, 4]]) <add> b = np.arange(4).reshape(2, 2).T <add> i = np.nditer([a, b, None], [], <add> [['readonly'], ['readonly'], ['writeonly', 'allocate']]) <add> assert_(type(i.operands[2]) is np.matrix) <add> assert_(type(i.operands[2]) is not np.ndarray) <add> assert_equal(i.operands[2].shape, (2, 2)) <add> <add> # matrix always wants things to be 2D <add> b = np.arange(4).reshape(1, 2, 2) <add> assert_raises(RuntimeError, np.nditer, [a, b, None], [], <add> [['readonly'], ['readonly'], ['writeonly', 'allocate']]) <add> # but if subtypes are disabled, the result can still work <add> i = np.nditer([a, b, None], [], <add> [['readonly'], ['readonly'], <add> ['writeonly', 'allocate', 'no_subtype']]) <add> assert_(type(i.operands[2]) is np.ndarray) <add> assert_(type(i.operands[2]) is not np.matrix) <add> assert_equal(i.operands[2].shape, (1, 2, 2)) <add> <add> <add>def like_function(): <add> # 2018-04-29: moved here from core.tests.test_numeric <add> a = np.matrix([[1, 2], [3, 4]]) <add> for like_function in np.zeros_like, np.ones_like, np.empty_like: <add> b = like_function(a) <add> assert_(type(b) is np.matrix) <add> <add> c = like_function(a, subok=False) <add> assert_(type(c) is not np.matrix) <add> <add> <add>def test_array_astype(): <add> # 2018-04-29: copied here from core.tests.test_api <add> # subok=True passes through a matrix <add> a = np.matrix([[0, 1, 2], [3, 4, 5]], dtype='f4') <add> b = a.astype('f4', subok=True, copy=False) <add> assert_(a is b) <add> <add> # subok=True is default, and creates a subtype on a cast <add> b = a.astype('i4', copy=False) <add> assert_equal(a, b) <add> assert_equal(type(b), np.matrix) <add> <add> # subok=False never returns a matrix <add> b = a.astype('f4', subok=False, copy=False) <add> assert_equal(a, b) <add> assert_(not (a is b)) <add> assert_(type(b) is not np.matrix) <add> <add> <add>def test_stack(): <add> # 2018-04-29: copied here from core.tests.test_shape_base <add> # check np.matrix cannot be stacked <add> m = np.matrix([[1, 2], [3, 4]]) <add> assert_raises_regex(ValueError, 'shape too large to be a matrix', <add> np.stack, [m, m]) <add> <add> <add>def test_object_scalar_multiply(): <add> # Tickets #2469 and #4482 <add> # 2018-04-29: moved here from core.tests.test_ufunc <add> arr = np.matrix([1, 2], dtype=object) <add> desired = np.matrix([[3, 6]], dtype=object) <add> assert_equal(np.multiply(arr, 3), desired) <add> assert_equal(np.multiply(3, arr), desired) <ide><path>numpy/polynomial/tests/test_polyutils.py <ide> def test_mapdomain(self): <ide> dom1 = [0, 4] <ide> dom2 = [1, 3] <ide> tgt = dom2 <del> res = pu. mapdomain(dom1, dom1, dom2) <add> res = pu.mapdomain(dom1, dom1, dom2) <ide> assert_almost_equal(res, tgt) <ide> <ide> # test for complex values <ide> def test_mapdomain(self): <ide> assert_almost_equal(res, tgt) <ide> <ide> # test that subtypes are preserved. <add> class MyNDArray(np.ndarray): <add> pass <add> <ide> dom1 = [0, 4] <ide> dom2 = [1, 3] <del> x = np.matrix([dom1, dom1]) <add> x = np.array([dom1, dom1]).view(MyNDArray) <ide> res = pu.mapdomain(x, dom1, dom2) <del> assert_(isinstance(res, np.matrix)) <add> assert_(isinstance(res, MyNDArray)) <ide> <ide> def test_mapparms(self): <ide> # test for real values
12
Ruby
Ruby
fix blob associations
3eb8c89c0410fac34aefc8b89b8c6b5901c39415
<ide><path>lib/active_storage/attached/macros.rb <ide> def has_one_attached(name, dependent: :purge_later) <ide> end <ide> <ide> has_one :"#{name}_attachment", -> { where(name: name) }, class_name: "ActiveStorage::Attachment", as: :record <del> has_one :"#{name}_blob", through: :"#{name}_attachment" <add> has_one :"#{name}_blob", through: :"#{name}_attachment", class_name: "ActiveStorage::Blob", source: :blob <ide> <ide> if dependent == :purge_later <ide> before_destroy { public_send(name).purge_later } <ide> def has_many_attached(name, dependent: :purge_later) <ide> end <ide> <ide> has_many :"#{name}_attachments", -> { where(name: name) }, as: :record, class_name: "ActiveStorage::Attachment" <del> has_many :"#{name}_blobs", through: :"#{name}_attachments" <add> has_many :"#{name}_blobs", through: :"#{name}_attachments", class_name: "ActiveStorage::Blob", source: :blob <ide> <ide> scope :"with_attached_#{name}", -> { includes("#{name}_attachments": :blob) } <ide> <ide><path>test/models/attachments_test.rb <ide> class ActiveStorage::AttachmentsTest < ActiveSupport::TestCase <ide> assert_equal "town.jpg", @user.avatar.filename.to_s <ide> end <ide> <add> test "access underlying associations of new blob" do <add> @user.avatar.attach create_blob(filename: "funky.jpg") <add> assert_equal @user, @user.avatar_attachment.record <add> assert_equal @user.avatar_attachment.blob, @user.avatar_blob <add> assert_equal "funky.jpg", @user.avatar_attachment.blob.filename.to_s <add> end <add> <ide> test "purge attached blob" do <ide> @user.avatar.attach create_blob(filename: "funky.jpg") <ide> avatar_key = @user.avatar.key <ide> class ActiveStorage::AttachmentsTest < ActiveSupport::TestCase <ide> assert_equal "country.jpg", highlights.second.filename.to_s <ide> end <ide> <add> test "access underlying associations of new blobs" do <add> @user.highlights.attach( <add> { io: StringIO.new("STUFF"), filename: "town.jpg", content_type: "image/jpg" }, <add> { io: StringIO.new("IT"), filename: "country.jpg", content_type: "image/jpg" }) <add> <add> assert_equal @user, @user.highlights_attachments.first.record <add> assert_equal @user.highlights_attachments.collect(&:blob).sort, @user.highlights_blobs.sort <add> assert_equal "town.jpg", @user.highlights_attachments.first.blob.filename.to_s <add> end <add> <add> <ide> test "purge attached blobs" do <ide> @user.highlights.attach create_blob(filename: "funky.jpg"), create_blob(filename: "wonky.jpg") <ide> highlight_keys = @user.highlights.collect(&:key) <ide><path>test/test_helper.rb <ide> {} <ide> end <ide> <add>require "active_storage/blob" <ide> require "active_storage/service/disk_service" <ide> require "tmpdir" <ide> ActiveStorage::Blob.service = ActiveStorage::Service::DiskService.new(root: Dir.mktmpdir("active_storage_tests"))
3
Javascript
Javascript
deploy suppressions ahead of 0.183.0 to xplat
a333eb2ac54a86d9b2dd49b4ea5508d6177a4d08
<ide><path>Libraries/Image/Image.ios.js <ide> const BaseImage = (props: ImagePropsType, forwardedRef) => { <ide> } <ide> } <ide> <add> // $FlowFixMe[prop-missing] <ide> const resizeMode = props.resizeMode || style.resizeMode || 'cover'; <add> // $FlowFixMe[prop-missing] <ide> const tintColor = style.tintColor; <ide> <ide> if (props.src != null) { <ide><path>Libraries/StyleSheet/splitLayoutProps.js <ide> export default function splitLayoutProps(props: ?____ViewStyle_Internal): { <ide> case 'transform': <ide> // $FlowFixMe[cannot-write] <ide> // $FlowFixMe[incompatible-use] <add> // $FlowFixMe[prop-missing] <ide> outer[prop] = props[prop]; <ide> break; <ide> default: <ide> // $FlowFixMe[cannot-write] <ide> // $FlowFixMe[incompatible-use] <add> // $FlowFixMe[prop-missing] <ide> inner[prop] = props[prop]; <ide> break; <ide> }
2
Java
Java
fix warnings due to unused import statements
731d5be6440a400aca2fb92c5c6d6b17d252879e
<ide><path>spring-beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java <ide> import java.beans.PropertyChangeEvent; <ide> import java.beans.PropertyDescriptor; <ide> import java.lang.reflect.Array; <del>import java.lang.reflect.Field; <ide> import java.lang.reflect.InvocationTargetException; <ide> import java.lang.reflect.Method; <ide> import java.lang.reflect.Modifier; <ide> <ide> import org.springframework.core.CollectionFactory; <ide> import org.springframework.core.GenericCollectionTypeResolver; <del>import org.springframework.core.MethodParameter; <ide> import org.springframework.core.convert.ConversionException; <ide> import org.springframework.core.convert.ConverterNotFoundException; <ide> import org.springframework.core.convert.Property; <ide><path>spring-beans/src/main/java/org/springframework/beans/DirectFieldAccessor.java <ide> <ide> package org.springframework.beans; <ide> <del>import org.springframework.core.MethodParameter; <ide> import org.springframework.core.convert.ConversionException; <ide> import org.springframework.core.convert.ConverterNotFoundException; <ide> import org.springframework.core.convert.TypeDescriptor; <ide><path>spring-beans/src/test/java/org/springframework/beans/factory/xml/DelegatingEntityResolverTests.java <ide> <ide> package org.springframework.beans.factory.xml; <ide> <del>import junit.framework.TestCase; <del> <ide> import org.junit.Test; <ide> import org.xml.sax.EntityResolver; <ide> import org.xml.sax.InputSource; <ide><path>spring-beans/src/test/java/org/springframework/beans/factory/xml/SimpleConstructorNamespaceHandlerTests.java <ide> <ide> import org.junit.Test; <ide> import org.springframework.beans.factory.BeanDefinitionStoreException; <del>import org.springframework.core.LocalVariableTableParameterNameDiscoverer; <ide> import org.springframework.core.io.ClassPathResource; <ide> <ide> import test.beans.DummyBean; <ide><path>spring-beans/src/test/java/org/springframework/beans/support/PagedListHolderTests.java <ide> package org.springframework.beans.support; <ide> <ide> import java.util.ArrayList; <del>import java.util.HashMap; <del>import java.util.Iterator; <ide> import java.util.List; <del>import java.util.Locale; <del>import java.util.Map; <del> <ide> import junit.framework.TestCase; <ide> <del>import org.springframework.beans.BeanWrapper; <del>import org.springframework.beans.BeanWrapperImpl; <del> <ide> import test.beans.TestBean; <ide> <ide> /** <ide><path>spring-context/src/main/java/org/springframework/context/annotation/AutoProxyRegistrar.java <ide> <ide> import static org.springframework.context.annotation.MetadataUtils.attributesFor; <ide> <del>import java.util.Map; <ide> import java.util.Set; <ide> <ide> import org.apache.commons.logging.Log; <ide><path>spring-context/src/main/java/org/springframework/context/annotation/DependsOn.java <ide> import java.lang.annotation.ElementType; <ide> import java.lang.annotation.Retention; <ide> import java.lang.annotation.RetentionPolicy; <del>import java.lang.annotation.Inherited; <ide> import java.lang.annotation.Documented; <ide> <ide> /** <ide><path>spring-context/src/main/java/org/springframework/context/support/AbstractRefreshableApplicationContext.java <ide> import org.springframework.beans.factory.support.DefaultListableBeanFactory; <ide> import org.springframework.context.ApplicationContext; <ide> import org.springframework.context.ApplicationContextException; <del>import org.springframework.core.LocalVariableTableParameterNameDiscoverer; <ide> <ide> /** <ide> * Base class for {@link org.springframework.context.ApplicationContext} <ide><path>spring-context/src/main/java/org/springframework/context/support/GenericApplicationContext.java <ide> import org.springframework.beans.factory.support.BeanDefinitionRegistry; <ide> import org.springframework.beans.factory.support.DefaultListableBeanFactory; <ide> import org.springframework.context.ApplicationContext; <del>import org.springframework.core.LocalVariableTableParameterNameDiscoverer; <ide> import org.springframework.core.io.Resource; <ide> import org.springframework.core.io.ResourceLoader; <ide> import org.springframework.core.io.support.ResourcePatternResolver; <ide><path>spring-context/src/main/java/org/springframework/remoting/support/RemoteInvocationUtils.java <ide> import java.util.HashSet; <ide> import java.util.Set; <ide> <del>import org.springframework.core.JdkVersion; <del> <ide> /** <ide> * General utilities for handling remote invocations. <ide> * <ide><path>spring-context/src/main/java/org/springframework/scheduling/concurrent/ConcurrentTaskExecutor.java <ide> <ide> import java.util.concurrent.Callable; <ide> import java.util.concurrent.Executor; <del>import java.util.concurrent.ExecutorService; <ide> import java.util.concurrent.Executors; <ide> import java.util.concurrent.Future; <del>import java.util.concurrent.FutureTask; <del>import java.util.concurrent.RejectedExecutionException; <ide> <del>import org.springframework.core.task.TaskRejectedException; <ide> import org.springframework.core.task.support.TaskExecutorAdapter; <ide> import org.springframework.scheduling.SchedulingTaskExecutor; <ide> <ide><path>spring-context/src/test/java/org/springframework/aop/config/MethodLocatingFactoryBeanTests.java <ide> import java.lang.reflect.Method; <ide> <ide> import static org.easymock.EasyMock.*; <del>import org.junit.After; <ide> import static org.junit.Assert.*; <add>import org.junit.After; <ide> import org.junit.Before; <ide> import org.junit.Test; <ide> <ide><path>spring-context/src/test/java/org/springframework/context/annotation/AnnotationScopeMetadataResolverTests.java <ide> <ide> package org.springframework.context.annotation; <ide> <del>import java.lang.annotation.Documented; <ide> import java.lang.annotation.RetentionPolicy; <ide> import java.lang.annotation.Retention; <ide> import java.lang.annotation.ElementType; <ide><path>spring-context/src/test/java/org/springframework/context/annotation/configuration/BeanMethodQualificationTests.java <ide> <ide> import org.springframework.beans.factory.annotation.Autowired; <ide> import org.springframework.beans.factory.annotation.Qualifier; <del>import org.springframework.context.ApplicationContext; <ide> import org.springframework.context.annotation.AnnotationConfigApplicationContext; <ide> import org.springframework.context.annotation.Bean; <ide> import org.springframework.context.annotation.Configuration; <ide> import org.springframework.context.annotation.Lazy; <del>import org.springframework.context.annotation.Scope; <ide> import org.springframework.stereotype.Component; <ide> <ide> import static org.hamcrest.CoreMatchers.*; <ide><path>spring-context/src/test/java/org/springframework/context/annotation5/OtherFooDao.java <ide> <ide> import example.scannable.FooDao; <ide> <del>import org.springframework.context.annotation.Lazy; <del>import org.springframework.context.annotation.Primary; <del>import org.springframework.stereotype.Repository; <del> <ide> /** <ide> * @author Juergen Hoeller <ide> */ <ide><path>spring-context/src/test/java/org/springframework/context/event/EventPublicationInterceptorTests.java <ide> import static org.easymock.EasyMock.*; <ide> import static org.junit.Assert.assertTrue; <ide> <del>import org.junit.After; <ide> import org.junit.Before; <ide> import org.junit.Test; <ide> import org.springframework.aop.framework.ProxyFactory; <ide><path>spring-context/src/test/java/org/springframework/jmx/export/assembler/AbstractMetadataAssemblerTests.java <ide> <ide> import java.util.HashMap; <ide> import java.util.Map; <del>import java.util.Arrays; <ide> <ide> import javax.management.Descriptor; <ide> import javax.management.MBeanInfo; <ide><path>spring-context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerCustomTests.java <ide> import javax.management.modelmbean.ModelMBeanAttributeInfo; <ide> import javax.management.modelmbean.ModelMBeanInfo; <ide> <del>import org.junit.Ignore; <del> <ide> /** <ide> * @author Rob Harrop <ide> */ <ide><path>spring-context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerMappedTests.java <ide> import javax.management.modelmbean.ModelMBeanAttributeInfo; <ide> import javax.management.modelmbean.ModelMBeanInfo; <ide> <del>import org.junit.Ignore; <del> <ide> /** <ide> * @author Rob Harrop <ide> */ <ide><path>spring-context/src/test/java/org/springframework/mock/jndi/ExpectedLookupTemplate.java <ide> <ide> import javax.naming.NamingException; <ide> <del>import org.springframework.core.CollectionFactory; <ide> import org.springframework.jndi.JndiTemplate; <ide> <ide> /** <ide><path>spring-context/src/test/java/org/springframework/scheduling/concurrent/ScheduledExecutorFactoryBeanTests.java <ide> import org.junit.Test; <ide> import org.springframework.core.task.NoOpRunnable; <ide> <add>import static org.mockito.Mockito.*; <add> <add> <ide> /** <ide> * @author Rick Evans <ide> * @author Juergen Hoeller <ide><path>spring-context/src/test/java/org/springframework/scripting/support/ResourceScriptSourceTests.java <ide> package org.springframework.scripting.support; <ide> <ide> import java.io.ByteArrayInputStream; <del>import java.io.FileNotFoundException; <ide> import java.io.IOException; <ide> <ide> import junit.framework.TestCase; <del>import org.easymock.MockControl; <ide> <add>import org.easymock.MockControl; <ide> import org.springframework.core.io.ByteArrayResource; <ide> import org.springframework.core.io.Resource; <ide> <ide><path>spring-core/src/main/java/org/springframework/core/PrioritizedParameterNameDiscoverer.java <ide> <ide> import java.lang.reflect.Constructor; <ide> import java.lang.reflect.Method; <del>import java.util.Iterator; <ide> import java.util.LinkedList; <ide> import java.util.List; <ide> <ide><path>spring-core/src/main/java/org/springframework/core/io/Resource.java <ide> <ide> import java.io.File; <ide> import java.io.IOException; <del>import java.io.InputStream; <ide> import java.net.URI; <ide> import java.net.URL; <ide> <ide><path>spring-core/src/test/java/org/springframework/core/LocalVariableTableParameterNameDiscovererTests.java <ide> import java.io.PrintStream; <ide> import java.lang.reflect.Constructor; <ide> import java.lang.reflect.Method; <del>import java.util.Arrays; <ide> import java.util.Date; <ide> <ide> import junit.framework.TestCase; <ide> public static long getDate() { <ide> return date; <ide> } <ide> } <del>} <ide>\ No newline at end of file <add>} <ide><path>spring-core/src/test/java/org/springframework/core/type/CachingMetadataReaderLeakTest.java <ide> import org.springframework.core.type.classreading.CachingMetadataReaderFactory; <ide> import org.springframework.core.type.classreading.MetadataReader; <ide> import org.springframework.core.type.classreading.MetadataReaderFactory; <del>import org.springframework.core.type.classreading.SimpleMetadataReaderFactory; <ide> <ide> /** <ide> * Unit test checking the behaviour of {@link CachingMetadataReaderFactory under load. <ide><path>spring-core/src/test/java/org/springframework/util/xml/AbstractStaxXMLReaderTestCase.java <ide> import org.easymock.AbstractMatcher; <ide> import org.easymock.MockControl; <ide> import org.junit.Before; <del>import org.junit.Ignore; <ide> import org.junit.Test; <ide> import org.xml.sax.Attributes; <ide> import org.xml.sax.ContentHandler; <ide><path>spring-expression/src/main/java/org/springframework/expression/spel/ast/AstUtils.java <ide> import java.util.List; <ide> <ide> import org.springframework.expression.PropertyAccessor; <del>import org.springframework.expression.spel.ExpressionState; <ide> <ide> /** <ide> * Utilities methods for use in the Ast classes. <ide><path>spring-jdbc/src/test/java/org/springframework/jdbc/core/JdbcTemplateTests.java <ide> import java.sql.Statement; <ide> import java.sql.Types; <ide> import java.util.ArrayList; <del>import java.util.Collection; <ide> import java.util.LinkedList; <ide> import java.util.List; <ide> import java.util.Map; <ide><path>spring-jdbc/src/test/java/org/springframework/jdbc/support/CustomSQLExceptionTranslatorRegistrarTests.java <ide> package org.springframework.jdbc.support; <ide> <ide> import java.sql.SQLException; <del>import java.util.HashMap; <del>import java.util.Map; <del> <ide> import org.junit.Before; <ide> import org.junit.Test; <ide> <ide><path>spring-jms/src/main/java/org/springframework/jms/listener/AbstractPollingMessageListenerContainer.java <ide> import javax.jms.Session; <ide> import javax.jms.Topic; <ide> <del>import org.springframework.beans.factory.BeanNameAware; <ide> import org.springframework.jms.connection.ConnectionFactoryUtils; <ide> import org.springframework.jms.connection.JmsResourceHolder; <ide> import org.springframework.jms.connection.SingleConnectionFactory; <ide><path>spring-jms/src/test/java/org/springframework/jms/listener/adapter/MessageListenerAdapterTests.java <ide> import javax.jms.Session; <ide> import javax.jms.TextMessage; <ide> <del>import junit.framework.TestCase; <ide> import org.easymock.MockControl; <ide> import org.junit.Test; <ide> <ide><path>spring-jms/src/test/java/org/springframework/jms/listener/adapter/ResponsiveJmsTextMessageReturningMessageDelegate.java <ide> package org.springframework.jms.listener.adapter; <ide> <ide> import javax.jms.TextMessage; <del>import javax.jms.MapMessage; <del>import javax.jms.BytesMessage; <del>import javax.jms.ObjectMessage; <del> <del>import java.util.Map; <del>import java.io.Serializable; <ide> <ide> /** <ide> * See the MessageListenerAdapterTests class for usage. <ide><path>spring-orm/src/main/java/org/springframework/orm/hibernate3/support/AbstractLobType.java <ide> import java.sql.ResultSet; <ide> import java.sql.SQLException; <ide> <del>import javax.transaction.Status; <ide> import javax.transaction.TransactionManager; <ide> <ide> import org.apache.commons.logging.Log; <ide> import org.hibernate.usertype.UserType; <ide> import org.hibernate.util.EqualsHelper; <ide> <del>import org.springframework.dao.DataAccessResourceFailureException; <del>import org.springframework.jdbc.support.lob.JtaLobCreatorSynchronization; <ide> import org.springframework.jdbc.support.lob.LobCreator; <ide> import org.springframework.jdbc.support.lob.LobHandler; <del>import org.springframework.jdbc.support.lob.SpringLobCreatorSynchronization; <ide> import org.springframework.jdbc.support.lob.LobCreatorUtils; <ide> import org.springframework.orm.hibernate3.LocalSessionFactoryBean; <del>import org.springframework.transaction.support.TransactionSynchronizationManager; <ide> <ide> /** <ide> * Abstract base class for Hibernate UserType implementations that map to LOBs. <ide><path>spring-orm/src/main/java/org/springframework/orm/ibatis/SqlMapClientOperations.java <ide> import java.util.List; <ide> import java.util.Map; <ide> <del>import com.ibatis.common.util.PaginatedList; <ide> import com.ibatis.sqlmap.client.event.RowHandler; <ide> <ide> import org.springframework.dao.DataAccessException; <ide><path>spring-orm/src/test/java/org/springframework/mock/jndi/ExpectedLookupTemplate.java <ide> <ide> import javax.naming.NamingException; <ide> <del>import org.springframework.core.CollectionFactory; <ide> import org.springframework.jndi.JndiTemplate; <ide> <ide> /** <ide><path>spring-orm/src/test/java/org/springframework/orm/hibernate3/HibernateJtaTransactionTests.java <ide> import org.hibernate.classic.Session; <ide> import org.hibernate.engine.SessionFactoryImplementor; <ide> import org.hibernate.engine.SessionImplementor; <del>import org.junit.Ignore; <ide> import org.junit.Test; <ide> import org.springframework.dao.DataAccessException; <ide> import org.springframework.transaction.MockJtaTransaction; <ide><path>spring-orm/src/test/java/org/springframework/orm/hibernate3/support/OpenSessionInViewTests.java <ide> package org.springframework.orm.hibernate3.support; <ide> <ide> import static org.easymock.EasyMock.*; <del>import static org.easymock.EasyMock.createMock; <del>import static org.easymock.EasyMock.createStrictMock; <del>import static org.easymock.EasyMock.expect; <del>import static org.easymock.EasyMock.replay; <del>import static org.easymock.EasyMock.reset; <del>import static org.easymock.EasyMock.verify; <ide> import static org.junit.Assert.assertEquals; <ide> import static org.junit.Assert.assertFalse; <ide> import static org.junit.Assert.assertNotNull; <ide><path>spring-orm/src/test/java/org/springframework/orm/jpa/ApplicationManagedEntityManagerIntegrationTests.java <ide> import javax.persistence.Query; <ide> import javax.persistence.TransactionRequiredException; <ide> <del>import org.springframework.aop.support.AopUtils; <ide> import org.springframework.orm.jpa.domain.Person; <ide> import org.springframework.orm.jpa.AbstractEntityManagerFactoryIntegrationTests; <ide> import org.springframework.test.annotation.NotTransactional; <ide><path>spring-orm/src/test/java/org/springframework/orm/jpa/ContainerManagedEntityManagerIntegrationTests.java <ide> import javax.persistence.Query; <ide> import javax.persistence.TransactionRequiredException; <ide> <del>import org.springframework.aop.support.AopUtils; <ide> import org.springframework.dao.DataAccessException; <ide> import org.springframework.dao.support.PersistenceExceptionTranslator; <ide> import org.springframework.orm.jpa.domain.Person; <ide><path>spring-orm/src/test/java/org/springframework/orm/jpa/domain/Person.java <ide> import javax.persistence.Id; <ide> import javax.persistence.JoinColumn; <ide> import javax.persistence.OneToOne; <del>import javax.persistence.Table; <ide> <ide> import org.springframework.beans.TestBean; <ide> import org.springframework.beans.factory.annotation.Configurable; <ide><path>spring-orm/src/test/java/org/springframework/test/AbstractTransactionalDataSourceSpringContextTests.java <ide> import org.springframework.dao.DataAccessResourceFailureException; <ide> import org.springframework.jdbc.core.JdbcTemplate; <ide> import org.springframework.test.jdbc.JdbcTestUtils; <del>import org.springframework.util.StringUtils; <ide> <ide> /** <ide> * Subclass of AbstractTransactionalSpringContextTests that adds some convenience <ide><path>spring-oxm/src/main/java/org/springframework/oxm/xmlbeans/XmlBeansMarshaller.java <ide> import java.io.OutputStream; <ide> import java.io.Reader; <ide> import java.io.Writer; <del>import java.io.FilterInputStream; <ide> import java.util.ArrayList; <ide> import java.util.List; <ide> import java.lang.ref.WeakReference; <ide> import org.apache.xmlbeans.XmlOptions; <ide> import org.apache.xmlbeans.XmlSaxHandler; <ide> import org.apache.xmlbeans.XmlValidationError; <del>import org.apache.commons.logging.Log; <del>import org.apache.commons.logging.LogFactory; <ide> import org.w3c.dom.Document; <ide> import org.w3c.dom.Node; <ide> import org.w3c.dom.NodeList; <ide><path>spring-oxm/src/test/java/org/springframework/oxm/castor/CastorMarshallerTests.java <ide> import org.custommonkey.xmlunit.XMLUnit; <ide> import org.custommonkey.xmlunit.XpathEngine; <ide> import org.junit.Assert; <del>import org.junit.Ignore; <ide> import org.junit.Test; <ide> import org.w3c.dom.Document; <ide> import org.w3c.dom.NodeList; <ide><path>spring-oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2MarshallerTests.java <ide> <ide> import static org.custommonkey.xmlunit.XMLAssert.assertFalse; <ide> import static org.custommonkey.xmlunit.XMLAssert.*; <del>import static org.custommonkey.xmlunit.XMLAssert.fail; <ide> import static org.easymock.EasyMock.*; <ide> import static org.junit.Assert.assertTrue; <ide> <ide><path>spring-tx/src/main/java/org/springframework/jca/work/WorkManagerTaskExecutor.java <ide> import javax.resource.spi.work.WorkRejectedException; <ide> <ide> import org.springframework.beans.factory.InitializingBean; <del>import org.springframework.core.task.AsyncTaskExecutor; <ide> import org.springframework.core.task.TaskRejectedException; <ide> import org.springframework.core.task.TaskTimeoutException; <ide> import org.springframework.jca.context.BootstrapContextAware; <ide><path>spring-tx/src/test/java/org/springframework/mock/jndi/ExpectedLookupTemplate.java <ide> <ide> import javax.naming.NamingException; <ide> <del>import org.springframework.core.CollectionFactory; <ide> import org.springframework.jndi.JndiTemplate; <ide> <ide> /** <ide><path>spring-web/src/main/java/org/springframework/web/client/RestTemplate.java <ide> import org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter; <ide> import org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter; <ide> import org.springframework.http.converter.xml.SourceHttpMessageConverter; <del>import org.springframework.http.converter.xml.XmlAwareFormHttpMessageConverter; <ide> import org.springframework.util.Assert; <ide> import org.springframework.util.ClassUtils; <ide> import org.springframework.web.util.UriTemplate; <ide><path>spring-web/src/main/java/org/springframework/web/filter/HttpPutFormContentFilter.java <ide> import org.springframework.http.MediaType; <ide> import org.springframework.http.converter.FormHttpMessageConverter; <ide> import org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter; <del>import org.springframework.http.converter.xml.XmlAwareFormHttpMessageConverter; <ide> import org.springframework.http.server.ServletServerHttpRequest; <ide> import org.springframework.util.LinkedMultiValueMap; <ide> import org.springframework.util.MultiValueMap; <ide><path>spring-web/src/main/java/org/springframework/web/filter/ShallowEtagHeaderFilter.java <ide> import org.springframework.util.Assert; <ide> import org.springframework.util.DigestUtils; <ide> import org.springframework.util.FileCopyUtils; <del>import org.springframework.web.context.request.async.WebAsyncManager; <del>import org.springframework.web.context.request.async.WebAsyncUtils; <ide> import org.springframework.web.util.WebUtils; <ide> <ide> /** <ide><path>spring-web/src/main/java/org/springframework/web/multipart/commons/CommonsMultipartFile.java <ide> import java.io.IOException; <ide> import java.io.InputStream; <ide> import java.io.Serializable; <del>import java.util.Collections; <del>import java.util.Iterator; <del> <ide> import org.apache.commons.fileupload.FileItem; <ide> import org.apache.commons.fileupload.FileUploadException; <ide> import org.apache.commons.fileupload.disk.DiskFileItem; <ide><path>spring-web/src/main/java/org/springframework/web/util/UrlPathHelper.java <ide> <ide> import org.apache.commons.logging.Log; <ide> import org.apache.commons.logging.LogFactory; <del>import org.springframework.util.Assert; <ide> import org.springframework.util.StringUtils; <ide> <ide> /** <ide><path>spring-web/src/test/java/org/springframework/http/converter/FormHttpMessageConverterTests.java <ide> import org.springframework.http.MockHttpInputMessage; <ide> import org.springframework.http.MockHttpOutputMessage; <ide> import org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter; <del>import org.springframework.http.converter.xml.XmlAwareFormHttpMessageConverter; <ide> import org.springframework.util.LinkedMultiValueMap; <ide> import org.springframework.util.MultiValueMap; <ide> <ide><path>spring-web/src/test/java/org/springframework/http/converter/HttpMessageConverterTests.java <ide> package org.springframework.http.converter; <ide> <ide> import java.io.IOException; <del>import java.io.StringReader; <del>import java.io.StringWriter; <del> <del>import javax.xml.bind.JAXBContext; <del>import javax.xml.bind.JAXBElement; <del>import javax.xml.transform.Source; <del>import javax.xml.transform.stream.StreamSource; <del>import javax.xml.namespace.QName; <del> <ide> import static org.junit.Assert.*; <ide> import org.junit.Test; <ide> <ide><path>spring-web/src/test/java/org/springframework/mock/web/test/MockMultipartFile.java <ide> import java.io.File; <ide> import java.io.IOException; <ide> import java.io.InputStream; <del>import java.util.Collections; <del>import java.util.Iterator; <del> <ide> import org.springframework.util.Assert; <ide> import org.springframework.util.FileCopyUtils; <ide> import org.springframework.web.multipart.MultipartFile; <ide><path>spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/DefaultAnnotationHandlerMapping.java <ide> <ide> import java.lang.reflect.Method; <ide> import java.util.Arrays; <del>import java.util.HashMap; <ide> import java.util.HashSet; <ide> import java.util.LinkedHashSet; <del>import java.util.Map; <ide> import java.util.Set; <ide> import javax.portlet.ActionRequest; <ide> import javax.portlet.ClientDataRequest; <ide><path>spring-webmvc-portlet/src/test/java/org/springframework/mock/web/MockMultipartFile.java <ide> import java.io.File; <ide> import java.io.IOException; <ide> import java.io.InputStream; <del>import java.util.Collections; <del>import java.util.Iterator; <del> <ide> import org.springframework.util.Assert; <ide> import org.springframework.util.FileCopyUtils; <ide> import org.springframework.web.multipart.MultipartFile; <ide><path>spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/AbstractXmlWebApplicationContextTests.java <ide> <ide> package org.springframework.web.portlet.context; <ide> <del>import java.util.Locale; <ide> import javax.servlet.ServletException; <ide> <ide> import org.springframework.beans.TestBean; <ide> import org.springframework.beans.factory.DisposableBean; <ide> import org.springframework.beans.factory.InitializingBean; <ide> import org.springframework.context.AbstractApplicationContextTests; <ide> import org.springframework.context.ConfigurableApplicationContext; <del>import org.springframework.context.NoSuchMessageException; <ide> import org.springframework.context.TestListener; <ide> import org.springframework.web.context.ConfigurableWebApplicationContext; <del>import org.springframework.web.context.support.XmlWebApplicationContext; <ide> <ide> /** <ide> * Should ideally be eliminated. Copied when splitting .testsuite up into individual bundles. <ide><path>spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/PortletWebRequestTests.java <ide> import org.junit.Test; <ide> <ide> import org.springframework.mock.web.portlet.MockPortletRequest; <del>import org.springframework.mock.web.portlet.MockPortletResponse; <ide> import org.springframework.mock.web.portlet.MockRenderRequest; <ide> import org.springframework.mock.web.portlet.MockRenderResponse; <ide> import org.springframework.web.multipart.MultipartRequest; <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/HttpServletBean.java <ide> import org.springframework.beans.PropertyValue; <ide> import org.springframework.beans.PropertyValues; <ide> import org.springframework.context.EnvironmentAware; <del>import org.springframework.core.env.ConfigurableEnvironment; <ide> import org.springframework.core.env.Environment; <ide> import org.springframework.core.env.EnvironmentCapable; <ide> import org.springframework.core.io.Resource; <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/config/AnnotationDrivenBeanDefinitionParser.java <ide> import org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter; <ide> import org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter; <ide> import org.springframework.http.converter.xml.SourceHttpMessageConverter; <del>import org.springframework.http.converter.xml.XmlAwareFormHttpMessageConverter; <ide> import org.springframework.util.ClassUtils; <ide> import org.springframework.util.xml.DomUtils; <ide> import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport.java <ide> import org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter; <ide> import org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter; <ide> import org.springframework.http.converter.xml.SourceHttpMessageConverter; <del>import org.springframework.http.converter.xml.XmlAwareFormHttpMessageConverter; <ide> import org.springframework.util.ClassUtils; <ide> import org.springframework.validation.Errors; <ide> import org.springframework.validation.MessageCodesResolver; <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/AbstractMessageConverterMethodArgumentResolver.java <ide> package org.springframework.web.servlet.mvc.method.annotation; <ide> <ide> import java.io.IOException; <del>import java.lang.reflect.Array; <del>import java.lang.reflect.GenericArrayType; <del>import java.lang.reflect.ParameterizedType; <ide> import java.lang.reflect.Type; <ide> import java.lang.reflect.TypeVariable; <ide> import java.util.ArrayList; <ide> protected ServletServerHttpRequest createInputMessage(NativeWebRequest webReques <ide> return new ServletServerHttpRequest(servletRequest); <ide> } <ide> <del>} <ide>\ No newline at end of file <add>} <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java <ide> import org.springframework.http.converter.StringHttpMessageConverter; <ide> import org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter; <ide> import org.springframework.http.converter.xml.SourceHttpMessageConverter; <del>import org.springframework.http.converter.xml.XmlAwareFormHttpMessageConverter; <ide> import org.springframework.ui.ModelMap; <ide> import org.springframework.util.Assert; <ide> import org.springframework.util.CollectionUtils; <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/AbstractHtmlElementTag.java <ide> import javax.servlet.jsp.JspException; <ide> import javax.servlet.jsp.tagext.DynamicAttributes; <ide> <del>import org.springframework.util.Assert; <ide> import org.springframework.util.CollectionUtils; <ide> import org.springframework.util.ObjectUtils; <ide> import org.springframework.util.StringUtils; <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/OptionWriter.java <ide> import java.util.Collection; <ide> import java.util.Map; <ide> <del>import javax.servlet.ServletRequest; <del>import javax.servlet.http.HttpServletRequest; <ide> import javax.servlet.jsp.JspException; <del>import javax.servlet.jsp.PageContext; <del> <ide> import org.springframework.beans.BeanWrapper; <ide> import org.springframework.beans.PropertyAccessorFactory; <ide> import org.springframework.util.Assert; <ide> import org.springframework.util.CollectionUtils; <ide> import org.springframework.web.servlet.support.BindStatus; <del>import org.springframework.web.servlet.support.RequestDataValueProcessor; <del>import org.springframework.web.servlet.support.RequestContext; <ide> <ide> /** <ide> * Provides supporting functionality to render a list of '{@code option}' <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/OptionsTag.java <ide> package org.springframework.web.servlet.tags.form; <ide> <ide> import javax.servlet.jsp.JspException; <del>import javax.servlet.jsp.tagext.TagSupport; <del> <ide> import org.springframework.util.Assert; <ide> import org.springframework.util.ObjectUtils; <ide> import org.springframework.util.StringUtils; <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/view/tiles2/AbstractSpringPreparerFactory.java <ide> import org.apache.tiles.context.TilesRequestContext; <ide> import org.apache.tiles.preparer.PreparerFactory; <ide> import org.apache.tiles.preparer.ViewPreparer; <del>import org.apache.tiles.servlet.context.ServletTilesRequestContext; <del> <ide> import org.springframework.web.context.WebApplicationContext; <del>import org.springframework.web.context.support.WebApplicationContextUtils; <ide> import org.springframework.web.servlet.DispatcherServlet; <ide> <ide> /** <ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/config/MvcNamespaceTests.java <ide> import java.util.Date; <ide> import java.util.List; <ide> import java.util.Locale; <del>import java.util.Map; <del> <ide> import javax.servlet.RequestDispatcher; <ide> import javax.validation.constraints.NotNull; <ide> <ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupportExtensionTests.java <ide> <ide> import java.util.Arrays; <ide> import java.util.List; <del>import java.util.Map; <del> <ide> import org.junit.Before; <ide> import org.junit.Test; <ide> import org.springframework.beans.DirectFieldAccessor; <ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/handler/PathMatchingUrlHandlerMappingTests.java <ide> <ide> package org.springframework.web.servlet.handler; <ide> <del>import junit.framework.TestCase; <del> <ide> import org.springframework.mock.web.test.MockHttpServletRequest; <ide> import org.springframework.mock.web.test.MockServletContext; <ide> import org.springframework.web.context.ConfigurableWebApplicationContext; <ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/handler/SimpleUrlHandlerMappingTests.java <ide> import java.util.Map; <ide> import java.util.LinkedHashMap; <ide> <del>import junit.framework.TestCase; <del> <ide> import org.springframework.beans.FatalBeanException; <ide> import org.springframework.beans.factory.NoSuchBeanDefinitionException; <ide> import org.springframework.mock.web.test.MockHttpServletRequest; <ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/WebContentInterceptorTests.java <ide> import java.util.List; <ide> import java.util.Properties; <ide> <del>import junit.framework.TestCase; <del> <ide> import org.springframework.mock.web.test.MockHttpServletRequest; <ide> import org.springframework.mock.web.test.MockHttpServletResponse; <ide> import org.springframework.web.servlet.support.WebContentGenerator; <ide> <ide> import org.junit.Before; <ide> import org.junit.Test; <del>import org.junit.Assert; <ide> import static org.junit.Assert.assertNotNull; <ide> import static org.junit.Assert.assertTrue; <ide> import static org.junit.Assert.*; <del>import static org.junit.Assert.*; <del>import static org.junit.Assert.*; <del>import static org.junit.Assert.*; <ide> <ide> /** <ide> * @author Rick Evans <ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/condition/RequestMethodsRequestConditionTests.java <ide> package org.springframework.web.servlet.mvc.condition; <ide> <ide> import static org.junit.Assert.*; <del>import static org.junit.Assert.assertEquals; <del>import static org.junit.Assert.assertNotNull; <del>import static org.junit.Assert.assertNull; <del>import static org.junit.Assert.assertTrue; <del> <ide> import org.junit.Test; <ide> import org.springframework.mock.web.test.MockHttpServletRequest; <ide> import org.springframework.web.bind.annotation.RequestMethod; <ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/PathVariableMapMethodArgumentResolverTests.java <ide> import org.springframework.core.MethodParameter; <ide> import org.springframework.mock.web.test.MockHttpServletRequest; <ide> import org.springframework.mock.web.test.MockHttpServletResponse; <del>import org.springframework.web.bind.ServletRequestBindingException; <ide> import org.springframework.web.bind.annotation.PathVariable; <ide> import org.springframework.web.context.request.ServletWebRequest; <ide> import org.springframework.web.method.support.ModelAndViewContainer; <ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestPartIntegrationTests.java <ide> import org.springframework.http.converter.ResourceHttpMessageConverter; <ide> import org.springframework.http.converter.json.MappingJacksonHttpMessageConverter; <ide> import org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter; <del>import org.springframework.http.converter.xml.XmlAwareFormHttpMessageConverter; <ide> import org.springframework.stereotype.Controller; <ide> import org.springframework.util.LinkedMultiValueMap; <ide> import org.springframework.util.MultiValueMap; <ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestResponseBodyMethodProcessorMockTests.java <ide> <ide> import java.io.IOException; <ide> import java.lang.reflect.Method; <del>import java.util.ArrayList; <ide> import java.util.Arrays; <ide> import java.util.Collections; <ide> import java.util.List; <ide> import org.springframework.http.HttpInputMessage; <ide> import org.springframework.http.HttpOutputMessage; <ide> import org.springframework.http.MediaType; <del>import org.springframework.http.converter.ByteArrayHttpMessageConverter; <ide> import org.springframework.http.converter.HttpMessageConverter; <del>import org.springframework.http.converter.HttpMessageNotReadableException; <del>import org.springframework.http.converter.StringHttpMessageConverter; <del>import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; <ide> import org.springframework.mock.web.test.MockHttpServletRequest; <ide> import org.springframework.mock.web.test.MockHttpServletResponse; <ide> import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; <ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestResponseBodyMethodProcessorTests.java <ide> import org.springframework.http.converter.StringHttpMessageConverter; <ide> import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; <ide> import org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter; <del>import org.springframework.http.converter.xml.XmlAwareFormHttpMessageConverter; <ide> import org.springframework.mock.web.test.MockHttpServletRequest; <ide> import org.springframework.mock.web.test.MockHttpServletResponse; <ide> import org.springframework.util.MultiValueMap; <ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/tags/EvalTagTests.java <ide> <ide> import org.springframework.context.support.GenericApplicationContext; <ide> import org.springframework.core.env.MapPropertySource; <del>import org.springframework.core.env.PropertySource; <ide> import org.springframework.format.annotation.NumberFormat; <ide> import org.springframework.format.annotation.NumberFormat.Style; <ide> import org.springframework.format.support.FormattingConversionServiceFactoryBean; <ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/tags/UrlTagTests.java <ide> <ide> package org.springframework.web.servlet.tags; <ide> <del>import java.io.UnsupportedEncodingException; <ide> import java.lang.reflect.Method; <del>import java.net.URLDecoder; <ide> import java.util.HashSet; <ide> import java.util.LinkedList; <ide> import java.util.List; <ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/FormTagTests.java <ide> <ide> package org.springframework.web.servlet.tags.form; <ide> <del>import static org.easymock.EasyMock.createMock; <ide> import static org.easymock.EasyMock.expect; <ide> import static org.easymock.EasyMock.replay; <ide> import static org.easymock.EasyMock.verify; <ide> import javax.servlet.jsp.tagext.Tag; <ide> <ide> import org.springframework.mock.web.test.MockHttpServletRequest; <del>import org.springframework.web.context.support.StaticWebApplicationContext; <del>import org.springframework.web.servlet.support.RequestContextUtils; <ide> import org.springframework.web.servlet.support.RequestDataValueProcessor; <ide> <ide> /**
81
Ruby
Ruby
add --unsafe-perm to std_args
6874c79375176897b86215c410808fdacb034a51
<ide><path>Library/Homebrew/language/node.rb <ide> def self.std_npm_install_args(libexec) <ide> %W[ <ide> -ddd <ide> --global <add> --unsafe-perm <ide> --build-from-source <ide> --#{npm_cache_config} <ide> --prefix=#{libexec}
1
Python
Python
fix problem with alter_code1.py
3e47b2420c722cbb61250d816424617603cbc718
<ide><path>numpy/numarray/alter_code1.py <ide> def changeimports(fstr, name, newname): <ide> if ('.' in name): <ide> name_ = name.replace('.','_') <ide> <del> fstr = re.sub(r'(import [^,]+,\s*)(%s)' % name, <add> fstr = re.sub(r'(import\s+[^,\n\r]+,\s*)(%s)' % name, <ide> "\\1%s as %s" % (newname, name), fstr) <ide> fstr = fstr.replace(importasstr, 'import %s as ' % newname) <ide> fstr = fstr.replace(importstr, 'import %s as %s' % (newname,name_)) <ide><path>numpy/oldnumeric/alter_code1.py <ide> def changeimports(fstr, name, newname): <ide> fromstr = 'from %s import ' % name <ide> fromall=0 <ide> <del> fstr = re.sub(r'(import [^,]+,\s*)(%s)' % name, <add> fstr = re.sub(r'(import\s+[^,\n\r]+,\s*)(%s)' % name, <ide> "\\1%s as %s" % (newname, name), fstr) <ide> fstr = fstr.replace(importasstr, 'import %s as ' % newname) <ide> fstr = fstr.replace(importstr, 'import %s as %s' % (newname,name))
2
PHP
PHP
add doc blocks to selectbox
0f95ff934da58db6da81dde44125fb562197c7bd
<ide><path>Cake/View/Input/SelectBox.php <ide> <ide> /** <ide> * Input widget class for generating a selectbox. <add> * <add> * This class is intended as an internal implementation detail <add> * of Cake\View\Helper\FormHelper and is not intended for direct use. <ide> */ <ide> class SelectBox { <ide> <add>/** <add> * Template instance. <add> * <add> * @var Cake\View\StringTemplate <add> */ <ide> protected $_templates; <ide> <add>/** <add> * Constructor <add> * <add> * @param Cake\View\StringTemplate $templates <add> */ <ide> public function __construct($templates) { <ide> $this->_templates = $templates; <ide> } <ide> <add>/** <add> * Render a select box form input. <add> * <add> * Render a select box input given a set of data. Supported keys <add> * are: <add> * <add> * - `name` - Set the input name. <add> * - `options` - An array of options. <add> * - `disabled` - Either true or an array of options to disable. <add> * When true, the select element will be disabled. <add> * - `value` - Either a string or an array of options to mark as selected. <add> * - `empty` - Set to true to add an empty option at the top of the <add> * option elements. Set to a string to define the display value of the <add> * empty option. <add> * - `escape` - Set to false to disable HTML escaping. <add> * <add> * @param array $data Data to render with. <add> * @return string A generated select box. <add> */ <ide> public function render($data) { <ide> $data += [ <ide> 'name' => '', <ide> public function render($data) { <ide> ]); <ide> } <ide> <add>/** <add> * Render the contents of the select element. <add> * <add> * @param array $data The context for rendering a select. <add> * @return array <add> */ <ide> protected function _renderContent($data) { <ide> $out = []; <ide> $options = $data['options']; <ide> protected function _renderContent($data) { <ide> return $this->_renderOptions($options, $disabled, $selected, $data['escape']); <ide> } <ide> <add>/** <add> * Render a set of options. <add> * <add> * Will recursively call itself when option groups are in use. <add> * <add> * @param array $options The options to render. <add> * @param array|null $disabled The options to disable. <add> * @param array|string|null $selected The options to select. <add> * @param boolean $escape Toggle HTML escaping. <add> * @return array Option elements. <add> */ <ide> protected function _renderOptions($options, $disabled, $selected, $escape) { <add> $out = []; <ide> foreach ($options as $key => $val) { <ide> if (is_array($val)) { <ide> $groupOptions = $this->_renderOptions($val, $disabled, $selected, $escape); <ide> protected function _renderOptions($options, $disabled, $selected, $escape) { <ide> return $out; <ide> } <ide> <add>/** <add> * Helper method for deciding what options are selected. <add> * <add> * @param string $key The key to test. <add> * @param array|string|null The selected values. <add> * @return boolean <add> */ <ide> protected function _isSelected($key, $selected) { <ide> if ($selected === null) { <ide> return false; <ide> protected function _isSelected($key, $selected) { <ide> return in_array((string)$key, $selected, $strict); <ide> } <ide> <add>/** <add> * Helper method for deciding what options are disabled. <add> * <add> * @param string $key The key to test. <add> * @param array|null The disabled values. <add> * @return boolean <add> */ <ide> protected function _isDisabled($key, $disabled) { <ide> if ($disabled === null) { <ide> return false;
1
Javascript
Javascript
add test for invalid cert string
12d7a50368cd3974edea1ff7a188b90983f87d38
<ide><path>test/parallel/test-tls-parse-cert-string.js <ide> if (!common.hasCrypto) { <ide> const assert = require('assert'); <ide> const tls = require('tls'); <ide> <del>const singles = 'C=US\nST=CA\nL=SF\nO=Node.js Foundation\nOU=Node.js\n' + <del> 'CN=ca1\nemailAddress=ry@clouds.org'; <del>const singlesOut = tls.parseCertString(singles); <del>assert.deepStrictEqual(singlesOut, { <del> C: 'US', <del> ST: 'CA', <del> L: 'SF', <del> O: 'Node.js Foundation', <del> OU: 'Node.js', <del> CN: 'ca1', <del> emailAddress: 'ry@clouds.org' <del>}); <add>{ <add> const singles = 'C=US\nST=CA\nL=SF\nO=Node.js Foundation\nOU=Node.js\n' + <add> 'CN=ca1\nemailAddress=ry@clouds.org'; <add> const singlesOut = tls.parseCertString(singles); <add> assert.deepStrictEqual(singlesOut, { <add> C: 'US', <add> ST: 'CA', <add> L: 'SF', <add> O: 'Node.js Foundation', <add> OU: 'Node.js', <add> CN: 'ca1', <add> emailAddress: 'ry@clouds.org' <add> }); <add>} <add> <add>{ <add> const doubles = 'OU=Domain Control Validated\nOU=PositiveSSL Wildcard\n' + <add> 'CN=*.nodejs.org'; <add> const doublesOut = tls.parseCertString(doubles); <add> assert.deepStrictEqual(doublesOut, { <add> OU: [ 'Domain Control Validated', 'PositiveSSL Wildcard' ], <add> CN: '*.nodejs.org' <add> }); <add>} <ide> <del>const doubles = 'OU=Domain Control Validated\nOU=PositiveSSL Wildcard\n' + <del> 'CN=*.nodejs.org'; <del>const doublesOut = tls.parseCertString(doubles); <del>assert.deepStrictEqual(doublesOut, { <del> OU: [ 'Domain Control Validated', 'PositiveSSL Wildcard' ], <del> CN: '*.nodejs.org' <del>}); <add>{ <add> const invalid = 'fhqwhgads'; <add> const invalidOut = tls.parseCertString(invalid); <add> assert.deepStrictEqual(invalidOut, {}); <add>}
1
Javascript
Javascript
fix assertion in timeout.unref()
6c999fd2855f9bccf99666431cddc9b34930720b
<ide><path>lib/timers.js <ide> var Timeout = function(after) { <ide> <ide> Timeout.prototype.unref = function() { <ide> if (!this._handle) { <add> var delay = this._when - Date.now(); <add> if (delay < 0) delay = 0; <ide> exports.unenroll(this); <ide> this._handle = new Timer(); <ide> this._handle.ontimeout = this._onTimeout; <del> this._handle.start(this._when - Date.now(), 0); <add> this._handle.start(delay, 0); <ide> this._handle.domain = this.domain; <ide> this._handle.unref(); <ide> } else {
1
Ruby
Ruby
remove reference to session_store.rb initializer
0eff45db7d380b5b26a6461077f2c930a9b44972
<ide><path>actionpack/lib/action_dispatch/middleware/session/cookie_store.rb <ide> module Session <ide> # goes a step further than signed cookies in that encrypted cookies cannot <ide> # be altered or read by users. This is the default starting in Rails 4. <ide> # <del> # Configure your session store in <tt>config/initializers/session_store.rb</tt>: <add> # Configure your session store in an initializer: <ide> # <ide> # Rails.application.config.session_store :cookie_store, key: '_your_app_session' <ide> #
1
Text
Text
create model card
99833a9cbfa5a895478d128b40e6202f9c0925f5
<ide><path>model_cards/mrm8488/bert-spanish-cased-finetuned-pos-syntax/README.md <add>--- <add>language: spanish <add>thumbnail: <add>--- <add> <add># Spanish BERT (BETO) + Syntax POS tagging ✍🏷 <add> <add>This model is a fine-tuned version of the Spanish BERT [(BETO)](https://github.com/dccuchile/beto) on Spanish **syntax** annotations in [CONLL CORPORA](https://www.kaggle.com/nltkdata/conll-corpora) dataset for **syntax POS** (Part of Speech tagging) downstream task. <add> <add>## Details of the downstream task (Syntax POS) - Dataset <add> <add>- [Dataset: CONLL Corpora ES](https://www.kaggle.com/nltkdata/conll-corpora) <add> <add>#### [Fine-tune script on NER dataset provided by Huggingface](https://github.com/huggingface/transformers/blob/master/examples/run_ner.py) <add> <add>#### 21 Syntax annotations (Labels) covered: <add> <add>- \_ <add>- ATR <add>- ATR.d <add>- CAG <add>- CC <add>- CD <add>- CD.Q <add>- CI <add>- CPRED <add>- CPRED.CD <add>- CPRED.SUJ <add>- CREG <add>- ET <add>- IMPERS <add>- MOD <add>- NEG <add>- PASS <add>- PUNC <add>- ROOT <add>- SUJ <add>- VOC <add> <add>## Metrics on test set 📋 <add> <add>| Metric | # score | <add>| :-------: | :-------: | <add>| F1 | **89.27** | <add>| Precision | **89.44** | <add>| Recall | **89.11** | <add> <add>## Model in action 🔨 <add> <add>Fast usage with **pipelines** 🧪 <add> <add>```python <add>from transformers import pipeline <add> <add>nlp_pos_syntax = pipeline( <add> "ner", <add> model="mrm8488/bert-spanish-cased-finetuned-pos-syntax", <add> tokenizer="mrm8488/bert-spanish-cased-finetuned-pos-syntax" <add>) <add> <add>text = 'Mis amigos están pensando viajar a Londres este verano.' <add> <add>nlp_pos_syntax(text)[1:len(nlp_pos_syntax(text))-1] <add>``` <add> <add>```json <add>[ <add> { "entity": "_", "score": 0.9999216794967651, "word": "Mis" }, <add> { "entity": "SUJ", "score": 0.999882698059082, "word": "amigos" }, <add> { "entity": "_", "score": 0.9998869299888611, "word": "están" }, <add> { "entity": "ROOT", "score": 0.9980518221855164, "word": "pensando" }, <add> { "entity": "_", "score": 0.9998420476913452, "word": "viajar" }, <add> { "entity": "CD", "score": 0.999351978302002, "word": "a" }, <add> { "entity": "_", "score": 0.999959409236908, "word": "Londres" }, <add> { "entity": "_", "score": 0.9998968839645386, "word": "este" }, <add> { "entity": "CC", "score": 0.99931401014328, "word": "verano" }, <add> { "entity": "PUNC", "score": 0.9998534917831421, "word": "." } <add>] <add>``` <add> <add>> Created by [Manuel Romero/@mrm8488](https://twitter.com/mrm8488) <add> <add>> Made with <span style="color: #e25555;">&hearts;</span> in Spain
1
Ruby
Ruby
pull requires out of method
d1dd4b0e6792beec55b714ddb4e2aacb8b86d948
<ide><path>Library/Homebrew/cmd/create.rb <ide> require 'formula' <ide> require 'blacklist' <add>require 'digest' <add>require 'erb' <ide> <ide> module Homebrew extend self <ide> <ide> def url= url <ide> def generate! <ide> raise "#{path} already exists" if path.exist? <ide> <del> require 'digest' <del> require 'erb' <del> <ide> if version.nil? <ide> opoo "Version cannot be determined from URL." <ide> puts "You'll need to add an explicit 'version' to the formula."
1
PHP
PHP
reset doc block
5bd6c713a8b0c7716236c2d0485d4f20927a4866
<ide><path>src/Illuminate/Support/Facades/Validator.php <ide> namespace Illuminate\Support\Facades; <ide> <ide> /** <del> * @method static \Illuminate\Validation\Validator make(array $data, array $rules, array $messages = [], array $customAttributes = []) <add> * @method static \Illuminate\Contracts\Validation\Validator make(array $data, array $rules, array $messages = [], array $customAttributes = []) <ide> * @method static void extend(string $rule, \Closure | string $extension, string $message = null) <ide> * @method static void extendImplicit(string $rule, \Closure | string $extension, string $message = null) <ide> * @method static void replacer(string $rule, \Closure | string $replacer)
1
Python
Python
deserialize all tasks in a chain
1735336dadfdb0d4939459a3576d46dbb23c732c
<ide><path>celery/canvas.py <ide> def from_dict(cls, d, app=None): <ide> if tasks: <ide> if isinstance(tasks, tuple): # aaaargh <ide> tasks = d['kwargs']['tasks'] = list(tasks) <del> # First task must be signature object to get app <del> tasks[0] = maybe_signature(tasks[0], app=app) <add> tasks = [maybe_signature(task, app=app) for task in tasks] <ide> return _upgrade(d, _chain(tasks, app=app, **d['options'])) <ide> <ide> def __init__(self, *tasks, **options): <ide><path>t/unit/tasks/test_canvas.py <ide> from __future__ import absolute_import, unicode_literals <add>import json <ide> import pytest <ide> from case import MagicMock, Mock <ide> from celery._state import _task_stack <ide> def test_splices_chains(self): <ide> def test_from_dict_no_tasks(self): <ide> assert chain.from_dict(dict(chain(app=self.app)), app=self.app) <ide> <add> def test_from_dict_full_subtasks(self): <add> c = chain(self.add.si(1, 2), self.add.si(3, 4), self.add.si(5, 6)) <add> <add> serialized = json.loads(json.dumps(c)) <add> <add> deserialized = chain.from_dict(serialized) <add> <add> for task in deserialized.tasks: <add> assert isinstance(task, Signature) <add> <ide> @pytest.mark.usefixtures('depends_on_current_app') <ide> def test_app_falls_back_to_default(self): <ide> from celery._state import current_app
2
PHP
PHP
get request/response from the controller
8e7b79b9a27d80209f7d4bf24fe32be4e1e936ec
<ide><path>src/Controller/Component/SecurityComponent.php <ide> class SecurityComponent extends Component <ide> */ <ide> protected $_action = null; <ide> <del> /** <del> * Request object <del> * <del> * @var \Cake\Http\ServerRequest <del> */ <del> public $request; <del> <ide> /** <ide> * The Session object <ide> * <ide> class SecurityComponent extends Component <ide> public function startup(Event $event) <ide> { <ide> $controller = $event->subject(); <del> $this->session = $this->request->session(); <del> $this->_action = $this->request->param('action'); <del> $hasData = (bool)$this->request->data(); <add> $this->session = $controller->request->session(); <add> $this->_action = $controller->request->param('action'); <add> $hasData = (bool)$controller->request->data(); <ide> try { <ide> $this->_secureRequired($controller); <ide> $this->_authRequired($controller); <ide> protected function _secureRequired(Controller $controller) <ide> */ <ide> protected function _authRequired(Controller $controller) <ide> { <add> $request = $controller->request; <ide> if (is_array($this->_config['requireAuth']) && <ide> !empty($this->_config['requireAuth']) && <del> $this->request->data() <add> $request->data() <ide> ) { <ide> $requireAuth = $this->_config['requireAuth']; <ide> <del> if (in_array($this->request->param('action'), $requireAuth) || $requireAuth == ['*']) { <del> if (!isset($this->request->data['_Token'])) { <add> if (in_array($request->param('action'), $requireAuth) || $requireAuth == ['*']) { <add> if (!isset($request->data['_Token'])) { <ide> throw new AuthSecurityException('\'_Token\' was not found in request data.'); <ide> } <ide> <ide> if ($this->session->check('_Token')) { <ide> $tData = $this->session->read('_Token'); <ide> <ide> if (!empty($tData['allowedControllers']) && <del> !in_array($this->request->param('controller'), $tData['allowedControllers'])) { <add> !in_array($request->param('controller'), $tData['allowedControllers'])) { <ide> throw new AuthSecurityException( <ide> sprintf( <ide> 'Controller \'%s\' was not found in allowed controllers: \'%s\'.', <del> $this->request->param('controller'), <add> $request->param('controller'), <ide> implode(', ', (array)$tData['allowedControllers']) <ide> ) <ide> ); <ide> } <ide> if (!empty($tData['allowedActions']) && <del> !in_array($this->request->param('action'), $tData['allowedActions']) <add> !in_array($request->param('action'), $tData['allowedActions']) <ide> ) { <ide> throw new AuthSecurityException( <ide> sprintf( <ide> 'Action \'%s::%s\' was not found in allowed actions: \'%s\'.', <del> $this->request->param('controller'), <del> $this->request->param('action'), <add> $request->param('controller'), <add> $request->param('action'), <ide> implode(', ', (array)$tData['allowedActions']) <ide> ) <ide> ); <ide> protected function _validatePost(Controller $controller) <ide> */ <ide> protected function _validToken(Controller $controller) <ide> { <del> $check = $controller->request->data; <add> $check = $controller->request->getData(); <ide> <ide> $message = '\'%s\' was not found in request data.'; <ide> if (!isset($check['_Token'])) {
1
Text
Text
fix links in the psql guide [ci skip]
ccf66ab383184a1b3a8a120298ce143ddfeb1f15
<ide><path>guides/source/active_record_postgresql.md <ide> Book.where("array_length(ratings, 1) >= 3") <ide> ### Hstore <ide> <ide> * [type definition](https://www.postgresql.org/docs/current/static/hstore.html) <del>* [functions and operators](https://www.postgresql.org/docs/current/static/hstore.html#AEN179902) <add>* [functions and operators](https://www.postgresql.org/docs/current/static/hstore.html#id-1.11.7.26.5) <ide> <ide> NOTE: You need to enable the `hstore` extension to use hstore. <ide> <ide> SELECT n.nspname AS enum_schema, <ide> ### UUID <ide> <ide> * [type definition](https://www.postgresql.org/docs/current/static/datatype-uuid.html) <del>* [pgcrypto generator function](https://www.postgresql.org/docs/current/static/pgcrypto.html#AEN182570) <add>* [pgcrypto generator function](https://www.postgresql.org/docs/current/static/pgcrypto.html#id-1.11.7.35.7) <ide> * [uuid-ossp generator functions](https://www.postgresql.org/docs/current/static/uuid-ossp.html) <ide> <ide> NOTE: You need to enable the `pgcrypto` (only PostgreSQL >= 9.4) or `uuid-ossp`
1
Ruby
Ruby
move svn url munging to initialize
01dc112b607d2c4707c8835be9b122109088fd75
<ide><path>Library/Homebrew/download_strategy.rb <ide> def _fetch <ide> end <ide> <ide> class SubversionDownloadStrategy < VCSDownloadStrategy <add> def initialize(name, resource) <add> super <add> @url = @url.sub(/^svn\+/, "") if @url =~ %r[^svn\+http://] <add> end <add> <ide> def repo_url <ide> `svn info '#{@clone}' 2>/dev/null`.strip[/^URL: (.+)$/, 1] <ide> end <ide> <ide> def fetch <del> @url = @url.sub(/^svn\+/, '') if @url =~ %r[^svn\+http://] <ide> ohai "Checking out #{@url}" <ide> <ide> clear_cache unless @url.chomp("/") == repo_url or quiet_system 'svn', 'switch', @url, @clone
1
Ruby
Ruby
raise a helpful error if config.frameworks is used
2f8643955a780f0c2fe46d0ae68db8d51b76fbbf
<ide><path>railties/lib/rails/configuration.rb <ide> def paths <ide> end <ide> end <ide> <add> def frameworks(*args) <add> raise "config.frameworks in no longer supported. See the generated" \ <add> "config/boot.rb for steps on how to limit the frameworks that" \ <add> "will be loaded" <add> end <add> alias frameworks= frameworks <add> <ide> # Enable threaded mode. Allows concurrent requests to controller actions and <ide> # multiple database connections. Also disables automatic dependency loading <ide> # after boot, and disables reloading code on every request, as these are <ide><path>railties/test/application/configuration_test.rb <ide> def setup <ide> <ide> assert !ActionController.autoload?(:RecordIdentifier) <ide> end <add> <add> test "runtime error is raised if config.frameworks= is used" do <add> add_to_config "config.frameworks = []" <add> <add> assert_raises RuntimeError do <add> require "#{app_path}/config/environment" <add> end <add> end <add> <add> test "runtime error is raised if config.frameworks is used" do <add> add_to_config "config.frameworks -= []" <add> <add> assert_raises RuntimeError do <add> require "#{app_path}/config/environment" <add> end <add> end <ide> end <ide> end
2
Text
Text
improve parallel testing guide [ci skip]
4973a7643b9e6e2710efefa40595c3f6aac37f94
<ide><path>guides/source/testing.md <ide> takes your entire test suite to run. <ide> <ide> The default parallelization method is to fork processes using Ruby's DRb system. The processes <ide> are forked based on the number of workers provided. The default is 2, but can be changed by the <del>number passed to the parallelize method. Active Record automatically handles creating and <del>migrating a new database for each worker to use. <add>number passed to the parallelize method. <ide> <ide> To enable parallelization add the following to your `test_helper.rb`: <ide> <del>``` <add>```ruby <ide> class ActiveSupport::TestCase <ide> parallelize(workers: 2) <ide> end <ide> The number of workers passed is the number of times the process will be forked. <ide> parallelize your local test suite differently from your CI, so an environment variable is provided <ide> to be able to easily change the number of workers a test run should use: <ide> <del>``` <add>```bash <ide> PARALLEL_WORKERS=15 rails test <ide> ``` <ide> <del>When parallelizing tests, Active Record automatically handles creating and migrating a database for each <add>When parallelizing tests, Active Record automatically handles creating a database and loading the schema into the database for each <ide> process. The databases will be suffixed with the number corresponding to the worker. For example, if you <ide> have 2 workers the tests will create `test-database-0` and `test-database-1` respectively. <ide> <ide> If the number of workers passed is 1 or fewer the processes will not be forked and the tests will not <ide> be parallelized and the tests will use the original `test-database` database. <ide> <del>Two hooks are provided, one runs when the process is forked, and one runs before the processes are closed. <add>Two hooks are provided, one runs when the process is forked, and one runs before the forked process is closed. <ide> These can be useful if your app uses multiple databases or perform other tasks that depend on the number of <ide> workers. <ide> <ide> The `parallelize_setup` method is called right after the processes are forked. The `parallelize_teardown` method <ide> is called right before the processes are closed. <ide> <del>``` <add>```ruby <ide> class ActiveSupport::TestCase <ide> parallelize_setup do |worker| <ide> # setup databases <ide> end <ide> <ide> parallelize_teardown do |worker| <del> # cleanup database <add> # cleanup databases <ide> end <ide> <ide> parallelize(workers: 2) <ide> parallelizer is backed by Minitest's `Parallel::Executor`. <ide> <ide> To change the parallelization method to use threads over forks put the following in your `test_helper.rb` <ide> <del>``` <add>```ruby <ide> class ActiveSupport::TestCase <ide> parallelize(workers: 2, with: :threads) <ide> end <ide> The number of workers passed to `parallelize` determines the number of threads t <ide> want to parallelize your local test suite differently from your CI, so an environment variable is provided <ide> to be able to easily change the number of workers a test run should use: <ide> <del>``` <add>```bash <ide> PARALLEL_WORKERS=15 rails test <ide> ``` <ide>
1
Ruby
Ruby
remove completions, python
54b9bc4d0ec91db10204313cfa11e9e3bb3b38e2
<ide><path>Library/Homebrew/official_taps.rb <ide> OFFICIAL_TAPS = %w[ <ide> apache <del> completions <ide> dupes <ide> emacs <ide> fuse <ide> games <ide> nginx <ide> php <del> python <ide> science <ide> tex <ide> x11
1
Go
Go
fix severe fd leak in stack
0af04b613220060ef1fc21ca2f1d551f8f868af8
<ide><path>api/client/stack/opts.go <ide> func loadBundlefile(stderr io.Writer, namespace string, path string) (*bundlefil <ide> if err != nil { <ide> return nil, err <ide> } <add> defer reader.Close() <ide> <ide> bundle, err := bundlefile.LoadFile(reader) <ide> if err != nil {
1
PHP
PHP
remove command suffix
ce20ef22c1cc7a450c5499162ca97a3887963269
<add><path>app/Console/Commands/Inspire.php <del><path>app/Console/Commands/InspireCommand.php <ide> use Symfony\Component\Console\Input\InputOption; <ide> use Symfony\Component\Console\Input\InputArgument; <ide> <del>class InspireCommand extends Command { <add>class Inspire extends Command { <ide> <ide> /** <ide> * The console command name. <ide><path>app/Console/Kernel.php <ide> class Kernel extends ConsoleKernel { <ide> * @var array <ide> */ <ide> protected $commands = [ <del> 'App\Console\Commands\InspireCommand', <add> 'App\Console\Commands\Inspire', <ide> ]; <ide> <ide> /**
2
PHP
PHP
make init() chainable and improve docs
8bc8e0b468042cc5def95b0708c014a411f714e8
<ide><path>src/Shell/Helper/ProgressHelper.php <ide> <ide> /** <ide> * Create a progress bar using a supplied callback. <add> * <add> * ## Usage <add> * <add> * The ProgressHelper can be accessed from shells using the helper() method <add> * <add> * ``` <add> * $this->helper('Progress')->output(['callback' => function ($progress) { <add> * // Do work <add> * $progress->increment(); <add> * }); <add> * ``` <ide> */ <ide> class ProgressHelper extends Helper <ide> { <ide> public function output($args) <ide> * - `width` The width of the progress bar. Defaults to 80. <ide> * <ide> * @param array $args The initialization data. <del> * @return void <add> * @return $this <ide> */ <ide> public function init(array $args = []) <ide> { <ide> $args += ['total' => 100, 'width' => 80]; <ide> $this->_progress = 0; <ide> $this->_width = $args['width']; <ide> $this->_total = $args['total']; <add> <add> return $this; <ide> } <ide> <ide> /** <ide><path>tests/TestCase/Shell/Helper/ProgressHelperTest.php <ide> public function setUp() <ide> $this->helper = new ProgressHelper($this->io); <ide> } <ide> <add> /** <add> * Test using the helper manually. <add> * <add> * @return void <add> */ <add> public function testInit() <add> { <add> $helper = $this->helper->init([ <add> 'total' => 200, <add> 'width' => 50 <add> ]); <add> $this->assertSame($helper, $this->helper, 'init should be chainable'); <add> } <add> <ide> /** <ide> * Test that a callback is required. <ide> *
2
Go
Go
add a test for
f2f5106c92fb9399844dcb7315fe23f3612e7cea
<ide><path>integration/build/build_userns_linux_test.go <add>package build // import "github.com/docker/docker/integration/build" <add> <add>import ( <add> "bufio" <add> "bytes" <add> "context" <add> "io" <add> "io/ioutil" <add> "os" <add> "strings" <add> "testing" <add> <add> "github.com/docker/docker/api/types" <add> "github.com/docker/docker/integration/internal/container" <add> "github.com/docker/docker/pkg/stdcopy" <add> "github.com/docker/docker/testutil/daemon" <add> "github.com/docker/docker/testutil/fakecontext" <add> "gotest.tools/v3/assert" <add> "gotest.tools/v3/skip" <add>) <add> <add>// Implements a test for https://github.com/moby/moby/issues/41723 <add>// Images built in a user-namespaced daemon should have capabilities serialised in <add>// VFS_CAP_REVISION_2 (no user-namespace root uid) format rather than V3 (that includes <add>// the root uid). <add>func TestBuildUserNamespaceValidateCapabilitiesAreV2(t *testing.T) { <add> skip.If(t, testEnv.DaemonInfo.OSType != "linux") <add> skip.If(t, testEnv.IsRemoteDaemon()) <add> skip.If(t, !testEnv.IsUserNamespaceInKernel()) <add> skip.If(t, testEnv.IsRootless()) <add> <add> const imageTag = "capabilities:1.0" <add> <add> tmp, err := ioutil.TempDir("", "integration-") <add> assert.NilError(t, err) <add> defer os.RemoveAll(tmp) <add> <add> dUserRemap := daemon.New(t) <add> dUserRemap.StartWithBusybox(t, "--userns-remap", "default") <add> dUserRemapRunning := true <add> defer func() { <add> if dUserRemapRunning { <add> dUserRemap.Stop(t) <add> } <add> }() <add> <add> dockerfile := ` <add> FROM debian:bullseye <add> RUN setcap CAP_NET_BIND_SERVICE=+eip /bin/sleep <add> ` <add> <add> ctx := context.Background() <add> source := fakecontext.New(t, "", fakecontext.WithDockerfile(dockerfile)) <add> defer source.Close() <add> <add> clientUserRemap := dUserRemap.NewClientT(t) <add> resp, err := clientUserRemap.ImageBuild(ctx, <add> source.AsTarReader(t), <add> types.ImageBuildOptions{ <add> Tags: []string{imageTag}, <add> }) <add> assert.NilError(t, err) <add> defer resp.Body.Close() <add> buf := make([]byte, 1024) <add> for { <add> n, err := resp.Body.Read(buf) <add> if err != nil && err != io.EOF { <add> t.Fatalf("Error reading ImageBuild response: %v", err) <add> break <add> } <add> if n == 0 { <add> break <add> } <add> } <add> <add> reader, err := clientUserRemap.ImageSave(ctx, []string{imageTag}) <add> assert.NilError(t, err, "failed to download capabilities image") <add> defer reader.Close() <add> <add> tar, err := os.Create(tmp + "/image.tar") <add> assert.NilError(t, err, "failed to create image tar file") <add> defer tar.Close() <add> <add> _, err = io.Copy(tar, reader) <add> assert.NilError(t, err, "failed to write image tar file") <add> <add> dUserRemap.Stop(t) <add> dUserRemap.Cleanup(t) <add> dUserRemapRunning = false <add> <add> dNoUserRemap := daemon.New(t) <add> dNoUserRemap.StartWithBusybox(t) <add> defer dNoUserRemap.Stop(t) <add> <add> clientNoUserRemap := dNoUserRemap.NewClientT(t) <add> <add> tarFile, err := os.Open(tmp + "/image.tar") <add> assert.NilError(t, err, "failed to open image tar file") <add> <add> tarReader := bufio.NewReader(tarFile) <add> loadResp, err := clientNoUserRemap.ImageLoad(ctx, tarReader, false) <add> assert.NilError(t, err, "failed to load image tar file") <add> defer loadResp.Body.Close() <add> for { <add> n, err := loadResp.Body.Read(buf) <add> if err != nil && err != io.EOF { <add> t.Fatalf("Error reading ImageLoad response: %v", err) <add> break <add> } <add> if n == 0 { <add> break <add> } <add> } <add> <add> cid := container.Run(ctx, t, clientNoUserRemap, <add> container.WithImage(imageTag), <add> container.WithCmd("/sbin/getcap", "-n", "/bin/sleep"), <add> ) <add> logReader, err := clientNoUserRemap.ContainerLogs(ctx, cid, types.ContainerLogsOptions{ <add> ShowStdout: true, <add> }) <add> assert.NilError(t, err) <add> <add> actualStdout := new(bytes.Buffer) <add> actualStderr := ioutil.Discard <add> _, err = stdcopy.StdCopy(actualStdout, actualStderr, logReader) <add> assert.NilError(t, err) <add> if strings.TrimSpace(actualStdout.String()) != "/bin/sleep cap_net_bind_service=eip" { <add> // Activate when fix is merged: https://github.com/moby/moby/pull/41724 <add> //t.Fatalf("run produced invalid output: %q, expected %q", actualStdout.String(), "/bin/sleep cap_net_bind_service=eip") <add> // t.Logf("run produced invalid output (expected until #41724 merges): %q, expected %q", <add> // actualStdout.String(), <add> // "/bin/sleep cap_net_bind_service=eip") <add> } else { <add> // Shouldn't happen until fix is merged: https://github.com/moby/moby/pull/41724 <add> t.Fatalf("run produced valid output (unexpected until #41724 merges): %q, expected %q", <add> actualStdout.String(), <add> "/bin/sleep cap_net_bind_service=eip") <add> } <add>}
1
Go
Go
add solaris support to lstat
e3ab23630964c4cd3bac7cef637fe89e2318c47d
<ide><path>pkg/system/stat_solaris.go <add>package system // import "github.com/docker/docker/pkg/system" <add> <add>import "syscall" <add> <add>// fromStatT converts a syscall.Stat_t type to a system.Stat_t type <add>func fromStatT(s *syscall.Stat_t) (*StatT, error) { <add> return &StatT{size: s.Size, <add> mode: s.Mode, <add> uid: s.Uid, <add> gid: s.Gid, <add> rdev: s.Rdev, <add> mtim: s.Mtim}, nil <add>}
1
Mixed
Javascript
add comments for whatwg-url tests
9e4ab6c2065229c5f79b6cc663d554f9de16f703
<ide><path>doc/guides/writing-tests.md <ide> Some of the tests for the WHATWG URL implementation (named <ide> These imported tests will be wrapped like this: <ide> <ide> ```js <del>/* eslint-disable */ <del>/* WPT Refs: <add>/* The following tests are copied from WPT. Modifications to them should be <add> upstreamed first. Refs: <ide> https://github.com/w3c/web-platform-tests/blob/8791bed/url/urlsearchparams-stringifier.html <ide> License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html <ide> */ <add>/* eslint-disable */ <ide> <ide> // Test code <ide> <ide><path>test/fixtures/url-setter-tests.js <ide> 'use strict'; <ide> <del>/* WPT Refs: <add>/* The following tests are copied from WPT. Modifications to them should be <add> upstreamed first. Refs: <ide> https://github.com/w3c/web-platform-tests/blob/b30abaecf4/url/setters_tests.json <ide> License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html <ide> */ <ide><path>test/fixtures/url-tests.js <ide> 'use strict'; <ide> <del>/* WPT Refs: <add>/* The following tests are copied from WPT. Modifications to them should be <add> upstreamed first. Refs: <ide> https://github.com/w3c/web-platform-tests/blob/8df7c9c215/url/urltestdata.json <ide> License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html <ide> */ <ide><path>test/fixtures/url-toascii.js <ide> 'use strict'; <ide> <del>/* WPT Refs: <add>/* The following tests are copied from WPT. Modifications to them should be <add> upstreamed first. Refs: <ide> https://github.com/w3c/web-platform-tests/blob/4839a0a804/url/toascii.json <ide> License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html <ide> */ <ide><path>test/parallel/test-whatwg-url-constructor.js <ide> const request = { <ide> response: require(path.join(common.fixturesDir, 'url-tests')) <ide> }; <ide> <del>/* eslint-disable */ <del>/* WPT Refs: <add>/* The following tests are copied from WPT. Modifications to them should be <add> upstreamed first. Refs: <ide> https://github.com/w3c/web-platform-tests/blob/8791bed/url/url-constructor.html <ide> License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html <ide> */ <add>/* eslint-disable */ <ide> function runURLConstructorTests() { <ide> // var setup = async_test("Loading data…") <ide> // setup.step(function() { <ide><path>test/parallel/test-whatwg-url-historical.js <ide> if (!common.hasIntl) { <ide> const URL = require('url').URL; <ide> const { test, assert_equals, assert_throws } = require('../common/wpt'); <ide> <del>/* eslint-disable */ <del>/* WPT Refs: <add>/* The following tests are copied from WPT. Modifications to them should be <add> upstreamed first. Refs: <ide> https://github.com/w3c/web-platform-tests/blob/8791bed/url/historical.html <ide> License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html <ide> */ <add>/* eslint-disable */ <ide> // var objects = [ <ide> // [function() { return window.location }, "location object"], <ide> // [function() { return document.createElement("a") }, "a element"], <ide><path>test/parallel/test-whatwg-url-origin.js <ide> const request = { <ide> response: require(path.join(common.fixturesDir, 'url-tests')) <ide> }; <ide> <del>/* eslint-disable */ <del>/* WPT Refs: <add>/* The following tests are copied from WPT. Modifications to them should be <add> upstreamed first. Refs: <ide> https://github.com/w3c/web-platform-tests/blob/8791bed/url/url-origin.html <ide> License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html <ide> */ <add>/* eslint-disable */ <ide> function runURLOriginTests() { <ide> // var setup = async_test("Loading data…") <ide> // setup.step(function() { <ide><path>test/parallel/test-whatwg-url-searchparams-append.js <ide> const assert = require('assert'); <ide> const URLSearchParams = require('url').URLSearchParams; <ide> const { test, assert_equals, assert_true } = require('../common/wpt'); <ide> <del>/* eslint-disable */ <del>/* WPT Refs: <add>/* The following tests are copied from WPT. Modifications to them should be <add> upstreamed first. Refs: <ide> https://github.com/w3c/web-platform-tests/blob/8791bed/url/urlsearchparams-append.html <ide> License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html <ide> */ <add>/* eslint-disable */ <ide> test(function() { <ide> var params = new URLSearchParams(); <ide> params.append('a', 'b'); <ide><path>test/parallel/test-whatwg-url-searchparams-constructor.js <ide> const { <ide> assert_false, assert_throws, assert_array_equals <ide> } = require('../common/wpt'); <ide> <del>/* eslint-disable */ <del>var params; // Strict mode fix for WPT. <del>/* WPT Refs: <add>/* The following tests are copied from WPT. Modifications to them should be <add> upstreamed first. Refs: <ide> https://github.com/w3c/web-platform-tests/blob/54c3502d7b/url/urlsearchparams-constructor.html <ide> License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html <ide> */ <add>/* eslint-disable */ <add>var params; // Strict mode fix for WPT. <ide> test(function() { <ide> var params = new URLSearchParams(); <ide> assert_equals(params + '', ''); <ide><path>test/parallel/test-whatwg-url-searchparams-delete.js <ide> const { URL, URLSearchParams } = require('url'); <ide> const { test, assert_equals, assert_true, assert_false } = <ide> require('../common/wpt'); <ide> <del>/* eslint-disable */ <del>/* WPT Refs: <add>/* The following tests are copied from WPT. Modifications to them should be <add> upstreamed first. Refs: <ide> https://github.com/w3c/web-platform-tests/blob/8791bed/url/urlsearchparams-delete.html <ide> License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html <ide> */ <add>/* eslint-disable */ <ide> test(function() { <ide> var params = new URLSearchParams('a=b&c=d'); <ide> params.delete('a'); <ide><path>test/parallel/test-whatwg-url-searchparams-foreach.js <ide> const { URL, URLSearchParams } = require('url'); <ide> const { test, assert_array_equals, assert_unreached } = <ide> require('../common/wpt'); <ide> <del>/* eslint-disable */ <del>var i; // Strict mode fix for WPT. <del>/* WPT Refs: <add>/* The following tests are copied from WPT. Modifications to them should be <add> upstreamed first. Refs: <ide> https://github.com/w3c/web-platform-tests/blob/a8b2b1e/url/urlsearchparams-foreach.html <ide> License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html <ide> */ <add>/* eslint-disable */ <add>var i; // Strict mode fix for WPT. <ide> test(function() { <ide> var params = new URLSearchParams('a=1&b=2&c=3'); <ide> var keys = []; <ide><path>test/parallel/test-whatwg-url-searchparams-get.js <ide> const assert = require('assert'); <ide> const URLSearchParams = require('url').URLSearchParams; <ide> const { test, assert_equals, assert_true } = require('../common/wpt'); <ide> <del>/* eslint-disable */ <del>/* WPT Refs: <add>/* The following tests are copied from WPT. Modifications to them should be <add> upstreamed first. Refs: <ide> https://github.com/w3c/web-platform-tests/blob/8791bed/url/urlsearchparams-get.html <ide> License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html <ide> */ <add>/* eslint-disable */ <ide> test(function() { <ide> var params = new URLSearchParams('a=b&c=d'); <ide> assert_equals(params.get('a'), 'b'); <ide><path>test/parallel/test-whatwg-url-searchparams-getall.js <ide> const URLSearchParams = require('url').URLSearchParams; <ide> const { test, assert_equals, assert_true, assert_array_equals } = <ide> require('../common/wpt'); <ide> <del>/* eslint-disable */ <del>/* WPT Refs: <add>/* The following tests are copied from WPT. Modifications to them should be <add> upstreamed first. Refs: <ide> https://github.com/w3c/web-platform-tests/blob/8791bed/url/urlsearchparams-getall.html <ide> License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html <ide> */ <add>/* eslint-disable */ <ide> test(function() { <ide> var params = new URLSearchParams('a=b&c=d'); <ide> assert_array_equals(params.getAll('a'), ['b']); <ide><path>test/parallel/test-whatwg-url-searchparams-has.js <ide> const assert = require('assert'); <ide> const URLSearchParams = require('url').URLSearchParams; <ide> const { test, assert_false, assert_true } = require('../common/wpt'); <ide> <del>/* eslint-disable */ <del>/* WPT Refs: <add>/* The following tests are copied from WPT. Modifications to them should be <add> upstreamed first. Refs: <ide> https://github.com/w3c/web-platform-tests/blob/8791bed/url/urlsearchparams-has.html <ide> License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html <ide> */ <add>/* eslint-disable */ <ide> test(function() { <ide> var params = new URLSearchParams('a=b&c=d'); <ide> assert_true(params.has('a')); <ide><path>test/parallel/test-whatwg-url-searchparams-set.js <ide> const assert = require('assert'); <ide> const URLSearchParams = require('url').URLSearchParams; <ide> const { test, assert_equals, assert_true } = require('../common/wpt'); <ide> <del>/* eslint-disable */ <del>/* WPT Refs: <add>/* The following tests are copied from WPT. Modifications to them should be <add> upstreamed first. Refs: <ide> https://github.com/w3c/web-platform-tests/blob/8791bed/url/urlsearchparams-set.html <ide> License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html <ide> */ <add>/* eslint-disable */ <ide> test(function() { <ide> var params = new URLSearchParams('a=b&c=d'); <ide> params.set('a', 'B'); <ide><path>test/parallel/test-whatwg-url-searchparams-sort.js <ide> require('../common'); <ide> const { URL, URLSearchParams } = require('url'); <ide> const { test, assert_array_equals } = require('../common/wpt'); <ide> <del>/* eslint-disable */ <del>/* WPT Refs: <add>/* The following tests are copied from WPT. Modifications to them should be <add> upstreamed first. Refs: <ide> https://github.com/w3c/web-platform-tests/blob/5903e00e77e85f8bcb21c73d1d7819fcd04763bd/url/urlsearchparams-sort.html <ide> License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html <ide> */ <add>/* eslint-disable */ <ide> [ <ide> { <ide> "input": "z=b&a=b&z=a&a=a", <ide><path>test/parallel/test-whatwg-url-searchparams-stringifier.js <ide> const assert = require('assert'); <ide> const URLSearchParams = require('url').URLSearchParams; <ide> const { test, assert_equals } = require('../common/wpt'); <ide> <del>/* eslint-disable */ <del>/* WPT Refs: <add>/* The following tests are copied from WPT. Modifications to them should be <add> upstreamed first. Refs: <ide> https://github.com/w3c/web-platform-tests/blob/8791bed/url/urlsearchparams-stringifier.html <ide> License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html <ide> */ <add>/* eslint-disable */ <ide> test(function() { <ide> var params = new URLSearchParams(); <ide> params.append('a', 'b c'); <ide><path>test/parallel/test-whatwg-url-setters.js <ide> const request = { <ide> response: require(path.join(common.fixturesDir, 'url-setter-tests')) <ide> }; <ide> <del>/* eslint-disable */ <del>/* WPT Refs: <add>/* The following tests are copied from WPT. Modifications to them should be <add> upstreamed first. Refs: <ide> https://github.com/w3c/web-platform-tests/blob/8791bed/url/url-setters.html <ide> License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html <ide> */ <add>/* eslint-disable */ <ide> function startURLSettersTests() { <ide> // var setup = async_test("Loading data…") <ide> // setup.step(function() { <ide><path>test/parallel/test-whatwg-url-toascii.js <ide> const request = { <ide> response: require(path.join(common.fixturesDir, 'url-toascii')) <ide> }; <ide> <del>/* eslint-disable */ <del>/* WPT Refs: <add>/* The following tests are copied from WPT. Modifications to them should be <add> upstreamed first. Refs: <ide> https://github.com/w3c/web-platform-tests/blob/4839a0a804/url/toascii.window.js <ide> License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html <ide> */ <add>/* eslint-disable */ <ide> // async_test(t => { <ide> // const request = new XMLHttpRequest() <ide> // request.open("GET", "toascii.json") <ide><path>test/parallel/test-whatwg-url-tojson.js <ide> require('../common'); <ide> const URL = require('url').URL; <ide> const { test, assert_equals } = require('../common/wpt'); <ide> <del>/* eslint-disable */ <del>/* WPT Refs: <add>/* The following tests are copied from WPT. Modifications to them should be <add> upstreamed first. Refs: <ide> https://github.com/w3c/web-platform-tests/blob/02585db/url/url-tojson.html <ide> License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html <ide> */ <add>/* eslint-disable */ <ide> test(() => { <ide> const a = new URL("https://example.com/") <ide> assert_equals(JSON.stringify(a), "\"https://example.com/\"")
20
Javascript
Javascript
fix eventtarget benchmark
336546b075edc068f7d8daf7c04d92a530d94ba4
<ide><path>benchmark/events/eventtarget.js <ide> const common = require('../common.js'); <ide> <ide> const bench = common.createBenchmark(main, { <del> n: [2e7], <add> n: [1e6], <ide> listeners: [1, 5, 10] <ide> }, { flags: ['--expose-internals'] }); <ide> <ide> function main({ n, listeners }) { <ide> for (let n = 0; n < listeners; n++) <ide> target.addEventListener('foo', () => {}); <ide> <del> const event = new Event('foo'); <del> <ide> bench.start(); <ide> for (let i = 0; i < n; i++) { <del> target.dispatchEvent(event); <add> target.dispatchEvent(new Event('foo')); <ide> } <ide> bench.end(n); <ide>
1
Javascript
Javascript
fix eslint errors
f6b6956a3aeb341fb3987a8ddb6c76fb9a37999c
<ide><path>src/chart.js <ide> require('./charts/Chart.Scatter')(Chart); <ide> var plugins = []; <ide> <ide> plugins.push( <del> require('./plugins/plugin.filler')(Chart), <del> require('./plugins/plugin.legend')(Chart), <del> require('./plugins/plugin.title')(Chart) <add> require('./plugins/plugin.filler')(Chart), <add> require('./plugins/plugin.legend')(Chart), <add> require('./plugins/plugin.title')(Chart) <ide> ); <ide> <ide> Chart.plugins.register(plugins); <ide><path>src/controllers/controller.doughnut.js <ide> module.exports = function(Chart) { <ide> var endAngle = startAngle + circumference; <ide> var start = {x: Math.cos(startAngle), y: Math.sin(startAngle)}; <ide> var end = {x: Math.cos(endAngle), y: Math.sin(endAngle)}; <del> var contains0 = (startAngle <= 0 && 0 <= endAngle) || (startAngle <= Math.PI * 2.0 && Math.PI * 2.0 <= endAngle); <add> var contains0 = (startAngle <= 0 && endAngle >= 0) || (startAngle <= Math.PI * 2.0 && Math.PI * 2.0 <= endAngle); <ide> var contains90 = (startAngle <= Math.PI * 0.5 && Math.PI * 0.5 <= endAngle) || (startAngle <= Math.PI * 2.5 && Math.PI * 2.5 <= endAngle); <ide> var contains180 = (startAngle <= -Math.PI && -Math.PI <= endAngle) || (startAngle <= Math.PI && Math.PI <= endAngle); <ide> var contains270 = (startAngle <= -Math.PI * 0.5 && -Math.PI * 0.5 <= endAngle) || (startAngle <= Math.PI * 1.5 && Math.PI * 1.5 <= endAngle); <ide><path>src/core/core.controller.js <ide> module.exports = function(Chart) { <ide> * @private <ide> */ <ide> me.chart = me; <del> me.controller = me; // chart.chart.controller #inception <add> me.controller = me; // chart.chart.controller #inception <ide> <ide> // Add the chart instance to the global namespace <ide> Chart.instances[me.id] = me; <ide> module.exports = function(Chart) { <ide> // the canvas render width and height will be casted to integers so make sure that <ide> // the canvas display style uses the same integer values to avoid blurring effect. <ide> <del> // Set to 0 instead of canvas.size because the size defaults to 300x150 if the element is collased <add> // Set to 0 instead of canvas.size because the size defaults to 300x150 if the element is collased <ide> var newWidth = Math.max(0, Math.floor(helpers.getMaximumWidth(canvas))); <ide> var newHeight = Math.max(0, Math.floor(aspectRatio ? newWidth / aspectRatio : helpers.getMaximumHeight(canvas))); <ide> <ide> module.exports = function(Chart) { <ide> var me = this; <ide> me.tooltip = new Chart.Tooltip({ <ide> _chart: me, <del> _chartInstance: me, // deprecated, backward compatibility <add> _chartInstance: me, // deprecated, backward compatibility <ide> _data: me.data, <ide> _options: me.options.tooltips <ide> }, me); <ide><path>src/core/core.scale.js <ide> module.exports = function(Chart) { <ide> var min = me.min; <ide> var max = me.max; <ide> <del> return me.beginAtZero ? 0: <del> min < 0 && max < 0? max : <del> min > 0 && max > 0? min : <add> return me.beginAtZero ? 0 : <add> min < 0 && max < 0 ? max : <add> min > 0 && max > 0 ? min : <ide> 0; <ide> }, <ide> <ide><path>src/scales/scale.logarithmic.js <ide> module.exports = function(Chart) { <ide> if (me.isHorizontal()) { <ide> innerDimension = me.width; <ide> value = me.start * Math.pow(10, (pixel - me.left) * range / innerDimension); <del> } else { // todo: if start === 0 <add> } else { // todo: if start === 0 <ide> innerDimension = me.height; <ide> value = Math.pow(10, (me.bottom - pixel) * range / innerDimension) / me.start; <ide> } <ide><path>src/scales/scale.radialLinear.js <ide> module.exports = function(Chart) { <ide> var max = me.max; <ide> <ide> return me.getPointPositionForValue(0, <del> me.beginAtZero? 0: <del> min < 0 && max < 0? max : <del> min > 0 && max > 0? min : <add> me.beginAtZero ? 0 : <add> min < 0 && max < 0 ? max : <add> min > 0 && max > 0 ? min : <ide> 0); <ide> }, <ide> <ide><path>test/jasmine.utils.js <ide> function injectCSS(css) { <ide> var head = document.getElementsByTagName('head')[0]; <ide> var style = document.createElement('style'); <ide> style.setAttribute('type', 'text/css'); <del> if (style.styleSheet) { // IE <add> if (style.styleSheet) { // IE <ide> style.styleSheet.cssText = css; <ide> } else { <ide> style.appendChild(document.createTextNode(css)); <ide><path>test/specs/controller.polarArea.tests.js <ide> describe('Polar area controller tests', function() { <ide> type: 'polarArea', <ide> data: { <ide> datasets: [ <del> {data: []}, <del> {data: []} <add> {data: []}, <add> {data: []} <ide> ], <ide> labels: [] <ide> } <ide><path>test/specs/scale.category.tests.js <ide> describe('Category scale tests', function() { <ide> padding: 0, <ide> reverse: false, <ide> display: true, <del> callback: defaultConfig.ticks.callback, // make this nicer, then check explicitly below <add> callback: defaultConfig.ticks.callback, // make this nicer, then check explicitly below <ide> autoSkip: true, <ide> autoSkipPadding: 0, <ide> labelOffset: 0, <ide><path>test/specs/scale.logarithmic.tests.js <ide> describe('Logarithmic Scale tests', function() { <ide> }); <ide> <ide> var xScale = chart.scales.xScale; <del> expect(xScale.getPixelForValue(80, 0, 0)).toBeCloseToPixel(495); // right - paddingRight <add> expect(xScale.getPixelForValue(80, 0, 0)).toBeCloseToPixel(495); // right - paddingRight <ide> expect(xScale.getPixelForValue(1, 0, 0)).toBeCloseToPixel(37); // left + paddingLeft <del> expect(xScale.getPixelForValue(10, 0, 0)).toBeCloseToPixel(278); // halfway <add> expect(xScale.getPixelForValue(10, 0, 0)).toBeCloseToPixel(278); // halfway <ide> expect(xScale.getPixelForValue(0, 0, 0)).toBeCloseToPixel(37); // 0 is invalid, put it on the left. <ide> <ide> expect(xScale.getValueForPixel(495)).toBeCloseToPixel(80); <ide> expect(xScale.getValueForPixel(48)).toBeCloseTo(1, 1e-4); <ide> expect(xScale.getValueForPixel(278)).toBeCloseTo(10, 1e-4); <ide> <ide> var yScale = chart.scales.yScale; <del> expect(yScale.getPixelForValue(80, 0, 0)).toBeCloseToPixel(32); // top + paddingTop <add> expect(yScale.getPixelForValue(80, 0, 0)).toBeCloseToPixel(32); // top + paddingTop <ide> expect(yScale.getPixelForValue(1, 0, 0)).toBeCloseToPixel(484); // bottom - paddingBottom <del> expect(yScale.getPixelForValue(10, 0, 0)).toBeCloseToPixel(246); // halfway <del> expect(yScale.getPixelForValue(0, 0, 0)).toBeCloseToPixel(484); // 0 is invalid. force it on bottom <add> expect(yScale.getPixelForValue(10, 0, 0)).toBeCloseToPixel(246); // halfway <add> expect(yScale.getPixelForValue(0, 0, 0)).toBeCloseToPixel(484); // 0 is invalid. force it on bottom <ide> <ide> expect(yScale.getValueForPixel(32)).toBeCloseTo(80, 1e-4); <ide> expect(yScale.getValueForPixel(484)).toBeCloseTo(1, 1e-4); <ide> describe('Logarithmic Scale tests', function() { <ide> }); <ide> <ide> var yScale = chart.scales.yScale; <del> expect(yScale.getPixelForValue(70, 0, 0)).toBeCloseToPixel(32); // top + paddingTop <del> expect(yScale.getPixelForValue(0, 0, 0)).toBeCloseToPixel(484); // bottom - paddingBottom <del> expect(yScale.getPixelForValue(0.063, 0, 0)).toBeCloseToPixel(475); // minNotZero 2% from range <add> expect(yScale.getPixelForValue(70, 0, 0)).toBeCloseToPixel(32); // top + paddingTop <add> expect(yScale.getPixelForValue(0, 0, 0)).toBeCloseToPixel(484); // bottom - paddingBottom <add> expect(yScale.getPixelForValue(0.063, 0, 0)).toBeCloseToPixel(475); // minNotZero 2% from range <ide> expect(yScale.getPixelForValue(0.5, 0, 0)).toBeCloseToPixel(344); <ide> expect(yScale.getPixelForValue(4, 0, 0)).toBeCloseToPixel(213); <ide> expect(yScale.getPixelForValue(10, 0, 0)).toBeCloseToPixel(155); <ide> expect(yScale.getPixelForValue(63, 0, 0)).toBeCloseToPixel(38.5); <ide> <del> chart.options.scales.yAxes[0].ticks.reverse = true; // Reverse mode <add> chart.options.scales.yAxes[0].ticks.reverse = true; // Reverse mode <ide> chart.update(); <ide> <del> expect(yScale.getPixelForValue(70, 0, 0)).toBeCloseToPixel(484); // bottom - paddingBottom <del> expect(yScale.getPixelForValue(0, 0, 0)).toBeCloseToPixel(32); // top + paddingTop <del> expect(yScale.getPixelForValue(0.063, 0, 0)).toBeCloseToPixel(41); // minNotZero 2% from range <add> expect(yScale.getPixelForValue(70, 0, 0)).toBeCloseToPixel(484); // bottom - paddingBottom <add> expect(yScale.getPixelForValue(0, 0, 0)).toBeCloseToPixel(32); // top + paddingTop <add> expect(yScale.getPixelForValue(0.063, 0, 0)).toBeCloseToPixel(41); // minNotZero 2% from range <ide> expect(yScale.getPixelForValue(0.5, 0, 0)).toBeCloseToPixel(172); <ide> expect(yScale.getPixelForValue(4, 0, 0)).toBeCloseToPixel(303); <ide> expect(yScale.getPixelForValue(10, 0, 0)).toBeCloseToPixel(361);
10
Text
Text
make tests and test descriptions more explicit
9669e39b85a6c46f5407256043ef164ea2293fe7
<ide><path>curriculum/challenges/english/10-coding-interview-prep/rosetta-code/top-rank-per-group.md <ide> Find the top `n` ranked data in each group, where `n` is provided as a parameter <ide> <ide> Given the following data: <ide> <del><pre>[ <add>```js <add>testData1 = [ <ide> { name: 'Tyler Bennett', id: 'E10297', salary: 32000, dept: 'D101' }, <ide> { name: 'John Rappl', id: 'E21437', salary: 47000, dept: 'D050' }, <ide> { name: 'George Woltman', id: 'E00127', salary: 53500, dept: 'D101' }, <ide> Given the following data: <ide> { name: 'Kim Arlich', id: 'E10001', salary: 57000, dept: 'D190' }, <ide> { name: 'Timothy Grove', id: 'E16398', salary: 29900, dept: 'D190' } <ide> ]; <del></pre> <add>``` <ide> <del>one could rank top 10 employees in each department by calling <add>One could rank top 10 employees in each department by calling: <ide> <del>`topRankPerGroup(10, data, 'dept', 'salary')` <add>`topRankPerGroup(10, testData1, 'dept', 'salary')` <ide> <ide> Given the following data: <ide> <del><pre>[ <add>```js <add>testData2 = [ <ide> { name: 'Friday 13th', genre: 'horror', rating: 9.9 }, <ide> { name: "Nightmare on Elm's Street", genre: 'horror', rating: 5.7 }, <ide> { name: 'Titanic', genre: 'drama', rating: 7.3 }, <ide> { name: 'Maze Runner', genre: 'scifi', rating: 7.1 }, <ide> { name: 'Blade runner', genre: 'scifi', rating: 8.9 } <ide> ]; <del></pre> <add>``` <ide> <del>one could rank the top-rated movie in each genre by calling <add>One could rank the top-rated movie in each genre by calling: <ide> <del>`topRankPerGroup(1, data, 'genre', 'rating')` <add>`topRankPerGroup(1, testData2, 'genre', 'rating')` <ide> <ide> The function should return an array with an array for each group containing the top `n` objects. <ide> <add>For example, given data: <add> <add>```js <add>[ <add> { name: 'Claire Buckman', id: 'E39876', salary: 27800, dept: 'D101' }, <add> { name: 'Rich Holcomb', id: 'E01234', salary: 49500, dept: 'D050' }, <add> { name: 'David Motsinger', id: 'E27002', salary: 19250, dept: 'D050' }, <add> { name: 'Tim Sampair', id: 'E03033', salary: 27000, dept: 'D101' }, <add> { name: 'Kim Arlich', id: 'E10001', salary: 57000, dept: 'D050' }, <add> { name: 'Timothy Grove', id: 'E16398', salary: 29900, dept: 'D101' } <add>]; <add>``` <add> <add>Top two ranking employees in each department by salary would be: <add> <add>```js <add>[ [ { name: 'Kim Arlich', id: 'E10001', salary: 57000, dept: 'D050' }, <add> { name: 'Rich Holcomb', id: 'E01234', salary: 49500, dept: 'D050' } ], <add> [ { name: 'Timothy Grove', id: 'E16398', salary: 29900, dept: 'D101' }, <add> { name: 'Claire Buckman', id: 'E39876', salary: 27800, dept: 'D101' } ] ] <add>``` <add> <ide> # --hints-- <ide> <ide> `topRankPerGroup` should be a function. <ide> assert(typeof topRankPerGroup === 'function'); <ide> assert(typeof topRankPerGroup(-1, []) === 'undefined'); <ide> ``` <ide> <del>First department should be D050 <add>For `topRankPerGroup(10, testData1, 'dept', 'salary')`, the first result in the first group should be `{ name: 'John Rappl', id: 'E21437', salary: 47000, dept: 'D050'}`. <ide> <ide> ```js <del>assert.equal(res1[0][0].dept, 'D050'); <add>assert.deepEqual(res1[0][0], { name: 'John Rappl', id: 'E21437', salary: 47000, dept: 'D050'}); <ide> ``` <ide> <del>First department should be D050 <add>For `topRankPerGroup(10, testData1, 'dept', 'salary')`, the last result in the last group should be `{ name: 'Adam Smith', id: 'E63535', salary: 18000, dept: 'D202' }`. <ide> <ide> ```js <del>assert.equal(res1[0][1].salary, 21900); <del>``` <del> <del>The last department should be D202 <del> <del>```js <del>assert.equal(res1[3][3].dept, 'D202'); <add>assert.deepEqual(res1[3][3], { name: 'Adam Smith', id: 'E63535', salary: 18000, dept: 'D202' }); <ide> ``` <ide> <ide> `topRankPerGroup(1, ...)` should return only top ranking result per group. <ide> assert.equal(res1[3][3].dept, 'D202'); <ide> assert.equal(res2[2].length, 1); <ide> ``` <ide> <del>`topRankPerGroup(1, ...)` should return only top ranking result per group. <add>`topRankPerGroup(2, ...)` should return two ranking results per group. <ide> <ide> ```js <ide> assert.equal(res3[2][1].name, 'Maze Runner');
1
Text
Text
fix railties/changelog.md for cookie_serializer
b59620c15509921ceb2b7a797016d33e2574b599
<ide><path>railties/CHANGELOG.md <ide> or `config/initializers/cookies_serializer.rb` <ide> <ide> The default value for `cookies_serializer` (`:json`) has been moved to `config.load_defaults("7.0")`. <del> The new framework defaults file sets the serializer to `:marshal`. <add> The new framework defaults file can be used to upgrade the serializer. <ide> <ide> *Alex Ghiculescu* <ide>
1
Javascript
Javascript
fix chunk loading
cb89fedf8d239f5dc891afd9ee64f3e5ac377a19
<ide><path>lib/esm/ModuleChunkLoadingPlugin.js <ide> class ModuleChunkLoadingPlugin { <ide> const isEnabledForChunk = chunk => { <ide> const options = chunk.getEntryOptions(); <ide> const chunkLoading = <del> (options && options.chunkLoading) || globalChunkLoading; <add> options && options.chunkLoading !== undefined <add> ? options.chunkLoading <add> : globalChunkLoading; <ide> return chunkLoading === "import"; <ide> }; <ide> const onceForChunkSet = new WeakSet();
1
Javascript
Javascript
preserve style type in `flattenstyle`
7e7527e7db9068390f28de8264289c8c50053831
<ide><path>Libraries/ReactPrivate/ReactNativePrivateInterface.js <ide> import typeof UIManager from '../ReactNative/UIManager'; <ide> import typeof deepDiffer from '../Utilities/differ/deepDiffer'; <ide> import typeof deepFreezeAndThrowOnMutationInDev from '../Utilities/deepFreezeAndThrowOnMutationInDev'; <ide> import typeof flattenStyle from '../StyleSheet/flattenStyle'; <add>import {type DangerouslyImpreciseStyleProp} from '../StyleSheet/StyleSheet'; <ide> import typeof ReactFiberErrorDialog from '../Core/ReactFiberErrorDialog'; <ide> <ide> // flowlint unsafe-getters-setters:off <ide> module.exports = { <ide> > { <ide> return require('../Utilities/deepFreezeAndThrowOnMutationInDev'); <ide> }, <del> get flattenStyle(): flattenStyle { <add> get flattenStyle(): flattenStyle<DangerouslyImpreciseStyleProp> { <ide> return require('../StyleSheet/flattenStyle'); <ide> }, <ide> get ReactFiberErrorDialog(): ReactFiberErrorDialog { <ide><path>Libraries/StyleSheet/StyleSheetTypes.js <ide> export type ____Styles_Internal = { <ide> +[key: string]: $Shape<____DangerouslyImpreciseStyle_Internal>, <ide> ..., <ide> }; <add> <add>export type ____FlattenStyleProp_Internal<+TStyleProp> = $Call< <add> <T>(GenericStyleProp<T>) => T, <add> TStyleProp, <add>>; <ide><path>Libraries/StyleSheet/flattenStyle.js <ide> <ide> 'use strict'; <ide> <del>import type { <del> DangerouslyImpreciseStyle, <del> DangerouslyImpreciseStyleProp, <del>} from './StyleSheet'; <add>import type {DangerouslyImpreciseStyleProp} from './StyleSheet'; <add>import type {____FlattenStyleProp_Internal} from './StyleSheetTypes'; <ide> <del>function flattenStyle( <del> style: ?DangerouslyImpreciseStyleProp, <del>): ?DangerouslyImpreciseStyle { <add>function flattenStyle<+TStyleProp: DangerouslyImpreciseStyleProp>( <add> style: ?TStyleProp, <add>): ?____FlattenStyleProp_Internal<TStyleProp> { <ide> if (style === null || typeof style !== 'object') { <ide> return undefined; <ide> }
3
Javascript
Javascript
fix ucd extraction for node 10.x
ba4d9035860fc23944c12b5e39d5da4ab4faf4bf
<ide><path>i18n/ucd/src/extract.js <ide> function main() { <ide> } catch (e) { <ide> fs.mkdirSync(__dirname + '/../../../src/ngParseExt'); <ide> } <del> fs.writeFile(__dirname + '/../../../src/ngParseExt/ucd.js', code); <add> fs.writeFileSync(__dirname + '/../../../src/ngParseExt/ucd.js', code); <ide> } <ide> } <ide>
1
Python
Python
kill npymath ltcg on clang, intel
41bae1ed7fa47213b45abacdf7ed19abdb58c7b3
<ide><path>numpy/core/setup.py <ide> def get_mathlib_info(*args): <ide> join('src', 'npymath', 'halffloat.c') <ide> ] <ide> <del> is_msvc = customized_ccompiler().compiler_type == 'msvc' <add> compiler_type = customized_ccompiler().compiler_type <add> is_msvc = compiler_type == 'msvc' <add> is_msvc = is_msvc or (sys.platform == 'win32' and compiler_type in ('clang', 'intel')) <add> <ide> config.add_installed_library('npymath', <ide> sources=npymath_sources + [get_mathlib_info], <ide> install_dir='lib',
1
Text
Text
add 2.8.0-beta.5 to changelog.md
d43a86326b35fb493737bca48ccd5dc8e64547d7
<ide><path>CHANGELOG.md <ide> # Ember Changelog <ide> <add>### 2.8.0-beta.5 (August 30, 2016) <add> <add>- [#14159](https://github.com/emberjs/ember.js/pull/14159) [BUGFIX] Fix rendering system cleanup. <add> <ide> ### 2.8.0-beta.4 (August 29, 2016) <ide> <ide> - [#14123](https://github.com/emberjs/ember.js/pull/14123) [BUGFIX] Avoid rerendering outlet state during router destruction.
1
PHP
PHP
add missing docblock for runtimeexception
e77160aa29370d76bb3b9440d7d141c0f21c226b
<ide><path>src/Illuminate/Hashing/ArgonHasher.php <ide> public function __construct(array $options = []) <ide> * @param string $value <ide> * @param array $options <ide> * @return string <add> * <add> * @throws \RuntimeException <ide> */ <ide> public function make($value, array $options = []) <ide> {
1
PHP
PHP
add strict mode parameter to base64_encode
08d513dbbbdcf8952118f240d81a6991dc8e6021
<ide><path>src/Http/Middleware/CsrfProtectionMiddleware.php <ide> public function saltToken(string $token): string <ide> */ <ide> public function unsaltToken(string $token): string <ide> { <del> $decoded = base64_decode($token); <add> $decoded = base64_decode($token, true); <ide> if ($decoded === false || strlen($decoded) !== static::TOKEN_WITH_CHECKSUM_LENGTH * 2) { <ide> return $token; <ide> } <ide> public function unsaltToken(string $token): string <ide> */ <ide> protected function _verifyToken(string $token): bool <ide> { <del> $decoded = base64_decode($token); <add> $decoded = base64_decode($token, true); <ide> // If base64 fails we're in a compatibility mode from before <ide> // tokens were salted on each request. <ide> if ($decoded === false) { <ide><path>src/Http/Middleware/SessionCsrfProtectionMiddleware.php <ide> public function saltToken(string $token): string <ide> */ <ide> protected function unsaltToken(string $token): string <ide> { <del> $decoded = base64_decode($token); <add> $decoded = base64_decode($token, true); <ide> if ($decoded === false || strlen($decoded) !== static::TOKEN_VALUE_LENGTH * 2) { <ide> return $token; <ide> }
2
Text
Text
add documentation for desired_state filter
36f57f7d024e44b1db7f5cd0c24526f4cdfb7234
<ide><path>docs/reference/commandline/node_ls.md <ide> The currently supported filters are: <ide> * name <ide> * id <ide> * label <del>* desired_state <ide> <ide> ### name <ide> <ide><path>docs/reference/commandline/node_tasks.md <ide> than one filter, then pass multiple flags (e.g., `--filter "foo=bar" --filter "b <ide> <ide> The currently supported filters are: <ide> <del>* name <del>* id <del>* label <del>* desired_state <add>* [name](#name) <add>* [id](#id) <add>* [label](#label) <add>* [desired_state](#desired_state) <ide> <del>### name <add>#### name <ide> <ide> The `name` filter matches on all or part of a task's name. <ide> <ide> The following filter matches all tasks with a name containing the `redis` string <ide> 0tgctg8h8cech4w0k0gwrmr23 redis.10 redis redis:3.0.6 Running 5 seconds Running swarm-manager1 <ide> <ide> <del>### id <add>#### id <ide> <ide> The `id` filter matches a task's id. <ide> <ide> bg8c07zzg87di2mufeq51a2qp redis.7 redis redis:3.0.6 Running 9 minutes Ru <ide> ``` <ide> <ide> <add>#### desired_state <add> <add>The `desired_state` filter can take the values `running` and `accepted`. <add> <add> <ide> ## Related information <ide> <ide> * [node inspect](node_inspect.md) <ide><path>docs/reference/commandline/service_tasks.md <ide> The currently supported filters are: <ide> <ide> * [id](#id) <ide> * [name](#name) <add>* [desired_state](#desired_state) <ide> <ide> <ide> #### ID <ide> ID NAME SERVICE IMAGE DESIRED STATE LAST S <ide> ``` <ide> <ide> <add>#### desired_state <add> <add>The `desired_state` filter can take the values `running` and `accepted`. <add> <add> <ide> ## Related information <ide> <ide> * [service create](service_create.md)
3
Ruby
Ruby
avoid empty rescue
827b48912ab0a2d36ca7b29d8bd5849b360c9c6c
<ide><path>Library/Homebrew/cask/test/cask/cli/install_test.rb <ide> lambda { <ide> begin <ide> Hbc::CLI::Install.run("googlechrome") <del> rescue Hbc::CaskError; end <del> }.must_output nil, /No available Cask for googlechrome\. Did you mean:\ngoogle-chrome/ <add> rescue Hbc::CaskError <add> nil <add> end <add> }.must_output(nil, /No available Cask for googlechrome\. Did you mean:\ngoogle-chrome/) <ide> end <ide> <ide> it "returns multiple suggestions for a Cask fragment" do <ide> lambda { <ide> begin <ide> Hbc::CLI::Install.run("google") <del> rescue Hbc::CaskError; end <del> }.must_output nil, /No available Cask for google\. Did you mean one of:\ngoogle/ <add> rescue Hbc::CaskError <add> nil <add> end <add> }.must_output(nil, /No available Cask for google\. Did you mean one of:\ngoogle/) <ide> end <ide> <ide> describe "when no Cask is specified" do
1
Ruby
Ruby
add class to deprecate instance variables
a53331a161f72b25f6e9c860db43acaf23250f68
<ide><path>activesupport/lib/active_support/deprecation.rb <ide> def warn(callstack, called, args) <ide> ActiveSupport::Deprecation.warn("#{@var} is deprecated! Call #{@method}.#{called} instead of #{@var}.#{called}. Args: #{args.inspect}", callstack) <ide> end <ide> end <add> <add> class DeprecatedInstanceVariable < Delegator #:nodoc: <add> def initialize(value, method) <add> super(value) <add> @method = method <add> @value = value <add> end <add> <add> def __getobj__ <add> ActiveSupport::Deprecation.warn("Instance variable @#{@method} is deprecated! Call instance method #{@method} instead.") <add> @value <add> end <add> end <add> <ide> end <ide> end <ide> <ide><path>activesupport/test/deprecation_test.rb <ide> def message <ide> assert_nil @last_message <ide> end <ide> end <add> <add>class DeprecatedIvarTest < Test::Unit::TestCase <add> <add> def test_deprecated_ivar <add> @action = ActiveSupport::Deprecation::DeprecatedInstanceVariable.new("fubar", :foobar) <add> <add> assert_deprecated(/Instance variable @foobar is deprecated! Call instance method foobar instead/) { assert_equal "fubar", @action } <add> end <add> <add>end
2
PHP
PHP
apply fixes from styleci
9282278a8917f76e4d33d90ef3778bcf46b6cd8c
<ide><path>src/Illuminate/Foundation/helpers.php <ide> function mix($path) <ide> if (! array_key_exists($path, $manifest)) { <ide> throw new Exception( <ide> "Unable to locate Mix file: {$path}. Please check your ". <del> "webpack.mix.js output paths and try again." <add> 'webpack.mix.js output paths and try again.' <ide> ); <ide> } <ide>
1
Ruby
Ruby
fix typo for api_app_generator_test
029b633e390c8a5351adf8e8891faf730f247c3d
<ide><path>railties/test/generators/api_app_generator_test.rb <ide> def test_api_modified_files <ide> run_generator <ide> <ide> assert_file ".gitignore" do |content| <del> assert_no_match(/\/public\/asserts/, content) <add> assert_no_match(/\/public\/assets/, content) <ide> end <ide> <ide> assert_file "Gemfile" do |content|
1
Ruby
Ruby
reduce the calling `create_table_info` query
b8bedfa2f26c1697dd48dca6201a591c42ccfba0
<ide><path>activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb <ide> def foreign_keys(table_name) <ide> AND fk.table_name = '#{table_name}' <ide> SQL <ide> <del> create_table_info = select_one("SHOW CREATE TABLE #{quote_table_name(table_name)}")["Create Table"] <add> create_table_info = create_table_info(table_name) <ide> <ide> fk_info.map do |row| <ide> options = { <ide> def foreign_keys(table_name) <ide> end <ide> <ide> def table_options(table_name) <del> create_table_info = select_one("SHOW CREATE TABLE #{quote_table_name(table_name)}")["Create Table"] <add> create_table_info = create_table_info(table_name) <ide> <ide> # strip create_definitions and partition_options <ide> raw_table_options = create_table_info.sub(/\A.*\n\) /m, '').sub(/\n\/\*!.*\*\/\n\z/m, '').strip <ide> def extract_foreign_key_action(structure, name, action) # :nodoc: <ide> end <ide> end <ide> <add> def create_table_info(table_name) # :nodoc: <add> @create_table_info_cache = {} <add> @create_table_info_cache[table_name] ||= select_one("SHOW CREATE TABLE #{quote_table_name(table_name)}")["Create Table"] <add> end <add> <ide> def create_table_definition(name, temporary = false, options = nil, as = nil) # :nodoc: <ide> TableDefinition.new(native_database_types, name, temporary, options, as) <ide> end
1
Ruby
Ruby
add test for using argv to check options
76f4eccdceb5b3fb4e88b56e077234a6a3e56b08
<ide><path>Library/Homebrew/rubocops/lines_cop.rb <ide> def audit_formula(_node, _class_node, _parent_class_node, body_node) <ide> end <ide> end <ide> <del> # [:debug?, :verbose?, :value].each do |m| <del> # find_instance_method_call(body_node, :ARGV, m) do <del> # problem "Use build instead of ARGV to check options" <del> # end <del> # end <add> [:debug?, :verbose?, :value].each do |m| <add> find_instance_method_call(body_node, "ARGV", m) do <add> problem "Use build instead of ARGV to check options" <add> end <add> end <ide> # <ide> # find_instance_method_call(body_node, :man, :+) do |m| <ide> # next unless match = regex_match_group(parameters(m).first, %r{man[1-8]}) <ide> def audit_formula(_node, _class_node, _parent_class_node, body_node) <ide> next unless match = regex_match_group(arg, %r{\-\-(.*)}) <ide> problem "Reference '#{match[1]}' without dashes" <ide> end <del> <ide> end <ide> <ide> def unless_modifier?(node) <ide><path>Library/Homebrew/test/rubocops/lines_cop_spec.rb <ide> def post_install <ide> expect_offense(expected, actual) <ide> end <ide> end <add> <add> it "with using ARGV to check options" do <add> source = <<-EOS.undent <add> class Foo < Formula <add> desc "foo" <add> url 'http://example.com/foo-1.0.tgz' <add> def test <add> verbose = ARGV.verbose? <add> end <add> end <add> EOS <add> <add> expected_offenses = [{ message: "Use build instead of ARGV to check options", <add> severity: :convention, <add> line: 5, <add> column: 14, <add> source: source }] <add> <add> inspect_source(cop, source) <add> <add> expected_offenses.zip(cop.offenses).each do |expected, actual| <add> expect_offense(expected, actual) <add> end <add> end <ide> end <ide> def expect_offense(expected, actual) <ide> expect(actual.message).to eq(expected[:message])
2
Javascript
Javascript
ignore null values when calculating scale
57bd8c7715998a668d1a3b41daa8a520070969fe
<ide><path>src/Chart.Core.js <ide> maxSteps = Math.floor(drawingSize/(textSize * 1.5)), <ide> skipFitting = (minSteps >= maxSteps); <ide> <del> var maxValue = max(valuesArray), <del> minValue = min(valuesArray); <add> // Filter out null values since these would min() to zero <add> var values = []; <add> each(valuesArray, function( v ){ <add> v == null || values.push( v ); <add> }); <add> var minValue = min(values), <add> maxValue = max(values); <ide> <ide> // We need some degree of separation here to calculate the scales if all the values are the same <ide> // Adding/minusing 0.5 will give us a range of 1.
1
Ruby
Ruby
move key packing into encryptor
e3b4554f231beb789b981dfb5e32789f5ad4d17b
<ide><path>railties/lib/rails/secrets.rb <ide> def generate_key <ide> end <ide> <ide> def key <del> [(ENV["RAILS_MASTER_KEY"] || read_key_file || handle_missing_key)] <del> .pack("H*") <add> ENV["RAILS_MASTER_KEY"] || read_key_file || handle_missing_key <ide> end <ide> <ide> def encrypt(data) <ide> def preprocess(path) <ide> end <ide> <ide> def encryptor <del> @encryptor ||= ActiveSupport::MessageEncryptor.new(key, cipher: CIPHER) <add> @encryptor ||= ActiveSupport::MessageEncryptor.new([ key ].pack("H*"), cipher: CIPHER) <ide> end <ide> end <ide> end <ide><path>railties/test/secrets_test.rb <ide> def teardown <ide> <ide> test "reading from key file" do <ide> run_secrets_generator do <del> key = "00112233445566778899aabbccddeeff" <del> File.binwrite("config/secrets.yml.key", key) <add> File.binwrite("config/secrets.yml.key", "00112233445566778899aabbccddeeff") <ide> <del> assert_equal [key].pack("H*"), Rails::Secrets.key <add> assert_equal "00112233445566778899aabbccddeeff", Rails::Secrets.key <ide> end <ide> end <ide>
2
PHP
PHP
remove specific ids from fixture
75d6db89d289d8095478fbca497d3d67253c7221
<ide><path>tests/Fixture/SiteAuthorsFixture.php <ide> class SiteAuthorsFixture extends TestFixture <ide> * @var array <ide> */ <ide> public $records = [ <del> ['id' => 1, 'name' => 'mark', 'site_id' => 1], <del> ['id' => 2, 'name' => 'juan', 'site_id' => 2], <del> ['id' => 3, 'name' => 'jose', 'site_id' => 2], <del> ['id' => 4, 'name' => 'andy', 'site_id' => 1] <add> ['name' => 'mark', 'site_id' => 1], <add> ['name' => 'juan', 'site_id' => 2], <add> ['name' => 'jose', 'site_id' => 2], <add> ['name' => 'andy', 'site_id' => 1] <ide> ]; <ide> }
1
Text
Text
fix readme link to testing
7db89f90ee92b056af3bfc0cb4b2c74833ee5f31
<ide><path>ReactAndroid/README.md <ide> See the [docs on the website](https://reactnative.dev/docs/building-from-source. <ide> <ide> # Running tests <ide> <del>When you submit a pull request CircleCI will automatically run all tests. To run tests locally, see [Testing](https://reactnative.dev/docs/testing.html). <add>When you submit a pull request CircleCI will automatically run all tests. To run tests locally, see [Testing](https://github.com/facebook/react-native/wiki/Tests).
1
PHP
PHP
fix issue with button() and nested name attributes
95b85118c77ed410f54d6fbfc4ff3fb5d1376bbd
<ide><path>lib/Cake/Test/Case/View/Helper/FormHelperTest.php <ide> public function testFormSecurityMultipleSubmitButtons() { <ide> $this->assertTags($result, $expected); <ide> } <ide> <add>/** <add> * Test that buttons created with foo[bar] name attributes are unlocked correctly. <add> * <add> * @return void <add> */ <add> public function testSecurityButtonNestedNamed() { <add> $key = 'testKey'; <add> $this->Form->request['_Token'] = array('key' => $key); <add> <add> $this->Form->create('Addresses'); <add> $this->Form->button('Test', array('type' => 'submit', 'name' => 'Address[button]')); <add> $result = $this->Form->unlockField(); <add> $this->assertEquals(array('Address.button'), $result); <add> } <add> <ide> /** <ide> * Test that the correct fields are unlocked for image submits with no names. <ide> * <ide><path>lib/Cake/View/Helper/FormHelper.php <ide> public function unlockField($name = null) { <ide> * <ide> * @param boolean $lock Whether this field should be part of the validation <ide> * or excluded as part of the unlockedFields. <del> * @param mixed $field Reference to field to be secured <add> * @param mixed $field Reference to field to be secured. Should be dot separted to indicate nesting. <ide> * @param mixed $value Field value, if value should not be tampered with. <ide> * @return void <ide> */ <ide> public function button($title, $options = array()) { <ide> $title = h($title); <ide> } <ide> if (isset($options['name'])) { <del> $this->_secure($options['secure'], $options['name']); <add> $name = str_replace(array('[', ']'), array('.', ''), $options['name']); <add> $this->_secure($options['secure'], $name); <ide> } <ide> return $this->Html->useTag('button', $options['type'], array_diff_key($options, array('type' => '')), $title); <ide> }
2
Java
Java
improve javadoc for contextloaderutils
321004143b0941a10be10edd665c843ec1ab7967
<ide><path>spring-test/src/main/java/org/springframework/test/context/ContextLoaderUtils.java <ide> /* <del> * Copyright 2002-2012 the original author or authors. <add> * Copyright 2002-2013 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> /** <ide> * Utility methods for working with {@link ContextLoader ContextLoaders} and <ide> * {@link SmartContextLoader SmartContextLoaders} and resolving resource locations, <del> * annotated classes, and active bean definition profiles. <add> * annotated classes, active bean definition profiles, and application context <add> * initializers. <ide> * <ide> * @author Sam Brannen <ide> * @since 3.1 <ide> * @see ContextConfiguration <ide> * @see ContextConfigurationAttributes <ide> * @see ActiveProfiles <add> * @see ApplicationContextInitializer <ide> * @see MergedContextConfiguration <ide> */ <ide> abstract class ContextLoaderUtils { <ide> private ContextLoaderUtils() { <ide> * either {@value #DEFAULT_CONTEXT_LOADER_CLASS_NAME} <ide> * or {@value #DEFAULT_WEB_CONTEXT_LOADER_CLASS_NAME} will be used as the <ide> * default context loader class name. For details on the class resolution <del> * process, see {@link #resolveContextLoaderClass()}. <add> * process, see {@link #resolveContextLoaderClass}. <ide> * <ide> * @param testClass the test class for which the {@code ContextLoader} <ide> * should be resolved; must not be {@code null} <ide> private ContextLoaderUtils() { <ide> * {@code ContextLoader} class to use; may be {@code null} or <em>empty</em> <ide> * @return the resolved {@code ContextLoader} for the supplied <ide> * {@code testClass} (never {@code null}) <del> * @see #resolveContextLoaderClass() <add> * @see #resolveContextLoaderClass <ide> */ <add> @SuppressWarnings("javadoc") <ide> static ContextLoader resolveContextLoader(Class<?> testClass, <ide> List<ContextConfigurationAttributes> configAttributesList, String defaultContextLoaderClassName) { <ide> Assert.notNull(testClass, "Class must not be null"); <ide> else if (!ObjectUtils.isEmpty(valueProfiles)) { <ide> * @param defaultContextLoaderClassName the name of the default <ide> * {@code ContextLoader} class to use (may be {@code null}) <ide> * @return the merged context configuration <del> * @see #resolveContextLoader() <del> * @see #resolveContextConfigurationAttributes() <del> * @see SmartContextLoader#processContextConfiguration() <del> * @see ContextLoader#processLocations() <del> * @see #resolveActiveProfiles() <add> * @see #resolveContextLoader <add> * @see #resolveContextConfigurationAttributes <add> * @see SmartContextLoader#processContextConfiguration <add> * @see ContextLoader#processLocations <add> * @see #resolveActiveProfiles <ide> * @see MergedContextConfiguration <ide> */ <ide> static MergedContextConfiguration buildMergedContextConfiguration(Class<?> testClass,
1
Text
Text
remove trailing whitespace from ar basics guide
ab547e7b4368588719396a6f6b0528681c3a6cd4
<ide><path>guides/source/active_record_basics.md <ide> Active Record Basics <ide> ==================== <del> <add> <ide> This guide is an introduction to Active Record. <ide> <ide> After reading this guide, you will know: <ide> <del>* What Object Relational Mapping and Active Record are and how they are used in <add>* What Object Relational Mapping and Active Record are and how they are used in <ide> Rails. <ide> * How Active Record fits into the Model-View-Controller paradigm. <del>* How to use Active Record models to manipulate data stored in a relational <add>* How to use Active Record models to manipulate data stored in a relational <ide> database. <ide> * Active Record schema naming conventions. <ide> * The concepts of database migrations, validations and callbacks. <ide> After reading this guide, you will know: <ide> What is Active Record? <ide> ---------------------- <ide> <del>Active Record is the M in [MVC](getting_started.html#the-mvc-architecture) - the <del>model - which is the layer of the system responsible for representing business <del>data and logic. Active Record facilitates the creation and use of business <del>objects whose data requires persistent storage to a database. It is an <del>implementation of the Active Record pattern which itself is a description of an <add>Active Record is the M in [MVC](getting_started.html#the-mvc-architecture) - the <add>model - which is the layer of the system responsible for representing business <add>data and logic. Active Record facilitates the creation and use of business <add>objects whose data requires persistent storage to a database. It is an <add>implementation of the Active Record pattern which itself is a description of an <ide> Object Relational Mapping system. <ide> <ide> ### The Active Record Pattern <ide> <del>Active Record was described by Martin Fowler in his book _Patterns of Enterprise <del>Application Architecture_. In Active Record, objects carry both persistent data <del>and behavior which operates on that data. Active Record takes the opinion that <del>ensuring data access logic is part of the object will educate users of that <add>Active Record was described by Martin Fowler in his book _Patterns of Enterprise <add>Application Architecture_. In Active Record, objects carry both persistent data <add>and behavior which operates on that data. Active Record takes the opinion that <add>ensuring data access logic is part of the object will educate users of that <ide> object on how to write to and read from the database. <ide> <ide> ### Object Relational Mapping <ide> <del>Object-Relational Mapping, commonly referred to as its abbreviation ORM, is <del>a technique that connects the rich objects of an application to tables in <del>a relational database management system. Using ORM, the properties and <del>relationships of the objects in an application can be easily stored and <del>retrieved from a database without writing SQL statements directly and with less <add>Object-Relational Mapping, commonly referred to as its abbreviation ORM, is <add>a technique that connects the rich objects of an application to tables in <add>a relational database management system. Using ORM, the properties and <add>relationships of the objects in an application can be easily stored and <add>retrieved from a database without writing SQL statements directly and with less <ide> overall database access code. <ide> <ide> ### Active Record as an ORM Framework <ide> <del>Active Record gives us several mechanisms, the most important being the ability <add>Active Record gives us several mechanisms, the most important being the ability <ide> to: <ide> <ide> * Represent models and their data <ide> to: <ide> Convention over Configuration in Active Record <ide> ---------------------------------------------- <ide> <del>When writing applications using other programming languages or frameworks, it <del>may be necessary to write a lot of configuration code. This is particularly true <del>for ORM frameworks in general. However, if you follow the conventions adopted by <del>Rails, you'll need to write very little configuration (in some case no <del>configuration at all) when creating Active Record models. The idea is that if <del>you configure your applications in the very same way most of the times then this <del>should be the default way. In this cases, explicit configuration would be needed <add>When writing applications using other programming languages or frameworks, it <add>may be necessary to write a lot of configuration code. This is particularly true <add>for ORM frameworks in general. However, if you follow the conventions adopted by <add>Rails, you'll need to write very little configuration (in some case no <add>configuration at all) when creating Active Record models. The idea is that if <add>you configure your applications in the very same way most of the times then this <add>should be the default way. In this cases, explicit configuration would be needed <ide> only in those cases where you can't follow the conventions for any reason. <ide> <ide> ### Naming Conventions <ide> <del>By default, Active Record uses some naming conventions to find out how the <del>mapping between models and database tables should be created. Rails will <del>pluralize your class names to find the respective database table. So, for <del>a class `Book`, you should have a database table called **books**. The Rails <del>pluralization mechanisms are very powerful, being capable to pluralize (and <del>singularize) both regular and irregular words. When using class names composed <del>of two or more words, the model class name should follow the Ruby conventions, <del>using the CamelCase form, while the table name must contain the words separated <add>By default, Active Record uses some naming conventions to find out how the <add>mapping between models and database tables should be created. Rails will <add>pluralize your class names to find the respective database table. So, for <add>a class `Book`, you should have a database table called **books**. The Rails <add>pluralization mechanisms are very powerful, being capable to pluralize (and <add>singularize) both regular and irregular words. When using class names composed <add>of two or more words, the model class name should follow the Ruby conventions, <add>using the CamelCase form, while the table name must contain the words separated <ide> by underscores. Examples: <ide> <ide> * Database Table - Plural with underscores separating words (e.g., `book_clubs`) <del>* Model Class - Singular with the first letter of each word capitalized (e.g., <add>* Model Class - Singular with the first letter of each word capitalized (e.g., <ide> `BookClub`) <ide> <ide> | Model / Class | Table / Schema | <ide> by underscores. Examples: <ide> <ide> ### Schema Conventions <ide> <del>Active Record uses naming conventions for the columns in database tables, <add>Active Record uses naming conventions for the columns in database tables, <ide> depending on the purpose of these columns. <ide> <del>* **Foreign keys** - These fields should be named following the pattern <del> `singularized_table_name_id` (e.g., `item_id`, `order_id`). These are the <del> fields that Active Record will look for when you create associations between <add>* **Foreign keys** - These fields should be named following the pattern <add> `singularized_table_name_id` (e.g., `item_id`, `order_id`). These are the <add> fields that Active Record will look for when you create associations between <ide> your models. <del>* **Primary keys** - By default, Active Record will use an integer column named <del> `id` as the table's primary key. When using [Rails <del> Migrations](migrations.html) to create your tables, this column will be <add>* **Primary keys** - By default, Active Record will use an integer column named <add> `id` as the table's primary key. When using [Rails <add> Migrations](migrations.html) to create your tables, this column will be <ide> automatically created. <ide> <del>There are also some optional column names that will create additional features <add>There are also some optional column names that will create additional features <ide> to Active Record instances: <ide> <del>* `created_at` - Automatically gets set to the current date and time when the <add>* `created_at` - Automatically gets set to the current date and time when the <ide> record is first created. <del>* `updated_at` - Automatically gets set to the current date and time whenever <add>* `updated_at` - Automatically gets set to the current date and time whenever <ide> the record is updated. <del>* `lock_version` - Adds [optimistic <del> locking](http://api.rubyonrails.org/classes/ActiveRecord/Locking.html) to <add>* `lock_version` - Adds [optimistic <add> locking](http://api.rubyonrails.org/classes/ActiveRecord/Locking.html) to <ide> a model. <del>* `type` - Specifies that the model uses [Single Table <add>* `type` - Specifies that the model uses [Single Table <ide> Inheritance](http://api.rubyonrails.org/classes/ActiveRecord/Base.html) <del>* `(table_name)_count` - Used to cache the number of belonging objects on <del> associations. For example, a `comments_count` column in a `Post` class that <del> has many instances of `Comment` will cache the number of existent comments <add>* `(table_name)_count` - Used to cache the number of belonging objects on <add> associations. For example, a `comments_count` column in a `Post` class that <add> has many instances of `Comment` will cache the number of existent comments <ide> for each post. <ide> <ide> NOTE: While these column names are optional, they are in fact reserved by Active Record. Steer clear of reserved keywords unless you want the extra functionality. For example, `type` is a reserved keyword used to designate a table using Single Table Inheritance (STI). If you are not using STI, try an analogous keyword like "context", that may still accurately describe the data you are modeling. <ide> <ide> Creating Active Record Models <ide> ----------------------------- <ide> <del>It is very easy to create Active Record models. All you have to do is to <add>It is very easy to create Active Record models. All you have to do is to <ide> subclass the `ActiveRecord::Base` class and you're good to go: <ide> <ide> ```ruby <ide> class Product < ActiveRecord::Base <ide> end <ide> ``` <ide> <del>This will create a `Product` model, mapped to a `products` table at the <del>database. By doing this you'll also have the ability to map the columns of each <del>row in that table with the attributes of the instances of your model. Suppose <add>This will create a `Product` model, mapped to a `products` table at the <add>database. By doing this you'll also have the ability to map the columns of each <add>row in that table with the attributes of the instances of your model. Suppose <ide> that the `products` table was created using an SQL sentence like: <ide> <ide> ```sql <ide> CREATE TABLE products ( <ide> ); <ide> ``` <ide> <del>Following the table schema above, you would be able to write code like the <add>Following the table schema above, you would be able to write code like the <ide> following: <ide> <ide> ```ruby <ide> puts p.name # "Some Book" <ide> Overriding the Naming Conventions <ide> --------------------------------- <ide> <del>What if you need to follow a different naming convention or need to use your <del>Rails application with a legacy database? No problem, you can easily override <add>What if you need to follow a different naming convention or need to use your <add>Rails application with a legacy database? No problem, you can easily override <ide> the default conventions. <ide> <del>You can use the `ActiveRecord::Base.table_name=` method to specify the table <add>You can use the `ActiveRecord::Base.table_name=` method to specify the table <ide> name that should be used: <ide> <ide> ```ruby <ide> class Product < ActiveRecord::Base <ide> end <ide> ``` <ide> <del>If you do so, you will have to define manually the class name that is hosting <del>the fixtures (class_name.yml) using the `set_fixture_class` method in your test <add>If you do so, you will have to define manually the class name that is hosting <add>the fixtures (class_name.yml) using the `set_fixture_class` method in your test <ide> definition: <ide> <ide> ```ruby <ide> class FunnyJoke < ActiveSupport::TestCase <ide> end <ide> ``` <ide> <del>It's also possible to override the column that should be used as the table's <add>It's also possible to override the column that should be used as the table's <ide> primary key using the `ActiveRecord::Base.set_primary_key` method: <ide> <ide> ```ruby <ide> end <ide> CRUD: Reading and Writing Data <ide> ------------------------------ <ide> <del>CRUD is an acronym for the four verbs we use to operate on data: **C**reate, <del>**R**ead, **U**pdate and **D**elete. Active Record automatically creates methods <add>CRUD is an acronym for the four verbs we use to operate on data: **C**reate, <add>**R**ead, **U**pdate and **D**elete. Active Record automatically creates methods <ide> to allow an application to read and manipulate data stored within its tables. <ide> <ide> ### Create <ide> <del>Active Record objects can be created from a hash, a block or have their <del>attributes manually set after creation. The `new` method will return a new <add>Active Record objects can be created from a hash, a block or have their <add>attributes manually set after creation. The `new` method will return a new <ide> object while `create` will return the object and save it to the database. <ide> <del>For example, given a model `User` with attributes of `name` and `occupation`, <add>For example, given a model `User` with attributes of `name` and `occupation`, <ide> the `create` method call will create and save a new record into the database: <ide> <ide> ```ruby <ide> user.occupation = "Code Artist" <ide> <ide> A call to `user.save` will commit the record to the database. <ide> <del>Finally, if a block is provided, both `create` and `new` will yield the new <add>Finally, if a block is provided, both `create` and `new` will yield the new <ide> object to that block for initialization: <ide> <ide> ```ruby <ide> end <ide> <ide> ### Read <ide> <del>Active Record provides a rich API for accessing data within a database. Below <add>Active Record provides a rich API for accessing data within a database. Below <ide> are a few examples of different data access methods provided by Active Record. <ide> <ide> ```ruby <ide> david = User.find_by_name('David') <ide> users = User.where(name: 'David', occupation: 'Code Artist').order('created_at DESC') <ide> ``` <ide> <del>You can learn more about querying an Active Record model in the [Active Record <add>You can learn more about querying an Active Record model in the [Active Record <ide> Query Interface](active_record_querying.html) guide. <ide> <ide> ### Update <ide> <del>Once an Active Record object has been retrieved, its attributes can be modified <add>Once an Active Record object has been retrieved, its attributes can be modified <ide> and it can be saved to the database. <ide> <ide> ```ruby <ide> user.name = 'Dave' <ide> user.save <ide> ``` <ide> <del>A shorthand for this is to use a hash mapping attribute names to the desired <add>A shorthand for this is to use a hash mapping attribute names to the desired <ide> value, like so: <ide> <ide> ```ruby <ide> user = User.find_by_name('David') <ide> user.update(name: 'Dave') <ide> ``` <ide> <del>This is most useful when updating several attributes at once. If, on the other <del>hand, you'd like to update several records in bulk, you may find the <add>This is most useful when updating several attributes at once. If, on the other <add>hand, you'd like to update several records in bulk, you may find the <ide> `update_all` class method useful: <ide> <ide> ```ruby <ide> User.update_all "max_login_attempts = 3, must_change_password = 'true'" <ide> <ide> ### Delete <ide> <del>Likewise, once retrieved an Active Record object can be destroyed which removes <add>Likewise, once retrieved an Active Record object can be destroyed which removes <ide> it from the database. <ide> <ide> ```ruby <ide> user.destroy <ide> Validations <ide> ----------- <ide> <del>Active Record allows you to validate the state of a model before it gets written <del>into the database. There are several methods that you can use to check your <del>models and validate that an attribute value is not empty, is unique and not <add>Active Record allows you to validate the state of a model before it gets written <add>into the database. There are several methods that you can use to check your <add>models and validate that an attribute value is not empty, is unique and not <ide> already in the database, follows a specific format and many more. <ide> <del>Validation is a very important issue to consider when persisting to database, so <del>the methods `create`, `save` and `update` take it into account when <del>running: they return `false` when validation fails and they didn't actually <del>perform any operation on database. All of these have a bang counterpart (that <del>is, `create!`, `save!` and `update!`), which are stricter in that <del>they raise the exception `ActiveRecord::RecordInvalid` if validation fails. <add>Validation is a very important issue to consider when persisting to database, so <add>the methods `create`, `save` and `update` take it into account when <add>running: they return `false` when validation fails and they didn't actually <add>perform any operation on database. All of these have a bang counterpart (that <add>is, `create!`, `save!` and `update!`), which are stricter in that <add>they raise the exception `ActiveRecord::RecordInvalid` if validation fails. <ide> A quick example to illustrate: <ide> <ide> ```ruby <ide> User.create # => false <ide> User.create! # => ActiveRecord::RecordInvalid: Validation failed: Name can't be blank <ide> ``` <ide> <del>You can learn more about validations in the [Active Record Validations <add>You can learn more about validations in the [Active Record Validations <ide> guide](active_record_validations.html). <ide> <ide> Callbacks <ide> --------- <ide> <del>Active Record callbacks allow you to attach code to certain events in the <del>life-cycle of your models. This enables you to add behavior to your models by <del>transparently executing code when those events occur, like when you create a new <del>record, update it, destroy it and so on. You can learn more about callbacks in <add>Active Record callbacks allow you to attach code to certain events in the <add>life-cycle of your models. This enables you to add behavior to your models by <add>transparently executing code when those events occur, like when you create a new <add>record, update it, destroy it and so on. You can learn more about callbacks in <ide> the [Active Record Callbacks guide](active_record_callbacks.html). <ide> <ide> Migrations <ide> ---------- <ide> <del>Rails provides a domain-specific language for managing a database schema called <del>migrations. Migrations are stored in files which are executed against any <del>database that Active Record support using `rake`. Here's a migration that <add>Rails provides a domain-specific language for managing a database schema called <add>migrations. Migrations are stored in files which are executed against any <add>database that Active Record support using `rake`. Here's a migration that <ide> creates a table: <ide> <ide> ```ruby <ide> class CreatePublications < ActiveRecord::Migration <ide> end <ide> ``` <ide> <del>Rails keeps track of which files have been committed to the database and <add>Rails keeps track of which files have been committed to the database and <ide> provides rollback features. To actually create the table, you'd run `rake db:migrate` <ide> and to roll it back, `rake db:rollback`. <ide> <del>Note that the above code is database-agnostic: it will run in MySQL, postgresql, <del>Oracle and others. You can learn more about migrations in the [Active Record <add>Note that the above code is database-agnostic: it will run in MySQL, postgresql, <add>Oracle and others. You can learn more about migrations in the [Active Record <ide> Migrations guide](migrations.html)
1
Python
Python
fix tensorflow test
90e9da4093e357dc49d5631d2792221092516854
<ide><path>tests/keras/layers/test_call.py <ide> <ide> import unittest <ide> import numpy as np <del>import theano <ide> <ide> from numpy.testing import assert_allclose <ide> <ide> from keras import backend as K <del>from keras.layers.core import Layer, Dense <add>from keras.layers.core import Dense <ide> from keras.models import Sequential <ide> floatX = K.common._FLOATX <ide> <ide> class TestCall(unittest.TestCase): <ide> <ide> def test_layer_call(self): <ide> """Test keras.layers.core.Layer.__call__""" <del> nb_samples, input_dim = 3, 10 <del> layer = Layer() <add> nb_samples, input_dim, output_dim = 3, 10, 5 <add> layer = Dense(output_dim, input_dim=input_dim) <add> W = np.asarray(K.eval(layer.W)) <ide> X = K.placeholder(ndim=2) <ide> Y = layer(X) <del> F = K.function([X], Y) <add> F = K.function([X], [Y]) <ide> <ide> x = np.random.randn(nb_samples, input_dim).astype(floatX) <del> y = F([x, ]) <del> assert_allclose(x, y) <add> y = F([x])[0] <add> assert_allclose(np.dot(x, W), y) <ide> <ide> def test_sequential_call(self): <ide> """Test keras.models.Sequential.__call__""" <ide> def test_sequential_call(self): <ide> <ide> X = K.placeholder(ndim=2) <ide> Y = model(X) <del> F = K.function([X], Y) <add> F = K.function([X], [Y]) <ide> <ide> x = np.random.randn(nb_samples, input_dim).astype(floatX) <del> y1 = F([x, ]) <add> y1 = F([x])[0] <ide> y2 = model.predict(x) <ide> # results of __call__ should match model.predict <ide> assert_allclose(y1, y2) <ide> <ide> <ide> if __name__ == '__main__': <del> theano.config.exception_verbosity = 'high' <ide> unittest.main(verbosity=2)
1
Javascript
Javascript
replace more haste imports with path-based imports
a7a7970e543959e9db5281914d5f132beb01db8d
<ide><path>Libraries/AppState/NativeAppState.js <ide> <ide> 'use strict'; <ide> <del>import type {TurboModule} from 'RCTExport'; <del>import * as TurboModuleRegistry from 'TurboModuleRegistry'; <add>import type {TurboModule} from '../TurboModule/RCTExport'; <add>import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; <ide> <ide> export interface Spec extends TurboModule { <ide> +getConstants: () => {| <ide><path>Libraries/Blob/NativeBlobModule.js <ide> <ide> 'use strict'; <ide> <del>import type {TurboModule} from 'RCTExport'; <del>import * as TurboModuleRegistry from 'TurboModuleRegistry'; <add>import type {TurboModule} from '../TurboModule/RCTExport'; <add>import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; <ide> <ide> export interface Spec extends TurboModule { <ide> +getConstants: () => {|BLOB_URI_SCHEME: string, BLOB_URI_HOST: ?string|}; <ide><path>Libraries/Blob/NativeFileReaderModule.js <ide> <ide> 'use strict'; <ide> <del>import type {TurboModule} from 'RCTExport'; <del>import * as TurboModuleRegistry from 'TurboModuleRegistry'; <add>import type {TurboModule} from '../TurboModule/RCTExport'; <add>import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; <ide> <ide> export interface Spec extends TurboModule { <ide> +readAsDataURL: (data: Object) => Promise<string>; <ide><path>Libraries/Components/AccessibilityInfo/NativeAccessibilityInfo.js <ide> <ide> 'use strict'; <ide> <del>import type {TurboModule} from 'RCTExport'; <del>import * as TurboModuleRegistry from 'TurboModuleRegistry'; <add>import type {TurboModule} from '../../TurboModule/RCTExport'; <add>import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry'; <ide> <ide> export interface Spec extends TurboModule { <ide> +isReduceMotionEnabled: ( <ide><path>Libraries/Components/AppleTV/NativeTVNavigationEventEmitter.js <ide> <ide> 'use strict'; <ide> <del>import type {TurboModule} from 'RCTExport'; <del>import * as TurboModuleRegistry from 'TurboModuleRegistry'; <add>import type {TurboModule} from '../../TurboModule/RCTExport'; <add>import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry'; <ide> <ide> export interface Spec extends TurboModule { <ide> +addListener: (eventName: string) => void; <ide><path>Libraries/Components/DatePickerAndroid/NativeDatePickerAndroid.js <ide> <ide> 'use strict'; <ide> <del>import type {TurboModule} from 'RCTExport'; <del>import * as TurboModuleRegistry from 'TurboModuleRegistry'; <add>import type {TurboModule} from '../../TurboModule/RCTExport'; <add>import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry'; <ide> <ide> export interface Spec extends TurboModule { <ide> +open: (options: Object) => Promise<Object>; <ide><path>Libraries/Components/Keyboard/NativeKeyboardObserver.js <ide> <ide> 'use strict'; <ide> <del>import type {TurboModule} from 'RCTExport'; <del>import * as TurboModuleRegistry from 'TurboModuleRegistry'; <add>import type {TurboModule} from '../../TurboModule/RCTExport'; <add>import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry'; <ide> <ide> export interface Spec extends TurboModule { <ide> +addListener: (eventName: string) => void; <ide><path>Libraries/Components/TimePickerAndroid/NativeTimePickerAndroid.js <ide> <ide> 'use strict'; <ide> <del>import type {TurboModule} from 'RCTExport'; <del>import * as TurboModuleRegistry from 'TurboModuleRegistry'; <add>import type {TurboModule} from '../../TurboModule/RCTExport'; <add>import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry'; <ide> <ide> export type TimePickerOptions = {| <ide> hour?: number, <ide><path>Libraries/Components/View/ReactNativeViewViewConfig.js <ide> const ReactNativeViewConfig = { <ide> alignSelf: true, <ide> aspectRatio: true, <ide> backfaceVisibility: true, <del> backgroundColor: {process: require('processColor')}, <del> borderBottomColor: {process: require('processColor')}, <add> backgroundColor: {process: require('../../StyleSheet/processColor')}, <add> borderBottomColor: {process: require('../../StyleSheet/processColor')}, <ide> borderBottomEndRadius: true, <ide> borderBottomLeftRadius: true, <ide> borderBottomRightRadius: true, <ide> borderBottomStartRadius: true, <ide> borderBottomWidth: true, <del> borderColor: {process: require('processColor')}, <del> borderEndColor: {process: require('processColor')}, <add> borderColor: {process: require('../../StyleSheet/processColor')}, <add> borderEndColor: {process: require('../../StyleSheet/processColor')}, <ide> borderEndWidth: true, <del> borderLeftColor: {process: require('processColor')}, <add> borderLeftColor: {process: require('../../StyleSheet/processColor')}, <ide> borderLeftWidth: true, <ide> borderRadius: true, <del> borderRightColor: {process: require('processColor')}, <add> borderRightColor: {process: require('../../StyleSheet/processColor')}, <ide> borderRightWidth: true, <del> borderStartColor: {process: require('processColor')}, <add> borderStartColor: {process: require('../../StyleSheet/processColor')}, <ide> borderStartWidth: true, <ide> borderStyle: true, <del> borderTopColor: {process: require('processColor')}, <add> borderTopColor: {process: require('../../StyleSheet/processColor')}, <ide> borderTopEndRadius: true, <ide> borderTopLeftRadius: true, <ide> borderTopRightRadius: true, <ide> const ReactNativeViewConfig = { <ide> flexShrink: true, <ide> flexWrap: true, <ide> height: true, <del> hitSlop: {diff: (require('insetsDiffer'): any)}, <add> hitSlop: {diff: (require('../../Utilities/differ/insetsDiffer'): any)}, <ide> importantForAccessibility: true, <ide> justifyContent: true, <ide> left: true, <ide> const ReactNativeViewConfig = { <ide> rotation: true, <ide> scaleX: true, <ide> scaleY: true, <del> shadowColor: {process: require('processColor')}, <del> shadowOffset: {diff: require('sizesDiffer')}, <add> shadowColor: {process: require('../../StyleSheet/processColor')}, <add> shadowOffset: {diff: require('../../Utilities/differ/sizesDiffer')}, <ide> shadowOpacity: true, <ide> shadowRadius: true, <ide> shouldRasterizeIOS: true, <ide> const ReactNativeViewConfig = { <ide> alignSelf: true, <ide> aspectRatio: true, <ide> backfaceVisibility: true, <del> backgroundColor: {process: require('processColor')}, <del> borderBottomColor: {process: require('processColor')}, <add> backgroundColor: {process: require('../../StyleSheet/processColor')}, <add> borderBottomColor: {process: require('../../StyleSheet/processColor')}, <ide> borderBottomEndRadius: true, <ide> borderBottomLeftRadius: true, <ide> borderBottomRightRadius: true, <ide> borderBottomStartRadius: true, <ide> borderBottomWidth: true, <del> borderColor: {process: require('processColor')}, <del> borderEndColor: {process: require('processColor')}, <add> borderColor: {process: require('../../StyleSheet/processColor')}, <add> borderEndColor: {process: require('../../StyleSheet/processColor')}, <ide> borderEndWidth: true, <del> borderLeftColor: {process: require('processColor')}, <add> borderLeftColor: {process: require('../../StyleSheet/processColor')}, <ide> borderLeftWidth: true, <ide> borderRadius: true, <del> borderRightColor: {process: require('processColor')}, <add> borderRightColor: {process: require('../../StyleSheet/processColor')}, <ide> borderRightWidth: true, <del> borderStartColor: {process: require('processColor')}, <add> borderStartColor: {process: require('../../StyleSheet/processColor')}, <ide> borderStartWidth: true, <ide> borderStyle: true, <del> borderTopColor: {process: require('processColor')}, <add> borderTopColor: {process: require('../../StyleSheet/processColor')}, <ide> borderTopEndRadius: true, <ide> borderTopLeftRadius: true, <ide> borderTopRightRadius: true, <ide> borderTopStartRadius: true, <ide> borderTopWidth: true, <ide> borderWidth: true, <ide> bottom: true, <del> color: {process: require('processColor')}, <add> color: {process: require('../../StyleSheet/processColor')}, <ide> decomposedMatrix: true, <ide> direction: true, <ide> display: true, <ide> const ReactNativeViewConfig = { <ide> minWidth: true, <ide> opacity: true, <ide> overflow: true, <del> overlayColor: {process: require('processColor')}, <add> overlayColor: {process: require('../../StyleSheet/processColor')}, <ide> padding: true, <ide> paddingBottom: true, <ide> paddingEnd: true, <ide> const ReactNativeViewConfig = { <ide> rotation: true, <ide> scaleX: true, <ide> scaleY: true, <del> shadowColor: {process: require('processColor')}, <del> shadowOffset: {diff: require('sizesDiffer')}, <add> shadowColor: {process: require('../../StyleSheet/processColor')}, <add> shadowOffset: {diff: require('../../Utilities/differ/sizesDiffer')}, <ide> shadowOpacity: true, <ide> shadowRadius: true, <ide> start: true, <ide> textAlign: true, <ide> textAlignVertical: true, <del> textDecorationColor: {process: require('processColor')}, <add> textDecorationColor: {process: require('../../StyleSheet/processColor')}, <ide> textDecorationLine: true, <ide> textDecorationStyle: true, <del> textShadowColor: {process: require('processColor')}, <add> textShadowColor: {process: require('../../StyleSheet/processColor')}, <ide> textShadowOffset: true, <ide> textShadowRadius: true, <ide> textTransform: true, <del> tintColor: {process: require('processColor')}, <add> tintColor: {process: require('../../StyleSheet/processColor')}, <ide> top: true, <del> transform: {diff: require('matricesDiffer')}, <add> transform: {diff: require('../../Utilities/differ/matricesDiffer')}, <ide> transformMatrix: true, <ide> translateX: true, <ide> translateY: true, <ide> const ReactNativeViewConfig = { <ide> }, <ide> testID: true, <ide> top: true, <del> transform: {diff: require('matricesDiffer')}, <add> transform: {diff: require('../../Utilities/differ/matricesDiffer')}, <ide> translateX: true, <ide> translateY: true, <ide> width: true, <ide><path>Libraries/Components/View/ViewAccessibility.js <ide> <ide> 'use strict'; <ide> <del>import type {SyntheticEvent} from 'CoreEventTypes'; <add>import type {SyntheticEvent} from '../../Types/CoreEventTypes'; <ide> <ide> // This must be kept in sync with the AccessibilityRolesMask in RCTViewManager.m <ide> export type AccessibilityRole = <ide><path>Libraries/Core/NativeExceptionsManager.js <ide> <ide> 'use strict'; <ide> <del>import type {TurboModule} from 'RCTExport'; <del>import * as TurboModuleRegistry from 'TurboModuleRegistry'; <add>import type {TurboModule} from '../TurboModule/RCTExport'; <add>import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; <ide> <ide> export type StackFrame = {| <ide> column: ?number, <ide><path>Libraries/Core/Timers/NativeTiming.js <ide> <ide> 'use strict'; <ide> <del>import type {TurboModule} from 'RCTExport'; <del>import * as TurboModuleRegistry from 'TurboModuleRegistry'; <add>import type {TurboModule} from '../../TurboModule/RCTExport'; <add>import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry'; <ide> <ide> export interface Spec extends TurboModule { <ide> +createTimer: ( <ide><path>Libraries/HeapCapture/NativeHeapCapture.js <ide> <ide> 'use strict'; <ide> <del>import type {TurboModule} from 'RCTExport'; <del>import * as TurboModuleRegistry from 'TurboModuleRegistry'; <add>import type {TurboModule} from '../TurboModule/RCTExport'; <add>import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; <ide> <ide> export interface Spec extends TurboModule { <ide> // Common interface <ide><path>Libraries/Linking/NativeLinking.js <ide> <ide> 'use strict'; <ide> <del>import type {TurboModule} from 'RCTExport'; <del>import * as TurboModuleRegistry from 'TurboModuleRegistry'; <del>import Platform from 'Platform'; <add>import type {TurboModule} from '../TurboModule/RCTExport'; <add>import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; <add>import Platform from '../Utilities/Platform'; <ide> <ide> export interface Spec extends TurboModule { <ide> // Common interface <ide><path>Libraries/NativeModules/specs/NativeAnimationsDebugModule.js <ide> <ide> 'use strict'; <ide> <del>import type {TurboModule} from 'RCTExport'; <del>import * as TurboModuleRegistry from 'TurboModuleRegistry'; <add>import type {TurboModule} from '../../TurboModule/RCTExport'; <add>import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry'; <ide> <ide> export interface Spec extends TurboModule { <ide> +startRecordingFps: () => void; <ide><path>Libraries/NativeModules/specs/NativeDeviceEventManager.js <ide> <ide> 'use strict'; <ide> <del>import type {TurboModule} from 'RCTExport'; <del>import * as TurboModuleRegistry from 'TurboModuleRegistry'; <add>import type {TurboModule} from '../../TurboModule/RCTExport'; <add>import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry'; <ide> <ide> export interface Spec extends TurboModule { <ide> +invokeDefaultBackPressHandler: () => void; <ide><path>Libraries/NativeModules/specs/NativeRedBox.js <ide> <ide> 'use strict'; <ide> <del>import type {TurboModule} from 'RCTExport'; <del>import * as TurboModuleRegistry from 'TurboModuleRegistry'; <add>import type {TurboModule} from '../../TurboModule/RCTExport'; <add>import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry'; <ide> <ide> export interface Spec extends TurboModule { <ide> +setExtraData: (extraData: Object, identifier: string) => void; <ide><path>Libraries/NativeModules/specs/NativeSourceCode.js <ide> <ide> 'use strict'; <ide> <del>import type {TurboModule} from 'RCTExport'; <del>import * as TurboModuleRegistry from 'TurboModuleRegistry'; <add>import type {TurboModule} from '../../TurboModule/RCTExport'; <add>import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry'; <ide> <ide> export interface Spec extends TurboModule { <ide> +getConstants: () => {| <ide><path>Libraries/Performance/NativeJSCSamplingProfiler.js <ide> <ide> 'use strict'; <ide> <del>import type {TurboModule} from 'RCTExport'; <del>import * as TurboModuleRegistry from 'TurboModuleRegistry'; <add>import type {TurboModule} from '../TurboModule/RCTExport'; <add>import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; <ide> <ide> export interface Spec extends TurboModule { <ide> +operationComplete: (token: number, result: ?string, error: ?string) => void; <ide><path>Libraries/ReactNative/NativeHeadlessJsTaskSupport.js <ide> <ide> 'use strict'; <ide> <del>import type {TurboModule} from 'RCTExport'; <del>import * as TurboModuleRegistry from 'TurboModuleRegistry'; <add>import type {TurboModule} from '../TurboModule/RCTExport'; <add>import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; <ide> <ide> export interface Spec extends TurboModule { <ide> +notifyTaskFinished: (taskId: number) => void; <ide><path>Libraries/Utilities/NativeDevLoadingView.js <ide> <ide> 'use strict'; <ide> <del>import type {TurboModule} from 'RCTExport'; <del>import * as TurboModuleRegistry from 'TurboModuleRegistry'; <add>import type {TurboModule} from '../TurboModule/RCTExport'; <add>import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; <ide> <ide> export interface Spec extends TurboModule { <ide> +showMessage: ( <ide><path>Libraries/Utilities/NativeJSDevSupport.js <ide> <ide> 'use strict'; <ide> <del>import type {TurboModule} from 'RCTExport'; <del>import * as TurboModuleRegistry from 'TurboModuleRegistry'; <add>import type {TurboModule} from '../TurboModule/RCTExport'; <add>import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; <ide> <ide> export interface Spec extends TurboModule { <ide> +getConstants: () => {| <ide><path>Libraries/Utilities/__tests__/verifyComponentAttributeEquivalence-test.js <ide> <ide> 'use strict'; <ide> <del>const getNativeComponentAttributes = require('getNativeComponentAttributes'); <del>const verifyComponentAttributeEquivalence = require('verifyComponentAttributeEquivalence'); <add>const getNativeComponentAttributes = require('../../ReactNative/getNativeComponentAttributes'); <add>const verifyComponentAttributeEquivalence = require('../verifyComponentAttributeEquivalence'); <ide> <del>jest.mock('getNativeComponentAttributes', () => () => ({ <add>jest.mock('../../ReactNative/getNativeComponentAttributes', () => () => ({ <ide> NativeProps: { <ide> value: 'BOOL', <ide> }, <ide><path>Libraries/Utilities/verifyComponentAttributeEquivalence.js <ide> <ide> 'use strict'; <ide> <del>const getNativeComponentAttributes = require('getNativeComponentAttributes'); <add>const getNativeComponentAttributes = require('../ReactNative/getNativeComponentAttributes'); <ide> <del>import type {ReactNativeBaseComponentViewConfig} from 'ReactNativeTypes'; <add>import type {ReactNativeBaseComponentViewConfig} from '../Renderer/shims/ReactNativeTypes'; <ide> <ide> const IGNORED_KEYS = ['transform']; <ide> /** <ide><path>RNTester/js/TextExample.ios.js <ide> const { <ide> TextInput, <ide> View, <ide> } = require('react-native'); <del>const TextAncestor = require('TextAncestor'); <add>const TextAncestor = require('../../Libraries/Text/TextAncestor'); <ide> const TextInlineView = require('./Shared/TextInlineView'); <ide> const TextLegend = require('./Shared/TextLegend'); <ide>
25
Javascript
Javascript
avoid more allocations in bidi()
3759c11f424ed74315ea660b96e861db5fb4350a
<ide><path>src/core/bidi.js <ide> var bidi = PDFJS.bidi = (function bidiClosure() { <ide> } <ide> } <ide> <del> function BidiResult(str, isLTR, vertical) { <del> this.str = str; <del> this.dir = (vertical ? 'ttb' : (isLTR ? 'ltr' : 'rtl')); <add> function createBidiText(str, isLTR, vertical) { <add> return { <add> str: str, <add> dir: (vertical ? 'ttb' : (isLTR ? 'ltr' : 'rtl')) <add> }; <ide> } <ide> <ide> // These are used in bidi(), which is called frequently. We re-use them on <ide> var bidi = PDFJS.bidi = (function bidiClosure() { <ide> var isLTR = true; <ide> var strLength = str.length; <ide> if (strLength === 0 || vertical) { <del> return new BidiResult(str, isLTR, vertical); <add> return createBidiText(str, isLTR, vertical); <ide> } <ide> <ide> // Get types and fill arrays <ide> var bidi = PDFJS.bidi = (function bidiClosure() { <ide> // - If more than 30% chars are rtl then string is primarily rtl <ide> if (numBidi === 0) { <ide> isLTR = true; <del> return new BidiResult(str, isLTR); <add> return createBidiText(str, isLTR); <ide> } <ide> <ide> if (startLevel == -1) { <ide> var bidi = PDFJS.bidi = (function bidiClosure() { <ide> result += ch; <ide> } <ide> } <del> return new BidiResult(result, isLTR); <add> return createBidiText(result, isLTR); <ide> } <ide> <ide> return bidi; <ide><path>src/core/evaluator.js <ide> var PartialEvaluator = (function PartialEvaluatorClosure() { <ide> <ide> if (chunkBuf.length > 0) { <ide> var chunk = chunkBuf.join(''); <del> var bidiResult = PDFJS.bidi(chunk, -1, font.vertical); <del> var bidiText = { <del> str: bidiResult.str, <del> dir: bidiResult.dir <del> }; <add> var bidiText = PDFJS.bidi(chunk, -1, font.vertical); <ide> var renderParams = textState.calcRenderParams(preprocessor.ctm); <ide> var fontHeight = textState.fontSize * renderParams.vScale; <ide> var fontAscent = font.ascent ? font.ascent * fontHeight :
2
Javascript
Javascript
remove duplicate check
7fd5a4d096a8d868eb0f17fcb43779bab73ea030
<ide><path>lib/fs.js <ide> fs.writeFile = function(path, data, options, callback) { <ide> assertEncoding(options.encoding); <ide> <ide> var flag = options.flag || 'w'; <del> fs.open(path, options.flag || 'w', options.mode, function(openErr, fd) { <add> fs.open(path, flag, options.mode, function(openErr, fd) { <ide> if (openErr) { <ide> if (callback) callback(openErr); <ide> } else {
1
Text
Text
add the link for service logs
54d38fe115e0183af7d862e54ba6e58c347e2a8d
<ide><path>docs/reference/commandline/service_create.md <ide> x3ti0erg11rjpg64m75kej2mz-hosttempl <ide> ## Related information <ide> <ide> * [service inspect](service_inspect.md) <add>* [service logs](service_logs.md) <ide> * [service ls](service_ls.md) <ide> * [service rm](service_rm.md) <ide> * [service scale](service_scale.md) <ide><path>docs/reference/commandline/service_inspect.md <ide> $ docker service inspect --format='{{.Spec.Mode.Replicated.Replicas}}' redis <ide> ## Related information <ide> <ide> * [service create](service_create.md) <add>* [service logs](service_logs.md) <ide> * [service ls](service_ls.md) <ide> * [service rm](service_rm.md) <ide> * [service scale](service_scale.md) <ide><path>docs/reference/commandline/service_logs.md <ide> that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap <ide> seconds (aka Unix epoch or Unix time), and the optional .nanoseconds field is a <ide> fraction of a second no more than nine digits long. You can combine the <ide> `--since` option with either or both of the `--follow` or `--tail` options. <add> <add>## Related information <add> <add>* [service create](service_create.md) <add>* [service inspect](service_inspect.md) <add>* [service ls](service_ls.md) <add>* [service rm](service_rm.md) <add>* [service scale](service_scale.md) <add>* [service ps](service_ps.md) <add>* [service update](service_update.md) <ide><path>docs/reference/commandline/service_ls.md <ide> ID NAME MODE REPLICAS IMAGE <ide> <ide> * [service create](service_create.md) <ide> * [service inspect](service_inspect.md) <add>* [service logs](service_logs.md) <ide> * [service rm](service_rm.md) <ide> * [service scale](service_scale.md) <ide> * [service ps](service_ps.md) <ide><path>docs/reference/commandline/service_ps.md <ide> The `desired-state` filter can take the values `running`, `shutdown`, and `accep <ide> <ide> * [service create](service_create.md) <ide> * [service inspect](service_inspect.md) <add>* [service logs](service_logs.md) <ide> * [service ls](service_ls.md) <ide> * [service rm](service_rm.md) <ide> * [service scale](service_scale.md) <ide><path>docs/reference/commandline/service_rm.md <ide> ID NAME MODE REPLICAS IMAGE <ide> <ide> * [service create](service_create.md) <ide> * [service inspect](service_inspect.md) <add>* [service logs](service_logs.md) <ide> * [service ls](service_ls.md) <ide> * [service scale](service_scale.md) <ide> * [service ps](service_ps.md) <ide><path>docs/reference/commandline/service_scale.md <ide> Options: <ide> ### Scale a service <ide> <ide> The scale command enables you to scale one or more replicated services either up <del>or down to the desired number of replicas. This command cannot be applied on <add>or down to the desired number of replicas. This command cannot be applied on <ide> services which are global mode. The command will return immediately, but the <ide> actual scaling of the service may take some time. To stop all replicas of a <ide> service while keeping the service active in the swarm you can set the scale to 0. <ide> ID NAME MODE REPLICAS IMAGE <ide> <ide> * [service create](service_create.md) <ide> * [service inspect](service_inspect.md) <add>* [service logs](service_logs.md) <ide> * [service ls](service_ls.md) <ide> * [service rm](service_rm.md) <ide> * [service ps](service_ps.md) <ide><path>docs/reference/commandline/service_update.md <ide> See [`service create`](./service_create.md#templating) for the reference. <ide> <ide> * [service create](service_create.md) <ide> * [service inspect](service_inspect.md) <del>* [service ps](service_ps.md) <add>* [service logs](service_logs.md) <ide> * [service ls](service_ls.md) <add>* [service ps](service_ps.md) <ide> * [service rm](service_rm.md) <add>* [service scale](service_scale.md)
8
Javascript
Javascript
introduce hmr runtime
245065be87934924ab80103c490951a88807c2d5
<ide><path>packager/react-packager/src/Resolver/polyfills/require.js <ide> isInitialized: false, <ide> hasError: false, <ide> }; <add> <add> if (__DEV__) { // HMR <add> Object.assign(modules[id].module, { <add> hot: { <add> acceptCallback: null, <add> accept: function(callback) { <add> this.acceptCallback = callback; <add> } <add> } <add> }); <add> } <ide> } <ide> <ide> function require(id) { <ide> <ide> global.__d = define; <ide> global.require = require; <add> <add> if (__DEV__) { // HMR <add> function accept(id, factory) { <add> var mod = modules[id]; <add> if (mod.module.hot.acceptCallback) { <add> mod.factory = factory; <add> mod.isInitialized = false; <add> require(id); <add> <add> mod.hot.acceptCallback(); <add> } else { <add> console.log( <add> '[HMR] Module `' + id + '` cannot be accepted. ' + <add> 'Please reload bundle to get the updates.' <add> ); <add> } <add> } <add> <add> global.__accept = accept; <add> } <ide> })(this);
1
Mixed
Ruby
update latest versions of xcode for 10.11 & 10.12
c5bac087b34e90933acca1ee0371dd947cfa97a1
<ide><path>Library/Homebrew/os/mac.rb <ide> def preferred_arch <ide> "7.3" => { clang: "7.3", clang_build: 703 }, <ide> "7.3.1" => { clang: "7.3", clang_build: 703 }, <ide> "8.0" => { clang: "8.0", clang_build: 800 }, <add> "8.1" => { clang: "8.0", clang_build: 800 }, <add> "8.2" => { clang: "8.0", clang_build: 800 }, <add> "8.2.1" => { clang: "8.0", clang_build: 800 }, <add> "8.3" => { clang: "8.1", clang_build: 802 }, <ide> }.freeze <ide> <ide> def compilers_standard? <ide><path>Library/Homebrew/os/mac/xcode.rb <ide> def latest_version <ide> when "10.8" then "5.1.1" <ide> when "10.9" then "6.2" <ide> when "10.10" then "7.2.1" <del> when "10.11" then "8.2" <del> when "10.12" then "8.2" <add> when "10.11" then "8.2.1" <add> when "10.12" then "8.3" <ide> else <ide> raise "macOS '#{MacOS.version}' is invalid" unless OS::Mac.prerelease? <ide> <ide> # Default to newest known version of Xcode for unreleased macOS versions. <del> "8.2" <add> "8.3" <ide> end <ide> end <ide> <ide> def uncached_version <ide> when 70 then "7.0" <ide> when 73 then "7.3" <ide> when 80 then "8.0" <del> else "8.0" <add> when 81 then "8.3" <add> else "8.3" <ide> end <ide> end <ide> <ide> def latest_version <ide> # on the older supported platform for that Xcode release, i.e there's no <ide> # CLT package for 10.11 that contains the Clang version from Xcode 8. <ide> case MacOS.version <del> when "10.12" then "800.0.42.1" <del> when "10.11" then "703.0.31" <add> when "10.12" then "802.0.38" <add> when "10.11" then "800.0.42.1" <ide> when "10.10" then "700.1.81" <ide> when "10.9" then "600.0.57" <ide> when "10.8" then "503.0.40" <ide><path>docs/Xcode.md <ide> Tools available for your platform: <ide> | 10.8 | 5.1.1 | April 2014 | <ide> | 10.9 | 6.2 | 6.2 | <ide> | 10.10 | 7.2.1 | 7.2 | <del>| 10.11 | 8.0 | 7.3 | <del>| 10.12 | 8.0 | 8.0 | <add>| 10.11 | 8.2.1 | 8.2 | <add>| 10.12 | 8.3 | 8.3 | <ide> <ide> ## Compiler version database <ide> <ide> Tools available for your platform: <ide> | 7.3 | — | — | — | — | 7.3 (703.0.29) | — | <ide> | 7.3.1 | — | — | — | — | 7.3 (703.0.31) | — | <ide> | 8.0 | — | — | — | — | 8.0 (800.0.38) | — | <add>| 8.1 | — | — | — | — | 8.0 (800.0.42.1)| — | <add>| 8.2 | — | — | — | — | 8.0 (800.0.42.1)| — | <add>| 8.2.1 | — | — | — | — | 8.0 (800.0.42.1)| — | <add>| 8.3 | — | — | — | — | 8.1 (802.0.38) | — | <ide> <ide> ## References to Xcode and compiler versions in code <ide> When a new Xcode release is made, the following things need to be
3
Text
Text
remove apostrophe to correct grammar.
6aea3f015ae13878adba889d855871e6d1925158
<ide><path>README.md <ide> Typically, you can move computations or blocking IO to some other thread via `su <ide> <ide> RxJava operators don't work with `Thread`s or `ExecutorService`s directly but with so called `Scheduler`s that abstract away sources of concurrency behind an uniform API. RxJava 2 features several standard schedulers accessible via `Schedulers` utility class. These are available on all JVM platforms but some specific platforms, such as Android, have their own typical `Scheduler`s defined: `AndroidSchedulers.mainThread()`, `SwingScheduler.instance()` or `JavaFXSchedulers.gui()`. <ide> <del>The `Thread.sleep(2000);` at the end is no accident. In RxJava the default `Scheduler`s run on daemon threads, which means once the Java main thread exits, they all get stopped and background computations may never happen. Sleeping for some time in this example situations let's you see the output of the flow on the console with time to spare. <add>The `Thread.sleep(2000);` at the end is no accident. In RxJava the default `Scheduler`s run on daemon threads, which means once the Java main thread exits, they all get stopped and background computations may never happen. Sleeping for some time in this example situations lets you see the output of the flow on the console with time to spare. <ide> <ide> Flows in RxJava are sequential in nature split into processing stages that may run **concurrently** with each other: <ide>
1
Text
Text
use gfm footnotes in maintaining-v8.md
80e94dbb685b5c731e40b69915f47f541f7a9d33
<ide><path>doc/guides/maintaining-V8.md <ide> documented [on the V8 wiki][V8MergingPatching]. The summary of the process is: <ide> <ide> At any given time Node.js needs to be maintaining a few different V8 branches <ide> for the various Current, LTS, and nightly releases. At present this list <del>includes the following branches<sup>1</sup>: <add>includes the following branches:[^1] <ide> <ide> <table> <ide> <tr> <ide> to be cherry-picked in the Node.js repository and V8-CI must test the change. <ide> * Run the Node.js [V8 CI][] in addition to the [Node.js CI][]. <ide> The CI uses the `test-v8` target in the `Makefile`, which uses <ide> `tools/make-v8.sh` to reconstruct a git tree in the `deps/v8` directory to <del> run V8 tests<sup>2</sup>. <add> run V8 tests.[^2] <ide> <ide> The [`git-node`][] tool can be used to simplify this task. Run <ide> `git node v8 backport <sha>` to cherry-pick a commit. <ide> This would require some tooling to: <ide> promoted from `nodejs/v8` to `nodejs/node`. <ide> * Enabled the V8-CI build in Jenkins to build from the `nodejs/v8` fork. <ide> <del><!-- Footnotes themselves at the bottom. --> <add>[^1]: Node.js 0.12 and older are intentionally omitted from this document <add> as their support has ended. <ide> <del>### Notes <del> <del><sup>1</sup>Node.js 0.12 and older are intentionally omitted from this document <del>as their support has ended. <del> <del><sup>2</sup>The V8 tests still require Python 2. To run these tests locally, <del>you can run `PYTHON2 ./configure.py` before running `make test-v8`, in the root <del>of this repository. On macOS, this also requires a full Xcode install, <del>not just the "command line tools" for Xcode. <add>[^2]: The V8 tests still require Python 2. To run these tests locally, you can <add> run `PYTHON2 ./configure.py` before running `make test-v8`, in the root <add> of this repository. On macOS, this also requires a full Xcode install, <add> not just the "command line tools" for Xcode. <ide> <ide> [ChromiumReleaseCalendar]: https://www.chromium.org/developers/calendar <ide> [Node.js CI]: https://ci.nodejs.org/job/node-test-pull-request/
1
Ruby
Ruby
update template to match new style
3a2dc79153db5658a0bc14188a2ea77844a4e873
<ide><path>Library/Homebrew/cask/cmd/create.rb <ide> def run <ide> <ide> def self.template(cask_token) <ide> <<~RUBY <del> cask '#{cask_token}' do <del> version '' <del> sha256 '' <add> cask "#{cask_token}" do <add> version "" <add> sha256 "" <ide> <ide> url "https://" <del> name '' <del> homepage '' <add> name "" <add> homepage "" <ide> <del> app '' <add> app "" <ide> end <ide> RUBY <ide> end <ide><path>Library/Homebrew/test/cask/cmd/create_spec.rb <ide> described_class.run("new-cask") <ide> template = File.read(Cask::CaskLoader.path("new-cask")) <ide> expect(template).to eq <<~RUBY <del> cask 'new-cask' do <del> version '' <del> sha256 '' <add> cask "new-cask" do <add> version "" <add> sha256 "" <ide> <ide> url "https://" <del> name '' <del> homepage '' <add> name "" <add> homepage "" <ide> <del> app '' <add> app "" <ide> end <ide> RUBY <ide> end
2
Javascript
Javascript
remove duplicate 'the'
6ee7c29ca74e416bd53ca6174e2003a001e1356c
<ide><path>src/ng/filter/filter.js <ide> * <ide> * @param {function(actual, expected)|true|false} [comparator] Comparator which is used in <ide> * determining if values retrieved using `expression` (when it is not a function) should be <del> * considered a match based on the the expected value (from the filter expression) and actual <add> * considered a match based on the expected value (from the filter expression) and actual <ide> * value (from the object in the array). <ide> * <ide> * Can be one of:
1
Text
Text
add completion configuration for non-homebrew fish
7f651de7befd2f447e3fdc9a9c13bff49ca4cb2d
<ide><path>docs/Shell-Completion.md <ide> Additionally, if you receive "zsh compinit: insecure directories" warnings when <ide> <ide> ## Configuring Completions in `fish` <ide> <del>No configuration is needed in `fish`. Friendly! <add>No configuration is needed if you're using Homebrew's `fish`. Friendly! <add> <add>If your `fish` is from somewhere else, add the following to your `~/.config/fish/config.fish`: <add> <add>```sh <add>if test -d (brew --prefix)"/share/fish/completions" <add> set -g -x fish_complete_path $fish_complete_path (brew --prefix)/share/fish/completions <add>end <add> <add>if test -d (brew --prefix)"/share/fish/vendor_completions.d" <add> set -g -x fish_complete_path $fish_complete_path (brew --prefix)/share/fish/vendor_completions.d <add>end <add>```
1
Go
Go
fix deadlock on failed dial in udp userland proxy
6cbb8e070d6c3a66bf48fbe5cbf689557eee23db
<ide><path>pkg/proxy/udp_proxy.go <ide> func (proxy *UDPProxy) Run() { <ide> proxyConn, err = net.DialUDP("udp", nil, proxy.backendAddr) <ide> if err != nil { <ide> log.Printf("Can't proxy a datagram to udp/%s: %s\n", proxy.backendAddr, err) <add> proxy.connTrackLock.Unlock() <ide> continue <ide> } <ide> proxy.connTrackTable[*fromKey] = proxyConn
1
Python
Python
add create_meta option to package command
d4f2baf7dd7f0136916aa54c5d2af3ce12a43495
<ide><path>spacy/cli/package.py <ide> @plac.annotations( <ide> input_dir=("directory with model data", "positional", None, str), <ide> output_dir=("output parent directory", "positional", None, str), <del> meta=("path to meta.json", "option", "m", str), <add> meta_path=("path to meta.json", "option", "m", str), <add> create_meta=("create meta.json, even if one exists in directory", "flag", "c", bool), <ide> force=("force overwriting of existing folder in output directory", "flag", "f", bool) <ide> ) <del>def package(cmd, input_dir, output_dir, meta=None, force=False): <add>def package(cmd, input_dir, output_dir, meta_path=None, create_meta=False, force=False): <ide> """ <ide> Generate Python package for model data, including meta and required <ide> installation files. A new directory will be created in the specified <ide> output directory, and model data will be copied over. <ide> """ <ide> input_path = util.ensure_path(input_dir) <ide> output_path = util.ensure_path(output_dir) <del> meta_path = util.ensure_path(meta) <add> meta_path = util.ensure_path(meta_path) <ide> if not input_path or not input_path.exists(): <ide> prints(input_path, title="Model directory not found", exits=1) <ide> if not output_path or not output_path.exists(): <ide> def package(cmd, input_dir, output_dir, meta=None, force=False): <ide> template_manifest = get_template('MANIFEST.in') <ide> template_init = get_template('xx_model_name/__init__.py') <ide> meta_path = meta_path or input_path / 'meta.json' <del> if meta_path.is_file(): <add> if not create_meta and meta_path.is_file(): <ide> prints(meta_path, title="Reading meta.json from file") <ide> meta = util.read_json(meta_path) <ide> else:
1
Javascript
Javascript
check left todo)
adc086d4859ed63ef031bb25caa2ec19bdfe69a8
<ide><path>spec/update-spec.js <ide> <ide> import Update from '../src/update' <ide> import remote from 'remote' <add>import ipc from 'ipc' <ide> <ide> fdescribe('Update', () => { <add> let update <add> <add> afterEach(() => { <add> update.dispose() <add> }) <add> <ide> describe('::initialize', () => { <ide> it('subscribes to appropriate applicationDelegate events', () => { <del> const update = new Update() <del> update.initialize() <add> update = new Update() <ide> <ide> const downloadingSpy = jasmine.createSpy('downloadingSpy') <ide> const checkingSpy = jasmine.createSpy('checkingSpy') <ide> const noUpdateSpy = jasmine.createSpy('noUpdateSpy') <add> const completedDownloadSpy = jasmine.createSpy('completedDownloadSpy') <ide> <del> update.onDidBeginCheckingForUpdate(checkingSpy) <del> update.onDidBeginDownload(downloadingSpy) <del> update.onUpdateNotAvailable(noUpdateSpy) <add> update.emitter.on('did-begin-checking-for-update', checkingSpy) <add> update.emitter.on('did-begin-downloading-update', downloadingSpy) <add> update.emitter.on('did-complete-downloading-update', completedDownloadSpy) <add> update.emitter.on('update-not-available', noUpdateSpy) <add> <add> update.initialize() <ide> <del> // This doesn't work <ide> const webContents = remote.getCurrentWebContents() <del> webContents.send('message', 'update-available', {releaseVersion: '1.2.3'}) <del> webContents.send('message', 'did-begin-downloading-update') <ide> webContents.send('message', 'checking-for-update') <add> webContents.send('message', 'did-begin-downloading-update') <add> webContents.send('message', 'update-available', {releaseVersion: '1.2.3'}) <ide> webContents.send('message', 'update-not-available') <ide> <ide> waitsFor(() => { <del> noUpdateSpy.callCount > 0 <add> return noUpdateSpy.callCount > 0 <ide> }) <add> <ide> runs(() => { <ide> expect(downloadingSpy.callCount).toBe(1) <ide> expect(checkingSpy.callCount).toBe(1) <ide> expect(noUpdateSpy.callCount).toBe(1) <add> expect(completedDownloadSpy.callCount).toBe(1) <ide> }) <ide> }) <ide> }) <add> <add> beforeEach(() => { <add> update = new Update() <add> update.initialize() <add> }) <add> <add> describe('::onDidBeginCheckingForUpdate', () => { <add> it('subscribes to "did-begin-checking-for-update" event', () => { <add> const spy = jasmine.createSpy('spy') <add> update.onDidBeginCheckingForUpdate(spy) <add> update.emitter.emit('did-begin-checking-for-update') <add> expect(spy.callCount).toBe(1) <add> }) <add> }) <add> <add> describe('::onDidBeginDownload', () => { <add> it('subscribes to "did-begin-downloading-update" event', () => { <add> const spy = jasmine.createSpy('spy') <add> update.onDidBeginDownload(spy) <add> update.emitter.emit('did-begin-downloading-update') <add> expect(spy.callCount).toBe(1) <add> }) <add> }) <add> <add> describe('::onDidCompleteDownload', () => { <add> it('subscribes to "did-complete-downloading-update" event', () => { <add> const spy = jasmine.createSpy('spy') <add> update.onDidCompleteDownload(spy) <add> update.emitter.emit('did-complete-downloading-update') <add> expect(spy.callCount).toBe(1) <add> }) <add> }) <add> <add> describe('::onUpdateNotAvailable', () => { <add> it('subscribes to "update-not-available" event', () => { <add> const spy = jasmine.createSpy('spy') <add> update.onUpdateNotAvailable(spy) <add> update.emitter.emit('update-not-available') <add> expect(spy.callCount).toBe(1) <add> }) <add> }) <add> <add> describe('::onUpdateAvailable', () => { <add> it('subscribes to "update-available" event', () => { <add> const spy = jasmine.createSpy('spy') <add> update.onUpdateAvailable(spy) <add> update.emitter.emit('update-available') <add> expect(spy.callCount).toBe(1) <add> }) <add> }) <add> <add> // TODO: spec is timing out. spy is not called <add> // describe('::check', () => { <add> // it('sends "check-for-update" event', () => { <add> // const spy = jasmine.createSpy('spy') <add> // ipc.on('check-for-update', () => { <add> // spy() <add> // }) <add> // update.check() <add> // waitsFor(() => { <add> // return spy.callCount > 0 <add> // }) <add> // }) <add> // }) <add> <add> describe('::dispose', () => { <add> it('disposes of subscriptions', () => { <add> expect(update.subscriptions.disposables).not.toBeNull() <add> update.dispose() <add> expect(update.subscriptions.disposables).toBeNull() <add> }) <add> }) <add> <ide> })
1
Javascript
Javascript
add opacitynode and rename to colornode property
806eb90507bca48a22c86fd12deae7a05c5936d4
<ide><path>examples/jsm/renderers/webgpu/WebGPUNodeBuilder.js <ide> class WebGPUNodeBuilder extends NodeBuilder { <ide> <ide> if ( material.isMeshBasicMaterial ) { <ide> <del> if ( material.color.isNode ) { <add> if ( material.colorNode !== undefined ) { <ide> <del> this.addSlot( 'fragment', new NodeSlot( material.color, 'COLOR', 'vec3' ) ); <add> this.addSlot( 'fragment', new NodeSlot( material.colorNode, 'COLOR', 'vec3' ) ); <add> <add> } <add> <add> if ( material.opacityNode !== undefined ) { <add> <add> this.addSlot( 'fragment', new NodeSlot( material.opacityNode, 'OPACITY', 'float' ) ); <ide> <ide> } <ide> <ide><path>examples/jsm/renderers/webgpu/WebGPURenderPipelines.js <ide> const ShaderLib = { <ide> outColor.rgb = NODE_COLOR; <ide> #endif <ide> <add> #ifdef NODE_OPACITY <add> outColor.a *= NODE_OPACITY; <add> #endif <add> <ide> outColor.a *= opacityUniforms.opacity; <ide> }` <ide> },
2
Javascript
Javascript
make a fork for reactcurrentdispatcher
3e15b1c69014ad6767eac645228a052df861edc0
<ide><path>packages/react/src/forks/ReactCurrentDispatcher.www.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> <add>export default require('ReactCurrentDispatcher'); <ide><path>scripts/rollup/forks.js <ide> const forks = Object.freeze({ <ide> } <ide> }, <ide> <add> // Similarly, we preserve an inline require to ReactCurrentDispatcher. <add> // See the explanation in FB version of ReactCurrentDispatcher in www: <add> 'react/src/ReactCurrentDispatcher': (bundleType, entry) => { <add> switch (bundleType) { <add> case FB_WWW_DEV: <add> case FB_WWW_PROD: <add> case FB_WWW_PROFILING: <add> return 'react/src/forks/ReactCurrentDispatcher.www.js'; <add> default: <add> return null; <add> } <add> }, <add> <ide> // Different wrapping/reporting for caught errors. <ide> 'shared/invokeGuardedCallbackImpl': (bundleType, entry) => { <ide> switch (bundleType) {
2
Javascript
Javascript
fix failing test
089717cbd3a8743387ee897bc4edea9afafd5db9
<ide><path>spec/text-editor-component-spec.js <ide> describe('TextEditorComponent', () => { <ide> const decoration = editor.decorateMarker(marker, {type: 'overlay', item: overlayElement, class: 'a'}) <ide> await component.getNextUpdatePromise() <ide> <add> let overlayComponent <add> component.overlayComponents.forEach(c => overlayComponent = c) <add> <ide> const overlayWrapper = overlayElement.parentElement <ide> expect(overlayWrapper.classList.contains('a')).toBe(true) <ide> expect(overlayWrapper.getBoundingClientRect().top).toBe(clientTopForLine(component, 5)) <ide> describe('TextEditorComponent', () => { <ide> await setScrollTop(component, 20) <ide> expect(overlayWrapper.getBoundingClientRect().top).toBe(clientTopForLine(component, 5)) <ide> overlayElement.style.height = 60 + 'px' <del> await component.getNextUpdatePromise() <add> await overlayComponent.getNextUpdatePromise() <ide> expect(overlayWrapper.getBoundingClientRect().bottom).toBe(clientTopForLine(component, 4)) <ide> <ide> // Does not flip the overlay vertically if it would overflow the top of the window <ide> overlayElement.style.height = 80 + 'px' <del> await component.getNextUpdatePromise() <add> await overlayComponent.getNextUpdatePromise() <ide> expect(overlayWrapper.getBoundingClientRect().top).toBe(clientTopForLine(component, 5)) <ide> <ide> // Can update overlay wrapper class <ide><path>src/text-editor-component.js <ide> class TextEditorComponent { <ide> measuredDimensions: this.overlayDimensionsByElement.get(overlayProps.element), <ide> didResize: (overlayComponent) => { <ide> this.updateOverlayToRender(overlayProps) <del> overlayComponent.update({ <del> measuredDimensions: this.overlayDimensionsByElement.get(overlayProps.element) <del> }) <add> overlayComponent.update(Object.assign( <add> { <add> measuredDimensions: this.overlayDimensionsByElement.get(overlayProps.element) <add> }, <add> overlayProps <add> )) <ide> } <ide> }, <ide> overlayProps <ide> class OverlayComponent { <ide> this.didDetach() <ide> } <ide> <add> getNextUpdatePromise () { <add> if (!this.nextUpdatePromise) { <add> this.nextUpdatePromise = new Promise((resolve) => { <add> this.resolveNextUpdatePromise = () => { <add> this.nextUpdatePromise = null <add> this.resolveNextUpdatePromise = null <add> resolve() <add> } <add> }) <add> } <add> return this.nextUpdatePromise <add> } <add> <ide> update (newProps) { <ide> const oldProps = this.props <ide> this.props = Object.assign({}, oldProps, newProps) <ide> class OverlayComponent { <ide> if (oldProps.className != null) this.element.classList.remove(oldProps.className) <ide> if (newProps.className != null) this.element.classList.add(newProps.className) <ide> } <add> <add> if (this.resolveNextUpdatePromise) this.resolveNextUpdatePromise() <ide> } <ide> <ide> didAttach () {
2
Javascript
Javascript
take vertical padding into account
5dd1c77cf51adda1055c2eabb9f064b8ed5ee5ff
<ide><path>src/core/core.layoutService.js <ide> module.exports = function(Chart) { <ide> <ide> helpers.each(leftBoxes.concat(rightBoxes, topBoxes, bottomBoxes), getMinimumBoxSize); <ide> <del> // If a box has padding, we move the left scale over to avoid ugly charts (see issue #2478) <add> // If a horizontal box has padding, we move the left boxes over to avoid ugly charts (see issue #2478) <ide> var maxHorizontalLeftPadding = 0; <ide> var maxHorizontalRightPadding = 0; <add> var maxVerticalTopPadding = 0; <add> var maxVerticalBottomPadding = 0; <ide> <ide> helpers.each(topBoxes.concat(bottomBoxes), function(horizontalBox) { <ide> if (horizontalBox.getPadding) { <ide> module.exports = function(Chart) { <ide> } <ide> }); <ide> <add> helpers.each(leftBoxes.concat(rightBoxes), function(verticalBox) { <add> if (verticalBox.getPadding) { <add> var boxPadding = verticalBox.getPadding(); <add> maxVerticalTopPadding = Math.max(maxVerticalTopPadding, boxPadding.top); <add> maxVerticalBottomPadding = Math.max(maxVerticalBottomPadding, boxPadding.bottom); <add> } <add> }); <add> <ide> // At this point, maxChartAreaHeight and maxChartAreaWidth are the size the chart area could <ide> // be if the axes are drawn at their minimum sizes. <ide> // Steps 5 & 6 <ide> module.exports = function(Chart) { <ide> <ide> // We may be adding some padding to account for rotated x axis labels <ide> var leftPaddingAddition = Math.max(maxHorizontalLeftPadding - totalLeftBoxesWidth, 0); <del> var rightPaddingAddition = Math.max(maxHorizontalRightPadding - totalRightBoxesWidth, 0); <del> <ide> totalLeftBoxesWidth += leftPaddingAddition; <del> totalRightBoxesWidth += rightPaddingAddition; <add> totalRightBoxesWidth += Math.max(maxHorizontalRightPadding - totalRightBoxesWidth, 0); <add> <add> var topPaddingAddition = Math.max(maxVerticalTopPadding - totalTopBoxesHeight, 0); <add> totalTopBoxesHeight += topPaddingAddition; <add> totalBottomBoxesHeight += Math.max(maxVerticalBottomPadding - totalBottomBoxesHeight, 0); <ide> <ide> // Figure out if our chart area changed. This would occur if the dataset layout label rotation <ide> // changed due to the application of the margins in step 6. Since we can only get bigger, this is safe to do <ide> module.exports = function(Chart) { <ide> <ide> // Step 7 - Position the boxes <ide> var left = leftPadding + leftPaddingAddition; <del> var top = topPadding; <add> var top = topPadding + topPaddingAddition; <ide> <ide> function placeBox(box) { <ide> if (box.isHorizontal()) { <ide><path>src/core/core.scale.js <ide> module.exports = function(Chart) { <ide> }; <ide> <ide> Chart.Scale = Chart.Element.extend({ <add> /** <add> * Get the padding needed for the scale <add> * @method getPadding <add> * @private <add> * @returns {Padding} the necessary padding <add> */ <ide> getPadding: function() { <ide> var me = this; <ide> return { <ide><path>test/scale.logarithmic.tests.js <ide> describe('Logarithmic Scale tests', function() { <ide> expect(xScale.getPixelForValue(10, 0, 0)).toBeCloseToPixel(276); // halfway <ide> expect(xScale.getPixelForValue(0, 0, 0)).toBeCloseToPixel(48); // 0 is invalid, put it on the left. <ide> <del> expect(xScale.getValueForPixel(481.5)).toBeCloseTo(80, 1e-4); <add> expect(xScale.getValueForPixel(481.5)).toBeCloseToPixel(80); <ide> expect(xScale.getValueForPixel(48)).toBeCloseTo(1, 1e-4); <ide> expect(xScale.getValueForPixel(276)).toBeCloseTo(10, 1e-4); <ide>
3
Javascript
Javascript
fix typo in docs for `mut` helper
fc20f0a5205359ca1b01a8403002724dc79af046
<ide><path>packages/ember-htmlbars/lib/keywords/mut.js <ide> export let MUTABLE_REFERENCE = symbol('MUTABLE_REFERENCE'); <ide> <ide> /** <ide> The `mut` helper lets you __clearly specify__ that a child `Component` can update the <del> (mutable) value passed to it, which will __change the value of the parent compnent__. <add> (mutable) value passed to it, which will __change the value of the parent component__. <ide> <ide> This is very helpful for passing mutable values to a `Component` of any size, but <ide> critical to understanding the logic of a large/complex `Component`.
1
PHP
PHP
apply fixes from styleci
302a579f00ebcb2573f481054cbeadad9c970605
<ide><path>src/Illuminate/Validation/Concerns/ReplacesAttributes.php <ide> protected function replaceStartsWith($message, $attribute, $rule, $parameters) <ide> <ide> return str_replace(':values', implode(', ', $parameters), $message); <ide> } <del> <add> <ide> /** <ide> * Replace all place-holders for the doesnt_start_with rule. <ide> * <ide><path>src/Illuminate/Validation/Concerns/ValidatesAttributes.php <ide> public function validateStartsWith($attribute, $value, $parameters) <ide> { <ide> return Str::startsWith($value, $parameters); <ide> } <del> <add> <ide> /** <ide> * Validate the attribute does not start with a given substring. <ide> *
2
PHP
PHP
update parameter names for expressioninterface
a96f91067aa9173ceb53d29b686f2b23cc48ba0f
<ide><path>src/Database/Expression/AggregateExpression.php <ide> public function excludeTies() <ide> /** <ide> * @inheritDoc <ide> */ <del> public function sql(ValueBinder $generator): string <add> public function sql(ValueBinder $binder): string <ide> { <del> $sql = parent::sql($generator); <add> $sql = parent::sql($binder); <ide> if ($this->filter !== null) { <del> $sql .= ' FILTER (WHERE ' . $this->filter->sql($generator) . ')'; <add> $sql .= ' FILTER (WHERE ' . $this->filter->sql($binder) . ')'; <ide> } <ide> if ($this->window !== null) { <ide> if ($this->window->isNamedOnly()) { <del> $sql .= ' OVER ' . $this->window->sql($generator); <add> $sql .= ' OVER ' . $this->window->sql($binder); <ide> } else { <del> $sql .= ' OVER (' . $this->window->sql($generator) . ')'; <add> $sql .= ' OVER (' . $this->window->sql($binder) . ')'; <ide> } <ide> } <ide> <ide> public function sql(ValueBinder $generator): string <ide> /** <ide> * @inheritDoc <ide> */ <del> public function traverse(Closure $visitor) <add> public function traverse(Closure $callback) <ide> { <del> parent::traverse($visitor); <add> parent::traverse($callback); <ide> if ($this->filter !== null) { <del> $visitor($this->filter); <del> $this->filter->traverse($visitor); <add> $callback($this->filter); <add> $this->filter->traverse($callback); <ide> } <ide> if ($this->window !== null) { <del> $visitor($this->window); <del> $this->window->traverse($visitor); <add> $callback($this->window); <add> $this->window->traverse($callback); <ide> } <ide> <ide> return $this; <ide><path>src/Database/Expression/BetweenExpression.php <ide> public function __construct($field, $from, $to, $type = null) <ide> } <ide> <ide> /** <del> * Converts the expression to its string representation <del> * <del> * @param \Cake\Database\ValueBinder $generator Placeholder generator object <del> * @return string <add> * @inheritDoc <ide> */ <del> public function sql(ValueBinder $generator): string <add> public function sql(ValueBinder $binder): string <ide> { <ide> $parts = [ <ide> 'from' => $this->_from, <ide> public function sql(ValueBinder $generator): string <ide> /** @var string|\Cake\Database\ExpressionInterface $field */ <ide> $field = $this->_field; <ide> if ($field instanceof ExpressionInterface) { <del> $field = $field->sql($generator); <add> $field = $field->sql($binder); <ide> } <ide> <ide> foreach ($parts as $name => $part) { <ide> if ($part instanceof ExpressionInterface) { <del> $parts[$name] = $part->sql($generator); <add> $parts[$name] = $part->sql($binder); <ide> continue; <ide> } <del> $parts[$name] = $this->_bindValue($part, $generator, $this->_type); <add> $parts[$name] = $this->_bindValue($part, $binder, $this->_type); <ide> } <ide> <ide> return sprintf('%s BETWEEN %s AND %s', $field, $parts['from'], $parts['to']); <ide> public function sql(ValueBinder $generator): string <ide> /** <ide> * @inheritDoc <ide> */ <del> public function traverse(Closure $visitor) <add> public function traverse(Closure $callback) <ide> { <ide> foreach ([$this->_field, $this->_from, $this->_to] as $part) { <ide> if ($part instanceof ExpressionInterface) { <del> $visitor($part); <add> $callback($part); <ide> } <ide> } <ide> <ide> public function traverse(Closure $visitor) <ide> * Registers a value in the placeholder generator and returns the generated placeholder <ide> * <ide> * @param mixed $value The value to bind <del> * @param \Cake\Database\ValueBinder $generator The value binder to use <add> * @param \Cake\Database\ValueBinder $binder The value binder to use <ide> * @param string $type The type of $value <ide> * @return string generated placeholder <ide> */ <del> protected function _bindValue($value, $generator, $type): string <add> protected function _bindValue($value, $binder, $type): string <ide> { <del> $placeholder = $generator->placeholder('c'); <del> $generator->bind($placeholder, $value, $type); <add> $placeholder = $binder->placeholder('c'); <add> $binder->bind($placeholder, $value, $type); <ide> <ide> return $placeholder; <ide> } <ide><path>src/Database/Expression/CaseExpression.php <ide> public function elseValue($value = null, ?string $type = null): void <ide> * Compiles the relevant parts into sql <ide> * <ide> * @param array|string|\Cake\Database\ExpressionInterface $part The part to compile <del> * @param \Cake\Database\ValueBinder $generator Sql generator <add> * @param \Cake\Database\ValueBinder $binder Sql generator <ide> * @return string <ide> */ <del> protected function _compile($part, ValueBinder $generator): string <add> protected function _compile($part, ValueBinder $binder): string <ide> { <ide> if ($part instanceof ExpressionInterface) { <del> $part = $part->sql($generator); <add> $part = $part->sql($binder); <ide> } elseif (is_array($part)) { <del> $placeholder = $generator->placeholder('param'); <del> $generator->bind($placeholder, $part['value'], $part['type']); <add> $placeholder = $binder->placeholder('param'); <add> $binder->bind($placeholder, $part['value'], $part['type']); <ide> $part = $placeholder; <ide> } <ide> <ide> protected function _compile($part, ValueBinder $generator): string <ide> /** <ide> * Converts the Node into a SQL string fragment. <ide> * <del> * @param \Cake\Database\ValueBinder $generator Placeholder generator object <add> * @param \Cake\Database\ValueBinder $binder Placeholder generator object <ide> * @return string <ide> */ <del> public function sql(ValueBinder $generator): string <add> public function sql(ValueBinder $binder): string <ide> { <ide> $parts = []; <ide> $parts[] = 'CASE'; <ide> foreach ($this->_conditions as $k => $part) { <ide> $value = $this->_values[$k]; <del> $parts[] = 'WHEN ' . $this->_compile($part, $generator) . ' THEN ' . $this->_compile($value, $generator); <add> $parts[] = 'WHEN ' . $this->_compile($part, $binder) . ' THEN ' . $this->_compile($value, $binder); <ide> } <ide> if ($this->_elseValue !== null) { <ide> $parts[] = 'ELSE'; <del> $parts[] = $this->_compile($this->_elseValue, $generator); <add> $parts[] = $this->_compile($this->_elseValue, $binder); <ide> } <ide> $parts[] = 'END'; <ide> <ide> public function sql(ValueBinder $generator): string <ide> /** <ide> * @inheritDoc <ide> */ <del> public function traverse(Closure $visitor) <add> public function traverse(Closure $callback) <ide> { <ide> foreach (['_conditions', '_values'] as $part) { <ide> foreach ($this->{$part} as $c) { <ide> if ($c instanceof ExpressionInterface) { <del> $visitor($c); <del> $c->traverse($visitor); <add> $callback($c); <add> $c->traverse($callback); <ide> } <ide> } <ide> } <ide> if ($this->_elseValue instanceof ExpressionInterface) { <del> $visitor($this->_elseValue); <del> $this->_elseValue->traverse($visitor); <add> $callback($this->_elseValue); <add> $this->_elseValue->traverse($callback); <ide> } <ide> <ide> return $this; <ide><path>src/Database/Expression/CommonTableExpression.php <ide> public function recursive() <ide> /** <ide> * @inheritDoc <ide> */ <del> public function sql(ValueBinder $generator): string <add> public function sql(ValueBinder $binder): string <ide> { <ide> $fields = ''; <ide> if ($this->fields) { <del> $expressions = array_map(function (IdentifierExpression $e) use ($generator) { <del> return $e->sql($generator); <add> $expressions = array_map(function (IdentifierExpression $e) use ($binder) { <add> return $e->sql($binder); <ide> }, $this->fields); <ide> $fields = sprintf('(%s)', implode(', ', $expressions)); <ide> } <ide> public function sql(ValueBinder $generator): string <ide> <ide> return sprintf( <ide> '%s%s AS %s(%s)', <del> $this->name->sql($generator), <add> $this->name->sql($binder), <ide> $fields, <ide> $suffix, <del> $this->query ? $this->query->sql($generator) : '' <add> $this->query ? $this->query->sql($binder) : '' <ide> ); <ide> } <ide> <ide> /** <ide> * @inheritDoc <ide> */ <del> public function traverse(Closure $visitor) <add> public function traverse(Closure $callback) <ide> { <del> $visitor($this->name); <add> $callback($this->name); <ide> foreach ($this->fields as $field) { <del> $visitor($field); <del> $field->traverse($visitor); <add> $callback($field); <add> $field->traverse($callback); <ide> } <ide> <ide> if ($this->query) { <del> $visitor($this->query); <del> $this->query->traverse($visitor); <add> $callback($this->query); <add> $this->query->traverse($callback); <ide> } <ide> <ide> return $this; <ide><path>src/Database/Expression/ComparisonExpression.php <ide> public function getOperator(): string <ide> } <ide> <ide> /** <del> * Convert the expression into a SQL fragment. <del> * <del> * @param \Cake\Database\ValueBinder $generator Placeholder generator object <del> * @return string <add> * @inheritDoc <ide> */ <del> public function sql(ValueBinder $generator): string <add> public function sql(ValueBinder $binder): string <ide> { <ide> /** @var string|\Cake\Database\ExpressionInterface $field */ <ide> $field = $this->_field; <ide> <ide> if ($field instanceof ExpressionInterface) { <del> $field = $field->sql($generator); <add> $field = $field->sql($binder); <ide> } <ide> <ide> if ($this->_value instanceof ExpressionInterface) { <ide> $template = '%s %s (%s)'; <del> $value = $this->_value->sql($generator); <add> $value = $this->_value->sql($binder); <ide> } else { <del> [$template, $value] = $this->_stringExpression($generator); <add> [$template, $value] = $this->_stringExpression($binder); <ide> } <ide> <ide> return sprintf($template, $field, $this->_operator, $value); <ide> public function __clone() <ide> <ide> /** <ide> * Returns a template and a placeholder for the value after registering it <del> * with the placeholder $generator <add> * with the placeholder $binder <ide> * <del> * @param \Cake\Database\ValueBinder $generator The value binder to use. <add> * @param \Cake\Database\ValueBinder $binder The value binder to use. <ide> * @return array First position containing the template and the second a placeholder <ide> */ <del> protected function _stringExpression(ValueBinder $generator): array <add> protected function _stringExpression(ValueBinder $binder): array <ide> { <ide> $template = '%s '; <ide> <ide> protected function _stringExpression(ValueBinder $generator): array <ide> if ($type !== null) { <ide> $type = str_replace('[]', '', $type); <ide> } <del> $value = $this->_flattenValue($this->_value, $generator, $type); <add> $value = $this->_flattenValue($this->_value, $binder, $type); <ide> <ide> // To avoid SQL errors when comparing a field to a list of empty values, <ide> // better just throw an exception here <ide> if ($value === '') { <del> $field = $this->_field instanceof ExpressionInterface ? $this->_field->sql($generator) : $this->_field; <add> $field = $this->_field instanceof ExpressionInterface ? $this->_field->sql($binder) : $this->_field; <ide> /** @psalm-suppress PossiblyInvalidCast */ <ide> throw new DatabaseException( <ide> "Impossible to generate condition with empty list of values for field ($field)" <ide> ); <ide> } <ide> } else { <ide> $template .= '%s %s'; <del> $value = $this->_bindValue($this->_value, $generator, $this->_type); <add> $value = $this->_bindValue($this->_value, $binder, $this->_type); <ide> } <ide> <ide> return [$template, $value]; <ide> protected function _stringExpression(ValueBinder $generator): array <ide> * Registers a value in the placeholder generator and returns the generated placeholder <ide> * <ide> * @param mixed $value The value to bind <del> * @param \Cake\Database\ValueBinder $generator The value binder to use <add> * @param \Cake\Database\ValueBinder $binder The value binder to use <ide> * @param string|null $type The type of $value <ide> * @return string generated placeholder <ide> */ <del> protected function _bindValue($value, ValueBinder $generator, ?string $type = null): string <add> protected function _bindValue($value, ValueBinder $binder, ?string $type = null): string <ide> { <del> $placeholder = $generator->placeholder('c'); <del> $generator->bind($placeholder, $value, $type); <add> $placeholder = $binder->placeholder('c'); <add> $binder->bind($placeholder, $value, $type); <ide> <ide> return $placeholder; <ide> } <ide> <ide> /** <ide> * Converts a traversable value into a set of placeholders generated by <del> * $generator and separated by `,` <add> * $binder and separated by `,` <ide> * <ide> * @param iterable $value the value to flatten <del> * @param \Cake\Database\ValueBinder $generator The value binder to use <add> * @param \Cake\Database\ValueBinder $binder The value binder to use <ide> * @param string|null $type the type to cast values to <ide> * @return string <ide> */ <del> protected function _flattenValue(iterable $value, ValueBinder $generator, ?string $type = null): string <add> protected function _flattenValue(iterable $value, ValueBinder $binder, ?string $type = null): string <ide> { <ide> $parts = []; <ide> if (is_array($value)) { <ide> foreach ($this->_valueExpressions as $k => $v) { <del> $parts[$k] = $v->sql($generator); <add> $parts[$k] = $v->sql($binder); <ide> unset($value[$k]); <ide> } <ide> } <ide> <ide> if (!empty($value)) { <del> $parts += $generator->generateManyNamed($value, $type); <add> $parts += $binder->generateManyNamed($value, $type); <ide> } <ide> <ide> return implode(',', $parts); <ide><path>src/Database/Expression/FunctionExpression.php <ide> public function add($conditions, array $types = [], bool $prepend = false) <ide> } <ide> <ide> /** <del> * Returns the string representation of this object so that it can be used in a <del> * SQL query. Note that values condition values are not included in the string, <del> * in their place placeholders are put and can be replaced by the quoted values <del> * accordingly. <del> * <del> * @param \Cake\Database\ValueBinder $generator Placeholder generator object <del> * @return string <add> * @inheritDoc <ide> */ <del> public function sql(ValueBinder $generator): string <add> public function sql(ValueBinder $binder): string <ide> { <ide> $parts = []; <ide> foreach ($this->_conditions as $condition) { <ide> if ($condition instanceof Query) { <del> $condition = sprintf('(%s)', $condition->sql($generator)); <add> $condition = sprintf('(%s)', $condition->sql($binder)); <ide> } elseif ($condition instanceof ExpressionInterface) { <del> $condition = $condition->sql($generator); <add> $condition = $condition->sql($binder); <ide> } elseif (is_array($condition)) { <del> $p = $generator->placeholder('param'); <del> $generator->bind($p, $condition['value'], $condition['type']); <add> $p = $binder->placeholder('param'); <add> $binder->bind($p, $condition['value'], $condition['type']); <ide> $condition = $p; <ide> } <ide> $parts[] = $condition; <ide><path>src/Database/Expression/IdentifierExpression.php <ide> public function getIdentifier(): string <ide> } <ide> <ide> /** <del> * Converts the expression to its string representation <del> * <del> * @param \Cake\Database\ValueBinder $generator Placeholder generator object <del> * @return string <add> * @inheritDoc <ide> */ <del> public function sql(ValueBinder $generator): string <add> public function sql(ValueBinder $binder): string <ide> { <ide> return $this->_identifier; <ide> } <ide> <ide> /** <ide> * @inheritDoc <ide> */ <del> public function traverse(Closure $visitor) <add> public function traverse(Closure $callback) <ide> { <ide> return $this; <ide> } <ide><path>src/Database/Expression/OrderByExpression.php <ide> public function __construct($conditions = [], $types = [], $conjunction = '') <ide> } <ide> <ide> /** <del> * Convert the expression into a SQL fragment. <del> * <del> * @param \Cake\Database\ValueBinder $generator Placeholder generator object <del> * @return string <add> * @inheritDoc <ide> */ <del> public function sql(ValueBinder $generator): string <add> public function sql(ValueBinder $binder): string <ide> { <ide> $order = []; <ide> foreach ($this->_conditions as $k => $direction) { <ide> if ($direction instanceof ExpressionInterface) { <del> $direction = $direction->sql($generator); <add> $direction = $direction->sql($binder); <ide> } <ide> $order[] = is_numeric($k) ? $direction : sprintf('%s %s', $k, $direction); <ide> } <ide><path>src/Database/Expression/OrderClauseExpression.php <ide> public function __construct($field, $direction) <ide> /** <ide> * @inheritDoc <ide> */ <del> public function sql(ValueBinder $generator): string <add> public function sql(ValueBinder $binder): string <ide> { <ide> /** @var string|\Cake\Database\ExpressionInterface $field */ <ide> $field = $this->_field; <ide> if ($field instanceof ExpressionInterface) { <del> $field = $field->sql($generator); <add> $field = $field->sql($binder); <ide> } <ide> <ide> return sprintf('%s %s', $field, $this->_direction); <ide> public function sql(ValueBinder $generator): string <ide> /** <ide> * @inheritDoc <ide> */ <del> public function traverse(Closure $visitor) <add> public function traverse(Closure $callback) <ide> { <ide> if ($this->_field instanceof ExpressionInterface) { <del> $visitor($this->_field); <del> $this->_field->traverse($visitor); <add> $callback($this->_field); <add> $this->_field->traverse($callback); <ide> } <ide> <ide> return $this; <ide><path>src/Database/Expression/QueryExpression.php <ide> public function equalFields(string $left, string $right) <ide> } <ide> <ide> /** <del> * Returns the string representation of this object so that it can be used in a <del> * SQL query. Note that values condition values are not included in the string, <del> * in their place placeholders are put and can be replaced by the quoted values <del> * accordingly. <del> * <del> * @param \Cake\Database\ValueBinder $generator Placeholder generator object <del> * @return string <add> * @inheritDoc <ide> */ <del> public function sql(ValueBinder $generator): string <add> public function sql(ValueBinder $binder): string <ide> { <ide> $len = $this->count(); <ide> if ($len === 0) { <ide> public function sql(ValueBinder $generator): string <ide> $parts = []; <ide> foreach ($this->_conditions as $part) { <ide> if ($part instanceof Query) { <del> $part = '(' . $part->sql($generator) . ')'; <add> $part = '(' . $part->sql($binder) . ')'; <ide> } elseif ($part instanceof ExpressionInterface) { <del> $part = $part->sql($generator); <add> $part = $part->sql($binder); <ide> } <ide> if (strlen($part)) { <ide> $parts[] = $part; <ide> public function sql(ValueBinder $generator): string <ide> } <ide> <ide> /** <del> * Traverses the tree structure of this query expression by executing a callback <del> * function for each of the conditions that are included in this object. <del> * Useful for compiling the final expression, or doing <del> * introspection in the structure. <del> * <del> * Callback function receives as only argument an instance of ExpressionInterface <del> * <del> * @param \Closure $visitor The callable to apply to all sub-expressions. <del> * @return $this <add> * @inheritDoc <ide> */ <del> public function traverse(Closure $visitor) <add> public function traverse(Closure $callback) <ide> { <ide> foreach ($this->_conditions as $c) { <ide> if ($c instanceof ExpressionInterface) { <del> $visitor($c); <del> $c->traverse($visitor); <add> $callback($c); <add> $c->traverse($callback); <ide> } <ide> } <ide> <ide> public function traverse(Closure $visitor) <ide> * passed by reference, this will enable you to change the key under which the <ide> * modified part is stored. <ide> * <del> * @param callable $visitor The callable to apply to each part. <add> * @param callable $callback The callable to apply to each part. <ide> * @return $this <ide> */ <del> public function iterateParts(callable $visitor) <add> public function iterateParts(callable $callback) <ide> { <ide> $parts = []; <ide> foreach ($this->_conditions as $k => $c) { <ide> $key = &$k; <del> $part = $visitor($c, $key); <add> $part = $callback($c, $key); <ide> if ($part !== null) { <ide> $parts[$key] = $part; <ide> } <ide> public function iterateParts(callable $visitor) <ide> * as they often contain user input and arrays of strings <ide> * are easy to sneak in. <ide> * <del> * @param callable|string|array|\Cake\Database\ExpressionInterface $c The callable to check. <add> * @param callable|string|array|\Cake\Database\ExpressionInterface $callable The callable to check. <ide> * @return bool Valid callable. <ide> */ <del> public function isCallable($c): bool <add> public function isCallable($callable): bool <ide> { <del> if (is_string($c)) { <add> if (is_string($callable)) { <ide> return false; <ide> } <del> if (is_object($c) && is_callable($c)) { <add> if (is_object($callable) && is_callable($callable)) { <ide> return true; <ide> } <ide> <del> return is_array($c) && isset($c[0]) && is_object($c[0]) && is_callable($c); <add> return is_array($callable) && isset($callable[0]) && is_object($callable[0]) && is_callable($callable); <ide> } <ide> <ide> /** <ide><path>src/Database/Expression/TupleComparison.php <ide> public function setValue($value): void <ide> } <ide> <ide> /** <del> * Convert the expression into a SQL fragment. <del> * <del> * @param \Cake\Database\ValueBinder $generator Placeholder generator object <del> * @return string <add> * @inheritDoc <ide> */ <del> public function sql(ValueBinder $generator): string <add> public function sql(ValueBinder $binder): string <ide> { <ide> $template = '(%s) %s (%s)'; <ide> $fields = []; <ide> public function sql(ValueBinder $generator): string <ide> } <ide> <ide> foreach ($originalFields as $field) { <del> $fields[] = $field instanceof ExpressionInterface ? $field->sql($generator) : $field; <add> $fields[] = $field instanceof ExpressionInterface ? $field->sql($binder) : $field; <ide> } <ide> <del> $values = $this->_stringifyValues($generator); <add> $values = $this->_stringifyValues($binder); <ide> <ide> $field = implode(', ', $fields); <ide> <ide> public function sql(ValueBinder $generator): string <ide> * Returns a string with the values as placeholders in a string to be used <ide> * for the SQL version of this expression <ide> * <del> * @param \Cake\Database\ValueBinder $generator The value binder to convert expressions with. <add> * @param \Cake\Database\ValueBinder $binder The value binder to convert expressions with. <ide> * @return string <ide> */ <del> protected function _stringifyValues(ValueBinder $generator): string <add> protected function _stringifyValues(ValueBinder $binder): string <ide> { <ide> $values = []; <ide> $parts = $this->getValue(); <ide> <ide> if ($parts instanceof ExpressionInterface) { <del> return $parts->sql($generator); <add> return $parts->sql($binder); <ide> } <ide> <ide> foreach ($parts as $i => $value) { <ide> if ($value instanceof ExpressionInterface) { <del> $values[] = $value->sql($generator); <add> $values[] = $value->sql($binder); <ide> continue; <ide> } <ide> <ide> protected function _stringifyValues(ValueBinder $generator): string <ide> foreach ($value as $k => $val) { <ide> /** @var string $valType */ <ide> $valType = $type && isset($type[$k]) ? $type[$k] : $type; <del> $bound[] = $this->_bindValue($val, $generator, $valType); <add> $bound[] = $this->_bindValue($val, $binder, $valType); <ide> } <ide> <ide> $values[] = sprintf('(%s)', implode(',', $bound)); <ide> protected function _stringifyValues(ValueBinder $generator): string <ide> <ide> /** @var string $valType */ <ide> $valType = $type && isset($type[$i]) ? $type[$i] : $type; <del> $values[] = $this->_bindValue($value, $generator, $valType); <add> $values[] = $this->_bindValue($value, $binder, $valType); <ide> } <ide> <ide> return implode(', ', $values); <ide> protected function _stringifyValues(ValueBinder $generator): string <ide> /** <ide> * @inheritDoc <ide> */ <del> protected function _bindValue($value, ValueBinder $generator, ?string $type = null): string <add> protected function _bindValue($value, ValueBinder $binder, ?string $type = null): string <ide> { <del> $placeholder = $generator->placeholder('tuple'); <del> $generator->bind($placeholder, $value, $type); <add> $placeholder = $binder->placeholder('tuple'); <add> $binder->bind($placeholder, $value, $type); <ide> <ide> return $placeholder; <ide> } <ide> <ide> /** <del> * Traverses the tree of expressions stored in this object, visiting first <del> * expressions in the left hand side and then the rest. <del> * <del> * Callback function receives as its only argument an instance of an ExpressionInterface <del> * <del> * @param \Closure $visitor The callable to apply to sub-expressions <del> * @return $this <add> * @inheritDoc <ide> */ <del> public function traverse(Closure $visitor) <add> public function traverse(Closure $callback) <ide> { <ide> /** @var string[] $fields */ <ide> $fields = $this->getField(); <ide> foreach ($fields as $field) { <del> $this->_traverseValue($field, $visitor); <add> $this->_traverseValue($field, $callback); <ide> } <ide> <ide> $value = $this->getValue(); <ide> if ($value instanceof ExpressionInterface) { <del> $visitor($value); <del> $value->traverse($visitor); <add> $callback($value); <add> $value->traverse($callback); <ide> <ide> return $this; <ide> } <ide> <ide> foreach ($value as $val) { <ide> if ($this->isMulti()) { <ide> foreach ($val as $v) { <del> $this->_traverseValue($v, $visitor); <add> $this->_traverseValue($v, $callback); <ide> } <ide> } else { <del> $this->_traverseValue($val, $visitor); <add> $this->_traverseValue($val, $callback); <ide> } <ide> } <ide> <ide> public function traverse(Closure $visitor) <ide> * it is an ExpressionInterface <ide> * <ide> * @param mixed $value The value to traverse <del> * @param \Closure $callable The callable to use when traversing <add> * @param \Closure $callback The callable to use when traversing <ide> * @return void <ide> */ <del> protected function _traverseValue($value, Closure $callable): void <add> protected function _traverseValue($value, Closure $callback): void <ide> { <ide> if ($value instanceof ExpressionInterface) { <del> $callable($value); <del> $value->traverse($callable); <add> $callback($value); <add> $value->traverse($callback); <ide> } <ide> } <ide> <ide><path>src/Database/Expression/UnaryExpression.php <ide> public function __construct(string $operator, $value, $mode = self::PREFIX) <ide> } <ide> <ide> /** <del> * Converts the expression to its string representation <del> * <del> * @param \Cake\Database\ValueBinder $generator Placeholder generator object <del> * @return string <add> * @inheritDoc <ide> */ <del> public function sql(ValueBinder $generator): string <add> public function sql(ValueBinder $binder): string <ide> { <ide> $operand = $this->_value; <ide> if ($operand instanceof ExpressionInterface) { <del> $operand = $operand->sql($generator); <add> $operand = $operand->sql($binder); <ide> } <ide> <ide> if ($this->_mode === self::POSTFIX) { <ide> public function sql(ValueBinder $generator): string <ide> /** <ide> * @inheritDoc <ide> */ <del> public function traverse(Closure $visitor) <add> public function traverse(Closure $callback) <ide> { <ide> if ($this->_value instanceof ExpressionInterface) { <del> $visitor($this->_value); <del> $this->_value->traverse($visitor); <add> $callback($this->_value); <add> $this->_value->traverse($callback); <ide> } <ide> <ide> return $this; <ide><path>src/Database/Expression/ValuesExpression.php <ide> public function getQuery(): ?Query <ide> } <ide> <ide> /** <del> * Convert the values into a SQL string with placeholders. <del> * <del> * @param \Cake\Database\ValueBinder $generator Placeholder generator object <del> * @return string <add> * @inheritDoc <ide> */ <del> public function sql(ValueBinder $generator): string <add> public function sql(ValueBinder $binder): string <ide> { <ide> if (empty($this->_values) && empty($this->_query)) { <ide> return ''; <ide> public function sql(ValueBinder $generator): string <ide> $value = $row[$column]; <ide> <ide> if ($value instanceof ExpressionInterface) { <del> $rowPlaceholders[] = '(' . $value->sql($generator) . ')'; <add> $rowPlaceholders[] = '(' . $value->sql($binder) . ')'; <ide> continue; <ide> } <ide> <del> $placeholder = $generator->placeholder('c'); <add> $placeholder = $binder->placeholder('c'); <ide> $rowPlaceholders[] = $placeholder; <del> $generator->bind($placeholder, $value, $types[$column]); <add> $binder->bind($placeholder, $value, $types[$column]); <ide> } <ide> <ide> $placeholders[] = implode(', ', $rowPlaceholders); <ide> } <ide> <ide> $query = $this->getQuery(); <ide> if ($query) { <del> return ' ' . $query->sql($generator); <add> return ' ' . $query->sql($binder); <ide> } <ide> <ide> return sprintf(' VALUES (%s)', implode('), (', $placeholders)); <ide> } <ide> <ide> /** <del> * Traverse the values expression. <del> * <del> * This method will also traverse any queries that are to be used in the INSERT <del> * values. <del> * <del> * @param \Closure $visitor The visitor to traverse the expression with. <del> * @return $this <add> * @inheritDoc <ide> */ <del> public function traverse(Closure $visitor) <add> public function traverse(Closure $callback) <ide> { <ide> if ($this->_query) { <ide> return $this; <ide> public function traverse(Closure $visitor) <ide> <ide> foreach ($this->_values as $v) { <ide> if ($v instanceof ExpressionInterface) { <del> $v->traverse($visitor); <add> $v->traverse($callback); <ide> } <ide> if (!is_array($v)) { <ide> continue; <ide> } <ide> foreach ($v as $field) { <ide> if ($field instanceof ExpressionInterface) { <del> $visitor($field); <del> $field->traverse($visitor); <add> $callback($field); <add> $field->traverse($callback); <ide> } <ide> } <ide> } <ide><path>src/Database/Expression/WindowExpression.php <ide> public function excludeTies() <ide> /** <ide> * @inheritDoc <ide> */ <del> public function sql(ValueBinder $generator): string <add> public function sql(ValueBinder $binder): string <ide> { <ide> $clauses = []; <ide> if ($this->name->getIdentifier()) { <del> $clauses[] = $this->name->sql($generator); <add> $clauses[] = $this->name->sql($binder); <ide> } <ide> <ide> if ($this->partitions) { <ide> $expressions = []; <ide> foreach ($this->partitions as $partition) { <del> $expressions[] = $partition->sql($generator); <add> $expressions[] = $partition->sql($binder); <ide> } <ide> <ide> $clauses[] = 'PARTITION BY ' . implode(', ', $expressions); <ide> } <ide> <ide> if ($this->order) { <del> $clauses[] = $this->order->sql($generator); <add> $clauses[] = $this->order->sql($binder); <ide> } <ide> <ide> if ($this->frame) { <ide> $start = $this->buildOffsetSql( <del> $generator, <add> $binder, <ide> $this->frame['start']['offset'], <ide> $this->frame['start']['direction'] <ide> ); <ide> $end = $this->buildOffsetSql( <del> $generator, <add> $binder, <ide> $this->frame['end']['offset'], <ide> $this->frame['end']['direction'] <ide> ); <ide> public function sql(ValueBinder $generator): string <ide> /** <ide> * @inheritDoc <ide> */ <del> public function traverse(Closure $visitor) <add> public function traverse(Closure $callback) <ide> { <del> $visitor($this->name); <add> $callback($this->name); <ide> foreach ($this->partitions as $partition) { <del> $visitor($partition); <del> $partition->traverse($visitor); <add> $callback($partition); <add> $partition->traverse($callback); <ide> } <ide> <ide> if ($this->order) { <del> $visitor($this->order); <del> $this->order->traverse($visitor); <add> $callback($this->order); <add> $this->order->traverse($callback); <ide> } <ide> <ide> if ($this->frame !== null) { <ide> $offset = $this->frame['start']['offset']; <ide> if ($offset instanceof ExpressionInterface) { <del> $visitor($offset); <del> $offset->traverse($visitor); <add> $callback($offset); <add> $offset->traverse($callback); <ide> } <ide> $offset = $this->frame['end']['offset'] ?? null; <ide> if ($offset instanceof ExpressionInterface) { <del> $visitor($offset); <del> $offset->traverse($visitor); <add> $callback($offset); <add> $offset->traverse($callback); <ide> } <ide> } <ide> <ide> public function traverse(Closure $visitor) <ide> /** <ide> * Builds frame offset sql. <ide> * <del> * @param \Cake\Database\ValueBinder $generator Value binder <add> * @param \Cake\Database\ValueBinder $binder Value binder <ide> * @param int|string|\Cake\Database\ExpressionInterface|null $offset Frame offset <ide> * @param string $direction Frame offset direction <ide> * @return string <ide> */ <del> protected function buildOffsetSql(ValueBinder $generator, $offset, string $direction): string <add> protected function buildOffsetSql(ValueBinder $binder, $offset, string $direction): string <ide> { <ide> if ($offset === 0) { <ide> return 'CURRENT ROW'; <ide> } <ide> <ide> if ($offset instanceof ExpressionInterface) { <del> $offset = $offset->sql($generator); <add> $offset = $offset->sql($binder); <ide> } <ide> <ide> $sql = sprintf( <ide><path>src/Database/ExpressionInterface.php <ide> interface ExpressionInterface <ide> /** <ide> * Converts the Node into a SQL string fragment. <ide> * <del> * @param \Cake\Database\ValueBinder $generator Placeholder generator object <add> * @param \Cake\Database\ValueBinder $binder Parameter binder <ide> * @return string <ide> */ <del> public function sql(ValueBinder $generator): string; <add> public function sql(ValueBinder $binder): string; <ide> <ide> /** <ide> * Iterates over each part of the expression recursively for every <del> * level of the expressions tree and executes the $visitor callable <add> * level of the expressions tree and executes the $callback callable <ide> * passing as first parameter the instance of the expression currently <ide> * being iterated. <ide> * <del> * @param \Closure $visitor The callable to apply to all nodes. <add> * @param \Closure $callback The callable to apply to all nodes. <ide> * @return $this <ide> */ <del> public function traverse(Closure $visitor); <add> public function traverse(Closure $callback); <ide> }
15
Ruby
Ruby
maintain a seperate buffer for each thread
96ab01e8f2b5a4475453acf60f9cf9bd8cd98483
<ide><path>activesupport/lib/active_support/buffered_logger.rb <ide> def silence(temporary_level = ERROR) <ide> <ide> attr_accessor :level <ide> attr_reader :auto_flushing <del> attr_reader :buffer <ide> <ide> def initialize(log, level = DEBUG) <ide> @level = level <del> @buffer = [] <add> @buffer = {} <ide> @auto_flushing = 1 <ide> @guard = Mutex.new <ide> <ide> def add(severity, message = nil, progname = nil, &block) <ide> # If a newline is necessary then create a new message ending with a newline. <ide> # Ensures that the original message is not mutated. <ide> message = "#{message}\n" unless message[-1] == ?\n <del> @guard.synchronize do <del> buffer << message <del> end <add> buffer << message <ide> auto_flush <ide> message <ide> end <ide> def auto_flushing=(period) <ide> def flush <ide> @guard.synchronize do <ide> unless buffer.empty? <del> old_buffer = @buffer <del> @buffer = [] <add> old_buffer = buffer <add> clear_buffer <ide> @log.write(old_buffer.join) <ide> end <ide> end <ide> def close <ide> def auto_flush <ide> flush if buffer.size >= @auto_flushing <ide> end <add> <add> def buffer <add> @buffer[Thread.current] ||= [] <add> end <add> <add> def clear_buffer <add> @buffer[Thread.current] = [] <add> end <ide> end <ide> end <ide><path>activesupport/test/buffered_logger_test.rb <ide> def test_should_not_mutate_message <ide> end <ide> <ide> @logger.flush <del> assert !@output.string.empty?, @logger.buffer.size <add> assert !@output.string.empty?, @logger.send(:buffer).size <ide> end <ide> <ide> define_method "test_disabling_auto_flush_with_#{disable.inspect}_should_flush_at_max_buffer_size_as_failsafe" do <ide> def test_should_not_mutate_message <ide> end <ide> <ide> @logger.info 'there it is.' <del> assert !@output.string.empty?, @logger.buffer.size <add> assert !@output.string.empty?, @logger.send(:buffer).size <ide> end <ide> end <del> <add> <ide> def test_should_know_if_its_loglevel_is_below_a_given_level <ide> ActiveSupport::BufferedLogger::Severity.constants.each do |level| <ide> @logger.level = ActiveSupport::BufferedLogger::Severity.const_get(level) - 1 <ide> def test_should_auto_flush_every_n_messages <ide> @logger.info 'there it is.' <ide> assert !@output.string.empty?, @output.string <ide> end <del> <add> <ide> def test_should_create_the_log_directory_if_it_doesnt_exist <ide> tmp_directory = File.join(File.dirname(__FILE__), "tmp") <ide> log_file = File.join(tmp_directory, "development.log") <ide> def test_should_create_the_log_directory_if_it_doesnt_exist <ide> ensure <ide> FileUtils.rm_rf(tmp_directory) <ide> end <add> <add> def test_logger_should_maintain_separate_buffers_for_each_thread <add> @logger.auto_flushing = false <add> <add> a = Thread.new do <add> @logger.info("a"); Thread.pass; <add> @logger.info("b"); Thread.pass; <add> @logger.info("c"); @logger.flush <add> end <add> <add> b = Thread.new do <add> @logger.info("x"); Thread.pass; <add> @logger.info("y"); Thread.pass; <add> @logger.info("z"); @logger.flush <add> end <add> <add> a.join <add> b.join <add> <add> assert_equal "a\nb\nc\nx\ny\nz\n", @output.string <add> end <ide> end
2
Text
Text
fix heading level in changelog
f553515d1ec7049ac85de3a75bc2850a9d4ab70d
<ide><path>CHANGELOG.md <ide> * Improve queue performance by switching its internal data structure to a min binary heap. ([@acdlite](http://github.com/acdlite) in [#16245](https://github.com/facebook/react/pull/16245)) <ide> * Use `postMessage` loop with short intervals instead of attempting to align to frame boundaries with `requestAnimationFrame`. ([@acdlite](http://github.com/acdlite) in [#16214](https://github.com/facebook/react/pull/16214)) <ide> <del># useSubscription <add>### useSubscription <ide> <ide> * Avoid tearing issue when a mutation happens and the previous update is still in progress. ([@bvaughn](http://github.com/bvaughn) in [#16623](https://github.com/facebook/react/pull/16623)) <ide>
1
Javascript
Javascript
fix typo in error message
6467d1d4e91ce7a658bcc6edebc5565aa210595b
<ide><path>tools/doc/checkLinks.js <ide> function checkFile(path) { <ide> console.error((process.env.GITHUB_ACTIONS ? <ide> `::error file=${path},line=${line},col=${column}::` : '') + <ide> `Unordered reference at ${path}:${line}:${column} (` + <del> `"${node.label}" should be before "${previousDefinitionLabel})"` <add> `"${node.label}" should be before "${previousDefinitionLabel}")` <ide> ); <ide> process.exitCode = 1; <ide> }
1
Ruby
Ruby
remove override warning
313134fbe361acbf474a5ad9f507e230f70ff4ae
<ide><path>Library/Homebrew/formula_specialties.rb <ide> class ScriptFileFormula < Formula <ide> def install <ide> bin.install Dir['*'] <ide> end <del> <del> def self.method_added method <del> super method <del> case method <del> when :install <del> opoo "#{name}: if you are overriding ScriptFileFormula#install, use a Formula instead" <del> end <del> end <ide> end <ide> <ide> # See browser for an example
1
PHP
PHP
add levels to handler
a507e1424339633ce423729ec0ac49b99f0e57d7
<ide><path>app/Exceptions/Handler.php <ide> <ide> class Handler extends ExceptionHandler <ide> { <add> /** <add> * A list of exceptions with their corresponding custom log levels. <add> * <add> * @var array<class-string<\Throwable>, \Psr\Log\LogLevel::*> <add> */ <add> protected $levels = [ <add> // <add> ]; <add> <ide> /** <ide> * A list of the exception types that are not reported. <ide> *
1
Javascript
Javascript
improve $location.search() docs
b389cfc49efdad50a8d5ac7d693767cae719f41a
<ide><path>src/ng/location.js <ide> LocationHashbangInHtml5Url.prototype = <ide> * <ide> * Change search part when called with parameter and return `$location`. <ide> * <add> * <add> * ```js <add> * // given url http://example.com/#/some/path?foo=bar&baz=xoxo <add> * var searchObject = $location.search(); <add> * // => {foo: 'bar', baz: 'xoxo'} <add> * <add> * <add> * // set foo to 'yipee' <add> * $location.search('foo', 'yipee'); <add> * // => $location <add> * ``` <add> * <ide> * @param {string|Object.<string>|Object.<Array.<string>>} search New search params - string or <del> * hash object. Hash object may contain an array of values, which will be decoded as duplicates in <del> * the url. <add> * hash object. <add> * <add> * When called with a single argument the method acts as a setter, setting the `search` component <add> * of `$location` to the specified value. <add> * <add> * If the argument is a hash object containing an array of values, these values will be encoded <add> * as duplicate search parameters in the url. <add> * <add> * @param {(string|Array<string>)=} paramValue If `search` is a string, then `paramValue` will <add> * override only a single search property. <add> * <add> * If `paramValue` is an array, it will override the property of the `search` component of <add> * `$location` specified via the first argument. <ide> * <del> * @param {(string|Array<string>)=} paramValue If `search` is a string, then `paramValue` will override only a <del> * single search parameter. If `paramValue` is an array, it will set the parameter as a <del> * comma-separated value. If `paramValue` is `null`, the parameter will be deleted. <add> * If `paramValue` is `null`, the property specified via the first argument will be deleted. <ide> * <del> * @return {string} search <add> * @return {Object} If called with no arguments returns the parsed `search` object. If called with <add> * one or more arguments returns `$location` object itself. <ide> */ <ide> search: function(search, paramValue) { <ide> switch (arguments.length) {
1
PHP
PHP
apply fixes from styleci
8eb3de12720c7bd53a411748ad282bfbda57a948
<ide><path>src/Illuminate/Contracts/Foundation/Application.php <ide> public function environment(); <ide> * @return bool <ide> */ <ide> public function runningInConsole(); <del> <del> /** <add> <add> /** <ide> * Determine if we are running unit tests. <ide> * <ide> * @return bool
1