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
|
---|---|---|---|---|---|
Javascript | Javascript | fix ref type for native scroll view | db662af5b28d0ad42abd1da67c32f2c38ff04900 | <ide><path>Libraries/Components/ScrollView/ScrollView.js
<ide> import type {
<ide> ScrollEvent,
<ide> LayoutEvent,
<ide> } from '../../Types/CoreEventTypes';
<add>import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
<ide> import type {State as ScrollResponderState} from '../ScrollResponder';
<ide> import type {ViewProps} from '../View/ViewPropTypes';
<ide> import type {Props as ScrollViewStickyHeaderProps} from './ScrollViewStickyHeader';
<ide> class ScrollView extends React.Component<Props, State> {
<ide> return ReactNative.findNodeHandle(this._innerViewRef);
<ide> }
<ide>
<del> getInnerViewRef(): ?React.ElementRef<
<del> Class<ReactNative.NativeComponent<mixed>>,
<del> > {
<add> getInnerViewRef(): ?React.ElementRef<HostComponent<mixed>> {
<ide> return this._innerViewRef;
<ide> }
<ide>
<del> getNativeScrollRef(): ?React.ElementRef<
<del> Class<ReactNative.NativeComponent<mixed>>,
<del> > {
<add> getNativeScrollRef(): ?React.ElementRef<HostComponent<mixed>> {
<ide> return this._scrollViewRef;
<ide> }
<ide>
<ide> class ScrollView extends React.Component<Props, State> {
<ide> this.props.onContentSizeChange(width, height);
<ide> };
<ide>
<del> _scrollViewRef: ?React.ElementRef<
<del> Class<ReactNative.NativeComponent<mixed>>,
<del> > = null;
<del> _setScrollViewRef = (
<del> ref: ?React.ElementRef<Class<ReactNative.NativeComponent<mixed>>>,
<del> ) => {
<add> _scrollViewRef: ?React.ElementRef<HostComponent<mixed>> = null;
<add> _setScrollViewRef = (ref: ?React.ElementRef<HostComponent<mixed>>) => {
<ide> this._scrollViewRef = ref;
<ide> };
<ide>
<del> _innerViewRef: ?React.ElementRef<
<del> Class<ReactNative.NativeComponent<mixed>>,
<del> > = null;
<del> _setInnerViewRef = (
<del> ref: ?React.ElementRef<Class<ReactNative.NativeComponent<mixed>>>,
<del> ) => {
<add> _innerViewRef: ?React.ElementRef<HostComponent<mixed>> = null;
<add> _setInnerViewRef = (ref: ?React.ElementRef<HostComponent<mixed>>) => {
<ide> this._innerViewRef = ref;
<ide> };
<ide>
<ide> class ScrollView extends React.Component<Props, State> {
<ide> const contentContainer = (
<ide> <ScrollContentContainerViewClass
<ide> {...contentSizeChangeProps}
<del> // $FlowFixMe Invalid prop usage
<ide> ref={this._setInnerViewRef}
<ide> style={contentContainerStyle}
<ide> removeClippedSubviews={
<ide> class ScrollView extends React.Component<Props, State> {
<ide> // On iOS the RefreshControl is a child of the ScrollView.
<ide> // tvOS lacks native support for RefreshControl, so don't include it in that case
<ide> return (
<del> // $FlowFixMe
<ide> <ScrollViewClass {...props} ref={this._setScrollViewRef}>
<ide> {Platform.isTV ? null : refreshControl}
<ide> {contentContainer}
<ide> class ScrollView extends React.Component<Props, State> {
<ide> <ScrollViewClass
<ide> {...props}
<ide> style={[baseStyle, inner]}
<del> // $FlowFixMe
<ide> ref={this._setScrollViewRef}>
<ide> {contentContainer}
<ide> </ScrollViewClass>,
<ide> );
<ide> }
<ide> }
<ide> return (
<del> // $FlowFixMe
<ide> <ScrollViewClass {...props} ref={this._setScrollViewRef}>
<ide> {contentContainer}
<ide> </ScrollViewClass> | 1 |
Text | Text | update cross-compiler practice in core | d0b0dafb0bbe4eaa253ba7ccbab898c7c49a46c4 | <ide><path>docs/Custom-GCC-and-cross-compilers.md
<ide> # Custom GCC and Cross Compilers
<ide>
<del>Homebrew depends on having an up-to-date version of Xcode because it comes with
<del>specific versions of build tools, e.g. `clang`.
<add>Homebrew depends on having an up-to-date version of Xcode because it comes with specific versions of build tools, e.g. `clang`. Installing a custom version of GCC or Autotools into your `PATH` has the potential to break lots of compiles so we prefer the Apple or Homebrew-provided compilers. Cross-compilers based on GCC will typically be "keg-only" and therefore not linked into your `PATH` by default, or are prefixed with the target architecture, again to avoid conflicting with Apple or Homebrew compilers.
<ide>
<del>Installing a custom version of GCC or `autotools` into the `PATH` has the
<del>potential to break lots of compiles so we prefer the Apple- or Homebrew-provided
<del>compilers.
<add>Rather than merging formulae for either of these cases at this time, we're listing them on this page. If you come up with a formula for a new version of GCC or cross-compiler suite, please link it in here.
<ide>
<del>Cross-compilers based on GCC will typically be "keg-only" and therefore not
<del>linked into the path by default.
<del>
<del>Rather than merging in brews for either of these cases at this time, we're
<del>listing them on this page. If you come up with a formula for a new version of
<del>GCC or cross-compiler suite, please link it in here.
<del>
<del>- Homebrew provides a `gcc` formula for use with Xcode 4.2+ or when needing
<del> C++11 support on earlier versions.
<add>- Homebrew provides a `gcc` formula for use with Xcode 4.2+.
<ide> - Homebrew provides older GCC formulae, e.g. `gcc@7`
<add>- Homebrew provides some cross-compilers and toolchains, but these are named to avoid clashing with the default tools, e.g. `x86_64-elf-gcc`
<ide> - Homebrew provides the LLVM Clang, which is bundled with the `llvm` formula.
<del>- [RISC-V](https://github.com/riscv/homebrew-riscv) provides the RISC-V
<del> toolchain including binutils and GCC.
<add>- [RISC-V](https://github.com/riscv/homebrew-riscv) provides the RISC-V toolchain including binutils and GCC. | 1 |
Python | Python | fix line with too many characters | eefd967f49192fb769154e930be8480af369a752 | <ide><path>keras/utils/vis_utils.py
<ide> def format_shape(shape):
<ide> [format_shape(ishape) for ishape in layer.input_shapes])
<ide> else:
<ide> inputlabels = '?'
<del> label = '{%s}|{input:|output:}|{{%s}|{%s}}' % (label, inputlabels, outputlabels)
<add> label = '{%s}|{input:|output:}|{{%s}|{%s}}' % (
<add> label, inputlabels, outputlabels)
<ide> if not expand_nested or not isinstance(
<ide> layer, functional.Functional):
<ide> node = pydot.Node(layer_id, label=label) | 1 |
Java | Java | fix error responses handling in webclient | 81125de6979b84f8cf30ea31c372e87dde98d9a4 | <ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/function/client/DefaultWebClient.java
<ide> public <T> Mono<T> bodyToMono(Class<T> bodyType) {
<ide> public <T> Mono<T> bodyToMono(ParameterizedTypeReference<T> typeReference) {
<ide> return this.responseMono.flatMap(
<ide> response -> bodyToMono(response, BodyExtractors.toMono(typeReference),
<del> mono -> (Mono<T>)mono));
<add> this::monoThrowableToMono));
<ide> }
<ide>
<ide> private <T> Mono<T> monoThrowableToMono(Mono<? extends Throwable> mono) { | 1 |
Javascript | Javascript | build the webui | b0dcf8b30682971c0ba155e1b9086e1eed74d54a | <ide><path>glances/outputs/static/public/js/main.min.js
<ide> function GlancesPluginDockerController($scope, GlancesStats) {
<ide>
<ide> 'use strict';
<ide>
<del>glancesApp.component('glancesPluginFolders', {
<del> controller: GlancesPluginFsController,
<del> controllerAs: 'vm',
<del> templateUrl: 'components/plugin-folders/view.html'
<del>});
<del>
<del>'use strict';
<del>
<del>function GlancesPluginFoldersController($scope, GlancesStats) {
<del> var vm = this;
<del> vm.folders = [];
<del>
<del> vm.$onInit = function () {
<del> loadData(GlancesStats.getData());
<del> };
<del>
<del> $scope.$on('data_refreshed', function (event, data) {
<del> loadData(data);
<del> });
<del>
<del> var loadData = function (data) {
<del> var stats = data.stats['folders'];
<del> vm.folders = [];
<del>
<del> for (var i = 0; i < stats.length; i++) {
<del> var folderData = stats[i];
<del>
<del> var folder = {
<del> 'path': folderData['path'],
<del> 'size': folderData['size'],
<del> 'careful': folderData['careful'],
<del> 'warning': folderData['warning'],
<del> 'critical': folderData['critical']
<del> };
<del>
<del> vm.folders.push(folder);
<del> }
<del> }
<del>
<del> vm.getDecoration = function (folder) {
<del>
<del> if (!Number.isInteger(folder.size)) {
<del> return;
<del> }
<del>
<del> if (folder.critical !== null && folder.size > (folder.critical * 1000000)) {
<del> return 'critical';
<del> } else if (folder.warning !== null && folder.size > (folder.warning * 1000000)) {
<del> return 'warning';
<del> } else if (folder.careful !== null && folder.size > (folder.careful * 1000000)) {
<del> return 'careful';
<del> }
<del>
<del> return 'ok';
<del> };
<del>}
<del>
<del>'use strict';
<del>
<ide> glancesApp.component('glancesPluginFs', {
<ide> controller: GlancesPluginFsController,
<ide> controllerAs: 'vm',
<ide> function GlancesPluginGpuController($scope, GlancesStats, ARGUMENTS) {
<ide>
<ide> 'use strict';
<ide>
<add>glancesApp.component('glancesPluginFolders', {
<add> controller: GlancesPluginFsController,
<add> controllerAs: 'vm',
<add> templateUrl: 'components/plugin-folders/view.html'
<add>});
<add>
<add>'use strict';
<add>
<add>function GlancesPluginFoldersController($scope, GlancesStats) {
<add> var vm = this;
<add> vm.folders = [];
<add>
<add> vm.$onInit = function () {
<add> loadData(GlancesStats.getData());
<add> };
<add>
<add> $scope.$on('data_refreshed', function (event, data) {
<add> loadData(data);
<add> });
<add>
<add> var loadData = function (data) {
<add> var stats = data.stats['folders'];
<add> vm.folders = [];
<add>
<add> for (var i = 0; i < stats.length; i++) {
<add> var folderData = stats[i];
<add>
<add> var folder = {
<add> 'path': folderData['path'],
<add> 'size': folderData['size'],
<add> 'careful': folderData['careful'],
<add> 'warning': folderData['warning'],
<add> 'critical': folderData['critical']
<add> };
<add>
<add> vm.folders.push(folder);
<add> }
<add> }
<add>
<add> vm.getDecoration = function (folder) {
<add>
<add> if (!Number.isInteger(folder.size)) {
<add> return;
<add> }
<add>
<add> if (folder.critical !== null && folder.size > (folder.critical * 1000000)) {
<add> return 'critical';
<add> } else if (folder.warning !== null && folder.size > (folder.warning * 1000000)) {
<add> return 'warning';
<add> } else if (folder.careful !== null && folder.size > (folder.careful * 1000000)) {
<add> return 'careful';
<add> }
<add>
<add> return 'ok';
<add> };
<add>}
<add>
<add>'use strict';
<add>
<ide> glancesApp.component('glancesPluginIp', {
<ide> controller: GlancesPluginIpController,
<ide> controllerAs: 'vm',
<ide> function GlancesPluginIrqController($scope, GlancesStats) {
<ide>
<ide> 'use strict';
<ide>
<del>glancesApp.component('glancesPluginLoad', {
<del> controller: GlancesPluginLoadController,
<del> controllerAs: 'vm',
<del> templateUrl: 'components/plugin-load/view.html'
<del>});
<del>
<del>'use strict';
<del>
<del>function GlancesPluginLoadController($scope, GlancesStats) {
<del> var vm = this;
<del> var _view = {};
<del>
<del> vm.cpucore = null;
<del> vm.min1 = null;
<del> vm.min5 = null;
<del> vm.min15 = null;
<del>
<del> vm.$onInit = function () {
<del> loadData(GlancesStats.getData());
<del> };
<del>
<del> $scope.$on('data_refreshed', function (event, data) {
<del> loadData(data);
<del> });
<del>
<del> var loadData = function (data) {
<del> var stats = data.stats['load'];
<del> _view = data.views['load'];
<del>
<del> vm.cpucore = stats['cpucore'];
<del> vm.min1 = stats['min1'];
<del> vm.min5 = stats['min5'];
<del> vm.min15 = stats['min15'];
<del> };
<del>
<del> vm.getDecoration = function (value) {
<del> if (_view[value] === undefined) {
<del> return;
<del> }
<del>
<del> return _view[value].decoration.toLowerCase();
<del> };
<del>}
<del>
<del>'use strict';
<del>
<ide> glancesApp.component('glancesPluginMem', {
<ide> controller: GlancesPluginMemController,
<ide> controllerAs: 'vm',
<ide> function GlancesPluginMemMoreController($scope, GlancesStats) {
<ide>
<ide> 'use strict';
<ide>
<add>glancesApp.component('glancesPluginLoad', {
<add> controller: GlancesPluginLoadController,
<add> controllerAs: 'vm',
<add> templateUrl: 'components/plugin-load/view.html'
<add>});
<add>
<add>'use strict';
<add>
<add>function GlancesPluginLoadController($scope, GlancesStats) {
<add> var vm = this;
<add> var _view = {};
<add>
<add> vm.cpucore = null;
<add> vm.min1 = null;
<add> vm.min5 = null;
<add> vm.min15 = null;
<add>
<add> vm.$onInit = function () {
<add> loadData(GlancesStats.getData());
<add> };
<add>
<add> $scope.$on('data_refreshed', function (event, data) {
<add> loadData(data);
<add> });
<add>
<add> var loadData = function (data) {
<add> var stats = data.stats['load'];
<add> _view = data.views['load'];
<add>
<add> vm.cpucore = stats['cpucore'];
<add> vm.min1 = stats['min1'];
<add> vm.min5 = stats['min5'];
<add> vm.min15 = stats['min15'];
<add> };
<add>
<add> vm.getDecoration = function (value) {
<add> if (_view[value] === undefined) {
<add> return;
<add> }
<add>
<add> return _view[value].decoration.toLowerCase();
<add> };
<add>}
<add>
<add>'use strict';
<add>
<ide> glancesApp.component('glancesPluginMemswap', {
<ide> controller: GlancesPluginMemswapController,
<ide> controllerAs: 'vm',
<ide> function GlancesPluginProcessController(ARGUMENTS, hotkeys) {
<ide>
<ide> 'use strict';
<ide>
<del>glancesApp.component('glancesPluginProcesscount', {
<del> controller: GlancesPluginProcesscountController,
<add>glancesApp.component('glancesPluginQuicklook', {
<add> controller: GlancesPluginQuicklookController,
<ide> controllerAs: 'vm',
<del> bindings: {
<del> sorter: '<'
<del> },
<del> templateUrl: 'components/plugin-processcount/view.html'
<add> templateUrl: 'components/plugin-quicklook/view.html'
<ide> });
<ide>
<ide> 'use strict';
<ide>
<del>function GlancesPluginProcesscountController($scope, GlancesStats) {
<add>function GlancesPluginQuicklookController($scope, GlancesStats, ARGUMENTS) {
<ide> var vm = this;
<add> vm.arguments = ARGUMENTS;
<add> var _view = {};
<ide>
<del> vm.total = null;
<del> vm.running = null;
<del> vm.sleeping = null;
<del> vm.stopped = null;
<del> vm.thread = null;
<add> vm.mem = null;
<add> vm.cpu = null;
<add> vm.cpu_name = null;
<add> vm.cpu_hz_current = null;
<add> vm.cpu_hz = null;
<add> vm.swap = null;
<add> vm.percpus = [];
<ide>
<ide> vm.$onInit = function () {
<ide> loadData(GlancesStats.getData());
<ide> function GlancesPluginProcesscountController($scope, GlancesStats) {
<ide> });
<ide>
<ide> var loadData = function (data) {
<del> var processcountStats = data.stats['processcount'];
<add> var stats = data.stats['quicklook'];
<add> _view = data.views['quicklook'];
<ide>
<del> vm.total = processcountStats['total'] || 0;
<del> vm.running = processcountStats['running'] || 0;
<del> vm.sleeping = processcountStats['sleeping'] || 0;
<del> vm.stopped = processcountStats['stopped'] || 0;
<del> vm.thread = processcountStats['thread'] || 0;
<del> }
<add> vm.mem = stats.mem;
<add> vm.cpu = stats.cpu;
<add> vm.cpu_name = stats.cpu_name;
<add> vm.cpu_hz_current = stats.cpu_hz_current;
<add> vm.cpu_hz = stats.cpu_hz;
<add> vm.swap = stats.swap;
<add> vm.percpus = [];
<add>
<add> angular.forEach(stats.percpu, function (cpu) {
<add> vm.percpus.push({
<add> 'number': cpu.cpu_number,
<add> 'total': cpu.total
<add> });
<add> }, this);
<add> };
<add>
<add> vm.getDecoration = function (value) {
<add> if (_view[value] === undefined) {
<add> return;
<add> }
<add>
<add> return _view[value].decoration.toLowerCase();
<add> };
<ide> }
<ide>
<ide> 'use strict';
<ide> function GlancesPluginProcesslistController($scope, GlancesStats, GlancesPluginH
<ide>
<ide> 'use strict';
<ide>
<del>glancesApp.component('glancesPluginQuicklook', {
<del> controller: GlancesPluginQuicklookController,
<add>glancesApp.component('glancesPluginProcesscount', {
<add> controller: GlancesPluginProcesscountController,
<ide> controllerAs: 'vm',
<del> templateUrl: 'components/plugin-quicklook/view.html'
<add> bindings: {
<add> sorter: '<'
<add> },
<add> templateUrl: 'components/plugin-processcount/view.html'
<ide> });
<ide>
<ide> 'use strict';
<ide>
<del>function GlancesPluginQuicklookController($scope, GlancesStats, ARGUMENTS) {
<add>function GlancesPluginProcesscountController($scope, GlancesStats) {
<ide> var vm = this;
<del> vm.arguments = ARGUMENTS;
<del> var _view = {};
<ide>
<del> vm.mem = null;
<del> vm.cpu = null;
<del> vm.cpu_name = null;
<del> vm.cpu_hz_current = null;
<del> vm.cpu_hz = null;
<del> vm.swap = null;
<del> vm.percpus = [];
<add> vm.total = null;
<add> vm.running = null;
<add> vm.sleeping = null;
<add> vm.stopped = null;
<add> vm.thread = null;
<ide>
<ide> vm.$onInit = function () {
<ide> loadData(GlancesStats.getData());
<ide> function GlancesPluginQuicklookController($scope, GlancesStats, ARGUMENTS) {
<ide> });
<ide>
<ide> var loadData = function (data) {
<del> var stats = data.stats['quicklook'];
<del> _view = data.views['quicklook'];
<add> var processcountStats = data.stats['processcount'];
<ide>
<del> vm.mem = stats.mem;
<del> vm.cpu = stats.cpu;
<del> vm.cpu_name = stats.cpu_name;
<del> vm.cpu_hz_current = stats.cpu_hz_current;
<del> vm.cpu_hz = stats.cpu_hz;
<del> vm.swap = stats.swap;
<del> vm.percpus = [];
<add> vm.total = processcountStats['total'] || 0;
<add> vm.running = processcountStats['running'] || 0;
<add> vm.sleeping = processcountStats['sleeping'] || 0;
<add> vm.stopped = processcountStats['stopped'] || 0;
<add> vm.thread = processcountStats['thread'] || 0;
<add> }
<add>}
<ide>
<del> angular.forEach(stats.percpu, function (cpu) {
<del> vm.percpus.push({
<del> 'number': cpu.cpu_number,
<del> 'total': cpu.total
<del> });
<del> }, this);
<add>'use strict';
<add>
<add>glancesApp.component('glancesPluginSensors', {
<add> controller: GlancesPluginSensorsController,
<add> controllerAs: 'vm',
<add> templateUrl: 'components/plugin-sensors/view.html'
<add>});
<add>
<add>'use strict';
<add>
<add>function GlancesPluginSensorsController($scope, GlancesStats, GlancesPluginHelper, ARGUMENTS) {
<add> var vm = this;
<add> vm.sensors = [];
<add> var convertToFahrenheit = ARGUMENTS.fahrenheit;
<add>
<add> vm.$onInit = function () {
<add> loadData(GlancesStats.getData());
<ide> };
<ide>
<del> vm.getDecoration = function (value) {
<del> if (_view[value] === undefined) {
<del> return;
<del> }
<add> $scope.$on('data_refreshed', function (event, data) {
<add> loadData(data);
<add> });
<ide>
<del> return _view[value].decoration.toLowerCase();
<add> var loadData = function (data) {
<add> var stats = data.stats['sensors'];
<add>
<add> _.remove(stats, function (sensor) {
<add> return (_.isArray(sensor.value) && _.isEmpty(sensor.value)) || sensor.value === 0;
<add> });
<add>
<add> _.forEach(stats, function (sensor) {
<add> if (convertToFahrenheit && sensor.type != 'battery' && sensor.type != 'fan_speed') {
<add> sensor.value = parseFloat(sensor.value * 1.8 + 32).toFixed(1);
<add> sensor.unit = 'F';
<add> }
<add> });
<add>
<add> vm.sensors = stats;
<add> };
<add>
<add> vm.getAlert = function (sensor) {
<add> var current = sensor.type == 'battery' ? 100 - sensor.value : sensor.value;
<add>
<add> return GlancesPluginHelper.getAlert('sensors', 'sensors_' + sensor.type + '_', current);
<ide> };
<ide> }
<ide>
<ide> function GlancesPluginRaidController($scope, GlancesStats) {
<ide>
<ide> 'use strict';
<ide>
<del>glancesApp.component('glancesPluginSensors', {
<del> controller: GlancesPluginSensorsController,
<del> controllerAs: 'vm',
<del> templateUrl: 'components/plugin-sensors/view.html'
<del>});
<del>
<del>'use strict';
<del>
<del>function GlancesPluginSensorsController($scope, GlancesStats, GlancesPluginHelper, ARGUMENTS) {
<del> var vm = this;
<del> vm.sensors = [];
<del> var convertToFahrenheit = ARGUMENTS.fahrenheit;
<del>
<del> vm.$onInit = function () {
<del> loadData(GlancesStats.getData());
<del> };
<del>
<del> $scope.$on('data_refreshed', function (event, data) {
<del> loadData(data);
<del> });
<del>
<del> var loadData = function (data) {
<del> var stats = data.stats['sensors'];
<del>
<del> _.remove(stats, function (sensor) {
<del> return (_.isArray(sensor.value) && _.isEmpty(sensor.value)) || sensor.value === 0;
<del> });
<del>
<del> _.forEach(stats, function (sensor) {
<del> if (convertToFahrenheit && sensor.type != 'battery' && sensor.type != 'fan_speed') {
<del> sensor.value = sensor.value * 1.8 + 32;
<del> sensor.unit = 'F';
<del> }
<del> });
<del>
<del> vm.sensors = stats;
<del> };
<del>
<del> vm.getAlert = function (sensor) {
<del> var current = sensor.type == 'battery' ? 100 - sensor.value : sensor.value;
<del>
<del> return GlancesPluginHelper.getAlert('sensors', 'sensors_' + sensor.type + '_', current);
<del> };
<del>}
<del>
<del>'use strict';
<del>
<ide> glancesApp.component('glancesPluginSystem', {
<ide> controller: GlancesPluginSystemController,
<ide> controllerAs: 'vm',
<ide> function GlancesPluginSystemController($scope, GlancesStats) {
<ide>
<ide> 'use strict';
<ide>
<del>glancesApp.component('glancesPluginUptime', {
<del> controller: GlancesPluginUptimeController,
<del> controllerAs: 'vm',
<del> templateUrl: 'components/plugin-uptime/view.html'
<del>});
<del>
<del>'use strict';
<del>
<del>function GlancesPluginUptimeController($scope, GlancesStats) {
<del> var vm = this;
<del> vm.value = null;
<del>
<del> vm.$onInit = function () {
<del> loadData(GlancesStats.getData());
<del> };
<del>
<del> $scope.$on('data_refreshed', function (event, data) {
<del> loadData(data);
<del> });
<del>
<del> var loadData = function (data) {
<del> vm.value = data.stats['uptime'];
<del> }
<del>}
<del>
<del>'use strict';
<del>
<ide> glancesApp.component('glancesPluginWifi', {
<ide> controller: GlancesPluginWifiController,
<ide> controllerAs: 'vm',
<ide> function GlancesPluginWifiController($scope, $filter, GlancesStats) {
<ide> return _view[hotpost.ssid][field].decoration.toLowerCase();
<ide> };
<ide> }
<add>
<add>'use strict';
<add>
<add>glancesApp.component('glancesPluginUptime', {
<add> controller: GlancesPluginUptimeController,
<add> controllerAs: 'vm',
<add> templateUrl: 'components/plugin-uptime/view.html'
<add>});
<add>
<add>'use strict';
<add>
<add>function GlancesPluginUptimeController($scope, GlancesStats) {
<add> var vm = this;
<add> vm.value = null;
<add>
<add> vm.$onInit = function () {
<add> loadData(GlancesStats.getData());
<add> };
<add>
<add> $scope.$on('data_refreshed', function (event, data) {
<add> loadData(data);
<add> });
<add>
<add> var loadData = function (data) {
<add> vm.value = data.stats['uptime'];
<add> }
<add>}
<ide><path>glances/outputs/static/public/js/templates.min.js
<ide> $templateCache.put('components/plugin-cloud/view.html','<section id="cloud">\n
<ide> $templateCache.put('components/plugin-cpu/view.html','<section id="cpu" class="plugin">\n <div class="row">\n <div class="col-sm-24 col-md-12 col-lg-8">\n <div class="table">\n <div class="table-row">\n <div class="table-cell text-left title">CPU</div>\n <div class="table-cell">{{ vm.total }}%</div>\n </div>\n <div class="table-row">\n <div class="table-cell text-left">user:</div>\n <div class="table-cell" ng-class="vm.getDecoration(\'user\')">\n {{ vm.user }}%\n </div>\n </div>\n <div class="table-row">\n <div class="table-cell text-left">system:</div>\n <div class="table-cell" ng-class="vm.getDecoration(\'system\')">\n {{ vm.system }}%\n </div>\n </div>\n <div class="table-row">\n <div class="table-cell text-left">idle:</div>\n <div class="table-cell">{{ vm.idle }}%</div>\n </div>\n </div>\n </div>\n <div class="hidden-xs hidden-sm col-md-12 col-lg-8">\n <div class="table">\n <div class="table-row" ng-show="vm.nice != undefined">\n <div class="table-cell text-left">nice:</div>\n <div class="table-cell">\n {{ vm.nice }}%\n </div>\n </div>\n <div class="table-row" ng-show="vm.irq != undefined">\n <div class="table-cell text-left">irq:</div>\n <div class="table-cell">\n {{ vm.irq }}%\n </div>\n </div>\n <div class="table-row" ng-show="vm.iowait != undefined">\n <div class="table-cell text-left">iowait:</div>\n <div class="table-cell" ng-class="vm.getDecoration(\'iowait\')">\n {{ vm.iowait }}%\n </div>\n </div>\n <div class="table-row" ng-show="vm.steal != undefined">\n <div class="table-cell text-left">steal:</div>\n <div class="table-cell" ng-class="vm.getDecoration(\'steal\')">\n {{ vm.steal }}%\n </div>\n </div>\n </div>\n </div>\n <div class="hidden-xs hidden-sm hidden-md col-lg-8">\n <div class="table">\n <div class="table-row" ng-if="vm.ctx_switches">\n <div class="table-cell text-left">ctx_sw:</div>\n <div class="table-cell" ng-class="vm.getDecoration(\'ctx_switches\')">\n {{ vm.ctx_switches }}\n </div>\n </div>\n <div class="table-row" ng-if="vm.interrupts">\n <div class="table-cell text-left">inter:</div>\n <div class="table-cell">\n {{ vm.interrupts }}\n </div>\n </div>\n <div class="table-row" ng-if="vm.soft_interrupts">\n <div class="table-cell text-left">sw_int:</div>\n <div class="table-cell">\n {{ vm.soft_interrupts }}\n </div>\n </div>\n <div class="table-row" ng-if="!statsSystem.isLinux() && vm.syscalls">\n <div class="table-cell text-left">syscal:</div>\n <div class="table-cell">\n {{ vm.syscalls }}\n </div>\n </div>\n </div>\n </div>\n </div>\n</section>\n');
<ide> $templateCache.put('components/plugin-diskio/view.html','<div class="table-row" ng-if="vm.disks.length > 0">\n <div class="table-cell text-left title">DISK I/O</div>\n <div class="table-cell" ng-show="!vm.arguments.diskio_iops">R/s</div>\n <div class="table-cell" ng-show="!vm.arguments.diskio_iops">W/s</div>\n\n <div class="table-cell" ng-show="vm.arguments.diskio_iops">IOR/s</div>\n <div class="table-cell" ng-show="vm.arguments.diskio_iops">IOW/s</div>\n</div>\n<div class="table-row" ng-repeat="disk in vm.disks">\n <div class="table-cell text-left">{{(disk.alias ? disk.alias : disk.name) | min_size:9}}</div>\n <div class="table-cell" ng-show="!vm.arguments.diskio_iops">{{disk.bitrate.txps }}</div>\n <div class="table-cell" ng-show="!vm.arguments.diskio_iops">{{disk.bitrate.rxps }}</div>\n\n <div class="table-cell" ng-show="vm.arguments.diskio_iops">{{disk.count.txps }}</div>\n <div class="table-cell" ng-show="vm.arguments.diskio_iops">{{disk.count.rxps }}</div>\n</div>\n');
<ide> $templateCache.put('components/plugin-docker/view.html','<section id="containers-plugin" class="plugin" ng-if="vm.containers.length">\n <span class="title">CONTAINERS</span> {{ vm.containers.length }} (served by Docker {{ vm.version }})\n\n <div class="table">\n <div class="table-row">\n <div class="table-cell text-left">Name</div>\n <div class="table-cell">Status</div>\n <div class="table-cell">CPU%</div>\n <div class="table-cell">MEM</div>\n <div class="table-cell">IOR/s</div>\n <div class="table-cell">IOW/s</div>\n <div class="table-cell">RX/s</div>\n <div class="table-cell">TX/s</div>\n <div class="table-cell text-left">Command</div>\n </div>\n <div class="table-row" ng-repeat="container in vm.containers track by container.id">\n <div class="table-cell text-left">{{ container.name }}</div>\n <div class="table-cell" ng-class="container.status == \'Paused\' ? \'careful\' : \'ok\'">{{ container.status }}\n </div>\n <div class="table-cell">{{ container.cpu | number:1 }}</div>\n <div class="table-cell">{{ container.memory | bytes }}</div>\n <div class="table-cell">{{ container.ior / container.io_time_since_update | bits }}</div>\n <div class="table-cell">{{ container.iow / container.io_time_since_update | bits }}</div>\n <div class="table-cell">{{ container.rx / container.net_time_since_update | bits }}</div>\n <div class="table-cell">{{ container.tx / container.net_time_since_update | bits }}</div>\n <div class="table-cell text-left">{{ container.command }}</div>\n </div>\n </div>\n</section>\n');
<del>$templateCache.put('components/plugin-folders/view.html','<div class="table-row" ng-if="vm.folders.length > 0">\n <div class="table-cell text-left title">FOLDERS</div>\n <div class="table-cell">Size</div>\n</div>\n<div class="table-row" ng-repeat="folder in vm.folders">\n <div class="table-cell text-left">{{ folder.path }}</div>\n <div class="table-cell" ng-class="vm.getDecoration(folder)">{{ folder.size | bytes }}</div>\n</div>\n');
<ide> $templateCache.put('components/plugin-fs/view.html','<div class="table-row">\n <div class="table-cell text-left title">FILE SYS</div>\n <div class="table-cell">\n <span ng-show="!vm.arguments.fs_free_space">Used</span>\n <span ng-show="vm.arguments.fs_free_space">Free</span>\n </div>\n <div class="table-cell">Total</div>\n</div>\n<div class="table-row" ng-repeat="fs in vm.fileSystems">\n <div class="table-cell text-left">{{ fs.shortMountPoint }} <span class="visible-lg-inline"\n ng-show="fs.name.length <= 20">({{ fs.name }})<span>\n </div>\n <div class="table-cell" ng-class="vm.getDecoration(fs.mountPoint, \'used\')">\n <span ng-show="!vm.arguments.fs_free_space">{{ fs.used | bytes }}</span>\n <span ng-show="vm.arguments.fs_free_space">{{ fs.free | bytes }}</span>\n </div>\n <div class="table-cell">{{ fs.size | bytes }}</div>\n</div>\n');
<ide> $templateCache.put('components/plugin-gpu/view.html','<section id="gpu" class="plugin">\n <div class="gpu-name title">\n {{ vm.name }}\n </div>\n <div class="table">\n <div class="table-row" ng-if="arguments.meangpu || vm.gpus.length === 1">\n <div class="table-cell text-left">proc:</div>\n <div class="table-cell" ng-class="vm.getMeanDecoration(\'proc\')" ng-if="vm.mean.proc">{{ vm.mean.proc |\n number : 0 }}%\n </div>\n <div class="table-cell" ng-if="!vm.mean.proc">N/A</div>\n </div>\n <div class="table-row" ng-if="arguments.meangpu || vm.gpus.length === 1">\n <div class="table-cell text-left">mem:</div>\n <div class="table-cell" ng-class="vm.getMeanDecoration(\'mem\')" ng-if="vm.mean.mem">{{ vm.mean.mem | number :\n 0 }}%\n </div>\n <div class="table-cell" ng-if="!vm.mean.mem">N/A</div>\n </div>\n <div class="table-row" ng-if="!arguments.meangpu && vm.gpus.length > 1" ng-repeat="gpu in vm.gpus">\n <div class="table-cell text-left">\n {{ gpu.gpu_id }}:\n <span ng-class="vm.getDecoration(gpu.gpu_id, \'proc\')"\n ng-if="gpu.proc">{{ gpu.proc | number : 0 }}%</span>\n <span ng-if="!gpu.proc">N/A</span>\n mem:\n <span ng-class="vm.getDecoration(gpu.gpu_id, \'mem\')" ng-if="gpu.mem">{{ gpu.mem | number : 0 }}%</span>\n <span ng-if="!gpu.mem">N/A</span>\n </div>\n </div>\n </div>\n</section>\n');
<add>$templateCache.put('components/plugin-folders/view.html','<div class="table-row" ng-if="vm.folders.length > 0">\n <div class="table-cell text-left title">FOLDERS</div>\n <div class="table-cell">Size</div>\n</div>\n<div class="table-row" ng-repeat="folder in vm.folders">\n <div class="table-cell text-left">{{ folder.path }}</div>\n <div class="table-cell" ng-class="vm.getDecoration(folder)">{{ folder.size | bytes }}</div>\n</div>\n');
<ide> $templateCache.put('components/plugin-ip/view.html','<section id="ip" ng-if="vm.address != undefined && !vm.arguments.disable_ip">\n - <span class="title">IP</span> <span>{{ vm.address }}/{{ vm.maskCidr }}</span> <span\n ng-if="vm.publicAddress" class="title">Pub</span> <span>{{ vm.publicAddress }}</span>\n</section>\n');
<ide> $templateCache.put('components/plugin-irq/view.html','<div class="table-row" ng-if="vm.irqs.length > 0">\n <div class="table-cell text-left title">IRQ</div>\n <div class="table-cell"></div>\n <div class="table-cell">Rate/s</div>\n</div>\n<div class="table-row" ng-repeat="irq in vm.irqs">\n <div class="table-cell text-left">{{irq.irq_line}}</div>\n <div class="table-cell"></div>\n <div class="table-cell"><span>{{irq.irq_rate}}</span></div>\n</div>\n');
<del>$templateCache.put('components/plugin-load/view.html','<section id="load" class="plugin" ng-if="vm.cpucore != undefined">\n <div class="table">\n <div class="table-row">\n <div class="table-cell text-left title">LOAD</div>\n <div class="table-cell">{{ vm.cpucore }}-core</div>\n </div>\n <div class="table-row">\n <div class="table-cell text-left">1 min:</div>\n <div class="table-cell">\n {{ vm.min1 | number : 2}}\n </div>\n </div>\n <div class="table-row">\n <div class="table-cell text-left">5 min:</div>\n <div class="table-cell" ng-class="vm.getDecoration(\'min5\')">\n {{ vm.min5 | number : 2}}\n </div>\n </div>\n <div class="table-row">\n <div class="table-cell text-left">15 min:</div>\n <div class="table-cell" ng-class="vm.getDecoration(\'min15\')">\n {{ vm.min15 | number : 2}}\n </div>\n </div>\n </div>\n</section>\n');
<ide> $templateCache.put('components/plugin-mem/view.html','<section id="mem" class="plugin">\n <div class="table">\n <div class="table-row">\n <div class="table-cell text-left title">MEM</div>\n <div class="table-cell">{{ vm.percent }}%</div>\n </div>\n <div class="table-row">\n <div class="table-cell text-left">total:</div>\n <div class="table-cell">{{ vm.total | bytes }}</div>\n </div>\n <div class="table-row">\n <div class="table-cell text-left">used:</div>\n <div class="table-cell" ng-class="vm.getDecoration(\'used\')">\n {{ vm.used | bytes:2 }}\n </div>\n </div>\n <div class="table-row">\n <div class="table-cell text-left">free:</div>\n <div class="table-cell">{{ vm.free | bytes }}</div>\n </div>\n </div>\n</section>\n');
<ide> $templateCache.put('components/plugin-mem-more/view.html','<section id="mem-more" class="plugin">\n <div class="table">\n <div class="table-row" ng-show="vm.active != undefined">\n <div class="table-cell text-left">active:</div>\n <div class="table-cell">{{ vm.active | bytes }}</div>\n </div>\n <div class="table-row" ng-show="vm.inactive != undefined">\n <div class="table-cell text-left">inactive:</div>\n <div class="table-cell">{{ vm.inactive | bytes }}</div>\n </div>\n <div class="table-row" ng-show="vm.buffers != undefined">\n <div class="table-cell text-left">buffers:</div>\n <div class="table-cell">{{ vm.buffers | bytes }}</div>\n </div>\n <div class="table-row" ng-show="vm.cached != undefined">\n <div class="table-cell text-left">cached:</div>\n <div class="table-cell">{{ vm.cached | bytes }}</div>\n </div>\n </div>\n</section>\n');
<add>$templateCache.put('components/plugin-load/view.html','<section id="load" class="plugin" ng-if="vm.cpucore != undefined">\n <div class="table">\n <div class="table-row">\n <div class="table-cell text-left title">LOAD</div>\n <div class="table-cell">{{ vm.cpucore }}-core</div>\n </div>\n <div class="table-row">\n <div class="table-cell text-left">1 min:</div>\n <div class="table-cell">\n {{ vm.min1 | number : 2}}\n </div>\n </div>\n <div class="table-row">\n <div class="table-cell text-left">5 min:</div>\n <div class="table-cell" ng-class="vm.getDecoration(\'min5\')">\n {{ vm.min5 | number : 2}}\n </div>\n </div>\n <div class="table-row">\n <div class="table-cell text-left">15 min:</div>\n <div class="table-cell" ng-class="vm.getDecoration(\'min15\')">\n {{ vm.min15 | number : 2}}\n </div>\n </div>\n </div>\n</section>\n');
<ide> $templateCache.put('components/plugin-memswap/view.html','<section id="memswap" class="plugin">\n <div class="table">\n <div class="table-row">\n <div class="table-cell text-left title">SWAP</div>\n <div class="table-cell">{{ vm.percent }}%</div>\n </div>\n <div class="table-row">\n <div class="table-cell text-left">total:</div>\n <div class="table-cell">{{ vm.total | bytes }}</div>\n </div>\n <div class="table-row">\n <div class="table-cell text-left">used:</div>\n <div class="table-cell" ng-class="vm.getDecoration(\'used\')">\n {{ vm.used | bytes }}\n </div>\n </div>\n <div class="table-row">\n <div class="table-cell text-left">free:</div>\n <div class="table-cell">{{ vm.free | bytes }}</div>\n </div>\n </div>\n</section>\n');
<ide> $templateCache.put('components/plugin-network/view.html','<div class="table-row">\n <div class="table-cell text-left title">NETWORK</div>\n <div class="table-cell" ng-show="!vm.arguments.network_cumul && !vm.arguments.network_sum">Rx/s</div>\n <div class="table-cell" ng-show="!vm.arguments.network_cumul && !vm.arguments.network_sum">Tx/s</div>\n\n <div class="table-cell" ng-show="!vm.arguments.network_cumul && vm.arguments.network_sum"></div>\n <div class="table-cell" ng-show="!vm.arguments.network_cumul && vm.arguments.network_sum">Rx+Tx/s</div>\n\n <div class="table-cell" ng-show="vm.arguments.network_cumul && !vm.arguments.network_sum">Rx</div>\n <div class="table-cell" ng-show="vm.arguments.network_cumul && !vm.arguments.network_sum">Tx</div>\n\n <div class="table-cell" ng-show="vm.arguments.network_cumul && vm.arguments.network_sum"></div>\n <div class="table-cell" ng-show="vm.arguments.network_cumul && vm.arguments.network_sum">Rx+Tx</div>\n</div>\n<div class="table-row" ng-repeat="network in vm.networks track by network.interfaceName">\n <div class="table-cell text-left">{{ network.interfaceName | min_size }}</div>\n <div class="table-cell" ng-show="!vm.arguments.network_cumul && !vm.arguments.network_sum">{{ vm.arguments.byte ?\n (network.rx / network.time_since_update | bytes) : (network.rx / network.time_since_update | bits) }}\n </div>\n <div class="table-cell" ng-show="!vm.arguments.network_cumul && !vm.arguments.network_sum">{{ vm.arguments.byte ?\n (network.tx / network.time_since_update | bytes) : (network.tx / network.time_since_update | bits) }}\n </div>\n\n <div class="table-cell" ng-show="!vm.arguments.network_cumul && vm.arguments.network_sum"></div>\n <div class="table-cell" ng-show="!vm.arguments.network_cumul && vm.arguments.network_sum">{{ vm.arguments.byte ?\n (network.cx / network.time_since_update | bytes) : (network.cx / network.time_since_update | bits) }}\n </div>\n\n <div class="table-cell" ng-show="vm.arguments.network_cumul && !vm.arguments.network_sum">{{ vm.arguments.byte ?\n (network.cumulativeRx | bytes) : (network.cumulativeRx | bits) }}\n </div>\n <div class="table-cell" ng-show="vm.arguments.network_cumul && !vm.arguments.network_sum">{{ vm.arguments.byte ?\n (network.cumulativeTx | bytes) : (network.cumulativeTx | bits) }}\n </div>\n\n <div class="table-cell" ng-show="vm.arguments.network_cumul && vm.arguments.network_sum"></div>\n <div class="table-cell" ng-show="vm.arguments.network_cumul && vm.arguments.network_sum">{{ vm.arguments.byte ?\n (network.cumulativeCx | bytes) : (network.cumulativeCx | bits) }}\n </div>\n</div>\n');
<ide> $templateCache.put('components/plugin-percpu/view.html','<section id="percpu" class="plugin">\n <div class="table">\n <div class="table-row">\n <div class="table-cell text-left title">PER CPU</div>\n <div class="table-cell" ng-repeat="percpu in vm.cpus track by percpu.number">{{ percpu.total }}%</div>\n </div>\n <div class="table-row">\n <div class="table-cell text-left">user:</div>\n <div class="table-cell" ng-repeat="percpu in vm.cpus track by percpu.number"\n ng-class="vm.getUserAlert(percpu)">\n {{ percpu.user }}%\n </div>\n </div>\n <div class="table-row">\n <div class="table-cell text-left">system:</div>\n <div class="table-cell" ng-repeat="percpu in vm.cpus track by percpu.number"\n ng-class="vm.getSystemAlert(percpu)">\n {{ percpu.system }}%\n </div>\n </div>\n <div class="table-row">\n <div class="table-cell text-left">idle:</div>\n <div class="table-cell" ng-repeat="percpu in vm.cpus track by percpu.number">{{ percpu.idle }}%</div>\n </div>\n <div class="table-row" ng-if="vm.cpus[0].iowait">\n <div class="table-cell text-left">iowait:</div>\n <div class="table-cell" ng-repeat="percpu in vm.cpus track by percpu.number"\n ng-class="vm.getSystemAlert(percpu)">\n {{ percpu.iowait }}%\n </div>\n </div>\n <div class="table-row" ng-if="vm.cpus[0].steal">\n <div class="table-cell text-left">steal:</div>\n <div class="table-cell" ng-repeat="percpu in vm.cpus track by percpu.number"\n ng-class="vm.getSystemAlert(percpu)">\n {{ percpu.steal }}%\n </div>\n </div>\n </div>\n</section>\n');
<ide> $templateCache.put('components/plugin-ports/view.html','<div class="table-row" ng-repeat="port in vm.ports">\n <div class="table-cell text-left">{{(port.description ? port.description : port.host + \' \' + port.port) | min_size:\n 20}}\n </div>\n <div class="table-cell"></div>\n <div ng-switch="port.status" ng-class="vm.getDecoration(port)" class="table-cell">\n <span ng-switch-when="null">Scanning</span>\n <span ng-switch-when="false">Timeout</span>\n <span ng-switch-when="true">Open</span>\n <span ng-switch-default>{{port.status * 1000.0 | number:0}}ms</span>\n </div>\n</div>');
<ide> $templateCache.put('components/plugin-process/view.html','<div ng-if="!vm.arguments.disable_process">\n <glances-plugin-processcount sorter="vm.sorter"></glances-plugin-processcount>\n <div class="row" ng-if="!vm.arguments.disable_amps">\n <div class="col-lg-18">\n <glances-plugin-amps></glances-plugin-amps>\n </div>\n </div>\n <glances-plugin-processlist sorter="vm.sorter"></glances-plugin-processlist>\n</div>\n<div ng-if="vm.arguments.disable_process">PROCESSES DISABLED (press \'z\' to display)</div>\n');
<del>$templateCache.put('components/plugin-processcount/view.html','<section id="processcount" class="plugin">\n <span class="title">TASKS</span>\n <span>{{ vm.total }} ({{ vm.thread }} thr),</span>\n <span>{{ vm.running }} run,</span>\n <span>{{ vm.sleeping }} slp,</span>\n <span>{{ vm.stopped }} oth</span>\n <span> sorted {{ vm.sorter.auto ? \'automatically\' : \'\' }} by {{ vm.sorter.getColumnLabel(vm.sorter.column) }}, flat view</span>\n</section>');
<del>$templateCache.put('components/plugin-processlist/view.html','<section id="processlist-plugin" class="plugin">\n <div class="table">\n <div class="table-row">\n <div sortable-th sorter="vm.sorter" column="cpu_percent" class="table-cell">CPU%</div>\n <div sortable-th sorter="vm.sorter" column="memory_percent" class="table-cell">MEM%</div>\n <div class="table-cell hidden-xs hidden-sm">VIRT</div>\n <div class="table-cell hidden-xs hidden-sm">RES</div>\n <div class="table-cell">PID</div>\n <div sortable-th sorter="vm.sorter" column="username" class="table-cell text-left">USER</div>\n <div class="table-cell">NI</div>\n <div class="table-cell">S</div>\n <div sortable-th sorter="vm.sorter" column="timemillis" class="table-cell hidden-xs hidden-sm">TIME+</div>\n <div sortable-th sorter="vm.sorter" column="io_read" class="table-cell hidden-xs hidden-sm"\n ng-show="vm.ioReadWritePresent">IOR/s\n </div>\n <div sortable-th sorter="vm.sorter" column="io_write" class="table-cell hidden-xs hidden-sm"\n ng-show="vm.ioReadWritePresent">IOW/s\n </div>\n <div sortable-th sorter="vm.sorter" column="name" class="table-cell text-left">Command</div>\n </div>\n <div class="table-row"\n ng-repeat="process in vm.processes | orderBy:vm.sorter.column:vm.sorter.isReverseColumn(vm.sorter.column) | limitTo: vm.getLimit() track by process.pid">\n <div class="table-cell" ng-class="vm.getCpuPercentAlert(process)">{{process.cpu_percent | number:1}}</div>\n <div class="table-cell" ng-class="vm.getMemoryPercentAlert(process)">{{process.memory_percent | number:1}}\n </div>\n <div class="table-cell hidden-xs hidden-sm">{{process.memvirt | bytes}}</div>\n <div class="table-cell hidden-xs hidden-sm">{{process.memres | bytes}}</div>\n <div class="table-cell">{{process.pid}}</div>\n <div class="table-cell text-left">{{process.username}}</div>\n <div class="table-cell" ng-class="{nice: process.isNice}">{{process.nice | exclamation}}</div>\n <div class="table-cell" ng-class="{status: process.status == \'R\'}">{{process.status}}</div>\n <div class="table-cell hidden-xs hidden-sm">\n <span ng-show="process.timeplus.hours > 0" class="highlight">{{ process.timeplus.hours }}h</span>{{\n process.timeplus.minutes | leftPad:2:\'0\' }}:{{ process.timeplus.seconds | leftPad:2:\'0\' }}<span\n ng-show="process.timeplus.hours <= 0">.{{ process.timeplus.milliseconds | leftPad:2:\'0\' }}</span>\n </div>\n <div class="table-cell hidden-xs hidden-sm" ng-show="vm.ioReadWritePresent">{{process.ioRead}}</div>\n <div class="table-cell hidden-xs hidden-sm" ng-show="vm.ioReadWritePresent">{{process.ioWrite}}</div>\n <div class="table-cell text-left" ng-show="vm.arguments.process_short_name">{{process.name}}</div>\n <div class="table-cell text-left" ng-show="!vm.arguments.process_short_name">{{process.cmdline}}</div>\n </div>\n </div>\n</section>\n');
<ide> $templateCache.put('components/plugin-quicklook/view.html','<section id="quicklook-plugin" class="plugin">\n <div class="cpu-name">\n {{ vm.cpu_name }}\n </div>\n <div class="table">\n <div class="table-row" ng-if="!vm.arguments.percpu">\n <div class="table-cell text-left">CPU</div>\n <div class="table-cell">\n <div class="progress">\n <div class="progress-bar progress-bar-{{ vm.getDecoration(\'cpu\') }}" role="progressbar"\n aria-valuenow="{{ vm.cpu }}" aria-valuemin="0" aria-valuemax="100"\n style="width: {{ vm.cpu }}%;">\n \n </div>\n </div>\n </div>\n <div class="table-cell">\n {{ vm.cpu }}%\n </div>\n </div>\n <div class="table-row" ng-if="vm.arguments.percpu" ng-repeat="percpu in vm.percpus track by percpu.number">\n <div class="table-cell text-left">CPU{{ percpu.number }}</div>\n <div class="table-cell">\n <div class="progress">\n <div class="progress-bar progress-bar-{{ vm.getDecoration(\'cpu\') }}" role="progressbar"\n aria-valuenow="{{ percpu.total }}" aria-valuemin="0" aria-valuemax="100"\n style="width: {{ percpu.total }}%;">\n \n </div>\n </div>\n </div>\n <div class="table-cell">\n {{ percpu.total }}%\n </div>\n </div>\n <div class="table-row">\n <div class="table-cell text-left">MEM</div>\n <div class="table-cell">\n <div class="progress">\n <div class="progress-bar progress-bar-{{ vm.getDecoration(\'mem\') }}" role="progressbar"\n aria-valuenow="{{ vm.mem }}" aria-valuemin="0" aria-valuemax="100"\n style="width: {{ vm.mem }}%;">\n \n </div>\n </div>\n </div>\n <div class="table-cell">\n {{ vm.mem }}%\n </div>\n </div>\n <div class="table-row">\n <div class="table-cell text-left">SWAP</div>\n <div class="table-cell">\n <div class="progress">\n <div class="progress-bar progress-bar-{{ vm.getDecoration(\'swap\') }}" role="progressbar"\n aria-valuenow="{{ vm.swap }}" aria-valuemin="0" aria-valuemax="100"\n style="width: {{ vm.swap }}%;">\n \n </div>\n </div>\n </div>\n <div class="table-cell">\n {{ vm.swap }}%\n </div>\n </div>\n </div>\n</section>\n');
<del>$templateCache.put('components/plugin-raid/view.html','<div class="table-row" ng-if="vm.hasDisks()">\n <div class="table-cell text-left title">RAID disks</div>\n <div class="table-cell">Used</div>\n <div class="table-cell">Total</div>\n</div>\n<div class="table-row" ng-repeat="disk in vm.disks | orderBy: \'name\'">\n <div class="table-cell text-left">\n {{ disk.type | uppercase }} {{ disk.name }}\n <div class="warning" ng-show="disk.degraded">\u2514\u2500 Degraded mode</div>\n <div ng-show="disk.degraded"> \u2514\u2500 {{ disk.config }}</div>\n\n <div class="critical" ng-show="disk.inactive">\u2514\u2500 Status {{ disk.status }}</div>\n <div ng-show="disk.inactive" ng-repeat="component in disk.components | orderBy: \'number\'">\n {{ $last ? \'\u2514\u2500\' : \'\u251C\u2500\' }} disk {{ component.number }}: {{ component.name }}\n </div>\n </div>\n <div class="table-cell" ng-show="!disk.inactive" ng-class="vm.getAlert(disk)">{{ disk.used }}</div>\n <div class="table-cell" ng-show="!disk.inactive" ng-class="vm.getAlert(disk)">{{ disk.available }}</div>\n</div>\n');
<add>$templateCache.put('components/plugin-processlist/view.html','<section id="processlist-plugin" class="plugin">\n <div class="table">\n <div class="table-row">\n <div sortable-th sorter="vm.sorter" column="cpu_percent" class="table-cell">CPU%</div>\n <div sortable-th sorter="vm.sorter" column="memory_percent" class="table-cell">MEM%</div>\n <div class="table-cell hidden-xs hidden-sm">VIRT</div>\n <div class="table-cell hidden-xs hidden-sm">RES</div>\n <div class="table-cell">PID</div>\n <div sortable-th sorter="vm.sorter" column="username" class="table-cell text-left">USER</div>\n <div class="table-cell">NI</div>\n <div class="table-cell">S</div>\n <div sortable-th sorter="vm.sorter" column="timemillis" class="table-cell hidden-xs hidden-sm">TIME+</div>\n <div sortable-th sorter="vm.sorter" column="io_read" class="table-cell hidden-xs hidden-sm"\n ng-show="vm.ioReadWritePresent">IOR/s\n </div>\n <div sortable-th sorter="vm.sorter" column="io_write" class="table-cell hidden-xs hidden-sm"\n ng-show="vm.ioReadWritePresent">IOW/s\n </div>\n <div sortable-th sorter="vm.sorter" column="name" class="table-cell text-left">Command</div>\n </div>\n <div class="table-row"\n ng-repeat="process in vm.processes | orderBy:vm.sorter.column:vm.sorter.isReverseColumn(vm.sorter.column) | limitTo: vm.getLimit() track by process.pid">\n <div class="table-cell" ng-class="vm.getCpuPercentAlert(process)">{{process.cpu_percent | number:1}}</div>\n <div class="table-cell" ng-class="vm.getMemoryPercentAlert(process)">{{process.memory_percent | number:1}}\n </div>\n <div class="table-cell hidden-xs hidden-sm">{{process.memvirt | bytes}}</div>\n <div class="table-cell hidden-xs hidden-sm">{{process.memres | bytes}}</div>\n <div class="table-cell">{{process.pid}}</div>\n <div class="table-cell text-left">{{process.username}}</div>\n <div class="table-cell" ng-class="{nice: process.isNice}">{{process.nice | exclamation}}</div>\n <div class="table-cell" ng-class="{status: process.status == \'R\'}">{{process.status}}</div>\n <div class="table-cell hidden-xs hidden-sm">\n <span ng-show="process.timeplus.hours > 0" class="highlight">{{ process.timeplus.hours }}h</span>{{\n process.timeplus.minutes | leftPad:2:\'0\' }}:{{ process.timeplus.seconds | leftPad:2:\'0\' }}<span\n ng-show="process.timeplus.hours <= 0">.{{ process.timeplus.milliseconds | leftPad:2:\'0\' }}</span>\n </div>\n <div class="table-cell hidden-xs hidden-sm" ng-show="vm.ioReadWritePresent">{{process.ioRead}}</div>\n <div class="table-cell hidden-xs hidden-sm" ng-show="vm.ioReadWritePresent">{{process.ioWrite}}</div>\n <div class="table-cell text-left" ng-show="vm.arguments.process_short_name">{{process.name}}</div>\n <div class="table-cell text-left" ng-show="!vm.arguments.process_short_name">{{process.cmdline}}</div>\n </div>\n </div>\n</section>\n');
<add>$templateCache.put('components/plugin-processcount/view.html','<section id="processcount" class="plugin">\n <span class="title">TASKS</span>\n <span>{{ vm.total }} ({{ vm.thread }} thr),</span>\n <span>{{ vm.running }} run,</span>\n <span>{{ vm.sleeping }} slp,</span>\n <span>{{ vm.stopped }} oth</span>\n <span> sorted {{ vm.sorter.auto ? \'automatically\' : \'\' }} by {{ vm.sorter.getColumnLabel(vm.sorter.column) }}, flat view</span>\n</section>');
<ide> $templateCache.put('components/plugin-sensors/view.html','<div class="table-row" ng-if="vm.sensors.length > 0">\n <div class="table-cell text-left title">SENSORS</div>\n</div>\n\n<div class="table-row" ng-repeat="sensor in vm.sensors">\n <div class="table-cell text-left">{{ sensor.label }}</div>\n <div class="table-cell">{{ sensor.unit }}</div>\n <div class="table-cell" ng-class="vm.getAlert(sensor)">{{ sensor.value }}</div>\n</div>\n');
<add>$templateCache.put('components/plugin-raid/view.html','<div class="table-row" ng-if="vm.hasDisks()">\n <div class="table-cell text-left title">RAID disks</div>\n <div class="table-cell">Used</div>\n <div class="table-cell">Total</div>\n</div>\n<div class="table-row" ng-repeat="disk in vm.disks | orderBy: \'name\'">\n <div class="table-cell text-left">\n {{ disk.type | uppercase }} {{ disk.name }}\n <div class="warning" ng-show="disk.degraded">\u2514\u2500 Degraded mode</div>\n <div ng-show="disk.degraded"> \u2514\u2500 {{ disk.config }}</div>\n\n <div class="critical" ng-show="disk.inactive">\u2514\u2500 Status {{ disk.status }}</div>\n <div ng-show="disk.inactive" ng-repeat="component in disk.components | orderBy: \'number\'">\n {{ $last ? \'\u2514\u2500\' : \'\u251C\u2500\' }} disk {{ component.number }}: {{ component.name }}\n </div>\n </div>\n <div class="table-cell" ng-show="!disk.inactive" ng-class="vm.getAlert(disk)">{{ disk.used }}</div>\n <div class="table-cell" ng-show="!disk.inactive" ng-class="vm.getAlert(disk)">{{ disk.available }}</div>\n</div>\n');
<ide> $templateCache.put('components/plugin-system/view.html','<section id="system">\n <span ng-if="vm.isDisconnected" class="critical">Disconnected from</span>\n <span class="title">{{ vm.hostname }}</span>\n <span ng-if="vm.stats.isLinux" class="hidden-xs hidden-sm">({{ vm.humanReadableName }} / {{ vm.os.name }} {{ vm.os.version }})</span>\n <span ng-if="!vm.stats.isLinux"\n class="hidden-xs hidden-sm">({{ vm.os.name }} {{ vm.os.version }} {{ vm.platform }})</span>\n</section>\n');
<del>$templateCache.put('components/plugin-uptime/view.html','<section id="uptime">\n <span>Uptime: {{ vm.value }}</span>\n</section>\n');
<del>$templateCache.put('components/plugin-wifi/view.html','<div class="table-row" ng-if="vm.hotspots.length > 0">\n <div class="table-cell text-left title">WIFI</div>\n <div class="table-cell"></div>\n <div class="table-cell">dBm</div>\n</div>\n<div class="table-row" ng-repeat="hotspot in vm.hotspots">\n <div class="table-cell text-left">{{ hotspot.ssid|limitTo:20 }} <span ng-if="hotspot.encrypted">{{ hotspot.encryption_type }}</span>\n </div>\n <div class="table-cell"></div>\n <div class="table-cell" ng-class="vm.getDecoration(hotspot, \'signal\')">{{ hotspot.signal }}</div>\n</div>\n');}]);
<ide>\ No newline at end of file
<add>$templateCache.put('components/plugin-wifi/view.html','<div class="table-row" ng-if="vm.hotspots.length > 0">\n <div class="table-cell text-left title">WIFI</div>\n <div class="table-cell"></div>\n <div class="table-cell">dBm</div>\n</div>\n<div class="table-row" ng-repeat="hotspot in vm.hotspots">\n <div class="table-cell text-left">{{ hotspot.ssid|limitTo:20 }} <span ng-if="hotspot.encrypted">{{ hotspot.encryption_type }}</span>\n </div>\n <div class="table-cell"></div>\n <div class="table-cell" ng-class="vm.getDecoration(hotspot, \'signal\')">{{ hotspot.signal }}</div>\n</div>\n');
<add>$templateCache.put('components/plugin-uptime/view.html','<section id="uptime">\n <span>Uptime: {{ vm.value }}</span>\n</section>\n');}]);
<ide>\ No newline at end of file | 2 |
PHP | PHP | fix coding standards errors in network/ | a6da7361494b85411f1b93ea589e58405a77524b | <ide><path>lib/Cake/Network/CakeRequest.php
<ide> * @package Cake.Network
<ide> */
<ide> class CakeRequest implements ArrayAccess {
<add>
<ide> /**
<ide> * Array of parameters parsed from the url.
<ide> *
<ide> protected function _base() {
<ide> $base = '';
<ide> }
<ide>
<del> $this->webroot = $base .'/';
<add> $this->webroot = $base . '/';
<ide> return $this->base = $base;
<ide> }
<ide>
<ide> protected function _base() {
<ide>
<ide> if (!empty($base) || !$docRootContainsWebroot) {
<ide> if (strpos($this->webroot, '/' . $dir . '/') === false) {
<del> $this->webroot .= $dir . '/' ;
<add> $this->webroot .= $dir . '/';
<ide> }
<ide> if (strpos($this->webroot, '/' . $webroot . '/') === false) {
<ide> $this->webroot .= $webroot . '/';
<ide> public function offsetExists($name) {
<ide> public function offsetUnset($name) {
<ide> unset($this->params[$name]);
<ide> }
<add>
<ide> }
<ide><path>lib/Cake/Network/CakeResponse.php
<ide> class CakeResponse {
<ide> 'cpio' => 'application/x-cpio',
<ide> 'cpt' => 'application/mac-compactpro',
<ide> 'csh' => 'application/x-csh',
<del> 'csv' => array('text/csv', 'application/vnd.ms-excel', 'text/plain'),
<add> 'csv' => array('text/csv', 'application/vnd.ms-excel', 'text/plain'),
<ide> 'dcr' => 'application/x-director',
<ide> 'dir' => 'application/x-director',
<ide> 'dms' => 'application/octet-stream',
<ide> public function sharable($public = null, $time = null) {
<ide> if ($time == null) {
<ide> $this->_setCacheControl();
<ide> }
<del> return (bool) $public;
<add> return (bool)$public;
<ide> }
<ide>
<ide> /**
<ide> public function notModified() {
<ide> **/
<ide> public function vary($cacheVariances = null) {
<ide> if ($cacheVariances !== null) {
<del> $cacheVariances = (array) $cacheVariances;
<add> $cacheVariances = (array)$cacheVariances;
<ide> $this->_headers['Vary'] = implode(', ', $cacheVariances);
<ide> }
<ide> if (isset($this->_headers['Vary'])) {
<ide> public function etag($tag = null, $weak = false) {
<ide> return null;
<ide> }
<ide>
<del>
<ide> /**
<ide> * Returns a DateTime object initialized at the $time param and using UTC
<ide> * as timezone
<ide> public function cookie($options = null) {
<ide>
<ide> $this->_cookies[$options['name']] = $options;
<ide> }
<add>
<ide> }
<ide><path>lib/Cake/Network/CakeSocket.php
<ide> public function reset($state = null) {
<ide> }
<ide> return true;
<ide> }
<add>
<ide> }
<ide><path>lib/Cake/Network/Email/CakeEmail.php
<ide> class CakeEmail {
<ide> /**
<ide> * Charset the email body is sent in
<ide> *
<del> *
<ide> * @var string
<ide> */
<ide> public $charset = 'utf-8';
<ide>
<ide> /**
<ide> * Charset the email header is sent in
<ide> * If null, the $charset property will be used as default
<add> *
<ide> * @var string
<ide> */
<ide> public $headerCharset = null;
<ide>
<ide> /**
<ide> * The application wide charset, used to encode headers and body
<add> *
<ide> * @var string
<ide> */
<del> public $_appCharset = null;
<add> protected $_appCharset = null;
<ide>
<ide> /**
<ide> * List of files that should be attached to the email.
<ide> public static function deliver($to = null, $subject = null, $message = null, $tr
<ide> * @param CakeEmail $obj CakeEmail
<ide> * @param array $config
<ide> * @return void
<add> * @throws ConfigureException When configuration file cannot be found, or is missing
<add> * the named config.
<ide> */
<ide> protected function _applyConfig($config) {
<ide> if (is_string($config)) {
<ide> protected function _attachFiles($boundary = null) {
<ide> protected function _readFile($file) {
<ide> $handle = fopen($file, 'rb');
<ide> $data = fread($handle, filesize($file));
<del> $data = chunk_split(base64_encode($data)) ;
<add> $data = chunk_split(base64_encode($data));
<ide> fclose($handle);
<ide> return $data;
<ide> }
<ide> protected function _render($content) {
<ide> $msg = array_merge($msg, $content);
<ide> $msg[] = '';
<ide> }
<del>
<add>
<ide> if (isset($rendered['html'])) {
<ide> if ($textBoundary !== $boundary || $hasAttachments) {
<ide> $msg[] = '--' . $textBoundary;
<ide> protected function _renderTemplates($content) {
<ide> $View->set('content', $content);
<ide> $View->hasRendered = false;
<ide> $View->viewPath = $View->layoutPath = 'Emails' . DS . $type;
<del>
<add>
<ide> $render = $View->render($template, $layout);
<ide> $render = str_replace(array("\r\n", "\r"), "\n", $render);
<ide> $rendered[$type] = $this->_encodeString($render, $this->charset);
<ide> protected function _getContentTransferEncoding() {
<ide> }
<ide> return '7bit';
<ide> }
<add>
<ide> }
<ide><path>lib/Cake/Network/Email/MailTransport.php
<ide> class MailTransport extends AbstractTransport {
<ide> *
<ide> * @param CakeEmail $email CakeEmail
<ide> * @return array
<add> * @throws SocketException When mail cannot be sent.
<ide> */
<ide> public function send(CakeEmail $email) {
<ide> $eol = PHP_EOL;
<ide><path>lib/Cake/Network/Http/DigestAuthentication.php
<ide> protected static function _generateHeader(HttpSocket $http, &$authInfo) {
<ide> }
<ide> return $authHeader;
<ide> }
<add>
<ide> }
<ide><path>lib/Cake/Network/Http/HttpResponse.php
<ide> public function getHeader($name, $headers = null) {
<ide> public function isOk() {
<ide> return $this->code == 200;
<ide> }
<del>
<add>
<ide> /**
<ide> * If return is a valid 3xx (Redirection)
<ide> *
<ide> protected function _decodeChunkedBody($body) {
<ide> $chunkLength = hexdec($hexLength);
<ide> $chunk = substr($body, 0, $chunkLength);
<ide> if (!empty($chunkExtensionName)) {
<del> /**
<del> * @todo See if there are popular chunk extensions we should implement
<del> */
<add> // @todo See if there are popular chunk extensions we should implement
<ide> }
<ide> $decodedBody .= $chunk;
<ide> if ($chunkLength !== 0) {
<ide> public function offsetGet($offset) {
<ide> * @return void
<ide> */
<ide> public function offsetSet($offset, $value) {
<del> return;
<ide> }
<ide>
<ide> /**
<ide> public function offsetSet($offset, $value) {
<ide> * @return void
<ide> */
<ide> public function offsetUnset($offset) {
<del> return;
<ide> }
<ide>
<ide> /**
<ide><path>lib/Cake/Network/Http/HttpSocket.php
<ide> protected function _setProxy() {
<ide> }
<ide> list($plugin, $authClass) = pluginSplit($this->_proxy['method'], true);
<ide> $authClass = Inflector::camelize($authClass) . 'Authentication';
<del> App::uses($authClass, $plugin. 'Network/Http');
<add> App::uses($authClass, $plugin . 'Network/Http');
<ide>
<ide> if (!class_exists($authClass)) {
<ide> throw new SocketException(__d('cake_dev', 'Unknown authentication method for proxy.'));
<ide> public function reset($full = true) {
<ide> parent::reset($initalState);
<ide> return true;
<ide> }
<add>
<ide> } | 8 |
PHP | PHP | fix auth docblocks | 740064803568a62ab7c0514d821727947bab7fdd | <ide><path>src/Illuminate/Auth/SessionGuard.php
<ide> public function setDispatcher(Dispatcher $events)
<ide> /**
<ide> * Get the session store used by the guard.
<ide> *
<del> * @return \Illuminate\Session\Store
<add> * @return \Illuminate\Contracts\Session\Session.
<ide> */
<ide> public function getSession()
<ide> { | 1 |
Ruby | Ruby | remove extra space | 931e379fec26977f7a0409016632f32a8692edec | <ide><path>Library/Homebrew/download_strategy.rb
<ide> def _curl_args
<ide>
<ide> args += ["--user", meta.fetch(:user)] if meta.key?(:user)
<ide>
<del> args += [meta[:header], meta[:headers]].compact.flatten.flat_map { |h| ["--header", h.strip] }
<add> args += [meta[:header], meta[:headers]].compact.flatten.flat_map { |h| ["--header", h.strip] }
<ide>
<ide> args
<ide> end | 1 |
PHP | PHP | adjust index script | 5c7c9f36384bb3f64837064baa975c124a34a457 | <ide><path>public/index.php
<ide> <?php
<ide>
<add>use Illuminate\Contracts\Http\Kernel;
<add>use Illuminate\Http\Request;
<add>
<ide> /**
<ide> * Laravel - A PHP Framework For Web Artisans
<ide> *
<ide>
<ide> require __DIR__.'/../vendor/autoload.php';
<ide>
<del>/*
<del>|--------------------------------------------------------------------------
<del>| Turn On The Lights
<del>|--------------------------------------------------------------------------
<del>|
<del>| We need to illuminate PHP development, so let us turn on the lights.
<del>| This bootstraps the framework and gets it ready for use, then it
<del>| will load up this application so that we can run it and send
<del>| the responses back to the browser and delight our users.
<del>|
<del>*/
<del>
<del>$app = require_once __DIR__.'/../bootstrap/app.php';
<ide>
<ide> /*
<ide> |--------------------------------------------------------------------------
<ide> |
<ide> */
<ide>
<del>$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
<add>$app = require_once __DIR__.'/../bootstrap/app.php';
<add>
<add>$kernel = $app->make(Kernel::class);
<ide>
<ide> $response = tap($kernel->handle(
<del> $request = Illuminate\Http\Request::capture()
<add> $request = Request::capture()
<ide> ))->send();
<ide>
<ide> $kernel->terminate($request, $response); | 1 |
PHP | PHP | add ignore method | 87ab4e2a962130cd59a52c5d2db453067a954976 | <ide><path>src/Illuminate/Foundation/Exceptions/Handler.php
<ide> public function map($from, $to = null)
<ide> return $this;
<ide> }
<ide>
<add> /**
<add> * Indicate that the given exception type should not be reported.
<add> *
<add> * @param string $class
<add> * @return $this
<add> */
<add> protected function ignore(string $class)
<add> {
<add> $this->dontReport[] = $class;
<add>
<add> return $this;
<add> }
<add>
<ide> /**
<ide> * Report or log an exception.
<ide> * | 1 |
Javascript | Javascript | fix error handling | 058e7fb8e66cafae700c5cb437d08572150fa69f | <ide><path>lib/internal/process.js
<ide> const {
<ide> ERR_CPU_USAGE,
<ide> ERR_INVALID_ARG_TYPE,
<ide> ERR_INVALID_ARRAY_LENGTH,
<add> ERR_INVALID_OPT_VALUE,
<ide> ERR_UNCAUGHT_EXCEPTION_CAPTURE_ALREADY_SET,
<ide> ERR_UNKNOWN_SIGNAL
<ide> }
<ide> function setup_cpuUsage() {
<ide> // If a previous value was passed in, ensure it has the correct shape.
<ide> if (prevValue) {
<ide> if (!previousValueIsValid(prevValue.user)) {
<del> throw new ERR_INVALID_ARG_TYPE('preValue.user', 'number');
<add> if (typeof prevValue !== 'object')
<add> throw new ERR_INVALID_ARG_TYPE('prevValue', 'object', prevValue);
<add>
<add> if (typeof prevValue.user !== 'number') {
<add> throw new ERR_INVALID_ARG_TYPE('prevValue.user',
<add> 'number', prevValue.user);
<add> }
<add> throw new ERR_INVALID_OPT_VALUE.RangeError('prevValue.user',
<add> prevValue.user);
<ide> }
<ide>
<ide> if (!previousValueIsValid(prevValue.system)) {
<del> throw new ERR_INVALID_ARG_TYPE('preValue.system', 'number');
<add> if (typeof prevValue.system !== 'number') {
<add> throw new ERR_INVALID_ARG_TYPE('prevValue.system',
<add> 'number', prevValue.system);
<add> }
<add> throw new ERR_INVALID_OPT_VALUE.RangeError('prevValue.system',
<add> prevValue.system);
<ide> }
<ide> }
<ide>
<ide><path>test/parallel/test-process-cpuUsage.js
<ide> 'use strict';
<add>require('../common');
<ide> const assert = require('assert');
<del>const common = require('../common');
<ide> const result = process.cpuUsage();
<ide>
<ide> // Validate the result of calling with no previous value argument.
<ide> for (let i = 0; i < 10; i++) {
<ide> assert(diffUsage.user >= 0);
<ide> assert(diffUsage.system >= 0);
<ide> }
<del>const invalidUserArgument = common.expectsError({
<del> code: 'ERR_INVALID_ARG_TYPE',
<del> type: TypeError,
<del> message: 'The "preValue.user" property must be of type number'
<del>}, 8);
<del>
<del>const invalidSystemArgument = common.expectsError({
<del> code: 'ERR_INVALID_ARG_TYPE',
<del> type: TypeError,
<del> message: 'The "preValue.system" property must be of type number'
<del>}, 2);
<del>
<ide>
<ide> // Ensure that an invalid shape for the previous value argument throws an error.
<del>assert.throws(() => {
<del> process.cpuUsage(1);
<del>}, invalidUserArgument);
<del>
<del>assert.throws(() => {
<del> process.cpuUsage({});
<del>}, invalidUserArgument);
<del>
<del>assert.throws(() => {
<del> process.cpuUsage({ user: 'a' });
<del>}, invalidUserArgument);
<del>
<del>assert.throws(() => {
<del> process.cpuUsage({ system: 'b' });
<del>}, invalidUserArgument);
<del>
<del>assert.throws(() => {
<del> process.cpuUsage({ user: null, system: 'c' });
<del>}, invalidUserArgument);
<del>
<del>assert.throws(() => {
<del> process.cpuUsage({ user: 'd', system: null });
<del>}, invalidUserArgument);
<del>
<del>assert.throws(() => {
<del> process.cpuUsage({ user: -1, system: 2 });
<del>}, invalidUserArgument);
<del>
<del>assert.throws(() => {
<del> process.cpuUsage({ user: 3, system: -2 });
<del>}, invalidSystemArgument);
<del>
<del>assert.throws(() => {
<del> process.cpuUsage({
<del> user: Number.POSITIVE_INFINITY,
<del> system: 4
<del> });
<del>}, invalidUserArgument);
<del>
<del>assert.throws(() => {
<del> process.cpuUsage({
<del> user: 5,
<del> system: Number.NEGATIVE_INFINITY
<del> });
<del>}, invalidSystemArgument);
<add>assert.throws(
<add> () => process.cpuUsage(1),
<add> {
<add> code: 'ERR_INVALID_ARG_TYPE',
<add> name: 'TypeError [ERR_INVALID_ARG_TYPE]',
<add> message: 'The "prevValue" argument must be of type object. ' +
<add> 'Received type number'
<add> }
<add>);
<add>
<add>// Check invalid types.
<add>[
<add> {},
<add> { user: 'a' },
<add> { user: null, system: 'c' },
<add>].forEach((value) => {
<add> assert.throws(
<add> () => process.cpuUsage(value),
<add> {
<add> code: 'ERR_INVALID_ARG_TYPE',
<add> name: 'TypeError [ERR_INVALID_ARG_TYPE]',
<add> message: 'The "prevValue.user" property must be of type number. ' +
<add> `Received type ${typeof value.user}`
<add> }
<add> );
<add>});
<add>
<add>[
<add> { user: 3, system: 'b' },
<add> { user: 3, system: null }
<add>].forEach((value) => {
<add> assert.throws(
<add> () => process.cpuUsage(value),
<add> {
<add> code: 'ERR_INVALID_ARG_TYPE',
<add> name: 'TypeError [ERR_INVALID_ARG_TYPE]',
<add> message: 'The "prevValue.system" property must be of type number. ' +
<add> `Received type ${typeof value.system}`
<add> }
<add> );
<add>});
<add>
<add>// Check invalid values.
<add>[
<add> { user: -1, system: 2 },
<add> { user: Number.POSITIVE_INFINITY, system: 4 }
<add>].forEach((value) => {
<add> assert.throws(
<add> () => process.cpuUsage(value),
<add> {
<add> code: 'ERR_INVALID_OPT_VALUE',
<add> name: 'RangeError [ERR_INVALID_OPT_VALUE]',
<add> message: `The value "${value.user}" is invalid ` +
<add> 'for option "prevValue.user"'
<add> }
<add> );
<add>});
<add>
<add>[
<add> { user: 3, system: -2 },
<add> { user: 5, system: Number.NEGATIVE_INFINITY }
<add>].forEach((value) => {
<add> assert.throws(
<add> () => process.cpuUsage(value),
<add> {
<add> code: 'ERR_INVALID_OPT_VALUE',
<add> name: 'RangeError [ERR_INVALID_OPT_VALUE]',
<add> message: `The value "${value.system}" is invalid ` +
<add> 'for option "prevValue.system"'
<add> }
<add> );
<add>});
<ide>
<ide> // Ensure that the return value is the expected shape.
<ide> function validateResult(result) { | 2 |
Javascript | Javascript | remove unneeded escaping in template strings | 150dc5c2e6a848aa49bb95f4e6c0cbf0da5d0e73 | <ide><path>test/parallel/test-debugger-pid.js
<ide> interfacer.on('line', function(line) {
<ide> }
<ide> } else {
<ide> line = line.replace(/^(debug> *)+/, '');
<del> expected = `(node:${pid}) Target process: 655555 doesn\'t exist.`;
<add> expected = `(node:${pid}) Target process: 655555 doesn't exist.`;
<ide> }
<ide>
<ide> assert.strictEqual(expected, line);
<ide><path>test/parallel/test-tick-processor-cpp-core.js
<ide> const base = require('./tick-processor-base.js');
<ide> base.runTest({
<ide> pattern: /RunInDebugContext/,
<ide> code: `function f() {
<del> require(\'vm\').runInDebugContext(\'Debug\');
<add> require('vm').runInDebugContext('Debug');
<ide> setImmediate(function() { f(); });
<ide> };
<ide> f();`
<ide><path>test/parallel/test-vm-cached-data.js
<ide> const spawnSync = require('child_process').spawnSync;
<ide> const Buffer = require('buffer').Buffer;
<ide>
<ide> function getSource(tag) {
<del> return `(function ${tag}() { return \'${tag}\'; })`;
<add> return `(function ${tag}() { return '${tag}'; })`;
<ide> }
<ide>
<ide> function produce(source, count) {
<ide><path>test/sequential/test-child-process-execsync.js
<ide> var msgBuf = Buffer.from(msg + '\n');
<ide>
<ide> // console.log ends every line with just '\n', even on Windows.
<ide>
<del>cmd = `"${process.execPath}" -e "console.log(\'${msg}\');"`;
<add>cmd = `"${process.execPath}" -e "console.log('${msg}');"`;
<ide>
<ide> ret = execSync(cmd);
<ide> | 4 |
Text | Text | add information about premium themes and plugins | af31b214df3afcc753c9fdc6e7b9c06de4fb94fd | <ide><path>guide/english/wordpress/index.md
<ide> Just to name a few advantages of WordPress:
<ide> * Has plugins, which extend functionality to WordPress sites.
<ide> * Has mobile app (Android and iOS), which can be used to post and manage their Wordpress webpage.
<ide> * Wordpress sites can be hosted on any server running the LAMP stack
<add>* WordPress themes make it possible for non-designers to create a customized website
<ide>
<ide> Whether it is page transitions or a customized contact form, WordPress users are only a few clicks away from success and a beautiful website.
<ide>
<ide> Themes typically provide an overall framework for the design and functionality o
<ide>
<ide> Plugins extend WordPress functionality in specific ways, adding features like mailing list integrations, contact forms, enhanced security, or custom data fields. As with themes, there's a huge number of plugins available, many of them free, or with both free and pro versions available, covering almost any feature you might think of.
<ide>
<add>While free themes offer a range of beautiful designs, WordPress premium themes for web projects beyond the basics may cost between $10 to $200 with an average around $59. Also, most plugins are available in free or premium versions.
<add>
<ide> The following are some of the popular and useful plugins in WordPress:
<ide> - Yoast SEO
<ide> - JetPack
<ide> Admin Passowrd: -Make sure the admin password is difficult- (https://strongpassw
<ide> ### Choose Language
<ide> Select Language: -Pick Your Desired Language-
<ide>
<del>###Select Plugins
<add>### Select Plugins
<ide> Limit Login Attempts (Loginizer): -NO-
<ide>
<ide> ### Advanced Options | 1 |
Ruby | Ruby | add todo comment | acf39f8777a825d48b4ca46249c75be13614e2d1 | <ide><path>Library/Homebrew/cask/cask.rb
<ide> def versions
<ide> end
<ide>
<ide> def os_versions
<add> # TODO: use #to_hash_with_variations instead once all casks use on_system blocks
<ide> @os_versions ||= begin
<ide> version_os_hash = {}
<ide> actual_version = MacOS.full_version.to_s | 1 |
PHP | PHP | make use of new getconnection method signature | c268e2756defc9561207a2c4b4f7400f777751f8 | <ide><path>src/Illuminate/Foundation/Testing/Concerns/InteractsWithDatabase.php
<ide> trait InteractsWithDatabase
<ide> protected function assertDatabaseHas($table, array $data, $connection = null)
<ide> {
<ide> $this->assertThat(
<del> $this->getTable($table), new HasInDatabase($this->getConnection($connection), $data)
<add> $this->getTable($table), new HasInDatabase($this->getConnection($table, $connection), $data)
<ide> );
<ide>
<ide> return $this;
<ide> protected function assertDatabaseHas($table, array $data, $connection = null)
<ide> protected function assertDatabaseMissing($table, array $data, $connection = null)
<ide> {
<ide> $constraint = new ReverseConstraint(
<del> new HasInDatabase($this->getConnection($connection), $data)
<add> new HasInDatabase($this->getConnection($table, $connection), $data)
<ide> );
<ide>
<ide> $this->assertThat($this->getTable($table), $constraint);
<ide> protected function assertSoftDeleted($table, array $data = [], $connection = nul
<ide> }
<ide>
<ide> $this->assertThat(
<del> $this->getTable($table), new SoftDeletedInDatabase($this->getConnection($connection), $data, $deletedAtColumn)
<add> $this->getTable($table), new SoftDeletedInDatabase($this->getConnection($table, $connection), $data, $deletedAtColumn)
<ide> );
<ide>
<ide> return $this;
<ide> protected function assertNotSoftDeleted($table, array $data = [], $connection =
<ide> }
<ide>
<ide> $this->assertThat(
<del> $this->getTable($table), new NotSoftDeletedInDatabase($this->getConnection($connection), $data, $deletedAtColumn)
<add> $this->getTable($table), new NotSoftDeletedInDatabase($this->getConnection($table, $connection), $data, $deletedAtColumn)
<ide> );
<ide>
<ide> return $this; | 1 |
PHP | PHP | adjust variables to be consistent | bfe343a0b059b7a91768845fb381e8608795ff21 | <ide><path>src/Error/ErrorHandler.php
<ide> protected function _displayError($error, $debug)
<ide> /**
<ide> * Displays an exception response body.
<ide> *
<del> * @param \Exception $exception The exception to display
<add> * @param \Exception $exception The exception to display.
<ide> * @return void
<ide> * @throws \Exception When the chosen exception renderer is invalid.
<ide> */
<ide> protected function _displayException($exception)
<ide> $response = $renderer->render();
<ide> $this->_clearOutput();
<ide> $this->_sendResponse($response);
<del> } catch (Throwable $t) {
<del> $this->_logInternalError($t);
<del> } catch (Exception $e) {
<del> $this->_logInternalError($e);
<add> } catch (Throwable $exception) {
<add> $this->_logInternalError($exception);
<add> } catch (Exception $exception) {
<add> $this->_logInternalError($exception);
<ide> }
<ide> }
<ide> | 1 |
Ruby | Ruby | fix proc coercion | 8764c4fc21890087bcfde8daac714fce46c4ada8 | <ide><path>Library/Homebrew/cmd/leaves.rb
<ide> def leaves
<ide>
<ide> leaves_list = Formula.installed_formulae_with_no_dependents
<ide>
<del> leaves_list.select!(&:installed_on_request?) if args.installed_on_request?
<del> leaves_list.select!(&:installed_as_dependency?) if args.installed_as_dependency?
<add> leaves_list.select!(&method(:installed_on_request?)) if args.installed_on_request?
<add> leaves_list.select!(&method(:installed_as_dependency?)) if args.installed_as_dependency?
<ide>
<ide> leaves_list.map(&:full_name)
<ide> .sort | 1 |
Text | Text | note dependancies in docs | 86931b01b6f0c6ae5826210b277fe3218e21f7b5 | <ide><path>docs/topics/3.6-announcement.md
<ide> REST framework's new API documentation supports a number of features:
<ide> * Support for various authentication schemes.
<ide> * Code snippets for the Python, JavaScript, and Command Line clients.
<ide>
<add>The `coreapi` library is required as a dependancy for the API docs. Make sure
<add>to install the latest version (2.3.0 or above). The `pygments` and `markdown`
<add>libraries are optional but recommended.
<add>
<ide> To install the API documentation, you'll need to include it in your projects URLconf:
<ide>
<ide> from rest_framework.documentation import include_docs_urls
<ide> For more information see the [Python client library documentation][py-docs].
<ide>
<ide> ## Deprecations
<ide>
<add>### Updating `coreapi`
<add>
<add>If you're using REST framework's schema generation, or want to use the API docs,
<add>then you'll need to update to the latest version of coreapi. (2.3.0)
<add>
<ide> ### Generating schemas from Router
<ide>
<ide> The 3.5 "pending deprecation" of router arguments for generating a schema view, such as `schema_title`, `schema_url` and `schema_renderers`, have now been escalated to a
<ide><path>docs/topics/documenting-your-api.md
<ide> The built-in API documentation includes:
<ide>
<ide> ### Installation
<ide>
<add>The `coreapi` library is required as a dependancy for the API docs. Make sure
<add>to install the latest version. The `pygments` and `markdown` libraries
<add>are optional but recommended.
<add>
<ide> To install the API documentation, you'll need to include it in your projects URLconf:
<ide>
<ide> from rest_framework.documentation import include_docs_urls | 2 |
Ruby | Ruby | upgrade virtualenv to 16.4.0 | 6cac67bcd0850f3c1ec26008ba54c24c1d26d762 | <ide><path>Library/Homebrew/language/python_virtualenv_constants.rb
<ide> PYTHON_VIRTUALENV_URL =
<del> "https://files.pythonhosted.org/packages/8b/f4" \
<del> "/360aa656ddb0f4168aeaa1057d8784b95d1ce12f34332c1cf52420b6db4e" \
<del> "/virtualenv-16.3.0.tar.gz".freeze
<add> "https://files.pythonhosted.org/packages/51/aa" \
<add> "/c395a6e6eaaedfa5a04723b6446a1df783b16cca6fec66e671cede514688" \
<add> "/virtualenv-16.4.0.tar.gz".freeze
<ide> PYTHON_VIRTUALENV_SHA256 =
<del> "729f0bcab430e4ef137646805b5b1d8efbb43fe53d4a0f33328624a84a5121f7".freeze
<add> "cceab52aa7d4df1e1871a70236eb2b89fcfe29b6b43510d9738689787c513261".freeze | 1 |
Javascript | Javascript | update outdated comment | 835fbeee002779fbd164f9af6f8392c4d5373dfd | <ide><path>lib/child_process.js
<ide> exports.fork = function(modulePath /*, args, options*/) {
<ide> args = execArgv.concat([modulePath], args);
<ide>
<ide> if (!Array.isArray(options.stdio)) {
<del> // Leave stdin open for the IPC channel. stdout and stderr should be the
<del> // same as the parent's if silent isn't set.
<add> // Use a separate fd=3 for the IPC channel. Inherit stdin, stdout,
<add> // and stderr from the parent if silent isn't set.
<ide> options.stdio = options.silent ? ['pipe', 'pipe', 'pipe', 'ipc'] :
<ide> [0, 1, 2, 'ipc'];
<ide> } else if (options.stdio.indexOf('ipc') === -1) { | 1 |
Javascript | Javascript | remove useless config override (#790) | ffeeb682af082edb0067a775e485176b43fc33a0 | <ide><path>examples/custom-server-express/server.js
<ide> const express = require('express')
<ide> const next = require('next')
<ide>
<ide> const dev = process.env.NODE_ENV !== 'production'
<del>const app = next({ dir: '.', dev })
<add>const app = next({ dev })
<ide> const handle = app.getRequestHandler()
<ide>
<ide> app.prepare() | 1 |
Python | Python | fix typo in helpers.py | 5addabfbddbb0f620d81adc7bcafbf8bd5f12a3e | <ide><path>flask/helpers.py
<ide> def flash(message, category='message'):
<ide> # session.setdefault('_flashes', []).append((category, message))
<ide> #
<ide> # This assumed that changes made to mutable structures in the session are
<del> # are always in sync with the sess on object, which is not true for session
<add> # are always in sync with the session object, which is not true for session
<ide> # implementations that use external storage for keeping their keys/values.
<ide> flashes = session.get('_flashes', [])
<ide> flashes.append((category, message)) | 1 |
PHP | PHP | use restart identity | c27267f49d42ae60a381a6698e7f819cd78606e5 | <ide><path>lib/Cake/Database/Schema/PostgresSchema.php
<ide> public function dropTableSql(Table $table) {
<ide> */
<ide> public function truncateTableSql(Table $table) {
<ide> $name = $this->_driver->quoteIdentifier($table->name());
<del> $sequence = null;
<del> foreach ($table->constraints() as $seq) {
<del> if ($table->constraint($seq)['type'] == Table::CONSTRAINT_PRIMARY) {
<del> $sequence = $this->_driver->quoteIdentifier($seq);
<del> break;
<del> }
<del> }
<ide>
<del> $out = [];
<del> if ($sequence) {
<del> $out[] = sprintf(
<del> 'ALTER SEQUENCE %s.%s RESTART WITH 1',
<del> $name,
<del> $sequence
<del> );
<del> }
<del> $out[] = sprintf('DELETE FROM %s', $name);
<del> return $out;
<add> return [
<add> sprintf("TRUNCATE %s RESTART IDENTITY", $name)
<add> ];
<ide> }
<ide>
<ide> }
<ide><path>lib/Cake/Test/TestCase/Database/Schema/PostgresSchemaTest.php
<ide> public function testTruncateSql() {
<ide> 'columns' => ['id']
<ide> ]);
<ide> $result = $table->truncateSql($connection);
<del> $this->assertCount(2, $result);
<del> $this->assertEquals('ALTER SEQUENCE "articles"."primary" RESTART WITH 1', $result[0]);
<del> $this->assertEquals('DELETE FROM "articles"', $result[1]);
<add> $this->assertCount(1, $result);
<add> $this->assertEquals('TRUNCATE "articles" RESTART IDENTITY', $result[0]);
<ide> }
<ide>
<ide> /** | 2 |
Text | Text | change double quotes to single quotes in guide | a4aa95e6af4daba4aaaa9f09abc9007ecc54d1a5 | <ide><path>guides/source/getting_started.md
<ide> Then you make the `app/views/articles/show.html.erb` look like the following:
<ide> <%= render @article.comments %>
<ide>
<ide> <h2>Add a comment:</h2>
<del><%= render "comments/form" %>
<add><%= render 'comments/form' %>
<ide>
<ide> <%= link_to 'Edit Article', edit_article_path(@article) %> |
<ide> <%= link_to 'Back to Articles', articles_path %> | 1 |
PHP | PHP | add a validate method onto the request | 5b7d0373d379634bdf1662d4c9313072d1c5231b | <ide><path>src/Illuminate/Foundation/Providers/FoundationServiceProvider.php
<ide>
<ide> namespace Illuminate\Foundation\Providers;
<ide>
<add>use Illuminate\Http\Request;
<ide> use Illuminate\Support\AggregateServiceProvider;
<ide>
<ide> class FoundationServiceProvider extends AggregateServiceProvider
<ide> class FoundationServiceProvider extends AggregateServiceProvider
<ide> protected $providers = [
<ide> FormRequestServiceProvider::class,
<ide> ];
<add>
<add> /**
<add> * Register the service provider.
<add> *
<add> * @return void
<add> */
<add> public function register()
<add> {
<add> parent::register();
<add>
<add> $this->registerRequestValidate();
<add> }
<add>
<add> /**
<add> * Register the "validate" macro on the request.
<add> *
<add> * @return void
<add> */
<add> public function registerRequestValidate()
<add> {
<add> Request::macro('validate', function (array $rules, ...$params) {
<add> validator()->validate($this->all(), $rules, ...$params);
<add>
<add> return $this->only(array_keys($rules));
<add> });
<add> }
<ide> } | 1 |
Text | Text | fix module syncbuiltinesmexports example | 28e9c10003aede86df930c94325bb10827cf6e1a | <ide><path>doc/api/module.md
<ide> does not add or remove exported names from the [ES Modules][].
<ide>
<ide> ```js
<ide> const fs = require('fs');
<add>const assert = require('assert');
<ide> const { syncBuiltinESMExports } = require('module');
<ide>
<del>fs.readFile = null;
<add>fs.readFile = newAPI;
<ide>
<ide> delete fs.readFileSync;
<ide>
<del>fs.newAPI = function newAPI() {
<add>function newAPI() {
<ide> // ...
<del>};
<add>}
<add>
<add>fs.newAPI = newAPI;
<ide>
<ide> syncBuiltinESMExports();
<ide>
<ide> import('fs').then((esmFS) => {
<del> assert.strictEqual(esmFS.readFile, null);
<del> assert.strictEqual('readFileSync' in fs, true);
<add> // It syncs the existing readFile property with the new value
<add> assert.strictEqual(esmFS.readFile, newAPI);
<add> // readFileSync has been deleted from the required fs
<add> assert.strictEqual('readFileSync' in fs, false);
<add> // syncBuiltinESMExports() does not remove readFileSync from esmFS
<add> assert.strictEqual('readFileSync' in esmFS, true);
<add> // syncBuiltinESMExports() does not add names
<ide> assert.strictEqual(esmFS.newAPI, undefined);
<ide> });
<ide> ``` | 1 |
Ruby | Ruby | add missing families | e1da637f9aab7e23a5b3eb22bdf7a9f514b2fe92 | <ide><path>Library/Homebrew/test/hardware/cpu_spec.rb
<ide> describe "::family" do
<ide> let(:cpu_families) {
<ide> [
<add> :amd_k7,
<add> :amd_k8,
<add> :amd_k8_k10_hybrid,
<add> :amd_k10,
<add> :amd_k12,
<add> :arm,
<ide> :arm_firestorm_icestorm,
<ide> :arm_hurricane_zephyr,
<ide> :arm_lightning_thunder,
<ide> :arm_typhoon,
<ide> :arm_vortex_tempest,
<ide> :atom,
<add> :bobcat,
<ide> :broadwell,
<add> :bulldozer,
<add> :cannonlake,
<ide> :core,
<ide> :core2,
<ide> :dothan,
<ide> :haswell,
<ide> :icelake,
<ide> :ivybridge,
<add> :jaguar,
<ide> :kabylake,
<ide> :merom,
<ide> :nehalem,
<ide> :penryn,
<add> :ppc,
<ide> :prescott,
<ide> :presler,
<ide> :sandybridge,
<ide> :skylake,
<ide> :westmere,
<add> :zen,
<add> :zen3,
<ide> :dunno,
<ide> ]
<ide> } | 1 |
Text | Text | fix typos in canvas-background.md | 82d42bd799f5c47f1d69299db29039d97cb49329 | <ide><path>docs/configuration/canvas-background.md
<ide> # Canvas background
<ide>
<del>In some use cases you would want a background image or color over the whole canvas. There is no build in support for this, the way you can achieve this is by writing a custom plugin.
<add>In some use cases you would want a background image or color over the whole canvas. There is no built-in support for this, the way you can achieve this is by writing a custom plugin.
<ide>
<del>In the two example plugins underneath here you can see how you can draw an color or image to the canvas as background. This way of giving the chart a background is only necessary if you want to export the chart with that specific background.
<add>In the two example plugins underneath here you can see how you can draw a color or image to the canvas as background. This way of giving the chart a background is only necessary if you want to export the chart with that specific background.
<ide> For normal use you can set the background more easily with [CSS](https://www.w3schools.com/cssref/css3_pr_background.asp).
<ide>
<ide> :::: tabs | 1 |
PHP | PHP | forgetinstance() docblock | 4e7ebabd92763d4054ee36186a6ad2d040f61c50 | <ide><path>src/Illuminate/Support/Facades/App.php
<ide> * @method static string environmentFile()
<ide> * @method static string environmentFilePath()
<ide> * @method static string environmentPath()
<add> * @method static void forgetInstance(string $abstract)
<ide> * @method static string getCachedConfigPath()
<ide> * @method static string getCachedPackagesPath()
<ide> * @method static string getCachedRoutesPath() | 1 |
Javascript | Javascript | fix pureexpressiondependency bug | 41a6f2af1a6723d006d5c95326e91697dfe48546 | <ide><path>lib/dependencies/HarmonyImportDependencyParserPlugin.js
<ide> module.exports = class HarmonyImportDependencyParserPlugin {
<ide> harmonyAllExportDependentDependencies.add(dep);
<ide> const currentTopLevelSymbol =
<ide> /** @type {TopLevelSymbol} */ (parser.state.currentTopLevelSymbol);
<del> const info = innerGraph.get(dep);
<ide> if (!currentTopLevelSymbol) {
<ide> innerGraph.set(dep, true);
<del> } else if (info === undefined) {
<add> } else {
<ide> innerGraph.set(dep, new Set([currentTopLevelSymbol]));
<del> } else if (info !== true) {
<del> info.add(currentTopLevelSymbol);
<ide> }
<ide> };
<ide> parser.hooks.expression
<ide><path>lib/optimize/InnerGraphPlugin.js
<ide> const PureExpressionDependency = require("../dependencies/PureExpressionDependency");
<ide>
<ide> /** @typedef {import("../Compiler")} Compiler */
<add>/** @typedef {import("../Dependency")} Dependency */
<ide> /** @typedef {import("../JavascriptParser")} JavascriptParser */
<del>/** @typedef {import("../dependencies/HarmonyImportSpecifierDependency")} HarmonyImportSpecifierDependency */
<ide>
<ide> const topLevelSymbolTag = Symbol("top level symbol");
<ide>
<del>/** @typedef {Map<TopLevelSymbol | HarmonyImportSpecifierDependency, Set<string | TopLevelSymbol> | true>} InnerGraph */
<add>/** @typedef {Map<TopLevelSymbol | Dependency, Set<string | TopLevelSymbol> | true>} InnerGraph */
<ide>
<ide> class TopLevelSymbol {
<ide> /**
<ide> class InnerGraphPlugin {
<ide> }
<ide> }
<ide> });
<add> /** @type {WeakMap<{}, TopLevelSymbol>} */
<ide> const statementWithTopLevelSymbol = new WeakMap();
<ide> parser.hooks.preStatement.tap("InnerGraphPlugin", statement => {
<ide> if (parser.scope.topLevelScope === true) {
<ide> class InnerGraphPlugin {
<ide> }
<ide> }
<ide> });
<add> /** @type {WeakMap<{}, TopLevelSymbol>} */
<ide> const declWithTopLevelSymbol = new WeakMap();
<ide> parser.hooks.preDeclarator.tap(
<ide> "InnerGraphPlugin",
<ide> class InnerGraphPlugin {
<ide> const dep = new PureExpressionDependency(decl.init.range);
<ide> dep.loc = decl.loc;
<ide> parser.state.module.addDependency(dep);
<add> innerGraph.set(dep, new Set([fn]));
<ide> parser.state.harmonyAllExportDependentDependencies.add(dep);
<ide> return true;
<ide> }
<ide><path>test/cases/inner-graph/simple/index.js
<del>import { exportUsed, export2Used } from "./inner";
<del>import { f1 } from "./module";
<add>import { exportUsed, export2Used, export3Used } from "./inner";
<add>import { f1, pureUsed } from "./module";
<ide>
<ide> it("export should be unused when only unused functions use it", () => {
<ide> f1();
<add> expect(pureUsed).toBe(42);
<ide> if (process.env.NODE_ENV === "production") {
<ide> expect(exportUsed).toBe(false);
<ide> expect(export2Used).toBe(true);
<add> expect(export3Used).toBe(true);
<ide> }
<ide> return import("./chunk");
<ide> });
<ide><path>test/cases/inner-graph/simple/inner.js
<ide> export const EXPORT = 42;
<ide> export const EXPORT2 = 42;
<add>export const EXPORT3 = 42;
<ide>
<ide> export const exportUsed = __webpack_exports_info__.EXPORT.used;
<ide> export const export2Used = __webpack_exports_info__.EXPORT2.used;
<add>export const export3Used = __webpack_exports_info__.EXPORT3.used;
<ide><path>test/cases/inner-graph/simple/module.js
<del>import { EXPORT, EXPORT2 } from "./inner";
<add>import { EXPORT, EXPORT2, EXPORT3 } from "./inner";
<ide>
<ide> export function f1() {
<ide> // no using EXPORT
<ide> function gb6() {
<ide> export const pure1 = /*#__PURE__*/ EXPORT;
<ide> export const pure2 = /*#__PURE__*/ f6();
<ide> const pure3 = /*#__PURE__*/ g5();
<add>export const pureUsed = /*#__PURE__*/ EXPORT3;
<ide>
<ide> function x1() {
<ide> return EXPORT2; | 5 |
Java | Java | revise settablelistenablefuture implementation | 0640a32863c9a86511e4a3e0c7fe75e98e0f3f1e | <ide><path>spring-core/src/main/java/org/springframework/util/concurrent/SettableListenableFuture.java
<ide>
<ide> import org.springframework.util.Assert;
<ide>
<del>import java.util.concurrent.CancellationException;
<del>import java.util.concurrent.CountDownLatch;
<add>import java.util.concurrent.Callable;
<ide> import java.util.concurrent.ExecutionException;
<del>import java.util.concurrent.Future;
<ide> import java.util.concurrent.TimeUnit;
<ide> import java.util.concurrent.TimeoutException;
<del>import java.util.concurrent.locks.ReadWriteLock;
<del>import java.util.concurrent.locks.ReentrantReadWriteLock;
<add>import java.util.concurrent.atomic.AtomicReference;
<ide>
<ide> /**
<del> * A {@link ListenableFuture} whose value can be set by the {@link #set(Object)} or
<add> * A {@link org.springframework.util.concurrent.ListenableFuture ListenableFuture}
<add> * whose value can be set via {@link #set(Object)} or
<ide> * {@link #setException(Throwable)}. It may also be cancelled.
<ide> *
<ide> * <p>Inspired by {@code com.google.common.util.concurrent.SettableFuture}.
<ide> *
<ide> * @author Mattias Severson
<add> * @author Rossen Stoyanchev
<ide> * @since 4.1
<ide> */
<ide> public class SettableListenableFuture<T> implements ListenableFuture<T> {
<ide>
<del> private final SettableFuture<T> settableFuture = new SettableFuture<T>();
<del> private final ListenableFutureCallbackRegistry<T> registry = new ListenableFutureCallbackRegistry<T>();
<add> private final SettableTask<T> settableTask;
<ide>
<add> private final ListenableFutureTask<T> listenableFuture;
<add>
<add>
<add> public SettableListenableFuture() {
<add> this.settableTask = new SettableTask<T>();
<add> this.listenableFuture = new ListenableFutureTask<T>(this.settableTask);
<add> }
<ide>
<ide> /**
<ide> * Set the value of this future. This method will return {@code true} if
<ide> * the value was set successfully, or {@code false} if the future has already
<ide> * been set or cancelled.
<del> *
<ide> * @param value the value that will be set.
<ide> * @return {@code true} if the value was successfully set, else {@code false}.
<ide> */
<ide> public boolean set(T value) {
<del> boolean setValue = this.settableFuture.setValue(value);
<del> if (setValue) {
<del> this.registry.success(value);
<add> boolean success = this.settableTask.setValue(value);
<add> if (success) {
<add> this.listenableFuture.run();
<ide> }
<del> return setValue;
<add> return success;
<ide> }
<ide>
<ide> /**
<ide> public boolean set(T value) {
<ide> * @return {@code true} if the exception was successfully set, else {@code false}.
<ide> */
<ide> public boolean setException(Throwable exception) {
<del> Assert.notNull(exception, "exception must not be null");
<del> boolean setException = this.settableFuture.setThrowable(exception);
<del> if (setException) {
<del> this.registry.failure(exception);
<add> Assert.notNull(exception, "'exception' must not be null");
<add> boolean success = this.settableTask.setValue(exception);
<add> if (success) {
<add> this.listenableFuture.run();
<ide> }
<del> return setException;
<add> return success;
<ide> }
<ide>
<del> @Override
<del> public void addCallback(ListenableFutureCallback<? super T> callback) {
<del> this.registry.addCallback(callback);
<del> }
<add> @Override
<add> public void addCallback(ListenableFutureCallback<? super T> callback) {
<add> this.listenableFuture.addCallback(callback);
<add> }
<ide>
<del> @Override
<del> public boolean cancel(boolean mayInterruptIfRunning) {
<del> boolean cancelled = this.settableFuture.cancel(mayInterruptIfRunning);
<add> @Override
<add> public boolean cancel(boolean mayInterruptIfRunning) {
<add> this.settableTask.setCancelled();
<add> boolean cancelled = this.listenableFuture.cancel(mayInterruptIfRunning);
<ide> if (cancelled && mayInterruptIfRunning) {
<ide> interruptTask();
<ide> }
<ide> return cancelled;
<del> }
<add> }
<ide>
<del> @Override
<del> public boolean isCancelled() {
<del> return this.settableFuture.isCancelled();
<del> }
<add> @Override
<add> public boolean isCancelled() {
<add> return this.listenableFuture.isCancelled();
<add> }
<ide>
<del> @Override
<del> public boolean isDone() {
<del> return this.settableFuture.isDone();
<del> }
<add> @Override
<add> public boolean isDone() {
<add> return this.listenableFuture.isDone();
<add> }
<ide>
<ide> /**
<ide> * Retrieve the value.
<del> * <p>Will return the value if it has been set by calling {@link #set(Object)}, throw
<del> * an {@link ExecutionException} if the {@link #setException(Throwable)} has been
<del> * called, throw a {@link CancellationException} if the future has been cancelled, or
<del> * throw an {@link IllegalStateException} if neither a value, nor an exception has
<del> * been set.
<add> * <p>Will return the value if it has been set via {@link #set(Object)},
<add> * throw an {@link java.util.concurrent.ExecutionException} if it has been
<add> * set via {@link #setException(Throwable)} or throw a
<add> * {@link java.util.concurrent.CancellationException} if it has been cancelled.
<ide> * @return The value associated with this future.
<ide> */
<del> @Override
<del> public T get() throws InterruptedException, ExecutionException {
<del> return this.settableFuture.get();
<del> }
<add> @Override
<add> public T get() throws InterruptedException, ExecutionException {
<add> return this.listenableFuture.get();
<add> }
<ide>
<ide> /**
<ide> * Retrieve the value.
<del> * <p>Will return the value if it has been by calling {@link #set(Object)}, throw an
<del> * {@link ExecutionException} if the {@link #setException(Throwable)}
<del> * has been called, throw a {@link java.util.concurrent.CancellationException} if the
<del> * future has been cancelled.
<add> * <p>Will return the value if it has been set via {@link #set(Object)},
<add> * throw an {@link java.util.concurrent.ExecutionException} if it has been
<add> * set via {@link #setException(Throwable)} or throw a
<add> * {@link java.util.concurrent.CancellationException} if it has been cancelled.
<ide> * @param timeout the maximum time to wait.
<ide> * @param unit the time unit of the timeout argument.
<ide> * @return The value associated with this future.
<ide> */
<ide> @Override
<del> public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
<del> return this.settableFuture.get(timeout, unit);
<del> }
<add> public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
<add> return this.listenableFuture.get(timeout, unit);
<add> }
<ide>
<ide> /**
<ide> * Subclasses can override this method to implement interruption of the future's
<ide> protected void interruptTask() {
<ide> }
<ide>
<ide>
<del> /**
<del> * Helper class that keeps track of the state of this future.
<del> * @param <T> The type of value to be set.
<del> */
<del> private static class SettableFuture<T> implements Future<T> {
<add> private static class SettableTask<T> implements Callable<T> {
<ide>
<del> private final ReadWriteLock lock = new ReentrantReadWriteLock(true);
<del> private final CountDownLatch latch = new CountDownLatch(1);
<del> private T value;
<del> private Throwable throwable;
<del> private State state = State.INITIALIZED;
<add> private static final String NO_VALUE = SettableListenableFuture.class.getName() + ".NO_VALUE";
<ide>
<add> private final AtomicReference<Object> value = new AtomicReference<Object>(NO_VALUE);
<ide>
<del> @Override
<del> public T get() throws ExecutionException, InterruptedException {
<del> this.latch.await();
<del> this.lock.readLock().lock();
<del> try {
<del> return getValue();
<del> }
<del> finally {
<del> this.lock.readLock().unlock();
<del> }
<del> }
<del>
<del> @Override
<del> public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
<del> if (this.latch.await(timeout, unit)) {
<del> this.lock.readLock().lock();
<del> try {
<del> return getValue();
<del> }
<del> finally {
<del> this.lock.readLock().unlock();
<del> }
<del> }
<del> else {
<del> throw new TimeoutException();
<del> }
<del> }
<add> private volatile boolean cancelled = false;
<ide>
<del> private T getValue() throws ExecutionException {
<del> switch (this.state) {
<del> case COMPLETED:
<del> if (this.throwable != null) {
<del> throw new ExecutionException(this.throwable);
<del> }
<del> else {
<del> return this.value;
<del> }
<del> case CANCELLED:
<del> throw new CancellationException("Future has been cancelled.");
<del> default:
<del> throw new IllegalStateException("Invalid state: " + this.state);
<del> }
<del> }
<ide>
<del> @Override
<del> public boolean isDone() {
<del> this.lock.readLock().lock();
<del> try {
<del> switch (this.state) {
<del> case COMPLETED:
<del> case CANCELLED:
<del> return true;
<del> default:
<del> return false;
<del> }
<del> }
<del> finally {
<del> this.lock.readLock().unlock();
<add> public boolean setValue(Object value) {
<add> if (this.cancelled) {
<add> return false;
<ide> }
<add> return this.value.compareAndSet(NO_VALUE, value);
<ide> }
<ide>
<del> @Override
<del> public boolean cancel(boolean mayInterruptIfRunning) {
<del> this.lock.writeLock().lock();
<del> try {
<del> if (this.state.equals(State.INITIALIZED)) {
<del> this.state = State.CANCELLED;
<del> this.latch.countDown();
<del> return true;
<del> }
<del> }
<del> finally {
<del> this.lock.writeLock().unlock();
<del> }
<del> return false;
<add> public void setCancelled() {
<add> this.cancelled = true;
<ide> }
<ide>
<ide> @Override
<del> public boolean isCancelled() {
<del> this.lock.readLock().lock();
<del> try {
<del> return this.state.equals(State.CANCELLED);
<del> }
<del> finally {
<del> this.lock.readLock().unlock();
<add> public T call() throws Exception {
<add> if (value.get() instanceof Exception) {
<add> throw (Exception) value.get();
<ide> }
<add> return (T) value.get();
<ide> }
<del>
<del> boolean setValue(T value) {
<del> this.lock.writeLock().lock();
<del> try {
<del> if (this.state.equals(State.INITIALIZED)) {
<del> this.value = value;
<del> this.state = State.COMPLETED;
<del> this.latch.countDown();
<del> return true;
<del> }
<del> }
<del> finally {
<del> this.lock.writeLock().unlock();
<del> }
<del> return false;
<del> }
<del>
<del> Throwable getThrowable() {
<del> return this.throwable;
<del> }
<del>
<del> boolean setThrowable(Throwable throwable) {
<del> this.lock.writeLock().lock();
<del> try {
<del> if (this.state.equals(State.INITIALIZED)) {
<del> this.throwable = throwable;
<del> this.state = State.COMPLETED;
<del> this.latch.countDown();
<del> return true;
<del> }
<del> }
<del> finally {
<del> this.lock.writeLock().unlock();
<del> }
<del> return false;
<del> }
<del>
<del> private enum State {INITIALIZED, COMPLETED, CANCELLED}
<ide> }
<add>
<ide> }
<ide><path>spring-core/src/test/java/org/springframework/util/concurrent/SettableListenableFutureTests.java
<ide>
<ide> import static org.hamcrest.Matchers.equalTo;
<ide> import static org.junit.Assert.*;
<add>import static org.mockito.Mockito.*;
<add>
<ide>
<ide> /**
<ide> * @author Mattias Severson
<ide> public void run() {
<ide>
<ide> @Test
<ide> public void cancelDoesNotNotifyCallbacksOnSet() {
<del> settableListenableFuture.addCallback(new ListenableFutureCallback<String>() {
<del> @Override
<del> public void onSuccess(String result) {
<del> fail("onSuccess should not have been called");
<del> }
<del>
<del> @Override
<del> public void onFailure(Throwable t) {
<del> fail("onFailure should not have been called");
<del> }
<del> });
<add> ListenableFutureCallback callback = mock(ListenableFutureCallback.class);
<add> settableListenableFuture.addCallback(callback);
<ide> settableListenableFuture.cancel(true);
<add>
<add> verify(callback).onFailure(any(CancellationException.class));
<add> verifyNoMoreInteractions(callback);
<add>
<ide> settableListenableFuture.set("hello");
<add> verifyNoMoreInteractions(callback);
<ide> }
<ide>
<ide> @Test
<ide> public void cancelDoesNotNotifyCallbacksOnSetException() {
<del> settableListenableFuture.addCallback(new ListenableFutureCallback<String>() {
<del> @Override
<del> public void onSuccess(String result) {
<del> fail("onSuccess should not have been called");
<del> }
<del>
<del> @Override
<del> public void onFailure(Throwable t) {
<del> fail("onFailure should not have been called");
<del> }
<del> });
<add> ListenableFutureCallback callback = mock(ListenableFutureCallback.class);
<add> settableListenableFuture.addCallback(callback);
<ide> settableListenableFuture.cancel(true);
<add>
<add> verify(callback).onFailure(any(CancellationException.class));
<add> verifyNoMoreInteractions(callback);
<add>
<ide> settableListenableFuture.setException(new RuntimeException());
<add> verifyNoMoreInteractions(callback);
<ide> }
<ide>
<ide> private static class InterruptableSettableListenableFuture extends SettableListenableFuture<String> { | 2 |
PHP | PHP | return id from redis queue push | 18e6a1dfb3f14e9f7a42912fbab871acd5d6c947 | <ide><path>src/Illuminate/Queue/RedisQueue.php
<ide> public function push($job, $data = '', $queue = null)
<ide> */
<ide> public function pushRaw($payload, $queue = null, array $options = array())
<ide> {
<del> return $this->redis->rpush($this->getQueue($queue), $payload);
<add> $this->redis->rpush($this->getQueue($queue), $payload);
<add>
<add> return array_get(json_decode($payload, true), 'id');
<ide> }
<ide>
<ide> /**
<ide> public function later($delay, $job, $data = '', $queue = null)
<ide> $payload = $this->createPayload($job, $data);
<ide>
<ide> $this->redis->zadd($this->getQueue($queue).':delayed', $this->getTime() + $delay, $payload);
<add>
<add> return array_get(json_decode($payload, true), 'id');
<ide> }
<ide>
<ide> /**
<ide><path>tests/Queue/QueueRedisQueueTest.php
<ide> public function testPushProperlyPushesJobOntoRedis()
<ide> $queue->expects($this->once())->method('getRandomId')->will($this->returnValue('foo'));
<ide> $redis->shouldReceive('rpush')->once()->with('queues:default', json_encode(array('job' => 'foo', 'data' => array('data'), 'id' => 'foo', 'attempts' => 1)));
<ide>
<del> $queue->push('foo', array('data'));
<add> $id = $queue->push('foo', array('data'));
<add> $this->assertEquals('foo', $id);
<ide> }
<ide>
<ide>
<ide> public function testDelayedPushProperlyPushesJobOntoRedis()
<ide> json_encode(array('job' => 'foo', 'data' => array('data'), 'id' => 'foo', 'attempts' => 1))
<ide> );
<ide>
<del> $queue->later(1, 'foo', array('data'));
<add> $id = $queue->later(1, 'foo', array('data'));
<add> $this->assertEquals('foo', $id);
<ide> }
<ide>
<ide> | 2 |
Go | Go | fix some style issues | 01112989b71523df006b00f66b8585a18f634add | <ide><path>api/common.go
<ide> import (
<ide> "mime"
<ide> "path/filepath"
<ide> "sort"
<add> "strconv"
<ide> "strings"
<ide>
<ide> "github.com/Sirupsen/logrus"
<ide> func (r byPrivatePort) Less(i, j int) bool { return r[i].PrivatePort < r[j].Priv
<ide> // e.g. "0.0.0.0:80->9090/tcp, 9988/tcp"
<ide> // it's used by command 'docker ps'
<ide> func DisplayablePorts(ports []types.Port) string {
<del> var (
<del> result = []string{}
<del> hostMappings = []string{}
<del> firstInGroupMap map[string]int
<del> lastInGroupMap map[string]int
<del> )
<del> firstInGroupMap = make(map[string]int)
<del> lastInGroupMap = make(map[string]int)
<add> type portGroup struct {
<add> first int
<add> last int
<add> }
<add> groupMap := make(map[string]*portGroup)
<add> var result []string
<add> var hostMappings []string
<ide> sort.Sort(byPrivatePort(ports))
<ide> for _, port := range ports {
<del> var (
<del> current = port.PrivatePort
<del> portKey = port.Type
<del> firstInGroup int
<del> lastInGroup int
<del> )
<add> current := port.PrivatePort
<add> portKey := port.Type
<ide> if port.IP != "" {
<ide> if port.PublicPort != current {
<ide> hostMappings = append(hostMappings, fmt.Sprintf("%s:%d->%d/%s", port.IP, port.PublicPort, port.PrivatePort, port.Type))
<ide> continue
<ide> }
<ide> portKey = fmt.Sprintf("%s/%s", port.IP, port.Type)
<ide> }
<del> firstInGroup = firstInGroupMap[portKey]
<del> lastInGroup = lastInGroupMap[portKey]
<add> group := groupMap[portKey]
<ide>
<del> if firstInGroup == 0 {
<del> firstInGroupMap[portKey] = current
<del> lastInGroupMap[portKey] = current
<add> if group == nil {
<add> groupMap[portKey] = &portGroup{first: current, last: current}
<ide> continue
<ide> }
<del>
<del> if current == (lastInGroup + 1) {
<del> lastInGroupMap[portKey] = current
<add> if current == (group.last + 1) {
<add> group.last = current
<ide> continue
<ide> }
<del> result = append(result, formGroup(portKey, firstInGroup, lastInGroup))
<del> firstInGroupMap[portKey] = current
<del> lastInGroupMap[portKey] = current
<add>
<add> result = append(result, formGroup(portKey, group.first, group.last))
<add> groupMap[portKey] = &portGroup{first: current, last: current}
<ide> }
<del> for portKey, firstInGroup := range firstInGroupMap {
<del> result = append(result, formGroup(portKey, firstInGroup, lastInGroupMap[portKey]))
<add> for portKey, g := range groupMap {
<add> result = append(result, formGroup(portKey, g.first, g.last))
<ide> }
<ide> result = append(result, hostMappings...)
<ide> return strings.Join(result, ", ")
<ide> }
<ide>
<ide> func formGroup(key string, start, last int) string {
<del> var (
<del> group string
<del> parts = strings.Split(key, "/")
<del> groupType = parts[0]
<del> ip = ""
<del> )
<add> parts := strings.Split(key, "/")
<add> groupType := parts[0]
<add> var ip string
<ide> if len(parts) > 1 {
<ide> ip = parts[0]
<ide> groupType = parts[1]
<ide> }
<del> if start == last {
<del> group = fmt.Sprintf("%d", start)
<del> } else {
<del> group = fmt.Sprintf("%d-%d", start, last)
<add> group := strconv.Itoa(start)
<add> if start != last {
<add> group = fmt.Sprintf("%s-%d", group, last)
<ide> }
<ide> if ip != "" {
<ide> group = fmt.Sprintf("%s:%s->%s", ip, group, group) | 1 |
Ruby | Ruby | allow link_overwrite for old name too | 17ca7527f49f6f83ec57563a3f503cc81ea1cc50 | <ide><path>Library/Homebrew/formula.rb
<ide> def link_overwrite?(path)
<ide> rescue TapFormulaAmbiguityError, TapFormulaWithOldnameAmbiguityError
<ide> return false # this keg belongs to another formula
<ide> else
<del> # this keg belongs to another formula
<del> # but it is not an alias
<del> return false unless f.aliases.include? keg.name
<add> # this keg belongs to another unrelated formula
<add> return false unless (f.aliases + f.oldname).include?(keg.name)
<ide> end
<ide> end
<ide> to_check = path.relative_path_from(HOMEBREW_PREFIX).to_s | 1 |
Ruby | Ruby | fix random ci fail due to non-deterministic order | 5b28e42f65aa4dcb5dfcea76c5dcf564601a8853 | <ide><path>activerecord/test/cases/calculations_test.rb
<ide> def test_should_limit_calculation_with_offset
<ide> end
<ide>
<ide> def test_limit_should_apply_before_count
<del> accounts = Account.limit(4)
<add> accounts = Account.order(:id).limit(4)
<ide>
<ide> assert_equal 3, accounts.count(:firm_id)
<ide> assert_equal 3, accounts.select(:firm_id).count
<ide> end
<ide>
<ide> def test_limit_should_apply_before_count_arel_attribute
<del> accounts = Account.limit(4)
<add> accounts = Account.order(:id).limit(4)
<ide>
<ide> firm_id_attribute = Account.arel_table[:firm_id]
<ide> assert_equal 3, accounts.count(firm_id_attribute) | 1 |
Javascript | Javascript | add test case for | 664627272fc5a5a9ad298fc624f6785d87c49bd1 | <ide><path>test/watchCases/scope-hoisting/caching-inner-source/0/index.js
<add>it("should not crash when scope-hoisted modules change", function() {
<add> require("./module").default.should.be.eql(WATCH_STEP);
<add>})
<ide><path>test/watchCases/scope-hoisting/caching-inner-source/0/inner.js
<add>export { x } from "./inner1";
<ide><path>test/watchCases/scope-hoisting/caching-inner-source/0/inner1.js
<add>export { x } from "./inner2";
<ide><path>test/watchCases/scope-hoisting/caching-inner-source/0/inner2.js
<add>export var x = "0";
<ide><path>test/watchCases/scope-hoisting/caching-inner-source/0/module.js
<add>import { x } from "./inner";
<add>
<add>export default x;
<ide><path>test/watchCases/scope-hoisting/caching-inner-source/1/inner1.js
<add>export var x = "1";
<ide><path>test/watchCases/scope-hoisting/caching-inner-source/webpack.config.js
<add>module.exports = {
<add> optimization: {
<add> concatenateModules: true
<add> }
<add>}; | 7 |
Javascript | Javascript | remove internal variable from makeasync | 7bc6aeac86e6ce09efba4b04190b7792fc72fded | <ide><path>lib/dns.js
<ide> function makeAsync(callback) {
<ide> } else {
<ide> var args = new Array(arguments.length + 1);
<ide> args[0] = callback;
<del> for (var i = 1, a = 0; a < arguments.length; ++i, ++a)
<del> args[i] = arguments[a];
<add> for (var i = 0; i < arguments.length; ++i)
<add> args[i + 1] = arguments[i];
<ide> process.nextTick.apply(null, args);
<ide> }
<ide> }; | 1 |
Text | Text | simplify wording in tracing apis doc | ff4928f85fb2125be7e8a7f787369ea85c6b5fe6 | <ide><path>doc/api/tracing.md
<ide> string that supports `${rotation}` and `${pid}`:
<ide> node --trace-event-categories v8 --trace-event-file-pattern '${pid}-${rotation}.log' server.js
<ide> ```
<ide>
<del>Starting with Node.js 10.0.0, the tracing system uses the same time source
<del>as the one used by `process.hrtime()`
<del>however the trace-event timestamps are expressed in microseconds,
<add>The tracing system uses the same time source
<add>as the one used by `process.hrtime()`.
<add>However the trace-event timestamps are expressed in microseconds,
<ide> unlike `process.hrtime()` which returns nanoseconds.
<ide>
<ide> The features from this module are not available in [`Worker`][] threads. | 1 |
Javascript | Javascript | remove redundant hashprefix params | 627459b96d34e320668a51741ad9c2c6d292ea6a | <ide><path>test/ng/locationSpec.js
<ide> describe('$location', function() {
<ide>
<ide>
<ide> it('should throw error when invalid server url given', function() {
<del> var locationUrl = new LocationHtml5Url('http://server.org/base/abc', 'http://server.org/base/', '/base');
<add> var locationUrl = new LocationHtml5Url('http://server.org/base/abc', 'http://server.org/base/');
<ide>
<ide> expect(function() {
<ide> locationUrl.$$parse('http://other.server.org/path#/path');
<ide> describe('$location', function() {
<ide>
<ide>
<ide> it('should throw error when invalid base url given', function() {
<del> var locationUrl = new LocationHtml5Url('http://server.org/base/abc', 'http://server.org/base/', '/base');
<add> var locationUrl = new LocationHtml5Url('http://server.org/base/abc', 'http://server.org/base/');
<ide>
<ide> expect(function() {
<ide> locationUrl.$$parse('http://server.org/path#/path');
<ide> describe('$location', function() {
<ide> var locationUrl, locationUmlautUrl, locationIndexUrl;
<ide>
<ide> beforeEach(function() {
<del> locationUrl = new LocationHtml5Url('http://server/pre/', 'http://server/pre/', 'http://server/pre/path');
<del> locationUmlautUrl = new LocationHtml5Url('http://särver/pre/', 'http://särver/pre/', 'http://särver/pre/path');
<del> locationIndexUrl = new LocationHtml5Url('http://server/pre/index.html', 'http://server/pre/', 'http://server/pre/path');
<add> locationUrl = new LocationHtml5Url('http://server/pre/', 'http://server/pre/');
<add> locationUmlautUrl = new LocationHtml5Url('http://särver/pre/', 'http://särver/pre/');
<add> locationIndexUrl = new LocationHtml5Url('http://server/pre/index.html', 'http://server/pre/');
<ide> });
<ide>
<ide> it('should rewrite URL', function() { | 1 |
Text | Text | add missing words in the swarm docs | db158e9182f86adc721d6c401782983bfe51fd49 | <ide><path>docs/swarm/key-concepts.md
<ide> running the task for the service. All nodes in the swarm cluster route ingress
<ide> connections to a running task instance.
<ide>
<ide> Swarm mode has an internal DNS component that automatically assigns each service
<del>in the swarm DNS entry. The swarm manager uses **internal load balancing**
<add>in the swarm a DNS entry. The swarm manager uses **internal load balancing** to
<ide> distribute requests among services within the cluster based upon the DNS name of
<ide> the service.
<ide> | 1 |
PHP | PHP | add a test for using an collection for options | aa30d4b196d30ebaa6149480e96467aac6a5237c | <ide><path>src/View/Input/Radio.php
<ide> public function render($data) {
<ide> 'label' => true,
<ide> 'empty' => false,
<ide> ];
<del> $options = (array)$data['options'];
<add> if ($data['options'] instanceof Traversable) {
<add> $options = iterator_to_array($data['options']);
<add> } else {
<add> $options = (array)$data['options'];
<add> }
<add>
<ide> $escape = $data['escape'];
<ide> if (!empty($data['empty'])) {
<ide> $empty = $data['empty'] === true ? 'empty' : $data['empty'];
<ide><path>tests/TestCase/View/Input/RadioTest.php
<ide> */
<ide> namespace Cake\Test\TestCase\View\Input;
<ide>
<add>use Cake\Collection\Collection;
<ide> use Cake\TestSuite\TestCase;
<ide> use Cake\View\Input\Radio;
<ide> use Cake\View\StringTemplate;
<ide> public function testRenderSimple() {
<ide> '/label',
<ide> ];
<ide> $this->assertTags($result, $expected);
<add>
<add> $data = [
<add> 'name' => 'Crayons[color]',
<add> 'options' => new Collection(['r' => 'Red', 'b' => 'Black'])
<add> ];
<add> $result = $radio->render($data);
<add> $this->assertTags($result, $expected);
<ide> }
<ide>
<ide> /** | 2 |
Python | Python | fix flaky test `test_set_dag_runs_action` | d0ffd31ba3a4e8cd27fb7305cc19c33cf637509f | <ide><path>tests/www/views/test_views_dagrun.py
<ide> def test_delete_dagrun_permission_denied(session, client_dr_without_dag_edit, ru
<ide> [
<ide> (
<ide> "clear",
<del> [None, None],
<add> {None},
<ide> "1 dag runs and 2 task instances were cleared",
<ide> ),
<ide> (
<ide> "set_success",
<del> ["success", "success"],
<add> {"success"},
<ide> "1 dag runs and 1 task instances were set to success",
<ide> ),
<ide> (
<ide> "set_failed",
<del> ["success", "failed"], # The success ti is not set to failed.
<add> {"success", "failed"}, # The success ti is not set to failed.
<ide> "1 dag runs and 0 task instances were set to failed",
<ide> ),
<ide> (
<ide> "set_running",
<del> ["success", "failed"], # Unchanged.
<add> {"success", "failed"}, # Unchanged.
<ide> "1 dag runs were set to running",
<ide> ),
<ide> ],
<ide> def test_set_dag_runs_action(
<ide> follow_redirects=True,
<ide> )
<ide> check_content_in_response(expected_message, resp)
<del> assert [ti.state for ti in session.query(TaskInstance).all()] == expected_ti_states
<add> assert {ti.state for ti in session.query(TaskInstance).all()} == expected_ti_states
<ide>
<ide>
<ide> @pytest.mark.parametrize( | 1 |
Text | Text | fix typo in testing.md | 9d001cd84c1239d708b1528587c183ef30e38c31 | <ide><path>docs/api-guide/testing.md
<ide> Extends [Django's existing `Client` class][client].
<ide>
<ide> ## Making requests
<ide>
<del>The `APIClient` class supports the same request interface as Django's standard `Client` class. This means the that standard `.get()`, `.post()`, `.put()`, `.patch()`, `.delete()`, `.head()` and `.options()` methods are all available. For example:
<add>The `APIClient` class supports the same request interface as Django's standard `Client` class. This means that the standard `.get()`, `.post()`, `.put()`, `.patch()`, `.delete()`, `.head()` and `.options()` methods are all available. For example:
<ide>
<ide> from rest_framework.test import APIClient
<ide> | 1 |
Text | Text | change var to const and let | 6814ad7f67ab201734db53843f38eabb1507e389 | <ide><path>guide/english/javascript/loops/for-of-loop/index.md
<ide> The `for...of` statement creates a loop iterating over iterable objects (includi
<ide>
<ide> ### Map
<ide> ```javascript
<del> var m = new Map();
<add> const m = new Map();
<ide> m.set(1, "black");
<ide> m.set(2, "red");
<ide>
<del> for (var n of m) {
<add> for (let n of m) {
<ide> console.log(n);
<ide> }
<ide>
<ide> // Output:
<del> // 1,black
<del> // 2,red
<add> // [1, "black"]
<add> // [2, "red"]
<ide> ```
<ide>
<ide> ### Set
<ide> ```javascript
<del> var s = new Set();
<add> const s = new Set();
<ide> s.add(1);
<ide> s.add("red");
<ide>
<del> for (var n of s) {
<add> for (let n of s) {
<ide> console.log(n);
<ide> }
<ide> | 1 |
Python | Python | add docs for bigquery hook | fc522bd3feebd7386aeb61d1bb9b78448e1350d3 | <ide><path>airflow/contrib/hooks/bigquery_hook.py
<add>"""
<add>This module contains a BigQuery Hook, as well as a very basic PEP 249
<add>implementation for BigQuery.
<add>"""
<add>
<ide> import httplib2
<ide> import logging
<ide> import pandas
<ide> def __init__(self,
<ide>
<ide> def get_conn(self):
<ide> """
<del> Returns a BigQuery service object.
<add> Returns a BigQuery PEP 249 connection object.
<ide> """
<ide> service = self.get_service()
<ide> connection_extras = self._extras_dejson()
<ide> def get_service(self):
<ide> return build('bigquery', 'v2', http=http_authorized)
<ide>
<ide> def insert_rows(self, table, rows, target_fields=None, commit_every=1000):
<add> """
<add> Insertion is currently unsupported. Theoretically, you could use
<add> BigQuery's streaming API to insert rows into a table, but this hasn't
<add> been implemented.
<add> """
<ide> raise NotImplementedError()
<ide>
<ide> class BigQueryConnection(object):
<ide> def rollback(self):
<ide> raise NotSupportedError("BigQueryConnection does not have transactions")
<ide>
<ide> class BigQueryBaseCursor(object):
<del> # TODO pydocs
<add> """
<add> The BigQuery base cursor contains helper methods to execute queries against
<add> BigQuery. The methods can be used directly by operators, in cases where a
<add> PEP 249 cursor isn't needed.
<add> """
<add>
<ide> def __init__(self, service, project_id):
<del> # TODO pydocs
<ide> self.service = service
<ide> self.project_id = project_id
<ide>
<ide> def run_query(self, bql, destination_dataset_table = False, write_disposition =
<ide>
<ide> :param bql: The BigQuery SQL to execute.
<ide> :type bql: string
<del> :param destination_dataset_table: The dotted <dataset>.<table>
<add> :param destination_dataset_table: The dotted <dataset>.<table>
<ide> BigQuery table to save the query results.
<del> :param write_disposition: What to do if the table already exists in
<add> :param write_disposition: What to do if the table already exists in
<ide> BigQuery.
<ide> """
<ide> configuration = {
<ide> def run_with_configuration(self, configuration):
<ide>
<ide> class BigQueryCursor(BigQueryBaseCursor):
<ide> """
<del> The PyHive PEP 249 implementation was used as a reference:
<add> A very basic BigQuery PEP 249 cursor implementation. The PyHive PEP 249
<add> implementation was used as a reference:
<ide>
<ide> https://github.com/dropbox/PyHive/blob/master/pyhive/presto.py
<ide> https://github.com/dropbox/PyHive/blob/master/pyhive/common.py
<ide> """
<ide>
<ide> def __init__(self, service, project_id):
<del> """
<del> # TODO param docs
<del> """
<ide> super(BigQueryCursor, self).__init__(service=service, project_id=project_id)
<ide> self.buffersize = None
<ide> self.page_token = None
<ide> def __init__(self, service, project_id):
<ide>
<ide> @property
<ide> def description(self):
<add> """ The schema description method is not currently implemented. """
<ide> raise NotImplementedError
<ide>
<ide> def close(self):
<ide> def rowcount(self):
<ide>
<ide> def execute(self, operation, parameters=None):
<ide> """
<del> # TODO javadocs
<add> Executes a BigQuery query, and returns the job ID.
<add>
<add> :param operation: The query to execute.
<add> :type operation: string
<add> :param parameters: Parameters to substitute into the query.
<add> :type parameters: dict
<ide> """
<ide> bql = _bind_parameters(operation, parameters) if parameters else operation
<ide> self.job_id = self.run_query(bql)
<ide>
<ide> def executemany(self, operation, seq_of_parameters):
<ide> """
<del> Execute an operation multiple times with different parameters.
<add> Execute a BigQuery query multiple times with different parameters.
<add>
<add> :param operation: The query to execute.
<add> :type operation: string
<add> :param parameters: List of dictionary parameters to substitute into the
<add> query.
<add> :type parameters: list
<ide> """
<ide> for parameters in seq_of_parameters:
<ide> self.execute(operation, parameters)
<ide>
<ide> def fetchone(self):
<del> # TODO pydocs
<add> """ Fetch the next row of a query result set. """
<ide> return self.next()
<ide>
<ide> def next(self):
<del> # TODO pydocs
<add> """
<add> Helper method for fetchone, which returns the next row from a buffer.
<add> If the buffer is empty, attempts to paginate through the result set for
<add> the next page, and load it into the buffer.
<add> """
<ide> if not self.job_id:
<ide> return None
<ide>
<ide> def fetchall(self):
<ide> return result
<ide>
<ide> def get_arraysize(self):
<del> # TODO pydocs
<del> # PEP 249
<add> """ Specifies the number of rows to fetch at a time with .fetchmany() """
<ide> return self._buffersize if self.buffersize else 1
<ide>
<ide> def set_arraysize(self, arraysize):
<del> # TODO pydocs
<del> # PEP 249
<add> """ Specifies the number of rows to fetch at a time with .fetchmany() """
<ide> self.buffersize = arraysize
<ide>
<ide> arraysize = property(get_arraysize, set_arraysize)
<ide> def setoutputsize(self, size, column=None):
<ide> pass
<ide>
<ide> def _bind_parameters(operation, parameters):
<del> # TODO pydocs
<add> """ Helper method that binds parameters to a SQL query. """
<ide> # inspired by MySQL Python Connector (conversion.py)
<ide> string_parameters = {}
<ide> for (name, value) in parameters.iteritems():
<ide> def _bind_parameters(operation, parameters):
<ide> return operation % string_parameters
<ide>
<ide> def _escape(s):
<del> # TODO pydocs
<add> """ Helper method that escapes parameters to a SQL query. """
<ide> e = s
<ide> e = e.replace('\\', '\\\\')
<ide> e = e.replace('\n', '\\n')
<ide> def _escape(s):
<ide> return e
<ide>
<ide> def _bq_cast(string_field, bq_type):
<del> # TODO pydocs
<add> """
<add> Helper method that casts a BigQuery row to the appropriate data types.
<add> This is useful because BigQuery returns all fields as strings.
<add> """
<ide> if bq_type == 'INTEGER' or bq_type == 'TIMESTAMP':
<ide> return int(string_field)
<ide> elif bq_type == 'FLOAT': | 1 |
PHP | PHP | fix tests after rebase | 30de95db54e3cf9ea6867491d7efe0553c420173 | <ide><path>Cake/Test/TestCase/ORM/BehaviorTest.php
<ide> public function doSomething() {
<ide> * verifySettings
<ide> */
<ide> public function verifySettings() {
<add> parent::verifySettings();
<ide> }
<ide>
<ide> /**
<ide> public function testImplementedFindersDisabled() {
<ide> }
<ide>
<ide> /**
<del> * testImplementedFinderInvalid
<add> * testVerifySettings
<ide> *
<del> * @expectedException Cake\Error\Exception
<del> * @expectedExceptionMessage The method findNotDefined is not callable on class Cake\Test\TestCase\ORM\Test2Behavior
<add> * Don't expect an exception to be thrown
<ide> *
<ide> * @return void
<ide> */
<del> public function testImplementedFinderInvalid() {
<add> public function testVerifySettings() {
<add> $table = $this->getMock('Cake\ORM\Table');
<add> $behavior = new Test2Behavior($table);
<add> $behavior->verifySettings();
<add> $this->assertTrue(true, 'No exception thrown');
<add> }
<add>
<add>/**
<add> * testVerifySettingsImplementedFindersOverriden
<add> *
<add> * Simply don't expect an exception to be thrown
<add> *
<add> * @return void
<add> */
<add> public function testVerifySettingsImplementedFindersOverriden() {
<ide> $table = $this->getMock('Cake\ORM\Table');
<ide> $behavior = new Test2Behavior($table, [
<ide> 'implementedFinders' => [
<del> 'aliased' => 'findNotDefined'
<add> 'aliased' => 'findFoo'
<ide> ]
<ide> ]);
<add> $behavior->verifySettings();
<add> $this->assertTrue(true, 'No exception thrown');
<ide> }
<ide>
<ide> /**
<del> * testImplementedMethods
<add> * testVerifyImplementedFindersInvalid
<ide> *
<del> * Simply don't expect an exception to be thrown
<add> * @expectedException Cake\Error\Exception
<add> * @expectedExceptionMessage The method findNotDefined is not callable on class Cake\Test\TestCase\ORM\Test2Behavior
<ide> *
<ide> * @return void
<ide> */
<del> public function testVerifySettings() {
<add> public function testVerifyImplementedFindersInvalid() {
<ide> $table = $this->getMock('Cake\ORM\Table');
<del> $behavior = new Test2Behavior($table);
<add> $behavior = new Test2Behavior($table, [
<add> 'implementedFinders' => [
<add> 'aliased' => 'findNotDefined'
<add> ]
<add> ]);
<ide> $behavior->verifySettings();
<ide> }
<ide>
<ide> /**
<del> * testImplementedMethodsOverriden
<add> * testVerifySettingsImplementedMethodsOverriden
<ide> *
<del> * Simply don't expect an exception to be thrown
<add> * Don't expect an exception to be thrown
<ide> *
<ide> * @return void
<ide> */
<del> public function testVerifySettingsOverriden() {
<add> public function testVerifySettingsImplementedMethodsOverriden() {
<ide> $table = $this->getMock('Cake\ORM\Table');
<ide> $behavior = new Test2Behavior($table);
<ide> $behavior = new Test2Behavior($table, [
<ide> public function testVerifySettingsOverriden() {
<ide> ]
<ide> ]);
<ide> $behavior->verifySettings();
<add> $this->assertTrue(true, 'No exception thrown');
<ide> }
<ide>
<ide> /**
<del> * testImplementedMethodsInvalid
<add> * testVerifyImplementedMethodsInvalid
<ide> *
<ide> * @expectedException Cake\Error\Exception
<ide> * @expectedExceptionMessage The method iDoNotExist is not callable on class Cake\Test\TestCase\ORM\Test2Behavior
<ide> *
<ide> * @return void
<ide> */
<del> public function testVerifySettingsInvalid() {
<add> public function testVerifyImplementedMethodsInvalid() {
<ide> $table = $this->getMock('Cake\ORM\Table');
<ide> $behavior = new Test2Behavior($table, [
<ide> 'implementedMethods' => [
<ide><path>Cake/Test/TestCase/ORM/TableTest.php
<ide> public function testCallBehaviorFinder() {
<ide> * @return void
<ide> */
<ide> public function testCallBehaviorAliasedFinder() {
<del> $table = TableRegistry::get('article');
<add> $table = TableRegistry::get('articles');
<ide> $table->addBehavior('Sluggable', ['implementedFinders' => ['special' => 'findNoSlug']]);
<ide>
<del> $query = $table->special();
<del> $this->assertInstanceOf('Cake\ORM\Query', $query);
<del> $this->assertNotEmpty($query->clause('where'));
<del>
<ide> $query = $table->find('special');
<ide> $this->assertInstanceOf('Cake\ORM\Query', $query);
<ide> $this->assertNotEmpty($query->clause('where')); | 2 |
Ruby | Ruby | use appropriate words for docs of model.none | 80d3a0e16e8a3e7f02fc85a0136b52b3a1a19ebc | <ide><path>activerecord/lib/active_record/relation/query_methods.rb
<ide> def lock(locks = true)
<ide> # Any subsequent condition chained to the returned relation will continue
<ide> # generating an empty relation and will not fire any query to the database.
<ide> #
<del> # Used in cases where a method or scope could return zero results but the
<del> # response needs to be chainable.
<add> # Used in cases where a method or scope could return zero records but the
<add> # result needs to be chainable.
<ide> #
<ide> # For example:
<ide> # | 1 |
Ruby | Ruby | enhance active model assignment | 285cba022ce37977f977376a20ca866197ef33bd | <ide><path>activemodel/lib/active_model/attribute_assignment.rb
<ide> def _assign_attributes(attributes)
<ide> end
<ide>
<ide> def _assign_attribute(k, v)
<del> if respond_to?("#{k}=")
<del> public_send("#{k}=", v)
<add> setter = "#{k}="
<add> if respond_to?(setter)
<add> public_send(setter, v)
<ide> else
<ide> raise UnknownAttributeError.new(self, k)
<ide> end | 1 |
Java | Java | use math.min() in exponentialbackoff | 490bdd11a562b665f1b8695d4b8f61f6bb7949a1 | <ide><path>spring-core/src/main/java/org/springframework/util/backoff/ExponentialBackOff.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> private long computeNextInterval() {
<ide> }
<ide> else if (this.currentInterval < 0) {
<ide> long initialInterval = getInitialInterval();
<del> this.currentInterval = (initialInterval < maxInterval
<del> ? initialInterval : maxInterval);
<add> this.currentInterval = Math.min(initialInterval, maxInterval);
<ide> }
<ide> else {
<ide> this.currentInterval = multiplyInterval(maxInterval);
<ide> else if (this.currentInterval < 0) {
<ide> private long multiplyInterval(long maxInterval) {
<ide> long i = this.currentInterval;
<ide> i *= getMultiplier();
<del> return (i > maxInterval ? maxInterval : i);
<add> return Math.min(i, maxInterval);
<ide> }
<ide>
<ide> | 1 |
Ruby | Ruby | remove deprecation warning | 3d4004ab635f64952e1f6bf5d881ec0be7f37721 | <ide><path>actionview/test/actionpack/controller/render_test.rb
<ide> def teardown
<ide> def case_sensitive_file_system?
<ide> fname = '.case_sensitive_file_system_test'
<ide> FileUtils.touch(fname)
<del> !File.exists?(fname.upcase)
<add> !File.exist?(fname.upcase)
<ide> ensure
<ide> FileUtils.rm_f(fname)
<ide> end | 1 |
Javascript | Javascript | remove outdated v8 flag | 501ae0e6e33b76d4d553fe233635f46183a7c25b | <ide><path>test/node-api/test_buffer/test.js
<ide> 'use strict';
<del>// Flags: --expose-gc --no-concurrent-array-buffer-freeing --no-concurrent-array-buffer-sweeping
<add>// Flags: --expose-gc --no-concurrent-array-buffer-sweeping
<ide>
<ide> const common = require('../../common');
<ide> const binding = require(`./build/${common.buildType}/test_buffer`); | 1 |
Ruby | Ruby | improve observers documentation | 7536731a9ac5668a81c2581697edf25e1341519e | <ide><path>activemodel/lib/active_model/observing.rb
<ide> def observed_class
<ide> end
<ide>
<ide> # Start observing the declared classes and their subclasses.
<add> # Called automatically by the instance method.
<ide> def initialize
<ide> observed_classes.each { |klass| add_observer!(klass) }
<ide> end
<ide> def add_observer!(klass) #:nodoc:
<ide> klass.add_observer(self)
<ide> end
<ide>
<add> # Returns true if notifications are disabled for this object.
<ide> def disabled_for?(object)
<ide> klass = object.class
<ide> return false unless klass.respond_to?(:observers) | 1 |
Javascript | Javascript | use projection matrix in frustum | 9fcb357600446c2f0b161196c316c4c8daff7a55 | <ide><path>examples/jsm/csm/CSM.js
<ide> export default class CSM {
<ide>
<ide> initCascades() {
<ide>
<add> // TODO: Handle orthographic camera
<ide> const camera = this.camera;
<ide> const far = Math.min(camera.far, this.maxFar);
<ide> this.mainFrustum = new Frustum( {
<ide> export default class CSM {
<ide> updateUniforms() {
<ide>
<ide> const far = Math.min(this.camera.far, this.maxFar);
<del> console.log('HERE', far);
<add>
<ide> for ( let i = 0; i < this.materials.length; i ++ ) {
<ide>
<ide> this.materials[ i ].uniforms.CSM_cascades.value = this.getExtendedBreaks();
<ide><path>examples/jsm/csm/Frustum.js
<ide> * @author vHawk / https://github.com/vHawk/
<ide> */
<ide>
<del>import { MathUtils, Vector3 } from '../../../build/three.module.js';
<add>import { MathUtils, Vector3, Matrix4 } from '../../../build/three.module.js';
<ide> import FrustumVertex from './FrustumVertex.js';
<ide>
<add>const inverseProjectionMatrix = new Matrix4();
<add>
<ide> export default class Frustum {
<ide>
<ide> constructor( data ) {
<ide>
<ide> data = data || {};
<ide>
<del> this.fov = data.fov || 70;
<del> this.near = data.near || 0.1;
<del> this.far = data.far || 1000;
<del> this.aspect = data.aspect || 1;
<add> this.projectionMatrix = data.projectionMatrix;
<add> this.maxFar = data.maxFar || 10000;
<ide>
<ide> this.vertices = {
<ide> near: [],
<ide> export default class Frustum {
<ide>
<ide> getViewSpaceVertices() {
<ide>
<del> this.nearPlaneY = this.near * Math.tan( MathUtils.degToRad( this.fov / 2 ) );
<del> this.nearPlaneX = this.aspect * this.nearPlaneY;
<del>
<del> this.farPlaneY = this.far * Math.tan( MathUtils.degToRad( this.fov / 2 ) );
<del> this.farPlaneX = this.aspect * this.farPlaneY;
<add> const maxFar = this.maxFar;
<add> inverseProjectionMatrix.getInverse( this.projectionMatrix );
<ide>
<ide> // 3 --- 0 vertices.near/far order
<ide> // | |
<ide> // 2 --- 1
<add> // clip space spans from [-1, 1]
<ide>
<ide> this.vertices.near.push(
<del> new FrustumVertex( this.nearPlaneX, this.nearPlaneY, - this.near ),
<del> new FrustumVertex( this.nearPlaneX, - this.nearPlaneY, - this.near ),
<del> new FrustumVertex( - this.nearPlaneX, - this.nearPlaneY, - this.near ),
<del> new FrustumVertex( - this.nearPlaneX, this.nearPlaneY, - this.near )
<del> );
<add> new Vector3( 1, 1, - 1 ),
<add> new Vector3( 1, - 1, - 1 ),
<add> new Vector3( - 1, - 1, - 1 ),
<add> new Vector3( - 1, 1, - 1 )
<add> ).forEach( function( v ) {
<add>
<add> v.applyMatrix4( inverseProjectionMatrix );
<add> v.multiplyScalar( Math.min( v.z / maxFar, 1.0 ) );
<add>
<add> } );
<ide>
<ide> this.vertices.far.push(
<del> new FrustumVertex( this.farPlaneX, this.farPlaneY, - this.far ),
<del> new FrustumVertex( this.farPlaneX, - this.farPlaneY, - this.far ),
<del> new FrustumVertex( - this.farPlaneX, - this.farPlaneY, - this.far ),
<del> new FrustumVertex( - this.farPlaneX, this.farPlaneY, - this.far )
<del> );
<add> new Vector3( 1, 1, 1 ),
<add> new Vector3( 1, - 1, 1 ),
<add> new Vector3( - 1, - 1, 1 ),
<add> new Vector3( - 1, 1, 1 )
<add> ).forEach( function( v ) {
<add>
<add> v.applyMatrix4( inverseProjectionMatrix );
<add> v.multiplyScalar( Math.min( v.z / maxFar, 1.0 ) );
<add>
<add> } );
<ide>
<ide> return this.vertices;
<ide> | 2 |
Ruby | Ruby | move schema dumper tests to the correct class | 0f743bc59dc04f9108cefb46e22a56ed7ebf35bc | <ide><path>activerecord/test/cases/migration_test.rb
<ide> def migrate(x); raise 'Something broke'; end
<ide> refute Person.column_methods_hash.include?(:last_name)
<ide> end
<ide>
<del> def test_dump_schema_information_outputs_lexically_ordered_versions
<del> migration_path = MIGRATIONS_ROOT + '/valid_with_timestamps'
<del> ActiveRecord::Migrator.run(:up, migration_path, 20100301010101)
<del> ActiveRecord::Migrator.run(:up, migration_path, 20100201010101)
<del>
<del> schema_info = ActiveRecord::Base.connection.dump_schema_information
<del> assert_match(/20100201010101.*20100301010101/m, schema_info)
<del> end
<del>
<ide> def test_only_loads_pending_migrations
<ide> # migrate up to 1
<ide> ActiveRecord::Migrator.up(MIGRATIONS_ROOT + "/valid", 1)
<ide><path>activerecord/test/cases/schema_dumper_test.rb
<ide> def standard_dump
<ide> @stream.string
<ide> end
<ide>
<add> def test_dump_schema_information_outputs_lexically_ordered_versions
<add> versions = %w{ 20100101010101 20100201010101 20100301010101 }
<add> versions.reverse.each do |v|
<add> ActiveRecord::SchemaMigration.create!(:version => v)
<add> end
<add>
<add> schema_info = ActiveRecord::Base.connection.dump_schema_information
<add> assert_match(/20100201010101.*20100301010101/m, schema_info)
<add> end
<add>
<ide> def test_magic_comment
<ide> assert_match "# encoding: #{@stream.external_encoding.name}", standard_dump
<ide> end | 2 |
Ruby | Ruby | use a hash to store relation values | 6311975fb3c02f50730fd1e11b8dba8dd9c05306 | <ide><path>activerecord/lib/active_record/relation.rb
<ide> def initialize(klass, table)
<ide> @implicit_readonly = nil
<ide> @loaded = false
<ide> @default_scoped = false
<del>
<del> SINGLE_VALUE_METHODS.each {|v| instance_variable_set(:"@#{v}_value", nil)}
<del> MULTI_VALUE_METHODS.each {|v| instance_variable_set(:"@#{v}_values", [])}
<del>
<del> @create_with_value = {}
<add> @values = {}
<ide> end
<ide>
<ide> def insert(values)
<ide> def new(*args, &block)
<ide> end
<ide>
<ide> def initialize_copy(other)
<del> @bind_values = @bind_values.dup
<add> @values = @values.dup
<add> @values[:bind] = @values[:bind].dup if @values[:bind]
<ide> reset
<ide> end
<ide>
<ide> def exec_queries
<ide> default_scoped = with_default_scope
<ide>
<ide> if default_scoped.equal?(self)
<del> @records = eager_loading? ? find_with_associations : @klass.find_by_sql(arel, @bind_values)
<add> @records = eager_loading? ? find_with_associations : @klass.find_by_sql(arel, bind_values)
<ide>
<del> preload = @preload_values
<del> preload += @includes_values unless eager_loading?
<add> preload = preload_values
<add> preload += includes_values unless eager_loading?
<ide> preload.each do |associations|
<ide> ActiveRecord::Associations::Preloader.new(@records, associations).run
<ide> end
<ide>
<ide> # @readonly_value is true only if set explicitly. @implicit_readonly is true if there
<ide> # are JOINS and no explicit SELECT.
<del> readonly = @readonly_value.nil? ? @implicit_readonly : @readonly_value
<add> readonly = readonly_value.nil? ? @implicit_readonly : readonly_value
<ide> @records.each { |record| record.readonly! } if readonly
<ide> else
<ide> @records = default_scoped.to_a
<ide> def many?
<ide> if block_given?
<ide> to_a.many? { |*block_args| yield(*block_args) }
<ide> else
<del> @limit_value ? to_a.many? : size > 1
<add> limit_value ? to_a.many? : size > 1
<ide> end
<ide> end
<ide>
<ide> def reset
<ide> end
<ide>
<ide> def to_sql
<del> @to_sql ||= klass.connection.to_sql(arel, @bind_values.dup)
<add> @to_sql ||= klass.connection.to_sql(arel, bind_values.dup)
<ide> end
<ide>
<ide> def where_values_hash
<ide> def scope_for_create
<ide>
<ide> def eager_loading?
<ide> @should_eager_load ||=
<del> @eager_load_values.any? ||
<del> @includes_values.any? && (joined_includes_values.any? || references_eager_loaded_tables?)
<add> eager_load_values.any? ||
<add> includes_values.any? && (joined_includes_values.any? || references_eager_loaded_tables?)
<ide> end
<ide>
<ide> # Joins that are also marked for preloading. In which case we should just eager load them.
<ide> # Note that this is a naive implementation because we could have strings and symbols which
<ide> # represent the same association, but that aren't matched by this. Also, we could have
<ide> # nested hashes which partially match, e.g. { :a => :b } & { :a => [:b, :c] }
<ide> def joined_includes_values
<del> @includes_values & @joins_values
<add> includes_values & joins_values
<ide> end
<ide>
<ide> def ==(other)
<ide><path>activerecord/lib/active_record/relation/calculations.rb
<ide> def perform_calculation(operation, column_name, options = {})
<ide> distinct = nil if column_name =~ /\s*DISTINCT\s+/i
<ide> end
<ide>
<del> if @group_values.any?
<add> if group_values.any?
<ide> execute_grouped_calculation(operation, column_name, distinct)
<ide> else
<ide> execute_simple_calculation(operation, column_name, distinct)
<ide> def execute_simple_calculation(operation, column_name, distinct) #:nodoc:
<ide> end
<ide>
<ide> def execute_grouped_calculation(operation, column_name, distinct) #:nodoc:
<del> group_attr = @group_values
<add> group_attr = group_values
<ide> association = @klass.reflect_on_association(group_attr.first.to_sym)
<ide> associated = group_attr.size == 1 && association && association.macro == :belongs_to # only count belongs_to associations
<ide> group_fields = Array(associated ? association.foreign_key : group_attr)
<ide> def execute_grouped_calculation(operation, column_name, distinct) #:nodoc:
<ide> operation,
<ide> distinct).as(aggregate_alias)
<ide> ]
<del> select_values += @select_values unless @having_values.empty?
<add> select_values += select_values unless having_values.empty?
<ide>
<ide> select_values.concat group_fields.zip(group_aliases).map { |field,aliaz|
<ide> "#{field} AS #{aliaz}"
<ide> def type_cast_using_column(value, column)
<ide> end
<ide>
<ide> def select_for_count
<del> if @select_values.present?
<del> select = @select_values.join(", ")
<add> if select_values.present?
<add> select = select_values.join(", ")
<ide> select if select !~ /[,*]/
<ide> end
<ide> end
<ide><path>activerecord/lib/active_record/relation/finder_methods.rb
<ide> def find_with_associations
<ide> end
<ide>
<ide> def construct_join_dependency_for_association_find
<del> including = (@eager_load_values + @includes_values).uniq
<add> including = (eager_load_values + includes_values).uniq
<ide> ActiveRecord::Associations::JoinDependency.new(@klass, including, [])
<ide> end
<ide>
<ide> def construct_relation_for_association_calculations
<del> including = (@eager_load_values + @includes_values).uniq
<add> including = (eager_load_values + includes_values).uniq
<ide> join_dependency = ActiveRecord::Associations::JoinDependency.new(@klass, including, arel.froms.first)
<ide> relation = except(:includes, :eager_load, :preload)
<ide> apply_join_dependency(relation, join_dependency)
<ide> def find_one(id)
<ide> id = id.id if ActiveRecord::Base === id
<ide>
<ide> column = columns_hash[primary_key]
<del> substitute = connection.substitute_at(column, @bind_values.length)
<add> substitute = connection.substitute_at(column, bind_values.length)
<ide> relation = where(table[primary_key].eq(substitute))
<ide> relation.bind_values += [[column, id]]
<ide> record = relation.first
<ide> def find_some(ids)
<ide> result = where(table[primary_key].in(ids)).all
<ide>
<ide> expected_size =
<del> if @limit_value && ids.size > @limit_value
<del> @limit_value
<add> if limit_value && ids.size > limit_value
<add> limit_value
<ide> else
<ide> ids.size
<ide> end
<ide>
<ide> # 11 ids with limit 3, offset 9 should give 2 results.
<del> if @offset_value && (ids.size - @offset_value < expected_size)
<del> expected_size = ids.size - @offset_value
<add> if offset_value && (ids.size - offset_value < expected_size)
<add> expected_size = ids.size - offset_value
<ide> end
<ide>
<ide> if result.size == expected_size
<ide><path>activerecord/lib/active_record/relation/query_methods.rb
<ide> module ActiveRecord
<ide> module QueryMethods
<ide> extend ActiveSupport::Concern
<ide>
<del> attr_accessor :includes_values, :eager_load_values, :preload_values,
<del> :select_values, :group_values, :order_values, :joins_values,
<del> :where_values, :having_values, :bind_values,
<del> :limit_value, :offset_value, :lock_value, :readonly_value, :create_with_value,
<del> :from_value, :reordering_value, :reverse_order_value,
<del> :uniq_value, :references_values, :extending_values
<add> Relation::MULTI_VALUE_METHODS.each do |name|
<add> class_eval <<-CODE, __FILE__, __LINE__ + 1
<add> def #{name}_values # def select_values
<add> @values[:#{name}] || [] # @values[:select] || []
<add> end # end
<add> #
<add> def #{name}_values=(values) # def select_values=(values)
<add> @values[:#{name}] = values # @values[:select] = values
<add> end # end
<add> CODE
<add> end
<add>
<add> (Relation::SINGLE_VALUE_METHODS - [:create_with]).each do |name|
<add> class_eval <<-CODE, __FILE__, __LINE__ + 1
<add> def #{name}_value # def readonly_value
<add> @values[:#{name}] # @values[:readonly]
<add> end # end
<add> #
<add> def #{name}_value=(value) # def readonly_value=(value)
<add> @values[:#{name}] = value # @values[:readonly] = value
<add> end # end
<add> CODE
<add> end
<add>
<add> def create_with_value
<add> @values[:create_with] || {}
<add> end
<add>
<add> def create_with_value=(value)
<add> @values[:create_with] = value
<add> end
<ide>
<ide> alias extensions extending_values
<ide>
<ide> def arel
<ide> def build_arel
<ide> arel = table.from table
<ide>
<del> build_joins(arel, @joins_values) unless @joins_values.empty?
<add> build_joins(arel, joins_values) unless joins_values.empty?
<ide>
<del> collapse_wheres(arel, (@where_values - ['']).uniq)
<add> collapse_wheres(arel, (where_values - ['']).uniq)
<ide>
<del> arel.having(*@having_values.uniq.reject{|h| h.blank?}) unless @having_values.empty?
<add> arel.having(*having_values.uniq.reject{|h| h.blank?}) unless having_values.empty?
<ide>
<del> arel.take(connection.sanitize_limit(@limit_value)) if @limit_value
<del> arel.skip(@offset_value.to_i) if @offset_value
<add> arel.take(connection.sanitize_limit(limit_value)) if limit_value
<add> arel.skip(offset_value.to_i) if offset_value
<ide>
<del> arel.group(*@group_values.uniq.reject{|g| g.blank?}) unless @group_values.empty?
<add> arel.group(*group_values.uniq.reject{|g| g.blank?}) unless group_values.empty?
<ide>
<del> order = @order_values
<del> order = reverse_sql_order(order) if @reverse_order_value
<add> order = order_values
<add> order = reverse_sql_order(order) if reverse_order_value
<ide> arel.order(*order.uniq.reject{|o| o.blank?}) unless order.empty?
<ide>
<del> build_select(arel, @select_values.uniq)
<add> build_select(arel, select_values.uniq)
<ide>
<del> arel.distinct(@uniq_value)
<del> arel.from(@from_value) if @from_value
<del> arel.lock(@lock_value) if @lock_value
<add> arel.distinct(uniq_value)
<add> arel.from(from_value) if from_value
<add> arel.lock(lock_value) if lock_value
<ide>
<ide> arel
<ide> end
<ide><path>activerecord/test/cases/relation_test.rb
<ide> def test_empty_where_values_hash
<ide> relation = Relation.new :a, :b
<ide> assert_equal({}, relation.where_values_hash)
<ide>
<del> relation.where_values << :hello
<add> relation.where! :hello
<ide> assert_equal({}, relation.where_values_hash)
<ide> end
<ide>
<ide> def test_has_values
<ide> relation = Relation.new Post, Post.arel_table
<del> relation.where_values << relation.table[:id].eq(10)
<add> relation.where! relation.table[:id].eq(10)
<ide> assert_equal({:id => 10}, relation.where_values_hash)
<ide> end
<ide>
<ide> def test_values_wrong_table
<ide> relation = Relation.new Post, Post.arel_table
<del> relation.where_values << Comment.arel_table[:id].eq(10)
<add> relation.where! Comment.arel_table[:id].eq(10)
<ide> assert_equal({}, relation.where_values_hash)
<ide> end
<ide>
<ide> def test_tree_is_not_traversed
<ide> left = relation.table[:id].eq(10)
<ide> right = relation.table[:id].eq(10)
<ide> combine = left.and right
<del> relation.where_values << combine
<add> relation.where! combine
<ide> assert_equal({}, relation.where_values_hash)
<ide> end
<ide>
<ide> def test_create_with_value
<ide>
<ide> def test_create_with_value_with_wheres
<ide> relation = Relation.new Post, Post.arel_table
<del> relation.where_values << relation.table[:id].eq(10)
<add> relation.where! relation.table[:id].eq(10)
<ide> relation.create_with_value = {:hello => 'world'}
<ide> assert_equal({:hello => 'world', :id => 10}, relation.scope_for_create)
<ide> end
<ide> def test_scope_for_create_is_cached
<ide> relation = Relation.new Post, Post.arel_table
<ide> assert_equal({}, relation.scope_for_create)
<ide>
<del> relation.where_values << relation.table[:id].eq(10)
<add> relation.where! relation.table[:id].eq(10)
<ide> assert_equal({}, relation.scope_for_create)
<ide>
<ide> relation.create_with_value = {:hello => 'world'}
<ide> def test_empty_eager_loading?
<ide>
<ide> def test_eager_load_values
<ide> relation = Relation.new :a, :b
<del> relation.eager_load_values << :b
<add> relation.eager_load! :b
<ide> assert relation.eager_loading?
<ide> end
<ide> | 5 |
Javascript | Javascript | use consistent quotes | 3c31bfff6599cf68bda2552a92d982559bd64c5e | <ide><path>benchmark/querystring/querystring-stringify.js
<ide> function main({ type, n }) {
<ide> encodemany: {
<ide> '\u0080\u0083\u0089': 'bar',
<ide> '\u008C\u008E\u0099': 'quux',
<del> xyzzy: '\u00A5q\u00A3r'
<add> 'xyzzy': '\u00A5q\u00A3r'
<ide> },
<ide> encodelast: {
<ide> foo: 'bar',
<ide><path>lib/internal/loader/DefaultResolve.js
<ide> function search(target, base) {
<ide> }
<ide>
<ide> const extensionFormatMap = {
<del> __proto__: null,
<add> '__proto__': null,
<ide> '.mjs': 'esm',
<ide> '.json': 'json',
<ide> '.node': 'addon',
<ide><path>test/doctool/test-doctool-json.js
<ide> const testData = [
<ide> meta: {
<ide> added: ['v5.3.0', 'v4.2.0'],
<ide> changes: [
<del> { version: 'v4.2.0',
<add> { 'version': 'v4.2.0',
<ide> 'pr-url': 'https://github.com/nodejs/node/pull/3276',
<del> description: 'The `error` parameter can now be ' +
<add> 'description': 'The `error` parameter can now be ' +
<ide> 'an arrow function.'
<ide> }
<ide> ]
<ide><path>test/parallel/test-http-client-headers-array.js
<ide> function execute(options) {
<ide> http.createServer(function(req, res) {
<ide> const expectHeaders = {
<ide> 'x-foo': 'boom',
<del> cookie: 'a=1; b=2; c=3',
<del> connection: 'close'
<add> 'cookie': 'a=1; b=2; c=3',
<add> 'connection': 'close'
<ide> };
<ide>
<ide> // no Host header when you set headers an array
<ide><path>test/parallel/test-http-raw-headers.js
<ide> http.createServer(function(req, res) {
<ide> 'close'
<ide> ];
<ide> const expectHeaders = {
<del> host: `localhost:${this.address().port}`,
<add> 'host': `localhost:${this.address().port}`,
<ide> 'transfer-encoding': 'CHUNKED',
<ide> 'x-bar': 'yoyoyo',
<del> connection: 'close'
<add> 'connection': 'close'
<ide> };
<ide> const expectRawTrailers = [
<ide> 'x-bAr',
<ide> http.createServer(function(req, res) {
<ide> 'chunked'
<ide> ];
<ide> const expectHeaders = {
<del> trailer: 'x-foo',
<del> date: null,
<del> connection: 'close',
<add> 'trailer': 'x-foo',
<add> 'date': null,
<add> 'connection': 'close',
<ide> 'transfer-encoding': 'chunked'
<ide> };
<ide> res.rawHeaders[3] = null;
<ide><path>test/parallel/test-http2-compat-expect-continue-check.js
<ide> server.listen(0, common.mustCall(() => {
<ide> const client = http2.connect(`http://localhost:${server.address().port}`);
<ide> const req = client.request({
<ide> ':method': 'POST',
<del> expect: '100-continue'
<add> 'expect': '100-continue'
<ide> });
<ide>
<ide> let gotContinue = false;
<ide><path>test/parallel/test-http2-compat-expect-continue.js
<ide> server.on('listening', common.mustCall(() => {
<ide> const client = http2.connect(`http://localhost:${server.address().port}`);
<ide> const req = client.request({
<ide> ':method': 'POST',
<del> expect: '100-continue'
<add> 'expect': '100-continue'
<ide> });
<ide>
<ide> let gotContinue = false;
<ide><path>test/parallel/test-http2-compat-expect-handling.js
<ide> function nextTest(testsToRun) {
<ide> ':method': 'GET',
<ide> ':scheme': 'http',
<ide> ':authority': `localhost:${port}`,
<del> expect: expectValue
<add> 'expect': expectValue
<ide> });
<ide>
<ide> req.on('response', common.mustCall((headers) => {
<ide><path>test/parallel/test-http2-cookies.js
<ide> server.on('listening', common.mustCall(() => {
<ide>
<ide> const req = client.request({
<ide> ':path': '/',
<del> abc: [1, 2, 3],
<del> cookie: ['a=b', 'c=d', 'e=f'],
<add> 'abc': [1, 2, 3],
<add> 'cookie': ['a=b', 'c=d', 'e=f'],
<ide> });
<ide> req.resume();
<ide>
<ide><path>test/parallel/test-http2-server-rst-before-respond.js
<ide> function onStream(stream, headers, flags) {
<ide> common.expectsError(() => {
<ide> stream.additionalHeaders({
<ide> ':status': 123,
<del> abc: 123
<add> 'abc': 123
<ide> });
<ide> }, { code: 'ERR_HTTP2_INVALID_STREAM' });
<ide> }
<ide><path>test/parallel/test-http2-server-rst-stream.js
<ide> server.listen(0, common.mustCall(() => {
<ide> tests.forEach((test) => {
<ide> const req = client.request({
<ide> ':method': 'POST',
<del> rstcode: test[0]
<add> 'rstcode': test[0]
<ide> });
<ide> req.on('close', common.mustCall((code) => {
<ide> assert.strictEqual(code, test[0]);
<ide><path>test/parallel/test-querystring.js
<ide> const qsTestCases = [
<ide> ['foo&bar=baz', 'foo=&bar=baz', { foo: '', bar: 'baz' }],
<ide> ['a=b&c&d=e', 'a=b&c=&d=e', { a: 'b', c: '', d: 'e' }],
<ide> ['a=b&c=&d=e', 'a=b&c=&d=e', { a: 'b', c: '', d: 'e' }],
<del> ['a=b&=c&d=e', 'a=b&=c&d=e', { a: 'b', '': 'c', d: 'e' }],
<del> ['a=b&=&c=d', 'a=b&=&c=d', { a: 'b', '': '', c: 'd' }],
<add> ['a=b&=c&d=e', 'a=b&=c&d=e', { 'a': 'b', '': 'c', 'd': 'e' }],
<add> ['a=b&=&c=d', 'a=b&=&c=d', { 'a': 'b', '': '', 'c': 'd' }],
<ide> ['&&foo=bar&&', 'foo=bar', { foo: 'bar' }],
<ide> ['&', '', {}],
<ide> ['&&&&', '', {}],
<ide><path>test/parallel/test-vm-module-link.js
<ide> async function circular() {
<ide>
<ide> async function circular2() {
<ide> const sourceMap = {
<del> root: `
<add> 'root': `
<ide> import * as a from './a.mjs';
<ide> import * as b from './b.mjs';
<ide> if (!('fromA' in a))
<ide><path>tools/eslint-rules/no-unescaped-regexp-dot.js
<ide> module.exports = function(context) {
<ide> }
<ide>
<ide> return {
<del> TemplateLiteral: checkLiteral,
<del> Literal: checkLiteral,
<del> CallExpression: checkRegExpStart,
<del> NewExpression: checkRegExpStart,
<add> 'TemplateLiteral': checkLiteral,
<add> 'Literal': checkLiteral,
<add> 'CallExpression': checkRegExpStart,
<add> 'NewExpression': checkRegExpStart,
<ide> 'CallExpression:exit': checkRegExpEnd,
<ide> 'NewExpression:exit': checkRegExpEnd
<ide> }; | 14 |
Text | Text | update changelog for 1.11.2 | 302a1e61013a2c90ae94a4e7d3e49b9c8ed9d768 | <ide><path>CHANGELOG.md
<ide> information on the list of deprecated flags and APIs please have a look at
<ide> https://docs.docker.com/engine/deprecated/ where target removal dates can also
<ide> be found.
<ide>
<add>## 1.11.2 (2016-05-31)
<add>
<add>### Networking
<add>
<add>- Fix a stale endpoint issue on overlay networks during ungraceful restart ([#23015](https://github.com/docker/docker/pull/23015))
<add>- Fix an issue where the wrong port could be reported by `docker inspect/ps/port` ([#22997](https://github.com/docker/docker/pull/22997))
<add>
<add>### Runtime
<add>
<add>- Fix a potential panic when running `docker build` ([#23032](https://github.com/docker/docker/pull/23032))
<add>- Fix interpretation of `--user` parameter ([#22998](https://github.com/docker/docker/pull/22998))
<add>- Fix a bug preventing container statistics to be correctly reported ([#22955](https://github.com/docker/docker/pull/22955))
<add>- Fix an issue preventing container to be restarted after daemon restart ([#22947](https://github.com/docker/docker/pull/22947))
<add>- Fix issues when running 32 bit binaries on Ubuntu 16.04 ([#22922](https://github.com/docker/docker/pull/22922))
<add>- Fix a possible deadlock on image deletion and container attach ([#22918](https://github.com/docker/docker/pull/22918))
<add>- Fix an issue where containers fail to start after a daemon restart if they depend on a containerized cluster store ([#22561](https://github.com/docker/docker/pull/22561))
<add>- Fix an issue causing `docker ps` to hang on CentOS when using devicemapper ([#22168](https://github.com/docker/docker/pull/22168), [#23067](https://github.com/docker/docker/pull/23067))
<add>- Fix a bug preventing to `docker exec` into a container when using devicemapper ([#22168](https://github.com/docker/docker/pull/22168), [#23067](https://github.com/docker/docker/pull/23067))
<add>
<add>
<ide> ## 1.11.1 (2016-04-26)
<ide>
<ide> ### Distribution | 1 |
Ruby | Ruby | remove unused function from bump-cask-pr | ad7561955401b051f716dcd2676ecbf99067b703 | <ide><path>Library/Homebrew/dev-cmd/bump-cask-pr.rb
<ide> def bump_cask_pr
<ide> GitHub.create_bump_pr(pr_info, args: args)
<ide> end
<ide>
<del> def fetch_cask(contents, config: nil)
<del> cask = Cask::CaskLoader.load(contents)
<del> cask.config = config if config.present?
<del> old_hash = cask.sha256.to_s
<del>
<del> cask_download = Cask::Download.new(cask, quarantine: true)
<del> download = cask_download.fetch(verify_download_integrity: false)
<del> Utils::Tar.validate_file(download)
<del> new_hash = download.sha256
<del>
<del> [old_hash, new_hash]
<del> end
<del>
<ide> def check_open_pull_requests(cask, args:)
<ide> tap_remote_repo = cask.tap.remote_repo || cask.tap.full_name
<ide> GitHub.check_for_duplicate_pull_requests(cask.token, tap_remote_repo, | 1 |
Java | Java | fix copy+paste error | 1b98d09855477df1d05a498e2749546fe0c1908d | <ide><path>spring-web/src/test/java/org/springframework/http/server/reactive/AbstractHttpHandlerIntegrationTests.java
<ide> public void tearDown() throws Exception {
<ide>
<ide>
<ide> /**
<del> * Return an interval stream of with n number of ticks and buffer the
<del> * emissions to avoid back pressure failures (e.g. on slow CI server).
<add> * Return an interval stream of N number of ticks and buffer the emissions
<add> * to avoid back pressure failures (e.g. on slow CI server).
<ide> *
<ide> * <p>Use this method as follows:
<ide> * <ul>
<ide> public void tearDown() throws Exception {
<ide> * </ul>
<ide> */
<ide> public static Flux<Long> interval(Duration period, int count) {
<del> return Flux.interval(period).take(count).onBackpressureBuffer(2);
<add> return Flux.interval(period).take(count).onBackpressureBuffer(count);
<ide> }
<ide>
<ide> } | 1 |
PHP | PHP | update busfake to use new batchfake | 6299cd85d728ebb82da13f20abcdf4a7e98ef55b | <ide><path>src/Illuminate/Support/Testing/Fakes/BatchRepositoryFake.php
<ide>
<ide> use Carbon\CarbonImmutable;
<ide> use Closure;
<del>use Illuminate\Bus\Batch;
<ide> use Illuminate\Bus\BatchRepository;
<ide> use Illuminate\Bus\PendingBatch;
<ide> use Illuminate\Bus\UpdatedBatchJobCounts;
<del>use Illuminate\Support\Facades\Facade;
<ide> use Illuminate\Support\Str;
<ide>
<ide> class BatchRepositoryFake implements BatchRepository
<ide> public function store(PendingBatch $batch)
<ide> {
<ide> $id = (string) Str::orderedUuid();
<ide>
<del> $this->batches[$id] = new Batch(
<del> new QueueFake(Facade::getFacadeApplication()),
<del> $this,
<add> $this->batches[$id] = new BatchFake(
<ide> $id,
<ide> $batch->name,
<ide> count($batch->jobs),
<ide> public function markAsFinished(string $batchId)
<ide> public function cancel(string $batchId)
<ide> {
<ide> if (isset($this->batches[$batchId])) {
<del> $this->batches[$batchId]->cancelledAt = now();
<add> $this->batches[$batchId]->cancel();
<ide> }
<ide> }
<ide> | 1 |
Python | Python | update neural net tests | 836fe1d8800c028e34920812773ec9426d716c90 | <ide><path>spacy/tests/parser/test_neural_parser.py
<ide> def test_build_model(parser):
<ide>
<ide>
<ide> def test_predict_doc(parser, tok2vec, model, doc):
<del> state = {}
<del> state['tokvecs'] = tok2vec([doc])
<add> doc.tensor = tok2vec([doc])
<ide> parser.model = model
<del> parser(doc, state=state)
<add> parser(doc)
<ide>
<ide>
<ide> def test_update_doc(parser, tok2vec, model, doc, gold):
<ide> parser.model = model
<ide> tokvecs, bp_tokvecs = tok2vec.begin_update([doc])
<del> state = {'tokvecs': tokvecs, 'bp_tokvecs': bp_tokvecs}
<del> state = parser.update(doc, gold, state=state)
<del> loss1 = state['parser_loss']
<del> assert loss1 > 0
<del> state = parser.update(doc, gold, state=state)
<del> loss2 = state['parser_loss']
<del> assert loss2 == loss1
<add> d_tokvecs = parser.update((doc, tokvecs), gold)
<add> assert d_tokvecs.shape == tokvecs.shape
<ide> def optimize(weights, gradient, key=None):
<ide> weights -= 0.001 * gradient
<del> state = parser.update(doc, gold, sgd=optimize, state=state)
<del> loss3 = state['parser_loss']
<del> state = parser.update(doc, gold, sgd=optimize, state=state)
<del> lossr = state['parser_loss']
<del> assert loss3 < loss2
<add> bp_tokvecs(d_tokvecs, sgd=optimize)
<add> assert d_tokvecs.sum() == 0. | 1 |
Text | Text | fix typo error and update index | e0db2fa4da8f4de861ff83e6f19e7e6d4251289d | <ide><path>docs/extend/index.md
<ide> Currently, you can extend Docker by adding a plugin. This section contains the f
<ide> * [Understand Docker plugins](plugins.md)
<ide> * [Write a volume plugin](plugins_volume.md)
<ide> * [Write a network plugin](plugins_network.md)
<add>* [Write an authorization plugin](authorization.md)
<ide> * [Docker plugin API](plugin_api.md)
<ide><path>docs/extend/plugins_network.md
<ide> documented as part of libnetwork:
<ide>
<ide> # Related Information
<ide>
<del>To interact with the Docker maintainers and other interested users, se the IRC channel `#docker-network`.
<add>To interact with the Docker maintainers and other interested users, see the IRC channel `#docker-network`.
<ide>
<ide> - [Docker networks feature overview](../userguide/networking/index.md)
<ide> - The [LibNetwork](https://github.com/docker/libnetwork) project | 2 |
Ruby | Ruby | prefer rails.logger over rails_default_logger | 75fa82418d54b36b6092767f2a2b5c1d5324441b | <ide><path>actionpack/lib/action_controller/failsafe.rb
<ide> def log_failsafe_exception(exception)
<ide> end
<ide>
<ide> def failsafe_logger
<del> if defined?(::RAILS_DEFAULT_LOGGER) && !::RAILS_DEFAULT_LOGGER.nil?
<del> ::RAILS_DEFAULT_LOGGER
<add> if defined? Rails && Rails.logger
<add> Rails.logger
<ide> else
<ide> Logger.new($stderr)
<ide> end
<ide><path>activesupport/lib/active_support/dependencies.rb
<ide> class LoadingModule #:nodoc:
<ide> # Old style environment.rb referenced this method directly. Please note, it doesn't
<ide> # actually *do* anything any more.
<ide> def self.root(*args)
<del> if defined?(RAILS_DEFAULT_LOGGER)
<del> RAILS_DEFAULT_LOGGER.warn "Your environment.rb uses the old syntax, it may not continue to work in future releases."
<del> RAILS_DEFAULT_LOGGER.warn "For upgrade instructions please see: http://manuals.rubyonrails.com/read/book/19"
<add> if defined? Rails && Rails.logger
<add> Rails.logger.warn "Your environment.rb uses the old syntax, it may not continue to work in future releases."
<add> Rails.logger.warn "For upgrade instructions please see: http://manuals.rubyonrails.com/read/book/19"
<ide> end
<ide> end
<ide> end
<ide><path>activesupport/lib/active_support/deprecation.rb
<ide> module Deprecation #:nodoc:
<ide> $stderr.puts callstack.join("\n ") if debug
<ide> },
<ide> 'development' => Proc.new { |message, callstack|
<del> logger = defined?(::RAILS_DEFAULT_LOGGER) ? ::RAILS_DEFAULT_LOGGER : Logger.new($stderr)
<add> logger = defined? Rails ? Rails.logger : Logger.new($stderr)
<ide> logger.warn message
<ide> logger.debug callstack.join("\n ") if debug
<ide> }
<ide><path>railties/lib/commands/runner.rb
<ide> eval(code_or_file)
<ide> end
<ide> ensure
<del> RAILS_DEFAULT_LOGGER.flush if RAILS_DEFAULT_LOGGER
<add> if defined? Rails
<add> Rails.logger.flush if Rails.logger.respond_to?(:flush)
<add> end
<ide> end | 4 |
Go | Go | change unused writecloser to writer | fd3f2e175fa6ddb606d2c681ff86a97faccfebbd | <ide><path>pkg/jsonlog/jsonlog.go
<ide> func (jl *JSONLog) Format(format string) (string, error) {
<ide> return fmt.Sprintf("[%s] %s", jl.Created.Format(format), jl.Log), nil
<ide> }
<ide>
<del>func WriteLog(src io.Reader, dst io.WriteCloser, format string) error {
<add>func WriteLog(src io.Reader, dst io.Writer, format string) error {
<ide> dec := json.NewDecoder(src)
<ide> for {
<ide> l := &JSONLog{} | 1 |
PHP | PHP | remove bogus test | e097d9780a85f6534270c39761eba01c2774f837 | <ide><path>tests/TestCase/View/Helper/FormHelperTest.php
<ide> public function testInputDatetime() {
<ide> $this->assertRegExp('/for\="created-month"/', $result);
<ide> }
<ide>
<del>/**
<del> * Test generating checkboxes in a loop.
<del> *
<del> * @return void
<del> */
<del> public function testInputCheckboxesInLoop() {
<del> $this->markTestIncomplete('Need to revisit once models work again.');
<del> for ($i = 1; $i < 5; $i++) {
<del> $result = $this->Form->input("Contact.{$i}.email", array('type' => 'checkbox', 'value' => $i));
<del> $expected = array(
<del> 'div' => array('class' => 'input checkbox'),
<del> 'input' => array('type' => 'hidden', 'name' => "Contact[{$i}][email]", 'value' => '0', 'id' => "Contact{$i}Email_"),
<del> array('input' => array('type' => 'checkbox', 'name' => "Contact[{$i}][email]", 'value' => $i, 'id' => "Contact{$i}Email")),
<del> 'label' => array('for' => "Contact{$i}Email"),
<del> 'Email',
<del> '/label',
<del> '/div'
<del> );
<del> $this->assertTags($result, $expected);
<del> }
<del> }
<del>
<ide> /**
<ide> * Test generating checkboxes with disabled elements.
<ide> * | 1 |
Python | Python | register errorhandlers for exceptions | 668061a5fc928a5055815acf818b02baf1aef37b | <ide><path>flask/app.py
<ide> def find_handler(handler_map):
<ide> return handler
<ide>
<ide> # fall back to app handlers
<del> return find_handler(self.error_handler_spec[None].get(code))
<add> handler = find_handler(self.error_handler_spec[None].get(code))
<add> if handler is not None:
<add> return handler
<add>
<add> try:
<add> handler = find_handler(self.error_handler_spec[None][None])
<add> except KeyError:
<add> handler = None
<add>
<add> return handler
<ide>
<ide> def handle_http_exception(self, e):
<ide> """Handles an HTTP exception. By default this will invoke the
<ide><path>tests/test_user_error_handler.py
<ide> # -*- coding: utf-8 -*-
<del>from werkzeug.exceptions import Forbidden, InternalServerError
<add>from werkzeug.exceptions import Forbidden, InternalServerError, HTTPException, NotFound
<ide> import flask
<ide>
<ide>
<ide> def key_error():
<ide> assert c.get('/keyerror').data == b'KeyError'
<ide>
<ide>
<add>def test_default_error_handler():
<add> app = flask.Flask(__name__)
<add>
<add> @app.errorhandler(HTTPException)
<add> def catchall_errorhandler(e):
<add> assert isinstance(e, HTTPException)
<add> assert isinstance(e, NotFound)
<add> return 'default'
<add>
<add> @app.errorhandler(Forbidden)
<add> def catchall_errorhandler(e):
<add> assert isinstance(e, Forbidden)
<add> return 'forbidden'
<add>
<add> @app.route('/forbidden')
<add> def forbidden():
<add> raise Forbidden()
<add>
<add> c = app.test_client()
<add> assert c.get('/undefined').data == b'default'
<add> assert c.get('/forbidden').data == b'forbidden'
<add>
<add>
<ide> def test_error_handler_subclass():
<ide> app = flask.Flask(__name__)
<ide> | 2 |
Text | Text | add link to diagnostic tools | 52483a0e5da42ce1eb6e7040e8bf747fb9369482 | <ide><path>doc/contributing/diagnostic-tooling-support-tiers.md
<ide> The tools are currently assigned to Tiers as follows:
<ide>
<ide> ## Tier 1
<ide>
<del>| Tool Type | Tool/API Name | Regular Testing in Node.js CI | Integrated with Node.js | Target Tier |
<del>| --------- | ----------------- | ----------------------------- | ----------------------- | ----------- |
<del>| FFDC | diagnostic report | Yes | Yes | 1 |
<del>| | | | | |
<add>| Tool Type | Tool/API Name | Regular Testing in Node.js CI | Integrated with Node.js | Target Tier |
<add>| --------- | --------------------- | ----------------------------- | ----------------------- | ----------- |
<add>| FFDC | [diagnostic report][] | Yes | Yes | 1 |
<add>| | | | | |
<ide>
<ide> ## Tier 2
<ide>
<ide> The tools are currently assigned to Tiers as follows:
<ide> | Profiling | --prof/--prof-process flags | Yes | Yes | 1 |
<ide> | Profiling | V8 CodeEventHandler API | Partial (V8 Tests) | Yes | 2 |
<ide> | Profiling | V8 --interpreted-frames-native-stack | Yes | Yes | 2 |
<del>| Profiling | Linux perf | Yes | Partial | 2 |
<del>| Profiling | node-clinic | No | No | 3 |
<del>| Debugger | Chrome Dev tools | No | No | 3 |
<add>| Profiling | [Linux perf][] | Yes | Partial | 2 |
<add>| Profiling | [node-clinic][] | No | No | 3 |
<add>| Debugger | [Chrome Dev tools][] | No | No | 3 |
<ide>
<ide> ## Tier 4
<ide>
<del>| Tool Type | Tool/API Name | Regular Testing in Node.js CI | Integrated with Node.js | Target Tier |
<del>| --------- | --------------------------------------------- | ----------------------------- | ----------------------- | ----------- |
<del>| Profiling | [0x](https://github.com/davidmarkclements/0x) | No | No | 3 |
<add>| Tool Type | Tool/API Name | Regular Testing in Node.js CI | Integrated with Node.js | Target Tier |
<add>| --------- | ------------- | ----------------------------- | ----------------------- | ----------- |
<add>| Profiling | [0x][] | No | No | 3 |
<ide>
<ide> ## Not yet classified
<ide>
<del>| Tool Type | Tool/API Name | Regular Testing in Node.js CI | Integrated with Node.js | Target Tier |
<del>| --------- | ------------------------- | ----------------------------- | ----------------------- | ----------- |
<del>| Memory | V8 heap profiler | No | Yes | 1 |
<del>| Memory | V8 sampling heap profiler | No | Yes | 1 |
<del>| AsyncFlow | Async Hooks (API) | ? | Yes | 1 |
<del>| Debugger | V8 Debug protocol (API) | No | Yes | 1 |
<del>| Debugger | Command line Debug Client | ? | Yes | 1 |
<del>| Tracing | trace\_events (API) | No | Yes | 1 |
<del>| Tracing | trace\_gc | No | Yes | 1 |
<del>| M/T | eBPF tracing tool | No | No | ? |
<add>| Tool Type | Tool/API Name | Regular Testing in Node.js CI | Integrated with Node.js | Target Tier |
<add>| --------- | ----------------------------------------- | ----------------------------- | ----------------------- | ----------- |
<add>| Memory | V8 heap profiler | No | Yes | 1 |
<add>| Memory | V8 sampling heap profiler | No | Yes | 1 |
<add>| AsyncFlow | [Async Hooks (API)][] | ? | Yes | 1 |
<add>| Debugger | V8 Debug protocol (API) | No | Yes | 1 |
<add>| Debugger | [Command line Debug Client][] | ? | Yes | 1 |
<add>| Tracing | [trace\_events (API)][trace_events (API)] | No | Yes | 1 |
<add>| Tracing | trace\_gc | No | Yes | 1 |
<add>| M/T | eBPF tracing tool | No | No | ? |
<add>
<add>[0x]: https://github.com/davidmarkclements/0x
<add>[Async Hooks (API)]: https://nodejs.org/api/async_hooks.html
<add>[Chrome Dev Tools]: https://developer.chrome.com/docs/devtools/
<add>[Command line Debug Client]: https://nodejs.org/api/inspector.html
<add>[Linux perf]: https://perf.wiki.kernel.org/index.php/Main_Page
<add>[diagnostic report]: https://nodejs.org/api/report.html
<add>[node-clinic]: https://github.com/clinicjs/node-clinic/
<add>[trace_events (API)]: https://nodejs.org/api/tracing.html | 1 |
Python | Python | add missing line in distutils/system_info.py | 83480b6eb106d8c7e1d9293d7adc988c7c670778 | <ide><path>numpy/distutils/system_info.py
<ide> def calc_info(self):
<ide> dict_append(info, include_dirs=[h])
<ide> info['language'] = 'c'
<ide>
<add> atlas_version, atlas_extra_info = get_atlas_version(**atlas)
<ide> dict_append(atlas, **atlas_extra_info)
<ide>
<ide> dict_append(info, **atlas) | 1 |
PHP | PHP | $reservedmemory | fe3d1bff07215c4ca79a0ae202d15ba22f17318d | <ide><path>src/Illuminate/Foundation/Bootstrap/HandleExceptions.php
<ide> class HandleExceptions
<ide> /**
<ide> * Reserved memory so that errors can be displayed properly on memory exhaustion.
<ide> *
<del> * @var string
<add> * @var string|null
<ide> */
<ide> public static $reservedMemory;
<ide> | 1 |
Text | Text | add missing comma in net documentation | 1c67e741a12b7791adbc7bb5821650f5d1da30cf | <ide><path>doc/api/net.md
<ide> The number of concurrent connections on the server.
<ide>
<ide> This becomes `null` when sending a socket to a child with
<ide> [`child_process.fork()`][]. To poll forks and get current number of active
<del>connections use asynchronous [`server.getConnections()`][] instead.
<add>connections, use asynchronous [`server.getConnections()`][] instead.
<ide>
<ide> ### server.getConnections(callback)
<ide> <!-- YAML | 1 |
Python | Python | fix the module names of `numpy.typing` objects | 77efd107aa51c8c82781702a607488ca31c4464e | <ide><path>numpy/typing/__init__.py
<ide>
<ide> .. automodule:: numpy.typing.mypy_plugin
<ide>
<add>.. currentmodule:: numpy.typing
<add>
<ide> Differences from the runtime NumPy API
<ide> --------------------------------------
<ide> | 1 |
Javascript | Javascript | add error log if collada file can't be parsed | f70703ac764751aef3086a29d02af3c17b073301 | <ide><path>examples/js/loaders/ColladaLoader.js
<ide> THREE.ColladaLoader.prototype = {
<ide>
<ide> var collada = getElementsByTagName( xml, 'COLLADA' )[ 0 ];
<ide>
<add> var parserError = xml.getElementsByTagName( 'parsererror' )[ 0 ];
<add> if ( parserError !== undefined ) {
<add>
<add> console.error( 'ColladaLoader: Failed to parse collada file.', parserError );
<add> return null;
<add>
<add> }
<add>
<ide> // metadata
<ide>
<ide> var version = collada.getAttribute( 'version' ); | 1 |
PHP | PHP | add more tests | 9f4b0260f322517cbb1ee71ca916e908a9a9ff55 | <ide><path>tests/Database/DatabaseEloquentBuilderTest.php
<ide> public function testHasWithContraintsAndJoinAndHavingInSubquery()
<ide> $this->assertEquals(['baz', 'quuuuuux', 'qux', 'quuux'], $builder->getBindings());
<ide> }
<ide>
<add> public function testHasWithContraintsAndHavingInSubqueryWithCount()
<add> {
<add> $model = new EloquentBuilderTestModelParentStub;
<add>
<add> $builder = $model->where('bar', 'baz');
<add> $builder->whereHas('foo', function ($q) {
<add> $q->having('bam', '>', 'qux');
<add> }, '>=', 2)->where('quux', 'quuux');
<add>
<add> $this->assertEquals('select * from "eloquent_builder_test_model_parent_stubs" where "bar" = ? and (select count(*) from "eloquent_builder_test_model_close_related_stubs" where "eloquent_builder_test_model_parent_stubs"."foo_id" = "eloquent_builder_test_model_close_related_stubs"."id" having "bam" > ?) >= 2 and "quux" = ?', $builder->toSql());
<add> $this->assertEquals(['baz', 'qux', 'quuux'], $builder->getBindings());
<add> }
<add>
<ide> public function testHasNestedWithConstraints()
<ide> {
<ide> $model = new EloquentBuilderTestModelParentStub; | 1 |
Javascript | Javascript | add identitytounicodemap class | 6c8cca1284f061028bc5521b307d662ea831d0f0 | <ide><path>src/core/fonts.js
<ide> var ToUnicodeMap = (function ToUnicodeMapClosure() {
<ide> return ToUnicodeMap;
<ide> })();
<ide>
<add>var IdentityToUnicodeMap = (function IdentityToUnicodeMapClosure() {
<add> function IdentityToUnicodeMap(firstChar, lastChar) {
<add> this.firstChar = firstChar;
<add> this.lastChar = lastChar;
<add> }
<add>
<add> IdentityToUnicodeMap.prototype = {
<add> get length() {
<add> error('should not access .length');
<add> },
<add>
<add> forEach: function(callback) {
<add> for (var i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
<add> callback(i, i);
<add> }
<add> },
<add>
<add> get: function(i) {
<add> if (this.firstChar <= i && i <= this.lastChar) {
<add> return String.fromCharCode(i);
<add> }
<add> return undefined;
<add> },
<add>
<add> charCodeOf: function(v) {
<add> error('should not call .charCodeOf');
<add> }
<add> };
<add>
<add> return IdentityToUnicodeMap;
<add>})();
<add>
<ide> /**
<ide> * 'Font' is the class the outside world should use, it encapsulate all the font
<ide> * decoding logics whatever type it is (assuming the font type is supported).
<ide> var Font = (function FontClosure() {
<ide> }
<ide>
<ide> // The viewer's choice, just use an identity map.
<del> toUnicode = [];
<del> var firstChar = properties.firstChar, lastChar = properties.lastChar;
<del> for (var i = firstChar; i <= lastChar; i++) {
<del> toUnicode[i] = String.fromCharCode(i);
<del> }
<ide> map.isIdentity = true;
<del> map.toUnicode = new ToUnicodeMap(toUnicode);
<add> map.toUnicode =
<add> new IdentityToUnicodeMap(properties.firstChar, properties.lastChar);
<ide> return map;
<ide> },
<ide> | 1 |
Text | Text | add fishrock123 to the tc | 22aafa55971ef762863ec8badcd76228581d40c6 | <ide><path>README.md
<ide> information about the governance of the io.js project, see
<ide> - Release GPG key: DD8F2338BAE7501E3DD5AC78C273792F7D83545D
<ide> * **Thorsten Lorenz** ([@thlorenz](https://github.com/thlorenz)) <[email protected]>
<ide> * **Stephen Belanger** ([@qard](https://github.com/qard)) <[email protected]>
<del>* **Jeremiah Senkpiel** ([@fishrock123](https://github.com/fishrock123)) <[email protected]>
<add>* **Jeremiah Senkpiel** ([@fishrock123](https://github.com/fishrock123)) <[email protected]> (Technical Committee)
<ide> - Release GPG key: FD3A5288F042B6850C66B31F09FE44734EB7990E
<ide> * **Evan Lucas** ([@evanlucas](https://github.com/evanlucas)) <[email protected]>
<ide> * **Brendan Ashworth** ([@brendanashworth](https://github.com/brendanashworth)) <[email protected]> | 1 |
Python | Python | remove legacy code in tf backend | 26e6df8a98670802286978e1657526fe2afa61d5 | <ide><path>keras/backend/tensorflow_backend.py
<ide> def dot(x, y):
<ide> (2, 4, 5)
<ide> ```
<ide> """
<del> if hasattr(tf, 'unstack'):
<del> unstack = tf.unstack
<del> else:
<del> unstack = tf.unpack
<ide> if ndim(x) is not None and (ndim(x) > 2 or ndim(y) > 2):
<ide> x_shape = []
<del> for i, s in zip(int_shape(x), unstack(tf.shape(x))):
<add> for i, s in zip(int_shape(x), tf.unstack(tf.shape(x))):
<ide> if i is not None:
<ide> x_shape.append(i)
<ide> else:
<ide> x_shape.append(s)
<ide> x_shape = tuple(x_shape)
<ide> y_shape = []
<del> for i, s in zip(int_shape(y), unstack(tf.shape(y))):
<add> for i, s in zip(int_shape(y), tf.unstack(tf.shape(y))):
<ide> if i is not None:
<ide> y_shape.append(i)
<ide> else:
<ide> def batch_dot(x, y, axes=None):
<ide> else:
<ide> adj_x = None
<ide> adj_y = None
<del> # TODO: remove later.
<del> if hasattr(tf, 'batch_matmul'):
<del> try:
<del> out = tf.batch_matmul(x, y, adj_a=adj_x, adj_b=adj_y)
<del> except TypeError:
<del> out = tf.batch_matmul(x, y, adj_x=adj_x, adj_y=adj_y)
<del> else:
<del> out = tf.matmul(x, y, adjoint_a=adj_x, adjoint_b=adj_y)
<add> out = tf.matmul(x, y, adjoint_a=adj_x, adjoint_b=adj_y)
<ide> if ndim(out) == 1:
<ide> out = expand_dims(out, 1)
<ide> return out
<ide> def normalize_batch_in_training(x, gamma, beta,
<ide> target_shape.append(1)
<ide> else:
<ide> target_shape.append(tf.shape(x)[axis])
<del> target_shape = stack(target_shape)
<add> target_shape = tf.stack(target_shape)
<ide>
<ide> broadcast_mean = tf.reshape(mean, target_shape)
<ide> broadcast_var = tf.reshape(var, target_shape)
<ide> def repeat(x, n):
<ide> """
<ide> assert ndim(x) == 2
<ide> x = tf.expand_dims(x, 1)
<del> pattern = stack([1, n, 1])
<add> pattern = tf.stack([1, n, 1])
<ide> return tf.tile(x, pattern)
<ide>
<ide>
<ide> def batch_flatten(x):
<ide> # Returns
<ide> A tensor.
<ide> """
<del> x = tf.reshape(x, stack([-1, prod(shape(x)[1:])]))
<add> x = tf.reshape(x, tf.stack([-1, prod(shape(x)[1:])]))
<ide> return x
<ide>
<ide>
<ide> def stack(x):
<ide> # Returns
<ide> A tensor.
<ide> """
<del> try:
<del> return tf.stack(x)
<del> except AttributeError:
<del> return tf.pack(x)
<add> return tf.stack(x)
<ide>
<ide>
<ide> def one_hot(indices, num_classes):
<ide> def rnn(step_function, inputs, initial_states,
<ide> if constants is None:
<ide> constants = []
<ide>
<del> # TODO: remove later.
<del> if hasattr(tf, 'select'):
<del> tf.where = tf.select
<del> if hasattr(tf, 'stack'):
<del> stack = tf.stack
<del> unstack = tf.unstack
<del> else:
<del> stack = tf.pack
<del> unstack = tf.unpack
<del>
<ide> if unroll:
<ide> if not inputs.get_shape()[0]:
<ide> raise ValueError('Unrolling requires a '
<ide> def rnn(step_function, inputs, initial_states,
<ide> successive_states = []
<ide> successive_outputs = []
<ide>
<del> input_list = unstack(inputs)
<add> input_list = tf.unstack(inputs)
<ide> if go_backwards:
<ide> input_list.reverse()
<ide>
<ide> if mask is not None:
<del> mask_list = unstack(mask)
<add> mask_list = tf.unstack(mask)
<ide> if go_backwards:
<ide> mask_list.reverse()
<ide>
<ide> def rnn(step_function, inputs, initial_states,
<ide> # it just repeats the mask along its second dimension
<ide> # n times.
<ide> tiled_mask_t = tf.tile(mask_t,
<del> stack([1, tf.shape(output)[1]]))
<add> tf.stack([1, tf.shape(output)[1]]))
<ide>
<ide> if len(successive_outputs) == 0:
<ide> prev_output = zeros_like(output)
<ide> def rnn(step_function, inputs, initial_states,
<ide> for state, new_state in zip(states, new_states):
<ide> # (see earlier comment for tile explanation)
<ide> tiled_mask_t = tf.tile(mask_t,
<del> stack([1, tf.shape(new_state)[1]]))
<add> tf.stack([1, tf.shape(new_state)[1]]))
<ide> return_states.append(tf.where(tiled_mask_t,
<ide> new_state,
<ide> state))
<ide> def rnn(step_function, inputs, initial_states,
<ide> successive_states.append(states)
<ide> last_output = successive_outputs[-1]
<ide> new_states = successive_states[-1]
<del> outputs = stack(successive_outputs)
<add> outputs = tf.stack(successive_outputs)
<ide> else:
<ide> for input in input_list:
<ide> output, states = step_function(input, states + constants)
<ide> successive_outputs.append(output)
<ide> successive_states.append(states)
<ide> last_output = successive_outputs[-1]
<ide> new_states = successive_states[-1]
<del> outputs = stack(successive_outputs)
<add> outputs = tf.stack(successive_outputs)
<ide>
<ide> else:
<ide> if go_backwards:
<ide> def rnn(step_function, inputs, initial_states,
<ide> dtype=inputs.dtype,
<ide> size=time_steps,
<ide> tensor_array_name='input_ta')
<del> if hasattr(input_ta, 'unstack'):
<del> input_ta = input_ta.unstack(inputs)
<del> else:
<del> input_ta = input_ta.unpack(inputs)
<add> input_ta = input_ta.unstack(inputs)
<ide> time = tf.constant(0, dtype='int32', name='time')
<ide>
<ide> if mask is not None:
<ide> def rnn(step_function, inputs, initial_states,
<ide> dtype=tf.bool,
<ide> size=time_steps,
<ide> tensor_array_name='mask_ta')
<del> if hasattr(mask_ta, 'unstack'):
<del> mask_ta = mask_ta.unstack(mask)
<del> else:
<del> mask_ta = mask_ta.unpack(mask)
<add> mask_ta = mask_ta.unstack(mask)
<ide>
<ide> def _step(time, output_ta_t, *states):
<ide> current_input = input_ta.read(time)
<ide> def _step(time, output_ta_t, *states):
<ide> for state, new_state in zip(states, new_states):
<ide> new_state.set_shape(state.get_shape())
<ide> tiled_mask_t = tf.tile(mask_t,
<del> stack([1, tf.shape(output)[1]]))
<add> tf.stack([1, tf.shape(output)[1]]))
<ide> output = tf.where(tiled_mask_t, output, states[0])
<ide> new_states = [tf.where(tiled_mask_t, new_states[i], states[i]) for i in range(len(states))]
<ide> output_ta_t = output_ta_t.write(time, output)
<ide> def _step(time, output_ta_t, *states):
<ide> output_ta = final_outputs[1]
<ide> new_states = final_outputs[2:]
<ide>
<del> if hasattr(output_ta, 'stack'):
<del> outputs = output_ta.stack()
<del> else:
<del> outputs = output_ta.pack()
<add> outputs = output_ta.stack()
<ide> last_output = output_ta.read(last_time - 1)
<ide>
<ide> axes = [1, 0] + list(range(2, len(outputs.get_shape())))
<ide> def conv2d_transpose(x, kernel, output_shape, strides=(1, 1),
<ide> x = tf.nn.conv2d_transpose(x, kernel, output_shape, strides,
<ide> padding=padding)
<ide> x = _postprocess_conv2d_output(x, data_format)
<del> # TODO: set_shape with static shape
<ide> return x
<ide>
<ide>
<ide> def separable_conv2d(x, depthwise_kernel, pointwise_kernel, strides=(1, 1),
<ide> padding='valid', data_format=None, dilation_rate=(1, 1)):
<del> """2-D convolution with separable filters.
<add> """2D convolution with separable filters.
<ide>
<ide> # Arguments
<del> # TODO
<add> x: input tensor
<add> depthwise_kernel: convolution kernel for the depthwise convolution.
<add> pointwise_kernel: kernel for the 1x1 convolution.
<add> strides: strides tuple (length 2).
<add> padding: padding mode, "valid" or "same".
<add> data_format: data format, "channels_first" or "channels_last".
<add> dilation_rate: tuple of integers,
<add> dilation rates for the separable convolution.
<add>
<add> # Returns
<add> Output tensor.
<ide>
<ide> # Raises
<ide> ValueError: if `data_format` is neither `channels_last` or `channels_first`.
<ide> def ctc_label_dense_to_sparse(labels, label_lengths):
<ide> # undocumented feature soon to be made public
<ide> from tensorflow.python.ops import functional_ops
<ide> label_shape = tf.shape(labels)
<del> num_batches_tns = stack([label_shape[0]])
<del> max_num_labels_tns = stack([label_shape[1]])
<add> num_batches_tns = tf.stack([label_shape[0]])
<add> max_num_labels_tns = tf.stack([label_shape[1]])
<ide>
<ide> def range_less_than(previous_state, current_input):
<ide> return tf.expand_dims(tf.range(label_shape[1]), 0) < tf.fill(max_num_labels_tns, current_input) | 1 |
Ruby | Ruby | convert formula test to spec | b0cd1c732d25b112e75facf48325f7841c8b6ac3 | <ide><path>Library/Homebrew/test/formula_spec.rb
<add>require "test/support/fixtures/testball"
<add>require "formula"
<add>
<add>RSpec::Matchers.alias_matcher :follow_installed_alias, :be_follow_installed_alias
<add>RSpec::Matchers.alias_matcher :have_any_version_installed, :be_any_version_installed
<add>RSpec::Matchers.alias_matcher :need_migration, :be_migration_needed
<add>
<add>RSpec::Matchers.alias_matcher :have_changed_installed_alias_target, :be_installed_alias_target_changed
<add>RSpec::Matchers.alias_matcher :supersede_an_installed_formula, :be_supersedes_an_installed_formula
<add>RSpec::Matchers.alias_matcher :have_changed_alias, :be_alias_changed
<add>
<add>RSpec::Matchers.alias_matcher :have_option_defined, :be_option_defined
<add>RSpec::Matchers.alias_matcher :have_post_install_defined, :be_post_install_defined
<add>RSpec::Matchers.alias_matcher :have_test_defined, :be_test_defined
<add>RSpec::Matchers.alias_matcher :pour_bottle, :be_pour_bottle
<add>
<add>describe Formula do
<add> describe "::new" do
<add> let(:klass) do
<add> Class.new(described_class) do
<add> url "http://example.com/foo-1.0.tar.gz"
<add> end
<add> end
<add>
<add> let(:name) { "formula_name" }
<add> let(:path) { Formulary.core_path(name) }
<add> let(:spec) { :stable }
<add> let(:alias_name) { "baz@1" }
<add> let(:alias_path) { CoreTap.instance.alias_dir/alias_name }
<add> let(:f) { klass.new(name, path, spec) }
<add> let(:f_alias) { klass.new(name, path, spec, alias_path: alias_path) }
<add>
<add> specify "formula instantiation" do
<add> expect(f.name).to eq(name)
<add> expect(f.specified_name).to eq(name)
<add> expect(f.full_name).to eq(name)
<add> expect(f.full_specified_name).to eq(name)
<add> expect(f.path).to eq(path)
<add> expect(f.alias_path).to be nil
<add> expect(f.alias_name).to be nil
<add> expect(f.full_alias_name).to be nil
<add> expect { klass.new }.to raise_error(ArgumentError)
<add> end
<add>
<add> specify "formula instantiation with alias" do
<add> expect(f_alias.name).to eq(name)
<add> expect(f_alias.full_name).to eq(name)
<add> expect(f_alias.path).to eq(path)
<add> expect(f_alias.alias_path).to eq(alias_path)
<add> expect(f_alias.alias_name).to eq(alias_name)
<add> expect(f_alias.specified_name).to eq(alias_name)
<add> expect(f_alias.full_alias_name).to eq(alias_name)
<add> expect(f_alias.full_specified_name).to eq(alias_name)
<add> expect { klass.new }.to raise_error(ArgumentError)
<add> end
<add>
<add> context "in a Tap" do
<add> let(:tap) { Tap.new("foo", "bar") }
<add> let(:path) { (tap.path/"Formula/#{name}.rb") }
<add> let(:full_name) { "#{tap.user}/#{tap.repo}/#{name}" }
<add> let(:full_alias_name) { "#{tap.user}/#{tap.repo}/#{alias_name}" }
<add>
<add> specify "formula instantiation" do
<add> expect(f.name).to eq(name)
<add> expect(f.specified_name).to eq(name)
<add> expect(f.full_name).to eq(full_name)
<add> expect(f.full_specified_name).to eq(full_name)
<add> expect(f.path).to eq(path)
<add> expect(f.alias_path).to be nil
<add> expect(f.alias_name).to be nil
<add> expect(f.full_alias_name).to be nil
<add> expect { klass.new }.to raise_error(ArgumentError)
<add> end
<add>
<add> specify "formula instantiation with alias" do
<add> expect(f_alias.name).to eq(name)
<add> expect(f_alias.full_name).to eq(full_name)
<add> expect(f_alias.path).to eq(path)
<add> expect(f_alias.alias_path).to eq(alias_path)
<add> expect(f_alias.alias_name).to eq(alias_name)
<add> expect(f_alias.specified_name).to eq(alias_name)
<add> expect(f_alias.full_alias_name).to eq(full_alias_name)
<add> expect(f_alias.full_specified_name).to eq(full_alias_name)
<add> expect { klass.new }.to raise_error(ArgumentError)
<add> end
<add> end
<add> end
<add>
<add> describe "#follow_installed_alias?" do
<add> let(:f) do
<add> formula do
<add> url "foo-1.0"
<add> end
<add> end
<add>
<add> it "returns true by default" do
<add> expect(f).to follow_installed_alias
<add> end
<add>
<add> it "can be set to true" do
<add> f.follow_installed_alias = true
<add> expect(f).to follow_installed_alias
<add> end
<add>
<add> it "can be set to false" do
<add> f.follow_installed_alias = false
<add> expect(f).not_to follow_installed_alias
<add> end
<add> end
<add>
<add> example "installed alias with core" do
<add> f = formula do
<add> url "foo-1.0"
<add> end
<add>
<add> build_values_with_no_installed_alias = [
<add> nil,
<add> BuildOptions.new({}, {}),
<add> Tab.new(source: { "path" => f.path.to_s }),
<add> ]
<add> build_values_with_no_installed_alias.each do |build|
<add> f.build = build
<add> expect(f.installed_alias_path).to be nil
<add> expect(f.installed_alias_name).to be nil
<add> expect(f.full_installed_alias_name).to be nil
<add> expect(f.installed_specified_name).to eq(f.name)
<add> expect(f.full_installed_specified_name).to eq(f.name)
<add> end
<add>
<add> alias_name = "bar"
<add> alias_path = "#{CoreTap.instance.alias_dir}/#{alias_name}"
<add>
<add> f.build = Tab.new(source: { "path" => alias_path })
<add>
<add> expect(f.installed_alias_path).to eq(alias_path)
<add> expect(f.installed_alias_name).to eq(alias_name)
<add> expect(f.full_installed_alias_name).to eq(alias_name)
<add> expect(f.installed_specified_name).to eq(alias_name)
<add> expect(f.full_installed_specified_name).to eq(alias_name)
<add> end
<add>
<add> example "installed alias with tap" do
<add> tap = Tap.new("user", "repo")
<add> name = "foo"
<add> path = "#{tap.path}/Formula/#{name}.rb"
<add> f = formula name, path: path do
<add> url "foo-1.0"
<add> end
<add>
<add> build_values_with_no_installed_alias = [nil, BuildOptions.new({}, {}), Tab.new(source: { "path" => f.path })]
<add> build_values_with_no_installed_alias.each do |build|
<add> f.build = build
<add> expect(f.installed_alias_path).to be nil
<add> expect(f.installed_alias_name).to be nil
<add> expect(f.full_installed_alias_name).to be nil
<add> expect(f.installed_specified_name).to eq(f.name)
<add> expect(f.full_installed_specified_name).to eq(f.full_name)
<add> end
<add>
<add> alias_name = "bar"
<add> full_alias_name = "#{tap.user}/#{tap.repo}/#{alias_name}"
<add> alias_path = "#{tap.alias_dir}/#{alias_name}"
<add>
<add> f.build = Tab.new(source: { "path" => alias_path })
<add>
<add> expect(f.installed_alias_path).to eq(alias_path)
<add> expect(f.installed_alias_name).to eq(alias_name)
<add> expect(f.full_installed_alias_name).to eq(full_alias_name)
<add> expect(f.installed_specified_name).to eq(alias_name)
<add> expect(f.full_installed_specified_name).to eq(full_alias_name)
<add> end
<add>
<add> specify "#prefix" do
<add> f = Testball.new
<add> expect(f.prefix).to eq(HOMEBREW_CELLAR/f.name/"0.1")
<add> expect(f.prefix).to be_kind_of(Pathname)
<add> end
<add>
<add> example "revised prefix" do
<add> f = Class.new(Testball) { revision(1) }.new
<add> expect(f.prefix).to eq(HOMEBREW_CELLAR/f.name/"0.1_1")
<add> end
<add>
<add> specify "#any_version_installed?" do
<add> f = formula do
<add> url "foo"
<add> version "1.0"
<add> end
<add>
<add> expect(f).not_to have_any_version_installed
<add>
<add> prefix = HOMEBREW_CELLAR/f.name/"0.1"
<add> prefix.mkpath
<add> FileUtils.touch prefix/Tab::FILENAME
<add>
<add> expect(f).to have_any_version_installed
<add> end
<add>
<add> specify "#migration_needed" do
<add> f = Testball.new("newname")
<add> f.instance_variable_set(:@oldname, "oldname")
<add> f.instance_variable_set(:@tap, CoreTap.instance)
<add>
<add> oldname_prefix = (HOMEBREW_CELLAR/"oldname/2.20")
<add> newname_prefix = (HOMEBREW_CELLAR/"newname/2.10")
<add>
<add> oldname_prefix.mkpath
<add> oldname_tab = Tab.empty
<add> oldname_tab.tabfile = oldname_prefix/Tab::FILENAME
<add> oldname_tab.write
<add>
<add> expect(f).not_to need_migration
<add>
<add> oldname_tab.tabfile.unlink
<add> oldname_tab.source["tap"] = "homebrew/core"
<add> oldname_tab.write
<add>
<add> expect(f).to need_migration
<add>
<add> newname_prefix.mkpath
<add>
<add> expect(f).not_to need_migration
<add> end
<add>
<add> describe "#installed?" do
<add> let(:f) { Testball.new }
<add>
<add> it "returns false if the #installed_prefix is not a directory" do
<add> allow(f).to receive(:installed_prefix).and_return(double(directory?: false))
<add> expect(f).not_to be_installed
<add> end
<add>
<add> it "returns false if the #installed_prefix does not have children" do
<add> allow(f).to receive(:installed_prefix).and_return(double(directory?: true, children: []))
<add> expect(f).not_to be_installed
<add> end
<add>
<add> it "returns true if the #installed_prefix has children" do
<add> allow(f).to receive(:installed_prefix).and_return(double(directory?: true, children: [double]))
<add> expect(f).to be_installed
<add> end
<add> end
<add>
<add> describe "#installed prefix" do
<add> let(:f) do
<add> formula do
<add> url "foo"
<add> version "1.9"
<add>
<add> head "foo"
<add>
<add> devel do
<add> url "foo"
<add> version "2.1-devel"
<add> end
<add> end
<add> end
<add>
<add> let(:stable_prefix) { HOMEBREW_CELLAR/f.name/f.version }
<add> let(:devel_prefix) { HOMEBREW_CELLAR/f.name/f.devel.version }
<add> let(:head_prefix) { HOMEBREW_CELLAR/f.name/f.head.version }
<add>
<add> it "is the same as #prefix by default" do
<add> expect(f.installed_prefix).to eq(f.prefix)
<add> end
<add>
<add> it "returns the stable prefix if it is installed" do
<add> stable_prefix.mkpath
<add> expect(f.installed_prefix).to eq(stable_prefix)
<add> end
<add>
<add> it "returns the devel prefix if it is installed" do
<add> devel_prefix.mkpath
<add> expect(f.installed_prefix).to eq(devel_prefix)
<add> end
<add>
<add> it "returns the head prefix if it is installed" do
<add> head_prefix.mkpath
<add> expect(f.installed_prefix).to eq(head_prefix)
<add> end
<add>
<add> it "returns the stable prefix if head is outdated" do
<add> head_prefix.mkpath
<add>
<add> tab = Tab.empty
<add> tab.tabfile = head_prefix/Tab::FILENAME
<add> tab.source["versions"] = { "stable" => "1.0" }
<add> tab.write
<add>
<add> expect(f.installed_prefix).to eq(stable_prefix)
<add> end
<add>
<add> it "returns the stable prefix if head and devel are outdated" do
<add> head_prefix.mkpath
<add>
<add> tab = Tab.empty
<add> tab.tabfile = head_prefix/Tab::FILENAME
<add> tab.source["versions"] = { "stable" => "1.9", "devel" => "2.0" }
<add> tab.write
<add>
<add> expect(f.installed_prefix).to eq(stable_prefix)
<add> end
<add>
<add> it "returns the devel prefix if the active specification is :devel" do
<add> f.active_spec = :devel
<add> expect(f.installed_prefix).to eq(devel_prefix)
<add> end
<add>
<add> it "returns the head prefix if the active specification is :head" do
<add> f.active_spec = :head
<add> expect(f.installed_prefix).to eq(head_prefix)
<add> end
<add> end
<add>
<add> describe "#latest_head_prefix" do
<add> let(:f) { Testball.new }
<add>
<add> it "returns the latest head prefix" do
<add> stamps_with_revisions = [
<add> [111111, 1],
<add> [222222, 0],
<add> [222222, 1],
<add> [222222, 2],
<add> ]
<add>
<add> stamps_with_revisions.each do |stamp, revision|
<add> version = "HEAD-#{stamp}"
<add> version << "_#{revision}" unless revision.zero?
<add>
<add> prefix = f.rack/version
<add> prefix.mkpath
<add>
<add> tab = Tab.empty
<add> tab.tabfile = prefix/Tab::FILENAME
<add> tab.source_modified_time = stamp
<add> tab.write
<add> end
<add>
<add> prefix = HOMEBREW_CELLAR/f.name/"HEAD-222222_2"
<add>
<add> expect(f.latest_head_prefix).to eq(prefix)
<add> end
<add> end
<add>
<add> specify "equality" do
<add> x = Testball.new
<add> y = Testball.new
<add>
<add> expect(x).to eq(y)
<add> expect(x).to eql(y)
<add> expect(x.hash).to eq(y.hash)
<add> end
<add>
<add> specify "inequality" do
<add> x = Testball.new("foo")
<add> y = Testball.new("bar")
<add>
<add> expect(x).not_to eq(y)
<add> expect(x).not_to eql(y)
<add> expect(x.hash).not_to eq(y.hash)
<add> end
<add>
<add> specify "comparison with non formula objects does not raise" do
<add> expect(Object.new).not_to eq(Testball.new)
<add> end
<add>
<add> specify "#<=>" do
<add> expect(Testball.new <=> Object.new).to be nil
<add> end
<add>
<add> describe "#installed_alias_path" do
<add> example "alias paths with build options" do
<add> alias_path = (CoreTap.instance.alias_dir/"another_name")
<add>
<add> f = formula alias_path: alias_path do
<add> url "foo-1.0"
<add> end
<add> f.build = BuildOptions.new({}, {})
<add>
<add> expect(f.alias_path).to eq(alias_path)
<add> expect(f.installed_alias_path).to be nil
<add> end
<add>
<add> example "alias paths with tab with non alias source path" do
<add> alias_path = (CoreTap.instance.alias_dir/"another_name")
<add> source_path = (CoreTap.instance.formula_dir/"another_other_name")
<add>
<add> f = formula alias_path: alias_path do
<add> url "foo-1.0"
<add> end
<add> f.build = Tab.new(source: { "path" => source_path.to_s })
<add>
<add> expect(f.alias_path).to eq(alias_path)
<add> expect(f.installed_alias_path).to be nil
<add> end
<add>
<add> example "alias paths with tab with alias source path" do
<add> alias_path = (CoreTap.instance.alias_dir/"another_name")
<add> source_path = (CoreTap.instance.alias_dir/"another_other_name")
<add>
<add> f = formula alias_path: alias_path do
<add> url "foo-1.0"
<add> end
<add> f.build = Tab.new(source: { "path" => source_path.to_s })
<add>
<add> expect(f.alias_path).to eq(alias_path)
<add> expect(f.installed_alias_path).to eq(source_path.to_s)
<add> end
<add> end
<add>
<add> describe "::installed_with_alias_path" do
<add> specify "with alias path with nil" do
<add> expect(described_class.installed_with_alias_path(nil)).to be_empty
<add> end
<add>
<add> specify "with alias path with a path" do
<add> alias_path = "#{CoreTap.instance.alias_dir}/alias"
<add> different_alias_path = "#{CoreTap.instance.alias_dir}/another_alias"
<add>
<add> formula_with_alias = formula "foo" do
<add> url "foo-1.0"
<add> end
<add> formula_with_alias.build = Tab.empty
<add> formula_with_alias.build.source["path"] = alias_path
<add>
<add> formula_without_alias = formula "bar" do
<add> url "bar-1.0"
<add> end
<add> formula_without_alias.build = Tab.empty
<add> formula_without_alias.build.source["path"] = formula_without_alias.path.to_s
<add>
<add> formula_with_different_alias = formula "baz" do
<add> url "baz-1.0"
<add> end
<add> formula_with_different_alias.build = Tab.empty
<add> formula_with_different_alias.build.source["path"] = different_alias_path
<add>
<add> formulae = [
<add> formula_with_alias,
<add> formula_without_alias,
<add> formula_with_different_alias,
<add> ]
<add>
<add> allow(described_class).to receive(:installed).and_return(formulae)
<add>
<add> expect(described_class.installed_with_alias_path(alias_path))
<add> .to eq([formula_with_alias])
<add> end
<add> end
<add>
<add> specify "spec integration" do
<add> f = formula do
<add> homepage "http://example.com"
<add>
<add> url "http://example.com/test-0.1.tbz"
<add> mirror "http://example.org/test-0.1.tbz"
<add> sha256 TEST_SHA256
<add>
<add> head "http://example.com/test.git", tag: "foo"
<add>
<add> devel do
<add> url "http://example.com/test-0.2.tbz"
<add> mirror "http://example.org/test-0.2.tbz"
<add> sha256 TEST_SHA256
<add> end
<add> end
<add>
<add> expect(f.homepage).to eq("http://example.com")
<add> expect(f.version).to eq(Version.create("0.1"))
<add> expect(f).to be_stable
<add> expect(f.stable.version).to eq(Version.create("0.1"))
<add> expect(f.devel.version).to eq(Version.create("0.2"))
<add> expect(f.head.version).to eq(Version.create("HEAD"))
<add> end
<add>
<add> specify "#active_spec=" do
<add> f = formula do
<add> url "foo"
<add> version "1.0"
<add> revision 1
<add>
<add> devel do
<add> url "foo"
<add> version "1.0beta"
<add> end
<add> end
<add>
<add> expect(f.active_spec_sym).to eq(:stable)
<add> expect(f.send(:active_spec)).to eq(f.stable)
<add> expect(f.pkg_version.to_s).to eq("1.0_1")
<add>
<add> f.active_spec = :devel
<add>
<add> expect(f.active_spec_sym).to eq(:devel)
<add> expect(f.send(:active_spec)).to eq(f.devel)
<add> expect(f.pkg_version.to_s).to eq("1.0beta_1")
<add> expect { f.active_spec = :head }.to raise_error(FormulaSpecificationError)
<add> end
<add>
<add> specify "class specs are always initialized" do
<add> f = formula do
<add> url "foo-1.0"
<add> end
<add>
<add> expect(f.class.stable).to be_kind_of(SoftwareSpec)
<add> expect(f.class.devel).to be_kind_of(SoftwareSpec)
<add> expect(f.class.head).to be_kind_of(SoftwareSpec)
<add> end
<add>
<add> specify "incomplete instance specs are not accessible" do
<add> f = formula do
<add> url "foo-1.0"
<add> end
<add>
<add> expect(f.devel).to be nil
<add> expect(f.head).to be nil
<add> end
<add>
<add> it "honors attributes declared before specs" do
<add> f = formula do
<add> url "foo-1.0"
<add>
<add> depends_on "foo"
<add>
<add> devel do
<add> url "foo-1.1"
<add> end
<add> end
<add>
<add> expect(f.class.stable.deps.first.name).to eq("foo")
<add> expect(f.class.devel.deps.first.name).to eq("foo")
<add> expect(f.class.head.deps.first.name).to eq("foo")
<add> end
<add>
<add> describe "#pkg_version" do
<add> specify "simple version" do
<add> f = formula do
<add> url "foo-1.0.bar"
<add> end
<add>
<add> expect(f.pkg_version).to eq(PkgVersion.parse("1.0"))
<add> end
<add>
<add> specify "version with revision" do
<add> f = formula do
<add> url "foo-1.0.bar"
<add> revision 1
<add> end
<add>
<add> expect(f.pkg_version).to eq(PkgVersion.parse("1.0_1"))
<add> end
<add>
<add> specify "head uses revisions" do
<add> f = formula "test", spec: :head do
<add> url "foo-1.0.bar"
<add> revision 1
<add>
<add> head "foo"
<add> end
<add>
<add> expect(f.pkg_version).to eq(PkgVersion.parse("HEAD_1"))
<add> end
<add> end
<add>
<add> specify "#update_head_version" do
<add> f = formula do
<add> head "foo", using: :git
<add> end
<add>
<add> cached_location = f.head.downloader.cached_location
<add> cached_location.mkpath
<add> cached_location.cd do
<add> FileUtils.touch "LICENSE"
<add>
<add> shutup do
<add> system("git", "init")
<add> system("git", "add", "--all")
<add> system("git", "commit", "-m", "Initial commit")
<add> end
<add> end
<add>
<add> f.update_head_version
<add>
<add> expect(f.head.version).to eq(Version.create("HEAD-5658946"))
<add> end
<add>
<add> specify "legacy options" do
<add> f = formula do
<add> url "foo-1.0"
<add>
<add> def options
<add> [
<add> ["--foo", "desc"],
<add> ["--bar", "desc"],
<add> ]
<add> end
<add>
<add> option("baz")
<add> end
<add>
<add> expect(f).to have_option_defined("foo")
<add> expect(f).to have_option_defined("bar")
<add> expect(f).to have_option_defined("baz")
<add> end
<add>
<add> specify "#desc" do
<add> f = formula do
<add> desc "a formula"
<add>
<add> url "foo-1.0"
<add> end
<add>
<add> expect(f.desc).to eq("a formula")
<add> end
<add>
<add> specify "#post_install_defined?" do
<add> f1 = formula do
<add> url "foo-1.0"
<add>
<add> def post_install
<add> # do nothing
<add> end
<add> end
<add>
<add> f2 = formula do
<add> url "foo-1.0"
<add> end
<add>
<add> expect(f1).to have_post_install_defined
<add> expect(f2).not_to have_post_install_defined
<add> end
<add>
<add> specify "#test_defined?" do
<add> f1 = formula do
<add> url "foo-1.0"
<add>
<add> def test
<add> # do nothing
<add> end
<add> end
<add>
<add> f2 = formula do
<add> url "foo-1.0"
<add> end
<add>
<add> expect(f1).to have_test_defined
<add> expect(f2).not_to have_test_defined
<add> end
<add>
<add> specify "test fixtures" do
<add> f1 = formula do
<add> url "foo-1.0"
<add> end
<add>
<add> expect(f1.test_fixtures("foo")).to eq(Pathname.new("#{HOMEBREW_LIBRARY_PATH}/test/support/fixtures/foo"))
<add> end
<add>
<add> specify "dependencies" do
<add> f1 = formula "f1" do
<add> url "f1-1.0"
<add> end
<add>
<add> f2 = formula "f2" do
<add> url "f2-1.0"
<add> end
<add>
<add> f3 = formula "f3" do
<add> url "f3-1.0"
<add>
<add> depends_on "f1" => :build
<add> depends_on "f2"
<add> end
<add>
<add> f4 = formula "f4" do
<add> url "f4-1.0"
<add>
<add> depends_on "f1"
<add> end
<add>
<add> stub_formula_loader(f1)
<add> stub_formula_loader(f2)
<add> stub_formula_loader(f3)
<add> stub_formula_loader(f4)
<add>
<add> f5 = formula "f5" do
<add> url "f5-1.0"
<add>
<add> depends_on "f3" => :build
<add> depends_on "f4"
<add> end
<add>
<add> expect(f5.deps.map(&:name)).to eq(["f3", "f4"])
<add> expect(f5.recursive_dependencies.map(&:name)).to eq(["f1", "f2", "f3", "f4"])
<add> expect(f5.runtime_dependencies.map(&:name)).to eq(["f1", "f4"])
<add> end
<add>
<add> specify "runtime dependencies with optional deps from tap" do
<add> tap_loader = double
<add>
<add> allow(tap_loader).to receive(:get_formula).and_raise(RuntimeError, "tried resolving tap formula")
<add> allow(Formulary).to receive(:loader_for).with("foo/bar/f1", from: nil).and_return(tap_loader)
<add> stub_formula_loader(formula("f2") { url("f2-1.0") }, "baz/qux/f2")
<add>
<add> f3 = formula "f3" do
<add> url "f3-1.0"
<add>
<add> depends_on "foo/bar/f1" => :optional
<add> depends_on "baz/qux/f2"
<add> end
<add>
<add> expect(f3.runtime_dependencies.map(&:name)).to eq(["baz/qux/f2"])
<add>
<add> stub_formula_loader(formula("f1") { url("f1-1.0") }, "foo/bar/f1")
<add> f3.build = BuildOptions.new(Options.create(["--with-f1"]), f3.options)
<add>
<add> expect(f3.runtime_dependencies.map(&:name)).to eq(["foo/bar/f1", "baz/qux/f2"])
<add> end
<add>
<add> specify "requirements" do
<add> f1 = formula "f1" do
<add> url "f1-1"
<add>
<add> depends_on :python
<add> depends_on x11: :recommended
<add> depends_on xcode: ["1.0", :optional]
<add> end
<add> stub_formula_loader(f1)
<add>
<add> python = PythonRequirement.new
<add> x11 = X11Requirement.new("x11", [:recommended])
<add> xcode = XcodeRequirement.new(["1.0", :optional])
<add>
<add> expect(Set.new(f1.recursive_requirements)).to eq(Set[python, x11])
<add>
<add> f1.build = BuildOptions.new(["--with-xcode", "--without-x11"], f1.options)
<add>
<add> expect(Set.new(f1.recursive_requirements)).to eq(Set[python, xcode])
<add>
<add> f1.build = f1.stable.build
<add> f2 = formula "f2" do
<add> url "f2-1"
<add>
<add> depends_on "f1"
<add> end
<add>
<add> expect(Set.new(f2.recursive_requirements)).to eq(Set[python, x11])
<add> expect(Set.new(f2.recursive_requirements {})).to eq(Set[python, x11, xcode])
<add>
<add> requirements = f2.recursive_requirements do |_dependent, requirement|
<add> Requirement.prune if requirement.is_a?(PythonRequirement)
<add> end
<add>
<add> expect(Set.new(requirements)).to eq(Set[x11, xcode])
<add> end
<add>
<add> specify "#to_hash" do
<add> f1 = formula "foo" do
<add> url "foo-1.0"
<add>
<add> bottle do
<add> cellar(:any)
<add> sha256(TEST_SHA256 => Utils::Bottles.tag)
<add> end
<add> end
<add>
<add> h = f1.to_hash
<add>
<add> expect(h).to be_a(Hash)
<add> expect(h["name"]).to eq("foo")
<add> expect(h["full_name"]).to eq("foo")
<add> expect(h["versions"]["stable"]).to eq("1.0")
<add> expect(h["versions"]["bottle"]).to be_truthy
<add> end
<add>
<add> describe "#eligible_kegs_for_cleanup" do
<add> it "returns Kegs eligible for cleanup" do
<add> f1 = Class.new(Testball) do
<add> version("1.0")
<add> end.new
<add>
<add> f2 = Class.new(Testball) do
<add> version("0.2")
<add> version_scheme(1)
<add> end.new
<add>
<add> f3 = Class.new(Testball) do
<add> version("0.3")
<add> version_scheme(1)
<add> end.new
<add>
<add> f4 = Class.new(Testball) do
<add> version("0.1")
<add> version_scheme(2)
<add> end.new
<add>
<add> shutup do
<add> [f1, f2, f3, f4].each do |f|
<add> f.brew { f.install }
<add> Tab.create(f, DevelopmentTools.default_compiler, :libcxx).write
<add> end
<add> end
<add>
<add> expect(f1).to be_installed
<add> expect(f2).to be_installed
<add> expect(f3).to be_installed
<add> expect(f4).to be_installed
<add> expect(f3.eligible_kegs_for_cleanup.sort_by(&:version))
<add> .to eq([f2, f1].map { |f| Keg.new(f.prefix) })
<add> end
<add>
<add> specify "with pinned Keg" do
<add> f1 = Class.new(Testball) { version("0.1") }.new
<add> f2 = Class.new(Testball) { version("0.2") }.new
<add> f3 = Class.new(Testball) { version("0.3") }.new
<add>
<add> shutup do
<add> f1.brew { f1.install }
<add> f1.pin
<add> f2.brew { f2.install }
<add> f3.brew { f3.install }
<add> end
<add>
<add> expect(f1.prefix).to eq((HOMEBREW_PINNED_KEGS/f1.name).resolved_path)
<add> expect(f1).to be_installed
<add> expect(f2).to be_installed
<add> expect(f3).to be_installed
<add> expect(shutup { f3.eligible_kegs_for_cleanup }).to eq([Keg.new(f2.prefix)])
<add> end
<add>
<add> specify "with HEAD installed" do
<add> f = formula do
<add> version("0.1")
<add> head("foo")
<add> end
<add>
<add> stable_prefix = f.installed_prefix
<add> stable_prefix.mkpath
<add>
<add> [["000000_1", 1], ["111111", 2], ["111111_1", 2]].each do |pkg_version_suffix, stamp|
<add> prefix = f.prefix("HEAD-#{pkg_version_suffix}")
<add> prefix.mkpath
<add> tab = Tab.empty
<add> tab.tabfile = prefix/Tab::FILENAME
<add> tab.source_modified_time = stamp
<add> tab.write
<add> end
<add>
<add> eligible_kegs = f.installed_kegs - [Keg.new(f.prefix("HEAD-111111_1"))]
<add> expect(f.eligible_kegs_for_cleanup).to eq(eligible_kegs)
<add> end
<add> end
<add>
<add> describe "#pour_bottle?" do
<add> it "returns false if set to false" do
<add> f = formula "foo" do
<add> url "foo-1.0"
<add>
<add> def pour_bottle?
<add> false
<add> end
<add> end
<add>
<add> expect(f).not_to pour_bottle
<add> end
<add>
<add> it "returns true if set to true" do
<add> f = formula "foo" do
<add> url "foo-1.0"
<add>
<add> def pour_bottle?
<add> true
<add> end
<add> end
<add>
<add> expect(f).to pour_bottle
<add> end
<add>
<add> it "returns false if set to false via DSL" do
<add> f = formula "foo" do
<add> url "foo-1.0"
<add>
<add> pour_bottle? do
<add> reason "false reason"
<add> satisfy { (var == etc) }
<add> end
<add> end
<add>
<add> expect(f).not_to pour_bottle
<add> end
<add>
<add> it "returns true if set to true via DSL" do
<add> f = formula "foo" do
<add> url "foo-1.0"
<add>
<add> pour_bottle? do
<add> reason "true reason"
<add> satisfy { true }
<add> end
<add> end
<add>
<add> expect(f).to pour_bottle
<add> end
<add> end
<add>
<add> describe "alias changes" do
<add> let(:f) do
<add> formula "formula_name", alias_path: alias_path do
<add> url "foo-1.0"
<add> end
<add> end
<add>
<add> let(:new_formula) do
<add> formula "new_formula_name", alias_path: alias_path do
<add> url "foo-1.1"
<add> end
<add> end
<add>
<add> let(:tab) { Tab.empty }
<add> let(:alias_path) { "#{CoreTap.instance.alias_dir}/bar" }
<add>
<add> before(:each) do
<add> allow(described_class).to receive(:installed).and_return([f])
<add>
<add> f.build = tab
<add> new_formula.build = tab
<add> end
<add>
<add> specify "alias changes when not installed with alias" do
<add> tab.source["path"] = Formulary.core_path(f.name).to_s
<add>
<add> expect(f.current_installed_alias_target).to be nil
<add> expect(f.latest_formula).to eq(f)
<add> expect(f).not_to have_changed_installed_alias_target
<add> expect(f).not_to supersede_an_installed_formula
<add> expect(f).not_to have_changed_alias
<add> expect(f.old_installed_formulae).to be_empty
<add> end
<add>
<add> specify "alias changes when not changed" do
<add> tab.source["path"] = alias_path
<add> stub_formula_loader(f, alias_path)
<add>
<add> expect(f.current_installed_alias_target).to eq(f)
<add> expect(f.latest_formula).to eq(f)
<add> expect(f).not_to have_changed_installed_alias_target
<add> expect(f).not_to supersede_an_installed_formula
<add> expect(f).not_to have_changed_alias
<add> expect(f.old_installed_formulae).to be_empty
<add> end
<add>
<add> specify "alias changes when new alias target" do
<add> tab.source["path"] = alias_path
<add> stub_formula_loader(new_formula, alias_path)
<add>
<add> expect(f.current_installed_alias_target).to eq(new_formula)
<add> expect(f.latest_formula).to eq(new_formula)
<add> expect(f).to have_changed_installed_alias_target
<add> expect(f).not_to supersede_an_installed_formula
<add> expect(f).to have_changed_alias
<add> expect(f.old_installed_formulae).to be_empty
<add> end
<add>
<add> specify "alias changes when old formulae installed" do
<add> tab.source["path"] = alias_path
<add> stub_formula_loader(new_formula, alias_path)
<add>
<add> expect(new_formula.current_installed_alias_target).to eq(new_formula)
<add> expect(new_formula.latest_formula).to eq(new_formula)
<add> expect(new_formula).not_to have_changed_installed_alias_target
<add> expect(new_formula).to supersede_an_installed_formula
<add> expect(new_formula).to have_changed_alias
<add> expect(new_formula.old_installed_formulae).to eq([f])
<add> end
<add> end
<add>
<add> describe "#outdated_kegs" do
<add> let(:outdated_prefix) { (HOMEBREW_CELLAR/"#{f.name}/1.11") }
<add> let(:same_prefix) { (HOMEBREW_CELLAR/"#{f.name}/1.20") }
<add> let(:greater_prefix) { (HOMEBREW_CELLAR/"#{f.name}/1.21") }
<add> let(:head_prefix) { (HOMEBREW_CELLAR/"#{f.name}/HEAD") }
<add> let(:old_alias_target_prefix) { (HOMEBREW_CELLAR/"#{old_formula.name}/1.0") }
<add>
<add> let(:f) do
<add> formula do
<add> url "foo"
<add> version "1.20"
<add> end
<add> end
<add>
<add> let(:old_formula) do
<add> formula "foo@1" do
<add> url "foo-1.0"
<add> end
<add> end
<add>
<add> let(:new_formula) do
<add> formula "foo@2" do
<add> url "foo-2.0"
<add> end
<add> end
<add>
<add> let(:alias_path) { "#{f.tap.alias_dir}/bar" }
<add>
<add> def setup_tab_for_prefix(prefix, options = {})
<add> prefix.mkpath
<add> tab = Tab.empty
<add> tab.tabfile = prefix/Tab::FILENAME
<add> tab.source["path"] = options[:path].to_s if options[:path]
<add> tab.source["tap"] = options[:tap] if options[:tap]
<add> tab.source["versions"] = options[:versions] if options[:versions]
<add> tab.source_modified_time = options[:source_modified_time].to_i
<add> tab.write unless options[:no_write]
<add> tab
<add> end
<add>
<add> def reset_outdated_kegs
<add> f.instance_variable_set(:@outdated_kegs, nil)
<add> end
<add>
<add> example "greater different tap installed" do
<add> setup_tab_for_prefix(greater_prefix, tap: "user/repo")
<add> expect(f.outdated_kegs).to be_empty
<add> end
<add>
<add> example "greater same tap installed" do
<add> f.instance_variable_set(:@tap, CoreTap.instance)
<add> setup_tab_for_prefix(greater_prefix, tap: "homebrew/core")
<add> expect(f.outdated_kegs).to be_empty
<add> end
<add>
<add> example "outdated different tap installed" do
<add> setup_tab_for_prefix(outdated_prefix, tap: "user/repo")
<add> expect(f.outdated_kegs).not_to be_empty
<add> end
<add>
<add> example "outdated same tap installed" do
<add> f.instance_variable_set(:@tap, CoreTap.instance)
<add> setup_tab_for_prefix(outdated_prefix, tap: "homebrew/core")
<add> expect(f.outdated_kegs).not_to be_empty
<add> end
<add>
<add> example "outdated follow alias and alias unchanged" do
<add> f.follow_installed_alias = true
<add> f.build = setup_tab_for_prefix(same_prefix, path: alias_path)
<add> stub_formula_loader(f, alias_path)
<add> expect(f.outdated_kegs).to be_empty
<add> end
<add>
<add> example "outdated follow alias and alias changed and new target not installed" do
<add> f.follow_installed_alias = true
<add> f.build = setup_tab_for_prefix(same_prefix, path: alias_path)
<add> stub_formula_loader(new_formula, alias_path)
<add> expect(f.outdated_kegs).not_to be_empty
<add> end
<add>
<add> example "outdated follow alias and alias changed and new target installed" do
<add> f.follow_installed_alias = true
<add> f.build = setup_tab_for_prefix(same_prefix, path: alias_path)
<add> stub_formula_loader(new_formula, alias_path)
<add> setup_tab_for_prefix(new_formula.prefix)
<add> expect(f.outdated_kegs).to be_empty
<add> end
<add>
<add> example "outdated no follow alias and alias unchanged" do
<add> f.follow_installed_alias = false
<add> f.build = setup_tab_for_prefix(same_prefix, path: alias_path)
<add> stub_formula_loader(f, alias_path)
<add> expect(f.outdated_kegs).to be_empty
<add> end
<add>
<add> example "outdated no follow alias and alias changed" do
<add> f.follow_installed_alias = false
<add> f.build = setup_tab_for_prefix(same_prefix, path: alias_path)
<add>
<add> f2 = formula "foo@2" do
<add> url "foo-2.0"
<add> end
<add>
<add> stub_formula_loader(f2, alias_path)
<add> expect(f.outdated_kegs).to be_empty
<add> end
<add>
<add> example "outdated old alias targets installed" do
<add> f = formula alias_path: alias_path do
<add> url "foo-1.0"
<add> end
<add>
<add> tab = setup_tab_for_prefix(old_alias_target_prefix, path: alias_path)
<add> old_formula.build = tab
<add> allow(described_class).to receive(:installed).and_return([old_formula])
<add> expect(f.outdated_kegs).not_to be_empty
<add> end
<add>
<add> example "outdated old alias targets not installed" do
<add> f = formula alias_path: alias_path do
<add> url "foo-1.0"
<add> end
<add>
<add> tab = setup_tab_for_prefix(old_alias_target_prefix, path: old_formula.path)
<add> old_formula.build = tab
<add> allow(described_class).to receive(:installed).and_return([old_formula])
<add> expect(f.outdated_kegs).to be_empty
<add> end
<add>
<add> example "outdated same head installed" do
<add> f.instance_variable_set(:@tap, CoreTap.instance)
<add> setup_tab_for_prefix(head_prefix, tap: "homebrew/core")
<add> expect(f.outdated_kegs).to be_empty
<add> end
<add>
<add> example "outdated different head installed" do
<add> f.instance_variable_set(:@tap, CoreTap.instance)
<add> setup_tab_for_prefix(head_prefix, tap: "user/repo")
<add> expect(f.outdated_kegs).to be_empty
<add> end
<add>
<add> example "outdated mixed taps greater version installed" do
<add> f.instance_variable_set(:@tap, CoreTap.instance)
<add> setup_tab_for_prefix(outdated_prefix, tap: "homebrew/core")
<add> setup_tab_for_prefix(greater_prefix, tap: "user/repo")
<add>
<add> expect(f.outdated_kegs).to be_empty
<add>
<add> setup_tab_for_prefix(greater_prefix, tap: "homebrew/core")
<add> reset_outdated_kegs
<add>
<add> expect(f.outdated_kegs).to be_empty
<add> end
<add>
<add> example "outdated mixed taps outdated version installed" do
<add> f.instance_variable_set(:@tap, CoreTap.instance)
<add>
<add> extra_outdated_prefix = HOMEBREW_CELLAR/f.name/"1.0"
<add>
<add> setup_tab_for_prefix(outdated_prefix)
<add> setup_tab_for_prefix(extra_outdated_prefix, tap: "homebrew/core")
<add> reset_outdated_kegs
<add>
<add> expect(f.outdated_kegs).not_to be_empty
<add>
<add> setup_tab_for_prefix(outdated_prefix, tap: "user/repo")
<add> reset_outdated_kegs
<add>
<add> expect(f.outdated_kegs).not_to be_empty
<add> end
<add>
<add> example "outdated same version tap installed" do
<add> f.instance_variable_set(:@tap, CoreTap.instance)
<add> setup_tab_for_prefix(same_prefix, tap: "homebrew/core")
<add>
<add> expect(f.outdated_kegs).to be_empty
<add>
<add> setup_tab_for_prefix(same_prefix, tap: "user/repo")
<add> reset_outdated_kegs
<add>
<add> expect(f.outdated_kegs).to be_empty
<add> end
<add>
<add> example "outdated installed head less than stable" do
<add> tab = setup_tab_for_prefix(head_prefix, versions: { "stable" => "1.0" })
<add>
<add> expect(f.outdated_kegs).not_to be_empty
<add>
<add> tab.source["versions"] = { "stable" => f.version.to_s }
<add> tab.write
<add> reset_outdated_kegs
<add>
<add> expect(f.outdated_kegs).to be_empty
<add> end
<add>
<add> describe ":fetch_head" do
<add> let(:f) do
<add> repo = testball_repo
<add> formula "testball" do
<add> url "foo"
<add> version "2.10"
<add> head "file://#{repo}", using: :git
<add> end
<add> end
<add> let(:testball_repo) { HOMEBREW_PREFIX/"testball_repo" }
<add>
<add> example do
<add> begin
<add> outdated_stable_prefix = HOMEBREW_CELLAR/"testball/1.0"
<add> head_prefix_a = HOMEBREW_CELLAR/"testball/HEAD"
<add> head_prefix_b = HOMEBREW_CELLAR/"testball/HEAD-aaaaaaa_1"
<add> head_prefix_c = HOMEBREW_CELLAR/"testball/HEAD-18a7103"
<add>
<add> setup_tab_for_prefix(outdated_stable_prefix)
<add> tab_a = setup_tab_for_prefix(head_prefix_a, versions: { "stable" => "1.0" })
<add> setup_tab_for_prefix(head_prefix_b)
<add>
<add> testball_repo.mkdir
<add> testball_repo.cd do
<add> FileUtils.touch "LICENSE"
<add>
<add> shutup do
<add> system("git", "init")
<add> system("git", "add", "--all")
<add> system("git", "commit", "-m", "Initial commit")
<add> end
<add> end
<add>
<add> expect(f.outdated_kegs(fetch_head: true)).not_to be_empty
<add>
<add> tab_a.source["versions"] = { "stable" => f.version.to_s }
<add> tab_a.write
<add> reset_outdated_kegs
<add> expect(f.outdated_kegs(fetch_head: true)).not_to be_empty
<add>
<add> head_prefix_a.rmtree
<add> reset_outdated_kegs
<add> expect(f.outdated_kegs(fetch_head: true)).not_to be_empty
<add>
<add> setup_tab_for_prefix(head_prefix_c, source_modified_time: 1)
<add> reset_outdated_kegs
<add> expect(f.outdated_kegs(fetch_head: true)).to be_empty
<add> ensure
<add> testball_repo.rmtree if testball_repo.exist?
<add> end
<add> end
<add> end
<add>
<add> describe "with changed version scheme" do
<add> let(:f) do
<add> formula "testball" do
<add> url "foo"
<add> version "20141010"
<add> version_scheme 1
<add> end
<add> end
<add>
<add> example do
<add> prefix = HOMEBREW_CELLAR/"testball/0.1"
<add> setup_tab_for_prefix(prefix, versions: { "stable" => "0.1" })
<add>
<add> expect(f.outdated_kegs).not_to be_empty
<add> end
<add> end
<add>
<add> describe "with mixed version schemes" do
<add> let(:f) do
<add> formula "testball" do
<add> url "foo"
<add> version "20141010"
<add> version_scheme 3
<add> end
<add> end
<add>
<add> example do
<add> prefix_a = HOMEBREW_CELLAR/"testball/20141009"
<add> setup_tab_for_prefix(prefix_a, versions: { "stable" => "20141009", "version_scheme" => 1 })
<add>
<add> prefix_b = HOMEBREW_CELLAR/"testball/2.14"
<add> setup_tab_for_prefix(prefix_b, versions: { "stable" => "2.14", "version_scheme" => 2 })
<add>
<add> expect(f.outdated_kegs).not_to be_empty
<add> reset_outdated_kegs
<add>
<add> prefix_c = HOMEBREW_CELLAR/"testball/20141009"
<add> setup_tab_for_prefix(prefix_c, versions: { "stable" => "20141009", "version_scheme" => 3 })
<add>
<add> expect(f.outdated_kegs).not_to be_empty
<add> reset_outdated_kegs
<add>
<add> prefix_d = HOMEBREW_CELLAR/"testball/20141011"
<add> setup_tab_for_prefix(prefix_d, versions: { "stable" => "20141009", "version_scheme" => 3 })
<add> expect(f.outdated_kegs).to be_empty
<add> end
<add> end
<add>
<add> describe "with version scheme" do
<add> let(:f) do
<add> formula "testball" do
<add> url "foo"
<add> version "1.0"
<add> version_scheme 2
<add> end
<add> end
<add>
<add> example do
<add> head_prefix = HOMEBREW_CELLAR/"testball/HEAD"
<add>
<add> setup_tab_for_prefix(head_prefix, versions: { "stable" => "1.0", "version_scheme" => 1 })
<add> expect(f.outdated_kegs).not_to be_empty
<add>
<add> reset_outdated_kegs
<add> head_prefix.rmtree
<add>
<add> setup_tab_for_prefix(head_prefix, versions: { "stable" => "1.0", "version_scheme" => 2 })
<add> expect(f.outdated_kegs).to be_empty
<add> end
<add> end
<add> end
<add>end
<ide><path>Library/Homebrew/test/formula_test.rb
<del>require "testing_env"
<del>require "test/support/fixtures/testball"
<del>require "formula"
<del>
<del>class FormulaTests < Homebrew::TestCase
<del> def test_formula_instantiation
<del> klass = Class.new(Formula) { url "http://example.com/foo-1.0.tar.gz" }
<del> name = "formula_name"
<del> path = Formulary.core_path(name)
<del> spec = :stable
<del>
<del> f = klass.new(name, path, spec)
<del> assert_equal name, f.name
<del> assert_equal name, f.specified_name
<del> assert_equal name, f.full_name
<del> assert_equal name, f.full_specified_name
<del> assert_equal path, f.path
<del> assert_nil f.alias_path
<del> assert_nil f.alias_name
<del> assert_nil f.full_alias_name
<del> assert_raises(ArgumentError) { klass.new }
<del> end
<del>
<del> def test_formula_instantiation_with_alias
<del> klass = Class.new(Formula) { url "http://example.com/foo-1.0.tar.gz" }
<del> name = "formula_name"
<del> path = Formulary.core_path(name)
<del> spec = :stable
<del> alias_name = "baz@1"
<del> alias_path = CoreTap.instance.alias_dir/alias_name
<del>
<del> f = klass.new(name, path, spec, alias_path: alias_path)
<del> assert_equal name, f.name
<del> assert_equal name, f.full_name
<del> assert_equal path, f.path
<del> assert_equal alias_path, f.alias_path
<del> assert_equal alias_name, f.alias_name
<del> assert_equal alias_name, f.specified_name
<del> assert_equal alias_name, f.full_alias_name
<del> assert_equal alias_name, f.full_specified_name
<del> assert_raises(ArgumentError) { klass.new }
<del> end
<del>
<del> def test_tap_formula_instantiation
<del> tap = Tap.new("foo", "bar")
<del> klass = Class.new(Formula) { url "baz-1.0" }
<del> name = "baz"
<del> full_name = "#{tap.user}/#{tap.repo}/#{name}"
<del> path = tap.path/"Formula/#{name}.rb"
<del> spec = :stable
<del>
<del> f = klass.new(name, path, spec)
<del> assert_equal name, f.name
<del> assert_equal name, f.specified_name
<del> assert_equal full_name, f.full_name
<del> assert_equal full_name, f.full_specified_name
<del> assert_equal path, f.path
<del> assert_nil f.alias_path
<del> assert_nil f.alias_name
<del> assert_nil f.full_alias_name
<del> assert_raises(ArgumentError) { klass.new }
<del> end
<del>
<del> def test_tap_formula_instantiation_with_alias
<del> tap = Tap.new("foo", "bar")
<del> klass = Class.new(Formula) { url "baz-1.0" }
<del> name = "baz"
<del> full_name = "#{tap.user}/#{tap.repo}/#{name}"
<del> path = tap.path/"Formula/#{name}.rb"
<del> spec = :stable
<del> alias_name = "baz@1"
<del> full_alias_name = "#{tap.user}/#{tap.repo}/#{alias_name}"
<del> alias_path = CoreTap.instance.alias_dir/alias_name
<del>
<del> f = klass.new(name, path, spec, alias_path: alias_path)
<del> assert_equal name, f.name
<del> assert_equal full_name, f.full_name
<del> assert_equal path, f.path
<del> assert_equal alias_path, f.alias_path
<del> assert_equal alias_name, f.alias_name
<del> assert_equal alias_name, f.specified_name
<del> assert_equal full_alias_name, f.full_alias_name
<del> assert_equal full_alias_name, f.full_specified_name
<del> assert_raises(ArgumentError) { klass.new }
<del> end
<del>
<del> def test_follow_installed_alias
<del> f = formula { url "foo-1.0" }
<del> assert_predicate f, :follow_installed_alias?
<del>
<del> f.follow_installed_alias = true
<del> assert_predicate f, :follow_installed_alias?
<del>
<del> f.follow_installed_alias = false
<del> refute_predicate f, :follow_installed_alias?
<del> end
<del>
<del> def test_installed_alias_with_core
<del> f = formula { url "foo-1.0" }
<del>
<del> build_values_with_no_installed_alias = [
<del> nil,
<del> BuildOptions.new({}, {}),
<del> Tab.new(source: { "path" => f.path.to_s }),
<del> ]
<del>
<del> build_values_with_no_installed_alias.each do |build|
<del> f.build = build
<del> assert_nil f.installed_alias_path
<del> assert_nil f.installed_alias_name
<del> assert_nil f.full_installed_alias_name
<del> assert_equal f.name, f.installed_specified_name
<del> assert_equal f.name, f.full_installed_specified_name
<del> end
<del>
<del> alias_name = "bar"
<del> alias_path = "#{CoreTap.instance.alias_dir}/#{alias_name}"
<del> f.build = Tab.new(source: { "path" => alias_path })
<del> assert_equal alias_path, f.installed_alias_path
<del> assert_equal alias_name, f.installed_alias_name
<del> assert_equal alias_name, f.full_installed_alias_name
<del> assert_equal alias_name, f.installed_specified_name
<del> assert_equal alias_name, f.full_installed_specified_name
<del> end
<del>
<del> def test_installed_alias_with_tap
<del> tap = Tap.new("user", "repo")
<del> name = "foo"
<del> path = "#{tap.path}/Formula/#{name}.rb"
<del> f = formula(name, path) { url "foo-1.0" }
<del>
<del> build_values_with_no_installed_alias = [
<del> nil,
<del> BuildOptions.new({}, {}),
<del> Tab.new(source: { "path" => f.path }),
<del> ]
<del>
<del> build_values_with_no_installed_alias.each do |build|
<del> f.build = build
<del> assert_nil f.installed_alias_path
<del> assert_nil f.installed_alias_name
<del> assert_nil f.full_installed_alias_name
<del> assert_equal f.name, f.installed_specified_name
<del> assert_equal f.full_name, f.full_installed_specified_name
<del> end
<del>
<del> alias_name = "bar"
<del> full_alias_name = "#{tap.user}/#{tap.repo}/#{alias_name}"
<del> alias_path = "#{tap.alias_dir}/#{alias_name}"
<del> f.build = Tab.new(source: { "path" => alias_path })
<del> assert_equal alias_path, f.installed_alias_path
<del> assert_equal alias_name, f.installed_alias_name
<del> assert_equal full_alias_name, f.full_installed_alias_name
<del> assert_equal alias_name, f.installed_specified_name
<del> assert_equal full_alias_name, f.full_installed_specified_name
<del> end
<del>
<del> def test_prefix
<del> f = Testball.new
<del> assert_equal HOMEBREW_CELLAR/f.name/"0.1", f.prefix
<del> assert_kind_of Pathname, f.prefix
<del> end
<del>
<del> def test_revised_prefix
<del> f = Class.new(Testball) { revision 1 }.new
<del> assert_equal HOMEBREW_CELLAR/f.name/"0.1_1", f.prefix
<del> end
<del>
<del> def test_any_version_installed?
<del> f = formula do
<del> url "foo"
<del> version "1.0"
<del> end
<del> refute_predicate f, :any_version_installed?
<del> prefix = HOMEBREW_CELLAR+f.name+"0.1"
<del> prefix.mkpath
<del> FileUtils.touch prefix+Tab::FILENAME
<del> assert_predicate f, :any_version_installed?
<del> end
<del>
<del> def test_migration_needed
<del> f = Testball.new("newname")
<del> f.instance_variable_set(:@oldname, "oldname")
<del> f.instance_variable_set(:@tap, CoreTap.instance)
<del>
<del> oldname_prefix = HOMEBREW_CELLAR/"oldname/2.20"
<del> newname_prefix = HOMEBREW_CELLAR/"newname/2.10"
<del> oldname_prefix.mkpath
<del> oldname_tab = Tab.empty
<del> oldname_tab.tabfile = oldname_prefix.join("INSTALL_RECEIPT.json")
<del> oldname_tab.write
<del>
<del> refute_predicate f, :migration_needed?
<del>
<del> oldname_tab.tabfile.unlink
<del> oldname_tab.source["tap"] = "homebrew/core"
<del> oldname_tab.write
<del>
<del> assert_predicate f, :migration_needed?
<del>
<del> newname_prefix.mkpath
<del>
<del> refute_predicate f, :migration_needed?
<del> end
<del>
<del> def test_installed?
<del> f = Testball.new
<del> f.stubs(:installed_prefix).returns(stub(directory?: false))
<del> refute_predicate f, :installed?
<del>
<del> f.stubs(:installed_prefix).returns(
<del> stub(directory?: true, children: []),
<del> )
<del> refute_predicate f, :installed?
<del>
<del> f.stubs(:installed_prefix).returns(
<del> stub(directory?: true, children: [stub]),
<del> )
<del> assert_predicate f, :installed?
<del> end
<del>
<del> def test_installed_prefix
<del> f = Testball.new
<del> assert_equal f.prefix, f.installed_prefix
<del> end
<del>
<del> def test_installed_prefix_head_installed
<del> f = formula do
<del> head "foo"
<del> devel do
<del> url "foo"
<del> version "1.0"
<del> end
<del> end
<del> prefix = HOMEBREW_CELLAR+f.name+f.head.version
<del> prefix.mkpath
<del> assert_equal prefix, f.installed_prefix
<del> end
<del>
<del> def test_installed_prefix_devel_installed
<del> f = formula do
<del> head "foo"
<del> devel do
<del> url "foo"
<del> version "1.0"
<del> end
<del> end
<del> prefix = HOMEBREW_CELLAR+f.name+f.devel.version
<del> prefix.mkpath
<del> assert_equal prefix, f.installed_prefix
<del> end
<del>
<del> def test_installed_prefix_stable_installed
<del> f = formula do
<del> head "foo"
<del> devel do
<del> url "foo"
<del> version "1.0-devel"
<del> end
<del> end
<del> prefix = HOMEBREW_CELLAR+f.name+f.version
<del> prefix.mkpath
<del> assert_equal prefix, f.installed_prefix
<del> end
<del>
<del> def test_installed_prefix_outdated_stable_head_installed
<del> f = formula do
<del> url "foo"
<del> version "1.9"
<del> head "foo"
<del> end
<del>
<del> head_prefix = HOMEBREW_CELLAR/"#{f.name}/HEAD"
<del> head_prefix.mkpath
<del> tab = Tab.empty
<del> tab.tabfile = head_prefix.join("INSTALL_RECEIPT.json")
<del> tab.source["versions"] = { "stable" => "1.0" }
<del> tab.write
<del>
<del> assert_equal HOMEBREW_CELLAR/"#{f.name}/#{f.version}", f.installed_prefix
<del> end
<del>
<del> def test_installed_prefix_outdated_devel_head_installed
<del> f = formula do
<del> url "foo"
<del> version "1.9"
<del> devel do
<del> url "foo"
<del> version "2.1"
<del> end
<del> end
<del>
<del> head_prefix = HOMEBREW_CELLAR/"#{f.name}/HEAD"
<del> head_prefix.mkpath
<del> tab = Tab.empty
<del> tab.tabfile = head_prefix.join("INSTALL_RECEIPT.json")
<del> tab.source["versions"] = { "stable" => "1.9", "devel" => "2.0" }
<del> tab.write
<del>
<del> assert_equal HOMEBREW_CELLAR/"#{f.name}/#{f.version}", f.installed_prefix
<del> end
<del>
<del> def test_installed_prefix_head
<del> f = formula("test", Pathname.new(__FILE__).expand_path, :head) do
<del> head "foo"
<del> devel do
<del> url "foo"
<del> version "1.0-devel"
<del> end
<del> end
<del> prefix = HOMEBREW_CELLAR+f.name+f.head.version
<del> assert_equal prefix, f.installed_prefix
<del> end
<del>
<del> def test_installed_prefix_devel
<del> f = formula("test", Pathname.new(__FILE__).expand_path, :devel) do
<del> head "foo"
<del> devel do
<del> url "foo"
<del> version "1.0-devel"
<del> end
<del> end
<del> prefix = HOMEBREW_CELLAR+f.name+f.devel.version
<del> assert_equal prefix, f.installed_prefix
<del> end
<del>
<del> def test_latest_head_prefix
<del> f = Testball.new
<del>
<del> stamps_with_revisions = [[111111, 1], [222222, 1], [222222, 2], [222222, 0]]
<del>
<del> stamps_with_revisions.each do |stamp, revision|
<del> version = "HEAD-#{stamp}"
<del> version += "_#{revision}" if revision > 0
<del> prefix = f.rack.join(version)
<del> prefix.mkpath
<del>
<del> tab = Tab.empty
<del> tab.tabfile = prefix.join("INSTALL_RECEIPT.json")
<del> tab.source_modified_time = stamp
<del> tab.write
<del> end
<del>
<del> prefix = HOMEBREW_CELLAR/"#{f.name}/HEAD-222222_2"
<del> assert_equal prefix, f.latest_head_prefix
<del> end
<del>
<del> def test_equality
<del> x = Testball.new
<del> y = Testball.new
<del> assert_equal x, y
<del> assert_eql x, y
<del> assert_equal x.hash, y.hash
<del> end
<del>
<del> def test_inequality
<del> x = Testball.new("foo")
<del> y = Testball.new("bar")
<del> refute_equal x, y
<del> refute_eql x, y
<del> refute_equal x.hash, y.hash
<del> end
<del>
<del> def test_comparison_with_non_formula_objects_does_not_raise
<del> refute_equal Testball.new, Object.new
<del> end
<del>
<del> def test_sort_operator
<del> assert_nil Testball.new <=> Object.new
<del> end
<del>
<del> def test_alias_paths_with_build_options
<del> alias_path = CoreTap.instance.alias_dir/"another_name"
<del> f = formula(alias_path: alias_path) { url "foo-1.0" }
<del> f.build = BuildOptions.new({}, {})
<del> assert_equal alias_path, f.alias_path
<del> assert_nil f.installed_alias_path
<del> end
<del>
<del> def test_alias_paths_with_tab_with_non_alias_source_path
<del> alias_path = CoreTap.instance.alias_dir/"another_name"
<del> source_path = CoreTap.instance.formula_dir/"another_other_name"
<del> f = formula(alias_path: alias_path) { url "foo-1.0" }
<del> f.build = Tab.new(source: { "path" => source_path.to_s })
<del> assert_equal alias_path, f.alias_path
<del> assert_nil f.installed_alias_path
<del> end
<del>
<del> def test_alias_paths_with_tab_with_alias_source_path
<del> alias_path = CoreTap.instance.alias_dir/"another_name"
<del> source_path = CoreTap.instance.alias_dir/"another_other_name"
<del> f = formula(alias_path: alias_path) { url "foo-1.0" }
<del> f.build = Tab.new(source: { "path" => source_path.to_s })
<del> assert_equal alias_path, f.alias_path
<del> assert_equal source_path.to_s, f.installed_alias_path
<del> end
<del>
<del> def test_installed_with_alias_path_with_nil
<del> assert_predicate Formula.installed_with_alias_path(nil), :empty?
<del> end
<del>
<del> def test_installed_with_alias_path_with_a_path
<del> alias_path = "#{CoreTap.instance.alias_dir}/alias"
<del> different_alias_path = "#{CoreTap.instance.alias_dir}/another_alias"
<del>
<del> formula_with_alias = formula("foo") { url "foo-1.0" }
<del> formula_with_alias.build = Tab.empty
<del> formula_with_alias.build.source["path"] = alias_path
<del>
<del> formula_without_alias = formula("bar") { url "bar-1.0" }
<del> formula_without_alias.build = Tab.empty
<del> formula_without_alias.build.source["path"] = formula_without_alias.path.to_s
<del>
<del> formula_with_different_alias = formula("baz") { url "baz-1.0" }
<del> formula_with_different_alias.build = Tab.empty
<del> formula_with_different_alias.build.source["path"] = different_alias_path
<del>
<del> formulae = [
<del> formula_with_alias,
<del> formula_without_alias,
<del> formula_with_different_alias,
<del> ]
<del>
<del> Formula.stubs(:installed).returns(formulae)
<del> assert_equal [formula_with_alias], Formula.installed_with_alias_path(alias_path)
<del> end
<del>
<del> def test_formula_spec_integration
<del> f = formula do
<del> homepage "http://example.com"
<del> url "http://example.com/test-0.1.tbz"
<del> mirror "http://example.org/test-0.1.tbz"
<del> sha256 TEST_SHA256
<del>
<del> head "http://example.com/test.git", tag: "foo"
<del>
<del> devel do
<del> url "http://example.com/test-0.2.tbz"
<del> mirror "http://example.org/test-0.2.tbz"
<del> sha256 TEST_SHA256
<del> end
<del> end
<del>
<del> assert_equal "http://example.com", f.homepage
<del> assert_version_equal "0.1", f.version
<del> assert_predicate f, :stable?
<del>
<del> assert_version_equal "0.1", f.stable.version
<del> assert_version_equal "0.2", f.devel.version
<del> assert_version_equal "HEAD", f.head.version
<del> end
<del>
<del> def test_formula_active_spec=
<del> f = formula do
<del> url "foo"
<del> version "1.0"
<del> revision 1
<del>
<del> devel do
<del> url "foo"
<del> version "1.0beta"
<del> end
<del> end
<del> assert_equal :stable, f.active_spec_sym
<del> assert_equal f.stable, f.send(:active_spec)
<del> assert_equal "1.0_1", f.pkg_version.to_s
<del> f.active_spec = :devel
<del> assert_equal :devel, f.active_spec_sym
<del> assert_equal f.devel, f.send(:active_spec)
<del> assert_equal "1.0beta_1", f.pkg_version.to_s
<del> assert_raises(FormulaSpecificationError) { f.active_spec = :head }
<del> end
<del>
<del> def test_path
<del> name = "foo-bar"
<del> assert_equal Pathname.new("#{HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core/Formula/#{name}.rb"), Formulary.core_path(name)
<del> end
<del>
<del> def test_class_specs_are_always_initialized
<del> f = formula { url "foo-1.0" }
<del>
<del> %w[stable devel head].each do |spec|
<del> assert_kind_of SoftwareSpec, f.class.send(spec)
<del> end
<del> end
<del>
<del> def test_incomplete_instance_specs_are_not_accessible
<del> f = formula { url "foo-1.0" }
<del>
<del> %w[devel head].each { |spec| assert_nil f.send(spec) }
<del> end
<del>
<del> def test_honors_attributes_declared_before_specs
<del> f = formula do
<del> url "foo-1.0"
<del> depends_on "foo"
<del> devel { url "foo-1.1" }
<del> end
<del>
<del> %w[stable devel head].each do |spec|
<del> assert_equal "foo", f.class.send(spec).deps.first.name
<del> end
<del> end
<del>
<del> def test_simple_version
<del> assert_equal PkgVersion.parse("1.0"), formula { url "foo-1.0.bar" }.pkg_version
<del> end
<del>
<del> def test_version_with_revision
<del> f = formula do
<del> url "foo-1.0.bar"
<del> revision 1
<del> end
<del>
<del> assert_equal PkgVersion.parse("1.0_1"), f.pkg_version
<del> end
<del>
<del> def test_head_uses_revisions
<del> f = formula("test", Pathname.new(__FILE__).expand_path, :head) do
<del> url "foo-1.0.bar"
<del> revision 1
<del> head "foo"
<del> end
<del>
<del> assert_equal PkgVersion.parse("HEAD_1"), f.pkg_version
<del> end
<del>
<del> def test_update_head_version
<del> f = formula do
<del> head "foo", using: :git
<del> end
<del>
<del> cached_location = f.head.downloader.cached_location
<del> cached_location.mkpath
<del>
<del> cached_location.cd do
<del> FileUtils.touch "LICENSE"
<del> shutup do
<del> system "git", "init"
<del> system "git", "add", "--all"
<del> system "git", "commit", "-m", "Initial commit"
<del> end
<del> end
<del>
<del> f.update_head_version
<del> assert_equal Version.create("HEAD-5658946"), f.head.version
<del> end
<del>
<del> def test_legacy_options
<del> f = formula do
<del> url "foo-1.0"
<del>
<del> def options
<del> [["--foo", "desc"], ["--bar", "desc"]]
<del> end
<del>
<del> option "baz"
<del> end
<del>
<del> assert f.option_defined?("foo")
<del> assert f.option_defined?("bar")
<del> assert f.option_defined?("baz")
<del> end
<del>
<del> def test_desc
<del> f = formula do
<del> desc "a formula"
<del> url "foo-1.0"
<del> end
<del>
<del> assert_equal "a formula", f.desc
<del> end
<del>
<del> def test_post_install_defined
<del> f1 = formula do
<del> url "foo-1.0"
<del>
<del> def post_install; end
<del> end
<del>
<del> f2 = formula do
<del> url "foo-1.0"
<del> end
<del>
<del> assert f1.post_install_defined?
<del> refute f2.post_install_defined?
<del> end
<del>
<del> def test_test_defined
<del> f1 = formula do
<del> url "foo-1.0"
<del>
<del> def test; end
<del> end
<del>
<del> f2 = formula do
<del> url "foo-1.0"
<del> end
<del>
<del> assert f1.test_defined?
<del> refute f2.test_defined?
<del> end
<del>
<del> def test_test_fixtures
<del> f1 = formula do
<del> url "foo-1.0"
<del> end
<del>
<del> assert_equal Pathname.new("#{HOMEBREW_LIBRARY_PATH}/test/support/fixtures/foo"),
<del> f1.test_fixtures("foo")
<del> end
<del>
<del> def test_dependencies
<del> stub_formula_loader formula("f1") { url "f1-1.0" }
<del> stub_formula_loader formula("f2") { url "f2-1.0" }
<del>
<del> f3 = formula("f3") do
<del> url "f3-1.0"
<del> depends_on "f1" => :build
<del> depends_on "f2"
<del> end
<del> stub_formula_loader f3
<del>
<del> f4 = formula("f4") do
<del> url "f4-1.0"
<del> depends_on "f1"
<del> end
<del> stub_formula_loader f4
<del>
<del> f5 = formula("f5") do
<del> url "f5-1.0"
<del> depends_on "f3" => :build
<del> depends_on "f4"
<del> end
<del>
<del> assert_equal %w[f3 f4], f5.deps.map(&:name)
<del> assert_equal %w[f1 f2 f3 f4], f5.recursive_dependencies.map(&:name)
<del> assert_equal %w[f1 f4], f5.runtime_dependencies.map(&:name)
<del> end
<del>
<del> def test_runtime_dependencies_with_optional_deps_from_tap
<del> tap_loader = mock
<del> tap_loader.stubs(:get_formula).raises(RuntimeError, "tried resolving tap formula")
<del> Formulary.stubs(:loader_for).with("foo/bar/f1", from: nil).returns(tap_loader)
<del>
<del> stub_formula_loader formula("f2") { url "f2-1.0" }, "baz/qux/f2"
<del>
<del> f3 = formula("f3") do
<del> url "f3-1.0"
<del> depends_on "foo/bar/f1" => :optional
<del> depends_on "baz/qux/f2"
<del> end
<del>
<del> # f1 shouldn't be loaded by default.
<del> # If it is, an exception will be raised.
<del> assert_equal %w[baz/qux/f2], f3.runtime_dependencies.map(&:name)
<del>
<del> # If --with-f1, f1 should be loaded.
<del> stub_formula_loader formula("f1") { url "f1-1.0" }, "foo/bar/f1"
<del> f3.build = BuildOptions.new(Options.create(%w[--with-f1]), f3.options)
<del> assert_equal %w[foo/bar/f1 baz/qux/f2], f3.runtime_dependencies.map(&:name)
<del> end
<del>
<del> def test_requirements
<del> f1 = formula("f1") do
<del> url "f1-1"
<del>
<del> depends_on :python
<del> depends_on x11: :recommended
<del> depends_on xcode: ["1.0", :optional]
<del> end
<del> stub_formula_loader f1
<del>
<del> python = PythonRequirement.new
<del> x11 = X11Requirement.new("x11", [:recommended])
<del> xcode = XcodeRequirement.new(["1.0", :optional])
<del>
<del> # Default block should filter out deps that aren't being used
<del> assert_equal Set[python, x11], Set.new(f1.recursive_requirements)
<del>
<del> f1.build = BuildOptions.new(["--with-xcode", "--without-x11"], f1.options)
<del> assert_equal Set[python, xcode], Set.new(f1.recursive_requirements)
<del> f1.build = f1.stable.build
<del>
<del> f2 = formula("f2") do
<del> url "f2-1"
<del> depends_on "f1"
<del> end
<del>
<del> assert_equal Set[python, x11], Set.new(f2.recursive_requirements)
<del>
<del> # Empty block should allow all requirements
<del> assert_equal Set[python, x11, xcode], Set.new(f2.recursive_requirements {})
<del>
<del> # Requirements can be pruned
<del> requirements = f2.recursive_requirements do |_dependent, requirement|
<del> Requirement.prune if requirement.is_a?(PythonRequirement)
<del> end
<del> assert_equal Set[x11, xcode], Set.new(requirements)
<del> end
<del>
<del> def test_to_hash
<del> f1 = formula("foo") do
<del> url "foo-1.0"
<del> end
<del>
<del> h = f1.to_hash
<del> assert h.is_a?(Hash), "Formula#to_hash should return a Hash"
<del> assert_equal "foo", h["name"]
<del> assert_equal "foo", h["full_name"]
<del> assert_equal "1.0", h["versions"]["stable"]
<del> end
<del>
<del> def test_to_hash_bottle
<del> f1 = formula("foo") do
<del> url "foo-1.0"
<del>
<del> bottle do
<del> cellar :any
<del> sha256 TEST_SHA256 => Utils::Bottles.tag
<del> end
<del> end
<del>
<del> h = f1.to_hash
<del> assert h.is_a?(Hash), "Formula#to_hash should return a Hash"
<del> assert h["versions"]["bottle"], "The hash should say the formula is bottled"
<del> end
<del>
<del> def test_eligible_kegs_for_cleanup
<del> f1 = Class.new(Testball) do
<del> version "1.0"
<del> end.new
<del> f2 = Class.new(Testball) do
<del> version "0.2"
<del> version_scheme 1
<del> end.new
<del> f3 = Class.new(Testball) do
<del> version "0.3"
<del> version_scheme 1
<del> end.new
<del> f4 = Class.new(Testball) do
<del> version "0.1"
<del> version_scheme 2
<del> end.new
<del>
<del> shutup do
<del> [f1, f2, f3, f4].each do |f|
<del> f.brew { f.install }
<del> Tab.create(f, DevelopmentTools.default_compiler, :libcxx).write
<del> end
<del> end
<del>
<del> assert_predicate f1, :installed?
<del> assert_predicate f2, :installed?
<del> assert_predicate f3, :installed?
<del> assert_predicate f4, :installed?
<del>
<del> assert_equal [f2, f1].map { |f| Keg.new(f.prefix) },
<del> f3.eligible_kegs_for_cleanup.sort_by(&:version)
<del> end
<del>
<del> def test_eligible_kegs_for_cleanup_keg_pinned
<del> f1 = Class.new(Testball) { version "0.1" }.new
<del> f2 = Class.new(Testball) { version "0.2" }.new
<del> f3 = Class.new(Testball) { version "0.3" }.new
<del>
<del> shutup do
<del> f1.brew { f1.install }
<del> f1.pin
<del> f2.brew { f2.install }
<del> f3.brew { f3.install }
<del> end
<del>
<del> assert_equal (HOMEBREW_PINNED_KEGS/f1.name).resolved_path, f1.prefix
<del>
<del> assert_predicate f1, :installed?
<del> assert_predicate f2, :installed?
<del> assert_predicate f3, :installed?
<del>
<del> assert_equal [Keg.new(f2.prefix)], shutup { f3.eligible_kegs_for_cleanup }
<del> end
<del>
<del> def test_eligible_kegs_for_cleanup_head_installed
<del> f = formula do
<del> version "0.1"
<del> head "foo"
<del> end
<del>
<del> stable_prefix = f.installed_prefix
<del> stable_prefix.mkpath
<del>
<del> [["000000_1", 1], ["111111", 2], ["111111_1", 2]].each do |pkg_version_suffix, stamp|
<del> prefix = f.prefix("HEAD-#{pkg_version_suffix}")
<del> prefix.mkpath
<del> tab = Tab.empty
<del> tab.tabfile = prefix.join("INSTALL_RECEIPT.json")
<del> tab.source_modified_time = stamp
<del> tab.write
<del> end
<del>
<del> eligible_kegs = f.installed_kegs - [Keg.new(f.prefix("HEAD-111111_1"))]
<del> assert_equal eligible_kegs, f.eligible_kegs_for_cleanup
<del> end
<del>
<del> def test_pour_bottle
<del> f_false = formula("foo") do
<del> url "foo-1.0"
<del> def pour_bottle?
<del> false
<del> end
<del> end
<del> refute f_false.pour_bottle?
<del>
<del> f_true = formula("foo") do
<del> url "foo-1.0"
<del> def pour_bottle?
<del> true
<del> end
<del> end
<del> assert f_true.pour_bottle?
<del> end
<del>
<del> def test_pour_bottle_dsl
<del> f_false = formula("foo") do
<del> url "foo-1.0"
<del> pour_bottle? do
<del> reason "false reason"
<del> satisfy { var == etc }
<del> end
<del> end
<del> refute f_false.pour_bottle?
<del>
<del> f_true = formula("foo") do
<del> url "foo-1.0"
<del> pour_bottle? do
<del> reason "true reason"
<del> satisfy { true }
<del> end
<del> end
<del> assert f_true.pour_bottle?
<del> end
<del>end
<del>
<del>class AliasChangeTests < Homebrew::TestCase
<del> attr_reader :f, :new_formula, :tab, :alias_path
<del>
<del> def make_formula(name, version)
<del> f = formula(name, alias_path: alias_path) { url "foo-#{version}" }
<del> f.build = tab
<del> f
<del> end
<del>
<del> def setup
<del> super
<del>
<del> alias_name = "bar"
<del> @alias_path = "#{CoreTap.instance.alias_dir}/#{alias_name}"
<del>
<del> @tab = Tab.empty
<del>
<del> @f = make_formula("formula_name", "1.0")
<del> @new_formula = make_formula("new_formula_name", "1.1")
<del>
<del> Formula.stubs(:installed).returns([f])
<del> end
<del>
<del> def test_alias_changes_when_not_installed_with_alias
<del> tab.source["path"] = Formulary.core_path(f.name).to_s
<del>
<del> assert_nil f.current_installed_alias_target
<del> assert_equal f, f.latest_formula
<del> refute_predicate f, :installed_alias_target_changed?
<del> refute_predicate f, :supersedes_an_installed_formula?
<del> refute_predicate f, :alias_changed?
<del> assert_predicate f.old_installed_formulae, :empty?
<del> end
<del>
<del> def test_alias_changes_when_not_changed
<del> tab.source["path"] = alias_path
<del> stub_formula_loader(f, alias_path)
<del>
<del> assert_equal f, f.current_installed_alias_target
<del> assert_equal f, f.latest_formula
<del> refute_predicate f, :installed_alias_target_changed?
<del> refute_predicate f, :supersedes_an_installed_formula?
<del> refute_predicate f, :alias_changed?
<del> assert_predicate f.old_installed_formulae, :empty?
<del> end
<del>
<del> def test_alias_changes_when_new_alias_target
<del> tab.source["path"] = alias_path
<del> stub_formula_loader(new_formula, alias_path)
<del>
<del> assert_equal new_formula, f.current_installed_alias_target
<del> assert_equal new_formula, f.latest_formula
<del> assert_predicate f, :installed_alias_target_changed?
<del> refute_predicate f, :supersedes_an_installed_formula?
<del> assert_predicate f, :alias_changed?
<del> assert_predicate f.old_installed_formulae, :empty?
<del> end
<del>
<del> def test_alias_changes_when_old_formulae_installed
<del> tab.source["path"] = alias_path
<del> stub_formula_loader(new_formula, alias_path)
<del>
<del> assert_equal new_formula, new_formula.current_installed_alias_target
<del> assert_equal new_formula, new_formula.latest_formula
<del> refute_predicate new_formula, :installed_alias_target_changed?
<del> assert_predicate new_formula, :supersedes_an_installed_formula?
<del> assert_predicate new_formula, :alias_changed?
<del> assert_equal [f], new_formula.old_installed_formulae
<del> end
<del>end
<del>
<del>class OutdatedVersionsTests < Homebrew::TestCase
<del> attr_reader :outdated_prefix,
<del> :same_prefix,
<del> :greater_prefix,
<del> :head_prefix,
<del> :old_alias_target_prefix
<del> attr_reader :f, :old_formula, :new_formula
<del>
<del> def setup
<del> super
<del>
<del> @f = formula do
<del> url "foo"
<del> version "1.20"
<del> end
<del>
<del> @old_formula = formula("foo@1") { url "foo-1.0" }
<del> @new_formula = formula("foo@2") { url "foo-2.0" }
<del>
<del> @outdated_prefix = HOMEBREW_CELLAR/"#{f.name}/1.11"
<del> @same_prefix = HOMEBREW_CELLAR/"#{f.name}/1.20"
<del> @greater_prefix = HOMEBREW_CELLAR/"#{f.name}/1.21"
<del> @head_prefix = HOMEBREW_CELLAR/"#{f.name}/HEAD"
<del> @old_alias_target_prefix = HOMEBREW_CELLAR/"#{old_formula.name}/1.0"
<del> end
<del>
<del> def alias_path
<del> "#{@f.tap.alias_dir}/bar"
<del> end
<del>
<del> def setup_tab_for_prefix(prefix, options = {})
<del> prefix.mkpath
<del> tab = Tab.empty
<del> tab.tabfile = prefix.join("INSTALL_RECEIPT.json")
<del> tab.source["path"] = options[:path].to_s if options[:path]
<del> tab.source["tap"] = options[:tap] if options[:tap]
<del> tab.source["versions"] = options[:versions] if options[:versions]
<del> tab.source_modified_time = options[:source_modified_time].to_i
<del> tab.write unless options[:no_write]
<del> tab
<del> end
<del>
<del> def reset_outdated_kegs
<del> f.instance_variable_set(:@outdated_kegs, nil)
<del> end
<del>
<del> def test_greater_different_tap_installed
<del> setup_tab_for_prefix(greater_prefix, tap: "user/repo")
<del> assert_predicate f.outdated_kegs, :empty?
<del> end
<del>
<del> def test_greater_same_tap_installed
<del> f.instance_variable_set(:@tap, CoreTap.instance)
<del> setup_tab_for_prefix(greater_prefix, tap: "homebrew/core")
<del> assert_predicate f.outdated_kegs, :empty?
<del> end
<del>
<del> def test_outdated_different_tap_installed
<del> setup_tab_for_prefix(outdated_prefix, tap: "user/repo")
<del> refute_predicate f.outdated_kegs, :empty?
<del> end
<del>
<del> def test_outdated_same_tap_installed
<del> f.instance_variable_set(:@tap, CoreTap.instance)
<del> setup_tab_for_prefix(outdated_prefix, tap: "homebrew/core")
<del> refute_predicate f.outdated_kegs, :empty?
<del> end
<del>
<del> def test_outdated_follow_alias_and_alias_unchanged
<del> f.follow_installed_alias = true
<del> f.build = setup_tab_for_prefix(same_prefix, path: alias_path)
<del> stub_formula_loader(f, alias_path)
<del> assert_predicate f.outdated_kegs, :empty?
<del> end
<del>
<del> def test_outdated_follow_alias_and_alias_changed_and_new_target_not_installed
<del> f.follow_installed_alias = true
<del> f.build = setup_tab_for_prefix(same_prefix, path: alias_path)
<del> stub_formula_loader(new_formula, alias_path)
<del> refute_predicate f.outdated_kegs, :empty?
<del> end
<del>
<del> def test_outdated_follow_alias_and_alias_changed_and_new_target_installed
<del> f.follow_installed_alias = true
<del> f.build = setup_tab_for_prefix(same_prefix, path: alias_path)
<del> stub_formula_loader(new_formula, alias_path)
<del> setup_tab_for_prefix(new_formula.prefix) # install new_formula
<del> assert_predicate f.outdated_kegs, :empty?
<del> end
<del>
<del> def test_outdated_no_follow_alias_and_alias_unchanged
<del> f.follow_installed_alias = false
<del> f.build = setup_tab_for_prefix(same_prefix, path: alias_path)
<del> stub_formula_loader(f, alias_path)
<del> assert_predicate f.outdated_kegs, :empty?
<del> end
<del>
<del> def test_outdated_no_follow_alias_and_alias_changed
<del> f.follow_installed_alias = false
<del> f.build = setup_tab_for_prefix(same_prefix, path: alias_path)
<del> stub_formula_loader(formula("foo@2") { url "foo-2.0" }, alias_path)
<del> assert_predicate f.outdated_kegs, :empty?
<del> end
<del>
<del> def test_outdated_old_alias_targets_installed
<del> @f = formula(alias_path: alias_path) { url "foo-1.0" }
<del> tab = setup_tab_for_prefix(old_alias_target_prefix, path: alias_path)
<del> old_formula.build = tab
<del> Formula.stubs(:installed).returns([old_formula])
<del> refute_predicate f.outdated_kegs, :empty?
<del> end
<del>
<del> def test_outdated_old_alias_targets_not_installed
<del> @f = formula(alias_path: alias_path) { url "foo-1.0" }
<del> tab = setup_tab_for_prefix(old_alias_target_prefix, path: old_formula.path)
<del> old_formula.build = tab
<del> Formula.stubs(:installed).returns([old_formula])
<del> assert_predicate f.outdated_kegs, :empty?
<del> end
<del>
<del> def test_outdated_same_head_installed
<del> f.instance_variable_set(:@tap, CoreTap.instance)
<del> setup_tab_for_prefix(head_prefix, tap: "homebrew/core")
<del> assert_predicate f.outdated_kegs, :empty?
<del> end
<del>
<del> def test_outdated_different_head_installed
<del> f.instance_variable_set(:@tap, CoreTap.instance)
<del> setup_tab_for_prefix(head_prefix, tap: "user/repo")
<del> assert_predicate f.outdated_kegs, :empty?
<del> end
<del>
<del> def test_outdated_mixed_taps_greater_version_installed
<del> f.instance_variable_set(:@tap, CoreTap.instance)
<del> setup_tab_for_prefix(outdated_prefix, tap: "homebrew/core")
<del> setup_tab_for_prefix(greater_prefix, tap: "user/repo")
<del>
<del> assert_predicate f.outdated_kegs, :empty?
<del>
<del> setup_tab_for_prefix(greater_prefix, tap: "homebrew/core")
<del> reset_outdated_kegs
<del>
<del> assert_predicate f.outdated_kegs, :empty?
<del> end
<del>
<del> def test_outdated_mixed_taps_outdated_version_installed
<del> f.instance_variable_set(:@tap, CoreTap.instance)
<del>
<del> extra_outdated_prefix = HOMEBREW_CELLAR/"#{f.name}/1.0"
<del>
<del> setup_tab_for_prefix(outdated_prefix)
<del> setup_tab_for_prefix(extra_outdated_prefix, tap: "homebrew/core")
<del> reset_outdated_kegs
<del>
<del> refute_predicate f.outdated_kegs, :empty?
<del>
<del> setup_tab_for_prefix(outdated_prefix, tap: "user/repo")
<del> reset_outdated_kegs
<del>
<del> refute_predicate f.outdated_kegs, :empty?
<del> end
<del>
<del> def test_outdated_same_version_tap_installed
<del> f.instance_variable_set(:@tap, CoreTap.instance)
<del> setup_tab_for_prefix(same_prefix, tap: "homebrew/core")
<del>
<del> assert_predicate f.outdated_kegs, :empty?
<del>
<del> setup_tab_for_prefix(same_prefix, tap: "user/repo")
<del> reset_outdated_kegs
<del>
<del> assert_predicate f.outdated_kegs, :empty?
<del> end
<del>
<del> def test_outdated_installed_head_less_than_stable
<del> tab = setup_tab_for_prefix(head_prefix, versions: { "stable" => "1.0" })
<del> refute_predicate f.outdated_kegs, :empty?
<del>
<del> # Tab.for_keg(head_prefix) will be fetched from CACHE but we write it anyway
<del> tab.source["versions"] = { "stable" => f.version.to_s }
<del> tab.write
<del> reset_outdated_kegs
<del>
<del> assert_predicate f.outdated_kegs, :empty?
<del> end
<del>
<del> def test_outdated_fetch_head
<del> outdated_stable_prefix = HOMEBREW_CELLAR.join("testball/1.0")
<del> head_prefix_a = HOMEBREW_CELLAR.join("testball/HEAD")
<del> head_prefix_b = HOMEBREW_CELLAR.join("testball/HEAD-aaaaaaa_1")
<del> head_prefix_c = HOMEBREW_CELLAR.join("testball/HEAD-18a7103")
<del>
<del> setup_tab_for_prefix(outdated_stable_prefix)
<del> tab_a = setup_tab_for_prefix(head_prefix_a, versions: { "stable" => "1.0" })
<del> setup_tab_for_prefix(head_prefix_b)
<del>
<del> testball_repo = HOMEBREW_PREFIX.join("testball_repo")
<del> testball_repo.mkdir
<del>
<del> @f = formula("testball") do
<del> url "foo"
<del> version "2.10"
<del> head "file://#{testball_repo}", using: :git
<del> end
<del>
<del> testball_repo.cd do
<del> FileUtils.touch "LICENSE"
<del> shutup do
<del> system "git", "init"
<del> system "git", "add", "--all"
<del> system "git", "commit", "-m", "Initial commit"
<del> end
<del> end
<del>
<del> refute_predicate f.outdated_kegs(fetch_head: true), :empty?
<del>
<del> tab_a.source["versions"] = { "stable" => f.version.to_s }
<del> tab_a.write
<del> reset_outdated_kegs
<del> refute_predicate f.outdated_kegs(fetch_head: true), :empty?
<del>
<del> head_prefix_a.rmtree
<del> reset_outdated_kegs
<del> refute_predicate f.outdated_kegs(fetch_head: true), :empty?
<del>
<del> setup_tab_for_prefix(head_prefix_c, source_modified_time: 1)
<del> reset_outdated_kegs
<del> assert_predicate f.outdated_kegs(fetch_head: true), :empty?
<del> ensure
<del> testball_repo.rmtree if testball_repo.exist?
<del> end
<del>
<del> def test_outdated_kegs_version_scheme_changed
<del> @f = formula("testball") do
<del> url "foo"
<del> version "20141010"
<del> version_scheme 1
<del> end
<del>
<del> prefix = HOMEBREW_CELLAR.join("testball/0.1")
<del> setup_tab_for_prefix(prefix, versions: { "stable" => "0.1" })
<del>
<del> refute_predicate f.outdated_kegs, :empty?
<del> end
<del>
<del> def test_outdated_kegs_mixed_version_schemes
<del> @f = formula("testball") do
<del> url "foo"
<del> version "20141010"
<del> version_scheme 3
<del> end
<del>
<del> prefix_a = HOMEBREW_CELLAR.join("testball/20141009")
<del> setup_tab_for_prefix(prefix_a, versions: { "stable" => "20141009", "version_scheme" => 1 })
<del>
<del> prefix_b = HOMEBREW_CELLAR.join("testball/2.14")
<del> setup_tab_for_prefix(prefix_b, versions: { "stable" => "2.14", "version_scheme" => 2 })
<del>
<del> refute_predicate f.outdated_kegs, :empty?
<del> reset_outdated_kegs
<del>
<del> prefix_c = HOMEBREW_CELLAR.join("testball/20141009")
<del> setup_tab_for_prefix(prefix_c, versions: { "stable" => "20141009", "version_scheme" => 3 })
<del>
<del> refute_predicate f.outdated_kegs, :empty?
<del> reset_outdated_kegs
<del>
<del> prefix_d = HOMEBREW_CELLAR.join("testball/20141011")
<del> setup_tab_for_prefix(prefix_d, versions: { "stable" => "20141009", "version_scheme" => 3 })
<del> assert_predicate f.outdated_kegs, :empty?
<del> end
<del>
<del> def test_outdated_kegs_head_with_version_scheme
<del> @f = formula("testball") do
<del> url "foo"
<del> version "1.0"
<del> version_scheme 2
<del> end
<del>
<del> head_prefix = HOMEBREW_CELLAR.join("testball/HEAD")
<del>
<del> setup_tab_for_prefix(head_prefix, versions: { "stable" => "1.0", "version_scheme" => 1 })
<del> refute_predicate f.outdated_kegs, :empty?
<del>
<del> reset_outdated_kegs
<del> head_prefix.rmtree
<del>
<del> setup_tab_for_prefix(head_prefix, versions: { "stable" => "1.0", "version_scheme" => 2 })
<del> assert_predicate f.outdated_kegs, :empty?
<del> end
<del>end
<ide><path>Library/Homebrew/test/formulary_spec.rb
<ide> class Wrong#{subject.class_s(formula_name)} < Formula
<ide> end
<ide> end
<ide> end
<add>
<add> describe "::core_path" do
<add> it "returns the path to a Formula in the core tap" do
<add> name = "foo-bar"
<add> expect(subject.core_path(name))
<add> .to eq(Pathname.new("#{HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core/Formula/#{name}.rb"))
<add> end
<add> end
<ide> end | 3 |
Javascript | Javascript | run watch cases with more timeout | 0db9d8f1077e43ef59f9beec1d1b29ad7584765e | <ide><path>test/WatchTestCases.test.js
<ide> describe("WatchTestCases", () => {
<ide> run = runs[runIdx];
<ide> setTimeout(() => {
<ide> copyDiff(path.join(testDirectory, run.name), tempDirectory);
<del> }, 50);
<add> }, 1500);
<ide> } else {
<ide> watching.close();
<ide> process.nextTick(done); | 1 |
Javascript | Javascript | get the oes_texture_float_linear extension | 557471058a6223dfde1d079d13115c881f49d9e9 | <ide><path>src/renderers/WebGLRenderer.js
<ide> THREE.WebGLRenderer = function ( parameters ) {
<ide> var _gl;
<ide>
<ide> var _glExtensionTextureFloat;
<add> var _glExtensionTextureFloatLinear;
<ide> var _glExtensionStandardDerivatives;
<ide> var _glExtensionTextureFilterAnisotropic;
<ide> var _glExtensionCompressedTextureS3TC;
<ide> THREE.WebGLRenderer = function ( parameters ) {
<ide> }
<ide>
<ide> _glExtensionTextureFloat = _gl.getExtension( 'OES_texture_float' );
<add> _glExtensionTextureFloatLinear = _gl.getExtension( 'OES_texture_float_linear' );
<ide> _glExtensionStandardDerivatives = _gl.getExtension( 'OES_standard_derivatives' );
<ide>
<ide> _glExtensionTextureFilterAnisotropic = _gl.getExtension( 'EXT_texture_filter_anisotropic' ) || | 1 |
Javascript | Javascript | fix http2 benchmarks | 1c4fa9a48ab08627475e3988483c18d946e81d80 | <ide><path>benchmark/_test-double-benchmarker.js
<ide> function run() {
<ide> }
<ide> } else { // HTTP/2
<ide> const client = http.connect(url);
<del> client.on('error', (e) => { throw e; });
<add> client.on('error', () => {});
<ide> request(client.request(), client);
<ide> }
<ide> }
<ide><path>benchmark/http2/compat.js
<ide> function main({ requests, streams, clients, duration }) {
<ide> res.destroy();
<ide> });
<ide> });
<del> server.listen(common.PORT, () => {
<add> server.listen(0, () => {
<ide> bench.http({
<ide> path: '/',
<add> port: server.address().port,
<ide> requests,
<ide> maxConcurrentStreams: streams,
<ide> clients,
<ide><path>benchmark/http2/headers.js
<ide> 'use strict';
<ide>
<ide> const common = require('../common.js');
<del>const PORT = common.PORT;
<ide>
<ide> const bench = common.createBenchmark(main, {
<ide> n: [1e3],
<ide> function main({ n, nheaders }) {
<ide> stream.respond();
<ide> stream.end('Hi!');
<ide> });
<del> server.listen(PORT, () => {
<del> const client = http2.connect(`http://localhost:${PORT}/`, {
<add> server.listen(0, () => {
<add> const client = http2.connect(`http://localhost:${server.address().port}/`, {
<ide> maxHeaderListPairs: 20000
<ide> });
<ide>
<ide><path>benchmark/http2/respond-with-fd.js
<ide> function main({ requests, streams, clients, duration }) {
<ide> stream.respondWithFD(fd);
<ide> stream.on('error', (err) => {});
<ide> });
<del> server.listen(common.PORT, () => {
<add> server.listen(0, () => {
<ide> bench.http({
<ide> path: '/',
<ide> requests,
<add> port: server.address().port,
<ide> maxConcurrentStreams: streams,
<ide> clients,
<ide> duration,
<ide><path>benchmark/http2/simple.js
<ide> function main({ requests, streams, clients, duration }) {
<ide> out.pipe(stream);
<ide> stream.on('error', (err) => {});
<ide> });
<del> server.listen(common.PORT, () => {
<add> server.listen(0, () => {
<ide> bench.http({
<ide> path: '/',
<add> port: server.address().port,
<ide> requests,
<ide> maxConcurrentStreams: streams,
<ide> clients,
<ide><path>benchmark/http2/write.js
<ide> function main({ streams, length, size, duration }) {
<ide> }
<ide> write();
<ide> });
<del> server.listen(common.PORT, () => {
<add> server.listen(0, () => {
<ide> bench.http({
<ide> path: '/',
<add> port: server.address().port,
<ide> requests: 10000,
<ide> duration,
<ide> maxConcurrentStreams: streams, | 6 |
PHP | PHP | add typehints to shell hook methods | c37b8a257956ea30c4d9243b3df3ca8446632d28 | <ide><path>src/Console/Command.php
<ide> public function getOptionParser(): ConsoleOptionParser
<ide> * @param \Cake\Console\ConsoleOptionParser $parser The parser to be defined
<ide> * @return \Cake\Console\ConsoleOptionParser The built parser.
<ide> */
<del> protected function buildOptionParser(ConsoleOptionParser $parser)
<add> protected function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionParser
<ide> {
<ide> return $parser;
<ide> }
<ide><path>src/Console/Shell.php
<ide> public function setIo(ConsoleIo $io): void
<ide> * @return void
<ide> * @link https://book.cakephp.org/3.0/en/console-and-shells.html#Cake\Console\ConsoleOptionParser::initialize
<ide> */
<del> public function initialize()
<add> public function initialize(): void
<ide> {
<ide> $this->loadTasks();
<ide> }
<ide> public function initialize()
<ide> * @return void
<ide> * @link https://book.cakephp.org/3.0/en/console-and-shells.html#Cake\Console\ConsoleOptionParser::startup
<ide> */
<del> public function startup()
<add> public function startup(): void
<ide> {
<ide> if (!$this->param('requested')) {
<ide> $this->_welcome();
<ide> protected function _displayHelp(string $command)
<ide> * @return \Cake\Console\ConsoleOptionParser
<ide> * @link https://book.cakephp.org/3.0/en/console-and-shells.html#configuring-options-and-generating-help
<ide> */
<del> public function getOptionParser()
<add> public function getOptionParser(): ConsoleOptionParser
<ide> {
<ide> $name = ($this->plugin ? $this->plugin . '.' : '') . $this->name;
<ide> $parser = new ConsoleOptionParser($name);
<ide> public function success($message = null, int $newlines = 1, int $level = Shell::
<ide> * @return string
<ide> * @link https://book.cakephp.org/3.0/en/console-and-shells.html#Shell::nl
<ide> */
<del> public function nl(int $multiplier = 1)
<add> public function nl(int $multiplier = 1): string
<ide> {
<ide> return $this->_io->nl($multiplier);
<ide> }
<ide> public function nl(int $multiplier = 1)
<ide> * @return void
<ide> * @link https://book.cakephp.org/3.0/en/console-and-shells.html#Shell::hr
<ide> */
<del> public function hr(int $newlines = 0, int $width = 63)
<add> public function hr(int $newlines = 0, int $width = 63): void
<ide> {
<ide> $this->_io->hr($newlines, $width);
<ide> }
<ide> public function shortPath(string $file): string
<ide> * @param array $settings Configuration data for the helper.
<ide> * @return \Cake\Console\Helper The created helper instance.
<ide> */
<del> public function helper(string $name, array $settings = [])
<add> public function helper(string $name, array $settings = []): Helper
<ide> {
<ide> return $this->_io->helper($name, $settings);
<ide> }
<ide><path>src/Shell/CacheShell.php
<ide> use Cake\Cache\Cache;
<ide> use Cake\Cache\Engine\ApcuEngine;
<ide> use Cake\Cache\Engine\WincacheEngine;
<add>use Cake\Console\ConsoleOptionParser;
<ide> use Cake\Console\Shell;
<ide> use InvalidArgumentException;
<ide>
<ide> class CacheShell extends Shell
<ide> *
<ide> * @return \Cake\Console\ConsoleOptionParser
<ide> */
<del> public function getOptionParser()
<add> public function getOptionParser(): ConsoleOptionParser
<ide> {
<ide> $parser = parent::getOptionParser();
<ide> $parser->addSubcommand('list_prefixes', [
<ide> public function getOptionParser()
<ide> * @throws \Cake\Console\Exception\StopException
<ide> * @return void
<ide> */
<del> public function clear($prefix = null)
<add> public function clear($prefix = null): void
<ide> {
<ide> try {
<ide> $engine = Cache::engine($prefix);
<ide><path>src/Shell/CompletionShell.php
<ide> */
<ide> namespace Cake\Shell;
<ide>
<add>use Cake\Console\ConsoleOptionParser;
<ide> use Cake\Console\Shell;
<ide>
<ide> /**
<ide> class CompletionShell extends Shell
<ide> *
<ide> * @return void
<ide> */
<del> public function startup()
<add> public function startup(): void
<ide> {
<ide> }
<ide>
<ide> public function fuzzy()
<ide> *
<ide> * @return \Cake\Console\ConsoleOptionParser
<ide> */
<del> public function getOptionParser()
<add> public function getOptionParser(): ConsoleOptionParser
<ide> {
<ide> $parser = parent::getOptionParser();
<ide>
<ide><path>src/Shell/I18nShell.php
<ide> */
<ide> namespace Cake\Shell;
<ide>
<add>use Cake\Console\ConsoleOptionParser;
<ide> use Cake\Console\Shell;
<ide> use Cake\Core\Plugin;
<ide> use Cake\Utility\Inflector;
<ide> public function init($language = null)
<ide> * @return \Cake\Console\ConsoleOptionParser
<ide> * @throws \Cake\Console\Exception\ConsoleException
<ide> */
<del> public function getOptionParser()
<add> public function getOptionParser(): ConsoleOptionParser
<ide> {
<ide> $parser = parent::getOptionParser();
<ide> $initParser = [
<ide><path>src/Shell/PluginShell.php
<ide> */
<ide> namespace Cake\Shell;
<ide>
<add>use Cake\Console\ConsoleOptionParser;
<ide> use Cake\Console\Shell;
<ide> use Cake\Core\Plugin;
<ide>
<ide> public function loaded()
<ide> *
<ide> * @return \Cake\Console\ConsoleOptionParser
<ide> */
<del> public function getOptionParser()
<add> public function getOptionParser(): ConsoleOptionParser
<ide> {
<ide> $parser = parent::getOptionParser();
<ide>
<ide><path>src/Shell/RoutesShell.php
<ide> */
<ide> namespace Cake\Shell;
<ide>
<add>use Cake\Console\ConsoleOptionParser;
<ide> use Cake\Console\Shell;
<ide> use Cake\Http\ServerRequest;
<ide> use Cake\Routing\Exception\MissingRouteException;
<ide> public function generate()
<ide> *
<ide> * @return \Cake\Console\ConsoleOptionParser
<ide> */
<del> public function getOptionParser()
<add> public function getOptionParser(): ConsoleOptionParser
<ide> {
<ide> $parser = parent::getOptionParser();
<ide> $parser->setDescription(
<ide><path>src/Shell/SchemaCacheShell.php
<ide> */
<ide> namespace Cake\Shell;
<ide>
<add>use Cake\Console\ConsoleOptionParser;
<ide> use Cake\Console\Shell;
<ide> use Cake\Database\SchemaCache;
<ide> use Cake\Datasource\ConnectionManager;
<ide> protected function _getSchemaCache()
<ide> *
<ide> * @return \Cake\Console\ConsoleOptionParser
<ide> */
<del> public function getOptionParser()
<add> public function getOptionParser(): ConsoleOptionParser
<ide> {
<ide> $parser = parent::getOptionParser();
<ide> $parser->addSubcommand('clear', [
<ide><path>src/Shell/ServerShell.php
<ide>
<ide> namespace Cake\Shell;
<ide>
<add>use Cake\Console\ConsoleOptionParser;
<ide> use Cake\Console\Shell;
<ide> use Cake\Core\Configure;
<ide>
<ide> class ServerShell extends Shell
<ide> * @return void
<ide> * @link https://book.cakephp.org/3.0/en/console-and-shells.html#hook-methods
<ide> */
<del> public function startup()
<add> public function startup(): void
<ide> {
<ide> if ($this->param('host')) {
<ide> $this->_host = $this->param('host');
<ide> public function main()
<ide> *
<ide> * @return \Cake\Console\ConsoleOptionParser
<ide> */
<del> public function getOptionParser()
<add> public function getOptionParser(): ConsoleOptionParser
<ide> {
<ide> $parser = parent::getOptionParser();
<ide>
<ide><path>src/Shell/Task/AssetsTask.php
<ide> */
<ide> namespace Cake\Shell\Task;
<ide>
<add>use Cake\Console\ConsoleOptionParser;
<ide> use Cake\Console\Shell;
<ide> use Cake\Core\Plugin;
<ide> use Cake\Filesystem\Folder;
<ide> protected function _copyDirectory($source, $destination)
<ide> *
<ide> * @return \Cake\Console\ConsoleOptionParser
<ide> */
<del> public function getOptionParser()
<add> public function getOptionParser(): ConsoleOptionParser
<ide> {
<ide> $parser = parent::getOptionParser();
<ide>
<ide><path>src/Shell/Task/ExtractTask.php
<ide> */
<ide> namespace Cake\Shell\Task;
<ide>
<add>use Cake\Console\ConsoleOptionParser;
<ide> use Cake\Console\Shell;
<ide> use Cake\Core\App;
<ide> use Cake\Core\Plugin;
<ide> protected function _extract()
<ide> *
<ide> * @return \Cake\Console\ConsoleOptionParser
<ide> */
<del> public function getOptionParser()
<add> public function getOptionParser(): ConsoleOptionParser
<ide> {
<ide> $parser = parent::getOptionParser();
<ide> $parser->setDescription(
<ide><path>src/Shell/Task/LoadTask.php
<ide> */
<ide> namespace Cake\Shell\Task;
<ide>
<add>use Cake\Console\ConsoleOptionParser;
<ide> use Cake\Console\Shell;
<ide> use Cake\Filesystem\File;
<ide>
<ide> protected function _modifyBootstrap($plugin, $options)
<ide> *
<ide> * @return \Cake\Console\ConsoleOptionParser
<ide> */
<del> public function getOptionParser()
<add> public function getOptionParser(): ConsoleOptionParser
<ide> {
<ide> $parser = parent::getOptionParser();
<ide>
<ide><path>tests/test_app/TestApp/Shell/IntegrationShell.php
<ide> <?php
<ide> /**
<del> * IntegrationShell file
<del> *
<ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<ide> *
<ide> class IntegrationShell extends Shell
<ide> *
<ide> * @return ConsoleOptionParser
<ide> */
<del> public function getOptionParser()
<add> public function getOptionParser(): ConsoleOptionParser
<ide> {
<ide> $parser = new ConsoleOptionParser();
<ide> $argAndOptionParser = (new ConsoleOptionParser())
<ide><path>tests/test_app/TestApp/Shell/Task/SampleTask.php
<ide> <?php
<ide> /**
<del> * SampleTask file
<del> *
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide> *
<ide> */
<ide> namespace TestApp\Shell\Task;
<ide>
<add>use Cake\Console\ConsoleOptionParser;
<ide> use Cake\Console\Shell;
<ide>
<ide> class SampleTask extends Shell
<ide> {
<del> public function getOptionParser()
<add> public function getOptionParser(): ConsoleOptionParser
<ide> {
<ide> $parser = parent::getOptionParser();
<ide> $parser->addOption('sample', [ | 14 |
Javascript | Javascript | fix parseashtml link | b43c09c372a2aaf74e7c15bd44095b279a2f4632 | <ide><path>src/ng/sce.js
<ide> function $SceDelegateProvider() {
<ide> * {@link ng.$sce#getTrusted $sce.getTrusted} behind the scenes on non-constant literals.
<ide> *
<ide> * As an example, {@link ng.directive:ngBindHtml ngBindHtml} uses {@link
<del> * ng.$sce#parseHtml $sce.parseAsHtml(binding expression)}. Here's the actual code (slightly
<add> * ng.$sce#parseAsHtml $sce.parseAsHtml(binding expression)}. Here's the actual code (slightly
<ide> * simplified):
<ide> *
<ide> * <pre class="prettyprint"> | 1 |
Go | Go | remove redundant warning | f3dc35169780e1555b4116986649b729cb80b5d1 | <ide><path>pkg/sysinfo/sysinfo.go
<ide> func New(quiet bool) *SysInfo {
<ide> sysInfo := &SysInfo{}
<ide> if cgroupMemoryMountpoint, err := cgroups.FindCgroupMountpoint("memory"); err != nil {
<ide> if !quiet {
<del> logrus.Warnf("%s", err)
<add> logrus.Warnf("%v", err)
<ide> }
<ide> } else {
<ide> _, err1 := ioutil.ReadFile(path.Join(cgroupMemoryMountpoint, "memory.limit_in_bytes"))
<ide> _, err2 := ioutil.ReadFile(path.Join(cgroupMemoryMountpoint, "memory.soft_limit_in_bytes"))
<ide> sysInfo.MemoryLimit = err1 == nil && err2 == nil
<ide> if !sysInfo.MemoryLimit && !quiet {
<del> logrus.Warnf("Your kernel does not support cgroup memory limit.")
<add> logrus.Warn("Your kernel does not support cgroup memory limit.")
<ide> }
<ide>
<ide> _, err = ioutil.ReadFile(path.Join(cgroupMemoryMountpoint, "memory.memsw.limit_in_bytes"))
<ide> sysInfo.SwapLimit = err == nil
<ide> if !sysInfo.SwapLimit && !quiet {
<del> logrus.Warnf("Your kernel does not support cgroup swap limit.")
<add> logrus.Warn("Your kernel does not support cgroup swap limit.")
<ide> }
<ide> }
<ide>
<ide> if cgroupCpuMountpoint, err := cgroups.FindCgroupMountpoint("cpu"); err != nil {
<ide> if !quiet {
<del> logrus.Warnf("WARING: %s\n", err)
<add> logrus.Warnf("%v", err)
<ide> }
<ide> } else {
<ide> _, err1 := ioutil.ReadFile(path.Join(cgroupCpuMountpoint, "cpu.cfs_quota_us"))
<del> logrus.Warnf("%s", cgroupCpuMountpoint)
<ide> sysInfo.CpuCfsQuota = err1 == nil
<ide> if !sysInfo.CpuCfsQuota && !quiet {
<del> logrus.Warnf("WARING: Your kernel does not support cgroup cfs quotas")
<add> logrus.Warn("Your kernel does not support cgroup cfs quotas")
<ide> }
<ide> }
<ide> | 1 |
Go | Go | check err and add print | 130d1491b7d813937d30169829d95ad58e0b54a6 | <ide><path>daemon/checkpoint.go
<ide> func (daemon *Daemon) CheckpointCreate(name string, config types.CheckpointCreat
<ide> }
<ide>
<ide> checkpointDir, err := getCheckpointDir(config.CheckpointDir, config.CheckpointID, name, container.ID, container.CheckpointDir(), true)
<del>
<ide> if err != nil {
<ide> return fmt.Errorf("cannot checkpoint container %s: %s", name, err)
<ide> }
<ide> func (daemon *Daemon) CheckpointList(name string, config types.CheckpointListOpt
<ide> }
<ide>
<ide> checkpointDir, err := getCheckpointDir(config.CheckpointDir, "", name, container.ID, container.CheckpointDir(), true)
<add> if err != nil {
<add> return nil, err
<add> }
<ide>
<ide> if err := os.MkdirAll(checkpointDir, 0755); err != nil {
<ide> return nil, err | 1 |
PHP | PHP | add multibytepattern option to route | 6617c140c37fe1d7b99e1efb8721568ca0dc20ce | <ide><path>src/Routing/Route/Route.php
<ide> protected function _writeRoute()
<ide> $parsed = preg_replace('#/\\\\\*$#', '(?:/(?P<_args_>.*))?', $parsed);
<ide> $this->_greedy = true;
<ide> }
<add> $mode = '';
<add> if (!empty($this->options['multibytePattern'])) {
<add> $mode = 'u';
<add> }
<ide> krsort($routeParams);
<ide> $parsed = str_replace(array_keys($routeParams), array_values($routeParams), $parsed);
<del> $this->_compiledRoute = '#^' . $parsed . '[/]*$#u';
<add> $this->_compiledRoute = '#^' . $parsed . '[/]*$#' . $mode;
<ide> $this->keys = $names;
<ide>
<ide> // Remove defaults that are also keys. They can cause match failures
<ide><path>src/Routing/RouteBuilder.php
<ide> public function resources($name, $options = [], $callback = null)
<ide> * included when generating new URLs. You can override persistent parameters
<ide> * by redefining them in a URL or remove them by setting the parameter to `false`.
<ide> * Ex. `'persist' => ['lang']`
<add> * - `multibytePattern` Set to true to enable multibyte pattern support in route
<add> * parameter patterns.
<ide> * - `_name` is used to define a specific name for routes. This can be used to optimize
<ide> * reverse routing lookups. If undefined a name will be generated for each
<ide> * connected route.
<ide><path>tests/TestCase/Routing/Route/RouteTest.php
<ide> public function testRouteCompilingWithUnicodePatterns()
<ide> $route = new Route(
<ide> '/test/:slug',
<ide> ['controller' => 'Pages', 'action' => 'display'],
<del> ['pass' => ['slug'], 'slug' => '[A-zА-я\-\ ]+']
<add> ['pass' => ['slug'], 'multibytePattern' => false, 'slug' => '[A-zА-я\-\ ]+']
<add> );
<add> $result = $route->compile();
<add> $this->assertNotRegExp($result, '/test/bla-blan-тест');
<add>
<add> $route = new Route(
<add> '/test/:slug',
<add> ['controller' => 'Pages', 'action' => 'display'],
<add> ['pass' => ['slug'], 'multibytePattern' => true, 'slug' => '[A-zА-я\-\ ]+']
<ide> );
<ide> $result = $route->compile();
<del> $this->assertRegExp($result, '/test/abcDEF');
<ide> $this->assertRegExp($result, '/test/bla-blan-тест');
<del> $this->assertNotRegExp($result, '/test/9999');
<ide> }
<ide>
<ide> /** | 3 |
Javascript | Javascript | use object.keys to improve performance | 04468db44185e3d7968abdb23d77bf623cb5021b | <ide><path>src/Angular.js
<ide> function copy(source, destination, stackSource, stackDest) {
<ide> * Creates a shallow copy of an object, an array or a primitive
<ide> */
<ide> function shallowCopy(src, dst) {
<add> var i = 0;
<ide> if (isArray(src)) {
<ide> dst = dst || [];
<ide>
<del> for ( var i = 0; i < src.length; i++) {
<add> for (; i < src.length; i++) {
<ide> dst[i] = src[i];
<ide> }
<ide> } else if (isObject(src)) {
<ide> dst = dst || {};
<ide>
<del> for (var key in src) {
<del> if (hasOwnProperty.call(src, key) && !(key.charAt(0) === '$' && key.charAt(1) === '$')) {
<add> var keys = Object.keys(src);
<add>
<add> for (var l = keys.length; i < l; i++) {
<add> var key = keys[i];
<add>
<add> if (!(key.charAt(0) === '$' && key.charAt(1) === '$')) {
<ide> dst[key] = src[key];
<ide> }
<ide> } | 1 |
PHP | PHP | preserve language case | e8734f2828a73859532059d2f1002fb068297640 | <ide><path>src/Shell/I18nShell.php
<ide> <?php
<ide> /**
<del> * Internationalization Management Shell
<del> *
<ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<ide> *
<ide> public function main()
<ide> public function init($language = null)
<ide> {
<ide> if (!$language) {
<del> $language = strtolower($this->in('Please specify language code, e.g. `en`, `eng`, `en_US` etc.'));
<add> $language = $this->in('Please specify language code, e.g. `en`, `eng`, `en_US` etc.');
<ide> }
<ide> if (strlen($language) < 2) {
<ide> return $this->error('Invalid language code. Valid is `en`, `eng`, `en_US` etc.');
<ide><path>tests/TestCase/Shell/I18nShellTest.php
<ide> public function tearDown()
<ide> {
<ide> parent::tearDown();
<ide>
<del> $deDir = $this->localeDir . 'de' . DS;
<add> $deDir = $this->localeDir . 'de_DE' . DS;
<ide>
<ide> unlink($this->localeDir . 'default.pot');
<ide> unlink($this->localeDir . 'cake.pot');
<ide> public function tearDown()
<ide> */
<ide> public function testInit()
<ide> {
<del> $deDir = $this->localeDir . 'de' . DS;
<add> $deDir = $this->localeDir . 'de_DE' . DS;
<ide> if (!is_dir($deDir)) {
<ide> mkdir($deDir, 0770, true);
<ide> }
<ide> public function testInit()
<ide>
<ide> $this->shell->io()->expects($this->at(0))
<ide> ->method('ask')
<del> ->will($this->returnValue('de'));
<add> ->will($this->returnValue('de_DE'));
<ide> $this->shell->io()->expects($this->at(1))
<ide> ->method('ask')
<ide> ->will($this->returnValue($this->localeDir)); | 2 |
Javascript | Javascript | fix flaky doctool and test | f4f856b2381d10de48534e0de97df142f3e29994 | <ide><path>test/doctool/test-doctool-html.js
<ide> const remark2rehype = require('remark-rehype');
<ide> const raw = require('rehype-raw');
<ide> const htmlStringify = require('rehype-stringify');
<ide>
<del>function toHTML({ input, filename, nodeVersion }, cb) {
<add>async function toHTML({ input, filename, nodeVersion }) {
<ide> const content = unified()
<ide> .use(markdown)
<ide> .use(html.firstHeader)
<ide> function toHTML({ input, filename, nodeVersion }, cb) {
<ide> .use(htmlStringify)
<ide> .processSync(input);
<ide>
<del> html.toHTML(
<del> { input, content, filename, nodeVersion },
<del> cb
<del> );
<add> return html.toHTML({ input, content, filename, nodeVersion });
<ide> }
<ide>
<ide> // Test data is a list of objects with two properties.
<ide> testData.forEach(({ file, html }) => {
<ide> // Normalize expected data by stripping whitespace.
<ide> const expected = html.replace(spaces, '');
<ide>
<del> readFile(file, 'utf8', common.mustCall((err, input) => {
<add> readFile(file, 'utf8', common.mustCall(async (err, input) => {
<ide> assert.ifError(err);
<del> toHTML(
<del> {
<del> input: input,
<del> filename: 'foo',
<del> nodeVersion: process.version,
<del> },
<del> common.mustCall((err, output) => {
<del> assert.ifError(err);
<add> const output = await toHTML({ input: input,
<add> filename: 'foo',
<add> nodeVersion: process.version });
<ide>
<del> const actual = output.replace(spaces, '');
<del> // Assert that the input stripped of all whitespace contains the
<del> // expected markup.
<del> assert(actual.includes(expected),
<del> `ACTUAL: ${actual}\nEXPECTED: ${expected}`);
<del> })
<del> );
<add> const actual = output.replace(spaces, '');
<add> // Assert that the input stripped of all whitespace contains the
<add> // expected markup.
<add> assert(actual.includes(expected),
<add> `ACTUAL: ${actual}\nEXPECTED: ${expected}`);
<ide> }));
<ide> });
<ide><path>tools/doc/generate.js
<ide> if (!filename) {
<ide> }
<ide>
<ide>
<del>fs.readFile(filename, 'utf8', (er, input) => {
<add>fs.readFile(filename, 'utf8', async (er, input) => {
<ide> if (er) throw er;
<ide>
<ide> const content = unified()
<ide> fs.readFile(filename, 'utf8', (er, input) => {
<ide>
<ide> const basename = path.basename(filename, '.md');
<ide>
<del> html.toHTML(
<del> { input, content, filename, nodeVersion },
<del> (err, html) => {
<del> const target = path.join(outputDir, `${basename}.html`);
<del> if (err) throw err;
<del> fs.writeFileSync(target, html);
<del> }
<del> );
<add> const myHtml = await html.toHTML({ input, content, filename, nodeVersion });
<add> const htmlTarget = path.join(outputDir, `${basename}.html`);
<add> fs.writeFileSync(htmlTarget, myHtml);
<ide>
<del> const target = path.join(outputDir, `${basename}.json`);
<del> fs.writeFileSync(target, JSON.stringify(content.json, null, 2));
<add> const jsonTarget = path.join(outputDir, `${basename}.json`);
<add> fs.writeFileSync(jsonTarget, JSON.stringify(content.json, null, 2));
<ide> });
<ide><path>tools/doc/html.js
<ide> const gtocHTML = unified()
<ide> const templatePath = path.join(docPath, 'template.html');
<ide> const template = fs.readFileSync(templatePath, 'utf8');
<ide>
<del>async function toHTML({ input, content, filename, nodeVersion }, cb) {
<add>async function toHTML({ input, content, filename, nodeVersion }) {
<ide> filename = path.basename(filename, '.md');
<ide>
<ide> const id = filename.replace(/\W+/g, '-');
<ide> async function toHTML({ input, content, filename, nodeVersion }, cb) {
<ide> HTML = HTML.replace('__ALTDOCS__', '');
<ide> }
<ide>
<del> cb(null, HTML);
<add> return HTML;
<ide> }
<ide>
<ide> // Set the section name based on the first header. Default to 'Index'. | 3 |
Go | Go | remove panic in nat package on invalid hostport | 12b6083c8f82db7e5db4c683cfe20151731ea851 | <ide><path>api/client/port.go
<ide> func (cli *DockerCli) CmdPort(args ...string) error {
<ide> proto = parts[1]
<ide> }
<ide> natPort := port + "/" + proto
<del> if frontends, exists := c.NetworkSettings.Ports[nat.Port(port+"/"+proto)]; exists && frontends != nil {
<add> newP, err := nat.NewPort(proto, port)
<add> if err != nil {
<add> return err
<add> }
<add> if frontends, exists := c.NetworkSettings.Ports[newP]; exists && frontends != nil {
<ide> for _, frontend := range frontends {
<ide> fmt.Fprintf(cli.out, "%s:%s\n", frontend.HostIp, frontend.HostPort)
<ide> }
<ide><path>daemon/container_unix.go
<ide> func (container *Container) buildPortMapInfo(n libnetwork.Network, ep libnetwork
<ide> if expData, ok := driverInfo[netlabel.ExposedPorts]; ok {
<ide> if exposedPorts, ok := expData.([]types.TransportPort); ok {
<ide> for _, tp := range exposedPorts {
<del> natPort := nat.NewPort(tp.Proto.String(), strconv.Itoa(int(tp.Port)))
<add> natPort, err := nat.NewPort(tp.Proto.String(), strconv.Itoa(int(tp.Port)))
<add> if err != nil {
<add> return nil, fmt.Errorf("Error parsing Port value(%s):%v", tp.Port, err)
<add> }
<ide> networkSettings.Ports[natPort] = nil
<ide> }
<ide> }
<ide> func (container *Container) buildPortMapInfo(n libnetwork.Network, ep libnetwork
<ide>
<ide> if portMapping, ok := mapData.([]types.PortBinding); ok {
<ide> for _, pp := range portMapping {
<del> natPort := nat.NewPort(pp.Proto.String(), strconv.Itoa(int(pp.Port)))
<add> natPort, err := nat.NewPort(pp.Proto.String(), strconv.Itoa(int(pp.Port)))
<add> if err != nil {
<add> return nil, err
<add> }
<ide> natBndg := nat.PortBinding{HostIp: pp.HostIP.String(), HostPort: strconv.Itoa(int(pp.HostPort))}
<ide> networkSettings.Ports[natPort] = append(networkSettings.Ports[natPort], natBndg)
<ide> }
<ide> func (container *Container) buildCreateEndpointOptions() ([]libnetwork.EndpointO
<ide> binding := bindings[port]
<ide> for i := 0; i < len(binding); i++ {
<ide> pbCopy := pb.GetCopy()
<del> pbCopy.HostPort = uint16(nat.Port(binding[i].HostPort).Int())
<add> newP, err := nat.NewPort(nat.SplitProtoPort(binding[i].HostPort))
<add> if err != nil {
<add> return nil, fmt.Errorf("Error parsing HostPort value(%s):%v", binding[i].HostPort, err)
<add> }
<add> pbCopy.HostPort = uint16(newP.Int())
<ide> pbCopy.HostIP = net.ParseIP(binding[i].HostIp)
<ide> pbList = append(pbList, pbCopy)
<ide> }
<ide><path>daemon/daemon_unix.go
<ide> func (daemon *Daemon) verifyContainerSettings(hostConfig *runconfig.HostConfig,
<ide> for port := range hostConfig.PortBindings {
<ide> _, portStr := nat.SplitProtoPort(string(port))
<ide> if _, err := nat.ParsePort(portStr); err != nil {
<del> return warnings, fmt.Errorf("Invalid port specification: %s", portStr)
<add> return warnings, fmt.Errorf("Invalid port specification: %q", portStr)
<add> }
<add> for _, pb := range hostConfig.PortBindings[port] {
<add> _, err := nat.NewPort(nat.SplitProtoPort(pb.HostPort))
<add> if err != nil {
<add> return warnings, fmt.Errorf("Invalid port specification: %q", pb.HostPort)
<add> }
<ide> }
<ide> }
<ide> if hostConfig.LxcConf.Len() > 0 && !strings.Contains(daemon.ExecutionDriver().Name(), "lxc") {
<ide><path>daemon/list.go
<ide> func (daemon *Daemon) Containers(config *ContainersConfig) ([]*types.Container,
<ide>
<ide> newC.Ports = []types.Port{}
<ide> for port, bindings := range container.NetworkSettings.Ports {
<del> p, _ := nat.ParsePort(port.Port())
<add> p, err := nat.ParsePort(port.Port())
<add> if err != nil {
<add> return err
<add> }
<ide> if len(bindings) == 0 {
<ide> newC.Ports = append(newC.Ports, types.Port{
<ide> PrivatePort: p,
<ide> func (daemon *Daemon) Containers(config *ContainersConfig) ([]*types.Container,
<ide> continue
<ide> }
<ide> for _, binding := range bindings {
<del> h, _ := nat.ParsePort(binding.HostPort)
<add> h, err := nat.ParsePort(binding.HostPort)
<add> if err != nil {
<add> return err
<add> }
<ide> newC.Ports = append(newC.Ports, types.Port{
<ide> PrivatePort: p,
<ide> PublicPort: h,
<ide><path>integration-cli/docker_api_containers_test.go
<ide> func (s *DockerSuite) TestContainerApiCommitWithLabelInConfig(c *check.C) {
<ide> dockerCmd(c, "run", img.Id, "ls", "/test")
<ide> }
<ide>
<add>func (s *DockerSuite) TestContainerApiBadPort(c *check.C) {
<add> config := map[string]interface{}{
<add> "Image": "busybox",
<add> "Cmd": []string{"/bin/sh", "-c", "echo test"},
<add> "PortBindings": map[string]interface{}{
<add> "8080/tcp": []map[string]interface{}{
<add> {
<add> "HostIp": "",
<add> "HostPort": "aa80",
<add> },
<add> },
<add> },
<add> }
<add>
<add> jsonData := bytes.NewBuffer(nil)
<add> json.NewEncoder(jsonData).Encode(config)
<add>
<add> status, b, err := sockRequest("POST", "/containers/create", config)
<add> c.Assert(err, check.IsNil)
<add> c.Assert(status, check.Equals, http.StatusInternalServerError)
<add>
<add> if strings.TrimSpace(string(b)) != `Invalid port specification: "aa80"` {
<add> c.Fatalf("Incorrect error msg: %s", string(b))
<add> }
<add>}
<add>
<ide> func (s *DockerSuite) TestContainerApiCreate(c *check.C) {
<ide> config := map[string]interface{}{
<ide> "Image": "busybox",
<ide><path>links/links_test.go
<ide> import (
<ide> "github.com/docker/docker/pkg/nat"
<ide> )
<ide>
<add>// Just to make life easier
<add>func newPortNoError(proto, port string) nat.Port {
<add> p, _ := nat.NewPort(proto, port)
<add> return p
<add>}
<add>
<ide> func TestLinkNaming(t *testing.T) {
<ide> ports := make(nat.PortSet)
<del> ports[nat.Port("6379/tcp")] = struct{}{}
<add> ports[newPortNoError("tcp", "6379")] = struct{}{}
<ide>
<ide> link, err := NewLink("172.0.17.3", "172.0.17.2", "/db/docker-1", nil, ports)
<ide> if err != nil {
<ide> func TestLinkNaming(t *testing.T) {
<ide>
<ide> func TestLinkNew(t *testing.T) {
<ide> ports := make(nat.PortSet)
<del> ports[nat.Port("6379/tcp")] = struct{}{}
<add> ports[newPortNoError("tcp", "6379")] = struct{}{}
<ide>
<ide> link, err := NewLink("172.0.17.3", "172.0.17.2", "/db/docker", nil, ports)
<ide> if err != nil {
<ide> func TestLinkNew(t *testing.T) {
<ide> t.Fail()
<ide> }
<ide> for _, p := range link.Ports {
<del> if p != nat.Port("6379/tcp") {
<add> if p != newPortNoError("tcp", "6379") {
<ide> t.Fail()
<ide> }
<ide> }
<ide> }
<ide>
<ide> func TestLinkEnv(t *testing.T) {
<ide> ports := make(nat.PortSet)
<del> ports[nat.Port("6379/tcp")] = struct{}{}
<add> ports[newPortNoError("tcp", "6379")] = struct{}{}
<ide>
<ide> link, err := NewLink("172.0.17.3", "172.0.17.2", "/db/docker", []string{"PASSWORD=gordon"}, ports)
<ide> if err != nil {
<ide> func TestLinkEnv(t *testing.T) {
<ide>
<ide> func TestLinkMultipleEnv(t *testing.T) {
<ide> ports := make(nat.PortSet)
<del> ports[nat.Port("6379/tcp")] = struct{}{}
<del> ports[nat.Port("6380/tcp")] = struct{}{}
<del> ports[nat.Port("6381/tcp")] = struct{}{}
<add> ports[newPortNoError("tcp", "6379")] = struct{}{}
<add> ports[newPortNoError("tcp", "6380")] = struct{}{}
<add> ports[newPortNoError("tcp", "6381")] = struct{}{}
<ide>
<ide> link, err := NewLink("172.0.17.3", "172.0.17.2", "/db/docker", []string{"PASSWORD=gordon"}, ports)
<ide> if err != nil {
<ide> func TestLinkMultipleEnv(t *testing.T) {
<ide>
<ide> func TestLinkPortRangeEnv(t *testing.T) {
<ide> ports := make(nat.PortSet)
<del> ports[nat.Port("6379/tcp")] = struct{}{}
<del> ports[nat.Port("6380/tcp")] = struct{}{}
<del> ports[nat.Port("6381/tcp")] = struct{}{}
<add> ports[newPortNoError("tcp", "6379")] = struct{}{}
<add> ports[newPortNoError("tcp", "6380")] = struct{}{}
<add> ports[newPortNoError("tcp", "6381")] = struct{}{}
<ide>
<ide> link, err := NewLink("172.0.17.3", "172.0.17.2", "/db/docker", []string{"PASSWORD=gordon"}, ports)
<ide> if err != nil {
<ide><path>pkg/nat/nat.go
<ide> type PortSet map[Port]struct{}
<ide> // 80/tcp
<ide> type Port string
<ide>
<del>func NewPort(proto, port string) Port {
<del> return Port(fmt.Sprintf("%s/%s", port, proto))
<add>func NewPort(proto, port string) (Port, error) {
<add> // Check for parsing issues on "port" now so we can avoid having
<add> // to check it later on.
<add>
<add> portInt, err := ParsePort(port)
<add> if err != nil {
<add> return "", err
<add> }
<add>
<add> return Port(fmt.Sprintf("%d/%s", portInt, proto)), nil
<ide> }
<ide>
<ide> func ParsePort(rawPort string) (int, error) {
<ide> func (p Port) Port() string {
<ide> }
<ide>
<ide> func (p Port) Int() int {
<del> port, err := ParsePort(p.Port())
<del> if err != nil {
<del> panic(err)
<add> portStr := p.Port()
<add> if len(portStr) == 0 {
<add> return 0
<ide> }
<del> return port
<add>
<add> // We don't need to check for an error because we're going to
<add> // assume that any error would have been found, and reported, in NewPort()
<add> port, _ := strconv.ParseUint(portStr, 10, 16)
<add> return int(port)
<ide> }
<ide>
<ide> // Splits a port in the format of proto/port
<ide> func ParsePortSpecs(ports []string) (map[Port]struct{}, map[Port][]PortBinding,
<ide> if len(hostPort) > 0 {
<ide> hostPort = strconv.FormatUint(startHostPort+i, 10)
<ide> }
<del> port := NewPort(strings.ToLower(proto), containerPort)
<add> port, err := NewPort(strings.ToLower(proto), containerPort)
<add> if err != nil {
<add> return nil, nil, err
<add> }
<ide> if _, exists := exposedPorts[port]; !exists {
<ide> exposedPorts[port] = struct{}{}
<ide> }
<ide><path>pkg/nat/nat_test.go
<ide> func TestParsePort(t *testing.T) {
<ide> }
<ide>
<ide> func TestPort(t *testing.T) {
<del> p := NewPort("tcp", "1234")
<add> p, err := NewPort("tcp", "1234")
<add>
<add> if err != nil {
<add> t.Fatalf("tcp, 1234 had a parsing issue: %v", err)
<add> }
<ide>
<ide> if string(p) != "1234/tcp" {
<ide> t.Fatal("tcp, 1234 did not result in the string 1234/tcp")
<ide> func TestPort(t *testing.T) {
<ide> if p.Int() != 1234 {
<ide> t.Fatal("port int value was not 1234")
<ide> }
<add>
<add> p, err = NewPort("tcp", "asd1234")
<add> if err == nil {
<add> t.Fatal("tcp, asd1234 was supposed to fail")
<add> }
<ide> }
<ide>
<ide> func TestSplitProtoPort(t *testing.T) {
<ide><path>runconfig/compare_test.go
<ide> import (
<ide> "github.com/docker/docker/pkg/nat"
<ide> )
<ide>
<add>// Just to make life easier
<add>func newPortNoError(proto, port string) nat.Port {
<add> p, _ := nat.NewPort(proto, port)
<add> return p
<add>}
<add>
<ide> func TestCompare(t *testing.T) {
<ide> ports1 := make(nat.PortSet)
<del> ports1[nat.Port("1111/tcp")] = struct{}{}
<del> ports1[nat.Port("2222/tcp")] = struct{}{}
<add> ports1[newPortNoError("tcp", "1111")] = struct{}{}
<add> ports1[newPortNoError("tcp", "2222")] = struct{}{}
<ide> ports2 := make(nat.PortSet)
<del> ports2[nat.Port("3333/tcp")] = struct{}{}
<del> ports2[nat.Port("4444/tcp")] = struct{}{}
<add> ports2[newPortNoError("tcp", "3333")] = struct{}{}
<add> ports2[newPortNoError("tcp", "4444")] = struct{}{}
<ide> ports3 := make(nat.PortSet)
<del> ports3[nat.Port("1111/tcp")] = struct{}{}
<del> ports3[nat.Port("2222/tcp")] = struct{}{}
<del> ports3[nat.Port("5555/tcp")] = struct{}{}
<add> ports3[newPortNoError("tcp", "1111")] = struct{}{}
<add> ports3[newPortNoError("tcp", "2222")] = struct{}{}
<add> ports3[newPortNoError("tcp", "5555")] = struct{}{}
<ide> volumes1 := make(map[string]struct{})
<ide> volumes1["/test1"] = struct{}{}
<ide> volumes2 := make(map[string]struct{})
<ide><path>runconfig/merge_test.go
<ide> func TestMerge(t *testing.T) {
<ide> volumesImage["/test1"] = struct{}{}
<ide> volumesImage["/test2"] = struct{}{}
<ide> portsImage := make(nat.PortSet)
<del> portsImage[nat.Port("1111/tcp")] = struct{}{}
<del> portsImage[nat.Port("2222/tcp")] = struct{}{}
<add> portsImage[newPortNoError("tcp", "1111")] = struct{}{}
<add> portsImage[newPortNoError("tcp", "2222")] = struct{}{}
<ide> configImage := &Config{
<ide> ExposedPorts: portsImage,
<ide> Env: []string{"VAR1=1", "VAR2=2"},
<ide> Volumes: volumesImage,
<ide> }
<ide>
<ide> portsUser := make(nat.PortSet)
<del> portsUser[nat.Port("2222/tcp")] = struct{}{}
<del> portsUser[nat.Port("3333/tcp")] = struct{}{}
<add> portsUser[newPortNoError("tcp", "2222")] = struct{}{}
<add> portsUser[newPortNoError("tcp", "3333")] = struct{}{}
<ide> volumesUser := make(map[string]struct{})
<ide> volumesUser["/test3"] = struct{}{}
<ide> configUser := &Config{
<ide><path>runconfig/parse.go
<ide> func Parse(cmd *flag.FlagSet, args []string) (*Config, *HostConfig, *flag.FlagSe
<ide> return nil, nil, cmd, fmt.Errorf("Invalid range format for --expose: %s, error: %s", e, err)
<ide> }
<ide> for i := start; i <= end; i++ {
<del> p := nat.NewPort(proto, strconv.FormatUint(i, 10))
<add> p, err := nat.NewPort(proto, strconv.FormatUint(i, 10))
<add> if err != nil {
<add> return nil, nil, cmd, err
<add> }
<ide> if _, exists := ports[p]; !exists {
<ide> ports[p] = struct{}{}
<ide> } | 11 |
Python | Python | improve executor validation in cli | 1e2837ac5498e72186a75a7efddf47c059e4a058 | <ide><path>airflow/cli/cli_parser.py
<ide> class DefaultHelpParser(argparse.ArgumentParser):
<ide>
<ide> def _check_value(self, action, value):
<ide> """Override _check_value and check conditionally added command"""
<del> executor = conf.get('core', 'EXECUTOR')
<del> if value == 'celery' and executor not in (CELERY_EXECUTOR, CELERY_KUBERNETES_EXECUTOR):
<del> message = f'celery subcommand works only with CeleryExecutor, your current executor: {executor}'
<del> raise ArgumentError(action, message)
<del> if value == 'kubernetes':
<add> if action.dest == 'subcommand' and value == 'celery':
<add> executor = conf.get('core', 'EXECUTOR')
<add> if executor not in (CELERY_EXECUTOR, CELERY_KUBERNETES_EXECUTOR):
<add> message = (
<add> f'celery subcommand works only with CeleryExecutor, your current executor: {executor}'
<add> )
<add> raise ArgumentError(action, message)
<add> if action.dest == 'subcommand' and value == 'kubernetes':
<ide> try:
<ide> import kubernetes.client # noqa: F401
<ide> except ImportError:
<ide><path>tests/cli/test_cli_parser.py
<ide> from unittest import TestCase
<ide>
<ide> import pytest
<add>from parameterized import parameterized
<ide>
<ide> from airflow.cli import cli_parser
<add>from tests.test_utils.config import conf_vars
<ide>
<ide> # Can not be `--snake_case` or contain uppercase letter
<ide> ILLEGAL_LONG_OPTION_PATTERN = re.compile("^--[a-z]+_[a-z]+|^--.*[A-Z].*")
<ide> def test_positive_int(self):
<ide> with pytest.raises(argparse.ArgumentTypeError):
<ide> cli_parser.positive_int(allow_zero=False)('0')
<ide> cli_parser.positive_int(allow_zero=True)('-1')
<add>
<add> def test_dag_parser_celery_command_require_celery_executor(self):
<add> with conf_vars({('core', 'executor'): 'SequentialExecutor'}), contextlib.redirect_stderr(
<add> io.StringIO()
<add> ) as stderr:
<add> parser = cli_parser.get_parser()
<add> with self.assertRaises(SystemExit):
<add> parser.parse_args(['celery'])
<add> stderr = stderr.getvalue()
<add> assert (
<add> "airflow command error: argument GROUP_OR_COMMAND: celery subcommand "
<add> "works only with CeleryExecutor, your current executor: SequentialExecutor, see help above."
<add> ) in stderr
<add>
<add> @parameterized.expand(["CeleryExecutor", "CeleryKubernetesExecutor"])
<add> def test_dag_parser_celery_command_accept_celery_executor(self, executor):
<add> with conf_vars({('core', 'executor'): executor}), contextlib.redirect_stderr(io.StringIO()) as stderr:
<add> parser = cli_parser.get_parser()
<add> with self.assertRaises(SystemExit):
<add> parser.parse_args(['celery'])
<add> stderr = stderr.getvalue()
<add> assert (
<add> "airflow celery command error: the following arguments are required: COMMAND, see help above."
<add> ) in stderr
<add>
<add> def test_dag_parser_config_command_dont_required_celery_executor(self):
<add> with conf_vars({('core', 'executor'): "CeleryExecutor"}), contextlib.redirect_stderr(
<add> io.StringIO()
<add> ) as stdout:
<add> parser = cli_parser.get_parser()
<add> parser.parse_args(['config', 'get-value', 'celery', 'broker-url'])
<add> assert stdout is not None | 2 |
Javascript | Javascript | split independent tests into separate files | 26e47efbca9e3c2a334430aa3c17f1c2a499b75e | <ide><path>test/parallel/test-fs-watch-enoent.js
<add>'use strict';
<add>const common = require('../common');
<add>const assert = require('assert');
<add>const fs = require('fs');
<add>
<add>assert.throws(function() {
<add> fs.watch('non-existent-file');
<add>}, function(err) {
<add> assert(err);
<add> assert(/non-existent-file/.test(err));
<add> assert.equal(err.filename, 'non-existent-file');
<add> return true;
<add>});
<add>
<add>const watcher = fs.watch(__filename);
<add>watcher.on('error', common.mustCall(function(err) {
<add> assert(err);
<add> assert(/non-existent-file/.test(err));
<add> assert.equal(err.filename, 'non-existent-file');
<add>}));
<add>watcher._handle.onchange(-1, 'ENOENT', 'non-existent-file');
<ide><path>test/sequential/test-fs-watch.js
<ide> assert.throws(function() {
<ide> w.stop();
<ide> }, TypeError);
<ide> oldhandle.stop(); // clean up
<del>
<del>assert.throws(function() {
<del> fs.watch('non-existent-file');
<del>}, function(err) {
<del> assert(err);
<del> assert(/non-existent-file/.test(err));
<del> assert.equal(err.filename, 'non-existent-file');
<del> return true;
<del>});
<del>
<del>var watcher = fs.watch(__filename);
<del>watcher.on('error', common.mustCall(function(err) {
<del> assert(err);
<del> assert(/non-existent-file/.test(err));
<del> assert.equal(err.filename, 'non-existent-file');
<del>}));
<del>watcher._handle.onchange(-1, 'ENOENT', 'non-existent-file'); | 2 |
Javascript | Javascript | fix $flowfixme in flatlist | 22a14199000ea994f24f6fe387ea26647af3c128 | <ide><path>Libraries/Lists/FlatList.js
<ide> const MetroListView = require('MetroListView'); // Used as a fallback legacy opt
<ide> const React = require('React');
<ide> const View = require('View');
<ide> const VirtualizedList = require('VirtualizedList');
<add>const ListView = require('ListView');
<ide>
<ide> const invariant = require('fbjs/lib/invariant');
<ide>
<ide> class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
<ide> * Scrolls to the end of the content. May be janky without `getItemLayout` prop.
<ide> */
<ide> scrollToEnd(params?: ?{animated?: ?boolean}) {
<del> this._listRef.scrollToEnd(params);
<add> if (this._listRef) {
<add> this._listRef.scrollToEnd(params);
<add> }
<ide> }
<ide>
<ide> /**
<ide> class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
<ide> viewOffset?: number,
<ide> viewPosition?: number,
<ide> }) {
<del> this._listRef.scrollToIndex(params);
<add> if (this._listRef) {
<add> this._listRef.scrollToIndex(params);
<add> }
<ide> }
<ide>
<ide> /**
<ide> class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
<ide> item: ItemT,
<ide> viewPosition?: number,
<ide> }) {
<del> this._listRef.scrollToItem(params);
<add> if (this._listRef) {
<add> this._listRef.scrollToItem(params);
<add> }
<ide> }
<ide>
<ide> /**
<ide> class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
<ide> * Check out [scrollToOffset](docs/virtualizedlist.html#scrolltooffset) of VirtualizedList
<ide> */
<ide> scrollToOffset(params: {animated?: ?boolean, offset: number}) {
<del> this._listRef.scrollToOffset(params);
<add> if (this._listRef) {
<add> this._listRef.scrollToOffset(params);
<add> }
<ide> }
<ide>
<ide> /**
<ide> class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
<ide> * taps on items or by navigation actions.
<ide> */
<ide> recordInteraction() {
<del> this._listRef.recordInteraction();
<add> if (this._listRef) {
<add> this._listRef.recordInteraction();
<add> }
<ide> }
<ide>
<ide> /**
<ide> class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
<ide> * @platform ios
<ide> */
<ide> flashScrollIndicators() {
<del> this._listRef.flashScrollIndicators();
<add> if (this._listRef) {
<add> this._listRef.flashScrollIndicators();
<add> }
<ide> }
<ide>
<ide> /**
<ide> class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
<ide> }
<ide>
<ide> _hasWarnedLegacy = false;
<del> _listRef: VirtualizedList;
<add> _listRef: null | VirtualizedList | ListView;
<ide> _virtualizedListPairs: Array<ViewabilityConfigCallbackPair> = [];
<ide>
<ide> _captureRef = ref => {
<del> /* $FlowFixMe(>=0.53.0 site=react_native_fb,react_native_oss) This comment
<del> * suppresses an error when upgrading Flow's support for React. To see the
<del> * error delete this comment and run Flow. */
<ide> this._listRef = ref;
<ide> };
<ide> | 1 |
Javascript | Javascript | drop the float mapping from cssprops | bbf334282b5c27394fc507b1778cf21850be7b93 | <ide><path>src/css.js
<ide> jQuery.extend( {
<ide>
<ide> // Add in properties whose names you wish to fix before
<ide> // setting or getting the value
<del> cssProps: {
<del> "float": "cssFloat"
<del> },
<add> cssProps: {},
<ide>
<ide> // Get and set the style property on a DOM Node
<ide> style: function( elem, name, value, extra ) { | 1 |
PHP | PHP | fail a response sequence when out of responses | 37d03d6002c6218e6147c4ee85187673fc7b61f2 | <ide><path>src/Illuminate/Http/Client/ResponseSequence.php
<ide>
<ide> namespace Illuminate\Http\Client;
<ide>
<add>use OutOfBoundsException;
<add>
<ide> class ResponseSequence
<ide> {
<ide> /**
<ide> class ResponseSequence
<ide> */
<ide> protected $responses;
<ide>
<add> /**
<add> * Indicates that invoking this sequence when it is empty should throw an exception.
<add> *
<add> * @var bool
<add> */
<add> protected $failWhenEmpty = true;
<add>
<ide> /**
<ide> * Create a new response sequence.
<ide> *
<ide> public function pushResponse($response)
<ide> return $this;
<ide> }
<ide>
<add> /**
<add> * Make the sequence return a default response when it is empty.
<add> *
<add> * @return $this
<add> */
<add> public function dontFailWhenEmpty()
<add> {
<add> $this->failWhenEmpty = false;
<add>
<add> return $this;
<add> }
<add>
<ide> /**
<ide> * Get the next response in the sequence.
<ide> *
<ide> * @return mixed
<ide> */
<ide> public function __invoke()
<ide> {
<add> if ($this->failWhenEmpty && count($this->responses) === 0) {
<add> throw new OutOfBoundsException('A request was made, but the response sequence is empty.');
<add> }
<add>
<ide> return array_shift($this->responses);
<ide> }
<ide> }
<ide><path>tests/Http/HttpClientTest.php
<ide> use Illuminate\Http\Client\Factory;
<ide> use Illuminate\Http\Client\PendingRequest;
<ide> use Illuminate\Support\Str;
<add>use OutOfBoundsException;
<ide> use PHPUnit\Framework\TestCase;
<ide>
<ide> class HttpClientTest extends TestCase
<ide> public function testSequenceBuilder()
<ide> $response = $factory->get('https://example.com');
<ide> $this->assertSame('', $response->body());
<ide> $this->assertSame(403, $response->status());
<add>
<add> $this->expectException(OutOfBoundsException::class);
<add>
<add> // The sequence is empty, it should throw an exception.
<add> $factory->get('https://example.com');
<add> }
<add>
<add> public function testSequenceBuilderCanKeepGoingWhenEmpty()
<add> {
<add> $factory = new Factory;
<add>
<add> $factory->fake([
<add> '*' => Factory::sequence()
<add> ->dontFailWhenEmpty()
<add> ->push('Ok'),
<add> ]);
<add>
<add> /** @var PendingRequest $factory */
<add> $response = $factory->get('https://example.com');
<add> $this->assertSame('Ok', $response->body());
<add>
<add> // The sequence is empty, but it should not fail.
<add> $factory->get('https://example.com');
<ide> }
<ide> } | 2 |
PHP | PHP | fix mockery test | 22e60f4741666aa01ee625ce7aac0fb5c6fd4986 | <ide><path>tests/View/ViewTest.php
<ide> public function testRenderProperlyRendersView()
<ide>
<ide> public function testRenderSectionsReturnsEnvironmentSections()
<ide> {
<del> $view = m::mock('Illuminate\View\View[render]');
<del> $view->__construct(m::mock('Illuminate\View\Environment'), m::mock('Illuminate\View\Engines\EngineInterface'), 'view', 'path', array());
<add> $view = m::mock('Illuminate\View\View[render]', array(
<add> m::mock('Illuminate\View\Environment'),
<add> m::mock('Illuminate\View\Engines\EngineInterface'),
<add> 'view',
<add> 'path',
<add> array()
<add> ));
<ide>
<ide> $view->shouldReceive('render')->with(m::type('Closure'))->once()->andReturn($sections = array('foo' => 'bar'));
<ide> $view->getEnvironment()->shouldReceive('getSections')->once()->andReturn($sections); | 1 |
PHP | PHP | add missing space | f7b91c635dbac81b53090ee0b84ff8ae73b43b02 | <ide><path>src/Illuminate/Queue/SyncQueue.php
<ide> public function push($job, $data = '', $queue = null)
<ide> {
<ide> $queueJob->fire();
<ide> }
<del> catch(Exception $e)
<add> catch (Exception $e)
<ide> {
<ide> $this->handleFailedJob($queueJob);
<ide> | 1 |
Python | Python | add type hints for tfdistilbert | 3f8360a7b68800dfc87d54a0f9d7ab16be531433 | <ide><path>src/transformers/models/distilbert/modeling_tf_distilbert.py
<ide> """
<ide>
<ide> import warnings
<add>from typing import Optional, Tuple, Union
<ide>
<add>import numpy as np
<ide> import tensorflow as tf
<ide>
<ide> from ...activations_tf import get_tf_activation
<ide> )
<ide> from ...modeling_tf_utils import (
<ide> TFMaskedLanguageModelingLoss,
<add> TFModelInputType,
<ide> TFMultipleChoiceLoss,
<ide> TFPreTrainedModel,
<ide> TFQuestionAnsweringLoss,
<ide> def __init__(self, config, *inputs, **kwargs):
<ide> )
<ide> def call(
<ide> self,
<del> input_ids=None,
<del> attention_mask=None,
<del> head_mask=None,
<del> inputs_embeds=None,
<del> output_attentions=None,
<del> output_hidden_states=None,
<del> return_dict=None,
<del> training=False,
<add> input_ids: Optional[TFModelInputType] = None,
<add> attention_mask: Optional[Union[np.ndarray, tf.Tensor]] = None,
<add> head_mask: Optional[Union[np.ndarray, tf.Tensor]] = None,
<add> inputs_embeds: Optional[Union[np.ndarray, tf.Tensor]] = None,
<add> output_attentions: Optional[bool] = None,
<add> output_hidden_states: Optional[bool] = None,
<add> return_dict: Optional[bool] = None,
<add> training: Optional[bool] = False,
<ide> **kwargs,
<del> ):
<add> ) -> Union[TFBaseModelOutput, Tuple[tf.Tensor]]:
<ide> inputs = input_processing(
<ide> func=self.call,
<ide> config=self.config,
<ide> def get_prefix_bias_name(self):
<ide> )
<ide> def call(
<ide> self,
<del> input_ids=None,
<del> attention_mask=None,
<del> head_mask=None,
<del> inputs_embeds=None,
<del> output_attentions=None,
<del> output_hidden_states=None,
<del> return_dict=None,
<del> labels=None,
<del> training=False,
<add> input_ids: Optional[TFModelInputType] = None,
<add> attention_mask: Optional[Union[np.ndarray, tf.Tensor]] = None,
<add> head_mask: Optional[Union[np.ndarray, tf.Tensor]] = None,
<add> inputs_embeds: Optional[Union[np.ndarray, tf.Tensor]] = None,
<add> output_attentions: Optional[bool] = None,
<add> output_hidden_states: Optional[bool] = None,
<add> return_dict: Optional[bool] = None,
<add> labels: Optional[Union[np.ndarray, tf.Tensor]] = None,
<add> training: Optional[bool] = False,
<ide> **kwargs,
<del> ):
<add> ) -> Union[TFMaskedLMOutput, Tuple[tf.Tensor]]:
<ide> r"""
<ide> labels (`tf.Tensor` of shape `(batch_size, sequence_length)`, *optional*):
<ide> Labels for computing the masked language modeling loss. Indices should be in `[-100, 0, ...,
<ide> def __init__(self, config, *inputs, **kwargs):
<ide> )
<ide> def call(
<ide> self,
<del> input_ids=None,
<del> attention_mask=None,
<del> head_mask=None,
<del> inputs_embeds=None,
<del> output_attentions=None,
<del> output_hidden_states=None,
<del> return_dict=None,
<del> labels=None,
<del> training=False,
<add> input_ids: Optional[TFModelInputType] = None,
<add> attention_mask: Optional[Union[np.ndarray, tf.Tensor]] = None,
<add> head_mask: Optional[Union[np.ndarray, tf.Tensor]] = None,
<add> inputs_embeds: Optional[Union[np.ndarray, tf.Tensor]] = None,
<add> output_attentions: Optional[bool] = None,
<add> output_hidden_states: Optional[bool] = None,
<add> return_dict: Optional[bool] = None,
<add> labels: Optional[Union[np.ndarray, tf.Tensor]] = None,
<add> training: Optional[bool] = False,
<ide> **kwargs,
<del> ):
<add> ) -> Union[TFSequenceClassifierOutput, Tuple[tf.Tensor]]:
<ide> r"""
<ide> labels (`tf.Tensor` of shape `(batch_size,)`, *optional*):
<ide> Labels for computing the sequence classification/regression loss. Indices should be in `[0, ...,
<ide> def __init__(self, config, *inputs, **kwargs):
<ide> )
<ide> def call(
<ide> self,
<del> input_ids=None,
<del> attention_mask=None,
<del> head_mask=None,
<del> inputs_embeds=None,
<del> output_attentions=None,
<del> output_hidden_states=None,
<del> return_dict=None,
<del> labels=None,
<del> training=False,
<add> input_ids: Optional[TFModelInputType] = None,
<add> attention_mask: Optional[Union[np.ndarray, tf.Tensor]] = None,
<add> head_mask: Optional[Union[np.ndarray, tf.Tensor]] = None,
<add> inputs_embeds: Optional[Union[np.ndarray, tf.Tensor]] = None,
<add> output_attentions: Optional[bool] = None,
<add> output_hidden_states: Optional[bool] = None,
<add> return_dict: Optional[bool] = None,
<add> labels: Optional[Union[np.ndarray, tf.Tensor]] = None,
<add> training: Optional[bool] = False,
<ide> **kwargs,
<del> ):
<add> ) -> Union[TFTokenClassifierOutput, Tuple[tf.Tensor]]:
<ide> r"""
<ide> labels (`tf.Tensor` of shape `(batch_size, sequence_length)`, *optional*):
<ide> Labels for computing the token classification loss. Indices should be in `[0, ..., config.num_labels - 1]`.
<ide> def dummy_inputs(self):
<ide> )
<ide> def call(
<ide> self,
<del> input_ids=None,
<del> attention_mask=None,
<del> head_mask=None,
<del> inputs_embeds=None,
<del> output_attentions=None,
<del> output_hidden_states=None,
<del> return_dict=None,
<del> labels=None,
<del> training=False,
<add> input_ids: Optional[TFModelInputType] = None,
<add> attention_mask: Optional[Union[np.ndarray, tf.Tensor]] = None,
<add> head_mask: Optional[Union[np.ndarray, tf.Tensor]] = None,
<add> inputs_embeds: Optional[Union[np.ndarray, tf.Tensor]] = None,
<add> output_attentions: Optional[bool] = None,
<add> output_hidden_states: Optional[bool] = None,
<add> return_dict: Optional[bool] = None,
<add> labels: Optional[Union[np.ndarray, tf.Tensor]] = None,
<add> training: Optional[bool] = False,
<ide> **kwargs,
<del> ):
<add> ) -> Union[TFMultipleChoiceModelOutput, Tuple[tf.Tensor]]:
<ide> r"""
<ide> labels (`tf.Tensor` of shape `(batch_size,)`, *optional*):
<ide> Labels for computing the multiple choice classification loss. Indices should be in `[0, ..., num_choices]`
<ide> def __init__(self, config, *inputs, **kwargs):
<ide> )
<ide> def call(
<ide> self,
<del> input_ids=None,
<del> attention_mask=None,
<del> head_mask=None,
<del> inputs_embeds=None,
<del> output_attentions=None,
<del> output_hidden_states=None,
<del> return_dict=None,
<del> start_positions=None,
<del> end_positions=None,
<del> training=False,
<add> input_ids: Optional[TFModelInputType] = None,
<add> attention_mask: Optional[Union[np.ndarray, tf.Tensor]] = None,
<add> head_mask: Optional[Union[np.ndarray, tf.Tensor]] = None,
<add> inputs_embeds: Optional[Union[np.ndarray, tf.Tensor]] = None,
<add> output_attentions: Optional[bool] = None,
<add> output_hidden_states: Optional[bool] = None,
<add> return_dict: Optional[bool] = None,
<add> start_positions: Optional[Union[np.ndarray, tf.Tensor]] = None,
<add> end_positions: Optional[Union[np.ndarray, tf.Tensor]] = None,
<add> training: Optional[bool] = False,
<ide> **kwargs,
<del> ):
<add> ) -> Union[TFQuestionAnsweringModelOutput, Tuple[tf.Tensor]]:
<ide> r"""
<ide> start_positions (`tf.Tensor` of shape `(batch_size,)`, *optional*):
<ide> Labels for position (index) of the start of the labelled span for computing the token classification loss. | 1 |
Javascript | Javascript | use lowercase method to account for undefined type | 066c049957a8af2fe449040eca2f1cb499655e32 | <ide><path>src/ng/directive/input.js
<ide> function addNativeHtml5Validators(ctrl, validatorName, badFlags, ignoreFlags, va
<ide> function textInputType(scope, element, attr, ctrl, $sniffer, $browser) {
<ide> var validity = element.prop(VALIDITY_STATE_PROPERTY);
<ide> var placeholder = element[0].placeholder, noevent = {};
<del> var type = element[0].type.toLowerCase();
<add> var type = lowercase(element[0].type);
<ide> ctrl.$$validityState = validity;
<ide>
<ide> // In composition mode, users are still inputing intermediate text buffer, | 1 |
Ruby | Ruby | improve phone_to api documentation [ci-skip] | 63edd5cd2fb776767bad755f3c42b7f62e1abb2e | <ide><path>actionview/lib/action_view/helpers/url_helper.rb
<ide> def sms_to(phone_number, name = nil, html_options = {}, &block)
<ide> content_tag("a", name || phone_number, html_options, &block)
<ide> end
<ide>
<del> # Creates a TEL anchor link tag to the specified +phone_number+, which is
<del> # also used as the name of the link unless +name+ is specified. Additional
<del> # HTML attributes for the link can be passed in +html_options+.
<add> # Creates a TEL anchor link tag to the specified +phone_number+. When the
<add> # link is clicked, the default app to make phone calls is opened and
<add> # prepopulated with the phone number.
<add> #
<add> # If +name+ is not specified, +phone_number+ will be used as the name of
<add> # the link.
<ide> #
<del> # When clicked, the default app to make calls is opened, and it
<del> # is prepopulated with the passed phone number and optional
<del> # +country_code+ value.
<add> # A +country_code+ option is supported, which prepends a plus sign and the
<add> # given country code to the linked phone number. For example,
<add> # <tt>country_code: "01"</tt> will prepend <tt>+01</tt> to the linked
<add> # phone number.
<ide> #
<del> # +phone_to+ has an optional +country_code+ option which automatically adds the country
<del> # code as well as the + sign in the phone numer that gets prepopulated,
<del> # for example if +country_code: "01"+ +\+01+ will be prepended to the
<del> # phone numer, by passing special keys to +html_options+.
<add> # Additional HTML attributes for the link can be passed via +html_options+.
<ide> #
<ide> # ==== Options
<del> # * <tt>:country_code</tt> - Prepends the country code to the number
<add> # * <tt>:country_code</tt> - Prepends the country code to the phone number
<ide> #
<ide> # ==== Examples
<ide> # phone_to "1234567890" | 1 |
Python | Python | fix first element in list being displayed as code | 5c11e767a7312a80f70fa5100b7df8b4e391c4e2 | <ide><path>keras/preprocessing/image_dataset.py
<ide> def image_dataset_from_directory(directory,
<ide> image files found in the directory. Labels should be sorted according
<ide> to the alphanumeric order of the image file paths
<ide> (obtained via `os.walk(directory)` in Python).
<del> label_mode:
<add> label_mode: String describing the encoding of `labels`. Options are:
<ide> - 'int': means that the labels are encoded as integers
<ide> (e.g. for `sparse_categorical_crossentropy` loss).
<ide> - 'categorical' means that the labels are | 1 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.