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 a note on concurrency and races | b1004a47334a0dd1929e6d50b8f7ff6badc959f4 | <ide><path>docs/api-guide/throttling.md
<ide> If you need to use a cache other than `'default'`, you can do so by creating a c
<ide>
<ide> You'll need to remember to also set your custom throttle class in the `'DEFAULT_THROTTLE_CLASSES'` settings key, or using the `throttle_classes` view attribute.
<ide>
<add>## A note on concurrency
<add>
<add>The built-in throttle implementations are open to [race conditions][race], so under high concurrency they may allow a few extra requests through.
<add>
<add>If your project relies on guaranteeing the number of requests during concurrent requests, you will need to implement your own throttle class. See [issue #5181][gh5181] for more details.
<add>
<ide> ---
<ide>
<ide> # API Reference
<ide> The following is an example of a rate throttle, that will randomly throttle 1 in
<ide> [identifying-clients]: http://oxpedia.org/wiki/index.php?title=AppSuite:Grizzly#Multiple_Proxies_in_front_of_the_cluster
<ide> [cache-setting]: https://docs.djangoproject.com/en/stable/ref/settings/#caches
<ide> [cache-docs]: https://docs.djangoproject.com/en/stable/topics/cache/#setting-up-the-cache
<add>[gh5181]: https://github.com/encode/django-rest-framework/issues/5181
<add>[race]: https://en.wikipedia.org/wiki/Race_condition#Data_race | 1 |
Javascript | Javascript | add author attribution to csm | 8604213c9dd95ed42931b755bffce838f917ccb0 | <ide><path>examples/jsm/csm/CSM.js
<add>/**
<add> * @author vHawk / https://github.com/vHawk/
<add> */
<add>
<ide> import {
<ide> Vector2,
<ide> Vector3,
<ide><path>examples/jsm/csm/Frustum.js
<add>/**
<add> * @author vHawk / https://github.com/vHawk/
<add> */
<add>
<ide> import { MathUtils, Vector3 } from '../../../build/three.module.js';
<ide> import FrustumVertex from './FrustumVertex.js';
<ide>
<ide><path>examples/jsm/csm/FrustumBoundingBox.js
<add>/**
<add> * @author vHawk / https://github.com/vHawk/
<add> */
<add>
<ide> export default class FrustumBoundingBox {
<ide>
<ide> constructor() {
<ide><path>examples/jsm/csm/FrustumVertex.js
<add>/**
<add> * @author vHawk / https://github.com/vHawk/
<add> */
<add>
<ide> export default class FrustumVertex {
<ide>
<ide> constructor( x, y, z ) {
<ide><path>examples/jsm/csm/Shader.js
<add>/**
<add> * @author vHawk / https://github.com/vHawk/
<add> */
<add>
<ide> import { ShaderChunk } from '../../../build/three.module.js';
<ide>
<ide> export default { | 5 |
Python | Python | add serializer handlers for root and parent | 885eca59952365f24698b28d9969defc20cc170b | <ide><path>celery/events/state.py
<ide> def __init__(self, uuid=None, cluster_state=None, children=None, **kwargs):
<ide> )
<ide> self._serializer_handlers = {
<ide> 'children': self._serializable_children,
<add> 'root': self._serializable_root,
<add> 'parent': self._serializable_parent,
<ide> }
<ide> if kwargs:
<ide> self.__dict__.update(kwargs)
<ide> def as_dict(self):
<ide> def _serializable_children(self, value):
<ide> return [task.id for task in self.children]
<ide>
<add> def _serializable_root(self, value):
<add> return self.root_id
<add>
<add> def _serializable_parent(self, value):
<add> return self.parent_id
<add>
<ide> def __reduce__(self):
<ide> return _depickle_task, (self.__class__, self.as_dict())
<ide> | 1 |
Text | Text | fix version history for `"exports"` patterns | dfc00ea0383fe6e0efeaf26c9002217f6a71b661 | <ide><path>doc/api/packages.md
<ide> analogous to the exports field.
<ide> <!-- YAML
<ide> added:
<ide> - v14.13.0
<del> - v12.19.0
<add> - v12.20.0
<ide> -->
<ide>
<ide> For packages with a small number of exports or imports, we recommend
<ide> added: v12.7.0
<ide> changes:
<ide> - version:
<ide> - v14.13.0
<add> - v12.20.0
<ide> pr-url: https://github.com/nodejs/node/pull/34718
<ide> description: Add support for `"exports"` patterns.
<ide> - version: | 1 |
PHP | PHP | upgrade shell - refactoring | d41475503619936abf93bcae210765c60aac0028 | <ide><path>cake/console/shells/upgrade.php
<ide> class UpgradeShell extends Shell {
<ide> * @return void
<ide> */
<ide> function helpers() {
<del> if (!empty($this->params['plugin'])) {
<del> $this->_paths = array(App::pluginPath($this->params['plugin']));
<del> } else {
<del> $this->_paths = array(
<del> VIEWS
<del> );
<del> }
<add> $this->_paths = array(
<add> VIEWS
<add> );
<ide>
<ide> $patterns = array();
<ide> foreach(App::objects('helper') as $helper) {
<ide> function helpers() {
<ide> );
<ide> }
<ide>
<del> $this->_findFiles();
<del> foreach ($this->_files as $file) {
<del> $this->out('Updating ' . $file . '...', 1, Shell::VERBOSE);
<del> $this->_updateFile($file, $patterns);
<del> }
<add> $this->_filesRegexpUpdate($patterns);
<ide> }
<ide>
<ide> /**
<ide> function helpers() {
<ide> * @return void
<ide> */
<ide> function i18n() {
<del> if (!empty($this->params['plugin'])) {
<del> $this->_paths = array(App::pluginPath($this->params['plugin']));
<del> } else {
<del> $this->_paths = array(
<del> CONTROLLERS,
<del> MODELS,
<del> VIEWS
<del> );
<del> }
<add> $this->_paths = array(
<add> CONTROLLERS,
<add> MODELS,
<add> VIEWS
<add> );
<ide>
<ide> $patterns = array(
<ide> array(
<ide> function i18n() {
<ide> array('__*(*, true) to __*(*)', '/(__[a-z]*\(.*?)(,\s*true)(\))/', '\1\3')
<ide> );
<ide>
<add> $this->_filesRegexpUpdate($patterns);
<add> }
<add>
<add> protected function _filesRegexpUpdate($patterns) {
<add> if (!empty($this->params['plugin'])) {
<add> $this->_paths = array(App::pluginPath($this->params['plugin']));
<add> }
<add>
<ide> $this->_findFiles();
<ide> foreach ($this->_files as $file) {
<ide> $this->out('Updating ' . $file . '...', 1, Shell::VERBOSE); | 1 |
Ruby | Ruby | preheat the table cache in arel | 1e9685f15921d1acec65d07a27640aa1c674a29b | <ide><path>activerecord/test/cases/batches_test.rb
<ide> class EachTest < ActiveRecord::TestCase
<ide> def setup
<ide> @posts = Post.order("id asc")
<ide> @total = Post.count
<add> Post.count('id') # preheat arel's table cache
<ide> end
<ide>
<ide> def test_each_should_excecute_one_query_per_batch | 1 |
Mixed | Ruby | handle client disconnect during live streaming | 6a89850dfe1e8c8331fd8482525aa4b9b2530cad | <ide><path>actionpack/CHANGELOG.md
<add>* Ensure the controller is always notified as soon as the client disconnects
<add> during live streaming, even when the controller is blocked on a write.
<add>
<add> *Nicholas Jakobsen*, *Matthew Draper*
<add>
<ide> * Routes specifying 'to:' must be a string that contains a "#" or a rack
<ide> application. Use of a symbol should be replaced with `action: symbol`.
<ide> Use of a string without a "#" should be replaced with `controller: string`.
<ide><path>actionpack/lib/action_controller/metal/live.rb
<ide> def perform_write(json, options)
<ide> end
<ide> end
<ide>
<add> class ClientDisconnected < RuntimeError
<add> end
<add>
<ide> class Buffer < ActionDispatch::Response::Buffer #:nodoc:
<ide> include MonitorMixin
<ide>
<add> # Ignore that the client has disconnected.
<add> #
<add> # If this value is `true`, calling `write` after the client
<add> # disconnects will result in the written content being silently
<add> # discarded. If this value is `false` (the default), a
<add> # ClientDisconnected exception will be raised.
<add> attr_accessor :ignore_disconnect
<add>
<ide> def initialize(response)
<ide> @error_callback = lambda { true }
<ide> @cv = new_cond
<add> @aborted = false
<add> @ignore_disconnect = false
<ide> super(response, SizedQueue.new(10))
<ide> end
<ide>
<ide> def write(string)
<ide> end
<ide>
<ide> super
<add>
<add> unless connected?
<add> @buf.clear
<add>
<add> unless @ignore_disconnect
<add> # Raise ClientDisconnected, which is a RuntimeError (not an
<add> # IOError), because that's more appropriate for something beyond
<add> # the developer's control.
<add> raise ClientDisconnected, "client disconnected"
<add> end
<add> end
<ide> end
<ide>
<ide> def each
<ide> def each
<ide> @response.sent!
<ide> end
<ide>
<add> # Write a 'close' event to the buffer; the producer/writing thread
<add> # uses this to notify us that it's finished supplying content.
<add> #
<add> # See also #abort.
<ide> def close
<ide> synchronize do
<ide> super
<ide> def close
<ide> end
<ide> end
<ide>
<add> # Inform the producer/writing thread that the client has
<add> # disconnected; the reading thread is no longer interested in
<add> # anything that's being written.
<add> #
<add> # See also #close.
<add> def abort
<add> synchronize do
<add> @aborted = true
<add> @buf.clear
<add> end
<add> end
<add>
<add> # Is the client still connected and waiting for content?
<add> #
<add> # The result of calling `write` when this is `false` is determined
<add> # by `ignore_disconnect`.
<add> def connected?
<add> !@aborted
<add> end
<add>
<ide> def await_close
<ide> synchronize do
<ide> @cv.wait_until { @closed }
<ide><path>actionpack/lib/action_dispatch/http/response.rb
<ide> def each(&block)
<ide> x
<ide> end
<ide>
<add> def abort
<add> end
<add>
<ide> def close
<ide> @response.commit!
<ide> @closed = true
<ide> def message
<ide> end
<ide> alias_method :status_message, :message
<ide>
<del> def respond_to?(method, include_private = false)
<del> if method.to_s == 'to_path'
<del> stream.respond_to?(method)
<del> else
<del> super
<del> end
<del> end
<del>
<del> def to_path
<del> stream.to_path
<del> end
<del>
<ide> # Returns the content of the response as a string. This contains the contents
<ide> # of any calls to <tt>render</tt>.
<ide> def body
<ide> def close
<ide> stream.close if stream.respond_to?(:close)
<ide> end
<ide>
<add> def abort
<add> if stream.respond_to?(:abort)
<add> stream.abort
<add> elsif stream.respond_to?(:close)
<add> # `stream.close` should really be reserved for a close from the
<add> # other direction, but we must fall back to it for
<add> # compatibility.
<add> stream.close
<add> end
<add> end
<add>
<ide> # Turns the Response into a Rack-compatible array of the status, headers,
<ide> # and body.
<ide> def to_a
<ide> def append_charset?
<ide> !@sending_file && @charset != false
<ide> end
<ide>
<add> class RackBody
<add> def initialize(response)
<add> @response = response
<add> end
<add>
<add> def each(*args, &block)
<add> @response.each(*args, &block)
<add> end
<add>
<add> def close
<add> # Rack "close" maps to Response#abort, and *not* Response#close
<add> # (which is used when the controller's finished writing)
<add> @response.abort
<add> end
<add>
<add> def body
<add> @response.body
<add> end
<add>
<add> def respond_to?(method, include_private = false)
<add> if method.to_s == 'to_path'
<add> @response.stream.respond_to?(method)
<add> else
<add> super
<add> end
<add> end
<add>
<add> def to_path
<add> @response.stream.to_path
<add> end
<add> end
<add>
<ide> def rack_response(status, header)
<ide> assign_default_content_type_and_charset!(header)
<ide> handle_conditional_get!
<ide> def rack_response(status, header)
<ide> header.delete CONTENT_TYPE
<ide> [status, header, []]
<ide> else
<del> [status, header, Rack::BodyProxy.new(self){}]
<add> [status, header, RackBody.new(self)]
<ide> end
<ide> end
<ide> end
<ide><path>actionpack/test/controller/live_stream_test.rb
<ide> def exception_in_exception_callback
<ide> response.stream.write ''
<ide> response.stream.write params[:widget][:didnt_check_for_nil]
<ide> end
<add>
<add> def overfill_buffer_and_die
<add> # Write until the buffer is full. It doesn't expose that
<add> # information directly, so we must hard-code its size:
<add> 10.times do
<add> response.stream.write '.'
<add> end
<add> # .. plus one more, because the #each frees up a slot:
<add> response.stream.write '.'
<add>
<add> latch.release
<add>
<add> # This write will block, and eventually raise
<add> response.stream.write 'x'
<add>
<add> 20.times do
<add> response.stream.write '.'
<add> end
<add> end
<add>
<add> def ignore_client_disconnect
<add> response.stream.ignore_disconnect = true
<add>
<add> response.stream.write '' # commit
<add>
<add> # These writes will be ignored
<add> 15.times do
<add> response.stream.write 'x'
<add> end
<add>
<add> logger.info 'Work complete'
<add> latch.release
<add> end
<ide> end
<ide>
<ide> tests TestController
<ide> def test_async_stream
<ide> assert t.join(3), 'timeout expired before the thread terminated'
<ide> end
<ide>
<add> def test_abort_with_full_buffer
<add> @controller.latch = ActiveSupport::Concurrency::Latch.new
<add>
<add> @request.parameters[:format] = 'plain'
<add> @controller.request = @request
<add> @controller.response = @response
<add>
<add> got_error = ActiveSupport::Concurrency::Latch.new
<add> @response.stream.on_error do
<add> ActionController::Base.logger.warn 'Error while streaming'
<add> got_error.release
<add> end
<add>
<add> t = Thread.new(@response) { |resp|
<add> resp.await_commit
<add> _, _, body = resp.to_a
<add> body.each do |part|
<add> @controller.latch.await
<add> body.close
<add> break
<add> end
<add> }
<add>
<add> capture_log_output do |output|
<add> @controller.process :overfill_buffer_and_die
<add> t.join
<add> got_error.await
<add> assert_match 'Error while streaming', output.rewind && output.read
<add> end
<add> end
<add>
<add> def test_ignore_client_disconnect
<add> @controller.latch = ActiveSupport::Concurrency::Latch.new
<add>
<add> @controller.request = @request
<add> @controller.response = @response
<add>
<add> t = Thread.new(@response) { |resp|
<add> resp.await_commit
<add> _, _, body = resp.to_a
<add> body.each do |part|
<add> body.close
<add> break
<add> end
<add> }
<add>
<add> capture_log_output do |output|
<add> @controller.process :ignore_client_disconnect
<add> t.join
<add> Timeout.timeout(3) do
<add> @controller.latch.await
<add> end
<add> assert_match 'Work complete', output.rewind && output.read
<add> end
<add> end
<add>
<ide> def test_thread_locals_get_copied
<ide> @controller.tc = self
<ide> Thread.current[:originating_thread] = Thread.current.object_id | 4 |
PHP | PHP | change variable name to be descriptive | 987c01856afa4a5ad9cfd29fddf6623eff293cdc | <ide><path>lib/Cake/Network/Email/CakeEmail.php
<ide> protected function _attachFiles($boundary = null) {
<ide> /**
<ide> * Read the file contents and return a base64 version of the file contents.
<ide> *
<del> * @param string $file The file to read.
<add> * @param string $path The absolute path to the file to read.
<ide> * @return string File contents in base64 encoding
<ide> */
<del> protected function _readFile($file) {
<del> $f = new File($file);
<del> return $f->readBase64();
<add> protected function _readFile($path) {
<add> $File = new File($path);
<add> return $File->readBase64();
<ide> }
<ide>
<ide> /** | 1 |
Text | Text | avoid tautology in readme | 53b8133656132b1f899fbf3b8ae6c0c82ae5296b | <ide><path>README.md
<ide> contains the latest Carbon (Node.js 8) release.
<ide> #### Nightly Releases
<ide> <https://nodejs.org/download/nightly/>
<ide>
<del>Each directory name and filename contains a date (in UTC time) and the commit
<add>Each directory name and filename contains a date (in UTC) and the commit
<ide> SHA at the HEAD of the release.
<ide>
<ide> #### API Documentation | 1 |
Text | Text | use external url for mlengine link | a5e9d4e55b3796ec0d7d6f3ffebb15a9a8b49c1d | <ide><path>object_detection/g3doc/running_on_cloud.md
<ide> training checkpoints and events will be written to and
<ide> Google Cloud Storage.
<ide>
<ide> Users can monitor the progress of their training job on the [ML Engine
<del>Dashboard](https://pantheon.corp.google.com/mlengine/jobs).
<add>Dashboard](https://console.cloud.google.com/mlengine/jobs).
<ide>
<ide> ## Running an Evaluation Job on Cloud
<ide> | 1 |
Go | Go | fix race in statistics | 0eb01bbbee8a2dc22493628da67b80c78ab29a07 | <ide><path>libnetwork/sandbox.go
<ide> func (sb *sandbox) Labels() map[string]interface{} {
<ide> func (sb *sandbox) Statistics() (map[string]*types.InterfaceStatistics, error) {
<ide> m := make(map[string]*types.InterfaceStatistics)
<ide>
<del> if sb.osSbox == nil {
<add> sb.Lock()
<add> osb := sb.osSbox
<add> sb.Unlock()
<add> if osb == nil {
<ide> return m, nil
<ide> }
<ide>
<ide> var err error
<del> for _, i := range sb.osSbox.Info().Interfaces() {
<add> for _, i := range osb.Info().Interfaces() {
<ide> if m[i.DstName()], err = i.Statistics(); err != nil {
<ide> return m, err
<ide> } | 1 |
Java | Java | use collection.removeif() where possible | d3a0a8e0078df5f152d9e5f802683614a0018182 | <ide><path>spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/target/AbstractBeanFactoryBasedTargetSourceCreator.java
<ide> /*
<del> * Copyright 2002-2016 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> package org.springframework.aop.framework.autoproxy.target;
<ide>
<ide> import java.util.HashMap;
<del>import java.util.Iterator;
<ide> import java.util.Map;
<ide>
<ide> import org.apache.commons.logging.Log;
<ide> import org.springframework.beans.factory.BeanFactoryAware;
<ide> import org.springframework.beans.factory.DisposableBean;
<ide> import org.springframework.beans.factory.config.BeanDefinition;
<del>import org.springframework.beans.factory.config.BeanPostProcessor;
<ide> import org.springframework.beans.factory.config.ConfigurableBeanFactory;
<ide> import org.springframework.beans.factory.support.DefaultListableBeanFactory;
<ide> import org.springframework.beans.factory.support.GenericBeanDefinition;
<ide> protected DefaultListableBeanFactory buildInternalBeanFactory(ConfigurableBeanFa
<ide>
<ide> // Filter out BeanPostProcessors that are part of the AOP infrastructure,
<ide> // since those are only meant to apply to beans defined in the original factory.
<del> for (Iterator<BeanPostProcessor> it = internalBeanFactory.getBeanPostProcessors().iterator(); it.hasNext();) {
<del> if (it.next() instanceof AopInfrastructureBean) {
<del> it.remove();
<del> }
<del> }
<add> internalBeanFactory.getBeanPostProcessors().removeIf(beanPostProcessor ->
<add> beanPostProcessor instanceof AopInfrastructureBean);
<ide>
<ide> return internalBeanFactory;
<ide> }
<ide><path>spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java
<ide> import java.beans.Introspector;
<ide> import java.beans.PropertyDescriptor;
<ide> import java.util.Collections;
<del>import java.util.Iterator;
<ide> import java.util.LinkedHashMap;
<ide> import java.util.List;
<ide> import java.util.Map;
<ide> public static void acceptClassLoader(@Nullable ClassLoader classLoader) {
<ide> * @param classLoader the ClassLoader to clear the cache for
<ide> */
<ide> public static void clearClassLoader(@Nullable ClassLoader classLoader) {
<del> for (Iterator<ClassLoader> it = acceptedClassLoaders.iterator(); it.hasNext();) {
<del> ClassLoader registeredLoader = it.next();
<del> if (isUnderneathClassLoader(registeredLoader, classLoader)) {
<del> it.remove();
<del> }
<del> }
<del> for (Iterator<Class<?>> it = strongClassCache.keySet().iterator(); it.hasNext();) {
<del> Class<?> beanClass = it.next();
<del> if (isUnderneathClassLoader(beanClass.getClassLoader(), classLoader)) {
<del> it.remove();
<del> }
<del> }
<del> for (Iterator<Class<?>> it = softClassCache.keySet().iterator(); it.hasNext();) {
<del> Class<?> beanClass = it.next();
<del> if (isUnderneathClassLoader(beanClass.getClassLoader(), classLoader)) {
<del> it.remove();
<del> }
<del> }
<add> acceptedClassLoaders.removeIf(registeredLoader ->
<add> isUnderneathClassLoader(registeredLoader, classLoader));
<add> strongClassCache.keySet().removeIf(beanClass ->
<add> isUnderneathClassLoader(beanClass.getClassLoader(), classLoader));
<add> softClassCache.keySet().removeIf(beanClass ->
<add> isUnderneathClassLoader(beanClass.getClassLoader(), classLoader));
<ide> }
<ide>
<ide> /**
<ide><path>spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java
<ide> import java.util.Collections;
<ide> import java.util.HashMap;
<ide> import java.util.HashSet;
<del>import java.util.Iterator;
<ide> import java.util.LinkedHashMap;
<ide> import java.util.LinkedHashSet;
<ide> import java.util.LinkedList;
<ide> protected void clearMergedBeanDefinition(String beanName) {
<ide> * @since 4.2
<ide> */
<ide> public void clearMetadataCache() {
<del> Iterator<String> mergedBeans = this.mergedBeanDefinitions.keySet().iterator();
<del> while (mergedBeans.hasNext()) {
<del> if (!isBeanEligibleForMetadataCaching(mergedBeans.next())) {
<del> mergedBeans.remove();
<del> }
<del> }
<add> this.mergedBeanDefinitions.keySet().removeIf(bean -> !isBeanEligibleForMetadataCaching(bean));
<ide> }
<ide>
<ide> /**
<ide><path>spring-context/src/main/java/org/springframework/scripting/support/ScriptFactoryPostProcessor.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> package org.springframework.scripting.support;
<ide>
<ide> import java.util.HashMap;
<del>import java.util.Iterator;
<ide> import java.util.Map;
<ide>
<ide> import org.apache.commons.logging.Log;
<ide> import org.springframework.beans.factory.DisposableBean;
<ide> import org.springframework.beans.factory.FactoryBean;
<ide> import org.springframework.beans.factory.config.BeanDefinition;
<del>import org.springframework.beans.factory.config.BeanPostProcessor;
<ide> import org.springframework.beans.factory.config.ConfigurableBeanFactory;
<ide> import org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessorAdapter;
<ide> import org.springframework.beans.factory.support.AbstractBeanDefinition;
<ide> public void setBeanFactory(BeanFactory beanFactory) {
<ide>
<ide> // Filter out BeanPostProcessors that are part of the AOP infrastructure,
<ide> // since those are only meant to apply to beans defined in the original factory.
<del> for (Iterator<BeanPostProcessor> it = this.scriptBeanFactory.getBeanPostProcessors().iterator(); it.hasNext();) {
<del> if (it.next() instanceof AopInfrastructureBean) {
<del> it.remove();
<del> }
<del> }
<add> this.scriptBeanFactory.getBeanPostProcessors().removeIf(beanPostProcessor ->
<add> beanPostProcessor instanceof AopInfrastructureBean);
<ide> }
<ide>
<ide> @Override
<ide><path>spring-messaging/src/main/java/org/springframework/messaging/simp/user/MultiServerUserRegistry.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> import java.util.Collections;
<ide> import java.util.HashMap;
<ide> import java.util.HashSet;
<del>import java.util.Iterator;
<ide> import java.util.Map;
<ide> import java.util.Set;
<ide> import java.util.UUID;
<ide> void addRemoteRegistryDto(Message<?> message, MessageConverter converter, long e
<ide>
<ide> void purgeExpiredRegistries() {
<ide> long now = System.currentTimeMillis();
<del> Iterator<Map.Entry<String, UserRegistrySnapshot>> iterator = this.remoteRegistries.entrySet().iterator();
<del> while (iterator.hasNext()) {
<del> Map.Entry<String, UserRegistrySnapshot> entry = iterator.next();
<del> if (entry.getValue().isExpired(now)) {
<del> iterator.remove();
<del> }
<del> }
<add> this.remoteRegistries.entrySet().removeIf(entry -> entry.getValue().isExpired(now));
<ide> }
<ide>
<ide>
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/ConsumesRequestCondition.java
<ide> /*
<del> * Copyright 2002-2016 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> import java.util.ArrayList;
<ide> import java.util.Collection;
<ide> import java.util.Collections;
<del>import java.util.Iterator;
<ide> import java.util.LinkedHashSet;
<ide> import java.util.List;
<ide> import java.util.Set;
<ide> public ConsumesRequestCondition getMatchingCondition(ServerWebExchange exchange)
<ide> return this;
<ide> }
<ide> Set<ConsumeMediaTypeExpression> result = new LinkedHashSet<>(expressions);
<del> for (Iterator<ConsumeMediaTypeExpression> iterator = result.iterator(); iterator.hasNext();) {
<del> ConsumeMediaTypeExpression expression = iterator.next();
<del> if (!expression.match(exchange)) {
<del> iterator.remove();
<del> }
<del> }
<add> result.removeIf(expression -> !expression.match(exchange));
<ide> return (result.isEmpty()) ? null : new ConsumesRequestCondition(result);
<ide> }
<ide>
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/ProducesRequestCondition.java
<ide> /*
<del> * Copyright 2002-2016 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> import java.util.ArrayList;
<ide> import java.util.Collection;
<ide> import java.util.Collections;
<del>import java.util.Iterator;
<ide> import java.util.LinkedHashSet;
<ide> import java.util.List;
<ide> import java.util.Set;
<ide> public ProducesRequestCondition getMatchingCondition(ServerWebExchange exchange)
<ide> return this;
<ide> }
<ide> Set<ProduceMediaTypeExpression> result = new LinkedHashSet<>(expressions);
<del> for (Iterator<ProduceMediaTypeExpression> iterator = result.iterator(); iterator.hasNext();) {
<del> ProduceMediaTypeExpression expression = iterator.next();
<del> if (!expression.match(exchange)) {
<del> iterator.remove();
<del> }
<del> }
<add> result.removeIf(expression -> !expression.match(exchange));
<ide> return (result.isEmpty()) ? null : new ProducesRequestCondition(result, this.contentTypeResolver);
<ide> }
<ide> | 7 |
Text | Text | fix typo ಠ_ಠ | 919cef41ebcc09fbbbd4376fb0df9eddf01037a9 | <ide><path>README.md
<ide>
<ide> ## Be forwarned: Atom is pre-alpha software!
<ide>
<del>## Instalation
<add>## Installation
<ide>
<ide> 1. Get [xcode 4.2](http://itunes.apple.com/us/app/xcode/id448457090?mt=12).
<ide> | 1 |
Text | Text | mention fixed freeze | b56f4a129fb3828cde90f6a38ab7b14ac1aaef24 | <ide><path>CHANGELOG.md
<add>* Fixed: Freeze when editing a RoR class
<ide> * Added: meta-N to open a new untitled editor in the current window
<ide>
<ide> * Fixed: Styling in command logger | 1 |
Text | Text | fix typo in changelog.md | 3168d401a765c93f54a09c4708e2e9dfc43916bc | <ide><path>railties/CHANGELOG.md
<ide> Example:
<ide>
<ide> ```
<del> > bin/rails rails --unused
<add> > bin/rails routes --unused
<ide>
<ide> Found 2 unused routes:
<ide> | 1 |
Python | Python | set version to v3.1.0.dev0 | 6b69b8934b483862a3e7d57ace26ae05ce16d053 | <ide><path>spacy/about.py
<ide> # fmt: off
<ide> __title__ = "spacy"
<del>__version__ = "3.0.6"
<add>__version__ = "3.1.0.dev0"
<ide> __download_url__ = "https://github.com/explosion/spacy-models/releases/download"
<ide> __compatibility__ = "https://raw.githubusercontent.com/explosion/spacy-models/master/compatibility.json"
<ide> __projects__ = "https://github.com/explosion/projects" | 1 |
Java | Java | fix websocket compatibility with tyrus 1.9 - 1.12 | b7e75c5db472d22a619739a55331f5423a510ee7 | <ide><path>spring-websocket/src/main/java/org/springframework/web/socket/server/standard/AbstractTyrusRequestUpgradeStrategy.java
<ide> public Object createdEndpoint(ServerEndpointRegistration registration, Component
<ide> Object sessionListener = accessor.getPropertyValue("sessionListener");
<ide> Object clusterContext = accessor.getPropertyValue("clusterContext");
<ide> try {
<del> return constructor.newInstance(registration.getEndpoint(), registration, provider, container,
<del> "/", registration.getConfigurator(), sessionListener, clusterContext, null);
<add> if (constructor.getParameterCount() == 9) {
<add> return constructor.newInstance(registration.getEndpoint(), registration, provider, container,
<add> "/", registration.getConfigurator(), sessionListener, clusterContext, null);
<add> }
<add> else {
<add> return constructor.newInstance(registration.getEndpoint(), registration, provider, container,
<add> "/", registration.getConfigurator(), sessionListener, clusterContext, null, Boolean.TRUE);
<add> }
<ide> }
<ide> catch (Exception ex) {
<ide> throw new HandshakeFailureException("Failed to register " + registration, ex); | 1 |
Ruby | Ruby | remove dead code | cb32f76f271f20a14685580a7be0cb0c72c0aec6 | <ide><path>Library/Homebrew/software_spec.rb
<ide> def requirements
<ide> class HeadSoftwareSpec < SoftwareSpec
<ide> def initialize
<ide> super
<del> @resource.url = url
<ide> @resource.version = Version.new('HEAD')
<ide> end
<ide> | 1 |
PHP | PHP | fix most of the coding standards issues in i18n/ | c5be343b72b88d11824cdd85854c08901e4b2cc4 | <ide><path>lib/Cake/I18n/I18n.php
<ide> class I18n {
<ide> 'LC_ALL', 'LC_COLLATE', 'LC_CTYPE', 'LC_MONETARY', 'LC_NUMERIC', 'LC_TIME', 'LC_MESSAGES'
<ide> );
<ide>
<add> protected $_escape = null;
<add>
<ide> /**
<ide> * Constructor, use I18n::getInstance() to get the i18n translation object.
<ide> *
<ide> public static function loadLocaleDefinition($filename) {
<ide> $replacements = array_map('crc32', $mustEscape);
<ide> $value = str_replace($mustEscape, $replacements, $value);
<ide> $value = explode(';', $value);
<del> $_this->__escape = $escape;
<add> $_this->_escape = $escape;
<ide> foreach ($value as $i => $val) {
<ide> $val = trim($val, '"');
<ide> $val = preg_replace_callback('/(?:<)?(.[^>]*)(?:>)?/', array(&$_this, '_parseLiteralValue'), $val);
<ide> public static function loadLocaleDefinition($filename) {
<ide> */
<ide> protected function _parseLiteralValue($string) {
<ide> $string = $string[1];
<del> if (substr($string, 0, 2) === $this->__escape . 'x') {
<del> $delimiter = $this->__escape . 'x';
<add> if (substr($string, 0, 2) === $this->_escape . 'x') {
<add> $delimiter = $this->_escape . 'x';
<ide> return join('', array_map('chr', array_map('hexdec',array_filter(explode($delimiter, $string)))));
<ide> }
<del> if (substr($string, 0, 2) === $this->__escape . 'd') {
<del> $delimiter = $this->__escape . 'd';
<add> if (substr($string, 0, 2) === $this->_escape . 'd') {
<add> $delimiter = $this->_escape . 'd';
<ide> return join('', array_map('chr', array_filter(explode($delimiter, $string))));
<ide> }
<del> if ($string[0] === $this->__escape && isset($string[1]) && is_numeric($string[1])) {
<del> $delimiter = $this->__escape;
<add> if ($string[0] === $this->_escape && isset($string[1]) && is_numeric($string[1])) {
<add> $delimiter = $this->_escape;
<ide> return join('', array_map('chr', array_filter(explode($delimiter, $string))));
<ide> }
<ide> if (substr($string, 0, 3) === 'U00') {
<ide> protected function _translateTime($format, $domain) {
<ide> }
<ide> return $format;
<ide> }
<add>
<ide> }
<ide><path>lib/Cake/I18n/L10n.php
<ide> public function catalog($language = null) {
<ide> }
<ide> return $this->_l10nCatalog;
<ide> }
<add>
<ide> }
<ide><path>lib/Cake/I18n/Multibyte.php
<ide> function mb_substr($string, $start, $length = null, $encoding = null) {
<ide> * @return string A converted version of the string represented in ASCII.
<ide> */
<ide> if (!function_exists('mb_encode_mimeheader')) {
<del> function mb_encode_mimeheader($str, $charset = 'UTF-8', $transfer_encoding = 'B', $linefeed = "\r\n", $indent = 1) {
<add> function mb_encode_mimeheader($str, $charset = 'UTF-8', $transferEncoding = 'B', $linefeed = "\r\n", $indent = 1) {
<ide> return Multibyte::mimeEncode($str, $charset, $linefeed);
<ide> }
<ide> }
<ide> public static function strrchr($haystack, $needle, $part = false) {
<ide> if (isset($needle[0]) && $needle[0] === $check[$position]) {
<ide> for ($i = 1; $i < $needleCount; $i++) {
<ide> if ($needle[$i] !== $check[$position + $i]) {
<del> if ($needle[$i] === $check[($position + $i) -1]) {
<add> if ($needle[$i] === $check[($position + $i) - 1]) {
<ide> $found = true;
<ide> }
<ide> unset($parts[$position - 1]);
<ide> public static function strrichr($haystack, $needle, $part = false) {
<ide> if (isset($needle[0]) && $needle[0] === $check[$position]) {
<ide> for ($i = 1; $i < $needleCount; $i++) {
<ide> if ($needle[$i] !== $check[$position + $i]) {
<del> if ($needle[$i] === $check[($position + $i) -1]) {
<add> if ($needle[$i] === $check[($position + $i) - 1]) {
<ide> $found = true;
<ide> }
<ide> unset($parts[$position - 1]);
<ide> public static function strripos($haystack, $needle, $offset = 0) {
<ide> if (isset($needle[0]) && $needle[0] === $haystack[$position]) {
<ide> for ($i = 1; $i < $needleCount; $i++) {
<ide> if ($needle[$i] !== $haystack[$position + $i]) {
<del> if ($needle[$i] === $haystack[($position + $i) -1]) {
<add> if ($needle[$i] === $haystack[($position + $i) - 1]) {
<ide> $position--;
<ide> $found = true;
<ide> continue;
<ide> public static function strrpos($haystack, $needle, $offset = 0) {
<ide> if (isset($needle[0]) && $needle[0] === $haystack[$position]) {
<ide> for ($i = 1; $i < $needleCount; $i++) {
<ide> if ($needle[$i] !== $haystack[$position + $i]) {
<del> if ($needle[$i] === $haystack[($position + $i) -1]) {
<add> if ($needle[$i] === $haystack[($position + $i) - 1]) {
<ide> $position--;
<ide> $found = true;
<ide> continue;
<ide> public static function strtolower($string) {
<ide> $length = count($utf8Map);
<ide> $lowerCase = array();
<ide>
<del> for ($i = 0 ; $i < $length; $i++) {
<add> for ($i = 0; $i < $length; $i++) {
<ide> $char = $utf8Map[$i];
<ide>
<ide> if ($char < 128) {
<ide> $str = strtolower(chr($char));
<ide> $strlen = strlen($str);
<del> for ($ii = 0 ; $ii < $strlen; $ii++) {
<add> for ($ii = 0; $ii < $strlen; $ii++) {
<ide> $lower = ord(substr($str, $ii, 1));
<ide> }
<ide> $lowerCase[] = $lower;
<ide> public static function strtoupper($string) {
<ide> $replaced = array();
<ide> $upperCase = array();
<ide>
<del> for ($i = 0 ; $i < $length; $i++) {
<add> for ($i = 0; $i < $length; $i++) {
<ide> $char = $utf8Map[$i];
<ide>
<ide> if ($char < 128) {
<ide> $str = strtoupper(chr($char));
<ide> $strlen = strlen($str);
<del> for ($ii = 0 ; $ii < $strlen; $ii++) {
<add> for ($ii = 0; $ii < $strlen; $ii++) {
<ide> $upper = ord(substr($str, $ii, 1));
<ide> }
<ide> $upperCase[] = $upper;
<ide> public static function mimeEncode($string, $charset = null, $newline = "\r\n") {
<ide> * @return string
<ide> */
<ide> protected static function _codepoint($decimal) {
<del> if ($decimal > 128 && $decimal < 256) {
<add> if ($decimal > 128 && $decimal < 256) {
<ide> $return = '0080_00ff'; // Latin-1 Supplement
<ide> } elseif ($decimal < 384) {
<ide> $return = '0100_017f'; // Latin Extended-A
<ide> public static function checkMultibyte($string) {
<ide> }
<ide> return false;
<ide> }
<add>
<ide> } | 3 |
Text | Text | remove changelog from readme | 52aa5be883e6714538c091f6bcafbb8e7a56a81c | <ide><path>README.md
<ide>
<ide> **Author:** Tom Christie. [Follow me on Twitter][twitter].
<ide>
<del>**Support:** [REST framework discussion group][group].
<add>**Support:** [REST framework group][group], or `#restframework` on freenode IRC.
<ide>
<ide> [![build-status-image]][travis]
<ide>
<ide> To run the tests.
<ide>
<ide> ./rest_framework/runtests/runtests.py
<ide>
<del># Changelog
<del>
<del>### 2.1.17
<del>
<del>**Date**: 26th Jan 2013
<del>
<del>* Support proper 401 Unauthorized responses where appropriate, instead of always using 403 Forbidden.
<del>* Support json encoding of timedelta objects.
<del>* `format_suffix_patterns()` now supports `include` style URL patterns.
<del>* Bugfix: Fix issues with custom pagination serializers.
<del>* Bugfix: Nested serializers now accept `source='*'` argument.
<del>* Bugfix: Return proper validation errors when incorrect types supplied for relational fields.
<del>* Bugfix: Support nullable FKs with `SlugRelatedField`.
<del>* Bugfix: Don't call custom validation methods if the field has an error.
<del>
<del>**Note**: If the primary authentication class is `TokenAuthentication` or `BasicAuthentication`, a view will now correctly return 401 responses to unauthenticated access, with an appropriate `WWW-Authenticate` header, instead of 403 responses.
<del>
<del>### 2.1.16
<del>
<del>**Date**: 14th Jan 2013
<del>
<del>* Deprecate django.utils.simplejson in favor of Python 2.6's built-in json module.
<del>* Bugfix: `auto_now`, `auto_now_add` and other `editable=False` fields now default to read-only.
<del>* Bugfix: PK fields now only default to read-only if they are an AutoField or if `editable=False`.
<del>* Bugfix: Validation errors instead of exceptions when serializers receive incorrect types.
<del>* Bugfix: Validation errors instead of exceptions when related fields receive incorrect types.
<del>* Bugfix: Handle ObjectDoesNotExist exception when serializing null reverse one-to-one
<del>
<del>### 2.1.15
<del>
<del>**Date**: 3rd Jan 2013
<del>
<del>* Added `PATCH` support.
<del>* Added `RetrieveUpdateAPIView`.
<del>* Relation changes are now persisted in `.save` instead of in `.restore_object`.
<del>* Remove unused internal `save_m2m` flag on `ModelSerializer.save()`.
<del>* Tweak behavior of hyperlinked fields with an explicit format suffix.
<del>* Bugfix: Fix issue with FileField raising exception instead of validation error when files=None.
<del>* Bugfix: Partial updates should not set default values if field is not included.
<del>
<del>### 2.1.14
<del>
<del>**Date**: 31st Dec 2012
<del>
<del>* Bugfix: ModelSerializers now include reverse FK fields on creation.
<del>* Bugfix: Model fields with `blank=True` are now `required=False` by default.
<del>* Bugfix: Nested serializers now support nullable relationships.
<del>
<del>**Note**: From 2.1.14 onwards, relational fields move out of the `fields.py` module and into the new `relations.py` module, in order to seperate them from regular data type fields, such as `CharField` and `IntegerField`.
<del>
<del>This change will not affect user code, so long as it's following the recommended import style of `from rest_framework import serializers` and refering to fields using the style `serializers.PrimaryKeyRelatedField`.
<del>
<del>### 2.1.13
<del>
<del>**Date**: 28th Dec 2012
<del>
<del>* Support configurable `STATICFILES_STORAGE` storage.
<del>* Bugfix: Related fields now respect the required flag, and may be required=False.
<del>
<del>### 2.1.12
<del>
<del>**Date**: 21st Dec 2012
<del>
<del>* Bugfix: Fix bug that could occur using ChoiceField.
<del>* Bugfix: Fix exception in browseable API on DELETE.
<del>* Bugfix: Fix issue where pk was was being set to a string if set by URL kwarg.
<del>
<del>### 2.1.11
<del>
<del>**Date**: 17th Dec 2012
<del>
<del>* Bugfix: Fix issue with M2M fields in browseable API.
<del>
<del>### 2.1.10
<del>
<del>**Date**: 17th Dec 2012
<del>
<del>* Bugfix: Ensure read-only fields don't have model validation applied.
<del>* Bugfix: Fix hyperlinked fields in paginated results.
<del>
<del>### 2.1.9
<del>
<del>**Date**: 11th Dec 2012
<del>
<del>* Bugfix: Fix broken nested serialization.
<del>* Bugfix: Fix `Meta.fields` only working as tuple not as list.
<del>* Bugfix: Edge case if unnecessarily specifying `required=False` on read only field.
<del>
<del>### 2.1.8
<del>
<del>**Date**: 8th Dec 2012
<del>
<del>* Fix for creating nullable Foreign Keys with `''` as well as `None`.
<del>* Added `null=<bool>` related field option.
<del>
<del>### 2.1.7
<del>
<del>**Date**: 7th Dec 2012
<del>
<del>* Serializers now properly support nullable Foreign Keys.
<del>* Serializer validation now includes model field validation, such as uniqueness constraints.
<del>* Support 'true' and 'false' string values for BooleanField.
<del>* Added pickle support for serialized data.
<del>* Support `source='dotted.notation'` style for nested serializers.
<del>* Make `Request.user` settable.
<del>* Bugfix: Fix `RegexField` to work with `BrowsableAPIRenderer`
<del>
<del>### 2.1.6
<del>
<del>**Date**: 23rd Nov 2012
<del>
<del>* Bugfix: Unfix DjangoModelPermissions. (I am a doofus.)
<del>
<del>### 2.1.5
<del>
<del>**Date**: 23rd Nov 2012
<del>
<del>* Bugfix: Fix DjangoModelPermissions.
<del>
<del>### 2.1.4
<del>
<del>**Date**: 22nd Nov 2012
<del>
<del>* Support for partial updates with serializers.
<del>* Added `RegexField`.
<del>* Added `SerializerMethodField`.
<del>* Serializer performance improvements.
<del>* Added `obtain_token_view` to get tokens when using `TokenAuthentication`.
<del>* Bugfix: Django 1.5 configurable user support for `TokenAuthentication`.
<del>
<del>### 2.1.3
<del>
<del>**Date**: 16th Nov 2012
<del>
<del>* Added `FileField` and `ImageField`. For use with `MultiPartParser`.
<del>* Added `URLField` and `SlugField`.
<del>* Support for `read_only_fields` on `ModelSerializer` classes.
<del>* Support for clients overriding the pagination page sizes. Use the `PAGINATE_BY_PARAM` setting or set the `paginate_by_param` attribute on a generic view.
<del>* 201 Responses now return a 'Location' header.
<del>* Bugfix: Serializer fields now respect `max_length`.
<del>
<del>### 2.1.2
<del>
<del>**Date**: 9th Nov 2012
<del>
<del>* **Filtering support.**
<del>* Bugfix: Support creation of objects with reverse M2M relations.
<del>
<del>### 2.1.1
<del>
<del>**Date**: 7th Nov 2012
<del>
<del>* Support use of HTML exception templates. Eg. `403.html`
<del>* Hyperlinked fields take optional `slug_field`, `slug_url_kwarg` and `pk_url_kwarg` arguments.
<del>* Bugfix: Deal with optional trailing slashs properly when generating breadcrumbs.
<del>* Bugfix: Make textareas same width as other fields in browsable API.
<del>* Private API change: `.get_serializer` now uses same `instance` and `data` ordering as serializer initialization.
<del>
<del>### 2.1.0
<del>
<del>**Date**: 5th Nov 2012
<del>
<del>**Warning**: Please read [this thread][2.1.0-notes] regarding the `instance` and `data` keyword args before updating to 2.1.0.
<del>
<del>* **Serializer `instance` and `data` keyword args have their position swapped.**
<del>* `queryset` argument is now optional on writable model fields.
<del>* Hyperlinked related fields optionally take `slug_field` and `slug_field_kwarg` arguments.
<del>* Support Django's cache framework.
<del>* Minor field improvements. (Don't stringify dicts, more robust many-pk fields.)
<del>* Bugfixes (Support choice field in Browseable API)
<del>
<del>### 2.0.2
<del>
<del>**Date**: 2nd Nov 2012
<del>
<del>* Fix issues with pk related fields in the browsable API.
<del>
<del>### 2.0.1
<del>
<del>**Date**: 1st Nov 2012
<del>
<del>* Add support for relational fields in the browsable API.
<del>* Added SlugRelatedField and ManySlugRelatedField.
<del>* If PUT creates an instance return '201 Created', instead of '200 OK'.
<del>
<del>### 2.0.0
<del>
<del>**Date**: 30th Oct 2012
<del>
<del>* Redesign of core components.
<del>* **Fix all of the things**.
<del>
<ide> # License
<ide>
<ide> Copyright (c) 2011-2013, Tom Christie | 1 |
Javascript | Javascript | remove ember global usage when testing onerror | 253556651d74fd0bd5c5a50d0abb6bcd20bf9028 | <ide><path>packages/ember-testing/lib/index.js
<ide> export { default as Test } from './test';
<ide> export { default as Adapter } from './adapters/adapter';
<add>export { setAdapter, getAdapter } from './test/adapter';
<ide> export { default as setupForTesting } from './setup_for_testing';
<ide> export { default as QUnitAdapter } from './adapters/qunit';
<ide>
<ide><path>packages/ember/tests/error_handler_test.js
<del>import Ember from 'ember';
<del>import { run } from 'ember-metal';
<add>import { isTesting, setTesting } from 'ember-debug';
<add>import { run, getOnerror, setOnerror } from 'ember-metal';
<ide> import { DEBUG } from 'ember-env-flags';
<ide> import RSVP from 'rsvp';
<del>
<del>const ONERROR = Ember.onerror;
<del>const ADAPTER = Ember.Test && Ember.Test.adapter;
<del>const TESTING = Ember.testing;
<add>import require, { has } from 'require';
<ide>
<ide> let WINDOW_ONERROR;
<ide>
<add>let setAdapter;
<add>let QUnitAdapter;
<add>
<ide> QUnit.module('error_handler', {
<ide> beforeEach() {
<add> if (has('ember-testing')) {
<add> let testing = require('ember-testing');
<add> setAdapter = testing.setAdapter;
<add> QUnitAdapter = testing.QUnitAdapter;
<add> }
<ide> // capturing this outside of module scope to ensure we grab
<ide> // the test frameworks own window.onerror to reset it
<ide> WINDOW_ONERROR = window.onerror;
<ide> },
<ide>
<ide> afterEach() {
<del> Ember.onerror = ONERROR;
<del> Ember.testing = TESTING;
<add> setTesting(isTesting);
<ide> window.onerror = WINDOW_ONERROR;
<del> if (Ember.Test) {
<del> Ember.Test.adapter = ADAPTER;
<add>
<add> if (setAdapter) {
<add> setAdapter();
<ide> }
<add>
<add> setOnerror(undefined);
<add>
<ide> }
<ide> });
<ide>
<ide> function runThatThrowsAsync(message = 'Error for testing error handling') {
<ide> }
<ide>
<ide> QUnit.test('by default there is no onerror - sync run', function(assert) {
<del> assert.strictEqual(Ember.onerror, undefined, 'precond - there should be no Ember.onerror set by default');
<add> assert.strictEqual(getOnerror(), undefined, 'precond - there should be no Ember.onerror set by default');
<ide> assert.throws(runThatThrowsSync, Error, 'errors thrown sync are catchable');
<ide> });
<ide>
<ide> QUnit.test('when Ember.onerror (which rethrows) is registered - sync run', function(assert) {
<ide> assert.expect(2);
<del> Ember.onerror = function(error) {
<add> setOnerror(function(error) {
<ide> assert.ok(true, 'onerror called');
<ide> throw error;
<del> };
<add> });
<ide> assert.throws(runThatThrowsSync, Error, 'error is thrown');
<ide> });
<ide>
<ide> QUnit.test('when Ember.onerror (which does not rethrow) is registered - sync run', function(assert) {
<ide> assert.expect(2);
<del> Ember.onerror = function() {
<add> setOnerror(function() {
<ide> assert.ok(true, 'onerror called');
<del> };
<add> });
<ide> runThatThrowsSync();
<ide> assert.ok(true, 'no error was thrown, Ember.onerror can intercept errors');
<ide> });
<ide> if (DEBUG) {
<ide> QUnit.test('when TestAdapter is registered and error is thrown - sync run', function(assert) {
<ide> assert.expect(1);
<ide>
<del> Ember.Test.adapter = {
<add> setAdapter({
<ide> exception() {
<ide> assert.notOk(true, 'adapter is not called for errors thrown in sync run loops');
<ide> }
<del> };
<add> });
<ide>
<ide> assert.throws(runThatThrowsSync, Error);
<ide> });
<ide>
<ide> QUnit.test('when both Ember.onerror (which rethrows) and TestAdapter are registered - sync run', function(assert) {
<ide> assert.expect(2);
<ide>
<del> Ember.Test.adapter = {
<add> setAdapter({
<ide> exception() {
<ide> assert.notOk(true, 'adapter is not called for errors thrown in sync run loops');
<ide> }
<del> };
<add> });
<ide>
<del> Ember.onerror = function(error) {
<add> setOnerror(function(error) {
<ide> assert.ok(true, 'onerror is called for sync errors even if TestAdapter is setup');
<ide> throw error;
<del> };
<add> });
<ide>
<ide> assert.throws(runThatThrowsSync, Error, 'error is thrown');
<ide> });
<ide>
<ide> QUnit.test('when both Ember.onerror (which does not rethrow) and TestAdapter are registered - sync run', function(assert) {
<ide> assert.expect(2);
<ide>
<del> Ember.Test.adapter = {
<add> setAdapter({
<ide> exception() {
<ide> assert.notOk(true, 'adapter is not called for errors thrown in sync run loops');
<ide> }
<del> };
<add> });
<ide>
<del> Ember.onerror = function() {
<add> setOnerror(function() {
<ide> assert.ok(true, 'onerror is called for sync errors even if TestAdapter is setup');
<del> };
<add> });
<ide>
<ide> runThatThrowsSync();
<ide> assert.ok(true, 'no error was thrown, Ember.onerror can intercept errors');
<ide> if (DEBUG) {
<ide> let done = assert.async();
<ide>
<ide> let caughtInAdapter, caughtInCatch, caughtByWindowOnerror;
<del> Ember.Test.adapter = {
<add> setAdapter({
<ide> exception(error) {
<ide> caughtInAdapter = error;
<ide> }
<del> };
<add> });
<ide>
<ide> window.onerror = function(message) {
<ide> caughtByWindowOnerror = message;
<ide> if (DEBUG) {
<ide> assert.expect(1);
<ide> let done = assert.async();
<ide>
<del> Ember.Test.adapter = {
<add> setAdapter({
<ide> exception() {
<ide> assert.notOk(true, 'Adapter.exception is not called for errors thrown in run.next');
<ide> }
<del> };
<add> });
<ide>
<del> Ember.onerror = function() {
<add> setOnerror(function() {
<ide> assert.ok(true, 'onerror is invoked for errors thrown in run.next/run.later');
<del> };
<add> });
<ide>
<ide> runThatThrowsAsync();
<ide> setTimeout(done, 10);
<ide> });
<ide> }
<ide>
<ide> QUnit.test('does not swallow exceptions by default (Ember.testing = true, no Ember.onerror) - sync run', function(assert) {
<del> Ember.testing = true;
<add> setTesting(true);
<ide>
<ide> let error = new Error('the error');
<ide> assert.throws(() => {
<del> Ember.run(() => {
<add> run(() => {
<ide> throw error;
<ide> });
<ide> }, error);
<ide> });
<ide>
<ide> QUnit.test('does not swallow exceptions by default (Ember.testing = false, no Ember.onerror) - sync run', function(assert) {
<del> Ember.testing = false;
<add> setTesting(false);
<ide> let error = new Error('the error');
<ide> assert.throws(() => {
<del> Ember.run(() => {
<add> run(() => {
<ide> throw error;
<ide> });
<ide> }, error);
<ide> });
<ide>
<ide> QUnit.test('does not swallow exceptions (Ember.testing = false, Ember.onerror which rethrows) - sync run', function(assert) {
<ide> assert.expect(2);
<del> Ember.testing = false;
<add> setTesting(false);
<ide>
<del> Ember.onerror = function(error) {
<add> setOnerror(function(error) {
<ide> assert.ok(true, 'Ember.onerror was called');
<ide> throw error;
<del> };
<add> });
<ide>
<ide> let error = new Error('the error');
<ide> assert.throws(() => {
<del> Ember.run(() => {
<add> run(() => {
<ide> throw error;
<ide> });
<ide> }, error);
<ide> });
<ide>
<ide> QUnit.test('Ember.onerror can intercept errors (aka swallow) by not rethrowing (Ember.testing = false) - sync run', function(assert) {
<ide> assert.expect(1);
<del> Ember.testing = false;
<add> setTesting(false);
<ide>
<del> Ember.onerror = function() {
<add> setOnerror(function() {
<ide> assert.ok(true, 'Ember.onerror was called');
<del> };
<add> });
<ide>
<ide> let error = new Error('the error');
<ide> try {
<del> Ember.run(() => {
<add> run(() => {
<ide> throw error;
<ide> });
<ide> } catch(e) {
<ide> QUnit.test('does not swallow exceptions by default (Ember.testing = true, no Emb
<ide> let done = assert.async();
<ide> let caughtByWindowOnerror;
<ide>
<del> Ember.testing = true;
<add> setTesting(true);
<ide>
<ide> window.onerror = function(message) {
<ide> caughtByWindowOnerror = message;
<ide> // prevent "bubbling" and therefore failing the test
<ide> return true;
<ide> };
<ide>
<del> Ember.run.later(() => {
<add> run.later(() => {
<ide> throw new Error('the error');
<ide> }, 10);
<ide>
<ide> QUnit.test('does not swallow exceptions by default (Ember.testing = false, no Em
<ide> let done = assert.async();
<ide> let caughtByWindowOnerror;
<ide>
<del> Ember.testing = false;
<add> setTesting(false);
<ide>
<ide> window.onerror = function(message) {
<ide> caughtByWindowOnerror = message;
<ide> // prevent "bubbling" and therefore failing the test
<ide> return true;
<ide> };
<ide>
<del> Ember.run.later(() => {
<add> run.later(() => {
<ide> throw new Error('the error');
<ide> }, 10);
<ide>
<ide> QUnit.test('does not swallow exceptions by default (Ember.testing = false, no Em
<ide> QUnit.test('Ember.onerror can intercept errors (aka swallow) by not rethrowing (Ember.testing = false) - async run', function(assert) {
<ide> let done = assert.async();
<ide>
<del> Ember.testing = false;
<add> setTesting(false);
<ide>
<ide> window.onerror = function() {
<ide> assert.notOk(true, 'window.onerror is never invoked when Ember.onerror intentionally swallows errors');
<ide> QUnit.test('Ember.onerror can intercept errors (aka swallow) by not rethrowing (
<ide> };
<ide>
<ide> let thrown = new Error('the error');
<del> Ember.onerror = function(error) {
<add> setOnerror(function(error) {
<ide> assert.strictEqual(error, thrown, 'Ember.onerror is called with the error');
<del> };
<add> });
<ide>
<del> Ember.run.later(() => {
<add> run.later(() => {
<ide> throw thrown;
<ide> }, 10);
<ide>
<ide> function generateRSVPErrorHandlingTests(message, generatePromise, timeout = 10)
<ide> assert.expect(1);
<ide>
<ide> let thrown = new Error('the error');
<del> Ember.onerror = function(error) {
<add> setOnerror(function(error) {
<ide> assert.strictEqual(error, thrown, 'Ember.onerror is called for errors thrown in RSVP promises');
<del> };
<add> });
<ide>
<ide> generatePromise(thrown);
<ide>
<ide> function generateRSVPErrorHandlingTests(message, generatePromise, timeout = 10)
<ide> assert.expect(2);
<ide>
<ide> let thrown = new Error('the error');
<del> Ember.onerror = function(error) {
<add> setOnerror(function(error) {
<ide> assert.strictEqual(error, thrown, 'Ember.onerror is called for errors thrown in RSVP promises');
<ide> throw error;
<del> };
<add> });
<ide>
<ide> window.onerror = function(message) {
<ide> assert.pushResult({
<ide> function generateRSVPErrorHandlingTests(message, generatePromise, timeout = 10)
<ide> QUnit.test(`${message} when Ember.onerror which does not rethrow is present (Ember.testing = false) - rsvp`, function(assert) {
<ide> assert.expect(1);
<ide>
<del> Ember.testing = false;
<add> setTesting(false);
<ide> let thrown = new Error('the error');
<del> Ember.onerror = function(error) {
<add> setOnerror(function(error) {
<ide> assert.strictEqual(error, thrown, 'Ember.onerror is called for errors thrown in RSVP promises');
<del> };
<add> });
<ide>
<ide> generatePromise(thrown);
<ide>
<ide> function generateRSVPErrorHandlingTests(message, generatePromise, timeout = 10)
<ide> QUnit.test(`${message} when Ember.onerror which does rethrow is present (Ember.testing = false) - rsvp`, function(assert) {
<ide> assert.expect(2);
<ide>
<del> Ember.testing = false;
<add> setTesting(false);
<ide> let thrown = new Error('the error');
<del> Ember.onerror = function(error) {
<add> setOnerror(function(error) {
<ide> assert.strictEqual(error, thrown, 'Ember.onerror is called for errors thrown in RSVP promises');
<ide> throw error;
<del> };
<add> });
<ide>
<ide> window.onerror = function(message) {
<ide> assert.pushResult({
<ide> function generateRSVPErrorHandlingTests(message, generatePromise, timeout = 10)
<ide> assert.expect(1);
<ide>
<ide> let thrown = new Error('the error');
<del> Ember.Test.adapter = Ember.Test.QUnitAdapter.create({
<add> setAdapter(QUnitAdapter.create({
<ide> exception: undefined
<del> });
<add> }));
<ide>
<ide> window.onerror = function(message) {
<ide> assert.pushResult({
<ide> function generateRSVPErrorHandlingTests(message, generatePromise, timeout = 10)
<ide> assert.expect(1);
<ide>
<ide> let thrown = new Error('the error');
<del> Ember.Test.adapter = Ember.Test.QUnitAdapter.create({
<add> setAdapter(QUnitAdapter.create({
<ide> exception: undefined
<del> });
<add> }));
<ide>
<del> Ember.onerror = function(error) {
<add> setOnerror(function(error) {
<ide> assert.pushResult({
<ide> result: /the error/.test(error.message),
<ide> actual: error.message,
<ide> expected: 'to include `the error`',
<ide> message: 'error should bubble out to window.onerror, and therefore fail tests (due to QUnit implementing window.onerror)'
<ide> });
<del> };
<add> });
<ide>
<ide> generatePromise(thrown);
<ide>
<ide> function generateRSVPErrorHandlingTests(message, generatePromise, timeout = 10)
<ide> assert.expect(1);
<ide>
<ide> let thrown = new Error('the error');
<del> Ember.Test.adapter = Ember.Test.QUnitAdapter.create({
<add> setAdapter(QUnitAdapter.create({
<ide> exception(error) {
<ide> assert.strictEqual(error, thrown, 'Adapter.exception is called for errors thrown in RSVP promises');
<ide> }
<del> });
<add> }));
<ide>
<ide> generatePromise(thrown);
<ide>
<ide> function generateRSVPErrorHandlingTests(message, generatePromise, timeout = 10)
<ide> assert.expect(1);
<ide>
<ide> let thrown = new Error('the error');
<del> Ember.Test.adapter = Ember.Test.QUnitAdapter.create({
<add> setAdapter(QUnitAdapter.create({
<ide> exception(error) {
<ide> assert.strictEqual(error, thrown, 'Adapter.exception is called for errors thrown in RSVP promises');
<ide> }
<del> });
<add> }));
<ide>
<del> Ember.onerror = function() {
<add> setOnerror(function() {
<ide> assert.notOk(true, 'Ember.onerror is not called if Test.adapter does not rethrow');
<del> };
<add> });
<ide>
<ide> generatePromise(thrown);
<ide>
<ide> function generateRSVPErrorHandlingTests(message, generatePromise, timeout = 10)
<ide> assert.expect(2);
<ide>
<ide> let thrown = new Error('the error');
<del> Ember.Test.adapter = Ember.Test.QUnitAdapter.create({
<add> setAdapter(QUnitAdapter.create({
<ide> exception(error) {
<ide> assert.strictEqual(error, thrown, 'Adapter.exception is called for errors thrown in RSVP promises');
<ide> throw error;
<ide> }
<del> });
<add> }));
<ide>
<del> Ember.onerror = function(error) {
<add> setOnerror(function(error) {
<ide> assert.strictEqual(error, thrown, 'Ember.onerror is called for errors thrown in RSVP promises if Test.adapter rethrows');
<del> };
<add> });
<ide>
<ide> generatePromise(thrown);
<ide> | 2 |
Text | Text | add license, badges and banner | 71342cb1aae548f6b496cdd1511dc94ef69df339 | <ide><path>README.md
<add>
<add>
<ide> # freeCodeCamp Curriculum
<ide>
<ide> [](https://travis-ci.org/freeCodeCamp/curriculum) [](https://www.npmjs.com/package/@freecodecamp/curriculum)
<add>[](http://makeapullrequest.com)
<add>[](http://www.firsttimersonly.com/)
<ide>
<del>> This package contains the "seed" files used in the freeCodeCamp Curriculum.
<add>> This package contains the "challenge" files used in the freeCodeCamp Curriculum.
<ide>
<ide> ## Installation
<ide>
<ide> getChallenges()
<ide> 3. 🔧 Make some awesome changes!
<ide> 4. 👉 [Make a pull request](https://github.com/freeCodeCamp/learn/compare)
<ide> 5. 🎉 Get your pull request approved - success!
<add>
<add>## License
<add>
<add>Copyright (c) 2018 freeCodeCamp.
<add>
<add>The curricular content in this repo is licensed under the [CC-BY-SA-4.0](LICENSE.md) | 1 |
Mixed | Ruby | drop the correct index after reverting a migration | e1d4673102f7c4e58964a6de864402ae9a615688 | <ide><path>activerecord/CHANGELOG.md
<add>* When inverting add_index use the index name if present instead of
<add> the columns.
<add>
<add> If there are two indices with matching columns and one of them is
<add> explicitly named then reverting the migration adding the named one
<add> would instead drop the unnamed one.
<add>
<add> The inversion of add_index will now drop the index by its name if
<add> it is present.
<add>
<add> *Hubert Dąbrowski*
<add>
<ide> * Add flag to disable schema dump after migration.
<ide>
<ide> Add a config parameter on Active Record named `dump_schema_after_migration`
<ide><path>activerecord/lib/active_record/migration/command_recorder.rb
<ide> def invert_rename_column(args)
<ide>
<ide> def invert_add_index(args)
<ide> table, columns, options = *args
<del> [:remove_index, [table, (options || {}).merge(column: columns)]]
<add> options ||= {}
<add>
<add> index_name = options[:name]
<add> options_hash = index_name ? { name: index_name } : { column: columns }
<add>
<add> [:remove_index, [table, options_hash]]
<ide> end
<ide>
<ide> def invert_remove_index(args)
<ide><path>activerecord/test/cases/invertible_migration_test.rb
<ide> def change
<ide> end
<ide> end
<ide>
<add> class RevertNamedIndexMigration1 < SilentMigration
<add> def change
<add> create_table("horses") do |t|
<add> t.column :content, :string
<add> t.column :remind_at, :datetime
<add> end
<add> add_index :horses, :content
<add> end
<add> end
<add>
<add> class RevertNamedIndexMigration2 < SilentMigration
<add> def change
<add> add_index :horses, :content, name: "horses_index_named"
<add> end
<add> end
<add>
<ide> def teardown
<ide> %w[horses new_horses].each do |table|
<ide> if ActiveRecord::Base.connection.table_exists?(table)
<ide> def test_migrate_down_with_table_name_prefix
<ide> ActiveRecord::Base.table_name_prefix = ActiveRecord::Base.table_name_suffix = ''
<ide> end
<ide>
<add> def test_migrate_revert_add_index_with_name
<add> RevertNamedIndexMigration1.new.migrate(:up)
<add> RevertNamedIndexMigration2.new.migrate(:up)
<add> RevertNamedIndexMigration2.new.migrate(:down)
<add>
<add> connection = ActiveRecord::Base.connection
<add> assert connection.index_exists?(:horses, :content),
<add> "index on content should exist"
<add> assert !connection.index_exists?(:horses, :content, name: "horses_index_named"),
<add> "horses_index_named index should not exist"
<add> end
<add>
<ide> end
<ide> end
<ide><path>activerecord/test/cases/migration/command_recorder_test.rb
<ide> def test_invert_rename_column
<ide> end
<ide>
<ide> def test_invert_add_index
<del> remove = @recorder.inverse_of :add_index, [:table, [:one, :two], options: true]
<del> assert_equal [:remove_index, [:table, {column: [:one, :two], options: true}]], remove
<add> remove = @recorder.inverse_of :add_index, [:table, [:one, :two]]
<add> assert_equal [:remove_index, [:table, {column: [:one, :two]}]], remove
<ide> end
<ide>
<ide> def test_invert_add_index_with_name
<ide> remove = @recorder.inverse_of :add_index, [:table, [:one, :two], name: "new_index"]
<del> assert_equal [:remove_index, [:table, {column: [:one, :two], name: "new_index"}]], remove
<add> assert_equal [:remove_index, [:table, {name: "new_index"}]], remove
<ide> end
<ide>
<ide> def test_invert_add_index_with_no_options | 4 |
Go | Go | improve tests on the engine | 8e5ab5bfca2a7077f4e85096808c8f309cf692df | <ide><path>engine/engine_test.go
<add>package engine
<add>
<add>import (
<add> "testing"
<add>)
<add>
<add>func TestRegister(t *testing.T) {
<add> if err := Register("dummy1", nil); err != nil {
<add> t.Fatal(err)
<add> }
<add>
<add> if err := Register("dummy1", nil); err == nil {
<add> t.Fatalf("Expecting error, got none")
<add> }
<add>
<add> eng := newTestEngine(t)
<add>
<add> //Should fail because globan handlers are copied
<add> //at the engine creation
<add> if err := eng.Register("dummy1", nil); err == nil {
<add> t.Fatalf("Expecting error, got none")
<add> }
<add>
<add> if err := eng.Register("dummy2", nil); err != nil {
<add> t.Fatal(err)
<add> }
<add>
<add> if err := eng.Register("dummy2", nil); err == nil {
<add> t.Fatalf("Expecting error, got none")
<add> }
<add>}
<add>
<add>func TestJob(t *testing.T) {
<add> eng := newTestEngine(t)
<add> job1 := eng.Job("dummy1", "--level=awesome")
<add>
<add> if job1.handler != nil {
<add> t.Fatalf("job1.handler should be empty")
<add> }
<add>
<add> h := func(j *Job) string {
<add> return j.Name
<add> }
<add>
<add> eng.Register("dummy2", h)
<add> job2 := eng.Job("dummy2", "--level=awesome")
<add>
<add> if job2.handler == nil {
<add> t.Fatalf("job2.handler shouldn't be nil")
<add> }
<add>
<add> if job2.handler(job2) != job2.Name {
<add> t.Fatalf("handler dummy2 was not found in job2")
<add> }
<add>}
<ide><path>engine/env_test.go
<ide> func TestSetenv(t *testing.T) {
<ide> if val := job.Getenv("foo"); val != "bar" {
<ide> t.Fatalf("Getenv returns incorrect value: %s", val)
<ide> }
<add>
<add> job.Setenv("bar", "")
<add> if val := job.Getenv("bar"); val != "" {
<add> t.Fatalf("Getenv returns incorrect value: %s", val)
<add> }
<ide> if val := job.Getenv("nonexistent"); val != "" {
<ide> t.Fatalf("Getenv returns incorrect value: %s", val)
<ide> }
<ide> }
<add>
<add>func TestSetenvBool(t *testing.T) {
<add> job := mkJob(t, "dummy")
<add> job.SetenvBool("foo", true)
<add> if val := job.GetenvBool("foo"); !val {
<add> t.Fatalf("GetenvBool returns incorrect value: %b", val)
<add> }
<add>
<add> job.SetenvBool("bar", false)
<add> if val := job.GetenvBool("bar"); val {
<add> t.Fatalf("GetenvBool returns incorrect value: %b", val)
<add> }
<add>
<add> if val := job.GetenvBool("nonexistent"); val {
<add> t.Fatalf("GetenvBool returns incorrect value: %b", val)
<add> }
<add>}
<add>
<add>func TestSetenvInt(t *testing.T) {
<add> job := mkJob(t, "dummy")
<add>
<add> job.SetenvInt("foo", -42)
<add> if val := job.GetenvInt("foo"); val != -42 {
<add> t.Fatalf("GetenvInt returns incorrect value: %d", val)
<add> }
<add>
<add> job.SetenvInt("bar", 42)
<add> if val := job.GetenvInt("bar"); val != 42 {
<add> t.Fatalf("GetenvInt returns incorrect value: %d", val)
<add> }
<add> if val := job.GetenvInt("nonexistent"); val != -1 {
<add> t.Fatalf("GetenvInt returns incorrect value: %d", val)
<add> }
<add>}
<add>
<add>func TestSetenvList(t *testing.T) {
<add> job := mkJob(t, "dummy")
<add>
<add> job.SetenvList("foo", []string{"bar"})
<add> if val := job.GetenvList("foo"); len(val) != 1 || val[0] != "bar" {
<add> t.Fatalf("GetenvList returns incorrect value: %v", val)
<add> }
<add>
<add> job.SetenvList("bar", nil)
<add> if val := job.GetenvList("bar"); val != nil {
<add> t.Fatalf("GetenvList returns incorrect value: %v", val)
<add> }
<add> if val := job.GetenvList("nonexistent"); val != nil {
<add> t.Fatalf("GetenvList returns incorrect value: %v", val)
<add> }
<add>}
<add>
<add>func TestImportEnv(t *testing.T) {
<add> type dummy struct {
<add> DummyInt int
<add> DummyStringArray []string
<add> }
<add>
<add> job := mkJob(t, "dummy")
<add> if err := job.ImportEnv(&dummy{42, []string{"foo", "bar"}}); err != nil {
<add> t.Fatal(err)
<add> }
<add>
<add> dmy := dummy{}
<add> if err := job.ExportEnv(&dmy); err != nil {
<add> t.Fatal(err)
<add> }
<add>
<add> if dmy.DummyInt != 42 {
<add> t.Fatalf("Expected 42, got %d", dmy.DummyInt)
<add> }
<add>
<add> if len(dmy.DummyStringArray) != 2 || dmy.DummyStringArray[0] != "foo" || dmy.DummyStringArray[1] != "bar" {
<add> t.Fatalf("Expected {foo, bar}, got %v", dmy.DummyStringArray)
<add> }
<add>
<add>}
<add>
<add>func TestEnviron(t *testing.T) {
<add> job := mkJob(t, "dummy")
<add> job.Setenv("foo", "bar")
<add> val, exists := job.Environ()["foo"]
<add> if !exists {
<add> t.Fatalf("foo not found in the environ")
<add> }
<add> if val != "bar" {
<add> t.Fatalf("bar not found in the environ")
<add> }
<add>}
<add><path>engine/helpers_test.go
<del><path>engine/utils.go
<ide> import (
<ide>
<ide> var globalTestID string
<ide>
<del>func init() {
<del> Register("dummy", func(job *Job) string { return "" })
<del>}
<del>
<ide> func newTestEngine(t *testing.T) *Engine {
<ide> // Use the caller function name as a prefix.
<ide> // This helps trace temp directories back to their test.
<ide><path>engine/job.go
<ide> func (job *Job) SetenvInt(key string, value int64) {
<ide> job.Setenv(key, fmt.Sprintf("%d", value))
<ide> }
<ide>
<add>// Returns nil if key not found
<ide> func (job *Job) GetenvList(key string) []string {
<ide> sval := job.Getenv(key)
<add> if sval == "" {
<add> return nil
<add> }
<ide> l := make([]string, 0, 1)
<ide> if err := json.Unmarshal([]byte(sval), &l); err != nil {
<ide> l = append(l, sval)
<ide> func (job *Job) Setenv(key, value string) {
<ide> // DecodeEnv decodes `src` as a json dictionary, and adds
<ide> // each decoded key-value pair to the environment.
<ide> //
<del>// If `text` cannot be decoded as a json dictionary, an error
<add>// If `src` cannot be decoded as a json dictionary, an error
<ide> // is returned.
<ide> func (job *Job) DecodeEnv(src io.Reader) error {
<ide> m := make(map[string]interface{}) | 4 |
Python | Python | fix irnn example | cec7f73bca617ab4321a805f25499d75f13c2672 | <ide><path>examples/mnist_irnn.py
<ide> '''
<ide>
<ide> from __future__ import print_function
<del>import numpy as np
<del>np.random.seed(1337) # for reproducibility
<ide>
<ide> from keras.datasets import mnist
<ide> from keras.models import Sequential
<ide> from keras.layers.core import Dense, Activation
<ide> from keras.initializations import normal, identity
<del>from keras.layers.recurrent import SimpleRNN, LSTM
<add>from keras.layers.recurrent import SimpleRNN
<ide> from keras.optimizers import RMSprop
<ide> from keras.utils import np_utils
<ide>
<del>
<ide> batch_size = 32
<ide> nb_classes = 10
<ide> nb_epochs = 200
<ide> print('Evaluate IRNN...')
<ide> model = Sequential()
<ide> model.add(SimpleRNN(output_dim=hidden_units,
<del> init=lambda shape: normal(shape, scale=0.001),
<del> inner_init=lambda shape: identity(shape, scale=1.0),
<add> init=lambda shape, name: normal(shape, scale=0.001, name=name),
<add> inner_init=lambda shape, name: identity(shape, scale=1.0, name=name),
<ide> activation='relu',
<ide> input_shape=X_train.shape[1:]))
<ide> model.add(Dense(nb_classes))
<ide> scores = model.evaluate(X_test, Y_test, verbose=0)
<ide> print('IRNN test score:', scores[0])
<ide> print('IRNN test accuracy:', scores[1])
<del>
<del>print('Compare to LSTM...')
<del>model = Sequential()
<del>model.add(LSTM(hidden_units, input_shape=X_train.shape[1:]))
<del>model.add(Dense(nb_classes))
<del>model.add(Activation('softmax'))
<del>rmsprop = RMSprop(lr=learning_rate)
<del>model.compile(loss='categorical_crossentropy',
<del> optimizer=rmsprop,
<del> metrics=['accuracy'])
<del>
<del>model.fit(X_train, Y_train, batch_size=batch_size, nb_epoch=nb_epochs,
<del> verbose=1, validation_data=(X_test, Y_test))
<del>
<del>scores = model.evaluate(X_test, Y_test, verbose=0)
<del>print('LSTM test score:', scores[0])
<del>print('LSTM test accuracy:', scores[1]) | 1 |
Text | Text | update broken link to publish doc | 66628e8c5218525efe7043101ccb19bfac0a3633 | <ide><path>docs/your-first-package.md
<ide> To begin, press `cmd-shift-P` to bring up the [Command
<ide> Palette](https://github.com/atom/command-palette). Type "generate package" and
<ide> select the "Package Generator: Generate Package" command. Now we need to name
<ide> the package. Try to avoid naming your package with the *atom-* prefix, for
<del>example we are going to call this package _ascii-art_.
<add>example we are going to call this package _ascii-art_.
<ide>
<ide> Atom will open a new window with the contents of our new _ascii-art_ package
<ide> displayed in the Tree View. Because this window is opened **after** the package
<ide> ASCII art professional!
<ide> * [Creating a package guide](creating-a-package.html) for more information
<ide> on the mechanics of packages
<ide>
<del>* [Publishing a package guide](publish-a-package.html) for more information
<add>* [Publishing a package guide](publishing-a-package.html) for more information
<ide> on publishing your package to [atom.io](https://atom.io) | 1 |
Ruby | Ruby | increase test coverage (closes , ) [josh] | f99e5bba192938ed7e812f1ae82785ad796c636d | <ide><path>activeresource/test/base/custom_methods_test.rb
<ide> def setup
<ide> mock.get "/people/1/deep.xml", {}, @matz_deep
<ide> mock.get "/people/retrieve.xml?name=Matz", {}, @matz_array
<ide> mock.get "/people/managers.xml", {}, @matz_array
<add> mock.post "/people/hire.xml?name=Matz", {}, nil, 201
<ide> mock.put "/people/1/promote.xml?position=Manager", {}, nil, 204
<ide> mock.put "/people/promote.xml?name=Matz", {}, nil, 204, {}
<ide> mock.put "/people/sort.xml?by=name", {}, nil, 204
<ide> mock.delete "/people/deactivate.xml?name=Matz", {}, nil, 200
<ide> mock.delete "/people/1/deactivate.xml", {}, nil, 200
<ide> mock.post "/people/new/register.xml", {}, @ryan, 201, 'Location' => '/people/5.xml'
<add> mock.post "/people/1/register.xml", {}, @matz, 201
<ide> mock.get "/people/1/addresses/1.xml", {}, @addy
<ide> mock.get "/people/1/addresses/1/deep.xml", {}, @addy_deep
<ide> mock.put "/people/1/addresses/1/normalize_phone.xml?locale=US", {}, nil, 204
<ide> def setup
<ide> def teardown
<ide> ActiveResource::HttpMock.reset!
<ide> end
<del>
<add>
<ide> def test_custom_collection_method
<ide> # GET
<ide> assert_equal([{ "id" => 1, "name" => 'Matz' }], Person.get(:retrieve, :name => 'Matz'))
<del>
<add>
<add> # POST
<add> assert_equal(ActiveResource::Response.new("", 201, {}), Person.post(:hire, :name => 'Matz'))
<add>
<ide> # PUT
<ide> assert_equal ActiveResource::Response.new("", 204, {}),
<ide> Person.put(:promote, {:name => 'Matz'}, 'atestbody')
<ide> assert_equal ActiveResource::Response.new("", 204, {}), Person.put(:sort, :by => 'name')
<del>
<add>
<ide> # DELETE
<ide> Person.delete :deactivate, :name => 'Matz'
<del>
<add>
<ide> # Nested resource
<ide> assert_equal ActiveResource::Response.new("", 204, {}), StreetAddress.put(:sort, :person_id => 1, :by => 'name')
<ide> end
<del>
<add>
<ide> def test_custom_element_method
<ide> # Test GET against an element URL
<ide> assert_equal Person.find(1).get(:shallow), {"id" => 1, "name" => 'Matz'}
<ide> def test_custom_element_method
<ide> assert_equal ActiveResource::Response.new("", 204, {}),
<ide> StreetAddress.find(1, :params => { :person_id => 1 }).put(:normalize_phone, :locale => 'US')
<ide> end
<del>
<add>
<ide> def test_custom_new_element_method
<ide> # Test POST against a new element URL
<ide> ryan = Person.new(:name => 'Ryan')
<ide> assert_equal ActiveResource::Response.new(@ryan, 201, {'Location' => '/people/5.xml'}), ryan.post(:register)
<del>
<add>
<ide> # Test POST against a nested collection URL
<ide> addy = StreetAddress.new(:street => '123 Test Dr.', :person_id => 1)
<ide> assert_equal ActiveResource::Response.new({ :street => '12345 Street' }.to_xml(:root => 'address'),
<ide> 201, {'Location' => '/people/1/addresses/2.xml'}),
<ide> addy.post(:link)
<add>
<add> matz = Person.new(:id => 1, :name => 'Matz')
<add> assert_equal ActiveResource::Response.new(@matz, 201), matz.post(:register)
<ide> end
<del>
<add>
<ide> def test_find_custom_resources
<ide> assert_equal 'Matz', Person.find(:all, :from => :managers).first.name
<ide> end
<del>end
<ide>\ No newline at end of file
<add>end
<ide><path>activeresource/test/base_errors_test.rb
<ide> def setup
<ide> @person = Person.new(:name => '', :age => '')
<ide> assert_equal @person.save, false
<ide> end
<del>
<add>
<ide> def test_should_mark_as_invalid
<ide> assert [email protected]?
<ide> end
<del>
<add>
<ide> def test_should_parse_xml_errors
<ide> assert_kind_of ActiveResource::Errors, @person.errors
<ide> assert_equal 4, @person.errors.size
<ide> end
<ide>
<ide> def test_should_parse_errors_to_individual_attributes
<add> assert @person.errors.invalid?(:name)
<ide> assert_equal "can't be blank", @person.errors.on(:age)
<ide> assert_equal ["can't be blank", "must start with a letter"], @person.errors[:name]
<ide> assert_equal "Person quota full for today.", @person.errors.on_base
<ide> end
<ide>
<add> def test_should_iterate_over_errors
<add> errors = []
<add> @person.errors.each { |attribute, message| errors << [attribute, message] }
<add> assert_equal ["name", "can't be blank"], errors.first
<add> end
<add>
<add> def test_should_iterate_over_full_errors
<add> errors = []
<add> @person.errors.each_full { |message| errors << message }
<add> assert_equal "Name can't be blank", errors.first
<add> end
<add>
<ide> def test_should_format_full_errors
<ide> full = @person.errors.full_messages
<ide> assert full.include?("Age can't be blank") | 2 |
Text | Text | add link to sqlite download in sqlite lesson | df8166267b60d43e13abf37144e5166731d5171b | <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/relational-databases-and-sqlite.md
<ide> bilibiliIds:
<ide> dashedName: relational-databases-and-sqlite
<ide> ---
<ide>
<add># --description--
<add>
<add>[Download SQLite](https://www.sqlite.org/download.html)
<add>[Download DB Browser for SQLite](https://sqlitebrowser.org/dl/)
<add>[SQLite usage](https://www.sqlite.org/famous.html)
<add>
<ide> # --question--
<ide>
<ide> ## --text-- | 1 |
Ruby | Ruby | pass the skip_pipeline option in image_submit_tag | ae7a57209d0a2365a6e90684e45d55b7de78101d | <ide><path>actionview/lib/action_view/helpers/form_tag_helper.rb
<ide> def button_tag(content_or_options = nil, options = nil, &block)
<ide> # # => <input src="/assets/save.png" data-confirm="Are you sure?" type="image" />
<ide> def image_submit_tag(source, options = {})
<ide> options = options.stringify_keys
<del> tag :input, { "type" => "image", "src" => path_to_image(source) }.update(options)
<add> src = path_to_image(source, skip_pipeline: options.delete("skip_pipeline"))
<add> tag :input, { "type" => "image", "src" => src }.update(options)
<ide> end
<ide>
<ide> # Creates a field set for grouping HTML form elements.
<ide><path>railties/test/application/asset_debugging_test.rb
<ide> class ::PostsController < ActionController::Base ; end
<ide> stylesheet_link_tag: %r{<link rel="stylesheet" media="screen" href="/stylesheets/#{contents}.css" />},
<ide> javascript_include_tag: %r{<script src="/javascripts/#{contents}.js">},
<ide> audio_tag: %r{<audio src="/audios/#{contents}"></audio>},
<del> video_tag: %r{<video src="/videos/#{contents}"></video>}
<add> video_tag: %r{<video src="/videos/#{contents}"></video>},
<add> image_submit_tag: %r{<input type="image" src="/images/#{contents}" />}
<ide> }
<ide>
<ide> cases.each do |(view_method, tag_match)| | 2 |
Python | Python | ignore nan-warnings in randomized out tests | 48623f63f6a564f9b65bdb8f0a26c026b65ea6e8 | <ide><path>numpy/lib/tests/test_nanfunctions.py
<ide> def test_keepdims(self):
<ide> (-3, -1),
<ide> ]
<ide> )
<add> @pytest.mark.filterwarnings("ignore:All-NaN slice:RuntimeWarning")
<ide> def test_keepdims_out(self, axis):
<ide> d = np.ones((3, 5, 7, 11))
<ide> # Randomly set some elements to NaN:
<ide> def test_keepdims(self):
<ide> (-3, -1),
<ide> ]
<ide> )
<add> @pytest.mark.filterwarnings("ignore:All-NaN slice:RuntimeWarning")
<ide> def test_keepdims_out(self, q, axis):
<ide> d = np.ones((3, 5, 7, 11))
<ide> # Randomly set some elements to NaN: | 1 |
Ruby | Ruby | use appropriate type for `test_framework` option | 5c421239c3cbbb587a54a18548cf734492f6341a | <ide><path>railties/lib/rails/generators.rb
<ide> module Generators
<ide> stylesheet_engine: :css,
<ide> scaffold_stylesheet: true,
<ide> system_tests: nil,
<del> test_framework: false,
<add> test_framework: nil,
<ide> template_engine: :erb
<ide> }
<ide> } | 1 |
Python | Python | replace double quotes with simple quotes | df85a0ff0b2847295fde06ab5fd6d2bcb217d59e | <ide><path>transformers/modeling_bert.py
<ide> class BertLayer(nn.Module):
<ide> def __init__(self, config):
<ide> super(BertLayer, self).__init__()
<ide> self.self_attention = BertAttention(config)
<del> if config.get('is_decoder', False):
<add> if config.get("is_decoder", False):
<ide> self.attention = BertAttention(config)
<ide> self.intermediate = BertIntermediate(config)
<ide> self.output = BertOutput(config) | 1 |
Python | Python | use tf.float32 instead of "float32" | dfcca061b309082d59d133b3b02f359ac1e591c4 | <ide><path>official/transformer/v2/transformer.py
<ide> def create_model(params, is_train):
<ide> if params["enable_metrics_in_training"]:
<ide> logits = metrics.MetricLayer(vocab_size)([logits, targets])
<ide> logits = tf.keras.layers.Lambda(lambda x: x, name="logits",
<del> dtype="float32")(logits)
<add> dtype=tf.float32)(logits)
<ide> model = tf.keras.Model([inputs, targets], logits)
<ide> # TODO(reedwm): Can we do this loss in float16 instead of float32?
<ide> loss = metrics.transformer_loss( | 1 |
Javascript | Javascript | fix a small error in font encoding | a7332d178a53fbc99e5f668f2a71d85a1a4ee82d | <ide><path>pdf.js
<ide> var CanvasGraphics = (function() {
<ide> }
<ide>
<ide> var composite = font.composite;
<del> var encoding = font.encoding;
<ide> var fontSize = current.fontSize;
<ide> var charSpacing = current.charSpacing;
<ide> var wordSpacing = current.wordSpacing;
<ide> var CanvasGraphics = (function() {
<ide> var charcode = originalText.charCodeAt(i);
<ide> }
<ide>
<del> var charWidth = font.encoding[charcode].width * fontSize * 0.001;
<add> var encoding = font.encoding[charcode];
<add> var charWidth = (encoding ? encoding.width : font.defaultWidth);
<add> charWidth *= (fontSize * 0.001);
<ide> charWidth += charSpacing;
<ide> if (charcode == 32)
<ide> charWidth += wordSpacing; | 1 |
Python | Python | simplify content_negotiation slightly | 5036638d0c8a9f53d865e7b6bfd11b4a5534ba6e | <ide><path>djangorestframework/views.py
<ide> def get_renderers(self, format=None):
<ide> """
<ide> return [renderer(self) for renderer in self.renderer_classes]
<ide>
<del> def filter_renderers(self, renderers, format=None):
<del> """
<del> If format suffix such as '.json' is supplied, filter the
<del> list of valid renderers for this request.
<del> """
<del> return [renderer for renderer in renderers
<del> if renderer.can_handle_format(format)]
<del>
<ide> def get_permissions(self):
<ide> """
<ide> Instantiates and returns the list of permissions that this view requires.
<ide> def content_negotiation(self, request):
<ide> # If there is a '.json' style format suffix, only use
<ide> # renderers that accept that format.
<ide> fallback = renderers[0]
<del> renderers = self.filter_renderers(renderers, self.format)
<add> renderers = [renderer for renderer in renderers
<add> if renderer.can_handle_format(self.format)]
<ide> if not renderers:
<ide> self.format404 = True
<ide> return (fallback, fallback.media_type) | 1 |
Javascript | Javascript | add missing semicolon in simplehttpserver.js | f787058cee5922066998072f706bd5697df76b45 | <ide><path>utils/servers/simplehttpserver.js
<ide> http.createServer(handleRequest).listen(port);
<ide>
<ide> require('dns').lookup(require('os').hostname(), function (err, addr, fam) {
<ide> console.log('Running at http://' + addr + ((port === 80) ? '' : ':') + port + '/');
<del>})
<add>});
<ide>
<ide> console.log('Three.js server has started...');
<del>console.log('Base directory at ' + currentDir);
<ide>\ No newline at end of file
<add>console.log('Base directory at ' + currentDir); | 1 |
Python | Python | add back context_rcnn_lib | 1a449bb925115eea0a43d78e7b9af5a3e1f60045 | <ide><path>research/object_detection/meta_architectures/context_rcnn_lib.py
<ide> from __future__ import print_function
<ide>
<ide> import tensorflow.compat.v1 as tf
<add>import tf_slim as slim
<add>
<ide>
<ide> # The negative value used in padding the invalid weights.
<ide> _NEGATIVE_PADDING_VALUE = -100000
<ide>
<del>KEY_NAME = 'key'
<del>VALUE_NAME = 'val'
<del>QUERY_NAME = 'query'
<del>FEATURE_NAME = 'feature'
<del>
<del>class ContextProjection(tf.keras.layers.Layer):
<del> """Custom layer to do batch normalization and projection."""
<del> def __init__(self, projection_dimension, freeze_batchnorm, **kwargs):
<del> self.batch_norm = tf.keras.layers.BatchNormalization(
<del> epsilon=0.001,
<del> center=True,
<del> scale=True,
<del> momentum=0.97,
<del> trainable=(not freeze_batchnorm))
<del> self.projection = tf.keras.layers.Dense(units=projection_dimension,
<del> activation=tf.nn.relu6,
<del> use_bias=True)
<del> super(ContextProjection, self).__init__(**kwargs)
<del>
<del> def build(self, input_shape):
<del> self.batch_norm.build(input_shape)
<del> self.projection.build(input_shape)
<del>
<del> def call(self, input_features, is_training=False):
<del> return self.projection(self.batch_norm(input_features, is_training))
<del>
<del>class AttentionBlock(tf.keras.layers.Layer):
<del> def __init__(self, bottleneck_dimension, attention_temperature, freeze_batchnorm, output_dimension=None, **kwargs):
<del> self.key_proj = ContextProjection(bottleneck_dimension, freeze_batchnorm)
<del> self.val_proj = ContextProjection(bottleneck_dimension, freeze_batchnorm)
<del> self.query_proj = ContextProjection(bottleneck_dimension, freeze_batchnorm)
<del> self.attention_temperature = attention_temperature
<del> self.freeze_batchnorm = freeze_batchnorm
<del> self.bottleneck_dimension = bottleneck_dimension
<del> if output_dimension:
<del> self.output_dimension = output_dimension
<del> super(AttentionBlock, self).__init__(**kwargs)
<del>
<del> def set_output_dimension(self, new_output_dimension):
<del> self.output_dimension = new_output_dimension
<del>
<del> def build(self, input_shapes):
<del> print(input_shapes)
<del> self.feature_proj = ContextProjection(self.output_dimension, self.freeze_batchnorm)
<del> #self.key_proj.build(input_shapes[0])
<del> #self.val_proj.build(input_shapes[0])
<del> #self.query_proj.build(input_shapes[0])
<del> #self.feature_proj.build(input_shapes[0])
<del> pass
<del>
<del> def call(self, input_features, is_training, valid_mask):
<del> input_features, context_features = input_features
<del> with tf.variable_scope("AttentionBlock"):
<del> queries = project_features(
<del> input_features, self.bottleneck_dimension, is_training,
<del> self.query_proj, normalize=True)
<del> keys = project_features(
<del> context_features, self.bottleneck_dimension, is_training,
<del> self.key_proj, normalize=True)
<del> values = project_features(
<del> context_features, self.bottleneck_dimension, is_training,
<del> self.val_proj, normalize=True)
<del>
<del> weights = tf.matmul(queries, keys, transpose_b=True)
<del>
<del> weights, values = filter_weight_value(weights, values, valid_mask)
<del>
<del> weights = tf.nn.softmax(weights / self.attention_temperature)
<del>
<del> features = tf.matmul(weights, values)
<del> output_features = project_features(
<del> features, self.output_dimension, is_training,
<del> self.feature_proj, normalize=False)
<del> return output_features
<del>
<ide>
<ide> def filter_weight_value(weights, values, valid_mask):
<ide> """Filters weights and values based on valid_mask.
<ide> def filter_weight_value(weights, values, valid_mask):
<ide> m_batch_size, m_context_size = valid_mask.shape
<ide> if w_batch_size != v_batch_size or v_batch_size != m_batch_size:
<ide> raise ValueError("Please make sure the first dimension of the input"
<del> " tensors are the same.")
<add> " tensors are the same.")
<ide>
<ide> if w_context_size != v_context_size:
<ide> raise ValueError("Please make sure the third dimension of weights matches"
<del> " the second dimension of values.")
<add> " the second dimension of values.")
<ide>
<ide> if w_context_size != m_context_size:
<ide> raise ValueError("Please make sure the third dimension of the weights"
<del> " matches the second dimension of the valid_mask.")
<add> " matches the second dimension of the valid_mask.")
<ide>
<ide> valid_mask = valid_mask[..., tf.newaxis]
<ide>
<ide> def filter_weight_value(weights, values, valid_mask):
<ide>
<ide> return weights, values
<ide>
<del>def project_features(features, bottleneck_dimension, is_training, layer, normalize=True):
<add>
<add>def compute_valid_mask(num_valid_elements, num_elements):
<add> """Computes mask of valid entries within padded context feature.
<add>
<add> Args:
<add> num_valid_elements: A int32 Tensor of shape [batch_size].
<add> num_elements: An int32 Tensor.
<add>
<add> Returns:
<add> A boolean Tensor of the shape [batch_size, num_elements]. True means
<add> valid and False means invalid.
<add> """
<add> batch_size = num_valid_elements.shape[0]
<add> element_idxs = tf.range(num_elements, dtype=tf.int32)
<add> batch_element_idxs = tf.tile(element_idxs[tf.newaxis, ...], [batch_size, 1])
<add> num_valid_elements = num_valid_elements[..., tf.newaxis]
<add> valid_mask = tf.less(batch_element_idxs, num_valid_elements)
<add> return valid_mask
<add>
<add>
<add>def project_features(features, projection_dimension, is_training, normalize):
<ide> """Projects features to another feature space.
<ide>
<ide> Args:
<ide> features: A float Tensor of shape [batch_size, features_size,
<ide> num_features].
<ide> projection_dimension: A int32 Tensor.
<ide> is_training: A boolean Tensor (affecting batch normalization).
<del> node: Contains a custom layer specific to the particular operation
<del> being performed (key, value, query, features)
<ide> normalize: A boolean Tensor. If true, the output features will be l2
<ide> normalized on the last dimension.
<ide>
<ide> Returns:
<ide> A float Tensor of shape [batch, features_size, projection_dimension].
<ide> """
<del> shape_arr = features.shape
<del> batch_size, _, num_features = shape_arr
<del> print("Orig", features.shape)
<add> # TODO(guanhangwu) Figure out a better way of specifying the batch norm
<add> # params.
<add> batch_norm_params = {
<add> "is_training": is_training,
<add> "decay": 0.97,
<add> "epsilon": 0.001,
<add> "center": True,
<add> "scale": True
<add> }
<add>
<add> batch_size, _, num_features = features.shape
<ide> features = tf.reshape(features, [-1, num_features])
<add> projected_features = slim.fully_connected(
<add> features,
<add> num_outputs=projection_dimension,
<add> activation_fn=tf.nn.relu6,
<add> normalizer_fn=slim.batch_norm,
<add> normalizer_params=batch_norm_params)
<ide>
<del> projected_features = layer(features, is_training)
<del>
<del> projected_features = tf.reshape(projected_features, [batch_size, -1, bottleneck_dimension])
<del> print(projected_features.shape)
<add> projected_features = tf.reshape(projected_features,
<add> [batch_size, -1, projection_dimension])
<ide>
<ide> if normalize:
<del> projected_features = tf.keras.backend.l2_normalize(projected_features, axis=-1)
<add> projected_features = tf.math.l2_normalize(projected_features, axis=-1)
<ide>
<ide> return projected_features
<ide>
<del>def compute_valid_mask(num_valid_elements, num_elements):
<del> """Computes mask of valid entries within padded context feature.
<del>
<del> Args:
<del> num_valid_elements: A int32 Tensor of shape [batch_size].
<del> num_elements: An int32 Tensor.
<del>
<del> Returns:
<del> A boolean Tensor of the shape [batch_size, num_elements]. True means
<del> valid and False means invalid.
<del> """
<del> batch_size = num_valid_elements.shape[0]
<del> element_idxs = tf.range(num_elements, dtype=tf.int32)
<del> batch_element_idxs = tf.tile(element_idxs[tf.newaxis, ...], [batch_size, 1])
<del> num_valid_elements = num_valid_elements[..., tf.newaxis]
<del> valid_mask = tf.less(batch_element_idxs, num_valid_elements)
<del> return valid_mask
<add>
<add>def attention_block(input_features, context_features, bottleneck_dimension,
<add> output_dimension, attention_temperature, valid_mask,
<add> is_training):
<add> """Generic attention block.
<add>
<add> Args:
<add> input_features: A float Tensor of shape [batch_size, input_size,
<add> num_input_features].
<add> context_features: A float Tensor of shape [batch_size, context_size,
<add> num_context_features].
<add> bottleneck_dimension: A int32 Tensor representing the bottleneck dimension
<add> for intermediate projections.
<add> output_dimension: A int32 Tensor representing the last dimension of the
<add> output feature.
<add> attention_temperature: A float Tensor. It controls the temperature of the
<add> softmax for weights calculation. The formula for calculation as follows:
<add> weights = exp(weights / temperature) / sum(exp(weights / temperature))
<add> valid_mask: A boolean Tensor of shape [batch_size, context_size].
<add> is_training: A boolean Tensor (affecting batch normalization).
<add>
<add> Returns:
<add> A float Tensor of shape [batch_size, input_size, output_dimension].
<add> """
<add>
<add> with tf.variable_scope("AttentionBlock"):
<add> queries = project_features(
<add> input_features, bottleneck_dimension, is_training, normalize=True)
<add> keys = project_features(
<add> context_features, bottleneck_dimension, is_training, normalize=True)
<add> values = project_features(
<add> context_features, bottleneck_dimension, is_training, normalize=True)
<add>
<add> weights = tf.matmul(queries, keys, transpose_b=True)
<add>
<add> weights, values = filter_weight_value(weights, values, valid_mask)
<add>
<add> weights = tf.nn.softmax(weights / attention_temperature)
<add>
<add> features = tf.matmul(weights, values)
<add> output_features = project_features(
<add> features, output_dimension, is_training, normalize=False)
<add> return output_features
<add>
<ide>
<ide> def compute_box_context_attention(box_features, context_features,
<ide> valid_context_size, bottleneck_dimension,
<del> attention_temperature, is_training,
<del> freeze_batchnorm, attention_block):
<add> attention_temperature, is_training):
<ide> """Computes the attention feature from the context given a batch of box.
<ide>
<ide> Args:
<ide> def compute_box_context_attention(box_features, context_features,
<ide> softmax for weights calculation. The formula for calculation as follows:
<ide> weights = exp(weights / temperature) / sum(exp(weights / temperature))
<ide> is_training: A boolean Tensor (affecting batch normalization).
<del> freeze_batchnorm: Whether to freeze batch normalization weights.
<del> attention_projections: Dictionary of the projection layers.
<ide>
<ide> Returns:
<ide> A float Tensor of shape [batch_size, max_num_proposals, 1, 1, channels].
<ide> def compute_box_context_attention(box_features, context_features,
<ide> valid_mask = compute_valid_mask(valid_context_size, context_size)
<ide>
<ide> channels = box_features.shape[-1]
<del> attention_block.set_output_dimension(channels)
<del>
<ide> # Average pools over height and width dimension so that the shape of
<ide> # box_features becomes [batch_size, max_num_proposals, channels].
<ide> box_features = tf.reduce_mean(box_features, [2, 3])
<ide>
<del> output_features = attention_block([box_features, context_features], is_training, valid_mask)
<add> output_features = attention_block(box_features, context_features,
<add> bottleneck_dimension, channels.value,
<add> attention_temperature, valid_mask,
<add> is_training)
<ide>
<ide> # Expands the dimension back to match with the original feature map.
<ide> output_features = output_features[:, :, tf.newaxis, tf.newaxis, :]
<ide>
<ide> return output_features
<add>
<ide>\ No newline at end of file | 1 |
Javascript | Javascript | add default to textures | 6ee06c715587c498cac381727278adf4da34189c | <ide><path>src/textures/DataTexture2DArray.js
<ide> function DataTexture2DArray( data, width, height, depth ) {
<ide>
<ide> Texture.call( this, null );
<ide>
<del> this.image = { data: data, width: width, height: height, depth: depth };
<add> this.image = { data: data || null, width: width || 1, height: height || 1, depth: depth || 1 };
<ide>
<ide> this.magFilter = NearestFilter;
<ide> this.minFilter = NearestFilter;
<ide><path>src/textures/DataTexture3D.js
<ide> function DataTexture3D( data, width, height, depth ) {
<ide>
<ide> Texture.call( this, null );
<ide>
<del> this.image = { data: data, width: width, height: height, depth: depth };
<add> this.image = { data: data || null, width: width || 1, height: height || 1, depth: depth || 1 };
<ide>
<ide> this.magFilter = NearestFilter;
<ide> this.minFilter = NearestFilter; | 2 |
Python | Python | fix softlayer tests | 8a35031a8f51b7179267b47f530e982f6f60db58 | <ide><path>test/compute/test_softlayer.py
<ide> def test_list_sizes(self):
<ide> class SoftLayerMockHttp(MockHttp):
<ide> fixtures = ComputeFileFixtures('softlayer')
<ide>
<del> def _xmlrpc_v3_SoftLayer_Account_getVirtualGuests(
<add> def _xmlrpc_v3__SoftLayer_Account_getVirtualGuests(
<ide> self, method, url, body, headers):
<ide>
<ide> body = self.fixtures.load('v3_SoftLayer_Account_getVirtualGuests.xml')
<ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK])
<ide>
<del> def _xmlrpc_v3_SoftLayer_Location_Datacenter_getDatacenters(
<add> def _xmlrpc_v3__SoftLayer_Location_Datacenter_getDatacenters(
<ide> self, method, url, body, headers):
<ide>
<ide> body = self.fixtures.load( | 1 |
Python | Python | add todo in notes | 9115c3ba0a7f2612f5a1ac550d25cc565fb86814 | <ide><path>spacy/_matcher2_notes.py
<ide> def transition(state, token, matches, nexts):
<ide> start = token.i
<ide> if is_match:
<ide> matches.append((pattern, start, token.i+1))
<del> if keep_state:
<del> nexts.append((pattern, i, start))
<ide> if advance_state:
<ide> nexts.append((pattern, i+1, start))
<add> if keep_state:
<add> # TODO: This needs to be zero-width :(.
<add> nexts.append((pattern, i, start))
<ide> return (matches, nexts)
<ide>
<ide>
<ide> def get_action(state, token):
<ide> elif is_match:
<ide> return '011'
<ide> else:
<del> return '010'
<add> return '001'
<ide> else:
<ide> print(operator, is_match, is_final)
<ide> raise ValueError
<ide> def test_find_matches_greedy():
<ide> assert matches == [(patterns[0], 0, 1), (patterns[0], 0, 2), (patterns[0], 1, 2)]
<ide>
<ide> def test_find_matches_non_greedy():
<del> patterns = [[{'spec': 'a', 'op': '0+'}, {'spec': 'b'}]]
<add> patterns = [[{'spec': 'a', 'op': '0+'}, {'spec': 'b', "op": "1"}]]
<ide> doc = Doc(Vocab(), words=['b'])
<ide> matches = find_matches(patterns, doc)
<ide> assert matches == [(patterns[0], 0, 1)] | 1 |
Ruby | Ruby | remove x11 doctor check | bbcbbcdaa1552ae3c5203c760c2efb7b7137b41c | <ide><path>Library/Homebrew/cmd/doctor.rb
<ide> def check_for_stray_las
<ide> s
<ide> end
<ide>
<del>def check_for_x11
<del> unless MacOS::XQuartz.installed? then <<-EOS.undent
<del> X11 is not installed.
<del> You don't have X11 installed as part of your OS X installation.
<del> This is not required for all formulae, but is expected by some.
<del> You can download the latest version of XQuartz from:
<del> https://xquartz.macosforge.org
<del> EOS
<del> end
<del>end
<del>
<ide> def check_for_other_package_managers
<ide> if macports_or_fink_installed?
<ide> <<-EOS.undent | 1 |
PHP | PHP | add @link to file/folder properties | 53f7a716ecee064acb7335fd2bfd3d45d15182a1 | <ide><path>lib/Cake/Utility/File.php
<ide> class File {
<ide> * Folder object of the File
<ide> *
<ide> * @var Folder
<add> * @link http://book.cakephp.org/2.0/en/core-utility-libraries/file-folder.html#File::$Folder
<ide> */
<ide> public $Folder = null;
<ide>
<ide> /**
<ide> * Filename
<ide> *
<ide> * @var string
<add> * http://book.cakephp.org/2.0/en/core-utility-libraries/file-folder.html#File::$name
<ide> */
<ide> public $name = null;
<ide>
<ide> /**
<ide> * File info
<ide> *
<del> * @var string
<add> * @var array
<add> * http://book.cakephp.org/2.0/en/core-utility-libraries/file-folder.html#File::$info
<ide> */
<ide> public $info = array();
<ide>
<ide> /**
<ide> * Holds the file handler resource if the file is opened
<ide> *
<ide> * @var resource
<add> * http://book.cakephp.org/2.0/en/core-utility-libraries/file-folder.html#File::$handle
<ide> */
<ide> public $handle = null;
<ide>
<ide> /**
<ide> * Enable locking for file reading and writing
<ide> *
<ide> * @var boolean
<add> * http://book.cakephp.org/2.0/en/core-utility-libraries/file-folder.html#File::$lock
<ide> */
<ide> public $lock = null;
<ide>
<ide> class File {
<ide> * Current file's absolute path
<ide> *
<ide> * @var mixed null
<add> * http://book.cakephp.org/2.0/en/core-utility-libraries/file-folder.html#File::$path
<ide> */
<ide> public $path = null;
<ide>
<ide><path>lib/Cake/Utility/Folder.php
<ide> class Folder {
<ide> * Path to Folder.
<ide> *
<ide> * @var string
<add> * @link http://book.cakephp.org/2.0/en/core-utility-libraries/file-folder.html#Folder::$path
<ide> */
<ide> public $path = null;
<ide>
<ide> class Folder {
<ide> * should be sorted by name.
<ide> *
<ide> * @var boolean
<add> * @link http://book.cakephp.org/2.0/en/core-utility-libraries/file-folder.html#Folder::$sort
<ide> */
<ide> public $sort = false;
<ide>
<ide> /**
<ide> * Mode to be used on create. Does nothing on windows platforms.
<ide> *
<ide> * @var integer
<add> * http://book.cakephp.org/2.0/en/core-utility-libraries/file-folder.html#Folder::$mode
<ide> */
<ide> public $mode = 0755;
<ide> | 2 |
Python | Python | add another test for deployment | 50af0714c7bce46df04051af18d6c1ccd6e6a085 | <ide><path>test/compute/test_deployment.py
<ide> import unittest
<ide>
<ide> from libcloud.compute.deployment import MultiStepDeployment, Deployment
<add>from libcloud.compute.deployment import SSHKeyDeployment
<ide> from libcloud.compute.base import Node
<ide> from libcloud.compute.types import NodeState
<add>from libcloud.compute.ssh import BaseSSHClient
<ide> from libcloud.compute.drivers.ec2 import EC2NodeDriver
<ide>
<ide> class MockDeployment(Deployment):
<ide> def run(self, node, client):
<ide> return node
<ide>
<add>class MockClient(BaseSSHClient):
<add> def put(self, file, contents):
<add> return contents
<add>
<ide> class DeploymentTests(unittest.TestCase):
<ide>
<add> def setUp(self):
<add> self.node = Node(id=1, name='test', state=NodeState.RUNNING,
<add> public_ip=['1.2.3.4'], private_ip='1.2.3.5',
<add> driver=EC2NodeDriver)
<add>
<ide> def test_multi_step_deployment(self):
<ide> msd = MultiStepDeployment()
<ide> self.assertEqual(len(msd.steps), 0)
<ide>
<ide> msd.add(MockDeployment())
<ide> self.assertEqual(len(msd.steps), 1)
<ide>
<del> node = Node(id=1, name='test', state=NodeState.RUNNING,
<del> public_ip=['1.2.3.4'], private_ip='1.2.3.5',
<del> driver=EC2NodeDriver)
<del> self.assertEqual(node, msd.run(node=node, client=None))
<add> self.assertEqual(self.node, msd.run(node=self.node, client=None))
<add>
<add> def test_ssh_key_deployment(self):
<add> sshd = SSHKeyDeployment(key='1234')
<add>
<add> self.assertEqual(self.node, sshd.run(node=self.node,
<add> client=MockClient(hostname='localhost')))
<ide>
<ide> if __name__ == '__main__':
<ide> sys.exit(unittest.main()) | 1 |
Python | Python | fix vectorize to handle scalar return values | e328ecf10f570df8900438ec9e727b3af68c7f84 | <ide><path>numpy/lib/function_base.py
<ide> def __call__(self, *args):
<ide> self.lastcallargs = nargs
<ide>
<ide> if self.nout == 1:
<del> return self.ufunc(*args).astype(self.otypes[0])
<add> ret = self.ufunc(*args)
<add> c = self.otypes[0]
<add> try:
<add> return ret.astype(c)
<add> except AttributeError: # scalar-case
<add> return array(ret).astype(c)
<ide> else:
<del> return tuple([x.astype(c) for x, c in zip(self.ufunc(*args), self.otypes)])
<add> ret = []
<add> for x, c in zip(self.ufunc(*args), self.otypes):
<add> try:
<add> ret.append(x.astype(c))
<add> except AttributeError:
<add> ret.append(array(x).astype(c))
<add> return tuple(ret)
<ide>
<ide> def cov(m,y=None, rowvar=1, bias=0):
<ide> """Estimate the covariance matrix. | 1 |
Javascript | Javascript | handle more cases with an regexp | bd35396503bd39f89535c67c41d9a3b71b45d173 | <ide><path>lib/config/defaults.js
<ide> const applyOutputDefaults = (
<ide> "type" in library
<ide> ? library.name
<ide> : /** @type {LibraryName=} */ (library);
<del> const excludePlaceholders = ["[name]"];
<ide> if (Array.isArray(libraryName)) {
<del> return libraryName
<del> .filter(item => !excludePlaceholders.includes(item))
<del> .join(".");
<add> return libraryName.join(".");
<ide> } else if (typeof libraryName === "object") {
<ide> return getLibraryName(libraryName.root);
<ide> } else if (typeof libraryName === "string") {
<ide> const applyOutputDefaults = (
<ide> };
<ide>
<ide> F(output, "uniqueName", () => {
<del> const libraryName = getLibraryName(output.library);
<add> const libraryName = getLibraryName(output.library).replace(
<add> /^\[(\\*[\w:]+\\*)\](\.)|(\.)\[(\\*[\w:]+\\*)\](?=\.|$)|\[(\\*[\w:]+\\*)\]/g,
<add> (m, a, d1, d2, b, c) => {
<add> const content = a || b || c;
<add> return content.startsWith("\\") && content.endsWith("\\")
<add> ? `${d2 || ""}[${content.slice(1, -1)}]${d1 || ""}`
<add> : "";
<add> }
<add> );
<ide> if (libraryName) return libraryName;
<ide> const pkgPath = path.resolve(context, "package.json");
<ide> try {
<ide><path>test/Defaults.unittest.js
<ide> describe("Defaults", () => {
<ide> },
<ide> e =>
<ide> e.toMatchInlineSnapshot(`
<del> - Expected
<del> + Received
<add> - Expected
<add> + Received
<ide>
<del>
<del> - "chunkLoadingGlobal": "webpackChunkwebpack",
<del> + "chunkLoadingGlobal": "webpackChunkmyLib",
<del>
<del> - "devtoolNamespace": "webpack",
<del> + "devtoolNamespace": "myLib",
<del>
<del> - "enabledLibraryTypes": Array [],
<del> + "enabledLibraryTypes": Array [
<del> + "var",
<del> + ],
<del>
<del> - "hotUpdateGlobal": "webpackHotUpdatewebpack",
<del> + "hotUpdateGlobal": "webpackHotUpdatemyLib",
<del>
<del> - "library": undefined,
<del> + "library": Object {
<del> + "auxiliaryComment": undefined,
<del> + "export": undefined,
<del> + "name": Array [
<del> + "myLib",
<del> + "[name]",
<del> + ],
<del> + "type": "var",
<del> + "umdNamedDefine": undefined,
<del> + },
<del>
<del> - "uniqueName": "webpack",
<del> + "uniqueName": "myLib",
<del> `)
<add>
<add> - "chunkLoadingGlobal": "webpackChunkwebpack",
<add> + "chunkLoadingGlobal": "webpackChunkmyLib",
<add>
<add> - "devtoolNamespace": "webpack",
<add> + "devtoolNamespace": "myLib",
<add>
<add> - "enabledLibraryTypes": Array [],
<add> + "enabledLibraryTypes": Array [
<add> + "var",
<add> + ],
<add>
<add> - "hotUpdateGlobal": "webpackHotUpdatewebpack",
<add> + "hotUpdateGlobal": "webpackHotUpdatemyLib",
<add>
<add> - "library": undefined,
<add> + "library": Object {
<add> + "auxiliaryComment": undefined,
<add> + "export": undefined,
<add> + "name": Array [
<add> + "myLib",
<add> + "[name]",
<add> + ],
<add> + "type": "var",
<add> + "umdNamedDefine": undefined,
<add> + },
<add>
<add> - "uniqueName": "webpack",
<add> + "uniqueName": "myLib",
<add> `)
<ide> );
<ide> test(
<ide> "library.name contains [name] placeholder",
<ide> {
<ide> output: {
<ide> library: {
<del> name: ["myLib", "[name]"],
<add> name: ["my[name]Lib", "[name]", "lib"],
<ide> type: "var"
<ide> }
<ide> }
<ide> },
<ide> e =>
<ide> e.toMatchInlineSnapshot(`
<del> - Expected
<del> + Received
<add> - Expected
<add> + Received
<ide>
<del>
<del> - "chunkLoadingGlobal": "webpackChunkwebpack",
<del> + "chunkLoadingGlobal": "webpackChunkmyLib",
<del>
<del> - "devtoolNamespace": "webpack",
<del> + "devtoolNamespace": "myLib",
<del>
<del> - "enabledLibraryTypes": Array [],
<del> + "enabledLibraryTypes": Array [
<del> + "var",
<del> + ],
<del>
<del> - "hotUpdateGlobal": "webpackHotUpdatewebpack",
<del> + "hotUpdateGlobal": "webpackHotUpdatemyLib",
<del>
<del> - "library": undefined,
<del> + "library": Object {
<del> + "auxiliaryComment": undefined,
<del> + "export": undefined,
<del> + "name": Array [
<del> + "myLib",
<del> + "[name]",
<del> + ],
<del> + "type": "var",
<del> + "umdNamedDefine": undefined,
<del> + },
<del>
<del> - "uniqueName": "webpack",
<del> + "uniqueName": "myLib",
<del> `)
<add>
<add> - "chunkLoadingGlobal": "webpackChunkwebpack",
<add> + "chunkLoadingGlobal": "webpackChunkmyLib_lib",
<add>
<add> - "devtoolNamespace": "webpack",
<add> + "devtoolNamespace": "myLib.lib",
<add>
<add> - "enabledLibraryTypes": Array [],
<add> + "enabledLibraryTypes": Array [
<add> + "var",
<add> + ],
<add>
<add> - "hotUpdateGlobal": "webpackHotUpdatewebpack",
<add> + "hotUpdateGlobal": "webpackHotUpdatemyLib_lib",
<add>
<add> - "library": undefined,
<add> + "library": Object {
<add> + "auxiliaryComment": undefined,
<add> + "export": undefined,
<add> + "name": Array [
<add> + "my[name]Lib",
<add> + "[name]",
<add> + "lib",
<add> + ],
<add> + "type": "var",
<add> + "umdNamedDefine": undefined,
<add> + },
<add>
<add> - "uniqueName": "webpack",
<add> + "uniqueName": "myLib.lib",
<add> `)
<ide> );
<ide> test(
<ide> "library.name.root contains [name] placeholder",
<ide> {
<ide> output: {
<ide> library: {
<ide> name: {
<del> root: ["myLib", "[name]"]
<add> root: ["[name]", "myLib"]
<ide> },
<ide> type: "var"
<ide> }
<ide> }
<ide> },
<ide> e =>
<ide> e.toMatchInlineSnapshot(`
<del> - Expected
<del> + Received
<add> - Expected
<add> + Received
<ide>
<del>
<del> - "chunkLoadingGlobal": "webpackChunkwebpack",
<del> + "chunkLoadingGlobal": "webpackChunkmyLib",
<del>
<del> - "devtoolNamespace": "webpack",
<del> + "devtoolNamespace": "myLib",
<del>
<del> - "enabledLibraryTypes": Array [],
<del> + "enabledLibraryTypes": Array [
<del> + "var",
<del> + ],
<del>
<del> - "hotUpdateGlobal": "webpackHotUpdatewebpack",
<del> + "hotUpdateGlobal": "webpackHotUpdatemyLib",
<del>
<del> - "library": undefined,
<del> + "library": Object {
<del> + "auxiliaryComment": undefined,
<del> + "export": undefined,
<del> + "name": Object {
<del> + "root": Array [
<del> + "myLib",
<del> + "[name]",
<del> + ],
<del> + },
<del> + "type": "var",
<del> + "umdNamedDefine": undefined,
<del> + },
<del>
<del> - "uniqueName": "webpack",
<del> + "uniqueName": "myLib",
<del> `)
<add>
<add> - "chunkLoadingGlobal": "webpackChunkwebpack",
<add> + "chunkLoadingGlobal": "webpackChunkmyLib",
<add>
<add> - "devtoolNamespace": "webpack",
<add> + "devtoolNamespace": "myLib",
<add>
<add> - "enabledLibraryTypes": Array [],
<add> + "enabledLibraryTypes": Array [
<add> + "var",
<add> + ],
<add>
<add> - "hotUpdateGlobal": "webpackHotUpdatewebpack",
<add> + "hotUpdateGlobal": "webpackHotUpdatemyLib",
<add>
<add> - "library": undefined,
<add> + "library": Object {
<add> + "auxiliaryComment": undefined,
<add> + "export": undefined,
<add> + "name": Object {
<add> + "root": Array [
<add> + "[name]",
<add> + "myLib",
<add> + ],
<add> + },
<add> + "type": "var",
<add> + "umdNamedDefine": undefined,
<add> + },
<add>
<add> - "uniqueName": "webpack",
<add> + "uniqueName": "myLib",
<add> `)
<add> );
<add> test(
<add> "library.name.root contains escaped placeholder",
<add> {
<add> output: {
<add> library: {
<add> name: {
<add> root: ["[\\name\\]", "my[\\name\\]Lib[name]", "[\\name\\]"]
<add> },
<add> type: "var"
<add> }
<add> }
<add> },
<add> e =>
<add> e.toMatchInlineSnapshot(`
<add> - Expected
<add> + Received
<add>
<add>
<add> - "chunkLoadingGlobal": "webpackChunkwebpack",
<add> + "chunkLoadingGlobal": "webpackChunk_name_my_name_Lib_name_",
<add>
<add> - "devtoolNamespace": "webpack",
<add> + "devtoolNamespace": "[name].my[name]Lib.[name]",
<add>
<add> - "enabledLibraryTypes": Array [],
<add> + "enabledLibraryTypes": Array [
<add> + "var",
<add> + ],
<add>
<add> - "hotUpdateGlobal": "webpackHotUpdatewebpack",
<add> + "hotUpdateGlobal": "webpackHotUpdate_name_my_name_Lib_name_",
<add>
<add> - "library": undefined,
<add> + "library": Object {
<add> + "auxiliaryComment": undefined,
<add> + "export": undefined,
<add> + "name": Object {
<add> + "root": Array [
<add> + "[\\\\name\\\\]",
<add> + "my[\\\\name\\\\]Lib[name]",
<add> + "[\\\\name\\\\]",
<add> + ],
<add> + },
<add> + "type": "var",
<add> + "umdNamedDefine": undefined,
<add> + },
<add>
<add> - "uniqueName": "webpack",
<add> + "uniqueName": "[name].my[name]Lib.[name]",
<add> `)
<ide> );
<ide> test("target node", { target: "node" }, e =>
<ide> e.toMatchInlineSnapshot(` | 2 |
Ruby | Ruby | fix build_head? call | cd40af2c5842e83b8dde68dc16ef4e0985b51f52 | <ide><path>Library/Homebrew/extend/ARGV.rb
<ide> def env
<ide> def collect_build_flags
<ide> build_flags = []
<ide>
<del> build_flags << "--HEAD" if build_head?
<add> build_flags << "--HEAD" if include?("--HEAD")
<ide> build_flags << "--universal" if build_universal?
<ide> build_flags << "--build-bottle" if build_bottle?
<ide> build_flags << "--build-from-source" if build_from_source? | 1 |
Java | Java | disallow mounting virtual nodes to views | b10474c33320f9ee662192333e9cb0fc42ead349 | <ide><path>ReactAndroid/src/main/java/com/facebook/react/flat/FlatShadowNode.java
<ide> protected final void setNodeRegion(NodeRegion nodeRegion) {
<ide> }
<ide>
<ide> /* package */ final void forceMountToView() {
<add> if (isVirtual()) {
<add> return;
<add> }
<add>
<ide> if (mDrawView == null) {
<ide> mDrawView = DrawView.INSTANCE;
<ide> if (getParent() != null) { | 1 |
Go | Go | fix stdout and stderr in api client | 533bd82e41fee352962cb5ae0a49b9edbdebc25e | <ide><path>api/client/network/remove.go
<ide> func runRemove(dockerCli *client.DockerCli, networks []string) error {
<ide> status = 1
<ide> continue
<ide> }
<del> fmt.Fprintf(dockerCli.Err(), "%s\n", name)
<add> fmt.Fprintf(dockerCli.Out(), "%s\n", name)
<ide> }
<ide>
<ide> if status != 0 {
<ide><path>api/client/registry/logout.go
<ide> func runLogout(dockerCli *client.DockerCli, serverAddress string) error {
<ide>
<ide> fmt.Fprintf(dockerCli.Out(), "Remove login credentials for %s\n", serverAddress)
<ide> if err := client.EraseCredentials(dockerCli.ConfigFile(), serverAddress); err != nil {
<del> fmt.Fprintf(dockerCli.Out(), "WARNING: could not erase credentials: %v\n", err)
<add> fmt.Fprintf(dockerCli.Err(), "WARNING: could not erase credentials: %v\n", err)
<ide> }
<ide>
<ide> return nil
<ide><path>api/client/swarm/init.go
<ide> func runInit(dockerCli *client.DockerCli, flags *pflag.FlagSet, opts initOptions
<ide> if err != nil {
<ide> return err
<ide> }
<del> fmt.Printf("Swarm initialized: current node (%s) is now a manager.\n", nodeID)
<add>
<add> fmt.Fprintf(dockerCli.Out(), "Swarm initialized: current node (%s) is now a manager.\n", nodeID)
<add>
<ide> return nil
<ide> }
<ide><path>api/client/swarm/update.go
<ide> func runUpdate(dockerCli *client.DockerCli, flags *pflag.FlagSet, opts swarmOpti
<ide> return err
<ide> }
<ide>
<del> fmt.Println("Swarm updated.")
<add> fmt.Fprintln(dockerCli.Out(), "Swarm updated.")
<add>
<ide> return nil
<ide> }
<ide>
<ide><path>api/client/volume/remove.go
<ide> func runRemove(dockerCli *client.DockerCli, volumes []string) error {
<ide> status = 1
<ide> continue
<ide> }
<del> fmt.Fprintf(dockerCli.Err(), "%s\n", name)
<add> fmt.Fprintf(dockerCli.Out(), "%s\n", name)
<ide> }
<ide>
<ide> if status != 0 { | 5 |
Text | Text | fix one docs typo | 29581a351fe44917266998540ee6fc4d56503f14 | <ide><path>docs/GestureResponderSystem.md
<ide> If the view is responding, the following handlers can be called:
<ide> + `pageX` - The X position of the touch, relative to the root element
<ide> + `pageY` - The Y position of the touch, relative to the root element
<ide> + `target` - The node id of the element receiving the touch event
<del> + `timestamp` - A time identifier for the touch, useful for velocity calculation
<add> + `timeStamp` - A time identifier for the touch, useful for velocity calculation
<ide> + `touches` - Array of all current touches on the screen
<ide>
<ide> ### Capture ShouldSet Handlers | 1 |
Javascript | Javascript | resolve process.setgid() error on ubuntu | cc8a33edbc91d5c7c2cadd8f51805b3937f25ead | <ide><path>test/parallel/test-process-uid-gid.js
<ide> if (process.getuid() !== 0) {
<ide>
<ide> // If we are running as super user...
<ide> const oldgid = process.getgid();
<del>process.setgid('nobody');
<add>try {
<add> process.setgid('nobody');
<add>} catch (err) {
<add> if (err.message !== 'setgid group id does not exist') {
<add> throw err;
<add> }
<add> process.setgid('nogroup');
<add>}
<ide> const newgid = process.getgid();
<ide> assert.notStrictEqual(newgid, oldgid);
<ide> | 1 |
Java | Java | fix uricomponents.equals() method | 5b7969e726edf9080e999730f53f6d449172279d | <ide><path>spring-web/src/main/java/org/springframework/web/util/HierarchicalUriComponents.java
<ide> * Extension of {@link UriComponents} for hierarchical URIs.
<ide> *
<ide> * @author Arjen Poutsma
<add> * @author Phillip Webb
<ide> * @since 3.1.3
<ide> * @see <a href="http://tools.ietf.org/html/rfc3986#section-1.2.3">Hierarchical URIs</a>
<ide> */
<ide> public boolean equals(Object obj) {
<ide> return false;
<ide> }
<ide> HierarchicalUriComponents other = (HierarchicalUriComponents) obj;
<del> if (ObjectUtils.nullSafeEquals(getScheme(), other.getScheme())) {
<del> return false;
<del> }
<del> if (ObjectUtils.nullSafeEquals(getUserInfo(), other.getUserInfo())) {
<del> return false;
<del> }
<del> if (ObjectUtils.nullSafeEquals(getHost(), other.getHost())) {
<del> return false;
<del> }
<del> if (this.port != other.port) {
<del> return false;
<del> }
<del> if (!this.path.equals(other.path)) {
<del> return false;
<del> }
<del> if (!this.queryParams.equals(other.queryParams)) {
<del> return false;
<del> }
<del> if (ObjectUtils.nullSafeEquals(getFragment(), other.getFragment())) {
<del> return false;
<del> }
<del> return true;
<add> boolean rtn = true;
<add> rtn &= ObjectUtils.nullSafeEquals(getScheme(), other.getScheme());
<add> rtn &= ObjectUtils.nullSafeEquals(getUserInfo(), other.getUserInfo());
<add> rtn &= ObjectUtils.nullSafeEquals(getHost(), other.getHost());
<add> rtn &= getPort() == other.getPort();
<add> rtn &= this.path.equals(other.path);
<add> rtn &= this.queryParams.equals(other.queryParams);
<add> rtn &= ObjectUtils.nullSafeEquals(getFragment(), other.getFragment());
<add> return rtn;
<ide> }
<ide>
<ide> @Override
<ide><path>spring-web/src/main/java/org/springframework/web/util/OpaqueUriComponents.java
<ide> /*
<del> * Copyright 2002-2012 the original author or authors.
<add> * Copyright 2002-2013 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> * Extension of {@link UriComponents} for opaque URIs.
<ide> *
<ide> * @author Arjen Poutsma
<add> * @author Phillip Webb
<ide> * @since 3.2
<ide> * @see <a href="http://tools.ietf.org/html/rfc3986#section-1.2.3">Hierarchical vs Opaque URIs</a>
<ide> */
<ide> public boolean equals(Object obj) {
<ide> }
<ide>
<ide> OpaqueUriComponents other = (OpaqueUriComponents) obj;
<del>
<del> if (ObjectUtils.nullSafeEquals(getScheme(), other.getScheme())) {
<del> return false;
<del> }
<del> if (ObjectUtils.nullSafeEquals(this.ssp, other.ssp)) {
<del> return false;
<del> }
<del> if (ObjectUtils.nullSafeEquals(getFragment(), other.getFragment())) {
<del> return false;
<del> }
<del>
<del> return true;
<add> boolean rtn = true;
<add> rtn &= ObjectUtils.nullSafeEquals(getScheme(), other.getScheme());
<add> rtn &= ObjectUtils.nullSafeEquals(this.ssp, other.ssp);
<add> rtn &= ObjectUtils.nullSafeEquals(getFragment(), other.getFragment());
<add> return rtn;
<ide> }
<ide>
<ide> @Override
<ide><path>spring-web/src/test/java/org/springframework/web/util/UriComponentsTests.java
<ide> import org.junit.Test;
<ide>
<ide> import static org.hamcrest.Matchers.equalTo;
<add>import static org.hamcrest.Matchers.instanceOf;
<add>import static org.hamcrest.Matchers.not;
<ide> import static org.junit.Assert.*;
<ide>
<del>/** @author Arjen Poutsma */
<add>/**
<add> * @author Arjen Poutsma
<add> * @author Phillip Webb
<add> */
<ide> public class UriComponentsTests {
<ide>
<ide> @Test
<ide> public void serializable() throws Exception {
<ide> assertThat(uriComponents.toString(), equalTo(readObject.toString()));
<ide> }
<ide>
<add> @Test
<add> public void equalsHierarchicalUriComponents() throws Exception {
<add> UriComponents uriComponents1 = UriComponentsBuilder.fromUriString("http://example.com").path("/{foo}").query("bar={baz}").build();
<add> UriComponents uriComponents2 = UriComponentsBuilder.fromUriString("http://example.com").path("/{foo}").query("bar={baz}").build();
<add> UriComponents uriComponents3 = UriComponentsBuilder.fromUriString("http://example.com").path("/{foo}").query("bin={baz}").build();
<add> assertThat(uriComponents1, instanceOf(HierarchicalUriComponents.class));
<add> assertThat(uriComponents1, equalTo(uriComponents1));
<add> assertThat(uriComponents1, equalTo(uriComponents2));
<add> assertThat(uriComponents1, not(equalTo(uriComponents3)));
<add> }
<add>
<add> @Test
<add> public void equalsOpaqueUriComponents() throws Exception {
<add> UriComponents uriComponents1 = UriComponentsBuilder.fromUriString("http:example.com/foo/bar").build();
<add> UriComponents uriComponents2 = UriComponentsBuilder.fromUriString("http:example.com/foo/bar").build();
<add> UriComponents uriComponents3 = UriComponentsBuilder.fromUriString("http:example.com/foo/bin").build();
<add> assertThat(uriComponents1, instanceOf(OpaqueUriComponents.class));
<add> assertThat(uriComponents1, equalTo(uriComponents1));
<add> assertThat(uriComponents1, equalTo(uriComponents2));
<add> assertThat(uriComponents1, not(equalTo(uriComponents3)));
<add> }
<add>
<ide> } | 3 |
Ruby | Ruby | add runtime dependency on libtool | e33c01aab55cf7522596988b09532e941bd3044c | <ide><path>Library/Homebrew/cmd/audit.rb
<ide> def audit_deps
<ide> when *BUILD_TIME_DEPS
<ide> next if dep.build?
<ide> next if dep.name == 'autoconf' && f.name =~ /automake/
<del> next if dep.name == 'libtool' && %w{imagemagick libgphoto2 libp11}.any? { |n| f.name == n }
<add> next if dep.name == 'libtool' && %w{imagemagick libgphoto2 libp11 libextractor}.any? { |n| f.name == n }
<ide> next if dep.name =~ /autoconf|pkg-config/ && f.name == 'ruby-build'
<ide>
<ide> problem %{#{dep} dependency should be "depends_on '#{dep}' => :build"} | 1 |
Text | Text | add missing fat arrow | 121f6c2801c3f20be0c66c9e209f5d57044f4839 | <ide><path>readme.md
<ide> Phases can be imported from `next/constants`:
<ide>
<ide> ```js
<ide> const {PHASE_DEVELOPMENT_SERVER} = require('next/constants')
<del>module.exports = (phase, {defaultConfig}){
<add>module.exports = (phase, {defaultConfig}) => {
<ide> if(phase === PHASE_DEVELOPMENT_SERVER) {
<ide> return {
<ide> /* development only config options here */ | 1 |
Go | Go | use poll.waiton in authz_plugin_test.go | 0492b0997b2fc739a9a6fe6831145297d8149e55 | <ide><path>integration/plugin/authz/authz_plugin_test.go
<ide> import (
<ide> "github.com/docker/docker/pkg/archive"
<ide> "github.com/docker/docker/pkg/authorization"
<ide> "gotest.tools/assert"
<add> "gotest.tools/poll"
<ide> "gotest.tools/skip"
<ide> )
<ide>
<ide> func TestAuthZPluginAllowEventStream(t *testing.T) {
<ide>
<ide> // Create a container and wait for the creation events
<ide> cID := container.Run(t, ctx, c)
<del>
<del> for i := 0; i < 100; i++ {
<del> c, err := c.ContainerInspect(ctx, cID)
<del> assert.NilError(t, err)
<del> if c.State.Running {
<del> break
<del> }
<del> if i == 99 {
<del> t.Fatal("Container didn't run within 10s")
<del> }
<del> time.Sleep(100 * time.Millisecond)
<del> }
<add> poll.WaitOn(t, container.IsInState(ctx, c, cID, "running"))
<ide>
<ide> created := false
<ide> started := false | 1 |
Python | Python | remove debug statement | aff5117f4695666f1fe9400f159e2a137f806544 | <ide><path>src/transformers/tokenization_utils_base.py
<ide> def from_pretrained(cls, pretrained_model_name_or_path: Union[str, os.PathLike],
<ide> resolved_vocab_files = {}
<ide> unresolved_files = []
<ide> for file_id, file_path in vocab_files.items():
<del> print(file_id, file_path)
<ide> if file_path is None:
<ide> resolved_vocab_files[file_id] = None
<ide> else: | 1 |
PHP | PHP | rewrited the send method to use cakeemail | 5e56f7651000b636e9f60c5246abe087702ce80f | <ide><path>lib/Cake/Controller/Component/EmailComponent.php
<ide>
<ide> App::uses('Component', 'Controller');
<ide> App::uses('Multibyte', 'I18n');
<add>App::uses('CakeEmail', 'Network');
<ide>
<ide> /**
<ide> * EmailComponent
<ide> public function startup($controller) {}
<ide> * @return boolean Success
<ide> */
<ide> public function send($content = null, $template = null, $layout = null) {
<del> $this->_createHeader();
<add> $lib = new CakeEmail();
<add> $lib->charset = $this->charset;
<ide>
<del> if ($template) {
<del> $this->template = $template;
<add> $lib->from($this->_formatAddresses((array)$this->from));
<add> if (!empty($this->to)) {
<add> $lib->to($this->_formatAddresses((array)$this->to));
<ide> }
<del>
<del> if ($layout) {
<del> $this->layout = $layout;
<add> if (!empty($this->cc)) {
<add> $lib->cc($this->_formatAddresses((array)$this->cc));
<ide> }
<del>
<del> if (is_array($content)) {
<del> $content = implode("\n", $content) . "\n";
<add> if (!empty($this->bcc)) {
<add> $lib->bcc($this->_formatAddresses((array)$this->bcc));
<ide> }
<del>
<del> $this->htmlMessage = $this->textMessage = null;
<del> if ($content) {
<del> if ($this->sendAs === 'html') {
<del> $this->htmlMessage = $content;
<del> } elseif ($this->sendAs === 'text') {
<del> $this->textMessage = $content;
<del> } else {
<del> $this->htmlMessage = $this->textMessage = $content;
<del> }
<add> if (!empty($this->replyTo)) {
<add> $lib->replyTo($this->_formatAddresses((array)$this->replyTo));
<ide> }
<del>
<del> if ($this->sendAs === 'text') {
<del> $message = $this->_wrap($content);
<del> } else {
<del> $message = $this->_wrap($content, 998);
<add> if (!empty($this->return)) {
<add> $lib->returnPath($this->_formatAddresses((array)$this->return));
<add> }
<add> if (!empty($readReceipt)) {
<add> $lib->readReceipt($this->_formatAddresses((array)$this->readReceipt));
<ide> }
<ide>
<del> if ($this->template === null) {
<del> $message = $this->_formatMessage($message);
<del> } else {
<del> $message = $this->_render($message);
<add> $lib->subject($this->subject)->messageID($this->messageId);
<add>
<add> $headers = array();
<add> foreach ($this->headers as $key => $value) {
<add> $headers['X-' . $key] = $value;
<ide> }
<add> if ($this->date != false) {
<add> $headers['Date'] = $this->date;
<add> }
<add> $lib->setHeaders($headers);
<ide>
<del> $message[] = '';
<del> $this->_message = $message;
<add> if ($template) {
<add> $this->template = $template;
<add> }
<add> if ($layout) {
<add> $this->layout = $layout;
<add> }
<add> $lib->layout($this->layout, $this->template)->emailFormat($this->sendAs);
<ide>
<ide> if (!empty($this->attachments)) {
<del> $this->_attachFiles();
<add> $lib->attachment($this->_formatAttachFiles());
<ide> }
<ide>
<del> if (!is_null($this->_boundary)) {
<del> $this->_message[] = '';
<del> $this->_message[] = '--' . $this->_boundary . '--';
<del> $this->_message[] = '';
<add> $transport = $lib->transport($this->delivery)->transportClass();
<add> if ($this->delivery === 'mail') {
<add> $transport->config(array('eol' => $this->lineFeed));
<add> } elseif ($this->delivery === 'smtp') {
<add> $transport->config($this->smtpOptions);
<ide> }
<ide>
<del>
<del> $_method = '_' . $this->delivery;
<del> $sent = $this->$_method();
<add> $sent = $lib->send($content);
<ide>
<ide> $this->_header = array();
<ide> $this->_message = array();
<ide> function _formatMessage($message) {
<ide> }
<ide>
<ide> /**
<del> * Attach files by adding file contents inside boundaries.
<add> * Format the attach array
<ide> *
<del> * @access private
<del> * @TODO: modify to use the core File class?
<add> * @return array
<ide> */
<del> function _attachFiles() {
<add> protected function _formatAttachFiles() {
<ide> $files = array();
<ide> foreach ($this->attachments as $filename => $attachment) {
<ide> $file = $this->_findFiles($attachment);
<ide> function _attachFiles() {
<ide> $files[$filename] = $file;
<ide> }
<ide> }
<del>
<del> foreach ($files as $filename => $file) {
<del> $handle = fopen($file, 'rb');
<del> $data = fread($handle, filesize($file));
<del> $data = chunk_split(base64_encode($data)) ;
<del> fclose($handle);
<del>
<del> $this->_message[] = '--' . $this->_boundary;
<del> $this->_message[] = 'Content-Type: application/octet-stream';
<del> $this->_message[] = 'Content-Transfer-Encoding: base64';
<del> $this->_message[] = 'Content-Disposition: attachment; filename="' . basename($filename) . '"';
<del> $this->_message[] = '';
<del> $this->_message[] = $data;
<del> $this->_message[] = '';
<del> }
<add> return $files;
<ide> }
<ide>
<ide> /**
<ide> function _formatAddress($string, $smtp = false) {
<ide> return $this->_strip($string);
<ide> }
<ide>
<add>/**
<add> * Format addresses to be an array with email as key and alias as value
<add> *
<add> * @param array $addresses
<add> * @return array
<add> */
<add> protected function _formatAddresses($addresses) {
<add> $formatted = array();
<add> foreach ($addresses as $address) {
<add> if (preg_match('/((.*))?\s?<(.+)>/', $address, $matches) && !empty($matches[2])) {
<add> $formatted[$this->_strip($matches[3])] = $this->_encode($matches[2]);
<add> } else {
<add> $address = $this->_strip($address);
<add> $formatted[$address] = $address;
<add> }
<add> }
<add> return $formatted;
<add> }
<add>
<ide> /**
<ide> * Remove certain elements (such as bcc:, to:, %0a) from given value.
<ide> * Helps prevent header injection / mainipulation on user content. | 1 |
PHP | PHP | add method 'hasfailed' to queue job contract | 2f01bd8862f8d65e49836a1039f668ee0aeb0e10 | <ide><path>src/Illuminate/Contracts/Queue/Job.php
<ide> public function isDeletedOrReleased();
<ide> */
<ide> public function attempts();
<ide>
<add> /**
<add> * Determine if the job has been marked as a failure.
<add> *
<add> * @return bool
<add> */
<add> public function hasFailed();
<add>
<ide> /**
<ide> * Mark the job as "failed".
<ide> *
<ide><path>tests/Queue/QueueWorkerTest.php
<ide> public function failed($e)
<ide> $this->failedWith = $e;
<ide> }
<ide>
<add> public function hasFailed()
<add> {
<add> return $this->failed;
<add> }
<add>
<ide> public function getName()
<ide> {
<ide> return 'WorkerFakeJob'; | 2 |
Text | Text | improve arabic translation | 5a4da8fbb2e3efbd928657103b10fd48204c91d9 | <ide><path>guide/arabic/react/fragments/index.md
<ide> ---
<ide> title: Fragments
<del>localeTitle: فتات
<add>localeTitle: الشظايا
<ide> ---
<del># فتات
<add># الشظايا Fragments
<ide>
<del>الأجزاء هي طريقة لعرض عناصر متعددة دون استخدام عنصر مجمّع. عند محاولة تقديم عناصر بدون علامة تضمين في JSX ، سترى رسالة الخطأ `Adjacent JSX elements must be wrapped in an enclosing tag` . وذلك لأنه عندما يقوم JSX بالانتقال ، فإنه ينشئ عناصر تحمل أسماء علاماتها المقابلة ، ولا يعرف اسم العلامة الذي يجب استخدامه إذا تم العثور على عناصر متعددة. في الماضي ، كان الحل المتكرر لهذا هو استخدام div diver لحل هذه المشكلة. ومع ذلك ، جلب الإصدار 16 من React إضافة `Fragment` ، مما يجعل هذا لم يعد ضروريًا.
<add>الشظايا هي طريقة لعرض عناصر متعددة دون استخدام عنصر محيط. عند محاولة تقديم عناصر بدون عنصر محيطة في JSX ، سترى رسالة الخطأ `Adjacent JSX elements must be wrapped in an enclosing tag` . وذلك لأنه عندما يقوم JSX بالتحويل ، فإنه ينشئ عناصر تحمل أسماء علاماتها المقابلة ، ولا يعرف اسم العلامة التي يجب استخدامها إذا تم العثور على عناصر متعددة. في الماضي ، كان الحل المتكرر لهذا هو استخدام div diver لحل هذه المشكلة. ومع ذلك ، جلب الإصدار 16 من React إضافة `Fragment` ، مما يجعل هذا ليس ضروريًا.
<ide>
<ide> تعمل `Fragment` جزءًا بدون إضافة أقسام غير ضرورية إلى DOM. يمكنك استخدامه مباشرة من استيراد React أو تفكيكه:
<ide>
<ide> localeTitle: فتات
<ide> #### معلومات اكثر:
<ide>
<ide> * [React.Fragment (الوثائق الرسمية)](https://reactjs.org/docs/react-api.html#reactfragment)
<del>* [React v16.2.0: تحسين الدعم للشظايا](https://reactjs.org/blog/2017/11/28/react-v16.2.0-fragment-support.html)
<ide>\ No newline at end of file
<add>* [React v16.2.0: تحسين الدعم للشظايا](https://reactjs.org/blog/2017/11/28/react-v16.2.0-fragment-support.html) | 1 |
PHP | PHP | fix fixture generation | 3a18a0e92f5c8117bd7bcb02a99c6d56ded1dfa6 | <ide><path>src/Shell/Task/TestTask.php
<ide> protected function _processModel($subject) {
<ide> $this->_addFixture($subject->alias());
<ide> foreach ($subject->associations()->keys() as $alias) {
<ide> $assoc = $subject->association($alias);
<del> $name = $assoc->target()->alias();
<add> $target = $assoc->target();
<add> $name = $target->alias();
<add>
<add> if (get_class($subject) === get_class($target)) {
<add> continue;
<add> }
<add>
<ide> if (!isset($this->_fixtures[$name])) {
<del> $this->_processModel($assoc->target());
<add> $this->_processModel($target);
<ide> }
<ide> if ($assoc->type() === Association::MANY_TO_MANY) {
<ide> $junction = $assoc->junction();
<ide><path>tests/TestCase/Shell/Task/TestTaskTest.php
<ide> use Cake\TestSuite\TestCase;
<ide> use TestApp\Controller\PostsController;
<ide> use TestApp\Model\Table\ArticlesTable;
<add>use TestApp\Model\Table\CategoryThreadsTable;
<ide>
<ide> /**
<ide> * TestTaskTest class
<ide> class TestTaskTest extends TestCase {
<ide> *
<ide> * @var string
<ide> */
<del> public $fixtures = ['core.article', 'core.author',
<del> 'core.comment', 'core.articles_tag', 'core.tag'];
<add> public $fixtures = [
<add> 'core.article',
<add> 'core.author',
<add> 'core.comment',
<add> 'core.articles_tag',
<add> 'core.tag',
<add> ];
<ide>
<ide> /**
<ide> * setUp method
<ide> public function testFixtureArrayGenerationFromModel() {
<ide> $this->assertEquals($expected, $result);
<ide> }
<ide>
<add>/**
<add> * test that the generation of fixtures works correctly.
<add> *
<add> * @return void
<add> */
<add> public function testFixtureArrayGenerationIgnoreSelfAssociation() {
<add> $subject = new CategoryThreadsTable();
<add> $result = $this->Task->generateFixtureList($subject);
<add> $expected = [
<add> 'app.category_thread',
<add> ];
<add> $this->assertEquals($expected, $result);
<add> }
<add>
<ide> /**
<ide> * test that the generation of fixtures works correctly.
<ide> * | 2 |
PHP | PHP | add hasargument and getargument | 6a7256bbb2aff963416fd0def8714233fe7ac44b | <ide><path>src/Console/Arguments.php
<ide> */
<ide> class Arguments
<ide> {
<add> /**
<add> * Positional argument name map
<add> *
<add> * @var array
<add> */
<add> protected $argNames;
<add>
<ide> /**
<ide> * Positional arguments.
<ide> *
<ide> class Arguments
<ide> *
<ide> * @param string[] $args Positional arguments
<ide> * @param array $options Named arguments
<add> * @param array $argNames Map of argument names and their indexes.
<ide> */
<del> public function __construct(array $args, array $options)
<add> public function __construct(array $args, array $options, array $argNames)
<ide> {
<ide> $this->args = $args;
<ide> $this->options = $options;
<add> $this->argNames = $argNames;
<ide> }
<ide>
<ide> /**
<ide> public function getArguments()
<ide> */
<ide> public function getArgumentAt($index)
<ide> {
<del> if (isset($this->args[$index])) {
<add> if ($this->hasArgumentAt($index)) {
<ide> return $this->args[$index];
<ide> }
<ide>
<ide> public function hasArgumentAt($index)
<ide> {
<ide> return isset($this->args[$index]);
<ide> }
<add>
<add> /**
<add> * Check if a positional argument exists by name
<add> *
<add> * @param string $name The argument name to check.
<add> * @return bool
<add> */
<add> public function hasArgument($name)
<add> {
<add> if (!isset($this->argNames[$name])) {
<add> return false;
<add> }
<add> $index = $this->argNames[$name];
<add>
<add> return isset($this->args[$index]);
<add> }
<add>
<add> /**
<add> * Check if a positional argument exists by name
<add> *
<add> * @param string $name The argument name to check.
<add> * @return string|null
<add> */
<add> public function getArgument($name)
<add> {
<add> if (!isset($this->argNames[$name])) {
<add> return null;
<add> }
<add> $index = $this->argNames[$name];
<add>
<add> return $this->args[$index];
<add> }
<ide> }
<ide><path>tests/TestCase/Console/ArgumentsTest.php
<ide> * @since 3.6.0
<ide> * @license https://opensource.org/licenses/mit-license.php MIT License
<ide> */
<del>
<ide> namespace Cake\Test\TestSuite\Console;
<ide>
<ide> use Cake\Console\Arguments;
<ide> class ArgumentsTest extends TestCase
<ide> public function testGetArguments()
<ide> {
<ide> $values = ['big', 'brown', 'bear'];
<del> $args = new Arguments($values, []);
<add> $args = new Arguments($values, [], []);
<ide> $this->assertSame($values, $args->getArguments());
<ide> }
<ide>
<ide> public function testGetArguments()
<ide> public function testGetArgumentAt()
<ide> {
<ide> $values = ['big', 'brown', 'bear'];
<del> $args = new Arguments($values, []);
<add> $args = new Arguments($values, [], []);
<ide> $this->assertSame($values[0], $args->getArgumentAt(0));
<ide> $this->assertSame($values[1], $args->getArgumentAt(1));
<ide> $this->assertNull($args->getArgumentAt(3));
<ide> public function testGetArgumentAt()
<ide> public function testHasArgumentAt()
<ide> {
<ide> $values = ['big', 'brown', 'bear'];
<del> $args = new Arguments($values, []);
<add> $args = new Arguments($values, [], []);
<ide> $this->assertTrue($args->hasArgumentAt(0));
<ide> $this->assertTrue($args->hasArgumentAt(1));
<ide> $this->assertFalse($args->hasArgumentAt(3));
<add> $this->assertFalse($args->hasArgumentAt(-1));
<add> }
<add>
<add> /**
<add> * check arguments by name
<add> *
<add> * @return void
<add> */
<add> public function testHasArgument()
<add> {
<add> $values = ['big', 'brown', 'bear'];
<add> $names = ['size' => 0, 'color' => 1, 'species' => 2, 'odd' => 3];
<add> $args = new Arguments($values, [], $names);
<add> $this->assertTrue($args->hasArgument('size'));
<add> $this->assertTrue($args->hasArgument('color'));
<add> $this->assertFalse($args->hasArgument('hair'));
<add> $this->assertFalse($args->hasArgument('Hair'), 'casing matters');
<add> $this->assertFalse($args->hasArgument('odd'));
<add> }
<add>
<add> /**
<add> * get arguments by name
<add> *
<add> * @return void
<add> */
<add> public function testGetArgument()
<add> {
<add> $values = ['big', 'brown', 'bear'];
<add> $names = ['size' => 0, 'color' => 1, 'species' => 2, 'odd' => 3];
<add> $args = new Arguments($values, [], $names);
<add> $this->assertSame($values[0], $args->getArgument('size'));
<add> $this->assertSame($values[1], $args->getArgument('color'));
<add> $this->assertNull($args->getArgument('Color'));
<add> $this->assertNull($args->getArgument('hair'));
<ide> }
<ide> } | 2 |
Ruby | Ruby | remove installationerror superclass | 081036c81c7f5a8ce96c912fdacf1e1331ddde96 | <ide><path>Library/Homebrew/exceptions.rb
<ide> def initialize name
<ide> end
<ide> end
<ide>
<del>module Homebrew
<del> class InstallationError < RuntimeError
<del> attr_reader :formula
<del>
<del> def initialize(formula, message)
<del> super message
<del> @formula = formula
<del> end
<del> end
<del>end
<del>
<ide> class CannotInstallFormulaError < RuntimeError; end
<ide>
<ide> class FormulaAlreadyInstalledError < RuntimeError; end
<ide>
<del>class FormulaInstallationAlreadyAttemptedError < Homebrew::InstallationError
<add>class FormulaInstallationAlreadyAttemptedError < RuntimeError
<ide> def initialize(formula)
<del> super formula, "Formula installation already attempted: #{formula}"
<add> super "Formula installation already attempted: #{formula}"
<ide> end
<ide> end
<ide>
<del>class UnsatisfiedRequirements < Homebrew::InstallationError
<del> attr_reader :reqs
<del>
<del> def initialize formula, reqs
<del> @reqs = reqs
<del> message = (reqs.length == 1) \
<del> ? "An unsatisfied requirement failed this build." \
<del> : "Unsatisifed requirements failed this build."
<del> super formula, message
<add>class UnsatisfiedRequirements < RuntimeError
<add> def initialize(reqs)
<add> if reqs.length == 1
<add> super "An unsatisfied requirement failed this build."
<add> else
<add> super "Unsatisified requirements failed this build."
<add> end
<ide> end
<ide> end
<ide>
<del>class FormulaConflictError < Homebrew::InstallationError
<del> attr_reader :conflicts
<add>class FormulaConflictError < RuntimeError
<add> attr_reader :formula, :conflicts
<ide>
<ide> def initialize(formula, conflicts)
<del> @conflicts = conflicts
<ide> @formula = formula
<del> super formula, message
<add> @conflicts = conflicts
<add> super message
<ide> end
<ide>
<ide> def conflict_message(conflict)
<ide> def message
<ide> end
<ide> end
<ide>
<del>class BuildError < Homebrew::InstallationError
<del> attr_reader :env
<add>class BuildError < RuntimeError
<add> attr_reader :formula, :env
<ide>
<ide> def initialize(formula, cmd, args, env)
<add> @formula = formula
<ide> @env = env
<ide> args = args.map{ |arg| arg.to_s.gsub " ", "\\ " }.join(" ")
<del> super formula, "Failed executing: #{cmd} #{args}"
<add> super "Failed executing: #{cmd} #{args}"
<ide> end
<ide>
<ide> def issues
<ide> def dump
<ide>
<ide> # raised by CompilerSelector if the formula fails with all of
<ide> # the compilers available on the user's system
<del>class CompilerSelectionError < Homebrew::InstallationError
<del> def initialize formula
<del> super formula, <<-EOS.undent
<del> #{formula.name} cannot be built with any available compilers.
<del> To install this formula, you may need to:
<del> brew install gcc
<del> EOS
<add>class CompilerSelectionError < RuntimeError
<add> def initialize(formula)
<add> super <<-EOS.undent
<add> #{formula.name} cannot be built with any available compilers.
<add> To install this formula, you may need to:
<add> brew install gcc
<add> EOS
<ide> end
<ide> end
<ide>
<ide><path>Library/Homebrew/formula_installer.rb
<ide> def check_requirements(req_map)
<ide> end
<ide> end
<ide>
<del> raise UnsatisfiedRequirements.new(f, fatals) unless fatals.empty?
<add> raise UnsatisfiedRequirements.new(fatals) unless fatals.empty?
<ide> end
<ide>
<ide> def install_requirement_default_formula?(req, build) | 2 |
Python | Python | convert tests to pytest style | 06afe6b1bf50e1b4bc953c1be7192c0304d96bf6 | <ide><path>tests/test_parsers.py
<ide> def test_parse(self):
<ide> stream = StringIO(self.string)
<ide> data = parser.parse(stream)
<ide>
<del> self.assertEqual(Form(data).is_valid(), True)
<add> assert Form(data).is_valid() is True
<ide>
<ide>
<ide> class TestFileUploadParser(TestCase):
<ide> def test_parse(self):
<ide> self.stream.seek(0)
<ide> data_and_files = parser.parse(self.stream, None, self.parser_context)
<ide> file_obj = data_and_files.files['file']
<del> self.assertEqual(file_obj._size, 14)
<add> assert file_obj._size == 14
<ide>
<ide> def test_parse_missing_filename(self):
<ide> """
<ide> def test_parse_missing_filename_large_file(self):
<ide> def test_get_filename(self):
<ide> parser = FileUploadParser()
<ide> filename = parser.get_filename(self.stream, None, self.parser_context)
<del> self.assertEqual(filename, 'file.txt')
<add> assert filename == 'file.txt'
<ide>
<ide> def test_get_encoded_filename(self):
<ide> parser = FileUploadParser()
<ide>
<ide> self.__replace_content_disposition('inline; filename*=utf-8\'\'ÀĥƦ.txt')
<ide> filename = parser.get_filename(self.stream, None, self.parser_context)
<del> self.assertEqual(filename, 'ÀĥƦ.txt')
<add> assert filename == 'ÀĥƦ.txt'
<ide>
<ide> self.__replace_content_disposition('inline; filename=fallback.txt; filename*=utf-8\'\'ÀĥƦ.txt')
<ide> filename = parser.get_filename(self.stream, None, self.parser_context)
<del> self.assertEqual(filename, 'ÀĥƦ.txt')
<add> assert filename == 'ÀĥƦ.txt'
<ide>
<ide> self.__replace_content_disposition('inline; filename=fallback.txt; filename*=utf-8\'en-us\'ÀĥƦ.txt')
<ide> filename = parser.get_filename(self.stream, None, self.parser_context)
<del> self.assertEqual(filename, 'ÀĥƦ.txt')
<add> assert filename == 'ÀĥƦ.txt'
<ide>
<ide> def __replace_content_disposition(self, disposition):
<ide> self.parser_context['request'].META['HTTP_CONTENT_DISPOSITION'] = disposition | 1 |
PHP | PHP | make default match typehint | dbd7faf11cd1d0f959189466e37fd488e76ae11c | <ide><path>src/View/Input/InputRegistry.php
<ide> class InputRegistry {
<ide> * @param StringTemplate $templates Templates instance to use.
<ide> * @param array $widgets See add() method for more information.
<ide> */
<del> public function __construct(StringTemplate $templates, array $widgets = null) {
<add> public function __construct(StringTemplate $templates, array $widgets = []) {
<ide> $this->_templates = $templates;
<ide> if (!empty($widgets)) {
<ide> $this->add($widgets); | 1 |
Java | Java | add "mutate" builder to serverwebexchange | c3f22b73646be44d29ae42e0c5dc9531a1a36b31 | <ide><path>spring-web/src/main/java/org/springframework/web/server/DefaultServerWebExchangeMutativeBuilder.java
<add>/*
<add> * Copyright 2002-2016 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>package org.springframework.web.server;
<add>
<add>import java.security.Principal;
<add>import java.util.Optional;
<add>
<add>import reactor.core.publisher.Mono;
<add>
<add>import org.springframework.http.server.reactive.ServerHttpRequest;
<add>import org.springframework.http.server.reactive.ServerHttpResponse;
<add>import org.springframework.util.Assert;
<add>
<add>/**
<add> * Default implementation of
<add> * {@link org.springframework.web.server.ServerWebExchange.MutativeBuilder}.
<add> *
<add> * @author Rossen Stoyanchev
<add> * @since 5.0
<add> */
<add>class DefaultServerWebExchangeMutativeBuilder implements ServerWebExchange.MutativeBuilder {
<add>
<add> private final ServerWebExchange delegate;
<add>
<add> private ServerHttpRequest request;
<add>
<add> private ServerHttpResponse response;
<add>
<add> private Principal user;
<add>
<add> private Mono<WebSession> session;
<add>
<add>
<add> public DefaultServerWebExchangeMutativeBuilder(ServerWebExchange delegate) {
<add> Assert.notNull(delegate, "'delegate' is required.");
<add> this.delegate = delegate;
<add> }
<add>
<add>
<add> @Override
<add> public ServerWebExchange.MutativeBuilder setRequest(ServerHttpRequest request) {
<add> this.request = request;
<add> return this;
<add> }
<add>
<add> @Override
<add> public ServerWebExchange.MutativeBuilder setResponse(ServerHttpResponse response) {
<add> this.response = response;
<add> return this;
<add> }
<add>
<add> @Override
<add> public ServerWebExchange.MutativeBuilder setPrincipal(Principal user) {
<add> this.user = user;
<add> return this;
<add> }
<add>
<add> @Override
<add> public ServerWebExchange.MutativeBuilder setSession(Mono<WebSession> session) {
<add> this.session = session;
<add> return this;
<add> }
<add>
<add> @Override
<add> public ServerWebExchange build() {
<add> return new MutativeDecorator(this.delegate,
<add> this.request, this.response, this.user, this.session);
<add> }
<add>
<add>
<add> /**
<add> * An immutable wrapper of an exchange returning property overrides -- given
<add> * to the constructor -- or original values otherwise.
<add> */
<add> private static class MutativeDecorator extends ServerWebExchangeDecorator {
<add>
<add> private final ServerHttpRequest request;
<add>
<add> private final ServerHttpResponse response;
<add>
<add> private final Principal user;
<add>
<add> private final Mono<WebSession> session;
<add>
<add>
<add> public MutativeDecorator(ServerWebExchange delegate,
<add> ServerHttpRequest request, ServerHttpResponse response, Principal user,
<add> Mono<WebSession> session) {
<add>
<add> super(delegate);
<add> this.request = request;
<add> this.response = response;
<add> this.user = user;
<add> this.session = session;
<add> }
<add>
<add>
<add> @Override
<add> public ServerHttpRequest getRequest() {
<add> return (this.request != null ? this.request : getDelegate().getRequest());
<add> }
<add>
<add> @Override
<add> public ServerHttpResponse getResponse() {
<add> return (this.response != null ? this.response : getDelegate().getResponse());
<add> }
<add>
<add> @Override
<add> public Mono<WebSession> getSession() {
<add> return (this.session != null ? this.session : getDelegate().getSession());
<add> }
<add>
<add> @SuppressWarnings("unchecked")
<add> @Override
<add> public <T extends Principal> Optional<T> getPrincipal() {
<add> return (this.user != null ? Optional.of((T) this.user) : getDelegate().getPrincipal());
<add> }
<add> }
<add>
<add>}
<add>
<ide><path>spring-web/src/main/java/org/springframework/web/server/ServerWebExchange.java
<ide> public interface ServerWebExchange {
<ide> */
<ide> boolean checkNotModified(String etag, Instant lastModified);
<ide>
<add>
<add> /**
<add> * Return a builder to mutate properties of this exchange. The resulting
<add> * new exchange is an immutable {@link ServerWebExchangeDecorator decorator}
<add> * around the current exchange instance that returns mutated values, where
<add> * provided, or delegating to the decorated instance otherwise.
<add> */
<add> default MutativeBuilder mutate() {
<add> return new DefaultServerWebExchangeMutativeBuilder(this);
<add> }
<add>
<add>
<add> /**
<add> * Builder for mutating properties of a {@link ServerWebExchange}.
<add> */
<add> interface MutativeBuilder {
<add>
<add> /**
<add> * Set the request to use.
<add> */
<add> MutativeBuilder setRequest(ServerHttpRequest request);
<add>
<add> /**
<add> * Set the response to use.
<add> */
<add> MutativeBuilder setResponse(ServerHttpResponse response);
<add>
<add> /**
<add> * Set the principal to use.
<add> */
<add> MutativeBuilder setPrincipal(Principal user);
<add>
<add> /**
<add> * Set the session to use.
<add> */
<add> MutativeBuilder setSession(Mono<WebSession> session);
<add>
<add> /**
<add> * Build an immutable wrapper that returning the mutated properties.
<add> */
<add> ServerWebExchange build();
<add>
<add> }
<add>
<ide> }
<ide><path>spring-web/src/main/java/org/springframework/web/server/ServerWebExchangeDecorator.java
<ide> import org.springframework.util.Assert;
<ide>
<ide> /**
<del> * Wraps another {@link ServerWebExchange} and delegates all methods to it.
<del> * Sub-classes can override specific methods, e.g. {@link #getPrincipal()} to
<del> * return the authenticated user for the request.
<add> * A convenient base class for classes that need to wrap another
<add> * {@link ServerWebExchange}. Pre-implements all methods by delegating to the
<add> * wrapped instance.
<add> *
<add> * <p>Note that if the purpose for wrapping is simply to override specific
<add> * properties, e.g. {@link #getPrincipal()}, consider using
<add> * {@link ServerWebExchange#mutate()} instead.
<ide> *
<ide> * @author Rossen Stoyanchev
<ide> * @since 5.0
<add> *
<add> * @see ServerWebExchange#mutate()
<ide> */
<ide> public class ServerWebExchangeDecorator implements ServerWebExchange {
<ide>
<ide> private final ServerWebExchange delegate;
<ide>
<ide>
<del> public ServerWebExchangeDecorator(ServerWebExchange delegate) {
<del> Assert.notNull(delegate, "'delegate' is required.");
<add> protected ServerWebExchangeDecorator(ServerWebExchange delegate) {
<add> Assert.notNull(delegate, "ServerWebExchange 'delegate' is required.");
<ide> this.delegate = delegate;
<ide> }
<ide> | 3 |
Java | Java | increase timeout in integration test | e8d8c3390a0626308b770c5860c11704f5c52e06 | <ide><path>spring-messaging/src/test/java/org/springframework/messaging/simp/stomp/StompBrokerRelayMessageHandlerIntegrationTests.java
<ide> public void publishEvent(ApplicationEvent event) {
<ide> }
<ide>
<ide> public void expectBrokerAvailabilityEvent(boolean isBrokerAvailable) throws InterruptedException {
<del> BrokerAvailabilityEvent event = this.eventQueue.poll(10000, TimeUnit.MILLISECONDS);
<add> BrokerAvailabilityEvent event = this.eventQueue.poll(20000, TimeUnit.MILLISECONDS);
<ide> assertNotNull("Times out waiting for BrokerAvailabilityEvent[" + isBrokerAvailable + "]", event);
<ide> assertEquals(isBrokerAvailable, event.isBrokerAvailable());
<ide> } | 1 |
Text | Text | remove file list | aceb735dbaa7845aeacfdaa62656de558554d8b7 | <ide><path>docs/man/README.md
<ide> This directory contains the Docker user manual in the Markdown format.
<ide> Do *not* edit the man pages in the man1 directory. Instead, amend the
<ide> Markdown (*.md) files.
<ide>
<del># File List
<del>
<del> docker.md
<del> docker-attach.md
<del> docker-build.md
<del> docker-commit.md
<del> docker-cp.md
<del> docker-diff.md
<del> docker-events.md
<del> docker-export.md
<del> docker-history.md
<del> docker-images.md
<del> docker-import.md
<del> docker-info.md
<del> docker-inspect.md
<del> docker-kill.md
<del> docker-load.md
<del> docker-login.md
<del> docker-logs.md
<del> docker-port.md
<del> docker-ps.md
<del> docker-pull.md
<del> docker-push.md
<del> docker-restart.md
<del> docker-rmi.md
<del> docker-rm.md
<del> docker-run.md
<del> docker-save.md
<del> docker-search.md
<del> docker-start.md
<del> docker-stop.md
<del> docker-tag.md
<del> docker-top.md
<del> docker-wait.md
<del> Dockerfile
<del> md2man-all.sh
<del>
<ide> # Generating man pages from the Markdown files
<ide>
<ide> The recommended approach for generating the man pages is via a Docker | 1 |
Go | Go | respect auto allocation for --ipv6 | 83dd2c193a0c5d2f3fd4a050e7e27f048891c1a3 | <ide><path>libnetwork/api/api_test.go
<ide> func TestCreateDeleteNetwork(t *testing.T) {
<ide> }
<ide>
<ide> dops := GetOpsMap("abc", "")
<del> nops := map[string]string{
<del> netlabel.EnableIPv6: "true",
<del> }
<add> nops := map[string]string{}
<ide> nc := networkCreate{Name: "network_1", NetworkType: bridgeNetType, DriverOpts: dops, NetworkOpts: nops}
<ide> goodBody, err := json.Marshal(nc)
<ide> if err != nil {
<ide> func TestEndToEnd(t *testing.T) {
<ide> handleRequest := NewHTTPHandler(c)
<ide>
<ide> dops := GetOpsMap("cdef", "1460")
<del> nops := map[string]string{
<del> netlabel.EnableIPv6: "true",
<del> }
<add> nops := map[string]string{}
<ide>
<ide> // Create network
<ide> nc := networkCreate{Name: "network-fiftyfive", NetworkType: bridgeNetType, DriverOpts: dops, NetworkOpts: nops}
<ide><path>libnetwork/ipam/allocator.go
<ide> func (a *Allocator) getPredefinedPool(as string, ipV6 bool) (*net.IPNet, error)
<ide> }
<ide> }
<ide>
<del> return nil, types.NotFoundErrorf("could not find an available non-overlapping address pool among the defaults to auto assign to the network")
<add> return nil, types.NotFoundErrorf("could not find an available, non-overlapping IPv%d address pool among the defaults to assign to the network", v)
<ide> }
<ide>
<ide> // RequestAddress returns an address from the specified pool ID
<ide><path>libnetwork/network.go
<ide> func (n *network) ipamAllocateVersion(ipVer int, ipam ipamapi.Ipam) error {
<ide> }
<ide>
<ide> if len(*cfgList) == 0 {
<del> if ipVer == 6 {
<del> return nil
<del> }
<ide> *cfgList = []*IpamConf{{}}
<ide> }
<ide> | 3 |
Ruby | Ruby | reduce required revision length | 632813d9693562af041fd8b98ac459099704a957 | <ide><path>Library/Homebrew/rubocops/patches.rb
<ide> def patch_problems(patch)
<ide> %r{gist\.github\.com/.+/raw},
<ide> %r{gist\.githubusercontent\.com/.+/raw}])
<ide> if regex_match_group(patch, gh_patch_patterns)
<del> unless patch_url.match?(/[a-fA-F0-9]{40}/)
<add> unless patch_url.match?(%r{/[a-fA-F0-9]{6,40}/})
<ide> problem <<~EOS.chomp
<ide> GitHub/Gist patches should specify a revision:
<ide> #{patch_url} | 1 |
Text | Text | add missing methods to api index | fb47694c52d4b7285cdbb80cbe7e42181826cc53 | <ide><path>API.md
<ide> Geographic projections, shapes and math.
<ide> * [*path*.area](https://github.com/d3/d3-geo/blob/master/README.md#path_area) - compute the projected planar area of a given feature.
<ide> * [*path*.bounds](https://github.com/d3/d3-geo/blob/master/README.md#path_bounds) - compute the projected planar bounding box of a given feature.
<ide> * [*path*.centroid](https://github.com/d3/d3-geo/blob/master/README.md#path_centroid) - compute the projected planar centroid of a given feature.
<add>* [*path*.measure](https://github.com/d3/d3-geo/blob/master/README.md#path_measure) - compute the projected planar length of a given feature.
<ide> * [*path*.projection](https://github.com/d3/d3-geo/blob/master/README.md#path_projection) - set the geographic projection.
<ide> * [*path*.context](https://github.com/d3/d3-geo/blob/master/README.md#path_context) - set the render context.
<ide> * [*path*.pointRadius](https://github.com/d3/d3-geo/blob/master/README.md#path_pointRadius) - set the radius to display point features.
<ide> Geographic projections, shapes and math.
<ide> ### [Transforms](https://github.com/d3/d3-geo/blob/master/README.md#transforms)
<ide>
<ide> * [d3.geoIdentity](https://github.com/d3/d3-geo/blob/master/README.md#geoIdentity) - scale, translate or clip planar geometry.
<add>* [*identity*.reflectX](https://github.com/d3/d3-geo/blob/master/README.md#identity_reflectX) - reflect the *x*-dimension.
<add>* [*identity*.reflectY](https://github.com/d3/d3-geo/blob/master/README.md#identity_reflectY) - reflect the *y*-dimension.
<ide> * [d3.geoTransform](https://github.com/d3/d3-geo/blob/master/README.md#geoTransform) - define a custom geometry transform.
<ide>
<ide> ## [Hierarchies (d3-hierarchy)](https://github.com/d3/d3-hierarchy)
<ide> Pan and zoom SVG, HTML or Canvas using mouse or touch input.
<ide> * [*zoom*.scaleExtent](https://github.com/d3/d3-zoom/blob/master/README.md#zoom_scaleExtent) - set the allowed scale range.
<ide> * [*zoom*.translateExtent](https://github.com/d3/d3-zoom/blob/master/README.md#zoom_translateExtent) - set the extent of the zoomable world.
<ide> * [*zoom*.duration](https://github.com/d3/d3-zoom/blob/master/README.md#zoom_duration) - set the duration of zoom transitions.
<add>* [*zoom*.interpolate](https://github.com/d3/d3-zoom/blob/master/README.md#zoom_interpolate) - control the interpolation of zoom transitions.
<ide> * [*zoom*.on](https://github.com/d3/d3-zoom/blob/master/README.md#zoom_on) - listen for zoom events.
<ide> * [d3.zoomTransform](https://github.com/d3/d3-zoom/blob/master/README.md#zoomTransform) - get the zoom transform for a given element.
<ide> * [*transform*.scale](https://github.com/d3/d3-zoom/blob/master/README.md#transform_scale) - scale a transform by the specified amount. | 1 |
Text | Text | move digitalinfinity to emeritus | 7eb500b538a5b78650ac9d2a6c5f52353dc4c577 | <ide><path>README.md
<ide> For information about the governance of the Node.js project, see
<ide> **David Carlier** <[email protected]>
<ide> * [devsnek](https://github.com/devsnek) -
<ide> **Gus Caplan** <[email protected]> (he/him)
<del>* [digitalinfinity](https://github.com/digitalinfinity) -
<del>**Hitesh Kanwathirtha** <[email protected]> (he/him)
<ide> * [edsadr](https://github.com/edsadr) -
<ide> **Adrian Estrada** <[email protected]> (he/him)
<ide> * [eugeneo](https://github.com/eugeneo) -
<ide> For information about the governance of the Node.js project, see
<ide> **Claudio Rodriguez** <[email protected]>
<ide> * [DavidCai1993](https://github.com/DavidCai1993) -
<ide> **David Cai** <[email protected]> (he/him)
<add>* [digitalinfinity](https://github.com/digitalinfinity) -
<add>**Hitesh Kanwathirtha** <[email protected]> (he/him)
<ide> * [eljefedelrodeodeljefe](https://github.com/eljefedelrodeodeljefe) -
<ide> **Robert Jefe Lindstaedt** <[email protected]>
<ide> * [estliberitas](https://github.com/estliberitas) - | 1 |
Javascript | Javascript | make tests cwd-independent | f1d593cda16dec18d56e76bedb11200d57e74e36 | <ide><path>test/doctool/test-doctool-html.js
<ide> testData.forEach((item) => {
<ide> {
<ide> input: preprocessed,
<ide> filename: 'foo',
<del> template: 'doc/template.html',
<add> template: path.resolve(__dirname, '../../doc/template.html'),
<ide> nodeVersion: process.version,
<ide> analytics: item.analyticsId,
<ide> },
<ide><path>test/parallel/test-cli-eval.js
<ide> child.exec(`${nodejs} --print "os.platform()"`,
<ide> }));
<ide>
<ide> // Module path resolve bug regression test.
<add>const cwd = process.cwd();
<add>process.chdir(path.resolve(__dirname, '../../'));
<ide> child.exec(`${nodejs} --eval "require('./test/parallel/test-cli-eval.js')"`,
<ide> common.mustCall((err, stdout, stderr) => {
<ide> assert.strictEqual(err.code, 42);
<ide> assert.strictEqual(
<ide> stdout, 'Loaded as a module, exiting with status code 42.\n');
<ide> assert.strictEqual(stderr, '');
<ide> }));
<add>process.chdir(cwd);
<ide>
<ide> // Missing argument should not crash.
<ide> child.exec(`${nodejs} -e`, common.mustCall((err, stdout, stderr) => {
<ide><path>test/parallel/test-process-chdir.js
<ide> const assert = require('assert');
<ide> const fs = require('fs');
<ide> const path = require('path');
<ide>
<add>process.chdir('..');
<ide> assert.notStrictEqual(process.cwd(), __dirname);
<ide> process.chdir(__dirname);
<ide> assert.strictEqual(process.cwd(), __dirname); | 3 |
Text | Text | add comment tags to the end of the file | 3218e999bd6c06e779cdba51d1a0b9f22a039438 | <ide><path>.github/PULL_REQUEST_TEMPLATE.md
<ide> - [ ] None of my changes are plagiarized from another source without proper attribution.
<ide> - [ ] My article does not contain shortened URLs or affiliate links.
<ide>
<del>If your pull request closes a GitHub issue, replace the XXXXX below with the issue number.
<add><!--If your pull request closes a GitHub issue, replace the XXXXX below with the issue number.-->
<ide>
<ide> Closes #XXXXX | 1 |
Ruby | Ruby | remove warning from `video_tag` | c762a24a61a5f54247142d291487206d3187671a | <ide><path>actionview/lib/action_view/helpers/asset_tag_helper.rb
<ide> def video_tag(*sources)
<ide> options = sources.extract_options!.symbolize_keys
<ide> public_poster_folder = options.delete(:poster_skip_pipeline)
<ide> sources << options
<del> multiple_sources_tag_builder("video", sources) do |options|
<del> options[:poster] = path_to_image(options[:poster], skip_pipeline: public_poster_folder) if options[:poster]
<del> options[:width], options[:height] = extract_dimensions(options.delete(:size)) if options[:size]
<add> multiple_sources_tag_builder("video", sources) do |tag_options|
<add> tag_options[:poster] = path_to_image(tag_options[:poster], skip_pipeline: public_poster_folder) if tag_options[:poster]
<add> tag_options[:width], tag_options[:height] = extract_dimensions(tag_options.delete(:size)) if tag_options[:size]
<ide> end
<ide> end
<ide> | 1 |
Javascript | Javascript | fix three.skinnedmesh.clone() bug | 9c872b1cab3daed5cb6c564fbe5af836ec22feea | <ide><path>src/objects/SkinnedMesh.js
<ide> THREE.SkinnedMesh.prototype = Object.assign( Object.create( THREE.Mesh.prototype
<ide>
<ide> clone: function() {
<ide>
<del> return new this.constructor( this.geometry, this.material, this.useVertexTexture ).copy( this );
<add> return new this.constructor( this.geometry, this.material, this.skeleton.useVertexTexture ).copy( this );
<ide>
<ide> }
<ide> | 1 |
Python | Python | remove the extra "1" | 21aa620b6bd65e8368f86a37e55de8e56fccf917 | <ide><path>flask/debughelpers.py
<ide>
<ide> Various helpers to make the development experience better.
<ide>
<del>1 :copyright: (c) 2014 by Armin Ronacher.
<add> :copyright: (c) 2014 by Armin Ronacher.
<ide> :license: BSD, see LICENSE for more details.
<ide> """
<ide> from ._compat import implements_to_string | 1 |
PHP | PHP | component method for component aliases | 4ab37bb224d7edb21acdf22dcba6ce5272bbfc14 | <ide><path>src/Illuminate/View/Compilers/BladeCompiler.php
<ide> public function check($name, ...$parameters)
<ide> return call_user_func($this->conditions[$name], ...$parameters);
<ide> }
<ide>
<add> /**
<add> * Register a component alias.
<add> *
<add> * @param string $path
<add> * @param string $alias
<add> * @return void
<add> */
<add> public function component($path, $alias = null)
<add> {
<add> $alias = $alias ?: array_last(explode('.', $path));
<add>
<add> $this->directive($alias, function ($expression) use ($path) {
<add> if ($expression) {
<add> return "<?php \$__env->startComponent('{$path}', {$expression}); ?>";
<add> } else {
<add> return "<?php \$__env->startComponent('{$path}'); ?>";
<add> }
<add> });
<add>
<add> $this->directive('end'.$alias, function ($expression) use ($path) {
<add> return '<?php echo $__env->renderComponent(); ?>';
<add> });
<add> }
<add>
<ide> /**
<ide> * Register a handler for custom directives.
<ide> *
<ide><path>tests/View/Blade/BladeCustomTest.php
<ide> public function testCustomIfElseConditions()
<ide> <?php endif; ?>';
<ide> $this->assertEquals($expected, $this->compiler->compileString($string));
<ide> }
<add>
<add> public function testCustomComponents()
<add> {
<add> $this->compiler->component('app.components.alert', 'alert');
<add>
<add> $string = '@alert
<add>@endalert';
<add> $expected = '<?php $__env->startComponent(\'app.components.alert\'); ?>
<add><?php echo $__env->renderComponent(); ?>';
<add> $this->assertEquals($expected, $this->compiler->compileString($string));
<add> }
<add>
<add> public function testCustomComponentsWithSlots()
<add> {
<add> $this->compiler->component('app.components.alert', 'alert');
<add>
<add> $string = '@alert([\'type\' => \'danger\'])
<add>@endalert';
<add> $expected = '<?php $__env->startComponent(\'app.components.alert\', [\'type\' => \'danger\']); ?>
<add><?php echo $__env->renderComponent(); ?>';
<add> $this->assertEquals($expected, $this->compiler->compileString($string));
<add> }
<add>
<add> public function testCustomComponentsDefaultAlias()
<add> {
<add> $this->compiler->component('app.components.alert');
<add>
<add> $string = '@alert
<add>@endalert';
<add> $expected = '<?php $__env->startComponent(\'app.components.alert\'); ?>
<add><?php echo $__env->renderComponent(); ?>';
<add> $this->assertEquals($expected, $this->compiler->compileString($string));
<add> }
<ide> } | 2 |
Text | Text | update korean transltaion to 58fb322 | 6a4617a4cde60756531ac7ee808397e096a2ed04 | <ide><path>docs/docs/10.1-animation.ko-KR.md
<ide> var TodoList = React.createClass({
<ide> ```javascript{3-5}
<ide> render: function() {
<ide> return (
<del> <ReactCSSTransitionGroup transitionName="example" transitionAppear="true">
<add> <ReactCSSTransitionGroup transitionName="example" transitionAppear={true}>
<ide> <h1>Fading at Initial Mount</h1>
<ide> </ReactCSSTransitionGroup>
<ide> );
<ide><path>docs/docs/thinking-in-react.ko-KR.md
<ide> prev: tutorial-ko-KR.html
<ide> next: videos-ko-KR.html
<ide> ---
<ide>
<del>이 문서의 원본은 [공식 블로그](/react/blog)의 [포스팅](/react/blog/2013/11/05/thinking-in-react.html) 입니다.
<add>Pete Hunt의 글입니다.
<ide>
<ide> 제가 생각하기에, React는 JavaScript로 크고 빠른 웹 애플리케이션을 만드는데 최고입니다. 페이스북과 인스타그램에서 우리에게 잘 맞도록 조정되어 왔습니다.
<ide> | 2 |
Text | Text | translate 10.4test-utils.md to japanese | 75d04862027a323896fe023c6ba68d348b64f760 | <ide><path>docs/docs/10.4-test-utils.ja-JP.md
<add>---
<add>id: test-utils
<add>title: テストユーティリティ
<add>permalink: test-utils-ja-JP.html
<add>prev: two-way-binding-helpers-ja-JP.html
<add>next: clone-with-props-ja-JP.html
<add>---
<add>
<add>`React.addons.TestUtils` は選んだテストフレームワーク(私たちは[Jest](https://facebook.github.io/jest/)を使っています)において、Reactのコンポーネントをテストすることを簡単にします。
<add>
<add>### Simulate
<add>
<add>```javascript
<add>Simulate.{eventName}(DOMElement element, object eventData)
<add>```
<add>
<add>オプションの `eventData` であるイベントデータと共に、DOMノードの上でイベントのディスパッチをシミュレートします。 **これは `ReactTestUtils` の中で最も有用なユーティリティでしょう。**
<add>
<add>使用例:
<add>
<add>```javascript
<add>var node = React.findDOMNode(this.refs.input);
<add>React.addons.TestUtils.Simulate.click(node);
<add>React.addons.TestUtils.Simulate.change(node, {target: {value: 'Hello, world'}});
<add>React.addons.TestUtils.Simulate.keyDown(node, {key: "Enter"});
<add>```
<add>
<add>`Simulate` はReactが理解出来る全てのイベントのためのメソッドを持っています。
<add>
<add>### renderIntoDocument
<add>
<add>```javascript
<add>ReactComponent renderIntoDocument(ReactElement instance)
<add>```
<add>
<add>コンポーネントをドキュメントの中で分離したDOMノードにレンダリングします。 **この関数はDOMを必要とします。**
<add>
<add>
<add>### mockComponent
<add>
<add>```javascript
<add>object mockComponent(function componentClass, string? mockTagName)
<add>```
<add>
<add>有効なダミーのReactのコンポーネントとして使われることを許可するメソッドと共にこれを増強させるためにモックとなったコンポーネントモジュールをこのメソッドに渡してください。いつものようにレンダリングされる代わりに、コンポーネントは単純で、提供された子要素はどんなものでも含む `<div>` (`mockTagName` が提供されている場合はそのタグ)になるでしょう。
<add>
<add>### isElement
<add>
<add>```javascript
<add>boolean isElement(ReactElement element)
<add>```
<add>
<add>`element` が何かしらのReactElementだった場合に `true` を返します。
<add>
<add>### isElementOfType
<add>
<add>```javascript
<add>boolean isElementOfType(ReactElement element, function componentClass)
<add>```
<add>
<add>`element` がReactの `componentClass` 型であるReactElementだった場合に `true` を返します。
<add>
<add>### isDOMComponent
<add>
<add>```javascript
<add>boolean isDOMComponent(ReactComponent instance)
<add>```
<add>
<add>`instance` がDOMのコンポーネントだった場合に `true` を返します( `<div>` や `<span>` のように)。
<add>
<add>### isCompositeComponent
<add>
<add>```javascript
<add>boolean isCompositeComponent(ReactComponent instance)`
<add>```
<add>
<add>`instance` が複合的なコンポーネントだった場合に `true` を返します(`React.createClass()` で作成されるような)。
<add>
<add>### isCompositeComponentWithType
<add>
<add>```javascript
<add>boolean isCompositeComponentWithType(ReactComponent instance, function componentClass)
<add>```
<add>
<add>`instance` が複合的なコンポーネントだった場合に `true` を返します(`React.createClass()` で作成され、型がReactの `componentClass` であるような)。
<add>
<add>### findAllInRenderedTree
<add>
<add>```javascript
<add>array findAllInRenderedTree(ReactComponent tree, function test)
<add>```
<add>
<add>`tree` の中の全てのコンポーネントや `test(component)` が `true` となる蓄積された全てのコンポーネントを検討します。これはこれだけでは有用ではありませんが、他のテストユーティリティの根本として使われます。
<add>
<add>### scryRenderedDOMComponentsWithClass
<add>
<add>```javascript
<add>array scryRenderedDOMComponentsWithClass(ReactComponent tree, string className)
<add>```
<add>
<add>レンダリングされたツリーの中で、DOMコンポーネントであり、クラス名が `className` にマッチする、コンポーネントの全てのインスタンスを見つけます。
<add>
<add>### findRenderedDOMComponentWithClass
<add>
<add>```javascript
<add>ReactComponent findRenderedDOMComponentWithClass(ReactComponent tree, string className)
<add>```
<add>
<add>`scryRenderedDOMComponentsWithClass()` に似ていますが、結果が1つであること、それを返すこと、またはマッチする個数が1個以外だった場合に例外を投げることを予期します。
<add>
<add>### scryRenderedDOMComponentsWithTag
<add>
<add>```javascript
<add>array scryRenderedDOMComponentsWithTag(ReactComponent tree, string tagName)
<add>```
<add>
<add>レンダリングされたツリーの中で、DOMコンポーネントであり、タグ名が `tagName` にマッチする、コンポーネントの全てのインスタンスを見つけます。
<add>
<add>### findRenderedDOMComponentWithTag
<add>
<add>```javascript
<add>ReactComponent findRenderedDOMComponentWithTag(ReactComponent tree, string tagName)
<add>```
<add>
<add>`scryRenderedDOMComponentsWithTag()` に似ていますが、結果が1つであること、それを返すこと、またはマッチする個数が1個以外だった場合に例外を投げることを予期します。
<add>
<add>### scryRenderedComponentsWithType
<add>
<add>```javascript
<add>array scryRenderedComponentsWithType(ReactComponent tree, function componentClass)
<add>```
<add>
<add>型名が `componentClass` と同様である、コンポーネントの全てのインスタンスを見つけます。
<add>
<add>### findRenderedComponentWithType
<add>
<add>```javascript
<add>ReactComponent findRenderedComponentWithType(ReactComponent tree, function componentClass)
<add>```
<add>
<add>`scryRenderedComponentsWithType()` と同じですが、結果が1つであること、それを返すこと、またはマッチする個数が1個以外だった場合に例外を投げることを予期します。
<add>
<add>## Shallow rendering
<add>
<add>シャローレンダリングは"第一段階の深さ"であるコンポーネントをレンダリングすることを強制し、レンダリングメソッドが返すものについての事実をアサートし、インスタンスを生成したり、レンダリングされたりしない子のコンポーネントの振る舞いについては関心しない実験的な特徴です。これはDOMを必要としません。
<add>
<add>```javascript
<add>ReactShallowRenderer createRenderer()
<add>```
<add>
<add>シャローレンダラーを作成するにはこれをテストの中で呼んでください。これをあなたがテストするコンポーネントをレンダリングする場所であると考えることができます。この場所はイベントに返答したり、これ自身を更新したりできます。
<add>
<add>```javascript
<add>shallowRenderer.render(ReactElement element)
<add>```
<add>
<add>`React.render` に同様。
<add>
<add>```javascript
<add>ReactComponent shallowRenderer.getRenderOutput()
<add>```
<add>
<add>`render` が呼ばれた後、浅くレンダリングされた出力を返します。その後、その出力に関しての事実をアサートすることができます。例えば、以下のように、コンポーネントのレンダリングメソッドが返してきた場合は、
<add>
<add>```javascript
<add><div>
<add> <span className="heading">Title</span>
<add> <Subcomponent foo="bar" />
<add></div>
<add>```
<add>
<add>以下のように、アサートできます。
<add>
<add>```javascript
<add>result = renderer.getRenderOutput();
<add>expect(result.type).toBe('div');
<add>expect(result.props.children).toEqual([
<add> <span className="heading">Title</span>,
<add> <Subcomponent foo="bar" />
<add>]);
<add>```
<add>
<add>シャローテスティングは現在、制限があります。はっきり言うと、参照をサポートしていません。私たちは、この特徴を早めにリリースし、これが、どのように進化していくか、Reactのコミュニティのフィードバックを評価するつもりです。 | 1 |
Python | Python | fix unbound vars in es.syntax_iterators | 8df75b229cca93474a8502c7b07ed16e1d575b18 | <ide><path>spacy/lang/es/syntax_iterators.py
<ide>
<ide> def noun_chunks(obj):
<ide> doc = obj.doc
<del> np_label = doc.vocab.strings['NP']
<add> np_label = doc.vocab.strings.add('NP')
<ide> left_labels = ['det', 'fixed', 'neg'] #['nunmod', 'det', 'appos', 'fixed']
<ide> right_labels = ['flat', 'fixed', 'compound', 'neg']
<ide> stop_labels = ['punct']
<del> np_left_deps = [doc.vocab.strings[label] for label in left_labels]
<del> np_right_deps = [doc.vocab.strings[label] for label in right_labels]
<del> stop_deps = [doc.vocab.strings[label] for label in stop_labels]
<add> np_left_deps = [doc.vocab.strings.add(label) for label in left_labels]
<add> np_right_deps = [doc.vocab.strings.add(label) for label in right_labels]
<add> stop_deps = [doc.vocab.strings.add(label) for label in stop_labels]
<ide> token = doc[0]
<ide> while token and token.i < len(doc):
<ide> if token.pos in [PROPN, NOUN, PRON]:
<del> left, right = noun_bounds(token)
<add> left, right = noun_bounds(token, np_left_deps, np_right_deps, stop_deps)
<ide> yield left.i, right.i+1, np_label
<ide> token = right
<ide> token = next_token(token)
<ide> def next_token(token):
<ide> return None
<ide>
<ide>
<del>def noun_bounds(root):
<add>def noun_bounds(root, np_left_deps, np_right_deps, stop_deps):
<ide> left_bound = root
<ide> for token in reversed(list(root.lefts)):
<ide> if token.dep in np_left_deps:
<ide> left_bound = token
<ide> right_bound = root
<ide> for token in root.rights:
<ide> if (token.dep in np_right_deps):
<del> left, right = noun_bounds(token)
<add> left, right = noun_bounds(token, np_left_deps, np_right_deps, stop_deps)
<ide> if list(filter(lambda t: is_verb_token(t) or t.dep in stop_deps,
<ide> doc[left_bound.i: right.i])):
<ide> break | 1 |
Ruby | Ruby | fix inreplace string | a8e524d3345271dc350093ed54be008fa436cb0b | <ide><path>Library/Homebrew/dev-cmd/bottle.rb
<ide> def merge
<ide> update_or_add = "update"
<ide> if args.keep_old?
<ide> mismatches = []
<del> bottle_block_contents = s[/ bottle do(.+?)end\n/m, 1]
<add> bottle_block_contents = s.inreplace_string[/ bottle do(.+?)end\n/m, 1]
<ide> bottle_block_contents.lines.each do |line|
<ide> line = line.strip
<ide> next if line.empty? | 1 |
Python | Python | fix oom in config doctest | 7ccd6fc47cb95b7a029dbb15375bff999f7fa80f | <ide><path>src/transformers/models/gpt_neox/configuration_gpt_neox.py
<ide> class GPTNeoXConfig(PretrainedConfig):
<ide> >>> configuration = GPTNeoXConfig()
<ide>
<ide> >>> # Initializing a model (with random weights) from the gpt-neox-20b style configuration
<del> >>> model = GPTNeoXModel(configuration)
<add> >>> model = GPTNeoXModel(configuration) # doctest: +SKIP
<ide>
<ide> >>> # Accessing the model configuration
<del> >>> configuration = model.config
<add> >>> configuration = model.config # doctest: +SKIP
<ide> ```"""
<ide> model_type = "gpt_neox"
<ide> | 1 |
Mixed | Javascript | expose stream api in movecursor() | 795c7482f24c0c2f1b2db8d004b03ea373b6381b | <ide><path>doc/api/readline.md
<ide> if (process.stdin.isTTY)
<ide> process.stdin.setRawMode(true);
<ide> ```
<ide>
<del>## readline.moveCursor(stream, dx, dy)
<add>## readline.moveCursor(stream, dx, dy[, callback])
<ide> <!-- YAML
<ide> added: v0.7.7
<add>changes:
<add> - version: REPLACEME
<add> pr-url: https://github.com/nodejs/node/pull/28674
<add> description: The stream's write() callback and return value are exposed.
<ide> -->
<ide>
<ide> * `stream` {stream.Writable}
<ide> * `dx` {number}
<ide> * `dy` {number}
<add>* `callback` {Function} Invoked once the operation completes.
<add>* Returns: {boolean} `false` if `stream` wishes for the calling code to wait for
<add> the `'drain'` event to be emitted before continuing to write additional data;
<add> otherwise `true`.
<ide>
<ide> The `readline.moveCursor()` method moves the cursor *relative* to its current
<ide> position in a given [TTY][] `stream`.
<ide><path>lib/readline.js
<ide> function cursorTo(stream, x, y) {
<ide> * moves the cursor relative to its current location
<ide> */
<ide>
<del>function moveCursor(stream, dx, dy) {
<del> if (stream === null || stream === undefined)
<del> return;
<add>function moveCursor(stream, dx, dy, callback) {
<add> if (callback !== undefined && typeof callback !== 'function')
<add> throw new ERR_INVALID_CALLBACK(callback);
<add>
<add> if (stream == null || !(dx || dy)) {
<add> if (typeof callback === 'function')
<add> process.nextTick(callback);
<add> return true;
<add> }
<add>
<add> let data = '';
<ide>
<ide> if (dx < 0) {
<del> stream.write(CSI`${-dx}D`);
<add> data += CSI`${-dx}D`;
<ide> } else if (dx > 0) {
<del> stream.write(CSI`${dx}C`);
<add> data += CSI`${dx}C`;
<ide> }
<ide>
<ide> if (dy < 0) {
<del> stream.write(CSI`${-dy}A`);
<add> data += CSI`${-dy}A`;
<ide> } else if (dy > 0) {
<del> stream.write(CSI`${dy}B`);
<add> data += CSI`${dy}B`;
<ide> }
<add>
<add> return stream.write(data, callback);
<ide> }
<ide>
<ide> /**
<ide><path>test/parallel/test-readline-csi.js
<ide> assert.strictEqual(readline.clearLine(undefined, 0, common.mustCall()), true);
<ide> [1, -1, '\x1b[1C\x1b[1A'],
<ide> ].forEach((set) => {
<ide> writable.data = '';
<del> readline.moveCursor(writable, set[0], set[1]);
<add> assert.strictEqual(readline.moveCursor(writable, set[0], set[1]), true);
<add> assert.deepStrictEqual(writable.data, set[2]);
<add> writable.data = '';
<add> assert.strictEqual(
<add> readline.moveCursor(writable, set[0], set[1], common.mustCall()),
<add> true
<add> );
<ide> assert.deepStrictEqual(writable.data, set[2]);
<ide> });
<ide>
<add>// Verify that moveCursor() throws on invalid callback.
<add>assert.throws(() => {
<add> readline.moveCursor(writable, 1, 1, null);
<add>}, /ERR_INVALID_CALLBACK/);
<add>
<add>// Verify that moveCursor() does not throw on null or undefined stream.
<add>assert.strictEqual(readline.moveCursor(null, 1, 1), true);
<add>assert.strictEqual(readline.moveCursor(undefined, 1, 1), true);
<add>assert.strictEqual(readline.moveCursor(null, 1, 1, common.mustCall()), true);
<add>assert.strictEqual(readline.moveCursor(undefined, 1, 1, common.mustCall()),
<add> true);
<add>
<ide> // Undefined or null as stream should not throw.
<ide> readline.cursorTo(null);
<ide> readline.cursorTo(); | 3 |
Java | Java | use bridge methods in reflectivemethodresolver | 0b6101478e705f5fff1fa7e1cd2b1159ac60280c | <ide><path>spring-expression/src/test/java/org/springframework/expression/spel/SpelReproTests.java
<ide> import static org.junit.Assert.assertTrue;
<ide> import static org.junit.Assert.fail;
<ide>
<del>import java.io.Serializable;
<ide> import java.lang.reflect.Field;
<ide> import java.lang.reflect.Method;
<ide> import java.util.ArrayList;
<ide><path>spring-expression/src/test/java/org/springframework/expression/spel/spr10210/A.java
<ide> import org.springframework.expression.spel.spr10210.infra.C;
<ide>
<ide> abstract class A extends B<C> {
<add>
<add> public void bridgetMethod() {
<add> }
<add>
<ide> } | 2 |
PHP | PHP | add a test case for extend() before bind() | a9dd69087a5c5a39d02b1306809211e4d230fb66 | <ide><path>tests/Container/ContainerTest.php
<ide> public function testExtendIsLazyInitialized()
<ide> }
<ide>
<ide>
<add> public function testExtendCanBeCalledBeforeBind()
<add> {
<add> $container = new Container;
<add> $container->extend('foo', function($old, $container)
<add> {
<add> return $old.'bar';
<add> });
<add> $container['foo'] = 'foo';
<add>
<add> $this->assertEquals('foobar', $container->make('foo'));
<add> }
<add>
<add>
<ide> public function testParametersCanBePassedThroughToClosure()
<ide> {
<ide> $container = new Container; | 1 |
PHP | PHP | remove pointless code | 2d6ee3cdb1c42704bc15a1c08e6fbbab5c08507d | <ide><path>lib/Cake/Test/Case/View/Helper/PaginatorHelperTest.php
<ide> class PaginatorHelperTest extends CakeTestCase {
<ide> * @return void
<ide> */
<ide> public function setUp() {
<add> parent::setUp();
<ide> $controller = null;
<ide> $this->View = new View($controller);
<ide> $this->Paginator = new PaginatorHelper($this->View);
<ide> public function testUrlGeneration() {
<ide> * @return void
<ide> */
<ide> public function testUrlGenerationWithPrefixes() {
<del> $_back = Configure::read('Routing');
<del>
<ide> Configure::write('Routing.prefixes', array('members'));
<ide> Router::reload();
<ide>
<ide> public function testUrlGenerationWithPrefixes() {
<ide> $result = $this->Paginator->url($options);
<ide> $expected = '/posts/index/page:2/sort:Article.name/direction:desc';
<ide> $this->assertEquals($expected, $result);
<del>
<del> Configure::write('Routing', $_back);
<ide> }
<ide>
<ide> /** | 1 |
Ruby | Ruby | use alias nodes to represent table aliases | f528389a5580227f4d173bf4915a98b71befb32e | <ide><path>activerecord/lib/active_record/associations/class_methods/join_dependency/join_association.rb
<ide> def join_target_table(relation, condition)
<ide>
<ide> def join_has_and_belongs_to_many_to(relation)
<ide> join_table = Arel::Table.new(
<del> options[:join_table], :engine => arel_engine,
<del> :as => @aliased_join_table_name
<del> )
<add> options[:join_table]
<add> ).alias(@aliased_join_table_name)
<ide>
<ide> fk = options[:foreign_key] || reflection.active_record.to_s.foreign_key
<ide> klass_fk = options[:association_foreign_key] || reflection.klass.to_s.foreign_key | 1 |
Text | Text | expand docs for using immutable.js with selectors | 21b5c51d49288d369b588e038a9f1aacce50b27f | <ide><path>docs/recipes/UsingImmutableJS.md
<ide> Do not, however, use Immutable.JS in your dumb components.
<ide>
<ide> ### Your selectors should return Immutable.JS objects
<ide>
<del>Always.
<add>Always. This practice has several advantages:
<add>
<add>- It avoids unnecessary rerenders caused by calling `.toJS()` in selectors (since `.toJS()` will always return a new object).
<add> - It is possible to memoize selectors where you call `.toJS()`, but it’s redundant when just returning Immutable.js objects without memoizing will suffice.
<add>- It establishes a consistent interface for selectors; you won’t have to keep track of whether an Immutable.js object or plain JavaScript object will be returned.
<ide>
<ide> ### Use Immutable.JS objects in your Smart Components
<ide>
<ide> Such a dependency renders the component impure, makes testing the component more
<ide>
<ide> Something needs to map the Immutable.JS props in your Smart Component to the pure JavaScript props used in your Dumb Component. That something is a Higher Order Component (HOC) that simply takes the Immutable.JS props from your Smart Component, and converts them using `toJS()` to plain JavaScript props, which are then passed to your Dumb Component.
<ide>
<del>Here is an example of such a HOC:
<add>An example of such a HOC follows. A similar HOC is available as an NPM package for your convenience: [with-immutable-props-to-js](https://www.npmjs.com/package/with-immutable-props-to-js).
<ide>
<ide> ```js
<ide> import React from 'react' | 1 |
Mixed | Javascript | add externs file for closure compiler | 9d0a69772c39bfc751ca2000c3b4b3381e51fe93 | <ide><path>closure/README.md
<add>This file contains externs for use with the Closure compiler (aka JSCompiler).
<add>Passing these files to the --externs parameter of a compiler pass allows using
<add>type annotations for AngularJS objects. For example, Angular's $scope objects
<add>can be annotated as:
<add>```js
<add>/** @type {angular.Scope} */
<add>var scope = $scope;
<add>```
<add>
<add>This allows JSCompiler to type check accesses to scope, give warnings about
<add>missing methods or incorrect arguments, and also prevents renaming of property
<add>accesses with advanced compilation.
<add>
<add>The externs are incomplete and maintained on an as-needed basis, but strive to
<add>be correct. Externs for individual modules should be added in separate files.
<add>
<add>See https://developers.google.com/closure/compiler/
<ide><path>closure/angular.js
<add>/*
<add> * Copyright 2012 The Closure Compiler 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>/**
<add> * @fileoverview Externs for Angular 1.
<add> *
<add> * TODO: Mocks.
<add> * TODO: Remaining Services:
<add> * $compileProvider
<add> * $controller
<add> * $controllerProvider
<add> * $cookies
<add> * $cookieStore
<add> * $document
<add> * $httpBackend
<add> * $interpolate
<add> * $locale
<add> * $resource
<add> * $rootElement
<add> * $rootScope
<add> * $rootScopeProvider
<add> * $routeParams
<add> * $sanitize
<add> * $templateCache
<add> * $window
<add> * TODO: Resolve two issues with angular.$http
<add> * 1) angular.$http cannot be declared as a callable type.
<add> * Its helper methods should be used instead.
<add> * 2) angular.$http.delete cannot be added as an extern
<add> * as it is a reserved keyword.
<add> * Its use is potentially not supported in IE.
<add> * It may be aliased as 'remove' in a future version.
<add> *
<add> * @see http://angularjs.org/
<add> * @externs
<add> */
<add>
<add>/**
<add> * @typedef {(Window|Document|Element|Array.<Element>|string|angular.JQLite|
<add> * NodeList|{length: number})}
<add> */
<add>var JQLiteSelector;
<add>
<add>/**
<add> * @type {Object}
<add> * @const
<add> */
<add>var angular = {};
<add>
<add>/**
<add> * @param {Object} self
<add> * @param {Function} fn
<add> * @param {...*} args
<add> * @return {Function}
<add> */
<add>angular.bind = function(self, fn, args) {};
<add>
<add>/**
<add> * @param {Element|HTMLDocument} element
<add> * @param {Array.<string|Function>=} opt_modules
<add> * @return {angular.$injector}
<add> */
<add>angular.bootstrap = function(element, opt_modules) {};
<add>
<add>/**
<add> * @param {T} source
<add> * @param {(Object|Array)=} opt_dest
<add> * @return {T}
<add> * @template T
<add> */
<add>angular.copy = function(source, opt_dest) {};
<add>
<add>/**
<add> * @param {(JQLiteSelector|Object)} element
<add> * @param {(JQLiteSelector|Object)=} opt_context
<add> * @return {angular.JQLite}
<add> */
<add>angular.element = function(element, opt_context) {};
<add>
<add>/**
<add> * @param {*} o1
<add> * @param {*} o2
<add> * @return {boolean}
<add> */
<add>angular.equals = function(o1, o2) {};
<add>
<add>/**
<add> * @param {Object} dest
<add> * @param {...Object} srcs
<add> */
<add>angular.extend = function(dest, srcs) {};
<add>
<add>/**
<add> * @param {Object|Array} obj
<add> * @param {Function} iterator
<add> * @param {Object=} opt_context
<add> * @return {Object|Array}
<add> */
<add>angular.forEach = function(obj, iterator, opt_context) {};
<add>
<add>/**
<add> * @param {string|T} json
<add> * @return {Object|Array|Date|T}
<add> * @template T
<add> */
<add>angular.fromJson = function(json) {};
<add>
<add>/**
<add> * @param {*} arg
<add> * @return {*}
<add> */
<add>angular.identity = function(arg) {};
<add>
<add>/**
<add> * @param {Array.<string|Function>} modules
<add> * @return {angular.$injector}
<add> */
<add>angular.injector = function(modules) {};
<add>
<add>/**
<add> * @param {*} value
<add> * @return {boolean}
<add> */
<add>angular.isArray = function(value) {};
<add>
<add>/**
<add> * @param {*} value
<add> * @return {boolean}
<add> */
<add>angular.isDate = function(value) {};
<add>
<add>/**
<add> * @param {*} value
<add> * @return {boolean}
<add> */
<add>angular.isDefined = function(value) {};
<add>
<add>/**
<add> * @param {*} value
<add> * @return {boolean}
<add> */
<add>angular.isElement = function(value) {};
<add>
<add>/**
<add> * @param {*} value
<add> * @return {boolean}
<add> */
<add>angular.isFunction = function(value) {};
<add>
<add>/**
<add> * @param {*} value
<add> * @return {boolean}
<add> */
<add>angular.isNumber = function(value) {};
<add>
<add>/**
<add> * @param {*} value
<add> * @return {boolean}
<add> */
<add>angular.isObject = function(value) {};
<add>
<add>/**
<add> * @param {*} value
<add> * @return {boolean}
<add> */
<add>angular.isString = function(value) {};
<add>
<add>/**
<add> * @param {*} value
<add> * @return {boolean}
<add> */
<add>angular.isUndefined = function(value) {};
<add>
<add>/**
<add> * @param {string} s
<add> * @return {string}
<add> */
<add>angular.lowercase = function(s) {};
<add>
<add>angular.mock = {};
<add>
<add>/**
<add> * @param {string} name
<add> * @param {Array.<string>=} opt_requires
<add> * @param {(Function|Array.<string|Function>)=} opt_configFn
<add> * @return {angular.Module}
<add> */
<add>angular.module = function(name, opt_requires, opt_configFn) {};
<add>
<add>angular.noop = function() {};
<add>
<add>/**
<add> * @param {Object|Array|Date|string|number} obj
<add> * @param {boolean=} opt_pretty
<add> * @return {string}
<add> */
<add>angular.toJson = function(obj, opt_pretty) {};
<add>
<add>/**
<add> * @param {string} s
<add> * @return {string}
<add> */
<add>angular.uppercase = function(s) {};
<add>
<add>/**
<add> * @typedef {{
<add> * $attr: Object.<string,string>,
<add> * $normalize: function(string): string,
<add> * $observe: function(string, function(*)): function(*),
<add> * $set: function(string, ?(string|boolean), boolean=, string=)
<add> * }}
<add> */
<add>angular.Attributes;
<add>
<add>/**
<add> * @param {string} name
<add> * @return {string}
<add> */
<add>angular.Attributes.$normalize = function(name) {};
<add>
<add>/**
<add> * @param {string} key
<add> * @param {function(*)} fn
<add> * @return {function(*)}
<add> */
<add>angular.Attributes.$observe = function(key, fn) {};
<add>
<add>/**
<add> * @param {string} key
<add> * @param {?(string|boolean)} value
<add> * @param {boolean=} opt_writeAttr
<add> * @param {string=} opt_attrName
<add> */
<add>angular.Attributes.$set = function(key, value, opt_writeAttr, opt_attrName) {};
<add>
<add>/**
<add> * @typedef {{
<add> * pre: (function(
<add> * angular.Scope=, angular.JQLite=, angular.Attributes=, Object=)|
<add> * undefined),
<add> * post: (function(
<add> * angular.Scope=, angular.JQLite=, angular.Attributes=, Object=)|
<add> * undefined)
<add> * }}
<add> */
<add>angular.LinkingFunctions;
<add>
<add>/**
<add> * @param {angular.Scope=} scope
<add> * @param {angular.JQLite=} iElement
<add> * @param {angular.Attributes=} iAttrs
<add> * @param {(Object|Array.<Object>)=} controller
<add> */
<add>angular.LinkingFunctions.pre = function(scope, iElement, iAttrs, controller) {};
<add>
<add>/**
<add> * @param {angular.Scope=} scope
<add> * @param {angular.JQLite=} iElement
<add> * @param {angular.Attributes=} iAttrs
<add> * @param {(Object|Array.<Object>)=} controller
<add> */
<add>angular.LinkingFunctions.post = function(scope, iElement, iAttrs, controller) {
<add>};
<add>
<add>/**
<add> * @typedef {{
<add> * compile: (function(
<add> * angular.JQLite=, angular.Attributes=, Function=)|undefined),
<add> * controller: (Function|undefined),
<add> * controllerAs: (string|undefined),
<add> * link: (function(
<add> * angular.Scope=, angular.JQLite=, angular.Attributes=,
<add> * (Object|Array.<Object>)=)|
<add> * undefined),
<add> * name: (string|undefined),
<add> * priority: (number|undefined),
<add> * replace: (boolean|undefined),
<add> * require: (string|Array.<string>|undefined),
<add> * restrict: (string|undefined),
<add> * scope: (boolean|Object.<string, string>|undefined),
<add> * template: (string|undefined),
<add> * templateUrl: (string|undefined),
<add> * terminal: (boolean|undefined),
<add> * transclude: (boolean|string|undefined)
<add> * }}
<add> */
<add>angular.Directive;
<add>
<add>/**
<add> * @param {angular.JQLite=} tElement
<add> * @param {angular.Attributes=} tAttrs
<add> * @param {Function=} transclude
<add> * @return {Function|angular.LinkingFunctions|undefined}
<add> */
<add>angular.Directive.compile = function(tElement, tAttrs, transclude) {};
<add>
<add>angular.Directive.controller = function() {};
<add>
<add>/**
<add> * @type {string|undefined}
<add> */
<add>angular.Directive.controllerAs;
<add>
<add>/**
<add> * @param {angular.Scope=} scope
<add> * @param {angular.JQLite=} iElement
<add> * @param {angular.Attributes=} iAttrs
<add> * @param {(Object|Array.<Object>)=} controller
<add> */
<add>angular.Directive.link = function(scope, iElement, iAttrs, controller) {};
<add>
<add>/**
<add> * @type {(string|undefined)}
<add> */
<add>angular.Directive.name;
<add>
<add>/**
<add> * @type {(number|undefined)}
<add> */
<add>angular.Directive.priority;
<add>
<add>/**
<add> * @type {(boolean|undefined)}
<add> */
<add>angular.Directive.replace;
<add>
<add>/**
<add> * @type {(string|Array.<string>|undefined)}
<add> */
<add>angular.Directive.require;
<add>
<add>/**
<add> * @type {(string|undefined)}
<add> */
<add>angular.Directive.restrict;
<add>
<add>/**
<add> * @type {(boolean|Object.<string, string>|undefined)}
<add> */
<add>angular.Directive.scope;
<add>
<add>/**
<add> * @type {(string|undefined)}
<add> * TODO: This can also be a function which returns a string.
<add> */
<add>angular.Directive.template;
<add>
<add>/**
<add> * @type {(string|undefined)}
<add> */
<add>angular.Directive.templateUrl;
<add>
<add>/**
<add> * @type {(boolean|undefined)}
<add> */
<add>angular.Directive.terminal;
<add>
<add>/**
<add> * @type {(boolean|string|undefined)}
<add> */
<add>angular.Directive.transclude;
<add>
<add>/**
<add> * @typedef {{
<add> * addClass: function(string): angular.JQLite,
<add> * after: function(JQLiteSelector): angular.JQLite,
<add> * append: function(JQLiteSelector): angular.JQLite,
<add> * attr: function(string, (string|boolean)=): (angular.JQLite|string|boolean),
<add> * bind: function(string, Function): angular.JQLite,
<add> * children: function(): angular.JQLite,
<add> * clone: function(): angular.JQLite,
<add> * contents: function(): angular.JQLite,
<add> * controller: function(string=): Object,
<add> * css: function(string, string=): (angular.JQLite|string),
<add> * data: function(string=, *=): *,
<add> * eq: function(number): angular.JQLite,
<add> * find: function(string): angular.JQLite,
<add> * hasClass: function(string): boolean,
<add> * html: function(string=): (angular.JQLite|string),
<add> * inheritedData: function(string=, *=): *,
<add> * injector: function(): angular.$injector,
<add> * length: number,
<add> * next: function(): angular.JQLite,
<add> * on: function(string, Function): angular.JQLite,
<add> * off: function(string=, Function=): angular.JQLite,
<add> * parent: function(): angular.JQLite,
<add> * prepend: function(JQLiteSelector): angular.JQLite,
<add> * prop: function(string, *=): *,
<add> * ready: function(Function): angular.JQLite,
<add> * remove: function(): angular.JQLite,
<add> * removeAttr: function(string): angular.JQLite,
<add> * removeClass: function(string): angular.JQLite,
<add> * removeData: function(): angular.JQLite,
<add> * replaceWith: function(JQLiteSelector): angular.JQLite,
<add> * scope: function(): angular.Scope,
<add> * text: function(string=): (angular.JQLite|string),
<add> * toggleClass: function(string, boolean=): angular.JQLite,
<add> * triggerHandler: function(string, *=): angular.JQLite,
<add> * unbind: function(string=, Function=): angular.JQLite,
<add> * val: function(string=): (angular.JQLite|string),
<add> * wrap: function(JQLiteSelector): angular.JQLite
<add> * }}
<add> */
<add>angular.JQLite;
<add>
<add>/**
<add> * @param {string} name
<add> * @return {angular.JQLite}
<add> */
<add>angular.JQLite.addClass = function(name) {};
<add>
<add>/**
<add> * @param {JQLiteSelector} element
<add> * @return {angular.JQLite}
<add> */
<add>angular.JQLite.after = function(element) {};
<add>
<add>/**
<add> * @param {JQLiteSelector} element
<add> * @return {angular.JQLite}
<add> */
<add>angular.JQLite.append = function(element) {};
<add>
<add>/**
<add> * @param {string} name
<add> * @param {(string|boolean)=} opt_value
<add> * @return {angular.JQLite|string|boolean}
<add> */
<add>angular.JQLite.attr = function(name, opt_value) {};
<add>
<add>/**
<add> * @param {string} type
<add> * @param {Function} fn
<add> * @return {angular.JQLite}
<add> */
<add>angular.JQLite.bind = function(type, fn) {};
<add>
<add>/**
<add> * @return {angular.JQLite}
<add> */
<add>angular.JQLite.children = function() {};
<add>
<add>/**
<add> * @return {angular.JQLite}
<add> */
<add>angular.JQLite.clone = function() {};
<add>
<add>/**
<add> * @return {angular.JQLite}
<add> */
<add>angular.JQLite.contents = function() {};
<add>
<add>/**
<add> * @param {string=} opt_name
<add> * @return {Object}
<add> */
<add>angular.JQLite.controller = function(opt_name) {};
<add>
<add>/**
<add> * @param {string} name
<add> * @param {string=} opt_value
<add> * @return {angular.JQLite|string}
<add> */
<add>angular.JQLite.css = function(name, opt_value) {};
<add>
<add>/**
<add> * @param {string=} opt_key
<add> * @param {*=} opt_value
<add> * @return {*}
<add> */
<add>angular.JQLite.data = function(opt_key, opt_value) {};
<add>
<add>/**
<add> * @param {number} index
<add> * @return {angular.JQLite}
<add> */
<add>angular.JQLite.eq = function(index) {};
<add>
<add>/**
<add> * @param {string} selector
<add> * @return {angular.JQLite}
<add> */
<add>angular.JQLite.find = function(selector) {};
<add>
<add>/**
<add> * @param {string} name
<add> * @return {boolean}
<add> */
<add>angular.JQLite.hasClass = function(name) {};
<add>
<add>/**
<add> * @param {string=} opt_value
<add> * @return {angular.JQLite|string}
<add> */
<add>angular.JQLite.html = function(opt_value) {};
<add>
<add>/**
<add> * @param {string=} opt_key
<add> * @param {*=} opt_value
<add> * @return {*}
<add> */
<add>angular.JQLite.inheritedData = function(opt_key, opt_value) {};
<add>
<add>/**
<add> * @return {angular.$injector}
<add> */
<add>angular.JQLite.injector = function() {};
<add>
<add>/** @type {number} */
<add>angular.JQLite.length;
<add>
<add>/**
<add> * @return {angular.JQLite}
<add> */
<add>angular.JQLite.next = function() {};
<add>
<add>/**
<add> * @param {string} type
<add> * @param {Function} fn
<add> * @return {angular.JQLite}
<add> */
<add>angular.JQLite.on = function(type, fn) {};
<add>
<add>/**
<add> * @param {string=} opt_type
<add> * @param {Function=} opt_fn
<add> * @return {angular.JQLite}
<add> */
<add>angular.JQLite.off = function(opt_type, opt_fn) {};
<add>
<add>/**
<add> * @return {angular.JQLite}
<add> */
<add>angular.JQLite.parent = function() {};
<add>
<add>/**
<add> * @param {JQLiteSelector} element
<add> * @return {angular.JQLite}
<add> */
<add>angular.JQLite.prepend = function(element) {};
<add>
<add>/**
<add> * @param {string} name
<add> * @param {*=} opt_value
<add> * @return {*}
<add> */
<add>angular.JQLite.prop = function(name, opt_value) {};
<add>
<add>/**
<add> * @param {Function} fn
<add> * @return {angular.JQLite}
<add> */
<add>angular.JQLite.ready = function(fn) {};
<add>
<add>/**
<add> * @return {angular.JQLite}
<add> */
<add>angular.JQLite.remove = function() {};
<add>
<add>/**
<add> * @param {string} name
<add> * @return {angular.JQLite}
<add> */
<add>angular.JQLite.removeAttr = function(name) {};
<add>
<add>/**
<add> * @param {string} name
<add> * @return {angular.JQLite}
<add> */
<add>angular.JQLite.removeClass = function(name) {};
<add>
<add>/**
<add> * @return {angular.JQLite}
<add> */
<add>angular.JQLite.removeData = function() {};
<add>
<add>/**
<add> * @param {JQLiteSelector} element
<add> * @return {angular.JQLite}
<add> */
<add>angular.JQLite.replaceWith = function(element) {};
<add>
<add>/**
<add> * @return {angular.Scope}
<add> */
<add>angular.JQLite.scope = function() {};
<add>
<add>/**
<add> * @param {string=} opt_value
<add> * @return {angular.JQLite|string}
<add> */
<add>angular.JQLite.text = function(opt_value) {};
<add>
<add>/**
<add> * @param {string} name
<add> * @param {boolean=} opt_condition
<add> * @return {angular.JQLite}
<add> */
<add>angular.JQLite.toggleClass = function(name, opt_condition) {};
<add>
<add>/**
<add> * @param {string} type
<add> * @param {*=} opt_value
<add> * @return {angular.JQLite}
<add> */
<add>angular.JQLite.triggerHandler = function(type, opt_value) {};
<add>
<add>/**
<add> * @param {string=} opt_type
<add> * @param {Function=} opt_fn
<add> * @return {angular.JQLite}
<add> */
<add>angular.JQLite.unbind = function(opt_type, opt_fn) {};
<add>
<add>/**
<add> * @param {string=} opt_value
<add> * @return {angular.JQLite|string}
<add> */
<add>angular.JQLite.val = function(opt_value) {};
<add>
<add>/**
<add> * @param {JQLiteSelector} element
<add> * @return {angular.JQLite}
<add> */
<add>angular.JQLite.wrap = function(element) {};
<add>
<add>/**
<add> * @typedef {{
<add> * config: function((Function|Array.<string|Function>)):angular.Module,
<add> * constant: function(string, *):angular.Module,
<add> * controller:
<add> * (function(string, (Function|Array.<string|Function>)):angular.Module|
<add> * function(!Object.<(Function|Array.<string|Function>)>):angular.Module),
<add> * directive:
<add> * (function(string, (Function|Array.<string|Function>)):angular.Module|
<add> * function(!Object.<(Function|Array.<string|Function>)>):angular.Module),
<add> * factory:
<add> * function(string, (Function|Array.<string|Function>)):angular.Module,
<add> * filter:
<add> * function(string, (Function|Array.<string|Function>)):angular.Module,
<add> * name: string,
<add> * provider: function(string,
<add> * (Object|Function|Array.<string|Function>)):angular.Module,
<add> * requires: Array.<string>,
<add> * run: function((Function|Array.<string|Function>)):angular.Module,
<add> * service:
<add> * function(string, (Function|Array.<string|Function>)):angular.Module,
<add> * value: function(string, *):angular.Module
<add> * }}
<add> */
<add>angular.Module;
<add>
<add>/**
<add> * @param {Function|Array.<string|Function>} configFn
<add> * @return {angular.Module}
<add> */
<add>angular.Module.config = function(configFn) {};
<add>
<add>/**
<add> * @param {string} name
<add> * @param {*} object
<add> * @return {angular.Module}
<add> */
<add>angular.Module.constant = function(name, object) {};
<add>
<add>/**
<add> * @param {string} name
<add> * @param {Function|Array.<string|Function>} constructor
<add> * @return {angular.Module}
<add> */
<add>angular.Module.controller = function(name, constructor) {};
<add>
<add>/**
<add> * @param {string} name
<add> * @param {Function|Array.<string|Function>} directiveFactory
<add> * @return {angular.Module}
<add> */
<add>angular.Module.directive = function(name, directiveFactory) {};
<add>
<add>/**
<add> * @param {string} name
<add> * @param {Function|Array.<string|Function>} providerFunction
<add> * @return {angular.Module}
<add> */
<add>angular.Module.factory = function(name, providerFunction) {};
<add>
<add>/**
<add> * @param {string} name
<add> * @param {Function|Array.<string|Function>} filterFactory
<add> * @return {angular.Module}
<add> */
<add>angular.Module.filter = function(name, filterFactory) {};
<add>
<add>/**
<add> * @param {string} name
<add> * @param {Function|Array.<string|Function>} providerType
<add> * @return {angular.Module}
<add> */
<add>angular.Module.provider = function(name, providerType) {};
<add>
<add>/**
<add> * @param {Function|Array.<string|Function>} initializationFn
<add> * @return {angular.Module}
<add> */
<add>angular.Module.run = function(initializationFn) {};
<add>
<add>/**
<add> * @param {string} name
<add> * @param {Function|Array.<string|Function>} constructor
<add> * @return {angular.Module}
<add> */
<add>angular.Module.service = function(name, constructor) {};
<add>
<add>/**
<add> * @param {string} name
<add> * @param {*} object
<add> * @return {angular.Module}
<add> */
<add>angular.Module.value = function(name, object) {};
<add>
<add>/**
<add> * @type {string}
<add> */
<add>angular.Module.name = '';
<add>
<add>/**
<add> * @type {Array.<string>}
<add> */
<add>angular.Module.requires;
<add>
<add>/**
<add> * @typedef {{
<add> * $$phase: string,
<add> * $apply: function((string|function(angular.Scope))=):*,
<add> * $broadcast: function(string, ...[*]),
<add> * $destroy: function(),
<add> * $digest: function(),
<add> * $emit: function(string, ...[*]),
<add> * $eval: function((string|function(angular.Scope))=, Object=):*,
<add> * $evalAsync: function((string|function())=),
<add> * $id: string,
<add> * $new: function(boolean=):angular.Scope,
<add> * $on: function(string, function(angular.Scope.Event, ...[?])):function(),
<add> * $parent: angular.Scope,
<add> * $root: angular.Scope,
<add> * $watch: function(
<add> * (string|Function), (string|Function)=, boolean=):function()
<add> * }}
<add> */
<add>angular.Scope;
<add>
<add>/** @type {string} */
<add>angular.Scope.$$phase;
<add>
<add>/**
<add> * @param {(string|function(angular.Scope))=} opt_exp
<add> * @return {*}
<add> */
<add>angular.Scope.$apply = function(opt_exp) {};
<add>
<add>/**
<add> * @param {string} name
<add> * @param {...*} args
<add> */
<add>angular.Scope.$broadcast = function(name, args) {};
<add>
<add>angular.Scope.$destroy = function() {};
<add>
<add>angular.Scope.$digest = function() {};
<add>
<add>/**
<add> * @param {string} name
<add> * @param {...*} args
<add> */
<add>angular.Scope.$emit = function(name, args) {};
<add>
<add>/**
<add> * @param {(string|function())=} opt_exp
<add> * @param {Object=} opt_locals
<add> * @return {*}
<add> */
<add>angular.Scope.$eval = function(opt_exp, opt_locals) {};
<add>
<add>/**
<add> * @param {(string|function())=} opt_exp
<add> */
<add>angular.Scope.$evalAsync = function(opt_exp) {};
<add>
<add>/** @type {string} */
<add>angular.Scope.$id;
<add>
<add>/**
<add> * @param {boolean=} opt_isolate
<add> * @return {angular.Scope}
<add> */
<add>angular.Scope.$new = function(opt_isolate) {};
<add>
<add>/**
<add> * @param {string} name
<add> * @param {function(angular.Scope.Event, ...[?])} listener
<add> * @return {function()}
<add> */
<add>angular.Scope.$on = function(name, listener) {};
<add>
<add>/** @type {angular.Scope} */
<add>angular.Scope.$parent;
<add>
<add>/** @type {!angular.Scope} */
<add>angular.Scope.$root;
<add>
<add>/**
<add> * @param {string|Function} exp
<add> * @param {(string|Function)=} opt_listener
<add> * @param {boolean=} opt_objectEquality
<add> * @return {function()}
<add> */
<add>angular.Scope.$watch = function(exp, opt_listener, opt_objectEquality) {};
<add>
<add>/**
<add> * @typedef {{
<add> * currentScope: angular.Scope,
<add> * defaultPrevented: boolean,
<add> * name: string,
<add> * preventDefault: function(),
<add> * stopPropagation: function(),
<add> * targetScope: angular.Scope
<add> * }}
<add> */
<add>angular.Scope.Event;
<add>
<add>/** @type {angular.Scope} */
<add>angular.Scope.Event.currentScope;
<add>
<add>/** @type {boolean} */
<add>angular.Scope.Event.defaultPrevented;
<add>
<add>/** @type {string} */
<add>angular.Scope.Event.name;
<add>
<add>angular.Scope.Event.preventDefault = function() {};
<add>
<add>angular.Scope.Event.stopPropagation = function() {};
<add>
<add>/** @type {angular.Scope} */
<add>angular.Scope.Event.targetScope;
<add>
<add>/**
<add> * @type {Object}
<add> */
<add>angular.version = {};
<add>
<add>/**
<add> * @type {string}
<add> */
<add>angular.version.full = '';
<add>
<add>/**
<add> * @type {number}
<add> */
<add>angular.version.major = 0;
<add>
<add>/**
<add> * @type {number}
<add> */
<add>angular.version.minor = 0;
<add>
<add>/**
<add> * @type {number}
<add> */
<add>angular.version.dot = 0;
<add>
<add>/**
<add> * @type {string}
<add> */
<add>angular.version.codeName = '';
<add>
<add>/******************************************************************************
<add> * $anchorScroll Service
<add> *****************************************************************************/
<add>
<add>/**
<add> * @typedef {function()}
<add> */
<add>angular.$anchorScroll;
<add>
<add>/******************************************************************************
<add> * $anchorScrollProvider Service
<add> *****************************************************************************/
<add>
<add>/**
<add> * @typedef {{
<add> * disableAutoScrolling: function()
<add> * }}
<add> */
<add>angular.$anchorScrollProvider;
<add>
<add>/**
<add> * @type {function()}
<add> */
<add>angular.$anchorScrollProvider.disableAutoScrolling = function() {};
<add>
<add>/******************************************************************************
<add> * $compile Service
<add> *****************************************************************************/
<add>
<add>/**
<add> * @typedef {
<add> * function(
<add> * (JQLiteSelector|Object), function(angular.Scope, Function=)=, number=):
<add> * function(angular.Scope, function(Object, angular.Scope=)=): Object}
<add> */
<add>angular.$compile;
<add>
<add>/******************************************************************************
<add> * $cacheFactory Service
<add> *****************************************************************************/
<add>
<add>/**
<add> * @typedef {
<add> * function(string, angular.$cacheFactory.Options=):
<add> * !angular.$cacheFactory.Cache}
<add> */
<add>angular.$cacheFactory;
<add>
<add>/** @typedef {{capacity: (number|undefined)}} */
<add>angular.$cacheFactory.Options;
<add>
<add>/**
<add> * @typedef {{
<add> * info: function():angular.$cacheFactory.Cache.Info,
<add> * put: function(string, *),
<add> * get: function(string):*,
<add> * remove: function(string),
<add> * removeAll: function(),
<add> * destroy: function()
<add> * }}
<add> */
<add>angular.$cacheFactory.Cache;
<add>
<add>/**
<add> * @typedef {{
<add> * id: string,
<add> * size: number,
<add> * options: angular.$cacheFactory.Options
<add> * }}
<add> */
<add>angular.$cacheFactory.Cache.Info;
<add>
<add>/******************************************************************************
<add> * $exceptionHandler Service
<add> *****************************************************************************/
<add>
<add>/**
<add> * @typedef {function(Error, string=)}
<add> */
<add>angular.$exceptionHandler;
<add>
<add>/******************************************************************************
<add> * $filter Service
<add> *****************************************************************************/
<add>
<add>/**
<add> * @typedef {function(string): !Function}
<add> */
<add>angular.$filter;
<add>
<add>/**
<add> * The 'orderBy' filter is available through $filterProvider and AngularJS
<add> * injection; but is not accessed through a documented public API of AngularJS.
<add> * <p>In current AngularJS version the injection is satisfied by
<add> * angular.orderByFunction, where the implementation is found.
<add> * <p>See http://docs.angularjs.org/api/ng.filter:orderBy.
<add> * @typedef {function(Array,
<add> * (string|function(?):*|Array.<(string|function(?):*)>),
<add> * boolean=): Array}
<add> */
<add>angular.$filter.orderBy;
<add>
<add>/******************************************************************************
<add> * $filterProvider Service
<add> *****************************************************************************/
<add>
<add>/**
<add> * @typedef {{
<add> * register: function(string, (Function|Array.<string|Function>))
<add> * }}
<add> */
<add>angular.$filterProvider;
<add>
<add>/**
<add> * @param {string} name
<add> * @param {(Function|Array.<string|Function>)} fn
<add> */
<add>angular.$filterProvider.register = function(name, fn) {};
<add>
<add>/******************************************************************************
<add> * $http Service
<add> *****************************************************************************/
<add>
<add>/**
<add> * This is a typedef because the closure compiler does not allow
<add> * defining a type that is a function with properties.
<add> * If you are trying to use the $http service as a function, try
<add> * using one of the helper functions instead.
<add> * @typedef {{
<add> * delete: function(string, angular.$http.Config=):angular.$http.HttpPromise,
<add> * get: function(string, angular.$http.Config=):angular.$http.HttpPromise,
<add> * head: function(string, angular.$http.Config=):angular.$http.HttpPromise,
<add> * jsonp: function(string, angular.$http.Config=):angular.$http.HttpPromise,
<add> * post: function(string, *, angular.$http.Config=):angular.$http.HttpPromise,
<add> * put: function(string, *, angular.$http.Config=):angular.$http.HttpPromise,
<add> * defaults: angular.$http.Config,
<add> * pendingRequests: Array.<angular.$http.Config>
<add> * }}
<add> */
<add>angular.$http;
<add>
<add>/**
<add> * @typedef {{
<add> * cache: (boolean|angular.$cacheFactory.Cache|undefined),
<add> * data: (string|Object|undefined),
<add> * headers: (Object|undefined),
<add> * method: (string|undefined),
<add> * params: (Object.<(string|Object)>|undefined),
<add> * timeout: (number|undefined),
<add> * transformRequest:
<add> * (function((string|Object), Object):(string|Object)|
<add> * Array.<function((string|Object), Object):(string|Object)>|undefined),
<add> * transformResponse:
<add> * (function((string|Object), Object):(string|Object)|
<add> * Array.<function((string|Object), Object):(string|Object)>|undefined),
<add> * url: (string|undefined),
<add> * withCredentials: (boolean|undefined)
<add> * }}
<add> */
<add>angular.$http.Config;
<add>
<add>// /**
<add>// * This extern is currently incomplete as delete is a reserved word.
<add>// * To use delete, index $http.
<add>// * Example: $http['delete'](url, opt_config);
<add>// * @param {string} url
<add>// * @param {angular.$http.Config=} opt_config
<add>// * @return {angular.$http.HttpPromise}
<add>// */
<add>// angular.$http.delete = function(url, opt_config) {};
<add>
<add>/**
<add> * @param {string} url
<add> * @param {angular.$http.Config=} opt_config
<add> * @return {angular.$http.HttpPromise}
<add> */
<add>angular.$http.get = function(url, opt_config) {};
<add>
<add>/**
<add> * @param {string} url
<add> * @param {angular.$http.Config=} opt_config
<add> * @return {angular.$http.HttpPromise}
<add> */
<add>angular.$http.head = function(url, opt_config) {};
<add>
<add>/**
<add> * @param {string} url
<add> * @param {angular.$http.Config=} opt_config
<add> * @return {angular.$http.HttpPromise}
<add> */
<add>angular.$http.jsonp = function(url, opt_config) {};
<add>
<add>/**
<add> * @param {string} url
<add> * @param {*} data
<add> * @param {angular.$http.Config=} opt_config
<add> * @return {angular.$http.HttpPromise}
<add> */
<add>angular.$http.post = function(url, data, opt_config) {};
<add>
<add>/**
<add> * @param {string} url
<add> * @param {*} data
<add> * @param {angular.$http.Config=} opt_config
<add> * @return {angular.$http.HttpPromise}
<add> */
<add>angular.$http.put = function(url, data, opt_config) {};
<add>
<add>/**
<add> * @type {angular.$http.Config}
<add> */
<add>angular.$http.defaults;
<add>
<add>/**
<add> * @type {Array.<angular.$http.Config>}
<add> * @const
<add> */
<add>angular.$http.pendingRequests;
<add>
<add>/**
<add> * @typedef {function((string|Object), number,
<add> * function(string=): (string|Object|null), angular.$http.Config)}
<add> */
<add>angular.HttpCallback;
<add>
<add>/**
<add> * @typedef {{
<add> * then: function(
<add> * ?function(!angular.$http.Response),
<add> * ?function(!angular.$http.Response)=,
<add> * ?function(!angular.$http.Response)=): angular.$http.HttpPromise,
<add> * success: function(angular.HttpCallback): angular.$http.HttpPromise,
<add> * error: function(angular.HttpCallback): angular.$http.HttpPromise
<add> * }}
<add> */
<add>angular.$http.HttpPromise;
<add>
<add>/**
<add> * @param {?function(!angular.$http.Response)} successCallback
<add> * @param {?function(!angular.$http.Response)=} opt_errorCallback
<add> * @return {angular.$http.HttpPromise}
<add> */
<add>angular.$http.HttpPromise.then = function(
<add> successCallback, opt_errorCallback) {};
<add>
<add>/**
<add> * @param {angular.HttpCallback} callback
<add> * @return {!angular.$http.HttpPromise} Promise for chaining.
<add> */
<add>angular.$http.HttpPromise.success = function(callback) {};
<add>
<add>/**
<add> * @param {angular.HttpCallback} callback
<add> * @return {!angular.$http.HttpPromise} Promise for chaining.
<add> */
<add>angular.$http.HttpPromise.error = function(callback) {};
<add>
<add>/**
<add> * @typedef {{
<add> * data: (string|Object),
<add> * status: number,
<add> * headers: function(string=): (string|Object),
<add> * config: !angular.$http.Config
<add> * }}
<add> */
<add>angular.$http.Response;
<add>
<add>/******************************************************************************
<add> * $injector Service
<add> *****************************************************************************/
<add>
<add>/**
<add> * @typedef {{
<add> * annotate: function((Function|Array.<string|Function>)):Array.<string>,
<add> * get: function(string):(?),
<add> * instantiate: function(Function, Object=):Object,
<add> * invoke: function(
<add> * (Function|Array.<string|Function>), Object=, Object=):(?)
<add> * }}
<add> */
<add>angular.$injector;
<add>
<add>/**
<add> * @param {(Function|Array.<string|Function>)} fn
<add> * @return {Array.<string>}
<add> */
<add>angular.$injector.annotate = function(fn) {};
<add>
<add>/**
<add> * @param {string} name
<add> * @return {?}
<add> */
<add>angular.$injector.get = function(name) {};
<add>
<add>/**
<add> * @param {Function} type
<add> * @param {Object=} opt_locals
<add> * @return {Object}
<add> */
<add>angular.$injector.instantiate = function(type, opt_locals) {};
<add>
<add>/**
<add> * @param {(Function|Array.<string|Function>)} fn
<add> * @param {Object=} opt_self
<add> * @param {Object=} opt_locals
<add> * @return {?}
<add> */
<add>angular.$injector.invoke = function(fn, opt_self, opt_locals) {};
<add>
<add>/******************************************************************************
<add> * $interpolateProvider Service
<add> *****************************************************************************/
<add>
<add>/**
<add> * @typedef {{
<add> * startSymbol: function(string),
<add> * endSymbol: function(string)
<add> * }}
<add> */
<add>angular.$interpolateProvider;
<add>
<add>/** @type {function(string)} */
<add>angular.$interpolateProvider.startSymbol;
<add>
<add>/** @type {function(string)} */
<add>angular.$interpolateProvider.endSymbol;
<add>
<add>/******************************************************************************
<add> * $location Service
<add> *****************************************************************************/
<add>
<add>/**
<add> * @typedef {{
<add> * absUrl: function():string,
<add> * hash: function(string=):string,
<add> * host: function():string,
<add> * path: function(string=):(string|angular.$location),
<add> * port: function():number,
<add> * protocol: function():string,
<add> * replace: function(),
<add> * search: function((string|Object.<string, string>)=, ?string=):
<add> * (string|!Object.<string, string>),
<add> * url: function(string=):string
<add> * }}
<add> */
<add>angular.$location;
<add>
<add>/**
<add> * @return {string}
<add> */
<add>angular.$location.absUrl = function() {};
<add>
<add>/**
<add> * @param {string=} opt_hash
<add> * @return {string}
<add> */
<add>angular.$location.hash = function(opt_hash) {};
<add>
<add>/**
<add> * @return {string}
<add> */
<add>angular.$location.host = function() {};
<add>
<add>/**
<add> * @param {string=} opt_path
<add> * @return {string|angular.$location}
<add> */
<add>angular.$location.path = function(opt_path) {};
<add>
<add>/**
<add> * @return {number}
<add> */
<add>angular.$location.port = function() {};
<add>
<add>/**
<add> * @return {string}
<add> */
<add>angular.$location.protocol = function() {};
<add>
<add>/**
<add> * @type {function()}
<add> */
<add>angular.$location.replace = function() {};
<add>
<add>/**
<add> * @param {(string|Object.<string, string>)=} opt_search
<add> * @param {?string=} opt_paramValue
<add> * @return {string|!Object.<string, string>}
<add> */
<add>angular.$location.search = function(opt_search, opt_paramValue) {};
<add>
<add>/**
<add> * @param {string=} opt_url
<add> * @return {string}
<add> */
<add>angular.$location.url = function(opt_url) {};
<add>
<add>/******************************************************************************
<add> * $locationProvider Service
<add> *****************************************************************************/
<add>
<add>/**
<add> * @typedef {{
<add> * hashPrefix:
<add> * function(string=): (string|angular.$locationProvider),
<add> * html5Mode:
<add> * function(boolean=): (boolean|angular.$locationProvider)
<add> * }}
<add> */
<add>angular.$locationProvider;
<add>
<add>/**
<add> * @param {string=} opt_prefix
<add> * @return {string|angular.$locationProvider}
<add> */
<add>angular.$locationProvider.hashPrefix = function(opt_prefix) {};
<add>
<add>/**
<add> * @param {boolean=} opt_enabled
<add> * @return {boolean|angular.$locationProvider}
<add> */
<add>angular.$locationProvider.html5Mode = function(opt_enabled) {};
<add>
<add>/******************************************************************************
<add> * $log Service
<add> *****************************************************************************/
<add>
<add>/**
<add> * @typedef {{
<add> * error: function(...[*]),
<add> * info: function(...[*]),
<add> * log: function(...[*]),
<add> * warn: function(...[*])
<add> * }}
<add> */
<add>angular.$log;
<add>
<add>/**
<add> * @param {...*} var_args
<add> */
<add>angular.$log.error = function(var_args) {};
<add>
<add>/**
<add> * @param {...*} var_args
<add> */
<add>angular.$log.info = function(var_args) {};
<add>
<add>/**
<add> * @param {...*} var_args
<add> */
<add>angular.$log.log = function(var_args) {};
<add>
<add>/**
<add> * @param {...*} var_args
<add> */
<add>angular.$log.warn = function(var_args) {};
<add>
<add>/******************************************************************************
<add> * NgModelController
<add> *****************************************************************************/
<add>
<add>/**
<add> * @constructor
<add> */
<add>angular.NgModelController = function() {};
<add>
<add>/**
<add> * @type {?}
<add> */
<add>angular.NgModelController.prototype.$modelValue;
<add>
<add>/**
<add> * @type {boolean}
<add> */
<add>angular.NgModelController.prototype.$dirty;
<add>
<add>/**
<add> * @type {!Object.<boolean>}
<add> */
<add>angular.NgModelController.prototype.$error;
<add>
<add>/**
<add> * @type {!Array.<function(?):*>}
<add> */
<add>angular.NgModelController.prototype.$formatters;
<add>
<add>/**
<add> * @type {boolean}
<add> */
<add>angular.NgModelController.prototype.$invalid;
<add>
<add>/**
<add> * @type {!Array.<function(?):*>}
<add> */
<add>angular.NgModelController.prototype.$parsers;
<add>
<add>/**
<add> * @type {boolean}
<add> */
<add>angular.NgModelController.prototype.$pristine;
<add>
<add>angular.NgModelController.prototype.$render = function() {};
<add>
<add>/**
<add> * @param {string} key
<add> * @param {boolean} isValid
<add> */
<add>angular.NgModelController.prototype.$setValidity = function(key, isValid) {};
<add>
<add>/**
<add> * @param {?} value
<add> */
<add>angular.NgModelController.prototype.$setViewValue = function(value) {};
<add>
<add>/**
<add> * @type {boolean}
<add> */
<add>angular.NgModelController.prototype.$valid;
<add>
<add>/**
<add> * @type {!Array.<function()>}
<add> */
<add>angular.NgModelController.prototype.$viewChangeListeners;
<add>
<add>/**
<add> * @type {?}
<add> */
<add>angular.NgModelController.prototype.$viewValue;
<add>
<add>/******************************************************************************
<add> * FormController
<add> *****************************************************************************/
<add>
<add>/**
<add> * @constructor
<add> */
<add>angular.FormController = function() {};
<add>
<add>/**
<add> * @type {boolean}
<add> */
<add>angular.FormController.prototype.$dirty;
<add>
<add>/**
<add> * @type {!Object.<boolean>}
<add> */
<add>angular.FormController.prototype.$error;
<add>
<add>/**
<add> * @type {boolean}
<add> */
<add>angular.FormController.prototype.$invalid;
<add>
<add>/**
<add> * @type {boolean}
<add> */
<add>angular.FormController.prototype.$pristine;
<add>
<add>/**
<add> * @type {boolean}
<add> */
<add>angular.FormController.prototype.$valid;
<add>
<add>/******************************************************************************
<add> * $parse Service
<add> *****************************************************************************/
<add>
<add>/**
<add> * @typedef {function(string):!angular.$parse.Expression}
<add> */
<add>angular.$parse;
<add>
<add>/**
<add> * @typedef {function((!angular.Scope|!Object), Object=):*}
<add> */
<add>angular.$parse.Expression;
<add>
<add>/**
<add> * Augment the angular.$parse.Expression type definition by reopening the type
<add> * via an artificial angular.$parse instance.
<add> *
<add> * This allows us to define methods on function objects which is something
<add> * that can't be expressed via typical type annotations.
<add> *
<add> * @type {angular.$parse.Expression}
<add> */
<add>angular.$parse_;
<add>
<add>/**
<add> * @type {function((!angular.Scope|!Object), *)}
<add> */
<add>angular.$parse_.assign = function(scope, newValue) {};
<add>
<add>/******************************************************************************
<add> * $provide Service
<add> *****************************************************************************/
<add>
<add>/**
<add> * @typedef {{
<add> * constant: function(string, *): Object,
<add> * decorator: function(string, (Function|Array.<string|Function>)),
<add> * factory: function(string, (Function|Array.<string|Function>)): Object,
<add> * provider: function(string, (Function|Array.<string|Function>)): Object,
<add> * service: function(string, (Function|Array.<string|Function>)): Object,
<add> * value: function(string, *): Object
<add> * }}
<add> */
<add>angular.$provide;
<add>
<add>/**
<add> * @param {string} name
<add> * @param {*} object
<add> * @return {Object}
<add> */
<add>angular.$provide.constant = function(name, object) {};
<add>
<add>/**
<add> * @param {string} name
<add> * @param {Function|Array.<string|Function>} decorator
<add> */
<add>angular.$provide.decorator = function(name, decorator) {};
<add>
<add>/**
<add> * @param {string} name
<add> * @param {Function|Array.<string|Function>} providerFunction
<add> * @return {Object}
<add> */
<add>angular.$provide.factory = function(name, providerFunction) {};
<add>
<add>/**
<add> * @param {string} name
<add> * @param {Function|Array.<string|Function>} providerType
<add> * @return {Object}
<add> */
<add>angular.$provide.provider = function(name, providerType) {};
<add>
<add>/**
<add> * @param {string} name
<add> * @param {Function|Array.<string|Function>} constructor
<add> * @return {Object}
<add> */
<add>angular.$provide.service = function(name, constructor) {};
<add>
<add>/**
<add> * @param {string} name
<add> * @param {*} object
<add> * @return {Object}
<add> */
<add>angular.$provide.value = function(name, object) {};
<add>
<add>/******************************************************************************
<add> * $q Service
<add> *****************************************************************************/
<add>
<add>/**
<add> * @typedef {{
<add> * all: function(Array.<angular.$q.Promise>): angular.$q.Promise,
<add> * defer: function():angular.$q.Deferred,
<add> * reject: function(*):angular.$q.Promise,
<add> * when: function(*):angular.$q.Promise
<add> * }}
<add> */
<add>angular.$q;
<add>
<add>/**
<add> * @param {Array.<angular.$q.Promise>} promises
<add> * @return {angular.$q.Promise}
<add> */
<add>angular.$q.all = function(promises) {};
<add>
<add>/**
<add> * @return {angular.$q.Deferred}
<add> */
<add>angular.$q.defer = function() {};
<add>
<add>/**
<add> * @param {*} reason
<add> * @return {angular.$q.Promise}
<add> */
<add>angular.$q.reject = function(reason) {};
<add>
<add>/**
<add> * @param {*} value
<add> * @return {angular.$q.Promise}
<add> */
<add>angular.$q.when = function(value) {};
<add>
<add>/**
<add> * @typedef {{
<add> * resolve: function(*=),
<add> * reject: function(*=),
<add> * promise: angular.$q.Promise
<add> * }}
<add> */
<add>angular.$q.Deferred;
<add>
<add>/** @param {*=} opt_value */
<add>angular.$q.Deferred.resolve = function(opt_value) {};
<add>
<add>/** @param {*=} opt_reason */
<add>angular.$q.Deferred.reject = function(opt_reason) {};
<add>
<add>/** @type {angular.$q.Promise} */
<add>angular.$q.Deferred.promise;
<add>
<add>/**
<add> * @typedef {{then: function(?function(?), ?function(?)=, ?function(?)=):
<add> * angular.$q.Promise}}
<add> */
<add>angular.$q.Promise;
<add>
<add>/**
<add> * @param {?function(?)} successCallback
<add> * @param {?function(?)=} opt_errorCallback
<add> * @return {angular.$q.Promise}
<add> */
<add>angular.$q.Promise.then = function(successCallback, opt_errorCallback) {};
<add>
<add>/******************************************************************************
<add> * $route Service
<add> *****************************************************************************/
<add>
<add>/**
<add> * @typedef {{
<add> * reload: function(),
<add> * current: angular.$route.Route,
<add> * routes: Array.<angular.$route.Route>
<add> * }}
<add> */
<add>angular.$route;
<add>
<add>/** @type {function()} */
<add>angular.$route.reload = function() {};
<add>
<add>/** @type {angular.$route.Route} */
<add>angular.$route.current;
<add>
<add>/** @type {Array.<angular.$route.Route>} */
<add>angular.$route.routes;
<add>
<add>/**
<add> * @typedef {{
<add> * $route: angular.$routeProvider.Params,
<add> * locals: Object.<string, *>,
<add> * params: Object.<string, string>,
<add> * pathParams: Object.<string, string>,
<add> * scope: Object.<string, *>
<add> * }}
<add> */
<add>angular.$route.Route;
<add>
<add>/** @type {angular.$routeProvider.Params} */
<add>angular.$route.Route.$route;
<add>
<add>/** @type {Object.<string, *>} */
<add>angular.$route.Route.locals;
<add>
<add>/** @type {Object.<string, string>} */
<add>angular.$route.Route.params;
<add>
<add>/** @type {Object.<string, string>} */
<add>angular.$route.Route.pathParams;
<add>
<add>/** @type {Object.<string, *>} */
<add>angular.$route.Route.scope;
<add>
<add>/******************************************************************************
<add> * $routeProvider Service
<add> *****************************************************************************/
<add>
<add>/**
<add> * @typedef {{
<add> * otherwise:
<add> * function(angular.$routeProvider.Params): angular.$routeProvider,
<add> * when:
<add> * function(
<add> * string, angular.$routeProvider.Params): angular.$routeProvider
<add> * }}
<add> */
<add>angular.$routeProvider;
<add>
<add>/**
<add> * @param {angular.$routeProvider.Params} params
<add> * @return {angular.$routeProvider}
<add> */
<add>angular.$routeProvider.otherwise = function(params) {};
<add>
<add>/**
<add> * @param {string} path
<add> * @param {angular.$routeProvider.Params} route
<add> * @return {angular.$routeProvider}
<add> */
<add>angular.$routeProvider.when = function(path, route) {};
<add>
<add>/**
<add> * @typedef {{
<add> * controller: (Function|Array.<string|Function>|string|undefined),
<add> * template: (string|undefined),
<add> * templateUrl: (string|undefined),
<add> * resolve: (Object.<string, (
<add> * string|Function|Array.<string|Function>|angular.$q.Promise
<add> * )>|undefined),
<add> * redirectTo: (string|function()|undefined),
<add> * reloadOnSearch: (boolean|undefined)
<add> * }}
<add> */
<add>angular.$routeProvider.Params;
<add>
<add>/** @type {Function|Array.<string|Function>|string} */
<add>angular.$routeProvider.Params.controller;
<add>
<add>/** @type {string} */
<add>angular.$routeProvider.Params.template;
<add>
<add>/** @type {string} */
<add>angular.$routeProvider.Params.templateUrl;
<add>
<add>/**
<add> * @type {
<add> * Object.<string, (
<add> * string|Function|Array.<string|Function>|angular.$q.Promise
<add> * )>}
<add> */
<add>angular.$routeProvider.Params.resolve;
<add>
<add>/** @type {string|function()} */
<add>angular.$routeProvider.Params.redirectTo;
<add>
<add>/** @type {boolean} */
<add>angular.$routeProvider.Params.reloadOnSearch;
<add>
<add>
<add>/******************************************************************************
<add> * $sce Service
<add> *****************************************************************************/
<add>
<add>/**
<add> * Ref: http://docs.angularjs.org/api/ng.$sce
<add> *
<add> * @typedef {{
<add> * HTML: string,
<add> * CSS: string,
<add> * URL: string,
<add> * JS: string,
<add> * RESOURCE_URL: string,
<add> * isEnabled: function(): boolean,
<add> * parseAs: function(string, string): !angular.$parse.Expression,
<add> * getTrusted: function(string, *): string,
<add> * trustAs: function(string, string): *,
<add> * parseAsHtml: function(string): !angular.$parse.Expression,
<add> * parseAsCss: function(string): !angular.$parse.Expression,
<add> * parseAsUrl: function(string): !angular.$parse.Expression,
<add> * parseAsJs: function(string): !angular.$parse.Expression,
<add> * parseAsResourceUrl: function(string): !angular.$parse.Expression,
<add> * getTrustedHtml: function(*): string,
<add> * getTrustedCss: function(*): string,
<add> * getTrustedUrl: function(*): string,
<add> * getTrustedJs: function(*): string,
<add> * getTrustedResourceUrl: function(*): string,
<add> * trustAsHtml: function(string): *,
<add> * trustAsCss: function(string): *,
<add> * trustAsUrl: function(string): *,
<add> * trustAsJs: function(string): *,
<add> * trustAsResourceUrl: function(string): *
<add> * }}
<add> *****************************************************************************/
<add>angular.$sce;
<add>
<add>
<add>/** @const {string} */
<add>angular.$sce.HTML;
<add>
<add>/** @const {string} */
<add>angular.$sce.CSS;
<add>
<add>/** @const {string} */
<add>angular.$sce.URL;
<add>
<add>/** @const {string} */
<add>angular.$sce.JS;
<add>
<add>/** @const {string} */
<add>angular.$sce.RESOURCE_URL;
<add>
<add>/** @return {boolean} */
<add>angular.$sce.isEnabled = function() {};
<add>
<add>/**
<add> * @param {string} type
<add> * @param {string} expression
<add> * @return {!angular.$parse.Expression}
<add> */
<add>angular.$sce.parseAs = function(type, expression) {};
<add>
<add>/**
<add> * @param {string} type
<add> * @param {*} maybeTrusted
<add> * @return {string}
<add> */
<add>angular.$sce.getTrusted = function(type, maybeTrusted) {};
<add>
<add>/**
<add> * @param {string} type
<add> * @param {string} trustedValue
<add> * @return {*}
<add> */
<add>angular.$sce.trustAs = function(type, trustedValue) {};
<add>
<add>/**
<add> * @param {string} expression
<add> * @return {!angular.$parse.Expression}
<add> */
<add>angular.$sce.parseAsHtml = function(expression) {};
<add>
<add>/**
<add> * @param {string} expression
<add> * @return {!angular.$parse.Expression}
<add> */
<add>angular.$sce.parseAsCss = function(expression) {};
<add>
<add>/**
<add> * @param {string} expression
<add> * @return {!angular.$parse.Expression}
<add> */
<add>angular.$sce.parseAsUrl = function(expression) {};
<add>
<add>/**
<add> * @param {string} expression
<add> * @return {!angular.$parse.Expression}
<add> */
<add>angular.$sce.parseAsJs = function(expression) {};
<add>
<add>/**
<add> * @param {string} expression
<add> * @return {!angular.$parse.Expression}
<add> */
<add>angular.$sce.parseAsResourceUrl = function(expression) {};
<add>
<add>/**
<add> * @param {*} maybeTrusted
<add> * @return {string}
<add> */
<add>angular.$sce.getTrustedHtml = function(maybeTrusted) {};
<add>
<add>/**
<add> * @param {*} maybeTrusted
<add> * @return {string}
<add> */
<add>angular.$sce.getTrustedCss = function(maybeTrusted) {};
<add>
<add>/**
<add> * @param {*} maybeTrusted
<add> * @return {string}
<add> */
<add>angular.$sce.getTrustedUrl = function(maybeTrusted) {};
<add>
<add>/**
<add> * @param {*} maybeTrusted
<add> * @return {string}
<add> */
<add>angular.$sce.getTrustedJs = function(maybeTrusted) {};
<add>
<add>/**
<add> * @param {*} maybeTrusted
<add> * @return {string}
<add> */
<add>angular.$sce.getTrustedResourceUrl = function(maybeTrusted) {};
<add>
<add>/**
<add> * @param {string} trustedValue
<add> * @return {*}
<add> */
<add>angular.$sce.trustAsHtml = function(trustedValue) {};
<add>
<add>/**
<add> * @param {string} trustedValue
<add> * @return {*}
<add> */
<add>angular.$sce.trustAsCss = function(trustedValue) {};
<add>
<add>/**
<add> * @param {string} trustedValue
<add> * @return {*}
<add> */
<add>angular.$sce.trustAsUrl = function(trustedValue) {};
<add>
<add>/**
<add> * @param {string} trustedValue
<add> * @return {*}
<add> */
<add>angular.$sce.trustAsJs = function(trustedValue) {};
<add>
<add>/**
<add> * @param {string} trustedValue
<add> * @return {*}
<add> */
<add>angular.$sce.trustAsResourceUrl = function(trustedValue) {};
<add>
<add>
<add>/******************************************************************************
<add> * $timeout Service
<add> *****************************************************************************/
<add>
<add>/**
<add> * @typedef {function(function(), number=, boolean=):angular.$q.Promise}
<add> */
<add>angular.$timeout;
<add>
<add>/**
<add> * Augment the angular.$timeout type definition by reopening the type via an
<add> * artificial angular.$timeout instance.
<add> *
<add> * This allows us to define methods on function objects which is something
<add> * that can't be expressed via typical type annotations.
<add> *
<add> * @type {angular.$timeout}
<add> */
<add>angular.$timeout_;
<add>
<add>/**
<add> * @type {function(angular.$q.Promise):boolean}
<add> */
<add>angular.$timeout_.cancel = function(promise) {}; | 2 |
Ruby | Ruby | wrap everything in class << self | 226ea0e9e817a2e449d989d925c36cf6a4cfd67b | <ide><path>actionpack/lib/action_dispatch/http/url.rb
<ide> module URL
<ide> mattr_accessor :tld_length
<ide> self.tld_length = 1
<ide>
<del> def self.extract_domain(host, tld_length = @@tld_length)
<del> return nil unless named_host?(host)
<del>
<del> host.split('.').last(1 + tld_length).join('.')
<del> end
<del>
<del> def self.extract_subdomains(host, tld_length = @@tld_length)
<del> return [] unless named_host?(host)
<del> parts = host.split('.')
<del> parts[0..-(tld_length+2)]
<del> end
<del>
<del> def self.extract_subdomain(host, tld_length = @@tld_length)
<del> extract_subdomains(host, tld_length).join('.')
<del> end
<add> class << self
<add> def extract_domain(host, tld_length = @@tld_length)
<add> return nil unless named_host?(host)
<add> host.split('.').last(1 + tld_length).join('.')
<add> end
<ide>
<del> def self.named_host?(host)
<del> !(host.nil? || /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.match(host))
<del> end
<add> def extract_subdomains(host, tld_length = @@tld_length)
<add> return [] unless named_host?(host)
<add> parts = host.split('.')
<add> parts[0..-(tld_length+2)]
<add> end
<ide>
<del> def self.url_for(options = {})
<del> unless options[:host].present? || options[:only_path].present?
<del> raise ArgumentError, 'Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true'
<add> def extract_subdomain(host, tld_length = @@tld_length)
<add> extract_subdomains(host, tld_length).join('.')
<ide> end
<ide>
<del> rewritten_url = ""
<add> def url_for(options = {})
<add> unless options[:host].present? || options[:only_path].present?
<add> raise ArgumentError, 'Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true'
<add> end
<ide>
<del> unless options[:only_path]
<del> rewritten_url << (options[:protocol] || "http")
<del> rewritten_url << "://" unless rewritten_url.match("://")
<del> rewritten_url << rewrite_authentication(options)
<del> rewritten_url << host_or_subdomain_and_domain(options)
<del> rewritten_url << ":#{options.delete(:port)}" if options[:port]
<del> end
<add> rewritten_url = ""
<ide>
<del> path = options.delete(:path) || ''
<add> unless options[:only_path]
<add> rewritten_url << (options[:protocol] || "http")
<add> rewritten_url << "://" unless rewritten_url.match("://")
<add> rewritten_url << rewrite_authentication(options)
<add> rewritten_url << host_or_subdomain_and_domain(options)
<add> rewritten_url << ":#{options.delete(:port)}" if options[:port]
<add> end
<ide>
<del> params = options[:params] || {}
<del> params.reject! {|k,v| !v }
<add> path = options.delete(:path) || ''
<ide>
<del> rewritten_url << (options[:trailing_slash] ? path.sub(/\?|\z/) { "/" + $& } : path)
<del> rewritten_url << "?#{params.to_query}" unless params.empty?
<del> rewritten_url << "##{Rack::Mount::Utils.escape_uri(options[:anchor].to_param.to_s)}" if options[:anchor]
<del> rewritten_url
<del> end
<add> params = options[:params] || {}
<add> params.reject! {|k,v| !v }
<add>
<add> rewritten_url << (options[:trailing_slash] ? path.sub(/\?|\z/) { "/" + $& } : path)
<add> rewritten_url << "?#{params.to_query}" unless params.empty?
<add> rewritten_url << "##{Rack::Mount::Utils.escape_uri(options[:anchor].to_param.to_s)}" if options[:anchor]
<add> rewritten_url
<add> end
<ide>
<del> class << self
<ide> private
<ide>
<add> def named_host?(host)
<add> !(host.nil? || /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.match(host))
<add> end
<add>
<ide> def rewrite_authentication(options)
<ide> if options[:user] && options[:password]
<ide> "#{Rack::Utils.escape(options[:user])}:#{Rack::Utils.escape(options[:password])}@"
<ide> def host_or_subdomain_and_domain(options)
<ide> host << (options[:domain] || extract_domain(options[:host], tld_length))
<ide> host
<ide> end
<del>
<ide> end
<ide>
<del>
<del>
<ide> # Returns the complete URL used for this request.
<ide> def url
<ide> protocol + host_with_port + fullpath
<ide> def subdomains(tld_length = @@tld_length)
<ide> def subdomain(tld_length = @@tld_length)
<ide> subdomains(tld_length)
<ide> end
<del>
<ide> end
<ide> end
<ide> end | 1 |
Text | Text | add my changes to the article | d351655d1382a6aa11767c0555d47a3fd59db6bd | <ide><path>guide/russian/accessibility/index.md
<ide> localeTitle: доступность
<ide> ## доступность
<ide>
<ide> **Доступность в Интернете означает, что люди с ограниченными возможностями могут пользоваться Интернетом** .
<add>В широком смысле, когда мы говорим, что сайт доступен, мы имеем ввиду, что контент сайта доступен и его функционалом может воспользоваться буквально кто угодно.
<ide>
<add>Доступность относится к пользователям, которые могут выходить за рамки узкого понятия "типичный" пользователь, к пользователяим, которые могут иметь доступ или взаимодействовать с вещами не так, как вы ожидаете. В частности, это касается пользователей, у которых имеются некоторые нарушения или инвалидность — и имейте в виду, что это всё может быть нефизическим или временным.
<ide> Более конкретно, доступность в Интернете означает, что люди с ограниченными возможностями могут воспринимать, понимать, перемещаться и взаимодействовать с Интернетом и что они могут вносить вклад в Интернет. Доступность в Интернете также приносит пользу другим, включая [пожилых людей](https://www.w3.org/WAI/bcase/soc.html#of) с изменяющимися способностями из-за старения.
<ide>
<add>Xотя мы и склонны сосредотачивать наше обсуждение доступности на пользователях с физическими нарушениями, всем нам знаком опыт использования интерфейса недоступного для нас по другим причинам. У вас когда-нибудь были проблемы с использованием сайта на мобильном телефоне, или вы видели сообщение "Этот контент недоступен в вашем регионе", или вы не могли найти знакомое меню на планшете? Все это проблемы доступности.
<add>
<add>Как станет ясно в дальнейшем, когда вы решаете проблемы доступности в этом, более широком, более глобальном смысле, это почти всегда улучшает пользовательский опыт для всех.
<add>
<ide> Доступность в Интернете включает в себя все ограничения, влияющие на доступ к Интернету, включая визуальные, слуховые, физические, речевые, когнитивные и неврологические инвалиды. Документ « [Как люди с ограниченными возможностями используют Интернет»](http://www.w3.org/WAI/intro/people-use-web/Overview.html) описывает, как различные инвалиды влияют на использование в Интернете и включают в себя сценарии людей с ограниченными возможностями с использованием Интернета.
<ide>
<ide> Доступность в Интернете также **приносит пользу** людям _без_ инвалидности. Например, ключевым принципом доступности Интернета является создание веб-сайтов и программного обеспечения которые являются гибкими для удовлетворения различных потребностей пользователей, предпочтений и ситуаций. Эта **гибкость** также приносит пользу людям _без_ ситуации, такие как люди, использующие медленное подключение к Интернету, люди с «временными ограничениями», такими как сломанная рука, и люди с изменяющимися способностями из-за старения. В документе « [Разработка бизнес-кейса для веб-доступности для вашей организации»](https://www.w3.org/WAI/bcase/Overview) описаны многие различные преимущества доступности Интернета, включая **преимущества для организаций** .
<ide> Copyright © 2005 [World Wide Web Consortium](http://www.w3.org) , ( [MIT](http:
<ide>
<ide> ### Дополнительная информация:
<ide>
<del>[w3.org введение в доступность.](https://www.w3.org/WAI/intro/accessibility.php) [Проект A11Y](http://a11yproject.com/)
<ide>\ No newline at end of file
<add>[w3.org введение в доступность.](https://www.w3.org/WAI/intro/accessibility.php) [Проект A11Y](http://a11yproject.com/)
<add>Доступность (https://developers.google.com/web/fundamentals/accessibility/?hl=ru) | 1 |
Javascript | Javascript | watch the original value and sanitize later | 068d8615d245a70bfde9007606b08a54c6e1cfec | <ide><path>src/ng/directive/ngBind.js
<ide> var ngBindTemplateDirective = ['$interpolate', function($interpolate) {
<ide> var ngBindHtmlDirective = ['$sce', function($sce) {
<ide> return function(scope, element, attr) {
<ide> element.addClass('ng-binding').data('$binding', attr.ngBindHtml);
<del> scope.$watch($sce.parseAsHtml(attr.ngBindHtml), function ngBindHtmlWatchAction(value) {
<del> element.html(value || '');
<add> scope.$watch(attr.ngBindHtml, function ngBindHtmlWatchAction(value) {
<add> element.html($sce.getTrustedHtml(value) || '');
<ide> });
<ide> };
<ide> }]; | 1 |
Javascript | Javascript | change common.fixturesdir to fixtures.path | 9b3d6a0d8f77933b38af4d02dfb48f2242f76a50 | <ide><path>test/parallel/test-require-exceptions.js
<ide> 'use strict';
<ide> const common = require('../common');
<ide> const assert = require('assert');
<add>const fixtures = require('../common/fixtures');
<ide>
<ide> // A module with an error in it should throw
<ide> assert.throws(function() {
<del> require(`${common.fixturesDir}/throws_error`);
<add> require(fixtures.path('/throws_error'));
<ide> }, /^Error: blah$/);
<ide>
<ide> // Requiring the same module again should throw as well
<ide> assert.throws(function() {
<del> require(`${common.fixturesDir}/throws_error`);
<add> require(fixtures.path('/throws_error'));
<ide> }, /^Error: blah$/);
<ide>
<ide> // Requiring a module that does not exist should throw an
<ide> assertModuleNotFound('/module-require/not-found/trailingSlash');
<ide>
<ide> function assertModuleNotFound(path) {
<ide> assert.throws(function() {
<del> require(common.fixturesDir + path);
<add> require(fixtures.path(path));
<ide> }, function(e) {
<ide> assert.strictEqual(e.code, 'MODULE_NOT_FOUND');
<ide> return true;
<ide> });
<ide> }
<ide>
<ide> function assertExists(fixture) {
<del> assert(common.fileExists(common.fixturesDir + fixture));
<add> assert(common.fileExists(fixtures.path(fixture)));
<ide> } | 1 |
Python | Python | fix mypy errors at bfs_shortest_path algo | c5003a2c462c7c775992ad9a733c360126702dd4 | <ide><path>graphs/breadth_first_search_shortest_path.py
<ide> """
<ide> from __future__ import annotations
<ide>
<add>from typing import Optional
<add>
<ide> graph = {
<ide> "A": ["B", "C", "E"],
<ide> "B": ["A", "D", "E"],
<ide>
<ide>
<ide> class Graph:
<del> def __init__(self, graph: dict[str, str], source_vertex: str) -> None:
<del> """Graph is implemented as dictionary of adjacency lists. Also,
<add> def __init__(self, graph: dict[str, list[str]], source_vertex: str) -> None:
<add> """
<add> Graph is implemented as dictionary of adjacency lists. Also,
<ide> Source vertex have to be defined upon initialization.
<ide> """
<ide> self.graph = graph
<ide> # mapping node to its parent in resulting breadth first tree
<del> self.parent = {}
<add> self.parent: dict[str, Optional[str]] = {}
<ide> self.source_vertex = source_vertex
<ide>
<ide> def breath_first_search(self) -> None:
<del> """This function is a helper for running breath first search on this graph.
<add> """
<add> This function is a helper for running breath first search on this graph.
<ide> >>> g = Graph(graph, "G")
<ide> >>> g.breath_first_search()
<ide> >>> g.parent
<ide> def breath_first_search(self) -> None:
<ide> queue.append(adjacent_vertex)
<ide>
<ide> def shortest_path(self, target_vertex: str) -> str:
<del> """This shortest path function returns a string, describing the result:
<add> """
<add> This shortest path function returns a string, describing the result:
<ide> 1.) No path is found. The string is a human readable message to indicate this.
<ide> 2.) The shortest path is found. The string is in the form
<ide> `v1(->v2->v3->...->vn)`, where v1 is the source vertex and vn is the target
<ide> def shortest_path(self, target_vertex: str) -> str:
<ide> 'G'
<ide> """
<ide> if target_vertex == self.source_vertex:
<del> return f"{self.source_vertex}"
<del> elif not self.parent.get(target_vertex):
<add> return self.source_vertex
<add>
<add> target_vertex_parent = self.parent.get(target_vertex)
<add> if target_vertex_parent is None:
<ide> return f"No path from vertex:{self.source_vertex} to vertex:{target_vertex}"
<del> else:
<del> return self.shortest_path(self.parent[target_vertex]) + f"->{target_vertex}"
<ide>
<add> return self.shortest_path(target_vertex_parent) + f"->{target_vertex}"
<ide>
<del>if __name__ == "__main__":
<del> import doctest
<ide>
<del> doctest.testmod()
<add>if __name__ == "__main__":
<ide> g = Graph(graph, "G")
<ide> g.breath_first_search()
<ide> print(g.shortest_path("D")) | 1 |
Text | Text | streamline readme intro | 89dd21a8ad7725b7a495160feed8e642241b1f00 | <ide><path>README.md
<ide> <a title="CII Best Practices" href="https://bestpractices.coreinfrastructure.org/projects/29"><img src="https://bestpractices.coreinfrastructure.org/projects/29/badge"></a>
<ide> </p>
<ide>
<del>Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js
<del>uses an event-driven, non-blocking I/O model that makes it lightweight and
<del>efficient. The Node.js package ecosystem, [npm][], is the largest ecosystem of
<del>open source libraries in the world.
<add>Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine. For
<add>more information on using Node.js, see the
<add>[Node.js Website][].
<ide>
<ide> The Node.js project is supported by the
<ide> [Node.js Foundation](https://nodejs.org/en/foundation/). Contributions,
<ide> Previous releases may also have been signed with one of the following GPG keys:
<ide> * [Contributing to the project][]
<ide> * [Working Groups][]
<ide>
<del>[npm]: https://www.npmjs.com
<ide> [Code of Conduct]: https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md
<ide> [Contributing to the project]: CONTRIBUTING.md
<ide> [Node.js Help]: https://github.com/nodejs/help | 1 |
Ruby | Ruby | extract variant setter to process method | feacb99003813d10425bd861d4dae3a14e4a33fb | <ide><path>actionpack/lib/abstract_controller/rendering.rb
<ide> def _process_options(options)
<ide> def _process_format(format)
<ide> end
<ide>
<add> def _process_variant(options)
<add> end
<add>
<ide> def _set_html_content_type # :nodoc:
<ide> end
<ide>
<ide> def _set_rendered_content_type(format) # :nodoc:
<ide> # :api: private
<ide> def _normalize_render(*args, &block)
<ide> options = _normalize_args(*args, &block)
<del> #TODO: remove defined? when we restore AP <=> AV dependency
<del> if defined?(request) && !request.nil? && request.variant.present?
<del> options[:variant] = request.variant
<del> end
<add> _process_variant(options)
<ide> _normalize_options(options)
<ide> options
<ide> end
<ide><path>actionpack/lib/action_controller/metal/rendering.rb
<ide> def render_to_body(options = {})
<ide>
<ide> private
<ide>
<add> def _process_variant(options)
<add> if defined?(request) && !request.nil? && request.variant.present?
<add> options[:variant] = request.variant
<add> end
<add> end
<add>
<ide> def _render_in_priorities(options)
<ide> RENDER_FORMATS_IN_PRIORITY.each do |format|
<ide> return options[format] if options.key?(format) | 2 |
Javascript | Javascript | use fixtures.path instead of fixturesdir | b1506f713c8866c47d17b0d7fe76fd5c6697ef42 | <ide><path>test/parallel/test-require-resolve.js
<ide> // USE OR OTHER DEALINGS IN THE SOFTWARE.
<ide>
<ide> 'use strict';
<del>const common = require('../common');
<del>const fixturesDir = common.fixturesDir;
<add>require('../common');
<add>const fixtures = require('../common/fixtures');
<ide> const assert = require('assert');
<del>const path = require('path');
<ide>
<ide> assert.strictEqual(
<del> path.join(__dirname, '../fixtures/a.js').toLowerCase(),
<del> require.resolve('../fixtures/a').toLowerCase());
<add> fixtures.path('a.js').toLowerCase(),
<add> require.resolve(fixtures.path('a').toLowerCase()));
<ide> assert.strictEqual(
<del> path.join(fixturesDir, 'a.js').toLowerCase(),
<del> require.resolve(path.join(fixturesDir, 'a')).toLowerCase());
<add> fixtures.path('a.js').toLowerCase(),
<add> require.resolve(fixtures.path('a')).toLowerCase());
<ide> assert.strictEqual(
<del> path.join(fixturesDir, 'nested-index', 'one', 'index.js').toLowerCase(),
<del> require.resolve('../fixtures/nested-index/one').toLowerCase());
<add> fixtures.path('nested-index', 'one', 'index.js').toLowerCase(),
<add> require.resolve(fixtures.path('nested-index', 'one').toLowerCase()));
<ide> assert.strictEqual('path', require.resolve('path'));
<ide>
<ide> console.log('ok'); | 1 |
Ruby | Ruby | remove unneeded tests | 3ca7fa96f7160ae67c289504d7984dcebdedbeae | <ide><path>activesupport/test/deprecation_test.rb
<ide> def test_deprecation_with_alternate_method
<ide> def test_deprecation_with_explicit_message
<ide> assert_deprecated(/you now need to do something extra for this one/) { @dtc.d }
<ide> end
<del>
<del> unless defined?(::MiniTest)
<del> def test_assertion_failed_error_doesnt_spout_deprecation_warnings
<del> error_class = Class.new(StandardError) do
<del> def message
<del> ActiveSupport::Deprecation.warn 'warning in error message'
<del> super
<del> end
<del> end
<del>
<del> raise error_class.new('hmm')
<del>
<del> rescue => e
<del> error = Test::Unit::Error.new('testing ur doodz', e)
<del> assert_not_deprecated { error.message }
<del> assert_nil @last_message
<del> end
<del> end
<ide> end
<ide><path>activesupport/test/isolation_test.rb
<del>require 'abstract_unit'
<del>require 'rbconfig'
<del>
<del>if defined?(MiniTest) || defined?(Test::Unit::TestResultFailureSupport)
<del> $stderr.puts "Isolation tests can test test-unit 1 only"
<del>
<del>elsif ENV['CHILD']
<del> class ChildIsolationTest < ActiveSupport::TestCase
<del> include ActiveSupport::Testing::Isolation
<del>
<del> def self.setup
<del> File.open(File.join(File.dirname(__FILE__), "fixtures", "isolation_test"), "a") do |f|
<del> f.puts "hello"
<del> end
<del> end
<del>
<del> def setup
<del> @instance = "HELLO"
<del> end
<del>
<del> def teardown
<del> raise if @boom
<del> end
<del>
<del> test "runs the test" do
<del> assert true
<del> end
<del>
<del> test "captures errors" do
<del> raise
<del> end
<del>
<del> test "captures failures" do
<del> assert false
<del> end
<del>
<del> test "first runs in isolation" do
<del> assert_nil $x
<del> $x = 1
<del> end
<del>
<del> test "second runs in isolation" do
<del> assert_nil $x
<del> $x = 2
<del> end
<del>
<del> test "runs with slow tests" do
<del> sleep 0.3
<del> assert true
<del> sleep 0.2
<del> end
<del>
<del> test "runs setup" do
<del> assert "HELLO", @instance
<del> end
<del>
<del> test "runs teardown" do
<del> @boom = true
<del> end
<del>
<del> test "resets requires one" do
<del> assert !defined?(Custom)
<del> assert_equal 0, $LOADED_FEATURES.grep(/fixtures\/custom/).size
<del> require File.expand_path(File.join(File.dirname(__FILE__), "fixtures", "custom"))
<del> end
<del>
<del> test "resets requires two" do
<del> assert !defined?(Custom)
<del> assert_equal 0, $LOADED_FEATURES.grep(/fixtures\/custom/).size
<del> require File.expand_path(File.join(File.dirname(__FILE__), "fixtures", "custom"))
<del> end
<del> end
<del>else
<del> class ParentIsolationTest < ActiveSupport::TestCase
<del>
<del> File.open(File.join(File.dirname(__FILE__), "fixtures", "isolation_test"), "w") {}
<del>
<del> ENV["CHILD"] = "1"
<del> OUTPUT = `#{RbConfig::CONFIG["bindir"]}/#{RbConfig::CONFIG["ruby_install_name"]} -I#{File.dirname(__FILE__)} "#{File.expand_path(__FILE__)}" -v`
<del> ENV.delete("CHILD")
<del>
<del> def setup
<del> @results = {}
<del> OUTPUT[/Started\n\s*(.*)\s*\nFinished/mi, 1].to_s.split(/\s*\n\s*/).each do |result|
<del> result =~ %r'^\w+#(\w+):.*:\s*(.*Assertion.*|.*RuntimeError.*|\.\s*)$'
<del> val = :success
<del> val = :error if $2.include?('RuntimeError')
<del> val = :failure if $2.include?('Assertion')
<del>
<del> @results[$1] = val
<del> end
<del>
<del> # Extract the backtraces
<del> @backtraces = {}
<del> OUTPUT.scan(/^\s*\d+\).*?\n\n/m).each do |backtrace|
<del> # \n 1) Error:\ntest_captures_errors(ChildIsolationTest):
<del> backtrace =~ %r'\s*\d+\)\s*(Error|Failure):\n(\w+)'i
<del> @backtraces[$2] = {:type => $1, :output => backtrace}
<del> end
<del> end
<del>
<del> def assert_failing(name)
<del> assert_equal :failure, @results[name.to_s], "Test #{name} failed"
<del> end
<del>
<del> def assert_passing(name)
<del> assert_equal :success, @results[name.to_s], "Test #{name} passed"
<del> end
<del>
<del> def assert_erroring(name)
<del> assert_equal :error, @results[name.to_s], "Test #{name} errored"
<del> end
<del>
<del> test "has all tests" do
<del> assert_equal 10, @results.length
<del> end
<del>
<del> test "passing tests are still reported" do
<del> assert_passing :test_runs_the_test
<del> assert_passing :test_runs_with_slow_tests
<del> end
<del>
<del> test "resets global variables" do
<del> assert_passing :test_first_runs_in_isolation
<del> assert_passing :test_second_runs_in_isolation
<del> end
<del>
<del> test "resets requires" do
<del> assert_passing :test_resets_requires_one
<del> assert_passing :test_resets_requires_two
<del> end
<del>
<del> test "erroring tests are still reported" do
<del> assert_erroring :test_captures_errors
<del> end
<del>
<del> test "runs setup and teardown methods" do
<del> assert_passing :test_runs_setup
<del> assert_erroring :test_runs_teardown
<del> end
<del>
<del> test "correct tests fail" do
<del> assert_failing :test_captures_failures
<del> end
<del>
<del> test "backtrace is printed for errors" do
<del> assert_equal 'Error', @backtraces["test_captures_errors"][:type]
<del> assert_match %r{isolation_test.rb:\d+}, @backtraces["test_captures_errors"][:output]
<del> end
<del>
<del> test "backtrace is printed for failures" do
<del> assert_equal 'Failure', @backtraces["test_captures_failures"][:type]
<del> assert_match %r{isolation_test.rb:\d+}, @backtraces["test_captures_failures"][:output]
<del> end
<del>
<del> test "self.setup is run only once" do
<del> text = File.read(File.join(File.dirname(__FILE__), "fixtures", "isolation_test"))
<del> assert_equal "hello\n", text
<del> end
<del>
<del> end
<del>end | 2 |
Python | Python | deprecate the oldnumeric and numarray modules | a9a470c841eeb5f0fb2c2ae9639f6c2833f03d00 | <ide><path>numpy/__init__.py
<ide>
<ide> import sys
<ide>
<add>
<add>class ModuleDeprecationWarning(DeprecationWarning):
<add> """Module deprecation warning.
<add>
<add> The nose tester turns ordinary Deprecation warnings into test failures.
<add> That makes it hard to deprecate whole modules, because they get
<add> imported by default. So this is a special Deprecation warning that the
<add> nose tester will let pass without making tests fail.
<add>
<add> """
<add> pass
<add>
<add>
<ide> # We first need to detect if we're being called as part of the numpy setup
<ide> # procedure itself in a reliable manner.
<ide> try:
<ide> def pkgload(*packages, **options):
<ide> return loader(*packages, **options)
<ide>
<ide> from . import add_newdocs
<del> __all__ = ['add_newdocs']
<add> __all__ = ['add_newdocs', 'ModuleDeprecationWarning']
<ide>
<ide> pkgload.__doc__ = PackageLoader.__call__.__doc__
<ide>
<ide><path>numpy/numarray/__init__.py
<ide> from __future__ import division, absolute_import, print_function
<ide>
<add>import warnings
<add>from numpy import ModuleDeprecationWarning
<add>
<ide> from .util import *
<ide> from .numerictypes import *
<ide> from .functions import *
<ide> from . import compat
<ide> from . import session
<ide>
<add>_msg = "The numarray module will be dropped in Numpy 1.9"
<add>warnings.warn(_msg, ModuleDeprecationWarning)
<add>
<ide> __all__ = ['session', 'numerictypes']
<ide> __all__ += util.__all__
<ide> __all__ += numerictypes.__all__
<ide><path>numpy/oldnumeric/__init__.py
<ide> """
<ide> from __future__ import division, absolute_import, print_function
<ide>
<add>import warnings
<add>
<ide> from numpy import *
<ide>
<add>_msg = "The oldnumeric module will be dropped in Numpy 1.9"
<add>warnings.warn(_msg, ModuleDeprecationWarning)
<add>
<add>
<ide> def _move_axis_to_0(a, axis):
<ide> if axis == 0:
<ide> return a
<ide><path>numpy/testing/nosetester.py
<ide> import warnings
<ide> import numpy.testing.utils
<ide> from numpy.compat import basestring
<add>from numpy import ModuleDeprecationWarning
<ide>
<ide> def get_package_name(filepath):
<ide> """
<ide> def test(self, label='fast', verbose=1, extra_argv=None,
<ide> warnings.filterwarnings('ignore', message='Not importing directory')
<ide> warnings.filterwarnings("ignore", message="numpy.dtype size changed")
<ide> warnings.filterwarnings("ignore", message="numpy.ufunc size changed")
<add> warnings.filterwarnings("ignore", category=ModuleDeprecationWarning)
<ide>
<ide> try:
<ide> from .noseclasses import NumpyTestProgram
<ide><path>numpy/testing/utils.py
<ide> 'assert_array_max_ulp', 'assert_warns', 'assert_no_warnings',
<ide> 'assert_allclose']
<ide>
<add>
<ide> verbose = 0
<ide>
<add>
<ide> def assert_(val, msg='') :
<ide> """
<ide> Assert that works in release mode. | 5 |
PHP | PHP | expand api docs | 5848c0076ae09f2bfe82972a35631947f37a4b79 | <ide><path>lib/Cake/Network/Http/Response.php
<ide> namespace Cake\Network\Http;
<ide>
<ide> /**
<del> * Implements methods for HTTP responses
<add> * Implements methods for HTTP responses.
<add> *
<add> * All of the following examples assume that `$response` is an
<add> * instance of this class.
<ide> *
<ide> * ### Get header values
<ide> *
<add> * Header names are case-insensitve, but normalized to Title-Case
<add> * when the response is parsed.
<add> *
<add> * `$val = $response->header('content-type');`
<add> *
<add> * Will read the Content-Type header. You can get all set
<add> * headers using:
<add> *
<add> * `$response->header();`
<add> *
<add> * You can also get at the headers using array notation. When getting
<add> * headers with array notation, you have to use case-sensitive header
<add> * names:
<add> *
<add> * `$val = $response['headers']['Content-Type'];`
<add> *
<ide> * ### Get the response body
<ide> *
<add> * You can access the response body using:
<add> *
<add> * `$content = $response->body();`
<add> *
<add> * You can also use array notation:
<add> *
<add> * `$content = $response['body'];`
<add> *
<ide> * ### Check the status code
<ide> *
<add> * You can access the response status code using:
<add> *
<add> * `$content = $response->statusCode();`
<add> *
<add> * You can also use array notation:
<add> *
<add> * `$content = $response['code'];`
<ide> */
<ide> class Response implements \ArrayAccess {
<ide> | 1 |
Go | Go | add setsubenv and getsubenv | 8fbdb7b59eba078bf24546686e005cc86a60e493 | <ide><path>api.go
<ide> func postCommit(srv *Server, version float64, w http.ResponseWriter, r *http.Req
<ide> return err
<ide> }
<ide> var (
<del> config = &Config{}
<add> config engine.Env
<ide> env engine.Env
<ide> job = srv.Eng.Job("commit", r.Form.Get("container"))
<ide> )
<del> if err := json.NewDecoder(r.Body).Decode(config); err != nil && err != io.EOF {
<add> if err := config.Import(r.Body); err != nil {
<ide> utils.Errorf("%s", err)
<ide> }
<ide>
<ide> job.Setenv("repo", r.Form.Get("repo"))
<ide> job.Setenv("tag", r.Form.Get("tag"))
<ide> job.Setenv("author", r.Form.Get("author"))
<ide> job.Setenv("comment", r.Form.Get("comment"))
<del> job.SetenvJson("config", config)
<add> job.SetenvSubEnv("config", &config)
<ide>
<ide> var id string
<ide> job.Stdout.AddString(&id)
<ide> func postContainersAttach(srv *Server, version float64, w http.ResponseWriter, r
<ide> return fmt.Errorf("Missing parameter")
<ide> }
<ide>
<del> // TODO: replace the buffer by job.AddEnv()
<ide> var (
<ide> job = srv.Eng.Job("inspect", vars["name"], "container")
<del> buffer = bytes.NewBuffer(nil)
<del> c Container
<add> c, err = job.Stdout.AddEnv()
<ide> )
<del> job.Stdout.Add(buffer)
<del> if err := job.Run(); err != nil {
<add> if err != nil {
<ide> return err
<ide> }
<del>
<del> if err := json.Unmarshal(buffer.Bytes(), &c); err != nil {
<add> if err = job.Run(); err != nil {
<ide> return err
<ide> }
<ide>
<ide> func postContainersAttach(srv *Server, version float64, w http.ResponseWriter, r
<ide>
<ide> fmt.Fprintf(outStream, "HTTP/1.1 200 OK\r\nContent-Type: application/vnd.docker.raw-stream\r\n\r\n")
<ide>
<del> if !c.Config.Tty && version >= 1.6 {
<add> if c.GetSubEnv("Config") != nil && !c.GetSubEnv("Config").GetBool("Tty") && version >= 1.6 {
<ide> errStream = utils.NewStdWriter(outStream, utils.Stderr)
<ide> outStream = utils.NewStdWriter(outStream, utils.Stdout)
<ide> } else {
<ide><path>engine/env.go
<ide> func (env *Env) GetList(key string) []string {
<ide> return l
<ide> }
<ide>
<add>func (env *Env) GetSubEnv(key string) *Env {
<add> sval := env.Get(key)
<add> if sval == "" {
<add> return nil
<add> }
<add> buf := bytes.NewBufferString(sval)
<add> var sub Env
<add> if err := sub.Decode(buf); err != nil {
<add> return nil
<add> }
<add> return &sub
<add>}
<add>
<add>func (env *Env) SetSubEnv(key string, sub *Env) error {
<add> var buf bytes.Buffer
<add> if err := sub.Encode(&buf); err != nil {
<add> return err
<add> }
<add> env.Set(key, string(buf.Bytes()))
<add> return nil
<add>}
<add>
<ide> func (env *Env) GetJson(key string, iface interface{}) error {
<ide> sval := env.Get(key)
<ide> if sval == "" {
<ide><path>engine/job.go
<ide> func (job *Job) SetenvBool(key string, value bool) {
<ide> job.env.SetBool(key, value)
<ide> }
<ide>
<add>func (job *Job) GetenvSubEnv(key string) *Env {
<add> return job.env.GetSubEnv(key)
<add>}
<add>
<add>func (job *Job) SetenvSubEnv(key string, value *Env) error {
<add> return job.env.SetSubEnv(key, value)
<add>}
<add>
<ide> func (job *Job) GetenvInt64(key string) int64 {
<ide> return job.env.GetInt64(key)
<ide> }
<ide><path>server.go
<ide> func (srv *Server) ContainerCreate(job *engine.Job) engine.Status {
<ide> }
<ide> resolvConf, err := utils.GetResolvConf()
<ide> if err != nil {
<del> job.Error(err)
<del> return engine.StatusErr
<add> return job.Error(err)
<ide> }
<ide> if !config.NetworkDisabled && len(config.Dns) == 0 && len(srv.runtime.config.Dns) == 0 && utils.CheckLocalDns(resolvConf) {
<ide> job.Errorf("WARNING: Docker detected local DNS server on resolv.conf. Using default external servers: %v\n", defaultDns) | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.