content_type stringclasses 8 values | main_lang stringclasses 7 values | message stringlengths 1 50 | sha stringlengths 40 40 | patch stringlengths 52 962k | file_count int64 1 300 |
|---|---|---|---|---|---|
Text | Text | improve contributing.md wording | b82f03437ac6313e1fdffe36513b0a87f2ca878c | <ide><path>CONTRIBUTING.md
<ide>
<ide> Hello 👋!
<ide>
<del>freeCodeCamp.org is possible thanks to thousands of kind volunteers like you. We are grateful for your contributions, and we are excited to welcome you onboard.
<add>freeCodeCamp.org is possible thanks to thousands of kind volunteers like you. We are grateful for your contributions, and we are excited to welcome you aboard.
<ide>
<del>We strictly enforce our ["Code of Conduct"](https://www.freecodecamp.org/code-of-conduct). Take a moment to read it. It's not very long.
<add>We strictly enforce our ["Code of Conduct"](https://www.freecodecamp.org/code-of-conduct). Take a moment to read it. It's only 196 words long.
<ide>
<del>Happy Contributing 🎉!
<add>Happy contributing 🎉!
<ide>
<ide> ## Here are some fun ways you can help
<ide>
<del>You can choose to contribute to an area of you interest:
<add>You can choose to contribute to any area that interests you:
<ide>
<del>1. [Contribute to this open source codebase.](#contribute-to-this-open-source-codebase)
<add>1. [Contribute to this open source codebase.](#contribute-to-this-open-source-codebase). Help editing [guide articles](https://guide.freecodecamp.org/), [coding challenges](https://learn.freecodecamp.org/), or fix bugs on the learning platform.
<ide>
<del> Help us in creating or editing [guide articles](https://www.freecodecamp.org/guide), [coding challenges](https://www.freecodecamp.org/learn) and fixing bugs on the learning platform.
<add>2. Help campers on our [public forum](https://www.freecodecamp.org/forum/). [Answer their coding questions](https://www.freecodecamp.org/forum/?max_posts=1) or [give them feedback on their coding projects](https://www.freecodecamp.org/forum/c/project-feedback?max_posts=1)
<ide>
<del>2. Help campers on our [public forum](https://www.freecodecamp.org/forum/).
<del>
<del> - ❓ Help campers by [answering their questions](https://www.freecodecamp.org/forum/?max_posts=1).
<del> - 💬 [Give feedback](https://www.freecodecamp.org/forum/c/project-feedback?max_posts=1) on camper projects.
<del>
<del>3. Help us add subtitles on our [YouTube channel](https://www.youtube.com/channel/UC8butISFwT-Wl7EV0hUK0BQ/videos).
<add>3. Help us add subtitles to our [YouTube channel videos](https://www.youtube.com/channel/UC8butISFwT-Wl7EV0hUK0BQ/videos).
<ide>
<ide> ## Contribute to this open source codebase
<ide>
<del>We have a huge open source codebase of the thousands of [Coding challenges](https://www.freecodecamp.org/learn) and [Guide articles](https://www.freecodecamp.org/guide). These challenges and articles make up the learning content available on the freeCodeCamp.org's learning platform.
<add>We have a huge open source codebase of the thousands of [coding challenges](https://www.freecodecamp.org/learn) and [guide articles](https://www.freecodecamp.org/guide).
<ide>
<ide> You can help us:
<ide>
<del>- [📝 Research, Write and Update our guide articles.](#research-write-and-update-our-guide-articles)
<add>- [📝 Research, Write and Update our guide articles](#research-write-and-update-our-guide-articles)
<ide>
<del>- [💻 Create, Update and Fix Bugs in our coding challenges.](#create-update-and-fix-bugs-in-our-coding-challenges)
<add>- [💻 Create, Update and Fix Bugs in our coding challenges](#create-update-and-fix-bugs-in-our-coding-challenges)
<ide>
<del>- [🌐 Translate guide articles and coding challenges.](#translate-guide-articles-and-coding-challenges)
<add>- [🌐 Translate guide articles and coding challenges](#translate-guide-articles-and-coding-challenges)
<ide>
<del>- [🛠 Help us fix bugs in freeCodeCamp.org's learning platform.](#help-us-fix-bugs-in-freecodecamporgs-learning-platform)
<add>- [🛠 Help us fix bugs in freeCodeCamp.org's learning platform](#help-us-fix-bugs-in-freecodecamporgs-learning-platform)
<ide>
<ide> ### Research, Write and Update our guide articles
<ide>
<ide> To help, find a `stub article` on our [Guide website](https://www.freecodecamp.o
<ide>
<ide> If you can't find a stub about the topic you'd like to write about, you can open a PR that creates the stub and includes your draft article.
<ide>
<del>**If you would like work on these, follow along these guidelines:**
<del>
<del>#### [How to work on Guide articles.](/docs/how-to-work-on-guide-articles.md)
<add>If you would like to help improve guide articles, here's [how to work on guide articles](/docs/how-to-work-on-guide-articles.md).
<ide>
<ide> ### Create, Update and Fix Bugs in our coding challenges
<ide>
<ide> All our Coding challenges are curated by the community, bringing in expert knowledge from volunteers like you.
<ide>
<del>However, these need to be constantly refined, for quality. For example, you may want to update instructions to improve their [verbiage](https://en.oxforddictionaries.com/definition/verbiage). You can update the user stories to explain the concept better and even remove redundant ones. You may want to refactor tests which do not pass with valid code for the user stories.
<del>
<del>**If you would like work on these, follow along these guidelines:**
<add>You can help expand them and make their wording more clear. You can update the user stories to explain the concept better and even remove redundant ones. You can also improve the challenge tests to make them more accurately test people's code.
<ide>
<del>#### [How to work on Coding Challenges.](/docs/how-to-work-on-coding-challenges.md)
<add>If you're interested in improving these coding chalenges, here's [how to work on coding challenges](/docs/how-to-work-on-coding-challenges.md).
<ide>
<ide> ### Translate guide articles and coding challenges
<ide>
<ide> You can help us translate our Guide articles and Coding challenges for a language that you speak. Currently we have translated versions in:
<ide>
<del>- Chinese (中文)
<del>- Russian (русский)
<del>- Arabic (عربى)
<del>- Spanish (Español)
<del>- Portuguese (Português)
<add>- [Chinese (中文)](https://github.com/freeCodeCamp/freeCodeCamp/tree/master/curriculum/challenges/chinese)
<add>- [Russian (русский)](https://github.com/freeCodeCamp/freeCodeCamp/tree/master/curriculum/challenges/russian)
<add>- [Arabic (عربى)](https://github.com/freeCodeCamp/freeCodeCamp/tree/master/curriculum/challenges/arabic)
<add>- [Spanish (Español)](https://github.com/freeCodeCamp/freeCodeCamp/tree/master/curriculum/challenges/spanish)
<add>- [Portuguese (Português)](https://github.com/freeCodeCamp/freeCodeCamp/tree/master/curriculum/challenges/portuguese)
<ide>
<del>Most of these versions are machine translated. We would love your help in improving the quality of these translations.
<del>
<del>**If you would like work on these, follow along these guidelines:**
<del>
<del>**[TODO]** We are in the process of updating docs for the translation workflow. Follow [`#18313`](https://github.com/freeCodeCamp/freeCodeCamp/issues/18313) for the progress.
<add>We would love your help in improving the quality of these translations. Millions of people use the English language version of freeCodeCamp.org, and we expect millions more to use these translated versions as well.
<ide>
<ide> ### Help us fix bugs in freeCodeCamp.org's learning platform
<ide>
<ide> Essentially we expect certain basic familiarity, with some of the aforementioned
<ide>
<ide> Feel free to ask us questions, on the related issue threads, and we will be glad to clarify. When in doubt, you can reach Mrugesh Mohapatra [`@raisedadead`](https://github.com/raisedadead) or Stuart Taylor [`@bouncey`](https://github.com/bouncey) from our platform dev team to help you with this.
<ide>
<del>**If you would like work on these, follow along these guidelines:**
<del>
<del>#### [How to setup freeCodeCamp locally.](/docs/how-to-setup-freecodecamp-locally.md)
<add>If you want to help us improve our codebase, here's [how to setup freeCodeCamp locally](/docs/how-to-setup-freecodecamp-locally.md).
<ide>
<ide> ## Frequently Asked Questions
<ide>
<ide> Please don't create GitHub issues for security issues. Instead, please send an e
<ide>
<ide> Feel free to ask for help in:
<ide>
<del>- [The "Contributors" category our public forum](https://www.freecodecamp.org/forum/c/contributors).
<del>- [Our public contributors chat room on Gitter](https://gitter.im/FreeCodeCamp/Contributors).
<add>- [The "Contributors" category our public forum](https://www.freecodecamp.org/forum/c/contributors)
<add>- [Our public contributors chat room on Gitter](https://gitter.im/FreeCodeCamp/Contributors)
<ide>
<ide> We are excited to help you contribute to any of the topics that you would like to work on. Make sure you search for your query before posting a new one. Be polite and patient. Our community volunteers and moderators are always around to guide you through your queries.
<ide>
<ide> If these issues lack clarity on what needs to be done, feel free ask questions i
<ide>
<ide> **I found a typo, should I report an issue before I can make a pull request?**
<ide>
<del>You can straight away create a pull request without having to report any issues, for typos, or small changes to [verbiage](https://en.oxforddictionaries.com/definition/verbiage). Issues are a tool to seek confirmation on changes that you would want to propose via a pull request.
<add>For typos and other wording changes, you can directly open pull requests without first creating an issues. Issues are more for discussing larger problems associated with code, or more structural aspects of the curriculum. | 1 |
Text | Text | add getters/setter to prepreqs | 09ad6fbe8a2a47a1bb202d6a33471f89b3ea77fc | <ide><path>threejs/lessons/threejs-prerequisites.md
<ide> somemesh.position.set(...position);
<ide> ### Use `class`
<ide>
<ide> The syntax for making class like objects pre ES5 was unfamilar to most programmers.
<del>As of ES5 you can now [use the `class` keyword](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
<add>As of ES5 you can now [use the `class` keyword](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes) which
<add>is closer to the style of C++/C#/Java.
<add>
<add>### Understand getters and setters
<add>
<add>[Getters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get) and
<add>[setters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/set) are
<add>common in most modern languages. The `class` syntax
<add>of ES5 makes them much easier than pre ES5.
<ide>
<ide> ### Use arrow functions where appropriate
<ide> | 1 |
Ruby | Ruby | remove useless conditional | 44454bdd8b08ca7f19f3974e6c7eb7f0fcbca590 | <ide><path>actionpack/lib/action_controller/metal.rb
<ide> def set_request!(request) #:nodoc:
<ide> end
<ide>
<ide> def to_a #:nodoc:
<del> response ? response.to_a : [status, headers, response_body]
<add> response.to_a
<ide> end
<ide>
<ide> class_attribute :middleware_stack | 1 |
Java | Java | add verify(duration) to mockrestserviceserver | 35225e5794d9a144eae544b64ebad58120766815 | <ide><path>spring-test/src/main/java/org/springframework/test/web/client/AbstractRequestExpectationManager.java
<ide> /*
<del> * Copyright 2002-2020 the original author or authors.
<add> * Copyright 2002-2021 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide>
<ide> import java.io.IOException;
<ide> import java.net.URI;
<add>import java.time.Duration;
<add>import java.time.Instant;
<ide> import java.util.ArrayList;
<ide> import java.util.Collection;
<ide> import java.util.Collections;
<ide> protected RequestExpectation matchRequest(ClientHttpRequest request) throws IOEx
<ide>
<ide> @Override
<ide> public void verify() {
<del> if (this.expectations.isEmpty()) {
<del> return;
<del> }
<del> int count = 0;
<del> for (RequestExpectation expectation : this.expectations) {
<del> if (!expectation.isSatisfied()) {
<del> count++;
<del> }
<del> }
<add> int count = verifyInternal();
<ide> if (count > 0) {
<ide> String message = "Further request(s) expected leaving " + count + " unsatisfied expectation(s).\n";
<ide> throw new AssertionError(message + getRequestDetails());
<ide> }
<add> }
<add>
<add> @Override
<add> public void verify(Duration timeout) {
<add> Instant endTime = Instant.now().plus(timeout);
<add> do {
<add> if (verifyInternal() == 0) {
<add> return;
<add> }
<add> }
<add> while (Instant.now().isBefore(endTime));
<add> verify();
<add> }
<add>
<add> private int verifyInternal() {
<add> if (this.expectations.isEmpty()) {
<add> return 0;
<add> }
<ide> if (!this.requestFailures.isEmpty()) {
<ide> throw new AssertionError("Some requests did not execute successfully.\n" +
<ide> this.requestFailures.entrySet().stream()
<ide> .map(entry -> "Failed request:\n" + entry.getKey() + "\n" + entry.getValue())
<ide> .collect(Collectors.joining("\n", "\n", "")));
<ide> }
<add> int count = 0;
<add> for (RequestExpectation expectation : this.expectations) {
<add> if (!expectation.isSatisfied()) {
<add> count++;
<add> }
<add> }
<add> return count;
<ide> }
<ide>
<ide> /**
<ide><path>spring-test/src/main/java/org/springframework/test/web/client/MockRestServiceServer.java
<ide> /*
<del> * Copyright 2002-2019 the original author or authors.
<add> * Copyright 2002-2021 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide>
<ide> import java.io.IOException;
<ide> import java.net.URI;
<add>import java.time.Duration;
<ide>
<ide> import org.springframework.http.HttpMethod;
<ide> import org.springframework.http.client.BufferingClientHttpRequestFactory;
<ide> public ResponseActions expect(ExpectedCount count, RequestMatcher matcher) {
<ide> /**
<ide> * Verify that all expected requests set up via
<ide> * {@link #expect(RequestMatcher)} were indeed performed.
<del> * @throws AssertionError when some expectations were not met
<add> * @throws AssertionError if not all expectations are met
<ide> */
<ide> public void verify() {
<ide> this.expectationManager.verify();
<ide> }
<ide>
<add> /**
<add> * Variant of {@link #verify()} that waits for up to the specified time for
<add> * all expectations to be fulfilled. This can be useful for tests that
<add> * involve asynchronous requests.
<add> * @param timeout how long to wait for all expecations to be met
<add> * @throws AssertionError if not all expectations are met by the specified
<add> * timeout, or if any expectation fails at any time before that.
<add> * @since 5.3.4
<add> */
<add> public void verify(Duration timeout) {
<add> this.expectationManager.verify(timeout);
<add> }
<add>
<ide> /**
<ide> * Reset the internal state removing all expectations and recorded requests.
<ide> */
<ide><path>spring-test/src/main/java/org/springframework/test/web/client/RequestExpectationManager.java
<ide> /*
<del> * Copyright 2002-2018 the original author or authors.
<add> * Copyright 2002-2021 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> package org.springframework.test.web.client;
<ide>
<ide> import java.io.IOException;
<add>import java.time.Duration;
<ide>
<ide> import org.springframework.http.client.ClientHttpRequest;
<ide> import org.springframework.http.client.ClientHttpResponse;
<ide> public interface RequestExpectationManager {
<ide> /**
<ide> * Verify that all expectations have been met.
<ide> * <p>This is a delegate for {@link MockRestServiceServer#verify()}.
<del> * @throws AssertionError when some expectations were not met
<add> * @throws AssertionError if not all expectations are met
<ide> * @see MockRestServiceServer#verify()
<ide> */
<ide> void verify();
<ide>
<add> /**
<add> * Variant of {@link #verify()} that waits for up to the specified time for
<add> * all expectations to be fulfilled. This can be useful for tests that
<add> * involve asynchronous requests.
<add> * @param timeout how long to wait for all expecations to be met
<add> * @throws AssertionError if not all expectations are met by the specified
<add> * timeout, or if any expectation fails at any time before that.
<add> * @since 5.3.4
<add> */
<add> void verify(Duration timeout);
<add>
<ide> /**
<ide> * Reset the internal state removing all expectations and recorded requests.
<ide> * <p>This is a delegate for {@link MockRestServiceServer#reset()}.
<ide> public interface RequestExpectationManager {
<ide> * @throws IOException in case of any validation errors
<ide> */
<ide> ClientHttpResponse validateRequest(ClientHttpRequest request) throws IOException;
<del>
<ide> }
<ide><path>spring-test/src/test/java/org/springframework/test/web/client/MockRestServiceServerTests.java
<ide> package org.springframework.test.web.client;
<ide>
<ide> import java.net.SocketException;
<add>import java.time.Duration;
<ide>
<ide> import org.junit.jupiter.api.Test;
<ide>
<ide> import org.springframework.test.web.client.MockRestServiceServer.MockRestServiceServerBuilder;
<ide> import org.springframework.web.client.RestTemplate;
<ide>
<ide> import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
<add>import static org.assertj.core.api.Assertions.assertThatThrownBy;
<ide> import static org.assertj.core.api.Assertions.fail;
<ide> import static org.springframework.http.HttpMethod.POST;
<ide> import static org.springframework.test.web.client.ExpectedCount.once;
<ide> public void verifyShouldFailIfRequestsFailed() {
<ide> .withMessageStartingWith("Some requests did not execute successfully");
<ide> }
<ide>
<add> @Test
<add> public void verifyWithTimeout() {
<add> MockRestServiceServerBuilder builder = MockRestServiceServer.bindTo(this.restTemplate);
<add>
<add> MockRestServiceServer server1 = builder.build();
<add> server1.expect(requestTo("/foo")).andRespond(withSuccess());
<add> server1.expect(requestTo("/bar")).andRespond(withSuccess());
<add> this.restTemplate.getForObject("/foo", Void.class);
<add>
<add> assertThatThrownBy(() -> server1.verify(Duration.ofMillis(100))).hasMessage(
<add> "Further request(s) expected leaving 1 unsatisfied expectation(s).\n" +
<add> "1 request(s) executed:\n" +
<add> "GET /foo, headers: [Accept:\"application/json, application/*+json\"]\n");
<add>
<add> MockRestServiceServer server2 = builder.build();
<add> server2.expect(requestTo("/foo")).andRespond(withSuccess());
<add> server2.expect(requestTo("/bar")).andRespond(withSuccess());
<add> this.restTemplate.getForObject("/foo", Void.class);
<add> this.restTemplate.getForObject("/bar", Void.class);
<add>
<add> server2.verify(Duration.ofMillis(100));
<add> }
<add>
<ide> } | 4 |
Python | Python | fix failing tests from | 281095e4c34036845ef7eb5e14c5fc7f7f1ea8bf | <ide><path>airflow/operators/check_operator.py
<ide> SQLCheckOperator, SQLIntervalCheckOperator, SQLThresholdCheckOperator, SQLValueCheckOperator,
<ide> )
<ide>
<add>warnings.warn(
<add> "This module is deprecated. Please use `airflow.operators.sql`.",
<add> DeprecationWarning, stacklevel=2
<add>)
<add>
<ide>
<ide> class CheckOperator(SQLCheckOperator):
<ide> """
<ide><path>airflow/operators/sql_branch_operator.py
<ide>
<ide> from airflow.operators.sql import BranchSQLOperator
<ide>
<add>warnings.warn(
<add> """This module is deprecated. Please use `airflow.operators.sql`.""",
<add> DeprecationWarning, stacklevel=2
<add>)
<add>
<ide>
<ide> class BranchSqlOperator(BranchSQLOperator):
<ide> """
<ide><path>tests/test_core_to_contrib.py
<ide> 'airflow.operators.presto_check_operator.PrestoValueCheckOperator',
<ide> ),
<ide> (
<del> 'airflow.operators.check_operator.CheckOperator',
<ide> 'airflow.operators.sql.SQLCheckOperator',
<add> 'airflow.operators.check_operator.CheckOperator',
<ide> ),
<ide> (
<del> 'airflow.operators.check_operator.IntervalCheckOperator',
<ide> 'airflow.operators.sql.SQLIntervalCheckOperator',
<add> 'airflow.operators.check_operator.IntervalCheckOperator',
<ide> ),
<ide> (
<del> 'airflow.operators.check_operator.ValueCheckOperator',
<ide> 'airflow.operators.sql.SQLValueCheckOperator',
<add> 'airflow.operators.check_operator.ValueCheckOperator',
<ide> ),
<ide> (
<del> 'airflow.operators.check_operator.ThresholdCheckOperator',
<ide> 'airflow.operators.sql.SQLThresholdCheckOperator',
<add> 'airflow.operators.check_operator.ThresholdCheckOperator',
<ide> ),
<ide> (
<del> 'airflow.operators.sql_branch_operator.BranchSqlOperator',
<ide> 'airflow.operators.sql.BranchSQLOperator',
<add> 'airflow.operators.sql_branch_operator.BranchSqlOperator',
<ide> ),
<ide> (
<ide> 'airflow.operators.python.BranchPythonOperator', | 3 |
Ruby | Ruby | add tests for man+'man[1-8]' | af5cd1a1da0e1b87696ae72b8a5f1c174e83e94e | <ide><path>Library/Homebrew/rubocops/lines_cop.rb
<ide> def audit_formula(_node, _class_node, _parent_class_node, body_node)
<ide> problem "Use build instead of ARGV to check options"
<ide> end
<ide> end
<del> #
<del> # find_instance_method_call(body_node, :man, :+) do |m|
<del> # next unless match = regex_match_group(parameters(m).first, %r{man[1-8]})
<del> # problem "\"#{m.source}\" should be \"#{match[1]}\""
<del> # end
<del> #
<add>
<add> find_instance_method_call(body_node, :man, :+) do |m|
<add> next unless match = regex_match_group(parameters(m).first, %r{man[1-8]})
<add> problem "\"#{m.source}\" should be \"#{match[0]}\""
<add> end
<add>
<ide> # # Avoid hard-coding compilers
<ide> # find_every_method_call_by_name(body_node, :system).each do |m|
<ide> # param = parameters(m).first
<ide><path>Library/Homebrew/test/rubocops/lines_cop_spec.rb
<ide> def test
<ide> expect_offense(expected, actual)
<ide> end
<ide> end
<add>
<add> it "with man+ " do
<add> source = <<-EOS.undent
<add> class Foo < Formula
<add> desc "foo"
<add> url 'http://example.com/foo-1.0.tgz'
<add> def test
<add> man1.install man+"man8" => "faad.1"
<add> end
<add> end
<add> EOS
<add>
<add> expected_offenses = [{ message: "\"man+\"man8\"\" should be \"man8\"",
<add> severity: :convention,
<add> line: 5,
<add> column: 22,
<add> source: source }]
<add>
<add> inspect_source(cop, source)
<add>
<add> expected_offenses.zip(cop.offenses).each do |expected, actual|
<add> expect_offense(expected, actual)
<add> end
<add> end
<ide> end
<ide> def expect_offense(expected, actual)
<ide> expect(actual.message).to eq(expected[:message]) | 2 |
PHP | PHP | prevent duplicate attachments | 3c8ccc2fb4ec03572076e6df71608f6bbb7d71e1 | <ide><path>src/Illuminate/Mail/Mailable.php
<ide> public function with($key, $value = null)
<ide> */
<ide> public function attach($file, array $options = [])
<ide> {
<del> $this->attachments[] = compact('file', 'options');
<add> $this->attachments = collect($this->attachments)
<add> ->push(compact('file', 'options'))
<add> ->unique('file')
<add> ->all();
<ide>
<ide> return $this;
<ide> }
<ide> public function attachFromStorage($path, $name = null, array $options = [])
<ide> */
<ide> public function attachFromStorageDisk($disk, $path, $name = null, array $options = [])
<ide> {
<del> $this->diskAttachments[] = [
<add> $this->diskAttachments = collect($this->diskAttachments)->push([
<ide> 'disk' => $disk,
<ide> 'path' => $path,
<ide> 'name' => $name ?? basename($path),
<ide> 'options' => $options,
<del> ];
<add> ])->unique(function ($file) {
<add> return $file['disk'].$file['path'];
<add> })->all();
<ide>
<ide> return $this;
<ide> }
<ide> public function attachFromStorageDisk($disk, $path, $name = null, array $options
<ide> */
<ide> public function attachData($data, $name, array $options = [])
<ide> {
<del> $this->rawAttachments[] = compact('data', 'name', 'options');
<add> $this->rawAttachments = collect($this->rawAttachments)
<add> ->push(compact('data', 'name', 'options'))
<add> ->unique('data')
<add> ->all();
<ide>
<ide> return $this;
<ide> } | 1 |
Text | Text | add release key for richard lau | 1b6565b13c0eaa96416f09972acf89a6d8e18cfd | <ide><path>README.md
<ide> Primary GPG keys for Node.js Releasers (some Releasers sign with subkeys):
<ide> `8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600`
<ide> * **Myles Borins** <myles.borins@gmail.com>
<ide> `C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8`
<add>* **Richard Lau** <riclau@uk.ibm.com>
<add>`C82FA3AE1CBEDC6BE46B9360C43CEC45C17AB93C`
<ide> * **Rod Vagg** <rod@vagg.org>
<ide> `DD8F2338BAE7501E3DD5AC78C273792F7D83545D`
<ide> * **Ruben Bridgewater** <ruben@bridgewater.de>
<ide> gpg --keyserver pool.sks-keyservers.net --recv-keys 94AE36675C464D64BAFA68DD7434
<ide> gpg --keyserver pool.sks-keyservers.net --recv-keys 71DCFD284A79C3B38668286BC97EC7A07EDE3FC1
<ide> gpg --keyserver pool.sks-keyservers.net --recv-keys 8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600
<ide> gpg --keyserver pool.sks-keyservers.net --recv-keys C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8
<add>gpg --keyserver pool.sks-keyservers.net --recv-keys C82FA3AE1CBEDC6BE46B9360C43CEC45C17AB93C
<ide> gpg --keyserver pool.sks-keyservers.net --recv-keys DD8F2338BAE7501E3DD5AC78C273792F7D83545D
<ide> gpg --keyserver pool.sks-keyservers.net --recv-keys A48C2BEE680E841632CD4E44F07496B3EB3C1762
<ide> gpg --keyserver pool.sks-keyservers.net --recv-keys B9E2F5981AA6E0CD28160D9FF13993A75599653C | 1 |
Python | Python | fix import error | 7051296775c4b41a79e66bc6c8527926d2e3c90c | <ide><path>numpy/linalg/setup.py
<ide>
<add>import sys
<add>
<ide> def configuration(parent_package='',top_path=None):
<ide> from numpy.distutils.misc_util import Configuration
<ide> from numpy.distutils.system_info import get_info | 1 |
PHP | PHP | fix some docblocks | 2dcf1a0f9b767a937fbcad0af5f96cbe1856f85f | <ide><path>src/Illuminate/Foundation/Testing/Concerns/InteractsWithAuthentication.php
<ide> trait InteractsWithAuthentication
<ide> /**
<ide> * Assert that the user is authenticated.
<ide> *
<del> * @param string|null $guard
<add> * @param string|null $guard
<ide> * @return $this
<ide> */
<ide> public function seeIsAuthenticated($guard = null)
<ide> public function dontSeeCredentials(array $credentials, $guard = null)
<ide> /**
<ide> * Return true is the credentials are valid, false otherwise.
<ide> *
<del> * @param array $credentials
<add> * @param array $credentials
<ide> * @param string|null $guard
<ide> * @return bool
<ide> */
<ide><path>src/Illuminate/Foundation/Testing/Concerns/InteractsWithConsole.php
<ide> trait InteractsWithConsole
<ide> /**
<ide> * Call artisan command and return code.
<ide> *
<del> * @param string $command
<del> * @param array $parameters
<add> * @param string $command
<add> * @param array $parameters
<ide> * @return int
<ide> */
<ide> public function artisan($command, $parameters = [])
<ide><path>src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php
<ide> public function get($uri, array $headers = [])
<ide> /**
<ide> * Visit the given URI with a GET request, expecting a JSON response.
<ide> *
<del> * @param string $uri
<del> * @param array $headers
<add> * @param string $uri
<add> * @param array $headers
<ide> * @return $this
<ide> */
<ide> public function getJson($uri, array $headers = [])
<ide> public function post($uri, array $data = [], array $headers = [])
<ide> /**
<ide> * Visit the given URI with a POST request, expecting a JSON response.
<ide> *
<del> * @param string $uri
<del> * @param array $data
<del> * @param array $headers
<add> * @param string $uri
<add> * @param array $data
<add> * @param array $headers
<ide> * @return $this
<ide> */
<ide> public function postJson($uri, array $data = [], array $headers = [])
<ide> public function put($uri, array $data = [], array $headers = [])
<ide> /**
<ide> * Visit the given URI with a PUT request, expecting a JSON response.
<ide> *
<del> * @param string $uri
<del> * @param array $data
<del> * @param array $headers
<add> * @param string $uri
<add> * @param array $data
<add> * @param array $headers
<ide> * @return $this
<ide> */
<ide> public function putJson($uri, array $data = [], array $headers = [])
<ide> public function patch($uri, array $data = [], array $headers = [])
<ide> /**
<ide> * Visit the given URI with a PATCH request, expecting a JSON response.
<ide> *
<del> * @param string $uri
<del> * @param array $data
<del> * @param array $headers
<add> * @param string $uri
<add> * @param array $data
<add> * @param array $headers
<ide> * @return $this
<ide> */
<ide> public function patchJson($uri, array $data = [], array $headers = [])
<ide> public function delete($uri, array $data = [], array $headers = [])
<ide> /**
<ide> * Visit the given URI with a DELETE request, expecting a JSON response.
<ide> *
<del> * @param string $uri
<del> * @param array $data
<del> * @param array $headers
<add> * @param string $uri
<add> * @param array $data
<add> * @param array $headers
<ide> * @return $this
<ide> */
<ide> public function deleteJson($uri, array $data = [], array $headers = [])
<ide> protected function shouldReturnJson(array $data = null)
<ide> * @param array|null $data
<ide> * @return $this|null
<ide> */
<del> protected function receiveJson($data = null)
<add> protected function receiveJson(array $data = null)
<ide> {
<ide> return $this->seeJson($data);
<ide> }
<ide> protected function withServerVariables(array $server)
<ide> *
<ide> * @param string $method
<ide> * @param string $uri
<del> * @param array $parameters
<del> * @param array $cookies
<del> * @param array $files
<del> * @param array $server
<add> * @param array $parameters
<add> * @param array $cookies
<add> * @param array $files
<add> * @param array $server
<ide> * @param string $content
<ide> * @return \Illuminate\Http\Response
<ide> */
<ide> public function call($method, $uri, $parameters = [], $cookies = [], $files = []
<ide> *
<ide> * @param string $method
<ide> * @param string $uri
<del> * @param array $parameters
<del> * @param array $cookies
<del> * @param array $files
<del> * @param array $server
<add> * @param array $parameters
<add> * @param array $cookies
<add> * @param array $files
<add> * @param array $server
<ide> * @param string $content
<ide> * @return \Illuminate\Http\Response
<ide> */
<ide> public function callSecure($method, $uri, $parameters = [], $cookies = [], $file
<ide> *
<ide> * @param string $method
<ide> * @param string $action
<del> * @param array $wildcards
<del> * @param array $parameters
<del> * @param array $cookies
<del> * @param array $files
<del> * @param array $server
<add> * @param array $wildcards
<add> * @param array $parameters
<add> * @param array $cookies
<add> * @param array $files
<add> * @param array $server
<ide> * @param string $content
<ide> * @return \Illuminate\Http\Response
<ide> */
<ide> public function action($method, $action, $wildcards = [], $parameters = [], $coo
<ide> *
<ide> * @param string $method
<ide> * @param string $name
<del> * @param array $routeParameters
<del> * @param array $parameters
<del> * @param array $cookies
<del> * @param array $files
<del> * @param array $server
<add> * @param array $routeParameters
<add> * @param array $parameters
<add> * @param array $cookies
<add> * @param array $files
<add> * @param array $server
<ide> * @param string $content
<ide> * @return \Illuminate\Http\Response
<ide> */
<ide> public function assertViewMissing($key)
<ide> * Assert whether the client was redirected to a given URI.
<ide> *
<ide> * @param string $uri
<del> * @param array $with
<add> * @param array $with
<ide> * @return $this
<ide> */
<ide> public function assertRedirectedTo($uri, $with = [])
<ide> public function assertRedirectedTo($uri, $with = [])
<ide> * Assert whether the client was redirected to a given route.
<ide> *
<ide> * @param string $name
<del> * @param array $parameters
<del> * @param array $with
<add> * @param array $parameters
<add> * @param array $with
<ide> * @return $this
<ide> */
<ide> public function assertRedirectedToRoute($name, $parameters = [], $with = [])
<ide> public function assertRedirectedToRoute($name, $parameters = [], $with = [])
<ide> * Assert whether the client was redirected to a given action.
<ide> *
<ide> * @param string $name
<del> * @param array $parameters
<del> * @param array $with
<add> * @param array $parameters
<add> * @param array $with
<ide> * @return $this
<ide> */
<ide> public function assertRedirectedToAction($name, $parameters = [], $with = [])
<ide><path>tests/Database/DatabaseMigrationRefreshCommandTest.php
<ide> protected function runCommand($command, $input = [])
<ide> class InputMatcher extends m\Matcher\MatcherAbstract
<ide> {
<ide> /**
<del> * @param \Symfony\Component\Console\Input\ArrayInput $actual
<add> * @param \Symfony\Component\Console\Input\ArrayInput $actual
<ide> * @return bool
<ide> */
<ide> public function match(&$actual) | 4 |
Javascript | Javascript | revert the change of webglrenderer.setrendertarget | dc11dedc4b06760b3046191e1c5e079a3404837e | <ide><path>src/renderers/WebGLRenderer.js
<ide> function WebGLRenderer( parameters ) {
<ide>
<ide> };
<ide>
<del> this.setRenderTarget = function ( renderTarget, optType ) {
<add> this.setRenderTarget = function ( renderTarget ) {
<ide>
<ide> _currentRenderTarget = renderTarget;
<ide>
<ide> function WebGLRenderer( parameters ) {
<ide>
<ide> if ( _currentFramebuffer !== framebuffer ) {
<ide>
<del> _gl.bindFramebuffer( optType || _gl.FRAMEBUFFER, framebuffer );
<add> _gl.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
<ide> _currentFramebuffer = framebuffer;
<ide>
<ide> } | 1 |
PHP | PHP | fix utf8 issues in tablehelper | 7bee2ae0860f82522dbff2955074e720cb9c2987 | <ide><path>src/Shell/Helper/TableHelper.php
<ide> protected function _render($row, $widths)
<ide> {
<ide> $out = '';
<ide> foreach ($row as $i => $column) {
<del> $out .= '| ' . str_pad($column, $widths[$i], ' ', STR_PAD_RIGHT) . ' ';
<add> $pad = $widths[$i] - mb_strlen($column);
<add> $out .= '| ' . $column . str_repeat(' ', $pad) . ' ';
<ide> }
<ide> $out .= '|';
<ide> $this->_io->out($out);
<ide><path>tests/TestCase/Shell/Helper/TableHelperTest.php
<ide> public function testOutput()
<ide> ];
<ide> $this->assertEquals($expected, $this->stub->messages());
<ide> }
<add>
<add> /**
<add> * Test output array shifting
<add> *
<add> * @return voi
<add> */
<add> public function testOutputShifting()
<add> {
<add> $data = [
<add> ['Header 1', 'Header', 'Long Header'],
<add> ['short', 'Longish thing', 'short'],
<add> ];
<add> $this->helper->output([$data]);
<add> $expected = [
<add> '+----------+---------------+-------------+',
<add> '| Header 1 | Header | Long Header |',
<add> '+----------+---------------+-------------+',
<add> '| short | Longish thing | short |',
<add> '+----------+---------------+-------------+',
<add> ];
<add> $this->assertEquals($expected, $this->stub->messages());
<add> }
<add>
<add> /**
<add> * Test output with multibyte characters
<add> *
<add> * @return voi
<add> */
<add> public function testOutputUtf8()
<add> {
<add> $data = [
<add> ['Header 1', 'Head', 'Long Header'],
<add> ['short', 'ÄÄÄÜÜÜ', 'short'],
<add> ['Longer thing', 'longerish', 'Longest Value'],
<add> ];
<add> $this->helper->output($data);
<add> $expected = [
<add> '+--------------+-----------+---------------+',
<add> '| Header 1 | Head | Long Header |',
<add> '+--------------+-----------+---------------+',
<add> '| short | ÄÄÄÜÜÜ | short |',
<add> '| Longer thing | longerish | Longest Value |',
<add> '+--------------+-----------+---------------+',
<add> ];
<add> debug($this->stub->messages());
<add> $this->assertEquals($expected, $this->stub->messages());
<add> }
<ide> } | 2 |
Python | Python | update the tests introduced in the latest rebase | cd15084bf9f21f4e255f9c788f903ffcbf703a58 | <ide><path>numpy/typing/tests/data/reveal/dtype.py
<ide> import numpy as np
<ide>
<del>reveal_type(np.dtype(np.float64)) # E: numpy.dtype[numpy.float64*]
<del>reveal_type(np.dtype(np.int64)) # E: numpy.dtype[numpy.int64*]
<add>reveal_type(np.dtype(np.float64)) # E: numpy.dtype[numpy.floating[numpy.typing._64Bit]]
<add>reveal_type(np.dtype(np.int64)) # E: numpy.dtype[numpy.signedinteger[numpy.typing._64Bit]]
<ide>
<ide> # String aliases
<del>reveal_type(np.dtype("float64")) # E: numpy.dtype[numpy.float64]
<del>reveal_type(np.dtype("float32")) # E: numpy.dtype[numpy.float32]
<del>reveal_type(np.dtype("int64")) # E: numpy.dtype[numpy.int64]
<del>reveal_type(np.dtype("int32")) # E: numpy.dtype[numpy.int32]
<add>reveal_type(np.dtype("float64")) # E: numpy.dtype[numpy.floating[numpy.typing._64Bit]]
<add>reveal_type(np.dtype("float32")) # E: numpy.dtype[numpy.floating[numpy.typing._32Bit]]
<add>reveal_type(np.dtype("int64")) # E: numpy.dtype[numpy.signedinteger[numpy.typing._64Bit]]
<add>reveal_type(np.dtype("int32")) # E: numpy.dtype[numpy.signedinteger[numpy.typing._32Bit]]
<ide> reveal_type(np.dtype("bool")) # E: numpy.dtype[numpy.bool_]
<ide> reveal_type(np.dtype("bytes")) # E: numpy.dtype[numpy.bytes_]
<ide> reveal_type(np.dtype("str")) # E: numpy.dtype[numpy.str_]
<ide>
<ide> # Python types
<del>reveal_type(np.dtype(complex)) # E: numpy.dtype[numpy.complex128]
<del>reveal_type(np.dtype(float)) # E: numpy.dtype[numpy.float64]
<add>reveal_type(np.dtype(complex)) # E: numpy.dtype[numpy.complexfloating[numpy.typing._64Bit, numpy.typing._64Bit]]
<add>reveal_type(np.dtype(float)) # E: numpy.dtype[numpy.floating[numpy.typing._64Bit]]
<ide> reveal_type(np.dtype(int)) # E: numpy.dtype
<ide> reveal_type(np.dtype(bool)) # E: numpy.dtype[numpy.bool_]
<ide> reveal_type(np.dtype(str)) # E: numpy.dtype[numpy.str_]
<ide> reveal_type(np.dtype(bytes)) # E: numpy.dtype[numpy.bytes_]
<ide>
<ide> # Special case for None
<del>reveal_type(np.dtype(None)) # E: numpy.dtype[numpy.float64]
<add>reveal_type(np.dtype(None)) # E: numpy.dtype[numpy.floating[numpy.typing._64Bit]]
<ide>
<ide> # Dtypes of dtypes
<del>reveal_type(np.dtype(np.dtype(np.float64))) # E: numpy.dtype[numpy.float64*]
<add>reveal_type(np.dtype(np.dtype(np.float64))) # E: numpy.dtype[numpy.floating[numpy.typing._64Bit]]
<ide>
<ide> # Parameterized dtypes
<ide> reveal_type(np.dtype("S8")) # E: numpy.dtype | 1 |
Ruby | Ruby | add no-op message | 1e0551fca49b919077c47adbbac5f7a09cb57a49 | <ide><path>Library/Homebrew/cmd/tap.rb
<ide> def tap
<ide> elsif args.no_named?
<ide> puts Tap.names
<ide> else
<add> if args.full?
<add> opoo "`brew tap --full` is now a no-op!"
<add> # odeprecated "`brew tap --full`"
<add> end
<add>
<add> if args.shallow?
<add> opoo "`brew tap --shallow` is now a no-op!"
<add> # odeprecated "`brew tap --shallow`"
<add> end
<add>
<ide> tap = Tap.fetch(args.named.first)
<ide> begin
<ide> tap.install clone_target: args.named.second, | 1 |
PHP | PHP | remove re-execution of buffered queries | 27977308c199ded4831b71fcf659774f65c47ef6 | <ide><path>src/Database/Statement/BufferedStatement.php
<ide> public function current()
<ide> */
<ide> public function rewind()
<ide> {
<del> if (!$this->_hasExecuted) {
<del> $this->execute();
<del> }
<ide> $this->index = 0;
<ide> }
<ide> | 1 |
Ruby | Ruby | add collectionproxy#to_ary documentation | 390d86ae899f6aba735d8efa0f7f23e05c6957a5 | <ide><path>activerecord/lib/active_record/associations/collection_proxy.rb
<ide> class CollectionProxy < Relation
<ide> # :call-seq:
<ide> # delete(*records)
<ide> #
<del> # Deletes the +records+ supplied and remove them from the collection. For
<add> # Deletes the +records+ supplied and removes them from the collection. For
<ide> # +has_many+ associations, the deletion is done according to the strategy
<ide> # specified by the <tt>:dependent</tt> option. Returns an array with the
<ide> # deleted records.
<ide> class CollectionProxy < Relation
<ide> # :call-seq:
<ide> # destroy(*records)
<ide> #
<del> # Destroys the +records+ supplied and remove them from the collection.
<add> # Destroys the +records+ supplied and removes them from the collection.
<ide> # This method will _always_ remove record from the database ignoring
<ide> # the +:dependent+ option. Returns an array with the removed records.
<ide> #
<ide> def ==(other)
<ide> load_target == other
<ide> end
<ide>
<add> # Returns a new array of objects from the collection. If the collection
<add> # hasn't been loaded, it fetches the records from the database.
<add> #
<add> # class Person < ActiveRecord::Base
<add> # has_many :pets
<add> # end
<add> #
<add> # person.pets
<add> # # => [
<add> # # #<Pet id: 4, name: "Benny", person_id: 1>,
<add> # # #<Pet id: 5, name: "Brain", person_id: 1>,
<add> # # #<Pet id: 6, name: "Boss", person_id: 1>
<add> # # ]
<add> #
<add> # other_pets = person.pets.to_ary
<add> # # => [
<add> # # #<Pet id: 4, name: "Benny", person_id: 1>,
<add> # # #<Pet id: 5, name: "Brain", person_id: 1>,
<add> # # #<Pet id: 6, name: "Boss", person_id: 1>
<add> # # ]
<add> #
<add> # other_pets.replace([Pet.new(name: 'BooGoo')])
<add> #
<add> # other_pets
<add> # # => [#<Pet id: nil, name: "BooGoo", person_id: 1>]
<add> #
<add> # person.pets
<add> # # This is not affected by replace
<add> # # => [
<add> # # #<Pet id: 4, name: "Benny", person_id: 1>,
<add> # # #<Pet id: 5, name: "Brain", person_id: 1>,
<add> # # #<Pet id: 6, name: "Boss", person_id: 1>
<add> # # ]
<ide> def to_ary
<ide> load_target.dup
<ide> end | 1 |
Go | Go | remove experimental guard for buildkit | 239047c2d36706f2826b0a9bc115e0a08b1c3d27 | <ide><path>api/server/router/build/build_routes.go
<ide> func (br *buildRouter) postBuild(ctx context.Context, w http.ResponseWriter, r *
<ide> }
<ide>
<ide> // check if the builder feature has been enabled from daemon as well.
<del> if buildOptions.Version == types.BuilderBuildKit &&
<del> (br.builderVersion != types.BuilderBuildKit || !br.daemon.HasExperimental()) {
<add> if buildOptions.Version == types.BuilderBuildKit && br.builderVersion != types.BuilderBuildKit {
<ide> return errdefs.InvalidParameter(errors.New("buildkit is not enabled on daemon"))
<ide> }
<ide> | 1 |
Javascript | Javascript | simplify subsequent rststream calls | 795a96400613c11791d6b2609811e6c7e48661ef | <ide><path>lib/internal/http2/core.js
<ide> class Http2Session extends EventEmitter {
<ide>
<ide> const state = stream[kState];
<ide> if (state.rst) {
<del> // rst has already been called, do not call again,
<del> // skip straight to destroy
<del> stream.destroy();
<add> // rst has already been called by self or peer,
<add> // do not call again
<ide> return;
<ide> }
<ide> state.rst = true;
<ide><path>test/parallel/test-http2-client-rststream-before-connect.js
<ide> server.on('listening', common.mustCall(() => {
<ide> // make sure that destroy is called
<ide> req._destroy = common.mustCall(req._destroy.bind(req));
<ide>
<add> // second call doesn't do anything
<add> assert.doesNotThrow(() => client.rstStream(req, 8));
<add> assert.strictEqual(req.rstCode, 0);
<add>
<ide> req.on('streamClosed', common.mustCall((code) => {
<ide> assert.strictEqual(req.destroyed, true);
<ide> assert.strictEqual(code, 0); | 2 |
PHP | PHP | remove restriction that caused some bc issues | 57d8251b26e994f428e3cc0630f90b2b14d2fc1f | <ide><path>src/Illuminate/Queue/Console/ListenCommand.php
<ide>
<ide> namespace Illuminate\Queue\Console;
<ide>
<del>use InvalidArgumentException;
<ide> use Illuminate\Queue\Listener;
<ide> use Illuminate\Console\Command;
<ide> use Symfony\Component\Console\Input\InputOption;
<ide> public function fire()
<ide>
<ide> $timeout = $this->input->getOption('timeout');
<ide>
<del> if ($timeout <= $this->input->getOption('sleep')) {
<del> throw new InvalidArgumentException(
<del> "Job timeout must be greater than 'sleep' option value."
<del> );
<del> }
<del>
<ide> // We need to get the right queue for the connection which is set in the queue
<ide> // configuration file for the application. We will pull it based on the set
<ide> // connection being run for the queue operation currently being executed. | 1 |
Go | Go | fix wrong untag while docker rmi | 93810b289c6c8394061da41a59f7fa5c655be0d7 | <ide><path>server.go
<ide> func (srv *Server) deleteImageParents(img *Image, imgs *[]APIRmi) error {
<ide>
<ide> func (srv *Server) deleteImage(img *Image, repoName, tag string) ([]APIRmi, error) {
<ide> imgs := []APIRmi{}
<add> tags := []string{}
<ide>
<ide> //If delete by id, see if the id belong only to one repository
<del> if strings.Contains(img.ID, repoName) && tag == "" {
<add> if repoName == "" {
<ide> for _, repoAndTag := range srv.runtime.repositories.ByID()[img.ID] {
<ide> parsedRepo, parsedTag := utils.ParseRepositoryTag(repoAndTag)
<del> if strings.Contains(img.ID, repoName) {
<add> if repoName == "" || repoName == parsedRepo {
<ide> repoName = parsedRepo
<del> if len(srv.runtime.repositories.ByID()[img.ID]) == 1 && len(parsedTag) > 1 {
<del> tag = parsedTag
<add> if parsedTag != "" {
<add> tags = append(tags, parsedTag)
<ide> }
<ide> } else if repoName != parsedRepo {
<ide> // the id belongs to multiple repos, like base:latest and user:test,
<ide> // in that case return conflict
<ide> return imgs, nil
<ide> }
<ide> }
<add> } else {
<add> tags = append(tags, tag)
<ide> }
<ide> //Untag the current image
<del> tagDeleted, err := srv.runtime.repositories.Delete(repoName, tag)
<del> if err != nil {
<del> return nil, err
<del> }
<del> if tagDeleted {
<del> imgs = append(imgs, APIRmi{Untagged: img.ShortID()})
<del> srv.LogEvent("untag", img.ShortID(), "")
<add> for _, tag := range tags {
<add> tagDeleted, err := srv.runtime.repositories.Delete(repoName, tag)
<add> if err != nil {
<add> return nil, err
<add> }
<add> if tagDeleted {
<add> imgs = append(imgs, APIRmi{Untagged: img.ShortID()})
<add> srv.LogEvent("untag", img.ShortID(), "")
<add> }
<ide> }
<ide> if len(srv.runtime.repositories.ByID()[img.ID]) == 0 {
<ide> if err := srv.deleteImageAndChildren(img.ID, &imgs); err != nil {
<ide> func (srv *Server) ImageDelete(name string, autoPrune bool) ([]APIRmi, error) {
<ide> }
<ide> return nil, nil
<ide> }
<del>
<add> if strings.Contains(img.ID, name) {
<add> //delete via ID
<add> return srv.deleteImage(img, "", "")
<add> }
<ide> name, tag := utils.ParseRepositoryTag(name)
<ide> return srv.deleteImage(img, name, tag)
<ide> } | 1 |
Python | Python | handle poll if poller closed. fixes #882 | 6b5461c0a02cfaeff35a087c706ec980b2dc2511 | <ide><path>celery/worker/consumer.py
<ide> def on_task_received(body, message):
<ide> if readers or writers:
<ide> connection.more_to_read = True
<ide> while connection.more_to_read:
<del> for fileno, event in poll(poll_timeout) or ():
<add> try:
<add> events = poll(poll_timeout):
<add> except ValueError: # Issue 882
<add> return
<add> for fileno, event in events or ():
<ide> try:
<ide> if event & READ:
<ide> readers[fileno](fileno, event) | 1 |
Text | Text | add more testing methods to dev/readme.md | b1fcac2f6dc201fdf88028518cb82aa3ec591748 | <ide><path>dev/README.md
<ide> is available on PyPI apart from SVN packages, so everyone should be able to inst
<ide> the release candidate version of Airflow via simply (<VERSION> is 1.10.12 for example, and <X> is
<ide> release candidate number 1,2,3,....).
<ide>
<del>You have to make sure you have ariflow 1.10.* (the version you want to install providers with).
<add>You can use any of the installation methods you prefer (you can even install it via the binary wheels
<add>downloaded from the SVN).
<ide>
<del>```shell script
<del>pip install apache-airflow-backport-providers-<provider>==<VERSION>rc<X>
<del>```
<del>Optionally it can be followed with constraints
<add>
<add>#### Installing in your local virtualenv
<add>
<add>You have to make sure you have Airilow 1.10.* installed in your PIP virtualenv
<add>(the version you want to install providers with).
<ide>
<ide> ```shell script
<del>pip install apache-airflow-backport-providers-<provider>==<VERSION>rc<X> \
<del> --constraint "https://raw.githubusercontent.com/apache/airflow/constraints-<VERSION>/constraints-3.6.txt"`
<add>pip install apache-airflow-backport-providers-<provider>==<VERSION>rc<X>
<ide> ```
<ide>
<del>Note that the constraints contain python version that you are installing it with.
<del>
<del>You can use any of the installation methods you prefer (you can even install it via the binary wheels
<del>downloaded from the SVN).
<add>#### Installing with Breeze
<ide>
<ide> There is also an easy way of installation with Breeze if you have the latest sources of Apache Airflow.
<ide> Here is a typical scenario.
<ide> For 1.10 releases you can also use `--no-rbac-ui` flag disable RBAC UI of Airflo
<ide> --python 3.7 --backend postgres --install-wheels --no-rbac-ui
<ide> ```
<ide>
<del>Once you install and run Airflow, you should perform any verification you see as necessary to check
<del>that the Airflow works as you expected.
<add>#### Building your own docker image
<add>
<add>If you prefer to build your own image, you can also use the official image and PyPI packages to test
<add>backport packages. This is especially helpful when you want to test integrations, but you need to install
<add>additional tools. Below is an example Dockerfile, which installs backport providers for Google and
<add>an additional third-party tools:
<add>
<add>```
<add>FROM apache/airflow:1.10.12
<ide>
<add>RUN pip install --user apache-airflow-backport-providers-google==2020.10.5.rc1
<add>
<add>RUN curl https://sdk.cloud.google.com | bash \
<add> && echo "source /home/airflow/google-cloud-sdk/path.bash.inc" >> /home/airflow/.bashrc \
<add> && echo "source /home/airflow/google-cloud-sdk/completion.bash.inc" >> /home/airflow/.bashrc
<add>
<add>USER 0
<add>RUN KUBECTL_VERSION="$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)" \
<add> && KUBECTL_URL="https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl" \
<add> && curl -L "${KUBECTL_URL}" --output /usr/local/bin/kubectl \
<add> && chmod +x /usr/local/bin/kubectl
<add>
<add>USER ${AIRFLOW_UID}
<add>```
<add>
<add>To build an image build and run a shell, run:
<add>
<add>```
<add>docker build . -t my-airflow
<add>docker run -ti \
<add> --rm \
<add> -v "$PWD/data:/opt/airflow/" \
<add> -v "$PWD/keys/:/keys/" \
<add> -p 8080:8080 \
<add> -e GOOGLE_APPLICATION_CREDENTIALS=/keys/sa.json \
<add> -e AIRFLOW__CORE__LOAD_EXAMPLES=True \
<add> my-airflow bash
<add>```
<add>
<add>#### Verification
<add>
<add>Once you install and run Airflow, you can perform any verification you see as necessary to check
<add>that the Airflow works as you expected.
<ide>
<ide> ## Publish the final releases of backport packages
<ide> | 1 |
Ruby | Ruby | apply the log_level default | 794a6ca71ebdd3794710c503131580e9cb02982c | <ide><path>railties/lib/rails/application/configuration.rb
<ide> class Configuration < ::Rails::Engine::Configuration
<ide> :ssl_options, :public_file_server,
<ide> :session_options, :time_zone, :reload_classes_only_on_change,
<ide> :beginning_of_week, :filter_redirect, :x, :enable_dependency_loading,
<del> :read_encrypted_secrets
<add> :read_encrypted_secrets, :log_level
<ide>
<del> attr_writer :log_level
<ide> attr_reader :encoding, :api_only
<ide>
<ide> def initialize(*)
<ide> def initialize(*)
<ide> @session_store = nil
<ide> @time_zone = "UTC"
<ide> @beginning_of_week = :monday
<del> @log_level = nil
<add> @log_level = :debug
<ide> @generators = app_generators
<ide> @cache_store = [ :file_store, "#{root}/tmp/cache/" ]
<ide> @railties_order = [:all]
<ide> def database_configuration
<ide> raise e, "Cannot load `Rails.application.database_configuration`:\n#{e.message}", e.backtrace
<ide> end
<ide>
<del> def log_level
<del> @log_level ||= (Rails.env.production? ? :info : :debug)
<del> end
<del>
<ide> def colorize_logging
<ide> ActiveSupport::LogSubscriber.colorize_logging
<ide> end | 1 |
Python | Python | fix import order by disabling it | fd955c930ee994c25aec77ba738504d334393e66 | <ide><path>official/resnet/keras/keras_common.py
<ide>
<ide> import time
<ide>
<del>from absl import flags # pylint: disable=g-bad-import-order
<del>import numpy as np # pylint: disable=g-bad-import-order
<del>import tensorflow as tf # pylint: disable=g-bad-import-order
<del>
<add># pylint: disable=g-bad-import-order
<add>from absl import flags
<add>import numpy as np
<add>import tensorflow as tf
<ide> from tensorflow.python.keras.optimizer_v2 import (gradient_descent as
<ide> gradient_descent_v2)
<ide> | 1 |
Text | Text | fix example codes for generators guide [ci skip] | 79477417bf6c266d10a8cb4cdd2911465a862c12 | <ide><path>guides/source/generators.md
<ide> This method also takes a block:
<ide>
<ide> ```ruby
<ide> lib "super_special.rb" do
<del> puts "Super special!"
<add> "puts 'Super special!'"
<ide> end
<ide> ```
<ide>
<ide> end
<ide> Creates a Rake file in the `lib/tasks` directory of the application.
<ide>
<ide> ```ruby
<del>rakefile "test.rake", "hello there"
<add>rakefile "test.rake", 'task(:hello) { puts "Hello, there" }'
<ide> ```
<ide>
<ide> This method also takes a block: | 1 |
Ruby | Ruby | fix typos in date helper rdoc (via mike breen) | 986b3f805d1e9d6e5c2de096dbc5857fb1b3d826 | <ide><path>actionpack/lib/action_view/helpers/date_helper.rb
<ide> def time_ago_in_words(from_time, include_seconds = false)
<ide> alias_method :distance_of_time_in_words_to_now, :time_ago_in_words
<ide>
<ide> # Returns a set of select tags (one for year, month, and day) pre-selected for accessing a specified date-based
<del> # attribute (identified by +method+) on an object assigned to the template (identified by +object+). You can
<del> # the output in the +options+ hash.
<add> # attribute (identified by +method+) on an object assigned to the template (identified by +object+).
<add> #
<ide> #
<ide> # ==== Options
<ide> # * <tt>:use_month_numbers</tt> - Set to true if you want to use month numbers rather than month names (e.g.
<ide> def time_select(object_name, method, options = {}, html_options = {})
<ide>
<ide> # Returns a set of select tags (one for year, month, day, hour, and minute) pre-selected for accessing a
<ide> # specified datetime-based attribute (identified by +method+) on an object assigned to the template (identified
<del> # by +object+). Examples:
<add> # by +object+).
<ide> #
<ide> # If anything is passed in the html_options hash it will be applied to every select tag in the set.
<ide> # | 1 |
Text | Text | update arch dependencies | 98b40c98da5308cb01871e836f5ca4328709b701 | <ide><path>docs/build-instructions/linux.md
<ide> To also install the newly built application, use `--create-debian-package` or `-
<ide>
<ide> ### Arch
<ide>
<del>* `sudo pacman -S --needed gconf base-devel git nodejs npm libgnome-keyring python2 libX11-devel libxkbfile-devel`
<add>* `sudo pacman -S --needed gconf base-devel git nodejs npm libgnome-keyring python2 libx11 libxkbfile`
<ide> * `export PYTHON=/usr/bin/python2` before building Atom.
<ide>
<ide> ### Slackware | 1 |
Python | Python | fix crazy typo | fd9d6c664be1273f4d2f4d56361345e630ce8b7b | <ide><path>rest_framework/tests/authentication.py
<ide> def test_post_form_session_auth_failing(self):
<ide>
<ide> class TokenAuthTests(TestCase):
<ide> """Token authentication"""
<del> urls = '§.tests.authentication'
<add> urls = 'rest_framework.tests.authentication'
<ide>
<ide> def setUp(self):
<ide> self.csrf_client = Client(enforce_csrf_checks=True) | 1 |
Javascript | Javascript | reduce run time for test-benchmark-crypto | 3eae3103349b4fd5dc9a5d7a8b50374d6bf43c16 | <ide><path>test/parallel/test-benchmark-crypto.js
<ide> const fork = require('child_process').fork;
<ide> const path = require('path');
<ide>
<ide> const runjs = path.join(__dirname, '..', '..', 'benchmark', 'run.js');
<del>const argv = ['--set', 'n=1',
<del> '--set', 'writes=1',
<del> '--set', 'len=1',
<add>const argv = ['--set', 'algo=sha256',
<ide> '--set', 'api=stream',
<del> '--set', 'out=buffer',
<ide> '--set', 'keylen=1024',
<add> '--set', 'len=1',
<add> '--set', 'n=1',
<add> '--set', 'out=buffer',
<ide> '--set', 'type=buf',
<add> '--set', 'v=crypto',
<add> '--set', 'writes=1',
<ide> 'crypto'];
<ide>
<ide> const child = fork(runjs, argv, {env: {NODEJS_BENCHMARK_ZERO_ALLOWED: 1}}); | 1 |
Ruby | Ruby | convert formulaauditor test to spec | ebe4042b2f9b7b66e1c2ee9082de002795ea0b81 | <ide><path>Library/Homebrew/test/audit_test.rb
<del>require "testing_env"
<del>require "fileutils"
<del>require "pathname"
<del>require "formulary"
<del>require "dev-cmd/audit"
<del>
<del>class FormulaAuditorTests < Homebrew::TestCase
<del> def setup
<del> super
<del> @dir = mktmpdir
<del> end
<del>
<del> def formula_auditor(name, text, options = {})
<del> path = Pathname.new "#{@dir}/#{name}.rb"
<del> path.open("w") do |f|
<del> f.write text
<del> end
<del> FormulaAuditor.new Formulary.factory(path), options
<del> end
<del>
<del> def test_init_no_problems
<del> fa = formula_auditor "foo", <<-EOS.undent
<del> class Foo < Formula
<del> url "http://example.com/foo-1.0.tgz"
<del> end
<del> EOS
<del>
<del> assert_equal [], fa.problems
<del> end
<del>
<del> def test_audit_file_permissions
<del> File.stubs(:umask).returns 022
<del> fa = formula_auditor "foo", <<-EOS.undent
<del> class Foo < Formula
<del> url "http://example.com/foo-1.0.tgz"
<del> end
<del> EOS
<del>
<del> path = fa.formula.path
<del> path.chmod 0400
<del>
<del> fa.audit_file
<del> assert_equal ["Incorrect file permissions (400): chmod 644 #{path}"],
<del> fa.problems
<del> end
<del>
<del> def test_audit_file_data_no_end
<del> fa = formula_auditor "foo", <<-EOS.undent
<del> class Foo < Formula
<del> url "http://example.com/foo-1.0.tgz"
<del> patch :DATA
<del> end
<del> EOS
<del> fa.audit_file
<del> assert_equal ["'DATA' was found, but no '__END__'"], fa.problems
<del> end
<del>
<del> def test_audit_file_end_no_data
<del> fa = formula_auditor "foo", <<-EOS.undent
<del> class Foo < Formula
<del> url "http://example.com/foo-1.0.tgz"
<del> end
<del> __END__
<del> a patch goes here
<del> EOS
<del> fa.audit_file
<del> assert_equal ["'__END__' was found, but 'DATA' is not used"], fa.problems
<del> end
<del>
<del> def test_audit_file_no_trailing_newline
<del> fa = formula_auditor "foo", 'class Foo<Formula; url "file:///foo-1.0.tgz";end'
<del> fa.audit_file
<del> assert_equal ["File should end with a newline"], fa.problems
<del> end
<del>
<del> def test_audit_file_not_strict_no_issue
<del> fa = formula_auditor "foo", <<-EOS.undent
<del> class Foo < Formula
<del> url "http://example.com/foo-1.0.tgz"
<del> homepage "http://example.com"
<del> end
<del> EOS
<del> fa.audit_file
<del> assert_equal [], fa.problems
<del> end
<del>
<del> def test_audit_file_strict_ordering_issue
<del> fa = formula_auditor "foo", <<-EOS.undent, strict: true
<del> class Foo < Formula
<del> url "http://example.com/foo-1.0.tgz"
<del> homepage "http://example.com"
<del> end
<del> EOS
<del> fa.audit_file
<del> assert_equal ["`homepage` (line 3) should be put before `url` (line 2)"],
<del> fa.problems
<del> end
<del>
<del> def test_audit_file_strict_resource_placement
<del> fa = formula_auditor "foo", <<-EOS.undent, strict: true
<del> class Foo < Formula
<del> url "https://example.com/foo-1.0.tgz"
<del>
<del> resource "foo2" do
<del> url "https://example.com/foo-2.0.tgz"
<del> end
<del>
<del> depends_on "openssl"
<del> end
<del> EOS
<del> fa.audit_file
<del> assert_equal ["`depends_on` (line 8) should be put before `resource` (line 4)"],
<del> fa.problems
<del> end
<del>
<del> def test_audit_file_strict_plist_placement
<del> fa = formula_auditor "foo", <<-EOS.undent, strict: true
<del> class Foo < Formula
<del> url "https://example.com/foo-1.0.tgz"
<del>
<del> test do
<del> assert_match "Dogs are terrific", shell_output("./dogs")
<del> end
<del>
<del> def plist
<del> end
<del> end
<del> EOS
<del> fa.audit_file
<del> assert_equal ["`plist block` (line 8) should be put before `test block` (line 4)"],
<del> fa.problems
<del> end
<del>
<del> def test_audit_file_strict_url_outside_of_stable_block
<del> fa = formula_auditor "foo", <<-EOS.undent, strict: true
<del> class Foo < Formula
<del> url "http://example.com/foo-1.0.tgz"
<del> stable do
<del> # stuff
<del> end
<del> end
<del> EOS
<del> fa.audit_file
<del> assert_equal ["`url` should be put inside `stable block`"], fa.problems
<del> end
<del>
<del> def test_audit_file_strict_head_and_head_do
<del> fa = formula_auditor "foo", <<-EOS.undent, strict: true
<del> class Foo < Formula
<del> head "http://example.com/foo.git"
<del> head do
<del> # stuff
<del> end
<del> end
<del> EOS
<del> fa.audit_file
<del> assert_equal ["Should not have both `head` and `head do`"], fa.problems
<del> end
<del>
<del> def test_audit_file_strict_bottle_and_bottle_do
<del> fa = formula_auditor "foo", <<-EOS.undent, strict: true
<del> class Foo < Formula
<del> url "http://example.com/foo-1.0.tgz"
<del> bottle do
<del> # bottles go here
<del> end
<del> bottle :unneeded
<del> end
<del> EOS
<del> fa.audit_file
<del> assert_equal ["Should not have `bottle :unneeded/:disable` and `bottle do`"],
<del> fa.problems
<del> end
<del>
<del> def test_audit_class_no_test
<del> fa = formula_auditor "foo", <<-EOS.undent
<del> class Foo < Formula
<del> url "http://example.com/foo-1.0.tgz"
<del> end
<del> EOS
<del> fa.audit_class
<del> assert_equal [], fa.problems
<del>
<del> fa = formula_auditor "foo", <<-EOS.undent, strict: true
<del> class Foo < Formula
<del> url "http://example.com/foo-1.0.tgz"
<del> end
<del> EOS
<del> fa.audit_class
<del> assert_equal ["A `test do` test block should be added"], fa.problems
<del> end
<del>
<del> def test_audit_class_github_gist_formula
<del> needs_compat
<del> require "compat/formula_specialties"
<del>
<del> ENV.delete("HOMEBREW_DEVELOPER")
<del> fa = shutup do
<del> formula_auditor "foo", <<-EOS.undent
<del> class Foo < GithubGistFormula
<del> url "http://example.com/foo-1.0.tgz"
<del> end
<del> EOS
<del> end
<del> fa.audit_class
<del> assert_equal ["GithubGistFormula is deprecated, use Formula instead"],
<del> fa.problems
<del> end
<del>
<del> def test_audit_class_script_file_formula
<del> needs_compat
<del> require "compat/formula_specialties"
<del>
<del> ENV.delete("HOMEBREW_DEVELOPER")
<del> fa = formula_auditor "foo", <<-EOS.undent
<del> class Foo < ScriptFileFormula
<del> url "http://example.com/foo-1.0.tgz"
<del> end
<del> EOS
<del> fa.audit_class
<del> assert_equal ["ScriptFileFormula is deprecated, use Formula instead"],
<del> fa.problems
<del> end
<del>
<del> def test_audit_class_aws_formula
<del> needs_compat
<del> require "compat/formula_specialties"
<del>
<del> ENV.delete("HOMEBREW_DEVELOPER")
<del> fa = formula_auditor "foo", <<-EOS.undent
<del> class Foo < AmazonWebServicesFormula
<del> url "http://example.com/foo-1.0.tgz"
<del> end
<del> EOS
<del> fa.audit_class
<del> assert_equal ["AmazonWebServicesFormula is deprecated, use Formula instead"],
<del> fa.problems
<del> end
<del>
<del> def test_audit_line_pkgshare
<del> fa = formula_auditor "foo", <<-EOS.undent, strict: true
<del> class Foo < Formula
<del> url "http://example.com/foo-1.0.tgz"
<del> end
<del> EOS
<del> fa.audit_line 'ohai "#{share}/foo"', 3
<del> assert_equal "Use \#{pkgshare} instead of \#{share}/foo", fa.problems.shift
<del>
<del> fa.audit_line 'ohai "#{share}/foo/bar"', 3
<del> assert_equal "Use \#{pkgshare} instead of \#{share}/foo", fa.problems.shift
<del>
<del> fa.audit_line 'ohai share/"foo"', 3
<del> assert_equal 'Use pkgshare instead of (share/"foo")', fa.problems.shift
<del>
<del> fa.audit_line 'ohai share/"foo/bar"', 3
<del> assert_equal 'Use pkgshare instead of (share/"foo")', fa.problems.shift
<del>
<del> fa.audit_line 'ohai "#{share}/foo-bar"', 3
<del> assert_equal [], fa.problems
<del> fa.audit_line 'ohai share/"foo-bar"', 3
<del> assert_equal [], fa.problems
<del> fa.audit_line 'ohai share/"bar"', 3
<del> assert_equal [], fa.problems
<del> end
<del>
<del> # Regression test for https://github.com/Homebrew/legacy-homebrew/pull/48744
<del> # Formulae with "++" in their name would break various audit regexps:
<del> # Error: nested *?+ in regexp: /^libxml++3\s/
<del> def test_audit_plus_plus_name
<del> fa = formula_auditor "foolibc++", <<-EOS.undent, strict: true
<del> class Foolibcxx < Formula
<del> desc "foolibc++ is a test"
<del> url "http://example.com/foo-1.0.tgz"
<del> end
<del> EOS
<del>
<del> fa.audit_desc
<del> assert_equal "Description shouldn't include the formula name",
<del> fa.problems.shift
<del>
<del> fa.audit_line 'ohai "#{share}/foolibc++"', 3
<del> assert_equal "Use \#{pkgshare} instead of \#{share}/foolibc++", fa.problems.shift
<del>
<del> fa.audit_line 'ohai share/"foolibc++"', 3
<del> assert_equal 'Use pkgshare instead of (share/"foolibc++")', fa.problems.shift
<del> end
<del>
<del> def test_audit_line_space_in_class_inheritance
<del> fa = formula_auditor "foo", "class Foo<Formula; url '/foo-1.0.tgz'; end"
<del> fa.audit_line "class Foo<Formula", 1
<del> assert_equal "Use a space in class inheritance: class Foo < Formula",
<del> fa.problems.shift
<del> end
<del>
<del> def test_audit_line_default_template
<del> fa = formula_auditor "foo", "class Foo < Formula; url '/foo-1.0.tgz'; end"
<del>
<del> fa.audit_line '# system "cmake", ".", *std_cmake_args', 3
<del> assert_equal "Commented cmake call found",
<del> fa.problems.shift
<del>
<del> fa.audit_line "# PLEASE REMOVE", 3
<del> assert_equal "Please remove default template comments",
<del> fa.problems.shift
<del> end
<del>
<del> def test_audit_github_repository_no_api
<del> fa = formula_auditor "foo", <<-EOS.undent, strict: true, online: true
<del> class Foo < Formula
<del> homepage "https://github.com/example/example"
<del> url "http://example.com/foo-1.0.tgz"
<del> end
<del> EOS
<del>
<del> ENV["HOMEBREW_NO_GITHUB_API"] = "1"
<del>
<del> fa.audit_github_repository
<del> assert_equal [], fa.problems
<del> end
<del>
<del> def test_audit_caveats
<del> fa = formula_auditor "foo", <<-EOS.undent
<del> class Foo < Formula
<del> homepage "http://example.com/foo"
<del> url "http://example.com/foo-1.0.tgz"
<del>
<del> def caveats
<del> "setuid"
<del> end
<del> end
<del> EOS
<del>
<del> fa.audit_caveats
<del> assert_equal ["Don't recommend setuid in the caveats, suggest sudo instead."],
<del> fa.problems
<del> end
<del>
<del> def test_audit_desc
<del> formula_descriptions = [
<del> { name: "foo", desc: nil,
<del> problem: "Formula should have a desc" },
<del> { name: "bar", desc: "bar" * 30,
<del> problem: "Description is too long" },
<del> { name: "baz", desc: "Baz commandline tool",
<del> problem: "Description should use \"command-line\"" },
<del> { name: "qux", desc: "A tool called Qux",
<del> problem: "Description shouldn't start with an indefinite article" },
<del> ]
<del>
<del> formula_descriptions.each do |formula|
<del> content = <<-EOS.undent
<del> class #{Formulary.class_s(formula[:name])} < Formula
<del> url "http://example.com/#{formula[:name]}-1.0.tgz"
<del> desc "#{formula[:desc]}"
<del> end
<del> EOS
<del>
<del> fa = formula_auditor formula[:name], content, strict: true
<del> fa.audit_desc
<del> assert_match formula[:problem], fa.problems.first
<del> end
<del> end
<del>
<del> def test_audit_homepage
<del> fa = formula_auditor "foo", <<-EOS.undent, online: true
<del> class Foo < Formula
<del> homepage "ftp://example.com/foo"
<del> url "http://example.com/foo-1.0.tgz"
<del> end
<del> EOS
<del>
<del> fa.audit_homepage
<del> assert_equal ["The homepage should start with http or https (URL is #{fa.formula.homepage})."],
<del> fa.problems
<del>
<del> formula_homepages = {
<del> "bar" => "http://www.freedesktop.org/wiki/bar",
<del> "baz" => "http://www.freedesktop.org/wiki/Software/baz",
<del> "qux" => "https://code.google.com/p/qux",
<del> "quux" => "http://github.com/quux",
<del> "corge" => "http://savannah.nongnu.org/corge",
<del> "grault" => "http://grault.github.io/",
<del> "garply" => "http://www.gnome.org/garply",
<del> "sf1" => "http://foo.sourceforge.net/",
<del> "sf2" => "http://foo.sourceforge.net",
<del> "sf3" => "http://foo.sf.net/",
<del> "sf4" => "http://foo.sourceforge.io/",
<del> "waldo" => "http://www.gnu.org/waldo",
<del> }
<del>
<del> formula_homepages.each do |name, homepage|
<del> fa = formula_auditor name, <<-EOS.undent
<del> class #{Formulary.class_s(name)} < Formula
<del> homepage "#{homepage}"
<del> url "http://example.com/#{name}-1.0.tgz"
<del> end
<del> EOS
<del>
<del> fa.audit_homepage
<del> if homepage =~ %r{http:\/\/www\.freedesktop\.org}
<del> if homepage =~ /Software/
<del> assert_match "#{homepage} should be styled " \
<del> "`https://wiki.freedesktop.org/www/Software/project_name`",
<del> fa.problems.first
<del> else
<del> assert_match "#{homepage} should be styled " \
<del> "`https://wiki.freedesktop.org/project_name`",
<del> fa.problems.first
<del> end
<del> elsif homepage =~ %r{https:\/\/code\.google\.com}
<del> assert_match "#{homepage} should end with a slash", fa.problems.first
<del> elsif homepage =~ /foo\.(sf|sourceforge)\.net/
<del> assert_match "#{homepage} should be `https://foo.sourceforge.io/`", fa.problems.first
<del> else
<del> assert_match "Please use https:// for #{homepage}", fa.problems.first
<del> end
<del> end
<del> end
<del>
<del> def test_audit_without_homepage
<del> fa = formula_auditor "foo", <<-EOS.undent, online: true
<del> class Foo < Formula
<del> url "http://example.com/foo-1.0.tgz"
<del> end
<del> EOS
<del>
<del> fa.audit_homepage
<del> assert_match "Formula should have a homepage.", fa.problems.first
<del> end
<del>
<del> def test_audit_xcodebuild_suggests_symroot
<del> fa = formula_auditor "foo", <<-EOS.undent
<del> class Foo < Formula
<del> url "http://example.com/foo-1.0.tgz"
<del> homepage "http://example.com"
<del>
<del> def install
<del> xcodebuild "-project", "meow.xcodeproject"
<del> end
<del> end
<del> EOS
<del>
<del> fa.audit_text
<del>
<del> assert_match 'xcodebuild should be passed an explicit "SYMROOT"', fa.problems.first
<del> end
<del>
<del> def test_audit_bare_xcodebuild_suggests_symroot_also
<del> fa = formula_auditor "foo", <<-EOS.undent
<del> class Foo < Formula
<del> url "http://example.com/foo-1.0.tgz"
<del> homepage "http://example.com"
<del>
<del> def install
<del> xcodebuild
<del> end
<del> end
<del> EOS
<del>
<del> fa.audit_text
<del>
<del> assert_match 'xcodebuild should be passed an explicit "SYMROOT"', fa.problems.first
<del> end
<del>end
<ide><path>Library/Homebrew/test/dev-cmd/audit_spec.rb
<ide> class #{Formulary.class_s(name)} < Formula
<ide> expect(ft.without_patch).to eq("class End < Formula\n \nend")
<ide> end
<ide> end
<add>
<add>describe FormulaAuditor do
<add> def formula_auditor(name, text, options = {})
<add> path = Pathname.new "#{dir}/#{name}.rb"
<add> path.open("w") do |f|
<add> f.write text
<add> end
<add>
<add> described_class.new(Formulary.factory(path), options)
<add> end
<add>
<add> let(:dir) { @dir = Pathname.new(Dir.mktmpdir) }
<add>
<add> after(:each) do
<add> dir.rmtree unless @dir.nil?
<add> end
<add>
<add> describe "#problems" do
<add> it "is empty by default" do
<add> fa = formula_auditor "foo", <<-EOS.undent
<add> class Foo < Formula
<add> url "http://example.com/foo-1.0.tgz"
<add> end
<add> EOS
<add>
<add> expect(fa.problems).to be_empty
<add> end
<add> end
<add>
<add> describe "#audit_file" do
<add> specify "file permissions" do
<add> allow(File).to receive(:umask).and_return(022)
<add>
<add> fa = formula_auditor "foo", <<-EOS.undent
<add> class Foo < Formula
<add> url "http://example.com/foo-1.0.tgz"
<add> end
<add> EOS
<add>
<add> path = fa.formula.path
<add> path.chmod 0400
<add>
<add> fa.audit_file
<add> expect(fa.problems)
<add> .to eq(["Incorrect file permissions (400): chmod 644 #{path}"])
<add> end
<add>
<add> specify "DATA but no __END__" do
<add> fa = formula_auditor "foo", <<-EOS.undent
<add> class Foo < Formula
<add> url "http://example.com/foo-1.0.tgz"
<add> patch :DATA
<add> end
<add> EOS
<add>
<add> fa.audit_file
<add> expect(fa.problems).to eq(["'DATA' was found, but no '__END__'"])
<add> end
<add>
<add> specify "__END__ but no DATA" do
<add> fa = formula_auditor "foo", <<-EOS.undent
<add> class Foo < Formula
<add> url "http://example.com/foo-1.0.tgz"
<add> end
<add> __END__
<add> a patch goes here
<add> EOS
<add>
<add> fa.audit_file
<add> expect(fa.problems).to eq(["'__END__' was found, but 'DATA' is not used"])
<add> end
<add>
<add> specify "no trailing newline" do
<add> fa = formula_auditor "foo", 'class Foo<Formula; url "file:///foo-1.0.tgz";end'
<add>
<add> fa.audit_file
<add> expect(fa.problems).to eq(["File should end with a newline"])
<add> end
<add>
<add> specify "no issue" do
<add> fa = formula_auditor "foo", <<-EOS.undent
<add> class Foo < Formula
<add> url "http://example.com/foo-1.0.tgz"
<add> homepage "http://example.com"
<add> end
<add> EOS
<add>
<add> fa.audit_file
<add> expect(fa.problems).to eq([])
<add> end
<add>
<add> specify "strict: ordering issue" do
<add> fa = formula_auditor "foo", <<-EOS.undent, strict: true
<add> class Foo < Formula
<add> url "http://example.com/foo-1.0.tgz"
<add> homepage "http://example.com"
<add> end
<add> EOS
<add>
<add> fa.audit_file
<add> expect(fa.problems)
<add> .to eq(["`homepage` (line 3) should be put before `url` (line 2)"])
<add> end
<add>
<add> specify "strict: resource placement" do
<add> fa = formula_auditor "foo", <<-EOS.undent, strict: true
<add> class Foo < Formula
<add> url "https://example.com/foo-1.0.tgz"
<add>
<add> resource "foo2" do
<add> url "https://example.com/foo-2.0.tgz"
<add> end
<add>
<add> depends_on "openssl"
<add> end
<add> EOS
<add>
<add> fa.audit_file
<add> expect(fa.problems)
<add> .to eq(["`depends_on` (line 8) should be put before `resource` (line 4)"])
<add> end
<add>
<add> specify "strict: plist placement" do
<add> fa = formula_auditor "foo", <<-EOS.undent, strict: true
<add> class Foo < Formula
<add> url "https://example.com/foo-1.0.tgz"
<add>
<add> test do
<add> expect(shell_output("./dogs")).to match("Dogs are terrific")
<add> end
<add>
<add> def plist
<add> end
<add> end
<add> EOS
<add>
<add> fa.audit_file
<add> expect(fa.problems)
<add> .to eq(["`plist block` (line 8) should be put before `test block` (line 4)"])
<add> end
<add>
<add> specify "strict: url outside of stable block" do
<add> fa = formula_auditor "foo", <<-EOS.undent, strict: true
<add> class Foo < Formula
<add> url "http://example.com/foo-1.0.tgz"
<add> stable do
<add> # stuff
<add> end
<add> end
<add> EOS
<add>
<add> fa.audit_file
<add> expect(fa.problems).to eq(["`url` should be put inside `stable block`"])
<add> end
<add>
<add> specify "strict: head and head do" do
<add> fa = formula_auditor "foo", <<-EOS.undent, strict: true
<add> class Foo < Formula
<add> head "http://example.com/foo.git"
<add> head do
<add> # stuff
<add> end
<add> end
<add> EOS
<add>
<add> fa.audit_file
<add> expect(fa.problems).to eq(["Should not have both `head` and `head do`"])
<add> end
<add>
<add> specify "strict: bottle and bottle do" do
<add> fa = formula_auditor "foo", <<-EOS.undent, strict: true
<add> class Foo < Formula
<add> url "http://example.com/foo-1.0.tgz"
<add> bottle do
<add> # bottles go here
<add> end
<add> bottle :unneeded
<add> end
<add> EOS
<add>
<add> fa.audit_file
<add> expect(fa.problems)
<add> .to eq(["Should not have `bottle :unneeded/:disable` and `bottle do`"])
<add> end
<add> end
<add>
<add> describe "#audit_class" do
<add> specify "missing test" do
<add> fa = formula_auditor "foo", <<-EOS.undent
<add> class Foo < Formula
<add> url "http://example.com/foo-1.0.tgz"
<add> end
<add> EOS
<add>
<add> fa.audit_class
<add> expect(fa.problems).to eq([])
<add>
<add> fa = formula_auditor "foo", <<-EOS.undent, strict: true
<add> class Foo < Formula
<add> url "http://example.com/foo-1.0.tgz"
<add> end
<add> EOS
<add>
<add> fa.audit_class
<add> expect(fa.problems).to eq(["A `test do` test block should be added"])
<add> end
<add>
<add> specify "GithubGistFormula", :needs_compat do
<add> ENV.delete("HOMEBREW_DEVELOPER")
<add>
<add> fa = shutup do
<add> formula_auditor "foo", <<-EOS.undent
<add> class Foo < GithubGistFormula
<add> url "http://example.com/foo-1.0.tgz"
<add> end
<add> EOS
<add> end
<add>
<add> fa.audit_class
<add> expect(fa.problems)
<add> .to eq(["GithubGistFormula is deprecated, use Formula instead"])
<add> end
<add>
<add> specify "ScriptFileFormula", :needs_compat do
<add> ENV.delete("HOMEBREW_DEVELOPER")
<add>
<add> fa = formula_auditor "foo", <<-EOS.undent
<add> class Foo < ScriptFileFormula
<add> url "http://example.com/foo-1.0.tgz"
<add> end
<add> EOS
<add>
<add> fa.audit_class
<add> expect(fa.problems)
<add> .to eq(["ScriptFileFormula is deprecated, use Formula instead"])
<add> end
<add>
<add> specify "AmazonWebServicesFormula", :needs_compat do
<add> ENV.delete("HOMEBREW_DEVELOPER")
<add>
<add> fa = formula_auditor "foo", <<-EOS.undent
<add> class Foo < AmazonWebServicesFormula
<add> url "http://example.com/foo-1.0.tgz"
<add> end
<add> EOS
<add>
<add> fa.audit_class
<add> expect(fa.problems)
<add> .to eq(["AmazonWebServicesFormula is deprecated, use Formula instead"])
<add> end
<add> end
<add>
<add> describe "#audit_line" do
<add> specify "pkgshare" do
<add> fa = formula_auditor "foo", <<-EOS.undent, strict: true
<add> class Foo < Formula
<add> url "http://example.com/foo-1.0.tgz"
<add> end
<add> EOS
<add>
<add> fa.audit_line 'ohai "#{share}/foo"', 3
<add> expect(fa.problems.shift).to eq("Use \#{pkgshare} instead of \#{share}/foo")
<add>
<add> fa.audit_line 'ohai "#{share}/foo/bar"', 3
<add> expect(fa.problems.shift).to eq("Use \#{pkgshare} instead of \#{share}/foo")
<add>
<add> fa.audit_line 'ohai share/"foo"', 3
<add> expect(fa.problems.shift).to eq('Use pkgshare instead of (share/"foo")')
<add>
<add> fa.audit_line 'ohai share/"foo/bar"', 3
<add> expect(fa.problems.shift).to eq('Use pkgshare instead of (share/"foo")')
<add>
<add> fa.audit_line 'ohai "#{share}/foo-bar"', 3
<add> expect(fa.problems).to eq([])
<add>
<add> fa.audit_line 'ohai share/"foo-bar"', 3
<add> expect(fa.problems).to eq([])
<add>
<add> fa.audit_line 'ohai share/"bar"', 3
<add> expect(fa.problems).to eq([])
<add> end
<add>
<add> # Regression test for https://github.com/Homebrew/legacy-homebrew/pull/48744
<add> # Formulae with "++" in their name would break various audit regexps:
<add> # Error: nested *?+ in regexp: /^libxml++3\s/
<add> specify "++ in name" do
<add> fa = formula_auditor "foolibc++", <<-EOS.undent, strict: true
<add> class Foolibcxx < Formula
<add> desc "foolibc++ is a test"
<add> url "http://example.com/foo-1.0.tgz"
<add> end
<add> EOS
<add>
<add> fa.audit_desc
<add> expect(fa.problems.shift)
<add> .to eq("Description shouldn't include the formula name")
<add>
<add> fa.audit_line 'ohai "#{share}/foolibc++"', 3
<add> expect(fa.problems.shift)
<add> .to eq("Use \#{pkgshare} instead of \#{share}/foolibc++")
<add>
<add> fa.audit_line 'ohai share/"foolibc++"', 3
<add> expect(fa.problems.shift)
<add> .to eq('Use pkgshare instead of (share/"foolibc++")')
<add> end
<add>
<add> specify "no space in class inheritance" do
<add> fa = formula_auditor "foo", <<-EOS.undent
<add> class Foo<Formula
<add> url '/foo-1.0.tgz'
<add> end
<add> EOS
<add>
<add> fa.audit_line "class Foo<Formula", 1
<add> expect(fa.problems.shift)
<add> .to eq("Use a space in class inheritance: class Foo < Formula")
<add> end
<add>
<add> specify "default template" do
<add> fa = formula_auditor "foo", "class Foo < Formula; url '/foo-1.0.tgz'; end"
<add>
<add> fa.audit_line '# system "cmake", ".", *std_cmake_args', 3
<add> expect(fa.problems.shift).to eq("Commented cmake call found")
<add>
<add> fa.audit_line "# PLEASE REMOVE", 3
<add> expect(fa.problems.shift).to eq("Please remove default template comments")
<add> end
<add> end
<add>
<add> describe "#audit_github_repository" do
<add> specify "#audit_github_repository when HOMEBREW_NO_GITHUB_API is set" do
<add> ENV["HOMEBREW_NO_GITHUB_API"] = "1"
<add>
<add> fa = formula_auditor "foo", <<-EOS.undent, strict: true, online: true
<add> class Foo < Formula
<add> homepage "https://github.com/example/example"
<add> url "http://example.com/foo-1.0.tgz"
<add> end
<add> EOS
<add>
<add> fa.audit_github_repository
<add> expect(fa.problems).to eq([])
<add> end
<add> end
<add>
<add> specify "#audit_caveats" do
<add> fa = formula_auditor "foo", <<-EOS.undent
<add> class Foo < Formula
<add> homepage "http://example.com/foo"
<add> url "http://example.com/foo-1.0.tgz"
<add>
<add> def caveats
<add> "setuid"
<add> end
<add> end
<add> EOS
<add>
<add> fa.audit_caveats
<add> expect(fa.problems)
<add> .to eq(["Don't recommend setuid in the caveats, suggest sudo instead."])
<add> end
<add>
<add> specify "#audit_desc" do
<add> formula_descriptions = [
<add> { name: "foo", desc: nil,
<add> problem: "Formula should have a desc" },
<add> { name: "bar", desc: "bar" * 30,
<add> problem: "Description is too long" },
<add> { name: "baz", desc: "Baz commandline tool",
<add> problem: "Description should use \"command-line\"" },
<add> { name: "qux", desc: "A tool called Qux",
<add> problem: "Description shouldn't start with an indefinite article" },
<add> ]
<add>
<add> formula_descriptions.each do |formula|
<add> content = <<-EOS.undent
<add> class #{Formulary.class_s(formula[:name])} < Formula
<add> url "http://example.com/#{formula[:name]}-1.0.tgz"
<add> desc "#{formula[:desc]}"
<add> end
<add> EOS
<add>
<add> fa = formula_auditor formula[:name], content, strict: true
<add> fa.audit_desc
<add> expect(fa.problems.first).to match(formula[:problem])
<add> end
<add> end
<add>
<add> describe "#audit_homepage" do
<add> specify "homepage URLs" do
<add> fa = formula_auditor "foo", <<-EOS.undent, online: true
<add> class Foo < Formula
<add> homepage "ftp://example.com/foo"
<add> url "http://example.com/foo-1.0.tgz"
<add> end
<add> EOS
<add>
<add> fa.audit_homepage
<add> expect(fa.problems)
<add> .to eq(["The homepage should start with http or https (URL is #{fa.formula.homepage})."])
<add>
<add> formula_homepages = {
<add> "bar" => "http://www.freedesktop.org/wiki/bar",
<add> "baz" => "http://www.freedesktop.org/wiki/Software/baz",
<add> "qux" => "https://code.google.com/p/qux",
<add> "quux" => "http://github.com/quux",
<add> "corge" => "http://savannah.nongnu.org/corge",
<add> "grault" => "http://grault.github.io/",
<add> "garply" => "http://www.gnome.org/garply",
<add> "sf1" => "http://foo.sourceforge.net/",
<add> "sf2" => "http://foo.sourceforge.net",
<add> "sf3" => "http://foo.sf.net/",
<add> "sf4" => "http://foo.sourceforge.io/",
<add> "waldo" => "http://www.gnu.org/waldo",
<add> }
<add>
<add> formula_homepages.each do |name, homepage|
<add> fa = formula_auditor name, <<-EOS.undent
<add> class #{Formulary.class_s(name)} < Formula
<add> homepage "#{homepage}"
<add> url "http://example.com/#{name}-1.0.tgz"
<add> end
<add> EOS
<add>
<add> fa.audit_homepage
<add> if homepage =~ %r{http:\/\/www\.freedesktop\.org}
<add> if homepage =~ /Software/
<add> expect(fa.problems.first).to match(
<add> "#{homepage} should be styled " \
<add> "`https://wiki.freedesktop.org/www/Software/project_name`",
<add> )
<add> else
<add> expect(fa.problems.first).to match(
<add> "#{homepage} should be styled " \
<add> "`https://wiki.freedesktop.org/project_name`",
<add> )
<add> end
<add> elsif homepage =~ %r{https:\/\/code\.google\.com}
<add> expect(fa.problems.first)
<add> .to match("#{homepage} should end with a slash")
<add> elsif homepage =~ /foo\.(sf|sourceforge)\.net/
<add> expect(fa.problems.first)
<add> .to match("#{homepage} should be `https://foo.sourceforge.io/`")
<add> else
<add> expect(fa.problems.first)
<add> .to match("Please use https:// for #{homepage}")
<add> end
<add> end
<add> end
<add>
<add> specify "missing homepage" do
<add> fa = formula_auditor "foo", <<-EOS.undent, online: true
<add> class Foo < Formula
<add> url "http://example.com/foo-1.0.tgz"
<add> end
<add> EOS
<add>
<add> fa.audit_homepage
<add> expect(fa.problems.first).to match("Formula should have a homepage.")
<add> end
<add> end
<add>
<add> describe "#audit_text" do
<add> specify "xcodebuild suggests symroot" do
<add> fa = formula_auditor "foo", <<-EOS.undent
<add> class Foo < Formula
<add> url "http://example.com/foo-1.0.tgz"
<add> homepage "http://example.com"
<add>
<add> def install
<add> xcodebuild "-project", "meow.xcodeproject"
<add> end
<add> end
<add> EOS
<add>
<add> fa.audit_text
<add> expect(fa.problems.first)
<add> .to match('xcodebuild should be passed an explicit "SYMROOT"')
<add> end
<add>
<add> specify "bare xcodebuild also suggests symroot" do
<add> fa = formula_auditor "foo", <<-EOS.undent
<add> class Foo < Formula
<add> url "http://example.com/foo-1.0.tgz"
<add> homepage "http://example.com"
<add>
<add> def install
<add> xcodebuild
<add> end
<add> end
<add> EOS
<add>
<add> fa.audit_text
<add> expect(fa.problems.first)
<add> .to match('xcodebuild should be passed an explicit "SYMROOT"')
<add> end
<add> end
<add>end
<ide><path>Library/Homebrew/test/spec_helper.rb
<ide> config.include(Test::Helper::Fixtures)
<ide> config.include(Test::Helper::Formula)
<ide>
<add> config.before(:each, :needs_compat) do
<add> skip "Requires compatibility layer." if ENV["HOMEBREW_NO_COMPAT"]
<add> end
<add>
<ide> config.before(:each, :needs_official_cmd_taps) do
<ide> skip "Needs official command Taps." unless ENV["HOMEBREW_TEST_OFFICIAL_CMD_TAPS"]
<ide> end | 3 |
PHP | PHP | add a compileforeign method to postgresgrammar.php | 6981580ef2555fbd593b1eb7aa1b765cfde122e7 | <ide><path>src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php
<ide> protected function modifyIncrement(Blueprint $blueprint, Fluent $column)
<ide> return ' primary key';
<ide> }
<ide> }
<add>
<add> /**
<add> * Compile a foreign key command.
<add> *
<add> * @param \Illuminate\Database\Schema\Blueprint $blueprint
<add> * @param \Illuminate\Support\Fluent $command
<add> * @return string
<add> */
<add> public function compileForeign(Blueprint $blueprint, Fluent $command)
<add> {
<add> // The \Illuminate\Database\Schema\Grammars\Grammar method compiles the classical statement
<add> $sql = parent::compileForeign($blueprint, $command);
<add>
<add> // Here we add the Postgres specific "deferrable" part
<add> if(! is_null($command->deferrable)) {
<add> $sql .= " {$command->deferrable}";
<add> }
<add>
<add> return $sql;
<add> }
<add>
<ide> } | 1 |
Ruby | Ruby | pass invalid option names to formula installer | 6594650eb1c37170e7d70e7e9c75b48d154e38a9 | <ide><path>Library/Homebrew/cmd/reinstall.rb
<ide> def reinstall_formula(f)
<ide> backup keg
<ide> end
<ide>
<del> options = BuildOptions.new(Options.create(ARGV.flags_only), f.options).used_options
<add> build_options = BuildOptions.new(Options.create(ARGV.flags_only), f.options)
<add> options = build_options.used_options
<ide> options |= f.build.used_options
<ide> options &= f.options
<ide>
<ide> fi = FormulaInstaller.new(f)
<del> fi.options = options
<del> fi.build_bottle = ARGV.build_bottle? || (!f.bottled? && f.build.build_bottle?)
<del> fi.build_from_source = ARGV.build_from_source? || ARGV.build_all_from_source?
<del> fi.force_bottle = ARGV.force_bottle?
<del> fi.interactive = ARGV.interactive?
<del> fi.git = ARGV.git?
<del> fi.verbose = ARGV.verbose?
<del> fi.debug = ARGV.debug?
<add> fi.options = options
<add> fi.invalid_option_names = build_options.invalid_option_names
<add> fi.build_bottle = ARGV.build_bottle? || (!f.bottled? && f.build.build_bottle?)
<add> fi.build_from_source = ARGV.build_from_source? || ARGV.build_all_from_source?
<add> fi.force_bottle = ARGV.force_bottle?
<add> fi.interactive = ARGV.interactive?
<add> fi.git = ARGV.git?
<add> fi.verbose = ARGV.verbose?
<add> fi.debug = ARGV.debug?
<ide> fi.prelude
<ide>
<ide> oh1 "Reinstalling #{f.full_name} #{options.to_a.join " "}" | 1 |
Javascript | Javascript | remove ie9 custom launcher | 0bb9aaf72643de7b44a25780ca723007f6251d32 | <ide><path>karma.conf.js
<ide> module.exports = function(config) {
<ide>
<ide> // IE
<ide> if (runAll || process.env.SAUCE_IE) {
<del> // customLaunchers.SL_IE8 = createCustomLauncher('internet explorer', 8, 'Windows 7');
<del> customLaunchers.SL_IE9 = createCustomLauncher('internet explorer', 9, 'Windows 2008');
<ide> customLaunchers.SL_IE10 = createCustomLauncher('internet explorer', 10, 'Windows 2012');
<ide> customLaunchers.SL_IE11 = createCustomLauncher('internet explorer', 11, 'Windows 8.1');
<ide> } | 1 |
Ruby | Ruby | exclude draft pr | 5607e4a947cc8bc81c2bf05009658d14e67dcd39 | <ide><path>Library/Homebrew/dev-cmd/pr-automerge.rb
<ide> def pr_automerge
<ide> without_labels = args.without_labels || ["do not merge", "new formula", "automerge-skip", "linux-only"]
<ide> tap = Tap.fetch(args.tap || CoreTap.instance.name)
<ide>
<del> query = "is:pr is:open repo:#{tap.full_name}"
<add> query = "is:pr is:open repo:#{tap.full_name} draft:false"
<ide> query += args.ignore_failures? ? " -status:pending" : " status:success"
<ide> query += " review:approved" unless args.without_approval?
<ide> query += " label:\"#{args.with_label}\"" if args.with_label | 1 |
Javascript | Javascript | add missing word to comment | 6ad7ab5a6ffa4c1f4c6db798ba0f9cf72deebfc3 | <ide><path>src/lib/duration/constructor.js
<ide> export function Duration (duration) {
<ide> // day when working around DST, we need to store them separately
<ide> this._days = +days +
<ide> weeks * 7;
<del> // It is impossible translate months into days without knowing
<add> // It is impossible to translate months into days without knowing
<ide> // which months you are are talking about, so we have to store
<ide> // it separately.
<ide> this._months = +months + | 1 |
Ruby | Ruby | fix spelling in api docs | d5f0bb38f6364f45fd4810faf58cc66ff8ff2d73 | <ide><path>actionview/lib/action_view/helpers/cache_helper.rb
<ide> module CacheHelper
<ide> #
<ide> # === Explicit dependencies
<ide> #
<del> # Some times you'll have template dependencies that can't be derived at all. This is typically
<add> # Sometimes you'll have template dependencies that can't be derived at all. This is typically
<ide> # the case when you have template rendering that happens in helpers. Here's an example:
<ide> #
<ide> # <%= render_sortable_todolists @project.todolists %>
<ide><path>activerecord/lib/active_record/fixtures.rb
<ide> class FixtureClassNotFound < ActiveRecord::ActiveRecordError #:nodoc:
<ide> # assert_equal "Ruby on Rails", @rubyonrails.name
<ide> # end
<ide> #
<del> # In order to use these methods to access fixtured data within your testcases, you must specify one of the
<add> # In order to use these methods to access fixtured data within your test cases, you must specify one of the
<ide> # following in your ActiveSupport::TestCase-derived class:
<ide> #
<ide> # - to fully enable instantiated fixtures (enable alternate methods #1 and #2 above)
<ide> class FixtureClassNotFound < ActiveRecord::ActiveRecordError #:nodoc:
<ide> #
<ide> # = Dynamic fixtures with ERB
<ide> #
<del> # Some times you don't care about the content of the fixtures as much as you care about the volume.
<add> # Sometimes you don't care about the content of the fixtures as much as you care about the volume.
<ide> # In these cases, you can mix ERB in with your YAML fixtures to create a bunch of fixtures for load
<ide> # testing, like:
<ide> # | 2 |
Javascript | Javascript | use local config reference in texteditorregistry | d70c8d029bb51f5f8d237856b9baa75ffa80c415 | <ide><path>src/text-editor-registry.js
<ide> export default class TextEditorRegistry {
<ide>
<ide> const configOptions = {scope: editor.getRootScopeDescriptor()}
<ide> for (const [settingKey, setterName] of EDITOR_SETTER_NAMES_BY_SETTING_KEY) {
<del> editor[setterName](atom.config.get(settingKey, configOptions))
<add> editor[setterName](this.config.get(settingKey, configOptions))
<ide> }
<ide>
<ide> const updateTabTypes = () => {
<ide> editor.setSoftTabs(shouldEditorUseSoftTabs(
<ide> editor,
<del> atom.config.get('editor.tabType', configOptions),
<del> atom.config.get('editor.softTabs', configOptions)
<add> this.config.get('editor.tabType', configOptions),
<add> this.config.get('editor.softTabs', configOptions)
<ide> ))
<ide> }
<ide> | 1 |
Python | Python | allow setting of load balancer listener ip | 2d9f438808c102c8c3315db8cca44a48b36321e0 | <ide><path>libcloud/loadbalancer/drivers/dimensiondata.py
<ide> def _ex_connection_class_kwargs(self):
<ide> return kwargs
<ide>
<ide> def create_balancer(self, name, port=None, protocol=None,
<del> algorithm=None, members=None):
<add> algorithm=None, members=None,
<add> ex_listener_ip_address=None):
<ide> """
<ide> Create a new load balancer instance
<ide>
<ide> def create_balancer(self, name, port=None, protocol=None,
<ide> :param algorithm: Load balancing algorithm, defaults to ROUND_ROBIN.
<ide> :type algorithm: :class:`.Algorithm`
<ide>
<add> :param ex_listener_ip_address: Must be a valid IPv4 in dot-decimal
<add> notation (x.x.x.x).
<add> :type ex_listener_ip_address: ``str``
<add>
<ide> :rtype: :class:`LoadBalancer`
<ide> """
<ide> network_domain_id = self.network_domain_id
<ide> def create_balancer(self, name, port=None, protocol=None,
<ide> name=name,
<ide> ex_description=name,
<ide> port=port,
<del> pool=pool)
<add> pool=pool,
<add> listener_ip_address=ex_listener_ip_address)
<ide>
<ide> return LoadBalancer(
<ide> id=listener.id,
<ide> def create_balancer(self, name, port=None, protocol=None,
<ide> port=port,
<ide> driver=self,
<ide> extra={'pool_id': pool.id,
<del> 'network_domain_id': network_domain_id}
<add> 'network_domain_id': network_domain_id,
<add> 'listener_ip_address': ex_listener_ip_address}
<ide> )
<ide>
<ide> def list_balancers(self):
<ide><path>libcloud/test/loadbalancer/test_dimensiondata.py
<ide> def test_create_balancer(self):
<ide> port=80,
<ide> protocol='http',
<ide> algorithm=Algorithm.ROUND_ROBIN,
<del> members=members)
<add> members=members,
<add> ex_listener_ip_address='5.6.7.8')
<ide> self.assertEqual(balancer.name, 'test')
<ide> self.assertEqual(balancer.id, '8334f461-0df0-42d5-97eb-f4678eb26bea')
<ide> self.assertEqual(balancer.ip, '165.180.12.22')
<ide> self.assertEqual(balancer.port, 80)
<ide> self.assertEqual(balancer.extra['pool_id'], '9e6b496d-5261-4542-91aa-b50c7f569c54')
<ide> self.assertEqual(balancer.extra['network_domain_id'], '1234')
<add> self.assertEqual(balancer.extra['listener_ip_address'], '5.6.7.8')
<ide>
<ide> def test_create_balancer_with_defaults(self):
<ide> self.driver.ex_set_current_network_domain('1234') | 2 |
PHP | PHP | add method to ensure a directory exists | 8a8eed4d157102ef77527891ac1d8f8e85e7afee | <ide><path>src/Illuminate/Filesystem/Filesystem.php
<ide> public function directories($directory)
<ide> return $directories;
<ide> }
<ide>
<add> /**
<add> * Ensure a directory exists.
<add> *
<add> * @param string $path
<add> * @param int $mode
<add> * @param bool $recursive
<add> * @return void
<add> */
<add> public function ensureDirectoryExists($path, $mode = 0755, $recursive = true)
<add> {
<add> if (! $this->isDirectory($path)) {
<add> $this->makeDirectory($path, $mode, $recursive);
<add> }
<add> }
<add>
<ide> /**
<ide> * Create a directory.
<ide> * | 1 |
PHP | PHP | pass the context into widget rendering | 9c960fa9945953cbcf12f2b46955f255140f4143 | <ide><path>src/View/Helper/FormHelper.php
<ide> public function widget($name, array $data = []) {
<ide> }
<ide> unset($data['secure']);
<ide>
<del> return $widget->render($data);
<add> return $widget->render($data, $this->context());
<ide> }
<ide>
<ide> /** | 1 |
Text | Text | add v3.20.0-beta.2 to changelog | 7676db612c554ce49b1c6917762e0242e6c5d802 | <ide><path>CHANGELOG.md
<ide> # Ember Changelog
<ide>
<add>### v3.20.0-beta.2 (June 2, 2020)
<add>
<add>- [#18997](https://github.com/emberjs/ember.js/pull/18997) [BUGFIX] Fix components `<Input>` and `<Textarea>` to work with native class actions correctly.
<add>
<ide> ### v3.20.0-beta.1 (May 26, 2020)
<ide>
<ide> - [#18926](https://github.com/emberjs/ember.js/pull/18926) / [#18852](https://github.com/emberjs/ember.js/pull/18852) [FEATURE] Implement the [Yieldable Named Blocks](https://github.com/emberjs/rfcs/blob/master/text/0460-yieldable-named-blocks.md) RFC. | 1 |
Mixed | Go | add a short flag for docker stack deploy | f1dd721b6978f1c24bb2761b88c83d9e385bd781 | <ide><path>cli/command/stack/opts.go
<ide> import (
<ide> )
<ide>
<ide> func addComposefileFlag(opt *string, flags *pflag.FlagSet) {
<del> flags.StringVar(opt, "compose-file", "", "Path to a Compose file")
<add> flags.StringVarP(opt, "compose-file", "c", "", "Path to a Compose file")
<ide> }
<ide>
<ide> func addBundlefileFlag(opt *string, flags *pflag.FlagSet) {
<ide><path>docs/reference/commandline/stack_deploy.md
<ide> Aliases:
<ide>
<ide> Options:
<ide> --bundle-file string Path to a Distributed Application Bundle file
<del> --compose-file string Path to a Compose file
<add> -c, --compose-file string Path to a Compose file
<ide> --help Print usage
<ide> --with-registry-auth Send registry authentication details to Swarm agents
<ide> ``` | 2 |
PHP | PHP | fix doc block | 4bb96d1f8a415023632064e9ec114ed32fe2ae0d | <ide><path>src/Illuminate/Http/Concerns/InteractsWithInput.php
<ide> public function filled($key)
<ide> return true;
<ide> }
<ide>
<del> /**
<add> /**
<ide> * Determine if the request contains a non-empty value for any of the given inputs.
<ide> *
<ide> * @param string|array $keys | 1 |
Ruby | Ruby | copy new subject when bumping | 2320c0a6c1130dd24d7f73c073c66ad798caa8b0 | <ide><path>Library/Homebrew/cmd/pull.rb
<ide> def pull
<ide> f = changed_formulae.first
<ide> subject = "#{f.name} #{f.version}"
<ide> ohai "New bump commit subject: #{subject}"
<add> system "/bin/echo -n #{subject} | pbcopy"
<ide> message = "#{subject}\n\n#{message}"
<ide> end
<ide> | 1 |
Ruby | Ruby | convert env test to spec | 890631dc29cbf0035566d5c5d1e74ddf43684bc2 | <ide><path>Library/Homebrew/test/ARGV_spec.rb
<ide> require "extend/ARGV"
<ide>
<ide> describe HomebrewArgvExtension do
<del> subject { argv.extend(HomebrewArgvExtension) }
<add> subject { argv.extend(described_class) }
<ide> let(:argv) { ["mxcl"] }
<ide>
<ide> describe "#formulae" do
<ide><path>Library/Homebrew/test/ENV_spec.rb
<add>require "extend/ENV"
<add>
<add>shared_examples EnvActivation do
<add> subject { env.extend(described_class) }
<add> let(:env) { {}.extend(EnvActivation) }
<add>
<add> it "supports switching compilers" do
<add> subject.clang
<add> expect(subject["LD"]).to be nil
<add> expect(subject["CC"]).to eq(subject["OBJC"])
<add> end
<add>
<add> describe "#with_build_environment" do
<add> it "restores the environment" do
<add> before = subject.dup
<add>
<add> subject.with_build_environment do
<add> subject["foo"] = "bar"
<add> end
<add>
<add> expect(subject["foo"]).to be nil
<add> expect(subject).to eq(before)
<add> end
<add>
<add> it "ensures the environment is restored" do
<add> before = subject.dup
<add>
<add> expect {
<add> subject.with_build_environment do
<add> subject["foo"] = "bar"
<add> raise StandardError
<add> end
<add> }.to raise_error(StandardError)
<add>
<add> expect(subject["foo"]).to be nil
<add> expect(subject).to eq(before)
<add> end
<add>
<add> it "returns the value of the block" do
<add> expect(subject.with_build_environment { 1 }).to eq(1)
<add> end
<add>
<add> it "does not mutate the interface" do
<add> expected = subject.methods
<add>
<add> subject.with_build_environment do
<add> expect(subject.methods).to eq(expected)
<add> end
<add>
<add> expect(subject.methods).to eq(expected)
<add> end
<add> end
<add>
<add> describe "#append" do
<add> it "appends to an existing key" do
<add> subject["foo"] = "bar"
<add> subject.append "foo", "1"
<add> expect(subject["foo"]).to eq("bar 1")
<add> end
<add>
<add> it "appends to an existing empty key" do
<add> subject["foo"] = ""
<add> subject.append "foo", "1"
<add> expect(subject["foo"]).to eq("1")
<add> end
<add>
<add> it "appends to a non-existant key" do
<add> subject.append "foo", "1"
<add> expect(subject["foo"]).to eq("1")
<add> end
<add>
<add> # NOTE: this may be a wrong behavior; we should probably reject objects that
<add> # do not respond to #to_str. For now this documents existing behavior.
<add> it "coerces a value to a string" do
<add> subject.append "foo", 42
<add> expect(subject["foo"]).to eq("42")
<add> end
<add> end
<add>
<add> describe "#prepend" do
<add> it "prepends to an existing key" do
<add> subject["foo"] = "bar"
<add> subject.prepend "foo", "1"
<add> expect(subject["foo"]).to eq("1 bar")
<add> end
<add>
<add> it "prepends to an existing empty key" do
<add> subject["foo"] = ""
<add> subject.prepend "foo", "1"
<add> expect(subject["foo"]).to eq("1")
<add> end
<add>
<add> it "prepends to a non-existant key" do
<add> subject.prepend "foo", "1"
<add> expect(subject["foo"]).to eq("1")
<add> end
<add>
<add> # NOTE: this may be a wrong behavior; we should probably reject objects that
<add> # do not respond to #to_str. For now this documents existing behavior.
<add> it "coerces a value to a string" do
<add> subject.prepend "foo", 42
<add> expect(subject["foo"]).to eq("42")
<add> end
<add> end
<add>
<add> describe "#append_path" do
<add> it "appends to a path" do
<add> subject.append_path "FOO", "/usr/bin"
<add> expect(subject["FOO"]).to eq("/usr/bin")
<add>
<add> subject.append_path "FOO", "/bin"
<add> expect(subject["FOO"]).to eq("/usr/bin#{File::PATH_SEPARATOR}/bin")
<add> end
<add> end
<add>
<add> describe "#prepend_path" do
<add> it "prepends to a path" do
<add> subject.prepend_path "FOO", "/usr/bin"
<add> expect(subject["FOO"]).to eq("/usr/bin")
<add>
<add> subject.prepend_path "FOO", "/bin"
<add> expect(subject["FOO"]).to eq("/bin#{File::PATH_SEPARATOR}/usr/bin")
<add> end
<add> end
<add>
<add> describe "#compiler" do
<add> it "allows switching compilers" do
<add> [:clang, :gcc_4_2, :gcc_4_0].each do |compiler|
<add> subject.public_send(compiler)
<add> expect(subject.compiler).to eq(compiler)
<add> end
<add> end
<add> end
<add>
<add> example "deparallelize_block_form_restores_makeflags" do
<add> subject["MAKEFLAGS"] = "-j4"
<add>
<add> subject.deparallelize do
<add> expect(subject["MAKEFLAGS"]).to be nil
<add> end
<add>
<add> expect(subject["MAKEFLAGS"]).to eq("-j4")
<add> end
<add>end
<add>
<add>describe Stdenv do
<add> include_examples EnvActivation
<add>end
<add>
<add>describe Superenv do
<add> include_examples EnvActivation
<add>
<add> it "initializes deps" do
<add> expect(subject.deps).to eq([])
<add> expect(subject.keg_only_deps).to eq([])
<add> end
<add>
<add> describe "#cxx11" do
<add> it "raises an error when the compiler isn't supported" do
<add> %w[gcc gcc-4.7].each do |compiler|
<add> subject["HOMEBREW_CC"] = compiler
<add>
<add> expect { subject.cxx11 }
<add> .to raise_error(/The selected compiler doesn't support C\+\+11:/)
<add>
<add> expect(subject["HOMEBREW_CCCFG"]).to be nil
<add> end
<add> end
<add>
<add> it "supports gcc-5" do
<add> subject["HOMEBREW_CC"] = "gcc-5"
<add> subject.cxx11
<add> expect(subject["HOMEBREW_CCCFG"]).to include("x")
<add> end
<add>
<add> example "supports gcc-6" do
<add> subject["HOMEBREW_CC"] = "gcc-6"
<add> subject.cxx11
<add> expect(subject["HOMEBREW_CCCFG"]).to include("x")
<add> end
<add>
<add> it "supports clang" do
<add> subject["HOMEBREW_CC"] = "clang"
<add> subject.cxx11
<add> expect(subject["HOMEBREW_CCCFG"]).to include("x")
<add> expect(subject["HOMEBREW_CCCFG"]).to include("g")
<add> end
<add> end
<add>end
<ide><path>Library/Homebrew/test/ENV_test.rb
<del>require "testing_env"
<del>require "extend/ENV"
<del>require "testing_env"
<del>
<del>module SharedEnvTests
<del> def setup
<del> super
<del> @env = {}.extend(EnvActivation)
<del> end
<del>
<del> def test_switching_compilers
<del> @env.clang
<del> assert_nil @env["LD"]
<del> assert_equal @env["OBJC"], @env["CC"]
<del> end
<del>
<del> def test_with_build_environment_restores_env
<del> before = @env.dup
<del> @env.with_build_environment do
<del> @env["foo"] = "bar"
<del> end
<del> assert_nil @env["foo"]
<del> assert_equal before, @env
<del> end
<del>
<del> def test_with_build_environment_ensures_env_restored
<del> before = @env.dup
<del> begin
<del> @env.with_build_environment do
<del> @env["foo"] = "bar"
<del> raise Exception
<del> end
<del> rescue Exception
<del> end
<del> assert_nil @env["foo"]
<del> assert_equal before, @env
<del> end
<del>
<del> def test_with_build_environment_returns_block_value
<del> assert_equal 1, @env.with_build_environment { 1 }
<del> end
<del>
<del> def test_with_build_environment_does_not_mutate_interface
<del> expected = @env.methods
<del> @env.with_build_environment { assert_equal expected, @env.methods }
<del> assert_equal expected, @env.methods
<del> end
<del>
<del> def test_append_existing_key
<del> @env["foo"] = "bar"
<del> @env.append "foo", "1"
<del> assert_equal "bar 1", @env["foo"]
<del> end
<del>
<del> def test_append_existing_key_empty
<del> @env["foo"] = ""
<del> @env.append "foo", "1"
<del> assert_equal "1", @env["foo"]
<del> end
<del>
<del> def test_append_missing_key
<del> @env.append "foo", "1"
<del> assert_equal "1", @env["foo"]
<del> end
<del>
<del> def test_prepend_existing_key
<del> @env["foo"] = "bar"
<del> @env.prepend "foo", "1"
<del> assert_equal "1 bar", @env["foo"]
<del> end
<del>
<del> def test_prepend_existing_key_empty
<del> @env["foo"] = ""
<del> @env.prepend "foo", "1"
<del> assert_equal "1", @env["foo"]
<del> end
<del>
<del> def test_prepend_missing_key
<del> @env.prepend "foo", "1"
<del> assert_equal "1", @env["foo"]
<del> end
<del>
<del> # NOTE: this may be a wrong behavior; we should probably reject objects that
<del> # do not respond to #to_str. For now this documents existing behavior.
<del> def test_append_coerces_value_to_string
<del> @env.append "foo", 42
<del> assert_equal "42", @env["foo"]
<del> end
<del>
<del> def test_prepend_coerces_value_to_string
<del> @env.prepend "foo", 42
<del> assert_equal "42", @env["foo"]
<del> end
<del>
<del> def test_append_path
<del> @env.append_path "FOO", "/usr/bin"
<del> assert_equal "/usr/bin", @env["FOO"]
<del> @env.append_path "FOO", "/bin"
<del> assert_equal "/usr/bin#{File::PATH_SEPARATOR}/bin", @env["FOO"]
<del> end
<del>
<del> def test_prepend_path
<del> @env.prepend_path "FOO", "/usr/bin"
<del> assert_equal "/usr/bin", @env["FOO"]
<del> @env.prepend_path "FOO", "/bin"
<del> assert_equal "/bin#{File::PATH_SEPARATOR}/usr/bin", @env["FOO"]
<del> end
<del>
<del> def test_switching_compilers_updates_compiler
<del> [:clang, :gcc_4_2, :gcc_4_0].each do |compiler|
<del> @env.send(compiler)
<del> assert_equal compiler, @env.compiler
<del> end
<del> end
<del>
<del> def test_deparallelize_block_form_restores_makeflags
<del> @env["MAKEFLAGS"] = "-j4"
<del> @env.deparallelize do
<del> assert_nil @env["MAKEFLAGS"]
<del> end
<del> assert_equal "-j4", @env["MAKEFLAGS"]
<del> end
<del>end
<del>
<del>class StdenvTests < Homebrew::TestCase
<del> include SharedEnvTests
<del>
<del> def setup
<del> super
<del> @env.extend(Stdenv)
<del> end
<del>end
<del>
<del>class SuperenvTests < Homebrew::TestCase
<del> include SharedEnvTests
<del>
<del> def setup
<del> super
<del> @env.extend(Superenv)
<del> end
<del>
<del> def test_initializes_deps
<del> assert_equal [], @env.deps
<del> assert_equal [], @env.keg_only_deps
<del> end
<del>
<del> def test_unsupported_cxx11
<del> %w[gcc gcc-4.7].each do |compiler|
<del> @env["HOMEBREW_CC"] = compiler
<del> assert_raises do
<del> @env.cxx11
<del> end
<del> refute_match "x", @env["HOMEBREW_CCCFG"]
<del> end
<del> end
<del>
<del> def test_supported_cxx11_gcc_5
<del> @env["HOMEBREW_CC"] = "gcc-5"
<del> @env.cxx11
<del> assert_match "x", @env["HOMEBREW_CCCFG"]
<del> end
<del>
<del> def test_supported_cxx11_gcc_6
<del> @env["HOMEBREW_CC"] = "gcc-6"
<del> @env.cxx11
<del> assert_match "x", @env["HOMEBREW_CCCFG"]
<del> end
<del>
<del> def test_supported_cxx11_clang
<del> @env["HOMEBREW_CC"] = "clang"
<del> @env.cxx11
<del> assert_match "x", @env["HOMEBREW_CCCFG"]
<del> assert_match "g", @env["HOMEBREW_CCCFG"]
<del> end
<del>end | 3 |
Python | Python | add docstrings to merge layers | b257dad10c0a5441c8638142b7de4c26fc76b69f | <ide><path>keras/layers/merge.py
<ide>
<ide>
<ide> class _Merge(Layer):
<del> """TODO
<add> """Generic merge layer for elementwise merge functions.
<add>
<add> Used to implement `Sum`, `Average`, etc.
<add>
<add> # Arguments
<add> **kwargs: standard layer keyword arguments.
<ide> """
<ide>
<ide> def __init__(self, **kwargs):
<ide> def compute_mask(self, inputs, mask=None):
<ide>
<ide>
<ide> class Sum(_Merge):
<del> """TODO
<add> """Layer that sums a list of inputs.
<add>
<add> It takes as input a list of tensors,
<add> all of the same shape, and returns
<add> a single tensor (also of the same shape).
<ide> """
<ide>
<ide> def _merge_function(self, inputs):
<ide> def _merge_function(self, inputs):
<ide>
<ide>
<ide> class Multiply(_Merge):
<del> """TODO
<add> """Layer that multiplies (element-wise) a list of inputs.
<add>
<add> It takes as input a list of tensors,
<add> all of the same shape, and returns
<add> a single tensor (also of the same shape).
<ide> """
<ide>
<ide> def _merge_function(self, inputs):
<ide> def _merge_function(self, inputs):
<ide>
<ide>
<ide> class Average(_Merge):
<del> """TODO
<add> """Layer that averages a list of inputs.
<add>
<add> It takes as input a list of tensors,
<add> all of the same shape, and returns
<add> a single tensor (also of the same shape).
<ide> """
<ide>
<ide> def _merge_function(self, inputs):
<ide> def _merge_function(self, inputs):
<ide>
<ide>
<ide> class Maximum(_Merge):
<del> """TODO
<add> """Layer that computes the maximum (element-wise) a list of inputs.
<add>
<add> It takes as input a list of tensors,
<add> all of the same shape, and returns
<add> a single tensor (also of the same shape).
<ide> """
<ide>
<ide> def _merge_function(self, inputs):
<ide> def _merge_function(self, inputs):
<ide>
<ide>
<ide> class Concatenate(_Merge):
<del> """TODO
<add> """Layer that concatenates a list of inputs.
<add>
<add> It takes as input a list of tensors,
<add> all of the same shape expect for the concatenation axis,
<add> and returns a single tensor, the concatenation of all inputs.
<add>
<add> # Arguments
<add> axis: Axis along which to concatenate.
<add> **kwargs: standard layer keyword arguments.
<ide> """
<ide>
<ide> def __init__(self, axis=-1, **kwargs):
<ide> def get_config(self):
<ide>
<ide>
<ide> class Dot(_Merge):
<del> """TODO
<add> """Layer that computes a dot product between samples in two tensors.
<add>
<add> E.g. if applied to two tensors `a` and `b` of shape `(batch_size, n)`,
<add> the output will be a tensor of shape `(batch_size, 1)`
<add> where each entry `i` will be the dot product between
<add> `a[i]` and `b[i]`.
<add>
<add> # Arguments
<add> axes: Integer or tuple of integers,
<add> axis or axes along which to take the dot product.
<add> normalize: Whether to L2-normalize samples along the
<add> dot product axis before taking the dot product.
<add> If set to True, then the output of the dot product
<add> is the cosine proximity between the two samples.
<add> **kwargs: Standard layer keyword arguments.
<ide> """
<ide>
<ide> def __init__(self, axes, normalize=False, **kwargs):
<ide> def get_config(self):
<ide>
<ide>
<ide> def sum(inputs, **kwargs):
<del> """TODO
<add> """Functional interface to the `Sum` layer.
<add>
<add> # Arguments
<add> inputs: A list of input tensors (at least 2).
<add> **kwargs: Standard layer keyword arguments.
<add>
<add> # Returns
<add> A tensor, the sum of the inputs.
<ide> """
<ide> return Sum(**kwargs)(inputs)
<ide>
<ide>
<ide> def multiply(inputs, **kwargs):
<del> """TODO
<add> """Functional interface to the `Multiply` layer.
<add>
<add> # Arguments
<add> inputs: A list of input tensors (at least 2).
<add> **kwargs: Standard layer keyword arguments.
<add>
<add> # Returns
<add> A tensor, the element-wise product of the inputs.
<ide> """
<ide> return Multiply(**kwargs)(inputs)
<ide>
<ide>
<ide> def average(inputs, **kwargs):
<del> """TODO
<add> """Functional interface to the `Average` layer.
<add>
<add> # Arguments
<add> inputs: A list of input tensors (at least 2).
<add> **kwargs: Standard layer keyword arguments.
<add>
<add> # Returns
<add> A tensor, the average of the inputs.
<ide> """
<ide> return Average(**kwargs)(inputs)
<ide>
<ide>
<ide> def maximum(inputs, **kwargs):
<del> """TODO
<add> """Functional interface to the `Maximum` layer.
<add>
<add> # Arguments
<add> inputs: A list of input tensors (at least 2).
<add> **kwargs: Standard layer keyword arguments.
<add>
<add> # Returns
<add> A tensor, the element-wise maximum of the inputs.
<ide> """
<ide> return Maximum(**kwargs)(inputs)
<ide>
<ide>
<ide> def concatenate(inputs, axis=-1, **kwargs):
<del> """TODO
<add> """Functional interface to the `Concatenate` layer.
<add>
<add> # Arguments
<add> inputs: A list of input tensors (at least 2).
<add> axis: Concatenation axis.
<add> **kwargs: Standard layer keyword arguments.
<add>
<add> # Returns
<add> A tensor, the concatenation of the inputs alongside axis `axis`.
<ide> """
<ide> return Concatenate(axis=axis, **kwargs)(inputs)
<ide>
<ide>
<ide> def dot(inputs, axes, normalize=False, **kwargs):
<del> """TODO
<add> """Functional interface to the `Dot` layer.
<add>
<add> # Arguments
<add> inputs: A list of input tensors (at least 2).
<add> axes: Integer or tuple of integers,
<add> axis or axes along which to take the dot product.
<add> normalize: Whether to L2-normalize samples along the
<add> dot product axis before taking the dot product.
<add> If set to True, then the output of the dot product
<add> is the cosine proximity between the two samples.
<add> **kwargs: Standard layer keyword arguments.
<add>
<add> # Returns
<add> A tensor, the dot product of the samples from the inputs.
<ide> """
<ide> return Dot(axes=axes, normalize=normalize, **kwargs)(inputs) | 1 |
Javascript | Javascript | add arechildrenoffscreen to host config | 4602e768f3a65f8076d70aa67b8a7c94d7cc377f | <ide><path>src/renderers/art/ReactARTFiber.js
<ide> const ARTRenderer = ReactFiberReconciler({
<ide> // Noop
<ide> },
<ide>
<add> areChildrenOffscreen(props : Props) {
<add> return false;
<add> },
<add>
<ide> getRootHostContext() {
<ide> return emptyObject;
<ide> },
<ide><path>src/renderers/dom/fiber/ReactDOMFiber.js
<ide> type Container = Element;
<ide> type Props = {
<ide> autoFocus ?: boolean,
<ide> children ?: mixed,
<add> hidden ?: boolean,
<ide> };
<ide> type Instance = Element;
<ide> type TextInstance = Text;
<ide> var DOMRenderer = ReactFiberReconciler({
<ide> domElement.textContent = '';
<ide> },
<ide>
<add> areChildrenOffscreen(props : Props) : boolean {
<add> return Boolean(props.hidden);
<add> },
<add>
<ide> createTextInstance(
<ide> text : string,
<ide> rootContainerInstance : Container,
<ide><path>src/renderers/native/ReactNativeFiber.js
<ide> const NativeRenderer = ReactFiberReconciler({
<ide> // Noop
<ide> },
<ide>
<add> areChildrenOffscreen(props : Props) : boolean {
<add> return false;
<add> },
<add>
<ide> scheduleAnimationCallback: global.requestAnimationFrame,
<ide>
<ide> scheduleDeferredCallback: global.requestIdleCallback,
<ide><path>src/renderers/noop/ReactNoop.js
<ide> var scheduledAnimationCallback = null;
<ide> var scheduledDeferredCallback = null;
<ide>
<ide> type Container = { rootID: string, children: Array<Instance | TextInstance> };
<del>type Props = { prop: any };
<add>type Props = { prop: any, hidden ?: boolean };
<ide> type Instance = {| type: string, id: number, children: Array<Instance | TextInstance>, prop: any |};
<ide> type TextInstance = {| text: string, id: number |};
<ide>
<ide> var NoopRenderer = ReactFiberReconciler({
<ide>
<ide> resetTextContent(instance : Instance) : void {},
<ide>
<add> areChildrenOffscreen(props : Props) : boolean {
<add> return Boolean(props.hidden);
<add> },
<add>
<ide> createTextInstance(
<ide> text : string,
<ide> rootContainerInstance : Container,
<ide><path>src/renderers/shared/fiber/ReactFiberBeginWork.js
<ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>(
<ide> getPriorityContext : () => PriorityLevel,
<ide> ) {
<ide>
<del> const { shouldSetTextContent, useSyncScheduling } = config;
<add> const { shouldSetTextContent, useSyncScheduling, areChildrenOffscreen } = config;
<ide>
<ide> const {
<ide> pushHostContext,
<ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>(
<ide> }
<ide> } else if (nextProps === null || memoizedProps === nextProps) {
<ide> if (!useSyncScheduling &&
<del> memoizedProps.hidden &&
<add> areChildrenOffscreen(memoizedProps) &&
<ide> workInProgress.pendingWorkPriority !== OffscreenPriority) {
<ide> // This subtree still has work, but it should be deprioritized so we need
<ide> // to bail out and not do any work yet.
<ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>(
<ide> markRef(current, workInProgress);
<ide>
<ide> if (!useSyncScheduling &&
<del> nextProps.hidden &&
<add> areChildrenOffscreen(nextProps) &&
<ide> workInProgress.pendingWorkPriority !== OffscreenPriority) {
<ide> // If this host component is hidden, we can bail out on the children.
<ide> // We'll rerender the children later at the lower priority.
<ide><path>src/renderers/shared/fiber/ReactFiberReconciler.js
<ide> export type HostConfig<T, P, I, TI, PI, C, CX, PL> = {
<ide>
<ide> shouldSetTextContent(props : P) : boolean,
<ide> resetTextContent(instance : I) : void,
<add> areChildrenOffscreen(props : P) : boolean,
<ide>
<ide> createTextInstance(
<ide> text : string,
<ide><path>src/renderers/testing/ReactTestRendererFiber.js
<ide> var TestRenderer = ReactFiberReconciler({
<ide> // noop
<ide> },
<ide>
<add> areChildrenOffscreen(props : Props) : boolean {
<add> return false;
<add> },
<add>
<ide> createTextInstance(
<ide> text : string,
<ide> rootContainerInstance : Container, | 7 |
Javascript | Javascript | fix crash from fillratelogging | 6f8ce41a3958068d6258f7b7c0d1f98646486475 | <ide><path>Libraries/Lists/FillRateHelper.js
<ide> class FillRateHelper {
<ide> return null;
<ide> }
<ide> const start = performanceNow();
<add> if (props.getItemCount(props.data) === 0) {
<add> return null;
<add> }
<ide> if (!this._samplesStartTime) {
<ide> this._samplesStartTime = start;
<ide> } | 1 |
Python | Python | set version to 2.1.2 | c9bd0e5a966e5a2069a96c474e23713b3d5e5b58 | <ide><path>spacy/about.py
<ide> # fmt: off
<ide>
<ide> __title__ = "spacy"
<del>__version__ = "2.1.1"
<add>__version__ = "2.1.2"
<ide> __summary__ = "Industrial-strength Natural Language Processing (NLP) with Python and Cython"
<ide> __uri__ = "https://spacy.io"
<ide> __author__ = "Explosion AI" | 1 |
PHP | PHP | add tests for mergeoptions with custom prefix | 8ded571b4813f3657c1ff5d8347a506f5be5db60 | <ide><path>tests/TestCase/Controller/Component/PaginatorComponentTest.php
<ide> public function testMergeOptionsModelSpecific()
<ide> $this->assertEquals($expected, $result);
<ide> }
<ide>
<add> /**
<add> * test mergeOptions with custom prefix
<add> *
<add> * @return void
<add> */
<add> public function testMergeOptionsCustomPrefix()
<add> {
<add> $this->request->query = [
<add> 'page' => 10,
<add> 'limit' => 10,
<add> 'prefix' => [
<add> 'page' => 2,
<add> 'limit' => 5,
<add> ]
<add> ];
<add>
<add> $settings = [
<add> 'page' => 1,
<add> 'limit' => 20,
<add> 'maxLimit' => 100,
<add> 'finder' => 'myCustomFind',
<add> ];
<add> $result = $this->Paginator->mergeOptions('Post', $settings);
<add> $expected = [
<add> 'page' => 10,
<add> 'limit' => 10,
<add> 'maxLimit' => 100,
<add> 'finder' => 'myCustomFind',
<add> 'whitelist' => ['limit', 'sort', 'page', 'direction'],
<add> ];
<add> $this->assertEquals($expected, $result);
<add>
<add> $settings = [
<add> 'page' => 1,
<add> 'limit' => 20,
<add> 'maxLimit' => 100,
<add> 'finder' => 'myCustomFind',
<add> 'prefix' => 'non-existent',
<add> ];
<add> $result = $this->Paginator->mergeOptions('Post', $settings);
<add> $expected = [
<add> 'page' => 1,
<add> 'limit' => 20,
<add> 'maxLimit' => 100,
<add> 'finder' => 'myCustomFind',
<add> 'whitelist' => ['limit', 'sort', 'page', 'direction'],
<add> 'prefix' => 'non-existent',
<add> ];
<add> $this->assertEquals($expected, $result);
<add>
<add>
<add> $settings = [
<add> 'page' => 1,
<add> 'limit' => 20,
<add> 'maxLimit' => 100,
<add> 'finder' => 'myCustomFind',
<add> 'prefix' => 'prefix',
<add> ];
<add> $result = $this->Paginator->mergeOptions('Post', $settings);
<add> $expected = [
<add> 'page' => 2,
<add> 'limit' => 5,
<add> 'maxLimit' => 100,
<add> 'finder' => 'myCustomFind',
<add> 'whitelist' => ['limit', 'sort', 'page', 'direction'],
<add> 'prefix' => 'prefix',
<add> ];
<add> $this->assertEquals($expected, $result);
<add> }
<add>
<ide> /**
<ide> * test mergeOptions with customFind key
<ide> * | 1 |
PHP | PHP | fix cookie bug | 2504f8693fbe3bb69b75cdc6033958cb15cb9ba5 | <ide><path>laravel/cookie.php
<ide> public static function send()
<ide> */
<ide> public static function get($name, $default = null)
<ide> {
<del> if (isset(static::$jar[$name])) return static::$jar[$name];
<add> if (isset(static::$jar[$name])) return static::$jar[$name]['value'];
<ide>
<ide> $value = array_get($_COOKIE, $name);
<ide> | 1 |
Ruby | Ruby | use new exclude paths | 4e6990ed8168b74f14b51f389ae89db5abc026f6 | <ide><path>Library/Homebrew/cmd/list.rb
<ide> def list
<ide> UNBREWED_EXCLUDE_PATHS = %w[
<ide> .github/*
<ide> bin/brew
<add> completions/zsh/_brew
<add> docs/*
<ide> lib/gdk-pixbuf-2.0/*
<ide> lib/gio/*
<ide> lib/node_modules/*
<ide> def list
<ide> lib/ruby/gems/[12].*
<ide> lib/ruby/site_ruby/[12].*
<ide> lib/ruby/vendor_ruby/[12].*
<add> manpages/brew.1
<ide> share/pypy/*
<ide> share/pypy3/*
<del> share/doc/homebrew/*
<ide> share/info/dir
<del> share/man/man1/brew.1
<ide> share/man/whatis
<del> share/zsh/site-functions/_brew
<ide> ].freeze
<ide>
<ide> def list_unbrewed | 1 |
Go | Go | prevent panic when empty flag | 661a1e90263cc348c17620cf0b250bf552dd4056 | <ide><path>pkg/mflag/flag.go
<ide> func (f *FlagSet) usage() {
<ide> }
<ide>
<ide> func trimQuotes(str string) string {
<add> if len(str) == 0 {
<add> return str
<add> }
<ide> type quote struct {
<ide> start, end byte
<ide> } | 1 |
PHP | PHP | fix dispatcher typos | 68c49e5c17e8e9f6219736367f042d80d88f2c08 | <ide><path>src/Illuminate/Database/Eloquent/Model.php
<ide> abstract class Model implements ArrayAccess, ArrayableInterface, JsonableInterfa
<ide> /**
<ide> * The event dispatcher instance.
<ide> *
<del> * @var Illuminate\Events\Dispacher
<add> * @var Illuminate\Events\Dispatcher
<ide> */
<ide> protected static $dispatcher;
<ide>
<ide> public static function setConnectionResolver(Resolver $resolver)
<ide> */
<ide> public static function getEventDispatcher()
<ide> {
<del> return static::$dispathcer;
<add> return static::$dispatcher;
<ide> }
<ide>
<ide> /** | 1 |
Javascript | Javascript | fix performance issue with separationcs | 39624e91739e24ebf52c83df19863c96b26cb922 | <ide><path>pdf.js
<ide> var SeparationCS = (function() {
<ide> var rgbBuf = new Uint8Array(length);
<ide> var pos = 0;
<ide>
<add> var numComps = base.numComps;
<add> var baseBuf = new Uint8Array(numComps * input.length);
<ide> for (var i = 0, ii = input.length; i < ii; ++i) {
<ide> var scaled = input[i] / 255;
<ide> var tinted = tintFn.func([scaled]);
<del> var rgb = base.getRgb(tinted);
<del> for (var j = 0; j < 3; ++j)
<del> rgbBuf[pos++] = Math.round(255 * rgb[j]);
<add> for (var j = 0; j < numComps; ++j)
<add> baseBuf[pos++] = 255 * tinted[j];
<ide> }
<add> return base.getRgbBuffer(baseBuf);
<ide>
<del> return rgbBuf;
<ide> }
<ide> };
<ide>
<ide> var DeviceCmykCS = (function() {
<ide>
<ide> var rgb = this.getRgb(cmyk);
<ide> for (var j = 0; j < 3; ++j)
<del> rgb[rgbBufPos++] = Math.round(rgb[j] * 255);
<add> rgbBuf[rgbBufPos++] = Math.round(rgb[j] * 255);
<ide> }
<ide>
<ide> return rgbBuf; | 1 |
Javascript | Javascript | add coverage for util.inspect.colors alias setter | 481fa1ca989a36f850f844f1df50a6db0cfb1dd3 | <ide><path>test/parallel/test-util-inspect.js
<ide> assert.strictEqual(
<ide> '\x1B[2mdef: \x1B[33m5\x1B[39m\x1B[22m }'
<ide> );
<ide> }
<add>
<add>// Test changing util.inspect.colors colors and aliases.
<add>{
<add> const colors = util.inspect.colors;
<add>
<add> const originalValue = colors.gray;
<add>
<add> // "grey" is reference-equal alias of "gray".
<add> assert.strictEqual(colors.grey, colors.gray);
<add>
<add> // Assigninging one should assign the other. This tests that the alias setter
<add> // function keeps things reference-equal.
<add> colors.gray = [0, 0];
<add> assert.deepStrictEqual(colors.gray, [0, 0]);
<add> assert.strictEqual(colors.grey, colors.gray);
<add>
<add> colors.grey = [1, 1];
<add> assert.deepStrictEqual(colors.grey, [1, 1]);
<add> assert.strictEqual(colors.grey, colors.gray);
<add>
<add> // Restore original value to avoid side effects in other tests.
<add> colors.gray = originalValue;
<add> assert.deepStrictEqual(colors.gray, originalValue);
<add> assert.strictEqual(colors.grey, colors.gray);
<add>} | 1 |
Java | Java | fix detection supportshover | 75a8847a425a84614698dbbab3a38c055a2569f6 | <ide><path>ReactAndroid/src/main/java/com/facebook/react/uimanager/events/PointerEventHelper.java
<ide> public class PointerEventHelper {
<ide> public static final String POINTER_TYPE_PEN = "pen";
<ide> public static final String POINTER_TYPE_MOUSE = "mouse";
<ide> public static final String POINTER_TYPE_UNKNOWN = "";
<add> private static final int X_FLAG_SUPPORTS_HOVER = 0x01000000;
<ide>
<ide> public static enum EVENT {
<ide> CANCEL,
<ide> public static int getEventCategory(String pointerEventType) {
<ide> }
<ide>
<ide> public static boolean supportsHover(MotionEvent motionEvent) {
<add> // A flag has been set on the MotionEvent to indicate it supports hover
<add> // See D36958947 on justifications for this.
<add> // TODO(luwe): Leverage previous events to determine if MotionEvent
<add> // is from an input device that supports hover
<add> boolean supportsHoverFlag = (motionEvent.getFlags() & X_FLAG_SUPPORTS_HOVER) != 0;
<add> if (supportsHoverFlag) {
<add> return true;
<add> }
<add>
<ide> int source = motionEvent.getSource();
<del> return source == InputDevice.SOURCE_MOUSE || source == InputDevice.SOURCE_CLASS_POINTER;
<add> return source == InputDevice.SOURCE_MOUSE;
<ide> }
<ide>
<ide> public static boolean isExitEvent(String eventName) { | 1 |
Ruby | Ruby | inline initializer setup | 60926db9e06a7890409926211dffe773aff4a57d | <ide><path>activerecord/lib/active_record/relation.rb
<ide> class Relation
<ide> attr_reader :relation, :klass
<ide>
<ide> def initialize(klass, relation)
<del> @klass = klass
<del> @relation = relation
<add> @klass, @relation = klass, relation
<ide> end
<ide>
<ide> def to_a | 1 |
Text | Text | update configuring.md with colons and periods | 9a4ca7d71a2a3c2b4f4f12c1d10e4077af675e1c | <ide><path>guides/source/configuring.md
<ide> Because `Rails::Application` inherits from `Rails::Railtie` (indirectly), you ca
<ide>
<ide> Below is a comprehensive list of all the initializers found in Rails in the order that they are defined (and therefore run in, unless otherwise stated).
<ide>
<del>* `load_environment_hook` Serves as a placeholder so that `:load_environment_config` can be defined to run before it.
<add>* `load_environment_hook`: Serves as a placeholder so that `:load_environment_config` can be defined to run before it.
<ide>
<del>* `load_active_support` Requires `active_support/dependencies` which sets up the basis for Active Support. Optionally requires `active_support/all` if `config.active_support.bare` is un-truthful, which is the default.
<add>* `load_active_support`: Requires `active_support/dependencies` which sets up the basis for Active Support. Optionally requires `active_support/all` if `config.active_support.bare` is un-truthful, which is the default.
<ide>
<del>* `initialize_logger` Initializes the logger (an `ActiveSupport::Logger` object) for the application and makes it accessible at `Rails.logger`, provided that no initializer inserted before this point has defined `Rails.logger`.
<add>* `initialize_logger`: Initializes the logger (an `ActiveSupport::Logger` object) for the application and makes it accessible at `Rails.logger`, provided that no initializer inserted before this point has defined `Rails.logger`.
<ide>
<del>* `initialize_cache` If `Rails.cache` isn't set yet, initializes the cache by referencing the value in `config.cache_store` and stores the outcome as `Rails.cache`. If this object responds to the `middleware` method, its middleware is inserted before `Rack::Runtime` in the middleware stack.
<add>* `initialize_cache`: If `Rails.cache` isn't set yet, initializes the cache by referencing the value in `config.cache_store` and stores the outcome as `Rails.cache`. If this object responds to the `middleware` method, its middleware is inserted before `Rack::Runtime` in the middleware stack.
<ide>
<del>* `set_clear_dependencies_hook` This initializer - which runs only if `cache_classes` is set to `false` - uses `ActionDispatch::Callbacks.after` to remove the constants which have been referenced during the request from the object space so that they will be reloaded during the following request.
<add>* `set_clear_dependencies_hook`: This initializer - which runs only if `cache_classes` is set to `false` - uses `ActionDispatch::Callbacks.after` to remove the constants which have been referenced during the request from the object space so that they will be reloaded during the following request.
<ide>
<del>* `initialize_dependency_mechanism` If `config.cache_classes` is true, configures `ActiveSupport::Dependencies.mechanism` to `require` dependencies rather than `load` them.
<add>* `initialize_dependency_mechanism`: If `config.cache_classes` is true, configures `ActiveSupport::Dependencies.mechanism` to `require` dependencies rather than `load` them.
<ide>
<del>* `bootstrap_hook` Runs all configured `before_initialize` blocks.
<add>* `bootstrap_hook`: Runs all configured `before_initialize` blocks.
<ide>
<del>* `i18n.callbacks` In the development environment, sets up a `to_prepare` callback which will call `I18n.reload!` if any of the locales have changed since the last request. In production mode this callback will only run on the first request.
<add>* `i18n.callbacks`: In the development environment, sets up a `to_prepare` callback which will call `I18n.reload!` if any of the locales have changed since the last request. In production mode this callback will only run on the first request.
<ide>
<del>* `active_support.deprecation_behavior` Sets up deprecation reporting for environments, defaulting to `:log` for development, `:notify` for production and `:stderr` for test. If a value isn't set for `config.active_support.deprecation` then this initializer will prompt the user to configure this line in the current environment's `config/environments` file. Can be set to an array of values.
<add>* `active_support.deprecation_behavior`: Sets up deprecation reporting for environments, defaulting to `:log` for development, `:notify` for production and `:stderr` for test. If a value isn't set for `config.active_support.deprecation` then this initializer will prompt the user to configure this line in the current environment's `config/environments` file. Can be set to an array of values.
<ide>
<del>* `active_support.initialize_time_zone` Sets the default time zone for the application based on the `config.time_zone` setting, which defaults to "UTC".
<add>* `active_support.initialize_time_zone`: Sets the default time zone for the application based on the `config.time_zone` setting, which defaults to "UTC".
<ide>
<del>* `active_support.initialize_beginning_of_week` Sets the default beginning of week for the application based on `config.beginning_of_week` setting, which defaults to `:monday`.
<add>* `active_support.initialize_beginning_of_week`: Sets the default beginning of week for the application based on `config.beginning_of_week` setting, which defaults to `:monday`.
<ide>
<del>* `active_support.set_configs` Sets up Active Support by using the settings in `config.active_support` by `send`'ing the method names as setters to `ActiveSupport` and passing the values through.
<add>* `active_support.set_configs`: Sets up Active Support by using the settings in `config.active_support` by `send`'ing the method names as setters to `ActiveSupport` and passing the values through.
<ide>
<del>* `action_dispatch.configure` Configures the `ActionDispatch::Http::URL.tld_length` to be set to the value of `config.action_dispatch.tld_length`.
<add>* `action_dispatch.configure`: Configures the `ActionDispatch::Http::URL.tld_length` to be set to the value of `config.action_dispatch.tld_length`.
<ide>
<del>* `action_view.set_configs` Sets up Action View by using the settings in `config.action_view` by `send`'ing the method names as setters to `ActionView::Base` and passing the values through.
<add>* `action_view.set_configs`: Sets up Action View by using the settings in `config.action_view` by `send`'ing the method names as setters to `ActionView::Base` and passing the values through.
<ide>
<del>* `action_controller.assets_config` Initializes the `config.actions_controller.assets_dir` to the app's public directory if not explicitly configured
<add>* `action_controller.assets_config`: Initializes the `config.actions_controller.assets_dir` to the app's public directory if not explicitly configured.
<ide>
<del>* `action_controller.set_helpers_path` Sets Action Controller's helpers_path to the application's helpers_path
<add>* `action_controller.set_helpers_path`: Sets Action Controller's `helpers_path` to the application's `helpers_path`.
<ide>
<del>* `action_controller.parameters_config` Configures strong parameters options for `ActionController::Parameters`
<add>* `action_controller.parameters_config`: Configures strong parameters options for `ActionController::Parameters`.
<ide>
<del>* `action_controller.set_configs` Sets up Action Controller by using the settings in `config.action_controller` by `send`'ing the method names as setters to `ActionController::Base` and passing the values through.
<add>* `action_controller.set_configs`: Sets up Action Controller by using the settings in `config.action_controller` by `send`'ing the method names as setters to `ActionController::Base` and passing the values through.
<ide>
<del>* `action_controller.compile_config_methods` Initializes methods for the config settings specified so that they are quicker to access.
<add>* `action_controller.compile_config_methods`: Initializes methods for the config settings specified so that they are quicker to access.
<ide>
<del>* `active_record.initialize_timezone` Sets `ActiveRecord::Base.time_zone_aware_attributes` to true, as well as setting `ActiveRecord::Base.default_timezone` to UTC. When attributes are read from the database, they will be converted into the time zone specified by `Time.zone`.
<add>* `active_record.initialize_timezone`: Sets `ActiveRecord::Base.time_zone_aware_attributes` to true, as well as setting `ActiveRecord::Base.default_timezone` to UTC. When attributes are read from the database, they will be converted into the time zone specified by `Time.zone`.
<ide>
<del>* `active_record.logger` Sets `ActiveRecord::Base.logger` - if it's not already set - to `Rails.logger`.
<add>* `active_record.logger`: Sets `ActiveRecord::Base.logger` - if it's not already set - to `Rails.logger`.
<ide>
<del>* `active_record.migration_error` Configures middleware to check for pending migrations
<add>* `active_record.migration_error`: Configures middleware to check for pending migrations.
<ide>
<del>* `active_record.check_schema_cache_dump` Loads the schema cache dump if configured and available
<add>* `active_record.check_schema_cache_dump`: Loads the schema cache dump if configured and available.
<ide>
<del>* `active_record.warn_on_records_fetched_greater_than` Enables warnings when queries return large numbers of records
<add>* `active_record.warn_on_records_fetched_greater_than`: Enables warnings when queries return large numbers of records.
<ide>
<del>* `active_record.set_configs` Sets up Active Record by using the settings in `config.active_record` by `send`'ing the method names as setters to `ActiveRecord::Base` and passing the values through.
<add>* `active_record.set_configs`: Sets up Active Record by using the settings in `config.active_record` by `send`'ing the method names as setters to `ActiveRecord::Base` and passing the values through.
<ide>
<del>* `active_record.initialize_database` Loads the database configuration (by default) from `config/database.yml` and establishes a connection for the current environment.
<add>* `active_record.initialize_database`: Loads the database configuration (by default) from `config/database.yml` and establishes a connection for the current environment.
<ide>
<del>* `active_record.log_runtime` Includes `ActiveRecord::Railties::ControllerRuntime` which is responsible for reporting the time taken by Active Record calls for the request back to the logger.
<add>* `active_record.log_runtime`: Includes `ActiveRecord::Railties::ControllerRuntime` which is responsible for reporting the time taken by Active Record calls for the request back to the logger.
<ide>
<del>* `active_record.set_reloader_hooks` Resets all reloadable connections to the database if `config.cache_classes` is set to `false`.
<add>* `active_record.set_reloader_hooks`: Resets all reloadable connections to the database if `config.cache_classes` is set to `false`.
<ide>
<del>* `active_record.add_watchable_files` Adds `schema.rb` and `structure.sql` files to watchable files
<add>* `active_record.add_watchable_files`: Adds `schema.rb` and `structure.sql` files to watchable files.
<ide>
<del>* `active_job.logger` Sets `ActiveJob::Base.logger` - if it's not already set -
<add>* `active_job.logger`: Sets `ActiveJob::Base.logger` - if it's not already set -
<ide> to `Rails.logger`.
<ide>
<del>* `active_job.set_configs` Sets up Active Job by using the settings in `config.active_job` by `send`'ing the method names as setters to `ActiveJob::Base` and passing the values through.
<add>* `active_job.set_configs`: Sets up Active Job by using the settings in `config.active_job` by `send`'ing the method names as setters to `ActiveJob::Base` and passing the values through.
<ide>
<del>* `action_mailer.logger` Sets `ActionMailer::Base.logger` - if it's not already set - to `Rails.logger`.
<add>* `action_mailer.logger`: Sets `ActionMailer::Base.logger` - if it's not already set - to `Rails.logger`.
<ide>
<del>* `action_mailer.set_configs` Sets up Action Mailer by using the settings in `config.action_mailer` by `send`'ing the method names as setters to `ActionMailer::Base` and passing the values through.
<add>* `action_mailer.set_configs`: Sets up Action Mailer by using the settings in `config.action_mailer` by `send`'ing the method names as setters to `ActionMailer::Base` and passing the values through.
<ide>
<del>* `action_mailer.compile_config_methods` Initializes methods for the config settings specified so that they are quicker to access.
<add>* `action_mailer.compile_config_methods`: Initializes methods for the config settings specified so that they are quicker to access.
<ide>
<del>* `set_load_path` This initializer runs before `bootstrap_hook`. Adds paths specified by `config.load_paths` and all autoload paths to `$LOAD_PATH`.
<add>* `set_load_path`: This initializer runs before `bootstrap_hook`. Adds paths specified by `config.load_paths` and all autoload paths to `$LOAD_PATH`.
<ide>
<del>* `set_autoload_paths` This initializer runs before `bootstrap_hook`. Adds all sub-directories of `app` and paths specified by `config.autoload_paths`, `config.eager_load_paths` and `config.autoload_once_paths` to `ActiveSupport::Dependencies.autoload_paths`.
<add>* `set_autoload_paths`: This initializer runs before `bootstrap_hook`. Adds all sub-directories of `app` and paths specified by `config.autoload_paths`, `config.eager_load_paths` and `config.autoload_once_paths` to `ActiveSupport::Dependencies.autoload_paths`.
<ide>
<del>* `add_routing_paths` Loads (by default) all `config/routes.rb` files (in the application and railties, including engines) and sets up the routes for the application.
<add>* `add_routing_paths`: Loads (by default) all `config/routes.rb` files (in the application and railties, including engines) and sets up the routes for the application.
<ide>
<del>* `add_locales` Adds the files in `config/locales` (from the application, railties and engines) to `I18n.load_path`, making available the translations in these files.
<add>* `add_locales`: Adds the files in `config/locales` (from the application, railties and engines) to `I18n.load_path`, making available the translations in these files.
<ide>
<del>* `add_view_paths` Adds the directory `app/views` from the application, railties and engines to the lookup path for view files for the application.
<add>* `add_view_paths`: Adds the directory `app/views` from the application, railties and engines to the lookup path for view files for the application.
<ide>
<del>* `load_environment_config` Loads the `config/environments` file for the current environment.
<add>* `load_environment_config`: Loads the `config/environments` file for the current environment.
<ide>
<del>* `prepend_helpers_path` Adds the directory `app/helpers` from the application, railties and engines to the lookup path for helpers for the application.
<add>* `prepend_helpers_path`: Adds the directory `app/helpers` from the application, railties and engines to the lookup path for helpers for the application.
<ide>
<del>* `load_config_initializers` Loads all Ruby files from `config/initializers` in the application, railties and engines. The files in this directory can be used to hold configuration settings that should be made after all of the frameworks are loaded.
<add>* `load_config_initializers`: Loads all Ruby files from `config/initializers` in the application, railties and engines. The files in this directory can be used to hold configuration settings that should be made after all of the frameworks are loaded.
<ide>
<del>* `engines_blank_point` Provides a point-in-initialization to hook into if you wish to do anything before engines are loaded. After this point, all railtie and engine initializers are run.
<add>* `engines_blank_point`: Provides a point-in-initialization to hook into if you wish to do anything before engines are loaded. After this point, all railtie and engine initializers are run.
<ide>
<del>* `add_generator_templates` Finds templates for generators at `lib/templates` for the application, railties and engines and adds these to the `config.generators.templates` setting, which will make the templates available for all generators to reference.
<add>* `add_generator_templates`: Finds templates for generators at `lib/templates` for the application, railties and engines and adds these to the `config.generators.templates` setting, which will make the templates available for all generators to reference.
<ide>
<del>* `ensure_autoload_once_paths_as_subset` Ensures that the `config.autoload_once_paths` only contains paths from `config.autoload_paths`. If it contains extra paths, then an exception will be raised.
<add>* `ensure_autoload_once_paths_as_subset`: Ensures that the `config.autoload_once_paths` only contains paths from `config.autoload_paths`. If it contains extra paths, then an exception will be raised.
<ide>
<del>* `add_to_prepare_blocks` The block for every `config.to_prepare` call in the application, a railtie or engine is added to the `to_prepare` callbacks for Action Dispatch which will be run per request in development, or before the first request in production.
<add>* `add_to_prepare_blocks`: The block for every `config.to_prepare` call in the application, a railtie or engine is added to the `to_prepare` callbacks for Action Dispatch which will be run per request in development, or before the first request in production.
<ide>
<del>* `add_builtin_route` If the application is running under the development environment then this will append the route for `rails/info/properties` to the application routes. This route provides the detailed information such as Rails and Ruby version for `public/index.html` in a default Rails application.
<add>* `add_builtin_route`: If the application is running under the development environment then this will append the route for `rails/info/properties` to the application routes. This route provides the detailed information such as Rails and Ruby version for `public/index.html` in a default Rails application.
<ide>
<del>* `build_middleware_stack` Builds the middleware stack for the application, returning an object which has a `call` method which takes a Rack environment object for the request.
<add>* `build_middleware_stack`: Builds the middleware stack for the application, returning an object which has a `call` method which takes a Rack environment object for the request.
<ide>
<del>* `eager_load!` If `config.eager_load` is true, runs the `config.before_eager_load` hooks and then calls `eager_load!` which will load all `config.eager_load_namespaces`.
<add>* `eager_load!`: If `config.eager_load` is true, runs the `config.before_eager_load` hooks and then calls `eager_load!` which will load all `config.eager_load_namespaces`.
<ide>
<del>* `finisher_hook` Provides a hook for after the initialization of process of the application is complete, as well as running all the `config.after_initialize` blocks for the application, railties and engines.
<add>* `finisher_hook`: Provides a hook for after the initialization of process of the application is complete, as well as running all the `config.after_initialize` blocks for the application, railties and engines.
<ide>
<del>* `set_routes_reloader` Configures Action Dispatch to reload the routes file using `ActionDispatch::Callbacks.to_prepare`.
<add>* `set_routes_reloader`: Configures Action Dispatch to reload the routes file using `ActionDispatch::Callbacks.to_prepare`.
<ide>
<del>* `disable_dependency_loading` Disables the automatic dependency loading if the `config.eager_load` is set to true.
<add>* `disable_dependency_loading`: Disables the automatic dependency loading if the `config.eager_load` is set to true.
<ide>
<ide> Database pooling
<ide> ---------------- | 1 |
Python | Python | allow specification of terms to fit in lagfit | 8dcf03358a97bf3a577025c03438d381c8b4cb72 | <ide><path>numpy/polynomial/laguerre.py
<ide> def lagfit(x, y, deg, rcond=None, full=False, w=None):
<ide> y-coordinates of the sample points. Several data sets of sample
<ide> points sharing the same x-coordinates can be fitted at once by
<ide> passing in a 2D-array that contains one dataset per column.
<del> deg : int
<del> Degree of the fitting polynomial
<add> deg : int or array_like
<add> Degree of the fitting polynomial. If `deg` is a single integer
<add> all terms up to and including the `deg`'th term are included.
<add> `deg` may alternatively be a list or array specifying which
<add> terms in the Legendre expansion to include in the fit.
<add>
<add> .. versionchanged:: 1.11.0
<add> `deg` may be a list specifying which terms to fit
<ide> rcond : float, optional
<ide> Relative condition number of the fit. Singular values smaller than
<ide> this relative to the largest singular value will be ignored. The
<ide> def lagfit(x, y, deg, rcond=None, full=False, w=None):
<ide> array([ 0.96971004, 2.00193749, 3.00288744])
<ide>
<ide> """
<del> order = int(deg) + 1
<ide> x = np.asarray(x) + 0.0
<ide> y = np.asarray(y) + 0.0
<add> deg = np.asarray([deg,], dtype=int).flatten()
<ide>
<ide> # check arguments.
<del> if deg < 0:
<add> if deg.size < 1:
<add> raise TypeError("expected deg to be one or more integers")
<add> if deg.min() < 0:
<ide> raise ValueError("expected deg >= 0")
<ide> if x.ndim != 1:
<ide> raise TypeError("expected 1D vector for x")
<ide> def lagfit(x, y, deg, rcond=None, full=False, w=None):
<ide> if len(x) != len(y):
<ide> raise TypeError("expected x and y to have same length")
<ide>
<add> if deg.size == 1:
<add> restricted_fit = False
<add> lmax = deg[0]
<add> order = lmax + 1
<add> else:
<add> restricted_fit = True
<add> lmax = deg.max()
<add> order = deg.size
<add>
<ide> # set up the least squares matrices in transposed form
<del> lhs = lagvander(x, deg).T
<add> van = lagvander(x, lmax)
<add> if restricted_fit:
<add> van = van[:, deg]
<add> lhs = van.T
<ide> rhs = y.T
<ide> if w is not None:
<ide> w = np.asarray(w) + 0.0
<ide> def lagfit(x, y, deg, rcond=None, full=False, w=None):
<ide> c, resids, rank, s = la.lstsq(lhs.T/scl, rhs.T, rcond)
<ide> c = (c.T/scl).T
<ide>
<add> # Expand c to include non-fitted coefficients which are set to zero
<add> if restricted_fit:
<add> if c.ndim == 2:
<add> cc = np.zeros((lmax+1, c.shape[1]), dtype=c.dtype)
<add> else:
<add> cc = np.zeros(lmax+1, dtype=c.dtype)
<add> cc[deg] = c
<add> c = cc
<add>
<ide> # warn on rank reduction
<ide> if rank != order and not full:
<ide> msg = "The fit may be poorly conditioned" | 1 |
Python | Python | fix batch_size in transformer_main.py | 2d7a0d6abba764b768d645947014492ade492385 | <ide><path>official/transformer/transformer_main.py
<ide> def run_transformer(flags_obj):
<ide>
<ide> params["use_synthetic_data"] = flags_obj.use_synthetic_data
<ide>
<del> # Set batch size parameter, which depends on TPU and distribution settings.
<del> params["batch_size"] = (
<del> flags_obj.batch_size or params["default_batch_size_tpu"])
<add> # Set batch size parameter, which depends on the availability of
<add> # TPU and GPU, and distribution settings.
<add> params["batch_size"] = (flags_obj.batch_size or (
<add> params["default_batch_size_tpu"] if params["use_tpu"]
<add> else params["default_batch_size"]))
<add>
<ide> if not params["use_tpu"]:
<ide> params["batch_size"] = distribution_utils.per_device_batch_size(
<ide> params["batch_size"], num_gpus) | 1 |
Ruby | Ruby | fix github naming | 6db4b7220094205424e4174c43319be273a4b9de | <ide><path>Library/Homebrew/tap.rb
<ide>
<ide> # a {Tap} is used to extend the formulae provided by Homebrew core.
<ide> # Usually, it's synced with a remote git repository. And it's likely
<del># a Github repository with the name of `user/homebrew-repo`. In such
<add># a GitHub repository with the name of `user/homebrew-repo`. In such
<ide> # case, `user/repo` will be used as the {#name} of this {Tap}, where
<del># {#user} represents Github username and {#repo} represents repository
<add># {#user} represents GitHub username and {#repo} represents repository
<ide> # name without leading `homebrew-`.
<ide> class Tap
<ide> extend Cachable
<ide> def self.default_cask_tap
<ide>
<ide> extend Enumerable
<ide>
<del> # The user name of this {Tap}. Usually, it's the Github username of
<add> # The user name of this {Tap}. Usually, it's the GitHub username of
<ide> # this #{Tap}'s remote repository.
<ide> attr_reader :user
<ide> | 1 |
PHP | PHP | remove annotation of removed functions in 4.0 | 229a1fba01e8c77bdb407c3e0c9c3017390b96e3 | <ide><path>src/Mailer/Mailer.php
<ide> *
<ide> * @method \Cake\Mailer\Email setTo($email, $name = null)
<ide> * @method array getTo()
<del> * @method \Cake\Mailer\Email to($email = null, $name = null)
<ide> * @method \Cake\Mailer\Email setFrom($email, $name = null)
<ide> * @method array getFrom()
<ide> * @method \Cake\Mailer\Email setSender($email, $name = null)
<ide> * @method \Cake\Mailer\Email setHeaders(array $headers)
<ide> * @method \Cake\Mailer\Email addHeaders(array $headers)
<ide> * @method \Cake\Mailer\Email getHeaders(array $include = [])
<del> * @method \Cake\Mailer\Email setTemplate($template)
<del> * @method string getTemplate()
<del> * @method \Cake\Mailer\Email setLayout($layout)
<del> * @method string getLayout()
<ide> * @method \Cake\Mailer\Email setViewRenderer($viewClass)
<ide> * @method string getViewRenderer()
<ide> * @method \Cake\Mailer\Email setViewVars($viewVars)
<ide> * @method array getViewVars()
<del> * @method \Cake\Mailer\Email setTheme($theme)
<del> * @method string getTheme()
<del> * @method \Cake\Mailer\Email setHelpers(array $helpers)
<del> * @method array getHelpers()
<ide> * @method \Cake\Mailer\Email setEmailFormat($format)
<ide> * @method string getEmailFormat()
<ide> * @method \Cake\Mailer\Email setTransport($name) | 1 |
Python | Python | add test for backpropagating padding | a22f96c3f19388b5369bf592aac1b056855009f8 | <ide><path>spacy/tests/test_misc.py
<ide> from ..displacy import parse_deps, parse_ents
<ide> from ..tokens import Span
<ide> from .util import get_doc
<add>from .._ml import PrecomputableAffine
<ide>
<ide> from pathlib import Path
<ide> import pytest
<ide> def test_displacy_parse_deps(en_vocab):
<ide> assert deps['arcs'] == [{'start': 0, 'end': 1, 'label': 'nsubj', 'dir': 'left'},
<ide> {'start': 2, 'end': 3, 'label': 'det', 'dir': 'left'},
<ide> {'start': 1, 'end': 3, 'label': 'attr', 'dir': 'right'}]
<add>
<add>
<add>def test_PrecomputableAffine(nO=4, nI=5, nF=3, nP=2):
<add> model = PrecomputableAffine(nO=nO, nI=nI, nF=nF, nP=nP)
<add> assert model.W.shape == (nF, nO, nP, nI)
<add> tensor = model.ops.allocate((10, nI))
<add> Y, get_dX = model.begin_update(tensor)
<add> assert Y.shape == (tensor.shape[0]+1, nF, nO, nP)
<add> assert model.d_pad.shape == (1, nF, nO, nP)
<add> dY = model.ops.allocate((15, nF, nO, nP))
<add> ids = model.ops.allocate((15, nF))
<add> ids[1,2] = -1
<add> dY[1,2] = 1
<add> assert model.d_pad[0, 2, 0, 0] == 0.
<add> model._backprop_padding(dY, ids)
<add> assert model.d_pad[0, 2, 0, 0] == 1. | 1 |
Javascript | Javascript | use shallow document comparisons in uniquesort | 15750b0af270da07917b70457cf09bda97d3d935 | <ide><path>src/selector/uniqueSort.js
<ide> function sortOrder( a, b ) {
<ide> }
<ide>
<ide> // Calculate position if both inputs belong to the same document
<del> compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
<add> // Support: IE 11+, Edge 17 - 18+
<add> // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
<add> // two documents; shallow comparisons work.
<add> // eslint-disable-next-line eqeqeq
<add> compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ?
<ide> a.compareDocumentPosition( b ) :
<ide>
<ide> // Otherwise we know they are disconnected
<ide> function sortOrder( a, b ) {
<ide> if ( compare & 1 ) {
<ide>
<ide> // Choose the first element that is related to the document
<del> if ( a === document || a.ownerDocument === document &&
<add> // Support: IE 11+, Edge 17 - 18+
<add> // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
<add> // two documents; shallow comparisons work.
<add> // eslint-disable-next-line eqeqeq
<add> if ( a == document || a.ownerDocument == document &&
<ide> jQuery.contains( document, a ) ) {
<ide> return -1;
<ide> }
<del> if ( b === document || b.ownerDocument === document &&
<add>
<add> // Support: IE 11+, Edge 17 - 18+
<add> // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
<add> // two documents; shallow comparisons work.
<add> // eslint-disable-next-line eqeqeq
<add> if ( b == document || b.ownerDocument == document &&
<ide> jQuery.contains( document, b ) ) {
<ide> return 1;
<ide> } | 1 |
Mixed | Javascript | add hasref method to timeout & immediate | 48a2568f411cf09999b7e82992d15142ce9a45b0 | <ide><path>doc/api/timers.md
<ide> running as long as the immediate is active. The `Immediate` object returned by
<ide> [`setImmediate()`][] exports both `immediate.ref()` and `immediate.unref()`
<ide> functions that can be used to control this default behavior.
<ide>
<add>### immediate.hasRef()
<add><!-- YAML
<add>added: REPLACEME
<add>-->
<add>
<add>* Returns: {boolean}
<add>
<add>If true, the `Immediate` object will keep the Node.js event loop active.
<add>
<ide> ### immediate.ref()
<ide> <!-- YAML
<ide> added: v9.7.0
<ide> timer is active. Each of the `Timeout` objects returned by these functions
<ide> export both `timeout.ref()` and `timeout.unref()` functions that can be used to
<ide> control this default behavior.
<ide>
<add>### timeout.hasRef()
<add><!-- YAML
<add>added: REPLACEME
<add>-->
<add>
<add>* Returns: {boolean}
<add>
<add>If true, the `Timeout` object will keep the Node.js event loop active.
<add>
<ide> ### timeout.ref()
<ide> <!-- YAML
<ide> added: v0.9.1
<ide><path>lib/timers.js
<ide> Timeout.prototype.ref = function() {
<ide> return this;
<ide> };
<ide>
<add>Timeout.prototype.hasRef = function() {
<add> return !!this[kRefed];
<add>};
<add>
<ide> Timeout.prototype.close = function() {
<ide> clearTimeout(this);
<ide> return this;
<ide> function processImmediate() {
<ide> count++;
<ide> if (immediate[kRefed])
<ide> refCount++;
<del> immediate[kRefed] = undefined;
<add> immediate[kRefed] = null;
<ide>
<ide> tryOnImmediate(immediate, tail, count, refCount);
<ide>
<ide> const Immediate = class Immediate {
<ide> }
<ide> return this;
<ide> }
<add>
<add> hasRef() {
<add> return !!this[kRefed];
<add> }
<ide> };
<ide>
<ide> function setImmediate(callback, arg1, arg2, arg3) {
<ide> exports.clearImmediate = function clearImmediate(immediate) {
<ide>
<ide> if (immediate[kRefed] && --immediateInfo[kRefCount] === 0)
<ide> toggleImmediateRef(false);
<del> immediate[kRefed] = undefined;
<add> immediate[kRefed] = null;
<ide>
<ide> if (destroyHooksExist()) {
<ide> emitDestroy(immediate[async_id_symbol]);
<ide><path>test/parallel/test-timers-immediate-unref.js
<ide> const common = require('../common');
<ide> const Countdown = require('../common/countdown');
<ide>
<add>const assert = require('assert');
<add>
<add>const immediate = setImmediate(() => {});
<add>assert.strictEqual(immediate.hasRef(), true);
<add>immediate.unref();
<add>assert.strictEqual(immediate.hasRef(), false);
<add>clearImmediate(immediate);
<add>
<ide> // This immediate should execute as it was unrefed and refed again.
<ide> // It also confirms that unref/ref are chainable.
<ide> setImmediate(common.mustCall(firstStep)).ref().unref().unref().ref();
<ide><path>test/parallel/test-timers-unref.js
<ide>
<ide> const common = require('../common');
<ide>
<add>const assert = require('assert');
<add>
<ide> let unref_interval = false;
<ide> let unref_timer = false;
<ide> let checks = 0;
<ide>
<ide> const LONG_TIME = 10 * 1000;
<ide> const SHORT_TIME = 100;
<ide>
<add>const timer = setTimeout(() => {}, 10);
<add>assert.strictEqual(timer.hasRef(), true);
<ide> // Should not throw.
<del>setTimeout(() => {}, 10).unref().ref().unref();
<add>timer.unref().ref().unref();
<add>assert.strictEqual(timer.hasRef(), false);
<add>
<ide> setInterval(() => {}, 10).unref().ref().unref();
<ide>
<ide> setInterval(common.mustNotCall('Interval should not fire'), LONG_TIME).unref(); | 4 |
Javascript | Javascript | remove unnecessary return statements | 32ca31306006d54d4887549b10608dc691cab055 | <ide><path>packages/react-dom/src/events/plugins/SelectEventPlugin.js
<ide> function extractEvents(
<ide> case 'keyup':
<ide> constructSelectEvent(dispatchQueue, nativeEvent, nativeEventTarget);
<ide> }
<del>
<del> return;
<ide> }
<ide>
<ide> export {registerEvents, extractEvents};
<ide><path>packages/react-dom/src/events/plugins/SimpleEventPlugin.js
<ide> function extractEvents(
<ide> accumulateTargetOnly,
<ide> );
<ide> }
<del> return event;
<ide> }
<ide>
<ide> export {registerSimpleEvents as registerEvents, extractEvents}; | 2 |
Python | Python | add a install_clib command | 78de166d5bd2a41f90defd899abb9fb6c14c6c79 | <ide><path>numpy/distutils/command/__init__.py
<ide>
<ide> distutils_all = [ 'build_py',
<ide> 'clean',
<del> 'install_lib',
<add> 'install_clib',
<ide> 'install_scripts',
<ide> 'bdist',
<ide> 'bdist_dumb',
<ide> 'install',
<ide> 'install_data',
<ide> 'install_headers',
<add> 'install_lib',
<ide> 'bdist_rpm',
<ide> 'sdist',
<ide> ] + distutils_all
<ide><path>numpy/distutils/command/install.py
<ide>
<ide> class install(old_install):
<ide>
<add> # XXX: fix the lambda: True
<add> sub_commands = old_install.sub_commands + [('install_clib', lambda x: True)]
<add>
<ide> def finalize_options (self):
<ide> old_install.finalize_options(self)
<ide> self.install_lib = self.install_libbase
<ide><path>numpy/distutils/command/install_clib.py
<add>import os
<add>from distutils.core import Command
<add>
<add>class install_clib(Command):
<add> description = "Command to install installable C libraries"
<add>
<add> user_options = []
<add>
<add> def initialize_options(self):
<add> pass
<add>
<add> def finalize_options(self):
<add> pass
<add>
<add> def run (self):
<add> pass
<add>
<add> def get_outputs(self):
<add> return []
<ide><path>numpy/distutils/core.py
<ide> from numpy.distutils.numpy_distribution import NumpyDistribution
<ide> from numpy.distutils.command import config, config_compiler, \
<ide> build, build_py, build_ext, build_clib, build_src, build_scripts, \
<del> sdist, install_data, install_headers, install, bdist_rpm, scons
<add> sdist, install_data, install_headers, install, bdist_rpm, scons, \
<add> install_clib
<ide> from numpy.distutils.misc_util import get_data_files, is_sequence, is_string
<ide>
<ide> numpy_cmdclass = {'build': build.build,
<ide> 'scons': scons.scons,
<ide> 'install_data': install_data.install_data,
<ide> 'install_headers': install_headers.install_headers,
<add> 'install_clib': install_clib.install_clib,
<ide> 'install': install.install,
<ide> 'bdist_rpm': bdist_rpm.bdist_rpm,
<ide> } | 4 |
Javascript | Javascript | use map to track callbacks | 97dad7e33b24ce4163fdf95b8a32300f25492aef | <ide><path>lib/internal/cluster/utils.js
<ide> module.exports = {
<ide> handles: {} // Used in tests.
<ide> };
<ide>
<del>const callbacks = {};
<add>const callbacks = new Map();
<ide> var seq = 0;
<ide>
<ide> function sendHelper(proc, message, handle, cb) {
<ide> function sendHelper(proc, message, handle, cb) {
<ide> message = util._extend({ cmd: 'NODE_CLUSTER' }, message);
<ide>
<ide> if (typeof cb === 'function')
<del> callbacks[seq] = cb;
<add> callbacks.set(seq, cb);
<ide>
<ide> message.seq = seq;
<ide> seq += 1;
<ide> function internal(worker, cb) {
<ide>
<ide> var fn = cb;
<ide>
<del> if (message.ack !== undefined && callbacks[message.ack] !== undefined) {
<del> fn = callbacks[message.ack];
<del> delete callbacks[message.ack];
<add> if (message.ack !== undefined) {
<add> const callback = callbacks.get(message.ack);
<add>
<add> if (callback !== undefined) {
<add> fn = callback;
<add> callbacks.delete(message.ack);
<add> }
<ide> }
<ide>
<ide> fn.apply(worker, arguments); | 1 |
Ruby | Ruby | remove redundant that already happened in teardown | 4dfe213d0fcaf5e665aa624686c13e08849059db | <ide><path>activerecord/test/cases/attribute_decorators_test.rb
<ide> def type_cast_from_user(value)
<ide>
<ide> test "decoration does not eagerly load existing columns" do
<ide> assert_no_queries do
<del> Model.reset_column_information
<ide> Model.decorate_attribute_type(:a_string, :test) { |t| StringDecorator.new(t) }
<ide> end
<ide> end | 1 |
Javascript | Javascript | update handlebars to 1.0.0.beta.3 | eb3c5aa562461d238c8d1b02c80b428858416c38 | <ide><path>packages/handlebars/lib/main.js
<ide> var handlebars = (function(){
<ide> var parser = {trace: function trace() { },
<ide> yy: {},
<del>symbols_: {"error":2,"root":3,"program":4,"EOF":5,"statements":6,"simpleInverse":7,"statement":8,"openInverse":9,"closeBlock":10,"openBlock":11,"mustache":12,"partial":13,"CONTENT":14,"COMMENT":15,"OPEN_BLOCK":16,"inMustache":17,"CLOSE":18,"OPEN_INVERSE":19,"OPEN_ENDBLOCK":20,"path":21,"OPEN":22,"OPEN_UNESCAPED":23,"OPEN_PARTIAL":24,"params":25,"hash":26,"param":27,"STRING":28,"hashSegments":29,"hashSegment":30,"ID":31,"EQUALS":32,"pathSegments":33,"SEP":34,"$accept":0,"$end":1},
<del>terminals_: {2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"OPEN_PARTIAL",28:"STRING",31:"ID",32:"EQUALS",34:"SEP"},
<del>productions_: [0,[3,2],[4,3],[4,1],[4,0],[6,1],[6,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,3],[13,4],[7,2],[17,3],[17,2],[17,2],[17,1],[25,2],[25,1],[27,1],[27,1],[26,1],[29,2],[29,1],[30,3],[30,3],[21,1],[33,3],[33,1]],
<add>symbols_: {"error":2,"root":3,"program":4,"EOF":5,"statements":6,"simpleInverse":7,"statement":8,"openInverse":9,"closeBlock":10,"openBlock":11,"mustache":12,"partial":13,"CONTENT":14,"COMMENT":15,"OPEN_BLOCK":16,"inMustache":17,"CLOSE":18,"OPEN_INVERSE":19,"OPEN_ENDBLOCK":20,"path":21,"OPEN":22,"OPEN_UNESCAPED":23,"OPEN_PARTIAL":24,"params":25,"hash":26,"param":27,"STRING":28,"INTEGER":29,"BOOLEAN":30,"hashSegments":31,"hashSegment":32,"ID":33,"EQUALS":34,"pathSegments":35,"SEP":36,"$accept":0,"$end":1},
<add>terminals_: {2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"OPEN_PARTIAL",28:"STRING",29:"INTEGER",30:"BOOLEAN",33:"ID",34:"EQUALS",36:"SEP"},
<add>productions_: [0,[3,2],[4,3],[4,1],[4,0],[6,1],[6,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,3],[13,4],[7,2],[17,3],[17,2],[17,2],[17,1],[25,2],[25,1],[27,1],[27,1],[27,1],[27,1],[26,1],[31,2],[31,1],[32,3],[32,3],[32,3],[32,3],[21,1],[35,3],[35,1]],
<ide> performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {
<ide>
<ide> var $0 = $$.length - 1;
<ide> case 27: this.$ = $$[$0]
<ide> break;
<ide> case 28: this.$ = new yy.StringNode($$[$0])
<ide> break;
<del>case 29: this.$ = new yy.HashNode($$[$0])
<add>case 29: this.$ = new yy.IntegerNode($$[$0])
<ide> break;
<del>case 30: $$[$0-1].push($$[$0]); this.$ = $$[$0-1]
<add>case 30: this.$ = new yy.BooleanNode($$[$0])
<ide> break;
<del>case 31: this.$ = [$$[$0]]
<add>case 31: this.$ = new yy.HashNode($$[$0])
<ide> break;
<del>case 32: this.$ = [$$[$0-2], $$[$0]]
<add>case 32: $$[$0-1].push($$[$0]); this.$ = $$[$0-1]
<ide> break;
<del>case 33: this.$ = [$$[$0-2], new yy.StringNode($$[$0])]
<add>case 33: this.$ = [$$[$0]]
<ide> break;
<del>case 34: this.$ = new yy.IdNode($$[$0])
<add>case 34: this.$ = [$$[$0-2], $$[$0]]
<ide> break;
<del>case 35: $$[$0-2].push($$[$0]); this.$ = $$[$0-2];
<add>case 35: this.$ = [$$[$0-2], new yy.StringNode($$[$0])]
<ide> break;
<del>case 36: this.$ = [$$[$0]]
<add>case 36: this.$ = [$$[$0-2], new yy.IntegerNode($$[$0])]
<add>break;
<add>case 37: this.$ = [$$[$0-2], new yy.BooleanNode($$[$0])]
<add>break;
<add>case 38: this.$ = new yy.IdNode($$[$0])
<add>break;
<add>case 39: $$[$0-2].push($$[$0]); this.$ = $$[$0-2];
<add>break;
<add>case 40: this.$ = [$$[$0]]
<ide> break;
<ide> }
<ide> },
<del>table: [{3:1,4:2,5:[2,4],6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{1:[3]},{5:[1,16]},{5:[2,3],7:17,8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,19],20:[2,3],22:[1,13],23:[1,14],24:[1,15]},{5:[2,5],14:[2,5],15:[2,5],16:[2,5],19:[2,5],20:[2,5],22:[2,5],23:[2,5],24:[2,5]},{4:20,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{4:21,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],24:[2,9]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],24:[2,10]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],24:[2,11]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],24:[2,12]},{17:22,21:23,31:[1,25],33:24},{17:26,21:23,31:[1,25],33:24},{17:27,21:23,31:[1,25],33:24},{17:28,21:23,31:[1,25],33:24},{21:29,31:[1,25],33:24},{1:[2,1]},{6:30,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{5:[2,6],14:[2,6],15:[2,6],16:[2,6],19:[2,6],20:[2,6],22:[2,6],23:[2,6],24:[2,6]},{17:22,18:[1,31],21:23,31:[1,25],33:24},{10:32,20:[1,33]},{10:34,20:[1,33]},{18:[1,35]},{18:[2,24],21:40,25:36,26:37,27:38,28:[1,41],29:39,30:42,31:[1,43],33:24},{18:[2,34],28:[2,34],31:[2,34],34:[1,44]},{18:[2,36],28:[2,36],31:[2,36],34:[2,36]},{18:[1,45]},{18:[1,46]},{18:[1,47]},{18:[1,48],21:49,31:[1,25],33:24},{5:[2,2],8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,2],22:[1,13],23:[1,14],24:[1,15]},{14:[2,20],15:[2,20],16:[2,20],19:[2,20],22:[2,20],23:[2,20],24:[2,20]},{5:[2,7],14:[2,7],15:[2,7],16:[2,7],19:[2,7],20:[2,7],22:[2,7],23:[2,7],24:[2,7]},{21:50,31:[1,25],33:24},{5:[2,8],14:[2,8],15:[2,8],16:[2,8],19:[2,8],20:[2,8],22:[2,8],23:[2,8],24:[2,8]},{14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],24:[2,14]},{18:[2,22],21:40,26:51,27:52,28:[1,41],29:39,30:42,31:[1,43],33:24},{18:[2,23]},{18:[2,26],28:[2,26],31:[2,26]},{18:[2,29],30:53,31:[1,54]},{18:[2,27],28:[2,27],31:[2,27]},{18:[2,28],28:[2,28],31:[2,28]},{18:[2,31],31:[2,31]},{18:[2,36],28:[2,36],31:[2,36],32:[1,55],34:[2,36]},{31:[1,56]},{14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],24:[2,13]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],24:[2,16]},{5:[2,17],14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],24:[2,17]},{5:[2,18],14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],24:[2,18]},{18:[1,57]},{18:[1,58]},{18:[2,21]},{18:[2,25],28:[2,25],31:[2,25]},{18:[2,30],31:[2,30]},{32:[1,55]},{21:59,28:[1,60],31:[1,25],33:24},{18:[2,35],28:[2,35],31:[2,35],34:[2,35]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],24:[2,19]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],24:[2,15]},{18:[2,32],31:[2,32]},{18:[2,33],31:[2,33]}],
<del>defaultActions: {16:[2,1],37:[2,23],51:[2,21]},
<add>table: [{3:1,4:2,5:[2,4],6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{1:[3]},{5:[1,16]},{5:[2,3],7:17,8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,19],20:[2,3],22:[1,13],23:[1,14],24:[1,15]},{5:[2,5],14:[2,5],15:[2,5],16:[2,5],19:[2,5],20:[2,5],22:[2,5],23:[2,5],24:[2,5]},{4:20,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{4:21,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],24:[2,9]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],24:[2,10]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],24:[2,11]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],24:[2,12]},{17:22,21:23,33:[1,25],35:24},{17:26,21:23,33:[1,25],35:24},{17:27,21:23,33:[1,25],35:24},{17:28,21:23,33:[1,25],35:24},{21:29,33:[1,25],35:24},{1:[2,1]},{6:30,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{5:[2,6],14:[2,6],15:[2,6],16:[2,6],19:[2,6],20:[2,6],22:[2,6],23:[2,6],24:[2,6]},{17:22,18:[1,31],21:23,33:[1,25],35:24},{10:32,20:[1,33]},{10:34,20:[1,33]},{18:[1,35]},{18:[2,24],21:40,25:36,26:37,27:38,28:[1,41],29:[1,42],30:[1,43],31:39,32:44,33:[1,45],35:24},{18:[2,38],28:[2,38],29:[2,38],30:[2,38],33:[2,38],36:[1,46]},{18:[2,40],28:[2,40],29:[2,40],30:[2,40],33:[2,40],36:[2,40]},{18:[1,47]},{18:[1,48]},{18:[1,49]},{18:[1,50],21:51,33:[1,25],35:24},{5:[2,2],8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,2],22:[1,13],23:[1,14],24:[1,15]},{14:[2,20],15:[2,20],16:[2,20],19:[2,20],22:[2,20],23:[2,20],24:[2,20]},{5:[2,7],14:[2,7],15:[2,7],16:[2,7],19:[2,7],20:[2,7],22:[2,7],23:[2,7],24:[2,7]},{21:52,33:[1,25],35:24},{5:[2,8],14:[2,8],15:[2,8],16:[2,8],19:[2,8],20:[2,8],22:[2,8],23:[2,8],24:[2,8]},{14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],24:[2,14]},{18:[2,22],21:40,26:53,27:54,28:[1,41],29:[1,42],30:[1,43],31:39,32:44,33:[1,45],35:24},{18:[2,23]},{18:[2,26],28:[2,26],29:[2,26],30:[2,26],33:[2,26]},{18:[2,31],32:55,33:[1,56]},{18:[2,27],28:[2,27],29:[2,27],30:[2,27],33:[2,27]},{18:[2,28],28:[2,28],29:[2,28],30:[2,28],33:[2,28]},{18:[2,29],28:[2,29],29:[2,29],30:[2,29],33:[2,29]},{18:[2,30],28:[2,30],29:[2,30],30:[2,30],33:[2,30]},{18:[2,33],33:[2,33]},{18:[2,40],28:[2,40],29:[2,40],30:[2,40],33:[2,40],34:[1,57],36:[2,40]},{33:[1,58]},{14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],24:[2,13]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],24:[2,16]},{5:[2,17],14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],24:[2,17]},{5:[2,18],14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],24:[2,18]},{18:[1,59]},{18:[1,60]},{18:[2,21]},{18:[2,25],28:[2,25],29:[2,25],30:[2,25],33:[2,25]},{18:[2,32],33:[2,32]},{34:[1,57]},{21:61,28:[1,62],29:[1,63],30:[1,64],33:[1,25],35:24},{18:[2,39],28:[2,39],29:[2,39],30:[2,39],33:[2,39],36:[2,39]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],24:[2,19]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],24:[2,15]},{18:[2,34],33:[2,34]},{18:[2,35],33:[2,35]},{18:[2,36],33:[2,36]},{18:[2,37],33:[2,37]}],
<add>defaultActions: {16:[2,1],37:[2,23],53:[2,21]},
<ide> parseError: function parseError(str, hash) {
<ide> throw new Error(str);
<ide> },
<ide> case 9: yy_.yytext = yy_.yytext.substr(3,yy_.yyleng-5); this.begin("INITIAL"); r
<ide> break;
<ide> case 10: return 22;
<ide> break;
<del>case 11: return 32;
<add>case 11: return 34;
<ide> break;
<del>case 12: return 31;
<add>case 12: return 33;
<ide> break;
<del>case 13: return 31;
<add>case 13: return 33;
<ide> break;
<del>case 14: return 34;
<add>case 14: return 36;
<ide> break;
<ide> case 15: /*ignore whitespace*/
<ide> break;
<ide> case 17: this.begin("INITIAL"); return 18;
<ide> break;
<ide> case 18: yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2).replace(/\\"/g,'"'); return 28;
<ide> break;
<del>case 19: return 31;
<add>case 19: return 30;
<add>break;
<add>case 20: return 30;
<add>break;
<add>case 21: return 29;
<ide> break;
<del>case 20: return 'INVALID';
<add>case 22: return 33;
<ide> break;
<del>case 21: return 5;
<add>case 23: return 'INVALID';
<add>break;
<add>case 24: return 5;
<ide> break;
<ide> }
<ide> };
<del>lexer.rules = [/^[^\x00]*?(?=(\{\{))/,/^[^\x00]+/,/^\{\{>/,/^\{\{#/,/^\{\{\//,/^\{\{\^/,/^\{\{\s*else\b/,/^\{\{\{/,/^\{\{&/,/^\{\{![\s\S]*?\}\}/,/^\{\{/,/^=/,/^\.(?=[} ])/,/^\.\./,/^[/.]/,/^\s+/,/^\}\}\}/,/^\}\}/,/^"(\\["]|[^"])*"/,/^[a-zA-Z0-9_-]+(?=[=} /.])/,/^./,/^$/];
<del>lexer.conditions = {"mu":{"rules":[2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21],"inclusive":false},"INITIAL":{"rules":[0,1,21],"inclusive":true}};return lexer;})()
<add>lexer.rules = [/^[^\x00]*?(?=(\{\{))/,/^[^\x00]+/,/^\{\{>/,/^\{\{#/,/^\{\{\//,/^\{\{\^/,/^\{\{\s*else\b/,/^\{\{\{/,/^\{\{&/,/^\{\{![\s\S]*?\}\}/,/^\{\{/,/^=/,/^\.(?=[} ])/,/^\.\./,/^[/.]/,/^\s+/,/^\}\}\}/,/^\}\}/,/^"(\\["]|[^"])*"/,/^true(?=[}\s])/,/^false(?=[}\s])/,/^[0-9]+(?=[}\s])/,/^[a-zA-Z0-9_$-]+(?=[=}\s/.])/,/^./,/^$/];
<add>lexer.conditions = {"mu":{"rules":[2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24],"inclusive":false},"INITIAL":{"rules":[0,1,24],"inclusive":true}};return lexer;})()
<ide> parser.lexer = lexer;
<ide> return parser;
<ide> })();
<add>if (typeof require !== 'undefined' && typeof exports !== 'undefined') {
<add>exports.parser = handlebars;
<add>exports.parse = function () { return handlebars.parse.apply(handlebars, arguments); }
<add>exports.main = function commonjsMain(args) {
<add> if (!args[1])
<add> throw new Error('Usage: '+args[0]+' FILE');
<add> if (typeof process !== 'undefined') {
<add> var source = require('fs').readFileSync(require('path').join(process.cwd(), args[1]), "utf8");
<add> } else {
<add> var cwd = require("file").path(require("file").cwd());
<add> var source = cwd.join(args[1]).read({charset: "utf-8"});
<add> }
<add> return exports.parser.parse(source);
<add>}
<add>if (typeof module !== 'undefined' && require.main === module) {
<add> exports.main(typeof process !== 'undefined' ? process.argv.slice(1) : require("system").args);
<add>}
<add>};
<add>;
<ide> // lib/handlebars/base.js
<del>Handlebars = {};
<add>var Handlebars = {};
<ide>
<del>Handlebars.VERSION = "1.0.beta.1";
<add>Handlebars.VERSION = "1.0.beta.2";
<ide>
<ide> Handlebars.Parser = handlebars;
<ide>
<ide> Handlebars.log = function(level, str) { Handlebars.logger.log(level, str); };
<ide> this.string = string;
<ide> };
<ide>
<add> Handlebars.AST.IntegerNode = function(integer) {
<add> this.type = "INTEGER";
<add> this.integer = integer;
<add> };
<add>
<add> Handlebars.AST.BooleanNode = function(boolean) {
<add> this.type = "BOOLEAN";
<add> this.boolean = boolean;
<add> };
<add>
<ide> Handlebars.AST.CommentNode = function(comment) {
<ide> this.type = "comment";
<ide> this.comment = comment;
<ide> Handlebars.SafeString.prototype.toString = function() {
<ide> (function() {
<ide> var escape = {
<ide> "<": "<",
<del> ">": ">"
<add> ">": ">",
<add> '"': """,
<add> "'": "'",
<add> "`": "`"
<ide> };
<ide>
<del> var badChars = /&(?!\w+;)|[<>]/g;
<del> var possible = /[&<>]/;
<add> var badChars = /&(?!\w+;)|[<>"'`]/g;
<add> var possible = /[&<>"'`]/;
<ide>
<ide> var escapeChar = function(chr) {
<ide> return escape[chr] || "&"
<ide> Handlebars.JavaScriptCompiler = function() {};
<ide> this.opcode('pushString', string.string);
<ide> },
<ide>
<add> INTEGER: function(integer) {
<add> this.opcode('push', integer.integer);
<add> },
<add>
<add> BOOLEAN: function(boolean) {
<add> this.opcode('push', boolean.boolean);
<add> },
<add>
<ide> comment: function() {},
<ide>
<ide> // HELPERS
<ide> Handlebars.JavaScriptCompiler = function() {};
<ide> // PUBLIC API: You can override these methods in a subclass to provide
<ide> // alternative compiled forms for name lookup and buffering semantics
<ide> nameLookup: function(parent, name, type) {
<del> if(JavaScriptCompiler.RESERVED_WORDS[name] || name.indexOf('-') !== -1) {
<add> if(JavaScriptCompiler.RESERVED_WORDS[name] || name.indexOf('-') !== -1 || !isNaN(name)) {
<ide> return parent + "['" + name + "']";
<add> } else if (/^[0-9]+$/.test(name)) {
<add> return parent + "[" + name + "]";
<ide> } else {
<ide> return parent + "." + name;
<ide> } | 1 |
Ruby | Ruby | allow taps to link manpages | d36d88edf27ead55adb6efe312f7f70f090b729d | <ide><path>Library/Homebrew/cmd/tap.rb
<ide> def tap
<ide> if ARGV.empty?
<ide> puts Tap.names
<ide> elsif ARGV.first == "--repair"
<add> Tap.each(&:link_manpages)
<ide> migrate_taps :force => true
<ide> elsif ARGV.first == "--list-official"
<ide> require "official_taps"
<ide><path>Library/Homebrew/cmd/update.rb
<ide> def update
<ide> puts "Already up-to-date." unless master_updated || !updated_taps.empty?
<ide>
<ide> Tap.clear_cache
<add> Tap.each(&:link_manpages)
<ide>
<ide> # automatically tap any migrated formulae's new tap
<ide> report.select_formula(:D).each do |f|
<ide><path>Library/Homebrew/tap.rb
<ide> def install(options = {})
<ide> raise
<ide> end
<ide>
<add> link_manpages
<add>
<ide> formula_count = formula_files.size
<ide> puts "Tapped #{formula_count} formula#{plural(formula_count, "e")} (#{path.abv})"
<ide> Descriptions.cache_formulae(formula_names)
<ide> def install(options = {})
<ide> end
<ide> end
<ide>
<add> def link_manpages
<add> return unless (path/"man").exist?
<add> conflicts = []
<add> (path/"man").find do |src|
<add> next if src.directory?
<add> dst = HOMEBREW_PREFIX/"share"/src.relative_path_from(path)
<add> next if dst.symlink? && src == dst.resolved_path
<add> if dst.exist?
<add> conflicts << dst
<add> next
<add> end
<add> dst.make_relative_symlink(src)
<add> end
<add> unless conflicts.empty?
<add> onoe <<-EOS.undent
<add> Could not link #{name} manpages to:
<add> #{conflicts.join("\n")}
<add>
<add> Please delete these files and run `brew tap --repair`.
<add> EOS
<add> end
<add> end
<add>
<ide> # uninstall this {Tap}.
<ide> def uninstall
<ide> raise TapUnavailableError, name unless installed?
<ide> def uninstall
<ide> unpin if pinned?
<ide> formula_count = formula_files.size
<ide> Descriptions.uncache_formulae(formula_names)
<add> unlink_manpages
<ide> path.rmtree
<del> path.dirname.rmdir_if_possible
<add> path.parent.rmdir_if_possible
<ide> puts "Untapped #{formula_count} formula#{plural(formula_count, "e")}"
<ide> end
<ide>
<add> def unlink_manpages
<add> return unless (path/"man").exist?
<add> (path/"man").find do |src|
<add> next if src.directory?
<add> dst = HOMEBREW_PREFIX/src.relative_path_from(path)
<add> dst.delete if dst.symlink? && src == dst.resolved_path
<add> dst.parent.rmdir_if_possible
<add> end
<add> end
<add>
<ide> # True if the {#remote} of {Tap} is customized.
<ide> def custom_remote?
<ide> return true unless remote
<ide> def unpin
<ide> raise TapUnavailableError, name unless installed?
<ide> raise TapPinStatusError.new(name, false) unless pinned?
<ide> pinned_symlink_path.delete
<del> pinned_symlink_path.dirname.rmdir_if_possible
<add> pinned_symlink_path.parent.rmdir_if_possible
<ide> @pinned = false
<ide> end
<ide> | 3 |
Java | Java | delete unused package import | 127bc07cdaa2434b6fa4c8227faaa5fdcb9a9647 | <ide><path>spring-test/src/test/java/org/springframework/test/context/junit4/orm/HibernateSessionFlushingTests.java
<ide>
<ide> import org.hibernate.SessionFactory;
<ide> import org.hibernate.exception.ConstraintViolationException;
<del>import org.hibernate.exception.GenericJDBCException;
<ide>
<ide> import org.junit.Before;
<ide> import org.junit.Test; | 1 |
Ruby | Ruby | add collectionproxy#size documentation | f539d98cc8838b0f7c3c31465cdc070ab9c1e9f3 | <ide><path>activerecord/lib/active_record/associations/collection_proxy.rb
<ide> class CollectionProxy < Relation
<ide> # person.pets.create!(name: nil)
<ide> # # => ActiveRecord::RecordInvalid: Validation failed: Name can't be blank
<ide>
<del>
<ide> ##
<ide> # :method: concat
<ide> #
<ide> class CollectionProxy < Relation
<ide> #
<ide> # person.pets.replace(["doo", "ggie", "gaga"])
<ide> # # => ActiveRecord::AssociationTypeMismatch: Pet expected, got String
<del>
<ide>
<ide> ##
<ide> # :method: delete_all
<ide> class CollectionProxy < Relation
<ide> # person.pets # => []
<ide> #
<ide> # Pet.find(4, 5, 6) # => ActiveRecord::RecordNotFound: Couldn't find all Pets with IDs (4, 5, 6)
<add>
<add> ##
<add> # :method: size
<add> #
<add> # Returns the size of the collection. If the collection hasn't been loaded,
<add> # it executes a <tt>SELECT COUNT(*)</tt> query.
<add> #
<add> # class Person < ActiveRecord::Base
<add> # has_many :pets
<add> # end
<add> #
<add> # # This will execute:
<add> # # SELECT COUNT(*) FROM "pets" WHERE "pets"."person_id" = ? [["person_id", 1]]
<add> # person.pets.size # => 3
<add> #
<add> # person.pets
<add> # # => [
<add> # # #<Pet id: 1, name: "Fancy-Fancy", person_id: 1>,
<add> # # #<Pet id: 2, name: "Spook", person_id: 1>,
<add> # # #<Pet id: 3, name: "Choo-Choo", person_id: 1>
<add> # # ]
<add> #
<add> # # Because the collection is already loaded, this will behave like
<add> # <tt>collection.size</tt> and no SQL count query is executed.
<add> # person.pets.size # => 3
<ide>
<ide> ##
<ide> # :method: empty? | 1 |
Text | Text | add v2.8.0-beta.3 to changelog.md | 336974825be2aa061c293561e32a2d1f1a9fd531 | <ide><path>CHANGELOG.md
<ide> # Ember Changelog
<ide>
<add>### 2.8.0-beta.3 (August 15, 2016)
<add>
<add>- [#14009](https://github.com/emberjs/ember.js/pull/14009) [BUGFIX] Fix usage of `role` when used in `attributeBindings`.
<add>- [#14044](https://github.com/emberjs/ember.js/pull/14044) / [#14062](https://github.com/emberjs/ember.js/pull/14062) / [#14066](https://github.com/emberjs/ember.js/pull/14066) [BUGFIX] Update `router.js` so that `getHandlers` is invoked lazily.
<add>- [#14054](https://github.com/emberjs/ember.js/pull/14054) [BUGFIX] Ensure substates properly work with `resetNamespace`.
<add>- [#14033](https://github.com/emberjs/ember.js/pull/14033) [BUGFIX] Ensure `fillIn` acceptance test helper only sets value to first matched element.
<add>- [#14058](https://github.com/emberjs/ember.js/pull/14058) [BUGFIX] Fix issues related to `Ember.Router.map` changes in 2.7.0.
<add>- [#14068](https://github.com/emberjs/ember.js/pull/14068) [BUGFIX] Prevent errors when clicking a `{{link-to}}` during an existing transition.
<add>
<add>
<ide> ### 2.8.0-beta.2 (August 1, 2016)
<ide>
<ide> - [#13887](https://github.com/emberjs/ember.js/pull/13887) [BUGFIX] Add assertions for illegal component invocations. | 1 |
Python | Python | fix train.py for v1.0.0-rc1 | 53fbd3dd1ca1b9e8b09d1b36897a1dc046a19e0c | <ide><path>bin/parser/train.py
<ide> def _merge_sents(sents):
<ide> return [(m_deps, m_brackets)]
<ide>
<ide>
<del>def train(Language, gold_tuples, model_dir, n_iter=15, feat_set=u'basic',
<del> seed=0, gold_preproc=False, n_sents=0, corruption_level=0,
<del> beam_width=1, verbose=False,
<del> use_orig_arc_eager=False, pseudoprojective=False):
<add>def train(Language, gold_tuples, model_dir, tagger_cfg, parser_cfg, entity_cfg,
<add> n_iter=15, seed=0, gold_preproc=False, n_sents=0, corruption_level=0):
<ide> dep_model_dir = path.join(model_dir, 'deps')
<ide> ner_model_dir = path.join(model_dir, 'ner')
<ide> pos_model_dir = path.join(model_dir, 'pos')
<ide> def train(Language, gold_tuples, model_dir, n_iter=15, feat_set=u'basic',
<ide> os.mkdir(ner_model_dir)
<ide> os.mkdir(pos_model_dir)
<ide>
<del> if pseudoprojective:
<add> if parser_cfg['pseudoprojective']:
<ide> # preprocess training data here before ArcEager.get_labels() is called
<ide> gold_tuples = PseudoProjectivity.preprocess_training_data(gold_tuples)
<ide>
<del> Config.write(dep_model_dir, 'config', features=feat_set, seed=seed,
<del> labels=ArcEager.get_labels(gold_tuples),
<del> beam_width=beam_width,projectivize=pseudoprojective)
<del> Config.write(ner_model_dir, 'config', features='ner', seed=seed,
<del> labels=BiluoPushDown.get_labels(gold_tuples),
<del> beam_width=0)
<add> parser_cfg['labels'] = ArcEager.get_labels(gold_tuples)
<add> entity_cfg['labels'] = BiluoPushDown.get_labels(gold_tuples)
<add>
<add> with (dep_model_dir / 'config.json').open('w') as file_:
<add> json.dump(file_, parser_config)
<add> with (ner_model_dir / 'config.json').open('w') as file_:
<add> json.dump(file_, entity_config)
<add> with (pos_model_dir / 'config.json').open('w') as file_:
<add> json.dump(file_, tagger_config)
<ide>
<ide> if n_sents > 0:
<ide> gold_tuples = gold_tuples[:n_sents]
<ide>
<del> nlp = Language(data_dir=model_dir, tagger=False, parser=False, entity=False)
<del> nlp.tagger = Tagger.blank(nlp.vocab, Tagger.default_templates())
<del> nlp.parser = Parser.from_dir(dep_model_dir, nlp.vocab.strings, ArcEager)
<del> nlp.entity = Parser.from_dir(ner_model_dir, nlp.vocab.strings, BiluoPushDown)
<add> nlp = Language(
<add> data_dir=model_dir,
<add> tagger=Tagger.blank(nlp.vocab, **tagger_cfg),
<add> parser=Parser.blank(nlp.vocab, ArcEager, **parser_cfg),
<add> entity=Parser.blank(nlp.vocab, BiluoPushDown, **entity_cfg))
<ide> print("Itn.\tP.Loss\tUAS\tNER F.\tTag %\tToken %")
<ide> for itn in range(n_iter):
<ide> scorer = Scorer()
<ide> def write_parses(Language, dev_loc, model_dir, out_loc):
<ide> )
<ide> def main(language, train_loc, dev_loc, model_dir, n_sents=0, n_iter=15, out_loc="", verbose=False,
<ide> debug=False, corruption_level=0.0, gold_preproc=False, eval_only=False, pseudoprojective=False):
<add> parser_cfg = dict(locals())
<add> tagger_cfg = dict(locals())
<add> entity_cfg = dict(locals())
<add>
<ide> lang = spacy.util.get_lang_class(language)
<ide>
<ide> if not eval_only:
<ide> gold_train = list(read_json_file(train_loc))
<del> train(lang, gold_train, model_dir,
<del> feat_set='basic' if not debug else 'debug',
<del> gold_preproc=gold_preproc, n_sents=n_sents,
<del> corruption_level=corruption_level, n_iter=n_iter,
<del> verbose=verbose,pseudoprojective=pseudoprojective)
<add> train(lang, gold_train, model_dir, tagger_cfg, parser_cfg, entity_cfg,
<add> n_sents=n_sents, gold_preproc=gold_preproc, corruption_level=corruption_level,
<add> n_iter=n_iter)
<ide> if out_loc:
<ide> write_parses(lang, dev_loc, model_dir, out_loc)
<ide> scorer = evaluate(lang, list(read_json_file(dev_loc)), | 1 |
Ruby | Ruby | add tests for argv.filter_for_dependencies | aed70e50e8305e2f2e0dcb80310e0bec20aee429 | <ide><path>Library/Homebrew/test/test_ARGV.rb
<ide> def test_switch?
<ide> assert !ARGV.switch?('-n')
<ide> end
<ide>
<add> def test_filter_for_dependencies_clears_flags
<add> ARGV.unshift("--debug")
<add> ARGV.filter_for_dependencies do
<add> assert ARGV.empty?
<add> end
<add> end
<add>
<add> def test_filter_for_dependencies_ensures_argv_restored
<add> ARGV.expects(:replace).with(ARGV.clone)
<add> begin
<add> ARGV.filter_for_dependencies { raise Exception }
<add> rescue Exception
<add> end
<add> end
<add>
<add> def test_filter_for_dependencies_returns_block_value
<add> assert_equal 1, ARGV.filter_for_dependencies { 1 }
<add> end
<ide> end | 1 |
Text | Text | update readme with blogpost link | 5cd07c0976a8dd379f6b811e21c0fae1e8c87da4 | <ide><path>research/object_detection/README.md
<ide> pipeline configuration files indicating TPU compatibility.
<ide> * Support for quantized training.
<ide> * Updated documentation for new binaries, Cloud training, and [Tensorflow Lite](https://www.tensorflow.org/mobile/tflite/).
<ide>
<add>See also our [expanded announcement blogpost](https://ai.googleblog.com/2018/07/accelerated-training-and-inference-with.html) and accompanying tutorial at the [TensorFlow blog](https://medium.com/@tensorflow/b78971cf1193).
<add>
<ide> <b>Thanks to contributors</b>: Sara Robinson, Aakanksha Chowdhery, Derek Chow,
<ide> Pengchong Jin, Jonathan Huang, Vivek Rathod, Zhichao Lu, Ronny Votel
<ide> | 1 |
Java | Java | reduce the visibility of internal methods. | c9c772fbefecafc5fcb600fab7e16c7657a798b3 | <ide><path>src/main/java/io/reactivex/Completable.java
<ide> public static Completable merge(Publisher<? extends CompletableConsumable> sourc
<ide> * @throws NullPointerException if sources is null
<ide> * @throws IllegalArgumentException if maxConcurrency is less than 1
<ide> */
<del> protected static Completable merge0(Publisher<? extends CompletableConsumable> sources, int maxConcurrency, boolean delayErrors) {
<add> private static Completable merge0(Publisher<? extends CompletableConsumable> sources, int maxConcurrency, boolean delayErrors) {
<ide> Objects.requireNonNull(sources, "sources is null");
<ide> if (maxConcurrency < 1) {
<ide> throw new IllegalArgumentException("maxConcurrency > 0 required but it was " + maxConcurrency);
<ide> public static Completable timer(final long delay, final TimeUnit unit, final Sch
<ide> * @param ex the Throwable instance to use as cause, not null (not verified)
<ide> * @return the created NullPointerException
<ide> */
<del> static NullPointerException toNpe(Throwable ex) {
<add> private static NullPointerException toNpe(Throwable ex) {
<ide> NullPointerException npe = new NullPointerException("Actually not, but can't pass out an exception otherwise...");
<ide> npe.initCause(ex);
<ide> return npe;
<ide> public final Completable doOnError(Consumer<? super Throwable> onError) {
<ide> * @return the new Completable instance
<ide> */
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<del> protected final Completable doOnLifecycle(
<add> private Completable doOnLifecycle(
<ide> final Consumer<? super Disposable> onSubscribe,
<ide> final Consumer<? super Throwable> onError,
<ide> final Runnable onComplete,
<ide> public final Completable timeout(long timeout, TimeUnit unit, Scheduler schedule
<ide> * @throws NullPointerException if unit or scheduler
<ide> */
<ide> @SchedulerSupport(SchedulerSupport.CUSTOM)
<del> public final Completable timeout0(long timeout, TimeUnit unit, Scheduler scheduler, CompletableConsumable other) {
<add> private Completable timeout0(long timeout, TimeUnit unit, Scheduler scheduler, CompletableConsumable other) {
<ide> Objects.requireNonNull(unit, "unit is null");
<ide> Objects.requireNonNull(scheduler, "scheduler is null");
<ide> return new CompletableTimeout(this, timeout, unit, scheduler, other); | 1 |
Ruby | Ruby | move the array to a constant | ca67632674e62426bf8b421d672692592e986091 | <ide><path>activemodel/lib/active_model/validations.rb
<ide> def validates_each(*attr_names, &block)
<ide> validates_with BlockValidator, _merge_attributes(attr_names), &block
<ide> end
<ide>
<add> VALID_OPTIONS_FOR_VALIDATE = [:on, :if, :unless].freeze
<add>
<ide> # Adds a validation method or block to the class. This is useful when
<ide> # overriding the +validate+ instance method becomes too unwieldy and
<ide> # you're looking for more descriptive declaration of your validations.
<ide> def validates_each(*attr_names, &block)
<ide> # value.
<ide> def validate(*args, &block)
<ide> options = args.extract_options!
<del> valid_keys = [:on, :if, :unless]
<ide>
<ide> if args.all? { |arg| arg.is_a?(Symbol) }
<ide> options.each_key do |k|
<del> unless valid_keys.include?(k)
<del> raise ArgumentError.new("Unknown key: #{k.inspect}. Valid keys are: #{valid_keys.map(&:inspect).join(', ')}. Perhaps you meant to call validates instead of validate.")
<add> unless VALID_OPTIONS_FOR_VALIDATE.include?(k)
<add> raise ArgumentError.new("Unknown key: #{k.inspect}. Valid keys are: #{VALID_OPTIONS_FOR_VALIDATE.map(&:inspect).join(', ')}. Perhaps you meant to call `validates` instead of `validate`?")
<ide> end
<ide> end
<ide> end | 1 |
PHP | PHP | fix oauth 1 when consumer key is base64 string | f37b2a93a222e6f1a42483de5f98924784d0f5db | <ide><path>src/Http/Client/Auth/Oauth.php
<ide> protected function _hmacSha1(Request $request, array $credentials): string
<ide> 'oauth_timestamp' => $timestamp,
<ide> 'oauth_signature_method' => 'HMAC-SHA1',
<ide> 'oauth_token' => $credentials['token'],
<del> 'oauth_consumer_key' => $credentials['consumerKey'],
<add> 'oauth_consumer_key' => $this->_encode($credentials['consumerKey']),
<ide> ];
<ide> $baseString = $this->baseString($request, $values);
<ide> | 1 |
Ruby | Ruby | fix depends_on examples in formula page | f5e8b2680e9a94d57666fc8b5e2ff324fb1bd143 | <ide><path>Library/Homebrew/formula.rb
<ide> def go_resource(name, &block)
<ide> # depends_on :x11 # X11/XQuartz components.
<ide> # depends_on :osxfuse # Permits the use of the upstream signed binary or our source package.
<ide> # depends_on :tuntap # Does the same thing as above. This is vital for Yosemite and above.
<del> # depends_on :mysql => :recommended</pre>
<add> # depends_on "mysql" => :recommended</pre>
<ide> # <pre># It is possible to only depend on something if
<ide> # # `build.with?` or `build.without? "another_formula"`:
<del> # depends_on :mysql # allows brewed or external mysql to be used
<del> # depends_on :postgresql if build.without? "sqlite"
<del> # depends_on :hg # Mercurial (external or brewed) is needed</pre>
<add> # depends_on "mysql" # allows brewed or external mysql to be used
<add> # depends_on "postgresql" if build.without? "sqlite"
<add> # depends_on "hg" # Mercurial (external or brewed) is needed</pre>
<ide> #
<ide> # <pre># If any Python >= 2.7 < 3.x is okay (either from macOS or brewed):
<del> # depends_on :python</pre>
<add> # depends_on "python"</pre>
<ide> # <pre># to depend on Python >= 2.7 but use system Python where possible
<del> # depends_on :python if MacOS.version <= :snow_leopard</pre>
<add> # depends_on "python" if MacOS.version <= :snow_leopard</pre>
<ide> # <pre># Python 3.x if the `--with-python3` is given to `brew install example`
<del> # depends_on :python3 => :optional</pre>
<add> # depends_on "python3" => :optional</pre>
<ide> def depends_on(dep)
<ide> specs.each { |spec| spec.depends_on(dep) }
<ide> end | 1 |
Javascript | Javascript | remove variable redeclaration | bbaf0f926d11ea980ac9828cb31fb45108b1d841 | <ide><path>lib/_http_client.js
<ide> function ClientRequest(options, cb) {
<ide> if (self.socketPath) {
<ide> self._last = true;
<ide> self.shouldKeepAlive = false;
<del> var conn = self.agent.createConnection({ path: self.socketPath });
<del> self.onSocket(conn);
<add> self.onSocket(self.agent.createConnection({ path: self.socketPath }));
<ide> } else if (self.agent) {
<ide> // If there is an agent we should default to Connection:keep-alive,
<ide> // but only if the Agent will actually reuse the connection!
<ide> function ClientRequest(options, cb) {
<ide> self._last = true;
<ide> self.shouldKeepAlive = false;
<ide> if (options.createConnection) {
<del> var conn = options.createConnection(options);
<add> self.onSocket(options.createConnection(options));
<ide> } else {
<ide> debug('CLIENT use net.createConnection', options);
<del> var conn = net.createConnection(options);
<add> self.onSocket(net.createConnection(options));
<ide> }
<del> self.onSocket(conn);
<ide> }
<ide>
<ide> self._deferToConnect(null, null, function() { | 1 |
Go | Go | enable `docker search` on private docker registry | 3231033a80451adff73b53554e27fbabfebb4a4f | <ide><path>registry/service.go
<ide> func (s *Service) Search(job *engine.Job) engine.Status {
<ide> job.GetenvJson("authConfig", authConfig)
<ide> job.GetenvJson("metaHeaders", metaHeaders)
<ide>
<add> hostname, term, err := ResolveRepositoryName(term)
<add> if err != nil {
<add> return job.Error(err)
<add> }
<add> hostname, err = ExpandAndVerifyRegistryUrl(hostname)
<add> if err != nil {
<add> return job.Error(err)
<add> }
<ide> r, err := NewSession(authConfig, HTTPRequestFactory(metaHeaders), IndexServerAddress(), true)
<ide> if err != nil {
<ide> return job.Error(err) | 1 |
Text | Text | fix typo `currentfeatures` to `concurrentfeatures` | 7e9f801b47225c692b6dc3d69c26dd2cfa0a760b | <ide><path>docs/advanced-features/react-18.md
<ide> React Server Components allow us to render everything, including the components
<ide>
<ide> ### Enable React Server Components (Alpha)
<ide>
<del>To use React Server Components, ensure you have React 18 installed. Then, turn on the `currentFeatures` and `serverComponents` options in `next.config.js`:
<add>To use React Server Components, ensure you have React 18 installed. Then, turn on the `concurrentFeatures` and `serverComponents` options in `next.config.js`:
<ide>
<ide> ```jsx
<ide> // next.config.js | 1 |
Javascript | Javascript | remove un-needed contructor and function overrides | 6889e925b4ec361f2cfcac1d9bf8feb66c1fc0ab | <ide><path>src/js/big-play-button.js
<ide> import Component from './component.js';
<ide> */
<ide> class BigPlayButton extends Button {
<ide>
<del> constructor(player, options) {
<del> super(player, options);
<del> }
<del>
<ide> /**
<ide> * Allow sub components to stack CSS class names
<ide> *
<ide><path>src/js/button.js
<ide> import assign from 'object.assign';
<ide> */
<ide> class Button extends ClickableComponent {
<ide>
<del> constructor(player, options) {
<del> super(player, options);
<del> }
<del>
<ide> /**
<ide> * Create the component's DOM element
<ide> *
<ide><path>src/js/clickable-component.js
<ide> class ClickableComponent extends Component {
<ide> return `vjs-control vjs-button ${super.buildCSSClass()}`;
<ide> }
<ide>
<del> /**
<del> * Adds a child component inside this clickable-component
<del> *
<del> * @param {String|Component} child The class name or instance of a child to add
<del> * @param {Object=} options Options, including options to be passed to children of the child.
<del> * @return {Component} The child component (created by this process if a string was used)
<del> * @method addChild
<del> */
<del> addChild(child, options = {}) {
<del> // TODO: Fix adding an actionable child to a ClickableComponent; currently
<del> // it will cause issues with assistive technology (e.g. screen readers)
<del> // which support ARIA, since an element with role="button" cannot have
<del> // actionable child elements.
<del>
<del> // let className = this.constructor.name;
<del> // log.warn(`Adding a child to a ClickableComponent (${className}) can cause issues with assistive technology which supports ARIA, since an element with role="button" cannot have actionable child elements.`);
<del>
<del> return super.addChild(child, options);
<del> }
<del>
<ide> /**
<ide> * Enable the component element
<ide> * | 3 |
Javascript | Javascript | fix export mangling for unused default objects | 32ec03f2b2d72fb812923dd224fc0716e4f3ae6c | <ide><path>lib/optimize/MangleExportsPlugin.js
<ide> const mangleExportsInfo = (exportsInfo, canBeArray) => {
<ide> }
<ide> if (
<ide> exportInfo.exportsInfoOwned &&
<del> exportInfo.used === UsageState.OnlyPropertiesUsed
<add> (exportInfo.used === UsageState.OnlyPropertiesUsed ||
<add> exportInfo.used === UsageState.Unused)
<ide> ) {
<ide> mangleExportsInfo(exportInfo.exportsInfo, true);
<ide> } | 1 |
Python | Python | apply reviewer nit | eae806ce8005b608a28debb12825e4b0b5ee374c | <ide><path>numpy/f2py/cfuncs.py
<ide> string_from_pyobj(string *str, int *len, const string inistr, PyObject *obj,
<ide> const char *errmess)
<ide> {
<del> PyArrayObject *arr = NULL;
<ide> PyObject *tmp = NULL;
<ide> string buf = NULL;
<ide> npy_intp n = -1;
<ide> buf = inistr;
<ide> }
<ide> else if (PyArray_Check(obj)) {
<del> arr = (PyArrayObject *)obj;
<add> PyArrayObject *arr = (PyArrayObject *)obj;
<ide> if (!ISCONTIGUOUS(arr)) {
<ide> PyErr_SetString(PyExc_ValueError,
<ide> \"array object is non-contiguous.\"); | 1 |
Go | Go | fix wrong variable name on blkio resources | 8784bd6fdeb7bd87fcbbdee884d42d1dca0c4cca | <ide><path>daemon/daemon_unix.go
<ide> func getBlkioWeightDevices(config containertypes.Resources) ([]specs.WeightDevic
<ide> weight := weightDevice.Weight
<ide> d := specs.WeightDevice{Weight: &weight}
<ide> d.Major = int64(stat.Rdev / 256)
<del> d.Major = int64(stat.Rdev % 256)
<add> d.Minor = int64(stat.Rdev % 256)
<ide> blkioWeightDevices = append(blkioWeightDevices, d)
<ide> }
<ide>
<ide> func getBlkioReadIOpsDevices(config containertypes.Resources) ([]specs.ThrottleD
<ide> rate := iopsDevice.Rate
<ide> d := specs.ThrottleDevice{Rate: &rate}
<ide> d.Major = int64(stat.Rdev / 256)
<del> d.Major = int64(stat.Rdev % 256)
<add> d.Minor = int64(stat.Rdev % 256)
<ide> blkioReadIOpsDevice = append(blkioReadIOpsDevice, d)
<ide> }
<ide>
<ide> func getBlkioWriteIOpsDevices(config containertypes.Resources) ([]specs.Throttle
<ide> rate := iopsDevice.Rate
<ide> d := specs.ThrottleDevice{Rate: &rate}
<ide> d.Major = int64(stat.Rdev / 256)
<del> d.Major = int64(stat.Rdev % 256)
<add> d.Minor = int64(stat.Rdev % 256)
<ide> blkioWriteIOpsDevice = append(blkioWriteIOpsDevice, d)
<ide> }
<ide>
<ide> func getBlkioReadBpsDevices(config containertypes.Resources) ([]specs.ThrottleDe
<ide> rate := bpsDevice.Rate
<ide> d := specs.ThrottleDevice{Rate: &rate}
<ide> d.Major = int64(stat.Rdev / 256)
<del> d.Major = int64(stat.Rdev % 256)
<add> d.Minor = int64(stat.Rdev % 256)
<ide> blkioReadBpsDevice = append(blkioReadBpsDevice, d)
<ide> }
<ide>
<ide> func getBlkioWriteBpsDevices(config containertypes.Resources) ([]specs.ThrottleD
<ide> rate := bpsDevice.Rate
<ide> d := specs.ThrottleDevice{Rate: &rate}
<ide> d.Major = int64(stat.Rdev / 256)
<del> d.Major = int64(stat.Rdev % 256)
<add> d.Minor = int64(stat.Rdev % 256)
<ide> blkioWriteBpsDevice = append(blkioWriteBpsDevice, d)
<ide> }
<ide> | 1 |
Java | Java | accept set<?> instead of set<object> (spr-6742) | 6fcca3cd939af78b83bc80cd295996df2d198b81 | <ide><path>org.springframework.context/src/main/java/org/springframework/context/support/ConversionServiceFactoryBean.java
<ide> /*
<del> * Copyright 2002-2009 the original author or authors.
<add> * Copyright 2002-2010 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> */
<ide> public class ConversionServiceFactoryBean implements FactoryBean<ConversionService>, InitializingBean {
<ide>
<del> private Set<Object> converters;
<add> private Set<?> converters;
<ide>
<ide> private GenericConversionService conversionService;
<ide>
<ide> public class ConversionServiceFactoryBean implements FactoryBean<ConversionServi
<ide> * {@link org.springframework.core.convert.converter.ConverterFactory},
<ide> * or {@link org.springframework.core.convert.converter.GenericConverter}.
<ide> */
<del> public void setConverters(Set<Object> converters) {
<add> public void setConverters(Set<?> converters) {
<ide> this.converters = converters;
<ide> }
<ide>
<ide><path>org.springframework.context/src/main/java/org/springframework/format/support/FormattingConversionServiceFactoryBean.java
<ide> /*
<del> * Copyright 2002-2009 the original author or authors.
<add> * Copyright 2002-2010 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> private static final boolean jodaTimePresent = ClassUtils.isPresent(
<ide> "org.joda.time.DateTime", FormattingConversionService.class.getClassLoader());
<ide>
<del> private Set<Object> converters;
<add> private Set<?> converters;
<ide>
<ide> private FormattingConversionService conversionService;
<ide>
<ide> * {@link org.springframework.core.convert.converter.ConverterFactory},
<ide> * or {@link org.springframework.core.convert.converter.GenericConverter}.
<ide> */
<del> public void setConverters(Set<Object> converters) {
<add> public void setConverters(Set<?> converters) {
<ide> this.converters = converters;
<ide> }
<ide>
<ide><path>org.springframework.core/src/main/java/org/springframework/core/convert/support/ConversionServiceFactory.java
<ide> /*
<del> * Copyright 2002-2009 the original author or authors.
<add> * Copyright 2002-2010 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> public static void addDefaultConverters(GenericConversionService conversionServi
<ide> * {@link ConverterFactory}, or {@link GenericConverter}
<ide> * @param registry the target registry to register with
<ide> */
<del> public static void registerConverters(Set<Object> converters, ConverterRegistry registry) {
<add> public static void registerConverters(Set<?> converters, ConverterRegistry registry) {
<ide> if (converters != null) {
<ide> for (Object converter : converters) {
<ide> if (converter instanceof GenericConverter) { | 3 |
Text | Text | fix typos in n-api | e0b1394cb00a6e4f5a5d4daca486f5bb64836e5a | <ide><path>doc/api/n-api.md
<ide> This API returns the C int32 primitive equivalent
<ide> of the given JavaScript Number. If the number exceeds the range of the
<ide> 32 bit integer, then the result is truncated to the equivalent of the
<ide> bottom 32 bits. This can result in a large positive number becoming
<del>a negative number if the the value is > 2^31 -1.
<add>a negative number if the value is > 2^31 -1.
<ide>
<ide> #### *napi_get_value_int64*
<ide> <!-- YAML
<ide> constructor and methods can be called from JavaScript.
<ide>
<ide> 1. The [`napi_define_class`][] API defines a JavaScript class with constructor,
<ide> static properties and methods, and instance properties and methods that
<del> correspond to the The C++ class.
<add> correspond to the C++ class.
<ide> 2. When JavaScript code invokes the constructor, the constructor callback
<ide> uses [`napi_wrap`][] to wrap a new C++ instance in a JavaScript object,
<ide> then returns the wrapper object. | 1 |
Text | Text | improve definition of a collaborator | 52fe7626068c7110696104139a063942bdb3fd83 | <ide><path>GOVERNANCE.md
<ide> The [nodejs/node](https://github.com/nodejs/node) GitHub repository is
<ide> maintained by Collaborators who are added by the CTC on an ongoing basis.
<ide>
<ide> Individuals identified by the CTC as making significant and valuable
<del>contributions are made Collaborators and given commit access to the project. If
<del>you make a significant contribution and are not considered for commit access,
<del>log an issue or contact a CTC member directly.
<add>contributions across any Node.js repository may be made Collaborators and given
<add>commit access to the project. Activities taken into consideration include (but
<add>are not limited to) the quality of:
<add>
<add>* code commits and pull requests
<add>* documentation commits and pull requests
<add>* comments on issues and pull requests
<add>* contributions to the Node.js website
<add>* assistance provided to end users and novice contributors
<add>* participation in Working Groups
<add>* other participation in the wider Node.js community
<add>
<add>If individuals making valuable contributions do not believe they have been
<add>considered for commit access, they may log an issue or contact a CTC member
<add>directly.
<ide>
<ide> Modifications of the contents of the nodejs/node repository are made on
<ide> a collaborative basis. Anybody with a GitHub account may propose a | 1 |
Javascript | Javascript | add example of directly calling $filter('orderby') | 4a57b1501e9f6d89e9b4d5a3fb328d7bd3193a54 | <ide><path>src/ng/filter/orderBy.js
<ide> </div>
<ide> </file>
<ide> </example>
<add> *
<add> * It's also possible to call the orderBy filter manually, by injecting `$filter`, retrieving the
<add> * filter routine with `$filter('orderBy')`, and calling the returned filter routine with the
<add> * desired parameters.
<add> *
<add> * Example:
<add> *
<add> * @example
<add> <example>
<add> <file name="index.html">
<add> <div ng-controller="Ctrl">
<add> <table class="friend">
<add> <tr>
<add> <th><a href="" ng-click="reverse=false;order('name', false)">Name</a>
<add> (<a href="" ng-click="order('-name',false)">^</a>)</th>
<add> <th><a href="" ng-click="reverse=!reverse;order('phone', reverse)">Phone Number</a></th>
<add> <th><a href="" ng-click="reverse=!reverse;order('age',reverse)">Age</a></th>
<add> </tr>
<add> <tr ng-repeat="friend in friends">
<add> <td>{{friend.name}}</td>
<add> <td>{{friend.phone}}</td>
<add> <td>{{friend.age}}</td>
<add> </tr>
<add> </table>
<add> </div>
<add> </file>
<add>
<add> <file name="script.js">
<add> function Ctrl($scope, $filter) {
<add> var orderBy = $filter('orderBy');
<add> $scope.friends = [
<add> { name: 'John', phone: '555-1212', age: 10 },
<add> { name: 'Mary', phone: '555-9876', age: 19 },
<add> { name: 'Mike', phone: '555-4321', age: 21 },
<add> { name: 'Adam', phone: '555-5678', age: 35 },
<add> { name: 'Julie', phone: '555-8765', age: 29 }
<add> ];
<add>
<add> $scope.order = function(predicate, reverse) {
<add> $scope.friends = orderBy($scope.friends, predicate, reverse);
<add> };
<add> $scope.order('-age',false);
<add> }
<add> </file>
<add></example>
<ide> */
<ide> orderByFilter.$inject = ['$parse'];
<ide> function orderByFilter($parse){ | 1 |
Text | Text | fix inspectport documentation in cluster.md | a3365c6ae91953f404b4e030b9dfba872ce9c77d | <ide><path>doc/api/cluster.md
<ide> values are `"rr"` and `"none"`.
<ide> <!-- YAML
<ide> added: v0.7.1
<ide> changes:
<add> - version: REPLACEME
<add> pr-url: https://github.com/nodejs/node/pull/14140
<add> description: The `inspectPort` option is supported now.
<ide> - version: v6.4.0
<ide> pr-url: https://github.com/nodejs/node/pull/7838
<ide> description: The `stdio` option is supported now.
<ide> changes:
<ide> * `uid` {number} Sets the user identity of the process. (See setuid(2).)
<ide> * `gid` {number} Sets the group identity of the process. (See setgid(2).)
<ide> * `inspectPort` {number|function} Sets inspector port of worker.
<del> Accepts number, or function that evaluates to number. By default
<del> each worker gets port, incremented from master's `process.debugPort`.
<add> This can be a number, or a function that takes no arguments and returns a
<add> number. By default each worker gets its own port, incremented from the
<add> master's `process.debugPort`.
<ide>
<ide> After calling `.setupMaster()` (or `.fork()`) this settings object will contain
<ide> the settings, including the default values. | 1 |
Ruby | Ruby | tell brew doctor to ignore libtrapi.dylib | 8e68a9724de109fe08293c9d35f422d78caa341d | <ide><path>Library/Homebrew/cmd/doctor.rb
<ide> def check_for_stray_dylibs
<ide> "libmacfuse_i64.2.dylib", # OSXFuse MacFuse compatibility layer
<ide> "libosxfuse_i32.2.dylib", # OSXFuse
<ide> "libosxfuse_i64.2.dylib", # OSXFuse
<add> "libTrAPI.dylib", # TrAPI
<ide> ]
<ide>
<ide> __check_stray_files "/usr/local/lib", "*.dylib", white_list, <<-EOS.undent | 1 |
Ruby | Ruby | fix `serial?` with quoted sequence name | 684caf55038234374a17c1e010e8b18d2dc0c90f | <ide><path>activerecord/lib/active_record/connection_adapters/postgresql/column.rb
<ide> class PostgreSQLColumn < Column #:nodoc:
<ide> def serial?
<ide> return unless default_function
<ide>
<del> %r{\Anextval\('(?<table_name>.+)_#{name}_seq'::regclass\)\z} === default_function
<add> table_name = @table_name || '(?<table_name>.+)'
<add> %r{\Anextval\('"?#{table_name}_#{name}_seq"?'::regclass\)\z} === default_function
<ide> end
<ide> end
<ide> end
<ide><path>activerecord/test/cases/primary_keys_test.rb
<ide> def test_primary_key_update_with_custom_key_name
<ide> dashboard = Dashboard.first
<ide> assert_equal '2', dashboard.id
<ide> end
<add>
<add> if current_adapter?(:PostgreSQLAdapter)
<add> def test_serial_with_quoted_sequence_name
<add> column = MixedCaseMonkey.columns_hash[MixedCaseMonkey.primary_key]
<add> assert_equal "nextval('\"mixed_case_monkeys_monkeyID_seq\"'::regclass)", column.default_function
<add> assert column.serial?
<add> end
<add> end
<ide> end
<ide>
<ide> class PrimaryKeyWithNoConnectionTest < ActiveRecord::TestCase | 2 |
Python | Python | add nested create for 1to1 reverse relationships | 72c04d570d167209f3f34d6d78492426f206b245 | <ide><path>rest_framework/serializers.py
<ide> def __init__(self, meta):
<ide> self.exclude = getattr(meta, 'exclude', ())
<ide>
<ide>
<del>class BaseSerializer(Field):
<add>class BaseSerializer(WritableField):
<ide> class Meta(object):
<ide> pass
<ide>
<ide> def restore_fields(self, data, files):
<ide> try:
<ide> field.field_from_native(data, files, field_name, reverted_data)
<ide> except ValidationError as err:
<del> self._errors[field_name] = list(err.messages)
<add> if hasattr(err, 'message_dict'):
<add> self._errors[field_name] = [err.message_dict]
<add> else:
<add> self._errors[field_name] = list(err.messages)
<ide>
<ide> return reverted_data
<ide>
<ide> class ModelSerializer(Serializer):
<ide> """
<ide> _options_class = ModelSerializerOptions
<ide>
<add> def field_from_native(self, data, files, field_name, into):
<add> if self.read_only:
<add> return
<add>
<add> try:
<add> native = data[field_name]
<add> except KeyError:
<add> if self.required:
<add> raise ValidationError(self.error_messages['required'])
<add> return
<add>
<add> obj = self.from_native(native, files)
<add> if not self._errors:
<add> self.object = obj
<add> into[self.source or field_name] = self
<add> else:
<add> # Propagate errors up to our parent
<add> raise ValidationError(self._errors)
<add>
<ide> def get_default_fields(self):
<ide> """
<ide> Return all the fields that should be serialized for the model.
<ide> def restore_object(self, attrs, instance=None):
<ide>
<ide> return instance
<ide>
<del> def save(self):
<del> """
<del> Save the deserialized object and return it.
<del> """
<add> def _save(self, parent=None, fk_field=None):
<add> if parent and fk_field:
<add> setattr(self.object, fk_field, parent)
<ide> self.object.save()
<ide>
<ide> if getattr(self, 'm2m_data', None):
<ide> def save(self):
<ide>
<ide> if getattr(self, 'related_data', None):
<ide> for accessor_name, object_list in self.related_data.items():
<del> setattr(self.object, accessor_name, object_list)
<add> if isinstance(object_list, ModelSerializer):
<add> fk_field = self.object._meta.get_field_by_name(accessor_name)[0].field.name
<add> object_list._save(parent=self.object, fk_field=fk_field)
<add> else:
<add> setattr(self.object, accessor_name, object_list)
<ide> self.related_data = {}
<del>
<add>
<add> def save(self):
<add> """
<add> Save the deserialized object and return it.
<add> """
<add> self._save()
<ide> return self.object
<ide>
<ide>
<ide><path>rest_framework/tests/nesting.py
<add>from django.db import models
<add>from django.test import TestCase
<add>from rest_framework import serializers
<add>
<add>
<add>class OneToOneTarget(models.Model):
<add> name = models.CharField(max_length=100)
<add>
<add>
<add>class OneToOneTargetSource(models.Model):
<add> name = models.CharField(max_length=100)
<add> target = models.OneToOneField(OneToOneTarget, related_name='target_source')
<add>
<add>
<add>class OneToOneSource(models.Model):
<add> name = models.CharField(max_length=100)
<add> target_source = models.OneToOneField(OneToOneTargetSource, related_name='source')
<add>
<add>
<add>class OneToOneSourceSerializer(serializers.ModelSerializer):
<add> class Meta:
<add> model = OneToOneSource
<add> exclude = ('target_source', )
<add>
<add>
<add>class OneToOneTargetSourceSerializer(serializers.ModelSerializer):
<add> source = OneToOneSourceSerializer()
<add>
<add> class Meta:
<add> model = OneToOneTargetSource
<add> exclude = ('target', )
<add>
<add>class OneToOneTargetSerializer(serializers.ModelSerializer):
<add> target_source = OneToOneTargetSourceSerializer()
<add>
<add> class Meta:
<add> model = OneToOneTarget
<add>
<add>
<add>class NestedOneToOneTests(TestCase):
<add> def setUp(self):
<add> #import pdb ; pdb.set_trace()
<add> for idx in range(1, 4):
<add> target = OneToOneTarget(name='target-%d' % idx)
<add> target.save()
<add> target_source = OneToOneTargetSource(name='target-source-%d' % idx, target=target)
<add> target_source.save()
<add> source = OneToOneSource(name='source-%d' % idx, target_source=target_source)
<add> source.save()
<add>
<add> def test_foreign_key_retrieve(self):
<add> queryset = OneToOneTarget.objects.all()
<add> serializer = OneToOneTargetSerializer(queryset)
<add> expected = [
<add> {'id': 1, 'name': u'target-1', 'target_source': {'id': 1, 'name': u'target-source-1', 'source': {'id': 1, 'name': u'source-1'}}},
<add> {'id': 2, 'name': u'target-2', 'target_source': {'id': 2, 'name': u'target-source-2', 'source': {'id': 2, 'name': u'source-2'}}},
<add> {'id': 3, 'name': u'target-3', 'target_source': {'id': 3, 'name': u'target-source-3', 'source': {'id': 3, 'name': u'source-3'}}}
<add> ]
<add> self.assertEquals(serializer.data, expected)
<add>
<add>
<add> def test_foreign_key_create(self):
<add> data = {'id': 4, 'name': u'target-4', 'target_source': {'id': 4, 'name': u'target-source-4', 'source': {'id': 4, 'name': u'source-4'}}}
<add> serializer = OneToOneTargetSerializer(data=data)
<add> self.assertTrue(serializer.is_valid())
<add> obj = serializer.save()
<add> self.assertEquals(serializer.data, data)
<add> self.assertEqual(obj.name, u'target-4')
<add>
<add> # Ensure (source 4, target 4) is added, and everything else is as expected
<add> queryset = OneToOneTarget.objects.all()
<add> serializer = OneToOneTargetSerializer(queryset)
<add> expected = [
<add> {'id': 1, 'name': u'target-1', 'target_source': {'id': 1, 'name': u'target-source-1', 'source': {'id': 1, 'name': u'source-1'}}},
<add> {'id': 2, 'name': u'target-2', 'target_source': {'id': 2, 'name': u'target-source-2', 'source': {'id': 2, 'name': u'source-2'}}},
<add> {'id': 3, 'name': u'target-3', 'target_source': {'id': 3, 'name': u'target-source-3', 'source': {'id': 3, 'name': u'source-3'}}},
<add> {'id': 4, 'name': u'target-4', 'target_source': {'id': 4, 'name': u'target-source-4', 'source': {'id': 4, 'name': u'source-4'}}}
<add> ]
<add> self.assertEquals(serializer.data, expected)
<add>
<add> def test_foreign_key_create_with_invalid_data(self):
<add> data = {'id': 4, 'name': u'target-4', 'target_source': {'id': 4, 'name': u'target-source-4', 'source': {'id': 4}}}
<add> serializer = OneToOneTargetSerializer(data=data)
<add> self.assertFalse(serializer.is_valid())
<add> self.assertEquals(serializer.errors, {'target_source': [{'source': [{'name': [u'This field is required.']}]}]}) | 2 |
Python | Python | fix possible typo | 20f62e828b2ed100f7aa907b60880c8938593740 | <ide><path>tests/test_basic.py
<ide> def subdomain():
<ide>
<ide>
<ide> def test_exception_propagation():
<del> def apprunner(configkey):
<add> def apprunner(config_key):
<ide> app = flask.Flask(__name__)
<ide> app.config['LOGGER_HANDLER_POLICY'] = 'never'
<ide> | 1 |
Python | Python | remove dead code | cb491894776ab6c2d72d163b06a935db14ce8b86 | <ide><path>spacy/language.py
<ide> def end_training(self, path=None):
<ide> (ENT_TYPE, entity_type_freqs),
<ide> (HEAD, head_freqs)
<ide> ]))
<del>
<del> def get_defaults(self, path):
<del> return self.Defaults(self.lang, path) | 1 |
Ruby | Ruby | remove prefix option and add reason argument name | fb3bfbb65c75227abce523aa2446c3e8f390e3da | <ide><path>Library/Homebrew/formula.rb
<ide> def service(&block)
<ide> # the {Formula} will be built from source and `reason` will be printed.
<ide> #
<ide> # Alternatively, a preset reason can be passed as a symbol:
<del> # <pre>pour_bottle? :default_prefix_required</pre>
<del> # <pre>pour_bottle? :clt_required</pre>
<del> def pour_bottle?(requirement = nil, &block)
<add> # <pre>pour_bottle? reason: :clt_required</pre>
<add> def pour_bottle?(reason: nil, &block)
<ide> @pour_bottle_check = PourBottleCheck.new(self)
<ide>
<del> block ||= case requirement
<del> when :default_prefix_required
<del> lambda do |_|
<del> T.cast(self, PourBottleCheck).reason(+<<~EOS)
<del> The bottle needs to be installed into #{Homebrew::DEFAULT_PREFIX}.
<del> EOS
<del> T.cast(self, PourBottleCheck).satisfy { HOMEBREW_PREFIX.to_s == Homebrew::DEFAULT_PREFIX }
<del> end
<del> when :clt_required
<del> lambda do |_|
<add> if reason == :clt_required
<add> block = lambda do |_|
<ide> on_macos do
<ide> T.cast(self, PourBottleCheck).reason(+<<~EOS)
<ide> The bottle needs the Apple Command Line Tools to be installed.
<ide><path>Library/Homebrew/test/formula_spec.rb
<ide> def pour_bottle?
<ide> end
<ide>
<ide> it "returns false when set with a symbol" do
<del> # Ensure that prefix does not match the default
<del> stub_const "Homebrew::DEFAULT_PREFIX", "foo"
<add> # Pretend CLT is not installed
<add> allow(MacOS::CLT).to receive(:installed?).and_return(false)
<ide>
<ide> f = formula "foo" do
<ide> url "foo-1.0"
<ide>
<del> pour_bottle? :default_prefix_required
<add> pour_bottle? reason: :clt_required
<ide> end
<ide>
<ide> expect(f).not_to pour_bottle
<ide> end
<ide>
<ide> it "returns true when set with a symbol" do
<del> # Ensure that prefix matches the default
<del> stub_const "Homebrew::DEFAULT_PREFIX", HOMEBREW_PREFIX.to_s
<add> # Pretend CLT is installed
<add> allow(MacOS::CLT).to receive(:installed?).and_return(true)
<ide>
<ide> f = formula "foo" do
<ide> url "foo-1.0"
<ide>
<del> pour_bottle? :default_prefix_required
<add> pour_bottle? reason: :clt_required
<ide> end
<ide>
<ide> expect(f).to pour_bottle | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.