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 | add v3.1.0-beta.1 to changelog.md | b3786610acdad73be20092876bf60f0b17af83c3 | <ide><path>CHANGELOG.md
<ide> # Ember Changelog
<ide>
<add>### v3.1.0-beta.1 (February 14, 2018)
<add>
<add>- [emberjs/rfcs#276](https://github.com/emberjs/rfcs/blob/master/text/0276-named-args.md) [FEATURE named-args] enabled by default.
<add>- [emberjs/rfcs#278](https://github.com/emberjs/rfcs/blob/master/text/0278-template-only-components.md) [FEATURE template-only-glimmer-components] Enable-able via `@ember/optional-features` addon.
<add>- [emberjs/rfcs#280](https://github.com/emberjs/rfcs/blob/master/text/0280-remove-application-wrapper.md) [FEATURE application-template-wrapper] Enable-able via `@ember/optional-features` addon.
<add>- [emberjs/rfcs#281](https://github.com/emberjs/rfcs/blob/master/text/0281-es5-getters.md) [FEATURE native-es5-getters] Enabled by default.
<add>- [#15828](https://github.com/emberjs/ember.js/pull/15828) Upgrade glimmer-vm to latest version.
<add>- [#16212](https://github.com/emberjs/ember.js/pull/16212) Update to [email protected].
<add>
<ide> ### v3.0.0 (February 13, 2018)
<ide>
<ide> - [#16218](https://github.com/emberjs/ember.js/pull/16218) [BUGFIX beta] Prevent errors when using const `(get arr 1)`. | 1 |
Python | Python | add type hints for pegasus | deb61e5f073308cc3386c4777e41e28668aadc85 | <ide><path>src/transformers/models/pegasus/modeling_pegasus.py
<ide> def get_position_embeddings(self) -> Tuple[nn.Embedding]:
<ide> @replace_return_docstrings(output_type=Seq2SeqModelOutput, config_class=_CONFIG_FOR_DOC)
<ide> def forward(
<ide> self,
<del> input_ids=None,
<del> attention_mask=None,
<del> decoder_input_ids=None,
<del> decoder_attention_mask=None,
<del> head_mask=None,
<del> decoder_head_mask=None,
<del> cross_attn_head_mask=None,
<del> encoder_outputs=None,
<del> past_key_values=None,
<del> inputs_embeds=None,
<del> decoder_inputs_embeds=None,
<del> use_cache=None,
<del> output_attentions=None,
<del> output_hidden_states=None,
<del> return_dict=None,
<del> ):
<add> input_ids: Optional[torch.Tensor] = None,
<add> attention_mask: Optional[torch.Tensor] = None,
<add> decoder_input_ids: Optional[torch.Tensor] = None,
<add> decoder_attention_mask: Optional[torch.Tensor] = None,
<add> head_mask: Optional[torch.Tensor] = None,
<add> decoder_head_mask: Optional[torch.Tensor] = None,
<add> cross_attn_head_mask: Optional[torch.Tensor] = None,
<add> encoder_outputs: Optional[Tuple[torch.FloatTensor]] = None,
<add> past_key_values: Optional[Tuple[torch.FloatTensor]] = None,
<add> inputs_embeds: Optional[torch.Tensor] = None,
<add> decoder_inputs_embeds: Optional[torch.Tensor] = None,
<add> use_cache: Optional[bool] = None,
<add> output_attentions: Optional[bool] = None,
<add> output_hidden_states: Optional[bool] = None,
<add> return_dict: Optional[bool] = None,
<add> ) -> Union[Tuple, Seq2SeqModelOutput]:
<ide> r"""
<ide> Returns:
<ide>
<ide> def get_position_embeddings(self) -> Tuple[nn.Embedding]:
<ide> @add_end_docstrings(PEGASUS_GENERATION_EXAMPLE)
<ide> def forward(
<ide> self,
<del> input_ids=None,
<del> attention_mask=None,
<del> decoder_input_ids=None,
<del> decoder_attention_mask=None,
<del> head_mask=None,
<del> decoder_head_mask=None,
<del> cross_attn_head_mask=None,
<del> encoder_outputs=None,
<del> past_key_values=None,
<del> inputs_embeds=None,
<del> decoder_inputs_embeds=None,
<del> labels=None,
<del> use_cache=None,
<del> output_attentions=None,
<del> output_hidden_states=None,
<del> return_dict=None,
<del> ):
<add> input_ids: Optional[torch.Tensor] = None,
<add> attention_mask: Optional[torch.Tensor] = None,
<add> decoder_input_ids: Optional[torch.Tensor] = None,
<add> decoder_attention_mask: Optional[torch.Tensor] = None,
<add> head_mask: Optional[torch.Tensor] = None,
<add> decoder_head_mask: Optional[torch.Tensor] = None,
<add> cross_attn_head_mask: Optional[torch.Tensor] = None,
<add> encoder_outputs: Optional[Tuple[torch.FloatTensor]] = None,
<add> past_key_values: Optional[Tuple[torch.FloatTensor]] = None,
<add> inputs_embeds: Optional[torch.Tensor] = None,
<add> decoder_inputs_embeds: Optional[torch.Tensor] = None,
<add> labels: Optional[torch.Tensor] = None,
<add> use_cache: Optional[bool] = None,
<add> output_attentions: Optional[bool] = None,
<add> output_hidden_states: Optional[bool] = None,
<add> return_dict: Optional[bool] = None,
<add> ) -> Union[Tuple, Seq2SeqLMOutput]:
<ide> r"""
<ide> labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
<ide> Labels for computing the masked language modeling loss. Indices should either be in `[0, ..., | 1 |
Text | Text | add contributor agreement | d000b4323aca9cd1a2c893b9ade771824411dd1a | <ide><path>.github/contributors/calumcalder.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 UG (haftungsbeschränkt)](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 | Calum Calder |
<add>| Company name (if applicable) | |
<add>| Title or role (if applicable) | |
<add>| Date | 22 March 2018 |
<add>| GitHub username | calumcalder |
<add>| Website (optional) | | | 1 |
Go | Go | improve error message for non-running containers | b1a3a5580285b58d643ff0c09c263f78d1088f37 | <ide><path>server.go
<ide> func (srv *Server) ImageHistory(name string) ([]APIHistory, error) {
<ide>
<ide> func (srv *Server) ContainerTop(name, psArgs string) (*APITop, error) {
<ide> if container := srv.runtime.Get(name); container != nil {
<add> if !container.State.IsRunning() {
<add> return nil, fmt.Errorf("Container %s is not running", name)
<add> }
<ide> pids, err := utils.GetPidsForContainer(container.ID)
<ide> if err != nil {
<ide> return nil, err | 1 |
Java | Java | avoid deprecated number constructors on jdk 9 | d07381e862728d10feb861b0c8e070328ac875aa | <ide><path>spring-context/src/main/java/org/springframework/scripting/config/ScriptingDefaultsParser.java
<ide> public BeanDefinition parse(Element element, ParserContext parserContext) {
<ide> LangNamespaceUtils.registerScriptFactoryPostProcessorIfNecessary(parserContext.getRegistry());
<ide> String refreshCheckDelay = element.getAttribute(REFRESH_CHECK_DELAY_ATTRIBUTE);
<ide> if (StringUtils.hasText(refreshCheckDelay)) {
<del> bd.getPropertyValues().add("defaultRefreshCheckDelay", new Long(refreshCheckDelay));
<add> bd.getPropertyValues().add("defaultRefreshCheckDelay", Long.valueOf(refreshCheckDelay));
<ide> }
<ide> String proxyTargetClass = element.getAttribute(PROXY_TARGET_CLASS_ATTRIBUTE);
<ide> if (StringUtils.hasText(proxyTargetClass)) {
<ide><path>spring-core/src/main/java/org/springframework/asm/Opcodes.java
<ide> public interface Opcodes {
<ide> */
<ide> int F_SAME1 = 4;
<ide>
<del> Integer TOP = new Integer(0);
<del> Integer INTEGER = new Integer(1);
<del> Integer FLOAT = new Integer(2);
<del> Integer DOUBLE = new Integer(3);
<del> Integer LONG = new Integer(4);
<del> Integer NULL = new Integer(5);
<del> Integer UNINITIALIZED_THIS = new Integer(6);
<add> Integer TOP = 0;
<add> Integer INTEGER = 1;
<add> Integer FLOAT = 2;
<add> Integer DOUBLE = 3;
<add> Integer LONG = 4;
<add> Integer NULL = 5;
<add> Integer UNINITIALIZED_THIS = 6;
<ide>
<ide> // opcodes // visit method (- = idem)
<ide>
<ide><path>spring-core/src/main/java/org/springframework/core/style/ToStringCreator.java
<ide> /*
<del> * Copyright 2002-2014 the original author or authors.
<add> * Copyright 2002-2016 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 ToStringCreator(Object obj, ToStringStyler styler) {
<ide> * @return this, to support call-chaining
<ide> */
<ide> public ToStringCreator append(String fieldName, byte value) {
<del> return append(fieldName, new Byte(value));
<add> return append(fieldName, Byte.valueOf(value));
<ide> }
<ide>
<ide> /**
<ide> public ToStringCreator append(String fieldName, byte value) {
<ide> * @return this, to support call-chaining
<ide> */
<ide> public ToStringCreator append(String fieldName, short value) {
<del> return append(fieldName, new Short(value));
<add> return append(fieldName, Short.valueOf(value));
<ide> }
<ide>
<ide> /**
<ide> public ToStringCreator append(String fieldName, short value) {
<ide> * @return this, to support call-chaining
<ide> */
<ide> public ToStringCreator append(String fieldName, int value) {
<del> return append(fieldName, new Integer(value));
<add> return append(fieldName, Integer.valueOf(value));
<ide> }
<ide>
<ide> /**
<ide> public ToStringCreator append(String fieldName, int value) {
<ide> * @return this, to support call-chaining
<ide> */
<ide> public ToStringCreator append(String fieldName, long value) {
<del> return append(fieldName, new Long(value));
<add> return append(fieldName, Long.valueOf(value));
<ide> }
<ide>
<ide> /**
<ide> public ToStringCreator append(String fieldName, long value) {
<ide> * @return this, to support call-chaining
<ide> */
<ide> public ToStringCreator append(String fieldName, float value) {
<del> return append(fieldName, new Float(value));
<add> return append(fieldName, Float.valueOf(value));
<ide> }
<ide>
<ide> /**
<ide> public ToStringCreator append(String fieldName, float value) {
<ide> * @return this, to support call-chaining
<ide> */
<ide> public ToStringCreator append(String fieldName, double value) {
<del> return append(fieldName, new Double(value));
<add> return append(fieldName, Double.valueOf(value));
<ide> }
<ide>
<ide> /**
<ide><path>spring-jdbc/src/main/java/org/springframework/jdbc/datasource/ConnectionHolder.java
<ide> public Connection getConnection() {
<ide> */
<ide> public boolean supportsSavepoints() throws SQLException {
<ide> if (this.savepointsSupported == null) {
<del> this.savepointsSupported = new Boolean(getConnection().getMetaData().supportsSavepoints());
<add> this.savepointsSupported = getConnection().getMetaData().supportsSavepoints();
<ide> }
<del> return this.savepointsSupported.booleanValue();
<add> return this.savepointsSupported;
<ide> }
<ide>
<ide> /**
<ide><path>spring-jms/src/main/java/org/springframework/jms/config/JcaListenerContainerParser.java
<ide> /*
<del> * Copyright 2002-2014 the original author or authors.
<add> * Copyright 2002-2016 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> protected MutablePropertyValues parseCommonContainerProperties(Element container
<ide>
<ide> String prefetch = containerEle.getAttribute(PREFETCH_ATTRIBUTE);
<ide> if (StringUtils.hasText(prefetch)) {
<del> properties.add("prefetchSize", new Integer(prefetch));
<add> properties.add("prefetchSize", Integer.valueOf(prefetch));
<ide> }
<ide>
<ide> return properties;
<ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/handler/SimpleMappingExceptionResolver.java
<ide> public class SimpleMappingExceptionResolver extends AbstractHandlerExceptionReso
<ide> /** The default name of the exception attribute: "exception". */
<ide> public static final String DEFAULT_EXCEPTION_ATTRIBUTE = "exception";
<ide>
<add>
<ide> private Properties exceptionMappings;
<ide>
<ide> private Class<?>[] excludedExceptions;
<ide> public void setDefaultErrorView(String defaultErrorView) {
<ide> public void setStatusCodes(Properties statusCodes) {
<ide> for (Enumeration<?> enumeration = statusCodes.propertyNames(); enumeration.hasMoreElements();) {
<ide> String viewName = (String) enumeration.nextElement();
<del> Integer statusCode = new Integer(statusCodes.getProperty(viewName));
<add> Integer statusCode = Integer.valueOf(statusCodes.getProperty(viewName));
<ide> this.statusCodes.put(viewName, statusCode);
<ide> }
<ide> } | 6 |
Ruby | Ruby | reset schema properly after schema changing test | 3412d4a1e7c1b696444119528ea2a0466b180ce9 | <ide><path>activerecord/test/cases/locking_test.rb
<ide> def test_destroy_dependents
<ide> assert_raises(ActiveRecord::RecordNotFound) { LegacyThing.find(t.id) }
<ide> ensure
<ide> remove_counter_column_from(Person, 'legacy_things_count')
<add> LegacyThing.connection.remove_column LegacyThing.table_name, 'person_id'
<add> LegacyThing.reset_column_information
<ide> end
<ide>
<ide> private | 1 |
Python | Python | fix test.py after v8 upgrade | b5c172138c8c27048f969ea9891f93474d937e19 | <ide><path>tools/test.py
<ide> import time
<ide> import threading
<ide> from Queue import Queue, Empty
<del>
<del>sys.path.append(dirname(__file__) + "/../deps/v8/tools");
<ide> import utils
<ide>
<ide> VERBOSE = False
<ide><path>tools/utils.py
<add># Copyright 2008 the V8 project authors. All rights reserved.
<add># Redistribution and use in source and binary forms, with or without
<add># modification, are permitted provided that the following conditions are
<add># met:
<add>#
<add># * Redistributions of source code must retain the above copyright
<add># notice, this list of conditions and the following disclaimer.
<add># * Redistributions in binary form must reproduce the above
<add># copyright notice, this list of conditions and the following
<add># disclaimer in the documentation and/or other materials provided
<add># with the distribution.
<add># * Neither the name of Google Inc. nor the names of its
<add># contributors may be used to endorse or promote products derived
<add># from this software without specific prior written permission.
<add>#
<add># THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
<add># "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
<add># LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
<add># A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
<add># OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
<add># SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
<add># LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
<add># DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
<add># THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
<add># (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
<add># OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<add>
<add>
<add>import platform
<add>import re
<add>
<add>
<add># Reads a .list file into an array of strings
<add>def ReadLinesFrom(name):
<add> list = []
<add> for line in open(name):
<add> if '#' in line:
<add> line = line[:line.find('#')]
<add> line = line.strip()
<add> if len(line) == 0:
<add> continue
<add> list.append(line)
<add> return list
<add>
<add>
<add>def GuessOS():
<add> id = platform.system()
<add> if id == 'Linux':
<add> return 'linux'
<add> elif id == 'Darwin':
<add> return 'macos'
<add> elif id.find('CYGWIN') >= 0:
<add> return 'cygwin'
<add> elif id == 'Windows' or id == 'Microsoft':
<add> # On Windows Vista platform.system() can return 'Microsoft' with some
<add> # versions of Python, see http://bugs.python.org/issue1082
<add> return 'win32'
<add> elif id == 'FreeBSD':
<add> return 'freebsd'
<add> elif id == 'OpenBSD':
<add> return 'openbsd'
<add> elif id == 'SunOS':
<add> return 'solaris'
<add> elif id == 'NetBSD':
<add> return 'netbsd'
<add> else:
<add> return None
<add>
<add>
<add># This will default to building the 32 bit VM even on machines that are capable
<add># of running the 64 bit VM. Use the scons option --arch=x64 to force it to build
<add># the 64 bit VM.
<add>def GuessArchitecture():
<add> id = platform.machine()
<add> id = id.lower() # Windows 7 capitalizes 'AMD64'.
<add> if id.startswith('arm'):
<add> return 'arm'
<add> elif (not id) or (not re.match('(x|i[3-6])86$', id) is None):
<add> return 'ia32'
<add> elif id == 'i86pc':
<add> return 'ia32'
<add> elif id == 'x86_64':
<add> return 'ia32'
<add> elif id == 'amd64':
<add> return 'ia32'
<add> else:
<add> return None
<add>
<add>
<add>def GuessWordsize():
<add> if '64' in platform.machine():
<add> return '64'
<add> else:
<add> return '32'
<add>
<add>
<add>def IsWindows():
<add> return GuessOS() == 'win32' | 2 |
Ruby | Ruby | handle nil import_name | 686f829f2f5584939c989b58d93e8e17b4d60fcc | <ide><path>Library/Homebrew/requirements/language_module_dependency.rb
<ide> class LanguageModuleDependency < Requirement
<ide> fatal true
<ide>
<del> def initialize language, module_name, import_name=module_name
<add> def initialize language, module_name, import_name=nil
<ide> @language = language
<ide> @module_name = module_name
<del> @import_name = import_name
<add> @import_name = import_name || module_name
<ide> super([language, module_name, import_name])
<ide> end
<ide> | 1 |
Ruby | Ruby | fix missing `command` method | 40a0b8b10ab6ba1ef8e3b0acc2eeef7c8dd494b6 | <ide><path>Library/Homebrew/cask/cmd.rb
<ide> def initialize(command, *args)
<ide> @args = args
<ide> end
<ide>
<del> def run(*_args)
<add> def run(*)
<ide> purpose
<ide> usage
<ide>
<ide> def run(*_args)
<ide> raise ArgumentError, "help does not take arguments." if @args.length
<ide> end
<ide>
<del> raise ArgumentError, "Unknown Cask command: #{command}"
<add> raise ArgumentError, "Unknown Cask command: #{@command}"
<ide> end
<ide>
<ide> def purpose | 1 |
Python | Python | fix _array2string for strustured array (issue ) | 3d75c3f5165d958ff109a4f877aeb18d77ce279f | <ide><path>numpy/core/arrayprint.py
<ide> def _boolFormatter(x):
<ide> def repr_format(x):
<ide> return repr(x)
<ide>
<del>def _array2string(a, max_line_width, precision, suppress_small, separator=' ',
<del> prefix="", formatter=None):
<del>
<del> if max_line_width is None:
<del> max_line_width = _line_width
<del>
<del> if precision is None:
<del> precision = _float_output_precision
<del>
<del> if suppress_small is None:
<del> suppress_small = _float_output_suppress_small
<del>
<del> if formatter is None:
<del> formatter = _formatter
<del>
<del> if a.size > _summaryThreshold:
<del> summary_insert = "..., "
<del> data = _leading_trailing(a)
<del> else:
<del> summary_insert = ""
<del> data = ravel(asarray(a))
<add>def _get_format_function(data, precision, suppress_small, formatter):
<add> """
<add> find the right formatting function for the dtype_
<add> """
<add> dtype_ = data.dtype
<add> if dtype_.fields is not None:
<add> format_functions = []
<add> for descr in dtype_.descr:
<add> field_name = descr[0]
<add> field_values = data[field_name]
<add> if len(field_values.shape) <= 1:
<add> format_function = _get_format_function(
<add> field_values, precision, suppress_small, formatter)
<add> else:
<add> format_function = repr_format
<add> format_functions.append(format_function)
<add> return StructureFormat(format_functions)
<ide>
<ide> formatdict = {'bool': _boolFormatter,
<ide> 'int': IntegerFormat(data),
<ide> def _array2string(a, max_line_width, precision, suppress_small, separator=' ',
<ide> if key in fkeys:
<ide> formatdict[key] = formatter[key]
<ide>
<del> # find the right formatting function for the array
<del> dtypeobj = a.dtype.type
<add> dtypeobj = dtype_.type
<ide> if issubclass(dtypeobj, _nt.bool_):
<del> format_function = formatdict['bool']
<add> return formatdict['bool']
<ide> elif issubclass(dtypeobj, _nt.integer):
<ide> if issubclass(dtypeobj, _nt.timedelta64):
<del> format_function = formatdict['timedelta']
<add> return formatdict['timedelta']
<ide> else:
<del> format_function = formatdict['int']
<add> return formatdict['int']
<ide> elif issubclass(dtypeobj, _nt.floating):
<ide> if issubclass(dtypeobj, _nt.longfloat):
<del> format_function = formatdict['longfloat']
<add> return formatdict['longfloat']
<ide> else:
<del> format_function = formatdict['float']
<add> return formatdict['float']
<ide> elif issubclass(dtypeobj, _nt.complexfloating):
<ide> if issubclass(dtypeobj, _nt.clongfloat):
<del> format_function = formatdict['longcomplexfloat']
<add> return formatdict['longcomplexfloat']
<ide> else:
<del> format_function = formatdict['complexfloat']
<add> return formatdict['complexfloat']
<ide> elif issubclass(dtypeobj, (_nt.unicode_, _nt.string_)):
<del> format_function = formatdict['numpystr']
<add> return formatdict['numpystr']
<ide> elif issubclass(dtypeobj, _nt.datetime64):
<del> format_function = formatdict['datetime']
<add> return formatdict['datetime']
<ide> else:
<del> format_function = formatdict['numpystr']
<add> return formatdict['numpystr']
<add>
<add>def _array2string(a, max_line_width, precision, suppress_small, separator=' ',
<add> prefix="", formatter=None):
<add>
<add> if max_line_width is None:
<add> max_line_width = _line_width
<add>
<add> if precision is None:
<add> precision = _float_output_precision
<add>
<add> if suppress_small is None:
<add> suppress_small = _float_output_suppress_small
<add>
<add> if formatter is None:
<add> formatter = _formatter
<add>
<add> if a.size > _summaryThreshold:
<add> summary_insert = "..., "
<add> data = _leading_trailing(a)
<add> else:
<add> summary_insert = ""
<add> data = ravel(asarray(a))
<add>
<add> # find the right formatting function for the array
<add> format_function = _get_format_function(data, precision,
<add> suppress_small, formatter)
<ide>
<ide> # skip over "["
<ide> next_line_prefix = " "
<ide> def __call__(self, x):
<ide> return self._nat
<ide> else:
<ide> return self.format % x.astype('i8')
<add>
<add>
<add>class StructureFormat(object):
<add> def __init__(self, format_functions):
<add> self.format_functions = format_functions
<add> self.num_fields = len(format_functions)
<add>
<add> def __call__(self, x):
<add> s = "("
<add> for field, format_function in zip(x, self.format_functions):
<add> s += format_function(field) + ", "
<add> return (s[:-2] if 1 < self.num_fields else s[:-1]) + ")"
<ide><path>numpy/core/tests/test_arrayprint.py
<ide> def _format_function(x):
<ide> assert_(np.array2string(s, formatter={'numpystr':lambda s: s*2}) ==
<ide> '[abcabc defdef]')
<ide>
<add> def test_structure_format(self):
<add> dt = np.dtype([('name', np.str_, 16), ('grades', np.float64, (2,))])
<add> x = np.array([('Sarah', (8.0, 7.0)), ('John', (6.0, 7.0))], dtype=dt)
<add> assert_equal(np.array2string(x),
<add> "[('Sarah', array([ 8., 7.])) ('John', array([ 6., 7.]))]")
<add>
<add> # for issue #5692
<add> A = np.zeros(shape=10, dtype=[("A", "M8[s]")])
<add> A[5:].fill(np.nan)
<add> assert_equal(np.array2string(A),
<add> "[('1970-01-01T00:00:00',) ('1970-01-01T00:00:00',) " +
<add> "('1970-01-01T00:00:00',)\n ('1970-01-01T00:00:00',) " +
<add> "('1970-01-01T00:00:00',) ('NaT',) ('NaT',)\n " +
<add> "('NaT',) ('NaT',) ('NaT',)]")
<add>
<ide>
<ide> class TestPrintOptions:
<ide> """Test getting and setting global print options.""" | 2 |
Ruby | Ruby | use jenkins env, add step.passed? | fafa62d1d2a2bb517263f89beff9f57fa35a9753 | <ide><path>Library/Contributions/cmd/brew-test-bot.rb
<ide> def status_upcase
<ide> @status.to_s.upcase
<ide> end
<ide>
<add> def passed?
<add> @status == :passed
<add> end
<add>
<ide> def failed?
<ide> @status == :failed
<ide> end
<ide> def current_branch
<ide> @category = __method__
<ide> @start_branch = current_branch
<ide>
<del> if @hash or @url
<add> # Use Jenkins environment variables if present.
<add> if ENV['GIT_PREVIOUS_COMMIT'] and ENV['GIT_COMMIT']
<add> diff_start_sha1 = ENV['GIT_PREVIOUS_COMMIT']
<add> diff_end_sha1 = ENV['GIT_COMMIT']
<add> test "brew update" if current_branch == "master"
<add> elsif @hash or @url
<ide> diff_start_sha1 = current_sha1
<ide> test "brew update" if current_branch == "master"
<ide> diff_end_sha1 = current_sha1
<ide> def current_branch
<ide> FileUtils.mkdir_p @log_root
<ide>
<ide> return unless diff_start_sha1 != diff_end_sha1
<del> return if @url and steps.last.status != :passed
<add> return if @url and not steps.last.passed?
<ide>
<ide> diff_stat = git "diff #{diff_start_sha1}..#{diff_end_sha1} --name-status"
<ide> diff_stat.each_line do |line|
<ide> def formula formula
<ide> test "brew fetch --build-bottle #{formula}"
<ide> test "brew install --verbose #{dependencies}" unless dependencies.empty?
<ide> test "brew install --verbose --build-bottle #{formula}"
<del> return unless steps.last.status == :passed
<add> return unless steps.last.passed?
<ide> test "brew bottle #{formula}", true
<ide> bottle_revision = bottle_new_revision(formula_object)
<ide> bottle_filename = bottle_filename(formula_object, bottle_revision) | 1 |
Text | Text | add changlog entry for | 28b4ffc37917f0552ef6537a15511b37b320d156 | <ide><path>actionpack/CHANGELOG.md
<add>* Fix `ActionDispatch::RemoteIp::GetIp#calculate_ip` to only check for spoofing
<add> attacks if both `HTTP_CLIENT_IP` and `HTTP_X_FORWARDED_FOR` are set.
<add>
<add> Fixes #10844
<add>
<add> *Tamir Duberstein*
<add>
<ide> * Strong parameters should permit nested number as key.
<ide>
<ide> Fixes #12293 | 1 |
Text | Text | shorten template instructions | 28bb1960a40fea21494f9cc707b19901962a1561 | <ide><path>.github/PULL_REQUEST_TEMPLATE.md
<del>Thanks for submitting a pull request! Please provide enough information so that others can review your pull request:
<add>Thanks for submitting a PR! Please read these instructions carefully:
<ide>
<del>> **Unless you are a React Native release maintainer and cherry-picking an *existing* commit into a current release, ensure your pull request is targeting the `master` React Native branch.**
<add>- [ ] Explain the **motivation** for making this change.
<add>- [ ] Provide a **test plan** demonstrating that the code is solid.
<add>- [ ] Match the **code formatting** of the rest of the codebase.
<add>- [ ] Target the `master` branch, NOT a "stable" branch.
<ide>
<del>Explain the **motivation** for making this change. What existing problem does the pull request solve?
<add>## Motivation (required)
<ide>
<del>Prefer **small pull requests**. These are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it.
<add>What existing problem does the pull request solve?
<ide>
<del>**Test plan (required)**
<add>## Test Plan (required)
<ide>
<del>Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI.
<add>A good test plan has the exact commands you ran and their output, provides screenshots or videos if the pull request changes UI or updates the website. See [What is a Test Plan?][1] to learn more.
<ide>
<del>Make sure tests pass on both Travis and Circle CI.
<add>If you have added code that should be tested, add tests.
<ide>
<del>**Code formatting**
<add>## Next Steps
<ide>
<del>Look around. Match the style of the rest of the codebase. See also the simple [style guide](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#style-guide).
<add>Sign the [CLA][2], if you haven't already.
<ide>
<del>For more info, see the ["Pull Requests" section of our "Contributing" guidelines](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#pull-requests).
<add>Small pull requests are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it.
<add>
<add>Make sure all **tests pass** on both [Travis][3] and [Circle CI][4]. PRs that break tests are unlikely to be merged.
<add>
<add>For more info, see the ["Pull Requests"][5] section of our "Contributing" guidelines.
<add>
<add>[1]: https://medium.com/@martinkonicek/what-is-a-test-plan-8bfc840ec171#.y9lcuqqi9
<add>[2]: https://code.facebook.com/cla
<add>[3]: https://travis-ci.org/facebook/react-native
<add>[4]: http://circleci.com/gh/facebook/react-native
<add>[5]: https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#pull-requests
<ide><path>CONTRIBUTING.md
<ide> We will do our best to keep `master` in good shape, with tests passing at all ti
<ide>
<ide> The core team will be monitoring for pull requests. When we get one, we'll run some Facebook-specific integration tests on it first. From here, we'll need to get another person to sign off on the changes and then merge the pull request. For API changes we may need to fix internal uses, which could cause some delay. We'll do our best to provide updates and feedback throughout the process.
<ide>
<del>**Please submit your pull request on the `master` branch**. If the fix is critical and should be included in a stable branch please mention it and it will be cherry picked into it.
<add>**Please submit your pull request on the `master` branch**. If the fix is critical and should be included in a stable branch please mention it and it will be cherry picked into it by a project maintainer.
<ide>
<ide> *Before* submitting a pull request, please make sure the following is done…
<ide>
<ide> 1. Fork the repo and create your branch from `master`.
<del>2. **Describe your test plan in your commit.** If you've added code that should be tested, add tests!
<del>3. If you've changed APIs, update the documentation.
<del>4. If you've updated the docs, verify the website locally and submit screenshots if applicable.
<del>
<del> ```
<del> $ cd website
<del> $ npm install && npm start
<del> go to: http://localhost:8079/react-native/index.html
<del> ```
<del>
<del>5. Add the copyright notice to the top of any new files you've added.
<del>6. Ensure tests pass on Travis and Circle CI.
<del>7. Make sure your code lints (`node linter.js <files touched>`).
<del>8. If you haven't already, sign the [CLA](https://code.facebook.com/cla).
<del>9. Squash your commits (`git rebase -i`).
<del> one intent alongs with one commit makes it clearer for people to review and easier to understand your intention
<del>
<del>Note: It is not necessary to keep clicking `Merge master to your branch` on PR page. You would want to merge master if there are conflicts or tests are failing. The facebook-bot ultimately squashes all commits to a single one before merging your PR.
<add>2. **Describe your test plan in your commit.**
<add> - If you've added code that should be tested, add tests!
<add> - If you've changed APIs, update the documentation.
<add> - If you've updated the docs, verify the website locally and submit screenshots if applicable.
<add>
<add> ```
<add> $ cd website
<add> $ npm install && npm start
<add> Open the following in your browser: http://localhost:8079/react-native/index.html
<add> ```
<add>
<add>3. Add the copyright notice to the top of any new files you've added.
<add>4. Ensure tests pass on Travis and Circle CI.
<add>5. Make sure your code lints (`node linter.js <files touched>`).
<add>6. If you haven't already, sign the [CLA](https://code.facebook.com/cla).
<add>7. Squash your commits (`git rebase -i`).
<add> One intent alongside one commit makes it clearer for people to review and easier to understand your intention.
<add>
<add>> **Note:** It is not necessary to keep clicking `Merge master to your branch` on the PR page. You would want to merge master if there are conflicts or tests are failing. The Facebook-GitHub-Bot ultimately squashes all commits to a single one before merging your PR.
<ide>
<ide> #### Copyright Notice for files
<ide>
<ide> Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe
<ide>
<ide> ## How to Get in Touch
<ide>
<del>* [Facebook group](https://www.facebook.com/groups/react.native.community/)
<del>* Reactiflux — [#react-native](http://join.reactiflux.com/)
<add>* [Facebook](https://www.facebook.com/groups/react.native.community/)
<add>* [Twitter](https://www.twitter.com/reactnative)
<ide>
<ide> ## Style Guide
<ide> | 2 |
Java | Java | introduce routerfunction visitor | 2841ef5d05a1070e517c5c2b03f6e9ee60983b0f | <ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/function/server/PathResourceLookupFunction.java
<ide> else if (resource instanceof ClassPathResource) {
<ide> return true;
<ide> }
<ide>
<add> @Override
<add> public String toString() {
<add> return String.format("%s -> %s", this.pattern, this.location);
<add> }
<ide> }
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/function/server/RouterFunction.java
<ide> * @see #andOther(RouterFunction)
<ide> */
<ide> default RouterFunction<T> and(RouterFunction<T> other) {
<del> return request -> this.route(request)
<del> .switchIfEmpty(Mono.defer(() -> other.route(request)));
<add> return new RouterFunctions.SameComposedRouterFunction<>(this, other);
<ide> }
<ide>
<ide> /**
<ide> default RouterFunction<T> and(RouterFunction<T> other) {
<ide> * @see #and(RouterFunction)
<ide> */
<ide> default RouterFunction<?> andOther(RouterFunction<?> other) {
<del> return request -> this.route(request)
<del> .map(RouterFunctions::cast)
<del> .switchIfEmpty(
<del> Mono.defer(() -> other.route(request).map(RouterFunctions::cast)));
<add> return new RouterFunctions.DifferentComposedRouterFunction(this, other);
<ide> }
<ide>
<ide> /**
<ide> default RouterFunction<T> andNest(RequestPredicate predicate, RouterFunction<T>
<ide> * @return the filtered routing function
<ide> */
<ide> default <S extends ServerResponse> RouterFunction<S> filter(HandlerFilterFunction<T, S> filterFunction) {
<del> return request -> this.route(request).map(filterFunction::apply);
<add> return new RouterFunctions.FilteredRouterFunction<>(this, filterFunction);
<add> }
<add>
<add> /**
<add> * Accept the given visitor. Default implementation calls
<add> * {@link RouterFunctions.Visitor#unknown(RouterFunction)}; composed {@code RouterFunction}
<add> * implementations are expected to call {@code accept} for all components that make up this
<add> * router function
<add> * @param visitor the visitor to accept
<add> */
<add> default void accept(RouterFunctions.Visitor visitor) {
<add> visitor.unknown(this);
<ide> }
<ide>
<ide> }
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/function/server/RouterFunctions.java
<ide> public static RouterFunction<ServerResponse> resources(String pattern, Resource
<ide> */
<ide> public static RouterFunction<ServerResponse> resources(Function<ServerRequest, Mono<Resource>> lookupFunction) {
<ide> Assert.notNull(lookupFunction, "'lookupFunction' must not be null");
<del> return request -> lookupFunction.apply(request).map(ResourceHandlerFunction::new);
<add> return new ResourcesRouterFunction(lookupFunction);
<ide> }
<ide>
<ide> /**
<ide> static <T extends ServerResponse> HandlerFunction<T> cast(HandlerFunction<?> han
<ide> return (HandlerFunction<T>) handlerFunction;
<ide> }
<ide>
<del> private static class DefaultRouterFunction<T extends ServerResponse>
<del> implements RouterFunction<T> {
<add>
<add> /**
<add> * Receives notifications from the logical structure of router functions.
<add> */
<add> public interface Visitor {
<add>
<add> /**
<add> * Receive notification of the beginning of a nested router function.
<add> * @param predicate the predicate that applies to the nested router functions
<add> * @see RouterFunctions#nest(RequestPredicate, RouterFunction)
<add> */
<add> void startNested(RequestPredicate predicate);
<add>
<add> /**
<add> * Receive notification of the end of a nested router function.
<add> * @param predicate the predicate that applies to the nested router functions
<add> * @see RouterFunctions#nest(RequestPredicate, RouterFunction)
<add> */
<add> void endNested(RequestPredicate predicate);
<add>
<add> /**
<add> * Receive notification of a standard predicated route to a handler function.
<add> * @param predicate the predicate that applies to the handler function
<add> * @param handlerFunction the handler function.
<add> * @see RouterFunctions#route(RequestPredicate, HandlerFunction)
<add> */
<add> void route(RequestPredicate predicate, HandlerFunction<?> handlerFunction);
<add>
<add> /**
<add> * Receive notification of a resource router function.
<add> * @param lookupFunction the lookup function for the resources
<add> * @see RouterFunctions#resources(Function)
<add> */
<add> void resources(Function<ServerRequest, Mono<Resource>> lookupFunction);
<add>
<add> /**
<add> * Receive notification of an unknown router function. This method is called for router
<add> * functions that were not created via the various {@link RouterFunctions} methods.
<add> * @param routerFunction the router function
<add> */
<add> void unknown(RouterFunction<?> routerFunction);
<add> }
<add>
<add>
<add> private static abstract class AbstractRouterFunction<T extends ServerResponse> implements RouterFunction<T> {
<add>
<add> @Override
<add> public String toString() {
<add> ToStringVisitor visitor = new ToStringVisitor();
<add> accept(visitor);
<add> return visitor.toString();
<add> }
<add> }
<add>
<add> final static class SameComposedRouterFunction<T extends ServerResponse> extends AbstractRouterFunction<T> {
<add>
<add> private final RouterFunction<T> first;
<add>
<add> private final RouterFunction<T> second;
<add>
<add> public SameComposedRouterFunction(RouterFunction<T> first, RouterFunction<T> second) {
<add> this.first = first;
<add> this.second = second;
<add> }
<add>
<add> @Override
<add> public Mono<HandlerFunction<T>> route(ServerRequest request) {
<add> return this.first.route(request)
<add> .switchIfEmpty(Mono.defer(() -> this.second.route(request)));
<add> }
<add>
<add> @Override
<add> public void accept(Visitor visitor) {
<add> this.first.accept(visitor);
<add> this.second.accept(visitor);
<add> }
<add> }
<add>
<add> final static class DifferentComposedRouterFunction extends AbstractRouterFunction<ServerResponse> {
<add>
<add> private final RouterFunction<?> first;
<add>
<add> private final RouterFunction<?> second;
<add>
<add> public DifferentComposedRouterFunction(RouterFunction<?> first, RouterFunction<?> second) {
<add> this.first = first;
<add> this.second = second;
<add> }
<add>
<add> @Override
<add> public Mono<HandlerFunction<ServerResponse>> route(ServerRequest request) {
<add> return this.first.route(request)
<add> .map(RouterFunctions::cast)
<add> .switchIfEmpty(Mono.defer(() -> this.second.route(request).map(RouterFunctions::cast)));
<add> }
<add>
<add> @Override
<add> public void accept(Visitor visitor) {
<add> this.first.accept(visitor);
<add> this.second.accept(visitor);
<add> }
<add>
<add> }
<add>
<add> final static class FilteredRouterFunction<T extends ServerResponse, S extends ServerResponse>
<add> implements RouterFunction<S> {
<add>
<add> private final RouterFunction<T> routerFunction;
<add>
<add> private final HandlerFilterFunction<T, S> filterFunction;
<add>
<add> public FilteredRouterFunction(
<add> RouterFunction<T> routerFunction,
<add> HandlerFilterFunction<T, S> filterFunction) {
<add> this.routerFunction = routerFunction;
<add> this.filterFunction = filterFunction;
<add> }
<add>
<add> @Override
<add> public Mono<HandlerFunction<S>> route(ServerRequest request) {
<add> return this.routerFunction.route(request).map(this.filterFunction::apply);
<add> }
<add>
<add> @Override
<add> public void accept(Visitor visitor) {
<add> this.routerFunction.accept(visitor);
<add> }
<add>
<add> }
<add>
<add> private static final class DefaultRouterFunction<T extends ServerResponse>
<add> extends AbstractRouterFunction<T> {
<ide>
<ide> private final RequestPredicate predicate;
<ide>
<ide> public Mono<HandlerFunction<T>> route(ServerRequest request) {
<ide> }
<ide>
<ide> @Override
<del> public String toString() {
<del> return String.format("%s -> %s", this.predicate, this.handlerFunction);
<add> public void accept(Visitor visitor) {
<add> visitor.route(this.predicate, this.handlerFunction);
<ide> }
<add>
<ide> }
<ide>
<del> private static class DefaultNestedRouterFunction<T extends ServerResponse>
<del> implements RouterFunction<T> {
<add> private static final class DefaultNestedRouterFunction<T extends ServerResponse>
<add> extends AbstractRouterFunction<T> {
<ide>
<ide> private final RequestPredicate predicate;
<ide>
<ide> public Mono<HandlerFunction<T>> route(ServerRequest serverRequest) {
<ide> }
<ide>
<ide> @Override
<del> public String toString() {
<del> return String.format("%s -> %s", this.predicate, this.routerFunction);
<add> public void accept(Visitor visitor) {
<add> visitor.startNested(this.predicate);
<add> this.routerFunction.accept(visitor);
<add> visitor.endNested(this.predicate);
<ide> }
<ide>
<ide> }
<ide>
<add> private static class ResourcesRouterFunction extends AbstractRouterFunction<ServerResponse> {
<add>
<add> private final Function<ServerRequest, Mono<Resource>> lookupFunction;
<add>
<add> public ResourcesRouterFunction(Function<ServerRequest, Mono<Resource>> lookupFunction) {
<add> this.lookupFunction = lookupFunction;
<add> }
<add>
<add> @Override
<add> public Mono<HandlerFunction<ServerResponse>> route(ServerRequest request) {
<add> return this.lookupFunction.apply(request).map(ResourceHandlerFunction::new);
<add> }
<add>
<add> @Override
<add> public void accept(Visitor visitor) {
<add> visitor.resources(this.lookupFunction);
<add> }
<add> }
<add>
<ide> private static class HandlerStrategiesResponseContext implements ServerResponse.Context {
<ide>
<ide> private final HandlerStrategies strategies;
<ide> public List<ViewResolver> viewResolvers() {
<ide> return this.strategies.viewResolvers();
<ide> }
<ide> }
<add>
<ide> }
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/function/server/ToStringVisitor.java
<add>/*
<add> * Copyright 2002-2017 the original author or authors.
<add> *
<add> * Licensed under the Apache License, Version 2.0 (the "License");
<add> * you may not use this file except in compliance with the License.
<add> * You may obtain a copy of the License at
<add> *
<add> * http://www.apache.org/licenses/LICENSE-2.0
<add> *
<add> * Unless required by applicable law or agreed to in writing, software
<add> * distributed under the License is distributed on an "AS IS" BASIS,
<add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<add> * See the License for the specific language governing permissions and
<add> * limitations under the License.
<add> */
<add>
<add>package org.springframework.web.reactive.function.server;
<add>
<add>import java.util.function.Function;
<add>
<add>import reactor.core.publisher.Mono;
<add>
<add>import org.springframework.core.io.Resource;
<add>
<add>/**
<add> * Implementation of {@link RouterFunctions.Visitor} that creates a
<add> * @author Arjen Poutsma
<add> * @since 5.0
<add> */
<add>class ToStringVisitor implements RouterFunctions.Visitor {
<add>
<add> private static final String NEW_LINE = System.getProperty("line.separator", "\\n");
<add>
<add> private final StringBuilder builder = new StringBuilder();
<add>
<add> private int indent = 0;
<add>
<add> @Override
<add> public void startNested(RequestPredicate predicate) {
<add> indent();
<add> this.builder.append(predicate);
<add> this.builder.append(" => {");
<add> this.builder.append(NEW_LINE);
<add> this.indent++;
<add> }
<add>
<add> @Override
<add> public void endNested(RequestPredicate predicate) {
<add> this.indent--;
<add> indent();
<add> this.builder.append('}');
<add> this.builder.append(NEW_LINE);
<add> }
<add>
<add> @Override
<add> public void route(RequestPredicate predicate, HandlerFunction<?> handlerFunction) {
<add> indent();
<add> this.builder.append(predicate);
<add> this.builder.append(" -> ");
<add> this.builder.append(handlerFunction);
<add> this.builder.append(NEW_LINE);
<add> }
<add>
<add> @Override
<add> public void resources(Function<ServerRequest, Mono<Resource>> lookupFunction) {
<add> indent();
<add> this.builder.append(lookupFunction);
<add> this.builder.append(NEW_LINE);
<add> }
<add>
<add> @Override
<add> public void unknown(RouterFunction<?> routerFunction) {
<add> indent();
<add> this.builder.append(routerFunction);
<add> }
<add>
<add> private void indent() {
<add> for (int i=0; i < this.indent; i++) {
<add> this.builder.append(' ');
<add> }
<add> }
<add>
<add> @Override
<add> public String toString() {
<add> String result = this.builder.toString();
<add> if (result.endsWith(NEW_LINE)) {
<add> result = result.substring(0, result.length() - NEW_LINE.length());
<add> }
<add> return result;
<add> }
<add>}
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/function/server/support/RouterFunctionMapping.java
<ide> protected void initRouterFunctions() {
<ide>
<ide> List<RouterFunction<?>> routerFunctions = routerFunctions();
<ide> if (!CollectionUtils.isEmpty(routerFunctions) && logger.isInfoEnabled()) {
<del> routerFunctions.forEach(routerFunction1 -> {
<del> logger.info("Mapped " + routerFunction1);
<add> routerFunctions.forEach(routerFunction -> {
<add> logger.info("Mapped " + routerFunction);
<ide> });
<ide> }
<ide> this.routerFunction = routerFunctions.stream() | 5 |
Ruby | Ruby | fix random ci fail due to cross-second time delay | fa2584fc2b11284c45d66a1764b455ed99c65d73 | <ide><path>activejob/lib/active_job/test_helper.rb
<ide> def flush_enqueued_jobs(only: nil, except: nil, queue: nil, at: nil)
<ide>
<ide> def prepare_args_for_assertion(args)
<ide> args.dup.tap do |arguments|
<del> arguments[:at] = round_time_arguments(arguments[:at]) if arguments[:at]
<add> if arguments[:at]
<add> at_range = arguments[:at] - 1..arguments[:at] + 1
<add> arguments[:at] = ->(at) { at_range.cover?(at) }
<add> end
<ide> arguments[:args] = round_time_arguments(arguments[:args]) if arguments[:args]
<ide> end
<ide> end
<ide> def round_time_arguments(argument)
<ide>
<ide> def deserialize_args_for_assertion(job)
<ide> job.dup.tap do |new_job|
<del> new_job[:at] = round_time_arguments(Time.at(new_job[:at])) if new_job[:at]
<add> new_job[:at] = Time.at(new_job[:at]) if new_job[:at]
<ide> new_job[:args] = ActiveJob::Arguments.deserialize(new_job[:args]) if new_job[:args]
<ide> end
<ide> end | 1 |
Javascript | Javascript | preserve symlinks when requiring | de1dc0ae2eb52842b5c5c974090123a64c3a594c | <ide><path>lib/module.js
<ide> function readPackage(requestPath) {
<ide> return pkg;
<ide> }
<ide>
<del>function tryPackage(requestPath, exts) {
<add>function tryPackage(requestPath, exts, isMain) {
<ide> var pkg = readPackage(requestPath);
<ide>
<ide> if (!pkg) return false;
<ide>
<ide> var filename = path.resolve(requestPath, pkg);
<del> return tryFile(filename) ||
<del> tryExtensions(filename, exts) ||
<del> tryExtensions(path.resolve(filename, 'index'), exts);
<add> return tryFile(filename, isMain) ||
<add> tryExtensions(filename, exts, isMain) ||
<add> tryExtensions(path.resolve(filename, 'index'), exts, isMain);
<ide> }
<ide>
<ide> // check if the file exists and is not a directory
<del>function tryFile(requestPath) {
<add>// resolve to the absolute realpath if running main module,
<add>// otherwise resolve to absolute while keeping symlinks intact.
<add>function tryFile(requestPath, isMain) {
<ide> const rc = stat(requestPath);
<del> return rc === 0 && fs.realpathSync(requestPath);
<add> if (isMain) {
<add> return rc === 0 && fs.realpathSync(requestPath);
<add> }
<add> return rc === 0 && path.resolve(requestPath);
<ide> }
<ide>
<ide> // given a path check a the file exists with any of the set extensions
<del>function tryExtensions(p, exts) {
<add>function tryExtensions(p, exts, isMain) {
<ide> for (var i = 0; i < exts.length; i++) {
<del> const filename = tryFile(p + exts[i]);
<add> const filename = tryFile(p + exts[i], isMain);
<ide>
<ide> if (filename) {
<ide> return filename;
<ide> function tryExtensions(p, exts) {
<ide> }
<ide>
<ide> var warned = false;
<del>Module._findPath = function(request, paths) {
<add>Module._findPath = function(request, paths, isMain) {
<ide> if (path.isAbsolute(request)) {
<ide> paths = [''];
<ide> } else if (!paths || paths.length === 0) {
<ide> Module._findPath = function(request, paths) {
<ide> if (!trailingSlash) {
<ide> const rc = stat(basePath);
<ide> if (rc === 0) { // File.
<del> filename = fs.realpathSync(basePath);
<add> if (!isMain) {
<add> filename = path.resolve(basePath);
<add> } else {
<add> filename = fs.realpathSync(basePath);
<add> }
<ide> } else if (rc === 1) { // Directory.
<ide> if (exts === undefined)
<ide> exts = Object.keys(Module._extensions);
<del> filename = tryPackage(basePath, exts);
<add> filename = tryPackage(basePath, exts, isMain);
<ide> }
<ide>
<ide> if (!filename) {
<ide> // try it with each of the extensions
<ide> if (exts === undefined)
<ide> exts = Object.keys(Module._extensions);
<del> filename = tryExtensions(basePath, exts);
<add> filename = tryExtensions(basePath, exts, isMain);
<ide> }
<ide> }
<ide>
<ide> if (!filename) {
<ide> if (exts === undefined)
<ide> exts = Object.keys(Module._extensions);
<del> filename = tryPackage(basePath, exts);
<add> filename = tryPackage(basePath, exts, isMain);
<ide> }
<ide>
<ide> if (!filename) {
<ide> // try it with each of the extensions at "index"
<ide> if (exts === undefined)
<ide> exts = Object.keys(Module._extensions);
<del> filename = tryExtensions(path.resolve(basePath, 'index'), exts);
<add> filename = tryExtensions(path.resolve(basePath, 'index'), exts, isMain);
<ide> }
<ide>
<ide> if (filename) {
<ide> Module._load = function(request, parent, isMain) {
<ide> debug('Module._load REQUEST %s parent: %s', request, parent.id);
<ide> }
<ide>
<del> var filename = Module._resolveFilename(request, parent);
<add> var filename = Module._resolveFilename(request, parent, isMain);
<ide>
<ide> var cachedModule = Module._cache[filename];
<ide> if (cachedModule) {
<ide> function tryModuleLoad(module, filename) {
<ide> }
<ide> }
<ide>
<del>Module._resolveFilename = function(request, parent) {
<add>Module._resolveFilename = function(request, parent, isMain) {
<ide> if (NativeModule.nonInternalExists(request)) {
<ide> return request;
<ide> }
<ide> Module._resolveFilename = function(request, parent) {
<ide> // look up the filename first, since that's the cache key.
<ide> debug('looking for %j in %j', id, paths);
<ide>
<del> var filename = Module._findPath(request, paths);
<add> var filename = Module._findPath(request, paths, isMain);
<ide> if (!filename) {
<ide> var err = new Error("Cannot find module '" + request + "'");
<ide> err.code = 'MODULE_NOT_FOUND';
<ide><path>test/fixtures/module-require-symlink/foo.js
<add>exports.dep1 = require('dep1');
<add>exports.dep2 = exports.dep1.dep2;
<ide><path>test/fixtures/module-require-symlink/node_modules/bar/index.js
<add>exports.version = 'INCORRECT_VERSION';
<ide><path>test/fixtures/module-require-symlink/node_modules/dep1/index.js
<add>exports.bar = require('bar');
<add>exports.dep2 = require('dep2');
<ide><path>test/fixtures/module-require-symlink/node_modules/dep1/node_modules/bar/index.js
<add>exports.version = 'CORRECT_VERSION';
<ide><path>test/fixtures/module-require-symlink/node_modules/dep2/index.js
<add>exports.bar = require('bar');
<ide><path>test/fixtures/module-require-symlink/symlinked.js
<add>'use strict';
<add>const assert = require('assert');
<add>const common = require('../../common');
<add>const path = require('path');
<add>
<add>const linkScriptTarget = path.join(common.fixturesDir,
<add> '/module-require-symlink/symlinked.js');
<add>
<add>var foo = require('./foo');
<add>assert.equal(foo.dep1.bar.version, 'CORRECT_VERSION');
<add>assert.equal(foo.dep2.bar.version, 'CORRECT_VERSION');
<add>assert.equal(__filename, linkScriptTarget);
<add>assert(__filename in require.cache);
<ide><path>test/parallel/test-require-symlink.js
<add>'use strict';
<add>const common = require('../common');
<add>const assert = require('assert');
<add>const path = require('path');
<add>const fs = require('fs');
<add>const exec = require('child_process').exec;
<add>const spawn = require('child_process').spawn;
<add>
<add>const linkTarget = path.join(common.fixturesDir,
<add> '/module-require-symlink/node_modules/dep2/');
<add>
<add>const linkDir = path.join(common.fixturesDir,
<add> '/module-require-symlink/node_modules/dep1/node_modules/dep2');
<add>
<add>const linkScriptTarget = path.join(common.fixturesDir,
<add> '/module-require-symlink/symlinked.js');
<add>
<add>const linkScript = path.join(common.tmpDir, 'module-require-symlink.js');
<add>
<add>if (common.isWindows) {
<add> // On Windows, creating symlinks requires admin privileges.
<add> // We'll only try to run symlink test if we have enough privileges.
<add> exec('whoami /priv', function(err, o) {
<add> if (err || o.indexOf('SeCreateSymbolicLinkPrivilege') == -1) {
<add> console.log('Skipped: insufficient privileges');
<add> return;
<add> } else {
<add> test();
<add> }
<add> });
<add>} else {
<add> test();
<add>}
<add>
<add>function test() {
<add> process.on('exit', function() {
<add> fs.unlinkSync(linkDir);
<add> fs.unlinkSync(linkScript);
<add> });
<add>
<add> fs.symlinkSync(linkTarget, linkDir);
<add> fs.symlinkSync(linkScriptTarget, linkScript);
<add>
<add> // load symlinked-module
<add> var fooModule =
<add> require(path.join(common.fixturesDir, '/module-require-symlink/foo.js'));
<add> assert.equal(fooModule.dep1.bar.version, 'CORRECT_VERSION');
<add> assert.equal(fooModule.dep2.bar.version, 'CORRECT_VERSION');
<add>
<add> // load symlinked-script as main
<add> var node = process.execPath;
<add> var child = spawn(node, [linkScript]);
<add> child.on('close', function(code, signal) {
<add> assert(!code);
<add> assert(!signal);
<add> });
<add>} | 8 |
Javascript | Javascript | use indices instead of indicies | 78cd472c68b039a653eecda94cad00e8e3ee687f | <ide><path>lib/buildChunkGraph.js
<ide> const visitModules = (
<ide> const blockModules = blockModulesMap.get(block);
<ide>
<ide> if (blockModules !== undefined) {
<del> // Buffer items because order need to be reverse to get indicies correct
<add> // Buffer items because order need to be reverse to get indices correct
<ide> const skipBuffer = [];
<ide> const queueBuffer = [];
<ide> // Traverse all referenced modules | 1 |
Javascript | Javascript | remove useless getlibuvnow in internal/timers | 22f5c0892b2e78ccd5173df603e54cdca3b27eec | <ide><path>lib/internal/timers.js
<ide> module.exports = {
<ide> kRefed,
<ide> initAsyncResource,
<ide> setUnrefTimeout,
<del> validateTimerDuration,
<del> getLibuvNow: internalBinding('timers').getLibuvNow,
<add> validateTimerDuration
<ide> };
<ide>
<ide> var timers;
<ide><path>test/parallel/test-timers-now.js
<ide>
<ide> require('../common');
<ide> const assert = require('assert');
<del>const { getLibuvNow } = require('internal/timers');
<add>const { internalBinding } = require('internal/test/binding');
<add>const { getLibuvNow } = internalBinding('timers');
<ide>
<ide> // Return value of getLibuvNow() should easily fit in a SMI after start-up.
<ide> assert(getLibuvNow() < 0x3ffffff);
<ide><path>test/parallel/test-timers-ordering.js
<ide> 'use strict';
<ide> require('../common');
<ide> const assert = require('assert');
<del>const { getLibuvNow } = require('internal/timers');
<add>const { internalBinding } = require('internal/test/binding');
<add>const { getLibuvNow } = internalBinding('timers');
<ide>
<ide> const N = 30;
<ide> | 3 |
Python | Python | update paddle example | d75fe7c19a0b8fb8c86efbd02743eb653afe043f | <ide><path>examples/paddle/sentiment_bilstm/__main__.py
<del>def write_parameter(outfile, feats):
<del> """
<del> From https://github.com/baidu/Paddle/issues/490
<del>
<del> outfile: Output file name with string type. **Note**, it should be the same as it in the above config.
<del> feats: Parameter with float type.
<del> """
<del> version = 0
<del> value_size = 4; # means float type
<del> ret = b""
<del> for feat in feats:
<del> ret += feat.tostring()
<del> size = len(ret) / 4
<del> fo = open(outfile, 'wb')
<del> fo.write(struct.pack('iIQ', version, value_size, size))
<del> fo.write(ret)
<del>
<del>
<del># config=trainer_config.py
<del># output=./model_output
<del># paddle train --config=$config \
<del># --save_dir=$output \
<del># --job=train \
<del># --use_gpu=false \
<del># --trainer_count=4 \
<del># --num_passes=10 \
<del># --log_period=20 \
<del># --dot_period=20 \
<del># --show_parameter_stats_period=100 \
<del># --test_all_data_in_one_period=1 \
<del># 2>&1 | tee 'train.log'
<ide><path>examples/paddle/sentiment_bilstm/dataprovider.py
<ide> from paddle.trainer.PyDataProvider2 import *
<ide> from itertools import izip
<add>import spacy
<ide>
<ide>
<ide> def get_features(doc):
<ide> def read_data(data_dir):
<ide> yield text, label
<ide>
<ide>
<del>def on_init(settings, lang_name, **kwargs):
<add>def on_init(settings, **kwargs):
<ide> print("Loading spaCy")
<ide> nlp = spacy.load('en', entity=False)
<ide> vectors = get_vectors(nlp)
<ide> def on_init(settings, lang_name, **kwargs):
<ide> ]
<ide> settings.nlp = nlp
<ide> settings.vectors = vectors
<add> settings['batch_size'] = 32
<ide>
<ide>
<ide> @provider(init_hook=on_init) | 2 |
Ruby | Ruby | fix capture_stderr style | 14099ffaf3016f126ad95c869ac5dbecf5837eee | <ide><path>Library/Homebrew/utils.rb
<ide> def ignore_interrupts(opt = nil)
<ide> end
<ide>
<ide> def capture_stderr
<del> old, $stderr = $stderr, StringIO.new
<add> old = $stderr
<add> $stderr = StringIO.new
<ide> yield
<ide> $stderr.string
<ide> ensure | 1 |
PHP | PHP | add http method short-forms | 2737d174631509843df98eb59309f64a7a020d8c | <ide><path>src/Routing/RouteBuilder.php
<ide> public function resources($name, $options = [], $callback = null)
<ide> }
<ide> }
<ide>
<add> /**
<add> * Create a route that only responds to GET requests.
<add> *
<add> * @param string $template The URL template to use.
<add> * @param array $target An array describing the target route parameters. These parameters
<add> * should indicate the plugin, prefix, controller, and action that this route points to.
<add> * @param string $name The name of the route.
<add> * @return \Cake\Routing\Route\Route
<add> */
<add> public function get($template, $target, $name = null)
<add> {
<add> return $this->_methodRoute('GET', $template, $target, $name);
<add> }
<add>
<add> /**
<add> * Create a route that only responds to POST requests.
<add> *
<add> * @param string $template The URL template to use.
<add> * @param array $target An array describing the target route parameters. These parameters
<add> * should indicate the plugin, prefix, controller, and action that this route points to.
<add> * @param string $name The name of the route.
<add> * @return \Cake\Routing\Route\Route
<add> */
<add> public function post($template, $target, $name = null)
<add> {
<add> return $this->_methodRoute('POST', $template, $target, $name);
<add> }
<add>
<add> /**
<add> * Create a route that only responds to PUT requests.
<add> *
<add> * @param string $template The URL template to use.
<add> * @param array $target An array describing the target route parameters. These parameters
<add> * should indicate the plugin, prefix, controller, and action that this route points to.
<add> * @param string $name The name of the route.
<add> * @return \Cake\Routing\Route\Route
<add> */
<add> public function put($template, $target, $name = null)
<add> {
<add> return $this->_methodRoute('PUT', $template, $target, $name);
<add> }
<add>
<add> /**
<add> * Create a route that only responds to PATCH requests.
<add> *
<add> * @param string $template The URL template to use.
<add> * @param array $target An array describing the target route parameters. These parameters
<add> * should indicate the plugin, prefix, controller, and action that this route points to.
<add> * @param string $name The name of the route.
<add> * @return \Cake\Routing\Route\Route
<add> */
<add> public function patch($template, $target, $name = null)
<add> {
<add> return $this->_methodRoute('PATCH', $template, $target, $name);
<add> }
<add>
<add> /**
<add> * Create a route that only responds to DELETE requests.
<add> *
<add> * @param string $template The URL template to use.
<add> * @param array $target An array describing the target route parameters. These parameters
<add> * should indicate the plugin, prefix, controller, and action that this route points to.
<add> * @param string $name The name of the route.
<add> * @return \Cake\Routing\Route\Route
<add> */
<add> public function delete($template, $target, $name = null)
<add> {
<add> return $this->_methodRoute('DELETE', $template, $target, $name);
<add> }
<add>
<add> /**
<add> * Create a route that only responds to HEAD requests.
<add> *
<add> * @param string $template The URL template to use.
<add> * @param array $target An array describing the target route parameters. These parameters
<add> * should indicate the plugin, prefix, controller, and action that this route points to.
<add> * @param string $name The name of the route.
<add> * @return \Cake\Routing\Route\Route
<add> */
<add> public function head($template, $target, $name = null)
<add> {
<add> return $this->_methodRoute('HEAD', $template, $target, $name);
<add> }
<add>
<add> /**
<add> * Create a route that only responds to OPTIONS requests.
<add> *
<add> * @param string $template The URL template to use.
<add> * @param array $target An array describing the target route parameters. These parameters
<add> * should indicate the plugin, prefix, controller, and action that this route points to.
<add> * @param string $name The name of the route.
<add> * @return \Cake\Routing\Route\Route
<add> */
<add> public function options($template, $target, $name = null)
<add> {
<add> return $this->_methodRoute('OPTIONS', $template, $target, $name);
<add> }
<add>
<add> /**
<add> * Helper to create routes that only respond to a single HTTP method.
<add> *
<add> * @param string $template The URL template to use.
<add> * @param array $target An array describing the target route parameters. These parameters
<add> * should indicate the plugin, prefix, controller, and action that this route points to.
<add> * @param string $name The name of the route.
<add> * @return \Cake\Routing\Route\Route
<add> */
<add> protected function _methodRoute($method, $template, $target, $name)
<add> {
<add> if ($name !== null) {
<add> $name = $this->_namePrefix . $name;
<add> }
<add> $options = [
<add> '_method' => $method,
<add> '_ext' => $this->_extensions,
<add> 'routeClass' => $this->_routeClass,
<add> '_name' => $name,
<add> ];
<add>
<add> $route = $this->_makeRoute($template, $target, $options);
<add> $this->_collection->add($route, $options);
<add>
<add> return $route;
<add> }
<add>
<ide> /**
<ide> * Connects a new Route.
<ide> *
<ide> public function resources($name, $options = [], $callback = null)
<ide> * $options offers several 'special' keys that have special meaning
<ide> * in the $options array.
<ide> *
<del> * - `pass` is used to define which of the routed parameters should be shifted
<del> * into the pass array. Adding a parameter to pass will remove it from the
<del> * regular route array. Ex. `'pass' => ['slug']`.
<ide> * - `routeClass` is used to extend and change how individual routes parse requests
<ide> * and handle reverse routing, via a custom routing class.
<ide> * Ex. `'routeClass' => 'SlugRoute'`
<add> * - `pass` is used to define which of the routed parameters should be shifted
<add> * into the pass array. Adding a parameter to pass will remove it from the
<add> * regular route array. Ex. `'pass' => ['slug']`.
<ide> * - `persist` is used to define which route parameters should be automatically
<ide> * included when generating new URLs. You can override persistent parameters
<ide> * by redefining them in a URL or remove them by setting the parameter to `false`.
<ide> public function resources($name, $options = [], $callback = null)
<ide> * reverse routing lookups. If undefined a name will be generated for each
<ide> * connected route.
<ide> * - `_ext` is an array of filename extensions that will be parsed out of the url if present.
<del> * See {@link ScopedRouteCollection::extensions()}.
<add> * See {@link \Cake\Routing\RouteCollection::extensions()}.
<ide> * - `_method` Only match requests with specific HTTP verbs.
<ide> *
<ide> * Example of using the `_method` condition:
<ide><path>tests/TestCase/Routing/RouteBuilderTest.php
<ide> public function testApplyMiddleware()
<ide> $this->collection->getMatchingMiddleware('/api/v1/ping')
<ide> );
<ide> }
<add>
<add> /**
<add> * @return array
<add> */
<add> public static function httpMethodProvider()
<add> {
<add> return [
<add> ['GET'],
<add> ['POST'],
<add> ['PUT'],
<add> ['PATCH'],
<add> ['DELETE'],
<add> ['OPTIONS'],
<add> ['HEAD'],
<add> ];
<add> }
<add>
<add> /**
<add> * Test that the HTTP method helpers create the right kind of routes.
<add> *
<add> * @dataProvider httpMethodProvider
<add> * @return void
<add> */
<add> public function testHttpMethods($method)
<add> {
<add> $routes = new RouteBuilder($this->collection, '/', [], ['namePrefix' => 'app:']);
<add> $route = $routes->{strtolower($method)}(
<add> '/bookmarks/:id',
<add> ['controller' => 'Bookmarks', 'action' => 'view'],
<add> 'route-name'
<add> );
<add> $this->assertInstanceOf(Route::class, $route, 'Should return a route');
<add> $this->assertSame($method, $route->options['_method']);
<add> $this->assertSame('app:route-name', $route->options['_name']);
<add> $this->assertSame('/bookmarks/:id', $route->template);
<add> $this->assertEquals(
<add> ['plugin' => null, 'controller' => 'Bookmarks', 'action' => 'view'],
<add> $route->defaults
<add> );
<add> }
<ide> } | 2 |
Python | Python | fix broken test and lint | baf956e5cfe47b9b375dfd64cfc30c5a21513ce4 | <ide><path>libcloud/test/compute/test_maxihost.py
<ide> from libcloud.utils.py3 import httplib
<ide>
<ide> from libcloud.compute.drivers.maxihost import MaxihostNodeDriver
<del>from libcloud.compute.base import Node, KeyPair
<del>from libcloud.compute.types import NodeState
<add>from libcloud.compute.base import Node
<ide>
<ide> from libcloud.test import MockHttp
<ide> from libcloud.test.compute import TestCaseMixin
<ide> def setUp(self):
<ide> MaxihostNodeDriver.connectionCls.conn_class = MaxihostMockHttp
<ide> self.driver = MaxihostNodeDriver('foo')
<ide>
<del>
<ide> def test_list_sizes(self):
<ide> sizes = self.driver.list_sizes()
<ide> self.assertEqual(len(sizes), 1)
<ide> def _devices(self, method, url, body, headers):
<ide> body = self.fixtures.load('nodes.json')
<ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK])
<ide>
<add> def _devices_1319(self, method, url, body, headers):
<add> if method == 'DELETE':
<add> body = '{}'
<add> return (httplib.OK, body, {}, httplib.responses[httplib.OK])
<add> else:
<add> raise ValueError('Unsupported method: %s' % (method))
<add>
<ide> def _devices_1319_actions(self, method, url, body, headers):
<ide> body = self.fixtures.load('node.json')
<ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) | 1 |
Javascript | Javascript | add test case for | 21d6395a141f1e725cdf707b606b05f079f48b92 | <ide><path>packages/react-reconciler/src/ReactFiberBeginWork.js
<ide> function beginWork(
<ide> renderExpirationTime,
<ide> );
<ide> } else {
<add> // An update was scheduled on this fiber, but there are no new props
<add> // nor legacy context. Set this to false. If an update queue or context
<add> // consumer produces a changed value, it will set this to true. Otherwise,
<add> // the component will assume the children have not changed and bail out.
<ide> didReceiveUpdate = false;
<ide> }
<ide> } else {
<ide><path>packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.internal.js
<ide> describe('ReactHooksWithNoopRenderer', () => {
<ide> expect(ReactNoop).toMatchRenderedOutput('2');
<ide> });
<ide>
<add> // Regression test. Covers a case where an internal state variable
<add> // (`didReceiveUpdate`) is not reset properly.
<add> it('state bail out edge case (#16359)', async () => {
<add> let setCounterA;
<add> let setCounterB;
<add>
<add> function CounterA() {
<add> const [counter, setCounter] = useState(0);
<add> setCounterA = setCounter;
<add> Scheduler.unstable_yieldValue('Render A: ' + counter);
<add> useEffect(() => {
<add> Scheduler.unstable_yieldValue('Commit A: ' + counter);
<add> });
<add> return counter;
<add> }
<add>
<add> function CounterB() {
<add> const [counter, setCounter] = useState(0);
<add> setCounterB = setCounter;
<add> Scheduler.unstable_yieldValue('Render B: ' + counter);
<add> useEffect(() => {
<add> Scheduler.unstable_yieldValue('Commit B: ' + counter);
<add> });
<add> return counter;
<add> }
<add>
<add> const root = ReactNoop.createRoot(null);
<add> await ReactNoop.act(async () => {
<add> root.render(
<add> <>
<add> <CounterA />
<add> <CounterB />
<add> </>,
<add> );
<add> });
<add> expect(Scheduler).toHaveYielded([
<add> 'Render A: 0',
<add> 'Render B: 0',
<add> 'Commit A: 0',
<add> 'Commit B: 0',
<add> ]);
<add>
<add> await ReactNoop.act(async () => {
<add> setCounterA(1);
<add>
<add> // In the same batch, update B twice. To trigger the condition we're
<add> // testing, the first update is necessary to bypass the early
<add> // bailout optimization.
<add> setCounterB(1);
<add> setCounterB(0);
<add> });
<add> expect(Scheduler).toHaveYielded([
<add> 'Render A: 1',
<add> 'Render B: 0',
<add> 'Commit A: 1',
<add> // B should not fire an effect because the update bailed out
<add> // 'Commit B: 0',
<add> ]);
<add> });
<add>
<ide> it('should update latest rendered reducer when a preceding state receives a render phase update', () => {
<ide> // Similar to previous test, except using a preceding render phase update
<ide> // instead of new props. | 2 |
Text | Text | update http urls to https in readme.md | 0028241fb4c19d04066b006bca4f3e0b3b403d90 | <ide><path>README.md
<ide> and set your expectations accordingly.
<ide> The Node.js project maintains multiple types of releases:
<ide>
<ide> * **Current**: Released from active development branches of this repository,
<del> versioned by [SemVer](http://semver.org/) and signed by a member of the
<add> versioned by [SemVer](https://semver.org) and signed by a member of the
<ide> [Release Team](#release-team).
<ide> Code for Current releases is organized in this repository by major version
<ide> number. For example: [v4.x](https://github.com/nodejs/node/tree/v4.x). | 1 |
Text | Text | add raisinten as a triager | 27a63ee87020ff09136a4d16830e97902b7acb15 | <ide><path>README.md
<ide> maintaining the Node.js project.
<ide>
<ide> * [PoojaDurgad](https://github.com/PoojaDurgad) -
<ide> **Pooja Durgad** <[email protected]>
<add>* [RaisinTen](https://github.com/RaisinTen) -
<add>**Darshan Sen** <[email protected]>
<ide>
<ide> ### Release Keys
<ide> | 1 |
Ruby | Ruby | use encoding.default_external, not _internal | 91ffddca57d754f024b90d981acb146a5e9f5ab9 | <ide><path>activesupport/lib/active_support/multibyte/utils.rb
<ide> module Multibyte #:nodoc:
<ide> if Kernel.const_defined?(:Encoding)
<ide> # Returns a regular expression that matches valid characters in the current encoding
<ide> def self.valid_character
<del> VALID_CHARACTER[Encoding.default_internal.to_s]
<add> VALID_CHARACTER[Encoding.default_external.to_s]
<ide> end
<ide> else
<ide> def self.valid_character
<ide> def self.clean(string)
<ide> end
<ide> end
<ide> end
<del>end
<ide>\ No newline at end of file
<add>end
<ide><path>activesupport/test/multibyte_utils_test.rb
<ide> class MultibyteUtilsTest < ActiveSupport::TestCase
<ide>
<ide> if Kernel.const_defined?(:Encoding)
<ide> def example(key)
<del> STRINGS[key].force_encoding(Encoding.default_internal)
<add> STRINGS[key].force_encoding(Encoding.default_external)
<ide> end
<ide>
<ide> def examples
<del> STRINGS.values.map { |s| s.force_encoding(Encoding.default_internal) }
<add> STRINGS.values.map { |s| s.force_encoding(Encoding.default_external) }
<ide> end
<ide> else
<ide> def example(key)
<ide> def examples
<ide>
<ide> if 'string'.respond_to?(:encoding)
<ide> def with_encoding(enc)
<del> before = Encoding.default_internal
<add> before = Encoding.default_external
<ide>
<ide> case enc
<ide> when 'UTF8'
<del> Encoding.default_internal = Encoding::UTF_8
<add> Encoding.default_external = Encoding::UTF_8
<ide> when 'SJIS'
<del> Encoding.default_internal = Encoding::Shift_JIS
<add> Encoding.default_external = Encoding::Shift_JIS
<ide> else
<del> Encoding.default_internal = Encoding::BINARY
<add> Encoding.default_external = Encoding::BINARY
<ide> end
<ide> yield
<ide>
<del> Encoding.default_internal = before
<add> Encoding.default_external = before
<ide> end
<ide> else
<ide> alias with_encoding with_kcode
<ide> end
<del>end
<ide>\ No newline at end of file
<add>end | 2 |
Javascript | Javascript | improve description of caching | 84c04b0b6856ee0cc42867bc4e8ab8e583e54d11 | <ide><path>src/ng/http.js
<ide> function $HttpProvider() {
<ide> *
<ide> * Object containing default values for all {@link ng.$http $http} requests.
<ide> *
<del> * - **`defaults.cache`** - {Object} - an object built with {@link ng.$cacheFactory `$cacheFactory`}
<del> * that will provide the cache for all requests who set their `cache` property to `true`.
<del> * If you set the `defaults.cache = false` then only requests that specify their own custom
<del> * cache object will be cached. See {@link $http#caching $http Caching} for more information.
<add> * - **`defaults.cache`** - {boolean|Object} - A boolean value or object created with
<add> * {@link ng.$cacheFactory `$cacheFactory`} to enable or disable caching of HTTP responses
<add> * by default. See {@link $http#caching $http Caching} for more information.
<ide> *
<ide> * - **`defaults.xsrfCookieName`** - {string} - Name of cookie containing the XSRF token.
<ide> * Defaults value is `'XSRF-TOKEN'`.
<ide> function $HttpProvider() {
<ide> *
<ide> * ## Caching
<ide> *
<del> * To enable caching, set the request configuration `cache` property to `true` (to use default
<del> * cache) or to a custom cache object (built with {@link ng.$cacheFactory `$cacheFactory`}).
<del> * When the cache is enabled, `$http` stores the response from the server in the specified
<del> * cache. The next time the same request is made, the response is served from the cache without
<del> * sending a request to the server.
<add> * {@link ng.$http `$http`} responses are not cached by default. To enable caching, you must
<add> * set the config.cache value or the default cache value to TRUE or to a cache object (created
<add> * with {@link ng.$cacheFactory `$cacheFactory`}). If defined, the value of config.cache takes
<add> * precedence over the default cache value.
<ide> *
<del> * Note that even if the response is served from cache, delivery of the data is asynchronous in
<del> * the same way that real requests are.
<add> * In order to:
<add> * * cache all responses - set the default cache value to TRUE or to a cache object
<add> * * cache a specific response - set config.cache value to TRUE or to a cache object
<ide> *
<del> * If there are multiple GET requests for the same URL that should be cached using the same
<del> * cache, but the cache is not populated yet, only one request to the server will be made and
<del> * the remaining requests will be fulfilled using the response from the first request.
<add> * If caching is enabled, but neither the default cache nor config.cache are set to a cache object,
<add> * then the default `$cacheFactory($http)` object is used.
<ide> *
<del> * You can change the default cache to a new object (built with
<del> * {@link ng.$cacheFactory `$cacheFactory`}) by updating the
<del> * {@link ng.$http#defaults `$http.defaults.cache`} property. All requests who set
<del> * their `cache` property to `true` will now use this cache object.
<add> * The default cache value can be set by updating the
<add> * {@link ng.$http#defaults `$http.defaults.cache`} property or the
<add> * {@link $httpProvider#defaults `$httpProvider.defaults.cache`} property.
<add> *
<add> * When caching is enabled, {@link ng.$http `$http`} stores the response from the server using
<add> * the relevant cache object. The next time the same request is made, the response is returned
<add> * from the cache without sending a request to the server.
<add> *
<add> * Take note that:
<add> *
<add> * * Only GET and JSONP requests are cached.
<add> * * The cache key is the request URL including search parameters; headers are not considered.
<add> * * Cached responses are returned asynchronously, in the same way as responses from the server.
<add> * * If multiple identical requests are made using the same cache, which is not yet populated,
<add> * one request will be made to the server and remaining requests will return the same response.
<add> * * A cache-control header on the response does not affect if or how responses are cached.
<ide> *
<del> * If you set the default cache to `false` then only requests that specify their own custom
<del> * cache object will be cached.
<ide> *
<ide> * ## Interceptors
<ide> *
<ide> function $HttpProvider() {
<ide> * by registering it as a {@link auto.$provide#service service}.
<ide> * The default serializer is the {@link $httpParamSerializer $httpParamSerializer};
<ide> * alternatively, you can use the {@link $httpParamSerializerJQLike $httpParamSerializerJQLike}
<del> * - **cache** – `{boolean|Cache}` – If true, a default $http cache will be used to cache the
<del> * GET request, otherwise if a cache instance built with
<del> * {@link ng.$cacheFactory $cacheFactory}, this cache will be used for
<del> * caching.
<add> * - **cache** – `{boolean|Object}` – A boolean value or object created with
<add> * {@link ng.$cacheFactory `$cacheFactory`} to enable or disable caching of the HTTP response.
<add> * See {@link $http#caching $http Caching} for more information.
<ide> * - **timeout** – `{number|Promise}` – timeout in milliseconds, or {@link ng.$q promise}
<ide> * that should abort the request when resolved.
<ide> * - **withCredentials** - `{boolean}` - whether to set the `withCredentials` flag on the | 1 |
Java | Java | make text in text inputs selectable | c456accbeda8b6c3aa01a0d713cd9998eef2c61b | <ide><path>ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java
<ide> public void clearFocus() {
<ide>
<ide> @Override
<ide> public boolean requestFocus(int direction, Rect previouslyFocusedRect) {
<add> // Always return true if we are already focused. This is used by android in certain places,
<add> // such as text selection.
<add> if (isFocused()) {
<add> return true;
<add> }
<ide> if (!mIsJSSettingFocus) {
<ide> return false;
<ide> } | 1 |
Javascript | Javascript | make use of declared variable | 4efda14b499fa1dbc115f17bb3bf42385a00e239 | <ide><path>src/ng/directive/ngRepeat.js
<ide> var ngRepeatDirective = ngDirective({
<ide> // Same as lastOrder but it has the current state. It will become the
<ide> // lastOrder on the next iteration.
<ide> nextOrder = new HashQueueMap(),
<del> arrayLength,
<add> arrayBound,
<ide> childScope,
<ide> key, value, // key/value of iteration
<ide> array,
<ide> var ngRepeatDirective = ngDirective({
<ide> array = collection || [];
<ide> }
<ide>
<del> arrayLength = array.length;
<add> arrayBound = array.length-1;
<ide>
<ide> // we are not using forEach for perf reasons (trying to avoid #call)
<ide> for (index = 0, length = array.length; index < length; index++) {
<ide> var ngRepeatDirective = ngDirective({
<ide> childScope.$index = index;
<ide>
<ide> childScope.$first = (index === 0);
<del> childScope.$last = (index === (arrayLength - 1));
<add> childScope.$last = (index === arrayBound);
<ide> childScope.$middle = !(childScope.$first || childScope.$last);
<ide>
<ide> if (!last) { | 1 |
PHP | PHP | fix srid mysql schema | 2e9d90bad11dbaf33e4a7cedcdcbb60419f85a25 | <ide><path>src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php
<ide> class MySqlGrammar extends Grammar
<ide> */
<ide> protected $modifiers = [
<ide> 'Unsigned', 'Charset', 'Collate', 'VirtualAs', 'StoredAs', 'Nullable',
<del> 'Default', 'Increment', 'Comment', 'After', 'First', 'Srid',
<add> 'Srid', 'Default', 'Increment', 'Comment', 'After', 'First',
<ide> ];
<ide>
<ide> /**
<ide><path>tests/Database/DatabaseMySqlSchemaGrammarTest.php
<ide> public function testAddingPoint()
<ide> $this->assertSame('alter table `geo` add `coordinates` point not null', $statements[0]);
<ide> }
<ide>
<add> public function testAddingPointWithSrid()
<add> {
<add> $blueprint = new Blueprint('geo');
<add> $blueprint->point('coordinates', 4326);
<add> $statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
<add>
<add> $this->assertCount(1, $statements);
<add> $this->assertSame('alter table `geo` add `coordinates` point not null srid 4326', $statements[0]);
<add> }
<add>
<add> public function testAddingPointWithSridColumn()
<add> {
<add> $blueprint = new Blueprint('geo');
<add> $blueprint->point('coordinates', 4326)->after('id');
<add> $statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
<add>
<add> $this->assertCount(1, $statements);
<add> $this->assertSame('alter table `geo` add `coordinates` point not null srid 4326 after `id`', $statements[0]);
<add> }
<add>
<ide> public function testAddingLineString()
<ide> {
<ide> $blueprint = new Blueprint('geo'); | 2 |
Java | Java | remove no-op classes in web-related java config | a40d25a760249e59e9c077648f844591c3acac8b | <ide><path>spring-messaging/src/main/java/org/springframework/messaging/simp/config/AbstractMessageBrokerConfiguration.java
<ide> import org.springframework.context.ApplicationContextAware;
<ide> import org.springframework.context.annotation.Bean;
<ide> import org.springframework.lang.Nullable;
<del>import org.springframework.messaging.Message;
<ide> import org.springframework.messaging.MessageHandler;
<ide> import org.springframework.messaging.converter.ByteArrayMessageConverter;
<ide> import org.springframework.messaging.converter.CompositeMessageConverter;
<ide> protected void addReturnValueHandlers(List<HandlerMethodReturnValueHandler> retu
<ide> }
<ide>
<ide> @Bean
<add> @Nullable
<ide> public AbstractBrokerMessageHandler simpleBrokerMessageHandler() {
<ide> SimpleBrokerMessageHandler handler = getBrokerRegistry().getSimpleBroker(brokerChannel());
<ide> if (handler == null) {
<del> return new NoOpBrokerMessageHandler();
<add> return null;
<ide> }
<ide> updateUserDestinationResolver(handler);
<ide> return handler;
<ide> private void updateUserDestinationResolver(AbstractBrokerMessageHandler handler)
<ide> }
<ide>
<ide> @Bean
<add> @Nullable
<ide> public AbstractBrokerMessageHandler stompBrokerRelayMessageHandler() {
<ide> StompBrokerRelayMessageHandler handler = getBrokerRegistry().getStompBrokerRelay(brokerChannel());
<ide> if (handler == null) {
<del> return new NoOpBrokerMessageHandler();
<add> return null;
<ide> }
<ide> Map<String, MessageHandler> subscriptions = new HashMap<>(1);
<ide> String destination = getBrokerRegistry().getUserDestinationBroadcast();
<ide> public UserDestinationMessageHandler userDestinationMessageHandler() {
<ide> }
<ide>
<ide> @Bean
<add> @Nullable
<ide> public MessageHandler userRegistryMessageHandler() {
<ide> if (getBrokerRegistry().getUserRegistryBroadcast() == null) {
<del> return new NoOpMessageHandler();
<add> return null;
<ide> }
<ide> SimpUserRegistry userRegistry = userRegistry();
<ide> Assert.isInstanceOf(MultiServerUserRegistry.class, userRegistry, "MultiServerUserRegistry required");
<ide> public SimpUserRegistry userRegistry() {
<ide> protected abstract SimpUserRegistry createLocalUserRegistry();
<ide>
<ide> /**
<del> * Return a {@link org.springframework.validation.Validator org.springframework.validation.Validators} instance for validating
<add> * Return a {@link org.springframework.validation.Validator
<add> * org.springframework.validation.Validators} instance for validating
<ide> * {@code @Payload} method arguments.
<ide> * <p>In order, this method tries to get a Validator instance:
<ide> * <ul>
<ide> public Validator getValidator() {
<ide> return null;
<ide> }
<ide>
<del>
<del> private static class NoOpMessageHandler implements MessageHandler {
<del>
<del> @Override
<del> public void handleMessage(Message<?> message) {
<del> }
<del> }
<del>
<del>
<del> private class NoOpBrokerMessageHandler extends AbstractBrokerMessageHandler {
<del>
<del> public NoOpBrokerMessageHandler() {
<del> super(clientInboundChannel(), clientOutboundChannel(), brokerChannel());
<del> }
<del>
<del> @Override
<del> public void start() {
<del> }
<del>
<del> @Override
<del> public void stop() {
<del> }
<del>
<del> @Override
<del> public void handleMessage(Message<?> message) {
<del> }
<del>
<del> @Override
<del> protected void handleMessageInternal(Message<?> message) {
<del> }
<del> }
<del>
<ide> }
<ide><path>spring-messaging/src/test/java/org/springframework/messaging/simp/config/MessageBrokerConfigurationTests.java
<ide> public void userBroadcastsDisabledWithSimpleBroker() {
<ide> UserDestinationMessageHandler handler = context.getBean(UserDestinationMessageHandler.class);
<ide> assertNull(handler.getBroadcastDestination());
<ide>
<del> String name = "userRegistryMessageHandler";
<del> MessageHandler messageHandler = context.getBean(name, MessageHandler.class);
<del> assertNotEquals(UserRegistryMessageHandler.class, messageHandler.getClass());
<add> Object nullBean = context.getBean("userRegistryMessageHandler");
<add> assertTrue(nullBean.equals(null));
<ide> }
<ide>
<ide> @Test // SPR-16275
<ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport.java
<ide> import java.util.Map;
<ide> import java.util.function.Predicate;
<ide> import javax.servlet.ServletContext;
<del>import javax.servlet.http.HttpServletRequest;
<ide>
<ide> import org.springframework.beans.BeanUtils;
<ide> import org.springframework.beans.factory.BeanFactoryUtils;
<ide> protected void configureContentNegotiation(ContentNegotiationConfigurer configur
<ide> * {@link #addViewControllers}.
<ide> */
<ide> @Bean
<add> @Nullable
<ide> public HandlerMapping viewControllerHandlerMapping() {
<ide> ViewControllerRegistry registry = new ViewControllerRegistry(this.applicationContext);
<ide> addViewControllers(registry);
<ide>
<ide> AbstractHandlerMapping handlerMapping = registry.buildHandlerMapping();
<del> handlerMapping = (handlerMapping != null ? handlerMapping : new EmptyHandlerMapping());
<add> if (handlerMapping == null) {
<add> return null;
<add> }
<ide> handlerMapping.setPathMatcher(mvcPathMatcher());
<ide> handlerMapping.setUrlPathHelper(mvcUrlPathHelper());
<ide> handlerMapping.setInterceptors(getInterceptors());
<ide> public BeanNameUrlHandlerMapping beanNameHandlerMapping() {
<ide> * {@link #addResourceHandlers}.
<ide> */
<ide> @Bean
<add> @Nullable
<ide> public HandlerMapping resourceHandlerMapping() {
<ide> Assert.state(this.applicationContext != null, "No ApplicationContext set");
<ide> Assert.state(this.servletContext != null, "No ServletContext set");
<ide> public HandlerMapping resourceHandlerMapping() {
<ide> addResourceHandlers(registry);
<ide>
<ide> AbstractHandlerMapping handlerMapping = registry.getHandlerMapping();
<del> if (handlerMapping != null) {
<del> handlerMapping.setPathMatcher(mvcPathMatcher());
<del> handlerMapping.setUrlPathHelper(mvcUrlPathHelper());
<del> handlerMapping.setInterceptors(getInterceptors());
<del> handlerMapping.setCorsConfigurations(getCorsConfigurations());
<del> }
<del> else {
<del> handlerMapping = new EmptyHandlerMapping();
<add> if (handlerMapping == null) {
<add> return null;
<ide> }
<add> handlerMapping.setPathMatcher(mvcPathMatcher());
<add> handlerMapping.setUrlPathHelper(mvcUrlPathHelper());
<add> handlerMapping.setInterceptors(getInterceptors());
<add> handlerMapping.setCorsConfigurations(getCorsConfigurations());
<ide> return handlerMapping;
<ide> }
<ide>
<ide> public ResourceUrlProvider mvcResourceUrlProvider() {
<ide> * override {@link #configureDefaultServletHandling}.
<ide> */
<ide> @Bean
<add> @Nullable
<ide> public HandlerMapping defaultServletHandlerMapping() {
<ide> Assert.state(this.servletContext != null, "No ServletContext set");
<ide> DefaultServletHandlerConfigurer configurer = new DefaultServletHandlerConfigurer(this.servletContext);
<ide> configureDefaultServletHandling(configurer);
<del>
<del> HandlerMapping handlerMapping = configurer.buildHandlerMapping();
<del> return (handlerMapping != null ? handlerMapping : new EmptyHandlerMapping());
<add> return configurer.buildHandlerMapping();
<ide> }
<ide>
<ide> /**
<ide> public FormattingConversionService mvcConversionService() {
<ide> }
<ide>
<ide> /**
<del> * Override this method to add custom {@link Converter}s and {@link Formatter Converter}s and {@link Formatters}.
<add> * Override this method to add custom {@link Converter}s and
<add> * {@link Formatter Converter}s and {@link Formatters}.
<ide> */
<ide> protected void addFormatters(FormatterRegistry registry) {
<ide> }
<ide> public HandlerMappingIntrospector mvcHandlerMappingIntrospector() {
<ide> }
<ide>
<ide>
<del>
<del> private static final class EmptyHandlerMapping extends AbstractHandlerMapping {
<del>
<del> @Override
<del> protected Object getHandlerInternal(HttpServletRequest request) {
<del> return null;
<del> }
<del> }
<del>
<del>
<ide> private static final class NoOpValidator implements Validator {
<ide>
<ide> @Override
<ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupportTests.java
<ide> import org.springframework.web.servlet.HandlerExceptionResolver;
<ide> import org.springframework.web.servlet.HandlerExecutionChain;
<ide> import org.springframework.web.servlet.ViewResolver;
<del>import org.springframework.web.servlet.handler.AbstractHandlerMapping;
<ide> import org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping;
<ide> import org.springframework.web.servlet.handler.ConversionServiceExposingInterceptor;
<ide> import org.springframework.web.servlet.handler.HandlerExceptionResolverComposite;
<ide> import org.springframework.web.servlet.view.ViewResolverComposite;
<ide> import org.springframework.web.util.UrlPathHelper;
<ide>
<del>import static com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES;
<del>import static com.fasterxml.jackson.databind.MapperFeature.DEFAULT_VIEW_INCLUSION;
<del>import static org.junit.Assert.assertEquals;
<del>import static org.junit.Assert.assertFalse;
<del>import static org.junit.Assert.assertNotNull;
<del>import static org.junit.Assert.assertNull;
<del>import static org.junit.Assert.assertTrue;
<add>import static com.fasterxml.jackson.databind.DeserializationFeature.*;
<add>import static com.fasterxml.jackson.databind.MapperFeature.*;
<add>import static org.junit.Assert.*;
<ide>
<ide> /**
<ide> * Integration tests for {@link WebMvcConfigurationSupport} (imported via
<ide> public void requestMappingHandlerMapping() throws Exception {
<ide> }
<ide>
<ide> @Test
<del> public void emptyViewControllerHandlerMapping() {
<add> public void emptyHandlerMappings() {
<ide> ApplicationContext context = initContext(WebConfig.class);
<del> String name = "viewControllerHandlerMapping";
<del> AbstractHandlerMapping handlerMapping = context.getBean(name, AbstractHandlerMapping.class);
<ide>
<del> assertNotNull(handlerMapping);
<del> assertEquals(Integer.MAX_VALUE, handlerMapping.getOrder());
<del> assertTrue(handlerMapping.getClass().getName().endsWith("EmptyHandlerMapping"));
<add> Object nullBean = context.getBean("viewControllerHandlerMapping");
<add> assertTrue(nullBean.equals(null));
<add>
<add> nullBean = context.getBean("resourceHandlerMapping");
<add> assertTrue(nullBean.equals(null));
<add>
<add> nullBean = context.getBean("defaultServletHandlerMapping");
<add> assertTrue(nullBean.equals(null));
<ide> }
<ide>
<ide> @Test
<ide> public void beanNameHandlerMapping() throws Exception {
<ide> assertEquals(ResourceUrlProviderExposingInterceptor.class, chain.getInterceptors()[2].getClass());
<ide> }
<ide>
<del> @Test
<del> public void emptyResourceHandlerMapping() {
<del> ApplicationContext context = initContext(WebConfig.class);
<del> AbstractHandlerMapping handlerMapping = context.getBean("resourceHandlerMapping", AbstractHandlerMapping.class);
<del>
<del> assertNotNull(handlerMapping);
<del> assertEquals(Integer.MAX_VALUE, handlerMapping.getOrder());
<del> assertTrue(handlerMapping.getClass().getName().endsWith("EmptyHandlerMapping"));
<del> }
<del>
<del> @Test
<del> public void emptyDefaultServletHandlerMapping() {
<del> ApplicationContext context = initContext(WebConfig.class);
<del> String name = "defaultServletHandlerMapping";
<del> AbstractHandlerMapping handlerMapping = context.getBean(name, AbstractHandlerMapping.class);
<del>
<del> assertNotNull(handlerMapping);
<del> assertEquals(Integer.MAX_VALUE, handlerMapping.getOrder());
<del> assertTrue(handlerMapping.getClass().getName().endsWith("EmptyHandlerMapping"));
<del> }
<del>
<ide> @Test
<ide> public void requestMappingHandlerAdapter() throws Exception {
<ide> ApplicationContext context = initContext(WebConfig.class); | 4 |
Ruby | Ruby | use gcc 12 for runtime libraries | 66fa1f7e6aacaa84f9cc50e384a7bd8504b98a99 | <ide><path>Library/Homebrew/extend/os/linux/compilers.rb
<ide> class CompilerSelector
<ide> sig { returns(String) }
<ide> def self.preferred_gcc
<del> OS::LINUX_PREFERRED_GCC_FORMULA
<add> OS::LINUX_PREFERRED_GCC_COMPILER_FORMULA
<ide> end
<ide> end
<ide><path>Library/Homebrew/extend/os/linux/dependency_collector.rb
<ide> def glibc_dep_if_needed(related_formula_names)
<ide> private
<ide>
<ide> GLIBC = "glibc"
<del> GCC = CompilerSelector.preferred_gcc.freeze
<add> GCC = OS::LINUX_PREFERRED_GCC_RUNTIME_FORMULA
<ide>
<ide> sig { void }
<ide> def init_global_dep_tree_if_needed!
<ide><path>Library/Homebrew/extend/os/linux/formula.rb
<ide> def add_global_deps_to_spec(spec)
<ide> dependency_collector = spec.dependency_collector
<ide> related_formula_names = Set.new([
<ide> name,
<add> *aliases,
<ide> *versioned_formulae_names,
<ide> ])
<ide> [
<ide><path>Library/Homebrew/extend/os/linux/install.rb
<ide> module Install
<ide> ].freeze
<ide> private_constant :DYNAMIC_LINKERS
<ide>
<del> GCC_VERSION_SUFFIX = OS::LINUX_GCC_CI_VERSION.delete_suffix(".0").freeze
<add> PREFERRED_GCC_RUNTIME_VERSION = OS::LINUX_PREFERRED_GCC_RUNTIME_FORMULA.split("@").last.freeze
<add> private_constant :PREFERRED_GCC_RUNTIME_VERSION
<ide>
<ide> # We link GCC runtime libraries that are not specificaly used for Fortran,
<ide> # which are linked by the GCC formula. We only use the versioned shared libraries
<ide> def symlink_ld_so
<ide> private_class_method :symlink_ld_so
<ide>
<ide> def symlink_gcc_libs
<del> gcc_opt_prefix = HOMEBREW_PREFIX/"opt/#{OS::LINUX_PREFERRED_GCC_FORMULA}"
<add> gcc_opt_prefix = HOMEBREW_PREFIX/"opt/#{OS::LINUX_PREFERRED_GCC_RUNTIME_FORMULA}"
<ide>
<ide> GCC_RUNTIME_LIBS.each do |library|
<del> gcc_library = gcc_opt_prefix/"lib/gcc/#{GCC_VERSION_SUFFIX}/#{library}"
<add> gcc_library = gcc_opt_prefix/"lib/gcc/#{PREFERRED_GCC_RUNTIME_VERSION}/#{library}"
<ide> gcc_library_symlink = HOMEBREW_PREFIX/"lib/#{library}"
<ide> # Skip if the link target doesn't exist.
<ide> next unless gcc_library.readable?
<ide><path>Library/Homebrew/os.rb
<ide> def self.kernel_name
<ide> LINUX_GLIBC_CI_VERSION = "2.35"
<ide> LINUX_GLIBC_NEXT_CI_VERSION = "2.35"
<ide> LINUX_GCC_CI_VERSION = "11.0"
<del> LINUX_PREFERRED_GCC_FORMULA = "gcc@11"
<add> LINUX_PREFERRED_GCC_COMPILER_FORMULA = "gcc@11" # https://packages.ubuntu.com/jammy/gcc
<add> LINUX_PREFERRED_GCC_RUNTIME_FORMULA = "gcc@12" # https://packages.ubuntu.com/jammy/libstdc++6
<ide>
<ide> if OS.mac?
<ide> require "os/mac" | 5 |
Python | Python | fix documentation of array | f9d1cd5265b013042b5909adf92ca5ea168aaee3 | <ide><path>numpy/add_newdocs.py
<ide>
<ide> add_newdoc('numpy.core.multiarray', 'array',
<ide> """
<del> array(object, dtype=None, copy=True, order=None, subok=False, ndmin=True)
<add> array(object, dtype=None, copy=True, order=None, subok=False, ndmin=0)
<ide>
<ide> Create an array.
<ide> | 1 |
Ruby | Ruby | use process.pid rather than $$ | decafdd57a2c992a15df894cc43cd0a7ff6ea985 | <ide><path>activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
<ide> def initialize(pools = Hash.new { |h,k| h[k] = {} })
<ide> end
<ide>
<ide> def connection_pools
<del> @connection_pools[$$]
<add> @connection_pools[Process.pid]
<ide> end
<ide>
<ide> def establish_connection(name, spec)
<ide> def retrieve_connection_pool(klass)
<ide> private
<ide>
<ide> def class_to_pool
<del> @class_to_pool[$$]
<add> @class_to_pool[Process.pid]
<ide> end
<ide>
<ide> def set_pool_for_spec(spec, pool)
<del> @connection_pools[$$][spec] = pool
<add> @connection_pools[Process.pid][spec] = pool
<ide> end
<ide>
<ide> def set_class_to_pool(name, pool)
<del> @class_to_pool[$$][name] = pool
<add> @class_to_pool[Process.pid][name] = pool
<ide> pool
<ide> end
<ide>
<ide> def get_pool_for_class(klass)
<del> @class_to_pool[$$].fetch(klass) {
<add> @class_to_pool[Process.pid].fetch(klass) {
<ide> c_to_p = @class_to_pool.values.find { |class_to_pool|
<ide> class_to_pool[klass]
<ide> }
<ide><path>activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
<ide> def clear
<ide>
<ide> private
<ide> def cache
<del> @cache[$$]
<add> @cache[Process.pid]
<ide> end
<ide> end
<ide>
<ide><path>activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
<ide> def delete(sql_key)
<ide>
<ide> private
<ide> def cache
<del> @cache[$$]
<add> @cache[Process.pid]
<ide> end
<ide>
<ide> def dealloc(key) | 3 |
PHP | PHP | fix all() not working with plugins | 4923387c552af184c3cede96518eb6ba28d9e57e | <ide><path>src/Console/Command/Task/ControllerTask.php
<ide> public function main($name = null) {
<ide> * @return void
<ide> */
<ide> public function all() {
<del> $controllersCreated = 0;
<ide> foreach ($this->listAll() as $table) {
<del> $controller = $this->_controllerName($table);
<del> $this->bake($controller);
<del> $controllersCreated++;
<add> $this->main($table);
<ide> }
<ide> }
<ide>
<ide><path>src/Console/Command/Task/ModelTask.php
<ide> public function all() {
<ide> if (in_array($table, $this->skipTables)) {
<ide> continue;
<ide> }
<del> $modelClass = $this->_modelName($table);
<del> $this->out(__d('cake_console', 'Baking %s', $modelClass));
<del> $this->bake($modelClass);
<add> $this->main($table);
<ide> }
<ide> }
<ide> | 2 |
Javascript | Javascript | apply promises api to third appendfile test | 16d63e629d433c27d431260322fd3cd53f910e0c | <ide><path>test/parallel/test-fs-append-file.js
<ide> const throwNextTick = (e) => { process.nextTick(() => { throw e; }); };
<ide> .catch(throwNextTick);
<ide> }
<ide>
<del>// test that appendFile accepts buffers
<del>const filename3 = join(tmpdir.path, 'append3.txt');
<del>fs.writeFileSync(filename3, currentFileData);
<add>// test that appendFile accepts buffers (callback API)
<add>{
<add> const filename = join(tmpdir.path, 'append-buffer.txt');
<add> fs.writeFileSync(filename, currentFileData);
<ide>
<del>const buf = Buffer.from(s, 'utf8');
<add> const buf = Buffer.from(s, 'utf8');
<ide>
<del>fs.appendFile(filename3, buf, function(e) {
<del> assert.ifError(e);
<add> fs.appendFile(filename, buf, common.mustCall((e) => {
<add> assert.ifError(e);
<ide>
<del> ncallbacks++;
<add> fs.readFile(filename, common.mustCall((e, buffer) => {
<add> assert.ifError(e);
<add> assert.strictEqual(buf.length + currentFileData.length, buffer.length);
<add> }));
<add> }));
<add>}
<ide>
<del> fs.readFile(filename3, function(e, buffer) {
<del> assert.ifError(e);
<del> ncallbacks++;
<del> assert.strictEqual(buf.length + currentFileData.length, buffer.length);
<del> });
<del>});
<add>// test that appendFile accepts buffers (promises API)
<add>{
<add> const filename = join(tmpdir.path, 'append-buffer-promises.txt');
<add> fs.writeFileSync(filename, currentFileData);
<add>
<add> const buf = Buffer.from(s, 'utf8');
<add>
<add> fs.promises.appendFile(filename, buf)
<add> .then(common.mustCall(() => fs.promises.readFile(filename)))
<add> .then((buffer) => {
<add> assert.strictEqual(buf.length + currentFileData.length, buffer.length);
<add> })
<add> .catch(throwNextTick);
<add>}
<ide>
<ide> // test that appendFile accepts numbers.
<ide> const filename4 = join(tmpdir.path, 'append4.txt');
<ide> assert.throws(
<ide> { code: 'ERR_INVALID_CALLBACK' });
<ide>
<ide> process.on('exit', function() {
<del> assert.strictEqual(ncallbacks, 8);
<add> assert.strictEqual(ncallbacks, 6);
<ide>
<del> fs.unlinkSync(filename3);
<ide> fs.unlinkSync(filename4);
<ide> fs.unlinkSync(filename5);
<ide> }); | 1 |
Go | Go | fix error when make lint | 1adcfa9aa11b765c6b3eb1fcbae2d5fb722077c4 | <ide><path>libnetwork/networkdb/networkdb_test.go
<ide> func (db *NetworkDB) verifyNodeExistence(t *testing.T, node string, present bool
<ide> time.Sleep(50 * time.Millisecond)
<ide> }
<ide>
<del> t.Error(fmt.Sprintf("%v(%v): Node existence verification for node %s failed", db.config.Hostname, db.config.NodeID, node))
<add> t.Errorf("%v(%v): Node existence verification for node %s failed", db.config.Hostname, db.config.NodeID, node)
<ide> }
<ide>
<ide> func (db *NetworkDB) verifyNetworkExistence(t *testing.T, node string, id string, present bool) {
<ide> func (db *NetworkDB) verifyEntryExistence(t *testing.T, tname, nid, key, value s
<ide> time.Sleep(50 * time.Millisecond)
<ide> }
<ide>
<del> t.Error(fmt.Sprintf("Entry existence verification test failed for %v(%v)", db.config.Hostname, db.config.NodeID))
<add> t.Errorf("Entry existence verification test failed for %v(%v)", db.config.Hostname, db.config.NodeID)
<ide> }
<ide>
<ide> func testWatch(t *testing.T, ch chan events.Event, ev interface{}, tname, nid, key, value string) { | 1 |
Javascript | Javascript | add support to jsx transform for <hyphenated-tags> | 5eb57fa51b4702e76e8c71535b695a216b803eb2 | <ide><path>vendor/fbtransform/transforms/__tests__/react-test.js
<ide> * See the License for the specific language governing permissions and
<ide> * limitations under the License.
<ide> *
<del> * @emails [email protected]
<add> * @emails [email protected]
<ide> */
<ide> "use strict";
<ide>
<ide> require('mock-modules').autoMockOff();
<ide>
<ide> describe('react jsx', function() {
<ide> var transformAll = require('../../syntax.js').transformAll;
<add> var xjs = require('../xjs.js');
<add>
<add> // Add <font-face> to list of known tags to ensure that when we test support
<add> // for hyphentated known tags, it's there.
<add> // TODO: remove this when/if <font-face> is supported out of the box.
<add> xjs.knownTags['font-face'] = true;
<ide>
<ide> var transform = function(code, options, excludes) {
<ide> return transformAll(
<ide> describe('react jsx', function() {
<ide> expect(transform(code).code).toBe(result);
<ide> });
<ide>
<add> it('should allow deeper JS namespacing', function() {
<add> var code = [
<add> '/**',
<add> ' * @jsx React.DOM',
<add> ' */',
<add> '<Namespace.DeepNamespace.Component />;'
<add> ].join('\n');
<add> var result = [
<add> '/**',
<add> ' * @jsx React.DOM',
<add> ' */',
<add> 'Namespace.DeepNamespace.Component(null);'
<add> ].join('\n');
<add>
<add> expect(transform(code).code).toBe(result);
<add> });
<add>
<ide> it('should disallow XML namespacing', function() {
<ide> var code = [
<ide> '/**',
<ide> describe('react jsx', function() {
<ide> '<Component { ... x } y\n={2 } z />';
<ide> var result = HEADER +
<ide> 'Component(Object.assign({}, x , {y: \n2, z: true}))';
<add>
<add> expect(transform(code).code).toBe(result);
<add> });
<add>
<add> it('should transform known hyphenated tags', function() {
<add> var code = [
<add> '/**',
<add> ' * @jsx React.DOM',
<add> ' */',
<add> '<font-face />;'
<add> ].join('\n');
<add> var result = [
<add> '/**',
<add> ' * @jsx React.DOM',
<add> ' */',
<add> 'React.DOM[\'font-face\'](null);'
<add> ].join('\n');
<add>
<ide> expect(transform(code).code).toBe(result);
<ide> });
<ide>
<ide> describe('react jsx', function() {
<ide> ).not.toBeCalled();
<ide> });
<ide>
<add> it('should throw for unknown hyphenated tags', function() {
<add> var code = [
<add> '/**',
<add> ' * @jsx React.DOM',
<add> ' */',
<add> '<x-component />;'
<add> ].join('\n');
<add>
<add> expect(() => transform(code)).toThrow();
<add> });
<add>
<ide> it('calls assign with a new target object for spreads', function() {
<ide> expectObjectAssign(
<ide> '<Component {...x} />'
<ide><path>vendor/fbtransform/transforms/react.js
<ide> function visitReactTag(traverse, object, path, state) {
<ide>
<ide> utils.catchup(openingElement.range[0], state, trimLeft);
<ide>
<del>
<ide> if (nameObject.type === Syntax.XJSNamespacedName && nameObject.namespace) {
<ide> throw new Error('Namespace tags are not supported. ReactJSX is not XML.');
<ide> }
<ide>
<del> // Only identifiers can be fallback tags. XJSMemberExpressions are not.
<del> var isFallbackTag =
<del> nameObject.type === Syntax.XJSIdentifier &&
<del> FALLBACK_TAGS.hasOwnProperty(nameObject.name);
<add> // Only identifiers can be fallback tags or need quoting. We don't need to
<add> // handle quoting for other types.
<add> var didAddTag = false;
<ide>
<del> utils.append(isFallbackTag ? jsxObjIdent + '.' : '', state);
<add> // Only identifiers can be fallback tags. XJSMemberExpressions are not.
<add> if (nameObject.type === Syntax.XJSIdentifier) {
<add> var tagName = nameObject.name;
<add> var quotedTagName = quoteAttrName(tagName);
<add>
<add> if (FALLBACK_TAGS.hasOwnProperty(tagName)) {
<add> // "Properly" handle invalid identifiers, like <font-face>, which needs to
<add> // be enclosed in quotes.
<add> var predicate =
<add> tagName === quotedTagName ?
<add> ('.' + tagName) :
<add> ('[' + quotedTagName + ']');
<add> utils.append(jsxObjIdent + predicate, state);
<add> utils.move(nameObject.range[1], state);
<add> didAddTag = true;
<add> } else if (tagName !== quotedTagName) {
<add> // If we're in the case where we need to quote and but don't recognize the
<add> // tag, throw.
<add> throw new Error(
<add> 'Tags must be valid JS identifiers or a recognized special case. `<' +
<add> tagName + '>` is not one of them.'
<add> );
<add> }
<add> }
<ide>
<del> utils.move(nameObject.range[0], state);
<del> utils.catchup(nameObject.range[1], state);
<add> // Use utils.catchup in this case so we can easily handle XJSMemberExpressions
<add> // which look like Foo.Bar.Baz. This also handles unhyphenated XJSIdentifiers
<add> // that aren't fallback tags.
<add> if (!didAddTag) {
<add> utils.move(nameObject.range[0], state);
<add> utils.catchup(nameObject.range[1], state);
<add> }
<ide>
<ide> utils.append('(', state);
<ide> | 2 |
Python | Python | add privileged option in dockeroperator | 3064bf04429f86ff2b527704603ef3ca9b9fe22f | <ide><path>airflow/providers/docker/operators/docker.py
<ide> class DockerOperator(BaseOperator):
<ide> :param tty: Allocate pseudo-TTY to the container
<ide> This needs to be set see logs of the Docker container.
<ide> :type tty: bool
<add> :param privileged: Give extended privileges to this container.
<add> :type privileged: bool
<ide> :param cap_add: Include container capabilities
<ide> :type cap_add: list[str]
<ide> """
<ide> def __init__(
<ide> auto_remove: bool = False,
<ide> shm_size: Optional[int] = None,
<ide> tty: bool = False,
<add> privileged: bool = False,
<ide> cap_add: Optional[Iterable[str]] = None,
<ide> extra_hosts: Optional[Dict[str, str]] = None,
<ide> **kwargs,
<ide> def __init__(
<ide> self.docker_conn_id = docker_conn_id
<ide> self.shm_size = shm_size
<ide> self.tty = tty
<add> self.privileged = privileged
<ide> self.cap_add = cap_add
<ide> self.extra_hosts = extra_hosts
<ide> if kwargs.get('xcom_push') is not None:
<ide> def _run_image(self) -> Optional[str]:
<ide> mem_limit=self.mem_limit,
<ide> cap_add=self.cap_add,
<ide> extra_hosts=self.extra_hosts,
<add> privileged=self.privileged,
<ide> ),
<ide> image=self.image,
<ide> user=self.user,
<ide><path>tests/providers/docker/operators/test_docker.py
<ide> def test_execute(self):
<ide> dns_search=None,
<ide> cap_add=None,
<ide> extra_hosts=None,
<add> privileged=False,
<ide> )
<ide> self.tempdir_mock.assert_called_once_with(dir='/host/airflow', prefix='airflowtmp')
<ide> self.client_mock.images.assert_called_once_with(name='ubuntu:latest')
<ide> def test_extra_hosts(self):
<ide> assert 'host_config' in self.client_mock.create_container.call_args[1]
<ide> assert 'extra_hosts' in self.client_mock.create_host_config.call_args[1]
<ide> assert hosts_obj is self.client_mock.create_host_config.call_args[1]['extra_hosts']
<add>
<add> def test_privileged(self):
<add> privileged = mock.Mock()
<add> operator = DockerOperator(task_id='test', image='test', privileged=privileged)
<add> operator.execute(None)
<add> self.client_mock.create_container.assert_called_once()
<add> assert 'host_config' in self.client_mock.create_container.call_args[1]
<add> assert 'privileged' in self.client_mock.create_host_config.call_args[1]
<add> assert privileged is self.client_mock.create_host_config.call_args[1]['privileged'] | 2 |
Python | Python | fix test_fetcher when setup is updated | 7bd16b87762480b0c61ee517770ff7c037620b74 | <ide><path>utils/tests_fetcher.py
<ide> def infer_tests_to_run(output_file, diff_with_last_commit=False, filters=None):
<ide> print(f"\n### IMPACTED FILES ###\n{_print_list(impacted_files)}")
<ide>
<ide> # Grab the corresponding test files:
<del> test_files_to_run = []
<del> for f in impacted_files:
<del> # Modified test files are always added
<del> if f.startswith("tests/"):
<del> test_files_to_run.append(f)
<del> else:
<del> new_tests = module_to_test_file(f)
<del> if new_tests is not None:
<del> if isinstance(new_tests, str):
<del> test_files_to_run.append(new_tests)
<del> else:
<del> test_files_to_run.extend(new_tests)
<del>
<del> # Remove duplicates
<del> test_files_to_run = sorted(list(set(test_files_to_run)))
<del> # Make sure we did not end up with a test file that was removed
<del> test_files_to_run = [f for f in test_files_to_run if os.path.isfile(f) or os.path.isdir(f)]
<del> if filters is not None:
<del> for filter in filters:
<del> test_files_to_run = [f for f in test_files_to_run if f.startswith(filter)]
<add> if "setup.py" in impacted_files:
<add> test_files_to_run = ["tests"]
<add> else:
<add> # Grab the corresponding test files:
<add> test_files_to_run = []
<add> for f in impacted_files:
<add> # Modified test files are always added
<add> if f.startswith("tests/"):
<add> test_files_to_run.append(f)
<add> else:
<add> new_tests = module_to_test_file(f)
<add> if new_tests is not None:
<add> if isinstance(new_tests, str):
<add> test_files_to_run.append(new_tests)
<add> else:
<add> test_files_to_run.extend(new_tests)
<add>
<add> # Remove duplicates
<add> test_files_to_run = sorted(list(set(test_files_to_run)))
<add> # Make sure we did not end up with a test file that was removed
<add> test_files_to_run = [f for f in test_files_to_run if os.path.isfile(f) or os.path.isdir(f)]
<add> if filters is not None:
<add> for filter in filters:
<add> test_files_to_run = [f for f in test_files_to_run if f.startswith(filter)]
<ide>
<ide> print(f"\n### TEST TO RUN ###\n{_print_list(test_files_to_run)}")
<ide> if len(test_files_to_run) > 0: | 1 |
Text | Text | simplify download instruction | aa630279e672c882e3c74acd1cd7e56c63536722 | <ide><path>examples/basic-css/README.md
<ide> Download the example:
<ide>
<ide> ```bash
<del>curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz next.js-master/examples/basic-css
<del>cd next.js-master/examples/basic-css
<add>curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz --strip=2 next.js-master/examples/basic-css
<add>cd basic-css
<ide> ```
<ide>
<ide> or clone the repo:
<ide><path>examples/custom-server-express/README.md
<ide> Download the example:
<ide>
<ide> ```bash
<del>curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz next.js-master/examples/custom-server-express
<del>cd next.js-master/examples/custom-server-express
<add>curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz --strip=2 next.js-master/examples/custom-server-express
<add>cd custom-server-express
<ide> ```
<ide>
<ide> or clone the repo:
<ide><path>examples/custom-server/README.md
<ide> Download the example:
<ide>
<ide> ```bash
<del>curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz next.js-master/examples/custom-server
<del>cd next.js-master/examples/custom-server
<add>curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz --strip=2 next.js-master/examples/custom-server
<add>cd custom-server
<ide> ```
<ide>
<ide> or clone the repo:
<ide><path>examples/head-elements/README.md
<ide> Download the example:
<ide>
<ide> ```bash
<del>curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz next.js-master/examples/head-elements
<del>cd next.js-master/examples/head-elements
<add>curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz --strip=2 next.js-master/examples/head-elements
<add>cd head-elements
<ide> ```
<ide>
<ide> or clone the repo:
<ide><path>examples/hello-world/README.md
<ide> Download the example:
<ide>
<ide> ```bash
<del>curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz next.js-master/examples/hello-world
<del>cd next.js-master/examples/hello-world
<add>curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz --strip=2 next.js-master/examples/hello-world
<add>cd hello-world
<ide> ```
<ide>
<ide> or clone the repo:
<ide><path>examples/nested-components/README.md
<ide> Download the example:
<ide>
<ide> ```bash
<del>curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz next.js-master/examples/nested-components
<del>cd next.js-master/examples/nested-components
<add>curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz --strip=2 next.js-master/examples/nested-components
<add>cd nested-components
<ide> ```
<ide>
<ide> or clone the repo:
<ide><path>examples/parameterized-routing/README.md
<ide> Download the example:
<ide>
<ide> ```bash
<del>curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz next.js-master/examples/parametrized-routing
<del>cd next.js-master/examples/parametrized-routing
<add>curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz --strip=2 next.js-master/examples/parametrized-routing
<add>cd parametrized-routing
<ide> ```
<ide>
<ide> or clone the repo:
<ide><path>examples/shared-modules/README.md
<ide> Download the example:
<ide>
<ide> ```bash
<del>curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz next.js-master/examples/shared-modules
<del>cd next.js-master/examples/shared-modules
<add>curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz --strip=2 next.js-master/examples/shared-modules
<add>cd shared-modules
<ide> ```
<ide>
<ide> or clone the repo:
<ide><path>examples/using-router/README.md
<ide> Download the example:
<ide>
<ide> ```bash
<del>curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz next.js-master/examples/using-router
<del>cd next.js-master/examples/using-router
<add>curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz --strip=2 next.js-master/examples/using-router
<add>cd using-router
<ide> ```
<ide>
<ide> or clone the repo:
<ide><path>examples/with-prefetching/README.md
<ide> Download the example:
<ide>
<ide> ```bash
<del>curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz next.js-master/examples/with-prefetching
<del>cd next.js-master/examples/with-prefetching
<add>curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz --strip=2 next.js-master/examples/with-prefetching
<add>cd with-prefetching
<ide> ```
<ide>
<ide> or clone the repo:
<ide><path>examples/with-redux/README.md
<ide> Download the example:
<ide>
<ide> ```bash
<del>curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz next.js-master/examples/with-redux
<del>cd next.js-master/examples/with-redux
<add>curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz --strip=2 next.js-master/examples/with-redux
<add>cd with-redux
<ide> ```
<ide>
<ide> or clone the repo:
<ide><path>examples/with-styled-components/README.md
<ide> Download the example:
<ide>
<ide> ```bash
<del>curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz next.js-master/examples/with-styles-components
<del>cd next.js-master/examples/with-styled-components
<add>curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz --strip=2 next.js-master/examples/with-styles-components
<add>cd with-styled-components
<ide> ```
<ide>
<ide> or clone the repo: | 12 |
Javascript | Javascript | fix error and callback handling | ca2179f0c23dd0e0662c13053c5c54cf9c2870d3 | <ide><path>lib/FileSystemInfo.js
<ide> class FileSystemInfo {
<ide> if (cache !== undefined) {
<ide> const resolved = getResolvedTimestamp(cache);
<ide> if (resolved !== undefined) return callback(null, resolved);
<del> this._resolveContextTimestamp(cache, callback);
<add> return this._resolveContextTimestamp(cache, callback);
<ide> }
<ide> this.contextTimestampQueue.add(path, (err, entry) => {
<add> if (err) return callback(err);
<ide> const resolved = getResolvedTimestamp(entry);
<ide> if (resolved !== undefined) return callback(null, resolved);
<ide> this._resolveContextTimestamp(entry, callback);
<ide> class FileSystemInfo {
<ide> _getUnresolvedContextTimestamp(path, callback) {
<ide> const cache = this._contextTimestamps.get(path);
<ide> if (cache !== undefined) return callback(null, cache);
<del> this.contextTimestampQueue.add(path, (err, entry) => {
<del> return callback(null, entry);
<del> });
<add> this.contextTimestampQueue.add(path, callback);
<ide> }
<ide>
<ide> /**
<ide> class FileSystemInfo {
<ide> if (cache !== undefined) {
<ide> const resolved = getResolvedHash(cache);
<ide> if (resolved !== undefined) return callback(null, resolved);
<del> this._resolveContextHash(cache, callback);
<add> return this._resolveContextHash(cache, callback);
<ide> }
<ide> this.contextHashQueue.add(path, (err, entry) => {
<add> if (err) return callback(err);
<ide> const resolved = getResolvedHash(entry);
<ide> if (resolved !== undefined) return callback(null, resolved);
<ide> this._resolveContextHash(entry, callback);
<ide> class FileSystemInfo {
<ide> _getUnresolvedContextHash(path, callback) {
<ide> const cache = this._contextHashes.get(path);
<ide> if (cache !== undefined) return callback(null, cache);
<del> this.contextHashQueue.add(path, (err, entry) => {
<del> return callback(null, entry);
<del> });
<add> this.contextHashQueue.add(path, callback);
<ide> }
<ide>
<ide> /**
<ide> class FileSystemInfo {
<ide> if (cache !== undefined) {
<ide> const resolved = getResolvedTimestamp(cache);
<ide> if (resolved !== undefined) return callback(null, resolved);
<del> this._resolveContextTsh(cache, callback);
<add> return this._resolveContextTsh(cache, callback);
<ide> }
<ide> this.contextTshQueue.add(path, (err, entry) => {
<add> if (err) return callback(err);
<ide> const resolved = getResolvedTimestamp(entry);
<ide> if (resolved !== undefined) return callback(null, resolved);
<ide> this._resolveContextTsh(entry, callback);
<ide> class FileSystemInfo {
<ide> _getUnresolvedContextTsh(path, callback) {
<ide> const cache = this._contextTshs.get(path);
<ide> if (cache !== undefined) return callback(null, cache);
<del> this.contextTshQueue.add(path, (err, entry) => {
<del> return callback(null, entry);
<del> });
<add> this.contextTshQueue.add(path, callback);
<ide> }
<ide>
<ide> _createBuildDependenciesResolvers() { | 1 |
Ruby | Ruby | hide `update` from `brew cask help` | c31f959ec1955999d4be4446914eaab2e715058a | <ide><path>Library/Homebrew/compat/hbc/cli/update.rb
<ide> def self.run(*_ignored)
<ide> exit result.exit_status
<ide> end
<ide>
<add> def self.visible
<add> false
<add> end
<add>
<ide> def self.help
<del> Formatter.warning("deprecated: use `brew update` instead")
<add> "a synonym for 'brew update'"
<ide> end
<ide> end
<ide> end | 1 |
Javascript | Javascript | render highlights behind lines | 3d21ac0742dc5fdc9c18585d81ba601e730151e9 | <ide><path>src/text-editor-component.js
<ide> class TextEditorComponent {
<ide> }
<ide>
<ide> renderLineTiles () {
<del> const children = []
<ide> const style = {
<ide> position: 'absolute',
<ide> contain: 'strict',
<ide> overflow: 'hidden'
<ide> }
<ide>
<add> const children = []
<add> children.push(this.renderHighlightDecorations())
<add>
<ide> if (this.hasInitialMeasurements) {
<ide> const {lineComponentsByScreenLineId} = this
<ide>
<ide> class TextEditorComponent {
<ide> }
<ide>
<ide> children.push(this.renderPlaceholderText())
<del> children.push(this.renderHighlightDecorations())
<ide> children.push(this.renderCursorsAndInput())
<ide>
<ide> return $.div( | 1 |
Go | Go | remove windowsdiff driver | dd0fc2be8b8b0bbac3d3a478ae6939d9b742612d | <ide><path>daemon/graphdriver/driver_windows.go
<ide> var (
<ide> // Slice of drivers that should be used in order
<ide> priority = []string{
<ide> "windowsfilter",
<del> "windowsdiff",
<del> "vfs",
<ide> }
<ide> )
<ide>
<ide><path>daemon/graphdriver/windows/windows.go
<ide> import (
<ide> "github.com/Sirupsen/logrus"
<ide> "github.com/docker/docker/daemon/graphdriver"
<ide> "github.com/docker/docker/pkg/archive"
<del> "github.com/docker/docker/pkg/chrootarchive"
<ide> "github.com/docker/docker/pkg/idtools"
<ide> "github.com/docker/docker/pkg/ioutils"
<ide> "github.com/docker/docker/pkg/longpath"
<ide> import (
<ide> "github.com/vbatts/tar-split/tar/storage"
<ide> )
<ide>
<add>// filterDriver is an HCSShim driver type for the Windows Filter driver.
<add>const filterDriver = 1
<add>
<ide> // init registers the windows graph drivers to the register.
<ide> func init() {
<ide> graphdriver.Register("windowsfilter", InitFilter)
<del> graphdriver.Register("windowsdiff", InitDiff)
<ide> reexec.Register("docker-windows-write-layer", writeLayer)
<ide> }
<ide>
<del>const (
<del> // diffDriver is an hcsshim driver type
<del> diffDriver = iota
<del> // filterDriver is an hcsshim driver type
<del> filterDriver
<del>)
<del>
<ide> // Driver represents a windows graph driver.
<ide> type Driver struct {
<ide> // info stores the shim driver information
<ide> info hcsshim.DriverInfo
<ide> }
<ide>
<del>var _ graphdriver.DiffGetterDriver = &Driver{}
<del>
<ide> func isTP5OrOlder() bool {
<ide> return system.GetOSVersion().Build <= 14300
<ide> }
<ide> func InitFilter(home string, options []string, uidMaps, gidMaps []idtools.IDMap)
<ide> return d, nil
<ide> }
<ide>
<del>// InitDiff returns a new Windows differencing disk driver.
<del>func InitDiff(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (graphdriver.Driver, error) {
<del> logrus.Debugf("WindowsGraphDriver InitDiff at %s", home)
<del> d := &Driver{
<del> info: hcsshim.DriverInfo{
<del> HomeDir: home,
<del> Flavour: diffDriver,
<del> },
<del> }
<del> return d, nil
<del>}
<del>
<ide> // String returns the string representation of a driver.
<ide> func (d *Driver) String() string {
<del> switch d.info.Flavour {
<del> case diffDriver:
<del> return "windowsdiff"
<del> case filterDriver:
<del> return "windowsfilter"
<del> default:
<del> return "Unknown driver flavour"
<del> }
<add> return "Windows filter storage driver"
<ide> }
<ide>
<ide> // Status returns the status of the driver.
<ide> func (d *Driver) Changes(id, parent string) ([]archive.Change, error) {
<ide> // new layer in bytes.
<ide> // The layer should not be mounted when calling this function
<ide> func (d *Driver) ApplyDiff(id, parent string, diff archive.Reader) (int64, error) {
<del> if d.info.Flavour == diffDriver {
<del> start := time.Now().UTC()
<del> logrus.Debugf("WindowsGraphDriver ApplyDiff: Start untar layer")
<del> destination := d.dir(id)
<del> destination = filepath.Dir(destination)
<del> size, err := chrootarchive.ApplyUncompressedLayer(destination, diff, nil)
<del> if err != nil {
<del> return 0, err
<del> }
<del> logrus.Debugf("WindowsGraphDriver ApplyDiff: Untar time: %vs", time.Now().UTC().Sub(start).Seconds())
<del>
<del> return size, nil
<del> }
<del>
<ide> var layerChain []string
<ide> if parent != "" {
<ide> rPId, err := d.resolveID(parent) | 2 |
Ruby | Ruby | let change_make_var! append to existing value | 5474cf1a95616243f5592c8c5951048ea5cbafe3 | <ide><path>Library/Homebrew/utils.rb
<ide> module HomebrewInreplaceExtension
<ide> # Looks for Makefile style variable defintions and replaces the
<ide> # value with "new_value", or removes the definition entirely.
<ide> # See inreplace in utils.rb
<del> def change_make_var! flag, new_value
<del> new_value = "#{flag}=#{new_value}" unless new_value.to_s.empty?
<del> gsub! Regexp.new("^#{flag}\\s*=.*$"), new_value.to_s
<add> def change_make_var! flag, new_value=nil
<add> new_value = "#{flag}=#{new_value}" unless new_value == nil
<add> gsub! Regexp.new("^#{flag}\\s*=\\s*(.*)$"), new_value
<ide> end
<ide> def remove_make_var! flags
<ide> flags.each { |flag| change_make_var! flag, "" } | 1 |
Python | Python | redefine alphabetic characters | 33af52599e3aac9834ec2f104556e6ef67bce968 | <ide><path>spacy/language_data/punctuation.py
<ide> # coding: utf8
<ide> from __future__ import unicode_literals
<ide>
<del>import re
<del>
<del>
<del>_ALPHA_LOWER = """
<del>a ä à á â ǎ æ ã å ā ă ą b c ç ć č ĉ ċ c̄ d ð ď e é è ê ë ė ȅ ȩ ẽ ę f g ĝ ğ h i ı
<del>î ï í ī ì ȉ ǐ į ĩ j k ķ l ł ļ m n ñ ń ň ņ o ö ó ò ő ô õ œ ø ō ő ǒ ơ p q r ř ŗ s
<del>ß ś š ş ŝ t ť u ú û ù ú ū ű ǔ ů ų ư v w ŵ x y ÿ ý ỳ ŷ ỹ z ź ž ż þ
<del>"""
<del>
<del>
<del>_ALPHA_UPPER = """
<del>A Ä À Á Â Ǎ Æ Ã Å Ā Ă Ą B C Ç Ć Č Ĉ Ċ C̄ D Ð Ď E É È Ê Ë Ė Ȅ Ȩ Ẽ Ę F G Ĝ Ğ H I İ
<del>Î Ï Í Ī Ì Ȉ Ǐ Į Ĩ J K Ķ L Ł Ļ M N Ñ Ń Ň Ņ O Ö Ó Ò Ő Ô Õ Œ Ø Ō Ő Ǒ Ơ P Q R Ř Ŗ S
<del>Ś Š Ş Ŝ T Ť U Ú Û Ù Ú Ū Ű Ǔ Ů Ų Ư V W Ŵ X Y Ÿ Ý Ỳ Ŷ Ỹ Z Ź Ž Ż Þ
<del>"""
<ide> import regex as re
<ide> re.DEFAULT_VERSION = re.VERSION1
<ide>
<ide> LIST_HYPHENS = list(_HYPHENS.strip().split())
<ide>
<ide>
<del>ALPHA_LOWER = _ALPHA_LOWER.strip().replace(' ', '').replace('\n', '')
<del>ALPHA_UPPER = _ALPHA_UPPER.strip().replace(' ', '').replace('\n', '')
<del>ALPHA = ALPHA_LOWER + ALPHA_UPPER
<add>BENGALI = r'[\p{L}&&\p{Bengali}]'
<add>HEBREW = r'[\p{L}&&\p{Hebrew}]'
<add>LATIN_LOWER = r'[\p{Ll}&&\p{Latin}]'
<add>LATIN_UPPER = r'[\p{Lu}&&\p{Latin}]'
<add>LATIN = r'[[\p{Ll}||\p{Lu}]&&\p{Latin}]'
<add>
<add>
<add>ALPHA_LOWER = '[{}]'.format('||'.join([BENGALI, HEBREW, LATIN_LOWER]))
<add>ALPHA_UPPER = '[{}]'.format('||'.join([BENGALI, HEBREW, LATIN_UPPER]))
<add>ALPHA = '[{}]'.format('||'.join([BENGALI, HEBREW, LATIN]))
<ide>
<ide>
<ide> QUOTES = _QUOTES.strip().replace(' ', '|') | 1 |
Ruby | Ruby | fix arguments order on assertion | a3f030686bbcfb215ae5635e1c7a92d0346db732 | <ide><path>activemodel/test/cases/errors_test.rb
<ide> def test_no_key
<ide> test "delete returns the deleted messages" do
<ide> errors = ActiveModel::Errors.new(Person.new)
<ide> errors.add(:name, :invalid)
<del> assert_equal errors.delete(:name), ["is invalid"]
<add> assert_equal ["is invalid"], errors.delete(:name)
<ide> end
<ide>
<ide> test "clear removes details" do | 1 |
Ruby | Ruby | use direct 'available?' logic | 1b084b5aa021d5399f4bc560ccab715766f09c16 | <ide><path>Library/Homebrew/requirements/gpg2_requirement.rb
<ide> class GPG2Requirement < Requirement
<ide> # GPGTools installs GnuPG 2.0.x as a `gpg` symlink pointing
<ide> # to `gpg2`. Our `gnupg` installs only a non-symlink `gpg`.
<ide> # The aim is to retain support for any version above 2.0.
<del> satisfy(build_env: false) { Gpg.gpg || Gpg.gpg2 }
<add> satisfy(build_env: false) { Gpg.available? }
<ide> end | 1 |
Text | Text | fix indentation in `configuring.md` [ci skip] | 789fa4d9342ea8baee2dde1109c8e1db695cab11 | <ide><path>guides/source/configuring.md
<ide> The schema dumper adds two additional configuration options:
<ide> Rendered recordings/threads/_thread.html.erb in 1.5 ms [cache miss]
<ide> ```
<ide>
<del> By default it is set to `false` which results in following output:
<add> By default it is set to `false` which results in following output:
<ide>
<ide> ```
<ide> Rendered messages/_message.html.erb in 1.2 ms [cache hit] | 1 |
Text | Text | add note about email sync to contributing.md | 6d4c68523d235545f14e1961dcef68d174b00d55 | <ide><path>CONTRIBUTING.md
<ide> who you are:
<ide> $ git config --global user.name "J. Random User"
<ide> $ git config --global user.email "[email protected]"
<ide> ```
<add>Please make sure this local email is also added to your
<add>[GitHub email list](https://github.com/settings/emails) so that your commits
<add>will be properly associated with your account and you will be promoted
<add>to Contributor once your first commit is landed.
<ide>
<ide> #### Step 1: Fork
<ide> | 1 |
Javascript | Javascript | fix live editor examples on home page | b46b6a8db90c2316c3e9e7d77ab6d620a6b4f775 | <ide><path>docs/_js/live_editor.js
<ide> var CodeMirrorEditor = React.createClass({
<ide> }
<ide>
<ide> return (
<del> <div class={this.props.className}>
<add> <div className={this.props.className}>
<ide> {editor}
<ide> </div>
<ide> );
<ide> var ReactPlayground = React.createClass({
<ide> content =
<ide> <CodeMirrorEditor
<ide> onChange={this.bindState('code')}
<del> class="playgroundStage"
<add> className="playgroundStage"
<ide> codeText={this.state.code}
<ide> />;
<ide> } else if (this.state.mode === this.MODES.JS) {
<ide> content =
<del> <div class="playgroundJS playgroundStage">
<add> <div className="playgroundJS playgroundStage">
<ide> {this.getDesugaredCode()}
<ide> </div>;
<ide> }
<ide>
<ide> return (
<del> <div class="playground">
<del> <div class="playgroundCode">
<add> <div className="playground">
<add> <div className="playgroundCode">
<ide> {content}
<ide> </div>
<del> <div class="playgroundPreview">
<add> <div className="playgroundPreview">
<ide> <div ref="mount" />
<ide> </div>
<ide> </div>
<ide> var ReactPlayground = React.createClass({
<ide> }
<ide> } catch (e) {
<ide> React.renderComponent(
<del> <div content={e.toString()} class="playgroundError" />,
<add> <div content={e.toString()} className="playgroundError" />,
<ide> mountNode
<ide> );
<ide> } | 1 |
Python | Python | try different drop_layer structure in tok2vec | 4ab0c8c8e9b3320675e6a5e20d39db0be7fa0210 | <ide><path>spacy/_ml.py
<ide> def backward(dYp_ids, sgd=None):
<ide> return Yfp, backward
<ide>
<ide>
<del>def drop_layer(layer, factor=1.0):
<add>def drop_layer(layer, factor=2.):
<ide> def drop_layer_fwd(X, drop=0.):
<ide> drop *= factor
<ide> mask = layer.ops.get_dropout_mask((1,), drop)
<del> if mask is not None and mask[0] == 0.:
<del> return X, lambda dX, sgd=None: dX
<del> else:
<add> if mask is None or mask > 0:
<ide> return layer.begin_update(X, drop=drop)
<add> else:
<add> return X, lambda dX, sgd=None: dX
<ide> return wrap(drop_layer_fwd, layer)
<ide>
<ide>
<ide> def Tok2Vec(width, embed_size, preprocess=None):
<ide> suffix = get_col(cols.index(SUFFIX)) >> HashEmbed(width, embed_size//2, name='embed_suffix')
<ide> shape = get_col(cols.index(SHAPE)) >> HashEmbed(width, embed_size//2, name='embed_shape')
<ide>
<del> embed = (norm | prefix | suffix | shape )
<add> embed = (norm | prefix | suffix | shape ) >> Maxout(width, width*4, pieces=3)
<ide> tok2vec = (
<ide> with_flatten(
<ide> asarray(Model.ops, dtype='uint64')
<del> >> uniqued(embed >> Maxout(width, width*4, pieces=3), column=5)
<del> >> Residual(
<del> (ExtractWindow(nW=1) >> ReLu(width, width*3))
<del> >> (ExtractWindow(nW=1) >> ReLu(width, width*3))
<del> >> (ExtractWindow(nW=1) >> ReLu(width, width*3))
<del> >> (ExtractWindow(nW=1) >> ReLu(width, width*3))
<del> ), pad=4)
<add> >> uniqued(embed, column=5)
<add> >> drop_layer(
<add> Residual(
<add> (ExtractWindow(nW=1) >> ReLu(width, width*3))
<add> )
<add> ) ** 4, pad=4
<add> )
<ide> )
<ide> if preprocess not in (False, None):
<ide> tok2vec = preprocess >> tok2vec | 1 |
PHP | PHP | enable subcommands to use spaces | 0c8ce430a2c0347ca316435570fe41fa607936fe | <ide><path>src/Console/CommandRunner.php
<ide> public function run(array $argv, ConsoleIo $io = null)
<ide> array_shift($argv);
<ide>
<ide> $io = $io ?: new ConsoleIo();
<del> $name = $this->resolveName($commands, $io, array_shift($argv));
<add>
<add> list($name, $argv) = $this->longestCommandName($commands, $argv);
<add> $name = $this->resolveName($commands, $io, $name);
<ide>
<ide> $result = Shell::CODE_ERROR;
<ide> $shell = $this->getShell($io, $commands, $name);
<ide> protected function getShell(ConsoleIo $io, CommandCollection $commands, $name)
<ide> return $instance;
<ide> }
<ide>
<add> /**
<add> * Build the longest command name that exists in the collection
<add> *
<add> * Build the longest command name that matches a
<add> * defined command. This will traverse a maximum of 3 tokens.
<add> *
<add> * @param \Cake\Console\CommandCollection $commands The command collection to check.
<add> * @param array $argv The CLI arguments.
<add> * @return array An array of the resolved name and modified argv.
<add> */
<add> protected function longestCommandName($commands, $argv)
<add> {
<add> for ($i = 3; $i > 1; $i--) {
<add> $parts = array_slice($argv, 0, $i);
<add> $name = implode(' ', $parts);
<add> if ($commands->has($name)) {
<add> return [$name, array_slice($argv, $i)];
<add> }
<add> }
<add> $name = array_shift($argv);
<add>
<add> return [$name, $argv];
<add> }
<add>
<ide> /**
<ide> * Resolve the command name into a name that exists in the collection.
<ide> *
<ide> * Apply backwards compatible inflections and aliases.
<add> * Will step forward up to 3 tokens in $argv to generate
<add> * a command name in the CommandCollection. More specific
<add> * command names take precedence over less specific ones.
<ide> *
<ide> * @param \Cake\Console\CommandCollection $commands The command collection to check.
<ide> * @param \Cake\Console\ConsoleIo $io ConsoleIo object for errors.
<del> * @param string $name The name from the CLI args.
<del> * @return string The resolved name.
<add> * @param string $name The name
<add> * @return string The resolved class name
<ide> */
<ide> protected function resolveName($commands, $io, $name)
<ide> {
<ide><path>tests/TestCase/Console/CommandRunnerTest.php
<ide> use Cake\TestSuite\Stub\ConsoleOutput;
<ide> use Cake\TestSuite\TestCase;
<ide> use InvalidArgumentException;
<add>use TestApp\Command\AbortCommand;
<ide> use TestApp\Command\DemoCommand;
<ide> use TestApp\Shell\SampleShell;
<ide>
<ide> public function testRunValidCommandClass()
<ide> $this->assertContains('Demo Command!', $messages);
<ide> }
<ide>
<add> /**
<add> * Test running a valid command with spaces in the name
<add> *
<add> * @return void
<add> */
<add> public function testRunValidCommandSubcommandName()
<add> {
<add> $app = $this->makeAppWithCommands([
<add> 'tool build' => DemoCommand::class,
<add> 'tool' => AbortCommand::class
<add> ]);
<add> $output = new ConsoleOutput();
<add>
<add> $runner = new CommandRunner($app, 'cake');
<add> $result = $runner->run(['cake', 'tool', 'build'], $this->getMockIo($output));
<add> $this->assertSame(Shell::CODE_SUCCESS, $result);
<add>
<add> $messages = implode("\n", $output->messages());
<add> $this->assertContains('Demo Command!', $messages);
<add> }
<add>
<add> /**
<add> * Test running a valid command with spaces in the name
<add> *
<add> * @return void
<add> */
<add> public function testRunValidCommandNestedName()
<add> {
<add> $app = $this->makeAppWithCommands([
<add> 'tool build assets' => DemoCommand::class,
<add> 'tool' => AbortCommand::class
<add> ]);
<add> $output = new ConsoleOutput();
<add>
<add> $runner = new CommandRunner($app, 'cake');
<add> $result = $runner->run(['cake', 'tool', 'build', 'assets'], $this->getMockIo($output));
<add> $this->assertSame(Shell::CODE_SUCCESS, $result);
<add>
<add> $messages = implode("\n", $output->messages());
<add> $this->assertContains('Demo Command!', $messages);
<add> }
<add>
<ide> /**
<ide> * Test using a custom factory
<ide> * | 2 |
Ruby | Ruby | convert descriptions test to spec | 66735b91a316e2d56ad484699178496da5c83656 | <ide><path>Library/Homebrew/test/descriptions_spec.rb
<add>require "descriptions"
<add>
<add>describe Descriptions do
<add> subject { described_class.new(descriptions_hash) }
<add> let(:descriptions_hash) { {} }
<add>
<add> it "can print description for a core Formula" do
<add> descriptions_hash["homebrew/core/foo"] = "Core foo"
<add> expect { subject.print }.to output("foo: Core foo\n").to_stdout
<add> end
<add>
<add> it "can print description for an external Formula" do
<add> descriptions_hash["somedev/external/foo"] = "External foo"
<add> expect { subject.print }.to output("foo: External foo\n").to_stdout
<add> end
<add>
<add> it "can print descriptions for duplicate Formulae" do
<add> descriptions_hash["homebrew/core/foo"] = "Core foo"
<add> descriptions_hash["somedev/external/foo"] = "External foo"
<add>
<add> expect { subject.print }.to output(
<add> <<-EOS.undent
<add> homebrew/core/foo: Core foo
<add> somedev/external/foo: External foo
<add> EOS
<add> ).to_stdout
<add> end
<add>
<add> it "can print descriptions for duplicate core and external Formulae" do
<add> descriptions_hash["homebrew/core/foo"] = "Core foo"
<add> descriptions_hash["somedev/external/foo"] = "External foo"
<add> descriptions_hash["otherdev/external/foo"] = "Other external foo"
<add>
<add> expect { subject.print }.to output(
<add> <<-EOS.undent
<add> homebrew/core/foo: Core foo
<add> otherdev/external/foo: Other external foo
<add> somedev/external/foo: External foo
<add> EOS
<add> ).to_stdout
<add> end
<add>end
<ide><path>Library/Homebrew/test/descriptions_test.rb
<del>require "testing_env"
<del>require "descriptions"
<del>
<del>class DescriptionsTest < Homebrew::TestCase
<del> def setup
<del> super
<del>
<del> @descriptions_hash = {}
<del> @descriptions = Descriptions.new(@descriptions_hash)
<del>
<del> @old_stdout = $stdout
<del> $stdout = StringIO.new
<del> end
<del>
<del> def teardown
<del> $stdout = @old_stdout
<del> super
<del> end
<del>
<del> def test_single_core_formula
<del> @descriptions_hash["homebrew/core/foo"] = "Core foo"
<del> @descriptions.print
<del> assert_equal "foo: Core foo", $stdout.string.chomp
<del> end
<del>
<del> def test_single_external_formula
<del> @descriptions_hash["somedev/external/foo"] = "External foo"
<del> @descriptions.print
<del> assert_equal "foo: External foo", $stdout.string.chomp
<del> end
<del>
<del> def test_even_dupes
<del> @descriptions_hash["homebrew/core/foo"] = "Core foo"
<del> @descriptions_hash["somedev/external/foo"] = "External foo"
<del> @descriptions.print
<del> assert_equal "homebrew/core/foo: Core foo\nsomedev/external/foo: External foo",
<del> $stdout.string.chomp
<del> end
<del>
<del> def test_odd_dupes
<del> @descriptions_hash["homebrew/core/foo"] = "Core foo"
<del> @descriptions_hash["somedev/external/foo"] = "External foo"
<del> @descriptions_hash["otherdev/external/foo"] = "Other external foo"
<del> @descriptions.print
<del> assert_equal "homebrew/core/foo: Core foo\notherdev/external/foo: Other external foo\nsomedev/external/foo: External foo",
<del> $stdout.string.chomp
<del> end
<del>end | 2 |
Text | Text | update russian translation | 2b4277b5da8d67db3362bec8211d013504f2e2e3 | <ide><path>curriculum/challenges/russian/01-responsive-web-design/applied-accessibility/add-an-accessible-date-picker.russian.md
<ide> id: 587d778b367417b2b2512aa8
<ide> title: Add an Accessible Date Picker
<ide> challengeType: 0
<ide> videoUrl: ''
<del>localeTitle: Добавить доступную дату выбора
<add>localeTitle: Добавить доступный выбор даты
<ide> ---
<ide>
<ide> ## Description
<ide> localeTitle: Добавить доступную дату выбора
<ide>
<ide> ```yml
<ide> tests:
<del> - text: Ваш код должен добавить один тег <code>input</code> для поля выбора даты.
<add> - text: Вы должны добавить один тег <code>input</code> для поля выбора даты.
<ide> testString: 'assert($("input").length == 2, "Your code should add one <code>input</code> tag for the date selector field.");'
<ide> - text: Тег <code>input</code> должен иметь атрибут <code>type</code> со значением даты.
<ide> testString: 'assert($("input").attr("type") == "date", "Your <code>input</code> tag should have a <code>type</code> attribute with a value of date.");' | 1 |
Javascript | Javascript | fix spelling of letter (leter) | 5d44dad43f9e53d39b5179862f552fc0b9a19d40 | <ide><path>Examples/UIExplorer/NavigationExperimental/NavigationTicTacToeExample.js
<ide> const {
<ide> type GameGrid = Array<Array<?string>>;
<ide>
<ide> const evenOddPlayerMap = ['O', 'X'];
<del>const rowLeterMap = ['a', 'b', 'c'];
<add>const rowLetterMap = ['a', 'b', 'c'];
<ide>
<ide> function parseGame(game: string): GameGrid {
<ide> const gameTurns = game ? game.split('-') : [];
<ide> const grid = Array(3);
<ide> for (let i = 0; i < 3; i++) {
<ide> const row = Array(3);
<ide> for (let j = 0; j < 3; j++) {
<del> const turnIndex = gameTurns.indexOf(rowLeterMap[i]+j);
<add> const turnIndex = gameTurns.indexOf(rowLetterMap[i]+j);
<ide> if (turnIndex === -1) {
<ide> row[j] = null;
<ide> } else {
<ide> function parseGame(game: string): GameGrid {
<ide> }
<ide>
<ide> function playTurn(game: string, row: number, col: number): string {
<del> const turn = rowLeterMap[row] + col;
<add> const turn = rowLetterMap[row] + col;
<ide> return game ? (game + '-' + turn) : turn;
<ide> }
<ide> | 1 |
Python | Python | fix imports in test_io.py and test_recfunctions.py | e79d6e306c675eee852a8ebaa26a137d4296841a | <ide><path>numpy/lib/tests/test_io.py
<ide>
<ide> import numpy as np
<ide> import numpy.ma as ma
<del>from numpy.lib._iotools import (ConverterError, ConverterLockError,
<del> ConversionWarning)
<add>from numpy.lib._iotools import (
<add> ConverterError, ConverterLockError, ConversionWarning
<add> )
<ide> from numpy.compat import asbytes, bytes, unicode
<ide> from nose import SkipTest
<del>from numpy.ma.testutils import (
<del> TestCase, assert_equal, assert_array_equal, assert_allclose,
<del> assert_raises, assert_raises_regex, run_module_suite
<del>)
<del>from numpy.testing import assert_warns, assert_, build_err_msg
<add>from numpy.ma.testutils import assert_equal, assert_almost_equal
<add>from numpy.testing import (
<add> TestCase, run_module_suite, assert_warns, assert_, build_err_msg,
<add> assert_raises_regex, assert_raises, assert_allclose,
<add> assert_array_equal,
<add> )
<ide> from numpy.testing.utils import tempdir
<ide>
<ide>
<ide><path>numpy/lib/tests/test_recfunctions.py
<ide> import numpy as np
<ide> import numpy.ma as ma
<ide> from numpy.ma.mrecords import MaskedRecords
<del>from numpy.ma.testutils import (
<del> run_module_suite, TestCase, assert_, assert_equal
<del> )
<add>from numpy.ma.testutils import assert_equal
<add>from numpy.testing import TestCase, run_module_suite, assert_
<ide> from numpy.lib.recfunctions import (
<ide> drop_fields, rename_fields, get_fieldstructure, recursive_fill_fields,
<ide> find_duplicates, merge_arrays, append_fields, stack_arrays, join_by | 2 |
Mixed | Java | implement image.defaultsource property on android | b0fa3228a77d89d6736da6fcae5dd32f74f3052c | <ide><path>Libraries/Image/Image.android.js
<ide> var Image = createReactClass({
<ide> * See https://facebook.github.io/react-native/docs/image.html#blurradius
<ide> */
<ide> blurRadius: PropTypes.number,
<add> /**
<add> * See https://facebook.github.io/react-native/docs/image.html#defaultsource
<add> */
<add> defaultSource: PropTypes.number,
<ide> /**
<ide> * See https://facebook.github.io/react-native/docs/image.html#loadingindicatorsource
<ide> */
<ide> var Image = createReactClass({
<ide>
<ide> render: function() {
<ide> const source = resolveAssetSource(this.props.source);
<add> const defaultSource = resolveAssetSource(this.props.defaultSource);
<ide> const loadingIndicatorSource = resolveAssetSource(
<ide> this.props.loadingIndicatorSource,
<ide> );
<ide> var Image = createReactClass({
<ide> );
<ide> }
<ide>
<add> if (this.props.defaultSource && this.props.loadingIndicatorSource) {
<add> throw new Error(
<add> 'The <Image> component cannot have defaultSource and loadingIndicatorSource at the same time. Please use either defaultSource or loadingIndicatorSource.',
<add> );
<add> }
<add>
<ide> if (source && (source.uri || Array.isArray(source))) {
<ide> let style;
<ide> let sources;
<ide> var Image = createReactClass({
<ide> ),
<ide> src: sources,
<ide> headers: source.headers,
<add> defaultSrc: defaultSource
<add> ? defaultSource.uri
<add> : null,
<ide> loadingIndicatorSrc: loadingIndicatorSource
<ide> ? loadingIndicatorSource.uri
<ide> : null,
<ide> var cfg = {
<ide> nativeOnly: {
<ide> src: true,
<ide> headers: true,
<add> defaultSrc: true,
<ide> loadingIndicatorSrc: true,
<ide> shouldNotifyLoadEvents: true,
<ide> },
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageManager.java
<ide> public void setBlurRadius(ReactImageView view, float blurRadius) {
<ide> view.setBlurRadius(blurRadius);
<ide> }
<ide>
<add> // In JS this is Image.props.defaultSource
<add> @ReactProp(name = "defaultSrc")
<add> public void setDefaultSource(ReactImageView view, @Nullable String source) {
<add> view.setDefaultSource(source);
<add> }
<add>
<ide> // In JS this is Image.props.loadingIndicatorSource.uri
<ide> @ReactProp(name = "loadingIndicatorSrc")
<ide> public void setLoadingIndicatorSource(ReactImageView view, @Nullable String source) {
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageView.java
<ide> public CloseableReference<Bitmap> process(Bitmap source, PlatformBitmapFactory b
<ide>
<ide> private @Nullable ImageSource mImageSource;
<ide> private @Nullable ImageSource mCachedImageSource;
<add> private @Nullable Drawable mDefaultImageDrawable;
<ide> private @Nullable Drawable mLoadingImageDrawable;
<ide> private @Nullable RoundedColorDrawable mBackgroundImageDrawable;
<ide> private int mBackgroundColor = 0x00000000;
<ide> public void setSource(@Nullable ReadableArray sources) {
<ide> mIsDirty = true;
<ide> }
<ide>
<add> public void setDefaultSource(@Nullable String name) {
<add> mDefaultImageDrawable = ResourceDrawableIdHelper.getInstance().getResourceDrawable(getContext(), name);
<add> mIsDirty = true;
<add> }
<add>
<ide> public void setLoadingIndicatorSource(@Nullable String name) {
<ide> Drawable drawable = ResourceDrawableIdHelper.getInstance().getResourceDrawable(getContext(), name);
<ide> mLoadingImageDrawable =
<ide> public void maybeUpdateView() {
<ide> GenericDraweeHierarchy hierarchy = getHierarchy();
<ide> hierarchy.setActualImageScaleType(mScaleType);
<ide>
<add> if (mDefaultImageDrawable != null) {
<add> hierarchy.setPlaceholderImage(mDefaultImageDrawable, ScalingUtils.ScaleType.CENTER);
<add> }
<add>
<ide> if (mLoadingImageDrawable != null) {
<ide> hierarchy.setPlaceholderImage(mLoadingImageDrawable, ScalingUtils.ScaleType.CENTER);
<ide> } | 3 |
Javascript | Javascript | catch xr.supportssession() rejection | d6907618cd3e4ca8963dfd526f445ddede17026a | <ide><path>examples/js/vr/WebVR.js
<ide> var WEBVR = {
<ide>
<ide> stylizeElement( button );
<ide>
<del> navigator.xr.supportsSession( 'immersive-vr' ).then( showEnterXR );
<add> navigator.xr.supportsSession( 'immersive-vr' ).then( showEnterXR ).catch( showVRNotFound );
<ide>
<ide> return button;
<ide> | 1 |
PHP | PHP | add return typehint | f565d2a7d04901b2c69f12494610695e61c94740 | <ide><path>src/Console/ConsoleIo.php
<ide> public function success($message = null, int $newlines = 1, int $level = self::N
<ide> * @return void
<ide> * @throws \Cake\Console\Exception\StopException
<ide> */
<del> public function abort($message, $code = Command::CODE_ERROR)
<add> public function abort($message, $code = Command::CODE_ERROR): void
<ide> {
<ide> $this->error($message);
<ide> | 1 |
PHP | PHP | introduce restorelock function | 50a69b7a5e94ea187a4c689087e659d85eedb456 | <ide><path>src/Illuminate/Cache/MemcachedStore.php
<ide> public function lock($name, $seconds = 0, $owner = null)
<ide> return new MemcachedLock($this->memcached, $this->prefix.$name, $seconds, $owner);
<ide> }
<ide>
<add> /**
<add> * Restore a lock instance using the owner identifier.
<add> *
<add> * @param string $name
<add> * @param string $owner
<add> * @return \Illuminate\Contracts\Cache\Lock
<add> */
<add> public function restoreLock($name, $owner)
<add> {
<add> return $this->lock($name, 0, $owner);
<add> }
<add>
<ide> /**
<ide> * Remove an item from the cache.
<ide> *
<ide><path>src/Illuminate/Cache/RedisStore.php
<ide> public function lock($name, $seconds = 0, $owner = null)
<ide> return new RedisLock($this->connection(), $this->prefix.$name, $seconds, $owner);
<ide> }
<ide>
<add> /**
<add> * Restore a lock instance using the owner identifier.
<add> *
<add> * @param string $name
<add> * @param string $owner
<add> * @return \Illuminate\Contracts\Cache\Lock
<add> */
<add> public function restoreLock($name, $owner)
<add> {
<add> return $this->lock($name, 0, $owner);
<add> }
<add>
<ide> /**
<ide> * Remove an item from the cache.
<ide> *
<ide><path>src/Illuminate/Contracts/Cache/LockProvider.php
<ide> interface LockProvider
<ide> *
<ide> * @param string $name
<ide> * @param int $seconds
<add> * @param string|null $owner
<ide> * @return \Illuminate\Contracts\Cache\Lock
<ide> */
<del> public function lock($name, $seconds = 0);
<add> public function lock($name, $seconds = 0, $owner = null);
<add>
<add> /**
<add> * Restore a lock instance using the owner identifier.
<add> *
<add> * @param string $name
<add> * @param string $owner
<add> * @return \Illuminate\Contracts\Cache\Lock
<add> */
<add> public function restoreLock($name, $owner);
<ide> }
<ide><path>tests/Integration/Cache/MemcachedCacheLockTest.php
<ide> public function test_memcached_locks_can_be_released_using_owner_token()
<ide> $this->assertTrue($firstLock->get());
<ide> $owner = $firstLock->getOwner();
<ide>
<del> $secondLock = Cache::store('memcached')->lock('foo', 10, $owner);
<add> $secondLock = Cache::store('memcached')->restoreLock('foo', $owner);
<ide> $secondLock->release();
<ide>
<ide> $this->assertTrue(Cache::store('memcached')->lock('foo')->get());
<ide><path>tests/Integration/Cache/RedisCacheLockTest.php
<ide> public function test_redis_locks_can_be_released_using_owner_token()
<ide> $this->assertTrue($firstLock->get());
<ide> $owner = $firstLock->getOwner();
<ide>
<del> $secondLock = Cache::store('redis')->lock('foo', 10, $owner);
<add> $secondLock = Cache::store('redis')->restoreLock('foo', $owner);
<ide> $secondLock->release();
<ide>
<ide> $this->assertTrue(Cache::store('redis')->lock('foo')->get()); | 5 |
Ruby | Ruby | improve performance of multibyte utils | 67d8b9743add53f908ca417c641c4a54dd326c7d | <ide><path>activesupport/lib/active_support/multibyte/utils.rb
<ide> def self.verify(string)
<ide> def self.verify(string)
<ide> if expression = valid_character
<ide> # Splits the string on character boundaries, which are determined based on $KCODE.
<del> string.split(//).all? { |c| expression.match(c) }
<add> string.split(//).all? { |c| expression =~ c }
<ide> else
<ide> true
<ide> end | 1 |
Ruby | Ruby | check sbin too | 87686d861051f25018288d6dab1333daef2e038f | <ide><path>Library/Homebrew/formula_installer.rb
<ide> def caveats
<ide> @show_summary_heading = true
<ide> else
<ide> audit_bin
<add> audit_sbin
<ide> audit_lib
<ide> check_manpages
<ide> check_infopages
<ide> def check_non_libraries
<ide> def audit_bin
<ide> return unless File.exist? f.bin
<ide>
<del> non_exes = f.bin.children.select {|g| not File.executable? g}
<add> non_exes = f.bin.children.select {|g| File.directory? g or not File.executable? g}
<ide>
<ide> unless non_exes.empty?
<ide> opoo 'Non-executables were installed to "bin".'
<ide> def audit_bin
<ide> end
<ide> end
<ide>
<add> def audit_sbin
<add> return unless File.exist? f.sbin
<add>
<add> non_exes = f.sbin.children.select {|g| File.directory? g or not File.executable? g}
<add>
<add> unless non_exes.empty?
<add> opoo 'Non-executables were installed to "sbin".'
<add> puts "Installing non-executables to \"sbin\" is bad practice."
<add> puts "The offending files are:"
<add> puts non_exes
<add> @show_summary_heading = true
<add> end
<add> end
<add>
<ide> def audit_lib
<ide> check_jars
<ide> check_non_libraries | 1 |
Ruby | Ruby | add missing comment out [ci skip] | 58156a803e9bc0ad972da5a4d0766f1c24398e33 | <ide><path>activesupport/lib/active_support/core_ext/enumerable.rb
<ide> module Enumerable
<ide> #
<ide> # [5, 15, 10].sum # => 30
<ide> # ['foo', 'bar'].sum # => "foobar"
<del> # [[1, 2], [3, 1, 5]].sum => [1, 2, 3, 1, 5]
<add> # [[1, 2], [3, 1, 5]].sum # => [1, 2, 3, 1, 5]
<ide> #
<ide> # The default sum of an empty list is zero. You can override this default:
<ide> #
<ide> def sum(identity = nil, &block)
<ide> # Convert an enumerable to a hash.
<ide> #
<ide> # people.index_by(&:login)
<del> # => { "nextangle" => <Person ...>, "chade-" => <Person ...>, ...}
<add> # # => { "nextangle" => <Person ...>, "chade-" => <Person ...>, ...}
<ide> # people.index_by { |person| "#{person.first_name} #{person.last_name}" }
<del> # => { "Chade- Fowlersburg-e" => <Person ...>, "David Heinemeier Hansson" => <Person ...>, ...}
<add> # # => { "Chade- Fowlersburg-e" => <Person ...>, "David Heinemeier Hansson" => <Person ...>, ...}
<ide> def index_by
<ide> if block_given?
<ide> result = {}
<ide> def exclude?(object)
<ide> # Returns a copy of the enumerable without the specified elements.
<ide> #
<ide> # ["David", "Rafael", "Aaron", "Todd"].without "Aaron", "Todd"
<del> # => ["David", "Rafael"]
<add> # # => ["David", "Rafael"]
<ide> #
<ide> # {foo: 1, bar: 2, baz: 3}.without :bar
<del> # => {foo: 1, baz: 3}
<add> # # => {foo: 1, baz: 3}
<ide> def without(*elements)
<ide> reject { |element| elements.include?(element) }
<ide> end
<ide>
<ide> # Convert an enumerable to an array based on the given key.
<ide> #
<ide> # [{ name: "David" }, { name: "Rafael" }, { name: "Aaron" }].pluck(:name)
<del> # => ["David", "Rafael", "Aaron"]
<add> # # => ["David", "Rafael", "Aaron"]
<ide> #
<ide> # [{ id: 1, name: "David" }, { id: 2, name: "Rafael" }].pluck(:id, :name)
<del> # => [[1, "David"], [2, "Rafael"]]
<add> # # => [[1, "David"], [2, "Rafael"]]
<ide> def pluck(*keys)
<ide> if keys.many?
<ide> map { |element| keys.map { |key| element[key] } } | 1 |
Javascript | Javascript | fix usages of workspace.panecontainer | 233c29d998808f4522b47aa1f61f273ddecfdc6e | <ide><path>spec/workspace-spec.js
<ide> describe('Workspace', () => {
<ide> pane4 = workspace.getPanes().filter(p => p !== pane1)[0]
<ide> expect(workspace.getActivePane()).toBe(pane4)
<ide> expect(pane4.items).toEqual([editor])
<del> expect(workspace.paneContainer.root.children[0]).toBe(pane1)
<del> expect(workspace.paneContainer.root.children[1]).toBe(pane4)
<add> expect(workspace.getCenter().paneContainer.root.children[0]).toBe(pane1)
<add> expect(workspace.getCenter().paneContainer.root.children[1]).toBe(pane4)
<ide> })
<ide> })
<ide> })
<ide> describe('Workspace', () => {
<ide> pane4 = workspace.getPanes().filter(p => p !== pane1)[0]
<ide> expect(workspace.getActivePane()).toBe(pane4)
<ide> expect(pane4.items).toEqual([editor])
<del> expect(workspace.paneContainer.root.children[0]).toBe(pane1)
<del> expect(workspace.paneContainer.root.children[1]).toBe(pane2)
<add> expect(workspace.getCenter().paneContainer.root.children[0]).toBe(pane1)
<add> expect(workspace.getCenter().paneContainer.root.children[1]).toBe(pane2)
<ide> })
<ide> })
<ide> })
<ide><path>src/workspace-element.js
<ide> class WorkspaceElement extends HTMLElement {
<ide> this.observeScrollbarStyle()
<ide> this.observeTextEditorFontConfig()
<ide>
<del> this.paneContainer = this.viewRegistry.getView(this.model.paneContainer)
<add> this.paneContainer = this.model.getCenter().paneContainer.getElement()
<ide> this.verticalAxis.appendChild(this.paneContainer)
<ide> this.addEventListener('focus', this.handleFocus.bind(this))
<ide>
<ide> this.addEventListener('mousewheel', this.handleMousewheel.bind(this), true)
<ide> window.addEventListener('dragstart', this.handleDragStart)
<ide>
<ide> this.panelContainers = {
<del> top: this.viewRegistry.getView(this.model.panelContainers.top),
<del> left: this.viewRegistry.getView(this.model.panelContainers.left),
<del> right: this.viewRegistry.getView(this.model.panelContainers.right),
<del> bottom: this.viewRegistry.getView(this.model.panelContainers.bottom),
<del> header: this.viewRegistry.getView(this.model.panelContainers.header),
<del> footer: this.viewRegistry.getView(this.model.panelContainers.footer),
<del> modal: this.viewRegistry.getView(this.model.panelContainers.modal)
<add> top: this.model.panelContainers.top.getElement(),
<add> left: this.model.panelContainers.left.getElement(),
<add> right: this.model.panelContainers.right.getElement(),
<add> bottom: this.model.panelContainers.bottom.getElement(),
<add> header: this.model.panelContainers.header.getElement(),
<add> footer: this.model.panelContainers.footer.getElement(),
<add> modal: this.model.panelContainers.modal.getElement()
<ide> }
<ide>
<ide> this.horizontalAxis.insertBefore(this.panelContainers.left, this.verticalAxis) | 2 |
Python | Python | add missing tokenproxy migration | 995188f8c5bfdd0da29a7f9ca01898dfce5f0b37 | <ide><path>rest_framework/authtoken/migrations/0003_tokenproxy.py
<add># Generated by Django 3.1.1 on 2020-09-28 09:34
<add>
<add>from django.db import migrations
<add>
<add>
<add>class Migration(migrations.Migration):
<add>
<add> dependencies = [
<add> ('authtoken', '0002_auto_20160226_1747'),
<add> ]
<add>
<add> operations = [
<add> migrations.CreateModel(
<add> name='TokenProxy',
<add> fields=[
<add> ],
<add> options={
<add> 'verbose_name': 'token',
<add> 'proxy': True,
<add> 'indexes': [],
<add> 'constraints': [],
<add> },
<add> bases=('authtoken.token',),
<add> ),
<add> ] | 1 |
Javascript | Javascript | extend timeout in debug mode | 11136bf334cc22c34f7b5969f33d0b9f37342754 | <ide><path>test/common.js
<ide> exports.spawnPwd = function(options) {
<ide> };
<ide>
<ide> exports.platformTimeout = function(ms) {
<add> if (process.config.target_defaults.default_configuration === 'Debug')
<add> ms = 2 * ms;
<add>
<ide> if (process.arch !== 'arm')
<ide> return ms;
<ide>
<ide><path>test/sequential/test-net-GH-5504.js
<ide> 'use strict';
<ide> var common = require('../common');
<del>var assert = require('assert');
<ide>
<ide> // this test only fails with CentOS 6.3 using kernel version 2.6.32
<ide> // On other linuxes and darwin, the `read` call gets an ECONNRESET in | 2 |
Text | Text | verb tense correction [ci skip] | 2cec7ccc691f9abaa480e23f57c4003f766c876d | <ide><path>guides/source/engines.md
<ide> Blorgh.author_class = "User"
<ide> WARNING: It's very important here to use the `String` version of the class,
<ide> rather than the class itself. If you were to use the class, Rails would attempt
<ide> to load that class and then reference the related table. This could lead to
<del>problems if the table wasn't already existing. Therefore, a `String` should be
<add>problems if the table didn't already exist. Therefore, a `String` should be
<ide> used and then converted to a class using `constantize` in the engine later on.
<ide>
<ide> Go ahead and try to create a new article. You will see that it works exactly in the | 1 |
Javascript | Javascript | flow strict touchableopacity | 69213eea9512c81ed998d240a6f5a3be05346b48 | <ide><path>Libraries/Components/AppleTV/TVViewPropTypes.js
<ide>
<ide> 'use strict';
<ide>
<del>type TVParallaxPropertiesType = $ReadOnly<{|
<add>export type TVParallaxPropertiesType = $ReadOnly<{|
<ide> /**
<ide> * If true, parallax effects are enabled. Defaults to true.
<ide> */
<ide><path>Libraries/Components/Touchable/TouchableOpacity.js
<ide> const flattenStyle = require('flattenStyle');
<ide>
<ide> import type {Props as TouchableWithoutFeedbackProps} from 'TouchableWithoutFeedback';
<ide> import type {ViewStyleProp} from 'StyleSheet';
<del>
<del>type Event = Object;
<add>import type {TVParallaxPropertiesType} from 'TVViewPropTypes';
<add>import type {PressEvent} from 'CoreEventTypes';
<ide>
<ide> const PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
<ide>
<ide> type TVProps = $ReadOnly<{|
<ide> hasTVPreferredFocus?: ?boolean,
<del> tvParallaxProperties?: ?Object,
<add> tvParallaxProperties?: ?TVParallaxPropertiesType,
<ide> |}>;
<ide>
<ide> type Props = $ReadOnly<{|
<ide> const TouchableOpacity = ((createReactClass({
<ide> * `Touchable.Mixin` self callbacks. The mixin will invoke these if they are
<ide> * defined on your component.
<ide> */
<del> touchableHandleActivePressIn: function(e: Event) {
<add> touchableHandleActivePressIn: function(e: PressEvent) {
<ide> if (e.dispatchConfig.registrationName === 'onResponderGrant') {
<ide> this._opacityActive(0);
<ide> } else {
<ide> const TouchableOpacity = ((createReactClass({
<ide> this.props.onPressIn && this.props.onPressIn(e);
<ide> },
<ide>
<del> touchableHandleActivePressOut: function(e: Event) {
<add> touchableHandleActivePressOut: function(e: PressEvent) {
<ide> this._opacityInactive(250);
<ide> this.props.onPressOut && this.props.onPressOut(e);
<ide> },
<ide>
<del> touchableHandlePress: function(e: Event) {
<add> touchableHandlePress: function(e: PressEvent) {
<ide> this.props.onPress && this.props.onPress(e);
<ide> },
<ide>
<del> touchableHandleLongPress: function(e: Event) {
<add> touchableHandleLongPress: function(e: PressEvent) {
<ide> this.props.onLongPress && this.props.onLongPress(e);
<ide> },
<ide> | 2 |
Ruby | Ruby | use string#lines instead of to_a in ruby 1.9 | 8e68ec4dcceb606853a50d41076c7d5e118089b7 | <ide><path>railties/lib/commands/plugin.rb
<ide> class RecursiveHTTPFetcher
<ide> def initialize(urls_to_fetch, level = 1, cwd = ".")
<ide> @level = level
<ide> @cwd = cwd
<del> @urls_to_fetch = urls_to_fetch.to_a
<add> @urls_to_fetch = RUBY_VERSION >= '1.9' ? urls_to_fetch.lines : urls_to_fetch.to_a
<ide> @quiet = false
<ide> end
<ide> | 1 |
Text | Text | add documentation for jsonp response | cf6e2a768b7bb93e884873429f5f50489a507002 | <ide><path>laravel/documentation/views/home.md
<ide> Sometimes you will need a little more control over the response sent to the brow
<ide>
<ide> return Response::json(array('name' => 'Batman'));
<ide>
<add>#### Returning a JSONP response:
<add>
<add> return Response::jsonp(array('name' => 'Batman'));
<add>
<ide> #### Returning Eloquent models as JSON:
<ide>
<ide> return Response::eloquent(User::find(1)); | 1 |
Javascript | Javascript | fix usages of reactcomponentwithpurerendermixin | a2cfea1934ab3682b2597a53de0b2b00a319832f | <ide><path>Libraries/CustomComponents/NavigationExperimental/NavigationHeader.js
<ide> const NavigationHeaderStyleInterpolator = require('NavigationHeaderStyleInterpol
<ide> const NavigationHeaderTitle = require('NavigationHeaderTitle');
<ide> const NavigationPropTypes = require('NavigationPropTypes');
<ide> const React = require('React');
<del>const ReactComponentWithPureRenderMixin = require('react/lib/ReactComponentWithPureRenderMixin');
<ide> const ReactNative = require('react-native');
<ide> const TVEventHandler = require('TVEventHandler');
<ide>
<ide> const APPBAR_HEIGHT = Platform.OS === 'ios' ? 44 : 56;
<ide> const STATUSBAR_HEIGHT = Platform.OS === 'ios' ? 20 : 0;
<ide> const {PropTypes} = React;
<ide>
<del>class NavigationHeader extends React.Component<DefaultProps, Props, any> {
<add>class NavigationHeader extends React.PureComponent<DefaultProps, Props, any> {
<ide> props: Props;
<ide>
<ide> static defaultProps = {
<ide> class NavigationHeader extends React.Component<DefaultProps, Props, any> {
<ide> viewProps: PropTypes.shape(View.propTypes),
<ide> };
<ide>
<del> shouldComponentUpdate(nextProps: Props, nextState: any): boolean {
<del> return ReactComponentWithPureRenderMixin.shouldComponentUpdate.call(
<del> this,
<del> nextProps,
<del> nextState
<del> );
<del> }
<del>
<ide> _tvEventHandler: TVEventHandler;
<ide>
<ide> componentDidMount(): void { | 1 |
Javascript | Javascript | fix branding violation resolvercacheplugin | 4571fdab69d0aca5cdd5dad290fc56b16eb29340 | <ide><path>lib/cache/ResolverCachePlugin.js
<ide> const objectToString = (object, excludeContext) => {
<ide>
<ide> class ResolverCachePlugin {
<ide> /**
<del> * @param {Compiler} compiler Webpack compiler
<add> * @param {Compiler} compiler webpack compiler
<ide> * @returns {void}
<ide> */
<ide> apply(compiler) { | 1 |
PHP | PHP | add solevalue method to query builders | 1846fb3e88818cfd3ec78150666a51295feddf7d | <ide><path>src/Illuminate/Database/Eloquent/Builder.php
<ide> public function value($column)
<ide> }
<ide> }
<ide>
<add> /**
<add> * Get a single column's value from the first result of a query if it's the sole matching record.
<add> *
<add> * @param string|\Illuminate\Database\Query\Expression $column
<add> * @return mixed
<add> *
<add> * @throws \Illuminate\Database\Eloquent\ModelNotFoundException<\Illuminate\Database\Eloquent\Model>
<add> * @throws \Illuminate\Database\MultipleRecordsFoundException
<add> */
<add> public function soleValue($column)
<add> {
<add> return $this->sole([$column])->{Str::afterLast($column, '.')};
<add> }
<add>
<ide> /**
<ide> * Get a single column's value from the first result of the query or throw an exception.
<ide> *
<ide><path>src/Illuminate/Database/Query/Builder.php
<ide> public function value($column)
<ide> return count($result) > 0 ? reset($result) : null;
<ide> }
<ide>
<add> /**
<add> * Get a single column's value from the first result of a query if it's the sole matching record.
<add> *
<add> * @param string $column
<add> * @return mixed
<add> *
<add> * @throws \Illuminate\Database\RecordsNotFoundException
<add> * @throws \Illuminate\Database\MultipleRecordsFoundException
<add> */
<add> public function soleValue($column)
<add> {
<add> $result = (array) $this->sole([$column]);
<add>
<add> return reset($result);
<add> }
<add>
<ide> /**
<ide> * Execute the query as a "select" statement.
<ide> * | 2 |
Javascript | Javascript | remove the istvos check | 6075d64acf6f8d74e18ef6568c9438f73fe56d44 | <ide><path>Libraries/Utilities/Platform.ios.js
<ide> const Platform = {
<ide> get isPad(): boolean {
<ide> return this.constants.interfaceIdiom === 'pad';
<ide> },
<del> /**
<del> * Deprecated, use `isTV` instead.
<del> */
<del> // $FlowFixMe[unsafe-getters-setters]
<del> get isTVOS(): boolean {
<del> return Platform.isTV;
<del> },
<ide> // $FlowFixMe[unsafe-getters-setters]
<ide> get isTV(): boolean {
<ide> return this.constants.interfaceIdiom === 'tv'; | 1 |
Javascript | Javascript | add more unit tests | cd5e51db59a65710824b18ac0f1294f4f9aaf706 | <ide><path>test/unit/src/math/Quaternion.tests.js
<ide> export default QUnit.module( 'Maths', () => {
<ide> } );
<ide>
<ide> QUnit.test( "x", ( assert ) => {
<add>
<ide> var a = new Quaternion();
<del> assert.ok(a.x === 0, "Passed!");
<add> assert.ok( a.x === 0, "Passed!" );
<ide>
<del> a = new Quaternion(1, 2, 3);
<del> assert.ok(a.x === 1, "Passed!");
<add> a = new Quaternion( 1, 2, 3 );
<add> assert.ok( a.x === 1, "Passed!" );
<ide>
<del> a = new Quaternion(4, 5, 6, 1);
<del> assert.ok(a.x === 4, "Passed!");
<add> a = new Quaternion( 4, 5, 6, 1 );
<add> assert.ok( a.x === 4, "Passed!" );
<ide>
<del> a = new Quaternion(7, 8, 9);
<add> a = new Quaternion( 7, 8, 9 );
<ide> a.x = 10;
<del> assert.ok(a.x === 10, "Passed!");
<add> assert.ok( a.x === 10, "Passed!" );
<ide>
<del> a = new Quaternion(11, 12, 13);
<add> a = new Quaternion( 11, 12, 13 );
<ide> var b = false;
<del> a._onChange(function () {
<add> a._onChange( function () {
<ide>
<ide> b = true;
<ide>
<del> });
<del> assert.ok(!b, "Passed!");
<add> } );
<add> assert.ok( ! b, "Passed!" );
<ide> a.x = 14;
<del> assert.ok(b, "Passed!");
<del> assert.ok(a.x === 14, "Passed!");
<add> assert.ok( b, "Passed!" );
<add> assert.ok( a.x === 14, "Passed!" );
<ide>
<ide> } );
<ide>
<ide> QUnit.test( "y", ( assert ) => {
<ide>
<ide> var a = new Quaternion();
<del> assert.ok(a.y === 0, "Passed!");
<add> assert.ok( a.y === 0, "Passed!" );
<ide>
<del> a = new Quaternion(1, 2, 3);
<del> assert.ok(a.y === 2, "Passed!");
<add> a = new Quaternion( 1, 2, 3 );
<add> assert.ok( a.y === 2, "Passed!" );
<ide>
<del> a = new Quaternion(4, 5, 6, 1);
<del> assert.ok(a.y === 5, "Passed!");
<add> a = new Quaternion( 4, 5, 6, 1 );
<add> assert.ok( a.y === 5, "Passed!" );
<ide>
<del> a = new Quaternion(7, 8, 9);
<add> a = new Quaternion( 7, 8, 9 );
<ide> a.y = 10;
<del> assert.ok(a.y === 10, "Passed!");
<add> assert.ok( a.y === 10, "Passed!" );
<ide>
<del> a = new Quaternion(11, 12, 13);
<add> a = new Quaternion( 11, 12, 13 );
<ide> var b = false;
<del> a._onChange(function () {
<add> a._onChange( function () {
<ide>
<ide> b = true;
<ide>
<del> });
<del> assert.ok(!b, "Passed!");
<add> } );
<add> assert.ok( ! b, "Passed!" );
<ide> a.y = 14;
<del> assert.ok(b, "Passed!");
<del> assert.ok(a.y === 14, "Passed!");
<add> assert.ok( b, "Passed!" );
<add> assert.ok( a.y === 14, "Passed!" );
<ide>
<ide> } );
<ide>
<ide> QUnit.test( "z", ( assert ) => {
<ide>
<ide>
<ide> var a = new Quaternion();
<del> assert.ok(a.z === 0, "Passed!");
<add> assert.ok( a.z === 0, "Passed!" );
<ide>
<del> a = new Quaternion(1, 2, 3);
<del> assert.ok(a.z === 3, "Passed!");
<add> a = new Quaternion( 1, 2, 3 );
<add> assert.ok( a.z === 3, "Passed!" );
<ide>
<del> a = new Quaternion(4, 5, 6, 1);
<del> assert.ok(a.z === 6, "Passed!");
<add> a = new Quaternion( 4, 5, 6, 1 );
<add> assert.ok( a.z === 6, "Passed!" );
<ide>
<del> a = new Quaternion(7, 8, 9);
<add> a = new Quaternion( 7, 8, 9 );
<ide> a.z = 10;
<del> assert.ok(a.z === 10, "Passed!");
<add> assert.ok( a.z === 10, "Passed!" );
<ide>
<del> a = new Quaternion(11, 12, 13);
<add> a = new Quaternion( 11, 12, 13 );
<ide> var b = false;
<del> a._onChange(function () {
<add> a._onChange( function () {
<ide>
<ide> b = true;
<ide>
<del> });
<del> assert.ok(!b, "Passed!");
<add> } );
<add> assert.ok( ! b, "Passed!" );
<ide> a.z = 14;
<del> assert.ok(b, "Passed!");
<del> assert.ok(a.z === 14, "Passed!");
<add> assert.ok( b, "Passed!" );
<add> assert.ok( a.z === 14, "Passed!" );
<ide>
<ide> } );
<ide>
<ide> QUnit.test( "w", ( assert ) => {
<ide>
<ide> var a = new Quaternion();
<del> assert.ok(a.w === 1, "Passed!");
<add> assert.ok( a.w === 1, "Passed!" );
<ide>
<del> a = new Quaternion(1, 2, 3);
<del> assert.ok(a.w === 1, "Passed!");
<add> a = new Quaternion( 1, 2, 3 );
<add> assert.ok( a.w === 1, "Passed!" );
<ide>
<del> a = new Quaternion(4, 5, 6, 1);
<del> assert.ok(a.w === 1, "Passed!");
<add> a = new Quaternion( 4, 5, 6, 1 );
<add> assert.ok( a.w === 1, "Passed!" );
<ide>
<del> a = new Quaternion(7, 8, 9);
<add> a = new Quaternion( 7, 8, 9 );
<ide> a.w = 10;
<del> assert.ok(a.w === 10, "Passed!");
<add> assert.ok( a.w === 10, "Passed!" );
<ide>
<del> a = new Quaternion(11, 12, 13);
<add> a = new Quaternion( 11, 12, 13 );
<ide> var b = false;
<del> a._onChange(function () {
<add> a._onChange( function () {
<ide>
<ide> b = true;
<ide>
<del> });
<del> assert.ok(!b, "Passed!");
<add> } );
<add> assert.ok( ! b, "Passed!" );
<ide> a.w = 14;
<del> assert.ok(b, "Passed!");
<del> assert.ok(a.w === 14, "Passed!");
<add> assert.ok( b, "Passed!" );
<add> assert.ok( a.w === 14, "Passed!" );
<ide>
<ide> } );
<ide>
<ide> export default QUnit.module( 'Maths', () => {
<ide>
<ide> } );
<ide>
<del> QUnit.todo( "dot", ( assert ) => {
<add> QUnit.test( "dot", ( assert ) => {
<add>
<add> var a = new Quaternion();
<add> var b = new Quaternion();
<add>
<add> assert.ok( a.dot( b ) === 1, "Passed!" );
<add> a = new Quaternion( 1, 2, 3, 1 );
<add> b = new Quaternion( 3, 2, 1, 1 );
<add>
<add> assert.ok( a.dot( b ) === 11, "Passed!" );
<ide>
<del> assert.ok( false, "everything's gonna be alright" );
<ide>
<ide> } );
<ide>
<ide> export default QUnit.module( 'Maths', () => {
<ide>
<ide> } );
<ide>
<del> QUnit.todo( "_onChange", ( assert ) => {
<add> QUnit.test( "_onChange", ( assert ) => {
<ide>
<del> assert.ok( false, "everything's gonna be alright" );
<add>
<add> var f = function () {
<add>
<add> var b = true;
<add>
<add> };
<add>
<add> var a = new Quaternion( 11, 12, 13, 1 );
<add> a._onChange( f );
<add> assert.ok( a._onChangeCallback === f, "Passed!" );
<ide>
<ide> } );
<ide>
<del> QUnit.todo( "_onChangeCallback", ( assert ) => {
<add> QUnit.test( "_onChangeCallback", ( assert ) => {
<ide>
<del> assert.ok( false, "everything's gonna be alright" );
<add> var f = function () {
<add>
<add> var b = true;
<add>
<add> };
<add>
<add> var a = new Quaternion( 11, 12, 13, 1 );
<add> a._onChangeCallback = f;
<add> assert.ok( a._onChangeCallback === f, "Passed!" );
<ide>
<ide> } );
<ide> | 1 |
Javascript | Javascript | clarify comment in compose.js | a7f0a923bbe881d7052af4536a4b5ffb8ae23af8 | <ide><path>src/compose.js
<ide> /**
<del> * Composes single-argument functions from right to left.
<add> * Composes single-argument functions from right to left. The rightmost
<add> * function can take multiple arguments as it provides the signature for
<add> * the resulting composite function.
<ide> *
<ide> * @param {...Function} funcs The functions to compose.
<del> * @returns {Function} A function obtained by composing functions from right to
<del> * left. For example, compose(f, g, h) is identical to arg => f(g(h(arg))).
<add> * @returns {Function} A function obtained by composing the argument functions
<add> * from right to left. For example, compose(f, g, h) is identical to doing
<add> * (...args) => f(g(h(...args))).
<ide> */
<add>
<ide> export default function compose(...funcs) {
<ide> return (...args) => {
<ide> if (funcs.length === 0) { | 1 |
PHP | PHP | fix documentation of controller callbacks | 38951b210903ea255ac9ecb4c99f381f854eb76e | <ide><path>src/Controller/Controller.php
<ide> public function isAction($action)
<ide> * or perform logic that needs to happen before each controller action.
<ide> *
<ide> * @param Event $event An Event instance
<del> * @return void
<add> * @return \Cake\Network\Response|null
<ide> * @link http://book.cakephp.org/3.0/en/controllers.html#request-life-cycle-callbacks
<ide> */
<ide> public function beforeFilter(Event $event)
<ide> public function beforeFilter(Event $event)
<ide> * to perform logic or set view variables that are required on every request.
<ide> *
<ide> * @param Event $event An Event instance
<del> * @return void
<add> * @return \Cake\Network\Response|null
<ide> * @link http://book.cakephp.org/3.0/en/controllers.html#request-life-cycle-callbacks
<ide> */
<ide> public function beforeRender(Event $event)
<ide> public function beforeRender(Event $event)
<ide> * @param string|array $url A string or array-based URL pointing to another location within the app,
<ide> * or an absolute URL
<ide> * @param \Cake\Network\Response $response The response object.
<del> * @return void
<add> * @return \Cake\Network\Response|null
<ide> * @link http://book.cakephp.org/3.0/en/controllers.html#request-life-cycle-callbacks
<ide> */
<ide> public function beforeRedirect(Event $event, $url, Response $response)
<ide> public function beforeRedirect(Event $event, $url, Response $response)
<ide> * Called after the controller action is run and rendered.
<ide> *
<ide> * @param Event $event An Event instance
<del> * @return void
<add> * @return \Cake\Network\Response|null
<ide> * @link http://book.cakephp.org/3.0/en/controllers.html#request-life-cycle-callbacks
<ide> */
<ide> public function afterFilter(Event $event) | 1 |
PHP | PHP | use "iterable" type hint and is_iterable() check | 844b24c3605f409ed6fcfc7417b928d0c5fdc316 | <ide><path>src/Collection/Collection.php
<ide> namespace Cake\Collection;
<ide>
<ide> use ArrayIterator;
<del>use InvalidArgumentException;
<ide> use IteratorIterator;
<ide> use Serializable;
<del>use Traversable;
<ide>
<ide> /**
<ide> * A collection is an immutable list of elements with a handful of functions to
<ide> class Collection extends IteratorIterator implements CollectionInterface, Serial
<ide> * @param array|\Traversable $items Items.
<ide> * @throws \InvalidArgumentException If passed incorrect type for items.
<ide> */
<del> public function __construct($items)
<add> public function __construct(iterable $items)
<ide> {
<ide> if (is_array($items)) {
<ide> $items = new ArrayIterator($items);
<ide> }
<ide>
<del> if (!($items instanceof Traversable)) {
<del> $msg = 'Only an array or \Traversable is allowed for Collection';
<del> throw new InvalidArgumentException($msg);
<del> }
<del>
<ide> parent::__construct($items);
<ide> }
<ide>
<ide><path>src/Collection/CollectionInterface.php
<ide> public function through(callable $handler): CollectionInterface;
<ide> * @param array|\Traversable ...$items The collections to zip.
<ide> * @return \Cake\Collection\CollectionInterface
<ide> */
<del> public function zip($items): CollectionInterface;
<add> public function zip(iterable $items): CollectionInterface;
<ide>
<ide> /**
<ide> * Combines the elements of this collection with each of the elements of the
<ide> public function zip($items): CollectionInterface;
<ide> * @param callable $callable The function to use for zipping the elements together.
<ide> * @return \Cake\Collection\CollectionInterface
<ide> */
<del> public function zipWith($items, $callable): CollectionInterface;
<add> public function zipWith(iterable $items, $callable): CollectionInterface;
<ide>
<ide> /**
<ide> * Breaks the collection into smaller arrays of the given size.
<ide><path>src/Collection/CollectionTrait.php
<ide> public function through(callable $handler): CollectionInterface
<ide> /**
<ide> * {@inheritDoc}
<ide> */
<del> public function zip($items): CollectionInterface
<add> public function zip(iterable $items): CollectionInterface
<ide> {
<ide> return new ZipIterator(array_merge([$this->unwrap()], func_get_args()));
<ide> }
<ide>
<ide> /**
<ide> * {@inheritDoc}
<ide> */
<del> public function zipWith($items, $callable): CollectionInterface
<add> public function zipWith(iterable $items, $callable): CollectionInterface
<ide> {
<ide> if (func_num_args() > 2) {
<ide> $items = func_get_args();
<ide> public function countKeys(): int
<ide> *
<ide> * @return \Traversable|array
<ide> */
<del> protected function optimizeUnwrap()
<add> protected function optimizeUnwrap(): iterable
<ide> {
<ide> $iterator = $this->unwrap();
<ide>
<ide><path>src/Collection/Iterator/BufferedIterator.php
<ide> class BufferedIterator extends Collection implements Countable, Serializable
<ide> *
<ide> * @param array|\Traversable $items The items to be filtered.
<ide> */
<del> public function __construct($items)
<add> public function __construct(iterable $items)
<ide> {
<ide> $this->_buffer = new SplDoublyLinkedList();
<ide> parent::__construct($items);
<ide><path>src/Collection/Iterator/ExtractIterator.php
<ide> class ExtractIterator extends Collection
<ide> * @param string $path a dot separated string symbolizing the path to follow
<ide> * inside the hierarchy of each value so that the column can be extracted.
<ide> */
<del> public function __construct($items, $path)
<add> public function __construct(iterable $items, $path)
<ide> {
<ide> $this->_extractor = $this->_propertyExtractor($path);
<ide> parent::__construct($items);
<ide><path>src/Collection/Iterator/InsertIterator.php
<ide> class InsertIterator extends Collection
<ide> * @param array|\Traversable $values The source collection from which the values will
<ide> * be inserted at the specified path.
<ide> */
<del> public function __construct($into, $path, $values)
<add> public function __construct(iterable $into, $path, iterable $values)
<ide> {
<ide> parent::__construct($into);
<ide>
<ide><path>src/Collection/Iterator/NestIterator.php
<ide> class NestIterator extends Collection implements RecursiveIterator
<ide> * @param string|callable $nestKey the property that contains the nested items
<ide> * If a callable is passed, it should return the childrens for the passed item
<ide> */
<del> public function __construct($items, $nestKey)
<add> public function __construct(iterable $items, $nestKey)
<ide> {
<ide> parent::__construct($items);
<ide> $this->_nestKey = $nestKey;
<ide><path>src/Collection/Iterator/ReplaceIterator.php
<ide> class ReplaceIterator extends Collection
<ide> * @param array|\Traversable $items The items to be filtered.
<ide> * @param callable $callback Callback.
<ide> */
<del> public function __construct($items, callable $callback)
<add> public function __construct(iterable $items, callable $callback)
<ide> {
<ide> $this->_callback = $callback;
<ide> parent::__construct($items);
<ide><path>src/Collection/Iterator/SortIterator.php
<ide> class SortIterator extends Collection
<ide> * @param int $type the type of comparison to perform, either SORT_STRING
<ide> * SORT_NUMERIC or SORT_NATURAL
<ide> */
<del> public function __construct($items, $callback, $dir = \SORT_DESC, $type = \SORT_NUMERIC)
<add> public function __construct(iterable $items, $callback, $dir = \SORT_DESC, $type = \SORT_NUMERIC)
<ide> {
<ide> if (!is_array($items)) {
<ide> $items = iterator_to_array((new Collection($items))->unwrap(), false);
<ide><path>src/Collection/Iterator/StoppableIterator.php
<ide> class StoppableIterator extends Collection
<ide> * the collection, if the result evaluates to false, no more items will be
<ide> * yielded from this iterator.
<ide> */
<del> public function __construct($items, callable $condition)
<add> public function __construct(iterable $items, callable $condition)
<ide> {
<ide> $this->_condition = $condition;
<ide> parent::__construct($items);
<ide><path>src/Collection/Iterator/UnfoldIterator.php
<ide> class UnfoldIterator extends IteratorIterator implements RecursiveIterator
<ide> * current item and key. It must return an array or Traversable object
<ide> * out of which the nested iterators will be yielded.
<ide> */
<del> public function __construct($items, callable $unfolder)
<add> public function __construct(iterable $items, callable $unfolder)
<ide> {
<ide> $this->_unfolder = $unfolder;
<ide> parent::__construct($items);
<ide><path>src/Collection/functions.php
<ide> * @param \Traversable|array $items The items from which the collection will be built.
<ide> * @return \Cake\Collection\Collection
<ide> */
<del> function collection($items): CollectionInterface
<add> function collection(iterable $items): CollectionInterface
<ide> {
<ide> return new Collection($items);
<ide> }
<ide><path>src/Database/Expression/Comparison.php
<ide> protected function _bindValue($value, ValueBinder $generator, $type): string
<ide> * @param string|array|null $type the type to cast values to
<ide> * @return string
<ide> */
<del> protected function _flattenValue($value, $generator, $type = 'string'): string
<add> protected function _flattenValue(iterable $value, $generator, $type = 'string'): string
<ide> {
<ide> $parts = [];
<ide> foreach ($this->_valueExpressions as $k => $v) {
<ide> protected function _flattenValue($value, $generator, $type = 'string'): string
<ide> * and all ExpressionInterface objects that could be found in the second
<ide> * position.
<ide> *
<del> * @param array|\Traversable $values The rows to insert
<add> * @param array|\Traversable|\Cake\Database\ExpressionInterface $values The rows to insert
<ide> * @return array
<ide> */
<ide> protected function _collectExpressions($values): array
<ide><path>src/Database/ValueBinder.php
<ide> public function placeholder($token)
<ide> * @param string $type The type with which all values will be bound
<ide> * @return array with the placeholders to insert in the query
<ide> */
<del> public function generateManyNamed($values, $type = 'string')
<add> public function generateManyNamed(iterable $values, $type = 'string')
<ide> {
<ide> $placeholders = [];
<ide> foreach ($values as $k => $value) {
<ide><path>src/Datasource/RepositoryInterface.php
<ide> public function patchEntity(EntityInterface $entity, array $data, array $options
<ide> * @param array $options A list of options for the objects hydration.
<ide> * @return \Cake\Datasource\EntityInterface[]
<ide> */
<del> public function patchEntities($entities, array $data, array $options = []): array;
<add> public function patchEntities(iterable $entities, array $data, array $options = []): array;
<ide> }
<ide><path>src/ORM/Association/BelongsToMany.php
<ide> use Closure;
<ide> use InvalidArgumentException;
<ide> use SplObjectStorage;
<del>use Traversable;
<ide>
<ide> /**
<ide> * Represents an M - N relationship where there exists a junction - or join - table
<ide> public function saveAssociated(EntityInterface $entity, array $options = [])
<ide> * @return \Cake\Datasource\EntityInterface|bool The parent entity after all links have been
<ide> * created if no errors happened, false otherwise
<ide> */
<del> protected function _saveTarget(EntityInterface $parentEntity, $entities, $options)
<add> protected function _saveTarget(EntityInterface $parentEntity, iterable $entities, $options)
<ide> {
<ide> $joinAssociations = false;
<ide> if (!empty($options['associated'][$this->_junctionProperty]['associated'])) {
<ide> $joinAssociations = $options['associated'][$this->_junctionProperty]['associated'];
<ide> }
<ide> unset($options['associated'][$this->_junctionProperty]);
<ide>
<del> if (!(is_array($entities) || $entities instanceof Traversable)) {
<del> $name = $this->getProperty();
<del> $message = sprintf('Could not save %s, it cannot be traversed', $name);
<del> throw new InvalidArgumentException($message);
<del> }
<del>
<ide> $table = $this->getTarget();
<ide> $original = $entities;
<ide> $persisted = [];
<ide><path>src/ORM/Association/HasMany.php
<ide> public function saveAssociated(EntityInterface $entity, array $options = [])
<ide> $targetEntities = [];
<ide> }
<ide>
<del> if (!is_array($targetEntities) &&
<del> !($targetEntities instanceof Traversable)
<del> ) {
<add> if (!is_iterable($targetEntities)) {
<ide> $name = $this->getProperty();
<ide> $message = sprintf('Could not save %s, it cannot be traversed', $name);
<ide> throw new InvalidArgumentException($message);
<ide> public function saveAssociated(EntityInterface $entity, array $options = [])
<ide> * @param array $options list of options accepted by `Table::save()`.
<ide> * @return bool `true` on success, `false` otherwise.
<ide> */
<del> protected function _saveTarget(array $foreignKeyReference, EntityInterface $parentEntity, $entities, array $options): bool
<add> protected function _saveTarget(array $foreignKeyReference, EntityInterface $parentEntity, iterable $entities, array $options): bool
<ide> {
<ide> $foreignKey = array_keys($foreignKeyReference);
<ide> $table = $this->getTarget();
<ide><path>src/ORM/Marshaller.php
<ide> public function merge(EntityInterface $entity, array $data, array $options = [])
<ide> * @return \Cake\Datasource\EntityInterface[]
<ide> * @see \Cake\ORM\Entity::$_accessible
<ide> */
<del> public function mergeMany($entities, array $data, array $options = []): array
<add> public function mergeMany(iterable $entities, array $data, array $options = []): array
<ide> {
<ide> $primary = (array)$this->_table->getPrimaryKey();
<ide>
<ide><path>src/ORM/Table.php
<ide> public function patchEntity(EntityInterface $entity, array $data, array $options
<ide> * You can use the `Model.beforeMarshal` event to modify request data
<ide> * before it is converted into entities.
<ide> */
<del> public function patchEntities($entities, array $data, array $options = []): array
<add> public function patchEntities(iterable $entities, array $data, array $options = []): array
<ide> {
<ide> if (!isset($options['associated'])) {
<ide> $options['associated'] = $this->_associations->keys();
<ide><path>src/View/Form/ContextFactory.php
<ide> use Cake\Form\Form;
<ide> use Cake\Http\ServerRequest;
<ide> use RuntimeException;
<del>use Traversable;
<ide>
<ide> /**
<ide> * Factory for getting form context instance based on provided data.
<ide> public static function createWithDefaults(array $providers = []): self
<ide> [
<ide> 'type' => 'orm',
<ide> 'callable' => function ($request, $data) {
<del> if (is_array($data['entity']) || $data['entity'] instanceof Traversable) {
<add> if (is_iterable($data['entity'])) {
<ide> $pass = (new Collection($data['entity']))->first() !== null;
<ide> if ($pass) {
<ide> return new EntityContext($request, $data);
<ide><path>src/View/Form/EntityContext.php
<ide> protected function _prepare(): void
<ide> $table = $this->_context['table'];
<ide> $entity = $this->_context['entity'];
<ide> if (empty($table)) {
<del> if (is_array($entity) || $entity instanceof Traversable) {
<add> if (is_iterable($entity)) {
<ide> foreach ($entity as $e) {
<ide> $entity = $e;
<ide> break;
<ide> public function isPrimaryKey(string $field): bool
<ide> public function isCreate(): bool
<ide> {
<ide> $entity = $this->_context['entity'];
<del> if (is_array($entity) || $entity instanceof Traversable) {
<add> if (is_iterable($entity)) {
<ide> foreach ($entity as $e) {
<ide> $entity = $e;
<ide> break;
<ide> protected function _schemaDefault(array $parts)
<ide> */
<ide> protected function _extractMultiple($values, $path): ?array
<ide> {
<del> if (!(is_array($values) || $values instanceof Traversable)) {
<add> if (!is_iterable($values)) {
<ide> return null;
<ide> }
<ide> $table = $this->_getTable($path, false);
<ide> public function entity(?array $path = null)
<ide> }
<ide>
<ide> $isTraversable = (
<del> is_array($next) ||
<del> $next instanceof Traversable ||
<add> is_iterable($next) ||
<ide> $next instanceof EntityInterface
<ide> );
<ide> if ($isLast || !$isTraversable) {
<ide><path>src/View/Helper/FormHelper.php
<ide> protected function _optionsOptions(string $fieldName, array $options): array
<ide> $pluralize ? Inflector::pluralize($fieldName) : $fieldName
<ide> );
<ide> $varOptions = $this->_View->get($varName);
<del> if (!is_array($varOptions) && !($varOptions instanceof Traversable)) {
<add> if (!is_iterable($varOptions)) {
<ide> return $options;
<ide> }
<ide> if ($options['type'] !== 'radio') {
<ide> public function checkbox(string $fieldName, array $options = [])
<ide> * @return string Completed radio widget set.
<ide> * @link https://book.cakephp.org/3.0/en/views/helpers/form.html#creating-radio-buttons
<ide> */
<del> public function radio(string $fieldName, $options = [], array $attributes = []): string
<add> public function radio(string $fieldName, iterable $options = [], array $attributes = []): string
<ide> {
<ide> $attributes['options'] = $options;
<ide> $attributes['idPrefix'] = $this->_idPrefix;
<ide> public function submit(?string $caption = null, array $options = []): string
<ide> * ```
<ide> *
<ide> * @param string $fieldName Name attribute of the SELECT
<del> * @param array|\Traversable $options Array of the OPTION elements (as 'value'=>'Text' pairs) to be used in the
<add> * @param array|\Traversable|null $options Array of the OPTION elements (as 'value'=>'Text' pairs) to be used in the
<ide> * SELECT element
<ide> * @param array $attributes The HTML attributes of the select element.
<ide> * @return string Formatted SELECT element
<ide> * @see \Cake\View\Helper\FormHelper::multiCheckbox() for creating multiple checkboxes.
<ide> * @link https://book.cakephp.org/3.0/en/views/helpers/form.html#creating-select-pickers
<ide> */
<del> public function select(string $fieldName, $options = [], array $attributes = []): string
<add> public function select(string $fieldName, ?iterable $options = [], array $attributes = []): string
<ide> {
<ide> $attributes += [
<ide> 'disabled' => null,
<ide> public function select(string $fieldName, $options = [], array $attributes = [])
<ide> * @return string Formatted SELECT element
<ide> * @see \Cake\View\Helper\FormHelper::select() for supported option formats.
<ide> */
<del> public function multiCheckbox(string $fieldName, $options, array $attributes = []): string
<add> public function multiCheckbox(string $fieldName, iterable $options, array $attributes = []): string
<ide> {
<ide> $attributes += [
<ide> 'disabled' => null,
<ide><path>src/View/Widget/SelectBoxWidget.php
<ide> protected function _renderOptions($options, $disabled, $selected, $templateVars,
<ide> $out = [];
<ide> foreach ($options as $key => $val) {
<ide> // Option groups
<del> $arrayVal = (is_array($val) || $val instanceof Traversable);
<del> if ((!is_int($key) && $arrayVal) ||
<del> (is_int($key) && $arrayVal && (isset($val['options']) || !isset($val['value'])))
<add> $isIterable = is_iterable($val);
<add> if ((!is_int($key) && $isIterable) ||
<add> (is_int($key) && $isIterable && (isset($val['options']) || !isset($val['value'])))
<ide> ) {
<ide> $out[] = $this->_renderOptgroup((string)$key, $val, $disabled, $selected, $templateVars, $escape);
<ide> continue;
<ide><path>tests/TestCase/Collection/CollectionTest.php
<ide> class TestCollection extends \IteratorIterator implements CollectionInterface
<ide> {
<ide> use CollectionTrait;
<ide>
<del> public function __construct($items)
<add> public function __construct(iterable $items)
<ide> {
<ide> if (is_array($items)) {
<ide> $items = new \ArrayIterator($items);
<ide> public function testToJson()
<ide> $this->assertEquals(json_encode($data), json_encode($collection));
<ide> }
<ide>
<del> /**
<del> * Tests that only arrays and Traversables are allowed in the constructor
<del> *
<del> * @return void
<del> */
<del> public function testInvalidConstructorArgument()
<del> {
<del> $this->expectException(\InvalidArgumentException::class);
<del> $this->expectExceptionMessage('Only an array or \Traversable is allowed for Collection');
<del> new Collection('Derp');
<del> }
<del>
<ide> /**
<ide> * Tests that Count returns the number of elements
<ide> *
<ide><path>tests/TestCase/ORM/Association/BelongsToManyTest.php
<ide> public function emptyProvider()
<ide> ];
<ide> }
<ide>
<del> /**
<del> * Test that saveAssociated() fails on non-empty, non-iterable value
<del> *
<del> * @return void
<del> */
<del> public function testSaveAssociatedNotEmptyNotIterable()
<del> {
<del> $this->expectException(\InvalidArgumentException::class);
<del> $this->expectExceptionMessage('Could not save tags, it cannot be traversed');
<del> $articles = $this->getTableLocator()->get('Articles');
<del> $assoc = $articles->belongsToMany('Tags', [
<del> 'saveStrategy' => BelongsToMany::SAVE_APPEND,
<del> 'joinTable' => 'articles_tags',
<del> ]);
<del> $entity = new Entity([
<del> 'id' => 1,
<del> 'tags' => 'oh noes',
<del> ], ['markNew' => true]);
<del>
<del> $assoc->saveAssociated($entity);
<del> }
<del>
<ide> /**
<ide> * Test that saving an empty set on create works.
<ide> * | 25 |
Python | Python | fix tf template | 570218878a502469f2ce62a33bc62be9b3f89b4a | <ide><path>templates/adding_a_new_model/cookiecutter-template-{{cookiecutter.modelname}}/test_modeling_tf_{{cookiecutter.lowercase_modelname}}.py
<ide> class TF{{cookiecutter.camelcase_modelname}}ModelTest(TFModelTesterMixin, unitte
<ide> )
<ide>
<ide> test_head_masking = False
<add> test_onnx = False
<ide>
<ide> def setUp(self):
<ide> self.model_tester = TF{{cookiecutter.camelcase_modelname}}ModelTester(self)
<ide> class TF{{cookiecutter.camelcase_modelname}}ModelTest(TFModelTesterMixin, unitte
<ide> is_encoder_decoder = True
<ide> test_pruning = False
<ide> test_head_masking = False
<add> test_onnx = False
<ide>
<ide> def setUp(self):
<ide> self.model_tester = TF{{cookiecutter.camelcase_modelname}}ModelTester(self) | 1 |
Ruby | Ruby | move the testqueue tests to the proper file | 08f57bfb8f46e9f521b7d324fc47fe00d93f42bf | <ide><path>activesupport/test/queueing/test_queue_test.rb
<ide> def test_drain
<ide> assert job.ran?, "The job runs synchronously when the queue is drained"
<ide> assert_equal job.thread_id, Thread.current.object_id
<ide> end
<add>
<add> class IdentifiableJob
<add> def initialize(id)
<add> @id = id
<add> end
<add>
<add> def ==(other)
<add> other.same_id?(@id)
<add> end
<add>
<add> def same_id?(other_id)
<add> other_id == @id
<add> end
<add>
<add> def run
<add> end
<add> end
<add>
<add> def test_queue_can_be_observed
<add> jobs = (1..10).map do |id|
<add> IdentifiableJob.new(id)
<add> end
<add>
<add> jobs.each do |job|
<add> @queue.push job
<add> end
<add>
<add> assert_equal jobs, @queue.jobs
<add> end
<add>
<add> def test_adding_an_unmarshallable_job
<add> anonymous_class_instance = Struct.new(:run).new
<add>
<add> assert_raises TypeError do
<add> @queue.push anonymous_class_instance
<add> end
<add> end
<add>
<add> def test_attempting_to_add_a_reference_to_itself
<add> job = {reference: @queue}
<add> assert_raises TypeError do
<add> @queue.push job
<add> end
<add> end
<ide> end
<ide><path>railties/test/application/queue_test.rb
<ide> def ran?
<ide> refute job.ran_in_different_thread?, "Expected job to run in the same thread"
<ide> end
<ide>
<del> class IdentifiableJob
<del> def initialize(id)
<del> @id = id
<del> end
<del>
<del> def ==(other)
<del> other.same_id?(@id)
<del> end
<del>
<del> def same_id?(other_id)
<del> other_id == @id
<del> end
<del>
<del> def run
<del> end
<del> end
<del>
<del> test "in test mode, the queue can be observed" do
<del> app("test")
<del>
<del> jobs = (1..10).map do |id|
<del> IdentifiableJob.new(id)
<del> end
<del>
<del> jobs.each do |job|
<del> Rails.queue.push job
<del> end
<del>
<del> assert_equal jobs, Rails.queue.jobs
<del> end
<del>
<del> test "in test mode, adding an unmarshallable job will raise an exception" do
<del> app("test")
<del> anonymous_class_instance = Struct.new(:run).new
<del> assert_raises TypeError do
<del> Rails.queue.push anonymous_class_instance
<del> end
<del> end
<del>
<ide> test "attempting to marshal a queue will raise an exception" do
<ide> app("test")
<ide> assert_raises TypeError do
<ide> Marshal.dump Rails.queue
<ide> end
<ide> end
<ide>
<del> test "attempting to add a reference to itself to the queue will raise an exception" do
<del> app("test")
<del> job = {reference: Rails.queue}
<del> assert_raises TypeError do
<del> Rails.queue.push job
<del> end
<del> end
<del>
<ide> def setup_custom_queue
<ide> add_to_env_config "production", <<-RUBY
<ide> require "my_queue" | 2 |
Python | Python | add dist_info to valid setup.py commands | 9b3f65096ee6bee277552da987ce296985baa96d | <ide><path>setup.py
<ide> def parse_setuppy_commands():
<ide> '--maintainer', '--maintainer-email', '--contact',
<ide> '--contact-email', '--url', '--license', '--description',
<ide> '--long-description', '--platforms', '--classifiers',
<del> '--keywords', '--provides', '--requires', '--obsoletes']
<add> '--keywords', '--provides', '--requires', '--obsoletes',
<add> 'version',]
<ide>
<ide> for command in info_commands:
<ide> if command in args:
<ide> def parse_setuppy_commands():
<ide> # below and not standalone. Hence they're not added to good_commands.
<ide> good_commands = ('develop', 'sdist', 'build', 'build_ext', 'build_py',
<ide> 'build_clib', 'build_scripts', 'bdist_wheel', 'bdist_rpm',
<del> 'bdist_wininst', 'bdist_msi', 'bdist_mpkg', 'build_src',
<del> 'version')
<add> 'bdist_wininst', 'bdist_msi', 'bdist_mpkg', 'build_src',)
<ide>
<ide> for command in good_commands:
<ide> if command in args:
<ide> def parse_setuppy_commands():
<ide>
<ide> # Commands that do more than print info, but also don't need Cython and
<ide> # template parsing.
<del> other_commands = ['egg_info', 'install_egg_info', 'rotate']
<add> other_commands = ['egg_info', 'install_egg_info', 'rotate', 'dist_info']
<ide> for command in other_commands:
<ide> if command in args:
<ide> return False
<ide>
<ide> # If we got here, we didn't detect what setup.py command was given
<del> import warnings
<del> warnings.warn("Unrecognized setuptools command, proceeding with "
<del> "generating Cython sources and expanding templates",
<del> stacklevel=2)
<del> return True
<add> raise RuntimeError("Unrecognized setuptools command: {}".format(args))
<ide>
<ide>
<ide> def get_docs_url():
<ide> def setup_package():
<ide> # Raise errors for unsupported commands, improve help output, etc.
<ide> run_build = parse_setuppy_commands()
<ide>
<del> if run_build and 'version' not in sys.argv:
<add> if run_build:
<ide> # patches distutils, even though we don't use it
<ide> #from setuptools import setup
<ide> from numpy.distutils.core import setup | 1 |
Javascript | Javascript | add inline @type tag | 0b4a41af58fbc75122e18146a890a0a7c8dbd947 | <ide><path>docs/config/index.js
<ide> module.exports = function(config) {
<ide> require('./tag-defs/tutorial-step')
<ide> ]);
<ide>
<add> config.append('processing.inlineTagDefinitions', [
<add> require('./inline-tag-defs/type')
<add> ]);
<add>
<ide> config.set('processing.search.ignoreWordsFile', path.resolve(packagePath, 'ignore.words'));
<ide>
<ide> config.prepend('rendering.templateFolders', [
<ide><path>docs/config/inline-tag-defs/type.js
<add>var typeClassFilter = require('dgeni-packages/ngdoc/rendering/filters/type-class');
<add>var encoder = new require('node-html-encoder').Encoder();
<add>
<add>module.exports = {
<add> name: 'type',
<add> description: 'Replace with markup that displays a nice type',
<add> handlerFactory: function() {
<add> return function(doc, tagName, tagDescription) {
<add> return '<a href="" class="' + typeClassFilter.process(tagDescription) + '">'+encoder.htmlEncode(tagDescription) + '</a>';
<add> };
<add> }
<add>}; | 2 |
Text | Text | del the extra dot | 73770c00fc322929215108a44049e51f1d89cae5 | <ide><path>docs/reference/commandline/run.md
<ide> Options:
<ide> -m, --memory string Memory limit
<ide> --memory-reservation string Memory soft limit
<ide> --memory-swap string Swap limit equal to memory plus swap: '-1' to enable unlimited swap
<del> --memory-swappiness int Tune container memory swappiness (0 to 100) (default -1).
<add> --memory-swappiness int Tune container memory swappiness (0 to 100) (default -1)
<ide> --name string Assign a name to the container
<ide> --network-alias value Add network-scoped alias for the container (default [])
<ide> --network string Connect a container to a network | 1 |
PHP | PHP | add missing standard http codes | 55218815e8048a995f0719142ddf6b1429b7458f | <ide><path>src/Network/Response.php
<ide> class Response
<ide> protected $_statusCodes = [
<ide> 100 => 'Continue',
<ide> 101 => 'Switching Protocols',
<add> 102 => 'Processing',
<ide> 200 => 'OK',
<ide> 201 => 'Created',
<ide> 202 => 'Accepted',
<ide> 203 => 'Non-Authoritative Information',
<ide> 204 => 'No Content',
<ide> 205 => 'Reset Content',
<ide> 206 => 'Partial Content',
<add> 207 => 'Multi-status',
<add> 208 => 'Already Reported',
<ide> 300 => 'Multiple Choices',
<ide> 301 => 'Moved Permanently',
<ide> 302 => 'Found',
<ide> 303 => 'See Other',
<ide> 304 => 'Not Modified',
<ide> 305 => 'Use Proxy',
<add> 306 => 'Switch Proxy',
<ide> 307 => 'Temporary Redirect',
<ide> 400 => 'Bad Request',
<ide> 401 => 'Unauthorized',
<ide> class Response
<ide> 415 => 'Unsupported Media Type',
<ide> 416 => 'Requested range not satisfiable',
<ide> 417 => 'Expectation Failed',
<add> 418 => 'I\'m a teapot',
<ide> 422 => 'Unprocessable Entity',
<add> 423 => 'Locked',
<add> 424 => 'Failed Dependency',
<add> 425 => 'Unordered Collection',
<add> 426 => 'Upgrade Required',
<add> 428 => 'Precondition Required',
<ide> 429 => 'Too Many Requests',
<add> 431 => 'Request Header Fields Too Large',
<ide> 451 => 'Unavailable For Legal Reasons',
<ide> 500 => 'Internal Server Error',
<ide> 501 => 'Not Implemented',
<ide> 502 => 'Bad Gateway',
<ide> 503 => 'Service Unavailable',
<ide> 504 => 'Gateway Time-out',
<ide> 505 => 'Unsupported Version'
<add> 506 => 'Variant Also Negotiates',
<add> 507 => 'Insufficient Storage',
<add> 508 => 'Loop Detected',
<add> 511 => 'Network Authentication Required',
<ide> ];
<ide>
<ide> /** | 1 |
PHP | PHP | update dispatchesjobs.php | 9d902d3581ac32549d02058b04b6a1944ff198ed | <ide><path>src/Illuminate/Foundation/Bus/DispatchesJobs.php
<ide> public function dispatchNow($job)
<ide> }
<ide>
<ide> /**
<del> * Dispatch a command to its appropriate handler in the current process.
<add> * Dispatch a job to its appropriate handler in the current process.
<ide> *
<ide> * Queueable jobs will be dispatched to the "sync" queue.
<ide> * | 1 |
Java | Java | update javadoc on uritemplatehandler property | 4f28c28287d9715bf1a7a9693a809b099003ae88 | <ide><path>spring-web/src/main/java/org/springframework/web/client/RestTemplate.java
<ide> /*
<del> * Copyright 2002-2017 the original author or authors.
<add> * Copyright 2002-2018 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> else if (this.uriTemplateHandler instanceof org.springframework.web.util.Abstrac
<ide> * Configure the {@link UriTemplateHandler} to use to expand URI templates.
<ide> * By default the {@link DefaultUriBuilderFactory} is used which relies on
<ide> * Spring's URI template support and exposes several useful properties that
<del> * customize its behavior for encoding and for prepending a common base URL.
<add> * customize its behavior for encoding and for pre-pending a common base URL.
<ide> * An alternative implementation may be used to plug an external URI
<ide> * template library.
<add> * <p><strong>Note:</strong> if switching from
<add> * {@link org.springframework.web.util.DefaultUriTemplateHandler
<add> * DefaultUriTemplateHandler} (deprecated in 4.3) to
<add> * {@link DefaultUriBuilderFactory} keep in mind that the
<add> * {@link DefaultUriBuilderFactory} has a different default for the
<add> * {@code parsePath} property (from false to true).
<ide> * @param handler the URI template handler to use
<ide> */
<ide> public void setUriTemplateHandler(UriTemplateHandler handler) {
<ide><path>spring-web/src/main/java/org/springframework/web/util/DefaultUriTemplateHandler.java
<ide> /*
<del> * Copyright 2002-2017 the original author or authors.
<add> * Copyright 2002-2018 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> *
<ide> * @author Rossen Stoyanchev
<ide> * @since 4.2
<del> * @deprecated as of 5.0 in favor of {@link DefaultUriBuilderFactory}
<add> * @deprecated as of 5.0 in favor of {@link DefaultUriBuilderFactory}.
<add> * <p><strong>Note:</strong> {@link DefaultUriBuilderFactory} has a different
<add> * default for the {@link #setParsePath(boolean) parsePath} property (from
<add> * false to true).
<ide> */
<ide> @Deprecated
<ide> public class DefaultUriTemplateHandler extends AbstractUriTemplateHandler { | 2 |
Javascript | Javascript | add link to transcludefn description | 356e6b18d6287cdcea14b57ee525e7921f95a480 | <ide><path>src/ng/compile.js
<ide> * any other controller.
<ide> *
<ide> * * `transcludeFn` - A transclude linking function pre-bound to the correct transclusion scope.
<del> * This is the same as the `$transclude`
<del> * parameter of directive controllers, see there for details.
<add> * This is the same as the `$transclude` parameter of directive controllers,
<add> * see {@link ng.$compile#-controller- the controller section for details}.
<ide> * `function([scope], cloneLinkingFn, futureParentElement)`.
<ide> *
<ide> * #### Pre-linking function | 1 |
Javascript | Javascript | use full path for cmd.exe on win32 | c08da463adab71c05017ad6fe81927fa66e2e11e | <ide><path>lib/child_process.js
<ide> function normalizeExecArgs(command /*, options, callback */) {
<ide> }
<ide>
<ide> if (process.platform === 'win32') {
<del> file = 'cmd.exe';
<add> file = process.env.comspec || 'cmd.exe';
<ide> args = ['/s', '/c', '"' + command + '"'];
<ide> // Make a shallow copy before patching so we don't clobber the user's
<ide> // options object. | 1 |
Java | Java | fix broken test in mvcnamespacetests | 6b0a62569bfb5c8e20746eead6723a3ea23e443f | <ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/config/MvcNamespaceTests.java
<ide> import java.lang.annotation.Retention;
<ide> import java.lang.annotation.RetentionPolicy;
<ide> import java.lang.reflect.Method;
<add>import java.text.DateFormat;
<add>import java.text.SimpleDateFormat;
<ide> import java.util.Arrays;
<ide> import java.util.Date;
<ide> import java.util.List;
<ide> public void testDefaultConfig() throws Exception {
<ide> testController.testBind(now, null, null);
<ide> MvcUrls mvcUrls = this.appContext.getBean(MvcUrls.class);
<ide> UriComponents uriComponents = mvcUrls.linkToMethodOn(testController);
<del>
<del> assertEquals("http://localhost/?date=2013-10-21", uriComponents.toUriString());
<add> DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
<add> assertEquals("http://localhost/?date=" + dateFormat.format(now), uriComponents.toUriString());
<ide> }
<ide> finally {
<ide> RequestContextHolder.resetRequestAttributes(); | 1 |
PHP | PHP | fix a few bugs | 9acf685b749ac065f7b4ba52ded5eb5bcbc2bf4e | <ide><path>src/Illuminate/Exception/Handler.php
<ide> use ReflectionFunction;
<ide> use Illuminate\Contracts\Support\ResponsePreparer;
<ide> use Illuminate\Contracts\Exception\Handler as HandlerContract;
<add>use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
<ide> use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
<ide> use Symfony\Component\Debug\Exception\FatalErrorException as FatalError;
<ide>
<ide> public function pushError(Closure $callback)
<ide> $this->handlers[] = $callback;
<ide> }
<ide>
<add> /**
<add> * Register a 404 error handler.
<add> *
<add> * @param \Closure $callback
<add> * @return void
<add> */
<add> public function missing(Closure $callback)
<add> {
<add> $this->error(function(NotFoundHttpException $e) use ($callback)
<add> {
<add> return call_user_func($callback, $e);
<add> });
<add> }
<add>
<ide> /**
<ide> * Register an error handler for fatal errors.
<ide> *
<ide><path>src/Illuminate/Foundation/Application.php
<ide> public function run(SymfonyRequest $request = null)
<ide> $response = with($stack = $this->call($this->stack))->setContainer($this)->run($request);
<ide>
<ide> $response->send();
<del>
<del> $stack->terminate($request, $response);
<ide> }
<ide>
<ide> /**
<ide> public function abort($code, $message = '', array $headers = array())
<ide> throw new HttpException($code, $message, null, $headers);
<ide> }
<ide>
<del> /**
<del> * Register a 404 error handler.
<del> *
<del> * @param \Closure $callback
<del> * @return void
<del> */
<del> public function missing(Closure $callback)
<del> {
<del> $this->error(function(NotFoundHttpException $e) use ($callback)
<del> {
<del> return call_user_func($callback, $e);
<del> });
<del> }
<del>
<ide> /**
<ide> * Get the configuration loader instance.
<ide> * | 2 |
Java | Java | fix a typo | 8b8afe3def341da37c4db03f04ac87414326b34f | <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/ListableBeanFactory.java
<ide> public interface ListableBeanFactory extends BeanFactory {
<ide> * by other means than bean definitions.
<ide> * <p>This version of {@code getBeanNamesForType} matches all kinds of beans,
<ide> * be it singletons, prototypes, or FactoryBeans. In most implementations, the
<del> * result will be the same as for {@code getBeanNamesOfType(type, true, true)}.
<add> * result will be the same as for {@code getBeanNamesForType(type, true, true)}.
<ide> * <p>Bean names returned by this method should always return bean names <i>in the
<ide> * order of definition</i> in the backend configuration, as far as possible.
<ide> * @param type the class or interface to match, or {@code null} for all bean names | 1 |
Text | Text | update description of `external` | b4ae0cb97a1a0968cacd34390606d9acf49baf1f | <ide><path>doc/api/util.md
<ide> added: v10.0.0
<ide> * Returns: {boolean}
<ide>
<ide> Returns `true` if the value is a native `External` value.
<del>A native `External` value is a special type of object whose
<del>data is not stored within the JavaScript managed heap
<del>and does not conform to standard JavaScript types. Such
<del>objects are created either by Node.js internals or native
<del>addons and are wrapped by a JavaScript object.
<add>
<add>A native `External` value is a special type of object that contains a
<add>raw C++ pointer (`void*`) for access from native code, and has no other
<add>properties. Such objects are created either by Node.js internals or native
<add>addons. In JavaScript, they are [frozen][`Object.freeze()`] objects with a
<add>`null` prototype.
<ide>
<ide> ### `util.types.isFloat32Array(value)`
<ide> <!-- YAML
<ide> util.log('Timestamped message.');
<ide> [`Int8Array`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array
<ide> [`Map`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map
<ide> [`Object.assign()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
<add>[`Object.freeze()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze
<ide> [`Promise`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
<ide> [`Proxy`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy
<ide> [`Set`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set | 1 |
Python | Python | simplify hypothesis config | ba315034759fbf91c61bb55390edc86e7b2627f3 | <ide><path>numpy/_pytesttester.py
<ide> def __call__(self, label='fast', verbose=1, extra_argv=None,
<ide> import pytest
<ide> import warnings
<ide>
<del> # Imported after pytest to enable assertion rewriting
<del> import hypothesis
<del>
<ide> module = sys.modules[self.module_name]
<ide> module_path = os.path.abspath(module.__path__[0])
<ide>
<ide> def __call__(self, label='fast', verbose=1, extra_argv=None,
<ide>
<ide> pytest_args += ["--pyargs"] + list(tests)
<ide>
<del> # This configuration is picked up by numpy.conftest, and ensures that
<del> # running `np.test()` is deterministic and does not write any files.
<del> # See https://hypothesis.readthedocs.io/en/latest/settings.html
<del> hypothesis.settings.register_profile(
<del> name="np.test() profile",
<del> deadline=None, print_blob=True, database=None, derandomize=True,
<del> suppress_health_check=hypothesis.HealthCheck.all(),
<del> )
<del>
<ide> # run tests.
<ide> _show_numpy_info()
<ide>
<ide><path>numpy/conftest.py
<ide> hypothesis.configuration.set_hypothesis_home_dir(
<ide> os.path.join(tempfile.gettempdir(), ".hypothesis")
<ide> )
<del># See https://hypothesis.readthedocs.io/en/latest/settings.html
<add>
<add># We register two custom profiles for Numpy - for details see
<add># https://hypothesis.readthedocs.io/en/latest/settings.html
<add># The first is designed for our own CI runs; the latter also
<add># forces determinism and is designed for use via np.test()
<ide> hypothesis.settings.register_profile(
<ide> name="numpy-profile", deadline=None, print_blob=True,
<ide> )
<del># We try loading the profile defined by np.test(), which disables the
<del># database and forces determinism, and fall back to the profile defined
<del># above if we're running pytest directly. The odd dance is required
<del># because np.test() executes this file *after* its own setup code.
<del>try:
<del> hypothesis.settings.load_profile("np.test() profile")
<del>except hypothesis.errors.InvalidArgument: # profile not found
<del> hypothesis.settings.load_profile("numpy-profile")
<add>hypothesis.settings.register_profile(
<add> name="np.test() profile",
<add> deadline=None, print_blob=True, database=None, derandomize=True,
<add> suppress_health_check=hypothesis.HealthCheck.all(),
<add>)
<add># Note that the default profile is chosen based on the presence
<add># of pytest.ini, but can be overriden by passing the
<add># --hypothesis-profile=NAME argument to pytest.
<add>_pytest_ini = os.path.join(os.path.dirname(__file__), "..", "pytest.ini")
<add>hypothesis.settings.load_profile(
<add> "numpy-profile" if os.path.isfile(_pytest_ini) else "np.test() profile"
<add>)
<ide>
<ide>
<ide> def pytest_configure(config): | 2 |
PHP | PHP | remove redundant collection | b18678b80d6379edd15a841d90c7be8c7d20a734 | <ide><path>src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php
<ide> protected function cleanArray(array $data, $keyPrefix = '')
<ide> $data[$key] = $this->cleanValue($keyPrefix.$key, $value);
<ide> }
<ide>
<del> return collect($data)->all();
<add> return $data;
<ide> }
<ide>
<ide> /** | 1 |
Text | Text | add the manifest.in | 1e59f60e6ade34dd07882d0c60238964bc9ae725 | <ide><path>README.md
<del>[](https://flattr.com/submit/auto?user_id=nicolargo&url=https://github.com/nicolargo/glances&title=Glances&language=&tags=github&category=software)
<del>
<del>=============================
<del>Glances -- Eye on your system
<del>=============================
<del>
<del>## Description
<del>
<del>Glances is a CLI curses based monitoring tool for GNU/Linux and BSD OS.
<del>
<del>Glances uses the PsUtil library to get information from your system.
<del>
<del>It is developed in Python.
<del>
<del>
<del>
<del>## Installation
<del>
<del>### From package manager (very easy way)
<del>
<del>Packages exist for Arch, Fedora, Redhat, FreeBSD...
<del>
<del>### From PPA (easy way for Ubuntu/Mint...)
<del>
<del>Arnaud Hartmann (thanks to him !) maintains a PPA with the latest Glances version:
<del>
<del>To install the PPA just enter:
<del>
<del> $ sudo add-apt-repository ppa:arnaud-hartmann/glances-dev
<del> $ sudo apt-get update
<del>
<del>Then install Glances:
<del>
<del> $ sudo apt-get install glances
<del>
<del>### From PyPi (easy way)
<del>
<del>PyPi is an official Python package manager.
<del>
<del>You first need to install pypi on your system. For exemple on Debian/Ubuntu:
<del>
<del> $ sudo apt-get install python-pip
<del>
<del>Then install the latest Glances version:
<del>
<del> $ sudo pip install glances
<del>
<del>### From source
<del>
<del>Get the latest version:
<del>
<del> $ wget https://github.com/downloads/nicolargo/glances/glances-1.4.tar.gz
<del>
<del>Glances use a standard GNU style installer:
<del>
<del> $ tar zxvf glances-1.4.tar.gz
<del> $ cd glances-1.4
<del> $ sudo python setup.py install
<del>
<del>Pre-requisites:
<del>
<del>* Python 2.6+ (not tested with Python 3+)
<del>
<del>## Running
<del>
<del>Easy way (that's all folks !):
<del>
<del> $ glances.py
<del>
<del>## User guide
<del>
<del>By default, stats are refreshed every second, to change this setting, you can
<del>use the -t option. For exemple to set the refrech rate to 5 seconds:
<del>
<del> $ glances.py -t 5
<del>
<del>Importants stats are colored:
<del>
<del>* GREEN: stat counter is "OK"
<del>* BLUE: stat counter is "CAREFUL"
<del>* MAGENTA: stat counter is "WARNING"
<del>* RED: stat counter is "CRITICAL"
<del>
<del>When Glances is running, you can press:
<del>
<del>* 'h' to display an help message whith the keys you can press
<del>* 'a' to set the automatic mode. The processes are sorted automatically
<del>
<del> If CPU > 70%, sort by process "CPU consumption"
<del>
<del> If MEM > 70%, sort by process "memory size"
<del>
<del>* 'c' to sort the processes list by CPU consumption
<del>* 'd' Disable or enable the disk IO stats
<del>* 'f' Disable or enable the file system stats
<del>* 'l' Disable or enable the logs
<del>* 'm' to sort the processes list by process size
<del>* 'n' Disable or enable the network interfaces stats
<del>* 'q' Exit
<del>
<del>### Header
<del>
<del>
<del>
<del>The header shows the Glances version, the host name and the operating
<del>system name, version and architecture.
<del>
<del>### CPU
<del>
<del>
<del>
<del>The CPU states are shown as a percentage and for the configured refresh
<del>time.
<del>
<del>If user|kernel|nice CPU is < 50%, then status is set to "OK".
<del>
<del>If user|kernel|nice CPU is > 50%, then status is set to "CAREFUL".
<del>
<del>If user|kernel|nice CPU is > 70%, then status is set to "WARNING".
<del>
<del>If user|kernel|nice CPU is > 90%, then status is set to "CRITICAL".
<del>
<del>### Load
<del>
<del>
<del>
<del>On the Nosheep blog, Zach defines the average load: "In short it is the
<del>average sum of the number of processes waiting in the run-queue plus the
<del>number currently executing over 1, 5, and 15 minute time periods."
<del>
<del>Glances gets the number of CPU cores to adapt the alerts. With Glances,
<del>alerts on average load are only set on 5 and 15 mins.
<del>
<del>If average load is < O.7*Core, then status is set to "OK".
<del>
<del>If average load is > O.7*Core, then status is set to "CAREFUL".
<del>
<del>If average load is > 1*Core, then status is set to "WARNING".
<del>
<del>If average load is > 5*Core, then status is set to "CRITICAL".
<del>
<del>### Memory
<del>
<del>
<del>
<del>Glances uses tree columns: memory (RAM), swap and "real".
<del>
<del>Real used memory is: used - cache.
<del>
<del>Real free memory is: free + cache.
<del>
<del>With Glances, alerts are only set for on used swap and real memory.
<del>
<del>If memory is < 50%, then status is set to "OK".
<del>
<del>If memory is > 50%, then status is set to "CAREFUL".
<del>
<del>If memory is > 70%, then status is set to "WARNING".
<del>
<del>If memory is > 90%, then status is set to "CRITICAL".
<del>
<del>### Network bit rate
<del>
<del>
<del>
<del>Glances display the network interface bit rate. The unit is adapted
<del>dynamicaly (bits per second, Kbits per second, Mbits per second...).
<del>
<del>Alerts are set only if the network interface maximum speed is available.
<del>
<del>If bitrate is < 50%, then status is set to "OK".
<del>
<del>If bitrate is > 50%, then status is set to "CAREFUL".
<del>
<del>If bitrate is > 70%, then status is set to "WARNING".
<del>
<del>If bitrate is > 90%, then status is set to "CRITICAL".
<del>
<del>For exemple, on a 100 Mbps Ethernet interface, the warning status is set
<del>if the bit rate is higher than 70 Mbps.
<del>
<del>### Disk I/O
<del>
<del>
<del>
<del>Glances display the disk I/O throughput. The unit is adapted dynamicaly
<del>(bytes per second, Kbytes per second, Mbytes per second...).
<del>
<del>There is no alert on this information.
<del>
<del>### Filesystem
<del>
<del>
<del>
<del>Glances display the total and used filesytem disk space. The unit is
<del>adapted dynamicaly (bytes per second, Kbytes per second, Mbytes per
<del>second...).
<del>
<del>Alerts are set for used disk space:
<del>
<del>If disk used is < 50%, then status is set to "OK".
<del>
<del>If disk used is > 50%, then status is set to "CAREFUL".
<del>
<del>If disk used is > 70%, then status is set to "WARNING".
<del>
<del>If disk used is > 90%, then status is set to "CRITICAL".
<del>
<del>### Processes
<del>
<del>
<del>
<del>Glances displays a summary and a list of processes.
<del>
<del>By default (or if you hit the 'a' key) the process list is automaticaly
<del>sorted by CPU of memory consumption.
<del>
<del>The number of processes in the list is adapted to the screen size.
<del>
<del>### Logs
<del>
<del>
<del>
<del>A logs list is displayed in the bottom of the screen if (an only if):
<del>
<del>* at least one WARNING or CRITICAL alert was occured.
<del>* space is available in the bottom of the console/terminal
<del>
<del>There is one line per alert with the following information:
<del>
<del>* start date
<del>* end date
<del>* alert name
<del>* (min/avg/max) values
<del>
<del>### Footer
<del>
<del>
<del>
<del>Glances displays a caption and the current time/date.
<del>
<del>## Localisation
<del>
<del>To generate french locale execute as root or sudo :
<del>i18n_francais_generate.sh
<del>
<del>To generate spanish locale execute as root or sudo :
<del>i18n_espanol_generate.sh
<del>
<del>## Todo
<del>
<del>You are welcome to contribute to this software.
<del>
<del>* Packaging for Debian, Ubuntu, BSD...
<del>* Check the needed Python library in the configure.ac
<del>* Add file system stats when the python-statgrab is corrected
<ide><path>README.md
<add>README
<ide>\ No newline at end of file | 2 |
Javascript | Javascript | remove unnecessary resolvercachekey | 80c5127dc13de3abc9e5c9894d0edddd6737a668 | <ide><path>packages/container/lib/container.js
<ide> export default class Container {
<ide> return { [OWNER]: this.owner };
<ide> }
<ide>
<del> _resolverCacheKey(name) {
<del> return this.registry.resolverCacheKey(name);
<del> }
<del>
<ide> /**
<ide> Given a fullName, return the corresponding factory. The consumer of the factory
<ide> is responsible for the destruction of any factory instances, as there is no
<ide> function lookup(container, fullName, options = {}) {
<ide> }
<ide>
<ide> if (options.singleton !== false) {
<del> let cacheKey = container._resolverCacheKey(normalizedName);
<del> let cached = container.cache[cacheKey];
<add> let cached = container.cache[normalizedName];
<ide> if (cached !== undefined) {
<ide> return cached;
<ide> }
<ide> function lookup(container, fullName, options = {}) {
<ide>
<ide>
<ide> function factoryFor(container, normalizedName, fullName) {
<del> let cacheKey = container._resolverCacheKey(normalizedName);
<del> let cached = container.factoryManagerCache[cacheKey];
<add> let cached = container.factoryManagerCache[normalizedName];
<ide>
<ide> if (cached !== undefined) { return cached; }
<ide>
<ide> function factoryFor(container, normalizedName, fullName) {
<ide> manager = wrapManagerInDeprecationProxy(manager);
<ide> }
<ide>
<del> container.factoryManagerCache[cacheKey] = manager;
<add> container.factoryManagerCache[normalizedName] = manager;
<ide> return manager;
<ide> }
<ide>
<ide> function instantiateFactory(container, normalizedName, fullName, options) {
<ide> // SomeClass { singleton: true, instantiate: true } | { singleton: true } | { instantiate: true } | {}
<ide> // By default majority of objects fall into this case
<ide> if (isSingletonInstance(container, fullName, options)) {
<del> let cacheKey = container._resolverCacheKey(normalizedName);
<del> return container.cache[cacheKey] = factoryManager.create();
<add> return container.cache[normalizedName] = factoryManager.create();
<ide> }
<ide>
<ide> // SomeClass { singleton: false, instantiate: true }
<ide> function resetCache(container) {
<ide> }
<ide>
<ide> function resetMember(container, fullName) {
<del> let cacheKey = container._resolverCacheKey(fullName);
<del> let member = container.cache[cacheKey];
<add> let member = container.cache[fullName];
<ide>
<del> delete container.factoryManagerCache[cacheKey];
<add> delete container.factoryManagerCache[fullName];
<ide>
<ide> if (member) {
<del> delete container.cache[cacheKey];
<add> delete container.cache[fullName];
<ide>
<ide> if (member.destroy) {
<ide> member.destroy();
<ide><path>packages/container/lib/registry.js
<ide> export default class Registry {
<ide> assert(`Attempting to register an unknown factory: '${fullName}'`, factory !== undefined);
<ide>
<ide> let normalizedName = this.normalize(fullName);
<del> let cacheKey = this.resolverCacheKey(normalizedName);
<del> assert(`Cannot re-register: '${fullName}', as it has already been resolved.`, !this._resolveCache[cacheKey]);
<add> assert(`Cannot re-register: '${fullName}', as it has already been resolved.`, !this._resolveCache[normalizedName]);
<ide>
<del> this._failSet.delete(cacheKey);
<add> this._failSet.delete(normalizedName);
<ide> this.registrations[normalizedName] = factory;
<ide> this._options[normalizedName] = options;
<ide> }
<ide> export default class Registry {
<ide> assert('fullName must be a proper full name', this.isValidFullName(fullName));
<ide>
<ide> let normalizedName = this.normalize(fullName);
<del> let cacheKey = this.resolverCacheKey(normalizedName);
<ide>
<ide> this._localLookupCache = Object.create(null);
<ide>
<ide> delete this.registrations[normalizedName];
<del> delete this._resolveCache[cacheKey];
<add> delete this._resolveCache[normalizedName];
<ide> delete this._options[normalizedName];
<del> this._failSet.delete(cacheKey);
<add> this._failSet.delete(normalizedName);
<ide> }
<ide>
<ide> /**
<ide> export default class Registry {
<ide> return injections;
<ide> }
<ide>
<del> resolverCacheKey(name) {
<del> return name;
<del> }
<del>
<ide> /**
<ide> Given a fullName and a source fullName returns the fully resolved
<ide> fullName. Used to allow for local lookup.
<ide> function resolve(registry, normalizedName, options) {
<ide> }
<ide> }
<ide>
<del> let cacheKey = registry.resolverCacheKey(normalizedName);
<del> let cached = registry._resolveCache[cacheKey];
<add> let cached = registry._resolveCache[normalizedName];
<ide> if (cached !== undefined) { return cached; }
<del> if (registry._failSet.has(cacheKey)) { return; }
<add> if (registry._failSet.has(normalizedName)) { return; }
<ide>
<ide> let resolved;
<ide>
<ide> function resolve(registry, normalizedName, options) {
<ide> }
<ide>
<ide> if (resolved === undefined) {
<del> registry._failSet.add(cacheKey);
<add> registry._failSet.add(normalizedName);
<ide> } else {
<del> registry._resolveCache[cacheKey] = resolved;
<add> registry._resolveCache[normalizedName] = resolved;
<ide> }
<ide>
<ide> return resolved; | 2 |
Ruby | Ruby | clarify comments about sanitized_allowed_tags | 95acea5498f1e9ac43cf87b55578e0a8d576680b | <ide><path>actionview/lib/action_view/helpers/sanitize_helper.rb
<ide> module SanitizeHelper
<ide> # Add table tags to the default allowed tags
<ide> #
<ide> # class Application < Rails::Application
<del> # config.action_view.sanitized_allowed_tags = 'table', 'tr', 'td'
<add> # config.action_view.sanitized_allowed_tags = ['table', 'tr', 'td']
<ide> # end
<ide> #
<ide> # Remove tags to the default allowed tags
<ide> def white_list_sanitizer
<ide> # Replaces the allowed tags for the +sanitize+ helper.
<ide> #
<ide> # class Application < Rails::Application
<del> # config.action_view.sanitized_allowed_tags = 'table', 'tr', 'td'
<add> # config.action_view.sanitized_allowed_tags = ['table', 'tr', 'td']
<ide> # end
<ide> #
<ide> | 1 |
Java | Java | fix generics t[] in zip & combinelatest | 9966209d74fdd33d54f633a444c95c601aa21955 | <ide><path>src/main/java/io/reactivex/Flowable.java
<ide> public static int bufferSize() {
<ide> * Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of
<ide> * the source Publishers each time an item is received from any of the source Publishers, where this
<ide> * aggregation is defined by a specified function.
<add> * <p>
<add> * Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
<add> * implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
<add> * {@code Function<Integer[], R>} passed to the method would trigger a {@code ClassCastException}.
<add> *
<ide> * <dl>
<ide> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Publisher} honors backpressure from downstream. The source {@code Publisher}s
<ide> public static int bufferSize() {
<ide> */
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> @BackpressureSupport(BackpressureKind.FULL)
<del> public static <T, R> Flowable<R> combineLatest(Publisher<? extends T>[] sources, Function<? super T[], ? extends R> combiner) {
<add> public static <T, R> Flowable<R> combineLatest(Publisher<? extends T>[] sources, Function<? super Object[], ? extends R> combiner) {
<ide> return combineLatest(sources, combiner, bufferSize());
<ide> }
<ide>
<ide> /**
<ide> * Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of
<ide> * the source Publishers each time an item is received from any of the source Publishers, where this
<ide> * aggregation is defined by a specified function.
<add> * <p>
<add> * Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
<add> * implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
<add> * {@code Function<Integer[], R>} passed to the method would trigger a {@code ClassCastException}.
<add> *
<ide> * <dl>
<ide> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Publisher} honors backpressure from downstream. The source {@code Publisher}s
<ide> public static <T, R> Flowable<R> combineLatest(Publisher<? extends T>[] sources,
<ide> */
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> @BackpressureSupport(BackpressureKind.FULL)
<del> public static <T, R> Flowable<R> combineLatest(Function<? super T[], ? extends R> combiner, Publisher<? extends T>... sources) {
<add> public static <T, R> Flowable<R> combineLatest(Function<? super Object[], ? extends R> combiner, Publisher<? extends T>... sources) {
<ide> return combineLatest(sources, combiner, bufferSize());
<ide> }
<ide>
<ide> /**
<ide> * Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of
<ide> * the source Publishers each time an item is received from any of the source Publishers, where this
<ide> * aggregation is defined by a specified function.
<add> * <p>
<add> * Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
<add> * implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
<add> * {@code Function<Integer[], R>} passed to the method would trigger a {@code ClassCastException}.
<add> *
<ide> * <dl>
<ide> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Publisher} honors backpressure from downstream. The source {@code Publisher}s
<ide> public static <T, R> Flowable<R> combineLatest(Function<? super T[], ? extends R
<ide> */
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> @BackpressureSupport(BackpressureKind.FULL)
<del> public static <T, R> Flowable<R> combineLatest(Publisher<? extends T>[] sources, Function<? super T[], ? extends R> combiner, int bufferSize) {
<add> public static <T, R> Flowable<R> combineLatest(Publisher<? extends T>[] sources, Function<? super Object[], ? extends R> combiner, int bufferSize) {
<ide> ObjectHelper.requireNonNull(sources, "sources is null");
<ide> if (sources.length == 0) {
<ide> return empty();
<ide> public static <T, R> Flowable<R> combineLatest(Publisher<? extends T>[] sources,
<ide> * Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of
<ide> * the source Publishers each time an item is received from any of the source Publishers, where this
<ide> * aggregation is defined by a specified function.
<add> * <p>
<add> * Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
<add> * implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
<add> * {@code Function<Integer[], R>} passed to the method would trigger a {@code ClassCastException}.
<add> *
<ide> * <dl>
<ide> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Publisher} honors backpressure from downstream. The source {@code Publisher}s
<ide> public static <T, R> Flowable<R> combineLatest(Publisher<? extends T>[] sources,
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> @BackpressureSupport(BackpressureKind.FULL)
<ide> public static <T, R> Flowable<R> combineLatest(Iterable<? extends Publisher<? extends T>> sources,
<del> Function<? super T[], ? extends R> combiner) {
<add> Function<? super Object[], ? extends R> combiner) {
<ide> return combineLatest(sources, combiner, bufferSize());
<ide> }
<ide>
<ide> /**
<ide> * Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of
<ide> * the source Publishers each time an item is received from any of the source Publishers, where this
<ide> * aggregation is defined by a specified function.
<add> * <p>
<add> * Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
<add> * implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
<add> * {@code Function<Integer[], R>} passed to the method would trigger a {@code ClassCastException}.
<add> *
<ide> * <dl>
<ide> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Publisher} honors backpressure from downstream. The source {@code Publisher}s
<ide> public static <T, R> Flowable<R> combineLatest(Iterable<? extends Publisher<? ex
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> @BackpressureSupport(BackpressureKind.FULL)
<ide> public static <T, R> Flowable<R> combineLatest(Iterable<? extends Publisher<? extends T>> sources,
<del> Function<? super T[], ? extends R> combiner, int bufferSize) {
<add> Function<? super Object[], ? extends R> combiner, int bufferSize) {
<ide> ObjectHelper.requireNonNull(sources, "sources is null");
<ide> ObjectHelper.requireNonNull(combiner, "combiner is null");
<ide> ObjectHelper.verifyPositive(bufferSize, "bufferSize");
<ide> public static <T, R> Flowable<R> combineLatest(Iterable<? extends Publisher<? ex
<ide> * Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of
<ide> * the source Publishers each time an item is received from any of the source Publishers, where this
<ide> * aggregation is defined by a specified function.
<add> * <p>
<add> * Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
<add> * implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
<add> * {@code Function<Integer[], R>} passed to the method would trigger a {@code ClassCastException}.
<add> *
<ide> * <dl>
<ide> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Publisher} honors backpressure from downstream. The source {@code Publisher}s
<ide> public static <T, R> Flowable<R> combineLatest(Iterable<? extends Publisher<? ex
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> @BackpressureSupport(BackpressureKind.FULL)
<ide> public static <T, R> Flowable<R> combineLatestDelayError(Publisher<? extends T>[] sources,
<del> Function<? super T[], ? extends R> combiner) {
<add> Function<? super Object[], ? extends R> combiner) {
<ide> return combineLatestDelayError(sources, combiner, bufferSize());
<ide> }
<ide>
<ide> public static <T, R> Flowable<R> combineLatestDelayError(Publisher<? extends T>[
<ide> * the source Publishers each time an item is received from any of the source Publishers, where this
<ide> * aggregation is defined by a specified function and delays any error from the sources until
<ide> * all source Publishers terminate.
<add> * <p>
<add> * Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
<add> * implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
<add> * {@code Function<Integer[], R>} passed to the method would trigger a {@code ClassCastException}.
<ide> *
<ide> * <dl>
<ide> * <dt><b>Backpressure:</b></dt>
<ide> public static <T, R> Flowable<R> combineLatestDelayError(Publisher<? extends T>[
<ide> */
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> @BackpressureSupport(BackpressureKind.FULL)
<del> public static <T, R> Flowable<R> combineLatestDelayError(Function<? super T[], ? extends R> combiner,
<add> public static <T, R> Flowable<R> combineLatestDelayError(Function<? super Object[], ? extends R> combiner,
<ide> Publisher<? extends T>... sources) {
<ide> return combineLatestDelayError(sources, combiner, bufferSize());
<ide> }
<ide> public static <T, R> Flowable<R> combineLatestDelayError(Function<? super T[], ?
<ide> * the source ObservableSources each time an item is received from any of the source Publisher, where this
<ide> * aggregation is defined by a specified function and delays any error from the sources until
<ide> * all source Publishers terminate.
<add> * <p>
<add> * Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
<add> * implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
<add> * {@code Function<Integer[], R>} passed to the method would trigger a {@code ClassCastException}.
<ide> *
<ide> * <dl>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public static <T, R> Flowable<R> combineLatestDelayError(Function<? super T[], ?
<ide> * @see <a href="http://reactivex.io/documentation/operators/combinelatest.html">ReactiveX operators documentation: CombineLatest</a>
<ide> */
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<del> public static <T, R> Flowable<R> combineLatestDelayError(Function<? super T[], ? extends R> combiner,
<add> public static <T, R> Flowable<R> combineLatestDelayError(Function<? super Object[], ? extends R> combiner,
<ide> int bufferSize, Publisher<? extends T>... sources) {
<ide> return combineLatestDelayError(sources, combiner, bufferSize);
<ide> }
<ide> public static <T, R> Flowable<R> combineLatestDelayError(Function<? super T[], ?
<ide> * the source Publishers each time an item is received from any of the source Publishers, where this
<ide> * aggregation is defined by a specified function and delays any error from the sources until
<ide> * all source Publishers terminate.
<add> * <p>
<add> * Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
<add> * implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
<add> * {@code Function<Integer[], R>} passed to the method would trigger a {@code ClassCastException}.
<ide> *
<ide> * <dl>
<ide> * <dt><b>Backpressure:</b></dt>
<ide> public static <T, R> Flowable<R> combineLatestDelayError(Function<? super T[], ?
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> @BackpressureSupport(BackpressureKind.FULL)
<ide> public static <T, R> Flowable<R> combineLatestDelayError(Publisher<? extends T>[] sources,
<del> Function<? super T[], ? extends R> combiner, int bufferSize) {
<add> Function<? super Object[], ? extends R> combiner, int bufferSize) {
<ide> ObjectHelper.requireNonNull(sources, "sources is null");
<ide> ObjectHelper.requireNonNull(combiner, "combiner is null");
<ide> ObjectHelper.verifyPositive(bufferSize, "bufferSize");
<ide> public static <T, R> Flowable<R> combineLatestDelayError(Publisher<? extends T>[
<ide> * the source Publishers each time an item is received from any of the source Publishers, where this
<ide> * aggregation is defined by a specified function and delays any error from the sources until
<ide> * all source Publishers terminate.
<add> * <p>
<add> * Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
<add> * implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
<add> * {@code Function<Integer[], R>} passed to the method would trigger a {@code ClassCastException}.
<ide> *
<ide> * <dl>
<ide> * <dt><b>Backpressure:</b></dt>
<ide> public static <T, R> Flowable<R> combineLatestDelayError(Publisher<? extends T>[
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> @BackpressureSupport(BackpressureKind.FULL)
<ide> public static <T, R> Flowable<R> combineLatestDelayError(Iterable<? extends Publisher<? extends T>> sources,
<del> Function<? super T[], ? extends R> combiner) {
<add> Function<? super Object[], ? extends R> combiner) {
<ide> return combineLatestDelayError(sources, combiner, bufferSize());
<ide> }
<ide>
<ide> public static <T, R> Flowable<R> combineLatestDelayError(Iterable<? extends Publ
<ide> * the source Publishers each time an item is received from any of the source Publishers, where this
<ide> * aggregation is defined by a specified function and delays any error from the sources until
<ide> * all source Publishers terminate.
<add> * <p>
<add> * Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
<add> * implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
<add> * {@code Function<Integer[], R>} passed to the method would trigger a {@code ClassCastException}.
<ide> *
<ide> * <dl>
<ide> * <dt><b>Backpressure:</b></dt>
<ide> public static <T, R> Flowable<R> combineLatestDelayError(Iterable<? extends Publ
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> @BackpressureSupport(BackpressureKind.FULL)
<ide> public static <T, R> Flowable<R> combineLatestDelayError(Iterable<? extends Publisher<? extends T>> sources,
<del> Function<? super T[], ? extends R> combiner, int bufferSize) {
<add> Function<? super Object[], ? extends R> combiner, int bufferSize) {
<ide> ObjectHelper.requireNonNull(sources, "sources is null");
<ide> ObjectHelper.requireNonNull(combiner, "combiner is null");
<ide> ObjectHelper.verifyPositive(bufferSize, "bufferSize");
<ide> public final TestSubscriber<T> test(long initialRequest, boolean cancel) { // No
<ide> return ts;
<ide> }
<ide>
<del>}
<ide>\ No newline at end of file
<add>}
<ide><path>src/main/java/io/reactivex/Maybe.java
<ide> public static <T> Maybe<T> wrap(MaybeSource<T> source) {
<ide> * Returns a Maybe that emits the results of a specified combiner function applied to combinations of
<ide> * items emitted, in sequence, by an Iterable of other MaybeSources.
<ide> * <p>
<add> * Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
<add> * implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
<add> * {@code Function<Integer[], R>} passed to the method would trigger a {@code ClassCastException}.
<add> *
<add> * <p>
<ide> * <img width="640" height="380" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/zip.png" alt="">
<ide> * <p>This operator terminates eagerly if any of the source MaybeSources signal an onError or onComplete. This
<ide> * also means it is possible some sources may not get subscribed to at all.
<ide> public static <T> Maybe<T> wrap(MaybeSource<T> source) {
<ide> * @see <a href="http://reactivex.io/documentation/operators/zip.html">ReactiveX operators documentation: Zip</a>
<ide> */
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<del> public static <T, R> Maybe<R> zip(Iterable<? extends MaybeSource<? extends T>> sources, Function<? super T[], ? extends R> zipper) {
<add> public static <T, R> Maybe<R> zip(Iterable<? extends MaybeSource<? extends T>> sources, Function<? super Object[], ? extends R> zipper) {
<ide> ObjectHelper.requireNonNull(zipper, "zipper is null");
<ide> ObjectHelper.requireNonNull(sources, "sources is null");
<ide> return RxJavaPlugins.onAssembly(new MaybeZipIterable<T, R>(sources, zipper));
<ide> public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, R> Maybe<R> zip(
<ide> * Returns a Maybe that emits the results of a specified combiner function applied to combinations of
<ide> * items emitted, in sequence, by an array of other MaybeSources.
<ide> * <p>
<add> * Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
<add> * implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
<add> * {@code Function<Integer[], R>} passed to the method would trigger a {@code ClassCastException}.
<add> *
<add> * <p>
<ide> * <img width="640" height="380" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/zip.png" alt="">
<ide> * <p>This operator terminates eagerly if any of the source MaybeSources signal an onError or onComplete. This
<ide> * also means it is possible some sources may not get subscribed to at all.
<ide> public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, R> Maybe<R> zip(
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> public static <T, R> Maybe<R> zipArray(Function<? super Object[], ? extends R> zipper,
<ide> MaybeSource<? extends T>... sources) {
<add> ObjectHelper.requireNonNull(sources, "sources is null");
<ide> if (sources.length == 0) {
<ide> return empty();
<ide> }
<ide><path>src/main/java/io/reactivex/Observable.java
<ide> public static int bufferSize() {
<ide> * Combines a collection of source ObservableSources by emitting an item that aggregates the latest values of each of
<ide> * the source ObservableSources each time an item is received from any of the source ObservableSources, where this
<ide> * aggregation is defined by a specified function.
<add> * <p>
<add> * Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
<add> * implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
<add> * {@code Function<Integer[], R>} passed to the method would trigger a {@code ClassCastException}.
<add> *
<ide> * <dl>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code combineLatest} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> public static int bufferSize() {
<ide> * @see <a href="http://reactivex.io/documentation/operators/combinelatest.html">ReactiveX operators documentation: CombineLatest</a>
<ide> */
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<del> public static <T, R> Observable<R> combineLatest(Function<? super T[], ? extends R> combiner, int bufferSize, ObservableSource<? extends T>... sources) {
<add> public static <T, R> Observable<R> combineLatest(Function<? super Object[], ? extends R> combiner, int bufferSize, ObservableSource<? extends T>... sources) {
<ide> return combineLatest(sources, combiner, bufferSize);
<ide> }
<ide>
<ide> /**
<ide> * Combines a collection of source ObservableSources by emitting an item that aggregates the latest values of each of
<ide> * the source ObservableSources each time an item is received from any of the source ObservableSources, where this
<ide> * aggregation is defined by a specified function.
<add> * <p>
<add> * Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
<add> * implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
<add> * {@code Function<Integer[], R>} passed to the method would trigger a {@code ClassCastException}.
<add> *
<ide> * <dl>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code combineLatest} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> public static <T, R> Observable<R> combineLatest(Function<? super T[], ? extends
<ide> */
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> public static <T, R> Observable<R> combineLatest(Iterable<? extends ObservableSource<? extends T>> sources,
<del> Function<? super T[], ? extends R> combiner) {
<add> Function<? super Object[], ? extends R> combiner) {
<ide> return combineLatest(sources, combiner, bufferSize());
<ide> }
<ide>
<ide> public static <T, R> Observable<R> combineLatest(Iterable<? extends ObservableSo
<ide> * Combines a collection of source ObservableSources by emitting an item that aggregates the latest values of each of
<ide> * the source ObservableSources each time an item is received from any of the source ObservableSources, where this
<ide> * aggregation is defined by a specified function.
<add> * <p>
<add> * Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
<add> * implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
<add> * {@code Function<Integer[], R>} passed to the method would trigger a {@code ClassCastException}.
<add> *
<ide> * <dl>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code combineLatest} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> public static <T, R> Observable<R> combineLatest(Iterable<? extends ObservableSo
<ide> */
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> public static <T, R> Observable<R> combineLatest(Iterable<? extends ObservableSource<? extends T>> sources,
<del> Function<? super T[], ? extends R> combiner, int bufferSize) {
<add> Function<? super Object[], ? extends R> combiner, int bufferSize) {
<ide> ObjectHelper.requireNonNull(sources, "sources is null");
<ide> ObjectHelper.requireNonNull(combiner, "combiner is null");
<ide> ObjectHelper.verifyPositive(bufferSize, "bufferSize");
<ide> public static <T, R> Observable<R> combineLatest(Iterable<? extends ObservableSo
<ide> * Combines a collection of source ObservableSources by emitting an item that aggregates the latest values of each of
<ide> * the source ObservableSources each time an item is received from any of the source ObservableSources, where this
<ide> * aggregation is defined by a specified function.
<add> * <p>
<add> * Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
<add> * implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
<add> * {@code Function<Integer[], R>} passed to the method would trigger a {@code ClassCastException}.
<add> *
<ide> * <dl>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code combineLatest} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> public static <T, R> Observable<R> combineLatest(Iterable<? extends ObservableSo
<ide> */
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> public static <T, R> Observable<R> combineLatest(ObservableSource<? extends T>[] sources,
<del> Function<? super T[], ? extends R> combiner) {
<add> Function<? super Object[], ? extends R> combiner) {
<ide> return combineLatest(sources, combiner, bufferSize());
<ide> }
<ide>
<ide> /**
<ide> * Combines a collection of source ObservableSources by emitting an item that aggregates the latest values of each of
<ide> * the source ObservableSources each time an item is received from any of the source ObservableSources, where this
<ide> * aggregation is defined by a specified function.
<add> * <p>
<add> * Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
<add> * implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
<add> * {@code Function<Integer[], R>} passed to the method would trigger a {@code ClassCastException}.
<add> *
<ide> * <dl>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code combineLatest} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> public static <T, R> Observable<R> combineLatest(ObservableSource<? extends T>[]
<ide> */
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> public static <T, R> Observable<R> combineLatest(ObservableSource<? extends T>[] sources,
<del> Function<? super T[], ? extends R> combiner, int bufferSize) {
<add> Function<? super Object[], ? extends R> combiner, int bufferSize) {
<ide> ObjectHelper.requireNonNull(sources, "sources is null");
<ide> if (sources.length == 0) {
<ide> return empty();
<ide> public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, R> Observable<R> combineLates
<ide> * Combines a collection of source ObservableSources by emitting an item that aggregates the latest values of each of
<ide> * the source ObservableSources each time an item is received from any of the source ObservableSources, where this
<ide> * aggregation is defined by a specified function.
<add> * <p>
<add> * Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
<add> * implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
<add> * {@code Function<Integer[], R>} passed to the method would trigger a {@code ClassCastException}.
<add> *
<ide> * <dl>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code combineLatest} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, R> Observable<R> combineLates
<ide> */
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> public static <T, R> Observable<R> combineLatestDelayError(ObservableSource<? extends T>[] sources,
<del> Function<? super T[], ? extends R> combiner) {
<add> Function<? super Object[], ? extends R> combiner) {
<ide> return combineLatestDelayError(sources, combiner, bufferSize());
<ide> }
<ide>
<ide> public static <T, R> Observable<R> combineLatestDelayError(ObservableSource<? ex
<ide> * the source ObservableSources each time an item is received from any of the source ObservableSources, where this
<ide> * aggregation is defined by a specified function and delays any error from the sources until
<ide> * all source ObservableSources terminate.
<add> * <p>
<add> * Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
<add> * implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
<add> * {@code Function<Integer[], R>} passed to the method would trigger a {@code ClassCastException}.
<ide> *
<ide> * <dl>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public static <T, R> Observable<R> combineLatestDelayError(ObservableSource<? ex
<ide> * @see <a href="http://reactivex.io/documentation/operators/combinelatest.html">ReactiveX operators documentation: CombineLatest</a>
<ide> */
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<del> public static <T, R> Observable<R> combineLatestDelayError(Function<? super T[], ? extends R> combiner,
<add> public static <T, R> Observable<R> combineLatestDelayError(Function<? super Object[], ? extends R> combiner,
<ide> int bufferSize, ObservableSource<? extends T>... sources) {
<ide> return combineLatestDelayError(sources, combiner, bufferSize);
<ide> }
<ide> public static <T, R> Observable<R> combineLatestDelayError(Function<? super T[],
<ide> * the source ObservableSources each time an item is received from any of the source ObservableSources, where this
<ide> * aggregation is defined by a specified function and delays any error from the sources until
<ide> * all source ObservableSources terminate.
<add> * <p>
<add> * Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
<add> * implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
<add> * {@code Function<Integer[], R>} passed to the method would trigger a {@code ClassCastException}.
<ide> *
<ide> * <dl>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public static <T, R> Observable<R> combineLatestDelayError(Function<? super T[],
<ide> */
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> public static <T, R> Observable<R> combineLatestDelayError(ObservableSource<? extends T>[] sources,
<del> Function<? super T[], ? extends R> combiner, int bufferSize) {
<add> Function<? super Object[], ? extends R> combiner, int bufferSize) {
<ide> ObjectHelper.verifyPositive(bufferSize, "bufferSize");
<ide> ObjectHelper.requireNonNull(combiner, "combiner is null");
<ide> if (sources.length == 0) {
<ide> public static <T, R> Observable<R> combineLatestDelayError(ObservableSource<? ex
<ide> * the source ObservableSources each time an item is received from any of the source ObservableSources, where this
<ide> * aggregation is defined by a specified function and delays any error from the sources until
<ide> * all source ObservableSources terminate.
<add> * <p>
<add> * Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
<add> * implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
<add> * {@code Function<Integer[], R>} passed to the method would trigger a {@code ClassCastException}.
<ide> *
<ide> * <dl>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public static <T, R> Observable<R> combineLatestDelayError(ObservableSource<? ex
<ide> */
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> public static <T, R> Observable<R> combineLatestDelayError(Iterable<? extends ObservableSource<? extends T>> sources,
<del> Function<? super T[], ? extends R> combiner) {
<add> Function<? super Object[], ? extends R> combiner) {
<ide> return combineLatestDelayError(sources, combiner, bufferSize());
<ide> }
<ide>
<ide> public static <T, R> Observable<R> combineLatestDelayError(Iterable<? extends Ob
<ide> * the source ObservableSources each time an item is received from any of the source ObservableSources, where this
<ide> * aggregation is defined by a specified function and delays any error from the sources until
<ide> * all source ObservableSources terminate.
<add> * <p>
<add> * Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
<add> * implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
<add> * {@code Function<Integer[], R>} passed to the method would trigger a {@code ClassCastException}.
<ide> *
<ide> * <dl>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public static <T, R> Observable<R> combineLatestDelayError(Iterable<? extends Ob
<ide> */
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> public static <T, R> Observable<R> combineLatestDelayError(Iterable<? extends ObservableSource<? extends T>> sources,
<del> Function<? super T[], ? extends R> combiner, int bufferSize) {
<add> Function<? super Object[], ? extends R> combiner, int bufferSize) {
<ide> ObjectHelper.requireNonNull(sources, "sources is null");
<ide> ObjectHelper.requireNonNull(combiner, "combiner is null");
<ide> ObjectHelper.verifyPositive(bufferSize, "bufferSize");
<ide> public static <T> Observable<T> wrap(ObservableSource<T> source) {
<ide> * use {@code doOnUnsubscribed()} as well or use {@code using()} to do cleanup in case of completion
<ide> * or unsubscription.
<ide> * <p>
<add> * Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
<add> * implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
<add> * {@code Function<Integer[], R>} passed to the method would trigger a {@code ClassCastException}.
<add> *
<add> * <p>
<ide> * <img width="640" height="380" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/zip.png" alt="">
<ide> * <dl>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public static <T> Observable<T> wrap(ObservableSource<T> source) {
<ide> * @see <a href="http://reactivex.io/documentation/operators/zip.html">ReactiveX operators documentation: Zip</a>
<ide> */
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<del> public static <T, R> Observable<R> zip(Iterable<? extends ObservableSource<? extends T>> sources, Function<? super T[], ? extends R> zipper) {
<add> public static <T, R> Observable<R> zip(Iterable<? extends ObservableSource<? extends T>> sources, Function<? super Object[], ? extends R> zipper) {
<ide> ObjectHelper.requireNonNull(zipper, "zipper is null");
<ide> ObjectHelper.requireNonNull(sources, "sources is null");
<ide> return RxJavaPlugins.onAssembly(new ObservableZip<T, R>(null, sources, zipper, bufferSize(), false));
<ide> public static <T, R> Observable<R> zip(Iterable<? extends ObservableSource<? ext
<ide> * use {@code doOnUnsubscribed()} as well or use {@code using()} to do cleanup in case of completion
<ide> * or unsubscription.
<ide> * <p>
<add> * Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
<add> * implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
<add> * {@code Function<Integer[], R>} passed to the method would trigger a {@code ClassCastException}.
<add> *
<add> * <p>
<ide> * <img width="640" height="370" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/zip.o.png" alt="">
<ide> * <dl>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public static <T, R> Observable<R> zip(Iterable<? extends ObservableSource<? ext
<ide> */
<ide> @SuppressWarnings({ "rawtypes", "unchecked" })
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<del> public static <T, R> Observable<R> zip(ObservableSource<? extends ObservableSource<? extends T>> sources, final Function<? super T[], ? extends R> zipper) {
<add> public static <T, R> Observable<R> zip(ObservableSource<? extends ObservableSource<? extends T>> sources, final Function<? super Object[], ? extends R> zipper) {
<ide> ObjectHelper.requireNonNull(zipper, "zipper is null");
<ide> ObjectHelper.requireNonNull(sources, "sources is null");
<ide> return RxJavaPlugins.onAssembly(new ObservableToList(sources, 16)
<ide> public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, R> Observable<R> zip(
<ide> * use {@code doOnUnsubscribed()} as well or use {@code using()} to do cleanup in case of completion
<ide> * or unsubscription.
<ide> * <p>
<add> * Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
<add> * implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
<add> * {@code Function<Integer[], R>} passed to the method would trigger a {@code ClassCastException}.
<add> *
<add> * <p>
<ide> * <img width="640" height="380" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/zip.png" alt="">
<ide> * <dl>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, R> Observable<R> zip(
<ide> * @see <a href="http://reactivex.io/documentation/operators/zip.html">ReactiveX operators documentation: Zip</a>
<ide> */
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<del> public static <T, R> Observable<R> zipArray(Function<? super T[], ? extends R> zipper,
<add> public static <T, R> Observable<R> zipArray(Function<? super Object[], ? extends R> zipper,
<ide> boolean delayError, int bufferSize, ObservableSource<? extends T>... sources) {
<ide> if (sources.length == 0) {
<ide> return empty();
<ide> public static <T, R> Observable<R> zipArray(Function<? super T[], ? extends R> z
<ide> * use {@code doOnUnsubscribed()} as well or use {@code using()} to do cleanup in case of completion
<ide> * or unsubscription.
<ide> * <p>
<add> * Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
<add> * implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
<add> * {@code Function<Integer[], R>} passed to the method would trigger a {@code ClassCastException}.
<add> *
<add> * <p>
<ide> * <img width="640" height="380" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/zip.png" alt="">
<ide> * <dl>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public static <T, R> Observable<R> zipArray(Function<? super T[], ? extends R> z
<ide> */
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> public static <T, R> Observable<R> zipIterable(Iterable<? extends ObservableSource<? extends T>> sources,
<del> Function<? super T[], ? extends R> zipper, boolean delayError,
<add> Function<? super Object[], ? extends R> zipper, boolean delayError,
<ide> int bufferSize) {
<ide> ObjectHelper.requireNonNull(zipper, "zipper is null");
<ide> ObjectHelper.requireNonNull(sources, "sources is null");
<ide><path>src/main/java/io/reactivex/Single.java
<ide> public static <T> Single<T> wrap(SingleSource<T> source) {
<ide> * value and calls a zipper function with an array of these values to return a result
<ide> * to be emitted to downstream.
<ide> * <p>
<add> * Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
<add> * implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
<add> * {@code Function<Integer[], R>} passed to the method would trigger a {@code ClassCastException}.
<add> *
<add> * <p>
<ide> * <img width="640" height="380" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/zip.png" alt="">
<ide> * <p>
<ide> * If any of the SingleSources signal an error, all other SingleSources get cancelled and the
<ide> public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, R> Single<R> zip(
<ide> * value and calls a zipper function with an array of these values to return a result
<ide> * to be emitted to downstream.
<ide> * <p>
<add> * Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
<add> * implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
<add> * {@code Function<Integer[], R>} passed to the method would trigger a {@code ClassCastException}.
<add> *
<add> * <p>
<ide> * <img width="640" height="380" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/zip.png" alt="">
<ide> * <p>
<ide> * If any of the SingleSources signal an error, all other SingleSources get cancelled and the
<ide><path>src/main/java/io/reactivex/internal/operators/flowable/FlowableCombineLatest.java
<ide>
<ide> final Iterable<? extends Publisher<? extends T>> iterable;
<ide>
<del> final Function<? super T[], ? extends R> combiner;
<add> final Function<? super Object[], ? extends R> combiner;
<ide>
<ide> final int bufferSize;
<ide>
<ide> final boolean delayErrors;
<ide>
<ide> public FlowableCombineLatest(Publisher<? extends T>[] array,
<del> Function<? super T[], ? extends R> combiner,
<add> Function<? super Object[], ? extends R> combiner,
<ide> int bufferSize, boolean delayErrors) {
<ide> if (bufferSize <= 0) {
<ide> throw new IllegalArgumentException("BUFFER_SIZE > 0 required but it was " + bufferSize);
<ide> public FlowableCombineLatest(Publisher<? extends T>[] array,
<ide> }
<ide>
<ide> public FlowableCombineLatest(Iterable<? extends Publisher<? extends T>> iterable,
<del> Function<? super T[], ? extends R> combiner,
<add> Function<? super Object[], ? extends R> combiner,
<ide> int bufferSize, boolean delayErrors) {
<ide> if (bufferSize <= 0) {
<ide> throw new IllegalArgumentException("BUFFER_SIZE > 0 required but it was " + bufferSize);
<ide> public R apply(T t) throws Exception {
<ide>
<ide> final Subscriber<? super R> actual;
<ide>
<del> final Function<? super T[], ? extends R> combiner;
<add> final Function<? super Object[], ? extends R> combiner;
<ide>
<ide> final CombineLatestInnerSubscriber<T>[] subscribers;
<ide>
<ide> public R apply(T t) throws Exception {
<ide> final AtomicReference<Throwable> error;
<ide>
<ide> public CombineLatestCoordinator(Subscriber<? super R> actual,
<del> Function<? super T[], ? extends R> combiner, int n,
<add> Function<? super Object[], ? extends R> combiner, int n,
<ide> int bufferSize, boolean delayErrors) {
<ide> this.actual = actual;
<ide> this.combiner = combiner;
<ide><path>src/main/java/io/reactivex/internal/operators/maybe/MaybeZipArray.java
<ide>
<ide> final MaybeSource<? extends T>[] sources;
<ide>
<del> final Function<? super T[], ? extends R> zipper;
<add> final Function<? super Object[], ? extends R> zipper;
<ide>
<del> public MaybeZipArray(MaybeSource<? extends T>[] sources, Function<? super T[], ? extends R> zipper) {
<add> public MaybeZipArray(MaybeSource<? extends T>[] sources, Function<? super Object[], ? extends R> zipper) {
<ide> this.sources = sources;
<ide> this.zipper = zipper;
<ide> }
<ide> public R apply(T t) throws Exception {
<ide>
<ide> final MaybeObserver<? super R> actual;
<ide>
<del> final Function<? super T[], ? extends R> zipper;
<add> final Function<? super Object[], ? extends R> zipper;
<ide>
<ide> final ZipMaybeObserver<T>[] observers;
<ide>
<ide> final Object[] values;
<ide>
<ide> @SuppressWarnings("unchecked")
<del> public ZipCoordinator(MaybeObserver<? super R> observer, int n, Function<? super T[], ? extends R> zipper) {
<add> public ZipCoordinator(MaybeObserver<? super R> observer, int n, Function<? super Object[], ? extends R> zipper) {
<ide> super(n);
<ide> this.actual = observer;
<ide> this.zipper = zipper;
<ide><path>src/main/java/io/reactivex/internal/operators/maybe/MaybeZipIterable.java
<ide>
<ide> final Iterable<? extends MaybeSource<? extends T>> sources;
<ide>
<del> final Function<? super T[], ? extends R> zipper;
<add> final Function<? super Object[], ? extends R> zipper;
<ide>
<del> public MaybeZipIterable(Iterable<? extends MaybeSource<? extends T>> sources, Function<? super T[], ? extends R> zipper) {
<add> public MaybeZipIterable(Iterable<? extends MaybeSource<? extends T>> sources, Function<? super Object[], ? extends R> zipper) {
<ide> this.sources = sources;
<ide> this.zipper = zipper;
<ide> }
<ide><path>src/main/java/io/reactivex/internal/operators/observable/ObservableCombineLatest.java
<ide> public final class ObservableCombineLatest<T, R> extends Observable<R> {
<ide> final ObservableSource<? extends T>[] sources;
<ide> final Iterable<? extends ObservableSource<? extends T>> sourcesIterable;
<del> final Function<? super T[], ? extends R> combiner;
<add> final Function<? super Object[], ? extends R> combiner;
<ide> final int bufferSize;
<ide> final boolean delayError;
<ide>
<ide> public ObservableCombineLatest(ObservableSource<? extends T>[] sources,
<ide> Iterable<? extends ObservableSource<? extends T>> sourcesIterable,
<del> Function<? super T[], ? extends R> combiner, int bufferSize,
<add> Function<? super Object[], ? extends R> combiner, int bufferSize,
<ide> boolean delayError) {
<ide> this.sources = sources;
<ide> this.sourcesIterable = sourcesIterable;
<ide> public void subscribeActual(Observer<? super R> s) {
<ide> /** */
<ide> private static final long serialVersionUID = 8567835998786448817L;
<ide> final Observer<? super R> actual;
<del> final Function<? super T[], ? extends R> combiner;
<add> final Function<? super Object[], ? extends R> combiner;
<ide> final int count;
<ide> final CombinerSubscriber<T, R>[] subscribers;
<ide> final int bufferSize;
<ide> public void subscribeActual(Observer<? super R> s) {
<ide>
<ide> @SuppressWarnings("unchecked")
<ide> public LatestCoordinator(Observer<? super R> actual,
<del> Function<? super T[], ? extends R> combiner,
<add> Function<? super Object[], ? extends R> combiner,
<ide> int count, int bufferSize, boolean delayError) {
<ide> this.actual = actual;
<ide> this.combiner = combiner;
<ide><path>src/main/java/io/reactivex/internal/operators/observable/ObservableInternalHelper.java
<ide> public static <T> Function<Observable<Notification<Object>>, ObservableSource<?>
<ide>
<ide> static final class ZipIterableFunction<T, R>
<ide> implements Function<List<ObservableSource<? extends T>>, ObservableSource<? extends R>> {
<del> private final Function<? super T[], ? extends R> zipper;
<add> private final Function<? super Object[], ? extends R> zipper;
<ide>
<del> ZipIterableFunction(Function<? super T[], ? extends R> zipper) {
<add> ZipIterableFunction(Function<? super Object[], ? extends R> zipper) {
<ide> this.zipper = zipper;
<ide> }
<ide>
<ide> public ObservableSource<? extends R> apply(List<ObservableSource<? extends T>> l
<ide> }
<ide> }
<ide>
<del> public static <T, R> Function<List<ObservableSource<? extends T>>, ObservableSource<? extends R>> zipIterable(final Function<? super T[], ? extends R> zipper) {
<add> public static <T, R> Function<List<ObservableSource<? extends T>>, ObservableSource<? extends R>> zipIterable(final Function<? super Object[], ? extends R> zipper) {
<ide> return new ZipIterableFunction<T, R>(zipper);
<ide> }
<ide>
<ide><path>src/main/java/io/reactivex/internal/operators/observable/ObservableZip.java
<ide>
<ide> final ObservableSource<? extends T>[] sources;
<ide> final Iterable<? extends ObservableSource<? extends T>> sourcesIterable;
<del> final Function<? super T[], ? extends R> zipper;
<add> final Function<? super Object[], ? extends R> zipper;
<ide> final int bufferSize;
<ide> final boolean delayError;
<ide>
<ide> public ObservableZip(ObservableSource<? extends T>[] sources,
<ide> Iterable<? extends ObservableSource<? extends T>> sourcesIterable,
<del> Function<? super T[], ? extends R> zipper,
<add> Function<? super Object[], ? extends R> zipper,
<ide> int bufferSize,
<ide> boolean delayError) {
<ide> this.sources = sources;
<ide> public void subscribeActual(Observer<? super R> s) {
<ide> /** */
<ide> private static final long serialVersionUID = 2983708048395377667L;
<ide> final Observer<? super R> actual;
<del> final Function<? super T[], ? extends R> zipper;
<add> final Function<? super Object[], ? extends R> zipper;
<ide> final ZipSubscriber<T, R>[] subscribers;
<ide> final T[] row;
<ide> final boolean delayError;
<ide> public void subscribeActual(Observer<? super R> s) {
<ide>
<ide> @SuppressWarnings("unchecked")
<ide> public ZipCoordinator(Observer<? super R> actual,
<del> Function<? super T[], ? extends R> zipper,
<add> Function<? super Object[], ? extends R> zipper,
<ide> int count, boolean delayError) {
<ide> this.actual = actual;
<ide> this.zipper = zipper;
<ide><path>src/test/java/io/reactivex/flowable/FlowableTests.java
<ide> public void toObservableRange() {
<ide> public void toObservableError() {
<ide> Flowable.error(new TestException()).toObservable().test().assertFailure(TestException.class);
<ide> }
<add>
<add> @Test
<add> public void zipIterableObject() {
<add> final List<Flowable<Integer>> flowables = Arrays.asList(Flowable.just(1, 2, 3), Flowable.just(1, 2, 3));
<add> Flowable.zip(flowables, new Function<Object[], Object>() {
<add> @Override
<add> public Object apply(Object[] o) throws Exception {
<add> int sum = 0;
<add> for (Object i : o) {
<add> sum += (Integer) i;
<add> }
<add> return sum;
<add> }
<add> }).test().assertResult(2, 4, 6);
<add> }
<add>
<add> @Test
<add> public void combineLatestObject() {
<add> final List<Flowable<Integer>> flowables = Arrays.asList(Flowable.just(1, 2, 3), Flowable.just(1, 2, 3));
<add> Flowable.combineLatest(flowables, new Function<Object[], Object>() {
<add> @Override
<add> public Object apply(final Object[] o) throws Exception {
<add> int sum = 1;
<add> for (Object i : o) {
<add> sum *= (Integer) i;
<add> }
<add> return sum;
<add> }
<add> }).test().assertResult(3, 6, 9);
<add> }
<ide> }
<ide><path>src/test/java/io/reactivex/maybe/MaybeTest.java
<ide> public void ambWith2SignalsSuccess() {
<ide> ts.assertResult(2);
<ide> }
<ide>
<add> @Test
<add> public void zipIterableObject() {
<add> final List<Maybe<Integer>> maybes = Arrays.asList(Maybe.just(1), Maybe.just(4));
<add> Maybe.zip(maybes, new Function<Object[], Object>() {
<add> @Override
<add> public Object apply(final Object[] o) throws Exception {
<add> int sum = 0;
<add> for (Object i : o) {
<add> sum += (Integer) i;
<add> }
<add> return sum;
<add> }
<add> }).test().assertResult(5);
<add> }
<ide> }
<ide><path>src/test/java/io/reactivex/observable/ObservableTest.java
<ide> public void singleDefault() {
<ide>
<ide> Observable.empty().toSingle(100).test().assertResult(100);
<ide> }
<add>
<add> @Test
<add> public void zipIterableObject() {
<add> final List<Observable<Integer>> observables = Arrays.asList(Observable.just(1, 2, 3), Observable.just(1, 2, 3));
<add> Observable.zip(observables, new Function<Object[], Object>() {
<add> @Override
<add> public Object apply(Object[] o) throws Exception {
<add> int sum = 0;
<add> for (Object i : o) {
<add> sum += (Integer) i;
<add> }
<add> return sum;
<add> }
<add> }).test().assertResult(2, 4, 6);
<add> }
<add>
<add> @Test
<add> public void combineLatestObject() {
<add> final List<Observable<Integer>> observables = Arrays.asList(Observable.just(1, 2, 3), Observable.just(1, 2, 3));
<add> Observable.combineLatest(observables, new Function<Object[], Object>() {
<add> @Override
<add> public Object apply(final Object[] o) throws Exception {
<add> int sum = 1;
<add> for (Object i : o) {
<add> sum *= (Integer) i;
<add> }
<add> return sum;
<add> }
<add> }).test().assertResult(3, 6, 9);
<add> }
<ide> }
<ide><path>src/test/java/io/reactivex/single/SingleTest.java
<ide> public void toFlowableIterableRemove() {
<ide> iterator.next();
<ide> iterator.remove();
<ide> }
<add>
<add> @Test
<add> public void zipIterableObject() {
<add> final List<Single<Integer>> singles = Arrays.asList(Single.just(1), Single.just(4));
<add> Single.zip(singles, new Function<Object[], Object>() {
<add> @Override
<add> public Object apply(final Object[] o) throws Exception {
<add> int sum = 0;
<add> for (Object i : o) {
<add> sum += (Integer) i;
<add> }
<add> return sum;
<add> }
<add> }).test().assertResult(5);
<add> }
<ide> }
<ide> | 14 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.