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
Text
Text
add 2.4.4 to changelog.md
d601333063ee51992dcce4ca413dbde065f5e44d
<ide><path>CHANGELOG.md <ide> # Ember Changelog <ide> <add><<<<<<< HEAD <ide> ### 2.5.0-beta.3 (March 14, 2016) <ide> <ide> - [#13083](https://github.com/emberjs/ember.js/issues/13083) [BUGFIX] Fix issue with feature flagging infrastructure in beta 2 <ide> - [#13024](https://github.com/emberjs/ember.js/pull/13024) [BUGFIX] Change internal async acceptance test helpers to be somewhat more efficient in determining router transition status. <ide> - [FEATURE] Add helper method named `Ember.assign` to roughly emulate `Object.assign`. <ide> <add>### 2.4.4 (April 3, 2016) <add> <add>- [#13177](https://github.com/emberjs/ember.js/pull/13177) [BUGFIX] Allow contextual component attributes are mutable (allowing for two way binding). <add>- [#13185](https://github.com/emberjs/ember.js/pull/13185) [BUGFIX] Ensure `{{render}}` sets up target properly (fixes issues with `{{render}}`'ed templates using actions). <add>- [#13202](https://github.com/emberjs/ember.js/pull/13202) [BUGFIX] Merge in active transition QPs when doing a transition. <add>- [#13218](https://github.com/emberjs/ember.js/pull/13218) [BUGFIX] Do not refresh routes on initial transition. <add>- [#13228](https://github.com/emberjs/ember.js/pull/13228) [BUGFIX] re-enable link-to when disabledWhen changes values. <add> <ide> ### 2.4.3 (March 17, 2016) <ide> <ide> - [#13118](https://github.com/emberjs/ember.js/pull/13118) [BUGFIX] Work around Chrome 49/50 optimization bug affecting helper usage.
1
Javascript
Javascript
fix wrong param order in doc
05596527edb055b094dd6b42ca118b411aa27eb2
<ide><path>src/ng/filter/filter.js <ide> * property of the object. That's equivalent to the simple substring match with a `string` <ide> * as described above. <ide> * <del> * - `function`: A predicate function can be used to write arbitrary filters. The function is <add> * - `function(value)`: A predicate function can be used to write arbitrary filters. The function is <ide> * called for each element of `array`. The final result is an array of those elements that <ide> * the predicate returned true for. <ide> * <del> * @param {function(expected, actual)|true|undefined} comparator Comparator which is used in <add> * @param {function(actual, expected)|true|undefined} comparator Comparator which is used in <ide> * determining if the expected value (from the filter expression) and actual value (from <ide> * the object in the array) should be considered a match. <ide> * <ide> * Can be one of: <ide> * <del> * - `function(expected, actual)`: <add> * - `function(actual, expected)`: <ide> * The function will be given the object value and the predicate value to compare and <ide> * should return true if the item should be included in filtered result. <ide> * <del> * - `true`: A shorthand for `function(expected, actual) { return angular.equals(expected, actual)}`. <add> * - `true`: A shorthand for `function(actual, expected) { return angular.equals(expected, actual)}`. <ide> * this is essentially strict comparison of expected and actual. <ide> * <ide> * - `false|undefined`: A short hand for a function which will look for a substring match in case
1
Python
Python
remove unnecessary branching
599e2b183db846a632b1efd148e6bc97d926ee5c
<ide><path>rest_framework/urlpatterns.py <ide> def format_suffix_patterns(urlpatterns, suffix_required=False, allowed=None): <ide> else: <ide> suffix_pattern = r'\.(?P<%s>[a-z0-9]+)/?$' % suffix_kwarg <ide> <del> if path and register_converter: <del> converter_name, suffix_converter = _get_format_path_converter(suffix_kwarg, allowed) <del> register_converter(suffix_converter, converter_name) <add> converter_name, suffix_converter = _get_format_path_converter(suffix_kwarg, allowed) <add> register_converter(suffix_converter, converter_name) <ide> <del> suffix_route = '<%s:%s>' % (converter_name, suffix_kwarg) <del> else: <del> suffix_route = None <add> suffix_route = '<%s:%s>' % (converter_name, suffix_kwarg) <ide> <ide> return apply_suffix_patterns(urlpatterns, suffix_pattern, suffix_required, suffix_route)
1
Go
Go
use ioctlgetint/ioctlsetint from x/sys/unix
bedf09363cb7f2f59bf2b72fea0704351b9f5c8d
<ide><path>pkg/loopback/ioctl.go <ide> import ( <ide> ) <ide> <ide> func ioctlLoopCtlGetFree(fd uintptr) (int, error) { <del> index, _, err := unix.Syscall(unix.SYS_IOCTL, fd, LoopCtlGetFree, 0) <del> if err != 0 { <add> index, err := unix.IoctlGetInt(int(fd), LoopCtlGetFree) <add> if err != nil { <ide> return 0, err <ide> } <del> return int(index), nil <add> return index, nil <ide> } <ide> <ide> func ioctlLoopSetFd(loopFd, sparseFd uintptr) error { <del> if _, _, err := unix.Syscall(unix.SYS_IOCTL, loopFd, LoopSetFd, sparseFd); err != 0 { <add> if err := unix.IoctlSetInt(int(loopFd), LoopSetFd, int(sparseFd)); err != nil { <ide> return err <ide> } <ide> return nil <ide> func ioctlLoopGetStatus64(loopFd uintptr) (*loopInfo64, error) { <ide> } <ide> <ide> func ioctlLoopSetCapacity(loopFd uintptr, value int) error { <del> if _, _, err := unix.Syscall(unix.SYS_IOCTL, loopFd, LoopSetCapacity, uintptr(value)); err != 0 { <add> if err := unix.IoctlSetInt(int(loopFd), LoopSetCapacity, value); err != nil { <ide> return err <ide> } <ide> return nil
1
Python
Python
add some tests for ndarray.resize
82e08aa07fa4d6a94808f8cf7cd191d1bf6bae82
<ide><path>numpy/core/tests/test_multiarray.py <ide> def test_none_shape(self): <ide> x = np.eye(3) <ide> x.resize(None) <ide> assert_array_equal(x, np.eye(3)) <add> x.resize() <add> assert_array_equal(x, np.eye(3)) <add> <add> def test_invalid_arguements(self): <add> self.assertRaises(TypeError, np.eye(3).resize, 'hi') <add> self.assertRaises(ValueError, np.eye(3).resize, -1) <add> self.assertRaises(TypeError, np.eye(3).resize, order=1) <add> self.assertRaises(TypeError, np.eye(3).resize, refcheck='hi') <add> <add> def test_freeform_shape(self): <add> x = np.eye(3) <add> x.resize(3,2,1) <add> assert_(x.shape == (3,2,1)) <add> <add> def test_zeros_appended(self): <add> x = np.eye(3) <add> x.resize(2,3,3) <add> assert_array_equal(x[0], np.eye(3)) <add> assert_array_equal(x[1], np.zeros((3,3))) <ide> <ide> <ide> class TestRecord(TestCase):
1
Javascript
Javascript
fix linting errors
ca9054a4f811f1371307c108a89839f6df2f0805
<ide><path>src/tooltip.js <add>/* global MutationObserver */ <add> <ide> 'use strict' <ide> <ide> const EventKit = require('event-kit') <ide> Tooltip.prototype.init = function (element, options) { <ide> this.element = element <ide> this.options = this.getOptions(options) <ide> this.disposables = new EventKit.CompositeDisposable() <del> this.mutationObserver = new MutationObserver(this.handleMutations.bind(this)); <add> this.mutationObserver = new MutationObserver(this.handleMutations.bind(this)) <ide> <ide> if (this.options.viewport) { <ide> if (typeof this.options.viewport === 'function') { <ide> Tooltip.prototype.init = function (element, options) { <ide> : this.fixTitle() <ide> } <ide> <del>Tooltip.prototype.startObservingMutations = function() { <add>Tooltip.prototype.startObservingMutations = function () { <ide> this.mutationObserver.observe(this.getTooltipElement(), { <ide> attributes: true, childList: true, characterData: true, subtree: true <ide> }) <ide> } <ide> <del>Tooltip.prototype.stopObservingMutations = function() { <del> this.mutationObserver.disconnect(); <add>Tooltip.prototype.stopObservingMutations = function () { <add> this.mutationObserver.disconnect() <ide> } <ide> <del>Tooltip.prototype.handleMutations = function(mutations) { <del> this.stopObservingMutations(); <del> requestAnimationFrame(function() { <del> this.recalculatePosition(); <del> this.startObservingMutations(); <add>Tooltip.prototype.handleMutations = function (mutations) { <add> this.stopObservingMutations() <add> window.requestAnimationFrame(function () { <add> this.recalculatePosition() <add> this.startObservingMutations() <ide> }.bind(this)) <ide> } <ide> <ide> Tooltip.prototype.show = function () { <ide> } <ide> <ide> var tip = this.getTooltipElement() <del> this.startObservingMutations(); <add> this.startObservingMutations() <ide> var tipId = this.getUID('tooltip') <ide> <ide> this.setContent() <ide> Tooltip.prototype.hide = function (callback) { <ide> } <ide> <ide> this.tip && this.tip.classList.remove('in') <del> this.stopObservingMutations(); <add> this.stopObservingMutations() <ide> <ide> if (this.hoverState !== 'in') this.tip && this.tip.remove() <ide> <ide> Tooltip.prototype.getDelegateComponent = function (element) { <ide> return component <ide> } <ide> <del>Tooltip.prototype.recalculatePosition = function() { <del> var tip = this.getTooltipElement(); <del> var placement = typeof this.options.placement == 'function' ? <del> this.options.placement.call(this, tip, this.element) : <del> this.options.placement <add>Tooltip.prototype.recalculatePosition = function () { <add> var tip = this.getTooltipElement() <add> <add> var placement = typeof this.options.placement === 'function' <add> ? this.options.placement.call(this, tip, this.element) <add> : this.options.placement <ide> <ide> var autoToken = /\s?auto?\s?/i <ide> var autoPlace = autoToken.test(placement) <ide> if (autoPlace) placement = placement.replace(autoToken, '') || 'top' <ide> <ide> tip.classList.add(placement) <ide> <del> var pos = this.element.getBoundingClientRect() <del> var actualWidth = tip.offsetWidth <add> var pos = this.element.getBoundingClientRect() <add> var actualWidth = tip.offsetWidth <ide> var actualHeight = tip.offsetHeight <ide> <ide> if (autoPlace) { <ide> var orgPlacement = placement <ide> var viewportDim = this.viewport.getBoundingClientRect() <ide> <del> placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' : <del> placement == 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' : <del> placement == 'right' && pos.right + actualWidth > viewportDim.width ? 'left' : <del> placement == 'left' && pos.left - actualWidth < viewportDim.left ? 'right' : <del> placement <add> placement = placement === 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' <add> : placement === 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' <add> : placement === 'right' && pos.right + actualWidth > viewportDim.width ? 'left' <add> : placement === 'left' && pos.left - actualWidth < viewportDim.left ? 'right' <add> : placement <ide> <ide> tip.classList.remove(orgPlacement) <ide> tip.classList.add(placement)
1
Text
Text
replace stub for mongdb lesson (use model.findone)
a16cff7671490191596e296cc3d3f6d3585db85e
<ide><path>guide/english/certifications/apis-and-microservices/mongodb-and-mongoose/use-model.findone-to-return-a-single-matching-document-from-your-database/index.md <ide> --- <ide> title: Use model.findOne() to Return a Single Matching Document from Your Database <ide> --- <del>## Use model.findOne() to Return a Single Matching Document from Your Database <add># Use model.findOne() to Return a Single Matching Document from Your Database <ide> <del>This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/mongodb-and-mongoose/use-model.findone-to-return-a-single-matching-document-from-your-database/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>. <add>## Solutions <ide> <del><a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>. <add><details><summary>Solution #1 (Click to Show/Hide)</summary> <ide> <del><!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds --> <add>Code for `myApp.js` <add> <add>```javascript <add>/** 1) Install & Set up mongoose */ <add>const mongoose = require('mongoose'); <add>mongoose.connect(process.env.MONGO_URI); <add> <add>/** 2) Create a 'Person' Model */ <add>var personSchema = new mongoose.Schema({ <add> name: String, <add> age: Number, <add> favoriteFoods: [String] <add>}); <add> <add>/** 3) Create and Save a Person */ <add>var Person = mongoose.model('Person', personSchema); <add> <add>var createAndSavePerson = function(done) { <add> var janeFonda = new Person({name: "Jane Fonda", age: 84, favoriteFoods: ["vodka", "air"]}); <add> <add> janeFonda.save(function(err, data) { <add> if (err) return console.error(err); <add> done(null, data) <add> }); <add>}; <add> <add>/** 4) Create many People with `Model.create()` */ <add>var arrayOfPeople = [ <add> {name: "Frankie", age: 74, favoriteFoods: ["Del Taco"]}, <add> {name: "Sol", age: 76, favoriteFoods: ["roast chicken"]}, <add> {name: "Robert", age: 78, favoriteFoods: ["wine"]} <add>]; <add>var createManyPeople = function(arrayOfPeople, done) { <add> Person.create(arrayOfPeople, function (err, people) { <add> if (err) return console.log(err); <add> done(null, people); <add> }); <add>}; <add> <add>/** 5) Use `Model.find()` */ <add>var findPeopleByName = function(personName, done) { <add> Person.find({name: personName}, function (err, personFound) { <add> if (err) return console.log(err); <add> done(null, personFound); <add> }); <add>}; <add> <add>/** 6) Use `Model.findOne()` */ <add>var findOneByFood = function(food, done) { <add> Person.findOne({favoriteFoods: food}, function (err, data) { <add> if (err) return console.log(err); <add> done(null, data); <add> }); <add>}; <add>``` <add></details>
1
Text
Text
add jacksontian to collaborators
92a02d51dcb63ec50532d36dd91336f1c9a9cd8d
<ide><path>README.md <ide> information about the governance of the Node.js project, see <ide> * [iarna](https://github.com/iarna) - **Rebecca Turner** &lt;me@re-becca.org&gt; <ide> * [isaacs](https://github.com/isaacs) - **Isaac Z. Schlueter** &lt;i@izs.me&gt; <ide> * [iWuzHere](https://github.com/iWuzHere) - **Imran Iqbal** &lt;imran@imraniqbal.org&gt; <add>* [JacksonTian](https://github.com/JacksonTian) - **Jackson Tian** &lt;shvyo1987@gmail.com&gt; <ide> * [jbergstroem](https://github.com/jbergstroem) - **Johan Bergström** &lt;bugs@bergstroem.nu&gt; <ide> * [joaocgreis](https://github.com/joaocgreis) - **João Reis** &lt;reis@janeasystems.com&gt; <ide> * [julianduque](https://github.com/julianduque) - **Julian Duque** &lt;julianduquej@gmail.com&gt;
1
PHP
PHP
improve error message
59fcd74c929da4bfa489d69f23652292c28ece8b
<ide><path>src/TestSuite/MiddlewareDispatcher.php <ide> public function __construct( <ide> $app = $reflect->newInstanceArgs($this->_constructorArgs); <ide> $this->app = $app; <ide> } catch (ReflectionException $e) { <del> throw new LogicException(sprintf('Cannot load "%s" for use in integration testing.', $this->_class)); <add> throw new LogicException("Cannot load `{$this->_class}` for use in integration testing.", null, $e); <ide> } <ide> } <ide>
1
Javascript
Javascript
fix bad boolean in professor-x
a173ddf375b5836d2e1c1cd0341d3ca7024bc4ce
<ide><path>common/app/utils/professor-x.js <ide> export default function contain(options = {}, Component) { <ide> ); <ide> <ide> const fetch$ = action.apply(null, actionArgs); <del> if (__DEV__ && Observable.isObservable(fetch$)) { <add> if (__DEV__ && !Observable.isObservable(fetch$)) { <ide> throw new Error( <ide> 'fetch action should return observable' <ide> );
1
Text
Text
fix indentation + remove blank line
9050f6ee0133e9088f914a77bb65108a89f49dfd
<ide><path>activesupport/CHANGELOG.md <ide> * Add default option to class_attribute. Before: <ide> <del> class_attribute :settings <del> self.settings = {} <add> class_attribute :settings <add> self.settings = {} <ide> <ide> Now: <ide> <del> class_attribute :settings, default: {} <add> class_attribute :settings, default: {} <ide> <ide> *DHH* <ide> <ide> <ide> * Add `ActiveSupport::CurrentAttributes` to provide a thread-isolated attributes singleton. <ide> Primary use case is keeping all the per-request attributes easily available to the whole system. <del> <add> <ide> *DHH* <ide> <ide> * Fix implicit coercion calculations with scalars and durations
1
Javascript
Javascript
remove unnecessary variable
9f793a715fd9033ae475d5d524733668b7492c91
<ide><path>src/scales/scale.time.js <ide> module.exports = function(Chart) { <ide> me.displayFormat = timeOpts.displayFormats[unit]; <ide> <ide> var stepSize = timeOpts.stepSize || determineStepSize(minTimestamp || dataMin, maxTimestamp || dataMax, unit, maxTicks); <del> var ticks = me.ticks = Chart.Ticks.generators.time({ <add> me.ticks = Chart.Ticks.generators.time({ <ide> maxTicks: maxTicks, <ide> min: minTimestamp, <ide> max: maxTimestamp, <ide> module.exports = function(Chart) { <ide> <ide> // At this point, we need to update our max and min given the tick values since we have expanded the <ide> // range of the scale <del> me.max = helpers.max(ticks); <del> me.min = helpers.min(ticks); <add> me.max = helpers.max(me.ticks); <add> me.min = helpers.min(me.ticks); <ide> }, <ide> // Get tooltip label <ide> getLabelForIndex: function(index, datasetIndex) {
1
Text
Text
fix outdated code sample in n-api.md
8b902500cddce129dda59f7d78b6bc8b62f13cb6
<ide><path>doc/api/n-api.md <ide> napi_status status = napi_status_generic_failure; <ide> <ide> // const obj = {}; <ide> napi_value obj; <del>status = napi_create_obj(env, &obj); <add>status = napi_create_object(env, &obj); <ide> if (status != napi_ok) return status; <ide> <ide> // Create napi_values for 123 and 456 <ide> status = napi_create_int32(env, 456, &barValue); <ide> if (status != napi_ok) return status; <ide> <ide> // Set the properties <del>napi_property_descriptors descriptors[] = { <del> { "foo", fooValue, 0, 0, 0, napi_default, 0 }, <del> { "bar", barValue, 0, 0, 0, napi_default, 0 } <add>napi_property_descriptor descriptors[] = { <add> { "foo", nullptr, 0, 0, 0, fooValue, napi_default, 0 }, <add> { "bar", nullptr, 0, 0, 0, barValue, napi_default, 0 } <ide> } <ide> status = napi_define_properties(env, <ide> obj,
1
Mixed
Java
remove unused rctdebugcomponentownership
8548ca09f14c237913e00a328409231a727b8572
<ide><path>Libraries/Core/InitializeCore.js <ide> if (__DEV__) { <ide> require('setupDevtools'); <ide> } <ide> <del> require('RCTDebugComponentOwnership'); <del> <ide> // Set up inspector <ide> const JSInspector = require('JSInspector'); <ide> JSInspector.registerAgent(require('NetworkAgent')); <ide><path>Libraries/DebugComponentHierarchy/RCTDebugComponentOwnership.js <del>/** <del> * Copyright (c) 2015-present, Facebook, Inc. <del> * All rights reserved. <del> * <del> * This source code is licensed under the BSD-style license found in the <del> * LICENSE file in the root directory of this source tree. An additional grant <del> * of patent rights can be found in the PATENTS file in the same directory. <del> * <del> * Utility class to provide the component owner hierarchy to native code for <del> * debugging purposes. <del> * <del> * @providesModule RCTDebugComponentOwnership <del> * @flow <del> */ <del> <del>'use strict'; <del> <del>var BatchedBridge = require('BatchedBridge'); <del> <del>var RCTDebugComponentOwnership = { <del> /** <del> * Asynchronously returns the owner hierarchy as an array of strings. Request id is <del> * passed along to the native module so that the native module can identify the <del> * particular call instance. <del> * <del> * Example returned owner hierarchy: ['RootView', 'Dialog', 'TitleView', 'Text'] <del> */ <del> getOwnerHierarchy: function(requestID: number, tag: number) { <del> // Consider cleaning up these unused modules in a separate diff. <del> throw new Error( <del> 'This seems to be unused. Will disable until it is needed again.' <del> ); <del> }, <del>}; <del> <del>BatchedBridge.registerCallableModule( <del> 'RCTDebugComponentOwnership', <del> RCTDebugComponentOwnership <del>); <del> <del>module.exports = RCTDebugComponentOwnership; <ide><path>ReactAndroid/src/main/java/com/facebook/react/CoreModulesPackage.java <ide> import com.facebook.react.uimanager.UIImplementationProvider; <ide> import com.facebook.react.uimanager.UIManagerModule; <ide> import com.facebook.react.uimanager.ViewManager; <del>import com.facebook.react.uimanager.debug.DebugComponentOwnershipModule; <ide> import com.facebook.systrace.Systrace; <ide> <ide> import static com.facebook.react.bridge.ReactMarkerConstants.CREATE_UI_MANAGER_MODULE_END; <ide> UIManagerModule.class, <ide> DeviceInfoModule.class, <ide> // Debug only <del> DebugComponentOwnershipModule.class, <ide> JSCHeapCapture.class, <ide> JSCSamplingProfiler.class, <ide> } <ide> public NativeModule get() { <ide> })); <ide> <ide> if (ReactBuildConfig.DEBUG) { <del> moduleSpecList.add( <del> new ModuleSpec(DebugComponentOwnershipModule.class, new Provider<NativeModule>() { <del> @Override <del> public NativeModule get() { <del> return new DebugComponentOwnershipModule(reactContext); <del> } <del> })); <ide> moduleSpecList.add( <ide> new ModuleSpec(JSCHeapCapture.class, new Provider<NativeModule>() { <ide> @Override <ide><path>ReactAndroid/src/main/java/com/facebook/react/DebugCorePackage.java <ide> import com.facebook.react.devsupport.JSCSamplingProfiler; <ide> import com.facebook.react.module.annotations.ReactModuleList; <ide> import com.facebook.react.module.model.ReactModuleInfoProvider; <del>import com.facebook.react.uimanager.debug.DebugComponentOwnershipModule; <ide> <ide> /** <ide> * Package defining core framework modules (e.g. UIManager). It should be used for modules that <ide> */ <ide> @ReactModuleList( <ide> nativeModules = { <del> DebugComponentOwnershipModule.class, <ide> JSCHeapCapture.class, <ide> JSCSamplingProfiler.class, <ide> } <ide> @Override <ide> public List<ModuleSpec> getNativeModules(final ReactApplicationContext reactContext) { <ide> List<ModuleSpec> moduleSpecList = new ArrayList<>(); <del> <del> moduleSpecList.add( <del> new ModuleSpec(DebugComponentOwnershipModule.class, new Provider<NativeModule>() { <del> @Override <del> public NativeModule get() { <del> return new DebugComponentOwnershipModule(reactContext); <del> } <del> })); <ide> moduleSpecList.add( <ide> new ModuleSpec(JSCHeapCapture.class, new Provider<NativeModule>() { <ide> @Override <ide><path>ReactAndroid/src/main/java/com/facebook/react/uimanager/debug/DebugComponentOwnershipModule.java <del>/** <del> * Copyright (c) 2015-present, Facebook, Inc. <del> * All rights reserved. <del> * <del> * This source code is licensed under the BSD-style license found in the <del> * LICENSE file in the root directory of this source tree. An additional grant <del> * of patent rights can be found in the PATENTS file in the same directory. <del> */ <del> <del>package com.facebook.react.uimanager.debug; <del> <del>import javax.annotation.Nullable; <del> <del>import android.util.SparseArray; <del> <del>import com.facebook.infer.annotation.Assertions; <del>import com.facebook.react.bridge.JSApplicationCausedNativeException; <del>import com.facebook.react.bridge.JavaScriptModule; <del>import com.facebook.react.bridge.ReactApplicationContext; <del>import com.facebook.react.bridge.ReactContextBaseJavaModule; <del>import com.facebook.react.bridge.ReactMethod; <del>import com.facebook.react.bridge.ReadableArray; <del>import com.facebook.react.module.annotations.ReactModule; <del> <del>/** <del> * Native module that can asynchronously request the owners hierarchy of a react tag. <del> * <del> * Example returned owner hierarchy: ['RootView', 'Dialog', 'TitleView', 'Text'] <del> */ <del>@ReactModule(name = "DebugComponentOwnershipModule") <del>public class DebugComponentOwnershipModule extends ReactContextBaseJavaModule { <del> <del> public interface RCTDebugComponentOwnership extends JavaScriptModule { <del> <del> void getOwnerHierarchy(int requestID, int tag); <del> } <del> <del> /** <del> * Callback for when we receive the ownership hierarchy in native code. <del> * <del> * NB: {@link #onOwnerHierarchyLoaded} will be called on the native modules thread! <del> */ <del> public static interface OwnerHierarchyCallback { <del> <del> void onOwnerHierarchyLoaded(int tag, @Nullable ReadableArray owners); <del> } <del> <del> private final SparseArray<OwnerHierarchyCallback> mRequestIdToCallback = new SparseArray<>(); <del> <del> private @Nullable RCTDebugComponentOwnership mRCTDebugComponentOwnership; <del> private int mNextRequestId = 0; <del> <del> public DebugComponentOwnershipModule(ReactApplicationContext reactContext) { <del> super(reactContext); <del> } <del> <del> @Override <del> public void initialize() { <del> super.initialize(); <del> mRCTDebugComponentOwnership = getReactApplicationContext(). <del> getJSModule(RCTDebugComponentOwnership.class); <del> } <del> <del> @Override <del> public void onCatalystInstanceDestroy() { <del> super.onCatalystInstanceDestroy(); <del> mRCTDebugComponentOwnership = null; <del> } <del> <del> @ReactMethod <del> public synchronized void receiveOwnershipHierarchy( <del> int requestId, <del> int tag, <del> @Nullable ReadableArray owners) { <del> OwnerHierarchyCallback callback = mRequestIdToCallback.get(requestId); <del> if (callback == null) { <del> throw new JSApplicationCausedNativeException( <del> "Got receiveOwnershipHierarchy for invalid request id: " + requestId); <del> } <del> mRequestIdToCallback.delete(requestId); <del> callback.onOwnerHierarchyLoaded(tag, owners); <del> } <del> <del> /** <del> * Request to receive the component hierarchy for a particular tag. <del> * <del> * Example returned owner hierarchy: ['RootView', 'Dialog', 'TitleView', 'Text'] <del> * <del> * NB: The callback provided will be invoked on the native modules thread! <del> */ <del> public synchronized void loadComponentOwnerHierarchy(int tag, OwnerHierarchyCallback callback) { <del> int requestId = mNextRequestId; <del> mNextRequestId++; <del> mRequestIdToCallback.put(requestId, callback); <del> Assertions.assertNotNull(mRCTDebugComponentOwnership).getOwnerHierarchy(requestId, tag); <del> } <del> <del> @Override <del> public String getName() { <del> return "DebugComponentOwnershipModule"; <del> } <del>}
5
PHP
PHP
apply fixes from styleci
715c7e101f11d979b52b2ef70858b24b57fff423
<ide><path>app/Http/Middleware/VerifyCsrfToken.php <ide> class VerifyCsrfToken extends Middleware <ide> protected $except = [ <ide> // <ide> ]; <del> <add> <ide> /** <ide> * Indicates whether the XSRF-TOKEN cookie should be set on the response. <ide> *
1
Javascript
Javascript
simplify pack layout
c5c6614d9eea6d7255e4bc20c26fcc47e5a64b96
<ide><path>d3.layout.js <ide> function d3_layout_hierarchySort(a, b) { <ide> } <ide> d3.layout.pack = function() { <ide> var hierarchy = d3.layout.hierarchy(), <del> separation = 1, // spacing <ide> size = [1, 1]; <del> radius = d3_layout_packRadius; <ide> <ide> function pack(d, i) { <ide> var nodes = hierarchy.call(this, d, i), <ide> root = nodes[0]; <ide> <del> d3_layout_packRadii(nodes, radius); <del> <del> /* Recursively compute the layout. */ <add> // Recursively compute the layout. <ide> root.x = 0; <ide> root.y = 0; <del> root.radius = d3_layout_packTree(root, separation); <add> d3_layout_packTree(root); <ide> <add> // Scale the layout to fit the requested size. <ide> var w = size[0], <ide> h = size[1], <del> k = 1 / Math.max(2 * root.radius / w, 2 * root.radius / h); <add> k = 1 / Math.max(2 * root.r / w, 2 * root.r / h); <ide> d3_layout_packTransform(root, w / 2, h / 2, k); <add> <ide> return nodes; <ide> } <ide> <ide> pack.sort = d3.rebind(pack, hierarchy.sort); <ide> pack.children = d3.rebind(pack, hierarchy.children); <ide> pack.value = d3.rebind(pack, hierarchy.value); <ide> <del> pack.separation = function(x) { <del> if (!arguments.length) return separation; <del> separation = x; <del> return pack; <del> }; <del> <ide> pack.size = function(x) { <ide> if (!arguments.length) return size; <ide> size = x; <ide> return pack; <ide> }; <ide> <del> pack.radius = function(x) { <del> if (!arguments.length) return radius; <del> radius = x; <del> return pack; <del> }; <del> <del> return pack; <add> return pack.sort(d3_layout_packSort); <ide> }; <ide> <del>function d3_layout_packRadius(d) { <del> return d.radius; <add>function d3_layout_packSort(a, b) { <add> return a.value - b.value; <add>} <add> <add>function d3_layout_packInsert(a, b) { <add> var c = a._pack_next; <add> a._pack_next = b; <add> b._pack_prev = a; <add> b._pack_next = c; <add> c._pack_prev = b; <add>} <add> <add>function d3_layout_packSplice(a, b) { <add> a._pack_next = b; <add> b._pack_prev = a; <ide> } <ide> <del>function d3_layout_packCircle(nodes, spacing) { <add>function d3_layout_packIntersects(a, b) { <add> var dx = b.x - a.x, <add> dy = b.y - a.y, <add> dr = a.r + b.r; <add> return (dr * dr - dx * dx - dy * dy) > .001; // within epsilon <add>} <add> <add>function d3_layout_packCircle(nodes) { <ide> var xMin = Infinity, <ide> xMax = -Infinity, <ide> yMin = Infinity, <ide> yMax = -Infinity, <add> n = nodes.length, <ide> a, b, c, j, k; <ide> <ide> function bound(n) { <del> xMin = Math.min(n.x - n.radius, xMin); <del> xMax = Math.max(n.x + n.radius, xMax); <del> yMin = Math.min(n.y - n.radius, yMin); <del> yMax = Math.max(n.y + n.radius, yMax); <del> } <del> <del> function insert(a, b) { <del> var c = a.n; <del> a.n = b; <del> b.p = a; <del> b.n = c; <del> c.p = b; <add> xMin = Math.min(n.x - n.r, xMin); <add> xMax = Math.max(n.x + n.r, xMax); <add> yMin = Math.min(n.y - n.r, yMin); <add> yMax = Math.max(n.y + n.r, yMax); <ide> } <ide> <del> function splice(a, b) { <del> a.n = b; <del> b.p = a; <del> } <add> // Create node links. <add> nodes.forEach(d3_layout_packLink); <ide> <del> function intersects(a, b) { <del> var dx = b.x - a.x, <del> dy = b.y - a.y, <del> dr = a.radius + b.radius; <del> return (dr * dr - dx * dx - dy * dy) > .001; // within epsilon <del> } <del> <del> /* Create first node. */ <add> // Create first node. <ide> a = nodes[0]; <del> a.x = -a.radius; <add> a.x = -a.r; <ide> a.y = 0; <ide> bound(a); <ide> <del> /* Create second node. */ <del> if (nodes.length > 1) { <add> // Create second node. <add> if (n > 1) { <ide> b = nodes[1]; <del> b.x = b.radius; <add> b.x = b.r; <ide> b.y = 0; <ide> bound(b); <ide> <del> /* Create third node and build chain. */ <del> if (nodes.length > 2) { <add> // Create third node and build chain. <add> if (n > 2) { <ide> c = nodes[2]; <ide> d3_layout_packPlace(a, b, c); <ide> bound(c); <del> insert(a, c); <del> a.p = c; <del> insert(c, b); <del> b = a.n; <add> d3_layout_packInsert(a, c); <add> a._pack_prev = c; <add> d3_layout_packInsert(c, b); <add> b = a._pack_next; <ide> <del> /* Now iterate through the rest. */ <del> for (var i = 3; i < nodes.length; i++) { <add> // Now iterate through the rest. <add> for (var i = 3; i < n; i++) { <ide> d3_layout_packPlace(a, b, c = nodes[i]); <ide> <del> /* Search for the closest intersection. */ <add> // Search for the closest intersection. <ide> var isect = 0, s1 = 1, s2 = 1; <del> for (j = b.n; j != b; j = j.n, s1++) { <del> if (intersects(j, c)) { <add> for (j = b._pack_next; j != b; j = j._pack_next, s1++) { <add> if (d3_layout_packIntersects(j, c)) { <ide> isect = 1; <ide> break; <ide> } <ide> } <ide> if (isect == 1) { <del> for (k = a.p; k != j.p; k = k.p, s2++) { <del> if (intersects(k, c)) { <add> for (k = a._pack_prev; k != j._pack_prev; k = k._pack_prev, s2++) { <add> if (d3_layout_packIntersects(k, c)) { <ide> if (s2 < s1) { <ide> isect = -1; <ide> j = k; <ide> function d3_layout_packCircle(nodes, spacing) { <ide> } <ide> } <ide> <del> /* Update node chain. */ <add> // Update node chain. <ide> if (isect == 0) { <del> insert(a, c); <add> d3_layout_packInsert(a, c); <ide> b = c; <ide> bound(c); <ide> } else if (isect > 0) { <del> splice(a, j); <add> d3_layout_packSplice(a, j); <ide> b = j; <ide> i--; <del> } else if (isect < 0) { <del> splice(j, b); <add> } else { // isect < 0 <add> d3_layout_packSplice(j, b); <ide> a = j; <ide> i--; <ide> } <ide> } <ide> } <ide> } <ide> <del> /* Re-center the circles and return the encompassing radius. */ <add> // Re-center the circles and return the encompassing radius. <ide> var cx = (xMin + xMax) / 2, <ide> cy = (yMin + yMax) / 2, <ide> cr = 0; <del> for (var i = 0; i < nodes.length; i++) { <del> var n = nodes[i]; <del> n.x -= cx; <del> n.y -= cy; <del> cr = Math.max(cr, n.radius + Math.sqrt(n.x * n.x + n.y * n.y)); <add> for (var i = 0; i < n; i++) { <add> var node = nodes[i]; <add> node.x -= cx; <add> node.y -= cy; <add> cr = Math.max(cr, node.r + Math.sqrt(node.x * node.x + node.y * node.y)); <ide> } <del> return cr + spacing; <add> <add> // Remove node links. <add> nodes.forEach(d3_layout_packUnlink); <add> <add> return cr; <add>} <add> <add>function d3_layout_packLink(node) { <add> node._pack_next = node._pack_prev = node; <add>} <add> <add>function d3_layout_packUnlink(node) { <add> delete node._pack_next; <add> delete node._pack_prev; <ide> } <ide> <del>function d3_layout_packTree(n, spacing) { <del> var nodes = [], <del> children = n.children; <add>function d3_layout_packTree(node) { <add> var children = node.children; <ide> if (children) { <del> for (var i = 0, l = children.length; i < l; i++) { <del> var c = children[i]; <del> if (c.children) c.radius = d3_layout_packTree(c, spacing); <del> c.n = c.p = c; <del> nodes.push(c); <del> } <add> children.forEach(d3_layout_packTree); <add> node.r = d3_layout_packCircle(children); <add> } else { <add> node.r = Math.sqrt(node.value); <ide> } <del> return d3_layout_packCircle(nodes, spacing); <ide> } <ide> <del>function d3_layout_packTransform(n, x, y, k) { <del> var children = n.children; <add>function d3_layout_packTransform(node, x, y, k) { <add> var children = node.children; <add> node.x = (x += k * node.x); <add> node.y = (y += k * node.y); <add> node.r *= k; <ide> if (children) { <del> for (var i = 0, l = children.length; i < l; i++) { <del> var c = children[i]; <del> c.x += n.x; <del> c.y += n.y; <del> d3_layout_packTransform(c, x, y, k); <del> } <add> var i = -1, n = children.length; <add> while (++i < n) d3_layout_packTransform(children[i], x, y, k); <ide> } <del> n.x = x + k * n.x; <del> n.y = y + k * n.y; <del> n.radius *= k; <ide> } <ide> <ide> function d3_layout_packPlace(a, b, c) { <del> var da = b.radius + c.radius, <del> db = a.radius + c.radius, <add> var da = b.r + c.r, <add> db = a.r + c.r, <ide> dx = b.x - a.x, <ide> dy = b.y - a.y, <ide> dc = Math.sqrt(dx * dx + dy * dy), <ide> function d3_layout_packPlace(a, b, c) { <ide> c.x = a.x + x * dx + h * dy; <ide> c.y = a.y + x * dy - h * dx; <ide> } <del> <del>// Computes the radii of the leaf nodes. <del>// TODO (from Protovis version): <del>// Is it possible for spacing to operate in pixel space? <del>// Right now it appears to be multiples of the smallest radius. <del>function d3_layout_packRadii(nodes, radius) { <del> for (var i = 0, n = nodes.length; i < n; i++) { <del> var c = nodes[i]; <del> if (!c.children) { <del> c.radius = radius.call(this, c, i); <del> } <del> } <del>} <ide> // Node-link tree diagram using the Reingold-Tilford "tidy" algorithm <ide> d3.layout.tree = function() { <ide> var hierarchy = d3.layout.hierarchy(), <ide><path>d3.layout.min.js <del>(function(){function z(a,b,c){return a._tree.ancestor.parent==b.parent?a._tree.ancestor:c}function y(a,b,c){a=a._tree,b=b._tree;var d=c/(b.number-a.number);a.change+=d,b.change-=d,b.shift+=c,b.prelim+=c,b.mod+=c}function x(a){var b=0,c=0,d=a.children,e=d.length,f;while(--e>=0)f=d[e]._tree,f.prelim+=b,f.mod+=b,b+=f.shift+(c+=f.change)}function w(a,b){function c(a,d){var e=a.children;if(e){var f,g=null,h=-1,i=e.length;while(++h<i)f=e[h],c(f,g),g=f}b(a,d)}c(a,null)}function v(a,b){return a.depth-b.depth}function u(a,b){return b.x-a.x}function t(a,b){return a.x-b.x}function s(a,b){var c=a.children;if(c){var d,e=c.length,f=-1;while(++f<e)b(d=s(c[f],b),a)>0&&(a=d)}return a}function r(a){return a.children?a.children[a.children.length-1]:a._tree.thread}function q(a){return a.children?a.children[0]:a._tree.thread}function p(a,b){return a.parent==b.parent?1:2}function o(a,b){for(var c=0,d=a.length;c<d;c++){var e=a[c];e.children||(e.radius=b.call(this,e,c))}}function n(a,b,c){var d=b.radius+c.radius,e=a.radius+c.radius,f=b.x-a.x,g=b.y-a.y,h=Math.sqrt(f*f+g*g),i=(e*e+h*h-d*d)/(2*e*h),j=Math.acos(i),k=i*e,l=Math.sin(j)*e;f/=h,g/=h,c.x=a.x+k*f+l*g,c.y=a.y+k*g-l*f}function m(a,b,c,d){var e=a.children;if(e)for(var f=0,g=e.length;f<g;f++){var h=e[f];h.x+=a.x,h.y+=a.y,m(h,b,c,d)}a.x=b+d*a.x,a.y=c+d*a.y,a.radius*=d}function l(a,b){var c=[],d=a.children;if(d)for(var e=0,f=d.length;e<f;e++){var g=d[e];g.children&&(g.radius=l(g,b)),g.n=g.p=g,c.push(g)}return k(c,b)}function k(a,b){function p(a,b){var c=b.x-a.x,d=b.y-a.y,e=a.radius+b.radius;return e*e-c*c-d*d>.001}function o(a,b){a.n=b,b.p=a}function m(a,b){var c=a.n;a.n=b,b.p=a,b.n=c,c.p=b}function l(a){c=Math.min(a.x-a.radius,c),d=Math.max(a.x+a.radius,d),e=Math.min(a.y-a.radius,e),f=Math.max(a.y+a.radius,f)}var c=Infinity,d=-Infinity,e=Infinity,f=-Infinity,g,h,i,j,k;g=a[0],g.x=-g.radius,g.y=0,l(g);if(a.length>1){h=a[1],h.x=h.radius,h.y=0,l(h);if(a.length>2){i=a[2],n(g,h,i),l(i),m(g,i),g.p=i,m(i,h),h=g.n;for(var q=3;q<a.length;q++){n(g,h,i=a[q]);var r=0,s=1,t=1;for(j=h.n;j!=h;j=j.n,s++)if(p(j,i)){r=1;break}if(r==1)for(k=g.p;k!=j.p;k=k.p,t++)if(p(k,i)){t<s&&(r=-1,j=k);break}r==0?(m(g,i),h=i,l(i)):r>0?(o(g,j),h=j,q--):r<0&&(o(j,h),g=j,q--)}}}var u=(c+d)/2,v=(e+f)/2,w=0;for(var q=0;q<a.length;q++){var x=a[q];x.x-=u,x.y-=v,w=Math.max(w,x.radius+Math.sqrt(x.x*x.x+x.y*x.y))}return w+b}function j(a){return a.radius}function i(a,b){return b.value-a.value}function h(a){return a.value}function g(a){return a.children}function f(a,b){return a+b.y}function e(a){var b=1,c=0,d=a[0].y,e,f=a.length;for(;b<f;++b)(e=a[b].y)>d&&(c=b,d=e);return c}function c(a){return a.reduce(f,0)}d3.layout={},d3.layout.chord=function(){function k(){b.sort(function(a,b){a=Math.min(a.source.value,a.target.value),b=Math.min(b.source.value,b.target.value);return i(a,b)})}function j(){var a={},j=[],l=d3.range(e),m=[],n,o,p,q,r;b=[],c=[],n=0,q=-1;while(++q<e){o=0,r=-1;while(++r<e)o+=d[q][r];j.push(o),m.push(d3.range(e)),n+=o}g&&l.sort(function(a,b){return g(j[a],j[b])}),h&&m.forEach(function(a,b){a.sort(function(a,c){return h(d[b][a],d[b][c])})}),n=(2*Math.PI-f*e)/n,o=0,q=-1;while(++q<e){p=o,r=-1;while(++r<e){var s=l[q],t=m[q][r],u=d[s][t];a[s+"-"+t]={index:s,subindex:t,startAngle:o,endAngle:o+=u*n,value:u}}c.push({index:s,startAngle:p,endAngle:o,value:(o-p)/n}),o+=f}q=-1;while(++q<e){r=q-1;while(++r<e){var v=a[q+"-"+r],w=a[r+"-"+q];(v.value||w.value)&&b.push({source:v,target:w})}}i&&k()}var a={},b,c,d,e,f=0,g,h,i;a.matrix=function(f){if(!arguments.length)return d;e=(d=f)&&d.length,b=c=null;return a},a.padding=function(d){if(!arguments.length)return f;f=d,b=c=null;return a},a.sortGroups=function(d){if(!arguments.length)return g;g=d,b=c=null;return a},a.sortSubgroups=function(c){if(!arguments.length)return h;h=c,b=null;return a},a.sortChords=function(c){if(!arguments.length)return i;i=c,b&&k();return a},a.chords=function(){b||j();return b},a.groups=function(){c||j();return c};return a},d3.layout.force=function(){function j(){var a=i.length,c,f,g,h,j,k,l;for(c=0;c<a;++c){f=i[c],g=f.source,h=f.target,k=h.x-g.x,l=h.y-g.y;if(j=Math.sqrt(k*k+l*l))j=d/(f.distance*f.distance)*(j-e*f.distance)/j,k*=j,l*=j,h.fixed||(h.x-=k,h.y-=l),g.fixed||(g.x+=k,g.y+=l)}b.tick.dispatch({type:"tick"});return(d*=.99)<.005}var a={},b=d3.dispatch("tick"),c=[1,1],d=.5,e=30,f,g,h,i;a.on=function(c,d){b[c].add(d);return a},a.nodes=function(b){if(!arguments.length)return g;g=b;return a},a.links=function(b){if(!arguments.length)return h;h=b;return a},a.size=function(b){if(!arguments.length)return c;c=b;return a},a.distance=function(b){if(!arguments.length)return e;e=b;return a},a.start=function(){var b,d,e,f=g.length,k=h.length,l=c[0],m=c[1],n,o=[];for(b=0;b<f;++b){n=g[b],n.x=n.x||Math.random()*l,n.y=n.y||Math.random()*m,n.fixed=0,o[b]=[];for(d=0;d<f;++d)o[b][d]=Infinity;o[b][b]=0}for(b=0;b<k;++b)n=h[b],o[n.source][n.target]=1,o[n.target][n.source]=1,n.source=g[n.source],n.target=g[n.target];for(e=0;e<f;++e)for(b=0;b<f;++b)for(d=0;d<f;++d)o[b][d]=Math.min(o[b][d],o[b][e]+o[e][d]);i=[];for(b=0;b<f;++b)for(d=b+1;d<f;++d)i.push({source:g[b],target:g[d],distance:o[b][d]*o[b][d]});i.sort(function(a,b){return a.distance-b.distance}),d3.timer(j);return a},a.resume=function(){d=.1,d3.timer(j);return a},a.stop=function(){d=0;return a},a.drag=function(){function f(){!b||(e(),b.fixed=!1,b=c=null)}function e(){if(!!b){var d=d3.svg.mouse(c);b.x=d[0],b.y=d[1],a.resume()}}function d(a){(b=a).fixed=!0,c=this,d3.event.preventDefault()}var b,c;this.on("mouseover",function(a){a.fixed=!0}).on("mouseout",function(a){a!=b&&(a.fixed=!1)}).on("mousedown",d),d3.select(window).on("mousemove",e).on("mouseup",f);return a};return a},d3.layout.partition=function(){function e(e,f){var g=a.call(this,e,f);c(g[0],0,b[0],b[1]/d(g[0]));return g}function d(a){var b=a.children,c=0;if(b){var e=-1,f=b.length;while(++e<f)c=Math.max(c,d(b[e]))}return 1+c}function c(a,b,d,e){var f=a.children;a.x=b,a.y=a.depth*e,a.dx=d,a.dy=e;if(f){var g=-1,h=f.length,i,j;d/=a.value;while(++g<h)c(i=f[g],b,j=i.value*d,e),b+=j}}var a=d3.layout.hierarchy(),b=[1,1];e.sort=d3.rebind(e,a.sort),e.children=d3.rebind(e,a.children),e.value=d3.rebind(e,a.value),e.size=function(a){if(!arguments.length)return b;b=a;return e};return e},d3.layout.pie=function(){function f(f,g){var h=+(typeof c=="function"?c.apply(this,arguments):c),i=(typeof e=="function"?e.apply(this,arguments):e)-c,j=d3.range(f.length);b!=null&&j.sort(function(a,c){return b(f[a],f[c])});var k=f.map(a);i/=k.reduce(function(a,b){return a+b},0);var l=j.map(function(a){return{value:d=k[a],startAngle:h,endAngle:h+=d*i}});return f.map(function(a,b){return l[j[b]]})}var a=Number,b=null,c=0,e=2*Math.PI;f.value=function(b){if(!arguments.length)return a;a=b;return f},f.sort=function(a){if(!arguments.length)return b;b=a;return f},f.startAngle=function(a){if(!arguments.length)return c;c=a;return f},f.endAngle=function(a){if(!arguments.length)return e;e=a;return f};return f},d3.layout.stack=function(){function e(e){var f=e.length,g=e[0].length,h,i,j,k=a[c](e);b[d](e,k);for(i=0;i<g;++i)for(h=1,j=e[k[0]][i].y0;h<f;++h)e[k[h]][i].y0=j+=e[k[h-1]][i].y;return e}var c="default",d="zero";e.order=function(a){if(!arguments.length)return c;c=a;return e},e.offset=function(a){if(!arguments.length)return d;d=a;return e};return e};var a={"inside-out":function(a){var b=a.length,d,f,g=a.map(e),h=a.map(c),i=d3.range(b).sort(function(a,b){return g[a]-g[b]}),j=0,k=0,l=[],m=[];for(d=0;d<b;d++)f=i[d],j<k?(j+=h[f],l.push(f)):(k+=h[f],m.push(f));return m.reverse().concat(l)},reverse:function(a){return d3.range(a.length).reverse()},"default":function(a){return d3.range(a.length)}},b={silhouette:function(a,b){var c=a.length,d=a[0].length,e=[],f=0,g,h,i;for(h=0;h<d;++h){for(g=0,i=0;g<c;g++)i+=a[g][h].y;i>f&&(f=i),e.push(i)}for(h=0,g=b[0];h<d;++h)a[g][h].y0=(f-e[h])/2},wiggle:function(a,b){var c=a.length,d=a[0],e=d.length,f=0,g,h,i,j,k,l=b[0],m,n,o,p,q,r;a[l][0].y0=q=r=0;for(h=1;h<e;++h){for(g=0,m=0;g<c;++g)m+=a[g][h].y;for(g=0,n=0,p=d[h].x-d[h-1].x;g<c;++g){for(i=0,j=b[g],o=(a[j][h].y-a[j][h-1].y)/(2*p);i<g;++i)o+=(a[k=b[i]][h].y-a[k][h-1].y)/p;n+=o*a[j][h].y}a[l][h].y0=q-=m?n/m*p:0,q<r&&(r=q)}for(h=0;h<e;++h)a[l][h].y0-=r},zero:function(a,b){var c=0,d=a[0].length,e=b[0];for(;c<d;++c)a[e][c].y0=0}};d3.layout.hierarchy=function(){function j(a){var b=[];e(a,0,b);return b}function f(a,b){var d=a.children,e=0;if(d){var g=-1,h=d.length,i=b+1;while(++g<h)e+=f(d[g],i)}else e=c.call(j,a.data,b);return a.value=e}function e(f,g,h){var i=b.call(j,f,g),k={depth:g,data:f};h.push(k);if(i){var l=-1,m=i.length,n=k.children=[],o=0,p=g+1;while(++l<m)d=e(i[l],p,h),d.value>0&&(n.push(d),o+=d.value,d.parent=k);a&&n.sort(a),k.value=o}else k.value=c.call(j,f,g);return k}var a=i,b=g,c=h;j.sort=function(b){if(!arguments.length)return a;a=b;return j},j.children=function(a){if(!arguments.length)return b;b=a;return j},j.value=function(a){if(!arguments.length)return c;c=a;return j},j.revalue=function(a){f(a,0);return a};return j},d3.layout.pack=function(){function d(d,e){var f=a.call(this,d,e),g=f[0];o(f,radius),g.x=0,g.y=0,g.radius=l(g,b);var h=c[0],i=c[1],j=1/Math.max(2*g.radius/h,2*g.radius/i);m(g,h/2,i/2,j);return f}var a=d3.layout.hierarchy(),b=1,c=[1,1];radius=j,d.sort=d3.rebind(d,a.sort),d.children=d3.rebind(d,a.children),d.value=d3.rebind(d,a.value),d.separation=function(a){if(!arguments.length)return b;b=a;return d},d.size=function(a){if(!arguments.length)return c;c=a;return d},d.radius=function(a){if(!arguments.length)return radius;radius=a;return d};return d},d3.layout.tree=function(){function d(d,e){function j(a,c,d){if(c){var e=a,f=a,g=c,h=a.parent.children[0],i=e._tree.mod,j=f._tree.mod,k=g._tree.mod,l=h._tree.mod,m;while(g=r(g),e=q(e),g&&e)h=q(h),f=r(f),f._tree.ancestor=a,m=g._tree.prelim+k-e._tree.prelim-i+b(g,e),m>0&&(y(z(g,a,d),a,m),i+=m,j+=m),k+=g._tree.mod,i+=e._tree.mod,l+=h._tree.mod,j+=f._tree.mod;g&&!r(f)&&(f._tree.thread=g,f._tree.mod+=k-j),e&&!q(h)&&(h._tree.thread=e,h._tree.mod+=i-l,d=a)}return d}function i(a,b){a.x=a._tree.prelim+b;var c=a.children;if(c){var d=-1,e=c.length;b+=a._tree.mod;while(++d<e)i(c[d],b)}}function h(a,c){var d=a.children,e=a._tree;if(d){var f=d.length,g=d[0],i,k=g,l,m=-1;while(++m<f)l=d[m],h(l,i),k=j(l,i,k),i=l;x(a);var n=.5*(g._tree.prelim+l._tree.prelim);c?(e.prelim=c._tree.prelim+b(a,c),e.mod=e.prelim-n):e.prelim=n}else c&&(e.prelim=c._tree.prelim+b(a,c))}var f=a.call(this,d,e),g=f[0];w(g,function(a,b){a._tree={ancestor:a,prelim:0,mod:0,change:0,shift:0,number:b?b._tree.number+1:0}}),h(g),i(g,-g._tree.prelim);var k=s(g,u),l=s(g,t),m=s(g,v),n=k.x-b(k,l)/2,o=l.x+b(l,k)/2,p=m.depth;w(g,function(a){a.x=(a.x-n)/(o-n)*c[0],a.y=a.depth/p*c[1],delete a._tree});return f}var a=d3.layout.hierarchy(),b=p,c=[1,1];d.sort=d3.rebind(d,a.sort),d.children=d3.rebind(d,a.children),d.value=d3.rebind(d,a.value),d.separation=function(a){if(!arguments.length)return b;b=a;return d},d.size=function(a){if(!arguments.length)return c;c=a;return d};return d},d3.layout.treemap=function(){function k(b){var i=e||a(b),j=i[0];j.x=0,j.y=0,j.dx=c[0],j.dy=c[1],e&&a.revalue(j),f(j,c[0]*c[1]/j.value),(e?h:g)(j),d&&(e=i);return i}function j(a,c,d,e){var f=-1,g=a.length,h=d.x,i=d.y,j=c?b(a.area/c):0,k;if(c==d.dx){if(e||j>d.dy)j=d.dy;while(++f<g)k=a[f],k.x=h,k.y=i,k.dy=j,h+=k.dx=b(k.area/j);k.z=!0,k.dx+=d.x+d.dx-h,d.y+=j,d.dy-=j}else{if(e||j>d.dx)j=d.dx;while(++f<g)k=a[f],k.x=h,k.y=i,k.dx=j,i+=k.dy=b(k.area/j);k.z=!1,k.dy+=d.y+d.dy-i,d.x+=j,d.dx-=j}}function i(a,b){var c=a.area,d,e=0,f=Infinity,g=-1,h=a.length;while(++g<h)d=a[g].area,d<f&&(f=d),d>e&&(e=d);c*=c,b*=b;return Math.max(b*e/c,c/(b*f))}function h(a){if(!!a.children){var b={x:a.x,y:a.y,dx:a.dx,dy:a.dy},c=a.children.slice(),d,e=[];e.area=0;while(d=c.pop())e.push(d),e.area+=d.area,d.z!=null&&(j(e,d.z?b.dx:b.dy,b,!c.length),e.length=e.area=0);a.children.forEach(h)}}function g(a){if(!!a.children){var b={x:a.x,y:a.y,dx:a.dx,dy:a.dy},c=[],d=a.children.slice(),e,f=Infinity,h,k=Math.min(b.dx,b.dy),l;c.area=0;while((l=d.length)>0)c.push(e=d[l-1]),c.area+=e.area,(h=i(c,k))<=f?(d.pop(),f=h):(c.area-=c.pop().area,j(c,k,b,!1),k=Math.min(b.dx,b.dy),c.length=c.area=0,f=Infinity);c.length&&(j(c,k,b,!0),c.length=c.area=0),a.children.forEach(g)}}function f(a,b){var c=a.children;a.area=a.value*b;if(c){var d=-1,e=c.length;while(++d<e)f(c[d],b)}}var a=d3.layout.hierarchy(),b=Math.round,c=[1,1],d=!1,e;k.sort=d3.rebind(k,a.sort),k.children=d3.rebind(k,a.children),k.value=d3.rebind(k,a.value),k.size=function(a){if(!arguments.length)return c;c=a;return k},k.round=function(a){if(!arguments.length)return b!=Number;b=a?Math.round:Number;return k},k.sticky=function(a){if(!arguments.length)return d;d=a,e=null;return k};return k}})() <ide>\ No newline at end of file <add>(function(){function D(a,b,c){return a._tree.ancestor.parent==b.parent?a._tree.ancestor:c}function C(a,b,c){a=a._tree,b=b._tree;var d=c/(b.number-a.number);a.change+=d,b.change-=d,b.shift+=c,b.prelim+=c,b.mod+=c}function B(a){var b=0,c=0,d=a.children,e=d.length,f;while(--e>=0)f=d[e]._tree,f.prelim+=b,f.mod+=b,b+=f.shift+(c+=f.change)}function A(a,b){function c(a,d){var e=a.children;if(e){var f,g=null,h=-1,i=e.length;while(++h<i)f=e[h],c(f,g),g=f}b(a,d)}c(a,null)}function z(a,b){return a.depth-b.depth}function y(a,b){return b.x-a.x}function x(a,b){return a.x-b.x}function w(a,b){var c=a.children;if(c){var d,e=c.length,f=-1;while(++f<e)b(d=w(c[f],b),a)>0&&(a=d)}return a}function v(a){return a.children?a.children[a.children.length-1]:a._tree.thread}function u(a){return a.children?a.children[0]:a._tree.thread}function t(a,b){return a.parent==b.parent?1:2}function s(a,b,c){var d=b.r+c.r,e=a.r+c.r,f=b.x-a.x,g=b.y-a.y,h=Math.sqrt(f*f+g*g),i=(e*e+h*h-d*d)/(2*e*h),j=Math.acos(i),k=i*e,l=Math.sin(j)*e;f/=h,g/=h,c.x=a.x+k*f+l*g,c.y=a.y+k*g-l*f}function r(a,b,c,d){var e=a.children;a.x=b+=d*a.x,a.y=c+=d*a.y,a.r*=d;if(e){var f=-1,g=e.length;while(++f<g)r(e[f],b,c,d)}}function q(a){var b=a.children;b?(b.forEach(q),a.r=n(b)):a.r=Math.sqrt(a.value)}function p(a){delete a._pack_next,delete a._pack_prev}function o(a){a._pack_next=a._pack_prev=a}function n(a){function q(a){b=Math.min(a.x-a.r,b),c=Math.max(a.x+a.r,c),d=Math.min(a.y-a.r,d),e=Math.max(a.y+a.r,e)}var b=Infinity,c=-Infinity,d=Infinity,e=-Infinity,f=a.length,g,h,i,j,n;a.forEach(o),g=a[0],g.x=-g.r,g.y=0,q(g);if(f>1){h=a[1],h.x=h.r,h.y=0,q(h);if(f>2){i=a[2],s(g,h,i),q(i),k(g,i),g._pack_prev=i,k(i,h),h=g._pack_next;for(var r=3;r<f;r++){s(g,h,i=a[r]);var t=0,u=1,v=1;for(j=h._pack_next;j!=h;j=j._pack_next,u++)if(m(j,i)){t=1;break}if(t==1)for(n=g._pack_prev;n!=j._pack_prev;n=n._pack_prev,v++)if(m(n,i)){v<u&&(t=-1,j=n);break}t==0?(k(g,i),h=i,q(i)):t>0?(l(g,j),h=j,r--):(l(j,h),g=j,r--)}}}var w=(b+c)/2,x=(d+e)/2,y=0;for(var r=0;r<f;r++){var z=a[r];z.x-=w,z.y-=x,y=Math.max(y,z.r+Math.sqrt(z.x*z.x+z.y*z.y))}a.forEach(p);return y}function m(a,b){var c=b.x-a.x,d=b.y-a.y,e=a.r+b.r;return e*e-c*c-d*d>.001}function l(a,b){a._pack_next=b,b._pack_prev=a}function k(a,b){var c=a._pack_next;a._pack_next=b,b._pack_prev=a,b._pack_next=c,c._pack_prev=b}function j(a,b){return a.value-b.value}function i(a,b){return b.value-a.value}function h(a){return a.value}function g(a){return a.children}function f(a,b){return a+b.y}function e(a){var b=1,c=0,d=a[0].y,e,f=a.length;for(;b<f;++b)(e=a[b].y)>d&&(c=b,d=e);return c}function c(a){return a.reduce(f,0)}d3.layout={},d3.layout.chord=function(){function k(){b.sort(function(a,b){a=Math.min(a.source.value,a.target.value),b=Math.min(b.source.value,b.target.value);return i(a,b)})}function j(){var a={},j=[],l=d3.range(e),m=[],n,o,p,q,r;b=[],c=[],n=0,q=-1;while(++q<e){o=0,r=-1;while(++r<e)o+=d[q][r];j.push(o),m.push(d3.range(e)),n+=o}g&&l.sort(function(a,b){return g(j[a],j[b])}),h&&m.forEach(function(a,b){a.sort(function(a,c){return h(d[b][a],d[b][c])})}),n=(2*Math.PI-f*e)/n,o=0,q=-1;while(++q<e){p=o,r=-1;while(++r<e){var s=l[q],t=m[q][r],u=d[s][t];a[s+"-"+t]={index:s,subindex:t,startAngle:o,endAngle:o+=u*n,value:u}}c.push({index:s,startAngle:p,endAngle:o,value:(o-p)/n}),o+=f}q=-1;while(++q<e){r=q-1;while(++r<e){var v=a[q+"-"+r],w=a[r+"-"+q];(v.value||w.value)&&b.push({source:v,target:w})}}i&&k()}var a={},b,c,d,e,f=0,g,h,i;a.matrix=function(f){if(!arguments.length)return d;e=(d=f)&&d.length,b=c=null;return a},a.padding=function(d){if(!arguments.length)return f;f=d,b=c=null;return a},a.sortGroups=function(d){if(!arguments.length)return g;g=d,b=c=null;return a},a.sortSubgroups=function(c){if(!arguments.length)return h;h=c,b=null;return a},a.sortChords=function(c){if(!arguments.length)return i;i=c,b&&k();return a},a.chords=function(){b||j();return b},a.groups=function(){c||j();return c};return a},d3.layout.force=function(){function j(){var a=i.length,c,f,g,h,j,k,l;for(c=0;c<a;++c){f=i[c],g=f.source,h=f.target,k=h.x-g.x,l=h.y-g.y;if(j=Math.sqrt(k*k+l*l))j=d/(f.distance*f.distance)*(j-e*f.distance)/j,k*=j,l*=j,h.fixed||(h.x-=k,h.y-=l),g.fixed||(g.x+=k,g.y+=l)}b.tick.dispatch({type:"tick"});return(d*=.99)<.005}var a={},b=d3.dispatch("tick"),c=[1,1],d=.5,e=30,f,g,h,i;a.on=function(c,d){b[c].add(d);return a},a.nodes=function(b){if(!arguments.length)return g;g=b;return a},a.links=function(b){if(!arguments.length)return h;h=b;return a},a.size=function(b){if(!arguments.length)return c;c=b;return a},a.distance=function(b){if(!arguments.length)return e;e=b;return a},a.start=function(){var b,d,e,f=g.length,k=h.length,l=c[0],m=c[1],n,o=[];for(b=0;b<f;++b){n=g[b],n.x=n.x||Math.random()*l,n.y=n.y||Math.random()*m,n.fixed=0,o[b]=[];for(d=0;d<f;++d)o[b][d]=Infinity;o[b][b]=0}for(b=0;b<k;++b)n=h[b],o[n.source][n.target]=1,o[n.target][n.source]=1,n.source=g[n.source],n.target=g[n.target];for(e=0;e<f;++e)for(b=0;b<f;++b)for(d=0;d<f;++d)o[b][d]=Math.min(o[b][d],o[b][e]+o[e][d]);i=[];for(b=0;b<f;++b)for(d=b+1;d<f;++d)i.push({source:g[b],target:g[d],distance:o[b][d]*o[b][d]});i.sort(function(a,b){return a.distance-b.distance}),d3.timer(j);return a},a.resume=function(){d=.1,d3.timer(j);return a},a.stop=function(){d=0;return a},a.drag=function(){function f(){!b||(e(),b.fixed=!1,b=c=null)}function e(){if(!!b){var d=d3.svg.mouse(c);b.x=d[0],b.y=d[1],a.resume()}}function d(a){(b=a).fixed=!0,c=this,d3.event.preventDefault()}var b,c;this.on("mouseover",function(a){a.fixed=!0}).on("mouseout",function(a){a!=b&&(a.fixed=!1)}).on("mousedown",d),d3.select(window).on("mousemove",e).on("mouseup",f);return a};return a},d3.layout.partition=function(){function e(e,f){var g=a.call(this,e,f);c(g[0],0,b[0],b[1]/d(g[0]));return g}function d(a){var b=a.children,c=0;if(b){var e=-1,f=b.length;while(++e<f)c=Math.max(c,d(b[e]))}return 1+c}function c(a,b,d,e){var f=a.children;a.x=b,a.y=a.depth*e,a.dx=d,a.dy=e;if(f){var g=-1,h=f.length,i,j;d/=a.value;while(++g<h)c(i=f[g],b,j=i.value*d,e),b+=j}}var a=d3.layout.hierarchy(),b=[1,1];e.sort=d3.rebind(e,a.sort),e.children=d3.rebind(e,a.children),e.value=d3.rebind(e,a.value),e.size=function(a){if(!arguments.length)return b;b=a;return e};return e},d3.layout.pie=function(){function f(f,g){var h=+(typeof c=="function"?c.apply(this,arguments):c),i=(typeof e=="function"?e.apply(this,arguments):e)-c,j=d3.range(f.length);b!=null&&j.sort(function(a,c){return b(f[a],f[c])});var k=f.map(a);i/=k.reduce(function(a,b){return a+b},0);var l=j.map(function(a){return{value:d=k[a],startAngle:h,endAngle:h+=d*i}});return f.map(function(a,b){return l[j[b]]})}var a=Number,b=null,c=0,e=2*Math.PI;f.value=function(b){if(!arguments.length)return a;a=b;return f},f.sort=function(a){if(!arguments.length)return b;b=a;return f},f.startAngle=function(a){if(!arguments.length)return c;c=a;return f},f.endAngle=function(a){if(!arguments.length)return e;e=a;return f};return f},d3.layout.stack=function(){function e(e){var f=e.length,g=e[0].length,h,i,j,k=a[c](e);b[d](e,k);for(i=0;i<g;++i)for(h=1,j=e[k[0]][i].y0;h<f;++h)e[k[h]][i].y0=j+=e[k[h-1]][i].y;return e}var c="default",d="zero";e.order=function(a){if(!arguments.length)return c;c=a;return e},e.offset=function(a){if(!arguments.length)return d;d=a;return e};return e};var a={"inside-out":function(a){var b=a.length,d,f,g=a.map(e),h=a.map(c),i=d3.range(b).sort(function(a,b){return g[a]-g[b]}),j=0,k=0,l=[],m=[];for(d=0;d<b;d++)f=i[d],j<k?(j+=h[f],l.push(f)):(k+=h[f],m.push(f));return m.reverse().concat(l)},reverse:function(a){return d3.range(a.length).reverse()},"default":function(a){return d3.range(a.length)}},b={silhouette:function(a,b){var c=a.length,d=a[0].length,e=[],f=0,g,h,i;for(h=0;h<d;++h){for(g=0,i=0;g<c;g++)i+=a[g][h].y;i>f&&(f=i),e.push(i)}for(h=0,g=b[0];h<d;++h)a[g][h].y0=(f-e[h])/2},wiggle:function(a,b){var c=a.length,d=a[0],e=d.length,f=0,g,h,i,j,k,l=b[0],m,n,o,p,q,r;a[l][0].y0=q=r=0;for(h=1;h<e;++h){for(g=0,m=0;g<c;++g)m+=a[g][h].y;for(g=0,n=0,p=d[h].x-d[h-1].x;g<c;++g){for(i=0,j=b[g],o=(a[j][h].y-a[j][h-1].y)/(2*p);i<g;++i)o+=(a[k=b[i]][h].y-a[k][h-1].y)/p;n+=o*a[j][h].y}a[l][h].y0=q-=m?n/m*p:0,q<r&&(r=q)}for(h=0;h<e;++h)a[l][h].y0-=r},zero:function(a,b){var c=0,d=a[0].length,e=b[0];for(;c<d;++c)a[e][c].y0=0}};d3.layout.hierarchy=function(){function j(a){var b=[];e(a,0,b);return b}function f(a,b){var d=a.children,e=0;if(d){var g=-1,h=d.length,i=b+1;while(++g<h)e+=f(d[g],i)}else e=c.call(j,a.data,b);return a.value=e}function e(f,g,h){var i=b.call(j,f,g),k={depth:g,data:f};h.push(k);if(i){var l=-1,m=i.length,n=k.children=[],o=0,p=g+1;while(++l<m)d=e(i[l],p,h),d.value>0&&(n.push(d),o+=d.value,d.parent=k);a&&n.sort(a),k.value=o}else k.value=c.call(j,f,g);return k}var a=i,b=g,c=h;j.sort=function(b){if(!arguments.length)return a;a=b;return j},j.children=function(a){if(!arguments.length)return b;b=a;return j},j.value=function(a){if(!arguments.length)return c;c=a;return j},j.revalue=function(a){f(a,0);return a};return j},d3.layout.pack=function(){function c(c,d){var e=a.call(this,c,d),f=e[0];f.x=0,f.y=0,q(f);var g=b[0],h=b[1],i=1/Math.max(2*f.r/g,2*f.r/h);r(f,g/2,h/2,i);return e}var a=d3.layout.hierarchy(),b=[1,1];c.sort=d3.rebind(c,a.sort),c.children=d3.rebind(c,a.children),c.value=d3.rebind(c,a.value),c.size=function(a){if(!arguments.length)return b;b=a;return c};return c.sort(j)},d3.layout.tree=function(){function d(d,e){function j(a,c,d){if(c){var e=a,f=a,g=c,h=a.parent.children[0],i=e._tree.mod,j=f._tree.mod,k=g._tree.mod,l=h._tree.mod,m;while(g=v(g),e=u(e),g&&e)h=u(h),f=v(f),f._tree.ancestor=a,m=g._tree.prelim+k-e._tree.prelim-i+b(g,e),m>0&&(C(D(g,a,d),a,m),i+=m,j+=m),k+=g._tree.mod,i+=e._tree.mod,l+=h._tree.mod,j+=f._tree.mod;g&&!v(f)&&(f._tree.thread=g,f._tree.mod+=k-j),e&&!u(h)&&(h._tree.thread=e,h._tree.mod+=i-l,d=a)}return d}function i(a,b){a.x=a._tree.prelim+b;var c=a.children;if(c){var d=-1,e=c.length;b+=a._tree.mod;while(++d<e)i(c[d],b)}}function h(a,c){var d=a.children,e=a._tree;if(d){var f=d.length,g=d[0],i,k=g,l,m=-1;while(++m<f)l=d[m],h(l,i),k=j(l,i,k),i=l;B(a);var n=.5*(g._tree.prelim+l._tree.prelim);c?(e.prelim=c._tree.prelim+b(a,c),e.mod=e.prelim-n):e.prelim=n}else c&&(e.prelim=c._tree.prelim+b(a,c))}var f=a.call(this,d,e),g=f[0];A(g,function(a,b){a._tree={ancestor:a,prelim:0,mod:0,change:0,shift:0,number:b?b._tree.number+1:0}}),h(g),i(g,-g._tree.prelim);var k=w(g,y),l=w(g,x),m=w(g,z),n=k.x-b(k,l)/2,o=l.x+b(l,k)/2,p=m.depth;A(g,function(a){a.x=(a.x-n)/(o-n)*c[0],a.y=a.depth/p*c[1],delete a._tree});return f}var a=d3.layout.hierarchy(),b=t,c=[1,1];d.sort=d3.rebind(d,a.sort),d.children=d3.rebind(d,a.children),d.value=d3.rebind(d,a.value),d.separation=function(a){if(!arguments.length)return b;b=a;return d},d.size=function(a){if(!arguments.length)return c;c=a;return d};return d},d3.layout.treemap=function(){function k(b){var i=e||a(b),j=i[0];j.x=0,j.y=0,j.dx=c[0],j.dy=c[1],e&&a.revalue(j),f(j,c[0]*c[1]/j.value),(e?h:g)(j),d&&(e=i);return i}function j(a,c,d,e){var f=-1,g=a.length,h=d.x,i=d.y,j=c?b(a.area/c):0,k;if(c==d.dx){if(e||j>d.dy)j=d.dy;while(++f<g)k=a[f],k.x=h,k.y=i,k.dy=j,h+=k.dx=b(k.area/j);k.z=!0,k.dx+=d.x+d.dx-h,d.y+=j,d.dy-=j}else{if(e||j>d.dx)j=d.dx;while(++f<g)k=a[f],k.x=h,k.y=i,k.dx=j,i+=k.dy=b(k.area/j);k.z=!1,k.dy+=d.y+d.dy-i,d.x+=j,d.dx-=j}}function i(a,b){var c=a.area,d,e=0,f=Infinity,g=-1,h=a.length;while(++g<h)d=a[g].area,d<f&&(f=d),d>e&&(e=d);c*=c,b*=b;return Math.max(b*e/c,c/(b*f))}function h(a){if(!!a.children){var b={x:a.x,y:a.y,dx:a.dx,dy:a.dy},c=a.children.slice(),d,e=[];e.area=0;while(d=c.pop())e.push(d),e.area+=d.area,d.z!=null&&(j(e,d.z?b.dx:b.dy,b,!c.length),e.length=e.area=0);a.children.forEach(h)}}function g(a){if(!!a.children){var b={x:a.x,y:a.y,dx:a.dx,dy:a.dy},c=[],d=a.children.slice(),e,f=Infinity,h,k=Math.min(b.dx,b.dy),l;c.area=0;while((l=d.length)>0)c.push(e=d[l-1]),c.area+=e.area,(h=i(c,k))<=f?(d.pop(),f=h):(c.area-=c.pop().area,j(c,k,b,!1),k=Math.min(b.dx,b.dy),c.length=c.area=0,f=Infinity);c.length&&(j(c,k,b,!0),c.length=c.area=0),a.children.forEach(g)}}function f(a,b){var c=a.children;a.area=a.value*b;if(c){var d=-1,e=c.length;while(++d<e)f(c[d],b)}}var a=d3.layout.hierarchy(),b=Math.round,c=[1,1],d=!1,e;k.sort=d3.rebind(k,a.sort),k.children=d3.rebind(k,a.children),k.value=d3.rebind(k,a.value),k.size=function(a){if(!arguments.length)return c;c=a;return k},k.round=function(a){if(!arguments.length)return b!=Number;b=a?Math.round:Number;return k},k.sticky=function(a){if(!arguments.length)return d;d=a,e=null;return k};return k}})() <ide>\ No newline at end of file <ide><path>examples/pack/pack.js <del>var w = 800, <del> h = 800, <del> format = d3.format(",d"), <del> pack = d3.layout.pack() <del> .size([w - 4, h - 4]) <del> .sort(null) <del> .children(function(d) { return isNaN(d.value) ? d3.entries(d.value) : null; }) <del> .radius(function(d) { return Math.sqrt(d.value); }); <add>var w = 960, <add> h = 960, <add> format = d3.format(",d"); <add> <add>var pack = d3.layout.pack() <add> .size([w - 4, h - 4]) <add> .children(function(d) { return isNaN(d.value) ? d3.entries(d.value) : null; }); <ide> <ide> var vis = d3.select("#chart").append("svg:svg") <ide> .attr("width", w) <ide> .attr("height", h) <add> .attr("class", "pack") <add> .append("svg:g") <add> .attr("transform", "translate(2, 2)"); <ide> <ide> d3.json("flare.json", function(json) { <del> var node = vis.selectAll("g.pack") <del> .data(d3.entries(json)) <del> .enter().append("svg:g") <del> .attr("class", "pack") <del> .attr("transform", "translate(2,2)") <del> .selectAll("g.node") <add> var node = vis.data(d3.entries(json)).selectAll("g.node") <ide> .data(pack) <ide> .enter().append("svg:g") <ide> .attr("class", function(d) { return d.children ? "node" : "leaf node"; }) <del> .attr("transform", function(d) { return "translate(" + d.y + "," + d.x + ")"; }); <add> .attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; }); <ide> <ide> node.append("svg:title") <ide> .text(function(d) { return d.data.key + (d.children ? "" : ": " + format(d.value)); }); <ide> <ide> node.append("svg:circle") <del> .attr("r", function(d) { return d.radius; }); <add> .attr("r", function(d) { return d.r; }); <ide> <ide> node.filter(function(d) { return !d.children; }).append("svg:text") <ide> .attr("text-anchor", "middle") <ide> .attr("dy", ".3em") <del> .text(function(d) { return d.data.key.substring(0, Math.sqrt(d.value) / 25); }); <add> .text(function(d) { return d.data.key.substring(0, d.r / 3); }); <ide> }); <ide><path>src/layout/pack.js <ide> d3.layout.pack = function() { <ide> var hierarchy = d3.layout.hierarchy(), <del> separation = 1, // spacing <ide> size = [1, 1]; <del> radius = d3_layout_packRadius; <ide> <ide> function pack(d, i) { <ide> var nodes = hierarchy.call(this, d, i), <ide> root = nodes[0]; <ide> <del> d3_layout_packRadii(nodes, radius); <del> <del> /* Recursively compute the layout. */ <add> // Recursively compute the layout. <ide> root.x = 0; <ide> root.y = 0; <del> root.radius = d3_layout_packTree(root, separation); <add> d3_layout_packTree(root); <ide> <add> // Scale the layout to fit the requested size. <ide> var w = size[0], <ide> h = size[1], <del> k = 1 / Math.max(2 * root.radius / w, 2 * root.radius / h); <add> k = 1 / Math.max(2 * root.r / w, 2 * root.r / h); <ide> d3_layout_packTransform(root, w / 2, h / 2, k); <add> <ide> return nodes; <ide> } <ide> <ide> pack.sort = d3.rebind(pack, hierarchy.sort); <ide> pack.children = d3.rebind(pack, hierarchy.children); <ide> pack.value = d3.rebind(pack, hierarchy.value); <ide> <del> pack.separation = function(x) { <del> if (!arguments.length) return separation; <del> separation = x; <del> return pack; <del> }; <del> <ide> pack.size = function(x) { <ide> if (!arguments.length) return size; <ide> size = x; <ide> return pack; <ide> }; <ide> <del> pack.radius = function(x) { <del> if (!arguments.length) return radius; <del> radius = x; <del> return pack; <del> }; <del> <del> return pack; <add> return pack.sort(d3_layout_packSort); <ide> }; <ide> <del>function d3_layout_packRadius(d) { <del> return d.radius; <add>function d3_layout_packSort(a, b) { <add> return a.value - b.value; <ide> } <ide> <del>function d3_layout_packCircle(nodes, spacing) { <add>function d3_layout_packInsert(a, b) { <add> var c = a._pack_next; <add> a._pack_next = b; <add> b._pack_prev = a; <add> b._pack_next = c; <add> c._pack_prev = b; <add>} <add> <add>function d3_layout_packSplice(a, b) { <add> a._pack_next = b; <add> b._pack_prev = a; <add>} <add> <add>function d3_layout_packIntersects(a, b) { <add> var dx = b.x - a.x, <add> dy = b.y - a.y, <add> dr = a.r + b.r; <add> return (dr * dr - dx * dx - dy * dy) > .001; // within epsilon <add>} <add> <add>function d3_layout_packCircle(nodes) { <ide> var xMin = Infinity, <ide> xMax = -Infinity, <ide> yMin = Infinity, <ide> yMax = -Infinity, <add> n = nodes.length, <ide> a, b, c, j, k; <ide> <ide> function bound(n) { <del> xMin = Math.min(n.x - n.radius, xMin); <del> xMax = Math.max(n.x + n.radius, xMax); <del> yMin = Math.min(n.y - n.radius, yMin); <del> yMax = Math.max(n.y + n.radius, yMax); <del> } <del> <del> function insert(a, b) { <del> var c = a.n; <del> a.n = b; <del> b.p = a; <del> b.n = c; <del> c.p = b; <del> } <del> <del> function splice(a, b) { <del> a.n = b; <del> b.p = a; <add> xMin = Math.min(n.x - n.r, xMin); <add> xMax = Math.max(n.x + n.r, xMax); <add> yMin = Math.min(n.y - n.r, yMin); <add> yMax = Math.max(n.y + n.r, yMax); <ide> } <ide> <del> function intersects(a, b) { <del> var dx = b.x - a.x, <del> dy = b.y - a.y, <del> dr = a.radius + b.radius; <del> return (dr * dr - dx * dx - dy * dy) > .001; // within epsilon <del> } <add> // Create node links. <add> nodes.forEach(d3_layout_packLink); <ide> <del> /* Create first node. */ <add> // Create first node. <ide> a = nodes[0]; <del> a.x = -a.radius; <add> a.x = -a.r; <ide> a.y = 0; <ide> bound(a); <ide> <del> /* Create second node. */ <del> if (nodes.length > 1) { <add> // Create second node. <add> if (n > 1) { <ide> b = nodes[1]; <del> b.x = b.radius; <add> b.x = b.r; <ide> b.y = 0; <ide> bound(b); <ide> <del> /* Create third node and build chain. */ <del> if (nodes.length > 2) { <add> // Create third node and build chain. <add> if (n > 2) { <ide> c = nodes[2]; <ide> d3_layout_packPlace(a, b, c); <ide> bound(c); <del> insert(a, c); <del> a.p = c; <del> insert(c, b); <del> b = a.n; <add> d3_layout_packInsert(a, c); <add> a._pack_prev = c; <add> d3_layout_packInsert(c, b); <add> b = a._pack_next; <ide> <del> /* Now iterate through the rest. */ <del> for (var i = 3; i < nodes.length; i++) { <add> // Now iterate through the rest. <add> for (var i = 3; i < n; i++) { <ide> d3_layout_packPlace(a, b, c = nodes[i]); <ide> <del> /* Search for the closest intersection. */ <add> // Search for the closest intersection. <ide> var isect = 0, s1 = 1, s2 = 1; <del> for (j = b.n; j != b; j = j.n, s1++) { <del> if (intersects(j, c)) { <add> for (j = b._pack_next; j != b; j = j._pack_next, s1++) { <add> if (d3_layout_packIntersects(j, c)) { <ide> isect = 1; <ide> break; <ide> } <ide> } <ide> if (isect == 1) { <del> for (k = a.p; k != j.p; k = k.p, s2++) { <del> if (intersects(k, c)) { <add> for (k = a._pack_prev; k != j._pack_prev; k = k._pack_prev, s2++) { <add> if (d3_layout_packIntersects(k, c)) { <ide> if (s2 < s1) { <ide> isect = -1; <ide> j = k; <ide> function d3_layout_packCircle(nodes, spacing) { <ide> } <ide> } <ide> <del> /* Update node chain. */ <add> // Update node chain. <ide> if (isect == 0) { <del> insert(a, c); <add> d3_layout_packInsert(a, c); <ide> b = c; <ide> bound(c); <ide> } else if (isect > 0) { <del> splice(a, j); <add> d3_layout_packSplice(a, j); <ide> b = j; <ide> i--; <del> } else if (isect < 0) { <del> splice(j, b); <add> } else { // isect < 0 <add> d3_layout_packSplice(j, b); <ide> a = j; <ide> i--; <ide> } <ide> } <ide> } <ide> } <ide> <del> /* Re-center the circles and return the encompassing radius. */ <add> // Re-center the circles and return the encompassing radius. <ide> var cx = (xMin + xMax) / 2, <ide> cy = (yMin + yMax) / 2, <ide> cr = 0; <del> for (var i = 0; i < nodes.length; i++) { <del> var n = nodes[i]; <del> n.x -= cx; <del> n.y -= cy; <del> cr = Math.max(cr, n.radius + Math.sqrt(n.x * n.x + n.y * n.y)); <add> for (var i = 0; i < n; i++) { <add> var node = nodes[i]; <add> node.x -= cx; <add> node.y -= cy; <add> cr = Math.max(cr, node.r + Math.sqrt(node.x * node.x + node.y * node.y)); <ide> } <del> return cr + spacing; <add> <add> // Remove node links. <add> nodes.forEach(d3_layout_packUnlink); <add> <add> return cr; <add>} <add> <add>function d3_layout_packLink(node) { <add> node._pack_next = node._pack_prev = node; <ide> } <ide> <del>function d3_layout_packTree(n, spacing) { <del> var nodes = [], <del> children = n.children; <add>function d3_layout_packUnlink(node) { <add> delete node._pack_next; <add> delete node._pack_prev; <add>} <add> <add>function d3_layout_packTree(node) { <add> var children = node.children; <ide> if (children) { <del> for (var i = 0, l = children.length; i < l; i++) { <del> var c = children[i]; <del> if (c.children) c.radius = d3_layout_packTree(c, spacing); <del> c.n = c.p = c; <del> nodes.push(c); <del> } <add> children.forEach(d3_layout_packTree); <add> node.r = d3_layout_packCircle(children); <add> } else { <add> node.r = Math.sqrt(node.value); <ide> } <del> return d3_layout_packCircle(nodes, spacing); <ide> } <ide> <del>function d3_layout_packTransform(n, x, y, k) { <del> var children = n.children; <add>function d3_layout_packTransform(node, x, y, k) { <add> var children = node.children; <add> node.x = (x += k * node.x); <add> node.y = (y += k * node.y); <add> node.r *= k; <ide> if (children) { <del> for (var i = 0, l = children.length; i < l; i++) { <del> var c = children[i]; <del> c.x += n.x; <del> c.y += n.y; <del> d3_layout_packTransform(c, x, y, k); <del> } <add> var i = -1, n = children.length; <add> while (++i < n) d3_layout_packTransform(children[i], x, y, k); <ide> } <del> n.x = x + k * n.x; <del> n.y = y + k * n.y; <del> n.radius *= k; <ide> } <ide> <ide> function d3_layout_packPlace(a, b, c) { <del> var da = b.radius + c.radius, <del> db = a.radius + c.radius, <add> var da = b.r + c.r, <add> db = a.r + c.r, <ide> dx = b.x - a.x, <ide> dy = b.y - a.y, <ide> dc = Math.sqrt(dx * dx + dy * dy), <ide> function d3_layout_packPlace(a, b, c) { <ide> c.x = a.x + x * dx + h * dy; <ide> c.y = a.y + x * dy - h * dx; <ide> } <del> <del>// Computes the radii of the leaf nodes. <del>// TODO (from Protovis version): <del>// Is it possible for spacing to operate in pixel space? <del>// Right now it appears to be multiples of the smallest radius. <del>function d3_layout_packRadii(nodes, radius) { <del> for (var i = 0, n = nodes.length; i < n; i++) { <del> var c = nodes[i]; <del> if (!c.children) { <del> c.radius = radius.call(this, c, i); <del> } <del> } <del>}
4
PHP
PHP
use the nullsafe operator in sessionguard
6094c427834827b9932f848b6a37d788c181e814
<ide><path>src/Illuminate/Auth/SessionGuard.php <ide> protected function rehashUserPassword($password, $attribute) <ide> */ <ide> public function attempting($callback) <ide> { <del> if (isset($this->events)) { <del> $this->events->listen(Events\Attempting::class, $callback); <del> } <add> $this->events?->listen(Events\Attempting::class, $callback); <ide> } <ide> <ide> /** <ide> public function attempting($callback) <ide> */ <ide> protected function fireAttemptEvent(array $credentials, $remember = false) <ide> { <del> if (isset($this->events)) { <del> $this->events->dispatch(new Attempting( <del> $this->name, $credentials, $remember <del> )); <del> } <add> $this->events?->dispatch(new Attempting($this->name, $credentials, $remember)); <ide> } <ide> <ide> /** <ide> protected function fireAttemptEvent(array $credentials, $remember = false) <ide> */ <ide> protected function fireValidatedEvent($user) <ide> { <del> if (isset($this->events)) { <del> $this->events->dispatch(new Validated( <del> $this->name, $user <del> )); <del> } <add> $this->events?->dispatch(new Validated($this->name, $user)); <ide> } <ide> <ide> /** <ide> protected function fireValidatedEvent($user) <ide> */ <ide> protected function fireLoginEvent($user, $remember = false) <ide> { <del> if (isset($this->events)) { <del> $this->events->dispatch(new Login( <del> $this->name, $user, $remember <del> )); <del> } <add> $this->events?->dispatch(new Login($this->name, $user, $remember)); <ide> } <ide> <ide> /** <ide> protected function fireLoginEvent($user, $remember = false) <ide> */ <ide> protected function fireAuthenticatedEvent($user) <ide> { <del> if (isset($this->events)) { <del> $this->events->dispatch(new Authenticated( <del> $this->name, $user <del> )); <del> } <add> $this->events?->dispatch(new Authenticated($this->name, $user)); <ide> } <ide> <ide> /** <ide> protected function fireAuthenticatedEvent($user) <ide> */ <ide> protected function fireOtherDeviceLogoutEvent($user) <ide> { <del> if (isset($this->events)) { <del> $this->events->dispatch(new OtherDeviceLogout( <del> $this->name, $user <del> )); <del> } <add> $this->events?->dispatch(new OtherDeviceLogout($this->name, $user)); <ide> } <ide> <ide> /** <ide> protected function fireOtherDeviceLogoutEvent($user) <ide> */ <ide> protected function fireFailedEvent($user, array $credentials) <ide> { <del> if (isset($this->events)) { <del> $this->events->dispatch(new Failed( <del> $this->name, $user, $credentials <del> )); <del> } <add> $this->events?->dispatch(new Failed($this->name, $user, $credentials)); <ide> } <ide> <ide> /**
1
Javascript
Javascript
destroy app created in handlebars test
c2e621384c1b72ee4dc22b8f09c4ab2bcf2e222b
<ide><path>packages/sproutcore-handlebars/tests/views/collection_view_test.js <ide> test("empty views should be removed when content is added to the collection (reg <ide> <ide> equals(view.$('tr').length, 1, 'has one row'); <ide> <del> window.App = undefined; <add> window.App.destroy(); <ide> }); <ide> <ide> test("if no content is passed, and no 'else' is specified, nothing is rendered", function() {
1
Python
Python
fix inadvertent regressions introduced in
2b6a3517c4bf724f9e3420d3abbffe1545f2a41a
<ide><path>libcloud/common/openstack_identity.py <ide> def __init__( <ide> timeout=None, <ide> proxy_url=None, <ide> parent_conn=None, <add> auth_cache=None, <ide> ): <ide> """ <ide> Tenant, domain and scope options are ignored as they are contained <ide> def __init__( <ide> timeout=timeout, <ide> proxy_url=proxy_url, <ide> parent_conn=parent_conn, <add> auth_cache=auth_cache, <ide> ) <ide> <ide> def _get_auth_data(self): <ide> def __init__( <ide> user_id, <ide> key, <ide> tenant_name=None, <add> tenant_domain_id="default", <ide> domain_name="Default", <ide> token_scope=OpenStackIdentityTokenScope.PROJECT, <ide> timeout=None,
1
Python
Python
break cyclic refs in recursive closures
50fde71f1ac0528f40ee216136b33fde41205ef2
<ide><path>numpy/core/arrayprint.py <ide> def recurser(index, hanging_indent, curr_width): <ide> s += hanging_indent + summary_insert + line_sep <ide> <ide> for i in range(trailing_items, 1, -1): <del> nested = recurser(index + (-i,), next_hanging_indent, next_width) <add> nested = recurser(index + (-i,), next_hanging_indent, <add> next_width) <ide> s += hanging_indent + nested + line_sep <ide> <ide> nested = recurser(index + (-1,), next_hanging_indent, next_width) <ide> def recurser(index, hanging_indent, curr_width): <ide> s = '[' + s[len(hanging_indent):] + ']' <ide> return s <ide> <del> # invoke the recursive part with an initial index and prefix <del> return recurser( <del> index=(), <del> hanging_indent=next_line_prefix, <del> curr_width=line_width) <del> <add> try: <add> # invoke the recursive part with an initial index and prefix <add> return recurser(index=(), <add> hanging_indent=next_line_prefix, <add> curr_width=line_width) <add> finally: <add> # recursive closures have a cyclic reference to themselves, which <add> # requires gc to collect (gh-10620). To avoid this problem, for <add> # performance and PyPy friendliness, we break the cycle: <add> recurser = None <ide> <ide> def _none_or_positive_arg(x, name): <ide> if x is None: <ide><path>numpy/core/shape_base.py <ide> def block_recursion(arrays, depth=0): <ide> # type(arrays) is not list <ide> return atleast_nd(arrays, result_ndim) <ide> <del> return block_recursion(arrays) <add> try: <add> return block_recursion(arrays) <add> finally: <add> # recursive closures have a cyclic reference to themselves, which <add> # requires gc to collect (gh-10620). To avoid this problem, for <add> # performance and PyPy friendliness, we break the cycle: <add> block_recursion = None <ide> <ide> <ide> def block(arrays): <ide><path>numpy/core/tests/test_arrayprint.py <ide> # -*- coding: utf-8 -*- <ide> from __future__ import division, absolute_import, print_function <ide> <del>import sys <add>import sys, gc <ide> <ide> import numpy as np <ide> from numpy.testing import ( <ide> def test_wide_element(self): <ide> "[ 'xxxxx']" <ide> ) <ide> <add> def test_refcount(self): <add> # make sure we do not hold references to the array due to a recursive <add> # closure (gh-10620) <add> gc.disable() <add> a = np.arange(2) <add> r1 = sys.getrefcount(a) <add> np.array2string(a) <add> np.array2string(a) <add> r2 = sys.getrefcount(a) <add> gc.collect() <add> gc.enable() <add> assert_(r1 == r2) <ide> <ide> class TestPrintOptions(object): <ide> """Test getting and setting global print options.""" <ide><path>numpy/lib/npyio.py <ide> def tobytes_first(x, conv): <ide> finally: <ide> if fown: <ide> fh.close() <add> # recursive closures have a cyclic reference to themselves, which <add> # requires gc to collect (gh-10620). To avoid this problem, for <add> # performance and PyPy friendliness, we break the cycle: <add> flatten_dtype_internal = None <add> pack_items = None <ide> <ide> if X is None: <ide> X = np.array([], dtype)
4
Ruby
Ruby
expose used git version and path
d7b6e9bba92ccc5884dcb9dd0859d16e2bf3fe9c
<ide><path>Library/Homebrew/system_config.rb <ide> def describe_java <ide> javas.uniq.join(", ") <ide> end <ide> <add> def describe_git <add> return "N/A" unless Utils.git_available? <add> "#{Utils.git_version} => #{Utils.git_path}" <add> end <add> <ide> def dump_verbose_config(f = $stdout) <ide> f.puts "HOMEBREW_VERSION: #{HOMEBREW_VERSION}" <ide> f.puts "ORIGIN: #{origin}" <ide> def dump_verbose_config(f = $stdout) <ide> f.puts "GCC-4.0: build #{gcc_40}" if gcc_40 <ide> f.puts "GCC-4.2: build #{gcc_42}" if gcc_42 <ide> f.puts "Clang: #{clang ? "#{clang} build #{clang_build}" : "N/A"}" <add> f.puts "Git: #{describe_git}" <ide> f.puts "Perl: #{describe_perl}" <ide> f.puts "Python: #{describe_python}" <ide> f.puts "Ruby: #{describe_ruby}"
1
Mixed
Text
add changelog entry for activejob change
c45c84db72b1448ca4a8a01a7d705ad0286d2277
<ide><path>activejob/CHANGELOG.md <add>* Add `at` argument to the `perform_enqueued_jobs` test helper. <add> <add> *John Crepezzi*, *Eileen Uchitelle* <add> <ide> * `assert_enqueued_with` and `assert_performed_with` can now test jobs with relative delay. <ide> <ide> *Vlado Cingel* <ide><path>activejob/lib/active_job/test_helper.rb <ide> def queue_adapter_for_test <ide> # HelloJob.perform_later('elfassy') <ide> # end <ide> # end <del> def assert_enqueued_jobs(number, only: nil, except: nil, queue: nil, at: at) <add> def assert_enqueued_jobs(number, only: nil, except: nil, queue: nil) <ide> if block_given? <ide> original_count = enqueued_jobs_with(only: only, except: except, queue: queue) <ide>
2
Java
Java
allow separator configuration in pathpatternparser
33becd8258583f17741c8615bcd2d2dc0378c7fc
<ide><path>spring-web/src/main/java/org/springframework/http/server/DefaultPathContainer.java <ide> /* <del> * Copyright 2002-2018 the original author or authors. <add> * Copyright 2002-2019 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> public String toString() { <ide> } <ide> <ide> <del> static PathContainer createFromUrlPath(String path) { <add> static PathContainer createFromUrlPath(String path, String separator) { <ide> if (path.equals("")) { <ide> return EMPTY_PATH; <ide> } <del> String separator = "/"; <add> if (separator.length() == 0) { <add> throw new IllegalArgumentException("separator should not be empty"); <add> } <ide> Separator separatorElement = separator.equals(SEPARATOR.value()) ? SEPARATOR : () -> separator; <ide> List<Element> elements = new ArrayList<>(); <ide> int begin; <ide><path>spring-web/src/main/java/org/springframework/http/server/PathContainer.java <ide> default PathContainer subPath(int startIndex, int endIndex) { <ide> } <ide> <ide> <add> /** <add> * Parse the path value into a sequence of {@code "/"} {@link Separator Separator} <add> * and {@link PathSegment PathSegment} elements. <add> * @param path the encoded, raw path value to parse <add> * @return the parsed path <add> */ <add> static PathContainer parsePath(String path) { <add> return DefaultPathContainer.createFromUrlPath(path, "/"); <add> } <add> <ide> /** <ide> * Parse the path value into a sequence of {@link Separator Separator} and <ide> * {@link PathSegment PathSegment} elements. <del> * @param path the encoded, raw URL path value to parse <add> * @param path the encoded, raw path value to parse <add> * @param separator the decoded separator for parsing patterns <ide> * @return the parsed path <add> * @since 5.2 <ide> */ <del> static PathContainer parsePath(String path) { <del> return DefaultPathContainer.createFromUrlPath(path); <add> static PathContainer parsePath(String path, String separator) { <add> return DefaultPathContainer.createFromUrlPath(path, separator); <ide> } <ide> <ide> <ide><path>spring-web/src/main/java/org/springframework/web/util/pattern/PathPatternParser.java <ide> /* <del> * Copyright 2002-2017 the original author or authors. <add> * Copyright 2002-2019 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> public class PathPatternParser { <ide> <ide> private boolean caseSensitive = true; <ide> <add> private char separator = '/'; <add> <ide> <ide> /** <ide> * Whether a {@link PathPattern} produced by this parser should should <ide> public boolean isCaseSensitive() { <ide> } <ide> <ide> /** <del> * Accessor used for the separator to use. <del> * <p>Currently not exposed for configuration with URI path patterns and <del> * mainly for use in InternalPathPatternParser and PathPattern. If required <del> * in the future, a similar option would also need to be exposed in <del> * {@link org.springframework.http.server.PathContainer PathContainer}. <add> * Char that represents the separator to use in the patterns. <add> * <p>The default is {@code '/'}. <add> * @since 5.2 <add> */ <add> public void setSeparator(char separator) { <add> this.separator = separator; <add> } <add> <add> /** <add> * Char that represents the separator to use in the patterns. <add> * @since 5.2 <ide> */ <del> char getSeparator() { <del> return '/'; <add> public char getSeparator() { <add> return this.separator; <ide> } <ide> <ide> <ide><path>spring-web/src/test/java/org/springframework/http/server/DefaultPathContainerTests.java <ide> import org.springframework.util.MultiValueMap; <ide> <ide> import static org.assertj.core.api.Assertions.assertThat; <add>import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; <ide> <ide> /** <ide> * Unit tests for {@link DefaultPathContainer}. <ide> public void path() throws Exception { <ide> testPath("//%20/%20", "//%20/%20", Arrays.asList("/", "/", "%20", "/", "%20")); <ide> } <ide> <del> private void testPath(String input, String value, List<String> expectedElements) { <del> <del> PathContainer path = PathContainer.parsePath(input); <add> private void testPath(String input, String separator, String value, List<String> expectedElements) { <add> PathContainer path = PathContainer.parsePath(input, separator); <ide> <ide> assertThat(path.value()).as("value: '" + input + "'").isEqualTo(value); <ide> assertThat(path.elements().stream() <ide> .map(PathContainer.Element::value).collect(Collectors.toList())).as("elements: " + input).isEqualTo(expectedElements); <ide> } <ide> <add> private void testPath(String input, String value, List<String> expectedElements) { <add> testPath(input, "/", value, expectedElements); <add> } <add> <ide> @Test <ide> public void subPath() throws Exception { <ide> // basic <ide> public void subPath() throws Exception { <ide> assertThat(path.subPath(2).value()).isEqualTo("/b/"); <ide> } <ide> <add> @Test <add> public void pathWithCustomSeparator() throws Exception { <add> testPath("a.b.c", ".", "a.b.c", Arrays.asList("a", ".", "b", ".", "c")); <add> } <add> <add> @Test <add> public void emptySeparator() { <add> assertThatIllegalArgumentException().isThrownBy(() -> PathContainer.parsePath("path", "")); <add> } <add> <ide> } <ide><path>spring-web/src/test/java/org/springframework/web/util/pattern/PathPatternParserTests.java <ide> public void compareTests() { <ide> assertThat(patterns.get(1)).isEqualTo(p2); <ide> } <ide> <add> @Test <add> public void separatorTests() { <add> PathPatternParser parser = new PathPatternParser(); <add> parser.setSeparator('.'); <add> String rawPattern = "first.second.{last}"; <add> PathPattern pattern = parser.parse(rawPattern); <add> assertThat(pattern.computePatternString()).isEqualTo(rawPattern); <add> } <add> <ide> private PathPattern parse(String pattern) { <ide> PathPatternParser patternParser = new PathPatternParser(); <ide> return patternParser.parse(pattern);
5
Text
Text
fix reference to oddsquares
2a680a3fe5f9d1297331e50bb0771be19e07e2bb
<ide><path>README.md <ide> Once the sequence is used, it performs only the work necessary. In this <ide> example, no intermediate arrays are ever created, filter is only called <ide> twice, and map is only called once: <ide> <del> console.log(evenSquares.last()); // 49 <add> console.log(oddSquares.last()); // 49 <ide> <ide> Lazy Sequences allow for the efficient chaining of sequence operations, allowing <ide> for the expression of logic that can otherwise be very tedious:
1
Ruby
Ruby
remove disabled functionality tests
8a93230c1546bb172a81e1aa27083b98e2e3b5d0
<ide><path>Library/Homebrew/test/cask/depends_on_spec.rb <ide> end <ide> end <ide> <del> context "given a string", :needs_compat do <del> let(:cask) { Cask::CaskLoader.load(cask_path("compat/with-depends-on-macos-string")) } <del> <del> it "does not raise an error" do <del> expect { install }.not_to raise_error <del> end <del> end <del> <ide> context "given a symbol" do <ide> let(:cask) { Cask::CaskLoader.load(cask_path("with-depends-on-macos-symbol")) } <ide> <ide><path>Library/Homebrew/test/cask/dsl_spec.rb <ide> def caveats <ide> end <ide> <ide> describe "depends_on macos" do <del> context "string disabled", :needs_compat do <del> let(:token) { "compat/with-depends-on-macos-string" } <del> <del> it "allows depends_on macos to be specified" do <del> expect { cask }.to raise_error(Cask::CaskInvalidError) <del> end <del> end <del> <ide> context "invalid depends_on macos value" do <ide> let(:token) { "invalid/invalid-depends-on-macos-bad-release" } <ide>
2
Text
Text
fix changelog from
1b2fa1875e7e53ba58993c163f131266ed76baa7
<ide><path>activerecord/CHANGELOG.md <ide> <ide> Previously the schema cache methods `primary_keys`, `columns, `columns_hash`, and `indexes` <ide> would behave differently than one another when a table didn't exist and differently across <del> databases. This change unifies the behavior so that all the methods return `nil` if the table <del> doesn't exist. While this class is technically public, applications don't interact with the <del> return values of these methods so it should be safe to make this change. <add> database adapters. This change unifies the behavior so each method behaves the same regardless <add> of adapter. <add> <add> The behavior now is: <add> <add> `columns`: (unchanged) raises a db error if the table does not exist <add> `columns_hash`: (unchanged) raises a db error if the table does not exist <add> `primary_keys`: (unchanged) returns `nil` if the table does not exist <add> `indexes`: (changed for mysql2) returns `[]` if the table does not exist <ide> <ide> *Eileen M. Uchitelle* <ide>
1
Python
Python
remove an extra newline with the popen based exec
4e6e5fcccddca2cb737fde43c8e9771192e26038
<ide><path>numpy/distutils/exec_command.py <ide> def _exec_command(command, use_shell=None, use_tee = None, **env): <ide> # Another historical oddity <ide> if text[-1:] == '\n': <ide> text = text[:-1] <del> if use_tee: <add> if use_tee and text: <ide> print(text) <ide> return proc.returncode, text <ide>
1
Go
Go
use containercommitresponse struct for commit cmd
8b795a05a8fa8a6f747ee5cc0c087bca9d42199d
<ide><path>api/client/commit.go <ide> import ( <ide> "fmt" <ide> "net/url" <ide> <del> "github.com/docker/docker/engine" <add> "github.com/docker/docker/api/types" <ide> "github.com/docker/docker/opts" <ide> flag "github.com/docker/docker/pkg/mflag" <ide> "github.com/docker/docker/pkg/parsers" <ide> func (cli *DockerCli) CmdCommit(args ...string) error { <ide> } <ide> <ide> var ( <del> config *runconfig.Config <del> env engine.Env <add> config *runconfig.Config <add> response types.ContainerCommitResponse <ide> ) <add> <ide> if *flConfig != "" { <ide> config = &runconfig.Config{} <ide> if err := json.Unmarshal([]byte(*flConfig), config); err != nil { <ide> func (cli *DockerCli) CmdCommit(args ...string) error { <ide> if err != nil { <ide> return err <ide> } <del> if err := env.Decode(stream); err != nil { <add> <add> if err := json.NewDecoder(stream).Decode(&response); err != nil { <ide> return err <ide> } <ide> <del> fmt.Fprintf(cli.out, "%s\n", env.Get("Id")) <add> fmt.Fprintln(cli.out, response.ID) <ide> return nil <ide> } <ide><path>api/server/server.go <ide> func postCommit(eng *engine.Engine, version version.Version, w http.ResponseWrit <ide> } <ide> var ( <ide> config engine.Env <del> env engine.Env <ide> job = eng.Job("commit", r.Form.Get("container")) <ide> stdoutBuffer = bytes.NewBuffer(nil) <ide> ) <ide> func postCommit(eng *engine.Engine, version version.Version, w http.ResponseWrit <ide> if err := job.Run(); err != nil { <ide> return err <ide> } <del> env.Set("Id", engine.Tail(stdoutBuffer, 1)) <del> return writeJSONEnv(w, http.StatusCreated, env) <add> return writeJSON(w, http.StatusCreated, &types.ContainerCommitResponse{ <add> ID: engine.Tail(stdoutBuffer, 1), <add> }) <ide> } <ide> <ide> // Creates an image from Pull or from Import <ide><path>api/types/types.go <ide> type ContainerWaitResponse struct { <ide> // StatusCode is the status code of the wait job <ide> StatusCode int `json:"StatusCode"` <ide> } <add> <add>// POST "/commit?container="+containerID <add>type ContainerCommitResponse struct { <add> ID string `json:"Id"` <add>}
3
Go
Go
fix incorrect file permissions (staticcheck)
c2532d56b0c80a0300d9aae9c24c3ba077bab2a9
<ide><path>volume/local/local.go <ide> func (r *Root) Create(name string, opts map[string]string) (volume.Volume, error <ide> if err != nil { <ide> return nil, err <ide> } <del> if err = ioutil.WriteFile(filepath.Join(filepath.Dir(path), "opts.json"), b, 600); err != nil { <add> if err = ioutil.WriteFile(filepath.Join(filepath.Dir(path), "opts.json"), b, 0600); err != nil { <ide> return nil, errdefs.System(errors.Wrap(err, "error while persisting volume options")) <ide> } <ide> }
1
PHP
PHP
add function droptimestamps()
cd06c78fb4668ac7f624004f9164895c9f467b48
<ide><path>src/Illuminate/Database/Schema/Blueprint.php <ide> public function dropForeign($index) <ide> return $this->dropIndexCommand('dropForeign', $index); <ide> } <ide> <add> /** <add> * Indicate that the timestamp columns should be dropped. <add> * <add> * @return void <add> */ <add> public function dropTimestamps() <add> { <add> $this->dropColumns('created_at', 'updated_at'); <add> } <add> <ide> /** <ide> * Rename the table to a given name. <ide> *
1
Text
Text
add information "string"
3f2b07ed71409dcabc998ab2adf42e6d422f0113
<ide><path>guide/english/php/strings/index.md <ide> title: Strings <ide> --- <ide> ## Strings <add>A string is a sequence of characters, like "Hello world!". <ide> <add>## PHP String Functions <add>In this chapter we will look at some commonly used functions to manipulate strings. <add> <add>## Get The Length of a String <add>The PHP strlen() function returns the length of a string. <add>The example below returns the length of the string "Hello world!": <add>```` <add><?php <add>echo strlen("Hello world!"); // outputs 12 <add>?> <add>```` <ide> A string is series of characters. <ide> PHP only supports a 256-character set and hence does not offer native Unicode support. <ide> <del><!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds --> <add>## Count The Number of Words in a String <add>The PHP str_word_count() function counts the number of words in a string: <add>```` <add><?php <add>echo str_word_count("Hello world!"); // outputs 2 <add>?> <add>```` <add> <add>## Reverse a String <add>The PHP strrev() function reverses a string: <add>```` <add><?php <add>echo strrev("Hello world!"); // outputs !dlrow olleH <add>?> <add>```` <add> <add>## Search For a Specific Text Within a String <add>The PHP strpos() function searches for a specific text within a string. <add>If a match is found, the function returns the character position of the first match. If no match is found, it will return FALSE. <add>The example below searches for the text "world" in the string "Hello world!": <add>```` <add><?php <add>echo strpos("Hello world!", "world"); // outputs 6 <add>?> <add>```` <add> <add>## Replace Text Within a String <add>```` <add><?php <add>echo str_replace("world", "Dolly", "Hello world!"); // outputs Hello Dolly! <add>?> <add>```` <ide> <ide> #### More Information: <del><!-- Please add any articles you think might be helpful to read before writing the article --> <add>[PHP String tutorial](https://www.w3schools.com/php/php_string.asp)
1
Text
Text
add troubleshooting guide for asynclocalstorage
fedb0f4d54e8e68d39f488969d074773f7f95ffb
<ide><path>doc/api/async_hooks.md <ide> In this example, the store is only available in the callback function and the <ide> functions called by `foo`. Outside of `run`, calling `getStore` will return <ide> `undefined`. <ide> <add>### Troubleshooting <add> <add>In most cases your application or library code should have no issues with <add>`AsyncLocalStorage`. But in rare cases you may face situations when the <add>current store is lost in one of asynchronous operations. Then you should <add>consider the following options. <add> <add>If your code is callback-based, it is enough to promisify it with <add>[`util.promisify()`][], so it starts working with native promises. <add> <add>If you need to keep using callback-based API, or your code assumes <add>a custom thenable implementation, you should use [`AsyncResource`][] class <add>to associate the asynchronous operation with the correct execution context. <add> <add>[`AsyncResource`]: #async_hooks_class_asyncresource <ide> [`after` callback]: #async_hooks_after_asyncid <ide> [`before` callback]: #async_hooks_before_asyncid <ide> [`destroy` callback]: #async_hooks_destroy_asyncid <ide> functions called by `foo`. Outside of `run`, calling `getStore` will return <ide> [PromiseHooks]: https://docs.google.com/document/d/1rda3yKGHimKIhg5YeoAmCOtyURgsbTH_qaYR79FELlk/edit <ide> [`Worker`]: worker_threads.html#worker_threads_class_worker <ide> [promise execution tracking]: #async_hooks_promise_execution_tracking <add>[`util.promisify()`]: util.html#util_util_promisify_original
1
Text
Text
fix some translation error
69767d4b792d2192ccd0e5b2cbfa29b401d798fd
<ide><path>docs/docs/01-why-react.zh-CN.md <ide> React 是一个 Facebook 和 Instagram 用来创建用户界面的 JavaScript <ide> <ide> ## 构建可组合的组件 <ide> <del>React is all about building reusable components. In fact, with React the *only* thing you do is build components. Since they're so encapsulated, components make code reuse, testing, and separation of concerns easy. <del> <del>React 是所有关于创建可以复用的组件。事实上,通过 React 你*唯一*要做的事情就是构建组件。得益于其良好的封装性,组件使代码复用、测试和关注分离(separation of concerns)更加简单。 <add>React 都是关于创建可复用的组件。事实上,通过 React 你*唯一*要做的事情就是构建组件。得益于其良好的封装性,组件使代码复用、测试和关注分离(separation of concerns)更加简单。 <ide> <ide> ## 给它5分钟的时间 <ide>
1
Javascript
Javascript
fix many queries in story
31eb81bf2f0ce58b2ef0ccc4c5f1603788152ded
<ide><path>server/boot/story.js <ide> module.exports = function(app) { <ide> } <ide> <ide> function hotJSON(req, res, next) { <del> Story.find({order: 'timePosted DESC', limit: 1000}, function(err, stories) { <add> Story.find({ <add> order: 'timePosted DESC', <add> limit: 1000 <add> }, function(err, stories) { <ide> if (err) { <ide> return next(err); <ide> } <ide> module.exports = function(app) { <ide> <ide> var storyName = dashedName.replace(/\-/g, ' ').trim(); <ide> <del> Story.find({where: {'storyLink': storyName}}, function(err, story) { <add> Story.find({ where: { storyLink: storyName } }, function(err, story) { <ide> if (err) { <ide> return next(err); <ide> } <ide> module.exports = function(app) { <ide> <ide> function upvote(req, res, next) { <ide> var data = req.body.data; <del> Story.find({'id': data.id}, function(err, story) { <add> Story.find({ where: { id: data.id } }, function(err, story) { <ide> if (err) { <ide> return next(err); <ide> } <ide> module.exports = function(app) { <ide> function comments(req, res, next) { <ide> var data = req.params.id; <ide> Comment.find( <del> { where: {'id': data } }, <add> { where: { id: data } }, <ide> function(err, comment) { <ide> if (err) { <ide> return next(err); <ide> module.exports = function(app) { <ide> url = 'http://' + url; <ide> } <ide> Story.find( <del> { where: {'link': url} }, <add> { where: { link: url } }, <ide> function(err, story) { <ide> if (err) { <ide> return next(err); <ide> module.exports = function(app) { <ide> } <ide> <ide> Story.count({ <del> storyLink: { like: new RegExp('^' + storyLink + '(?: [0-9]+)?$', 'i') } <add> storyLink: { <add> like: ('^' + storyLink + '(?: [0-9]+)?$'), <add> options: 'i' <add> } <ide> }, function (err, storyCount) { <ide> if (err) { <ide> return next(err); <ide> module.exports = function(app) { <ide> <ide> function commentEdit(req, res, next) { <ide> <del> Comment.find({ id: req.params.id }, function(err, cmt) { <add> Comment.find({ where: { id: req.params.id } }, function(err, cmt) { <ide> if (err) { <ide> return next(err); <ide> } <ide> module.exports = function(app) { <ide> // Based on the context retrieve the parent <ide> // object of the comment (Story/Comment) <ide> Context.find({ <del> id: data.associatedPost <add> where: { id: data.associatedPost } <ide> }, function (err, associatedContext) { <ide> if (err) { <ide> return next(err); <ide> module.exports = function(app) { <ide> } <ide> // Find the author of the parent object <ide> User.findOne({ <del> 'profile.username': associatedContext.author.username <add> username: associatedContext.author.username <ide> }, function(err, recipient) { <ide> if (err) { <ide> return next(err);
1
PHP
PHP
remove unneeded tests
c2180d04d0cb91667c548506e6ff1bc64c4e9b88
<ide><path>tests/TestCase/Auth/BasicAuthenticateTest.php <ide> public function testAuthenticateSuccess() <ide> ]; <ide> $this->assertEquals($expected, $result); <ide> } <del> <del> /** <del> * test scope failure. <del> * <del> * @return void <del> */ <del> public function testAuthenticateFailReChallenge() <del> { <del> $this->expectException(\Cake\Http\Exception\UnauthorizedException::class); <del> $this->expectExceptionCode(401); <del> $this->auth->setConfig('scope.username', 'nate'); <del> $request = new ServerRequest([ <del> 'url' => 'posts/index', <del> 'environment' => [ <del> 'PHP_AUTH_USER' => 'mariano', <del> 'PHP_AUTH_PW' => 'password' <del> ] <del> ]); <del> <del> $this->auth->unauthenticated($request, $this->response); <del> } <ide> } <ide><path>tests/TestCase/Auth/DigestAuthenticateTest.php <ide> public function testAuthenticateSuccessSimulatedRequestMethod() <ide> $this->assertEquals($expected, $result); <ide> } <ide> <del> /** <del> * test scope failure. <del> * <del> * @return void <del> */ <del> public function testAuthenticateFailReChallenge() <del> { <del> $this->expectException(\Cake\Http\Exception\UnauthorizedException::class); <del> $this->expectExceptionCode(401); <del> $this->auth->setConfig('scope.username', 'nate'); <del> $request = new ServerRequest([ <del> 'url' => 'posts/index', <del> 'environment' => ['REQUEST_METHOD' => 'GET'] <del> ]); <del> <del> $data = [ <del> 'username' => 'invalid', <del> 'uri' => '/dir/index.html', <del> 'nonce' => $this->generateNonce(), <del> 'nc' => 1, <del> 'cnonce' => '123', <del> 'qop' => 'auth', <del> ]; <del> $data['response'] = $this->auth->generateResponseHash($data, '09faa9931501bf30f0d4253fa7763022', 'GET'); <del> $request = $request->withEnv('PHP_AUTH_DIGEST', $this->digestHeader($data)); <del> $this->auth->unauthenticated($request, $this->response); <del> } <del> <ide> /** <ide> * testLoginHeaders method <ide> *
2
PHP
PHP
fix code explanation
ca6e89710a9a4d8956268cc9477162f46865976a
<ide><path>src/Illuminate/Cache/TaggedCache.php <ide> public function rememberForever($key, Closure $callback) <ide> { <ide> // If the item exists in the cache we will just return this immediately <ide> // otherwise we will execute the given Closure and cache the result <del> // of that execution for the given number of minutes. It's easy. <add> // of that execution for an indefinite amount of time. It's easy. <ide> if (! is_null($value = $this->get($key))) { <ide> return $value; <ide> }
1
PHP
PHP
handle array callbacks
b80ddf458bd08de375d83b716a1309ed927197aa
<ide><path>src/Illuminate/Events/Dispatcher.php <ide> protected function addInterfaceListeners($eventName, array $listeners = []) <ide> */ <ide> public function makeListener($listener, $wildcard = false) <ide> { <del> if (is_string($listener)) { <add> if (is_string($listener) || is_array($listener)) { <ide> return $this->createClassListener($listener, $wildcard); <ide> } <ide> <ide> public function makeListener($listener, $wildcard = false) <ide> /** <ide> * Create a class based listener using the IoC container. <ide> * <del> * @param string $listener <add> * @param string|array $listener <ide> * @param bool $wildcard <ide> * @return \Closure <ide> */ <ide> public function createClassListener($listener, $wildcard = false) <ide> /** <ide> * Create the class based event callable. <ide> * <del> * @param string $listener <add> * @param string|array $listener <ide> * @return callable <ide> */ <ide> protected function createClassCallable($listener) <ide> { <del> [$class, $method] = $this->parseClassCallable($listener); <add> [$class, $method] = is_array($listener) ? $listener : $this->parseClassCallable($listener); <ide> <ide> if ($this->handlerShouldBeQueued($class)) { <ide> return $this->createQueuedHandlerCallable($class, $method); <ide><path>tests/Events/EventsDispatcherTest.php <ide> public function testClassesWork() <ide> $this->assertSame('baz', $_SERVER['__event.test']); <ide> } <ide> <add> public function testArrayCallbackListenersAreHandled() <add> { <add> unset($_SERVER['__event.ExampleListener']); <add> $d = new Dispatcher; <add> $d->listen(ExampleEvent::class, [ExampleListener::class, 'hear']); <add> $d->dispatch(new ExampleEvent); <add> <add> $this->assertTrue($_SERVER['__event.ExampleListener']); <add> } <add> <ide> public function testEventClassesArePayload() <ide> { <ide> unset($_SERVER['__event.test']); <ide> class AnotherEvent implements SomeEventInterface <ide> { <ide> // <ide> } <add> <add>class ExampleListener <add>{ <add> public function hear() <add> { <add> $_SERVER['__event.ExampleListener'] = true; <add> } <add>}
2
Python
Python
fix segmentation fault
2cff4bd8f3ad412917f4f295b97b952e297fa257
<ide><path>transformers/file_utils.py <ide> <ide> logger = logging.getLogger(__name__) # pylint: disable=invalid-name <ide> <del>try: <del> import tensorflow as tf <del> assert hasattr(tf, '__version__') and int(tf.__version__[0]) >= 2 <del> _tf_available = True # pylint: disable=invalid-name <del> logger.info("TensorFlow version {} available.".format(tf.__version__)) <del>except (ImportError, AssertionError): <del> _tf_available = False # pylint: disable=invalid-name <del> <ide> try: <ide> import torch <ide> _torch_available = True # pylint: disable=invalid-name <ide> logger.info("PyTorch version {} available.".format(torch.__version__)) <ide> except ImportError: <ide> _torch_available = False # pylint: disable=invalid-name <ide> <add>try: <add> import tensorflow as tf <add> assert hasattr(tf, '__version__') and int(tf.__version__[0]) >= 2 <add> _tf_available = True # pylint: disable=invalid-name <add> logger.info("TensorFlow version {} available.".format(tf.__version__)) <add>except (ImportError, AssertionError): <add> _tf_available = False # pylint: disable=invalid-name <ide> <ide> try: <ide> from torch.hub import _get_torch_home
1
Text
Text
fix grammatical error in readme.md
19e1b1e2ac9cbf8d0479a6408c12ea5445f4314b
<ide><path>README.md <ide> Airflow is a platform to programmatically author, schedule and monitor <ide> data pipelines. <ide> <del>When workflows are defined as code, they becomes more maintainable, <add>When workflows are defined as code, they become more maintainable, <ide> versionable, testable, and collaborative. <ide> <ide> ![img] (http://i.imgur.com/6Gs4hxT.gif)
1
Ruby
Ruby
remove another `@env` access
d4e1f58fd8ce70ae356c630dad68926ad6711fe3
<ide><path>actionpack/lib/action_dispatch/http/url.rb <ide> def port_string <ide> end <ide> <ide> def server_port <del> @env['SERVER_PORT'].to_i <add> get_header('SERVER_PORT').to_i <ide> end <ide> <ide> # Returns the \domain part of a \host, such as "rubyonrails.org" in "www.rubyonrails.org". You can specify
1
Python
Python
fix typos in docstrings and comments in run.py
e21afed0bba82668c6e4f5f433d0ccfcf54b3577
<ide><path>flask/run.py <ide> def find_best_app(module): <ide> if app is not None and callable(app): <ide> return app <ide> <del> # Otherwise find the first object named Flask <add> # Otherwise find exactly one Flask instance, or fail. <ide> matches = [] <ide> for key, value in iteritems(module.__dict__): <ide> if isinstance(value, Flask): <ide> def find_best_app(module): <ide> def prepare_exec_for_file(filename): <ide> module = [] <ide> <del> # Chop off file extensions or package markers <add> # Chop off file extensions or package markers. <ide> if filename.endswith('.py'): <ide> filename = filename[:-3] <ide> elif os.path.split(filename)[1] == '__init__.py': <ide> def locate_app(app_id, debug=None): <ide> <ide> <ide> class DispatchingApp(object): <del> """Special applicationt that dispatches to a flask application which <add> """Special application that dispatches to a flask application which <ide> is imported by name on first request. This is safer than importing <del> the application upfront because it means that we can forward all <del> errors for import problems into the browser as error. <add> the application up front because it means that we can forward all <add> errors for import problems into the browser as errors. <ide> """ <ide> <ide> def __init__(self, app_id, debug=None, use_eager_loading=False): <ide> def run_application(app_id, host='127.0.0.1', port=5000, debug=None, <ide> use_eager_loading=None, magic_app_id=True, <ide> **options): <ide> """Useful function to start a Werkzeug server for an application that <del> is known by it's import name. By default the app ID can also be a <add> is known by its import name. By default the app ID can also be a <ide> full file name in which case Flask attempts to reconstruct the import <ide> name from it and do the right thing. <ide> <ide> def run_application(app_id, host='127.0.0.1', port=5000, debug=None, <ide> if use_eager_loading is None: <ide> use_eager_loading = not use_reloader <ide> <del> # Extra startup messages. This depends a but on Werkzeug internals to <add> # Extra startup messages. This depends a bit on Werkzeug internals to <ide> # not double execute when the reloader kicks in. <ide> if os.environ.get('WERKZEUG_RUN_MAIN') != 'true': <ide> print ' * Serving Flask app "%s"' % app_id
1
PHP
PHP
add additional tests for marshaller
ed8331f6b1f3a290114e58dedbf4a8037371794e
<ide><path>Cake/Test/TestCase/ORM/MarshallerTest.php <ide> public function testOneAssociationsMany() { <ide> $this->assertEquals($data['Users'], $result->Users); <ide> } <ide> <add>/** <add> * Test one() with deeper associations. <add> * <add> * @return void <add> */ <ide> public function testOneDeepAssociations() { <del> $this->markTestIncomplete('not done'); <add> $data = [ <add> 'comment' => 'First post', <add> 'user_id' => 2, <add> 'Articles' => [ <add> 'title' => 'Article title', <add> 'body' => 'Article body', <add> 'Users' => [ <add> 'username' => 'mark', <add> 'password' => 'secret' <add> ], <add> ] <add> ]; <add> $marshall = new Marshaller($this->comments); <add> $result = $marshall->one($data, ['Articles' => ['Users']]); <add> <add> $this->assertEquals( <add> $data['Articles']['title'], <add> $result->article->title <add> ); <add> $this->assertEquals( <add> $data['Articles']['Users']['username'], <add> $result->article->user->username <add> ); <add> $this->assertNull($result->article->Users); <add> $this->assertNull($result->Articles); <ide> } <ide> <add>/** <add> * Test many() with a simple set of data. <add> * <add> * @return void <add> */ <ide> public function testManySimple() { <del> $this->markTestIncomplete('not done'); <add> $data = [ <add> ['comment' => 'First post', 'user_id' => 2], <add> ['comment' => 'Second post', 'user_id' => 2], <add> ]; <add> $marshall = new Marshaller($this->comments); <add> $result = $marshall->many($data); <add> <add> $this->assertCount(2, $result); <add> $this->assertInstanceOf('Cake\ORM\Entity', $result[0]); <add> $this->assertInstanceOf('Cake\ORM\Entity', $result[1]); <add> $this->assertEquals($data[0]['comment'], $result[0]->comment); <add> $this->assertEquals($data[1]['comment'], $result[1]->comment); <ide> } <ide> <add>/** <add> * test many() with nested associations. <add> * <add> * @return void <add> */ <ide> public function testManyAssociations() { <del> $this->markTestIncomplete('not done'); <del> } <del> <del> public function testManyDeepAssociations() { <del> $this->markTestIncomplete('not done'); <add> $data = [ <add> [ <add> 'comment' => 'First post', <add> 'user_id' => 2, <add> 'Users' => [ <add> 'username' => 'mark', <add> ], <add> ], <add> [ <add> 'comment' => 'Second post', <add> 'user_id' => 2, <add> 'Users' => [ <add> 'username' => 'jose', <add> ], <add> ], <add> ]; <add> $marshall = new Marshaller($this->comments); <add> $result = $marshall->many($data, ['Users']); <add> <add> $this->assertCount(2, $result); <add> $this->assertInstanceOf('Cake\ORM\Entity', $result[0]); <add> $this->assertInstanceOf('Cake\ORM\Entity', $result[1]); <add> $this->assertEquals( <add> $data[0]['Users']['username'], <add> $result[0]->user->username <add> ); <add> $this->assertEquals( <add> $data[1]['Users']['username'], <add> $result[1]->user->username <add> ); <ide> } <ide> <ide> }
1
PHP
PHP
correct doc block
c7f2eab359969aeac5552839320ac960a71ebd44
<ide><path>src/Console/ShellDispatcher.php <ide> protected function _dispatch() { <ide> * All paths in the loaded shell paths are searched. <ide> * <ide> * @param string $shell Optionally the name of a plugin <del> * @return mixed An object <add> * @return \Cake\Console\Shell A shell instance. <ide> * @throws \Cake\Console\Error\MissingShellException when errors are encountered. <ide> */ <ide> public function findShell($shell) {
1
Python
Python
fix a typo in _example_parser docstring
f82ca018a04c57c3a6f56e374367b18abc5b90a5
<ide><path>research/astronet/astronet/ops/dataset_ops.py <ide> def build_dataset(file_pattern, <ide> table_initializer, default_value=-1) <ide> <ide> def _example_parser(serialized_example): <del> """Parses a single tf.Example into image and label tensors.""" <add> """Parses a single tf.Example into feature and label tensors.""" <ide> # Set specifications for parsing the features. <ide> data_fields = { <ide> feature_name: tf.FixedLenFeature([feature.length], tf.float32)
1
Ruby
Ruby
fix dependency equality
a412b49c2ce23d0b917f5c08e0cb453a042c1b26
<ide><path>Library/Homebrew/dependencies.rb <ide> def each(*args, &block) <ide> end <ide> <ide> def <<(o) <del> @deps << o unless include?(o) <add> @deps << o <ide> self <ide> end <ide> <ide><path>Library/Homebrew/dependency.rb <ide> def to_s <ide> end <ide> <ide> def ==(other) <del> instance_of?(other.class) && name == other.name <add> instance_of?(other.class) && name == other.name && tags == other.tags <ide> end <ide> alias_method :eql?, :== <ide> <ide> def hash <del> name.hash <add> name.hash ^ tags.hash <ide> end <ide> <ide> def to_formula <ide> def keep_but_prune_recursive_deps <ide> throw(:action, :keep_but_prune_recursive_deps) <ide> end <ide> <del> def merge_repeats(deps) <del> grouped = deps.group_by(&:name) <del> <del> deps.uniq.map do |dep| <del> tags = grouped.fetch(dep.name).map(&:tags).flatten.uniq <del> dep.class.new(dep.name, tags, dep.env_proc) <add> def merge_repeats(all) <add> all.group_by(&:name).map do |name, deps| <add> dep = deps.first <add> tags = deps.map(&:tags).flatten.uniq <add> dep.class.new(name, tags, dep.env_proc) <ide> end <ide> end <ide> end <ide><path>Library/Homebrew/test/test_dependencies.rb <ide> def test_shovel_returns_self <ide> assert_same @deps, @deps << Dependency.new("foo") <ide> end <ide> <del> def test_no_duplicate_deps <del> @deps << Dependency.new("foo") <del> @deps << Dependency.new("foo", [:build]) <del> @deps << Dependency.new("foo", [:build]) <del> assert_equal 1, @deps.count <del> end <del> <ide> def test_preserves_order <ide> hash = { 0 => "foo", 1 => "bar", 2 => "baz" } <ide> @deps << Dependency.new(hash[0]) <ide><path>Library/Homebrew/test/test_dependency.rb <ide> def test_equality <ide> assert_eql foo1, foo2 <ide> refute_equal foo1, bar <ide> refute_eql foo1, bar <add> foo3 = Dependency.new("foo", [:build]) <add> refute_equal foo1, foo3 <add> refute_eql foo1, foo3 <ide> end <ide> end <ide><path>Library/Homebrew/test/test_dependency_collector.rb <ide> def test_dependency_tags <ide> assert_empty Dependency.new('foo').tags <ide> end <ide> <del> def test_no_duplicate_dependencies <del> @d.add 'foo' <del> @d.add 'foo' => :build <del> assert_equal 1, @d.deps.count <del> assert_empty find_dependency("foo").tags <del> end <del> <ide> def test_requirement_creation <ide> @d.add :x11 <ide> assert_instance_of X11Dependency, find_requirement(X11Dependency) <ide><path>Library/Homebrew/test/test_dependency_expansion.rb <ide> def test_skip_skips_parent_but_yields_children <ide> end <ide> <ide> def test_keep_dep_but_prune_recursive_deps <del> f = stub(:name => "f", :deps => [ <del> build_dep(:foo, [:build], [@bar]), <del> build_dep(:baz, [:build]), <del> ]) <add> foo = build_dep(:foo, [:build], @bar) <add> baz = build_dep(:baz, [:build]) <add> f = stub(:name => "f", :deps => [foo, baz]) <ide> <ide> deps = Dependency.expand(f) do |dependent, dep| <ide> Dependency.keep_but_prune_recursive_deps if dep.build? <ide> end <ide> <del> assert_equal [@foo, @baz], deps <add> assert_equal [foo, baz], deps <ide> end <ide> <ide> def test_deps_with_collection_argument
6
PHP
PHP
createquietly parameter type
98548073b4f7bc201c0c8e6d215f65faa8f5c739
<ide><path>src/Illuminate/Database/Eloquent/Factories/Factory.php <ide> public function create($attributes = [], ?Model $parent = null) <ide> /** <ide> * Create a collection of models and persist them to the database without dispatching any model events. <ide> * <del> * @param array<string, mixed> $attributes <add> * @param (callable(array<string, mixed>): array<string, mixed>)|array<string, mixed> $attributes <ide> * @param \Illuminate\Database\Eloquent\Model|null $parent <ide> * @return \Illuminate\Database\Eloquent\Collection<int, \Illuminate\Database\Eloquent\Model|TModel>|\Illuminate\Database\Eloquent\Model|TModel <ide> */ <ide><path>types/Database/Eloquent/Factories/Factory.php <ide> public function definition() <ide> assertType('Illuminate\Database\Eloquent\Collection<int, Illuminate\Database\Eloquent\Model>|Illuminate\Database\Eloquent\Model', $factory->createQuietly([ <ide> 'string' => 'string', <ide> ])); <add>assertType('Illuminate\Database\Eloquent\Collection<int, Illuminate\Database\Eloquent\Model>|Illuminate\Database\Eloquent\Model', $factory->createQuietly(function ($attributes) { <add> assertType('array<string, mixed>', $attributes); <add> <add> return ['string' => 'string']; <add>})); <ide> <ide> // assertType('Closure(): Illuminate\Database\Eloquent\Collection<int, User>|User', $factory->lazy()); <ide> // assertType('Closure(): Illuminate\Database\Eloquent\Collection<int, User>|User', $factory->lazy([
2
Go
Go
replace panic by log.fatal in tests
823174de4d1acb93613c1b5ba53873906f43f62c
<ide><path>runtime_test.go <ide> func init() { <ide> <ide> // Make it our Store root <ide> if runtime, err := NewRuntimeFromDirectory(unitTestStoreBase, false); err != nil { <del> panic(err) <add> log.Fatalf("Unable to create a runtime for tests:", err) <ide> } else { <ide> globalRuntime = runtime <ide> } <ide> func init() { <ide> if img, err := globalRuntime.repositories.LookupImage(unitTestImageName); err != nil || img.ID != unitTestImageID { <ide> // Retrieve the Image <ide> if err := srv.ImagePull(unitTestImageName, "", os.Stdout, utils.NewStreamFormatter(false), nil, nil, true); err != nil { <del> panic(err) <add> log.Fatalf("Unable to pull the test image:", err) <ide> } <ide> } <ide> // Spawn a Daemon <ide> go func() { <ide> if err := ListenAndServe(testDaemonProto, testDaemonAddr, srv, os.Getenv("DEBUG") != ""); err != nil { <del> panic(err) <add> log.Fatalf("Unable to spawn the test daemon:", err) <ide> } <ide> }() <ide> <ide> func init() { <ide> func GetTestImage(runtime *Runtime) *Image { <ide> imgs, err := runtime.graph.Map() <ide> if err != nil { <del> panic(err) <add> log.Fatalf("Unable to get the test image:", err) <ide> } <ide> for _, image := range imgs { <ide> if image.ID == unitTestImageID { <ide> return image <ide> } <ide> } <del> panic(fmt.Errorf("Test image %v not found", unitTestImageID)) <add> log.Fatalf("Test image %v not found", unitTestImageID) <add> return nil <ide> } <ide> <ide> func TestRuntimeCreate(t *testing.T) {
1
Ruby
Ruby
fix failing tests for rails-api
de45e4c6cd9d8a6e610863c6ec396ba12b654e55
<ide><path>railties/test/application/rake_test.rb <ide> class ApplicationController < ActionController::API <ide> bundle exec rake db:migrate test` <ide> end <ide> <del> assert_match(/5 runs, 8 assertions, 0 failures, 0 errors/, output) <add> assert_match(/5 runs, 7 assertions, 0 failures, 0 errors/, output) <ide> assert_no_match(/Errors running/, output) <ide> end <ide>
1
PHP
PHP
implement key lengths for mysql
28de0f04944186e1ca9124cc4937e58146b855d6
<ide><path>lib/Cake/Database/Schema/MysqlSchema.php <ide> public function indexSql(Table $table, $name) { <ide> if ($data['type'] === Table::INDEX_FULLTEXT) { <ide> $out = 'FULLTEXT KEY '; <ide> } <del> // TODO finish MySQL indexes with length <ide> $out .= $this->_driver->quoteIdentifier($name); <ide> <ide> $columns = array_map( <ide> [$this->_driver, 'quoteIdentifier'], <ide> $data['columns'] <ide> ); <add> foreach ($data['columns'] as $i => $column) { <add> if (isset($data['length'][$column])) { <add> $columns[$i] .= sprintf('(%d)', $data['length'][$column]); <add> } <add> } <ide> return $out . ' (' . implode(', ', $columns) . ')'; <ide> } <ide> <ide><path>lib/Cake/Database/Schema/Table.php <ide> class Table { <ide> protected $_indexKeys = [ <ide> 'type' => null, <ide> 'columns' => [], <add> 'length' => [], <ide> ]; <ide> <ide> /** <ide><path>lib/Cake/Test/TestCase/Database/Schema/MysqlSchemaTest.php <ide> public static function createTableProvider() { <ide> UNIQUE KEY `unique_idx` (`author_id`, `article_id`) <ide> ); <ide> SQL; <add> <ide> $simpleKey = (new Table('things')) <ide> ->addColumn('thing_id', [ <ide> 'type' => 'integer', <ide> public static function createTableProvider() { <ide> `stuff` TEXT, <ide> FULLTEXT KEY `stuff_idx` (`stuff`) <ide> ); <add>SQL; <add> <add> $keyLength = (new Table('articles_authors')) <add> ->addColumn('author_id', [ <add> 'type' => 'integer', <add> 'null' => false <add> ]) <add> ->addColumn('article_id', [ <add> 'type' => 'integer', <add> 'null' => false, <add> ]) <add> ->addIndex('unique_idx', [ <add> 'type' => 'unique', <add> 'columns' => ['author_id', 'article_id'], <add> 'length' => ['author_id' => 5, 'article_id' => 4], <add> ]); <add> $keyLengthExpected = <<<SQL <add>CREATE TABLE `articles_authors` ( <add>`author_id` INTEGER NOT NULL, <add>`article_id` INTEGER NOT NULL, <add>UNIQUE KEY `unique_idx` (`author_id`(5), `article_id`(4)) <add>); <ide> SQL; <ide> return [ <ide> [$basic, $basicExpected], <ide> [$uniqueKey, $uniqueExpected], <ide> [$fullText, $fullTextExpected], <ide> [$simpleKey, $simpleKeyExpected], <add> [$keyLength, $keyLengthExpected], <ide> ]; <ide> } <ide>
3
Ruby
Ruby
fix enum on custom attribute with default
8f2decdf4db9723dd964637cb6357f0aabcb4e24
<ide><path>activerecord/lib/active_record/attributes.rb <ide> def define_default_attribute(name, value, type, from_user:) <ide> def decorate_attribute_type(attr_name, **default) <ide> type, options = attributes_to_define_after_schema_loads[attr_name] <ide> <add> default.with_defaults!(default: options[:default]) if options&.key?(:default) <add> <ide> attribute(attr_name, **default) do |cast_type| <ide> if type && !type.is_a?(Proc) <ide> cast_type = _lookup_cast_type(attr_name, type, options) <ide><path>activerecord/test/cases/enum_test.rb <ide> def self.name; "Book"; end <ide> assert_equal :integer, Book.type_for_attribute("status").type <ide> end <ide> <add> test "enum on custom attribute with default" do <add> klass = Class.new(ActiveRecord::Base) do <add> self.table_name = "books" <add> attribute :status, default: 2 <add> enum status: [:proposed, :written, :published] <add> end <add> <add> assert_equal "published", klass.new.status <add> end <add> <ide> test "overloaded default" do <ide> klass = Class.new(ActiveRecord::Base) do <ide> self.table_name = "books"
2
Javascript
Javascript
test white space in `ember.isempty`
5fc8d4064ff72c393719b677b541b89428d274e4
<ide><path>packages/ember-metal/lib/is_empty.js <ide> import isNone from 'ember-metal/is_none'; <ide> Ember.isEmpty({}); // false <ide> Ember.isEmpty('Adam Hawkins'); // false <ide> Ember.isEmpty([0,1,2]); // false <add> Ember.isEmpty('\n\t'); // false <add> Ember.isEmpty(' '); // false <ide> ``` <ide> <ide> @method isEmpty <ide><path>packages/ember-metal/tests/is_empty_test.js <ide> QUnit.test('Ember.isEmpty', function() { <ide> equal(true, isEmpty(null), 'for null'); <ide> equal(true, isEmpty(undefined), 'for undefined'); <ide> equal(true, isEmpty(''), 'for an empty String'); <add> equal(false, isEmpty(' '), 'for a whitespace String'); <add> equal(false, isEmpty('\n\t'), 'for another whitespace String'); <ide> equal(false, isEmpty(true), 'for true'); <ide> equal(false, isEmpty(false), 'for false'); <ide> equal(false, isEmpty(string), 'for a String');
2
PHP
PHP
fix docblock spelling
23526ca9a4620a60e2f282df14ccb053d52b36a7
<ide><path>src/Illuminate/Hashing/BcryptHasher.php <ide> public function needsRehash($hashedValue, array $options = array()) <ide> } <ide> <ide> /** <del> * Set the default passwork work factor. <add> * Set the default password work factor. <ide> * <ide> * @param int $rounds <ide> * @return $this
1
Python
Python
fix use of __doc__ in setup.py for -oo mode
922442fe0251df29b3494a2aa93a0d3f18155481
<ide><path>setup.py <ide> """ <ide> from __future__ import division, print_function <ide> <del>DOCLINES = __doc__.split("\n") <add>DOCLINES = (__doc__ or '').split("\n") <ide> <ide> import os <ide> import sys
1
PHP
PHP
add throws docblock for console kernel
b0efeb71216761ff8cefa621f45b43b4402702e8
<ide><path>src/Illuminate/Foundation/Console/Kernel.php <ide> public function registerCommand($command) <ide> * @param array $parameters <ide> * @param \Symfony\Component\Console\Output\OutputInterface $outputBuffer <ide> * @return int <add> * <add> * @throws \Symfony\Component\Console\Exception\CommandNotFoundException <ide> */ <ide> public function call($command, array $parameters = [], $outputBuffer = null) <ide> {
1
Go
Go
use tagimage in commit
afb3eda697efebf18d8ac3bbcfd911a5968081e3
<ide><path>api/server/router/image/backend.go <ide> type imageBackend interface { <ide> ImageHistory(imageName string) ([]*image.HistoryResponseItem, error) <ide> Images(imageFilters filters.Args, all bool, withExtraAttrs bool) ([]*types.ImageSummary, error) <ide> LookupImage(name string) (*types.ImageInspect, error) <del> TagImage(imageName, repository, tag string) error <add> TagImage(imageName, repository, tag string) (string, error) <ide> ImagesPrune(ctx context.Context, pruneFilters filters.Args) (*types.ImagesPruneReport, error) <ide> } <ide> <ide><path>api/server/router/image/image_routes.go <ide> func (s *imageRouter) postImagesTag(ctx context.Context, w http.ResponseWriter, <ide> if err := httputils.ParseForm(r); err != nil { <ide> return err <ide> } <del> if err := s.backend.TagImage(vars["name"], r.Form.Get("repo"), r.Form.Get("tag")); err != nil { <add> if _, err := s.backend.TagImage(vars["name"], r.Form.Get("repo"), r.Form.Get("tag")); err != nil { <ide> return err <ide> } <ide> w.WriteHeader(http.StatusCreated) <ide><path>daemon/commit.go <ide> import ( <ide> "strings" <ide> "time" <ide> <del> "github.com/docker/distribution/reference" <ide> "github.com/docker/docker/api/types/backend" <ide> containertypes "github.com/docker/docker/api/types/container" <ide> "github.com/docker/docker/builder/dockerfile" <ide> func (daemon *Daemon) CreateImageFromContainer(name string, c *backend.CreateIma <ide> return "", err <ide> } <ide> <del> imageRef, err := daemon.tagCommit(c.Repo, c.Tag, id) <del> if err != nil { <del> return "", err <add> var imageRef string <add> if c.Repo != "" { <add> imageRef, err = daemon.TagImage(string(id), c.Repo, c.Tag) <add> if err != nil { <add> return "", err <add> } <ide> } <ide> daemon.LogContainerEventWithAttributes(container, "commit", map[string]string{ <ide> "comment": c.Comment, <ide> func (daemon *Daemon) commitImage(c backend.CommitConfig) (image.ID, error) { <ide> return id, nil <ide> } <ide> <del>// TODO: remove from Daemon, move to api backend <del>func (daemon *Daemon) tagCommit(repo string, tag string, id image.ID) (string, error) { <del> imageRef := "" <del> if repo != "" { <del> newTag, err := reference.ParseNormalizedNamed(repo) // todo: should move this to API layer <del> if err != nil { <del> return "", err <del> } <del> if !reference.IsNameOnly(newTag) { <del> return "", errors.Errorf("unexpected repository name: %s", repo) <del> } <del> if tag != "" { <del> if newTag, err = reference.WithTag(newTag, tag); err != nil { <del> return "", err <del> } <del> } <del> if err := daemon.TagImageWithReference(id, newTag); err != nil { <del> return "", err <del> } <del> imageRef = reference.FamiliarString(newTag) <del> } <del> return imageRef, nil <del>} <del> <ide> func exportContainerRw(layerStore layer.Store, id, mountLabel string) (arch io.ReadCloser, err error) { <ide> rwlayer, err := layerStore.GetRWLayer(id) <ide> if err != nil { <ide><path>daemon/image_tag.go <ide> import ( <ide> <ide> // TagImage creates the tag specified by newTag, pointing to the image named <ide> // imageName (alternatively, imageName can also be an image ID). <del>func (daemon *Daemon) TagImage(imageName, repository, tag string) error { <add>func (daemon *Daemon) TagImage(imageName, repository, tag string) (string, error) { <ide> imageID, _, err := daemon.GetImageIDAndOS(imageName) <ide> if err != nil { <del> return err <add> return "", err <ide> } <ide> <ide> newTag, err := reference.ParseNormalizedNamed(repository) <ide> if err != nil { <del> return err <add> return "", err <ide> } <ide> if tag != "" { <ide> if newTag, err = reference.WithTag(reference.TrimNamed(newTag), tag); err != nil { <del> return err <add> return "", err <ide> } <ide> } <ide> <del> return daemon.TagImageWithReference(imageID, newTag) <add> err = daemon.TagImageWithReference(imageID, newTag) <add> return reference.FamiliarString(newTag), err <ide> } <ide> <ide> // TagImageWithReference adds the given reference to the image ID provided.
4
Javascript
Javascript
replace function with arrow function
54ff3b6b052c561e127ae5f5a02f1ad6895b61d7
<ide><path>test/parallel/test-http.js <ide> server.on('listening', function() { <ide> Cookie: [ 'foo=bar', 'bar=baz', 'baz=quux' ] <ide> }, <ide> agent: agent <del> }, common.mustCall(function(res) { <add> }, common.mustCall((res) => { <ide> const cookieHeaders = req._header.match(/^Cookie: .+$/img); <ide> assert.deepStrictEqual(cookieHeaders, <ide> ['Cookie: foo=bar; bar=baz; baz=quux']); <ide> assert.strictEqual(res.statusCode, 200); <ide> let body = ''; <ide> res.setEncoding('utf8'); <del> res.on('data', function(chunk) { body += chunk; }); <del> res.on('end', common.mustCall(function() { <add> res.on('data', (chunk) => { body += chunk; }); <add> res.on('end', common.mustCall(() => { <ide> assert.strictEqual(body, 'The path was /hello'); <ide> })); <ide> })); <ide> <del> setTimeout(common.mustCall(function() { <add> setTimeout(common.mustCall(() => { <ide> const req = http.request({ <ide> port: server.address().port, <ide> method: 'PUT', <ide> path: '/there', <ide> agent: agent <del> }, common.mustCall(function(res) { <add> }, common.mustCall((res) => { <ide> const cookieHeaders = req._header.match(/^Cookie: .+$/img); <ide> assert.deepStrictEqual(cookieHeaders, ['Cookie: node=awesome; ta=da']); <ide> assert.strictEqual(res.statusCode, 200); <ide> let body = ''; <ide> res.setEncoding('utf8'); <del> res.on('data', function(chunk) { body += chunk; }); <del> res.on('end', common.mustCall(function() { <add> res.on('data', (chunk) => { body += chunk; }); <add> res.on('end', common.mustCall(() => { <ide> assert.strictEqual(body, 'The path was /there'); <ide> })); <ide> })); <ide> req.setHeader('Cookie', ['node=awesome', 'ta=da']); <ide> req.end(); <ide> }), 1); <ide> <del> setTimeout(common.mustCall(function() { <add> setTimeout(common.mustCall(() => { <ide> const req = http.request({ <ide> port: server.address().port, <ide> method: 'POST', <ide> server.on('listening', function() { <ide> ['Cookie', 'def=456'], <ide> ['Cookie', 'ghi=789'] ], <ide> agent: agent <del> }, common.mustCall(function(res) { <add> }, common.mustCall((res) => { <ide> const cookieHeaders = req._header.match(/^Cookie: .+$/img); <ide> assert.deepStrictEqual(cookieHeaders, <ide> ['Cookie: abc=123', <ide> server.on('listening', function() { <ide> assert.strictEqual(res.statusCode, 200); <ide> let body = ''; <ide> res.setEncoding('utf8'); <del> res.on('data', function(chunk) { body += chunk; }); <del> res.on('end', common.mustCall(function() { <add> res.on('data', (chunk) => { body += chunk; }); <add> res.on('end', common.mustCall(() => { <ide> assert.strictEqual(body, 'The path was /world'); <ide> })); <ide> }));
1
Ruby
Ruby
remove useless find_partial method
405b4c7f1e078185b71d74629675336ad3d9c36a
<ide><path>actionview/lib/action_view/renderer/partial_renderer.rb <ide> def render(context, options, block) <ide> else <ide> @template_keys = @locals.keys <ide> end <del> template = find_partial(@path, @template_keys) <add> template = find_template(@path, @template_keys) <ide> @variable ||= template.variable <ide> else <ide> if options[:cached] <ide> def collection_from_object <ide> @object.to_ary if @object.respond_to?(:to_ary) <ide> end <ide> <del> def find_partial(path, template_keys) <del> find_template(path, template_keys) <del> end <del> <ide> def find_template(path, locals) <ide> prefixes = path.include?(?/) ? [] : @lookup_context.prefixes <ide> @lookup_context.find_template(path, prefixes, true, locals, @details)
1
PHP
PHP
add test to prove
5261b277c3e9b68a33bec304f8713c9ea69334c8
<ide><path>tests/TestCase/View/Widget/DateTimeWidgetTest.php <ide> public function testRenderSelected($selected) <ide> $this->assertContains('<option value="45" selected="selected">45</option>', $result); <ide> } <ide> <add> public function testRenderInvalidDate() { <add> $selected = [ <add> 'year' => '2014', 'month' => '02', 'day' => '31', <add> 'hour' => '12', 'minute' => '30', 'second' => '45', <add> ]; <add> $result = $this->DateTime->render(['val' => $selected], $this->context); <add> $this->assertContains('<option value="2014" selected="selected">2014</option>', $result); <add> $this->assertContains('<option value="02" selected="selected">2</option>', $result); <add> $this->assertContains('<option value="31" selected="selected">31</option>', $result); <add> $this->assertContains('<option value="12" selected="selected">12</option>', $result); <add> $this->assertContains('<option value="30" selected="selected">30</option>', $result); <add> $this->assertContains('<option value="45" selected="selected">45</option>', $result); <add> } <add> <ide> /** <ide> * Test that render() works with an array for val that is missing seconds. <ide> *
1
Mixed
Ruby
allow skipping incineration of processed emails
d0037daa3738ac754781ce5e55778a2cf9d3d2f7
<ide><path>actionmailbox/CHANGELOG.md <add>* Allow skipping incineration of processed emails. <add> <add> This can be done by setting `config.action_mailbox.incinerate` to `false`. <add> <add> *Pratik Naik* <add> <ide> ## Rails 6.0.0.beta1 (January 18, 2019) ## <ide> <ide> * Added to Rails. <ide><path>actionmailbox/app/jobs/action_mailbox/incineration_job.rb <ide> module ActionMailbox <ide> # <ide> # Since this incineration is set for the future, it'll automatically ignore any <tt>InboundEmail</tt>s <ide> # that have already been deleted and discard itself if so. <add> # <add> # You can disable incinerating processed emails by setting +config.action_mailbox.incinerate+ or <add> # +ActionMailbox.incinerate+ to +false+. <ide> class IncinerationJob < ActiveJob::Base <ide> queue_as { ActionMailbox.queues[:incineration] } <ide> <ide><path>actionmailbox/app/models/action_mailbox/inbound_email/incineratable.rb <ide> module ActionMailbox::InboundEmail::Incineratable <ide> extend ActiveSupport::Concern <ide> <ide> included do <del> after_update_commit :incinerate_later, if: -> { status_previously_changed? && processed? } <add> after_update_commit :incinerate_later, if: -> { ActionMailbox.incinerate && status_previously_changed? && processed? } <ide> end <ide> <ide> def incinerate_later <ide><path>actionmailbox/lib/action_mailbox.rb <ide> module ActionMailbox <ide> <ide> mattr_accessor :ingress <ide> mattr_accessor :logger <add> mattr_accessor :incinerate, default: true <ide> mattr_accessor :incinerate_after, default: 30.days <ide> mattr_accessor :queues, default: {} <ide> end <ide><path>actionmailbox/lib/action_mailbox/engine.rb <ide> class Engine < Rails::Engine <ide> config.eager_load_namespaces << ActionMailbox <ide> <ide> config.action_mailbox = ActiveSupport::OrderedOptions.new <add> config.action_mailbox.incinerate = true <ide> config.action_mailbox.incinerate_after = 30.days <ide> <ide> config.action_mailbox.queues = ActiveSupport::InheritableOptions.new \ <ide> class Engine < Rails::Engine <ide> initializer "action_mailbox.config" do <ide> config.after_initialize do |app| <ide> ActionMailbox.logger = app.config.action_mailbox.logger || Rails.logger <add> ActionMailbox.incinerate = app.config.action_mailbox.incinerate.nil? ? true : app.config.action_mailbox.incinerate <ide> ActionMailbox.incinerate_after = app.config.action_mailbox.incinerate_after || 30.days <ide> ActionMailbox.queues = app.config.action_mailbox.queues || {} <ide> end <ide><path>actionmailbox/test/unit/inbound_email/incineration_test.rb <ide> class ActionMailbox::InboundEmail::IncinerationTest < ActiveSupport::TestCase <ide> perform_enqueued_jobs only: ActionMailbox::IncinerationJob <ide> end <ide> end <add> <add> test "skipping incineration" do <add> original, ActionMailbox.incinerate = ActionMailbox.incinerate, false <add> <add> assert_no_enqueued_jobs only: ActionMailbox::IncinerationJob do <add> create_inbound_email_from_fixture("welcome.eml").delivered! <add> end <add> ensure <add> ActionMailbox.incinerate = original <add> end <ide> end
6
Python
Python
simplify the import statement
0086bbc0145b9e9612b299e0b36b4782160c9ce1
<ide><path>numpy/core/_internal.py <ide> def _newnames(datatype, order): <ide> # Given an array with fields and a sequence of field names <ide> # construct a new array with just those fields copied over <ide> def _index_fields(ary, fields): <del> from multiarray import empty, dtype <add> from multiarray import empty, dtype, array <ide> dt = ary.dtype <ide> <ide> names = [name for name in fields if name in dt.names] <ide> def _index_fields(ary, fields): <ide> # Return a copy for now until behavior is fully deprecated <ide> # in favor of returning view <ide> copy_dtype = {'names':view_dtype['names'], 'formats':view_dtype['formats']} <del> from numpy import array <ide> return array(view, dtype=copy_dtype, copy=True) <ide> <ide> # Given a string containing a PEP 3118 format specifier,
1
Python
Python
fix bug in get_indexes affecting the tests
c5e2ecae6949d4e89530610d768bbbd563ddc19b
<ide><path>django/db/backends/mysql/introspection.py <ide> def get_indexes(self, cursor, table_name): <ide> continue <ide> if row[4] not in indexes: <ide> indexes[row[4]] = {'primary_key': False, 'unique': False} <add> # It's possible to have the unique and PK constraints in separate indexes. <ide> if row[2] == 'PRIMARY': <ide> indexes[row[4]]['primary_key'] = True <ide> if not bool(row[1]): <ide><path>django/db/backends/postgresql_psycopg2/introspection.py <ide> def get_indexes(self, cursor, table_name): <ide> # Here, we skip any indexes across multiple fields. <ide> if ' ' in row[1]: <ide> continue <del> indexes[row[0]] = {'primary_key': row[3], 'unique': row[2]} <add> if row[0] not in indexes: <add> indexes[row[0]] = {'primary_key': False, 'unique': False} <add> # It's possible to have the unique and PK constraints in separate indexes. <add> if row[3]: <add> indexes[row[0]]['primary_key'] = True <add> if row[2]: <add> indexes[row[0]]['unique'] = True <ide> return indexes <ide> <ide> def get_constraints(self, cursor, table_name):
2
Python
Python
reduce transformer fp16 test to 12 iterations.
81123ebf39e2491791b5aa8b4f50d46c10a66223
<ide><path>official/transformer/v2/transformer_benchmark.py <ide> def benchmark_8_gpu_fp16(self): <ide> FLAGS['bleu_ref'].value = self.bleu_ref <ide> FLAGS.param_set = 'big' <ide> FLAGS.batch_size = 3072*8 <del> FLAGS.train_steps = 400000 <add> FLAGS.train_steps = 20000 * 12 <ide> FLAGS.steps_between_evals = 20000 <ide> FLAGS.model_dir = self._get_model_dir('benchmark_8_gpu_fp16') <ide> self._run_and_report_benchmark(total_batch_size=FLAGS.batch_size,
1
Text
Text
change paragraph and spelling error
7e69a4e791c2ac7c5415d4fa926333627e553a2e
<ide><path>guide/english/computer-science/index.md <ide> Computer Science is the study of computers and the concepts that make computers <ide> <ide> Much of computer science was pioneered in the latter half of the 20th century. <ide> <del>Today, if you attend an undergraduate computer science course, you will learn about both hardware and software. You'll learn how computers work at a low level of abstraction (machine language) and at a high level of abstraction (modern scripting langauges like JavaScript). <add>Students who are interested in computer science will first learn about both hardware and software. It is important to learn how computers work at a low level of abstraction (machine language) and at a high level of abstraction (modern scripting languages like JavaScript) because it will help individuals understand computer science intuitively. <ide> <ide> In 21st century, computer science has become a backbone for every technological leap we take forward. <ide>
1
Java
Java
add runtime hints for tx management
50240bb609b6441390d436005a7f2e7a4cdf5454
<ide><path>spring-tx/src/main/java/org/springframework/transaction/annotation/ProxyTransactionManagementConfiguration.java <ide> import org.springframework.beans.factory.config.BeanDefinition; <ide> import org.springframework.context.annotation.Bean; <ide> import org.springframework.context.annotation.Configuration; <add>import org.springframework.context.annotation.ImportRuntimeHints; <ide> import org.springframework.context.annotation.Role; <ide> import org.springframework.transaction.config.TransactionManagementConfigUtils; <ide> import org.springframework.transaction.interceptor.BeanFactoryTransactionAttributeSourceAdvisor; <ide> */ <ide> @Configuration(proxyBeanMethods = false) <ide> @Role(BeanDefinition.ROLE_INFRASTRUCTURE) <add>@ImportRuntimeHints(TransactionRuntimeHintsRegistrar.class) <ide> public class ProxyTransactionManagementConfiguration extends AbstractTransactionManagementConfiguration { <ide> <ide> @Bean(name = TransactionManagementConfigUtils.TRANSACTION_ADVISOR_BEAN_NAME) <ide><path>spring-tx/src/main/java/org/springframework/transaction/annotation/TransactionRuntimeHintsRegistrar.java <add>/* <add> * Copyright 2002-2022 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * https://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add> <add>package org.springframework.transaction.annotation; <add> <add>import org.springframework.aot.hint.MemberCategory; <add>import org.springframework.aot.hint.RuntimeHints; <add>import org.springframework.aot.hint.RuntimeHintsRegistrar; <add>import org.springframework.aot.hint.TypeReference; <add>import org.springframework.aot.hint.support.RuntimeHintsUtils; <add> <add>import static java.util.Arrays.asList; <add> <add>/** <add> * {@link RuntimeHintsRegistrar} implementation that registers runtime hints for <add> * transaction management. <add> * <add> * @author Sebastien Deleuze <add> * @since 6.0 <add> */ <add>public class TransactionRuntimeHintsRegistrar implements RuntimeHintsRegistrar { <add> <add> @Override <add> public void registerHints(RuntimeHints hints, ClassLoader classLoader) { <add> RuntimeHintsUtils.registerAnnotation(hints, org.springframework.transaction.annotation.Transactional.class); <add> <add> hints.reflection() <add> .registerTypes(asList( <add> TypeReference.of(org.springframework.transaction.annotation.Isolation.class), <add> TypeReference.of(org.springframework.transaction.annotation.Propagation.class), <add> TypeReference.of(org.springframework.transaction.TransactionDefinition.class)), <add> builder -> builder.withMembers(MemberCategory.DECLARED_FIELDS)); <add> } <add>}
2
Text
Text
add build status to readme
09b43d72847876fe535f82cf19ebd5fc143b7c93
<ide><path>README.md <ide> native implementation. We are committed to improving and expanding the <ide> capabilities of this project as fast as we can, and look forward to working with <ide> the community. <ide> <del># React Native <add># React Native [![Build Status](https://magnum.travis-ci.com/facebook/react-native.svg?token=L5Egb3B4dyQzH5wDijCB&branch=master)](https://magnum.travis-ci.com/facebook/react-native) <ide> <ide> Our first React Native implementation is `ReactKit`, targeting iOS. We are also <ide> working on an Android implementation which we will release later. `ReactKit`
1
Javascript
Javascript
move earth radius constant to d3_geo_earthradius
0a1af36dcc11c229dfc826b74eea7f30cdb15bfa
<ide><path>d3.geo.js <ide> (function(){d3.geo = {}; <ide> <del>var d3_radians = Math.PI / 180; <add>var d3_radians = Math.PI / 180, <add> d3_geo_earthRadius = 6371; // Mean radius of Earth, in km. <ide> // TODO clip input coordinates on opposite hemisphere <ide> d3.geo.azimuthal = function() { <ide> var mode = "orthographic", // or stereographic, gnomonic, equidistant or equalarea <ide> d3.geo.greatCircle = function() { <ide> var source = d3_geo_greatCircleSource, <ide> target = d3_geo_greatCircleTarget, <ide> n = 100, <del> radius = 6371; // Mean radius of Earth, in km. <add> radius = d3_geo_earthRadius; <ide> // TODO: breakAtDateLine? <ide> <ide> function greatCircle(d, i) { <ide> function d3_geo_greatCircleTarget(d) { <ide> d3.geo.clip = function() { <ide> var origin = [0, 0], <ide> angle = 90, <del> r = 6371 * angle / 180 * Math.PI; <add> r = d3_geo_earthRadius * angle / 180 * Math.PI; <ide> <ide> function clip(d) { <ide> var o = {source: origin, target: null}, <ide> d3.geo.clip = function() { <ide> clip.angle = function(x) { <ide> if (!arguments.length) return angle; <ide> angle = +x; <del> r = 6371 * angle / 180 * Math.PI; <add> r = d3_geo_earthRadius * angle / 180 * Math.PI; <ide> return clip; <ide> }; <ide> <ide><path>d3.geo.min.js <del>(function(){function q(a,b,c){var d=-1,e=a.length,f=0,g=Infinity;while(++d<e){b.target=a[d];var h=Math.abs(p.distance(b)-c);h<g&&(g=h,f=d)}b.target=a[f];return f}function o(a){return a.target}function n(a){return a.source}function m(a,b){for(var c=a.coordinates[0],d=0,e=c.length;d<e;d++)b.apply(null,c[d])}function l(a,b){b.apply(null,a.coordinates)}function k(a,b){for(var c=a.coordinates,d=0,e=c.length;d<e;d++)for(var f=c[d][0],g=0,h=f.length;g<h;g++)b.apply(null,f[g])}function j(a,b){for(var c=a.coordinates,d=0,e=c.length;d<e;d++)for(var f=c[d],g=0,h=f.length;g<h;g++)b.apply(null,f[g])}function i(a,b){for(var c=a.coordinates,d=0,e=c.length;d<e;d++)b.apply(null,c[d])}function h(a,b){for(var c=a.features,d=0,f=c.length;d<f;d++)e(c[d].geometry,b)}function g(a,b){e(a.geometry,b)}function e(a,b){a.type in f&&f[a.type](a,b)}function d(a,b){return b&&b.type in a?a[b.type](b):""}function c(){return 0}function b(a){return"m0,"+a+"a"+a+","+a+" 0 1,1 0,"+ -2*a+"a"+a+","+a+" 0 1,1 0,"+2*a+"z"}d3.geo={};var a=Math.PI/180;d3.geo.azimuthal=function(){function j(c){var g=c[0]*a-f,j=c[1]*a,k=Math.cos(g),l=Math.sin(g),m=Math.cos(j),n=Math.sin(j),o=b!=="orthographic"?i*n+h*m*k:null,p,q=b==="stereographic"?1/(1+o):b==="gnomonic"?1/o:b==="equidistant"?(p=Math.acos(o),p/Math.sin(p)):b==="equalarea"?Math.sqrt(2/(1+o)):1,r=q*m*l,s=q*(i*m*k-h*n);return[d*r+e[0],d*s+e[1]]}var b="orthographic",c,d=200,e=[480,250],f,g,h,i;j.invert=function(c){var g=(c[0]-e[0])/d,j=(c[1]-e[1])/d,k=Math.sqrt(g*g+j*j),l=b==="stereographic"?2*Math.atan(k):b==="gnomonic"?Math.atan(k):b==="equidistant"?k:b==="equalarea"?2*Math.asin(.5*k):Math.asin(k),m=Math.sin(l),n=Math.cos(l);return[(f+Math.atan2(g*m,k*h*n+j*i*m))/a,Math.asin(n*i-j*m*h/k)/a]},j.mode=function(a){if(!arguments.length)return b;b=a+"";return j},j.origin=function(b){if(!arguments.length)return c;c=b,f=c[0]*a,g=c[1]*a,h=Math.cos(g),i=Math.sin(g);return j},j.scale=function(a){if(!arguments.length)return d;d=+a;return j},j.translate=function(a){if(!arguments.length)return e;e=[+a[0],+a[1]];return j};return j.origin([0,0])},d3.geo.albers=function(){function k(){var d=a*c[0],e=a*c[1],k=a*b[1],l=Math.sin(d),m=Math.cos(d);f=a*b[0],g=.5*(l+Math.sin(e)),h=m*m+2*g*l,i=Math.sqrt(h-2*g*Math.sin(k))/g;return j}function j(b){var c=g*(a*b[0]-f),j=Math.sqrt(h-2*g*Math.sin(a*b[1]))/g;return[d*j*Math.sin(c)+e[0],d*(j*Math.cos(c)-i)+e[1]]}var b=[-98,38],c=[29.5,45.5],d=1e3,e=[480,250],f,g,h,i;j.invert=function(b){var c=(b[0]-e[0])/d,j=(b[1]-e[1])/d,k=i+j,l=Math.atan2(c,k),m=Math.sqrt(c*c+k*k);return[(f+l/g)/a,Math.asin((h-m*m*g*g)/(2*g))/a]},j.origin=function(a){if(!arguments.length)return b;b=[+a[0],+a[1]];return k()},j.parallels=function(a){if(!arguments.length)return c;c=[+a[0],+a[1]];return k()},j.scale=function(a){if(!arguments.length)return d;d=+a;return j},j.translate=function(a){if(!arguments.length)return e;e=[+a[0],+a[1]];return j};return k()},d3.geo.albersUsa=function(){function e(e){var f=e[0],g=e[1];return(g>50?b:f<-140?c:g<21?d:a)(e)}var a=d3.geo.albers(),b=d3.geo.albers().origin([-160,60]).parallels([55,65]),c=d3.geo.albers().origin([-160,20]).parallels([8,18]),d=d3.geo.albers().origin([-60,10]).parallels([8,18]);e.scale=function(f){if(!arguments.length)return a.scale();a.scale(f),b.scale(f*.6),c.scale(f),d.scale(f*1.5);return e.translate(a.translate())},e.translate=function(f){if(!arguments.length)return a.translate();var g=a.scale()/1e3,h=f[0],i=f[1];a.translate(f),b.translate([h-400*g,i+170*g]),c.translate([h-190*g,i+200*g]),d.translate([h+580*g,i+430*g]);return e};return e.scale(a.scale())},d3.geo.mercator=function(){function d(d){var e=d[0]/360,f=-(Math.log(Math.tan(Math.PI/4+d[1]*a/2))/a)/360;return[b*e+c[0],b*Math.max(-0.5,Math.min(.5,f))+c[1]]}var b=500,c=[480,250];d.invert=function(d){var e=(d[0]-c[0])/b,f=(d[1]-c[1])/b;return[360*e,2*Math.atan(Math.exp(-360*f*a))/a-90]},d.scale=function(a){if(!arguments.length)return b;b=+a;return d},d.translate=function(a){if(!arguments.length)return c;c=[+a[0],+a[1]];return d};return d},d3.geo.path=function(){function o(a){return Math.abs(d3.geom.polygon(a.map(f)).area())}function m(a){var b=d3.geom.polygon(a[0].map(f)),c=b.centroid(1),d=c[0],e=c[1],g=Math.abs(b.area()),h=0,i=a.length;while(++h<i)b=d3.geom.polygon(a[h].map(f)),c=b.centroid(1),d-=c[0],e-=c[1],g-=Math.abs(b.area());return[d,e,6*g]}function l(a){var b=o(a[0]),c=0,d=a.length;while(++c<d)b-=o(a[c]);return b}function i(a){return f(a).join(",")}function h(c,f){typeof a=="function"&&(e=b(a.apply(this,arguments)));return d(j,c)}var a=4.5,e=b(a),f=d3.geo.albersUsa(),g=Object,j={FeatureCollection:function(a){var b=[],c=a.features,e=-1,f=c.length;while(++e<f)b.push(d(j,c[e].geometry));return b.join("")},Feature:function(a){return d(j,a.geometry)},Point:function(a){var b=g.call(this,[a.coordinates]);return b.length?"M"+i(b[0])+e:""},MultiPoint:function(a){var b=[],c=g.call(this,a.coordinates),d=-1,f=c.length;while(++d<f)b.push("M",i(c[d]),e);return b.join("")},LineString:function(a){var b=["M"],c=g.call(this,a.coordinates),d=-1,e=c.length;while(++d<e)b.push(i(c[d]),"L");b.pop();return b.join("")},MultiLineString:function(a){var b=[],c=a.coordinates,d=-1,e=c.length,f,h,j;while(++d<e){f=g.call(this,c[d]),h=-1,j=f.length,b.push("M");while(++h<j)b.push(i(f[h]),"L");b.pop()}return b.join("")},Polygon:function(a){var b=[],c=a.coordinates,d=-1,e=c.length,f,h,j;while(++d<e){f=g.call(this,c[d]),h=-1,j=f.length-1;if(j<1)continue;b.push("M");while(++h<j)b.push(i(f[h]),"L");b[b.length-1]="Z"}return b.join("")},MultiPolygon:function(a){var b=[],c=a.coordinates,d=-1,e=c.length,f,h,j,k,l,m;while(++d<e){f=c[d],h=-1,j=f.length;while(++h<j){k=g.call(this,f[h]),l=-1,m=k.length-1;if(m<1)continue;b.push("M");while(++l<m)b.push(i(k[l]),"L");b[b.length-1]="Z"}}return b.join("")},GeometryCollection:function(a){var b=[],c=a.geometries,e=-1,f=c.length;while(++e<f)b.push(d(j,c[e]));return b.join("")}},k={FeatureCollection:function(a){var b=0,c=a.features,e=-1,f=c.length;while(++e<f)b+=d(k,c[e]);return b},Feature:function(a){return d(k,a.geometry)},Point:c,MultiPoint:c,LineString:c,MultiLineString:c,Polygon:function(a){return l(a.coordinates)},MultiPolygon:function(a){var b=0,c=a.coordinates,d=-1,e=c.length;while(++d<e)b+=l(c[d]);return b},GeometryCollection:function(a){var b=0,c=a.geometries,e=-1,f=c.length;while(++e<f)b+=d(k,c[e]);return b}},n={Feature:function(a){return d(n,a.geometry)},Polygon:function(a){var b=m(a.coordinates);return[b[0]/b[2],b[1]/b[2]]},MultiPolygon:function(a){var b=0,c=a.coordinates,d,e=0,f=0,g=0,h=-1,i=c.length;while(++h<i)d=m(c[h]),e+=d[0],f+=d[1],g+=d[2];return[e/g,f/g]}};h.projection=function(a){f=a;return h},h.clip=function(a){if(!arguments.length)return g;g=a;return h},h.area=function(a){return d(k,a)},h.centroid=function(a){return d(n,a)},h.pointRadius=function(c){typeof c=="function"?a=c:(a=+c,e=b(a));return h};return h},d3.geo.bounds=function(a){var b=Infinity,c=Infinity,d=-Infinity,f=-Infinity;e(a,function(a,e){a<b&&(b=a),a>d&&(d=a),e<c&&(c=e),e>f&&(f=e)});return[[b,c],[d,f]]};var f={Feature:g,FeatureCollection:h,LineString:i,MultiLineString:j,MultiPoint:i,MultiPolygon:k,Point:l,Polygon:m};d3.geo.greatCircle=function(){function f(e,f){var g=b.call(this,e,f),h=c.call(this,e,f),i=g[0]*a,j=g[1]*a,k=h[0]*a,l=h[1]*a,m=Math.cos(i),n=Math.sin(i),o=Math.cos(j),p=Math.sin(j),q=Math.cos(k),r=Math.sin(k),s=Math.cos(l),t=Math.sin(l),e=Math.acos(p*t+o*s*Math.cos(k-i)),u=Math.sin(e),v=e/(d-1),w=-v,x=[],f=-1;while(++f<d){w+=v;var y=Math.sin(e-w)/u,z=Math.sin(w)/u,A=y*o*m+z*s*q,B=y*o*n+z*s*r,C=y*p+z*t;x[f]=[Math.atan2(B,A)/a,Math.atan2(C,Math.sqrt(A*A+B*B))/a]}return x}var b=n,c=o,d=100,e=6371;f.source=function(a){if(!arguments.length)return b;b=a;return f},f.target=function(a){if(!arguments.length)return c;c=a;return f},f.n=function(a){if(!arguments.length)return d;d=+a;return f},f.radius=function(a){if(!arguments.length)return e;e=+a;return f},f.distance=function(d,f){var g=b.call(this,d,f),h=c.call(this,d,f),i=g[0]*a,j=g[1]*a,k=h[0]*a,l=h[1]*a,m=Math.sin((l-j)/2),n=Math.sin((k-i)/2),o=m*m+Math.cos(j)*Math.cos(l)*n*n;return e*2*Math.atan2(Math.sqrt(o),Math.sqrt(1-o))};return f},d3.geo.clip=function(){function d(b){var d={source:a,target:null},e=b.length,f=-1,g,h,i=[],j=null,k=null;while(++f<e)d.target=b[f],distance=p.distance(d),distance<c?k?(h=p({source:k,target:d.target}),g=q(h,d,c),j&&i.push.apply(i,p({source:j,target:d.target})),i.push.apply(i,h.slice(g)),j=k=null):i.push(d.target):(k=d.target,!j&&i.length&&(h=p({source:i[i.length-1],target:d.target}),g=q(h,d,c),i.push.apply(i,h.slice(0,g)),j=d.target));k&&i.length&&(d.target=i[0],h=p({source:k,target:d.target}),g=q(h,d,c),j&&i.push.apply(i,p({source:j,target:d.target})),i.push.apply(i,h.slice(g)));return i}var a=[0,0],b=90,c=6371*b/180*Math.PI;d.origin=function(b){if(!arguments.length)return a;a=b;return d},d.angle=function(a){if(!arguments.length)return b;b=+a,c=6371*b/180*Math.PI;return d};return d};var p=d3.geo.greatCircle().n(100)})() <ide>\ No newline at end of file <add>(function(){function r(a,b,c){var d=-1,e=a.length,f=0,g=Infinity;while(++d<e){b.target=a[d];var h=Math.abs(q.distance(b)-c);h<g&&(g=h,f=d)}b.target=a[f];return f}function p(a){return a.target}function o(a){return a.source}function n(a,b){for(var c=a.coordinates[0],d=0,e=c.length;d<e;d++)b.apply(null,c[d])}function m(a,b){b.apply(null,a.coordinates)}function l(a,b){for(var c=a.coordinates,d=0,e=c.length;d<e;d++)for(var f=c[d][0],g=0,h=f.length;g<h;g++)b.apply(null,f[g])}function k(a,b){for(var c=a.coordinates,d=0,e=c.length;d<e;d++)for(var f=c[d],g=0,h=f.length;g<h;g++)b.apply(null,f[g])}function j(a,b){for(var c=a.coordinates,d=0,e=c.length;d<e;d++)b.apply(null,c[d])}function i(a,b){for(var c=a.features,d=0,e=c.length;d<e;d++)f(c[d].geometry,b)}function h(a,b){f(a.geometry,b)}function f(a,b){a.type in g&&g[a.type](a,b)}function e(a,b){return b&&b.type in a?a[b.type](b):""}function d(){return 0}function c(a){return"m0,"+a+"a"+a+","+a+" 0 1,1 0,"+ -2*a+"a"+a+","+a+" 0 1,1 0,"+2*a+"z"}d3.geo={};var a=Math.PI/180,b=6371;d3.geo.azimuthal=function(){function j(c){var g=c[0]*a-f,j=c[1]*a,k=Math.cos(g),l=Math.sin(g),m=Math.cos(j),n=Math.sin(j),o=b!=="orthographic"?i*n+h*m*k:null,p,q=b==="stereographic"?1/(1+o):b==="gnomonic"?1/o:b==="equidistant"?(p=Math.acos(o),p/Math.sin(p)):b==="equalarea"?Math.sqrt(2/(1+o)):1,r=q*m*l,s=q*(i*m*k-h*n);return[d*r+e[0],d*s+e[1]]}var b="orthographic",c,d=200,e=[480,250],f,g,h,i;j.invert=function(c){var g=(c[0]-e[0])/d,j=(c[1]-e[1])/d,k=Math.sqrt(g*g+j*j),l=b==="stereographic"?2*Math.atan(k):b==="gnomonic"?Math.atan(k):b==="equidistant"?k:b==="equalarea"?2*Math.asin(.5*k):Math.asin(k),m=Math.sin(l),n=Math.cos(l);return[(f+Math.atan2(g*m,k*h*n+j*i*m))/a,Math.asin(n*i-j*m*h/k)/a]},j.mode=function(a){if(!arguments.length)return b;b=a+"";return j},j.origin=function(b){if(!arguments.length)return c;c=b,f=c[0]*a,g=c[1]*a,h=Math.cos(g),i=Math.sin(g);return j},j.scale=function(a){if(!arguments.length)return d;d=+a;return j},j.translate=function(a){if(!arguments.length)return e;e=[+a[0],+a[1]];return j};return j.origin([0,0])},d3.geo.albers=function(){function k(){var d=a*c[0],e=a*c[1],k=a*b[1],l=Math.sin(d),m=Math.cos(d);f=a*b[0],g=.5*(l+Math.sin(e)),h=m*m+2*g*l,i=Math.sqrt(h-2*g*Math.sin(k))/g;return j}function j(b){var c=g*(a*b[0]-f),j=Math.sqrt(h-2*g*Math.sin(a*b[1]))/g;return[d*j*Math.sin(c)+e[0],d*(j*Math.cos(c)-i)+e[1]]}var b=[-98,38],c=[29.5,45.5],d=1e3,e=[480,250],f,g,h,i;j.invert=function(b){var c=(b[0]-e[0])/d,j=(b[1]-e[1])/d,k=i+j,l=Math.atan2(c,k),m=Math.sqrt(c*c+k*k);return[(f+l/g)/a,Math.asin((h-m*m*g*g)/(2*g))/a]},j.origin=function(a){if(!arguments.length)return b;b=[+a[0],+a[1]];return k()},j.parallels=function(a){if(!arguments.length)return c;c=[+a[0],+a[1]];return k()},j.scale=function(a){if(!arguments.length)return d;d=+a;return j},j.translate=function(a){if(!arguments.length)return e;e=[+a[0],+a[1]];return j};return k()},d3.geo.albersUsa=function(){function e(e){var f=e[0],g=e[1];return(g>50?b:f<-140?c:g<21?d:a)(e)}var a=d3.geo.albers(),b=d3.geo.albers().origin([-160,60]).parallels([55,65]),c=d3.geo.albers().origin([-160,20]).parallels([8,18]),d=d3.geo.albers().origin([-60,10]).parallels([8,18]);e.scale=function(f){if(!arguments.length)return a.scale();a.scale(f),b.scale(f*.6),c.scale(f),d.scale(f*1.5);return e.translate(a.translate())},e.translate=function(f){if(!arguments.length)return a.translate();var g=a.scale()/1e3,h=f[0],i=f[1];a.translate(f),b.translate([h-400*g,i+170*g]),c.translate([h-190*g,i+200*g]),d.translate([h+580*g,i+430*g]);return e};return e.scale(a.scale())},d3.geo.mercator=function(){function d(d){var e=d[0]/360,f=-(Math.log(Math.tan(Math.PI/4+d[1]*a/2))/a)/360;return[b*e+c[0],b*Math.max(-0.5,Math.min(.5,f))+c[1]]}var b=500,c=[480,250];d.invert=function(d){var e=(d[0]-c[0])/b,f=(d[1]-c[1])/b;return[360*e,2*Math.atan(Math.exp(-360*f*a))/a-90]},d.scale=function(a){if(!arguments.length)return b;b=+a;return d},d.translate=function(a){if(!arguments.length)return c;c=[+a[0],+a[1]];return d};return d},d3.geo.path=function(){function o(a){return Math.abs(d3.geom.polygon(a.map(f)).area())}function m(a){var b=d3.geom.polygon(a[0].map(f)),c=b.centroid(1),d=c[0],e=c[1],g=Math.abs(b.area()),h=0,i=a.length;while(++h<i)b=d3.geom.polygon(a[h].map(f)),c=b.centroid(1),d-=c[0],e-=c[1],g-=Math.abs(b.area());return[d,e,6*g]}function l(a){var b=o(a[0]),c=0,d=a.length;while(++c<d)b-=o(a[c]);return b}function i(a){return f(a).join(",")}function h(d,f){typeof a=="function"&&(b=c(a.apply(this,arguments)));return e(j,d)}var a=4.5,b=c(a),f=d3.geo.albersUsa(),g=Object,j={FeatureCollection:function(a){var b=[],c=a.features,d=-1,f=c.length;while(++d<f)b.push(e(j,c[d].geometry));return b.join("")},Feature:function(a){return e(j,a.geometry)},Point:function(a){var c=g.call(this,[a.coordinates]);return c.length?"M"+i(c[0])+b:""},MultiPoint:function(a){var c=[],d=g.call(this,a.coordinates),e=-1,f=d.length;while(++e<f)c.push("M",i(d[e]),b);return c.join("")},LineString:function(a){var b=["M"],c=g.call(this,a.coordinates),d=-1,e=c.length;while(++d<e)b.push(i(c[d]),"L");b.pop();return b.join("")},MultiLineString:function(a){var b=[],c=a.coordinates,d=-1,e=c.length,f,h,j;while(++d<e){f=g.call(this,c[d]),h=-1,j=f.length,b.push("M");while(++h<j)b.push(i(f[h]),"L");b.pop()}return b.join("")},Polygon:function(a){var b=[],c=a.coordinates,d=-1,e=c.length,f,h,j;while(++d<e){f=g.call(this,c[d]),h=-1,j=f.length-1;if(j<1)continue;b.push("M");while(++h<j)b.push(i(f[h]),"L");b[b.length-1]="Z"}return b.join("")},MultiPolygon:function(a){var b=[],c=a.coordinates,d=-1,e=c.length,f,h,j,k,l,m;while(++d<e){f=c[d],h=-1,j=f.length;while(++h<j){k=g.call(this,f[h]),l=-1,m=k.length-1;if(m<1)continue;b.push("M");while(++l<m)b.push(i(k[l]),"L");b[b.length-1]="Z"}}return b.join("")},GeometryCollection:function(a){var b=[],c=a.geometries,d=-1,f=c.length;while(++d<f)b.push(e(j,c[d]));return b.join("")}},k={FeatureCollection:function(a){var b=0,c=a.features,d=-1,f=c.length;while(++d<f)b+=e(k,c[d]);return b},Feature:function(a){return e(k,a.geometry)},Point:d,MultiPoint:d,LineString:d,MultiLineString:d,Polygon:function(a){return l(a.coordinates)},MultiPolygon:function(a){var b=0,c=a.coordinates,d=-1,e=c.length;while(++d<e)b+=l(c[d]);return b},GeometryCollection:function(a){var b=0,c=a.geometries,d=-1,f=c.length;while(++d<f)b+=e(k,c[d]);return b}},n={Feature:function(a){return e(n,a.geometry)},Polygon:function(a){var b=m(a.coordinates);return[b[0]/b[2],b[1]/b[2]]},MultiPolygon:function(a){var b=0,c=a.coordinates,d,e=0,f=0,g=0,h=-1,i=c.length;while(++h<i)d=m(c[h]),e+=d[0],f+=d[1],g+=d[2];return[e/g,f/g]}};h.projection=function(a){f=a;return h},h.clip=function(a){if(!arguments.length)return g;g=a;return h},h.area=function(a){return e(k,a)},h.centroid=function(a){return e(n,a)},h.pointRadius=function(d){typeof d=="function"?a=d:(a=+d,b=c(a));return h};return h},d3.geo.bounds=function(a){var b=Infinity,c=Infinity,d=-Infinity,e=-Infinity;f(a,function(a,f){a<b&&(b=a),a>d&&(d=a),f<c&&(c=f),f>e&&(e=f)});return[[b,c],[d,e]]};var g={Feature:h,FeatureCollection:i,LineString:j,MultiLineString:k,MultiPoint:j,MultiPolygon:l,Point:m,Polygon:n};d3.geo.greatCircle=function(){function g(b,f){var g=c.call(this,b,f),h=d.call(this,b,f),i=g[0]*a,j=g[1]*a,k=h[0]*a,l=h[1]*a,m=Math.cos(i),n=Math.sin(i),o=Math.cos(j),p=Math.sin(j),q=Math.cos(k),r=Math.sin(k),s=Math.cos(l),t=Math.sin(l),b=Math.acos(p*t+o*s*Math.cos(k-i)),u=Math.sin(b),v=b/(e-1),w=-v,x=[],f=-1;while(++f<e){w+=v;var y=Math.sin(b-w)/u,z=Math.sin(w)/u,A=y*o*m+z*s*q,B=y*o*n+z*s*r,C=y*p+z*t;x[f]=[Math.atan2(B,A)/a,Math.atan2(C,Math.sqrt(A*A+B*B))/a]}return x}var c=o,d=p,e=100,f=b;g.source=function(a){if(!arguments.length)return c;c=a;return g},g.target=function(a){if(!arguments.length)return d;d=a;return g},g.n=function(a){if(!arguments.length)return e;e=+a;return g},g.radius=function(a){if(!arguments.length)return f;f=+a;return g},g.distance=function(b,e){var g=c.call(this,b,e),h=d.call(this,b,e),i=g[0]*a,j=g[1]*a,k=h[0]*a,l=h[1]*a,m=Math.sin((l-j)/2),n=Math.sin((k-i)/2),o=m*m+Math.cos(j)*Math.cos(l)*n*n;return f*2*Math.atan2(Math.sqrt(o),Math.sqrt(1-o))};return g},d3.geo.clip=function(){function e(b){var c={source:a,target:null},e=b.length,f=-1,g,h,i=[],j=null,k=null;while(++f<e)c.target=b[f],distance=q.distance(c),distance<d?k?(h=q({source:k,target:c.target}),g=r(h,c,d),j&&i.push.apply(i,q({source:j,target:c.target})),i.push.apply(i,h.slice(g)),j=k=null):i.push(c.target):(k=c.target,!j&&i.length&&(h=q({source:i[i.length-1],target:c.target}),g=r(h,c,d),i.push.apply(i,h.slice(0,g)),j=c.target));k&&i.length&&(c.target=i[0],h=q({source:k,target:c.target}),g=r(h,c,d),j&&i.push.apply(i,q({source:j,target:c.target})),i.push.apply(i,h.slice(g)));return i}var a=[0,0],c=90,d=b*c/180*Math.PI;e.origin=function(b){if(!arguments.length)return a;a=b;return e},e.angle=function(a){if(!arguments.length)return c;c=+a,d=b*c/180*Math.PI;return e};return e};var q=d3.geo.greatCircle().n(100)})() <ide>\ No newline at end of file <ide><path>src/geo/clip.js <ide> d3.geo.clip = function() { <ide> var origin = [0, 0], <ide> angle = 90, <del> r = 6371 * angle / 180 * Math.PI; <add> r = d3_geo_earthRadius * angle / 180 * Math.PI; <ide> <ide> function clip(d) { <ide> var o = {source: origin, target: null}, <ide> d3.geo.clip = function() { <ide> clip.angle = function(x) { <ide> if (!arguments.length) return angle; <ide> angle = +x; <del> r = 6371 * angle / 180 * Math.PI; <add> r = d3_geo_earthRadius * angle / 180 * Math.PI; <ide> return clip; <ide> }; <ide> <ide><path>src/geo/geo.js <ide> d3.geo = {}; <ide> <del>var d3_radians = Math.PI / 180; <add>var d3_radians = Math.PI / 180, <add> d3_geo_earthRadius = 6371; // Mean radius of Earth, in km. <ide><path>src/geo/greatCircle.js <ide> d3.geo.greatCircle = function() { <ide> var source = d3_geo_greatCircleSource, <ide> target = d3_geo_greatCircleTarget, <ide> n = 100, <del> radius = 6371; // Mean radius of Earth, in km. <add> radius = d3_geo_earthRadius; <ide> // TODO: breakAtDateLine? <ide> <ide> function greatCircle(d, i) {
5
Ruby
Ruby
fix error with --installed
0c0cdf81051217e2ac6721c92aaa5dad57f29de7
<ide><path>Library/Homebrew/dev-cmd/audit.rb <ide> def audit <ide> end <ide> elsif args.installed? <ide> no_named_args = true <del> [Formula.installed, Cask::Cask.casks] <add> [Formula.installed, Cask::Caskroom.casks] <ide> elsif args.no_named? <ide> no_named_args = true <ide> [Formula.all, Cask::Cask.all]
1
Javascript
Javascript
improve description of `.flush()`
b62f33f29a14c528b0e6934a279edd6a8f2b8134
<ide><path>src/ngMock/angular-mocks.js <ide> function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { <ide> * @ngdoc method <ide> * @name $httpBackend#flush <ide> * @description <del> * Flushes pending requests in the order they arrived beginning at specified request using the trained responses. <del> * If there are no pending requests to flush when the method is called <del> * an exception is thrown (as this typically a sign of programming error). <del> * <del> * @param {number=} count Number of responses to flush. If undefined, <del> * all pending requests from `skip` will be flushed. <del> * @param {number=} [skip=0] Number of pending requests to skip before flushing. <del> * So it specifies the first request to flush. <add> * Flushes pending requests using the trained responses. Requests are flushed in the order they <add> * were made, but it is also possible to skip one or more requests (for example to have them <add> * flushed later). This is useful for simulating scenarios where responses arrive from the server <add> * in any order. <add> * <add> * If there are no pending requests to flush when the method is called, an exception is thrown (as <add> * this is typically a sign of programming error). <add> * <add> * @param {number=} count - Number of responses to flush. If undefined/null, all pending requests <add> * (starting after `skip`) will be flushed. <add> * @param {number=} [skip=0] - Number of pending requests to skip. For example, a value of `5` <add> * would skip the first 5 pending requests and start flushing from the 6th onwards. <ide> */ <ide> $httpBackend.flush = function(count, skip, digest) { <ide> if (digest !== false) $rootScope.$digest();
1
Java
Java
add "result" package under ~.web.reactive
341f23e0e666ce0a00090fe1cad91caa7cb5e97c
<ide><path>spring-web-reactive/src/main/java/org/springframework/http/client/reactive/package-info.java <del>/* <del> * Copyright 2002-2016 the original author or authors. <del> * <del> * Licensed under the Apache License, Version 2.0 (the "License"); <del> * you may not use this file except in compliance with the License. <del> * You may obtain a copy of the License at <del> * <del> * http://www.apache.org/licenses/LICENSE-2.0 <del> * <del> * Unless required by applicable law or agreed to in writing, software <del> * distributed under the License is distributed on an "AS IS" BASIS, <del> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <del> * See the License for the specific language governing permissions and <del> * limitations under the License. <del> */ <del> <ide> /** <ide> * Core package of the reactive client HTTP support. <ide> * Provides {@link org.springframework.http.client.reactive.ClientHttpRequest} <ide><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/handler/package-info.java <del>/* <del> * Copyright 2002-2016 the original author or authors. <del> * <del> * Licensed under the Apache License, Version 2.0 (the "License"); <del> * you may not use this file except in compliance with the License. <del> * You may obtain a copy of the License at <del> * <del> * http://www.apache.org/licenses/LICENSE-2.0 <del> * <del> * Unless required by applicable law or agreed to in writing, software <del> * distributed under the License is distributed on an "AS IS" BASIS, <del> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <del> * See the License for the specific language governing permissions and <del> * limitations under the License. <del> */ <del> <ide> /** <del> * Provides reactive HandlerMapping implementations. <add> * Provides standard HandlerMapping implementations, <add> * including abstract base classes for custom implementations. <ide> */ <ide> package org.springframework.web.reactive.handler; <ide><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/method/annotation/package-info.java <del>/* <del> * Copyright 2002-2016 the original author or authors. <del> * <del> * Licensed under the Apache License, Version 2.0 (the "License"); <del> * you may not use this file except in compliance with the License. <del> * You may obtain a copy of the License at <del> * <del> * http://www.apache.org/licenses/LICENSE-2.0 <del> * <del> * Unless required by applicable law or agreed to in writing, software <del> * distributed under the License is distributed on an "AS IS" BASIS, <del> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <del> * See the License for the specific language governing permissions and <del> * limitations under the License. <del> */ <del> <del>/** <del> * Reactive infrastructure for annotation-based handler method processing. <del> */ <del>package org.springframework.web.reactive.method.annotation; <ide><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/method/package-info.java <del>/* <del> * Copyright 2002-2016 the original author or authors. <del> * <del> * Licensed under the Apache License, Version 2.0 (the "License"); <del> * you may not use this file except in compliance with the License. <del> * You may obtain a copy of the License at <del> * <del> * http://www.apache.org/licenses/LICENSE-2.0 <del> * <del> * Unless required by applicable law or agreed to in writing, software <del> * distributed under the License is distributed on an "AS IS" BASIS, <del> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <del> * See the License for the specific language governing permissions and <del> * limitations under the License. <del> */ <del> <del>/** <del> * Reactive infrastructure for handler method processing. <del> */ <del>package org.springframework.web.reactive.method; <ide><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/package-info.java <del>/* <del> * Copyright 2002-2016 the original author or authors. <del> * <del> * Licensed under the Apache License, Version 2.0 (the "License"); <del> * you may not use this file except in compliance with the License. <del> * You may obtain a copy of the License at <del> * <del> * http://www.apache.org/licenses/LICENSE-2.0 <del> * <del> * Unless required by applicable law or agreed to in writing, software <del> * distributed under the License is distributed on an "AS IS" BASIS, <del> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <del> * See the License for the specific language governing permissions and <del> * limitations under the License. <del> */ <del> <ide> /** <del> * Provides the core interfaces and classes for the Spring web reactive framework. <add> * Core interfaces and classes for Spring Web Reactive. <ide> */ <ide> package org.springframework.web.reactive; <add><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/result/SimpleResultHandler.java <del><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/handler/SimpleResultHandler.java <ide> * limitations under the License. <ide> */ <ide> <del>package org.springframework.web.reactive.handler; <add>package org.springframework.web.reactive.result; <ide> <ide> import java.util.Optional; <ide> <add><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/result/WebHandlerHandlerAdapter.java <del><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/handler/WebHandlerHandlerAdapter.java <ide> * limitations under the License. <ide> */ <ide> <del>package org.springframework.web.reactive.handler; <add>package org.springframework.web.reactive.result; <ide> <ide> import org.reactivestreams.Publisher; <ide> import reactor.core.publisher.Mono; <ide> <ide> import org.springframework.core.ResolvableType; <del>import org.springframework.ui.ExtendedModelMap; <del>import org.springframework.ui.ModelMap; <ide> import org.springframework.web.reactive.DispatcherHandler; <ide> import org.springframework.web.reactive.HandlerAdapter; <ide> import org.springframework.web.reactive.HandlerResult; <add><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/HandlerMethodArgumentResolver.java <del><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/method/HandlerMethodArgumentResolver.java <ide> * limitations under the License. <ide> */ <ide> <del>package org.springframework.web.reactive.method; <add>package org.springframework.web.reactive.result.method; <ide> <ide> import reactor.core.publisher.Mono; <ide> <add><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/InvocableHandlerMethod.java <del><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/method/InvocableHandlerMethod.java <ide> * limitations under the License. <ide> */ <ide> <del>package org.springframework.web.reactive.method; <add>package org.springframework.web.reactive.result.method; <ide> <ide> import java.lang.reflect.InvocationTargetException; <ide> import java.lang.reflect.Method; <add><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/ModelArgumentResolver.java <del><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/method/annotation/ModelArgumentResolver.java <ide> * See the License for the specific language governing permissions and <ide> * limitations under the License. <ide> */ <del>package org.springframework.web.reactive.method.annotation; <add>package org.springframework.web.reactive.result.method.annotation; <ide> <ide> import reactor.core.publisher.Mono; <ide> <ide> import org.springframework.core.MethodParameter; <ide> import org.springframework.ui.Model; <ide> import org.springframework.ui.ModelMap; <del>import org.springframework.web.reactive.method.HandlerMethodArgumentResolver; <add>import org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver; <ide> import org.springframework.web.server.ServerWebExchange; <ide> <ide> /** <add><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestBodyArgumentResolver.java <del><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/method/annotation/RequestBodyArgumentResolver.java <ide> * limitations under the License. <ide> */ <ide> <del>package org.springframework.web.reactive.method.annotation; <add>package org.springframework.web.reactive.result.method.annotation; <ide> <ide> import java.util.List; <ide> <ide> import org.springframework.ui.ModelMap; <ide> import org.springframework.util.Assert; <ide> import org.springframework.web.bind.annotation.RequestBody; <del>import org.springframework.web.reactive.method.HandlerMethodArgumentResolver; <add>import org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver; <ide> import org.springframework.web.server.ServerWebExchange; <ide> <ide> /** <add><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestMappingHandlerAdapter.java <del><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/method/annotation/RequestMappingHandlerAdapter.java <ide> * limitations under the License. <ide> */ <ide> <del>package org.springframework.web.reactive.method.annotation; <add>package org.springframework.web.reactive.result.method.annotation; <ide> <ide> import java.lang.reflect.Method; <ide> import java.util.ArrayList; <ide> import org.springframework.web.method.annotation.ExceptionHandlerMethodResolver; <ide> import org.springframework.web.reactive.HandlerAdapter; <ide> import org.springframework.web.reactive.HandlerResult; <del>import org.springframework.web.reactive.method.HandlerMethodArgumentResolver; <del>import org.springframework.web.reactive.method.InvocableHandlerMethod; <add>import org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver; <add>import org.springframework.web.reactive.result.method.InvocableHandlerMethod; <ide> import org.springframework.web.server.ServerWebExchange; <ide> <ide> <add><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestMappingHandlerMapping.java <del><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/method/annotation/RequestMappingHandlerMapping.java <ide> * limitations under the License. <ide> */ <ide> <del>package org.springframework.web.reactive.method.annotation; <add>package org.springframework.web.reactive.result.method.annotation; <ide> <ide> import java.util.Arrays; <ide> import java.util.Collection; <add><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestParamArgumentResolver.java <del><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/method/annotation/RequestParamArgumentResolver.java <ide> * limitations under the License. <ide> */ <ide> <del>package org.springframework.web.reactive.method.annotation; <add>package org.springframework.web.reactive.result.method.annotation; <ide> <ide> import reactor.core.publisher.Mono; <ide> <ide> import org.springframework.core.MethodParameter; <ide> import org.springframework.ui.ModelMap; <ide> import org.springframework.web.bind.annotation.RequestParam; <del>import org.springframework.web.reactive.method.HandlerMethodArgumentResolver; <add>import org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver; <ide> import org.springframework.web.server.ServerWebExchange; <ide> import org.springframework.web.util.UriComponents; <ide> import org.springframework.web.util.UriComponentsBuilder; <add><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/ResponseBodyResultHandler.java <del><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/method/annotation/ResponseBodyResultHandler.java <ide> * limitations under the License. <ide> */ <ide> <del>package org.springframework.web.reactive.method.annotation; <add>package org.springframework.web.reactive.result.method.annotation; <ide> <ide> import java.util.ArrayList; <ide> import java.util.Collections; <ide><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/package-info.java <add>/** <add> * Infrastructure for annotation-based handler method processing. <add> */ <add>package org.springframework.web.reactive.result.method.annotation; <ide><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/package-info.java <add>/** <add> * Infrastructure for handler method processing. <add> */ <add>package org.springframework.web.reactive.result.method; <ide><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/result/package-info.java <add>/** <add> * Provides various controller styles for request handling. <add> */ <add>package org.springframework.web.reactive.result; <ide><path>spring-web-reactive/src/test/java/org/springframework/core/codec/support/jaxb/package-info.java <del>/* <del> * Copyright 2002-2016 the original author or authors. <del> * <del> * Licensed under the Apache License, Version 2.0 (the "License"); <del> * you may not use this file except in compliance with the License. <del> * You may obtain a copy of the License at <del> * <del> * http://www.apache.org/licenses/LICENSE-2.0 <del> * <del> * Unless required by applicable law or agreed to in writing, software <del> * distributed under the License is distributed on an "AS IS" BASIS, <del> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <del> * See the License for the specific language governing permissions and <del> * limitations under the License. <del> */ <del> <ide> @javax.xml.bind.annotation.XmlSchema(namespace = "namespace") <ide> package org.springframework.core.codec.support.jaxb; <ide><path>spring-web-reactive/src/test/java/org/springframework/web/reactive/DispatcherHandlerErrorTests.java <ide> import org.springframework.web.bind.annotation.RequestBody; <ide> import org.springframework.web.bind.annotation.RequestMapping; <ide> import org.springframework.web.bind.annotation.ResponseBody; <del>import org.springframework.web.reactive.method.annotation.RequestMappingHandlerAdapter; <del>import org.springframework.web.reactive.method.annotation.RequestMappingHandlerMapping; <del>import org.springframework.web.reactive.method.annotation.ResponseBodyResultHandler; <add>import org.springframework.web.reactive.result.method.annotation.RequestMappingHandlerAdapter; <add>import org.springframework.web.reactive.result.method.annotation.RequestMappingHandlerMapping; <add>import org.springframework.web.reactive.result.method.annotation.ResponseBodyResultHandler; <ide> import org.springframework.web.server.ServerWebExchange; <ide> import org.springframework.web.server.WebExceptionHandler; <ide> import org.springframework.web.server.WebFilter; <add><path>spring-web-reactive/src/test/java/org/springframework/web/reactive/result/SimpleResultHandlerTests.java <del><path>spring-web-reactive/src/test/java/org/springframework/web/reactive/handler/SimpleResultHandlerTests.java <ide> * limitations under the License. <ide> */ <ide> <del>package org.springframework.web.reactive.handler; <add>package org.springframework.web.reactive.result; <ide> <ide> import java.util.concurrent.CompletableFuture; <ide> <ide> import org.springframework.core.convert.support.ReactiveStreamsToRxJava1Converter; <ide> import org.springframework.web.method.HandlerMethod; <ide> import org.springframework.web.reactive.HandlerResult; <add>import org.springframework.web.reactive.result.SimpleResultHandler; <ide> <ide> import static org.junit.Assert.assertFalse; <ide> import static org.junit.Assert.assertTrue; <add><path>spring-web-reactive/src/test/java/org/springframework/web/reactive/result/WebHandlerIntegrationTests.java <del><path>spring-web-reactive/src/test/java/org/springframework/web/reactive/handler/WebHandlerIntegrationTests.java <ide> * limitations under the License. <ide> */ <ide> <del>package org.springframework.web.reactive.handler; <add>package org.springframework.web.reactive.result; <ide> <ide> import java.net.URI; <ide> import java.nio.charset.Charset; <ide> import org.springframework.web.client.RestTemplate; <ide> import org.springframework.web.reactive.DispatcherHandler; <ide> import org.springframework.web.reactive.ResponseStatusExceptionHandler; <add>import org.springframework.web.reactive.handler.SimpleUrlHandlerMapping; <add>import org.springframework.web.reactive.result.SimpleResultHandler; <add>import org.springframework.web.reactive.result.WebHandlerHandlerAdapter; <ide> import org.springframework.web.server.WebHandler; <ide> import org.springframework.web.server.ServerWebExchange; <ide> import org.springframework.web.server.adapter.WebHttpHandlerBuilder; <add><path>spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/InvocableHandlerMethodTests.java <del><path>spring-web-reactive/src/test/java/org/springframework/web/reactive/method/InvocableHandlerMethodTests.java <ide> * See the License for the specific language governing permissions and <ide> * limitations under the License. <ide> */ <del>package org.springframework.web.reactive.method; <add>package org.springframework.web.reactive.result.method; <ide> <ide> import java.lang.reflect.Method; <ide> import java.net.URI; <ide> import org.springframework.web.bind.annotation.RequestParam; <ide> import org.springframework.web.method.HandlerMethod; <ide> import org.springframework.web.reactive.HandlerResult; <del>import org.springframework.web.reactive.method.annotation.RequestParamArgumentResolver; <add>import org.springframework.web.reactive.result.method.annotation.RequestParamArgumentResolver; <ide> import org.springframework.web.server.ServerWebExchange; <ide> import org.springframework.web.server.adapter.DefaultServerWebExchange; <ide> import org.springframework.web.server.session.WebSessionManager; <add><path>spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestMappingHandlerMappingTests.java <del><path>spring-web-reactive/src/test/java/org/springframework/web/reactive/method/annotation/RequestMappingHandlerMappingTests.java <ide> * limitations under the License. <ide> */ <ide> <del>package org.springframework.web.reactive.method.annotation; <add>package org.springframework.web.reactive.result.method.annotation; <ide> <ide> import java.net.URI; <ide> import java.util.List; <add><path>spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestMappingIntegrationTests.java <del><path>spring-web-reactive/src/test/java/org/springframework/web/reactive/method/annotation/RequestMappingIntegrationTests.java <ide> * limitations under the License. <ide> */ <ide> <del>package org.springframework.web.reactive.method.annotation; <add>package org.springframework.web.reactive.result.method.annotation; <ide> <ide> import java.net.URI; <ide> import java.nio.ByteBuffer; <ide> import org.springframework.web.client.RestTemplate; <ide> import org.springframework.web.reactive.DispatcherHandler; <ide> import org.springframework.web.reactive.ViewResolver; <del>import org.springframework.web.reactive.handler.SimpleResultHandler; <add>import org.springframework.web.reactive.result.SimpleResultHandler; <ide> import org.springframework.web.reactive.view.ViewResolverResultHandler; <ide> import org.springframework.web.reactive.view.freemarker.FreeMarkerConfigurer; <ide> import org.springframework.web.reactive.view.freemarker.FreeMarkerViewResolver; <add><path>spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ResponseBodyResultHandlerTests.java <del><path>spring-web-reactive/src/test/java/org/springframework/web/reactive/method/annotation/ResponseBodyResultHandlerTests.java <ide> * limitations under the License. <ide> */ <ide> <del>package org.springframework.web.reactive.method.annotation; <add>package org.springframework.web.reactive.result.method.annotation; <ide> <ide> import java.util.Collections; <ide>
26
Javascript
Javascript
remove unused exec param
8a41470c85536119a6dbeaf4b40dc9ebc4c453c4
<ide><path>lib/child_process.js <ide> function normalizeExecArgs(command, options, callback) { <ide> } <ide> <ide> <del>exports.exec = function exec(command /* , options, callback */) { <del> var opts = normalizeExecArgs.apply(null, arguments); <add>exports.exec = function exec(/* command , options, callback */) { <add> const opts = normalizeExecArgs.apply(null, arguments); <ide> return exports.execFile(opts.file, <ide> opts.options, <ide> opts.callback);
1
Javascript
Javascript
change error message on interpolation
cb1bdf1e37236f5147ee5ef745573c0ced1b4f14
<ide><path>Libraries/Animated/src/nodes/AnimatedInterpolation.js <ide> function checkValidInputRange(arr: Array<number>) { <ide> * mean this implicit string conversion, you can do something like <ide> * String(myThing) <ide> */ <del> 'inputRange must be monotonically increasing ' + arr, <add> 'inputRange must be monotonically non-decreasing ' + arr, <ide> ); <ide> } <ide> }
1
Ruby
Ruby
add missing spaces to button_tag api doc [ci skip]
61075cb79c60ee11fb9050b1a39fa8dcbcd0d71d
<ide><path>actionview/lib/action_view/helpers/form_tag_helper.rb <ide> def submit_tag(value = "Save changes", options = {}) <ide> end <ide> <ide> # Creates a button element that defines a <tt>submit</tt> button, <del> # <tt>reset</tt>button or a generic button which can be used in <add> # <tt>reset</tt> button or a generic button which can be used in <ide> # JavaScript, for example. You can use the button tag as a regular <ide> # submit tag but it isn't supported in legacy browsers. However, <ide> # the button tag does allow for richer labels such as images and emphasis,
1
Javascript
Javascript
remove unreachable branch
fbc29164ea01f943fd91ac77794868caa5f7487e
<ide><path>lib/internal/util/inspect.js <ide> function noPrototypeIterator(ctx, value, recurseTimes) { <ide> } else if (Array.isArray(value)) { <ide> const clazz = Object.getPrototypeOf(value) || <ide> clazzWithNullPrototype(Array, 'Array'); <del> newVal = new clazz(value.length || 0); <add> newVal = new clazz(value.length); <ide> } else if (isTypedArray(value)) { <ide> let clazz = Object.getPrototypeOf(value); <ide> if (!clazz) {
1
Text
Text
add russian translation
5e552cd3df7694055516c4505be5218c3d42b02a
<ide><path>guide/russian/vagrant/index.md <ide> title: Vagrant <ide> localeTitle: бродяга <ide> --- <del>## бродяга <add>## Vagrant <ide> <del>Это заглушка. [Помогите нашему сообществу расширить его](https://github.com/freecodecamp/guides/tree/master/src/pages/mathematics/quadratic-equations/index.md) . <add>Vagrant это программа для создания и использования виртуальных машин, позволяет легко вносить и видить внесенные изменения очень быстро. Сведения о системе и о програмном обеспечении хранятся в `Vagrantfile`, это позволяет всей команде работать над проектом, вне зависимости какой компьютер они используют. <ide> <del>[Это руководство по быстрому стилю поможет вам принять ваш запрос на тягу](https://github.com/freecodecamp/guides/blob/master/README.md) . <del> <del>#### Дополнительная информация: <ide>\ No newline at end of file <add>#### Дополнительная информация: <add>1. [Официальная Документация](https://www.vagrantup.com/docs/index.html) <add>2. [Как Начать](https://www.vagrantup.com/intro/getting-started/index.html)
1
Ruby
Ruby
link cellar and opt before the keg
be45e6a0c52b02508aef17f0a9b16ebf6976d006
<ide><path>Library/Homebrew/migrator.rb <ide> def migrate <ide> unlink_oldname <ide> move_to_new_directory <ide> repin <del> link_newname unless old_linked_keg.nil? <del> link_oldname_opt <ide> link_oldname_cellar <add> link_oldname_opt <add> link_newname unless old_linked_keg.nil? <ide> update_tabs <ide> rescue Interrupt <ide> ignore_interrupts { backup_oldname }
1
Ruby
Ruby
prevent a 500 in the default controller scaffold
c83ace7b6a5720be30a2f7d843d545fc81af54cd
<ide><path>railties/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb <ide> def set_<%= singular_table_name %> <ide> # Only allow a trusted parameter "white list" through. <ide> def <%= "#{singular_table_name}_params" %> <ide> <%- if attributes_names.empty? -%> <del> params[:<%= singular_table_name %>] <add> params.fetch(:<%= singular_table_name %>, {}) <ide> <%- else -%> <ide> params.require(:<%= singular_table_name %>).permit(<%= attributes_names.map { |name| ":#{name}" }.join(', ') %>) <ide> <%- end -%> <ide><path>railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb <ide> def set_<%= singular_table_name %> <ide> # Only allow a trusted parameter "white list" through. <ide> def <%= "#{singular_table_name}_params" %> <ide> <%- if attributes_names.empty? -%> <del> params[:<%= singular_table_name %>] <add> params.fetch(:<%= singular_table_name %>, {}) <ide> <%- else -%> <ide> params.require(:<%= singular_table_name %>).permit(<%= attributes_names.map { |name| ":#{name}" }.join(', ') %>) <ide> <%- end -%> <ide><path>railties/test/generators/scaffold_controller_generator_test.rb <ide> def test_dont_use_require_or_permit_if_there_are_no_attributes <ide> <ide> assert_file "app/controllers/users_controller.rb" do |content| <ide> assert_match(/def user_params/, content) <del> assert_match(/params\[:user\]/, content) <add> assert_match(/params\.fetch\(:user, \{\}\)/, content) <ide> end <ide> end <ide>
3
Ruby
Ruby
add checks for the header package
296f3c309ed4a44a550e454fc18a306749f06e86
<ide><path>Library/Homebrew/os/mac/xcode.rb <ide> module CLT <ide> <ide> STANDALONE_PKG_ID = "com.apple.pkg.DeveloperToolsCLILeo".freeze <ide> FROM_XCODE_PKG_ID = "com.apple.pkg.DeveloperToolsCLI".freeze <del> MAVERICKS_PKG_ID = "com.apple.pkg.CLTools_Executables".freeze <add> # EXECUTABLE_PKG_ID now means two things: <add> # 1. The original Mavericks CLT package ID, and <add> # 2. The additional header package included in Mojave. <add> EXECUTABLE_PKG_ID = "com.apple.pkg.CLTools_Executables".freeze <ide> MAVERICKS_NEW_PKG_ID = "com.apple.pkg.CLTools_Base".freeze # obsolete <ide> PKG_PATH = "/Library/Developer/CommandLineTools".freeze <add> HEADER_PKG_PATH = "/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_:macos_version.pkg".freeze <ide> <ide> # Returns true even if outdated tools are installed, e.g. <ide> # tools from Xcode 4.x on 10.9 <ide> def installed? <ide> !version.null? <ide> end <ide> <add> def separate_header_package? <add> MacOS.version >= :mojave <add> end <add> <add> def headers_installed? <add> if !separate_header_package? <add> installed? <add> else <add> headers_version == version <add> end <add> end <add> <ide> def update_instructions <ide> if MacOS.version >= "10.9" <ide> <<~EOS <ide> def version <ide> end <ide> end <ide> <add> # Version string of the header package, which is a <add> # separate package as of macOS 10.14. <add> def headers_version <add> if !separate_header_package? <add> version <add> else <add> @header_version ||= MacOS.pkgutil_info(EXECUTABLE_PKG_ID)[/version: (.+)$/, 1] <add> return ::Version::NULL unless @header_version <add> ::Version.new(@header_version) <add> end <add> end <add> <ide> def detect_version <ide> # CLT isn't a distinct entity pre-4.3, and pkgutil doesn't exist <ide> # at all on Tiger, so just count it as installed if Xcode is installed <ide> def detect_version <ide> end <ide> <ide> version = nil <del> [MAVERICKS_PKG_ID, MAVERICKS_NEW_PKG_ID, STANDALONE_PKG_ID, FROM_XCODE_PKG_ID].each do |id| <add> [EXECUTABLE_PKG_ID, MAVERICKS_NEW_PKG_ID, STANDALONE_PKG_ID, FROM_XCODE_PKG_ID].each do |id| <ide> if MacOS.version >= :mavericks <ide> next unless File.exist?("#{PKG_PATH}/usr/bin/clang") <ide> end
1
Javascript
Javascript
remove ability to inject arbitrary scripts
8a6cd3cd12932e5c6dfea9529c8cbafb9be46445
<ide><path>packages/react-devtools-extensions/src/inject.js <ide> <ide> export default function inject(scriptName: string, done: ?Function) { <ide> const source = ` <add> // the prototype stuff is in case document.createElement has been modified <ide> (function () { <del> window.postMessage({ source: 'react-devtools-inject-script', scriptName: "${scriptName}" }, "*"); <add> var script = document.constructor.prototype.createElement.call(document, 'script'); <add> script.src = "${scriptName}"; <add> script.charset = "utf-8"; <add> document.documentElement.appendChild(script); <add> script.parentNode.removeChild(script); <ide> })() <ide> `; <ide> <ide> export default function inject(scriptName: string, done: ?Function) { <ide> done(); <ide> } <ide> }); <del>} <ide>\ No newline at end of file <add>} <ide><path>packages/react-devtools-extensions/src/injectGlobalHook.js <ide> window.addEventListener('message', function(evt) { <ide> reactBuildType: evt.data.reactBuildType, <ide> }; <ide> chrome.runtime.sendMessage(lastDetectionResult); <del> } else if (evt.data.source === 'react-devtools-inject-script' && evt.data.scriptName) { <add> } else if (evt.data.source === 'react-devtools-inject-backend') { <ide> //Inject the specified script <ide> var script = document.constructor.prototype.createElement.call(document, 'script'); <del> script.src = evt.data.scriptName; <add> script.src = chrome.runtime.getURL('build/backend.js'); <ide> script.charset = "utf-8"; <ide> document.documentElement.appendChild(script); <ide> script.parentNode.removeChild(script); <ide><path>packages/react-devtools-extensions/src/main.js <ide> function createPanelIfReactLoaded() { <ide> <ide> // Initialize the backend only once the Store has been initialized. <ide> // Otherwise the Store may miss important initial tree op codes. <del> inject(chrome.runtime.getURL('build/backend.js')); <add> chrome.devtools.inspectedWindow.eval( <add> `window.postMessage({ source: 'react-devtools-inject-backend' });`, <add> function(response, error) { <add> if (error) { <add> console.log(error); <add> } <add> <add> if (typeof done === 'function') { <add> done(); <add> } <add> } <add> ); <ide> <ide> const viewElementSourceFunction = createViewElementSource( <ide> bridge,
3
Text
Text
add missing paginator in docs
3785281d4c0830cdeac901e222e667eff42cfa54
<ide><path>docs/topics/3.2-announcement.md <ide> The following pagination view attributes and settings have been moved into attri <ide> * `view.max_paginate_by` - Use `paginator.max_page_size` instead. <ide> * `settings.PAGINATE_BY` - Use `paginator.page_size` instead. <ide> * `settings.PAGINATE_BY_PARAM` - Use `paginator.page_size_query_param` instead. <del>* `settings.MAX_PAGINATE_BY` - Use `max_page_size` instead. <add>* `settings.MAX_PAGINATE_BY` - Use `paginator.max_page_size` instead. <ide> <ide> ## Modifications to list behaviors <ide>
1
Python
Python
fix broken example
372e945097f8e5e9ba3637eff84ee119c46c2276
<ide><path>examples/sandbox/views.py <ide> def get(self, request): <ide> 'url': reverse('blog-posts-root', request=request)}, <ide> {'name': 'Permissions example', <ide> 'url': reverse('permissions-example', request=request)}, <del> {'name': 'Simple request mixin example', <del> 'url': reverse('request-example', request=request)} <ide> ])
1
Javascript
Javascript
add classbinding test
9945d946d3527685c437604c19060919adc5d03d
<ide><path>packages/ember-glimmer/tests/integration/components/curly-components-test.js <ide> moduleFor('Components test: curly components', class extends RenderingTest { <ide> this.assertComponentElement(this.firstChild, { tagName: 'div', attrs: { 'class': classes('ember-view foo bar') }, content: 'hello' }); <ide> } <ide> <add> ['@htmlbars it should apply classBinding without condition always']() { <add> this.registerComponent('foo-bar', { template: 'hello' }); <add> <add> this.render('{{foo-bar classBinding=":foo"}}'); <add> <add> this.assertComponentElement(this.firstChild, { tagName: 'div', content: 'hello', attrs: {'class': classes('foo ember-view') } }); <add> <add> this.runTask(() => this.rerender()); <add> <add> this.assertComponentElement(this.firstChild, { tagName: 'div', content: 'hello', attrs: {'class': classes('foo ember-view') } }); <add> } <add> <ide> ['@htmlbars should not apply falsy class name']() { <ide> this.registerComponent('foo-bar', { template: 'hello' }); <ide>
1
Javascript
Javascript
remove monthly plans from client
a2c7659f2d3c8ad9f56fda3ec3aeb76fc9564511
<ide><path>config/donation-settings.js <ide> require('dotenv').config({ path: path.resolve(__dirname, '../.env') }); <ide> // Configuration for client side <ide> const durationsConfig = { <ide> year: 'yearly', <del> month: 'monthly', <add> // month: 'monthly', <ide> onetime: 'one-time' <ide> }; <ide> const amountsConfig = { <ide> year: [100000, 25000, 6000], <del> month: [5000, 3500, 500], <add> // month: [5000, 3500, 500], <ide> onetime: [100000, 25000, 3500] <ide> }; <ide> const defaultAmount = { <ide> const defaultAmount = { <ide> onetime: 25000 <ide> }; <ide> const defaultStateConfig = { <del> donationAmount: defaultAmount['month'], <del> donationDuration: 'month' <add> donationAmount: defaultAmount['year'], <add> donationDuration: 'year' <ide> }; <ide> const modalDefaultStateConfig = { <ide> donationAmount: 6000,
1
Python
Python
teach gyp to write an 'all deps' rule
920c13203df434278eb7c34a485e89734a5fa62a
<ide><path>tools/gyp/pylib/gyp/generator/make.py <ide> def CalculateMakefilePath(build_file, base_name): <ide> for target in gyp.common.AllTargets(target_list, target_dicts, build_file): <ide> needed_targets.add(target) <ide> <add> all_deps = set() <ide> build_files = set() <ide> include_list = set() <ide> for qualified_target in target_list: <ide> def CalculateMakefilePath(build_file, base_name): <ide> os.path.dirname(makefile_path)) <ide> include_list.add(mkfile_rel_path) <ide> <add> if 'actions' in spec: <add> for action in spec['actions']: <add> all_deps.update(map(writer.Absolutify, action['inputs'])) <add> if 'sources' in spec: <add> all_deps.update(map(writer.Absolutify, spec['sources'])) <add> <ide> # Write out per-gyp (sub-project) Makefiles. <ide> depth_rel_path = gyp.common.RelativePath(options.depth, os.getcwd()) <ide> for build_file in build_files: <ide> def CalculateMakefilePath(build_file, base_name): <ide> root_makefile.write(SHARED_FOOTER) <ide> <ide> root_makefile.close() <add> <add> # Hack to get rid of $(obj)/path/to/foo.o deps that node.gyp adds manually. <add> all_deps = [s for s in all_deps if not '$' in s] <add> all_deps_path = os.path.join(options.toplevel_dir, '.deps') <add> with open(all_deps_path, 'w') as f: <add> f.write('ALL_DEPS := \\\n\t') <add> f.write(' \\\n\t'.join(sorted(all_deps)))
1
Python
Python
remove useless semicolon
a572f1b3e6e3ab4469e714098d9cea57361d52b0
<ide><path>numpy/core/code_generators/generate_umath.py <ide> def make_code(funcdict, filename): <ide> %s <ide> } <ide> """ % (filename, code1, code2, code3) <del> return code; <add> return code <ide> <ide> <ide> if __name__ == "__main__": <ide><path>numpy/linalg/linalg.py <ide> def pinv(a, rcond=1e-15 ): <ide> if s[i] > cutoff: <ide> s[i] = 1./s[i] <ide> else: <del> s[i] = 0.; <add> s[i] = 0. <ide> res = dot(transpose(vt), multiply(s[:, newaxis], transpose(u))) <ide> return wrap(res) <ide>
2
Javascript
Javascript
fix some issues with three.animation
037c5d51abb1b630a2c46c198c234708d2199268
<ide><path>src/extras/animation/Animation.js <ide> THREE.Animation = function ( root, name ) { <ide> <ide> this.interpolationType = THREE.AnimationHandler.LINEAR; <ide> <del> this.points = []; <del> this.target = new THREE.Vector3(); <del> <ide> }; <ide> <ide> THREE.Animation.prototype.play = function ( startTime ) { <ide> THREE.Animation.prototype.reset = function () { <ide> }; <ide> <ide> <del>THREE.Animation.prototype.update = function ( delta ) { <del> <del> if ( this.isPlaying === false ) return; <del> <del> this.currentTime += delta * this.timeScale; <del> <del> // <del> <del> var vector; <del> var types = [ "pos", "rot", "scl" ]; <del> <del> var duration = this.data.length; <del> <del> if ( this.loop === true && this.currentTime > duration ) { <del> <del> this.currentTime %= duration; <del> this.reset(); <del> <del> } <del> <del> this.currentTime = Math.min( this.currentTime, duration ); <del> <del> for ( var h = 0, hl = this.hierarchy.length; h < hl; h ++ ) { <del> <del> var object = this.hierarchy[ h ]; <del> var animationCache = object.animationCache; <del> <del> // loop through pos/rot/scl <del> <del> for ( var t = 0; t < 3; t ++ ) { <del> <del> // get keys <del> <del> var type = types[ t ]; <del> var prevKey = animationCache.prevKey[ type ]; <del> var nextKey = animationCache.nextKey[ type ]; <del> <del> if ( nextKey.time <= this.currentTime ) { <del> <del> prevKey = this.data.hierarchy[ h ].keys[ 0 ]; <del> nextKey = this.getNextKeyWith( type, h, 1 ); <del> <del> while ( nextKey.time < this.currentTime && nextKey.index > prevKey.index ) { <del> <del> prevKey = nextKey; <del> nextKey = this.getNextKeyWith( type, h, nextKey.index + 1 ); <del> <add>THREE.Animation.prototype.update = (function(){ <add> <add> var points = []; <add> var target = new THREE.Vector3(); <add> <add> // Catmull-Rom spline <add> <add> var interpolateCatmullRom = function ( points, scale ) { <add> <add> var c = [], v3 = [], <add> point, intPoint, weight, w2, w3, <add> pa, pb, pc, pd; <add> <add> point = ( points.length - 1 ) * scale; <add> intPoint = Math.floor( point ); <add> weight = point - intPoint; <add> <add> c[ 0 ] = intPoint === 0 ? intPoint : intPoint - 1; <add> c[ 1 ] = intPoint; <add> c[ 2 ] = intPoint > points.length - 2 ? intPoint : intPoint + 1; <add> c[ 3 ] = intPoint > points.length - 3 ? intPoint : intPoint + 2; <add> <add> pa = points[ c[ 0 ] ]; <add> pb = points[ c[ 1 ] ]; <add> pc = points[ c[ 2 ] ]; <add> pd = points[ c[ 3 ] ]; <add> <add> w2 = weight * weight; <add> w3 = weight * w2; <add> <add> v3[ 0 ] = interpolate( pa[ 0 ], pb[ 0 ], pc[ 0 ], pd[ 0 ], weight, w2, w3 ); <add> v3[ 1 ] = interpolate( pa[ 1 ], pb[ 1 ], pc[ 1 ], pd[ 1 ], weight, w2, w3 ); <add> v3[ 2 ] = interpolate( pa[ 2 ], pb[ 2 ], pc[ 2 ], pd[ 2 ], weight, w2, w3 ); <add> <add> return v3; <add> <add> }; <add> <add> var interpolate = function ( p0, p1, p2, p3, t, t2, t3 ) { <add> <add> var v0 = ( p2 - p0 ) * 0.5, <add> v1 = ( p3 - p1 ) * 0.5; <add> <add> return ( 2 * ( p1 - p2 ) + v0 + v1 ) * t3 + ( - 3 * ( p1 - p2 ) - 2 * v0 - v1 ) * t2 + v0 * t + p1; <add> <add> }; <add> <add> return function ( delta ) { <add> if ( this.isPlaying === false ) return; <add> <add> this.currentTime += delta * this.timeScale; <add> <add> // <add> <add> var vector; <add> var types = [ "pos", "rot", "scl" ]; <add> <add> var duration = this.data.length; <add> <add> if ( this.loop === true && this.currentTime > duration ) { <add> <add> this.currentTime %= duration; <add> this.reset(); <add> <add> } else if ( this.loop === false && this.currentTime > duration ) { <add> <add> this.stop(); <add> return; <add> <add> } <add> <add> this.currentTime = Math.min( this.currentTime, duration ); <add> <add> for ( var h = 0, hl = this.hierarchy.length; h < hl; h ++ ) { <add> <add> var object = this.hierarchy[ h ]; <add> var animationCache = object.animationCache; <add> <add> // loop through pos/rot/scl <add> <add> for ( var t = 0; t < 3; t ++ ) { <add> <add> // get keys <add> <add> var type = types[ t ]; <add> var prevKey = animationCache.prevKey[ type ]; <add> var nextKey = animationCache.nextKey[ type ]; <add> <add> if ( nextKey.time <= this.currentTime ) { <add> <add> prevKey = this.data.hierarchy[ h ].keys[ 0 ]; <add> nextKey = this.getNextKeyWith( type, h, 1 ); <add> <add> while ( nextKey.time < this.currentTime && nextKey.index > prevKey.index ) { <add> <add> prevKey = nextKey; <add> nextKey = this.getNextKeyWith( type, h, nextKey.index + 1 ); <add> <add> } <add> <add> animationCache.prevKey[ type ] = prevKey; <add> animationCache.nextKey[ type ] = nextKey; <add> <ide> } <del> <del> animationCache.prevKey[ type ] = prevKey; <del> animationCache.nextKey[ type ] = nextKey; <del> <del> } <del> <del> object.matrixAutoUpdate = true; <del> object.matrixWorldNeedsUpdate = true; <del> <del> var scale = ( this.currentTime - prevKey.time ) / ( nextKey.time - prevKey.time ); <del> <del> var prevXYZ = prevKey[ type ]; <del> var nextXYZ = nextKey[ type ]; <del> <del> if ( scale < 0 ) scale = 0; <del> if ( scale > 1 ) scale = 1; <del> <del> // interpolate <del> <del> if ( type === "pos" ) { <del> <del> vector = object.position; <del> <del> if ( this.interpolationType === THREE.AnimationHandler.LINEAR ) { <del> <add> <add> object.matrixAutoUpdate = true; <add> object.matrixWorldNeedsUpdate = true; <add> <add> var scale = ( this.currentTime - prevKey.time ) / ( nextKey.time - prevKey.time ); <add> <add> var prevXYZ = prevKey[ type ]; <add> var nextXYZ = nextKey[ type ]; <add> <add> if ( scale < 0 ) scale = 0; <add> if ( scale > 1 ) scale = 1; <add> <add> // interpolate <add> <add> if ( type === "pos" ) { <add> <add> vector = object.position; <add> <add> if ( this.interpolationType === THREE.AnimationHandler.LINEAR ) { <add> <add> vector.x = prevXYZ[ 0 ] + ( nextXYZ[ 0 ] - prevXYZ[ 0 ] ) * scale; <add> vector.y = prevXYZ[ 1 ] + ( nextXYZ[ 1 ] - prevXYZ[ 1 ] ) * scale; <add> vector.z = prevXYZ[ 2 ] + ( nextXYZ[ 2 ] - prevXYZ[ 2 ] ) * scale; <add> <add> } else if ( this.interpolationType === THREE.AnimationHandler.CATMULLROM || <add> this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) { <add> <add> points[ 0 ] = this.getPrevKeyWith( "pos", h, prevKey.index - 1 )[ "pos" ]; <add> points[ 1 ] = prevXYZ; <add> points[ 2 ] = nextXYZ; <add> points[ 3 ] = this.getNextKeyWith( "pos", h, nextKey.index + 1 )[ "pos" ]; <add> <add> scale = scale * 0.33 + 0.33; <add> <add> var currentPoint = interpolateCatmullRom( points, scale ); <add> <add> vector.x = currentPoint[ 0 ]; <add> vector.y = currentPoint[ 1 ]; <add> vector.z = currentPoint[ 2 ]; <add> <add> if ( this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) { <add> <add> var forwardPoint = interpolateCatmullRom( points, scale * 1.01 ); <add> <add> target.set( forwardPoint[ 0 ], forwardPoint[ 1 ], forwardPoint[ 2 ] ); <add> target.sub( vector ); <add> target.y = 0; <add> target.normalize(); <add> <add> var angle = Math.atan2( target.x, target.z ); <add> object.rotation.set( 0, angle, 0 ); <add> <add> } <add> <add> } <add> <add> } else if ( type === "rot" ) { <add> <add> THREE.Quaternion.slerp( prevXYZ, nextXYZ, object.quaternion, scale ); <add> <add> } else if ( type === "scl" ) { <add> <add> vector = object.scale; <add> <ide> vector.x = prevXYZ[ 0 ] + ( nextXYZ[ 0 ] - prevXYZ[ 0 ] ) * scale; <ide> vector.y = prevXYZ[ 1 ] + ( nextXYZ[ 1 ] - prevXYZ[ 1 ] ) * scale; <ide> vector.z = prevXYZ[ 2 ] + ( nextXYZ[ 2 ] - prevXYZ[ 2 ] ) * scale; <del> <del> } else if ( this.interpolationType === THREE.AnimationHandler.CATMULLROM || <del> this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) { <del> <del> this.points[ 0 ] = this.getPrevKeyWith( "pos", h, prevKey.index - 1 )[ "pos" ]; <del> this.points[ 1 ] = prevXYZ; <del> this.points[ 2 ] = nextXYZ; <del> this.points[ 3 ] = this.getNextKeyWith( "pos", h, nextKey.index + 1 )[ "pos" ]; <del> <del> scale = scale * 0.33 + 0.33; <del> <del> var currentPoint = this.interpolateCatmullRom( this.points, scale ); <del> <del> vector.x = currentPoint[ 0 ]; <del> vector.y = currentPoint[ 1 ]; <del> vector.z = currentPoint[ 2 ]; <del> <del> if ( this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) { <del> <del> var forwardPoint = this.interpolateCatmullRom( this.points, scale * 1.01 ); <del> <del> this.target.set( forwardPoint[ 0 ], forwardPoint[ 1 ], forwardPoint[ 2 ] ); <del> this.target.sub( vector ); <del> this.target.y = 0; <del> this.target.normalize(); <del> <del> var angle = Math.atan2( this.target.x, this.target.z ); <del> object.rotation.set( 0, angle, 0 ); <del> <del> } <del> <add> <ide> } <del> <del> } else if ( type === "rot" ) { <del> <del> THREE.Quaternion.slerp( prevXYZ, nextXYZ, object.quaternion, scale ); <del> <del> } else if ( type === "scl" ) { <del> <del> vector = object.scale; <del> <del> vector.x = prevXYZ[ 0 ] + ( nextXYZ[ 0 ] - prevXYZ[ 0 ] ) * scale; <del> vector.y = prevXYZ[ 1 ] + ( nextXYZ[ 1 ] - prevXYZ[ 1 ] ) * scale; <del> vector.z = prevXYZ[ 2 ] + ( nextXYZ[ 2 ] - prevXYZ[ 2 ] ) * scale; <del> <add> <ide> } <del> <add> <ide> } <ide> <del> } <add> }; <ide> <del> if ( this.loop === false && this.currentTime > duration ) { <add>})(); <ide> <del> this.stop(); <ide> <del> } <del> <del>}; <del> <del>// Catmull-Rom spline <del> <del>THREE.Animation.prototype.interpolateCatmullRom = function ( points, scale ) { <del> <del> var c = [], v3 = [], <del> point, intPoint, weight, w2, w3, <del> pa, pb, pc, pd; <del> <del> point = ( points.length - 1 ) * scale; <del> intPoint = Math.floor( point ); <del> weight = point - intPoint; <del> <del> c[ 0 ] = intPoint === 0 ? intPoint : intPoint - 1; <del> c[ 1 ] = intPoint; <del> c[ 2 ] = intPoint > points.length - 2 ? intPoint : intPoint + 1; <del> c[ 3 ] = intPoint > points.length - 3 ? intPoint : intPoint + 2; <del> <del> pa = points[ c[ 0 ] ]; <del> pb = points[ c[ 1 ] ]; <del> pc = points[ c[ 2 ] ]; <del> pd = points[ c[ 3 ] ]; <del> <del> w2 = weight * weight; <del> w3 = weight * w2; <del> <del> v3[ 0 ] = this.interpolate( pa[ 0 ], pb[ 0 ], pc[ 0 ], pd[ 0 ], weight, w2, w3 ); <del> v3[ 1 ] = this.interpolate( pa[ 1 ], pb[ 1 ], pc[ 1 ], pd[ 1 ], weight, w2, w3 ); <del> v3[ 2 ] = this.interpolate( pa[ 2 ], pb[ 2 ], pc[ 2 ], pd[ 2 ], weight, w2, w3 ); <del> <del> return v3; <del> <del>}; <del> <del>THREE.Animation.prototype.interpolate = function ( p0, p1, p2, p3, t, t2, t3 ) { <del> <del> var v0 = ( p2 - p0 ) * 0.5, <del> v1 = ( p3 - p1 ) * 0.5; <del> <del> return ( 2 * ( p1 - p2 ) + v0 + v1 ) * t3 + ( - 3 * ( p1 - p2 ) - 2 * v0 - v1 ) * t2 + v0 * t + p1; <del> <del>}; <ide> <ide> <ide>
1
Java
Java
fix httpmessagewriter tests
7a8a2d96080188838c135ed409e50e2467cd9f05
<ide><path>spring-web/src/test/java/org/springframework/http/codec/FormHttpMessageWriterTests.java <ide> <ide> import org.junit.Test; <ide> import reactor.core.publisher.Mono; <add>import reactor.test.StepVerifier; <ide> <ide> import org.springframework.core.ResolvableType; <add>import org.springframework.core.io.buffer.AbstractDataBufferAllocatingTestCase; <ide> import org.springframework.http.HttpHeaders; <ide> import org.springframework.http.MediaType; <ide> import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse; <ide> import org.springframework.util.LinkedMultiValueMap; <ide> import org.springframework.util.MultiValueMap; <ide> <del>import static org.junit.Assert.assertEquals; <del>import static org.junit.Assert.assertFalse; <del>import static org.junit.Assert.assertTrue; <add>import static org.junit.Assert.*; <ide> <ide> /** <ide> * @author Sebastien Deleuze <ide> */ <del>public class FormHttpMessageWriterTests { <add>public class FormHttpMessageWriterTests extends AbstractDataBufferAllocatingTestCase { <ide> <ide> private final FormHttpMessageWriter writer = new FormHttpMessageWriter(); <ide> <ide> public void writeForm() { <ide> body.add("name 2", "value 2+1"); <ide> body.add("name 2", "value 2+2"); <ide> body.add("name 3", null); <del> MockServerHttpResponse response = new MockServerHttpResponse(); <add> MockServerHttpResponse response = new MockServerHttpResponse(this.bufferFactory); <ide> this.writer.write(Mono.just(body), null, MediaType.APPLICATION_FORM_URLENCODED, response, null).block(); <ide> <del> String responseBody = response.getBodyAsString().block(); <del> assertEquals("name+1=value+1&name+2=value+2%2B1&name+2=value+2%2B2&name+3", responseBody); <add> String expected = "name+1=value+1&name+2=value+2%2B1&name+2=value+2%2B2&name+3"; <add> StepVerifier.create(response.getBody()) <add> .consumeNextWith(stringConsumer( <add> expected)) <add> .expectComplete() <add> .verify(); <ide> HttpHeaders headers = response.getHeaders(); <ide> assertEquals("application/x-www-form-urlencoded;charset=UTF-8", headers.getContentType().toString()); <del> assertEquals(responseBody.getBytes().length, headers.getContentLength()); <add> assertEquals(expected.length(), headers.getContentLength()); <ide> } <ide> <ide> } <ide><path>spring-web/src/test/java/org/springframework/http/codec/ServerSentEventHttpMessageWriterTests.java <ide> import java.util.Map; <ide> <ide> import com.fasterxml.jackson.databind.ObjectMapper; <add>import org.junit.Before; <ide> import org.junit.Test; <ide> import org.reactivestreams.Publisher; <ide> import reactor.core.publisher.Flux; <ide> <ide> import org.springframework.core.ResolvableType; <ide> import org.springframework.core.io.buffer.AbstractDataBufferAllocatingTestCase; <add>import org.springframework.core.io.buffer.DataBufferUtils; <add>import org.springframework.core.io.buffer.support.DataBufferTestUtils; <ide> import org.springframework.http.MediaType; <ide> import org.springframework.http.codec.json.Jackson2JsonEncoder; <ide> import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; <ide> * @author Sebastien Deleuze <ide> * @author Rossen Stoyanchev <ide> */ <add>@SuppressWarnings("rawtypes") <ide> public class ServerSentEventHttpMessageWriterTests extends AbstractDataBufferAllocatingTestCase { <ide> <ide> private static final Map<String, Object> HINTS = Collections.emptyMap(); <ide> <ide> private ServerSentEventHttpMessageWriter messageWriter = <ide> new ServerSentEventHttpMessageWriter(new Jackson2JsonEncoder()); <ide> <add> private MockServerHttpResponse outputMessage; <add> <add> <add> @Before <add> public void setUp() { <add> this.outputMessage = new MockServerHttpResponse(this.bufferFactory); <add> } <add> <add> <ide> <ide> @Test <ide> public void canWrite() { <ide> public void writeServerSentEvent() { <ide> .comment("bla\nbla bla\nbla bla bla").retry(Duration.ofMillis(123L)).build(); <ide> <ide> Mono<ServerSentEvent> source = Mono.just(event); <del> MockServerHttpResponse outputMessage = new MockServerHttpResponse(); <ide> testWrite(source, outputMessage, ServerSentEvent.class); <ide> <del> StepVerifier.create(outputMessage.getBodyAsString()) <del> .expectNext("id:c42\nevent:foo\nretry:123\n:bla\n:bla bla\n:bla bla bla\ndata:bar\n\n") <add> StepVerifier.create(outputMessage.getBody()) <add> .consumeNextWith(stringConsumer("id:c42\nevent:foo\nretry:123\n:bla\n:bla bla\n:bla bla bla\ndata:")) <add> .consumeNextWith(stringConsumer("bar\n")) <add> .consumeNextWith(stringConsumer("\n")) <ide> .expectComplete() <ide> .verify(); <ide> } <ide> <del> @Test <del> @SuppressWarnings("rawtypes") <del> public void writeServerSentEventError() { <del> ServerSentEvent<?> event = ServerSentEvent.builder().data("bar").id("c42").event("foo") <del> .comment("bla\nbla bla\nbla bla bla").retry(Duration.ofMillis(123L)).build(); <del> <del> Flux<ServerSentEvent> source = Flux.concat( <del> Flux.just(event), <del> Flux.error(new RuntimeException())); <del> MockServerHttpResponse outputMessage = new MockServerHttpResponse(); <del> <del> Mono<Void> result = this.messageWriter.write(source, forClass(ServerSentEvent.class), <del> MediaType.TEXT_EVENT_STREAM, outputMessage, HINTS); <del> <del> StepVerifier.create(result) <del> .verifyError(RuntimeException.class); <del> } <del> <ide> @Test <ide> public void writeString() { <ide> Flux<String> source = Flux.just("foo", "bar"); <del> MockServerHttpResponse outputMessage = new MockServerHttpResponse(); <ide> testWrite(source, outputMessage, String.class); <ide> <del> StepVerifier.create(outputMessage.getBodyAsString()) <del> .expectNext("data:foo\n\ndata:bar\n\n") <add> StepVerifier.create(outputMessage.getBody()) <add> .consumeNextWith(stringConsumer("data:")) <add> .consumeNextWith(stringConsumer("foo\n")) <add> .consumeNextWith(stringConsumer("\n")) <add> .consumeNextWith(stringConsumer("data:")) <add> .consumeNextWith(stringConsumer("bar\n")) <add> .consumeNextWith(stringConsumer("\n")) <ide> .expectComplete() <ide> .verify(); <ide> } <ide> <ide> @Test <ide> public void writeMultiLineString() { <ide> Flux<String> source = Flux.just("foo\nbar", "foo\nbaz"); <del> MockServerHttpResponse outputMessage = new MockServerHttpResponse(); <ide> testWrite(source, outputMessage, String.class); <ide> <del> StepVerifier.create(outputMessage.getBodyAsString()) <del> .expectNext("data:foo\ndata:bar\n\ndata:foo\ndata:baz\n\n") <add> StepVerifier.create(outputMessage.getBody()) <add> .consumeNextWith(stringConsumer("data:")) <add> .consumeNextWith(stringConsumer("foo\ndata:bar\n")) <add> .consumeNextWith(stringConsumer("\n")) <add> .consumeNextWith(stringConsumer("data:")) <add> .consumeNextWith(stringConsumer("foo\ndata:baz\n")) <add> .consumeNextWith(stringConsumer("\n")) <ide> .expectComplete() <ide> .verify(); <ide> } <ide> public void writeStringWithCustomCharset() { <ide> Flux<String> source = Flux.just("\u00A3"); <ide> Charset charset = StandardCharsets.ISO_8859_1; <ide> MediaType mediaType = new MediaType("text", "event-stream", charset); <del> MockServerHttpResponse outputMessage = new MockServerHttpResponse(); <ide> testWrite(source, mediaType, outputMessage, String.class); <ide> <ide> assertEquals(mediaType, outputMessage.getHeaders().getContentType()); <del> StepVerifier.create(outputMessage.getBodyAsString()).expectNext("data:\u00A3\n\n").verifyComplete(); <add> StepVerifier.create(outputMessage.getBody()) <add> .consumeNextWith(stringConsumer("data:")) <add> .consumeNextWith(dataBuffer -> { <add> String value = <add> DataBufferTestUtils.dumpString(dataBuffer, charset); <add> DataBufferUtils.release(dataBuffer); <add> assertEquals("\u00A3\n", value); <add> }) <add> .consumeNextWith(stringConsumer("\n")) <add> .expectComplete() <add> .verify(); <ide> } <ide> <ide> @Test <ide> public void writePojo() { <ide> Flux<Pojo> source = Flux.just(new Pojo("foofoo", "barbar"), new Pojo("foofoofoo", "barbarbar")); <del> MockServerHttpResponse outputMessage = new MockServerHttpResponse(); <ide> testWrite(source, outputMessage, Pojo.class); <ide> <del> StepVerifier.create(outputMessage.getBodyAsString()) <del> .expectNext("data:{\"foo\":\"foofoo\",\"bar\":\"barbar\"}\n\n" + <del> "data:{\"foo\":\"foofoofoo\",\"bar\":\"barbarbar\"}\n\n") <add> StepVerifier.create(outputMessage.getBody()) <add> .consumeNextWith(stringConsumer("data:")) <add> .consumeNextWith(stringConsumer("{\"foo\":\"foofoo\",\"bar\":\"barbar\"}")) <add> .consumeNextWith(stringConsumer("\n")) <add> .consumeNextWith(stringConsumer("\n")) <add> .consumeNextWith(stringConsumer("data:")) <add> .consumeNextWith(stringConsumer("{\"foo\":\"foofoofoo\",\"bar\":\"barbarbar\"}")) <add> .consumeNextWith(stringConsumer("\n")) <add> .consumeNextWith(stringConsumer("\n")) <ide> .expectComplete() <ide> .verify(); <ide> } <ide> public void writePojoWithPrettyPrint() { <ide> this.messageWriter = new ServerSentEventHttpMessageWriter(new Jackson2JsonEncoder(mapper)); <ide> <ide> Flux<Pojo> source = Flux.just(new Pojo("foofoo", "barbar"), new Pojo("foofoofoo", "barbarbar")); <del> MockServerHttpResponse outputMessage = new MockServerHttpResponse(); <ide> testWrite(source, outputMessage, Pojo.class); <ide> <del> StepVerifier.create(outputMessage.getBodyAsString()) <del> .expectNext("data:{\n" + <add> StepVerifier.create(outputMessage.getBody()) <add> .consumeNextWith(stringConsumer("data:")) <add> .consumeNextWith(stringConsumer("{\n" + <ide> "data: \"foo\" : \"foofoo\",\n" + <del> "data: \"bar\" : \"barbar\"\n" + "data:}\n\n" + <del> "data:{\n" + <add> "data: \"bar\" : \"barbar\"\n" + "data:}")) <add> .consumeNextWith(stringConsumer("\n")) <add> .consumeNextWith(stringConsumer("\n")) <add> .consumeNextWith(stringConsumer("data:")) <add> .consumeNextWith(stringConsumer("{\n" + <ide> "data: \"foo\" : \"foofoofoo\",\n" + <del> "data: \"bar\" : \"barbarbar\"\n" + "data:}\n\n") <add> "data: \"bar\" : \"barbarbar\"\n" + "data:}")) <add> .consumeNextWith(stringConsumer("\n")) <add> .consumeNextWith(stringConsumer("\n")) <ide> .expectComplete() <ide> .verify(); <ide> } <ide> public void writePojoWithCustomEncoding() { <ide> Flux<Pojo> source = Flux.just(new Pojo("foo\uD834\uDD1E", "bar\uD834\uDD1E")); <ide> Charset charset = StandardCharsets.UTF_16LE; <ide> MediaType mediaType = new MediaType("text", "event-stream", charset); <del> MockServerHttpResponse outputMessage = new MockServerHttpResponse(); <ide> testWrite(source, mediaType, outputMessage, Pojo.class); <ide> <ide> assertEquals(mediaType, outputMessage.getHeaders().getContentType()); <del> StepVerifier.create(outputMessage.getBodyAsString()) <del> .expectNext("data:{\"foo\":\"foo\uD834\uDD1E\",\"bar\":\"bar\uD834\uDD1E\"}\n\n") <del> .verifyComplete(); <add> StepVerifier.create(outputMessage.getBody()) <add> .consumeNextWith(dataBuffer1 -> { <add> String value1 = <add> DataBufferTestUtils.dumpString(dataBuffer1, charset); <add> DataBufferUtils.release(dataBuffer1); <add> assertEquals("data:", value1); <add> }) <add> .consumeNextWith(dataBuffer -> { <add> String value = DataBufferTestUtils.dumpString(dataBuffer, charset); <add> DataBufferUtils.release(dataBuffer); <add> assertEquals("{\"foo\":\"foo\uD834\uDD1E\",\"bar\":\"bar\uD834\uDD1E\"}", value); <add> }) <add> .consumeNextWith(dataBuffer2 -> { <add> String value2 = <add> DataBufferTestUtils.dumpString(dataBuffer2, charset); <add> DataBufferUtils.release(dataBuffer2); <add> assertEquals("\n", value2); <add> }) <add> .consumeNextWith(dataBuffer3 -> { <add> String value3 = <add> DataBufferTestUtils.dumpString(dataBuffer3, charset); <add> DataBufferUtils.release(dataBuffer3); <add> assertEquals("\n", value3); <add> }) <add> .expectComplete() <add> .verify(); <ide> } <ide> <ide> <ide><path>spring-web/src/test/java/org/springframework/mock/http/server/reactive/test/MockServerHttpResponse.java <ide> /* <del> * Copyright 2002-2017 the original author or authors. <add> * Copyright 2002-2018 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> import reactor.core.publisher.Mono; <ide> <ide> import org.springframework.core.io.buffer.DataBuffer; <add>import org.springframework.core.io.buffer.DataBufferFactory; <ide> import org.springframework.core.io.buffer.DataBufferUtils; <ide> import org.springframework.core.io.buffer.DefaultDataBufferFactory; <ide> import org.springframework.http.HttpHeaders; <ide> public class MockServerHttpResponse extends AbstractServerHttpResponse { <ide> <ide> <ide> public MockServerHttpResponse() { <del> super(new DefaultDataBufferFactory()); <add> this(new DefaultDataBufferFactory()); <add> } <add> <add> public MockServerHttpResponse(DataBufferFactory dataBufferFactory) { <add> super(dataBufferFactory); <ide> this.writeHandler = body -> { <ide> this.body = body.cache(); <ide> return this.body.then();
3
Javascript
Javascript
fix connection upgrade checks
1050594c867550f2417adae045160c6e39d70073
<ide><path>lib/_http_common.js <ide> function parserOnHeadersComplete(versionMajor, versionMinor, headers, method, <ide> parser.incoming.statusMessage = statusMessage; <ide> } <ide> <del> // The client made non-upgrade request, and server is just advertising <del> // supported protocols. <del> // <del> // See RFC7230 Section 6.7 <del> // <del> // NOTE: RegExp below matches `upgrade` in `Connection: abc, upgrade, def` <del> // header. <del> if (upgrade && <del> parser.outgoing !== null && <del> (parser.outgoing._headers.upgrade === undefined || <del> !/(^|\W)upgrade(\W|$)/i.test(parser.outgoing._headers.connection))) { <add> if (upgrade && parser.outgoing !== null && !parser.outgoing.upgrading) { <add> // The client made non-upgrade request, and server is just advertising <add> // supported protocols. <add> // <add> // See RFC7230 Section 6.7 <ide> upgrade = false; <ide> } <ide> <ide><path>lib/_http_outgoing.js <ide> const Buffer = require('buffer').Buffer; <ide> const common = require('_http_common'); <ide> <ide> const CRLF = common.CRLF; <del>const chunkExpression = common.chunkExpression; <add>const trfrEncChunkExpression = common.chunkExpression; <ide> const debug = common.debug; <ide> <del>const connectionExpression = /^Connection$/i; <add>const upgradeExpression = /^Upgrade$/i; <ide> const transferEncodingExpression = /^Transfer-Encoding$/i; <del>const closeExpression = /close/i; <ide> const contentLengthExpression = /^Content-Length$/i; <ide> const dateExpression = /^Date$/i; <ide> const expectExpression = /^Expect$/i; <ide> const trailerExpression = /^Trailer$/i; <add>const connectionExpression = /^Connection$/i; <add>const connCloseExpression = /(^|\W)close(\W|$)/i; <add>const connUpgradeExpression = /(^|\W)upgrade(\W|$)/i; <ide> <ide> const automaticHeaders = { <ide> connection: true, <ide> function OutgoingMessage() { <ide> this.writable = true; <ide> <ide> this._last = false; <add> this.upgrading = false; <ide> this.chunkedEncoding = false; <ide> this.shouldKeepAlive = true; <ide> this.useChunkedEncodingByDefault = true; <ide> OutgoingMessage.prototype._storeHeader = function(firstLine, headers) { <ide> // in the case of response it is: 'HTTP/1.1 200 OK\r\n' <ide> var state = { <ide> sentConnectionHeader: false, <add> sentConnectionUpgrade: false, <ide> sentContentLengthHeader: false, <ide> sentTransferEncodingHeader: false, <ide> sentDateHeader: false, <ide> sentExpect: false, <ide> sentTrailer: false, <add> sentUpgrade: false, <ide> messageHeader: firstLine <ide> }; <ide> <ide> OutgoingMessage.prototype._storeHeader = function(firstLine, headers) { <ide> } <ide> } <ide> <add> // Are we upgrading the connection? <add> if (state.sentConnectionUpgrade && state.sentUpgrade) <add> this.upgrading = true; <add> <ide> // Date header <ide> if (this.sendDate === true && state.sentDateHeader === false) { <ide> state.messageHeader += 'Date: ' + utcDate() + CRLF; <ide> function storeHeader(self, state, field, value) { <ide> <ide> if (connectionExpression.test(field)) { <ide> state.sentConnectionHeader = true; <del> if (closeExpression.test(value)) { <add> if (connCloseExpression.test(value)) { <ide> self._last = true; <ide> } else { <ide> self.shouldKeepAlive = true; <ide> } <del> <add> if (connUpgradeExpression.test(value)) <add> state.sentConnectionUpgrade = true; <ide> } else if (transferEncodingExpression.test(field)) { <ide> state.sentTransferEncodingHeader = true; <del> if (chunkExpression.test(value)) self.chunkedEncoding = true; <add> if (trfrEncChunkExpression.test(value)) self.chunkedEncoding = true; <ide> <ide> } else if (contentLengthExpression.test(field)) { <ide> state.sentContentLengthHeader = true; <ide> function storeHeader(self, state, field, value) { <ide> state.sentExpect = true; <ide> } else if (trailerExpression.test(field)) { <ide> state.sentTrailer = true; <add> } else if (upgradeExpression.test(field)) { <add> state.sentUpgrade = true; <ide> } <ide> } <ide> <ide><path>test/parallel/test-http-upgrade-client.js <ide> var srv = net.createServer(function(c) { <ide> }); <ide> <ide> srv.listen(0, '127.0.0.1', common.mustCall(function() { <del> <del> var req = http.get({ <del> port: this.address().port, <del> headers: { <add> var port = this.address().port; <add> var headers = [ <add> { <ide> connection: 'upgrade', <ide> upgrade: 'websocket' <del> } <del> }); <del> req.on('upgrade', common.mustCall(function(res, socket, upgradeHead) { <del> var recvData = upgradeHead; <del> socket.on('data', function(d) { <del> recvData += d; <add> }, <add> [ <add> ['Host', 'echo.websocket.org'], <add> ['Connection', 'Upgrade'], <add> ['Upgrade', 'websocket'], <add> ['Origin', 'http://www.websocket.org'] <add> ] <add> ]; <add> var left = headers.length; <add> headers.forEach(function(h) { <add> var req = http.get({ <add> port: port, <add> headers: h <ide> }); <add> var sawUpgrade = false; <add> req.on('upgrade', common.mustCall(function(res, socket, upgradeHead) { <add> sawUpgrade = true; <add> var recvData = upgradeHead; <add> socket.on('data', function(d) { <add> recvData += d; <add> }); <ide> <del> socket.on('close', common.mustCall(function() { <del> assert.equal(recvData, 'nurtzo'); <del> })); <add> socket.on('close', common.mustCall(function() { <add> assert.equal(recvData, 'nurtzo'); <add> })); <ide> <del> console.log(res.headers); <del> var expectedHeaders = {'hello': 'world', <del> 'connection': 'upgrade', <del> 'upgrade': 'websocket' }; <del> assert.deepStrictEqual(expectedHeaders, res.headers); <add> console.log(res.headers); <add> var expectedHeaders = { <add> hello: 'world', <add> connection: 'upgrade', <add> upgrade: 'websocket' <add> }; <add> assert.deepStrictEqual(expectedHeaders, res.headers); <ide> <del> socket.end(); <del> srv.close(); <del> })); <add> socket.end(); <add> if (--left == 0) <add> srv.close(); <add> })); <add> req.on('close', common.mustCall(function() { <add> assert.strictEqual(sawUpgrade, true); <add> })); <add> }); <ide> }));
3
Javascript
Javascript
fix existing tests that failed schema validaton
3ba9ed99c0952eb8241e9e2c3c6b357cf0c59d5b
<ide><path>lib/validateSchema.js <ide> const Ajv = require("ajv"); <ide> const ajv = new Ajv({ <ide> errorDataPath: "configuration", <ide> allErrors: true, <del> verbose: true <add> verbose: true, <add> extendRefs: true <ide> }); <ide> require("ajv-keywords")(ajv, ["instanceof"]); <ide> require("../schemas/ajv.absolutePath")(ajv); <ide><path>test/Compiler-caching.test.js <ide> describe("Compiler (caching)", function() { <ide> new WebpackOptionsDefaulter().process(options); <ide> options.entry = entry; <ide> options.context = path.join(__dirname, "fixtures"); <del> options.output.path = ""; <add> options.output.path = "/"; <ide> options.output.filename = "bundle.js"; <ide> options.output.pathinfo = true; <ide> const logs = { <ide> describe("Compiler (caching)", function() { <ide> stats.assets[0].emitted.should.be.exactly(true); <ide> <ide> helper.runAgain((stats, files, iteration) => { <del> <ide> // Cached the second run <ide> stats.assets[0].name.should.be.exactly("bundle.js"); <ide> stats.assets[0].emitted.should.be.exactly(false); <ide> <del> files["bundle.js"].should.containEql("This is a"); <add> files["/bundle.js"].should.containEql("This is a"); <ide> <ide> const aContent = fs.readFileSync(tempFixture.aFilepath).toString().replace("This is a", "This is a MODIFIED"); <ide> <ide> describe("Compiler (caching)", function() { <ide> stats.assets[0].name.should.be.exactly("bundle.js"); <ide> stats.assets[0].emitted.should.be.exactly(true); <ide> <del> files["bundle.js"].should.containEql("This is a MODIFIED"); <add> files["/bundle.js"].should.containEql("This is a MODIFIED"); <ide> <ide> done(); <ide> }); <ide><path>test/Compiler.test.js <ide> describe("Compiler", function() { <ide> new WebpackOptionsDefaulter().process(options); <ide> options.entry = entry; <ide> options.context = path.join(__dirname, "fixtures"); <del> if(noOutputPath) options.output.path = ""; <add> if(noOutputPath) options.output.path = "/"; <ide> options.output.pathinfo = true; <ide> var logs = { <ide> mkdirp: [], <ide> describe("Compiler", function() { <ide> <ide> compile("./c", { <ide> output: { <del> path: 'what', <add> path: '/what', <ide> filename: 'the' + sep + 'hell.js', <ide> } <ide> }, function(stats, files) { <ide> stats.logs.mkdirp.should.eql([ <del> 'what', <del> 'what' + sep + 'the', <add> '/what', <add> '/what' + sep + 'the', <ide> ]); <ide> done(); <ide> }); <ide> }); <add> <ide> it("should compile a single file", function(done) { <ide> compile("./c", {}, function(stats, files) { <del> files.should.have.property("main.js").have.type("string"); <del> Object.keys(files).should.be.eql(["main.js"]); <del> var bundle = files["main.js"]; <add> files.should.have.property("/main.js").have.type("string"); <add> Object.keys(files).should.be.eql(["/main.js"]); <add> var bundle = files["/main.js"]; <ide> bundle.should.containEql("function __webpack_require__("); <ide> bundle.should.containEql("__webpack_require__(/*! ./a */ 0);"); <ide> bundle.should.containEql("./c.js"); <ide> describe("Compiler", function() { <ide> done(); <ide> }); <ide> }); <add> <ide> it("should compile a complex file", function(done) { <ide> compile("./main1", {}, function(stats, files) { <del> files.should.have.property("main.js").have.type("string"); <del> Object.keys(files).should.be.eql(["main.js"]); <del> var bundle = files["main.js"]; <add> files.should.have.property("/main.js").have.type("string"); <add> Object.keys(files).should.be.eql(["/main.js"]); <add> var bundle = files["/main.js"]; <ide> bundle.should.containEql("function __webpack_require__("); <ide> bundle.should.containEql("__webpack_require__(/*! ./a */"); <ide> bundle.should.containEql("./main1.js"); <ide> describe("Compiler", function() { <ide> done(); <ide> }); <ide> }); <add> <ide> it("should compile a file with transitive dependencies", function(done) { <ide> compile("./abc", {}, function(stats, files) { <del> files.should.have.property("main.js").have.type("string"); <del> Object.keys(files).should.be.eql(["main.js"]); <del> var bundle = files["main.js"]; <add> files.should.have.property("/main.js").have.type("string"); <add> Object.keys(files).should.be.eql(["/main.js"]); <add> var bundle = files["/main.js"]; <ide> bundle.should.containEql("function __webpack_require__("); <ide> bundle.should.containEql("__webpack_require__(/*! ./a */"); <ide> bundle.should.containEql("__webpack_require__(/*! ./b */"); <ide> describe("Compiler", function() { <ide> done(); <ide> }); <ide> }); <add> <ide> it("should compile a file with multiple chunks", function(done) { <ide> compile("./chunks", {}, function(stats, files) { <ide> stats.chunks.length.should.be.eql(2); <del> files.should.have.property("main.js").have.type("string"); <del> files.should.have.property("0.js").have.type("string"); <del> Object.keys(files).should.be.eql(["0.js", "main.js"]); <del> var bundle = files["main.js"]; <del> var chunk = files["0.js"]; <add> files.should.have.property("/main.js").have.type("string"); <add> files.should.have.property("/0.js").have.type("string"); <add> Object.keys(files).should.be.eql(["/0.js", "/main.js"]); <add> var bundle = files["/main.js"]; <add> var chunk = files["/0.js"]; <ide> bundle.should.containEql("function __webpack_require__("); <ide> bundle.should.containEql("__webpack_require__(/*! ./b */"); <ide> chunk.should.not.containEql("__webpack_require__(/* ./b */"); <ide><path>test/Validation.test.js <ide> describe("Validation", function() { <ide> module: { <ide> rules: [{ <ide> oneOf: [{ <del> test: "a", <add> test: "/a", <ide> paser: { <ide> amd: false <ide> }
4
Mixed
Javascript
remove usage of url.parse
295e766c2782d6d83e33004f7c2204c0a8d52655
<ide><path>doc/api/deprecations.md <ide> expose values under these names. <ide> ### DEP0109: `http`, `https`, and `tls` support for invalid URLs <ide> <!-- YAML <ide> changes: <add> - version: REPLACEME <add> pr-url: https://github.com/nodejs/node/pull/36853 <add> description: End-of-Life. <ide> - version: v11.0.0 <ide> pr-url: https://github.com/nodejs/node/pull/20270 <ide> description: Runtime deprecation. <ide> --> <ide> <del>Type: Runtime <add>Type: End-of-Life <ide> <ide> Some previously supported (but strictly invalid) URLs were accepted through the <ide> [`http.request()`][], [`http.get()`][], [`https.request()`][], <ide><path>lib/_http_client.js <ide> const { <ide> } = primordials; <ide> <ide> const net = require('net'); <del>const url = require('url'); <ide> const assert = require('internal/assert'); <ide> const { once } = require('internal/util'); <ide> const { <ide> class HTTPClientAsyncResource { <ide> } <ide> } <ide> <del>let urlWarningEmitted = false; <ide> function ClientRequest(input, options, cb) { <ide> FunctionPrototypeCall(OutgoingMessage, this); <ide> <ide> if (typeof input === 'string') { <ide> const urlStr = input; <del> try { <del> input = urlToHttpOptions(new URL(urlStr)); <del> } catch (err) { <del> input = url.parse(urlStr); <del> if (!input.hostname) { <del> throw err; <del> } <del> if (!urlWarningEmitted && !process.noDeprecation) { <del> urlWarningEmitted = true; <del> process.emitWarning( <del> `The provided URL ${urlStr} is not a valid URL, and is supported ` + <del> 'in the http module solely for compatibility.', <del> 'DeprecationWarning', 'DEP0109'); <del> } <del> } <add> input = urlToHttpOptions(new URL(urlStr)); <ide> } else if (input && input[searchParamsSymbol] && <ide> input[searchParamsSymbol][searchParamsSymbol]) { <ide> // url.URL instance <ide><path>lib/https.js <ide> const { <ide> require('internal/util').assertCrypto(); <ide> <ide> const tls = require('tls'); <del>const url = require('url'); <ide> const { Agent: HttpAgent } = require('_http_agent'); <ide> const { <ide> Server: HttpServer, <ide> Agent.prototype._evictSession = function _evictSession(key) { <ide> <ide> const globalAgent = new Agent(); <ide> <del>let urlWarningEmitted = false; <ide> function request(...args) { <ide> let options = {}; <ide> <ide> if (typeof args[0] === 'string') { <ide> const urlStr = ArrayPrototypeShift(args); <del> try { <del> options = urlToHttpOptions(new URL(urlStr)); <del> } catch (err) { <del> options = url.parse(urlStr); <del> if (!options.hostname) { <del> throw err; <del> } <del> if (!urlWarningEmitted && !process.noDeprecation) { <del> urlWarningEmitted = true; <del> process.emitWarning( <del> `The provided URL ${urlStr} is not a valid URL, and is supported ` + <del> 'in the https module solely for compatibility.', <del> 'DeprecationWarning', 'DEP0109'); <del> } <del> } <add> options = urlToHttpOptions(new URL(urlStr)); <ide> } else if (args[0] && args[0][searchParamsSymbol] && <ide> args[0][searchParamsSymbol][searchParamsSymbol]) { <ide> // url.URL instance <ide><path>lib/tls.js <ide> const { isArrayBufferView } = require('internal/util/types'); <ide> <ide> const net = require('net'); <ide> const { getOptionValue } = require('internal/options'); <del>const url = require('url'); <ide> const { getRootCertificates, getSSLCiphers } = internalBinding('crypto'); <ide> const { Buffer } = require('buffer'); <ide> const EventEmitter = require('events'); <ide> function check(hostParts, pattern, wildcards) { <ide> return true; <ide> } <ide> <del>let urlWarningEmitted = false; <ide> exports.checkServerIdentity = function checkServerIdentity(hostname, cert) { <ide> const subject = cert.subject; <ide> const altNames = cert.subjectaltname; <ide> exports.checkServerIdentity = function checkServerIdentity(hostname, cert) { <ide> if (StringPrototypeStartsWith(name, 'DNS:')) { <ide> ArrayPrototypePush(dnsNames, StringPrototypeSlice(name, 4)); <ide> } else if (StringPrototypeStartsWith(name, 'URI:')) { <del> let uri; <del> try { <del> uri = new URL(StringPrototypeSlice(name, 4)); <del> } catch { <del> const slicedName = StringPrototypeSlice(name, 4); <del> uri = url.parse(slicedName); <del> if (!urlWarningEmitted && !process.noDeprecation) { <del> urlWarningEmitted = true; <del> process.emitWarning( <del> `The URI ${slicedName} found in cert.subjectaltname ` + <del> 'is not a valid URI, and is supported in the tls module ' + <del> 'solely for compatibility.', <del> 'DeprecationWarning', 'DEP0109'); <del> } <del> } <add> const uri = new URL(StringPrototypeSlice(name, 4)); <ide> <ide> // TODO(bnoordhuis) Also use scheme. <ide> ArrayPrototypePush(uriNames, uri.hostname); <ide><path>test/parallel/test-http-deprecated-urls.js <del>/* eslint-disable node-core/crypto-check */ <del> <del>'use strict'; <del> <del>const common = require('../common'); <del> <del>const http = require('http'); <del>const modules = { http }; <del> <del>const deprecations = [ <del> ['The provided URL http://[www.nodejs.org] is not a valid URL, and is supported ' + <del> 'in the http module solely for compatibility.', <del> 'DEP0109'], <del>]; <del> <del>if (common.hasCrypto) { <del> const https = require('https'); <del> modules.https = https; <del> deprecations.push( <del> ['The provided URL https://[www.nodejs.org] is not a valid URL, and is supported ' + <del> 'in the https module solely for compatibility.', <del> 'DEP0109'], <del> ); <del>} <del> <del>common.expectWarning('DeprecationWarning', deprecations); <del> <del>Object.keys(modules).forEach((module) => { <del> const doNotCall = common.mustNotCall( <del> `${module}.request should not connect to ${module}://[www.nodejs.org]` <del> ); <del> modules[module].request(`${module}://[www.nodejs.org]`, doNotCall).abort(); <del>}); <ide><path>test/parallel/test-tls-check-server-identity.js <ide> const util = require('util'); <ide> <ide> const tls = require('tls'); <ide> <del>common.expectWarning('DeprecationWarning', [ <del> ['The URI http://[a.b.a.com]/ found in cert.subjectaltname ' + <del> 'is not a valid URI, and is supported in the tls module ' + <del> 'solely for compatibility.', <del> 'DEP0109'], <del>]); <del> <ide> const tests = [ <ide> // False-y values. <ide> { <ide> const tests = [ <ide> error: 'Host: a.b.a.com. is not in the cert\'s altnames: ' + <ide> 'URI:http://*.b.a.com/' <ide> }, <del> // Invalid URI <del> { <del> host: 'a.b.a.com', cert: { <del> subjectaltname: 'URI:http://[a.b.a.com]/', <del> subject: {} <del> } <del> }, <ide> // IP addresses <ide> { <ide> host: 'a.b.a.com', cert: {
6
Javascript
Javascript
change example module name
217feda041c62d55ee13a0fad3563f36863fddc0
<ide><path>src/ngRoute/route.js <ide> function $RouteProvider(){ <ide> Note that this example is using {@link ng.directive:script inlined templates} <ide> to get it working on jsfiddle as well. <ide> <del> <example module="ngView" deps="angular-route.js"> <add> <example module="ngViewExample" deps="angular-route.js"> <ide> <file name="index.html"> <ide> <div ng-controller="MainCntl"> <ide> Choose: <ide> function $RouteProvider(){ <ide> </file> <ide> <ide> <file name="script.js"> <del> angular.module('ngView', ['ngRoute']).config(function($routeProvider, $locationProvider) { <add> angular.module('ngViewExample', ['ngRoute']).config(function($routeProvider, $locationProvider) { <ide> $routeProvider.when('/Book/:bookId', { <ide> templateUrl: 'book.html', <ide> controller: BookCntl,
1
Ruby
Ruby
fix typo in exception message
ef862c04e5cc4deed04e0ffc70af88431803efe6
<ide><path>actionpack/lib/action_dispatch/routing/route_set.rb <ide> def call(t, args, options, outer_options = {}) <ide> if url_options.permitted? <ide> t.url_for(url_options.to_h.merge(outer_options)) <ide> else <del> raise ArgumentError, "Generating an URL from non sanitized request parameters is insecure!" <add> raise ArgumentError, "Generating a URL from non sanitized request parameters is insecure!" <ide> end <ide> when Array <ide> opts = url_options.extract_options!
1
Ruby
Ruby
add list --json
832073a3c7de32346d09409569b48ed672418527
<ide><path>Library/Homebrew/cask/cmd/list.rb <ide> module Cask <ide> class Cmd <ide> class List < AbstractCommand <del> option "-1", :one, false <del> option "--versions", :versions, false <del> option "--full-name", :full_name, false <add> option "-1", :one, false <add> option "--versions", :versions, false <add> option "--full-name", :full_name, false <add> option "--json", :json, false <add> <add> def self.usage <add> <<~EOS <add> `cask list`, `cask ls` [<options>] [<casks>] <add> <add> -1 - Force output to be one entry per line. <add> This is the default when output is not to a terminal. <add> --versions - Show the version number for installed formulae, or only the specified <add> casks if <casks> are provided. <add> --full-name - Print casks with fully-qualified names. <add> --json - Print a JSON representation of <cask>. See the docs for examples of using the JSON <add> output: <https://docs.brew.sh/Querying-Brew> <add> <add> List all installed casks. <add> <add> If <casks> are provided, limit information to just those casks. <add> EOS <add> end <add> <add> def self.help <add> "lists installed Casks or the casks provided in the arguments" <add> end <ide> <ide> def run <del> args.any? ? list : list_installed <add> output = args.any? ? provided_list : Caskroom.casks <add> <add> if json? <add> puts JSON.generate(output.map(&:to_h)) <add> elsif one? <add> puts output.map(&:to_s) <add> elsif full_name? <add> puts output.map(&:full_name).sort(&tap_and_name_comparison) <add> elsif versions? <add> puts output.map(&self.class.method(:format_versioned)) <add> elsif !output.empty? && args.any? <add> puts output.map(&self.class.method(:list_artifacts)) <add> elsif !output.empty? <add> puts Formatter.columns(output.map(&:to_s)) <add> end <ide> end <ide> <del> def list <add> def provided_list <ide> casks.each do |cask| <ide> raise CaskNotInstalledError, cask unless cask.installed? <del> <del> if one? <del> puts cask.token <del> elsif versions? <del> puts self.class.format_versioned(cask) <del> else <del> cask = CaskLoader.load(cask.installed_caskfile) <del> self.class.list_artifacts(cask) <del> end <ide> end <add> casks <ide> end <ide> <ide> def self.list_artifacts(cask) <ide> cask.artifacts.group_by(&:class).each do |klass, artifacts| <ide> next unless klass.respond_to?(:english_description) <ide> <del> ohai klass.english_description, artifacts.map(&:summarize_installed) <del> end <del> end <del> <del> def list_installed <del> installed_casks = Caskroom.casks <del> <del> if one? <del> puts installed_casks.map(&:to_s) <del> elsif versions? <del> puts installed_casks.map(&self.class.method(:format_versioned)) <del> elsif full_name? <del> puts installed_casks.map(&:full_name).sort(&tap_and_name_comparison) <del> elsif !installed_casks.empty? <del> puts Formatter.columns(installed_casks.map(&:to_s)) <add> return "==> #{klass.english_description}", artifacts.map(&:summarize_installed) <ide> end <ide> end <ide> <ide> def self.format_versioned(cask) <ide> cask.to_s.concat(cask.versions.map(&:to_s).join(" ").prepend(" ")) <ide> end <del> <del> def self.help <del> "with no args, lists installed Casks; given installed Casks, lists staged files" <del> end <ide> end <ide> end <ide> end <ide><path>Library/Homebrew/test/cask/cmd/list_spec.rb <ide> EOS <ide> end <ide> <add> it "lists oneline" do <add> casks = %w[ <add> local-caffeine <add> third-party/tap/third-party-cask <add> local-transmission <add> ].map { |c| Cask::CaskLoader.load(c) } <add> <add> casks.each do |c| <add> InstallHelper.install_with_caskfile(c) <add> end <add> <add> expect { <add> described_class.run("-1") <add> }.to output(<<~EOS).to_stdout <add> local-caffeine <add> local-transmission <add> third-party-cask <add> EOS <add> end <add> <ide> it "lists full names" do <ide> casks = %w[ <ide> local-caffeine <ide> end <ide> end <ide> <add> describe "lists json" do <add> let(:casks) { ["local-caffeine", "local-transmission"] } <add> let(:expected_output) { <add> <<~EOS <add> [{"token":"local-caffeine","name":[],"homepage":"https://brew.sh/","url":"file:///usr/local/Homebrew/Library/Homebrew/test/support/fixtures/cask/caffeine.zip","appcast":null,"version":"1.2.3","sha256":"67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94","artifacts":[["Caffeine.app"]],"caveats":null,"depends_on":{},"conflicts_with":null,"container":null,"auto_updates":null},{"token":"local-transmission","name":["Transmission"],"homepage":"https://brew.sh/","url":"file:///usr/local/Homebrew/Library/Homebrew/test/support/fixtures/cask/transmission-2.61.dmg","appcast":null,"version":"2.61","sha256":"e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68","artifacts":[["Transmission.app"]],"caveats":null,"depends_on":{},"conflicts_with":null,"container":null,"auto_updates":null}] <add> EOS <add> } <add> <add> before do <add> casks.map(&Cask::CaskLoader.method(:load)).each(&InstallHelper.method(:install_with_caskfile)) <add> end <add> <add> it "of all installed Casks" do <add> expect { <add> described_class.run("--json") <add> }.to output(expected_output).to_stdout <add> end <add> <add> it "of given Casks" do <add> expect { <add> described_class.run("--json", "local-caffeine", "local-transmission") <add> }.to output(expected_output).to_stdout <add> end <add> end <add> <ide> describe "given a set of installed Casks" do <ide> let(:caffeine) { Cask::CaskLoader.load(cask_path("local-caffeine")) } <ide> let(:transmission) { Cask::CaskLoader.load(cask_path("local-transmission")) }
2
Javascript
Javascript
fix logluvtolinear convert error
43918cc66cbce4dcb97a3904ef804518846ff7ea
<ide><path>src/renderers/shaders/ShaderChunk/encodings_pars_fragment.glsl.js <ide> vec4 LogLuvToLinear( in vec4 value ) { <ide> Xp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 ); <ide> Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y; <ide> Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z; <del> vec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM; <add> vec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb; <ide> return vec4( max( vRGB, 0.0 ), 1.0 ); <ide> } <ide> `;
1
Python
Python
fix new feature flags
4d2d7d586608ddc0bcb2857fb3c2d0d4c151ebfc
<ide><path>spacy/_ml.py <ide> def Tok2Vec(width, embed_size, **kwargs): <ide> shape = HashEmbed(width, embed_size//2, column=cols.index(SHAPE), <ide> name='embed_shape') <ide> else: <del> prefix, suffix, shape = None <add> prefix, suffix, shape = (None, None, None) <ide> if pretrained_vectors is not None: <ide> glove = StaticVectors(pretrained_vectors, width, column=cols.index(ID)) <ide> <ide><path>spacy/cli/ud_train.py <ide> def initialize_pipeline(nlp, docs, golds, config, device): <ide> nlp.tagger.add_label(tag) <ide> return nlp.begin_training( <ide> lambda: golds_to_gold_tuples(docs, golds), device=device, <del> subword_features=config.subword_features, config.conv_depth=conv_depth) <add> subword_features=config.subword_features, conv_depth=config.conv_depth) <ide> <ide> <ide> ########################
2
PHP
PHP
remove dead method
2de57f1b77f12650d62ca66d4fae4d9a59103dbe
<ide><path>src/View/Helper/FormHelper.php <ide> protected function _addDefaultContextProviders() <ide> } <ide> <ide> /** <del> * Returns if a field is required to be filled based on validation properties from the validating object. <del> * <del> * @param \Cake\Validation\ValidationSet $validationRules Validation rules set. <del> * @return bool true if field is required to be filled, false otherwise <del> */ <del> protected function _isRequiredField($validationRules) <del> { <del> if (empty($validationRules) || count($validationRules) === 0) { <del> return false; <del> } <del> $validationRules->isUpdate($this->requestType === 'put'); <del> foreach ($validationRules as $rule) { <del> if ($rule->skip()) { <del> continue; <del> } <del> <del> return !$validationRules->isEmptyAllowed(); <del> } <del> <del> return false; <del> } <del> <del> /** <del> * Returns an HTML FORM element. <add> * Returns an HTML form element. <ide> * <ide> * ### Options: <ide> *
1
Python
Python
add batchnorm tests for cntk
81ab7573565e3f3d09a077945f4ab2659c9c48d9
<ide><path>keras/backend/cntk_backend.py <ide> def normalize_batch_in_training(x, gamma, beta, <ide> for axis in range(1, ndim(x)): <ide> if axis in reduction_axes: <ide> target_shape.append(1) <add> if ndim(gamma) > axis: <add> gamma = C.reduce_mean(gamma, axis - 1) <add> beta = C.reduce_mean(beta, axis - 1) <ide> else: <ide> target_shape.append(x_shape[axis]) <ide> <ide><path>tests/keras/backend/backend_test.py <ide> def test_batchnorm(self): <ide> x_shape = (1, 4) + shape <ide> else: <ide> x_shape = (1,) + shape + (4,) <del> xth = KTH.variable(np.random.random(x_shape)) <del> xtf = KTF.variable(np.random.random(x_shape)) <add> x_val = np.random.random(x_shape).astype(np.float32) <add> xth = KTH.variable(x_val) <add> xtf = KTF.variable(x_val) <add> xc = KC.placeholder(x_shape) <ide> zth, _, _ = KTH.normalize_batch_in_training(xth, None, None, <ide> reduction_axes='per-activation') <ide> ztf, _, _ = KTF.normalize_batch_in_training(xtf, None, None, <ide> reduction_axes=[0, 1, 2, 3]) <add> zc, _, _ = KC.normalize_batch_in_training(xc, None, None, <add> reduction_axes=[0, 1, 2, 3]) <ide> zth = KTH.eval(zth) <ide> ztf = KTF.eval(ztf) <add> zc = KC.function([xc], [zc])([x_val])[0] <ide> assert zth.shape == ztf.shape <add> assert zth.shape == zc.shape <ide> <ide> def test_ctc(self): <ide> # simplified version of TensorFlow's test
2
Text
Text
note macstadium, add more links
9aa4888d2b45c7a07a95183cc4c026d828391914
<ide><path>README.md <ide> Please consider a regular donation through Patreon: <ide> [![Donate with Patreon](https://img.shields.io/badge/patreon-donate-green.svg)](https://www.patreon.com/homebrew) <ide> <ide> ## Sponsors <del>Our CI infrastructure was paid for by [our Kickstarter supporters](http://docs.brew.sh/Kickstarter-Supporters.html). <add>Our Xserve ESXi boxes for CI are hosted by [MacStadium](https://www.macstadium.com). <ide> <del>Our CI infrastructure is hosted by [The Positive Internet Company](http://www.positive-internet.com). <add>[![Powered by MacStadium](https://cloud.githubusercontent.com/assets/125011/22776032/097557ac-eea6-11e6-8ba8-eff22dfd58f1.png)](https://www.macstadium.com) <ide> <del>Our bottles (binary packages) are hosted by Bintray. <add>Our Mac Minis for CI were paid for by [our Kickstarter supporters](http://docs.brew.sh/Kickstarter-Supporters.html). <add> <add>Our Mac Minis for CI are hosted by [The Positive Internet Company](http://www.positive-internet.com). <add> <add>Our bottles (binary packages) are hosted by [Bintray](https://bintray.com/homebrew). <ide> <ide> [![Downloads by Bintray](https://bintray.com/docs/images/downloads_by_bintray_96.png)](https://bintray.com/homebrew) <ide> <del>Secure password storage and syncing provided by [1Password for Teams](https://1password.com/teams/) by AgileBits <add>Secure password storage and syncing provided by [1Password for Teams](https://1password.com/teams/) by [AgileBits](https://agilebits.com) <ide> <ide> [![AgileBits](https://da36klfizjv29.cloudfront.net/assets/branding/agilebits-fcca96e9b8e815c5c48c6b3e98156cb5.png)](https://agilebits.com) <ide>
1
Go
Go
add test for recording restart policy name
c3ed49dcdb2d835bf4fbdebe3f07318c945282c8
<ide><path>integration-cli/docker_cli_restart_test.go <ide> func TestRestartWithVolumes(t *testing.T) { <ide> <ide> logDone("restart - does not create a new volume on restart") <ide> } <add> <add>func TestRecordRestartPolicyNO(t *testing.T) { <add> defer deleteAllContainers() <add> <add> cmd := exec.Command(dockerBinary, "run", "-d", "--restart=no", "busybox", "false") <add> out, _, err := runCommandWithOutput(cmd) <add> if err != nil { <add> t.Fatal(err, out) <add> } <add> <add> id := strings.TrimSpace(string(out)) <add> name, err := inspectField(id, "HostConfig.RestartPolicy.Name") <add> if err != nil { <add> t.Fatal(err, out) <add> } <add> if name != "no" { <add> t.Fatalf("Container restart policy name is %s, expected %s", name, "no") <add> } <add> <add> logDone("restart - recording restart policy name for --restart=no") <add>} <add> <add>func TestRecordRestartPolicyAlways(t *testing.T) { <add> defer deleteAllContainers() <add> <add> cmd := exec.Command(dockerBinary, "run", "-d", "--restart=always", "busybox", "false") <add> out, _, err := runCommandWithOutput(cmd) <add> if err != nil { <add> t.Fatal(err, out) <add> } <add> <add> id := strings.TrimSpace(string(out)) <add> name, err := inspectField(id, "HostConfig.RestartPolicy.Name") <add> if err != nil { <add> t.Fatal(err, out) <add> } <add> if name != "always" { <add> t.Fatalf("Container restart policy name is %s, expected %s", name, "always") <add> } <add> <add> cmd = exec.Command(dockerBinary, "stop", id) <add> out, _, err = runCommandWithOutput(cmd) <add> if err != nil { <add> t.Fatal(err, out) <add> } <add> <add> logDone("restart - recording restart policy name for --restart=always") <add>} <add> <add>func TestRecordRestartPolicyOnFailure(t *testing.T) { <add> defer deleteAllContainers() <add> <add> cmd := exec.Command(dockerBinary, "run", "-d", "--restart=on-failure:1", "busybox", "false") <add> out, _, err := runCommandWithOutput(cmd) <add> if err != nil { <add> t.Fatal(err, out) <add> } <add> <add> id := strings.TrimSpace(string(out)) <add> name, err := inspectField(id, "HostConfig.RestartPolicy.Name") <add> if err != nil { <add> t.Fatal(err, out) <add> } <add> if name != "on-failure" { <add> t.Fatalf("Container restart policy name is %s, expected %s", name, "on-failure") <add> } <add> <add> logDone("restart - recording restart policy name for --restart=on-failure") <add>}
1
Ruby
Ruby
use strip_heredoc to keep indentation consistent
13c9195b12e2a6c87056d24968f092ba97e14364
<ide><path>actionpack/lib/action_dispatch/routing/inspector.rb <ide> def header(routes) <ide> end <ide> <ide> def no_routes <del> @buffer << <<-MESSAGE <del>You don't have any routes defined! <add> @buffer << <<-MESSAGE.strip_heredoc <add> You don't have any routes defined! <ide> <del>Please add some routes in config/routes.rb. <add> Please add some routes in config/routes.rb. <ide> <del>For more information about routes, see the Rails Guide: http://guides.rubyonrails.org/routing.html . <del>MESSAGE <add> For more information about routes, see the Rails Guide: http://guides.rubyonrails.org/routing.html . <add> MESSAGE <ide> end <ide> <ide> private <ide> def section(routes) <ide> end <ide> <ide> def no_routes <del> @buffer << <<-MESSAGE <del><p>You don't have any routes defined!</p> <del><ul> <del><li>Please add some routes in config/routes.rb.</li> <del><li>For more information about routes, please <a href="http://guides.rubyonrails.org/routing.html">see the Rails Guide</a>.</li> <del></ul> <del>MESSAGE <add> @buffer << <<-MESSAGE.strip_heredoc <add> <p>You don't have any routes defined!</p> <add> <ul> <add> <li>Please add some routes in config/routes.rb.</li> <add> <li>For more information about routes, please <a href="http://guides.rubyonrails.org/routing.html">see the Rails Guide</a>.</li> <add> </ul> <add> MESSAGE <ide> end <ide> <ide> def result
1
Java
Java
remove misleading default note on iso.date_time
86f9716fef89a25462f5d55c9d430cf8cd62c82c
<ide><path>spring-context/src/main/java/org/springframework/format/annotation/DateTimeFormat.java <ide> /* <del> * Copyright 2002-2018 the original author or authors. <add> * Copyright 2002-2020 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> enum ISO { <ide> /** <ide> * The most common ISO DateTime Format {@code yyyy-MM-dd'T'HH:mm:ss.SSSXXX}, <ide> * e.g. "2000-10-31T01:30:00.000-05:00". <del> * <p>This is the default if no annotation value is specified. <ide> */ <ide> DATE_TIME, <ide>
1