content_type
stringclasses 8
values | main_lang
stringclasses 7
values | message
stringlengths 1
50
| sha
stringlengths 40
40
| patch
stringlengths 52
962k
| file_count
int64 1
300
|
---|---|---|---|---|---|
Ruby | Ruby | return self from #distinct so it's chainable | acdd8e4f08e230926a7174903cf905e8a415a1d4 | <ide><path>lib/arel/select_manager.rb
<ide> def distinct(value = true)
<ide> else
<ide> @ctx.set_quantifier = nil
<ide> end
<add> self
<ide> end
<ide>
<ide> def order *expr
<ide><path>test/test_select_manager.rb
<ide> def test_manager_stores_bind_values
<ide> manager.distinct(false)
<ide> manager.ast.cores.last.set_quantifier.must_equal nil
<ide> end
<add>
<add> it "chains" do
<add> manager = Arel::SelectManager.new Table.engine
<add> manager.distinct.must_equal manager
<add> manager.distinct(false).must_equal manager
<add> end
<ide> end
<ide> end
<ide> end | 2 |
Ruby | Ruby | remove unnecessary puts | ceca0c34fa99e2e7a7c697cdd8b6284de7fa9cf4 | <ide><path>railties/test/railties/engine_test.rb
<ide> def new
<ide>
<ide> env = Rack::MockRequest.env_for("/bukkits/posts/new")
<ide> response = AppTemplate::Application.call(env)
<del> p rack_body(response[2])
<ide> assert rack_body(response[2]) =~ /name="post\[title\]"/
<ide> end
<ide> | 1 |
Javascript | Javascript | use fixture files | 32482baeaa617ff7feb90aec5147782bbff15bb3 | <ide><path>node-tests/blueprints/component-test.js
<ide> var chai = require('ember-cli-blueprint-test-helpers/chai');
<ide> var expect = chai.expect;
<ide>
<ide> var generateFakePackageManifest = require('../helpers/generate-fake-package-manifest');
<add>var fixture = require('../helpers/file');
<ide>
<ide> describe('Acceptance: ember generate component', function() {
<ide> setupTestHooks(this);
<ide> describe('Acceptance: ember generate component', function() {
<ide> return emberNew()
<ide> .then(() => emberGenerateDestroy(args, _file => {
<ide> expect(_file('tests/integration/components/x-foo-test.js'))
<del> .to.contain("import { moduleForComponent, test } from 'ember-qunit';")
<del> .to.contain("import hbs from 'htmlbars-inline-precompile';")
<del> .to.contain("moduleForComponent('x-foo'")
<del> .to.contain("integration: true")
<del> .to.contain("{{x-foo}}")
<del> .to.contain("{{#x-foo}}");
<add> .to.equal(fixture('component-test/default.js'));
<ide> }));
<ide> });
<ide>
<ide> describe('Acceptance: ember generate component', function() {
<ide> return emberNew()
<ide> .then(() => emberGenerateDestroy(args, _file => {
<ide> expect(_file('tests/unit/components/x-foo-test.js'))
<del> .to.contain("import { moduleForComponent, test } from 'ember-qunit';")
<del> .to.contain("moduleForComponent('x-foo'")
<del> .to.contain("unit: true");
<add> .to.equal(fixture('component-test/unit.js'));
<ide> }));
<ide> });
<ide>
<ide> describe('Acceptance: ember generate component', function() {
<ide> .then(() => generateFakePackageManifest('ember-cli-mocha', '0.11.0'))
<ide> .then(() => emberGenerateDestroy(args, _file => {
<ide> expect(_file('tests/integration/components/x-foo-test.js'))
<del> .to.contain("import { describeComponent, it } from 'ember-mocha';")
<del> .to.contain("import hbs from 'htmlbars-inline-precompile';")
<del> .to.contain("describeComponent('x-foo', 'Integration | Component | x foo'")
<del> .to.contain("integration: true")
<del> .to.contain("{{x-foo}}")
<del> .to.contain("{{#x-foo}}");
<add> .to.equal(fixture('component-test/mocha.js'));
<ide> }));
<ide> });
<ide>
<ide> describe('Acceptance: ember generate component', function() {
<ide> .then(() => generateFakePackageManifest('ember-cli-mocha', '0.11.0'))
<ide> .then(() => emberGenerateDestroy(args, _file => {
<ide> expect(_file('tests/unit/components/x-foo-test.js'))
<del> .to.contain("import { describeComponent, it } from 'ember-mocha';")
<del> .to.contain("describeComponent('x-foo', 'Unit | Component | x foo")
<del> .to.contain("unit: true");
<add> .to.equal(fixture('component-test/mocha-unit.js'));
<ide> }));
<ide> });
<ide>
<ide> describe('Acceptance: ember generate component', function() {
<ide> .then(() => generateFakePackageManifest('ember-cli-mocha', '0.12.0'))
<ide> .then(() => emberGenerateDestroy(args, _file => {
<ide> expect(_file('tests/integration/components/x-foo-test.js'))
<del> .to.contain("import { describe, it } from 'mocha';")
<del> .to.contain("import { setupComponentTest } from 'ember-mocha';")
<del> .to.contain("import hbs from 'htmlbars-inline-precompile';")
<del> .to.contain("describe('Integration | Component | x foo'")
<del> .to.contain("setupComponentTest('x-foo',")
<del> .to.contain("integration: true")
<del> .to.contain("{{x-foo}}")
<del> .to.contain("{{#x-foo}}");
<add> .to.equal(fixture('component-test/mocha-0.12.js'));
<ide> }));
<ide> });
<ide>
<ide> describe('Acceptance: ember generate component', function() {
<ide> .then(() => generateFakePackageManifest('ember-cli-mocha', '0.12.0'))
<ide> .then(() => emberGenerateDestroy(args, _file => {
<ide> expect(_file('tests/unit/components/x-foo-test.js'))
<del> .to.contain("import { describe, it } from 'mocha';")
<del> .to.contain("import { setupComponentTest } from 'ember-mocha';")
<del> .to.contain("describe('Unit | Component | x foo'")
<del> .to.contain("setupComponentTest('x-foo',")
<del> .to.contain("unit: true");
<add> .to.equal(fixture('component-test/mocha-0.12-unit.js'));
<ide> }));
<ide> });
<ide> });
<ide><path>node-tests/fixtures/component-test/default.js
<add>import { moduleForComponent, test } from 'ember-qunit';
<add>import hbs from 'htmlbars-inline-precompile';
<add>
<add>moduleForComponent('x-foo', 'Integration | Component | x foo', {
<add> integration: true
<add>});
<add>
<add>test('it renders', function(assert) {
<add> // Set any properties with this.set('myProperty', 'value');
<add> // Handle any actions with this.on('myAction', function(val) { ... });
<add>
<add> this.render(hbs`{{x-foo}}`);
<add>
<add> assert.equal(this.$().text().trim(), '');
<add>
<add> // Template block usage:
<add> this.render(hbs`
<add> {{#x-foo}}
<add> template block text
<add> {{/x-foo}}
<add> `);
<add>
<add> assert.equal(this.$().text().trim(), 'template block text');
<add>});
<ide><path>node-tests/fixtures/component-test/mocha-0.12-unit.js
<add>import { expect } from 'chai';
<add>import { describe, it } from 'mocha';
<add>import { setupComponentTest } from 'ember-mocha';
<add>
<add>describe('Unit | Component | x foo', function() {
<add> setupComponentTest('x-foo', {
<add> // Specify the other units that are required for this test
<add> // needs: ['component:foo', 'helper:bar'],
<add> unit: true
<add> });
<add>
<add> it('renders', function() {
<add> // creates the component instance
<add> let component = this.subject();
<add> // renders the component on the page
<add> this.render();
<add> expect(component).to.be.ok;
<add> expect(this.$()).to.have.length(1);
<add> });
<add>});
<ide><path>node-tests/fixtures/component-test/mocha-0.12.js
<add>import { expect } from 'chai';
<add>import { describe, it } from 'mocha';
<add>import { setupComponentTest } from 'ember-mocha';
<add>import hbs from 'htmlbars-inline-precompile';
<add>
<add>describe('Integration | Component | x foo', function() {
<add> setupComponentTest('x-foo', {
<add> integration: true
<add> });
<add>
<add> it('renders', function() {
<add> // Set any properties with this.set('myProperty', 'value');
<add> // Handle any actions with this.on('myAction', function(val) { ... });
<add> // Template block usage:
<add> // this.render(hbs`
<add> // {{#x-foo}}
<add> // template content
<add> // {{/x-foo}}
<add> // `);
<add>
<add> this.render(hbs`{{x-foo}}`);
<add> expect(this.$()).to.have.length(1);
<add> });
<add>});
<ide><path>node-tests/fixtures/component-test/mocha-unit.js
<add>import { expect } from 'chai';
<add>import { describeComponent, it } from 'ember-mocha';
<add>
<add>describeComponent('x-foo', 'Unit | Component | x foo',
<add> {
<add> // Specify the other units that are required for this test
<add> // needs: ['component:foo', 'helper:bar'],
<add> unit: true
<add> },
<add> function() {
<add> it('renders', function() {
<add> // creates the component instance
<add> let component = this.subject();
<add> // renders the component on the page
<add> this.render();
<add> expect(component).to.be.ok;
<add> expect(this.$()).to.have.length(1);
<add> });
<add> }
<add>);
<ide><path>node-tests/fixtures/component-test/mocha.js
<add>import { expect } from 'chai';
<add>import { describeComponent, it } from 'ember-mocha';
<add>import hbs from 'htmlbars-inline-precompile';
<add>
<add>describeComponent('x-foo', 'Integration | Component | x foo',
<add> {
<add> integration: true
<add> },
<add> function() {
<add> it('renders', function() {
<add> // Set any properties with this.set('myProperty', 'value');
<add> // Handle any actions with this.on('myAction', function(val) { ... });
<add> // Template block usage:
<add> // this.render(hbs`
<add> // {{#x-foo}}
<add> // template content
<add> // {{/x-foo}}
<add> // `);
<add>
<add> this.render(hbs`{{x-foo}}`);
<add> expect(this.$()).to.have.length(1);
<add> });
<add> }
<add>);
<ide><path>node-tests/fixtures/component-test/unit.js
<add>import { moduleForComponent, test } from 'ember-qunit';
<add>
<add>moduleForComponent('x-foo', 'Unit | Component | x foo', {
<add> // Specify the other units that are required for this test
<add> // needs: ['component:foo', 'helper:bar'],
<add> unit: true
<add>});
<add>
<add>test('it renders', function(assert) {
<add>
<add> // Creates the component instance
<add> /*let component =*/ this.subject();
<add> // Renders the component to the page
<add> this.render();
<add> assert.equal(this.$().text().trim(), '');
<add>}); | 7 |
PHP | PHP | apply suggestions from code review | 15c2b20b5052a2f5978407d37600533913139c26 | <ide><path>tests/TestCase/Controller/ControllerTest.php
<ide> public function testRedirectBeforeRedirectListenerReturnResponse(): void
<ide> public function testReferer(): void
<ide> {
<ide> $request = new ServerRequest([
<del> 'environment' => ['HTTP_REFERER' => 'http://localhost/posts/index']
<add> 'environment' => ['HTTP_REFERER' => 'http://localhost/posts/index'],
<ide> ]);
<ide> $Controller = new Controller($request);
<ide> $result = $Controller->referer();
<ide> $this->assertSame('/posts/index', $result);
<ide>
<ide> $request = new ServerRequest([
<del> 'environment' => ['HTTP_REFERER' => 'http://localhost/posts/index']
<add> 'environment' => ['HTTP_REFERER' => 'http://localhost/posts/index'],
<ide> ]);
<ide> $Controller = new Controller($request);
<ide> $result = $Controller->referer(['controller' => 'posts', 'action' => 'index'], true);
<ide> public function testReferer(): void
<ide> ->getMock();
<ide>
<ide> $request = new ServerRequest([
<del> 'environment' => ['HTTP_REFERER' => 'http://localhost/posts/index']
<add> 'environment' => ['HTTP_REFERER' => 'http://localhost/posts/index'],
<ide> ]);
<ide> $Controller = new Controller($request);
<ide> $result = $Controller->referer(null, false); | 1 |
Javascript | Javascript | update proptypes for reactelement & reactnode | 770b579aa2f517f2a323234ccaa1445a0b7ca9cb | <ide><path>src/core/ReactPropTypes.js
<ide> var ReactElement = require('ReactElement');
<ide> var ReactPropTypeLocationNames = require('ReactPropTypeLocationNames');
<ide>
<add>var deprecated = require('deprecated');
<ide> var emptyFunction = require('emptyFunction');
<ide>
<ide> /**
<ide> var emptyFunction = require('emptyFunction');
<ide>
<ide> var ANONYMOUS = '<<anonymous>>';
<ide>
<add>var elementTypeChecker = createElementTypeChecker();
<add>var nodeTypeChecker = createNodeChecker();
<add>
<ide> var ReactPropTypes = {
<ide> array: createPrimitiveTypeChecker('array'),
<ide> bool: createPrimitiveTypeChecker('boolean'),
<ide> var ReactPropTypes = {
<ide>
<ide> any: createAnyTypeChecker(),
<ide> arrayOf: createArrayOfTypeChecker,
<del> component: createComponentTypeChecker(),
<add> element: elementTypeChecker,
<ide> instanceOf: createInstanceTypeChecker,
<add> node: nodeTypeChecker,
<ide> objectOf: createObjectOfTypeChecker,
<ide> oneOf: createEnumTypeChecker,
<ide> oneOfType: createUnionTypeChecker,
<del> renderable: createRenderableTypeChecker(),
<del> shape: createShapeTypeChecker
<add> shape: createShapeTypeChecker,
<add>
<add> component: deprecated(
<add> 'React.PropTypes',
<add> 'component',
<add> 'element',
<add> this,
<add> elementTypeChecker
<add> ),
<add> renderable: deprecated(
<add> 'React.PropTypes',
<add> 'renderable',
<add> 'node',
<add> this,
<add> nodeTypeChecker
<add> )
<ide> };
<ide>
<ide> function createChainableTypeChecker(validate) {
<ide> function createArrayOfTypeChecker(typeChecker) {
<ide> return createChainableTypeChecker(validate);
<ide> }
<ide>
<del>function createComponentTypeChecker() {
<add>function createElementTypeChecker() {
<ide> function validate(props, propName, componentName, location) {
<ide> if (!ReactElement.isValidElement(props[propName])) {
<ide> var locationName = ReactPropTypeLocationNames[location];
<ide> return new Error(
<ide> `Invalid ${locationName} \`${propName}\` supplied to ` +
<del> `\`${componentName}\`, expected a React component.`
<add> `\`${componentName}\`, expected a ReactElement.`
<ide> );
<ide> }
<ide> }
<ide> function createUnionTypeChecker(arrayOfTypeCheckers) {
<ide> return createChainableTypeChecker(validate);
<ide> }
<ide>
<del>function createRenderableTypeChecker() {
<add>function createNodeChecker() {
<ide> function validate(props, propName, componentName, location) {
<del> if (!isRenderable(props[propName])) {
<add> if (!isNode(props[propName])) {
<ide> var locationName = ReactPropTypeLocationNames[location];
<ide> return new Error(
<ide> `Invalid ${locationName} \`${propName}\` supplied to ` +
<del> `\`${componentName}\`, expected a renderable prop.`
<add> `\`${componentName}\`, expected a ReactNode.`
<ide> );
<ide> }
<ide> }
<ide> function createShapeTypeChecker(shapeTypes) {
<ide> return createChainableTypeChecker(validate, 'expected `object`');
<ide> }
<ide>
<del>function isRenderable(propValue) {
<add>function isNode(propValue) {
<ide> switch(typeof propValue) {
<del> // TODO: this was probably written with the assumption that we're not
<del> // returning `this.props.component` directly from `render`. This is
<del> // currently not supported but we should, to make it consistent.
<ide> case 'number':
<ide> case 'string':
<ide> return true;
<ide> case 'boolean':
<ide> return !propValue;
<ide> case 'object':
<ide> if (Array.isArray(propValue)) {
<del> return propValue.every(isRenderable);
<add> return propValue.every(isNode);
<ide> }
<ide> if (ReactElement.isValidElement(propValue)) {
<ide> return true;
<ide> }
<ide> for (var k in propValue) {
<del> if (!isRenderable(propValue[k])) {
<add> if (!isNode(propValue[k])) {
<ide> return false;
<ide> }
<ide> }
<ide><path>src/core/__tests__/ReactPropTypes-test.js
<ide> describe('ReactPropTypes', function() {
<ide> beforeEach(function() {
<ide> Component = React.createClass({
<ide> propTypes: {
<del> label: PropTypes.component.isRequired
<add> label: PropTypes.element.isRequired
<ide> },
<ide>
<ide> render: function() {
<ide> describe('ReactPropTypes', function() {
<ide> });
<ide>
<ide> it('should support components', () => {
<del> typeCheckPass(PropTypes.component, <div />);
<add> typeCheckPass(PropTypes.element, <div />);
<ide> });
<ide>
<ide> it('should not support multiple components or scalar values', () => {
<ide> var message = 'Invalid prop `testProp` supplied to `testComponent`, ' +
<del> 'expected a React component.';
<del> typeCheckFail(PropTypes.component, [<div />, <div />], message);
<del> typeCheckFail(PropTypes.component, 123, message);
<del> typeCheckFail(PropTypes.component, 'foo', message);
<del> typeCheckFail(PropTypes.component, false, message);
<add> 'expected a ReactElement.';
<add> typeCheckFail(PropTypes.element, [<div />, <div />], message);
<add> typeCheckFail(PropTypes.element, 123, message);
<add> typeCheckFail(PropTypes.element, 'foo', message);
<add> typeCheckFail(PropTypes.element, false, message);
<ide> });
<ide>
<ide> it('should be able to define a single child as label', () => {
<ide> describe('ReactPropTypes', function() {
<ide> });
<ide>
<ide> it("should be implicitly optional and not warn without values", function() {
<del> typeCheckPass(PropTypes.component, null);
<del> typeCheckPass(PropTypes.component, undefined);
<add> typeCheckPass(PropTypes.element, null);
<add> typeCheckPass(PropTypes.element, undefined);
<ide> });
<ide>
<ide> it("should warn for missing required values", function() {
<del> typeCheckFail(PropTypes.component.isRequired, null, requiredMessage);
<del> typeCheckFail(PropTypes.component.isRequired, undefined, requiredMessage);
<add> typeCheckFail(PropTypes.element.isRequired, null, requiredMessage);
<add> typeCheckFail(PropTypes.element.isRequired, undefined, requiredMessage);
<ide> });
<ide> });
<ide>
<ide> describe('ReactPropTypes', function() {
<ide>
<ide> it('should warn for invalid values', function() {
<ide> var failMessage = 'Invalid prop `testProp` supplied to ' +
<del> '`testComponent`, expected a renderable prop.';
<del> typeCheckFail(PropTypes.renderable, true, failMessage);
<del> typeCheckFail(PropTypes.renderable, function() {}, failMessage);
<del> typeCheckFail(PropTypes.renderable, {key: function() {}}, failMessage);
<add> '`testComponent`, expected a ReactNode.';
<add> typeCheckFail(PropTypes.node, true, failMessage);
<add> typeCheckFail(PropTypes.node, function() {}, failMessage);
<add> typeCheckFail(PropTypes.node, {key: function() {}}, failMessage);
<ide> });
<ide>
<ide> it('should not warn for valid values', function() {
<del> typeCheckPass(PropTypes.renderable, <div />);
<del> typeCheckPass(PropTypes.renderable, false);
<del> typeCheckPass(PropTypes.renderable, <MyComponent />);
<del> typeCheckPass(PropTypes.renderable, 'Some string');
<del> typeCheckPass(PropTypes.renderable, []);
<del> typeCheckPass(PropTypes.renderable, {});
<del> typeCheckPass(PropTypes.renderable, [
<add> typeCheckPass(PropTypes.node, <div />);
<add> typeCheckPass(PropTypes.node, false);
<add> typeCheckPass(PropTypes.node, <MyComponent />);
<add> typeCheckPass(PropTypes.node, 'Some string');
<add> typeCheckPass(PropTypes.node, []);
<add> typeCheckPass(PropTypes.node, {});
<add>
<add> typeCheckPass(PropTypes.node, [
<ide> 123,
<ide> 'Some string',
<ide> <div />,
<ide> describe('ReactPropTypes', function() {
<ide> ]);
<ide>
<ide> // Object of rendereable things
<del> typeCheckPass(PropTypes.renderable, {
<add> typeCheckPass(PropTypes.node, {
<ide> k0: 123,
<ide> k1: 'Some string',
<ide> k2: <div />,
<ide> describe('ReactPropTypes', function() {
<ide> });
<ide>
<ide> it('should not warn for null/undefined if not required', function() {
<del> typeCheckPass(PropTypes.renderable, null);
<del> typeCheckPass(PropTypes.renderable, undefined);
<add> typeCheckPass(PropTypes.node, null);
<add> typeCheckPass(PropTypes.node, undefined);
<ide> });
<ide>
<ide> it('should warn for missing required values', function() {
<ide> typeCheckFail(
<del> PropTypes.renderable.isRequired,
<add> PropTypes.node.isRequired,
<ide> null,
<ide> 'Required prop `testProp` was not specified in `testComponent`.'
<ide> );
<ide> typeCheckFail(
<del> PropTypes.renderable.isRequired,
<add> PropTypes.node.isRequired,
<ide> undefined,
<ide> 'Required prop `testProp` was not specified in `testComponent`.'
<ide> );
<ide> });
<ide>
<del> it('should accept empty array & object for required props', function() {
<add> it('should accept empty array for required props', function() {
<add> typeCheckPass(PropTypes.node.isRequired, []);
<add> });
<add>
<add> it('should still work for deprecated typechecks', function() {
<add> typeCheckPass(PropTypes.renderable, []);
<ide> typeCheckPass(PropTypes.renderable.isRequired, []);
<del> typeCheckPass(PropTypes.renderable.isRequired, {});
<ide> });
<ide> });
<ide>
<ide><path>src/utils/deprecated.js
<ide> function deprecated(namespace, oldName, newName, ctx, fn) {
<ide> return fn.apply(ctx, arguments);
<ide> };
<ide> newFn.displayName = `${namespace}_${oldName}`;
<del> return newFn;
<add> // We need to make sure all properties of the original fn are copied over.
<add> // In particular, this is needed to support PropTypes
<add> return Object.assign(newFn, fn);
<ide> }
<ide>
<ide> return fn; | 3 |
Javascript | Javascript | fix rendersubtreeintocontainer to update context | 25f9f4563edb0b0daa4687da0c75b3ae010e9816 | <ide><path>src/addons/__tests__/renderSubtreeIntoContainer-test.js
<ide> 'use strict';
<ide>
<ide> var React = require('React');
<add>var ReactDOM = require('ReactDOM');
<ide> var ReactTestUtils = require('ReactTestUtils');
<ide> var renderSubtreeIntoContainer = require('renderSubtreeIntoContainer');
<ide>
<ide> describe('renderSubtreeIntoContainer', function() {
<ide>
<ide> it('should pass context when rendering subtree elsewhere', function() {
<del>
<ide> var portal = document.createElement('div');
<ide>
<ide> var Component = React.createClass({
<ide> describe('renderSubtreeIntoContainer', function() {
<ide> },
<ide> });
<ide> });
<add>
<add> it('should update context if it changes due to setState', function() {
<add> var container = document.createElement('div');
<add> document.body.appendChild(container);
<add> var portal = document.createElement('div');
<add>
<add> var Component = React.createClass({
<add> contextTypes: {
<add> foo: React.PropTypes.string.isRequired,
<add> getFoo: React.PropTypes.func.isRequired,
<add> },
<add>
<add> render: function() {
<add> return <div>{this.context.foo + '-' + this.context.getFoo()}</div>;
<add> },
<add> });
<add>
<add> var Parent = React.createClass({
<add> childContextTypes: {
<add> foo: React.PropTypes.string.isRequired,
<add> getFoo: React.PropTypes.func.isRequired,
<add> },
<add>
<add> getChildContext: function() {
<add> return {
<add> foo: this.state.bar,
<add> getFoo: () => this.state.bar,
<add> };
<add> },
<add>
<add> getInitialState: function() {
<add> return {
<add> bar: 'initial',
<add> };
<add> },
<add>
<add> render: function() {
<add> return null;
<add> },
<add>
<add> componentDidMount: function() {
<add> renderSubtreeIntoContainer(this, <Component />, portal);
<add> },
<add>
<add> componentDidUpdate() {
<add> renderSubtreeIntoContainer(this, <Component />, portal);
<add> },
<add> });
<add>
<add> var instance = ReactDOM.render(<Parent />, container);
<add> expect(portal.firstChild.innerHTML).toBe('initial-initial');
<add> instance.setState({bar: 'changed'});
<add> expect(portal.firstChild.innerHTML).toBe('changed-changed');
<add> });
<add>
<add> it('should update context if it changes due to re-render', function() {
<add> var container = document.createElement('div');
<add> document.body.appendChild(container);
<add> var portal = document.createElement('div');
<add>
<add> var Component = React.createClass({
<add> contextTypes: {
<add> foo: React.PropTypes.string.isRequired,
<add> getFoo: React.PropTypes.func.isRequired,
<add> },
<add>
<add> render: function() {
<add> return <div>{this.context.foo + '-' + this.context.getFoo()}</div>;
<add> },
<add> });
<add>
<add> var Parent = React.createClass({
<add> childContextTypes: {
<add> foo: React.PropTypes.string.isRequired,
<add> getFoo: React.PropTypes.func.isRequired,
<add> },
<add>
<add> getChildContext: function() {
<add> return {
<add> foo: this.props.bar,
<add> getFoo: () => this.props.bar,
<add> };
<add> },
<add>
<add> render: function() {
<add> return null;
<add> },
<add>
<add> componentDidMount: function() {
<add> renderSubtreeIntoContainer(this, <Component />, portal);
<add> },
<add>
<add> componentDidUpdate() {
<add> renderSubtreeIntoContainer(this, <Component />, portal);
<add> },
<add> });
<add>
<add> ReactDOM.render(<Parent bar="initial" />, container);
<add> expect(portal.firstChild.innerHTML).toBe('initial-initial');
<add> ReactDOM.render(<Parent bar="changed" />, container);
<add> expect(portal.firstChild.innerHTML).toBe('changed-changed');
<add> });
<add>
<ide> });
<ide><path>src/renderers/dom/client/ReactMount.js
<ide> var ReactDOMContainerInfo = require('ReactDOMContainerInfo');
<ide> var ReactDOMFeatureFlags = require('ReactDOMFeatureFlags');
<ide> var ReactElement = require('ReactElement');
<ide> var ReactFeatureFlags = require('ReactFeatureFlags');
<add>var ReactInstanceMap = require('ReactInstanceMap');
<ide> var ReactInstrumentation = require('ReactInstrumentation');
<ide> var ReactMarkupChecksum = require('ReactMarkupChecksum');
<ide> var ReactReconciler = require('ReactReconciler');
<ide> var ReactMount = {
<ide> _updateRootComponent: function(
<ide> prevComponent,
<ide> nextElement,
<add> nextContext,
<ide> container,
<ide> callback) {
<ide> ReactMount.scrollMonitor(container, function() {
<del> ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement);
<add> ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement, nextContext);
<ide> if (callback) {
<ide> ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback);
<ide> }
<ide> var ReactMount = {
<ide> */
<ide> renderSubtreeIntoContainer: function(parentComponent, nextElement, container, callback) {
<ide> invariant(
<del> parentComponent != null && parentComponent._reactInternalInstance != null,
<add> parentComponent != null && ReactInstanceMap.has(parentComponent),
<ide> 'parentComponent must be a valid React Component'
<ide> );
<ide> return ReactMount._renderSubtreeIntoContainer(
<ide> var ReactMount = {
<ide> nextElement
<ide> );
<ide>
<add> var nextContext;
<add> if (parentComponent) {
<add> var parentInst = ReactInstanceMap.get(parentComponent);
<add> nextContext = parentInst._processChildContext(parentInst._context);
<add> } else {
<add> nextContext = emptyObject;
<add> }
<add>
<ide> var prevComponent = getTopLevelWrapperInContainer(container);
<ide>
<ide> if (prevComponent) {
<ide> var ReactMount = {
<ide> ReactMount._updateRootComponent(
<ide> prevComponent,
<ide> nextWrappedElement,
<add> nextContext,
<ide> container,
<ide> updatedCallback
<ide> );
<ide> var ReactMount = {
<ide> nextWrappedElement,
<ide> container,
<ide> shouldReuseMarkup,
<del> parentComponent != null ?
<del> parentComponent._reactInternalInstance._processChildContext(
<del> parentComponent._reactInternalInstance._context
<del> ) :
<del> emptyObject
<add> nextContext
<ide> )._renderedComponent.getPublicInstance();
<ide> if (callback) {
<ide> callback.call(component);
<ide><path>src/renderers/native/ReactNativeMount.js
<ide> var ReactNativeMount = {
<ide> var prevWrappedElement = prevComponent._currentElement;
<ide> var prevElement = prevWrappedElement.props;
<ide> if (shouldUpdateReactComponent(prevElement, nextElement)) {
<del> ReactUpdateQueue.enqueueElementInternal(prevComponent, nextWrappedElement);
<add> ReactUpdateQueue.enqueueElementInternal(prevComponent, nextWrappedElement, emptyObject);
<ide> if (callback) {
<ide> ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback);
<ide> }
<ide><path>src/renderers/shared/stack/reconciler/ReactUpdateQueue.js
<ide> var ReactUpdateQueue = {
<ide> enqueueUpdate(internalInstance);
<ide> },
<ide>
<del> enqueueElementInternal: function(internalInstance, newElement) {
<del> internalInstance._pendingElement = newElement;
<add> enqueueElementInternal: function(internalInstance, nextElement, nextContext) {
<add> internalInstance._pendingElement = nextElement;
<add> // TODO: introduce _pendingContext instead of setting it directly.
<add> internalInstance._context = nextContext;
<ide> enqueueUpdate(internalInstance);
<ide> },
<ide> | 4 |
Python | Python | fix typo in documentation | 7b0a05f5013f03b4897e3aac462352fa6b0e26c6 | <ide><path>keras/layers/preprocessing/text_vectorization.py
<ide> def vocabulary_size(self):
<ide> """Gets the current size of the layer's vocabulary.
<ide>
<ide> Returns:
<del> The integer size of the voculary, including optional mask and oov indices.
<add> The integer size of the vocabulary, including optional mask and oov indices.
<ide> """
<ide> return self._lookup_layer.vocabulary_size()
<ide> | 1 |
Go | Go | remove unused constants and fields (unused) | d9483062555ec7021da786c3af5dc9eedaf8f8b3 | <ide><path>integration/container/create_test.go
<ide> func TestCreateWithCustomReadonlyPaths(t *testing.T) {
<ide> ctx := context.Background()
<ide>
<ide> testCases := []struct {
<del> doc string
<ide> readonlyPaths []string
<ide> expected []string
<ide> }{
<ide><path>integration/image/remove_unix_test.go
<ide> func TestRemoveImageGarbageCollector(t *testing.T) {
<ide>
<ide> // Run imageService.Cleanup() and make sure that layer was removed from disk
<ide> i.Cleanup()
<del> dir, err = os.Stat(data["UpperDir"])
<del> assert.ErrorContains(t, err, "no such file or directory")
<add> _, err = os.Stat(data["UpperDir"])
<add> assert.Assert(t, os.IsNotExist(err))
<ide> }
<ide><path>integration/plugin/graphdriver/main_test.go
<ide> func init() {
<ide> reexec.Init() // This is required for external graphdriver tests
<ide> }
<ide>
<del>const dockerdBinary = "dockerd"
<del>
<ide> func TestMain(m *testing.M) {
<ide> var err error
<ide> testEnv, err = environment.New() | 3 |
Javascript | Javascript | modify tests for russian locale | c2d97c5a78023d8abb357b64fc87acd90c37c5bd | <ide><path>test/locale/ru.js
<ide> exports['locale:ru'] = {
<ide> },
<ide>
<ide> 'calendar last week' : function (test) {
<del> var i, m;
<add> var i, m, now;
<ide>
<del> function makeFormat(d) {
<add> function makeFormatLast(d) {
<ide> switch (d.day()) {
<ide> case 0:
<ide> return '[В прошлое] dddd [в] LT';
<ide> exports['locale:ru'] = {
<ide> }
<ide> }
<ide>
<add> function makeFormatThis(d) {
<add> switch (d.day()) {
<add> case 0:
<add> return '[В это] dddd [в] LT';
<add> case 1:
<add> case 2:
<add> case 4:
<add> return '[В этот] dddd [в] LT';
<add> case 3:
<add> case 5:
<add> case 6:
<add> return '[В эту] dddd [в] LT';
<add> }
<add> }
<add>
<add> now = moment().startOf('week');
<ide> for (i = 2; i < 7; i++) {
<del> m = moment().subtract({d: i});
<del> test.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days current time');
<add> m = moment(now).subtract({d: i});
<add> test.equal(m.calendar(now), m.format(makeFormatLast(m)), 'Today - ' + i + ' days current time');
<ide> m.hours(0).minutes(0).seconds(0).milliseconds(0);
<del> test.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days beginning of day');
<add> test.equal(m.calendar(now), m.format(makeFormatLast(m)), 'Today - ' + i + ' days beginning of day');
<ide> m.hours(23).minutes(59).seconds(59).milliseconds(999);
<del> test.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days end of day');
<add> test.equal(m.calendar(now), m.format(makeFormatLast(m)), 'Today - ' + i + ' days end of day');
<ide> }
<add>
<add> now = moment().endOf('week');
<add> for (i = 2; i < 7; i++) {
<add> m = moment(now).subtract({d: i});
<add> test.equal(m.calendar(now), m.format(makeFormatThis(m)), 'Today - ' + i + ' days current time');
<add> m.hours(0).minutes(0).seconds(0).milliseconds(0);
<add> test.equal(m.calendar(now), m.format(makeFormatThis(m)), 'Today - ' + i + ' days beginning of day');
<add> m.hours(23).minutes(59).seconds(59).milliseconds(999);
<add> test.equal(m.calendar(now), m.format(makeFormatThis(m)), 'Today - ' + i + ' days end of day');
<add> }
<add>
<ide> test.done();
<ide> },
<ide> | 1 |
Text | Text | remove tip on parse_query | b4f4de050010aef2982c46b1b878a6deb1318429 | <ide><path>guides/source/form_helpers.md
<ide> action for a Person model, `params[:person]` would usually be a hash of all the
<ide>
<ide> Fundamentally HTML forms don't know about any sort of structured data, all they generate is name-value pairs, where pairs are just plain strings. The arrays and hashes you see in your application are the result of some parameter naming conventions that Rails uses.
<ide>
<del>TIP: You may find you can try out examples in this section faster by using the console to directly invoke Rack's parameter parser. For example,
<del>
<del>```ruby
<del>Rack::Utils.parse_query "name=fred&phone=0123456789"
<del># => {"name"=>"fred", "phone"=>"0123456789"}
<del>```
<del>
<ide> ### Basic Structures
<ide>
<ide> The two basic structures are arrays and hashes. Hashes mirror the syntax used for accessing the value in `params`. For example, if a form contains: | 1 |
Javascript | Javascript | update lowlevel renderer | e3ccd9682678d1423ad1bba4120593db644f6f9d | <ide><path>src/renderers/webgl/renderer.js
<ide> THREE.WebGLRenderer2.LowLevelRenderer = function(parameters){
<ide> _clearColor = parameters.clearColor !== undefined ? new THREE.Color( parameters.clearColor ) : new THREE.Color( 0x000000 ),
<ide> _clearAlpha = parameters.clearAlpha !== undefined ? parameters.clearAlpha : 0;
<ide>
<add> var _currentWidth = 0,
<add> _currentHeight = 0;
<add>
<ide>
<ide> var _gl;
<ide>
<ide> THREE.WebGLRenderer2.LowLevelRenderer = function(parameters){
<ide>
<ide> initGL();
<ide>
<del> setDefaultGLState();
<del>
<del> this.context = _gl;
<del>
<del>
<add> setDefaultGLState();
<ide>
<ide> var _maxTextures = _gl.getParameter( _gl.MAX_TEXTURE_IMAGE_UNITS );
<ide> var _maxVertexTextures = _gl.getParameter( _gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS );
<ide> THREE.WebGLRenderer2.LowLevelRenderer = function(parameters){
<ide> _oldPolygonOffsetFactor = null,
<ide> _oldPolygonOffsetUnits = null,
<ide> _currentFramebuffer = null;
<del>
<del> this.autoScaleCubemaps = true;
<del> this.supportsBoneTextures = _supportsBoneTextures;
<del> this.precision = _precision;
<del> this.maxVertexUniformVectors = _gl.getParameter( _gl.MAX_VERTEX_UNIFORM_VECTORS );
<del>
<del> this.currentWidth = 0;
<del> this.currentHeight = 0;
<ide>
<ide> function initGL () {
<ide>
<ide> THREE.WebGLRenderer2.LowLevelRenderer = function(parameters){
<ide>
<ide> };
<ide>
<del> this.getContext = function () {
<add> function getContext() {
<ide>
<ide> return _gl;
<ide>
<ide> };
<del> this.getDomElement = function(){
<add> function getDomElement(){
<ide>
<ide> return _canvas;
<ide>
<ide> }
<ide>
<del> this.supportsVertexTextures = function () {
<add> function supportsVertexTextures() {
<ide>
<ide> return _supportsVertexTextures;
<ide>
<ide> };
<ide>
<del> this.getMaxAnisotropy = function () {
<add> function getMaxAnisotropy() {
<ide>
<ide> return _maxAnisotropy;
<ide>
<ide> };
<ide>
<del> this.setSize = function ( width, height ) {
<add> function setSize( width, height ) {
<ide>
<ide> _canvas.width = width;
<ide> _canvas.height = height;
<ide>
<del> this.setViewport( 0, 0, _canvas.width, _canvas.height );
<add> setViewport( 0, 0, _canvas.width, _canvas.height );
<ide>
<ide> };
<ide>
<del> this.setViewport = function ( x, y, width, height ) {
<add> function setViewport( x, y, width, height ) {
<ide>
<ide> _viewportX = x !== undefined ? x : 0;
<ide> _viewportY = y !== undefined ? y : 0;
<ide> THREE.WebGLRenderer2.LowLevelRenderer = function(parameters){
<ide>
<ide> };
<ide>
<del> this.setScissor = function ( x, y, width, height ) {
<add> function setScissor( x, y, width, height ) {
<ide>
<ide> _gl.scissor( x, y, width, height );
<ide>
<ide> };
<ide>
<del> this.enableScissorTest = function ( enable ) {
<add> function enableScissorTest( enable ) {
<ide>
<ide> enable ? _gl.enable( _gl.SCISSOR_TEST ) : _gl.disable( _gl.SCISSOR_TEST );
<ide>
<ide> };
<ide>
<ide> // Clearing
<ide>
<del> this.setClearColorHex = function ( hex, alpha ) {
<add> function setClearColorHex( hex, alpha ) {
<ide>
<ide> _clearColor.setHex( hex );
<ide> _clearAlpha = alpha;
<ide> THREE.WebGLRenderer2.LowLevelRenderer = function(parameters){
<ide>
<ide> };
<ide>
<del> this.setClearColor = function ( color, alpha ) {
<add> function setClearColor( color, alpha ) {
<ide>
<ide> _clearColor.copy( color );
<ide> _clearAlpha = alpha;
<ide> THREE.WebGLRenderer2.LowLevelRenderer = function(parameters){
<ide>
<ide> };
<ide>
<del> this.getClearColor = function () {
<add> function getClearColor() {
<ide>
<ide> return _clearColor;
<ide>
<ide> };
<ide>
<del> this.getClearAlpha = function () {
<add> function getClearAlpha() {
<ide>
<ide> return _clearAlpha;
<ide>
<ide> };
<ide>
<del> this.clear = function ( color, depth, stencil ) {
<add> function clear( color, depth, stencil ) {
<ide>
<ide> var bits = 0;
<ide>
<ide> THREE.WebGLRenderer2.LowLevelRenderer = function(parameters){
<ide>
<ide> };
<ide>
<del> this.clearTarget = function ( renderTarget, color, depth, stencil ) {
<add> function clearTarget( renderTarget, color, depth, stencil ) {
<ide>
<del> this.setRenderTarget( renderTarget );
<del> this.clear( color, depth, stencil );
<add> setRenderTarget( renderTarget );
<add> clear( color, depth, stencil );
<ide>
<ide> };
<ide>
<del> this.deleteBuffer = function(buffer){
<add> function deleteBuffer(buffer){
<ide> _gl.deleteBuffer(buffer);
<ide> };
<ide>
<del> this.deleteTexture = function(texture){
<add> function deleteTexture(texture){
<ide> _gl.deleteTexture( texture );
<ide> };
<ide>
<del> this.deleteFramebuffer = function(Framebuffer){
<add> function deleteFramebuffer(Framebuffer){
<ide> _gl.deleteFramebuffer(Framebuffer);
<ide> };
<ide>
<del> this.deleteRenderbuffer = function(RenderBuffer){
<add> function deleteRenderbuffer(RenderBuffer){
<ide> _gl.deleteRenderbuffer(RenderBuffer);
<ide> };
<ide>
<del> this.deleteProgram = function(RenderBuffer){
<add> function deleteProgram(RenderBuffer){
<ide> _gl.deleteProgram(RenderBuffer);
<ide> };
<ide>
<del> this.createBuffer = function(){
<add> function createBuffer(){
<ide> return _gl.createBuffer();
<ide> };
<ide>
<del> this.setStaticArrayBuffer = function(buffer,data){
<add> function setStaticArrayBuffer(buffer,data){
<ide>
<del> this.bindArrayBuffer( buffer );
<add> bindArrayBuffer( buffer );
<ide> _gl.bufferData( _gl.ARRAY_BUFFER, data, _gl.STATIC_DRAW );
<ide>
<ide> };
<ide>
<del> this.setStaticIndexBuffer = function(buffer,data){
<add> function setStaticIndexBuffer(buffer,data){
<ide>
<del> this.bindElementArrayBuffer( buffer );
<add> bindElementArrayBuffer( buffer );
<ide> _gl.bufferData( _gl.ELEMENT_ARRAY_BUFFER, data, _gl.STATIC_DRAW );
<ide>
<ide> };
<ide>
<del> this.setDynamicArrayBuffer = function(buffer,data){
<add> function setDynamicArrayBuffer(buffer,data){
<ide>
<del> this.bindArrayBuffer( buffer );
<add> bindArrayBuffer( buffer );
<ide> _gl.bufferData( _gl.ARRAY_BUFFER, data, _gl.DYNAMIC_DRAW );
<ide>
<ide> };
<ide>
<del> this.setDynamicIndexBuffer = function(buffer,data){
<add> function setDynamicIndexBuffer(buffer,data){
<ide>
<del> this.bindElementArrayBuffer( buffer );
<add> bindElementArrayBuffer( buffer );
<ide> _gl.bufferData( _gl.ELEMENT_ARRAY_BUFFER, data, _gl.DYNAMIC_DRAW );
<ide>
<ide> };
<ide>
<del> this.drawTriangles = function(count){
<add> function drawTriangles(count){
<ide> _gl.drawArrays( _gl.TRIANGLES, 0, count );
<ide> };
<ide>
<del> this.drawLines = function(count){
<add> function drawLines(count){
<ide> _gl.drawArrays( _gl.LINES, 0, count );
<ide> };
<ide>
<del> this.drawLineStrip = function(count){
<add> function drawLineStrip(count){
<ide> _gl.drawArrays( _gl.LINE_STRIP, 0, count );
<ide> };
<ide>
<del> this.drawPoints = function(count){
<add> function drawPoints(count){
<ide> _gl.drawArrays( _gl.POINTS, 0, count );
<ide> };
<ide>
<del> this.drawTriangleElements = function(buffer,count,offset){
<del> this.bindElementArrayBuffer( buffer );
<add> function drawTriangleElements(buffer,count,offset){
<add> bindElementArrayBuffer( buffer );
<ide> _gl.drawElements( _gl.TRIANGLES, count, _gl.UNSIGNED_SHORT, offset ); // 2 bytes per Uint16
<ide> };
<ide>
<del> this.drawLineElements = function(buffer,count,offset){
<del> this.bindElementArrayBuffer( buffer );
<add> function drawLineElements(buffer,count,offset){
<add> bindElementArrayBuffer( buffer );
<ide> _gl.drawElements( _gl.LINES, count, _gl.UNSIGNED_SHORT, offset ); // 2 bytes per Uint16
<ide> };
<ide>
<ide>
<del> var _boundBuffer =undefined;
<del> this.bindArrayBuffer = function(buffer){
<add> var _boundBuffer;
<add> function bindArrayBuffer(buffer){
<ide> if (_boundBuffer != buffer){
<ide> _gl.bindBuffer( _gl.ARRAY_BUFFER, buffer );
<ide> _boundBuffer = buffer;
<ide> }
<ide>
<ide> };
<ide>
<del> this.bindElementArrayBuffer = function(buffer){
<add> function bindElementArrayBuffer(buffer){
<ide>
<ide> if (_boundBuffer != buffer){
<ide> _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, buffer );
<ide> THREE.WebGLRenderer2.LowLevelRenderer = function(parameters){
<ide> };
<ide>
<ide>
<del> this.enableAttribute = function enableAttribute( attribute ) {
<add> function enableAttribute( attribute ) {
<ide>
<ide> if ( ! _enabledAttributes[ attribute ] ) {
<ide>
<ide> THREE.WebGLRenderer2.LowLevelRenderer = function(parameters){
<ide>
<ide>
<ide>
<del> this.disableAttributes = function disableAttributes() {
<add> function disableAttributes() {
<ide>
<ide> for ( var attribute in _enabledAttributes ) {
<ide>
<ide> THREE.WebGLRenderer2.LowLevelRenderer = function(parameters){
<ide>
<ide> };
<ide>
<del> this.getAttribLocation = function( program, id ){
<add> function getAttribLocation( program, id ){
<ide> return _gl.getAttribLocation( program, id );
<ide> }
<ide>
<del> this.setFloatAttribute = function(index,buffer,size,offset){
<add> function setFloatAttribute(index,buffer,size,offset){
<ide>
<del> this.bindArrayBuffer( buffer );
<del> this.enableAttribute( index );
<add> bindArrayBuffer( buffer );
<add> enableAttribute( index );
<ide> _gl.vertexAttribPointer( index, size, _gl.FLOAT, false, 0, offset );
<ide>
<ide> };
<ide>
<del> this.getUniformLocation= function( program, id ){
<add> function getUniformLocation( program, id ){
<ide>
<ide> return _gl.getUniformLocation( program, id );
<ide>
<ide> }
<ide>
<del> this.uniform1i = function(uniform,value){
<add> function uniform1i(uniform,value){
<ide>
<ide> _gl.uniform1i( uniform, value );
<ide>
<ide> };
<ide>
<del> this.uniform1f = function(uniform,value){
<add> function uniform1f(uniform,value){
<ide>
<ide> _gl.uniform1f( uniform, value );
<ide>
<ide> };
<ide>
<del> this.uniform2f = function(uniform,value1, value2){
<add> function uniform2f(uniform,value1, value2){
<ide>
<ide> _gl.uniform2f( location, value1, value2 );
<ide>
<ide> };
<ide>
<del> this.uniform3f = function(uniform, value1, value2, value3){
<add> function uniform3f(uniform, value1, value2, value3){
<ide>
<ide> _gl.uniform3f( uniform, value1, value2, value3 );
<ide>
<ide> };
<ide>
<del> this.uniform4f = function(uniform, value1, value2, value3, value4){
<add> function uniform4f(uniform, value1, value2, value3, value4){
<ide>
<ide> _gl.uniform4f( uniform, value1, value2, value3, value4);
<ide>
<ide> };
<ide>
<del> this.uniform1iv = function(uniform,value){
<add> function uniform1iv(uniform,value){
<ide>
<ide> _gl.uniform1iv( uniform, value );
<ide>
<ide> };
<ide>
<del> this.uniform2iv = function(uniform,value){
<add> function uniform2iv(uniform,value){
<ide>
<ide> _gl.uniform2iv( uniform, value );
<ide>
<ide> };
<ide>
<del> this.uniform3iv = function(uniform,value){
<add> function uniform3iv(uniform,value){
<ide>
<ide> _gl.uniform3iv( uniform, value );
<ide>
<ide> };
<ide>
<del> this.uniform1fv = function(uniform,value){
<add> function uniform1fv(uniform,value){
<ide>
<ide> _gl.uniform1fv( uniform, value );
<ide>
<ide> };
<ide>
<del> this.uniform2fv = function(uniform,value){
<add> function uniform2fv(uniform,value){
<ide>
<ide> _gl.uniform2fv( uniform, value );
<ide>
<ide> };
<ide>
<del> this.uniform3fv = function(uniform,value){
<add> function uniform3fv(uniform,value){
<ide>
<ide> _gl.uniform3fv( uniform, value );
<ide>
<ide> };
<ide>
<del> this.uniform4fv = function(uniform,value){
<add> function uniform4fv(uniform,value){
<ide>
<ide> _gl.uniform3fv( uniform, value );
<ide>
<ide> };
<ide>
<del> this.uniformMatrix3fv = function(location,value){
<add> function uniformMatrix3fv(location,value){
<ide>
<ide> _gl.uniformMatrix3fv( location, false, value );
<ide>
<ide> };
<ide>
<del> this.uniformMatrix4fv = function(location,value){
<add> function uniformMatrix4fv(location,value){
<ide>
<ide> _gl.uniformMatrix4fv( location, false, value );
<ide>
<ide> };
<ide>
<del> this.useProgram = function(program){
<add> function useProgram(program){
<ide>
<ide> _gl.useProgram( program );
<ide>
<ide> };
<ide>
<del> this.setFaceCulling = function ( cullFace, frontFace ) {
<del>
<del> if ( cullFace ) {
<add> function setFaceCulling( cullFace, frontFaceDirection ) {
<ide>
<del> if ( !frontFace || frontFace === "ccw" ) {
<add> if ( cullFace === THREE.CullFaceNone ) {
<ide>
<del> _gl.frontFace( _gl.CCW );
<add> _gl.disable( _gl.CULL_FACE );
<ide>
<del> } else {
<add> } else {
<add>
<add> if ( frontFaceDirection === THREE.FrontFaceDirectionCW ) {
<ide>
<ide> _gl.frontFace( _gl.CW );
<ide>
<add> } else {
<add>
<add> _gl.frontFace( _gl.CCW );
<add>
<ide> }
<ide>
<del> if( cullFace === "back" ) {
<add> if ( cullFace === THREE.CullFaceBack ) {
<ide>
<ide> _gl.cullFace( _gl.BACK );
<ide>
<del> } else if( cullFace === "front" ) {
<add> } else if ( cullFace === THREE.CullFaceFront ) {
<ide>
<ide> _gl.cullFace( _gl.FRONT );
<ide>
<ide> THREE.WebGLRenderer2.LowLevelRenderer = function(parameters){
<ide>
<ide> _gl.enable( _gl.CULL_FACE );
<ide>
<del> } else {
<del>
<del> _gl.disable( _gl.CULL_FACE );
<del>
<ide> }
<ide>
<ide> };
<ide>
<del> this.setMaterialFaces = function ( material ) {
<add> function setMaterialFaces( material ) {
<ide>
<ide> var doubleSided = material.side === THREE.DoubleSide;
<ide> var flipSided = material.side === THREE.BackSide;
<ide> THREE.WebGLRenderer2.LowLevelRenderer = function(parameters){
<ide>
<ide> };
<ide>
<del> this.setPolygonOffset = function setPolygonOffset ( polygonoffset, factor, units ) {
<add> function setPolygonOffset ( polygonoffset, factor, units ) {
<ide>
<ide> if ( _oldPolygonOffset !== polygonoffset ) {
<ide>
<ide> THREE.WebGLRenderer2.LowLevelRenderer = function(parameters){
<ide>
<ide> };
<ide>
<del>
<del>
<del>
<del> this.setBlending = function ( blending, blendEquation, blendSrc, blendDst ) {
<add> function setBlending( blending, blendEquation, blendSrc, blendDst ) {
<ide>
<ide> if ( blending !== _oldBlending ) {
<ide>
<ide> THREE.WebGLRenderer2.LowLevelRenderer = function(parameters){
<ide>
<ide>
<ide>
<del> this.setDepthTest = function ( depthTest ) {
<add> function setDepthTest( depthTest ) {
<ide>
<ide> if ( _oldDepthTest !== depthTest ) {
<ide>
<ide> THREE.WebGLRenderer2.LowLevelRenderer = function(parameters){
<ide>
<ide> };
<ide>
<del> this.setDepthWrite = function ( depthWrite ) {
<add> function setDepthWrite( depthWrite ) {
<ide>
<ide> if ( _oldDepthWrite !== depthWrite ) {
<ide>
<ide> THREE.WebGLRenderer2.LowLevelRenderer = function(parameters){
<ide> };
<ide>
<ide>
<del> this.setTexture = function ( texture, slot ) {
<add> function setTexture( texture, slot ) {
<ide>
<ide> if ( texture.needsUpdate ) {
<ide>
<ide> THREE.WebGLRenderer2.LowLevelRenderer = function(parameters){
<ide>
<ide> };
<ide>
<del> this.setCubeTexture = function( texture, slot ,autoScaleCubemaps) {
<add> function setCubeTexture( texture, slot ,autoScaleCubemaps) {
<ide>
<ide> if ( texture.image.length === 6 ) {
<ide>
<ide> THREE.WebGLRenderer2.LowLevelRenderer = function(parameters){
<ide> };
<ide>
<ide>
<del> this.setRenderTarget = function ( renderTarget ) {
<add> function setRenderTarget( renderTarget ) {
<ide>
<ide> var isCube = ( renderTarget instanceof THREE.WebGLRenderTargetCube );
<ide>
<ide> THREE.WebGLRenderer2.LowLevelRenderer = function(parameters){
<ide>
<ide> }
<ide>
<del> this.currentWidth = width;
<del> this.currentHeight = height;
<add> _currentWidth = width;
<add> _currentHeight = height;
<ide>
<ide> };
<ide>
<ide> THREE.WebGLRenderer2.LowLevelRenderer = function(parameters){
<ide>
<ide> };
<ide>
<del> this.updateRenderTargetMipmap = function updateRenderTargetMipmap ( renderTarget ) {
<add> function updateRenderTargetMipmap ( renderTarget ) {
<ide>
<ide> if ( renderTarget instanceof THREE.WebGLRenderTargetCube ) {
<ide>
<ide> THREE.WebGLRenderer2.LowLevelRenderer = function(parameters){
<ide>
<ide> };
<ide>
<del> this.setCubeTextureDynamic = function setCubeTextureDynamic ( texture, slot ) {
<add> function setCubeTextureDynamic ( texture, slot ) {
<ide>
<ide> _gl.activeTexture( _gl.TEXTURE0 + slot );
<ide> _gl.bindTexture( _gl.TEXTURE_CUBE_MAP, texture.__webglTexture );
<ide> THREE.WebGLRenderer2.LowLevelRenderer = function(parameters){
<ide>
<ide>
<ide> // Map three.js constants to WebGL constants
<del> var paramThreeToGL = this.paramThreeToGL = function paramThreeToGL ( p ) {
<add> function paramThreeToGL ( p ) {
<ide>
<ide> if ( p === THREE.RepeatWrapping ) return _gl.REPEAT;
<ide> if ( p === THREE.ClampToEdgeWrapping ) return _gl.CLAMP_TO_EDGE;
<ide> THREE.WebGLRenderer2.LowLevelRenderer = function(parameters){
<ide> };
<ide>
<ide>
<del> this.compileShader = function(vertexShader, fragmentShader){
<add> function compileShader(vertexShader, fragmentShader){
<ide>
<ide> var program = _gl.createProgram();
<ide>
<ide> THREE.WebGLRenderer2.LowLevelRenderer = function(parameters){
<ide>
<ide> };
<ide>
<del> this.resetState = function(){
<add> function resetState(){
<ide>
<ide> _oldBlending = -1;
<ide> _oldDepthTest = -1;
<ide> THREE.WebGLRenderer2.LowLevelRenderer = function(parameters){
<ide>
<ide>
<ide>
<del> var setLineWidth = this.setLineWidth = function setLineWidth ( width ) {
<add> function setLineWidth ( width ) {
<ide>
<ide> if ( width !== _oldLineWidth ) {
<ide>
<ide> THREE.WebGLRenderer2.LowLevelRenderer = function(parameters){
<ide> }
<ide>
<ide> };
<add>
<add>
<add> this.context = _gl;
<add>
<add> this.autoScaleCubemaps = true;
<add> this.supportsBoneTextures = _supportsBoneTextures;
<add> this.precision = _precision;
<add> this.maxVertexUniformVectors = _gl.getParameter( _gl.MAX_VERTEX_UNIFORM_VECTORS );
<add>
<add> // Methods
<add> this.getContext = getContext;
<add> this.getDomElement = getDomElement;
<add> this.supportsVertexTextures = supportsVertexTextures;
<add> this.getMaxAnisotropy = getMaxAnisotropy;
<add>
<add> this.setSize = setSize;
<add> this.setViewport = setViewport;
<add> this.setScissor = setScissor;
<add> this.enableScissorTest = enableScissorTest;
<add>
<add> this.setClearColorHex = setClearColorHex;
<add> this.setClearColor = setClearColor;
<add> this.getClearColor = getClearColor;
<add> this.getClearAlpha = getClearAlpha;
<add> this.clear = clear;
<add> this.clearTarget = clearTarget;
<add>
<add> this.deleteBuffer = deleteBuffer;
<add> this.deleteTexture = deleteTexture;
<add> this.deleteFramebuffer = deleteFramebuffer;
<add> this.deleteRenderbuffer = deleteRenderbuffer;
<add> this.deleteProgram = deleteProgram;
<add>
<add> this.createBuffer = createBuffer;
<add> this.setStaticArrayBuffer = setStaticArrayBuffer;
<add> this.setStaticIndexBuffer = setStaticIndexBuffer;
<add> this.setDynamicArrayBuffer = setDynamicArrayBuffer;
<add> this.setDynamicIndexBuffer = setDynamicIndexBuffer;
<add>
<add> this.drawTriangles = drawTriangles;
<add> this.drawLines = drawLines;
<add> this.drawLineStrip = drawLineStrip;
<add> this.drawPoints = drawPoints;
<add> this.drawTriangleElements = drawTriangleElements;
<add> this.drawLineElements = drawLineElements;
<add>
<add> this.bindArrayBuffer = bindArrayBuffer;
<add> this.bindElementArrayBuffer = bindElementArrayBuffer;
<add>
<add> this.enableAttribute = enableAttribute;
<add> this.disableAttributes = disableAttributes;
<add> this.getAttribLocation = getAttribLocation;
<add> this.setFloatAttribute = setFloatAttribute;
<add>
<add> this.getUniformLocation= getUniformLocation;
<add>
<add> this.uniform1i = uniform1i;
<add> this.uniform1f = uniform1f;
<add> this.uniform2f = uniform2f;
<add> this.uniform3f = uniform3f;
<add> this.uniform4f = uniform4f;
<add> this.uniform1iv = uniform1iv;
<add> this.uniform2iv = uniform2iv;
<add> this.uniform3iv = uniform3iv;
<add> this.uniform1fv = uniform1fv;
<add> this.uniform2fv = uniform2fv;
<add> this.uniform3fv = uniform3fv;
<add> this.uniform4fv = uniform4fv;
<add> this.uniformMatrix3fv = uniformMatrix3fv;
<add> this.uniformMatrix4fv = uniformMatrix4fv;
<add>
<add> this.useProgram = useProgram;
<add> this.compileShader = compileShader;
<add>
<add> this.setFaceCulling = setFaceCulling;
<add> this.setMaterialFaces = setMaterialFaces;
<add> this.setPolygonOffset = setPolygonOffset;
<add> this.setBlending = setBlending;
<add> this.setDepthTest = setDepthTest;
<add> this.setDepthWrite = setDepthWrite;
<add>
<add> this.setTexture = setTexture;
<add> this.setCubeTexture = setCubeTexture;
<add> this.updateRenderTargetMipmap = updateRenderTargetMipmap;
<add> this.setCubeTextureDynamic = setCubeTextureDynamic;
<add>
<add> this.paramThreeToGL = paramThreeToGL;
<add> this.setLineWidth = setLineWidth;
<add> this.resetState = resetState;
<add>
<ide> };
<ide>
<ide>
<add> | 1 |
PHP | PHP | remove overloadable from helper class | f5fa56ff3cbf5ec396c8a46358186347484a209b | <ide><path>cake/libs/view/helper.php
<ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
<ide> */
<ide>
<del>/**
<del> * Included libs
<del> */
<del>App::import('Core', 'Overloadable');
<del>
<ide> /**
<ide> * Abstract base class for all other Helpers in CakePHP.
<ide> * Provides common methods and features.
<ide> *
<ide> * @package cake
<ide> * @subpackage cake.cake.libs.view
<ide> */
<del>class Helper extends Overloadable {
<add>class Helper {
<ide>
<ide> /**
<ide> * List of helpers used by this helper
<ide> class Helper extends Overloadable {
<ide> * Default overload methods
<ide> *
<ide> */
<del> protected function get__($name) {}
<del> protected function set__($name, $value) {}
<del> protected function call__($method, $params) {
<add> protected function __call($method, $params) {
<ide> trigger_error(sprintf(__('Method %1$s::%2$s does not exist', true), get_class($this), $method), E_USER_WARNING);
<ide> }
<ide> | 1 |
PHP | PHP | handle dynamic channels | 30f9a32bde4ac95c59fd028548872205d8ba894c | <ide><path>src/Illuminate/Notifications/Channels/Notification.php
<ide> public function action($text, $url)
<ide> */
<ide> public function via($channels)
<ide> {
<del> $this->via = (array) $channels;
<add> $this->via = is_string($channels) ? func_get_args() : (array) $channels;
<ide>
<ide> return $this;
<ide> } | 1 |
Text | Text | add text to describe how activities interact | fce3fefc09ee7889961e6f01c704f6027c1667fd | <ide><path>guide/english/android-development/core-components/index.md
<ide> Core components are the essential elements contained in an Android app. Each of
<ide> - Content providers
<ide>
<ide> ### [Activities](https://developer.android.com/guide/components/activities/)
<del>An _activity_ is a component that has a user interface and represents a single screen in an Android app. An app can have multiple activities, each of which can be an entry point to the application itself for the user or the system (an app's activity that wants to open another activity that belongs to the same application or to a different one).
<add>An _activity_ is a component that has a user interface and represents a single screen in an Android app. An app can have multiple activities, each of which can be an entry point to the application itself for the user or the system (an app's activity that wants to open another activity that belongs to the same application or to a different one). One activity can call another activity with the help of an [Intent](https://developer.android.com/reference/android/content/Intent).
<ide>
<ide> An activity facilitates the following key interactions between system and app:
<ide> - Keeping track of what the user currently cares about (what is on screen) to ensure that the system keeps running the process that is hosting the activity. | 1 |
Python | Python | fix bugs from porting master to develop | fc6e34c3a13b93caaed7b2c0cf60dcc0df59c0f4 | <ide><path>bin/wiki_entity_linking/wikidata_train_entity_linker.py
<ide> def main(
<ide> kb=kb,
<ide> labels_discard=labels_discard,
<ide> )
<del> docs, golds = zip(*train_batch)
<ide> try:
<ide> with nlp.disable_pipes(*other_pipes):
<ide> nlp.update(
<del> docs=docs,
<del> golds=golds,
<add> examples=train_batch,
<ide> sgd=optimizer,
<ide> drop=dropout,
<ide> losses=losses,
<ide><path>spacy/cli/train.py
<ide> def train(
<ide> pipeline: ("Comma-separated names of pipeline components", "option", "p", str) = "tagger,parser,ner",
<ide> vectors: ("Model to load vectors from", "option", "v", str) = None,
<ide> replace_components: ("Replace components from base model", "flag", "R", bool) = False,
<del> width: ("Width of CNN layers of Tok2Vec component", "option", "cw", int) = 96,
<del> conv_depth: ("Depth of CNN layers of Tok2Vec component", "option", "cd", int) = 4,
<del> cnn_window: ("Window size for CNN layers of Tok2Vec component", "option", "cW", int) = 1,
<del> cnn_pieces: ("Maxout size for CNN layers of Tok2Vec component. 1 for Mish", "option", "cP", int) = 3,
<del> use_chars: ("Whether to use character-based embedding of Tok2Vec component", "flag", "chr", bool) = False,
<del> bilstm_depth: ("Depth of BiLSTM layers of Tok2Vec component (requires PyTorch)", "option", "lstm", int) = 0,
<del> embed_rows: ("Number of embedding rows of Tok2Vec component", "option", "er", int) = 2000,
<ide> n_iter: ("Number of iterations", "option", "n", int) = 30,
<ide> n_early_stopping: ("Maximum number of training epochs without dev accuracy improvement", "option", "ne", int) = None,
<ide> n_examples: ("Number of examples", "option", "ns", int) = 0,
<ide> def train(
<ide> else:
<ide> # Start with a blank model, call begin_training
<ide> cfg = {"device": use_gpu}
<del> cfg["conv_depth"] = conv_depth
<del> cfg["token_vector_width"] = width
<del> cfg["bilstm_depth"] = bilstm_depth
<del> cfg["cnn_maxout_pieces"] = cnn_pieces
<del> cfg["embed_size"] = embed_rows
<del> cfg["conv_window"] = cnn_window
<del> cfg["subword_features"] = not use_chars
<del> optimizer = nlp.begin_training(lambda: corpus.train_tuples, **cfg)
<add> optimizer = nlp.begin_training(lambda: corpus.train_examples, **cfg)
<ide> nlp._optimizer = None
<ide>
<ide> # Load in pretrained weights
<ide> def train(
<ide> for batch in util.minibatch_by_words(train_data, size=batch_sizes):
<ide> if not batch:
<ide> continue
<del> docs, golds = zip(*batch)
<ide> try:
<ide> nlp.update(
<del> docs,
<del> golds,
<add> batch,
<ide> sgd=optimizer,
<ide> drop=next(dropout_rates),
<ide> losses=losses,
<ide> def _get_metrics(component):
<ide> elif component == "tagger":
<ide> return ("tags_acc",)
<ide> elif component == "ner":
<del> return ("ents_f", "ents_p", "ents_r", "enty_per_type")
<add> return ("ents_f", "ents_p", "ents_r", "ents_per_type")
<ide> elif component == "sentrec":
<ide> return ("sent_f", "sent_p", "sent_r")
<ide> elif component == "textcat": | 2 |
Javascript | Javascript | materialize typed array in one place | d44bf272ad1ffb9adfd21de760645840ffdaec86 | <ide><path>src/backend/renderer.js
<ide> export function attach(
<ide> }
<ide>
<ide> let pendingOperations: Array<number> = [];
<del> let pendingOperationsQueue: Array<Array<number>> | null = [];
<add> let pendingOperationsQueue: Array<Uint32Array> | null = [];
<ide>
<ide> let nextOperation: Array<number> = [];
<ide> function beginNextOperation(size: number): void {
<ide> export function attach(
<ide> // Let the frontend know about tree operations.
<ide> // The first value in this array will identify which root it corresponds to,
<ide> // so we do no longer need to dispatch a separate root-committed event.
<add> const ops = Uint32Array.from(pendingOperations);
<ide> if (pendingOperationsQueue !== null) {
<ide> // Until the frontend has been connected, store the tree operations.
<ide> // This will let us avoid walking the tree later when the frontend connects,
<ide> // and it enables the Profiler's reload-and-profile functionality to work as well.
<del> pendingOperationsQueue.push(pendingOperations);
<add> pendingOperationsQueue.push(ops);
<ide> } else {
<ide> // If we've already connected to the frontend, just pass the operations through.
<del> hook.emit('operations', Uint32Array.from(pendingOperations));
<add> hook.emit('operations', ops);
<ide> }
<ide>
<ide> pendingOperations = [];
<ide> export function attach(
<ide> ) {
<ide> // We may have already queued up some operations before the frontend connected
<ide> // If so, let the frontend know about them.
<del> localPendingOperationsQueue.forEach(pendingOperations => {
<del> hook.emit('operations', Uint32Array.from(pendingOperations));
<add> localPendingOperationsQueue.forEach(ops => {
<add> hook.emit('operations', ops);
<ide> });
<ide> } else {
<ide> // If we have not been profiling, then we can just walk the tree and build up its current state as-is. | 1 |
Mixed | Javascript | add missing deprecation code | ff5a1cf5a8d61fd16d5190e7117e97e49d7edcb2 | <ide><path>doc/api/deprecations.md
<ide> Type: Documentation-only (supports [`--pending-deprecation`][])
<ide> The `process._tickCallback` property was never documented as
<ide> an officially supported API.
<ide>
<del><a id="DEP0XXX"></a>
<del>### DEP0XXX: `WriteStream.open()` and `ReadStream.open()` are internal
<add><a id="DEP0135"></a>
<add>### DEP0135: `WriteStream.open()` and `ReadStream.open()` are internal
<ide> <!-- YAML
<ide> changes:
<ide> - version: REPLACEME
<ide><path>lib/internal/fs/streams.js
<ide> Object.setPrototypeOf(ReadStream, Readable);
<ide>
<ide> const openReadFs = internalUtil.deprecate(function() {
<ide> _openReadFs(this);
<del>}, 'ReadStream.prototype.open() is deprecated', 'DEP0XXX');
<add>}, 'ReadStream.prototype.open() is deprecated', 'DEP0135');
<ide> ReadStream.prototype.open = openReadFs;
<ide>
<ide> function _openReadFs(stream) {
<ide> WriteStream.prototype._final = function(callback) {
<ide>
<ide> const openWriteFs = internalUtil.deprecate(function() {
<ide> _openWriteFs(this);
<del>}, 'WriteStream.prototype.open() is deprecated', 'DEP0XXX');
<add>}, 'WriteStream.prototype.open() is deprecated', 'DEP0135');
<ide> WriteStream.prototype.open = openWriteFs;
<ide>
<ide> function _openWriteFs(stream) {
<ide><path>test/parallel/test-fs-read-stream-patch-open.js
<ide> const fs = require('fs');
<ide>
<ide> common.expectWarning(
<ide> 'DeprecationWarning',
<del> 'ReadStream.prototype.open() is deprecated', 'DEP0XXX');
<add> 'ReadStream.prototype.open() is deprecated', 'DEP0135');
<ide> const s = fs.createReadStream('asd')
<ide> // We don't care about errors in this test.
<ide> .on('error', () => {});
<ide><path>test/parallel/test-fs-write-stream-patch-open.js
<ide> if (process.argv[2] !== 'child') {
<ide>
<ide> common.expectWarning(
<ide> 'DeprecationWarning',
<del> 'WriteStream.prototype.open() is deprecated', 'DEP0XXX');
<add> 'WriteStream.prototype.open() is deprecated', 'DEP0135');
<ide> const s = fs.createWriteStream(`${tmpdir.path}/out`);
<ide> s.open();
<ide> | 4 |
Java | Java | fix broken tostringvisitortests | 9b1c8a3a5cd72a1a5301c6966d124783f7e17ffb | <ide><path>spring-webflux/src/test/java/org/springframework/web/reactive/function/server/ToStringVisitorTests.java
<ide> /*
<del> * Copyright 2002-2019 the original author or authors.
<add> * Copyright 2002-2022 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> public void predicates() {
<ide> testPredicate(pathExtension("foo"), "*.foo");
<ide>
<ide> testPredicate(contentType(MediaType.APPLICATION_JSON), "Content-Type: application/json");
<del> testPredicate(contentType(MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN), "Content-Type: [application/json, text/plain]");
<add>
<add> ToStringVisitor visitor = new ToStringVisitor();
<add> contentType(MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN).accept(visitor);
<add> assertThat(visitor.toString()).matches("Content-Type: \\[.+, .+\\]").contains("application/json", "text/plain");
<ide>
<ide> testPredicate(accept(MediaType.APPLICATION_JSON), "Accept: application/json");
<ide>
<ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/function/ToStringVisitorTests.java
<ide> /*
<del> * Copyright 2002-2019 the original author or authors.
<add> * Copyright 2002-2022 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> public void predicates() {
<ide> testPredicate(pathExtension("foo"), "*.foo");
<ide>
<ide> testPredicate(contentType(MediaType.APPLICATION_JSON), "Content-Type: application/json");
<del> testPredicate(contentType(MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN), "Content-Type: [application/json, text/plain]");
<add>
<add> ToStringVisitor visitor = new ToStringVisitor();
<add> contentType(MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN).accept(visitor);
<add> assertThat(visitor.toString()).matches("Content-Type: \\[.+, .+\\]").contains("application/json", "text/plain");
<ide>
<ide> testPredicate(accept(MediaType.APPLICATION_JSON), "Accept: application/json");
<ide> | 2 |
Go | Go | fix regresion on first boot | 8da449055fd2fb60e45391c8482865dca3d0232f | <ide><path>daemon/start.go
<ide> func (daemon *Daemon) containerStart(container *Container) (err error) {
<ide> mounts = append(mounts, container.ipcMounts()...)
<ide>
<ide> container.command.Mounts = mounts
<del> return daemon.waitForStart(container)
<add> if err := daemon.waitForStart(container); err != nil {
<add> return err
<add> }
<add> container.HasBeenStartedBefore = true
<add> return nil
<ide> }
<ide>
<ide> func (daemon *Daemon) waitForStart(container *Container) error { | 1 |
Text | Text | improve metadata for http.request | fadafef4f4e673b71cb33078a588daddf8deed3a | <ide><path>doc/api/http.md
<ide> added: v0.3.6
<ide> changes:
<ide> - version: v10.9.0
<ide> pr-url: https://github.com/nodejs/node/pull/21616
<del> description: allow both url and options to be passed to `http.get()`
<add> description: The `url` parameter can now be passed along with a separate
<add> `options` object.
<ide> - version: v7.5.0
<ide> pr-url: https://github.com/nodejs/node/pull/10638
<ide> description: The `options` parameter can be a WHATWG `URL` object.
<ide> added: v0.3.6
<ide> changes:
<ide> - version: v10.9.0
<ide> pr-url: https://github.com/nodejs/node/pull/21616
<del> description: allow both url and options to be passed to `http.request()`
<add> description: The `url` parameter can now be passed along with a separate
<add> `options` object.
<ide> - version: v7.5.0
<ide> pr-url: https://github.com/nodejs/node/pull/10638
<ide> description: The `options` parameter can be a WHATWG `URL` object.
<ide><path>doc/api/https.md
<ide> added: v0.3.6
<ide> changes:
<ide> - version: v10.9.0
<ide> pr-url: https://github.com/nodejs/node/pull/21616
<del> description: allow both url and options to be passed to `https.get()`
<add> description: The `url` parameter can now be passed along with a separate
<add> `options` object.
<ide> - version: v7.5.0
<ide> pr-url: https://github.com/nodejs/node/pull/10638
<ide> description: The `options` parameter can be a WHATWG `URL` object.
<ide> added: v0.3.6
<ide> changes:
<ide> - version: v10.9.0
<ide> pr-url: https://github.com/nodejs/node/pull/21616
<del> description: allow both url and options to be passed to `https.request()`
<add> description: The `url` parameter can now be passed along with a separate
<add> `options` object.
<ide> - version: v9.3.0
<ide> pr-url: https://github.com/nodejs/node/pull/14903
<ide> description: The `options` parameter can now include `clientCertEngine`. | 2 |
Text | Text | update license name | 8f82e89d0b26108e32a10b5d95b67e5e21ff0df6 | <ide><path>README.md
<ide> Homebrew's current maintainers are [Misty De Meo](https://github.com/mistydemeo)
<ide> Former maintainers with significant contributions include [Dominyk Tiller](https://github.com/DomT4), [Brett Koonce](https://github.com/asparagui), [Jack Nagel](https://github.com/jacknagel), [Adam Vandenberg](https://github.com/adamv) and Homebrew's creator: [Max Howell](https://github.com/mxcl).
<ide>
<ide> ## License
<del>Code is under the [BSD 2 Clause (NetBSD) license](https://github.com/Homebrew/brew/tree/master/LICENSE.txt).
<add>Code is under the [BSD 2-clause "Simplified" License](https://github.com/Homebrew/brew/tree/master/LICENSE.txt).
<ide> Documentation is under the [Creative Commons Attribution license](https://creativecommons.org/licenses/by/4.0/).
<ide>
<ide> ## Donations | 1 |
Text | Text | update the version with hooks proposal in readme | e489c3f9c114e3c30ccecc32743c9b6255fea058 | <ide><path>packages/eslint-plugin-react-hooks/README.md
<ide> It is a part of the [Hooks proposal](https://reactjs.org/docs/hooks-intro.html)
<ide>
<ide> ## Experimental Status
<ide>
<del>This is an experimental release and is intended to be used for testing the Hooks proposal with React 16.7 alpha. The exact heuristics it uses may be adjusted.
<add>This is an experimental release and is intended to be used for testing the Hooks proposal with React 16.8 alpha. The exact heuristics it uses may be adjusted.
<ide>
<ide> The [Rules of Hooks](https://reactjs.org/docs/hooks-rules.html) documentation contains a link to the technical RFC. Please leave a comment on the RFC if you have concerns or ideas about how this plugin should work.
<ide> | 1 |
Text | Text | fix the link for plugin documentation | 701021ebd8f7bba22347be71f58563506fcc7b74 | <ide><path>experimental/plugins_graphdriver.md
<ide> being started.
<ide>
<ide> # Write a graph driver plugin
<ide>
<del>See the [plugin documentation](/docs/extend/plugins.md) for detailed information
<add>See the [plugin documentation](/docs/extend/index.md) for detailed information
<ide> on the underlying plugin protocol.
<ide>
<ide> | 1 |
Mixed | Text | cleanup the whitelisting references after | ca62dfeede0c5352baf6c65688c71b9cd909c831 | <ide><path>actionpack/CHANGELOG.md
<ide> * Introduce ActionDispatch::HostAuthorization
<ide>
<ide> This is a new middleware that guards against DNS rebinding attacks by
<del> white-listing the allowed hosts a request can be made to.
<add> explicitly permitting the hosts a request can be made to.
<ide>
<ide> Each host is checked with the case operator (`#===`) to support `RegExp`,
<ide> `Proc`, `IPAddr` and custom objects as host allowances.
<ide><path>actionpack/lib/action_dispatch/middleware/host_authorization.rb
<ide> require "action_dispatch/http/request"
<ide>
<ide> module ActionDispatch
<del> # This middleware guards from DNS rebinding attacks by white-listing the
<del> # hosts a request can be sent to.
<add> # This middleware guards from DNS rebinding attacks by explicitly permitting
<add> # the hosts a request can be sent to.
<ide> #
<ide> # When a request comes to an unauthorized host, the +response_app+
<ide> # application will be executed and rendered. If no +response_app+ is given, a
<ide><path>actionpack/test/dispatch/host_authorization_test.rb
<ide> class HostAuthorizationTest < ActionDispatch::IntegrationTest
<ide> assert_match "Blocked host: www.example.com", response.body
<ide> end
<ide>
<del> test "passes all requests to if the whitelist is empty" do
<add> test "allows all requests if hosts is empty" do
<ide> @app = ActionDispatch::HostAuthorization.new(App, nil)
<ide>
<ide> get "/"
<ide> class HostAuthorizationTest < ActionDispatch::IntegrationTest
<ide> assert_equal "Success", body
<ide> end
<ide>
<del> test "passes requests to allowed host" do
<add> test "hosts can be a single element array" do
<ide> @app = ActionDispatch::HostAuthorization.new(App, %w(www.example.com))
<ide>
<ide> get "/"
<ide> class HostAuthorizationTest < ActionDispatch::IntegrationTest
<ide> assert_equal "Success", body
<ide> end
<ide>
<del> test "the whitelist could be a single element" do
<add> test "hosts can be a string" do
<ide> @app = ActionDispatch::HostAuthorization.new(App, "www.example.com")
<ide>
<ide> get "/"
<ide><path>guides/source/api_app.md
<ide> controller modules by default:
<ide> - `ActionController::Renderers::All`: Support for `render :json` and friends.
<ide> - `ActionController::ConditionalGet`: Support for `stale?`.
<ide> - `ActionController::BasicImplicitRender`: Makes sure to return an empty response, if there isn't an explicit one.
<del>- `ActionController::StrongParameters`: Support for parameters white-listing in combination with Active Model mass assignment.
<add>- `ActionController::StrongParameters`: Support for parameters filtering in combination with Active Model mass assignment.
<ide> - `ActionController::DataStreaming`: Support for `send_file` and `send_data`.
<ide> - `AbstractController::Callbacks`: Support for `before_action` and
<ide> similar helpers.
<ide><path>railties/CHANGELOG.md
<ide>
<ide> In other environments `Rails.application.config.hosts` is empty and no
<ide> `Host` header checks will be done. If you want to guard against header
<del> attacks on production, you have to manually whitelist the allowed hosts
<add> attacks on production, you have to manually permit the allowed hosts
<ide> with:
<ide>
<ide> Rails.application.config.hosts << "product.com"
<ide> # `beta1.product.com`.
<ide> Rails.application.config.hosts << /.*\.product\.com/
<ide>
<del> A special case is supported that allows you to whitelist all sub-domains:
<add> A special case is supported that allows you to permit all sub-domains:
<ide>
<ide> # Allow requests from subdomains like `www.product.com` and
<ide> # `beta1.product.com`.
<ide><path>railties/test/application/configuration_test.rb
<ide> class MyLogger < ::Logger
<ide> MESSAGE
<ide> end
<ide>
<del> test "the host whitelist includes .localhost in development" do
<add> test "hosts include .localhost in development" do
<ide> app "development"
<ide> assert_includes Rails.application.config.hosts, ".localhost"
<ide> end | 6 |
Mixed | Python | remove exception detail from doctest | aa0ace4df7dfff3a70685466e96c51dd264e5083 | <ide><path>DIRECTORY.md
<ide> * [Binary Shifts](https://github.com/TheAlgorithms/Python/blob/master/bit_manipulation/binary_shifts.py)
<ide> * [Binary Twos Complement](https://github.com/TheAlgorithms/Python/blob/master/bit_manipulation/binary_twos_complement.py)
<ide> * [Binary Xor Operator](https://github.com/TheAlgorithms/Python/blob/master/bit_manipulation/binary_xor_operator.py)
<add> * [Count 1S Brian Kernighan Method](https://github.com/TheAlgorithms/Python/blob/master/bit_manipulation/count_1s_brian_kernighan_method.py)
<ide> * [Count Number Of One Bits](https://github.com/TheAlgorithms/Python/blob/master/bit_manipulation/count_number_of_one_bits.py)
<ide> * [Reverse Bits](https://github.com/TheAlgorithms/Python/blob/master/bit_manipulation/reverse_bits.py)
<ide> * [Single Bit Manipulation Operations](https://github.com/TheAlgorithms/Python/blob/master/bit_manipulation/single_bit_manipulation_operations.py)
<ide> * [Decimal To Octal](https://github.com/TheAlgorithms/Python/blob/master/conversions/decimal_to_octal.py)
<ide> * [Hex To Bin](https://github.com/TheAlgorithms/Python/blob/master/conversions/hex_to_bin.py)
<ide> * [Hexadecimal To Decimal](https://github.com/TheAlgorithms/Python/blob/master/conversions/hexadecimal_to_decimal.py)
<add> * [Length Conversions](https://github.com/TheAlgorithms/Python/blob/master/conversions/length_conversions.py)
<ide> * [Molecular Chemistry](https://github.com/TheAlgorithms/Python/blob/master/conversions/molecular_chemistry.py)
<ide> * [Octal To Decimal](https://github.com/TheAlgorithms/Python/blob/master/conversions/octal_to_decimal.py)
<ide> * [Prefix Conversions](https://github.com/TheAlgorithms/Python/blob/master/conversions/prefix_conversions.py)
<ide> * [Polynom For Points](https://github.com/TheAlgorithms/Python/blob/master/linear_algebra/src/polynom_for_points.py)
<ide> * [Power Iteration](https://github.com/TheAlgorithms/Python/blob/master/linear_algebra/src/power_iteration.py)
<ide> * [Rayleigh Quotient](https://github.com/TheAlgorithms/Python/blob/master/linear_algebra/src/rayleigh_quotient.py)
<add> * [Schur Complement](https://github.com/TheAlgorithms/Python/blob/master/linear_algebra/src/schur_complement.py)
<ide> * [Test Linear Algebra](https://github.com/TheAlgorithms/Python/blob/master/linear_algebra/src/test_linear_algebra.py)
<ide> * [Transformations 2D](https://github.com/TheAlgorithms/Python/blob/master/linear_algebra/src/transformations_2d.py)
<ide>
<ide> * [Runge Kutta](https://github.com/TheAlgorithms/Python/blob/master/maths/runge_kutta.py)
<ide> * [Segmented Sieve](https://github.com/TheAlgorithms/Python/blob/master/maths/segmented_sieve.py)
<ide> * Series
<del> * [Arithmetic Mean](https://github.com/TheAlgorithms/Python/blob/master/maths/series/arithmetic_mean.py)
<del> * [Geometric Mean](https://github.com/TheAlgorithms/Python/blob/master/maths/series/geometric_mean.py)
<add> * [Arithmetic](https://github.com/TheAlgorithms/Python/blob/master/maths/series/arithmetic.py)
<add> * [Geometric](https://github.com/TheAlgorithms/Python/blob/master/maths/series/geometric.py)
<ide> * [Geometric Series](https://github.com/TheAlgorithms/Python/blob/master/maths/series/geometric_series.py)
<add> * [Harmonic](https://github.com/TheAlgorithms/Python/blob/master/maths/series/harmonic.py)
<ide> * [Harmonic Series](https://github.com/TheAlgorithms/Python/blob/master/maths/series/harmonic_series.py)
<ide> * [P Series](https://github.com/TheAlgorithms/Python/blob/master/maths/series/p_series.py)
<ide> * [Sieve Of Eratosthenes](https://github.com/TheAlgorithms/Python/blob/master/maths/sieve_of_eratosthenes.py)
<ide> * [Indian Phone Validator](https://github.com/TheAlgorithms/Python/blob/master/strings/indian_phone_validator.py)
<ide> * [Is Palindrome](https://github.com/TheAlgorithms/Python/blob/master/strings/is_palindrome.py)
<ide> * [Jaro Winkler](https://github.com/TheAlgorithms/Python/blob/master/strings/jaro_winkler.py)
<add> * [Join](https://github.com/TheAlgorithms/Python/blob/master/strings/join.py)
<ide> * [Knuth Morris Pratt](https://github.com/TheAlgorithms/Python/blob/master/strings/knuth_morris_pratt.py)
<ide> * [Levenshtein Distance](https://github.com/TheAlgorithms/Python/blob/master/strings/levenshtein_distance.py)
<ide> * [Lower](https://github.com/TheAlgorithms/Python/blob/master/strings/lower.py)
<ide> * [Fetch Jobs](https://github.com/TheAlgorithms/Python/blob/master/web_programming/fetch_jobs.py)
<ide> * [Get Imdb Top 250 Movies Csv](https://github.com/TheAlgorithms/Python/blob/master/web_programming/get_imdb_top_250_movies_csv.py)
<ide> * [Get Imdbtop](https://github.com/TheAlgorithms/Python/blob/master/web_programming/get_imdbtop.py)
<add> * [Giphy](https://github.com/TheAlgorithms/Python/blob/master/web_programming/giphy.py)
<ide> * [Instagram Crawler](https://github.com/TheAlgorithms/Python/blob/master/web_programming/instagram_crawler.py)
<ide> * [Instagram Pic](https://github.com/TheAlgorithms/Python/blob/master/web_programming/instagram_pic.py)
<ide> * [Instagram Video](https://github.com/TheAlgorithms/Python/blob/master/web_programming/instagram_video.py)
<ide><path>conversions/length_conversions.py
<ide> def length_conversion(value: float, from_type: str, to_type: str) -> float:
<ide> 0.1181103
<ide> >>> length_conversion(4, "wrongUnit", "inch")
<ide> Traceback (most recent call last):
<del> File "/usr/lib/python3.8/doctest.py", line 1336, in __run
<del> exec(compile(example.source, filename, "single",
<del> File "<doctest __main__.length_conversion[18]>", line 1, in <module>
<del> length_conversion(4, "wrongUnit", "inch")
<del> File "<string>", line 85, in length_conversion
<add> ...
<ide> ValueError: Invalid 'from_type' value: 'wrongUnit' Supported values are:
<ide> meter, kilometer, feet, inch, centimeter, yard, foot, mile, millimeter
<ide> """ | 2 |
Ruby | Ruby | push rails app testing up | 9b15828b5c347395b42066a588c88e5eb4e72279 | <ide><path>actionpack/lib/action_dispatch/routing/mapper.rb
<ide> def mount(app, options = nil)
<ide>
<ide> raise "A rack application must be specified" unless path
<ide>
<del> options[:as] ||= app_name(app)
<add> rails_app = rails_app? app
<add>
<add> if rails_app
<add> options[:as] ||= app.railtie_name
<add> else
<add> # non rails apps can't have an :as
<add> options[:as] = nil
<add> end
<add>
<ide> target_as = name_for_action(options[:as], path)
<ide> options[:via] ||= :all
<ide>
<ide> match(path, options.merge(:to => app, :anchor => false, :format => false))
<ide>
<del> define_generate_prefix(app, target_as)
<add> define_generate_prefix(app, target_as) if rails_app
<ide> self
<ide> end
<ide>
<ide> def has_named_route?(name)
<ide> end
<ide>
<ide> private
<del> def app_name(app)
<del> return unless app.is_a?(Class) && app < Rails::Railtie
<del>
<del> app.railtie_name
<add> def rails_app?(app)
<add> app.is_a?(Class) && app < Rails::Railtie
<ide> end
<ide>
<ide> def define_generate_prefix(app, name)
<del> return unless app.is_a?(Class) && app < Rails::Railtie
<del>
<ide> _route = @set.named_routes.routes[name.to_sym]
<ide> _routes = @set
<ide> app.routes.define_mounted_helper(name)
<ide> def add_route(action, options) # :nodoc:
<ide> action = nil
<ide> end
<ide>
<del> if !options.fetch(:as, true)
<add> if !options.fetch(:as, true) # if it's set to nil or false
<ide> options.delete(:as)
<ide> else
<ide> options[:as] = name_for_action(options[:as], action) | 1 |
PHP | PHP | add wherepivotin test | e9831b3b683c2135834ba5650f81ac531af7a244 | <ide><path>tests/Integration/Database/EloquentBelongsToManyTest.php
<ide> public function test_where_pivot_on_string()
<ide> $post = Post::create(['title' => Str::random()]);
<ide>
<ide> DB::table('posts_tags')->insert([
<del> ['post_id' => $post->id, 'tag_id' => $tag->id, 'flag' => 'empty'],
<add> ['post_id' => $post->id, 'tag_id' => $tag->id, 'flag' => 'foo'],
<ide> ]);
<ide>
<del> $relationTag = $post->tags()->wherePivot('flag', 'empty')->first();
<add> $relationTag = $post->tags()->wherePivot('flag', 'foo')->first();
<ide> $this->assertEquals($relationTag->getAttributes(), $tag->getAttributes());
<ide>
<del> $relationTag = $post->tags()->wherePivot('flag', '=', 'empty')->first();
<add> $relationTag = $post->tags()->wherePivot('flag', '=', 'foo')->first();
<ide> $this->assertEquals($relationTag->getAttributes(), $tag->getAttributes());
<ide> }
<ide>
<ide> public function test_where_pivot_on_boolean()
<ide> $this->assertEquals($relationTag->getAttributes(), $tag->getAttributes());
<ide> }
<ide>
<add> public function test_where_pivot_in_method()
<add> {
<add> $tag = Tag::create(['name' => Str::random()]);
<add> $post = Post::create(['title' => Str::random()]);
<add>
<add> DB::table('posts_tags')->insert([
<add> ['post_id' => $post->id, 'tag_id' => $tag->id, 'flag' => 'foo'],
<add> ]);
<add>
<add> $relationTag = $post->tags()->wherePivotIn('flag', ['foo'])->first();
<add> $this->assertEquals($relationTag->getAttributes(), $tag->getAttributes());
<add> }
<add>
<ide> public function test_can_update_existing_pivot()
<ide> {
<ide> $tag = Tag::create(['name' => Str::random()]); | 1 |
Java | Java | fix broken test missed in merge | c263cbfbe486d7712b9e46b80ed151c1eda98c74 | <ide><path>integration-tests/src/test/java/org/springframework/context/annotation/jsr330/ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests.java
<ide> else if (annDef.getMetadata().getMetaAnnotationTypes(type).contains(jakarta.inje
<ide> metadata.setScopedProxyMode(scopedProxyMode);
<ide> break;
<ide> }
<del> else if (type.startsWith("javax.inject")) {
<add> else if (type.startsWith("jakarta.inject")) {
<ide> metadata.setScopeName(BeanDefinition.SCOPE_PROTOTYPE);
<ide> }
<ide> } | 1 |
Java | Java | consolidate annotation processing constants | 2bc3527f76247a3b8fd81ba5373b4b155e3a48b8 | <ide><path>org.springframework.context/src/main/java/org/springframework/cache/config/AnnotationDrivenCacheBeanDefinitionParser.java
<ide>
<ide> package org.springframework.cache.config;
<ide>
<add>import static org.springframework.context.annotation.AnnotationConfigUtils.CACHE_ADVISOR_BEAN_NAME;
<add>import static org.springframework.context.annotation.AnnotationConfigUtils.CACHE_ASPECT_BEAN_NAME;
<add>import static org.springframework.context.annotation.AnnotationConfigUtils.CACHE_ASPECT_CLASS_NAME;
<add>
<ide> import org.springframework.aop.config.AopNamespaceUtils;
<ide> import org.springframework.beans.factory.config.BeanDefinition;
<ide> import org.springframework.beans.factory.config.RuntimeBeanReference;
<ide> class AnnotationDrivenCacheBeanDefinitionParser implements BeanDefinitionParser
<ide> private static final String DEFAULT_CACHE_MANAGER_BEAN_NAME = "cacheManager";
<ide>
<ide>
<del> /**
<del> * The bean name of the internally managed cache advisor (mode="proxy").
<del> */
<del> public static final String CACHE_ADVISOR_BEAN_NAME = "org.springframework.cache.config.internalCacheAdvisor";
<del>
<del> /**
<del> * The bean name of the internally managed cache aspect (mode="aspectj").
<del> */
<del> public static final String CACHE_ASPECT_BEAN_NAME = "org.springframework.cache.config.internalCacheAspect";
<del>
<del> private static final String CACHE_ASPECT_CLASS_NAME = "org.springframework.cache.aspectj.AnnotationCacheAspect";
<del>
<ide> /**
<ide> * Parses the '<code><cache:annotation-driven/></code>' tag. Will
<ide> * {@link AopNamespaceUtils#registerAutoProxyCreatorIfNecessary register an AutoProxyCreator}
<ide><path>org.springframework.context/src/main/java/org/springframework/context/annotation/AnnotationConfigUtils.java
<ide> public class AnnotationConfigUtils {
<ide> public static final String COMMON_ANNOTATION_PROCESSOR_BEAN_NAME =
<ide> "org.springframework.context.annotation.internalCommonAnnotationProcessor";
<ide>
<add> /**
<add> * The bean name of the internally managed Scheduled annotation processor.
<add> */
<add> public static final String SCHEDULED_ANNOTATION_PROCESSOR_BEAN_NAME =
<add> "org.springframework.context.annotation.internalScheduledAnnotationProcessor";
<add>
<add> /**
<add> * The bean name of the internally managed Async annotation processor.
<add> */
<add> public static final String ASYNC_ANNOTATION_PROCESSOR_BEAN_NAME =
<add> "org.springframework.context.annotation.internalAsyncAnnotationProcessor";
<add>
<add> /**
<add> * The bean name of the internally managed AspectJ async execution aspect.
<add> */
<add> public static final String ASYNC_EXECUTION_ASPECT_BEAN_NAME =
<add> "org.springframework.scheduling.config.internalAsyncExecutionAspect";
<add>
<add> /**
<add> * The class name of the AspectJ async execution aspect.
<add> */
<add> public static final String ASYNC_EXECUTION_ASPECT_CLASS_NAME =
<add> "org.springframework.scheduling.aspectj.AnnotationAsyncExecutionAspect";
<add>
<add> /**
<add> * The bean name of the internally managed cache advisor.
<add> */
<add> public static final String CACHE_ADVISOR_BEAN_NAME =
<add> "org.springframework.cache.config.internalCacheAdvisor";
<add>
<add> /**
<add> * The bean name of the internally managed cache aspect.
<add> */
<add> public static final String CACHE_ASPECT_BEAN_NAME =
<add> "org.springframework.cache.config.internalCacheAspect";
<add>
<add> /**
<add> * The class name of the AspectJ caching aspect.
<add> */
<add> public static final String CACHE_ASPECT_CLASS_NAME =
<add> "org.springframework.cache.aspectj.AnnotationCacheAspect";
<add>
<ide> /**
<ide> * The bean name of the internally managed JPA annotation processor.
<ide> */
<ide><path>org.springframework.context/src/main/java/org/springframework/scheduling/config/AnnotationDrivenBeanDefinitionParser.java
<ide> import org.springframework.beans.factory.support.BeanDefinitionRegistry;
<ide> import org.springframework.beans.factory.xml.BeanDefinitionParser;
<ide> import org.springframework.beans.factory.xml.ParserContext;
<add>import org.springframework.context.annotation.AnnotationConfigUtils;
<ide> import org.springframework.util.StringUtils;
<ide>
<ide> /**
<ide> * @author Mark Fisher
<ide> * @author Juergen Hoeller
<ide> * @author Ramnivas Laddad
<add> * @author Chris Beams
<ide> * @since 3.0
<ide> */
<ide> public class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
<ide>
<ide> /**
<ide> * The bean name of the internally managed async annotation processor (mode="proxy").
<add> * @deprecated as of Spring 3.1 in favor of
<add> * {@link AnnotationConfigUtils#ASYNC_ANNOTATION_PROCESSOR_BEAN_NAME}
<ide> */
<add> @Deprecated
<ide> public static final String ASYNC_ANNOTATION_PROCESSOR_BEAN_NAME =
<del> "org.springframework.scheduling.annotation.internalAsyncAnnotationProcessor";
<add> AnnotationConfigUtils.ASYNC_ANNOTATION_PROCESSOR_BEAN_NAME;
<ide>
<ide> /**
<ide> * The bean name of the internally managed transaction aspect (mode="aspectj").
<add> * @deprecated as of Spring 3.1 in favor of
<add> * {@link AnnotationConfigUtils#ASYNC_EXECUTION_ASPECT_BEAN_NAME}
<ide> */
<add> @Deprecated
<ide> public static final String ASYNC_EXECUTION_ASPECT_BEAN_NAME =
<del> "org.springframework.scheduling.config.internalAsyncExecutionAspect";
<del>
<del> private static final String ASYNC_EXECUTION_ASPECT_CLASS_NAME =
<del> "org.springframework.scheduling.aspectj.AnnotationAsyncExecutionAspect";
<add> AnnotationConfigUtils.ASYNC_EXECUTION_ASPECT_BEAN_NAME;
<ide>
<ide> /**
<ide> * The bean name of the internally managed scheduled annotation processor.
<add> * @deprecated as of Spring 3.1 in favor of
<add> * {@link AnnotationConfigUtils#SCHEDULED_ANNOTATION_PROCESSOR_BEAN_NAME}
<ide> */
<add> @Deprecated
<ide> public static final String SCHEDULED_ANNOTATION_PROCESSOR_BEAN_NAME =
<del> "org.springframework.scheduling.annotation.internalScheduledAnnotationProcessor";
<add> AnnotationConfigUtils.SCHEDULED_ANNOTATION_PROCESSOR_BEAN_NAME;
<ide>
<ide>
<ide> public BeanDefinition parse(Element element, ParserContext parserContext) {
<ide> public BeanDefinition parse(Element element, ParserContext parserContext) {
<ide> }
<ide> else {
<ide> // mode="proxy"
<del> if (registry.containsBeanDefinition(ASYNC_ANNOTATION_PROCESSOR_BEAN_NAME)) {
<add> if (registry.containsBeanDefinition(AnnotationConfigUtils.ASYNC_ANNOTATION_PROCESSOR_BEAN_NAME)) {
<ide> parserContext.getReaderContext().error(
<ide> "Only one AsyncAnnotationBeanPostProcessor may exist within the context.", source);
<ide> }
<ide> public BeanDefinition parse(Element element, ParserContext parserContext) {
<ide> if (Boolean.valueOf(element.getAttribute(AopNamespaceUtils.PROXY_TARGET_CLASS_ATTRIBUTE))) {
<ide> builder.addPropertyValue("proxyTargetClass", true);
<ide> }
<del> registerPostProcessor(parserContext, builder, ASYNC_ANNOTATION_PROCESSOR_BEAN_NAME);
<add> registerPostProcessor(parserContext, builder, AnnotationConfigUtils.ASYNC_ANNOTATION_PROCESSOR_BEAN_NAME);
<ide> }
<ide> }
<ide>
<del> if (registry.containsBeanDefinition(SCHEDULED_ANNOTATION_PROCESSOR_BEAN_NAME)) {
<add> if (registry.containsBeanDefinition(AnnotationConfigUtils.SCHEDULED_ANNOTATION_PROCESSOR_BEAN_NAME)) {
<ide> parserContext.getReaderContext().error(
<ide> "Only one ScheduledAnnotationBeanPostProcessor may exist within the context.", source);
<ide> }
<ide> public BeanDefinition parse(Element element, ParserContext parserContext) {
<ide> if (StringUtils.hasText(scheduler)) {
<ide> builder.addPropertyReference("scheduler", scheduler);
<ide> }
<del> registerPostProcessor(parserContext, builder, SCHEDULED_ANNOTATION_PROCESSOR_BEAN_NAME);
<add> registerPostProcessor(parserContext, builder, AnnotationConfigUtils.SCHEDULED_ANNOTATION_PROCESSOR_BEAN_NAME);
<ide> }
<ide>
<ide> // Finally register the composite component.
<ide> public BeanDefinition parse(Element element, ParserContext parserContext) {
<ide> }
<ide>
<ide> private void registerAsyncExecutionAspect(Element element, ParserContext parserContext) {
<del> if (!parserContext.getRegistry().containsBeanDefinition(ASYNC_EXECUTION_ASPECT_BEAN_NAME)) {
<add> if (!parserContext.getRegistry().containsBeanDefinition(AnnotationConfigUtils.ASYNC_EXECUTION_ASPECT_BEAN_NAME)) {
<ide> BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(
<del> ASYNC_EXECUTION_ASPECT_CLASS_NAME);
<add> AnnotationConfigUtils.ASYNC_EXECUTION_ASPECT_CLASS_NAME);
<ide> builder.setFactoryMethod("aspectOf");
<ide> String executor = element.getAttribute("executor");
<ide> if (StringUtils.hasText(executor)) {
<ide> builder.addPropertyReference("executor", executor);
<ide> }
<ide> parserContext.registerBeanComponent(
<del> new BeanComponentDefinition(builder.getBeanDefinition(), ASYNC_EXECUTION_ASPECT_BEAN_NAME));
<add> new BeanComponentDefinition(builder.getBeanDefinition(),
<add> AnnotationConfigUtils.ASYNC_EXECUTION_ASPECT_BEAN_NAME));
<ide> }
<ide> }
<ide>
<ide><path>org.springframework.context/src/test/java/org/springframework/scheduling/config/AnnotationDrivenBeanDefinitionParserTests.java
<ide>
<ide> import org.springframework.beans.DirectFieldAccessor;
<ide> import org.springframework.context.ApplicationContext;
<add>import org.springframework.context.annotation.AnnotationConfigUtils;
<ide> import org.springframework.context.support.ClassPathXmlApplicationContext;
<ide>
<ide> /**
<ide> public void setup() {
<ide>
<ide> @Test
<ide> public void asyncPostProcessorRegistered() {
<del> assertTrue(context.containsBean(
<del> AnnotationDrivenBeanDefinitionParser.ASYNC_ANNOTATION_PROCESSOR_BEAN_NAME));
<add> assertTrue(context.containsBean(AnnotationConfigUtils.ASYNC_ANNOTATION_PROCESSOR_BEAN_NAME));
<ide> }
<ide>
<ide> @Test
<ide> public void scheduledPostProcessorRegistered() {
<ide> assertTrue(context.containsBean(
<del> AnnotationDrivenBeanDefinitionParser.SCHEDULED_ANNOTATION_PROCESSOR_BEAN_NAME));
<add> AnnotationConfigUtils.SCHEDULED_ANNOTATION_PROCESSOR_BEAN_NAME));
<ide> }
<ide>
<ide> @Test
<ide> public void asyncPostProcessorExecutorReference() {
<ide> Object executor = context.getBean("testExecutor");
<del> Object postProcessor = context.getBean(AnnotationDrivenBeanDefinitionParser.ASYNC_ANNOTATION_PROCESSOR_BEAN_NAME);
<add> Object postProcessor = context.getBean(AnnotationConfigUtils.ASYNC_ANNOTATION_PROCESSOR_BEAN_NAME);
<ide> assertSame(executor, new DirectFieldAccessor(postProcessor).getPropertyValue("executor"));
<ide> }
<ide>
<ide> @Test
<ide> public void scheduledPostProcessorSchedulerReference() {
<ide> Object scheduler = context.getBean("testScheduler");
<del> Object postProcessor = context.getBean(AnnotationDrivenBeanDefinitionParser.SCHEDULED_ANNOTATION_PROCESSOR_BEAN_NAME);
<add> Object postProcessor = context.getBean(AnnotationConfigUtils.SCHEDULED_ANNOTATION_PROCESSOR_BEAN_NAME);
<ide> assertSame(scheduler, new DirectFieldAccessor(postProcessor).getPropertyValue("scheduler"));
<ide> }
<ide>
<ide><path>org.springframework.transaction/src/main/java/org/springframework/transaction/config/AnnotationDrivenBeanDefinitionParser.java
<ide> import org.springframework.beans.factory.xml.ParserContext;
<ide> import org.springframework.context.config.AbstractSpecificationBeanDefinitionParser;
<ide> import org.springframework.context.config.FeatureSpecification;
<add>import org.springframework.transaction.annotation.TransactionManagementCapability;
<ide> import org.w3c.dom.Element;
<ide>
<ide> /**
<ide> * @author Rob Harrop
<ide> * @author Chris Beams
<ide> * @since 2.0
<del> * @see TxAnnotationDriven
<ide> */
<ide> class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
<ide>
<ide> /**
<ide> * The bean name of the internally managed transaction advisor (mode="proxy").
<add> * @deprecated as of Spring 3.1 in favor of
<add> * {@link TransactionManagementCapability#TRANSACTION_ADVISOR_BEAN_NAME}
<ide> */
<add> @Deprecated
<ide> public static final String TRANSACTION_ADVISOR_BEAN_NAME =
<del> TxAnnotationDrivenExecutor.TRANSACTION_ADVISOR_BEAN_NAME;
<add> TransactionManagementCapability.TRANSACTION_ADVISOR_BEAN_NAME;
<ide>
<ide> /**
<ide> * The bean name of the internally managed transaction aspect (mode="aspectj").
<add> * @deprecated as of Spring 3.1 in favor of
<add> * {@link TransactionManagementCapability#TRANSACTION_ASPECT_BEAN_NAME}
<ide> */
<add> @Deprecated
<ide> public static final String TRANSACTION_ASPECT_BEAN_NAME =
<del> TxAnnotationDrivenExecutor.TRANSACTION_ASPECT_BEAN_NAME;
<add> TransactionManagementCapability.TRANSACTION_ASPECT_BEAN_NAME;
<ide>
<ide>
<ide> /** | 5 |
PHP | PHP | fix return type of pool | be961c33d08d3892c797b6bc883c8c7a1e561a3f | <ide><path>src/Illuminate/Http/Client/Factory.php
<ide> * @method \Illuminate\Http\Client\PendingRequest dump()
<ide> * @method \Illuminate\Http\Client\PendingRequest dd()
<ide> * @method \Illuminate\Http\Client\PendingRequest async()
<del> * @method \Illuminate\Http\Client\Pool pool(callable $callback)
<add> * @method array pool(callable $callback)
<ide> * @method \Illuminate\Http\Client\Response delete(string $url, array $data = [])
<ide> * @method \Illuminate\Http\Client\Response get(string $url, array $query = [])
<ide> * @method \Illuminate\Http\Client\Response head(string $url, array $query = [])
<ide><path>src/Illuminate/Support/Facades/Http.php
<ide> * @method static \Illuminate\Http\Client\PendingRequest dump()
<ide> * @method static \Illuminate\Http\Client\PendingRequest dd()
<ide> * @method static \Illuminate\Http\Client\PendingRequest async()
<del> * @method static \Illuminate\Http\Client\Pool pool(callable $callback)
<add> * @method static array pool(callable $callback)
<ide> * @method static \Illuminate\Http\Client\Response delete(string $url, array $data = [])
<ide> * @method static \Illuminate\Http\Client\Response get(string $url, array $query = [])
<ide> * @method static \Illuminate\Http\Client\Response head(string $url, array $query = []) | 2 |
Text | Text | add 2 new commands and some word edits | 97616fe6fa7c43440332e6fca11672698266fd96 | <ide><path>guide/english/terminal-commandline/macos-terminal/index.md
<ide> title: Mac OS Terminal
<ide> Most of the time users interact through a Graphical User Interface to interact with the computer. You use the mouse to point and click to open, move, or create new files or open applications. But, you can also use the Terminal Application to interact with your machine through written commands. When you use the terminal, it allows you to dig deeper and customize in a way not possible through the GUI.
<ide>
<ide> ### Opening the Terminal and Navigating Directories
<del>Your terminal exists in the Applications directory. Open your Terminal app. You should see a prompt in the terminal window. it shoudl have the computer's name (ABC's Macbook), followed by the User name (ABC), and then a '$.' If you are in the root directory, the last character will be a '#.'
<add>Your terminal exists in the Applications directory. Open your Terminal app. You should see a prompt in the terminal window. It should have the computer's name (ABC's Macbook), followed by the User name (ABC), and then a '$'. If you are in the root directory, the last character will be a '#'.
<ide>
<del>To see what directory you are working in, use ```pwd``` which stands for "print working directory"
<del>Directory is another word for folder.
<add>To see what directory you are working in, just type the command:
<ide>
<del>If you want to list the directory's contents, use ```ls```
<add>```
<add>pwd
<add>```
<ide>
<del>To change directories, use ```cd <directory_path>``` which stands for change directory and replace the angle brackets with the appropriate path name.
<del>If you are currently in `Documents` and want to move into the directory/folder `hello_world` which is inside `Documents` use `cd hello_world`
<add>`pwd` stands for "Print Working Directory". Directory is another word for folder.
<add>
<add>If you want to list the contents of your directory, use the command:
<add>
<add>```
<add>ls
<add>```
<add>
<add>To switch to a new directory you, use the command:
<add>
<add>```
<add>cd <directory_name>
<add>```
<add>
<add>`cd` stands for "Change Directory". ```cd``` is then followed by the directory's name you wish to switch into.
<ide>
<ide> Here is a list of common commands:
<ide>
<ide> Command | Usage
<ide> ------------ | -------------
<ide> `pwd` | Print Working Directory (Where Am I? )
<ide> `ls` | List contents of current directory
<del>`mkdir <directoryname>` | Create a new directory
<del>`touch <filename>` | Create a new file
<del>`cp <filetobecopied> <nameforcopiedfile>` | Copy a file
<add>`mkdir <directory_name>` | Create a new directory
<add>`rmdir` | Remove directory
<add>`touch <file_name>` | Create a new file
<add>`cp <file_to_be_copied> <name_for_copied_file>` | Copy a file
<add>`mv` | Rename a file/directory
<ide> `rm <filename>` | Remove a file
<del>`rm -rf <directoryname>` | Forcibly remove a directory
<add>`rm -rf <directory_name>` | Forcibly remove a directory
<ide>
<ide> ### Usage Examples
<ide>
<ide> Some of the aforementioned commands aren't clear without examples. Below are a few usage examples to help provide you with some context.
<ide>
<ide> #### Making a Directory
<ide>
<del>```mkdir #YOUR-NEW-FOLDER-NAME-HERE```
<add>```
<add>mkdir folder_name
<add>```
<ide>
<ide> #### Making a File
<ide>
<del>``` touch YOUR-FILE-NAME.JS```
<add>```
<add>touch file_name.js
<add>```
<ide>
<del>You can make a file with any extension you choose. As long as it is in an a format accepted by the folder or machine.
<add>You can make a file with any extension you choose. As long as it is in a format accepted by the folder or machine.
<ide>
<ide> #### Copying a File
<ide>
<ide> Use the following syntax to copy a file from the terminal:
<ide>
<ide> For example, if we have a file, _'test.txt'_ that is stored in our _/Desktop_ directory and we want to copy it to the _/Documents_ folder, our command would look like this:
<ide>
<del> cp ~/Desktop/test.txt ~/Documents
<add>```
<add>cp ~/Desktop/test.txt ~/Documents
<add>```
<ide>
<ide> #### Deleting a File
<ide>
<del>Use the following syntax to delete a file
<add>Use the following syntax to delete a file.
<ide>
<del>**rm _#PATH_TO_FILE_**
<add>```
<add>rm <path_to_file>
<add>```
<ide>
<ide> #### Detect which process is using the port you want to use
<del>``` lsof -i :<PORT> ```
<add>```
<add>lsof -i :<port>
<add>```
<ide>
<ide> #### Terminate the process which uses the port you want to use
<del>``` kill <PID> ```
<add>```
<add>kill <pid>
<add>```
<ide>
<ide>
<ide> #### Previewing file | 1 |
Text | Text | remove unused link definition | ef8acccfde4f4916b62deb8f15a5930a2bdac546 | <ide><path>doc/api/fs.md
<ide> The following constants are meant for use with the [`fs.Stats`][] object's
<ide> [`kqueue`]: https://www.freebsd.org/cgi/man.cgi?kqueue
<ide> [`net.Socket`]: net.html#net_class_net_socket
<ide> [`stat()`]: fs.html#fs_fs_stat_path_callback
<del>[`util.inspect(stats)`]: util.html#util_util_inspect_object_options
<ide> [`util.promisify()`]: util.html#util_util_promisify_original
<ide> [Caveats]: #fs_caveats
<ide> [Common System Errors]: errors.html#errors_common_system_errors | 1 |
Ruby | Ruby | add closederror message to the initializer | 90ecad0bc944fc3adb847c0c754d8f0dc2bed4b5 | <ide><path>actionpack/lib/action_dispatch.rb
<ide> module ActionDispatch
<ide> autoload :Static
<ide> end
<ide>
<add> autoload :ClosedError, 'action_dispatch/middleware/closed_error'
<ide> autoload :MiddlewareStack, 'action_dispatch/middleware/stack'
<ide> autoload :Routing
<ide>
<ide><path>actionpack/lib/action_dispatch/middleware/closed_error.rb
<add>module ActionDispatch
<add> class ClosedError < StandardError #:nodoc:
<add> def initialize(kind)
<add> super "Cannot modify #{kind} because it was closed. This means it was already streamed back to the client or converted to HTTP headers."
<add> end
<add> end
<add>end
<ide><path>actionpack/lib/action_dispatch/middleware/flash.rb
<ide> def initialize(flash)
<ide> def close!; @closed = true end
<ide>
<ide> def []=(k, v)
<del> raise ClosedError, "Cannot modify flash because it was closed. This means it was already streamed back to the client or converted to HTTP headers." if closed?
<add> raise ClosedError, :flash if closed?
<ide> @flash[k] = v
<ide> @flash.discard(k)
<ide> v
<ide> def initialize #:nodoc:
<ide> def close!; @closed = true end
<ide>
<ide> def []=(k, v) #:nodoc:
<del> raise ClosedError, "Cannot modify flash because it was closed. This means it was already streamed back to the client or converted to HTTP headers." if closed?
<add> raise ClosedError, :flash if closed?
<ide> keep(k)
<ide> super
<ide> end
<ide> def call(env)
<ide> end
<ide> end
<ide> end
<del>
<del> class ClosedError < StandardError #:nodoc:
<del> end
<ide> end | 3 |
Go | Go | fix ci failure due to conflicting merges | 3528fd9830cae0c3205dec45c6751a178fb08070 | <ide><path>libnetwork/drivers/bridge/bridge_test.go
<ide> func TestCreateFullOptions(t *testing.T) {
<ide> }
<ide>
<ide> func TestCreateNoConfig(t *testing.T) {
<del> defer osl.SetupTestOSContext(t)()
<add> defer testutils.SetupTestOSContext(t)()
<ide> d := newDriver()
<ide>
<ide> netconfig := &networkConfiguration{BridgeName: DefaultBridgeName} | 1 |
Python | Python | avoid pymodulelevel, deprecated in sphinx 4 | e5158d9ceb22ad072da701337de5ba19efda030c | <ide><path>celery/contrib/sphinx.py
<ide> """
<ide> from __future__ import absolute_import, unicode_literals
<ide>
<del>from sphinx.domains.python import PyModulelevel
<add>from sphinx.domains.python import PyFunction
<ide> from sphinx.ext.autodoc import FunctionDocumenter
<ide>
<ide> from celery.app.task import BaseTask
<ide> def check_module(self):
<ide> return super(TaskDocumenter, self).check_module()
<ide>
<ide>
<del>class TaskDirective(PyModulelevel):
<add>class TaskDirective(PyFunction):
<ide> """Sphinx task directive."""
<ide>
<ide> def get_signature_prefix(self, sig): | 1 |
Javascript | Javascript | fix linting issues | 30307231e63a57d8bedac103be0ad88d4e33e95f | <ide><path>src/main-process/file-recovery-service.js
<ide> export default class FileRecoveryService {
<ide>
<ide> if (!this.observedWindows.has(window)) {
<ide> this.observedWindows.add(window)
<del> window.webContents.on("crashed", () => this.recoverFilesForWindow(window))
<del> window.on("closed", () => {
<add> window.webContents.on('crashed', () => this.recoverFilesForWindow(window))
<add> window.on('closed', () => {
<ide> this.observedWindows.delete(window)
<ide> this.recoveryFilesByWindow.delete(window)
<ide> }) | 1 |
Javascript | Javascript | add clearer invariant in processupdates | 945d041160cb2fca3bde2c2422c46e6fe99af4dd | <ide><path>src/browser/ui/dom/DOMChildrenOperations.js
<ide> var Danger = require('Danger');
<ide> var ReactMultiChildUpdateTypes = require('ReactMultiChildUpdateTypes');
<ide>
<ide> var getTextContentAccessor = require('getTextContentAccessor');
<add>var invariant = require('invariant');
<ide>
<ide> /**
<ide> * The DOM property to use when setting text content.
<ide> var DOMChildrenOperations = {
<ide> var updatedChild = update.parentNode.childNodes[updatedIndex];
<ide> var parentID = update.parentID;
<ide>
<add> invariant(
<add> updatedChild,
<add> 'processUpdates(): Unable to find child %s of element. This ' +
<add> 'probably means the DOM was unexpectedly mutated (e.g., by the ' +
<add> 'browser), usually due to forgetting a <tbody> when using tables ' +
<add> 'or nesting <p> or <a> tags. Try inspecting the child nodes of the ' +
<add> 'element with React ID `%s`.',
<add> updatedIndex,
<add> parentID
<add> );
<add>
<ide> initialChildren = initialChildren || {};
<ide> initialChildren[parentID] = initialChildren[parentID] || [];
<ide> initialChildren[parentID][updatedIndex] = updatedChild; | 1 |
Python | Python | add scaffolds to default layer imports | 3bb3f185c14c6c2db8131cfbb438ed06b5633169 | <ide><path>official/nlp/modeling/layers/__init__.py
<ide> from official.nlp.modeling.layers.position_embedding import PositionEmbedding
<ide> from official.nlp.modeling.layers.self_attention_mask import SelfAttentionMask
<ide> from official.nlp.modeling.layers.transformer import Transformer
<add>from official.nlp.modeling.layers.transformer_scaffold import TransformerScaffold
<ide><path>official/nlp/modeling/networks/__init__.py
<ide> """Networks package definition."""
<ide> from official.nlp.modeling.networks.albert_transformer_encoder import AlbertTransformerEncoder
<ide> from official.nlp.modeling.networks.classification import Classification
<add>from official.nlp.modeling.networks.encoder_scaffold import EncoderScaffold
<ide> from official.nlp.modeling.networks.masked_lm import MaskedLM
<ide> from official.nlp.modeling.networks.span_labeling import SpanLabeling
<ide> from official.nlp.modeling.networks.transformer_encoder import TransformerEncoder | 2 |
Javascript | Javascript | use correct property name | 5596b5a1ad299dcd622acac3585f6ef588826da3 | <ide><path>lib/Module.js
<ide> function Module() {
<ide> this.debugId = debugId++;
<ide> this.lastId = -1;
<ide> this.id = null;
<del> this.portableIdentifier = null;
<add> this.portableId = null;
<ide> this.index = null;
<ide> this.index2 = null;
<ide> this.used = null; | 1 |
Javascript | Javascript | replace var with let/const | deb412743ec2da20bd70f2b749fc7b2344880acd | <ide><path>lib/child_process.js
<ide> function fork(modulePath /* , args, options */) {
<ide> validateString(modulePath, 'modulePath');
<ide>
<ide> // Get options and args arguments.
<del> var execArgv;
<del> var options = {};
<del> var args = [];
<del> var pos = 1;
<add> let execArgv;
<add> let options = {};
<add> let args = [];
<add> let pos = 1;
<ide> if (pos < arguments.length && Array.isArray(arguments[pos])) {
<ide> args = arguments[pos++];
<ide> }
<ide> function execFile(file /* , args, options, callback */) {
<ide> windowsVerbatimArguments: !!options.windowsVerbatimArguments
<ide> });
<ide>
<del> var encoding;
<add> let encoding;
<ide> const _stdout = [];
<ide> const _stderr = [];
<ide> if (options.encoding !== 'buffer' && Buffer.isEncoding(options.encoding)) {
<ide> encoding = options.encoding;
<ide> } else {
<ide> encoding = null;
<ide> }
<del> var stdoutLen = 0;
<del> var stderrLen = 0;
<del> var killed = false;
<del> var exited = false;
<del> var timeoutId;
<add> let stdoutLen = 0;
<add> let stderrLen = 0;
<add> let killed = false;
<add> let exited = false;
<add> let timeoutId;
<ide>
<del> var ex = null;
<add> let ex = null;
<ide>
<del> var cmd = file;
<add> let cmd = file;
<ide>
<ide> function exithandler(code, signal) {
<ide> if (exited) return;
<ide> function execFile(file /* , args, options, callback */) {
<ide> if (!callback) return;
<ide>
<ide> // merge chunks
<del> var stdout;
<del> var stderr;
<add> let stdout;
<add> let stderr;
<ide> if (encoding ||
<ide> (
<ide> child.stdout &&
<ide> function spawnSync(file, args, options) {
<ide> options.stdio = getValidStdio(options.stdio || 'pipe', true).stdio;
<ide>
<ide> if (options.input) {
<del> var stdin = options.stdio[0] = { ...options.stdio[0] };
<add> const stdin = options.stdio[0] = { ...options.stdio[0] };
<ide> stdin.input = options.input;
<ide> }
<ide>
<ide> // We may want to pass data in on any given fd, ensure it is a valid buffer
<del> for (var i = 0; i < options.stdio.length; i++) {
<del> var input = options.stdio[i] && options.stdio[i].input;
<add> for (let i = 0; i < options.stdio.length; i++) {
<add> const input = options.stdio[i] && options.stdio[i].input;
<ide> if (input != null) {
<del> var pipe = options.stdio[i] = { ...options.stdio[i] };
<add> const pipe = options.stdio[i] = { ...options.stdio[i] };
<ide> if (isArrayBufferView(input)) {
<ide> pipe.input = input;
<ide> } else if (typeof input === 'string') {
<ide> function spawnSync(file, args, options) {
<ide>
<ide>
<ide> function checkExecSyncError(ret, args, cmd) {
<del> var err;
<add> let err;
<ide> if (ret.error) {
<ide> err = ret.error;
<ide> } else if (ret.status !== 0) {
<del> var msg = 'Command failed: ';
<add> let msg = 'Command failed: ';
<ide> msg += cmd || args.join(' ');
<ide> if (ret.stderr && ret.stderr.length > 0)
<ide> msg += `\n${ret.stderr.toString()}`; | 1 |
Javascript | Javascript | use euclideanmodulo in mathutils.pingpong | c214c8a5ba8a638a72494e81758a858d25059942 | <ide><path>src/math/MathUtils.js
<ide> const MathUtils = {
<ide>
<ide> pingPong: function ( x, length = 1 ) {
<ide>
<del> return length - Math.abs( x % ( length * 2 ) - length );
<add> return length - Math.abs( MathUtils.euclideanModulo( x, length * 2 ) - length );
<ide>
<ide> },
<ide>
<ide><path>test/unit/src/math/MathUtils.tests.js
<ide> export default QUnit.module( 'Maths', () => {
<ide>
<ide> assert.strictEqual( MathUtils.pingPong( 2.5 ), 0.5, "Value at 2.5 is 0.5" );
<ide> assert.strictEqual( MathUtils.pingPong( 2.5, 2 ), 1.5, "Value at 2.5 with length of 2 is 1.5" );
<del> assert.strictEqual( MathUtils.pingPong( - 2 ), 0, "Value at -2 is 0" );
<add> assert.strictEqual( MathUtils.pingPong( - 1.5 ), 0.5, "Value at -1.5 is 0.5" );
<ide>
<ide> } );
<ide> | 2 |
Python | Python | add `python_requires` metadata for pypi | 732c5b0509a8138a504d48a8c5e0be493f1ed603 | <ide><path>setup.py
<ide> include_package_data=True,
<ide> zip_safe=False,
<ide> platforms='any',
<add> python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*',
<ide> install_requires=[
<ide> 'Werkzeug>=0.14',
<ide> 'Jinja2>=2.10', | 1 |
Javascript | Javascript | add services stamp | fe16a74faabe3932dbd63a05e71c08885464d5b7 | <ide><path>common/app/Cat.js
<ide> import { Cat } from 'thundercats';
<add>import stamp from 'stampit';
<add>import { Disposable, Observable } from 'rx';
<ide>
<ide> import { AppActions, AppStore } from './flux';
<del>import { HikesActions, HikesStore } from './routes/Hikes/flux';
<add>import { HikesActions } from './routes/Hikes/flux';
<ide> import { JobActions, JobsStore} from './routes/Jobs/flux';
<ide>
<del>export default Cat()
<del> .init(({ instance: cat, args: [services] }) => {
<del> cat.register(AppActions, null, services);
<del> cat.register(AppStore, null, cat);
<add>export default Cat().init(({ instance: cat, args: [services] }) => {
<add> const serviceStamp = stamp({
<add> methods: {
<add> readService$(resource, params, config) {
<ide>
<del> cat.register(HikesActions, null, services);
<del> cat.register(HikesStore, null, cat);
<add> return Observable.create(function(observer) {
<add> services.read(resource, params, config, (err, res) => {
<add> if (err) {
<add> observer.onError(err);
<add> return observer.onCompleted();
<add> }
<ide>
<del> cat.register(JobActions, null, cat, services);
<del> cat.register(JobsStore, null, cat);
<add> observer.onNext(res);
<add> observer.onCompleted();
<add> });
<add>
<add> return Disposable.create(function() {
<add> observer.onCompleted();
<add> });
<add> });
<add> }
<add> }
<ide> });
<add>
<add> cat.register(HikesActions.compose(serviceStamp), null, services);
<add> cat.register(AppActions.compose(serviceStamp), null, services);
<add> cat.register(AppStore, null, cat);
<add>
<add>
<add> cat.register(JobActions, null, cat, services);
<add> cat.register(JobsStore.compose(serviceStamp), null, cat);
<add>}); | 1 |
Text | Text | add missing commas | 8296fe8142d28b7d23c42d6669322720d802ea3e | <ide><path>docs/recipes/reducers/RefactoringReducersExample.md
<ide> function editTodo(todosState, action) {}
<ide>
<ide> const todosReducer = createReducer([], {
<ide> 'ADD_TODO' : addTodo,
<del> 'TOGGLE_TODO' : toggleTodo
<add> 'TOGGLE_TODO' : toggleTodo,
<ide> 'EDIT_TODO' : editTodo
<ide> });
<ide>
<ide> function editTodo(todosState, action) {
<ide> // Slice reducer
<ide> const todosReducer = createReducer([], {
<ide> 'ADD_TODO' : addTodo,
<del> 'TOGGLE_TODO' : toggleTodo
<add> 'TOGGLE_TODO' : toggleTodo,
<ide> 'EDIT_TODO' : editTodo
<ide> });
<ide> | 1 |
Javascript | Javascript | avoid jquery data calls when there is no data | 9efb0d5ee961b57c8fc144a3138a15955e4010e2 | <ide><path>src/jqLite.js
<ide> function jqLiteAcceptsData(node) {
<ide> return nodeType === NODE_TYPE_ELEMENT || !nodeType || nodeType === NODE_TYPE_DOCUMENT;
<ide> }
<ide>
<add>function jqLiteHasData(node) {
<add> for (var key in jqCache[node.ng339]) {
<add> return true;
<add> }
<add> return false;
<add>}
<add>
<ide> function jqLiteBuildFragment(html, context) {
<ide> var tmp, tag, wrap,
<ide> fragment = context.createDocumentFragment(),
<ide> function getAliasedAttrName(element, name) {
<ide>
<ide> forEach({
<ide> data: jqLiteData,
<del> removeData: jqLiteRemoveData
<add> removeData: jqLiteRemoveData,
<add> hasData: jqLiteHasData
<ide> }, function(fn, name) {
<ide> JQLite[name] = fn;
<ide> });
<ide><path>src/ng/compile.js
<ide> function $CompileProvider($provide, $$sanitizeUriProvider) {
<ide> var fragment = document.createDocumentFragment();
<ide> fragment.appendChild(firstElementToRemove);
<ide>
<del> // Copy over user data (that includes Angular's $scope etc.). Don't copy private
<del> // data here because there's no public interface in jQuery to do that and copying over
<del> // event listeners (which is the main use of private data) wouldn't work anyway.
<del> jqLite(newNode).data(jqLite(firstElementToRemove).data());
<del>
<del> // Remove data of the replaced element. We cannot just call .remove()
<del> // on the element it since that would deallocate scope that is needed
<del> // for the new node. Instead, remove the data "manually".
<del> if (!jQuery) {
<del> delete jqLite.cache[firstElementToRemove[jqLite.expando]];
<del> } else {
<del> // jQuery 2.x doesn't expose the data storage. Use jQuery.cleanData to clean up after
<del> // the replaced element. The cleanData version monkey-patched by Angular would cause
<del> // the scope to be trashed and we do need the very same scope to work with the new
<del> // element. However, we cannot just cache the non-patched version and use it here as
<del> // that would break if another library patches the method after Angular does (one
<del> // example is jQuery UI). Instead, set a flag indicating scope destroying should be
<del> // skipped this one time.
<del> skipDestroyOnNextJQueryCleanData = true;
<del> jQuery.cleanData([firstElementToRemove]);
<add> if (jqLite.hasData(firstElementToRemove)) {
<add> // Copy over user data (that includes Angular's $scope etc.). Don't copy private
<add> // data here because there's no public interface in jQuery to do that and copying over
<add> // event listeners (which is the main use of private data) wouldn't work anyway.
<add> jqLite(newNode).data(jqLite(firstElementToRemove).data());
<add>
<add> // Remove data of the replaced element. We cannot just call .remove()
<add> // on the element it since that would deallocate scope that is needed
<add> // for the new node. Instead, remove the data "manually".
<add> if (!jQuery) {
<add> delete jqLite.cache[firstElementToRemove[jqLite.expando]];
<add> } else {
<add> // jQuery 2.x doesn't expose the data storage. Use jQuery.cleanData to clean up after
<add> // the replaced element. The cleanData version monkey-patched by Angular would cause
<add> // the scope to be trashed and we do need the very same scope to work with the new
<add> // element. However, we cannot just cache the non-patched version and use it here as
<add> // that would break if another library patches the method after Angular does (one
<add> // example is jQuery UI). Instead, set a flag indicating scope destroying should be
<add> // skipped this one time.
<add> skipDestroyOnNextJQueryCleanData = true;
<add> jQuery.cleanData([firstElementToRemove]);
<add> }
<ide> }
<ide>
<ide> for (var k = 1, kk = elementsToRemove.length; k < kk; k++) {
<ide><path>test/jqLiteSpec.js
<ide> describe('jqLite', function() {
<ide> it('should provide the non-wrapped data calls', function() {
<ide> var node = document.createElement('div');
<ide>
<add> expect(jqLite.hasData(node)).toBe(false);
<ide> expect(jqLite.data(node, "foo")).toBeUndefined();
<add> expect(jqLite.hasData(node)).toBe(false);
<ide>
<ide> jqLite.data(node, "foo", "bar");
<ide>
<add> expect(jqLite.hasData(node)).toBe(true);
<ide> expect(jqLite.data(node, "foo")).toBe("bar");
<ide> expect(jqLite(node).data("foo")).toBe("bar");
<ide>
<ide> describe('jqLite', function() {
<ide> jqLite.removeData(node);
<ide> jqLite.removeData(node);
<ide> expect(jqLite.data(node, "bar")).toBeUndefined();
<add>
<add> jqLite(node).remove();
<add> expect(jqLite.hasData(node)).toBe(false);
<ide> });
<ide>
<ide> it('should emit $destroy event if element removed via remove()', function() {
<ide><path>test/ng/compileSpec.js
<ide> describe('$compile', function() {
<ide> expect(privateData.events.click).toBeDefined();
<ide> expect(privateData.events.click[0]).toBeDefined();
<ide>
<add> //Ensure the angular $destroy event is still sent
<add> var destroyCount = 0;
<add> element.find("div").on("$destroy", function() { destroyCount++; });
<add>
<ide> $rootScope.$apply('xs = null');
<ide>
<add> expect(destroyCount).toBe(2);
<ide> expect(firstRepeatedElem.data('$scope')).not.toBeDefined();
<ide> privateData = jQuery._data(firstRepeatedElem[0]);
<ide> expect(privateData && privateData.events).not.toBeDefined();
<ide> describe('$compile', function() {
<ide>
<ide> testCleanup();
<ide>
<del> // The initial ng-repeat div is dumped after parsing hence we expect cleanData
<del> // count to be one larger than size of the iterated array.
<del> expect(cleanedCount).toBe(xs.length + 1);
<add> expect(cleanedCount).toBe(xs.length);
<ide>
<ide> // Restore the previous jQuery.cleanData.
<ide> jQuery.cleanData = currentCleanData; | 4 |
Javascript | Javascript | improve read/write speed with assert | 7393740c7b4c35205db27dbe3cfe03a624ee5704 | <ide><path>lib/buffer.js
<ide> Buffer.prototype.asciiWrite = function(string, offset) {
<ide> return this.write(string, offset, 'ascii');
<ide> };
<ide>
<del>Buffer.prototype.readUInt8 = function(offset, noAssert) {
<del> var buffer = this;
<ide>
<del> if (!noAssert) {
<del> assert.ok(offset !== undefined && offset !== null,
<del> 'missing offset');
<add>/*
<add> * Need to make sure that buffer isn't trying to write out of bounds.
<add> * This check is far too slow internally for fast buffers.
<add> */
<add>function checkOffset(offset, ext, length) {
<add> if ((offset % 1) !== 0 || offset < 0)
<add> throw new RangeError('offset is not uint');
<add> if (offset + ext > length)
<add> throw new RangeError('Trying to access beyond buffer length');
<add>}
<ide>
<del> assert.ok(offset < buffer.length,
<del> 'Trying to read beyond buffer length');
<del> }
<ide>
<del> return buffer[offset];
<add>Buffer.prototype.readUInt8 = function(offset, noAssert) {
<add> if (!noAssert)
<add> checkOffset(offset, 1, this.length);
<add> return this[offset];
<ide> };
<ide>
<del>function readUInt16(buffer, offset, isBigEndian, noAssert) {
<del> var val = 0;
<del>
<del>
<del> if (!noAssert) {
<del> assert.ok(typeof (isBigEndian) === 'boolean',
<del> 'missing or invalid endian');
<del>
<del> assert.ok(offset !== undefined && offset !== null,
<del> 'missing offset');
<del>
<del> assert.ok(offset + 1 < buffer.length,
<del> 'Trying to read beyond buffer length');
<del> }
<ide>
<add>function readUInt16(buffer, offset, isBigEndian) {
<add> var val = 0;
<ide> if (isBigEndian) {
<ide> val = buffer[offset] << 8;
<ide> val |= buffer[offset + 1];
<ide> function readUInt16(buffer, offset, isBigEndian, noAssert) {
<ide> return val;
<ide> }
<ide>
<add>
<ide> Buffer.prototype.readUInt16LE = function(offset, noAssert) {
<add> if (!noAssert)
<add> checkOffset(offset, 2, this.length);
<ide> return readUInt16(this, offset, false, noAssert);
<ide> };
<ide>
<add>
<ide> Buffer.prototype.readUInt16BE = function(offset, noAssert) {
<add> if (!noAssert)
<add> checkOffset(offset, 2, this.length);
<ide> return readUInt16(this, offset, true, noAssert);
<ide> };
<ide>
<add>
<ide> function readUInt32(buffer, offset, isBigEndian, noAssert) {
<ide> var val = 0;
<ide>
<del> if (!noAssert) {
<del> assert.ok(typeof (isBigEndian) === 'boolean',
<del> 'missing or invalid endian');
<del>
<del> assert.ok(offset !== undefined && offset !== null,
<del> 'missing offset');
<del>
<del> assert.ok(offset + 3 < buffer.length,
<del> 'Trying to read beyond buffer length');
<del> }
<del>
<ide> if (isBigEndian) {
<ide> val = buffer[offset + 1] << 16;
<ide> val |= buffer[offset + 2] << 8;
<ide> function readUInt32(buffer, offset, isBigEndian, noAssert) {
<ide> return val;
<ide> }
<ide>
<add>
<ide> Buffer.prototype.readUInt32LE = function(offset, noAssert) {
<add> if (!noAssert)
<add> checkOffset(offset, 4, this.length);
<ide> return readUInt32(this, offset, false, noAssert);
<ide> };
<ide>
<add>
<ide> Buffer.prototype.readUInt32BE = function(offset, noAssert) {
<add> if (!noAssert)
<add> checkOffset(offset, 4, this.length);
<ide> return readUInt32(this, offset, true, noAssert);
<ide> };
<ide>
<ide> Buffer.prototype.readUInt32BE = function(offset, noAssert) {
<ide> * (0x007f + 1) * -1
<ide> * (0x0080) * -1
<ide> */
<del>Buffer.prototype.readInt8 = function(offset, noAssert) {
<del> var buffer = this;
<del> var neg;
<ide>
<del> if (!noAssert) {
<del> assert.ok(offset !== undefined && offset !== null,
<del> 'missing offset');
<del>
<del> assert.ok(offset < buffer.length,
<del> 'Trying to read beyond buffer length');
<del> }
<del>
<del> neg = buffer[offset] & 0x80;
<del> if (!neg) {
<del> return (buffer[offset]);
<del> }
<del>
<del> return ((0xff - buffer[offset] + 1) * -1);
<add>Buffer.prototype.readInt8 = function(offset, noAssert) {
<add> if (!noAssert)
<add> checkOffset(offset, 1, this.length);
<add> if (!(this[offset] & 0x80))
<add> return (this[offset]);
<add> return ((0xff - this[offset] + 1) * -1);
<ide> };
<ide>
<del>function readInt16(buffer, offset, isBigEndian, noAssert) {
<del> var neg, val;
<ide>
<del> if (!noAssert) {
<del> assert.ok(typeof (isBigEndian) === 'boolean',
<del> 'missing or invalid endian');
<add>function readInt16(buffer, offset, isBigEndian) {
<add> var val = readUInt16(buffer, offset, isBigEndian);
<ide>
<del> assert.ok(offset !== undefined && offset !== null,
<del> 'missing offset');
<del>
<del> assert.ok(offset + 1 < buffer.length,
<del> 'Trying to read beyond buffer length');
<del> }
<del>
<del> val = readUInt16(buffer, offset, isBigEndian, noAssert);
<del> neg = val & 0x8000;
<del> if (!neg) {
<add> if (!(val & 0x8000))
<ide> return val;
<del> }
<del>
<ide> return (0xffff - val + 1) * -1;
<ide> }
<ide>
<add>
<ide> Buffer.prototype.readInt16LE = function(offset, noAssert) {
<del> return readInt16(this, offset, false, noAssert);
<add> if (!noAssert)
<add> checkOffset(offset, 2, this.length);
<add> return readInt16(this, offset, false);
<ide> };
<ide>
<add>
<ide> Buffer.prototype.readInt16BE = function(offset, noAssert) {
<del> return readInt16(this, offset, true, noAssert);
<add> if (!noAssert)
<add> checkOffset(offset, 2, this.length);
<add> return readInt16(this, offset, true);
<ide> };
<ide>
<del>function readInt32(buffer, offset, isBigEndian, noAssert) {
<del> var neg, val;
<del>
<del> if (!noAssert) {
<del> assert.ok(typeof (isBigEndian) === 'boolean',
<del> 'missing or invalid endian');
<ide>
<del> assert.ok(offset !== undefined && offset !== null,
<del> 'missing offset');
<add>function readInt32(buffer, offset, isBigEndian) {
<add> var val = readUInt32(buffer, offset, isBigEndian);
<ide>
<del> assert.ok(offset + 3 < buffer.length,
<del> 'Trying to read beyond buffer length');
<del> }
<del>
<del> val = readUInt32(buffer, offset, isBigEndian, noAssert);
<del> neg = val & 0x80000000;
<del> if (!neg) {
<add> if (!(val & 0x80000000))
<ide> return (val);
<del> }
<del>
<ide> return (0xffffffff - val + 1) * -1;
<ide> }
<ide>
<add>
<ide> Buffer.prototype.readInt32LE = function(offset, noAssert) {
<del> return readInt32(this, offset, false, noAssert);
<add> if (!noAssert)
<add> checkOffset(offset, 2, this.length);
<add> return readInt32(this, offset, false);
<ide> };
<ide>
<add>
<ide> Buffer.prototype.readInt32BE = function(offset, noAssert) {
<del> return readInt32(this, offset, true, noAssert);
<add> if (!noAssert)
<add> checkOffset(offset, 2, this.length);
<add> return readInt32(this, offset, true);
<ide> };
<ide>
<del>function checkOffset(offset, ext, length) {
<del> if ((offset % 1) !== 0 || offset < 0)
<del> throw new RangeError('offset is not uint');
<del> if (offset + ext > length)
<del> throw new RangeError('Trying to access beyond buffer length');
<del>}
<del>
<ide> Buffer.prototype.readFloatLE = function(offset, noAssert) {
<ide> if (!noAssert)
<ide> checkOffset(offset, 4, this.length);
<ide> return this.parent.readFloatLE(this.offset + offset, !!noAssert);
<ide> };
<ide>
<add>
<ide> Buffer.prototype.readFloatBE = function(offset, noAssert) {
<ide> if (!noAssert)
<ide> checkOffset(offset, 4, this.length);
<ide> return this.parent.readFloatBE(this.offset + offset, !!noAssert);
<ide> };
<ide>
<add>
<ide> Buffer.prototype.readDoubleLE = function(offset, noAssert) {
<ide> if (!noAssert)
<ide> checkOffset(offset, 8, this.length);
<ide> return this.parent.readDoubleLE(this.offset + offset, !!noAssert);
<ide> };
<ide>
<add>
<ide> Buffer.prototype.readDoubleBE = function(offset, noAssert) {
<ide> if (!noAssert)
<ide> checkOffset(offset, 8, this.length);
<ide> return this.parent.readDoubleBE(this.offset + offset, !!noAssert);
<ide> };
<ide>
<ide>
<del>/*
<del> * We have to make sure that the value is a valid integer. This means that it is
<del> * non-negative. It has no fractional component and that it does not exceed the
<del> * maximum allowed value.
<del> *
<del> * value The number to check for validity
<del> *
<del> * max The maximum value
<del> */
<del>function verifuint(value, max) {
<del> assert.ok(typeof (value) == 'number',
<del> 'cannot write a non-number as a number');
<del>
<del> assert.ok(value >= 0,
<del> 'specified a negative value for writing an unsigned value');
<del>
<del> assert.ok(value <= max, 'value is larger than maximum value for type');
<del>
<del> assert.ok(Math.floor(value) === value, 'value has a fractional component');
<add>function checkInt(buffer, value, offset, ext, max, min) {
<add> if ((value % 1) !== 0 || value > max || value < min)
<add> throw TypeError("value is out of bounds");
<add> if ((offset % 1) !== 0 || offset < 0)
<add> throw TypeError("offset is not uint");
<add> if (offset + ext > buffer.length || buffer.length + offset < 0)
<add> throw RangeError("Trying to write outside buffer length");
<ide> }
<ide>
<del>Buffer.prototype.writeUInt8 = function(value, offset, noAssert) {
<del> var buffer = this;
<del>
<del> if (!noAssert) {
<del> assert.ok(value !== undefined && value !== null,
<del> 'missing value');
<del>
<del> assert.ok(offset !== undefined && offset !== null,
<del> 'missing offset');
<del>
<del> assert.ok(offset < buffer.length,
<del> 'trying to write beyond buffer length');
<ide>
<del> verifuint(value, 0xff);
<del> }
<del>
<del> buffer[offset] = value;
<add>Buffer.prototype.writeUInt8 = function(value, offset, noAssert) {
<add> if (!noAssert)
<add> checkInt(this, value, offset, 1, 0xff, 0);
<add> this[offset] = value;
<ide> };
<ide>
<del>function writeUInt16(buffer, value, offset, isBigEndian, noAssert) {
<del> if (!noAssert) {
<del> assert.ok(value !== undefined && value !== null,
<del> 'missing value');
<del>
<del> assert.ok(typeof (isBigEndian) === 'boolean',
<del> 'missing or invalid endian');
<del>
<del> assert.ok(offset !== undefined && offset !== null,
<del> 'missing offset');
<del>
<del> assert.ok(offset + 1 < buffer.length,
<del> 'trying to write beyond buffer length');
<del>
<del> verifuint(value, 0xffff);
<del> }
<ide>
<add>function writeUInt16(buffer, value, offset, isBigEndian) {
<ide> if (isBigEndian) {
<ide> buffer[offset] = (value & 0xff00) >>> 8;
<ide> buffer[offset + 1] = value & 0x00ff;
<ide> function writeUInt16(buffer, value, offset, isBigEndian, noAssert) {
<ide> }
<ide> }
<ide>
<add>
<ide> Buffer.prototype.writeUInt16LE = function(value, offset, noAssert) {
<del> writeUInt16(this, value, offset, false, noAssert);
<add> if (!noAssert)
<add> checkInt(this, value, offset, 2, 0xffff, 0);
<add> writeUInt16(this, value, offset, false);
<ide> };
<ide>
<add>
<ide> Buffer.prototype.writeUInt16BE = function(value, offset, noAssert) {
<del> writeUInt16(this, value, offset, true, noAssert);
<add> if (!noAssert)
<add> checkInt(this, value, offset, 2, 0xffff, 0);
<add> writeUInt16(this, value, offset, true);
<ide> };
<ide>
<del>function writeUInt32(buffer, value, offset, isBigEndian, noAssert) {
<del> if (!noAssert) {
<del> assert.ok(value !== undefined && value !== null,
<del> 'missing value');
<del>
<del> assert.ok(typeof (isBigEndian) === 'boolean',
<del> 'missing or invalid endian');
<del>
<del> assert.ok(offset !== undefined && offset !== null,
<del> 'missing offset');
<del>
<del> assert.ok(offset + 3 < buffer.length,
<del> 'trying to write beyond buffer length');
<del>
<del> verifuint(value, 0xffffffff);
<del> }
<ide>
<add>function writeUInt32(buffer, value, offset, isBigEndian) {
<ide> if (isBigEndian) {
<ide> buffer[offset] = (value >>> 24) & 0xff;
<ide> buffer[offset + 1] = (value >>> 16) & 0xff;
<ide> function writeUInt32(buffer, value, offset, isBigEndian, noAssert) {
<ide> }
<ide> }
<ide>
<add>
<ide> Buffer.prototype.writeUInt32LE = function(value, offset, noAssert) {
<del> writeUInt32(this, value, offset, false, noAssert);
<add> if (!noAssert)
<add> checkInt(this, value, offset, 4, 0xffffffff, 0);
<add> writeUInt32(this, value, offset, false);
<ide> };
<ide>
<add>
<ide> Buffer.prototype.writeUInt32BE = function(value, offset, noAssert) {
<del> writeUInt32(this, value, offset, true, noAssert);
<add> if (!noAssert)
<add> checkInt(this, value, offset, 4, 0xffffffff, 0);
<add> writeUInt32(this, value, offset, true);
<ide> };
<ide>
<ide>
<ide> Buffer.prototype.writeUInt32BE = function(value, offset, noAssert) {
<ide> * hacky, but it should work and get the job done which is our goal here.
<ide> */
<ide>
<del>/*
<del> * A series of checks to make sure we actually have a signed 32-bit number
<del> */
<del>function verifsint(value, max, min) {
<del> assert.ok(typeof (value) == 'number',
<del> 'cannot write a non-number as a number');
<del>
<del> assert.ok(value <= max, 'value larger than maximum allowed value');
<del>
<del> assert.ok(value >= min, 'value smaller than minimum allowed value');
<del>
<del> assert.ok(Math.floor(value) === value, 'value has a fractional component');
<del>}
<del>
<ide> Buffer.prototype.writeInt8 = function(value, offset, noAssert) {
<del> var buffer = this;
<del>
<del> if (!noAssert) {
<del> verifsint(value, 0x7f, -0x80);
<del> }
<del>
<del> if (value >= 0) {
<del> buffer.writeUInt8(value, offset, noAssert);
<del> } else {
<del> buffer.writeUInt8(0xff + value + 1, offset, noAssert);
<del> }
<add> if (!noAssert)
<add> checkInt(this, value, offset, 1, 0x7f, -0x80);
<add> if (value < 0) value = 0xff + value + 1;
<add> this[offset] = value;
<ide> };
<ide>
<del>function writeInt16(buffer, value, offset, isBigEndian, noAssert) {
<del> if (!noAssert) {
<del> verifsint(value, 0x7fff, -0x8000);
<del> }
<del>
<del> if (value >= 0) {
<del> writeUInt16(buffer, value, offset, isBigEndian, noAssert);
<del> } else {
<del> writeUInt16(buffer, 0xffff + value + 1, offset, isBigEndian, noAssert);
<del> }
<del>}
<ide>
<ide> Buffer.prototype.writeInt16LE = function(value, offset, noAssert) {
<del> writeInt16(this, value, offset, false, noAssert);
<add> if (!noAssert)
<add> checkInt(this, value, offset, 2, 0x7fff, -0x8000);
<add> if (value < 0) value = 0xffff + value + 1;
<add> writeUInt16(this, value, offset, false);
<ide> };
<ide>
<add>
<ide> Buffer.prototype.writeInt16BE = function(value, offset, noAssert) {
<del> writeInt16(this, value, offset, true, noAssert);
<add> if (!noAssert)
<add> checkInt(this, value, offset, 2, 0x7fff, -0x8000);
<add> if (value < 0) value = 0xffff + value + 1;
<add> writeUInt16(this, value, offset, true);
<ide> };
<ide>
<del>function writeInt32(buffer, value, offset, isBigEndian, noAssert) {
<del> if (!noAssert) {
<del> verifsint(value, 0x7fffffff, -0x80000000);
<del> }
<del>
<del> if (value >= 0) {
<del> writeUInt32(buffer, value, offset, isBigEndian, noAssert);
<del> } else {
<del> writeUInt32(buffer, 0xffffffff + value + 1, offset, isBigEndian, noAssert);
<del> }
<del>}
<ide>
<ide> Buffer.prototype.writeInt32LE = function(value, offset, noAssert) {
<del> writeInt32(this, value, offset, false, noAssert);
<add> if (!noAssert)
<add> checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
<add> if (value < 0) value = 0xffffffff + value + 1;
<add> writeUInt32(this, value, offset, false);
<ide> };
<ide>
<add>
<ide> Buffer.prototype.writeInt32BE = function(value, offset, noAssert) {
<del> writeInt32(this, value, offset, true, noAssert);
<add> if (!noAssert)
<add> checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
<add> if (value < 0) value = 0xffffffff + value + 1;
<add> writeUInt32(this, value, offset, true);
<ide> };
<ide>
<add>
<ide> Buffer.prototype.writeFloatLE = function(value, offset, noAssert) {
<ide> if (!noAssert)
<ide> checkOffset(offset, 4, this.length);
<ide> this.parent.writeFloatLE(value, this.offset + offset, !!noAssert);
<ide> };
<ide>
<add>
<ide> Buffer.prototype.writeFloatBE = function(value, offset, noAssert) {
<ide> if (!noAssert)
<ide> checkOffset(offset, 4, this.length);
<ide> this.parent.writeFloatBE(value, this.offset + offset, !!noAssert);
<ide> };
<ide>
<add>
<ide> Buffer.prototype.writeDoubleLE = function(value, offset, noAssert) {
<ide> if (!noAssert)
<ide> checkOffset(offset, 8, this.length);
<ide> this.parent.writeDoubleLE(value, this.offset + offset, !!noAssert);
<ide> };
<ide>
<add>
<ide> Buffer.prototype.writeDoubleBE = function(value, offset, noAssert) {
<ide> if (!noAssert)
<ide> checkOffset(offset, 8, this.length); | 1 |
Javascript | Javascript | add lint fixer for `require-buffer` | 0319a5e1805bf7728d6116990cb9b7f00f726653 | <ide><path>test/parallel/test-eslint-require-buffer.js
<ide> const ruleTester = new RuleTester({
<ide> const message = "Use const Buffer = require('buffer').Buffer; " +
<ide> 'at the beginning of this file';
<ide>
<add>const useStrict = '\'use strict\';\n\n';
<add>const bufferModule = 'const { Buffer } = require(\'buffer\');\n';
<add>const mockComment = '// Some Comment\n//\n// Another Comment\n\n';
<add>const useBuffer = 'Buffer;';
<ide> ruleTester.run('require-buffer', rule, {
<ide> valid: [
<ide> 'foo',
<del> 'const Buffer = require("Buffer"); Buffer;'
<add> 'const Buffer = require("Buffer"); Buffer;',
<add> 'const { Buffer } = require(\'buffer\'); Buffer;',
<ide> ],
<ide> invalid: [
<ide> {
<del> code: 'Buffer;',
<del> errors: [{ message }]
<del> }
<add> code: useBuffer,
<add> errors: [{ message }],
<add> output: bufferModule + useBuffer,
<add> },
<add> {
<add> code: useStrict + useBuffer,
<add> errors: [{ message }],
<add> output: useStrict + bufferModule + useBuffer,
<add> },
<add> {
<add> code: mockComment + useBuffer,
<add> errors: [{ message }],
<add> output: mockComment + bufferModule + useBuffer,
<add> },
<add> {
<add> code: mockComment + useStrict + useBuffer,
<add> errors: [{ message }],
<add> output: mockComment + useStrict + bufferModule + useBuffer,
<add> },
<ide> ]
<ide> });
<ide><path>tools/eslint-rules/require-buffer.js
<ide> 'use strict';
<add>const BUFFER_REQUIRE = 'const { Buffer } = require(\'buffer\');\n';
<ide>
<ide> module.exports = function(context) {
<add>
<ide> function flagIt(reference) {
<ide> const msg = 'Use const Buffer = require(\'buffer\').Buffer; ' +
<ide> 'at the beginning of this file';
<del> context.report(reference.identifier, msg);
<add>
<add> context.report({
<add> node: reference.identifier,
<add> message: msg,
<add> fix: (fixer) => {
<add> const sourceCode = context.getSourceCode();
<add>
<add> const useStrict = /'use strict';\n\n?/g;
<add> const hasUseStrict = !!useStrict.exec(sourceCode.text);
<add> const firstLOC = sourceCode.ast.range[0];
<add> const rangeNeedle = hasUseStrict ? useStrict.lastIndex : firstLOC;
<add>
<add> return fixer.insertTextBeforeRange([rangeNeedle], BUFFER_REQUIRE);
<add> }
<add> });
<ide> }
<ide>
<ide> return { | 2 |
Mixed | Javascript | remove unused jsdevsupport module | 34e7d48472565ec4502c56d42adc17b66c71c4bc | <ide><path>Libraries/Core/setUpBatchedBridge.js
<ide> if (global.RN$Bridgeless === true && global.RN$registerCallableModule) {
<ide> | $TEMPORARY$string<'GlobalPerformanceLogger'>
<ide> | $TEMPORARY$string<'HMRClient'>
<ide> | $TEMPORARY$string<'HeapCapture'>
<del> | $TEMPORARY$string<'JSDevSupportModule'>
<ide> | $TEMPORARY$string<'JSTimers'>
<ide> | $TEMPORARY$string<'RCTDeviceEventEmitter'>
<ide> | $TEMPORARY$string<'RCTLog'>
<ide> registerModule('RCTNativeAppEventEmitter', () =>
<ide> registerModule('GlobalPerformanceLogger', () =>
<ide> require('../Utilities/GlobalPerformanceLogger'),
<ide> );
<del>registerModule('JSDevSupportModule', () =>
<del> require('../Utilities/JSDevSupportModule'),
<del>);
<ide>
<ide> if (__DEV__ && !global.__RCTProfileIsProfiling) {
<ide> registerModule('HMRClient', () => require('../Utilities/HMRClient'));
<ide><path>Libraries/Utilities/JSDevSupportModule.js
<del>/**
<del> * Copyright (c) Meta Platforms, Inc. and affiliates.
<del> *
<del> * This source code is licensed under the MIT license found in the
<del> * LICENSE file in the root directory of this source tree.
<del> *
<del> * @format
<del> * @flow strict-local
<del> */
<del>
<del>import NativeJSDevSupport from './NativeJSDevSupport';
<del>const ReactNative = require('../Renderer/shims/ReactNative');
<del>
<del>const JSDevSupportModule = {
<del> getJSHierarchy: function (tag: number) {
<del> if (NativeJSDevSupport) {
<del> const constants = NativeJSDevSupport.getConstants();
<del> try {
<del> const {computeComponentStackForErrorReporting} =
<del> ReactNative.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
<del> const componentStack = computeComponentStackForErrorReporting(tag);
<del> if (!componentStack) {
<del> NativeJSDevSupport.onFailure(
<del> constants.ERROR_CODE_VIEW_NOT_FOUND,
<del> "Component stack doesn't exist for tag " + tag,
<del> );
<del> } else {
<del> NativeJSDevSupport.onSuccess(componentStack);
<del> }
<del> } catch (e) {
<del> NativeJSDevSupport.onFailure(constants.ERROR_CODE_EXCEPTION, e.message);
<del> }
<del> }
<del> },
<del>};
<del>
<del>module.exports = JSDevSupportModule;
<ide><path>Libraries/Utilities/NativeJSDevSupport.js
<del>/**
<del> * Copyright (c) Meta Platforms, Inc. and affiliates.
<del> *
<del> * This source code is licensed under the MIT license found in the
<del> * LICENSE file in the root directory of this source tree.
<del> *
<del> * @flow strict
<del> * @format
<del> */
<del>
<del>import type {TurboModule} from '../TurboModule/RCTExport';
<del>import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry';
<del>
<del>export interface Spec extends TurboModule {
<del> +getConstants: () => {|
<del> ERROR_CODE_EXCEPTION: number,
<del> ERROR_CODE_VIEW_NOT_FOUND: number,
<del> |};
<del> +onSuccess: (data: string) => void;
<del> +onFailure: (errorCode: number, error: string) => void;
<del>}
<del>
<del>export default (TurboModuleRegistry.get<Spec>('JSDevSupport'): ?Spec);
<ide><path>ReactAndroid/src/main/java/com/facebook/react/devsupport/JSDevSupport.java
<del>/*
<del> * Copyright (c) Meta Platforms, Inc. and affiliates.
<del> *
<del> * This source code is licensed under the MIT license found in the
<del> * LICENSE file in the root directory of this source tree.
<del> */
<del>
<del>package com.facebook.react.devsupport;
<del>
<del>import android.util.Pair;
<del>import android.view.View;
<del>import androidx.annotation.Nullable;
<del>import com.facebook.fbreact.specs.NativeJSDevSupportSpec;
<del>import com.facebook.react.bridge.JavaScriptModule;
<del>import com.facebook.react.bridge.ReactApplicationContext;
<del>import com.facebook.react.module.annotations.ReactModule;
<del>import java.util.HashMap;
<del>import java.util.Map;
<del>
<del>@ReactModule(name = JSDevSupport.MODULE_NAME)
<del>public class JSDevSupport extends NativeJSDevSupportSpec {
<del> public static final String MODULE_NAME = "JSDevSupport";
<del>
<del> public static final int ERROR_CODE_EXCEPTION = 0;
<del> public static final int ERROR_CODE_VIEW_NOT_FOUND = 1;
<del>
<del> @Nullable private volatile DevSupportCallback mCurrentCallback = null;
<del>
<del> public interface JSDevSupportModule extends JavaScriptModule {
<del> void getJSHierarchy(int reactTag);
<del> }
<del>
<del> public JSDevSupport(ReactApplicationContext reactContext) {
<del> super(reactContext);
<del> }
<del>
<del> public interface DevSupportCallback {
<del>
<del> void onSuccess(String data);
<del>
<del> void onFailure(int errorCode, Exception error);
<del> }
<del>
<del> /**
<del> * Notifies the callback with either the JS hierarchy of the deepest leaf from the given root view
<del> * or with an error.
<del> */
<del> public synchronized void computeDeepestJSHierarchy(View root, DevSupportCallback callback) {
<del> final Pair<View, Integer> deepestPairView = ViewHierarchyUtil.getDeepestLeaf(root);
<del> View deepestView = deepestPairView.first;
<del> Integer tagId = deepestView.getId();
<del> getJSHierarchy(tagId, callback);
<del> }
<del>
<del> public synchronized void getJSHierarchy(int reactTag, DevSupportCallback callback) {
<del> ReactApplicationContext reactApplicationContext = getReactApplicationContextIfActiveOrWarn();
<del>
<del> JSDevSupportModule jsDevSupportModule = null;
<del> if (reactApplicationContext != null) {
<del> jsDevSupportModule = reactApplicationContext.getJSModule(JSDevSupportModule.class);
<del> }
<del>
<del> if (jsDevSupportModule == null) {
<del> callback.onFailure(
<del> ERROR_CODE_EXCEPTION,
<del> new JSCHeapCapture.CaptureException(MODULE_NAME + " module not registered."));
<del> return;
<del> }
<del> mCurrentCallback = callback;
<del> jsDevSupportModule.getJSHierarchy(reactTag);
<del> }
<del>
<del> @SuppressWarnings("unused")
<del> @Override
<del> public synchronized void onSuccess(String data) {
<del> if (mCurrentCallback != null) {
<del> mCurrentCallback.onSuccess(data);
<del> }
<del> }
<del>
<del> @SuppressWarnings("unused")
<del> @Override
<del> public synchronized void onFailure(double errorCodeDouble, String error) {
<del> int errorCode = (int) errorCodeDouble;
<del>
<del> if (mCurrentCallback != null) {
<del> mCurrentCallback.onFailure(errorCode, new RuntimeException(error));
<del> }
<del> }
<del>
<del> @Override
<del> public Map<String, Object> getTypedExportedConstants() {
<del> HashMap<String, Object> constants = new HashMap<>();
<del> constants.put("ERROR_CODE_EXCEPTION", ERROR_CODE_EXCEPTION);
<del> constants.put("ERROR_CODE_VIEW_NOT_FOUND", ERROR_CODE_VIEW_NOT_FOUND);
<del> return constants;
<del> }
<del>
<del> @Override
<del> public String getName() {
<del> return MODULE_NAME;
<del> }
<del>} | 4 |
PHP | PHP | update exception handling for integration tests | fc8548545185df770a1d6949fd149362a3a4ab9c | <ide><path>src/TestSuite/IntegrationTestTrait.php
<ide> use Cake\Utility\Security;
<ide> use Exception;
<ide> use Laminas\Diactoros\Uri;
<del>use LogicException;
<del>use PHPUnit\Framework\Error\Error as PhpUnitError;
<add>use PHPUnit\Exception as PHPUnitException;
<ide> use Throwable;
<ide>
<ide> /**
<ide> public function options($url): void
<ide> * @param string $method The HTTP method
<ide> * @param string|array $data The request data.
<ide> * @return void
<del> * @throws \PHPUnit\Framework\Error\Error|\Throwable
<add> * @throws \PHPUnit\Exception|\Throwable
<ide> */
<ide> protected function _sendRequest($url, $method, $data = []): void
<ide> {
<ide> protected function _sendRequest($url, $method, $data = []): void
<ide> $this->_requestSession->write('Flash', $this->_flashMessages);
<ide> }
<ide> $this->_response = $response;
<del> } catch (PhpUnitError | DatabaseException | LogicException $e) {
<add> } catch (PHPUnitException | DatabaseException $e) {
<ide> throw $e;
<ide> } catch (Throwable $e) {
<ide> $this->_exception = $e; | 1 |
PHP | PHP | add stringable method | 2488eba6f85092af7cb4d3b8271d8024d3978379 | <ide><path>src/Illuminate/Support/Stringable.php
<ide> public function beforeLast($search)
<ide> return new static(Str::beforeLast($this->value, $search));
<ide> }
<ide>
<add> /**
<add> * Get the portion of a string between a given values.
<add> *
<add> * @param string $before
<add> * @param string $after
<add> * @return static
<add> */
<add> public function between($before, $after)
<add> {
<add> return new static(Str::between($this->value, $before, $after));
<add> }
<add>
<ide> /**
<ide> * Convert a value to camel case.
<ide> * | 1 |
Text | Text | update changelog for unreleased 16.0 changes | cdfbe6bb04e6c37a2ee3c64139cfa0fea643f392 | <ide><path>CHANGELOG.md
<add>## [Unreleased]
<add><details>
<add> <summary>
<add> Changes that have landed in master but are not yet released.
<add> Click to see more.
<add> </summary>
<add>
<add>### New JS Environment Requirements
<add>
<add> * React 16 depends on the collection types [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) and [Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set), as well as [requestAnimationFrame](https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame). If you support older browsers and devices which may not yet provide these natively (e.g. <IE11), [you may want to include a polyfill](https://gist.github.com/gaearon/9a4d54653ae9c50af6c54b4e0e56b583).
<add>
<add>### New Features
<add>* Components can now return arrays and strings from `render`. (Docs coming soon!)
<add>* Improved error handling with introduction of "error boundaries". [Error boundaries](https://facebook.github.io/react/blog/2017/07/26/error-handling-in-react-16.html) are React components that catch JavaScript errors anywhere in their child component tree, log those errors, and display a fallback UI instead of the component tree that crashed.
<add>* First-class support for declaratively rendering a subtree into another DOM node with `ReactDOM.createPortal()`. (Docs coming soon!)
<add>* Streaming mode for server side rendering is enabled with `ReactDOMServer.renderToNodeStream()` and `ReactDOMServer.renderToStaticNodeStream()`. ([@aickin](https://github.com/aickin) in [#10425](https://github.com/facebook/react/pull/10425), [#10044](https://github.com/facebook/react/pull/10044), [#10039](https://github.com/facebook/react/pull/10039), [#10024](https://github.com/facebook/react/pull/10024), [#9264](https://github.com/facebook/react/pull/9264), and others.)
<add>* [React DOM now allows passing non-standard attributes](https://facebook.github.io/react/blog/2017/09/08/dom-attributes-in-react-16.html). ([@nhunzaker](https://github.com/nhunzaker) in [#10385](https://github.com/facebook/react/pull/10385), [10564](https://github.com/facebook/react/pull/10564), [#10495](https://github.com/facebook/react/pull/10495) and others)
<add>
<add>### Breaking Changes
<add>- There are several changes to the behavior of scheduling and lifecycle methods:
<add> * `ReactDOM.render()` and `ReactDOM.unstable_renderIntoContainer()` now return `null` if called from inside a lifecycle method.
<add> * To work around this, you can either use [the new portal API](https://github.com/facebook/react/issues/10309#issuecomment-318433235) or [refs](https://github.com/facebook/react/issues/10309#issuecomment-318434635).
<add> * Minor changes to `setState` behavior:
<add> * Calling `setState` with null no longer triggers an update. This allows you to decide in an updater function if you want to re-render.
<add> * Calling `setState` directly in render always causes an update. This was not previously the case. Regardless, you should not be calling `setState` from render.
<add> * `setState` callback (second argument) now fires immediately after `componentDidMount` / `componentDidUpdate` instead of after all components have rendered.
<add> * When replacing `<A />` with `<B />`, `B.componentWillMount` now always happens before `A.componentWillUnmount`. Previously, `A.componentWillUnmount` could fire first in some cases.
<add> * Previously, changing the `ref` to a component would always detach the ref before that component's render is called. Now, we change the `ref` later, when applying the changes to the DOM.
<add> * It is not safe to re-render into a container that was modified by something other than React. This worked previously in some cases but was never supported. We now emit a warning in this case. Instead you should clean up your component trees using `ReactDOM.unmountComponentAtNode`. [See this example.](https://github.com/facebook/react/issues/10294#issuecomment-318820987)
<add> * `componentDidUpdate` lifecycle no longer receives `prevContext` param. ([@bvaughn](https://github.com/bvaughn) in [#8631](https://github.com/facebook/react/pull/8631))
<add> * Shallow renderer no longer calls `componentDidUpdate()` because DOM refs are not available. This also makes it consistent with `componentDidMount()` (which does not get called in previous versions either).
<add> * Shallow renderer does not implement `unstable_batchedUpdates()` anymore.
<add>- The names and paths to the single-file browser builds have changed to emphasize the difference between development and production builds. For example:
<add> - `react/dist/react.js` → `react/umd/react.development.js`
<add> - `react/dist/react.min.js` → `react/umd/react.production.min.js`
<add> - `react-dom/dist/react-dom.js` → `react-dom/umd/react-dom.development.js`
<add> - `react-dom/dist/react-dom.min.js` → `react-dom/umd/react-dom.production.min.js`
<add>* The server renderer has been completely rewritten, with some improvements:
<add> * Server rendering does not use markup validation anymore, and instead tries its best to attach to existing DOM, warning about inconsistencies. It also doesn't use comments for empty components and data-reactid attributes on each node anymore.
<add> * Hydrating a server rendered container now has an explicit API. Use `ReactDOM.hydrate` instead of `ReactDOM.render` if you're reviving server rendered HTML. Keep using `ReactDOM.render` if you're just doing client-side rendering.
<add>* When "unknown" props are passed to DOM components, for valid values, React will now render them in the DOM. [See this post for more details.](https://facebook.github.io/react/blog/2017/09/08/dom-attributes-in-react-16.html) ([@nhunzaker](https://github.com/nhunzaker) in [#10385](https://github.com/facebook/react/pull/10385), [10564](https://github.com/facebook/react/pull/10564), [#10495](https://github.com/facebook/react/pull/10495) and others)
<add>* Errors in the render and lifecycle methods now unmount the component tree by default. To prevent this, add [error boundaries](https://facebook.github.io/react/blog/2017/07/26/error-handling-in-react-16.html) to the appropriate places in the UI.
<add>
<add>### Removed Deprecations
<add>
<add>- There is no `react-with-addons.js` build anymore. All compatible addons are published separately on npm, and have single-file browser versions if you need them.
<add>- The deprecations introduced in 15.x have been removed from the core package. `React.createClass` is now available as create-react-class, `React.PropTypes` as prop-types, `React.DOM` as react-dom-factories, react-addons-test-utils as react-dom/test-utils, and shallow renderer as react-test-renderer/shallow. See [15.5.0](https://facebook.github.io/react/blog/2017/04/07/react-v15.5.0.html) and [15.6.0](https://facebook.github.io/react/blog/2017/06/13/react-v15.6.0.html) blog posts for instructions on migrating code and automated codemods.
<add>
<add></details>
<add>
<ide> ## 15.6.1 (June 14, 2017)
<ide>
<ide> ### React DOM | 1 |
Javascript | Javascript | fix isvalid for unix timestamp parser | 65df5fb7ae35e791110e38dfcf65dc2ad79363d6 | <ide><path>moment.js
<ide> // UNIX TIMESTAMP WITH MS
<ide> case 'X':
<ide> config._d = new Date(parseFloat(input) * 1000);
<add> config._isValid = !isNaN(config._d.getTime());
<ide> break;
<ide> // TIMEZONE
<ide> case 'Z' : // fall through to ZZ | 1 |
PHP | PHP | remove unneeded connection cloning in tests | 2ac08e3e6c839c7973882f302edfd369f7731ed2 | <ide><path>tests/TestCase/Database/ConnectionTest.php
<ide> class ConnectionTest extends TestCase
<ide> public function setUp(): void
<ide> {
<ide> parent::setUp();
<del> $this->connection = clone ConnectionManager::get('test');
<add> $this->connection = ConnectionManager::get('test');
<ide> static::setAppNamespace();
<ide> }
<ide>
<ide><path>tests/TestCase/Database/Schema/CollectionTest.php
<ide> class CollectionTest extends TestCase
<ide> public function setUp(): void
<ide> {
<ide> parent::setUp();
<del> $this->connection = clone ConnectionManager::get('test');
<add> $this->connection = ConnectionManager::get('test');
<ide> Cache::clear('_cake_model_');
<ide> Cache::enable();
<ide> }
<ide> public function setUp(): void
<ide> public function tearDown(): void
<ide> {
<ide> parent::tearDown();
<add> $this->connection->cacheMetadata('_cake_model_');
<ide> unset($this->connection);
<ide> }
<ide>
<ide><path>tests/TestCase/Database/SchemaCacheTest.php
<ide> public function setUp(): void
<ide> ->will($this->returnValue(true));
<ide> Cache::setConfig('orm_cache', $this->cache);
<ide>
<del> $this->connection = clone ConnectionManager::get('test');
<add> $this->connection = ConnectionManager::get('test');
<ide> $this->connection->cacheMetadata('orm_cache');
<ide> }
<ide>
<ide> public function tearDown(): void
<ide> {
<ide> parent::tearDown();
<ide>
<del> $this->connection->cacheMetadata('orm_cache');
<add> $this->connection->cacheMetadata('_cake_model_');
<ide> unset($this->connection);
<ide> Cache::drop('orm_cache');
<ide> } | 3 |
PHP | PHP | add strict_types to events | 1304bf770052a10d521ed138649e88b937934509 | <ide><path>src/Event/Decorator/AbstractDecorator.php
<ide> <?php
<add>declare(strict_types=1);
<ide> /**
<ide> * CakePHP : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Event/Decorator/ConditionDecorator.php
<ide> <?php
<add>declare(strict_types=1);
<ide> /**
<ide> * CakePHP : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Event/Decorator/SubjectFilterDecorator.php
<ide> <?php
<add>declare(strict_types=1);
<ide> /**
<ide> * CakePHP : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Event/Event.php
<ide> <?php
<add>declare(strict_types=1);
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Event/EventDispatcherInterface.php
<ide> <?php
<add>declare(strict_types=1);
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Event/EventDispatcherTrait.php
<ide> <?php
<add>declare(strict_types=1);
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Event/EventInterface.php
<ide> <?php
<add>declare(strict_types=1);
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Event/EventList.php
<ide> <?php
<add>declare(strict_types=1);
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Event/EventListenerInterface.php
<ide> <?php
<add>declare(strict_types=1);
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Event/EventManager.php
<ide> <?php
<add>declare(strict_types=1);
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Event/EventManagerInterface.php
<ide> <?php
<add>declare(strict_types=1);
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<ide><path>tests/TestCase/Event/Decorator/ConditionDecoratorTest.php
<ide> <?php
<add>declare(strict_types=1);
<ide> /**
<ide> * CakePHP : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>tests/TestCase/Event/Decorator/SubjectFilterDecoratorTest.php
<ide> <?php
<add>declare(strict_types=1);
<ide> /**
<ide> * CakePHP : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>tests/TestCase/Event/EventDispatcherTraitTest.php
<ide> <?php
<add>declare(strict_types=1);
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>tests/TestCase/Event/EventListTest.php
<ide> <?php
<add>declare(strict_types=1);
<ide> /**
<ide> * CakePHP : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>tests/TestCase/Event/EventManagerTest.php
<ide> <?php
<add>declare(strict_types=1);
<ide> /**
<ide> * CakePHP : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>tests/TestCase/Event/EventTest.php
<ide> <?php
<add>declare(strict_types=1);
<ide> /**
<ide> * EventTest file
<ide> * | 17 |
Ruby | Ruby | fix ruby warnings | eb80dd39dc8d2f022d8b7682051ed09be872cb7f | <ide><path>actionpack/lib/action_controller/metal/testing.rb
<ide> module Testing
<ide> # Behavior specific to functional tests
<ide> module Functional # :nodoc:
<ide> def clear_instance_variables_between_requests
<del> if @_ivars
<add> if defined?(@_ivars)
<ide> new_ivars = instance_variables - @_ivars
<ide> new_ivars.each { |ivar| remove_instance_variable(ivar) }
<ide> end | 1 |
Text | Text | prefer file name instead of filename [ci skip] | 13e8c8036375589ad3fe7405d7fffba24135e8a4 | <ide><path>guides/source/api_documentation_guidelines.md
<ide> end
<ide> The API is careful not to commit to any particular value, the method has
<ide> predicate semantics, that's enough.
<ide>
<del>Filenames
<del>---------
<add>File Names
<add>----------
<ide>
<ide> As a rule of thumb, use filenames relative to the application root:
<ide> | 1 |
Text | Text | refactor the refactor challenge | 89544496256d11f05f1c669ce29fd069718f5dfe | <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/refactor-global-variables-out-of-functions.md
<ide> Rewrite the code so the global array `bookList` is not changed inside either fun
<ide> `bookList` should not change and still equal `["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"]`.
<ide>
<ide> ```js
<add>add(bookList, "Test");
<ide> assert(
<ide> JSON.stringify(bookList) ===
<ide> JSON.stringify([
<ide> assert(
<ide> );
<ide> ```
<ide>
<del>`newBookList` should equal `["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae", "A Brief History of Time"]`.
<add>`add(bookList, "A Brief History of Time")` should return `["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae", "A Brief History of Time"]`.
<ide>
<ide> ```js
<ide> assert(
<del> JSON.stringify(newBookList) ===
<add> JSON.stringify(add(bookList, "A Brief History of Time")) ===
<ide> JSON.stringify([
<ide> 'The Hound of the Baskervilles',
<ide> 'On The Electrodynamics of Moving Bodies',
<ide> assert(
<ide> );
<ide> ```
<ide>
<del>`newerBookList` should equal `["The Hound of the Baskervilles", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"]`.
<add>`remove(bookList, "On The Electrodynamics of Moving Bodies")` should return `["The Hound of the Baskervilles", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"]`.
<ide>
<ide> ```js
<ide> assert(
<del> JSON.stringify(newerBookList) ===
<add> JSON.stringify(remove(bookList, 'On The Electrodynamics of Moving Bodies')) ===
<ide> JSON.stringify([
<ide> 'The Hound of the Baskervilles',
<ide> 'Philosophiæ Naturalis Principia Mathematica',
<ide> assert(
<ide> );
<ide> ```
<ide>
<del>`newestBookList` should equal `["The Hound of the Baskervilles", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae", "A Brief History of Time"]`.
<add>`remove(add(bookList, "A Brief History of Time"), "On The Electrodynamics of Moving Bodies");` should equal `["The Hound of the Baskervilles", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae", "A Brief History of Time"]`.
<ide>
<ide> ```js
<ide> assert(
<del> JSON.stringify(newestBookList) ===
<add> JSON.stringify(remove(add(bookList, 'A Brief History of Time'), 'On The Electrodynamics of Moving Bodies')) ===
<ide> JSON.stringify([
<ide> 'The Hound of the Baskervilles',
<ide> 'Philosophiæ Naturalis Principia Mathematica',
<ide> function remove(bookName) {
<ide> // Change code above this line
<ide> }
<ide> }
<del>
<del>const newBookList = add(bookList, 'A Brief History of Time');
<del>const newerBookList = remove(bookList, 'On The Electrodynamics of Moving Bodies');
<del>const newestBookList = remove(add(bookList, 'A Brief History of Time'), 'On The Electrodynamics of Moving Bodies');
<del>
<del>console.log(bookList);
<ide> ```
<ide>
<ide> # --solutions--
<ide> function remove(bookList, bookName) {
<ide> }
<ide> return bookListCopy;
<ide> }
<del>
<del>const newBookList = add(bookList, 'A Brief History of Time');
<del>const newerBookList = remove(bookList, 'On The Electrodynamics of Moving Bodies');
<del>const newestBookList = remove(add(bookList, 'A Brief History of Time'), 'On The Electrodynamics of Moving Bodies');
<ide> ``` | 1 |
Ruby | Ruby | cache the new type object on the stack | ad1d0b8408f08bc08d54adfd66040bea14b44fe4 | <ide><path>actionpack/lib/action_dispatch/http/mime_type.rb
<ide> def register_alias(string, symbol, extension_synonyms = [])
<ide> end
<ide>
<ide> def register(string, symbol, mime_type_synonyms = [], extension_synonyms = [], skip_lookup = false)
<del> Mime.const_set(symbol.upcase, Type.new(string, symbol, mime_type_synonyms))
<add> new_mime = Type.new(string, symbol, mime_type_synonyms)
<add> Mime.const_set(symbol.upcase, new_mime)
<ide>
<del> new_mime = Mime.const_get(symbol.upcase)
<ide> SET << new_mime
<ide>
<ide> ([string] + mime_type_synonyms).each { |str| LOOKUP[str] = SET.last } unless skip_lookup | 1 |
Javascript | Javascript | simplify the ngoptions regular expression | 587e8e2ba5feb275f14d259afb72ae6b77dfef18 | <ide><path>src/ng/directive/select.js
<ide>
<ide> var ngOptionsDirective = valueFn({ terminal: true });
<ide> var selectDirective = ['$compile', '$parse', function($compile, $parse) {
<del> //0000111110000000000022220000000000000000000000333300000000000000444444444444444440000000005555555555555555500000006666666666666666600000000000000007777000000000000000000088888
<del> var NG_OPTIONS_REGEXP = /^\s*(.*?)(?:\s+as\s+(.*?))?(?:\s+group\s+by\s+(.*))?\s+for\s+(?:([\$\w][\$\w\d]*)|(?:\(\s*([\$\w][\$\w\d]*)\s*,\s*([\$\w][\$\w\d]*)\s*\)))\s+in\s+(.*?)(?:\s+track\s+by\s+(.*?))?$/,
<add> //0000111110000000000022220000000000000000000000333300000000000000444444444444444000000000555555555555555000000066666666666666600000000000000007777000000000000000000088888
<add> var NG_OPTIONS_REGEXP = /^\s*(.*?)(?:\s+as\s+(.*?))?(?:\s+group\s+by\s+(.*))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+(.*?)(?:\s+track\s+by\s+(.*?))?$/,
<ide> nullModelCtrl = {$setViewValue: noop};
<ide>
<ide> return { | 1 |
PHP | PHP | use class notation in container tests | 8f0f9bf0269df7200069485d3dd854aa633589a9 | <ide><path>tests/Container/ContainerTest.php
<ide> public function testCallWithAtSignBasedClassReferencesWithoutMethodThrowsExcepti
<ide> public function testCallWithAtSignBasedClassReferences()
<ide> {
<ide> $container = new Container;
<del> $result = $container->call('Illuminate\Tests\Container\ContainerTestCallStub@work', ['foo', 'bar']);
<add> $result = $container->call(ContainerTestCallStub::class.'@work', ['foo', 'bar']);
<ide> $this->assertEquals(['foo', 'bar'], $result);
<ide>
<ide> $container = new Container;
<del> $result = $container->call('Illuminate\Tests\Container\ContainerTestCallStub@inject');
<add> $result = $container->call(ContainerTestCallStub::class.'@inject');
<ide> $this->assertInstanceOf(ContainerConcreteStub::class, $result[0]);
<ide> $this->assertEquals('taylor', $result[1]);
<ide>
<ide> $container = new Container;
<del> $result = $container->call('Illuminate\Tests\Container\ContainerTestCallStub@inject', ['default' => 'foo']);
<add> $result = $container->call(ContainerTestCallStub::class.'@inject', ['default' => 'foo']);
<ide> $this->assertInstanceOf(ContainerConcreteStub::class, $result[0]);
<ide> $this->assertEquals('foo', $result[1]);
<ide>
<ide> public function testCallWithGlobalMethodName()
<ide> public function testCallWithBoundMethod()
<ide> {
<ide> $container = new Container;
<del> $container->bindMethod('Illuminate\Tests\Container\ContainerTestCallStub@unresolvable', function ($stub) {
<add> $container->bindMethod(ContainerTestCallStub::class.'@unresolvable', function ($stub) {
<ide> return $stub->unresolvable('foo', 'bar');
<ide> });
<del> $result = $container->call('Illuminate\Tests\Container\ContainerTestCallStub@unresolvable');
<add> $result = $container->call(ContainerTestCallStub::class.'@unresolvable');
<ide> $this->assertEquals(['foo', 'bar'], $result);
<ide>
<ide> $container = new Container;
<del> $container->bindMethod('Illuminate\Tests\Container\ContainerTestCallStub@unresolvable', function ($stub) {
<add> $container->bindMethod(ContainerTestCallStub::class.'@unresolvable', function ($stub) {
<ide> return $stub->unresolvable('foo', 'bar');
<ide> });
<ide> $result = $container->call([new ContainerTestCallStub, 'unresolvable']);
<ide> public function testBindMethodAcceptsAnArray()
<ide> $container->bindMethod([ContainerTestCallStub::class, 'unresolvable'], function ($stub) {
<ide> return $stub->unresolvable('foo', 'bar');
<ide> });
<del> $result = $container->call('Illuminate\Tests\Container\ContainerTestCallStub@unresolvable');
<add> $result = $container->call(ContainerTestCallStub::class.'@unresolvable');
<ide> $this->assertEquals(['foo', 'bar'], $result);
<ide>
<ide> $container = new Container;
<ide> public function testContextualBindingWorksForNewlyInstancedBindings()
<ide> {
<ide> $container = new Container;
<ide>
<del> $container->when('Illuminate\Tests\Container\ContainerTestContextInjectOne')->needs('Illuminate\Tests\Container\IContainerContractStub')->give('Illuminate\Tests\Container\ContainerImplementationStubTwo');
<add> $container->when(ContainerTestContextInjectOne::class)->needs(IContainerContractStub::class)->give(ContainerImplementationStubTwo::class);
<ide>
<del> $container->instance('Illuminate\Tests\Container\IContainerContractStub', new ContainerImplementationStub);
<add> $container->instance(IContainerContractStub::class, new ContainerImplementationStub);
<ide>
<ide> $this->assertInstanceOf(
<del> 'Illuminate\Tests\Container\ContainerImplementationStubTwo',
<del> $container->make('Illuminate\Tests\Container\ContainerTestContextInjectOne')->impl
<add> ContainerImplementationStubTwo::class,
<add> $container->make(ContainerTestContextInjectOne::class)->impl
<ide> );
<ide> }
<ide>
<ide> public function testContextualBindingWorksOnExistingAliasedInstances()
<ide> $container = new Container;
<ide>
<ide> $container->instance('stub', new ContainerImplementationStub);
<del> $container->alias('stub', 'Illuminate\Tests\Container\IContainerContractStub');
<add> $container->alias('stub', IContainerContractStub::class);
<ide>
<del> $container->when('Illuminate\Tests\Container\ContainerTestContextInjectOne')->needs('Illuminate\Tests\Container\IContainerContractStub')->give('Illuminate\Tests\Container\ContainerImplementationStubTwo');
<add> $container->when(ContainerTestContextInjectOne::class)->needs(IContainerContractStub::class)->give(ContainerImplementationStubTwo::class);
<ide>
<ide> $this->assertInstanceOf(
<del> 'Illuminate\Tests\Container\ContainerImplementationStubTwo',
<del> $container->make('Illuminate\Tests\Container\ContainerTestContextInjectOne')->impl
<add> ContainerImplementationStubTwo::class,
<add> $container->make(ContainerTestContextInjectOne::class)->impl
<ide> );
<ide> }
<ide>
<ide> public function testContextualBindingWorksOnNewAliasedInstances()
<ide> {
<ide> $container = new Container;
<ide>
<del> $container->when('Illuminate\Tests\Container\ContainerTestContextInjectOne')->needs('Illuminate\Tests\Container\IContainerContractStub')->give('Illuminate\Tests\Container\ContainerImplementationStubTwo');
<add> $container->when(ContainerTestContextInjectOne::class)->needs(IContainerContractStub::class)->give(ContainerImplementationStubTwo::class);
<ide>
<ide> $container->instance('stub', new ContainerImplementationStub);
<del> $container->alias('stub', 'Illuminate\Tests\Container\IContainerContractStub');
<add> $container->alias('stub', IContainerContractStub::class);
<ide>
<ide> $this->assertInstanceOf(
<del> 'Illuminate\Tests\Container\ContainerImplementationStubTwo',
<del> $container->make('Illuminate\Tests\Container\ContainerTestContextInjectOne')->impl
<add> ContainerImplementationStubTwo::class,
<add> $container->make(ContainerTestContextInjectOne::class)->impl
<ide> );
<ide> }
<ide>
<ide> public function testContextualBindingWorksOnNewAliasedBindings()
<ide> {
<ide> $container = new Container;
<ide>
<del> $container->when('Illuminate\Tests\Container\ContainerTestContextInjectOne')->needs('Illuminate\Tests\Container\IContainerContractStub')->give('Illuminate\Tests\Container\ContainerImplementationStubTwo');
<add> $container->when(ContainerTestContextInjectOne::class)->needs(IContainerContractStub::class)->give(ContainerImplementationStubTwo::class);
<ide>
<ide> $container->bind('stub', ContainerImplementationStub::class);
<del> $container->alias('stub', 'Illuminate\Tests\Container\IContainerContractStub');
<add> $container->alias('stub', IContainerContractStub::class);
<ide>
<ide> $this->assertInstanceOf(
<del> 'Illuminate\Tests\Container\ContainerImplementationStubTwo',
<del> $container->make('Illuminate\Tests\Container\ContainerTestContextInjectOne')->impl
<add> ContainerImplementationStubTwo::class,
<add> $container->make(ContainerTestContextInjectOne::class)->impl
<ide> );
<ide> }
<ide>
<ide> public function testContextualBindingDoesntOverrideNonContextualResolution()
<ide> $container = new Container;
<ide>
<ide> $container->instance('stub', new ContainerImplementationStub);
<del> $container->alias('stub', 'Illuminate\Tests\Container\IContainerContractStub');
<add> $container->alias('stub', IContainerContractStub::class);
<ide>
<del> $container->when('Illuminate\Tests\Container\ContainerTestContextInjectTwo')->needs('Illuminate\Tests\Container\IContainerContractStub')->give('Illuminate\Tests\Container\ContainerImplementationStubTwo');
<add> $container->when(ContainerTestContextInjectTwo::class)->needs(IContainerContractStub::class)->give(ContainerImplementationStubTwo::class);
<ide>
<ide> $this->assertInstanceOf(
<del> 'Illuminate\Tests\Container\ContainerImplementationStubTwo',
<del> $container->make('Illuminate\Tests\Container\ContainerTestContextInjectTwo')->impl
<add> ContainerImplementationStubTwo::class,
<add> $container->make(ContainerTestContextInjectTwo::class)->impl
<ide> );
<ide>
<ide> $this->assertInstanceOf(
<del> 'Illuminate\Tests\Container\ContainerImplementationStub',
<del> $container->make('Illuminate\Tests\Container\ContainerTestContextInjectOne')->impl
<add> ContainerImplementationStub::class,
<add> $container->make(ContainerTestContextInjectOne::class)->impl
<ide> );
<ide> }
<ide>
<ide> public function testContextuallyBoundInstancesAreNotUnnecessarilyRecreated()
<ide>
<ide> $container = new Container;
<ide>
<del> $container->instance('Illuminate\Tests\Container\IContainerContractStub', new ContainerImplementationStub);
<del> $container->instance('Illuminate\Tests\Container\ContainerTestContextInjectInstantiations', new ContainerTestContextInjectInstantiations);
<add> $container->instance(IContainerContractStub::class, new ContainerImplementationStub);
<add> $container->instance(ContainerTestContextInjectInstantiations::class, new ContainerTestContextInjectInstantiations);
<ide>
<ide> $this->assertEquals(1, ContainerTestContextInjectInstantiations::$instantiations);
<ide>
<del> $container->when('Illuminate\Tests\Container\ContainerTestContextInjectOne')->needs('Illuminate\Tests\Container\IContainerContractStub')->give('Illuminate\Tests\Container\ContainerTestContextInjectInstantiations');
<add> $container->when(ContainerTestContextInjectOne::class)->needs(IContainerContractStub::class)->give(ContainerTestContextInjectInstantiations::class);
<ide>
<del> $container->make('Illuminate\Tests\Container\ContainerTestContextInjectOne');
<del> $container->make('Illuminate\Tests\Container\ContainerTestContextInjectOne');
<del> $container->make('Illuminate\Tests\Container\ContainerTestContextInjectOne');
<del> $container->make('Illuminate\Tests\Container\ContainerTestContextInjectOne');
<add> $container->make(ContainerTestContextInjectOne::class);
<add> $container->make(ContainerTestContextInjectOne::class);
<add> $container->make(ContainerTestContextInjectOne::class);
<add> $container->make(ContainerTestContextInjectOne::class);
<ide>
<ide> $this->assertEquals(1, ContainerTestContextInjectInstantiations::$instantiations);
<ide> }
<ide>
<ide> public function testContainerTags()
<ide> {
<ide> $container = new Container;
<del> $container->tag('Illuminate\Tests\Container\ContainerImplementationStub', 'foo', 'bar');
<del> $container->tag('Illuminate\Tests\Container\ContainerImplementationStubTwo', ['foo']);
<add> $container->tag(ContainerImplementationStub::class, 'foo', 'bar');
<add> $container->tag(ContainerImplementationStubTwo::class, ['foo']);
<ide>
<ide> $this->assertCount(1, $container->tagged('bar'));
<ide> $this->assertCount(2, $container->tagged('foo'));
<del> $this->assertInstanceOf('Illuminate\Tests\Container\ContainerImplementationStub', $container->tagged('foo')[0]);
<del> $this->assertInstanceOf('Illuminate\Tests\Container\ContainerImplementationStub', $container->tagged('bar')[0]);
<del> $this->assertInstanceOf('Illuminate\Tests\Container\ContainerImplementationStubTwo', $container->tagged('foo')[1]);
<add> $this->assertInstanceOf(ContainerImplementationStub::class, $container->tagged('foo')[0]);
<add> $this->assertInstanceOf(ContainerImplementationStub::class, $container->tagged('bar')[0]);
<add> $this->assertInstanceOf(ContainerImplementationStubTwo::class, $container->tagged('foo')[1]);
<ide>
<ide> $container = new Container;
<del> $container->tag(['Illuminate\Tests\Container\ContainerImplementationStub', 'Illuminate\Tests\Container\ContainerImplementationStubTwo'], ['foo']);
<add> $container->tag([ContainerImplementationStub::class, ContainerImplementationStubTwo::class], ['foo']);
<ide> $this->assertCount(2, $container->tagged('foo'));
<del> $this->assertInstanceOf('Illuminate\Tests\Container\ContainerImplementationStub', $container->tagged('foo')[0]);
<del> $this->assertInstanceOf('Illuminate\Tests\Container\ContainerImplementationStubTwo', $container->tagged('foo')[1]);
<add> $this->assertInstanceOf(ContainerImplementationStub::class, $container->tagged('foo')[0]);
<add> $this->assertInstanceOf(ContainerImplementationStubTwo::class, $container->tagged('foo')[1]);
<ide>
<ide> $this->assertEmpty($container->tagged('this_tag_does_not_exist'));
<ide> }
<ide> public function testForgetInstanceForgetsInstance()
<ide> {
<ide> $container = new Container;
<ide> $containerConcreteStub = new ContainerConcreteStub;
<del> $container->instance('Illuminate\Tests\Container\ContainerConcreteStub', $containerConcreteStub);
<del> $this->assertTrue($container->isShared('Illuminate\Tests\Container\ContainerConcreteStub'));
<del> $container->forgetInstance('Illuminate\Tests\Container\ContainerConcreteStub');
<del> $this->assertFalse($container->isShared('Illuminate\Tests\Container\ContainerConcreteStub'));
<add> $container->instance(ContainerConcreteStub::class, $containerConcreteStub);
<add> $this->assertTrue($container->isShared(ContainerConcreteStub::class));
<add> $container->forgetInstance(ContainerConcreteStub::class);
<add> $this->assertFalse($container->isShared(ContainerConcreteStub::class));
<ide> }
<ide>
<ide> public function testForgetInstancesForgetsAllInstances()
<ide> public function testItThrowsExceptionWhenAbstractIsSameAsAlias()
<ide> public function testContainerCanInjectSimpleVariable()
<ide> {
<ide> $container = new Container;
<del> $container->when('Illuminate\Tests\Container\ContainerInjectVariableStub')->needs('$something')->give(100);
<del> $instance = $container->make('Illuminate\Tests\Container\ContainerInjectVariableStub');
<add> $container->when(ContainerInjectVariableStub::class)->needs('$something')->give(100);
<add> $instance = $container->make(ContainerInjectVariableStub::class);
<ide> $this->assertEquals(100, $instance->something);
<ide>
<ide> $container = new Container;
<del> $container->when('Illuminate\Tests\Container\ContainerInjectVariableStub')->needs('$something')->give(function ($container) {
<del> return $container->make('Illuminate\Tests\Container\ContainerConcreteStub');
<add> $container->when(ContainerInjectVariableStub::class)->needs('$something')->give(function ($container) {
<add> return $container->make(ContainerConcreteStub::class);
<ide> });
<del> $instance = $container->make('Illuminate\Tests\Container\ContainerInjectVariableStub');
<del> $this->assertInstanceOf('Illuminate\Tests\Container\ContainerConcreteStub', $instance->something);
<add> $instance = $container->make(ContainerInjectVariableStub::class);
<add> $this->assertInstanceOf(ContainerConcreteStub::class, $instance->something);
<ide> }
<ide>
<ide> public function testContainerGetFactory()
<ide> public function testContextualBindingWorksWithAliasedTargets()
<ide> {
<ide> $container = new Container;
<ide>
<del> $container->bind('Illuminate\Tests\Container\IContainerContractStub', 'Illuminate\Tests\Container\ContainerImplementationStub');
<del> $container->alias('Illuminate\Tests\Container\IContainerContractStub', 'interface-stub');
<add> $container->bind(IContainerContractStub::class, ContainerImplementationStub::class);
<add> $container->alias(IContainerContractStub::class, 'interface-stub');
<ide>
<del> $container->alias('Illuminate\Tests\Container\ContainerImplementationStub', 'stub-1');
<add> $container->alias(ContainerImplementationStub::class, 'stub-1');
<ide>
<del> $container->when('Illuminate\Tests\Container\ContainerTestContextInjectOne')->needs('interface-stub')->give('stub-1');
<del> $container->when('Illuminate\Tests\Container\ContainerTestContextInjectTwo')->needs('interface-stub')->give('Illuminate\Tests\Container\ContainerImplementationStubTwo');
<add> $container->when(ContainerTestContextInjectOne::class)->needs('interface-stub')->give('stub-1');
<add> $container->when(ContainerTestContextInjectTwo::class)->needs('interface-stub')->give(ContainerImplementationStubTwo::class);
<ide>
<del> $one = $container->make('Illuminate\Tests\Container\ContainerTestContextInjectOne');
<del> $two = $container->make('Illuminate\Tests\Container\ContainerTestContextInjectTwo');
<add> $one = $container->make(ContainerTestContextInjectOne::class);
<add> $two = $container->make(ContainerTestContextInjectTwo::class);
<ide>
<del> $this->assertInstanceOf('Illuminate\Tests\Container\ContainerImplementationStub', $one->impl);
<del> $this->assertInstanceOf('Illuminate\Tests\Container\ContainerImplementationStubTwo', $two->impl);
<add> $this->assertInstanceOf(ContainerImplementationStub::class, $one->impl);
<add> $this->assertInstanceOf(ContainerImplementationStubTwo::class, $two->impl);
<ide> }
<ide>
<ide> public function testResolvingCallbacksShouldBeFiredWhenCalledWithAliases()
<ide> public function testCanBuildWithoutParameterStackWithNoConstructors()
<ide> public function testCanBuildWithoutParameterStackWithConstructors()
<ide> {
<ide> $container = new Container;
<del> $container->bind('Illuminate\Tests\Container\IContainerContractStub', 'Illuminate\Tests\Container\ContainerImplementationStub');
<add> $container->bind(IContainerContractStub::class, ContainerImplementationStub::class);
<ide> $this->assertInstanceOf(ContainerDependentStub::class, $container->build(ContainerDependentStub::class));
<ide> }
<ide>
<ide> public function testContainerKnowsEntry()
<ide> {
<ide> $container = new Container;
<del> $container->bind('Illuminate\Tests\Container\IContainerContractStub', 'Illuminate\Tests\Container\ContainerImplementationStub');
<del> $this->assertTrue($container->has('Illuminate\Tests\Container\IContainerContractStub'));
<add> $container->bind(IContainerContractStub::class, ContainerImplementationStub::class);
<add> $this->assertTrue($container->has(IContainerContractStub::class));
<ide> }
<ide>
<ide> public function testContainerCanBindAnyWord() | 1 |
Text | Text | add readme files 1/7 | 47dd31f4a1aaa371f3b822e178fd273c68f45962 | <ide><path>arithmetic_analysis/README.md
<add># Arithmetic analysis
<add>
<add>Arithmetic analysis is a branch of mathematics that deals with solving linear equations.
<add>
<add>* <https://en.wikipedia.org/wiki/System_of_linear_equations>
<add>* <https://en.wikipedia.org/wiki/Gaussian_elimination>
<add>* <https://en.wikipedia.org/wiki/Root-finding_algorithms>
<ide><path>audio_filters/README.md
<add># Audio Filter
<add>
<add>Audio filters work on the frequency of an audio signal to attenuate unwanted frequency and amplify wanted ones.
<add>They are used within anything related to sound, whether it is radio communication or a hi-fi system.
<add>
<add>* <https://www.masteringbox.com/filter-types/>
<add>* <http://ethanwiner.com/filters.html>
<add>* <https://en.wikipedia.org/wiki/Audio_filter>
<add>* <https://en.wikipedia.org/wiki/Electronic_filter>
<ide><path>backtracking/README.md
<add># Backtracking
<add>
<add>Backtracking is a way to speed up the search process by removing candidates when they can't be the solution of a problem.
<add>
<add>* <https://en.wikipedia.org/wiki/Backtracking>
<add>* <https://en.wikipedia.org/wiki/Decision_tree_pruning>
<add>* <https://medium.com/@priyankmistry1999/backtracking-sudoku-6e4439e4825c>
<add>* <https://www.geeksforgeeks.org/sudoku-backtracking-7/>
<ide><path>bit_manipulation/README.md
<del>* https://docs.python.org/3/reference/expressions.html#binary-bitwise-operations
<del>* https://docs.python.org/3/reference/expressions.html#unary-arithmetic-and-bitwise-operations
<del>* https://docs.python.org/3/library/stdtypes.html#bitwise-operations-on-integer-types
<del>* https://wiki.python.org/moin/BitManipulation
<del>* https://wiki.python.org/moin/BitwiseOperators
<del>* https://www.tutorialspoint.com/python3/bitwise_operators_example.htm
<add># Bit manipulation
<add>
<add>Bit manipulation is the act of manipulating bits to detect errors (hamming code), encrypts and decrypts messages (more on that in the 'ciphers' folder) or just do anything at the lowest level of your computer.
<add>
<add>* <https://en.wikipedia.org/wiki/Bit_manipulation>
<add>* <https://docs.python.org/3/reference/expressions.html#binary-bitwise-operations>
<add>* <https://docs.python.org/3/reference/expressions.html#unary-arithmetic-and-bitwise-operations>
<add>* <https://docs.python.org/3/library/stdtypes.html#bitwise-operations-on-integer-types>
<add>* <https://wiki.python.org/moin/BitManipulation>
<add>* <https://wiki.python.org/moin/BitwiseOperators>
<add>* <https://www.tutorialspoint.com/python3/bitwise_operators_example.htm>
<ide><path>boolean_algebra/README.md
<add># Boolean Algebra
<add>
<add>Boolean algebra is used to do arithmetic with bits of values True (1) or False (0).
<add>There are three basic operations: 'and', 'or' and 'not'.
<add>
<add>* <https://en.wikipedia.org/wiki/Boolean_algebra>
<add>* <https://plato.stanford.edu/entries/boolalg-math/> | 5 |
Javascript | Javascript | remove helper object from fallbackcompositionstate | a869f992a88692f9d9a964e20ee7dc844bc7760a | <ide><path>packages/react-dom/src/events/FallbackCompositionState.js
<ide> import getTextContentAccessor from '../client/getTextContentAccessor';
<ide>
<ide> /**
<del> * This helper object stores information about text content of a target node,
<add> * These variables store information about text content of a target node,
<ide> * allowing comparison of content before and after a given event.
<ide> *
<ide> * Identify the node where selection currently begins, then observe
<ide> import getTextContentAccessor from '../client/getTextContentAccessor';
<ide> *
<ide> *
<ide> */
<del>const compositionState = {
<del> _root: null,
<del> _startText: null,
<del> _fallbackText: null,
<del>};
<add>
<add>let root = null;
<add>let startText = null;
<add>let fallbackText = null;
<ide>
<ide> export function initialize(nativeEventTarget) {
<del> compositionState._root = nativeEventTarget;
<del> compositionState._startText = getText();
<add> root = nativeEventTarget;
<add> startText = getText();
<ide> return true;
<ide> }
<ide>
<ide> export function reset() {
<del> compositionState._root = null;
<del> compositionState._startText = null;
<del> compositionState._fallbackText = null;
<add> root = null;
<add> startText = null;
<add> fallbackText = null;
<ide> }
<ide>
<ide> export function getData() {
<del> if (compositionState._fallbackText) {
<del> return compositionState._fallbackText;
<add> if (fallbackText) {
<add> return fallbackText;
<ide> }
<ide>
<ide> let start;
<del> const startValue = compositionState._startText;
<add> const startValue = startText;
<ide> const startLength = startValue.length;
<ide> let end;
<ide> const endValue = getText();
<ide> export function getData() {
<ide> }
<ide>
<ide> const sliceTail = end > 1 ? 1 - end : undefined;
<del> compositionState._fallbackText = endValue.slice(start, sliceTail);
<del> return compositionState._fallbackText;
<add> fallbackText = endValue.slice(start, sliceTail);
<add> return fallbackText;
<ide> }
<ide>
<ide> export function getText() {
<del> if ('value' in compositionState._root) {
<del> return compositionState._root.value;
<add> if ('value' in root) {
<add> return root.value;
<ide> }
<del> return compositionState._root[getTextContentAccessor()];
<add> return root[getTextContentAccessor()];
<ide> } | 1 |
Python | Python | preserve norm dtype for order 0 | 8cfc788643af035298a038410b73e044da695842 | <ide><path>numpy/linalg/linalg.py
<ide> def norm(x, ord=None, axis=None, keepdims=False):
<ide> return abs(x).min(axis=axis, keepdims=keepdims)
<ide> elif ord == 0:
<ide> # Zero norm
<del> return (x != 0).astype(float).sum(axis=axis, keepdims=keepdims)
<add> return (x != 0).astype(x.real.dtype).sum(axis=axis, keepdims=keepdims)
<ide> elif ord == 1:
<ide> # special case for speedup
<ide> return add.reduce(abs(x), axis=axis, keepdims=keepdims) | 1 |
Ruby | Ruby | tell the user to run doctor after installing | 46a9c9b6a09a67d8ebfc0fd07fc942a627f135a0 | <ide><path>Library/Contributions/install_homebrew.rb
<ide> def macos_version
<ide> end
<ide>
<ide> ohai "Installation successful!"
<add>puts "You should run `brew doctor' *before* you install anything."
<ide> puts "Now type: brew help" | 1 |
Javascript | Javascript | check splitdata for null and undefined | 9f055206860ab2e110c33e1e6fab3a3232284565 | <ide><path>lib/optimize/AggressiveSplittingPlugin.js
<ide> class AggressiveSplittingPlugin {
<ide> newChunk._fromAggressiveSplitting = true;
<ide> if(j < savedSplits.length)
<ide> newChunk._fromAggressiveSplittingIndex = j;
<del> if(splitData.id !== null) newChunk.id = splitData.id;
<add> if(splitData.id !== null && splitData.id !== undefined) {
<add> newChunk.id = splitData.id;
<add> }
<ide> newChunk.origins = chunk.origins.map(copyWithReason);
<ide> chunk.origins = chunk.origins.map(copyWithReason);
<ide> return true;
<ide> } else {
<ide> if(j < savedSplits.length)
<ide> chunk._fromAggressiveSplittingIndex = j;
<ide> chunk.name = null;
<del> if(splitData.id !== null) chunk.id = splitData.id;
<add> if(splitData.id !== null && splitData.id !== undefined) {
<add> chunk.id = splitData.id;
<add> }
<ide> }
<ide> }
<ide> } | 1 |
Javascript | Javascript | remove async transition docs | 2ae680f7fc4ccb16478811c91d2eefabaa89b18e | <ide><path>packages/ember-states/lib/state.js
<ide> Ember.State = Ember.Object.extend(Ember.Evented,
<ide>
<ide> @event
<ide> @param {Ember.StateManager} manager
<del> @param {Object} transition
<del> @param {Function} transition.async
<del> @param {Function} transition.resume
<ide> */
<ide> enter: Ember.K,
<ide>
<ide> Ember.State = Ember.Object.extend(Ember.Evented,
<ide>
<ide> @event
<ide> @param {Ember.StateManager} manager
<del> @param {Object} transition
<del> @param {Function} transition.async
<del> @param {Function} transition.resume
<ide> */
<ide> exit: Ember.K
<ide> });
<ide><path>packages/ember-states/lib/state_manager.js
<ide> require('ember-states/state');
<ide> robotManager = Ember.StateManager.create({
<ide> initialState: 'poweredDown',
<ide> poweredDown: Ember.State.create({
<del> exit: function(stateManager, transition){
<add> exit: function(stateManager){
<ide> console.log("exiting the poweredDown state")
<ide> }
<ide> }),
<ide> poweredUp: Ember.State.create({
<del> enter: function(stateManager, transition){
<add> enter: function(stateManager){
<ide> console.log("entering the poweredUp state. Destroy all humans.")
<ide> }
<ide> })
<ide> require('ember-states/state');
<ide> robotManager = Ember.StateManager.create({
<ide> initialState: 'poweredDown',
<ide> poweredDown: Ember.State.create({
<del> exit: function(stateManager, transition){
<add> exit: function(stateManager){
<ide> console.log("exiting the poweredDown state")
<ide> }
<ide> }),
<ide> poweredUp: Ember.State.create({
<del> enter: function(stateManager, transition){
<add> enter: function(stateManager){
<ide> console.log("entering the poweredUp state. Destroy all humans.")
<ide> }
<ide> })
<ide><path>packages/ember-viewstates/lib/view_state.js
<ide> var get = Ember.get, set = Ember.set;
<ide> viewStates = Ember.StateManager.create({
<ide> aState: Ember.ViewState.create({
<ide> view: Ember.View.extend({}),
<del> enter: function(manager, transition){
<add> enter: function(manager){
<ide> // calling _super ensures this view will be
<ide> // properly inserted
<del> this._super(manager, transition);
<add> this._super(manager);
<ide>
<ide> // now you can do other things
<ide> } | 3 |
Javascript | Javascript | fix tests with same names | 8bfaf7fba84decc5123133be7b1aaaff68a3582d | <ide><path>packages/ember/tests/routing/basic_test.js
<ide> asyncTest("Events are triggered on the current state", function() {
<ide> action.handler(event);
<ide> });
<ide>
<del>asyncTest("Events are triggered on the current state", function() {
<add>asyncTest("Events are triggered on the current state when routes are nested", function() {
<ide> Router.map(function(match) {
<ide> match("/").to("root", function(match) {
<ide> match("/").to("home"); | 1 |
Javascript | Javascript | add new test for node.fs.stat() | 88ad880556673c06f44acacd5bf1c0eee8a71e52 | <ide><path>test/mjsunit/test-fs-stat.js
<add>include("mjsunit.js");
<add>
<add>var got_error = false;
<add>var got_success = false;
<add>var stats;
<add>
<add>var promise = node.fs.stat(".");
<add>
<add>promise.addCallback(function (_stats) {
<add> stats = _stats;
<add> p(stats);
<add> got_success = true;
<add>});
<add>
<add>promise.addErrback(function () {
<add> got_error = true;
<add>});
<add>
<add>function onExit () {
<add> assertTrue(got_success);
<add> assertFalse(got_error);
<add> assertTrue(stats.mtime instanceof Date);
<add>}
<add> | 1 |
Javascript | Javascript | replace callback with arrow function | f85b43537d6dff4004081fcc81f8aa771efbe1e5 | <ide><path>test/parallel/test-child-process-kill.js
<ide> cat.stdout.on('end', common.mustCall());
<ide> cat.stderr.on('data', common.mustNotCall());
<ide> cat.stderr.on('end', common.mustCall());
<ide>
<del>cat.on('exit', common.mustCall(function(code, signal) {
<add>cat.on('exit', common.mustCall((code, signal) => {
<ide> assert.strictEqual(code, null);
<ide> assert.strictEqual(signal, 'SIGTERM');
<ide> })); | 1 |
PHP | PHP | use 256 cbc | 6cacd3e3cb43f1e672c992eaf8b4fadef36d9ac6 | <ide><path>tests/Encryption/EncrypterTest.php
<ide> public function testOpenSslEncrypterCanDecryptMcryptedData()
<ide> $key = str_random(32);
<ide> $encrypter = new Illuminate\Encryption\McryptEncrypter($key);
<ide> $encrypted = $encrypter->encrypt('foo');
<del> $openSslEncrypter = new Illuminate\Encryption\Encrypter($key);
<add> $openSslEncrypter = new Illuminate\Encryption\Encrypter($key, 'AES-256-CBC');
<ide>
<ide> $this->assertEquals('foo', $openSslEncrypter->decrypt($encrypted));
<ide> } | 1 |
Ruby | Ruby | fix possible memory leak of connectionhandler | 20a72627900330cf9c95cf506458cdec4d16a836 | <ide><path>activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
<ide> def checkout_and_verify(c)
<ide> # about the model. The model needs to pass a specification name to the handler,
<ide> # in order to look up the correct connection pool.
<ide> class ConnectionHandler
<add> def self.create_owner_to_pool
<add> Concurrent::Map.new(initial_capacity: 2) do |h, k|
<add> # Discard the parent's connection pools immediately; we have no need
<add> # of them
<add> ConnectionHandler.discard_unowned_pools(h)
<add>
<add> h[k] = Concurrent::Map.new(initial_capacity: 2)
<add> end
<add> end
<add>
<ide> def self.unowned_pool_finalizer(pid_map) # :nodoc:
<ide> lambda do |_|
<ide> discard_unowned_pools(pid_map)
<ide> def self.discard_unowned_pools(pid_map) # :nodoc:
<ide>
<ide> def initialize
<ide> # These caches are keyed by spec.name (ConnectionSpecification#name).
<del> @owner_to_pool = Concurrent::Map.new(initial_capacity: 2) do |h, k|
<del> # Discard the parent's connection pools immediately; we have no need
<del> # of them
<del> ConnectionHandler.discard_unowned_pools(h)
<del>
<del> h[k] = Concurrent::Map.new(initial_capacity: 2)
<del> end
<add> @owner_to_pool = ConnectionHandler.create_owner_to_pool
<ide>
<ide> # Backup finalizer: if the forked child never needed a pool, the above
<ide> # early discard has not occurred | 1 |
Python | Python | create separate *nullableonetoonetests testcase | a897eb5480348838b11fdb428ce0d110e8bc8da1 | <ide><path>rest_framework/tests/models.py
<ide> class NullableForeignKeySource(RESTFrameworkModel):
<ide> target = models.ForeignKey(ForeignKeyTarget, null=True, blank=True,
<ide> related_name='nullable_sources')
<ide>
<add>
<add># OneToOne
<add>class OneToOneTarget(RESTFrameworkModel):
<add> name = models.CharField(max_length=100)
<add>
<add>
<ide> class NullableOneToOneSource(RESTFrameworkModel):
<ide> name = models.CharField(max_length=100)
<del> target = models.OneToOneField(ForeignKeyTarget, null=True, blank=True,
<add> target = models.OneToOneField(OneToOneTarget, null=True, blank=True,
<ide> related_name='nullable_source')
<ide><path>rest_framework/tests/relations_hyperlink.py
<ide> from django.test import TestCase
<ide> from rest_framework import serializers
<ide> from rest_framework.compat import patterns, url
<del>from rest_framework.tests.models import ManyToManyTarget, ManyToManySource, ForeignKeyTarget, ForeignKeySource
<add>from rest_framework.tests.models import ManyToManyTarget, ManyToManySource, ForeignKeyTarget, ForeignKeySource, NullableForeignKeySource, OneToOneTarget, NullableOneToOneSource
<ide>
<ide> def dummy_view(request, pk):
<ide> pass
<ide> def dummy_view(request, pk):
<ide> url(r'^foreignkeysource/(?P<pk>[0-9]+)/$', dummy_view, name='foreignkeysource-detail'),
<ide> url(r'^foreignkeytarget/(?P<pk>[0-9]+)/$', dummy_view, name='foreignkeytarget-detail'),
<ide> url(r'^nullableforeignkeysource/(?P<pk>[0-9]+)/$', dummy_view, name='nullableforeignkeysource-detail'),
<add> url(r'^onetoonetarget/(?P<pk>[0-9]+)/$', dummy_view, name='onetoonetarget-detail'),
<add> url(r'^nullableonetoonesource/(?P<pk>[0-9]+)/$', dummy_view, name='nullableonetoonesource-detail'),
<ide> )
<ide>
<ide> class ManyToManyTargetSerializer(serializers.HyperlinkedModelSerializer):
<ide> class Meta:
<ide>
<ide>
<ide> # Nullable ForeignKey
<add>class NullableForeignKeySourceSerializer(serializers.HyperlinkedModelSerializer):
<add> class Meta:
<add> model = NullableForeignKeySource
<ide>
<del>class NullableForeignKeySource(models.Model):
<del> name = models.CharField(max_length=100)
<del> target = models.ForeignKey(ForeignKeyTarget, null=True, blank=True,
<del> related_name='nullable_sources')
<ide>
<add># OneToOne
<add>class NullableOneToOneTargetSerializer(serializers.HyperlinkedModelSerializer):
<add> nullable_source = serializers.HyperlinkedRelatedField(view_name='nullableonetoonesource-detail')
<ide>
<del>class NullableForeignKeySourceSerializer(serializers.HyperlinkedModelSerializer):
<ide> class Meta:
<del> model = NullableForeignKeySource
<add> model = OneToOneTarget
<ide>
<ide>
<ide> # TODO: Add test that .data cannot be accessed prior to .is_valid
<ide> def test_foreign_key_update_with_valid_emptystring(self):
<ide> # {'id': 2, 'name': u'target-2', 'sources': []},
<ide> # ]
<ide> # self.assertEquals(serializer.data, expected)
<add>
<add>
<add>class HyperlinkedNullableOneToOneTests(TestCase):
<add> urls = 'rest_framework.tests.relations_hyperlink'
<add>
<add> def setUp(self):
<add> target = OneToOneTarget(name='target-1')
<add> target.save()
<add> new_target = OneToOneTarget(name='target-2')
<add> new_target.save()
<add> source = NullableOneToOneSource(name='source-1', target=target)
<add> source.save()
<add>
<add> def test_reverse_foreign_key_retrieve_with_null(self):
<add> queryset = OneToOneTarget.objects.all()
<add> serializer = NullableOneToOneTargetSerializer(queryset)
<add> expected = [
<add> {'url': '/onetoonetarget/1/', 'name': u'target-1', 'nullable_source': '/nullableonetoonesource/1/'},
<add> {'url': '/onetoonetarget/2/', 'name': u'target-2', 'nullable_source': None},
<add> ]
<add> self.assertEquals(serializer.data, expected)
<ide><path>rest_framework/tests/relations_nested.py
<ide> from django.db import models
<ide> from django.test import TestCase
<ide> from rest_framework import serializers
<del>from rest_framework.tests.models import ForeignKeyTarget, ForeignKeySource, NullableForeignKeySource, NullableOneToOneSource
<add>from rest_framework.tests.models import ForeignKeyTarget, ForeignKeySource, NullableForeignKeySource, OneToOneTarget, NullableOneToOneSource
<ide>
<ide>
<ide> class ForeignKeySourceSerializer(serializers.ModelSerializer):
<ide> class Meta:
<ide> model = NullableForeignKeySource
<ide>
<ide>
<del>class NullableForeignKeyTargetSerializer(serializers.ModelSerializer):
<del> nullable_source = serializers.PrimaryKeyRelatedField()
<add>class NullableOneToOneSourceSerializer(serializers.ModelSerializer):
<add> class Meta:
<add> model = NullableOneToOneSource
<add>
<add>
<add>class NullableOneToOneTargetSerializer(serializers.ModelSerializer):
<add> nullable_source = NullableOneToOneSourceSerializer()
<ide>
<ide> class Meta:
<del> model = ForeignKeyTarget
<add> model = OneToOneTarget
<ide>
<ide>
<ide> class ReverseForeignKeyTests(TestCase):
<ide> class NestedNullableForeignKeyTests(TestCase):
<ide> def setUp(self):
<ide> target = ForeignKeyTarget(name='target-1')
<ide> target.save()
<del> new_target = ForeignKeyTarget(name='target-2')
<del> new_target.save()
<del> one_source = NullableOneToOneSource(name='one-source-1', target=target)
<del> one_source.save()
<ide> for idx in range(1, 4):
<ide> if idx == 3:
<ide> target = None
<ide> def test_foreign_key_retrieve_with_null(self):
<ide> ]
<ide> self.assertEquals(serializer.data, expected)
<ide>
<add>
<add>class NestedNullableOneToOneTests(TestCase):
<add> def setUp(self):
<add> target = OneToOneTarget(name='target-1')
<add> target.save()
<add> new_target = OneToOneTarget(name='target-2')
<add> new_target.save()
<add> source = NullableOneToOneSource(name='source-1', target=target)
<add> source.save()
<add>
<ide> def test_reverse_foreign_key_retrieve_with_null(self):
<del> queryset = ForeignKeyTarget.objects.all()
<del> serializer = NullableForeignKeyTargetSerializer(queryset)
<add> queryset = OneToOneTarget.objects.all()
<add> serializer = NullableOneToOneTargetSerializer(queryset)
<ide> expected = [
<del> {'id': 1, 'name': u'target-1', 'nullable_source': 1},
<add> {'id': 1, 'name': u'target-1', 'nullable_source': {'id': 1, 'name': u'source-1', 'target': 1}},
<ide> {'id': 2, 'name': u'target-2', 'nullable_source': None},
<ide> ]
<ide> self.assertEquals(serializer.data, expected)
<ide><path>rest_framework/tests/relations_pk.py
<ide> from django.db import models
<ide> from django.test import TestCase
<ide> from rest_framework import serializers
<del>from rest_framework.tests.models import ManyToManyTarget, ManyToManySource, ForeignKeyTarget, ForeignKeySource, NullableForeignKeySource
<add>from rest_framework.tests.models import ManyToManyTarget, ManyToManySource, ForeignKeyTarget, ForeignKeySource, NullableForeignKeySource, OneToOneTarget, NullableOneToOneSource
<ide>
<ide>
<ide> class ManyToManyTargetSerializer(serializers.ModelSerializer):
<ide> class Meta:
<ide> model = NullableForeignKeySource
<ide>
<ide>
<add># OneToOne
<add>class NullableOneToOneTargetSerializer(serializers.ModelSerializer):
<add> nullable_source = serializers.PrimaryKeyRelatedField()
<add>
<add> class Meta:
<add> model = OneToOneTarget
<add>
<add>
<ide> # TODO: Add test that .data cannot be accessed prior to .is_valid
<ide>
<ide> class PKManyToManyTests(TestCase):
<ide> def test_foreign_key_update_with_valid_emptystring(self):
<ide> # {'id': 2, 'name': u'target-2', 'sources': []},
<ide> # ]
<ide> # self.assertEquals(serializer.data, expected)
<add>
<add>
<add>class PKNullableOneToOneTests(TestCase):
<add> def setUp(self):
<add> target = OneToOneTarget(name='target-1')
<add> target.save()
<add> new_target = OneToOneTarget(name='target-2')
<add> new_target.save()
<add> source = NullableOneToOneSource(name='source-1', target=target)
<add> source.save()
<add>
<add> def test_reverse_foreign_key_retrieve_with_null(self):
<add> queryset = OneToOneTarget.objects.all()
<add> serializer = NullableOneToOneTargetSerializer(queryset)
<add> expected = [
<add> {'id': 1, 'name': u'target-1', 'nullable_source': 1},
<add> {'id': 2, 'name': u'target-2', 'nullable_source': None},
<add> ]
<add> self.assertEquals(serializer.data, expected) | 4 |
Text | Text | clarify a step in the quick start | 040e94b7f5c426db7e7a13a4d0c9b9b13e4ed249 | <ide><path>docs/docs/getting-started.md
<ide> In the root directory of the starter kit, create a `helloworld.html` with the fo
<ide> </html>
<ide> ```
<ide>
<del>The XML syntax inside of JavaScript is called JSX; check out the [JSX syntax](/react/docs/jsx-in-depth.html) to learn more about it. In order to translate it to vanilla JavaScript we use `<script type="text/babel">` and include Babel to actually perform the transformation in the browser.
<add>The XML syntax inside of JavaScript is called JSX; check out the [JSX syntax](/react/docs/jsx-in-depth.html) to learn more about it. In order to translate it to vanilla JavaScript we use `<script type="text/babel">` and include Babel to actually perform the transformation in the browser. Open the html from a browser and you should already be able to see the greeting!
<ide>
<ide> ### Separate File
<ide> | 1 |
Javascript | Javascript | fix typos in js and css selector | 1ce5d216c7b31fb711fce736af0b061d5f6b4bba | <ide><path>src/ngAnimate/module.js
<ide> * ngModule.directive('greetingBox', ['$animate', function($animate) {
<ide> * return function(scope, element, attrs) {
<ide> * attrs.$observe('active', function(value) {
<del> * value ? $animate.addClass(element, 'on') ? $animate.removeClass(element, 'on');
<add> * value ? $animate.addClass(element, 'on') : $animate.removeClass(element, 'on');
<ide> * });
<ide> * });
<ide> * }]);
<ide> *
<ide> * ```css
<ide> * /* normally we would create a CSS class to reference on the element */
<del> * [greeting-box].on { transition:0.5s linear all; background:green; color:white; }
<add> * greeting-box.on { transition:0.5s linear all; background:green; color:white; }
<ide> * ```
<ide> *
<ide> * The `$animate` service contains a variety of other methods like `enter`, `leave`, `animate` and `setClass`. To learn more about what's | 1 |
Python | Python | remove global statement | 643b46454c8a2049064744dbf207a3b85f0d91b7 | <ide><path>numpy/linalg/linalg.py
<ide> class LinAlgError(Exception):
<ide> """
<ide> pass
<ide>
<del># Dealing with errors in _umath_linalg
<del>
<del>_linalg_error_extobj = None
<ide>
<ide> def _determine_error_states():
<del> global _linalg_error_extobj
<ide> errobj = geterrobj()
<ide> bufsize = errobj[0]
<ide>
<ide> with errstate(invalid='call', over='ignore',
<ide> divide='ignore', under='ignore'):
<ide> invalid_call_errmask = geterrobj()[1]
<ide>
<del> _linalg_error_extobj = [bufsize, invalid_call_errmask, None]
<add> return [bufsize, invalid_call_errmask, None]
<ide>
<del>_determine_error_states()
<add># Dealing with errors in _umath_linalg
<add>_linalg_error_extobj = _determine_error_states()
<add>del _determine_error_states
<ide>
<ide> def _raise_linalgerror_singular(err, flag):
<ide> raise LinAlgError("Singular matrix")
<ide> def _raise_linalgerror_svd_nonconvergence(err, flag):
<ide> raise LinAlgError("SVD did not converge")
<ide>
<ide> def get_linalg_error_extobj(callback):
<del> extobj = list(_linalg_error_extobj)
<add> extobj = list(_linalg_error_extobj) # make a copy
<ide> extobj[2] = callback
<ide> return extobj
<ide> | 1 |
PHP | PHP | add getter for the defferedservice property | f44f335e29dca1198814e45df473489cb18305cc | <ide><path>src/Illuminate/Foundation/Application.php
<ide> public function getLoadedProviders()
<ide> return $this->loadedProviders;
<ide> }
<ide>
<add> /**
<add> * Get the application's deferred services.
<add> *
<add> * @return array
<add> */
<add> public function getDeferredServices()
<add> {
<add> return $this->deferredServices;
<add> }
<add>
<ide> /**
<ide> * Set the application's deferred services.
<ide> * | 1 |
Text | Text | copy editing as guide [ci skip] | 2f0a5c7ac506b900d101620c4cc338a88ee620e3 | <ide><path>guides/source/active_support_core_extensions.md
<ide> NOTE: Defined in `active_support/core_ext/object/with_options.rb`.
<ide>
<ide> ### JSON support
<ide>
<del>Active Support provides a better implemention of `to_json` than the json gem ordinarily provides for Ruby objects. This is because some classes, like Hash and OrderedHash, needs special handling in order to provide a proper JSON representation.
<add>Active Support provides a better implemention of `to_json` than the +json+ gem ordinarily provides for Ruby objects. This is because some classes, like +Hash+ and +OrderedHash+ needs special handling in order to provide a proper JSON representation.
<ide>
<del>Active Support also provides an implementation of `as_json` for the Process::Status class.
<add>Active Support also provides an implementation of `as_json` for the <tt>Process::Status</tt> class.
<ide>
<ide> NOTE: Defined in `active_support/core_ext/object/to_json.rb`.
<ide>
<ide> C.new(0, 1).instance_values # => {"x" => 0, "y" => 1}
<ide>
<ide> NOTE: Defined in `active_support/core_ext/object/instance_variables.rb`.
<ide>
<del>#### `instance_values`
<del>
<del>The method `instance_values` returns a hash that maps instance variable names without "@" to their
<del>corresponding values. Keys are strings:
<del>
<del>```ruby
<del>class C
<del> def initialize(x, y)
<del> @x, @y = x, y
<del> end
<del>end
<del>
<del>C.new(0, 1).instance_values # => {"x" => 0, "y" => 1}
<del>```
<del>
<del>NOTE: Defined in `active_support/core_ext/object/instance_variables.rb`.
<del>
<ide> #### `instance_variable_names`
<ide>
<ide> The method `instance_variable_names` returns an array. Each name includes the "@" sign.
<ide> NOTE: Defined in `active_support/core_ext/integer/inflections.rb`.
<ide> Extensions to `BigDecimal`
<ide> --------------------------
<ide> ### `to_s`
<add>
<ide> The method `to_s` is aliased to `to_formatted_s`. This provides a convenient way to display a BigDecimal value in floating-point notation:
<ide>
<ide> ```ruby
<ide> BigDecimal.new(5.00, 6).to_s # => "5.0"
<ide> ```
<ide>
<ide> ### `to_formatted_s`
<add>
<ide> Te method `to_formatted_s` provides a default specifier of "F". This means that a simple call to `to_formatted_s` or `to_s` will result in floating point representation instead of engineering notation:
<ide>
<ide> ```ruby | 1 |
Mixed | Ruby | remove deprecated argument `name` from `#indexes` | d6b779ecebe57f6629352c34bfd6c442ac8fba0e | <ide><path>activerecord/CHANGELOG.md
<add>* Remove deprecated argument `name` from `#indexes`.
<add>
<add> *Rafael Mendonça França*
<add>
<ide> * Remove deprecated method `ActiveRecord::Migrator.schema_migrations_table_name`.
<ide>
<ide> *Rafael Mendonça França*
<ide><path>activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
<ide> def view_exists?(view_name)
<ide> end
<ide>
<ide> # Returns an array of indexes for the given table.
<del> def indexes(table_name, name = nil)
<add> def indexes(table_name)
<ide> raise NotImplementedError, "#indexes is not implemented"
<ide> end
<ide>
<ide><path>activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb
<ide> module ConnectionAdapters
<ide> module MySQL
<ide> module SchemaStatements # :nodoc:
<ide> # Returns an array of indexes for the given table.
<del> def indexes(table_name, name = nil)
<del> if name
<del> ActiveSupport::Deprecation.warn(<<-MSG.squish)
<del> Passing name to #indexes is deprecated without replacement.
<del> MSG
<del> end
<del>
<add> def indexes(table_name)
<ide> indexes = []
<ide> current_index = nil
<ide> execute_and_free("SHOW KEYS FROM #{quote_table_name(table_name)}", "SCHEMA") do |result|
<ide><path>activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
<ide> # frozen_string_literal: true
<ide>
<del>require "active_support/core_ext/string/strip"
<del>
<ide> module ActiveRecord
<ide> module ConnectionAdapters
<ide> module PostgreSQL
<ide> def index_name_exists?(table_name, index_name)
<ide> end
<ide>
<ide> # Returns an array of indexes for the given table.
<del> def indexes(table_name, name = nil) # :nodoc:
<del> if name
<del> ActiveSupport::Deprecation.warn(<<-MSG.squish)
<del> Passing name to #indexes is deprecated without replacement.
<del> MSG
<del> end
<del>
<add> def indexes(table_name) # :nodoc:
<ide> scope = quoted_scope(table_name)
<ide>
<ide> result = query(<<-SQL, "SCHEMA")
<ide><path>activerecord/lib/active_record/connection_adapters/sqlite3/schema_statements.rb
<ide> module ConnectionAdapters
<ide> module SQLite3
<ide> module SchemaStatements # :nodoc:
<ide> # Returns an array of indexes for the given table.
<del> def indexes(table_name, name = nil)
<del> if name
<del> ActiveSupport::Deprecation.warn(<<-MSG.squish)
<del> Passing name to #indexes is deprecated without replacement.
<del> MSG
<del> end
<del>
<add> def indexes(table_name)
<ide> exec_query("PRAGMA index_list(#{quote_table_name(table_name)})", "SCHEMA").map do |row|
<ide> index_sql = query_value(<<-SQL, "SCHEMA")
<ide> SELECT sql
<ide><path>activerecord/test/cases/adapters/postgresql/connection_test.rb
<ide> def test_tables_logs_name
<ide> end
<ide>
<ide> def test_indexes_logs_name
<del> assert_deprecated { @connection.indexes("items", "hello") }
<add> @connection.indexes("items")
<ide> assert_equal "SCHEMA", @subscriber.logged[0][1]
<ide> end
<ide>
<ide><path>activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb
<ide> def test_tables_logs_name
<ide> end
<ide> end
<ide>
<del> def test_indexes_logs_name
<del> with_example_table do
<del> assert_logged [["PRAGMA index_list(\"ex\")", "SCHEMA", []]] do
<del> assert_deprecated { @conn.indexes("ex", "hello") }
<del> end
<del> end
<del> end
<del>
<ide> def test_table_exists_logs_name
<ide> with_example_table do
<ide> sql = <<-SQL | 7 |
Text | Text | add the contributing.md file | 92fd4918807749ebc9dfd21d6e063edbc00f01be | <ide><path>CONTRIBUTING.md
<add># Contributing to Glances
<add>
<add>Looking to contribute something to Glances ? **Here's how you can help.**
<add>
<add>Please take a moment to review this document in order to make the contribution
<add>process easy and effective for everyone involved.
<add>
<add>Following these guidelines helps to communicate that you respect the time of
<add>the developers managing and developing this open source project. In return,
<add>they should reciprocate that respect in addressing your issue or assessing
<add>patches and features.
<add>
<add>
<add>## Using the issue tracker
<add>
<add>The [issue tracker](https://github.com/nicolargos/glances/issues) is
<add>the preferred channel for [bug reports](#bug-reports), [features requests](#feature-requests)
<add>and [submitting pull requests](#pull-requests), but please respect the following
<add>restrictions:
<add>
<add>* Please **do not** use the issue tracker for personal support requests. A official Q&A exist. [Use it](https://groups.google.com/forum/?hl=en#!forum/glances-users)!
<add>
<add>* Please **do not** derail or troll issues. Keep the discussion on topic and
<add> respect the opinions of others.
<add>
<add>
<add>## Bug reports
<add>
<add>A bug is a _demonstrable problem_ that is caused by the code in the repository.
<add>Good bug reports are extremely helpful, so thanks!
<add>
<add>Guidelines for bug reports:
<add>
<add>0. **Use the GitHub issue search** — check if the issue has already been
<add> reported.
<add>
<add>1. **Check if the issue has been fixed** — try to reproduce it using the
<add> latest `master` or `develop` branch in the repository.
<add>
<add>2. **Isolate the problem** — ideally create a simple test bed.
<add>
<add>3. **Give us your test environment** — Operating system name and version
<add> Glances version...
<add>
<add>Example:
<add>
<add>> Short and descriptive example bug report title
<add>>
<add>> A summary of the issue and the browser/OS environment in which it occurs. If
<add>> suitable, include the steps required to reproduce the bug.
<add>>
<add>> 1. This is the first step
<add>> 2. This is the second step
<add>> 3. Further steps, etc.
<add>>
<add>> Screenshot (if usefull)
<add>>
<add>> Any other information you want to share that is relevant to the issue being
<add>> reported. This might include the lines of code that you have identified as
<add>> causing the bug, and potential solutions (and your opinions on their
<add>> merits).
<add>
<add>
<add>## Feature requests
<add>
<add>Feature requests are welcome. But take a moment to find out whether your idea
<add>fits with the scope and aims of the project. It's up to *you* to make a strong
<add>case to convince the project's developers of the merits of this feature. Please
<add>provide as much detail and context as possible.
<add>
<add>
<add>## Pull requests
<add>
<add>Good pull requests—patches, improvements, new features—are a fantastic
<add>help. They should remain focused in scope and avoid containing unrelated
<add>commits.
<add>
<add>**Please ask first** before embarking on any significant pull request (e.g.
<add>implementing features, refactoring code, porting to a different language),
<add>otherwise you risk spending a lot of time working on something that the
<add>project's developers might not want to merge into the project.
<add>
<add>First of all, all pull request should be done on the `develop` branch.
<add>
<add>Glances uses PEP8 compatible code, so use a PEP validator before submitting
<add>your pull request. Also uses the unitaries tests scripts (unitest.py).
<add>
<add>Similarly, when contributing to Glances's documentation, you should edit the
<add>documentation source files in
<add>[the `/doc/` and `/man/` directories of the `develop` branch](https://github.com/nicolargo/glances/tree/develop/docs).
<add>
<add>Adhering to the following process is the best way to get your work
<add>included in the project:
<add>
<add>1. [Fork](https://help.github.com/fork-a-repo/) the project, clone your fork,
<add> and configure the remotes:
<add>
<add> ```bash
<add> # Clone your fork of the repo into the current directory
<add> git clone https://github.com/<your-username>/glances.git
<add> # Navigate to the newly cloned directory
<add> cd glances
<add> # Assign the original repo to a remote called "upstream"
<add> git remote add upstream https://github.com/nicolargo/glances.git
<add> ```
<add>
<add>2. Get the latest changes from upstream:
<add>
<add> ```bash
<add> git checkout develop
<add> git pull upstream develop
<add> ```
<add>
<add>3. Create a new topic branch (off the main project development branch) to
<add> contain your feature, change, or fix (best way is to call it issue#xxx):
<add>
<add> ```bash
<add> git checkout -b <topic-branch-name>
<add> ```
<add>
<add>4. Commit your changes in logical chunks. Please adhere to these [git commit
<add> message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
<add> or your code is unlikely be merged into the main project. Use Git's
<add> [interactive rebase](https://help.github.com/articles/interactive-rebase)
<add> feature to tidy up your commits before making them public.
<add>
<add>5. Locally merge (or rebase) the upstream development branch into your topic branch:
<add>
<add> ```bash
<add> git pull [--rebase] upstream develop
<add> ```
<add>
<add>6. Push your topic branch up to your fork:
<add>
<add> ```bash
<add> git push origin <topic-branch-name>
<add> ```
<add>
<add>7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
<add> with a clear title and description against the `develop` branch.
<add>
<add>**IMPORTANT**: By submitting a patch, you agree to allow the project owners to
<add>license your work under the terms of the [LGPL](LICENSE) (if it
<add>includes code changes). | 1 |
Javascript | Javascript | eliminate unit test timing flakiness | 8edf4e9e3adcc85743e3c86a25ab3748b276a3da | <ide><path>Libraries/Pressability/__tests__/Pressability-test.js
<ide> const createMockPressEvent = (
<ide> describe('Pressability', () => {
<ide> beforeEach(() => {
<ide> jest.resetModules();
<add> jest.restoreAllMocks();
<ide> jest.spyOn(Date, 'now');
<ide> jest.spyOn(HoverState, 'isHoverEnabled');
<ide> });
<ide> describe('Pressability', () => {
<ide> handlers.onResponderMove(createMockPressEvent('onResponderMove'));
<ide> jest.runOnlyPendingTimers();
<ide> expect(config.onPressIn).toBeCalled();
<add>
<ide> // WORKAROUND: Jest does not advance `Date.now()`.
<del> const touchActivateTime = Date.now();
<add> expect(Date.now).toHaveBeenCalledTimes(1);
<add> const touchActivateTime = Date.now.mock.results[0].value;
<ide> jest.advanceTimersByTime(120);
<ide> Date.now.mockReturnValue(touchActivateTime + 120);
<ide> handlers.onResponderRelease(createMockPressEvent('onResponderRelease'));
<ide>
<ide> expect(config.onPressOut).not.toBeCalled();
<ide> jest.advanceTimersByTime(10);
<add> Date.now.mockReturnValue(touchActivateTime + 130);
<ide> expect(config.onPressOut).toBeCalled();
<add>
<add> Date.now.mockRestore();
<ide> });
<ide>
<ide> it('is called synchronously if minimum press duration is 0ms', () => { | 1 |
Go | Go | fix docker info with lxc 1.0.0 | f30f823bf50de6581f547aee842286584c4b6990 | <ide><path>execdriver/lxc/driver.go
<ide> func (d *driver) Restore(c *execdriver.Command) error {
<ide> }
<ide>
<ide> func (d *driver) version() string {
<del> version := ""
<del> if output, err := exec.Command("lxc-version").CombinedOutput(); err == nil {
<del> outputStr := string(output)
<del> if len(strings.SplitN(outputStr, ":", 2)) == 2 {
<del> version = strings.TrimSpace(strings.SplitN(outputStr, ":", 2)[1])
<add> var (
<add> version string
<add> output []byte
<add> err error
<add> )
<add> if _, errPath := exec.LookPath("lxc-version"); errPath == nil {
<add> output, err = exec.Command("lxc-version").CombinedOutput()
<add> } else {
<add> output, err = exec.Command("lxc-start", "--version").CombinedOutput()
<add> }
<add> if err == nil {
<add> version = strings.TrimSpace(string(output))
<add> if parts := strings.SplitN(version, ":", 2); len(parts) == 2 {
<add> version = strings.TrimSpace(parts[1])
<ide> }
<ide> }
<ide> return version | 1 |
Ruby | Ruby | use spec key, when given as spec_id | 79154a3281eb25a573dfcb5d5db31c3c481311f9 | <ide><path>activerecord/lib/active_record/connection_adapters/connection_specification.rb
<ide> def resolve_all
<ide> # spec.config
<ide> # # => { "host" => "localhost", "database" => "foo", "adapter" => "sqlite3" }
<ide> #
<del> def spec(config, id = "primary")
<add> def spec(config, id = nil)
<ide> spec = resolve(config).symbolize_keys
<ide>
<ide> raise(AdapterNotSpecified, "database configuration does not specify adapter") unless spec.key?(:adapter)
<ide> def spec(config, id = "primary")
<ide> end
<ide>
<ide> adapter_method = "#{spec[:adapter]}_connection"
<add>
<add> id ||=
<add> if config.is_a?(Symbol)
<add> config.to_s
<add> else
<add> "primary"
<add> end
<ide> ConnectionSpecification.new(id, spec, adapter_method)
<ide> end
<ide>
<ide><path>activerecord/test/cases/connection_adapters/connection_handler_test.rb
<ide> class ConnectionHandlerTest < ActiveRecord::TestCase
<ide> def setup
<ide> @handler = ConnectionHandler.new
<ide> resolver = ConnectionAdapters::ConnectionSpecification::Resolver.new Base.configurations
<del> spec = resolver.spec(:arunit)
<del>
<ide> @spec_id = "primary"
<del> @pool = @handler.establish_connection(spec)
<add> @pool = @handler.establish_connection(resolver.spec(:arunit, @spec_id))
<add> end
<add>
<add> def test_establish_connection_uses_spec_id
<add> config = {"readonly" => {"adapter" => 'sqlite3'}}
<add> resolver = ConnectionAdapters::ConnectionSpecification::Resolver.new(config)
<add> spec = resolver.spec(:readonly)
<add> @handler.establish_connection(spec)
<add>
<add> assert_not_nil @handler.retrieve_connection_pool('readonly')
<add> ensure
<add> @handler.remove_connection('readonly')
<ide> end
<ide>
<ide> def test_retrieve_connection
<ide> def test_active_connections?
<ide> assert [email protected]_connections?
<ide> end
<ide>
<del># def test_retrieve_connection_pool_with_ar_base
<del># assert_nil @handler.retrieve_connection_pool(ActiveRecord::Base)
<del># end
<del>
<ide> def test_retrieve_connection_pool
<ide> assert_not_nil @handler.retrieve_connection_pool(@spec_id)
<ide> end
<ide>
<del># def test_retrieve_connection_pool_uses_superclass_when_no_subclass_connection
<del># assert_not_nil @handler.retrieve_connection_pool(@subklass)
<del># end
<del>
<del># def test_retrieve_connection_pool_uses_superclass_pool_after_subclass_establish_and_remove
<del># sub_pool = @handler.establish_connection(@subklass, Base.connection_pool.spec)
<del># assert_same sub_pool, @handler.retrieve_connection_pool(@subklass)
<del>#
<del># @handler.remove_connection @subklass
<del># assert_same @pool, @handler.retrieve_connection_pool(@subklass)
<del># end
<add> def test_retrieve_connection_pool_with_invalid_id
<add> assert_nil @handler.retrieve_connection_pool("foo")
<add> end
<ide>
<ide> def test_connection_pools
<ide> assert_equal([@pool], @handler.connection_pools)
<ide> end
<ide>
<del> # TODO
<ide> if Process.respond_to?(:fork)
<ide> def test_connection_pool_per_pid
<ide> object_id = ActiveRecord::Base.connection.object_id | 2 |
Java | Java | remove trailing whitespace | a006ca254272bebe7b8e3828dd6cd53a8b52542b | <ide><path>spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests.java
<ide>
<ide> /**
<ide> * Miscellaneous tests for XML bean definitions.
<del> *
<add> *
<ide> * @author Juergen Hoeller
<ide> * @author Rod Johnson
<ide> * @author Rick Evans
<ide><path>spring-test/src/main/java/org/springframework/test/context/MetaAnnotationUtils.java
<ide> private static <T extends Annotation> AnnotationDescriptor<T> findAnnotationDesc
<ide> *
<ide> * <p>This method traverses the annotations and superclasses of the specified
<ide> * {@code clazz} if no annotation can be found on the given class itself.
<del> *
<add> *
<ide> * <p>This method explicitly handles class-level annotations which are not
<ide> * declared as {@linkplain java.lang.annotation.Inherited inherited} <em>as
<ide> * well as meta-annotations</em>.
<ide><path>spring-test/src/main/java/org/springframework/test/jdbc/JdbcTestUtils.java
<ide> public static String readScript(LineNumberReader lineNumberReader) throws IOExce
<ide> * @param commentPrefix the prefix that identifies comments in the SQL script — typically "--"
<ide> * @return a {@code String} containing the script lines
<ide> * @deprecated as of Spring 4.0.3, in favor of using
<del> * {@link org.springframework.jdbc.datasource.init.ScriptUtils#readScript(LineNumberReader, String, String)}
<add> * {@link org.springframework.jdbc.datasource.init.ScriptUtils#readScript(LineNumberReader, String, String)}
<ide> */
<ide> @Deprecated
<ide> public static String readScript(LineNumberReader lineNumberReader, String commentPrefix) throws IOException {
<ide> public static boolean containsSqlScriptDelimiters(String script, char delim) {
<ide> * @param delim character delimiting each statement — typically a ';' character
<ide> * @param statements the list that will contain the individual statements
<ide> * @deprecated as of Spring 4.0.3, in favor of using
<del> * {@link org.springframework.jdbc.datasource.init.ScriptUtils#splitSqlScript(String, char, List)}
<add> * {@link org.springframework.jdbc.datasource.init.ScriptUtils#splitSqlScript(String, char, List)}
<ide> */
<ide> @Deprecated
<ide> public static void splitSqlScript(String script, char delim, List<String> statements) {
<ide><path>spring-test/src/test/java/org/springframework/test/context/hierarchies/meta/MetaContextHierarchyConfig.java
<ide>
<ide> /**
<ide> * Custom context hierarchy configuration annotation.
<del> *
<add> *
<ide> * @author Sam Brannen
<ide> * @since 4.0.3
<ide> */
<ide><path>spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/session/AbstractSockJsSession.java
<ide>
<ide> /**
<ide> * An abstract base class for SockJS sessions implementing {@link SockJsSession}.
<del> *
<add> *
<ide> * @author Rossen Stoyanchev
<ide> * @author Sam Brannen
<ide> * @since 4.0 | 5 |
Javascript | Javascript | introduce asyncrequire function | a7b231a3278e4fc2d7e4269ce106f22712f2e5a8 | <ide><path>Libraries/Utilities/BundleSegments.js
<del>/**
<del> * Copyright (c) 2015-present, Facebook, Inc.
<del> * All rights reserved.
<del> *
<del> * This source code is licensed under the BSD-style license found in the
<del> * LICENSE file in the root directory of this source tree. An additional grant
<del> * of patent rights can be found in the PATENTS file in the same directory.
<del> *
<del> * @flow
<del> * @format
<del> * @providesModule BundleSegments
<del> */
<del>
<del>'use strict';
<del>
<del>let segmentLoaders = new Map();
<del>
<del>/**
<del> * Ensure that a bundle segment is ready for use, for example requiring some of
<del> * its module. We cache load promises so as to avoid calling `fetchSegment` twice
<del> * for the same bundle. We assume that once a segment is fetched/loaded, it is
<del> * never gettting removed during this instance of the JavaScript VM.
<del> *
<del> * We don't use async/await syntax to avoid depending on `regeneratorRuntime`.
<del> */
<del>function loadForModule(moduleID: number): Promise<void> {
<del> return Promise.resolve().then(() => {
<del> const {segmentId} = (require: $FlowFixMe).unpackModuleId(moduleID);
<del> if (segmentId === 0) {
<del> return;
<del> }
<del> let segmentLoader = segmentLoaders.get(segmentId);
<del> if (segmentLoader != null) {
<del> return segmentLoader;
<del> }
<del>
<del> const {fetchSegment} = global;
<del> if (fetchSegment == null) {
<del> throw new Error(
<del> 'When bundle splitting is enabled, the `global.fetchSegment` function ' +
<del> 'must be provided to be able to load particular bundle segments.',
<del> );
<del> }
<del> segmentLoader = new Promise((resolve, reject) => {
<del> fetchSegment(segmentId, error => {
<del> if (error != null) {
<del> reject(error);
<del> return;
<del> }
<del> resolve();
<del> });
<del> });
<del> segmentLoaders.set(segmentId, segmentLoader);
<del> return segmentLoader;
<del> });
<del>}
<del>
<del>module.exports = {loadForModule};
<ide><path>Libraries/Utilities/asyncRequire.js
<add>/**
<add> * Copyright (c) 2015-present, Facebook, Inc.
<add> * All rights reserved.
<add> *
<add> * This source code is licensed under the BSD-style license found in the
<add> * LICENSE file in the root directory of this source tree. An additional grant
<add> * of patent rights can be found in the PATENTS file in the same directory.
<add> *
<add> * @flow
<add> * @format
<add> * @providesModule asyncRequire
<add> */
<add>
<add>'use strict';
<add>
<add>/**
<add> * The bundler must register the dependency properly when generating a call to
<add> * `asyncRequire`, that allows us to call `require` dynamically with confidence
<add> * the module ID is indeed valid and available.
<add> */
<add>function asyncRequire(moduleID: number): Promise<mixed> {
<add> return Promise.resolve()
<add> .then(() => {
<add> const {segmentId} = (require: $FlowFixMe).unpackModuleId(moduleID);
<add> return loadSegment(segmentId);
<add> })
<add> .then(() => require.call(null, (moduleID: $FlowFixMe)));
<add>}
<add>
<add>let segmentLoaders = new Map();
<add>
<add>/**
<add> * Ensure that a bundle segment is ready for use, for example requiring some of
<add> * its module. We cache load promises so as to avoid calling `fetchSegment`
<add> * twice for the same bundle. We assume that once a segment is fetched/loaded,
<add> * it is never gettting removed during this instance of the JavaScript VM.
<add> *
<add> * Segment #0 is the main segment, that is always available by definition, so
<add> * we never try to load anything.
<add> *
<add> * We don't use async/await syntax to avoid depending on `regeneratorRuntime`.
<add> */
<add>function loadSegment(segmentId: number): Promise<void> {
<add> return Promise.resolve().then(() => {
<add> if (segmentId === 0) {
<add> return;
<add> }
<add> let segmentLoader = segmentLoaders.get(segmentId);
<add> if (segmentLoader != null) {
<add> return segmentLoader;
<add> }
<add> const {fetchSegment} = global;
<add> if (fetchSegment == null) {
<add> throw new FetchSegmentNotAvailableError();
<add> }
<add> segmentLoader = new Promise((resolve, reject) => {
<add> fetchSegment(segmentId, error => {
<add> if (error != null) {
<add> reject(error);
<add> return;
<add> }
<add> resolve();
<add> });
<add> });
<add> segmentLoaders.set(segmentId, segmentLoader);
<add> return segmentLoader;
<add> });
<add>}
<add>
<add>class FetchSegmentNotAvailableError extends Error {
<add> constructor() {
<add> super(
<add> 'When bundle splitting is enabled, the `global.fetchSegment` function ' +
<add> 'must be provided to be able to load particular bundle segments.',
<add> );
<add> }
<add>}
<add>
<add>module.exports = asyncRequire; | 2 |
Text | Text | update dataset examples | e302950da3bcd8c6bbdf4ac3897282decedb83e4 | <ide><path>research/deeplab/g3doc/cityscapes.md
<ide> A local training job using `xception_65` can be run with the following command:
<ide> # From tensorflow/models/research/
<ide> python deeplab/train.py \
<ide> --logtostderr \
<add><<<<<<< HEAD
<add>=======
<add> --training_number_of_steps=90000 \
<add>>>>>>>> origin/master
<ide> --train_split="train" \
<ide> --model_variant="xception_65" \
<ide> --atrous_rates=6 \
<ide> python deeplab/train.py \
<ide> --train_crop_size=769 \
<ide> --train_crop_size=769 \
<ide> --train_batch_size=1 \
<add><<<<<<< HEAD
<add>=======
<add> --dataset="cityscapes" \
<add> --train_split="train" \
<add>>>>>>>> origin/master
<ide> --tf_initial_checkpoints=${PATH_TO_INITIAL_CHECKPOINT} \
<ide> --train_logdir=${PATH_TO_TRAIN_DIR} \
<ide> --dataset_dir=${PATH_TO_DATASET}
<ide> where ${PATH_TO_INITIAL_CHECKPOINT} is the path to the initial checkpoint
<ide> directory in which training checkpoints and events will be written to, and
<ide> ${PATH_TO_DATASET} is the directory in which the Cityscapes dataset resides.
<ide>
<add><<<<<<< HEAD
<ide> Note that for {train,eval,vis}.py:
<ide>
<ide> 1. We use small batch size during training. The users could change it based on
<ide> the available GPU memory and also set `fine_tune_batch_norm` to be False or
<ide> True depending on the use case.
<add>=======
<add>**Note that for {train,eval,vis}.py**:
<add>
<add>1. In order to reproduce our results, one needs to use large batch size (> 8),
<add> and set fine_tune_batch_norm = True. Here, we simply use small batch size
<add> during training for the purpose of demonstration. If the users have limited
<add> GPU memory at hand, please fine-tune from our provided checkpoints whose
<add> batch norm parameters have been trained, and use smaller learning rate with
<add> fine_tune_batch_norm = False.
<add>>>>>>>> origin/master
<ide>
<ide> 2. The users should change atrous_rates from [6, 12, 18] to [12, 24, 36] if
<ide> setting output_stride=8.
<ide> python deeplab/eval.py \
<ide> --decoder_output_stride=4 \
<ide> --eval_crop_size=1025 \
<ide> --eval_crop_size=2049 \
<add><<<<<<< HEAD
<add>=======
<add> --dataset="cityscapes" \
<add> --eval_split="val" \
<add>>>>>>>> origin/master
<ide> --checkpoint_dir=${PATH_TO_CHECKPOINT} \
<ide> --eval_logdir=${PATH_TO_EVAL_DIR} \
<ide> --dataset_dir=${PATH_TO_DATASET}
<ide> python deeplab/vis.py \
<ide> --decoder_output_stride=4 \
<ide> --vis_crop_size=1025 \
<ide> --vis_crop_size=2049 \
<add><<<<<<< HEAD
<add>=======
<add> --dataset="cityscapes" \
<add> --vis_split="val" \
<add>>>>>>>> origin/master
<ide> --colormap_type="cityscapes" \
<ide> --checkpoint_dir=${PATH_TO_CHECKPOINT} \
<ide> --vis_logdir=${PATH_TO_VIS_DIR} \
<ide><path>research/deeplab/g3doc/pascal.md
<ide> A local training job using `xception_65` can be run with the following command:
<ide> # From tensorflow/models/research/
<ide> python deeplab/train.py \
<ide> --logtostderr \
<add><<<<<<< HEAD
<add>=======
<add> --training_number_of_steps=30000 \
<add>>>>>>>> origin/master
<ide> --train_split="train" \
<ide> --model_variant="xception_65" \
<ide> --atrous_rates=6 \
<ide> python deeplab/train.py \
<ide> --train_crop_size=513 \
<ide> --train_crop_size=513 \
<ide> --train_batch_size=1 \
<add><<<<<<< HEAD
<add>=======
<add> --dataset="pascal_voc_seg" \
<add> --train_split="train" \
<add>>>>>>>> origin/master
<ide> --tf_initial_checkpoints=${PATH_TO_INITIAL_CHECKPOINT} \
<ide> --train_logdir=${PATH_TO_TRAIN_DIR} \
<ide> --dataset_dir=${PATH_TO_DATASET}
<ide> directory in which training checkpoints and events will be written to, and
<ide> ${PATH_TO_DATASET} is the directory in which the PASCAL VOC 2012 dataset
<ide> resides.
<ide>
<add><<<<<<< HEAD
<ide> Note that for {train,eval,vis}.py:
<ide>
<ide> 1. We use small batch size during training. The users could change it based on
<ide> the available GPU memory and also set `fine_tune_batch_norm` to be False or
<ide> True depending on the use case.
<add>=======
<add>**Note that for {train,eval,vis}.py:**
<add>
<add>1. In order to reproduce our results, one needs to use large batch size (> 12),
<add> and set fine_tune_batch_norm = True. Here, we simply use small batch size
<add> during training for the purpose of demonstration. If the users have limited
<add> GPU memory at hand, please fine-tune from our provided checkpoints whose
<add> batch norm parameters have been trained, and use smaller learning rate with
<add> fine_tune_batch_norm = False.
<add>>>>>>>> origin/master
<ide>
<ide> 2. The users should change atrous_rates from [6, 12, 18] to [12, 24, 36] if
<ide> setting output_stride=8.
<ide> python deeplab/eval.py \
<ide> --decoder_output_stride=4 \
<ide> --eval_crop_size=513 \
<ide> --eval_crop_size=513 \
<add><<<<<<< HEAD
<add>=======
<add> --dataset="pascal_voc_seg" \
<add> --eval_split="val" \
<add>>>>>>>> origin/master
<ide> --checkpoint_dir=${PATH_TO_CHECKPOINT} \
<ide> --eval_logdir=${PATH_TO_EVAL_DIR} \
<ide> --dataset_dir=${PATH_TO_DATASET}
<ide> python deeplab/vis.py \
<ide> --decoder_output_stride=4 \
<ide> --vis_crop_size=513 \
<ide> --vis_crop_size=513 \
<add><<<<<<< HEAD
<add>=======
<add> --dataset="pascal_voc_seg" \
<add> --vis_split="val" \
<add>>>>>>>> origin/master
<ide> --checkpoint_dir=${PATH_TO_CHECKPOINT} \
<ide> --vis_logdir=${PATH_TO_VIS_DIR} \
<ide> --dataset_dir=${PATH_TO_DATASET} | 2 |
PHP | PHP | remove deprecated code in cache package | 7301e8ad56f70093bc520cd3b2652f8e6ce2cada | <ide><path>src/Cache/Cache.php
<ide> class Cache
<ide> * @var array
<ide> */
<ide> protected static $_dsnClassMap = [
<del> 'apc' => 'Cake\Cache\Engine\ApcuEngine', // @deprecated Since 3.6. Use apcu instead.
<ide> 'apcu' => 'Cake\Cache\Engine\ApcuEngine',
<ide> 'file' => 'Cake\Cache\Engine\FileEngine',
<ide> 'memcached' => 'Cake\Cache\Engine\MemcachedEngine',
<ide> public static function setRegistry(ObjectRegistry $registry)
<ide> static::$_registry = $registry;
<ide> }
<ide>
<del> /**
<del> * Returns the Cache Registry instance used for creating and using cache adapters.
<del> * Also allows for injecting of a new registry instance.
<del> *
<del> * @param \Cake\Core\ObjectRegistry|null $registry Injectable registry object.
<del> * @return \Cake\Core\ObjectRegistry
<del> * @deprecated Deprecated since 3.5. Use getRegistry() and setRegistry() instead.
<del> */
<del> public static function registry(ObjectRegistry $registry = null)
<del> {
<del> deprecationWarning('Use Cache::getRegistry() and Cache::setRegistry() instead.');
<del> if ($registry) {
<del> static::setRegistry($registry);
<del> }
<del>
<del> return static::getRegistry();
<del> }
<del>
<ide> /**
<ide> * Finds and builds the instance of the required engine class.
<ide> *
<ide><path>src/Cache/Engine/ApcEngine.php
<del><?php
<del>/**
<del> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<del> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice.
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<del> * @link https://cakephp.org CakePHP(tm) Project
<del> * @since 1.2.0
<del> * @license https://opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Cache\Engine;
<del>
<del>// @deprecated Add backwards compat alias.
<del>class_alias('Cake\Cache\Engine\ApcuEngine', 'Cake\Cache\Engine\ApcEngine');
<del>
<del>deprecationWarning('Use Cake\Cache\Engine\ApcuEngine instead of Cake\Cache\Engine\ApcEngine.');
<ide><path>src/Cache/Engine/MemcachedEngine.php
<ide> public function parseServerString($server)
<ide> return [$host, (int)$port];
<ide> }
<ide>
<del> /**
<del> * Backwards compatible alias of parseServerString
<del> *
<del> * @param string $server The server address string.
<del> * @return array Array containing host, port
<del> * @deprecated 3.4.13 Will be removed in 4.0.0
<del> */
<del> protected function _parseServerString($server)
<del> {
<del> return $this->parseServerString($server);
<del> }
<del>
<ide> /**
<ide> * Read an option value from the memcached connection.
<ide> *
<ide><path>src/Cache/Engine/XcacheEngine.php
<del><?php
<del>/**
<del> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<del> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice.
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<del> * @link https://cakephp.org CakePHP(tm) Project
<del> * @since 1.2.0
<del> * @license https://opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Cache\Engine;
<del>
<del>use Cake\Cache\CacheEngine;
<del>
<del>/**
<del> * Xcache storage engine for cache
<del> *
<del> * @link http://trac.lighttpd.net/xcache/ Xcache
<del> * @deprecated 3.6.0 Xcache engine has been deprecated and will be removed in 4.0.0.
<del> */
<del>class XcacheEngine extends CacheEngine
<del>{
<del>
<del> /**
<del> * The default config used unless overridden by runtime configuration
<del> *
<del> * - `duration` Specify how long items in this cache configuration last.
<del> * - `groups` List of groups or 'tags' associated to every key stored in this config.
<del> * handy for deleting a complete group from cache.
<del> * - `prefix` Prefix appended to all entries. Good for when you need to share a keyspace
<del> * with either another cache config or another application.
<del> * - `probability` Probability of hitting a cache gc cleanup. Setting to 0 will disable
<del> * cache::gc from ever being called automatically.
<del> * - `PHP_AUTH_USER` xcache.admin.user
<del> * - `PHP_AUTH_PW` xcache.admin.password
<del> *
<del> * @var array
<del> */
<del> protected $_defaultConfig = [
<del> 'duration' => 3600,
<del> 'groups' => [],
<del> 'prefix' => null,
<del> 'probability' => 100,
<del> 'PHP_AUTH_USER' => 'user',
<del> 'PHP_AUTH_PW' => 'password'
<del> ];
<del>
<del> /**
<del> * Initialize the Cache Engine
<del> *
<del> * Called automatically by the cache frontend
<del> *
<del> * @param array $config array of setting for the engine
<del> * @return bool True if the engine has been successfully initialized, false if not
<del> */
<del> public function init(array $config = [])
<del> {
<del> if (!extension_loaded('xcache')) {
<del> return false;
<del> }
<del>
<del> parent::init($config);
<del>
<del> return true;
<del> }
<del>
<del> /**
<del> * Write data for key into cache
<del> *
<del> * @param string $key Identifier for the data
<del> * @param mixed $value Data to be cached
<del> * @return bool True if the data was successfully cached, false on failure
<del> */
<del> public function write($key, $value)
<del> {
<del> $key = $this->_key($key);
<del>
<del> if (!is_numeric($value)) {
<del> $value = serialize($value);
<del> }
<del>
<del> $duration = $this->_config['duration'];
<del> $expires = time() + $duration;
<del> xcache_set($key . '_expires', $expires, $duration);
<del>
<del> return xcache_set($key, $value, $duration);
<del> }
<del>
<del> /**
<del> * Read a key from the cache
<del> *
<del> * @param string $key Identifier for the data
<del> * @return mixed The cached data, or false if the data doesn't exist,
<del> * has expired, or if there was an error fetching it
<del> */
<del> public function read($key)
<del> {
<del> $key = $this->_key($key);
<del>
<del> if (xcache_isset($key)) {
<del> $time = time();
<del> $cachetime = (int)xcache_get($key . '_expires');
<del> if ($cachetime < $time || ($time + $this->_config['duration']) < $cachetime) {
<del> return false;
<del> }
<del>
<del> $value = xcache_get($key);
<del> if (is_string($value) && !is_numeric($value)) {
<del> $value = unserialize($value);
<del> }
<del>
<del> return $value;
<del> }
<del>
<del> return false;
<del> }
<del>
<del> /**
<del> * Increments the value of an integer cached key
<del> * If the cache key is not an integer it will be treated as 0
<del> *
<del> * @param string $key Identifier for the data
<del> * @param int $offset How much to increment
<del> * @return bool|int New incremented value, false otherwise
<del> */
<del> public function increment($key, $offset = 1)
<del> {
<del> $key = $this->_key($key);
<del>
<del> return xcache_inc($key, $offset);
<del> }
<del>
<del> /**
<del> * Decrements the value of an integer cached key.
<del> * If the cache key is not an integer it will be treated as 0
<del> *
<del> * @param string $key Identifier for the data
<del> * @param int $offset How much to subtract
<del> * @return bool|int New decremented value, false otherwise
<del> */
<del> public function decrement($key, $offset = 1)
<del> {
<del> $key = $this->_key($key);
<del>
<del> return xcache_dec($key, $offset);
<del> }
<del>
<del> /**
<del> * Delete a key from the cache
<del> *
<del> * @param string $key Identifier for the data
<del> * @return bool True if the value was successfully deleted, false if it didn't exist or couldn't be removed
<del> */
<del> public function delete($key)
<del> {
<del> $key = $this->_key($key);
<del>
<del> return xcache_unset($key);
<del> }
<del>
<del> /**
<del> * Delete all keys from the cache
<del> *
<del> * @param bool $check If true no deletes will occur and instead CakePHP will rely
<del> * on key TTL values.
<del> * Unused for Xcache engine.
<del> * @return bool True if the cache was successfully cleared, false otherwise
<del> */
<del> public function clear($check)
<del> {
<del> $this->_auth();
<del> $max = xcache_count(XC_TYPE_VAR);
<del> for ($i = 0; $i < $max; $i++) {
<del> xcache_clear_cache(XC_TYPE_VAR, $i);
<del> }
<del> $this->_auth(true);
<del>
<del> return true;
<del> }
<del>
<del> /**
<del> * Returns the `group value` for each of the configured groups
<del> * If the group initial value was not found, then it initializes
<del> * the group accordingly.
<del> *
<del> * @return array
<del> */
<del> public function groups()
<del> {
<del> $result = [];
<del> foreach ($this->_config['groups'] as $group) {
<del> $value = xcache_get($this->_config['prefix'] . $group);
<del> if (!$value) {
<del> $value = 1;
<del> xcache_set($this->_config['prefix'] . $group, $value, 0);
<del> }
<del> $result[] = $group . $value;
<del> }
<del>
<del> return $result;
<del> }
<del>
<del> /**
<del> * Increments the group value to simulate deletion of all keys under a group
<del> * old values will remain in storage until they expire.
<del> *
<del> * @param string $group The group to clear.
<del> * @return bool success
<del> */
<del> public function clearGroup($group)
<del> {
<del> return (bool)xcache_inc($this->_config['prefix'] . $group, 1);
<del> }
<del>
<del> /**
<del> * Populates and reverses $_SERVER authentication values
<del> * Makes necessary changes (and reverting them back) in $_SERVER
<del> *
<del> * This has to be done because xcache_clear_cache() needs to pass Basic Http Auth
<del> * (see xcache.admin configuration config)
<del> *
<del> * @param bool $reverse Revert changes
<del> * @return void
<del> */
<del> protected function _auth($reverse = false)
<del> {
<del> static $backup = [];
<del> $keys = ['PHP_AUTH_USER' => 'user', 'PHP_AUTH_PW' => 'password'];
<del> foreach ($keys as $key => $value) {
<del> if ($reverse) {
<del> if (isset($backup[$key])) {
<del> $_SERVER[$key] = $backup[$key];
<del> unset($backup[$key]);
<del> } else {
<del> unset($_SERVER[$key]);
<del> }
<del> } else {
<del> $value = env($key);
<del> if (!empty($value)) {
<del> $backup[$key] = $value;
<del> }
<del> if (!empty($this->_config[$value])) {
<del> $_SERVER[$key] = $this->_config[$value];
<del> } elseif (!empty($this->_config[$key])) {
<del> $_SERVER[$key] = $this->_config[$key];
<del> } else {
<del> $_SERVER[$key] = $value;
<del> }
<del> }
<del> }
<del> }
<del>}
<ide><path>tests/TestCase/Cache/CacheTest.php
<ide> public function testConfigErrorOnReconfigure()
<ide> Cache::setConfig('tests', ['engine' => 'Apc']);
<ide> }
<ide>
<del> /**
<del> * Test reading configuration.
<del> *
<del> * @group deprecated
<del> * @return void
<del> */
<del> public function testConfigReadCompat()
<del> {
<del> $this->deprecated(function () {
<del> $config = [
<del> 'engine' => 'File',
<del> 'path' => TMP,
<del> 'prefix' => 'cake_'
<del> ];
<del> Cache::config('tests', $config);
<del> $expected = $config;
<del> $expected['className'] = $config['engine'];
<del> unset($expected['engine']);
<del> $this->assertEquals($expected, Cache::config('tests'));
<del> });
<del> }
<del>
<ide> /**
<ide> * Test reading configuration.
<ide> *
<ide> public function testAdd()
<ide> $this->assertFalse($result);
<ide> }
<ide>
<del> /**
<del> * test registry method
<del> *
<del> * @group deprecated
<del> * @return void
<del> */
<del> public function testRegistry()
<del> {
<del> $this->deprecated(function () {
<del> $this->assertInstanceOf(CacheRegistry::class, Cache::registry());
<del> });
<del> }
<del>
<del> /**
<del> * test registry method setting
<del> *
<del> * @group deprecated
<del> * @return void
<del> */
<del> public function testRegistrySet()
<del> {
<del> $registry = new CacheRegistry();
<del> $this->deprecated(function () use ($registry) {
<del> Cache::registry($registry);
<del> $this->assertSame($registry, Cache::registry());
<del> });
<del> }
<del>
<ide> /**
<ide> * Test getting the registry
<ide> *
<ide><path>tests/TestCase/Cache/Engine/XcacheEngineTest.php
<del><?php
<del>/**
<del> * XcacheEngineTest file
<del> *
<del> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<del> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<del> *
<del> * Licensed under The MIT License
<del> * For full copyright and license information, please see the LICENSE.txt
<del> * Redistributions of files must retain the above copyright notice
<del> *
<del> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<del> * @link https://cakephp.org CakePHP(tm) Project
<del> * @since 1.2.0
<del> * @license https://opensource.org/licenses/mit-license.php MIT License
<del> */
<del>namespace Cake\Test\TestCase\Cache\Engine;
<del>
<del>use Cake\Cache\Cache;
<del>use Cake\TestSuite\TestCase;
<del>
<del>/**
<del> * XcacheEngineTest class
<del> */
<del>class XcacheEngineTest extends TestCase
<del>{
<del>
<del> /**
<del> * setUp method
<del> *
<del> * @return void
<del> */
<del> public function setUp()
<del> {
<del> parent::setUp();
<del> if (!extension_loaded('xcache')) {
<del> $this->markTestSkipped('Xcache is not installed or configured properly');
<del> }
<del> Cache::enable();
<del> Cache::setConfig('xcache', ['engine' => 'Xcache', 'prefix' => 'cake_']);
<del> }
<del>
<del> /**
<del> * Helper method for testing.
<del> *
<del> * @param array $config
<del> * @return void
<del> */
<del> protected function _configCache($config = [])
<del> {
<del> $defaults = [
<del> 'className' => 'Xcache',
<del> 'prefix' => 'cake_',
<del> ];
<del> Cache::drop('xcache');
<del> Cache::setConfig('xcache', array_merge($defaults, $config));
<del> }
<del>
<del> /**
<del> * tearDown method
<del> *
<del> * @return void
<del> */
<del> public function tearDown()
<del> {
<del> parent::tearDown();
<del> Cache::drop('xcache');
<del> Cache::drop('xcache_groups');
<del> }
<del>
<del> /**
<del> * testConfig method
<del> *
<del> * @return void
<del> */
<del> public function testConfig()
<del> {
<del> $config = Cache::engine('xcache')->getConfig();
<del> $expecting = [
<del> 'prefix' => 'cake_',
<del> 'duration' => 3600,
<del> 'probability' => 100,
<del> 'groups' => [],
<del> ];
<del> $this->assertArrayHasKey('PHP_AUTH_USER', $config);
<del> $this->assertArrayHasKey('PHP_AUTH_PW', $config);
<del>
<del> unset($config['PHP_AUTH_USER'], $config['PHP_AUTH_PW']);
<del> $this->assertEquals($config, $expecting);
<del> }
<del>
<del> /**
<del> * testReadAndWriteCache method
<del> *
<del> * @return void
<del> */
<del> public function testReadAndWriteCache()
<del> {
<del> $result = Cache::read('test', 'xcache');
<del> $expecting = '';
<del> $this->assertEquals($expecting, $result);
<del>
<del> // String
<del> $data = 'this is a test of the emergency broadcasting system';
<del> $result = Cache::write('test', $data, 'xcache');
<del> $this->assertTrue($result);
<del>
<del> $result = Cache::read('test', 'xcache');
<del> $expecting = $data;
<del> $this->assertEquals($expecting, $result);
<del>
<del> // Integer
<del> $data = 100;
<del> $result = Cache::write('test', 100, 'xcache');
<del> $this->assertTrue($result);
<del>
<del> $result = Cache::read('test', 'xcache');
<del> $this->assertSame(100, $result);
<del>
<del> // Object
<del> $data = (object)['value' => 'an object'];
<del> $result = Cache::write('test', $data, 'xcache');
<del> $this->assertTrue($result);
<del>
<del> $result = Cache::read('test', 'xcache');
<del> $this->assertInstanceOf('stdClass', $result);
<del> $this->assertEquals('an object', $result->value);
<del>
<del> Cache::delete('test', 'xcache');
<del> }
<del>
<del> /**
<del> * testExpiry method
<del> *
<del> * @return void
<del> */
<del> public function testExpiry()
<del> {
<del> $this->_configCache(['duration' => 1]);
<del> $result = Cache::read('test', 'xcache');
<del> $this->assertFalse($result);
<del>
<del> $data = 'this is a test of the emergency broadcasting system';
<del> $result = Cache::write('other_test', $data, 'xcache');
<del> $this->assertTrue($result);
<del>
<del> sleep(2);
<del> $result = Cache::read('other_test', 'xcache');
<del> $this->assertFalse($result);
<del>
<del> $this->_configCache(['duration' => '+1 second']);
<del>
<del> $data = 'this is a test of the emergency broadcasting system';
<del> $result = Cache::write('other_test', $data, 'xcache');
<del> $this->assertTrue($result);
<del>
<del> sleep(2);
<del> $result = Cache::read('other_test', 'xcache');
<del> $this->assertFalse($result);
<del> }
<del>
<del> /**
<del> * testDeleteCache method
<del> *
<del> * @return void
<del> */
<del> public function testDeleteCache()
<del> {
<del> $data = 'this is a test of the emergency broadcasting system';
<del> $result = Cache::write('delete_test', $data, 'xcache');
<del> $this->assertTrue($result);
<del>
<del> $result = Cache::delete('delete_test', 'xcache');
<del> $this->assertTrue($result);
<del> }
<del>
<del> /**
<del> * testClearCache method
<del> *
<del> * @return void
<del> */
<del> public function testClearCache()
<del> {
<del> if ((PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg')) {
<del> $this->markTestSkipped('Xcache administration functions are not available for the CLI.');
<del> }
<del> $data = 'this is a test of the emergency broadcasting system';
<del> $result = Cache::write('clear_test_1', $data, 'xcache');
<del> $this->assertTrue($result);
<del>
<del> $result = Cache::write('clear_test_2', $data, 'xcache');
<del> $this->assertTrue($result);
<del>
<del> $result = Cache::clear(false, 'xcache');
<del> $this->assertTrue($result);
<del> }
<del>
<del> /**
<del> * testDecrement method
<del> *
<del> * @return void
<del> */
<del> public function testDecrement()
<del> {
<del> $result = Cache::write('test_decrement', 5, 'xcache');
<del> $this->assertTrue($result);
<del>
<del> $result = Cache::decrement('test_decrement', 1, 'xcache');
<del> $this->assertEquals(4, $result);
<del>
<del> $result = Cache::read('test_decrement', 'xcache');
<del> $this->assertEquals(4, $result);
<del>
<del> $result = Cache::decrement('test_decrement', 2, 'xcache');
<del> $this->assertEquals(2, $result);
<del>
<del> $result = Cache::read('test_decrement', 'xcache');
<del> $this->assertEquals(2, $result);
<del> }
<del>
<del> /**
<del> * testIncrement method
<del> *
<del> * @return void
<del> */
<del> public function testIncrement()
<del> {
<del> $result = Cache::write('test_increment', 5, 'xcache');
<del> $this->assertTrue($result);
<del>
<del> $result = Cache::increment('test_increment', 1, 'xcache');
<del> $this->assertEquals(6, $result);
<del>
<del> $result = Cache::read('test_increment', 'xcache');
<del> $this->assertEquals(6, $result);
<del>
<del> $result = Cache::increment('test_increment', 2, 'xcache');
<del> $this->assertEquals(8, $result);
<del>
<del> $result = Cache::read('test_increment', 'xcache');
<del> $this->assertEquals(8, $result);
<del> }
<del>
<del> /**
<del> * Tests that configuring groups for stored keys return the correct values when read/written
<del> * Shows that altering the group value is equivalent to deleting all keys under the same
<del> * group
<del> *
<del> * @return void
<del> */
<del> public function testGroupsReadWrite()
<del> {
<del> Cache::setConfig('xcache_groups', [
<del> 'engine' => 'Xcache',
<del> 'duration' => 0,
<del> 'groups' => ['group_a', 'group_b'],
<del> 'prefix' => 'test_'
<del> ]);
<del> $this->assertTrue(Cache::write('test_groups', 'value', 'xcache_groups'));
<del> $this->assertEquals('value', Cache::read('test_groups', 'xcache_groups'));
<del>
<del> xcache_inc('test_group_a', 1);
<del> $this->assertFalse(Cache::read('test_groups', 'xcache_groups'));
<del> $this->assertTrue(Cache::write('test_groups', 'value2', 'xcache_groups'));
<del> $this->assertEquals('value2', Cache::read('test_groups', 'xcache_groups'));
<del>
<del> xcache_inc('test_group_b', 1);
<del> $this->assertFalse(Cache::read('test_groups', 'xcache_groups'));
<del> $this->assertTrue(Cache::write('test_groups', 'value3', 'xcache_groups'));
<del> $this->assertEquals('value3', Cache::read('test_groups', 'xcache_groups'));
<del> }
<del>
<del> /**
<del> * Tests that deleting from a groups-enabled config is possible
<del> *
<del> * @return void
<del> */
<del> public function testGroupDelete()
<del> {
<del> Cache::setConfig('xcache_groups', [
<del> 'engine' => 'Xcache',
<del> 'duration' => 0,
<del> 'groups' => ['group_a', 'group_b'],
<del> 'prefix' => 'test_'
<del> ]);
<del> $this->assertTrue(Cache::write('test_groups', 'value', 'xcache_groups'));
<del> $this->assertEquals('value', Cache::read('test_groups', 'xcache_groups'));
<del> $this->assertTrue(Cache::delete('test_groups', 'xcache_groups'));
<del>
<del> $this->assertFalse(Cache::read('test_groups', 'xcache_groups'));
<del> }
<del>
<del> /**
<del> * Test clearing a cache group
<del> *
<del> * @return void
<del> */
<del> public function testGroupClear()
<del> {
<del> Cache::setConfig('xcache_groups', [
<del> 'engine' => 'Xcache',
<del> 'duration' => 0,
<del> 'groups' => ['group_a', 'group_b'],
<del> 'prefix' => 'test_'
<del> ]);
<del>
<del> $this->assertTrue(Cache::write('test_groups', 'value', 'xcache_groups'));
<del> $this->assertTrue(Cache::clearGroup('group_a', 'xcache_groups'));
<del> $this->assertFalse(Cache::read('test_groups', 'xcache_groups'));
<del>
<del> $this->assertTrue(Cache::write('test_groups', 'value2', 'xcache_groups'));
<del> $this->assertTrue(Cache::clearGroup('group_b', 'xcache_groups'));
<del> $this->assertFalse(Cache::read('test_groups', 'xcache_groups'));
<del> }
<del>} | 6 |
Javascript | Javascript | use octal integer literal | cf329d0f6312918ef996c89cf4464d4d26aff296 | <ide><path>spec/main-process/file-recovery-service.test.js
<ide> describe("FileRecoveryService", () => {
<ide> const mockWindow = {}
<ide> const filePath = temp.path()
<ide> fs.writeFileSync(filePath, "content")
<del> fs.chmodSync(filePath, 0444)
<add> fs.chmodSync(filePath, 0o444)
<ide>
<ide> let logs = []
<ide> this.stub(console, 'log', (message) => logs.push(message)) | 1 |
Ruby | Ruby | convert version test to spec | 32565eb96efcda28f4c255afc4e25467b8560379 | <ide><path>Library/Homebrew/cask/spec/cask/cli/version_spec.rb
<add>require "spec_helper"
<add>
<add>describe "brew cask --version" do
<add> it "respects the --version argument" do
<add> expect {
<add> expect {
<add> Hbc::CLI::NullCommand.new("--version").run
<add> }.not_to output.to_stderr
<add> }.to output(Hbc.full_version).to_stdout
<add> end
<add>end
<ide><path>Library/Homebrew/cask/test/cask/cli/version_test.rb
<del>require "test_helper"
<del>
<del>describe "brew cask --version" do
<del> it "respects the --version argument" do
<del> lambda {
<del> Hbc::CLI::NullCommand.new("--version").run
<del> }.must_output Hbc.full_version
<del> end
<del>end | 2 |
Text | Text | fix metalness description | e1450376e24f043dd0c6035363bac5b0f05b4a10 | <ide><path>threejs/lessons/threejs-materials.md
<ide> have hard reflections whereas something that's not rough, like a billiard ball,
<ide> is very shiny. Roughness goes from 0 to 1.
<ide>
<ide> The other setting, [`metalness`](MeshStandardMaterial.metalness), says
<del>how metal the material is. Metals behave differently than non-metals
<del>and so this setting goes from 0, not metal at all, to 1, 100% metal.
<add>how metal the material is. Metals behave differently than non-metals. For
<add>some reason this setting is un-intuitive and goes from 1, not metal at all,
<add>to 0, most metal like.
<ide>
<ide> Here's a quick sample of `MeshStandardMaterial` with `roughness` from 0 to 1
<ide> across and `metalness` from 0 to 1 down. | 1 |
Javascript | Javascript | define mix as const | b723b90889f084c8026e2d92ecb125deb6087816 | <ide><path>src/Illuminate/Foundation/Console/Presets/react-stubs/webpack.mix.js
<del>let mix = require('laravel-mix');
<add>const mix = require('laravel-mix');
<ide>
<ide> /*
<ide> |--------------------------------------------------------------------------
<ide><path>src/Illuminate/Foundation/Console/Presets/vue-stubs/webpack.mix.js
<del>let mix = require('laravel-mix');
<add>const mix = require('laravel-mix');
<ide>
<ide> /*
<ide> |-------------------------------------------------------------------------- | 2 |
Python | Python | pin good version of huggingface_hub | 12a4457c565064f981dd56ed40a459d1cf0e12ac | <ide><path>setup.py
<ide> "flake8>=3.8.3",
<ide> "flax>=0.3.4",
<ide> "fugashi>=1.0",
<del> "huggingface-hub==0.0.11",
<add> "huggingface-hub==0.0.12",
<ide> "importlib_metadata",
<ide> "ipadic>=1.0.0,<2.0",
<ide> "isort>=5.5.4",
<ide><path>src/transformers/dependency_versions_table.py
<ide> "flake8": "flake8>=3.8.3",
<ide> "flax": "flax>=0.3.4",
<ide> "fugashi": "fugashi>=1.0",
<del> "huggingface-hub": "huggingface-hub==0.0.11",
<add> "huggingface-hub": "huggingface-hub==0.0.12",
<ide> "importlib_metadata": "importlib_metadata",
<ide> "ipadic": "ipadic>=1.0.0,<2.0",
<ide> "isort": "isort>=5.5.4", | 2 |
PHP | PHP | fix implementation of bufferedstatement | 35dcf38514900b6e4163d5a5ee502ba9f87913e6 | <ide><path>src/Database/Schema/SqliteSchema.php
<ide> public function truncateTableSql(TableSchema $schema)
<ide> */
<ide> public function hasSequences()
<ide> {
<del> $result = $this->_driver
<del> ->prepare('SELECT 1 FROM sqlite_master WHERE name = "sqlite_sequence"');
<add> $result = $this->_driver->prepare(
<add> 'SELECT 1 FROM sqlite_master WHERE name = "sqlite_sequence"'
<add> );
<ide> $result->execute();
<ide> $this->_hasSequences = (bool)$result->rowCount();
<ide> $result->closeCursor();
<ide><path>src/Database/Statement/BufferedStatement.php
<ide> */
<ide> namespace Cake\Database\Statement;
<ide>
<del>use CachingIterator;
<del>use IteratorIterator;
<add>use Cake\Database\StatementInterface;
<add>use Cake\Database\TypeConverterTrait;
<add>use Iterator;
<ide>
<ide> /**
<ide> * A statement decorator that implements buffered results.
<ide> *
<ide> * This statement decorator will save fetched results in memory, allowing
<ide> * the iterator to be rewound and reused.
<ide> */
<del>class BufferedStatement extends StatementDecorator
<add>class BufferedStatement implements Iterator, StatementInterface
<ide> {
<add> use TypeConverterTrait;
<ide>
<ide> /**
<del> * Records count
<add> * If true, all rows were fetched
<ide> *
<del> * @var int
<add> * @var bool
<ide> */
<del> protected $_count = 0;
<add> protected $_allFetched = false;
<ide>
<ide> /**
<del> * Array of results
<add> * The decorated statement
<add> *
<add> * @var \Cake\Database\StatementInterface|\PDOStatement
<add> */
<add> protected $statement;
<add>
<add> /**
<add> * The driver for the statement
<add> *
<add> * @var \Cake\Database\DriverInterface
<add> */
<add> protected $driver;
<add>
<add> /**
<add> * The in-memory cache containing results from previous iterators
<ide> *
<ide> * @var array
<ide> */
<del> protected $_records = [];
<add> protected $buffer = [];
<ide>
<ide> /**
<del> * If true, all rows were fetched
<add> * Whether or not this statement has already been executed
<ide> *
<ide> * @var bool
<ide> */
<del> protected $_allFetched = false;
<add> protected $_hasExecuted = false;
<ide>
<ide> /**
<del> * Current record pointer
<add> * The current iterator index.
<ide> *
<ide> * @var int
<ide> */
<del> protected $_counter = 0;
<add> protected $index = 0;
<add>
<add> /**
<add> * Constructor
<add> *
<add> * @param \Cake\Database\StatementInterface $statement Statement implementation such as PDOStatement
<add> * @param \Cake\Database\Driver $driver Driver instance
<add> */
<add> public function __construct($statement, $driver)
<add> {
<add> $this->statement = $statement;
<add> $this->driver = $driver;
<add> }
<ide>
<ide> /**
<del> * Execute the statement and return the results.
<add> * Magic getter to return $queryString as read-only.
<ide> *
<del> * @param array|null $params list of values to be bound to query
<del> * @return bool true on success, false otherwise
<add> * @param string $property internal property to get
<add> * @return mixed
<add> */
<add> public function __get($property)
<add> {
<add> if ($property === 'queryString') {
<add> return $this->statement->queryString;
<add> }
<add> }
<add>
<add> /**
<add> * {@inheritDoc}
<add> */
<add> public function bindValue($column, $value, $type = 'string')
<add> {
<add> $this->statement->bindValue($column, $value, $type);
<add> }
<add>
<add> /**
<add> * {@inheritDoc}
<add> */
<add> public function closeCursor()
<add> {
<add> $this->statement->closeCursor();
<add> }
<add>
<add> /**
<add> * {@inheritDoc}
<add> */
<add> public function columnCount()
<add> {
<add> return $this->statement->columnCount();
<add> }
<add>
<add> /**
<add> * {@inheritDoc}
<add> */
<add> public function errorCode()
<add> {
<add> return $this->statement->errorCode();
<add> }
<add>
<add> /**
<add> * {@inheritDoc}
<add> */
<add> public function errorInfo()
<add> {
<add> return $this->statement->errorInfo();
<add> }
<add>
<add> /**
<add> * {@inheritDoc}
<ide> */
<ide> public function execute($params = null)
<ide> {
<ide> $this->_reset();
<add> $this->_hasExecuted = true;
<ide>
<del> return parent::execute($params);
<add> return $this->statement->execute($params);
<add> }
<add>
<add> /**
<add> * {@inheritDoc}
<add> */
<add> public function fetchColumn($position)
<add> {
<add> $result = $this->fetch(static::FETCH_TYPE_NUM);
<add> if (isset($result[$position])) {
<add> return $result[$position];
<add> }
<add>
<add> return false;
<add> }
<add>
<add> /**
<add> * Statements can be passed as argument for count() to return the number
<add> * for affected rows from last execution.
<add> *
<add> * @return int
<add> */
<add> public function count()
<add> {
<add> return $this->rowCount();
<add> }
<add>
<add> /**
<add> * {@inheritDoc}
<add> */
<add> public function bind($params, $types)
<add> {
<add> if (empty($params)) {
<add> return;
<add> }
<add>
<add> $anonymousParams = is_int(key($params)) ? true : false;
<add> $offset = 1;
<add> foreach ($params as $index => $value) {
<add> $type = null;
<add> if (isset($types[$index])) {
<add> $type = $types[$index];
<add> }
<add> if ($anonymousParams) {
<add> $index += $offset;
<add> }
<add> $this->bindValue($index, $value, $type);
<add> }
<add> }
<add>
<add> /**
<add> * {@inheritDoc}
<add> */
<add> public function lastInsertId($table = null, $column = null)
<add> {
<add> $row = null;
<add> if ($column && $this->columnCount()) {
<add> $row = $this->fetch(static::FETCH_TYPE_ASSOC);
<add> }
<add> if (isset($row[$column])) {
<add> return $row[$column];
<add> }
<add>
<add> return $this->driver->lastInsertId($table, $column);
<ide> }
<ide>
<ide> /**
<ide> public function execute($params = null)
<ide> public function fetch($type = parent::FETCH_TYPE_NUM)
<ide> {
<ide> if ($this->_allFetched) {
<del> $row = ($this->_counter < $this->_count) ? $this->_records[$this->_counter++] : false;
<del> $row = ($row && $type === static::FETCH_TYPE_NUM) ? array_values($row) : $row;
<add> $row = false;
<add> if (isset($this->buffer[$this->index])) {
<add> $row = $this->buffer[$this->index];
<add> }
<add> $this->index += 1;
<add>
<add> if ($row && $type === static::FETCH_TYPE_NUM) {
<add> return array_values($row);
<add> }
<ide>
<ide> return $row;
<ide> }
<ide>
<del> $record = parent::fetch($type);
<del>
<add> $record = $this->statement->fetch($type);
<ide> if ($record === false) {
<ide> $this->_allFetched = true;
<del> $this->_counter = $this->_count + 1;
<del> $this->_statement->closeCursor();
<add> $this->statement->closeCursor();
<ide>
<ide> return false;
<ide> }
<add> $this->buffer[] = $record;
<ide>
<del> $this->_count++;
<del>
<del> return $this->_records[] = $record;
<add> return $record;
<ide> }
<ide>
<ide> /**
<ide> public function fetchAssoc()
<ide> * @param string $type The type to fetch.
<ide> * @return array
<ide> */
<del> public function fetchAll($type = parent::FETCH_TYPE_NUM)
<add> public function fetchAll($type = self::FETCH_TYPE_NUM)
<ide> {
<ide> if ($this->_allFetched) {
<del> return $this->_records;
<add> return $this->buffer;
<add> }
<add> $results = $this->statement->fetchAll($type);
<add> if ($results !== false) {
<add> $this->buffer = array_merge($this->buffer, $results);
<ide> }
<del>
<del> $this->_records = parent::fetchAll($type);
<del> $this->_count = count($this->_records);
<ide> $this->_allFetched = true;
<del> $this->_statement->closeCursor();
<add> $this->statement->closeCursor();
<ide>
<del> return $this->_records;
<add> return $this->buffer;
<ide> }
<ide>
<ide> /**
<ide> public function fetchAll($type = parent::FETCH_TYPE_NUM)
<ide> public function rowCount()
<ide> {
<ide> if (!$this->_allFetched) {
<del> $counter = $this->_counter;
<del> while ($this->fetch(static::FETCH_TYPE_ASSOC)) {
<del> }
<del> $this->_counter = $counter;
<add> $this->fetchAll(static::FETCH_TYPE_ASSOC);
<ide> }
<ide>
<del> return $this->_count;
<add> return count($this->buffer);
<ide> }
<ide>
<ide> /**
<del> * Rewind the _counter property
<add> * Reset all properties
<ide> *
<ide> * @return void
<ide> */
<del> public function rewind()
<add> protected function _reset()
<ide> {
<del> $this->_counter = 0;
<add> $this->buffer = [];
<add> $this->_allFetched = false;
<add> $this->index = 0;
<ide> }
<ide>
<ide> /**
<del> * Reset all properties
<add> * Returns the current key in the iterator
<ide> *
<del> * @return void
<add> * @return mixed
<ide> */
<del> protected function _reset()
<add> public function key()
<ide> {
<del> $this->_count = $this->_counter = 0;
<del> $this->_records = [];
<del> $this->_allFetched = false;
<add> return $this->index;
<ide> }
<ide>
<ide> /**
<del> * Get an iterator that buffers results.
<add> * Returns the current record in the iterator
<ide> *
<del> * @return Traversable
<add> * @return mixed
<ide> */
<del> public function getIterator()
<add> public function current()
<ide> {
<del> $statement = parent::getIterator();
<del> if (!$this->_iterator) {
<del> $this->_iterator = new BufferedIterator(new IteratorIterator($statement));
<add> return $this->buffer[$this->index];
<add> }
<add>
<add> /**
<add> * Rewinds the collection
<add> *
<add> * @return void
<add> */
<add> public function rewind()
<add> {
<add> if (!$this->_hasExecuted) {
<add> $this->execute();
<ide> }
<add> $this->index = 0;
<add> }
<ide>
<del> return $this->_iterator;
<add> /**
<add> * Returns whether or not the iterator has more elements
<add> *
<add> * @return bool
<add> */
<add> public function valid()
<add> {
<add> $old = $this->index;
<add> $row = $this->fetch(self::FETCH_TYPE_ASSOC);
<add>
<add> // Restore the index as fetch() increments during
<add> // the cache scenario.
<add> $this->index = $old;
<add>
<add> return $row !== false;
<add> }
<add>
<add> /**
<add> * Advances the iterator pointer to the next element
<add> *
<add> * @return void
<add> */
<add> public function next()
<add> {
<add> $this->index += 1;
<add> }
<add>
<add> /**
<add> * Get the wrapped statement
<add> *
<add> * @return \Cake\Database\StatementInterface
<add> */
<add> public function getInnerStatement()
<add> {
<add> return $this->statement;
<ide> }
<ide> }
<ide><path>src/Database/Statement/StatementDecorator.php
<ide> */
<ide> class StatementDecorator implements StatementInterface, Countable, IteratorAggregate
<ide> {
<del>
<ide> use TypeConverterTrait;
<ide>
<del> /**
<del> * Used to designate that numeric indexes be returned in a result when calling fetch methods
<del> *
<del> * @var string
<del> */
<del> const FETCH_TYPE_NUM = 'num';
<del>
<del> /**
<del> * Used to designate that an associated array be returned in a result when calling fetch methods
<del> *
<del> * @var string
<del> */
<del> const FETCH_TYPE_ASSOC = 'assoc';
<del>
<del> /**
<del> * Used to designate that a stdClass object be returned in a result when calling fetch methods
<del> *
<del> * @var string
<del> */
<del> const FETCH_TYPE_OBJ = 'obj';
<del>
<ide> /**
<ide> * Statement instance implementation, such as PDOStatement
<ide> * or any other custom implementation.
<ide><path>src/Database/StatementInterface.php
<ide> */
<ide> interface StatementInterface
<ide> {
<add> /**
<add> * Used to designate that numeric indexes be returned in a result when calling fetch methods
<add> *
<add> * @var string
<add> */
<add> const FETCH_TYPE_NUM = 'num';
<add>
<add> /**
<add> * Used to designate that an associated array be returned in a result when calling fetch methods
<add> *
<add> * @var string
<add> */
<add> const FETCH_TYPE_ASSOC = 'assoc';
<add>
<add> /**
<add> * Used to designate that a stdClass object be returned in a result when calling fetch methods
<add> *
<add> * @var string
<add> */
<add> const FETCH_TYPE_OBJ = 'obj';
<ide>
<ide> /**
<ide> * Assign a value to a positional or named variable in prepared query. If using
<ide><path>tests/TestCase/Database/QueryTest.php
<ide> public function testDecorateResults()
<ide> }
<ide>
<ide> $results = $query->decorateResults(null, true)->execute();
<del> while ($row = $result->fetch('assoc')) {
<add> while ($row = $results->fetch('assoc')) {
<ide> $this->assertArrayNotHasKey('foo', $row);
<ide> $this->assertArrayNotHasKey('modified_id', $row);
<ide> }
<ide><path>tests/TestCase/Database/Schema/SqliteSchemaTest.php
<ide> public function testTruncateSql()
<ide> ->will($this->returnValue($driver));
<ide>
<ide> $statement = $this->getMockBuilder('\PDOStatement')
<del> ->setMethods(['execute', 'rowCount', 'closeCursor', 'fetch'])
<add> ->setMethods(['execute', 'rowCount', 'closeCursor', 'fetchAll'])
<ide> ->getMock();
<del> $driver->getConnection()->expects($this->once())->method('prepare')
<add> $driver->getConnection()->expects($this->once())
<add> ->method('prepare')
<ide> ->with('SELECT 1 FROM sqlite_master WHERE name = "sqlite_sequence"')
<ide> ->will($this->returnValue($statement));
<del> $statement->expects($this->at(0))->method('fetch')
<add> $statement->expects($this->once())
<add> ->method('fetchAll')
<ide> ->will($this->returnValue(['1']));
<del> $statement->expects($this->at(2))->method('fetch')
<del> ->will($this->returnValue(false));
<ide>
<ide> $table = new TableSchema('articles');
<ide> $result = $table->truncateSql($connection);
<ide> public function testTruncateSqlNoSequences()
<ide> ->will($this->returnValue($driver));
<ide>
<ide> $statement = $this->getMockBuilder('\PDOStatement')
<del> ->setMethods(['execute', 'rowCount', 'closeCursor', 'fetch'])
<add> ->setMethods(['execute', 'rowCount', 'closeCursor', 'fetchAll'])
<ide> ->getMock();
<del> $driver->getConnection()->expects($this->once())->method('prepare')
<add> $driver->getConnection()
<add> ->expects($this->once())
<add> ->method('prepare')
<ide> ->with('SELECT 1 FROM sqlite_master WHERE name = "sqlite_sequence"')
<ide> ->will($this->returnValue($statement));
<del> $statement->expects($this->once())->method('fetch')
<add> $statement->expects($this->once())
<add> ->method('fetchAll')
<ide> ->will($this->returnValue(false));
<ide>
<ide> $table = new TableSchema('articles'); | 6 |
Javascript | Javascript | move setting of controller data to single location | 0d55298b56fcd67570374441c0bba76c0bf0d1f0 | <ide><path>src/ng/compile.js
<ide> function $CompileProvider($provide, $$sanitizeUriProvider) {
<ide> }
<ide> }
<ide>
<del> // Initialize controllers
<add> // Initialize bindToController bindings
<ide> for (var name in elementControllers) {
<ide> var controllerDirective = controllerDirectives[name];
<ide> var controller = elementControllers[name];
<ide> var bindings = controllerDirective.$$bindings.bindToController;
<ide>
<del> // Initialize bindToController bindings
<ide> if (controller.identifier && bindings) {
<ide> controller.bindingInfo =
<ide> initializeDirectiveBindings(controllerScope, attrs, controller.instance, bindings, controllerDirective);
<ide> function $CompileProvider($provide, $$sanitizeUriProvider) {
<ide> // If the controller constructor has a return value, overwrite the instance
<ide> // from setupControllers
<ide> controller.instance = controllerResult;
<add> $element.data('$' + controllerDirective.name + 'Controller', controllerResult);
<ide> controller.bindingInfo.removeWatches && controller.bindingInfo.removeWatches();
<ide> controller.bindingInfo =
<ide> initializeDirectiveBindings(controllerScope, attrs, controller.instance, bindings, controllerDirective);
<ide> }
<del>
<del> // Store controllers on the $element data
<del> // For transclude comment nodes this will be a noop and will be done at transclusion time
<del> $element.data('$' + controllerDirective.name + 'Controller', controllerResult);
<ide> }
<ide>
<ide> // Bind the required controllers to the controller, if `require` is an object and `bindToController` is truthy
<ide> function $CompileProvider($provide, $$sanitizeUriProvider) {
<ide> controller = attrs[directive.name];
<ide> }
<ide>
<del> elementControllers[directive.name] = $controller(controller, locals, true, directive.controllerAs);
<add> var controllerInstance = $controller(controller, locals, true, directive.controllerAs);
<add>
<add> // For directives with element transclusion the element is a comment.
<add> // In this case .data will not attach any data.
<add> // Instead, we save the controllers for the element in a local hash and attach to .data
<add> // later, once we have the actual element.
<add> elementControllers[directive.name] = controllerInstance;
<add> $element.data('$' + directive.name + 'Controller', controllerInstance.instance);
<ide> }
<ide> return elementControllers;
<ide> } | 1 |
Javascript | Javascript | add missing runtask | 2a5e2c7bf99755a0b270f36b8181e0dda3943ccc | <ide><path>packages/internal-test-helpers/lib/test-cases/abstract-application.js
<ide> export default class AbstractApplicationTestCase extends AbstractTestCase {
<ide>
<ide> async visit(url, options) {
<ide> // Create the instance
<del> let instance = await this._ensureInstance(options).then(instance => instance.visit(url));
<add> let instance = await this._ensureInstance(options).then(instance =>
<add> runTask(() => instance.visit(url))
<add> );
<ide>
<ide> // Await all asynchronous actions
<ide> await runLoopSettled(); | 1 |
Java | Java | add support for websocket protocol extensions | 6d00a3f0ee795e1a5bd9ffe02c584623828dbc37 | <ide><path>spring-messaging/src/main/java/org/springframework/messaging/handler/websocket/SubProtocolHandler.java
<ide> void handleMessageFromClient(WebSocketSession session, WebSocketMessage message,
<ide> /**
<ide> * Resolve the session id from the given message or return {@code null}.
<ide> *
<del> * @param the message to resolve the session id from
<add> * @param message the message to resolve the session id from
<ide> */
<ide> String resolveSessionId(Message<?> message);
<ide>
<ide><path>spring-websocket/src/main/java/org/springframework/web/socket/WebSocketExtension.java
<add>/*
<add> * Copyright 2002-2013 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.web.socket;
<add>
<add>import org.springframework.util.Assert;
<add>import org.springframework.util.CollectionUtils;
<add>import org.springframework.util.LinkedCaseInsensitiveMap;
<add>import org.springframework.util.StringUtils;
<add>
<add>import java.util.ArrayList;
<add>import java.util.Collections;
<add>import java.util.LinkedHashMap;
<add>import java.util.List;
<add>import java.util.Locale;
<add>import java.util.Map;
<add>
<add>/**
<add> * WebSocket Protocol extension.
<add> * Adds new protocol features to the WebSocket protocol; the extensions used
<add> * within a session are negotiated during the handshake phase:
<add> * <ul>
<add> * <li>the client may ask for specific extensions in the HTTP request</li>
<add> * <li>the server declares the final list of supported extensions for the current session in the HTTP response</li>
<add> * </ul>
<add> *
<add> * <p>WebSocket Extension HTTP headers may include parameters and follow
<add> * <a href="https://tools.ietf.org/html/rfc2616#section-4.2">RFC 2616 Section 4.2</a>
<add> * specifications.</p>
<add> *
<add> * <p>Note that the order of extensions in HTTP headers defines their order of execution,
<add> * e.g. extensions "foo, bar" will be executed as "bar(foo(message))".</p>
<add> *
<add> * @author Brian Clozel
<add> * @since 4.0
<add> * @see <a href="https://tools.ietf.org/html/rfc6455#section-9">
<add> * WebSocket Protocol Extensions, RFC 6455 - Section 9</a>
<add> */
<add>public class WebSocketExtension {
<add>
<add> private final String name;
<add>
<add> private final Map<String, String> parameters;
<add>
<add> public WebSocketExtension(String name) {
<add> this(name,null);
<add> }
<add>
<add> public WebSocketExtension(String name, Map<String, String> parameters) {
<add> Assert.hasLength(name, "extension name must not be empty");
<add> this.name = name;
<add> if (!CollectionUtils.isEmpty(parameters)) {
<add> Map<String, String> m = new LinkedCaseInsensitiveMap<String>(parameters.size(), Locale.ENGLISH);
<add> m.putAll(parameters);
<add> this.parameters = Collections.unmodifiableMap(m);
<add> }
<add> else {
<add> this.parameters = Collections.emptyMap();
<add> }
<add> }
<add>
<add> /**
<add> * @return the name of the extension
<add> */
<add> public String getName() {
<add> return this.name;
<add> }
<add>
<add> /**
<add> * @return the parameters of the extension
<add> */
<add> public Map<String, String> getParameters() {
<add> return this.parameters;
<add> }
<add>
<add> /**
<add> * Parse a list of raw WebSocket extension headers
<add> */
<add> public static List<WebSocketExtension> parseHeaders(List<String> headers) {
<add> if (headers == null || headers.isEmpty()) {
<add> return Collections.emptyList();
<add> }
<add> else {
<add> List<WebSocketExtension> result = new ArrayList<WebSocketExtension>(headers.size());
<add> for (String header : headers) {
<add> result.addAll(parseHeader(header));
<add> }
<add> return result;
<add> }
<add> }
<add>
<add> /**
<add> * Parse a raw WebSocket extension header
<add> */
<add> public static List<WebSocketExtension> parseHeader(String header) {
<add> if (header == null || !StringUtils.hasText(header)) {
<add> return Collections.emptyList();
<add> }
<add> else {
<add> List<WebSocketExtension> result = new ArrayList<WebSocketExtension>();
<add> for(String token : header.split(",")) {
<add> result.add(parse(token));
<add> }
<add> return result;
<add> }
<add> }
<add>
<add> private static WebSocketExtension parse(String extension) {
<add> Assert.doesNotContain(extension,",","this string contains multiple extension declarations");
<add> String[] parts = StringUtils.tokenizeToStringArray(extension, ";");
<add> String name = parts[0].trim();
<add>
<add> Map<String, String> parameters = null;
<add> if (parts.length > 1) {
<add> parameters = new LinkedHashMap<String, String>(parts.length - 1);
<add> for (int i = 1; i < parts.length; i++) {
<add> String parameter = parts[i];
<add> int eqIndex = parameter.indexOf('=');
<add> if (eqIndex != -1) {
<add> String attribute = parameter.substring(0, eqIndex);
<add> String value = parameter.substring(eqIndex + 1, parameter.length());
<add> parameters.put(attribute, value);
<add> }
<add> }
<add> }
<add>
<add> return new WebSocketExtension(name,parameters);
<add> }
<add>
<add> /**
<add> * Convert a list of WebSocketExtensions to a list of String,
<add> * which is convenient for native HTTP headers.
<add> */
<add> public static List<String> toStringList(List<WebSocketExtension> extensions) {
<add> List<String> result = new ArrayList<String>(extensions.size());
<add> for(WebSocketExtension extension : extensions) {
<add> result.add(extension.toString());
<add> }
<add> return result;
<add> }
<add>
<add> @Override
<add> public String toString() {
<add> StringBuilder str = new StringBuilder();
<add> str.append(this.name);
<add> for (String param : parameters.keySet()) {
<add> str.append(';');
<add> str.append(param);
<add> str.append('=');
<add> str.append(this.parameters.get(param));
<add> }
<add> return str.toString();
<add> }
<add>}
<ide><path>spring-websocket/src/main/java/org/springframework/web/socket/WebSocketSession.java
<ide> import java.net.InetSocketAddress;
<ide> import java.net.URI;
<ide> import java.security.Principal;
<add>import java.util.List;
<ide> import java.util.Map;
<ide>
<ide> import org.springframework.http.HttpHeaders;
<ide> public interface WebSocketSession {
<ide> */
<ide> String getAcceptedProtocol();
<ide>
<add> /**
<add> * Return the negotiated extensions or {@code null} if none was specified or
<add> * negotiated successfully.
<add> */
<add> List<WebSocketExtension> getExtensions();
<add>
<ide> /**
<ide> * Return whether the connection is still open.
<ide> */
<ide><path>spring-websocket/src/main/java/org/springframework/web/socket/adapter/JettyWebSocketSession.java
<ide> import java.net.InetSocketAddress;
<ide> import java.net.URI;
<ide> import java.security.Principal;
<add>import java.util.ArrayList;
<add>import java.util.List;
<ide> import java.util.Map;
<ide>
<add>import org.eclipse.jetty.websocket.api.extensions.ExtensionConfig;
<ide> import org.springframework.http.HttpHeaders;
<ide> import org.springframework.util.ObjectUtils;
<ide> import org.springframework.web.socket.BinaryMessage;
<ide> import org.springframework.web.socket.CloseStatus;
<ide> import org.springframework.web.socket.PingMessage;
<ide> import org.springframework.web.socket.PongMessage;
<ide> import org.springframework.web.socket.TextMessage;
<add>import org.springframework.web.socket.WebSocketExtension;
<ide> import org.springframework.web.socket.WebSocketSession;
<ide>
<ide> /**
<ide> public class JettyWebSocketSession extends AbstractWebSocketSesssion<org.eclipse
<ide>
<ide> private HttpHeaders headers;
<ide>
<add> private List<WebSocketExtension> extensions;
<add>
<ide> private final Principal principal;
<ide>
<ide>
<ide> public String getAcceptedProtocol() {
<ide> return getNativeSession().getUpgradeResponse().getAcceptedSubProtocol();
<ide> }
<ide>
<add> @Override
<add> public List<WebSocketExtension> getExtensions() {
<add> checkNativeSessionInitialized();
<add> if(this.extensions == null) {
<add> this.extensions = new ArrayList<WebSocketExtension>();
<add> for(ExtensionConfig ext : getNativeSession().getUpgradeResponse().getExtensions()) {
<add> this.extensions.add(new WebSocketExtension(ext.getName(),ext.getParameters()));
<add> }
<add> }
<add> return this.extensions;
<add> }
<add>
<ide> @Override
<ide> public boolean isOpen() {
<ide> return ((getNativeSession() != null) && getNativeSession().isOpen());
<ide><path>spring-websocket/src/main/java/org/springframework/web/socket/adapter/StandardWebSocketSession.java
<ide> import java.net.InetSocketAddress;
<ide> import java.net.URI;
<ide> import java.security.Principal;
<add>import java.util.ArrayList;
<add>import java.util.HashMap;
<add>import java.util.List;
<ide> import java.util.Map;
<ide>
<ide> import javax.websocket.CloseReason;
<ide> import javax.websocket.CloseReason.CloseCodes;
<add>import javax.websocket.Extension;
<ide>
<ide> import org.springframework.http.HttpHeaders;
<ide> import org.springframework.util.StringUtils;
<ide> import org.springframework.web.socket.PingMessage;
<ide> import org.springframework.web.socket.PongMessage;
<ide> import org.springframework.web.socket.TextMessage;
<add>import org.springframework.web.socket.WebSocketExtension;
<ide> import org.springframework.web.socket.WebSocketSession;
<ide>
<ide> /**
<ide> public class StandardWebSocketSession extends AbstractWebSocketSesssion<javax.we
<ide>
<ide> private final InetSocketAddress remoteAddress;
<ide>
<add> private List<WebSocketExtension> extensions;
<add>
<ide>
<ide> /**
<ide> * Class constructor.
<ide> public String getAcceptedProtocol() {
<ide> return StringUtils.isEmpty(protocol)? null : protocol;
<ide> }
<ide>
<add> @Override
<add> public List<WebSocketExtension> getExtensions() {
<add> checkNativeSessionInitialized();
<add> if(this.extensions == null) {
<add> List<Extension> nativeExtensions = getNativeSession().getNegotiatedExtensions();
<add> this.extensions = new ArrayList<WebSocketExtension>(nativeExtensions.size());
<add> for(Extension nativeExtension : nativeExtensions) {
<add> Map<String, String> parameters = new HashMap<String, String>();
<add> for (Extension.Parameter param : nativeExtension.getParameters()) {
<add> parameters.put(param.getName(),param.getValue());
<add> }
<add> this.extensions.add(new WebSocketExtension(nativeExtension.getName(),parameters));
<add> }
<add> }
<add> return this.extensions;
<add> }
<add>
<ide> @Override
<ide> public boolean isOpen() {
<ide> return ((getNativeSession() != null) && getNativeSession().isOpen());
<ide><path>spring-websocket/src/main/java/org/springframework/web/socket/server/DefaultHandshakeHandler.java
<ide> import org.springframework.http.server.ServerHttpResponse;
<ide> import org.springframework.util.ClassUtils;
<ide> import org.springframework.util.StringUtils;
<add>import org.springframework.web.socket.WebSocketExtension;
<ide> import org.springframework.web.socket.WebSocketHandler;
<ide>
<ide> /**
<ide> * A default {@link HandshakeHandler} implementation. Performs initial validation of the
<ide> * WebSocket handshake request -- possibly rejecting it through the appropriate HTTP
<ide> * status code -- while also allowing sub-classes to override various parts of the
<del> * negotiation process (e.g. origin validation, sub-protocol negotiation, etc).
<add> * negotiation process (e.g. origin validation, sub-protocol negotiation,
<add> * extensions negotiation, etc).
<ide> *
<ide> * <p>
<ide> * If the negotiation succeeds, the actual upgrade is delegated to a server-specific
<ide> public final boolean doHandshake(ServerHttpRequest request, ServerHttpResponse r
<ide> logger.debug("Upgrading request, sub-protocol=" + subProtocol);
<ide> }
<ide>
<add> List<WebSocketExtension> requestedExtensions = WebSocketExtension
<add> .parseHeaders(request.getHeaders().getSecWebSocketExtensions());
<add>
<add> List<WebSocketExtension> filteredExtensions = filterRequestedExtensions(requestedExtensions,
<add> this.requestUpgradeStrategy.getAvailableExtensions(request));
<add> request.getHeaders().setSecWebSocketExtensions(WebSocketExtension.toStringList(filteredExtensions));
<add>
<ide> this.requestUpgradeStrategy.upgrade(request, response, subProtocol, wsHandler, attributes);
<ide>
<ide> return true;
<ide> protected String selectProtocol(List<String> requestedProtocols) {
<ide> return null;
<ide> }
<ide>
<add> /**
<add> * Filter the list of WebSocket Extensions requested by the client.
<add> * Since the negotiation process happens during the upgrade phase within the server
<add> * implementation, one can customize the applied extensions only by filtering the
<add> * requested extensions by the client.
<add> *
<add> * <p>The default implementation of this method doesn't filter any of the extensions
<add> * requested by the client.
<add> * @param requestedExtensions the list of extensions requested by the client
<add> * @param supportedExtensions the list of extensions supported by the server
<add> * @return the filtered list of requested extensions
<add> */
<add> protected List<WebSocketExtension> filterRequestedExtensions(List<WebSocketExtension> requestedExtensions,
<add> List<WebSocketExtension> supportedExtensions) {
<add>
<add> if (requestedExtensions != null) {
<add> if (logger.isDebugEnabled()) {
<add> logger.debug("Requested extension(s): " + requestedExtensions
<add> + ", supported extension(s): " + supportedExtensions);
<add> }
<add> }
<add> return requestedExtensions;
<add> }
<ide> }
<ide><path>spring-websocket/src/main/java/org/springframework/web/socket/server/RequestUpgradeStrategy.java
<ide>
<ide> package org.springframework.web.socket.server;
<ide>
<add>import java.util.List;
<ide> import java.util.Map;
<ide>
<ide> import org.springframework.http.server.ServerHttpRequest;
<ide> import org.springframework.http.server.ServerHttpResponse;
<add>import org.springframework.web.socket.WebSocketExtension;
<ide> import org.springframework.web.socket.WebSocketHandler;
<ide>
<ide> /**
<ide> public interface RequestUpgradeStrategy {
<ide> */
<ide> String[] getSupportedVersions();
<ide>
<add> /**
<add> * @return the list of available WebSocket protocol extensions,
<add> * implemented by the underlying WebSocket server.
<add> */
<add> List<WebSocketExtension> getAvailableExtensions(ServerHttpRequest request);
<add>
<ide> /**
<ide> * Perform runtime specific steps to complete the upgrade. Invoked after successful
<ide> * negotiation of the handshake request.
<ide><path>spring-websocket/src/main/java/org/springframework/web/socket/server/config/WebSocketConfigurer.java
<ide>
<ide> package org.springframework.web.socket.server.config;
<ide>
<del>import org.eclipse.jetty.websocket.server.WebSocketHandler;
<del>
<add>import org.springframework.web.socket.WebSocketHandler;
<ide>
<ide>
<ide> /**
<ide><path>spring-websocket/src/main/java/org/springframework/web/socket/server/support/AbstractGlassFishRequestUpgradeStrategy.java
<ide> import java.io.IOException;
<ide> import java.lang.reflect.Constructor;
<ide> import java.net.URI;
<add>import java.util.ArrayList;
<ide> import java.util.Arrays;
<add>import java.util.List;
<ide> import java.util.Random;
<ide>
<add>import javax.servlet.ServletContext;
<ide> import javax.servlet.ServletException;
<ide> import javax.servlet.http.HttpServletRequest;
<ide> import javax.servlet.http.HttpServletResponse;
<ide> import javax.websocket.DeploymentException;
<ide> import javax.websocket.Endpoint;
<add>import javax.websocket.Extension;
<add>import javax.websocket.server.ServerContainer;
<ide>
<add>import org.apache.tomcat.websocket.server.WsServerContainer;
<ide> import org.glassfish.tyrus.core.ComponentProviderService;
<ide> import org.glassfish.tyrus.core.EndpointWrapper;
<ide> import org.glassfish.tyrus.core.ErrorCollector;
<ide> import org.springframework.util.ClassUtils;
<ide> import org.springframework.util.ReflectionUtils;
<ide> import org.springframework.util.StringUtils;
<add>import org.springframework.web.socket.WebSocketExtension;
<ide> import org.springframework.web.socket.server.HandshakeFailureException;
<ide> import org.springframework.web.socket.server.endpoint.ServerEndpointRegistration;
<ide> import org.springframework.web.socket.server.endpoint.ServletServerContainerFactoryBean;
<ide> public abstract class AbstractGlassFishRequestUpgradeStrategy extends AbstractSt
<ide>
<ide> private final static Random random = new Random();
<ide>
<add> private List<WebSocketExtension> availableExtensions;
<add>
<ide> @Override
<ide> public String[] getSupportedVersions() {
<ide> return StringUtils.commaDelimitedListToStringArray(Version.getSupportedWireProtocolVersions());
<ide> }
<ide>
<add> @Override
<add> public List<WebSocketExtension> getAvailableExtensions(ServerHttpRequest request) {
<add>
<add> if(this.availableExtensions == null) {
<add> this.availableExtensions = new ArrayList<WebSocketExtension>();
<add> HttpServletRequest servletRequest = ((ServletServerHttpRequest) request).getServletRequest();
<add> for(Extension extension : getContainer(servletRequest).getInstalledExtensions()) {
<add> this.availableExtensions.add(parseStandardExtension(extension));
<add> }
<add> }
<add> return this.availableExtensions;
<add> }
<add>
<ide> @Override
<ide> public void upgradeInternal(ServerHttpRequest request, ServerHttpResponse response,
<ide> String selectedProtocol, Endpoint endpoint) throws HandshakeFailureException {
<ide> public void upgradeInternal(ServerHttpRequest request, ServerHttpResponse respon
<ide> }
<ide> }
<ide>
<add> public ServerContainer getContainer(HttpServletRequest servletRequest) {
<add>
<add> String attributeName = "javax.websocket.server.ServerContainer";
<add> ServletContext servletContext = servletRequest.getServletContext();
<add> return (ServerContainer)servletContext.getAttribute(attributeName);
<add> }
<add>
<ide> private boolean performUpgrade(HttpServletRequest request, HttpServletResponse response,
<ide> HttpHeaders headers, WebSocketApplication wsApp) throws IOException {
<ide>
<ide><path>spring-websocket/src/main/java/org/springframework/web/socket/server/support/AbstractStandardUpgradeStrategy.java
<ide> package org.springframework.web.socket.server.support;
<ide>
<ide> import java.net.InetSocketAddress;
<add>import java.util.HashMap;
<ide> import java.util.Map;
<ide>
<ide> import javax.websocket.Endpoint;
<add>import javax.websocket.Extension;
<ide>
<ide> import org.apache.commons.logging.Log;
<ide> import org.apache.commons.logging.LogFactory;
<ide> import org.springframework.http.HttpHeaders;
<ide> import org.springframework.http.server.ServerHttpRequest;
<ide> import org.springframework.http.server.ServerHttpResponse;
<add>import org.springframework.web.socket.WebSocketExtension;
<ide> import org.springframework.web.socket.WebSocketHandler;
<ide> import org.springframework.web.socket.adapter.StandardWebSocketHandlerAdapter;
<ide> import org.springframework.web.socket.adapter.StandardWebSocketSession;
<ide> public void upgrade(ServerHttpRequest request, ServerHttpResponse response, Stri
<ide> protected abstract void upgradeInternal(ServerHttpRequest request, ServerHttpResponse response,
<ide> String selectedProtocol, Endpoint endpoint) throws HandshakeFailureException;
<ide>
<add> protected WebSocketExtension parseStandardExtension(Extension extension) {
<add> Map<String, String> params = new HashMap<String,String>(extension.getParameters().size());
<add> for(Extension.Parameter param : extension.getParameters()) {
<add> params.put(param.getName(),param.getValue());
<add> }
<add> return new WebSocketExtension(extension.getName(),params);
<add> }
<add>
<ide> }
<ide><path>spring-websocket/src/main/java/org/springframework/web/socket/server/support/JettyRequestUpgradeStrategy.java
<ide> package org.springframework.web.socket.server.support;
<ide>
<ide> import java.io.IOException;
<add>import java.util.ArrayList;
<add>import java.util.List;
<ide> import java.util.Map;
<ide>
<ide> import javax.servlet.http.HttpServletRequest;
<ide> import org.springframework.http.server.ServletServerHttpRequest;
<ide> import org.springframework.http.server.ServletServerHttpResponse;
<ide> import org.springframework.util.Assert;
<add>import org.springframework.web.socket.WebSocketExtension;
<ide> import org.springframework.web.socket.WebSocketHandler;
<ide> import org.springframework.web.socket.adapter.JettyWebSocketHandlerAdapter;
<ide> import org.springframework.web.socket.adapter.JettyWebSocketSession;
<ide> public class JettyRequestUpgradeStrategy implements RequestUpgradeStrategy {
<ide>
<ide> private WebSocketServerFactory factory;
<ide>
<add> private List<WebSocketExtension> availableExtensions;
<add>
<ide>
<ide> /**
<ide> * Default constructor that creates {@link WebSocketServerFactory} through its default
<ide> public String[] getSupportedVersions() {
<ide> return new String[] { String.valueOf(HandshakeRFC6455.VERSION) };
<ide> }
<ide>
<add> @Override
<add> public List<WebSocketExtension> getAvailableExtensions(ServerHttpRequest request) {
<add> if(this.availableExtensions == null) {
<add> this.availableExtensions = new ArrayList<WebSocketExtension>();
<add> for(String extensionName : this.factory.getExtensionFactory().getExtensionNames()) {
<add> this.availableExtensions.add(new WebSocketExtension(extensionName));
<add> }
<add> }
<add> return this.availableExtensions;
<add> }
<add>
<ide> @Override
<ide> public void upgrade(ServerHttpRequest request, ServerHttpResponse response,
<ide> String protocol, WebSocketHandler wsHandler, Map<String, Object> attrs) throws HandshakeFailureException {
<ide><path>spring-websocket/src/main/java/org/springframework/web/socket/server/support/TomcatRequestUpgradeStrategy.java
<ide> package org.springframework.web.socket.server.support;
<ide>
<ide> import java.io.IOException;
<add>import java.util.ArrayList;
<ide> import java.util.Arrays;
<ide> import java.util.Collections;
<add>import java.util.List;
<ide> import java.util.Map;
<ide>
<ide> import javax.servlet.ServletContext;
<ide> import javax.servlet.ServletException;
<ide> import javax.servlet.http.HttpServletRequest;
<ide> import javax.servlet.http.HttpServletResponse;
<ide> import javax.websocket.Endpoint;
<add>import javax.websocket.Extension;
<ide>
<ide> import org.apache.tomcat.websocket.server.WsServerContainer;
<ide> import org.springframework.http.server.ServerHttpRequest;
<ide> import org.springframework.http.server.ServerHttpResponse;
<ide> import org.springframework.http.server.ServletServerHttpRequest;
<ide> import org.springframework.http.server.ServletServerHttpResponse;
<ide> import org.springframework.util.Assert;
<add>import org.springframework.web.socket.WebSocketExtension;
<ide> import org.springframework.web.socket.server.HandshakeFailureException;
<ide> import org.springframework.web.socket.server.endpoint.ServerEndpointRegistration;
<ide> import org.springframework.web.socket.server.endpoint.ServletServerContainerFactoryBean;
<ide> */
<ide> public class TomcatRequestUpgradeStrategy extends AbstractStandardUpgradeStrategy {
<ide>
<add> private List<WebSocketExtension> availableExtensions;
<ide>
<ide> @Override
<ide> public String[] getSupportedVersions() {
<ide> return new String[] { "13" };
<ide> }
<ide>
<add> @Override
<add> public List<WebSocketExtension> getAvailableExtensions(ServerHttpRequest request) {
<add>
<add> if(this.availableExtensions == null) {
<add> this.availableExtensions = new ArrayList<WebSocketExtension>();
<add> HttpServletRequest servletRequest = ((ServletServerHttpRequest) request).getServletRequest();
<add> for(Extension extension : getContainer(servletRequest).getInstalledExtensions()) {
<add> this.availableExtensions.add(parseStandardExtension(extension));
<add> }
<add> }
<add> return this.availableExtensions;
<add> }
<add>
<ide> @Override
<ide> public void upgradeInternal(ServerHttpRequest request, ServerHttpResponse response,
<ide> String acceptedProtocol, Endpoint endpoint) throws HandshakeFailureException {
<ide><path>spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/session/AbstractHttpSockJsSession.java
<ide> import java.net.InetSocketAddress;
<ide> import java.net.URI;
<ide> import java.security.Principal;
<add>import java.util.List;
<ide> import java.util.Map;
<ide> import java.util.concurrent.ArrayBlockingQueue;
<ide> import java.util.concurrent.BlockingQueue;
<ide> import org.springframework.http.server.ServerHttpResponse;
<ide> import org.springframework.util.Assert;
<ide> import org.springframework.web.socket.CloseStatus;
<add>import org.springframework.web.socket.WebSocketExtension;
<ide> import org.springframework.web.socket.WebSocketHandler;
<ide> import org.springframework.web.socket.sockjs.SockJsException;
<ide> import org.springframework.web.socket.sockjs.SockJsTransportFailureException;
<ide> public abstract class AbstractHttpSockJsSession extends AbstractSockJsSession {
<ide>
<ide> private String acceptedProtocol;
<ide>
<add> private List<WebSocketExtension> extensions;
<ide>
<ide> public AbstractHttpSockJsSession(String id, SockJsServiceConfig config,
<ide> WebSocketHandler wsHandler, Map<String, Object> handshakeAttributes) {
<ide> protected void setRemoteAddress(InetSocketAddress remoteAddress) {
<ide> this.remoteAddress = remoteAddress;
<ide> }
<ide>
<add> @Override
<add> public List<WebSocketExtension> getExtensions() { return this.extensions; }
<add>
<ide> /**
<ide> * Unlike WebSocket where sub-protocol negotiation is part of the
<ide> * initial handshake, in HTTP transports the same negotiation must
<ide> public synchronized void handleInitialRequest(ServerHttpRequest request, ServerH
<ide> this.principal = request.getPrincipal();
<ide> this.localAddress = request.getLocalAddress();
<ide> this.remoteAddress = request.getRemoteAddress();
<add> this.extensions = WebSocketExtension.parseHeaders(response.getHeaders().getSecWebSocketExtensions());
<ide>
<ide> try {
<ide> delegateConnectionEstablished();
<ide><path>spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/session/WebSocketServerSockJsSession.java
<ide> import java.net.InetSocketAddress;
<ide> import java.net.URI;
<ide> import java.security.Principal;
<add>import java.util.List;
<ide> import java.util.Map;
<ide>
<ide> import org.springframework.http.HttpHeaders;
<ide> import org.springframework.util.Assert;
<ide> import org.springframework.util.StringUtils;
<ide> import org.springframework.web.socket.CloseStatus;
<ide> import org.springframework.web.socket.TextMessage;
<add>import org.springframework.web.socket.WebSocketExtension;
<ide> import org.springframework.web.socket.WebSocketHandler;
<ide> import org.springframework.web.socket.WebSocketSession;
<ide> import org.springframework.web.socket.adapter.NativeWebSocketSession;
<ide> public String getAcceptedProtocol() {
<ide> return this.wsSession.getAcceptedProtocol();
<ide> }
<ide>
<add> @Override
<add> public List<WebSocketExtension> getExtensions() {
<add> checkDelegateSessionInitialized();
<add> return this.wsSession.getExtensions();
<add> }
<add>
<ide> private void checkDelegateSessionInitialized() {
<ide> Assert.state(this.wsSession != null, "WebSocketSession not yet initialized");
<ide> }
<ide><path>spring-websocket/src/test/java/org/springframework/web/socket/WebSocketExtensionTests.java
<add>/*
<add> * Copyright 2002-2013 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.web.socket;
<add>
<add>import static org.junit.Assert.assertEquals;
<add>import static org.junit.Assert.assertThat;
<add>
<add>import org.hamcrest.Matchers;
<add>import org.junit.Test;
<add>
<add>import java.util.ArrayList;
<add>import java.util.List;
<add>
<add>/**
<add> * Test fixture for {@link WebSocketExtension}
<add> * @author Brian Clozel
<add> */
<add>public class WebSocketExtensionTests {
<add>
<add> @Test
<add> public void parseHeaderSingle() {
<add> List<WebSocketExtension> extensions = WebSocketExtension.parseHeader("x-test-extension ; foo=bar");
<add> assertThat(extensions, Matchers.hasSize(1));
<add> WebSocketExtension extension = extensions.get(0);
<add> assertEquals("x-test-extension", extension.getName());
<add> assertEquals(1, extension.getParameters().size());
<add> assertEquals("bar", extension.getParameters().get("foo"));
<add> }
<add>
<add> @Test
<add> public void parseHeaderMultiple() {
<add> List<WebSocketExtension> extensions = WebSocketExtension.parseHeader("x-foo-extension, x-bar-extension");
<add> assertThat(extensions, Matchers.hasSize(2));
<add> assertEquals("x-foo-extension", extensions.get(0).getName());
<add> assertEquals("x-bar-extension", extensions.get(1).getName());
<add> }
<add>
<add> @Test
<add> public void parseHeaders() {
<add> List<String> extensions = new ArrayList<String>();
<add> extensions.add("x-foo-extension, x-bar-extension");
<add> extensions.add("x-test-extension");
<add> List<WebSocketExtension> parsedExtensions = WebSocketExtension.parseHeaders(extensions);
<add> assertThat(parsedExtensions, Matchers.hasSize(3));
<add> }
<add>
<add>}
<ide><path>spring-websocket/src/test/java/org/springframework/web/socket/sockjs/transport/session/TestSockJsSession.java
<ide>
<ide> import org.springframework.http.HttpHeaders;
<ide> import org.springframework.web.socket.CloseStatus;
<add>import org.springframework.web.socket.WebSocketExtension;
<ide> import org.springframework.web.socket.WebSocketHandler;
<ide> import org.springframework.web.socket.sockjs.support.frame.SockJsFrame;
<ide>
<ide> public class TestSockJsSession extends AbstractSockJsSession {
<ide>
<ide> private String subProtocol;
<ide>
<add> private List<WebSocketExtension> extensions = new ArrayList<WebSocketExtension>();
<add>
<ide>
<ide> public TestSockJsSession(String sessionId, SockJsServiceConfig config,
<ide> WebSocketHandler wsHandler, Map<String, Object> attributes) {
<ide> public InetSocketAddress getLocalAddress() {
<ide> }
<ide>
<ide> /**
<del> * @param remoteAddress the remoteAddress to set
<add> * @param localAddress the remoteAddress to set
<ide> */
<ide> public void setLocalAddress(InetSocketAddress localAddress) {
<ide> this.localAddress = localAddress;
<ide> public void setAcceptedProtocol(String protocol) {
<ide> this.subProtocol = protocol;
<ide> }
<ide>
<add> /**
<add> * @return the extensions
<add> */
<add> @Override
<add> public List<WebSocketExtension> getExtensions() { return this.extensions; }
<add>
<add> /**
<add> *
<add> * @param extensions the extensions to set
<add> */
<add> public void setExtensions(List<WebSocketExtension> extensions) { this.extensions = extensions; }
<add>
<ide> public CloseStatus getCloseStatus() {
<ide> return this.closeStatus;
<ide> }
<ide><path>spring-websocket/src/test/java/org/springframework/web/socket/support/TestWebSocketSession.java
<ide>
<ide> import org.springframework.http.HttpHeaders;
<ide> import org.springframework.web.socket.CloseStatus;
<add>import org.springframework.web.socket.WebSocketExtension;
<ide> import org.springframework.web.socket.WebSocketMessage;
<ide> import org.springframework.web.socket.WebSocketSession;
<ide>
<ide> public class TestWebSocketSession implements WebSocketSession {
<ide>
<ide> private String protocol;
<ide>
<add> private List<WebSocketExtension> extensions = new ArrayList<WebSocketExtension>();
<add>
<ide> private boolean open;
<ide>
<ide> private final List<WebSocketMessage<?>> messages = new ArrayList<>();
<ide> public InetSocketAddress getLocalAddress() {
<ide> }
<ide>
<ide> /**
<del> * @param remoteAddress the remoteAddress to set
<add> * @param localAddress the remoteAddress to set
<ide> */
<ide> public void setLocalAddress(InetSocketAddress localAddress) {
<ide> this.localAddress = localAddress;
<ide> public void setAcceptedProtocol(String protocol) {
<ide> this.protocol = protocol;
<ide> }
<ide>
<add> /**
<add> * @return the extensions
<add> */
<add> @Override
<add> public List<WebSocketExtension> getExtensions() { return this.extensions; }
<add>
<add> /**
<add> *
<add> * @param extensions the extensions to set
<add> */
<add> public void setExtensions(List<WebSocketExtension> extensions) { this.extensions = extensions; }
<add>
<ide> /**
<ide> * @return the open
<ide> */ | 17 |
Text | Text | add dataview to appropriate crypto methods | 42185730954dd2aaef9f7149b1bae03b3115e505 | <ide><path>doc/api/crypto.md
<ide> changes:
<ide> description: The default encoding for `password` if it is a string changed
<ide> from `binary` to `utf8`.
<ide> -->
<del>- `password` {string|Buffer|TypedArray}
<del>- `salt` {string|Buffer|TypedArray}
<add>- `password` {string|Buffer|TypedArray|DataView}
<add>- `salt` {string|Buffer|TypedArray|DataView}
<ide> - `iterations` {number}
<ide> - `keylen` {number}
<ide> - `digest` {string}
<ide> changes:
<ide> description: The default encoding for `password` if it is a string changed
<ide> from `binary` to `utf8`.
<ide> -->
<del>- `password` {string|Buffer|TypedArray}
<del>- `salt` {string|Buffer|TypedArray}
<add>- `password` {string|Buffer|TypedArray|DataView}
<add>- `salt` {string|Buffer|TypedArray|DataView}
<ide> - `iterations` {number}
<ide> - `keylen` {number}
<ide> - `digest` {string}
<ide> request.
<ide> <!-- YAML
<ide> added: v10.5.0
<ide> -->
<del>- `password` {string|Buffer|TypedArray}
<del>- `salt` {string|Buffer|TypedArray}
<add>- `password` {string|Buffer|TypedArray|DataView}
<add>- `salt` {string|Buffer|TypedArray|DataView}
<ide> - `keylen` {number}
<ide> - `options` {Object}
<ide> - `N` {number} CPU/memory cost parameter. Must be a power of two greater
<ide> crypto.scrypt('secret', 'salt', 64, { N: 1024 }, (err, derivedKey) => {
<ide> <!-- YAML
<ide> added: v10.5.0
<ide> -->
<del>- `password` {string|Buffer|TypedArray}
<del>- `salt` {string|Buffer|TypedArray}
<add>- `password` {string|Buffer|TypedArray|DataView}
<add>- `salt` {string|Buffer|TypedArray|DataView}
<ide> - `keylen` {number}
<ide> - `options` {Object}
<ide> - `N` {number} CPU/memory cost parameter. Must be a power of two greater | 1 |
Javascript | Javascript | adapt test-linux-perf to v8 changes | ce4b4cc0aff75cc91dc9cf61b09aedc5fbb061c3 | <ide><path>test/v8-updates/test-linux-perf.js
<ide> for (const perfArgs of perfArgsList) {
<ide> output += perfScript.stdout;
<ide> }
<ide>
<del>const interpretedFunctionOneRe = /InterpretedFunction:functionOne/;
<del>const compiledFunctionOneRe = /LazyCompile:\*functionOne/;
<del>const interpretedFunctionTwoRe = /InterpretedFunction:functionTwo/;
<del>const compiledFunctionTwoRe = /LazyCompile:\*functionTwo/;
<add>const interpretedFunctionOneRe = /~functionOne/;
<add>const compiledFunctionOneRe = /\*functionOne/;
<add>const interpretedFunctionTwoRe = /~functionTwo/;
<add>const compiledFunctionTwoRe = /\*functionTwo/;
<ide>
<add>function makeAssertMessage(message) {
<add> return message + '\nPerf output:\n\n' + output;
<add>}
<ide>
<ide> assert.ok(output.match(interpretedFunctionOneRe),
<del> "Couldn't find interpreted functionOne()");
<add> makeAssertMessage("Couldn't find interpreted functionOne()"));
<ide> assert.ok(output.match(compiledFunctionOneRe),
<del> "Couldn't find compiled functionOne()");
<add> makeAssertMessage("Couldn't find compiled functionOne()"));
<ide> assert.ok(output.match(interpretedFunctionTwoRe),
<del> "Couldn't find interpreted functionTwo()");
<add> makeAssertMessage("Couldn't find interpreted functionTwo()"));
<ide> assert.ok(output.match(compiledFunctionTwoRe),
<del> "Couldn't find compiled functionTwo");
<add> makeAssertMessage("Couldn't find compiled functionTwo")); | 1 |
Text | Text | add dep on datasets | 0054a48cdd64e7309184a64b399ab2c58d75d4e5 | <ide><path>CONTRIBUTING.md
<ide> Follow these steps to start contributing:
<ide> it with `pip uninstall transformers` before reinstalling it in editable
<ide> mode with the `-e` flag.)
<ide>
<add> To run the full test suite, you might need the additional dependency on `datasets` which requires a separate source
<add> install:
<add>
<add> ```bash
<add> $ git clone https://github.com/huggingface/datasets
<add> $ cd datasets
<add> $ pip install -e .
<add> ```
<add>
<add> If you have already cloned that repo, you might need to `git pull` to get the most recent changes in the `datasets`
<add> library.
<add>
<ide> 5. Develop the features on your branch.
<ide>
<ide> As you work on the features, you should make sure that the test suite | 1 |
Ruby | Ruby | remove owner_name from db_config | 4a95e9aa5f6a5d67bd796110c1ff86f442bfde86 | <ide><path>activerecord/lib/active_record/database_configurations/database_config.rb
<ide> class DatabaseConfigurations
<ide> class DatabaseConfig # :nodoc:
<ide> attr_reader :env_name, :name
<ide>
<del> attr_accessor :owner_name
<del>
<ide> def initialize(env_name, name)
<ide> @env_name = env_name
<ide> @name = name
<ide><path>activerecord/test/cases/query_cache_test.rb
<ide> def test_cache_is_available_when_connection_is_connected
<ide> def test_cache_is_available_when_using_a_not_connected_connection
<ide> skip "In-Memory DB can't test for using a not connected connection" if in_memory_db?
<ide> db_config = ActiveRecord::Base.configurations.configs_for(env_name: "arunit", name: "primary").dup
<del> db_config.owner_name = "test2"
<del> ActiveRecord::Base.connection_handler.establish_connection(db_config)
<add> new_conn = ActiveRecord::Base.connection_handler.establish_connection(db_config)
<ide> assert_not_predicate Task, :connected?
<ide>
<ide> Task.cache do
<ide> assert_queries(1) { Task.find(1); Task.find(1) }
<ide> ensure
<del> ActiveRecord::Base.connection_handler.remove_connection_pool(db_config.owner_name)
<add> ActiveRecord::Base.connection_handler.remove_connection_pool(new_conn)
<ide> end
<ide> end
<ide> | 2 |
Javascript | Javascript | fix typos in navigationexperimental | b098d0e8393cde31ce971e320c250b950761625a | <ide><path>Libraries/CustomComponents/NavigationExperimental/NavigationLegacyNavigator.js
<ide> class NavigationLegacyNavigator extends React.Component<any, Props, State> {
<ide> return this._stack.toArray();
<ide> }
<ide>
<del> // Lyfe cycle and private methods below.
<add> // Life cycle and private methods below.
<ide>
<ide> shouldComponentUpdate(nextProps: Object, nextState: Object): boolean {
<ide> return ReactComponentWithPureRenderMixin.shouldComponentUpdate.call(
<ide> class NavigationLegacyNavigator extends React.Component<any, Props, State> {
<ide> }
<ide>
<ide> _renderHeader(props: NavigationSceneRendererProps): ?ReactElement {
<del> // `_renderHeader` is the always called before `_renderCard`. We should
<add> // `_renderHeader` is always called before `_renderCard`. We should
<ide> // subscribe to the position here.
<ide> this._positionListener && this._positionListener.remove();
<ide> this._positionListener = new NavigationAnimatedValueSubscription( | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.