content_type stringclasses 8
values | main_lang stringclasses 7
values | message stringlengths 1 50 | sha stringlengths 40 40 | patch stringlengths 52 962k | file_count int64 1 300 |
|---|---|---|---|---|---|
Javascript | Javascript | fix whitespace and jslint for core object | 33f01b458ce5809270475429b9f9915e1765a9ed | <ide><path>packages/sproutcore-runtime/lib/system/core_object.js
<ide> function makeCtor() {
<ide> // Note: avoid accessing any properties on the object since it makes the
<ide> // method a lot faster. This is glue code so we want it to be as fast as
<ide> // possible.
<del>
<add>
<ide> var isPrepared = false, initMixins, init = false, hasChains = false;
<del>
<add>
<ide> var Class = function() {
<del> if (!isPrepared) get(Class, 'proto'); // prepare prototype...
<add> if (!isPrepared) { get(Class, 'proto'); } // prepare prototype...
<ide> if (initMixins) {
<ide> this.reopen.apply(this, initMixins);
<ide> initMixins = null;
<ide> rewatch(this); // ålways rewatch just in case
<ide> this.init.apply(this, arguments);
<ide> } else {
<del> if (hasChains) rewatch(this);
<del> if (init===false) init = this.init; // cache for later instantiations
<add> if (hasChains) { rewatch(this); }
<add> if (init===false) { init = this.init; } // cache for later instantiations
<ide> init.apply(this, arguments);
<ide> }
<ide> };
<ide> function makeCtor() {
<ide> if (!isPrepared) {
<ide> isPrepared = true;
<ide> Class.PrototypeMixin.applyPartial(Class.prototype);
<del> hasChains = !!meta(Class.prototype, false).chains; // avoid rewatch
<add> hasChains = !!meta(Class.prototype, false).chains; // avoid rewatch
<ide> }
<ide> return this.prototype;
<ide> }));
<del>
<add>
<ide> return Class;
<del>
<add>
<ide> }
<ide>
<del>var Object = makeCtor();
<add>var CoreObject = makeCtor();
<add>
<add>CoreObject.PrototypeMixin = SC.Mixin.create({
<ide>
<del>Object.PrototypeMixin = SC.Mixin.create({
<del>
<ide> reopen: function() {
<ide> SC.Mixin._apply(this, arguments, true);
<ide> return this;
<ide> },
<ide>
<ide> isInstance: true,
<del>
<add>
<ide> init: function() {},
<del>
<add>
<ide> isDestroyed: false,
<del>
<add>
<ide> destroy: function() {
<ide> set(this, 'isDestroyed', true);
<del> return this;
<add> return this;
<ide> },
<del>
<add>
<ide> bind: function(to, from) {
<del> if (!(from instanceof SC.Binding)) from = SC.Binding.from(from);
<add> if (!(from instanceof SC.Binding)) { from = SC.Binding.from(from); }
<ide> from.to(to).connect(this);
<ide> return from;
<ide> },
<ide> Object.PrototypeMixin = SC.Mixin.create({
<ide> }
<ide> });
<ide>
<del>Object.__super__ = null;
<add>CoreObject.__super__ = null;
<ide>
<ide> var ClassMixin = SC.Mixin.create({
<del>
<add>
<ide> ClassMixin: SC.required(),
<del>
<add>
<ide> PrototypeMixin: SC.required(),
<ide>
<ide> isClass: true,
<del>
<add>
<ide> isMethod: false,
<del>
<add>
<ide> extend: function() {
<ide> var Class = makeCtor(), proto;
<ide> Class.ClassMixin = SC.Mixin.create(this.ClassMixin);
<ide> Class.PrototypeMixin = SC.Mixin.create(this.PrototypeMixin);
<del>
<add>
<ide> var PrototypeMixin = Class.PrototypeMixin;
<ide> PrototypeMixin.reopen.apply(PrototypeMixin, arguments);
<del>
<add>
<ide> Class.superclass = this;
<ide> Class.__super__ = this.prototype;
<ide>
<ide> var ClassMixin = SC.Mixin.create({
<ide> SC.generateGuid(proto, 'sc');
<ide> meta(proto).proto = proto; // this will disable observers on prototype
<ide> SC.rewatch(proto); // setup watch chains if needed.
<del>
<add>
<ide>
<ide> Class.subclasses = SC.Set ? new SC.Set() : null;
<del> if (this.subclasses) this.subclasses.add(Class);
<del>
<add> if (this.subclasses) { this.subclasses.add(Class); }
<add>
<ide> Class.ClassMixin.apply(Class);
<ide> return Class;
<ide> },
<del>
<add>
<ide> create: function() {
<ide> var C = this;
<del> if (arguments.length>0) this._initMixins(arguments);
<add> if (arguments.length>0) { this._initMixins(arguments); }
<ide> return new C();
<ide> },
<del>
<add>
<ide> reopen: function() {
<ide> var PrototypeMixin = this.PrototypeMixin;
<ide> PrototypeMixin.reopen.apply(PrototypeMixin, arguments);
<ide> this._prototypeMixinDidChange();
<ide> return this;
<ide> },
<del>
<add>
<ide> reopenClass: function() {
<ide> var ClassMixin = this.ClassMixin;
<ide> ClassMixin.reopen.apply(ClassMixin, arguments);
<ide> SC.Mixin._apply(this, arguments, false);
<ide> return this;
<ide> },
<del>
<add>
<ide> detect: function(obj) {
<del> if ('function' !== typeof obj) return false;
<add> if ('function' !== typeof obj) { return false; }
<ide> while(obj) {
<del> if (obj===this) return true;
<add> if (obj===this) { return true; }
<ide> obj = obj.superclass;
<ide> }
<ide> return false;
<ide> }
<del>
<add>
<ide> });
<ide>
<del>Object.ClassMixin = ClassMixin;
<del>ClassMixin.apply(Object);
<add>CoreObject.ClassMixin = ClassMixin;
<add>ClassMixin.apply(CoreObject);
<ide>
<del>SC.CoreObject = Object;
<add>SC.CoreObject = CoreObject;
<ide>
<ide>
<ide> | 1 |
Text | Text | update broken links | 8a4dabb5bdf29f22a091c9b63e8460f0b8bfba42 | <ide><path>guide/english/html/css-classes/index.md
<ide> You can also combine classes in the same line:
<ide> }
<ide> ```
<ide>
<del>You can see the result of the above code [here](https://codepen.io/Tlandis/pen/RLvomV'). Learn how to combine css classes using selectors [here](https://www.w3schools.com/css/css_combinators.asp').
<add>You can see the result of the above code [here](https://codepen.io/Tlandis/pen/RLvomV). Learn how to combine css classes using selectors [here](https://www.w3schools.com/css/css_combinators.asp).
<ide>
<ide> #### More Information:
<ide> | 1 |
PHP | PHP | improve test case | 73a9935f2073b2218a5f5c1a7d7b4646b8f76970 | <ide><path>tests/TestCase/Console/ShellDispatcherTest.php
<ide> public function testDispatchShellWithIntegerSuccessCode()
<ide>
<ide> $dispatcher->args = ['mock_without_main', 'initdb'];
<ide> $result = $dispatcher->dispatch();
<del> $this->assertEquals(Shell::CODE_SUCCESS, $result);
<add> $this->assertSame(Shell::CODE_SUCCESS, $result);
<ide> }
<ide>
<ide> /**
<ide> public function testDispatchShellWithIntegerSuccessCode()
<ide> */
<ide> public function testDispatchShellWithCustomIntegerCodes()
<ide> {
<add> $customErrorCode = 3;
<add>
<ide> $dispatcher = $this->getMockBuilder('Cake\Console\ShellDispatcher')
<ide> ->setMethods(['findShell'])
<ide> ->getMock();
<ide> public function testDispatchShellWithCustomIntegerCodes()
<ide> $Shell->expects($this->once())->method('initialize');
<ide> $Shell->expects($this->once())->method('runCommand')
<ide> ->with(['initdb'])
<del> ->will($this->returnValue(3));
<add> ->will($this->returnValue($customErrorCode));
<ide>
<ide> $dispatcher->expects($this->any())
<ide> ->method('findShell')
<ide> public function testDispatchShellWithCustomIntegerCodes()
<ide>
<ide> $dispatcher->args = ['mock_without_main', 'initdb'];
<ide> $result = $dispatcher->dispatch();
<del> $this->assertEquals(3, $result);
<add> $this->assertSame($customErrorCode, $result);
<ide> }
<ide>
<ide> /**
<ide> public function testDispatchShellWithoutMain()
<ide>
<ide> $dispatcher->args = ['mock_without_main', 'initdb'];
<ide> $result = $dispatcher->dispatch();
<del> $this->assertEquals(Shell::CODE_SUCCESS, $result);
<add> $this->assertSame(Shell::CODE_SUCCESS, $result);
<ide> }
<ide>
<ide> /**
<ide> public function testDispatchShortPluginAlias()
<ide>
<ide> $dispatcher->args = ['example'];
<ide> $result = $dispatcher->dispatch();
<del> $this->assertEquals(Shell::CODE_SUCCESS, $result);
<add> $this->assertSame(Shell::CODE_SUCCESS, $result);
<ide> }
<ide>
<ide> /**
<ide> public function testDispatchShortPluginAliasCamelized()
<ide>
<ide> $dispatcher->args = ['Example'];
<ide> $result = $dispatcher->dispatch();
<del> $this->assertEquals(Shell::CODE_SUCCESS, $result);
<add> $this->assertSame(Shell::CODE_SUCCESS, $result);
<ide> }
<ide>
<ide> /**
<ide> public function testDispatchShortPluginAliasConflict()
<ide>
<ide> $dispatcher->args = ['sample'];
<ide> $result = $dispatcher->dispatch();
<del> $this->assertEquals(Shell::CODE_SUCCESS, $result);
<add> $this->assertSame(Shell::CODE_SUCCESS, $result);
<ide> }
<ide>
<ide> /** | 1 |
Javascript | Javascript | fix initialization with non routable statemanager | 2d876a6d1b4309a004246d7ec616a5faf93cfb05 | <ide><path>packages/ember-application/lib/system/application.js
<ide> Ember.Application = Ember.Namespace.extend(
<ide>
<ide> this.ready();
<ide>
<del> if (stateManager) {
<add> if (stateManager && stateManager instanceof Ember.Router) {
<ide> this.setupStateManager(stateManager);
<ide> }
<ide> },
<ide><path>packages/ember-application/tests/system/application_test.js
<ide> test("initialize controllers into a state manager", function() {
<ide> equal(getPath(stateManager, 'barController.target'), stateManager, "the state manager is assigned");
<ide> });
<ide>
<del>module("Ember.Application initial route", function() {
<add>test('initialized application go to initial route', function() {
<ide> Ember.run(function() {
<ide> app = Ember.Application.create({
<ide> rootElement: '#qunit-fixture'
<ide> });
<ide>
<del> app.stateManager = Ember.StateManager.create({
<add> app.stateManager = Ember.Router.create({
<ide> location: {
<ide> getURL: function() {
<ide> return '/';
<del> }
<add> },
<add> setURL: function() {},
<add> onUpdateURL: function() {}
<ide> },
<ide>
<ide> start: Ember.State.extend({
<ide> module("Ember.Application initial route", function() {
<ide>
<ide> equal(app.getPath('stateManager.currentState.path'), 'start.index', "The router moved the state into the right place");
<ide> });
<add>
<add>test("initialize application with non routable stateManager", function() {
<add> Ember.run(function() {
<add> app = Ember.Application.create({
<add> rootElement: '#qunit-fixture'
<add> });
<add>
<add> app.stateManager = Ember.StateManager.create({
<add> start: Ember.State.extend()
<add> });
<add> });
<add>
<add> equal(app.getPath('stateManager.currentState.path'), 'start', "Application sucessfuly started");
<add>}); | 2 |
Javascript | Javascript | fix production test compatibility for ie11 | d23d25f4b7770ac713de41e97e6d3e3937adea46 | <ide><path>test/integration/production/test/dynamic.js
<ide> export default (context, render) => {
<ide> const firstElement = await browser.elementById('with-css')
<ide> const css1 = await firstElement.getComputedCss('display')
<ide> expect(css1).toBe('flex')
<del> await browser.eval(() =>
<add> await browser.eval(function () {
<ide> window.next.router.push('/dynamic/pagechange2')
<del> )
<add> })
<ide> await check(() => browser.elementByCss('body').text(), /PageChange2/)
<ide> const secondElement = await browser.elementById('with-css')
<ide> const css2 = await secondElement.getComputedCss('display') | 1 |
Python | Python | remove print statements in tests | 796b2f4c1b49401f7cb490df174fe32f0186bc56 | <ide><path>spacy/tests/regression/test_issue693.py
<ide> def test_issue693(EN):
<ide> doc2 = EN(text2)
<ide> chunks1 = [chunk for chunk in doc1.noun_chunks]
<ide> chunks2 = [chunk for chunk in doc2.noun_chunks]
<del> for word in doc1:
<del> print(word.text, word.dep_, word.head.text)
<ide> assert len(chunks1) == 2
<ide> assert len(chunks2) == 2
<ide><path>spacy/tests/regression/test_issue995.py
<ide> def test_issue955(doc):
<ide> '''Test that we don't have any nested noun chunks'''
<ide> seen_tokens = set()
<ide> for np in doc.noun_chunks:
<del> print(np.text, np.root.text, np.root.dep_, np.root.tag_)
<ide> for word in np:
<ide> key = (word.i, word.text)
<ide> assert key not in seen_tokens | 2 |
Javascript | Javascript | add new line feed | eab88a792b292e214411386aa11a5912980f5240 | <ide><path>src/test/moment/instanceof.js
<ide> test('instanceof', function (assert) {
<ide> assert.equal(NaN instanceof moment, false, 'NaN is not moment object');
<ide> assert.equal(null instanceof moment, false, 'null is not moment object');
<ide> assert.equal(undefined instanceof moment, false, 'undefined is not moment object');
<del>});
<ide>\ No newline at end of file
<add>}); | 1 |
Text | Text | add note about statuscode config for redirects | 571e2a7cff1e5b3ba3898fd8dd67ba29766dff67 | <ide><path>docs/api-reference/next.config.js/redirects.md
<ide> module.exports = {
<ide> },
<ide> }
<ide> ```
<add>
<add>In some rare cases, you might need to assign a custom status code for older HTTP Clients to properly redirect. In these cases, you can use the `statusCode` property instead of the `permanent` property, but not both. Note: to ensure IE11 compatibility a `Refresh` header is automatically added for the 308 status code. | 1 |
PHP | PHP | add emailregex property to cakeemail | 202b753c63703ea513744a060f7a60ae64a0a090 | <ide><path>lib/Cake/Network/Email/CakeEmail.php
<ide> class CakeEmail {
<ide> 'ISO-2022-JP-MS' => 'ISO-2022-JP'
<ide> );
<ide>
<add>/**
<add> * Regex for email validation
<add> * If null, it will use built in regex
<add> *
<add> * @var string
<add> */
<add> protected $_emailRegex = null;
<add>
<ide> /**
<ide> * Constructor
<ide> *
<ide> public function headerCharset($charset = null) {
<ide> return $this->headerCharset = $charset;
<ide> }
<ide>
<add>/**
<add> * EmailRegex setter/getter
<add> *
<add> * @param string $regexp
<add> * @return string|CakeEmail
<add> */
<add> public function emailRegex($regex = false) {
<add> if ($regex === false) {
<add> return $this->_emailRegex;
<add> }
<add> $this->_emailRegex = $regex;
<add> return $this;
<add> }
<add>
<ide> /**
<ide> * Set email
<ide> *
<ide> protected function _applyConfig($config) {
<ide> $simpleMethods = array(
<ide> 'from', 'sender', 'to', 'replyTo', 'readReceipt', 'returnPath', 'cc', 'bcc',
<ide> 'messageId', 'domain', 'subject', 'viewRender', 'viewVars', 'attachments',
<del> 'transport', 'emailFormat', 'theme', 'helpers'
<add> 'transport', 'emailFormat', 'theme', 'helpers', 'emailRegex'
<ide> );
<ide> foreach ($simpleMethods as $method) {
<ide> if (isset($config[$method])) {
<ide> public function reset() {
<ide> $this->headerCharset = null;
<ide> $this->_attachments = array();
<ide> $this->_config = array();
<add> $this->_emailRegex = null;
<ide> return $this;
<ide> }
<ide>
<ide><path>lib/Cake/Test/Case/Network/Email/CakeEmailTest.php
<ide> public function testInvalidEmailAdd($value) {
<ide> $this->CakeEmail->addTo($value);
<ide> }
<ide>
<add>/**
<add> * test emailRegex method
<add> *
<add> * @return void
<add> */
<add> public function testEmailRegex() {
<add> $regex = '/.+@.+\..+/i';
<add> $this->assertNull($this->CakeEmail->emailRegex());
<add> $this->assertSame($regex, $this->CakeEmail->emailRegex($regex)->emailRegex());
<add> }
<add>
<add>/**
<add> * Tests that it is possible to set email regex configuration to a CakeEmail object
<add> *
<add> * @return void
<add> */
<add> public function testConfigEmailRegex() {
<add> $regex = '/.+@.+\..+/i';
<add> $email = new CakeEmail(array('emailRegex' => $regex));
<add> $this->assertSame($regex, $email->emailRegex());
<add> }
<add>
<ide> /**
<ide> * testFormatAddress method
<ide> *
<ide> public function testMessage() {
<ide> public function testReset() {
<ide> $this->CakeEmail->to('cake@cakephp.org');
<ide> $this->CakeEmail->theme('TestTheme');
<add> $this->CakeEmail->emailRegex('/.+@.+\..+/i');
<ide> $this->assertSame($this->CakeEmail->to(), array('cake@cakephp.org' => 'cake@cakephp.org'));
<ide>
<ide> $this->CakeEmail->reset();
<ide> $this->assertSame($this->CakeEmail->to(), array());
<ide> $this->assertSame(null, $this->CakeEmail->theme());
<add> $this->assertSame(null, $this->CakeEmail->emailRegex());
<ide> }
<ide>
<ide> /** | 2 |
Text | Text | fix missing argument for dns.resolveptr() | c0953945a82d01250f27a9f3f07460983fe54a13 | <ide><path>doc/api/dns.md
<ide> Uses the DNS protocol to resolve name server records (`NS` records) for the
<ide> contain an array of name server records available for `hostname`
<ide> (e.g. `['ns1.example.com', 'ns2.example.com']`).
<ide>
<del>## dns.resolvePtr(hostname)
<add>## dns.resolvePtr(hostname, callback)
<ide> <!-- YAML
<ide> added: v6.0.0
<ide> --> | 1 |
Text | Text | update index.md minor changes | f996db7a524088ce6f0264e7ca4ba639e481eaf4 | <ide><path>guide/portuguese/c/arrays/index.md
<ide> localeTitle: Matrizes
<ide>
<ide> ## Problemas
<ide>
<del>Antes de tentar explicar quais são os arrays, vamos ver o código onde queremos imprimir 10 números dados pelo usuário na ordem inversa.
<add>Antes de tentar explicar quais são os arrays(vetores), vamos ver o código onde queremos imprimir 10 números dados pelo usuário na ordem inversa.
<ide>
<ide> ```C
<ide> #include <stdio.h>
<ide> Então, isso parece um pouco entediante. Até agora, todas as variáveis c
<ide>
<ide> ## Matrizes em C
<ide>
<del>Matrizes são contêineres com um determinado tamanho. Eles contêm variáveis do **mesmo tipo** . Você pode acessar uma variável armazenada na matriz com seu _índice_ . Vamos ver um código:
<add>Matrizes são contêineres com um determinado tamanho. Eles contêm variáveis do **mesmo tipo** . Você pode acessar uma variável armazenada na matriz com seu _índice_ . Uma matriz pode ser considerada um array de arrays. Vamos ver um código:
<ide>
<ide> ```C
<ide> #include <stdio.h>
<ide> int test[6];
<ide>
<ide> A razão para o C não verificar o limite de indexação é simples: C é uma linguagem eficiente. Foi feito, então o seu programa é o mais rápido: comunica-se bem com o hardware, etc. Um código C bem escrito não contém erros de indexação, então por que C iria querer verificar enquanto estava rodando?
<ide>
<del>* Quando você tenta acessar o último elemento da matriz. Suponha que o comprimento da matriz A seja 4 e ao acessar o último elemento como Um \[4\] retornará um erro, pois a indexação começa em 0.
<ide>\ No newline at end of file
<add>* Quando você tenta acessar o último elemento da matriz. Suponha que o comprimento da matriz A seja 4 e ao acessar o último elemento como Um \[4\] retornará um erro, pois a indexação começa em 0. | 1 |
Go | Go | use v2 capabilities in layer archives | 95eb4907805b0c8650cc1bce01844162c2c84c4a | <ide><path>integration/build/build_userns_linux_test.go
<ide> func TestBuildUserNamespaceValidateCapabilitiesAreV2(t *testing.T) {
<ide> _, err = stdcopy.StdCopy(actualStdout, actualStderr, logReader)
<ide> assert.NilError(t, err)
<ide> if strings.TrimSpace(actualStdout.String()) != "/bin/sleep cap_net_bind_service=eip" {
<del> // Activate when fix is merged: https://github.com/moby/moby/pull/41724
<del> //t.Fatalf("run produced invalid output: %q, expected %q", actualStdout.String(), "/bin/sleep cap_net_bind_service=eip")
<del> // t.Logf("run produced invalid output (expected until #41724 merges): %q, expected %q",
<del> // actualStdout.String(),
<del> // "/bin/sleep cap_net_bind_service=eip")
<del> } else {
<del> // Shouldn't happen until fix is merged: https://github.com/moby/moby/pull/41724
<del> t.Fatalf("run produced valid output (unexpected until #41724 merges): %q, expected %q",
<del> actualStdout.String(),
<del> "/bin/sleep cap_net_bind_service=eip")
<add> t.Fatalf("run produced invalid output: %q, expected %q", actualStdout.String(), "/bin/sleep cap_net_bind_service=eip")
<ide> }
<ide> }
<ide><path>pkg/archive/archive.go
<ide> func fillGo18FileTypeBits(mode int64, fi os.FileInfo) int64 {
<ide> // ReadSecurityXattrToTarHeader reads security.capability xattr from filesystem
<ide> // to a tar header
<ide> func ReadSecurityXattrToTarHeader(path string, hdr *tar.Header) error {
<add> const (
<add> // Values based on linux/include/uapi/linux/capability.h
<add> xattrCapsSz2 = 20
<add> versionOffset = 3
<add> vfsCapRevision2 = 2
<add> vfsCapRevision3 = 3
<add> )
<ide> capability, _ := system.Lgetxattr(path, "security.capability")
<ide> if capability != nil {
<add> length := len(capability)
<add> if capability[versionOffset] == vfsCapRevision3 {
<add> // Convert VFS_CAP_REVISION_3 to VFS_CAP_REVISION_2 as root UID makes no
<add> // sense outside the user namespace the archive is built in.
<add> capability[versionOffset] = vfsCapRevision2
<add> length = xattrCapsSz2
<add> }
<ide> hdr.Xattrs = make(map[string]string)
<del> hdr.Xattrs["security.capability"] = string(capability)
<add> hdr.Xattrs["security.capability"] = string(capability[:length])
<ide> }
<ide> return nil
<ide> } | 2 |
Ruby | Ruby | use the provided block to filter lists | 8b9733d7358f22409c86f8849faabab7f5c53881 | <ide><path>railties/lib/rails/paths.rb
<ide> def load_paths
<ide>
<ide> protected
<ide>
<del> def filter_by
<del> all = []
<del> all_paths.each do |path|
<del> if yield(path)
<del> paths = path.existent
<del> paths -= path.children.map { |p| yield(p) ? [] : p.existent }.flatten
<del> all.concat(paths)
<del> end
<del> end
<del> all.uniq!
<del> all
<add> def filter_by(&block)
<add> all_paths.find_all(&block).flat_map { |path|
<add> paths = path.existent
<add> paths - path.children.map { |p| yield(p) ? [] : p.existent }.flatten
<add> }.uniq
<ide> end
<ide> end
<ide> | 1 |
PHP | PHP | simplify mocking assertions. | 5164e0e83ab7d580124c9b777f12c88d6c5ced06 | <ide><path>tests/Database/DatabaseConnectorTest.php
<ide> public function testPostgresSearchPathCommaSeparatedValueSupported()
<ide> $config = ['host' => 'foo', 'database' => 'bar', 'search_path' => 'public, "user"', 'charset' => 'utf8'];
<ide> $connector = $this->getMockBuilder('Illuminate\Database\Connectors\PostgresConnector')->setMethods(['createConnection', 'getOptions'])->getMock();
<ide> $connection = m::mock('stdClass');
<del> $connector->expects($this->once())->method('getOptions')->with($this->equalTo($config))->will($this->returnValue(['options']));
<del> $connector->expects($this->once())->method('createConnection')->with($this->equalTo($dsn), $this->equalTo($config), $this->equalTo(['options']))->will($this->returnValue($connection));
<add> $connector->expects($this->once())->method('getOptions')->with($this->equalTo($config))->willReturn(['options']);
<add> $connector->expects($this->once())->method('createConnection')->with($this->equalTo($dsn), $this->equalTo($config), $this->equalTo(['options']))->willReturn($connection);
<ide> $connection->shouldReceive('prepare')->once()->with('set names \'utf8\'')->andReturn($connection);
<ide> $connection->shouldReceive('prepare')->once()->with('set search_path to "public", "user"')->andReturn($connection);
<ide> $connection->shouldReceive('execute')->twice();
<ide> public function testPostgresSearchPathVariablesSupported()
<ide> $config = ['host' => 'foo', 'database' => 'bar', 'search_path' => '"$user", public, user', 'charset' => 'utf8'];
<ide> $connector = $this->getMockBuilder('Illuminate\Database\Connectors\PostgresConnector')->setMethods(['createConnection', 'getOptions'])->getMock();
<ide> $connection = m::mock('stdClass');
<del> $connector->expects($this->once())->method('getOptions')->with($this->equalTo($config))->will($this->returnValue(['options']));
<del> $connector->expects($this->once())->method('createConnection')->with($this->equalTo($dsn), $this->equalTo($config), $this->equalTo(['options']))->will($this->returnValue($connection));
<add> $connector->expects($this->once())->method('getOptions')->with($this->equalTo($config))->willReturn(['options']);
<add> $connector->expects($this->once())->method('createConnection')->with($this->equalTo($dsn), $this->equalTo($config), $this->equalTo(['options']))->willReturn($connection);
<ide> $connection->shouldReceive('prepare')->once()->with('set names \'utf8\'')->andReturn($connection);
<ide> $connection->shouldReceive('prepare')->once()->with('set search_path to "$user", "public", "user"')->andReturn($connection);
<ide> $connection->shouldReceive('execute')->twice();
<ide><path>tests/Foundation/Testing/DatabaseMigrationsTest.php
<ide> private function __reflectAndSetupAccessibleForProtectedTraitMethod($methodName)
<ide> public function testRefreshTestDatabaseDefault()
<ide> {
<ide> $this->traitObject
<del> ->expects($this->exactly(1))
<add> ->expects($this->once())
<ide> ->method('artisan')
<ide> ->with('migrate:fresh', [
<ide> '--drop-views' => false,
<ide> public function testRefreshTestDatabaseWithDropViewsOption()
<ide> $this->traitObject->dropViews = true;
<ide>
<ide> $this->traitObject
<del> ->expects($this->exactly(1))
<add> ->expects($this->once())
<ide> ->method('artisan')
<ide> ->with('migrate:fresh', [
<ide> '--drop-views' => true,
<ide> public function testRefreshTestDatabaseWithDropTypesOption()
<ide> $this->traitObject->dropTypes = true;
<ide>
<ide> $this->traitObject
<del> ->expects($this->exactly(1))
<add> ->expects($this->once())
<ide> ->method('artisan')
<ide> ->with('migrate:fresh', [
<ide> '--drop-views' => false,
<ide><path>tests/Foundation/Testing/RefreshDatabaseTest.php
<ide> private function __reflectAndSetupAccessibleForProtectedTraitMethod($methodName)
<ide> public function testRefreshTestDatabaseDefault()
<ide> {
<ide> $this->traitObject
<del> ->expects($this->exactly(1))
<add> ->expects($this->once())
<ide> ->method('artisan')
<ide> ->with('migrate:fresh', [
<ide> '--drop-views' => false,
<ide> public function testRefreshTestDatabaseWithDropViewsOption()
<ide> $this->traitObject->dropViews = true;
<ide>
<ide> $this->traitObject
<del> ->expects($this->exactly(1))
<add> ->expects($this->once())
<ide> ->method('artisan')
<ide> ->with('migrate:fresh', [
<ide> '--drop-views' => true,
<ide> public function testRefreshTestDatabaseWithDropTypesOption()
<ide> $this->traitObject->dropTypes = true;
<ide>
<ide> $this->traitObject
<del> ->expects($this->exactly(1))
<add> ->expects($this->once())
<ide> ->method('artisan')
<ide> ->with('migrate:fresh', [
<ide> '--drop-views' => false,
<ide><path>tests/Support/SupportNamespacedItemResolverTest.php
<ide> public function testParsedItemsAreCached()
<ide> public function testParsedItemsMayBeFlushed()
<ide> {
<ide> $r = $this->getMockBuilder(NamespacedItemResolver::class)->onlyMethods(['parseBasicSegments', 'parseNamespacedSegments'])->getMock();
<del> $r->expects($this->once())->method('parseBasicSegments')->will(
<del> $this->returnValue(['bar'])
<del> );
<add> $r->expects($this->once())->method('parseBasicSegments')->willReturn(['bar']);
<ide>
<ide> $r->setParsedKey('foo.bar', ['foo']);
<ide> $r->flushParsedKeys(); | 4 |
Ruby | Ruby | expand `formulary` test coverage | dd516e4355f6a22f21cc8cc15546162c3df57473 | <ide><path>Library/Homebrew/test/formulary_spec.rb
<ide> def install
<ide> end
<ide> RUBY
<ide> end
<del> let(:formula_json_contents) do
<del> {
<del> formula_name => {
<del> "desc" => "testball",
<del> "homepage" => "https://example.com",
<del> "license" => "MIT",
<del> "revision" => 0,
<del> "version_scheme" => 0,
<del> "versions" => { "stable" => "0.1" },
<del> "urls" => {
<del> "stable" => {
<del> "url" => "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz",
<del> "tag" => nil,
<del> "revision" => nil,
<del> },
<del> },
<del> "bottle" => {
<del> "stable" => {
<del> "rebuild" => 0,
<del> "root_url" => "file://#{bottle_dir}",
<del> "files" => {
<del> Utils::Bottles.tag.to_s => {
<del> "cellar" => ":any",
<del> "url" => "file://#{bottle_dir}/#{formula_name}",
<del> "sha256" => "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149",
<del> },
<del> },
<del> },
<del> },
<del> "build_dependencies" => [],
<del> "dependencies" => [],
<del> "recommended_dependencies" => [],
<del> "optional_dependencies" => [],
<del> "uses_from_macos" => [],
<del> "caveats" => "",
<del> },
<del> }
<del> end
<ide> let(:bottle_dir) { Pathname.new("#{TEST_FIXTURE_DIR}/bottles") }
<ide> let(:bottle) { bottle_dir/"testball_bottle-0.1.#{Utils::Bottles.tag}.bottle.tar.gz" }
<ide>
<ide> class Wrong#{described_class.class_s(formula_name)} < Formula
<ide> end
<ide>
<ide> context "when loading from the API" do
<add> def formula_json_contents(extra_items = {})
<add> {
<add> formula_name => {
<add> "desc" => "testball",
<add> "homepage" => "https://example.com",
<add> "license" => "MIT",
<add> "revision" => 0,
<add> "version_scheme" => 0,
<add> "versions" => { "stable" => "0.1" },
<add> "urls" => {
<add> "stable" => {
<add> "url" => "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz",
<add> "tag" => nil,
<add> "revision" => nil,
<add> },
<add> },
<add> "bottle" => {
<add> "stable" => {
<add> "rebuild" => 0,
<add> "root_url" => "file://#{bottle_dir}",
<add> "files" => {
<add> Utils::Bottles.tag.to_s => {
<add> "cellar" => ":any",
<add> "url" => "file://#{bottle_dir}/#{formula_name}",
<add> "sha256" => "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149",
<add> },
<add> },
<add> },
<add> },
<add> "keg_only_reason" => {
<add> "reason" => ":provided_by_macos",
<add> "explanation" => "",
<add> },
<add> "build_dependencies" => [],
<add> "dependencies" => [],
<add> "recommended_dependencies" => [],
<add> "optional_dependencies" => [],
<add> "uses_from_macos" => [],
<add> "caveats" => "",
<add> }.merge(extra_items),
<add> }
<add> end
<add>
<add> let(:deprecate_json) do
<add> {
<add> "deprecation_date" => "2022-06-15",
<add> "deprecation_reason" => "repo_archived",
<add> }
<add> end
<add>
<add> let(:disable_json) do
<add> {
<add> "disable_date" => "2022-06-15",
<add> "disable_reason" => "repo_archived",
<add> }
<add> end
<add>
<ide> before do
<ide> allow(described_class).to receive(:loader_for).and_return(described_class::FormulaAPILoader.new(formula_name))
<del> allow(Homebrew::API::Formula).to receive(:all_formulae).and_return formula_json_contents
<ide> end
<ide>
<ide> it "returns a Formula when given a name" do
<add> allow(Homebrew::API::Formula).to receive(:all_formulae).and_return formula_json_contents
<add>
<add> formula = described_class.factory(formula_name)
<add> expect(formula).to be_kind_of(Formula)
<add> expect(formula.keg_only_reason.reason).to eq :provided_by_macos
<add> expect {
<add> formula.install
<add> }.to raise_error("Cannot build from source from abstract formula.")
<add> end
<add>
<add> it "returns a deprecated Formula when given a name" do
<add> allow(Homebrew::API::Formula).to receive(:all_formulae).and_return formula_json_contents(deprecate_json)
<add>
<add> formula = described_class.factory(formula_name)
<add> expect(formula).to be_kind_of(Formula)
<add> expect(formula.deprecated?).to be true
<add> expect {
<add> formula.install
<add> }.to raise_error("Cannot build from source from abstract formula.")
<add> end
<add>
<add> it "returns a disabled Formula when given a name" do
<add> allow(Homebrew::API::Formula).to receive(:all_formulae).and_return formula_json_contents(disable_json)
<add>
<ide> formula = described_class.factory(formula_name)
<ide> expect(formula).to be_kind_of(Formula)
<add> expect(formula.disabled?).to be true
<ide> expect {
<ide> formula.install
<ide> }.to raise_error("Cannot build from source from abstract formula.") | 1 |
Text | Text | clarify version map | 60a86747bbb41ad23cf29f2237e92d1de1049f09 | <ide><path>README.md
<ide> a starting point. For existing applications you can run the following:
<ide> $ composer require cakephp/cakephp
<ide> ```
<ide>
<add>For details on the (minimum/maximum) PHP version see [version map](https://github.com/cakephp/cakephp/wiki#version-map).
<add>
<ide> ## Running Tests
<ide>
<ide> Assuming you have PHPUnit installed system wide using one of the methods stated | 1 |
Javascript | Javascript | implement .setgrammar in terms of .setlanguagemode | d1468fddd9276925ab6602c59b529b4a6db5c9d4 | <ide><path>src/text-editor.js
<ide> class TextEditor {
<ide> //
<ide> // * `grammar` {Grammar}
<ide> setGrammar (grammar) {
<del> atom.grammars.assignLanguageMode(this.getBuffer(), grammar.name)
<add> const buffer = this.getBuffer()
<add> buffer.setLanguageMode(atom.grammars.languageModeForGrammarAndBuffer(grammar, buffer))
<ide> }
<ide>
<ide> // Experimental: Get a notification when async tokenization is completed. | 1 |
Python | Python | stack outputs instead of concat outputs | a9e998216fd08210ae566fefcb149576825ee5e8 | <ide><path>tutorials/rnn/ptb/ptb_word_lm.py
<ide> def attn_cell():
<ide> (cell_output, state) = cell(inputs[:, time_step, :], state)
<ide> outputs.append(cell_output)
<ide>
<del> output = tf.reshape(tf.concat(axis=1, values=outputs), [-1, size])
<add> output = tf.reshape(tf.stack(axis=1, values=outputs), [-1, size])
<ide> softmax_w = tf.get_variable(
<ide> "softmax_w", [size, vocab_size], dtype=data_type())
<ide> softmax_b = tf.get_variable("softmax_b", [vocab_size], dtype=data_type()) | 1 |
Go | Go | add class to repository scope | a12b466183e03621bc9e1c1e4deab6db8ec93f0a | <ide><path>distribution/errors.go
<ide> func shouldV2Fallback(err errcode.Error) bool {
<ide> return false
<ide> }
<ide>
<del>func translatePullError(err error, ref reference.Named) error {
<add>// TranslatePullError is used to convert an error from a registry pull
<add>// operation to an error representing the entire pull operation. Any error
<add>// information which is not used by the returned error gets output to
<add>// log at info level.
<add>func TranslatePullError(err error, ref reference.Named) error {
<ide> switch v := err.(type) {
<ide> case errcode.Errors:
<ide> if len(v) != 0 {
<ide> for _, extra := range v[1:] {
<ide> logrus.Infof("Ignoring extra error returned from registry: %v", extra)
<ide> }
<del> return translatePullError(v[0], ref)
<add> return TranslatePullError(v[0], ref)
<ide> }
<ide> case errcode.Error:
<ide> var newErr error
<ide> switch v.Code {
<ide> case errcode.ErrorCodeDenied:
<ide> // ErrorCodeDenied is used when access to the repository was denied
<del> newErr = errors.Errorf("repository %s not found: does not exist or no read access", ref.Name())
<add> newErr = errors.Errorf("repository %s not found: does not exist or no pull access", ref.Name())
<ide> case v2.ErrorCodeManifestUnknown:
<ide> newErr = errors.Errorf("manifest for %s not found", ref.String())
<ide> case v2.ErrorCodeNameUnknown:
<ide> func translatePullError(err error, ref reference.Named) error {
<ide> return newErr
<ide> }
<ide> case xfer.DoNotRetry:
<del> return translatePullError(v.Err, ref)
<add> return TranslatePullError(v.Err, ref)
<ide> }
<ide>
<ide> return err
<ide><path>distribution/pull.go
<ide> func Pull(ctx context.Context, ref reference.Named, imagePullConfig *ImagePullCo
<ide> continue
<ide> }
<ide> logrus.Errorf("Not continuing with pull after error: %v", err)
<del> return translatePullError(err, ref)
<add> return TranslatePullError(err, ref)
<ide> }
<ide>
<ide> imagePullConfig.ImageEventLogger(ref.String(), repoInfo.Name(), "pull")
<ide> func Pull(ctx context.Context, ref reference.Named, imagePullConfig *ImagePullCo
<ide> lastErr = fmt.Errorf("no endpoints found for %s", ref.String())
<ide> }
<ide>
<del> return translatePullError(lastErr, ref)
<add> return TranslatePullError(lastErr, ref)
<ide> }
<ide>
<ide> // writeStatus writes a status message to out. If layersDownloaded is true, the
<ide><path>distribution/registry.go
<ide> func NewV2Repository(ctx context.Context, repoInfo *registry.RepositoryInfo, end
<ide> passThruTokenHandler := &existingTokenHandler{token: authConfig.RegistryToken}
<ide> modifiers = append(modifiers, auth.NewAuthorizer(challengeManager, passThruTokenHandler))
<ide> } else {
<add> scope := auth.RepositoryScope{
<add> Repository: repoName,
<add> Actions: actions,
<add> }
<add>
<add> // Keep image repositories blank for scope compatibility
<add> if repoInfo.Class != "image" {
<add> scope.Class = repoInfo.Class
<add> }
<add>
<ide> creds := registry.NewStaticCredentialStore(authConfig)
<ide> tokenHandlerOptions := auth.TokenHandlerOptions{
<ide> Transport: authTransport,
<ide> Credentials: creds,
<del> Scopes: []auth.Scope{
<del> auth.RepositoryScope{
<del> Repository: repoName,
<del> Actions: actions,
<del> },
<del> },
<del> ClientID: registry.AuthClientID,
<add> Scopes: []auth.Scope{scope},
<add> ClientID: registry.AuthClientID,
<ide> }
<ide> tokenHandler := auth.NewTokenHandlerWithOptions(tokenHandlerOptions)
<ide> basicHandler := auth.NewBasicHandler(creds)
<ide><path>integration-cli/docker_cli_pull_test.go
<ide> func (s *DockerHubPullSuite) TestPullNonExistingImage(c *check.C) {
<ide> for record := range recordChan {
<ide> if len(record.option) == 0 {
<ide> c.Assert(record.err, checker.NotNil, check.Commentf("expected non-zero exit status when pulling non-existing image: %s", record.out))
<del> c.Assert(record.out, checker.Contains, fmt.Sprintf("repository %s not found: does not exist or no read access", record.e.repo), check.Commentf("expected image not found error messages"))
<add> c.Assert(record.out, checker.Contains, fmt.Sprintf("repository %s not found: does not exist or no pull access", record.e.repo), check.Commentf("expected image not found error messages"))
<ide> } else {
<ide> // pull -a on a nonexistent registry should fall back as well
<ide> c.Assert(record.err, checker.NotNil, check.Commentf("expected non-zero exit status when pulling non-existing image: %s", record.out))
<ide><path>plugin/distribution/pull.go
<ide> func Pull(ref reference.Named, rs registry.Service, metaheader http.Header, auth
<ide> logrus.Debugf("pull.go: error in ResolveRepository: %v", err)
<ide> return nil, err
<ide> }
<add> repoInfo.Class = "plugin"
<ide>
<ide> if err := dockerdist.ValidateRepoName(repoInfo.Name()); err != nil {
<ide> logrus.Debugf("pull.go: error in ValidateRepoName: %v", err)
<ide> func Pull(ref reference.Named, rs registry.Service, metaheader http.Header, auth
<ide> }
<ide> manifest, err := msv.Get(context.Background(), "", distribution.WithTag(tag))
<ide> if err != nil {
<del> // TODO: change 401 to 404
<ide> logrus.Debugf("pull.go: error in msv.Get(): %v", err)
<del> return nil, err
<add> return nil, dockerdist.TranslatePullError(err, repoInfo)
<ide> }
<ide>
<ide> _, pl, err := manifest.Payload()
<ide><path>plugin/distribution/push.go
<ide> func Push(name string, rs registry.Service, metaHeader http.Header, authConfig *
<ide> if err != nil {
<ide> return "", err
<ide> }
<add> repoInfo.Class = "plugin"
<ide>
<ide> if err := dockerdist.ValidateRepoName(repoInfo.Name()); err != nil {
<ide> return "", err
<ide><path>registry/config.go
<ide> func newRepositoryInfo(config *serviceConfig, name reference.Named) (*Repository
<ide> return nil, err
<ide> }
<ide> official := !strings.ContainsRune(name.Name(), '/')
<del> return &RepositoryInfo{name, index, official}, nil
<add> return &RepositoryInfo{
<add> Named: name,
<add> Index: index,
<add> Official: official,
<add> }, nil
<ide> }
<ide>
<ide> // ParseRepositoryInfo performs the breakdown of a repository name into a RepositoryInfo, but
<ide><path>registry/types.go
<ide> type RepositoryInfo struct {
<ide> // If the registry is official, and the normalized name does not
<ide> // contain a '/' (e.g. "foo"), then it is considered an official repo.
<ide> Official bool
<add> // Class represents the class of the repository, such as "plugin"
<add> // or "image".
<add> Class string
<ide> } | 8 |
Ruby | Ruby | move pk initialization logic onto `attributeset` | b79593f84d0bc601a49e9f7470e862251b7bc145 | <ide><path>activerecord/lib/active_record/attribute_set.rb
<ide> def initialize_clone(_)
<ide> super
<ide> end
<ide>
<add> def ensure_initialized(key)
<add> unless self[key].initialized?
<add> write_from_database(key, nil)
<add> end
<add> end
<add>
<ide> protected
<ide>
<ide> attr_reader :attributes
<ide><path>activerecord/lib/active_record/core.rb
<ide> def to_ary # :nodoc:
<ide> end
<ide>
<ide> def init_internals
<del> pk = self.class.primary_key
<del> if pk && !@attributes.include?(pk)
<del> @attributes.write_from_database(pk, nil)
<del> end
<add> @attributes.ensure_initialized(self.class.primary_key)
<ide>
<ide> @aggregation_cache = {}
<ide> @association_cache = {} | 2 |
Text | Text | update message to match actual output | 50bbc4e4039110b7429c182623cbfee4b35993d5 | <ide><path>doc/api/debugger.md
<ide> break in myscript.js:4
<ide> 5 }, 1000);
<ide> 6 console.log('hello');
<ide> debug> repl
<del>Press Ctrl + C to leave debug repl
<add>Press Ctrl+C to leave debug repl
<ide> > x
<ide> 5
<ide> > 2 + 2 | 1 |
Javascript | Javascript | move stackedsetmap into separate file | 25805470c1688676b7a8416bfa6eccf631c700a8 | <ide><path>lib/Parser.js
<ide>
<ide> // Syntax: https://developer.mozilla.org/en/SpiderMonkey/Parser_API
<ide>
<del>const util = require("util");
<ide> const acorn = require("acorn-dynamic-import").default;
<ide> const Tapable = require("tapable");
<ide> const json5 = require("json5");
<ide> const BasicEvaluatedExpression = require("./BasicEvaluatedExpression");
<add>const StackedSetMap = require("./util/StackedSetMap");
<ide>
<ide> function joinRanges(startRange, endRange) {
<ide> if(!endRange) return startRange;
<ide> const POSSIBLE_AST_OPTIONS = [{
<ide> }
<ide> }];
<ide>
<del>class StackedSetMap {
<del> constructor(defaultValue, parentStack) {
<del> this.defaultValue = defaultValue;
<del> this.stack = parentStack === undefined ? [] : parentStack.slice();
<del> this.map = new Map();
<del> this.stack.push(this.map);
<del> }
<del>
<del> add(item) {
<del> this.map.set(item, true);
<del> }
<del>
<del> set(item, value) {
<del> this.map.set(item, value);
<del> }
<del>
<del> delete(item) {
<del> this.map.set(item, false);
<del> }
<del>
<del> has(item) {
<del> return this.get(item, false);
<del> }
<del>
<del> get(item) {
<del> const topValue = this.map.get(item);
<del> if(typeof topValue !== "undefined")
<del> return topValue;
<del> for(var i = this.stack.length - 2; i >= 0; i--) {
<del> const value = this.stack[i].get(item);
<del> if(typeof value !== "undefined") {
<del> this.map.set(item, value);
<del> return value;
<del> }
<del> }
<del> this.map.set(item, this.defaultValue);
<del> return this.defaultValue;
<del> }
<del>
<del> _compress() {
<del> this.map = new Map();
<del> for(const data of this.stack) {
<del> for(const pair of data) {
<del> this.map.set(pair[0], pair[1]);
<del> }
<del> }
<del> this.stack = [this.map];
<del> }
<del>
<del> asSet() {
<del> this._compress();
<del> return new Set(Array.from(this.map.entries()).filter(pair => pair[1]).map(pair => pair[0]));
<del> }
<del>
<del> createChild() {
<del> return new StackedSetMap(this.defaultValue, this.stack);
<del> }
<del>
<del> get length() {
<del> throw new Error("Parser.definitions is no longer an Array");
<del> }
<del>
<del> set length(value) {
<del> throw new Error("Parser.definitions is no longer an Array");
<del> }
<del>}
<del>
<del>StackedSetMap.prototype.push = util.deprecate(function(item) {
<del> this.add(item);
<del>}, "Parser.definitions is no longer an Array: Use add instead.");
<del>
<ide> class TrackingSet {
<ide> constructor(set) {
<ide> this.set = set;
<ide><path>lib/util/StackedSetMap.js
<add>/*
<add> MIT License http://www.opensource.org/licenses/mit-license.php
<add> Author Tobias Koppers @sokra
<add>*/
<add>"use strict";
<add>
<add>const util = require("util");
<add>
<add>class StackedSetMap {
<add> constructor(defaultValue, parentStack) {
<add> this.defaultValue = defaultValue;
<add> this.stack = parentStack === undefined ? [] : parentStack.slice();
<add> this.map = new Map();
<add> this.stack.push(this.map);
<add> }
<add>
<add> add(item) {
<add> this.map.set(item, true);
<add> }
<add>
<add> set(item, value) {
<add> this.map.set(item, value);
<add> }
<add>
<add> delete(item) {
<add> this.map.set(item, false);
<add> }
<add>
<add> has(item) {
<add> return this.get(item, false);
<add> }
<add>
<add> get(item) {
<add> const topValue = this.map.get(item);
<add> if(typeof topValue !== "undefined")
<add> return topValue;
<add> for(var i = this.stack.length - 2; i >= 0; i--) {
<add> const value = this.stack[i].get(item);
<add> if(typeof value !== "undefined") {
<add> this.map.set(item, value);
<add> return value;
<add> }
<add> }
<add> this.map.set(item, this.defaultValue);
<add> return this.defaultValue;
<add> }
<add>
<add> _compress() {
<add> this.map = new Map();
<add> for(const data of this.stack) {
<add> for(const pair of data) {
<add> this.map.set(pair[0], pair[1]);
<add> }
<add> }
<add> this.stack = [this.map];
<add> }
<add>
<add> asSet() {
<add> this._compress();
<add> return new Set(Array.from(this.map.entries()).filter(pair => pair[1]).map(pair => pair[0]));
<add> }
<add>
<add> createChild() {
<add> return new StackedSetMap(this.defaultValue, this.stack);
<add> }
<add>
<add> get length() {
<add> throw new Error("This is no longer an Array");
<add> }
<add>
<add> set length(value) {
<add> throw new Error("This is no longer an Array");
<add> }
<add>}
<add>
<add>StackedSetMap.prototype.push = util.deprecate(function(item) {
<add> this.add(item);
<add>}, "This is no longer an Array: Use add instead.");
<add>
<add>module.exports = StackedSetMap; | 2 |
Go | Go | make resolvescopedpath a free fn | a7c8fdc55bb30f9aeabf58a9865e0d40b52ca18c | <ide><path>builder/dockerfile/copy.go
<ide> type copyInfo struct {
<ide> }
<ide>
<ide> func (c copyInfo) fullPath() (string, error) {
<del> return c.root.ResolveScopedPath(c.path, true)
<add> return containerfs.ResolveScopedPath(c.root.Path(), c.path)
<ide> }
<ide>
<ide> func newCopyInfoFromSource(source builder.Source, path string, hash string) copyInfo {
<ide><path>builder/remotecontext/archive.go
<ide> func (c *archiveContext) Hash(path string) (string, error) {
<ide>
<ide> func normalize(path string, root containerfs.ContainerFS) (cleanPath, fullPath string, err error) {
<ide> cleanPath = root.Clean(string(root.Separator()) + path)[1:]
<del> fullPath, err = root.ResolveScopedPath(path, true)
<add> fullPath, err = containerfs.ResolveScopedPath(root.Path(), path)
<ide> if err != nil {
<ide> return "", "", errors.Wrapf(err, "forbidden path outside the build context: %s (%s)", path, cleanPath)
<ide> }
<ide><path>builder/remotecontext/detect.go
<ide> import (
<ide> "github.com/docker/docker/builder"
<ide> "github.com/docker/docker/builder/remotecontext/urlutil"
<ide> "github.com/docker/docker/errdefs"
<add> "github.com/docker/docker/pkg/containerfs"
<ide> "github.com/docker/docker/pkg/fileutils"
<ide> "github.com/moby/buildkit/frontend/dockerfile/dockerignore"
<ide> "github.com/moby/buildkit/frontend/dockerfile/parser"
<ide> func StatAt(remote builder.Source, path string) (os.FileInfo, error) {
<ide>
<ide> // FullPath is a helper for getting a full path for a path from a source
<ide> func FullPath(remote builder.Source, path string) (string, error) {
<del> fullPath, err := remote.Root().ResolveScopedPath(path, true)
<add> fullPath, err := containerfs.ResolveScopedPath(remote.Root().Path(), path)
<ide> if err != nil {
<ide> if runtime.GOOS == "windows" {
<ide> return "", fmt.Errorf("failed to resolve scoped path %s (%s): %s. Possible cause is a forbidden path outside the build context", path, fullPath, err)
<ide><path>container/container.go
<ide> func (container *Container) GetResourcePath(path string) (string, error) {
<ide> }
<ide> // IMPORTANT - These are paths on the OS where the daemon is running, hence
<ide> // any filepath operations must be done in an OS agnostic way.
<del> r, e := container.BaseFS.ResolveScopedPath(path, false)
<add> r, e := containerfs.ResolveScopedPath(container.BaseFS.Path(), containerfs.CleanScopedPath(path))
<ide>
<ide> // Log this here on the daemon side as there's otherwise no indication apart
<ide> // from the error being propagated all the way back to the client. This makes
<ide><path>pkg/containerfs/containerfs.go
<ide> type ContainerFS interface {
<ide> // on the local system, so the continuity operations must be used
<ide> Path() string
<ide>
<del> // ResolveScopedPath evaluates the given path scoped to the root.
<del> // For example, if root=/a, and path=/b/c, then this function would return /a/b/c.
<del> // If rawPath is true, then the function will not preform any modifications
<del> // before path resolution. Otherwise, the function will clean the given path
<del> // by making it an absolute path.
<del> ResolveScopedPath(path string, rawPath bool) (string, error)
<del>
<ide> Driver
<ide> }
<ide>
<ide> func (l *local) Path() string {
<ide> return l.path
<ide> }
<ide>
<del>func (l *local) ResolveScopedPath(path string, rawPath bool) (string, error) {
<del> cleanedPath := path
<del> if !rawPath {
<del> cleanedPath = cleanScopedPath(path)
<del> }
<del> return symlink.FollowSymlinkInScope(filepath.Join(l.path, cleanedPath), l.path)
<add>// ResolveScopedPath evaluates the given path scoped to the root.
<add>// For example, if root=/a, and path=/b/c, then this function would return /a/b/c.
<add>func ResolveScopedPath(root, path string) (string, error) {
<add> return symlink.FollowSymlinkInScope(filepath.Join(root, path), root)
<ide> }
<ide><path>pkg/containerfs/containerfs_unix.go
<ide> package containerfs // import "github.com/docker/docker/pkg/containerfs"
<ide>
<ide> import "path/filepath"
<ide>
<del>// cleanScopedPath preappends a to combine with a mnt path.
<del>func cleanScopedPath(path string) string {
<add>// CleanScopedPath preappends a to combine with a mnt path.
<add>func CleanScopedPath(path string) string {
<ide> return filepath.Join(string(filepath.Separator), path)
<ide> }
<ide><path>pkg/containerfs/containerfs_windows.go
<ide> package containerfs // import "github.com/docker/docker/pkg/containerfs"
<ide>
<ide> import "path/filepath"
<ide>
<del>// cleanScopedPath removes the C:\ syntax, and prepares to combine
<add>// CleanScopedPath removes the C:\ syntax, and prepares to combine
<ide> // with a volume path
<del>func cleanScopedPath(path string) string {
<add>func CleanScopedPath(path string) string {
<ide> if len(path) >= 2 {
<ide> c := path[0]
<ide> if path[1] == ':' && ('a' <= c && c <= 'z' || 'A' <= c && c <= 'Z') { | 7 |
Text | Text | improve clarity in deprecate/disable/removal docs | 5784e36ead31f94e46b102323d05ef20b841a0f5 | <ide><path>docs/Deprecating-Disabling-and-Removing-Formulae.md
<ide> This general rule of thumb can be followed:
<ide>
<ide> ## Deprecation
<ide>
<del>If a user attempts to install a deprecated formula, they will be shown a warning message but the install will succeed.
<add>If a user attempts to install a deprecated formula, they will be shown a warning message but the install will proceed.
<ide>
<del>A formula should be deprecated to indicate to users that the formula should not be used and may be disabled in the future. Deprecated formulae should still build from source and their bottles should continue to work.
<add>A formula should be deprecated to indicate to users that the formula should not be used and may be disabled in the future. Deprecated formulae should still build from source and their bottles should continue to work. These formulae should continue to receive maintenance as needed to allow them to build.
<ide>
<ide> The most common reasons for deprecation are when the upstream project is deprecated, unmaintained, or archived.
<ide>
<ide> The `because` parameter can be a preset reason (using a symbol) or a custom reas
<ide>
<ide> ## Removal
<ide>
<del>A formula should be removed if it does not meet our criteria for [acceptable formulae](Acceptable-Formulae.md) or [versioned formulae](Versions.md), has a non-open-source license, or has been disabled for a long period of time.
<del>
<del>**Note: disabled formulae in homebrew/core will be automatically removed one year after their disable date**
<add>A formula should be removed if it does not meet our criteria for [acceptable formulae](Acceptable-Formulae.md) or [versioned formulae](Versions.md), has a non-open-source license, or has been disabled for over a year.
<ide>
<ide> ## Deprecate and Disable Reasons
<ide>
<ide> When a formula is deprecated or disabled, a reason explaining the action must be provided.
<ide>
<del>There are two ways to indicate the reason. The preferred way is to use a pre-existing symbol to indicate the reason. The available symbols are listed below and can be found in the [`DeprecateDisable` module](https://rubydoc.brew.sh/DeprecateDisable.html#DEPRECATE_DISABLE_REASONS-constant):
<add>There are two ways to indicate the reason. The preferred way is to use a pre-existing symbol to indicate the reason. The available symbols are listed below and can be found in the [`DeprecateDisable` module](https://github.com/Homebrew/brew/blob/master/Library/Homebrew/deprecate_disable.rb):
<ide>
<ide> - `:does_not_build`: the formula cannot be built from source
<ide> - `:no_license`: the formula does not have a license | 1 |
Text | Text | fix broken link in vm.md | de9a84186e6da9e4e6ee9434aa89715bf3eb9172 | <ide><path>doc/api/vm.md
<ide> added: v0.3.1
<ide> * `sandbox` {Object}
<ide>
<ide> If given a `sandbox` object, the `vm.createContext()` method will [prepare
<del>that sandbox][#vm_what_does_it_mean_to_contextify_an_object] so that it can be
<del>used in calls to [`vm.runInContext()`][] or [`script.runInContext()`][]. Inside
<del>such scripts, the `sandbox` object will be the global object, retaining all of
<del>its existing properties but also having the built-in objects and functions any
<del>standard [global object][] has. Outside of scripts run by the vm module,
<del>`sandbox` will remain unchanged.
<add>that sandbox][contextified] so that it can be used in calls to
<add>[`vm.runInContext()`][] or [`script.runInContext()`][]. Inside such scripts,
<add>the `sandbox` object will be the global object, retaining all of its existing
<add>properties but also having the built-in objects and functions any standard
<add>[global object][] has. Outside of scripts run by the vm module, `sandbox` will
<add>remain unchanged.
<ide>
<ide> If `sandbox` is omitted (or passed explicitly as `undefined`), a new, empty
<ide> [contextified][] sandbox object will be returned.
<ide> console.log('localVar: ', localVar);
<ide> Because `vm.runInThisContext()` does not have access to the local scope,
<ide> `localVar` is unchanged. In contrast, [`eval()`][] *does* have access to the
<ide> local scope, so the value `localVar` is changed. In this way
<del>`vm.runInThisContext()` is much like an [indirect `eval()` call][], e.g.
<add>`vm.runInThisContext()` is much like an [indirect `eval()` call][], e.g.
<ide> `(0,eval)('code')`.
<ide>
<ide> ## Example: Running an HTTP Server within a VM
<ide> let code =
<ide> })`;
<ide>
<ide> vm.runInThisContext(code)(require);
<del> ```
<add> ```
<ide>
<ide> *Note*: The `require()` in the above case shares the state with context it is
<ide> passed from. This may introduce risks when untrusted code is executed, e.g. | 1 |
Python | Python | turn 2 prints to py2/py3 compatible syntax | c810fae9e835ad446e7e9d61c12bbf2f6b597109 | <ide><path>scripts/flaskext_tester.py
<ide>
<ide>
<ide> def log(msg, *args):
<del> print '[EXTTEST]', msg % args
<add> print('[EXTTEST] ' + (msg % args))
<ide>
<ide>
<ide> class TestResult(object):
<ide> def main():
<ide> if args.browse:
<ide> import webbrowser
<ide> webbrowser.open('file:///' + filename.lstrip('/'))
<del> print 'Results written to', filename
<add> print('Results written to {}'.format(filename))
<ide>
<ide>
<ide> if __name__ == '__main__': | 1 |
Javascript | Javascript | support del in the repl | 0fd1656d63e5e1eb3048b718c53d35c6d5918846 | <ide><path>lib/readline.js
<ide> Interface.prototype._ttyWrite = function (b) {
<ide> this._historyPrev();
<ide> } else if (b[1] === 91 && b[2] === 66) { // down arrow
<ide> this._historyNext();
<add> } else if (b[1] === 91 && b[2] === 51 && this.cursor < this.line.length) { // delete right
<add> this.line = this.line.slice(0, this.cursor)
<add> + this.line.slice(this.cursor+1, this.line.length)
<add> ;
<add> this._refreshLine();
<ide> }
<ide> break;
<ide> | 1 |
Go | Go | add support for endpoint's preferred ipv6 address | 2ecc6aa49ebfcab1d579b1b8de221ea6260cd8cf | <ide><path>libnetwork/endpoint.go
<ide> type endpoint struct {
<ide> generic map[string]interface{}
<ide> joinLeaveDone chan struct{}
<ide> prefAddress net.IP
<add> prefAddressV6 net.IP
<ide> ipamOptions map[string]string
<ide> dbIndex uint64
<ide> dbExists bool
<ide> func EndpointOptionGeneric(generic map[string]interface{}) EndpointOption {
<ide> }
<ide>
<ide> // CreateOptionIpam function returns an option setter for the ipam configuration for this endpoint
<del>func CreateOptionIpam(prefAddress net.IP, ipamOptions map[string]string) EndpointOption {
<add>func CreateOptionIpam(ipV4, ipV6 net.IP, ipamOptions map[string]string) EndpointOption {
<ide> return func(ep *endpoint) {
<del> ep.prefAddress = prefAddress
<add> ep.prefAddress = ipV4
<add> ep.prefAddressV6 = ipV6
<ide> ep.ipamOptions = ipamOptions
<ide> }
<ide> }
<ide> func (ep *endpoint) assignAddressVersion(ipVer int, ipam ipamapi.Ipam) error {
<ide> var (
<ide> poolID *string
<ide> address **net.IPNet
<add> prefAdd net.IP
<add> progAdd net.IP
<ide> )
<ide>
<ide> n := ep.getNetwork()
<ide> switch ipVer {
<ide> case 4:
<ide> poolID = &ep.iface.v4PoolID
<ide> address = &ep.iface.addr
<add> prefAdd = ep.prefAddress
<ide> case 6:
<ide> poolID = &ep.iface.v6PoolID
<ide> address = &ep.iface.addrv6
<add> prefAdd = ep.prefAddressV6
<ide> default:
<ide> return types.InternalErrorf("incorrect ip version number passed: %d", ipVer)
<ide> }
<ide> func (ep *endpoint) assignAddressVersion(ipVer int, ipam ipamapi.Ipam) error {
<ide> return nil
<ide> }
<ide>
<add> // The address to program may be chosen by the user or by the network driver in one specific
<add> // case to support backward compatibility with `docker daemon --fixed-cidrv6` use case
<add> if prefAdd != nil {
<add> progAdd = prefAdd
<add> } else if *address != nil {
<add> progAdd = (*address).IP
<add> }
<add>
<ide> for _, d := range ipInfo {
<del> var prefIP net.IP
<del> if *address != nil {
<del> prefIP = (*address).IP
<add> if progAdd != nil && !d.Pool.Contains(progAdd) {
<add> continue
<ide> }
<del> addr, _, err := ipam.RequestAddress(d.PoolID, prefIP, ep.ipamOptions)
<add> addr, _, err := ipam.RequestAddress(d.PoolID, progAdd, ep.ipamOptions)
<ide> if err == nil {
<ide> ep.Lock()
<ide> *address = addr
<ide> *poolID = d.PoolID
<ide> ep.Unlock()
<ide> return nil
<ide> }
<del> if err != ipamapi.ErrNoAvailableIPs {
<add> if err != ipamapi.ErrNoAvailableIPs || progAdd != nil {
<ide> return err
<ide> }
<ide> }
<add> if progAdd != nil {
<add> return types.BadRequestErrorf("Invalid preferred address %s: It does not belong to any of this network's subnets")
<add> }
<ide> return fmt.Errorf("no available IPv%d addresses on this network's address pools: %s (%s)", ipVer, n.Name(), n.ID())
<ide> }
<ide> | 1 |
Javascript | Javascript | allow buffer encoding in spawnsync | dc76afffb6b7f3f4f263025808fcf809e95ddf91 | <ide><path>lib/child_process.js
<ide> function spawnSync(/*file, args, options*/) {
<ide>
<ide> var result = spawn_sync.spawn(options);
<ide>
<del> if (result.output && options.encoding) {
<add> if (result.output && options.encoding && options.encoding !== 'buffer') {
<ide> for (i = 0; i < result.output.length; i++) {
<ide> if (!result.output[i])
<ide> continue;
<ide><path>test/common.js
<ide> exports.spawnPwd = function(options) {
<ide> }
<ide> };
<ide>
<add>
<add>exports.spawnSyncPwd = function(options) {
<add> const spawnSync = require('child_process').spawnSync;
<add>
<add> if (exports.isWindows) {
<add> return spawnSync('cmd.exe', ['/c', 'cd'], options);
<add> } else {
<add> return spawnSync('pwd', [], options);
<add> }
<add>};
<add>
<ide> exports.platformTimeout = function(ms) {
<ide> if (process.config.target_defaults.default_configuration === 'Debug')
<ide> ms = 2 * ms;
<ide><path>test/parallel/test-child-process-spawnsync.js
<ide> assert.deepStrictEqual(ret_err.spawnargs, ['bar']);
<ide>
<ide> assert.strictEqual(response.stdout.toString().trim(), cwd);
<ide> })();
<add>
<add>{
<add> // Test the encoding option
<add> const noEncoding = common.spawnSyncPwd();
<add> const bufferEncoding = common.spawnSyncPwd({encoding: 'buffer'});
<add> const utf8Encoding = common.spawnSyncPwd({encoding: 'utf8'});
<add>
<add> assert.deepStrictEqual(noEncoding.output, bufferEncoding.output);
<add> assert.deepStrictEqual([
<add> null,
<add> noEncoding.stdout.toString(),
<add> noEncoding.stderr.toString()
<add> ], utf8Encoding.output);
<add>} | 3 |
PHP | PHP | apply fixes from styleci | ae9a17ea5192baea7dd2ec55167b1e8532f239d3 | <ide><path>tests/Support/SupportStringableTest.php
<ide> public function testWhenContainsAll()
<ide> return $stringable->studly();
<ide> }));
<ide> }
<del>
<add>
<ide> public function testDirname()
<ide> {
<ide> $this->assertSame('/framework/tests', (string) $this->stringable('/framework/tests/Support')->dirname());
<ide> $this->assertSame('/framework', (string) $this->stringable('/framework/tests/Support')->dirname(2));
<del>
<add>
<ide> $this->assertSame('/', (string) $this->stringable('/framework/')->dirname());
<del>
<add>
<ide> $this->assertSame('/', (string) $this->stringable('/')->dirname());
<ide> $this->assertSame('.', (string) $this->stringable('.')->dirname());
<del>
<add>
<ide> // without slash
<ide> $this->assertSame('.', (string) $this->stringable('framework')->dirname());
<ide> } | 1 |
Java | Java | fix tests with javaonlymap | 8ec13c306c155d9320221d34309f08c2baf507bf | <ide><path>ReactAndroid/src/main/java/com/facebook/react/bridge/JavaOnlyArray.java
<ide> public void pushDouble(double value) {
<ide>
<ide> @Override
<ide> public void pushInt(int value) {
<del> mBackingList.add(value);
<add> mBackingList.add(new Double(value));
<ide> }
<ide>
<ide> @Override
<ide><path>ReactAndroid/src/main/java/com/facebook/react/bridge/JavaOnlyMap.java
<ide> public void putDouble(@Nonnull String key, double value) {
<ide>
<ide> @Override
<ide> public void putInt(@Nonnull String key, int value) {
<del> mBackingMap.put(key, value);
<add> mBackingMap.put(key, new Double(value));
<ide> }
<ide>
<ide> @Override
<ide><path>ReactAndroid/src/test/java/com/facebook/react/modules/timing/TimingModuleTest.java
<ide> public void testSimpleTimer() {
<ide> mTiming.onHostResume();
<ide> mTiming.createTimer(1, 1, 0, false);
<ide> stepChoreographerFrame();
<del> verify(mJSTimersMock).callTimers(JavaOnlyArray.of(1));
<add> verify(mJSTimersMock).callTimers(JavaOnlyArray.of(1.0));
<ide> reset(mJSTimersMock);
<ide> stepChoreographerFrame();
<ide> verifyNoMoreInteractions(mJSTimersMock);
<ide> public void testSimpleRecurringTimer() {
<ide> mTiming.createTimer(100, 1, 0, true);
<ide> mTiming.onHostResume();
<ide> stepChoreographerFrame();
<del> verify(mJSTimersMock).callTimers(JavaOnlyArray.of(100));
<add> verify(mJSTimersMock).callTimers(JavaOnlyArray.of(100.0));
<ide>
<ide> reset(mJSTimersMock);
<ide> stepChoreographerFrame();
<del> verify(mJSTimersMock).callTimers(JavaOnlyArray.of(100));
<add> verify(mJSTimersMock).callTimers(JavaOnlyArray.of(100.0));
<ide> }
<ide>
<ide> @Test
<ide> public void testCancelRecurringTimer() {
<ide> mTiming.createTimer(105, 1, 0, true);
<ide>
<ide> stepChoreographerFrame();
<del> verify(mJSTimersMock).callTimers(JavaOnlyArray.of(105));
<add> verify(mJSTimersMock).callTimers(JavaOnlyArray.of(105.0));
<ide>
<ide> reset(mJSTimersMock);
<ide> mTiming.deleteTimer(105);
<ide> public void testPausingAndResuming() {
<ide> mTiming.createTimer(41, 1, 0, true);
<ide>
<ide> stepChoreographerFrame();
<del> verify(mJSTimersMock).callTimers(JavaOnlyArray.of(41));
<add> verify(mJSTimersMock).callTimers(JavaOnlyArray.of(41.0));
<ide>
<ide> reset(mJSTimersMock);
<ide> mTiming.onHostPause();
<ide> public void testPausingAndResuming() {
<ide> reset(mJSTimersMock);
<ide> mTiming.onHostResume();
<ide> stepChoreographerFrame();
<del> verify(mJSTimersMock).callTimers(JavaOnlyArray.of(41));
<add> verify(mJSTimersMock).callTimers(JavaOnlyArray.of(41.0));
<ide> }
<ide>
<ide> @Test
<ide> public void testHeadlessJsTaskInBackground() {
<ide> mTiming.createTimer(41, 1, 0, true);
<ide>
<ide> stepChoreographerFrame();
<del> verify(mJSTimersMock).callTimers(JavaOnlyArray.of(41));
<add> verify(mJSTimersMock).callTimers(JavaOnlyArray.of(41.0));
<ide>
<ide> reset(mJSTimersMock);
<ide> mTiming.onHeadlessJsTaskFinish(42);
<ide> public void testHeadlessJsTaskInForeground() {
<ide> mTiming.createTimer(41, 1, 0, true);
<ide>
<ide> stepChoreographerFrame();
<del> verify(mJSTimersMock).callTimers(JavaOnlyArray.of(41));
<add> verify(mJSTimersMock).callTimers(JavaOnlyArray.of(41.0));
<ide>
<ide> reset(mJSTimersMock);
<ide> mTiming.onHeadlessJsTaskFinish(42);
<ide> stepChoreographerFrame();
<del> verify(mJSTimersMock).callTimers(JavaOnlyArray.of(41));
<add> verify(mJSTimersMock).callTimers(JavaOnlyArray.of(41.0));
<ide>
<ide> reset(mJSTimersMock);
<ide> mTiming.onHostPause();
<ide> public void testHeadlessJsTaskIntertwine() {
<ide> mTiming.onHostPause();
<ide>
<ide> stepChoreographerFrame();
<del> verify(mJSTimersMock).callTimers(JavaOnlyArray.of(41));
<add> verify(mJSTimersMock).callTimers(JavaOnlyArray.of(41.0));
<ide>
<ide> reset(mJSTimersMock);
<ide> mTiming.onHostResume();
<ide> mTiming.onHeadlessJsTaskFinish(42);
<ide> stepChoreographerFrame();
<del> verify(mJSTimersMock).callTimers(JavaOnlyArray.of(41));
<add> verify(mJSTimersMock).callTimers(JavaOnlyArray.of(41.0));
<ide>
<ide> reset(mJSTimersMock);
<ide> mTiming.onHostPause();
<ide> public void testHeadlessJsTaskIntertwine() {
<ide> @Test
<ide> public void testSetTimeoutZero() {
<ide> mTiming.createTimer(100, 0, 0, false);
<del> verify(mJSTimersMock).callTimers(JavaOnlyArray.of(100));
<add> verify(mJSTimersMock).callTimers(JavaOnlyArray.of(100.0));
<ide> }
<ide>
<ide> @Test | 3 |
Ruby | Ruby | remove unnecessary rescue | 67c1fa934bd1ea04ee291df272d3e6a9094994e1 | <ide><path>activerecord/test/cases/mixin_test.rb
<ide> def test_create_turned_off
<ide>
<ide> # Make sure Mixin.record_timestamps gets reset, even if this test fails,
<ide> # so that other tests do not fail because Mixin.record_timestamps == false
<del> rescue Exception => e
<del> raise e
<ide> ensure
<ide> Mixin.record_timestamps = true
<ide> end | 1 |
Javascript | Javascript | fix legacy redirect | f39fee8eaf049994c7df25173425d83a108b40fe | <ide><path>examples/js/controls/OrbitControls.js
<ide> Object.defineProperties( THREE.OrbitControls.prototype, {
<ide> get: function () {
<ide>
<ide> console.warn( 'THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead.' );
<del> return ! this.constraint.enableDamping;
<add> return ! this.enableDamping;
<ide>
<ide> },
<ide>
<ide> set: function ( value ) {
<ide>
<ide> console.warn( 'THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead.' );
<del> this.constraint.enableDamping = ! value;
<add> this.enableDamping = ! value;
<ide>
<ide> }
<ide>
<ide> Object.defineProperties( THREE.OrbitControls.prototype, {
<ide> get: function () {
<ide>
<ide> console.warn( 'THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead.' );
<del> return this.constraint.dampingFactor;
<add> return this.dampingFactor;
<ide>
<ide> },
<ide>
<ide> set: function ( value ) {
<ide>
<ide> console.warn( 'THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead.' );
<del> this.constraint.dampingFactor = value;
<add> this.dampingFactor = value;
<ide>
<ide> }
<ide> | 1 |
PHP | PHP | fix doc block typo | e7f12d28b4a643d5bae9a8779d4323f708e57d1a | <ide><path>src/Collection/CollectionTrait.php
<ide> public function compile($preserveKeys = true) {
<ide>
<ide> /**
<ide> * Returns a new collection where the operations performed by this collection.
<del> * Not matter how many times the new collection is iterated, those operations will
<add> * No matter how many times the new collection is iterated, those operations will
<ide> * only be performed once.
<ide> *
<ide> * This can also be used to make any non-rewindable iterator rewindable. | 1 |
Java | Java | remove unecessary "<<" | 0e49c0e152f6f560be94b12629bdd946d3dec5c8 | <ide><path>spring-tx/src/main/java/org/springframework/transaction/TransactionDefinition.java
<ide> public interface TransactionDefinition {
<ide> * ({@link #PROPAGATION_SUPPORTS}). In the latter case, the flag will
<ide> * only apply to managed resources within the application, such as a
<ide> * Hibernate {@code Session}.
<del> << * <p>This just serves as a hint for the actual transaction subsystem;
<add> * <p>This just serves as a hint for the actual transaction subsystem;
<ide> * it will <i>not necessarily</i> cause failure of write access attempts.
<ide> * A transaction manager which cannot interpret the read-only hint will
<ide> * <i>not</i> throw an exception when asked for a read-only transaction. | 1 |
Text | Text | add a new handling touches guide | deb6106c1669276a56c7fc26ad7e59eb99f166a7 | <ide><path>docs/GestureResponderSystem.md
<ide> title: Gesture Responder System
<ide> layout: docs
<ide> category: Guides
<ide> permalink: docs/gesture-responder-system.html
<del>next: animations
<add>next: native-modules-ios
<ide> ---
<ide>
<ide> Gesture recognition on mobile devices is much more complicated than web. A touch can go through several phases as the app determines what the user's intention is. For example, the app needs to determine if the touch is scrolling, sliding on a widget, or tapping. This can even change during the duration of a touch. There can also be multiple simultaneous touches.
<ide><path>docs/HandlingTouches.md
<add>---
<add>id: handling-touches
<add>title: Handling Touches
<add>layout: docs
<add>category: Guides
<add>permalink: docs/handling-touches.html
<add>next: animations
<add>---
<add>
<add>Users interact with mobile apps mainly through touch. They can use a combination of gestures, such as tapping on a button, scrolling a list, or zooming on a map.
<add>
<add>React Native provides components to handle common gestures, such as taps and swipes, as well as a comprehensive [gesture responder system](/docs/gesturerespondersystem.html) to allow for more advanced gesture recognition.
<add>
<add>## Tappable Components
<add>
<add>You can use "Touchable" components when you want to capture a tapping gesture. They take a function through the `onPress` props which will be called when the touch begins and ends within the bounds of the component.
<add>
<add>Example:
<add>
<add>```javascript
<add>class MyButton extends Component {
<add> _onPressButton() {
<add> console.log("You tapped the button!");
<add> }
<add>
<add> render() {
<add> return (
<add> <TouchableHighlight onPress={this._onPressButton}>
<add> <Text>Button</Text>
<add> </TouchableHighlight>
<add> );
<add> }
<add>}
<add>```
<add>
<add>Tappable components should provide feedback that show the user what is handling their touch, and what will happen when they lift their finger. The user should also be able to cancel a tap by dragging their finger away.
<add>
<add>Which component you use will depend on what kind of feedback you want to provide:
<add>
<add>- Generally, you can use [**TouchableHighlight**](/docs/touchablehighlight.html) anywhere you would use a button or link on web. The view's background will be darkened when the user presses down on the button.
<add>
<add>- You may consider using [**TouchableNativeFeedback**](/docs/touchablenativefeedback.html) on Android to display ink surface reaction ripples that respond to the user's touch.
<add>
<add>- [**TouchableOpacity**](/docs/touchableopacity.html) can be used to provide feedback by reducing the opacity of the button, allowing the background to be seen through while the user is pressing down.
<add>
<add>- If you need to handle a tap gesture but you don't want any feedback to be displayed, use [**TouchableWithoutFeedback**](/docs/touchablewithoutfeedback.html).
<add>
<add>### Long presses
<add>
<add>In some cases, you may want to detect when a user presses and holds a view for a set amount of time. These long presses can be handled by passing a function to the `onLongPress` props of any of the touchable components listed above.
<add>
<add>## Scrolling lists and swiping views
<add>
<add>A common pattern to many mobile apps is the scrollable list of items. Users interact with these using panning or swiping gestures. The [ScrollView](/docs/basics-component-scrollview.html) component displays a list of items that can be scrolled using these gestures.
<add>
<add>ScrollViews can scroll vertically or horizontally, and can be configured to allow paging through views using swiping gestures by using the `pagingEnabled` props. Swiping horizontally between views can also be implemented on Android using the [ViewPagerAndroid](/docs/viewpagerandroid.html) component.
<add>
<add>A [ListView](/docs/basics-component-listview.html) is a special kind of ScrollView that is best suited for displaying long vertical lists of items. It can also display section headers and footers, similar to `UITableView`s on iOS.
<add>
<add>### Pinch-to-zoom
<add>
<add>A ScrollView with a single item can be used to allow the user to zoom content. Set up the `maximumZoomScale` and `minimumZoomScale` props and your user will be able to use pinch and expand gestures to zoom in and out.
<add>
<add>## Handling additional gestures
<add>
<add>If you want to allow a user to drag a view around the screen, or you want to implement your own custom pan/drag gesture, take a look at the [PanResponder](/docs/panresponder.html) API or the [gesture responder system docs](/docs/gesturerespondersystem.html).
<ide><path>docs/Images.md
<ide> title: Images
<ide> layout: docs
<ide> category: Guides
<ide> permalink: docs/images.html
<del>next: gesture-responder-system
<add>next: handling-touches
<ide> ---
<ide>
<ide> ## Static Image Resources
<ide><path>docs/PlatformSpecificInformation.md
<ide> title: Platform Specific Code
<ide> layout: docs
<ide> category: Guides
<ide> permalink: docs/platform-specific-code.html
<del>next: native-modules-ios
<add>next: gesture-responder-system
<ide> ---
<ide>
<ide> When building a cross-platform app, you'll want to re-use as much code as possible. Scenarios may arise where it makes sense for the code to be different, for example you may want to implement separate visual components for iOS and Android. | 4 |
Go | Go | improve error message only if no body is returned | e23190b6b3ddd16b3a5f951a33e05fd75ebb8970 | <ide><path>api/client.go
<ide> func (cli *DockerCli) call(method, path string, data interface{}, passAuthInfo b
<ide> return nil, -1, err
<ide> }
<ide> if len(body) == 0 {
<del> return nil, resp.StatusCode, fmt.Errorf("Error :%s", http.StatusText(resp.StatusCode))
<add> return nil, resp.StatusCode, fmt.Errorf("Error: request returned %s for api route and version %s, check if the server supports the requested api version", http.StatusText(resp.StatusCode), req.URL)
<ide> }
<ide> return nil, resp.StatusCode, fmt.Errorf("Error: %s", bytes.TrimSpace(body))
<ide> } | 1 |
Text | Text | avoid double parentheses [ci skip] | 50000d37e495b31fcb607d532120eab9068c75c9 | <ide><path>website/docs/usage/rule-based-matching.md
<ide> another token that's at least 10 characters long.
<ide>
<ide> spaCy features a rule-matching engine, the [`Matcher`](/api/matcher), that
<ide> operates over tokens, similar to regular expressions. The rules can refer to
<del>token annotations (e.g. the token `text` or `tag_`, and flags (e.g. `IS_PUNCT`)).
<add>token annotations (e.g. the token `text` or `tag_`, and flags like `IS_PUNCT`).
<ide> The rule matcher also lets you pass in a custom callback to act on matches – for
<ide> example, to merge entities and apply custom labels. You can also associate
<ide> patterns with entity IDs, to allow some basic entity linking or disambiguation. | 1 |
Ruby | Ruby | simplify boolean casting logic | 8c5983c5f00f6b77bd88f6ebad0ae31573f0ef96 | <ide><path>activerecord/lib/active_record/type/boolean.rb
<ide> def type
<ide> def cast_value(value)
<ide> if value == ''
<ide> nil
<del> elsif ConnectionAdapters::Column::FALSE_VALUES.include?(value)
<del> false
<ide> else
<del> true
<add> !ConnectionAdapters::Column::FALSE_VALUES.include?(value)
<ide> end
<ide> end
<ide> end | 1 |
Javascript | Javascript | add eventdispatcher tests for event bubbling | c2f40bf6e1cc898a4fa2b7c5e76d7127acbb7bcc | <ide><path>packages/ember-glimmer/tests/integration/event-dispatcher-test.js
<ide> moduleFor('EventDispatcher', class extends RenderingTest {
<ide> assert.strictEqual(receivedEvent.target, this.$('#is-done')[0]);
<ide> }
<ide>
<add> ['@test events bubble to parent view'](assert) {
<add> let receivedEvent;
<add>
<add> this.registerComponent('x-foo', {
<add> ComponentClass: Component.extend({
<add> change(event) {
<add> receivedEvent = event;
<add> }
<add> }),
<add> template: `{{yield}}`
<add> });
<add>
<add> this.registerComponent('x-bar', {
<add> ComponentClass: Component.extend({
<add> change() {}
<add> }),
<add> template: `<input id="is-done" type="checkbox">`
<add> });
<add>
<add> this.render(`{{#x-foo}}{{x-bar}}{{/x-foo}}`);
<add>
<add> this.runTask(() => this.$('#is-done').trigger('change'));
<add> assert.ok(receivedEvent, 'change event was triggered');
<add> assert.strictEqual(receivedEvent.target, this.$('#is-done')[0]);
<add> }
<add>
<add> ['@test events bubbling up can be prevented'](assert) {
<add> let hasReceivedEvent;
<add>
<add> this.registerComponent('x-foo', {
<add> ComponentClass: Component.extend({
<add> change() {
<add> hasReceivedEvent = true;
<add> }
<add> }),
<add> template: `{{yield}}`
<add> });
<add>
<add> this.registerComponent('x-bar', {
<add> ComponentClass: Component.extend({
<add> change() {
<add> return false;
<add> }
<add> }),
<add> template: `<input id="is-done" type="checkbox">`
<add> });
<add>
<add> this.render(`{{#x-foo}}{{x-bar}}{{/x-foo}}`);
<add>
<add> this.runTask(() => this.$('#is-done').trigger('change'));
<add> assert.notOk(hasReceivedEvent, 'change event has not been received');
<add> }
<add>
<ide> ['@test dispatches to the nearest event manager'](assert) {
<ide> let receivedEvent;
<ide> | 1 |
Python | Python | use libyaml c library when available. | 7daebefd15355b3f1331c6c58f66f3f88d38a10a | <ide><path>airflow/cli/commands/connection_command.py
<ide> from typing import Any, Dict, List
<ide> from urllib.parse import urlparse, urlunparse
<ide>
<del>import yaml
<ide> from sqlalchemy.orm import exc
<ide>
<add>import airflow.utils.yaml as yaml
<ide> from airflow.cli.simple_table import AirflowConsole
<ide> from airflow.exceptions import AirflowNotFoundException
<ide> from airflow.hooks.base import BaseHook
<ide><path>airflow/cli/commands/kubernetes_command.py
<ide> import os
<ide> import sys
<ide>
<del>import yaml
<ide> from kubernetes import client
<ide> from kubernetes.client.api_client import ApiClient
<ide> from kubernetes.client.rest import ApiException
<ide>
<add>import airflow.utils.yaml as yaml
<ide> from airflow.executors.kubernetes_executor import KubeConfig, create_pod_id
<ide> from airflow.kubernetes import pod_generator
<ide> from airflow.kubernetes.kube_client import get_kube_client
<ide><path>airflow/cli/simple_table.py
<ide> import json
<ide> from typing import Any, Callable, Dict, List, Optional, Union
<ide>
<del>import yaml
<ide> from rich.box import ASCII_DOUBLE_HEAD
<ide> from rich.console import Console
<ide> from rich.syntax import Syntax
<ide> from rich.table import Table
<ide> from tabulate import tabulate
<ide>
<add>import airflow.utils.yaml as yaml
<ide> from airflow.plugins_manager import PluginsDirectorySource
<ide> from airflow.utils.platform import is_tty
<ide>
<ide><path>airflow/configuration.py
<ide> def default_config_yaml() -> dict:
<ide>
<ide> :return: Python dictionary containing configs & their info
<ide> """
<del> import yaml
<add> import airflow.utils.yaml as yaml
<ide>
<ide> with open(_default_config_file_path('config.yml')) as config_file:
<ide> return yaml.safe_load(config_file)
<ide><path>airflow/kubernetes/pod_generator.py
<ide> from functools import reduce
<ide> from typing import List, Optional, Union
<ide>
<del>import yaml
<ide> from dateutil import parser
<ide> from kubernetes.client import models as k8s
<ide> from kubernetes.client.api_client import ApiClient
<ide>
<add>import airflow.utils.yaml as yaml
<ide> from airflow.exceptions import AirflowConfigException
<ide> from airflow.kubernetes.pod_generator_deprecated import PodGenerator as PodGeneratorDeprecated
<ide> from airflow.version import version as airflow_version
<ide><path>airflow/kubernetes/refresh_config.py
<ide> from typing import Optional, cast
<ide>
<ide> import pendulum
<del>import yaml
<ide> from kubernetes.client import Configuration
<ide> from kubernetes.config.exec_provider import ExecProvider
<ide> from kubernetes.config.kube_config import KUBE_CONFIG_DEFAULT_LOCATION, KubeConfigLoader
<ide>
<add>import airflow.utils.yaml as yaml
<add>
<ide>
<ide> def _parse_timestamp(ts_str: str) -> int:
<ide> parsed_dt = cast(pendulum.DateTime, pendulum.parse(ts_str))
<ide><path>airflow/providers/cncf/kubernetes/hooks/kubernetes.py
<ide> import tempfile
<ide> from typing import Any, Dict, Generator, Optional, Tuple, Union
<ide>
<del>import yaml
<ide> from cached_property import cached_property
<ide> from kubernetes import client, config, watch
<ide>
<add>try:
<add> import airflow.utils.yaml as yaml
<add>except ImportError:
<add> import yaml
<add>
<ide> from airflow.exceptions import AirflowException
<ide> from airflow.hooks.base import BaseHook
<ide>
<ide><path>airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py
<ide> import warnings
<ide> from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Optional, Tuple
<ide>
<del>import yaml
<ide> from kubernetes.client import CoreV1Api, models as k8s
<ide>
<add>try:
<add> import airflow.utils.yaml as yaml
<add>except ImportError:
<add> import yaml
<add>
<ide> from airflow.exceptions import AirflowException
<ide> from airflow.kubernetes import kube_client, pod_generator, pod_launcher
<ide> from airflow.kubernetes.pod_generator import PodGenerator
<ide><path>airflow/providers/google/cloud/operators/cloud_build.py
<ide> from typing import Any, Dict, Optional, Sequence, Union
<ide> from urllib.parse import unquote, urlparse
<ide>
<del>import yaml
<add>try:
<add> import airflow.utils.yaml as yaml
<add>except ImportError:
<add> import yaml
<ide>
<ide> from airflow.exceptions import AirflowException
<ide> from airflow.models import BaseOperator
<ide><path>airflow/providers_manager.py
<ide> from typing import Any, Dict, NamedTuple, Set
<ide>
<ide> import jsonschema
<del>import yaml
<ide> from wtforms import Field
<ide>
<add>import airflow.utils.yaml as yaml
<ide> from airflow.utils.entry_points import entry_points_with_dist
<ide>
<ide> try:
<ide><path>airflow/secrets/local_filesystem.py
<ide> from json import JSONDecodeError
<ide> from typing import TYPE_CHECKING, Any, Dict, List, Optional, Set, Tuple
<ide>
<del>import yaml
<del>
<add>import airflow.utils.yaml as yaml
<ide> from airflow.exceptions import (
<ide> AirflowException,
<ide> AirflowFileParseException,
<ide><path>airflow/utils/yaml.py
<add># Licensed to the Apache Software Foundation (ASF) under one
<add># or more contributor license agreements. See the NOTICE file
<add># distributed with this work for additional information
<add># regarding copyright ownership. The ASF licenses this file
<add># to you under the Apache License, Version 2.0 (the
<add># "License"); you may not use this file except in compliance
<add># with the License. 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,
<add># software distributed under the License is distributed on an
<add># "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
<add># KIND, either express or implied. See the License for the
<add># specific language governing permissions and limitations
<add># under the License.
<add>
<add>"""Use libyaml for YAML dump/load operations where possible.
<add>
<add>If libyaml is available we will use it -- it is significantly faster.
<add>
<add>This module delegates all other properties to the yaml module, so it can be used as:
<add>
<add>.. code-block:: python
<add> import airflow.utils.yaml as yaml
<add>
<add>And then be used directly in place of the normal python module.
<add>"""
<add>import sys
<add>from typing import TYPE_CHECKING, Any, BinaryIO, TextIO, Union, cast
<add>
<add>if TYPE_CHECKING:
<add> from yaml.error import MarkedYAMLError # noqa
<add>
<add>
<add>def safe_load(stream: Union[bytes, str, BinaryIO, TextIO]) -> Any:
<add> """Like yaml.safe_load, but use the C libyaml for speed where we can"""
<add> # delay import until use.
<add> from yaml import load as orig
<add>
<add> try:
<add> from yaml import CSafeLoader as SafeLoader
<add> except ImportError:
<add> from yaml import SafeLoader # type: ignore[no-redef]
<add>
<add> return orig(stream, SafeLoader)
<add>
<add>
<add>def dump(data: Any, **kwargs) -> str:
<add> """Like yaml.safe_dump, but use the C libyaml for speed where we can"""
<add> # delay import until use.
<add> from yaml import dump as orig
<add>
<add> try:
<add> from yaml import CSafeDumper as SafeDumper
<add> except ImportError:
<add> from yaml import SafeDumper # type: ignore[no-redef]
<add>
<add> return cast(str, orig(data, Dumper=SafeDumper, **kwargs))
<add>
<add>
<add>def __getattr__(name):
<add> # Delegate anything else to the yaml module
<add> import yaml
<add>
<add> if name == "FullLoader":
<add> # Try to use CFullLoader by default
<add> getattr(yaml, "CFullLoader", yaml.FullLoader)
<add>
<add> return getattr(yaml, name)
<add>
<add>
<add>if sys.version_info < (3, 7):
<add> from pep562 import Pep562
<add>
<add> Pep562(__name__)
<ide><path>airflow/www/views.py
<ide> import lazy_object_proxy
<ide> import nvd3
<ide> import sqlalchemy as sqla
<del>import yaml
<ide> from flask import (
<ide> Markup,
<ide> Response,
<ide> from wtforms.validators import InputRequired
<ide>
<ide> import airflow
<add>import airflow.utils.yaml as yaml
<ide> from airflow import models, plugins_manager, settings
<ide> from airflow.api.common.experimental.mark_tasks import (
<ide> set_dag_run_state_to_failed,
<ide><path>dev/provider_packages/copy_provider_package_sources.py
<ide> def rename_deprecated_modules(self) -> None:
<ide> ("airflow.sensors.time_delta", "airflow.sensors.time_delta_sensor"),
<ide> ("airflow.sensors.weekday", "airflow.contrib.sensors.weekday_sensor"),
<ide> ("airflow.utils.session", "airflow.utils.db"),
<add> ("airflow.utils.yaml", "yaml"),
<ide> ]
<ide> for new, old in changes:
<ide> self.qry.select_module(new).rename(old)
<ide><path>dev/provider_packages/prepare_provider_packages.py
<ide> from rich.console import Console
<ide> from rich.syntax import Syntax
<ide>
<add>try:
<add> from yaml import CSafeLoader as SafeLoader
<add>except ImportError:
<add> from yaml import SafeLoader # type: ignore[no-redef]
<add>
<ide> INITIAL_CHANGELOG_CONTENT = """
<ide>
<ide>
<ide> def get_provider_info_from_provider_yaml(provider_package_id: str) -> Dict[str,
<ide> if not os.path.exists(provider_yaml_file_name):
<ide> raise Exception(f"The provider.yaml file is missing: {provider_yaml_file_name}")
<ide> with open(provider_yaml_file_name) as provider_file:
<del> provider_yaml_dict = yaml.safe_load(provider_file.read())
<add> provider_yaml_dict = yaml.load(provider_file, SafeLoader)
<ide> provider_info = convert_to_provider_info(provider_yaml_dict)
<ide> validate_provider_info_with_2_0_0_schema(provider_info)
<ide> validate_provider_info_with_runtime_schema(provider_info)
<ide><path>docs/conf.py
<ide>
<ide> import yaml
<ide>
<add>try:
<add> from yaml import CSafeLoader as SafeLoader
<add>except ImportError:
<add> from yaml import SafeLoader # type: ignore[misc]
<add>
<ide> import airflow
<ide> from airflow.configuration import AirflowConfigParser, default_config_yaml
<ide> from docs.exts.docs_build.third_party_inventories import ( # pylint: disable=no-name-in-module,wrong-import-order
<ide> def _load_config():
<ide> return {}
<ide>
<ide> with open(file_path) as config_file:
<del> return yaml.safe_load(config_file)
<add> return yaml.load(config_file, SafeLoader)
<ide>
<ide> config = _load_config()
<ide> if config:
<ide><path>docs/exts/docs_build/lint_checks.py
<ide>
<ide> import yaml
<ide>
<add>try:
<add> from yaml import CSafeLoader as SafeLoader
<add>except ImportError:
<add> from yaml import SafeLoader # type: ignore[misc]
<add>
<ide> import airflow
<ide> from docs.exts.docs_build.docs_builder import ALL_PROVIDER_YAMLS # pylint: disable=no-name-in-module
<ide> from docs.exts.docs_build.errors import DocBuildError # pylint: disable=no-name-in-module
<ide> def check_docker_image_tag_in_quick_start_guide() -> List[DocBuildError]:
<ide> # master tag is little outdated.
<ide> expected_image = f'apache/airflow:{expected_tag}'
<ide> with open(compose_file_path) as yaml_file:
<del> content = yaml.safe_load(yaml_file)
<add> content = yaml.load(yaml_file, SafeLoader)
<ide> current_image_expression = content['x-airflow-common']['image']
<ide> if expected_image not in current_image_expression:
<ide> build_errors.append(
<ide><path>docs/exts/provider_yaml_utils.py
<ide> import jsonschema
<ide> import yaml
<ide>
<add>try:
<add> from yaml import CSafeLoader as SafeLoader
<add>except ImportError:
<add> from yaml import SafeLoader # type: ignore[misc]
<add>
<add>
<ide> ROOT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir))
<ide> PROVIDER_DATA_SCHEMA_PATH = os.path.join(ROOT_DIR, "airflow", "provider.yaml.schema.json")
<ide>
<ide> def load_package_data() -> List[Dict[str, Any]]:
<ide> result = []
<ide> for provider_yaml_path in get_provider_yaml_paths():
<ide> with open(provider_yaml_path) as yaml_file:
<del> provider = yaml.safe_load(yaml_file)
<add> provider = yaml.load(yaml_file, SafeLoader)
<ide> try:
<ide> jsonschema.validate(provider, schema=schema)
<ide> except jsonschema.ValidationError:
<ide><path>scripts/ci/pre_commit/pre_commit_check_pre_commit_hook_names.py
<ide>
<ide> import yaml
<ide>
<add>try:
<add> from yaml import CSafeLoader as SafeLoader
<add>except ImportError:
<add> from yaml import SafeLoader # type: ignore[no-redef]
<add>
<ide>
<ide> def main() -> int:
<ide> parser = argparse.ArgumentParser()
<ide> def main() -> int:
<ide> retval = 0
<ide>
<ide> with open('.pre-commit-config.yaml', 'rb') as f:
<del> content = yaml.safe_load(f)
<add> content = yaml.load(f, SafeLoader)
<ide> errors = get_errors(content, max_length)
<ide> if errors:
<ide> retval = 1
<ide><path>scripts/ci/pre_commit/pre_commit_check_provider_yaml_files.py
<ide> import yaml
<ide> from tabulate import tabulate
<ide>
<add>try:
<add> from yaml import CSafeLoader as SafeLoader
<add>except ImportError:
<add> from yaml import SafeLoader # type: ignore[no-redef]
<add>
<ide> if __name__ != "__main__":
<ide> raise Exception(
<ide> "This file is intended to be executed as an executable program. You cannot use it as a module."
<ide> def _load_package_data(package_paths: Iterable[str]):
<ide> result = {}
<ide> for provider_yaml_path in package_paths:
<ide> with open(provider_yaml_path) as yaml_file:
<del> provider = yaml.safe_load(yaml_file)
<add> provider = yaml.load(yaml_file, SafeLoader)
<ide> rel_path = os.path.relpath(provider_yaml_path, ROOT_DIR)
<ide> try:
<ide> jsonschema.validate(provider, schema=schema) | 20 |
Go | Go | allow temporary errors on leader switch | 3df1095bbdc331d4effa5452d8aafd5aaead5789 | <ide><path>integration-cli/docker_api_swarm_test.go
<ide> import (
<ide> "github.com/docker/docker/internal/test/request"
<ide> "github.com/docker/swarmkit/ca"
<ide> "github.com/go-check/check"
<add> "github.com/pkg/errors"
<ide> "gotest.tools/assert"
<ide> is "gotest.tools/assert/cmp"
<ide> )
<ide> func (s *DockerSwarmSuite) TestAPISwarmLeaderElection(c *check.C) {
<ide> leader *daemon.Daemon // keep track of leader
<ide> followers []*daemon.Daemon // keep track of followers
<ide> )
<add> var lastErr error
<ide> checkLeader := func(nodes ...*daemon.Daemon) checkF {
<ide> return func(c *check.C) (interface{}, check.CommentInterface) {
<ide> // clear these out before each run
<ide> leader = nil
<ide> followers = nil
<ide> for _, d := range nodes {
<del> if d.GetNode(c, d.NodeID()).ManagerStatus.Leader {
<add> n := d.GetNode(c, d.NodeID(), func(err error) bool {
<add> if strings.Contains(errors.Cause(err).Error(), context.DeadlineExceeded.Error()) || strings.Contains(err.Error(), "swarm does not have a leader") {
<add> lastErr = err
<add> return true
<add> }
<add> return false
<add> })
<add> if n == nil {
<add> return false, check.Commentf("failed to get node: %v", lastErr)
<add> }
<add> if n.ManagerStatus.Leader {
<ide> leader = d
<ide> } else {
<ide> followers = append(followers, d)
<ide> func (s *DockerSwarmSuite) TestAPISwarmRaftQuorum(c *check.C) {
<ide> defer cli.Close()
<ide>
<ide> // d1 will eventually step down from leader because there is no longer an active quorum, wait for that to happen
<del> waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) {
<add> waitAndAssert(c, defaultReconciliationTimeout*2, func(c *check.C) (interface{}, check.CommentInterface) {
<ide> _, err := cli.ServiceCreate(context.Background(), service.Spec, types.ServiceCreateOptions{})
<ide> return err.Error(), nil
<ide> }, checker.Contains, "Make sure more than half of the managers are online.")
<ide><path>internal/test/daemon/node.go
<ide> import (
<ide> type NodeConstructor func(*swarm.Node)
<ide>
<ide> // GetNode returns a swarm node identified by the specified id
<del>func (d *Daemon) GetNode(t assert.TestingT, id string) *swarm.Node {
<add>func (d *Daemon) GetNode(t assert.TestingT, id string, errCheck ...func(error) bool) *swarm.Node {
<ide> if ht, ok := t.(test.HelperT); ok {
<ide> ht.Helper()
<ide> }
<ide> cli := d.NewClientT(t)
<ide> defer cli.Close()
<ide>
<ide> node, _, err := cli.NodeInspectWithRaw(context.Background(), id)
<add> if err != nil {
<add> for _, f := range errCheck {
<add> if f(err) {
<add> return nil
<add> }
<add> }
<add> }
<ide> assert.NilError(t, err, "[%s] (*Daemon).GetNode: NodeInspectWithRaw(%q) failed", d.id, id)
<ide> assert.Check(t, node.ID == id)
<ide> return &node | 2 |
Ruby | Ruby | add docs to identity map | a62f7220bbad1678dbf114e2f252172e76b44bab | <ide><path>activerecord/lib/active_record/identity_map.rb
<ide> module ActiveRecord
<add> # = Active Record Identity Map
<add> #
<add> # Ensures that each object gets loaded only once by keeping every loaded
<add> # object in a map. Looks up objects using the map when referring to them.
<add> #
<add> # More information on Identity Map pattern:
<add> # http://www.martinfowler.com/eaaCatalog/identityMap.html
<add> #
<add> # == Configuration
<add> #
<add> # In order to activate IdentityMap, set <tt>config.active_record.identity_map = true</tt>
<add> # in your <tt>config/application.rb</tt> file.
<add> #
<ide> module IdentityMap
<ide> extend ActiveSupport::Concern
<ide> | 1 |
PHP | PHP | add tibetan locales | f9ff4e1e68cd84fad6008210ae4648734fb32320 | <ide><path>cake/libs/l10n.php
<ide> class L10n extends Object {
<ide> /* Arabic */ 'ara' => 'ar',
<ide> /* Armenian - Armenia */ 'hye' => 'hy',
<ide> /* Basque */ 'baq' => 'eu',
<add> /* Tibetan */ 'bod' => 'bo',
<ide> /* Bosnian */ 'bos' => 'bs',
<ide> /* Bulgarian */ 'bul' => 'bg',
<ide> /* Byelorussian */ 'bel' => 'be',
<ide> class L10n extends Object {
<ide> 'ar-ye' => array('language' => 'Arabic (Yemen)', 'locale' => 'ar_ye', 'localeFallback' => 'ara', 'charset' => 'utf-8', 'direction' => 'rtl'),
<ide> 'be' => array('language' => 'Byelorussian', 'locale' => 'bel', 'localeFallback' => 'bel', 'charset' => 'utf-8', 'direction' => 'ltr'),
<ide> 'bg' => array('language' => 'Bulgarian', 'locale' => 'bul', 'localeFallback' => 'bul', 'charset' => 'utf-8', 'direction' => 'ltr'),
<add> 'bo' => array('language' => 'Tibetan', 'locale' => 'bod', 'localeFallback' => 'bod', 'charset' => 'utf-8', 'direction' => 'ltr'),
<add> 'bo-cn' => array('language' => 'Tibetan (China)', 'locale' => 'bo_cn', 'localeFallback' => 'bod', 'charset' => 'utf-8', 'direction' => 'ltr'),
<add> 'bo-in' => array('language' => 'Tibetan (India)', 'locale' => 'bo_in', 'localeFallback' => 'bod', 'charset' => 'utf-8', 'direction' => 'ltr'),
<ide> 'bs' => array('language' => 'Bosnian', 'locale' => 'bos', 'localeFallback' => 'bos', 'charset' => 'utf-8', 'direction' => 'ltr'),
<ide> 'ca' => array('language' => 'Catalan', 'locale' => 'cat', 'localeFallback' => 'cat', 'charset' => 'utf-8', 'direction' => 'ltr'),
<ide> 'cs' => array('language' => 'Czech', 'locale' => 'cze', 'localeFallback' => 'cze', 'charset' => 'utf-8', 'direction' => 'ltr'), | 1 |
Ruby | Ruby | rename the variable | 40b39151f916e612c1fc7efe259b3fc28efe7336 | <ide><path>Library/Homebrew/diagnostic.rb
<ide> def check_git_status
<ide>
<ide> message = nil
<ide>
<del> taps = {
<add> repos = {
<ide> "Homebrew/brew" => HOMEBREW_REPOSITORY,
<ide> "Homebrew/homebrew-core" => CoreTap.instance.path,
<ide> }
<ide>
<ide> %w[cask cask-drivers cask-fonts cask-versions].each do |tap|
<ide> cask_tap = Tap.fetch "homebrew", tap
<del> taps[cask_tap.full_name] = cask_tap.path if cask_tap.installed?
<add> repos[cask_tap.full_name] = cask_tap.path if cask_tap.installed?
<ide> end
<ide>
<del> taps.each do |name, path|
<add> repos.each do |name, path|
<ide> status = path.cd do
<ide> `git status --untracked-files=all --porcelain 2>/dev/null`
<ide> end | 1 |
Python | Python | fix ticket 526 | 9ddd860b31ea1d4517eb3fff6ab4c280ebb14dec | <ide><path>numpy/distutils/fcompiler/__init__.py
<ide> def find_executables(self):
<ide>
<ide> def get_version_cmd(self):
<ide> """ Compiler command to print out version information. """
<del> f77 = self.executables['compiler_f77']
<add> f77 = self.executables.get('compiler_f77')
<ide> if f77 is not None:
<ide> f77 = f77[0]
<del> cmd = self.executables['version_cmd']
<add> cmd = self.executables.get('version_cmd')
<ide> if cmd is not None:
<ide> cmd = cmd[0]
<ide> if cmd==f77:
<ide> cmd = self.compiler_f77[0]
<ide> else:
<del> f90 = self.executables['compiler_f90']
<add> f90 = self.executables.get('compiler_f90')
<ide> if f90 is not None:
<ide> f90 = f90[0]
<ide> if cmd==f90:
<ide> def get_linker_so(self):
<ide> f77 = self.executables['compiler_f77']
<ide> if f77 is not None:
<ide> f77 = f77[0]
<del> ln = self.executables['linker_so']
<add> ln = self.executables.get('linker_so')
<ide> if ln is not None:
<ide> ln = ln[0]
<ide> if ln==f77:
<ide> ln = self.compiler_f77[0]
<ide> else:
<del> f90 = self.executables['compiler_f90']
<add> f90 = self.executables.get('compiler_f90')
<ide> if f90 is not None:
<ide> f90 = f90[0]
<ide> if ln==f90:
<ide> def get_linker_exe(self):
<ide> if ln==f77:
<ide> ln = self.compiler_f77[0]
<ide> else:
<del> f90 = self.executables['compiler_f90']
<add> f90 = self.executables.get('compiler_f90')
<ide> if f90 is not None:
<ide> f90 = f90[0]
<ide> if ln==f90:
<ide> def get_flags(self):
<ide> return [] + self.pic_flags
<ide> def get_flags_version(self):
<ide> """ List of compiler flags to print out version information. """
<del> if self.executables['version_cmd']:
<add> if self.executables.get('version_cmd'):
<ide> return self.executables['version_cmd'][1:]
<ide> return []
<ide> def get_flags_f77(self):
<ide> """ List of Fortran 77 specific flags. """
<del> if self.executables['compiler_f77']:
<add> if self.executables.get('compiler_f77'):
<ide> return self.executables['compiler_f77'][1:]
<ide> return []
<ide> def get_flags_f90(self):
<ide> """ List of Fortran 90 specific flags. """
<del> if self.executables['compiler_f90']:
<add> if self.executables.get('compiler_f90'):
<ide> return self.executables['compiler_f90'][1:]
<ide> return []
<ide> def get_flags_free(self):
<ide> """ List of Fortran 90 free format specific flags. """
<ide> return []
<ide> def get_flags_fix(self):
<ide> """ List of Fortran 90 fixed format specific flags. """
<del> if self.executables['compiler_fix']:
<add> if self.executables.get('compiler_fix'):
<ide> return self.executables['compiler_fix'][1:]
<ide> return []
<ide> def get_flags_linker_so(self):
<ide> """ List of linker flags to build a shared library. """
<del> if self.executables['linker_so']:
<add> if self.executables.get('linker_so'):
<ide> return self.executables['linker_so'][1:]
<ide> return []
<ide> def get_flags_linker_exe(self):
<ide> """ List of linker flags to build an executable. """
<del> if self.executables['linker_exe']:
<add> if self.executables.get('linker_exe'):
<ide> return self.executables['linker_exe'][1:]
<ide> return []
<ide> def get_flags_ar(self):
<ide> """ List of archiver flags. """
<del> if self.executables['archiver']:
<add> if self.executables.get('archiver'):
<ide> return self.executables['archiver'][1:]
<ide> return []
<ide> def get_flags_opt(self): | 1 |
Python | Python | correct #issue #149 | 9bc874646877accd188ef0ba01c43def26c9a5a0 | <ide><path>glances/glances.py
<ide> import collections
<ide>
<ide> # Somes libs depends of OS
<del>is_Bsd = sys.platform.endswith('bsd')
<add>is_Bsd = sys.platform.find('bsd') != -1
<ide> is_Linux = sys.platform.startswith('linux')
<ide> is_Mac = sys.platform.startswith('darwin')
<ide> is_Windows = sys.platform.startswith('win') | 1 |
Ruby | Ruby | use shasum 256 on the release | 14ab460f8efa9d259cce0b9fa51ce87dc5687207 | <ide><path>tasks/release.rb
<ide> raise "Only valid for patch releases"
<ide> end
<ide>
<del> sums = "$ shasum *-#{version}.gem\n" + `shasum *-#{version}.gem`
<add> sums = "$ shasum -a 256 *-#{version}.gem\n" + `shasum -a 256 *-#{version}.gem`
<ide>
<ide> puts "Hi everyone,"
<ide> puts
<ide> ## SHA-1
<ide>
<ide> If you'd like to verify that your gem is the same as the one I've uploaded,
<del>please use these SHA-1 hashes.
<add>please use these SHA-256 hashes.
<ide>
<ide> Here are the checksums for #{version}:
<ide> | 1 |
Text | Text | add react hook plugin | 6bd1a896570669006eee6e7e9cc2d35af5cf2b52 | <ide><path>ECOSYSTEM.md
<ide> This is a list of axios related libraries and resources. If you have a suggestio
<ide> * [react-hooks-axios](https://github.com/use-hooks/react-hooks-axios) - Custom React Hooks for Axios.js
<ide> * [redux-saga-requests](https://github.com/klis87/redux-saga-requests) - Redux-Saga addon to simplify handling of AJAX requests.
<ide> * [redux-axios-middleware](https://github.com/svrcekmichal/redux-axios-middleware) - Redux middleware for fetching data with axios HTTP client
<add>* [@react-cmpt/react-request-hook](https://github.com/react-cmpt/react-request-hook) - A React hook plugin for axios. Lightweight and less change.
<ide>
<ide> ### Unit testing
<ide> | 1 |
Java | Java | implement eager initialization of fabric | 756eec6cf5a57117810fab1b17d472328da0abb7 | <ide><path>ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java
<ide> private ReactApplicationContext createReactContext(
<ide> }
<ide> }
<ide> }
<add> if (ReactFeatureFlags.eagerInitializeFabric) {
<add> catalystInstance.getJSIModule(JSIModuleType.UIManager);
<add> }
<ide> if (mBridgeIdleDebugListener != null) {
<ide> catalystInstance.addBridgeIdleDebugListener(mBridgeIdleDebugListener);
<ide> } | 1 |
PHP | PHP | use psr7 interfaces internally in auth plugins | 01f016a8497dddc671b7866a35e6e5d06130328a | <ide><path>src/Http/Client.php
<ide> protected function _createRequest($method, $url, $data, $options)
<ide> $request->cookie($options['cookies']);
<ide> }
<ide> if (isset($options['auth'])) {
<del> $this->_addAuthentication($request, $options);
<add> $request = $this->_addAuthentication($request, $options);
<ide> }
<ide> if (isset($options['proxy'])) {
<del> $this->_addProxy($request, $options);
<add> $request = $this->_addProxy($request, $options);
<ide> }
<ide> return $request;
<ide> }
<ide> protected function _typeHeaders($type)
<ide> *
<ide> * @param \Cake\Http\Client\Request $request The request to modify.
<ide> * @param array $options Array of options containing the 'auth' key.
<del> * @return void
<add> * @return \Cake\Http\Client\Request The updated request object.
<ide> */
<ide> protected function _addAuthentication(Request $request, $options)
<ide> {
<ide> $auth = $options['auth'];
<ide> $adapter = $this->_createAuth($auth, $options);
<del> $adapter->authentication($request, $options['auth']);
<add> $result = $adapter->authentication($request, $options['auth']);
<add> return $result ?: $request;
<ide> }
<ide>
<ide> /**
<ide> protected function _addAuthentication(Request $request, $options)
<ide> *
<ide> * @param \Cake\Http\Client\Request $request The request to modify.
<ide> * @param array $options Array of options containing the 'proxy' key.
<del> * @return void
<add> * @return \Cake\Http\Client\Request The updated request object.
<ide> */
<ide> protected function _addProxy(Request $request, $options)
<ide> {
<ide> $auth = $options['proxy'];
<ide> $adapter = $this->_createAuth($auth, $options);
<del> $adapter->proxyAuthentication($request, $options['proxy']);
<add> $result = $adapter->proxyAuthentication($request, $options['proxy']);
<add> return $result ?: $request;
<ide> }
<ide>
<ide> /**
<ide><path>src/Http/Client/Auth/Basic.php
<ide> class Basic
<ide> *
<ide> * @param \Cake\Network\Http\Request $request Request instance.
<ide> * @param array $credentials Credentials.
<del> * @return void
<add> * @return \Cake\Network\Http\Request The updated request.
<ide> * @see http://www.ietf.org/rfc/rfc2617.txt
<ide> */
<ide> public function authentication(Request $request, array $credentials)
<ide> {
<ide> if (isset($credentials['username'], $credentials['password'])) {
<ide> $value = $this->_generateHeader($credentials['username'], $credentials['password']);
<del> $request->header('Authorization', $value);
<add> $request = $request->withHeader('Authorization', $value);
<ide> }
<add> return $request;
<ide> }
<ide>
<ide> /**
<ide> * Proxy Authentication
<ide> *
<ide> * @param \Cake\Network\Http\Request $request Request instance.
<ide> * @param array $credentials Credentials.
<del> * @return void
<add> * @return \Cake\Network\Http\Request The updated request.
<ide> * @see http://www.ietf.org/rfc/rfc2617.txt
<ide> */
<ide> public function proxyAuthentication(Request $request, array $credentials)
<ide> {
<ide> if (isset($credentials['username'], $credentials['password'])) {
<ide> $value = $this->_generateHeader($credentials['username'], $credentials['password']);
<del> $request->header('Proxy-Authorization', $value);
<add> $request = $request->withHeader('Proxy-Authorization', $value);
<ide> }
<add> return $request;
<ide> }
<ide>
<ide> /**
<ide><path>src/Http/Client/Auth/Digest.php
<ide> public function __construct(Client $client, $options = null)
<ide> *
<ide> * @param \Cake\Network\Http\Request $request The request object.
<ide> * @param array $credentials Authentication credentials.
<del> * @return void
<add> * @return \Cake\Network\Http\Request The updated request.
<ide> * @see http://www.ietf.org/rfc/rfc2617.txt
<ide> */
<ide> public function authentication(Request $request, array $credentials)
<ide> {
<ide> if (!isset($credentials['username'], $credentials['password'])) {
<del> return;
<add> return $request;
<ide> }
<ide> if (!isset($credentials['realm'])) {
<ide> $credentials = $this->_getServerInfo($request, $credentials);
<ide> }
<ide> if (!isset($credentials['realm'])) {
<del> return;
<add> return $request;
<ide> }
<ide> $value = $this->_generateHeader($request, $credentials);
<del> $request->header('Authorization', $value);
<add> return $request->withHeader('Authorization', $value);
<ide> }
<ide>
<ide> /**
<ide><path>src/Http/Client/Auth/Oauth.php
<ide> class Oauth
<ide> *
<ide> * @param \Cake\Network\Http\Request $request The request object.
<ide> * @param array $credentials Authentication credentials.
<del> * @return void
<add> * @return \Cake\Network\Http\Request The updated request.
<ide> * @throws \Cake\Core\Exception\Exception On invalid signature types.
<ide> */
<ide> public function authentication(Request $request, array $credentials)
<ide> public function authentication(Request $request, array $credentials)
<ide> $credentials['tokenSecret']
<ide> );
<ide> if (!$hasKeys) {
<del> return;
<add> return $request;
<ide> }
<ide> if (empty($credentials['method'])) {
<ide> $credentials['method'] = 'hmac-sha1';
<ide> public function authentication(Request $request, array $credentials)
<ide> default:
<ide> throw new Exception(sprintf('Unknown Oauth signature method %s', $credentials['method']));
<ide> }
<del> $request->header('Authorization', $value);
<add> return $request->withHeader('Authorization', $value);
<ide> }
<ide>
<ide> /**
<ide><path>tests/TestCase/Network/Http/Auth/DigestTest.php
<ide> public function testRealmAndNonceFromExtraRequest()
<ide> ->will($this->returnValue($response));
<ide>
<ide> $auth = ['username' => 'admin', 'password' => '1234'];
<del> $request = (new Request())->method(Request::METHOD_GET)
<del> ->url('http://example.com/some/path');
<add> $request = new Request('http://example.com/some/path', Request::METHOD_GET);
<add> $request = $this->auth->authentication($request, $auth);
<ide>
<del> $this->auth->authentication($request, $auth);
<del>
<del> $result = $request->header('Authorization');
<add> $result = $request->getHeaderLine('Authorization');
<ide> $this->assertContains('Digest', $result);
<ide> $this->assertContains('realm="The batcave"', $result);
<ide> $this->assertContains('nonce="4cded326c6c51"', $result);
<ide> public function testQop()
<ide> ->will($this->returnValue($response));
<ide>
<ide> $auth = ['username' => 'admin', 'password' => '1234'];
<del> $request = (new Request())->method(Request::METHOD_GET)
<del> ->url('http://example.com/some/path');
<del>
<del> $this->auth->authentication($request, $auth);
<del> $result = $request->header('Authorization');
<add> $request = new Request('http://example.com/some/path', Request::METHOD_GET);
<add> $request = $this->auth->authentication($request, $auth);
<add> $result = $request->getHeaderLine('Authorization');
<ide>
<ide> $this->assertContains('qop="auth"', $result);
<ide> $this->assertContains('nc=00000001', $result);
<ide> public function testOpaque()
<ide> ->will($this->returnValue($response));
<ide>
<ide> $auth = ['username' => 'admin', 'password' => '1234'];
<del> $request = (new Request())->method(Request::METHOD_GET)
<del> ->url('http://example.com/some/path');
<del>
<del> $this->auth->authentication($request, $auth);
<del> $result = $request->header('Authorization');
<add> $request = new Request('http://example.com/some/path', Request::METHOD_GET);
<add> $request = $this->auth->authentication($request, $auth);
<add> $result = $request->getHeaderLine('Authorization');
<ide>
<ide> $this->assertContains('opaque="d8ea7aa61a1693024c4cc3a516f49b3c"', $result);
<ide> }
<ide><path>tests/TestCase/Network/Http/Auth/OauthTest.php
<ide> public function testPlainTextSigning()
<ide> 'method' => 'plaintext',
<ide> ];
<ide> $request = new Request();
<del> $auth->authentication($request, $creds);
<add> $request = $auth->authentication($request, $creds);
<ide>
<del> $result = $request->header('Authorization');
<add> $result = $request->getHeaderLine('Authorization');
<ide> $this->assertContains('OAuth', $result);
<ide> $this->assertContains('oauth_version="1.0"', $result);
<ide> $this->assertContains('oauth_token="a%20token%20value"', $result);
<ide> public function testHmacSigning()
<ide> 'timestamp' => '1191242096'
<ide> ];
<ide> $auth = new Oauth();
<del> $auth->authentication($request, $options);
<add> $request = $auth->authentication($request, $options);
<ide>
<del> $result = $request->header('Authorization');
<add> $result = $request->getHeaderLine('Authorization');
<ide> $expected = 'tR3+Ty81lMeYAr/Fid0kMTYa/WM=';
<ide> $this->assertContains(
<ide> 'oauth_signature="' . $expected . '"',
<ide><path>tests/TestCase/Network/Http/ClientTest.php
<ide> */
<ide> namespace Cake\Test\TestCase\Network\Http;
<ide>
<add>use Cake\Core\Configure;
<ide> use Cake\Network\Http\Client;
<ide> use Cake\Network\Http\Request;
<ide> use Cake\Network\Http\Response;
<ide> public function testGetWithAuthenticationAndProxy()
<ide> $this->assertSame($result, $response);
<ide> }
<ide>
<add> /**
<add> * Test authentication adapter that mutates request.
<add> *
<add> * @return void
<add> */
<add> public function testAuthenticationWithMutation()
<add> {
<add> Configure::write('App.namespace', 'TestApp');
<add> $response = new Response();
<add> $mock = $this->getMock('Cake\Network\Http\Adapter\Stream', ['send']);
<add> $headers = [
<add> 'Authorization' => 'Bearer abc123',
<add> 'Proxy-Authorization' => 'Bearer abc123',
<add> ];
<add> $mock->expects($this->once())
<add> ->method('send')
<add> ->with($this->callback(function ($request) use ($headers) {
<add> $this->assertEquals(Request::METHOD_GET, $request->getMethod());
<add> $this->assertEquals('http://cakephp.org/', '' . $request->getUri());
<add> $this->assertEquals($headers['Authorization'], $request->getHeaderLine('Authorization'));
<add> $this->assertEquals($headers['Proxy-Authorization'], $request->getHeaderLine('Proxy-Authorization'));
<add> return true;
<add> }))
<add> ->will($this->returnValue([$response]));
<add>
<add> $http = new Client([
<add> 'host' => 'cakephp.org',
<add> 'adapter' => $mock
<add> ]);
<add> $result = $http->get('/', [], [
<add> 'auth' => ['type' => 'TestApp\Http\CompatAuth'],
<add> 'proxy' => ['type' => 'TestApp\Http\CompatAuth'],
<add> ]);
<add> $this->assertSame($result, $response);
<add> }
<add>
<ide> /**
<ide> * Return a list of HTTP methods.
<ide> *
<ide><path>tests/test_app/TestApp/Http/CompatAuth.php
<add><?php
<add>/**
<add> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<add> *
<add> * Licensed under The MIT License
<add> * Redistributions of files must retain the above copyright notice.
<add> *
<add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<add> * @link http://cakephp.org CakePHP(tm) Project
<add> * @since 3.3.0
<add> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<add> */
<add>namespace TestApp\Http;
<add>
<add>use Cake\Network\Http\Request;
<add>
<add>/**
<add> * Testing stub to ensure that auth providers
<add> * that mutate requests in place continue to work.
<add> *
<add> * @deprecated 3.3.0 Remove this compatibility behavior in 4.0.0
<add> */
<add>class CompatAuth
<add>{
<add>
<add> /**
<add> * Add Authorization header to the request via in-place mutation methods.
<add> *
<add> * @param \Cake\Network\Http\Request $request Request instance.
<add> * @param array $credentials Credentials.
<add> * @return \Cake\Network\Http\Request The updated request.
<add> */
<add> public function authentication(Request $request, array $credentials)
<add> {
<add> $request->header('Authorization', 'Bearer abc123');
<add> }
<add>
<add> /**
<add> * Proxy Authentication added via in-place mutation methods.
<add> *
<add> * @param \Cake\Network\Http\Request $request Request instance.
<add> * @param array $credentials Credentials.
<add> * @return \Cake\Network\Http\Request The updated request.
<add> */
<add> public function proxyAuthentication(Request $request, array $credentials)
<add> {
<add> $request->header('Proxy-Authorization', 'Bearer abc123');
<add> }
<add>
<add>} | 8 |
Javascript | Javascript | apply default export interop to `next/config` | 8698b4927cdf82773812ae2461919255644945db | <ide><path>packages/next/taskfile.js
<ide> export default async function (task) {
<ide> await task.watch('telemetry/**/*.+(js|ts|tsx)', 'telemetry', opts)
<ide> await task.watch('trace/**/*.+(js|ts|tsx)', 'trace', opts)
<ide> await task.watch(
<del> 'shared/lib/{amp,config,constants,dynamic,head}.+(js|ts|tsx)',
<add> 'shared/lib/{amp,config,constants,dynamic,head,runtime-config}.+(js|ts|tsx)',
<ide> 'shared_re_exported',
<ide> opts
<ide> )
<ide> await task.watch(
<del> 'shared/**/!(amp|config|constants|dynamic|head).+(js|ts|tsx)',
<add> 'shared/**/!(amp|config|constants|dynamic|head|runtime-config).+(js|ts|tsx)',
<ide> 'shared',
<ide> opts
<ide> )
<ide> export default async function (task) {
<ide> export async function shared(task, opts) {
<ide> await task
<ide> .source(
<del> opts.src || 'shared/**/!(amp|config|constants|dynamic|head).+(js|ts|tsx)'
<add> opts.src ||
<add> 'shared/**/!(amp|config|constants|dynamic|head|runtime-config).+(js|ts|tsx)'
<ide> )
<ide> .swc('client', { dev: opts.dev })
<ide> .target('dist/shared')
<ide> export async function shared(task, opts) {
<ide> export async function shared_re_exported(task, opts) {
<ide> await task
<ide> .source(
<del> opts.src || 'shared/**/{amp,config,constants,dynamic,head}.+(js|ts|tsx)'
<add> opts.src ||
<add> 'shared/**/{amp,config,constants,dynamic,head,runtime-config}.+(js|ts|tsx)'
<ide> )
<ide> .swc('client', { dev: opts.dev, interopClientDefaultExport: true })
<ide> .target('dist/shared') | 1 |
Python | Python | use reference for inf/nan | a90b4b27d5cdfeb558bdf51c1dc988204d730f72 | <ide><path>numpy/core/tests/test_print.py
<ide> def _test_redirected_print(x, tp, ref=None):
<ide> err_msg='print failed for type%s' % tp)
<ide>
<ide> def check_float_type_print(tp):
<del> for x in [0, 1,-1, 1e20, np.inf, -np.inf, np.nan]:
<add> for x in [0, 1,-1, 1e20]:
<ide> _test_redirected_print(float(x), tp)
<ide>
<add> for x in [np.inf, -np.inf, np.nan]:
<add> _test_redirected_print(float(x), tp, _REF[x])
<add>
<ide> if tp(1e10).itemsize > 4:
<ide> _test_redirected_print(float(1e10), tp)
<ide> else:
<ide> def check_float_type_print(tp):
<ide> def check_complex_type_print(tp):
<ide> # We do not create complex with inf/nan directly because the feature is
<ide> # missing in python < 2.6
<del> for x in [0, 1, -1, 1e20, complex(np.inf, 1),
<del> complex(np.nan, 1), complex(-np.inf, 1)] :
<add> for x in [0, 1, -1, 1e20]:
<ide> _test_redirected_print(complex(x), tp)
<ide>
<ide> if tp(1e10).itemsize > 8:
<ide> def check_complex_type_print(tp):
<ide> ref = '(1e+10+0j)'
<ide> _test_redirected_print(complex(1e10), tp, ref)
<ide>
<add> _test_redirected_print(complex(np.inf, 1), tp, '(inf+1j)')
<add> _test_redirected_print(complex(-np.inf, 1), tp, '(-inf+1j)')
<add> _test_redirected_print(complex(-np.nan, 1), tp, '(nan+1j)')
<add>
<ide> def test_float_type_print():
<ide> """Check formatting when using print """
<ide> for t in [np.float32, np.double, np.longdouble] : | 1 |
Javascript | Javascript | fix memory leaks in safari, edge, and ie | 142cc678cb32ded17835915e08c763af7aae1385 | <ide><path>src/js/resize-manager.js
<ide> class ResizeManager extends Component {
<ide> return;
<ide> }
<ide>
<del> Events.on(this.el_.contentWindow, 'resize', this.debouncedHandler_);
<add> const debouncedHandler_ = this.debouncedHandler_;
<add> let unloadListener_ = this.unloadListener_ = function() {
<add> Events.off(this, 'resize', debouncedHandler_);
<add> Events.off(this, 'unload', unloadListener_);
<add>
<add> unloadListener_ = null;
<add> };
<add>
<add> // safari and edge can unload the iframe before resizemanager dispose
<add> // we have to dispose of event handlers correctly before that happens
<add> Events.on(this.el_.contentWindow, 'unload', unloadListener_);
<add> Events.on(this.el_.contentWindow, 'resize', debouncedHandler_);
<ide> };
<ide>
<ide> this.one('load', this.loadListener_);
<ide> class ResizeManager extends Component {
<ide> this.resizeObserver_.disconnect();
<ide> }
<ide>
<del> if (this.el_ && this.el_.contentWindow) {
<del> Events.off(this.el_.contentWindow, 'resize', this.debouncedHandler_);
<del> }
<del>
<ide> if (this.loadListener_) {
<ide> this.off('load', this.loadListener_);
<ide> }
<ide>
<add> if (this.el_ && this.el_.contentWindow && this.unloadListener_) {
<add> this.unloadListener_.call(this.el_.contentWindow);
<add> }
<add>
<ide> this.ResizeObserver = null;
<ide> this.resizeObserver = null;
<ide> this.debouncedHandler_ = null;
<ide><path>src/js/tracks/audio-track-list.js
<ide> class AudioTrackList extends TrackList {
<ide> return;
<ide> }
<ide>
<add> if (!this.enabledChange_) {
<add> this.enabledChange_ = () => {
<add> // when we are disabling other tracks (since we don't support
<add> // more than one track at a time) we will set changing_
<add> // to true so that we don't trigger additional change events
<add> if (this.changing_) {
<add> return;
<add> }
<add> this.changing_ = true;
<add> disableOthers(this, track);
<add> this.changing_ = false;
<add> this.trigger('change');
<add> };
<add> }
<add>
<ide> /**
<ide> * @listens AudioTrack#enabledchange
<ide> * @fires TrackList#change
<ide> */
<del> track.addEventListener('enabledchange', () => {
<del> // when we are disabling other tracks (since we don't support
<del> // more than one track at a time) we will set changing_
<del> // to true so that we don't trigger additional change events
<del> if (this.changing_) {
<del> return;
<del> }
<del> this.changing_ = true;
<del> disableOthers(this, track);
<del> this.changing_ = false;
<del> this.trigger('change');
<del> });
<add> track.addEventListener('enabledchange', this.enabledChange_);
<add> }
<add>
<add> removeTrack(rtrack) {
<add> super.removeTrack(rtrack);
<add>
<add> if (rtrack.removeEventListener && this.enabledChange_) {
<add> rtrack.removeEventListener('enabledchange', this.enabledChange_);
<add> }
<ide> }
<ide> }
<ide>
<ide><path>src/js/tracks/text-track-list.js
<ide> * @file text-track-list.js
<ide> */
<ide> import TrackList from './track-list';
<del>import * as Fn from '../utils/fn.js';
<ide>
<ide> /**
<ide> * The current list of {@link TextTrack} for a media file.
<ide> class TextTrackList extends TrackList {
<ide> addTrack(track) {
<ide> super.addTrack(track);
<ide>
<add> if (!this.queueChange_) {
<add> this.queueChange_ = () => this.queueTrigger('change');
<add> }
<add> if (!this.triggerSelectedlanguagechange) {
<add> this.triggerSelectedlanguagechange_ = () => this.trigger('selectedlanguagechange');
<add> }
<add>
<ide> /**
<ide> * @listens TextTrack#modechange
<ide> * @fires TrackList#change
<ide> */
<del> track.addEventListener('modechange', Fn.bind(this, function() {
<del> this.queueTrigger('change');
<del> }));
<del>
<add> track.addEventListener('modechange', this.queueChange_);
<ide> const nonLanguageTextTrackKind = ['metadata', 'chapters'];
<ide>
<ide> if (nonLanguageTextTrackKind.indexOf(track.kind) === -1) {
<del> track.addEventListener('modechange', Fn.bind(this, function() {
<del> this.trigger('selectedlanguagechange');
<del> }));
<add> track.addEventListener('modechange', this.triggerSelectedlanguagechange_);
<add> }
<add> }
<add>
<add> removeTrack(rtrack) {
<add> super.removeTrack(rtrack);
<add>
<add> // manually remove the event handlers we added
<add> if (rtrack.removeEventListener) {
<add> if (this.queueChange_) {
<add> rtrack.removeEventListener('modechange', this.queueChange_);
<add> }
<add> if (this.selectedlanguagechange_) {
<add> rtrack.removeEventListener('modechange', this.triggerSelectedlanguagechange_);
<add> }
<ide> }
<ide> }
<ide> }
<ide><path>src/js/tracks/video-track-list.js
<ide> class VideoTrackList extends TrackList {
<ide> return;
<ide> }
<ide>
<add> if (!this.selectedChange_) {
<add> this.selectedChange_ = () => {
<add> if (this.changing_) {
<add> return;
<add> }
<add> this.changing_ = true;
<add> disableOthers(this, track);
<add> this.changing_ = false;
<add> this.trigger('change');
<add> };
<add> }
<add>
<ide> /**
<ide> * @listens VideoTrack#selectedchange
<ide> * @fires TrackList#change
<ide> */
<del> track.addEventListener('selectedchange', () => {
<del> if (this.changing_) {
<del> return;
<del> }
<del> this.changing_ = true;
<del> disableOthers(this, track);
<del> this.changing_ = false;
<del> this.trigger('change');
<del> });
<add> track.addEventListener('selectedchange', this.selectedChange_);
<add> }
<add>
<add> removeTrack(rtrack) {
<add> super.removeTrack(rtrack);
<add>
<add> if (rtrack.removeEventListener && this.selectedChange_) {
<add> rtrack.removeEventListener('selectedchange', this.selectedChange_);
<add> }
<ide> }
<ide> }
<ide>
<ide><path>test/unit/tracks/text-track-list-converter.test.js
<ide> if (Html5.supportsNativeTextTracks()) {
<ide> c.jsonToTextTracks(cleanup(c.textTracksToJson(tech)), tech);
<ide>
<ide> assert.equal(addRemotes, 2, 'we added two text tracks');
<add>
<add> tt.removeTrack(nativeTrack.track);
<add> tt.removeTrack(emulatedTrack);
<ide> });
<ide> }
<ide>
<ide><path>test/unit/tracks/text-tracks.test.js
<ide> if (Html5.supportsNativeTextTracks()) {
<ide> assert.equal(emulatedTt.length, tt.length, 'we have matching tracks length');
<ide> assert.equal(emulatedTt.length, 1, 'we have one text track');
<ide>
<del> emulatedTt.off('addtrack', addtrack);
<ide> el.removeChild(track);
<ide> };
<ide>
<del> emulatedTt.on('addtrack', addtrack);
<del> emulatedTt.on('removetrack', function() {
<add> emulatedTt.one('addtrack', addtrack);
<add> emulatedTt.one('removetrack', function() {
<ide> assert.equal(emulatedTt.length, tt.length, 'we have matching tracks length');
<ide> assert.equal(emulatedTt.length, 0, 'we have no more text tracks');
<ide>
<ide><path>test/unit/utils/dom-data.test.js
<ide> import document from 'global/document';
<ide> import * as DomData from '../../../src/js/utils/dom-data';
<ide> import videojs from '../../../src/js/video.js';
<add>import window from 'global/window';
<ide>
<ide> QUnit.module('dom-data');
<ide>
<ide> QUnit.done(function(details) {
<ide> return;
<ide> }
<ide>
<del> // TODO: fix memory leaks on the following
<del> if (videojs.browser.IS_SAFARI || videojs.browser.IS_EDGE || videojs.browser.IE_VERSION) {
<del> return;
<del> }
<del>
<ide> memoryTestRun = true;
<ide>
<ide> QUnit.module('dom-data memory');
<ide> QUnit.done(function(details) {
<ide> QUnit.test('Memory is not leaking', function(assert) {
<ide> if (Object.keys(DomData.elData).length > 0) {
<ide> videojs.domData = DomData;
<add> window.videojs = videojs;
<ide> }
<ide> assert.equal(Object.keys(DomData.elData).length, 0, 'no leaks, check videojs.domData.elData if failure');
<ide> }); | 7 |
Javascript | Javascript | use unbound to assert dom rerender | 97fa5ea1e36bbb9fece7dc13e9706ba82d8e6d50 | <ide><path>packages/ember-views/tests/views/view/view_lifecycle_test.js
<ide> QUnit.test("should throw an exception when calling appendChild when DOM element
<ide> }, null, "throws an exception when calling appendChild after element is created");
<ide> });
<ide>
<del>QUnit.skip("should replace DOM representation if rerender() is called after element is created", function() {
<add>QUnit.test("should replace DOM representation if rerender() is called after element is created", function() {
<ide> run(function() {
<del> view = EmberView.create({
<del> template(context, options) {
<del> var buffer = options.data.buffer;
<del> var value = context.get('shape');
<del>
<del> buffer.push("Do not taunt happy fun "+value);
<add> view = EmberView.createWithMixins({
<add> template: compile("Do not taunt happy fun {{unbound view.shape}}"),
<add> rerender() {
<add> this._super.apply(this, arguments);
<ide> },
<del>
<del> context: EmberObject.create({
<del> shape: 'sphere'
<del> })
<add> shape: 'sphere'
<ide> });
<ide>
<add> view.volatileProp = view.get('context.shape');
<ide> view.append();
<ide> });
<ide>
<del> equal(view.$().text(), "Do not taunt happy fun sphere", "precond - creates DOM element");
<add> equal(view.$().text(), "Do not taunt happy fun sphere",
<add> "precond - creates DOM element");
<add>
<add> view.shape = 'ball';
<add>
<add> equal(view.$().text(), "Do not taunt happy fun sphere",
<add> "precond - keeps DOM element");
<ide>
<del> view.set('context.shape', 'ball');
<ide> run(function() {
<ide> view.rerender();
<ide> });
<ide>
<del> equal(view.$().text(), "Do not taunt happy fun ball", "rerenders DOM element when rerender() is called");
<add> equal(view.$().text(), "Do not taunt happy fun ball",
<add> "rerenders DOM element when rerender() is called");
<ide> });
<ide>
<ide> QUnit.test("should destroy DOM representation when destroyElement is called", function() { | 1 |
Javascript | Javascript | upgrade commonjsplugin to es6 | 1caeb72b4d49bf5c2d65ee23b582250b2dde0aa2 | <ide><path>lib/dependencies/CommonJsPlugin.js
<ide> Author Tobias Koppers @sokra
<ide> */
<ide> "use strict";
<del>
<del>var ConstDependency = require("./ConstDependency");
<del>var CommonJsRequireDependency = require("./CommonJsRequireDependency");
<del>var CommonJsRequireContextDependency = require("./CommonJsRequireContextDependency");
<del>var RequireResolveDependency = require("./RequireResolveDependency");
<del>var RequireResolveContextDependency = require("./RequireResolveContextDependency");
<del>var RequireResolveHeaderDependency = require("./RequireResolveHeaderDependency");
<del>var RequireHeaderDependency = require("./RequireHeaderDependency");
<del>
<del>var NullFactory = require("../NullFactory");
<del>
<del>var RequireResolveDependencyParserPlugin = require("./RequireResolveDependencyParserPlugin");
<del>var CommonJsRequireDependencyParserPlugin = require("./CommonJsRequireDependencyParserPlugin");
<del>
<del>var ParserHelpers = require("../ParserHelpers");
<del>
<del>function CommonJsPlugin(options) {
<del> this.options = options;
<del>}
<del>module.exports = CommonJsPlugin;
<del>
<del>CommonJsPlugin.prototype.apply = function(compiler) {
<del> var options = this.options;
<del> compiler.plugin("compilation", function(compilation, params) {
<del> var normalModuleFactory = params.normalModuleFactory;
<del> var contextModuleFactory = params.contextModuleFactory;
<del>
<del> compilation.dependencyFactories.set(CommonJsRequireDependency, normalModuleFactory);
<del> compilation.dependencyTemplates.set(CommonJsRequireDependency, new CommonJsRequireDependency.Template());
<del>
<del> compilation.dependencyFactories.set(CommonJsRequireContextDependency, contextModuleFactory);
<del> compilation.dependencyTemplates.set(CommonJsRequireContextDependency, new CommonJsRequireContextDependency.Template());
<del>
<del> compilation.dependencyFactories.set(RequireResolveDependency, normalModuleFactory);
<del> compilation.dependencyTemplates.set(RequireResolveDependency, new RequireResolveDependency.Template());
<del>
<del> compilation.dependencyFactories.set(RequireResolveContextDependency, contextModuleFactory);
<del> compilation.dependencyTemplates.set(RequireResolveContextDependency, new RequireResolveContextDependency.Template());
<del>
<del> compilation.dependencyFactories.set(RequireResolveHeaderDependency, new NullFactory());
<del> compilation.dependencyTemplates.set(RequireResolveHeaderDependency, new RequireResolveHeaderDependency.Template());
<del>
<del> compilation.dependencyFactories.set(RequireHeaderDependency, new NullFactory());
<del> compilation.dependencyTemplates.set(RequireHeaderDependency, new RequireHeaderDependency.Template());
<del>
<del> params.normalModuleFactory.plugin("parser", function(parser, parserOptions) {
<del>
<del> if(typeof parserOptions.commonjs !== "undefined" && !parserOptions.commonjs)
<del> return;
<del>
<del> const requireExpressions = ["require", "require.resolve", "require.resolveWeak"];
<del> for(const expression of requireExpressions) {
<del> parser.plugin(`typeof ${expression}`, ParserHelpers.toConstantDependency(JSON.stringify("function")));
<del> parser.plugin(`evaluate typeof ${expression}`, ParserHelpers.evaluateToString("function"));
<del> }
<del>
<del> parser.plugin("evaluate typeof module", ParserHelpers.evaluateToString("object"));
<del> parser.plugin("assign require", function(expr) {
<del> // to not leak to global "require", we need to define a local require here.
<del> var dep = new ConstDependency("var require;", 0);
<del> dep.loc = expr.loc;
<del> this.state.current.addDependency(dep);
<del> this.scope.definitions.push("require");
<del> return true;
<del> });
<del> parser.plugin("can-rename require", ParserHelpers.approve);
<del> parser.plugin("rename require", function(expr) {
<del> // define the require variable. It's still undefined, but not "not defined".
<del> var dep = new ConstDependency("var require;", 0);
<del> dep.loc = expr.loc;
<del> this.state.current.addDependency(dep);
<del> return false;
<add>const ConstDependency = require("./ConstDependency");
<add>const CommonJsRequireDependency = require("./CommonJsRequireDependency");
<add>const CommonJsRequireContextDependency = require("./CommonJsRequireContextDependency");
<add>const RequireResolveDependency = require("./RequireResolveDependency");
<add>const RequireResolveContextDependency = require("./RequireResolveContextDependency");
<add>const RequireResolveHeaderDependency = require("./RequireResolveHeaderDependency");
<add>const RequireHeaderDependency = require("./RequireHeaderDependency");
<add>
<add>const NullFactory = require("../NullFactory");
<add>
<add>const RequireResolveDependencyParserPlugin = require("./RequireResolveDependencyParserPlugin");
<add>const CommonJsRequireDependencyParserPlugin = require("./CommonJsRequireDependencyParserPlugin");
<add>
<add>const ParserHelpers = require("../ParserHelpers");
<add>
<add>class CommonJsPlugin {
<add> constructor(options) {
<add> this.options = options;
<add> }
<add>
<add> apply(compiler) {
<add> const options = this.options;
<add> compiler.plugin("compilation", (compilation, params) => {
<add> const normalModuleFactory = params.normalModuleFactory;
<add> const contextModuleFactory = params.contextModuleFactory;
<add>
<add> compilation.dependencyFactories.set(CommonJsRequireDependency, normalModuleFactory);
<add> compilation.dependencyTemplates.set(CommonJsRequireDependency, new CommonJsRequireDependency.Template());
<add>
<add> compilation.dependencyFactories.set(CommonJsRequireContextDependency, contextModuleFactory);
<add> compilation.dependencyTemplates.set(CommonJsRequireContextDependency, new CommonJsRequireContextDependency.Template());
<add>
<add> compilation.dependencyFactories.set(RequireResolveDependency, normalModuleFactory);
<add> compilation.dependencyTemplates.set(RequireResolveDependency, new RequireResolveDependency.Template());
<add>
<add> compilation.dependencyFactories.set(RequireResolveContextDependency, contextModuleFactory);
<add> compilation.dependencyTemplates.set(RequireResolveContextDependency, new RequireResolveContextDependency.Template());
<add>
<add> compilation.dependencyFactories.set(RequireResolveHeaderDependency, new NullFactory());
<add> compilation.dependencyTemplates.set(RequireResolveHeaderDependency, new RequireResolveHeaderDependency.Template());
<add>
<add> compilation.dependencyFactories.set(RequireHeaderDependency, new NullFactory());
<add> compilation.dependencyTemplates.set(RequireHeaderDependency, new RequireHeaderDependency.Template());
<add>
<add> params.normalModuleFactory.plugin("parser", (parser, parserOptions) => {
<add>
<add> if(typeof parserOptions.commonjs !== "undefined" && !parserOptions.commonjs)
<add> return;
<add>
<add> const requireExpressions = ["require", "require.resolve", "require.resolveWeak"];
<add> for(const expression of requireExpressions) {
<add> parser.plugin(`typeof ${expression}`, ParserHelpers.toConstantDependency("function"));
<add> parser.plugin(`evaluate typeof ${expression}`, ParserHelpers.evaluateToString("function"));
<add> }
<add>
<add> parser.plugin("evaluate typeof module", ParserHelpers.evaluateToString("object"));
<add> parser.plugin("assign require", (expr) => {
<add> // to not leak to global "require", we need to define a local require here.
<add> const dep = new ConstDependency("var require;", 0);
<add> dep.loc = expr.loc;
<add> parser.state.current.addDependency(dep);
<add> parser.scope.definitions.push("require");
<add> return true;
<add> });
<add> parser.plugin("can-rename require", () => true);
<add> parser.plugin("rename require", (expr) => {
<add> // define the require variable. It's still undefined, but not "not defined".
<add> const dep = new ConstDependency("var require;", 0);
<add> dep.loc = expr.loc;
<add> parser.state.current.addDependency(dep);
<add> return false;
<add> });
<add> parser.plugin("typeof module", () => true);
<add> parser.plugin("evaluate typeof exports", ParserHelpers.evaluateToString("object"));
<add> parser.apply(
<add> new CommonJsRequireDependencyParserPlugin(options),
<add> new RequireResolveDependencyParserPlugin(options)
<add> );
<ide> });
<del> parser.plugin("typeof module", ParserHelpers.skipTraversal);
<del> parser.plugin("evaluate typeof exports", ParserHelpers.evaluateToString("object"));
<del> parser.apply(
<del> new CommonJsRequireDependencyParserPlugin(options),
<del> new RequireResolveDependencyParserPlugin(options)
<del> );
<ide> });
<del> });
<del>
<del>};
<add> }
<add>}
<add>module.exports = CommonJsPlugin; | 1 |
Text | Text | check the return message of docker service inspect | 68ef2569842f8ca4dd09a85caca1970d95946547 | <ide><path>docs/swarm/swarm-tutorial/delete-service.md
<ide> removed the service. The CLI returns a message that the service is not found:
<ide> ```
<ide> $ docker service inspect helloworld
<ide> []
<del> Error: no such service or task: helloworld
<add> Error: no such service: helloworld
<ide> ```
<ide>
<ide> ## What's next? | 1 |
Text | Text | loosen the "public" condition on getssp | e69820accc313bbe81659bff5b42a7037f22541e | <ide><path>docs/basic-features/data-fetching/get-static-props.md
<ide> You should use `getStaticProps` if:
<ide>
<ide> - The data required to render the page is available at build time ahead of a user’s request
<ide> - The data comes from a headless CMS
<del>- The data can be publicly cached (not user-specific)
<ide> - The page must be pre-rendered (for SEO) and be very fast — `getStaticProps` generates `HTML` and `JSON` files, both of which can be cached by a CDN for performance
<add>- The data can be publicly cached (not user-specific). This condition can be bypassed in certain specific situation by using a Middleware to rewrite the path.
<ide>
<ide> ## When does getStaticProps run
<ide> | 1 |
Ruby | Ruby | improve rspec readability | e096836b7b46e605fb4d1c10c632157dd6b11186 | <ide><path>Library/Homebrew/test/utils/github_spec.rb
<ide> describe "::search_issues", :needs_network do
<ide> it "queries GitHub issues with the passed parameters" do
<ide> results = subject.search_issues("brew search", repo: "Homebrew/brew", author: "avetamine", is: "closed")
<del> expect(results.count).to be > 1
<add> expect(results.count).not_to be_empty
<ide> expect(results.last["title"]).to eq("brew search : 422 Unprocessable Entity")
<ide> end
<ide> end | 1 |
PHP | PHP | remove debug code left in before commit | 0dd8b55d8261cbe01ce03dffc056b8ba14a14835 | <ide><path>libs/view.php
<ide> function render($action=null, $layout=null, $file=null)
<ide> // What is reason for these being the same?
<ide> if (isset($this->hasRendered) && $this->hasRendered)
<ide> {
<del> //echo "<pre>";
<del> //print_r($this);
<del> //echo "</pre>";
<ide> return true;
<ide> }
<ide> else | 1 |
Javascript | Javascript | fix tests after v8 upgrade | 9940766f8a09c2eec06f582cbb0b4883f601be89 | <ide><path>test/parallel/test-child-process-fork-exec-argv.js
<ide> if (process.argv[2] === 'fork') {
<ide> } else if (process.argv[2] === 'child') {
<ide> fork(__filename, ['fork']);
<ide> } else {
<del> var execArgv = ['--harmony_proxies', '--stack-size=256'];
<add> var execArgv = ['--stack-size=256'];
<ide> var args = [__filename, 'child', 'arg0'];
<ide>
<ide> var child = spawn(process.execPath, execArgv.concat(args));
<ide><path>test/parallel/test-console.js
<ide> for (const expected of expectedStrings) {
<ide> assert.equal(expected + '\n', errStrings.shift()); // console.warn (stderr)
<ide> }
<ide>
<del>assert.equal("{ foo: 'bar', inspect: [Function] }\n", strings.shift());
<del>assert.equal("{ foo: 'bar', inspect: [Function] }\n", strings.shift());
<add>assert.equal("{ foo: 'bar', inspect: [Function: inspect] }\n", strings.shift());
<add>assert.equal("{ foo: 'bar', inspect: [Function: inspect] }\n", strings.shift());
<ide> assert.notEqual(-1, strings.shift().indexOf('foo: [Object]'));
<ide> assert.equal(-1, strings.shift().indexOf('baz'));
<ide> assert.ok(/^label: \d+\.\d{3}ms$/.test(strings.shift().trim()));
<ide><path>test/parallel/test-process-exec-argv.js
<ide> var spawn = require('child_process').spawn;
<ide> if (process.argv[2] === 'child') {
<ide> process.stdout.write(JSON.stringify(process.execArgv));
<ide> } else {
<del> var execArgv = ['--harmony_proxies', '--stack-size=256'];
<add> var execArgv = ['--stack-size=256'];
<ide> var args = [__filename, 'child', 'arg0'];
<ide> var child = spawn(process.execPath, execArgv.concat(args));
<ide> var out = '';
<ide><path>test/parallel/test-repl.js
<ide> function error_test() {
<ide> { client: client_unix, send: '(function() { "use strict"; eval = 17; })()',
<ide> expect: /^SyntaxError: Unexpected eval or arguments in strict mode/ },
<ide> { client: client_unix, send: '(function() { "use strict"; if (true) function f() { } })()',
<del> expect: /^SyntaxError: In strict mode code, functions can only be declared at top level or immediately within another function/ },
<add> expect: /^SyntaxError: In strict mode code, functions can only be declared at top level or inside a block./ },
<ide> // Named functions can be used:
<ide> { client: client_unix, send: 'function blah() { return 1; }',
<ide> expect: prompt_unix },
<ide> function error_test() {
<ide> expect: 'Invalid REPL keyword\n' + prompt_unix },
<ide> // fail when we are not inside a String and a line continuation is used
<ide> { client: client_unix, send: '[] \\',
<del> expect: /^SyntaxError: Unexpected token ILLEGAL/ },
<add> expect: /^SyntaxError: Invalid or unexpected token/ },
<ide> // do not fail when a String is created with line continuation
<ide> { client: client_unix, send: '\'the\\\nfourth\\\neye\'',
<ide> expect: prompt_multiline + prompt_multiline +
<ide> function error_test() {
<ide> // Illegal token is not recoverable outside string literal, RegExp literal,
<ide> // or block comment. https://github.com/nodejs/node/issues/3611
<ide> { client: client_unix, send: 'a = 3.5e',
<del> expect: /^SyntaxError: Unexpected token ILLEGAL/ },
<add> expect: /^SyntaxError: Invalid or unexpected token/ },
<ide> ]);
<ide> }
<ide>
<ide><path>test/parallel/test-util-inspect-proxy.js
<ide> assert.strictEqual(target, details[0]);
<ide> assert.strictEqual(handler, details[1]);
<ide>
<ide> assert.strictEqual(util.inspect(proxyObj, opts),
<del> 'Proxy [ {}, { get: [Function] } ]');
<add> 'Proxy [ {}, { get: [Function: get] } ]');
<ide>
<ide> // Using getProxyDetails with non-proxy returns undefined
<ide> assert.strictEqual(processUtil.getProxyDetails({}), undefined);
<ide><path>test/parallel/test-util-inspect.js
<ide> assert.equal(util.inspect([1, [2, 3]]), '[ 1, [ 2, 3 ] ]');
<ide>
<ide> assert.equal(util.inspect({}), '{}');
<ide> assert.equal(util.inspect({a: 1}), '{ a: 1 }');
<del>assert.equal(util.inspect({a: function() {}}), '{ a: [Function] }');
<add>assert.equal(util.inspect({a: function() {}}), '{ a: [Function: a] }');
<ide> assert.equal(util.inspect({a: 1, b: 2}), '{ a: 1, b: 2 }');
<ide> assert.equal(util.inspect({'a': {}}), '{ a: {} }');
<ide> assert.equal(util.inspect({'a': {'b': 2}}), '{ a: { b: 2 } }');
<ide> assert.equal(util.inspect(value), '[ 1, 2, 3, growingLength: [Getter] ]');
<ide> // Function with properties
<ide> value = function() {};
<ide> value.aprop = 42;
<del>assert.equal(util.inspect(value), '{ [Function] aprop: 42 }');
<add>assert.equal(util.inspect(value), '{ [Function: value] aprop: 42 }');
<ide>
<ide> // Regular expressions with properties
<ide> value = /123/ig;
<ide><path>test/parallel/test-util-log.js
<ide> var tests = [
<ide> {input: null, output: 'null'},
<ide> {input: false, output: 'false'},
<ide> {input: 42, output: '42'},
<del> {input: function() {}, output: '[Function]'},
<add> {input: function() {}, output: '[Function: input]'},
<ide> {input: parseInt('not a number', 10), output: 'NaN'},
<ide> {input: {answer: 42}, output: '{ answer: 42 }'},
<ide> {input: [1, 2, 3], output: '[ 1, 2, 3 ]'} | 7 |
Python | Python | fix albert example | 33adab2b91697b3e78af618a21ab9f1176281165 | <ide><path>transformers/modeling_tf_albert.py
<ide> class TFAlbertModel(TFAlbertPreTrainedModel):
<ide> import tensorflow as tf
<ide> from transformers import AlbertTokenizer, TFAlbertModel
<ide>
<del> tokenizer = AlbertTokenizer.from_pretrained('bert-base-uncased')
<del> model = TFAlbertModel.from_pretrained('bert-base-uncased')
<add> tokenizer = AlbertTokenizer.from_pretrained('albert-base-v1')
<add> model = TFAlbertModel.from_pretrained('albert-base-v1')
<ide> input_ids = tf.constant(tokenizer.encode("Hello, my dog is cute"))[None, :] # Batch size 1
<ide> outputs = model(input_ids)
<ide> last_hidden_states = outputs[0] # The last hidden-state is the first element of the output tuple
<ide><path>transformers/modeling_utils.py
<ide> def from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs):
<ide> model = BertModel.from_pretrained('./tf_model/my_tf_checkpoint.ckpt.index', from_tf=True, config=config)
<ide>
<ide> """
<del> if pretrained_model_name_or_path is not None and (
<del> "albert" in pretrained_model_name_or_path and "v2" in pretrained_model_name_or_path):
<del> logger.warning("There is currently an upstream reproducibility issue with ALBERT v2 models. Please see " +
<del> "https://github.com/google-research/google-research/issues/119 for more information.")
<del>
<ide> config = kwargs.pop('config', None)
<ide> state_dict = kwargs.pop('state_dict', None)
<ide> cache_dir = kwargs.pop('cache_dir', None) | 2 |
Javascript | Javascript | remove debug code | b4e3554af25d7dfd09a9496a515c33dbdc1010c4 | <ide><path>src/fonts.js
<ide> var Font = (function FontClosure() {
<ide> }
<ide> properties.baseEncoding = encoding;
<ide> }
<del> if (false && properties.subtype == 'CIDFontType0C') {
<add> if (properties.subtype == 'CIDFontType0C') {
<ide> var toFontChar = [];
<ide> for (var i = 0; i < charstrings.length; ++i) {
<ide> var charstring = charstrings[i]; | 1 |
Javascript | Javascript | add better explanation for error status codes | 0727bfc141db6e60bce2fb1e09ad4f53963dec5d | <ide><path>src/ng/http.js
<ide> function $HttpProvider() {
<ide> * - **config** – `{Object}` – The configuration object that was used to generate the request.
<ide> * - **statusText** – `{string}` – HTTP status text of the response.
<ide> *
<del> * A response status code between 200 and 299 is considered a success status and
<del> * will result in the success callback being called. Note that if the response is a redirect,
<del> * XMLHttpRequest will transparently follow it, meaning that the error callback will not be
<del> * called for such responses.
<add> * A response status code between 200 and 299 is considered a success status and will result in
<add> * the success callback being called. Any response status code outside of that range is
<add> * considered an error status and will result in the error callback being called.
<add> * Also, status codes less than -1 are normalized to zero. -1 usually means the request was
<add> * aborted, e.g. using a `config.timeout`.
<add> * Note that if the response is a redirect, XMLHttpRequest will transparently follow it, meaning
<add> * that the outcome (success or error) will be determined by the final response status code.
<ide> *
<ide> *
<ide> * ## Shortcut methods | 1 |
Text | Text | correct the example in comment | d8a6087fe2db7330cbaa3f84a1339cdcc132c7d2 | <ide><path>client/src/pages/guide/english/javascript/assignment-operators/index.md
<ide> This is the same as applying the addition operator and reassigning the sum to th
<ide> To illustrate this using actual values, here is another example of using the addition assignment operator:
<ide>
<ide> let myVar = 5; // value of myVar: 5
<del> myVar += 7; // value of myVar: 12 = 5 + 7
<add> myVar += 7; // value of myVar: 5 + 7 = 12
<ide>
<ide> ## Complete list of Javascript's assignment operators
<ide> | 1 |
Go | Go | fix typo for --restart deprecation | ef9a5926e9af408d68b3c68638a69727e42079fa | <ide><path>daemon/config.go
<ide> type Config struct {
<ide> func (config *Config) InstallFlags() {
<ide> flag.StringVar(&config.Pidfile, []string{"p", "-pidfile"}, "/var/run/docker.pid", "Path to use for daemon PID file")
<ide> flag.StringVar(&config.Root, []string{"g", "-graph"}, "/var/lib/docker", "Path to use as the root of the Docker runtime")
<del> flag.BoolVar(&config.AutoRestart, []string{"#r", "#-restart"}, true, "--restart on the daemon has been deprecated infavor of --restart policies on docker run")
<add> flag.BoolVar(&config.AutoRestart, []string{"#r", "#-restart"}, true, "--restart on the daemon has been deprecated in favor of --restart policies on docker run")
<ide> flag.BoolVar(&config.EnableIptables, []string{"#iptables", "-iptables"}, true, "Enable Docker's addition of iptables rules")
<ide> flag.BoolVar(&config.EnableIpForward, []string{"#ip-forward", "-ip-forward"}, true, "Enable net.ipv4.ip_forward")
<ide> flag.StringVar(&config.BridgeIP, []string{"#bip", "-bip"}, "", "Use this CIDR notation address for the network bridge's IP, not compatible with -b") | 1 |
Java | Java | fix compiler warnings | 8b99c51969ab8f2354685956fb5724fbc4de72d0 | <ide><path>spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestHeaderMethodArgumentResolverTests.java
<ide> public void setUp() throws Exception {
<ide> this.resolver = new RequestHeaderMethodArgumentResolver(conversionService, context.getBeanFactory());
<ide>
<ide> @SuppressWarnings("ConfusingArgumentToVarargsMethod")
<del> Method method = ReflectionUtils.findMethod(getClass(), "params", null);
<add> Method method = ReflectionUtils.findMethod(getClass(), "params", (Class<?>[]) null);
<ide> this.paramNamedDefaultValueStringHeader = new SynthesizingMethodParameter(method, 0);
<ide> this.paramNamedValueStringArray = new SynthesizingMethodParameter(method, 1);
<ide> this.paramSystemProperty = new SynthesizingMethodParameter(method, 2);
<ide> public void notFound() throws Exception {
<ide> }
<ide>
<ide> @Test
<add> @SuppressWarnings("deprecation")
<ide> public void dateConversion() throws Exception {
<ide> String rfc1123val = "Thu, 21 Apr 2016 17:11:08 +0100";
<ide> this.exchange.getRequest().getHeaders().add("name", rfc1123val); | 1 |
PHP | PHP | use arraylog for testing query logs | 605f1757628ee45772722101b1fd6389079b5771 | <ide><path>tests/TestCase/TestSuite/FixtureManagerTest.php
<ide> use Cake\Datasource\ConnectionManager;
<ide> use Cake\Log\Log;
<ide> use Cake\TestSuite\Fixture\FixtureManager;
<del>use Cake\TestSuite\Stub\ConsoleOutput;
<ide> use Cake\TestSuite\TestCase;
<ide> use PDOException;
<ide>
<ide> public function setUp(): void
<ide> public function tearDown(): void
<ide> {
<ide> parent::tearDown();
<del> Log::reset();
<ide> $this->clearPlugins();
<add> Log::reset();
<add> ConnectionManager::get('test')->disableQueryLogging();
<ide> }
<ide>
<ide> /**
<ide> public function testFixturizeCore()
<ide> */
<ide> public function testLogSchemaWithDebug()
<ide> {
<add> Log::setConfig('queries', ['className' => 'Array']);
<add>
<ide> $db = ConnectionManager::get('test');
<ide> $restore = $db->isQueryLoggingEnabled();
<ide> $db->enableQueryLogging(true);
<ide>
<ide> $this->manager->setDebug(true);
<del> $buffer = new ConsoleOutput();
<del> Log::setConfig('testQueryLogger', [
<del> 'className' => 'Console',
<del> 'stream' => $buffer,
<del> ]);
<ide>
<ide> $test = $this->getMockBuilder('Cake\TestSuite\TestCase')->getMock();
<ide> $test->expects($this->any())
<ide> public function testLogSchemaWithDebug()
<ide> $this->manager->shutdown();
<ide>
<ide> $db->enableQueryLogging($restore);
<del> $this->assertStringContainsString('CREATE TABLE', implode('', $buffer->messages()));
<add> $this->assertStringContainsString('CREATE TABLE', implode('', Log::engine('queries')->read()));
<ide> }
<ide>
<ide> /**
<ide> public function testLogSchemaWithDebug()
<ide> */
<ide> public function testResetDbIfTableExists()
<ide> {
<add> Log::setConfig('queries', ['className' => 'Array']);
<add>
<ide> $db = ConnectionManager::get('test');
<ide> $restore = $db->isQueryLoggingEnabled();
<ide> $db->enableQueryLogging(true);
<ide>
<ide> $this->manager->setDebug(true);
<del> $buffer = new ConsoleOutput();
<del> Log::setConfig('testQueryLogger', [
<del> 'className' => 'Console',
<del> 'stream' => $buffer,
<del> ]);
<ide>
<ide> $table = new TableSchema('articles', [
<ide> 'id' => ['type' => 'integer', 'unsigned' => true],
<ide> public function testResetDbIfTableExists()
<ide> $this->manager->load($test);
<ide>
<ide> $db->enableQueryLogging($restore);
<del> $this->assertStringContainsString('DROP TABLE', implode('', $buffer->messages()));
<add> $this->assertStringContainsString('DROP TABLE', implode('', Log::engine('queries')->read()));
<ide> }
<ide>
<ide> /**
<ide> public function testLoadUnmanagedFixtures()
<ide> ])
<ide> ->execute();
<ide>
<del> $buffer = new ConsoleOutput();
<del> Log::setConfig('testQueryLogger', [
<del> 'className' => 'Console',
<del> 'stream' => $buffer,
<del> ]);
<add> Log::setConfig('queries', ['className' => 'Array']);
<add> $conn->enableQueryLogging(true);
<ide>
<ide> $test = $this->getMockBuilder('Cake\TestSuite\TestCase')->getMock();
<ide> $test->expects($this->any())
<ide> ->method('getFixtures')
<ide> ->willReturn(['core.Unmanaged']);
<ide>
<del> $conn->enableQueryLogging(true);
<ide> $this->manager->setDebug(true);
<ide> $this->manager->fixturize($test);
<ide> $this->manager->load($test);
<del> $this->assertStringNotContainsString('DROP TABLE', implode('', $buffer->messages()));
<add> $this->assertStringNotContainsString('DROP TABLE', implode('', Log::engine('queries')->read()));
<ide>
<ide> $stmt = $conn->newQuery()->select(['title', 'body'])->from('unmanaged')->execute();
<ide> $rows = $stmt->fetchAll();
<ide> $this->assertCount(2, $rows);
<ide>
<ide> $this->manager->shutDown();
<del> $this->assertStringNotContainsString('DROP TABLE', implode('', $buffer->messages()));
<add> $this->assertStringNotContainsString('DROP TABLE', implode('', Log::engine('queries')->read()));
<ide> $this->assertContains('unmanaged', $conn->getSchemaCollection()->listTables());
<ide>
<ide> foreach ($schema->dropSql($conn) as $sql) { | 1 |
PHP | PHP | fix conflicts and tests | ca32323d7e29cad363d4014fde156440855919a8 | <ide><path>src/Illuminate/Database/Eloquent/Model.php
<ide> public function freshTimestampString()
<ide> */
<ide> public function newQuery()
<ide> {
<del> $builder = $this->newEloquentBuilder(
<del> $this->newBaseQueryBuilder()
<del> );
<del>
<del> // Once we have the query builders, we will set the model instances so the
<del> // builder can easily access any information it may need from the model
<del> // while it is constructing and executing various queries against it.
<del> $builder->setModel($this)->with($this->with);
<add> $builder = $this->newQueryWithoutScopes();
<ide>
<ide> return $this->applyGlobalScopes($builder);
<ide> }
<ide> public function newQueryWithoutScope($scope)
<ide> */
<ide> public function newQueryWithoutScopes()
<ide> {
<del> return $this->removeGlobalScopes($this->newQuery());
<add> $builder = $this->newEloquentBuilder(
<add> $this->newBaseQueryBuilder()
<add> );
<add>
<add> // Once we have the query builders, we will set the model instances so the
<add> // builder can easily access any information it may need from the model
<add> // while it is constructing and executing various queries against it.
<add> return $builder->setModel($this)->with($this->with);
<ide> }
<ide>
<ide> /**
<ide><path>src/Illuminate/Support/Collection.php
<ide> public function splice($offset, $length = 0, $replacement = array())
<ide> /**
<ide> * Get the sum of the given values.
<ide> *
<del> * @param \Closure $callback
<add> * @param \Closure|null $callback
<ide> * @return mixed
<ide> */
<del> public function sum($callback)
<add> public function sum($callback = null)
<ide> {
<add> if (is_null($callback))
<add> {
<add> return array_sum($this->items);
<add> }
<add>
<ide> if (is_string($callback))
<ide> {
<ide> $callback = $this->valueRetriever($callback);
<ide><path>tests/Database/DatabaseEloquentModelTest.php
<ide> public function testWithMethodCallsQueryBuilderCorrectlyWithArray()
<ide>
<ide> public function testUpdateProcess()
<ide> {
<del> $model = $this->getMock('EloquentModelStub', array('newQuery', 'updateTimestamps'));
<add> $model = $this->getMock('EloquentModelStub', array('newQueryWithoutScopes', 'updateTimestamps'));
<ide> $query = m::mock('Illuminate\Database\Eloquent\Builder');
<ide> $query->shouldReceive('where')->once()->with('id', '=', 1);
<ide> $query->shouldReceive('update')->once()->with(array('name' => 'taylor'));
<del> $model->expects($this->once())->method('newQuery')->will($this->returnValue($query));
<add> $model->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query));
<ide> $model->expects($this->once())->method('updateTimestamps');
<ide> $model->setEventDispatcher($events = m::mock('Illuminate\Contracts\Events\Dispatcher'));
<ide> $events->shouldReceive('until')->once()->with('eloquent.saving: '.get_class($model), $model)->andReturn(true);
<ide> public function testUpdateProcess()
<ide>
<ide> public function testUpdateProcessDoesntOverrideTimestamps()
<ide> {
<del> $model = $this->getMock('EloquentModelStub', array('newQuery'));
<add> $model = $this->getMock('EloquentModelStub', array('newQueryWithoutScopes'));
<ide> $query = m::mock('Illuminate\Database\Eloquent\Builder');
<ide> $query->shouldReceive('where')->once()->with('id', '=', 1);
<ide> $query->shouldReceive('update')->once()->with(array('created_at' => 'foo', 'updated_at' => 'bar'));
<del> $model->expects($this->once())->method('newQuery')->will($this->returnValue($query));
<add> $model->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query));
<ide> $model->setEventDispatcher($events = m::mock('Illuminate\Contracts\Events\Dispatcher'));
<ide> $events->shouldReceive('until');
<ide> $events->shouldReceive('fire');
<ide> public function testUpdateProcessDoesntOverrideTimestamps()
<ide>
<ide> public function testSaveIsCancelledIfSavingEventReturnsFalse()
<ide> {
<del> $model = $this->getMock('EloquentModelStub', array('newQuery'));
<add> $model = $this->getMock('EloquentModelStub', array('newQueryWithoutScopes'));
<ide> $query = m::mock('Illuminate\Database\Eloquent\Builder');
<del> $model->expects($this->once())->method('newQuery')->will($this->returnValue($query));
<add> $model->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query));
<ide> $model->setEventDispatcher($events = m::mock('Illuminate\Contracts\Events\Dispatcher'));
<ide> $events->shouldReceive('until')->once()->with('eloquent.saving: '.get_class($model), $model)->andReturn(false);
<ide> $model->exists = true;
<ide> public function testSaveIsCancelledIfSavingEventReturnsFalse()
<ide>
<ide> public function testUpdateIsCancelledIfUpdatingEventReturnsFalse()
<ide> {
<del> $model = $this->getMock('EloquentModelStub', array('newQuery'));
<add> $model = $this->getMock('EloquentModelStub', array('newQueryWithoutScopes'));
<ide> $query = m::mock('Illuminate\Database\Eloquent\Builder');
<del> $model->expects($this->once())->method('newQuery')->will($this->returnValue($query));
<add> $model->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query));
<ide> $model->setEventDispatcher($events = m::mock('Illuminate\Contracts\Events\Dispatcher'));
<ide> $events->shouldReceive('until')->once()->with('eloquent.saving: '.get_class($model), $model)->andReturn(true);
<ide> $events->shouldReceive('until')->once()->with('eloquent.updating: '.get_class($model), $model)->andReturn(false);
<ide> public function testUpdateIsCancelledIfUpdatingEventReturnsFalse()
<ide>
<ide> public function testUpdateProcessWithoutTimestamps()
<ide> {
<del> $model = $this->getMock('EloquentModelStub', array('newQuery', 'updateTimestamps', 'fireModelEvent'));
<add> $model = $this->getMock('EloquentModelStub', array('newQueryWithoutScopes', 'updateTimestamps', 'fireModelEvent'));
<ide> $model->timestamps = false;
<ide> $query = m::mock('Illuminate\Database\Eloquent\Builder');
<ide> $query->shouldReceive('where')->once()->with('id', '=', 1);
<ide> $query->shouldReceive('update')->once()->with(array('name' => 'taylor'));
<del> $model->expects($this->once())->method('newQuery')->will($this->returnValue($query));
<add> $model->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query));
<ide> $model->expects($this->never())->method('updateTimestamps');
<ide> $model->expects($this->any())->method('fireModelEvent')->will($this->returnValue(true));
<ide>
<ide> public function testUpdateProcessWithoutTimestamps()
<ide>
<ide> public function testUpdateUsesOldPrimaryKey()
<ide> {
<del> $model = $this->getMock('EloquentModelStub', array('newQuery', 'updateTimestamps'));
<add> $model = $this->getMock('EloquentModelStub', array('newQueryWithoutScopes', 'updateTimestamps'));
<ide> $query = m::mock('Illuminate\Database\Eloquent\Builder');
<ide> $query->shouldReceive('where')->once()->with('id', '=', 1);
<ide> $query->shouldReceive('update')->once()->with(array('id' => 2, 'foo' => 'bar'));
<del> $model->expects($this->once())->method('newQuery')->will($this->returnValue($query));
<add> $model->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query));
<ide> $model->expects($this->once())->method('updateTimestamps');
<ide> $model->setEventDispatcher($events = m::mock('Illuminate\Contracts\Events\Dispatcher'));
<ide> $events->shouldReceive('until')->once()->with('eloquent.saving: '.get_class($model), $model)->andReturn(true);
<ide> public function testTimestampsAreCreatedFromStringsAndIntegers()
<ide>
<ide> public function testInsertProcess()
<ide> {
<del> $model = $this->getMock('EloquentModelStub', array('newQuery', 'updateTimestamps'));
<add> $model = $this->getMock('EloquentModelStub', array('newQueryWithoutScopes', 'updateTimestamps'));
<ide> $query = m::mock('Illuminate\Database\Eloquent\Builder');
<ide> $query->shouldReceive('insertGetId')->once()->with(array('name' => 'taylor'), 'id')->andReturn(1);
<del> $model->expects($this->once())->method('newQuery')->will($this->returnValue($query));
<add> $model->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query));
<ide> $model->expects($this->once())->method('updateTimestamps');
<ide>
<ide> $model->setEventDispatcher($events = m::mock('Illuminate\Contracts\Events\Dispatcher'));
<ide> public function testInsertProcess()
<ide> $this->assertEquals(1, $model->id);
<ide> $this->assertTrue($model->exists);
<ide>
<del> $model = $this->getMock('EloquentModelStub', array('newQuery', 'updateTimestamps'));
<add> $model = $this->getMock('EloquentModelStub', array('newQueryWithoutScopes', 'updateTimestamps'));
<ide> $query = m::mock('Illuminate\Database\Eloquent\Builder');
<ide> $query->shouldReceive('insert')->once()->with(array('name' => 'taylor'));
<del> $model->expects($this->once())->method('newQuery')->will($this->returnValue($query));
<add> $model->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query));
<ide> $model->expects($this->once())->method('updateTimestamps');
<ide> $model->setIncrementing(false);
<ide>
<ide> public function testInsertProcess()
<ide>
<ide> public function testInsertIsCancelledIfCreatingEventReturnsFalse()
<ide> {
<del> $model = $this->getMock('EloquentModelStub', array('newQuery'));
<add> $model = $this->getMock('EloquentModelStub', array('newQueryWithoutScopes'));
<ide> $query = m::mock('Illuminate\Database\Eloquent\Builder');
<del> $model->expects($this->once())->method('newQuery')->will($this->returnValue($query));
<add> $model->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query));
<ide> $model->setEventDispatcher($events = m::mock('Illuminate\Contracts\Events\Dispatcher'));
<ide> $events->shouldReceive('until')->once()->with('eloquent.saving: '.get_class($model), $model)->andReturn(true);
<ide> $events->shouldReceive('until')->once()->with('eloquent.creating: '.get_class($model), $model)->andReturn(false);
<ide> public function testInsertIsCancelledIfCreatingEventReturnsFalse()
<ide>
<ide> public function testDeleteProperlyDeletesModel()
<ide> {
<del> $model = $this->getMock('Illuminate\Database\Eloquent\Model', array('newQuery', 'updateTimestamps', 'touchOwners'));
<add> $model = $this->getMock('Illuminate\Database\Eloquent\Model', array('newQueryWithoutScopes', 'updateTimestamps', 'touchOwners'));
<ide> $query = m::mock('stdClass');
<ide> $query->shouldReceive('where')->once()->with('id', 1)->andReturn($query);
<ide> $query->shouldReceive('delete')->once();
<del> $model->expects($this->once())->method('newQuery')->will($this->returnValue($query));
<add> $model->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query));
<ide> $model->expects($this->once())->method('touchOwners');
<ide> $model->exists = true;
<ide> $model->id = 1;
<ide> public function testDeleteProperlyDeletesModel()
<ide>
<ide> public function testPushNoRelations()
<ide> {
<del> $model = $this->getMock('EloquentModelStub', array('newQuery', 'updateTimestamps'));
<add> $model = $this->getMock('EloquentModelStub', array('newQueryWithoutScopes', 'updateTimestamps'));
<ide> $query = m::mock('Illuminate\Database\Eloquent\Builder');
<ide> $query->shouldReceive('insertGetId')->once()->with(array('name' => 'taylor'), 'id')->andReturn(1);
<del> $model->expects($this->once())->method('newQuery')->will($this->returnValue($query));
<add> $model->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query));
<ide> $model->expects($this->once())->method('updateTimestamps');
<ide>
<ide> $model->name = 'taylor';
<ide> public function testPushNoRelations()
<ide>
<ide> public function testPushEmptyOneRelation()
<ide> {
<del> $model = $this->getMock('EloquentModelStub', array('newQuery', 'updateTimestamps'));
<add> $model = $this->getMock('EloquentModelStub', array('newQueryWithoutScopes', 'updateTimestamps'));
<ide> $query = m::mock('Illuminate\Database\Eloquent\Builder');
<ide> $query->shouldReceive('insertGetId')->once()->with(array('name' => 'taylor'), 'id')->andReturn(1);
<del> $model->expects($this->once())->method('newQuery')->will($this->returnValue($query));
<add> $model->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query));
<ide> $model->expects($this->once())->method('updateTimestamps');
<ide>
<ide> $model->name = 'taylor';
<ide> public function testPushEmptyOneRelation()
<ide>
<ide> public function testPushOneRelation()
<ide> {
<del> $related1 = $this->getMock('EloquentModelStub', array('newQuery', 'updateTimestamps'));
<add> $related1 = $this->getMock('EloquentModelStub', array('newQueryWithoutScopes', 'updateTimestamps'));
<ide> $query = m::mock('Illuminate\Database\Eloquent\Builder');
<ide> $query->shouldReceive('insertGetId')->once()->with(array('name' => 'related1'), 'id')->andReturn(2);
<del> $related1->expects($this->once())->method('newQuery')->will($this->returnValue($query));
<add> $related1->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query));
<ide> $related1->expects($this->once())->method('updateTimestamps');
<ide> $related1->name = 'related1';
<ide> $related1->exists = false;
<ide>
<del> $model = $this->getMock('EloquentModelStub', array('newQuery', 'updateTimestamps'));
<add> $model = $this->getMock('EloquentModelStub', array('newQueryWithoutScopes', 'updateTimestamps'));
<ide> $query = m::mock('Illuminate\Database\Eloquent\Builder');
<ide> $query->shouldReceive('insertGetId')->once()->with(array('name' => 'taylor'), 'id')->andReturn(1);
<del> $model->expects($this->once())->method('newQuery')->will($this->returnValue($query));
<add> $model->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query));
<ide> $model->expects($this->once())->method('updateTimestamps');
<ide>
<ide> $model->name = 'taylor';
<ide> public function testPushOneRelation()
<ide>
<ide> public function testPushEmptyManyRelation()
<ide> {
<del> $model = $this->getMock('EloquentModelStub', array('newQuery', 'updateTimestamps'));
<add> $model = $this->getMock('EloquentModelStub', array('newQueryWithoutScopes', 'updateTimestamps'));
<ide> $query = m::mock('Illuminate\Database\Eloquent\Builder');
<ide> $query->shouldReceive('insertGetId')->once()->with(array('name' => 'taylor'), 'id')->andReturn(1);
<del> $model->expects($this->once())->method('newQuery')->will($this->returnValue($query));
<add> $model->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query));
<ide> $model->expects($this->once())->method('updateTimestamps');
<ide>
<ide> $model->name = 'taylor';
<ide> public function testPushEmptyManyRelation()
<ide>
<ide> public function testPushManyRelation()
<ide> {
<del> $related1 = $this->getMock('EloquentModelStub', array('newQuery', 'updateTimestamps'));
<add> $related1 = $this->getMock('EloquentModelStub', array('newQueryWithoutScopes', 'updateTimestamps'));
<ide> $query = m::mock('Illuminate\Database\Eloquent\Builder');
<ide> $query->shouldReceive('insertGetId')->once()->with(array('name' => 'related1'), 'id')->andReturn(2);
<del> $related1->expects($this->once())->method('newQuery')->will($this->returnValue($query));
<add> $related1->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query));
<ide> $related1->expects($this->once())->method('updateTimestamps');
<ide> $related1->name = 'related1';
<ide> $related1->exists = false;
<ide>
<del> $related2 = $this->getMock('EloquentModelStub', array('newQuery', 'updateTimestamps'));
<add> $related2 = $this->getMock('EloquentModelStub', array('newQueryWithoutScopes', 'updateTimestamps'));
<ide> $query = m::mock('Illuminate\Database\Eloquent\Builder');
<ide> $query->shouldReceive('insertGetId')->once()->with(array('name' => 'related2'), 'id')->andReturn(3);
<del> $related2->expects($this->once())->method('newQuery')->will($this->returnValue($query));
<add> $related2->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query));
<ide> $related2->expects($this->once())->method('updateTimestamps');
<ide> $related2->name = 'related2';
<ide> $related2->exists = false;
<ide>
<del> $model = $this->getMock('EloquentModelStub', array('newQuery', 'updateTimestamps'));
<add> $model = $this->getMock('EloquentModelStub', array('newQueryWithoutScopes', 'updateTimestamps'));
<ide> $query = m::mock('Illuminate\Database\Eloquent\Builder');
<ide> $query->shouldReceive('insertGetId')->once()->with(array('name' => 'taylor'), 'id')->andReturn(1);
<del> $model->expects($this->once())->method('newQuery')->will($this->returnValue($query));
<add> $model->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query));
<ide> $model->expects($this->once())->method('updateTimestamps');
<ide>
<ide> $model->name = 'taylor';
<ide> public function testRelationshipTouchOwnersIsNotPropagatedIfNoRelationshipResult
<ide>
<ide> public function testTimestampsAreNotUpdatedWithTimestampsFalseSaveOption()
<ide> {
<del> $model = m::mock('EloquentModelStub[newQuery]');
<add> $model = m::mock('EloquentModelStub[newQueryWithoutScopes]');
<ide> $query = m::mock('Illuminate\Database\Eloquent\Builder');
<ide> $query->shouldReceive('where')->once()->with('id', '=', 1);
<ide> $query->shouldReceive('update')->once()->with(array('name' => 'taylor'));
<del> $model->shouldReceive('newQuery')->once()->andReturn($query);
<add> $model->shouldReceive('newQueryWithoutScopes')->once()->andReturn($query);
<ide>
<ide> $model->id = 1;
<ide> $model->syncOriginal();
<ide><path>tests/Support/SupportCollectionTest.php
<ide> public function testGettingSumFromCollection()
<ide> }
<ide>
<ide>
<add> public function testCanSumValuesWithoutACallback()
<add> {
<add> $c = new Collection([1, 2, 3, 4, 5]);
<add> $this->assertEquals(15, $c->sum());
<add> }
<add>
<add>
<ide> public function testGettingSumFromEmptyCollection()
<ide> {
<ide> $c = new Collection(); | 4 |
Text | Text | add a url to 'you might not need redux' | 07e37acee2eb07f9c6b8ac0daf167775bb9ff4d2 | <ide><path>README.md
<ide> It is tiny (2kB, including dependencies).
<ide> [](https://webchat.freenode.net/)
<ide> [](https://changelog.com/187)
<ide>
<del>>**New! Learn Redux from its creator:
<add>>**Learn Redux from its creator:
<ide> >[Getting Started with Redux](https://egghead.io/series/getting-started-with-redux) (30 free videos)**
<ide>
<ide> ### Testimonials
<ide> It is tiny (2kB, including dependencies).
<ide> >[“It's cool that you are inventing a better Flux by not doing Flux at all.”](https://twitter.com/andrestaltz/status/616271392930201604)
<ide> >André Staltz, creator of Cycle
<ide>
<add>### Before Proceeding Further
<add>
<add>>**Also read why you might not be needing Redux:
<add>>[“You Might Not Need Redux”](https://medium.com/@dan_abramov/you-might-not-need-redux-be46360cf367)**
<add>
<ide> ### Developer Experience
<ide>
<ide> I wrote Redux while working on my React Europe talk called [“Hot Reloading with Time Travel”](https://www.youtube.com/watch?v=xsSnOQynTHs). My goal was to create a state management library with minimal API but completely predictable behavior, so it is possible to implement logging, hot reloading, time travel, universal apps, record and replay, without any buy-in from the developer. | 1 |
PHP | PHP | add get() and has() to cookiecollection | 8890344f27f54bb3b225f073bbb22625d2f652ad | <ide><path>src/Http/Cookie/CookieCollection.php
<ide> public function __construct(array $cookies = [])
<ide> }
<ide> }
<ide>
<add> /**
<add> * Get a cookie by name
<add> *
<add> * If the provided name matches a URL (matches `#^https?://#`) this method
<add> * will assume you want a list of cookies that match that URL. This is
<add> * backwards compatible behavior that will be removed in 4.0.0
<add> *
<add> * @param string $name The name of the cookie. If the name looks like a URL,
<add> * backwards compatible behavior will be used.
<add> * @return \Cake\Http\Cookie\Cookie|null|array
<add> */
<add> public function get($name)
<add> {
<add> $key = mb_strtolower($name);
<add> if (isset($this->cookies[$key])) {
<add> return $this->cookies[$key];
<add> }
<add> return null;
<add> }
<add>
<add> /**
<add> * Check if a cookie with the given name exists
<add> *
<add> * @param string $name The cookie name to check.
<add> * @return bool True if the cookie exists, otherwise false.
<add> */
<add> public function has($name)
<add> {
<add> $key = mb_strtolower($name);
<add> return isset($this->cookies[$key]);
<add> }
<add>
<ide> /**
<ide> * Checks if only valid cookie objects are in the array
<ide> *
<ide><path>tests/TestCase/Http/Cookie/CookieCollectionTest.php
<ide> public function testConstructorWithCookieArray()
<ide> $this->assertCount(2, $collection);
<ide> }
<ide>
<add> /**
<add> * Test iteration
<add> *
<add> * @return void
<add> */
<add> public function testIteration()
<add> {
<add> $cookies = [
<add> new Cookie('remember_me', 'a'),
<add> new Cookie('gtm', 'b'),
<add> new Cookie('three', 'tree')
<add> ];
<add>
<add> $collection = new CookieCollection($cookies);
<add> $names = [];
<add> foreach ($collection as $cookie) {
<add> $names[] = $cookie->getName();
<add> }
<add> $this->assertSame(['remember_me', 'gtm', 'three'], $names);
<add> }
<add>
<add> /**
<add> * Test has()
<add> *
<add> * @return void
<add> */
<add> public function testHas()
<add> {
<add> $cookies = [
<add> new Cookie('remember_me', 'a'),
<add> new Cookie('gtm', 'b')
<add> ];
<add>
<add> $collection = new CookieCollection($cookies);
<add> $this->assertFalse($collection->has('nope'));
<add> $this->assertTrue($collection->has('remember_me'));
<add> $this->assertTrue($collection->has('REMEMBER_me'), 'case insensitive cookie names');
<add> }
<add>
<add> /**
<add> * Test getting cookies by name
<add> *
<add> * @return void
<add> */
<add> public function testGetByName()
<add> {
<add> $cookies = [
<add> new Cookie('remember_me', 'a'),
<add> new Cookie('gtm', 'b')
<add> ];
<add>
<add> $collection = new CookieCollection($cookies);
<add> $this->assertNull($collection->get('nope'));
<add> $this->assertInstanceOf(Cookie::class, $collection->get('REMEMBER_me'), 'case insensitive cookie names');
<add> $this->assertInstanceOf(Cookie::class, $collection->get('remember_me'));
<add> $this->assertSame($cookies[0], $collection->get('remember_me'));
<add> }
<add>
<ide> /**
<ide> * Test that the constructor takes only an array of objects implementing
<ide> * the CookieInterface | 2 |
Text | Text | import isomorphic-unfetch in data fetching example | 0b496a45e85f3c9aa3cf2e77eef10888be5884fc | <ide><path>packages/next/README.md
<ide> When you need state, lifecycle hooks or **initial data population** you can expo
<ide> Using a stateless function:
<ide>
<ide> ```jsx
<add>import fetch from 'isomorphic-unfetch';
<add>
<ide> function Page({ stars }) {
<ide> return <div>Next stars: {stars}</div>
<ide> } | 1 |
Text | Text | update core ideas.md | 608c18cc3fce20d4b683f156ca1e3e8a75c98f43 | <ide><path>docs/Basics/Core Ideas.md
<add>Core Ideas
<add>--------------------------
<ide>
<ide> Redux can be described in three fundamental principles:
<ide> | 1 |
Python | Python | improve style in cifar10 example scripts | 6a36339b63372b51e0aad81fcc798d3183e45e26 | <ide><path>examples/cifar10_cnn.py
<ide> from keras.layers import Conv2D, MaxPooling2D
<ide>
<ide> import os
<del>import pickle
<del>import numpy as np
<ide>
<ide> batch_size = 32
<ide> num_classes = 10
<ide> y_test = keras.utils.to_categorical(y_test, num_classes)
<ide>
<ide> model = Sequential()
<del>
<ide> model.add(Conv2D(32, (3, 3), padding='same',
<ide> input_shape=x_train.shape[1:]))
<ide> model.add(Activation('relu'))
<ide> model.save(model_path)
<ide> print('Saved trained model at %s ' % model_path)
<ide>
<del># Load label names to use in prediction results
<del>label_list_path = 'datasets/cifar-10-batches-py/batches.meta'
<del>
<del>
<del>keras_dir = os.path.expanduser(os.path.join('~', '.keras'))
<del>datadir_base = os.path.expanduser(keras_dir)
<del>if not os.access(datadir_base, os.W_OK):
<del> datadir_base = os.path.join('/tmp', '.keras')
<del>label_list_path = os.path.join(datadir_base, label_list_path)
<del>
<del>with open(label_list_path, mode='rb') as f:
<del> labels = pickle.load(f)
<del>
<del># Evaluate model with test data set and share sample prediction results
<del>evaluation = model.evaluate_generator(datagen.flow(x_test, y_test,
<del> batch_size=batch_size,
<del> shuffle=False),
<del> steps=x_test.shape[0] // batch_size,
<del> workers=4)
<del>print('Model Accuracy = %.2f' % (evaluation[1]))
<del>
<del>predict_gen = model.predict_generator(datagen.flow(x_test, y_test,
<del> batch_size=batch_size,
<del> shuffle=False),
<del> steps=x_test.shape[0] // batch_size,
<del> workers=4)
<del>
<del>for predict_index, predicted_y in enumerate(predict_gen):
<del> actual_label = labels['label_names'][np.argmax(y_test[predict_index])]
<del> predicted_label = labels['label_names'][np.argmax(predicted_y)]
<del> print('Actual Label = %s vs. Predicted Label = %s' % (actual_label,
<del> predicted_label))
<del> if predict_index == num_predictions:
<del> break
<add># Score trained model.
<add>scores = model.evaluate(x_test, y_test, verbose=1)
<add>print('Test loss:', scores[0])
<add>print('Test accuracy:', scores[1])
<ide><path>examples/cifar10_resnet.py
<del>''' Trains a ResNet on the CIFAR10 dataset.
<del> Greater than 91% test accuracy (0.52 val_loss) after 50 epochs
<del> 48sec per epoch on GTX 1080Ti
<add>"""Trains a ResNet on the CIFAR10 dataset.
<ide>
<del> Deep Residual Learning for Image Recognition
<del> https://arxiv.org/pdf/1512.03385.pdf
<del>'''
<add>Greater than 91% test accuracy (0.52 val_loss) after 50 epochs
<add>48sec per epoch on GTX 1080Ti
<add>
<add>Deep Residual Learning for Image Recognition
<add>https://arxiv.org/pdf/1512.03385.pdf
<add>"""
<ide>
<ide> from __future__ import print_function
<ide> import keras
<ide> import numpy as np
<ide> import os
<ide>
<del>
<add># Training params.
<ide> batch_size = 32
<del>num_classes = 10
<ide> epochs = 100
<add>data_augmentation = True
<add>
<add># Network architecture params.
<add>num_classes = 10
<add>num_filters = 64
<add>num_blocks = 4
<add>num_sub_blocks = 2
<add>use_max_pool = False
<ide>
<add># Load the CIFAR10 data.
<ide> (x_train, y_train), (x_test, y_test) = cifar10.load_data()
<ide>
<del># input image dimensions
<del>img_rows, img_cols, channels = x_train.shape[1], x_train.shape[2], x_train.shape[3]
<add># Input image dimensions.
<add># We assume data format "channels_last".
<add>img_rows = x_train.shape[1]
<add>img_cols = x_train.shape[2]
<add>channels = x_train.shape[3]
<ide>
<ide> if K.image_data_format() == 'channels_first':
<add> img_rows = x_train.shape[2]
<add> img_cols = x_train.shape[3]
<add> channels = x_train.shape[1]
<ide> x_train = x_train.reshape(x_train.shape[0], channels, img_rows, img_cols)
<ide> x_test = x_test.reshape(x_test.shape[0], channels, img_rows, img_cols)
<ide> input_shape = (channels, img_rows, img_cols)
<ide> else:
<add> img_rows = x_train.shape[1]
<add> img_cols = x_train.shape[2]
<add> channels = x_train.shape[3]
<ide> x_train = x_train.reshape(x_train.shape[0], img_rows, img_cols, channels)
<ide> x_test = x_test.reshape(x_test.shape[0], img_rows, img_cols, channels)
<ide> input_shape = (img_rows, img_cols, channels)
<ide>
<add># Normalize data.
<ide> x_train = x_train.astype('float32') / 255
<ide> x_test = x_test.astype('float32') / 255
<ide> print('x_train shape:', x_train.shape)
<ide> print(x_train.shape[0], 'train samples')
<ide> print(x_test.shape[0], 'test samples')
<ide> print('y_train shape:', y_train.shape)
<ide>
<del># convert class vectors to binary class matrices
<add># Convert class vectors to binary class matrices.
<ide> y_train = keras.utils.to_categorical(y_train, num_classes)
<ide> y_test = keras.utils.to_categorical(y_test, num_classes)
<ide>
<del>xin = Input(shape=input_shape)
<del>
<del>filters = 64
<del>blocks = 4
<del>sub_blocks = 2
<del>x = Conv2D(filters=filters, kernel_size=7, padding='same', strides=2,
<del> kernel_initializer="he_normal", kernel_regularizer=l2(1e-4))(xin)
<add># Start model definition.
<add>inputs = Input(shape=input_shape)
<add>x = Conv2D(num_filters,
<add> kernel_size=7,
<add> padding='same',
<add> strides=2,
<add> kernel_initializer='he_normal',
<add> kernel_regularizer=l2(1e-4))(inputs)
<ide> x = BatchNormalization()(x)
<ide> x = Activation('relu')(x)
<ide>
<del># Orig paper uses max pool after 1st conv. Reaches up 87% acc if use_max_pool = True.
<add># Orig paper uses max pool after 1st conv.
<add># Reaches up 87% acc if use_max_pool = True.
<ide> # Cifar10 images are already too small at 32x32 to be maxpooled. So, we skip.
<del>use_max_pool = False
<ide> if use_max_pool:
<del> x = MaxPooling2D(pool_size=3, strides=2, padding="same")(x)
<del> blocks = 3
<add> x = MaxPooling2D(pool_size=3, strides=2, padding='same')(x)
<add> num_blocks = 3
<ide>
<del>for i in range(blocks):
<del> for j in range(sub_blocks):
<add># Instantiate convolutional base (stack of blocks).
<add>for i in range(num_blocks):
<add> for j in range(num_sub_blocks):
<ide> strides = 1
<ide> is_first_layer_but_not_first_block = j == 0 and i > 0
<ide> if is_first_layer_but_not_first_block:
<ide> strides = 2
<del> y = Conv2D(filters=filters, kernel_size=3, padding='same', strides=strides,
<del> kernel_initializer="he_normal", kernel_regularizer=l2(1e-4))(x)
<add> y = Conv2D(num_filters,
<add> kernel_size=3,
<add> padding='same',
<add> strides=strides,
<add> kernel_initializer='he_normal',
<add> kernel_regularizer=l2(1e-4))(x)
<ide> y = BatchNormalization()(y)
<ide> y = Activation('relu')(y)
<del> y = Conv2D(filters=filters, kernel_size=3, padding='same',
<del> kernel_initializer="he_normal", kernel_regularizer=l2(1e-4))(y)
<add> y = Conv2D(num_filters,
<add> kernel_size=3,
<add> padding='same',
<add> kernel_initializer='he_normal',
<add> kernel_regularizer=l2(1e-4))(y)
<ide> y = BatchNormalization()(y)
<ide> if is_first_layer_but_not_first_block:
<del> x = Conv2D(filters=filters, kernel_size=1, padding='same', strides=2,
<del> kernel_initializer="he_normal", kernel_regularizer=l2(1e-4))(x)
<add> x = Conv2D(num_filters,
<add> kernel_size=1,
<add> padding='same',
<add> strides=2,
<add> kernel_initializer='he_normal',
<add> kernel_regularizer=l2(1e-4))(x)
<ide> x = keras.layers.add([x, y])
<ide> x = Activation('relu')(x)
<ide>
<del> filters = 2 * filters
<add> num_filters = 2 * num_filters
<ide>
<add># Add classifier on top.
<ide> x = AveragePooling2D()(x)
<ide> y = Flatten()(x)
<del>yout = Dense(num_classes, activation='softmax', kernel_initializer="he_normal")(y)
<del>model = Model(inputs=[xin], outputs=[yout])
<del>model.compile(loss='categorical_crossentropy', optimizer=Adam(),
<add>outputs = Dense(num_classes,
<add> activation='softmax',
<add> kernel_initializer='he_normal')(y)
<add>
<add># Instantiate and compile model.
<add>model = Model(inputs=inputs, outputs=outputs)
<add>model.compile(loss='categorical_crossentropy',
<add> optimizer=Adam(),
<ide> metrics=['accuracy'])
<ide> model.summary()
<ide>
<del># Save model and weights
<add># Prepare model model saving directory.
<ide> save_dir = os.path.join(os.getcwd(), 'saved_models')
<del>model_name = "cifar10_resnet_model.hdf5"
<add>model_name = 'cifar10_resnet_model.h5'
<ide> if not os.path.isdir(save_dir):
<ide> os.makedirs(save_dir)
<ide> filepath = os.path.join(save_dir, model_name)
<del>checkpoint = ModelCheckpoint(filepath=filepath, verbose=1, save_best_only=True)
<del>lr_reducer = ReduceLROnPlateau(factor=np.sqrt(0.1), cooldown=0, patience=5, min_lr=0.5e-6)
<del>callbacks = [checkpoint, lr_reducer]
<ide>
<del>data_augmentation = True
<add># Prepare callbacks for model saving and for learning rate decaying.
<add>checkpoint = ModelCheckpoint(filepath=filepath,
<add> verbose=1,
<add> save_best_only=True)
<add>lr_reducer = ReduceLROnPlateau(factor=np.sqrt(0.1),
<add> cooldown=0,
<add> patience=5,
<add> min_lr=0.5e-6)
<add>callbacks = [checkpoint, lr_reducer]
<ide>
<add># Run training, with or without data augmentation.
<ide> if not data_augmentation:
<ide> print('Not using data augmentation.')
<ide> model.fit(x_train, y_train,
<ide> epochs=epochs, verbose=1, workers=4,
<ide> callbacks=callbacks)
<ide>
<del>
<del>score = model.evaluate(x_test, y_test, verbose=1)
<del>print("")
<del>print('Test loss:', score[0])
<del>print('Test accuracy:', score[1])
<del>
<del>score = model.evaluate_generator(datagen.flow(x_test, y_test,
<del> batch_size=batch_size,
<del> shuffle=False),
<del> steps=x_test.shape[0] // batch_size,
<del> workers=4)
<del>print('Data gen test loss:', score[0])
<del>print('Data gen test accuracy:', score[1])
<add># Score trained model.
<add>scores = model.evaluate(x_test, y_test, verbose=1)
<add>print('Test loss:', scores[0])
<add>print('Test accuracy:', scores[1]) | 2 |
Javascript | Javascript | use \n as line break | 6367e312c842cc17c0970a0b6feed16ab1e55966 | <ide><path>lib/ExternalModule.js
<ide> class ExternalModule extends Module {
<ide> }
<ide>
<ide> checkExternalVariable(variableToCheck, request) {
<del> return `if(typeof ${variableToCheck} === 'undefined') {${WebpackMissingModule.moduleCode(request)}}
<del>`;
<add> return `if(typeof ${variableToCheck} === 'undefined') {${WebpackMissingModule.moduleCode(request)}}\n`;
<ide> }
<ide>
<ide> getSourceForAmdOrUmdExternal(id, optional, request) { | 1 |
Javascript | Javascript | throw error when no browserslist config found | d6c7adf3fb023eee18d62d879848d68f4d8b60f0 | <ide><path>lib/config/browserslistTargetHandler.js
<ide> const inputRx = /^(?:((?:[A-Z]:)?[/\\].*?))?(?::(.+?))?$/i;
<ide>
<ide> /**
<ide> * @typedef {Object} BrowserslistHandlerConfig
<del> * @property {string} [configPath]
<del> * @property {string} [env]
<del> * @property {string} [query]
<add> * @property {string=} configPath
<add> * @property {string=} env
<add> * @property {string=} query
<ide> */
<ide>
<del>/**
<del> * @param {BrowserslistHandlerConfig} handlerConfig config
<del> * @returns {EcmaTargetProperties & PlatformTargetProperties & ApiTargetProperties} target properties
<del> */
<del>const resolve = handlerConfig => {
<del> const { configPath, env, query } = handlerConfig;
<del>
<del> // if a query is specified, then use it, else
<del> // if a path to a config is specified then load it, else
<del> // find a nearest config
<del> const config = query
<del> ? query
<del> : configPath
<del> ? browserslist.loadConfig({
<del> config: configPath,
<del> env
<del> })
<del> : browserslist.loadConfig({ path: process.cwd(), env });
<del>
<del> const browsers = browserslist(config);
<del>
<del> return resolveESFeatures(browsers);
<del>};
<del>
<ide> /**
<ide> * @param {string} input input string
<add> * @param {string} context the context directory
<ide> * @returns {BrowserslistHandlerConfig} config
<ide> */
<del>const parse = input => {
<add>const parse = (input, context) => {
<ide> if (!input) {
<ide> return {};
<ide> }
<ide> const parse = input => {
<ide> return { configPath, env };
<ide> }
<ide>
<del> const config = browserslist.findConfig(process.cwd());
<add> const config = browserslist.findConfig(context);
<ide>
<ide> if (config && Object.keys(config).includes(input)) {
<ide> return { env: input };
<ide> const parse = input => {
<ide> return { query: input };
<ide> };
<ide>
<add>/**
<add> * @param {string} input input string
<add> * @param {string} context the context directory
<add> * @returns {string[] | null} selected browsers
<add> */
<add>const load = (input, context) => {
<add> const { configPath, env, query } = parse(input, context);
<add>
<add> // if a query is specified, then use it, else
<add> // if a path to a config is specified then load it, else
<add> // find a nearest config
<add> const config = query
<add> ? query
<add> : configPath
<add> ? browserslist.loadConfig({
<add> config: configPath,
<add> env
<add> })
<add> : browserslist.loadConfig({ path: context, env });
<add>
<add> if (!config) return null;
<add> return browserslist(config);
<add>};
<add>
<ide> /**
<ide> * @param {string[]} browsers supported browsers list
<ide> * @returns {EcmaTargetProperties & PlatformTargetProperties & ApiTargetProperties} target properties
<ide> */
<del>const resolveESFeatures = browsers => {
<add>const resolve = browsers => {
<ide> /**
<ide> * Checks only browser against the browserslist feature query
<ide> * @param {string} feature an ES feature to test
<ide> const resolveESFeatures = browsers => {
<ide>
<ide> module.exports = {
<ide> resolve,
<del> parse
<add> load
<ide> };
<ide><path>lib/config/defaults.js
<ide> const applyWebpackOptionsDefaults = options => {
<ide> target === false
<ide> ? /** @type {false} */ (false)
<ide> : typeof target === "string"
<del> ? getTargetProperties(target)
<del> : getTargetsProperties(target);
<add> ? getTargetProperties(target, options.context)
<add> : getTargetsProperties(target, options.context);
<ide>
<ide> const development = mode === "development";
<ide> const production = mode === "production" || !mode;
<ide><path>lib/config/target.js
<ide> const versionDependent = (major, minor) => {
<ide> };
<ide> };
<ide>
<del>/** @type {[string, string, RegExp, (...args: string[]) => TargetProperties][]} */
<add>/** @type {[string, string, RegExp, (...args: string[]) => TargetProperties | false][]} */
<ide> const TARGETS = [
<ide> [
<ide> "browserslist / browserslist:env / browserslist:query / browserslist:path-to-config / browserslist:path-to-config:env",
<ide> "Resolve features from browserslist. Will resolve browserslist config automatically. Only browser or node queries are supported (electron is not supported). Examples: 'browserslist:modern' to use 'modern' environment from browserslist config",
<ide> /^browserslist(?::(.+))?$/,
<del> rest => {
<del> return browserslistTargetHandler.resolve(
<del> browserslistTargetHandler.parse(rest ? rest.trim() : null)
<add> (rest, context) => {
<add> const browsers = browserslistTargetHandler.load(
<add> rest ? rest.trim() : null,
<add> context
<ide> );
<add> if (!browsers) {
<add> throw new Error(`No browserslist config found to handle the 'browserslist' target.
<add>See https://github.com/browserslist/browserslist#queries for possible ways to provide a config.
<add>The recommended way is to add a 'browserslist' key to your package.json and list supported browsers (resp. node.js versions).
<add>You can also more options via the 'target' option: 'browserslist' / 'browserslist:env' / 'browserslist:query' / 'browserslist:path-to-config' / 'browserslist:path-to-config:env'`);
<add> }
<add> return browserslistTargetHandler.resolve(browsers);
<ide> }
<ide> ],
<ide> [
<ide> const TARGETS = [
<ide>
<ide> /**
<ide> * @param {string} target the target
<add> * @param {string} context the context directory
<ide> * @returns {TargetProperties} target properties
<ide> */
<del>const getTargetProperties = target => {
<add>const getTargetProperties = (target, context) => {
<ide> for (const [, , regExp, handler] of TARGETS) {
<ide> const match = regExp.exec(target);
<ide> if (match) {
<ide> const [, ...args] = match;
<del> const result = handler(...args);
<add> const result = handler(...args, context);
<ide> if (result) return result;
<ide> }
<ide> }
<ide> const mergeTargetProperties = targetProperties => {
<ide>
<ide> /**
<ide> * @param {string[]} targets the targets
<add> * @param {string} context the context directory
<ide> * @returns {TargetProperties} target properties
<ide> */
<del>const getTargetsProperties = targets => {
<del> return mergeTargetProperties(targets.map(getTargetProperties));
<add>const getTargetsProperties = (targets, context) => {
<add> return mergeTargetProperties(
<add> targets.map(t => getTargetProperties(t, context))
<add> );
<ide> };
<ide>
<ide> exports.getTargetProperties = getTargetProperties; | 3 |
Python | Python | add histogramnd and fix histogram2d | 4e76e00cc5afceaf70fe8d655cf59d4a9fb85a0a | <ide><path>numpy/lib/function_base.py
<ide> 'diff', 'gradient', 'angle', 'unwrap', 'sort_complex', 'disp',
<ide> 'unique', 'extract', 'place', 'nansum', 'nanmax', 'nanargmax',
<ide> 'nanargmin', 'nanmin', 'vectorize', 'asarray_chkfinite', 'average',
<del> 'histogram', 'bincount', 'digitize', 'cov', 'corrcoef', 'msort',
<del> 'median', 'sinc', 'hamming', 'hanning', 'bartlett', 'blackman',
<del> 'kaiser', 'trapz', 'i0', 'add_newdoc', 'add_docstring', 'meshgrid',
<del> 'delete', 'insert', 'append'
<add> 'histogram', 'histogramnd', 'bincount', 'digitize', 'cov',
<add> 'corrcoef', 'msort', 'median', 'sinc', 'hamming', 'hanning',
<add> 'bartlett', 'blackman', 'kaiser', 'trapz', 'i0', 'add_newdoc',
<add> 'add_docstring', 'meshgrid', 'delete', 'insert', 'append'
<ide> ]
<ide>
<ide> import types
<ide> import numpy.core.numeric as _nx
<ide> from numpy.core.numeric import ones, zeros, arange, concatenate, array, \
<del> asarray, asanyarray, empty, empty_like, asanyarray, ndarray
<add> asarray, asanyarray, empty, empty_like, asanyarray, ndarray, around
<ide> from numpy.core.numeric import ScalarType, dot, where, newaxis, intp, \
<del> integer
<add> integer, isscalar
<ide> from numpy.core.umath import pi, multiply, add, arctan2, \
<del> frompyfunc, isnan, cos, less_equal, sqrt, sin, mod, exp
<add> frompyfunc, isnan, cos, less_equal, sqrt, sin, mod, exp, log10
<ide> from numpy.core.fromnumeric import ravel, nonzero, choose, sort
<ide> from numpy.core.numerictypes import typecodes
<del>from numpy.lib.shape_base import atleast_1d
<add>from numpy.lib.shape_base import atleast_1d, atleast_2d
<ide> from numpy.lib.twodim_base import diag
<ide> from _compiled_base import _insert, add_docstring
<ide> from _compiled_base import digitize, bincount
<ide> def histogram(a, bins=10, range=None, normed=False):
<ide> ----------
<ide> bins: Number of bins
<ide> range: Lower and upper bin edges (default: [sample.min(), sample.max()]).
<del> Does not really work, all values greater than range are stored in
<del> the last bin.
<add> All values greater than range are stored in the last bin.
<ide> normed: If False (default), return the number of samples in each bin.
<ide> If True, return a frequency distribution.
<ide>
<ide> def histogram(a, bins=10, range=None, normed=False):
<ide> else:
<ide> return n, bins
<ide>
<add>def histogramnd(sample, bins=10, range=None, normed=False):
<add> """histogramnd(sample, bins = 10, range = None, normed = False) -> H, edges
<add>
<add> Return the N-dimensional histogram computed from sample.
<add>
<add> Parameters
<add> ----------
<add> sample: A sequence of N arrays, or an KxN array.
<add> bins: A sequence of edge arrays, or a sequence of the number of bins.
<add> If a scalar is given, it is assumed to be the number of bins
<add> for all dimensions.
<add> range: A sequence of lower and upper bin edges (default: [min, max]).
<add> normed: If False, returns the number of samples in each bin.
<add> If True, returns the frequency distribution.
<add>
<add>
<add> Output
<add> ------
<add> H: Histogram array.
<add> edges: List of arrays defining the bin edges.
<add>
<add> Example:
<add> x = random.randn(100,3)
<add> H, edges = histogramnd(x, bins = (5, 6, 7))
<add>
<add> See also: histogram
<add> """
<add>
<add> try:
<add> N, D = sample.shape
<add> except (AttributeError, ValueError):
<add> ss = atleast_2d(sample)
<add> sample = ss.transpose()
<add> N, D = sample.shape
<add>
<add> nbin = empty(D, int)
<add> edges = D*[None]
<add> dedges = D*[None]
<add>
<add> try:
<add> M = len(bins)
<add> if M != D:
<add> raise AttributeError, 'The dimension of bins must be a equal to the dimension of the sample x.'
<add> except TypeError:
<add> bins = D*[bins]
<add>
<add> if range is None:
<add> smin = atleast_1d(sample.min(0))
<add> smax = atleast_1d(sample.max(0))
<add> else:
<add> smin = zeros(D)
<add> smax = zeros(D)
<add> for i in arange(D):
<add> smin[i], smax[i] = range[i]
<add>
<add> for i in arange(D):
<add> if isscalar(bins[i]):
<add> nbin[i] = bins[i]
<add> edges[i] = linspace(smin[i], smax[i], nbin[i]+1)
<add> else:
<add> edges[i] = asarray(bins[i], float)
<add> nbin[i] = len(edges[i])-1
<add>
<add>
<add>
<add> Ncount = {}
<add> nbin = asarray(nbin)
<add>
<add> for i in arange(D):
<add> Ncount[i] = digitize(sample[:,i], edges[i])
<add> dedges[i] = diff(edges[i])
<add> # Remove values falling outside of bins
<add> # Values that fall on an edge are put in the right bin.
<add> # For the rightmost bin, we want values equal to the right
<add> # edge to be counted in the last bin, and not as an outlier.
<add> outliers = zeros(N, int)
<add> for i in arange(D):
<add> decimal = int(-log10(dedges[i].min())) +6
<add> on_edge = where(around(sample[:,i], decimal) == around(edges[i][-1], decimal))[0]
<add> Ncount[i][on_edge] -= 1
<add> outliers += (Ncount[i] == 0) | (Ncount[i] == nbin[i]+1)
<add> indices = where(outliers == 0)[0]
<add> for i in arange(D):
<add> Ncount[i] = Ncount[i][indices] - 1
<add> N = len(indices)
<add>
<add> # Flattened histogram matrix (1D)
<add> hist = zeros(nbin.prod(), int)
<add>
<add> # Compute the sample indices in the flattened histogram matrix.
<add> ni = nbin.argsort()
<add> shape = []
<add> xy = zeros(N, int)
<add> for i in arange(0, D-1):
<add> xy += Ncount[ni[i]] * nbin[ni[i+1:]].prod()
<add>
<add> xy += Ncount[ni[-1]]
<add>
<add> # Compute the number of repetitions in xy and assign it to the flattened histmat.
<add> if len(xy) == 0:
<add> return zeros(nbin, int)
<add>
<add> flatcount = bincount(xy)
<add> a = arange(len(flatcount))
<add> hist[a] = flatcount
<add>
<add> # Shape into a proper matrix
<add> hist = hist.reshape(sort(nbin))
<add> for i,j in enumerate(ni):
<add> hist = hist.swapaxes(i,j)
<add> if (hist.shape == nbin).all():
<add> break
<add>
<add> if normed:
<add> s = hist.sum()
<add> for i in arange(D):
<add> shape = ones(D, int)
<add> shape[i] = nbin[i]
<add> hist = hist / dedges[i].reshape(shape)
<add> hist /= s
<add>
<add> return hist, edges
<add>
<add>
<ide> def average(a, axis=None, weights=None, returned=False):
<ide> """average(a, axis=None weights=None, returned=False)
<ide>
<ide><path>numpy/lib/tests/test_function_base.py
<ide> def check_simple(self):
<ide> (a,b)=histogram(linspace(0,10,100))
<ide> assert(all(a==10))
<ide>
<add>class test_histogramnd(NumpyTestCase):
<add> def check_simple(self):
<add> x = array([[-.5, .5, 1.5], [-.5, 1.5, 2.5], [-.5, 2.5, .5], \
<add> [.5, .5, 1.5], [.5, 1.5, 2.5], [.5, 2.5, 2.5]])
<add> H, edges = histogramnd(x, (2,3,3), range = [[-1,1], [0,3], [0,3]])
<add> answer = asarray([[[0,1,0], [0,0,1], [1,0,0]], [[0,1,0], [0,0,1], [0,0,1]]])
<add> assert(all(H == answer))
<add> # Check normalization
<add> ed = [[-2,0,2], [0,1,2,3], [0,1,2,3]]
<add> H, edges = histogramnd(x, bins = ed, normed = True)
<add> assert(all(H == answer/12.))
<add> # Check that H has the correct shape.
<add> H, edges = histogramnd(x, (2,3,4), range = [[-1,1], [0,3], [0,4]], normed=True)
<add> answer = asarray([[[0,1,0,0], [0,0,1,0], [1,0,0,0]], [[0,1,0,0], [0,0,1,0], [0,0,1,0]]])
<add> assert_array_almost_equal(H, answer/6., 4)
<add> # Check that a sequence of arrays is accepted and H has the correct shape.
<add> z = [squeeze(y) for y in split(x,3,axis=1)]
<add> H, edges = histogramnd(z, bins=(4,3,2),range=[[-2,2], [0,3], [0,2]])
<add> answer = asarray([[[0,0],[0,0],[0,0]],
<add> [[0,1], [0,0], [1,0]],
<add> [[0,1], [0,0],[0,0]],
<add> [[0,0],[0,0],[0,0]]])
<add> assert_array_equal(H, answer)
<add>
<add>
<ide> class test_unique(NumpyTestCase):
<ide> def check_simple(self):
<ide> x = array([4,3,2,1,1,2,3,4, 0])
<ide><path>numpy/lib/tests/test_twodim_base.py
<ide> from numpy.testing import *
<ide> set_package_path()
<ide> from numpy import arange, rot90, add, fliplr, flipud, zeros, ones, eye, \
<del> array, diag
<add> array, diag, histogram2d
<add>import numpy as np
<ide> restore_path()
<ide>
<ide> ##################################################
<ide> def check_basic(self):
<ide>
<ide> class test_histogram2d(NumpyTestCase):
<ide> def check_simple(self):
<del> import numpy as np
<ide> x = array([ 0.41702200, 0.72032449, 0.00011437481, 0.302332573, 0.146755891])
<ide> y = array([ 0.09233859, 0.18626021, 0.34556073, 0.39676747, 0.53881673])
<ide> xedges = np.linspace(0,1,10)
<ide> yedges = np.linspace(0,1,10)
<del> H = np.histogram2d(x, y, (xedges, yedges))[0]
<del> answer = np.array([[0, 0, 0, 1, 0, 0, 0, 0, 0],
<add> H = histogram2d(x, y, (xedges, yedges))[0]
<add> answer = array([[0, 0, 0, 1, 0, 0, 0, 0, 0],
<ide> [0, 0, 0, 0, 0, 0, 1, 0, 0],
<ide> [0, 0, 0, 0, 0, 0, 0, 0, 0],
<ide> [1, 0, 1, 0, 0, 0, 0, 0, 0],
<ide> def check_simple(self):
<ide> [0, 0, 0, 0, 0, 0, 0, 0, 0],
<ide> [0, 0, 0, 0, 0, 0, 0, 0, 0],
<ide> [0, 0, 0, 0, 0, 0, 0, 0, 0]])
<del> assert_equal(H, answer)
<del>
<add> assert_array_equal(H.T, answer)
<add> def check_asym(self):
<add> x = array([1, 1, 2, 3, 4, 4, 4, 5])
<add> y = array([1, 3, 2, 0, 1, 2, 3, 4])
<add> H, xed, yed = histogram2d(x,y, (6, 5), range = [[0,6],[0,5]], normed=True)
<add> answer = array([[0.,0,0,0,0],
<add> [0,1,0,1,0],
<add> [0,0,1,0,0],
<add> [1,0,0,0,0],
<add> [0,1,1,1,0],
<add> [0,0,0,0,1]])
<add> assert_array_almost_equal(H, answer/8., 3)
<add> def check_norm(self):
<add> x = array([1,2,3,1,2,3,1,2,3])
<add> y = array([1,1,1,2,2,2,3,3,3])
<add> H, xed, yed = histogram2d(x,y,[[1,2,3,5], [1,2,3,5]], normed=True)
<add> answer=array([[1,1,.5],
<add> [1,1,.5],
<add> [.5,.5,.25]])/9.
<add> assert_array_almost_equal(H, answer, 3)
<add>
<ide> if __name__ == "__main__":
<ide> NumpyTest().run()
<ide><path>numpy/lib/twodim_base.py
<ide>
<ide> """
<ide>
<del>__all__ = ['diag','diagflat','eye','fliplr','flipud','rot90','tri','triu','tril',
<del> 'vander','histogram2d']
<add>__all__ = ['diag','diagflat','eye','fliplr','flipud','rot90','tri','triu',
<add> 'tril','vander','histogram2d']
<ide>
<ide> from numpy.core.numeric import asanyarray, int_, equal, subtract, arange, \
<ide> zeros, arange, greater_equal, multiply, ones, asarray
<ide> def vander(x, N=None):
<ide> X[:,i] = x**(N-i-1)
<ide> return X
<ide>
<del>def histogram2d(x,y, bins, normed = False):
<del> """Compute the 2D histogram for a dataset (x,y) given the edges or
<del> the number of bins.
<del>
<del> Returns histogram, xedges, yedges.
<del> The histogram array is a count of the number of samples in each bin.
<del> The array is oriented such that H[i,j] is the number of samples falling
<del> into binx[j] and biny[i].
<add>def histogram2d(x,y, bins=10, range=None, normed=False):
<add> """histogram2d(x,y, bins=10, range=None, normed=False) -> H, xedges, yedges
<add>
<add> Compute the 2D histogram from samples x,y.
<add>
<add> Parameters
<add> ----------
<add> x,y: 1D data series. Both arrays must have the same length.
<add> bins: Number of bins -or- [nbin x, nbin y] -or-
<add> [bin edges] -or- [x bin edges, y bin edges].
<add> range: A sequence of lower and upper bin edges (default: [min, max]).
<add> normed: True or False.
<add>
<add> The histogram array is a count of the number of samples in each
<add> two dimensional bin.
<ide> Setting normed to True returns a density rather than a bin count.
<ide> Data falling outside of the edges are not counted.
<ide> """
<ide> def histogram2d(x,y, bins, normed = False):
<ide> except TypeError:
<ide> N = 1
<ide> bins = [bins]
<add> x = asarray(x)
<add> y = asarray(y)
<add> if range is None:
<add> xmin, xmax = x.min(), x.max()
<add> ymin, ymax = y.min(), y.max()
<add> else:
<add> xmin, xmax = range[0]
<add> ymin, ymax = range[1]
<ide> if N == 2:
<ide> if np.isscalar(bins[0]):
<ide> xnbin = bins[0]
<del> xedges = np.linspace(x.min(), x.max(), xnbin+1)
<del>
<add> xedges = np.linspace(xmin, xmax, xnbin+1)
<ide> else:
<ide> xedges = asarray(bins[0], float)
<ide> xnbin = len(xedges)-1
<del>
<ide> if np.isscalar(bins[1]):
<ide> ynbin = bins[1]
<del> yedges = np.linspace(y.min(), y.max(), ynbin+1)
<add> yedges = np.linspace(ymin, ymax, ynbin+1)
<ide> else:
<ide> yedges = asarray(bins[1], float)
<ide> ynbin = len(yedges)-1
<ide> elif N == 1:
<ide> ynbin = xnbin = bins[0]
<del> xedges = np.linspace(x.min(), x.max(), xnbin+1)
<del> yedges = np.linspace(y.max(), y.min(), ynbin+1)
<del> xedges[-1] *= 1.0001
<del> yedges[-1] *= 1.0001
<add> xedges = np.linspace(xmin, xmax, xnbin+1)
<add> yedges = np.linspace(ymin, ymax, ynbin+1)
<ide> else:
<ide> yedges = asarray(bins, float)
<ide> xedges = yedges.copy()
<ide> ynbin = len(yedges)-1
<ide> xnbin = len(xedges)-1
<ide>
<add> dxedges = np.diff(xedges)
<add> dyedges = np.diff(yedges)
<add>
<ide> # Flattened histogram matrix (1D)
<ide> hist = np.zeros((xnbin)*(ynbin), int)
<ide>
<ide> # Count the number of sample in each bin (1D)
<ide> xbin = np.digitize(x,xedges)
<ide> ybin = np.digitize(y,yedges)
<ide>
<del> # Remove the outliers
<add> # Values that fall on an edge are put in the right bin.
<add> # For the rightmost bin, we want values equal to the right
<add> # edge to be counted in the last bin, and not as an outlier.
<add> xdecimal = int(-np.log10(dxedges.min()))+6
<add> ydecimal = int(-np.log10(dyedges.min()))+6
<add> on_edge_x = np.where(np.around(x,xdecimal) == np.around(xedges[-1], xdecimal))[0]
<add> on_edge_y = np.where(np.around(y,ydecimal) == np.around(yedges[-1], ydecimal))[0]
<add> xbin[on_edge_x] -= 1
<add> ybin[on_edge_y] -= 1
<add> # Remove the true outliers
<ide> outliers = (xbin==0) | (xbin==xnbin+1) | (ybin==0) | (ybin == ynbin+1)
<del>
<del> xbin = xbin[outliers==False]
<del> ybin = ybin[outliers==False]
<add> xbin = xbin[outliers==False] - 1
<add> ybin = ybin[outliers==False] - 1
<ide>
<ide> # Compute the sample indices in the flattened histogram matrix.
<ide> if xnbin >= ynbin:
<ide> xy = ybin*(xnbin) + xbin
<del> shift = xnbin + 1
<add>
<ide> else:
<ide> xy = xbin*(ynbin) + ybin
<del> shift = ynbin + 1
<add>
<ide>
<ide> # Compute the number of repetitions in xy and assign it to the flattened
<ide> # histogram matrix.
<add>
<ide> flatcount = np.bincount(xy)
<del> indices = np.arange(len(flatcount)-shift)
<del> hist[indices] = flatcount[shift:]
<add> indices = np.arange(len(flatcount))
<add> hist[indices] = flatcount
<ide>
<add> shape = np.sort([xnbin, ynbin])
<ide> # Shape into a proper matrix
<del> histmat = hist.reshape(xnbin, ynbin)
<del>
<add> histmat = hist.reshape(shape)
<add> if (shape == (ynbin, xnbin)).all():
<add> histmat = histmat.T
<ide> if normed:
<del> diff2 = np.outer(np.diff(yedges), np.diff(xedges))
<add> diff2 = np.outer(dxedges, dyedges)
<ide> histmat = histmat / diff2 / histmat.sum()
<ide> return histmat, xedges, yedges
<ide><path>numpy/oldnumeric/functions.py
<ide> def cross_product(a, b, axis1=-1, axis2=-1):
<ide>
<ide> def average(a, axis=0, weights=None, returned=False):
<ide> return N.average(a, axis, weights, returned)
<add> | 5 |
Javascript | Javascript | add flow types to panresponder | 3f79b2a4e9afdcce62a4d8c8b490ab33d0d40bbb | <ide><path>Libraries/Experimental/SwipeableRow/SwipeableRow.js
<ide> const View = require('View');
<ide> const createReactClass = require('create-react-class');
<ide> const emptyFunction = require('fbjs/lib/emptyFunction');
<ide>
<add>import type {LayoutEvent, PressEvent} from 'CoreEventTypes';
<add>import type {GestureState} from 'PanResponder';
<add>
<ide> const IS_RTL = I18nManager.isRTL;
<ide>
<ide> // NOTE: Eventually convert these consts to an input object of configurations
<ide> const SwipeableRow = createReactClass({
<ide> this._animateToClosedPosition();
<ide> },
<ide>
<del> _onSwipeableViewLayout(event: Object): void {
<add> _onSwipeableViewLayout(event: LayoutEvent): void {
<ide> this.setState({
<ide> isSwipeableViewRendered: true,
<ide> rowHeight: event.nativeEvent.layout.height,
<ide> });
<ide> },
<ide>
<ide> _handleMoveShouldSetPanResponderCapture(
<del> event: Object,
<del> gestureState: Object,
<add> event: PressEvent,
<add> gestureState: GestureState,
<ide> ): boolean {
<ide> // Decides whether a swipe is responded to by this component or its child
<ide> return gestureState.dy < 10 && this._isValidSwipe(gestureState);
<ide> },
<ide>
<del> _handlePanResponderGrant(event: Object, gestureState: Object): void {},
<add> _handlePanResponderGrant(
<add> event: PressEvent,
<add> gestureState: GestureState,
<add> ): void {},
<ide>
<del> _handlePanResponderMove(event: Object, gestureState: Object): void {
<add> _handlePanResponderMove(event: PressEvent, gestureState: GestureState): void {
<ide> if (this._isSwipingExcessivelyRightFromClosedPosition(gestureState)) {
<ide> return;
<ide> }
<ide> const SwipeableRow = createReactClass({
<ide> }
<ide> },
<ide>
<del> _isSwipingRightFromClosed(gestureState: Object): boolean {
<add> _isSwipingRightFromClosed(gestureState: GestureState): boolean {
<ide> const gestureStateDx = IS_RTL ? -gestureState.dx : gestureState.dx;
<ide> return this._previousLeft === CLOSED_LEFT_POSITION && gestureStateDx > 0;
<ide> },
<ide>
<del> _swipeFullSpeed(gestureState: Object): void {
<add> _swipeFullSpeed(gestureState: GestureState): void {
<ide> this.state.currentLeft.setValue(this._previousLeft + gestureState.dx);
<ide> },
<ide>
<del> _swipeSlowSpeed(gestureState: Object): void {
<add> _swipeSlowSpeed(gestureState: GestureState): void {
<ide> this.state.currentLeft.setValue(
<ide> this._previousLeft + gestureState.dx / SLOW_SPEED_SWIPE_FACTOR,
<ide> );
<ide> },
<ide>
<del> _isSwipingExcessivelyRightFromClosedPosition(gestureState: Object): boolean {
<add> _isSwipingExcessivelyRightFromClosedPosition(
<add> gestureState: GestureState,
<add> ): boolean {
<ide> /**
<ide> * We want to allow a BIT of right swipe, to allow users to know that
<ide> * swiping is available, but swiping right does not do anything
<ide> const SwipeableRow = createReactClass({
<ide> },
<ide>
<ide> _onPanResponderTerminationRequest(
<del> event: Object,
<del> gestureState: Object,
<add> event: PressEvent,
<add> gestureState: GestureState,
<ide> ): boolean {
<ide> return false;
<ide> },
<ide> const SwipeableRow = createReactClass({
<ide> },
<ide>
<ide> // Ignore swipes due to user's finger moving slightly when tapping
<del> _isValidSwipe(gestureState: Object): boolean {
<add> _isValidSwipe(gestureState: GestureState): boolean {
<ide> if (
<ide> this.props.preventSwipeRight &&
<ide> this._previousLeft === CLOSED_LEFT_POSITION &&
<ide> const SwipeableRow = createReactClass({
<ide> return Math.abs(gestureState.dx) > HORIZONTAL_SWIPE_DISTANCE_THRESHOLD;
<ide> },
<ide>
<del> _shouldAnimateRemainder(gestureState: Object): boolean {
<add> _shouldAnimateRemainder(gestureState: GestureState): boolean {
<ide> /**
<ide> * If user has swiped past a certain distance, animate the rest of the way
<ide> * if they let go
<ide> const SwipeableRow = createReactClass({
<ide> );
<ide> },
<ide>
<del> _handlePanResponderEnd(event: Object, gestureState: Object): void {
<add> _handlePanResponderEnd(event: PressEvent, gestureState: GestureState): void {
<ide> const horizontalDistance = IS_RTL ? -gestureState.dx : gestureState.dx;
<ide> if (this._isSwipingRightFromClosed(gestureState)) {
<ide> this.props.onOpen();
<ide><path>Libraries/Interaction/PanResponder.js
<ide> * This source code is licensed under the MIT license found in the
<ide> * LICENSE file in the root directory of this source tree.
<ide> *
<add> * @flow
<ide> * @format
<ide> */
<ide>
<ide> const InteractionManager = require('./InteractionManager');
<ide> const TouchHistoryMath = require('./TouchHistoryMath');
<ide>
<add>import type {PressEvent} from 'CoreEventTypes';
<add>
<ide> const currentCentroidXOfTouchesChangedAfter =
<ide> TouchHistoryMath.currentCentroidXOfTouchesChangedAfter;
<ide> const currentCentroidYOfTouchesChangedAfter =
<ide> const currentCentroidY = TouchHistoryMath.currentCentroidY;
<ide> * [PanResponder example in RNTester](https://github.com/facebook/react-native/blob/master/RNTester/js/PanResponderExample.js)
<ide> */
<ide>
<add>export type GestureState = {|
<add> /**
<add> * ID of the gestureState - persisted as long as there at least one touch on screen
<add> */
<add> stateID: number,
<add>
<add> /**
<add> * The latest screen coordinates of the recently-moved touch
<add> */
<add> moveX: number,
<add>
<add> /**
<add> * The latest screen coordinates of the recently-moved touch
<add> */
<add> moveY: number,
<add>
<add> /**
<add> * The screen coordinates of the responder grant
<add> */
<add> x0: number,
<add>
<add> /**
<add> * The screen coordinates of the responder grant
<add> */
<add> y0: number,
<add>
<add> /**
<add> * Accumulated distance of the gesture since the touch started
<add> */
<add> dx: number,
<add>
<add> /**
<add> * Accumulated distance of the gesture since the touch started
<add> */
<add> dy: number,
<add>
<add> /**
<add> * Current velocity of the gesture
<add> */
<add> vx: number,
<add>
<add> /**
<add> * Current velocity of the gesture
<add> */
<add> vy: number,
<add>
<add> /**
<add> * Number of touches currently on screen
<add> */
<add> numberActiveTouches: number,
<add>
<add> /**
<add> * All `gestureState` accounts for timeStamps up until this value
<add> *
<add> * @private
<add> */
<add> _accountsForMovesUpTo: number,
<add>|};
<add>
<add>type ActiveCallback = (
<add> event: PressEvent,
<add> gestureState: GestureState,
<add>) => boolean;
<add>
<add>type PassiveCallback = (event: PressEvent, gestureState: GestureState) => mixed;
<add>
<add>type PanResponderConfig = $ReadOnly<{|
<add> onMoveShouldSetPanResponder?: ?ActiveCallback,
<add> onMoveShouldSetPanResponderCapture?: ?ActiveCallback,
<add> onStartShouldSetPanResponder?: ?ActiveCallback,
<add> onStartShouldSetPanResponderCapture?: ?ActiveCallback,
<add> /**
<add> * The body of `onResponderGrant` returns a bool, but the vast majority of
<add> * callsites return void and this TODO notice is found in it:
<add> * TODO: t7467124 investigate if this can be removed
<add> */
<add> onPanResponderGrant?: ?(PassiveCallback | ActiveCallback),
<add> onPanResponderReject?: ?PassiveCallback,
<add> onPanResponderStart?: ?PassiveCallback,
<add> onPanResponderEnd?: ?PassiveCallback,
<add> onPanResponderRelease?: ?PassiveCallback,
<add> onPanResponderMove?: ?PassiveCallback,
<add> onPanResponderTerminate?: ?PassiveCallback,
<add> onPanResponderTerminationRequest?: ?ActiveCallback,
<add> onShouldBlockNativeResponder?: ?ActiveCallback,
<add>|}>;
<add>
<ide> const PanResponder = {
<ide> /**
<ide> *
<ide> const PanResponder = {
<ide> * - vx/vy: Velocity.
<ide> */
<ide>
<del> _initializeGestureState: function(gestureState) {
<add> _initializeGestureState(gestureState: GestureState) {
<ide> gestureState.moveX = 0;
<ide> gestureState.moveY = 0;
<ide> gestureState.x0 = 0;
<ide> const PanResponder = {
<ide> * typical responder callback pattern (without using `PanResponder`), but
<ide> * avoids more dispatches than necessary.
<ide> */
<del> _updateGestureStateOnMove: function(gestureState, touchHistory) {
<add> _updateGestureStateOnMove(
<add> gestureState: GestureState,
<add> touchHistory: $PropertyType<PressEvent, 'touchHistory'>,
<add> ) {
<ide> gestureState.numberActiveTouches = touchHistory.numberActiveTouches;
<ide> gestureState.moveX = currentCentroidXOfTouchesChangedAfter(
<ide> touchHistory,
<ide> const PanResponder = {
<ide> * accordingly. (numberActiveTouches) may not be totally accurate unless you
<ide> * are the responder.
<ide> */
<del> create: function(config) {
<add> create(config: PanResponderConfig) {
<ide> const interactionState = {
<ide> handle: (null: ?number),
<ide> };
<del> const gestureState = {
<add> const gestureState: GestureState = {
<ide> // Useful for debugging
<ide> stateID: Math.random(),
<add> moveX: 0,
<add> moveY: 0,
<add> x0: 0,
<add> y0: 0,
<add> dx: 0,
<add> dy: 0,
<add> vx: 0,
<add> vy: 0,
<add> numberActiveTouches: 0,
<add> _accountsForMovesUpTo: 0,
<ide> };
<del> PanResponder._initializeGestureState(gestureState);
<ide> const panHandlers = {
<del> onStartShouldSetResponder: function(e) {
<del> return config.onStartShouldSetPanResponder === undefined
<add> onStartShouldSetResponder(event: PressEvent): boolean {
<add> return config.onStartShouldSetPanResponder == null
<ide> ? false
<del> : config.onStartShouldSetPanResponder(e, gestureState);
<add> : config.onStartShouldSetPanResponder(event, gestureState);
<ide> },
<del> onMoveShouldSetResponder: function(e) {
<del> return config.onMoveShouldSetPanResponder === undefined
<add> onMoveShouldSetResponder(event: PressEvent): boolean {
<add> return config.onMoveShouldSetPanResponder == null
<ide> ? false
<del> : config.onMoveShouldSetPanResponder(e, gestureState);
<add> : config.onMoveShouldSetPanResponder(event, gestureState);
<ide> },
<del> onStartShouldSetResponderCapture: function(e) {
<add> onStartShouldSetResponderCapture(event: PressEvent): boolean {
<ide> // TODO: Actually, we should reinitialize the state any time
<ide> // touches.length increases from 0 active to > 0 active.
<del> if (e.nativeEvent.touches.length === 1) {
<add> if (event.nativeEvent.touches.length === 1) {
<ide> PanResponder._initializeGestureState(gestureState);
<ide> }
<del> gestureState.numberActiveTouches = e.touchHistory.numberActiveTouches;
<del> return config.onStartShouldSetPanResponderCapture !== undefined
<del> ? config.onStartShouldSetPanResponderCapture(e, gestureState)
<add> gestureState.numberActiveTouches =
<add> event.touchHistory.numberActiveTouches;
<add> return config.onStartShouldSetPanResponderCapture != null
<add> ? config.onStartShouldSetPanResponderCapture(event, gestureState)
<ide> : false;
<ide> },
<ide>
<del> onMoveShouldSetResponderCapture: function(e) {
<del> const touchHistory = e.touchHistory;
<add> onMoveShouldSetResponderCapture(event: PressEvent): boolean {
<add> const touchHistory = event.touchHistory;
<ide> // Responder system incorrectly dispatches should* to current responder
<ide> // Filter out any touch moves past the first one - we would have
<ide> // already processed multi-touch geometry during the first event.
<ide> const PanResponder = {
<ide> }
<ide> PanResponder._updateGestureStateOnMove(gestureState, touchHistory);
<ide> return config.onMoveShouldSetPanResponderCapture
<del> ? config.onMoveShouldSetPanResponderCapture(e, gestureState)
<add> ? config.onMoveShouldSetPanResponderCapture(event, gestureState)
<ide> : false;
<ide> },
<ide>
<del> onResponderGrant: function(e) {
<add> onResponderGrant(event: PressEvent): boolean {
<ide> if (!interactionState.handle) {
<ide> interactionState.handle = InteractionManager.createInteractionHandle();
<ide> }
<del> gestureState.x0 = currentCentroidX(e.touchHistory);
<del> gestureState.y0 = currentCentroidY(e.touchHistory);
<add> gestureState.x0 = currentCentroidX(event.touchHistory);
<add> gestureState.y0 = currentCentroidY(event.touchHistory);
<ide> gestureState.dx = 0;
<ide> gestureState.dy = 0;
<ide> if (config.onPanResponderGrant) {
<del> config.onPanResponderGrant(e, gestureState);
<add> config.onPanResponderGrant(event, gestureState);
<ide> }
<ide> // TODO: t7467124 investigate if this can be removed
<del> return config.onShouldBlockNativeResponder === undefined
<add> return config.onShouldBlockNativeResponder == null
<ide> ? true
<del> : config.onShouldBlockNativeResponder();
<add> : config.onShouldBlockNativeResponder(event, gestureState);
<ide> },
<ide>
<del> onResponderReject: function(e) {
<add> onResponderReject(event: PressEvent): void {
<ide> clearInteractionHandle(
<ide> interactionState,
<ide> config.onPanResponderReject,
<del> e,
<add> event,
<ide> gestureState,
<ide> );
<ide> },
<ide>
<del> onResponderRelease: function(e) {
<add> onResponderRelease(event: PressEvent): void {
<ide> clearInteractionHandle(
<ide> interactionState,
<ide> config.onPanResponderRelease,
<del> e,
<add> event,
<ide> gestureState,
<ide> );
<ide> PanResponder._initializeGestureState(gestureState);
<ide> },
<ide>
<del> onResponderStart: function(e) {
<del> const touchHistory = e.touchHistory;
<add> onResponderStart(event: PressEvent): void {
<add> const touchHistory = event.touchHistory;
<ide> gestureState.numberActiveTouches = touchHistory.numberActiveTouches;
<ide> if (config.onPanResponderStart) {
<del> config.onPanResponderStart(e, gestureState);
<add> config.onPanResponderStart(event, gestureState);
<ide> }
<ide> },
<ide>
<del> onResponderMove: function(e) {
<del> const touchHistory = e.touchHistory;
<add> onResponderMove(event: PressEvent): void {
<add> const touchHistory = event.touchHistory;
<ide> // Guard against the dispatch of two touch moves when there are two
<ide> // simultaneously changed touches.
<ide> if (
<ide> const PanResponder = {
<ide> // already processed multi-touch geometry during the first event.
<ide> PanResponder._updateGestureStateOnMove(gestureState, touchHistory);
<ide> if (config.onPanResponderMove) {
<del> config.onPanResponderMove(e, gestureState);
<add> config.onPanResponderMove(event, gestureState);
<ide> }
<ide> },
<ide>
<del> onResponderEnd: function(e) {
<del> const touchHistory = e.touchHistory;
<add> onResponderEnd(event: PressEvent): void {
<add> const touchHistory = event.touchHistory;
<ide> gestureState.numberActiveTouches = touchHistory.numberActiveTouches;
<ide> clearInteractionHandle(
<ide> interactionState,
<ide> config.onPanResponderEnd,
<del> e,
<add> event,
<ide> gestureState,
<ide> );
<ide> },
<ide>
<del> onResponderTerminate: function(e) {
<add> onResponderTerminate(event: PressEvent): void {
<ide> clearInteractionHandle(
<ide> interactionState,
<ide> config.onPanResponderTerminate,
<del> e,
<add> event,
<ide> gestureState,
<ide> );
<ide> PanResponder._initializeGestureState(gestureState);
<ide> },
<ide>
<del> onResponderTerminationRequest: function(e) {
<del> return config.onPanResponderTerminationRequest === undefined
<add> onResponderTerminationRequest(event: PressEvent): boolean {
<add> return config.onPanResponderTerminationRequest == null
<ide> ? true
<del> : config.onPanResponderTerminationRequest(e, gestureState);
<add> : config.onPanResponderTerminationRequest(event, gestureState);
<ide> },
<ide> };
<ide> return {
<ide> const PanResponder = {
<ide>
<ide> function clearInteractionHandle(
<ide> interactionState: {handle: ?number},
<del> callback: Function,
<del> event: Object,
<del> gestureState: Object,
<add> callback: ?(ActiveCallback | PassiveCallback),
<add> event: PressEvent,
<add> gestureState: GestureState,
<ide> ) {
<ide> if (interactionState.handle) {
<ide> InteractionManager.clearInteractionHandle(interactionState.handle);
<ide><path>Libraries/Types/CoreEventTypes.js
<ide> export type SyntheticEvent<T> = $ReadOnly<{|
<ide> type: ?string,
<ide> |}>;
<ide>
<add>export type ResponderSyntheticEvent<T> = $ReadOnly<{|
<add> ...SyntheticEvent<T>,
<add> touchHistory: $ReadOnly<{|
<add> indexOfSingleActiveTouch: number,
<add> mostRecentTimeStamp: number,
<add> numberActiveTouches: number,
<add> touchBank: $ReadOnlyArray<
<add> $ReadOnly<{|
<add> touchActive: boolean,
<add> startPageX: number,
<add> startPageY: number,
<add> startTimeStamp: number,
<add> currentPageX: number,
<add> currentPageY: number,
<add> currentTimeStamp: number,
<add> previousPageX: number,
<add> previousPageY: number,
<add> previousTimeStamp: number,
<add> |}>,
<add> >,
<add> |}>,
<add>|}>;
<add>
<ide> export type Layout = $ReadOnly<{|
<ide> x: number,
<ide> y: number,
<ide> export type TextLayoutEvent = SyntheticEvent<
<ide> |}>,
<ide> >;
<ide>
<del>export type PressEvent = SyntheticEvent<
<add>export type PressEvent = ResponderSyntheticEvent<
<ide> $ReadOnly<{|
<ide> changedTouches: $ReadOnlyArray<$PropertyType<PressEvent, 'nativeEvent'>>,
<ide> force: number, | 3 |
Javascript | Javascript | remove duplicate infobox checks | ab5dabf876cca785314f198c6e4e47d5a3bcb46a | <ide><path>src/node.js
<ide> // run callbacks that have no domain
<ide> // using domains will cause this to be overridden
<ide> function _tickCallback() {
<del> var callback, nextTickLength, threw;
<add> var callback, threw;
<ide>
<del> if (infoBox[inTick] === 1) return;
<del> if (infoBox[length] === 0) {
<del> infoBox[index] = 0;
<del> return;
<del> }
<ide> infoBox[inTick] = 1;
<ide>
<ide> while (infoBox[index] < infoBox[length]) {
<ide> }
<ide>
<ide> function _tickDomainCallback() {
<del> var nextTickLength, tock, callback;
<add> var tock, callback, domain;
<ide>
<del> if (infoBox[lastThrew] === 1) {
<del> infoBox[lastThrew] = 0;
<del> return;
<del> }
<del>
<del> if (infoBox[inTick] === 1) return;
<del> if (infoBox[length] === 0) {
<del> infoBox[index] = 0;
<del> return;
<del> }
<ide> infoBox[inTick] = 1;
<ide>
<ide> while (infoBox[index] < infoBox[length]) {
<ide> tock = nextTickQueue[infoBox[index]++];
<ide> callback = tock.callback;
<del> if (tock.domain) {
<del> if (tock.domain._disposed) continue;
<del> tock.domain.enter();
<add> domain = tock.domain;
<add> if (domain) {
<add> if (domain._disposed) continue;
<add> domain.enter();
<ide> }
<ide> infoBox[lastThrew] = 1;
<ide> try {
<ide> } finally {
<ide> if (infoBox[lastThrew] === 1) tickDone();
<ide> }
<del> if (tock.domain)
<del> tock.domain.exit();
<add> if (domain)
<add> domain.exit();
<ide> }
<ide>
<ide> tickDone(); | 1 |
Ruby | Ruby | drop emacs dep audit | 9f42b6b9c7a7713242ab06cc21e082fd31f59dda | <ide><path>Library/Homebrew/cmd/audit.rb
<ide> def audit_deps
<ide> when *BUILD_TIME_DEPS
<ide> next if dep.build? or dep.run?
<ide> problem %{#{dep} dependency should be "depends_on '#{dep}' => :build"}
<del> when "git", "ruby", "emacs", "mercurial"
<add> when "git", "ruby", "mercurial"
<ide> problem <<-EOS.undent
<ide> Don't use #{dep} as a dependency. We allow non-Homebrew
<ide> #{dep} installations. | 1 |
Ruby | Ruby | add missing require | 0faa7ee2a05b261ef89fb4652eaa0cfeef86c1d5 | <ide><path>activesupport/test/gzip_test.rb
<ide> require 'abstract_unit'
<add>require 'active_support/core_ext/object/blank'
<ide>
<ide> class GzipTest < Test::Unit::TestCase
<ide> def test_compress_should_decompress_to_the_same_value
<ide> def test_compress_should_return_a_binary_string
<ide>
<ide> assert !compressed.blank?, "a compressed blank string should not be blank"
<ide> end
<del>end
<ide>\ No newline at end of file
<add>end | 1 |
PHP | PHP | remove unused use-statement | 64804d58f7ce957a0236c834ac6d68c2deb7c13e | <ide><path>tests/Integration/Database/QueryBuilderTest.php
<ide> use Illuminate\Support\Carbon;
<ide> use Illuminate\Support\Facades\DB;
<ide> use Illuminate\Support\Facades\Schema;
<del>use Illuminate\Tests\Integration\Database\DatabaseTestCase;
<ide>
<ide> /**
<ide> * @group integration | 1 |
Javascript | Javascript | fix iteration bug in valueseq | e5ab28a086a9edf7bd608bae6c2519cc875b4f1f | <ide><path>dist/Immutable.js
<ide> var $Sequence = Sequence;
<ide> valuesSequence.length = sequence.length;
<ide> valuesSequence.valueSeq = returnThis;
<ide> valuesSequence.__iterateUncached = function(fn, reverse, flipIndices) {
<del> if (flipIndices && this.length == null) {
<del> return this.cacheResult().__iterate(fn, reverse, flipIndices);
<del> }
<add> var $__0 = this;
<ide> var iterations = 0;
<ide> var predicate;
<ide> if (flipIndices) {
<del> iterations = this.length - 1;
<add> var maxIndex = this.length - 1;
<ide> predicate = (function(v, k, c) {
<del> return fn(v, iterations--, c) !== false;
<add> return fn(v, maxIndex - iterations++, $__0) !== false;
<ide> });
<ide> } else {
<ide> predicate = (function(v, k, c) {
<del> return fn(v, iterations++, c) !== false;
<add> return fn(v, iterations++, $__0) !== false;
<ide> });
<ide> }
<ide> sequence.__iterate(predicate, reverse);
<del> return flipIndices ? this.length : iterations;
<add> return iterations;
<ide> };
<ide> return valuesSequence;
<ide> },
<ide><path>dist/Immutable.min.js
<ide> * LICENSE file in the root directory of this source tree. An additional grant
<ide> * of patent rights can be found in the PATENTS file in the same directory.
<ide> */
<del>function t(){function t(t,e,n,r){var i;if(r){var u=r.prototype;i=de.create(u)}else i=t.prototype;return de.keys(e).forEach(function(t){i[t]=e[t]}),de.keys(n).forEach(function(e){t[e]=n[e]}),i.constructor=t,t.prototype=i,t}function e(t,e,n,r){return de.getPrototypeOf(e)[n].apply(t,r)}function n(t,n,r){e(t,n,"constructor",r)}function r(t){return t.value=!1,t}function i(t){t&&(t.value=!0)}function u(){}function s(t,e){e=e||0;for(var n=Math.max(0,t.length-e),r=Array(n),i=0;n>i;i++)r[i]=t[i+e];return r}function a(t){return be.value=t,be.done=!1,be}function h(){return be.value=void 0,be.done=!0,be}function o(t,e){if(!t)throw Error(e)}function c(t){if(!t)return 0;if(t===!0)return 1;var e=typeof t;if("number"===e){if((0|t)===t)return t&Ae;t=""+t,e="string"}return"string"===e?t.length>je?f(t):_(t):t.hashCode?c("function"==typeof t.hashCode?t.hashCode():t.hashCode):l(t)}function f(t){var e=We[t];return null==e&&(e=_(t),Ue===Re&&(Ue=0,We={}),Ue++,We[t]=e),e}function _(t){for(var e=0,n=0;t.length>n;n++)e=31*e+t.charCodeAt(n)&Ae;return e}function l(t){if(t[Ce])return t[Ce];var e=++xe&Ae;if(!Ee)try{return Object.defineProperty(t,Ce,{enumerable:!1,configurable:!1,writable:!1,value:e}),e}catch(n){Ee=!0}return t[Ce]=e,e}function v(){return Object.create(ze)}function g(t){var e=Object.create(Le);return e.__reversedIndices=t?t.__reversedIndices:!1,e}function p(t,e,n,r){var i=t.get?t.get(e[r],ke):ke;return i===ke?n:++r===e.length?i:p(i,e,n,r)}function m(t,e,n){return(0===t||null!=n&&-n>=t)&&(null==e||null!=n&&e>=n)}function d(t,e){return w(t,e,0)}function y(t,e){return w(t,e,e)}function w(t,e,n){return null==t?n:0>t?Math.max(0,e+t):e?Math.min(e,t):t}function S(t){return t}function I(t,e){return[e,t]}function k(){return!0}function q(){return this}function M(t){return(t||0)+1}function b(t,e,n,r){var i=t.__makeSequence();return i.__iterateUncached=function(i,u,s){var a=this,h=0;return t.__iterate(function(t,u,s){if(e.call(n,t,u,s)){if(i(t,r?u:h,a)===!1)return!1;h++}},u,s),h},i}function D(t,e,n,r){var i=In.empty().withMutations(function(i){t.forEach(function(u,s){var a=e.call(n,u,s,t),h=i.get(a);
<del>h||(h=[],i.set(a,h)),h.push(r?[s,u]:u)})});return i.map(r?function(t){return Pe(t).fromEntrySeq()}:function(t){return Pe(t)})}function O(t){return function(){return!t.apply(this,arguments)}}function A(t){return"string"==typeof t?JSON.stringify(t):t}function x(t,e){return t>e?1:e>t?-1:0}function C(t,e){return 0>e?(null==t.length&&t.cacheResult(),t.length+e):e}function E(t){o(1/0!==t,"Cannot perform this action with an infinite sequence.")}function j(t,e){var n=new Ge;return n.next=function(){var n=t.next();return n.done?n:(n.value=e(n.value),n)},n}function R(t,e,n){return n instanceof Pe?U(t,e,n):n}function U(t,e,n){return new Qe(t._rootData,t._keyPath.concat(e),t._onChange,n)}function W(t,e,n){var r=t._rootData.updateIn(t._keyPath,n?Te.empty():void 0,e),i=t._keyPath||[];return t._onChange&&t._onChange.call(void 0,r,t._rootData,n?i.concat(n):i),new Qe(r,t._keyPath,t._onChange)}function P(t,e){return t instanceof Qe&&(t=t.deref()),e instanceof Qe&&(e=e.deref()),t===e?0!==t||0!==e||1/t===1/e:t!==t?e!==e:t instanceof Pe?t.equals(e):!1}function J(t,e){return a(0===t||1===t?e[t]:[e[0],e[1]])}function z(t,e){return{node:t,index:0,__prev:e}}function K(t,e,n,r){var i=Object.create(Ye);return i.length=t,i._root=e,i.__ownerID=n,i.__hash=r,i.__altered=!1,i}function B(t,e,n){var i=r(qe),u=r(Me),s=L(t._root,t.__ownerID,0,c(e),e,n,i,u);if(!u.value)return t;var a=t.length+(i.value?n===ke?-1:1:0);return t.__ownerID?(t.length=a,t._root=s,t.__hash=void 0,t.__altered=!0,t):s?K(a,s):Te.empty()}function L(t,e,n,r,u,s,a,h){return t?t.update(e,n,r,u,s,a,h):s===ke?t:(i(h),i(a),new un(e,r,[u,s]))}function V(t){return t.constructor===un||t.constructor===nn}function N(t,e,n,r,i){if(t.hash===r)return new nn(e,r,[t.entry,i]);var u,s=(0===n?t.hash:t.hash>>>n)&Ie,a=(0===n?r:r>>>n)&Ie,h=s===a?[N(t,e,n+we,r,i)]:(u=new un(e,r,i),a>s?[t,u]:[u,t]);return new Ze(e,1<<s|1<<a,h)}function F(t,e,n,r){for(var i=0,u=0,s=Array(n),a=0,h=1,o=e.length;o>a;a++,h<<=1){var c=e[a];null!=c&&a!==r&&(i|=h,s[u++]=c)}return new Ze(t,i,s)}function G(t,e,n,r,i){for(var u=0,s=Array(Se),a=0;0!==n;a++,n>>>=1)s[a]=1&n?e[u++]:null;
<add>function t(){function t(t,e,n,r){var i;if(r){var u=r.prototype;i=de.create(u)}else i=t.prototype;return de.keys(e).forEach(function(t){i[t]=e[t]}),de.keys(n).forEach(function(e){t[e]=n[e]}),i.constructor=t,t.prototype=i,t}function e(t,e,n,r){return de.getPrototypeOf(e)[n].apply(t,r)}function n(t,n,r){e(t,n,"constructor",r)}function r(t){return t.value=!1,t}function i(t){t&&(t.value=!0)}function u(){}function s(t,e){e=e||0;for(var n=Math.max(0,t.length-e),r=Array(n),i=0;n>i;i++)r[i]=t[i+e];return r}function a(t){return be.value=t,be.done=!1,be}function h(){return be.value=void 0,be.done=!0,be}function o(t,e){if(!t)throw Error(e)}function c(t){if(!t)return 0;if(t===!0)return 1;var e=typeof t;if("number"===e){if((0|t)===t)return t&Ae;t=""+t,e="string"}return"string"===e?t.length>je?f(t):_(t):t.hashCode?c("function"==typeof t.hashCode?t.hashCode():t.hashCode):l(t)}function f(t){var e=We[t];return null==e&&(e=_(t),Re===Ue&&(Re=0,We={}),Re++,We[t]=e),e}function _(t){for(var e=0,n=0;t.length>n;n++)e=31*e+t.charCodeAt(n)&Ae;return e}function l(t){if(t[Ce])return t[Ce];var e=++xe&Ae;if(!Ee)try{return Object.defineProperty(t,Ce,{enumerable:!1,configurable:!1,writable:!1,value:e}),e}catch(n){Ee=!0}return t[Ce]=e,e}function v(){return Object.create(ze)}function g(t){var e=Object.create(Le);return e.__reversedIndices=t?t.__reversedIndices:!1,e}function p(t,e,n,r){var i=t.get?t.get(e[r],ke):ke;return i===ke?n:++r===e.length?i:p(i,e,n,r)}function m(t,e,n){return(0===t||null!=n&&-n>=t)&&(null==e||null!=n&&e>=n)}function d(t,e){return w(t,e,0)}function y(t,e){return w(t,e,e)}function w(t,e,n){return null==t?n:0>t?Math.max(0,e+t):e?Math.min(e,t):t}function S(t){return t}function I(t,e){return[e,t]}function k(){return!0}function q(){return this}function M(t){return(t||0)+1}function b(t,e,n,r){var i=t.__makeSequence();return i.__iterateUncached=function(i,u,s){var a=this,h=0;return t.__iterate(function(t,u,s){if(e.call(n,t,u,s)){if(i(t,r?u:h,a)===!1)return!1;h++}},u,s),h},i}function D(t,e,n,r){var i=In.empty().withMutations(function(i){t.forEach(function(u,s){var a=e.call(n,u,s,t),h=i.get(a);
<add>h||(h=[],i.set(a,h)),h.push(r?[s,u]:u)})});return i.map(r?function(t){return Pe(t).fromEntrySeq()}:function(t){return Pe(t)})}function O(t){return function(){return!t.apply(this,arguments)}}function A(t){return"string"==typeof t?JSON.stringify(t):t}function x(t,e){return t>e?1:e>t?-1:0}function C(t,e){return 0>e?(null==t.length&&t.cacheResult(),t.length+e):e}function E(t){o(1/0!==t,"Cannot perform this action with an infinite sequence.")}function j(t,e){var n=new Ge;return n.next=function(){var n=t.next();return n.done?n:(n.value=e(n.value),n)},n}function U(t,e,n){return n instanceof Pe?R(t,e,n):n}function R(t,e,n){return new Qe(t._rootData,t._keyPath.concat(e),t._onChange,n)}function W(t,e,n){var r=t._rootData.updateIn(t._keyPath,n?Te.empty():void 0,e),i=t._keyPath||[];return t._onChange&&t._onChange.call(void 0,r,t._rootData,n?i.concat(n):i),new Qe(r,t._keyPath,t._onChange)}function P(t,e){return t instanceof Qe&&(t=t.deref()),e instanceof Qe&&(e=e.deref()),t===e?0!==t||0!==e||1/t===1/e:t!==t?e!==e:t instanceof Pe?t.equals(e):!1}function J(t,e){return a(0===t||1===t?e[t]:[e[0],e[1]])}function z(t,e){return{node:t,index:0,__prev:e}}function K(t,e,n,r){var i=Object.create(Ye);return i.length=t,i._root=e,i.__ownerID=n,i.__hash=r,i.__altered=!1,i}function B(t,e,n){var i=r(qe),u=r(Me),s=L(t._root,t.__ownerID,0,c(e),e,n,i,u);if(!u.value)return t;var a=t.length+(i.value?n===ke?-1:1:0);return t.__ownerID?(t.length=a,t._root=s,t.__hash=void 0,t.__altered=!0,t):s?K(a,s):Te.empty()}function L(t,e,n,r,u,s,a,h){return t?t.update(e,n,r,u,s,a,h):s===ke?t:(i(h),i(a),new un(e,r,[u,s]))}function V(t){return t.constructor===un||t.constructor===nn}function N(t,e,n,r,i){if(t.hash===r)return new nn(e,r,[t.entry,i]);var u,s=(0===n?t.hash:t.hash>>>n)&Ie,a=(0===n?r:r>>>n)&Ie,h=s===a?[N(t,e,n+we,r,i)]:(u=new un(e,r,i),a>s?[t,u]:[u,t]);return new Ze(e,1<<s|1<<a,h)}function F(t,e,n,r){for(var i=0,u=0,s=Array(n),a=0,h=1,o=e.length;o>a;a++,h<<=1){var c=e[a];null!=c&&a!==r&&(i|=h,s[u++]=c)}return new Ze(t,i,s)}function G(t,e,n,r,i){for(var u=0,s=Array(Se),a=0;0!==n;a++,n>>>=1)s[a]=1&n?e[u++]:null;
<ide> return s[r]=i,new tn(t,u+1,s)}function H(t,e,n){for(var r=[],i=0;n.length>i;i++){var u=n[i];u&&r.push(Array.isArray(u)?Pe(u).fromEntrySeq():Pe(u))}return T(t,e,r)}function Q(t){return function(e,n){return e&&e.mergeDeepWith?e.mergeDeepWith(t,n):t?t(e,n):n}}function T(t,e,n){return 0===n.length?t:t.withMutations(function(t){for(var r=e?function(n,r){var i=t.get(r,ke);t.set(r,i===ke?n:e(i,n))}:function(e,n){t.set(n,e)},i=0;n.length>i;i++)n[i].forEach(r)})}function X(t,e,n,r,i){var u=e.length;if(i===u)return r(t);o(t.set,"updateIn with invalid keyPath");var s=i===u-1?n:Te.empty(),a=e[i],h=t.get(a,s),c=X(h,e,n,r,i+1);return c===h?t:t.set(a,c)}function Y(t){return t-=t>>1&1431655765,t=(858993459&t)+(t>>2&858993459),t=t+(t>>4)&252645135,t+=t>>8,t+=t>>16,127&t}function Z(t,e,n,r){var i=r?t:s(t);return i[e]=n,i}function $(t,e,n,r){var i=t.length+1;if(r&&e+1===i)return t[e]=n,t;for(var u=Array(i),s=0,a=0;i>a;a++)a===e?(u[a]=n,s=-1):u[a]=t[a+s];return u}function te(t,e,n){var r=t.length-1;if(n&&e===r)return t.pop(),t;for(var i=Array(r),u=0,s=0;r>s;s++)s===e&&(u=1),i[s]=t[s+u];return i}function ee(t,e,n,r,i,u){var s,a=t&&t.array;if(0===e){var h=0>n?0:n,o=n+Se;for(o>r&&(o=r),s=h;o>s;s++){var c=u?h+o-1-s:s;if(i(a&&a[c-n],c)===!1)return!1}}else{var f=1<<e,_=e-we;for(s=0;Ie>=s;s++){var l=u?Ie-s:s,v=n+(l<<e);if(r>v&&v+f>0){var g=a&&a[l];if(!ee(g,_,v,r,i,u))return!1}}}return!0}function ne(t,e,n,r,i){return{array:t,level:e,offset:n,max:r,rawMax:r-n>>e,index:0,__prev:i}}function re(t,e,n,r,i,u,s){var a=Object.create(ln);return a.length=e-t,a._origin=t,a._size=e,a._level=n,a._root=r,a._tail=i,a.__ownerID=u,a.__hash=s,a.__altered=!1,a}function ie(t,e,n){if(e=C(t,e),e>=t.length||0>e)return n===ke?t:t.withMutations(function(t){0>e?he(t,e).set(0,n):he(t,0,e+1).set(e,n)});e+=t._origin;var i=t._tail,u=t._root,s=r(Me);return e>=ce(t._size)?i=ue(i,t.__ownerID,0,e,n,s):u=ue(u,t.__ownerID,t._level,e,n,s),s.value?t.__ownerID?(t._root=u,t._tail=i,t.__hash=void 0,t.__altered=!0,t):re(t._origin,t._size,t._level,u,i):t}function ue(t,e,n,r,u,s){var a,h=u===ke,o=r>>>n&Ie,c=t&&t.array.length>o;
<ide> if(h&&!c)return t;if(n>0){var f=t&&t.array[o],_=ue(f,e,n-we,r,u,s);return _===f?t:(a=se(t,e),a.array[o]=_,a)}return!h&&c&&t.array[o]===u?t:(i(s),a=se(t,e),h&&o===a.array.length-1?a.array.pop():a.array[o]=h?void 0:u,a)}function se(t,e){return e&&t&&e===t.ownerID?t:new vn(t?t.array.slice():[],e)}function ae(t,e){if(e>=ce(t._size))return t._tail;if(1<<t._level+we>e){for(var n=t._root,r=t._level;n&&r>0;)n=n.array[e>>>r&Ie],r-=we;return n}}function he(t,e,n){var r=t.__ownerID||new u,i=t._origin,s=t._size,a=i+e,h=null==n?s:0>n?s+n:i+n;if(a===i&&h===s)return t;if(a>=h)return t.clear();for(var o=t._level,c=t._root,f=0;0>a+f;)c=new vn(c&&c.array.length?[null,c]:[],r),o+=we,f+=1<<o;f&&(a+=f,i+=f,h+=f,s+=f);for(var _=ce(s),l=ce(h);l>=1<<o+we;)c=new vn(c&&c.array.length?[c]:[],r),o+=we;var v=t._tail,g=_>l?ae(t,h-1):l>_?new vn([],r):v;if(v&&l>_&&s>a&&v.array.length){c=se(c,r);for(var p=c,m=o;m>we;m-=we){var d=_>>>m&Ie;p=p.array[d]=se(p.array[d],r)}p.array[_>>>we&Ie]=v}if(s>h&&(g=g&&g.removeAfter(r,0,h)),a>=l)a-=l,h-=l,o=we,c=null,g=g&&g.removeBefore(r,0,a);else if(a>i||_>l){var y,w;f=0;do y=a>>>o&Ie,w=l-1>>>o&Ie,y===w&&(y&&(f+=(1<<o)*y),o-=we,c=c&&c.array[y]);while(c&&y===w);c&&a>i&&(c=c&&c.removeBefore(r,o,a-f)),c&&_>l&&(c=c&&c.removeAfter(r,o,l-f)),f&&(a-=f,h-=f)}return t.__ownerID?(t.length=h-a,t._origin=a,t._size=h,t._level=o,t._root=c,t._tail=g,t.__hash=void 0,t.__altered=!0,t):re(a,h,o,c,g)}function oe(t,e,n){for(var r=[],i=0;n.length>i;i++){var u=n[i];u&&r.push(Pe(u))}var s=Math.max.apply(null,r.map(function(t){return t.length||0}));return s>t.length&&(t=t.setLength(s)),T(t,e,r)}function ce(t){return Se>t?0:t-1>>>we<<we}function fe(t,e){var n=Object.create(wn);return n.length=t?t.length:0,n._map=t,n.__ownerID=e,n}function _e(t,e,n,r){var i=Object.create(In.prototype);return i.length=t?t.length:0,i._map=t,i._vector=e,i.__ownerID=n,i.__hash=r,i}function le(t,e,n){var r=t._map,i=t._vector,u=r.get(e),s=void 0!==u,a=n===ke;if(!s&&a||s&&n===i.get(u)[1])return t;s||(u=i.length);var h=a?r.remove(e):s?r:r.set(e,u),o=a?i.remove(u):i.set(u,[e,n]);
<del>return t.__ownerID?(t.length=h.length,t._map=h,t._vector=o,t.__hash=void 0,t):_e(h,o)}function ve(t,e,n){var r=Object.create(Object.getPrototypeOf(t));return r._map=e,r.__ownerID=n,r}function ge(t,e){return e?pe(e,t,"",{"":t}):me(t)}function pe(t,e,n,r){return e&&(Array.isArray(e)||e.constructor===Object)?t.call(r,n,Pe(e).map(function(n,r){return pe(t,n,r,e)})):e}function me(t){if(t){if(Array.isArray(t))return Pe(t).map(me).toVector();if(t.constructor===Object)return Pe(t).map(me).toMap()}return t}var de=Object,ye={};ye.createClass=t,ye.superCall=e,ye.defaultSuperCall=n;var we=5,Se=1<<we,Ie=Se-1,ke={},qe={value:!1},Me={value:!1},be={value:void 0,done:!1},De="delete",Oe="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator",Ae=2147483647,xe=0,Ce="__immutablehash__";"undefined"!=typeof Symbol&&(Ce=Symbol(Ce));var Ee=!1,je=16,Re=255,Ue=0,We={},Pe=function(t){return Je.from(1===arguments.length?t:Array.prototype.slice.call(arguments))},Je=Pe;ye.createClass(Pe,{toString:function(){return this.__toString("Seq {","}")},__toString:function(t,e){return 0===this.length?t+e:t+" "+this.map(this.__toStringMapper).join(", ")+" "+e},__toStringMapper:function(t,e){return e+": "+A(t)},toJS:function(){return this.map(function(t){return t instanceof Je?t.toJS():t}).__toJS()},toArray:function(){E(this.length);var t=Array(this.length||0);return this.valueSeq().forEach(function(e,n){t[n]=e}),t},toObject:function(){E(this.length);var t={};return this.forEach(function(e,n){t[n]=e}),t},toVector:function(){return E(this.length),fn.from(this)},toMap:function(){return E(this.length),Te.from(this)},toOrderedMap:function(){return E(this.length),In.from(this)},toSet:function(){return E(this.length),dn.from(this)},toKeyedSeq:function(){return this},hashCode:function(){return this.__hash||(this.__hash=1/0===this.length?0:this.reduce(function(t,e,n){return t+(c(e)^(e===n?0:c(n)))&Ae},0))},equals:function(t){if(this===t)return!0;if(!(t instanceof Je))return!1;if(null!=this.length&&null!=t.length){if(this.length!==t.length)return!1;if(0===this.length&&0===t.length)return!0
<del>}return null!=this.__hash&&null!=t.__hash&&this.__hash!==t.__hash?!1:this.__deepEquals(t)},__deepEquals:function(t){var e=this.cacheResult().entrySeq().toArray(),n=0;return t.every(function(t,r){var i=e[n++];return P(r,i[0])&&P(t,i[1])})},join:function(t){t=void 0!==t?""+t:",";var e="",n=!0;return this.forEach(function(r){n?(n=!1,e+=null!=r?r:""):e+=t+(null!=r?r:"")}),e},count:function(t,e){return t?this.filter(t,e).count():(null==this.length&&(this.length=this.forEach(k)),this.length)},countBy:function(t){var e=this;return In.empty().withMutations(function(n){e.forEach(function(e,r,i){n.update(t(e,r,i),M)})})},concat:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];var n=[this].concat(t.map(function(t){return Je(t)})),r=this.__makeSequence();return r.length=n.reduce(function(t,e){return null!=t&&null!=e.length?t+e.length:void 0},0),r.__iterateUncached=function(t,e){for(var r,i=0,u=n.length-1,s=0;u>=s&&!r;s++){var a=n[e?u-s:s];i+=a.__iterate(function(e,n,i){return t(e,n,i)===!1?(r=!0,!1):void 0},e)}return i},r},reverse:function(){var t=this,e=t.__makeSequence();return e.reverse=function(){return t},e.length=t.length,e.__iterateUncached=function(e,n){return t.__iterate(e,!n)},e},keySeq:function(){return this.flip().valueSeq()},valueSeq:function(){var t=this,e=g(t);return e.length=t.length,e.valueSeq=q,e.__iterateUncached=function(e,n,r){if(r&&null==this.length)return this.cacheResult().__iterate(e,n,r);var i,u=0;return r?(u=this.length-1,i=function(t,n,r){return e(t,u--,r)!==!1}):i=function(t,n,r){return e(t,u++,r)!==!1},t.__iterate(i,n),r?this.length:u},e},entrySeq:function(){var t=this;if(t._cache)return Je(t._cache);var e=t.map(I).valueSeq();return e.fromEntries=function(){return t},e},forEach:function(t,e){return this.__iterate(e?t.bind(e):t)},reduce:function(t,e,n){var r,i;return 2>arguments.length?i=!0:r=e,this.forEach(function(e,u,s){i?(i=!1,r=e):r=t.call(n,r,e,u,s)}),r},reduceRight:function(){var t=this.toKeyedSeq().reverse();return t.reduce.apply(t,arguments)},every:function(t,e){var n=!0;
<del>return this.forEach(function(r,i,u){return t.call(e,r,i,u)?void 0:(n=!1,!1)}),n},some:function(t,e){return!this.every(O(t),e)},first:function(){return this.find(k)},last:function(){return this.findLast(k)},rest:function(){return this.slice(1)},butLast:function(){return this.slice(0,-1)},has:function(t){return this.get(t,ke)!==ke},get:function(t,e){return this.find(function(e,n){return P(n,t)},null,e)},getIn:function(t,e){return t&&0!==t.length?p(this,t,e,0):this},contains:function(t){return this.find(function(e){return P(e,t)},null,ke)!==ke},find:function(t,e,n){var r=n;return this.forEach(function(n,i,u){return t.call(e,n,i,u)?(r=n,!1):void 0}),r},findKey:function(t,e){var n;return this.forEach(function(r,i,u){return t.call(e,r,i,u)?(n=i,!1):void 0}),n},findLast:function(t,e,n){return this.toKeyedSeq().reverse().find(t,e,n)},findLastKey:function(t,e){return this.toKeyedSeq().reverse().findKey(t,e)},flip:function(){var t=this,e=v();return e.length=t.length,e.flip=function(){return t},e.__iterateUncached=function(e,n){var r=this;return t.__iterate(function(t,n){return e(n,t,r)!==!1},n)},e},map:function(t,e){var n=this,r=n.__makeSequence();return r.length=n.length,r.__iterateUncached=function(r,i){var u=this;return n.__iterate(function(n,i,s){return r(t.call(e,n,i,s),i,u)!==!1},i)},r},mapKeys:function(t,e){var n=this,r=n.__makeSequence();return r.length=n.length,r.__iterateUncached=function(r,i){var u=this;return n.__iterate(function(n,i,s){return r(n,t.call(e,i,n,s),u)!==!1},i)},r},filter:function(t,e){return b(this,t,e,!0)},slice:function(t,e){if(m(t,e,this.length))return this;var n=d(t,this.length),r=y(e,this.length);if(n!==n||r!==r)return this.entrySeq().slice(t,e).fromEntrySeq();var i=0===n?this:this.skip(n);return null==r||r===this.length?i:i.take(r-n)},take:function(t){var e=this;if(t>e.length)return e;var n=e.__makeSequence();return n.__iterateUncached=function(n,r,i){var u=this;if(r)return this.cacheResult().__iterate(n,r,i);var s=0;return e.__iterate(function(e,r){return t>s&&n(e,r,u)!==!1?void s++:!1},r,i),s
<del>},n.length=this.length&&Math.min(this.length,t),n},takeLast:function(t){return this.reverse().take(t).reverse()},takeWhile:function(t,e){var n=this,r=n.__makeSequence();return r.__iterateUncached=function(r,i,u){var s=this;if(i)return this.cacheResult().__iterate(r,i,u);var a=0;return n.__iterate(function(n,i,u){return t.call(e,n,i,u)&&r(n,i,s)!==!1?void a++:!1},i,u),a},r},takeUntil:function(t,e){return this.takeWhile(O(t),e)},skip:function(t){var e=this;if(0===t)return e;var n=e.__makeSequence();return n.__iterateUncached=function(n,r,i){var u=this;if(r)return this.cacheResult().__iterate(n,r,i);var s=!0,a=0,h=0;return e.__iterate(function(e,r){if(!s||!(s=h++<t)){if(n(e,r,u)===!1)return!1;a++}},r,i),a},n.length=this.length&&Math.max(0,this.length-t),n},skipLast:function(t){return this.reverse().skip(t).reverse()},skipWhile:function(t,e){var n=this,r=n.__makeSequence();return r.__iterateUncached=function(r,i,u){var s=this;if(i)return this.cacheResult().__iterate(r,i,u);var a=!0,h=0;return n.__iterate(function(n,i,u){if(!a||!(a=t.call(e,n,i,u))){if(r(n,i,s)===!1)return!1;h++}},i,u),h},r},skipUntil:function(t,e){return this.skipWhile(O(t),e)},groupBy:function(t,e){return D(this,t,e,!0)},sort:function(t){return this.sortBy(S,t)},sortBy:function(t,e){e=e||x;var n=this;return Je(this.entrySeq().entrySeq().toArray().sort(function(r,i){return e(t(r[1][1],r[1][0],n),t(i[1][1],i[1][0],n))||r[0]-i[0]})).fromEntrySeq().valueSeq().fromEntrySeq()},cacheResult:function(){return!this._cache&&this.__iterateUncached&&(E(this.length),this._cache=this.entrySeq().toArray(),null==this.length&&(this.length=this._cache.length)),this},__iterate:function(t,e){var n=this._cache;if(n){for(var r=n.length-1,i=0;r>=i;i++){var u=n[e?r-i:i];if(t(u[1],u[0],this)===!1)break}return i}return this.__iterateUncached(t,e)},__makeSequence:function(){return v()}},{from:function(t){if(t instanceof Je)return t;if(!Array.isArray(t)){if(t&&t.constructor===Object)return new Ne(t);t=[t]}return new Fe(t)}});var ze=Pe.prototype;ze.toJSON=ze.toJS,ze.__toJS=ze.toObject,ze.inspect=ze.toSource=function(){return""+this
<del>};var Ke=function(){ye.defaultSuperCall(this,Be.prototype,arguments)},Be=Ke;ye.createClass(Ke,{toString:function(){return this.__toString("Seq [","]")},toArray:function(){E(this.length);var t=Array(this.length||0);return t.length=this.forEach(function(e,n){t[n]=e}),t},toKeyedSeq:function(){return new Ve(this)},fromEntrySeq:function(){var t=this,e=v();return e.length=t.length,e.entrySeq=function(){return t},e.__iterateUncached=function(e,n){var r=this;return t.__iterate(function(t){return t&&e(t[1],t[0],r)},n)},e},join:function(t){t=void 0!==t?""+t:",";var e="";return this.forEach(function(n,r){e+=(r?t:"")+(null!=n?n:"")}),e},concat:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];var n=[this].concat(t).map(function(t){return Pe(t)}),r=this.__makeSequence();return r.length=n.reduce(function(t,e){return null!=t&&null!=e.length?t+e.length:void 0},0),r.__iterateUncached=function(t,e,r){for(var i,u=this,s=0,a=r&&this.length-1,h=n.length-1,o=0;h>=o&&!i;o++){var c=n[e?h-o:o];c instanceof Be||(c=c.valueSeq()),s+=c.__iterate(function(e,n){return n+=s,t(e,r?a-n:n,u)===!1?(i=!0,!1):void 0},e)}return s},r},reverse:function(){var t=this,e=t.__makeSequence();return e.reverse=function(){return t},e.length=t.length,e.__reversedIndices=t.__reversedIndices,e.__iterateUncached=function(e,n,r){var i=this,u=r?this.length:0;return t.__iterate(function(t){return e(t,r?--u:u++,i)!==!1},!n)},e},filter:function(t,e){return b(this,t,e,!1)},get:function(t,e){return t=C(this,t),this.find(function(e,n){return n===t},null,e)},indexOf:function(t){return this.findIndex(function(e){return P(e,t)})},lastIndexOf:function(t){return this.toKeyedSeq().reverse().indexOf(t)},findIndex:function(t,e){var n=this.findKey(t,e);return null==n?-1:n},findLastIndex:function(t,e){return this.toKeyedSeq().reverse().findIndex(t,e)},slice:function(t,e){var n=this;if(m(t,e,n.length))return n;var r=n.__makeSequence(),i=d(t,n.length),u=y(e,n.length);return r.length=n.length&&u-i,r.__reversedIndices=n.__reversedIndices,r.__iterateUncached=function(r,s,a){var h=this;
<del>if(s)return this.cacheResult().__iterate(r,s,a);var o=this.__reversedIndices^a;if(i!==i||u!==u||o&&null==n.length){var c=n.count();i=d(t,c),u=y(e,c)}var f=o?n.length-u:i,_=o?n.length-i:u,l=n.__iterate(function(t,e){return o?null!=_&&e>=_||e>=f&&r(t,e-f,h)!==!1:f>e||(null==_||_>e)&&r(t,e-f,h)!==!1},s,a);return null!=this.length?this.length:Math.max(0,l-f)},r},splice:function(t,e){var n=arguments.length;if(e=Math.max(0|e,0),0===n||2===n&&!e)return this;t=d(t,this.length);var r=this.slice(0,t);return 1===n?r:r.concat(s(arguments,2),this.slice(t+e))},flatten:function(){var t=this,e=t.__makeSequence();return e.__iterateUncached=function(e,n,r){var i=this;if(r)return this.cacheResult().__iterate(e,n,r);var u=0;return t.__iterate(function(t){u+=Pe(t).__iterate(function(t,n){return e(t,u+n,i)!==!1},n,r)},n,r),u},e},flatMap:function(t,e){return this.map(t,e).flatten()},skip:function(t){var e=this;if(0===t)return e;var n=e.__makeSequence();return n.__iterateUncached=function(n,r,i){var u=this;if(r)return this.cacheResult().__iterate(n,r,i);var s=e.__reversedIndices^i,a=!0,h=0,o=0,c=e.__iterate(function(e,r){return a&&(a=o++<t,a||(h=r)),a||n(e,s?r:r-h,u)!==!1},r,i);return s?h+1:c-h},n.length=this.length&&Math.max(0,this.length-t),n},skipWhile:function(t,e){var n=this,r=n.__makeSequence();return r.__iterateUncached=function(r,i,u){var s=this;if(i)return this.cacheResult().__iterate(r,i,u);var a=n.__reversedIndices^u,h=!0,o=0,c=n.__iterate(function(n,i,u){return h&&(h=t.call(e,n,i,u),h||(o=i)),h||r(n,a?i:i-o,s)!==!1},i,u);return a?o+1:c-o},r},groupBy:function(t,e){return D(this,t,e,!1)},sortBy:function(t,e){e=e||x;var n=this;return Pe(this.entrySeq().toArray().sort(function(r,i){return e(t(r[1],r[0],n),t(i[1],i[0],n))||r[0]-i[0]})).fromEntrySeq().valueSeq()},__iterate:function(t,e,n){var r=this._cache;if(r){n^=e;for(var i=r.length-1,u=0;i>=u;u++){var s=r[e?i-u:u],a=s[0];if(t(s[1],n?i-a:a,this)===!1)break}return u}return n&&!this.length?this.cacheResult().__iterate(t,e,n):this.__iterateUncached(t,e,n)},__makeSequence:function(){return g(this)
<del>}},{},Pe);var Le=Ke.prototype;Le.__toJS=Le.toArray,Le.__toStringMapper=A,Le.chain=Le.flatMap;var Ve=function(t){this._seq=t,this.length=t.length};ye.createClass(Ve,{get:function(t,e){return this._seq.get(t,e)},has:function(t){return this._seq.has(t)},__iterate:function(t,e){return this._seq.__iterate(t,e,e)}},{},Pe);var Ne=function(t){var e=Object.keys(t);this._object=t,this._keys=e,this.length=e.length};ye.createClass(Ne,{toObject:function(){return this._object},get:function(t,e){return void 0===e||this.has(t)?this._object[t]:e},has:function(t){return this._object.hasOwnProperty(t)},__iterate:function(t,e){for(var n=this._object,r=this._keys,i=r.length-1,u=0;i>=u;u++){var s=e?i-u:u;if(t(n[r[s]],r[s],n)===!1)break}return u}},{},Pe);var Fe=function(t){this._array=t,this.length=t.length};ye.createClass(Fe,{toArray:function(){return this._array},get:function(t,e){return this.has(t)?this._array[C(this,t)]:e},has:function(t){return t=C(this,t),t>=0&&this.length>t},__iterate:function(t,e,n){var r,i,u=this._array,s=u.length-1,a=e^n;for(r=0;s>=r;r++)if(i=s-r,t(u[e?i:r],n?i:r,u)===!1)return a?e?i:r:u.length;return u.length}},{},Ke);var Ge=function(){};ye.createClass(Ge,{toString:function(){return"[Iterator]"}},{});var He=Ge.prototype;He[Oe]=q,He.inspect=He.toSource=function(){return""+this};var Qe=function(t,e,n,r){r=r?r:t.getIn(e),this.length=r instanceof Pe?r.length:null,this._rootData=t,this._keyPath=e,this._onChange=n};ye.createClass(Qe,{deref:function(t){return this._rootData.getIn(this._keyPath,t)},get:function(t,e){if(Array.isArray(t)&&0===t.length)return this;var n=this._rootData.getIn(this._keyPath.concat(t),ke);return n===ke?e:R(this,t,n)},set:function(t,e){return W(this,function(n){return n.set(t,e)},t)},remove:function(t){return W(this,function(e){return e.remove(t)},t)},clear:function(){return W(this,function(t){return t.clear()})},update:function(t,e,n){return 1===arguments.length?W(this,t):W(this,function(r){return r.update(t,e,n)},t)},withMutations:function(t){return W(this,function(e){return(e||Te.empty()).withMutations(t)
<del>})},cursor:function(t){return Array.isArray(t)&&0===t.length?this:U(this,t)},__iterate:function(t,e,n){var r=this,i=r.deref();return i&&i.__iterate?i.__iterate(function(e,n,i){return t(R(r,n,e),n,i)},e,n):0}},{},Pe),Qe.prototype[De]=Qe.prototype.remove,Qe.prototype.getIn=Qe.prototype.get;var Te=function(t){var e=Xe.empty();return t?t.constructor===Xe?t:e.merge(t):e},Xe=Te;ye.createClass(Te,{toString:function(){return this.__toString("Map {","}")},get:function(t,e){return this._root?this._root.get(0,c(t),t,e):e},set:function(t,e){return B(this,t,e)},remove:function(t){return B(this,t,ke)},update:function(t,e,n){return 1===arguments.length?this.updateIn([],null,t):this.updateIn([t],e,n)},updateIn:function(t,e,n){var r;return n||(r=[e,n],n=r[0],e=r[1],r),X(this,t,e,n,0)},clear:function(){return 0===this.length?this:this.__ownerID?(this.length=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):Xe.empty()},merge:function(){return H(this,null,arguments)},mergeWith:function(t){for(var e=[],n=1;arguments.length>n;n++)e[n-1]=arguments[n];return H(this,t,e)},mergeDeep:function(){return H(this,Q(null),arguments)},mergeDeepWith:function(t){for(var e=[],n=1;arguments.length>n;n++)e[n-1]=arguments[n];return H(this,Q(t),e)},cursor:function(t,e){return e||"function"!=typeof t?0===arguments.length?t=[]:Array.isArray(t)||(t=[t]):(e=t,t=[]),new Qe(this,t,e)},withMutations:function(t){var e=this.asMutable();return t(e),e.wasAltered()?e.__ensureOwner(this.__ownerID):this},asMutable:function(){return this.__ownerID?this:this.__ensureOwner(new u)},asImmutable:function(){return this.__ensureOwner()},wasAltered:function(){return this.__altered},keys:function(){return new an(this,0)},values:function(){return new an(this,1)},entries:function(){return new an(this,2)},__iterator:function(t){return new an(this,2,t)},__iterate:function(t,e){var n=this;if(!n._root)return 0;var r=0;return this._root.iterate(function(e){return t(e[1],e[0],n)===!1?!1:void r++},e),r},__deepEquals:function(t){var e=this;return t.every(function(t,n){return P(e.get(n,ke),t)
<del>})},__ensureOwner:function(t){return t===this.__ownerID?this:t?K(this.length,this._root,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)}},{empty:function(){return hn||(hn=K(0))}},Pe);var Ye=Te.prototype;Ye[De]=Ye.remove,Ye[Oe]=function(){return this.entries()},Te.from=Te;var Ze=function(t,e,n){this.ownerID=t,this.bitmap=e,this.nodes=n},$e=Ze;ye.createClass(Ze,{get:function(t,e,n,r){var i=1<<((0===t?e:e>>>t)&Ie),u=this.bitmap;return 0===(u&i)?r:this.nodes[Y(u&i-1)].get(t+we,e,n,r)},update:function(t,e,n,r,i,u,s){var a=(0===e?n:n>>>e)&Ie,h=1<<a,o=this.bitmap,c=0!==(o&h);if(!c&&i===ke)return this;var f=Y(o&h-1),_=this.nodes,l=c?_[f]:null,v=L(l,t,e+we,n,r,i,u,s);if(v===l)return this;if(!c&&v&&_.length>=on)return G(t,_,o,a,v);if(c&&!v&&2===_.length&&V(_[1^f]))return _[1^f];if(c&&v&&1===_.length&&V(v))return v;var g=t&&t===this.ownerID,p=c?v?o:o^h:o|h,m=c?v?Z(_,f,v,g):te(_,f,g):$(_,f,v,g);return g?(this.bitmap=p,this.nodes=m,this):new $e(t,p,m)},iterate:function(t,e){for(var n=this.nodes,r=0,i=n.length-1;i>=r;r++)if(n[e?i-r:r].iterate(t,e)===!1)return!1}},{});var tn=function(t,e,n){this.ownerID=t,this.count=e,this.nodes=n},en=tn;ye.createClass(tn,{get:function(t,e,n,r){var i=(0===t?e:e>>>t)&Ie,u=this.nodes[i];return u?u.get(t+we,e,n,r):r},update:function(t,e,n,r,i,u,s){var a=(0===e?n:n>>>e)&Ie,h=i===ke,o=this.nodes,c=o[a];if(h&&!c)return this;var f=L(c,t,e+we,n,r,i,u,s);if(f===c)return this;var _=this.count;if(c){if(!f&&(_--,cn>_))return F(t,o,_,a)}else _++;var l=t&&t===this.ownerID,v=Z(o,a,f,l);return l?(this.count=_,this.nodes=v,this):new en(t,_,v)},iterate:function(t,e){for(var n=this.nodes,r=0,i=n.length-1;i>=r;r++){var u=n[e?i-r:r];if(u&&u.iterate(t,e)===!1)return!1}}},{});var nn=function(t,e,n){this.ownerID=t,this.hash=e,this.entries=n},rn=nn;ye.createClass(nn,{get:function(t,e,n,r){for(var i=this.entries,u=0,s=i.length;s>u;u++)if(P(n,i[u][0]))return i[u][1];return r},update:function(t,e,n,r,u,a,h){var o=u===ke;if(n!==this.hash)return o?this:(i(h),i(a),N(this,t,e,n,[r,u]));for(var c=this.entries,f=0,_=c.length;_>f&&!P(r,c[f][0]);f++);var l=_>f;
<del>if(o&&!l)return this;if(i(h),(o||!l)&&i(a),o&&2===_)return new un(t,this.hash,c[1^f]);var v=t&&t===this.ownerID,g=v?c:s(c);return l?o?f===_-1?g.pop():g[f]=g.pop():g[f]=[r,u]:g.push([r,u]),v?(this.entries=g,this):new rn(t,this.hash,g)},iterate:function(t,e){for(var n=this.entries,r=0,i=n.length-1;i>=r;r++)if(t(n[e?i-r:r])===!1)return!1}},{});var un=function(t,e,n){this.ownerID=t,this.hash=e,this.entry=n},sn=un;ye.createClass(un,{get:function(t,e,n,r){return P(n,this.entry[0])?this.entry[1]:r},update:function(t,e,n,r,u,s,a){var h=u===ke,o=P(r,this.entry[0]);return(o?u===this.entry[1]:h)?this:(i(a),h?(i(s),null):o?t&&t===this.ownerID?(this.entry[1]=u,this):new sn(t,n,[r,u]):(i(s),N(this,t,e,n,[r,u])))},iterate:function(t){return t(this.entry)}},{});var an=function(t,e,n){this._type=e,this._reverse=n,this._stack=t._root&&z(t._root)};ye.createClass(an,{next:function(){for(var t=this._type,e=this._stack;e;){var n,r=e.node,i=e.index++;if(r.entry){if(0===i)return J(t,r.entry)}else if(r.entries){if(n=r.entries.length-1,n>=i)return J(t,r.entries[this._reverse?n-i:i])}else if(n=r.nodes.length-1,n>=i){var u=r.nodes[this._reverse?n-i:i];if(u){if(u.entry)return J(t,u.entry);e=this._stack=z(u,e)}continue}e=this._stack=this._stack.__prev}return h()}},{},Ge);var hn,on=Se/2,cn=Se/4,fn=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return _n.from(t)},_n=fn;ye.createClass(fn,{toString:function(){return this.__toString("Vector [","]")},has:function(t){return t=C(this,t),t>=0&&this.length>t},get:function(t,e){if(t=C(this,t),0>t||t>=this.length)return e;t+=this._origin;var n=ae(this,t);return n&&n.array[t&Ie]},first:function(){return this.get(0)},last:function(){return this.get(this.length?this.length-1:0)},set:function(t,e){return ie(this,t,e)},remove:function(t){return ie(this,t,ke)},clear:function(){return 0===this.length?this:this.__ownerID?(this.length=this._origin=this._size=0,this._level=we,this._root=this._tail=null,this.__hash=void 0,this.__altered=!0,this):_n.empty()},push:function(){var t=arguments,e=this.length;
<del>return this.withMutations(function(n){he(n,0,e+t.length);for(var r=0;t.length>r;r++)n.set(e+r,t[r])})},pop:function(){return he(this,0,-1)},unshift:function(){var t=arguments;return this.withMutations(function(e){he(e,-t.length);for(var n=0;t.length>n;n++)e.set(n,t[n])})},shift:function(){return he(this,1)},merge:function(){return oe(this,null,arguments)},mergeWith:function(t){for(var e=[],n=1;arguments.length>n;n++)e[n-1]=arguments[n];return oe(this,t,e)},mergeDeep:function(){return oe(this,Q(null),arguments)},mergeDeepWith:function(t){for(var e=[],n=1;arguments.length>n;n++)e[n-1]=arguments[n];return oe(this,Q(t),e)},setLength:function(t){return he(this,0,t)},slice:function(t,e){var n=ye.superCall(this,_n.prototype,"slice",[t,e]);if(n!==this){var r=this,i=r.length;n.toVector=function(){return he(r,0>t?Math.max(0,i+t):i?Math.min(i,t):t,null==e?i:0>e?Math.max(0,i+e):i?Math.min(i,e):e)}}return n},keys:function(){return new pn(this,0)},values:function(){return new pn(this,1)},entries:function(){return new pn(this,2)},__iterator:function(t,e){return new pn(this,2,t,e)},__iterate:function(t,e,n){var r=this,i=0,u=r.length-1;n^=e;var s,a=function(e,s){return t(e,n?u-s:s,r)===!1?!1:(i=s,!0)},h=ce(this._size);return s=e?ee(this._tail,0,h-this._origin,this._size-this._origin,a,e)&&ee(this._root,this._level,-this._origin,h-this._origin,a,e):ee(this._root,this._level,-this._origin,h-this._origin,a,e)&&ee(this._tail,0,h-this._origin,this._size-this._origin,a,e),(s?u:e?u-i:i)+1},__deepEquals:function(t){var e=this.entries(!0);return t.every(function(t,n){var r=e.next().value;return r&&r[0]===n&&P(r[1],t)})},__ensureOwner:function(t){return t===this.__ownerID?this:t?re(this._origin,this._size,this._level,this._root,this._tail,t,this.__hash):(this.__ownerID=t,this)}},{empty:function(){return mn||(mn=re(0,0,we))},from:function(t){if(!t||0===t.length)return _n.empty();if(t.constructor===_n)return t;var e=Array.isArray(t);return t.length>0&&Se>t.length?re(0,t.length,we,null,new vn(e?s(t):Pe(t).toArray())):(e||(t=Pe(t),t instanceof Ke||(t=t.valueSeq())),_n.empty().merge(t))
<del>}},Ke);var ln=fn.prototype;ln[De]=ln.remove,ln[Oe]=ln.values,ln.update=Ye.update,ln.updateIn=Ye.updateIn,ln.cursor=Ye.cursor,ln.withMutations=Ye.withMutations,ln.asMutable=Ye.asMutable,ln.asImmutable=Ye.asImmutable,ln.wasAltered=Ye.wasAltered;var vn=function(t,e){this.array=t,this.ownerID=e},gn=vn;ye.createClass(vn,{removeBefore:function(t,e,n){if(n===e?1<<e:0||0===this.array.length)return this;var r=n>>>e&Ie;if(r>=this.array.length)return new gn([],t);var i,u=0===r;if(e>0){var s=this.array[r];if(i=s&&s.removeBefore(t,e-we,n),i===s&&u)return this}if(u&&!i)return this;var a=se(this,t);if(!u)for(var h=0;r>h;h++)a.array[h]=void 0;return i&&(a.array[r]=i),a},removeAfter:function(t,e,n){if(n===e?1<<e:0||0===this.array.length)return this;var r=n-1>>>e&Ie;if(r>=this.array.length)return this;var i,u=r===this.array.length-1;if(e>0){var s=this.array[r];if(i=s&&s.removeAfter(t,e-we,n),i===s&&u)return this}if(u&&!i)return this;var a=se(this,t);return u||a.array.pop(),i&&(a.array[r]=i),a}},{});var pn=function(t,e,n,r){this._type=e,this._reverse=!!n,this._flipIndices=!!(r^n),this._maxIndex=t.length-1;var i=ce(t._size),u=ne(t._root&&t._root.array,t._level,-t._origin,i-t._origin-1),s=ne(t._tail&&t._tail.array,0,i-t._origin,t._size-t._origin-1);this._stack=n?s:u,this._stack.__prev=n?u:s};ye.createClass(pn,{next:function(){for(var t=this._stack;t;){var e=t.array,n=t.index++;if(this._reverse&&(n=Ie-n,n>t.rawMax&&(n=t.rawMax,t.index=Se-n)),n>=0&&Se>n&&t.rawMax>=n){var r=e&&e[n];if(0===t.level){var i,u=this._type;return 1!==u&&(i=t.offset+(n<<t.level),this._flipIndices&&(i=this._maxIndex-i)),a(0===u?i:1===u?r:[i,r])}this._stack=t=ne(r&&r.array,t.level-we,t.offset+(n<<t.level),t.max,t)}else t=this._stack=this._stack.__prev}return h()}},{},Ge);var mn,dn=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return yn.from(t)},yn=dn;ye.createClass(dn,{toString:function(){return this.__toString("Set {","}")},has:function(t){return this._map.has(t)},get:function(t,e){return this.has(t)?t:e},add:function(t){var e=this._map.set(t,null);
<del>return this.__ownerID?(this.length=e.length,this._map=e,this):e===this._map?this:fe(e)},remove:function(t){var e=this._map.remove(t);return this.__ownerID?(this.length=e.length,this._map=e,this):e===this._map?this:0===e.length?yn.empty():fe(e)},clear:function(){return 0===this.length?this:this.__ownerID?(this.length=0,this._map.clear(),this):yn.empty()},union:function(){var t=arguments;return 0===t.length?this:this.withMutations(function(e){for(var n=0;t.length>n;n++)Pe(t[n]).forEach(function(t){return e.add(t)})})},intersect:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];if(0===t.length)return this;t=t.map(function(t){return Pe(t)});var n=this;return this.withMutations(function(e){n.forEach(function(n){t.every(function(t){return t.contains(n)})||e.remove(n)})})},subtract:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];if(0===t.length)return this;t=t.map(function(t){return Pe(t)});var n=this;return this.withMutations(function(e){n.forEach(function(n){t.some(function(t){return t.contains(n)})&&e.remove(n)})})},isSubset:function(t){return t=Pe(t),this.every(function(e){return t.contains(e)})},isSuperset:function(t){var e=this;return t=Pe(t),t.every(function(t){return e.contains(t)})},wasAltered:function(){return this._map.wasAltered()},values:function(){return this._map.keys()},entries:function(){return j(this.values(),function(t){return[t,t]})},hashCode:function(){return this._map.hashCode()},__iterate:function(t,e){var n=this;return this._map.__iterate(function(e,r){return t(r,r,n)},e)},__deepEquals:function(t){return this.isSuperset(t)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t);return t?fe(e,t):(this.__ownerID=t,this._map=e,this)}},{empty:function(){return Sn||(Sn=fe(Te.empty()))},from:function(t){var e=yn.empty();return t?t.constructor===yn?t:e.union(t):e},fromKeys:function(t){return yn.from(Pe(t).flip())}},Pe);var wn=dn.prototype;wn[De]=wn.remove,wn[Oe]=wn.keys=wn.values,wn.contains=wn.has,wn.mergeDeep=wn.merge=wn.union,wn.mergeDeepWith=wn.mergeWith=function(){for(var t=[],e=1;arguments.length>e;e++)t[e-1]=arguments[e];
<del>return this.merge.apply(this,t)},wn.withMutations=Ye.withMutations,wn.asMutable=Ye.asMutable,wn.asImmutable=Ye.asImmutable,wn.__toJS=Le.__toJS,wn.__toStringMapper=Le.__toStringMapper;var Sn,In=function(t){var e=kn.empty();return t?t.constructor===kn?t:e.merge(t):e},kn=In;ye.createClass(In,{toString:function(){return this.__toString("OrderedMap {","}")},get:function(t,e){var n=this._map.get(t);return null!=n?this._vector.get(n)[1]:e},clear:function(){return 0===this.length?this:this.__ownerID?(this.length=0,this._map.clear(),this._vector.clear(),this):kn.empty()},set:function(t,e){return le(this,t,e)},remove:function(t){return le(this,t,ke)},wasAltered:function(){return this._map.wasAltered()||this._vector.wasAltered()},keys:function(){return j(this.entries(),function(t){return t[0]})},values:function(){return j(this.entries(),function(t){return t[1]})},entries:function(){return this._vector.values(!0)},__iterate:function(t,e){return this._vector.fromEntrySeq().__iterate(t,e)},__deepEquals:function(t){var e=this.entries();return t.every(function(t,n){var r=e.next().value;return r&&P(r[0],n)&&P(r[1],t)})},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t),n=this._vector.__ensureOwner(t);return t?_e(e,n,t,this.__hash):(this.__ownerID=t,this._map=e,this._vector=n,this)}},{empty:function(){return qn||(qn=_e(Te.empty(),fn.empty()))}},Te),In.from=In,In.prototype[De]=In.prototype.remove;var qn,Mn=function(t,e){var n=function(t){return this instanceof n?void(this._map=Te(t)):new n(t)};t=Pe(t);var r=n.prototype=Object.create(Dn);r.constructor=n,r._name=e,r._defaultValues=t;var i=Object.keys(t);return n.prototype.length=i.length,Object.defineProperty&&t.forEach(function(t,e){Object.defineProperty(n.prototype,e,{get:function(){return this.get(e)},set:function(t){o(this.__ownerID,"Cannot set on an immutable record."),this.set(e,t)}})}),n},bn=Mn;ye.createClass(Mn,{toString:function(){return this.__toString((this._name||"Record")+" {","}")},has:function(t){return this._defaultValues.has(t)
<del>},get:function(t,e){return void 0===e||this.has(t)?this._map.get(t,this._defaultValues.get(t)):e},clear:function(){if(this.__ownerID)return this._map.clear(),this;Object.getPrototypeOf(this).constructor;return bn._empty||(bn._empty=ve(this,Te.empty()))},set:function(t,e){if(null==t||!this.has(t))return this;var n=this._map.set(t,e);return this.__ownerID||n===this._map?this:ve(this,n)},remove:function(t){if(null==t||!this.has(t))return this;var e=this._map.remove(t);return this.__ownerID||e===this._map?this:ve(this,e)},keys:function(){return this._map.keys()},values:function(){return this._map.values()},entries:function(){return this._map.entries()},wasAltered:function(){return this._map.wasAltered()},__iterate:function(t,e){var n=this;return this._defaultValues.map(function(t,e){return n.get(e)}).__iterate(t,e)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t);return t?ve(this,e,t):(this.__ownerID=t,this._map=e,this)}},{},Pe);var Dn=Mn.prototype;Dn[De]=Dn.remove,Dn[Oe]=Ye[Oe],Dn.merge=Ye.merge,Dn.mergeWith=Ye.mergeWith,Dn.mergeDeep=Ye.mergeDeep,Dn.mergeDeepWith=Ye.mergeDeepWith,Dn.update=Ye.update,Dn.updateIn=Ye.updateIn,Dn.cursor=Ye.cursor,Dn.withMutations=Ye.withMutations,Dn.asMutable=Ye.asMutable,Dn.asImmutable=Ye.asImmutable,Dn.__deepEquals=Ye.__deepEquals;var On=function(t,e,n){return this instanceof An?(o(0!==n,"Cannot step a Range by 0"),t=t||0,null==e&&(e=1/0),t===e&&Cn?Cn:(n=null==n?1:Math.abs(n),t>e&&(n=-n),this._start=t,this._end=e,this._step=n,void(this.length=Math.max(0,Math.ceil((e-t)/n-1)+1)))):new An(t,e,n)},An=On;ye.createClass(On,{toString:function(){return 0===this.length?"Range []":"Range [ "+this._start+"..."+this._end+(this._step>1?" by "+this._step:"")+" ]"},has:function(t){return t=C(this,t),t>=0&&(1/0===this.length||this.length>t)},get:function(t,e){return t=C(this,t),this.has(t)?this._start+t*this._step:e},contains:function(t){var e=(t-this._start)/this._step;return e>=0&&this.length>e&&e===Math.floor(e)},slice:function(t,e){return m(t,e,this.length)?this:(t=d(t,this.length),e=y(e,this.length),t>=e?Cn:new An(this.get(t,this._end),this.get(e,this._end),this._step))
<del>},indexOf:function(t){var e=t-this._start;if(e%this._step===0){var n=e/this._step;if(n>=0&&this.length>n)return n}return-1},lastIndexOf:function(t){return this.indexOf(t)},take:function(t){return this.slice(0,t)},skip:function(t){return this.slice(t)},__iterate:function(t,e,n){for(var r=this.length-1,i=this._step,u=e?this._start+r*i:this._start,s=0;r>=s&&t(u,n?r-s:s,this)!==!1;s++)u+=e?-i:i;return n?this.length:s},__deepEquals:function(t){return this._start===t._start&&this._end===t._end&&this._step===t._step}},{},Ke);var xn=On.prototype;xn.__toJS=xn.toArray,xn.first=ln.first,xn.last=ln.last;var Cn=On(0,0),En=function(t,e){return 0===e&&Un?Un:this instanceof jn?(this._value=t,void(this.length=null==e?1/0:Math.max(0,e))):new jn(t,e)},jn=En;ye.createClass(En,{toString:function(){return 0===this.length?"Repeat []":"Repeat [ "+this._value+" "+this.length+" times ]"},get:function(t,e){return this.has(t)?this._value:e},first:function(){return this._value},contains:function(t){return P(this._value,t)},slice:function(t,e){var n=this.length;return t=0>t?Math.max(0,n+t):Math.min(n,t),e=null==e?n:e>0?Math.min(n,e):Math.max(0,n+e),e>t?new jn(this._value,e-t):Un},reverse:function(){return this},indexOf:function(t){return P(this._value,t)?0:-1},lastIndexOf:function(t){return P(this._value,t)?this.length:-1},__iterate:function(t,e,n){var r=e^n;o(!r||1/0>this.length,"Cannot access end of infinite range.");for(var i=this.length-1,u=0;i>=u&&t(this._value,r?i-u:u,this)!==!1;u++);return r?this.length:u},__deepEquals:function(t){return P(this._value,t._value)}},{},Ke);var Rn=En.prototype;Rn.last=Rn.first,Rn.has=xn.has,Rn.take=xn.take,Rn.skip=xn.skip,Rn.__toJS=xn.__toJS;var Un=new En(void 0,0),Wn={Sequence:Pe,Map:Te,Vector:fn,Set:dn,OrderedMap:In,Record:Mn,Range:On,Repeat:En,is:P,fromJS:ge};return Wn}"object"==typeof exports?module.exports=t():"function"==typeof define&&define.amd?define(t):Immutable=t();
<ide>\ No newline at end of file
<add>return t.__ownerID?(t.length=h.length,t._map=h,t._vector=o,t.__hash=void 0,t):_e(h,o)}function ve(t,e,n){var r=Object.create(Object.getPrototypeOf(t));return r._map=e,r.__ownerID=n,r}function ge(t,e){return e?pe(e,t,"",{"":t}):me(t)}function pe(t,e,n,r){return e&&(Array.isArray(e)||e.constructor===Object)?t.call(r,n,Pe(e).map(function(n,r){return pe(t,n,r,e)})):e}function me(t){if(t){if(Array.isArray(t))return Pe(t).map(me).toVector();if(t.constructor===Object)return Pe(t).map(me).toMap()}return t}var de=Object,ye={};ye.createClass=t,ye.superCall=e,ye.defaultSuperCall=n;var we=5,Se=1<<we,Ie=Se-1,ke={},qe={value:!1},Me={value:!1},be={value:void 0,done:!1},De="delete",Oe="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator",Ae=2147483647,xe=0,Ce="__immutablehash__";"undefined"!=typeof Symbol&&(Ce=Symbol(Ce));var Ee=!1,je=16,Ue=255,Re=0,We={},Pe=function(t){return Je.from(1===arguments.length?t:Array.prototype.slice.call(arguments))},Je=Pe;ye.createClass(Pe,{toString:function(){return this.__toString("Seq {","}")},__toString:function(t,e){return 0===this.length?t+e:t+" "+this.map(this.__toStringMapper).join(", ")+" "+e},__toStringMapper:function(t,e){return e+": "+A(t)},toJS:function(){return this.map(function(t){return t instanceof Je?t.toJS():t}).__toJS()},toArray:function(){E(this.length);var t=Array(this.length||0);return this.valueSeq().forEach(function(e,n){t[n]=e}),t},toObject:function(){E(this.length);var t={};return this.forEach(function(e,n){t[n]=e}),t},toVector:function(){return E(this.length),fn.from(this)},toMap:function(){return E(this.length),Te.from(this)},toOrderedMap:function(){return E(this.length),In.from(this)},toSet:function(){return E(this.length),dn.from(this)},toKeyedSeq:function(){return this},hashCode:function(){return this.__hash||(this.__hash=1/0===this.length?0:this.reduce(function(t,e,n){return t+(c(e)^(e===n?0:c(n)))&Ae},0))},equals:function(t){if(this===t)return!0;if(!(t instanceof Je))return!1;if(null!=this.length&&null!=t.length){if(this.length!==t.length)return!1;if(0===this.length&&0===t.length)return!0
<add>}return null!=this.__hash&&null!=t.__hash&&this.__hash!==t.__hash?!1:this.__deepEquals(t)},__deepEquals:function(t){var e=this.cacheResult().entrySeq().toArray(),n=0;return t.every(function(t,r){var i=e[n++];return P(r,i[0])&&P(t,i[1])})},join:function(t){t=void 0!==t?""+t:",";var e="",n=!0;return this.forEach(function(r){n?(n=!1,e+=null!=r?r:""):e+=t+(null!=r?r:"")}),e},count:function(t,e){return t?this.filter(t,e).count():(null==this.length&&(this.length=this.forEach(k)),this.length)},countBy:function(t){var e=this;return In.empty().withMutations(function(n){e.forEach(function(e,r,i){n.update(t(e,r,i),M)})})},concat:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];var n=[this].concat(t.map(function(t){return Je(t)})),r=this.__makeSequence();return r.length=n.reduce(function(t,e){return null!=t&&null!=e.length?t+e.length:void 0},0),r.__iterateUncached=function(t,e){for(var r,i=0,u=n.length-1,s=0;u>=s&&!r;s++){var a=n[e?u-s:s];i+=a.__iterate(function(e,n,i){return t(e,n,i)===!1?(r=!0,!1):void 0},e)}return i},r},reverse:function(){var t=this,e=t.__makeSequence();return e.reverse=function(){return t},e.length=t.length,e.__iterateUncached=function(e,n){return t.__iterate(e,!n)},e},keySeq:function(){return this.flip().valueSeq()},valueSeq:function(){var t=this,e=g(t);return e.length=t.length,e.valueSeq=q,e.__iterateUncached=function(e,n,r){var i,u=this,s=0;if(r){var a=this.length-1;i=function(t){return e(t,a-s++,u)!==!1}}else i=function(t){return e(t,s++,u)!==!1};return t.__iterate(i,n),s},e},entrySeq:function(){var t=this;if(t._cache)return Je(t._cache);var e=t.map(I).valueSeq();return e.fromEntries=function(){return t},e},forEach:function(t,e){return this.__iterate(e?t.bind(e):t)},reduce:function(t,e,n){var r,i;return 2>arguments.length?i=!0:r=e,this.forEach(function(e,u,s){i?(i=!1,r=e):r=t.call(n,r,e,u,s)}),r},reduceRight:function(){var t=this.toKeyedSeq().reverse();return t.reduce.apply(t,arguments)},every:function(t,e){var n=!0;return this.forEach(function(r,i,u){return t.call(e,r,i,u)?void 0:(n=!1,!1)
<add>}),n},some:function(t,e){return!this.every(O(t),e)},first:function(){return this.find(k)},last:function(){return this.findLast(k)},rest:function(){return this.slice(1)},butLast:function(){return this.slice(0,-1)},has:function(t){return this.get(t,ke)!==ke},get:function(t,e){return this.find(function(e,n){return P(n,t)},null,e)},getIn:function(t,e){return t&&0!==t.length?p(this,t,e,0):this},contains:function(t){return this.find(function(e){return P(e,t)},null,ke)!==ke},find:function(t,e,n){var r=n;return this.forEach(function(n,i,u){return t.call(e,n,i,u)?(r=n,!1):void 0}),r},findKey:function(t,e){var n;return this.forEach(function(r,i,u){return t.call(e,r,i,u)?(n=i,!1):void 0}),n},findLast:function(t,e,n){return this.toKeyedSeq().reverse().find(t,e,n)},findLastKey:function(t,e){return this.toKeyedSeq().reverse().findKey(t,e)},flip:function(){var t=this,e=v();return e.length=t.length,e.flip=function(){return t},e.__iterateUncached=function(e,n){var r=this;return t.__iterate(function(t,n){return e(n,t,r)!==!1},n)},e},map:function(t,e){var n=this,r=n.__makeSequence();return r.length=n.length,r.__iterateUncached=function(r,i){var u=this;return n.__iterate(function(n,i,s){return r(t.call(e,n,i,s),i,u)!==!1},i)},r},mapKeys:function(t,e){var n=this,r=n.__makeSequence();return r.length=n.length,r.__iterateUncached=function(r,i){var u=this;return n.__iterate(function(n,i,s){return r(n,t.call(e,i,n,s),u)!==!1},i)},r},filter:function(t,e){return b(this,t,e,!0)},slice:function(t,e){if(m(t,e,this.length))return this;var n=d(t,this.length),r=y(e,this.length);if(n!==n||r!==r)return this.entrySeq().slice(t,e).fromEntrySeq();var i=0===n?this:this.skip(n);return null==r||r===this.length?i:i.take(r-n)},take:function(t){var e=this;if(t>e.length)return e;var n=e.__makeSequence();return n.__iterateUncached=function(n,r,i){var u=this;if(r)return this.cacheResult().__iterate(n,r,i);var s=0;return e.__iterate(function(e,r){return t>s&&n(e,r,u)!==!1?void s++:!1},r,i),s},n.length=this.length&&Math.min(this.length,t),n},takeLast:function(t){return this.reverse().take(t).reverse()
<add>},takeWhile:function(t,e){var n=this,r=n.__makeSequence();return r.__iterateUncached=function(r,i,u){var s=this;if(i)return this.cacheResult().__iterate(r,i,u);var a=0;return n.__iterate(function(n,i,u){return t.call(e,n,i,u)&&r(n,i,s)!==!1?void a++:!1},i,u),a},r},takeUntil:function(t,e){return this.takeWhile(O(t),e)},skip:function(t){var e=this;if(0===t)return e;var n=e.__makeSequence();return n.__iterateUncached=function(n,r,i){var u=this;if(r)return this.cacheResult().__iterate(n,r,i);var s=!0,a=0,h=0;return e.__iterate(function(e,r){if(!s||!(s=h++<t)){if(n(e,r,u)===!1)return!1;a++}},r,i),a},n.length=this.length&&Math.max(0,this.length-t),n},skipLast:function(t){return this.reverse().skip(t).reverse()},skipWhile:function(t,e){var n=this,r=n.__makeSequence();return r.__iterateUncached=function(r,i,u){var s=this;if(i)return this.cacheResult().__iterate(r,i,u);var a=!0,h=0;return n.__iterate(function(n,i,u){if(!a||!(a=t.call(e,n,i,u))){if(r(n,i,s)===!1)return!1;h++}},i,u),h},r},skipUntil:function(t,e){return this.skipWhile(O(t),e)},groupBy:function(t,e){return D(this,t,e,!0)},sort:function(t){return this.sortBy(S,t)},sortBy:function(t,e){e=e||x;var n=this;return Je(this.entrySeq().entrySeq().toArray().sort(function(r,i){return e(t(r[1][1],r[1][0],n),t(i[1][1],i[1][0],n))||r[0]-i[0]})).fromEntrySeq().valueSeq().fromEntrySeq()},cacheResult:function(){return!this._cache&&this.__iterateUncached&&(E(this.length),this._cache=this.entrySeq().toArray(),null==this.length&&(this.length=this._cache.length)),this},__iterate:function(t,e){var n=this._cache;if(n){for(var r=n.length-1,i=0;r>=i;i++){var u=n[e?r-i:i];if(t(u[1],u[0],this)===!1)break}return i}return this.__iterateUncached(t,e)},__makeSequence:function(){return v()}},{from:function(t){if(t instanceof Je)return t;if(!Array.isArray(t)){if(t&&t.constructor===Object)return new Ne(t);t=[t]}return new Fe(t)}});var ze=Pe.prototype;ze.toJSON=ze.toJS,ze.__toJS=ze.toObject,ze.inspect=ze.toSource=function(){return""+this};var Ke=function(){ye.defaultSuperCall(this,Be.prototype,arguments)
<add>},Be=Ke;ye.createClass(Ke,{toString:function(){return this.__toString("Seq [","]")},toArray:function(){E(this.length);var t=Array(this.length||0);return t.length=this.forEach(function(e,n){t[n]=e}),t},toKeyedSeq:function(){return new Ve(this)},fromEntrySeq:function(){var t=this,e=v();return e.length=t.length,e.entrySeq=function(){return t},e.__iterateUncached=function(e,n){var r=this;return t.__iterate(function(t){return t&&e(t[1],t[0],r)},n)},e},join:function(t){t=void 0!==t?""+t:",";var e="";return this.forEach(function(n,r){e+=(r?t:"")+(null!=n?n:"")}),e},concat:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];var n=[this].concat(t).map(function(t){return Pe(t)}),r=this.__makeSequence();return r.length=n.reduce(function(t,e){return null!=t&&null!=e.length?t+e.length:void 0},0),r.__iterateUncached=function(t,e,r){for(var i,u=this,s=0,a=r&&this.length-1,h=n.length-1,o=0;h>=o&&!i;o++){var c=n[e?h-o:o];c instanceof Be||(c=c.valueSeq()),s+=c.__iterate(function(e,n){return n+=s,t(e,r?a-n:n,u)===!1?(i=!0,!1):void 0},e)}return s},r},reverse:function(){var t=this,e=t.__makeSequence();return e.reverse=function(){return t},e.length=t.length,e.__reversedIndices=t.__reversedIndices,e.__iterateUncached=function(e,n,r){var i=this,u=r?this.length:0;return t.__iterate(function(t){return e(t,r?--u:u++,i)!==!1},!n)},e},filter:function(t,e){return b(this,t,e,!1)},get:function(t,e){return t=C(this,t),this.find(function(e,n){return n===t},null,e)},indexOf:function(t){return this.findIndex(function(e){return P(e,t)})},lastIndexOf:function(t){return this.toKeyedSeq().reverse().indexOf(t)},findIndex:function(t,e){var n=this.findKey(t,e);return null==n?-1:n},findLastIndex:function(t,e){return this.toKeyedSeq().reverse().findIndex(t,e)},slice:function(t,e){var n=this;if(m(t,e,n.length))return n;var r=n.__makeSequence(),i=d(t,n.length),u=y(e,n.length);return r.length=n.length&&u-i,r.__reversedIndices=n.__reversedIndices,r.__iterateUncached=function(r,s,a){var h=this;if(s)return this.cacheResult().__iterate(r,s,a);var o=this.__reversedIndices^a;
<add>if(i!==i||u!==u||o&&null==n.length){var c=n.count();i=d(t,c),u=y(e,c)}var f=o?n.length-u:i,_=o?n.length-i:u,l=n.__iterate(function(t,e){return o?null!=_&&e>=_||e>=f&&r(t,e-f,h)!==!1:f>e||(null==_||_>e)&&r(t,e-f,h)!==!1},s,a);return null!=this.length?this.length:Math.max(0,l-f)},r},splice:function(t,e){var n=arguments.length;if(e=Math.max(0|e,0),0===n||2===n&&!e)return this;t=d(t,this.length);var r=this.slice(0,t);return 1===n?r:r.concat(s(arguments,2),this.slice(t+e))},flatten:function(){var t=this,e=t.__makeSequence();return e.__iterateUncached=function(e,n,r){var i=this;if(r)return this.cacheResult().__iterate(e,n,r);var u=0;return t.__iterate(function(t){u+=Pe(t).__iterate(function(t,n){return e(t,u+n,i)!==!1},n,r)},n,r),u},e},flatMap:function(t,e){return this.map(t,e).flatten()},skip:function(t){var e=this;if(0===t)return e;var n=e.__makeSequence();return n.__iterateUncached=function(n,r,i){var u=this;if(r)return this.cacheResult().__iterate(n,r,i);var s=e.__reversedIndices^i,a=!0,h=0,o=0,c=e.__iterate(function(e,r){return a&&(a=o++<t,a||(h=r)),a||n(e,s?r:r-h,u)!==!1},r,i);return s?h+1:c-h},n.length=this.length&&Math.max(0,this.length-t),n},skipWhile:function(t,e){var n=this,r=n.__makeSequence();return r.__iterateUncached=function(r,i,u){var s=this;if(i)return this.cacheResult().__iterate(r,i,u);var a=n.__reversedIndices^u,h=!0,o=0,c=n.__iterate(function(n,i,u){return h&&(h=t.call(e,n,i,u),h||(o=i)),h||r(n,a?i:i-o,s)!==!1},i,u);return a?o+1:c-o},r},groupBy:function(t,e){return D(this,t,e,!1)},sortBy:function(t,e){e=e||x;var n=this;return Pe(this.entrySeq().toArray().sort(function(r,i){return e(t(r[1],r[0],n),t(i[1],i[0],n))||r[0]-i[0]})).fromEntrySeq().valueSeq()},__iterate:function(t,e,n){var r=this._cache;if(r){n^=e;for(var i=r.length-1,u=0;i>=u;u++){var s=r[e?i-u:u],a=s[0];if(t(s[1],n?i-a:a,this)===!1)break}return u}return n&&!this.length?this.cacheResult().__iterate(t,e,n):this.__iterateUncached(t,e,n)},__makeSequence:function(){return g(this)}},{},Pe);var Le=Ke.prototype;Le.__toJS=Le.toArray,Le.__toStringMapper=A,Le.chain=Le.flatMap;
<add>var Ve=function(t){this._seq=t,this.length=t.length};ye.createClass(Ve,{get:function(t,e){return this._seq.get(t,e)},has:function(t){return this._seq.has(t)},__iterate:function(t,e){return this._seq.__iterate(t,e,e)}},{},Pe);var Ne=function(t){var e=Object.keys(t);this._object=t,this._keys=e,this.length=e.length};ye.createClass(Ne,{toObject:function(){return this._object},get:function(t,e){return void 0===e||this.has(t)?this._object[t]:e},has:function(t){return this._object.hasOwnProperty(t)},__iterate:function(t,e){for(var n=this._object,r=this._keys,i=r.length-1,u=0;i>=u;u++){var s=e?i-u:u;if(t(n[r[s]],r[s],n)===!1)break}return u}},{},Pe);var Fe=function(t){this._array=t,this.length=t.length};ye.createClass(Fe,{toArray:function(){return this._array},get:function(t,e){return this.has(t)?this._array[C(this,t)]:e},has:function(t){return t=C(this,t),t>=0&&this.length>t},__iterate:function(t,e,n){var r,i,u=this._array,s=u.length-1,a=e^n;for(r=0;s>=r;r++)if(i=s-r,t(u[e?i:r],n?i:r,u)===!1)return a?e?i:r:u.length;return u.length}},{},Ke);var Ge=function(){};ye.createClass(Ge,{toString:function(){return"[Iterator]"}},{});var He=Ge.prototype;He[Oe]=q,He.inspect=He.toSource=function(){return""+this};var Qe=function(t,e,n,r){r=r?r:t.getIn(e),this.length=r instanceof Pe?r.length:null,this._rootData=t,this._keyPath=e,this._onChange=n};ye.createClass(Qe,{deref:function(t){return this._rootData.getIn(this._keyPath,t)},get:function(t,e){if(Array.isArray(t)&&0===t.length)return this;var n=this._rootData.getIn(this._keyPath.concat(t),ke);return n===ke?e:U(this,t,n)},set:function(t,e){return W(this,function(n){return n.set(t,e)},t)},remove:function(t){return W(this,function(e){return e.remove(t)},t)},clear:function(){return W(this,function(t){return t.clear()})},update:function(t,e,n){return 1===arguments.length?W(this,t):W(this,function(r){return r.update(t,e,n)},t)},withMutations:function(t){return W(this,function(e){return(e||Te.empty()).withMutations(t)})},cursor:function(t){return Array.isArray(t)&&0===t.length?this:R(this,t)},__iterate:function(t,e,n){var r=this,i=r.deref();
<add>return i&&i.__iterate?i.__iterate(function(e,n,i){return t(U(r,n,e),n,i)},e,n):0}},{},Pe),Qe.prototype[De]=Qe.prototype.remove,Qe.prototype.getIn=Qe.prototype.get;var Te=function(t){var e=Xe.empty();return t?t.constructor===Xe?t:e.merge(t):e},Xe=Te;ye.createClass(Te,{toString:function(){return this.__toString("Map {","}")},get:function(t,e){return this._root?this._root.get(0,c(t),t,e):e},set:function(t,e){return B(this,t,e)},remove:function(t){return B(this,t,ke)},update:function(t,e,n){return 1===arguments.length?this.updateIn([],null,t):this.updateIn([t],e,n)},updateIn:function(t,e,n){var r;return n||(r=[e,n],n=r[0],e=r[1],r),X(this,t,e,n,0)},clear:function(){return 0===this.length?this:this.__ownerID?(this.length=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):Xe.empty()},merge:function(){return H(this,null,arguments)},mergeWith:function(t){for(var e=[],n=1;arguments.length>n;n++)e[n-1]=arguments[n];return H(this,t,e)},mergeDeep:function(){return H(this,Q(null),arguments)},mergeDeepWith:function(t){for(var e=[],n=1;arguments.length>n;n++)e[n-1]=arguments[n];return H(this,Q(t),e)},cursor:function(t,e){return e||"function"!=typeof t?0===arguments.length?t=[]:Array.isArray(t)||(t=[t]):(e=t,t=[]),new Qe(this,t,e)},withMutations:function(t){var e=this.asMutable();return t(e),e.wasAltered()?e.__ensureOwner(this.__ownerID):this},asMutable:function(){return this.__ownerID?this:this.__ensureOwner(new u)},asImmutable:function(){return this.__ensureOwner()},wasAltered:function(){return this.__altered},keys:function(){return new an(this,0)},values:function(){return new an(this,1)},entries:function(){return new an(this,2)},__iterator:function(t){return new an(this,2,t)},__iterate:function(t,e){var n=this;if(!n._root)return 0;var r=0;return this._root.iterate(function(e){return t(e[1],e[0],n)===!1?!1:void r++},e),r},__deepEquals:function(t){var e=this;return t.every(function(t,n){return P(e.get(n,ke),t)})},__ensureOwner:function(t){return t===this.__ownerID?this:t?K(this.length,this._root,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)
<add>}},{empty:function(){return hn||(hn=K(0))}},Pe);var Ye=Te.prototype;Ye[De]=Ye.remove,Ye[Oe]=function(){return this.entries()},Te.from=Te;var Ze=function(t,e,n){this.ownerID=t,this.bitmap=e,this.nodes=n},$e=Ze;ye.createClass(Ze,{get:function(t,e,n,r){var i=1<<((0===t?e:e>>>t)&Ie),u=this.bitmap;return 0===(u&i)?r:this.nodes[Y(u&i-1)].get(t+we,e,n,r)},update:function(t,e,n,r,i,u,s){var a=(0===e?n:n>>>e)&Ie,h=1<<a,o=this.bitmap,c=0!==(o&h);if(!c&&i===ke)return this;var f=Y(o&h-1),_=this.nodes,l=c?_[f]:null,v=L(l,t,e+we,n,r,i,u,s);if(v===l)return this;if(!c&&v&&_.length>=on)return G(t,_,o,a,v);if(c&&!v&&2===_.length&&V(_[1^f]))return _[1^f];if(c&&v&&1===_.length&&V(v))return v;var g=t&&t===this.ownerID,p=c?v?o:o^h:o|h,m=c?v?Z(_,f,v,g):te(_,f,g):$(_,f,v,g);return g?(this.bitmap=p,this.nodes=m,this):new $e(t,p,m)},iterate:function(t,e){for(var n=this.nodes,r=0,i=n.length-1;i>=r;r++)if(n[e?i-r:r].iterate(t,e)===!1)return!1}},{});var tn=function(t,e,n){this.ownerID=t,this.count=e,this.nodes=n},en=tn;ye.createClass(tn,{get:function(t,e,n,r){var i=(0===t?e:e>>>t)&Ie,u=this.nodes[i];return u?u.get(t+we,e,n,r):r},update:function(t,e,n,r,i,u,s){var a=(0===e?n:n>>>e)&Ie,h=i===ke,o=this.nodes,c=o[a];if(h&&!c)return this;var f=L(c,t,e+we,n,r,i,u,s);if(f===c)return this;var _=this.count;if(c){if(!f&&(_--,cn>_))return F(t,o,_,a)}else _++;var l=t&&t===this.ownerID,v=Z(o,a,f,l);return l?(this.count=_,this.nodes=v,this):new en(t,_,v)},iterate:function(t,e){for(var n=this.nodes,r=0,i=n.length-1;i>=r;r++){var u=n[e?i-r:r];if(u&&u.iterate(t,e)===!1)return!1}}},{});var nn=function(t,e,n){this.ownerID=t,this.hash=e,this.entries=n},rn=nn;ye.createClass(nn,{get:function(t,e,n,r){for(var i=this.entries,u=0,s=i.length;s>u;u++)if(P(n,i[u][0]))return i[u][1];return r},update:function(t,e,n,r,u,a,h){var o=u===ke;if(n!==this.hash)return o?this:(i(h),i(a),N(this,t,e,n,[r,u]));for(var c=this.entries,f=0,_=c.length;_>f&&!P(r,c[f][0]);f++);var l=_>f;if(o&&!l)return this;if(i(h),(o||!l)&&i(a),o&&2===_)return new un(t,this.hash,c[1^f]);var v=t&&t===this.ownerID,g=v?c:s(c);
<add>return l?o?f===_-1?g.pop():g[f]=g.pop():g[f]=[r,u]:g.push([r,u]),v?(this.entries=g,this):new rn(t,this.hash,g)},iterate:function(t,e){for(var n=this.entries,r=0,i=n.length-1;i>=r;r++)if(t(n[e?i-r:r])===!1)return!1}},{});var un=function(t,e,n){this.ownerID=t,this.hash=e,this.entry=n},sn=un;ye.createClass(un,{get:function(t,e,n,r){return P(n,this.entry[0])?this.entry[1]:r},update:function(t,e,n,r,u,s,a){var h=u===ke,o=P(r,this.entry[0]);return(o?u===this.entry[1]:h)?this:(i(a),h?(i(s),null):o?t&&t===this.ownerID?(this.entry[1]=u,this):new sn(t,n,[r,u]):(i(s),N(this,t,e,n,[r,u])))},iterate:function(t){return t(this.entry)}},{});var an=function(t,e,n){this._type=e,this._reverse=n,this._stack=t._root&&z(t._root)};ye.createClass(an,{next:function(){for(var t=this._type,e=this._stack;e;){var n,r=e.node,i=e.index++;if(r.entry){if(0===i)return J(t,r.entry)}else if(r.entries){if(n=r.entries.length-1,n>=i)return J(t,r.entries[this._reverse?n-i:i])}else if(n=r.nodes.length-1,n>=i){var u=r.nodes[this._reverse?n-i:i];if(u){if(u.entry)return J(t,u.entry);e=this._stack=z(u,e)}continue}e=this._stack=this._stack.__prev}return h()}},{},Ge);var hn,on=Se/2,cn=Se/4,fn=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return _n.from(t)},_n=fn;ye.createClass(fn,{toString:function(){return this.__toString("Vector [","]")},has:function(t){return t=C(this,t),t>=0&&this.length>t},get:function(t,e){if(t=C(this,t),0>t||t>=this.length)return e;t+=this._origin;var n=ae(this,t);return n&&n.array[t&Ie]},first:function(){return this.get(0)},last:function(){return this.get(this.length?this.length-1:0)},set:function(t,e){return ie(this,t,e)},remove:function(t){return ie(this,t,ke)},clear:function(){return 0===this.length?this:this.__ownerID?(this.length=this._origin=this._size=0,this._level=we,this._root=this._tail=null,this.__hash=void 0,this.__altered=!0,this):_n.empty()},push:function(){var t=arguments,e=this.length;return this.withMutations(function(n){he(n,0,e+t.length);for(var r=0;t.length>r;r++)n.set(e+r,t[r])})},pop:function(){return he(this,0,-1)
<add>},unshift:function(){var t=arguments;return this.withMutations(function(e){he(e,-t.length);for(var n=0;t.length>n;n++)e.set(n,t[n])})},shift:function(){return he(this,1)},merge:function(){return oe(this,null,arguments)},mergeWith:function(t){for(var e=[],n=1;arguments.length>n;n++)e[n-1]=arguments[n];return oe(this,t,e)},mergeDeep:function(){return oe(this,Q(null),arguments)},mergeDeepWith:function(t){for(var e=[],n=1;arguments.length>n;n++)e[n-1]=arguments[n];return oe(this,Q(t),e)},setLength:function(t){return he(this,0,t)},slice:function(t,e){var n=ye.superCall(this,_n.prototype,"slice",[t,e]);if(n!==this){var r=this,i=r.length;n.toVector=function(){return he(r,0>t?Math.max(0,i+t):i?Math.min(i,t):t,null==e?i:0>e?Math.max(0,i+e):i?Math.min(i,e):e)}}return n},keys:function(){return new pn(this,0)},values:function(){return new pn(this,1)},entries:function(){return new pn(this,2)},__iterator:function(t,e){return new pn(this,2,t,e)},__iterate:function(t,e,n){var r=this,i=0,u=r.length-1;n^=e;var s,a=function(e,s){return t(e,n?u-s:s,r)===!1?!1:(i=s,!0)},h=ce(this._size);return s=e?ee(this._tail,0,h-this._origin,this._size-this._origin,a,e)&&ee(this._root,this._level,-this._origin,h-this._origin,a,e):ee(this._root,this._level,-this._origin,h-this._origin,a,e)&&ee(this._tail,0,h-this._origin,this._size-this._origin,a,e),(s?u:e?u-i:i)+1},__deepEquals:function(t){var e=this.entries(!0);return t.every(function(t,n){var r=e.next().value;return r&&r[0]===n&&P(r[1],t)})},__ensureOwner:function(t){return t===this.__ownerID?this:t?re(this._origin,this._size,this._level,this._root,this._tail,t,this.__hash):(this.__ownerID=t,this)}},{empty:function(){return mn||(mn=re(0,0,we))},from:function(t){if(!t||0===t.length)return _n.empty();if(t.constructor===_n)return t;var e=Array.isArray(t);return t.length>0&&Se>t.length?re(0,t.length,we,null,new vn(e?s(t):Pe(t).toArray())):(e||(t=Pe(t),t instanceof Ke||(t=t.valueSeq())),_n.empty().merge(t))}},Ke);var ln=fn.prototype;ln[De]=ln.remove,ln[Oe]=ln.values,ln.update=Ye.update,ln.updateIn=Ye.updateIn,ln.cursor=Ye.cursor,ln.withMutations=Ye.withMutations,ln.asMutable=Ye.asMutable,ln.asImmutable=Ye.asImmutable,ln.wasAltered=Ye.wasAltered;
<add>var vn=function(t,e){this.array=t,this.ownerID=e},gn=vn;ye.createClass(vn,{removeBefore:function(t,e,n){if(n===e?1<<e:0||0===this.array.length)return this;var r=n>>>e&Ie;if(r>=this.array.length)return new gn([],t);var i,u=0===r;if(e>0){var s=this.array[r];if(i=s&&s.removeBefore(t,e-we,n),i===s&&u)return this}if(u&&!i)return this;var a=se(this,t);if(!u)for(var h=0;r>h;h++)a.array[h]=void 0;return i&&(a.array[r]=i),a},removeAfter:function(t,e,n){if(n===e?1<<e:0||0===this.array.length)return this;var r=n-1>>>e&Ie;if(r>=this.array.length)return this;var i,u=r===this.array.length-1;if(e>0){var s=this.array[r];if(i=s&&s.removeAfter(t,e-we,n),i===s&&u)return this}if(u&&!i)return this;var a=se(this,t);return u||a.array.pop(),i&&(a.array[r]=i),a}},{});var pn=function(t,e,n,r){this._type=e,this._reverse=!!n,this._flipIndices=!!(r^n),this._maxIndex=t.length-1;var i=ce(t._size),u=ne(t._root&&t._root.array,t._level,-t._origin,i-t._origin-1),s=ne(t._tail&&t._tail.array,0,i-t._origin,t._size-t._origin-1);this._stack=n?s:u,this._stack.__prev=n?u:s};ye.createClass(pn,{next:function(){for(var t=this._stack;t;){var e=t.array,n=t.index++;if(this._reverse&&(n=Ie-n,n>t.rawMax&&(n=t.rawMax,t.index=Se-n)),n>=0&&Se>n&&t.rawMax>=n){var r=e&&e[n];if(0===t.level){var i,u=this._type;return 1!==u&&(i=t.offset+(n<<t.level),this._flipIndices&&(i=this._maxIndex-i)),a(0===u?i:1===u?r:[i,r])}this._stack=t=ne(r&&r.array,t.level-we,t.offset+(n<<t.level),t.max,t)}else t=this._stack=this._stack.__prev}return h()}},{},Ge);var mn,dn=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return yn.from(t)},yn=dn;ye.createClass(dn,{toString:function(){return this.__toString("Set {","}")},has:function(t){return this._map.has(t)},get:function(t,e){return this.has(t)?t:e},add:function(t){var e=this._map.set(t,null);return this.__ownerID?(this.length=e.length,this._map=e,this):e===this._map?this:fe(e)},remove:function(t){var e=this._map.remove(t);return this.__ownerID?(this.length=e.length,this._map=e,this):e===this._map?this:0===e.length?yn.empty():fe(e)
<add>},clear:function(){return 0===this.length?this:this.__ownerID?(this.length=0,this._map.clear(),this):yn.empty()},union:function(){var t=arguments;return 0===t.length?this:this.withMutations(function(e){for(var n=0;t.length>n;n++)Pe(t[n]).forEach(function(t){return e.add(t)})})},intersect:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];if(0===t.length)return this;t=t.map(function(t){return Pe(t)});var n=this;return this.withMutations(function(e){n.forEach(function(n){t.every(function(t){return t.contains(n)})||e.remove(n)})})},subtract:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];if(0===t.length)return this;t=t.map(function(t){return Pe(t)});var n=this;return this.withMutations(function(e){n.forEach(function(n){t.some(function(t){return t.contains(n)})&&e.remove(n)})})},isSubset:function(t){return t=Pe(t),this.every(function(e){return t.contains(e)})},isSuperset:function(t){var e=this;return t=Pe(t),t.every(function(t){return e.contains(t)})},wasAltered:function(){return this._map.wasAltered()},values:function(){return this._map.keys()},entries:function(){return j(this.values(),function(t){return[t,t]})},hashCode:function(){return this._map.hashCode()},__iterate:function(t,e){var n=this;return this._map.__iterate(function(e,r){return t(r,r,n)},e)},__deepEquals:function(t){return this.isSuperset(t)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t);return t?fe(e,t):(this.__ownerID=t,this._map=e,this)}},{empty:function(){return Sn||(Sn=fe(Te.empty()))},from:function(t){var e=yn.empty();return t?t.constructor===yn?t:e.union(t):e},fromKeys:function(t){return yn.from(Pe(t).flip())}},Pe);var wn=dn.prototype;wn[De]=wn.remove,wn[Oe]=wn.keys=wn.values,wn.contains=wn.has,wn.mergeDeep=wn.merge=wn.union,wn.mergeDeepWith=wn.mergeWith=function(){for(var t=[],e=1;arguments.length>e;e++)t[e-1]=arguments[e];return this.merge.apply(this,t)},wn.withMutations=Ye.withMutations,wn.asMutable=Ye.asMutable,wn.asImmutable=Ye.asImmutable,wn.__toJS=Le.__toJS,wn.__toStringMapper=Le.__toStringMapper;
<add>var Sn,In=function(t){var e=kn.empty();return t?t.constructor===kn?t:e.merge(t):e},kn=In;ye.createClass(In,{toString:function(){return this.__toString("OrderedMap {","}")},get:function(t,e){var n=this._map.get(t);return null!=n?this._vector.get(n)[1]:e},clear:function(){return 0===this.length?this:this.__ownerID?(this.length=0,this._map.clear(),this._vector.clear(),this):kn.empty()},set:function(t,e){return le(this,t,e)},remove:function(t){return le(this,t,ke)},wasAltered:function(){return this._map.wasAltered()||this._vector.wasAltered()},keys:function(){return j(this.entries(),function(t){return t[0]})},values:function(){return j(this.entries(),function(t){return t[1]})},entries:function(){return this._vector.values(!0)},__iterate:function(t,e){return this._vector.fromEntrySeq().__iterate(t,e)},__deepEquals:function(t){var e=this.entries();return t.every(function(t,n){var r=e.next().value;return r&&P(r[0],n)&&P(r[1],t)})},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t),n=this._vector.__ensureOwner(t);return t?_e(e,n,t,this.__hash):(this.__ownerID=t,this._map=e,this._vector=n,this)}},{empty:function(){return qn||(qn=_e(Te.empty(),fn.empty()))}},Te),In.from=In,In.prototype[De]=In.prototype.remove;var qn,Mn=function(t,e){var n=function(t){return this instanceof n?void(this._map=Te(t)):new n(t)};t=Pe(t);var r=n.prototype=Object.create(Dn);r.constructor=n,r._name=e,r._defaultValues=t;var i=Object.keys(t);return n.prototype.length=i.length,Object.defineProperty&&t.forEach(function(t,e){Object.defineProperty(n.prototype,e,{get:function(){return this.get(e)},set:function(t){o(this.__ownerID,"Cannot set on an immutable record."),this.set(e,t)}})}),n},bn=Mn;ye.createClass(Mn,{toString:function(){return this.__toString((this._name||"Record")+" {","}")},has:function(t){return this._defaultValues.has(t)},get:function(t,e){return void 0===e||this.has(t)?this._map.get(t,this._defaultValues.get(t)):e},clear:function(){if(this.__ownerID)return this._map.clear(),this;Object.getPrototypeOf(this).constructor;
<add>return bn._empty||(bn._empty=ve(this,Te.empty()))},set:function(t,e){if(null==t||!this.has(t))return this;var n=this._map.set(t,e);return this.__ownerID||n===this._map?this:ve(this,n)},remove:function(t){if(null==t||!this.has(t))return this;var e=this._map.remove(t);return this.__ownerID||e===this._map?this:ve(this,e)},keys:function(){return this._map.keys()},values:function(){return this._map.values()},entries:function(){return this._map.entries()},wasAltered:function(){return this._map.wasAltered()},__iterate:function(t,e){var n=this;return this._defaultValues.map(function(t,e){return n.get(e)}).__iterate(t,e)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t);return t?ve(this,e,t):(this.__ownerID=t,this._map=e,this)}},{},Pe);var Dn=Mn.prototype;Dn[De]=Dn.remove,Dn[Oe]=Ye[Oe],Dn.merge=Ye.merge,Dn.mergeWith=Ye.mergeWith,Dn.mergeDeep=Ye.mergeDeep,Dn.mergeDeepWith=Ye.mergeDeepWith,Dn.update=Ye.update,Dn.updateIn=Ye.updateIn,Dn.cursor=Ye.cursor,Dn.withMutations=Ye.withMutations,Dn.asMutable=Ye.asMutable,Dn.asImmutable=Ye.asImmutable,Dn.__deepEquals=Ye.__deepEquals;var On=function(t,e,n){return this instanceof An?(o(0!==n,"Cannot step a Range by 0"),t=t||0,null==e&&(e=1/0),t===e&&Cn?Cn:(n=null==n?1:Math.abs(n),t>e&&(n=-n),this._start=t,this._end=e,this._step=n,void(this.length=Math.max(0,Math.ceil((e-t)/n-1)+1)))):new An(t,e,n)},An=On;ye.createClass(On,{toString:function(){return 0===this.length?"Range []":"Range [ "+this._start+"..."+this._end+(this._step>1?" by "+this._step:"")+" ]"},has:function(t){return t=C(this,t),t>=0&&(1/0===this.length||this.length>t)},get:function(t,e){return t=C(this,t),this.has(t)?this._start+t*this._step:e},contains:function(t){var e=(t-this._start)/this._step;return e>=0&&this.length>e&&e===Math.floor(e)},slice:function(t,e){return m(t,e,this.length)?this:(t=d(t,this.length),e=y(e,this.length),t>=e?Cn:new An(this.get(t,this._end),this.get(e,this._end),this._step))},indexOf:function(t){var e=t-this._start;if(e%this._step===0){var n=e/this._step;
<add>if(n>=0&&this.length>n)return n}return-1},lastIndexOf:function(t){return this.indexOf(t)},take:function(t){return this.slice(0,t)},skip:function(t){return this.slice(t)},__iterate:function(t,e,n){for(var r=this.length-1,i=this._step,u=e?this._start+r*i:this._start,s=0;r>=s&&t(u,n?r-s:s,this)!==!1;s++)u+=e?-i:i;return n?this.length:s},__deepEquals:function(t){return this._start===t._start&&this._end===t._end&&this._step===t._step}},{},Ke);var xn=On.prototype;xn.__toJS=xn.toArray,xn.first=ln.first,xn.last=ln.last;var Cn=On(0,0),En=function(t,e){return 0===e&&Rn?Rn:this instanceof jn?(this._value=t,void(this.length=null==e?1/0:Math.max(0,e))):new jn(t,e)},jn=En;ye.createClass(En,{toString:function(){return 0===this.length?"Repeat []":"Repeat [ "+this._value+" "+this.length+" times ]"},get:function(t,e){return this.has(t)?this._value:e},first:function(){return this._value},contains:function(t){return P(this._value,t)},slice:function(t,e){var n=this.length;return t=0>t?Math.max(0,n+t):Math.min(n,t),e=null==e?n:e>0?Math.min(n,e):Math.max(0,n+e),e>t?new jn(this._value,e-t):Rn},reverse:function(){return this},indexOf:function(t){return P(this._value,t)?0:-1},lastIndexOf:function(t){return P(this._value,t)?this.length:-1},__iterate:function(t,e,n){var r=e^n;o(!r||1/0>this.length,"Cannot access end of infinite range.");for(var i=this.length-1,u=0;i>=u&&t(this._value,r?i-u:u,this)!==!1;u++);return r?this.length:u},__deepEquals:function(t){return P(this._value,t._value)}},{},Ke);var Un=En.prototype;Un.last=Un.first,Un.has=xn.has,Un.take=xn.take,Un.skip=xn.skip,Un.__toJS=xn.__toJS;var Rn=new En(void 0,0),Wn={Sequence:Pe,Map:Te,Vector:fn,Set:dn,OrderedMap:In,Record:Mn,Range:On,Repeat:En,is:P,fromJS:ge};return Wn}"object"==typeof exports?module.exports=t():"function"==typeof define&&define.amd?define(t):Immutable=t();
<ide>\ No newline at end of file
<ide><path>src/Sequence.js
<ide> class Sequence {
<ide> valuesSequence.length = sequence.length;
<ide> valuesSequence.valueSeq = returnThis;
<ide> valuesSequence.__iterateUncached = function (fn, reverse, flipIndices) {
<del> if (flipIndices && this.length == null) {
<del> return this.cacheResult().__iterate(fn, reverse, flipIndices);
<del> }
<ide> var iterations = 0;
<ide> var predicate;
<ide> if (flipIndices) {
<del> iterations = this.length - 1;
<del> predicate = (v, k, c) => fn(v, iterations--, c) !== false;
<add> var maxIndex = this.length - 1;
<add> predicate = (v, k, c) => fn(v, maxIndex - iterations++, this) !== false;
<ide> } else {
<del> predicate = (v, k, c) => fn(v, iterations++, c) !== false;
<add> predicate = (v, k, c) => fn(v, iterations++, this) !== false;
<ide> }
<ide> sequence.__iterate(predicate, reverse); // intentionally do not pass flipIndices
<del> return flipIndices ? this.length : iterations;
<add> return iterations;
<ide> }
<ide> return valuesSequence;
<ide> } | 3 |
Javascript | Javascript | use native impl if available | b6ae6e52f99c0c3c45ad787328a2e800ff07ca2c | <ide><path>src/Angular.js
<ide> function size(obj, ownPropsOnly) {
<ide>
<ide>
<ide> function includes(array, obj) {
<del> for ( var i = 0; i < array.length; i++) {
<del> if (obj === array[i]) return true;
<del> }
<del> return false;
<add> return indexOf(array, obj) != -1;
<ide> }
<ide>
<ide> function indexOf(array, obj) {
<add> if (array.indexOf) return array.indexOf(obj);
<add>
<ide> for ( var i = 0; i < array.length; i++) {
<ide> if (obj === array[i]) return i;
<ide> }
<ide><path>src/directive/form.js
<ide> function FormController(name, element) {
<ide> function addControlError(validationToken, control) {
<ide> var queue = errors[validationToken];
<ide> if (queue) {
<del> for (var i = 0, length = queue.length; i < length; i++) {
<del> if (queue[i] === control) {
<del> return;
<del> }
<del> }
<add> if (indexOf(queue, control)) return;
<ide> } else {
<ide> errors[validationToken] = queue = [];
<ide> | 2 |
Javascript | Javascript | fix math bug in pinch | 20b6082b02a16dc6bc720bfebb6a404743435667 | <ide><path>packages/sproutcore-touch/lib/gesture_recognizers/pinch.js
<ide> SC.PinchGestureRecognizer = SC.Gesture.extend({
<ide> var distanceDifference = (currentDistanceBetweenTouches - this._previousDistance);
<ide>
<ide> set(this, 'velocity', distanceDifference / timeDifference);
<del> set(this, 'scale', distanceDifference / this._previousDistance);
<add> set(this, 'scale', currentDistanceBetweenTouches / this._previousDistance);
<ide>
<ide> this._previousTimestamp = get(this.touches,'timestamp');
<ide> this._previousDistance = currentDistanceBetweenTouches; | 1 |
Go | Go | add term env var to exec | 4633f15f13d51530de2438c298a1084c55e4fedf | <ide><path>daemon/exec.go
<ide> import (
<ide> "github.com/docker/docker/libcontainerd"
<ide> "github.com/docker/docker/pkg/pools"
<ide> "github.com/docker/docker/pkg/signal"
<add> "github.com/docker/docker/pkg/system"
<ide> "github.com/docker/docker/pkg/term"
<add> "github.com/docker/docker/utils"
<ide> )
<ide>
<ide> // Seconds to wait after sending TERM before trying KILL
<ide> func (d *Daemon) ContainerExecCreate(name string, config *types.ExecConfig) (str
<ide> execConfig.Tty = config.Tty
<ide> execConfig.Privileged = config.Privileged
<ide> execConfig.User = config.User
<add> execConfig.Env = []string{
<add> "PATH=" + system.DefaultPathEnv,
<add> }
<add> if config.Tty {
<add> execConfig.Env = append(execConfig.Env, "TERM=xterm")
<add> }
<add> execConfig.Env = utils.ReplaceOrAppendEnvValues(execConfig.Env, container.Config.Env)
<ide> if len(execConfig.User) == 0 {
<ide> execConfig.User = container.Config.User
<ide> }
<ide> func (d *Daemon) ContainerExecStart(ctx context.Context, name string, stdin io.R
<ide>
<ide> p := libcontainerd.Process{
<ide> Args: append([]string{ec.Entrypoint}, ec.Args...),
<add> Env: ec.Env,
<ide> Terminal: ec.Tty,
<ide> }
<ide>
<ide><path>daemon/exec/exec.go
<ide> type Config struct {
<ide> Tty bool
<ide> Privileged bool
<ide> User string
<add> Env []string
<ide> }
<ide>
<ide> // NewConfig initializes the a new exec configuration
<ide><path>integration-cli/docker_cli_exec_unix_test.go
<ide> func (s *DockerSuite) TestExecTTY(c *check.C) {
<ide> c.Assert(err, checker.IsNil)
<ide> c.Assert(bytes.Contains(buf, []byte("hello")), checker.Equals, true, check.Commentf(string(buf[:read])))
<ide> }
<add>
<add>// Test the the TERM env var is set when -t is provided on exec
<add>func (s *DockerSuite) TestExecWithTERM(c *check.C) {
<add> testRequires(c, DaemonIsLinux, SameHostDaemon)
<add> out, _ := dockerCmd(c, "run", "-id", "busybox", "/bin/cat")
<add> contID := strings.TrimSpace(out)
<add> cmd := exec.Command(dockerBinary, "exec", "-t", contID, "sh", "-c", "if [ -z $TERM ]; then exit 1; else exit 0; fi")
<add> if err := cmd.Run(); err != nil {
<add> c.Assert(err, checker.IsNil)
<add> }
<add>}
<add>
<add>// Test that the TERM env var is not set on exec when -t is not provided, even if it was set
<add>// on run
<add>func (s *DockerSuite) TestExecWithNoTERM(c *check.C) {
<add> testRequires(c, DaemonIsLinux, SameHostDaemon)
<add> out, _ := dockerCmd(c, "run", "-itd", "busybox", "/bin/cat")
<add> contID := strings.TrimSpace(out)
<add> cmd := exec.Command(dockerBinary, "exec", contID, "sh", "-c", "if [ -z $TERM ]; then exit 0; else exit 1; fi")
<add> if err := cmd.Run(); err != nil {
<add> c.Assert(err, checker.IsNil)
<add> }
<add>} | 3 |
PHP | PHP | change fresh() parameter type | d576bedd3f0f70c9df6dcecb2f44057ee92234fe | <ide><path>src/Illuminate/Database/Eloquent/Model.php
<ide> public static function all($columns = ['*'])
<ide> /**
<ide> * Reload a fresh model instance from the database.
<ide> *
<del> * @param array $with
<add> * @param array|string $with
<ide> * @return $this|null
<ide> */
<del> public function fresh(array $with = [])
<add> public function fresh($with = [])
<ide> {
<ide> if (! $this->exists) {
<ide> return; | 1 |
Ruby | Ruby | verify credentials format before saving | 00f5aca3ef5de2637134c40e2e8b5d3c1d5b1a08 | <ide><path>activesupport/lib/active_support/encrypted_configuration.rb
<ide> def read
<ide> ""
<ide> end
<ide>
<add> def write(contents)
<add> deserialize(contents)
<add>
<add> super
<add> end
<add>
<ide> def config
<ide> @config ||= deserialize(read).deep_symbolize_keys
<ide> end
<ide> def serialize(config)
<ide> end
<ide>
<ide> def deserialize(config)
<del> config.present? ? YAML.load(config) : {}
<add> config.present? ? YAML.load(config, content_path) : {}
<ide> end
<ide> end
<ide> end
<ide><path>activesupport/test/encrypted_configuration_test.rb
<ide> class EncryptedConfigurationTest < ActiveSupport::TestCase
<ide> assert_equal "things", @credentials[:new]
<ide> end
<ide>
<add> test "raise error when writing an invalid format value" do
<add> assert_raise(Psych::SyntaxError) do
<add> @credentials.change do |config_file|
<add> config_file.write "login: *login\n username: dummy"
<add> end
<add> end
<add> end
<add>
<ide> test "raises key error when accessing config via bang method" do
<ide> assert_raise(KeyError) { @credentials.something! }
<ide> end | 2 |
Python | Python | fix merge conflict | 49e3b6e8c18fef163ccd7e8ac265ebe4adb0bc1f | <ide><path>libcloud/common/luadns.py
<ide>
<ide> import base64
<ide>
<del>import base64
<del>
<ide> from libcloud.common.base import ConnectionUserAndKey, JsonResponse
<ide> from libcloud.utils.py3 import b
<ide> | 1 |
Python | Python | reduce batch size during pretrain | df15279e88311f207407cec01d705cd569316258 | <ide><path>spacy/cli/pretrain.py
<ide> def pretrain(
<ide> msg.row(("#", "# Words", "Total Loss", "Loss", "w/s"), **row_settings)
<ide> for epoch in range(nr_iter):
<ide> for batch in util.minibatch_by_words(
<del> ((text, None) for text in texts), size=5000
<add> ((text, None) for text in texts), size=3000
<ide> ):
<ide> docs = make_docs(nlp, [text for (text, _) in batch])
<ide> loss = make_update(model, docs, optimizer, drop=dropout) | 1 |
Javascript | Javascript | fix path to docs-app e2e tests | 22b817ec11f7ab1a81342a4b60acd644a3f2a8c3 | <ide><path>docs/app/e2e/api-docs/api-pages.scenario.js
<ide> describe("doc.angularjs.org", function() {
<ide> describe("API pages", function() {
<ide>
<ide> it("should display links to code on GitHub", function() {
<del> browser.get('index-debug.html#!/api/ng/service/$http');
<add> browser.get('build/docs/index.html#!/api/ng/service/$http');
<ide> expect(element(by.css('.improve-docs')).getAttribute('href')).toMatch(/https?:\/\/github\.com\/angular\/angular\.js\/edit\/.+\/src\/ng\/http\.js/);
<ide>
<del> browser.get('index-debug.html#!/api/ng/service/$http');
<add> browser.get('build/docs/index.html#!/api/ng/service/$http');
<ide> expect(element(by.css('.view-source')).getAttribute('href')).toMatch(/https?:\/\/github\.com\/angular\/angular\.js\/tree\/.+\/src\/ng\/http\.js#L\d+/);
<ide> });
<ide>
<ide> it('should change the page content when clicking a link to a service', function () {
<del> browser.get('');
<add> browser.get('build/docs/index.html');
<ide>
<ide> var ngBindLink = element(by.css('.definition-table td a[href="api/ng/directive/ngClick"]'));
<ide> ngBindLink.click();
<ide> describe("doc.angularjs.org", function() {
<ide>
<ide>
<ide> it('should show the functioning input directive example', function () {
<del> browser.get('index-debug.html#!/api/ng/directive/input');
<add> browser.get('build/docs/index.html#!/api/ng/directive/input');
<ide>
<ide> // Ensure that the page is loaded before trying to switch frames.
<ide> browser.waitForAngular();
<ide> describe("doc.angularjs.org", function() {
<ide> });
<ide>
<ide> it("should trim indentation from code blocks", function() {
<del> browser.get('index-debug.html#!/api/ng/type/$rootScope.Scope');
<add> browser.get('build/docs/index.html#!/api/ng/type/$rootScope.Scope');
<ide>
<ide> var codeBlocks = element.all(by.css('pre > code.lang-js'));
<ide> codeBlocks.each(function(codeBlock) {
<ide><path>docs/app/e2e/api-docs/provider-pages.scenario.js
<ide> describe("provider pages", function() {
<ide>
<ide> it("should show the related service", function() {
<del> browser.get('index-debug.html#!/api/ng/provider/$compileProvider');
<add> browser.get('build/docs/index.html#!/api/ng/provider/$compileProvider');
<ide> var serviceLink = element.all(by.css('ol.api-profile-header-structure li a')).first();
<ide> expect(serviceLink.getText()).toEqual('- $compile');
<ide> expect(serviceLink.getAttribute('href')).toMatch(/api\/ng\/service\/\$compile/);
<ide><path>docs/app/e2e/api-docs/service-pages.scenario.js
<ide> describe("service pages", function() {
<ide>
<ide> it("should show the related provider if there is one", function() {
<del> browser.get('index-debug.html#!/api/ng/service/$compile');
<add> browser.get('build/docs/index.html#!/api/ng/service/$compile');
<ide> var providerLink = element.all(by.css('ol.api-profile-header-structure li a')).first();
<ide> expect(providerLink.getText()).toEqual('- $compileProvider');
<ide> expect(providerLink.getAttribute('href')).toMatch(/api\/ng\/provider\/\$compileProvider/);
<ide>
<del> browser.get('index-debug.html#!/api/ng/service/$q');
<add> browser.get('build/docs/index.html#!/api/ng/service/$q');
<ide> providerLink = element.all(by.css('ol.api-profile-header-structure li a')).first();
<ide> expect(providerLink.getText()).not.toEqual('- $qProvider');
<ide> expect(providerLink.getAttribute('href')).not.toMatch(/api\/ng\/provider\/\$compileProvider/);
<ide> });
<ide>
<ide> it("should show parameter defaults", function() {
<del> browser.get('index-debug.html#!/api/ng/service/$timeout');
<add> browser.get('build/docs/index.html#!/api/ng/service/$timeout');
<ide> expect(element.all(by.css('.input-arguments p em')).first().getText()).toContain('(default: 0)');
<ide> });
<ide>
<ide><path>docs/app/e2e/app.scenario.js
<ide> describe('docs.angularjs.org', function () {
<ide>
<ide>
<ide> it('should change the page content when clicking a link to a service', function () {
<del> browser.get('');
<add> browser.get('build/docs/index.html');
<ide>
<ide> var ngBindLink = element(by.css('.definition-table td a[href="api/ng/directive/ngClick"]'));
<ide> ngBindLink.click();
<ide> describe('docs.angularjs.org', function () {
<ide>
<ide>
<ide> it('should be resilient to trailing slashes', function() {
<del> browser.get('index-debug.html#!/api/ng/function/angular.noop/');
<add> browser.get('build/docs/index.html#!/api/ng/function/angular.noop/');
<ide> var pageBody = element(by.css('h1'));
<ide> expect(pageBody.getText()).toEqual('angular.noop');
<ide> });
<ide>
<ide>
<ide> it('should be resilient to trailing "index"', function() {
<del> browser.get('index-debug.html#!/api/ng/function/angular.noop/index');
<add> browser.get('build/docs/index.html#!/api/ng/function/angular.noop/index');
<ide> var pageBody = element(by.css('h1'));
<ide> expect(pageBody.getText()).toEqual('angular.noop');
<ide> });
<ide>
<ide>
<ide> it('should be resilient to trailing "index/"', function() {
<del> browser.get('index-debug.html#!/api/ng/function/angular.noop/index/');
<add> browser.get('build/docs/index.html#!/api/ng/function/angular.noop/index/');
<ide> var pageBody = element(by.css('h1'));
<ide> expect(pageBody.getText()).toEqual('angular.noop');
<ide> });
<ide>
<ide>
<ide> it('should display formatted error messages on error doc pages', function() {
<del> browser.get('index-debug.html#!error/ng/areq?p0=Missing&p1=not%20a%20function,%20got%20undefined');
<add> browser.get('build/docs/index.html#!error/ng/areq?p0=Missing&p1=not%20a%20function,%20got%20undefined');
<ide> expect(element(by.css('.minerr-errmsg')).getText()).toEqual("Argument 'Missing' is not a function, got undefined");
<ide> });
<ide>
<ide> it("should display an error if the page does not exist", function() {
<del> browser.get('index-debug.html#!/api/does/not/exist');
<add> browser.get('build/docs/index.html#!/api/does/not/exist');
<ide> expect(element(by.css('h1')).getText()).toBe('Oops!');
<ide> });
<ide> | 4 |
Javascript | Javascript | reduce duplicated code in doughnut controller | a5167cc42d397491247e406253afd006ba6b33b5 | <ide><path>src/controllers/controller.doughnut.js
<ide> module.exports = function(Chart) {
<ide> });
<ide>
<ide> var model = arc._model;
<del> model.backgroundColor = custom.backgroundColor ? custom.backgroundColor : valueAtIndexOrDefault(dataset.backgroundColor, index, arcOpts.backgroundColor);
<del> model.hoverBackgroundColor = custom.hoverBackgroundColor ? custom.hoverBackgroundColor : valueAtIndexOrDefault(dataset.hoverBackgroundColor, index, arcOpts.hoverBackgroundColor);
<del> model.borderWidth = custom.borderWidth ? custom.borderWidth : valueAtIndexOrDefault(dataset.borderWidth, index, arcOpts.borderWidth);
<del> model.borderColor = custom.borderColor ? custom.borderColor : valueAtIndexOrDefault(dataset.borderColor, index, arcOpts.borderColor);
<add> // Resets the visual styles
<add> this.removeHoverStyle(arc);
<ide>
<ide> // Set correct angles if not resetting
<ide> if (!reset || !animationOpts.animateRotate) {
<ide><path>test/controller.doughnut.tests.js
<ide> describe('Doughnut controller tests', function() {
<ide> arc: {
<ide> backgroundColor: 'rgb(255, 0, 0)',
<ide> borderColor: 'rgb(0, 0, 255)',
<del> borderWidth: 2,
<del> hoverBackgroundColor: 'rgb(255, 255, 255)'
<add> borderWidth: 2
<ide> }
<ide> }
<ide> }
<ide> describe('Doughnut controller tests', function() {
<ide> startAngle: Math.PI * -0.5,
<ide> endAngle: Math.PI * -0.5,
<ide> label: chart.data.labels[i],
<del> hoverBackgroundColor: 'rgb(255, 255, 255)',
<ide> backgroundColor: 'rgb(255, 0, 0)',
<ide> borderColor: 'rgb(0, 0, 255)',
<ide> borderWidth: 2
<ide> describe('Doughnut controller tests', function() {
<ide> expect(meta.data[i]._model.endAngle).toBeCloseTo(expected.e, 8);
<ide> expect(meta.data[i]._model).toEqual(jasmine.objectContaining({
<ide> label: chart.data.labels[i],
<del> hoverBackgroundColor: 'rgb(255, 255, 255)',
<ide> backgroundColor: 'rgb(255, 0, 0)',
<ide> borderColor: 'rgb(0, 0, 255)',
<ide> borderWidth: 2
<ide> describe('Doughnut controller tests', function() {
<ide> arc: {
<ide> backgroundColor: 'rgb(255, 0, 0)',
<ide> borderColor: 'rgb(0, 0, 255)',
<del> borderWidth: 2,
<del> hoverBackgroundColor: 'rgb(255, 255, 255)'
<add> borderWidth: 2
<ide> }
<ide> }
<ide> } | 2 |
PHP | PHP | fix code style. | 8d745f19a8cb0e93c89798406b33dc789219d2f9 | <ide><path>src/Illuminate/Support/Reflector.php
<ide> public static function isParameterSubclassOf($parameter, $className)
<ide> {
<ide> $paramClassName = static::getParameterClassName($parameter);
<ide>
<del> return ($paramClassName && class_exists($paramClassName))
<del> ? (new ReflectionClass($paramClassName))->isSubclassOf($className)
<del> : false;
<add> return $paramClassName
<add> && class_exists($paramClassName)
<add> && (new ReflectionClass($paramClassName))->isSubclassOf($className);
<ide> }
<ide> } | 1 |
Python | Python | use less fancy tables in cli by default | 5b72ef82bac3c168e43f2aecf21b5f52d64a0b50 | <ide><path>airflow/cli/cli_parser.py
<ide> def add_to_parser(self, parser: argparse.ArgumentParser):
<ide> "the tabulate module (https://pypi.org/project/tabulate/). "
<ide> ),
<ide> choices=tabulate_formats,
<del> default="fancy_grid")
<add> default="plain")
<ide> ARG_COLOR = Arg(
<ide> ('--color',),
<ide> help="Do emit colored output (default: auto)",
<ide><path>tests/cli/commands/test_dag_command.py
<ide> def test_cli_report(self):
<ide> ('core', 'load_examples'): 'true'
<ide> })
<ide> def test_cli_list_dags(self):
<del> args = self.parser.parse_args(['dags', 'list'])
<add> args = self.parser.parse_args(['dags', 'list', '--output=fancy_grid'])
<ide> with contextlib.redirect_stdout(io.StringIO()) as temp_stdout:
<ide> dag_command.dag_list_dags(args)
<ide> out = temp_stdout.getvalue()
<ide><path>tests/cli/commands/test_task_command.py
<ide> def test_task_states_for_dag_run(self):
<ide> 'state',
<ide> 'start_date',
<ide> 'end_date'],
<del> tablefmt="fancy_grid")
<add> tablefmt="plain")
<ide>
<ide> # Check that prints, and log messages, are shown
<ide> self.assertEqual(expected.replace("\n", ""), actual_out.replace("\n", "")) | 3 |
Javascript | Javascript | fix typo in parse.js | e29900c78f8fa962559b1cf95e1e7d428230e645 | <ide><path>src/ng/parse.js
<ide> function $ParseProvider() {
<ide>
<ide> var useInputs = parsedExpression.inputs && !exp.inputs;
<ide>
<del> // Propogate the literal/inputs/constant attributes
<add> // Propagate the literal/inputs/constant attributes
<ide> // ... but not oneTime since we are handling it
<ide> oneTimeWatch.literal = parsedExpression.literal;
<ide> oneTimeWatch.constant = parsedExpression.constant;
<ide> function $ParseProvider() {
<ide> fn.$$intercepted = parsedExpression;
<ide> fn.$$interceptor = interceptorFn;
<ide>
<del> // Propogate the literal/oneTime/constant attributes
<add> // Propagate the literal/oneTime/constant attributes
<ide> fn.literal = parsedExpression.literal;
<ide> fn.oneTime = parsedExpression.oneTime;
<ide> fn.constant = parsedExpression.constant; | 1 |
Ruby | Ruby | fix some whitespace errors | 4fa10300ef451f154916be7e301b7b047a0b4fa3 | <ide><path>actionpack/lib/action_controller/test_case.rb
<ide> def paramify_values(hash_or_array_or_value)
<ide> def process(action, http_method = 'GET', *args)
<ide> check_required_ivars
<ide> http_method, args = handle_old_process_api(http_method, args)
<del>
<add>
<ide> if args.first.is_a?(String)
<ide> @request.env['RAW_POST_DATA'] = args.shift
<ide> end
<del>
<add>
<ide> parameters, session, flash = args
<del>
<add>
<ide> # Ensure that numbers and symbols passed as params are converted to
<ide> # proper params, as is the case when engaging rack.
<ide> parameters = paramify_values(parameters)
<ide> def check_required_ivars
<ide> end
<ide> end
<ide> end
<del>
<add>
<ide> def handle_old_process_api(http_method, args)
<ide> # 4.0: Remove this method.
<ide> if http_method.is_a?(Hash)
<ide> ActiveSupport::Deprecation.warn("TestCase#process now expects the HTTP method as second argument: process(action, http_method, params, session, flash)")
<ide> args.unshift(http_method)
<ide> http_method = args.last.is_a?(String) ? args.last : "GET"
<ide> end
<del>
<add>
<ide> [http_method, args]
<ide> end
<ide> | 1 |
Text | Text | fix typo in docs | 95e28b2252b58e7d5d2e33ee5cb705029eb322c5 | <ide><path>docs/api-guide/serializers.md
<ide> The default implementation returns a serializer class based on the `serializer_f
<ide>
<ide> Called to generate a serializer field that maps to a relational model field.
<ide>
<del>The default implementation returns a serializer class based on the `serializer_relational_field` attribute.
<add>The default implementation returns a serializer class based on the `serializer_related_field` attribute.
<ide>
<ide> The `relation_info` argument is a named tuple, that contains `model_field`, `related_model`, `to_many` and `has_through_model` properties.
<ide> | 1 |
PHP | PHP | fix another batch of at() matchers | 0c0e0c8a67eaee1589fb6c38a51604d40da661c3 | <ide><path>tests/TestCase/Database/Driver/PostgresTest.php
<ide> public function testConnectionConfigDefault()
<ide> $this->returnArgument(0)
<ide> ));
<ide>
<del> $connection->expects($this->at(1))->method('exec')->with('SET NAMES utf8');
<del> $connection->expects($this->at(3))->method('exec')->with('SET search_path TO public');
<del> $connection->expects($this->exactly(2))->method('exec');
<add> $connection->expects($this->exactly(2))
<add> ->method('exec')
<add> ->withConsecutive(
<add> ['SET NAMES utf8'],
<add> ['SET search_path TO public']
<add> );
<ide>
<ide> $driver->expects($this->once())->method('_connect')
<ide> ->with($dsn, $expected);
<ide><path>tests/TestCase/Mailer/Transport/SmtpTransportTest.php
<ide> public function testConnectEhlo()
<ide> {
<ide> $this->socket->expects($this->any())->method('connect')->will($this->returnValue(true));
<ide> $this->socket->expects($this->any())
<del> ->method('read')
<add> ->method('read')
<ide> ->will($this->onConsecutiveCalls("220 Welcome message\r\n", "250 Accepted\r\n"));
<ide> $this->socket->expects($this->once())->method('write')->with("EHLO localhost\r\n");
<ide> $this->SmtpTransport->connect();
<ide> public function testConnectFail()
<ide>
<ide> public function testAuthPlain()
<ide> {
<del> $this->socket->expects($this->at(0))->method('write')->with("AUTH PLAIN {$this->credentialsEncoded}\r\n");
<del> $this->socket->expects($this->at(1))->method('read')->will($this->returnValue("235 OK\r\n"));
<add> $this->socket->expects($this->once())->method('write')->with("AUTH PLAIN {$this->credentialsEncoded}\r\n");
<add> $this->socket->expects($this->once())->method('read')->will($this->returnValue("235 OK\r\n"));
<ide> $this->SmtpTransport->setConfig($this->credentials);
<ide> $this->SmtpTransport->auth();
<ide> }
<ide> public function testRcpt()
<ide> $message->setBcc('phpnut@cakephp.org');
<ide> $message->setCc(['mark@cakephp.org' => 'Mark Story', 'juan@cakephp.org' => 'Juan Basso']);
<ide>
<del> $this->socket->expects($this->at(0))->method('write')->with("MAIL FROM:<noreply@cakephp.org>\r\n");
<del> $this->socket->expects($this->at(1))->method('read')->will($this->returnValue("250 OK\r\n"));
<del> $this->socket->expects($this->at(2))->method('write')->with("RCPT TO:<cake@cakephp.org>\r\n");
<del> $this->socket->expects($this->at(3))->method('read')->will($this->returnValue("250 OK\r\n"));
<del> $this->socket->expects($this->at(4))->method('write')->with("RCPT TO:<mark@cakephp.org>\r\n");
<del> $this->socket->expects($this->at(5))->method('read')->will($this->returnValue("250 OK\r\n"));
<del> $this->socket->expects($this->at(6))->method('write')->with("RCPT TO:<juan@cakephp.org>\r\n");
<del> $this->socket->expects($this->at(7))->method('read')->will($this->returnValue("250 OK\r\n"));
<del> $this->socket->expects($this->at(8))->method('write')->with("RCPT TO:<phpnut@cakephp.org>\r\n");
<del> $this->socket->expects($this->at(9))->method('read')->will($this->returnValue("250 OK\r\n"));
<add> $this->socket->expects($this->any())->method('read')->will($this->returnValue("250 OK\r\n"));
<add>
<add> $this->socket->expects($this->exactly(5))
<add> ->method('write')
<add> ->withConsecutive(
<add> ["MAIL FROM:<noreply@cakephp.org>\r\n"],
<add> ["RCPT TO:<cake@cakephp.org>\r\n"],
<add> ["RCPT TO:<mark@cakephp.org>\r\n"],
<add> ["RCPT TO:<juan@cakephp.org>\r\n"],
<add> ["RCPT TO:<phpnut@cakephp.org>\r\n"],
<add> );
<ide>
<ide> $this->SmtpTransport->sendRcpt($message);
<ide> }
<ide> public function testRcptWithReturnPath()
<ide> $message->setTo('cake@cakephp.org', 'CakePHP');
<ide> $message->setReturnPath('pleasereply@cakephp.org', 'CakePHP Return');
<ide>
<del> $this->socket->expects($this->at(0))->method('write')->with("MAIL FROM:<pleasereply@cakephp.org>\r\n");
<del> $this->socket->expects($this->at(1))->method('read')->will($this->returnValue("250 OK\r\n"));
<del> $this->socket->expects($this->at(2))->method('write')->with("RCPT TO:<cake@cakephp.org>\r\n");
<del> $this->socket->expects($this->at(3))->method('read')->will($this->returnValue("250 OK\r\n"));
<add> $this->socket->expects($this->exactly(2))->method('read')->will($this->returnValue("250 OK\r\n"));
<ide>
<add> $this->socket->expects($this->exactly(2))
<add> ->method('write')
<add> ->withConsecutive(
<add> ["MAIL FROM:<pleasereply@cakephp.org>\r\n"],
<add> ["RCPT TO:<cake@cakephp.org>\r\n"]
<add> );
<ide> $this->SmtpTransport->sendRcpt($message);
<ide> }
<ide>
<ide> public function testSendData()
<ide> $data .= "\r\n";
<ide> $data .= "\r\n\r\n.\r\n";
<ide>
<del> $this->socket->expects($this->at(0))->method('write')->with("DATA\r\n");
<del> $this->socket->expects($this->at(1))->method('read')->will($this->returnValue("354 OK\r\n"));
<del> $this->socket->expects($this->at(2))->method('write')->with($data);
<del> $this->socket->expects($this->at(3))->method('read')->will($this->returnValue("250 OK\r\n"));
<add> $this->socket->expects($this->exactly(2))
<add> ->method('read')
<add> ->will($this->onConsecutiveCalls(
<add> "354 OK\r\n",
<add> "250 OK\r\n",
<add> ));
<add>
<add> $this->socket->expects($this->exactly(2))
<add> ->method('write')
<add> ->withConsecutive(
<add> ["DATA\r\n"],
<add> [$data]
<add> );
<ide>
<ide> $this->SmtpTransport->sendData($message);
<ide> }
<ide> public function testSendData()
<ide> */
<ide> public function testQuit()
<ide> {
<del> $this->socket->expects($this->at(0))->method('write')->with("QUIT\r\n");
<add> $this->socket->expects($this->once())->method('write')->with("QUIT\r\n");
<ide> $this->socket->connected = true;
<ide> $this->SmtpTransport->disconnect();
<ide> }
<ide> public function testGetLastResponseMultipleOperations()
<ide> $message->setFrom('noreply@cakephp.org', 'CakePHP Test');
<ide> $message->setTo('cake@cakephp.org', 'CakePHP');
<ide>
<del> $this->socket->expects($this->at(0))->method('write')->with("MAIL FROM:<noreply@cakephp.org>\r\n");
<del> $this->socket->expects($this->at(1))->method('read')->will($this->returnValue("250 OK\r\n"));
<del> $this->socket->expects($this->at(2))->method('write')->with("RCPT TO:<cake@cakephp.org>\r\n");
<del> $this->socket->expects($this->at(3))->method('read')->will($this->returnValue("250 OK\r\n"));
<add> $this->socket->expects($this->exactly(2))
<add> ->method('write')
<add> ->withConsecutive(
<add> ["MAIL FROM:<noreply@cakephp.org>\r\n"],
<add> ["RCPT TO:<cake@cakephp.org>\r\n"]
<add> );
<add> $this->socket->expects($this->exactly(2))
<add> ->method('read')
<add> ->will($this->returnValue("250 OK\r\n"));
<ide>
<ide> $this->SmtpTransport->sendRcpt($message);
<ide>
<ide> public function testConnected()
<ide> */
<ide> public function testAutoDisconnect()
<ide> {
<del> $this->socket->expects($this->at(0))->method('write')->with("QUIT\r\n");
<del> $this->socket->expects($this->at(1))->method('disconnect');
<add> $this->socket->expects($this->once())->method('write')->with("QUIT\r\n");
<add> $this->socket->expects($this->once())->method('disconnect');
<ide> $this->socket->connected = true;
<ide> unset($this->SmtpTransport);
<ide> }
<ide> public function testAutoDisconnect()
<ide> */
<ide> public function testExplicitDisconnect()
<ide> {
<del> $this->socket->expects($this->at(0))->method('write')->with("QUIT\r\n");
<del> $this->socket->expects($this->at(1))->method('disconnect');
<add> $this->socket->expects($this->once())->method('write')->with("QUIT\r\n");
<add> $this->socket->expects($this->once())->method('disconnect');
<ide> $this->socket->connected = true;
<ide> $this->SmtpTransport->disconnect();
<ide> }
<ide> public function testSendDefaults()
<ide> $message->setTo('cake@cakephp.org', 'CakePHP');
<ide> $message->expects($this->once())->method('getBody')->will($this->returnValue(['First Line']));
<ide>
<del> $this->socket->expects($this->at(0))->method('connect')->will($this->returnValue(true));
<add> $this->socket->expects($this->once())->method('connect')->will($this->returnValue(true));
<ide>
<del> $this->socket->expects($this->at(1))->method('read')->will($this->returnValue("220 Welcome message\r\n"));
<del> $this->socket->expects($this->at(2))->method('write')->with("EHLO localhost\r\n");
<del> $this->socket->expects($this->at(3))->method('read')->will($this->returnValue("250 OK\r\n"));
<add> $this->socket->expects($this->atLeast(6))
<add> ->method('read')
<add> ->will($this->onConsecutiveCalls(
<add> "220 Welcome message\r\n",
<add> "250 OK\r\n",
<add> "250 OK\r\n",
<add> "250 OK\r\n",
<add> "354 OK\r\n",
<add> "250 OK\r\n",
<add> ));
<ide>
<del> $this->socket->expects($this->at(4))->method('write')->with("MAIL FROM:<noreply@cakephp.org>\r\n");
<del> $this->socket->expects($this->at(5))->method('read')->will($this->returnValue("250 OK\r\n"));
<del> $this->socket->expects($this->at(6))->method('write')->with("RCPT TO:<cake@cakephp.org>\r\n");
<del> $this->socket->expects($this->at(7))->method('read')->will($this->returnValue("250 OK\r\n"));
<add> $this->socket->expects($this->atLeast(6))
<add> ->method('write')
<add> ->withConsecutive(
<add> ["EHLO localhost\r\n"],
<add> ["MAIL FROM:<noreply@cakephp.org>\r\n"],
<add> ["RCPT TO:<cake@cakephp.org>\r\n"],
<add> ["DATA\r\n"],
<add> [$this->stringContains('First Line')],
<add> ["QUIT\r\n"]
<add> );
<ide>
<del> $this->socket->expects($this->at(8))->method('write')->with("DATA\r\n");
<del> $this->socket->expects($this->at(9))->method('read')->will($this->returnValue("354 OK\r\n"));
<del> $this->socket->expects($this->at(10))->method('write')->with($this->stringContains('First Line'));
<del> $this->socket->expects($this->at(11))->method('read')->will($this->returnValue("250 OK\r\n"));
<del>
<del> $this->socket->expects($this->at(12))->method('write')->with("QUIT\r\n");
<del> $this->socket->expects($this->at(13))->method('disconnect');
<add> $this->socket->expects($this->once())->method('disconnect');
<ide>
<ide> $this->SmtpTransport->send($message);
<ide> }
<ide> public function testSendMessageTooBigOnWindows()
<ide> $message->setTo('cake@cakephp.org', 'CakePHP');
<ide> $message->expects($this->once())->method('getBody')->will($this->returnValue(['First Line']));
<ide>
<del> $this->socket->expects($this->at(0))->method('connect')->will($this->returnValue(true));
<del>
<del> $this->socket->expects($this->at(1))->method('read')->will($this->returnValue("220 Welcome message\r\n"));
<del> $this->socket->expects($this->at(2))->method('write')->with("EHLO localhost\r\n");
<del> $this->socket->expects($this->at(3))->method('read')->will($this->returnValue("250 OK\r\n"));
<add> $this->socket->expects($this->once())->method('connect')->will($this->returnValue(true));
<ide>
<del> $this->socket->expects($this->at(4))->method('write')->with("MAIL FROM:<noreply@cakephp.org>\r\n");
<del> $this->socket->expects($this->at(5))->method('read')->will($this->returnValue("250 OK\r\n"));
<del> $this->socket->expects($this->at(6))->method('write')->with("RCPT TO:<cake@cakephp.org>\r\n");
<del> $this->socket->expects($this->at(7))->method('read')->will($this->returnValue("250 OK\r\n"));
<add> $this->socket->expects($this->atLeast(6))
<add> ->method('read')
<add> ->will($this->onConsecutiveCalls(
<add> "220 Welcome message\r\n",
<add> "250 OK\r\n",
<add> "250 OK\r\n",
<add> "250 OK\r\n",
<add> "354 OK\r\n",
<add> 'Message size too large'
<add> ));
<ide>
<del> $this->socket->expects($this->at(8))->method('write')->with("DATA\r\n");
<del> $this->socket->expects($this->at(9))->method('read')->will($this->returnValue("354 OK\r\n"));
<del> $this->socket->expects($this->at(10))->method('write')->with($this->stringContains('First Line'));
<del> $this->socket->expects($this->at(11))->method('read')->will($this->returnValue('Message size too large'));
<add> $this->socket->expects($this->exactly(5))
<add> ->method('write')
<add> ->withConsecutive(
<add> ["EHLO localhost\r\n"],
<add> ["MAIL FROM:<noreply@cakephp.org>\r\n"],
<add> ["RCPT TO:<cake@cakephp.org>\r\n"],
<add> ["DATA\r\n"],
<add> [$this->stringContains('First Line')]
<add> );
<ide>
<ide> $this->expectException(SocketException::class);
<ide> $this->expectExceptionMessage('Message size too large');
<ide> public function testSendMessageTooBigOnWindows()
<ide> */
<ide> public function testSerializeCleanupSocket()
<ide> {
<del> $this->socket->expects($this->at(0))->method('connect')->will($this->returnValue(true));
<del> $this->socket->expects($this->at(1))->method('read')->will($this->returnValue("220 Welcome message\r\n"));
<del> $this->socket->expects($this->at(2))->method('write')->with("EHLO localhost\r\n");
<del> $this->socket->expects($this->at(3))->method('read')->will($this->returnValue("250 OK\r\n"));
<add> $this->socket->expects($this->once())->method('connect')->will($this->returnValue(true));
<add> $this->socket->expects($this->exactly(2))
<add> ->method('read')
<add> ->will($this->onConsecutiveCalls(
<add> "220 Welcome message\r\n",
<add> "250 OK\r\n"
<add> ));
<add> $this->socket->expects($this->once())
<add> ->method('write')
<add> ->with("EHLO localhost\r\n");
<ide>
<ide> $smtpTransport = new SmtpTestTransport();
<ide> $smtpTransport->setSocket($this->socket); | 2 |
Go | Go | add parent img refcount for faster rmi | 56f5e3459f8d7477d2aa60dee02bc7cd8a8731ad | <ide><path>daemon/daemonbuilder/builder.go
<ide> func (d Docker) Copy(c *daemon.Container, destPath string, src builder.FileInfo,
<ide> // GetCachedImage returns a reference to a cached image whose parent equals `parent`
<ide> // and runconfig equals `cfg`. A cache miss is expected to return an empty ID and a nil error.
<ide> func (d Docker) GetCachedImage(imgID string, cfg *runconfig.Config) (string, error) {
<del> cache, err := d.Daemon.ImageGetCached(string(imgID), cfg)
<add> cache, err := d.Daemon.ImageGetCached(imgID, cfg)
<ide> if cache == nil || err != nil {
<ide> return "", err
<ide> }
<ide><path>daemon/image_delete.go
<ide> func (daemon *Daemon) checkImageDeleteHardConflict(img *image.Image) *imageDelet
<ide> }
<ide>
<ide> // Check if the image has any descendent images.
<del> if daemon.Graph().HasChildren(img) {
<add> if daemon.Graph().HasChildren(img.ID) {
<ide> return &imageDeleteConflict{
<ide> hard: true,
<ide> imgID: img.ID,
<ide> func (daemon *Daemon) checkImageDeleteSoftConflict(img *image.Image) *imageDelet
<ide> // that there are no repository references to the given image and it has no
<ide> // child images.
<ide> func (daemon *Daemon) imageIsDangling(img *image.Image) bool {
<del> return !(daemon.repositories.HasReferences(img) || daemon.Graph().HasChildren(img))
<add> return !(daemon.Repositories().HasReferences(img) || daemon.Graph().HasChildren(img.ID))
<ide> }
<ide><path>graph/graph.go
<ide> type Graph struct {
<ide> tarSplitDisabled bool
<ide> uidMaps []idtools.IDMap
<ide> gidMaps []idtools.IDMap
<add> parentRefs map[string]int
<ide> }
<ide>
<ide> // file names for ./graph/<ID>/
<ide> func NewGraph(root string, driver graphdriver.Driver, uidMaps, gidMaps []idtools
<ide> }
<ide>
<ide> graph := &Graph{
<del> root: abspath,
<del> idIndex: truncindex.NewTruncIndex([]string{}),
<del> driver: driver,
<del> retained: &retainedLayers{layerHolders: make(map[string]map[string]struct{})},
<del> uidMaps: uidMaps,
<del> gidMaps: gidMaps,
<add> root: abspath,
<add> idIndex: truncindex.NewTruncIndex([]string{}),
<add> driver: driver,
<add> retained: &retainedLayers{layerHolders: make(map[string]map[string]struct{})},
<add> uidMaps: uidMaps,
<add> gidMaps: gidMaps,
<add> parentRefs: make(map[string]int),
<ide> }
<ide>
<ide> // Windows does not currently support tarsplit functionality.
<ide> func (graph *Graph) restore() error {
<ide> for _, v := range dir {
<ide> id := v.Name()
<ide> if graph.driver.Exists(id) {
<add> pth := filepath.Join(graph.root, id, "json")
<add> jsonSource, err := os.Open(pth)
<add> if err != nil {
<add> return err
<add> }
<add> defer jsonSource.Close()
<add> decoder := json.NewDecoder(jsonSource)
<add> var img *image.Image
<add> if err := decoder.Decode(img); err != nil {
<add> return err
<add> }
<add> graph.imageMutex.Lock(img.Parent)
<add> graph.parentRefs[img.Parent]++
<add> graph.imageMutex.Unlock(img.Parent)
<ide> ids = append(ids, id)
<ide> }
<ide> }
<ide> func (graph *Graph) register(im image.Descriptor, layerData io.Reader) (err erro
<ide> if err := os.Rename(tmp, graph.imageRoot(imgID)); err != nil {
<ide> return err
<ide> }
<del> graph.idIndex.Add(imgID)
<add>
<add> graph.idIndex.Add(img.ID)
<add>
<add> graph.imageMutex.Lock(img.Parent)
<add> graph.parentRefs[img.Parent]++
<add> graph.imageMutex.Unlock(img.Parent)
<add>
<ide> return nil
<ide> }
<ide>
<ide> func (graph *Graph) Delete(name string) error {
<ide> if err != nil {
<ide> return err
<ide> }
<add> img, err := graph.Get(id)
<add> if err != nil {
<add> return err
<add> }
<ide> tmp, err := graph.mktemp()
<ide> graph.idIndex.Delete(id)
<ide> if err == nil {
<ide> func (graph *Graph) Delete(name string) error {
<ide> }
<ide> // Remove rootfs data from the driver
<ide> graph.driver.Remove(id)
<add>
<add> graph.imageMutex.Lock(img.Parent)
<add> graph.parentRefs[img.Parent]--
<add> if graph.parentRefs[img.Parent] == 0 {
<add> delete(graph.parentRefs, img.Parent)
<add> }
<add> graph.imageMutex.Unlock(img.Parent)
<add>
<ide> // Remove the trashed image directory
<ide> return os.RemoveAll(tmp)
<ide> }
<ide> func (graph *Graph) Map() map[string]*image.Image {
<ide> // The walking order is undetermined.
<ide> func (graph *Graph) walkAll(handler func(*image.Image)) {
<ide> graph.idIndex.Iterate(func(id string) {
<del> if img, err := graph.Get(id); err != nil {
<add> img, err := graph.Get(id)
<add> if err != nil {
<ide> return
<del> } else if handler != nil {
<add> }
<add> if handler != nil {
<ide> handler(img)
<ide> }
<ide> })
<ide> func (graph *Graph) ByParent() map[string][]*image.Image {
<ide> }
<ide>
<ide> // HasChildren returns whether the given image has any child images.
<del>func (graph *Graph) HasChildren(img *image.Image) bool {
<del> return len(graph.ByParent()[img.ID]) > 0
<add>func (graph *Graph) HasChildren(imgID string) bool {
<add> graph.imageMutex.Lock(imgID)
<add> count := graph.parentRefs[imgID]
<add> graph.imageMutex.Unlock(imgID)
<add> return count > 0
<ide> }
<ide>
<ide> // Retain keeps the images and layers that are in the pulling chain so that
<ide> func (graph *Graph) Release(sessionID string, layerIDs ...string) {
<ide> // A head is an image which is not the parent of another image in the graph.
<ide> func (graph *Graph) Heads() map[string]*image.Image {
<ide> heads := make(map[string]*image.Image)
<del> byParent := graph.ByParent()
<ide> graph.walkAll(func(image *image.Image) {
<ide> // If it's not in the byParent lookup table, then
<ide> // it's not a parent -> so it's a head!
<del> if _, exists := byParent[image.ID]; !exists {
<add> if !graph.HasChildren(image.ID) {
<ide> heads[image.ID] = image
<ide> }
<ide> })
<ide><path>integration-cli/docker_cli_images_test.go
<ide> func (s *DockerSuite) TestImagesEnsureImageWithBadTagIsNotListed(c *check.C) {
<ide> if strings.Contains(out, "busybox") {
<ide> c.Fatal("images should not have listed busybox")
<ide> }
<del>
<ide> }
<ide>
<ide> func (s *DockerSuite) TestImagesOrderedByCreationDate(c *check.C) {
<ide> func (s *DockerSuite) TestImagesWithIncorrectFilter(c *check.C) {
<ide> c.Assert(err, check.NotNil)
<ide> c.Assert(out, checker.Contains, "Invalid filter")
<ide> }
<add>
<add>func (s *DockerSuite) TestImagesEnsureOnlyHeadsImagesShown(c *check.C) {
<add> testRequires(c, DaemonIsLinux)
<add>
<add> dockerfile := `
<add> FROM scratch
<add> MAINTAINER docker
<add> ENV foo bar`
<add>
<add> head, out, err := buildImageWithOut("scratch-image", dockerfile, false)
<add> c.Assert(err, check.IsNil)
<add>
<add> split := strings.Split(out, "\n")
<add> intermediate := strings.TrimSpace(split[5][7:])
<add>
<add> out, _ = dockerCmd(c, "images")
<add> if strings.Contains(out, intermediate) {
<add> c.Fatalf("images shouldn't show non-heads images, got %s in %s", intermediate, out)
<add> }
<add> if !strings.Contains(out, head[:12]) {
<add> c.Fatalf("images should contain final built images, want %s in out, got %s", head[:12], out)
<add> }
<add>}
<add>
<add>func (s *DockerSuite) TestImagesEnsureImagesFromScratchShown(c *check.C) {
<add> testRequires(c, DaemonIsLinux)
<add>
<add> dockerfile := `
<add> FROM scratch
<add> MAINTAINER docker`
<add>
<add> id, _, err := buildImageWithOut("scratch-image", dockerfile, false)
<add> c.Assert(err, check.IsNil)
<add>
<add> out, _ := dockerCmd(c, "images")
<add> if !strings.Contains(out, id[:12]) {
<add> c.Fatalf("images should contain images built from scratch (e.g. %s), got %s", id[:12], out)
<add> }
<add>}
<ide><path>integration-cli/docker_cli_rmi_test.go
<ide> RUN echo 2 #layer2
<ide> // should be allowed to untag with the -f flag
<ide> c.Assert(out, checker.Contains, fmt.Sprintf("Untagged: %s:latest", newTag))
<ide> }
<add>
<add>func (*DockerSuite) TestRmiParentImageFail(c *check.C) {
<add> testRequires(c, DaemonIsLinux)
<add>
<add> parent, err := inspectField("busybox", "Parent")
<add> c.Assert(err, check.IsNil)
<add> out, _, err := dockerCmdWithError("rmi", parent)
<add> c.Assert(err, check.NotNil)
<add> if !strings.Contains(out, "image has dependent child images") {
<add> c.Fatalf("rmi should have failed because it's a parent image, got %s", out)
<add> }
<add>} | 5 |
Javascript | Javascript | fix example code indent | c2794b681e9daf504b56f5c53ac7e6679986c37b | <ide><path>packages/ember-states/lib/state_manager.js
<ide> var sendEvent = function(eventName, sendRecursiveArguments, isUnhandledPass) {
<ide> })
<ide> }),
<ide> stateTwo: Ember.State.create({
<del> anAction: function(manager, context){
<del> // will not be called below because it is
<del> // not a parent of the current state
<del> }
<add> anAction: function(manager, context){
<add> // will not be called below because it is
<add> // not a parent of the current state
<add> }
<ide> })
<ide> })
<ide> | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.