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
|
---|---|---|---|---|---|
Java | Java | add support to fabricuimanger to handle throwable | d2f05740a8e475108c23b2e24de9030a0cbb2a8d | <ide><path>ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java
<ide> public ReactShadowNode createNode(int reactTag,
<ide> mUIViewOperationQueue
<ide> .enqueueCreateView(rootNode.getThemedContext(), reactTag, viewName, styles);
<ide> return node;
<del> } catch (Exception e) {
<del> handleException(rootTag, e);
<add> } catch (Throwable t) {
<add> handleException(getRootNode(rootTag), t);
<ide> return null;
<ide> }
<ide> }
<ide> public ReactShadowNode cloneNode(ReactShadowNode node) {
<ide> ReactShadowNode clone = node.mutableCopy();
<ide> assertReactShadowNodeCopy(node, clone);
<ide> return clone;
<del> } catch (Exception e) {
<del> handleException(node.getThemedContext(), e);
<add> } catch (Throwable t) {
<add> handleException(node, t);
<ide> return null;
<ide> }
<ide> }
<ide> public ReactShadowNode cloneNodeWithNewChildren(ReactShadowNode node) {
<ide> ReactShadowNode clone = node.mutableCopyWithNewChildren();
<ide> assertReactShadowNodeCopy(node, clone);
<ide> return clone;
<del> } catch (Exception e) {
<del> handleException(node.getThemedContext(), e);
<add> } catch (Throwable t) {
<add> handleException(node, t);
<ide> return null;
<ide> }
<ide> }
<ide> public ReactShadowNode cloneNodeWithNewProps(
<ide> updateProps(clone, newProps);
<ide> assertReactShadowNodeCopy(node, clone);
<ide> return clone;
<del> } catch (Exception e) {
<del> handleException(node.getThemedContext(), e);
<add> } catch (Throwable t) {
<add> handleException(node, t);
<ide> return null;
<ide> }
<ide> }
<ide> public ReactShadowNode cloneNodeWithNewChildrenAndProps(
<ide> updateProps(clone, newProps);
<ide> assertReactShadowNodeCopy(node, clone);
<ide> return clone;
<del> } catch (Exception e) {
<del> handleException(node.getThemedContext(), e);
<del> getRootNode(1).getThemedContext().handleException(e);
<add> } catch (Throwable t) {
<add> handleException(node, t);
<ide> return null;
<ide> }
<ide> }
<ide> public void appendChild(ReactShadowNode parent, ReactShadowNode child) {
<ide> viewsToAdd,
<ide> null
<ide> );
<del> } catch (Exception e) {
<del> handleException(parent.getThemedContext(), e);
<add> } catch (Throwable t) {
<add> handleException(parent, t);
<ide> }
<ide> }
<ide>
<ide> public void completeRoot(int rootTag, List<ReactShadowNode> childList) {
<ide> mUIViewOperationQueue
<ide> .dispatchViewUpdates(1, System.currentTimeMillis(), System.currentTimeMillis());
<ide> } catch (Exception e) {
<del> handleException(rootTag, e);
<add> handleException(getRootNode(rootTag), e);
<ide> }
<ide> }
<ide>
<ide> public void updateRootView(
<ide> }
<ide> }
<ide>
<del> private void handleException(ThemedReactContext context, Exception e) {
<add> private void handleException(ReactShadowNode node, Throwable t) {
<ide> try {
<del> context.handleException(e);
<add> ThemedReactContext context = node.getThemedContext();
<add> // TODO move exception management to JNI side, and refactor to avoid wrapping Throwable into
<add> // a RuntimeException
<add> context.handleException(new RuntimeException(t));
<ide> } catch (Exception ex) {
<del> Log.e(TAG, "Exception while executing a Fabric method", e);
<del> throw new RuntimeException(ex.getMessage(), e);
<add> Log.e(TAG, "Exception while executing a Fabric method", t);
<add> throw new RuntimeException(ex.getMessage(), t);
<ide> }
<ide> }
<ide>
<del> private void handleException(int rootTag, Exception e) {
<del> handleException(getRootNode(rootTag).getThemedContext(), e);
<del> }
<ide> } | 1 |
Javascript | Javascript | remove unneeded parameters | 79b1f64acb4a0975fda7c23f70831e14da1fcaf6 | <ide><path>examples/js/loaders/FBXLoader.js
<ide> THREE.FBXLoader = ( function () {
<ide> switch ( type ) {
<ide>
<ide> case 'Bump':
<del> parameters.bumpMap = self.getTexture( FBXTree, textureMap, child.ID, connections );
<add> parameters.bumpMap = self.getTexture( textureMap, child.ID );
<ide> break;
<ide>
<ide> case 'DiffuseColor': | 1 |
PHP | PHP | add disk facade | 0ec2d01fa4654a167b723ae20b0ac0b3e055ffba | <ide><path>config/app.php
<ide> 'Cookie' => 'Illuminate\Support\Facades\Cookie',
<ide> 'Crypt' => 'Illuminate\Support\Facades\Crypt',
<ide> 'DB' => 'Illuminate\Support\Facades\DB',
<add> 'Disk' => 'Illuminate\Support\Facades\Disk',
<ide> 'Eloquent' => 'Illuminate\Database\Eloquent\Model',
<ide> 'Event' => 'Illuminate\Support\Facades\Event',
<ide> 'File' => 'Illuminate\Support\Facades\File', | 1 |
Python | Python | add couple of tests for compat module | 9c8adb4812d08020c91bac71fe5f3605c97609dd | <ide><path>tests/test_compat.py
<add>from django.test import TestCase
<add>
<add>from rest_framework import compat
<add>
<add>
<add>class CompatTests(TestCase):
<add>
<add> def test_total_seconds(self):
<add> class MockTimedelta(object):
<add> days = 1
<add> seconds = 1
<add> microseconds = 100
<add> timedelta = MockTimedelta()
<add> expected = (timedelta.days * 86400.0) + float(timedelta.seconds) + (timedelta.microseconds / 1000000.0)
<add> assert compat.total_seconds(timedelta) == expected
<add>
<add> def test_get_remote_field_with_old_django_version(self):
<add> class MockField(object):
<add> rel = 'example_rel'
<add> original_django_version = compat.django.VERSION
<add> compat.django.VERSION = (1, 8)
<add> assert compat.get_remote_field(MockField(), default='default_value') == 'example_rel'
<add> assert compat.get_remote_field(object(), default='default_value') == 'default_value'
<add> compat.django.VERSION = original_django_version
<add>
<add> def test_get_remote_field_with_new_django_version(self):
<add> class MockField(object):
<add> remote_field = 'example_remote_field'
<add> original_django_version = compat.django.VERSION
<add> compat.django.VERSION = (1, 10)
<add> assert compat.get_remote_field(MockField(), default='default_value') == 'example_remote_field'
<add> assert compat.get_remote_field(object(), default='default_value') == 'default_value'
<add> compat.django.VERSION = original_django_version
<add>
<add> def test_patch_in_http_method_names(self):
<add> assert 'patch' in compat.View.http_method_names
<add>
<add> def test_set_rollback_for_transaction_in_managed_mode(self):
<add> class MockTransaction(object):
<add> called_rollback = False
<add> called_leave_transaction_management = False
<add>
<add> def is_managed(self):
<add> return True
<add>
<add> def is_dirty(self):
<add> return True
<add>
<add> def rollback(self):
<add> self.called_rollback = True
<add>
<add> def leave_transaction_management(self):
<add> self.called_leave_transaction_management = True
<add>
<add> original_transaction = compat.transaction
<add> dirty_mock_transaction = MockTransaction()
<add> compat.transaction = dirty_mock_transaction
<add> compat.set_rollback()
<add> assert dirty_mock_transaction.called_rollback is True
<add> assert dirty_mock_transaction.called_leave_transaction_management is True
<add>
<add> clean_mock_transaction = MockTransaction()
<add> clean_mock_transaction.is_dirty = lambda: False
<add> compat.transaction = clean_mock_transaction
<add> compat.set_rollback()
<add> assert clean_mock_transaction.called_rollback is False
<add> assert clean_mock_transaction.called_leave_transaction_management is True
<add>
<add> compat.transaction = original_transaction | 1 |
Javascript | Javascript | keep process prototype in inheritance chain | cde272a066923a1b93a10a8121b0ce572308d13c | <ide><path>lib/internal/bootstrap_node.js
<ide> process._eventsCount = 0;
<ide>
<ide> const origProcProto = Object.getPrototypeOf(process);
<del> Object.setPrototypeOf(process, Object.create(EventEmitter.prototype, {
<del> constructor: Object.getOwnPropertyDescriptor(origProcProto, 'constructor')
<del> }));
<add> Object.setPrototypeOf(origProcProto, EventEmitter.prototype);
<ide>
<ide> EventEmitter.call(process);
<ide>
<ide><path>test/parallel/test-process-prototype.js
<ide> const EventEmitter = require('events');
<ide>
<ide> const proto = Object.getPrototypeOf(process);
<ide>
<add>assert(process instanceof process.constructor);
<ide> assert(proto instanceof EventEmitter);
<ide>
<ide> const desc = Object.getOwnPropertyDescriptor(proto, 'constructor'); | 2 |
Text | Text | add v3.21.0-beta.2 to changelog | a43f203010669f22fca0277a9edf0231a3e94079 | <ide><path>CHANGELOG.md
<ide> # Ember Changelog
<ide>
<add>### v3.21.0-beta.2 (July 20, 2020)
<add>
<add>- [#19040](https://github.com/emberjs/ember.js/pull/19040) [BUGFIX] Fix a memory leak that occurred when changing the array passed to `{{each}}`
<add>- [#19047](https://github.com/emberjs/ember.js/pull/19047) [BUGFIX] Ensure `inject-babel-helpers` plugin can be parallelized
<add>
<ide> ### v3.21.0-beta.1 (July 13, 2020)
<ide>
<ide> - [#18993](https://github.com/emberjs/ember.js/pull/18993) [DEPRECATION] Deprecate `getWithDefault` per [RFC #554](https://github.com/emberjs/rfcs/blob/master/text/0554-deprecate-getwithdefault.md). | 1 |
Ruby | Ruby | remove patchelf exemption | 2d95b9acda5b56380a3ca603fd2e0a0afbfa91f0 | <ide><path>Library/Homebrew/extend/os/linux/keg_relocate.rb
<ide> def relocate_dynamic_linkage(relocation)
<ide> # Patching the dynamic linker of glibc breaks it.
<ide> return if name.match? Version.formula_optionally_versioned_regex(:glibc)
<ide>
<del> # Patching patchelf fails with "Text file busy" or SIGBUS.
<del> return if name == "patchelf"
<del>
<ide> old_prefix, new_prefix = relocation.replacement_pair_for(:prefix)
<ide>
<ide> elf_files.each do |file| | 1 |
Java | Java | introduce @nested tests with constructor injection | 75f70b269ed89294330758eb61ee8d7f218c9af6 | <ide><path>spring-test/src/test/java/org/springframework/test/context/junit/jupiter/nested/NestedTestsWithConstructorInjectionWithSpringAndJUnitJupiterTestCase.java
<add>/*
<add> * Copyright 2002-2018 the original author or authors.
<add> *
<add> * Licensed under the Apache License, Version 2.0 (the "License");
<add> * you may not use this file except in compliance with the License.
<add> * You may obtain a copy of the License at
<add> *
<add> * http://www.apache.org/licenses/LICENSE-2.0
<add> *
<add> * Unless required by applicable law or agreed to in writing, software
<add> * distributed under the License is distributed on an "AS IS" BASIS,
<add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<add> * See the License for the specific language governing permissions and
<add> * limitations under the License.
<add> */
<add>
<add>package org.springframework.test.context.junit.jupiter.nested;
<add>
<add>import org.junit.jupiter.api.Nested;
<add>import org.junit.jupiter.api.Test;
<add>
<add>import org.springframework.beans.factory.annotation.Autowired;
<add>import org.springframework.context.annotation.Bean;
<add>import org.springframework.context.annotation.Configuration;
<add>import org.springframework.test.context.junit.SpringJUnitJupiterTestSuite;
<add>import org.springframework.test.context.junit.jupiter.DisabledIf;
<add>import org.springframework.test.context.junit.jupiter.SpringExtension;
<add>import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
<add>import org.springframework.test.context.junit.jupiter.nested.NestedTestsWithConstructorInjectionWithSpringAndJUnitJupiterTestCase.TopLevelConfig;
<add>
<add>import static org.junit.jupiter.api.Assertions.*;
<add>
<add>/**
<add> * Integration tests that verify support for {@code @Nested} test classes in conjunction
<add> * with the {@link SpringExtension} in a JUnit Jupiter environment ... when using
<add> * constructor injection as opposed to field injection.
<add> *
<add> * <p>
<add> * To run these tests in an IDE that does not have built-in support for the JUnit
<add> * Platform, simply run {@link SpringJUnitJupiterTestSuite} as a JUnit 4 test.
<add> *
<add> * @author Sam Brannen
<add> * @since 5.0.5
<add> * @see NestedTestsWithSpringAndJUnitJupiterTestCase
<add> * @see org.springframework.test.context.junit4.nested.NestedTestsWithSpringRulesTests
<add> */
<add>@SpringJUnitConfig(TopLevelConfig.class)
<add>class NestedTestsWithConstructorInjectionWithSpringAndJUnitJupiterTestCase {
<add>
<add> final String foo;
<add>
<add> @Autowired
<add> NestedTestsWithConstructorInjectionWithSpringAndJUnitJupiterTestCase(String foo) {
<add> this.foo = foo;
<add> }
<add>
<add> @Test
<add> void topLevelTest() {
<add> assertEquals("foo", foo);
<add> }
<add>
<add> @Nested
<add> @SpringJUnitConfig(NestedConfig.class)
<add> class AutowiredConstructor {
<add>
<add> final String bar;
<add>
<add> // Only fails on JDK 8 if the parameter is annotated with @Autowired.
<add> // Works if the constructor itself is annotated with @Autowired.
<add> @Autowired
<add> AutowiredConstructor(String bar) {
<add> this.bar = bar;
<add> }
<add>
<add> @Test
<add> void nestedTest() throws Exception {
<add> assertEquals("foo", foo);
<add> assertEquals("bar", bar);
<add> }
<add> }
<add>
<add> @Nested
<add> @SpringJUnitConfig(NestedConfig.class)
<add> @DisabledIf(expression = "#{systemProperties['java.version'].startsWith('1.8')}", //
<add> reason = "Disabled on Java 8 due to a bug in javac in JDK 8")
<add> // See https://github.com/junit-team/junit5/issues/1345
<add> class AutowiredConstructorParameter {
<add>
<add> final String bar;
<add>
<add> // Only fails on JDK 8 if the parameter is annotated with @Autowired.
<add> // Works if the constructor itself is annotated with @Autowired.
<add> AutowiredConstructorParameter(@Autowired String bar) {
<add> this.bar = bar;
<add> }
<add>
<add> @Test
<add> void nestedTest() throws Exception {
<add> assertEquals("foo", foo);
<add> assertEquals("bar", bar);
<add> }
<add> }
<add>
<add> // -------------------------------------------------------------------------
<add>
<add> @Configuration
<add> static class TopLevelConfig {
<add>
<add> @Bean
<add> String foo() {
<add> return "foo";
<add> }
<add> }
<add>
<add> @Configuration
<add> static class NestedConfig {
<add>
<add> @Bean
<add> String bar() {
<add> return "bar";
<add> }
<add> }
<add>
<add>}
<ide><path>spring-test/src/test/java/org/springframework/test/context/junit/jupiter/nested/NestedTestsWithSpringAndJUnitJupiterTestCase.java
<ide> *
<ide> * @author Sam Brannen
<ide> * @since 5.0
<add> * @see NestedTestsWithConstructorInjectionWithSpringAndJUnitJupiterTestCase
<ide> * @see org.springframework.test.context.junit4.nested.NestedTestsWithSpringRulesTests
<ide> */
<ide> @SpringJUnitConfig(TopLevelConfig.class) | 2 |
Javascript | Javascript | delete all webglproperties on loss of context | dfaea63385328a89bc56f4f1f28e4dcaefdffbfe | <ide><path>src/renderers/WebGLRenderer.js
<ide> THREE.WebGLRenderer = function ( parameters ) {
<ide> setDefaultGLState();
<ide>
<ide> objects.objects = {};
<add> objects.webGLProps.deleteAll();
<add> webGLProps.deleteAll();
<ide>
<ide> }, false);
<ide>
<ide><path>src/renderers/webgl/WebGLObjects.js
<ide> THREE.WebGLObjects = function ( gl, info ) {
<ide>
<ide> this.objects = objects;
<ide> this.objectsImmediate = objectsImmediate;
<add> this.webGLProps = webGLProps;
<ide>
<ide> this.geometries = geometries;
<ide>
<ide><path>src/renderers/webgl/WebGLProperties.js
<ide> THREE.WebGLProperties = function () {
<ide>
<ide> var properties = {};
<ide>
<add> this.deleteAll = function () {
<add>
<add> properties = {};
<add>
<add> }
<add>
<ide> this.delete = function ( object ) {
<ide>
<ide> delete properties[ object.uuid ]; | 3 |
Text | Text | fix http2 example with rstwithcancel | ba4a0a6f5f9f0172e182da4e9000fec8956d0689 | <ide><path>doc/api/http2.md
<ide> const client = http2.connect('http://example.org:8000');
<ide> const req = client.request({ ':path': '/' });
<ide>
<ide> // Cancel the stream if there's no activity after 5 seconds
<del>req.setTimeout(5000, () => req.rstStreamWithCancel());
<add>req.setTimeout(5000, () => req.rstWithCancel());
<ide> ```
<ide>
<ide> #### http2stream.state | 1 |
Javascript | Javascript | move argument special casing to the helpers | 83209e5d909152cd13649b77b4b769d84445e1bc | <ide><path>packages/ember-htmlbars/lib/helpers/each.js
<ide> function eachHelper(params, hash, options, env) {
<ide> return env.helpers.collection.call(this, [EachView], hash, options, env);
<ide> }
<ide>
<add>eachHelper._preprocessArguments = function(view, params, hash, options, env) {
<add> if (params.length === 3 && params[1] === "in") {
<add> params.splice(0, 3, {
<add> from: params[2],
<add> to: params[0],
<add> stream: view.getStream(params[2])
<add> });
<add> options.types.splice(0, 3, 'keyword');
<add> }
<add>};
<add>
<ide> export {
<ide> EachView,
<ide> eachHelper
<ide><path>packages/ember-htmlbars/lib/helpers/with.js
<ide> export function withHelper(params, hash, options, env) {
<ide> bind.call(this, source, hash, options, env, preserveContext, exists, undefined, undefined, WithView);
<ide> }
<ide>
<add>withHelper._preprocessArguments = function(view, params, hash, options, env) {
<add> if (params.length === 3 && params[1] === "as") {
<add> params.splice(0, 3, {
<add> from: params[0],
<add> to: params[2],
<add> stream: view.getStream(params[0])
<add> });
<add>
<add> options.types.splice(0, 3, 'keyword');
<add> }
<add>};
<add>
<ide> function exists(value) {
<ide> return !isNone(value);
<ide> }
<ide><path>packages/ember-htmlbars/lib/hooks.js
<ide> import Ember from "ember-metal/core";
<ide> import { lookupHelper } from "ember-htmlbars/system/lookup-helper";
<ide> import { sanitizeOptionsForHelper } from "ember-htmlbars/system/sanitize-for-helper";
<ide>
<del>function streamifyArgs(view, params, hash, options, env) {
<del> if (params.length === 3 && params[1] === "as") {
<del> params.splice(0, 3, {
<del> from: params[0],
<del> to: params[2],
<del> stream: view.getStream(params[0])
<del> });
<del> options.types.splice(0, 3, 'keyword');
<del> } else if (params.length === 3 && params[1] === "in") {
<del> params.splice(0, 3, {
<del> from: params[2],
<del> to: params[0],
<del> stream: view.getStream(params[2])
<del> });
<del> options.types.splice(0, 3, 'keyword');
<del> } else {
<del> // Convert ID params to streams
<del> for (var i = 0, l = params.length; i < l; i++) {
<del> if (options.types[i] === 'id') {
<del> params[i] = view.getStream(params[i]);
<del> }
<add>function streamifyArgs(view, params, hash, options, env, helper) {
<add> if (helper._preprocessArguments) {
<add> helper._preprocessArguments(view, params, hash, options, env);
<add> }
<add>
<add> // Convert ID params to streams
<add> for (var i = 0, l = params.length; i < l; i++) {
<add> if (options.types[i] === 'id') {
<add> params[i] = view.getStream(params[i]);
<ide> }
<ide> }
<ide>
<ide> export function content(morph, path, view, params, hash, options, env) {
<ide> options.types = ['id'];
<ide> }
<ide>
<del> streamifyArgs(view, params, hash, options, env);
<add> streamifyArgs(view, params, hash, options, env, helper);
<ide> sanitizeOptionsForHelper(options);
<ide> return helper.call(view, params, hash, options, env);
<ide> }
<ide> export function component(morph, tagName, view, hash, options, env) {
<ide>
<ide> Ember.assert('You specified `' + tagName + '` in your template, but a component for `' + tagName + '` could not be found.', !!helper);
<ide>
<del> streamifyArgs(view, params, hash, options, env);
<add> streamifyArgs(view, params, hash, options, env, helper);
<ide> sanitizeOptionsForHelper(options);
<ide> return helper.call(view, params, hash, options, env);
<ide> }
<ide> export function element(element, path, view, params, hash, options, env) { //jsh
<ide> var helper = lookupHelper(path, view, env);
<ide>
<ide> if (helper) {
<del> streamifyArgs(view, params, hash, options, env);
<add> streamifyArgs(view, params, hash, options, env, helper);
<ide> sanitizeOptionsForHelper(options);
<ide> return helper.call(view, params, hash, options, env);
<ide> } else {
<ide> export function subexpr(path, view, params, hash, options, env) {
<ide> var helper = lookupHelper(path, view, env);
<ide>
<ide> if (helper) {
<del> streamifyArgs(view, params, hash, options, env);
<add> streamifyArgs(view, params, hash, options, env, helper);
<ide> sanitizeOptionsForHelper(options);
<ide> return helper.call(view, params, hash, options, env);
<ide> } else { | 3 |
Javascript | Javascript | remove proptypes from elementproperties | c650407fe913e4eb8e9899d1115fc98d491c0f3e | <ide><path>Libraries/Inspector/ElementProperties.js
<ide> 'use strict';
<ide>
<ide> const BoxInspector = require('BoxInspector');
<del>const PropTypes = require('prop-types');
<ide> const React = require('React');
<ide> const StyleInspector = require('StyleInspector');
<ide> const StyleSheet = require('StyleSheet');
<ide> const flattenStyle = require('flattenStyle');
<ide> const mapWithSeparator = require('mapWithSeparator');
<ide> const openFileInEditor = require('openFileInEditor');
<ide>
<del>import type {DangerouslyImpreciseStyleProp} from 'StyleSheet';
<add>import type {ViewStyleProp} from 'StyleSheet';
<ide>
<del>class ElementProperties extends React.Component<{
<add>type Props = $ReadOnly<{|
<ide> hierarchy: Array<$FlowFixMe>,
<del> style?: DangerouslyImpreciseStyleProp,
<del> source?: {
<add> style?: ?ViewStyleProp,
<add> source?: ?{
<ide> fileName?: string,
<ide> lineNumber?: number,
<ide> },
<del>}> {
<del> static propTypes = {
<del> hierarchy: PropTypes.array.isRequired,
<del> style: PropTypes.oneOfType([
<del> PropTypes.object,
<del> PropTypes.array,
<del> PropTypes.number,
<del> ]),
<del> source: PropTypes.shape({
<del> fileName: PropTypes.string,
<del> lineNumber: PropTypes.number,
<del> }),
<del> };
<add> frame?: ?Object,
<add> selection?: ?number,
<add> setSelection?: (number) => mixed,
<add>|}>;
<ide>
<add>class ElementProperties extends React.Component<Props> {
<ide> render() {
<ide> const style = flattenStyle(this.props.style);
<ide> // $FlowFixMe found when converting React.createClass to ES6 | 1 |
Python | Python | add missing docstring line | 7308416449ca1d39f42ab863ea3a8a797dc2b2b4 | <ide><path>libcloud/dns/base.py
<ide> def list_hosts(self, zone):
<ide>
<ide> def create_zone(self, type='master', ttl=None, extra=None):
<ide> """
<add> Create a new zone.
<add>
<ide> @type type: C{string}
<ide> @param type: Zone type (master / slave).
<ide> | 1 |
Ruby | Ruby | amend paths to check for chmods | 897dd14ae5ab775470264156ddd3645ffb37cfaa | <ide><path>install_homebrew.rb
<ide> def getc # NOTE only tested on OS X
<ide> puts "/usr/local/Library/Formula/..."
<ide> puts "/usr/local/Library/Homebrew/..."
<ide>
<del>chmods = %w(bin etc include lib libexec Library sbin share var . share/locale share/man share/info share/doc share/aclocal).
<add>chmods = %w(bin etc include lib lib/pkgconfig Library sbin share var . share/locale share/man share/man/man1 share/info share/doc share/aclocal).
<ide> map{ |d| "/usr/local/#{d}" }.
<ide> select{ |d| File.directory? d and not File.writable? d }
<ide> chgrps = chmods.reject{ |d| File.stat(d).grpowned? } | 1 |
PHP | PHP | break crawler logic into crawler trait | 2eed3b634937971edaf6df41c66bb799e3a7961a | <add><path>src/Illuminate/Foundation/Testing/CrawlerTrait.php
<del><path>src/Illuminate/Foundation/Testing/ApplicationTrait.php
<ide> use InvalidArgumentException;
<ide> use Symfony\Component\DomCrawler\Form;
<ide> use Symfony\Component\DomCrawler\Crawler;
<del>use Illuminate\Contracts\Auth\Authenticatable as UserContract;
<ide> use PHPUnit_Framework_ExpectationFailedException as PHPUnitException;
<ide>
<del>trait ApplicationTrait
<add>trait CrawlerTrait
<ide> {
<del> /**
<del> * The Illuminate application instance.
<del> *
<del> * @var \Illuminate\Foundation\Application
<del> */
<del> protected $app;
<del>
<ide> /**
<ide> * The last response returned by the application.
<ide> *
<ide> * @var \Illuminate\Http\Response
<ide> */
<ide> protected $response;
<ide>
<del> /**
<del> * The last code returned by artisan cli.
<del> *
<del> * @var int
<del> */
<del> protected $code;
<del>
<ide> /**
<ide> * The DomCrawler instance.
<ide> *
<ide> trait ApplicationTrait
<ide> */
<ide> protected $inputs = [];
<ide>
<del> /**
<del> * Refresh the application instance.
<del> *
<del> * @return void
<del> */
<del> protected function refreshApplication()
<del> {
<del> putenv('APP_ENV=testing');
<del>
<del> $this->app = $this->createApplication();
<del> }
<del>
<ide> /**
<ide> * Visit the given URI with a GET request.
<ide> *
<ide> public function withoutMiddleware()
<ide>
<ide> return $this;
<ide> }
<del>
<del> /**
<del> * Set the session to the given array.
<del> *
<del> * @param array $data
<del> * @return void
<del> */
<del> public function session(array $data)
<del> {
<del> $this->startSession();
<del>
<del> foreach ($data as $key => $value) {
<del> $this->app['session']->put($key, $value);
<del> }
<del> }
<del>
<del> /**
<del> * Start the session for the application.
<del> *
<del> * @return void
<del> */
<del> protected function startSession()
<del> {
<del> if (! $this->app['session']->isStarted()) {
<del> $this->app['session']->start();
<del> }
<del> }
<del>
<del> /**
<del> * Flush all of the current session data.
<del> *
<del> * @return void
<del> */
<del> public function flushSession()
<del> {
<del> $this->startSession();
<del>
<del> $this->app['session']->flush();
<del> }
<del>
<del> /**
<del> * Set the currently logged in user for the application.
<del> *
<del> * @param \Illuminate\Contracts\Auth\Authenticatable $user
<del> * @param string $driver
<del> * @return void
<del> */
<del> public function be(UserContract $user, $driver = null)
<del> {
<del> $this->app['auth']->driver($driver)->setUser($user);
<del> }
<del>
<del> /**
<del> * Seed a given database connection.
<del> *
<del> * @param string $class
<del> * @return void
<del> */
<del> public function seed($class = 'DatabaseSeeder')
<del> {
<del> $this->artisan('db:seed', ['--class' => $class]);
<del> }
<del>
<del> /**
<del> * Call artisan command and return code.
<del> *
<del> * @param string $command
<del> * @param array $parameters
<del> * @return int
<del> */
<del> public function artisan($command, $parameters = [])
<del> {
<del> return $this->code = $this->app['Illuminate\Contracts\Console\Kernel']->call($command, $parameters);
<del> }
<ide> }
<ide><path>src/Illuminate/Foundation/Testing/TestCase.php
<ide> abstract class TestCase extends PHPUnit_Framework_TestCase
<ide> {
<ide>
<del> use ApplicationTrait, AssertionsTrait;
<add> use ApplicationTrait, AssertionsTrait, CrawlerTrait;
<ide>
<ide> /**
<ide> * The callbacks that should be run before the application is destroyed. | 2 |
Text | Text | update minitest references in testing guide | dcc532d2fbd0f412efd023beab4807d21784b6a6 | <ide><path>guides/source/testing.md
<ide> class ArticleTest < ActiveSupport::TestCase
<ide>
<ide> The `ArticleTest` class defines a _test case_ because it inherits from `ActiveSupport::TestCase`. `ArticleTest` thus has all the methods available from `ActiveSupport::TestCase`. You'll see those methods a little later in this guide.
<ide>
<del>Any method defined within a class inherited from `MiniTest::Unit::TestCase`
<del>(which is the superclass of `ActiveSupport::TestCase`) that begins with `test` (case sensitive) is simply called a test. So, `test_password`, `test_valid_password` and `testValidPassword` all are legal test names and are run automatically when the test case is run.
<add>Any method defined within a class inherited from `Minitest::Test`
<add>(which is the superclass of `ActiveSupport::TestCase`) that begins with `test_` (case sensitive) is simply called a test. So, `test_password` and `test_valid_password` are legal test names and are run automatically when the test case is run.
<ide>
<del>Rails adds a `test` method that takes a test name and a block. It generates a normal `MiniTest::Unit` test with method names prefixed with `test_`. So,
<add>Rails adds a `test` method that takes a test name and a block. It generates a normal `Minitest::Unit` test with method names prefixed with `test_`. So,
<ide>
<ide> ```ruby
<ide> test "the truth" do
<ide> NOTE: Creating your own assertions is an advanced topic that we won't cover in t
<ide>
<ide> ### Rails Specific Assertions
<ide>
<del>Rails adds some custom assertions of its own to the `test/unit` framework:
<add>Rails adds some custom assertions of its own to the `minitest` framework:
<ide>
<ide> | Assertion | Purpose |
<ide> | --------------------------------------------------------------------------------- | ------- |
<ide> when you initiate a Rails project.
<ide> | `rake test:all:db` | Runs all tests quickly by merging all types and resetting db |
<ide>
<ide>
<del>Brief Note About `MiniTest`
<add>Brief Note About `Minitest`
<ide> -----------------------------
<ide>
<del>Ruby ships with a vast Standard Library for all common use-cases including testing. Ruby 1.8 provided `Test::Unit`, a framework for unit testing in Ruby. All the basic assertions discussed above are actually defined in `Test::Unit::Assertions`. The class `ActiveSupport::TestCase` which we have been using in our unit and functional tests extends `Test::Unit::TestCase`, allowing
<del>us to use all of the basic assertions in our tests.
<add>Ruby ships with a vast Standard Library for all common use-cases including testing. Since version 1.9, Ruby provides `Minitest`, a framework for testing. All the basic assertions such as `assert_equal` discussed above are actually defined in `Minitest::Assertions`. The classes `ActiveSupport::TestCase`, `ActionController::TestCase`, `ActionMailer::TestCase`, `ActionView::TestCase` and `ActionDispatch::IntegrationTest` - which we have been inheriting in our test classes - include `Minitest::Assertions`, allowing us to use all of the basic assertions in our tests.
<ide>
<del>Ruby 1.9 introduced `MiniTest`, an updated version of `Test::Unit` which provides a backwards compatible API for `Test::Unit`. You could also use `MiniTest` in Ruby 1.8 by installing the `minitest` gem.
<del>
<del>NOTE: For more information on `Test::Unit`, refer to [test/unit Documentation](http://ruby-doc.org/stdlib/libdoc/test/unit/rdoc/)
<del>For more information on `MiniTest`, refer to [Minitest](http://www.ruby-doc.org/stdlib-1.9.3/libdoc/minitest/unit/rdoc/)
<add>NOTE: For more information on `Minitest`, refer to [Minitest](http://ruby-doc.org/stdlib-2.1.0/libdoc/minitest/rdoc/MiniTest.html)
<ide>
<ide> Setup and Teardown
<ide> ------------------
<ide> access to Rails' helper methods such as `link_to` or `pluralize`.
<ide> Other Testing Approaches
<ide> ------------------------
<ide>
<del>The built-in `test/unit` based testing is not the only way to test Rails applications. Rails developers have come up with a wide variety of other approaches and aids for testing, including:
<add>The built-in `minitest` based testing is not the only way to test Rails applications. Rails developers have come up with a wide variety of other approaches and aids for testing, including:
<ide>
<ide> * [NullDB](http://avdi.org/projects/nulldb/), a way to speed up testing by avoiding database use.
<ide> * [Factory Girl](https://github.com/thoughtbot/factory_girl/tree/master), a replacement for fixtures. | 1 |
Ruby | Ruby | add test and comment for `path#existing` | 1be5eeec26000b881c2ec8ff53333266eedd9fff | <ide><path>Library/Homebrew/PATH.rb
<ide> def empty?
<ide>
<ide> def existing
<ide> existing_path = select(&File.method(:directory?))
<add> # return nil instead of empty PATH, to unset environment variables
<ide> existing_path unless existing_path.empty?
<ide> end
<ide>
<ide><path>Library/Homebrew/test/PATH_spec.rb
<ide> expect(path.existing.to_ary).to eq(["/path1"])
<ide> expect(path.to_ary).to eq(["/path1", "/path2"])
<ide> end
<add>
<add> it "returns nil instead of an empty #{described_class}" do
<add> expect(described_class.new.existing).to be nil
<add> end
<ide> end
<ide> end | 2 |
Text | Text | add unhandledrejection to strict mode | a33521bc51785cf5d3d6eb6b6ed20e5edee72f62 | <ide><path>doc/api/cli.md
<ide> occurs. One of the following modes can be chosen:
<ide>
<ide> * `throw`: Emit [`unhandledRejection`][]. If this hook is not set, raise the
<ide> unhandled rejection as an uncaught exception. This is the default.
<del>* `strict`: Raise the unhandled rejection as an uncaught exception.
<add>* `strict`: Raise the unhandled rejection as an uncaught exception. If the
<add> exception is handled, [`unhandledRejection`][] is emitted.
<ide> * `warn`: Always trigger a warning, no matter if the [`unhandledRejection`][]
<ide> hook is set or not but do not print the deprecation warning.
<ide> * `warn-with-error-code`: Emit [`unhandledRejection`][]. If this hook is not | 1 |
Ruby | Ruby | use bind values for model types | 5e9f49aad94d11c19626c95189223aa88896ae22 | <ide><path>activerecord/lib/active_record/associations/association_scope.rb
<ide> def add_constraints(scope)
<ide> constraint = table[key].eq(foreign_table[foreign_key])
<ide>
<ide> if reflection.type
<del> type = chain[i + 1].klass.base_class.name
<del> constraint = constraint.and(table[reflection.type].eq(type))
<add> value = chain[i + 1].klass.base_class.name
<add> bind_val = bind scope, table.table_name, reflection.type.to_s, value
<add> scope = scope.where(table[reflection.type].eq(bind_val))
<ide> end
<ide>
<ide> scope = scope.joins(join(foreign_table, constraint)) | 1 |
Text | Text | change 87th line "to-do列表" to "to-do列表" | 2a33dfc17666f50bfcdbecfe95992beafd9cbfd3 | <ide><path>guide/chinese/agile/acceptance-testing/index.md
<ide> localeTitle: 验收测试
<ide>
<ide> \- >建议
<ide>
<del>\- > To-DO列表摘要
<add>\- > To-Do列表摘要
<ide>
<ide> # \- >批准决定
<ide> | 1 |
Ruby | Ruby | fix a typo in http_basic_authenticate_with | 9feaf7eaaef3f08151d0ba1362d883f127020e7c | <ide><path>actionpack/lib/action_controller/metal/http_authentication.rb
<ide> module ClassMethods
<ide> # See ActionController::HttpAuthentication::Basic for example usage.
<ide> def http_basic_authenticate_with(name:, password:, realm: nil, **options)
<ide> raise ArgumentError, "Expected name: to be a String, got #{name.class}" unless name.is_a?(String)
<del> raise ArgumentError, "Expected password: to be a String, got #{password.class}" unless name.is_a?(String)
<add> raise ArgumentError, "Expected password: to be a String, got #{password.class}" unless password.is_a?(String)
<ide> before_action(options) { http_basic_authenticate_or_request_with name: name, password: password, realm: realm }
<ide> end
<ide> end | 1 |
Ruby | Ruby | use length == 0 instead of empty in preloader | 6b3180fc5e27c6964f4f59f1272a51997e5eca7b | <ide><path>activerecord/lib/active_record/associations/preloader.rb
<ide> def initialize(associate_by_default: true, polymorphic_parent: false, **kwargs)
<ide> end
<ide>
<ide> def call
<del> return [] if records.empty? || associations.nil?
<add> return [] if associations.nil? || records.length == 0
<ide>
<ide> build_preloaders
<ide> end | 1 |
Python | Python | remove print statement | 80d85d62e932f97494387b66be3cfadbab5bde8d | <ide><path>numpy/lib/function_base.py
<ide> def gradient(f, *varargs):
<ide>
<ide> # use central differences on interior and first differences on endpoints
<ide>
<del> print dx
<ide> outvals = []
<ide>
<ide> # create slice objects --- initially all are [:, :, ..., :] | 1 |
Python | Python | avoid deprecated getargspec | 74264ea3cd5e8bdfe90325f98944297d7f409018 | <ide><path>docs/autogen.py
<ide> from keras.layers import advanced_activations
<ide> from keras.layers import noise
<ide> from keras.layers import wrappers
<add>from keras.utils import generic_utils
<ide> from keras import initializers
<ide> from keras import optimizers
<ide> from keras import callbacks
<ide> def get_function_signature(function, method=True):
<ide> wrapped = getattr(function, '_original_function', None)
<ide> if wrapped is None:
<del> signature = inspect.getargspec(function)
<add> signature = generic_utils.getargspec(function)
<ide> else:
<del> signature = inspect.getargspec(wrapped)
<add> signature = generic_utils.getargspec(wrapped)
<ide> defaults = signature.defaults
<ide> if method:
<ide> args = signature.args[1:]
<ide><path>keras/preprocessing/image.py
<ide> from __future__ import division
<ide> from __future__ import print_function
<ide>
<del>import inspect
<del>
<ide> from .. import backend
<ide> from .. import utils
<add>from ..utils import generic_utils
<add>
<ide> from keras_preprocessing import image
<ide>
<ide> random_rotation = image.random_rotation
<ide> def array_to_img(x, data_format=None, scale=True, dtype=None):
<ide> if data_format is None:
<ide> data_format = backend.image_data_format()
<del> if 'dtype' in inspect.getargspec(image.array_to_img).args:
<add> if 'dtype' in generic_utils.getargspec(image.array_to_img).args:
<ide> if dtype is None:
<ide> dtype = backend.floatx()
<ide> return image.array_to_img(x,
<ide> def array_to_img(x, data_format=None, scale=True, dtype=None):
<ide> def img_to_array(img, data_format=None, dtype=None):
<ide> if data_format is None:
<ide> data_format = backend.image_data_format()
<del> if 'dtype' in inspect.getargspec(image.img_to_array).args:
<add> if 'dtype' in generic_utils.getargspec(image.img_to_array).args:
<ide> if dtype is None:
<ide> dtype = backend.floatx()
<ide> return image.img_to_array(img, data_format=data_format, dtype=dtype)
<ide> def __init__(self, directory, image_data_generator,
<ide> if data_format is None:
<ide> data_format = backend.image_data_format()
<ide> kwargs = {}
<del> if 'dtype' in inspect.getargspec(
<add> if 'dtype' in generic_utils.getargspec(
<ide> image.ImageDataGenerator.__init__).args:
<ide> if dtype is None:
<ide> dtype = backend.floatx()
<ide> def __init__(self, x, y, image_data_generator,
<ide> if data_format is None:
<ide> data_format = backend.image_data_format()
<ide> kwargs = {}
<del> if 'dtype' in inspect.getargspec(
<add> if 'dtype' in generic_utils.getargspec(
<ide> image.NumpyArrayIterator.__init__).args:
<ide> if dtype is None:
<ide> dtype = backend.floatx()
<ide> def __init__(self,
<ide> if data_format is None:
<ide> data_format = backend.image_data_format()
<ide> kwargs = {}
<del> if 'dtype' in inspect.getargspec(
<add> if 'dtype' in generic_utils.getargspec(
<ide> image.ImageDataGenerator.__init__).args:
<ide> if dtype is None:
<ide> dtype = backend.floatx()
<ide><path>keras/utils/generic_utils.py
<ide> def dummy_fn():
<ide> closure=closure)
<ide>
<ide>
<add>def getargspec(fn):
<add> """Python 2/3 compatible `getargspec`.
<add>
<add> Calls `getfullargspec` and assigns args, varargs,
<add> varkw, and defaults to a python 2/3 compatible `ArgSpec`.
<add> The parameter name 'varkw' is changed to 'keywords' to fit the
<add> `ArgSpec` struct.
<add>
<add> # Arguments
<add> fn: the target function to inspect.
<add>
<add> # Returns
<add> An ArgSpec with args, varargs, keywords, and defaults parameters
<add> from FullArgSpec.
<add> """
<add> if sys.version_info < (3,):
<add> arg_spec = inspect.getargspec(fn)
<add> else:
<add> full_arg_spec = inspect.getfullargspec(fn)
<add> arg_spec = inspect.ArgSpec(
<add> args=full_arg_spec.args,
<add> varargs=full_arg_spec.varargs,
<add> keywords=full_arg_spec.varkw,
<add> defaults=full_arg_spec.defaults)
<add> return arg_spec
<add>
<add>
<ide> def has_arg(fn, name, accept_all=False):
<ide> """Checks if a callable accepts a given keyword argument.
<ide> | 3 |
PHP | PHP | apply fixes from styleci | 8af4f77d4c60f6d616e00c6c37eea731543f792d | <ide><path>src/Illuminate/Encryption/EncryptionServiceProvider.php
<ide> use Illuminate\Support\ServiceProvider;
<ide> use Illuminate\Support\Str;
<ide> use Opis\Closure\SerializableClosure;
<del>use RuntimeException;
<ide>
<ide> class EncryptionServiceProvider extends ServiceProvider
<ide> { | 1 |
Mixed | Javascript | promise version of streams.finished call clean up | 84064bfd6c237a7451ff7b025e47dbe0775704c9 | <ide><path>doc/api/stream.md
<ide> changes:
<ide> -->
<ide>
<ide> * `stream` {Stream} A readable and/or writable stream.
<add>
<ide> * `options` {Object}
<ide> * `error` {boolean} If set to `false`, then a call to `emit('error', err)` is
<ide> not treated as finished. **Default:** `true`.
<ide> changes:
<ide> underlying stream will _not_ be aborted if the signal is aborted. The
<ide> callback will get called with an `AbortError`. All registered
<ide> listeners added by this function will also be removed.
<add> * `cleanup` {boolean} remove all registered stream listeners.
<add> **Default:** `false`.
<add>
<ide> * `callback` {Function} A callback function that takes an optional error
<ide> argument.
<add>
<ide> * Returns: {Function} A cleanup function which removes all registered
<ide> listeners.
<ide>
<ide><path>lib/internal/streams/end-of-stream.js
<ide> const {
<ide> validateAbortSignal,
<ide> validateFunction,
<ide> validateObject,
<add> validateBoolean
<ide> } = require('internal/validators');
<ide>
<ide> const { Promise } = primordials;
<ide> function eos(stream, options, callback) {
<ide> }
<ide>
<ide> function finished(stream, opts) {
<add> let autoCleanup = false;
<add> if (opts === null) {
<add> opts = kEmptyObject;
<add> }
<add> if (opts?.cleanup) {
<add> validateBoolean(opts.cleanup, 'cleanup');
<add> autoCleanup = opts.cleanup;
<add> }
<ide> return new Promise((resolve, reject) => {
<del> eos(stream, opts, (err) => {
<add> const cleanup = eos(stream, opts, (err) => {
<add> if (autoCleanup) {
<add> cleanup();
<add> }
<ide> if (err) {
<ide> reject(err);
<ide> } else {
<ide><path>test/parallel/test-stream-promises.js
<ide> const common = require('../common');
<ide> const stream = require('stream');
<ide> const {
<del> Readable,
<del> Writable,
<del> promises,
<add> Readable, Writable, promises,
<ide> } = stream;
<ide> const {
<del> finished,
<del> pipeline,
<add> finished, pipeline,
<ide> } = require('stream/promises');
<ide> const fs = require('fs');
<ide> const assert = require('assert');
<ide> assert.strictEqual(finished, promisify(stream.finished));
<ide> {
<ide> let finished = false;
<ide> const processed = [];
<del> const expected = [
<del> Buffer.from('a'),
<del> Buffer.from('b'),
<del> Buffer.from('c'),
<del> ];
<add> const expected = [Buffer.from('a'), Buffer.from('b'), Buffer.from('c')];
<ide>
<ide> const read = new Readable({
<del> read() { }
<add> read() {
<add> }
<ide> });
<ide>
<ide> const write = new Writable({
<ide> assert.strictEqual(finished, promisify(stream.finished));
<ide> // pipeline error
<ide> {
<ide> const read = new Readable({
<del> read() { }
<add> read() {
<add> }
<ide> });
<ide>
<ide> const write = new Writable({
<ide> assert.strictEqual(finished, promisify(stream.finished));
<ide> code: 'ENOENT'
<ide> }).then(common.mustCall());
<ide> }
<add>
<add>{
<add> const streamObj = new Readable();
<add> assert.throws(() => {
<add> // Passing cleanup option not as boolean
<add> // should throw error
<add> finished(streamObj, { cleanup: 2 });
<add> }, { code: 'ERR_INVALID_ARG_TYPE' });
<add>}
<add>
<add>// Below code should not throw any errors as the
<add>// streamObj is `Stream` and cleanup is boolean
<add>{
<add> const streamObj = new Readable();
<add> finished(streamObj, { cleanup: true });
<add>}
<add>
<add>
<add>// Cleanup function should not be called when cleanup is set to false
<add>// listenerCount should be 1 after calling finish
<add>{
<add> const streamObj = new Writable();
<add> assert.strictEqual(streamObj.listenerCount('end'), 0);
<add> finished(streamObj, { cleanup: false }).then(() => {
<add> assert.strictEqual(streamObj.listenerCount('end'), 1);
<add> });
<add>}
<add>
<add>// Cleanup function should be called when cleanup is set to true
<add>// listenerCount should be 0 after calling finish
<add>{
<add> const streamObj = new Writable();
<add> assert.strictEqual(streamObj.listenerCount('end'), 0);
<add> finished(streamObj, { cleanup: true }).then(() => {
<add> assert.strictEqual(streamObj.listenerCount('end'), 0);
<add> });
<add>}
<add>
<add>// Cleanup function should not be called when cleanup has not been set
<add>// listenerCount should be 1 after calling finish
<add>{
<add> const streamObj = new Writable();
<add> assert.strictEqual(streamObj.listenerCount('end'), 0);
<add> finished(streamObj).then(() => {
<add> assert.strictEqual(streamObj.listenerCount('end'), 1);
<add> });
<add>} | 3 |
Javascript | Javascript | support usecapture boolean | bf33b61be04988d95bd2373e3b931e09d254e06b | <ide><path>lib/internal/event_target.js
<ide> function validateListener(listener) {
<ide> }
<ide>
<ide> function validateEventListenerOptions(options) {
<add> if (typeof options === 'boolean') {
<add> options = { capture: options };
<add> }
<ide> if (options == null || typeof options !== 'object')
<ide> throw new ERR_INVALID_ARG_TYPE('options', 'object', options);
<ide> const {
<ide><path>test/parallel/test-eventtarget.js
<ide> ok(EventTarget);
<ide> eventTarget.addEventListener('foo', (event) => event.preventDefault());
<ide> ok(!eventTarget.dispatchEvent(event));
<ide> }
<del>
<add>{
<add> // Adding event listeners with a boolean useCapture
<add> const eventTarget = new EventTarget();
<add> const event = new Event('foo');
<add> const fn = common.mustCall((event) => strictEqual(event.type, 'foo'));
<add> eventTarget.addEventListener('foo', fn, false);
<add> eventTarget.dispatchEvent(event);
<add>}
<ide> {
<ide> const eventTarget = new NodeEventTarget();
<ide> strictEqual(eventTarget.listenerCount('foo'), 0); | 2 |
Javascript | Javascript | use soundmanager in pressability and touchable | ff03698f20a123ebac8584891579a21443285b35 | <ide><path>Libraries/Components/Touchable/Touchable.js
<ide> const StyleSheet = require('../../StyleSheet/StyleSheet');
<ide> const TVEventHandler = require('../AppleTV/TVEventHandler');
<ide> const UIManager = require('../../ReactNative/UIManager');
<ide> const View = require('../View/View');
<add>const SoundManager = require('../Sound/SoundManager');
<ide>
<ide> const keyMirror = require('fbjs/lib/keyMirror');
<ide> const normalizeColor = require('../../Color/normalizeColor');
<ide> const TouchableMixin = {
<ide> this._endHighlight(e);
<ide> }
<ide> if (Platform.OS === 'android' && !this.props.touchSoundDisabled) {
<del> this._playTouchSound();
<add> SoundManager.playTouchSound();
<ide> }
<ide> this.touchableHandlePress(e);
<ide> }
<ide> const TouchableMixin = {
<ide> this.touchableDelayTimeout = null;
<ide> },
<ide>
<del> _playTouchSound: function() {
<del> UIManager.playTouchSound();
<del> },
<del>
<ide> _startHighlight: function(e: PressEvent) {
<ide> this._savePressInLocation(e);
<ide> this.touchableHandleActivePressIn && this.touchableHandleActivePressIn(e); | 1 |
PHP | PHP | fix bug in route | 425192a05db7d5066a2ba62c4f844164c94ee21f | <ide><path>laravel/routing/route.php
<ide> protected function filters($event)
<ide> */
<ide> protected function patterns()
<ide> {
<add> $filters = array();
<add>
<ide> // We will simply iterate through the registered patterns and
<ide> // check the URI pattern against the URI for the route and
<ide> // if they match we'll attach the filter. | 1 |
Javascript | Javascript | consolidate workloop and deferredwork loop | 3a7844cabb9d815e6dac8ae5b9eddd255a82b7a6 | <ide><path>src/renderers/shared/fiber/ReactFiberScheduler.js
<ide> module.exports = function<T, P, I, TI, C>(config : HostConfig<T, P, I, TI, C>) {
<ide> }
<ide>
<ide> priorityContext = previousPriorityContext;
<del>
<del> // Clear any errors that may have occurred during this commit
<del> // TODO: Possibly recursive. Can we move this into performWork? Not sure how
<del> // because we need to clear errors after every commit, and one of the call
<del> // sites of commitAllWork is completeUnitOfWork.
<del> errorLoop();
<ide> }
<ide>
<ide> function resetWorkPriority(workInProgress : Fiber) {
<ide> module.exports = function<T, P, I, TI, C>(config : HostConfig<T, P, I, TI, C>) {
<ide> performWork(AnimationPriority);
<ide> }
<ide>
<del> function errorLoop() {
<add> function clearErrors() {
<ide> if (!nextUnitOfWork) {
<ide> nextUnitOfWork = findNextUnitOfWork();
<ide> }
<ide> module.exports = function<T, P, I, TI, C>(config : HostConfig<T, P, I, TI, C>) {
<ide> nextUnitOfWork = performUnitOfWork(nextUnitOfWork);
<ide> }
<ide> if (!nextUnitOfWork) {
<add> // If performUnitOfWork returns null, that means we just comitted
<add> // a root. Normally we'd need to clear any errors that were scheduled
<add> // during the commit phase. But we're already clearing errors, so
<add> // we can continue.
<ide> nextUnitOfWork = findNextUnitOfWork();
<ide> }
<ide> }
<ide> }
<ide>
<del> function workLoop(priorityLevel) {
<del> if (!nextUnitOfWork) {
<del> nextUnitOfWork = findNextUnitOfWork();
<del> }
<del> while (nextUnitOfWork &&
<del> nextPriorityLevel !== NoWork &&
<del> nextPriorityLevel <= priorityLevel) {
<del> nextUnitOfWork = performUnitOfWork(nextUnitOfWork);
<del> if (!nextUnitOfWork) {
<del> nextUnitOfWork = findNextUnitOfWork();
<del> }
<del> }
<del> }
<add> function workLoop(priorityLevel, deadline : Deadline | null, deadlineHasExpired : boolean) : boolean {
<add> // Clear any errors.
<add> clearErrors();
<ide>
<del> // Returns true if we exit because the deadline has expired
<del> function deferredWorkLoop(deadline) : boolean {
<del> let deadlineHasExpired = false;
<ide> if (!nextUnitOfWork) {
<ide> nextUnitOfWork = findNextUnitOfWork();
<ide> }
<del> while (nextUnitOfWork && !deadlineHasExpired) {
<del> if (deadline.timeRemaining() > timeHeuristicForUnitOfWork) {
<del> nextUnitOfWork = performUnitOfWork(nextUnitOfWork);
<del> // The order of the checks here is important: we should only check if
<del> // there's a pending commit if performUnitOfWork returns null.
<del> // Alternatively, to avoid checking for the pending commit, we could
<del> // get it from the nextScheduledRoot. However, that requires additional
<del> // checks to satisfy Flow. Since the logical operator short-circuits,
<del> // this should be fine.
<del> if (!nextUnitOfWork && pendingCommit) {
<del> // performUnitOfWork returned null and we have a pendingCommit. If we
<del> // have time, we should commit the work now.
<del> if (deadline.timeRemaining() > timeHeuristicForUnitOfWork) {
<del> commitAllWork(pendingCommit);
<del> nextUnitOfWork = findNextUnitOfWork();
<del> } else {
<del> deadlineHasExpired = true;
<add>
<add> if (deadline) {
<add> // The deferred work loop will run until there's no time left in
<add> // the current frame.
<add> while (nextUnitOfWork && !deadlineHasExpired) {
<add> if (deadline.timeRemaining() > timeHeuristicForUnitOfWork) {
<add> nextUnitOfWork = performUnitOfWork(nextUnitOfWork);
<add> // In a deferred work batch, iff nextUnitOfWork returns null, we just
<add> // completed a root and a pendingCommit exists. Logically, we could
<add> // omit either of the checks in the following condition, but we need
<add> // both to satisfy Flow.
<add> if (!nextUnitOfWork && pendingCommit) {
<add> // If we have time, we should commit the work now.
<add> if (deadline.timeRemaining() > timeHeuristicForUnitOfWork) {
<add> commitAllWork(pendingCommit);
<add> nextUnitOfWork = findNextUnitOfWork();
<add> // Clear any errors that were scheduled during the commit phase.
<add> clearErrors();
<add> } else {
<add> deadlineHasExpired = true;
<add> }
<add> // Otherwise the root will committed in the next frame.
<ide> }
<del> // Otherwise the root will committed in the next frame.
<add> } else {
<add> deadlineHasExpired = true;
<add> }
<add> }
<add> } else {
<add> // The non-deferred work loop will run until there's no more work
<add> // at the given priority level
<add> if (priorityLevel >= HighPriority) {
<add> throw new Error(
<add> 'Deferred work should only be performed using deferredWorkLoop'
<add> );
<add> }
<add> while (nextUnitOfWork &&
<add> nextPriorityLevel !== NoWork &&
<add> nextPriorityLevel <= priorityLevel) {
<add> nextUnitOfWork = performUnitOfWork(nextUnitOfWork);
<add> if (!nextUnitOfWork) {
<add> nextUnitOfWork = findNextUnitOfWork();
<add> // performUnitOfWork returned null, which means we just comitted a
<add> // root. Clear any errors that were scheduled during the commit phase.
<add> clearErrors();
<ide> }
<del> } else {
<del> deadlineHasExpired = true;
<ide> }
<ide> }
<add>
<ide> return deadlineHasExpired;
<ide> }
<ide>
<del> function performWork(priorityLevel : PriorityLevel, deadline : null | Deadline) {
<add> function performWork(priorityLevel : PriorityLevel, deadline : Deadline | null) {
<ide> if (isPerformingWork) {
<ide> throw new Error('performWork was called recursively.');
<ide> }
<ide> isPerformingWork = true;
<ide> const isPerformingDeferredWork = Boolean(deadline);
<ide> let deadlineHasExpired = false;
<ide>
<del> // Perform work until either there's no more work at this priority level, or
<del> // (in the case of deferred work) we've run out of time.
<del> while (true) {
<del> try {
<del> // Functions that contain a try-catch block are not optimizable by the
<del> // JS engine. The hottest code paths have been extracted to separate
<del> // functions, workLoop and deferredWorkLoop, which run on every unit of
<del> // work. The loop we're in now runs infrequently: to flush task work at
<del> // the end of a frame, or to restart after an error.
<del> while (priorityLevel !== NoWork) {
<del> // Before starting any work, check to see if there are any pending
<del> // commits from the previous frame. An exception if we're flushing
<del> // Task work in a deferred batch and the pending commit does not
<del> // have Task priority.
<del> if (pendingCommit) {
<del> const isFlushingTaskWorkInDeferredBatch =
<del> priorityLevel === TaskPriority &&
<del> isPerformingDeferredWork &&
<del> pendingCommit.pendingWorkPriority !== TaskPriority;
<del> if (!isFlushingTaskWorkInDeferredBatch) {
<del> commitAllWork(pendingCommit);
<del> }
<del> }
<del>
<del> // Clear any errors.
<del> errorLoop();
<del>
<del> if (deadline) {
<del> // The deferred work loop will run until there's no time left in
<del> // the current frame.
<del> if (!deadlineHasExpired) {
<del> deadlineHasExpired = deferredWorkLoop(deadline);
<del> }
<del> } else {
<del> if (priorityLevel >= HighPriority) {
<del> throw new Error(
<del> 'Deferred work should only be performed using deferredWorkLoop'
<del> );
<del> }
<del> // The non-deferred work loop will run until there's no more work
<del> // at the given priority level
<del> workLoop(priorityLevel);
<del> }
<del>
<del> // Stop performing work
<del> priorityLevel = NoWork;
<del>
<del> // If we additional work, and we're in a deferred batch, check to see
<del> // if the deadline has expired. If not, we may have more time to
<del> // do work.
<del> if (nextPriorityLevel !== NoWork && isPerformingDeferredWork && !deadlineHasExpired) {
<del> priorityLevel = nextPriorityLevel;
<del> continue;
<del> }
<del>
<del> // There might still be work left. Depending on the priority, we should
<del> // either perform it now or schedule a callback to perform it later.
<del> switch (nextPriorityLevel) {
<del> case SynchronousPriority:
<del> case TaskPriority:
<del> // Perform work immediately by switching the priority level
<del> // and continuing the loop.
<del> priorityLevel = nextPriorityLevel;
<del> break;
<del> case AnimationPriority:
<del> scheduleAnimationCallback(performAnimationWork);
<del> // Even though the next unit of work has animation priority, there
<del> // may still be deferred work left over as well. I think this is
<del> // only important for unit tests. In a real app, a deferred callback
<del> // would be scheduled during the next animation frame.
<del> scheduleDeferredCallback(performDeferredWork);
<del> break;
<del> case HighPriority:
<del> case LowPriority:
<del> case OffscreenPriority:
<del> scheduleDeferredCallback(performDeferredWork);
<del> break;
<del> }
<add> // This outer loop exists so that we can restart the work loop after
<add> // catching an error. It also lets us flush Task work at the end of a
<add> // deferred batch.
<add> while (priorityLevel !== NoWork) {
<add> // Before starting any work, check to see if there are any pending
<add> // commits from the previous frame. An exception is if we're flushing
<add> // Task work in a deferred batch and the pending commit does not
<add> // have Task priority.
<add> if (pendingCommit) {
<add> const isFlushingTaskWorkInDeferredBatch =
<add> priorityLevel === TaskPriority &&
<add> isPerformingDeferredWork &&
<add> pendingCommit.pendingWorkPriority !== TaskPriority;
<add> if (!isFlushingTaskWorkInDeferredBatch) {
<add> commitAllWork(pendingCommit);
<ide> }
<add> }
<add>
<add> // Nothing in performWork should be allowed to throw. All unsafe
<add> // operations must happen within workLoop, which is extracted to a
<add> // separate function so that it can be optimized by the JS engine.
<add> try {
<add> deadlineHasExpired = workLoop(priorityLevel, deadline, deadlineHasExpired);
<ide> } catch (error) {
<ide> // We caught an error during either the begin or complete phases.
<ide> const failedWork = nextUnitOfWork;
<ide>
<ide> // "Capture" the error by finding the nearest boundary. If there is no
<del> // error boundary, the nearest host container acts as one.
<add> // error boundary, the nearest host container acts as one. If
<add> // captureError returns null, the error was intentionally ignored.
<ide> const maybeBoundary = captureError(failedWork, error);
<ide> if (maybeBoundary) {
<ide> const boundary = maybeBoundary;
<ide>
<del> // Complete the boundary as if it rendered null.
<add> // Complete the boundary as if it rendered null. This will unmount
<add> // the failed tree.
<ide> beginFailedWork(boundary.alternate, boundary, priorityLevel);
<ide>
<ide> // The next unit of work is now the boundary that captured the error.
<ide> module.exports = function<T, P, I, TI, C>(config : HostConfig<T, P, I, TI, C>) {
<ide> // Continue performing work
<ide> continue;
<ide> }
<del> break;
<add>
<add> // Stop performing work
<add> priorityLevel = NoWork;
<add>
<add> // If have we more work, and we're in a deferred batch, check to see
<add> // if the deadline has expired.
<add> if (nextPriorityLevel !== NoWork && isPerformingDeferredWork && !deadlineHasExpired) {
<add> // We have more time to do work.
<add> priorityLevel = nextPriorityLevel;
<add> continue;
<add> }
<add>
<add> // There might be work left. Depending on the priority, we should
<add> // either perform it now or schedule a callback to perform it later.
<add> switch (nextPriorityLevel) {
<add> case SynchronousPriority:
<add> case TaskPriority:
<add> // Perform work immediately by switching the priority level
<add> // and continuing the loop.
<add> priorityLevel = nextPriorityLevel;
<add> break;
<add> case AnimationPriority:
<add> scheduleAnimationCallback(performAnimationWork);
<add> // Even though the next unit of work has animation priority, there
<add> // may still be deferred work left over as well. I think this is
<add> // only important for unit tests. In a real app, a deferred callback
<add> // would be scheduled during the next animation frame.
<add> scheduleDeferredCallback(performDeferredWork);
<add> break;
<add> case HighPriority:
<add> case LowPriority:
<add> case OffscreenPriority:
<add> scheduleDeferredCallback(performDeferredWork);
<add> break;
<add> }
<ide> }
<ide>
<ide> // We're done performing work. Time to clean up. | 1 |
Javascript | Javascript | clarify manual proptype calls warning | b7c70b67af77fa8611d4b13315bf57df15c4d35b | <ide><path>src/isomorphic/classic/types/ReactPropTypes.js
<ide> function createChainableTypeChecker(validate) {
<ide> false,
<ide> 'You are manually calling a React.PropTypes validation ' +
<ide> 'function for the `%s` prop on `%s`. This is deprecated ' +
<del> 'and will not work in the next major version. You may be ' +
<del> 'seeing this warning due to a third-party PropTypes library. ' +
<del> 'See https://fb.me/react-warning-dont-call-proptypes for details.',
<add> 'and will not work in production with the next major version. ' +
<add> 'You may be seeing this warning due to a third-party PropTypes ' +
<add> 'library. See https://fb.me/react-warning-dont-call-proptypes ' +
<add> 'for details.',
<ide> propFullName,
<ide> componentName
<ide> ); | 1 |
Python | Python | restore mongodb extra dependencies | 8ba6c7ee08b24a028767f64aba161ba666e6b044 | <ide><path>setup.py
<ide> def _pyimp():
<ide> 'slmq',
<ide> 'tblib',
<ide> 'consul',
<del> 'dynamodb'
<add> 'dynamodb',
<add> 'mongodb',
<ide> }
<ide>
<ide> # -*- Classifiers -*- | 1 |
Javascript | Javascript | replace fixturesdir with fixtures methods | 64560cf08c1626a0414fa98872037751e1a3a1f5 | <ide><path>test/parallel/test-http2-respond-file-fd-errors.js
<ide> const common = require('../common');
<ide> if (!common.hasCrypto)
<ide> common.skip('missing crypto');
<add>const fixtures = require('../common/fixtures');
<ide> const http2 = require('http2');
<del>const path = require('path');
<ide> const fs = require('fs');
<ide>
<ide> const {
<ide> const types = {
<ide> symbol: Symbol('test')
<ide> };
<ide>
<del>const fname = path.resolve(common.fixturesDir, 'elipses.txt');
<add>const fname = fixtures.path('elipses.txt');
<ide> const fd = fs.openSync(fname, 'r');
<ide>
<ide> const server = http2.createServer(); | 1 |
Go | Go | convert docker root command to use pflag and cobra | 0452ff5a4dd1b8fba707235d6f12a4038208f34b | <ide><path>api/client/cli.go
<ide> import (
<ide> "github.com/docker/docker/cliconfig/configfile"
<ide> "github.com/docker/docker/cliconfig/credentials"
<ide> "github.com/docker/docker/dockerversion"
<del> "github.com/docker/docker/opts"
<add> dopts "github.com/docker/docker/opts"
<ide> "github.com/docker/docker/pkg/term"
<ide> "github.com/docker/engine-api/client"
<ide> "github.com/docker/go-connections/sockets"
<ide> type DockerCli struct {
<ide> outState *term.State
<ide> }
<ide>
<del>// Initialize calls the init function that will setup the configuration for the client
<del>// such as the TLS, tcp and other parameters used to run the client.
<del>func (cli *DockerCli) Initialize() error {
<del> if cli.init == nil {
<del> return nil
<del> }
<del> return cli.init()
<del>}
<del>
<ide> // Client returns the APIClient
<ide> func (cli *DockerCli) Client() client.APIClient {
<ide> return cli.client
<ide> func (cli *DockerCli) restoreTerminal(in io.Closer) error {
<ide> return nil
<ide> }
<ide>
<add>// Initialize the dockerCli runs initialization that must happen after command
<add>// line flags are parsed.
<add>func (cli *DockerCli) Initialize(opts *cliflags.ClientOptions) error {
<add> cli.configFile = LoadDefaultConfigFile(cli.err)
<add>
<add> client, err := NewAPIClientFromFlags(opts.Common, cli.configFile)
<add> if err != nil {
<add> return err
<add> }
<add>
<add> cli.client = client
<add>
<add> if cli.in != nil {
<add> cli.inFd, cli.isTerminalIn = term.GetFdInfo(cli.in)
<add> }
<add> if cli.out != nil {
<add> cli.outFd, cli.isTerminalOut = term.GetFdInfo(cli.out)
<add> }
<add> return nil
<add>}
<add>
<ide> // NewDockerCli returns a DockerCli instance with IO output and error streams set by in, out and err.
<ide> // The key file, protocol (i.e. unix) and address are passed in as strings, along with the tls.Config. If the tls.Config
<ide> // is set the client scheme will be set to https.
<ide> // The client will be given a 32-second timeout (see https://github.com/docker/docker/pull/8035).
<del>func NewDockerCli(in io.ReadCloser, out, err io.Writer, clientFlags *cliflags.ClientFlags) *DockerCli {
<add>func NewDockerCli(in io.ReadCloser, out, err io.Writer, clientOpts *cliflags.ClientOptions) *DockerCli {
<ide> cli := &DockerCli{
<del> in: in,
<del> out: out,
<del> err: err,
<del> keyFile: clientFlags.Common.TrustKey,
<add> in: in,
<add> out: out,
<add> err: err,
<add> // TODO: just pass trustKey, not the entire opts struct
<add> keyFile: clientOpts.Common.TrustKey,
<ide> }
<del>
<del> cli.init = func() error {
<del> clientFlags.PostParse()
<del> cli.configFile = LoadDefaultConfigFile(err)
<del>
<del> client, err := NewAPIClientFromFlags(clientFlags, cli.configFile)
<del> if err != nil {
<del> return err
<del> }
<del>
<del> cli.client = client
<del>
<del> if cli.in != nil {
<del> cli.inFd, cli.isTerminalIn = term.GetFdInfo(cli.in)
<del> }
<del> if cli.out != nil {
<del> cli.outFd, cli.isTerminalOut = term.GetFdInfo(cli.out)
<del> }
<del>
<del> return nil
<del> }
<del>
<ide> return cli
<ide> }
<ide>
<ide> func LoadDefaultConfigFile(err io.Writer) *configfile.ConfigFile {
<ide> }
<ide>
<ide> // NewAPIClientFromFlags creates a new APIClient from command line flags
<del>func NewAPIClientFromFlags(clientFlags *cliflags.ClientFlags, configFile *configfile.ConfigFile) (client.APIClient, error) {
<del> host, err := getServerHost(clientFlags.Common.Hosts, clientFlags.Common.TLSOptions)
<add>func NewAPIClientFromFlags(opts *cliflags.CommonOptions, configFile *configfile.ConfigFile) (client.APIClient, error) {
<add> host, err := getServerHost(opts.Hosts, opts.TLSOptions)
<ide> if err != nil {
<ide> return &client.Client{}, err
<ide> }
<ide> func NewAPIClientFromFlags(clientFlags *cliflags.ClientFlags, configFile *config
<ide> verStr = tmpStr
<ide> }
<ide>
<del> httpClient, err := newHTTPClient(host, clientFlags.Common.TLSOptions)
<add> httpClient, err := newHTTPClient(host, opts.TLSOptions)
<ide> if err != nil {
<ide> return &client.Client{}, err
<ide> }
<ide> func getServerHost(hosts []string, tlsOptions *tlsconfig.Options) (host string,
<ide> return "", errors.New("Please specify only one -H")
<ide> }
<ide>
<del> host, err = opts.ParseHost(tlsOptions != nil, host)
<add> host, err = dopts.ParseHost(tlsOptions != nil, host)
<ide> return
<ide> }
<ide>
<ide><path>cli/cobraadaptor/adaptor.go
<ide> import (
<ide> "github.com/docker/docker/api/client/system"
<ide> "github.com/docker/docker/api/client/volume"
<ide> "github.com/docker/docker/cli"
<del> cliflags "github.com/docker/docker/cli/flags"
<del> "github.com/docker/docker/pkg/term"
<ide> "github.com/spf13/cobra"
<ide> )
<ide>
<del>// CobraAdaptor is an adaptor for supporting spf13/cobra commands in the
<del>// docker/cli framework
<del>type CobraAdaptor struct {
<del> rootCmd *cobra.Command
<del> dockerCli *client.DockerCli
<del>}
<del>
<del>// NewCobraAdaptor returns a new handler
<del>func NewCobraAdaptor(clientFlags *cliflags.ClientFlags) CobraAdaptor {
<del> stdin, stdout, stderr := term.StdStreams()
<del> dockerCli := client.NewDockerCli(stdin, stdout, stderr, clientFlags)
<del>
<del> var rootCmd = &cobra.Command{
<del> Use: "docker [OPTIONS]",
<del> Short: "A self-sufficient runtime for containers",
<del> SilenceUsage: true,
<del> SilenceErrors: true,
<del> }
<add>// SetupRootCommand sets default usage, help, and error handling for the
<add>// root command.
<add>// TODO: move to cmd/docker/docker?
<add>// TODO: split into common setup and client setup
<add>func SetupRootCommand(rootCmd *cobra.Command, dockerCli *client.DockerCli) {
<ide> rootCmd.SetUsageTemplate(usageTemplate)
<ide> rootCmd.SetHelpTemplate(helpTemplate)
<ide> rootCmd.SetFlagErrorFunc(cli.FlagErrorFunc)
<del> rootCmd.SetOutput(stdout)
<add> rootCmd.SetOutput(dockerCli.Out())
<ide> rootCmd.AddCommand(
<ide> node.NewNodeCommand(dockerCli),
<ide> service.NewServiceCommand(dockerCli),
<ide> func NewCobraAdaptor(clientFlags *cliflags.ClientFlags) CobraAdaptor {
<ide>
<ide> rootCmd.PersistentFlags().BoolP("help", "h", false, "Print usage")
<ide> rootCmd.PersistentFlags().MarkShorthandDeprecated("help", "please use --help")
<del>
<del> return CobraAdaptor{
<del> rootCmd: rootCmd,
<del> dockerCli: dockerCli,
<del> }
<del>}
<del>
<del>// Usage returns the list of commands and their short usage string for
<del>// all top level cobra commands.
<del>func (c CobraAdaptor) Usage() []cli.Command {
<del> cmds := []cli.Command{}
<del> for _, cmd := range c.rootCmd.Commands() {
<del> if cmd.Name() != "" {
<del> cmds = append(cmds, cli.Command{Name: cmd.Name(), Description: cmd.Short})
<del> }
<del> }
<del> return cmds
<del>}
<del>
<del>func (c CobraAdaptor) run(cmd string, args []string) error {
<del> if err := c.dockerCli.Initialize(); err != nil {
<del> return err
<del> }
<del> // Prepend the command name to support normal cobra command delegation
<del> c.rootCmd.SetArgs(append([]string{cmd}, args...))
<del> return c.rootCmd.Execute()
<del>}
<del>
<del>// Command returns a cli command handler if one exists
<del>func (c CobraAdaptor) Command(name string) func(...string) error {
<del> for _, cmd := range c.rootCmd.Commands() {
<del> if cmd.Name() == name {
<del> return func(args ...string) error {
<del> return c.run(name, args)
<del> }
<del> }
<del> }
<del> return nil
<ide> }
<ide>
<ide> // GetRootCommand returns the root command. Required to generate the man pages
<ide><path>cli/flags/client.go
<ide> package flags
<ide>
<del>import (
<del> "github.com/spf13/pflag"
<del>)
<del>
<del>// ClientFlags represents flags for the docker client.
<del>type ClientFlags struct {
<del> FlagSet *pflag.FlagSet
<add>// ClientOptions are the options used to configure the client cli
<add>type ClientOptions struct {
<ide> Common *CommonOptions
<del> PostParse func()
<del>
<ide> ConfigDir string
<add> Version bool
<add>}
<add>
<add>// NewClientOptions returns a new ClientOptions
<add>func NewClientOptions() *ClientOptions {
<add> return &ClientOptions{Common: NewCommonOptions()}
<ide> }
<ide><path>cmd/docker/daemon.go
<del>package main
<del>
<del>const daemonBinary = "dockerd"
<del>
<del>// DaemonProxy acts as a cli.Handler to proxy calls to the daemon binary
<del>type DaemonProxy struct{}
<del>
<del>// NewDaemonProxy returns a new handler
<del>func NewDaemonProxy() DaemonProxy {
<del> return DaemonProxy{}
<del>}
<del>
<del>// Command returns a cli command handler if one exists
<del>func (p DaemonProxy) Command(name string) func(...string) error {
<del> return map[string]func(...string) error{
<del> "daemon": p.CmdDaemon,
<del> }[name]
<del>}
<ide><path>cmd/docker/daemon_none.go
<ide> package main
<ide>
<ide> import (
<ide> "fmt"
<add> "github.com/spf13/cobra"
<ide> "runtime"
<ide> "strings"
<ide> )
<ide>
<del>// CmdDaemon reports on an error on windows, because there is no exec
<del>func (p DaemonProxy) CmdDaemon(args ...string) error {
<add>func newDaemonCommand() *cobra.Command {
<add> return &cobra.Command{
<add> Use: "daemon",
<add> Hidden: true,
<add> RunE: func(cmd *cobra.Command, args []string) error {
<add> return runDaemon()
<add> },
<add> }
<add>}
<add>
<add>func runDaemon() error {
<ide> return fmt.Errorf(
<ide> "`docker daemon` is not supported on %s. Please run `dockerd` directly",
<ide> strings.Title(runtime.GOOS))
<ide><path>cmd/docker/daemon_unix.go
<ide> package main
<ide>
<ide> import (
<add> "fmt"
<add>
<ide> "os"
<ide> "os/exec"
<ide> "path/filepath"
<ide> "syscall"
<add>
<add> "github.com/spf13/cobra"
<ide> )
<ide>
<del>// CmdDaemon execs dockerd with the same flags
<del>func (p DaemonProxy) CmdDaemon(args ...string) error {
<del> // Special case for handling `docker help daemon`. When pkg/mflag is removed
<del> // we can support this on the daemon side, but that is not possible with
<del> // pkg/mflag because it uses os.Exit(1) instead of returning an error on
<del> // unexpected args.
<del> if len(args) == 0 || args[0] != "--help" {
<del> // Use os.Args[1:] so that "global" args are passed to dockerd
<del> args = stripDaemonArg(os.Args[1:])
<add>const daemonBinary = "dockerd"
<add>
<add>func newDaemonCommand() *cobra.Command {
<add> cmd := &cobra.Command{
<add> Use: "daemon",
<add> Hidden: true,
<add> RunE: func(cmd *cobra.Command, args []string) error {
<add> return runDaemon()
<add> },
<ide> }
<add> cmd.SetHelpFunc(helpFunc)
<add> return cmd
<add>}
<ide>
<add>// CmdDaemon execs dockerd with the same flags
<add>func runDaemon() error {
<add> // Use os.Args[1:] so that "global" args are passed to dockerd
<add> return execDaemon(stripDaemonArg(os.Args[1:]))
<add>}
<add>
<add>func execDaemon(args []string) error {
<ide> binaryPath, err := findDaemonBinary()
<ide> if err != nil {
<ide> return err
<ide> func (p DaemonProxy) CmdDaemon(args ...string) error {
<ide> os.Environ())
<ide> }
<ide>
<add>func helpFunc(cmd *cobra.Command, args []string) {
<add> if err := execDaemon([]string{"--help"}); err != nil {
<add> fmt.Fprintf(os.Stderr, "%s\n", err.Error())
<add> }
<add>}
<add>
<ide> // findDaemonBinary looks for the path to the dockerd binary starting with
<ide> // the directory of the current executable (if one exists) and followed by $PATH
<ide> func findDaemonBinary() (string, error) {
<ide><path>cmd/docker/docker.go
<ide> import (
<ide> cliflags "github.com/docker/docker/cli/flags"
<ide> "github.com/docker/docker/cliconfig"
<ide> "github.com/docker/docker/dockerversion"
<del> flag "github.com/docker/docker/pkg/mflag"
<ide> "github.com/docker/docker/pkg/term"
<ide> "github.com/docker/docker/utils"
<add> "github.com/spf13/cobra"
<add> "github.com/spf13/pflag"
<ide> )
<ide>
<del>var (
<del> commonFlags = cliflags.InitCommonFlags()
<del> clientFlags = initClientFlags(commonFlags)
<del> flHelp = flag.Bool([]string{"h", "-help"}, false, "Print usage")
<del> flVersion = flag.Bool([]string{"v", "-version"}, false, "Print version information and quit")
<del>)
<add>func newDockerCommand(dockerCli *client.DockerCli, opts *cliflags.ClientOptions) *cobra.Command {
<add> cmd := &cobra.Command{
<add> Use: "docker [OPTIONS] COMMAND [arg...]",
<add> Short: "A self-sufficient runtime for containers.",
<add> SilenceUsage: true,
<add> SilenceErrors: true,
<add> Args: cli.NoArgs,
<add> RunE: func(cmd *cobra.Command, args []string) error {
<add> if opts.Version {
<add> showVersion()
<add> return nil
<add> }
<add> fmt.Fprintf(dockerCli.Err(), "\n"+cmd.UsageString())
<add> return nil
<add> },
<add> PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
<add> dockerPreRun(cmd.Flags(), opts)
<add> return dockerCli.Initialize(opts)
<add> },
<add> }
<add> cobraadaptor.SetupRootCommand(cmd, dockerCli)
<add>
<add> flags := cmd.Flags()
<add> flags.BoolVarP(&opts.Version, "version", "v", false, "Print version information and quit")
<add> flags.StringVar(&opts.ConfigDir, "config", cliconfig.ConfigDir(), "Location of client config files")
<add> opts.Common.InstallFlags(flags)
<add>
<add> return cmd
<add>}
<ide>
<ide> func main() {
<ide> // Set terminal emulation based on platform as required.
<ide> stdin, stdout, stderr := term.StdStreams()
<del>
<ide> logrus.SetOutput(stderr)
<ide>
<del> flag.Merge(flag.CommandLine, clientFlags.FlagSet, commonFlags.FlagSet)
<add> opts := cliflags.NewClientOptions()
<add> dockerCli := client.NewDockerCli(stdin, stdout, stderr, opts)
<add> cmd := newDockerCommand(dockerCli, opts)
<ide>
<del> cobraAdaptor := cobraadaptor.NewCobraAdaptor(clientFlags)
<del>
<del> flag.Usage = func() {
<del> fmt.Fprint(stdout, "Usage: docker [OPTIONS] COMMAND [arg...]\n docker [ --help | -v | --version ]\n\n")
<del> fmt.Fprint(stdout, "A self-sufficient runtime for containers.\n\nOptions:\n")
<del>
<del> flag.CommandLine.SetOutput(stdout)
<del> flag.PrintDefaults()
<del>
<del> help := "\nCommands:\n"
<del>
<del> dockerCommands := append(cli.DockerCommandUsage, cobraAdaptor.Usage()...)
<del> for _, cmd := range sortCommands(dockerCommands) {
<del> help += fmt.Sprintf(" %-10.10s%s\n", cmd.Name, cmd.Description)
<del> }
<del>
<del> help += "\nRun 'docker COMMAND --help' for more information on a command."
<del> fmt.Fprintf(stdout, "%s\n", help)
<del> }
<del>
<del> flag.Parse()
<del>
<del> if *flVersion {
<del> showVersion()
<del> return
<del> }
<del>
<del> if *flHelp {
<del> // if global flag --help is present, regardless of what other options and commands there are,
<del> // just print the usage.
<del> flag.Usage()
<del> return
<del> }
<del>
<del> clientCli := client.NewDockerCli(stdin, stdout, stderr, clientFlags)
<del>
<del> c := cli.New(clientCli, NewDaemonProxy(), cobraAdaptor)
<del> if err := c.Run(flag.Args()...); err != nil {
<add> if err := cmd.Execute(); err != nil {
<ide> if sterr, ok := err.(cli.StatusError); ok {
<ide> if sterr.Status != "" {
<ide> fmt.Fprintln(stderr, sterr.Status)
<ide> func showVersion() {
<ide> }
<ide> }
<ide>
<del>func initClientFlags(commonFlags *cliflags.CommonFlags) *cliflags.ClientFlags {
<del> clientFlags := &cliflags.ClientFlags{FlagSet: new(flag.FlagSet), Common: commonFlags}
<del> client := clientFlags.FlagSet
<del> client.StringVar(&clientFlags.ConfigDir, []string{"-config"}, cliconfig.ConfigDir(), "Location of client config files")
<add>func dockerPreRun(flags *pflag.FlagSet, opts *cliflags.ClientOptions) {
<add> opts.Common.SetDefaultOptions(flags)
<add> cliflags.SetDaemonLogLevel(opts.Common.LogLevel)
<ide>
<del> clientFlags.PostParse = func() {
<del> clientFlags.Common.PostParse()
<del> cliflags.SetDaemonLogLevel(commonOpts.LogLevel)
<del>
<del> if clientFlags.ConfigDir != "" {
<del> cliconfig.SetConfigDir(clientFlags.ConfigDir)
<del> }
<add> // TODO: remove this, set a default in New, and pass it in opts
<add> if opts.ConfigDir != "" {
<add> cliconfig.SetConfigDir(opts.ConfigDir)
<add> }
<ide>
<del> if clientFlags.Common.TrustKey == "" {
<del> clientFlags.Common.TrustKey = filepath.Join(cliconfig.ConfigDir(), cliflags.DefaultTrustKeyFile)
<del> }
<add> if opts.Common.TrustKey == "" {
<add> opts.Common.TrustKey = filepath.Join(
<add> cliconfig.ConfigDir(),
<add> cliflags.DefaultTrustKeyFile)
<add> }
<ide>
<del> if clientFlags.Common.Debug {
<del> utils.EnableDebug()
<del> }
<add> if opts.Common.Debug {
<add> utils.EnableDebug()
<ide> }
<del> return clientFlags
<ide> }
<ide><path>cmd/docker/docker_test.go
<ide> import (
<ide>
<ide> "github.com/Sirupsen/logrus"
<ide> "github.com/docker/docker/utils"
<add>
<add> "github.com/docker/docker/api/client"
<add> cliflags "github.com/docker/docker/cli/flags"
<ide> )
<ide>
<ide> func TestClientDebugEnabled(t *testing.T) {
<ide> defer utils.DisableDebug()
<ide>
<del> clientFlags.Common.FlagSet.Parse([]string{"-D"})
<del> clientFlags.PostParse()
<add> opts := cliflags.NewClientOptions()
<add> cmd := newDockerCommand(&client.DockerCli{}, opts)
<add>
<add> opts.Common.Debug = true
<add> if err := cmd.PersistentPreRunE(cmd, []string{}); err != nil {
<add> t.Fatalf("Unexpected error: %s", err.Error())
<add> }
<ide>
<ide> if os.Getenv("DEBUG") != "1" {
<ide> t.Fatal("expected debug enabled, got false") | 8 |
Text | Text | add v3.12.0-beta.1 to changelog | de4234af72a6ce14b539baf1b5a1e1c273f8c03f | <ide><path>CHANGELOG.md
<ide> # Ember Changelog
<ide>
<add># v3.12.0-beta.1 (June 27, 2019)
<add>
<add>- [#17406](https://github.com/emberjs/ember.js/pull/17406) [BUGFIX] Properties observed through `Ember.Observer` can be set to `undefined`
<add>- [#18150](https://github.com/emberjs/ember.js/pull/18150) [BUGFIX] Fix a memory retention issue with string-based event listeners
<add>- [#18124](https://github.com/emberjs/ember.js/pull/18124) [CLEANUP] Remove deprecated `NAME_KEY`
<add>
<ide> ### v3.11.0 (June 24, 2019)
<ide>
<ide> - [#17842](https://github.com/emberjs/ember.js/pull/17842) / [#17901](https://github.com/emberjs/ember.js/pull/17901) [FEATURE] Implement the [Forwarding Element Modifiers with "Splattributes" RFC](https://github.com/emberjs/rfcs/blob/master/text/0435-modifier-splattributes.md). | 1 |
Javascript | Javascript | improve descriptiveness of identifier | c005ebb0ce3888c7fc6d088fab75561c29c2a31c | <ide><path>lib/url.js
<ide> Url.prototype.resolveObject = function resolveObject(relative) {
<ide> var removeAllDots = mustEndAbs;
<ide> var srcPath = result.pathname && result.pathname.split('/') || [];
<ide> var relPath = relative.pathname && relative.pathname.split('/') || [];
<del> var psychotic = result.protocol && !slashedProtocol[result.protocol];
<add> var noLeadingSlashes = result.protocol && !slashedProtocol[result.protocol];
<ide>
<ide> // if the url is a non-slashed url, then relative
<ide> // links like ../.. should be able
<ide> // to crawl up to the hostname, as well. This is strange.
<ide> // result.protocol has already been set by now.
<ide> // Later on, put the first path part into the host field.
<del> if (psychotic) {
<add> if (noLeadingSlashes) {
<ide> result.hostname = '';
<ide> result.port = null;
<ide> if (result.host) {
<ide> Url.prototype.resolveObject = function resolveObject(relative) {
<ide> // just pull out the search.
<ide> // like href='?foo'.
<ide> // Put this after the other two cases because it simplifies the booleans
<del> if (psychotic) {
<add> if (noLeadingSlashes) {
<ide> result.hostname = result.host = srcPath.shift();
<ide> //occasionally the auth can get stuck only in host
<ide> //this especially happens in cases like
<ide> Url.prototype.resolveObject = function resolveObject(relative) {
<ide> (srcPath[0] && srcPath[0].charAt(0) === '/');
<ide>
<ide> // put the host back
<del> if (psychotic) {
<add> if (noLeadingSlashes) {
<ide> result.hostname = result.host = isAbsolute ? '' :
<ide> srcPath.length ? srcPath.shift() : '';
<ide> //occasionally the auth can get stuck only in host | 1 |
Ruby | Ruby | add test for argv.flag? | 863d2b253a4c4be255e309b18d4fd14ad94155c1 | <ide><path>Library/Homebrew/test/test_ARGV.rb
<ide> def test_switch?
<ide> %w{b ns bar --bar -n}.each { |s| assert [email protected]?(s) }
<ide> end
<ide>
<add> def test_flag?
<add> @argv << "--foo" << "-bq" << "--bar"
<add> assert @argv.flag?("--foo")
<add> assert @argv.flag?("--bar")
<add> assert @argv.flag?("--baz")
<add> assert @argv.flag?("--qux")
<add> assert [email protected]?("--frotz")
<add> assert [email protected]?("--debug")
<add> end
<add>
<ide> def test_filter_for_dependencies_clears_flags
<ide> @argv << "--debug"
<ide> @argv.filter_for_dependencies { assert @argv.empty? } | 1 |
Python | Python | add is_graph to docstring | 515448f8596e2f9f1d0ffe91957c3da1a37dda23 | <ide><path>keras/layers/core.py
<ide> class Siamese(Layer):
<ide> merge_mode: Same meaning as `mode` argument of Merge layer
<ide> concat_axis: Same meaning as `concat_axis` argument of Merge layer
<ide> dot_axes: Same meaning as `dot_axes` argument of Merge layer
<add> is_graph: Should be set to True when used inside `Graph`
<ide> '''
<ide> def __init__(self, layer, inputs, merge_mode='concat',
<ide> concat_axis=1, dot_axes=-1, is_graph=False): | 1 |
PHP | PHP | add ability to nested validation rules | 9d19d1ece898ccbc0193a89a58a6500b5fb6c146 | <ide><path>src/Illuminate/Validation/NestedRules.php
<add><?php
<add>
<add>namespace Illuminate\Validation;
<add>
<add>use Illuminate\Support\Arr;
<add>
<add>class NestedRules
<add>{
<add> /**
<add> * The callback to execute.
<add> *
<add> * @var callable
<add> */
<add> protected $callback;
<add>
<add> /**
<add> * Create a new nested rule instance.
<add> *
<add> * @param callable $callback
<add> * @return void
<add> */
<add> public function __construct(callable $callback)
<add> {
<add> $this->callback = $callback;
<add> }
<add>
<add> /**
<add> * Compile the callback into an array of rules.
<add> *
<add> * @param string $attribute
<add> * @param mixed $value
<add> * @param mixed $data
<add> * @return \stdClass
<add> */
<add> public function compile($attribute, $value, $data = null)
<add> {
<add> $rules = call_user_func($this->callback, $attribute, $value, $data);
<add>
<add> $parser = new ValidationRuleParser(
<add> Arr::undot(Arr::wrap($data))
<add> );
<add>
<add> if (is_array($rules) && Arr::isAssoc($rules)) {
<add> $nested = [];
<add>
<add> foreach ($rules as $key => $rule) {
<add> $nested[$attribute.'.'.$key] = $rule;
<add> }
<add>
<add> return $parser->explode($nested);
<add> }
<add>
<add> return $parser->explode([$attribute => $rules]);
<add> }
<add>}
<ide><path>src/Illuminate/Validation/Rule.php
<ide> public static function when($condition, $rules, $defaultRules = [])
<ide> return new ConditionalRules($condition, $rules, $defaultRules);
<ide> }
<ide>
<add> /**
<add> * Create a new nested rule set.
<add> *
<add> * @param callable $callback
<add> * @return \Illuminate\Validation\NestedRules
<add> */
<add> public static function nested($callback)
<add> {
<add> return new NestedRules($callback);
<add> }
<add>
<ide> /**
<ide> * Get a dimensions constraint builder instance.
<ide> *
<ide> public static function unique($table, $column = 'NULL')
<ide> {
<ide> return new Unique($table, $column);
<ide> }
<del>}
<add>}
<ide>\ No newline at end of file
<ide><path>src/Illuminate/Validation/ValidationRuleParser.php
<ide> protected function explodeRules($rules)
<ide>
<ide> unset($rules[$key]);
<ide> } else {
<del> $rules[$key] = $this->explodeExplicitRule($rule);
<add> $rules[$key] = $this->explodeExplicitRule($rule, $key);
<ide> }
<ide> }
<ide>
<ide> protected function explodeRules($rules)
<ide> * Explode the explicit rule into an array if necessary.
<ide> *
<ide> * @param mixed $rule
<add> * @param string $attribute
<ide> * @return array
<ide> */
<del> protected function explodeExplicitRule($rule)
<add> protected function explodeExplicitRule($rule, $attribute)
<ide> {
<ide> if (is_string($rule)) {
<ide> return explode('|', $rule);
<ide> } elseif (is_object($rule)) {
<del> return [$this->prepareRule($rule)];
<add> return Arr::wrap($this->prepareRule($rule, $attribute));
<ide> }
<ide>
<del> return array_map([$this, 'prepareRule'], $rule);
<add> $attributes = array_fill(
<add> array_key_first($rule), count($rule), $attribute
<add> );
<add>
<add> return array_map(
<add> [$this, 'prepareRule'], $rule, $attributes
<add> );
<ide> }
<ide>
<ide> /**
<ide> * Prepare the given rule for the Validator.
<ide> *
<ide> * @param mixed $rule
<add> * @param string $attribute
<ide> * @return mixed
<ide> */
<del> protected function prepareRule($rule)
<add> protected function prepareRule($rule, $attribute)
<ide> {
<ide> if ($rule instanceof Closure) {
<ide> $rule = new ClosureValidationRule($rule);
<ide> protected function prepareRule($rule)
<ide> return $rule;
<ide> }
<ide>
<add> if ($rule instanceof NestedRules) {
<add> return $rule->compile(
<add> $attribute, $this->data[$attribute] ?? null, Arr::dot($this->data)
<add> )->rules[$attribute];
<add> }
<add>
<ide> return (string) $rule;
<ide> }
<ide>
<ide> protected function explodeWildcardRules($results, $attribute, $rules)
<ide>
<ide> foreach ($data as $key => $value) {
<ide> if (Str::startsWith($key, $attribute) || (bool) preg_match('/^'.$pattern.'\z/', $key)) {
<del> foreach ((array) $rules as $rule) {
<del> $this->implicitAttributes[$attribute][] = $key;
<del>
<del> $results = $this->mergeRules($results, $key, $rule);
<add> foreach (Arr::flatten((array) $rules) as $rule) {
<add> if ($rule instanceof NestedRules) {
<add> $compiled = $rule->compile($key, $value, $data);
<add>
<add> $this->implicitAttributes = array_merge_recursive(
<add> $compiled->implicitAttributes,
<add> $this->implicitAttributes,
<add> [$attribute => [$key]]
<add> );
<add>
<add> $results = $this->mergeRules($results, $compiled->rules);
<add> } else {
<add> $this->implicitAttributes[$attribute][] = $key;
<add>
<add> $results = $this->mergeRules($results, $key, $rule);
<add> }
<ide> }
<ide> }
<ide> }
<ide> protected function mergeRulesForAttribute($results, $attribute, $rules)
<ide> $merge = head($this->explodeRules([$rules]));
<ide>
<ide> $results[$attribute] = array_merge(
<del> isset($results[$attribute]) ? $this->explodeExplicitRule($results[$attribute]) : [], $merge
<add> isset($results[$attribute]) ? $this->explodeExplicitRule($results[$attribute], $attribute) : [], $merge
<ide> );
<ide>
<ide> return $results;
<ide> protected function mergeRulesForAttribute($results, $attribute, $rules)
<ide> */
<ide> public static function parse($rule)
<ide> {
<del> if ($rule instanceof RuleContract) {
<add> if ($rule instanceof RuleContract || $rule instanceof NestedRules) {
<ide> return [$rule, []];
<ide> }
<ide>
<ide> public static function filterConditionalRules($rules, array $data = [])
<ide> })->filter()->flatten(1)->values()->all()];
<ide> })->all();
<ide> }
<del>}
<add>}
<ide>\ No newline at end of file
<ide><path>tests/Validation/ValidationNestedRulesTest.php
<add><?php
<add>
<add>namespace Illuminate\Tests\Validation;
<add>
<add>use Illuminate\Translation\ArrayLoader;
<add>use Illuminate\Translation\Translator;
<add>use Illuminate\Validation\Rule;
<add>use Illuminate\Validation\Validator;
<add>use Mockery as m;
<add>use PHPUnit\Framework\TestCase;
<add>
<add>class ValidationNestedRulesTest extends TestCase
<add>{
<add> public function testNestedCallbacksCanProperlySegmentRules()
<add> {
<add> $data = [
<add> 'items' => [
<add> // Contains duplicate ID.
<add> ['discounts' => [['id' => 1], ['id' => 1], ['id' => 2]]],
<add> ['discounts' => [['id' => 1], ['id' => 2]]],
<add> ],
<add> ];
<add>
<add> $rules = [
<add> 'items.*' => Rule::nested(function () {
<add> return ['discounts.*.id' => 'distinct'];
<add> }),
<add> ];
<add>
<add> $trans = $this->getIlluminateArrayTranslator();
<add>
<add> $v = new Validator($trans, $data, $rules);
<add>
<add> $this->assertFalse($v->passes());
<add>
<add> $this->assertEquals([
<add> 'items.0.discounts.0.id' => ['validation.distinct'],
<add> 'items.0.discounts.1.id' => ['validation.distinct'],
<add> ], $v->getMessageBag()->toArray());
<add> }
<add>
<add> public function testNestedCallbacksCanBeRecursivelyNested()
<add> {
<add> $data = [
<add> 'items' => [
<add> // Contains duplicate ID.
<add> ['discounts' => [['id' => 1], ['id' => 1], ['id' => 2]]],
<add> ['discounts' => [['id' => 1], ['id' => 2]]],
<add> ],
<add> ];
<add>
<add> $rules = [
<add> 'items.*' => Rule::nested(function () {
<add> return [
<add> 'discounts.*.id' => Rule::nested(function () {
<add> return 'distinct';
<add> }),
<add> ];
<add> }),
<add> ];
<add>
<add> $trans = $this->getIlluminateArrayTranslator();
<add>
<add> $v = new Validator($trans, $data, $rules);
<add>
<add> $this->assertFalse($v->passes());
<add>
<add> $this->assertEquals([
<add> 'items.0.discounts.0.id' => ['validation.distinct'],
<add> 'items.0.discounts.1.id' => ['validation.distinct'],
<add> ], $v->getMessageBag()->toArray());
<add> }
<add>
<add> public function testNestedCallbacksCanReturnMultipleValidationRules()
<add> {
<add> $data = [
<add> 'items' => [
<add> [
<add> 'discounts' => [
<add> ['id' => 1, 'percent' => 30, 'discount' => 1400],
<add> ['id' => 1, 'percent' => -1, 'discount' => 12300],
<add> ['id' => 2, 'percent' => 120, 'discount' => 1200],
<add> ],
<add> ],
<add> [
<add> 'discounts' => [
<add> ['id' => 1, 'percent' => 30, 'discount' => 'invalid'],
<add> ['id' => 2, 'percent' => 'invalid', 'discount' => 1250],
<add> ['id' => 3, 'percent' => 'invalid', 'discount' => 'invalid'],
<add> ],
<add> ],
<add> ],
<add> ];
<add> $rules = [
<add> 'items.*' => Rule::nested(function () {
<add> return [
<add> 'discounts.*.id' => 'distinct',
<add> 'discounts.*' => Rule::nested(function () {
<add> return [
<add> 'id' => 'distinct',
<add> 'percent' => 'numeric|min:0|max:100',
<add> 'discount' => 'numeric',
<add> ];
<add> }),
<add> ];
<add> }),
<add> ];
<add>
<add> $trans = $this->getIlluminateArrayTranslator();
<add>
<add> $v = new Validator($trans, $data, $rules);
<add>
<add> $this->assertFalse($v->passes());
<add>
<add> $this->assertEquals([
<add> 'items.0.discounts.0.id' => ['validation.distinct'],
<add> 'items.0.discounts.1.id' => ['validation.distinct'],
<add> 'items.0.discounts.1.percent' => ['validation.min.numeric'],
<add> 'items.0.discounts.2.percent' => ['validation.max.numeric'],
<add> 'items.1.discounts.0.discount' => ['validation.numeric'],
<add> 'items.1.discounts.1.percent' => ['validation.numeric'],
<add> 'items.1.discounts.2.percent' => ['validation.numeric'],
<add> 'items.1.discounts.2.discount' => ['validation.numeric'],
<add> ], $v->getMessageBag()->toArray());
<add> }
<add>
<add> public function testNestedCallbacksCanReturnArraysOfValidationRules()
<add> {
<add> $data = [
<add> 'items' => [
<add> // Contains duplicate ID.
<add> ['discounts' => [['id' => 1], ['id' => 1], ['id' => 2]]],
<add> ['discounts' => [['id' => 1], ['id' => 'invalid']]],
<add> ],
<add> ];
<add>
<add> $rules = [
<add> 'items.*' => Rule::nested(function () {
<add> return ['discounts.*.id' => ['distinct', 'numeric']];
<add> }),
<add> ];
<add>
<add> $trans = $this->getIlluminateArrayTranslator();
<add>
<add> $v = new Validator($trans, $data, $rules);
<add>
<add> $this->assertFalse($v->passes());
<add>
<add> $this->assertEquals([
<add> 'items.0.discounts.0.id' => ['validation.distinct'],
<add> 'items.0.discounts.1.id' => ['validation.distinct'],
<add> 'items.1.discounts.1.id' => ['validation.numeric'],
<add> ], $v->getMessageBag()->toArray());
<add> }
<add>
<add> public function testNestedCallbacksCanReturnDifferentRules()
<add> {
<add> $data = [
<add> 'items' => [
<add> [
<add> 'discounts' => [
<add> ['id' => 1, 'type' => 'percent', 'discount' => 120],
<add> ['id' => 1, 'type' => 'absolute', 'discount' => 100],
<add> ['id' => 2, 'type' => 'percent', 'discount' => 50],
<add> ],
<add> ],
<add> [
<add> 'discounts' => [
<add> ['id' => 2, 'type' => 'percent', 'discount' => 'invalid'],
<add> ['id' => 3, 'type' => 'absolute', 'discount' => 2000],
<add> ],
<add> ],
<add> ],
<add> ];
<add>
<add> $rules = [
<add> 'items.*' => Rule::nested(function () {
<add> return [
<add> 'discounts.*.id' => 'distinct',
<add> 'discounts.*.type' => 'in:percent,absolute',
<add> 'discounts.*' => Rule::nested(function ($attribute, $value) {
<add> return $value['type'] === 'percent'
<add> ? ['discount' => 'numeric|min:0|max:100']
<add> : ['discount' => 'numeric'];
<add> }),
<add> ];
<add> }),
<add> ];
<add>
<add> $trans = $this->getIlluminateArrayTranslator();
<add>
<add> $v = new Validator($trans, $data, $rules);
<add>
<add> $this->assertFalse($v->passes());
<add>
<add> $this->assertEquals([
<add> 'items.0.discounts.0.id' => ['validation.distinct'],
<add> 'items.0.discounts.1.id' => ['validation.distinct'],
<add> 'items.0.discounts.0.discount' => ['validation.max.numeric'],
<add> 'items.1.discounts.0.discount' => ['validation.numeric'],
<add> ], $v->getMessageBag()->toArray());
<add> }
<add>
<add> protected function getTranslator()
<add> {
<add> return m::mock(TranslatorContract::class);
<add> }
<add>
<add> public function getIlluminateArrayTranslator()
<add> {
<add> return new Translator(
<add> new ArrayLoader, 'en'
<add> );
<add> }
<add>}
<ide><path>tests/Validation/ValidationRuleParserTest.php
<ide>
<ide> class ValidationRuleParserTest extends TestCase
<ide> {
<del> public function test_conditional_rules_are_properly_expanded_and_filtered()
<add> public function testConditionalRulesAreProperlyExpandedAndFiltered()
<ide> {
<ide> $rules = ValidationRuleParser::filterConditionalRules([
<ide> 'name' => Rule::when(true, ['required', 'min:2']),
<ide> public function test_conditional_rules_are_properly_expanded_and_filtered()
<ide> ], $rules);
<ide> }
<ide>
<del> public function test_empty_rules_are_preserved()
<add> public function testEmptyRulesArePreserved()
<ide> {
<ide> $rules = ValidationRuleParser::filterConditionalRules([
<ide> 'name' => [],
<ide> public function test_empty_rules_are_preserved()
<ide> ], $rules);
<ide> }
<ide>
<del> public function test_conditional_rules_with_default()
<add> public function testConditionalRulesWithDefault()
<ide> {
<ide> $rules = ValidationRuleParser::filterConditionalRules([
<ide> 'name' => Rule::when(true, ['required', 'min:2'], ['string', 'max:10']),
<ide> public function test_conditional_rules_with_default()
<ide> ], $rules);
<ide> }
<ide>
<del> public function test_empty_conditional_rules_are_preserved()
<add> public function testEmptyConditionalRulesArePreserved()
<ide> {
<ide> $rules = ValidationRuleParser::filterConditionalRules([
<ide> 'name' => Rule::when(true, '', ['string', 'max:10']),
<ide> public function test_empty_conditional_rules_are_preserved()
<ide> 'password' => ['string', 'max:10'],
<ide> ], $rules);
<ide> }
<del>}
<add>
<add> public function testExplodeGeneratesNestedRules()
<add> {
<add> $parser = (new ValidationRuleParser([
<add> 'users' => [
<add> ['name' => 'Taylor Otwell'],
<add> ],
<add> ]));
<add>
<add> $results = $parser->explode([
<add> 'users.*.name' => Rule::nested(function ($attribute, $value, $data) {
<add> $this->assertEquals('users.0.name', $attribute);
<add> $this->assertEquals('Taylor Otwell', $value);
<add> $this->assertEquals($data['users.0.name'], 'Taylor Otwell');
<add>
<add> return [Rule::requiredIf(true)];
<add> }),
<add> ]);
<add>
<add> $this->assertEquals(['users.0.name' => ['required']], $results->rules);
<add> $this->assertEquals(['users.*.name' => ['users.0.name']], $results->implicitAttributes);
<add> }
<add>
<add> public function testExplodeGeneratesNestedRulesForNonNestedData()
<add> {
<add> $parser = (new ValidationRuleParser([
<add> 'name' => 'Taylor Otwell',
<add> ]));
<add>
<add> $results = $parser->explode([
<add> 'name' => Rule::nested(function ($attribute, $value, $data = null) {
<add> $this->assertEquals('name', $attribute);
<add> $this->assertEquals('Taylor Otwell', $value);
<add> $this->assertEquals(['name' => 'Taylor Otwell'], $data);
<add>
<add> return 'required';
<add> }),
<add> ]);
<add>
<add> $this->assertEquals(['name' => ['required']], $results->rules);
<add> $this->assertEquals([], $results->implicitAttributes);
<add> }
<add>
<add> public function testExplodeHandlesArraysOfNestedRules()
<add> {
<add> $parser = (new ValidationRuleParser([
<add> 'users' => [
<add> ['name' => 'Taylor Otwell'],
<add> ['name' => 'Abigail Otwell'],
<add> ],
<add> ]));
<add>
<add> $results = $parser->explode([
<add> 'users.*.name' => [
<add> Rule::nested(function ($attribute, $value, $data) {
<add> $this->assertEquals([
<add> 'users.0.name' => 'Taylor Otwell',
<add> 'users.1.name' => 'Abigail Otwell',
<add> ], $data);
<add>
<add> return [Rule::requiredIf(true)];
<add> }),
<add> Rule::nested(function ($attribute, $value, $data) {
<add> $this->assertEquals([
<add> 'users.0.name' => 'Taylor Otwell',
<add> 'users.1.name' => 'Abigail Otwell',
<add> ], $data);
<add>
<add> return [
<add> $value === 'Taylor Otwell'
<add> ? Rule::in('taylor')
<add> : Rule::in('abigail'),
<add> ];
<add> }),
<add> ],
<add> ]);
<add>
<add> $this->assertEquals([
<add> 'users.0.name' => ['required', 'in:"taylor"'],
<add> 'users.1.name' => ['required', 'in:"abigail"'],
<add> ], $results->rules);
<add>
<add> $this->assertEquals([
<add> 'users.*.name' => [
<add> 'users.0.name',
<add> 'users.0.name',
<add> 'users.1.name',
<add> 'users.1.name',
<add> ],
<add> ], $results->implicitAttributes);
<add> }
<add>
<add> public function testExplodeHandlesRecursivelyNestedRules()
<add> {
<add> $parser = (new ValidationRuleParser([
<add> 'users' => [['name' => 'Taylor Otwell']],
<add> ]));
<add>
<add> $results = $parser->explode([
<add> 'users.*.name' => [
<add> Rule::nested(function ($attribute, $value, $data) {
<add> $this->assertEquals('users.0.name', $attribute);
<add> $this->assertEquals('Taylor Otwell', $value);
<add> $this->assertEquals(['users.0.name' => 'Taylor Otwell'], $data);
<add>
<add> return Rule::nested(function ($attribute, $value, $data) {
<add> $this->assertEquals('users.0.name', $attribute);
<add> $this->assertNull($value);
<add> $this->assertEquals(['users.0.name' => 'Taylor Otwell'], $data);
<add>
<add> return Rule::nested(function ($attribute, $value, $data) {
<add> $this->assertEquals('users.0.name', $attribute);
<add> $this->assertNull($value);
<add> $this->assertEquals(['users.0.name' => 'Taylor Otwell'], $data);
<add>
<add> return [Rule::requiredIf(true)];
<add> });
<add> });
<add> }),
<add> ],
<add> ]);
<add>
<add> $this->assertEquals(['users.0.name' => ['required']], $results->rules);
<add> $this->assertEquals(['users.*.name' => ['users.0.name']], $results->implicitAttributes);
<add> }
<add>
<add> public function testExplodeHandlesSegmentingNestedRules()
<add> {
<add> $parser = (new ValidationRuleParser([
<add> 'items' => [
<add> ['discounts' => [['id' => 1], ['id' => 2]]],
<add> ['discounts' => [['id' => 1], ['id' => 2]]],
<add> ],
<add> ]));
<add>
<add> $rules = [
<add> 'items.*' => Rule::nested(function () {
<add> return ['discounts.*.id' => 'distinct'];
<add> }),
<add> ];
<add>
<add> $results = $parser->explode($rules);
<add>
<add> $this->assertEquals([
<add> 'items.0.discounts.0.id' => ['distinct'],
<add> 'items.0.discounts.1.id' => ['distinct'],
<add> 'items.1.discounts.0.id' => ['distinct'],
<add> 'items.1.discounts.1.id' => ['distinct'],
<add> ], $results->rules);
<add>
<add> $this->assertEquals([
<add> 'items.1.discounts.*.id' => [
<add> 'items.1.discounts.0.id',
<add> 'items.1.discounts.1.id',
<add> ],
<add> 'items.0.discounts.*.id' => [
<add> 'items.0.discounts.0.id',
<add> 'items.0.discounts.1.id',
<add> ],
<add> 'items.*' => [
<add> 'items.0',
<add> 'items.1',
<add> ],
<add> ], $results->implicitAttributes);
<add> }
<add>}
<ide>\ No newline at end of file | 5 |
Javascript | Javascript | fix feature flags react-dom/unstable-new-scheduler | 3a44ccefeda8cfa19482c8a3a4480a83cae6c2ae | <ide><path>scripts/rollup/bundles.js
<ide> const bundles = [
<ide> FB_WWW_PROFILING,
<ide> NODE_DEV,
<ide> NODE_PROD,
<add> NODE_PROFILING,
<ide> ],
<ide> moduleType: RENDERER,
<ide> entry: 'react-dom/unstable-new-scheduler',
<ide><path>scripts/rollup/forks.js
<ide> const inlinedHostConfigs = require('../shared/inlinedHostConfigs');
<ide> const UMD_DEV = bundleTypes.UMD_DEV;
<ide> const UMD_PROD = bundleTypes.UMD_PROD;
<ide> const UMD_PROFILING = bundleTypes.UMD_PROFILING;
<add>const NODE_DEV = bundleTypes.NODE_DEV;
<add>const NODE_PROD = bundleTypes.NODE_PROD;
<add>const NODE_PROFILING = bundleTypes.NODE_PROFILING;
<ide> const FB_WWW_DEV = bundleTypes.FB_WWW_DEV;
<ide> const FB_WWW_PROD = bundleTypes.FB_WWW_PROD;
<ide> const FB_WWW_PROFILING = bundleTypes.FB_WWW_PROFILING;
<ide> const forks = Object.freeze({
<ide> 'shared/ReactFeatureFlags': (bundleType, entry) => {
<ide> switch (entry) {
<ide> case 'react-dom/unstable-new-scheduler': {
<del> if (entry === 'react-dom/unstable-new-scheduler') {
<del> return 'shared/forks/ReactFeatureFlags.www-new-scheduler.js';
<add> switch (bundleType) {
<add> case FB_WWW_DEV:
<add> case FB_WWW_PROD:
<add> case FB_WWW_PROFILING:
<add> return 'shared/forks/ReactFeatureFlags.www-new-scheduler.js';
<add> case NODE_DEV:
<add> case NODE_PROD:
<add> case NODE_PROFILING:
<add> return 'shared/forks/ReactFeatureFlags.new-scheduler.js';
<add> default:
<add> throw Error(
<add> `Unexpected entry (${entry}) and bundleType (${bundleType})`
<add> );
<ide> }
<del> return null;
<ide> }
<ide> case 'react-native-renderer':
<ide> switch (bundleType) { | 2 |
Javascript | Javascript | apply numeric text event bubbling fix for android | 17cb70efdd1ed6378677e720a022c9d83ad87dd6 | <ide><path>Libraries/Renderer/src/renderers/shared/shared/event/EventPluginHub.js
<ide> var EventPluginHub = {
<ide> return null;
<ide> }
<ide> } else {
<del> if (typeof inst._currentElement === 'string') {
<add> const currentElement = inst._currentElement;
<add> if (
<add> typeof currentElement === 'string' || typeof currentElement === 'number'
<add> ) {
<ide> // Text node, let it bubble through.
<ide> return null;
<ide> }
<ide> if (!inst._rootNodeID) {
<ide> // If the instance is already unmounted, we have no listeners.
<ide> return null;
<ide> }
<del> const props = inst._currentElement.props;
<del> if (!props) {
<del> return null;
<del> }
<add> const props = currentElement.props;
<ide> listener = props[registrationName];
<del> if (shouldPreventMouseEvent(registrationName, inst._currentElement.type, props)) {
<add> if (
<add> shouldPreventMouseEvent(registrationName, currentElement.type, props)
<add> ) {
<ide> return null;
<ide> }
<ide> } | 1 |
Java | Java | remove global list in jscheapcapture | 31628f3aa49256d489d6670c9e25ddd593216370 | <ide><path>ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerImpl.java
<ide> public void run() {
<ide> }
<ide>
<ide> private void handleCaptureHeap() {
<del> JSCHeapCapture.captureHeap(
<add> if (mCurrentContext == null) {
<add> return;
<add> }
<add> JSCHeapCapture heapCapture = mCurrentContext.getNativeModule(JSCHeapCapture.class);
<add> heapCapture.captureHeap(
<ide> mApplicationContext.getCacheDir().getPath(),
<ide> JSCHeapUpload.captureCallback(mDevServerHelper.getHeapCaptureUploadUrl()));
<ide> }
<ide><path>ReactAndroid/src/main/java/com/facebook/react/devsupport/JSCHeapCapture.java
<ide> import javax.annotation.Nullable;
<ide>
<ide> import java.io.File;
<del>import java.util.HashSet;
<del>import java.util.LinkedList;
<del>import java.util.List;
<ide>
<ide> import com.facebook.react.bridge.JavaScriptModule;
<ide> import com.facebook.react.bridge.ReactApplicationContext;
<ide> public static class CaptureException extends Exception {
<ide> }
<ide>
<ide> public interface CaptureCallback {
<del> void onComplete(List<File> captures, List<CaptureException> failures);
<del> }
<del>
<del> private interface PerCaptureCallback {
<ide> void onSuccess(File capture);
<del> void onFailure(CaptureException cause);
<del> }
<del>
<del> private @Nullable HeapCapture mHeapCapture;
<del> private @Nullable PerCaptureCallback mCaptureInProgress;
<del>
<del> private static final HashSet<JSCHeapCapture> sRegisteredDumpers = new HashSet<>();
<del>
<del> private static synchronized void registerHeapCapture(JSCHeapCapture dumper) {
<del> if (sRegisteredDumpers.contains(dumper)) {
<del> throw new RuntimeException(
<del> "a JSCHeapCapture registered more than once");
<del> }
<del> sRegisteredDumpers.add(dumper);
<add> void onFailure(CaptureException error);
<ide> }
<ide>
<del> private static synchronized void unregisterHeapCapture(JSCHeapCapture dumper) {
<del> sRegisteredDumpers.remove(dumper);
<del> }
<del>
<del> public static synchronized void captureHeap(String path, final CaptureCallback callback) {
<del> final LinkedList<File> captureFiles = new LinkedList<>();
<del> final LinkedList<CaptureException> captureFailures = new LinkedList<>();
<del>
<del> if (sRegisteredDumpers.isEmpty()) {
<del> captureFailures.add(new CaptureException("No JSC registered"));
<del> callback.onComplete(captureFiles, captureFailures);
<del> return;
<del> }
<del>
<del> int disambiguate = 0;
<del> File f = new File(path + "/capture" + Integer.toString(disambiguate) + ".json");
<del> while (f.delete()) {
<del> disambiguate++;
<del> f = new File(path + "/capture" + Integer.toString(disambiguate) + ".json");
<del> }
<del>
<del> final int numRegisteredDumpers = sRegisteredDumpers.size();
<del> disambiguate = 0;
<del> for (JSCHeapCapture dumper : sRegisteredDumpers) {
<del> File file = new File(path + "/capture" + Integer.toString(disambiguate) + ".json");
<del> dumper.captureHeapHelper(file, new PerCaptureCallback() {
<del> @Override
<del> public void onSuccess(File capture) {
<del> captureFiles.add(capture);
<del> if (captureFiles.size() + captureFailures.size() == numRegisteredDumpers) {
<del> callback.onComplete(captureFiles, captureFailures);
<del> }
<del> }
<del> @Override
<del> public void onFailure(CaptureException cause) {
<del> captureFailures.add(cause);
<del> if (captureFiles.size() + captureFailures.size() == numRegisteredDumpers) {
<del> callback.onComplete(captureFiles, captureFailures);
<del> }
<del> }
<del> });
<del> }
<del> }
<add> private @Nullable CaptureCallback mCaptureInProgress;
<ide>
<ide> public JSCHeapCapture(ReactApplicationContext reactContext) {
<ide> super(reactContext);
<del> mHeapCapture = null;
<ide> mCaptureInProgress = null;
<ide> }
<ide>
<del> private synchronized void captureHeapHelper(File file, PerCaptureCallback callback) {
<del> if (mHeapCapture == null) {
<del> callback.onFailure(new CaptureException("HeapCapture.js module not connected"));
<add> public synchronized void captureHeap(String path, final CaptureCallback callback) {
<add> if (mCaptureInProgress != null) {
<add> callback.onFailure(new CaptureException("Heap capture already in progress."));
<ide> return;
<ide> }
<del> if (mCaptureInProgress != null) {
<del> callback.onFailure(new CaptureException("Heap capture already in progress"));
<add> File f = new File(path + "/capture.json");
<add> f.delete();
<add>
<add> HeapCapture heapCapture = getReactApplicationContext().getJSModule(HeapCapture.class);
<add> if (heapCapture == null) {
<add> callback.onFailure(new CaptureException("Heap capture js module not registered."));
<ide> return;
<ide> }
<ide> mCaptureInProgress = callback;
<del> mHeapCapture.captureHeap(file.getPath());
<add> heapCapture.captureHeap(f.getPath());
<ide> }
<ide>
<ide> @ReactMethod
<ide> public synchronized void captureComplete(String path, String error) {
<ide> public String getName() {
<ide> return "JSCHeapCapture";
<ide> }
<del>
<del> @Override
<del> public void initialize() {
<del> super.initialize();
<del> mHeapCapture = getReactApplicationContext().getJSModule(HeapCapture.class);
<del> registerHeapCapture(this);
<del> }
<del>
<del> @Override
<del> public void onCatalystInstanceDestroy() {
<del> super.onCatalystInstanceDestroy();
<del> unregisterHeapCapture(this);
<del> mHeapCapture = null;
<del> }
<ide> }
<ide><path>ReactAndroid/src/main/java/com/facebook/react/devsupport/JSCHeapUpload.java
<ide> public class JSCHeapUpload {
<ide> public static JSCHeapCapture.CaptureCallback captureCallback(final String uploadUrl) {
<ide> return new JSCHeapCapture.CaptureCallback() {
<ide> @Override
<del> public void onComplete(
<del> List<File> captures,
<del> List<JSCHeapCapture.CaptureException> failures) {
<del> for (JSCHeapCapture.CaptureException e : failures) {
<del> Log.e("JSCHeapCapture", e.getMessage());
<del> }
<del>
<add> public void onSuccess(File capture) {
<ide> OkHttpClient httpClient = new OkHttpClient.Builder().build();
<add> RequestBody body = RequestBody.create(MediaType.parse("application/json"), capture);
<add> Request request = new Request.Builder()
<add> .url(uploadUrl)
<add> .method("POST", body)
<add> .build();
<add> Call call = httpClient.newCall(request);
<add> call.enqueue(new Callback() {
<add> @Override
<add> public void onFailure(Call call, IOException e) {
<add> Log.e("JSCHeapCapture", "Upload of heap capture failed: " + e.toString());
<add> }
<ide>
<del> for (File path : captures) {
<del> RequestBody body = RequestBody.create(MediaType.parse("application/json"), path);
<del> Request request = new Request.Builder()
<del> .url(uploadUrl)
<del> .method("POST", body)
<del> .build();
<del> Call call = httpClient.newCall(request);
<del> call.enqueue(new Callback() {
<del> @Override
<del> public void onFailure(Call call, IOException e) {
<del> Log.e("JSCHeapCapture", "Upload of heap capture failed: " + e.toString());
<add> @Override
<add> public void onResponse(Call call, Response response) throws IOException {
<add> if (!response.isSuccessful()) {
<add> Log.e("JSCHeapCapture", "Upload of heap capture failed with code: " + Integer.toString(response.code()));
<ide> }
<add> }
<add> });
<add> }
<ide>
<del> @Override
<del> public void onResponse(Call call, Response response) throws IOException {
<del> if (!response.isSuccessful()) {
<del> Log.e("JSCHeapCapture", "Upload of heap capture failed with code: " + Integer.toString(response.code()));
<del> }
<del> }
<del> });
<del> }
<add> @Override
<add> public void onFailure(JSCHeapCapture.CaptureException e) {
<add> Log.e("JSCHeapCapture", "Heap capture failed: " + e.toString());
<ide> }
<ide> };
<ide> } | 3 |
Ruby | Ruby | change the "unstable" spec message to devel/head | fabb0931e3fc13ad929b88996b9821acdea041d0 | <ide><path>Library/Homebrew/dev-cmd/audit.rb
<ide> def audit_specs
<ide> end
<ide>
<ide> if formula.head || formula.devel
<del> unstable_spec_message = "Formulae should not have an unstable spec"
<add> unstable_spec_message = "Formulae should not have a `HEAD` or `devel` spec"
<ide> if @new_formula
<ide> new_formula_problem unstable_spec_message
<ide> elsif formula.versioned_formula? | 1 |
PHP | PHP | add wherejsoncontains() to sql server | 8038c3d7eeb8d1cdbec8924bd0b4b41c3234f4d8 | <ide><path>src/Illuminate/Database/Query/Builder.php
<ide> public function whereJsonContains($column, $value, $boolean = 'and', $not = fals
<ide> $this->wheres[] = compact('type', 'column', 'value', 'boolean', 'not');
<ide>
<ide> if (! $value instanceof Expression) {
<del> $this->addBinding(json_encode($value));
<add> $this->addBinding($this->grammar->prepareBindingForJsonContains($value));
<ide> }
<ide>
<ide> return $this;
<ide><path>src/Illuminate/Database/Query/Grammars/Grammar.php
<ide> protected function compileJsonContains($column, $value)
<ide> throw new RuntimeException('This database engine does not support JSON contains operations.');
<ide> }
<ide>
<add> /**
<add> * Prepare the binding for a "JSON contains" statement.
<add> *
<add> * @param mixed $binding
<add> * @return string
<add> */
<add> public function prepareBindingForJsonContains($binding)
<add> {
<add> return json_encode($binding);
<add> }
<add>
<ide> /**
<ide> * Compile the "group by" portions of the query.
<ide> *
<ide><path>src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php
<ide> protected function whereDate(Builder $query, $where)
<ide> return 'cast('.$this->wrap($where['column']).' as date) '.$where['operator'].' '.$value;
<ide> }
<ide>
<add> /**
<add> * Compile a "JSON contains" statement into SQL.
<add> *
<add> * @param string $column
<add> * @param string $value
<add> * @return string
<add> */
<add> protected function compileJsonContains($column, $value)
<add> {
<add> $from = $column[0] == '[' ?
<add> 'openjson('.$column.')' :
<add> substr_replace($column, 'openjson', 0, strlen('json_value'));
<add>
<add> return $value.' in (select [value] from '.$from.')';
<add> }
<add>
<add> /**
<add> * Prepare the binding for a "JSON contains" statement.
<add> *
<add> * @param mixed $binding
<add> * @return string
<add> */
<add> public function prepareBindingForJsonContains($binding)
<add> {
<add> return is_bool($binding) ? json_encode($binding) : $binding;
<add> }
<add>
<ide> /**
<ide> * Create a full ANSI offset clause for the query.
<ide> *
<ide><path>tests/Database/DatabaseQueryBuilderTest.php
<ide> public function testWhereRowValuesArityMismatch()
<ide>
<ide> public function testWhereJsonContainsMySql()
<ide> {
<add> $builder = $this->getMySqlBuilder();
<add> $builder->select('*')->from('users')->whereJsonContains('options', ['en']);
<add> $this->assertEquals('select * from `users` where json_contains(`options`, ?)', $builder->toSql());
<add> $this->assertEquals(['["en"]'], $builder->getBindings());
<add>
<ide> $builder = $this->getMySqlBuilder();
<ide> $builder->select('*')->from('users')->whereJsonContains('options->languages', ['en']);
<ide> $this->assertEquals('select * from `users` where json_contains(`options`->\'$."languages"\', ?)', $builder->toSql());
<ide> public function testWhereJsonContainsMySql()
<ide>
<ide> public function testWhereJsonContainsPostgres()
<ide> {
<add> $builder = $this->getPostgresBuilder();
<add> $builder->select('*')->from('users')->whereJsonContains('options', ['en']);
<add> $this->assertEquals('select * from "users" where ("options")::jsonb @> ?', $builder->toSql());
<add> $this->assertEquals(['["en"]'], $builder->getBindings());
<add>
<ide> $builder = $this->getPostgresBuilder();
<ide> $builder->select('*')->from('users')->whereJsonContains('options->languages', ['en']);
<ide> $this->assertEquals('select * from "users" where ("options"->\'languages\')::jsonb @> ?', $builder->toSql());
<ide> public function testWhereJsonContainsSqlite()
<ide> $builder->select('*')->from('users')->whereJsonContains('options->languages', ['en'])->toSql();
<ide> }
<ide>
<del> /**
<del> * @expectedException \RuntimeException
<del> */
<ide> public function testWhereJsonContainsSqlServer()
<ide> {
<ide> $builder = $this->getSqlServerBuilder();
<del> $builder->select('*')->from('users')->whereJsonContains('options->languages', ['en'])->toSql();
<add> $builder->select('*')->from('users')->whereJsonContains('options', true);
<add> $this->assertEquals('select * from [users] where ? in (select [value] from openjson([options]))', $builder->toSql());
<add> $this->assertEquals(['true'], $builder->getBindings());
<add>
<add> $builder = $this->getSqlServerBuilder();
<add> $builder->select('*')->from('users')->whereJsonContains('options->languages', 'en');
<add> $this->assertEquals('select * from [users] where ? in (select [value] from openjson([options], \'$."languages"\'))', $builder->toSql());
<add> $this->assertEquals(['en'], $builder->getBindings());
<add>
<add> $builder = $this->getSqlServerBuilder();
<add> $builder->select('*')->from('users')->where('id', '=', 1)->orWhereJsonContains('options->languages', new Raw("'en'"));
<add> $this->assertEquals('select * from [users] where [id] = ? or \'en\' in (select [value] from openjson([options], \'$."languages"\'))', $builder->toSql());
<add> $this->assertEquals([1], $builder->getBindings());
<ide> }
<ide>
<ide> public function testWhereJsonDoesntContainMySql()
<ide> public function testWhereJsonDoesntContainSqlite()
<ide> $builder->select('*')->from('users')->whereJsonDoesntContain('options->languages', ['en'])->toSql();
<ide> }
<ide>
<del> /**
<del> * @expectedException \RuntimeException
<del> */
<ide> public function testWhereJsonDoesntContainSqlServer()
<ide> {
<ide> $builder = $this->getSqlServerBuilder();
<del> $builder->select('*')->from('users')->whereJsonDoesntContain('options->languages', ['en'])->toSql();
<add> $builder->select('*')->from('users')->whereJsonDoesntContain('options->languages', 'en');
<add> $this->assertEquals('select * from [users] where not ? in (select [value] from openjson([options], \'$."languages"\'))', $builder->toSql());
<add> $this->assertEquals(['en'], $builder->getBindings());
<add>
<add> $builder = $this->getSqlServerBuilder();
<add> $builder->select('*')->from('users')->where('id', '=', 1)->orWhereJsonDoesntContain('options->languages', new Raw("'en'"));
<add> $this->assertEquals('select * from [users] where [id] = ? or not \'en\' in (select [value] from openjson([options], \'$."languages"\'))', $builder->toSql());
<add> $this->assertEquals([1], $builder->getBindings());
<ide> }
<ide>
<ide> public function testFromSub() | 4 |
Javascript | Javascript | remove unnecessary set watching to zero | 3edefeae22cf7c84fafc026230c26fc4af75d608 | <ide><path>packages/ember-metal/lib/watching.js
<ide> var propertyDidChange = Ember.propertyDidChange = function(obj, keyName) {
<ide> @returns {void}
<ide> */
<ide> Ember.destroy = function (obj) {
<del> var meta = obj[META_KEY], chains, watching, paths, path;
<add> var meta = obj[META_KEY], chains, paths, path;
<ide> if (meta) {
<ide> obj[META_KEY] = null;
<ide> // remove chains to remove circular references that would prevent GC
<ide> chains = meta.chains;
<ide> if (chains) {
<del> watching = meta.watching;
<ide> paths = chains._paths;
<ide> for(path in paths) {
<ide> if (!(paths[path] > 0)) continue; // this check will also catch non-number vals.
<ide> chains.remove(path);
<del> watching[path] = 0;
<ide> }
<ide> }
<ide> } | 1 |
PHP | PHP | add sub-view evaluating back to view class | 7ad1126cf18cd5b732e54fd7c853931a540d2400 | <ide><path>system/view.php
<ide> public function get()
<ide> throw new \Exception("View [$view] does not exist.");
<ide> }
<ide>
<add> foreach ($this->data as &$data)
<add> {
<add> if ($data instanceof View or $data instanceof Response) $data = (string) $data;
<add> }
<add>
<ide> ob_start() and extract($this->data, EXTR_SKIP);
<ide>
<ide> try { include $this->path.$view.EXT; } catch (\Exception $e) { Error::handle($e); } | 1 |
Ruby | Ruby | use undeprecated add_offense form | 4e29152603ed192e90b83b66f0ad92a676549c43 | <ide><path>Library/Homebrew/rubocops/extend/formula_cop.rb
<ide> def formula_tap
<ide> end
<ide>
<ide> def problem(msg)
<del> add_offense(@offensive_node, @offense_source_range, msg)
<add> add_offense(@offensive_node, location: @offense_source_range, message: msg)
<ide> end
<ide>
<ide> private | 1 |
Text | Text | add full deprecation history | ed130d2e2c3422451915f89b73894b2abc822880 | <ide><path>doc/api/deprecations.md
<ide> However, the deprecation identifier will not be modified.
<ide>
<ide> <a id="DEP0001"></a>
<ide> ### DEP0001: http.OutgoingMessage.prototype.flush
<add><!-- YAML
<add>changes:
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v1.6.0
<add> pr-url: https://github.com/nodejs/node/pull/1156
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> The `OutgoingMessage.prototype.flush()` method is deprecated. Use
<ide>
<ide> <a id="DEP0002"></a>
<ide> ### DEP0002: require('\_linklist')
<add><!-- YAML
<add>changes:
<add> - version: v8.0.0
<add> pr-url: https://github.com/nodejs/node/pull/12113
<add> description: End-of-Life.
<add> - version: v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v5.0.0
<add> pr-url: https://github.com/nodejs/node/pull/3078
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: End-of-Life
<ide>
<ide> The `_linklist` module is deprecated. Please use a userland alternative.
<ide>
<ide> <a id="DEP0003"></a>
<ide> ### DEP0003: \_writableState.buffer
<add><!-- YAML
<add>changes:
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v0.11.15
<add> pr-url: https://github.com/nodejs/node-v0.x-archive/pull/8826
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> The `_writableState.buffer` property is deprecated. Use the
<ide>
<ide> <a id="DEP0004"></a>
<ide> ### DEP0004: CryptoStream.prototype.readyState
<add><!-- YAML
<add>changes:
<add> - version: v10.0.0
<add> pr-url: https://github.com/nodejs/node/pull/17882
<add> description: End-of-Life.
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: 0.4.0
<add> commit: 9c7f89bf56abd37a796fea621ad2e47dd33d2b82
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: End-of-Life
<ide>
<ide> The `CryptoStream.prototype.readyState` property was removed.
<ide>
<ide> <a id="DEP0005"></a>
<ide> ### DEP0005: Buffer() constructor
<add><!-- YAML
<add>changes:
<add> - version: v10.0.0
<add> pr-url: https://github.com/nodejs/node/pull/19524
<add> description: Runtime deprecation.
<add> - version: v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v6.0.0
<add> pr-url: https://github.com/nodejs/node/pull/4682
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Runtime (supports [`--pending-deprecation`][])
<ide>
<ide> outside `node_modules` in order to better target developers, rather than users.
<ide>
<ide> <a id="DEP0006"></a>
<ide> ### DEP0006: child\_process options.customFds
<add><!-- YAML
<add>changes:
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v0.11.14
<add> description: Runtime deprecation.
<add> - version: v0.5.11
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> option should be used instead.
<ide>
<ide> <a id="DEP0007"></a>
<ide> ### DEP0007: Replace cluster worker.suicide with worker.exitedAfterDisconnect
<add><!-- YAML
<add>changes:
<add> - version: v9.0.0
<add> pr-url: https://github.com/nodejs/node/pull/13702
<add> description: End-of-Life.
<add> - version: v7.0.0
<add> pr-url: https://github.com/nodejs/node/pull/3747
<add> description: Runtime deprecation.
<add> - version: v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v6.0.0
<add> pr-url: https://github.com/nodejs/node/pull/3743
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: End-of-Life
<ide>
<ide> precisely describe the actual semantics and was unnecessarily emotion-laden.
<ide>
<ide> <a id="DEP0008"></a>
<ide> ### DEP0008: require('constants')
<add><!-- YAML
<add>changes:
<add> - version: v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v6.3.0
<add> pr-url: https://github.com/nodejs/node/pull/6534
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> to the `constants` property exposed by the relevant module. For instance,
<ide>
<ide> <a id="DEP0009"></a>
<ide> ### DEP0009: crypto.pbkdf2 without digest
<add><!-- YAML
<add>changes:
<add> - version: v8.0.0
<add> pr-url: https://github.com/nodejs/node/pull/11305
<add> description: End-of-Life.
<add> - version: v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v6.0.0
<add> pr-url: https://github.com/nodejs/node/pull/4047
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: End-of-Life
<ide>
<ide> undefined `digest` will throw a `TypeError`.
<ide>
<ide> <a id="DEP0010"></a>
<ide> ### DEP0010: crypto.createCredentials
<add><!-- YAML
<add>changes:
<add> - version: REPLACEME
<add> pr-url: https://github.com/nodejs/node/pull/21153
<add> description: End-of-Life.
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v0.11.13
<add> pr-url: https://github.com/nodejs/node-v0.x-archive/pull/7265
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: End-of-Life
<ide>
<ide> The `crypto.createCredentials()` API was removed. Please use
<ide>
<ide> <a id="DEP0011"></a>
<ide> ### DEP0011: crypto.Credentials
<add><!-- YAML
<add>changes:
<add> - version: REPLACEME
<add> pr-url: https://github.com/nodejs/node/pull/21153
<add> description: End-of-Life.
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v0.11.13
<add> pr-url: https://github.com/nodejs/node-v0.x-archive/pull/7265
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: End-of-Life
<ide>
<ide> instead.
<ide>
<ide> <a id="DEP0012"></a>
<ide> ### DEP0012: Domain.dispose
<add><!-- YAML
<add>changes:
<add> - version: v9.0.0
<add> pr-url: https://github.com/nodejs/node/pull/15412
<add> description: End-of-Life.
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v0.11.7
<add> pr-url: https://github.com/nodejs/node-v0.x-archive/pull/5021
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: End-of-Life
<ide>
<ide> explicitly via error event handlers set on the domain instead.
<ide>
<ide> <a id="DEP0013"></a>
<ide> ### DEP0013: fs asynchronous function without callback
<add><!-- YAML
<add>changes:
<add> - version: v10.0.0
<add> pr-url: https://github.com/nodejs/node/pull/18668
<add> description: End-of-Life.
<add> - version: v7.0.0
<add> pr-url: https://github.com/nodejs/node/pull/7897
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: End-of-Life
<ide>
<ide> in Node.js 10.0.0 onwards. (See https://github.com/nodejs/node/pull/12562.)
<ide>
<ide> <a id="DEP0014"></a>
<ide> ### DEP0014: fs.read legacy String interface
<add><!-- YAML
<add>changes:
<add> - version: v8.0.0
<add> pr-url: https://github.com/nodejs/node/pull/9683
<add> description: End-of-Life.
<add> - version: v6.0.0
<add> pr-url: https://github.com/nodejs/node/pull/4525
<add> description: Runtime deprecation.
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v0.1.96
<add> commit: c93e0aaf062081db3ec40ac45b3e2c979d5759d6
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: End-of-Life
<ide>
<ide> API as mentioned in the documentation instead.
<ide>
<ide> <a id="DEP0015"></a>
<ide> ### DEP0015: fs.readSync legacy String interface
<add><!-- YAML
<add>changes:
<add> - version: v8.0.0
<add> pr-url: https://github.com/nodejs/node/pull/9683
<add> description: End-of-Life.
<add> - version: v6.0.0
<add> pr-url: https://github.com/nodejs/node/pull/4525
<add> description: Runtime deprecation.
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v0.1.96
<add> commit: c93e0aaf062081db3ec40ac45b3e2c979d5759d6
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: End-of-Life
<ide>
<ide> The [`fs.readSync()`][] legacy `String` interface is deprecated. Use the
<ide>
<ide> <a id="DEP0016"></a>
<ide> ### DEP0016: GLOBAL/root
<add><!-- YAML
<add>changes:
<add> - version: v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v6.0.0
<add> pr-url: https://github.com/nodejs/node/pull/1838
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> and should no longer be used.
<ide>
<ide> <a id="DEP0017"></a>
<ide> ### DEP0017: Intl.v8BreakIterator
<add><!-- YAML
<add>changes:
<add> - version: v9.0.0
<add> pr-url: https://github.com/nodejs/node/pull/15238
<add> description: End-of-Life.
<add> - version: v7.0.0
<add> pr-url: https://github.com/nodejs/node/pull/8908
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: End-of-Life
<ide>
<ide> See [`Intl.Segmenter`](https://github.com/tc39/proposal-intl-segmenter).
<ide>
<ide> <a id="DEP0018"></a>
<ide> ### DEP0018: Unhandled promise rejections
<add><!-- YAML
<add>changes:
<add> - version: v7.0.0
<add> pr-url: https://github.com/nodejs/node/pull/8217
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> code.
<ide>
<ide> <a id="DEP0019"></a>
<ide> ### DEP0019: require('.') resolved outside directory
<add><!-- YAML
<add>changes:
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v1.8.1
<add> pr-url: https://github.com/nodejs/node/pull/1363
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> release.
<ide>
<ide> <a id="DEP0020"></a>
<ide> ### DEP0020: Server.connections
<add><!-- YAML
<add>changes:
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v0.9.7
<add> pr-url: https://github.com/nodejs/node-v0.x-archive/pull/4595
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> The [`Server.connections`][] property is deprecated. Please use the
<ide>
<ide> <a id="DEP0021"></a>
<ide> ### DEP0021: Server.listenFD
<add><!-- YAML
<add>changes:
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v0.7.12
<add> commit: 41421ff9da1288aa241a5e9dcf915b685ade1c23
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> The `Server.listenFD()` method is deprecated. Please use
<ide>
<ide> <a id="DEP0022"></a>
<ide> ### DEP0022: os.tmpDir()
<add><!-- YAML
<add>changes:
<add> - version: v7.0.0
<add> pr-url: https://github.com/nodejs/node/pull/6739
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> The `os.tmpDir()` API is deprecated. Please use [`os.tmpdir()`][] instead.
<ide>
<ide> <a id="DEP0023"></a>
<ide> ### DEP0023: os.getNetworkInterfaces()
<add><!-- YAML
<add>changes:
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v0.6.0
<add> commit: 37bb37d151fb6ee4696730e63ff28bb7a4924f97
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> The `os.getNetworkInterfaces()` method is deprecated. Please use the
<ide>
<ide> <a id="DEP0024"></a>
<ide> ### DEP0024: REPLServer.prototype.convertToContext()
<add><!-- YAML
<add>changes:
<add> - version: v9.0.0
<add> pr-url: https://github.com/nodejs/node/pull/13434
<add> description: End-of-Life.
<add> - version: v7.0.0
<add> pr-url: https://github.com/nodejs/node/pull/7829
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: End-of-Life
<ide>
<ide> The `REPLServer.prototype.convertToContext()` API has been removed.
<ide>
<ide> <a id="DEP0025"></a>
<ide> ### DEP0025: require('sys')
<add><!-- YAML
<add>changes:
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v1.0.0
<add> pr-url: https://github.com/nodejs/node/pull/317
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> The `sys` module is deprecated. Please use the [`util`][] module instead.
<ide>
<ide> <a id="DEP0026"></a>
<ide> ### DEP0026: util.print()
<add><!-- YAML
<add>changes:
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v0.11.3
<add> commit: 896b2aa7074fc886efd7dd0a397d694763cac7ce
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> instead.
<ide>
<ide> <a id="DEP0027"></a>
<ide> ### DEP0027: util.puts()
<add><!-- YAML
<add>changes:
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v0.11.3
<add> commit: 896b2aa7074fc886efd7dd0a397d694763cac7ce
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> The [`util.puts()`][] API is deprecated. Please use [`console.log()`][] instead.
<ide>
<ide> <a id="DEP0028"></a>
<ide> ### DEP0028: util.debug()
<add><!-- YAML
<add>changes:
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v0.11.3
<add> commit: 896b2aa7074fc886efd7dd0a397d694763cac7ce
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> instead.
<ide>
<ide> <a id="DEP0029"></a>
<ide> ### DEP0029: util.error()
<add><!-- YAML
<add>changes:
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v0.11.3
<add> commit: 896b2aa7074fc886efd7dd0a397d694763cac7ce
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> instead.
<ide>
<ide> <a id="DEP0030"></a>
<ide> ### DEP0030: SlowBuffer
<add><!-- YAML
<add>changes:
<add> - version: v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v6.0.0
<add> pr-url: https://github.com/nodejs/node/pull/5833
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> The [`SlowBuffer`][] class is deprecated. Please use
<ide>
<ide> <a id="DEP0031"></a>
<ide> ### DEP0031: ecdh.setPublicKey()
<add><!-- YAML
<add>changes:
<add> - version: v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v5.2.0
<add> pr-url: https://github.com/nodejs/node/pull/3511
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> API is not useful.
<ide>
<ide> <a id="DEP0032"></a>
<ide> ### DEP0032: domain module
<add><!-- YAML
<add>changes:
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v1.4.2
<add> pr-url: https://github.com/nodejs/node/pull/943
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> The [`domain`][] module is deprecated and should not be used.
<ide>
<ide> <a id="DEP0033"></a>
<ide> ### DEP0033: EventEmitter.listenerCount()
<add><!-- YAML
<add>changes:
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v3.2.0
<add> pr-url: https://github.com/nodejs/node/pull/2349
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> deprecated. Please use [`emitter.listenerCount(eventName)`][] instead.
<ide>
<ide> <a id="DEP0034"></a>
<ide> ### DEP0034: fs.exists(path, callback)
<add><!-- YAML
<add>changes:
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v1.0.0
<add> pr-url: https://github.com/iojs/io.js/pull/166
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> The [`fs.exists(path, callback)`][] API is deprecated. Please use
<ide>
<ide> <a id="DEP0035"></a>
<ide> ### DEP0035: fs.lchmod(path, mode, callback)
<add><!-- YAML
<add>changes:
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v0.4.7
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> The [`fs.lchmod(path, mode, callback)`][] API is deprecated.
<ide>
<ide> <a id="DEP0036"></a>
<ide> ### DEP0036: fs.lchmodSync(path, mode)
<add><!-- YAML
<add>changes:
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v0.4.7
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> The [`fs.lchmodSync(path, mode)`][] API is deprecated.
<ide>
<add><a id="DEP0037"></a>
<add>### DEP0037: fs.lchown(path, uid, gid, callback)
<add><!-- YAML
<add>changes:
<add> - version: v10.6.0
<add> pr-url: https://github.com/nodejs/node/pull/21498
<add> description: Deprecation revoked.
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v0.4.7
<add> description: Documentation-only deprecation.
<add>-->
<add>
<add>Type: Deprecation revoked
<add>
<add>The [`fs.lchown(path, uid, gid, callback)`][] API is deprecated.
<add>
<add><a id="DEP0038"></a>
<add>### DEP0038: fs.lchownSync(path, uid, gid)
<add><!-- YAML
<add>changes:
<add> - version: v10.6.0
<add> pr-url: https://github.com/nodejs/node/pull/21498
<add> description: Deprecation revoked.
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v0.4.7
<add> description: Documentation-only deprecation.
<add>-->
<add>
<add>Type: Deprecation revoked
<add>
<add>The [`fs.lchownSync(path, uid, gid)`][] API is deprecated.
<add>
<ide> <a id="DEP0039"></a>
<ide> ### DEP0039: require.extensions
<add><!-- YAML
<add>changes:
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v0.10.6
<add> commit: 7bd8a5a2a60b75266f89f9a32877d55294a3881c
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> The [`require.extensions`][] property is deprecated.
<ide>
<ide> <a id="DEP0040"></a>
<ide> ### DEP0040: punycode module
<add><!-- YAML
<add>changes:
<add> - version: v7.0.0
<add> pr-url: https://github.com/nodejs/node/pull/7941
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> instead.
<ide>
<ide> <a id="DEP0041"></a>
<ide> ### DEP0041: NODE\_REPL\_HISTORY\_FILE environment variable
<add><!-- YAML
<add>changes:
<add> - version: v10.0.0
<add> pr-url: https://github.com/nodejs/node/pull/13876
<add> description: End-of-Life.
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v3.0.0
<add> pr-url: https://github.com/nodejs/node/pull/2224
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: End-of-Life
<ide>
<ide> The `NODE_REPL_HISTORY_FILE` environment variable was removed. Please use
<ide>
<ide> <a id="DEP0042"></a>
<ide> ### DEP0042: tls.CryptoStream
<add><!-- YAML
<add>changes:
<add> - version: v10.0.0
<add> pr-url: https://github.com/nodejs/node/pull/17882
<add> description: End-of-Life.
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v0.11.3
<add> commit: af80e7bc6e6f33c582eb1f7d37c7f5bbe9f910f7
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: End-of-Life
<ide>
<ide> The [`tls.CryptoStream`][] class was removed. Please use
<ide>
<ide> <a id="DEP0043"></a>
<ide> ### DEP0043: tls.SecurePair
<add><!-- YAML
<add>changes:
<add> - version: v8.0.0
<add> pr-url: https://github.com/nodejs/node/pull/11349
<add> description: Runtime deprecation.
<add> - version: v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v6.0.0
<add> pr-url: https://github.com/nodejs/node/pull/6063
<add> description: Documentation-only deprecation.
<add> - version: v0.11.15
<add> pr-url:
<add> - https://github.com/nodejs/node-v0.x-archive/pull/8695
<add> - https://github.com/nodejs/node-v0.x-archive/pull/8700
<add> description: Deprecation revoked.
<add> - version: v0.11.3
<add> commit: af80e7bc6e6f33c582eb1f7d37c7f5bbe9f910f7
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> The [`tls.SecurePair`][] class is deprecated. Please use
<ide>
<ide> <a id="DEP0044"></a>
<ide> ### DEP0044: util.isArray()
<add><!-- YAML
<add>changes:
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version:
<add> - v3.3.1
<add> - v4.0.0
<add> pr-url: https://github.com/nodejs/node/pull/2447
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> instead.
<ide>
<ide> <a id="DEP0045"></a>
<ide> ### DEP0045: util.isBoolean()
<add><!-- YAML
<add>changes:
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version:
<add> - v3.3.1
<add> - v4.0.0
<add> pr-url: https://github.com/nodejs/node/pull/2447
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> The [`util.isBoolean()`][] API is deprecated.
<ide>
<ide> <a id="DEP0046"></a>
<ide> ### DEP0046: util.isBuffer()
<add><!-- YAML
<add>changes:
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version:
<add> - v3.3.1
<add> - v4.0.0
<add> pr-url: https://github.com/nodejs/node/pull/2447
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> The [`util.isBuffer()`][] API is deprecated. Please use
<ide>
<ide> <a id="DEP0047"></a>
<ide> ### DEP0047: util.isDate()
<add><!-- YAML
<add>changes:
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version:
<add> - v3.3.1
<add> - v4.0.0
<add> pr-url: https://github.com/nodejs/node/pull/2447
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> The [`util.isDate()`][] API is deprecated.
<ide>
<ide> <a id="DEP0048"></a>
<ide> ### DEP0048: util.isError()
<add><!-- YAML
<add>changes:
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version:
<add> - v3.3.1
<add> - v4.0.0
<add> pr-url: https://github.com/nodejs/node/pull/2447
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> The [`util.isError()`][] API is deprecated.
<ide>
<ide> <a id="DEP0049"></a>
<ide> ### DEP0049: util.isFunction()
<add><!-- YAML
<add>changes:
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version:
<add> - v3.3.1
<add> - v4.0.0
<add> pr-url: https://github.com/nodejs/node/pull/2447
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> The [`util.isFunction()`][] API is deprecated.
<ide>
<ide> <a id="DEP0050"></a>
<ide> ### DEP0050: util.isNull()
<add><!-- YAML
<add>changes:
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version:
<add> - v3.3.1
<add> - v4.0.0
<add> pr-url: https://github.com/nodejs/node/pull/2447
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> The [`util.isNull()`][] API is deprecated.
<ide>
<ide> <a id="DEP0051"></a>
<ide> ### DEP0051: util.isNullOrUndefined()
<add><!-- YAML
<add>changes:
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version:
<add> - v3.3.1
<add> - v4.0.0
<add> pr-url: https://github.com/nodejs/node/pull/2447
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> The [`util.isNullOrUndefined()`][] API is deprecated.
<ide>
<ide> <a id="DEP0052"></a>
<ide> ### DEP0052: util.isNumber()
<add><!-- YAML
<add>changes:
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version:
<add> - v3.3.1
<add> - v4.0.0
<add> pr-url: https://github.com/nodejs/node/pull/2447
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> The [`util.isNumber()`][] API is deprecated.
<ide>
<ide> <a id="DEP0053"></a>
<ide> ### DEP0053 util.isObject()
<add><!-- YAML
<add>changes:
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version:
<add> - v3.3.1
<add> - v4.0.0
<add> pr-url: https://github.com/nodejs/node/pull/2447
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> The [`util.isObject()`][] API is deprecated.
<ide>
<ide> <a id="DEP0054"></a>
<ide> ### DEP0054: util.isPrimitive()
<add><!-- YAML
<add>changes:
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version:
<add> - v3.3.1
<add> - v4.0.0
<add> pr-url: https://github.com/nodejs/node/pull/2447
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> The [`util.isPrimitive()`][] API is deprecated.
<ide>
<ide> <a id="DEP0055"></a>
<ide> ### DEP0055: util.isRegExp()
<add><!-- YAML
<add>changes:
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version:
<add> - v3.3.1
<add> - v4.0.0
<add> pr-url: https://github.com/nodejs/node/pull/2447
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> The [`util.isRegExp()`][] API is deprecated.
<ide>
<ide> <a id="DEP0056"></a>
<ide> ### DEP0056: util.isString()
<add><!-- YAML
<add>changes:
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version:
<add> - v3.3.1
<add> - v4.0.0
<add> pr-url: https://github.com/nodejs/node/pull/2447
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> The [`util.isString()`][] API is deprecated.
<ide>
<ide> <a id="DEP0057"></a>
<ide> ### DEP0057: util.isSymbol()
<add><!-- YAML
<add>changes:
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version:
<add> - v3.3.1
<add> - v4.0.0
<add> pr-url: https://github.com/nodejs/node/pull/2447
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> The [`util.isSymbol()`][] API is deprecated.
<ide>
<ide> <a id="DEP0058"></a>
<ide> ### DEP0058: util.isUndefined()
<add><!-- YAML
<add>changes:
<add> - version:
<add> - v4.8.6
<add> - v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version:
<add> - v3.3.1
<add> - v4.0.0
<add> pr-url: https://github.com/nodejs/node/pull/2447
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> The [`util.isUndefined()`][] API is deprecated.
<ide>
<ide> <a id="DEP0059"></a>
<ide> ### DEP0059: util.log()
<add><!-- YAML
<add>changes:
<add> - version: v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v6.0.0
<add> pr-url: https://github.com/nodejs/node/pull/6161
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> The [`util.log()`][] API is deprecated.
<ide>
<ide> <a id="DEP0060"></a>
<ide> ### DEP0060: util.\_extend()
<add><!-- YAML
<add>changes:
<add> - version: v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v6.0.0
<add> pr-url: https://github.com/nodejs/node/pull/4903
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> The [`util._extend()`][] API is deprecated.
<ide>
<ide> <a id="DEP0061"></a>
<ide> ### DEP0061: fs.SyncWriteStream
<add><!-- YAML
<add>changes:
<add> - version: REPLACEME
<add> pr-url: https://github.com/nodejs/node/pull/20735
<add> description: End-of-Life.
<add> - version: v8.0.0
<add> pr-url: https://github.com/nodejs/node/pull/10467
<add> description: Runtime deprecation.
<add> - version: v7.0.0
<add> pr-url: https://github.com/nodejs/node/pull/6749
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: End-of-Life
<ide>
<ide> alternative.
<ide>
<ide> <a id="DEP0062"></a>
<ide> ### DEP0062: node --debug
<add><!-- YAML
<add>changes:
<add> - version: v8.0.0
<add> pr-url: https://github.com/nodejs/node/pull/10970
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> instead.
<ide>
<ide> <a id="DEP0063"></a>
<ide> ### DEP0063: ServerResponse.prototype.writeHeader()
<add><!-- YAML
<add>changes:
<add> - version: v8.0.0
<add> pr-url: https://github.com/nodejs/node/pull/11355
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> officially supported API.
<ide>
<ide> <a id="DEP0064"></a>
<ide> ### DEP0064: tls.createSecurePair()
<add><!-- YAML
<add>changes:
<add> - version: v8.0.0
<add> pr-url: https://github.com/nodejs/node/pull/11349
<add> description: Runtime deprecation.
<add> - version: v6.12.0
<add> pr-url: https://github.com/nodejs/node/pull/10116
<add> description: A deprecation code has been assigned.
<add> - version: v6.0.0
<add> pr-url: https://github.com/nodejs/node/pull/6063
<add> description: Documentation-only deprecation.
<add> - version: v0.11.15
<add> pr-url:
<add> - https://github.com/nodejs/node-v0.x-archive/pull/8695
<add> - https://github.com/nodejs/node-v0.x-archive/pull/8700
<add> description: Deprecation revoked.
<add> - version: v0.11.3
<add> commit: af80e7bc6e6f33c582eb1f7d37c7f5bbe9f910f7
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> The `tls.createSecurePair()` API was deprecated in documentation in Node.js
<ide>
<ide> <a id="DEP0065"></a>
<ide> ### DEP0065: repl.REPL_MODE_MAGIC and NODE_REPL_MODE=magic
<add><!-- YAML
<add>changes:
<add> - version: v10.0.0
<add> pr-url: https://github.com/nodejs/node/pull/19187
<add> description: End-of-Life.
<add> - version: v8.0.0
<add> pr-url: https://github.com/nodejs/node/pull/11599
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: End-of-Life
<ide>
<ide> removed. Please use `sloppy` instead.
<ide>
<ide> <a id="DEP0066"></a>
<ide> ### DEP0066: outgoingMessage.\_headers, outgoingMessage.\_headerNames
<add><!-- YAML
<add>changes:
<add> - version: v8.0.0
<add> pr-url: https://github.com/nodejs/node/pull/10941
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> were never documented as officially supported properties.
<ide>
<ide> <a id="DEP0067"></a>
<ide> ### DEP0067: OutgoingMessage.prototype.\_renderHeaders
<add><!-- YAML
<add>changes:
<add> - version: v8.0.0
<add> pr-url: https://github.com/nodejs/node/pull/10941
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> an officially supported API.
<ide>
<ide> <a id="DEP0068"></a>
<ide> ### DEP0068: node debug
<add><!-- YAML
<add>changes:
<add> - version: v8.0.0
<add> pr-url: https://github.com/nodejs/node/pull/11441
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> a V8-inspector based CLI debugger available through `node inspect`.
<ide>
<ide> <a id="DEP0069"></a>
<ide> ### DEP0069: vm.runInDebugContext(string)
<add><!-- YAML
<add>changes:
<add> - version: v10.0.0
<add> pr-url: https://github.com/nodejs/node/pull/13295
<add> description: End-of-Life.
<add> - version: v9.0.0
<add> pr-url: https://github.com/nodejs/node/pull/12815
<add> description: Runtime deprecation.
<add> - version: v8.0.0
<add> pr-url: https://github.com/nodejs/node/pull/12243
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: End-of-Life
<ide>
<ide> DebugContext was an experimental API.
<ide>
<ide> <a id="DEP0070"></a>
<ide> ### DEP0070: async_hooks.currentId()
<add><!-- YAML
<add>changes:
<add> - version: v9.0.0
<add> pr-url: https://github.com/nodejs/node/pull/14414
<add> description: End-of-Life.
<add> - version: v8.2.0
<add> pr-url: https://github.com/nodejs/node/pull/13490
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: End-of-Life
<ide>
<ide> This change was made while `async_hooks` was an experimental API.
<ide>
<ide> <a id="DEP0071"></a>
<ide> ### DEP0071: async_hooks.triggerId()
<add><!-- YAML
<add>changes:
<add> - version: v9.0.0
<add> pr-url: https://github.com/nodejs/node/pull/14414
<add> description: End-of-Life.
<add> - version: v8.2.0
<add> pr-url: https://github.com/nodejs/node/pull/13490
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: End-of-Life
<ide>
<ide> This change was made while `async_hooks` was an experimental API.
<ide>
<ide> <a id="DEP0072"></a>
<ide> ### DEP0072: async_hooks.AsyncResource.triggerId()
<add><!-- YAML
<add>changes:
<add> - version: v9.0.0
<add> pr-url: https://github.com/nodejs/node/pull/14414
<add> description: End-of-Life.
<add> - version: v8.2.0
<add> pr-url: https://github.com/nodejs/node/pull/13490
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: End-of-Life
<ide>
<ide> This change was made while `async_hooks` was an experimental API.
<ide>
<ide> <a id="DEP0073"></a>
<ide> ### DEP0073: Several internal properties of net.Server
<add><!-- YAML
<add>changes:
<add> - version: v10.0.0
<add> pr-url: https://github.com/nodejs/node/pull/17141
<add> description: End-of-Life.
<add> - version: v9.0.0
<add> pr-url: https://github.com/nodejs/node/pull/14449
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: End-of-Life
<ide>
<ide> code, no replacement API is provided.
<ide>
<ide> <a id="DEP0074"></a>
<ide> ### DEP0074: REPLServer.bufferedCommand
<add><!-- YAML
<add>changes:
<add> - version: v9.0.0
<add> pr-url: https://github.com/nodejs/node/pull/13687
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> The `REPLServer.bufferedCommand` property was deprecated in favor of
<ide>
<ide> <a id="DEP0075"></a>
<ide> ### DEP0075: REPLServer.parseREPLKeyword()
<add><!-- YAML
<add>changes:
<add> - version: v9.0.0
<add> pr-url: https://github.com/nodejs/node/pull/14223
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> `REPLServer.parseREPLKeyword()` was removed from userland visibility.
<ide>
<ide> <a id="DEP0076"></a>
<ide> ### DEP0076: tls.parseCertString()
<add><!-- YAML
<add>changes:
<add> - version: v9.0.0
<add> pr-url: https://github.com/nodejs/node/pull/14249
<add> description: Runtime deprecation.
<add> - version: v8.6.0
<add> pr-url: https://github.com/nodejs/node/pull/14245
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> difference is that `querystring.parse()` does url decoding:
<ide>
<ide> <a id="DEP0077"></a>
<ide> ### DEP0077: Module.\_debug()
<add><!-- YAML
<add>changes:
<add> - version: v9.0.0
<add> pr-url: https://github.com/nodejs/node/pull/13948
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> supported API.
<ide>
<ide> <a id="DEP0078"></a>
<ide> ### DEP0078: REPLServer.turnOffEditorMode()
<add><!-- YAML
<add>changes:
<add> - version: v9.0.0
<add> pr-url: https://github.com/nodejs/node/pull/15136
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> `REPLServer.turnOffEditorMode()` was removed from userland visibility.
<ide>
<ide> <a id="DEP0079"></a>
<ide> ### DEP0079: Custom inspection function on Objects via .inspect()
<add><!-- YAML
<add>changes:
<add> - version: REPLACEME
<add> pr-url: https://github.com/nodejs/node/pull/20722
<add> description: End-of-Life.
<add> - version: v10.0.0
<add> pr-url: https://github.com/nodejs/node/pull/16393
<add> description: Runtime deprecation.
<add> - version: v8.7.0
<add> pr-url: https://github.com/nodejs/node/pull/15631
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: End-of-Life
<ide>
<ide> may be specified.
<ide>
<ide> <a id="DEP0080"></a>
<ide> ### DEP0080: path.\_makeLong()
<add><!-- YAML
<add>changes:
<add> - version: v9.0.0
<add> pr-url: https://github.com/nodejs/node/pull/14956
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> and replaced with an identical, public `path.toNamespacedPath()` method.
<ide>
<ide> <a id="DEP0081"></a>
<ide> ### DEP0081: fs.truncate() using a file descriptor
<add><!-- YAML
<add>changes:
<add> - version: v9.0.0
<add> pr-url: https://github.com/nodejs/node/pull/15990
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> file descriptors.
<ide>
<ide> <a id="DEP0082"></a>
<ide> ### DEP0082: REPLServer.prototype.memory()
<add><!-- YAML
<add>changes:
<add> - version: v9.0.0
<add> pr-url: https://github.com/nodejs/node/pull/16242
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> the `REPLServer` itself. Do not use this function.
<ide>
<ide> <a id="DEP0083"></a>
<ide> ### DEP0083: Disabling ECDH by setting ecdhCurve to false
<add><!-- YAML
<add>changes:
<add> - version: v9.2.0
<add> pr-url: https://github.com/nodejs/node/pull/16130
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> the client. Use the `ciphers` parameter instead.
<ide>
<ide> <a id="DEP0084"></a>
<ide> ### DEP0084: requiring bundled internal dependencies
<add><!-- YAML
<add>changes:
<add> - version: v10.0.0
<add> pr-url: https://github.com/nodejs/node/pull/16392
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> code modification is necessary if that is done.
<ide>
<ide> <a id="DEP0085"></a>
<ide> ### DEP0085: AsyncHooks Sensitive API
<add><!-- YAML
<add>changes:
<add> - version: 10.0.0
<add> pr-url: https://github.com/nodejs/node/pull/17147
<add> description: End-of-Life.
<add> - version:
<add> - v8.10.0
<add> - v9.4.0
<add> pr-url: https://github.com/nodejs/node/pull/16972
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: End-of-Life
<ide>
<ide> API instead.
<ide>
<ide> <a id="DEP0086"></a>
<ide> ### DEP0086: Remove runInAsyncIdScope
<add><!-- YAML
<add>changes:
<add> - version: 10.0.0
<add> pr-url: https://github.com/nodejs/node/pull/17147
<add> description: End-of-Life.
<add> - version:
<add> - v8.10.0
<add> - v9.4.0
<add> pr-url: https://github.com/nodejs/node/pull/16972
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: End-of-Life
<ide>
<ide> details.
<ide>
<ide> <a id="DEP0089"></a>
<ide> ### DEP0089: require('assert')
<add><!-- YAML
<add>changes:
<add> - version:
<add> - v9.9.0
<add> - v10.0.0
<add> pr-url: https://github.com/nodejs/node/pull/17002
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> same as the legacy assert but it will always use strict equality checks.
<ide>
<ide> <a id="DEP0090"></a>
<ide> ### DEP0090: Invalid GCM authentication tag lengths
<add><!-- YAML
<add>changes:
<add> - version: REPLACEME
<add> pr-url: https://github.com/nodejs/node/pull/17825
<add> description: End-of-Life.
<add> - version: v10.0.0
<add> pr-url: https://github.com/nodejs/node/pull/18017
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: End-of-Life
<ide>
<ide> considered invalid in compliance with [NIST SP 800-38D][].
<ide>
<ide> <a id="DEP0091"></a>
<ide> ### DEP0091: crypto.DEFAULT_ENCODING
<add><!-- YAML
<add>changes:
<add> - version: v10.0.0
<add> pr-url: https://github.com/nodejs/node/pull/18333
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> The [`crypto.DEFAULT_ENCODING`][] property is deprecated.
<ide>
<ide> <a id="DEP0092"></a>
<ide> ### DEP0092: Top-level `this` bound to `module.exports`
<add><!-- YAML
<add>changes:
<add> - version: v10.0.0
<add> pr-url: https://github.com/nodejs/node/pull/16878
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> or `module.exports` instead.
<ide>
<ide> <a id="DEP0093"></a>
<ide> ### DEP0093: crypto.fips is deprecated and replaced.
<add><!-- YAML
<add>changes:
<add> - version: v10.0.0
<add> pr-url: https://github.com/nodejs/node/pull/18335
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> and `crypto.getFips()` instead.
<ide>
<ide> <a id="DEP0094"></a>
<ide> ### DEP0094: Using `assert.fail()` with more than one argument.
<add><!-- YAML
<add>changes:
<add> - version: v10.0.0
<add> pr-url: https://github.com/nodejs/node/pull/18418
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> method.
<ide>
<ide> <a id="DEP0095"></a>
<ide> ### DEP0095: timers.enroll()
<add><!-- YAML
<add>changes:
<add> - version: v10.0.0
<add> pr-url: https://github.com/nodejs/node/pull/18066
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> Type: Runtime
<ide>
<ide> <a id="DEP0096"></a>
<ide> ### DEP0096: timers.unenroll()
<add><!-- YAML
<add>changes:
<add> - version: v10.0.0
<add> pr-url: https://github.com/nodejs/node/pull/18066
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> Type: Runtime
<ide>
<ide> <a id="DEP0097"></a>
<ide> ### DEP0097: MakeCallback with domain property
<add><!-- YAML
<add>changes:
<add> - version: v10.0.0
<add> pr-url: https://github.com/nodejs/node/pull/17417
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> should start using the `async_context` variant of `MakeCallback` or
<ide>
<ide> <a id="DEP0098"></a>
<ide> ### DEP0098: AsyncHooks Embedder AsyncResource.emitBefore and AsyncResource.emitAfter APIs
<add><!-- YAML
<add>changes:
<add> - version:
<add> - v8.12.0
<add> - v9.6.0
<add> - v10.0.0
<add> pr-url: https://github.com/nodejs/node/pull/18632
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> https://github.com/nodejs/node/pull/18513 for more details.
<ide>
<ide> <a id="DEP0099"></a>
<ide> ### DEP0099: async context-unaware node::MakeCallback C++ APIs
<add><!-- YAML
<add>changes:
<add> - version: v10.0.0
<add> pr-url: https://github.com/nodejs/node/pull/18632
<add> description: Compile-time deprecation.
<add>-->
<ide>
<ide> Type: Compile-time
<ide>
<ide> parameter.
<ide>
<ide> <a id="DEP0100"></a>
<ide> ### DEP0100: process.assert()
<add><!-- YAML
<add>changes:
<add> - version: v10.0.0
<add> pr-url: https://github.com/nodejs/node/pull/18666
<add> description: Runtime deprecation.
<add> - version: v0.3.7
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> This was never a documented feature.
<ide>
<ide> <a id="DEP0101"></a>
<ide> ### DEP0101: --with-lttng
<add><!-- YAML
<add>changes:
<add> - version: v10.0.0
<add> pr-url: https://github.com/nodejs/node/pull/18982
<add> description: End-of-Life.
<add>-->
<ide>
<ide> Type: End-of-Life
<ide>
<ide> The `--with-lttng` compile-time option has been removed.
<ide>
<ide> <a id="DEP0102"></a>
<ide> ### DEP0102: Using `noAssert` in Buffer#(read|write) operations.
<add><!-- YAML
<add>changes:
<add> - version: v10.0.0
<add> pr-url: https://github.com/nodejs/node/pull/18395
<add> description: End-of-Life.
<add>-->
<ide>
<ide> Type: End-of-Life
<ide>
<ide> could lead to hard to find errors and crashes.
<ide>
<ide> <a id="DEP0103"></a>
<ide> ### DEP0103: process.binding('util').is[...] typechecks
<add><!-- YAML
<add>changes:
<add> - version: v10.9.0
<add> pr-url: https://github.com/nodejs/node/pull/22004
<add> description: Superseded by [DEP0111](#DEP0111).
<add> - version: v10.0.0
<add> pr-url: https://github.com/nodejs/node/pull/18415
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only (supports [`--pending-deprecation`][])
<ide>
<ide> This deprecation has been superseded by the deprecation of the
<ide>
<ide> <a id="DEP0104"></a>
<ide> ### DEP0104: process.env string coercion
<add><!-- YAML
<add>changes:
<add> - version: v10.0.0
<add> pr-url: https://github.com/nodejs/node/pull/18990
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only (supports [`--pending-deprecation`][])
<ide>
<ide> assigning it to `process.env`.
<ide>
<ide> <a id="DEP0105"></a>
<ide> ### DEP0105: decipher.finaltol
<add><!-- YAML
<add>changes:
<add> - version: REPLACEME
<add> pr-url: https://github.com/nodejs/node/pull/19941
<add> description: End-of-Life.
<add> - version: v10.0.0
<add> pr-url: https://github.com/nodejs/node/pull/19353
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: End-of-Life
<ide>
<ide> Type: End-of-Life
<ide>
<ide> <a id="DEP0106"></a>
<ide> ### DEP0106: crypto.createCipher and crypto.createDecipher
<add><!-- YAML
<add>changes:
<add> - version: REPLACEME
<add> pr-url: https://github.com/nodejs/node/pull/22089
<add> description: Runtime deprecation.
<add> - version: v10.0.0
<add> pr-url: https://github.com/nodejs/node/pull/19343
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> initialization vectors. It is recommended to derive a key using
<ide>
<ide> <a id="DEP0107"></a>
<ide> ### DEP0107: tls.convertNPNProtocols()
<add><!-- YAML
<add>changes:
<add> - version: REPLACEME
<add> pr-url: https://github.com/nodejs/node/pull/20736
<add> description: End-of-Life.
<add> - version: v10.0.0
<add> pr-url: https://github.com/nodejs/node/pull/19403
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: End-of-Life
<ide>
<ide> core and obsoleted by the removal of NPN (Next Protocol Negotiation) support.
<ide>
<ide> <a id="DEP0108"></a>
<ide> ### DEP0108: zlib.bytesRead
<add><!-- YAML
<add>changes:
<add> - version: v10.0.0
<add> pr-url: https://github.com/nodejs/node/pull/19414
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> expose values under these names.
<ide>
<ide> <a id="DEP0109"></a>
<ide> ### DEP0109: http, https, and tls support for invalid URLs
<add><!-- YAML
<add>changes:
<add> - version: REPLACEME
<add> pr-url: https://github.com/nodejs/node/pull/20270
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> deprecated and support will be removed in the future.
<ide>
<ide> <a id="DEP0110"></a>
<ide> ### DEP0110: vm.Script cached data
<add><!-- YAML
<add>changes:
<add> - version: v10.6.0
<add> pr-url: https://github.com/nodejs/node/pull/20300
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> The `produceCachedData` option is deprecated. Use
<ide>
<ide> <a id="DEP0111"></a>
<ide> ### DEP0111: process.binding()
<add><!-- YAML
<add>changes:
<add> - version: v10.9.0
<add> pr-url: https://github.com/nodejs/node/pull/22004
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> only. Use of `process.binding()` by userland code is unsupported.
<ide>
<ide> <a id="DEP0112"></a>
<ide> ### DEP0112: dgram private APIs
<add><!-- YAML
<add>changes:
<add> - version: REPLACEME
<add> pr-url: https://github.com/nodejs/node/pull/22011
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> accessed outside of Node.js core: `Socket.prototype._handle`,
<ide>
<ide> <a id="DEP0113"></a>
<ide> ### DEP0113: Cipher.setAuthTag(), Decipher.getAuthTag()
<add><!-- YAML
<add>changes:
<add> - version: REPLACEME
<add> pr-url: https://github.com/nodejs/node/pull/22126
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> release.
<ide>
<ide> <a id="DEP0114"></a>
<ide> ### DEP0114: crypto._toBuf()
<add><!-- YAML
<add>changes:
<add> - version: REPLACEME
<add> pr-url: https://github.com/nodejs/node/pull/22501
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> of Node.js core and will be removed in the future.
<ide>
<ide> <a id="DEP0115"></a>
<ide> ### DEP0115: crypto.prng(), crypto.pseudoRandomBytes(), crypto.rng()
<add><!-- YAML
<add>changes:
<add> - version: REPLACEME
<add> pr-url: https://github.com/nodejs/node/pull/22519
<add> description: Runtime deprecation.
<add>-->
<ide>
<ide> Type: Runtime
<ide>
<ide> future release.
<ide>
<ide> <a id="DEP0116"></a>
<ide> ### DEP0116: Legacy URL API
<add><!-- YAML
<add>changes:
<add> - version: v11.0.0
<add> pr-url: https://github.com/nodejs/node/pull/22715
<add> description: Documentation-only deprecation.
<add>-->
<ide>
<ide> Type: Documentation-only
<ide>
<ide> use the [WHATWG URL API][] instead.
<ide> [`fs.exists(path, callback)`]: fs.html#fs_fs_exists_path_callback
<ide> [`fs.lchmod(path, mode, callback)`]: fs.html#fs_fs_lchmod_path_mode_callback
<ide> [`fs.lchmodSync(path, mode)`]: fs.html#fs_fs_lchmodsync_path_mode
<add>[`fs.lchown(path, uid, gid, callback)`]: fs.html#fs_fs_lchown_path_uid_gid_callback
<add>[`fs.lchownSync(path, uid, gid)`]: fs.html#fs_fs_lchownsync_path_uid_gid
<ide> [`fs.read()`]: fs.html#fs_fs_read_fd_buffer_offset_length_position_callback
<ide> [`fs.readSync()`]: fs.html#fs_fs_readsync_fd_buffer_offset_length_position
<ide> [`fs.stat()`]: fs.html#fs_fs_stat_path_options_callback | 1 |
Javascript | Javascript | fix error message in gltfloader | 006a90682c49065e81aa2138029680d5530ba0e0 | <ide><path>examples/js/loaders/GLTFLoader.js
<ide> THREE.GLTFLoader = ( function () {
<ide>
<ide> if ( bufferDef.type && bufferDef.type !== 'arraybuffer' ) {
<ide>
<del> throw new Error( 'THREE.GLTFLoader: %s buffer type is not supported.', bufferDef.type );
<add> throw new Error( 'THREE.GLTFLoader: ' + bufferDef.type + ' buffer type is not supported.' );
<ide>
<ide> }
<ide> | 1 |
Ruby | Ruby | add a failing test | 943fde0a55594bb9e75783974e37eba9584ac79b | <ide><path>activerecord/test/associations_test.rb
<ide> def test_store_association_in_two_relations_with_one_save
<ide> assert_equal num_orders +1, Order.count
<ide> assert_equal num_customers +1, Customer.count
<ide> end
<add>
<add> def test_association_assignment_sticks
<add> client = Client.find(:first)
<add> apple = Firm.create("name" => "Apple")
<add> client.firm = apple
<add> client.save!
<add> client.reload
<add> assert_equal apple.id, client.firm_id
<add> end
<ide>
<ide> end
<ide> | 1 |
Text | Text | add wikipedia link for dry explanation | ff9e9f1d7c32b8c1ec36f9eb8a0ace5d20748818 | <ide><path>docs/01-Chart-Configuration.md
<ide> var chartInstance = new Chart(ctx, {
<ide>
<ide> ### Global Configuration
<ide>
<del>This concept was introduced in Chart.js 1.0 to keep configuration DRY, and allow for changing options globally across chart types, avoiding the need to specify options for each instance, or the default for a particular chart type.
<add>This concept was introduced in Chart.js 1.0 to keep configuration [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), and allow for changing options globally across chart types, avoiding the need to specify options for each instance, or the default for a particular chart type.
<ide>
<ide> Chart.js merges the options object passed to the chart with the global configuration using chart type defaults and scales defaults appropriately. This way you can be as specific as you would like in your individual chart configuration, while still changing the defaults for all chart types where applicable. The global general options are defined in `Chart.defaults.global`. The defaults for each chart type are discussed in the documentation for that chart type.
<ide>
<ide> img.onload = function() {
<ide> })
<ide> }
<ide>
<del>```
<ide>\ No newline at end of file
<add>``` | 1 |
Python | Python | add extra space in test failure output | a59b6a1bc6714c230339cea0c3a007e905b29191 | <ide><path>test/pseudo-tty/testcfg.py
<ide> def IsFailureOutput(self, output):
<ide> raw_lines = (output.stdout + output.stderr).split('\n')
<ide> outlines = [ s.rstrip() for s in raw_lines if not self.IgnoreLine(s) ]
<ide> if len(outlines) != len(patterns):
<del> print("length differs.")
<add> print(" length differs.")
<ide> print("expect=%d" % len(patterns))
<ide> print("actual=%d" % len(outlines))
<ide> print("patterns:")
<ide> def IsFailureOutput(self, output):
<ide> return True
<ide> for i in range(len(patterns)):
<ide> if not re.match(patterns[i], outlines[i]):
<del> print("match failed")
<add> print(" match failed")
<ide> print("line=%d" % i)
<ide> print("expect=%s" % patterns[i])
<ide> print("actual=%s" % outlines[i]) | 1 |
Python | Python | fix num of bits calculation for network stats | f0fe6af62929178cd46b8c8969310d6d1371c36d | <ide><path>glances/glances.py
<ide> def displayNetwork(self, network):
<ide> cx_per_sec = self.__autoUnit(
<ide> network[i]['cx'] // elapsed_time * 8) + "b"
<ide> cumulative_rx = self.__autoUnit(
<del> network[i]['cumulative_rx']) + "b"
<add> network[i]['cumulative_rx'] * 8) + "b"
<ide> cumulative_tx = self.__autoUnit(
<del> network[i]['cumulative_tx']) + "b"
<add> network[i]['cumulative_tx'] * 8) + "b"
<ide> cumulative_cx = self.__autoUnit(
<del> network[i]['cumulative_cx']) + "b"
<add> network[i]['cumulative_cx'] * 8) + "b"
<ide>
<ide> if self.network_stats_cumulative:
<ide> rx = cumulative_rx | 1 |
Java | Java | fix condition in subprotocolwebsockethandler | 2b1ff4c5db781a3d0b5b83fab44e47cd7e64dbd6 | <ide><path>spring-websocket/src/main/java/org/springframework/web/socket/messaging/SubProtocolWebSocketHandler.java
<ide> public class SubProtocolWebSocketHandler implements WebSocketHandler,
<ide> * connection isn't doing well (proxy issue, slow network?) and can be closed.
<ide> * @see #checkSessions()
<ide> */
<del> private final int TIME_TO_FIRST_MESSAGE = 60 * 1000;
<add> private static final int TIME_TO_FIRST_MESSAGE = 60 * 1000;
<ide>
<ide>
<ide> private final Log logger = LogFactory.getLog(SubProtocolWebSocketHandler.class);
<ide> public void handleMessage(WebSocketSession session, WebSocketMessage<?> message)
<ide> if (holder != null) {
<ide> holder.setHasHandledMessages();
<ide> }
<del> else {
<del> // Should never happen
<del> throw new IllegalStateException("Session not found: " + session);
<del> }
<ide> checkSessions();
<ide> }
<ide>
<ide> private String resolveSessionId(Message<?> message) {
<ide> */
<ide> private void checkSessions() throws IOException {
<ide> long currentTime = System.currentTimeMillis();
<del> if (!isRunning() && currentTime - this.lastSessionCheckTime < TIME_TO_FIRST_MESSAGE) {
<add> if (!isRunning() || (currentTime - this.lastSessionCheckTime < TIME_TO_FIRST_MESSAGE)) {
<ide> return;
<ide> }
<ide> if (this.sessionCheckLock.tryLock()) {
<ide> private void checkSessions() throws IOException {
<ide> continue;
<ide> }
<ide> long timeSinceCreated = currentTime - holder.getCreateTime();
<del> if (holder.hasHandledMessages() || timeSinceCreated < TIME_TO_FIRST_MESSAGE) {
<add> if (timeSinceCreated < TIME_TO_FIRST_MESSAGE) {
<ide> continue;
<ide> }
<ide> WebSocketSession session = holder.getSession();
<ide><path>spring-websocket/src/test/java/org/springframework/web/socket/messaging/SubProtocolWebSocketHandlerTests.java
<ide> public void checkSession() throws Exception {
<ide> new DirectFieldAccessor(sessions.get("id1")).setPropertyValue("createTime", sixtyOneSecondsAgo);
<ide> new DirectFieldAccessor(sessions.get("id2")).setPropertyValue("createTime", sixtyOneSecondsAgo);
<ide>
<add> this.webSocketHandler.start();
<ide> this.webSocketHandler.handleMessage(session1, new TextMessage("foo"));
<ide>
<ide> assertTrue(session1.isOpen()); | 2 |
PHP | PHP | fix typo in error class | c75f298c34a281e0a30959ceafcf515271ce945d | <ide><path>system/error.php
<ide> public static function handle($e)
<ide> $file = $e->getFile();
<ide> }
<ide>
<del> // Trim the period off the error message since we will be formatting it oursevles.
<add> // Trim the period off the error message since we will be formatting it ourselves.
<ide> $message = rtrim($e->getMessage(), '.');
<ide>
<ide> if (Config::get('error.log')) | 1 |
Text | Text | fix typo in command | f594090a936a06524d2df77c0eb65a42bf694d6b | <ide><path>examples/pytorch/translation/README.md
<ide> pip install accelerate
<ide> then
<ide>
<ide> ```bash
<del>python run_tranlation_no_trainer.py \
<add>python run_translation_no_trainer.py \
<ide> --model_name_or_path Helsinki-NLP/opus-mt-en-ro \
<ide> --source_lang en \
<ide> --target_lang ro \ | 1 |
Java | Java | add sun.misc annotation marker | 5923ee8af39a5a36017e3046146bdf0591ab0f61 | <ide><path>spring-core/src/main/java/org/springframework/lang/UsesSunMisc.java
<add>package org.springframework.lang;
<add>
<add>import java.lang.annotation.Documented;
<add>import java.lang.annotation.ElementType;
<add>import java.lang.annotation.Retention;
<add>import java.lang.annotation.RetentionPolicy;
<add>import java.lang.annotation.Target;
<add>
<add>/**
<add> * Indicates that the annotated element uses an API from the {@code sun.misc}
<add> * package.
<add> *
<add> * @author Stephane Nicoll
<add> * @since 4.3
<add> */
<add>@Retention(RetentionPolicy.CLASS)
<add>@Target({ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.TYPE})
<add>@Documented
<add>public @interface UsesSunMisc {
<add>} | 1 |
PHP | PHP | trim a long ling | 62d8c09cce19dae64a338fe4b22f2660b96dafec | <ide><path>laravel/cli/tasks/migrate/migrator.php
<ide> protected function stub($bundle, $migration)
<ide> {
<ide> $stub = File::get(path('sys').'cli/tasks/migrate/stub'.EXT);
<ide>
<add> $prefix = Bundle::class_prefix($bundle);
<add>
<ide> // The class name is formatted simialrly to tasks and controllers,
<ide> // where the bundle name is prefixed to the class if it is not in
<del> // the default bundle.
<del> $class = Bundle::class_prefix($bundle).Str::classify($migration);
<add> // the default "application" bundle.
<add> $class = $prefix.Str::classify($migration);
<ide>
<ide> return str_replace('{{class}}', $class, $stub);
<ide> } | 1 |
Ruby | Ruby | add regression test. closes | dea2aafbfa5f63bf99f21244309a6fe75e5de906 | <ide><path>activerecord/test/cases/persistence_test.rb
<ide> def self.name; 'Topic'; end
<ide> end
<ide> end
<ide>
<add> def test_update_does_not_run_sql_if_record_has_not_changed
<add> topic = Topic.create(title: 'Another New Topic')
<add> assert_queries(0) { topic.update(title: 'Another New Topic') }
<add> assert_queries(0) { topic.update_attributes(title: 'Another New Topic') }
<add> end
<add>
<ide> def test_delete
<ide> topic = Topic.find(1)
<ide> assert_equal topic, topic.delete, 'topic.delete did not return self' | 1 |
Python | Python | add timeout parameter to `dockeroperator` | e1a42c4fc8a634852dd5ac5b16cade620851477f | <ide><path>airflow/providers/docker/hooks/docker.py
<ide> from typing import Any, Dict, Optional
<ide>
<ide> from docker import APIClient
<add>from docker.constants import DEFAULT_TIMEOUT_SECONDS
<ide> from docker.errors import APIError
<ide>
<ide> from airflow.exceptions import AirflowException
<ide> def __init__(
<ide> base_url: Optional[str] = None,
<ide> version: Optional[str] = None,
<ide> tls: Optional[str] = None,
<add> timeout: int = DEFAULT_TIMEOUT_SECONDS,
<ide> ) -> None:
<ide> super().__init__()
<ide> if not base_url:
<ide> def __init__(
<ide> self.__base_url = base_url
<ide> self.__version = version
<ide> self.__tls = tls
<add> self.__timeout = timeout
<ide> if conn.port:
<ide> self.__registry = f"{conn.host}:{conn.port}"
<ide> else:
<ide> def __init__(
<ide> self.__reauth = extra_options.get('reauth') != 'no'
<ide>
<ide> def get_conn(self) -> APIClient:
<del> client = APIClient(base_url=self.__base_url, version=self.__version, tls=self.__tls)
<add> client = APIClient(
<add> base_url=self.__base_url, version=self.__version, tls=self.__tls, timeout=self.__timeout
<add> )
<ide> self.__login(client)
<ide> return client
<ide>
<ide><path>airflow/providers/docker/operators/docker.py
<ide> from typing import TYPE_CHECKING, Dict, Iterable, List, Optional, Sequence, Union
<ide>
<ide> from docker import APIClient, tls
<add>from docker.constants import DEFAULT_TIMEOUT_SECONDS
<ide> from docker.errors import APIError
<ide> from docker.types import Mount
<ide>
<ide> def __init__(
<ide> extra_hosts: Optional[Dict[str, str]] = None,
<ide> retrieve_output: bool = False,
<ide> retrieve_output_path: Optional[str] = None,
<add> timeout: int = DEFAULT_TIMEOUT_SECONDS,
<ide> **kwargs,
<ide> ) -> None:
<ide> super().__init__(**kwargs)
<ide> def __init__(
<ide> self.container = None
<ide> self.retrieve_output = retrieve_output
<ide> self.retrieve_output_path = retrieve_output_path
<add> self.timeout = timeout
<ide>
<ide> def get_hook(self) -> DockerHook:
<ide> """
<ide> def get_hook(self) -> DockerHook:
<ide> base_url=self.docker_url,
<ide> version=self.api_version,
<ide> tls=self.__get_tls_config(),
<add> timeout=self.timeout,
<ide> )
<ide>
<ide> def _run_image(self) -> Optional[Union[List[str], str]]:
<ide> def _get_cli(self) -> APIClient:
<ide> return self.get_hook().get_conn()
<ide> else:
<ide> tls_config = self.__get_tls_config()
<del> return APIClient(base_url=self.docker_url, version=self.api_version, tls=tls_config)
<add> return APIClient(
<add> base_url=self.docker_url, version=self.api_version, tls=tls_config, timeout=self.timeout
<add> )
<ide>
<ide> @staticmethod
<ide> def format_command(command: Union[str, List[str]]) -> Union[List[str], str]:
<ide><path>tests/providers/docker/hooks/test_docker.py
<ide> def test_get_conn_override_defaults(self, docker_client_mock):
<ide> base_url='https://index.docker.io/v1/',
<ide> version='1.23',
<ide> tls='someconfig',
<add> timeout=100,
<ide> )
<ide> hook.get_conn()
<ide> docker_client_mock.assert_called_once_with(
<del> base_url='https://index.docker.io/v1/', version='1.23', tls='someconfig'
<add> base_url='https://index.docker.io/v1/',
<add> version='1.23',
<add> tls='someconfig',
<add> timeout=100,
<ide> )
<ide>
<ide> def test_get_conn_with_standard_config(self, _):
<ide><path>tests/providers/docker/operators/test_docker.py
<ide> from unittest.mock import call
<ide>
<ide> import pytest
<add>from docker.constants import DEFAULT_TIMEOUT_SECONDS
<ide> from docker.errors import APIError
<ide>
<ide> from airflow.exceptions import AirflowException
<ide> def test_execute(self):
<ide> operator.execute(None)
<ide>
<ide> self.client_class_mock.assert_called_once_with(
<del> base_url='unix://var/run/docker.sock', tls=None, version='1.19'
<add> base_url='unix://var/run/docker.sock', tls=None, version='1.19', timeout=DEFAULT_TIMEOUT_SECONDS
<ide> )
<ide>
<ide> self.client_mock.create_container.assert_called_once_with(
<ide> def test_execute_no_temp_dir(self):
<ide> operator.execute(None)
<ide>
<ide> self.client_class_mock.assert_called_once_with(
<del> base_url='unix://var/run/docker.sock', tls=None, version='1.19'
<add> base_url='unix://var/run/docker.sock', tls=None, version='1.19', timeout=DEFAULT_TIMEOUT_SECONDS
<ide> )
<ide>
<ide> self.client_mock.create_container.assert_called_once_with(
<ide> def test_execute_fallback_temp_dir(self):
<ide> "and mounting temporary volume from host is not supported" in captured.output[0]
<ide> )
<ide> self.client_class_mock.assert_called_once_with(
<del> base_url='unix://var/run/docker.sock', tls=None, version='1.19'
<add> base_url='unix://var/run/docker.sock', tls=None, version='1.19', timeout=DEFAULT_TIMEOUT_SECONDS
<ide> )
<ide> self.client_mock.create_container.assert_has_calls(
<ide> [
<ide> def test_execute_tls(self, tls_class_mock):
<ide> )
<ide>
<ide> self.client_class_mock.assert_called_once_with(
<del> base_url='https://127.0.0.1:2376', tls=tls_mock, version=None
<add> base_url='https://127.0.0.1:2376', tls=tls_mock, version=None, timeout=DEFAULT_TIMEOUT_SECONDS
<ide> )
<ide>
<ide> def test_execute_unicode_logs(self):
<ide><path>tests/providers/docker/operators/test_docker_swarm.py
<ide>
<ide> import pytest
<ide> from docker import APIClient, types
<add>from docker.constants import DEFAULT_TIMEOUT_SECONDS
<ide> from parameterized import parameterized
<ide>
<ide> from airflow.exceptions import AirflowException
<ide> def _client_service_logs_effect():
<ide> types_mock.Resources.assert_called_once_with(mem_limit='128m')
<ide>
<ide> client_class_mock.assert_called_once_with(
<del> base_url='unix://var/run/docker.sock', tls=None, version='1.19'
<add> base_url='unix://var/run/docker.sock', tls=None, version='1.19', timeout=DEFAULT_TIMEOUT_SECONDS
<ide> )
<ide>
<ide> client_mock.service_logs.assert_called_once_with( | 5 |
Javascript | Javascript | remove unnecessary div and props | 1660a267bad076f50f5591fd2498071df83e9bd8 | <ide><path>client/src/templates/Guide/components/GuideFooter.js
<ide> import { Link, Spacer } from '../../../components/helpers';
<ide> const propTypes = {
<ide> githubPath: PropTypes.string
<ide> };
<del>const GuideFooter = props => {
<del> const { githubPath } = props;
<del> return (
<del> <div>
<del> <Spacer />
<del> <hr />
<del> <h4>Contributing to the Guide</h4>
<del> <p>
<del> This open source guide is curated by thousands of contributors. You can
<del> help by researching, writing and updating these articles. It is an easy
<del> and fun way to get started with contributing to open source.
<del> </p>
<del> <ul>
<del> <li>
<del> <Link to='https://github.com/freeCodeCamp/freeCodeCamp/blob/master/CONTRIBUTING.md#research-write-and-update-our-guide-articles'>
<del> Follow our contributing guidelines for working on guide articles
<del> </Link>
<del> .
<del> </li>
<del> <li>
<del> <Link to={githubPath}>Edit this article on GitHub</Link>.
<del> </li>
<del> </ul>
<del> <Spacer />
<del> </div>
<del> );
<del>};
<add>
<add>const GuideFooter = ({ githubPath }) => (
<add> <>
<add> <Spacer />
<add> <hr />
<add> <h4>Contributing to the Guide</h4>
<add> <p>
<add> This open source guide is curated by thousands of contributors. You can
<add> help by researching, writing and updating these articles. It is an easy
<add> and fun way to get started with contributing to open source.
<add> </p>
<add> <ul>
<add> <li>
<add> <Link to='https://github.com/freeCodeCamp/freeCodeCamp/blob/master/CONTRIBUTING.md#research-write-and-update-our-guide-articles'>
<add> Follow our contributing guidelines for working on guide articles
<add> </Link>
<add> .
<add> </li>
<add> <li>
<add> <Link to={githubPath}>Edit this article on GitHub</Link>.
<add> </li>
<add> </ul>
<add> <Spacer />
<add> </>
<add>);
<ide>
<ide> GuideFooter.displayName = 'GuideFooter';
<ide> GuideFooter.propTypes = propTypes; | 1 |
Javascript | Javascript | fix bumpy line on smooth data set | e080e782ab44f34d2bcd63ad6255f48bac2292ea | <ide><path>src/scales/scale.linear.js
<ide> module.exports = function(Chart) {
<ide>
<ide> if (me.isHorizontal()) {
<ide> pixel = me.left + (me.width / range * (rightValue - start));
<del> return Math.round(pixel);
<add> } else {
<add> pixel = me.bottom - (me.height / range * (rightValue - start));
<ide> }
<del>
<del> pixel = me.bottom - (me.height / range * (rightValue - start));
<del> return Math.round(pixel);
<add> return pixel;
<ide> },
<ide> getValueForPixel: function(pixel) {
<ide> var me = this;
<ide><path>test/specs/core.controller.tests.js
<ide> describe('Chart', function() {
<ide>
<ide> // Verify that points are at their initial correct location,
<ide> // then we will reset and see that they moved
<del> expect(meta.data[0]._model.y).toBe(333);
<del> expect(meta.data[1]._model.y).toBe(183);
<add> expect(meta.data[0]._model.y).toBeCloseToPixel(333);
<add> expect(meta.data[1]._model.y).toBeCloseToPixel(183);
<ide> expect(meta.data[2]._model.y).toBe(32);
<ide> expect(meta.data[3]._model.y).toBe(484);
<ide>
<ide><path>test/specs/core.tooltip.tests.js
<ide> describe('Core.Tooltip', function() {
<ide>
<ide> it('Should not update if active element has not changed', function() {
<ide> var chart = window.acquireChart({
<del> type: 'bar',
<add> type: 'line',
<ide> data: {
<ide> datasets: [{
<ide> label: 'Dataset 1', | 3 |
PHP | PHP | apply fixes from styleci | 9208548adbc1da7dc0a29de6c9d3365e350cafbd | <ide><path>src/Illuminate/Http/Client/RequestException.php
<ide> protected function prepareMessage(Response $response)
<ide>
<ide> $summary = \GuzzleHttp\Psr7\get_message_body_summary($response->toPsrResponse());
<ide>
<del> return is_null($summary) ? $message : $message .= ":\n{$summary}\n";;
<add> return is_null($summary) ? $message : $message .= ":\n{$summary}\n";
<ide> }
<ide> } | 1 |
Python | Python | fix add_start_docstrings on python 2 (removed) | 62b8eb43c1b722f8c8a3c89fce5d788a08fc9653 | <ide><path>pytorch_transformers/modeling_bert.py
<ide> def init_weights(self, module):
<ide> @add_start_docstrings("The bare Bert Model transformer outputing raw hidden-states without any specific head on top.",
<ide> BERT_START_DOCSTRING, BERT_INPUTS_DOCSTRING)
<ide> class BertModel(BertPreTrainedModel):
<del> __doc__ = r"""
<add> r"""
<ide> Outputs: `Tuple` comprising various elements depending on the configuration (config) and inputs:
<ide> **last_hidden_state**: ``torch.FloatTensor`` of shape ``(batch_size, sequence_length, hidden_size)``
<ide> Sequence of hidden-states at the last layer of the model.
<ide> def forward(self, input_ids, position_ids=None, token_type_ids=None, attention_m
<ide> a `masked language modeling` head and a `next sentence prediction (classification)` head. """,
<ide> BERT_START_DOCSTRING, BERT_INPUTS_DOCSTRING)
<ide> class BertForPreTraining(BertPreTrainedModel):
<del> __doc__ = r"""
<add> r"""
<ide> **masked_lm_labels**: (`optional`) ``torch.LongTensor`` of shape ``(batch_size, sequence_length)``:
<ide> Labels for computing the masked language modeling loss.
<ide> Indices should be in ``[-1, 0, ..., config.vocab_size]`` (see ``input_ids`` docstring)
<ide> def forward(self, input_ids, position_ids=None, token_type_ids=None, attention_m
<ide> @add_start_docstrings("""Bert Model transformer BERT model with a `language modeling` head on top. """,
<ide> BERT_START_DOCSTRING, BERT_INPUTS_DOCSTRING)
<ide> class BertForMaskedLM(BertPreTrainedModel):
<del> __doc__ = r"""
<add> r"""
<ide> **masked_lm_labels**: (`optional`) ``torch.LongTensor`` of shape ``(batch_size, sequence_length)``:
<ide> Labels for computing the masked language modeling loss.
<ide> Indices should be in ``[-1, 0, ..., config.vocab_size]`` (see ``input_ids`` docstring)
<ide> def forward(self, input_ids, position_ids=None, token_type_ids=None, attention_m
<ide> @add_start_docstrings("""Bert Model transformer BERT model with a `next sentence prediction (classification)` head on top. """,
<ide> BERT_START_DOCSTRING, BERT_INPUTS_DOCSTRING)
<ide> class BertForNextSentencePrediction(BertPreTrainedModel):
<del> __doc__ = r"""
<add> r"""
<ide> **next_sentence_label**: (`optional`) ``torch.LongTensor`` of shape ``(batch_size,)``:
<ide> Labels for computing the next sequence prediction (classification) loss. Input should be a sequence pair (see ``input_ids`` docstring)
<ide> Indices should be in ``[0, 1]``.
<ide> def forward(self, input_ids, position_ids=None, token_type_ids=None, attention_m
<ide> the pooled output) e.g. for GLUE tasks. """,
<ide> BERT_START_DOCSTRING, BERT_INPUTS_DOCSTRING)
<ide> class BertForSequenceClassification(BertPreTrainedModel):
<del> __doc__ = r"""
<add> r"""
<ide> **labels**: (`optional`) ``torch.LongTensor`` of shape ``(batch_size,)``:
<ide> Labels for computing the sequence classification/regression loss.
<ide> Indices should be in ``[0, ..., config.num_labels]``.
<ide> def forward(self, input_ids, position_ids=None, token_type_ids=None, attention_m
<ide> the pooled output and a softmax) e.g. for RocStories/SWAG tasks. """,
<ide> BERT_START_DOCSTRING)
<ide> class BertForMultipleChoice(BertPreTrainedModel):
<del> __doc__ = r"""
<add> r"""
<ide> Inputs:
<ide> **input_ids**: ``torch.LongTensor`` of shape ``(batch_size, num_choices, sequence_length)``:
<ide> Indices of input sequence tokens in the vocabulary.
<ide> def forward(self, input_ids, position_ids=None, token_type_ids=None, attention_m
<ide> the hidden-states output) e.g. for Named-Entity-Recognition (NER) tasks. """,
<ide> BERT_START_DOCSTRING, BERT_INPUTS_DOCSTRING)
<ide> class BertForTokenClassification(BertPreTrainedModel):
<del> __doc__ = r"""
<add> r"""
<ide> **labels**: (`optional`) ``torch.LongTensor`` of shape ``(batch_size, sequence_length)``:
<ide> Labels for computing the token classification loss.
<ide> Indices should be in ``[0, ..., config.num_labels]``.
<ide> def forward(self, input_ids, position_ids=None, token_type_ids=None, attention_m
<ide> the hidden-states output to compute `span start logits` and `span end logits`). """,
<ide> BERT_START_DOCSTRING, BERT_INPUTS_DOCSTRING)
<ide> class BertForQuestionAnswering(BertPreTrainedModel):
<del> __doc__ = r"""
<add> r"""
<ide> **start_positions**: (`optional`) ``torch.LongTensor`` of shape ``(batch_size,)``:
<ide> Position (index) of the start of the labelled span for computing the token classification loss.
<ide> Positions are clamped to the length of the sequence (`sequence_length`).
<ide><path>pytorch_transformers/modeling_gpt2.py
<ide> from torch.nn.parameter import Parameter
<ide>
<ide> from .modeling_utils import (Conv1D, CONFIG_NAME, WEIGHTS_NAME, PretrainedConfig,
<del> PreTrainedModel, prune_conv1d_layer, SequenceSummary)
<add> PreTrainedModel, prune_conv1d_layer, SequenceSummary,
<add> add_start_docstrings)
<ide> from .modeling_bert import BertLayerNorm as LayerNorm
<ide>
<ide> logger = logging.getLogger(__name__)
<ide> def init_weights(self, module):
<ide> @add_start_docstrings("The bare GPT2 Model transformer outputing raw hidden-states without any specific head on top.",
<ide> GPT2_START_DOCSTRING, GPT2_INPUTS_DOCTRING)
<ide> class GPT2Model(GPT2PreTrainedModel):
<del> __doc__ = r"""
<add> r"""
<ide> Outputs: `Tuple` comprising various elements depending on the configuration (config) and inputs:
<ide> **last_hidden_state**: ``torch.FloatTensor`` of shape ``(batch_size, sequence_length, hidden_size)``
<ide> Sequence of hidden-states at the last layer of the model.
<ide> def forward(self, input_ids, position_ids=None, token_type_ids=None, past=None,
<ide> @add_start_docstrings("""The GPT2 Model transformer with a language modeling head on top
<ide> (linear layer with weights tied to the input embeddings). """, GPT2_START_DOCSTRING, GPT2_INPUTS_DOCTRING)
<ide> class GPT2LMHeadModel(GPT2PreTrainedModel):
<del> __doc__ = r"""
<add> r"""
<ide> **lm_labels**: (`optional`) ``torch.LongTensor`` of shape ``(batch_size, sequence_length)``:
<ide> Labels for language modeling.
<ide> Note that the labels **are shifted** inside the model, i.e. you can set ``lm_labels = input_ids``
<ide> def forward(self, input_ids, position_ids=None, token_type_ids=None, lm_labels=N
<ide> the classification head takes as input the input of a specified classification token index in the intput sequence).
<ide> """, GPT2_START_DOCSTRING)
<ide> class GPT2DoubleHeadsModel(GPT2PreTrainedModel):
<del> __doc__ = r""" Inputs:
<add> r""" Inputs:
<ide> **input_ids**: ``torch.LongTensor`` of shape ``(batch_size, num_choices, sequence_length)``:
<ide> Indices of input sequence tokens in the vocabulary.
<ide> The second dimension of the input (`num_choices`) indicates the number of choices to score.
<ide><path>pytorch_transformers/modeling_utils.py
<ide> # limitations under the License.
<ide> """PyTorch BERT model."""
<ide>
<del>from __future__ import absolute_import, division, print_function, unicode_literals
<add>from __future__ import (absolute_import, division, print_function,
<add> unicode_literals)
<ide>
<add>import copy
<add>import json
<ide> import logging
<ide> import os
<del>import json
<del>import copy
<ide> from io import open
<ide>
<add>import six
<ide> import torch
<ide> from torch import nn
<del>from torch.nn import CrossEntropyLoss, functional as F
<add>from torch.nn import CrossEntropyLoss
<add>from torch.nn import functional as F
<ide>
<ide> from .file_utils import cached_path
<ide>
<ide> TF_WEIGHTS_NAME = 'model.ckpt'
<ide>
<ide>
<del>def add_start_docstrings(*docstr):
<del> def docstring_decorator(fn):
<del> fn.__doc__ = ''.join(docstr) + fn.__doc__
<del> return fn
<del> return docstring_decorator
<add>if not six.PY2:
<add> def add_start_docstrings(*docstr):
<add> def docstring_decorator(fn):
<add> fn.__doc__ = ''.join(docstr) + fn.__doc__
<add> return fn
<add> return docstring_decorator
<add>else:
<add> # Not possible to update class docstrings on python2
<add> def add_start_docstrings(*docstr):
<add> def docstring_decorator(fn):
<add> return fn
<add> return docstring_decorator
<ide>
<ide>
<ide> class PretrainedConfig(object): | 3 |
Ruby | Ruby | convert integer extension modules to class reopens | 54cf0fc476b2d77adb8a124c27a79a048fa4ddb5 | <ide><path>activesupport/lib/active_support/core_ext/integer.rb
<add>require 'active_support/core_ext/integer/even_odd'
<add>require 'active_support/core_ext/integer/inflections'
<add>
<ide> require 'active_support/core_ext/util'
<del>ActiveSupport.core_ext Integer, %w(even_odd inflections time)
<add>ActiveSupport.core_ext Integer, %w(time)
<ide><path>activesupport/lib/active_support/core_ext/integer/even_odd.rb
<del>module ActiveSupport #:nodoc:
<del> module CoreExtensions #:nodoc:
<del> module Integer #:nodoc:
<del> # For checking if a fixnum is even or odd.
<del> #
<del> # 2.even? # => true
<del> # 2.odd? # => false
<del> # 1.even? # => false
<del> # 1.odd? # => true
<del> # 0.even? # => true
<del> # 0.odd? # => false
<del> # -1.even? # => false
<del> # -1.odd? # => true
<del> module EvenOdd
<del> def multiple_of?(number)
<del> self % number == 0
<del> end
<add>class Integer
<add> # Check whether the integer is evenly divisible by the argument.
<add> def multiple_of?(number)
<add> self % number == 0
<add> end
<ide>
<del> def even?
<del> multiple_of? 2
<del> end if RUBY_VERSION < '1.9'
<add> # Is the integer a multiple of 2?
<add> def even?
<add> multiple_of? 2
<add> end if RUBY_VERSION < '1.9'
<ide>
<del> def odd?
<del> !even?
<del> end if RUBY_VERSION < '1.9'
<del> end
<del> end
<del> end
<add> # Is the integer not a multiple of 2?
<add> def odd?
<add> !even?
<add> end if RUBY_VERSION < '1.9'
<ide> end
<ide><path>activesupport/lib/active_support/core_ext/integer/inflections.rb
<ide> require 'active_support/inflector'
<ide>
<del>module ActiveSupport #:nodoc:
<del> module CoreExtensions #:nodoc:
<del> module Integer #:nodoc:
<del> module Inflections
<del> # Ordinalize turns a number into an ordinal string used to denote the
<del> # position in an ordered sequence such as 1st, 2nd, 3rd, 4th.
<del> #
<del> # 1.ordinalize # => "1st"
<del> # 2.ordinalize # => "2nd"
<del> # 1002.ordinalize # => "1002nd"
<del> # 1003.ordinalize # => "1003rd"
<del> def ordinalize
<del> Inflector.ordinalize(self)
<del> end
<del> end
<del> end
<add>class Integer
<add> # Ordinalize turns a number into an ordinal string used to denote the
<add> # position in an ordered sequence such as 1st, 2nd, 3rd, 4th.
<add> #
<add> # 1.ordinalize # => "1st"
<add> # 2.ordinalize # => "2nd"
<add> # 1002.ordinalize # => "1002nd"
<add> # 1003.ordinalize # => "1003rd"
<add> def ordinalize
<add> Inflector.ordinalize(self)
<ide> end
<ide> end | 3 |
Text | Text | add tempates for new issues and pull requests | 9cac2716f7196fc915c4cac3b2c34aa2183182d9 | <ide><path>.github/ISSUE_TEMPLATE.md
<add><!--
<add>If you are reporting a new issue, make sure that we do not have any duplicates
<add>already open. You can ensure this by searching the issue list for this
<add>repository. If there is a duplicate, please close your issue and add a comment
<add>to the existing issue instead.
<add>
<add>If you suspect your issue is a bug, please edit your issue description to
<add>include the BUG REPORT INFORMATION shown below. If you fail to provide this
<add>information within 7 days, we cannot debug your issue and will close it. We
<add>will, however, reopen it if you later provide the information.
<add>
<add>For more information about reporting issues, see
<add>https://github.com/docker/docker/blob/master/CONTRIBUTING.md#reporting-other-issues
<add>
<add>---------------------------------------------------
<add>BUG REPORT INFORMATION
<add>---------------------------------------------------
<add>Use the commands below to provide key information from your environment:
<add>You do NOT have to include this information if this is a FEATURE REQUEST
<add>-->
<add>
<add>Output of `docker version`:
<add>
<add>```
<add>(paste your output here)
<add>```
<add>
<add>
<add>Output of `docker info`:
<add>
<add>```
<add>(paste your output here)
<add>```
<add>
<add>Provide additional environment details (AWS, VirtualBox, physical, etc.):
<add>
<add>
<add>
<add>List the steps to reproduce the issue:
<add>1.
<add>2.
<add>3.
<add>
<add>
<add>Describe the results you received:
<add>
<add>
<add>Describe the results you expected:
<add>
<add>
<add>Provide additional info you think is important:
<ide><path>.github/PULL_REQUEST_TEMPLATE.md
<add><!--
<add>Please make sure you've read and understood our contributing guidelines;
<add>https://github.com/docker/docker/blob/master/CONTRIBUTING.md
<add>
<add>** Make sure all your commits include a signature generated with `git commit -s` **
<add>
<add>For additional information on our contributing process, read our contributing
<add>guide https://docs.docker.com/opensource/code/
<add>
<add>If this is a bug fix, make sure your description includes "fixes #xxxx", or
<add>"closes #xxxx"
<add>-->
<add>
<add>Please provide the following information:
<add>
<add>- What did you do?
<add>
<add>- How did you do it?
<add>
<add>- How do I see it or verify it?
<add>
<add>- A picture of a cute animal (not mandatory but encouraged)
<add> | 2 |
Python | Python | factorize export code | 338330271d62629461f867d7fd940231e65fa08f | <ide><path>glances/exports/glances_csv.py
<ide> def __init__(self, config=None, args=None):
<ide>
<ide> logger.info("Stats exported to CSV file: {0}".format(self.csv_filename))
<ide>
<add> self.export_enable = True
<add>
<ide> self.first_line = True
<ide>
<ide> def exit(self):
<ide><path>glances/exports/glances_export.py
<ide> def __init__(self, config=None, args=None):
<ide> self.config = config
<ide> self.args = args
<ide>
<add> # By default export is disable
<add> # Had to be set to True in the __init__ class of child
<add> self.export_enable = False
<add>
<ide> def exit(self):
<ide> """Close the export module."""
<ide> logger.debug("Finalise export interface %s" % self.export_name)
<ide>
<ide> def plugins_to_export(self):
<ide> """Return the list of plugins to export"""
<ide> return ['cpu', 'load', 'mem', 'memswap', 'network', 'diskio', 'fs', 'processcount']
<add>
<add> def update(self, stats):
<add> """Update stats to a server.
<add> The method buil two list: names and values
<add> and call the export method to export the stats"""
<add> if not self.export_enable:
<add> return False
<add>
<add> # Get the stats
<add> all_stats = stats.getAll()
<add> plugins = stats.getAllPlugins()
<add>
<add> # Loop over available plugin
<add> i = 0
<add> for plugin in plugins:
<add> if plugin in self.plugins_to_export():
<add> if type(all_stats[i]) is list:
<add> for item in all_stats[i]:
<add> export_names = map(
<add> lambda x: item[item['key']] + '.' + x, item.keys())
<add> export_values = item.values()
<add> self.export(plugin, export_names, export_values)
<add> elif type(all_stats[i]) is dict:
<add> export_names = all_stats[i].keys()
<add> export_values = all_stats[i].values()
<add> self.export(plugin, export_names, export_values)
<add> i += 1
<add>
<add> return True
<ide><path>glances/exports/glances_influxdb.py
<ide> def init(self):
<ide> sys.exit(2)
<ide> return db
<ide>
<del> def update(self, stats):
<del> """Update stats to the InfluxDB server."""
<del> if not self.export_enable:
<del> return False
<del>
<del> # Get the stats
<del> all_stats = stats.getAll()
<del> plugins = stats.getAllPlugins()
<del>
<del> # Loop over available plugin
<del> i = 0
<del> for plugin in plugins:
<del> if plugin in self.plugins_to_export():
<del> if type(all_stats[i]) is list:
<del> for item in all_stats[i]:
<del> export_names = map(
<del> lambda x: item[item['key']] + '_' + x, item.keys())
<del> export_values = item.values()
<del> self.write_to_influxdb(plugin, export_names, export_values)
<del> elif type(all_stats[i]) is dict:
<del> export_names = all_stats[i].keys()
<del> export_values = all_stats[i].values()
<del> self.write_to_influxdb(plugin, export_names, export_values)
<del> i += 1
<del>
<del> return True
<del>
<del> def write_to_influxdb(self, name, columns, points):
<add> def export(self, name, columns, points):
<ide> """Write the points to the InfluxDB server"""
<ide> data = [
<ide> {
<ide> def write_to_influxdb(self, name, columns, points):
<ide> try:
<ide> self.client.write_points(data)
<ide> except Exception as e:
<del> logger.critical("Can not export stats to InfluxDB (%s)" % e)
<add> logger.error("Can not export stats to InfluxDB (%s)" % e)
<ide><path>glances/exports/glances_statsd.py
<ide> def init(self, prefix='glances'):
<ide> self.port,
<ide> prefix=prefix)
<ide>
<del> def update(self, stats):
<del> """Update stats to the InfluxDB server."""
<del> if not self.export_enable:
<del> return False
<del>
<del> # Get the stats
<del> all_stats = stats.getAll()
<del> plugins = stats.getAllPlugins()
<del>
<del> # Loop over available plugin
<del> i = 0
<del> for plugin in plugins:
<del> if plugin in self.plugins_to_export():
<del> if type(all_stats[i]) is list:
<del> for item in all_stats[i]:
<del> export_names = map(
<del> lambda x: item[item['key']] + '.' + x, item.keys())
<del> export_values = item.values()
<del> self.__export(plugin, export_names, export_values)
<del> elif type(all_stats[i]) is dict:
<del> export_names = all_stats[i].keys()
<del> export_values = all_stats[i].values()
<del> self.__export(plugin, export_names, export_values)
<del> i += 1
<del>
<del> return True
<del>
<del> def __export(self, name, columns, points):
<add> def export(self, name, columns, points):
<ide> """Export the stats to the Statsd server"""
<ide> for i in range(0, len(columns)):
<ide> if not isinstance(points[i], Number):
<ide> def __export(self, name, columns, points):
<ide> try:
<ide> self.client.gauge(stat_name, stat_value)
<ide> except Exception as e:
<del> logger.critical("Can not export stats to Statsd (%s)" % e)
<add> logger.error("Can not export stats to Statsd (%s)" % e) | 4 |
Javascript | Javascript | remove unused catch bindings | a64ca7139ec1c04aff033fd1c6a1cd6c6a99c015 | <ide><path>lib/internal/modules/esm/loader.js
<ide> class Loader {
<ide> if (this._resolve !== defaultResolve) {
<ide> try {
<ide> new URL(url);
<del> } catch (e) {
<add> } catch {
<ide> throw new ERR_INVALID_RETURN_PROPERTY(
<ide> 'url', 'loader resolve', 'url', url
<ide> ); | 1 |
Javascript | Javascript | add exportsspec type to getexports | f5a457ffd4896b39da7dd83382ae46d6227a78b5 | <ide><path>lib/Dependency.js
<ide> class Dependency {
<ide>
<ide> /**
<ide> * Returns the exported names
<add> * @param {ModuleGraph} moduleGraph module graph
<ide> * @returns {ExportsSpec | undefined} export names
<ide> */
<del> getExports() {
<del> return null;
<add> getExports(moduleGraph) {
<add> return undefined;
<ide> }
<ide>
<ide> /**
<ide><path>lib/FlagDependencyExportsPlugin.js
<ide> class FlagDependencyExportsPlugin {
<ide> };
<ide>
<ide> const processDependency = dep => {
<del> const exportDesc = dep.getExports && dep.getExports();
<add> const exportDesc = dep.getExports(compilation.moduleGraph);
<ide> if (!exportDesc) return;
<ide> moduleWithExports = true;
<ide> const exports = exportDesc.exports;
<ide><path>lib/dependencies/DelegatedExportsDependency.js
<ide> const DependencyReference = require("./DependencyReference");
<ide> const NullDependency = require("./NullDependency");
<ide>
<ide> /** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */
<add>/** @typedef {import("../ModuleGraph")} ModuleGraph */
<ide>
<ide> class DelegatedExportsDependency extends NullDependency {
<ide> constructor(originModule, exports) {
<ide> class DelegatedExportsDependency extends NullDependency {
<ide>
<ide> /**
<ide> * Returns the exported names
<add> * @param {ModuleGraph} moduleGraph module graph
<ide> * @returns {ExportsSpec | undefined} export names
<ide> */
<del> getExports() {
<add> getExports(moduleGraph) {
<ide> return {
<ide> exports: this.exports,
<ide> dependencies: undefined
<ide><path>lib/dependencies/HarmonyExportExpressionDependency.js
<ide> const NullDependency = require("./NullDependency");
<ide> /** @typedef {import("../Dependency")} Dependency */
<ide> /** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */
<ide> /** @typedef {import("../DependencyTemplates")} DependencyTemplates */
<add>/** @typedef {import("../ModuleGraph")} ModuleGraph */
<ide> /** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */
<ide>
<ide> class HarmonyExportExpressionDependency extends NullDependency {
<ide> class HarmonyExportExpressionDependency extends NullDependency {
<ide>
<ide> /**
<ide> * Returns the exported names
<add> * @param {ModuleGraph} moduleGraph module graph
<ide> * @returns {ExportsSpec | undefined} export names
<ide> */
<del> getExports() {
<add> getExports(moduleGraph) {
<ide> return {
<ide> exports: ["default"],
<ide> dependencies: undefined
<ide><path>lib/dependencies/HarmonyExportImportedSpecifierDependency.js
<ide> class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
<ide>
<ide> /**
<ide> * Returns the exported names
<add> * @param {ModuleGraph} moduleGraph module graph
<ide> * @returns {ExportsSpec | undefined} export names
<ide> */
<del> getExports() {
<add> getExports(moduleGraph) {
<ide> if (this.name) {
<ide> return {
<ide> exports: [this.name],
<ide> class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
<ide>
<ide> if (!importedModule) {
<ide> // no imported module available
<del> return {
<del> exports: null,
<del> dependencies: undefined
<del> };
<add> return undefined;
<ide> }
<ide>
<ide> if (Array.isArray(importedModule.buildMeta.providedExports)) {
<ide><path>lib/dependencies/HarmonyExportSpecifierDependency.js
<ide> const NullDependency = require("./NullDependency");
<ide> /** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */
<ide> /** @typedef {import("../DependencyTemplate").TemplateContext} TemplateContext */
<ide> /** @typedef {import("../DependencyTemplates")} DependencyTemplates */
<add>/** @typedef {import("../ModuleGraph")} ModuleGraph */
<ide> /** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */
<ide>
<ide> class HarmonyExportSpecifierDependency extends NullDependency {
<ide> class HarmonyExportSpecifierDependency extends NullDependency {
<ide>
<ide> /**
<ide> * Returns the exported names
<add> * @param {ModuleGraph} moduleGraph module graph
<ide> * @returns {ExportsSpec | undefined} export names
<ide> */
<del> getExports() {
<add> getExports(moduleGraph) {
<ide> return {
<ide> exports: [this.name],
<ide> dependencies: undefined
<ide><path>lib/dependencies/JsonExportsDependency.js
<ide> const NullDependency = require("./NullDependency");
<ide>
<ide> /** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */
<add>/** @typedef {import("../ModuleGraph")} ModuleGraph */
<ide>
<ide> class JsonExportsDependency extends NullDependency {
<ide> constructor(exports) {
<ide> class JsonExportsDependency extends NullDependency {
<ide>
<ide> /**
<ide> * Returns the exported names
<add> * @param {ModuleGraph} moduleGraph module graph
<ide> * @returns {ExportsSpec | undefined} export names
<ide> */
<del> getExports() {
<add> getExports(moduleGraph) {
<ide> return {
<ide> exports: this.exports,
<ide> dependencies: undefined | 7 |
Python | Python | fix pickle tests | bb3304a4f1785cca954858b500afeef9051d245e | <ide><path>spacy/tests/test_pickles.py
<ide> def test_pickle_vocab(text1, text2):
<ide> lex2 = vocab[text2]
<ide> assert lex1.norm_ == text1[:-1]
<ide> assert lex2.norm_ == text2[:-1]
<del> data = pickle.dumps(vocab)
<del> unpickled = pickle.loads(data)
<add> data = srsly.pickle_dumps(vocab)
<add> unpickled = srsly.pickle_loads(data)
<ide> assert unpickled[text1].orth == lex1.orth
<ide> assert unpickled[text2].orth == lex2.orth
<ide> assert unpickled[text1].norm == lex1.norm | 1 |
Javascript | Javascript | add examples to the ember.route docs | 9ebb56e43184eed021a2059be08b58d9f8431e0e | <ide><path>packages/ember-routing/lib/system/route.js
<ide> Ember.Route = Ember.Object.extend({
<ide> route in question. The model will be serialized into the URL
<ide> using the `serialize` hook.
<ide>
<add> Example
<add>
<add> ```javascript
<add> App.Router.map(function() {
<add> this.route("index");
<add> this.route("secret");
<add> this.route("fourOhFour", { path: "*:"});
<add> });
<add>
<add> App.IndexRoute = Ember.Route.extend({
<add> events: {
<add> moveToSecret: function(context){
<add> if (authorized()){
<add> this.transitionTo('secret', context);
<add> }
<add> this.transitionTo('fourOhFour');
<add> }
<add> }
<add> });
<add> ```
<add>
<ide> @method transitionTo
<ide> @param {String} name the name of the route
<del> @param {...Object} models the
<add> @param {...Object} models
<ide> */
<ide> transitionTo: function(name, context) {
<ide> var router = this.router;
<ide> Ember.Route = Ember.Object.extend({
<ide> Of the bundled location types, only `history` currently supports
<ide> this behavior.
<ide>
<add> Example
<add>
<add> ```javascript
<add> App.Router.map(function() {
<add> this.route("index");
<add> this.route("secret");
<add> });
<add>
<add> App.SecretRoute = Ember.Route.extend({
<add> afterModel: function() {
<add> if (!authorized()){
<add> this.replaceWith('index');
<add> }
<add> }
<add> });
<add> ```
<add>
<ide> @method replaceWith
<ide> @param {String} name the name of the route
<del> @param {...Object} models the
<add> @param {...Object} models
<ide> */
<ide> replaceWith: function() {
<ide> var router = this.router;
<ide> return this.router.replaceWith.apply(this.router, arguments);
<ide> },
<ide>
<add> /**
<add> Triggers and event on a parent route.
<add>
<add> Example
<add>
<add> ```javascript
<add> App.Router.map(function() {
<add> this.route("index");
<add> });
<add>
<add> App.ApplicationRoute = Ember.Route.extend({
<add> events: {
<add> track: function(arg) {
<add> console.log(arg, 'was clicked');
<add> }
<add> }
<add> });
<add>
<add> App.IndexRoute = Ember.Route.extend({
<add> events: {
<add> trackIfDebug: function(arg) {
<add> if (debug) {
<add> this.send('track', arg);
<add> }
<add> }
<add> }
<add> });
<add> ```
<add>
<add> @method send
<add> @param {String} name the name of the event to trigger
<add> @param {...*} args
<add> */
<ide> send: function() {
<ide> return this.router.send.apply(this.router, arguments);
<ide> },
<ide> Ember.Route = Ember.Object.extend({
<ide> if a promise returned from `model` fails, the error will be
<ide> handled by the `error` hook on `Ember.Route`.
<ide>
<add> Example
<add>
<add> ```js
<add> App.PostRoute = Ember.Route.extend({
<add> model: function(params) {
<add> return App.Post.find(params.post_id);
<add> }
<add> });
<add> ```
<add>
<ide> @method model
<ide> @param {Object} params the parameters extracted from the URL
<ide> @param {Transition} transition
<ide> Ember.Route = Ember.Object.extend({
<ide> be used if it is defined. If it is not defined, an `Ember.ObjectController`
<ide> instance would be used.
<ide>
<add> Example
<add> ```js
<add> App.PostRoute = Ember.Route.extend({
<add> setupController: function(controller, model) {
<add> controller.set('model', model);
<add> }
<add> });
<add> ```
<add>
<ide> @method setupController
<add> @param {Controller} controller instance
<add> @param {Object} model
<ide> */
<ide> setupController: function(controller, context) {
<ide> if (controller && (context !== undefined)) {
<ide> Ember.Route = Ember.Object.extend({
<ide> If the optional model is passed then the controller type is determined automatically,
<ide> e.g., an ArrayController for arrays.
<ide>
<add> Example
<add>
<add> ```js
<add> App.PostRoute = Ember.Route.extend({
<add> setupController: function(controller, post) {
<add> this._super(controller, post);
<add> this.generateController('posts', post);
<add> }
<add> });
<add> ```
<add>
<ide> @method generateController
<ide> @param {String} name the name of the controller
<ide> @param {Object} model the model to infer the type of the controller (optional)
<ide> Ember.Route = Ember.Object.extend({
<ide> This is the object returned by the `model` hook of the route
<ide> in question.
<ide>
<add> Example
<add>
<add> ```js
<add> App.Router.map(function() {
<add> this.resource('post', { path: '/post/:post_id' }, function() {
<add> this.resource('comments');
<add> });
<add> });
<add>
<add> App.CommentsRoute = Ember.Route.extend({
<add> afterModel: function() {
<add> this.set('post', this.modelFor('post'));
<add> }
<add> });
<add> ```
<add>
<ide> @method modelFor
<ide> @param {String} name the name of the route
<ide> @return {Object} the model object
<ide> Ember.Route = Ember.Object.extend({
<ide> This method can be overridden to set up and render additional or
<ide> alternative templates.
<ide>
<add> ```js
<add> App.PostsRoute = Ember.Route.extend({
<add> renderTemplate: function(controller, model) {
<add> var favController = this.controllerFor('favoritePost');
<add>
<add> // Render the `favoritePost` template into
<add> // the outlet `posts`, and display the `favoritePost`
<add> // controller.
<add> this.render('favoritePost', {
<add> outlet: 'posts',
<add> controller: favController
<add> });
<add> }
<add> });
<add> ```
<add>
<ide> @method renderTemplate
<ide> @param {Object} controller the route's controller
<ide> @param {Object} model the route's model
<ide> Ember.Route = Ember.Object.extend({
<ide> this.teardownViews();
<ide> },
<ide>
<add> /**
<add> @private
<add>
<add> @method teardownViews
<add> */
<ide> teardownViews: function() {
<ide> // Tear down the top level view
<ide> if (this.teardownTopLevelView) { this.teardownTopLevelView(); } | 1 |
PHP | PHP | simplify test api for session access | f79ca04e0c1c883821fb3a95c461e5d1080dbd1a | <ide><path>src/TestSuite/IntegrationTestTrait.php
<ide> protected function extractExceptionMessage(Exception $exception): string
<ide> /**
<ide> * @return \Cake\TestSuite\TestSession
<ide> */
<del> protected function getTestSession(): TestSession
<add> protected function getSession(): TestSession
<ide> {
<ide> return new TestSession($_SESSION);
<ide> } | 1 |
Python | Python | remove unnecessary test_input_fn | 88c864f724e179343848938282404a84dc0c3e83 | <ide><path>official/nlp/xlnet/run_classifier.py
<ide> def main(unused_argv):
<ide> eval_fn=eval_fn,
<ide> metric_fn=get_metric_fn,
<ide> train_input_fn=train_input_fn,
<del> test_input_fn=test_input_fn,
<ide> init_checkpoint=FLAGS.init_checkpoint,
<ide> init_from_transformerxl=FLAGS.init_from_transformerxl,
<ide> total_training_steps=total_training_steps,
<ide><path>official/nlp/xlnet/run_pretrain.py
<ide> def main(unused_argv):
<ide> eval_fn=None,
<ide> metric_fn=None,
<ide> train_input_fn=train_input_fn,
<del> test_input_fn=None,
<ide> init_checkpoint=FLAGS.init_checkpoint,
<ide> init_from_transformerxl=FLAGS.init_from_transformerxl,
<ide> total_training_steps=total_training_steps,
<ide><path>official/nlp/xlnet/run_squad.py
<ide> def main(unused_argv):
<ide> eval_fn=eval_fn,
<ide> metric_fn=None,
<ide> train_input_fn=train_input_fn,
<del> test_input_fn=test_input_fn,
<ide> init_checkpoint=FLAGS.init_checkpoint,
<ide> init_from_transformerxl=FLAGS.init_from_transformerxl,
<ide> total_training_steps=total_training_steps,
<ide><path>official/nlp/xlnet/training_utils.py
<ide> # See the License for the specific language governing permissions and
<ide> # limitations under the License.
<ide> # ==============================================================================
<del>"""XLNet classification finetuning runner in tf2.0."""
<add>"""XLNet training utils."""
<ide>
<ide> from __future__ import absolute_import
<ide> from __future__ import division
<ide> def train(
<ide> eval_fn: Optional[Callable[[tf.keras.Model, int, tf.summary.SummaryWriter],
<ide> Any]] = None,
<ide> metric_fn: Optional[Callable[[], tf.keras.metrics.Metric]] = None,
<del> test_input_fn: Optional[Callable] = None,
<ide> init_checkpoint: Optional[Text] = None,
<ide> init_from_transformerxl: Optional[bool] = False,
<ide> model_dir: Optional[Text] = None,
<ide> def train(
<ide> metric_fn: A metrics function returns a Keras Metric object to record
<ide> evaluation result using evaluation dataset or with training dataset
<ide> after every epoch.
<del> test_input_fn: Function returns a evaluation dataset. If none, evaluation
<del> is skipped.
<ide> init_checkpoint: Optional checkpoint to load to `sub_model` returned by
<ide> `model_fn`.
<ide> init_from_transformerxl: Whether to load to `transformerxl_model` of
<ide> def train(
<ide> tf.io.gfile.mkdir(summary_dir)
<ide> train_summary_writer = None
<ide> eval_summary_writer = None
<del> if test_input_fn:
<add> if eval_fn:
<ide> eval_summary_writer = tf.summary.create_file_writer(
<ide> os.path.join(summary_dir, "eval"))
<ide> if steps_per_loop >= _MIN_SUMMARY_STEPS:
<ide> def cache_fn():
<ide> _save_checkpoint(checkpoint, model_dir,
<ide> checkpoint_name.format(step=current_step))
<ide>
<del> if test_input_fn and current_step % save_steps == 0:
<add> if eval_fn and current_step % save_steps == 0:
<ide>
<ide> logging.info("Running evaluation after step: %s.", current_step)
<ide>
<ide> eval_fn(model, current_step, eval_summary_writer)
<ide> if model_dir:
<ide> _save_checkpoint(checkpoint, model_dir,
<ide> checkpoint_name.format(step=current_step))
<del> if test_input_fn:
<add> if eval_fn:
<ide> logging.info("Running final evaluation after training is complete.")
<ide> eval_metric = eval_fn(model, current_step, eval_summary_writer)
<ide>
<ide> def cache_fn():
<ide> }
<ide> if train_metric:
<ide> training_summary["last_train_metrics"] = _float_metric_value(train_metric)
<del> if test_input_fn:
<add> if eval_fn:
<ide> # eval_metric is supposed to be a float.
<ide> training_summary["eval_metrics"] = eval_metric
<ide> | 4 |
Python | Python | simplify flow in np.require | f9cc4bf70c5c6f26ad421962bf5c608558b1035c | <ide><path>numpy/core/_asarray.py
<ide> __all__ = ["require"]
<ide>
<ide>
<add>POSSIBLE_FLAGS = {
<add> 'C': 'C', 'C_CONTIGUOUS': 'C', 'CONTIGUOUS': 'C',
<add> 'F': 'F', 'F_CONTIGUOUS': 'F', 'FORTRAN': 'F',
<add> 'A': 'A', 'ALIGNED': 'A',
<add> 'W': 'W', 'WRITEABLE': 'W',
<add> 'O': 'O', 'OWNDATA': 'O',
<add> 'E': 'E', 'ENSUREARRAY': 'E'
<add>}
<add>
<ide>
<ide> def _require_dispatcher(a, dtype=None, requirements=None, *, like=None):
<ide> return (like,)
<ide> def require(a, dtype=None, requirements=None, *, like=None):
<ide> like=like,
<ide> )
<ide>
<del> possible_flags = {'C': 'C', 'C_CONTIGUOUS': 'C', 'CONTIGUOUS': 'C',
<del> 'F': 'F', 'F_CONTIGUOUS': 'F', 'FORTRAN': 'F',
<del> 'A': 'A', 'ALIGNED': 'A',
<del> 'W': 'W', 'WRITEABLE': 'W',
<del> 'O': 'O', 'OWNDATA': 'O',
<del> 'E': 'E', 'ENSUREARRAY': 'E'}
<ide> if not requirements:
<ide> return asanyarray(a, dtype=dtype)
<del> else:
<del> requirements = {possible_flags[x.upper()] for x in requirements}
<add>
<add> requirements = {POSSIBLE_FLAGS[x.upper()] for x in requirements}
<ide>
<ide> if 'E' in requirements:
<ide> requirements.remove('E')
<ide> def require(a, dtype=None, requirements=None, *, like=None):
<ide>
<ide> for prop in requirements:
<ide> if not arr.flags[prop]:
<del> arr = arr.copy(order)
<del> break
<add> return arr.copy(order)
<ide> return arr
<ide>
<ide> | 1 |
Javascript | Javascript | use fixtures in test-https-localaddress.js | b9c8fd8338be88c074a91bd01a1101ba828d1fd4 | <ide><path>test/parallel/test-https-localaddress.js
<ide> if (!common.hasCrypto)
<ide> if (!common.hasMultiLocalhost())
<ide> common.skip('platform-specific test.');
<ide>
<del>const fs = require('fs');
<add>const fixtures = require('../common/fixtures');
<ide> const assert = require('assert');
<ide> const https = require('https');
<ide>
<ide> const options = {
<del> key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
<del> cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
<add> key: fixtures.readKey('agent1-key.pem'),
<add> cert: fixtures.readKey('agent1-cert.pem')
<ide> };
<ide>
<ide> const server = https.createServer(options, function(req, res) { | 1 |
PHP | PHP | add tests for assertjsonfragment() | 69f9c4eef64faf473683801b3659e5e4d314e7f3 | <ide><path>tests/Foundation/FoundationTestResponseTest.php
<ide> public function testAssertJsonWithMixed()
<ide> $response->assertJson($resource->jsonSerialize());
<ide> }
<ide>
<add> public function testAssertJsonFragment()
<add> {
<add> $response = new TestResponse(new JsonSerializableSingleResourceStub);
<add>
<add> $response->assertJsonFragment(['foo' => 'foo 0']);
<add>
<add> $response->assertJsonFragment(['foo' => 'foo 0', 'bar' => 'bar 0', 'foobar' => 'foobar 0']);
<add>
<add> $response = new TestResponse(new JsonSerializableMixedResourcesStub);
<add>
<add> $response->assertJsonFragment(['foo' => 'bar']);
<add>
<add> $response->assertJsonFragment(['foobar_foo' => 'foo']);
<add>
<add> $response->assertJsonFragment(['foobar' => ['foobar_foo' => 'foo', 'foobar_bar' => 'bar']]);
<add>
<add> $response->assertJsonFragment(['foo' => 'bar 0', 'bar' => ['foo' => 'bar 0', 'bar' => 'foo 0']]);
<add> }
<add>
<ide> public function testAssertJsonStructure()
<ide> {
<ide> $response = new TestResponse(new JsonSerializableMixedResourcesStub);
<ide> public function testAssertJsonStructure()
<ide>
<ide> // Wildcard (repeating structure) at root
<ide> $response = new TestResponse(new JsonSerializableSingleResourceStub);
<add>
<ide> $response->assertJsonStructure(['*' => ['foo', 'bar', 'foobar']]);
<ide> }
<ide> | 1 |
Text | Text | add socket example gist link | 3f93d6bb21fd104263bc83da87bd2e113e82bd9f | <ide><path>docs/faq/CodeStructure.md
<ide> Middleware are the right place for persistent connections like websockets in a R
<ide> - Middleware can see all dispatched actions and dispatch actions themselves. This means a middleware can take dispatched actions and turn those into messages sent over the websocket, and dispatch new actions when a message is received over the websocket.
<ide> - A websocket connection instance isn't serializable, so [it doesn't belong in the store state itself](/faq/organizing-state#organizing-state-non-serializable)
<ide>
<add>See [this example that shows how a socket middleware might dispatch and respond to Redux actions](https://gist.github.com/markerikson/3df1cf5abbac57820a20059287b4be58).
<add>
<ide> There's many existing middleware for websockets and other similar connections - see the link below.
<ide>
<ide> **Libraries** | 1 |
PHP | PHP | apply fixes from styleci | 51be372c2eed553cecfc73a46804d27fa2ff96ff | <ide><path>src/Illuminate/Http/UploadedFile.php
<ide> public function storePubliclyAs($path, $name, $options = [])
<ide> public function storeAs($path, $name, $options = [])
<ide> {
<ide> $options = $this->parseOptions($options);
<del>
<add>
<ide> $disk = Arr::pull($options, 'disk');
<ide>
<ide> return Container::getInstance()->make(FilesystemFactory::class)->disk($disk)->putFileAs( | 1 |
Java | Java | remove short conversions in mapbuffer | a054379a54c1548b98b5835bebf987d93517c41c | <ide><path>ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/ReadableMapBuffer.java
<ide> public class ReadableMapBuffer implements Iterable<ReadableMapBuffer.MapBufferEn
<ide>
<ide> private static final int INT_SIZE = 4;
<ide>
<del> // TODO T83483191: consider moving short to INTs, we are doing extra cast operations just because
<del> // of short java operates with int
<del> private static final int SHORT_SIZE = 2;
<del>
<del> private static final short SHORT_ONE = (short) 1;
<del>
<ide> @Nullable ByteBuffer mBuffer = null;
<ide>
<del> // Size of the Serialized Data
<del> @SuppressWarnings("unused")
<del> private int mSizeOfData = 0;
<del>
<ide> // Amount of items serialized on the ByteBuffer
<del> @SuppressWarnings("unused")
<del> private short mCount = 0;
<add> private int mCount = 0;
<ide>
<ide> @DoNotStrip
<ide> private ReadableMapBuffer(HybridData hybridData) {
<ide> private ReadableMapBuffer(ByteBuffer buffer) {
<ide> @Nullable
<ide> private HybridData mHybridData;
<ide>
<del> private int getKeyOffsetForBucketIndex(int bucketIndex) {
<add> private static int getKeyOffsetForBucketIndex(int bucketIndex) {
<ide> return HEADER_SIZE + BUCKET_SIZE * bucketIndex;
<ide> }
<ide>
<del> private int getValueOffsetForKey(short key) {
<add> private int getValueOffsetForKey(int key) {
<ide> importByteBufferAndReadHeader();
<ide> int bucketIndex = getBucketIndexForKey(key);
<ide> if (bucketIndex == -1) {
<ide> private int getOffsetForDynamicData() {
<ide> * @return the "bucket index" for a key or -1 if not found. It uses a binary search algorithm
<ide> * (log(n))
<ide> */
<del> private int getBucketIndexForKey(short key) {
<del> short lo = 0;
<del> short hi = (short) (getCount() - SHORT_ONE);
<add> private int getBucketIndexForKey(int key) {
<add> int lo = 0;
<add> int hi = getCount() - 1;
<ide> while (lo <= hi) {
<del> final short mid = (short) ((lo + hi) >>> SHORT_ONE);
<del> final short midVal = readKey(getKeyOffsetForBucketIndex(mid));
<add> final int mid = (lo + hi) >>> 1;
<add> final int midVal = readKey(getKeyOffsetForBucketIndex(mid));
<ide> if (midVal < key) {
<del> lo = (short) (mid + SHORT_ONE);
<add> lo = mid + 1;
<ide> } else if (midVal > key) {
<del> hi = (short) (mid - SHORT_ONE);
<add> hi = mid - 1;
<ide> } else {
<ide> return mid;
<ide> }
<ide> }
<ide> return -1;
<ide> }
<ide>
<del> private short readKey(int position) {
<del> return mBuffer.getShort(position);
<add> private int readKey(int position) {
<add> return mBuffer.getShort(position) & 0xFFFF;
<ide> }
<ide>
<ide> private double readDoubleValue(int bufferPosition) {
<ide> private void readHeader() {
<ide> mBuffer.order(ByteOrder.LITTLE_ENDIAN);
<ide> }
<ide> // count
<del> mCount = mBuffer.getShort();
<del> // size
<del> mSizeOfData = mBuffer.getInt();
<add> mCount = mBuffer.getShort() & 0xFFFF;
<ide> }
<ide>
<ide> /**
<ide> private void readHeader() {
<ide> * @param key Key to search for
<ide> * @return true if and only if the Key received as a parameter is stored in the MapBuffer.
<ide> */
<del> public boolean hasKey(short key) {
<add> public boolean hasKey(int key) {
<ide> // TODO T83483191: Add tests
<ide> return getBucketIndexForKey(key) != -1;
<ide> }
<ide>
<ide> /** @return amount of elements stored into the MapBuffer */
<del> public short getCount() {
<add> public int getCount() {
<ide> importByteBufferAndReadHeader();
<ide> return mCount;
<ide> }
<ide> public short getCount() {
<ide> * @param key {@link int} representing the key
<ide> * @return return the int associated to the Key received as a parameter.
<ide> */
<del> public int getInt(short key) {
<add> public int getInt(int key) {
<ide> // TODO T83483191: extract common code of "get methods"
<ide> return readIntValue(getValueOffsetForKey(key));
<ide> }
<ide> public int getInt(short key) {
<ide> * @param key {@link int} representing the key
<ide> * @return return the double associated to the Key received as a parameter.
<ide> */
<del> public double getDouble(short key) {
<add> public double getDouble(int key) {
<ide> return readDoubleValue(getValueOffsetForKey(key));
<ide> }
<ide>
<ide> /**
<ide> * @param key {@link int} representing the key
<ide> * @return return the int associated to the Key received as a parameter.
<ide> */
<del> public String getString(short key) {
<add> public String getString(int key) {
<ide> return readStringValue(getValueOffsetForKey(key));
<ide> }
<ide>
<del> public boolean getBoolean(short key) {
<add> public boolean getBoolean(int key) {
<ide> return readBooleanValue(getValueOffsetForKey(key));
<ide> }
<ide>
<ide> /**
<ide> * @param key {@link int} representing the key
<ide> * @return return the int associated to the Key received as a parameter.
<ide> */
<del> public ReadableMapBuffer getMapBuffer(short key) {
<add> public ReadableMapBuffer getMapBuffer(int key) {
<ide> return readMapBufferValue(getValueOffsetForKey(key));
<ide> }
<ide>
<ide> private ByteBuffer importByteBufferAndReadHeader() {
<ide> return mBuffer;
<ide> }
<ide>
<del> private void assertKeyExists(short key, int bucketIndex) {
<del> short storedKey = mBuffer.getShort(getKeyOffsetForBucketIndex(bucketIndex));
<add> private void assertKeyExists(int key, int bucketIndex) {
<add> int storedKey = readKey(getKeyOffsetForBucketIndex(bucketIndex));
<ide> if (storedKey != key) {
<ide> throw new IllegalStateException(
<ide> "Stored key doesn't match parameter - expected: " + key + " - found: " + storedKey);
<ide> public boolean equals(@Nullable Object obj) {
<ide> @Override
<ide> public Iterator<MapBufferEntry> iterator() {
<ide> return new Iterator<MapBufferEntry>() {
<del> short current = 0;
<del> short last = (short) (getCount() - SHORT_ONE);
<add> int current = 0;
<add> final int last = getCount() - 1;
<ide>
<ide> @Override
<ide> public boolean hasNext() {
<ide> private MapBufferEntry(int position) {
<ide> }
<ide>
<ide> /** @return a {@link short} that represents the key of this {@link MapBufferEntry}. */
<del> public short getKey() {
<add> public int getKey() {
<ide> return readKey(mBucketOffset);
<ide> }
<ide>
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManagerMapBuffer.java
<ide> private static void buildSpannableFromFragment(
<ide> SpannableStringBuilder sb,
<ide> List<SetSpanOperation> ops) {
<ide>
<del> for (short i = 0, length = fragments.getCount(); i < length; i++) {
<add> for (int i = 0, length = fragments.getCount(); i < length; i++) {
<ide> ReadableMapBuffer fragment = fragments.getMapBuffer(i);
<ide> int start = sb.length();
<ide> | 2 |
Java | Java | add nullpointerexception comment | 14bebc511b242d38f1956544a86265a6f48e489d | <ide><path>src/main/java/io/reactivex/Single.java
<ide> public static Single<Long> timer(long delay, TimeUnit unit) {
<ide> * @param unit the time unit of the delay
<ide> * @param scheduler the scheduler where the single 0L will be emitted
<ide> * @return the new Single instance
<add> * @throws NullPointerException
<add> * if unit is null, or
<add> * if scheduler is null
<ide> * @since 2.0
<ide> */
<ide> @CheckReturnValue
<ide> public final Single<T> delay(long time, TimeUnit unit) {
<ide> * @param unit the time unit
<ide> * @param scheduler the target scheduler to use for the non-blocking wait and emission
<ide> * @return the new Single instance
<add> * @throws NullPointerException
<add> * if unit is null, or
<add> * if scheduler is null
<ide> * @since 2.0
<ide> */
<ide> @CheckReturnValue
<ide> public final Flowable<T> mergeWith(SingleSource<? extends T> other) {
<ide> * the {@link Scheduler} to notify subscribers on
<ide> * @return the source Single modified so that its subscribers are notified on the specified
<ide> * {@link Scheduler}
<add> * @throws NullPointerException if scheduler is null
<ide> * @see <a href="http://reactivex.io/documentation/operators/observeon.html">ReactiveX operators documentation: ObserveOn</a>
<ide> * @see <a href="http://www.grahamlea.com/2014/07/rxjava-threading-examples/">RxJava Threading Examples</a>
<ide> * @see #subscribeOn
<ide> public final Single<T> timeout(long timeout, TimeUnit unit, Scheduler scheduler,
<ide> * @param unit the time unit
<ide> * @param other the other SingleSource that gets subscribed to if the current Single times out
<ide> * @return the new Single instance
<add> * @throws NullPointerException
<add> * if other is null, or
<add> * if unit is null, or
<add> * if scheduler is null
<ide> * @since 2.0
<ide> */
<ide> @CheckReturnValue | 1 |
PHP | PHP | allow array of strings/arrays, optional name attr | 38684f94871e66a599644b605b02c4bcac3ea088 | <ide><path>src/Illuminate/Mail/Mailable.php
<ide> protected function setAddress($address, $name = null, $property = 'to')
<ide>
<ide> if ($address instanceof Collection || is_array($address)) {
<ide> foreach ($address as $user) {
<del> $this->{$property}($user->email, $user->name);
<add> if (is_array($user)){
<add> $user = (object) $user;
<add> }elseif (is_string($user)) {
<add> $user = (object) ['email' => $user];
<add> }
<add> $this->{$property}($user->email, isset($user->name) ? $user->name : null);
<ide> }
<ide> } else {
<ide> $this->{$property}[] = compact('address', 'name'); | 1 |
Python | Python | fix 2.5-isms for deprecated decorator | eb6df7ca32375fe98c7902f77b90d6a7d9869ea3 | <ide><path>numpy/testing/decorators.py
<ide> def __init__(self, message, category, filename, lineno, file=None,
<ide> local_values = locals()
<ide> for attr in self._WARNING_DETAILS:
<ide> setattr(self, attr, local_values[attr])
<del> self._category_name = category.__name__ if category else None
<add> if category:
<add> self._category_name = category.__name__
<add> else:
<add> self._category_name = None
<ide>
<ide> def __str__(self):
<ide> return ("{message : %r, category : %r, filename : %r, lineno : %s, "
<ide> def __str__(self):
<ide> class WarningManager:
<ide> def __init__(self, record=False, module=None):
<ide> self._record = record
<del> self._module = sys.modules['warnings'] if module is None else module
<add> if module is None:
<add> self._module = sys.modules['warnings']
<add> else:
<add> self._module = module
<ide> self._entered = False
<ide>
<ide> def __enter__(self): | 1 |
Java | Java | add cookies to the websocket handshakeinfo | d92c74d923a43218cd0f49fdf28622a2aa6c9837 | <ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/socket/HandshakeInfo.java
<ide> import java.util.Collections;
<ide> import java.util.Map;
<ide>
<add>import org.springframework.http.HttpCookie;
<add>import org.springframework.util.CollectionUtils;
<add>import org.springframework.util.MultiValueMap;
<ide> import reactor.core.publisher.Mono;
<ide>
<ide> import org.springframework.http.HttpHeaders;
<ide> public class HandshakeInfo {
<ide>
<ide> private final HttpHeaders headers;
<ide>
<add> private final MultiValueMap<String, HttpCookie> cookies;
<add>
<ide> @Nullable
<ide> private final String protocol;
<ide>
<ide> public HandshakeInfo(URI uri, HttpHeaders headers, Mono<Principal> principal, @N
<ide> this(uri, headers, principal, protocol, null, Collections.emptyMap(), null);
<ide> }
<ide>
<add>
<ide> /**
<ide> * Constructor targetting server-side use with extra information about the
<ide> * handshake, the remote address, and a pre-existing log prefix for
<ide> public HandshakeInfo(URI uri, HttpHeaders headers, Mono<Principal> principal, @N
<ide> * messages, if any.
<ide> * @since 5.1
<ide> */
<add> @Deprecated
<ide> public HandshakeInfo(URI uri, HttpHeaders headers, Mono<Principal> principal,
<del> @Nullable String protocol, @Nullable InetSocketAddress remoteAddress,
<del> Map<String, Object> attributes, @Nullable String logPrefix) {
<add> @Nullable String protocol, @Nullable InetSocketAddress remoteAddress,
<add> Map<String, Object> attributes, @Nullable String logPrefix) {
<add> this(uri, headers, CollectionUtils.toMultiValueMap(Collections.emptyMap()), principal, protocol, remoteAddress, attributes, logPrefix);
<add> }
<ide>
<add> /**
<add> * Constructor targetting server-side use with extra information about the
<add> * handshake, the remote address, and a pre-existing log prefix for
<add> * correlation.
<add> * @param uri the endpoint URL
<add> * @param headers request headers for server or response headers or client
<add> * @param cookies request cookies for server
<add> * @param principal the principal for the session
<add> * @param protocol the negotiated sub-protocol (may be {@code null})
<add> * @param remoteAddress the remote address where the handshake came from
<add> * @param attributes initial attributes to use for the WebSocket session
<add> * @param logPrefix log prefix used during the handshake for correlating log
<add> * messages, if any.
<add> * @since 5.4
<add> */
<add> public HandshakeInfo(URI uri, HttpHeaders headers, MultiValueMap<String, HttpCookie> cookies,
<add> Mono<Principal> principal, @Nullable String protocol, @Nullable InetSocketAddress remoteAddress,
<add> Map<String, Object> attributes, @Nullable String logPrefix) {
<ide> Assert.notNull(uri, "URI is required");
<ide> Assert.notNull(headers, "HttpHeaders are required");
<ide> Assert.notNull(principal, "Principal is required");
<ide> Assert.notNull(attributes, "'attributes' is required");
<ide>
<ide> this.uri = uri;
<ide> this.headers = headers;
<add> this.cookies = cookies;
<ide> this.principalMono = principal;
<ide> this.protocol = protocol;
<ide> this.remoteAddress = remoteAddress;
<ide> public HttpHeaders getHeaders() {
<ide> return this.headers;
<ide> }
<ide>
<add> /**
<add> * Return the handshake HTTP cookies.
<add> */
<add> public MultiValueMap<String, HttpCookie> getCookies() {
<add> return this.cookies;
<add> }
<add>
<ide> /**
<ide> * Return the principal associated with the handshake HTTP request.
<ide> */
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/socket/server/support/HandshakeWebSocketService.java
<ide> import org.springframework.context.Lifecycle;
<ide> import org.springframework.http.HttpHeaders;
<ide> import org.springframework.http.HttpMethod;
<add>import org.springframework.http.HttpCookie;
<ide> import org.springframework.http.server.reactive.ServerHttpRequest;
<ide> import org.springframework.lang.Nullable;
<ide> import org.springframework.util.Assert;
<ide> import org.springframework.util.ClassUtils;
<ide> import org.springframework.util.ReflectionUtils;
<ide> import org.springframework.util.StringUtils;
<add>import org.springframework.util.MultiValueMap;
<add>import org.springframework.util.LinkedMultiValueMap;
<ide> import org.springframework.web.reactive.socket.HandshakeInfo;
<ide> import org.springframework.web.reactive.socket.WebSocketHandler;
<ide> import org.springframework.web.reactive.socket.server.RequestUpgradeStrategy;
<ide> private HandshakeInfo createHandshakeInfo(ServerWebExchange exchange, ServerHttp
<ide> // the server implementation once the handshake HTTP exchange is done.
<ide> HttpHeaders headers = new HttpHeaders();
<ide> headers.addAll(request.getHeaders());
<add> MultiValueMap<String, HttpCookie> cookies = new LinkedMultiValueMap<>();
<add> cookies.addAll(request.getCookies());
<ide> Mono<Principal> principal = exchange.getPrincipal();
<ide> String logPrefix = exchange.getLogPrefix();
<ide> InetSocketAddress remoteAddress = request.getRemoteAddress();
<del> return new HandshakeInfo(uri, headers, principal, protocol, remoteAddress, attributes, logPrefix);
<add> return new HandshakeInfo(uri, headers, cookies, principal, protocol, remoteAddress, attributes, logPrefix);
<ide> }
<ide>
<ide> } | 2 |
Go | Go | add 500 check for registry api call | 88f02c2f33ff5caf69b93e667b52ab50e5e386ad | <ide><path>registry/auth.go
<ide> func loginV1(authConfig *cliconfig.AuthConfig, registryEndpoint *Endpoint) (stri
<ide> }
<ide> // *TODO: Use registry configuration to determine what this says, if anything?
<ide> return "", fmt.Errorf("Login: Account is not Active. Please see the documentation of the registry %s for instructions how to activate it.", serverAddress)
<add> } else if resp.StatusCode == 500 { // Issue #14326
<add> logrus.Errorf("%s returned status code %d. Response Body :\n%s", req.URL.String(), resp.StatusCode, body)
<add> return "", fmt.Errorf("Internal Server Error")
<ide> }
<ide> return "", fmt.Errorf("Login: %s (Code: %d; Headers: %s)", body, resp.StatusCode, resp.Header)
<ide> } | 1 |
Javascript | Javascript | add benchmark for v8.getheap*statistics | bed4612c408dddd86f82b0d939338b6b72a5e346 | <ide><path>benchmark/v8/get-stats.js
<add>'use strict';
<add>
<add>const common = require('../common.js');
<add>const v8 = require('v8');
<add>
<add>const bench = common.createBenchmark(main, {
<add> method: [
<add> 'getHeapStatistics',
<add> 'getHeapSpaceStatistics'
<add> ],
<add> n: [1e6],
<add> flags: ['--ignition --turbo', '']
<add>});
<add>
<add>function main(conf) {
<add> const n = +conf.n;
<add> const method = conf.method;
<add> var i = 0;
<add> bench.start();
<add> for (; i < n; i++)
<add> v8[method]();
<add> bench.end(n);
<add>} | 1 |
Ruby | Ruby | improve alpha and rc detection | 58a2ef9b58d90dd831647f1bcc39e8597be5a7b8 | <ide><path>Library/Homebrew/version.rb
<ide> def self._parse(spec)
<ide> m = /-((?:\d+\.)*\d+(?:[abc]|rc|RC)\d*)$/.match(stem)
<ide> return m.captures.first unless m.nil?
<ide>
<del> # e.g. foobar-4.5.0-beta1, or foobar-4.50-beta
<del> m = /-((?:\d+\.)*\d+-beta\d*)$/.match(stem)
<add> # e.g. foobar-4.5.0-alpha5, foobar-4.5.0-beta1, or foobar-4.50-beta
<add> m = /-((?:\d+\.)*\d+-(?:alpha|beta|rc)\d*)$/.match(stem)
<ide> return m.captures.first unless m.nil?
<ide>
<ide> # e.g. http://ftpmirror.gnu.org/libidn/libidn-1.29-win64.zip | 1 |
Javascript | Javascript | write font cmap using a string | 32880025fc1ccdcc6e47a77fa4c2be4ceed29012 | <ide><path>fonts.js
<ide> var Font = (function () {
<ide> var searchRange = FontsUtils.getMaxPower2(segCount) * 2;
<ide> var searchEntry = Math.log(segCount) / Math.log(2);
<ide> var rangeShift = 2 * segCount - searchRange;
<del> var cmap = [].concat(
<del> [
<del> 0x00, 0x00, // version
<del> 0x00, 0x01, // numTables
<del> 0x00, 0x03, // platformID
<del> 0x00, 0x01, // encodingID
<del> 0x00, 0x00, 0x00, 0x0C, // start of the table record
<del> 0x00, 0x04 // format
<del> ],
<del> FontsUtils.integerToBytes(headerSize, 2), // length
<del> [0x00, 0x00], // language
<del> FontsUtils.integerToBytes(segCount2, 2),
<del> FontsUtils.integerToBytes(searchRange, 2),
<del> FontsUtils.integerToBytes(searchEntry, 2),
<del> FontsUtils.integerToBytes(rangeShift, 2)
<del> );
<add>
<add> var cmap = "\x00\x00" + // version
<add> "\x00\x01" + // numTables
<add> "\x00\x03" + // platformID
<add> "\x00\x01" + // encodingID
<add> "\x00\x00\x00\x0C" + // start of the table record
<add> "\x00\x04" + // format
<add> s16(headerSize) + // length
<add> "\x00\x00" + // languages
<add> s16(segCount2) +
<add> s16(searchRange) +
<add> s16(searchEntry) +
<add> s16(rangeShift);
<add> cmap = s2a(cmap);
<ide>
<ide> // Fill up the 4 parallel arrays describing the segments.
<ide> var startCount = []; | 1 |
Ruby | Ruby | remove @state.parent assignment on commit | dd9829a9ea460ddcfc8d954f2b95161b52fff6e7 | <ide><path>activerecord/lib/active_record/connection_adapters/abstract/transaction.rb
<ide> def savepoint_name
<ide> end
<ide>
<ide> class TransactionState
<del> attr_accessor :parent
<add> attr_reader :parent
<ide>
<ide> VALID_STATES = Set.new([:committed, :rolledback, nil])
<ide>
<ide> def perform_rollback
<ide>
<ide> def perform_commit
<ide> @state.set_state(:committed)
<del> @state.parent = parent.state
<ide> connection.release_savepoint(@savepoint_name)
<ide> end
<ide> end | 1 |
Python | Python | debug + tests for multipartparser | ee74aec27cdc8ca9934f93c828ffbdc7da3c426c | <ide><path>djangorestframework/parsers.py
<ide> class DataFlatener(object):
<ide> def flatten_data(self, data):
<ide> """Given a data dictionary {<key>: <value_list>}, returns a flattened dictionary
<ide> with information provided by the method "is_a_list"."""
<del> data = data.copy()
<ide> flatdata = dict()
<ide> for key, val_list in data.items():
<ide> if self.is_a_list(key, val_list):
<ide> class FormParser(BaseParser, DataFlatener):
<ide> Return a dict containing a single value for each non-reserved parameter.
<ide>
<ide> In order to handle select multiple (and having possibly more than a single value for each parameter),
<del> you can customize the output by subclassing the method 'is_a_list'.
<add> you can customize the output by subclassing the method 'is_a_list'."""
<ide>
<del> """
<del> # TODO: writing tests for PUT files + normal data
<ide> media_type = 'application/x-www-form-urlencoded'
<ide>
<ide> """The value of the parameter when the select multiple is empty.
<ide> def parse(self, input):
<ide> data, files = django_mpp.parse()
<ide>
<ide> # Flatening data, files and combining them
<del> data = self.flatten_data(data)
<del> files = self.flatten_data(files)
<add> data = self.flatten_data(dict(data.iterlists()))
<add> files = self.flatten_data(dict(files.iterlists()))
<ide> data.update(files)
<ide>
<ide> # Strip any parameters that we are treating as reserved
<ide><path>djangorestframework/tests/parsers.py
<ide> >>> some_resource = Resource()
<ide> >>> trash = some_resource.dispatch(req)# Some variables are set only when calling dispatch
<ide>
<add>FormParser
<add>============
<add>
<ide> Data flatening
<ide> ----------------
<ide>
<ide> >>> MyFormParser(some_resource).parse(inpt) == {'key1': 'bla1', 'key2': ['blo1', 'blo2']}
<ide> True
<ide>
<add>.. note:: The same functionality is available for :class:`parsers.MultipartParser`.
<add>
<ide> Submitting an empty list
<ide> --------------------------
<ide>
<ide> >>> MyFormParser(some_resource).parse(inpt) == {'key1': 'blo1', 'key2': []}
<ide> True
<ide>
<del>Better like that. Note also that you can configure something else than ``_empty`` for the empty value by setting :class:`parsers.FormParser.EMPTY_VALUE`.
<add>Better like that. Note that you can configure something else than ``_empty`` for the empty value by setting :attr:`parsers.FormParser.EMPTY_VALUE`.
<ide> """
<add>import httplib, mimetypes
<add>from tempfile import TemporaryFile
<add>from django.test import TestCase
<add>from djangorestframework.compat import RequestFactory
<add>from djangorestframework.parsers import MultipartParser
<add>from djangorestframework.resource import Resource
<add>
<add>def encode_multipart_formdata(fields, files):
<add> """For testing multipart parser.
<add> fields is a sequence of (name, value) elements for regular form fields.
<add> files is a sequence of (name, filename, value) elements for data to be uploaded as files
<add> Return (content_type, body)."""
<add> BOUNDARY = '----------ThIs_Is_tHe_bouNdaRY_$'
<add> CRLF = '\r\n'
<add> L = []
<add> for (key, value) in fields:
<add> L.append('--' + BOUNDARY)
<add> L.append('Content-Disposition: form-data; name="%s"' % key)
<add> L.append('')
<add> L.append(value)
<add> for (key, filename, value) in files:
<add> L.append('--' + BOUNDARY)
<add> L.append('Content-Disposition: form-data; name="%s"; filename="%s"' % (key, filename))
<add> L.append('Content-Type: %s' % get_content_type(filename))
<add> L.append('')
<add> L.append(value)
<add> L.append('--' + BOUNDARY + '--')
<add> L.append('')
<add> body = CRLF.join(L)
<add> content_type = 'multipart/form-data; boundary=%s' % BOUNDARY
<add> return content_type, body
<add>
<add>def get_content_type(filename):
<add> return mimetypes.guess_type(filename)[0] or 'application/octet-stream'
<add>
<add>class TestMultipartParser(TestCase):
<add> def setUp(self):
<add> self.req = RequestFactory()
<add> self.content_type, self.body = encode_multipart_formdata([('key1', 'val1'), ('key1', 'val2')],
<add> [('file1', 'pic.jpg', 'blablabla'), ('file1', 't.txt', 'blobloblo')])
<add>
<add> def test_multipartparser(self):
<add> """Ensure that MultipartParser can parse multipart/form-data that contains a mix of several files and parameters."""
<add> post_req = RequestFactory().post('/', self.body, content_type=self.content_type)
<add> some_resource = Resource()
<add> some_resource.dispatch(post_req)
<add> parsed = MultipartParser(some_resource).parse(self.body)
<add> self.assertEqual(parsed['key1'], 'val1')
<add> self.assertEqual(parsed['file1'].read(), 'blablabla')
<add> | 2 |
Javascript | Javascript | switch assertion order | 1ff9a49b7811f77919075132559adf105c3291b5 | <ide><path>test/pummel/test-child-process-spawn-loop.js
<ide> function doSpawn(i) {
<ide>
<ide> child.on('close', () => {
<ide> // + 1 for \n or + 2 for \r\n on Windows
<del> assert.strictEqual(SIZE + (common.isWindows ? 2 : 1), count);
<add> assert.strictEqual(count, SIZE + (common.isWindows ? 2 : 1));
<ide> if (i < N) {
<ide> doSpawn(i + 1);
<ide> } else { | 1 |
Python | Python | use hparams rather than dict. don't tune sync | e11010fce913ee21a5f57a116aa4c87d0afd3243 | <ide><path>tutorials/image/cifar10_estimator/cifar10_main.py
<ide> from __future__ import print_function
<ide>
<ide> import argparse
<del>import collections
<ide> import functools
<ide> import itertools
<ide> import os
<ide> tf.logging.set_verbosity(tf.logging.INFO)
<ide>
<ide>
<del>def get_model_fn(num_gpus, variable_strategy, num_workers):
<add>def get_model_fn(num_gpus, variable_strategy, num_workers, sync):
<ide> def _resnet_model_fn(features, labels, mode, params):
<ide> """Resnet model body.
<ide>
<ide> def _resnet_model_fn(features, labels, mode, params):
<ide> features: a list of tensors, one for each tower
<ide> labels: a list of tensors, one for each tower
<ide> mode: ModeKeys.TRAIN or EVAL
<del> params: Dictionary of Hyperparameters suitable for tuning
<add> params: Hyperparameters suitable for tuning
<ide> Returns:
<ide> A EstimatorSpec object.
<ide> """
<ide> is_training = (mode == tf.estimator.ModeKeys.TRAIN)
<del> weight_decay = params['weight_decay']
<del> momentum = params['momentum']
<add> weight_decay = params.weight_decay
<add> momentum = params.momentum
<ide>
<ide> tower_features = features
<ide> tower_labels = labels
<ide> def _resnet_model_fn(features, labels, mode, params):
<ide> tower_features[i],
<ide> tower_labels[i],
<ide> (device_type == 'cpu'),
<del> params['num_layers'],
<del> params['batch_norm_decay'],
<del> params['batch_norm_epsilon'])
<add> params.num_layers,
<add> params.batch_norm_decay,
<add> params.batch_norm_epsilon)
<ide> tower_losses.append(loss)
<ide> tower_gradvars.append(gradvars)
<ide> tower_preds.append(preds)
<ide> def _resnet_model_fn(features, labels, mode, params):
<ide> # Suggested learning rate scheduling from
<ide> # https://github.com/ppwwyyxx/tensorpack/blob/master/examples/ResNet/cifar10-resnet.py#L155
<ide> num_batches_per_epoch = cifar10.Cifar10DataSet.num_examples_per_epoch(
<del> 'train') // (params['train_batch_size'] * num_workers)
<add> 'train') // (params.train_batch_size * num_workers)
<ide> boundaries = [
<ide> num_batches_per_epoch * x
<ide> for x in np.array([82, 123, 300], dtype=np.int64)
<ide> ]
<del> staged_lr = [params['learning_rate'] * x for x in [1, 0.1, 0.01, 0.002]]
<add> staged_lr = [params.learning_rate * x for x in [1, 0.1, 0.01, 0.002]]
<ide>
<ide> learning_rate = tf.train.piecewise_constant(tf.train.get_global_step(),
<ide> boundaries, staged_lr)
<ide> def _resnet_model_fn(features, labels, mode, params):
<ide> learning_rate=learning_rate, momentum=momentum)
<ide>
<ide> chief_hooks = []
<del> if params['sync']:
<add> if sync:
<ide> optimizer = tf.train.SyncReplicasOptimizer(
<ide> optimizer,
<ide> replicas_to_aggregate=num_workers)
<ide> def input_fn(data_dir, subset, num_shards, batch_size,
<ide>
<ide> # create experiment
<ide> def get_experiment_fn(data_dir, num_gpus, is_gpu_ps,
<del> use_distortion_for_training=True):
<add> use_distortion_for_training=True,
<add> sync=True):
<ide> """Returns an Experiment function.
<ide>
<ide> Experiments perform training on several workers in parallel,
<ide> def get_experiment_fn(data_dir, num_gpus, is_gpu_ps,
<ide> num_gpus: int. Number of GPUs on each worker.
<ide> is_gpu_ps: bool. If true, average gradients on GPUs.
<ide> use_distortion_for_training: bool. See cifar10.Cifar10DataSet.
<add> sync: bool. If true synchronizes variable updates across workers.
<ide> Returns:
<ide> A function (tf.estimator.RunConfig, tf.contrib.training.HParams) ->
<ide> tf.contrib.learn.Experiment.
<ide> def _experiment_fn(run_config, hparams):
<ide>
<ide> classifier = tf.estimator.Estimator(
<ide> model_fn=get_model_fn(
<del> num_gpus, is_gpu_ps, run_config.num_worker_replicas or 1),
<add> num_gpus, is_gpu_ps, run_config.num_worker_replicas or 1, sync),
<ide> config=run_config,
<del> params=vars(hparams)
<add> params=hparams
<ide> )
<ide>
<ide> # Create experiment.
<ide> def main(job_dir,
<ide> use_distortion_for_training,
<ide> log_device_placement,
<ide> num_intra_threads,
<add> sync,
<ide> **hparams):
<ide> # The env variable is on deprecation path, default is set to off.
<ide> os.environ['TF_SYNC_ON_FINISH'] = '0'
<ide> def main(job_dir,
<ide> data_dir,
<ide> num_gpus,
<ide> variable_strategy,
<del> use_distortion_for_training
<add> use_distortion_for_training,
<add> sync
<ide> ),
<ide> run_config=config,
<ide> hparams=tf.contrib.training.HParams(**hparams)
<ide> def main(job_dir,
<ide> type=float,
<ide> default=2e-4,
<ide> help='Weight decay for convolutions.'
<del> )
<add> )
<ide> parser.add_argument(
<ide> '--learning-rate',
<ide> type=float, | 1 |
Javascript | Javascript | move composition event to plugin with polyfill | 5d7633d74cc79d6bb6498c9dd57d62b6718648e2 | <ide><path>src/core/ReactDefaultInjection.js
<ide> var DOMProperty = require('DOMProperty');
<ide> var DefaultEventPluginOrder = require('DefaultEventPluginOrder');
<ide> var EnterLeaveEventPlugin = require('EnterLeaveEventPlugin');
<ide> var ChangeEventPlugin = require('ChangeEventPlugin');
<add>var CompositionEventPlugin = require('CompositionEventPlugin');
<ide> var EventPluginHub = require('EventPluginHub');
<ide> var ReactInstanceHandles = require('ReactInstanceHandles');
<ide> var SimpleEventPlugin = require('SimpleEventPlugin');
<ide> function inject() {
<ide> 'SimpleEventPlugin': SimpleEventPlugin,
<ide> 'EnterLeaveEventPlugin': EnterLeaveEventPlugin,
<ide> 'ChangeEventPlugin': ChangeEventPlugin,
<add> 'CompositionEventPlugin': CompositionEventPlugin,
<ide> 'MobileSafariClickEventPlugin': MobileSafariClickEventPlugin
<ide> });
<ide>
<ide><path>src/eventPlugins/CompositionEventPlugin.js
<add>/**
<add> * Copyright 2013 Facebook, Inc.
<add> *
<add> * Licensed under the Apache License, Version 2.0 (the "License");
<add> * you may not use this file except in compliance with the License.
<add> * You may obtain a copy of the License at
<add> *
<add> * http://www.apache.org/licenses/LICENSE-2.0
<add> *
<add> * Unless required by applicable law or agreed to in writing, software
<add> * distributed under the License is distributed on an "AS IS" BASIS,
<add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<add> * See the License for the specific language governing permissions and
<add> * limitations under the License.
<add> *
<add> * @providesModule CompositionEventPlugin
<add> * @typechecks static-only
<add> */
<add>
<add>"use strict";
<add>
<add>var EventConstants = require('EventConstants');
<add>var EventPropagators = require('EventPropagators');
<add>var ReactInputSelection = require('ReactInputSelection');
<add>var SyntheticCompositionEvent = require('SyntheticCompositionEvent');
<add>
<add>var getTextContentAccessor = require('getTextContentAccessor');
<add>var keyOf = require('keyOf');
<add>
<add>var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
<add>var START_KEYCODE = 229;
<add>
<add>var useCompositionEvent = 'CompositionEvent' in window;
<add>var topLevelTypes = EventConstants.topLevelTypes;
<add>var currentComposition = null;
<add>
<add>// Events and their corresponding property names.
<add>var eventTypes = {
<add> compositionEnd: {
<add> phasedRegistrationNames: {
<add> bubbled: keyOf({onCompositionEnd: null}),
<add> captured: keyOf({onCompositionEndCapture: null})
<add> }
<add> },
<add> compositionStart: {
<add> phasedRegistrationNames: {
<add> bubbled: keyOf({onCompositionStart: null}),
<add> captured: keyOf({onCompositionStartCapture: null})
<add> }
<add> },
<add> compositionUpdate: {
<add> phasedRegistrationNames: {
<add> bubbled: keyOf({onCompositionUpdate: null}),
<add> captured: keyOf({onCompositionUpdateCapture: null})
<add> }
<add> }
<add>};
<add>
<add>/**
<add> * Translate native top level events into event types.
<add> *
<add> * @param {string} topLevelType
<add> * @return {object}
<add> */
<add>function getCompositionEventType(topLevelType) {
<add> switch (topLevelType) {
<add> case topLevelTypes.topCompositionStart:
<add> return eventTypes.compositionStart;
<add> case topLevelTypes.topCompositionEnd:
<add> return eventTypes.compositionEnd;
<add> case topLevelTypes.topCompositionUpdate:
<add> return eventTypes.compositionUpdate;
<add> }
<add>}
<add>
<add>/**
<add> * Does our fallback best-guess model think this event signifies that
<add> * composition has begun?
<add> *
<add> * @param {string} topLevelType
<add> * @param {object} nativeEvent
<add> * @return {boolean}
<add> */
<add>function isFallbackStart(topLevelType, nativeEvent) {
<add> return (
<add> topLevelType === topLevelTypes.topKeyDown &&
<add> nativeEvent.keyCode === START_KEYCODE
<add> );
<add>}
<add>
<add>/**
<add> * Does our fallback mode think that this event is the end of composition?
<add> *
<add> * @param {string} topLevelType
<add> * @param {object} nativeEvent
<add> * @return {boolean}
<add> */
<add>function isFallbackEnd(topLevelType, nativeEvent) {
<add> switch (topLevelType) {
<add> case topLevelTypes.topKeyUp:
<add> // Command keys insert or clear IME input.
<add> return (END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1);
<add> case topLevelTypes.topKeyDown:
<add> // Expect IME keyCode on each keydown. If we get any other
<add> // code we must have exited earlier.
<add> return (nativeEvent.keyCode !== START_KEYCODE);
<add> case topLevelTypes.topKeyPress:
<add> case topLevelTypes.topMouseDown:
<add> case topLevelTypes.topBlur:
<add> // Events are not possible without cancelling IME.
<add> return true;
<add> default:
<add> return false;
<add> }
<add>}
<add>
<add>/**
<add> * Helper class stores information about selection and document state
<add> * so we can figure out what changed at a later date.
<add> *
<add> * @param {DOMEventTarget} root
<add> */
<add>function FallbackCompositionState(root) {
<add> this.root = root;
<add> this.startSelection = ReactInputSelection.getSelection(root);
<add> this.startValue = this.getText();
<add>}
<add>
<add>/**
<add> * Get current text of input.
<add> *
<add> * @return {string}
<add> */
<add>FallbackCompositionState.prototype.getText = function() {
<add> return this.root.value || this.root[getTextContentAccessor()];
<add>};
<add>
<add>/**
<add> * Text that has changed since the start of composition.
<add> *
<add> * @return {string}
<add> */
<add>FallbackCompositionState.prototype.getData = function() {
<add> var endValue = this.getText();
<add> var prefixLength = this.startSelection.start;
<add> var suffixLength = this.startValue.length - this.startSelection.end;
<add>
<add> return endValue.substr(
<add> prefixLength,
<add> endValue.length - suffixLength - prefixLength
<add> );
<add>};
<add>
<add>/**
<add> * This plugin creates `onCompositionStart`, `onCompositionUpdate` and
<add> * `onCompositionEnd` events on inputs, textareas and contentEditable
<add> * nodes.
<add> */
<add>var CompositionEventPlugin = {
<add>
<add> eventTypes: eventTypes,
<add>
<add> /**
<add> * @param {string} topLevelType Record from `EventConstants`.
<add> * @param {DOMEventTarget} topLevelTarget The listening component root node.
<add> * @param {string} topLevelTargetID ID of `topLevelTarget`.
<add> * @param {object} nativeEvent Native browser event.
<add> * @return {*} An accumulation of synthetic events.
<add> * @see {EventPluginHub.extractEvents}
<add> */
<add> extractEvents: function(
<add> topLevelType,
<add> topLevelTarget,
<add> topLevelTargetID,
<add> nativeEvent) {
<add>
<add> var eventType;
<add> var data;
<add>
<add> if (useCompositionEvent) {
<add> eventType = getCompositionEventType(topLevelType);
<add> } else if (!currentComposition) {
<add> if (isFallbackStart(topLevelType, nativeEvent)) {
<add> eventType = eventTypes.start;
<add> currentComposition = new FallbackCompositionState(topLevelTarget);
<add> }
<add> } else if (isFallbackEnd(topLevelType, nativeEvent)) {
<add> eventType = eventTypes.compositionEnd;
<add> data = currentComposition.getData();
<add> currentComposition = null;
<add> }
<add>
<add> if (eventType) {
<add> var event = SyntheticCompositionEvent.getPooled(
<add> eventType,
<add> topLevelTargetID,
<add> nativeEvent
<add> );
<add> if (data) {
<add> // Inject data generated from fallback path into the synthetic event.
<add> // This matches the property of native CompositionEventInterface.
<add> event.data = data;
<add> }
<add> EventPropagators.accumulateTwoPhaseDispatches(event);
<add> return event;
<add> }
<add> }
<add>};
<add>
<add>module.exports = CompositionEventPlugin;
<ide><path>src/eventPlugins/DefaultEventPluginOrder.js
<ide> var DefaultEventPluginOrder = [
<ide> keyOf({TapEventPlugin: null}),
<ide> keyOf({EnterLeaveEventPlugin: null}),
<ide> keyOf({ChangeEventPlugin: null}),
<add> keyOf({CompositionEventPlugin: null}),
<ide> keyOf({AnalyticsEventPlugin: null}),
<ide> keyOf({MobileSafariClickEventPlugin: null})
<ide> ];
<ide><path>src/eventPlugins/SimpleEventPlugin.js
<ide> var EventConstants = require('EventConstants');
<ide> var EventPropagators = require('EventPropagators');
<ide> var SyntheticClipboardEvent = require('SyntheticClipboardEvent');
<del>var SyntheticCompositionEvent = require('SyntheticCompositionEvent');
<ide> var SyntheticEvent = require('SyntheticEvent');
<ide> var SyntheticFocusEvent = require('SyntheticFocusEvent');
<ide> var SyntheticKeyboardEvent = require('SyntheticKeyboardEvent');
<ide> var eventTypes = {
<ide> captured: keyOf({onClickCapture: true})
<ide> }
<ide> },
<del> compositionEnd: {
<del> phasedRegistrationNames: {
<del> bubbled: keyOf({onCompositionEnd: true}),
<del> captured: keyOf({onCompositionEndCapture: true})
<del> }
<del> },
<del> compositionStart: {
<del> phasedRegistrationNames: {
<del> bubbled: keyOf({onCompositionStart: true}),
<del> captured: keyOf({onCompositionStartCapture: true})
<del> }
<del> },
<del> compositionUpdate: {
<del> phasedRegistrationNames: {
<del> bubbled: keyOf({onCompositionUpdate: true}),
<del> captured: keyOf({onCompositionUpdateCapture: true})
<del> }
<del> },
<ide> copy: {
<ide> phasedRegistrationNames: {
<ide> bubbled: keyOf({onCopy: true}),
<ide> var topLevelEventsToDispatchConfig = {
<ide> topClick: eventTypes.click,
<ide> topCopy: eventTypes.copy,
<ide> topCut: eventTypes.cut,
<del> topCompositionEnd: eventTypes.compositionEnd,
<del> topCompositionStart: eventTypes.compositionStart,
<del> topCompositionUpdate: eventTypes.compositionUpdate,
<ide> topDoubleClick: eventTypes.doubleClick,
<ide> topDOMCharacterDataModified: eventTypes.DOMCharacterDataModified,
<ide> topDrag: eventTypes.drag,
<ide> var SimpleEventPlugin = {
<ide> case topLevelTypes.topPaste:
<ide> EventConstructor = SyntheticClipboardEvent;
<ide> break;
<del> case topLevelTypes.topCompositionStart:
<del> case topLevelTypes.topCompositionEnd:
<del> case topLevelTypes.topCompositionUpdate:
<del> EventConstructor = SyntheticCompositionEvent;
<del> break;
<ide> }
<ide> invariant(
<ide> EventConstructor, | 4 |
Javascript | Javascript | remove defaultprops from keyboardavoidingview | 2824b68ee8f808bc2860d1a4fd8f4e92127b79f6 | <ide><path>Libraries/Components/Keyboard/KeyboardAvoidingView.js
<ide> type Props = $ReadOnly<{|
<ide> * Controls whether this `KeyboardAvoidingView` instance should take effect.
<ide> * This is useful when more than one is on the screen. Defaults to true.
<ide> */
<del> enabled: ?boolean,
<add> enabled?: ?boolean,
<ide>
<ide> /**
<ide> * Distance between the top of the user screen and the React Native view. This
<ide> * may be non-zero in some cases. Defaults to 0.
<ide> */
<del> keyboardVerticalOffset: number,
<add> keyboardVerticalOffset?: number,
<ide> |}>;
<ide>
<ide> type State = {|
<ide> type State = {|
<ide> * adjusting its height, position, or bottom padding.
<ide> */
<ide> class KeyboardAvoidingView extends React.Component<Props, State> {
<del> static defaultProps: {|enabled: boolean, keyboardVerticalOffset: number|} = {
<del> enabled: true,
<del> keyboardVerticalOffset: 0,
<del> };
<del>
<ide> _frame: ?ViewLayout = null;
<ide> _keyboardEvent: ?KeyboardEvent = null;
<ide> _subscriptions: Array<EventSubscription> = [];
<ide> class KeyboardAvoidingView extends React.Component<Props, State> {
<ide> return 0;
<ide> }
<ide>
<del> const keyboardY = keyboardFrame.screenY - this.props.keyboardVerticalOffset;
<add> const keyboardY =
<add> keyboardFrame.screenY - (this.props.keyboardVerticalOffset ?? 0);
<ide>
<ide> // Calculate the displacement needed for the view such that it
<ide> // no longer overlaps with the keyboard
<ide> class KeyboardAvoidingView extends React.Component<Props, State> {
<ide> behavior,
<ide> children,
<ide> contentContainerStyle,
<del> enabled,
<del> keyboardVerticalOffset,
<add> enabled = true,
<add> // eslint-disable-next-line no-unused-vars
<add> keyboardVerticalOffset = 0,
<ide> style,
<ide> ...props
<ide> } = this.props; | 1 |
PHP | PHP | update array usage | 9fa29d2fc549bb0613bfc95282f477c91446c126 | <ide><path>lib/Cake/Routing/RequestActionTrait.php
<ide> trait RequestActionTrait {
<ide> * or fetch the return value from controller actions.
<ide> *
<ide> * Under the hood this method uses Router::reverse() to convert the $url parameter into a string
<del> * URL. You should use URL formats that are compatible with Router::reverse()
<add> * URL. You should use URL formats that are compatible with Router::reverse()
<ide> *
<ide> * #### Passing POST and GET data
<ide> *
<ide> public function requestAction($url, $extra = array()) {
<ide> $url = Router::normalize(str_replace(FULL_BASE_URL, '', $url));
<ide> }
<ide> if (is_string($url)) {
<del> $params = array(
<add> $params = [
<ide> 'url' => $url
<del> );
<add> ];
<ide> } elseif (is_array($url)) {
<ide> $params = array_merge($url, [
<ide> 'pass' => [], | 1 |
Python | Python | fix digital ocean tests | b164cfc793f99ed6c0e52f2e681abd9dfe744a50 | <ide><path>libcloud/common/base.py
<ide>
<ide> import libcloud
<ide>
<del>from libcloud.utils.py3 import PY3, PY25
<add>from libcloud.utils.py3 import PY25
<ide> from libcloud.utils.py3 import httplib
<ide> from libcloud.utils.py3 import urlparse
<ide> from libcloud.utils.py3 import urlencode
<del>from libcloud.utils.py3 import b
<ide>
<ide> from libcloud.utils.misc import lowercase_keys, retry
<ide> from libcloud.utils.compression import decompress_data
<ide> def __init__(self, response, connection):
<ide> self.error = response.reason
<ide> self.status = response.status_code
<ide>
<del> self.body = response.text
<add> self.body = response.text if response.text is not None else ''
<ide>
<ide> if not self.success():
<ide> raise exception_from_message(code=self.status,
<ide> def parse_body(self):
<ide> :return: Parsed body.
<ide> :rtype: ``str``
<ide> """
<del> return self.body
<add> return self.body if self.body is not None else ''
<ide>
<ide> def parse_error(self):
<ide> """
<ide> class JsonResponse(Response):
<ide> """
<ide>
<ide> def parse_body(self):
<del> if len(self.body) == 0 and not self.parse_zero_length_body:
<add> if self.body is not None and \
<add> len(self.body) == 0 and not self.parse_zero_length_body:
<ide> return self.body
<ide>
<ide> try:
<ide> class XmlResponse(Response):
<ide>
<ide> def parse_body(self):
<ide> if len(self.body) == 0 and not self.parse_zero_length_body:
<del> return self.body
<add> return self.body if self.body is not None else ''
<ide>
<ide> try:
<ide> body = ET.XML(self.body)
<ide><path>libcloud/test/__init__.py
<ide> class MockResponse(object):
<ide> A mock HTTPResponse
<ide> """
<ide> headers = {}
<del> body = None
<add> body = ''
<ide> status = 0
<ide> reason = ''
<ide> version = 11
<ide><path>libcloud/test/dns/test_digitalocean.py
<ide> def test_delete_record(self):
<ide> class DigitalOceanDNSMockHttp(MockHttpTestCase):
<ide> fixtures = DNSFileFixtures('digitalocean')
<ide>
<del> response = {
<add> response_map = {
<ide> None: httplib.OK,
<ide> 'CREATE': httplib.CREATED,
<ide> 'DELETE': httplib.NO_CONTENT,
<ide> class DigitalOceanDNSMockHttp(MockHttpTestCase):
<ide>
<ide> def _v2_domains(self, method, url, body, headers):
<ide> body = self.fixtures.load('_v2_domains.json')
<del> return (self.response[self.type], body, {},
<del> httplib.responses[self.response[self.type]])
<add> return (self.response_map[self.type], body, {},
<add> httplib.responses[self.response_map[self.type]])
<ide>
<ide> def _v2_domains_CREATE(self, method, url, body, headers):
<ide> body = self.fixtures.load('_v2_domains_CREATE.json')
<del> return (self.response[self.type], body, {},
<del> httplib.responses[self.response[self.type]])
<add> return (self.response_map[self.type], body, {},
<add> httplib.responses[self.response_map[self.type]])
<ide>
<ide> def _v2_domains_EMPTY(self, method, url, body, headers):
<ide> body = self.fixtures.load('_v2_domains_EMPTY.json')
<del> return (self.response[self.type], body, {},
<del> httplib.responses[self.response[self.type]])
<add> return (self.response_map[self.type], body, {},
<add> httplib.responses[self.response_map[self.type]])
<ide>
<ide> def _v2_domains_UNAUTHORIZED(self, method, url, body, headers):
<ide> body = self.fixtures.load('_v2_domains_UNAUTHORIZED.json')
<del> return (self.response[self.type], body, {},
<del> httplib.responses[self.response[self.type]])
<add> return (self.response_map[self.type], body, {},
<add> httplib.responses[self.response_map[self.type]])
<ide>
<ide> def _v2_domains_testdomain(self, method, url, body, headers):
<ide> body = self.fixtures.load('_v2_domains_testdomain.json')
<del> return (self.response[self.type], body, {},
<del> httplib.responses[self.response[self.type]])
<add> return (self.response_map[self.type], body, {},
<add> httplib.responses[self.response_map[self.type]])
<ide>
<ide> def _v2_domains_testdomain_DELETE(self, method, url, body, headers):
<del> return (self.response[self.type], body, {},
<del> httplib.responses[self.response[self.type]])
<add> return (self.response_map[self.type], body, {},
<add> httplib.responses[self.response_map[self.type]])
<ide>
<ide> def _v2_domains_testdomain_NOT_FOUND(self, method, url, body, headers):
<ide> body = self.fixtures.load('_v2_domains_testdomain_NOT_FOUND.json')
<del> return (self.response[self.type], body, {},
<del> httplib.responses[self.response[self.type]])
<add> return (self.response_map[self.type], body, {},
<add> httplib.responses[self.response_map[self.type]])
<ide>
<ide> def _v2_domains_testdomain_records(self, method, url, body, headers):
<ide> body = self.fixtures.load('_v2_domains_testdomain_records.json')
<del> return (self.response[self.type], body, {},
<del> httplib.responses[self.response[self.type]])
<add> return (self.response_map[self.type], body, {},
<add> httplib.responses[self.response_map[self.type]])
<ide>
<ide> def _v2_domains_testdomain_records_CREATE(self, method, url,
<ide> body, headers):
<ide> body = self.fixtures.load('_v2_domains_testdomain_records_CREATE.json')
<del> return (self.response[self.type], body, {},
<del> httplib.responses[self.response[self.type]])
<add> return (self.response_map[self.type], body, {},
<add> httplib.responses[self.response_map[self.type]])
<ide>
<ide> def _v2_domains_testdomain_records_1234560(
<ide> self, method, url, body, headers):
<ide> body = self.fixtures.load(
<ide> '_v2_domains_testdomain_records_1234560.json')
<del> return (self.response[self.type], body, {},
<del> httplib.responses[self.response[self.type]])
<add> return (self.response_map[self.type], body, {},
<add> httplib.responses[self.response_map[self.type]])
<ide>
<ide> def _v2_domains_testdomain_records_1234561(
<ide> self, method, url, body, headers):
<ide> body = self.fixtures.load(
<ide> '_v2_domains_testdomain_records_1234561.json')
<del> return (self.response[self.type], body, {},
<del> httplib.responses[self.response[self.type]])
<add> return (self.response_map[self.type], body, {},
<add> httplib.responses[self.response_map[self.type]])
<ide>
<ide> def _v2_domains_testdomain_records_1234562(
<ide> self, method, url, body, headers):
<ide> body = self.fixtures.load(
<ide> '_v2_domains_testdomain_records_1234562.json')
<del> return (self.response[self.type], body, {},
<del> httplib.responses[self.response[self.type]])
<add> return (self.response_map[self.type], body, {},
<add> httplib.responses[self.response_map[self.type]])
<ide>
<ide> def _v2_domains_testdomain_records_1234563(
<ide> self, method, url, body, headers):
<ide> body = self.fixtures.load(
<ide> '_v2_domains_testdomain_records_1234563.json')
<del> return (self.response[self.type], body, {},
<del> httplib.responses[self.response[self.type]])
<add> return (self.response_map[self.type], body, {},
<add> httplib.responses[self.response_map[self.type]])
<ide>
<ide> def _v2_domains_testdomain_records_1234564(
<ide> self, method, url, body, headers):
<ide> body = self.fixtures.load(
<ide> '_v2_domains_testdomain_records_1234564.json')
<del> return (self.response[self.type], body, {},
<del> httplib.responses[self.response[self.type]])
<add> return (self.response_map[self.type], body, {},
<add> httplib.responses[self.response_map[self.type]])
<ide>
<ide> def _v2_domains_testdomain_records_1234564_DELETE(
<ide> self, method, url, body, headers):
<ide> self.type = 'DELETE'
<del> return (self.response[self.type], body, {},
<del> httplib.responses[self.response[self.type]])
<add> return (self.response_map[self.type], body, {},
<add> httplib.responses[self.response_map[self.type]])
<ide>
<ide> def _v2_domains_testdomain_records_1234564_NOT_FOUND(
<ide> self, method, url, body, headers):
<ide> body = self.fixtures.load(
<ide> '_v2_domains_testdomain_records_1234564_NOT_FOUND.json')
<del> return (self.response[self.type], body, {},
<del> httplib.responses[self.response[self.type]])
<add> return (self.response_map[self.type], body, {},
<add> httplib.responses[self.response_map[self.type]])
<ide>
<ide> def _v2_domains_testdomain_records_1234564_UPDATE(
<ide> self, method, url, body, headers):
<ide> body = self.fixtures.load(
<ide> '_v2_domains_testdomain_records_1234564_UPDATE.json')
<del> return (self.response[self.type], body, {},
<del> httplib.responses[self.response[self.type]])
<add> return (self.response_map[self.type], body, {},
<add> httplib.responses[self.response_map[self.type]])
<ide>
<ide> if __name__ == '__main__':
<ide> sys.exit(unittest.main()) | 3 |
Go | Go | return device id in error message | 39bdf601f6bea3c189d8e189e13c7e48b6f66b43 | <ide><path>daemon/graphdriver/devmapper/driver.go
<ide> func (d *Driver) Remove(id string) error {
<ide>
<ide> // This assumes the device has been properly Get/Put:ed and thus is unmounted
<ide> if err := d.DeviceSet.DeleteDevice(id, false); err != nil {
<del> return err
<add> return fmt.Errorf("failed to remove device %v:%v", id, err)
<ide> }
<ide>
<ide> mp := path.Join(d.home, "mnt", id) | 1 |
Python | Python | add constraint to ensure task map length >= 0 | 80f30ee589f0ccbeaae5568976b40917ffd66d7f | <ide><path>airflow/migrations/versions/e655c0453f75_add_taskmap_and_map_id_on_taskinstance.py
<ide> """
<ide>
<ide> from alembic import op
<del>from sqlalchemy import Column, ForeignKeyConstraint, Integer, text
<add>from sqlalchemy import CheckConstraint, Column, ForeignKeyConstraint, Integer, text
<ide>
<ide> from airflow.models.base import StringID
<ide> from airflow.utils.sqlalchemy import ExtendedJSON
<ide> def upgrade():
<ide> Column("map_index", Integer, primary_key=True),
<ide> Column("length", Integer, nullable=False),
<ide> Column("keys", ExtendedJSON, nullable=True),
<add> CheckConstraint("length >= 0", name="task_map_length_not_negative"),
<ide> ForeignKeyConstraint(
<ide> ["dag_id", "task_id", "run_id", "map_index"],
<ide> [
<ide><path>airflow/models/taskmap.py
<ide> import enum
<ide> from typing import TYPE_CHECKING, Any, Collection, List, Optional
<ide>
<del>from sqlalchemy import Column, ForeignKeyConstraint, Integer, String
<add>from sqlalchemy import CheckConstraint, Column, ForeignKeyConstraint, Integer, String
<ide>
<ide> from airflow.models.base import COLLATION_ARGS, ID_LEN, Base
<ide> from airflow.utils.sqlalchemy import ExtendedJSON
<ide> class TaskMap(Base):
<ide> keys = Column(ExtendedJSON, nullable=True)
<ide>
<ide> __table_args__ = (
<add> CheckConstraint(length >= 0, name="task_map_length_not_negative"),
<ide> ForeignKeyConstraint(
<ide> [dag_id, task_id, run_id, map_index],
<ide> [ | 2 |
Text | Text | add another useful link for beginners | 36886e63180231ed405e0ea69a9dd5335400b6ef | <ide><path>guide/english/mathematics/intro-to-logarithms/index.md
<ide> math.log(100, 10) #outputs 2
<ide> math.log(2, 2) #outputs 1
<ide> ```
<ide>
<del>
<del>#### Sources:
<del><!-- Please add any articles you think might be helpful to read before writing the article -->
<del>* https://betterexplained.com/articles/using-logs-in-the-real-world/
<del>* https://www.khanacademy.org/math/algebra2/exponential-and-logarithmic-functions/introduction-to-logarithms/a/intro-to-logarithms
<del>
<del>
<ide> ### Definition of logarithm
<ide>
<ide> The logarithm of a number __x__, written _log(__x__)_, usually means the number you have to use as power over 10 to get __x__. Let's say you wanna find _log(10)_. This means you wanna find the number you have to raise 10 to to get 10. This gives us an equation:
<ide> _ln(e) = 1_, instead of _log(10) = 1_.
<ide> So, we are instead finding the power you need to raise _e_ to in _ln(__x__)_.
<ide>
<ide>
<del>
<add>#### More Information
<add><!-- Please add any articles you think might be helpful to read before writing the article -->
<add>* https://betterexplained.com/articles/using-logs-in-the-real-world/
<add>* https://www.khanacademy.org/math/algebra2/exponential-and-logarithmic-functions/introduction-to-logarithms/a/intro-to-logarithms
<add>* https://mathinsight.org/logarithm_basics | 1 |
Java | Java | set error status in observation servlet filter | 1960666765a6bf93500f3bf8f2eeb29e428b68e9 | <ide><path>spring-web/src/main/java/org/springframework/web/filter/ServerHttpObservationFilter.java
<ide> import jakarta.servlet.http.HttpServletRequest;
<ide> import jakarta.servlet.http.HttpServletResponse;
<ide>
<add>import org.springframework.http.HttpStatus;
<ide> import org.springframework.http.server.observation.DefaultServerRequestObservationConvention;
<ide> import org.springframework.http.server.observation.ServerHttpObservationDocumentation;
<ide> import org.springframework.http.server.observation.ServerRequestObservationContext;
<ide> protected void doFilterInternal(HttpServletRequest request, HttpServletResponse
<ide> filterChain.doFilter(request, response);
<ide> }
<ide> catch (Exception ex) {
<del> observation.error(unwrapServletException(ex)).stop();
<add> observation.error(unwrapServletException(ex));
<add> response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
<ide> throw ex;
<ide> }
<ide> finally {
<ide><path>spring-web/src/test/java/org/springframework/web/filter/ServerHttpObservationFilterTests.java
<ide> void filterShouldUnwrapServletException() {
<ide> ServerRequestObservationContext context = (ServerRequestObservationContext) this.request
<ide> .getAttribute(ServerHttpObservationFilter.CURRENT_OBSERVATION_CONTEXT_ATTRIBUTE);
<ide> assertThat(context.getError()).isEqualTo(customError);
<del> assertThatHttpObservation().hasLowCardinalityKeyValue("outcome", "SUCCESS");
<add> assertThatHttpObservation().hasLowCardinalityKeyValue("outcome", "SERVER_ERROR");
<add> }
<add>
<add> @Test
<add> void filterShouldSetDefaultErrorStatusForBubblingExceptions() {
<add> assertThatThrownBy(() -> {
<add> this.filter.doFilter(this.request, this.response, (request, response) -> {
<add> throw new ServletException(new IllegalArgumentException("custom error"));
<add> });
<add> }).isInstanceOf(ServletException.class);
<add> assertThatHttpObservation().hasLowCardinalityKeyValue("outcome", "SERVER_ERROR")
<add> .hasLowCardinalityKeyValue("status", "500");
<ide> }
<ide>
<ide> private TestObservationRegistryAssert.TestObservationRegistryAssertReturningObservationContextAssert assertThatHttpObservation() { | 2 |
Python | Python | fix bug in np.insert when axis=-1 | cb6fe848bf1a6a046fd473b72b1350ea40c8644e | <ide><path>numpy/lib/function_base.py
<ide> def insert(arr, obj, values, axis=None):
<ide> # broadcasting is very different here, since a[:,0,:] = ... behaves
<ide> # very different from a[:,[0],:] = ...! This changes values so that
<ide> # it works likes the second case. (here a[:,0:1,:])
<del> values = np.rollaxis(values, 0, axis+1)
<add> values = np.rollaxis(values, 0, axis % ndim + 1)
<ide> numnew = values.shape[axis]
<ide> newshape[axis] += numnew
<ide> new = empty(newshape, arr.dtype, arr.flags.fnc) | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.