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 | create card for model gpt-2-finetuned-cord19 | 7420a6a9cc1750c2bd2c2c245d00048ec36d3bf0 | <ide><path>model_cards/mrm8488/GPT-2-finetuned-CORD19/README.md
<add>---
<add>language: english
<add>thumbnail:
<add>---
<add>
<add># GPT-2 + CORD19 dataset : 🦠 ✍ ⚕
<add>
<add>**GPT-2** fine-tuned on **biorxiv_medrxiv** and **comm_use_subset files** from [CORD-19](https://www.kaggle.com/allen-institute-for-ai/CORD-19-research-challenge) dataset.
<add>
<add>
<add>## Datasets details:
<add>
<add>| Dataset | # Files |
<add>| ---------------------- | ----- |
<add>| biorxiv_medrxiv | 885 |
<add>| comm_use_subse | 9K |
<add>
<add>## Model training
<add>
<add>The model was trained on a Tesla P100 GPU and 25GB of RAM with the following command:
<add>
<add>```bash
<add>
<add>export TRAIN_FILE=/path/to/dataset/train.txt
<add>
<add>python run_language_modeling.py \
<add> --model_type gpt2 \
<add> --model_name_or_path gpt2 \
<add> --do_train \
<add> --train_data_file $TRAIN_FILE \
<add> --num_train_epochs 4 \
<add> --output_dir model_output \
<add> --overwrite_output_dir \
<add> --save_steps 10000 \
<add> --per_gpu_train_batch_size 3
<add>```
<add>
<add><img alt="training loss" src="https://svgshare.com/i/JTf.svg' title='GTP-2-finetuned-CORDS19-loss" width="600" height="300" />
<add>
<add>## Model in action / Example of usage: ✒
<add>
<add>You can get the following script [here](https://github.com/huggingface/transformers/blob/master/examples/run_generation.py)
<add>
<add>```bash
<add>python run_generation.py \
<add> --model_type gpt2 \
<add> --model_name_or_path mrm8488/GPT-2-finetuned-CORD19 \
<add> --length 200
<add>```
<add>```txt
<add># Input: the effects of COVID-19 on the lungs
<add># Output: === GENERATED SEQUENCE 1 ===
<add>the effects of COVID-19 on the lungs are currently debated (86). The role of this virus in the pathogenesis of pneumonia and lung cancer is still debated. MERS-CoV is also known to cause acute respiratory distress syndrome (87) and is associated with increased expression of pulmonary fibrosis markers (88). Thus, early airway inflammation may play an important role in the pathogenesis of coronavirus pneumonia and may contribute to the severe disease and/or mortality observed in coronavirus patients.
<add>Pneumonia is an acute, often fatal disease characterized by severe edema, leakage of oxygen and bronchiolar inflammation. Viruses include coronaviruses, and the role of oxygen depletion is complicated by lung injury and fibrosis in the lung, in addition to susceptibility to other lung diseases. The progression of the disease may be variable, depending on the lung injury, pathologic role, prognosis, and the immune status of the patient. Inflammatory responses to respiratory viruses cause various pathologies of the respiratory
<add>```
<add>
<add>
<add>> Created by [Manuel Romero/@mrm8488](https://twitter.com/mrm8488) | [LinkedIn](https://www.linkedin.com/in/manuel-romero-cs/)
<add>
<add>> Made with <span style="color: #e25555;">♥</span> in Spain | 1 |
Text | Text | clarify socket.setnodelay() explanation | 0fe810168bef2a53e5ff6b2f7832e372f850e5f3 | <ide><path>doc/api/net.md
<ide> added: v0.1.90
<ide> * `noDelay` {boolean} **Default:** `true`
<ide> * Returns: {net.Socket} The socket itself.
<ide>
<del>Disables the Nagle algorithm. By default TCP connections use the Nagle
<del>algorithm, they buffer data before sending it off. Setting `true` for
<del>`noDelay` will immediately fire off data each time `socket.write()` is called.
<add>Enable/disable the use of Nagle's algorithm.
<add>
<add>When a TCP connection is created, it will have Nagle's algorithm enabled.
<add>
<add>Nagle's algorithm delays data before it is sent via the network. It attempts
<add>to optimize throughput at the expense of latency.
<add>
<add>Passing `true` for `noDelay` or not passing an argument will disable Nagle's
<add>algorithm for the socket. Passing `false` for `noDelay` will enable Nagle's
<add>algorithm.
<ide>
<ide> ### `socket.setTimeout(timeout[, callback])`
<ide> <!-- YAML | 1 |
Javascript | Javascript | release script clarifies which test fixture failed | 33cb3f04f14638e9344dc59ae956f9805c07ab07 | <ide><path>scripts/release/shared-commands/test-packaging-fixture.js
<ide> const run = async ({cwd}) => {
<ide> }
<ide>
<ide> if (errorMessage) {
<del> console.error(theme.error(errorMessage));
<add> console.error(
<add> theme.error('✗'),
<add> 'Verifying "packaging" fixture\n ',
<add> theme.error(errorMessage)
<add> );
<ide> process.exit(1);
<ide> }
<ide> };
<ide><path>scripts/release/shared-commands/test-tracing-fixture.js
<ide> const run = async ({cwd}) => {
<ide> 'Verifying "scheduler/tracing" fixture'
<ide> );
<ide> if (errorMessage) {
<del> console.error(theme.error(errorMessage));
<add> console.error(
<add> theme.error('✗'),
<add> 'Verifying "scheduler/tracing" fixture\n ',
<add> theme.error(errorMessage)
<add> );
<ide> process.exit(1);
<ide> }
<ide> }; | 2 |
Ruby | Ruby | ensure original encoding doesnt change | 86dd2f32764ef3f141d9b24a47725b004fd4ac71 | <ide><path>activesupport/test/multibyte_chars_test.rb
<ide> def test_forwarded_bang_method_calls_should_return_nil_when_result_is_nil
<ide> end
<ide>
<ide> def test_methods_are_forwarded_to_wrapped_string_for_byte_strings
<add> original_encoding = BYTE_STRING.encoding
<ide> assert_equal BYTE_STRING.length, BYTE_STRING.mb_chars.length
<add> ensure
<add> BYTE_STRING.force_encoding(original_encoding)
<ide> end
<ide>
<ide> def test_forwarded_method_with_non_string_result_should_be_returned_vertabim | 1 |
Mixed | Ruby | qualify column names in calculation | a7628099de796a2db2c18e946dab319abd0fcba2 | <ide><path>activerecord/CHANGELOG.md
<add>* Qualify column name inserted by `group` in calculation
<add>
<add> Giving `group` an unqualified column name now works, even if the relation
<add> has `JOIN` with another table which also has a column of the name.
<add>
<add> *Soutaro Matsumoto*
<add>
<ide> * Don't cache prepared statements containing an IN clause or a SQL literal, as
<ide> these queries will change often and are unlikely to have a cache hit.
<ide>
<ide><path>activerecord/lib/active_record/relation/calculations.rb
<ide> def execute_grouped_calculation(operation, column_name, distinct) #:nodoc:
<ide> ]
<ide> select_values += select_values unless having_clause.empty?
<ide>
<del> select_values.concat group_fields.zip(group_aliases).map { |field,aliaz|
<add> select_values.concat arel_columns(group_fields).zip(group_aliases).map { |field,aliaz|
<ide> if field.respond_to?(:as)
<ide> field.as(aliaz)
<ide> else
<ide><path>activerecord/test/cases/calculations_test.rb
<ide> def test_should_group_by_summed_field
<ide> assert_equal 60, c[2]
<ide> end
<ide>
<add> def test_should_generate_valid_sql_with_joins_and_group
<add> assert_nothing_raised ActiveRecord::StatementInvalid do
<add> AuditLog.joins(:developer).group(:id).count
<add> end
<add> end
<add>
<add> def test_should_calculate_against_given_relation
<add> developer = Developer.create!(name: "developer")
<add> developer.audit_logs.create!(message: "first log")
<add> developer.audit_logs.create!(message: "second log")
<add>
<add> c = developer.audit_logs.joins(:developer).group(:id).count
<add>
<add> assert_equal developer.audit_logs.count, c.size
<add> developer.audit_logs.each do |log|
<add> assert_equal 1, c[log.id]
<add> end
<add> end
<add>
<ide> def test_should_order_by_grouped_field
<ide> c = Account.group(:firm_id).order("firm_id").sum(:credit_limit)
<ide> assert_equal [1, 2, 6, 9], c.keys.compact | 3 |
Text | Text | create yaph.md so i can contribute | e7e5999ddc37ea1b69b3453cef0ae297ad334d68 | <ide><path>.github/contributors/yaph.md
<add># spaCy contributor agreement
<add>
<add>This spaCy Contributor Agreement (**"SCA"**) is based on the
<add>[Oracle Contributor Agreement](http://www.oracle.com/technetwork/oca-405177.pdf).
<add>The SCA applies to any contribution that you make to any product or project
<add>managed by us (the **"project"**), and sets out the intellectual property rights
<add>you grant to us in the contributed materials. The term **"us"** shall mean
<add>[ExplosionAI GmbH](https://explosion.ai/legal). The term
<add>**"you"** shall mean the person or entity identified below.
<add>
<add>If you agree to be bound by these terms, fill in the information requested
<add>below and include the filled-in version with your first pull request, under the
<add>folder [`.github/contributors/`](/.github/contributors/). The name of the file
<add>should be your GitHub username, with the extension `.md`. For example, the user
<add>example_user would create the file `.github/contributors/example_user.md`.
<add>
<add>Read this agreement carefully before signing. These terms and conditions
<add>constitute a binding legal agreement.
<add>
<add>## Contributor Agreement
<add>
<add>1. The term "contribution" or "contributed materials" means any source code,
<add>object code, patch, tool, sample, graphic, specification, manual,
<add>documentation, or any other material posted or submitted by you to the project.
<add>
<add>2. With respect to any worldwide copyrights, or copyright applications and
<add>registrations, in your contribution:
<add>
<add> * you hereby assign to us joint ownership, and to the extent that such
<add> assignment is or becomes invalid, ineffective or unenforceable, you hereby
<add> grant to us a perpetual, irrevocable, non-exclusive, worldwide, no-charge,
<add> royalty-free, unrestricted license to exercise all rights under those
<add> copyrights. This includes, at our option, the right to sublicense these same
<add> rights to third parties through multiple levels of sublicensees or other
<add> licensing arrangements;
<add>
<add> * you agree that each of us can do all things in relation to your
<add> contribution as if each of us were the sole owners, and if one of us makes
<add> a derivative work of your contribution, the one who makes the derivative
<add> work (or has it made will be the sole owner of that derivative work;
<add>
<add> * you agree that you will not assert any moral rights in your contribution
<add> against us, our licensees or transferees;
<add>
<add> * you agree that we may register a copyright in your contribution and
<add> exercise all ownership rights associated with it; and
<add>
<add> * you agree that neither of us has any duty to consult with, obtain the
<add> consent of, pay or render an accounting to the other for any use or
<add> distribution of your contribution.
<add>
<add>3. With respect to any patents you own, or that you can license without payment
<add>to any third party, you hereby grant to us a perpetual, irrevocable,
<add>non-exclusive, worldwide, no-charge, royalty-free license to:
<add>
<add> * make, have made, use, sell, offer to sell, import, and otherwise transfer
<add> your contribution in whole or in part, alone or in combination with or
<add> included in any product, work or materials arising out of the project to
<add> which your contribution was submitted, and
<add>
<add> * at our option, to sublicense these same rights to third parties through
<add> multiple levels of sublicensees or other licensing arrangements.
<add>
<add>4. Except as set out above, you keep all right, title, and interest in your
<add>contribution. The rights that you grant to us under these terms are effective
<add>on the date you first submitted a contribution to us, even if your submission
<add>took place before the date you sign these terms.
<add>
<add>5. You covenant, represent, warrant and agree that:
<add>
<add> * Each contribution that you submit is and shall be an original work of
<add> authorship and you can legally grant the rights set out in this SCA;
<add>
<add> * to the best of your knowledge, each contribution will not violate any
<add> third party's copyrights, trademarks, patents, or other intellectual
<add> property rights; and
<add>
<add> * each contribution shall be in compliance with U.S. export control laws and
<add> other applicable export and import laws. You agree to notify us if you
<add> become aware of any circumstance which would make any of the foregoing
<add> representations inaccurate in any respect. We may publicly disclose your
<add> participation in the project, including the fact that you have signed the SCA.
<add>
<add>6. This SCA is governed by the laws of the State of California and applicable
<add>U.S. Federal law. Any choice of law rules will not apply.
<add>
<add>7. Please place an “x” on one of the applicable statement below. Please do NOT
<add>mark both statements:
<add>
<add> * [x] I am signing on behalf of myself as an individual and no other person
<add> or entity, including my employer, has or will have rights with respect to my
<add> contributions.
<add>
<add> * [ ] I am signing on behalf of my employer or a legal entity and I have the
<add> actual authority to contractually bind that entity.
<add>
<add>## Contributor Details
<add>
<add>| Field | Entry |
<add>|------------------------------- | -------------------- |
<add>| Name | Ramiro Gómez |
<add>| Company name (if applicable) | |
<add>| Title or role (if applicable) | |
<add>| Date | 2019-04-29 |
<add>| GitHub username | yaph |
<add>| Website (optional) | http://ramiro.org/ | | 1 |
PHP | PHP | apply fixes from styleci | 1aa66d78726bcaf3ff648d1bc318f157cab3df82 | <ide><path>src/Illuminate/Support/Stringable.php
<ide> namespace Illuminate\Support;
<ide>
<ide> use Closure;
<del>use Illuminate\Support\Str;
<ide> use Illuminate\Support\Traits\Macroable;
<ide>
<ide> class Stringable
<ide><path>tests/Support/SupportStringableTest.php
<ide> use Illuminate\Support\Stringable;
<ide> use PHPUnit\Framework\TestCase;
<ide>
<del>class SupportStrTest extends TestCase
<add>class SupportStringableTest extends TestCase
<ide> {
<ide> public function testMatch()
<ide> { | 2 |
Ruby | Ruby | fix chars.reverse for multibyte decomposed strings | 23780850237876cf81038534d8f59fa307af0b31 | <ide><path>activesupport/lib/active_support/multibyte/chars.rb
<ide> def size
<ide> # Example:
<ide> # 'Café'.mb_chars.reverse.to_s #=> 'éfaC'
<ide> def reverse
<del> chars(self.class.u_unpack(@wrapped_string).reverse.pack('U*'))
<add> chars(self.class.g_unpack(@wrapped_string).reverse.flatten.pack('U*'))
<ide> end
<ide>
<ide> # Implements Unicode-aware slice with codepoints. Slicing on one point returns the codepoints for that
<ide><path>activesupport/test/multibyte_chars_test.rb
<ide> def test_reverse_reverses_characters
<ide> assert_equal 'わちにこ', @chars.reverse
<ide> end
<ide>
<add> def test_reverse_should_work_with_normalized_strings
<add> str = 'bös'
<add> reversed_str = 'söb'
<add> assert_equal chars(reversed_str).normalize(:kc), chars(str).normalize(:kc).reverse
<add> assert_equal chars(reversed_str).normalize(:c), chars(str).normalize(:c).reverse
<add> assert_equal chars(reversed_str).normalize(:d), chars(str).normalize(:d).reverse
<add> assert_equal chars(reversed_str).normalize(:kd), chars(str).normalize(:kd).reverse
<add> assert_equal chars(reversed_str).decompose, chars(str).decompose.reverse
<add> assert_equal chars(reversed_str).compose, chars(str).compose.reverse
<add> end
<add>
<ide> def test_slice_should_take_character_offsets
<ide> assert_equal nil, ''.mb_chars.slice(0)
<ide> assert_equal 'こ', @chars.slice(0) | 2 |
Go | Go | remove bridgeip from ipallocation pool | f4551b8a48bdc7a135466398eecfb103fcde25c6 | <ide><path>daemon/networkdriver/bridge/driver.go
<ide> func InitDriver(job *engine.Job) engine.Status {
<ide> }
<ide> }
<ide>
<add> // Block BridgeIP in IP allocator
<add> ipallocator.RequestIP(bridgeNetwork, bridgeNetwork.IP)
<add>
<ide> // https://github.com/docker/docker/issues/2768
<ide> job.Eng.Hack_SetGlobalVar("httpapi.bridgeIP", bridgeNetwork.IP)
<ide>
<ide><path>daemon/networkdriver/ipallocator/allocator.go
<ide> func (allocated *allocatedMap) checkIP(ip net.IP) (net.IP, error) {
<ide>
<ide> // Register the IP.
<ide> allocated.p[ip.String()] = struct{}{}
<del> allocated.last.Set(pos)
<ide>
<ide> return ip, nil
<ide> } | 2 |
Python | Python | change zero_debias=false to zero_debias=true | 3ce40705a7235cabe81cfaa2ab9b9d56f225af52 | <ide><path>keras/backend/tensorflow_backend.py
<ide> def moving_average_update(x, value, momentum):
<ide> An operation to update the variable.
<ide> """
<ide> return moving_averages.assign_moving_average(
<del> x, value, momentum, zero_debias=False)
<add> x, value, momentum, zero_debias=True)
<ide>
<ide>
<ide> # LINEAR ALGEBRA | 1 |
Python | Python | fix types in scorer | c689ae8f0a81041ed3c2eb9cae9926b7842715bc | <ide><path>spacy/scorer.py
<ide> import numpy as np
<ide>
<ide> from .gold import Example
<del>from .tokens import Token
<add>from .tokens import Token, Doc
<ide> from .errors import Errors
<ide> from .util import get_lang_class
<ide> from .morphology import Morphology
<ide> def to_dict(self) -> Dict[str, float]:
<ide> class ROCAUCScore:
<ide> """An AUC ROC score."""
<ide>
<del> def __init__(self):
<add> def __init__(self) -> None:
<ide> self.golds = []
<ide> self.cands = []
<ide> self.saved_score = 0.0
<ide> def score_spans(
<ide> examples: Iterable[Example],
<ide> attr: str,
<ide> *,
<del> getter: Callable[[Token, str], Any] = getattr,
<add> getter: Callable[[Doc, str], Any] = getattr,
<ide> **cfg,
<ide> ) -> Dict[str, Any]:
<ide> """Returns PRF scores for labeled spans.
<ide>
<ide> examples (Iterable[Example]): Examples to score
<ide> attr (str): The attribute to score.
<del> getter (Callable[[Token, str], Any]): Defaults to getattr. If provided,
<add> getter (Callable[[Doc, str], Any]): Defaults to getattr. If provided,
<ide> getter(doc, attr) should return the spans for the individual doc.
<ide> RETURNS (Dict[str, Any]): A dictionary containing the PRF scores under
<ide> the keys attr_p/r/f and the per-type PRF scores under attr_per_type.
<ide> def score_cats(
<ide> examples: Iterable[Example],
<ide> attr: str,
<ide> *,
<del> getter: Callable[[Token, str], Any] = getattr,
<add> getter: Callable[[Doc, str], Any] = getattr,
<ide> labels: Iterable[str] = tuple(),
<ide> multi_label: bool = True,
<ide> positive_label: Optional[str] = None,
<ide> def score_cats(
<ide>
<ide> examples (Iterable[Example]): Examples to score
<ide> attr (str): The attribute to score.
<del> getter (Callable[[Token, str], Any]): Defaults to getattr. If provided,
<add> getter (Callable[[Doc, str], Any]): Defaults to getattr. If provided,
<ide> getter(doc, attr) should return the values for the individual doc.
<ide> labels (Iterable[str]): The set of possible labels. Defaults to [].
<ide> multi_label (bool): Whether the attribute allows multiple labels. | 1 |
Javascript | Javascript | build reactdom browser builds into react-dom/dist | ff542de59df93a7e33fab229d2b848233ee317da | <ide><path>Gruntfile.js
<ide> module.exports = function(grunt) {
<ide> grunt.registerTask('npm-react:pack', npmReactTasks.packRelease);
<ide>
<ide> var npmReactDOMTasks = require('./grunt/tasks/npm-react-dom');
<add> grunt.registerTask('npm-react-dom:release', npmReactDOMTasks.buildRelease);
<ide> grunt.registerTask('npm-react-dom:pack', npmReactDOMTasks.packRelease);
<ide>
<ide> var npmReactAddonsTasks = require('./grunt/tasks/npm-react-addons');
<ide> module.exports = function(grunt) {
<ide> 'build:react-dom',
<ide> 'npm-react:release',
<ide> 'npm-react:pack',
<add> 'npm-react-dom:release',
<ide> 'npm-react-dom:pack',
<ide> 'npm-react-addons:release',
<ide> 'npm-react-addons:pack',
<ide><path>grunt/tasks/npm-react-dom.js
<ide> var fs = require('fs');
<ide> var grunt = require('grunt');
<ide>
<add>var src = 'packages/react-dom/';
<add>var dest = 'build/packages/react-dom/';
<add>var dist = dest + 'dist/';
<add>var distFiles = [
<add> 'react-dom.js',
<add> 'react-dom.min.js',
<add>];
<add>
<add>function buildRelease() {
<add> if (grunt.file.exists(dest)) {
<add> grunt.file.delete(dest);
<add> }
<add>
<add> // Copy to build/packages/react-dom
<add> var mappings = [].concat(
<add> grunt.file.expandMapping('**/*', dest, {cwd: src})
<add> );
<add> mappings.forEach(function(mapping) {
<add> var mappingSrc = mapping.src[0];
<add> var mappingDest = mapping.dest;
<add> if (grunt.file.isDir(mappingSrc)) {
<add> grunt.file.mkdir(mappingDest);
<add> } else {
<add> grunt.file.copy(mappingSrc, mappingDest);
<add> }
<add> });
<add>
<add> // Make built source available inside npm package
<add> grunt.file.mkdir(dist);
<add> distFiles.forEach(function(file) {
<add> grunt.file.copy('build/' + file, dist + file);
<add> });
<add>}
<add>
<ide> function packRelease() {
<ide> var done = this.async();
<ide> var spawnCmd = {
<ide> cmd: 'npm',
<del> args: ['pack', 'packages/react-dom'],
<add> args: ['pack', 'react-dom'],
<add> opts: {
<add> cwd: 'build/packages/',
<add> },
<ide> };
<ide> grunt.util.spawn(spawnCmd, function() {
<del> var buildSrc = 'react-dom-' + grunt.config.data.pkg.version + '.tgz';
<del> var buildDest = 'build/packages/react-dom.tgz';
<del> fs.rename(buildSrc, buildDest, done);
<add> fs.rename(
<add> 'build/packages/react-dom-' + grunt.config.data.pkg.version + '.tgz',
<add> 'build/packages/react-dom.tgz',
<add> done
<add> );
<ide> });
<ide> }
<ide>
<ide> module.exports = {
<add> buildRelease: buildRelease,
<ide> packRelease: packRelease,
<ide> };
<ide><path>grunt/tasks/npm-react.js
<ide> var distFiles = [
<ide> 'react.min.js',
<ide> 'react-with-addons.js',
<ide> 'react-with-addons.min.js',
<del> 'react-dom.js',
<del> 'react-dom.min.js',
<ide> ];
<ide>
<ide> function buildRelease() { | 3 |
Text | Text | fix typo in new tutorial code | a5ff2f1e9c94765e4d167317f5248cefe3abc2e9 | <ide><path>docs/tutorial/tutorial.md
<ide> handleClick(i) {
<ide> if (calculateWinner(squares) || squares[i]) {
<ide> return;
<ide> }
<del> squares[i] = this.state.xIsNext(current.squares) ? 'X' : 'O';
<add> squares[i] = this.state.xIsNext ? 'X' : 'O';
<ide> this.setState({
<ide> history: history.concat([{
<ide> squares: squares | 1 |
Text | Text | fix typo in readme.md | a6091ec4b0923c4135cf1325da135917e6a79f58 | <ide><path>research/astronet/README.md
<ide> bazel build astronet/...
<ide> TFRECORD_DIR="${HOME}/astronet/tfrecord"
<ide>
<ide> # Preprocess light curves into sharded TFRecord files using 5 worker processes.
<del>bazel-bin/tensorflow/data/generate_input_records \
<add>bazel-bin/astronet/data/generate_input_records \
<ide> --input_tce_csv_file=${TCE_CSV_FILE} \
<ide> --kepler_data_dir=${KEPLER_DATA_DIR} \
<ide> --output_dir=${TFRECORD_DIR} \ | 1 |
Python | Python | add a test case for it | 6bb395dcbbefde09bcdd70c3151abce193162b25 | <ide><path>libcloud/test/storage/test_cloudfiles.py
<ide> # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<ide> # See the License for the specific language governing permissions and
<ide> # limitations under the License.
<del>from hashlib import sha1
<add>
<ide> import hmac
<ide> import os
<ide> import os.path # pylint: disable-msg=W0404
<ide> import math
<ide> import sys
<ide> import copy
<ide> from io import BytesIO
<add>from hashlib import sha1
<add>
<ide> import mock
<add>from mock import Mock
<add>from mock import PropertyMock
<ide>
<ide> import libcloud.utils.files
<ide>
<ide> from libcloud.utils.py3 import b
<ide> from libcloud.utils.py3 import httplib
<ide> from libcloud.utils.py3 import urlquote
<add>from libcloud.utils.py3 import StringIO
<ide>
<ide> from libcloud.common.types import MalformedResponseError
<ide> from libcloud.storage.base import CHUNK_SIZE, Container, Object
<ide> def test_download_object_as_stream(self):
<ide> obj=obj, chunk_size=None)
<ide> self.assertTrue(hasattr(stream, '__iter__'))
<ide>
<add> def test_download_object_data_is_not_buffered_in_memory(self):
<add> # Test case which verifies that response.body attribute is not accessed
<add> # and as such, whole body response is not buffered into RAM
<add>
<add> # If content is consumed and response.content attribute accessed execption
<add> # will be thrown and test will fail
<add> mock_response = Mock(name='mock response')
<add> mock_response.headers = {}
<add> mock_response.status_code = 200
<add> msg = '"content" attribute was accessed but it shouldn\'t have been'
<add> type(mock_response).content = PropertyMock(name='mock content attribute',
<add> side_effect=Exception(msg))
<add> mock_response.iter_content.return_value = StringIO('a' * 1000)
<add>
<add> self.driver.connection.connection.getresponse = Mock()
<add> self.driver.connection.connection.getresponse.return_value = mock_response
<add>
<add> container = Container(name='foo_bar_container', extra={},
<add> driver=self.driver)
<add> obj = Object(name='foo_bar_object_NO_BUFFER', size=1000, hash=None, extra={},
<add> container=container, meta_data=None,
<add> driver=self.driver)
<add> destination_path = os.path.abspath(__file__) + '.temp'
<add> result = self.driver.download_object(obj=obj,
<add> destination_path=destination_path,
<add> overwrite_existing=False,
<add> delete_on_failure=True)
<add> self.assertTrue(result)
<add>
<ide> def test_upload_object_success(self):
<ide> def upload_file(self, object_name=None, content_type=None,
<ide> request_path=None, request_method=None,
<ide> def _v1_MossoCloudFS_foo_bar_container_foo_test_stream_data(
<ide> headers,
<ide> httplib.responses[httplib.OK])
<ide>
<add> def _v1_MossoCloudFS_foo_bar_container_foo_bar_object_NO_BUFFER(
<add> self, method, url, body, headers):
<add> # test_download_object_data_is_not_buffered_in_memory
<add> headers = {}
<add> headers.update(self.base_headers)
<add> headers['etag'] = '577ef1154f3240ad5b9b413aa7346a1e'
<add> body = generate_random_data(1000)
<add> return (httplib.OK,
<add> body,
<add> headers,
<add> httplib.responses[httplib.OK])
<add>
<add>
<ide> if __name__ == '__main__':
<ide> sys.exit(unittest.main()) | 1 |
Python | Python | kill process group on failure | 0cebfc8ddb509fbf5f865bb660b73e96680b3f65 | <ide><path>tools/test.py
<ide> def DoSkip(case):
<ide>
<ide>
<ide> if __name__ == '__main__':
<del> sys.exit(Main())
<add> ret = 0
<add> try:
<add> ret = Main()
<add> sys.exit(ret)
<add> finally:
<add> if ret and not utils.IsWindows():
<add> os.killpg(0, signal.SIGKILL) | 1 |
Go | Go | synchronize stderr and stdout | 3eb0a80f29629a1c022dc914437b176271d476fc | <ide><path>api/server/router/build/build_routes.go
<ide> import (
<ide> "net/http"
<ide> "strconv"
<ide> "strings"
<add> "sync"
<ide>
<ide> "github.com/Sirupsen/logrus"
<ide> "github.com/docker/docker/api/server/httputils"
<ide> func newImageBuildOptions(ctx context.Context, r *http.Request) (*types.ImageBui
<ide> return options, nil
<ide> }
<ide>
<add>type syncWriter struct {
<add> w io.Writer
<add> mu sync.Mutex
<add>}
<add>
<add>func (s *syncWriter) Write(b []byte) (count int, err error) {
<add> s.mu.Lock()
<add> count, err = s.w.Write(b)
<add> s.mu.Unlock()
<add> return
<add>}
<add>
<ide> func (br *buildRouter) postBuild(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
<ide> var (
<ide> authConfigs = map[string]types.AuthConfig{}
<ide> func (br *buildRouter) postBuild(ctx context.Context, w http.ResponseWriter, r *
<ide> if buildOptions.SuppressOutput {
<ide> out = notVerboseBuffer
<ide> }
<add> out = &syncWriter{w: out}
<ide> stdout := &streamformatter.StdoutFormatter{Writer: out, StreamFormatter: sf}
<ide> stderr := &streamformatter.StderrFormatter{Writer: out, StreamFormatter: sf}
<ide> | 1 |
Text | Text | add a link to simplest-redux-example | 79c76a617214471d4f84ee5fa8e9c5086b303916 | <ide><path>README.md
<ide> This architecture might seem like an overkill for a counter app, but the beauty
<ide> * [Async](http://rackt.github.io/redux/docs/introduction/Examples.html#async) ([source](https://github.com/rackt/redux/tree/master/examples/async))
<ide> * [Real World](http://rackt.github.io/redux/docs/introduction/Examples.html#real-world) ([source](https://github.com/rackt/redux/tree/master/examples/real-world))
<ide>
<add>If you’re new to the NPM ecosystem and have troubles getting a project up and running, or aren’t sure where to paste the gist above, check out [simplest-redux-example](https://github.com/jackielii/simplest-redux-example) that uses Redux together with React and Browserify.
<add>
<ide> ### Discussion
<ide>
<ide> Join the **#redux** channel of the [Reactiflux](http://reactiflux.com) Slack community. | 1 |
Ruby | Ruby | fix run_callbacks for objects with negative id | 911a0859ac065aa8e8834ac985353d659c7c7b65 | <ide><path>activesupport/lib/active_support/callbacks.rb
<ide> module ClassMethods
<ide> # This generated method plays caching role.
<ide> def __define_callbacks(kind, object) #:nodoc:
<ide> chain = object.send("_#{kind}_callbacks")
<del> name = "_run_callbacks_#{chain.object_id}"
<add> name = "_run_callbacks_#{chain.object_id.abs}"
<ide> unless object.respond_to?(name, true)
<ide> class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
<ide> def #{name}() #{chain.compile} end | 1 |
Ruby | Ruby | show target path when empty | bfbfdf03eb2bcbb73082af0325f85761ea87719e | <ide><path>Library/Homebrew/extend/pathname.rb
<ide> def install *sources
<ide> case src
<ide> when Array
<ide> if src.empty?
<del> opoo "install was passed an empty array"
<add> opoo "tried to install empty array to #{self}"
<ide> return []
<ide> end
<ide> src.each {|s| results << install_p(s) }
<ide> when Hash
<ide> if src.empty?
<del> opoo "install was passed an empty hash"
<add> opoo "tried to install empty hash to #{self}"
<ide> return []
<ide> end
<ide> src.each {|s, new_basename| results << install_p(s, new_basename) } | 1 |
Javascript | Javascript | add some tests to test-buffer.js | e2569c402fc2b1b4f60c71c616a321134e7aa0ca | <ide><path>test/mjsunit/test-buffer.js
<ide> assert = require("assert");
<ide>
<ide> var b = new process.Buffer(1024);
<ide>
<del>sys.puts("b[0] == " + b[0]);
<del>assert.ok(b[0] >= 0);
<del>
<del>sys.puts("b[1] == " + b[1]);
<del>assert.ok(b[1] >= 0);
<del>
<ide> sys.puts("b.length == " + b.length);
<ide> assert.equal(1024, b.length);
<ide>
<add>for (var i = 0; i < 1024; i++) {
<add> assert.ok(b[i] >= 0);
<add> b[i] = i % 256;
<add>}
<add>
<add>for (var i = 0; i < 1024; i++) {
<add> assert.equal(i % 256, b[i]);
<add>}
<add>
<ide> for (var j = 0; j < 10000; j++) {
<ide> var asciiString = "hello world";
<ide> | 1 |
Ruby | Ruby | remove klass delegator | 40a015f7305affc046049ad17e16b8cc85763da7 | <ide><path>activerecord/lib/active_record/associations/association_scope.rb
<ide> module Associations
<ide> class AssociationScope #:nodoc:
<ide> attr_reader :association, :alias_tracker
<ide>
<del> delegate :klass, :reflection, :to => :association
<add> delegate :reflection, :to => :association
<ide>
<ide> def initialize(association)
<ide> @association = association
<del> @alias_tracker = AliasTracker.new klass.connection
<add> @alias_tracker = AliasTracker.new association.klass.connection
<ide> end
<ide>
<ide> def scope
<add> klass = association.klass
<ide> scope = klass.unscoped
<ide> scope.extending! Array(reflection.options[:extend])
<ide>
<ide> owner = association.owner
<ide> scope_chain = reflection.scope_chain
<ide> chain = reflection.chain
<del> add_constraints(scope, owner, scope_chain, chain)
<add> add_constraints(scope, owner, scope_chain, chain, klass)
<ide> end
<ide>
<ide> def join_type
<ide> def join_type
<ide>
<ide> private
<ide>
<del> def construct_tables(chain)
<add> def construct_tables(chain, klass)
<ide> chain.map do |reflection|
<ide> alias_tracker.aliased_table_for(
<del> table_name_for(reflection),
<add> table_name_for(reflection, klass),
<ide> table_alias_for(reflection, reflection != self.reflection)
<ide> )
<ide> end
<ide> def bind(scope, table_name, column_name, value)
<ide> bind_value scope, column, value
<ide> end
<ide>
<del> def add_constraints(scope, owner, scope_chain, chain)
<del> tables = construct_tables(chain)
<add> def add_constraints(scope, owner, scope_chain, chain, assoc_klass)
<add> tables = construct_tables(chain, assoc_klass)
<ide>
<ide> chain.each_with_index do |reflection, i|
<ide> table, foreign_table = tables.shift, tables.first
<ide>
<ide> if reflection.source_macro == :belongs_to
<ide> if reflection.options[:polymorphic]
<del> key = reflection.association_primary_key(self.klass)
<add> key = reflection.association_primary_key(assoc_klass)
<ide> else
<ide> key = reflection.association_primary_key
<ide> end
<ide> def add_constraints(scope, owner, scope_chain, chain)
<ide> end
<ide>
<ide> is_first_chain = i == 0
<del> klass = is_first_chain ? self.klass : reflection.klass
<add> klass = is_first_chain ? assoc_klass : reflection.klass
<ide>
<ide> # Exclude the scope of the association itself, because that
<ide> # was already merged in the #scope method.
<ide> def alias_suffix
<ide> reflection.name
<ide> end
<ide>
<del> def table_name_for(reflection)
<add> def table_name_for(reflection, klass)
<ide> if reflection == self.reflection
<ide> # If this is a polymorphic belongs_to, we want to get the klass from the
<ide> # association because it depends on the polymorphic_type attribute of | 1 |
Python | Python | add m3 instances for ec2 oregon | 2018fa0a4cfac5fcbf538d68662db4a5c398118e | <ide><path>libcloud/compute/drivers/ec2.py
<ide> 'm2.xlarge',
<ide> 'm2.2xlarge',
<ide> 'm2.4xlarge',
<add> 'm3.medium',
<add> 'm3.large',
<add> 'm3.xlarge',
<add> 'm3.2xlarge',
<ide> 'c1.medium',
<ide> 'c1.xlarge',
<ide> 'g2.2xlarge', | 1 |
Ruby | Ruby | add relation.last and relation.reverse_order | d5e98dc859e24e9ebf8206a7955c6ac40819a117 | <ide><path>activerecord/lib/active_record/relation.rb
<ide> def order(orders)
<ide> create_new_relation(@relation.order(orders))
<ide> end
<ide>
<add> def reverse_order
<add> relation = create_new_relation
<add> relation.instance_variable_set(:@orders, nil)
<add>
<add> order_clause = @relation.send(:order_clauses).join(', ')
<add> if order_clause.present?
<add> relation.order(reverse_sql_order(order_clause))
<add> else
<add> relation.order("#{@klass.table_name}.#{@klass.primary_key} DESC")
<add> end
<add> end
<add>
<ide> def limit(limits)
<ide> create_new_relation(@relation.take(limits))
<ide> end
<ide> def first
<ide> end
<ide> end
<ide>
<add> def last
<add> if loaded?
<add> @records.last
<add> else
<add> @last ||= reverse_order.limit(1).to_a[0]
<add> end
<add> end
<add>
<ide> def loaded?
<ide> @loaded
<ide> end
<ide>
<ide> def reload
<ide> @loaded = false
<del> @records = @first = nil
<add> @records = @first = @last = nil
<ide> self
<ide> end
<ide>
<ide> def create_new_relation(relation = @relation, readonly = @readonly, preload = @a
<ide> def where_clause(join_string = "\n\tAND ")
<ide> @relation.send(:where_clauses).join(join_string)
<ide> end
<add>
<add> def reverse_sql_order(order_query)
<add> order_query.to_s.split(/,/).each { |s|
<add> if s.match(/\s(asc|ASC)$/)
<add> s.gsub!(/\s(asc|ASC)$/, ' DESC')
<add> elsif s.match(/\s(desc|DESC)$/)
<add> s.gsub!(/\s(desc|DESC)$/, ' ASC')
<add> else
<add> s.concat(' DESC')
<add> end
<add> }.join(',')
<add> end
<add>
<ide> end
<ide> end
<ide><path>activerecord/test/cases/relations_test.rb
<ide> def test_exists
<ide> assert ! fake.exists?
<ide> assert ! fake.exists?(authors(:david).id)
<ide> end
<add>
<add> def test_last
<add> authors = Author.scoped
<add> assert_equal authors(:mary), authors.last
<add> end
<add>
<ide> end | 2 |
Text | Text | add reference for `===` operator in assert.md | 133ad76d0a3d7113239dc7ae38c05ebcbfa4f0bb | <ide><path>doc/api/assert.md
<ide> are recursively evaluated also by the following rules.
<ide> [`Object.is()`][].
<ide> * [Type tags][Object.prototype.toString()] of objects should be the same.
<ide> * [`[[Prototype]]`][prototype-spec] of objects are compared using
<del> the [Strict Equality Comparison][].
<add> the [`===` operator][].
<ide> * Only [enumerable "own" properties][] are considered.
<ide> * [`Error`][] names and messages are always compared, even if these are not
<ide> enumerable properties.
<ide> argument.
<ide> [Object wrappers]: https://developer.mozilla.org/en-US/docs/Glossary/Primitive#Primitive_wrapper_objects_in_JavaScript
<ide> [Object.prototype.toString()]: https://tc39.github.io/ecma262/#sec-object.prototype.tostring
<ide> [SameValue Comparison]: https://tc39.github.io/ecma262/#sec-samevalue
<del>[Strict Equality Comparison]: https://tc39.github.io/ecma262/#sec-strict-equality-comparison
<ide> [`!=` operator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Inequality
<add>[`===` operator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Strict_equality
<ide> [`==` operator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality
<ide> [`AssertionError`]: #class-assertassertionerror
<ide> [`CallTracker`]: #class-assertcalltracker | 1 |
Go | Go | fix network disabled for container | 66782730b85db20600ce48fcab203a5eb43bcb02 | <ide><path>container.go
<ide> func (container *Container) Start() (err error) {
<ide> }
<ide>
<ide> var en *execdriver.Network
<del> if !container.runtime.networkManager.disabled {
<add> if !container.Config.NetworkDisabled {
<ide> network := container.NetworkSettings
<ide> en = &execdriver.Network{
<ide> Gateway: network.Gateway, | 1 |
Text | Text | improve fbx and maya docs | 607584f62e5cb58f037228a67e0efa69f25e687c | <ide><path>utils/converters/fbx/README.md
<ide> Don't forget the visit the FBX SDK documentation website:
<ide> http://docs.autodesk.com/FBX/2013/ENU/FBX-SDK-Documentation/cpp_ref/index.html
<ide> ```
<ide>
<add>*Note:* If you use the OSX installer, it will install the Python packages into the following folder.
<add>
<add>```
<add>/Applications/Autodesk/FBX Python SDK/[VERSION]/lib/
<add>```
<add>
<add>If the tool still can't find the FBX SDK, you may need to copy the `fbx.so`, `FbxCommon.py` and `sip.so` files into your site_packages folder.
<add>
<add>If you don't know your site_packages folder, run `python` from shell and paste this:
<add>
<add>```py
<add>import site; site.getsitepackages()
<add>```
<add>
<ide> ### Python
<del>* Requires Python 2.6 or 3.1 (The FBX SDK requires one of these versions)
<add>* Requires Python 2.6, 2.7 or 3.1 (The FBX SDK requires one of these versions)
<ide>
<ide> ``` bash
<ide> sudo apt-get install build-essential
<ide><path>utils/exporters/maya/README.md
<ide> Exports Maya models to Three.js' JSON format. Currently supports exporting the
<ide>
<ide> ## Installation
<ide>
<del>Install [pymel](http://download.autodesk.com/global/docs/maya2014/en_us/PyMel/install.html).
<del>Though the docs are way out of date, the process described still works as of
<del>2014.
<add>(Maya 2016 suggested)
<add>
<add>Install [pymel](http://download.autodesk.com/global/docs/maya2014/en_us/PyMel/install.html) if necessary – Maya 2015 and newer will already include this for you. If you need to install PyMel manually, you can clone the latest from the [LumaPictures/pymel](https://github.com/LumaPictures/pymel) repository.
<ide>
<ide> Copy the scripts and plug-ins folders to the appropriate maya folder, where `maya-version` is your current version of Maya (eg. 2013-x64).
<ide>
<ide> - Windows: `C:\Users\username\Documents\maya\maya-version`
<ide> - OSX: `~/Library/Preferences/Autodesk/maya/maya-version`
<ide> - Linux: `/usr/autodesk/userconfig/maya/maya-version`
<ide>
<del>After that, you need to activate the plugin. In Maya, open `Window > Settings/Preferences > Plug-in Manager` and enable the checkboxes next to `threeJsFileTranslator.py`.
<add>After that, you need to activate the plugin. In Maya, open `Windows > Settings/Preferences > Plug-in Manager` and enable the checkboxes next to `threeJsFileTranslator.py`.
<add>
<add>
<add>
<add>
<ide>
<ide> ## Usage
<ide> | 2 |
Javascript | Javascript | remove todo for moving isip to dns | d51efd07ac580991011e8dbebef5179f9c6f5b66 | <ide><path>lib/net.js
<ide> Server.prototype.unref = function() {
<ide> };
<ide>
<ide>
<del>// TODO: isIP should be moved to the DNS code. Putting it here now because
<del>// this is what the legacy system did.
<ide> exports.isIP = cares.isIP;
<ide>
<ide> | 1 |
Ruby | Ruby | avoid array allocation where not needed | 4ff87909a95354136c51f33b1402fca484da961b | <ide><path>activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb
<ide> def #{attr_name}=(time)
<ide> def create_time_zone_conversion_attribute?(name, column)
<ide> time_zone_aware_attributes &&
<ide> !self.skip_time_zone_conversion_for_attributes.include?(name.to_sym) &&
<del> [:datetime, :timestamp].include?(column.type)
<add> (:datetime == column.type || :timestamp == column.type)
<ide> end
<ide> end
<ide> end | 1 |
Mixed | Ruby | reset @column_defaults when assigning | 33354aa23e9d34bdf5aae8ab942cf830bf9f2782 | <ide><path>activerecord/CHANGELOG.md
<add>* Reset @column_defaults when assigning `locking_column`.
<add> We had a potential problem. For example:
<add>
<add> class Post < ActiveRecord::Base
<add> self.column_defaults # if we call this unintentionally before setting locking_column ...
<add> self.locking_column = 'my_locking_column'
<add> end
<add>
<add> Post.column_defaults["my_locking_column"]
<add> => nil # expected value is 0 !
<add>
<add> *kennyj*
<add>
<ide> * Remove extra select and update queries on save/touch/destroy ActiveRecord model
<ide> with belongs to reflection with option `touch: true`.
<ide>
<ide><path>activerecord/lib/active_record/locking/optimistic.rb
<ide> def locking_enabled?
<ide>
<ide> # Set the column to use for optimistic locking. Defaults to +lock_version+.
<ide> def locking_column=(value)
<add> @column_defaults = nil
<ide> @locking_column = value.to_s
<ide> end
<ide>
<ide><path>activerecord/test/cases/locking_test.rb
<ide> class LockWithoutDefault < ActiveRecord::Base; end
<ide>
<ide> class LockWithCustomColumnWithoutDefault < ActiveRecord::Base
<ide> self.table_name = :lock_without_defaults_cust
<add> self.column_defaults # to test @column_defaults caching.
<ide> self.locking_column = :custom_lock_version
<ide> end
<ide> | 3 |
Text | Text | update copyright year in licence | c9658ad459c2a5c6f136fc1e7f83b4c800092a85 | <ide><path>LICENSE.md
<del>Copyright (c) 2011-2021 GitHub Inc.
<add>Copyright (c) 2011-2022 GitHub Inc.
<ide>
<ide> Permission is hereby granted, free of charge, to any person obtaining
<ide> a copy of this software and associated documentation files (the | 1 |
Javascript | Javascript | convert buffer benchmark to runbenchmark | 7456db937d91750cdbe4f9935e4d40cc682ace07 | <ide><path>test/parallel/test-benchmark-buffer.js
<ide>
<ide> require('../common');
<ide>
<del>// Minimal test for buffer benchmarks. This makes sure the benchmarks aren't
<del>// completely broken but nothing more than that.
<add>const runBenchmark = require('../common/benchmark');
<ide>
<del>const assert = require('assert');
<del>const fork = require('child_process').fork;
<del>const path = require('path');
<add>runBenchmark('buffers',
<add> [
<add> 'aligned=true',
<add> 'args=1',
<add> 'encoding=utf8',
<add> 'len=2',
<add> 'method=',
<add> 'n=1',
<add> 'noAssert=true',
<add> 'pieces=1',
<add> 'pieceSize=1',
<add> 'search=@',
<add> 'size=1',
<add> 'source=array',
<add> 'type=',
<add> 'withTotalLength=0'
<ide>
<del>const runjs = path.join(__dirname, '..', '..', 'benchmark', 'run.js');
<del>const argv = ['--set', 'aligned=true',
<del> '--set', 'args=1',
<del> '--set', 'buffer=fast',
<del> '--set', 'encoding=utf8',
<del> '--set', 'len=2',
<del> '--set', 'method=',
<del> '--set', 'n=1',
<del> '--set', 'noAssert=true',
<del> '--set', 'pieces=1',
<del> '--set', 'pieceSize=1',
<del> '--set', 'search=@',
<del> '--set', 'size=1',
<del> '--set', 'source=array',
<del> '--set', 'type=',
<del> '--set', 'withTotalLength=0',
<del> 'buffers'];
<del>
<del>const child = fork(runjs, argv);
<del>child.on('exit', (code, signal) => {
<del> assert.strictEqual(code, 0);
<del> assert.strictEqual(signal, null);
<del>});
<add> ]); | 1 |
Javascript | Javascript | use cdn version to generate link to source files | 5c4ffb36deee18743beb149ceae4d63d5b1ae8d9 | <ide><path>docs/spec/sourceLinkSpec.js
<ide> describe('Docs Links', function() {
<ide> });
<ide>
<ide> it('should have an "view source" button', function() {
<add> spyOn(gruntUtil, 'getVersion').andReturn({cdn: '1.2.299'});
<add>
<ide> expect(doc.html()).
<del> toContain('<a href="http://github.com/angular/angular.js/tree/v' + gruntUtil.getVersion().number + '/test.js#L42" class="view-source btn btn-action"><i class="icon-zoom-in"> </i> View source</a>');
<add> toContain('<a href="http://github.com/angular/angular.js/tree/v1.2.299/test.js#L42" class="view-source btn btn-action"><i class="icon-zoom-in"> </i> View source</a>');
<ide> });
<del>
<ide> });
<ide>
<ide> });
<ide><path>docs/src/ngdoc.js
<ide> Doc.prototype = {
<ide> if (this.section === 'api') {
<ide> dom.tag('a', {
<ide> href: 'http://github.com/angular/angular.js/tree/v' +
<del> gruntUtil.getVersion().number + '/' + self.file + '#L' + self.line,
<add> gruntUtil.getVersion().cdn + '/' + self.file + '#L' + self.line,
<ide> class: 'view-source btn btn-action' }, function(dom) {
<ide> dom.tag('i', {class:'icon-zoom-in'}, ' ');
<ide> dom.text(' View source'); | 2 |
Ruby | Ruby | fix mailerpreview broken tests | f870c4d063f6ac3b5fe96670955a08fcd7e15e67 | <ide><path>actionmailer/test/base_test.rb
<ide> def welcome
<ide> test "you can register a preview interceptor to the mail object that gets passed the mail object before previewing" do
<ide> ActionMailer::Base.register_preview_interceptor(MyInterceptor)
<ide> mail = BaseMailer.welcome
<del> BaseMailerPreview.stubs(:welcome).returns(mail)
<add> BaseMailerPreview.any_instance.stubs(:welcome).returns(mail)
<ide> MyInterceptor.expects(:previewing_email).with(mail)
<ide> BaseMailerPreview.call(:welcome)
<ide> end
<ide>
<ide> test "you can register a preview interceptor using its stringified name to the mail object that gets passed the mail object before previewing" do
<ide> ActionMailer::Base.register_preview_interceptor("BaseTest::MyInterceptor")
<ide> mail = BaseMailer.welcome
<del> BaseMailerPreview.stubs(:welcome).returns(mail)
<add> BaseMailerPreview.any_instance.stubs(:welcome).returns(mail)
<ide> MyInterceptor.expects(:previewing_email).with(mail)
<ide> BaseMailerPreview.call(:welcome)
<ide> end
<ide>
<ide> test "you can register an interceptor using its symbolized underscored name to the mail object that gets passed the mail object before previewing" do
<ide> ActionMailer::Base.register_preview_interceptor(:"base_test/my_interceptor")
<ide> mail = BaseMailer.welcome
<del> BaseMailerPreview.stubs(:welcome).returns(mail)
<add> BaseMailerPreview.any_instance.stubs(:welcome).returns(mail)
<ide> MyInterceptor.expects(:previewing_email).with(mail)
<ide> BaseMailerPreview.call(:welcome)
<ide> end
<ide>
<ide> test "you can register multiple preview interceptors to the mail object that both get passed the mail object before previewing" do
<ide> ActionMailer::Base.register_preview_interceptors("BaseTest::MyInterceptor", MySecondInterceptor)
<ide> mail = BaseMailer.welcome
<del> BaseMailerPreview.stubs(:welcome).returns(mail)
<add> BaseMailerPreview.any_instance.stubs(:welcome).returns(mail)
<ide> MyInterceptor.expects(:previewing_email).with(mail)
<ide> MySecondInterceptor.expects(:previewing_email).with(mail)
<ide> BaseMailerPreview.call(:welcome) | 1 |
Text | Text | update ubuntu image tag to 14.04 | 736558b6ae15afb3f5f0d7ba7801fa44bec9f285 | <ide><path>docs/sources/examples/running_redis_service.md
<ide> using a link.
<ide> Firstly, we create a `Dockerfile` for our new Redis
<ide> image.
<ide>
<del> FROM ubuntu:12.10
<add> FROM ubuntu:14.04
<ide> RUN apt-get update && apt-get install -y redis-server
<ide> EXPOSE 6379
<ide> ENTRYPOINT ["/usr/bin/redis-server"]
<ide> created with an alias of `db`. This will create a secure tunnel to the
<ide> `redis` container and expose the Redis instance running inside that
<ide> container to only this container.
<ide>
<del> $ sudo docker run --link redis:db -i -t ubuntu:12.10 /bin/bash
<add> $ sudo docker run --link redis:db -i -t ubuntu:14.04 /bin/bash
<ide>
<ide> Once inside our freshly created container we need to install Redis to
<ide> get the `redis-cli` binary to test our connection. | 1 |
Python | Python | fix on_failure_callback when task receive sigkill | 817b599234dca050438ee04bc6944d32bc032694 | <ide><path>airflow/jobs/local_task_job.py
<ide> # under the License.
<ide> #
<ide>
<del>import os
<ide> import signal
<ide> from typing import Optional
<ide>
<ide> def handle_task_exit(self, return_code: int) -> None:
<ide> # task exited by itself, so we need to check for error file
<ide> # incase it failed due to runtime exception/error
<ide> error = None
<add> if self.task_instance.state == State.RUNNING:
<add> # This is for a case where the task received a sigkill
<add> # while running
<add> self.task_instance.set_state(State.FAILED)
<ide> if self.task_instance.state != State.SUCCESS:
<ide> error = self.task_runner.deserialize_run_error()
<ide> self.task_instance._run_finished_callback(error=error) # pylint: disable=protected-access
<ide> def heartbeat_callback(self, session=None):
<ide> )
<ide> raise AirflowException("Hostname of job runner does not match")
<ide>
<del> current_pid = os.getpid()
<add> current_pid = self.task_runner.process.pid
<ide> same_process = ti.pid == current_pid
<del> if not same_process:
<add> if ti.pid is not None and not same_process:
<ide> self.log.warning("Recorded pid %s does not match " "the current pid %s", ti.pid, current_pid)
<ide> raise AirflowException("PID of job runner does not match")
<ide> elif self.task_runner.return_code() is None and hasattr(self.task_runner, 'process'):
<ide><path>airflow/models/taskinstance.py
<ide> def check_and_change_state_before_execution( # pylint: disable=too-many-argumen
<ide> if not test_mode:
<ide> session.add(Log(State.RUNNING, self))
<ide> self.state = State.RUNNING
<del> self.pid = os.getpid()
<ide> self.end_date = None
<ide> if not test_mode:
<ide> session.merge(self)
<ide> def _run_raw_task(
<ide> self.refresh_from_db(session=session)
<ide> self.job_id = job_id
<ide> self.hostname = get_hostname()
<del>
<add> self.pid = os.getpid()
<add> session.merge(self)
<add> session.commit()
<ide> actual_start_date = timezone.utcnow()
<ide> Stats.incr(f'ti.start.{task.dag_id}.{task.task_id}')
<ide> try:
<ide><path>tests/jobs/test_local_task_job.py
<ide> from unittest.mock import patch
<ide>
<ide> import pytest
<add>from parameterized import parameterized
<ide>
<ide> from airflow import settings
<ide> from airflow.exceptions import AirflowException, AirflowFailException
<ide> def test_localtaskjob_essential_attr(self):
<ide> check_result_2 = [getattr(job1, attr) is not None for attr in essential_attr]
<ide> assert all(check_result_2)
<ide>
<del> @patch('os.getpid')
<del> def test_localtaskjob_heartbeat(self, mock_pid):
<add> def test_localtaskjob_heartbeat(self):
<ide> session = settings.Session()
<ide> dag = DAG('test_localtaskjob_heartbeat', start_date=DEFAULT_DATE, default_args={'owner': 'owner1'})
<ide>
<ide> def test_localtaskjob_heartbeat(self, mock_pid):
<ide> session.commit()
<ide>
<ide> job1 = LocalTaskJob(task_instance=ti, ignore_ti_state=True, executor=SequentialExecutor())
<add> ti.task = op1
<add> ti.refresh_from_task(op1)
<add> job1.task_runner = StandardTaskRunner(job1)
<add> job1.task_runner.process = mock.Mock()
<ide> with pytest.raises(AirflowException):
<ide> job1.heartbeat_callback() # pylint: disable=no-value-for-parameter
<ide>
<del> mock_pid.return_value = 1
<add> job1.task_runner.process.pid = 1
<ide> ti.state = State.RUNNING
<ide> ti.hostname = get_hostname()
<ide> ti.pid = 1
<ide> session.merge(ti)
<ide> session.commit()
<del>
<add> assert ti.pid != os.getpid()
<ide> job1.heartbeat_callback(session=None)
<ide>
<del> mock_pid.return_value = 2
<add> job1.task_runner.process.pid = 2
<ide> with pytest.raises(AirflowException):
<ide> job1.heartbeat_callback() # pylint: disable=no-value-for-parameter
<ide>
<ide> def task_function(ti):
<ide> assert task_terminated_externally.value == 1
<ide> assert not process.is_alive()
<ide>
<del> def test_process_kill_call_on_failure_callback(self):
<add> @parameterized.expand(
<add> [
<add> (signal.SIGTERM,),
<add> (signal.SIGKILL,),
<add> ]
<add> )
<add> def test_process_kill_calls_on_failure_callback(self, signal_type):
<ide> """
<del> Test that ensures that when a task is killed with sigterm
<add> Test that ensures that when a task is killed with sigterm or sigkill
<ide> on_failure_callback gets executed
<ide> """
<ide> # use shared memory value so we can properly track value change even if
<ide> def task_function(ti):
<ide> process = multiprocessing.Process(target=job1.run)
<ide> process.start()
<ide>
<del> for _ in range(0, 10):
<add> for _ in range(0, 20):
<ide> ti.refresh_from_db()
<del> if ti.state == State.RUNNING:
<add> if ti.state == State.RUNNING and ti.pid is not None:
<ide> break
<ide> time.sleep(0.2)
<ide> assert ti.state == State.RUNNING
<del> os.kill(ti.pid, signal.SIGTERM)
<add> assert ti.pid is not None
<add> os.kill(ti.pid, signal_type)
<ide> process.join(timeout=10)
<ide> assert failure_callback_called.value == 1
<ide> assert task_terminated_externally.value == 1
<ide> def test_number_of_queries_single_loop(self, mock_get_task_runner, return_codes)
<ide> mock_get_task_runner.return_value.return_code.side_effects = return_codes
<ide>
<ide> job = LocalTaskJob(task_instance=ti, executor=MockExecutor())
<del> with assert_queries_count(13):
<add> with assert_queries_count(15):
<ide> job.run()
<ide><path>tests/models/test_taskinstance.py
<ide> def tearDown(self) -> None:
<ide> @parameterized.expand(
<ide> [
<ide> # Expected queries, mark_success
<del> (10, False),
<del> (5, True),
<add> (12, False),
<add> (7, True),
<ide> ]
<ide> )
<ide> def test_execute_queries_count(self, expected_query_count, mark_success):
<ide> def test_execute_queries_count_store_serialized(self):
<ide> session=session,
<ide> )
<ide>
<del> with assert_queries_count(10):
<add> with assert_queries_count(12):
<ide> ti._run_raw_task()
<ide>
<ide> def test_operator_field_with_serialization(self): | 4 |
PHP | PHP | provide initialize command to create po from pot | 12dd82a47c4eb86a830d5c53f7bb84204141372e | <ide><path>src/Shell/I18nShell.php
<ide> public function main()
<ide> $this->out('<info>I18n Shell</info>');
<ide> $this->hr();
<ide> $this->out('[E]xtract POT file from sources');
<add> $this->out('[I]inialize a language from POT file');
<ide> $this->out('[H]elp');
<ide> $this->out('[Q]uit');
<ide>
<del> $choice = strtolower($this->in('What would you like to do?', ['E', 'H', 'Q']));
<add> $choice = strtolower($this->in('What would you like to do?', ['E', 'I', 'H', 'Q']));
<ide> switch ($choice) {
<ide> case 'e':
<ide> $this->Extract->main();
<ide> break;
<add> case 'i':
<add> $this->init();
<add> break;
<ide> case 'h':
<ide> $this->out($this->OptionParser->help());
<ide> break;
<ide> public function main()
<ide> $this->main();
<ide> }
<ide>
<add> /**
<add> * Inits PO file from POT file.
<add> *
<add> * @return void
<add> */
<add> public function init($language = null) {
<add> if (!$language) {
<add> $language = strtolower($this->in('What language? Please use the two-letter ISO code, e.g. `en`.'));
<add> }
<add> if (strlen($language) !== 2) {
<add> return $this->error('Must be a two-letter ISO code');
<add> }
<add>
<add> $this->_paths = [APP];
<add> if (!empty($this->params['plugin'])) {
<add> $plugin = Inflector::camelize($this->params['plugin']);
<add> $this->_paths = [Plugin::classPath($plugin)];
<add> $this->params['plugin'] = $plugin;
<add> }
<add>
<add> $response = $this->in('What folder?', null, rtrim($this->_paths[0], DS) . DS . 'Locale');
<add> $sourceFolder = rtrim($response, DS) . DS;
<add> $targetFolder = $sourceFolder . $language . DS;
<add> if (!is_dir($targetFolder)) {
<add> mkdir($targetFolder, 0770, true);
<add> }
<add>
<add> $count = 0;
<add> $iterator = new \DirectoryIterator($sourceFolder);
<add> foreach ($iterator as $fileinfo) {
<add> if (!$fileinfo->isFile()) {
<add> continue;
<add> }
<add> $filename = $fileinfo->getFilename();
<add> $newFilename = $fileinfo->getBasename('.pot');
<add> $newFilename = $newFilename . '.po';
<add> if (empty($this->params['force']) && is_file($targetFolder . $newFilename)) {
<add> $this->err('File ' . $newFilename . ' exists, skipping. Use --force or -f to force overwriting');
<add> continue;
<add> }
<add>
<add> copy($sourceFolder . $filename, $targetFolder . $newFilename);
<add> $count++;
<add> }
<add>
<add> $this->out('Generated ' . $count . ' PO files in ' . $targetFolder);
<add> }
<add>
<ide> /**
<ide> * Gets the option parser instance and configures it.
<ide> *
<ide> public function main()
<ide> public function getOptionParser()
<ide> {
<ide> $parser = parent::getOptionParser();
<add> $initParser = [
<add> 'options' => [
<add> 'plugin' => [
<add> 'help' => 'Plugin name.',
<add> 'short' => 'p'
<add> ],
<add> 'force' => [
<add> 'help' => 'Force overwriting.',
<add> 'short' => 'f',
<add> 'boolean' => true
<add> ]
<add> ],
<add> 'arguments' => [
<add> 'language' => [
<add> 'help' => 'Two-letter language code.'
<add> ]
<add> ]
<add> ];
<ide>
<ide> $parser->description(
<ide> 'I18n Shell generates .pot files(s) with translations.'
<ide> )->addSubcommand('extract', [
<ide> 'help' => 'Extract the po translations from your application',
<ide> 'parser' => $this->Extract->getOptionParser()
<add> ])
<add> ->addSubcommand('init', [
<add> 'help' => 'Init PO language file from POT file',
<add> 'parser' => $initParser
<ide> ]);
<ide>
<ide> return $parser;
<ide><path>tests/TestCase/Shell/I18nShellTest.php
<add><?php
<add>/**
<add> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<add> *
<add> * Licensed under The MIT License
<add> * For full copyright and license information, please see the LICENSE.txt
<add> * Redistributions of files must retain the above copyright notice.
<add> *
<add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<add> * @link http://cakephp.org CakePHP(tm) Project
<add> * @since 3.0.8
<add> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<add> */
<add>namespace Cake\Test\TestCase\Shell;
<add>
<add>use Cake\Cache\Cache;
<add>use Cake\Datasource\ConnectionManager;
<add>use Cake\Shell\I18nShell;
<add>use Cake\TestSuite\TestCase;
<add>
<add>/**
<add> * I18nShell test.
<add> */
<add>class I18nShellTest extends TestCase
<add>{
<add>
<add> /**
<add> * setup method
<add> *
<add> * @return void
<add> */
<add> public function setUp()
<add> {
<add> parent::setUp();
<add> $this->io = $this->getMock('Cake\Console\ConsoleIo');
<add> $this->shell = new I18nShell($this->io);
<add> }
<add>
<add> /**
<add> * Teardown
<add> *
<add> * @return void
<add> */
<add> public function tearDown()
<add> {
<add> parent::tearDown();
<add> }
<add>
<add> /**
<add> * Tests that init() creates the PO files from POT files.
<add> *
<add> * @return void
<add> */
<add> public function testInit()
<add> {
<add> $localeDir = TMP . 'Locale' . DS;
<add> $deDir = $localeDir . 'de' . DS;
<add> if (!is_dir($deDir)) {
<add> mkdir($deDir, 0770, true);
<add> }
<add> file_put_contents($localeDir . 'default.pot', 'Testing POT file.');
<add> file_put_contents($localeDir . 'cake.pot', 'Testing POT file.');
<add> if (file_exists($deDir . 'default.po')) {
<add> unlink($deDir . 'default.po');
<add> }
<add> if (file_exists($deDir . 'default.po')) {
<add> unlink($deDir . 'cake.po');
<add> }
<add>
<add> $this->shell->io()->expects($this->at(0))
<add> ->method('ask')
<add> ->will($this->returnValue('de'));
<add> $this->shell->io()->expects($this->at(1))
<add> ->method('ask')
<add> ->will($this->returnValue($localeDir));
<add>
<add> $this->shell->params['verbose'] = true;
<add> $this->shell->init();
<add>
<add> $this->assertTrue(file_exists($deDir . 'default.po'));
<add> $this->assertTrue(file_exists($deDir . 'cake.po'));
<add> }
<add>} | 2 |
Java | Java | fix inverted horizontal scrollview on android | 32cb9ec49c801fcebe61486149134ab542d9364b | <ide><path>ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java
<ide> public boolean onTouchEvent(MotionEvent ev) {
<ide>
<ide> @Override
<ide> public void fling(int velocityX) {
<add>
<add> // Workaround.
<add> // On Android P if a ScrollView is inverted, we will get a wrong sign for
<add> // velocityX (see https://issuetracker.google.com/issues/112385925).
<add> // At the same time, mOnScrollDispatchHelper tracks the correct velocity direction.
<add> //
<add> // Hence, we can use the absolute value from whatever the OS gives
<add> // us and use the sign of what mOnScrollDispatchHelper has tracked.
<add> final int correctedVelocityX = (int)(Math.abs(velocityX) * Math.signum(mOnScrollDispatchHelper.getXFlingVelocity()));
<add>
<ide> if (mPagingEnabled) {
<del> flingAndSnap(velocityX);
<add> flingAndSnap(correctedVelocityX);
<ide> } else if (mScroller != null) {
<ide> // FB SCROLLVIEW CHANGE
<ide>
<ide> public void fling(int velocityX) {
<ide> mScroller.fling(
<ide> getScrollX(), // startX
<ide> getScrollY(), // startY
<del> velocityX, // velocityX
<add> correctedVelocityX, // velocityX
<ide> 0, // velocityY
<ide> 0, // minX
<ide> Integer.MAX_VALUE, // maxX
<ide> public void fling(int velocityX) {
<ide>
<ide> // END FB SCROLLVIEW CHANGE
<ide> } else {
<del> super.fling(velocityX);
<add> super.fling(correctedVelocityX);
<ide> }
<del> handlePostTouchScrolling(velocityX, 0);
<add> handlePostTouchScrolling(correctedVelocityX, 0);
<ide> }
<ide>
<ide> @Override | 1 |
PHP | PHP | implement morphone and morphmany | a145ab29a0b06fe4f7924d9e101db0d34d07cd51 | <ide><path>src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php
<ide> public function morphOne($related, $name, $type = null, $id = null, $localKey =
<ide>
<ide> $localKey = $localKey ?: $this->getKeyName();
<ide>
<del> return new MorphOne($instance->newQuery(), $this, $table.'.'.$type, $table.'.'.$id, $localKey);
<add> return $this->newMorphOne($instance->newQuery(), $this, $table.'.'.$type, $table.'.'.$id, $localKey);
<add> }
<add>
<add> /**
<add> * Instantiate a new MorphOne relationship.
<add> *
<add> * @param \Illuminate\Database\Eloquent\Builder $query
<add> * @param \Illuminate\Database\Eloquent\Model $parent
<add> * @param string $type
<add> * @param string $id
<add> * @param string $localKey
<add> * @return \Illuminate\Database\Eloquent\Relations\MorphOne
<add> */
<add> protected function newMorphOne(Builder $query, Model $parent, $type, $id, $localKey)
<add> {
<add> return new MorphOne($query, $parent, $type, $id, $localKey);
<ide> }
<ide>
<ide> /**
<ide> public function morphMany($related, $name, $type = null, $id = null, $localKey =
<ide>
<ide> $localKey = $localKey ?: $this->getKeyName();
<ide>
<del> return new MorphMany($instance->newQuery(), $this, $table.'.'.$type, $table.'.'.$id, $localKey);
<add> return $this->newMorphMany($instance->newQuery(), $this, $table.'.'.$type, $table.'.'.$id, $localKey);
<add> }
<add>
<add> /**
<add> * Instantiate a new MorphMany relationship.
<add> *
<add> * @param \Illuminate\Database\Eloquent\Builder $query
<add> * @param \Illuminate\Database\Eloquent\Model $parent
<add> * @param string $type
<add> * @param string $id
<add> * @param string $localKey
<add> * @return \Illuminate\Database\Eloquent\Relations\MorphMany
<add> */
<add> protected function newMorphMany(Builder $query, Model $parent, $type, $id, $localKey)
<add> {
<add> return new MorphMany($query, $parent, $type, $id, $localKey);
<ide> }
<ide>
<ide> /**
<ide><path>tests/Integration/Database/EloquentRelationshipsTest.php
<ide> use Illuminate\Database\Eloquent\Builder;
<ide> use Illuminate\Database\Eloquent\Relations\HasOne;
<ide> use Illuminate\Database\Eloquent\Relations\HasMany;
<add>use Illuminate\Database\Eloquent\Relations\MorphOne;
<add>use Illuminate\Database\Eloquent\Relations\MorphMany;
<ide> use Illuminate\Database\Eloquent\Relations\BelongsTo;
<ide>
<ide> /**
<ide> public function standard_relationships()
<ide> $this->assertInstanceOf(HasOne::class, $post->attachment());
<ide> $this->assertInstanceOf(BelongsTo::class, $post->author());
<ide> $this->assertInstanceOf(HasMany::class, $post->comments());
<add> $this->assertInstanceOf(MorphOne::class, $post->owner());
<add> $this->assertInstanceOf(MorphMany::class, $post->replies());
<ide> }
<ide>
<ide> /**
<ide> public function overridden_relationships()
<ide> $this->assertInstanceOf(CustomHasOne::class, $post->attachment());
<ide> $this->assertInstanceOf(CustomBelongsTo::class, $post->author());
<ide> $this->assertInstanceOf(CustomHasMany::class, $post->comments());
<add> $this->assertInstanceOf(CustomMorphOne::class, $post->owner());
<add> $this->assertInstanceOf(CustomMorphMany::class, $post->replies());
<ide> }
<ide> }
<ide>
<ide> public function comments()
<ide> {
<ide> return $this->hasMany(FakeRelationship::class);
<ide> }
<add>
<add> public function replies()
<add> {
<add> return $this->morphMany(FakeRelationship::class, 'actionable');
<add> }
<add>
<add> public function owner()
<add> {
<add> return $this->morphOne(FakeRelationship::class, 'property');
<add> }
<ide> }
<ide>
<ide> class CustomPost extends Post
<ide> protected function newHasOne(Builder $query, Model $parent, $foreignKey, $localK
<ide> {
<ide> return new CustomHasOne($query, $parent, $foreignKey, $localKey);
<ide> }
<add>
<add> protected function newMorphOne(Builder $query, Model $parent, $type, $id, $localKey)
<add> {
<add> return new CustomMorphOne($query, $parent, $type, $id, $localKey);
<add> }
<add>
<add> protected function newMorphMany(Builder $query, Model $parent, $type, $id, $localKey)
<add> {
<add> return new CustomMorphMany($query, $parent, $type, $id, $localKey);
<add> }
<ide> }
<ide>
<ide> class CustomHasOne extends HasOne
<ide> class CustomBelongsTo extends BelongsTo
<ide> class CustomHasMany extends HasMany
<ide> {
<ide> }
<add>
<add>class CustomMorphOne extends MorphOne
<add>{
<add>}
<add>
<add>class CustomMorphMany extends MorphMany
<add>{
<add>} | 2 |
Javascript | Javascript | expose the instance cache | 75aee1714b60b8b43ebaebf9bffe5af43ff90cde | <ide><path>src/core/ReactMount.js
<ide> var ReactMount = {
<ide> /** Whether support for touch events should be initialized. */
<ide> useTouchEvents: false,
<ide>
<add> /** Exposed for debugging purposes **/
<add> _instanceByReactRootID: instanceByReactRootID,
<add>
<ide> /**
<ide> * This is a hook provided to support rendering React components while
<ide> * ensuring that the apparent scroll position of its `container` does not | 1 |
Javascript | Javascript | check this.connection before using it | 9afee6785e3f0710172a423eb6140e29bf436475 | <ide><path>lib/_http_outgoing.js
<ide> OutgoingMessage.prototype.end = function(data, encoding, callback) {
<ide> // There is the first message on the outgoing queue, and we've sent
<ide> // everything to the socket.
<ide> debug('outgoing message end.');
<del> if (this.output.length === 0 && this.connection._httpMessage === this) {
<add> if (this.output.length === 0 &&
<add> this.connection &&
<add> this.connection._httpMessage === this) {
<ide> this._finish();
<ide> }
<ide> | 1 |
Text | Text | fix mistranslation "never write to this.props." | 7e779a9d448d15e4e6465c5b65832506d00c1eab | <ide><path>docs/docs/02-displaying-data.ja-JP.md
<ide> setInterval(function() {
<ide>
<ide> このことについて私たちが理解できる方法は、Reactは必要になるまで、DOMの操作を行わないということです。 **Reactは、DOMの変化を表現し、あなたにもっとも効率的なDOMの変化を見積もるために早い、内部のモックのDOMを使っています。**
<ide>
<del>このコンポーネントのインプットは `props` と呼ばれるものです。"properties" の省略形です。それらはJSXシンタックスの中でアトリビュートとして渡されます。それらはコンポーネントの中で不変と考えるべきで、 **`this.props` と書かないようにしてください**
<add>このコンポーネントのインプットは `props` と呼ばれるものです。"properties" の省略形です。それらはJSXシンタックスの中でアトリビュートとして渡されます。それらはコンポーネントの中で不変と考えるべきで、 **`this.props` には書き込まないようにしてください**
<ide>
<ide> ## コンポーネントは関数のようなものです。
<ide> | 1 |
Javascript | Javascript | use ya in case xa is false | c28d39e47d7337636e832134b26d6214357fe3d4 | <ide><path>examples/with-firebase-authentication/utils/auth/mapUserData.js
<ide> export const mapUserData = (user) => {
<del> const { uid, email, xa } = user
<add> const { uid, email, xa, ya } = user
<ide> return {
<ide> id: uid,
<ide> email,
<del> token: xa,
<add> token: xa || ya,
<ide> }
<ide> } | 1 |
Javascript | Javascript | simplify setsecurecontext() option parsing | 82f89ec8c1554964f5029fab1cf0f4fad1fa55a8 | <ide><path>lib/_tls_wrap.js
<ide> Server.prototype.setSecureContext = function(options) {
<ide> else
<ide> this.crl = undefined;
<ide>
<del> if (options.sigalgs !== undefined)
<del> this.sigalgs = options.sigalgs;
<del> else
<del> this.sigalgs = undefined;
<add> this.sigalgs = options.sigalgs;
<ide>
<ide> if (options.ciphers)
<ide> this.ciphers = options.ciphers;
<ide> else
<ide> this.ciphers = undefined;
<ide>
<del> if (options.ecdhCurve !== undefined)
<del> this.ecdhCurve = options.ecdhCurve;
<del> else
<del> this.ecdhCurve = undefined;
<add> this.ecdhCurve = options.ecdhCurve;
<ide>
<ide> if (options.dhparam)
<ide> this.dhparam = options.dhparam; | 1 |
Ruby | Ruby | fix bogus require | 4f2e31b3e3ef3ab4758e3ac3c22dafd190652d5d | <ide><path>Library/Homebrew/language/python.rb
<del>require "utils.rb"
<add>require "utils"
<ide>
<ide> module Language
<ide> module Python | 1 |
Ruby | Ruby | remove protected method class#scoped? | 81cd11259c52544dd1bc401b7097e4a0e5d34fe6 | <ide><path>activerecord/lib/active_record/base.rb
<ide> def default_scope(options = {})
<ide> self.default_scoping << construct_finder_arel(options)
<ide> end
<ide>
<del> # Test whether the given method and optional key are scoped.
<del> def scoped?(method, key = nil) #:nodoc:
<del> case method
<del> when :create
<del> current_scoped_methods.send(:scope_for_create).present? if current_scoped_methods
<del> end
<del> end
<del>
<ide> def scoped_methods #:nodoc:
<ide> Thread.current[:"#{self}_scoped_methods"] ||= self.default_scoping.dup
<ide> end
<ide> def initialize_copy(other)
<ide> @attributes_cache = {}
<ide> @new_record = true
<ide> ensure_proper_type
<del> self.class.send(:scope, :create).each { |att, value| self.send("#{att}=", value) } if self.class.send(:scoped?, :create)
<add>
<add> if scope = self.class.send(:current_scoped_methods)
<add> create_with = scope.scope_for_create
<add> create_with.each { |att,value| self.send("#{att}=", value) } if create_with
<add> end
<ide> end
<ide>
<ide> # Returns a String, which Action Pack uses for constructing an URL to this | 1 |
Python | Python | use tmp dir and check version for cython test | c18b3f59b5f5752ab038224fd3bdf2dadba55ecf | <ide><path>numpy/random/_examples/cython/setup.py
<ide> from os.path import join, abspath, dirname
<ide>
<ide> path = abspath(dirname(__file__))
<add>defs = [('NPY_NO_DEPRECATED_API', 0)]
<ide>
<ide> extending = Extension("extending",
<ide> sources=[join(path, 'extending.pyx')],
<ide> include_dirs=[
<ide> np.get_include(),
<ide> join(path, '..', '..')
<ide> ],
<add> define_macros=defs,
<ide> )
<ide> distributions = Extension("extending_distributions",
<ide> sources=[join(path, 'extending_distributions.pyx')],
<del> include_dirs=[np.get_include()])
<add> include_dirs=[np.get_include()],
<add> define_macros=defs,
<add> )
<ide>
<ide> extensions = [extending, distributions]
<ide>
<ide><path>numpy/random/tests/test_extending.py
<ide> import os, sys
<ide> import pytest
<ide> import warnings
<add>import shutil
<add>import subprocess
<ide>
<ide> try:
<ide> import cffi
<ide>
<ide> try:
<ide> import cython
<add> from Cython.Compiler.Version import version as cython_version
<ide> except ImportError:
<ide> cython = None
<add>else:
<add> from distutils.version import LooseVersion
<add> # Cython 0.29.14 is required for Python 3.8 and there are
<add> # other fixes in the 0.29 series that are needed even for earlier
<add> # Python versions.
<add> # Note: keep in sync with the one in pyproject.toml
<add> required_version = LooseVersion('0.29.14')
<add> if LooseVersion(cython_version) < required_version:
<add> # too old or wrong cython, skip the test
<add> cython = None
<ide>
<ide> @pytest.mark.skipif(cython is None, reason="requires cython")
<del>def test_cython():
<del> curdir = os.getcwd()
<del> argv = sys.argv
<del> examples = (os.path.dirname(__file__), '..', '_examples')
<del> try:
<del> os.chdir(os.path.join(*examples))
<del> sys.argv = argv[:1] + ['build']
<del> with warnings.catch_warnings(record=True) as w:
<del> # setuptools issue gh-1885
<del> warnings.filterwarnings('always', '', DeprecationWarning)
<del> from numpy.random._examples.cython import setup
<del> finally:
<del> sys.argv = argv
<del> os.chdir(curdir)
<add>@pytest.mark.slow
<add>@pytest.mark.skipif(sys.platform == 'win32', reason="cmd too long on CI")
<add>def test_cython(tmp_path):
<add> examples = os.path.join(os.path.dirname(__file__), '..', '_examples')
<add> base = os.path.dirname(examples)
<add> shutil.copytree(examples, tmp_path / '_examples')
<add> subprocess.check_call([sys.executable, 'setup.py', 'build'],
<add> cwd=str(tmp_path / '_examples' / 'cython'))
<ide>
<ide> @pytest.mark.skipif(numba is None or cffi is None,
<ide> reason="requires numba and cffi")
<ide> def test_numba():
<del> from numpy.random._examples.numba import extending
<add> from numpy.random._examples.numba import extending
<ide>
<ide> @pytest.mark.skipif(cffi is None, reason="requires cffi")
<ide> def test_cffi():
<del> from numpy.random._examples.cffi import extending
<add> from numpy.random._examples.cffi import extending | 2 |
Go | Go | add stream format details for attach/logs endpoint | 48829ddf885eb656bff6dcf053bf96471b106bf0 | <ide><path>client/container_attach.go
<ide> import (
<ide> // It returns a types.HijackedConnection with the hijacked connection
<ide> // and the a reader to get output. It's up to the called to close
<ide> // the hijacked connection by calling types.HijackedResponse.Close.
<add>//
<add>// The stream format on the response will be in one of two formats:
<add>//
<add>// If the container is using a TTY, there is only a single stream (stdout), and
<add>// data is copied directly from the container output stream, no extra
<add>// multiplexing or headers.
<add>//
<add>// If the container is *not* using a TTY, streams for stdout and stderr are
<add>// multiplexed.
<add>// The format of the multiplexed stream is as follows:
<add>//
<add>// [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}[]byte{OUTPUT}
<add>//
<add>// STREAM_TYPE can be 1 for stdout and 2 for stderr
<add>//
<add>// SIZE1, SIZE2, SIZE3, and SIZE4 are four bytes of uint32 encoded as big endian.
<add>// This is the size of OUTPUT.
<add>//
<add>// You can use github.com/docker/docker/pkg/stdcopy.StdCopy to demultiplex this
<add>// stream.
<ide> func (cli *Client) ContainerAttach(ctx context.Context, container string, options types.ContainerAttachOptions) (types.HijackedResponse, error) {
<ide> query := url.Values{}
<ide> if options.Stream {
<ide><path>client/container_logs.go
<ide> import (
<ide>
<ide> // ContainerLogs returns the logs generated by a container in an io.ReadCloser.
<ide> // It's up to the caller to close the stream.
<add>//
<add>// The stream format on the response will be in one of two formats:
<add>//
<add>// If the container is using a TTY, there is only a single stream (stdout), and
<add>// data is copied directly from the container output stream, no extra
<add>// multiplexing or headers.
<add>//
<add>// If the container is *not* using a TTY, streams for stdout and stderr are
<add>// multiplexed.
<add>// The format of the multiplexed stream is as follows:
<add>//
<add>// [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}[]byte{OUTPUT}
<add>//
<add>// STREAM_TYPE can be 1 for stdout and 2 for stderr
<add>//
<add>// SIZE1, SIZE2, SIZE3, and SIZE4 are four bytes of uint32 encoded as big endian.
<add>// This is the size of OUTPUT.
<add>//
<add>// You can use github.com/docker/docker/pkg/stdcopy.StdCopy to demultiplex this
<add>// stream.
<ide> func (cli *Client) ContainerLogs(ctx context.Context, container string, options types.ContainerLogsOptions) (io.ReadCloser, error) {
<ide> query := url.Values{}
<ide> if options.ShowStdout { | 2 |
Text | Text | add hyperlinks for the curriculum | bd244f99581044fdc15ce6cc3ba8663056070c9f | <ide><path>README.md
<ide> Here are our six core certifications:
<ide>
<ide> #### 1. Responsive Web Design Certification
<ide>
<del>- Basic HTML and HTML5
<del>- Basic CSS
<del>- Applied Visual Design
<del>- Applied Accessibility
<del>- Responsive Web Design Principles
<del>- CSS Flexbox
<del>- CSS Grid <br />
<add>- [Basic HTML and HTML5](https://learn.freecodecamp.org/responsive-web-design/basic-html-and-html5)
<add>- [Basic CSS](https://learn.freecodecamp.org/responsive-web-design/basic-css)
<add>- [Applied Visual Design](https://learn.freecodecamp.org/responsive-web-design/applied-visual-design)
<add>- [Applied Accessibility](https://learn.freecodecamp.org/responsive-web-design/applied-accessibility)
<add>- [Responsive Web Design Principles](https://learn.freecodecamp.org/responsive-web-design/responsive-web-design-principles)
<add>- [CSS Flexbox](https://learn.freecodecamp.org/responsive-web-design/css-flexbox)
<add>- [CSS Grid](https://learn.freecodecamp.org/responsive-web-design/css-grid)
<add> <br />
<ide> <br />
<ide> **Projects**: Tribute Page, Survey Form, Product Landing Page, Technical Documentation Page, Personal Portfolio Webpage
<ide>
<ide> #### 2. JavaScript Algorithms and Data Structures Certification
<ide>
<del>- Basic JavaScript
<del>- ES6
<del>- Regular Expressions
<del>- Debugging
<del>- Basic Data Structures
<del>- Algorithm Scripting
<del>- Object-Oriented Programming
<del>- Functional Programming <br />
<add>- [Basic JavaScript](https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript)
<add>- [ES6](https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6)
<add>- [Regular Expressions](https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions)
<add>- [Debugging](https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/debugging)
<add>- [Basic Data Structures](https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-data-structures)
<add>- [Algorithm Scripting](https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting)
<add>- [Object Oriented Programming](https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/object-oriented-programming)
<add>- [Functional Programming](https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/functional-programming)
<add>- [Intermediate Algorithm Scripting](https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting)
<add> <br />
<ide> <br />
<ide> **Projects**: Palindrome Checker, Roman Numeral Converter, Caesar's Cipher, Telephone Number Validator, Cash Register
<ide>
<ide> #### 3. Front End Libraries Certification
<ide>
<del>- Bootstrap
<del>- jQuery
<del>- Sass
<del>- React
<del>- Redux
<del>- React and Redux <br />
<add>- [Bootstrap](https://learn.freecodecamp.org/front-end-libraries/bootstrap)
<add>- [jQuery](https://learn.freecodecamp.org/front-end-libraries/jquery)
<add>- [Sass](https://learn.freecodecamp.org/front-end-libraries/sass)
<add>- [React](https://learn.freecodecamp.org/front-end-libraries/react)
<add>- [Redux](https://learn.freecodecamp.org/front-end-libraries/redux)
<add>- [React and Redux](https://learn.freecodecamp.org/front-end-libraries/react-and-redux)
<add> <br />
<ide> <br />
<ide> **Projects**: Random Quote Machine, Markdown Previewer, Drum Machine, JavaScript Calculator, Pomodoro Clock
<ide>
<ide> #### 4. Data Visualization Certification
<ide>
<del>- Data Visualization with D3
<del>- JSON APIs and Ajax <br />
<add>- [Data Visualization with D3](https://learn.freecodecamp.org/data-visualization/data-visualization-with-d3)
<add>- [JSON APIs and Ajax](https://learn.freecodecamp.org/data-visualization/json-apis-and-ajax)
<add> <br />
<ide> <br />
<ide> **Projects**: Bar Chart, Scatterplot Graph, Heat Map, Choropleth Map, Treemap Diagram
<ide>
<ide> #### 5. APIs and Microservices Certification
<ide>
<del>- Managing Packages with Npm
<del>- Basic Node and Express
<del>- MongoDB and Mongoose <br />
<add>- [Managing Packages with Npm](https://learn.freecodecamp.org/apis-and-microservices/managing-packages-with-npm)
<add>- [Basic Node and Express](https://learn.freecodecamp.org/apis-and-microservices/basic-node-and-express)
<add>- [MongoDB and Mongoose](https://learn.freecodecamp.org/apis-and-microservices/mongodb-and-mongoose)
<add> <br />
<ide> <br />
<ide> **Projects**: Timestamp Microservice, Request Header Parser, URL Shortener, Exercise Tracker, File Metadata Microservice
<ide>
<ide> #### 6. Information Security and Quality Assurance Certification
<ide>
<del>- Information Security with HelmetJS
<del>- Quality Assurance and Testing with Chai
<del>- Advanced Node and Express <br />
<add>- [Information Security with HelmetJS](https://learn.freecodecamp.org/information-security-and-quality-assurance/information-security-with-helmetjs)
<add>- [Quality Assurance and Testing with Chai](https://learn.freecodecamp.org/information-security-and-quality-assurance/quality-assurance-and-testing-with-chai)
<add>- [Advanced Node and Express](https://learn.freecodecamp.org/information-security-and-quality-assurance/advanced-node-and-express)
<add> <br />
<ide> <br />
<ide> **Projects**: Metric-Imperial Converter, Issue Tracker, Personal Library, Stock Price Checker, Anonymous Message Board
<ide> | 1 |
PHP | PHP | avoid re-ordering routes | 978f5cebd40c8ed939d2a89644c56938d61cddd4 | <ide><path>src/Illuminate/Routing/RouteCollection.php
<ide> public function match(Request $request)
<ide> */
<ide> protected function matchAgainstRoutes(array $routes, $request, $includingMethod = true)
<ide> {
<del> return collect($routes)->sortBy('isFallback')->first(function ($value) use ($request, $includingMethod) {
<add> list($fallbacks, $routes) = collect($routes)->partition(function ($route) {
<add> return $route->isFallback;
<add> });
<add>
<add> return $routes->merge($fallbacks)->first(function ($value) use ($request, $includingMethod) {
<ide> return $value->matches($request, $includingMethod);
<ide> });
<ide> }
<ide><path>tests/Integration/Routing/FallbackRouteTest.php
<ide> public function test_fallback_with_wildcards()
<ide> return response('fallback', 404);
<ide> });
<ide>
<add> Route::get('one', function () {
<add> return 'one';
<add> });
<add>
<ide> Route::get('{any}', function () {
<ide> return 'wildcard';
<ide> })->where('any', '.*');
<ide>
<add> $this->assertContains('one', $this->get('/one')->getContent());
<add> $this->assertContains('wildcard', $this->get('/non-existing')->getContent());
<add> $this->assertEquals(200, $this->get('/non-existing')->getStatusCode());
<add> }
<add>
<add> public function test_no_routes()
<add> {
<add> Route::fallback(function () {
<add> return response('fallback', 404);
<add> });
<add>
<add> $this->assertContains('fallback', $this->get('/non-existing')->getContent());
<add> $this->assertEquals(404, $this->get('/non-existing')->getStatusCode());
<add> }
<add>
<add> public function test_no_fallbacks()
<add> {
<ide> Route::get('one', function () {
<ide> return 'one';
<ide> });
<ide>
<ide> $this->assertContains('one', $this->get('/one')->getContent());
<del> $this->assertContains('wildcard', $this->get('/non-existing')->getContent());
<del> $this->assertEquals(200, $this->get('/non-existing')->getStatusCode());
<add> $this->assertEquals(200, $this->get('/one')->getStatusCode());
<ide> }
<ide> } | 2 |
Java | Java | remove unused import | 6e99ad0a5f37ecbb9bb752aebe03bca99adbf03c | <ide><path>src/main/java/io/reactivex/internal/operators/flowable/FlowableToList.java
<ide>
<ide> import io.reactivex.exceptions.Exceptions;
<ide> import io.reactivex.internal.subscriptions.*;
<del>import io.reactivex.internal.util.ArrayListSupplier;
<ide>
<ide> public final class FlowableToList<T, U extends Collection<? super T>> extends AbstractFlowableWithUpstream<T, U> {
<ide> final Callable<U> collectionSupplier; | 1 |
Ruby | Ruby | optimize url helpers | cd5dabab95924dfaf3af8c429454f1a46d9665c1 | <ide><path>actionpack/lib/action_dispatch/routing/route_set.rb
<ide> def define_url_helper(route, name, kind, options)
<ide> @module.module_eval <<-END_EVAL, __FILE__, __LINE__ + 1
<ide> remove_possible_method :#{selector}
<ide> def #{selector}(*args)
<del> if args.size == #{route.required_parts.size} && !args.last.is_a?(Hash) && _optimized_routes?
<add> if args.size == #{route.required_parts.size} && !args.last.is_a?(Hash) && optimize_routes_generation?
<ide> options = #{options.inspect}.merge!(url_options)
<ide> options[:path] = "#{optimized_helper(route)}"
<ide> ActionDispatch::Http::URL.url_for(options)
<ide> def #{selector}(*args)
<ide> helpers << selector
<ide> end
<ide>
<del> # If we are generating a path helper and we don't have a *path segment.
<del> # We can optimize the routes generation to a string interpolation if
<del> # it meets the appropriated runtime conditions.
<del> #
<del> # TODO We are enabling this only for path helpers, remove the
<del> # kind == :path and fix the failures to enable it for url as well.
<add> # Clause check about when we need to generate an optimized helper.
<ide> def optimize_helper?(kind, route) #:nodoc:
<del> kind == :path && route.ast.grep(Journey::Nodes::Star).empty?
<add> route.ast.grep(Journey::Nodes::Star).empty? && route.requirements.except(:controller, :action).empty?
<ide> end
<ide>
<ide> # Generates the interpolation to be used in the optimized helper.
<ide> def url_helpers
<ide> # Rails.application.routes.url_helpers.url_for(args)
<ide> @_routes = routes
<ide> class << self
<del> delegate :url_for, :to => '@_routes'
<add> delegate :url_for, :optimize_routes_generation?, :to => '@_routes'
<ide> end
<ide>
<ide> # Make named_routes available in the module singleton
<ide> def mounted?
<ide> false
<ide> end
<ide>
<add> def optimize_routes_generation?
<add> !mounted? && default_url_options.empty?
<add> end
<add>
<ide> def _generate_prefix(options = {})
<ide> nil
<ide> end
<ide><path>actionpack/lib/action_dispatch/routing/url_for.rb
<ide> def initialize(*)
<ide> super
<ide> end
<ide>
<add> # Hook overriden in controller to add request information
<add> # with `default_url_options`. Application logic should not
<add> # go into url_options.
<ide> def url_options
<ide> default_url_options
<ide> end
<ide> def url_for(options = nil)
<ide>
<ide> protected
<ide>
<del> def _optimized_routes?
<add> def optimize_routes_generation?
<ide> return @_optimized_routes if defined?(@_optimized_routes)
<del> @_optimized_routes = default_url_options.empty? && !_routes.mounted? && _routes.default_url_options.empty?
<add> @_optimized_routes = _routes.optimize_routes_generation? && default_url_options.empty?
<ide> end
<ide>
<ide> def _with_routes(routes)
<ide><path>actionpack/lib/action_view/helpers/url_helper.rb
<ide> module UrlHelper
<ide> include ActionDispatch::Routing::UrlFor
<ide> include TagHelper
<ide>
<del> def _routes_context
<del> controller
<del> end
<add> # We need to override url_optoins, _routes_context
<add> # and optimize_routes_generation? to consider the controller.
<ide>
<del> # Need to map default url options to controller one.
<del> # def default_url_options(*args) #:nodoc:
<del> # controller.send(:default_url_options, *args)
<del> # end
<del> #
<del> def url_options
<add> def url_options #:nodoc:
<ide> return super unless controller.respond_to?(:url_options)
<ide> controller.url_options
<ide> end
<ide>
<add> def _routes_context #:nodoc:
<add> controller
<add> end
<add> protected :_routes_context
<add>
<add> def optimize_routes_generation? #:nodoc:
<add> controller.respond_to?(:optimize_routes_generation?) ?
<add> controller.optimize_routes_generation? : super
<add> end
<add> protected :optimize_routes_generation?
<add>
<ide> # Returns the URL for the set of +options+ provided. This takes the
<ide> # same options as +url_for+ in Action Controller (see the
<ide> # documentation for <tt>ActionController::Base#url_for</tt>). Note that by default
<ide><path>actionpack/test/controller/base_test.rb
<ide> def from_view
<ide> end
<ide>
<ide> def url_options
<del> super.merge(:host => 'www.override.com', :action => 'new', :locale => 'en')
<add> super.merge(:host => 'www.override.com')
<ide> end
<ide> end
<ide>
<ide> def test_url_options_override
<ide>
<ide> get :from_view, :route => "from_view_url"
<ide>
<del> assert_equal 'http://www.override.com/from_view?locale=en', @response.body
<del> assert_equal 'http://www.override.com/from_view?locale=en', @controller.send(:from_view_url)
<del> assert_equal 'http://www.override.com/default_url_options/new?locale=en', @controller.url_for(:controller => 'default_url_options')
<add> assert_equal 'http://www.override.com/from_view', @response.body
<add> assert_equal 'http://www.override.com/from_view', @controller.send(:from_view_url)
<add> assert_equal 'http://www.override.com/default_url_options/index', @controller.url_for(:controller => 'default_url_options')
<ide> end
<ide> end
<ide>
<ide><path>actionpack/test/controller/routing_test.rb
<ide> def test_route_generation_allows_passing_non_string_values_to_generated_helper
<ide> class MockController
<ide> def self.build(helpers)
<ide> Class.new do
<del> def url_for(options)
<add> def url_options
<add> options = super
<ide> options[:protocol] ||= "http"
<ide> options[:host] ||= "test.host"
<del>
<del> super(options)
<add> options
<ide> end
<ide>
<ide> include helpers
<ide><path>actionpack/test/template/sprockets_helper_with_routes_test.rb
<ide> class SprocketsHelperWithRoutesTest < ActionView::TestCase
<ide>
<ide> def setup
<ide> super
<del> @controller = BasicController.new
<add> @controller = BasicController.new
<ide>
<ide> @assets = Sprockets::Environment.new
<ide> @assets.append_path(FIXTURES.join("sprockets/app/javascripts"))
<ide> def setup
<ide>
<ide> test "namespace conflicts on a named route called asset_path" do
<ide> # Testing this for sanity - asset_path is now a named route!
<del> assert_match asset_path('test_asset'), '/assets/test_asset'
<add> assert_equal asset_path('test_asset'), '/assets/test_asset'
<ide>
<ide> assert_match %r{/assets/logo-[0-9a-f]+.png},
<ide> path_to_asset("logo.png") | 6 |
Ruby | Ruby | add link_overwrite dsl | 09c810c7f428b838b9b327d1c92f87ebc6e76447 | <ide><path>Library/Homebrew/formula.rb
<ide> require "pkg_version"
<ide> require "tap"
<ide> require "formula_renames"
<add>require "keg"
<ide>
<ide> # A formula provides instructions and metadata for Homebrew to install a piece
<ide> # of software. Every Homebrew formula is a {Formula}.
<ide> def installed_prefix
<ide> # The currently installed version for this formula. Will raise an exception
<ide> # if the formula is not installed.
<ide> def installed_version
<del> require "keg"
<ide> Keg.new(installed_prefix).version
<ide> end
<ide>
<ide> def skip_clean?(path)
<ide> self.class.skip_clean_paths.include? to_check
<ide> end
<ide>
<add> # Sometimes we accidentally install files outside prefix. After we fix that,
<add> # users will get nasty link conflict error. So we create a whitelist here to
<add> # allow overwriting certain files. e.g.
<add> # link_overwrite "bin/foo", "lib/bar"
<add> # link_overwrite "share/man/man1/baz-*"
<add> def link_overwrite?(path)
<add> # Don't overwrite files not created by Homebrew.
<add> return false unless path.stat.uid == File.stat(HOMEBREW_BREW_FILE).uid
<add> # Don't overwrite files belong to other keg.
<add> begin
<add> Keg.for(path)
<add> rescue NotAKegError, Errno::ENOENT
<add> # file doesn't belong to any keg.
<add> else
<add> return false
<add> end
<add> to_check = path.relative_path_from(HOMEBREW_PREFIX).to_s
<add> self.class.link_overwrite_paths.any? do |p|
<add> p == to_check ||
<add> to_check.start_with?(p.chomp("/") + "/") ||
<add> /^#{Regexp.escape(p).gsub('\*', ".*?")}$/ === to_check
<add> end
<add> end
<add>
<ide> def skip_cxxstdlib_check?
<ide> false
<ide> end
<ide> def needs(*standards)
<ide> def test(&block)
<ide> define_method(:test, &block)
<ide> end
<add>
<add> def link_overwrite(*paths)
<add> paths.flatten!
<add> link_overwrite_paths.merge(paths)
<add> end
<add>
<add> def link_overwrite_paths
<add> @link_overwrite_paths ||= Set.new
<add> end
<ide> end
<ide> end
<ide><path>Library/Homebrew/formula_installer.rb
<ide> def link(keg)
<ide> keg.remove_linked_keg_record
<ide> end
<ide>
<add> link_overwrite_backup = {} # dict: conflict file -> backup file
<add> backup_dir = HOMEBREW_CACHE/"Backup"
<add>
<ide> begin
<ide> keg.link
<ide> rescue Keg::ConflictError => e
<add> conflict_file = e.dst
<add> if formula.link_overwrite?(conflict_file) && !link_overwrite_backup.key?(conflict_file)
<add> backup_file = backup_dir/conflict_file.relative_path_from(HOMEBREW_PREFIX).to_s
<add> backup_file.parent.mkpath
<add> conflict_file.rename backup_file
<add> link_overwrite_backup[conflict_file] = backup_file
<add> retry
<add> end
<ide> onoe "The `brew link` step did not complete successfully"
<ide> puts "The formula built, but is not symlinked into #{HOMEBREW_PREFIX}"
<ide> puts e
<ide> def link(keg)
<ide> puts e
<ide> puts e.backtrace if debug?
<ide> @show_summary_heading = true
<del> ignore_interrupts { keg.unlink }
<add> ignore_interrupts do
<add> keg.unlink
<add> link_overwrite_backup.each do |conflict_file, backup_file|
<add> conflict_file.parent.mkpath
<add> backup_file.rename conflict_file
<add> end
<add> end
<ide> Homebrew.failed = true
<ide> raise
<ide> end
<add>
<add> unless link_overwrite_backup.empty?
<add> opoo "These files were overwritten during `brew link` step:"
<add> puts link_overwrite_backup.keys
<add> puts
<add> puts "They are backup in #{backup_dir}"
<add> @show_summary_heading = true
<add> end
<ide> end
<ide>
<ide> def install_plist | 2 |
PHP | PHP | remove pointless tests and fix failing ones | 6bdd1d5c4638068acd0cb855f78b667dc55ceb09 | <ide><path>Cake/Test/TestCase/View/Helper/PaginatorHelperTest.php
<ide> public function setUp() {
<ide> 'prevPage' => false,
<ide> 'nextPage' => true,
<ide> 'pageCount' => 7,
<del> 'order' => null,
<del> 'limit' => 20,
<add> 'sort' => null,
<add> 'direction' => null,
<add> 'limit' => null,
<ide> )
<ide> )
<ide> ));
<ide> public function testSortLinks() {
<ide> $this->assertTags($result, $expected);
<ide>
<ide> $this->Paginator->request->params['paging']['Article']['sort'] = 'Article.title';
<del> $this->Paginator->request->params['paging']['Article']['sort'] = 'asc';
<add> $this->Paginator->request->params['paging']['Article']['direction'] = 'asc';
<ide> $result = $this->Paginator->sort('title', 'Title', array('direction' => 'asc'));
<ide> $expected = array(
<ide> 'a' => array('href' => '/accounts/index/param?sort=title&direction=desc', 'class' => 'asc'),
<ide> public function testSortLinksUsingDotNotation() {
<ide> * @return void
<ide> */
<ide> public function testSortKey() {
<del> $result = $this->Paginator->sortKey(null, array(
<del> 'order' => array('Article.title' => 'desc'
<del> )));
<del> $this->assertEquals('Article.title', $result);
<del>
<del> $result = $this->Paginator->sortKey('Article', array('order' => 'Article.title'));
<del> $this->assertEquals('Article.title', $result);
<del>
<ide> $result = $this->Paginator->sortKey('Article', array('sort' => 'Article.title'));
<ide> $this->assertEquals('Article.title', $result);
<ide>
<ide> public function testSortKey() {
<ide> * @return void
<ide> */
<ide> public function testSortKeyFallbackToParams() {
<del> $this->Paginator->request->params['paging']['Article']['order'] = 'Article.body';
<add> $this->Paginator->request->params['paging']['Article']['sort'] = 'Article.body';
<ide> $result = $this->Paginator->sortKey();
<ide> $this->assertEquals('Article.body', $result);
<ide>
<ide> $result = $this->Paginator->sortKey('Article');
<ide> $this->assertEquals('Article.body', $result);
<ide>
<del> $this->Paginator->request->params['paging']['Article']['order'] = array(
<del> 'Article.body' => 'DESC'
<del> );
<add> $this->Paginator->request->params['paging']['Article']['sort'] = 'Article.body';
<add> $this->Paginator->request->params['paging']['Article']['order'] = 'DESC';
<ide> $result = $this->Paginator->sortKey();
<ide> $this->assertEquals('Article.body', $result);
<ide>
<ide> public function testNumbers() {
<ide> * @return void
<ide> */
<ide> public function testFirstAndLastTag() {
<add> $this->Paginator->request->params['paging']['Article']['page'] = 2;
<ide> $result = $this->Paginator->first('<<', array('tag' => 'li', 'class' => 'first'));
<ide> $expected = array(
<ide> 'li' => array('class' => 'first'),
<ide> public function testFirstEmpty() {
<ide> * @return void
<ide> */
<ide> public function testFirstFullBaseUrl() {
<add> $this->Paginator->request->params['paging']['Article']['page'] = 3;
<add> $this->Paginator->request->params['paging']['Article']['direction'] = 'DESC';
<ide> $this->Paginator->request->params['paging']['Article']['sort'] = 'Article.title';
<ide> $this->Paginator->request->params['paging']['Article']['direction'] = 'DESC';
<ide>
<ide> public function testFirstFullBaseUrl() {
<ide> * @return void
<ide> */
<ide> public function testFirstBoundaries() {
<add> $this->Paginator->request->params['paging']['Article']['page'] = 3;
<ide> $result = $this->Paginator->first();
<ide> $expected = array(
<ide> '<span',
<ide><path>Cake/View/Helper/PaginatorHelper.php
<ide> public function url($options = array(), $asArray = false, $model = null) {
<ide> $paging += ['page' => null, 'sort' => null, 'direction' => null, 'limit' => null];
<ide> $url = [
<ide> 'page' => $paging['page'],
<del> 'sort' => $paging['sort'],
<del> 'direction' => $paging['sort'],
<ide> 'limit' => $paging['limit'],
<add> 'sort' => $paging['sort'],
<add> 'direction' => $paging['direction'],
<ide> ];
<ide> $url = array_merge(array_filter($url), $options);
<ide> | 2 |
Python | Python | fix example in config | a8549bdd825e3fcde4002721777367a008cdc1fd | <ide><path>src/transformers/models/gpt_neo/configuration_gpt_neo.py
<ide> class GPTNeoConfig(PretrainedConfig):
<ide>
<ide> Example::
<ide>
<del> >>> from transformers import GPTNeoModel, GPTNeoConfig
<add> >>> from transformers import GPTNeoModel, GPTNeoConfig
<ide>
<del> >>> # Initializing a GPTNeo EleutherAI/gpt-neo-1.3B style configuration
<del> >>> configuration = GPTNeoConfig()
<add> >>> # Initializing a GPTNeo EleutherAI/gpt-neo-1.3B style configuration
<add> >>> configuration = GPTNeoConfig()
<ide>
<del> >>> # Initializing a model from the EleutherAI/gpt-neo-1.3B style configuration
<del> >>> model = GPTNeoModel(configuration)
<add> >>> # Initializing a model from the EleutherAI/gpt-neo-1.3B style configuration
<add> >>> model = GPTNeoModel(configuration)
<ide>
<del> >>> # Accessing the model configuration
<del> >>> configuration = model.config
<add> >>> # Accessing the model configuration
<add> >>> configuration = model.config
<ide> """
<ide> model_type = "gpt_neo"
<ide> | 1 |
Python | Python | add missing parameter to stub function | 9b1a68db2fd78a0c39e361e997f3d4e2981c01b8 | <ide><path>celery/backends/base.py
<ide> def encode_result(self, result, status):
<ide> else:
<ide> return self.prepare_value(result)
<ide>
<del> def store_result(self, task_id, result, status):
<add> def store_result(self, task_id, result, status, traceback=None):
<ide> """Store the result and status of a task."""
<ide> raise NotImplementedError(
<ide> "store_result is not supported by this backend.") | 1 |
Javascript | Javascript | remove scrollwithoutanimationto from scrollview | c7e89909da70ac5290f9971080eb897567db3e43 | <ide><path>Libraries/Components/ScrollResponder.js
<ide> const ScrollResponderMixin = {
<ide> );
<ide> },
<ide>
<del> /**
<del> * Deprecated, do not use.
<del> */
<del> scrollResponderScrollWithoutAnimationTo: function(
<del> offsetX: number,
<del> offsetY: number,
<del> ) {
<del> console.warn(
<del> '`scrollResponderScrollWithoutAnimationTo` is deprecated. Use `scrollResponderScrollTo` instead',
<del> );
<del> this.scrollResponderScrollTo({x: offsetX, y: offsetY, animated: false});
<del> },
<del>
<ide> /**
<ide> * A helper function to zoom to a specific rect in the scrollview. The argument has the shape
<ide> * {x: number; y: number; width: number; height: number; animated: boolean = true}
<ide><path>Libraries/Components/ScrollView/ScrollView.js
<ide> export type ScrollResponderType = {
<ide>
<ide> setNativeProps: $PropertyType<ScrollView, 'setNativeProps'>,
<ide> scrollTo: $PropertyType<ScrollView, 'scrollTo'>,
<del> scrollWithoutAnimationTo: $PropertyType<
<del> ScrollView,
<del> 'scrollWithoutAnimationTo',
<del> >,
<ide> flashScrollIndicators: $PropertyType<ScrollView, 'flashScrollIndicators'>,
<ide>
<ide> ...typeof ScrollResponder.Mixin,
<ide> class ScrollView extends React.Component<Props, State> {
<ide> });
<ide> }
<ide>
<del> /**
<del> * Deprecated, use `scrollTo` instead.
<del> */
<del> scrollWithoutAnimationTo(y: number = 0, x: number = 0) {
<del> console.warn(
<del> '`scrollWithoutAnimationTo` is deprecated. Use `scrollTo` instead',
<del> );
<del> this.scrollTo({x, y, animated: false});
<del> }
<del>
<ide> /**
<ide> * Displays the scroll indicators momentarily.
<ide> * | 2 |
Python | Python | convert scripts into entry_points | 87c1244c7db8d57d6e1eed9a6578c0262379afea | <ide><path>pytorch_pretrained_bert/__main__.py
<ide> # coding: utf8
<del>if __name__ == '__main__':
<add>def main():
<ide> import sys
<ide> try:
<ide> from .convert_tf_checkpoint_to_pytorch import convert_tf_checkpoint_to_pytorch
<ide> TF_CONFIG = sys.argv.pop()
<ide> TF_CHECKPOINT = sys.argv.pop()
<ide> convert_tf_checkpoint_to_pytorch(TF_CHECKPOINT, TF_CONFIG, PYTORCH_DUMP_OUTPUT)
<add>
<add>if __name__ == '__main__':
<add> main()
<ide><path>setup.py
<ide> 'boto3',
<ide> 'requests',
<ide> 'tqdm'],
<del> scripts=["bin/pytorch_pretrained_bert"],
<add> entry_points={
<add> 'console_scripts': [
<add> "pytorch_pretrained_bert=pytorch_pretrained_bert.__main__:main"
<add> ]
<add> },
<ide> python_requires='>=3.5.0',
<ide> tests_require=['pytest'],
<ide> classifiers=[ | 2 |
PHP | PHP | apply suggestions from code review | 9410ffab50c8d2818fe1b2c4e0b65962cd009da2 | <ide><path>src/ORM/EagerLoader.php
<ide> public function loadExternal(Query $query, StatementInterface $statement): State
<ide>
<ide> $requiresKeys = $instance->requiresKeys($config);
<ide> if ($requiresKeys) {
<del> // If the path or alias has no key the required assoication load will fail.
<add> // If the path or alias has no key the required association load will fail.
<ide> // Nested paths are not subject to this condition because they could
<ide> // be attached to joined associations.
<ide> if (
<ide> strpos($path, '.') === false &&
<ide> (!array_key_exists($path, $collected) || !array_key_exists($alias, $collected[$path]))
<ide> ) {
<del> $message = "Unable to load `{$path}` association. Ensure foreign key on `{$alias}` is selected.";
<add> $message = "Unable to load `{$path}` association. Ensure foreign key in `{$alias}` is selected.";
<ide> throw new InvalidArgumentException($message);
<ide> }
<ide>
<ide><path>tests/TestCase/ORM/Association/BelongsToTest.php
<ide> public function testAttachToNoForeignKeySelect()
<ide> ->contain('Authors');
<ide>
<ide> $this->expectException(InvalidArgumentException::class);
<del> $this->expectExceptionMessage('Unable to load `Authors` association. Ensure foreign key on `Articles`');
<add> $this->expectExceptionMessage('Unable to load `Authors` association. Ensure foreign key in `Articles`');
<ide> $query->first();
<ide> }
<ide> }
<ide><path>tests/TestCase/ORM/Association/HasManyTest.php
<ide> public function testEagerloaderNoForeignKeys()
<ide> $authors->hasMany('Articles');
<ide>
<ide> $this->expectException(InvalidArgumentException::class);
<del> $this->expectExceptionMessage('Unable to load `Articles` association. Ensure foreign key on `Authors`');
<add> $this->expectExceptionMessage('Unable to load `Articles` association. Ensure foreign key in `Authors`');
<ide> $query = $authors->find()
<ide> ->select(['Authors.name'])
<ide> ->where(['Authors.id' => 1]) | 3 |
Javascript | Javascript | convert examples/node/pdf2svg.js to await/async | 0643ccb68b8c12e6734eaa02c9a2b11859096188 | <ide><path>examples/node/pdf2svg.js
<ide> try {
<ide> // Dumps svg outputs to a folder called svgdump
<ide> function getFilePathForPage(pageNum) {
<ide> const name = path.basename(pdfPath, path.extname(pdfPath));
<del> return path.join(outputDirectory, name + "-" + pageNum + ".svg");
<add> return path.join(outputDirectory, `${name}-${pageNum}.svg`);
<ide> }
<ide>
<ide> /**
<ide> function writeSvgToFile(svgElement, filePath) {
<ide> });
<ide> }
<ide>
<del>// Will be using promises to load document, pages and misc data instead of
<del>// callback.
<add>// Will be using async/await to load document, pages and misc data.
<ide> const loadingTask = pdfjsLib.getDocument({
<ide> data,
<ide> cMapUrl: CMAP_URL,
<ide> cMapPacked: CMAP_PACKED,
<ide> fontExtraProperties: true,
<ide> });
<del>loadingTask.promise
<del> .then(function (doc) {
<del> const numPages = doc.numPages;
<del> console.log("# Document Loaded");
<del> console.log("Number of Pages: " + numPages);
<del> console.log();
<add>(async function () {
<add> const doc = await loadingTask.promise;
<add> const numPages = doc.numPages;
<add> console.log("# Document Loaded");
<add> console.log(`Number of Pages: ${numPages}`);
<add> console.log();
<ide>
<del> let lastPromise = Promise.resolve(); // will be used to chain promises
<del> const loadPage = function (pageNum) {
<del> return doc.getPage(pageNum).then(function (page) {
<del> console.log("# Page " + pageNum);
<del> const viewport = page.getViewport({ scale: 1.0 });
<del> console.log("Size: " + viewport.width + "x" + viewport.height);
<del> console.log();
<add> for (let pageNum = 1; pageNum <= numPages; pageNum++) {
<add> try {
<add> const page = await doc.getPage(pageNum);
<add> console.log(`# Page ${pageNum}`);
<add> const viewport = page.getViewport({ scale: 1.0 });
<add> console.log(`Size: ${viewport.width}x${viewport.height}`);
<add> console.log();
<ide>
<del> return page.getOperatorList().then(function (opList) {
<del> const svgGfx = new pdfjsLib.SVGGraphics(page.commonObjs, page.objs);
<del> svgGfx.embedFonts = true;
<del> return svgGfx.getSVG(opList, viewport).then(function (svg) {
<del> return writeSvgToFile(svg, getFilePathForPage(pageNum)).then(
<del> function () {
<del> console.log("Page: " + pageNum);
<del> },
<del> function (err) {
<del> console.log("Error: " + err);
<del> }
<del> );
<del> });
<del> });
<del> });
<del> };
<del>
<del> for (let i = 1; i <= numPages; i++) {
<del> lastPromise = lastPromise.then(loadPage.bind(null, i));
<del> }
<del> return lastPromise;
<del> })
<del> .then(
<del> function () {
<del> console.log("# End of Document");
<del> },
<del> function (err) {
<del> console.error("Error: " + err);
<add> const opList = await page.getOperatorList();
<add> const svgGfx = new pdfjsLib.SVGGraphics(page.commonObjs, page.objs);
<add> svgGfx.embedFonts = true;
<add> const svg = await svgGfx.getSVG(opList, viewport);
<add> await writeSvgToFile(svg, getFilePathForPage(pageNum));
<add> } catch (err) {
<add> console.log(`Error: ${err}`);
<ide> }
<del> );
<add> }
<add> console.log("# End of Document");
<add>})(); | 1 |
Go | Go | remove unused registry.erralreadyexists | 9f874e53b9a386c58d6d54dca658945998d83a28 | <ide><path>registry/registry.go
<ide> package registry // import "github.com/docker/docker/registry"
<ide>
<ide> import (
<ide> "crypto/tls"
<del> "errors"
<ide> "fmt"
<ide> "net"
<ide> "net/http"
<ide> import (
<ide> "github.com/sirupsen/logrus"
<ide> )
<ide>
<del>var (
<del> // ErrAlreadyExists is an error returned if an image being pushed
<del> // already exists on the remote side
<del> ErrAlreadyExists = errors.New("Image already exists")
<del>)
<del>
<ide> // HostCertsDir returns the config directory for a specific host
<ide> func HostCertsDir(hostname string) (string, error) {
<ide> certsDir := CertsDir() | 1 |
Javascript | Javascript | use es2017 syntax in test-fs-open-* | 841caef9db88347e5c61668a814ccd5b99fc00a1 | <ide><path>test/parallel/test-fs-open-flags.js
<ide> const assert = require('assert');
<ide> const fs = require('fs');
<ide> const path = require('path');
<ide>
<del>const O_APPEND = fs.constants.O_APPEND || 0;
<del>const O_CREAT = fs.constants.O_CREAT || 0;
<del>const O_EXCL = fs.constants.O_EXCL || 0;
<del>const O_RDONLY = fs.constants.O_RDONLY || 0;
<del>const O_RDWR = fs.constants.O_RDWR || 0;
<del>const O_SYNC = fs.constants.O_SYNC || 0;
<del>const O_DSYNC = fs.constants.O_DSYNC || 0;
<del>const O_TRUNC = fs.constants.O_TRUNC || 0;
<del>const O_WRONLY = fs.constants.O_WRONLY || 0;
<add>// 0 if not found in fs.constants
<add>const { O_APPEND = 0,
<add> O_CREAT = 0,
<add> O_EXCL = 0,
<add> O_RDONLY = 0,
<add> O_RDWR = 0,
<add> O_SYNC = 0,
<add> O_DSYNC = 0,
<add> O_TRUNC = 0,
<add> O_WRONLY = 0
<add>} = fs.constants;
<ide>
<ide> const { stringToFlags } = require('internal/fs/utils');
<ide>
<ide><path>test/parallel/test-fs-open-mode-mask.js
<ide> const assert = require('assert');
<ide> const path = require('path');
<ide> const fs = require('fs');
<ide>
<del>let mode;
<del>
<del>if (common.isWindows) {
<del> mode = 0o444;
<del>} else {
<del> mode = 0o644;
<del>}
<add>const mode = common.isWindows ? 0o444 : 0o644;
<ide>
<ide> const maskToIgnore = 0o10000;
<ide> | 2 |
Text | Text | make some tweaks | e5853f4eaac8f4fb64b36f4d7c6ef0de80b53a83 | <ide><path>docs/New-Maintainer-Checklist.md
<ide>
<ide> **This is a guide used by existing maintainers to invite new maintainers. You might find it interesting but there's nothing here users should have to know.**
<ide>
<del>So, there's someone who has been making consistently high-quality contributions to Homebrew for a long time and shown themselves able to make slightly more advanced contributions than just e.g. formula updates? Let's invite them to be a maintainer!
<add>There's someone who has been making consistently high-quality contributions to Homebrew for a long time and shown themselves able to make slightly more advanced contributions than just e.g. formula updates? Let's invite them to be a maintainer!
<ide>
<ide> First, send them the invitation email:
<ide>
<ide> ```
<ide> The Homebrew team and I really appreciate your help on issues, pull requests and
<ide> your contributions around $THEIR_CONTRIBUTIONS.
<ide>
<del>We would like to invite you to have commit access. There are no obligations,
<del>but we'd appreciate your continuing help in keeping on top of contributions.
<del>The easiest way to do this is to watch the Homebrew/brew and
<del>Homebrew/homebrew-core repositories on GitHub to provide help and code review
<del>and to pull suitable changes.
<add>We would like to invite you to have commit access and be a Homebrew maintainer.
<add>If you agree to be a maintainer, you should spend a significant proportion of
<add>the time you are working on Homebrew fixing user-reported issues, resolving any
<add>issues that arise from your code in a timely fashion and reviewing user
<add>contributions. You should also be making contributions to Homebrew every month
<add>unless you are ill or on vacation (and please let another maintainer know if
<add>that's the case so we're aware you won't be able to help while you are out).
<add>You will need to watch Homebrew/brew and/or Homebrew/homebrew-core. If you're
<add>no longer able to perform all of these tasks, please continue to contribute to
<add>Homebrew, but we will ask you to step down as a maintainer.
<ide>
<ide> A few requests:
<ide>
<ide> A few requests:
<ide> - please read:
<ide> - https://docs.brew.sh/Brew-Test-Bot-For-Core-Contributors.html
<ide> - https://docs.brew.sh/Maintainer-Guidelines.html
<del> - possibly everything else on https://docs.brew.sh
<add> - anything else you haven't read on https://docs.brew.sh
<ide>
<ide> How does that sound?
<ide>
<ide> If they accept, follow a few steps to get them set up:
<ide> - Invite them to the [`machomebrew` private maintainers Slack](https://machomebrew.slack.com/admin/invites)
<ide> - Invite them to the [`homebrew` private maintainers 1Password](https://homebrew.1password.com/signin)
<ide> - Invite them to [Google Analytics](https://analytics.google.com/analytics/web/?authuser=1#management/Settings/a76679469w115400090p120682403/%3Fm.page%3DAccountUsers/)
<del>- Add them to [Homebrew's README](https://github.com/Homebrew/brew/edit/master/README.md)
<ide>
<del>After a few weeks/months with no problems consider making them [owners on the Homebrew GitHub organisation](https://github.com/orgs/Homebrew/people).
<add>After a month-long trial period with no problems make them [owners on the Homebrew GitHub organisation](https://github.com/orgs/Homebrew/people) and add them to [Homebrew's README](https://github.com/Homebrew/brew/edit/master/README.md). If there are problems, ask them to step down as a maintainer and revoke their access to the above.
<ide>
<ide> Now sit back, relax and let the new maintainers handle more of our contributions. | 1 |
Mixed | Ruby | add #no_touching on activerecord models | b32ba367f584a6298fb8b7eef97be15388b5bd87 | <ide><path>activerecord/CHANGELOG.md
<add>* Added `ActiveRecord::Base.no_touching`, which allows ignoring touch on models.
<add>
<add> Examples:
<add>
<add> Post.no_touching do
<add> Post.first.touch
<add> end
<add>
<add> *Sam Stephenson*, *Damien Mathieu*
<add>
<ide> * Prevent the counter cache from being decremented twice when destroying
<ide> a record on a has_many :through association.
<ide>
<ide><path>activerecord/lib/active_record.rb
<ide> module ActiveRecord
<ide> autoload :Migrator, 'active_record/migration'
<ide> autoload :ModelSchema
<ide> autoload :NestedAttributes
<add> autoload :NoTouching
<ide> autoload :Persistence
<ide> autoload :QueryCache
<ide> autoload :Querying
<ide><path>activerecord/lib/active_record/base.rb
<ide> class Base
<ide> extend Delegation::DelegateCache
<ide>
<ide> include Persistence
<add> include NoTouching
<ide> include ReadonlyAttributes
<ide> include ModelSchema
<ide> include Inheritance
<ide><path>activerecord/lib/active_record/no_touching.rb
<add>module ActiveRecord
<add> # = Active Record No Touching
<add> module NoTouching
<add> extend ActiveSupport::Concern
<add>
<add> module ClassMethods
<add> # Lets you selectively disable calls to `touch` for the
<add> # duration of a block.
<add> #
<add> # ==== Examples
<add> # ActiveRecord::Base.no_touching do
<add> # Project.first.touch # does nothing
<add> # Message.first.touch # does nothing
<add> # end
<add> #
<add> # Project.no_touching do
<add> # Project.first.touch # does nothing
<add> # Message.first.touch # works, but does not touch the associated project
<add> # end
<add> #
<add> def no_touching(&block)
<add> NoTouching.apply_to(self, &block)
<add> end
<add> end
<add>
<add> class << self
<add> def apply_to(klass) #:nodoc:
<add> klasses.push(klass)
<add> yield
<add> ensure
<add> klasses.pop
<add> end
<add>
<add> def applied_to?(klass) #:nodoc:
<add> klasses.any? { |k| k >= klass }
<add> end
<add>
<add> private
<add> def klasses
<add> Thread.current[:no_touching_classes] ||= []
<add> end
<add> end
<add>
<add> def no_touching?
<add> NoTouching.applied_to?(self.class)
<add> end
<add>
<add> def touch(*)
<add> super unless no_touching?
<add> end
<add> end
<add>end
<ide><path>activerecord/test/cases/timestamp_test.rb
<ide> class TimestampTest < ActiveRecord::TestCase
<ide>
<ide> def setup
<ide> @developer = Developer.first
<add> @owner = Owner.first
<ide> @developer.update_columns(updated_at: Time.now.prev_month)
<ide> @previously_updated_at = @developer.updated_at
<ide> end
<ide> def test_touching_a_record_without_timestamps_is_unexceptional
<ide> assert_nothing_raised { Car.first.touch }
<ide> end
<ide>
<add> def test_touching_a_no_touching_object
<add> Developer.no_touching do
<add> assert @developer.no_touching?
<add> assert [email protected]_touching?
<add> @developer.touch
<add> end
<add>
<add> assert [email protected]_touching?
<add> assert [email protected]_touching?
<add> assert_equal @previously_updated_at, @developer.updated_at
<add> end
<add>
<add> def test_touching_related_objects
<add> @owner = Owner.first
<add> @previously_updated_at = @owner.updated_at
<add>
<add> Owner.no_touching do
<add> @owner.pets.first.touch
<add> end
<add>
<add> assert_equal @previously_updated_at, @owner.updated_at
<add> end
<add>
<add> def test_global_no_touching
<add> ActiveRecord::Base.no_touching do
<add> assert @developer.no_touching?
<add> assert @owner.no_touching?
<add> @developer.touch
<add> end
<add>
<add> assert [email protected]_touching?
<add> assert [email protected]_touching?
<add> assert_equal @previously_updated_at, @developer.updated_at
<add> end
<add>
<add> def test_no_touching_threadsafe
<add> Thread.new do
<add> Developer.no_touching do
<add> assert @developer.no_touching?
<add>
<add> sleep(1)
<add> end
<add> end
<add>
<add> assert [email protected]_touching?
<add> end
<add>
<ide> def test_saving_a_record_with_a_belongs_to_that_specifies_touching_the_parent_should_update_the_parent_updated_at
<ide> pet = Pet.first
<ide> owner = pet.owner | 5 |
Javascript | Javascript | print a deprecated message for next/css (#421) | 1e70324a41993da52eadfe5139943084da9af218 | <ide><path>lib/css.js
<ide> const css = require('glamor')
<ide>
<add>if (process.env.NODE_ENV !== 'production') {
<add> console.error('Warning: \'next/css\' is deprecated. Please use styled-jsx syntax instead.')
<add>}
<add>
<ide> /**
<ide> * Expose style as default and the whole object as properties
<ide> * so it can be used as follows: | 1 |
Javascript | Javascript | convert the thumbnail viewer to es6 syntax | a682d77e71e8d5f0901d190a3d3d674d0df4a55f | <ide><path>web/pdf_thumbnail_viewer.js
<ide> import {
<ide> } from './ui_utils';
<ide> import { PDFThumbnailView } from './pdf_thumbnail_view';
<ide>
<del>var THUMBNAIL_SCROLL_MARGIN = -19;
<add>const THUMBNAIL_SCROLL_MARGIN = -19;
<ide>
<ide> /**
<ide> * @typedef {Object} PDFThumbnailViewerOptions
<ide> var THUMBNAIL_SCROLL_MARGIN = -19;
<ide> */
<ide>
<ide> /**
<del> * Simple viewer control to display thumbnails for pages.
<del> * @class
<add> * Viewer control to display thumbnails for pages in a PDF document.
<add> *
<ide> * @implements {IRenderableView}
<ide> */
<del>var PDFThumbnailViewer = (function PDFThumbnailViewerClosure() {
<add>class PDFThumbnailViewer {
<ide> /**
<del> * @constructs PDFThumbnailViewer
<ide> * @param {PDFThumbnailViewerOptions} options
<ide> */
<del> function PDFThumbnailViewer(options) {
<del> this.container = options.container;
<del> this.renderingQueue = options.renderingQueue;
<del> this.linkService = options.linkService;
<del> this.l10n = options.l10n || NullL10n;
<add> constructor({ container, linkService, renderingQueue, l10n = NullL10n, }) {
<add> this.container = container;
<add> this.linkService = linkService;
<add> this.renderingQueue = renderingQueue;
<add> this.l10n = l10n;
<ide>
<ide> this.scroll = watchScroll(this.container, this._scrollUpdated.bind(this));
<ide> this._resetView();
<ide> }
<ide>
<del> PDFThumbnailViewer.prototype = {
<del> /**
<del> * @private
<del> */
<del> _scrollUpdated: function PDFThumbnailViewer_scrollUpdated() {
<del> this.renderingQueue.renderHighestPriority();
<del> },
<del>
<del> getThumbnail: function PDFThumbnailViewer_getThumbnail(index) {
<del> return this.thumbnails[index];
<del> },
<del>
<del> /**
<del> * @private
<del> */
<del> _getVisibleThumbs: function PDFThumbnailViewer_getVisibleThumbs() {
<del> return getVisibleElements(this.container, this.thumbnails);
<del> },
<del>
<del> scrollThumbnailIntoView:
<del> function PDFThumbnailViewer_scrollThumbnailIntoView(page) {
<del> var selected = document.querySelector('.thumbnail.selected');
<del> if (selected) {
<del> selected.classList.remove('selected');
<del> }
<del> var thumbnail = document.querySelector(
<del> 'div.thumbnail[data-page-number="' + page + '"]');
<del> if (thumbnail) {
<del> thumbnail.classList.add('selected');
<del> }
<del> var visibleThumbs = this._getVisibleThumbs();
<del> var numVisibleThumbs = visibleThumbs.views.length;
<del>
<del> // If the thumbnail isn't currently visible, scroll it into view.
<del> if (numVisibleThumbs > 0) {
<del> var first = visibleThumbs.first.id;
<del> // Account for only one thumbnail being visible.
<del> var last = (numVisibleThumbs > 1 ? visibleThumbs.last.id : first);
<del> if (page <= first || page >= last) {
<del> scrollIntoView(thumbnail, { top: THUMBNAIL_SCROLL_MARGIN, });
<del> }
<del> }
<del> },
<add> /**
<add> * @private
<add> */
<add> _scrollUpdated() {
<add> this.renderingQueue.renderHighestPriority();
<add> }
<add>
<add> getThumbnail(index) {
<add> return this._thumbnails[index];
<add> }
<ide>
<del> get pagesRotation() {
<del> return this._pagesRotation;
<del> },
<add> /**
<add> * @private
<add> */
<add> _getVisibleThumbs() {
<add> return getVisibleElements(this.container, this._thumbnails);
<add> }
<ide>
<del> set pagesRotation(rotation) {
<del> this._pagesRotation = rotation;
<del> for (var i = 0, l = this.thumbnails.length; i < l; i++) {
<del> var thumb = this.thumbnails[i];
<del> thumb.update(rotation);
<add> scrollThumbnailIntoView(page) {
<add> let selected = document.querySelector('.thumbnail.selected');
<add> if (selected) {
<add> selected.classList.remove('selected');
<add> }
<add> let thumbnail = document.querySelector(
<add> 'div.thumbnail[data-page-number="' + page + '"]');
<add> if (thumbnail) {
<add> thumbnail.classList.add('selected');
<add> }
<add> let visibleThumbs = this._getVisibleThumbs();
<add> let numVisibleThumbs = visibleThumbs.views.length;
<add>
<add> // If the thumbnail isn't currently visible, scroll it into view.
<add> if (numVisibleThumbs > 0) {
<add> let first = visibleThumbs.first.id;
<add> // Account for only one thumbnail being visible.
<add> let last = (numVisibleThumbs > 1 ? visibleThumbs.last.id : first);
<add> if (page <= first || page >= last) {
<add> scrollIntoView(thumbnail, { top: THUMBNAIL_SCROLL_MARGIN, });
<ide> }
<del> },
<add> }
<add> }
<ide>
<del> cleanup: function PDFThumbnailViewer_cleanup() {
<del> PDFThumbnailView.cleanup();
<del> },
<add> get pagesRotation() {
<add> return this._pagesRotation;
<add> }
<ide>
<del> /**
<del> * @private
<del> */
<del> _resetView: function PDFThumbnailViewer_resetView() {
<del> this.thumbnails = [];
<del> this._pageLabels = null;
<del> this._pagesRotation = 0;
<del> this._pagesRequests = [];
<add> set pagesRotation(rotation) {
<add> this._pagesRotation = rotation;
<add> for (let i = 0, l = this._thumbnails.length; i < l; i++) {
<add> this._thumbnails[i].update(rotation);
<add> }
<add> }
<ide>
<del> // Remove the thumbnails from the DOM.
<del> this.container.textContent = '';
<del> },
<add> cleanup() {
<add> PDFThumbnailView.cleanup();
<add> }
<ide>
<del> setDocument: function PDFThumbnailViewer_setDocument(pdfDocument) {
<del> if (this.pdfDocument) {
<del> this._cancelRendering();
<del> this._resetView();
<del> }
<add> /**
<add> * @private
<add> */
<add> _resetView() {
<add> this._thumbnails = [];
<add> this._pageLabels = null;
<add> this._pagesRotation = 0;
<add> this._pagesRequests = [];
<add>
<add> // Remove the thumbnails from the DOM.
<add> this.container.textContent = '';
<add> }
<ide>
<del> this.pdfDocument = pdfDocument;
<del> if (!pdfDocument) {
<del> return Promise.resolve();
<add> setDocument(pdfDocument) {
<add> if (this.pdfDocument) {
<add> this._cancelRendering();
<add> this._resetView();
<add> }
<add>
<add> this.pdfDocument = pdfDocument;
<add> if (!pdfDocument) {
<add> return Promise.resolve();
<add> }
<add>
<add> return pdfDocument.getPage(1).then((firstPage) => {
<add> let pagesCount = pdfDocument.numPages;
<add> let viewport = firstPage.getViewport(1.0);
<add> for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) {
<add> let thumbnail = new PDFThumbnailView({
<add> container: this.container,
<add> id: pageNum,
<add> defaultViewport: viewport.clone(),
<add> linkService: this.linkService,
<add> renderingQueue: this.renderingQueue,
<add> disableCanvasToImageConversion: false,
<add> l10n: this.l10n,
<add> });
<add> this._thumbnails.push(thumbnail);
<ide> }
<add> });
<add> }
<ide>
<del> return pdfDocument.getPage(1).then((firstPage) => {
<del> var pagesCount = pdfDocument.numPages;
<del> var viewport = firstPage.getViewport(1.0);
<del> for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) {
<del> var thumbnail = new PDFThumbnailView({
<del> container: this.container,
<del> id: pageNum,
<del> defaultViewport: viewport.clone(),
<del> linkService: this.linkService,
<del> renderingQueue: this.renderingQueue,
<del> disableCanvasToImageConversion: false,
<del> l10n: this.l10n,
<del> });
<del> this.thumbnails.push(thumbnail);
<del> }
<del> });
<del> },
<del>
<del> /**
<del> * @private
<del> */
<del> _cancelRendering: function PDFThumbnailViewer_cancelRendering() {
<del> for (var i = 0, ii = this.thumbnails.length; i < ii; i++) {
<del> if (this.thumbnails[i]) {
<del> this.thumbnails[i].cancelRendering();
<del> }
<del> }
<del> },
<del>
<del> /**
<del> * @param {Array|null} labels
<del> */
<del> setPageLabels: function PDFThumbnailViewer_setPageLabels(labels) {
<del> if (!this.pdfDocument) {
<del> return;
<del> }
<del> if (!labels) {
<del> this._pageLabels = null;
<del> } else if (!(labels instanceof Array &&
<del> this.pdfDocument.numPages === labels.length)) {
<del> this._pageLabels = null;
<del> console.error('PDFThumbnailViewer_setPageLabels: Invalid page labels.');
<del> } else {
<del> this._pageLabels = labels;
<del> }
<del> // Update all the `PDFThumbnailView` instances.
<del> for (var i = 0, ii = this.thumbnails.length; i < ii; i++) {
<del> var thumbnailView = this.thumbnails[i];
<del> var label = this._pageLabels && this._pageLabels[i];
<del> thumbnailView.setPageLabel(label);
<del> }
<del> },
<del>
<del> /**
<del> * @param {PDFThumbnailView} thumbView
<del> * @returns {PDFPage}
<del> * @private
<del> */
<del> _ensurePdfPageLoaded(thumbView) {
<del> if (thumbView.pdfPage) {
<del> return Promise.resolve(thumbView.pdfPage);
<del> }
<del> var pageNumber = thumbView.id;
<del> if (this._pagesRequests[pageNumber]) {
<del> return this._pagesRequests[pageNumber];
<del> }
<del> var promise = this.pdfDocument.getPage(pageNumber).then((pdfPage) => {
<del> thumbView.setPdfPage(pdfPage);
<del> this._pagesRequests[pageNumber] = null;
<del> return pdfPage;
<del> });
<del> this._pagesRequests[pageNumber] = promise;
<del> return promise;
<del> },
<del>
<del> forceRendering() {
<del> var visibleThumbs = this._getVisibleThumbs();
<del> var thumbView = this.renderingQueue.getHighestPriority(visibleThumbs,
<del> this.thumbnails,
<del> this.scroll.down);
<del> if (thumbView) {
<del> this._ensurePdfPageLoaded(thumbView).then(() => {
<del> this.renderingQueue.renderView(thumbView);
<del> });
<del> return true;
<add> /**
<add> * @private
<add> */
<add> _cancelRendering() {
<add> for (let i = 0, ii = this._thumbnails.length; i < ii; i++) {
<add> if (this._thumbnails[i]) {
<add> this._thumbnails[i].cancelRendering();
<ide> }
<del> return false;
<del> },
<del> };
<add> }
<add> }
<ide>
<del> return PDFThumbnailViewer;
<del>})();
<add> /**
<add> * @param {Array|null} labels
<add> */
<add> setPageLabels(labels) {
<add> if (!this.pdfDocument) {
<add> return;
<add> }
<add> if (!labels) {
<add> this._pageLabels = null;
<add> } else if (!(labels instanceof Array &&
<add> this.pdfDocument.numPages === labels.length)) {
<add> this._pageLabels = null;
<add> console.error('PDFThumbnailViewer_setPageLabels: Invalid page labels.');
<add> } else {
<add> this._pageLabels = labels;
<add> }
<add> // Update all the `PDFThumbnailView` instances.
<add> for (let i = 0, ii = this._thumbnails.length; i < ii; i++) {
<add> let label = this._pageLabels && this._pageLabels[i];
<add> this._thumbnails[i].setPageLabel(label);
<add> }
<add> }
<add>
<add> /**
<add> * @param {PDFThumbnailView} thumbView
<add> * @returns {PDFPage}
<add> * @private
<add> */
<add> _ensurePdfPageLoaded(thumbView) {
<add> if (thumbView.pdfPage) {
<add> return Promise.resolve(thumbView.pdfPage);
<add> }
<add> let pageNumber = thumbView.id;
<add> if (this._pagesRequests[pageNumber]) {
<add> return this._pagesRequests[pageNumber];
<add> }
<add> let promise = this.pdfDocument.getPage(pageNumber).then((pdfPage) => {
<add> thumbView.setPdfPage(pdfPage);
<add> this._pagesRequests[pageNumber] = null;
<add> return pdfPage;
<add> });
<add> this._pagesRequests[pageNumber] = promise;
<add> return promise;
<add> }
<add>
<add> forceRendering() {
<add> let visibleThumbs = this._getVisibleThumbs();
<add> let thumbView = this.renderingQueue.getHighestPriority(visibleThumbs,
<add> this._thumbnails,
<add> this.scroll.down);
<add> if (thumbView) {
<add> this._ensurePdfPageLoaded(thumbView).then(() => {
<add> this.renderingQueue.renderView(thumbView);
<add> });
<add> return true;
<add> }
<add> return false;
<add> }
<add>}
<ide>
<ide> export {
<ide> PDFThumbnailViewer, | 1 |
Javascript | Javascript | update examples to use modules | 0cddc5c7b4f726448a660d8fa63b2502d6c28484 | <ide><path>src/ng/directive/ngController.js
<ide> *
<ide> * This example demonstrates the `controller as` syntax.
<ide> *
<del> * <example name="ngControllerAs">
<add> * <example name="ngControllerAs" module="controllerAsExample">
<ide> * <file name="index.html">
<ide> * <div id="ctrl-as-exmpl" ng-controller="SettingsController1 as settings">
<ide> * Name: <input type="text" ng-model="settings.name"/>
<ide> * </div>
<ide> * </file>
<ide> * <file name="app.js">
<add> * angular.module('controllerAsExample', [])
<add> * .controller('SettingsController1', SettingsController1);
<add> *
<ide> * function SettingsController1() {
<ide> * this.name = "John Smith";
<ide> * this.contacts = [
<ide> *
<ide> * This example demonstrates the "attach to `$scope`" style of controller.
<ide> *
<del> * <example name="ngController">
<add> * <example name="ngController" module="controllerExample">
<ide> * <file name="index.html">
<ide> * <div id="ctrl-exmpl" ng-controller="SettingsController2">
<ide> * Name: <input type="text" ng-model="name"/>
<ide> * </div>
<ide> * </file>
<ide> * <file name="app.js">
<add> * angular.module('controllerExample', [])
<add> * .controller('SettingsController2', ['$scope', SettingsController2]);
<add> *
<ide> * function SettingsController2($scope) {
<ide> * $scope.name = "John Smith";
<ide> * $scope.contacts = [ | 1 |
Javascript | Javascript | change socket.bind() to return itself | 3e0057dd61626890e1880ed1e609ef31ce39720b | <ide><path>lib/dgram.js
<ide> Socket.prototype.bind = function(port /*, address, callback*/) {
<ide> if (port instanceof UDP) {
<ide> replaceHandle(self, port);
<ide> startListening(self);
<del> return;
<add> return self;
<ide> }
<ide>
<ide> var address;
<ide> Socket.prototype.bind = function(port /*, address, callback*/) {
<ide> startListening(self);
<ide> }
<ide> });
<add>
<add> return self;
<ide> };
<ide>
<ide>
<ide><path>test/parallel/test-dgram-bind.js
<ide> socket.on('listening', function () {
<ide> socket.close();
<ide> });
<ide>
<del>socket.bind(); // should not throw
<add>var result = socket.bind(); // should not throw
<add>
<add>assert.strictEqual(result, socket); // should have returned itself | 2 |
Javascript | Javascript | remove extra call to metafor | 9851decd9919e2a3371eeaf4b65e8995980c5c2b | <ide><path>packages/ember-metal/lib/mixin.js
<ide> function applyMixin(obj, mixins, partial) {
<ide> // * Set up _super wrapping if necessary
<ide> // * Set up computed property descriptors
<ide> // * Copying `toString` in broken browsers
<del> mergeMixins(mixins, metaFor(obj), descs, values, obj, keys);
<add> mergeMixins(mixins, m, descs, values, obj, keys);
<ide>
<ide> for (var i = 0, l = keys.length; i < l; i++) {
<ide> key = keys[i]; | 1 |
Javascript | Javascript | add e2e tests for navigation buttons in /learn | 16a643d66f54886d203b4ab65bef33ccf27bbdb2 | <ide><path>cypress/integration/learn/navigation-buttons/update-my-account-settings-button.js
<add>/* global cy */
<add>
<add>describe('The `Update my account settings` button works properly', function() {
<add> beforeEach(() => {
<add> cy.visit('/');
<add>
<add> cy.contains("Get started (it's free)").click({ force: true });
<add> });
<add>
<add> it('Should get rendered', function() {
<add> cy.contains('View my Portfolio').should(
<add> 'have.class',
<add> 'btn btn-lg btn-primary btn-block'
<add> );
<add>
<add> cy.contains('View my Portfolio').should('be.visible');
<add> });
<add>
<add> it('Should take user to their account settings when clicked', function() {
<add> cy.contains('Update my account settings').click({ force: true });
<add> cy.url().should('include', '/settings');
<add> });
<add>});
<ide><path>cypress/integration/learn/navigation-buttons/view-portfolio-button.js
<add>/* global cy */
<add>
<add>describe('The `View my Portfolio` button works properly', function() {
<add> beforeEach(() => {
<add> cy.visit('/');
<add>
<add> cy.contains("Get started (it's free)").click({ force: true });
<add> });
<add>
<add> it('Button gets rendered', function() {
<add> cy.contains('View my Portfolio').should(
<add> 'have.class',
<add> 'btn btn-lg btn-primary btn-block'
<add> );
<add>
<add> cy.contains('View my Portfolio').should('be.visible');
<add> });
<add>
<add> it('Button takes user to their portfolio when clicked', function() {
<add> cy.contains('View my Portfolio').click({ force: true });
<add> cy.url().should('include', '/developmentuser');
<add> });
<add>}); | 2 |
Ruby | Ruby | provide arguments to recordnotfound | ae032ec38463e923c0556fbdd28b9d9fced18b11 | <ide><path>activerecord/lib/active_record/associations/collection_association.rb
<ide> def reset
<ide> def find(*args)
<ide> if options[:inverse_of] && loaded?
<ide> args_flatten = args.flatten
<del> raise RecordNotFound, "Couldn't find #{scope.klass.name} without an ID" if args_flatten.blank?
<add> model = scope.klass
<add>
<add> if args_flatten.blank?
<add> error_message = "Couldn't find #{model.name} without an ID"
<add> raise RecordNotFound.new(error_message, model.name, model.primary_key, args)
<add> end
<add>
<ide> result = find_by_scan(*args)
<ide>
<ide> result_size = Array(result).size
<ide><path>activerecord/lib/active_record/relation/finder_methods.rb
<ide> def find_by!(arg, *args)
<ide> where(arg, *args).take!
<ide> rescue ::RangeError
<ide> raise RecordNotFound.new("Couldn't find #{@klass.name} with an out of range value",
<del> @klass.name)
<add> @klass.name, @klass.primary_key)
<ide> end
<ide>
<ide> # Gives a record (or N records if a parameter is supplied) without any implied
<ide> def raise_record_not_found_exception!(ids = nil, result_size = nil, expected_siz
<ide> if ids.nil?
<ide> error = "Couldn't find #{name}".dup
<ide> error << " with#{conditions}" if conditions
<del> raise RecordNotFound.new(error, name)
<add> raise RecordNotFound.new(error, name, key)
<ide> elsif Array(ids).size == 1
<ide> error = "Couldn't find #{name} with '#{key}'=#{ids}#{conditions}"
<ide> raise RecordNotFound.new(error, name, key, ids)
<ide> else
<ide> error = "Couldn't find all #{name.pluralize} with '#{key}': ".dup
<ide> error << "(#{ids.join(", ")})#{conditions} (found #{result_size} results, but was looking for #{expected_size})."
<ide> error << " Couldn't find #{name.pluralize(not_found_ids.size)} with #{key.to_s.pluralize(not_found_ids.size)} #{not_found_ids.join(', ')}." if not_found_ids
<del> raise RecordNotFound.new(error, name, primary_key, ids)
<add> raise RecordNotFound.new(error, name, key, ids)
<ide> end
<ide> end
<ide>
<ide> def find_with_ids(*ids)
<ide>
<ide> ids = ids.flatten.compact.uniq
<ide>
<add> model_name = @klass.name
<add>
<ide> case ids.size
<ide> when 0
<del> raise RecordNotFound, "Couldn't find #{@klass.name} without an ID"
<add> error_message = "Couldn't find #{model_name} without an ID"
<add> raise RecordNotFound.new(error_message, model_name, primary_key)
<ide> when 1
<ide> result = find_one(ids.first)
<ide> expects_array ? [ result ] : result
<ide> else
<ide> find_some(ids)
<ide> end
<ide> rescue ::RangeError
<del> raise RecordNotFound, "Couldn't find #{@klass.name} with an out of range ID"
<add> error_message = "Couldn't find #{model_name} with an out of range ID"
<add> raise RecordNotFound.new(error_message, model_name, primary_key, ids)
<ide> end
<ide>
<ide> def find_one(id)
<ide><path>activerecord/test/cases/associations/inverse_associations_test.rb
<ide> def test_raise_record_not_found_error_when_invalid_ids_are_passed
<ide> def test_raise_record_not_found_error_when_no_ids_are_passed
<ide> man = Man.create!
<ide>
<del> assert_raise(ActiveRecord::RecordNotFound) { man.interests.find() }
<add> exception = assert_raise(ActiveRecord::RecordNotFound) { man.interests.load.find() }
<add>
<add> assert_equal exception.model, "Interest"
<add> assert_equal exception.primary_key, "id"
<ide> end
<ide>
<ide> def test_trying_to_use_inverses_that_dont_exist_should_raise_an_error
<ide><path>activerecord/test/cases/finder_test.rb
<ide> def test_find_with_ids_and_offset
<ide> assert_equal "The Fourth Topic of the day", records[2].title
<ide> end
<ide>
<add> def test_find_with_ids_with_no_id_passed
<add> exception = assert_raises(ActiveRecord::RecordNotFound) { Topic.find }
<add> assert_equal exception.model, "Topic"
<add> assert_equal exception.primary_key, "id"
<add> end
<add>
<add> def test_find_with_ids_with_id_out_of_range
<add> exception = assert_raises(ActiveRecord::RecordNotFound) do
<add> Topic.find("9999999999999999999999999999999")
<add> end
<add>
<add> assert_equal exception.model, "Topic"
<add> assert_equal exception.primary_key, "id"
<add> end
<add>
<ide> def test_find_passing_active_record_object_is_not_permitted
<ide> assert_raises(ArgumentError) do
<ide> Topic.find(Topic.last) | 4 |
Ruby | Ruby | pass the chain the join_constraints | 66556631f5b98990d55194f427533a4b992b3350 | <ide><path>activerecord/lib/active_record/associations/join_dependency.rb
<ide> def instantiate(result_set, aliases)
<ide>
<ide> def make_joins(node)
<ide> node.children.flat_map { |child|
<del> child.join_constraints(node, child.tables).concat make_joins(child)
<add> child.join_constraints(node, child.tables, child.reflection.chain)
<add> .concat make_joins(child)
<ide> }
<ide> end
<ide>
<ide><path>activerecord/lib/active_record/associations/join_dependency/join_association.rb
<ide> def match?(other)
<ide> super && reflection == other.reflection
<ide> end
<ide>
<del> def join_constraints(parent, tables)
<add> def join_constraints(parent, tables, chain)
<ide> joins = []
<ide> tables = tables.dup
<ide>
<ide> def join_constraints(parent, tables)
<ide>
<ide> # The chain starts with the target table, but we want to end with it here (makes
<ide> # more sense in this context), so we reverse
<del> reflection.chain.reverse_each do |reflection|
<add> chain.reverse_each do |reflection|
<ide> table = tables.shift
<ide> klass = reflection.klass
<ide> | 2 |
Python | Python | move replacement logic to language.from_config | 325f47500d5265ad4240d2903601f178e51efc17 | <ide><path>spacy/language.py
<ide> def from_config(
<ide> # Later we replace the component config with the raw config again.
<ide> interpolated = filled.interpolate() if not filled.is_interpolated else filled
<ide> pipeline = interpolated.get("components", {})
<add> sourced = util.get_sourced_components(interpolated)
<ide> # If components are loaded from a source (existing models), we cache
<ide> # them here so they're only loaded once
<ide> source_nlps = {}
<ide> def from_config(
<ide> raise ValueError(
<ide> Errors.E942.format(name="pipeline_creation", value=type(nlp))
<ide> )
<add> # Detect components with listeners that are not frozen consistently
<add> for name, proc in nlp.pipeline:
<add> if getattr(proc, "listening_components", None): # e.g. tok2vec/transformer
<add> for listener in proc.listening_components:
<add> # If it's a component sourced from another pipeline, we check if
<add> # the tok2vec listeners should be replaced with standalone tok2vec
<add> # models (e.g. so component can be frozen without its performance
<add> # degrading when other components/tok2vec are updated)
<add> paths = sourced.get(listener, {}).get("replace_listeners", [])
<add> if paths:
<add> nlp.replace_listeners(name, listener, paths)
<ide> return nlp
<ide>
<ide> def replace_listeners(
<ide> def replace_listeners(
<ide> # Go over the listener layers and replace them
<ide> for listener in pipe_listeners:
<ide> util.replace_model_node(pipe.model, listener, tok2vec.model.copy())
<add> tok2vec.remove_listener(listener, pipe_name)
<ide>
<ide> def to_disk(
<ide> self, path: Union[str, Path], *, exclude: Iterable[str] = SimpleFrozenList()
<ide><path>spacy/training/initialize.py
<ide> from ..errors import Errors, Warnings
<ide> from ..schemas import ConfigSchemaTraining
<ide> from ..util import registry, load_model_from_config, resolve_dot_names, logger
<del>from ..util import load_model, ensure_path, OOV_RANK, DEFAULT_OOV_PROB
<add>from ..util import load_model, ensure_path, get_sourced_components
<add>from ..util import OOV_RANK, DEFAULT_OOV_PROB
<ide>
<ide> if TYPE_CHECKING:
<ide> from ..language import Language # noqa: F401
<ide> def init_nlp(config: Config, *, use_gpu: int = -1) -> "Language":
<ide> for name, proc in nlp.pipeline:
<ide> if getattr(proc, "listening_components", None): # e.g. tok2vec/transformer
<ide> for listener in proc.listening_components:
<del> # If it's a component sourced from another pipeline, we check if
<del> # the tok2vec listeners should be replaced with standalone tok2vec
<del> # models (e.g. so component can be frozen without its performance
<del> # degrading when other components/tok2vec are updated)
<del> paths = sourced.get(listener, {}).get("replace_listeners", [])
<del> if paths:
<del> nlp.replace_listeners(name, listener, paths)
<del> elif listener in frozen_components and name not in frozen_components:
<add> if listener in frozen_components and name not in frozen_components:
<ide> logger.warning(Warnings.W087.format(name=name, listener=listener))
<ide> # We always check this regardless, in case user freezes tok2vec
<ide> if listener not in frozen_components and name in frozen_components:
<ide> def init_tok2vec(
<ide> return False
<ide>
<ide>
<del>def get_sourced_components(
<del> config: Union[Dict[str, Any], Config]
<del>) -> Dict[str, Dict[str, Any]]:
<del> """RETURNS (List[str]): All sourced components in the original config,
<del> e.g. {"source": "en_core_web_sm"}. If the config contains a key
<del> "factory", we assume it refers to a component factory.
<del> """
<del> return {
<del> name: cfg
<del> for name, cfg in config.get("components", {}).items()
<del> if "factory" not in cfg and "source" in cfg
<del> }
<del>
<del>
<ide> def convert_vectors(
<ide> nlp: "Language",
<ide> vectors_loc: Optional[Path],
<ide><path>spacy/util.py
<ide> def load_model_from_config(
<ide> return nlp
<ide>
<ide>
<add>def get_sourced_components(
<add> config: Union[Dict[str, Any], Config]
<add>) -> Dict[str, Dict[str, Any]]:
<add> """RETURNS (List[str]): All sourced components in the original config,
<add> e.g. {"source": "en_core_web_sm"}. If the config contains a key
<add> "factory", we assume it refers to a component factory.
<add> """
<add> return {
<add> name: cfg
<add> for name, cfg in config.get("components", {}).items()
<add> if "factory" not in cfg and "source" in cfg
<add> }
<add>
<add>
<ide> def resolve_dot_names(config: Config, dot_names: List[Optional[str]]) -> Tuple[Any]:
<ide> """Resolve one or more "dot notation" names, e.g. corpora.train.
<ide> The paths could point anywhere into the config, so we don't know which
<ide> def _pipe(docs, proc, name, default_error_handler, kwargs):
<ide> def raise_error(proc_name, proc, docs, e):
<ide> raise e
<ide>
<add>
<ide> def ignore_error(proc_name, proc, docs, e):
<ide> pass | 3 |
Javascript | Javascript | fix minor typo in imperative api notes | 258b43948fddbdc6a1fcc11fa65ab4077d08916c | <ide><path>Libraries/Components/StatusBar/StatusBar.js
<ide> function createStackEntry(props: any): any {
<ide> *
<ide> * For cases where using a component is not ideal, there is also an imperative
<ide> * API exposed as static functions on the component. It is however not recommended
<del> * to use the static API and the compoment for the same prop because any value
<add> * to use the static API and the component for the same prop because any value
<ide> * set by the static API will get overriden by the one set by the component in
<ide> * the next render.
<ide> */ | 1 |
Javascript | Javascript | start process after onload | bdad5e7333b15a786cd999b411463ffba5e36592 | <ide><path>test/mjsunit/test-process-kill.js
<ide> include("mjsunit.js");
<ide>
<del>var cat = new node.Process("cat");
<del>
<ide> var exit_status = -1;
<ide>
<del>cat.onOutput = function (chunk) { assertEquals(null, chunk); };
<del>cat.onError = function (chunk) { assertEquals(null, chunk); };
<del>cat.onExit = function (status) { exit_status = status; };
<add>function onLoad () {
<add> var cat = new node.Process("cat");
<add>
<add> cat.onOutput = function (chunk) { assertEquals(null, chunk); };
<add> cat.onError = function (chunk) { assertEquals(null, chunk); };
<add> cat.onExit = function (status) { exit_status = status; };
<ide>
<del>cat.kill();
<add> cat.kill();
<add>}
<ide>
<ide> function onExit () {
<ide> assertTrue(exit_status > 0); | 1 |
Text | Text | remove the old reference link | ca7b69016a13739db74eb09046d8344762a2caa4 | <ide><path>docs/userguide/dockervolumes.md
<ide> allows you to upgrade, or effectively migrate data volumes between containers.
<ide> > providing the `-v` option to delete its volumes. If you remove containers
<ide> > without using the `-v` option, you may end up with "dangling" volumes;
<ide> > volumes that are no longer referenced by a container.
<del>> Dangling volumes are difficult to get rid of and can take up a large amount
<del>> of disk space. We're working on improving volume management and you can check
<del>> progress on this in [pull request #14214](https://github.com/docker/docker/pull/14214)
<add>> You can use `docker volume ls -f dangling=true` to find dangling volumes,
<add>> and use `docker volume rm <volume name>` to remove a volume that's
<add>> no longer needed.
<ide>
<ide> ## Backup, restore, or migrate data volumes
<ide> | 1 |
Javascript | Javascript | add logic in zone to handle impossible keeptime-s | 72af6a3ff0d207ad5464afe45b032ba09b350c5a | <ide><path>moment.js
<ide>
<ide> // keepTime = true means only change the timezone, without affecting
<ide> // the local hour. So 5:31:26 +0300 --[zone(2, true)]--> 5:31:26 +0200
<add> // It is possible that 5:31:26 doesn't exist int zone +0200, so we
<add> // adjust the time as needed, to be valid.
<add> //
<add> // Keeping the time actually adds/subtracts (one hour)
<add> // from the actual represented time. That is why we call updateOffset
<add> // a second time. In case it wants us to change the offset again
<add> // _change_in_progress == true case, then we have to adjust, because
<add> // there is no such time in the given timezone.
<ide> zone : function (input, keepTime) {
<ide> var offset = this._offset || 0;
<ide> if (input != null) {
<ide> }
<ide> this._offset = input;
<ide> this._isUTC = true;
<del> if (offset !== input && !keepTime) {
<del> addOrSubtractDurationFromMoment(this,
<del> moment.duration(offset - input, 'm'), 1, false);
<add> if (offset !== input) {
<add> if (!keepTime || this._change_in_progress) {
<add> addOrSubtractDurationFromMoment(this,
<add> moment.duration(offset - input, 'm'), 1, false);
<add> } else if (!this._change_in_progress) {
<add> this._change_in_progress = true;
<add> moment.updateOffset(this, true);
<add> this._change_in_progress = null;
<add> }
<ide> }
<ide> } else {
<ide> return this._isUTC ? offset : this._d.getTimezoneOffset(); | 1 |
PHP | PHP | convert language php 5.4 arrays | a1547b30ad3d98f51cc69d5c24666c5ff826e6f2 | <ide><path>resources/lang/en/pagination.php
<ide> <?php
<ide>
<del>return array(
<add>return [
<ide>
<ide> /*
<ide> |--------------------------------------------------------------------------
<ide>
<ide> 'next' => 'Next »',
<ide>
<del>);
<add>]; | 1 |
PHP | PHP | add support for --admin to bake controller all | 5a6a45d0d1b9e4f844e950939c63204b4c0d2065 | <ide><path>lib/Cake/Console/Command/Task/ControllerTask.php
<ide> public function all() {
<ide> $this->listAll($this->connection, false);
<ide> ClassRegistry::config('Model', array('ds' => $this->connection));
<ide> $unitTestExists = $this->_checkUnitTest();
<add>
<add> $admin = false;
<add> if (!empty($this->params['admin'])) {
<add> $admin = $this->Project->getPrefix();
<add> }
<add>
<ide> foreach ($this->__tables as $table) {
<ide> $model = $this->_modelName($table);
<ide> $controller = $this->_controllerName($model);
<ide> App::uses($model, 'Model');
<ide> if (class_exists($model)) {
<ide> $actions = $this->bakeActions($controller);
<add> if ($admin) {
<add> $this->out(__d('cake_console', 'Adding %s methods', $admin));
<add> $actions .= "\n" . $this->bakeActions($controller, $admin);
<add> }
<ide> if ($this->bake($controller, $actions) && $unitTestExists) {
<ide> $this->bakeTest($controller);
<ide> }
<ide><path>lib/Cake/Test/Case/Console/Command/Task/ControllerTaskTest.php
<ide> public function testExecuteIntoAll() {
<ide> if (!defined('ARTICLE_MODEL_CREATED')) {
<ide> $this->markTestSkipped('Execute into all could not be run as an Article, Tag or Comment model was already loaded.');
<ide> }
<add>
<ide> $this->Task->connection = 'test';
<ide> $this->Task->path = '/my/path/';
<ide> $this->Task->args = array('all');
<ide> public function testExecuteIntoAll() {
<ide> $this->Task->execute();
<ide> }
<ide>
<add>/**
<add> * Test execute() with all and --admin
<add> *
<add> * @return void
<add> */
<add> public function testExecuteIntoAllAdmin() {
<add> $count = count($this->Task->listAll('test'));
<add> if ($count != count($this->fixtures)) {
<add> $this->markTestSkipped('Additional tables detected.');
<add> }
<add> if (!defined('ARTICLE_MODEL_CREATED')) {
<add> $this->markTestSkipped('Execute into all could not be run as an Article, Tag or Comment model was already loaded.');
<add> }
<add>
<add> $this->Task->connection = 'test';
<add> $this->Task->path = '/my/path/';
<add> $this->Task->args = array('all');
<add> $this->Task->params['admin'] = true;
<add>
<add> $this->Task->Project->expects($this->any())
<add> ->method('getPrefix')
<add> ->will($this->returnValue('admin_'));
<add> $this->Task->expects($this->any())
<add> ->method('_checkUnitTest')
<add> ->will($this->returnValue(true));
<add> $this->Task->Test->expects($this->once())->method('bake');
<add>
<add> $filename = '/my/path/BakeArticlesController.php';
<add> $this->Task->expects($this->once())->method('createFile')->with(
<add> $filename,
<add> $this->stringContains('function admin_index')
<add> )->will($this->returnValue(true));
<add>
<add> $this->Task->execute();
<add> }
<add>
<ide> /**
<ide> * test that `cake bake controller foos` works.
<ide> * | 2 |
Python | Python | remove f-strings in setup.py. (gh-16346) | dabf31c74f6f3153ef4e7c72ad969c37f8652c8a | <ide><path>setup.py
<ide> def check_submodules():
<ide> if 'path' in l:
<ide> p = l.split('=')[-1].strip()
<ide> if not os.path.exists(p):
<del> raise ValueError(f'Submodule {p} missing')
<add> raise ValueError('Submodule {} missing'.format(p))
<ide>
<ide>
<ide> proc = subprocess.Popen(['git', 'submodule', 'status'],
<ide> def check_submodules():
<ide> status = status.decode("ascii", "replace")
<ide> for line in status.splitlines():
<ide> if line.startswith('-') or line.startswith('+'):
<del> raise ValueError(f'Submodule not clean: {line}')
<add> raise ValueError('Submodule not clean: {}'.format(line))
<ide>
<ide>
<ide> | 1 |
PHP | PHP | add tests for and fix query string parsing | 4e66fee85160bca84771ad45862977bd50959ed6 | <ide><path>src/Controller/Component/RequestHandlerComponent.php
<ide> public function beforeRedirect(Event $event, $url, Response $response)
<ide> }
<ide> $query = [];
<ide> if (strpos($url, '?') !== false) {
<del> list($url, $querystr) = explode('?', $url);
<add> list($url, $querystr) = explode('?', $url, 2);
<ide> parse_str($querystr, $query);
<ide> }
<ide> $controller = $event->subject();
<ide><path>tests/TestCase/Controller/Component/RequestHandlerComponentTest.php
<ide> public function testAjaxRedirectAsRequestAction()
<ide> $this->assertRegExp('/posts index/', $response->body(), 'RequestAction redirect failed.');
<ide> }
<ide>
<add> /**
<add> * Test that AJAX requests involving redirects handle querystrings
<add> *
<add> * @return void
<add> * @triggers Controller.beforeRedirect $this->Controller
<add> */
<add> public function testAjaxRedirectAsRequestActionWithQueryString()
<add> {
<add> Configure::write('App.namespace', 'TestApp');
<add> Router::connect('/:controller/:action');
<add> $event = new Event('Controller.beforeRedirect', $this->Controller);
<add>
<add> $this->Controller->RequestHandler = new RequestHandlerComponent($this->Controller->components());
<add> $this->Controller->request = $this->getMock('Cake\Network\Request', ['is']);
<add> $this->Controller->response = $this->getMock('Cake\Network\Response', ['_sendHeader', 'stop']);
<add> $this->Controller->RequestHandler->request = $this->Controller->request;
<add> $this->Controller->RequestHandler->response = $this->Controller->response;
<add> $this->Controller->request->expects($this->any())
<add> ->method('is')
<add> ->with('ajax')
<add> ->will($this->returnValue(true));
<add>
<add> $response = $this->Controller->RequestHandler->beforeRedirect(
<add> $event,
<add> '/request_action/params_pass?a=b&x=y?ish',
<add> $this->Controller->response
<add> );
<add> $data = json_decode($response, true);
<add> $this->assertEquals('/request_action/params_pass', $data['here']);
<add>
<add> $response = $this->Controller->RequestHandler->beforeRedirect(
<add> $event,
<add> '/request_action/query_pass?a=b&x=y?ish',
<add> $this->Controller->response
<add> );
<add> $data = json_decode($response, true);
<add> $this->assertEquals('y?ish', $data['x']);
<add> }
<add>
<ide> /**
<ide> * Tests that AJAX requests involving redirects don't let the status code bleed through.
<ide> *
<ide><path>tests/test_app/TestApp/Controller/RequestActionController.php
<ide> public function params_pass()
<ide> $this->response->body(json_encode([
<ide> 'params' => $this->request->params,
<ide> 'base' => $this->request->base,
<add> 'here' => $this->request->here,
<ide> 'webroot' => $this->request->webroot,
<ide> 'params' => $this->request->params,
<ide> 'query' => $this->request->query, | 3 |
Javascript | Javascript | use strict operator | a982e8933329eb779e786fdb71d2701bd087fdbe | <ide><path>src/lib/duration/iso-string.js
<ide> export function toISOString() {
<ide> }
<ide>
<ide> var totalSign = total < 0 ? '-' : '';
<del> var ymSign = sign(this._months) != sign(total) ? '-' : '';
<del> var daysSign = sign(this._days) != sign(total) ? '-' : '';
<del> var hmsSign = sign(this._milliseconds) != sign(total) ? '-' : '';
<add> var ymSign = sign(this._months) !== sign(total) ? '-' : '';
<add> var daysSign = sign(this._days) !== sign(total) ? '-' : '';
<add> var hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : '';
<ide>
<ide> return totalSign + 'P' +
<ide> (Y ? ymSign + Y + 'Y' : '') + | 1 |
Python | Python | fix lstm regularizers | 9b4f973d5779f79369bd3ae0fb982c7da49bd4f5 | <ide><path>keras/layers/recurrent.py
<ide> def append_regulariser(input_regulariser, param, regularizers_list):
<ide> regularizers_list.append(regulariser)
<ide>
<ide> self.regularizers = []
<del> for W in [self.W_i, self.W_f, self.W_i, self.W_o]:
<add> for W in [self.W_i, self.W_f, self.W_c, self.W_o]:
<ide> append_regulariser(self.W_regularizer, W, self.regularizers)
<del> for U in [self.U_i, self.U_f, self.U_i, self.U_o]:
<add> for U in [self.U_i, self.U_f, self.U_c, self.U_o]:
<ide> append_regulariser(self.U_regularizer, U, self.regularizers)
<del> for b in [self.b_i, self.b_f, self.b_i, self.b_o]:
<add> for b in [self.b_i, self.b_f, self.b_c, self.b_o]:
<ide> append_regulariser(self.b_regularizer, b, self.regularizers)
<ide>
<ide> self.trainable_weights = [self.W_i, self.U_i, self.b_i, | 1 |
Java | Java | fix bottom sheet in fabric android | cd5fe06abe1b5f00f3e6edda453342266da6d36e | <ide><path>ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.java
<ide> public void createView(
<ide> viewManager = mViewManagerRegistry.get(componentName);
<ide> view = mViewFactory.getOrCreateView(componentName, propsDiffMap, stateWrapper, themedReactContext);
<ide> view.setId(reactTag);
<add> if (stateWrapper != null) {
<add> viewManager.updateState(view, stateWrapper);
<add> }
<ide> }
<ide>
<ide> ViewState viewState = new ViewState(reactTag, view, viewManager); | 1 |
Ruby | Ruby | move this method somewhere more appropriate | 8d000110ccd33464f23d3b4cfac75908b61f802c | <ide><path>Library/Homebrew/formula.rb
<ide> def <=> b
<ide> def to_s
<ide> name
<ide> end
<add> def inspect
<add> name
<add> end
<ide>
<ide> # Standard parameters for CMake builds.
<ide> # Using Build Type "None" tells cmake to use our CFLAGS,etc. settings.
<ide> def self.installed
<ide> HOMEBREW_CELLAR.children.map{ |rack| factory(rack.basename) rescue nil }.compact
<ide> end
<ide>
<del> def inspect
<del> name
<del> end
<del>
<ide> def self.aliases
<ide> Dir["#{HOMEBREW_REPOSITORY}/Library/Aliases/*"].map{ |f| File.basename f }.sort
<ide> end | 1 |
Javascript | Javascript | fix the arguments order in `assert.strictequal` | 3c4f8a15408e32d481a7f43564165db05f19b6bd | <ide><path>test/parallel/test-file-write-stream.js
<ide> file
<ide> console.error('drain!', callbacks.drain);
<ide> callbacks.drain++;
<ide> if (callbacks.drain === -1) {
<del> assert.strictEqual(EXPECTED, fs.readFileSync(fn, 'utf8'));
<add> assert.strictEqual(fs.readFileSync(fn, 'utf8'), EXPECTED);
<ide> file.write(EXPECTED);
<ide> } else if (callbacks.drain === 0) {
<del> assert.strictEqual(EXPECTED + EXPECTED, fs.readFileSync(fn, 'utf8'));
<add> assert.strictEqual(fs.readFileSync(fn, 'utf8'), EXPECTED + EXPECTED);
<ide> file.end();
<ide> }
<ide> }) | 1 |
Ruby | Ruby | detect root via process.uid | aac200a53db859ab1aa12284627eacc6f3e92cf0 | <ide><path>Library/Homebrew/language/node.rb
<ide> def self.std_npm_install_args(libexec)
<ide> #{Dir.pwd}/#{pack}
<ide> ]
<ide>
<del> args << "--unsafe-perm" if ENV["USER"] == "root"
<add> args << "--unsafe-perm" if Process.uid.zero?
<ide>
<ide> args
<ide> end | 1 |
Ruby | Ruby | summarize updated casks for --preinstall | 1acb085574ab1560e55ecf21e6e7194ff435227e | <ide><path>Library/Homebrew/cmd/update-report.rb
<ide> def update_report
<ide> HOMEBREW_REPOSITORY.cd do
<ide> donation_message_displayed =
<ide> Utils.popen_read("git", "config", "--get", "homebrew.donationmessage").chomp == "true"
<del> unless donation_message_displayed
<add> if !donation_message_displayed && !args.quiet?
<ide> ohai "Homebrew is run entirely by unpaid volunteers. Please consider donating:"
<ide> puts " #{Formatter.url("https://github.com/Homebrew/brew#donations")}\n"
<ide>
<ide> def update_report
<ide>
<ide> if updated
<ide> if hub.empty?
<del> puts "No changes to formulae."
<add> puts "No changes to formulae." unless args.quiet?
<ide> else
<ide> hub.dump(updated_formula_report: !args.preinstall?)
<ide> hub.reporters.each(&:migrate_tap_migration)
<ide> def update_report
<ide> end
<ide> puts if args.preinstall?
<ide> elsif !args.preinstall? && !ENV["HOMEBREW_UPDATE_FAILED"]
<del> puts "Already up-to-date."
<add> puts "Already up-to-date." unless args.quiet?
<ide> end
<ide>
<ide> Commands.rebuild_commands_completion_list
<ide> def dump(updated_formula_report: true)
<ide> dump_formula_report :R, "Renamed Formulae"
<ide> dump_formula_report :D, "Deleted Formulae"
<ide> dump_formula_report :AC, "New Casks"
<del> dump_formula_report :MC, "Updated Casks"
<add> if updated_formula_report
<add> dump_formula_report :MC, "Updated Casks"
<add> else
<add> updated = select_formula(:MC).count
<add> if updated.positive?
<add> ohai "Updated Casks"
<add> puts "Updated #{updated} #{"cask".pluralize(updated)}."
<add> end
<add> end
<ide> dump_formula_report :DC, "Deleted Casks"
<ide> end
<ide> | 1 |
Text | Text | use function for components in general | 4812e229928dc01ae21ee0533685f6813694c136 | <ide><path>errors/next-script-for-ga.md
<ide> If you are using the [gtag.js](https://developers.google.com/analytics/devguides
<ide> ```jsx
<ide> import Script from 'next/script'
<ide>
<del>const Home = () => {
<add>function Home() {
<ide> return (
<ide> <div class="container">
<ide> <!-- Global site tag (gtag.js) - Google Analytics -->
<ide> If you are using the [analytics.js](https://developers.google.com/analytics/devg
<ide> ```jsx
<ide> import Script from 'next/script'
<ide>
<del>const Home = () => {
<add>function Home() {
<ide> return (
<ide> <div class="container">
<ide> <Script id="google-analytics" strategy="afterInteractive">
<ide> If you are using the [alternative async variant](https://developers.google.com/a
<ide> ```jsx
<ide> import Script from 'next/script'
<ide>
<del>const Home = () => {
<add>function Home() {
<ide> return (
<ide> <div class="container">
<ide> <Script id="google-analytics" strategy="afterInteractive">
<ide><path>errors/no-sync-scripts.md
<ide> Use the Script component with the right loading strategy to defer loading of the
<ide> ```jsx
<ide> import Script from 'next/script'
<ide>
<del>const Home = () => {
<add>function Home() {
<ide> return (
<ide> <div class="container">
<ide> <Script src="https://third-party-script.js"></Script> | 2 |
PHP | PHP | update the default redis host | 9ca8ed99609abd473da42f5affdab266d867b532 | <ide><path>config/database.php
<ide> 'cluster' => false,
<ide>
<ide> 'default' => [
<del> 'host' => env('REDIS_HOST', 'localhost'),
<add> 'host' => env('REDIS_HOST', '127.0.0.1'),
<ide> 'password' => env('REDIS_PASSWORD', null),
<ide> 'port' => env('REDIS_PORT', 6379),
<ide> 'database' => 0, | 1 |
Javascript | Javascript | fix mip levels | 5c7f0349989de9cdae092dc38cc31bc5b33b3714 | <ide><path>examples/js/nodes/bsdfs/RoughnessToBlinnExponentNode.js
<ide> RoughnessToBlinnExponentNode.Nodes = (function() {
<ide> // float envMapWidth = pow( 2.0, maxMIPLevelScalar );
<ide> // float desiredMIPLevel = log2( envMapWidth * sqrt( 3.0 ) ) - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );
<ide>
<del> " float desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );",
<add> " float desiredMIPLevel = maxMIPLevelScalar + 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );",
<ide>
<ide> // clamp to allowable LOD ranges.
<ide> " return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );",
<add>
<ide> "}"
<ide> ].join( "\n" ) );
<ide>
<ide><path>examples/js/nodes/utils/MaxMIPLevelNode.js
<ide> Object.defineProperties( MaxMIPLevelNode.prototype, {
<ide>
<ide> var image = this.texture.value.image ? this.texture.value.image[0] : undefined;
<ide>
<del> this.maxMIPLevel = image !== undefined ? ( Math.log( Math.max( image.width, image.height ) ) + 1 ) * Math.LOG2E : 0;
<add> this.maxMIPLevel = image !== undefined ? Math.log( Math.max( image.width, image.height ) ) * Math.LOG2E : 0;
<ide>
<ide> }
<ide> | 2 |
Javascript | Javascript | increase coverage for http2 response headers | 3eb029794c61e013c236e70e99ff659f6ea0826a | <ide><path>test/parallel/test-http2-compat-serverresponse-headers.js
<ide> server.listen(0, common.mustCall(function() {
<ide> response.removeHeader(denormalised);
<ide> assert.strictEqual(response.hasHeader(denormalised), false);
<ide>
<del> assert.throws(function() {
<del> response.setHeader(':status', 'foobar');
<del> }, common.expectsError({
<del> code: 'ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED',
<del> type: Error,
<del> message: 'Cannot set HTTP/2 pseudo-headers'
<del> }));
<add> [
<add> ':status',
<add> ':method',
<add> ':path',
<add> ':authority',
<add> ':scheme'
<add> ].forEach((header) => assert.throws(
<add> () => response.setHeader(header, 'foobar'),
<add> common.expectsError({
<add> code: 'ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED',
<add> type: Error,
<add> message: 'Cannot set HTTP/2 pseudo-headers'
<add> })
<add> ));
<ide> assert.throws(function() {
<ide> response.setHeader(real, null);
<ide> }, common.expectsError({ | 1 |
Python | Python | remove extra parameter from xcom | 28d5ca2e09e1ac3d6532df610dc9e91e9c936202 | <ide><path>airflow/models.py
<ide> def xcom_pull(
<ide> task_ids,
<ide> dag_id=None,
<ide> key=XCOM_RETURN_KEY,
<del> include_prior_dates=False,
<del> limit=None):
<add> include_prior_dates=False):
<ide> """
<ide> Pull XComs that optionally meet certain criteria.
<ide>
<ide> def xcom_pull(
<ide> execution_date are returned. If True, XComs from previous dates
<ide> are returned as well.
<ide> :type include_prior_dates: bool
<del> :param limit: the maximum number of results to return. Pass None for
<del> no limit.
<del> :type limit: int
<ide> """
<ide>
<ide> if dag_id is None: | 1 |
Text | Text | add note about airflow components to template | a373dbaf50292e6e89d16e778e674e791576c902 | <ide><path>ISSUE_TEMPLATE.md
<ide> Dear Airflow Maintainers,
<ide>
<ide> Before I tell you about my issue, let me describe my environment:
<ide>
<del># Environment
<add>### Environment
<ide>
<del>* Version of Airflow (e.g. a release version, running your own fork, running off master -- provide a git log snippet) :
<add>* Version of Airflow (e.g. a release version, running your own fork, running off master -- provide a git log snippet):
<add>* Airflow components and configuration, if applicable (e.g. "Running a Scheduler with CeleryExecutor")
<ide> * Example code to reproduce the bug (as a code snippet in markdown)
<ide> * Screen shots of your DAG's graph and tree views:
<ide> * Stack trace if applicable:
<ide> Before I tell you about my issue, let me describe my environment:
<ide>
<ide> Now that you know a little about me, let me tell you about the issue I am having:
<ide>
<del># Description of Issue
<add>### Description of Issue
<ide>
<ide> * What did you expect to happen?
<ide> * What happened instead?
<ide> * Here is how you can reproduce this issue on your machine:
<ide>
<del>## Reproduction Steps
<add>### Reproduction Steps
<ide>
<ide> 1.
<ide> 2. | 1 |
Ruby | Ruby | initialize @target instead asking if it is defined | 49f3525f19a78b478367f997522197d03e8694ce | <ide><path>activerecord/lib/active_record/associations/association.rb
<ide> class Association #:nodoc:
<ide> def initialize(owner, reflection)
<ide> reflection.check_validity!
<ide>
<add> @target = nil
<ide> @owner, @reflection = owner, reflection
<ide> @updated = false
<ide>
<ide> def aliased_table_name
<ide> # Resets the \loaded flag to +false+ and sets the \target to +nil+.
<ide> def reset
<ide> @loaded = false
<del> IdentityMap.remove(@target) if defined?(@target) && @target && IdentityMap.enabled?
<add> IdentityMap.remove(@target) if IdentityMap.enabled? && @target
<ide> @target = nil
<ide> end
<ide> | 1 |
Java | Java | pass getlistenerid call on to delegate | 48688b7b0455efc74b2998288242e01ba78f3f73 | <ide><path>spring-context/src/main/java/org/springframework/context/event/GenericApplicationListenerAdapter.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> public void onApplicationEvent(ApplicationEvent event) {
<ide> this.delegate.onApplicationEvent(event);
<ide> }
<ide>
<add> @Override
<add> public String getListenerId() {
<add> return this.delegate.getListenerId();
<add> }
<add>
<ide> @Override
<ide> @SuppressWarnings("unchecked")
<ide> public boolean supportsEventType(ResolvableType eventType) {
<ide><path>spring-context/src/main/java/org/springframework/context/event/SourceFilteringListener.java
<ide> /*
<del> * Copyright 2002-2017 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> public void onApplicationEvent(ApplicationEvent event) {
<ide> }
<ide> }
<ide>
<add> @Override
<add> public String getListenerId() {
<add> return (this.delegate != null ? this.delegate.getListenerId() : "");
<add> }
<add>
<ide> @Override
<ide> public boolean supportsEventType(ResolvableType eventType) {
<ide> return (this.delegate == null || this.delegate.supportsEventType(eventType)); | 2 |
Ruby | Ruby | fix preloading of has_one through associations | b7a37b742c0abd1df8ea48cc82f76385cc0c41ea | <ide><path>activerecord/lib/active_record/association_preload.rb
<ide> def add_preloaded_records_to_collection(parent_records, reflection_name, associa
<ide>
<ide> def add_preloaded_record_to_collection(parent_records, reflection_name, associated_record)
<ide> parent_records.each do |parent_record|
<del> association_proxy = parent_record.send(reflection_name)
<del> association_proxy.loaded
<del> association_proxy.target = associated_record
<add> parent_record.send("set_#{reflection_name}_target", associated_record)
<ide> end
<ide> end
<ide>
<ide> def preload_has_and_belongs_to_many_association(records, reflection, preload_opt
<ide> def preload_has_one_association(records, reflection, preload_options={})
<ide> id_to_record_map, ids = construct_id_map(records)
<ide> options = reflection.options
<add> records.each {|record| record.send("set_#{reflection.name}_target", nil)}
<ide> if options[:through]
<del> records.each {|record| record.send(reflection.name) && record.send(reflection.name).loaded}
<ide> through_records = preload_through_records(records, reflection, options[:through])
<ide> through_reflection = reflections[options[:through]]
<ide> through_primary_key = through_reflection.primary_key_name
<ide> def preload_has_one_association(records, reflection, preload_options={})
<ide> end
<ide> end
<ide> else
<del> records.each {|record| record.send("set_#{reflection.name}_target", nil)}
<del>
<ide> set_association_single_records(id_to_record_map, reflection.name, find_associated_records(ids, reflection, preload_options), reflection.primary_key_name)
<ide> end
<ide> end
<ide><path>activerecord/test/cases/associations/has_one_through_associations_test.rb
<ide> def test_replacing_target_record_deletes_old_association
<ide> def test_has_one_through_polymorphic
<ide> assert_equal clubs(:moustache_club), @member.sponsor_club
<ide> end
<del>
<add>
<ide> def has_one_through_to_has_many
<ide> assert_equal 2, @member.fellow_members.size
<ide> end
<del>
<add>
<ide> def test_has_one_through_eager_loading
<del> members = Member.find(:all, :include => :club, :conditions => ["name = ?", "Groucho Marx"])
<add> members = assert_queries(3) do #base table, through table, clubs table
<add> Member.find(:all, :include => :club, :conditions => ["name = ?", "Groucho Marx"])
<add> end
<ide> assert_equal 1, members.size
<ide> assert_not_nil assert_no_queries {members[0].club}
<ide> end
<del>
<add>
<ide> def test_has_one_through_eager_loading_through_polymorphic
<del> members = Member.find(:all, :include => :sponsor_club, :conditions => ["name = ?", "Groucho Marx"])
<add> members = assert_queries(3) do #base table, through table, clubs table
<add> Member.find(:all, :include => :sponsor_club, :conditions => ["name = ?", "Groucho Marx"])
<add> end
<ide> assert_equal 1, members.size
<ide> assert_not_nil assert_no_queries {members[0].sponsor_club}
<ide> end | 2 |
Javascript | Javascript | add event handler for window resizing | 0a9437bef2d8014a94b637ddaf4c8e0e12276f73 | <ide><path>src/window-event-handler.js
<ide> class WindowEventHandler {
<ide> this.handleFocusNext = this.handleFocusNext.bind(this)
<ide> this.handleFocusPrevious = this.handleFocusPrevious.bind(this)
<ide> this.handleWindowBlur = this.handleWindowBlur.bind(this)
<add> this.handleWindowResize = this.handleWindowResize.bind(this)
<ide> this.handleEnterFullScreen = this.handleEnterFullScreen.bind(this)
<ide> this.handleLeaveFullScreen = this.handleLeaveFullScreen.bind(this)
<ide> this.handleWindowBeforeunload = this.handleWindowBeforeunload.bind(this)
<ide> class WindowEventHandler {
<ide> this.addEventListener(this.window, 'beforeunload', this.handleWindowBeforeunload)
<ide> this.addEventListener(this.window, 'focus', this.handleWindowFocus)
<ide> this.addEventListener(this.window, 'blur', this.handleWindowBlur)
<add> this.addEventListener(this.window, 'resize', this.handleWindowResize)
<ide>
<ide> this.addEventListener(this.document, 'keyup', this.handleDocumentKeyEvent)
<ide> this.addEventListener(this.document, 'keydown', this.handleDocumentKeyEvent)
<ide> class WindowEventHandler {
<ide> this.atomEnvironment.storeWindowDimensions()
<ide> }
<ide>
<add> handleWindowResize () {
<add> this.atomEnvironment.storeWindowDimensions()
<add> }
<add>
<ide> handleEnterFullScreen () {
<ide> this.document.body.classList.add('fullscreen')
<ide> } | 1 |
Javascript | Javascript | add tests for build activity indicator | 7fe7648f7b47174c8adbbbb3992b6518404aea1b | <ide><path>test/integration/build-indicator/pages/a.js
<add>export default () => <p>Hello from a</p>
<ide><path>test/integration/build-indicator/pages/b.js
<add>export default () => <p>Hello from b</p>
<ide><path>test/integration/build-indicator/pages/index.js
<add>import Link from 'next/link'
<add>
<add>export default () => (
<add> <>
<add> <Link href='/a'>
<add> <a id='to-a'>Go to a</a>
<add> </Link>
<add> <Link href='/b'>
<add> <a id='to-b'>Go to b</a>
<add> </Link>
<add> </>
<add>)
<ide><path>test/integration/build-indicator/test/index.test.js
<add>/* eslint-env jest */
<add>/* global jasmine */
<add>import fs from 'fs'
<add>import { join } from 'path'
<add>import webdriver from 'next-webdriver'
<add>import { findPort, launchApp, killApp, waitFor } from 'next-test-utils'
<add>
<add>jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 5
<add>const appDir = join(__dirname, '..')
<add>let appPort
<add>let app
<add>
<add>const installCheckVisible = browser => {
<add> return browser.eval(`(function() {
<add> window.checkInterval = setInterval(function() {
<add> let watcherDiv = document.querySelector('#__next-build-watcher')
<add> watcherDiv = watcherDiv.shadowRoot || watcherDiv
<add> window.showedBuilder = window.showedBuilder || (
<add> watcherDiv.querySelector('div').className.indexOf('visible') > -1
<add> )
<add> if (window.showedBuilder) clearInterval(window.checkInterval)
<add> }, 50)
<add> })()`)
<add>}
<add>
<add>describe('Build Activity Indicator', () => {
<add> beforeAll(async () => {
<add> appPort = await findPort()
<add> app = await launchApp(appDir, appPort)
<add> })
<add> afterAll(() => killApp(app))
<add>
<add> it('Adds the build indicator container', async () => {
<add> const browser = await webdriver(appPort, '/')
<add> const html = await browser.eval('document.body.innerHTML')
<add> expect(html).toMatch(/__next-build-watcher/)
<add> await browser.close()
<add> })
<add>
<add> it('Shows the build indicator when a page is built during navigation', async () => {
<add> const browser = await webdriver(appPort, '/')
<add> await installCheckVisible(browser)
<add> await browser.elementByCss('#to-a').click()
<add> await waitFor(500)
<add> const wasVisible = await browser.eval('window.showedBuilder')
<add> expect(wasVisible).toBe(true)
<add> await browser.close()
<add> })
<add>
<add> it('Shows build indicator when page is built from modifying', async () => {
<add> const browser = await webdriver(appPort, '/b')
<add> await installCheckVisible(browser)
<add> const pagePath = join(appDir, 'pages/b.js')
<add> const origContent = fs.readFileSync(pagePath, 'utf8')
<add> const newContent = origContent.replace('b', 'c')
<add>
<add> fs.writeFileSync(pagePath, newContent, 'utf8')
<add> await waitFor(500)
<add> const wasVisible = await browser.eval('window.showedBuilder')
<add>
<add> expect(wasVisible).toBe(true)
<add> fs.writeFileSync(pagePath, origContent, 'utf8')
<add> await browser.close()
<add> })
<add>}) | 4 |
Javascript | Javascript | shorten some lines in events.js | 6bdc42cee7e7aa6884e0b91277ee038d755afb4c | <ide><path>lib/events.js
<del>exports.EventEmitter = process.EventEmitter;
<add>var EventEmitter = exports.EventEmitter = process.EventEmitter;
<ide>
<ide> var isArray = Array.isArray;
<ide>
<del>process.EventEmitter.prototype.emit = function (type) {
<add>EventEmitter.prototype.emit = function (type) {
<ide> // If there is no 'error' event listener then throw.
<ide> if (type === 'error') {
<ide> if (!this._events || !this._events.error ||
<ide> process.EventEmitter.prototype.emit = function (type) {
<ide> }
<ide> };
<ide>
<del>// process.EventEmitter is defined in src/node_events.cc
<del>// process.EventEmitter.prototype.emit() is also defined there.
<del>process.EventEmitter.prototype.addListener = function (type, listener) {
<add>// EventEmitter is defined in src/node_events.cc
<add>// EventEmitter.prototype.emit() is also defined there.
<add>EventEmitter.prototype.addListener = function (type, listener) {
<ide> if ('function' !== typeof listener) {
<ide> throw new Error('addListener only takes instances of Function');
<ide> }
<ide> process.EventEmitter.prototype.addListener = function (type, listener) {
<ide> return this;
<ide> };
<ide>
<del>process.EventEmitter.prototype.on = process.EventEmitter.prototype.addListener;
<add>EventEmitter.prototype.on = EventEmitter.prototype.addListener;
<ide>
<del>process.EventEmitter.prototype.removeListener = function (type, listener) {
<add>EventEmitter.prototype.removeListener = function (type, listener) {
<ide> if ('function' !== typeof listener) {
<ide> throw new Error('removeListener only takes instances of Function');
<ide> }
<ide> process.EventEmitter.prototype.removeListener = function (type, listener) {
<ide> return this;
<ide> };
<ide>
<del>process.EventEmitter.prototype.removeAllListeners = function (type) {
<add>EventEmitter.prototype.removeAllListeners = function (type) {
<ide> // does not use listeners(), so no side effect of creating _events[type]
<ide> if (type && this._events && this._events[type]) this._events[type] = null;
<ide> return this;
<ide> };
<ide>
<del>process.EventEmitter.prototype.listeners = function (type) {
<add>EventEmitter.prototype.listeners = function (type) {
<ide> if (!this._events) this._events = {};
<ide> if (!this._events[type]) this._events[type] = [];
<ide> if (!isArray(this._events[type])) { | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.