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
Java
Java
add public variant getdeclaredmethods method
8ef609a1b74ad359ae764c4d4052365ac5483fcf
<ide><path>spring-core/src/main/java/org/springframework/util/ReflectionUtils.java <ide> public static Method findMethod(Class<?> clazz, String name, @Nullable Class<?>. <ide> Assert.notNull(name, "Method name must not be null"); <ide> Class<?> searchType = clazz; <ide> while (searchType != null) { <del> Method[] methods = (searchType.isInterface() ? searchType.getMethods() : getDeclaredMethods(searchType)); <add> Method[] methods = searchType.isInterface() ? <add> searchType.getMethods() : <add> getDeclaredMethods(searchType, false); <ide> for (Method method : methods) { <ide> if (name.equals(method.getName()) && <ide> (paramTypes == null || Arrays.equals(paramTypes, method.getParameterTypes()))) { <ide> public static boolean declaresException(Method method, Class<?> exceptionType) { <ide> * @see #doWithMethods <ide> */ <ide> public static void doWithLocalMethods(Class<?> clazz, MethodCallback mc) { <del> Method[] methods = getDeclaredMethods(clazz); <add> Method[] methods = getDeclaredMethods(clazz, false); <ide> for (Method method : methods) { <ide> try { <ide> mc.doWith(method); <ide> public static void doWithMethods(Class<?> clazz, MethodCallback mc) { <ide> */ <ide> public static void doWithMethods(Class<?> clazz, MethodCallback mc, @Nullable MethodFilter mf) { <ide> // Keep backing up the inheritance hierarchy. <del> Method[] methods = getDeclaredMethods(clazz); <add> Method[] methods = getDeclaredMethods(clazz, false); <ide> for (Method method : methods) { <ide> if (mf != null && !mf.matches(method)) { <ide> continue; <ide> public static Method[] getUniqueDeclaredMethods(Class<?> leafClass, @Nullable Me <ide> } <ide> <ide> /** <del> * This variant retrieves {@link Class#getDeclaredMethods()} from a local cache <del> * in order to avoid the JVM's SecurityManager check and defensive array copying. <del> * In addition, it also includes Java 8 default methods from locally implemented <del> * interfaces, since those are effectively to be treated just like declared methods. <add> * Variant of {@link Class#getDeclaredMethods()} that uses a local cache in <add> * order to avoid the JVM's SecurityManager check and new Method instances. <add> * In addition, it also includes Java 8 default methods from locally <add> * implemented interfaces, since those are effectively to be treated just <add> * like declared methods. <ide> * @param clazz the class to introspect <ide> * @return the cached array of methods <ide> * @throws IllegalStateException if introspection fails <add> * @since 5.2 <ide> * @see Class#getDeclaredMethods() <ide> */ <del> private static Method[] getDeclaredMethods(Class<?> clazz) { <add> public static Method[] getDeclaredMethods(Class<?> clazz) { <add> return getDeclaredMethods(clazz, true); <add> } <add> <add> private static Method[] getDeclaredMethods(Class<?> clazz, boolean defensive) { <ide> Assert.notNull(clazz, "Class must not be null"); <ide> Method[] result = declaredMethodsCache.get(clazz); <ide> if (result == null) { <ide> private static Method[] getDeclaredMethods(Class<?> clazz) { <ide> "] from ClassLoader [" + clazz.getClassLoader() + "]", ex); <ide> } <ide> } <del> return result; <add> return (result.length == 0 || !defensive) ? result : result.clone(); <ide> } <ide> <ide> @Nullable <ide><path>spring-core/src/test/java/org/springframework/util/ReflectionUtilsTests.java <ide> /* <del> * Copyright 2002-2016 the original author or authors. <add> * Copyright 2002-2019 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> void m95() { } void m96() { } void m97() { } void m98() { } void m99() { } <ide> assertThat(totalMs, Matchers.lessThan(10L)); <ide> } <ide> <add> @Test <add> public void getDecalredMethodsReturnsCopy() { <add> Method[] m1 = ReflectionUtils.getDeclaredMethods(A.class); <add> Method[] m2 = ReflectionUtils.getDeclaredMethods(A.class); <add> assertThat(m1, not(sameInstance(m2))); <add> } <add> <ide> private static class ListSavingMethodCallback implements ReflectionUtils.MethodCallback { <ide> <ide> private List<String> methodNames = new LinkedList<>();
2
PHP
PHP
add button widget & test case
dd4f2264fe2ee2de35592a263c898bdc2303321c
<ide><path>src/View/Input/Button.php <add><?php <add>/** <add> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * <add> * Licensed under The MIT License <add> * For full copyright and license information, please see the LICENSE.txt <add> * Redistributions of files must retain the above copyright notice. <add> * <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @link http://cakephp.org CakePHP(tm) Project <add> * @since CakePHP(tm) v3.0 <add> * @license http://www.opensource.org/licenses/mit-license.php MIT License <add> */ <add>namespace Cake\View\Input; <add> <add>use Cake\View\Input\InputInterface; <add> <add>/** <add> * Button input class <add> * <add> * This input class can be used to render button elements. <add> * If you need to make basic submit inputs with type=submit, <add> * use the Basic input widget. <add> */ <add>class Button implements InputInterface { <add> <add>/** <add> * StringTemplate instance. <add> * <add> * @var Cake\View\StringTemplate <add> */ <add> protected $_templates; <add> <add>/** <add> * Constructor. <add> * <add> * @param StringTemplate $templates <add> */ <add> public function __construct($templates) { <add> $this->_templates = $templates; <add> } <add> <add>/** <add> * Render a button. <add> * <add> * This method accepts a number of keys: <add> * <add> * - `text` The text of the button. Unlike all other form controls, buttons <add> * do not escape their contents by default. <add> * - `escape` Set to true to enable escaping on all attributes. <add> * - `type` The button type defaults to 'submit'. <add> * <add> * Any other keys provided in $data will be converted into HTML attributes. <add> * <add> * @param array $data The data to build an input with. <add> * @return string <add> */ <add> public function render(array $data) { <add> $data += [ <add> 'text' => '', <add> 'type' => 'submit', <add> 'escape' => false, <add> ]; <add> return $this->_templates->format('button', [ <add> 'text' => $data['escape'] ? h($data['text']) : $data['text'], <add> 'type' => $data['type'], <add> 'attrs' => $this->_templates->formatAttributes($data, ['type', 'text']), <add> ]); <add> } <add> <add>} <ide><path>tests/TestCase/View/Input/ButtonTest.php <add><?php <add>/** <add> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * <add> * Licensed under The MIT License <add> * For full copyright and license information, please see the LICENSE.txt <add> * Redistributions of files must retain the above copyright notice. <add> * <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @link http://cakephp.org CakePHP(tm) Project <add> * @since CakePHP(tm) v3.0 <add> * @license http://www.opensource.org/licenses/mit-license.php MIT License <add> */ <add>namespace Cake\Test\TestCase\View\Input; <add> <add>use Cake\TestSuite\TestCase; <add>use Cake\View\Input\Button; <add>use Cake\View\StringTemplate; <add> <add>/** <add> * Basic input test. <add> */ <add>class ButtonTest extends TestCase { <add> <add> public function setUp() { <add> parent::setUp(); <add> $templates = [ <add> 'button' => '<button type="{{type}}"{{attrs}}>{{text}}</button>', <add> ]; <add> $this->templates = new StringTemplate($templates); <add> } <add> <add>/** <add> * Test render in a simple case. <add> * <add> * @return void <add> */ <add> public function testRenderSimple() { <add> $button = new Button($this->templates); <add> $result = $button->render(['name' => 'my_input']); <add> $expected = [ <add> 'button' => ['type' => 'submit', 'name' => 'my_input'], <add> '/button' <add> ]; <add> $this->assertTags($result, $expected); <add> } <add> <add>/** <add> * Test render with custom type <add> * <add> * @return void <add> */ <add> public function testRenderType() { <add> $button = new Button($this->templates); <add> $data = [ <add> 'name' => 'my_input', <add> 'type' => 'button', <add> 'text' => 'Some button' <add> ]; <add> $result = $button->render($data); <add> $expected = [ <add> 'button' => ['type' => 'button', 'name' => 'my_input'], <add> 'Some button', <add> '/button' <add> ]; <add> $this->assertTags($result, $expected); <add> } <add> <add>/** <add> * Test render with a text <add> * <add> * @return void <add> */ <add> public function testRenderWithText() { <add> $button = new Button($this->templates); <add> $data = [ <add> 'text' => 'Some <value>' <add> ]; <add> $result = $button->render($data); <add> $expected = [ <add> 'button' => ['type' => 'submit'], <add> 'Some <value>', <add> '/button' <add> ]; <add> $this->assertTags($result, $expected); <add> <add> $data['escape'] = true; <add> $result = $button->render($data); <add> $expected = [ <add> 'button' => ['type' => 'submit'], <add> 'Some &lt;value&gt;', <add> '/button' <add> ]; <add> $this->assertTags($result, $expected); <add> } <add> <add>/** <add> * Test render with additional attributes. <add> * <add> * @return void <add> */ <add> public function testRenderAttributes() { <add> $button = new Button($this->templates); <add> $data = [ <add> 'name' => 'my_input', <add> 'text' => 'Go', <add> 'class' => 'btn', <add> 'required' => true <add> ]; <add> $result = $button->render($data); <add> $expected = [ <add> 'button' => [ <add> 'type' => 'submit', <add> 'name' => 'my_input', <add> 'class' => 'btn', <add> 'required' => 'required' <add> ], <add> 'Go', <add> '/button' <add> ]; <add> $this->assertTags($result, $expected); <add> } <add> <add>}
2
Python
Python
prepare 2.0.7 release
14a12e94c8edb683ae0c85d7d2db54724e902a6f
<ide><path>keras/__init__.py <ide> # Importable from root because it's technically not a layer <ide> from .layers import Input <ide> <del>__version__ = '2.0.6' <add>__version__ = '2.0.7' <ide><path>setup.py <ide> <ide> <ide> setup(name='Keras', <del> version='2.0.6', <add> version='2.0.7', <ide> description='Deep Learning for Python', <ide> author='Francois Chollet', <ide> author_email='francois.chollet@gmail.com', <ide> url='https://github.com/fchollet/keras', <del> download_url='https://github.com/fchollet/keras/tarball/2.0.6', <add> download_url='https://github.com/fchollet/keras/tarball/2.0.7', <ide> license='MIT', <ide> install_requires=['theano', 'pyyaml', 'six'], <ide> extras_require={
2
Javascript
Javascript
add tests for the new createstore() enhancer arg
147842cf9d80902287a41f7129bfadfea8afb112
<ide><path>test/createStore.spec.js <ide> describe('createStore', () => { <ide> expect(methods).toContain('replaceReducer') <ide> }) <ide> <del> it('requires a reducer function', () => { <add> it('throws if reducer is not a function', () => { <ide> expect(() => <ide> createStore() <ide> ).toThrow() <ide> describe('createStore', () => { <ide> store.dispatch({ type: '' }) <ide> ).toNotThrow() <ide> }) <add> <add> it('accepts enhancer as the third argument', () => { <add> const emptyArray = [] <add> const spyEnhancer = vanillaCreateStore => (...args) => { <add> expect(args[0]).toBe(reducers.todos) <add> expect(args[1]).toBe(emptyArray) <add> expect(args.length).toBe(2) <add> const vanillaStore = vanillaCreateStore(...args) <add> return { <add> ...vanillaStore, <add> dispatch: expect.createSpy(vanillaStore.dispatch).andCallThrough() <add> } <add> } <add> <add> const store = createStore(reducers.todos, emptyArray, spyEnhancer) <add> const action = addTodo('Hello') <add> store.dispatch(action) <add> expect(store.dispatch).toHaveBeenCalledWith(action) <add> expect(store.getState()).toEqual([ <add> { <add> id: 1, <add> text: 'Hello' <add> } <add> ]) <add> }) <add> <add> it('accepts enhancer as the second argument if initial state is missing', () => { <add> const spyEnhancer = vanillaCreateStore => (...args) => { <add> expect(args[0]).toBe(reducers.todos) <add> expect(args[1]).toBe(undefined) <add> expect(args.length).toBe(2) <add> const vanillaStore = vanillaCreateStore(...args) <add> return { <add> ...vanillaStore, <add> dispatch: expect.createSpy(vanillaStore.dispatch).andCallThrough() <add> } <add> } <add> <add> const store = createStore(reducers.todos, spyEnhancer) <add> const action = addTodo('Hello') <add> store.dispatch(action) <add> expect(store.dispatch).toHaveBeenCalledWith(action) <add> expect(store.getState()).toEqual([ <add> { <add> id: 1, <add> text: 'Hello' <add> } <add> ]) <add> }) <add> <add> it('throws if enhancer is neither undefined nor a function', () => { <add> expect(() => <add> createStore(reducers.todos, undefined, {}) <add> ).toThrow() <add> <add> expect(() => <add> createStore(reducers.todos, undefined, []) <add> ).toThrow() <add> <add> expect(() => <add> createStore(reducers.todos, undefined, null) <add> ).toThrow() <add> <add> expect(() => <add> createStore(reducers.todos, undefined, false) <add> ).toThrow() <add> <add> expect(() => <add> createStore(reducers.todos, undefined, undefined) <add> ).toNotThrow() <add> <add> expect(() => <add> createStore(reducers.todos, undefined, x => x) <add> ).toNotThrow() <add> <add> expect(() => <add> createStore(reducers.todos, x => x) <add> ).toNotThrow() <add> <add> expect(() => <add> createStore(reducers.todos, []) <add> ).toNotThrow() <add> <add> expect(() => <add> createStore(reducers.todos, {}) <add> ).toNotThrow() <add> }) <ide> })
1
Python
Python
clarify interface of in_train_phase
2e45022c955acc8197c57c67e7ce93be31bb4405
<ide><path>keras/backend/tensorflow_backend.py <ide> def switch(condition, then_expression, else_expression): <ide> return x <ide> <ide> <del>def in_train_phase(x, expression): <del> '''Inserts an expression to be only applied at training time. <del> Note that `expression` should have the *same shape* as `x`. <add>def in_train_phase(x, alt): <add> '''Selects `x` in train phase, and `alt` otherwise. <add> Note that `alt` should have the *same shape* as `x`. <ide> ''' <ide> x_shape = copy.copy(x.get_shape()) <ide> x = tf.python.control_flow_ops.cond(tf.cast(_LEARNING_PHASE, 'bool'), <ide> lambda: x, <del> lambda: expression) <add> lambda: alt) <ide> x._uses_learning_phase = True <ide> x.set_shape(x_shape) <ide> return x <ide> <ide> <del>def in_test_phase(x, expression): <del> '''Inserts an expression to be only applied at test time. <del> Note that `expression` should have the *same shape* as `x`. <add>def in_test_phase(x, alt): <add> '''Selects `x` in test phase, and `alt` otherwise. <add> Note that `alt` should have the *same shape* as `x`. <ide> ''' <ide> x_shape = copy.copy(x.get_shape()) <ide> x = tf.python.control_flow_ops.cond(tf.cast(_LEARNING_PHASE, 'bool'), <del> lambda: expression, <add> lambda: alt, <ide> lambda: x) <ide> x._uses_learning_phase = True <ide> x.set_shape(x_shape) <ide><path>keras/backend/theano_backend.py <ide> def switch(condition, then_expression, else_expression): <ide> return T.switch(condition, then_expression, else_expression) <ide> <ide> <del>def in_train_phase(x, expression): <del> x = T.switch(_LEARNING_PHASE, x, expression) <add>def in_train_phase(x, alt): <add> x = T.switch(_LEARNING_PHASE, x, alt) <ide> x._uses_learning_phase = True <ide> return x <ide> <ide> <del>def in_test_phase(x, expression): <del> x = T.switch(_LEARNING_PHASE, expression, x) <add>def in_test_phase(x, alt): <add> x = T.switch(_LEARNING_PHASE, alt, x) <ide> x._uses_learning_phase = True <ide> return x <ide>
2
PHP
PHP
fix incorrect class name in test
33031ea1319318b0497bfafc5f69d167dea5e64a
<ide><path>tests/TestCase/Routing/RouterTest.php <ide> public function testReverseToArrayQuery() <ide> public function testReverseToArrayRequestQuery() <ide> { <ide> Router::connect('/:lang/:controller/:action/*', [], ['lang' => '[a-z]{3}']); <del> $request = new Request('/eng/posts/view/1'); <add> $request = new ServerRequest('/eng/posts/view/1'); <ide> $request->addParams([ <ide> 'lang' => 'eng', <ide> 'controller' => 'posts',
1
PHP
PHP
remove code duplication
2801c5478d6e6953b50dab76e6fbc402887e11e7
<ide><path>src/Core/PluginCollection.php <ide> public function get(string $name): PluginInterface <ide> return $this->plugins[$name]; <ide> } <ide> <del> $config = ['name' => $name]; <del> $className = str_replace('/', '\\', $name) . '\\' . 'Plugin'; <del> if (class_exists($className)) { <del> $plugin = new $className($config); <del> $this->add($plugin); <add> $plugin = $this->create($name); <add> $this->add($plugin); <add> <add> return $plugin; <add> } <ide> <del> return $plugin; <add> /** <add> * Create a plugin instance from a name/classname and configuration. <add> * <add> * @param string $name The plugin name or classname <add> * @param array $config Configuration options for the plugin. <add> * @return \Cake\Core\PluginInterface <add> * @throws \Cake\Core\Exception\MissingPluginException When plugin instance could not be created. <add> */ <add> public function create(string $name, array $config = []): PluginInterface <add> { <add> if (strpos($name, '\\') !== false) { <add> /** @var \Cake\Core\PluginInterface */ <add> return new $name($config); <ide> } <ide> <del> $config['path'] = $this->findPath($name); <del> $plugin = new $className($config); <del> $this->add($plugin); <add> $config += ['name' => $name]; <add> $className = str_replace('/', '\\', $name) . '\\' . 'Plugin'; <add> if (!class_exists($className)) { <add> $className = BasePlugin::class; <add> if (empty($config['path'])) { <add> $config['path'] = $this->findPath($name); <add> } <add> } <ide> <del> return $plugin; <add> /** @var \Cake\Core\PluginInterface */ <add> return new $className($config); <ide> } <ide> <ide> /** <ide><path>src/Http/BaseApplication.php <ide> namespace Cake\Http; <ide> <ide> use Cake\Console\CommandCollection; <del>use Cake\Core\BasePlugin; <ide> use Cake\Core\ConsoleApplicationInterface; <ide> use Cake\Core\HttpApplicationInterface; <ide> use Cake\Core\Plugin; <ide> use Cake\Core\PluginApplicationInterface; <ide> use Cake\Core\PluginCollection; <del>use Cake\Core\PluginInterface; <ide> use Cake\Event\EventDispatcherTrait; <ide> use Cake\Event\EventManager; <ide> use Cake\Event\EventManagerInterface; <ide> use Cake\Routing\RouteBuilder; <ide> use Cake\Routing\Router; <del>use InvalidArgumentException; <ide> use Psr\Http\Message\ResponseInterface; <ide> use Psr\Http\Message\ServerRequestInterface; <ide> <ide> public function pluginMiddleware(MiddlewareQueue $middleware): MiddlewareQueue <ide> public function addPlugin($name, array $config = []) <ide> { <ide> if (is_string($name)) { <del> $plugin = $this->makePlugin($name, $config); <add> $plugin = $this->plugins->create($name, $config); <ide> } else { <ide> $plugin = $name; <ide> } <del> if (!$plugin instanceof PluginInterface) { <del> throw new InvalidArgumentException(sprintf( <del> "The `%s` plugin does not implement Cake\Core\PluginInterface.", <del> get_class($plugin) <del> )); <del> } <ide> $this->plugins->add($plugin); <ide> <ide> return $this; <ide> public function getPlugins(): PluginCollection <ide> return $this->plugins; <ide> } <ide> <del> /** <del> * Create a plugin instance from a classname and configuration <del> * <del> * @param string $name The plugin classname <del> * @param array $config Configuration options for the plugin <del> * @return \Cake\Core\PluginInterface <del> * @throws \InvalidArgumentException <del> */ <del> protected function makePlugin(string $name, array $config): PluginInterface <del> { <del> $className = $name; <del> if (strpos($className, '\\') === false) { <del> $className = str_replace('/', '\\', $className) . '\\' . 'Plugin'; <del> } <del> if (class_exists($className)) { <del> $plugin = new $className($config); <del> if (!$plugin instanceof PluginInterface) { <del> throw new InvalidArgumentException(sprintf( <del> 'The `%s` plugin does not implement Cake\Core\PluginInterface.', <del> get_class($plugin) <del> )); <del> } <del> <del> return $plugin; <del> } <del> <del> if (!isset($config['path'])) { <del> $config['path'] = $this->plugins->findPath($name); <del> } <del> $config['name'] = $name; <del> <del> return new BasePlugin($config); <del> } <del> <ide> /** <ide> * @inheritDoc <ide> */ <ide><path>tests/TestCase/Http/BaseApplicationTest.php <ide> use Cake\Routing\RouteBuilder; <ide> use Cake\Routing\RouteCollection; <ide> use Cake\TestSuite\TestCase; <del>use InvalidArgumentException; <ide> use Psr\Http\Message\ResponseInterface; <ide> use TestPlugin\Plugin as TestPlugin; <ide> <ide> public function testAddPluginUnknownClass() <ide> ); <ide> } <ide> <del> /** <del> * Ensure that plugin interfaces are implemented. <del> */ <del> public function testAddPluginBadClass() <del> { <del> $this->expectException(InvalidArgumentException::class); <del> $this->expectExceptionMessage('does not implement'); <del> $app = $this->getMockForAbstractClass(BaseApplication::class, [$this->path]); <del> $app->addPlugin(new \stdClass()); <del> } <del> <ide> public function testAddPluginValidShortName() <ide> { <ide> $app = $this->getMockForAbstractClass(BaseApplication::class, [$this->path]);
3
Text
Text
add shields io npm version badge
f5aac04b790ee097f825b070874f0bdf6fdbce4f
<ide><path>readme.md <ide> <img width="112" alt="screen shot 2016-10-25 at 2 37 27 pm" src="https://cloud.githubusercontent.com/assets/13041/19686250/971bf7f8-9ac0-11e6-975c-188defd82df1.png"> <ide> <add>[![NPM version](https://img.shields.io/npm/v/next.svg)](https://www.npmjs.com/package/next) <ide> [![Build Status](https://travis-ci.org/zeit/next.js.svg?branch=master)](https://travis-ci.org/zeit/next.js) <ide> [![Build status](https://ci.appveyor.com/api/projects/status/gqp5hs71l3ebtx1r/branch/master?svg=true)](https://ci.appveyor.com/project/arunoda/next-js/branch/master) <ide> [![Coverage Status](https://coveralls.io/repos/zeit/next.js/badge.svg?branch=master)](https://coveralls.io/r/zeit/next.js?branch=master)
1
PHP
PHP
reduce the api surface of classloader
92d470db15529bf420472481b0af0195e9b4e545
<ide><path>lib/Cake/Core/ClassLoader.php <ide> <?php <ide> /** <del> * ClassLoader class <del> * <ide> * PHP 5 <ide> * <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <ide> * <ide> * @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <del> * @package Cake.Core <ide> * @since CakePHP(tm) v 3.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide> */ <ide> /** <ide> * ClassLoader <ide> * <del> * @package Cake.Core <ide> */ <ide> class ClassLoader { <ide> <ide> class ClassLoader { <ide> * <ide> * @var string <ide> */ <del> protected $_fileExtension = '.php'; <add> protected $_fileExtension; <add> <add>/** <add> * The path a given namespace maps to. <add> * <add> * @var string <add> */ <add> protected $_path; <ide> <ide> /** <ide> * Registered namespace <ide> class ClassLoader { <ide> */ <ide> protected $_namespaceLength; <ide> <del>/** <del> * Path with the classes <del> * <del> * @var string <del> */ <del> protected $_includePath; <del> <ide> /** <ide> * Constructor <ide> * <ide> * @param string $ns The _namespace to use. <ide> */ <del> public function __construct($ns = null, $includePath = null) { <add> public function __construct($ns = null, $path = null, $fileExtension = '.php') { <ide> $this->_namespace = rtrim($ns, '\\') . '\\'; <ide> $this->_namespaceLength = strlen($this->_namespace); <del> $this->_includePath = $includePath; <del> } <del> <del>/** <del> * Sets the base include path for all class files in the _namespace of this class loader. <del> * <del> * @param string $includePath <del> * @return void <del> */ <del> public function setIncludePath($includePath) { <del> $this->_includePath = $includePath; <add> $this->_path = $path; <add> $this->_fileExtension = '.php'; <ide> } <ide> <ide> /** <ide> public function getIncludePath() { <ide> return $this->_includePath; <ide> } <ide> <del>/** <del> * Sets the file extension of class files in the _namespace of this class loader. <del> * <del> * @param string $fileExtension <del> * @return void <del> */ <del> public function setFileExtension($fileExtension) { <del> $this->_fileExtension = $fileExtension; <del> } <del> <ide> /** <ide> * Gets the file extension of class files in the _namespace of this class loader. <ide> * <ide> public function loadClass($className) { <ide> if (substr($className, 0, $this->_namespaceLength) !== $this->_namespace) { <ide> return false; <ide> } <del> $path = $this->_includePath . DS . str_replace('\\', DS, $className) . $this->_fileExtension; <add> $path = $this->_path . DS . str_replace('\\', DS, $className) . $this->_fileExtension; <ide> if (!file_exists($path)) { <ide> return false; <ide> } <ide> return require $path; <ide> } <add> <ide> }
1
Python
Python
fix softlayer test on 2.7
3cecb1950a2ecc7a7eccd1d4c26cb4ca48e6ccdd
<ide><path>test/compute/test_softlayer.py <ide> def request(self, host, handler, request_body, verbose=0): <ide> mock.request('POST', "%s/%s" % (handler, method)) <ide> resp = mock.getresponse() <ide> <del> return self._parse_response(resp.body, None) <add> if sys.version[0] == '2' and sys.version[2] == '7': <add> response = self.parse_response(resp) <add> else: <add> response = self.parse_response(resp.body) <add> return response <ide> <ide> class SoftLayerTests(unittest.TestCase): <ide>
1
Ruby
Ruby
extract details to methods to clarify command
f6310a3f163d565cfc014143212e5ee2f0f2ae79
<ide><path>railties/lib/rails/commands/routes/routes_command.rb <ide> def perform(*) <ide> require_application_and_environment! <ide> require "action_dispatch/routing/inspector" <ide> <del> all_routes = Rails.application.routes.routes <del> inspector = ActionDispatch::Routing::RoutesInspector.new(all_routes) <del> <del> if options.has_key?("expanded_format") <del> say inspector.format(ActionDispatch::Routing::ConsoleFormatter::Expanded.new, routes_filter) <del> else <del> say inspector.format(ActionDispatch::Routing::ConsoleFormatter::Sheet.new, routes_filter) <del> end <add> say inspector.format(formatter, routes_filter) <ide> end <ide> <ide> private <add> def inspector <add> ActionDispatch::Routing::RoutesInspector.new(Rails.application.routes.routes) <add> end <add> <add> def formatter <add> if options.key?("expanded_format") <add> ActionDispatch::Routing::ConsoleFormatter::Expanded.new <add> else <add> ActionDispatch::Routing::ConsoleFormatter::Sheet.new <add> end <add> end <ide> <ide> def routes_filter <ide> options.symbolize_keys.slice(:controller, :grep_pattern)
1
Ruby
Ruby
use canonical name with tap arg
30a8d8e470ea75e5796b7df9591a676a1a6fa429
<ide><path>Library/Homebrew/cmd/bottle.rb <ide> def merge <ide> puts output <ide> <ide> if ARGV.include? '--write' <del> f = Formulary.factory(formula_name) <add> tap = ARGV.value('tap') <add> canonical_formula_name = if tap <add> "#{tap}/#{formula_name}" <add> else <add> formula_name <add> end <add> f = Formulary.factory(canonical_formula_name) <ide> update_or_add = nil <ide> <ide> Utils::Inreplace.inreplace(f.path) do |s|
1
Python
Python
add test file
f096db4f9b14cec4f2aacf31f431b883eaceda0c
<ide><path>libcloud/test/common/test_openstack_identity.py <ide> from mock import Mock <ide> <ide> from libcloud.utils.py3 import httplib <add>from libcloud.utils.py3 import assertRaisesRegex <ide> from libcloud.common.openstack import OpenStackBaseConnection <ide> from libcloud.common.openstack_identity import AUTH_TOKEN_EXPIRES_GRACE_SECONDS <ide> from libcloud.common.openstack_identity import get_class_for_auth_version <ide> def setUp(self): <ide> def test_token_scope_argument(self): <ide> # Invalid token_scope value <ide> expected_msg = 'Invalid value for "token_scope" argument: foo' <del> self.assertRaisesRegexp(ValueError, expected_msg, <del> OpenStackIdentity_3_0_Connection, <del> auth_url='http://none', <del> user_id='test', <del> key='test', <del> token_scope='foo') <add> assertRaisesRegex(self, ValueError, expected_msg, <add> OpenStackIdentity_3_0_Connection, <add> auth_url='http://none', <add> user_id='test', <add> key='test', <add> token_scope='foo') <ide> <ide> # Missing tenant_name <ide> expected_msg = 'Must provide tenant_name and domain_name argument' <del> self.assertRaisesRegexp(ValueError, expected_msg, <del> OpenStackIdentity_3_0_Connection, <del> auth_url='http://none', <del> user_id='test', <del> key='test', <del> token_scope='project') <add> assertRaisesRegex(self, ValueError, expected_msg, <add> OpenStackIdentity_3_0_Connection, <add> auth_url='http://none', <add> user_id='test', <add> key='test', <add> token_scope='project') <ide> <ide> # Missing domain_name <ide> expected_msg = 'Must provide domain_name argument' <del> self.assertRaisesRegexp(ValueError, expected_msg, <del> OpenStackIdentity_3_0_Connection, <del> auth_url='http://none', <del> user_id='test', <del> key='test', <del> token_scope='domain', <del> domain_name=None) <add> assertRaisesRegex(self, ValueError, expected_msg, <add> OpenStackIdentity_3_0_Connection, <add> auth_url='http://none', <add> user_id='test', <add> key='test', <add> token_scope='domain', <add> domain_name=None) <ide> <ide> # Scope to project all ok <ide> OpenStackIdentity_3_0_Connection(auth_url='http://none',
1
Python
Python
add readonly endpoints for dagruns
b6f4837fb12fc96b2bf0570d3380fb5d66ea2100
<ide><path>airflow/api_connexion/endpoints/dag_run_endpoint.py <ide> # specific language governing permissions and limitations <ide> # under the License. <ide> <del># TODO(mik-laj): We have to implement it. <del># Do you want to help? Please look at: https://github.com/apache/airflow/issues/8129 <add>from sqlalchemy import func <add> <add>from airflow.api_connexion.exceptions import NotFound <add>from airflow.api_connexion.schemas.dag_run_schema import ( <add> DAGRunCollection, dagrun_collection_schema, dagrun_schema, <add>) <add>from airflow.api_connexion.utils import conn_parse_datetime <add>from airflow.models import DagRun <add>from airflow.utils.session import provide_session <ide> <ide> <ide> def delete_dag_run(): <ide> def delete_dag_run(): <ide> raise NotImplementedError("Not implemented yet.") <ide> <ide> <del>def get_dag_run(): <add>@provide_session <add>def get_dag_run(dag_id, dag_run_id, session): <ide> """ <ide> Get a DAG Run. <ide> """ <del> raise NotImplementedError("Not implemented yet.") <add> query = session.query(DagRun) <add> query = query.filter(DagRun.dag_id == dag_id) <add> query = query.filter(DagRun.run_id == dag_run_id) <add> dag_run = query.one_or_none() <add> if dag_run is None: <add> raise NotFound("DAGRun not found") <add> return dagrun_schema.dump(dag_run) <ide> <ide> <del>def get_dag_runs(): <add>@provide_session <add>def get_dag_runs(session, dag_id, start_date_gte=None, start_date_lte=None, <add> execution_date_gte=None, execution_date_lte=None, <add> end_date_gte=None, end_date_lte=None, offset=None, limit=None): <ide> """ <ide> Get all DAG Runs. <ide> """ <del> raise NotImplementedError("Not implemented yet.") <add> <add> query = session.query(DagRun) <add> <add> # This endpoint allows specifying ~ as the dag_id to retrieve DAG Runs for all DAGs. <add> if dag_id != '~': <add> query = query.filter(DagRun.dag_id == dag_id) <add> <add> # filter start date <add> if start_date_gte: <add> query = query.filter(DagRun.start_date >= conn_parse_datetime(start_date_gte)) <add> <add> if start_date_lte: <add> query = query.filter(DagRun.start_date <= conn_parse_datetime(start_date_lte)) <add> <add> # filter execution date <add> if execution_date_gte: <add> query = query.filter(DagRun.execution_date >= conn_parse_datetime(execution_date_gte)) <add> <add> if execution_date_lte: <add> query = query.filter(DagRun.execution_date <= conn_parse_datetime(execution_date_lte)) <add> <add> # filter end date <add> if end_date_gte: <add> query = query.filter(DagRun.end_date >= conn_parse_datetime(end_date_gte)) <add> <add> if end_date_lte: <add> query = query.filter(DagRun.end_date <= conn_parse_datetime(end_date_lte)) <add> <add> # apply offset and limit <add> dag_run = query.order_by(DagRun.id).offset(offset).limit(limit).all() <add> total_entries = session.query(func.count(DagRun.id)).scalar() <add> <add> return dagrun_collection_schema.dump(DAGRunCollection(dag_runs=dag_run, <add> total_entries=total_entries)) <ide> <ide> <ide> def get_dag_runs_batch(): <ide><path>airflow/api_connexion/schemas/dag_run_schema.py <add># <add># Licensed to the Apache Software Foundation (ASF) under one <add># or more contributor license agreements. See the NOTICE file <add># distributed with this work for additional information <add># regarding copyright ownership. The ASF licenses this file <add># to you under the Apache License, Version 2.0 (the <add># "License"); you may not use this file except in compliance <add># with the License. You may obtain a copy of the License at <add># <add># http://www.apache.org/licenses/LICENSE-2.0 <add># <add># Unless required by applicable law or agreed to in writing, <add># software distributed under the License is distributed on an <add># "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY <add># KIND, either express or implied. See the License for the <add># specific language governing permissions and limitations <add># under the License. <add>import json <add>from typing import List, NamedTuple <add> <add>from marshmallow import fields <add>from marshmallow.schema import Schema <add>from marshmallow_sqlalchemy import SQLAlchemySchema, auto_field <add> <add>from airflow.api_connexion.schemas.enum_schemas import DagStateField <add>from airflow.models.dagrun import DagRun <add> <add> <add>class ConfObject(fields.Field): <add> """ The conf field""" <add> def _serialize(self, value, attr, obj): <add> if not value: <add> return {} <add> return json.loads(value) if isinstance(value, str) else value <add> <add> def _deserialize(self, value, attr, data): <add> if isinstance(value, str): <add> return json.loads(value) <add> return value <add> <add> <add>class DAGRunSchema(SQLAlchemySchema): <add> """ <add> Schema for DAGRun <add> """ <add> <add> class Meta: <add> """ Meta """ <add> model = DagRun <add> dateformat = 'iso' <add> ordered = True <add> <add> run_id = auto_field(dump_to='dag_run_id', load_from='dag_run_id') <add> dag_id = auto_field(dump_only=True) <add> execution_date = auto_field() <add> start_date = auto_field(dump_only=True) <add> end_date = auto_field(dump_only=True) <add> state = DagStateField() <add> external_trigger = auto_field(default=True, dump_only=True) <add> conf = ConfObject() <add> <add> <add>class DAGRunCollection(NamedTuple): <add> """List of DAGRuns with metadata""" <add> <add> dag_runs: List[DagRun] <add> total_entries: int <add> <add> <add>class DAGRunCollectionSchema(Schema): <add> """DAGRun Collection schema""" <add> class Meta: <add> """ Meta """ <add> ordered = True <add> <add> dag_runs = fields.List(fields.Nested(DAGRunSchema)) <add> total_entries = fields.Int() <add> <add> <add>dagrun_schema = DAGRunSchema() <add>dagrun_collection_schema = DAGRunCollectionSchema() <ide><path>airflow/api_connexion/schemas/enum_schemas.py <add># Licensed to the Apache Software Foundation (ASF) under one <add># or more contributor license agreements. See the NOTICE file <add># distributed with this work for additional information <add># regarding copyright ownership. The ASF licenses this file <add># to you under the Apache License, Version 2.0 (the <add># "License"); you may not use this file except in compliance <add># with the License. You may obtain a copy of the License at <add># <add># http://www.apache.org/licenses/LICENSE-2.0 <add># <add># Unless required by applicable law or agreed to in writing, <add># software distributed under the License is distributed on an <add># "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY <add># KIND, either express or implied. See the License for the <add># specific language governing permissions and limitations <add># under the License. <add> <add>from marshmallow import fields, validate <add> <add>from airflow.utils.state import State <add> <add> <add>class DagStateField(fields.String): <add> """ Schema for DagState Enum""" <add> def __init__(self, **metadata): <add> super().__init__(**metadata) <add> self.validators = ( <add> [validate.OneOf(State.dag_states)] + list(self.validators) <add> ) <ide><path>airflow/api_connexion/utils.py <add># Licensed to the Apache Software Foundation (ASF) under one <add># or more contributor license agreements. See the NOTICE file <add># distributed with this work for additional information <add># regarding copyright ownership. The ASF licenses this file <add># to you under the Apache License, Version 2.0 (the <add># "License"); you may not use this file except in compliance <add># with the License. You may obtain a copy of the License at <add># <add># http://www.apache.org/licenses/LICENSE-2.0 <add># <add># Unless required by applicable law or agreed to in writing, <add># software distributed under the License is distributed on an <add># "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY <add># KIND, either express or implied. See the License for the <add># specific language governing permissions and limitations <add># under the License. <add> <add>from pendulum.exceptions import ParserError <add> <add>from airflow.api_connexion.exceptions import BadRequest <add>from airflow.utils import timezone <add> <add> <add>def conn_parse_datetime(datetime: str): <add> """ <add> Datetime format parser for args since connexion doesn't parse datetimes <add> https://github.com/zalando/connexion/issues/476 <add> <add> This should only be used within connection views because it raises 400 <add> """ <add> if datetime[-1] != 'Z': <add> datetime = datetime.replace(" ", '+') <add> try: <add> datetime = timezone.parse(datetime) <add> except (ParserError, TypeError) as err: <add> raise BadRequest("Incorrect datetime argument", <add> detail=str(err) <add> ) <add> return datetime <ide><path>tests/api_connexion/endpoints/test_dag_run_endpoint.py <ide> # specific language governing permissions and limitations <ide> # under the License. <ide> import unittest <add>from datetime import timedelta <ide> <ide> import pytest <add>from parameterized import parameterized <ide> <add>from airflow.models import DagRun <add>from airflow.utils import timezone <add>from airflow.utils.session import provide_session <add>from airflow.utils.types import DagRunType <ide> from airflow.www import app <add>from tests.test_utils.db import clear_db_runs <ide> <ide> <ide> class TestDagRunEndpoint(unittest.TestCase): <ide> @classmethod <ide> def setUpClass(cls) -> None: <ide> super().setUpClass() <add> <ide> cls.app = app.create_app(testing=True) # type:ignore <ide> <ide> def setUp(self) -> None: <ide> self.client = self.app.test_client() # type:ignore <add> self.default_time = '2020-06-11T18:00:00+00:00' <add> self.default_time_2 = '2020-06-12T18:00:00+00:00' <add> clear_db_runs() <add> <add> def tearDown(self) -> None: <add> clear_db_runs() <add> <add> def _create_test_dag_run(self, state='running', extra_dag=False): <add> dagrun_model_1 = DagRun( <add> dag_id='TEST_DAG_ID', <add> run_id='TEST_DAG_RUN_ID_1', <add> run_type=DagRunType.MANUAL.value, <add> execution_date=timezone.parse(self.default_time), <add> start_date=timezone.parse(self.default_time), <add> external_trigger=True, <add> state=state, <add> ) <add> dagrun_model_2 = DagRun( <add> dag_id='TEST_DAG_ID', <add> run_id='TEST_DAG_RUN_ID_2', <add> run_type=DagRunType.MANUAL.value, <add> execution_date=timezone.parse(self.default_time_2), <add> start_date=timezone.parse(self.default_time), <add> external_trigger=True, <add> ) <add> if extra_dag: <add> dagrun_extra = [DagRun( <add> dag_id='TEST_DAG_ID_' + str(i), <add> run_id='TEST_DAG_RUN_ID_' + str(i), <add> run_type=DagRunType.MANUAL.value, <add> execution_date=timezone.parse(self.default_time_2), <add> start_date=timezone.parse(self.default_time), <add> external_trigger=True, <add> ) for i in range(3, 5)] <add> return [dagrun_model_1, dagrun_model_2] + dagrun_extra <add> return [dagrun_model_1, dagrun_model_2] <ide> <ide> <ide> class TestDeleteDagRun(TestDagRunEndpoint): <ide> @pytest.mark.skip(reason="Not implemented yet") <ide> def test_should_response_200(self): <del> response = self.client.delete("/dags/TEST_DAG_ID}/dagRuns/TEST_DAG_RUN_ID") <add> response = self.client.delete("api/v1/dags/TEST_DAG_ID}/dagRuns/TEST_DAG_RUN_ID") <ide> assert response.status_code == 204 <ide> <ide> <ide> class TestGetDagRun(TestDagRunEndpoint): <del> @pytest.mark.skip(reason="Not implemented yet") <del> def test_should_response_200(self): <del> response = self.client.get("/dags/TEST_DAG_ID/dagRuns/TEST_DAG_RUN_ID") <add> @provide_session <add> def test_should_response_200(self, session): <add> dagrun_model = DagRun( <add> dag_id='TEST_DAG_ID', <add> run_id='TEST_DAG_RUN_ID', <add> run_type=DagRunType.MANUAL.value, <add> execution_date=timezone.parse(self.default_time), <add> start_date=timezone.parse(self.default_time), <add> external_trigger=True, <add> ) <add> session.add(dagrun_model) <add> session.commit() <add> result = session.query(DagRun).all() <add> assert len(result) == 1 <add> response = self.client.get("api/v1/dags/TEST_DAG_ID/dagRuns/TEST_DAG_RUN_ID") <ide> assert response.status_code == 200 <add> self.assertEqual( <add> response.json, <add> { <add> 'dag_id': 'TEST_DAG_ID', <add> 'dag_run_id': 'TEST_DAG_RUN_ID', <add> 'end_date': None, <add> 'state': 'running', <add> 'execution_date': self.default_time, <add> 'external_trigger': True, <add> 'start_date': self.default_time, <add> 'conf': {}, <add> }, <add> ) <add> <add> def test_should_response_404(self): <add> response = self.client.get("api/v1/dags/invalid-id/dagRuns/invalid-id") <add> assert response.status_code == 404 <add> self.assertEqual( <add> {'detail': None, 'status': 404, 'title': 'DAGRun not found', 'type': 'about:blank'}, response.json <add> ) <ide> <ide> <ide> class TestGetDagRuns(TestDagRunEndpoint): <del> @pytest.mark.skip(reason="Not implemented yet") <del> def test_should_response_200(self): <del> response = self.client.get("/dags/TEST_DAG_ID/dagRuns/") <add> @provide_session <add> def test_should_response_200(self, session): <add> dagruns = self._create_test_dag_run() <add> session.add_all(dagruns) <add> session.commit() <add> result = session.query(DagRun).all() <add> assert len(result) == 2 <add> response = self.client.get("api/v1/dags/TEST_DAG_ID/dagRuns") <add> assert response.status_code == 200 <add> self.assertEqual( <add> response.json, <add> { <add> "dag_runs": [ <add> { <add> 'dag_id': 'TEST_DAG_ID', <add> 'dag_run_id': 'TEST_DAG_RUN_ID_1', <add> 'end_date': None, <add> 'state': 'running', <add> 'execution_date': self.default_time, <add> 'external_trigger': True, <add> 'start_date': self.default_time, <add> 'conf': {}, <add> }, <add> { <add> 'dag_id': 'TEST_DAG_ID', <add> 'dag_run_id': 'TEST_DAG_RUN_ID_2', <add> 'end_date': None, <add> 'state': 'running', <add> 'execution_date': self.default_time_2, <add> 'external_trigger': True, <add> 'start_date': self.default_time, <add> 'conf': {}, <add> }, <add> ], <add> "total_entries": 2, <add> }, <add> ) <add> <add> @provide_session <add> def test_should_return_all_with_tilde_as_dag_id(self, session): <add> dagruns = self._create_test_dag_run(extra_dag=True) <add> expected_dag_run_ids = ['TEST_DAG_ID', 'TEST_DAG_ID', <add> "TEST_DAG_ID_3", "TEST_DAG_ID_4"] <add> session.add_all(dagruns) <add> session.commit() <add> result = session.query(DagRun).all() <add> assert len(result) == 4 <add> response = self.client.get("api/v1/dags/~/dagRuns") <add> assert response.status_code == 200 <add> dag_run_ids = [dag_run["dag_id"] for dag_run in response.json["dag_runs"]] <add> self.assertEqual(dag_run_ids, expected_dag_run_ids) <add> <add> <add>class TestGetDagRunsPagination(TestDagRunEndpoint): <add> @parameterized.expand( <add> [ <add> ("api/v1/dags/TEST_DAG_ID/dagRuns?limit=1", ["TEST_DAG_RUN_ID1"]), <add> ("api/v1/dags/TEST_DAG_ID/dagRuns?limit=2", ["TEST_DAG_RUN_ID1", "TEST_DAG_RUN_ID2"]), <add> ( <add> "api/v1/dags/TEST_DAG_ID/dagRuns?offset=5", <add> [ <add> "TEST_DAG_RUN_ID6", <add> "TEST_DAG_RUN_ID7", <add> "TEST_DAG_RUN_ID8", <add> "TEST_DAG_RUN_ID9", <add> "TEST_DAG_RUN_ID10", <add> ], <add> ), <add> ( <add> "api/v1/dags/TEST_DAG_ID/dagRuns?offset=0", <add> [ <add> "TEST_DAG_RUN_ID1", <add> "TEST_DAG_RUN_ID2", <add> "TEST_DAG_RUN_ID3", <add> "TEST_DAG_RUN_ID4", <add> "TEST_DAG_RUN_ID5", <add> "TEST_DAG_RUN_ID6", <add> "TEST_DAG_RUN_ID7", <add> "TEST_DAG_RUN_ID8", <add> "TEST_DAG_RUN_ID9", <add> "TEST_DAG_RUN_ID10", <add> ], <add> ), <add> ("api/v1/dags/TEST_DAG_ID/dagRuns?limit=1&offset=5", ["TEST_DAG_RUN_ID6"]), <add> ("api/v1/dags/TEST_DAG_ID/dagRuns?limit=1&offset=1", ["TEST_DAG_RUN_ID2"]), <add> ("api/v1/dags/TEST_DAG_ID/dagRuns?limit=2&offset=2", ["TEST_DAG_RUN_ID3", "TEST_DAG_RUN_ID4"],), <add> ] <add> ) <add> @provide_session <add> def test_handle_limit_and_offset(self, url, expected_dag_run_ids, session): <add> dagrun_models = self._create_dag_runs(10) <add> session.add_all(dagrun_models) <add> session.commit() <add> <add> response = self.client.get(url) <add> assert response.status_code == 200 <add> <add> self.assertEqual(response.json["total_entries"], 10) <add> dag_run_ids = [dag_run["dag_run_id"] for dag_run in response.json["dag_runs"]] <add> self.assertEqual(dag_run_ids, expected_dag_run_ids) <add> <add> @provide_session <add> def test_should_respect_page_size_limit(self, session): <add> dagrun_models = self._create_dag_runs(200) <add> session.add_all(dagrun_models) <add> session.commit() <add> <add> response = self.client.get("api/v1/dags/TEST_DAG_ID/dagRuns") # default is 100 <add> assert response.status_code == 200 <add> <add> self.assertEqual(response.json["total_entries"], 200) <add> self.assertEqual(len(response.json["dag_runs"]), 100) # default is 100 <add> <add> def _create_dag_runs(self, count): <add> return [ <add> DagRun( <add> dag_id="TEST_DAG_ID", <add> run_id="TEST_DAG_RUN_ID" + str(i), <add> run_type=DagRunType.MANUAL.value, <add> execution_date=timezone.parse(self.default_time) + timedelta(minutes=i), <add> start_date=timezone.parse(self.default_time), <add> external_trigger=True, <add> ) <add> for i in range(1, count + 1) <add> ] <add> <add> <add>class TestGetDagRunsPaginationFilters(TestDagRunEndpoint): <add> @parameterized.expand( <add> [ <add> ( <add> "api/v1/dags/TEST_DAG_ID/dagRuns?start_date_gte=2020-06-18T18:00:00+00:00", <add> ["TEST_START_EXEC_DAY_18", "TEST_START_EXEC_DAY_19"], <add> ), <add> ( <add> "api/v1/dags/TEST_DAG_ID/dagRuns?start_date_lte=2020-06-11T18:00:00+00:00", <add> ["TEST_START_EXEC_DAY_10", "TEST_START_EXEC_DAY_11"], <add> ), <add> ( <add> "api/v1/dags/TEST_DAG_ID/dagRuns?start_date_lte=2020-06-15T18:00:00+00:00" <add> "&start_date_gte=2020-06-12T18:00:00Z", <add> ["TEST_START_EXEC_DAY_12", "TEST_START_EXEC_DAY_13", <add> "TEST_START_EXEC_DAY_14", "TEST_START_EXEC_DAY_15"], <add> ), <add> ( <add> "api/v1/dags/TEST_DAG_ID/dagRuns?execution_date_lte=2020-06-13T18:00:00+00:00", <add> ["TEST_START_EXEC_DAY_10", "TEST_START_EXEC_DAY_11", <add> "TEST_START_EXEC_DAY_12", "TEST_START_EXEC_DAY_13"], <add> ), <add> ( <add> "api/v1/dags/TEST_DAG_ID/dagRuns?execution_date_gte=2020-06-16T18:00:00+00:00", <add> ["TEST_START_EXEC_DAY_16", "TEST_START_EXEC_DAY_17", <add> "TEST_START_EXEC_DAY_18", "TEST_START_EXEC_DAY_19"], <add> ), <add> ] <add> ) <add> @provide_session <add> def test_date_filters_gte_and_lte(self, url, expected_dag_run_ids, session): <add> dagrun_models = self._create_dag_runs() <add> session.add_all(dagrun_models) <add> session.commit() <add> <add> response = self.client.get(url) <add> assert response.status_code == 200 <add> self.assertEqual(response.json["total_entries"], 10) <add> dag_run_ids = [dag_run["dag_run_id"] for dag_run in response.json["dag_runs"]] <add> self.assertEqual(dag_run_ids, expected_dag_run_ids) <add> <add> def _create_dag_runs(self): <add> dates = [ <add> '2020-06-10T18:00:00+00:00', <add> '2020-06-11T18:00:00+00:00', <add> '2020-06-12T18:00:00+00:00', <add> '2020-06-13T18:00:00+00:00', <add> '2020-06-14T18:00:00+00:00', <add> '2020-06-15T18:00:00Z', <add> '2020-06-16T18:00:00Z', <add> '2020-06-17T18:00:00Z', <add> '2020-06-18T18:00:00Z', <add> '2020-06-19T18:00:00Z', <add> ] <add> <add> return [ <add> DagRun( <add> dag_id="TEST_DAG_ID", <add> run_id="TEST_START_EXEC_DAY_1" + str(i), <add> run_type=DagRunType.MANUAL.value, <add> execution_date=timezone.parse(dates[i]), <add> start_date=timezone.parse(dates[i]), <add> external_trigger=True, <add> state='success', <add> ) <add> for i in range(len(dates)) <add> ] <add> <add> <add>class TestGetDagRunsEndDateFilters(TestDagRunEndpoint): <add> @parameterized.expand( <add> [ <add> ( <add> f"api/v1/dags/TEST_DAG_ID/dagRuns?end_date_gte=" <add> f"{(timezone.utcnow() + timedelta(days=1)).isoformat()}", <add> [], <add> ), <add> ( <add> f"api/v1/dags/TEST_DAG_ID/dagRuns?end_date_lte=" <add> f"{(timezone.utcnow() + timedelta(days=1)).isoformat()}", <add> ["TEST_DAG_RUN_ID_1"], <add> ), <add> ] <add> ) <add> @provide_session <add> def test_end_date_gte_lte(self, url, expected_dag_run_ids, session): <add> dagruns = self._create_test_dag_run('success') # state==success, then end date is today <add> session.add_all(dagruns) <add> session.commit() <add> <add> response = self.client.get(url) <ide> assert response.status_code == 200 <add> self.assertEqual(response.json["total_entries"], 2) <add> dag_run_ids = [dag_run["dag_run_id"] for dag_run in response.json["dag_runs"] if dag_run] <add> self.assertEqual(dag_run_ids, expected_dag_run_ids) <ide> <ide> <ide> class TestPatchDagRun(TestDagRunEndpoint): <ide><path>tests/api_connexion/schemas/test_dag_run_schema.py <add># Licensed to the Apache Software Foundation (ASF) under one <add># or more contributor license agreements. See the NOTICE file <add># distributed with this work for additional information <add># regarding copyright ownership. The ASF licenses this file <add># to you under the Apache License, Version 2.0 (the <add># "License"); you may not use this file except in compliance <add># with the License. You may obtain a copy of the License at <add># <add># http://www.apache.org/licenses/LICENSE-2.0 <add># <add># Unless required by applicable law or agreed to in writing, <add># software distributed under the License is distributed on an <add># "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY <add># KIND, either express or implied. See the License for the <add># specific language governing permissions and limitations <add># under the License. <add> <add>import unittest <add> <add>from dateutil.parser import parse <add> <add>from airflow.api_connexion.schemas.dag_run_schema import ( <add> DAGRunCollection, dagrun_collection_schema, dagrun_schema, <add>) <add>from airflow.models import DagRun <add>from airflow.utils import timezone <add>from airflow.utils.session import provide_session <add>from airflow.utils.types import DagRunType <add>from tests.test_utils.db import clear_db_runs <add> <add> <add>class TestDAGRunBase(unittest.TestCase): <add> <add> def setUp(self) -> None: <add> clear_db_runs() <add> self.default_time = "2020-06-09T13:59:56.336000+00:00" <add> <add> def tearDown(self) -> None: <add> clear_db_runs() <add> <add> <add>class TestDAGRunSchema(TestDAGRunBase): <add> <add> @provide_session <add> def test_serialze(self, session): <add> dagrun_model = DagRun(run_id='my-dag-run', <add> run_type=DagRunType.MANUAL.value, <add> execution_date=timezone.parse(self.default_time), <add> start_date=timezone.parse(self.default_time), <add> conf='{"start": "stop"}' <add> ) <add> session.add(dagrun_model) <add> session.commit() <add> dagrun_model = session.query(DagRun).first() <add> deserialized_dagrun = dagrun_schema.dump(dagrun_model) <add> <add> self.assertEqual( <add> deserialized_dagrun[0], <add> { <add> 'dag_id': None, <add> 'dag_run_id': 'my-dag-run', <add> 'end_date': None, <add> 'state': 'running', <add> 'execution_date': self.default_time, <add> 'external_trigger': True, <add> 'start_date': self.default_time, <add> 'conf': {"start": "stop"} <add> } <add> ) <add> <add> def test_deserialize(self): <add> # Only dag_run_id, execution_date, state, <add> # and conf are loaded. <add> # dag_run_id should be loaded as run_id <add> serialized_dagrun = { <add> 'dag_id': None, <add> 'dag_run_id': 'my-dag-run', <add> 'end_date': None, <add> 'state': 'failed', <add> 'execution_date': self.default_time, <add> 'external_trigger': True, <add> 'start_date': self.default_time, <add> 'conf': '{"start": "stop"}' <add> } <add> <add> result = dagrun_schema.load(serialized_dagrun) <add> self.assertEqual( <add> result.data, <add> { <add> 'run_id': 'my-dag-run', <add> 'execution_date': parse(self.default_time), <add> 'state': 'failed', <add> 'conf': {"start": "stop"} <add> } <add> ) <add> <add> def test_deserialize_2(self): <add> # Invalid state field should return None <add> serialized_dagrun = { <add> 'dag_id': None, <add> 'dag_run_id': 'my-dag-run', <add> 'end_date': None, <add> 'state': 'faileds', <add> 'execution_date': self.default_time, <add> 'external_trigger': True, <add> 'start_date': self.default_time, <add> 'conf': {"start": "stop"} <add> } <add> <add> result = dagrun_schema.load(serialized_dagrun) <add> self.assertEqual( <add> result.data, <add> { <add> 'run_id': 'my-dag-run', <add> 'execution_date': parse(self.default_time), <add> 'conf': {"start": "stop"} <add> } <add> ) <add> <add> <add>class TestDagRunCollection(TestDAGRunBase): <add> <add> @provide_session <add> def test_serialize(self, session): <add> dagrun_model_1 = DagRun( <add> run_id='my-dag-run', <add> execution_date=timezone.parse(self.default_time), <add> run_type=DagRunType.MANUAL.value, <add> start_date=timezone.parse(self.default_time), <add> conf='{"start": "stop"}' <add> ) <add> dagrun_model_2 = DagRun( <add> run_id='my-dag-run-2', <add> execution_date=timezone.parse(self.default_time), <add> start_date=timezone.parse(self.default_time), <add> run_type=DagRunType.MANUAL.value, <add> ) <add> dagruns = [dagrun_model_1, dagrun_model_2] <add> session.add_all(dagruns) <add> session.commit() <add> instance = DAGRunCollection(dag_runs=dagruns, <add> total_entries=2) <add> deserialized_dagruns = dagrun_collection_schema.dump(instance) <add> self.assertEqual( <add> deserialized_dagruns.data, <add> { <add> 'dag_runs': [ <add> { <add> 'dag_id': None, <add> 'dag_run_id': 'my-dag-run', <add> 'end_date': None, <add> 'execution_date': self.default_time, <add> 'external_trigger': True, <add> 'state': 'running', <add> 'start_date': self.default_time, <add> 'conf': {"start": "stop"} <add> }, <add> { <add> 'dag_id': None, <add> 'dag_run_id': 'my-dag-run-2', <add> 'end_date': None, <add> 'state': 'running', <add> 'execution_date': self.default_time, <add> 'external_trigger': True, <add> 'start_date': self.default_time, <add> 'conf': {} <add> } <add> ], <add> 'total_entries': 2 <add> } <add> ) <ide><path>tests/api_connexion/test_utils.py <add># Licensed to the Apache Software Foundation (ASF) under one <add># or more contributor license agreements. See the NOTICE file <add># distributed with this work for additional information <add># regarding copyright ownership. The ASF licenses this file <add># to you under the Apache License, Version 2.0 (the <add># "License"); you may not use this file except in compliance <add># with the License. You may obtain a copy of the License at <add># <add># http://www.apache.org/licenses/LICENSE-2.0 <add># <add># Unless required by applicable law or agreed to in writing, <add># software distributed under the License is distributed on an <add># "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY <add># KIND, either express or implied. See the License for the <add># specific language governing permissions and limitations <add># under the License. <add> <add>import unittest <add> <add>from airflow.api_connexion.exceptions import BadRequest <add>from airflow.api_connexion.utils import conn_parse_datetime <add>from airflow.utils import timezone <add> <add> <add>class TestDateTimeParser(unittest.TestCase): <add> <add> def setUp(self) -> None: <add> self.default_time = '2020-06-13T22:44:00+00:00' <add> self.default_time_2 = '2020-06-13T22:44:00Z' <add> <add> def test_works_with_datestring_ending_00_00(self): <add> datetime = conn_parse_datetime(self.default_time) <add> datetime2 = timezone.parse(self.default_time) <add> assert datetime == datetime2 <add> assert datetime.isoformat() == self.default_time <add> <add> def test_works_with_datestring_ending_with_zed(self): <add> datetime = conn_parse_datetime(self.default_time_2) <add> datetime2 = timezone.parse(self.default_time_2) <add> assert datetime == datetime2 <add> assert datetime.isoformat() == self.default_time # python uses +00:00 instead of Z <add> <add> def test_raises_400_for_invalid_arg(self): <add> invalid_datetime = '2020-06-13T22:44:00P' <add> with self.assertRaises(BadRequest): <add> conn_parse_datetime(invalid_datetime)
7
Javascript
Javascript
add benchmarks for `buffer.from()`
289d862c6f1baeef3c361aa9fb358b72afacd6e3
<ide><path>benchmark/buffers/buffer-from.js <add>'use strict'; <add> <add>const common = require('../common.js'); <add>const assert = require('assert'); <add>const bench = common.createBenchmark(main, { <add> source: [ <add> 'array', <add> 'arraybuffer', <add> 'arraybuffer-middle', <add> 'buffer', <add> 'uint8array', <add> 'string', <add> 'string-base64' <add> ], <add> len: [10, 2048], <add> n: [1024] <add>}); <add> <add>function main(conf) { <add> const len = +conf.len; <add> const n = +conf.n; <add> <add> const array = new Array(len).fill(42); <add> const arrayBuf = new ArrayBuffer(len); <add> const str = 'a'.repeat(len); <add> const buffer = Buffer.allocUnsafe(len); <add> const uint8array = new Uint8Array(len); <add> <add> var i; <add> <add> switch (conf.source) { <add> case 'array': <add> bench.start(); <add> for (i = 0; i < n * 1024; i++) { <add> Buffer.from(array); <add> } <add> bench.end(n); <add> break; <add> case 'arraybuffer': <add> bench.start(); <add> for (i = 0; i < n * 1024; i++) { <add> Buffer.from(arrayBuf); <add> } <add> bench.end(n); <add> break; <add> case 'arraybuffer-middle': <add> const offset = ~~(len / 4); <add> const length = ~~(len / 2); <add> bench.start(); <add> for (i = 0; i < n * 1024; i++) { <add> Buffer.from(arrayBuf, offset, length); <add> } <add> bench.end(n); <add> break; <add> case 'buffer': <add> bench.start(); <add> for (i = 0; i < n * 1024; i++) { <add> Buffer.from(buffer); <add> } <add> bench.end(n); <add> break; <add> case 'uint8array': <add> bench.start(); <add> for (i = 0; i < n * 1024; i++) { <add> Buffer.from(uint8array); <add> } <add> bench.end(n); <add> break; <add> case 'string': <add> bench.start(); <add> for (i = 0; i < n * 1024; i++) { <add> Buffer.from(str); <add> } <add> bench.end(n); <add> break; <add> case 'string-base64': <add> bench.start(); <add> for (i = 0; i < n * 1024; i++) { <add> Buffer.from(str, 'base64'); <add> } <add> bench.end(n); <add> break; <add> default: <add> assert.fail(null, null, 'Should not get here'); <add> } <add>}
1
Go
Go
fix container restart race condition
fc2f5758cf22fe5d3d46be7e4642abc0735e2c8d
<ide><path>container.go <ide> func (container *Container) monitor() { <ide> exitCode = container.cmd.ProcessState.Sys().(syscall.WaitStatus).ExitStatus() <ide> } <ide> <del> // Report status back <del> container.State.setStopped(exitCode) <del> <ide> if container.runtime != nil && container.runtime.srv != nil { <ide> container.runtime.srv.LogEvent("die", container.ID, container.runtime.repositories.ImageName(container.Image)) <ide> } <ide> func (container *Container) monitor() { <ide> container.stdin, container.stdinPipe = io.Pipe() <ide> } <ide> <add> // Report status back <add> container.State.setStopped(exitCode) <add> <ide> // Release the lock <ide> close(container.waitLock) <ide>
1
Python
Python
fix breadcrumb view names
02b6836ee88498861521dfff743467b0456ad109
<ide><path>rest_framework/utils/breadcrumbs.py <ide> def get_breadcrumbs(url): <ide> tuple of (name, url). <ide> """ <ide> <add> from rest_framework.settings import api_settings <ide> from rest_framework.views import APIView <ide> <add> view_name_func = api_settings.VIEW_NAME_FUNCTION <add> <ide> def breadcrumbs_recursive(url, breadcrumbs_list, prefix, seen): <ide> """ <ide> Add tuples of (name, url) to the breadcrumbs list, <ide> def breadcrumbs_recursive(url, breadcrumbs_list, prefix, seen): <ide> # Don't list the same view twice in a row. <ide> # Probably an optional trailing slash. <ide> if not seen or seen[-1] != view: <del> instance = view.cls() <del> name = instance.get_view_name() <add> suffix = getattr(view, 'suffix', None) <add> name = view_name_func(cls, suffix) <ide> breadcrumbs_list.insert(0, (name, prefix + url)) <ide> seen.append(view) <ide>
1
Go
Go
improve detach unit tests
e97364ecd73fac7abfbd82cc7e3ebaa6cda3c935
<ide><path>commands_test.go <ide> func TestRunDetach(t *testing.T) { <ide> <-ch <ide> }) <ide> <del> setTimeout(t, "Waiting for container to die timedout", 5*time.Second, func() { <add> time.Sleep(500 * time.Millisecond) <add> if !container.State.Running { <add> t.Fatal("The detached container should be still running") <add> } <add> <add> setTimeout(t, "Waiting for container to die timed out", 20*time.Second, func() { <ide> container.Kill() <ide> container.Wait() <ide> }) <ide> func TestAttachDetach(t *testing.T) { <ide> <-ch <ide> }) <ide> <add> time.Sleep(500 * time.Millisecond) <add> if !container.State.Running { <add> t.Fatal("The detached container should be still running") <add> } <add> <ide> setTimeout(t, "Waiting for container to die timedout", 5*time.Second, func() { <ide> container.Kill() <ide> container.Wait() <ide><path>container.go <ide> func (container *Container) monitor() { <ide> } <ide> utils.Debugf("Process finished") <ide> <del> if container.runtime != nil && container.runtime.srv != nil { <del> container.runtime.srv.LogEvent("die", container.ShortID(), container.runtime.repositories.ImageName(container.Image)) <del> } <ide> exitCode := -1 <ide> if container.cmd != nil { <ide> exitCode = container.cmd.ProcessState.Sys().(syscall.WaitStatus).ExitStatus() <ide> func (container *Container) monitor() { <ide> // Report status back <ide> container.State.setStopped(exitCode) <ide> <add> if container.runtime != nil && container.runtime.srv != nil { <add> container.runtime.srv.LogEvent("die", container.ShortID(), container.runtime.repositories.ImageName(container.Image)) <add> } <add> <ide> // Cleanup <ide> container.releaseNetwork() <ide> if container.Config.OpenStdin {
2
Go
Go
fix unregister stats on when rm running container
b3e8ab3021d2021202e14b912e7fdbfede4c7c20
<ide><path>daemon/delete.go <ide> func (daemon *Daemon) ContainerRm(name string, config *ContainerRmConfig) error <ide> <ide> // Destroy unregisters a container from the daemon and cleanly removes its contents from the filesystem. <ide> func (daemon *Daemon) rm(container *Container, forceRemove bool) (err error) { <del> // stop collection of stats for the container regardless <del> // if stats are currently getting collected. <del> daemon.statsCollector.stopCollection(container) <del> <ide> if container.IsRunning() { <ide> if !forceRemove { <ide> return fmt.Errorf("Conflict, You cannot remove a running container. Stop the container before attempting removal or use -f") <ide> func (daemon *Daemon) rm(container *Container, forceRemove bool) (err error) { <ide> } <ide> } <ide> <add> // stop collection of stats for the container regardless <add> // if stats are currently getting collected. <add> daemon.statsCollector.stopCollection(container) <add> <ide> element := daemon.containers.Get(container.ID) <ide> if element == nil { <ide> return fmt.Errorf("Container %v not found - maybe it was already destroyed?", container.ID) <ide><path>integration-cli/docker_api_containers_test.go <ide> func (s *DockerSuite) TestGetContainerStats(c *check.C) { <ide> } <ide> } <ide> <add>func (s *DockerSuite) TestContainerStatsRmRunning(c *check.C) { <add> out, _ := dockerCmd(c, "run", "-d", "busybox", "top") <add> id := strings.TrimSpace(out) <add> <add> buf := &channelBuffer{make(chan []byte, 1)} <add> defer buf.Close() <add> chErr := make(chan error) <add> go func() { <add> _, body, err := sockRequestRaw("GET", "/containers/"+id+"/stats?stream=1", nil, "application/json") <add> if err != nil { <add> chErr <- err <add> } <add> defer body.Close() <add> _, err = io.Copy(buf, body) <add> chErr <- err <add> }() <add> defer func() { <add> c.Assert(<-chErr, check.IsNil) <add> }() <add> <add> b := make([]byte, 32) <add> // make sure we've got some stats <add> _, err := buf.ReadTimeout(b, 2*time.Second) <add> c.Assert(err, check.IsNil) <add> <add> // Now remove without `-f` and make sure we are still pulling stats <add> _, err = runCommand(exec.Command(dockerBinary, "rm", id)) <add> c.Assert(err, check.Not(check.IsNil), check.Commentf("rm should have failed but didn't")) <add> _, err = buf.ReadTimeout(b, 2*time.Second) <add> c.Assert(err, check.IsNil) <add> dockerCmd(c, "rm", "-f", id) <add> <add> _, err = buf.ReadTimeout(b, 2*time.Second) <add> c.Assert(err, check.Not(check.IsNil)) <add>} <add> <ide> func (s *DockerSuite) TestGetStoppedContainerStats(c *check.C) { <ide> // TODO: this test does nothing because we are c.Assert'ing in goroutine <ide> var ( <ide><path>integration-cli/utils.go <ide> func parseCgroupPaths(procCgroupData string) map[string]string { <ide> } <ide> return cgroupPaths <ide> } <add> <add>type channelBuffer struct { <add> c chan []byte <add>} <add> <add>func (c *channelBuffer) Write(b []byte) (int, error) { <add> c.c <- b <add> return len(b), nil <add>} <add> <add>func (c *channelBuffer) Close() error { <add> close(c.c) <add> return nil <add>} <add> <add>func (c *channelBuffer) ReadTimeout(p []byte, n time.Duration) (int, error) { <add> select { <add> case b := <-c.c: <add> return copy(p[0:], b), nil <add> case <-time.After(n): <add> return -1, fmt.Errorf("timeout reading from channel") <add> } <add>}
3
Ruby
Ruby
use file.binread to pull in the schema cache
3b378a7840c8c2a46935c73dc56d94d4b6fcee9e
<ide><path>activerecord/lib/active_record/railtie.rb <ide> class Railtie < Rails::Railtie <ide> if app.config.use_schema_cache_dump <ide> filename = File.join(app.config.paths["db"].first, "schema_cache.dump") <ide> if File.file?(filename) <del> cache = Marshal.load(open(filename, 'rb') { |f| f.read }) <add> cache = Marshal.load File.binread filename <ide> if cache.version == ActiveRecord::Migrator.current_version <ide> ActiveRecord::Base.connection.schema_cache = cache <ide> else <ide><path>railties/lib/rails/application/configuration.rb <ide> def threadsafe! <ide> # YAML::load. <ide> def database_configuration <ide> require 'erb' <del> YAML::load(ERB.new(IO.read(paths["config/database"].first)).result) <add> YAML.load ERB.new(IO.read(paths["config/database"].first)).result <ide> end <ide> <ide> def log_level
2
Javascript
Javascript
fix textchange event enqueueing
792b69ba111f4b976fa298a902a1f049f127d954
<ide><path>src/eventPlugins/TextChangeEventPlugin.js <ide> var handlePropertyChange = function(nativeEvent) { <ide> // events and have it go through ReactEventTopLevelCallback. Since it <ide> // doesn't, we manually listen for the propertychange event and so we <ide> // have to enqueue and process the abstract event manually. <del> EventPluginHub.enqueueAbstractEvents(abstractEvent); <del> EventPluginHub.processAbstractEventQueue(); <add> EventPluginHub.enqueueEvents(abstractEvent); <add> EventPluginHub.processEventQueue(); <ide> } <ide> } <ide> };
1
Javascript
Javascript
fix infinite recursion in browsers with iterators
8cf226e44241aeafe147f6256a1351b46ac3cf91
<ide><path>src/classic/element/ReactElementValidator.js <ide> function validateChildKeys(node, parentType) { <ide> validateChildKeys(child, parentType); <ide> } <ide> } <del> } else if (ReactElement.isValidElement(node)) { <add> } else if ( <add> typeof node === 'string' || typeof node === 'number' || <add> ReactElement.isValidElement(node) <add> ) { <ide> // This element was passed in a valid location. <ide> return; <ide> } else if (node) { <ide><path>src/classic/element/__tests__/ReactElementValidator-test.js <ide> describe('ReactElementValidator', function() { <ide> it('does not warn for keys when passing children down', function() { <ide> spyOn(console, 'error'); <ide> <del> debugger; <ide> var Wrapper = React.createClass({ <ide> render: function() { <ide> return (
2
PHP
PHP
apply style fixes
d9ad6863ebdc3b4c1edafad3e4046e0822b0bf46
<ide><path>src/Illuminate/Validation/Concerns/ValidatesAttributes.php <ide> public function validateDistinct($attribute, $value, $parameters) <ide> $data = $this->getDistinctValues($attribute); <ide> <ide> if (in_array('ignore_case', $parameters)) { <del> return empty(preg_grep('/^' . preg_quote($value, '/') . '$/iu', $data)); <add> return empty(preg_grep('/^'.preg_quote($value, '/').'$/iu', $data)); <ide> } <ide> <ide> return ! in_array($value, array_values($data));
1
Javascript
Javascript
add write method to time tooltips
204ff4619a9dd055c88579af28770ea046461529
<ide><path>src/js/control-bar/progress-control/time-tooltip.js <ide> class TimeTooltip extends Component { <ide> } <ide> <ide> this.el_.style.right = `-${pullTooltipBy}px`; <add> this.write(content); <add> } <add> <add> /** <add> * Write the time to the tooltip DOM element. <add> * <add> * @param {String} content <add> * The formatted time for the tooltip. <add> */ <add> write(content) { <ide> Dom.textContent(this.el_, content); <ide> } <ide>
1
Python
Python
add test and logic for attribute access calls
cd6ec4094730156f27c69b327916e19f6c1c4b2f
<ide><path>scripts/flaskext_migrate.py <ide> def fix_standard_imports(red): <ide> try: <ide> if (node.value[0].value[0].value == 'flask' and <ide> node.value[0].value[1].value == 'ext'): <del> package = node.value[0].value[2] <add> package = node.value[0].value[2].value <ide> name = node.names()[0].split('.')[-1] <del> node.replace("import flask_%s as %s" % (package, name)) <add> if name == package: <add> node.replace("import flask_%s" % (package)) <add> else: <add> node.replace("import flask_%s as %s" % (package, name)) <ide> except IndexError: <ide> pass <ide> <ide> def fix_function_calls(red): <ide> try: <ide> if (node.value[0].value == 'flask' and <ide> node.value[1].value == 'ext'): <del> node.replace("flask_%s%s" % (node.value[3], node.value[3])) <add> params = _form_function_call(node) <add> node.replace("flask_%s%s" % (node.value[2], params)) <ide> except IndexError: <ide> pass <ide> <ide> return red <ide> <ide> <add>def _form_function_call(node): <add> """ <add> Reconstructs function call strings when making attribute access calls. <add> """ <add> node_vals = node.value <add> output = "." <add> for x, param in enumerate(node_vals[3::]): <add> if param.dumps()[0] == "(": <add> output = output[0:-1] + param.dumps() <add> return output <add> else: <add> output += param.dumps() + "." <add> <add> <ide> def check_user_input(): <ide> """Exits and gives error message if no argument is passed in the shell.""" <ide> if len(sys.argv) < 2: <ide><path>scripts/test_import_migration.py <ide> def test_multiline_import(): <ide> def test_module_import(): <ide> red = RedBaron("import flask.ext.foo") <ide> output = migrate.fix_tester(red) <del> assert output == "import flask_foo as foo" <add> assert output == "import flask_foo" <ide> <ide> <ide> def test_named_module_import(): <ide> def test_function_call_migration(): <ide> red = RedBaron("flask.ext.foo(var)") <ide> output = migrate.fix_tester(red) <ide> assert output == "flask_foo(var)" <add> <add> <add>def test_nested_function_call_migration(): <add> red = RedBaron("import flask.ext.foo\n\n" <add> "flask.ext.foo.bar(var)") <add> output = migrate.fix_tester(red) <add> assert output == ("import flask_foo\n\n" <add> "flask_foo.bar(var)")
2
Ruby
Ruby
fix cache_helper comment erb
421865e4fd69841889ba1eb51af2e0bef98a8cb0
<ide><path>actionview/lib/action_view/helpers/cache_helper.rb <ide> def cache(name = {}, options = nil, &block) <ide> <ide> # Cache fragments of a view if +condition+ is true <ide> # <del> # <%= cache_if admin?, project do %> <add> # <% cache_if admin?, project do %> <ide> # <b>All the topics on this project</b> <ide> # <%= render project.topics %> <ide> # <% end %> <ide> def cache_if(condition, name = {}, options = nil, &block) <ide> <ide> # Cache fragments of a view unless +condition+ is true <ide> # <del> # <%= cache_unless admin?, project do %> <add> # <% cache_unless admin?, project do %> <ide> # <b>All the topics on this project</b> <ide> # <%= render project.topics %> <ide> # <% end %>
1
Python
Python
use list to be safe
f4675ecfdfb0ca40a7a34e1edfc348fdb771786b
<ide><path>airflow/jobs.py <ide> def _execute(self): <ide> executor.heartbeat() <ide> <ide> # Reacting to events <del> for key, state in executor.get_event_buffer().items(): <add> for key, state in list(executor.get_event_buffer().items()): <ide> dag_id, task_id, execution_date = key <ide> if key not in tasks_to_run: <ide> continue
1
Javascript
Javascript
use arrow fns for lexical `this` in agent
1f045f491a6a8d6ac193474f3856e2bdbd6847be
<ide><path>lib/_http_agent.js <ide> function Agent(options) { <ide> <ide> EventEmitter.call(this); <ide> <del> var self = this; <add> this.defaultPort = 80; <add> this.protocol = 'http:'; <ide> <del> self.defaultPort = 80; <del> self.protocol = 'http:'; <del> <del> self.options = util._extend({}, options); <add> this.options = util._extend({}, options); <ide> <ide> // don't confuse net and make it think that we're connecting to a pipe <del> self.options.path = null; <del> self.requests = {}; <del> self.sockets = {}; <del> self.freeSockets = {}; <del> self.keepAliveMsecs = self.options.keepAliveMsecs || 1000; <del> self.keepAlive = self.options.keepAlive || false; <del> self.maxSockets = self.options.maxSockets || Agent.defaultMaxSockets; <del> self.maxFreeSockets = self.options.maxFreeSockets || 256; <del> <del> self.on('free', function(socket, options) { <del> var name = self.getName(options); <add> this.options.path = null; <add> this.requests = {}; <add> this.sockets = {}; <add> this.freeSockets = {}; <add> this.keepAliveMsecs = this.options.keepAliveMsecs || 1000; <add> this.keepAlive = this.options.keepAlive || false; <add> this.maxSockets = this.options.maxSockets || Agent.defaultMaxSockets; <add> this.maxFreeSockets = this.options.maxFreeSockets || 256; <add> <add> this.on('free', (socket, options) => { <add> var name = this.getName(options); <ide> debug('agent.on(free)', name); <ide> <ide> if (socket.writable && <del> self.requests[name] && self.requests[name].length) { <del> self.requests[name].shift().onSocket(socket); <del> if (self.requests[name].length === 0) { <add> this.requests[name] && this.requests[name].length) { <add> this.requests[name].shift().onSocket(socket); <add> if (this.requests[name].length === 0) { <ide> // don't leak <del> delete self.requests[name]; <add> delete this.requests[name]; <ide> } <ide> } else { <ide> // If there are no pending requests, then put it in <ide> function Agent(options) { <ide> if (req && <ide> req.shouldKeepAlive && <ide> socket.writable && <del> self.keepAlive) { <del> var freeSockets = self.freeSockets[name]; <add> this.keepAlive) { <add> var freeSockets = this.freeSockets[name]; <ide> var freeLen = freeSockets ? freeSockets.length : 0; <ide> var count = freeLen; <del> if (self.sockets[name]) <del> count += self.sockets[name].length; <add> if (this.sockets[name]) <add> count += this.sockets[name].length; <ide> <del> if (count > self.maxSockets || freeLen >= self.maxFreeSockets) { <add> if (count > this.maxSockets || freeLen >= this.maxFreeSockets) { <ide> socket.destroy(); <del> } else if (self.keepSocketAlive(socket)) { <add> } else if (this.keepSocketAlive(socket)) { <ide> freeSockets = freeSockets || []; <del> self.freeSockets[name] = freeSockets; <add> this.freeSockets[name] = freeSockets; <ide> socket[async_id_symbol] = -1; <ide> socket._httpMessage = null; <del> self.removeSocket(socket, options); <add> this.removeSocket(socket, options); <ide> freeSockets.push(socket); <ide> } else { <ide> // Implementation doesn't want to keep socket alive <ide> Agent.prototype.addRequest = function addRequest(req, options, port/*legacy*/, <ide> }; <ide> <ide> Agent.prototype.createSocket = function createSocket(req, options, cb) { <del> var self = this; <ide> options = util._extend({}, options); <del> util._extend(options, self.options); <add> util._extend(options, this.options); <ide> if (options.socketPath) <ide> options.path = options.socketPath; <ide> <ide> if (!options.servername) <ide> options.servername = calculateServerName(options, req); <ide> <del> var name = self.getName(options); <add> var name = this.getName(options); <ide> options._agentKey = name; <ide> <ide> debug('createConnection', name, options); <ide> options.encoding = null; <ide> var called = false; <del> const newSocket = self.createConnection(options, oncreate); <del> if (newSocket) <del> oncreate(null, newSocket); <ide> <del> function oncreate(err, s) { <add> const oncreate = (err, s) => { <ide> if (called) <ide> return; <ide> called = true; <ide> if (err) <ide> return cb(err); <del> if (!self.sockets[name]) { <del> self.sockets[name] = []; <add> if (!this.sockets[name]) { <add> this.sockets[name] = []; <ide> } <del> self.sockets[name].push(s); <del> debug('sockets', name, self.sockets[name].length); <del> installListeners(self, s, options); <add> this.sockets[name].push(s); <add> debug('sockets', name, this.sockets[name].length); <add> installListeners(this, s, options); <ide> cb(null, s); <del> } <add> }; <add> <add> const newSocket = this.createConnection(options, oncreate); <add> if (newSocket) <add> oncreate(null, newSocket); <ide> }; <ide> <ide> function calculateServerName(options, req) {
1
Text
Text
add a changelog entry for [ci skip]
2bc88d4f74a36e8014534c4b574140a8a3fc624d
<ide><path>actionview/CHANGELOG.md <add>* The `video_tag` helper accepts a number as `:size` <add> <add> The `:size` option of the `video_tag` helper now can be specified <add> with a stringified number. The `width` and `height` attributes of <add> the generated tag will be the same. <add> <add> *Kuldeep Aggarwal* <add> <ide> * A Cycle object should accept an array and cycle through it as it would with a set of <ide> comma-separated objects. <ide>
1
Ruby
Ruby
add documentation for respond_to's any method
5ec91ef5ecfce409f1b90e631bdedb4bcef8de5f
<ide><path>actionpack/lib/action_controller/base/mime_responds.rb <ide> module InstanceMethods <ide> # Note that you can define your own XML parameter parser which would allow you to describe multiple entities <ide> # in a single request (i.e., by wrapping them all in a single root node), but if you just go with the flow <ide> # and accept Rails' defaults, life will be much easier. <add> # <add> # Further more, you may call the #any method on the block's object in order to run the same code for different responses. <add> # def index <add> # <add> # respond_to do |format| <add> # format.html { @people = People.all(:limit => 10) } <add> # format.any(:xml, :atom) { @people = People.all } <add> # end <add> # end <add> # <add> # This will limit the @people variable to 10 people records if we're requesting HTML, but will list all the <add> # people for any xml or atom request. <ide> # <ide> # If you need to use a MIME type which isn't supported by default, you can register your own handlers in <ide> # environment.rb as follows.
1
Ruby
Ruby
remove feature flags
e41f0bf8c8365c150935f03f3ecd14b44187b2ef
<ide><path>Library/Homebrew/formula_installer.rb <ide> def check_install_sanity <ide> EOS <ide> end <ide> <del> if ENV["HOMEBREW_CHECK_RECURSIVE_VERSION_DEPENDENCIES"] <del> version_hash = {} <del> version_conflicts = Set.new <del> recursive_formulae.each do |f| <del> name = f.name <del> unversioned_name, = name.split("@") <del> version_hash[unversioned_name] ||= Set.new <del> version_hash[unversioned_name] << name <del> next if version_hash[unversioned_name].length < 2 <del> version_conflicts += version_hash[unversioned_name] <del> end <del> unless version_conflicts.empty? <del> raise CannotInstallFormulaError, <<-EOS.undent <del> #{formula.full_name} contains conflicting version recursive dependencies: <del> #{version_conflicts.to_a.join ", "} <del> View these with `brew deps --tree #{formula.full_name}`. <del> EOS <del> end <del> end <del> <del> unless ENV["HOMEBREW_NO_CHECK_UNLINKED_DEPENDENCIES"] <del> unlinked_deps = recursive_formulae.select do |dep| <del> dep.installed? && !dep.keg_only? && !dep.linked_keg.directory? <del> end <del> <del> unless unlinked_deps.empty? <del> raise CannotInstallFormulaError, "You must `brew link #{unlinked_deps*" "}` before #{formula.full_name} can be installed" <del> end <add> version_hash = {} <add> version_conflicts = Set.new <add> recursive_formulae.each do |f| <add> name = f.name <add> unversioned_name, = name.split("@") <add> version_hash[unversioned_name] ||= Set.new <add> version_hash[unversioned_name] << name <add> next if version_hash[unversioned_name].length < 2 <add> version_conflicts += version_hash[unversioned_name] <add> end <add> unless version_conflicts.empty? <add> raise CannotInstallFormulaError, <<-EOS.undent <add> #{formula.full_name} contains conflicting version recursive dependencies: <add> #{version_conflicts.to_a.join ", "} <add> View these with `brew deps --tree #{formula.full_name}`. <add> EOS <ide> end <ide> <ide> pinned_unsatisfied_deps = recursive_deps.select do |dep|
1
PHP
PHP
add test for leading dot cookies
bd317d91f01b0d6501a4bcf819d37c1c1b1c120e
<ide><path>tests/TestCase/Http/Cookie/CookieCollectionTest.php <ide> public function testAddToRequest() <ide> $this->assertSame(['blog' => 'b'], $request->getCookieParams()); <ide> } <ide> <add> /** <add> * Test adding cookies ignores leading dot <add> * <add> * @return void <add> */ <add> public function testAddToRequestLeadingDot() <add> { <add> $collection = new CookieCollection(); <add> $collection = $collection <add> ->add(new Cookie('public', 'b', null, '/', '.example.com')); <add> $request = new ServerRequest([ <add> 'environment' => [ <add> 'HTTP_HOST' => 'example.com', <add> 'REQUEST_URI' => '/blog' <add> ] <add> ]); <add> $request = $collection->addToRequest($request); <add> $this->assertSame(['public' => 'b'], $request->getCookieParams()); <add> } <add> <ide> /** <ide> * Test adding cookies checks the secure crumb <ide> * <ide> public function testAddToRequestSecureCrumb() <ide> $collection = new CookieCollection(); <ide> $collection = $collection <ide> ->add(new Cookie('secret', 'A', null, '/', 'example.com', true)) <del> ->add(new Cookie('public', 'b', null, '/', 'example.com', false)); <add> ->add(new Cookie('public', 'b', null, '/', '.example.com', false)); <ide> $request = new ServerRequest([ <ide> 'environment' => [ <ide> 'HTTPS' => 'on',
1
Javascript
Javascript
use map to track indexes
aa899aa6d0434d4183a9a5ed86f99faf29298b11
<ide><path>lib/internal/cluster/child.js <ide> const Worker = require('internal/cluster/worker'); <ide> const { internal, sendHelper } = require('internal/cluster/utils'); <ide> const cluster = new EventEmitter(); <ide> const handles = {}; <del>const indexes = {}; <add>const indexes = new Map(); <ide> const noop = () => {}; <ide> <ide> module.exports = cluster; <ide> cluster._getServer = function(obj, options, cb) { <ide> options.addressType, <ide> options.fd ].join(':'); <ide> <del> if (indexes[indexesKey] === undefined) <del> indexes[indexesKey] = 0; <add> let index = indexes.get(indexesKey); <add> <add> if (index === undefined) <add> index = 0; <ide> else <del> indexes[indexesKey]++; <add> index++; <add> <add> indexes.set(indexesKey, index); <ide> <ide> const message = util._extend({ <ide> act: 'queryServer', <del> index: indexes[indexesKey], <add> index, <ide> data: null <ide> }, options); <ide> <ide> function shared(message, handle, indexesKey, cb) { <ide> handle.close = function() { <ide> send({ act: 'close', key }); <ide> delete handles[key]; <del> delete indexes[indexesKey]; <add> indexes.delete(indexesKey); <ide> return close.apply(this, arguments); <ide> }.bind(handle); <ide> assert(handles[key] === undefined); <ide> function rr(message, indexesKey, cb) { <ide> <ide> send({ act: 'close', key }); <ide> delete handles[key]; <del> delete indexes[indexesKey]; <add> indexes.delete(indexesKey); <ide> key = undefined; <ide> } <ide>
1
Javascript
Javascript
ignore blob urls when updating source cache
9cb1ba5ae94f7e9ad3467b8507ecd0ded96bc6d0
<ide><path>src/js/player.js <ide> class Player extends Component { <ide> src = srcObj.src; <ide> type = srcObj.type; <ide> } <add> <add> // if we are a blob url, don't update the source cache <add> // blob urls can arise when playback is done via Media Source Extension (MSE) <add> // such as m3u8 sources with @videojs/http-streaming (VHS) <add> if (/^blob:/.test(src)) { <add> return; <add> } <add> <ide> // make sure all the caches are set to default values <ide> // to prevent null checking <ide> this.cache_.source = this.cache_.source || {};
1
PHP
PHP
refactor the config class
e39ab9a0f97cbbf5e9d8cd494ce19276f6e6e75e
<ide><path>system/config.php <ide> public static function get($key, $default = null) <ide> { <ide> list($module, $file, $key) = static::parse($key); <ide> <del> if ( ! static::load($module, $file)) return is_callable($default) ? call_user_func($default) : $default; <add> if ( ! static::load($module, $file)) <add> { <add> return is_callable($default) ? call_user_func($default) : $default; <add> } <ide> <ide> if (is_null($key)) return static::$items[$module][$file]; <ide> <ide> private static function parse($key) <ide> { <ide> $module = (strpos($key, '::') !== false) ? substr($key, 0, strpos($key, ':')) : 'application'; <ide> <del> if ($module !== 'application') $key = substr($key, strpos($key, ':') + 2); <add> if ($module !== 'application') <add> { <add> $key = substr($key, strpos($key, ':') + 2); <add> } <ide> <ide> $key = (count($segments = explode('.', $key)) > 1) ? implode('.', array_slice($segments, 1)) : null; <ide> <ide> private static function parse($key) <ide> /** <ide> * Load all of the configuration items from a file. <ide> * <del> * If it exists, the configuration file in the application/config directory will be loaded first. <del> * Any environment specific configuration files will be merged with the root file. <del> * <ide> * @param string $file <ide> * @param string $module <ide> * @return bool <ide> public static function load($module, $file) <ide> <ide> $path = ($module === 'application') ? CONFIG_PATH : MODULE_PATH.$module.'/config/'; <ide> <add> // Load the base configuration items from the application directory. <ide> $config = (file_exists($base = $path.$file.EXT)) ? require $base : array(); <ide> <add> // Merge any environment specific configuration into the base array. <ide> if (isset($_SERVER['LARAVEL_ENV']) and file_exists($path = $path.$_SERVER['LARAVEL_ENV'].'/'.$file.EXT)) <ide> { <ide> $config = array_merge($config, require $path);
1
Python
Python
add support for "cpuplatform" field in gce driver
5cbd7888f505a527b3e48765680801066c6c2b08
<ide><path>libcloud/compute/drivers/gce.py <ide> def _to_node(self, node, use_disk_cache=False): <ide> extra['zone'] = self.ex_get_zone(node['zone']) <ide> extra['image'] = node.get('image') <ide> extra['machineType'] = node.get('machineType') <add> extra['cpuPlatform'] = node.get('cpuPlatform') <add> extra['minCpuPlatform'] = node.get('minCpuPlatform') <ide> extra['disks'] = node.get('disks', []) <ide> extra['networkInterfaces'] = node.get('networkInterfaces') <ide> extra['id'] = node['id']
1
Mixed
Python
add new initializations to the docs
e1df04c1376a20dbe1a2f15f20d2d34a9462454a
<ide><path>docs/sources/initializations.md <ide> model.add(Dense(64, 64, init='uniform')) <ide> - __lecun_uniform__: Uniform initialization scaled by the square root of the number of inputs (LeCun 98). <ide> - __normal__ <ide> - __orthogonal__: Use with square 2D layers (`shape[0] == shape[1]`). <del>- __zero__ <ide>\ No newline at end of file <add>- __zero__ <add>- __glorot_normal__: Gaussian initialization scaled by fan_in + fan_out (Glorot 2010) <add>- __he_normal__: Gaussian initialization scaled by fan_in (He et al., 2014) <ide><path>keras/initializations.py <ide> def glorot_normal(shape): <ide> ''' <ide> fan_in = shape[0] if len(shape) == 2 else np.prod(shape[1:]) <ide> fan_out = shape[1] if len(shape) == 2 else shape[0] <del> s = np.sqrt(2. / (fan_in + fan_out) <add> s = np.sqrt(2. / (fan_in + fan_out)) <ide> return normal(shape, s) <ide> <ide> def he_normal(shape):
2
Ruby
Ruby
add regression test for
406374de095f167bc742aa518a6818cacd344ffe
<ide><path>activerecord/test/cases/autosave_association_test.rb <ide> def save(**) <ide> def test_should_not_load_the_associated_model <ide> assert_queries(1) { @ship.name = "The Vile Insanity"; @ship.save! } <ide> end <add> <add> def test_should_save_with_non_nullable_foreign_keys <add> parent = Post.new title: "foo", body: "..." <add> child = parent.comments.build body: "..." <add> child.save! <add> assert_equal child.reload.post, parent.reload <add> end <ide> end <ide> <ide> module AutosaveAssociationOnACollectionAssociationTests
1
Ruby
Ruby
fix doctor on 10.5
733e280e61bc74258993fd19dedd8c0c3d1fd5be
<ide><path>Library/Homebrew/cmd/doctor.rb <ide> def check_user_path <ide> end <ide> <ide> # Don't complain about sbin not being in the path if it doesn't exist <del> if (HOMEBREW_PREFIX+'sbin').children.count > 0 <add> if (HOMEBREW_PREFIX+'sbin').children.length > 0 <ide> unless seen_prefix_sbin <ide> puts <<-EOS.undent <ide> Some brews install binaries to sbin instead of bin, but Homebrew's
1
Javascript
Javascript
fix sloppy factoring in `performsyncworkonroot`
bd7f4a013be3ef272a01874532bee71ad861e617
<ide><path>packages/react-reconciler/src/ReactFiberLane.new.js <ide> export function markRootExpired(root: FiberRoot, expiredLanes: Lanes) { <ide> root.pendingLanes |= SyncLane; <ide> } <ide> <del>export function areLanesExpired(root: FiberRoot, lanes: Lanes) { <del> const SyncLaneIndex = 0; <del> const entanglements = root.entanglements; <del> return (entanglements[SyncLaneIndex] & lanes) !== NoLanes; <del>} <del> <ide> export function markRootMutableRead(root: FiberRoot, updateLane: Lane) { <ide> root.mutableReadLanes |= updateLane & root.pendingLanes; <ide> } <ide><path>packages/react-reconciler/src/ReactFiberLane.old.js <ide> export function markRootExpired(root: FiberRoot, expiredLanes: Lanes) { <ide> root.pendingLanes |= SyncLane; <ide> } <ide> <del>export function areLanesExpired(root: FiberRoot, lanes: Lanes) { <del> const SyncLaneIndex = 0; <del> const entanglements = root.entanglements; <del> return (entanglements[SyncLaneIndex] & lanes) !== NoLanes; <del>} <del> <ide> export function markRootMutableRead(root: FiberRoot, updateLane: Lane) { <ide> root.mutableReadLanes |= updateLane & root.pendingLanes; <ide> } <ide><path>packages/react-reconciler/src/ReactFiberWorkLoop.new.js <ide> import { <ide> markRootPinged, <ide> markRootExpired, <ide> markRootFinished, <del> areLanesExpired, <ide> getHighestPriorityLane, <ide> addFiberToLanesMap, <ide> movePendingFibersToMemoized, <ide> function performConcurrentWorkOnRoot(root, didTimeout) { <ide> // synchronously to block concurrent data mutations, and we'll includes <ide> // all pending updates are included. If it still fails after the second <ide> // attempt, we'll give up and commit the resulting tree. <del> lanes = getLanesToRetrySynchronouslyOnError(root); <del> if (lanes !== NoLanes) { <del> exitStatus = renderRootSync(root, lanes); <add> const errorRetryLanes = getLanesToRetrySynchronouslyOnError(root); <add> if (errorRetryLanes !== NoLanes) { <add> lanes = errorRetryLanes; <add> exitStatus = renderRootSync(root, errorRetryLanes); <ide> } <ide> } <ide> <ide> function performSyncWorkOnRoot(root) { <ide> <ide> flushPassiveEffects(); <ide> <del> let lanes; <del> let exitStatus; <del> if ( <del> root === workInProgressRoot && <del> areLanesExpired(root, workInProgressRootRenderLanes) <add> let lanes = getNextLanes(root, NoLanes); <add> if (includesSomeLane(lanes, SyncLane)) { <add> if ( <add> root === workInProgressRoot && <add> includesSomeLane(lanes, workInProgressRootRenderLanes) <add> ) { <add> // There's a partial tree, and at least one of its lanes has expired. Finish <add> // rendering it before rendering the rest of the expired work. <add> lanes = workInProgressRootRenderLanes; <add> } <add> } else if ( <add> !( <add> enableSyncDefaultUpdates && <add> (includesSomeLane(lanes, DefaultLane) || <add> includesSomeLane(lanes, DefaultHydrationLane)) <add> ) <ide> ) { <del> // There's a partial tree, and at least one of its lanes has expired. Finish <del> // rendering it before rendering the rest of the expired work. <del> lanes = workInProgressRootRenderLanes; <del> exitStatus = renderRootSync(root, lanes); <del> } else { <del> lanes = getNextLanes(root, NoLanes); <del> exitStatus = renderRootSync(root, lanes); <add> // There's no remaining sync work left. <add> ensureRootIsScheduled(root, now()); <add> return null; <ide> } <ide> <add> let exitStatus = renderRootSync(root, lanes); <ide> if (root.tag !== LegacyRoot && exitStatus === RootErrored) { <ide> executionContext |= RetryAfterError; <ide> <ide> function performSyncWorkOnRoot(root) { <ide> // synchronously to block concurrent data mutations, and we'll includes <ide> // all pending updates are included. If it still fails after the second <ide> // attempt, we'll give up and commit the resulting tree. <del> lanes = getLanesToRetrySynchronouslyOnError(root); <del> if (lanes !== NoLanes) { <add> const errorRetryLanes = getLanesToRetrySynchronouslyOnError(root); <add> if (errorRetryLanes !== NoLanes) { <add> lanes = errorRetryLanes; <ide> exitStatus = renderRootSync(root, lanes); <ide> } <ide> } <ide> function performSyncWorkOnRoot(root) { <ide> const finishedWork: Fiber = (root.current.alternate: any); <ide> root.finishedWork = finishedWork; <ide> root.finishedLanes = lanes; <del> if (enableSyncDefaultUpdates && !includesSomeLane(lanes, SyncLane)) { <add> if ( <add> enableSyncDefaultUpdates && <add> (includesSomeLane(lanes, DefaultLane) || <add> includesSomeLane(lanes, DefaultHydrationLane)) <add> ) { <ide> finishConcurrentRender(root, exitStatus, lanes); <ide> } else { <ide> commitRoot(root); <ide> function commitRootImpl(root, renderPriorityLevel) { <ide> } <ide> <ide> return null; <add> } else { <add> if (__DEV__) { <add> if (lanes === NoLanes) { <add> console.error( <add> 'root.finishedLanes should not be empty during a commit. This is a ' + <add> 'bug in React.', <add> ); <add> } <add> } <ide> } <ide> root.finishedWork = null; <ide> root.finishedLanes = NoLanes; <ide><path>packages/react-reconciler/src/ReactFiberWorkLoop.old.js <ide> import { <ide> markRootPinged, <ide> markRootExpired, <ide> markRootFinished, <del> areLanesExpired, <ide> getHighestPriorityLane, <ide> addFiberToLanesMap, <ide> movePendingFibersToMemoized, <ide> function performConcurrentWorkOnRoot(root, didTimeout) { <ide> // synchronously to block concurrent data mutations, and we'll includes <ide> // all pending updates are included. If it still fails after the second <ide> // attempt, we'll give up and commit the resulting tree. <del> lanes = getLanesToRetrySynchronouslyOnError(root); <del> if (lanes !== NoLanes) { <del> exitStatus = renderRootSync(root, lanes); <add> const errorRetryLanes = getLanesToRetrySynchronouslyOnError(root); <add> if (errorRetryLanes !== NoLanes) { <add> lanes = errorRetryLanes; <add> exitStatus = renderRootSync(root, errorRetryLanes); <ide> } <ide> } <ide> <ide> function performSyncWorkOnRoot(root) { <ide> <ide> flushPassiveEffects(); <ide> <del> let lanes; <del> let exitStatus; <del> if ( <del> root === workInProgressRoot && <del> areLanesExpired(root, workInProgressRootRenderLanes) <add> let lanes = getNextLanes(root, NoLanes); <add> if (includesSomeLane(lanes, SyncLane)) { <add> if ( <add> root === workInProgressRoot && <add> includesSomeLane(lanes, workInProgressRootRenderLanes) <add> ) { <add> // There's a partial tree, and at least one of its lanes has expired. Finish <add> // rendering it before rendering the rest of the expired work. <add> lanes = workInProgressRootRenderLanes; <add> } <add> } else if ( <add> !( <add> enableSyncDefaultUpdates && <add> (includesSomeLane(lanes, DefaultLane) || <add> includesSomeLane(lanes, DefaultHydrationLane)) <add> ) <ide> ) { <del> // There's a partial tree, and at least one of its lanes has expired. Finish <del> // rendering it before rendering the rest of the expired work. <del> lanes = workInProgressRootRenderLanes; <del> exitStatus = renderRootSync(root, lanes); <del> } else { <del> lanes = getNextLanes(root, NoLanes); <del> exitStatus = renderRootSync(root, lanes); <add> // There's no remaining sync work left. <add> ensureRootIsScheduled(root, now()); <add> return null; <ide> } <ide> <add> let exitStatus = renderRootSync(root, lanes); <ide> if (root.tag !== LegacyRoot && exitStatus === RootErrored) { <ide> executionContext |= RetryAfterError; <ide> <ide> function performSyncWorkOnRoot(root) { <ide> // synchronously to block concurrent data mutations, and we'll includes <ide> // all pending updates are included. If it still fails after the second <ide> // attempt, we'll give up and commit the resulting tree. <del> lanes = getLanesToRetrySynchronouslyOnError(root); <del> if (lanes !== NoLanes) { <add> const errorRetryLanes = getLanesToRetrySynchronouslyOnError(root); <add> if (errorRetryLanes !== NoLanes) { <add> lanes = errorRetryLanes; <ide> exitStatus = renderRootSync(root, lanes); <ide> } <ide> } <ide> function performSyncWorkOnRoot(root) { <ide> const finishedWork: Fiber = (root.current.alternate: any); <ide> root.finishedWork = finishedWork; <ide> root.finishedLanes = lanes; <del> if (enableSyncDefaultUpdates && !includesSomeLane(lanes, SyncLane)) { <add> if ( <add> enableSyncDefaultUpdates && <add> (includesSomeLane(lanes, DefaultLane) || <add> includesSomeLane(lanes, DefaultHydrationLane)) <add> ) { <ide> finishConcurrentRender(root, exitStatus, lanes); <ide> } else { <ide> commitRoot(root); <ide> function commitRootImpl(root, renderPriorityLevel) { <ide> } <ide> <ide> return null; <add> } else { <add> if (__DEV__) { <add> if (lanes === NoLanes) { <add> console.error( <add> 'root.finishedLanes should not be empty during a commit. This is a ' + <add> 'bug in React.', <add> ); <add> } <add> } <ide> } <ide> root.finishedWork = null; <ide> root.finishedLanes = NoLanes;
4
Python
Python
fix misleading docstrings
b64e5919715f8dee546fbfc5049f8ec1574c2567
<ide><path>keras/layers/recurrent.py <ide> class SimpleRNN(Recurrent): <ide> units: Positive integer, dimensionality of the output space. <ide> activation: Activation function to use <ide> (see [activations](../activations.md)). <del> If you don't specify anything, no activation is applied <add> If you pass None, no activation is applied <ide> (ie. "linear" activation: `a(x) = x`). <ide> use_bias: Boolean, whether the layer uses a bias vector. <ide> kernel_initializer: Initializer for the `kernel` weights matrix, <ide> class GRU(Recurrent): <ide> units: Positive integer, dimensionality of the output space. <ide> activation: Activation function to use <ide> (see [activations](../activations.md)). <del> If you don't specify anything, no activation is applied <add> If you pass None, no activation is applied <ide> (ie. "linear" activation: `a(x) = x`). <ide> recurrent_activation: Activation function to use <ide> for the recurrent step <ide> class LSTM(Recurrent): <ide> units: Positive integer, dimensionality of the output space. <ide> activation: Activation function to use <ide> (see [activations](../activations.md)). <del> If you don't specify anything, no activation is applied <add> If you pass None, no activation is applied <ide> (ie. "linear" activation: `a(x) = x`). <ide> recurrent_activation: Activation function to use <ide> for the recurrent step
1
Text
Text
update broken links
0eda4d5988d5c37965f4119c4a3d302ff8a97d93
<ide><path>packages/next/README.md <ide> module.exports = (phase, { defaultConfig }) => { <ide> } <ide> ``` <ide> <del>`phase` is the current context in which the configuration is loaded. You can see all phases here: [constants](/packages/next-server/lib/constants.ts) <add>`phase` is the current context in which the configuration is loaded. You can see all phases here: [constants](/packages/next/next-server/lib/constants.ts) <ide> Phases can be imported from `next/constants`: <ide> <ide> ```js <ide> Next.js bundles [styled-jsx](https://github.com/zeit/styled-jsx) supporting scop <ide> <ide> We track V8. Since V8 has wide support for ES6 and `async` and `await`, we transpile those. Since V8 doesn’t support class decorators, we don’t transpile those. <ide> <del>See the documentation about [customizing the babel config](#customizing-babel-config) and [next/preset](/packages/next/build/babel/preset.js) for more information. <add>See the documentation about [customizing the babel config](#customizing-babel-config) and [next/preset](/packages/next/build/babel/preset.ts) for more information. <ide> <ide> </details> <ide>
1
Text
Text
replace forum link on contribute page
f4fe5a183b7ff5309cea87de9948a14d94ab46fd
<ide><path>docs/_coverpage.md <ide> <ide> ## Here are some quick and fun ways you can help the community. <ide> <del>- <span class='cover-icon'><i class="fas fa-question-circle"></i></span> [Help by answering coding questions](https://forum.freecodecamp.org/c/help?max_posts=1) on our community forum. <add>- <span class='cover-icon'><i class="fas fa-question-circle"></i></span> [Help by answering coding questions](https://forum.freecodecamp.org) on our community forum. <ide> - <span class='cover-icon'><i class="fas fa-comments"></i></span> [Give feedback on coding projects](https://forum.freecodecamp.org/c/project-feedback?max_posts=1) built by campers. <ide> - <span class='cover-icon'><i class="fas fa-language"></i></span> [Help us translate](https://translate.freecodecamp.org) these Contributing Guidelines. <ide> - <span class='cover-icon'><i class="fab fa-github"></i></span> [Contribute to our open source codebase](/index?id=our-open-source-codebase) on GitHub.
1
Javascript
Javascript
fix accidental quadratic
a1d96714401aaeae2bf4a5244cad2ef57fed7d29
<ide><path>src/menu-sort-helpers.js <ide> function sortTopologically (originalOrder, edgesById) { <ide> sorted.push(id) <ide> } <ide> <del> while (true) { <del> const unmarkedId = originalOrder.find(id => !marked.has(id)) <del> if (unmarkedId == null) { <del> break <del> } <del> visit(unmarkedId) <del> } <add> originalOrder.forEach(visit) <ide> return sorted <ide> } <ide>
1
Python
Python
add tests for fast tokenizers
2818e505694ee4b5b02a9c7b51faf4dd137728d4
<ide><path>tests/test_tokenization_bert.py <ide> VOCAB_FILES_NAMES, <ide> BasicTokenizer, <ide> BertTokenizer, <add> BertTokenizerFast, <ide> WordpieceTokenizer, <ide> _is_control, <ide> _is_punctuation, <ide> class BertTokenizationTest(TokenizerTesterMixin, unittest.TestCase): <ide> <ide> tokenizer_class = BertTokenizer <add> test_rust_tokenizer = True <ide> <ide> def setUp(self): <ide> super(BertTokenizationTest, self).setUp() <ide> def setUp(self): <ide> def get_tokenizer(self, **kwargs): <ide> return BertTokenizer.from_pretrained(self.tmpdirname, **kwargs) <ide> <add> def get_rust_tokenizer(self, **kwargs): <add> return BertTokenizerFast.from_pretrained(self.tmpdirname, **kwargs) <add> <ide> def get_input_output_texts(self): <ide> input_text = "UNwant\u00E9d,running" <ide> output_text = "unwanted, running" <ide> def test_full_tokenizer(self): <ide> self.assertListEqual(tokens, ["un", "##want", "##ed", ",", "runn", "##ing"]) <ide> self.assertListEqual(tokenizer.convert_tokens_to_ids(tokens), [7, 4, 5, 10, 8, 9]) <ide> <add> def test_rust_and_python_full_tokenizers(self): <add> if not self.test_rust_tokenizer: <add> return <add> <add> tokenizer = self.get_tokenizer() <add> rust_tokenizer = self.get_rust_tokenizer(add_special_tokens=False) <add> <add> sequence = u"UNwant\u00E9d,running" <add> <add> tokens = tokenizer.tokenize(sequence) <add> rust_tokens = rust_tokenizer.tokenize(sequence) <add> self.assertListEqual(tokens, rust_tokens) <add> <add> ids = tokenizer.encode(sequence, add_special_tokens=False) <add> rust_ids = rust_tokenizer.encode(sequence) <add> self.assertListEqual(ids, rust_ids) <add> <add> rust_tokenizer = self.get_rust_tokenizer() <add> ids = tokenizer.encode(sequence) <add> rust_ids = rust_tokenizer.encode(sequence) <add> self.assertListEqual(ids, rust_ids) <add> <ide> def test_chinese(self): <ide> tokenizer = BasicTokenizer() <ide> <ide><path>tests/test_tokenization_common.py <ide> class TokenizerTesterMixin: <ide> <ide> tokenizer_class = None <add> test_rust_tokenizer = False <ide> <ide> def setUp(self): <ide> self.tmpdirname = tempfile.mkdtemp() <ide> def tearDown(self): <ide> def get_tokenizer(self, **kwargs): <ide> raise NotImplementedError <ide> <add> def get_rust_tokenizer(self, **kwargs): <add> raise NotImplementedError <add> <ide> def get_input_output_texts(self): <ide> raise NotImplementedError <ide> <ide><path>tests/test_tokenization_gpt2.py <ide> import os <ide> import unittest <ide> <del>from transformers.tokenization_gpt2 import VOCAB_FILES_NAMES, GPT2Tokenizer <add>from transformers.tokenization_gpt2 import VOCAB_FILES_NAMES, GPT2Tokenizer, GPT2TokenizerFast <ide> <ide> from .test_tokenization_common import TokenizerTesterMixin <ide> <ide> <ide> class GPT2TokenizationTest(TokenizerTesterMixin, unittest.TestCase): <ide> <ide> tokenizer_class = GPT2Tokenizer <add> test_rust_tokenizer = True <ide> <ide> def setUp(self): <ide> super(GPT2TokenizationTest, self).setUp() <ide> def get_tokenizer(self, **kwargs): <ide> kwargs.update(self.special_tokens_map) <ide> return GPT2Tokenizer.from_pretrained(self.tmpdirname, **kwargs) <ide> <add> def get_rust_tokenizer(self, **kwargs): <add> kwargs.update(self.special_tokens_map) <add> return GPT2TokenizerFast.from_pretrained(self.tmpdirname, **kwargs) <add> <ide> def get_input_output_texts(self): <ide> input_text = "lower newer" <ide> output_text = "lower newer" <ide> def test_full_tokenizer(self): <ide> input_tokens = tokens + [tokenizer.unk_token] <ide> input_bpe_tokens = [14, 15, 10, 9, 3, 2, 15, 19] <ide> self.assertListEqual(tokenizer.convert_tokens_to_ids(input_tokens), input_bpe_tokens) <add> <add> def test_rust_and_python_full_tokenizers(self): <add> if not self.test_rust_tokenizer: <add> return <add> <add> tokenizer = self.get_tokenizer() <add> rust_tokenizer = self.get_rust_tokenizer(add_special_tokens=False, add_prefix_space=True) <add> <add> sequence = u"lower newer" <add> <add> # Testing tokenization <add> tokens = tokenizer.tokenize(sequence, add_prefix_space=True) <add> rust_tokens = rust_tokenizer.tokenize(sequence) <add> self.assertListEqual(tokens, rust_tokens) <add> <add> # Testing conversion to ids without special tokens <add> ids = tokenizer.encode(sequence, add_special_tokens=False, add_prefix_space=True) <add> rust_ids = rust_tokenizer.encode(sequence) <add> self.assertListEqual(ids, rust_ids) <add> <add> # Testing conversion to ids with special tokens <add> rust_tokenizer = self.get_rust_tokenizer(add_prefix_space=True) <add> ids = tokenizer.encode(sequence, add_prefix_space=True) <add> rust_ids = rust_tokenizer.encode(sequence) <add> self.assertListEqual(ids, rust_ids) <add> <add> # Testing the unknown token <add> input_tokens = tokens + [rust_tokenizer.unk_token] <add> input_bpe_tokens = [14, 15, 10, 9, 3, 2, 15, 19] <add> self.assertListEqual(rust_tokenizer.convert_tokens_to_ids(input_tokens), input_bpe_tokens)
3
Javascript
Javascript
add tests for searchparams dev warning
08859275ae8295ee29214f7c26138b3fee76bbcb
<ide><path>test/integration/dynamic-routing/pages/d/[id].js <add>import { useRouter } from 'next/router' <add> <add>const Page = () => { <add> const router = useRouter() <add> const { query } = router <add> return <p id="asdf">This is {query.id}</p> <add>} <add> <add>export default Page <ide><path>test/integration/dynamic-routing/pages/index.js <ide> import Link from 'next/link' <ide> import { useRouter } from 'next/router' <ide> <add>if (typeof window !== 'undefined') { <add> window.caughtWarns = [] <add> const origWarn = window.console.warn <add> window.console.warn = function (...args) { <add> window.caughtWarns.push(args) <add> origWarn(...args) <add> } <add>} <add> <ide> const Page = () => { <ide> return ( <ide> <div> <ide> const Page = () => { <ide> <a id="nested-ssg-catch-all-multi">Nested Catch-all route (multi)</a> <ide> </Link> <ide> <br /> <add> <Link href="/d/dynamic-1"> <add> <a id="dynamic-route-no-as">Dynamic route no as</a> <add> </Link> <ide> <p id="query">{JSON.stringify(Object.keys(useRouter().query))}</p> <ide> </div> <ide> ) <ide><path>test/integration/dynamic-routing/test/index.test.js <ide> function runTests(dev) { <ide> expect(url).toBe('?fromHome=true') <ide> }) <ide> <add> if (dev) { <add> it('should not have any console warnings on initial load', async () => { <add> const browser = await webdriver(appPort, '/') <add> expect(await browser.eval('window.caughtWarns')).toEqual([]) <add> }) <add> <add> it('should not have any console warnings when navigating to dynamic route', async () => { <add> let browser <add> try { <add> browser = await webdriver(appPort, '/') <add> await browser.eval('window.beforeNav = 1') <add> await browser.elementByCss('#dynamic-route-no-as').click() <add> await browser.waitForElementByCss('#asdf') <add> <add> expect(await browser.eval('window.beforeNav')).toBe(1) <add> <add> const text = await browser.elementByCss('#asdf').text() <add> expect(text).toMatch(/this is.*?dynamic-1/i) <add> expect(await browser.eval('window.caughtWarns')).toEqual([]) <add> } finally { <add> if (browser) await browser.close() <add> } <add> }) <add> } <add> <ide> it('should navigate to a dynamic page successfully', async () => { <ide> let browser <ide> try { <ide> function runTests(dev) { <ide> helloworld: 'hello-world', <ide> }, <ide> }, <add> { <add> namedRegex: '^/d/(?<id>[^/]+?)(?:/)?$', <add> page: '/d/[id]', <add> regex: normalizeRegEx('^\\/d\\/([^\\/]+?)(?:\\/)?$'), <add> routeKeys: { <add> id: 'id', <add> }, <add> }, <ide> { <ide> namedRegex: '^/dash/(?<helloworld>[^/]+?)(?:/)?$', <ide> page: '/dash/[hello-world]',
3
Javascript
Javascript
improve way of adding exported tests to test tree
01cfe5b67a3c5df3920d7404d5dbe0a424190792
<ide><path>test/ConfigTestCases.test.js <ide> const vm = require("vm"); <ide> const mkdirp = require("mkdirp"); <ide> const rimraf = require("rimraf"); <ide> const checkArrayExpectation = require("./checkArrayExpectation"); <add>const createLazyTestEnv = require("./helpers/createLazyTestEnv"); <ide> const FakeDocument = require("./helpers/FakeDocument"); <ide> <ide> const Stats = require("../lib/Stats"); <ide> describe("ConfigTestCases", () => { <ide> category.name, <ide> testName <ide> ); <del> const exportedTests = []; <del> const exportedBeforeEach = []; <del> const exportedAfterEach = []; <ide> it( <ide> testName + " should compile", <ide> () => <ide> describe("ConfigTestCases", () => { <ide> } catch (e) { <ide> // ignored <ide> } <add> if (testConfig.timeout) setDefaultTimeout(testConfig.timeout); <ide> <ide> webpack(options, (err, stats) => { <ide> if (err) { <ide> describe("ConfigTestCases", () => { <ide> ) <ide> return; <ide> <del> function _it(title, fn) { <del> exportedTests.push({ <del> title, <del> fn, <del> timeout: testConfig.timeout <del> }); <del> } <del> <del> function _beforeEach(fn) { <del> return exportedBeforeEach.push(fn); <del> } <del> <del> function _afterEach(fn) { <del> return exportedAfterEach.push(fn); <del> } <del> <ide> const globalContext = { <ide> console: console, <ide> expect: expect, <ide> describe("ConfigTestCases", () => { <ide> "Should have found at least one bundle file per webpack config" <ide> ) <ide> ); <del> if (exportedTests.length < filesCount) <add> if (getNumberOfTests() < filesCount) <ide> return done(new Error("No tests exported by test case")); <ide> if (testConfig.afterExecute) testConfig.afterExecute(); <del> const asyncSuite = describe(`ConfigTestCases ${ <del> category.name <del> } ${testName} exported tests`, () => { <del> exportedBeforeEach.forEach(beforeEach); <del> exportedAfterEach.forEach(afterEach); <del> exportedTests.forEach( <del> ({ title, fn, timeout }) => <del> fn <del> ? fit(title, fn, timeout) <del> : fit(title, () => {}).pend("Skipped") <del> ); <del> }); <del> // workaround for jest running clearSpies on the wrong suite (invoked by clearResourcesForRunnable) <del> asyncSuite.disabled = true; <del> <del> jasmine <del> .getEnv() <del> .execute([asyncSuite.id], asyncSuite) <del> .then(done, done); <add> done(); <ide> }); <ide> }) <ide> ); <add> <add> const { <add> it: _it, <add> beforeEach: _beforeEach, <add> afterEach: _afterEach, <add> setDefaultTimeout, <add> getNumberOfTests <add> } = createLazyTestEnv(jasmine.getEnv(), 10000); <ide> }); <ide> }); <ide> }); <ide><path>test/HotTestCases.test.js <ide> const path = require("path"); <ide> const fs = require("fs"); <ide> const vm = require("vm"); <ide> const checkArrayExpectation = require("./checkArrayExpectation"); <add>const createLazyTestEnv = require("./helpers/createLazyTestEnv"); <ide> <ide> const webpack = require("../lib/webpack"); <ide> <ide> describe("HotTestCases", () => { <ide> categories.forEach(category => { <ide> describe(category.name, () => { <ide> category.tests.forEach(testName => { <del> describe( <del> testName, <del> () => { <del> let exportedTests = []; <del> it(testName + " should compile", done => { <add> describe(testName, () => { <add> it( <add> testName + " should compile", <add> done => { <ide> const testDirectory = path.join( <ide> casesPath, <ide> category.name, <ide> describe("HotTestCases", () => { <ide> return; <ide> } <ide> <del> function _it(title, fn) { <del> exportedTests.push({ title, fn, timeout: 10000 }); <del> } <del> <ide> function _next(callback) { <ide> fakeUpdateLoaderOptions.updateIndex++; <ide> compiler.run((err, stats) => { <ide> describe("HotTestCases", () => { <ide> } else return require(module); <ide> } <ide> _require("./bundle.js"); <del> if (exportedTests.length < 1) <add> if (getNumberOfTests() < 1) <ide> return done(new Error("No tests exported by test case")); <ide> <del> const asyncSuite = describe(`HotTestCases ${ <del> category.name <del> } ${testName} exported tests`, () => { <del> exportedTests.forEach(({ title, fn, timeout }) => { <del> jest.setTimeout(10000); <del> return fn <del> ? fit(title, fn, timeout) <del> : fit(title, () => {}).pend("Skipped"); <del> }); <del> }); <del> // workaround for jest running clearSpies on the wrong suite (invoked by clearResourcesForRunnable) <del> asyncSuite.disabled = true; <del> <del> jasmine <del> .getEnv() <del> .execute([asyncSuite.id], asyncSuite) <del> .then(done, done); <add> done(); <ide> }); <del> }); <del> }, <del> 10000 <del> ); <add> }, <add> 10000 <add> ); <add> <add> const { it: _it, getNumberOfTests } = createLazyTestEnv( <add> jasmine.getEnv(), <add> 10000 <add> ); <add> }); <ide> }); <ide> }); <ide> }); <ide><path>test/TestCases.template.js <ide> const vm = require("vm"); <ide> const mkdirp = require("mkdirp"); <ide> const UglifyJsPlugin = require("uglifyjs-webpack-plugin"); <ide> const checkArrayExpectation = require("./checkArrayExpectation"); <add>const createLazyTestEnv = require("./helpers/createLazyTestEnv"); <ide> <ide> const Stats = require("../lib/Stats"); <ide> const webpack = require("../lib/webpack"); <ide> const describeCases = config => { <ide> it( <ide> testName + " should compile", <ide> done => { <del> const exportedTests = []; <ide> webpack(options, (err, stats) => { <ide> if (err) done(err); <ide> const statOptions = Stats.presetToOptions("verbose"); <ide> const describeCases = config => { <ide> ) <ide> return; <ide> <del> function _it(title, fn) { <del> exportedTests.push({ title, fn, timeout: 10000 }); <del> } <del> <ide> function _require(module) { <ide> if (module.substr(0, 2) === "./") { <ide> const p = path.join(outputDirectory, module); <ide> const describeCases = config => { <ide> } <ide> _require.webpackTestSuiteRequire = true; <ide> _require("./bundle.js"); <del> if (exportedTests.length === 0) <add> if (getNumberOfTests() === 0) <ide> return done(new Error("No tests exported by test case")); <ide> <del> const asyncSuite = describe(`${config.name} ${ <del> category.name <del> } ${testName} exported tests`, () => { <del> exportedTests.forEach( <del> ({ title, fn, timeout }) => <del> fn <del> ? fit(title, fn, timeout) <del> : fit(title, () => {}).pend("Skipped") <del> ); <del> }); <del> // workaround for jest running clearSpies on the wrong suite (invoked by clearResourcesForRunnable) <del> asyncSuite.disabled = true; <del> <del> jasmine <del> .getEnv() <del> .execute([asyncSuite.id], asyncSuite) <del> .then(done, done); <add> done(); <ide> }); <ide> }, <ide> 60000 <ide> ); <add> <add> const { it: _it, getNumberOfTests } = createLazyTestEnv( <add> jasmine.getEnv(), <add> 10000 <add> ); <ide> }); <ide> }); <ide> }); <ide><path>test/configCases/web/prefetch-preload/index.js <ide> let oldNonce; <ide> let oldPublicPath; <ide> <del>beforeEach(() => { <add>beforeEach(done => { <ide> oldNonce = __webpack_nonce__; <ide> oldPublicPath = __webpack_public_path__; <add> done(); <ide> }); <ide> <del>afterEach(() => { <add>afterEach(done => { <ide> __webpack_nonce__ = oldNonce; <ide> __webpack_public_path__ = oldPublicPath; <add> done(); <ide> }); <ide> <ide> it("should prefetch and preload child chunks on chunk load", () => { <ide><path>test/helpers/createLazyTestEnv.js <add>module.exports = (env, globalTimeout = 2000) => { <add> const suite = env.describe("exported tests", () => { <add> // this must have a child to be handled correctly <add> env.it("should run the exported tests", () => {}); <add> }); <add> let numberOfTests = 0; <add> const beforeAndAfterFns = () => { <add> let currentSuite = suite; <add> let afters = []; <add> let befores = []; <add> <add> while (currentSuite) { <add> befores = befores.concat(currentSuite.beforeFns); <add> afters = afters.concat(currentSuite.afterFns); <add> <add> currentSuite = currentSuite.parentSuite; <add> } <add> <add> return { <add> befores: befores.reverse(), <add> afters: afters <add> }; <add> }; <add> return { <add> setDefaultTimeout(time) { <add> globalTimeout = time; <add> }, <add> getNumberOfTests() { <add> return numberOfTests; <add> }, <add> it(title, fn, timeout = globalTimeout) { <add> numberOfTests++; <add> let spec; <add> if(fn) { <add> spec = env.fit(title, fn, timeout); <add> } else { <add> spec = env.fit(title, () => {}); <add> spec.pend("Skipped"); <add> } <add> suite.addChild(spec); <add> spec.disabled = false; <add> spec.getSpecName = () => { <add> return `${suite.getFullName()} ${spec.description}`; <add> }; <add> spec.beforeAndAfterFns = beforeAndAfterFns; <add> spec.result.fullName = spec.getFullName(); <add> }, <add> beforeEach(fn, timeout = globalTimeout) { <add> suite.beforeEach({ <add> fn, <add> timeout: () => timeout <add> }); <add> }, <add> afterEach(fn, timeout = globalTimeout) { <add> suite.afterEach({ <add> fn, <add> timeout: () => timeout <add> }); <add> } <add> }; <add>};
5
Javascript
Javascript
fix a bug in d3.interpolatestring
dd5b21a3638b4058c647ecd843a343781b77b261
<ide><path>d3.js <ide> d3.interpolateString = function(a, b) { <ide> n, // q.length <ide> o; <ide> <add> // Reset our regular expression! <add> d3_interpolate_number.lastIndex = 0; <add> <ide> // Find all numbers in b. <ide> for (i = 0; m = d3_interpolate_number.exec(b); ++i) { <ide> if (m.index) s.push(b.substring(s0, s1 = m.index)); <ide> d3.interpolateObject = function(a, b) { <ide> } <ide> <ide> var d3_interpolate_number = /[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g, <del> d3_interpolate_digits = /[-+]?\d*\.?\d*(?:[eE][-]?\d+)?(.*)/, <ide> d3_interpolate_rgb = {background: 1, fill: 1, stroke: 1}; <ide> <ide> function d3_interpolateByName(n) { <ide><path>d3.min.js <del>(function(){function bT(){return"circle"}function bS(){return 64}function bQ(a){return a.endAngle}function bP(a){return a.startAngle}function bO(a){return a.radius}function bN(a){return a.target}function bM(a){return a.source}function bL(){return 0}function bK(a,b,c){a.push("C",bG(bH,b),",",bG(bH,c),",",bG(bI,b),",",bG(bI,c),",",bG(bJ,b),",",bG(bJ,c))}function bG(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function bF(a){var b,c=-1,d=a.length,e=d+4,f,g=[],h=[];while(++c<4)f=a[c%d],g.push(f[0]),h.push(f[1]);b=[bG(bJ,g),",",bG(bJ,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),bK(b,g,h);return b.join("")}function bE(a){if(a.length<3)return bx(a);var b=[],c=1,d=a.length,e=a[0],f=e[0],g=e[1],h=[f,f,f,(e=a[1])[0]],i=[g,g,g,e[1]];b.push(f,",",g),bK(b,h,i);while(++c<d)e=a[c],h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),bK(b,h,i);c=-1;while(++c<2)h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),bK(b,h,i);return b.join("")}function bD(a,b){var c=[],d=(1-b)/2,e,f=a[0],g=a[1],h=1,i=a.length;while(++h<i)e=f,f=g,g=a[h],c.push([d*(g[0]-e[0]),d*(g[1]-e[1])]);return c}function bC(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return bx(a);var c=a.length!=b.length,d="",e=a[0],f=a[1],g=b[0],h=g,i=1;c&&(d+="Q"+(f[0]-g[0]*2/3)+","+(f[1]-g[1]*2/3)+","+f[0]+","+f[1],e=a[1],i=2);if(b.length>1){h=b[1],f=a[i],i++,d+="C"+(e[0]+g[0])+","+(e[1]+g[1])+","+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1];for(var j=2;j<b.length;j++,i++)f=a[i],h=b[j],d+="S"+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1]}if(c){var k=a[i];d+="Q"+(f[0]+h[0]*2/3)+","+(f[1]+h[1]*2/3)+","+k[0]+","+k[1]}return d}function bB(a,b,c){return a.length<3?bx(a):a[0]+bC(a,bD(a,b))}function bA(a,b){return a.length<3?bx(a):a[0]+bC((a.push(a[0]),a),bD([a[a.length-2]].concat(a,[a[1]]),b))}function bz(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("H",(e=a[c])[0],"V",e[1]);return b.join("")}function by(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("V",(e=a[c])[1],"H",e[0]);return b.join("")}function bx(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("L",(e=a[c])[0],",",e[1]);return b.join("")}function bv(a){return a[1]}function bu(a){return a[0]}function bt(a,b,c,d){var e=[],f=-1,g=b.length,h=typeof c=="function",i=typeof d=="function",j;if(h&&i)while(++f<g)e.push([c.call(a,j=b[f],f),d.call(a,j,f)]);else if(h)while(++f<g)e.push([c.call(a,b[f],f),d]);else if(i)while(++f<g)e.push([c,d.call(a,b[f],f)]);else while(++f<g)e.push([c,d]);return e}function bs(a){return a.endAngle}function br(a){return a.startAngle}function bq(a){return a.outerRadius}function bp(a){return a.innerRadius}function bi(a){return function(b){return-Math.pow(-b,a)}}function bh(a){return function(b){return Math.pow(b,a)}}function bg(a){return-Math.log(-a)/Math.LN10}function bf(a){return Math.log(a)/Math.LN10}function bd(){var a=null,b=Z;while(b)b=b.flush?a?a.next=b.next:Z=b.next:(a=b).next;a||(_=0)}function bc(){var a,b=Date.now(),c=null,d=Z;while(d)a=b-d.then,a>d.delay&&(d.flush=d.callback(a)),d=(c=d).next;bd(),_&&be(bc)}function bb(){_=1,$=0,be(bc)}function ba(a,b){var c=Date.now(),d=!1,e=c+b,f,g=Z;if(!!isFinite(b)){while(g){if(g.callback==a)g.then=c,g.delay=b,d=!0;else{var h=g.then+g.delay;h<e&&(e=h)}f=g,g=g.next}d||(Z={callback:a,then:c,delay:b,next:Z}),_||(clearTimeout($),$=setTimeout(bb,Math.max(24,e-c)))}}function Y(a){return typeof a=="function"?function(b,c,d){return d3.interpolate(d,String(a.call(this,b,c)))}:(a=String(a),function(b,c,d){return d3.interpolate(d,a)})}function X(a){function n(b){var g=!0,l=-1;a.each(function(){if(i[++l]!=2){var a=(b-j[l])/k[l],n=this.__transition__,o,p,q=e[l];if(a<1){g=!1;if(a<0)return}else a=1;if(i[l]){if(!n||n.active!=c){i[l]=2;return}}else{if(!n||n.active>c){i[l]=2;return}i[l]=1,h.start.dispatch.apply(this,arguments),q=e[l]={},n.active=c;for(p in d)q[p]=d[p].apply(this,arguments)}o=m(a);for(p in d)q[p].call(this,o);if(a==1){i[l]=2;if(n.active==c){var r=n.owner;r==c&&(delete this.__transition__,f&&this.parentNode.removeChild(this)),W=c,h.end.dispatch.apply(this,arguments),W=0,n.owner=r}}}});return g}var b={},c=W||++V,d={},e=[],f=!1,h=d3.dispatch("start","end"),i=[],j=[],k=[],l,m=d3.ease("cubic-in-out");a.each(function(){(this.__transition__||(this.__transition__={})).owner=c}),b.delay=function(c){var d=Infinity,e=-1;typeof c=="function"?a.each(function(a,b){var f=j[++e]=+c.apply(this,arguments);f<d&&(d=f)}):(d=+c,a.each(function(a,b){j[++e]=d})),ba(n,d);return b},b.duration=function(c){var d=-1;typeof c=="function"?(l=0,a.each(function(a,b){var e=k[++d]=+c.apply(this,arguments);e>l&&(l=e)})):(l=+c,a.each(function(a,b){k[++d]=l}));return b},b.ease=function(a){m=typeof a=="function"?a:d3.ease.apply(d3,arguments);return b},b.attrTween=function(a,c){function f(b,d){var e=c.call(this,b,d,this.getAttributeNS(a.space,a.local));return function(b){this.setAttributeNS(a.space,a.local,e(b))}}function e(b,d){var e=c.call(this,b,d,this.getAttribute(a));return function(b){this.setAttribute(a,e(b))}}d["attr."+a]=a.local?f:e;return b},b.attr=function(a,c){return b.attrTween(a,Y(c))},b.styleTween=function(a,c,e){function f(b,d){var f=c.call(this,b,d,window.getComputedStyle(this,null).getPropertyValue(a));return function(b){this.style.setProperty(a,f(b),e)}}arguments.length<3&&(e=null),d["style."+a]=f;return b},b.style=function(a,c,d){arguments.length<3&&(d=null);return b.styleTween(a,Y(c),d)},b.select=function(b){var c,d=X(a.select(b)).ease(m);c=-1,d.delay(function(a,b){return j[++c]}),c=-1,d.duration(function(a,b){return k[++c]});return d},b.selectAll=function(b){var c,d=X(a.selectAll(b)).ease(m);c=-1,d.delay(function(a,b){return j[b?c:++c]}),c=-1,d.duration(function(a,b){return k[b?c:++c]});return d},b.remove=function(){f=!0;return b},b.each=function(a,c){h[a].add(c);return b},b.call=g;return b.delay(0).duration(250)}function U(a){return{__data__:a}}function T(a){arguments.length||(a=d3.ascending);return function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function S(a){function b(b){var c=[],d,e,f,g;for(var h=0,i=a.length;h<i;h++){f=a[h],c.push(d=[]),d.parentNode=f.parentNode;for(var j=0,k=f.length;j<k;j++)(g=f[j])?(d.push(e=b(f.parentNode)),e.__data__=g.__data__):d.push(null)}return R(c)}a.append=function(a){function d(b){return b.appendChild(document.createElementNS(a.space,a.local))}function c(b){return b.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return b(a.local?d:c)},a.insert=function(a,c){function e(b){return b.insertBefore(document.createElementNS(a.space,a.local),O(c,b))}function d(b){return b.insertBefore(document.createElement(a),O(c,b))}a=d3.ns.qualify(a);return b(a.local?e:d)};return a}function R(a){function d(b){for(var c=0,d=a.length;c<d;c++){var e=a[c];for(var f=0,g=e.length;f<g;f++){var h=e[f];if(h)return b.call(h,h.__data__,f)}}return null}function c(b){var c=[],d,e,f;for(var g=0,h=a.length;g<h;g++){e=a[g];for(var i=0,j=e.length;i<j;i++)if(f=e[i])c.push(d=b(f)),d.parentNode=f}return R(c)}function b(b){var c=[],d,e,f,g;for(var h=0,i=a.length;h<i;h++){f=a[h],c.push(d=[]),d.parentNode=f.parentNode;for(var j=0,k=f.length;j<k;j++)(g=f[j])?(d.push(e=b(g)),e&&"__data__"in g&&(e.__data__=g.__data__)):d.push(null)}return R(c)}a.select=function(a){return b(function(b){return O(a,b)})},a.selectAll=function(a){return c(function(b){return P(a,b)})},a.filter=function(b){var c=[],d,e,f;for(var g=0,h=a.length;g<h;g++){e=a[g],c.push(d=[]),d.parentNode=e.parentNode;for(var i=0,j=e.length;i<j;i++)(f=e[i])&&b.call(f,f.__data__,i)&&d.push(f)}return R(c)},a.map=function(b){var c,d;for(var e=0,f=a.length;e<f;e++){c=a[e];for(var g=0,h=c.length;g<h;g++)if(d=c[g])d.__data__=b.call(d,d.__data__,g)}return a},a.data=function(b,c){function g(a,b){var g=0,h=a.length,i=b.length,j=Math.min(h,i),k=Math.max(h,i),l=[],m=[],n=[],o,p;if(c){var q={},r=[],s,t=b.length;for(g=0;g<h;g++)s=c.call(o=a[g],o.__data__,g),s in q?n[t++]=a[g]:q[s]=o,r.push(s);for(g=0;g<i;g++)o=q[s=c.call(b,p=b[g],g)],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=U(p),l[g]=n[g]=null),delete q[s];for(g=0;g<h;g++)r[g]in q&&(n[g]=a[g])}else{for(;g<j;g++)o=a[g],p=b[g],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=U(p),l[g]=n[g]=null);for(;g<i;g++)m[g]=U(b[g]),l[g]=n[g]=null;for(;g<k;g++)n[g]=a[g],m[g]=l[g]=null}m.parentNode=l.parentNode=n.parentNode=a.parentNode,d.push(m),e.push(l),f.push(n)}var d=[],e=[],f=[],h=-1,i=a.length,j;if(typeof b=="function")while(++h<i)g(j=a[h],b.call(j,j.parentNode.__data__,h));else while(++h<i)g(j=a[h],b);var k=R(e);k.enter=function(){return S(d)},k.exit=function(){return R(f)};return k},a.each=function(b){for(var c=0,d=a.length;c<d;c++){var e=a[c];for(var f=0,g=e.length;f<g;f++){var h=e[f];h&&b.call(h,h.__data__,f)}}return a},a.empty=function(){return!d(function(){return!0})},a.node=function(){return d(function(){return this})},a.attr=function(b,c){function j(){var a=c.apply(this,arguments);a==null?this.removeAttributeNS(b.space,b.local):this.setAttributeNS(b.space,b.local,a)}function i(){var a=c.apply(this,arguments);a==null?this.removeAttribute(b):this.setAttribute(b,a)}function h(){this.setAttributeNS(b.space,b.local,c)}function g(){this.setAttribute(b,c)}function f(){this.removeAttributeNS(b.space,b.local)}function e(){this.removeAttribute(b)}b=d3.ns.qualify(b);if(arguments.length<2)return d(b.local?function(){return this.getAttributeNS(b.space,b.local)}:function(){return this.getAttribute(b)});return a.each(c==null?b.local?f:e:typeof c=="function"?b.local?j:i:b.local?h:g)},a.classed=function(b,c){function i(){(c.apply(this,arguments)?g:h).call(this)}function h(){var a=f(this.className.replace(e," "));this.className=a.length?a:null}function g(){var a=this.className;e.lastIndex=0,e.test(a)||(this.className=f(a+" "+b))}var e=new RegExp("(^|\\s+)"+d3.requote(b)+"(\\s+|$)","g");if(arguments.length<2)return d(function(){e.lastIndex=0;return e.test(this.className)});return a.each(typeof c=="function"?i:c?g:h)},a.style=function(b,c,e){function h(){var a=c.apply(this,arguments);a==null?this.style.removeProperty(b):this.style.setProperty(b,a,e)}function g(){this.style.setProperty(b,c,e)}function f(){this.style.removeProperty(b)}arguments.length<3&&(e=null);if(arguments.length<2)return d(function(){return window.getComputedStyle(this,null).getPropertyValue(b)});return a.each(c==null?f:typeof c=="function"?h:g)},a.property=function(b,c){function g(){var a=c.apply(this,arguments);a==null?delete this[b]:this[b]=a}function f(){this[b]=c}function e(){delete this[b]}b=d3.ns.qualify(b);if(arguments.length<2)return d(function(){return this[b]});return a.each(c==null?e:typeof c=="function"?g:f)},a.text=function(b){function f(){var a=b.apply(this,arguments);a!=null&&this.appendChild(document.createTextNode(a))}function e(){this.appendChild(document.createTextNode(b))}function c(){while(this.lastChild)this.removeChild(this.lastChild)}if(arguments.length<1)return d(function(){return this.textContent});a.each(c);return b==null?a:a.each(typeof b=="function"?f:e)},a.html=function(b){function e(){this.innerHTML=b.apply(this,arguments)}function c(){this.innerHTML=b}if(arguments.length<1)return d(function(){return this.innerHTML});return a.each(typeof b=="function"?e:c)},a.append=function(a){function d(b){return b.appendChild(document.createElementNS(a.space,a.local))}function c(b){return b.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return b(a.local?d:c)},a.insert=function(a,c){function e(b){return b.insertBefore(document.createElementNS(a.space,a.local),O(c,b))}function d(b){return b.insertBefore(document.createElement(a),O(c,b))}a=d3.ns.qualify(a);return b(a.local?e:d)},a.remove=function(){return a.each(function(){var a=this.parentNode;a&&a.removeChild(this)})},a.sort=function(b){b=T.apply(this,arguments);for(var c=0,d=a.length;c<d;c++){var e=a[c];e.sort(b);for(var f=1,g=e.length,h=e[0];f<g;f++){var i=e[f];i&&(h&&h.parentNode.insertBefore(i,h.nextSibling),h=i)}}return a},a.on=function(b,c){var d=b.indexOf("."),e=d==-1?b:b.substring(0,d),f="__on"+b;return a.each(function(a,b){function d(d){var e=d3.event;d3.event=d;try{c.call(this,a,b)}finally{d3.event=e}}this[f]&&this.removeEventListener(e,this[f],!1),c&&this.addEventListener(e,this[f]=d,!1)})},a.transition=function(){return X(a)},a.call=g;return a}function N(a,b,c){function g(a){return Math.round(f(a)*255)}function f(a){a>360?a-=360:a<0&&(a+=360);if(a<60)return d+(e-d)*a/60;if(a<180)return e;if(a<240)return d+(e-d)*(240-a)/60;return d}var d,e;a=a%360,a<0&&(a+=360),b=b<0?0:b>1?1:b,c=c<0?0:c>1?1:c,e=c<=.5?c*(1+b):c+b-c*b,d=2*c-e;return D(g(a+120),g(a),g(a-120))}function M(){return"hsl("+this.h+","+this.s*100+"%,"+this.l*100+"%)"}function L(a,b,c){return{h:a,s:b,l:c,toString:M}}function I(a){var b=parseFloat(a);return a.charAt(a.length-1)=="%"?Math.round(b*2.55):b}function H(a,b,c){var d=Math.min(a/=255,b/=255,c/=255),e=Math.max(a,b,c),f=e-d,g,h,i=(e+d)/2;f?(h=i<.5?f/(e+d):f/(2-e-d),a==e?g=(b-c)/f+(b<c?6:0):b==e?g=(c-a)/f+2:g=(a-b)/f+4,g*=60):h=g=0;return L(g,h,i)}function G(a,b,c){var d=0,e=0,f=0,g,h,i;g=/([a-z]+)\((.*)\)/i.exec(a);if(g){h=g[2].split(",");switch(g[1]){case"hsl":return c(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case"rgb":return b(I(h[0]),I(h[1]),I(h[2]))}}if(i=J[a])return b(i.r,i.g,i.b);a!=null&&a.charAt(0)=="#"&&(a.length==4?(d=a.charAt(1),d+=d,e=a.charAt(2),e+=e,f=a.charAt(3),f+=f):a.length==7&&(d=a.substring(1,3),e=a.substring(3,5),f=a.substring(5,7)),d=parseInt(d,16),e=parseInt(e,16),f=parseInt(f,16));return b(d,e,f)}function F(a){return a<16?"0"+a.toString(16):a.toString(16)}function E(){return"#"+F(this.r)+F(this.g)+F(this.b)}function D(a,b,c){return{r:a,g:b,b:c,toString:E}}function C(a){return a in B||/\bcolor\b/.test(a)?d3.interpolateRgb:d3.interpolate}function y(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}function x(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}}function w(a,b){var c;arguments.length<2&&(b=.45),arguments.length<1?(a=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/a);return function(d){return 1+a*Math.pow(2,10*-d)*Math.sin((d-c)*2*Math.PI/b)}}function v(a){return 1-Math.sqrt(1-a*a)}function u(a){return a?Math.pow(2,10*(a-1))-.001:0}function t(a){return 1-Math.cos(a*Math.PI/2)}function s(a){return function(b){return Math.pow(b,a)}}function r(a){return a}function q(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function p(a){return function(b){return 1-a(1-b)}}function k(a){var b=a.lastIndexOf("."),c=b>=0?a.substring(b):(b=a.length,""),d=[];while(b>0)d.push(a.substring(b-=3,b+3));return d.reverse().join(",")+c}function i(a){var b={},c=[];b.add=function(a){for(var d=0;d<c.length;d++)if(c[d].listener==a)return b;c.push({listener:a,on:!0});return b},b.remove=function(a){for(var d=0;d<c.length;d++){var e=c[d];if(e.listener==a){e.on=!1,c=c.slice(0,d).concat(c.slice(d+1));break}}return b},b.dispatch=function(){var a=c;for(var b=0,d=a.length;b<d;b++){var e=a[b];e.on&&e.listener.apply(this,arguments)}};return b}function g(a){a.apply(this,(arguments[0]=this,arguments));return this}function f(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function e(a){return a==null}function c(a){return Array.prototype.slice.call(a)}function b(a){var b=-1,c=a.length,d=[];while(++b<c)d.push(a[b]);return d}d3={version:"1.10.1"},Date.now||(Date.now=function(){return+(new Date)}),Object.create||(Object.create=function(a){function b(){}b.prototype=a;return new b});var a=c;try{a(document.documentElement.childNodes)[0].nodeType}catch(d){a=b}d3.functor=function(a){return typeof a=="function"?a:function(){return a}},d3.rebind=function(a,b){return function(){var c=b.apply(a,arguments);return arguments.length?a:c}},d3.ascending=function(a,b){return a<b?-1:a>b?1:0},d3.descending=function(a,b){return b<a?-1:b>a?1:0},d3.min=function(a,b){var c=0,d=a.length,e=a[0],f;if(arguments.length==1)while(++c<d)e>(f=a[c])&&(e=f);else{e=b(a[0]);while(++c<d)e>(f=b(a[c]))&&(e=f)}return e},d3.max=function(a,b){var c=0,d=a.length,e=a[0],f;if(arguments.length==1)while(++c<d)e<(f=a[c])&&(e=f);else{e=b(e);while(++c<d)e<(f=b(a[c]))&&(e=f)}return e},d3.nest=function(){function g(a,d){if(d>=b.length)return a;var e=[],f=c[d++],h;for(h in a)e.push({key:h,values:g(a[h],d)});f&&e.sort(function(a,b){return f(a.key,b.key)});return e}function f(c,g){if(g>=b.length)return e?e.call(a,c):d?c.sort(d):c;var h=-1,i=c.length,j=b[g++],k,l,m={};while(++h<i)(k=j(l=c[h]))in m?m[k].push(l):m[k]=[l];for(k in m)m[k]=f(m[k],g);return m}var a={},b=[],c=[],d,e;a.map=function(a){return f(a,0)},a.entries=function(a){return g(f(a,0),0)},a.key=function(c){b.push(c);return a},a.sortKeys=function(d){c[b.length-1]=d;return a},a.sortValues=function(b){d=b;return a},a.rollup=function(b){e=b;return a};return a},d3.keys=function(a){var b=[];for(var c in a)b.push(c);return b},d3.values=function(a){var b=[];for(var c in a)b.push(a[c]);return b},d3.entries=function(a){var b=[];for(var c in a)b.push({key:c,value:a[c]});return b},d3.merge=function(a){return Array.prototype.concat.apply([],a)},d3.split=function(a,b){var c=[],d=[],f,g=-1,h=a.length;arguments.length<2&&(b=e);while(++g<h)b.call(d,f=a[g],g)?d=[]:(d.length||c.push(d),d.push(f));return c},d3.range=function(a,b,c){arguments.length==1&&(b=a,a=0),c==null&&(c=1);if((b-a)/c==Infinity)throw new Error("infinite range");var d=[],e=-1,f;if(c<0)while((f=a+c*++e)>b)d.push(f);else while((f=a+c*++e)<b)d.push(f);return d},d3.requote=function(a){return a.replace(h,"\\$&")};var h=/[\\\^\$\*\+\?\[\]\(\)\.\{\}]/g;d3.xhr=function(a,b,c){var d=new XMLHttpRequest;arguments.length<3?c=b:b&&d.overrideMimeType&&d.overrideMimeType(b),d.open("GET",a,!0),d.onreadystatechange=function(){d.readyState==4&&c(d.status<300?d:null)},d.send(null)},d3.text=function(a,b,c){function d(a){c(a&&a.responseText)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.json=function(a,b){d3.text(a,"application/json",function(a){b(a?JSON.parse(a):null)})},d3.html=function(a,b){d3.text(a,"text/html",function(a){if(a!=null){var c=document.createRange();c.selectNode(document.body),a=c.createContextualFragment(a)}b(a)})},d3.xml=function(a,b,c){function d(a){c(a&&a.responseXML)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.ns={prefix:{svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},qualify:function(a){var b=a.indexOf(":");return b<0?a:{space:d3.ns.prefix[a.substring(0,b)],local:a.substring(b+1)}}},d3.dispatch=function(a){var b={},c;for(var d=0,e=arguments.length;d<e;d++)c=arguments[d],b[c]=i(c);return b},d3.format=function(a){var b=j.exec(a),c=b[1]||" ",d=b[3]||"",e=b[5],f=+b[6],g=b[7],h=b[8],i=b[9];h&&(h=h.substring(1)),e&&(c="0",g&&(f-=Math.floor((f-1)/4))),i=="d"&&(h="0");return function(a){var b=+a,j=b<0&&(b=-b)?"−":d;if(i=="d"&&b%1)return"";h?a=b.toFixed(h):a=""+b;if(e){var l=a.length+j.length;l<f&&(a=Array(f-l+1).join(c)+a),g&&(a=k(a)),a=j+a}else{g&&(a=k(a)),a=j+a;var l=a.length;l<f&&(a=Array(f-l+1).join(c)+a)}return a}};var j=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,l=s(2),m=s(3),n={linear:function(){return r},poly:s,quad:function(){return l},cubic:function(){return m},sin:function(){return t},exp:function(){return u},circle:function(){return v},elastic:w,back:x,bounce:function(){return y}},o={"in":function(a){return a},out:p,"in-out":q,"out-in":function(a){return q(p(a))}};d3.ease=function(a){var b=a.indexOf("-"),c=b>=0?a.substring(0,b):a,d=b>=0?a.substring(b+1):"in";return o[d](n[c].apply(null,Array.prototype.slice.call(arguments,1)))},d3.event=null,d3.interpolate=function(a,b){if(typeof b=="number")return d3.interpolateNumber(+a,b);if(typeof b=="string")return b in J||/^(#|rgb\(|hsl\()/.test(b)?d3.interpolateRgb(String(a),b):d3.interpolateString(String(a),b);if(b instanceof Array)return d3.interpolateArray(a,b);return d3.interpolateObject(a,b)},d3.interpolateNumber=function(a,b){b-=a;return function(c){return a+b*c}},d3.interpolateRound=function(a,b){b-=a;return function(c){return Math.round(a+b*c)}},d3.interpolateString=function(a,b){var c,d,e,f=0,g=0,h=[],i=[],j,k;for(d=0;c=z.exec(b);++d)c.index&&h.push(b.substring(f,g=c.index)),i.push({i:h.length,x:c[0]}),h.push(null),f=z.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=z.exec(a))&&d<j;++d){k=i[d];if(k.x==c[0]){if(k.i)if(h[k.i+1]==null){h[k.i-1]+=k.x,h.splice(k.i,1);for(e=d+1;e<j;++e)i[e].i--}else{h[k.i-1]+=k.x+h[k.i+1],h.splice(k.i,2);for(e=d+1;e<j;++e)i[e].i-=2}else if(h[k.i+1]==null)h[k.i]=k.x;else{h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1);for(e=d+1;e<j;++e)i[e].i--}i.splice(d,1),j--,d--}else k.x=d3.interpolateNumber(parseFloat(c[0]),parseFloat(k.x))}while(d<j)k=i.pop(),h[k.i+1]==null?h[k.i]=k.x:(h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1)),j--;if(h.length==1)return h[0]==null?i[0].x:function(){return b};return function(a){for(d=0;d<j;++d)h[(k=i[d]).i]=k.x(a);return h.join("")}},d3.interpolateRgb=function(a,b){a=d3.rgb(a),b=d3.rgb(b);var c=a.r,d=a.g,e=a.b,f=b.r-c,g=b.g-d,h=b.b-e;return function(a){return"rgb("+Math.round(c+f*a)+","+Math.round(d+g*a)+","+Math.round(e+h*a)+")"}},d3.interpolateHsl=function(a,b){a=d3.hsl(a),b=d3.hsl(b);var c=a.h,d=a.s,e=a.l,f=b.h-c,g=b.s-d,h=b.l-e;return function(a){return N(c+f*a,d+g*a,e+h*a).toString()}},d3.interpolateArray=function(a,b){var c=[],d=[],e=a.length,f=b.length,g=Math.min(a.length,b.length),h;for(h=0;h<g;++h)c.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)d[h]=a[h];for(;h<f;++h)d[h]=b[h];return function(a){for(h=0;h<g;++h)d[h]=c[h](a);return d}},d3.interpolateObject=function(a,b){var c={},d={},e;for(e in a)e in b?c[e]=C(e)(a[e],b[e]):d[e]=a[e];for(e in b)e in a||(d[e]=b[e]);return function(a){for(e in c)d[e]=c[e](a);return d}};var z=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,A=/[-+]?\d*\.?\d*(?:[eE][-]?\d+)?(.*)/,B={background:1,fill:1,stroke:1};d3.rgb=function(a,b,c){return arguments.length==1?G(""+a,D,N):D(~~a,~~b,~~c)};var J={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};for(var K in J)J[K]=G(J[K],D,N);d3.hsl=function(a,b,c){return arguments.length==1?G(""+a,H,L):L(+a,+b,+c)};var O=function(a,b){return b.querySelector(a)},P=function(b,c){return a(c.querySelectorAll(b))};typeof Sizzle=="function"&&(O=function(a,b){return Sizzle(a,b)[0]},P=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))});var Q=R([[document]]);Q[0].parentNode=document.documentElement,d3.select=function(a){return typeof a=="string"?Q.select(a):R([[a]])},d3.selectAll=function(b){return typeof b=="string"?Q.selectAll(b):R([a(b)])},d3.transition=Q.transition;var V=0,W=0,Z=null,$=0,_;d3.timer=function(a){ba(a,0)};var be=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.scale={},d3.scale.linear=function(){function j(c){var d=Math.min(a,b),e=Math.max(a,b),f=e-d,g=Math.pow(10,Math.floor(Math.log(f/c)/Math.LN10)),h=c/(f/g);h<=.15?g*=10:h<=.35?g*=5:h<=.75&&(g*=2);return{start:Math.ceil(d/g)*g,stop:Math.floor(e/g)*g+g*.5,step:g}}function i(b){return h((b-a)*e)}var a=0,b=1,c=0,d=1,e=1,f=1,g=d3.interpolate,h=g(c,d);i.invert=function(b){return(b-c)*f+a},i.domain=function(g){if(!arguments.length)return[a,b];a=+g[0],b=+g[1],e=1/(b-a),f=(b-a)/(d-c);return i},i.range=function(e){if(!arguments.length)return[c,d];c=e[0],d=e[1],f=(b-a)/(d-c),h=g(c,d);return i},i.rangeRound=function(a){return i.range(a).interpolate(d3.interpolateRound)},i.interpolate=function(a){if(!arguments.length)return g;h=(g=a)(c,d);return i},i.ticks=function(a){var b=j(a);return d3.range(b.start,b.stop,b.step)},i.tickFormat=function(a){var b=Math.max(0,-Math.floor(Math.log(j(a).step)/Math.LN10+.01));return d3.format(",."+b+"f")};return i},d3.scale.log=function(){function d(c){return a(b(c))}var a=d3.scale.linear(),b=bf,c=b.pow;d.invert=function(b){return c(a.invert(b))},d.domain=function(e){if(!arguments.length)return a.domain().map(c);b=(e[0]||e[1])<0?bg:bf,c=b.pow,a.domain(e.map(b));return d},d.range=d3.rebind(d,a.range),d.rangeRound=d3.rebind(d,a.rangeRound),d.interpolate=d3.rebind(d,a.interpolate),d.ticks=function(){var d=a.domain(),e=[];if(d.every(isFinite)){var f=Math.floor(d[0]),g=Math.ceil(d[1]),h=c(d[0]),i=c(d[1]);if(b===bg){e.push(c(f));for(;f++<g;)for(var j=9;j>0;j--)e.push(c(f)*j)}else{for(;f<g;f++)for(var j=1;j<10;j++)e.push(c(f)*j);e.push(c(f))}for(f=0;e[f]<h;f++);for(g=e.length;e[g-1]>i;g--);e=e.slice(f,g)}return e},d.tickFormat=function(){return function(a){return a.toPrecision(1)}};return d},bf.pow=function(a){return Math.pow(10,a)},bg.pow=function(a){return-Math.pow(10,-a)},d3.scale.pow=function(){function f(b){return a(d(b))}var a=d3.scale.linear(),b=d3.scale.linear(),c=1,d=Number,e=d;f.invert=function(b){return e(a.invert(b))},f.domain=function(g){if(!arguments.length)return a.domain().map(e);var h=(g[0]||g[1])<0?bi:bh;d=h(c),e=h(1/c),a.domain(g.map(d)),b.domain(g);return f},f.range=d3.rebind(f,a.range),f.rangeRound=d3.rebind(f,a.rangeRound),f.interpolate=d3.rebind(f,a.interpolate),f.ticks=b.ticks,f.tickFormat=b.tickFormat,f.exponent=function(a){if(!arguments.length)return c;var b=f.domain();c=a;return f.domain(b)};return f},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){function e(d){var e=d in b?b[d]:b[d]=a.push(d)-1;return c[e%c.length]}var a=[],b={},c=[],d=0;e.domain=function(c){if(!arguments.length)return a;a=c,b={};var d=-1,f=-1,g=a.length;while(++d<g)c=a[d],c in b||(b[c]=++f);return e},e.range=function(a){if(!arguments.length)return c;c=a;return e},e.rangePoints=function(b,f){arguments.length<2&&(f=0);var g=b[0],h=b[1],i=(h-g)/(a.length-1+f);c=a.length==1?[(g+h)/2]:d3.range(g+i*f/2,h+i/2,i),d=0;return e},e.rangeBands=function(b,f){arguments.length<2&&(f=0);var g=b[0],h=b[1],i=(h-g)/(a.length+f);c=d3.range(g+i*f,h,i),d=i*(1-f);return e},e.rangeRoundBands=function(b,f){arguments.length<2&&(f=0);var g=b[0],h=b[1],i=h-g,j=Math.floor(i/(a.length+f)),k=i-(a.length-f)*j;c=d3.range(g+Math.round(k/2),h,j),d=Math.round(j*(1-f));return e},e.rangeBand=function(){return d};return e},d3.scale.category10=function(){return d3.scale.ordinal().range(bj)},d3.scale.category20=function(){return d3.scale.ordinal().range(bk)},d3.scale.category20b=function(){return d3.scale.ordinal().range(bl)},d3.scale.category20c=function(){return d3.scale.ordinal().range(bm)};var bj=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],bk=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],bl=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],bm=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){function f(a){return b[e(a)]}function e(a){if(isNaN(a=+a))return NaN;var b=0,d=c.length-1;while(b<=d){var e=b+d>>1,f=c[e];if(f<a)b=e+1;else if(f>a)d=e-1;else return e}return d<0?0:d}function d(){var d=-1,e=c.length=b.length,f=a.length/e;while(++d<e)c[d]=a[~~(d*f)]}var a=[],b=[],c=[];f.domain=function(b){if(!arguments.length)return a;a=b.filter(function(a){return!isNaN(a)}).sort(d3.ascending),d();return f},f.range=function(a){if(!arguments.length)return b;b=a,d();return f},f.quantiles=function(){return c};return f},d3.scale.quantize=function(){function f(b){return e[Math.max(0,Math.min(d,Math.floor(c*(b-a))))]}var a=0,b=1,c=2,d=1,e=[0,1];f.domain=function(d){if(!arguments.length)return[a,b];a=d[0],b=d[1],c=e.length/(b-a);return f},f.range=function(g){if(!arguments.length)return e;e=g,c=e.length/(b-a),d=e.length-1;return f};return f},d3.svg={},d3.svg.arc=function(){function e(){var e=a.apply(this,arguments),f=b.apply(this,arguments),g=c.apply(this,arguments)+bn,h=d.apply(this,arguments)+bn,i=h-g,j=i<Math.PI?"0":"1",k=Math.cos(g),l=Math.sin(g),m=Math.cos(h),n=Math.sin(h);return i>=bo?e?"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"M0,"+e+"A"+e+","+e+" 0 1,1 0,"+ -e+"A"+e+","+e+" 0 1,1 0,"+e+"Z":"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"Z":e?"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L"+e*m+","+e*n+"A"+e+","+e+" 0 "+j+",0 "+e*k+","+e*l+"Z":"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L0,0"+"Z"}var a=bp,b=bq,c=br,d=bs;e.innerRadius=function(b){if(!arguments.length)return a;a=d3.functor(b);return e},e.outerRadius=function(a){if(!arguments.length)return b;b=d3.functor(a);return e},e.startAngle=function(a){if(!arguments.length)return c;c=d3.functor(a);return e},e.endAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return e},e.centroid=function(){var e=(a.apply(this,arguments)+b.apply(this,arguments))/2,f=(c.apply(this,arguments)+d.apply(this,arguments))/2+bn;return[Math.cos(f)*e,Math.sin(f)*e]};return e};var bn=-Math.PI/2,bo=2*Math.PI-1e-6;d3.svg.line=function(){function f(c){return c.length<1?null:"M"+d(bt(this,c,a,b),e)}var a=bu,b=bv,c="linear",d=bw[c],e=.7;f.x=function(b){if(!arguments.length)return a;a=b;return f},f.y=function(a){if(!arguments.length)return b;b=a;return f},f.interpolate=function(a){if(!arguments.length)return c;d=bw[c=a];return f},f.tension=function(a){if(!arguments.length)return e;e=a;return f};return f};var bw={linear:bx,"step-before":by,"step-after":bz,basis:bE,"basis-closed":bF,cardinal:bB,"cardinal-closed":bA},bH=[0,2/3,1/3,0],bI=[0,1/3,2/3,0],bJ=[0,1/6,2/3,1/6];d3.svg.area=function(){function g(d){return d.length<1?null:"M"+e(bt(this,d,a,c), <del>f)+"L"+e(bt(this,d,a,b).reverse(),f)+"Z"}var a=bu,b=bL,c=bv,d="linear",e=bw[d],f=.7;g.x=function(b){if(!arguments.length)return a;a=b;return g},g.y0=function(a){if(!arguments.length)return b;b=a;return g},g.y1=function(a){if(!arguments.length)return c;c=a;return g},g.interpolate=function(a){if(!arguments.length)return d;e=bw[d=a];return g},g.tension=function(a){if(!arguments.length)return f;f=a;return g};return g},d3.svg.chord=function(){function j(a,b,c,d){return"Q 0,0 "+d}function i(a,b){return"A"+a+","+a+" 0 0,1 "+b}function h(a,b){return a.a0==b.a0&&a.a1==b.a1}function g(a,b,f,g){var h=b.call(a,f,g),i=c.call(a,h,g),j=d.call(a,h,g)+bn,k=e.call(a,h,g)+bn;return{r:i,a0:j,a1:k,p0:[i*Math.cos(j),i*Math.sin(j)],p1:[i*Math.cos(k),i*Math.sin(k)]}}function f(c,d){var e=g(this,a,c,d),f=g(this,b,c,d);return"M"+e.p0+i(e.r,e.p1)+(h(e,f)?j(e.r,e.p1,e.r,e.p0):j(e.r,e.p1,f.r,f.p0)+i(f.r,f.p1)+j(f.r,f.p1,e.r,e.p0))+"Z"}var a=bM,b=bN,c=bO,d=br,e=bs;f.radius=function(a){if(!arguments.length)return c;c=d3.functor(a);return f},f.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return f},f.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return f},f.startAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return f},f.endAngle=function(a){if(!arguments.length)return e;e=d3.functor(a);return f};return f},d3.svg.mouse=function(a){var b=(a.ownerSVGElement||a).createSVGPoint();if(bR<0&&(window.scrollX||window.scrollY)){var c=d3.select(document.body).append("svg:svg").style("position","absolute").style("top",0).style("left",0),d=c[0][0].getScreenCTM();bR=!d.f&&!d.e,c.remove()}bR?(b.x=d3.event.pageX,b.y=d3.event.pageY):(b.x=d3.event.clientX,b.y=d3.event.clientY),b=b.matrixTransform(a.getScreenCTM().inverse());return[b.x,b.y]};var bR=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.symbol=function(){function c(c,d){return(bU[a.call(this,c,d)]||bU.circle)(b.call(this,c,d))}var a=bT,b=bS;c.type=function(b){if(!arguments.length)return a;a=d3.functor(b);return c},c.size=function(a){if(!arguments.length)return b;b=d3.functor(a);return c};return c},d3.svg.symbolTypes=["circle","cross","diamond","square","triangle-down","triangle-up"];var bU={circle:function(a){var b=Math.sqrt(a/Math.PI);return"M0,"+b+"A"+b+","+b+" 0 1,1 0,"+ -b+"A"+b+","+b+" 0 1,1 0,"+b+"Z"},cross:function(a){var b=Math.sqrt(a/5)/2;return"M"+ -3*b+","+ -b+"H"+ -b+"V"+ -3*b+"H"+b+"V"+ -b+"H"+3*b+"V"+b+"H"+b+"V"+3*b+"H"+ -b+"V"+b+"H"+ -3*b+"Z"},diamond:function(a){var b=Math.sqrt(a/(2*bW)),c=b*bW;return"M0,"+ -b+"L"+c+",0"+" 0,"+b+" "+ -c+",0"+"Z"},square:function(a){var b=Math.sqrt(a)/2;return"M"+ -b+","+ -b+"L"+b+","+ -b+" "+b+","+b+" "+ -b+","+b+"Z"},"triangle-down":function(a){var b=Math.sqrt(a/bV),c=b*bV/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.sqrt(a/bV),c=b*bV/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}},bV=Math.sqrt(3),bW=Math.tan(30*Math.PI/180)})() <ide>\ No newline at end of file <add>(function(){function bS(){return"circle"}function bR(){return 64}function bP(a){return a.endAngle}function bO(a){return a.startAngle}function bN(a){return a.radius}function bM(a){return a.target}function bL(a){return a.source}function bK(){return 0}function bJ(a,b,c){a.push("C",bF(bG,b),",",bF(bG,c),",",bF(bH,b),",",bF(bH,c),",",bF(bI,b),",",bF(bI,c))}function bF(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function bE(a){var b,c=-1,d=a.length,e=d+4,f,g=[],h=[];while(++c<4)f=a[c%d],g.push(f[0]),h.push(f[1]);b=[bF(bI,g),",",bF(bI,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),bJ(b,g,h);return b.join("")}function bD(a){if(a.length<3)return bw(a);var b=[],c=1,d=a.length,e=a[0],f=e[0],g=e[1],h=[f,f,f,(e=a[1])[0]],i=[g,g,g,e[1]];b.push(f,",",g),bJ(b,h,i);while(++c<d)e=a[c],h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),bJ(b,h,i);c=-1;while(++c<2)h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),bJ(b,h,i);return b.join("")}function bC(a,b){var c=[],d=(1-b)/2,e,f=a[0],g=a[1],h=1,i=a.length;while(++h<i)e=f,f=g,g=a[h],c.push([d*(g[0]-e[0]),d*(g[1]-e[1])]);return c}function bB(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return bw(a);var c=a.length!=b.length,d="",e=a[0],f=a[1],g=b[0],h=g,i=1;c&&(d+="Q"+(f[0]-g[0]*2/3)+","+(f[1]-g[1]*2/3)+","+f[0]+","+f[1],e=a[1],i=2);if(b.length>1){h=b[1],f=a[i],i++,d+="C"+(e[0]+g[0])+","+(e[1]+g[1])+","+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1];for(var j=2;j<b.length;j++,i++)f=a[i],h=b[j],d+="S"+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1]}if(c){var k=a[i];d+="Q"+(f[0]+h[0]*2/3)+","+(f[1]+h[1]*2/3)+","+k[0]+","+k[1]}return d}function bA(a,b,c){return a.length<3?bw(a):a[0]+bB(a,bC(a,b))}function bz(a,b){return a.length<3?bw(a):a[0]+bB((a.push(a[0]),a),bC([a[a.length-2]].concat(a,[a[1]]),b))}function by(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("H",(e=a[c])[0],"V",e[1]);return b.join("")}function bx(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("V",(e=a[c])[1],"H",e[0]);return b.join("")}function bw(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("L",(e=a[c])[0],",",e[1]);return b.join("")}function bu(a){return a[1]}function bt(a){return a[0]}function bs(a,b,c,d){var e=[],f=-1,g=b.length,h=typeof c=="function",i=typeof d=="function",j;if(h&&i)while(++f<g)e.push([c.call(a,j=b[f],f),d.call(a,j,f)]);else if(h)while(++f<g)e.push([c.call(a,b[f],f),d]);else if(i)while(++f<g)e.push([c,d.call(a,b[f],f)]);else while(++f<g)e.push([c,d]);return e}function br(a){return a.endAngle}function bq(a){return a.startAngle}function bp(a){return a.outerRadius}function bo(a){return a.innerRadius}function bh(a){return function(b){return-Math.pow(-b,a)}}function bg(a){return function(b){return Math.pow(b,a)}}function bf(a){return-Math.log(-a)/Math.LN10}function be(a){return Math.log(a)/Math.LN10}function bc(){var a=null,b=Y;while(b)b=b.flush?a?a.next=b.next:Y=b.next:(a=b).next;a||($=0)}function bb(){var a,b=Date.now(),c=null,d=Y;while(d)a=b-d.then,a>d.delay&&(d.flush=d.callback(a)),d=(c=d).next;bc(),$&&bd(bb)}function ba(){$=1,Z=0,bd(bb)}function _(a,b){var c=Date.now(),d=!1,e=c+b,f,g=Y;if(!!isFinite(b)){while(g){if(g.callback==a)g.then=c,g.delay=b,d=!0;else{var h=g.then+g.delay;h<e&&(e=h)}f=g,g=g.next}d||(Y={callback:a,then:c,delay:b,next:Y}),$||(clearTimeout(Z),Z=setTimeout(ba,Math.max(24,e-c)))}}function X(a){return typeof a=="function"?function(b,c,d){return d3.interpolate(d,String(a.call(this,b,c)))}:(a=String(a),function(b,c,d){return d3.interpolate(d,a)})}function W(a){function n(b){var g=!0,l=-1;a.each(function(){if(i[++l]!=2){var a=(b-j[l])/k[l],n=this.__transition__,o,p,q=e[l];if(a<1){g=!1;if(a<0)return}else a=1;if(i[l]){if(!n||n.active!=c){i[l]=2;return}}else{if(!n||n.active>c){i[l]=2;return}i[l]=1,h.start.dispatch.apply(this,arguments),q=e[l]={},n.active=c;for(p in d)q[p]=d[p].apply(this,arguments)}o=m(a);for(p in d)q[p].call(this,o);if(a==1){i[l]=2;if(n.active==c){var r=n.owner;r==c&&(delete this.__transition__,f&&this.parentNode.removeChild(this)),V=c,h.end.dispatch.apply(this,arguments),V=0,n.owner=r}}}});return g}var b={},c=V||++U,d={},e=[],f=!1,h=d3.dispatch("start","end"),i=[],j=[],k=[],l,m=d3.ease("cubic-in-out");a.each(function(){(this.__transition__||(this.__transition__={})).owner=c}),b.delay=function(c){var d=Infinity,e=-1;typeof c=="function"?a.each(function(a,b){var f=j[++e]=+c.apply(this,arguments);f<d&&(d=f)}):(d=+c,a.each(function(a,b){j[++e]=d})),_(n,d);return b},b.duration=function(c){var d=-1;typeof c=="function"?(l=0,a.each(function(a,b){var e=k[++d]=+c.apply(this,arguments);e>l&&(l=e)})):(l=+c,a.each(function(a,b){k[++d]=l}));return b},b.ease=function(a){m=typeof a=="function"?a:d3.ease.apply(d3,arguments);return b},b.attrTween=function(a,c){function f(b,d){var e=c.call(this,b,d,this.getAttributeNS(a.space,a.local));return function(b){this.setAttributeNS(a.space,a.local,e(b))}}function e(b,d){var e=c.call(this,b,d,this.getAttribute(a));return function(b){this.setAttribute(a,e(b))}}d["attr."+a]=a.local?f:e;return b},b.attr=function(a,c){return b.attrTween(a,X(c))},b.styleTween=function(a,c,e){function f(b,d){var f=c.call(this,b,d,window.getComputedStyle(this,null).getPropertyValue(a));return function(b){this.style.setProperty(a,f(b),e)}}arguments.length<3&&(e=null),d["style."+a]=f;return b},b.style=function(a,c,d){arguments.length<3&&(d=null);return b.styleTween(a,X(c),d)},b.select=function(b){var c,d=W(a.select(b)).ease(m);c=-1,d.delay(function(a,b){return j[++c]}),c=-1,d.duration(function(a,b){return k[++c]});return d},b.selectAll=function(b){var c,d=W(a.selectAll(b)).ease(m);c=-1,d.delay(function(a,b){return j[b?c:++c]}),c=-1,d.duration(function(a,b){return k[b?c:++c]});return d},b.remove=function(){f=!0;return b},b.each=function(a,c){h[a].add(c);return b},b.call=g;return b.delay(0).duration(250)}function T(a){return{__data__:a}}function S(a){arguments.length||(a=d3.ascending);return function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function R(a){function b(b){var c=[],d,e,f,g;for(var h=0,i=a.length;h<i;h++){f=a[h],c.push(d=[]),d.parentNode=f.parentNode;for(var j=0,k=f.length;j<k;j++)(g=f[j])?(d.push(e=b(f.parentNode)),e.__data__=g.__data__):d.push(null)}return Q(c)}a.append=function(a){function d(b){return b.appendChild(document.createElementNS(a.space,a.local))}function c(b){return b.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return b(a.local?d:c)},a.insert=function(a,c){function e(b){return b.insertBefore(document.createElementNS(a.space,a.local),N(c,b))}function d(b){return b.insertBefore(document.createElement(a),N(c,b))}a=d3.ns.qualify(a);return b(a.local?e:d)};return a}function Q(a){function d(b){for(var c=0,d=a.length;c<d;c++){var e=a[c];for(var f=0,g=e.length;f<g;f++){var h=e[f];if(h)return b.call(h,h.__data__,f)}}return null}function c(b){var c=[],d,e,f;for(var g=0,h=a.length;g<h;g++){e=a[g];for(var i=0,j=e.length;i<j;i++)if(f=e[i])c.push(d=b(f)),d.parentNode=f}return Q(c)}function b(b){var c=[],d,e,f,g;for(var h=0,i=a.length;h<i;h++){f=a[h],c.push(d=[]),d.parentNode=f.parentNode;for(var j=0,k=f.length;j<k;j++)(g=f[j])?(d.push(e=b(g)),e&&"__data__"in g&&(e.__data__=g.__data__)):d.push(null)}return Q(c)}a.select=function(a){return b(function(b){return N(a,b)})},a.selectAll=function(a){return c(function(b){return O(a,b)})},a.filter=function(b){var c=[],d,e,f;for(var g=0,h=a.length;g<h;g++){e=a[g],c.push(d=[]),d.parentNode=e.parentNode;for(var i=0,j=e.length;i<j;i++)(f=e[i])&&b.call(f,f.__data__,i)&&d.push(f)}return Q(c)},a.map=function(b){var c,d;for(var e=0,f=a.length;e<f;e++){c=a[e];for(var g=0,h=c.length;g<h;g++)if(d=c[g])d.__data__=b.call(d,d.__data__,g)}return a},a.data=function(b,c){function g(a,b){var g=0,h=a.length,i=b.length,j=Math.min(h,i),k=Math.max(h,i),l=[],m=[],n=[],o,p;if(c){var q={},r=[],s,t=b.length;for(g=0;g<h;g++)s=c.call(o=a[g],o.__data__,g),s in q?n[t++]=a[g]:q[s]=o,r.push(s);for(g=0;g<i;g++)o=q[s=c.call(b,p=b[g],g)],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=T(p),l[g]=n[g]=null),delete q[s];for(g=0;g<h;g++)r[g]in q&&(n[g]=a[g])}else{for(;g<j;g++)o=a[g],p=b[g],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=T(p),l[g]=n[g]=null);for(;g<i;g++)m[g]=T(b[g]),l[g]=n[g]=null;for(;g<k;g++)n[g]=a[g],m[g]=l[g]=null}m.parentNode=l.parentNode=n.parentNode=a.parentNode,d.push(m),e.push(l),f.push(n)}var d=[],e=[],f=[],h=-1,i=a.length,j;if(typeof b=="function")while(++h<i)g(j=a[h],b.call(j,j.parentNode.__data__,h));else while(++h<i)g(j=a[h],b);var k=Q(e);k.enter=function(){return R(d)},k.exit=function(){return Q(f)};return k},a.each=function(b){for(var c=0,d=a.length;c<d;c++){var e=a[c];for(var f=0,g=e.length;f<g;f++){var h=e[f];h&&b.call(h,h.__data__,f)}}return a},a.empty=function(){return!d(function(){return!0})},a.node=function(){return d(function(){return this})},a.attr=function(b,c){function j(){var a=c.apply(this,arguments);a==null?this.removeAttributeNS(b.space,b.local):this.setAttributeNS(b.space,b.local,a)}function i(){var a=c.apply(this,arguments);a==null?this.removeAttribute(b):this.setAttribute(b,a)}function h(){this.setAttributeNS(b.space,b.local,c)}function g(){this.setAttribute(b,c)}function f(){this.removeAttributeNS(b.space,b.local)}function e(){this.removeAttribute(b)}b=d3.ns.qualify(b);if(arguments.length<2)return d(b.local?function(){return this.getAttributeNS(b.space,b.local)}:function(){return this.getAttribute(b)});return a.each(c==null?b.local?f:e:typeof c=="function"?b.local?j:i:b.local?h:g)},a.classed=function(b,c){function i(){(c.apply(this,arguments)?g:h).call(this)}function h(){var a=f(this.className.replace(e," "));this.className=a.length?a:null}function g(){var a=this.className;e.lastIndex=0,e.test(a)||(this.className=f(a+" "+b))}var e=new RegExp("(^|\\s+)"+d3.requote(b)+"(\\s+|$)","g");if(arguments.length<2)return d(function(){e.lastIndex=0;return e.test(this.className)});return a.each(typeof c=="function"?i:c?g:h)},a.style=function(b,c,e){function h(){var a=c.apply(this,arguments);a==null?this.style.removeProperty(b):this.style.setProperty(b,a,e)}function g(){this.style.setProperty(b,c,e)}function f(){this.style.removeProperty(b)}arguments.length<3&&(e=null);if(arguments.length<2)return d(function(){return window.getComputedStyle(this,null).getPropertyValue(b)});return a.each(c==null?f:typeof c=="function"?h:g)},a.property=function(b,c){function g(){var a=c.apply(this,arguments);a==null?delete this[b]:this[b]=a}function f(){this[b]=c}function e(){delete this[b]}b=d3.ns.qualify(b);if(arguments.length<2)return d(function(){return this[b]});return a.each(c==null?e:typeof c=="function"?g:f)},a.text=function(b){function f(){var a=b.apply(this,arguments);a!=null&&this.appendChild(document.createTextNode(a))}function e(){this.appendChild(document.createTextNode(b))}function c(){while(this.lastChild)this.removeChild(this.lastChild)}if(arguments.length<1)return d(function(){return this.textContent});a.each(c);return b==null?a:a.each(typeof b=="function"?f:e)},a.html=function(b){function e(){this.innerHTML=b.apply(this,arguments)}function c(){this.innerHTML=b}if(arguments.length<1)return d(function(){return this.innerHTML});return a.each(typeof b=="function"?e:c)},a.append=function(a){function d(b){return b.appendChild(document.createElementNS(a.space,a.local))}function c(b){return b.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return b(a.local?d:c)},a.insert=function(a,c){function e(b){return b.insertBefore(document.createElementNS(a.space,a.local),N(c,b))}function d(b){return b.insertBefore(document.createElement(a),N(c,b))}a=d3.ns.qualify(a);return b(a.local?e:d)},a.remove=function(){return a.each(function(){var a=this.parentNode;a&&a.removeChild(this)})},a.sort=function(b){b=S.apply(this,arguments);for(var c=0,d=a.length;c<d;c++){var e=a[c];e.sort(b);for(var f=1,g=e.length,h=e[0];f<g;f++){var i=e[f];i&&(h&&h.parentNode.insertBefore(i,h.nextSibling),h=i)}}return a},a.on=function(b,c){var d=b.indexOf("."),e=d==-1?b:b.substring(0,d),f="__on"+b;return a.each(function(a,b){function d(d){var e=d3.event;d3.event=d;try{c.call(this,a,b)}finally{d3.event=e}}this[f]&&this.removeEventListener(e,this[f],!1),c&&this.addEventListener(e,this[f]=d,!1)})},a.transition=function(){return W(a)},a.call=g;return a}function M(a,b,c){function g(a){return Math.round(f(a)*255)}function f(a){a>360?a-=360:a<0&&(a+=360);if(a<60)return d+(e-d)*a/60;if(a<180)return e;if(a<240)return d+(e-d)*(240-a)/60;return d}var d,e;a=a%360,a<0&&(a+=360),b=b<0?0:b>1?1:b,c=c<0?0:c>1?1:c,e=c<=.5?c*(1+b):c+b-c*b,d=2*c-e;return C(g(a+120),g(a),g(a-120))}function L(){return"hsl("+this.h+","+this.s*100+"%,"+this.l*100+"%)"}function K(a,b,c){return{h:a,s:b,l:c,toString:L}}function H(a){var b=parseFloat(a);return a.charAt(a.length-1)=="%"?Math.round(b*2.55):b}function G(a,b,c){var d=Math.min(a/=255,b/=255,c/=255),e=Math.max(a,b,c),f=e-d,g,h,i=(e+d)/2;f?(h=i<.5?f/(e+d):f/(2-e-d),a==e?g=(b-c)/f+(b<c?6:0):b==e?g=(c-a)/f+2:g=(a-b)/f+4,g*=60):h=g=0;return K(g,h,i)}function F(a,b,c){var d=0,e=0,f=0,g,h,i;g=/([a-z]+)\((.*)\)/i.exec(a);if(g){h=g[2].split(",");switch(g[1]){case"hsl":return c(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case"rgb":return b(H(h[0]),H(h[1]),H(h[2]))}}if(i=I[a])return b(i.r,i.g,i.b);a!=null&&a.charAt(0)=="#"&&(a.length==4?(d=a.charAt(1),d+=d,e=a.charAt(2),e+=e,f=a.charAt(3),f+=f):a.length==7&&(d=a.substring(1,3),e=a.substring(3,5),f=a.substring(5,7)),d=parseInt(d,16),e=parseInt(e,16),f=parseInt(f,16));return b(d,e,f)}function E(a){return a<16?"0"+a.toString(16):a.toString(16)}function D(){return"#"+E(this.r)+E(this.g)+E(this.b)}function C(a,b,c){return{r:a,g:b,b:c,toString:D}}function B(a){return a in A||/\bcolor\b/.test(a)?d3.interpolateRgb:d3.interpolate}function y(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}function x(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}}function w(a,b){var c;arguments.length<2&&(b=.45),arguments.length<1?(a=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/a);return function(d){return 1+a*Math.pow(2,10*-d)*Math.sin((d-c)*2*Math.PI/b)}}function v(a){return 1-Math.sqrt(1-a*a)}function u(a){return a?Math.pow(2,10*(a-1))-.001:0}function t(a){return 1-Math.cos(a*Math.PI/2)}function s(a){return function(b){return Math.pow(b,a)}}function r(a){return a}function q(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function p(a){return function(b){return 1-a(1-b)}}function k(a){var b=a.lastIndexOf("."),c=b>=0?a.substring(b):(b=a.length,""),d=[];while(b>0)d.push(a.substring(b-=3,b+3));return d.reverse().join(",")+c}function i(a){var b={},c=[];b.add=function(a){for(var d=0;d<c.length;d++)if(c[d].listener==a)return b;c.push({listener:a,on:!0});return b},b.remove=function(a){for(var d=0;d<c.length;d++){var e=c[d];if(e.listener==a){e.on=!1,c=c.slice(0,d).concat(c.slice(d+1));break}}return b},b.dispatch=function(){var a=c;for(var b=0,d=a.length;b<d;b++){var e=a[b];e.on&&e.listener.apply(this,arguments)}};return b}function g(a){a.apply(this,(arguments[0]=this,arguments));return this}function f(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function e(a){return a==null}function c(a){return Array.prototype.slice.call(a)}function b(a){var b=-1,c=a.length,d=[];while(++b<c)d.push(a[b]);return d}d3={version:"1.10.1"},Date.now||(Date.now=function(){return+(new Date)}),Object.create||(Object.create=function(a){function b(){}b.prototype=a;return new b});var a=c;try{a(document.documentElement.childNodes)[0].nodeType}catch(d){a=b}d3.functor=function(a){return typeof a=="function"?a:function(){return a}},d3.rebind=function(a,b){return function(){var c=b.apply(a,arguments);return arguments.length?a:c}},d3.ascending=function(a,b){return a<b?-1:a>b?1:0},d3.descending=function(a,b){return b<a?-1:b>a?1:0},d3.min=function(a,b){var c=0,d=a.length,e=a[0],f;if(arguments.length==1)while(++c<d)e>(f=a[c])&&(e=f);else{e=b(a[0]);while(++c<d)e>(f=b(a[c]))&&(e=f)}return e},d3.max=function(a,b){var c=0,d=a.length,e=a[0],f;if(arguments.length==1)while(++c<d)e<(f=a[c])&&(e=f);else{e=b(e);while(++c<d)e<(f=b(a[c]))&&(e=f)}return e},d3.nest=function(){function g(a,d){if(d>=b.length)return a;var e=[],f=c[d++],h;for(h in a)e.push({key:h,values:g(a[h],d)});f&&e.sort(function(a,b){return f(a.key,b.key)});return e}function f(c,g){if(g>=b.length)return e?e.call(a,c):d?c.sort(d):c;var h=-1,i=c.length,j=b[g++],k,l,m={};while(++h<i)(k=j(l=c[h]))in m?m[k].push(l):m[k]=[l];for(k in m)m[k]=f(m[k],g);return m}var a={},b=[],c=[],d,e;a.map=function(a){return f(a,0)},a.entries=function(a){return g(f(a,0),0)},a.key=function(c){b.push(c);return a},a.sortKeys=function(d){c[b.length-1]=d;return a},a.sortValues=function(b){d=b;return a},a.rollup=function(b){e=b;return a};return a},d3.keys=function(a){var b=[];for(var c in a)b.push(c);return b},d3.values=function(a){var b=[];for(var c in a)b.push(a[c]);return b},d3.entries=function(a){var b=[];for(var c in a)b.push({key:c,value:a[c]});return b},d3.merge=function(a){return Array.prototype.concat.apply([],a)},d3.split=function(a,b){var c=[],d=[],f,g=-1,h=a.length;arguments.length<2&&(b=e);while(++g<h)b.call(d,f=a[g],g)?d=[]:(d.length||c.push(d),d.push(f));return c},d3.range=function(a,b,c){arguments.length==1&&(b=a,a=0),c==null&&(c=1);if((b-a)/c==Infinity)throw new Error("infinite range");var d=[],e=-1,f;if(c<0)while((f=a+c*++e)>b)d.push(f);else while((f=a+c*++e)<b)d.push(f);return d},d3.requote=function(a){return a.replace(h,"\\$&")};var h=/[\\\^\$\*\+\?\[\]\(\)\.\{\}]/g;d3.xhr=function(a,b,c){var d=new XMLHttpRequest;arguments.length<3?c=b:b&&d.overrideMimeType&&d.overrideMimeType(b),d.open("GET",a,!0),d.onreadystatechange=function(){d.readyState==4&&c(d.status<300?d:null)},d.send(null)},d3.text=function(a,b,c){function d(a){c(a&&a.responseText)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.json=function(a,b){d3.text(a,"application/json",function(a){b(a?JSON.parse(a):null)})},d3.html=function(a,b){d3.text(a,"text/html",function(a){if(a!=null){var c=document.createRange();c.selectNode(document.body),a=c.createContextualFragment(a)}b(a)})},d3.xml=function(a,b,c){function d(a){c(a&&a.responseXML)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.ns={prefix:{svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},qualify:function(a){var b=a.indexOf(":");return b<0?a:{space:d3.ns.prefix[a.substring(0,b)],local:a.substring(b+1)}}},d3.dispatch=function(a){var b={},c;for(var d=0,e=arguments.length;d<e;d++)c=arguments[d],b[c]=i(c);return b},d3.format=function(a){var b=j.exec(a),c=b[1]||" ",d=b[3]||"",e=b[5],f=+b[6],g=b[7],h=b[8],i=b[9];h&&(h=h.substring(1)),e&&(c="0",g&&(f-=Math.floor((f-1)/4))),i=="d"&&(h="0");return function(a){var b=+a,j=b<0&&(b=-b)?"−":d;if(i=="d"&&b%1)return"";h?a=b.toFixed(h):a=""+b;if(e){var l=a.length+j.length;l<f&&(a=Array(f-l+1).join(c)+a),g&&(a=k(a)),a=j+a}else{g&&(a=k(a)),a=j+a;var l=a.length;l<f&&(a=Array(f-l+1).join(c)+a)}return a}};var j=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,l=s(2),m=s(3),n={linear:function(){return r},poly:s,quad:function(){return l},cubic:function(){return m},sin:function(){return t},exp:function(){return u},circle:function(){return v},elastic:w,back:x,bounce:function(){return y}},o={"in":function(a){return a},out:p,"in-out":q,"out-in":function(a){return q(p(a))}};d3.ease=function(a){var b=a.indexOf("-"),c=b>=0?a.substring(0,b):a,d=b>=0?a.substring(b+1):"in";return o[d](n[c].apply(null,Array.prototype.slice.call(arguments,1)))},d3.event=null,d3.interpolate=function(a,b){if(typeof b=="number")return d3.interpolateNumber(+a,b);if(typeof b=="string")return b in I||/^(#|rgb\(|hsl\()/.test(b)?d3.interpolateRgb(String(a),b):d3.interpolateString(String(a),b);if(b instanceof Array)return d3.interpolateArray(a,b);return d3.interpolateObject(a,b)},d3.interpolateNumber=function(a,b){b-=a;return function(c){return a+b*c}},d3.interpolateRound=function(a,b){b-=a;return function(c){return Math.round(a+b*c)}},d3.interpolateString=function(a,b){var c,d,e,f=0,g=0,h=[],i=[],j,k;z.lastIndex=0;for(d=0;c=z.exec(b);++d)c.index&&h.push(b.substring(f,g=c.index)),i.push({i:h.length,x:c[0]}),h.push(null),f=z.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=z.exec(a))&&d<j;++d){k=i[d];if(k.x==c[0]){if(k.i)if(h[k.i+1]==null){h[k.i-1]+=k.x,h.splice(k.i,1);for(e=d+1;e<j;++e)i[e].i--}else{h[k.i-1]+=k.x+h[k.i+1],h.splice(k.i,2);for(e=d+1;e<j;++e)i[e].i-=2}else if(h[k.i+1]==null)h[k.i]=k.x;else{h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1);for(e=d+1;e<j;++e)i[e].i--}i.splice(d,1),j--,d--}else k.x=d3.interpolateNumber(parseFloat(c[0]),parseFloat(k.x))}while(d<j)k=i.pop(),h[k.i+1]==null?h[k.i]=k.x:(h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1)),j--;if(h.length==1)return h[0]==null?i[0].x:function(){return b};return function(a){for(d=0;d<j;++d)h[(k=i[d]).i]=k.x(a);return h.join("")}},d3.interpolateRgb=function(a,b){a=d3.rgb(a),b=d3.rgb(b);var c=a.r,d=a.g,e=a.b,f=b.r-c,g=b.g-d,h=b.b-e;return function(a){return"rgb("+Math.round(c+f*a)+","+Math.round(d+g*a)+","+Math.round(e+h*a)+")"}},d3.interpolateHsl=function(a,b){a=d3.hsl(a),b=d3.hsl(b);var c=a.h,d=a.s,e=a.l,f=b.h-c,g=b.s-d,h=b.l-e;return function(a){return M(c+f*a,d+g*a,e+h*a).toString()}},d3.interpolateArray=function(a,b){var c=[],d=[],e=a.length,f=b.length,g=Math.min(a.length,b.length),h;for(h=0;h<g;++h)c.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)d[h]=a[h];for(;h<f;++h)d[h]=b[h];return function(a){for(h=0;h<g;++h)d[h]=c[h](a);return d}},d3.interpolateObject=function(a,b){var c={},d={},e;for(e in a)e in b?c[e]=B(e)(a[e],b[e]):d[e]=a[e];for(e in b)e in a||(d[e]=b[e]);return function(a){for(e in c)d[e]=c[e](a);return d}};var z=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,A={background:1,fill:1,stroke:1};d3.rgb=function(a,b,c){return arguments.length==1?F(""+a,C,M):C(~~a,~~b,~~c)};var I={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};for(var J in I)I[J]=F(I[J],C,M);d3.hsl=function(a,b,c){return arguments.length==1?F(""+a,G,K):K(+a,+b,+c)};var N=function(a,b){return b.querySelector(a)},O=function(b,c){return a(c.querySelectorAll(b))};typeof Sizzle=="function"&&(N=function(a,b){return Sizzle(a,b)[0]},O=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))});var P=Q([[document]]);P[0].parentNode=document.documentElement,d3.select=function(a){return typeof a=="string"?P.select(a):Q([[a]])},d3.selectAll=function(b){return typeof b=="string"?P.selectAll(b):Q([a(b)])},d3.transition=P.transition;var U=0,V=0,Y=null,Z=0,$;d3.timer=function(a){_(a,0)};var bd=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.scale={},d3.scale.linear=function(){function j(c){var d=Math.min(a,b),e=Math.max(a,b),f=e-d,g=Math.pow(10,Math.floor(Math.log(f/c)/Math.LN10)),h=c/(f/g);h<=.15?g*=10:h<=.35?g*=5:h<=.75&&(g*=2);return{start:Math.ceil(d/g)*g,stop:Math.floor(e/g)*g+g*.5,step:g}}function i(b){return h((b-a)*e)}var a=0,b=1,c=0,d=1,e=1,f=1,g=d3.interpolate,h=g(c,d);i.invert=function(b){return(b-c)*f+a},i.domain=function(g){if(!arguments.length)return[a,b];a=+g[0],b=+g[1],e=1/(b-a),f=(b-a)/(d-c);return i},i.range=function(e){if(!arguments.length)return[c,d];c=e[0],d=e[1],f=(b-a)/(d-c),h=g(c,d);return i},i.rangeRound=function(a){return i.range(a).interpolate(d3.interpolateRound)},i.interpolate=function(a){if(!arguments.length)return g;h=(g=a)(c,d);return i},i.ticks=function(a){var b=j(a);return d3.range(b.start,b.stop,b.step)},i.tickFormat=function(a){var b=Math.max(0,-Math.floor(Math.log(j(a).step)/Math.LN10+.01));return d3.format(",."+b+"f")};return i},d3.scale.log=function(){function d(c){return a(b(c))}var a=d3.scale.linear(),b=be,c=b.pow;d.invert=function(b){return c(a.invert(b))},d.domain=function(e){if(!arguments.length)return a.domain().map(c);b=(e[0]||e[1])<0?bf:be,c=b.pow,a.domain(e.map(b));return d},d.range=d3.rebind(d,a.range),d.rangeRound=d3.rebind(d,a.rangeRound),d.interpolate=d3.rebind(d,a.interpolate),d.ticks=function(){var d=a.domain(),e=[];if(d.every(isFinite)){var f=Math.floor(d[0]),g=Math.ceil(d[1]),h=c(d[0]),i=c(d[1]);if(b===bf){e.push(c(f));for(;f++<g;)for(var j=9;j>0;j--)e.push(c(f)*j)}else{for(;f<g;f++)for(var j=1;j<10;j++)e.push(c(f)*j);e.push(c(f))}for(f=0;e[f]<h;f++);for(g=e.length;e[g-1]>i;g--);e=e.slice(f,g)}return e},d.tickFormat=function(){return function(a){return a.toPrecision(1)}};return d},be.pow=function(a){return Math.pow(10,a)},bf.pow=function(a){return-Math.pow(10,-a)},d3.scale.pow=function(){function f(b){return a(d(b))}var a=d3.scale.linear(),b=d3.scale.linear(),c=1,d=Number,e=d;f.invert=function(b){return e(a.invert(b))},f.domain=function(g){if(!arguments.length)return a.domain().map(e);var h=(g[0]||g[1])<0?bh:bg;d=h(c),e=h(1/c),a.domain(g.map(d)),b.domain(g);return f},f.range=d3.rebind(f,a.range),f.rangeRound=d3.rebind(f,a.rangeRound),f.interpolate=d3.rebind(f,a.interpolate),f.ticks=b.ticks,f.tickFormat=b.tickFormat,f.exponent=function(a){if(!arguments.length)return c;var b=f.domain();c=a;return f.domain(b)};return f},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){function e(d){var e=d in b?b[d]:b[d]=a.push(d)-1;return c[e%c.length]}var a=[],b={},c=[],d=0;e.domain=function(c){if(!arguments.length)return a;a=c,b={};var d=-1,f=-1,g=a.length;while(++d<g)c=a[d],c in b||(b[c]=++f);return e},e.range=function(a){if(!arguments.length)return c;c=a;return e},e.rangePoints=function(b,f){arguments.length<2&&(f=0);var g=b[0],h=b[1],i=(h-g)/(a.length-1+f);c=a.length==1?[(g+h)/2]:d3.range(g+i*f/2,h+i/2,i),d=0;return e},e.rangeBands=function(b,f){arguments.length<2&&(f=0);var g=b[0],h=b[1],i=(h-g)/(a.length+f);c=d3.range(g+i*f,h,i),d=i*(1-f);return e},e.rangeRoundBands=function(b,f){arguments.length<2&&(f=0);var g=b[0],h=b[1],i=h-g,j=Math.floor(i/(a.length+f)),k=i-(a.length-f)*j;c=d3.range(g+Math.round(k/2),h,j),d=Math.round(j*(1-f));return e},e.rangeBand=function(){return d};return e},d3.scale.category10=function(){return d3.scale.ordinal().range(bi)},d3.scale.category20=function(){return d3.scale.ordinal().range(bj)},d3.scale.category20b=function(){return d3.scale.ordinal().range(bk)},d3.scale.category20c=function(){return d3.scale.ordinal().range(bl)};var bi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],bj=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],bk=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],bl=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){function f(a){return b[e(a)]}function e(a){if(isNaN(a=+a))return NaN;var b=0,d=c.length-1;while(b<=d){var e=b+d>>1,f=c[e];if(f<a)b=e+1;else if(f>a)d=e-1;else return e}return d<0?0:d}function d(){var d=-1,e=c.length=b.length,f=a.length/e;while(++d<e)c[d]=a[~~(d*f)]}var a=[],b=[],c=[];f.domain=function(b){if(!arguments.length)return a;a=b.filter(function(a){return!isNaN(a)}).sort(d3.ascending),d();return f},f.range=function(a){if(!arguments.length)return b;b=a,d();return f},f.quantiles=function(){return c};return f},d3.scale.quantize=function(){function f(b){return e[Math.max(0,Math.min(d,Math.floor(c*(b-a))))]}var a=0,b=1,c=2,d=1,e=[0,1];f.domain=function(d){if(!arguments.length)return[a,b];a=d[0],b=d[1],c=e.length/(b-a);return f},f.range=function(g){if(!arguments.length)return e;e=g,c=e.length/(b-a),d=e.length-1;return f};return f},d3.svg={},d3.svg.arc=function(){function e(){var e=a.apply(this,arguments),f=b.apply(this,arguments),g=c.apply(this,arguments)+bm,h=d.apply(this,arguments)+bm,i=h-g,j=i<Math.PI?"0":"1",k=Math.cos(g),l=Math.sin(g),m=Math.cos(h),n=Math.sin(h);return i>=bn?e?"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"M0,"+e+"A"+e+","+e+" 0 1,1 0,"+ -e+"A"+e+","+e+" 0 1,1 0,"+e+"Z":"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"Z":e?"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L"+e*m+","+e*n+"A"+e+","+e+" 0 "+j+",0 "+e*k+","+e*l+"Z":"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L0,0"+"Z"}var a=bo,b=bp,c=bq,d=br;e.innerRadius=function(b){if(!arguments.length)return a;a=d3.functor(b);return e},e.outerRadius=function(a){if(!arguments.length)return b;b=d3.functor(a);return e},e.startAngle=function(a){if(!arguments.length)return c;c=d3.functor(a);return e},e.endAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return e},e.centroid=function(){var e=(a.apply(this,arguments)+b.apply(this,arguments))/2,f=(c.apply(this,arguments)+d.apply(this,arguments))/2+bm;return[Math.cos(f)*e,Math.sin(f)*e]};return e};var bm=-Math.PI/2,bn=2*Math.PI-1e-6;d3.svg.line=function(){function f(c){return c.length<1?null:"M"+d(bs(this,c,a,b),e)}var a=bt,b=bu,c="linear",d=bv[c],e=.7;f.x=function(b){if(!arguments.length)return a;a=b;return f},f.y=function(a){if(!arguments.length)return b;b=a;return f},f.interpolate=function(a){if(!arguments.length)return c;d=bv[c=a];return f},f.tension=function(a){if(!arguments.length)return e;e=a;return f};return f};var bv={linear:bw,"step-before":bx,"step-after":by,basis:bD,"basis-closed":bE,cardinal:bA,"cardinal-closed":bz},bG=[0,2/3,1/3,0],bH=[0,1/3,2/3,0],bI=[0,1/6,2/3,1/6];d3.svg.area=function(){function g(d){return d.length<1?null:"M"+e(bs(this,d,a,c),f)+"L"+e(bs(this,d,a,b).reverse <add>(),f)+"Z"}var a=bt,b=bK,c=bu,d="linear",e=bv[d],f=.7;g.x=function(b){if(!arguments.length)return a;a=b;return g},g.y0=function(a){if(!arguments.length)return b;b=a;return g},g.y1=function(a){if(!arguments.length)return c;c=a;return g},g.interpolate=function(a){if(!arguments.length)return d;e=bv[d=a];return g},g.tension=function(a){if(!arguments.length)return f;f=a;return g};return g},d3.svg.chord=function(){function j(a,b,c,d){return"Q 0,0 "+d}function i(a,b){return"A"+a+","+a+" 0 0,1 "+b}function h(a,b){return a.a0==b.a0&&a.a1==b.a1}function g(a,b,f,g){var h=b.call(a,f,g),i=c.call(a,h,g),j=d.call(a,h,g)+bm,k=e.call(a,h,g)+bm;return{r:i,a0:j,a1:k,p0:[i*Math.cos(j),i*Math.sin(j)],p1:[i*Math.cos(k),i*Math.sin(k)]}}function f(c,d){var e=g(this,a,c,d),f=g(this,b,c,d);return"M"+e.p0+i(e.r,e.p1)+(h(e,f)?j(e.r,e.p1,e.r,e.p0):j(e.r,e.p1,f.r,f.p0)+i(f.r,f.p1)+j(f.r,f.p1,e.r,e.p0))+"Z"}var a=bL,b=bM,c=bN,d=bq,e=br;f.radius=function(a){if(!arguments.length)return c;c=d3.functor(a);return f},f.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return f},f.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return f},f.startAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return f},f.endAngle=function(a){if(!arguments.length)return e;e=d3.functor(a);return f};return f},d3.svg.mouse=function(a){var b=(a.ownerSVGElement||a).createSVGPoint();if(bQ<0&&(window.scrollX||window.scrollY)){var c=d3.select(document.body).append("svg:svg").style("position","absolute").style("top",0).style("left",0),d=c[0][0].getScreenCTM();bQ=!d.f&&!d.e,c.remove()}bQ?(b.x=d3.event.pageX,b.y=d3.event.pageY):(b.x=d3.event.clientX,b.y=d3.event.clientY),b=b.matrixTransform(a.getScreenCTM().inverse());return[b.x,b.y]};var bQ=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.symbol=function(){function c(c,d){return(bT[a.call(this,c,d)]||bT.circle)(b.call(this,c,d))}var a=bS,b=bR;c.type=function(b){if(!arguments.length)return a;a=d3.functor(b);return c},c.size=function(a){if(!arguments.length)return b;b=d3.functor(a);return c};return c},d3.svg.symbolTypes=["circle","cross","diamond","square","triangle-down","triangle-up"];var bT={circle:function(a){var b=Math.sqrt(a/Math.PI);return"M0,"+b+"A"+b+","+b+" 0 1,1 0,"+ -b+"A"+b+","+b+" 0 1,1 0,"+b+"Z"},cross:function(a){var b=Math.sqrt(a/5)/2;return"M"+ -3*b+","+ -b+"H"+ -b+"V"+ -3*b+"H"+b+"V"+ -b+"H"+3*b+"V"+b+"H"+b+"V"+3*b+"H"+ -b+"V"+b+"H"+ -3*b+"Z"},diamond:function(a){var b=Math.sqrt(a/(2*bV)),c=b*bV;return"M0,"+ -b+"L"+c+",0"+" 0,"+b+" "+ -c+",0"+"Z"},square:function(a){var b=Math.sqrt(a)/2;return"M"+ -b+","+ -b+"L"+b+","+ -b+" "+b+","+b+" "+ -b+","+b+"Z"},"triangle-down":function(a){var b=Math.sqrt(a/bU),c=b*bU/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.sqrt(a/bU),c=b*bU/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}},bU=Math.sqrt(3),bV=Math.tan(30*Math.PI/180)})() <ide>\ No newline at end of file <ide><path>src/core/interpolate.js <ide> d3.interpolateString = function(a, b) { <ide> n, // q.length <ide> o; <ide> <add> // Reset our regular expression! <add> d3_interpolate_number.lastIndex = 0; <add> <ide> // Find all numbers in b. <ide> for (i = 0; m = d3_interpolate_number.exec(b); ++i) { <ide> if (m.index) s.push(b.substring(s0, s1 = m.index)); <ide> d3.interpolateObject = function(a, b) { <ide> } <ide> <ide> var d3_interpolate_number = /[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g, <del> d3_interpolate_digits = /[-+]?\d*\.?\d*(?:[eE][-]?\d+)?(.*)/, <ide> d3_interpolate_rgb = {background: 1, fill: 1, stroke: 1}; <ide> <ide> function d3_interpolateByName(n) {
3
Ruby
Ruby
remove an is_a check
fded4d0385171877bc6e60a2f265a2095be652da
<ide><path>Library/Homebrew/extend/ENV/shared.rb <ide> def determine_cc <ide> # an alternate compiler, altering the value of environment variables. <ide> # If no valid compiler is found, raises an exception. <ide> def validate_cc!(formula) <del> if formula.fails_with? compiler <add> # FIXME <add> # The compiler object we pass to fails_with? has no version information <add> # attached to it. This means that if we pass Compiler.new(:clang), the <add> # selector will be invoked if the formula fails with any version of clang. <add> # I think we can safely remove this conditional and always invoke the <add> # selector. <add> if formula.fails_with? Compiler.new(compiler) <ide> send CompilerSelector.new(formula).compiler <ide> end <ide> end <ide><path>Library/Homebrew/formula.rb <ide> def keg_only_reason <ide> end <ide> <ide> def fails_with? cc <del> cc = Compiler.new(cc) unless cc.is_a? Compiler <ide> (self.class.cc_failures || []).any? do |failure| <ide> # Major version check distinguishes between, e.g., <ide> # GCC 4.7.1 and GCC 4.8.2, where a comparison is meaningless
2
Text
Text
encourage installation of sass as a devdep
ed1eedaa9723026ae4b1e5368526660c18ff8c8d
<ide><path>docs/basic-features/built-in-css-support.md <ide> You can use component-level Sass via CSS Modules and the `.module.scss` or `.mod <ide> Before you can use Next.js' built-in Sass support, be sure to install [`sass`](https://github.com/sass/sass): <ide> <ide> ```bash <del>npm install sass <add>npm install --save-dev sass <ide> ``` <ide> <ide> Sass support has the same benefits and restrictions as the built-in CSS support detailed above.
1
Javascript
Javascript
fix minor typos
fdb7011cfec9ffb5bfdeb00d8dfb1a0225d12bdf
<ide><path>examples/jsm/utils/BufferGeometryUtils.js <ide> function interleaveAttributes( attributes ) { <ide> let arrayLength = 0; <ide> let stride = 0; <ide> <del> // calculate the the length and type of the interleavedBuffer <add> // calculate the length and type of the interleavedBuffer <ide> for ( let i = 0, l = attributes.length; i < l; ++ i ) { <ide> <ide> const attribute = attributes[ i ]; <ide> function estimateBytesUsed( geometry ) { <ide> /** <ide> * @param {BufferGeometry} geometry <ide> * @param {number} tolerance <del> * @return {BufferGeometry>} <add> * @return {BufferGeometry} <ide> */ <ide> function mergeVertices( geometry, tolerance = 1e-4 ) { <ide> <ide> function mergeVertices( geometry, tolerance = 1e-4 ) { <ide> /** <ide> * @param {BufferGeometry} geometry <ide> * @param {number} drawMode <del> * @return {BufferGeometry>} <add> * @return {BufferGeometry} <ide> */ <ide> function toTrianglesDrawMode( geometry, drawMode ) { <ide>
1
Ruby
Ruby
improve args passing
b57b83feeccbfd1435e018a5a79328a2313078e8
<ide><path>Library/Homebrew/dev-cmd/ruby.rb <ide> def ruby_args <ide> Run a Ruby instance with Homebrew's libraries loaded, e.g. <ide> `brew ruby -e "puts :gcc.f.deps"` or `brew ruby script.rb`. <ide> EOS <del> switch "-r", <del> description: "Load a library using `require`." <del> switch "-e", <del> description: "Execute the given text string as a script." <add> flag "-r=", <add> description: "Load a library using `require`." <add> flag "-e=", <add> description: "Execute the given text string as a script." <ide> end <ide> end <ide> <ide> def ruby <del> ruby_args.parse <add> args = ruby_args.parse <add> <add> ruby_sys_args = [] <add> ruby_sys_args << "-r#{args.r}" if args.r <add> ruby_sys_args << "-e #{args.e}" if args.e <add> ruby_sys_args += args.named <ide> <ide> begin <ide> safe_system RUBY_PATH, <ide> "-I", $LOAD_PATH.join(File::PATH_SEPARATOR), <ide> "-rglobal", "-rdev-cmd/irb", <del> *ARGV <add> *ruby_sys_args <ide> rescue ErrorDuringExecution => e <ide> exit e.status.exitstatus <ide> end
1
Java
Java
update javadoc for throttlewithtimeout
2a3ade2d6162dc328a340ce247ccdf569284ffa8
<ide><path>rxjava-core/src/main/java/rx/Observable.java <ide> public static Observable<Long> interval(long interval, TimeUnit unit, Scheduler <ide> } <ide> <ide> /** <del> * Throttles the {@link Observable} by dropping values which are followed by newer values before the timer has expired. <add> * Throttles by dropping all values that are followed by newer values before the timeout value expires. The timer reset on each `onNext` call. <add> * <p> <add> * NOTE: If the timeout is set higher than the rate of traffic then this will drop all data. <ide> * <ide> * @param timeout <ide> * The time each value has to be 'the most recent' of the {@link Observable} to ensure that it's not dropped. <del> * <ide> * @param unit <ide> * The {@link TimeUnit} for the timeout. <ide> * <ide> public Observable<T> throttleWithTimeout(long timeout, TimeUnit unit) { <ide> } <ide> <ide> /** <del> * Throttles the {@link Observable} by dropping values which are followed by newer values before the timer has expired. <add> * Throttles by dropping all values that are followed by newer values before the timeout value expires. The timer reset on each `onNext` call. <add> * <p> <add> * NOTE: If the timeout is set higher than the rate of traffic then this will drop all data. <ide> * <ide> * @param timeout <ide> * The time each value has to be 'the most recent' of the {@link Observable} to ensure that it's not dropped. <ide> * @param unit <del> * The {@link TimeUnit} for the timeout. <add> * The unit of time for the specified timeout. <ide> * @param scheduler <del> * The {@link Scheduler} to use when timing incoming values. <del> * @return An {@link Observable} which filters out values which are too quickly followed up with newer values. <add> * The {@link Scheduler} to use internally to manage the timers which handle timeout for each event. <add> * @return Observable which performs the throttle operation. <ide> */ <ide> public Observable<T> throttleWithTimeout(long timeout, TimeUnit unit, Scheduler scheduler) { <ide> return create(OperationThrottleWithTimeout.throttleWithTimeout(this, timeout, unit, scheduler));
1
Text
Text
add info and fix command description [ci-skip]
a3ffa9b9088cf0dd3daa964a1f365dd10119fcf6
<ide><path>guides/source/command_line.md <ide> $ rails new commandsapp <ide> run bundle install <ide> ``` <ide> <del>Rails will set you up with what seems like a huge amount of stuff for such a tiny command! You've got the entire Rails directory structure now with all the code you need to run our simple application right out of the box. <add>Rails will set up what seems like a huge amount of stuff for such a tiny command! We've got the entire Rails directory structure now with all the code we need to run our simple application right out of the box. <ide> <del>If you wish to skip some files or components from being generated, you can append the following arguments to your `rails new` command: <add>If you wish to skip some files from being generated or skip some libraries, you can append any of the following arguments to your `rails new` command: <ide> <ide> | Argument | Description | <ide> | ----------------------- | ----------------------------------------------------------- | <del>| `--skip-git` | Skip .gitignore file | <add>| `--skip-git` | Skip git init, .gitignore, and .gitattributes | <ide> | `--skip-keeps` | Skip source control .keep files | <ide> | `--skip-action-mailer` | Skip Action Mailer files | <ide> | `--skip-action-mailbox` | Skip Action Mailbox gem | <ide> If you wish to skip some files or components from being generated, you can appen <ide> | `--skip-system-test` | Skip system test files | <ide> | `--skip-bootsnap` | Skip bootsnap gem | <ide> <add>These are just some of the options you can append to `rails new`. For a comprehensive list of options, type `rails new --help`. <add> <ide> Command Line Basics <ide> ------------------- <ide>
1
Go
Go
ignore nodata errors when delete thin device
7c6ef28042c20fdad23cd461ab49b9cfa0c757df
<ide><path>integration/container/stop_test.go <add>package container <add> <add>import ( <add> "context" <add> "fmt" <add> "strings" <add> "testing" <add> "time" <add> <add> "github.com/docker/docker/api/types" <add> "github.com/docker/docker/api/types/container" <add> "github.com/docker/docker/api/types/network" <add> "github.com/docker/docker/client" <add> "github.com/docker/docker/integration/util/request" <add> "github.com/gotestyourself/gotestyourself/icmd" <add> "github.com/gotestyourself/gotestyourself/poll" <add> "github.com/gotestyourself/gotestyourself/skip" <add> "github.com/stretchr/testify/require" <add>) <add> <add>func TestDeleteDevicemapper(t *testing.T) { <add> skip.IfCondition(t, testEnv.DaemonInfo.Driver != "devicemapper") <add> <add> defer setupTest(t)() <add> client := request.NewAPIClient(t) <add> ctx := context.Background() <add> <add> foo, err := client.ContainerCreate(ctx, <add> &container.Config{ <add> Cmd: []string{"echo"}, <add> Image: "busybox", <add> }, <add> &container.HostConfig{}, <add> &network.NetworkingConfig{}, <add> "foo", <add> ) <add> require.NoError(t, err) <add> <add> err = client.ContainerStart(ctx, foo.ID, types.ContainerStartOptions{}) <add> require.NoError(t, err) <add> <add> inspect, err := client.ContainerInspect(ctx, foo.ID) <add> require.NoError(t, err) <add> <add> poll.WaitOn(t, containerIsStopped(ctx, client, foo.ID), poll.WithDelay(100*time.Millisecond)) <add> <add> deviceID := inspect.GraphDriver.Data["DeviceId"] <add> <add> // Find pool name from device name <add> deviceName := inspect.GraphDriver.Data["DeviceName"] <add> devicePrefix := deviceName[:strings.LastIndex(deviceName, "-")] <add> devicePool := fmt.Sprintf("/dev/mapper/%s-pool", devicePrefix) <add> <add> result := icmd.RunCommand("dmsetup", "message", devicePool, "0", fmt.Sprintf("delete %s", deviceID)) <add> result.Assert(t, icmd.Success) <add> <add> err = client.ContainerRemove(ctx, foo.ID, types.ContainerRemoveOptions{}) <add> require.NoError(t, err) <add>} <add> <add>func containerIsStopped(ctx context.Context, client client.APIClient, containerID string) func(log poll.LogT) poll.Result { <add> return func(log poll.LogT) poll.Result { <add> inspect, err := client.ContainerInspect(ctx, containerID) <add> <add> switch { <add> case err != nil: <add> return poll.Error(err) <add> case !inspect.State.Running: <add> return poll.Success() <add> default: <add> return poll.Continue("waiting for container to be stopped") <add> } <add> } <add>}
1
Javascript
Javascript
fix strict js wanings
e72216649abdf0c24cd625d35f82967e1b8438ee
<ide><path>fonts.js <ide> var Type2CFF = (function type2CFF() { <ide> if (unicode <= 0x1f || (unicode >= 127 && unicode <= 255)) <ide> unicode += kCmapGlyphOffset; <ide> <del> var width = isNum(mapping.width) ? mapping.width : defaultWidth; <add> var width = (mapping.hasOwnProperty('width') && isNum(mapping.width)) ? <add> mapping.width : defaultWidth; <ide> properties.encoding[code] = { <ide> unicode: unicode, <ide> width: width <ide><path>pdf.js <ide> var PartialEvaluator = (function partialEvaluator() { <ide> } <ide> <ide> var fnArray = queue.fnArray, argsArray = queue.argsArray; <del> var dependency = dependency || []; <add> var dependencyArray = dependency || []; <ide> <ide> resources = xref.fetchIfRef(resources) || new Dict(); <ide> var xobjs = xref.fetchIfRef(resources.get('XObject')) || new Dict(); <ide> var PartialEvaluator = (function partialEvaluator() { <ide> <ide> if (typeNum == TILING_PATTERN) { <ide> // Create an IR of the pattern code. <del> var depIdx = dependency.length; <del> var codeIR = this.getIRQueue(pattern, <del> dict.get('Resources'), {}, dependency); <add> var depIdx = dependencyArray.length; <add> var queueObj = {}; <add> var codeIR = this.getIRQueue(pattern, dict.get('Resources'), <add> queueObj, dependencyArray); <ide> <ide> // Add the dependencies that are required to execute the <ide> // codeIR. <del> insertDependency(dependency.slice(depIdx)); <add> insertDependency(dependencyArray.slice(depIdx)); <ide> <ide> args = TilingPattern.getIR(codeIR, dict, args); <ide> } <ide> var PartialEvaluator = (function partialEvaluator() { <ide> argsArray.push([matrix, bbox]); <ide> <ide> // This adds the IRQueue of the xObj to the current queue. <del> var depIdx = dependency.length; <add> var depIdx = dependencyArray.length; <ide> <ide> this.getIRQueue(xobj, xobj.dict.get('Resources'), queue, <del> dependency); <add> dependencyArray); <ide> <ide> // Add the dependencies that are required to execute the <ide> // codeIR. <del> insertDependency(dependency.slice(depIdx)); <add> insertDependency(dependencyArray.slice(depIdx)); <ide> <ide> fn = 'paintFormXObjectEnd'; <ide> args = []; <ide> var PartialEvaluator = (function partialEvaluator() { <ide> properties.resources = fontResources; <ide> for (var key in charProcs.map) { <ide> var glyphStream = xref.fetchIfRef(charProcs.map[key]); <del> var queue = {}; <add> var queueObj = {}; <ide> properties.glyphs[key].IRQueue = this.getIRQueue(glyphStream, <del> fontResources, queue, dependency); <add> fontResources, <add> queueObj, <add> dependency); <ide> } <ide> } <ide> <ide> var PDFFunction = (function() { <ide> case CONSTRUCT_STICHED: <ide> return this.constructStichedFromIR(IR); <ide> case CONSTRUCT_POSTSCRIPT: <add> default: <ide> return this.constructPostScriptFromIR(IR); <ide> } <ide> }, <ide> var PDFObjects = (function() { <ide> // not required to be resolved right now <ide> if (callback) { <ide> this.ensureObj(objId).then(callback); <del> return; <add> return null; <ide> } <ide> <ide> // If there isn't a callback, the user expects to get the resolved data <ide> var PDFObjects = (function() { <ide> <ide> // If there isn't an object yet or the object isn't resolved, then the <ide> // data isn't ready yet! <del> if (!obj || !obj.isResolved) <add> if (!obj || !obj.isResolved) { <ide> throw 'Requesting object that isn\'t resolved yet ' + objId; <add> return null; <add> } <ide> else <ide> return obj.data; <ide> },
2
PHP
PHP
use label widget in multi-checkbox widget
0fdb8b7c17b7af22f45ee159680bc82be415c8dc
<ide><path>src/View/Input/MultiCheckbox.php <ide> class MultiCheckbox { <ide> */ <ide> protected $_templates; <ide> <add>/** <add> * Label widget instance. <add> * <add> * @var Cake\View\Input\Label <add> */ <add> protected $_label; <add> <ide> /** <ide> * Render multi-checkbox widget. <ide> * <add> * This class uses the following templates: <add> * <add> * - `checkbox` Renders checkbox input controls. Accepts <add> * the `name`, `value` and `attrs` variables. <add> * - `checkboxContainer` Renders the containing div/element for <add> * a checkbox and its label. Accepts the `input`, and `label` <add> * variables. <add> * <ide> * @param Cake\View\StringTemplate $templates <add> * @param Cake\View\Input\Label $label <ide> */ <del> public function __construct($templates) { <add> public function __construct($templates, $label) { <ide> $this->_templates = $templates; <add> $this->_label = $label; <ide> } <ide> <ide> /** <ide> protected function _renderInput($checkbox) { <ide> <ide> $labelAttrs = [ <ide> 'for' => $checkbox['id'], <del> 'escape' => $checkbox['escape'] <del> ]; <del> $label = $this->_templates->format('label', [ <del> 'text' => $checkbox['escape'] ? h($checkbox['text']) : $checkbox['text'], <add> 'escape' => $checkbox['escape'], <add> 'text' => $checkbox['text'], <ide> 'input' => $input, <del> 'attrs' => $this->_templates->formatAttributes($labelAttrs) <del> ]); <add> ]; <add> $label = $this->_label->render($labelAttrs); <ide> <ide> return $this->_templates->format('checkboxContainer', [ <ide> 'label' => $label, <ide><path>tests/TestCase/View/Input/MultiCheckboxTest.php <ide> namespace Cake\Test\TestCase\View\Input; <ide> <ide> use Cake\TestSuite\TestCase; <add>use Cake\View\Input\Label; <ide> use Cake\View\Input\MultiCheckbox; <ide> use Cake\View\StringTemplate; <ide> <ide> public function setUp() { <ide> * @return void <ide> */ <ide> public function testRenderSimple() { <del> $input = new MultiCheckbox($this->templates); <add> $label = new Label($this->templates); <add> $input = new MultiCheckbox($this->templates, $label); <ide> $data = [ <ide> 'name' => 'Tags[id]', <ide> 'options' => [ <ide> public function testRenderSimple() { <ide> * @return void <ide> */ <ide> public function testRenderComplex() { <del> $input = new MultiCheckbox($this->templates); <add> $label = new Label($this->templates); <add> $input = new MultiCheckbox($this->templates, $label); <ide> $data = [ <ide> 'name' => 'Tags[id]', <ide> 'options' => [ <ide> public function testRenderComplex() { <ide> * @return void <ide> */ <ide> public function testRenderEscaping() { <del> $input = new MultiCheckbox($this->templates); <add> $label = new Label($this->templates); <add> $input = new MultiCheckbox($this->templates, $label); <ide> $data = [ <ide> 'name' => 'Tags[id]', <ide> 'options' => [ <ide> public function testRenderEscaping() { <ide> * @return void <ide> */ <ide> public function testRenderSelected() { <del> $input = new MultiCheckbox($this->templates); <add> $label = new Label($this->templates); <add> $input = new MultiCheckbox($this->templates, $label); <ide> $data = [ <ide> 'name' => 'Tags[id]', <ide> 'options' => [ <ide> public function testRenderSelected() { <ide> * @return void <ide> */ <ide> public function testRenderDisabled() { <del> $input = new MultiCheckbox($this->templates); <add> $label = new Label($this->templates); <add> $input = new MultiCheckbox($this->templates, $label); <ide> $data = [ <ide> 'name' => 'Tags[id]', <ide> 'options' => [
2
Python
Python
add modes to batchnormalization, fix bn issues
54691f9be052e5564ca0e5c6a503e641ea3142e1
<ide><path>keras/layers/normalization.py <ide> from ..utils.theano_utils import shared_zeros <ide> from .. import initializations <ide> <add>import theano.tensor as T <add> <ide> class BatchNormalization(Layer): <ide> ''' <ide> Reference: <ide> Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift <ide> http://arxiv.org/pdf/1502.03167v3.pdf <add> <add> mode: 0 -> featurewise normalization <add> 1 -> samplewise normalization (may sometimes outperform featurewise mode) <ide> ''' <del> def __init__(self, input_shape, epsilon=1e-6, weights=None): <add> def __init__(self, input_shape, epsilon=1e-6, mode=0, weights=None): <ide> self.init = initializations.get("uniform") <ide> self.input_shape = input_shape <ide> self.epsilon = epsilon <add> self.mode = mode <ide> <ide> self.gamma = self.init((self.input_shape)) <ide> self.beta = shared_zeros(self.input_shape) <ide> def __init__(self, input_shape, epsilon=1e-6, weights=None): <ide> <ide> def output(self, train): <ide> X = self.get_input(train) <del> X_normed = (X - X.mean(keepdims=True)) / (X.std(keepdims=True) + self.epsilon) <add> <add> if self.mode == 0: <add> m = X.mean(axis=0) <add> # manual computation of std to prevent NaNs <add> std = T.mean((X-m)**2 + self.epsilon, axis=0) ** 0.5 <add> X_normed = (X - m) / (std + self.epsilon) <add> <add> elif self.mode == 1: <add> m = X.mean(axis=-1, keepdims=True) <add> std = X.std(axis=-1, keepdims=True) <add> X_normed = (X - m) / (std + self.epsilon) <add> <ide> out = self.gamma * X_normed + self.beta <ide> return out <ide> <ide> def get_config(self): <ide> return {"name":self.__class__.__name__, <ide> "input_shape":self.input_shape, <del> "epsilon":self.epsilon} <ide>\ No newline at end of file <add> "epsilon":self.epsilon, <add> "mode":self.mode}
1
Ruby
Ruby
use greedy_* method parameters
8dc060c88b360c26571b2549af46a108fc7a9078
<ide><path>Library/Homebrew/cask/cmd/upgrade.rb <ide> def self.upgrade_casks( <ide> <ide> outdated_casks = if casks.empty? <ide> Caskroom.casks(config: Config.from_args(args)).select do |cask| <del> cask.outdated?(greedy: greedy, greedy_latest: args.greedy_latest?, <del> greedy_auto_updates: args.greedy_auto_updates?) <add> cask.outdated?(greedy: greedy, greedy_latest: greedy_latest, <add> greedy_auto_updates: greedy_auto_updates) <ide> end <ide> else <ide> casks.select do |cask| <ide> def self.upgrade_casks( <ide> return false if outdated_casks.empty? <ide> <ide> if casks.empty? && !greedy <del> if !args.greedy_auto_updates? && !args.greedy_latest? <del> ohai "Casks with 'auto_updates true' or 'version :latest' <del> will not be upgraded; pass `--greedy` to upgrade them." <add> if !greedy_auto_updates && !greedy_latest <add> ohai "Casks with 'auto_updates true' or 'version :latest' " \ <add> "will not be upgraded; pass `--greedy` to upgrade them." <ide> end <del> if args.greedy_auto_updates? && !args.greedy_latest? <add> if greedy_auto_updates && !greedy_latest <ide> ohai "Casks with 'version :latest' will not be upgraded; pass `--greedy-latest` to upgrade them." <ide> end <del> if !args.greedy_auto_updates? && args.greedy_latest? <add> if !greedy_auto_updates && greedy_latest <ide> ohai "Casks with 'auto_updates true' will not be upgraded; pass `--greedy-auto-updates` to upgrade them." <ide> end <ide> end <ide><path>Library/Homebrew/cmd/upgrade.rb <ide> def upgrade_outdated_casks(casks, args:) <ide> <ide> Cask::Cmd::Upgrade.upgrade_casks( <ide> *casks, <del> force: args.force?, <del> greedy: args.greedy?, <del> dry_run: args.dry_run?, <del> binaries: args.binaries?, <del> quarantine: args.quarantine?, <del> require_sha: args.require_sha?, <del> skip_cask_deps: args.skip_cask_deps?, <del> verbose: args.verbose?, <del> args: args, <add> force: args.force?, <add> greedy: args.greedy?, <add> greedy_latest: args.greedy_latest?, <add> greedy_auto_updates: args.greedy_auto_updates?, <add> dry_run: args.dry_run?, <add> binaries: args.binaries?, <add> quarantine: args.quarantine?, <add> require_sha: args.require_sha?, <add> skip_cask_deps: args.skip_cask_deps?, <add> verbose: args.verbose?, <add> args: args, <ide> ) <ide> end <ide> end
2
Javascript
Javascript
fix the absolute path used in nodestuffplugin
7eb35558440ad1ee04cad536dfdf7078924b275d
<ide><path>lib/NodeStuffPlugin.js <ide> NodeStuffPlugin.prototype.apply = function(compiler) { <ide> return new BasicEvaluatedExpression().setBoolean(false).setRange(expr.range); <ide> }); <ide> compiler.parser.plugin("expression module", function() { <del> return ModuleParserHelpers.addParsedVariable(this, "module", "require(" + JSON.stringify(path.join(__dirname, "..", "buildin", "module.js")) + ")(module)"); <add> return ModuleParserHelpers.addParsedVariable(this, "module", "require(" + JSON.stringify(path.relative(this.state.module.context, path.join(__dirname, "..", "buildin", "module.js"))) + ")(module)"); <ide> }); <ide> };
1
Go
Go
add support for uptodate filter, for internal use
91c86c7e26c40ff3e422adcdd88d1649dd9dbc9b
<ide><path>daemon/cluster/filters.go <ide> func newListTasksFilters(filter filters.Args, transformFunc func(filters.Args) e <ide> "service": true, <ide> "node": true, <ide> "desired-state": true, <add> // UpToDate is not meant to be exposed to users. It's for <add> // internal use in checking create/update progress. Therefore, <add> // we prefix it with a '_'. <add> "_up-to-date": true, <ide> } <ide> if err := filter.Validate(accepted); err != nil { <ide> return nil, err <ide> func newListTasksFilters(filter filters.Args, transformFunc func(filters.Args) e <ide> Labels: runconfigopts.ConvertKVStringsToMap(filter.Get("label")), <ide> ServiceIDs: filter.Get("service"), <ide> NodeIDs: filter.Get("node"), <add> UpToDate: len(filter.Get("_up-to-date")) != 0, <ide> } <ide> <ide> for _, s := range filter.Get("desired-state") {
1
Python
Python
fix error handling
66586a6807fb26bb001cd008d86dae5056d7c25f
<ide><path>libcloud/compute/drivers/vsphere.py <ide> def create_node(self, **kwargs): <ide> # disk_spec.device.controllerKey = controller.key <ide> # devices.append(disk_spec) <ide> <del> if size.disk: <del> for dev in template.config.hardware.device: <del> if isinstance(dev, vim.vm.device.VirtualDisk): <del> dev.capacityInKB = int(size.disk) * 1024 * 1024 <del> <ide> vmconf = vim.vm.ConfigSpec( <ide> numCPUs=int(size.extra.get('cpu', 1)), <ide> memoryMB=long(size.ram), <ide> def create_node(self, **kwargs): <ide> ) <ide> <ide> result = self.wait_for_task(task) <add> <add> if task.info.state == 'error': <add> raise Exception(task.info.error.reason) <add> <ide> node = self._to_node(result) <ide> <ide> if network: <ide> self.ex_connect_network(result, network) <add> <ide> return node <ide> <ide> def ex_connect_network(self, vm, network_name):
1
Text
Text
add paragraph on consistency
ee78531d6338a9ae9ddf15b8dad4002f9f822573
<ide><path>guide/english/agile/velocity/index.md <ide> title: Velocity <ide> --- <ide> ## Velocity <ide> <del>On a Scrum team, you determine the velocity at the end of each iteration. It is simply the sum of Story Points completed within the timebox. <add>On a Scrum team, you determine the velocity at the end of each Iteration. Velocity is simply the sum of Story Points completed within the timebox. <ide> <del>Having a predictable, consistent velocity allows your team to plan your iterations with some confidence, to work sustainably, and to forecast, with empirical data, the amount of scope to include in each release. <add>At the beginning of projects, it is common for velocity to vary from sprint to sprint. However, the team aligns and becomes more consistent in estimations and delivery, most teams find their velocity becomes more consistent over time. <add> <add>Having a predictable, consistent velocity allows your team to plan your iterations with some confidence, to work sustainably, and to forecast, with empirical data, the amount of scope to include in each release. <ide> <ide> #### More Information: <ide> The Scrum Alliance on <a href='https://www.scrumalliance.org/community/articles/2014/february/velocity' target='_blank' rel='nofollow'>Velocity</a>
1
Mixed
Go
add docs for reading dockerfile from stdin
e838679cd7954775cbe7ff72ef2da02dbe791fcb
<ide><path>docs/reference/commandline/build.md <ide> $ docker build -f Dockerfile.debug . <ide> This will use a file called `Dockerfile.debug` for the build instructions <ide> instead of `Dockerfile`. <ide> <add>```bash <add>$ curl example.com/remote/Dockerfile | docker build -f - . <add>``` <add> <add>The above command will use the current directory as the build context and read <add>a Dockerfile from stdin. <add> <ide> ```bash <ide> $ docker build -f dockerfiles/Dockerfile.debug -t myapp_debug . <ide> $ docker build -f dockerfiles/Dockerfile.prod -t myapp_prod . <ide><path>pkg/archive/archive_test.go <ide> import ( <ide> "archive/tar" <ide> "bytes" <ide> "fmt" <del> "github.com/docker/docker/pkg/testutil/assert" <ide> "io" <ide> "io/ioutil" <ide> "os" <ide> import ( <ide> "strings" <ide> "testing" <ide> "time" <add> <add> "github.com/docker/docker/pkg/testutil/assert" <ide> ) <ide> <ide> var tmp string
2
Javascript
Javascript
add tests for hotupdatechunktemplate
9681a3b15f6c565c1b47ec1a85dd84c26f4f58d2
<ide><path>test/HotUpdateChunkTemplate.test.js <add>var should = require("should"); <add>var sinon = require("sinon"); <add>var HotUpdateChunkTemplate = require("../lib/HotUpdateChunkTemplate"); <add> <add>describe("HotUpdateChunkTemplate", function() { <add> var env; <add> <add> beforeEach(function() { <add> env = { <add> myHotUpdateChunkTemplate: new HotUpdateChunkTemplate({}) <add> }; <add> }); <add> <add> describe("render", function() { <add> beforeEach(function() { <add> env.renderContext = { <add> renderChunkModules: sinon.spy(), <add> applyPluginsWaterfall: sinon.spy() <add> }; <add> var renderArguments = [ <add> "id", ["module1", "module2"], <add> ["module3", "module4"], <add> {}, <add> "moduleTemplate", ["template1"] <add> ]; <add> env.myHotUpdateChunkTemplate.render.apply(env.renderContext, renderArguments); <add> env.pluginsCall = env.renderContext.applyPluginsWaterfall; <add> }); <add> <add> it("renders chunk modules", function() { <add> env.renderContext.renderChunkModules.callCount.should.be.exactly(1); <add> }); <add> <add> it("applies modules plugins", function() { <add> env.pluginsCall.callCount.should.be.exactly(2); <add> env.pluginsCall.firstCall.args[0].should.be.exactly("modules"); <add> }); <add> <add> it("applies render plugins", function() { <add> env.pluginsCall.callCount.should.be.exactly(2); <add> env.pluginsCall.secondCall.args[0].should.be.exactly("render"); <add> }); <add> }); <add> <add> describe("updateHash", function() { <add> beforeEach(function() { <add> env.hash = { <add> update: sinon.spy() <add> }; <add> env.updateHashContext = { <add> applyPlugins: sinon.spy() <add> }; <add> env.myHotUpdateChunkTemplate.updateHash.call(env.updateHashContext, env.hash); <add> }); <add> <add> it("updates hash", function() { <add> env.hash.update.callCount.should.be.exactly(2); <add> env.hash.update.firstCall.args[0].should.be.exactly("HotUpdateChunkTemplate"); <add> env.hash.update.secondCall.args[0].should.be.exactly("1"); <add> }); <add> <add> it("applies hash plugin", function() { <add> env.updateHashContext.applyPlugins.callCount.should.be.exactly(1); <add> env.updateHashContext.applyPlugins.firstCall.args[0].should.be.exactly("hash"); <add> env.updateHashContext.applyPlugins.firstCall.args[1].should.be.exactly(env.hash); <add> }); <add> }); <add>});
1
Javascript
Javascript
add more test cases for dynamic reexports
625b3832c77e2f29237f28144bff0b678ccdf20c
<ide><path>test/cases/side-effects/dynamic-reexports/checked-export/dynamic.js <add>Object(exports).value = 123; <add>Object(exports).value2 = 42; <ide><path>test/cases/side-effects/dynamic-reexports/checked-export/index.js <add>export { value, value2 } from "./module"; <ide><path>test/cases/side-effects/dynamic-reexports/checked-export/module.js <add>export const value = 42; <add>export * from "./dynamic"; <ide><path>test/cases/side-effects/dynamic-reexports/direct-export/dynamic.js <add>Object(exports).value = 123; <add>Object(exports).value2 = 42; <ide><path>test/cases/side-effects/dynamic-reexports/direct-export/index.js <add>export * from "./module"; <ide><path>test/cases/side-effects/dynamic-reexports/direct-export/module.js <add>export const value = 42; <add>export * from "./dynamic"; <ide><path>test/cases/side-effects/dynamic-reexports/index.js <ide> import { <ide> } from "./dedupe-target-with-side"; <ide> import { value, valueUsed } from "./dedupe-target"; <ide> import * as DefaultExport from "./default-export"; <add>import { value as valueDirect, value2 as value2Direct } from "./direct-export"; <add>import { <add> value as valueChecked, <add> value2 as value2Checked <add>} from "./checked-export"; <ide> <ide> it("should dedupe static reexport target", () => { <ide> expect(valueStatic).toBe(42); <ide> it("should handle default export when reexporting", () => { <ide> const module = Object(require("./reexports-excludes-default")); <ide> expect(module.defaultProvided).toBe(unprovided); <ide> }); <add> <add>it("should handle direct export when reexporting", () => { <add> expect(valueDirect).toBe(42); <add> expect(value2Direct).toBe(42); <add>}); <add> <add>it("should handle checked dynamic export when reexporting", () => { <add> expect(valueChecked).toBe(42); <add> expect(value2Checked).toBe(42); <add>});
7
Javascript
Javascript
add types to various plugins
d881bb4c8fcfe40324382fc11fb727d18f4323ba
<ide><path>lib/APIPlugin.js <ide> const { <ide> toConstantDependencyWithWebpackRequire, <ide> evaluateToString <ide> } = require("./JavascriptParserHelpers"); <add>const NullFactory = require("./NullFactory"); <ide> const ConstDependency = require("./dependencies/ConstDependency"); <ide> <del>const NullFactory = require("./NullFactory"); <add>/** @typedef {import("./Compiler")} Compiler */ <ide> <ide> /* eslint-disable camelcase */ <ide> const REPLACEMENTS = { <ide> const REPLACEMENT_TYPES = { <ide> /* eslint-enable camelcase */ <ide> <ide> class APIPlugin { <add> /** <add> * Apply the plugin <add> * @param {Compiler} compiler the compiler instance <add> * @returns {void} <add> */ <ide> apply(compiler) { <ide> compiler.hooks.compilation.tap( <ide> "APIPlugin", <ide><path>lib/AutomaticPrefetchPlugin.js <ide> const PrefetchDependency = require("./dependencies/PrefetchDependency"); <ide> class AutomaticPrefetchPlugin { <ide> /** <ide> * Apply the plugin <del> * @param {Compiler} compiler Webpack Compiler <add> * @param {Compiler} compiler the compiler instance <ide> * @returns {void} <ide> */ <ide> apply(compiler) { <ide><path>lib/CompatibilityPlugin.js <ide> const NullFactory = require("./NullFactory"); <ide> class CompatibilityPlugin { <ide> /** <ide> * Apply the plugin <del> * @param {Compiler} compiler Webpack Compiler <add> * @param {Compiler} compiler the compiler instance <ide> * @returns {void} <ide> */ <ide> apply(compiler) { <ide><path>lib/ContextExclusionPlugin.js <ide> class ContextExclusionPlugin { <ide> <ide> /** <ide> * Apply the plugin <del> * @param {Compiler} compiler Webpack Compiler <add> * @param {Compiler} compiler the compiler instance <ide> * @returns {void} <ide> */ <ide> apply(compiler) { <ide><path>lib/DelegatedPlugin.js <ide> const NullFactory = require("./NullFactory"); <ide> const DelegatedExportsDependency = require("./dependencies/DelegatedExportsDependency"); <ide> const DelegatedSourceDependency = require("./dependencies/DelegatedSourceDependency"); <ide> <add>/** @typedef {import("./Compiler")} Compiler */ <add> <ide> class DelegatedPlugin { <ide> constructor(options) { <ide> this.options = options; <ide> } <ide> <add> /** <add> * Apply the plugin <add> * @param {Compiler} compiler the compiler instance <add> * @returns {void} <add> */ <ide> apply(compiler) { <ide> compiler.hooks.compilation.tap( <ide> "DelegatedPlugin", <ide><path>lib/EvalSourceMapDevToolPlugin.js <ide> class EvalSourceMapDevToolPlugin { <ide> } <ide> <ide> /** <del> * @param {Compiler} compiler Webpack Compiler <add> * @param {Compiler} compiler the compiler instance <ide> * @returns {void} <ide> */ <ide> apply(compiler) { <ide><path>lib/ExternalsPlugin.js <ide> <ide> const ExternalModuleFactoryPlugin = require("./ExternalModuleFactoryPlugin"); <ide> <add>/** @typedef {import("./Compiler")} Compiler */ <add> <ide> class ExternalsPlugin { <ide> constructor(type, externals) { <ide> this.type = type; <ide> this.externals = externals; <ide> } <add> <add> /** <add> * @param {Compiler} compiler the compiler instance <add> * @returns {void} <add> */ <ide> apply(compiler) { <ide> compiler.hooks.compile.tap("ExternalsPlugin", ({ normalModuleFactory }) => { <ide> new ExternalModuleFactoryPlugin(this.type, this.externals).apply( <ide><path>lib/FunctionModulePlugin.js <ide> <ide> const FunctionModuleTemplatePlugin = require("./FunctionModuleTemplatePlugin"); <ide> <add>/** @typedef {import("./Compiler")} Compiler */ <add> <ide> class FunctionModulePlugin { <add> /** <add> * Apply the plugin <add> * @param {Compiler} compiler the compiler instance <add> * @returns {void} <add> */ <ide> apply(compiler) { <ide> compiler.hooks.compilation.tap("FunctionModulePlugin", compilation => { <ide> new FunctionModuleTemplatePlugin({ <ide><path>lib/IgnorePlugin.js <ide> class IgnorePlugin { <ide> } <ide> <ide> /** <del> * @param {Compiler} compiler Webpack Compiler <add> * @param {Compiler} compiler the compiler instance <ide> * @returns {void} <ide> */ <ide> apply(compiler) { <ide><path>lib/JsonModulesPlugin.js <ide> const JavascriptModulesPlugin = require("./JavascriptModulesPlugin"); <ide> const JsonGenerator = require("./JsonGenerator"); <ide> const JsonParser = require("./JsonParser"); <ide> <add>/** @typedef {import("./Compiler")} Compiler */ <add> <ide> class JsonModulesPlugin { <add> /** <add> * Apply the plugin <add> * @param {Compiler} compiler the compiler instance <add> * @returns {void} <add> */ <ide> apply(compiler) { <ide> compiler.hooks.compilation.tap( <ide> "JsonModulesPlugin", <ide><path>lib/ModuleProfile.js <ide> class ModuleProfile { <ide> this.storing = this.storingEndTime - this.storingStartTime; <ide> } <ide> <add> /** <add> * Merge this profile into another one <add> * @param {ModuleProfile} realProfile the profile to merge into <add> * @returns {void} <add> */ <ide> mergeInto(realProfile) { <ide> if (this.factory > realProfile.additionalFactories) <ide> realProfile.additionalFactories = this.factory; <ide> if (this.integration > realProfile.additionalIntegration) <ide> realProfile.additionalIntegration = this.integration; <del> return realProfile; <ide> } <ide> } <ide> <ide><path>lib/NoEmitOnErrorsPlugin.js <ide> <ide> "use strict"; <ide> <add>/** @typedef {import("./Compiler")} Compiler */ <add> <ide> class NoEmitOnErrorsPlugin { <add> /** <add> * Apply the plugin <add> * @param {Compiler} compiler the compiler instance <add> * @returns {void} <add> */ <ide> apply(compiler) { <ide> compiler.hooks.shouldEmit.tap("NoEmitOnErrorsPlugin", compilation => { <ide> if (compilation.getStats().hasErrors()) return false; <ide><path>lib/NodeStuffPlugin.js <ide> const CachedConstDependency = require("./dependencies/CachedConstDependency"); <ide> const ModuleDecoratorDependency = require("./dependencies/ModuleDecoratorDependency"); <ide> <ide> /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ <add>/** @typedef {import("./Compiler")} Compiler */ <ide> /** @typedef {import("./Dependency")} Dependency */ <ide> /** @typedef {import("./DependencyTemplates")} DependencyTemplates */ <ide> /** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ <ide> class NodeStuffPlugin { <ide> this.options = options; <ide> } <ide> <add> /** <add> * Apply the plugin <add> * @param {Compiler} compiler the compiler instance <add> * @returns {void} <add> */ <ide> apply(compiler) { <ide> const options = this.options; <ide> compiler.hooks.compilation.tap( <ide><path>lib/NormalModuleReplacementPlugin.js <ide> <ide> const path = require("path"); <ide> <add>/** @typedef {import("./Compiler")} Compiler */ <add>/** @typedef {function(TODO): void} ModuleReplacer */ <add> <ide> class NormalModuleReplacementPlugin { <add> /** <add> * Create an instance of the plugin <add> * @param {RegExp} resourceRegExp the resource matcher <add> * @param {string|ModuleReplacer} newResource the resource replacement <add> */ <ide> constructor(resourceRegExp, newResource) { <ide> this.resourceRegExp = resourceRegExp; <ide> this.newResource = newResource; <ide> } <ide> <add> /** <add> * Apply the plugin <add> * @param {Compiler} compiler the compiler instance <add> * @returns {void} <add> */ <ide> apply(compiler) { <ide> const resourceRegExp = this.resourceRegExp; <ide> const newResource = this.newResource; <ide><path>lib/PrefetchPlugin.js <ide> <ide> const PrefetchDependency = require("./dependencies/PrefetchDependency"); <ide> <add>/** @typedef {import("./Compiler")} Compiler */ <add> <ide> class PrefetchPlugin { <ide> constructor(context, request) { <del> if (!request) { <del> this.request = context; <del> } else { <add> if (request) { <ide> this.context = context; <ide> this.request = request; <add> } else { <add> this.context = null; <add> this.request = context; <ide> } <ide> } <ide> <add> /** <add> * Apply the plugin <add> * @param {Compiler} compiler the compiler instance <add> * @returns {void} <add> */ <ide> apply(compiler) { <ide> compiler.hooks.compilation.tap( <ide> "PrefetchPlugin", <ide><path>lib/RequireJsStuffPlugin.js <ide> const { <ide> const NullFactory = require("./NullFactory"); <ide> const ConstDependency = require("./dependencies/ConstDependency"); <ide> <add>/** @typedef {import("./Compiler")} Compiler */ <add> <ide> module.exports = class RequireJsStuffPlugin { <add> /** <add> * Apply the plugin <add> * @param {Compiler} compiler the compiler instance <add> * @returns {void} <add> */ <ide> apply(compiler) { <ide> compiler.hooks.compilation.tap( <ide> "RequireJsStuffPlugin", <ide><path>lib/TemplatedPathPlugin.js <ide> const Module = require("./Module"); <ide> <ide> /** @typedef {import("./Compilation").PathData} PathData */ <add>/** @typedef {import("./Compiler")} Compiler */ <ide> <ide> const REGEXP_HASH = /\[hash(?::(\d+))?\]/gi, <ide> REGEXP_CHUNKHASH = /\[chunkhash(?::(\d+))?\]/gi, <ide> const replacePathVariables = (path, data) => { <ide> }; <ide> <ide> class TemplatedPathPlugin { <add> /** <add> * Apply the plugin <add> * @param {Compiler} compiler the compiler instance <add> * @returns {void} <add> */ <ide> apply(compiler) { <ide> compiler.hooks.compilation.tap("TemplatedPathPlugin", compilation => { <ide> const mainTemplate = compilation.mainTemplate; <ide><path>lib/UseStrictPlugin.js <ide> const ConstDependency = require("./dependencies/ConstDependency"); <ide> <ide> class UseStrictPlugin { <ide> /** <del> * @param {Compiler} compiler Webpack Compiler <add> * @param {Compiler} compiler the compiler instance <ide> * @returns {void} <ide> */ <ide> apply(compiler) { <ide><path>lib/WarnCaseSensitiveModulesPlugin.js <ide> <ide> const CaseSensitiveModulesWarning = require("./CaseSensitiveModulesWarning"); <ide> <add>/** @typedef {import("./Compiler")} Compiler */ <add> <ide> class WarnCaseSensitiveModulesPlugin { <add> /** <add> * Apply the plugin <add> * @param {Compiler} compiler the compiler instance <add> * @returns {void} <add> */ <ide> apply(compiler) { <ide> compiler.hooks.compilation.tap( <ide> "WarnCaseSensitiveModulesPlugin", <ide><path>lib/WarnDeprecatedOptionPlugin.js <ide> <ide> const WebpackError = require("./WebpackError"); <ide> <add>/** @typedef {import("./Compiler")} Compiler */ <add> <ide> class WarnDeprecatedOptionPlugin { <add> /** <add> * Create an instance of the plugin <add> * @param {string} option the target option <add> * @param {string | number} value the deprecated option value <add> * @param {string} suggestion the suggestion replacement <add> */ <ide> constructor(option, value, suggestion) { <ide> this.option = option; <ide> this.value = value; <ide> this.suggestion = suggestion; <ide> } <ide> <add> /** <add> * Apply the plugin <add> * @param {Compiler} compiler the compiler instance <add> * @returns {void} <add> */ <ide> apply(compiler) { <ide> compiler.hooks.thisCompilation.tap( <ide> "WarnDeprecatedOptionPlugin", <ide><path>lib/WarnNoModeSetPlugin.js <ide> <ide> const NoModeWarning = require("./NoModeWarning"); <ide> <add>/** @typedef {import("./Compiler")} Compiler */ <add> <ide> class WarnNoModeSetPlugin { <add> /** <add> * Apply the plugin <add> * @param {Compiler} compiler the compiler instance <add> * @returns {void} <add> */ <ide> apply(compiler) { <ide> compiler.hooks.thisCompilation.tap("WarnNoModeSetPlugin", compilation => { <ide> compilation.warnings.push(new NoModeWarning());
21
Ruby
Ruby
fix audit error when homepage is missing
46736c5e8101e8f4568303eacab6a0cfaaad9298
<ide><path>Library/Homebrew/cask/audit.rb <ide> def url_match_homepage? <ide> else <ide> host_uri.host <ide> end <add> <add> return false if homepage.blank? <add> <ide> home = homepage.downcase <ide> if (split_host = host.split(".")).length >= 3 <ide> host = split_host[-2..].join(".")
1
Go
Go
remove watchmiss for swarm mode
dd47466a4d722dae8e30d1c1536e12acfd159e7b
<ide><path>libnetwork/drivers/overlay/ov_network.go <ide> import ( <ide> "strings" <ide> "sync" <ide> "syscall" <del> "time" <ide> <ide> "github.com/docker/docker/pkg/reexec" <ide> "github.com/docker/libnetwork/datastore" <ide> func (n *network) initSandbox(restore bool) error { <ide> n.driver.initSandboxPeerDB(n.id) <ide> } <ide> <add> // If we are in swarm mode, we don't need anymore the watchMiss routine. <add> // This will save 1 thread and 1 netlink socket per network <add> if !n.driver.isSerfAlive() { <add> return nil <add> } <add> <ide> var nlSock *nl.NetlinkSocket <ide> sbox.InvokeFunc(func() { <ide> nlSock, err = nl.Subscribe(syscall.NETLINK_ROUTE, syscall.RTNLGRP_NEIGH) <ide> func (n *network) initSandbox(restore bool) error { <ide> } <ide> <ide> func (n *network) watchMiss(nlSock *nl.NetlinkSocket) { <del> t := time.Now() <ide> for { <ide> msgs, err := nlSock.Receive() <ide> if err != nil { <ide> func (n *network) watchMiss(nlSock *nl.NetlinkSocket) { <ide> continue <ide> } <ide> <del> if n.driver.isSerfAlive() { <del> logrus.Debugf("miss notification: dest IP %v, dest MAC %v", ip, mac) <del> mac, IPmask, vtep, err := n.driver.resolvePeer(n.id, ip) <del> if err != nil { <del> logrus.Errorf("could not resolve peer %q: %v", ip, err) <del> continue <del> } <del> n.driver.peerAdd(n.id, "dummy", ip, IPmask, mac, vtep, l2Miss, l3Miss, false) <del> } else if l3Miss && time.Since(t) > time.Second { <del> // All the local peers will trigger a miss notification but this one is expected and the local container will reply <del> // autonomously to the ARP request <del> // In case the gc_thresh3 values is low kernel might reject new entries during peerAdd. This will trigger the following <del> // extra logs that will inform of the possible issue. <del> // Entries created would not be deleted see documentation http://man7.org/linux/man-pages/man7/arp.7.html: <del> // Entries which are marked as permanent are never deleted by the garbage-collector. <del> // The time limit here is to guarantee that the dbSearch is not <del> // done too frequently causing a stall of the peerDB operations. <del> pKey, pEntry, err := n.driver.peerDbSearch(n.id, ip) <del> if err == nil && !pEntry.isLocal { <del> t = time.Now() <del> logrus.Warnf("miss notification for peer:%+v l3Miss:%t l2Miss:%t, if the problem persist check the gc_thresh on the host pKey:%+v pEntry:%+v err:%v", <del> neigh, l3Miss, l2Miss, *pKey, *pEntry, err) <del> } <add> logrus.Debugf("miss notification: dest IP %v, dest MAC %v", ip, mac) <add> mac, IPmask, vtep, err := n.driver.resolvePeer(n.id, ip) <add> if err != nil { <add> logrus.Errorf("could not resolve peer %q: %v", ip, err) <add> continue <ide> } <add> n.driver.peerAdd(n.id, "dummy", ip, IPmask, mac, vtep, l2Miss, l3Miss, false) <ide> } <ide> } <ide> }
1
Ruby
Ruby
raise error when file does not contain a cask
5a45315349c440241c7a5669a33d2707682d8f82
<ide><path>Library/Homebrew/cask/lib/hbc/cask.rb <ide> def self.each <ide> return to_enum unless block_given? <ide> <ide> Tap.flat_map(&:cask_files).each do |f| <del> yield CaskLoader::FromTapPathLoader.new(f).load <add> begin <add> yield CaskLoader::FromTapPathLoader.new(f).load <add> rescue CaskUnreadableError => e <add> opoo e.message <add> end <ide> end <ide> end <ide> <ide><path>Library/Homebrew/cask/lib/hbc/cask_loader.rb <ide> def load <ide> <ide> @content = IO.read(path) <ide> <del> instance_eval(content, path) <add> begin <add> instance_eval(content, path).tap do |cask| <add> unless cask.is_a?(Cask) <add> raise CaskUnreadableError.new(token, "'#{path}' does not contain a cask.") <add> end <add> end <add> rescue NameError, ArgumentError, ScriptError => e <add> raise CaskUnreadableError.new(token, e.message) <add> end <ide> end <ide> <ide> private <ide><path>Library/Homebrew/cask/lib/hbc/exceptions.rb <ide> def to_s <ide> end <ide> end <ide> <add> class CaskUnreadableError < CaskUnavailableError <add> def to_s <add> "Cask '#{token}' is unreadable" << (reason.empty? ? "." : ": #{reason}") <add> end <add> end <add> <ide> class CaskAlreadyCreatedError < AbstractCaskErrorWithToken <ide> def to_s <ide> %Q(Cask '#{token}' already exists. Run #{Formatter.identifier("brew cask edit #{token}")} to edit it.)
3
Text
Text
add info about required unix tools
3e7da1d7a24d766d3ea36cc8cb8bb4e478176c68
<ide><path>benchmark/README.md <ide> benchmarker to be used by providing it as an argument, e. g.: <ide> <ide> `node benchmark/http/simple.js benchmarker=autocannon` <ide> <add>Basic Unix tools are required for some benchmarks. <add>[Git for Windows][git-for-windows] includes Git Bash and the necessary tools, <add>which need to be included in the global Windows `PATH`. <add> <ide> To analyze the results `R` should be installed. Check you package manager or <ide> download it from https://www.r-project.org/. <ide> <ide> Supported options keys are: <ide> [autocannon]: https://github.com/mcollina/autocannon <ide> [wrk]: https://github.com/wg/wrk <ide> [t-test]: https://en.wikipedia.org/wiki/Student%27s_t-test#Equal_or_unequal_sample_sizes.2C_unequal_variances <add>[git-for-windows]: http://git-scm.com/download/win <ide>\ No newline at end of file
1
Python
Python
handle redis connection errors in result consumer
6ccdc7b9f8e02d21275e923dccc7ccb9185e6153
<ide><path>celery/backends/redis.py <ide> from __future__ import absolute_import, unicode_literals <ide> <ide> import time <add>from contextlib import contextmanager <ide> from functools import partial <ide> from ssl import CERT_NONE, CERT_OPTIONAL, CERT_REQUIRED <ide> <ide> <ide> E_LOST = 'Connection to Redis lost: Retry (%s/%s) %s.' <ide> <add>E_RETRY_LIMIT_EXCEEDED = """ <add>Retry limit exceeded while trying to reconnect to the Celery redis result \ <add>store backend. The Celery application must be restarted. <add>""" <add> <ide> logger = get_logger(__name__) <ide> <ide> <ide> def __init__(self, *args, **kwargs): <ide> super(ResultConsumer, self).__init__(*args, **kwargs) <ide> self._get_key_for_task = self.backend.get_key_for_task <ide> self._decode_result = self.backend.decode_result <add> self._ensure = self.backend.ensure <add> self._connection_errors = self.backend.connection_errors <ide> self.subscribed_to = set() <ide> <ide> def on_after_fork(self): <ide> def on_after_fork(self): <ide> logger.warning(text_t(e)) <ide> super(ResultConsumer, self).on_after_fork() <ide> <add> def _reconnect_pubsub(self): <add> self._pubsub = None <add> self.backend.client.connection_pool.reset() <add> # task state might have changed when the connection was down so we <add> # retrieve meta for all subscribed tasks before going into pubsub mode <add> metas = self.backend.client.mget(self.subscribed_to) <add> metas = [meta for meta in metas if meta] <add> for meta in metas: <add> self.on_state_change(self._decode_result(meta), None) <add> self._pubsub = self.backend.client.pubsub( <add> ignore_subscribe_messages=True, <add> ) <add> self._pubsub.subscribe(*self.subscribed_to) <add> <add> @contextmanager <add> def reconnect_on_error(self): <add> try: <add> yield <add> except self._connection_errors: <add> try: <add> self._ensure(self._reconnect_pubsub, ()) <add> except self._connection_errors: <add> logger.critical(E_RETRY_LIMIT_EXCEEDED) <add> raise <add> <ide> def _maybe_cancel_ready_task(self, meta): <ide> if meta['status'] in states.READY_STATES: <ide> self.cancel_for(meta['task_id']) <ide> def stop(self): <ide> <ide> def drain_events(self, timeout=None): <ide> if self._pubsub: <del> message = self._pubsub.get_message(timeout=timeout) <del> if message and message['type'] == 'message': <del> self.on_state_change(self._decode_result(message['data']), message) <add> with self.reconnect_on_error(): <add> message = self._pubsub.get_message(timeout=timeout) <add> if message and message['type'] == 'message': <add> self.on_state_change(self._decode_result(message['data']), message) <ide> elif timeout: <ide> time.sleep(timeout) <ide> <ide> def _consume_from(self, task_id): <ide> key = self._get_key_for_task(task_id) <ide> if key not in self.subscribed_to: <ide> self.subscribed_to.add(key) <del> self._pubsub.subscribe(key) <add> with self.reconnect_on_error(): <add> self._pubsub.subscribe(key) <ide> <ide> def cancel_for(self, task_id): <add> key = self._get_key_for_task(task_id) <add> self.subscribed_to.discard(key) <ide> if self._pubsub: <del> key = self._get_key_for_task(task_id) <del> self.subscribed_to.discard(key) <del> self._pubsub.unsubscribe(key) <add> with self.reconnect_on_error(): <add> self._pubsub.unsubscribe(key) <ide> <ide> <ide> class RedisBackend(BaseKeyValueStoreBackend, AsyncBackendMixin): <ide><path>t/unit/backends/test_redis.py <ide> from __future__ import absolute_import, unicode_literals <ide> <add>import json <ide> import random <ide> import ssl <ide> from contextlib import contextmanager <ide> def on_first_call(*args, **kwargs): <ide> mock.return_value, = retval <ide> <ide> <add>class ConnectionError(Exception): <add> pass <add> <add> <ide> class Connection(object): <ide> connected = True <ide> <ide> def execute(self): <ide> return [step(*a, **kw) for step, a, kw in self.steps] <ide> <ide> <add>class PubSub(mock.MockCallbacks): <add> def __init__(self, ignore_subscribe_messages=False): <add> self._subscribed_to = set() <add> <add> def close(self): <add> self._subscribed_to = set() <add> <add> def subscribe(self, *args): <add> self._subscribed_to.update(args) <add> <add> def unsubscribe(self, *args): <add> self._subscribed_to.difference_update(args) <add> <add> def get_message(self, timeout=None): <add> pass <add> <add> <ide> class Redis(mock.MockCallbacks): <ide> Connection = Connection <ide> Pipeline = Pipeline <add> pubsub = PubSub <ide> <ide> def __init__(self, host=None, port=None, db=None, password=None, **kw): <ide> self.host = host <ide> def __init__(self, host=None, port=None, db=None, password=None, **kw): <ide> def get(self, key): <ide> return self.keyspace.get(key) <ide> <add> def mget(self, keys): <add> return [self.get(key) for key in keys] <add> <ide> def setex(self, key, expires, value): <ide> self.set(key, value) <ide> self.expire(key, expires) <ide> class _RedisBackend(RedisBackend): <ide> return _RedisBackend(app=self.app) <ide> <ide> def get_consumer(self): <del> return self.get_backend().result_consumer <add> consumer = self.get_backend().result_consumer <add> consumer._connection_errors = (ConnectionError,) <add> return consumer <ide> <ide> @patch('celery.backends.asynchronous.BaseResultConsumer.on_after_fork') <ide> def test_on_after_fork(self, parent_method): <ide> def test_drain_events_before_start(self): <ide> # drain_events shouldn't crash when called before start <ide> consumer.drain_events(0.001) <ide> <add> def test_consume_from_connection_error(self): <add> consumer = self.get_consumer() <add> consumer.start('initial') <add> consumer._pubsub.subscribe.side_effect = (ConnectionError(), None) <add> consumer.consume_from('some-task') <add> assert consumer._pubsub._subscribed_to == {b'celery-task-meta-initial', b'celery-task-meta-some-task'} <add> <add> def test_cancel_for_connection_error(self): <add> consumer = self.get_consumer() <add> consumer.start('initial') <add> consumer._pubsub.unsubscribe.side_effect = ConnectionError() <add> consumer.consume_from('some-task') <add> consumer.cancel_for('some-task') <add> assert consumer._pubsub._subscribed_to == {b'celery-task-meta-initial'} <add> <add> @patch('celery.backends.redis.ResultConsumer.cancel_for') <add> @patch('celery.backends.asynchronous.BaseResultConsumer.on_state_change') <add> def test_drain_events_connection_error(self, parent_on_state_change, cancel_for): <add> meta = {'task_id': 'initial', 'status': states.SUCCESS} <add> consumer = self.get_consumer() <add> consumer.start('initial') <add> consumer.backend.set(b'celery-task-meta-initial', json.dumps(meta)) <add> consumer._pubsub.get_message.side_effect = ConnectionError() <add> consumer.drain_events() <add> parent_on_state_change.assert_called_with(meta, None) <add> assert consumer._pubsub._subscribed_to == {b'celery-task-meta-initial'} <add> <ide> <ide> class test_RedisBackend: <ide> def get_backend(self):
2
Go
Go
add support for container id files (a la pidfile)
64e74cefb746caa7f2a581149bbd523dd1ac9215
<ide><path>commands.go <ide> func (cli *DockerCli) CmdRun(args ...string) error { <ide> for _, warning := range runResult.Warnings { <ide> fmt.Fprintf(cli.err, "WARNING: %s\n", warning) <ide> } <add> if len(hostConfig.ContainerIDFile) > 0 { <add> if _, err := ioutil.ReadFile(hostConfig.ContainerIDFile); err == nil { <add> return fmt.Errorf("cid file found, make sure the other container isn't running or delete %s", hostConfig.ContainerIDFile) <add> } <add> file, err := os.Create(hostConfig.ContainerIDFile) <add> if err != nil { <add> return fmt.Errorf("failed to create the container ID file: %s", err) <add> } <add> <add> defer file.Close() <add> if _, err = file.WriteString(runResult.ID); err != nil { <add> return fmt.Errorf("failed to write the container ID to the file: %s", err) <add> } <add> } <ide> <ide> //start the container <ide> if _, _, err = cli.call("POST", "/containers/"+runResult.ID+"/start", hostConfig); err != nil { <ide><path>container.go <ide> type Config struct { <ide> } <ide> <ide> type HostConfig struct { <del> Binds []string <add> Binds []string <add> ContainerIDFile string <ide> } <ide> <ide> type BindMap struct { <ide> func ParseRun(args []string, capabilities *Capabilities) (*Config, *HostConfig, <ide> flStdin := cmd.Bool("i", false, "Keep stdin open even if not attached") <ide> flTty := cmd.Bool("t", false, "Allocate a pseudo-tty") <ide> flMemory := cmd.Int64("m", 0, "Memory limit (in bytes)") <add> flContainerIDFile := cmd.String("cidfile", "", "Write the container ID to the file") <ide> <ide> if capabilities != nil && *flMemory > 0 && !capabilities.MemoryLimit { <ide> //fmt.Fprintf(stdout, "WARNING: Your kernel does not support memory limit capabilities. Limitation discarded.\n") <ide> func ParseRun(args []string, capabilities *Capabilities) (*Config, *HostConfig, <ide> Entrypoint: entrypoint, <ide> } <ide> hostConfig := &HostConfig{ <del> Binds: binds, <add> Binds: binds, <add> ContainerIDFile: *flContainerIDFile, <ide> } <ide> <ide> if capabilities != nil && *flMemory > 0 && !capabilities.SwapLimit {
2
Text
Text
add 2.6.0-beta.4 to changelog.md
15e31d665ecc21786cbf0f5599562d7a4f6536be
<ide><path>CHANGELOG.md <ide> # Ember Changelog <ide> <add>### 2.6.0-beta.4 (May 09, 2016) <add> <add>- [#13442](https://github.com/emberjs/ember.js/pull/13442) [BUGFIX] Revert `Ember.Handlebars.SafeString` deprecation. <add>- [#13449](https://github.com/emberjs/ember.js/pull/13449) [BUGFIX] Ensure that `Ember.get(null, 'foo')` returns `undefined`. <add>- [#13465](https://github.com/emberjs/ember.js/pull/13465) [BUGFIX] Propagate loc information for inline link-to transform. <add>- [#13461](https://github.com/emberjs/ember.js/pull/13461) [BUGFIX] Prevent `Ember.get` from attempting to retrieve properties on primitive objects. <add> <ide> ### 2.6.0-beta.3 (May 02, 2016) <ide> <ide> - [#13418](https://github.com/emberjs/ember.js/pull/13418) [BUGFIX] Ensure that passing `run.later` a timeout value of `NaN` does not break all future
1
Ruby
Ruby
disallow external tap dependencies in core
6c9c3c607c0585e5361e272e976f3895f87263a4
<ide><path>Library/Homebrew/formula_auditor.rb <ide> def audit_deps <ide> <ide> next unless @core_tap <ide> <add> unless dep_f.tap.core_tap? <add> problem <<~EOS <add> Dependency '#{dep.name}' is not in homebrew/core. Formulae in homebrew/core <add> should not have dependencies in external taps. <add> EOS <add> end <add> <ide> # we want to allow uses_from_macos for aliases but not bare dependencies <ide> if self.class.aliases.include?(dep.name) && spec.uses_from_macos_names.exclude?(dep.name) <ide> problem "Dependency '#{dep.name}' is an alias; use the canonical name '#{dep.to_formula.full_name}'."
1
Text
Text
make some corrections to the translation
cba8bcdd046cfe4fe179b2f040a619dbc84ac213
<ide><path>guide/russian/working-in-tech/imposter-syndrome/index.md <ide> --- <ide> title: Imposter Syndrome <del>localeTitle: Иммунный синдром <add>localeTitle: Синдром самозванца <ide> --- <del>## Иммунный синдром <add>## Синдром самозванца <ide> <del>Синдром Импостера - это чувство _мошенничества_ или _не достаточно хорошее,_ чтобы выполнить свою работу. Среди разработчиков программного обеспечения, разработчиков и дизайнеров, работающих в техноло- гических компаниях, особенно те, которые не приходят из традиционного технического фона. Люди, страдающие от синдрома импостера, испытывают чувство неадекватности и отсутствия безопасности в отношении их способности делать вклад на рабочем месте. В действительности, они могут быть вполне способны и действительно успешно выполняют свои задачи. <add>Человек с синдромом самозванца чувствует себя обманщиком или недостаточно хорошим для выполнения своей работы. Данный синдром распространен среди программистов, разработчиков и дизайнеров, работающих в технологических компаниях, особенно среди тех, кто не имеет традиционного технического образования. Люди, страдающие от синдрома самозванца, испытывают чувство неполноценности и неуверенности в своих способностях вносить вклад в работу. На самом же деле, они могут быть вполне способны выполнять свои задачи и действительно успешно делают это. <ide> <del>Синдром импостера очень распространен среди инженеров-программистов или разработчиков, которые новичок в этой роли и испытывают недостаток в опыте некоторых своих сотрудников. В разных отраслях синдром синдрома очень распространен среди очень успешных людей. Исследования показали, что два из пяти «успешных» людей считают себя мошенниками / самозванцами, в то время как другие исследования показали, что до 70% людей испытывают синдром мокроты как один момент времени или другой. <add>Синдром самозванца очень распространен среди инженеров-программистов или разработчиков начального уровня, у которых меньше опыта, чем у их коллег. В разных отраслях синдром самозванца очень распространен даже среди очень успешных людей. Исследования показали, что двое из пяти «успешных» людей считают себя обманщиками / самозванцами, в то время как другие исследования показали, что до 70% людей испытывают синдром самозванца в определенные моменты времени. <ide> <del>Если вы страдаете от синдрома мокроты, у вас может возникнуть чувство неадекватности или неуверенности в вашей способности внести свой вклад. На самом деле, вы можете быть в полной мере способны и вносить свой вклад в свои задачи. <add>Если вы страдаете от синдрома самозванца, у вас может возникнуть чувство неполноценности или неуверенности в вашей способности внести свой вклад. На самом деле, возможно, вы вполне способны вносить свой вклад в рабочие задачи. <ide> <del>Эти мысли довольно распространены, если вы боретесь с синдромом мошенничества: <add>Следующие мысли довольно распространены, если у вас синдром самозванца: <ide> <ide> * "Что я здесь делаю?" <del>* «Я не разработчик, я обманываю себя и других людей». (чувствует подделку) <del>* «Мои коллеги гораздо умнее меня, я никогда не смогу соответствовать им». (подрывает собственные достижения) <del>* «Мои коллеги сказали мне, что я многого добился, но чувствую, что этого никогда не бывает». (скидки похвалы) <del>* «Я понятия не имею, как я прошел процесс собеседования». (чувствует, что только удача диктует результаты) <del>* «Меня будут высмеивать и увольнять, когда люди поймут, что я не такой умный, как я себя представлял». (страх неудачи) <del>* «Мой IQ недостаточно высок, чтобы работать здесь». (сомнения присущие способности) <del>* «Мне нужно больше тренироваться, чтобы чувствовать, что я заслуживаю того, чтобы быть здесь». <add>* «Я не разработчик, я обманываю себя и других людей». (чувствуешь себя обманщиком) <add>* «Мои коллеги гораздо умнее меня, я никогда не смогу соответствовать им». (ставишь под сомнение собственные достижения) <add>* «Мои коллеги сказали мне, что я многого добился, но мне всегда мало». (не доверяешь любым похвалам) <add>* «Я понятия не имею, как я прошел собеседование». (думаешь, что тебе просто повезло) <add>* «Меня высмеют и уволят, когда люди поймут, что я не такой умный, каким я себя выставлял». (страх неудачи) <add>* «Мой IQ недостаточно высок, чтобы работать здесь». (сомневаешься в собственных способностях) <add>* «Мне нужно больше практики, чтобы почувствовать, что я заслуживаю работать здесь». <ide> <del>Синдром импостата может помешать вам достичь, когда вам нужна помощь, тем самым замедляя ваше прогрессирование. Пожалуйста, потянитесь на форум или в чат! <add>Синдром самозванца может помешать вам в установлении контактов, когда вам понадобится помощь, тем самым замедляя ваш прогресс. Пожалуйста, обратитесь на форум или в чат! <ide> <del>#### Преодоление синдрома Импостера <add>#### Преодоление синдрома самозванца <ide> <del>Первым шагом в преодолении синдрома мошенничества является изучение разницы между мышлением роста и фиксированным мышлением. Люди с мышлением роста считают, что их навыки и таланты могут быть разработаны с помощью тяжелой работы, практики, разговоров с другими людьми и т.д. С другой стороны, те, с фиксированным мышлением, как правило, считают, что их таланты установлены способностями, что они были рождены с. <add>Первый шаг в преодолении синдрома самозванца - изучение разницы между ориентацией на развитие и ограниченным мышлением. Люди с ориентацией на развитие считают, что их навыки и таланты могут быть развиты с помощью тяжелой работы, практики, разговоров с другими людьми и т.д. С другой стороны, те, у кого ограниченное мышление, как правило, считают, что их таланты зависят от способностей, с которыми они были рождены. <ide> <del>Когда вы меняете свое мировоззрение на рост мышления, вы позволяете себе решать проблемы, которые могут казаться недосягаемыми. Если вы считаете, что ваши навыки могут быть разработаны с течением времени, это будет иметь меньшее значение, если вы не знаете, как что-то сделать (если вы готовы выполнить работу). <add>Когда вы ориентируетесь на развитие, вы позволяете себе решать проблемы, которые могут показаться недосягаемыми. Если вы считаете, что ваши навыки могут быть развиты с течением времени, то не будет иметь значения, знаете ли вы, как что-то сделать (если вы готовы выполнить работу). <ide> <del>[Многие талантливые, успешные люди занимаются синдромом Импостера](https://www.thecut.com/2017/01/25-famous-women-on-impostor-syndrome-and-self-doubt.html) . Они даже говорят, что - контринтуитивно - не только успех не устраняет синдром Импостера; много раз успех делает его еще хуже. Таким образом, мы не побеждаем однажды. Мы побеждаем его каждый день, каждый раз, когда принимаем проект, задание и т. Д. <add>[Многие талантливые, успешные люди имеют синдром самозванца](https://www.thecut.com/2017/01/25-famous-women-on-impostor-syndrome-and-self-doubt.html) . Они даже говорят, что - как ни парадоксально - успех не только не устраняет синдром самозванца; во многих случаях успех делает еще хуже. Таким образом, мы не побеждаем его раз и навсегда. Мы побеждаем его каждый день, каждый раз, когда беремся за проект, задание и т. д. <ide> <del>Дополнительные ресурсы, которые помогут вам узнать больше о синдроме импостера и о некоторых советах по его устранению: <add>Дополнительные источники, где можно узнать больше о синдроме самозванца, и некоторые советы по борьбе с ним: <ide> <del>* [Американская психологическая ассоциация - Почувствуйте, как мошенничество?](http://www.apa.org/gradpsych/2013/11/fraud.aspx) <del>* [TED Talks - Борьба с синдромом импоста](https://www.ted.com/playlists/503/fighting_impostor_syndrome) <del>* [Кварц - Является ли синдром мошенничества признаком величия?](https://qz.com/606727/is-imposter-syndrome-a-sign-of-greatness/) <del>* [HTTP203 - Синдром импоста](https://www.youtube.com/watch?v=VNr1Kb07aME) <del>* [Инициатива Ады - это синдром самозванца, который удерживает женщин от открытых технологий и культуры?](https://adainitiative.org/2013/08/28/is-impostor-syndrome-keeping-women-out-of-open-technology-and-culture/) <add>* [Американская психологическая ассоциация - Чувствуете себя обманщиком?](http://www.apa.org/gradpsych/2013/11/fraud.aspx) <add>* [TED Talks - Борьба с синдромом самозванца](https://www.ted.com/playlists/503/fighting_impostor_syndrome) <add>* [Quartz - Является ли синдром самозванца признаком величия?](https://qz.com/606727/is-imposter-syndrome-a-sign-of-greatness/) <add>* [HTTP203 - Синдром самозванца](https://www.youtube.com/watch?v=VNr1Kb07aME) <add>* [Ada Initiative - Синдром самозванца удерживает женщин от открытых технологий и культуры?](https://adainitiative.org/2013/08/28/is-impostor-syndrome-keeping-women-out-of-open-technology-and-culture/) <ide> * [DEV - Преодоление синдрома самозванца](https://dev.to/kathryngrayson/overcoming-impostor-syndrome-apg) <del>* [FastCompany - Типы синдрома мошенничества и способы их победить](https://www.fastcompany.com/40421352/the-five-types-of-impostor-syndrome-and-how-to-beat-them) <del>* [Startup Bros - 21 доказанных способов преодоления синдрома импозантов](https://startupbros.com/21-ways-overcome-impostor-syndrome/) <del>* [NY Times - Изучение способов борьбы с синдромом импотенции](https://www.nytimes.com/2015/10/26/your-money/learning-to-deal-with-the-impostor-syndrome.html) <ide>\ No newline at end of file <add>* [FastCompany - Типы синдрома самозванца и способы их победить](https://www.fastcompany.com/40421352/the-five-types-of-impostor-syndrome-and-how-to-beat-them) <add>* [Startup Bros - 21 доказанных способов преодоления синдрома самозванца](https://startupbros.com/21-ways-overcome-impostor-syndrome/) <add>* [NY Times - Изучение способов борьбы с синдромом самозванца](https://www.nytimes.com/2015/10/26/your-money/learning-to-deal-with-the-impostor-syndrome.html)
1
Python
Python
remove python 3.7 checks from the array api code
9978cc5a1861533abf7c6ed7b0f4e1d732171094
<ide><path>numpy/_pytesttester.py <ide> def __call__(self, label='fast', verbose=1, extra_argv=None, <ide> # so fetch module for suppression here. <ide> from numpy.distutils import cpuinfo <ide> <del> if sys.version_info >= (3, 8): <del> # Ignore the warning from importing the array_api submodule. This <del> # warning is done on import, so it would break pytest collection, <del> # but importing it early here prevents the warning from being <del> # issued when it imported again. <del> warnings.simplefilter("ignore") <del> import numpy.array_api <del> else: <del> # The array_api submodule is Python 3.8+ only due to the use <del> # of positional-only argument syntax. We have to ignore it <del> # completely or the tests will fail at the collection stage. <del> pytest_args += ['--ignore-glob=numpy/array_api/*'] <add> # Ignore the warning from importing the array_api submodule. This <add> # warning is done on import, so it would break pytest collection, <add> # but importing it early here prevents the warning from being <add> # issued when it imported again. <add> warnings.simplefilter("ignore") <add> import numpy.array_api <ide> <ide> # Filter out annoying import messages. Want these in both develop and <ide> # release mode. <ide><path>numpy/array_api/__init__.py <ide> <ide> import sys <ide> <del># numpy.array_api is 3.8+ because it makes extensive use of positional-only <del># arguments. <del>if sys.version_info < (3, 8): <del> raise ImportError("The numpy.array_api submodule requires Python 3.8 or greater.") <del> <ide> import warnings <ide> <ide> warnings.warn(
2
Python
Python
fix several typos
a2d11d4724d3cf4a0b18a7fe8448723d92e1c716
<ide><path>examples/lstm_seq2seq.py <ide> # Summary of the algorithm <ide> <ide> - We start with input sequences from a domain (e.g. English sentences) <del> and correspding target sequences from another domain <add> and corresponding target sequences from another domain <ide> (e.g. French sentences). <ide> - An encoder LSTM turns input sequences to 2 state vectors <ide> (we keep the last LSTM state and discard the outputs). <ide><path>keras/backend/tensorflow_backend.py <ide> def rnn(step_function, inputs, initial_states, <ide> states: List of tensors. <ide> Returns: <ide> outputs: Tensor with shape (samples, ...) (no time dimension), <del> new_states: Tist of tensors, same length and shapes <add> new_states: List of tensors, same length and shapes <ide> as 'states'. <ide> inputs: Tensor of temporal data of shape (samples, time, ...) <ide> (at least 3D). <ide><path>keras/backend/theano_backend.py <ide> def rnn(step_function, inputs, initial_states, <ide> states: List of tensors. <ide> Returns: <ide> outputs: Tensor with shape (samples, ...) (no time dimension), <del> new_states: Tist of tensors, same length and shapes <add> new_states: List of tensors, same length and shapes <ide> as 'states'. <ide> inputs: Tensor of temporal data of shape (samples, time, ...) <ide> (at least 3D). <ide><path>keras/engine/network.py <ide> def _base_init(self, name=None): <ide> # Entries are unique. Includes input and output layers. <ide> self._layers = [] <ide> <del> # Used only in conjonction with graph-networks <add> # Used only in conjunction with graph-networks <ide> self._outbound_nodes = [] <ide> self._inbound_nodes = [] <ide> <ide> def input_spec(self): <ide> or a single instance if the model has only one input. <ide> """ <ide> if not self._is_graph_network: <del> # TODO: support it in subclassd networks after inputs are set. <add> # TODO: support it in subclassed networks after inputs are set. <ide> return None <ide> <ide> specs = [] <ide><path>keras/engine/saving.py <ide> def _need_convert_kernel(original_backend): <ide> The convolution operation is implemented differently in different backends. <ide> While TH implements convolution, TF and CNTK implement the correlation operation. <ide> So the channel axis needs to be flipped when we're loading TF weights onto a TH model, <del> or vice verca. However, there's no conversion required between TF and CNTK. <add> or vice versa. However, there's no conversion required between TF and CNTK. <ide> <ide> # Arguments <ide> original_backend: Keras backend the weights were trained with, as a string.
5
PHP
PHP
apply fixes from styleci
9c4cf333158e9b00e58888686b65c55774de8fdc
<ide><path>src/Illuminate/View/Factory.php <ide> use Illuminate\Support\Arr; <ide> use Illuminate\Support\Str; <ide> use InvalidArgumentException; <del>use Illuminate\Support\Collection; <ide> use Illuminate\Contracts\Events\Dispatcher; <ide> use Illuminate\Contracts\Support\Arrayable; <ide> use Illuminate\View\Engines\EngineResolver; <ide> public function renderEach($view, $data, $iterator, $empty = 'raw|') <ide> $result = $this->make($empty)->render(); <ide> } <ide> } <add> <ide> return $result; <ide> } <ide>
1
Text
Text
add tip about --gpu-id to training quickstart
7198be0f4bfd4ea6d63a18d01326d77827751841
<ide><path>website/docs/usage/training.md <ide> spaCy's binary `.spacy` format. You can either include the data paths in the <ide> $ python -m spacy train config.cfg --output ./output --paths.train ./train.spacy --paths.dev ./dev.spacy <ide> ``` <ide> <add>> #### Tip: Enable your GPU <add>> <add>> Use the `--gpu-id` option to select the GPU: <add>> <add>> ```cli <add>> $ python -m spacy train config.cfg --gpu-id 0 <add>> ``` <add> <ide> <Accordion title="How are the config recommendations generated?" id="quickstart-source" spaced> <ide> <ide> The recommended config settings generated by the quickstart widget and the
1
Python
Python
make create_tokenizer work with japanese
84041a2bb517841d725781bdd72b1daf4f8e603d
<ide><path>spacy/ja/__init__.py <ide> <ide> from os import path <ide> <del>from ..language import Language <add>from ..language import Language, BaseDefaults <add>from ..tokenizer import Tokenizer <ide> from ..attrs import LANG <ide> from ..tokens import Doc <ide> <ide> from .language_data import * <ide> <del> <del>class Japanese(Language): <del> lang = 'ja' <del> <del> def make_doc(self, text): <add>class JapaneseTokenizer(object): <add> def __init__(self, cls, nlp=None): <add> self.vocab = nlp.vocab if nlp is not None else cls.create_vocab(nlp) <ide> try: <ide> from janome.tokenizer import Tokenizer <ide> except ImportError: <ide> raise ImportError("The Japanese tokenizer requires the Janome library: " <ide> "https://github.com/mocobeta/janome") <del> words = [x.surface for x in Tokenizer().tokenize(text)] <add> self.tokenizer = Tokenizer() <add> <add> def __call__(self, text): <add> words = [x.surface for x in self.tokenizer.tokenize(text)] <ide> return Doc(self.vocab, words=words, spaces=[False]*len(words)) <add> <add>class JapaneseDefaults(BaseDefaults): <add> @classmethod <add> def create_tokenizer(cls, nlp=None): <add> return JapaneseTokenizer(cls, nlp) <add> <add>class Japanese(Language): <add> lang = 'ja' <add> <add> Defaults = JapaneseDefaults <add> <add> def make_doc(self, text): <add> words = self.tokenizer(text) <add> return Doc(self.vocab, words=words, spaces=[False]*len(words)) <add> <add>
1
Text
Text
specify possible need for c++ compiler
4886e028bfcb32c6cdfdf210802f862c1fca971f
<ide><path>README.md <ide> The process to build `react.js` is built entirely on top of node.js, using many <ide> #### Prerequisites <ide> <ide> * You have `node` installed at v4.0.0+ and `npm` at v2.0.0+. <add>* You have `gcc` installed or are comfortable installing a compiler if needed. Some of our `npm` dependencies may require a compliation step. On OS X, the Xcode Command Line Tools will cover this. On Ubuntu, `apt-get install build-essential` will install the required packages. Similar commands should work on other Linux distros. Windows will require some additional steps, see the [`node-gyp` installation instructions](https://github.com/nodejs/node-gyp#installation) for details. <ide> * You are familiar with `npm` and know whether or not you need to use `sudo` when installing packages globally. <ide> * You are familiar with `git`. <ide>
1
Python
Python
improve environment variables in gcs system test
9d9ef1addc44bb1553cf392f598366fd241c05c4
<ide><path>tests/providers/google/cloud/operators/test_gcs_system_helper.py <ide> # under the License. <ide> import os <ide> <add>from airflow.providers.google.cloud.example_dags.example_gcs import ( <add> BUCKET_1, <add> BUCKET_2, <add> PATH_TO_SAVED_FILE, <add> PATH_TO_TRANSFORM_SCRIPT, <add> PATH_TO_UPLOAD_FILE, <add>) <ide> from tests.test_utils.logging_command_executor import LoggingCommandExecutor <ide> <del>BUCKET_1 = os.environ.get("GCP_GCS_BUCKET_1", "test-gcs-example-bucket") <del>BUCKET_2 = os.environ.get("GCP_GCS_BUCKET_1", "test-gcs-example-bucket-2") <del> <del>PATH_TO_UPLOAD_FILE = os.environ.get("GCP_GCS_PATH_TO_UPLOAD_FILE", "test-gcs-example.txt") <del>PATH_TO_SAVED_FILE = os.environ.get("GCP_GCS_PATH_TO_SAVED_FILE", "test-gcs-example-download.txt") <del>PATH_TO_TRANSFORM_SCRIPT = os.environ.get('GCP_GCS_PATH_TO_TRANSFORM_SCRIPT', 'test.py') <del> <ide> <ide> class GcsSystemTestHelper(LoggingCommandExecutor): <ide> @staticmethod
1
Mixed
Ruby
apply default scope when joining associations
55193e449a377c448e43d8fec42899ea1ff93b27
<ide><path>activerecord/CHANGELOG.md <add>* Apply default scope when joining associations. For example: <add> <add> class Post < ActiveRecord::Base <add> default_scope -> { where published: true } <add> end <add> <add> class Comment <add> belongs_to :post <add> end <add> <add> When calling `Comment.joins(:post)`, we expect to receive only <add> comments on published posts, since that is the default scope for <add> posts. <add> <add> Before this change, the default scope from `Post` was not applied, <add> so we'd get comments on unpublished posts. <add> <add> *Jon Leighton* <add> <ide> * Remove `activerecord-deprecated_finders` as a dependency <ide> <ide> *Łukasz Strzałkowski* <ide><path>activerecord/lib/active_record/associations/join_dependency/join_association.rb <ide> def join_to(manager) <ide> ] <ide> end <ide> <add> scope_chain_items += [reflection.klass.send(:build_default_scope)].compact <add> <ide> constraint = scope_chain_items.inject(constraint) do |chain, item| <ide> unless item.is_a?(Relation) <ide> item = ActiveRecord::Relation.new(reflection.klass, table).instance_exec(self, &item) <ide><path>activerecord/test/cases/associations/inner_join_association_test.rb <ide> def test_find_with_conditions_on_through_reflection <ide> assert !posts(:welcome).tags.empty? <ide> assert Post.joins(:misc_tags).where(:id => posts(:welcome).id).empty? <ide> end <add> <add> test "the default scope of the target is applied when joining associations" do <add> author = Author.create! name: "Jon" <add> author.categorizations.create! <add> author.categorizations.create! special: true <add> <add> assert_equal [author], Author.where(id: author).joins(:special_categorizations) <add> end <ide> end
3
Text
Text
add ref to option to enable n-api
7d9dfdaea3aff33535167f528115115543430f2f
<ide><path>doc/api/n-api.md <ide> For example: <ide> #include <node_api.h> <ide> ``` <ide> <add>As the feature is experimental it must be enabled with the <add>following command line <add>[option](https://nodejs.org/dist/latest-v8.x/docs/api/cli.html#cli_napi_modules): <add> <add>```bash <add>--napi-modules <add>``` <add> <ide> ## Basic N-API Data Types <ide> <ide> N-API exposes the following fundamental datatypes as abstractions that are
1
PHP
PHP
move the authorize middleware into auth
a2c879a8e89fc2f0de989dfd5d0dac32b3a3db38
<add><path>src/Illuminate/Auth/Middleware/Authorize.php <del><path>src/Illuminate/Foundation/Http/Middleware/Authorize.php <ide> <?php <ide> <del>namespace Illuminate\Foundation\Http\Middleware; <add>namespace Illuminate\Auth\Middleware; <ide> <ide> use Closure; <ide> use Illuminate\Contracts\Auth\Access\Gate; <del>use Illuminate\Contracts\Auth\Factory as AuthFactory; <add>use Illuminate\Contracts\Auth\Factory as Auth; <ide> <ide> class Authorize <ide> { <ide> class Authorize <ide> * @param \Illuminate\Contracts\Auth\Access\Gate $gate <ide> * @return void <ide> */ <del> public function __construct(AuthFactory $auth, Gate $gate) <add> public function __construct(Auth $auth, Gate $gate) <ide> { <ide> $this->auth = $auth; <ide> $this->gate = $gate; <add><path>tests/Auth/AuthorizeMiddlewareTest.php <del><path>tests/Foundation/FoundationAuthorizeMiddlewareTest.php <ide> use Illuminate\Auth\Access\Gate; <ide> use Illuminate\Events\Dispatcher; <ide> use Illuminate\Container\Container; <add>use Illuminate\Auth\Middleware\Authorize; <ide> use Illuminate\Contracts\Routing\Registrar; <ide> use Illuminate\Contracts\Auth\Factory as Auth; <ide> use Illuminate\Auth\Access\AuthorizationException; <del>use Illuminate\Foundation\Http\Middleware\Authorize; <ide> use Illuminate\Routing\Middleware\SubstituteBindings; <ide> use Illuminate\Contracts\Auth\Access\Gate as GateContract; <ide> <del>class FoundationAuthorizeMiddlewareTest extends PHPUnit_Framework_TestCase <add>class AuthorizeMiddlewareTest extends PHPUnit_Framework_TestCase <ide> { <ide> protected $container; <ide> protected $user;
2
Ruby
Ruby
remove dead code
f51439329ba86ae6bbb9c513b03ec4f3eb23ef43
<ide><path>Library/Homebrew/formula_versions.rb <ide> def entry_name <ide> @entry_name ||= f.path.relative_path_from(repository).to_s <ide> end <ide> <del> def each <del> versions = Set.new <del> rev_list do |rev| <del> version = version_at_revision(rev) <del> next if version.nil? <del> yield version, rev if versions.add?(version) <del> end <del> end <del> <del> def repository_path <del> Pathname.pwd == repository ? entry_name : f.path <del> end <del> <ide> def rev_list(branch="HEAD") <ide> repository.cd do <ide> Utils.popen_read("git", "rev-list", "--abbrev-commit", "--remove-empty", branch, "--", entry_name) do |io| <ide> def file_contents_at_revision(rev) <ide> repository.cd { Utils.popen_read("git", "cat-file", "blob", "#{rev}:#{entry_name}") } <ide> end <ide> <del> def version_at_revision(rev) <del> formula_at_revision(rev) { |f| f.version } <del> end <del> <ide> def formula_at_revision(rev) <ide> FileUtils.mktemp(f.name) do <ide> path = Pathname.pwd.join("#{f.name}.rb")
1
Text
Text
add missing api entries on performance
c071bd581ae30585f5326ac0ce1cb0d80007664e
<ide><path>doc/api/perf_hooks.md <ide> added: v8.5.0 <ide> If `name` is not provided, removes all `PerformanceMark` objects from the <ide> Performance Timeline. If `name` is provided, removes only the named mark. <ide> <add>### `performance.clearMeasures([name])` <add> <add><!-- YAML <add>added: v16.7.0 <add>--> <add> <add>* `name` {string} <add> <add>If `name` is not provided, removes all `PerformanceMeasure` objects from the <add>Performance Timeline. If `name` is provided, removes only the named mark. <add> <ide> ### `performance.eventLoopUtilization([utilization1[, utilization2]])` <ide> <ide> <!-- YAML <ide> Passing in a user-defined object instead of the result of a previous call to <ide> `eventLoopUtilization()` will lead to undefined behavior. The return values <ide> are not guaranteed to reflect any correct state of the event loop. <ide> <add>### `performance.getEntries()` <add> <add><!-- YAML <add>added: v16.7.0 <add>--> <add> <add>* Returns: {PerformanceEntry\[]} <add> <add>Returns a list of `PerformanceEntry` objects in chronological order with <add>respect to `performanceEntry.startTime`. If you are only interested in <add>performance entries of certain types or that have certain names, see <add>`performance.getEntriesByType()` and `performance.getEntriesByName()`. <add> <add>### `performance.getEntriesByName(name[, type])` <add> <add><!-- YAML <add>added: v16.7.0 <add>--> <add> <add>* `name` {string} <add>* `type` {string} <add>* Returns: {PerformanceEntry\[]} <add> <add>Returns a list of `PerformanceEntry` objects in chronological order <add>with respect to `performanceEntry.startTime` whose `performanceEntry.name` is <add>equal to `name`, and optionally, whose `performanceEntry.entryType` is equal to <add>`type`. <add> <add>### `performance.getEntriesByType(type)` <add> <add><!-- YAML <add>added: v16.7.0 <add>--> <add> <add>* `type` {string} <add>* Returns: {PerformanceEntry\[]} <add> <add>Returns a list of `PerformanceEntry` objects in chronological order <add>with respect to `performanceEntry.startTime` whose `performanceEntry.entryType` <add>is equal to `type`. <add> <ide> ### `performance.mark([name[, options]])` <ide> <ide> <!-- YAML <ide> Creates a new `PerformanceMark` entry in the Performance Timeline. A <ide> `performanceEntry.duration` is always `0`. Performance marks are used <ide> to mark specific significant moments in the Performance Timeline. <ide> <add>The created `PerformanceMark` entry is put in the global Performance Timeline <add>and can be queried with `performance.getEntries`, <add>`performance.getEntriesByName`, and `performance.getEntriesByType`. When the <add>observation is performed, the entries should be cleared from the global <add>Performance Timeline manually with `performance.clearMarks`. <add> <ide> ### `performance.measure(name[, startMarkOrOptions[, endMark]])` <ide> <ide> <!-- YAML <ide> in the Performance Timeline or any of the timestamp properties provided by the <ide> if no parameter is passed, otherwise if the named `endMark` does not exist, an <ide> error will be thrown. <ide> <add>The created `PerformanceMeasure` entry is put in the global Performance Timeline <add>and can be queried with `performance.getEntries`, <add>`performance.getEntriesByName`, and `performance.getEntriesByType`. When the <add>observation is performed, the entries should be cleared from the global <add>Performance Timeline manually with `performance.clearMeasures`. <add> <ide> ### `performance.nodeTiming` <ide> <ide> <!-- YAML <ide> const wrapped = performance.timerify(someFunction); <ide> <ide> const obs = new PerformanceObserver((list) => { <ide> console.log(list.getEntries()[0].duration); <add> <add> performance.clearMarks(); <add> performance.clearMeasures(); <ide> obs.disconnect(); <ide> }); <ide> obs.observe({ entryTypes: ['function'] }); <ide> const { <ide> <ide> const obs = new PerformanceObserver((list, observer) => { <ide> console.log(list.getEntries()); <add> <add> performance.clearMarks(); <add> performance.clearMeasures(); <ide> observer.disconnect(); <ide> }); <ide> obs.observe({ entryTypes: ['mark'], buffered: true }); <ide> const obs = new PerformanceObserver((perfObserverList, observer) => { <ide> * } <ide> * ] <ide> */ <add> <add> performance.clearMarks(); <add> performance.clearMeasures(); <ide> observer.disconnect(); <ide> }); <ide> obs.observe({ type: 'mark' }); <ide> const obs = new PerformanceObserver((perfObserverList, observer) => { <ide> * ] <ide> */ <ide> console.log(perfObserverList.getEntriesByName('test', 'measure')); // [] <add> <add> performance.clearMarks(); <add> performance.clearMeasures(); <ide> observer.disconnect(); <ide> }); <ide> obs.observe({ entryTypes: ['mark', 'measure'] }); <ide> const obs = new PerformanceObserver((perfObserverList, observer) => { <ide> * } <ide> * ] <ide> */ <add> performance.clearMarks(); <add> performance.clearMeasures(); <ide> observer.disconnect(); <ide> }); <ide> obs.observe({ type: 'mark' }); <ide> hook.enable(); <ide> const obs = new PerformanceObserver((list, observer) => { <ide> console.log(list.getEntries()[0]); <ide> performance.clearMarks(); <add> performance.clearMeasures(); <ide> observer.disconnect(); <ide> }); <ide> obs.observe({ entryTypes: ['measure'], buffered: true }); <ide> const obs = new PerformanceObserver((list) => { <ide> entries.forEach((entry) => { <ide> console.log(`require('${entry[0]}')`, entry.duration); <ide> }); <add> performance.clearMarks(); <add> performance.clearMeasures(); <ide> obs.disconnect(); <ide> }); <ide> obs.observe({ entryTypes: ['function'], buffered: true });
1
Ruby
Ruby
fix caveats when loading from the api
15cf890ed747babbcc32a1ac9283ea2f56e3a019
<ide><path>Library/Homebrew/formulary.rb <ide> def install <ide> <ide> @caveats_string = json_formula["caveats"] <ide> def caveats <del> @caveats_string <add> self.class.instance_variable_get(:@caveats_string) <ide> end <ide> end <ide> <ide><path>Library/Homebrew/test/formulary_spec.rb <ide> def formula_json_contents(extra_items = {}) <ide> "recommended_dependencies" => ["recommended_dep"], <ide> "optional_dependencies" => ["optional_dep"], <ide> "uses_from_macos" => ["uses_from_macos_dep"], <del> "caveats" => "", <add> "caveats" => "example caveat string", <ide> }.merge(extra_items), <ide> } <ide> end <ide> def formula_json_contents(extra_items = {}) <ide> expect(formula.deps.count).to eq 5 <ide> end <ide> expect(formula.uses_from_macos_elements).to eq ["uses_from_macos_dep"] <add> expect(formula.caveats).to eq "example caveat string" <ide> expect { <ide> formula.install <ide> }.to raise_error("Cannot build from source from abstract formula.")
2
Java
Java
add messaging.simp.user package
307bf4bede299bdc95a99f68ae51fd076d5cdca9
<ide><path>spring-messaging/src/main/java/org/springframework/messaging/simp/SimpMessagingTemplate.java <ide> public SimpMessagingTemplate(MessageChannel messageChannel) { <ide> /** <ide> * Configure the prefix to use for destinations targeting a specific user. <ide> * <p>The default value is "/user/". <del> * @see org.springframework.messaging.simp.handler.UserDestinationMessageHandler <add> * @see org.springframework.messaging.simp.user.UserDestinationMessageHandler <ide> */ <ide> public void setUserDestinationPrefix(String prefix) { <ide> Assert.notNull(prefix, "UserDestinationPrefix must not be null"); <ide><path>spring-messaging/src/main/java/org/springframework/messaging/simp/annotation/SendToUser.java <ide> * @author Rossen Stoyanchev <ide> * @since 4.0 <ide> * @see org.springframework.messaging.handler.annotation.SendTo <del> * @see org.springframework.messaging.simp.handler.UserDestinationMessageHandler <add> * @see org.springframework.messaging.simp.user.UserDestinationMessageHandler <ide> */ <ide> @Target(ElementType.METHOD) <ide> @Retention(RetentionPolicy.RUNTIME) <ide><path>spring-messaging/src/main/java/org/springframework/messaging/simp/annotation/package-info.java <ide> /** <del> * Annotations and for handling messages from simple messaging protocols <del> * (like STOMP). <add> * Annotations and for handling messages from SImple Messaging Protocols such as STOMP. <ide> */ <ide> package org.springframework.messaging.simp.annotation; <ide><path>spring-messaging/src/main/java/org/springframework/messaging/simp/broker/AbstractSubscriptionRegistry.java <ide> import org.springframework.util.MultiValueMap; <ide> <ide> /** <add> * Abstract base class for implementations of {@link SubscriptionRegistry} that <add> * looks up information in messages but delegates to abstract methods for the <add> * actual storage and retrieval. <add> * <ide> * @author Rossen Stoyanchev <ide> * @since 4.0 <ide> */ <ide><path>spring-messaging/src/main/java/org/springframework/messaging/simp/broker/DefaultSubscriptionRegistry.java <ide> import org.springframework.util.MultiValueMap; <ide> <ide> /** <add> * A default, simple in-memory implementation of {@link SubscriptionRegistry}. <add> * <ide> * @author Rossen Stoyanchev <ide> * @since 4.0 <ide> */ <ide><path>spring-messaging/src/main/java/org/springframework/messaging/simp/config/AbstractMessageBrokerConfiguration.java <ide> import org.springframework.messaging.simp.SimpMessagingTemplate; <ide> import org.springframework.messaging.simp.annotation.support.SimpAnnotationMethodMessageHandler; <ide> import org.springframework.messaging.simp.broker.AbstractBrokerMessageHandler; <del>import org.springframework.messaging.simp.handler.DefaultUserDestinationResolver; <del>import org.springframework.messaging.simp.handler.DefaultUserSessionRegistry; <add>import org.springframework.messaging.simp.user.DefaultUserDestinationResolver; <add>import org.springframework.messaging.simp.user.DefaultUserSessionRegistry; <ide> import org.springframework.messaging.simp.broker.SimpleBrokerMessageHandler; <del>import org.springframework.messaging.simp.handler.UserDestinationMessageHandler; <del>import org.springframework.messaging.simp.handler.UserDestinationResolver; <del>import org.springframework.messaging.simp.handler.UserSessionRegistry; <add>import org.springframework.messaging.simp.user.UserDestinationMessageHandler; <add>import org.springframework.messaging.simp.user.UserDestinationResolver; <add>import org.springframework.messaging.simp.user.UserSessionRegistry; <ide> import org.springframework.messaging.support.AbstractSubscribableChannel; <ide> import org.springframework.messaging.support.ExecutorSubscribableChannel; <ide> import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; <ide><path>spring-messaging/src/main/java/org/springframework/messaging/simp/package-info.java <ide> /** <del> * Generic support for SImple Messaging Protocols such as STOMP. <add> * Generic support for SImple Messaging Protocols including protocols such as STOMP. <ide> */ <ide> package org.springframework.messaging.simp; <add><path>spring-messaging/src/main/java/org/springframework/messaging/simp/user/DefaultUserDestinationResolver.java <del><path>spring-messaging/src/main/java/org/springframework/messaging/simp/handler/DefaultUserDestinationResolver.java <ide> * limitations under the License. <ide> */ <ide> <del>package org.springframework.messaging.simp.handler; <add>package org.springframework.messaging.simp.user; <ide> <ide> import org.apache.commons.logging.Log; <ide> import org.apache.commons.logging.LogFactory; <add><path>spring-messaging/src/main/java/org/springframework/messaging/simp/user/DefaultUserSessionRegistry.java <del><path>spring-messaging/src/main/java/org/springframework/messaging/simp/handler/DefaultUserSessionRegistry.java <ide> * limitations under the License. <ide> */ <ide> <del>package org.springframework.messaging.simp.handler; <add>package org.springframework.messaging.simp.user; <ide> <ide> import org.springframework.util.Assert; <ide> <add><path>spring-messaging/src/main/java/org/springframework/messaging/simp/user/UserDestinationMessageHandler.java <del><path>spring-messaging/src/main/java/org/springframework/messaging/simp/handler/UserDestinationMessageHandler.java <ide> * limitations under the License. <ide> */ <ide> <del>package org.springframework.messaging.simp.handler; <add>package org.springframework.messaging.simp.user; <ide> <ide> import java.util.Set; <ide> <add><path>spring-messaging/src/main/java/org/springframework/messaging/simp/user/UserDestinationResolver.java <del><path>spring-messaging/src/main/java/org/springframework/messaging/simp/handler/UserDestinationResolver.java <ide> * limitations under the License. <ide> */ <ide> <del>package org.springframework.messaging.simp.handler; <add>package org.springframework.messaging.simp.user; <ide> <ide> import org.springframework.messaging.Message; <ide> <add><path>spring-messaging/src/main/java/org/springframework/messaging/simp/user/UserSessionRegistry.java <del><path>spring-messaging/src/main/java/org/springframework/messaging/simp/handler/UserSessionRegistry.java <del>package org.springframework.messaging.simp.handler; <add>package org.springframework.messaging.simp.user; <ide> <ide> import java.util.Set; <ide> <ide><path>spring-messaging/src/main/java/org/springframework/messaging/simp/user/package-info.java <add>/** <add> * Support for handling messages to "user" destinations (i.e. destinations that are <add> * unique to a user's sessions), primarily translating the destinations and then <add> * forwarding the updated message to the broker. <add> * <p> <add> * Also included is {@link org.springframework.messaging.simp.user.UserSessionRegistry} <add> * for keeping track of connected user sessions. <add> */ <add>package org.springframework.messaging.simp.user; <add><path>spring-messaging/src/test/java/org/springframework/messaging/simp/annotation/support/SimpAnnotationMethodMessageHandlerTests.java <del><path>spring-messaging/src/test/java/org/springframework/messaging/simp/handler/SimpAnnotationMethodMessageHandlerTests.java <ide> * limitations under the License. <ide> */ <ide> <del>package org.springframework.messaging.simp.handler; <add>package org.springframework.messaging.simp.annotation.support; <ide> <ide> import java.util.LinkedHashMap; <ide> import java.util.Map; <ide><path>spring-messaging/src/test/java/org/springframework/messaging/simp/config/MessageBrokerConfigurationTests.java <ide> import org.springframework.messaging.simp.annotation.SubscribeMapping; <ide> import org.springframework.messaging.simp.annotation.support.SimpAnnotationMethodMessageHandler; <ide> import org.springframework.messaging.simp.broker.SimpleBrokerMessageHandler; <del>import org.springframework.messaging.simp.handler.UserDestinationMessageHandler; <del>import org.springframework.messaging.simp.handler.UserSessionRegistry; <add>import org.springframework.messaging.simp.user.UserDestinationMessageHandler; <add>import org.springframework.messaging.simp.user.UserSessionRegistry; <ide> import org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler; <ide> import org.springframework.messaging.simp.stomp.StompCommand; <ide> import org.springframework.messaging.simp.stomp.StompHeaderAccessor; <add><path>spring-messaging/src/test/java/org/springframework/messaging/simp/user/DefaultUserDestinationResolverTests.java <del><path>spring-messaging/src/test/java/org/springframework/messaging/simp/handler/DefaultUserDestinationResolverTests.java <ide> * limitations under the License. <ide> */ <ide> <del>package org.springframework.messaging.simp.handler; <add>package org.springframework.messaging.simp.user; <ide> <ide> import org.junit.Before; <ide> import org.junit.Test; <ide> import org.springframework.messaging.Message; <ide> import org.springframework.messaging.simp.SimpMessageHeaderAccessor; <ide> import org.springframework.messaging.simp.SimpMessageType; <ide> import org.springframework.messaging.simp.TestPrincipal; <add>import org.springframework.messaging.simp.user.DefaultUserDestinationResolver; <add>import org.springframework.messaging.simp.user.DefaultUserSessionRegistry; <add>import org.springframework.messaging.simp.user.UserSessionRegistry; <ide> import org.springframework.messaging.support.MessageBuilder; <ide> <ide> import java.util.Set; <ide> <ide> import static org.junit.Assert.assertEquals; <ide> <ide> /** <del> * Unit tests for {@link DefaultUserDestinationResolver}. <add> * Unit tests for {@link org.springframework.messaging.simp.user.DefaultUserDestinationResolver}. <ide> */ <ide> public class DefaultUserDestinationResolverTests { <ide> <add><path>spring-messaging/src/test/java/org/springframework/messaging/simp/user/DefaultUserSessionRegistryTests.java <del><path>spring-messaging/src/test/java/org/springframework/messaging/simp/handler/DefaultUserSessionRegistryTests.java <ide> * limitations under the License. <ide> */ <ide> <del>package org.springframework.messaging.simp.handler; <add>package org.springframework.messaging.simp.user; <ide> <ide> import java.util.Arrays; <ide> import java.util.Collections; <ide> import java.util.LinkedHashSet; <ide> import java.util.List; <ide> <ide> import org.junit.Test; <add>import org.springframework.messaging.simp.user.DefaultUserSessionRegistry; <ide> <ide> import static org.junit.Assert.*; <ide> <ide> /** <del> * Test fixture for {@link DefaultUserSessionRegistry} <add> * Test fixture for {@link org.springframework.messaging.simp.user.DefaultUserSessionRegistry} <ide> * <ide> * @author Rossen Stoyanchev <ide> * @since 4.0 <add><path>spring-messaging/src/test/java/org/springframework/messaging/simp/user/UserDestinationMessageHandlerTests.java <del><path>spring-messaging/src/test/java/org/springframework/messaging/simp/handler/UserDestinationMessageHandlerTests.java <ide> * limitations under the License. <ide> */ <ide> <del>package org.springframework.messaging.simp.handler; <add>package org.springframework.messaging.simp.user; <ide> <ide> import org.junit.Before; <ide> import org.junit.Test; <ide> import org.springframework.messaging.simp.SimpMessageHeaderAccessor; <ide> import org.springframework.messaging.simp.SimpMessageType; <ide> import org.springframework.messaging.simp.TestPrincipal; <add>import org.springframework.messaging.simp.user.DefaultUserDestinationResolver; <add>import org.springframework.messaging.simp.user.DefaultUserSessionRegistry; <add>import org.springframework.messaging.simp.user.UserDestinationMessageHandler; <add>import org.springframework.messaging.simp.user.UserSessionRegistry; <ide> import org.springframework.messaging.support.MessageBuilder; <ide> <ide> import static org.junit.Assert.assertEquals; <ide> import static org.mockito.Mockito.*; <ide> <ide> /** <del> * Unit tests for {@link UserDestinationMessageHandler}. <add> * Unit tests for {@link org.springframework.messaging.simp.user.UserDestinationMessageHandler}. <ide> */ <ide> public class UserDestinationMessageHandlerTests { <ide> <ide><path>spring-websocket/src/main/java/org/springframework/web/socket/config/MessageBrokerBeanDefinitionParser.java <ide> import org.springframework.messaging.converter.StringMessageConverter; <ide> import org.springframework.messaging.simp.SimpMessagingTemplate; <ide> import org.springframework.messaging.simp.annotation.support.SimpAnnotationMethodMessageHandler; <del>import org.springframework.messaging.simp.handler.DefaultUserDestinationResolver; <del>import org.springframework.messaging.simp.handler.DefaultUserSessionRegistry; <add>import org.springframework.messaging.simp.user.DefaultUserDestinationResolver; <add>import org.springframework.messaging.simp.user.DefaultUserSessionRegistry; <ide> import org.springframework.messaging.simp.broker.SimpleBrokerMessageHandler; <del>import org.springframework.messaging.simp.handler.UserDestinationMessageHandler; <add>import org.springframework.messaging.simp.user.UserDestinationMessageHandler; <ide> import org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler; <ide> import org.springframework.messaging.support.ExecutorSubscribableChannel; <ide> import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; <ide><path>spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/WebMvcStompEndpointRegistry.java <ide> import java.util.List; <ide> import java.util.Map; <ide> <del>import org.springframework.messaging.simp.handler.UserSessionRegistry; <add>import org.springframework.messaging.simp.user.UserSessionRegistry; <ide> import org.springframework.scheduling.TaskScheduler; <ide> import org.springframework.util.Assert; <ide> import org.springframework.util.MultiValueMap; <ide><path>spring-websocket/src/main/java/org/springframework/web/socket/messaging/StompSubProtocolHandler.java <ide> import org.springframework.messaging.Message; <ide> import org.springframework.messaging.MessageChannel; <ide> import org.springframework.messaging.simp.SimpMessageType; <del>import org.springframework.messaging.simp.handler.UserSessionRegistry; <add>import org.springframework.messaging.simp.user.UserSessionRegistry; <ide> import org.springframework.messaging.simp.stomp.*; <ide> import org.springframework.messaging.support.MessageBuilder; <ide> import org.springframework.util.Assert; <ide> public class StompSubProtocolHandler implements SubProtocolHandler { <ide> <ide> /** <ide> * Provide a registry with which to register active user session ids. <del> * @see org.springframework.messaging.simp.handler.UserDestinationMessageHandler <add> * @see org.springframework.messaging.simp.user.UserDestinationMessageHandler <ide> */ <ide> public void setUserSessionRegistry(UserSessionRegistry registry) { <ide> this.userSessionRegistry = registry; <ide><path>spring-websocket/src/test/java/org/springframework/web/socket/config/MessageBrokerBeanDefinitionParserTests.java <ide> import org.springframework.messaging.converter.MessageConverter; <ide> import org.springframework.messaging.simp.SimpMessagingTemplate; <ide> import org.springframework.messaging.simp.annotation.support.SimpAnnotationMethodMessageHandler; <del>import org.springframework.messaging.simp.handler.DefaultUserDestinationResolver; <add>import org.springframework.messaging.simp.user.DefaultUserDestinationResolver; <ide> import org.springframework.messaging.simp.broker.SimpleBrokerMessageHandler; <del>import org.springframework.messaging.simp.handler.UserDestinationMessageHandler; <del>import org.springframework.messaging.simp.handler.UserDestinationResolver; <del>import org.springframework.messaging.simp.handler.UserSessionRegistry; <add>import org.springframework.messaging.simp.user.UserDestinationMessageHandler; <add>import org.springframework.messaging.simp.user.UserDestinationResolver; <add>import org.springframework.messaging.simp.user.UserSessionRegistry; <ide> import org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler; <ide> import org.springframework.messaging.support.AbstractSubscribableChannel; <ide> import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; <ide><path>spring-websocket/src/test/java/org/springframework/web/socket/config/annotation/WebMvcStompEndpointRegistryTests.java <ide> <ide> import org.springframework.messaging.MessageChannel; <ide> import org.springframework.messaging.SubscribableChannel; <del>import org.springframework.messaging.simp.handler.DefaultUserSessionRegistry; <del>import org.springframework.messaging.simp.handler.UserSessionRegistry; <add>import org.springframework.messaging.simp.user.DefaultUserSessionRegistry; <add>import org.springframework.messaging.simp.user.UserSessionRegistry; <ide> import org.springframework.scheduling.TaskScheduler; <ide> import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping; <del>import org.springframework.web.socket.config.annotation.WebMvcStompEndpointRegistry; <ide> import org.springframework.web.socket.messaging.StompSubProtocolHandler; <ide> import org.springframework.web.socket.messaging.SubProtocolHandler; <ide> import org.springframework.web.socket.messaging.SubProtocolWebSocketHandler;
23
Text
Text
add v3.28.0-beta.2 to changelog.md
455fdb2d8d3f3f7941169468c48fe19985aedc32
<ide><path>CHANGELOG.md <ide> # Ember Changelog <ide> <add>### v3.28.0-beta.2 (May 27, 2021) <add> <add>- [#19511](https://github.com/emberjs/ember.js/pull/19511) / [#19548](https://github.com/emberjs/ember.js/pull/19548) [BUGFIX] Makes the (hash) helper lazy <add>- [#19530](https://github.com/emberjs/ember.js/pull/19530) [DOC] fix passing params to named blocks examples <add>- [#19536](https://github.com/emberjs/ember.js/pull/19536) [BUGFIX] Fix `computed.*` deprecation message to include the correct import path <add>- [#19544](https://github.com/emberjs/ember.js/pull/19544) [BUGFIX] Use explicit this in helper test blueprints <add>- [#19555](https://github.com/emberjs/ember.js/pull/19555) [BUGFIX] Improve class based tranform deprecation message <add>- [#19557](https://github.com/emberjs/ember.js/pull/19557) [BUGFIX] Refine Ember Global deprecation message <add>- [#19564](https://github.com/emberjs/ember.js/pull/19564) [BUGFIX] Improve computed.* and run.* deprecation message (IE11) <add>- [#19491](https://github.com/emberjs/ember.js/pull/19491) [BUGFIX] Fix `owner.lookup` `owner.register` behavior with `singleton: true` option <add> <ide> ### v3.28.0-beta.1 (May 3, 2021) <ide> <ide> - [#19472](https://github.com/emberjs/ember.js/pull/19472) [BUGFIX] Prevent transformation of block params called `attrs`
1
PHP
PHP
add test for
886d51e1fda637e78e1f5f23f16a66bafa3040c8
<ide><path>tests/TestCase/ORM/QueryTest.php <ide> public function testContainWithClosure(): void <ide> * Integration test that uses the contain signature that is the same as the <ide> * matching signature <ide> */ <del> public function testContainSecondSignature(): void <add> public function testContainClosureSignature(): void <ide> { <ide> $table = $this->getTableLocator()->get('authors'); <ide> $table->hasMany('articles'); <ide> public function testContainSecondSignature(): void <ide> $this->assertEquals([1], array_unique($ids)); <ide> } <ide> <add> public function testContainAutoFields(): void <add> { <add> $table = $this->getTableLocator()->get('authors'); <add> $table->hasMany('articles'); <add> $query = new Query($this->connection, $table); <add> $query <add> ->select() <add> ->contain('articles', function ($q) { <add> return $q->select(['test' => '(SELECT 20)']) <add> ->enableAutoFields(true); <add> }); <add> $results = $query->toArray(); <add> $this->assertNotEmpty($results); <add> } <add> <ide> /** <ide> * Integration test to ensure that filtering associations with the queryBuilder <ide> * option works.
1
Text
Text
update changelog for 15.3.1
9af8be654bebe800c49871f2c7ad33b673113a3b
<ide><path>CHANGELOG.md <add>## 15.3.1 (August 19, 2016) <add> <add>### React <add> <add>- Improve performance of development builds in various ways. ([@gaearon](https://github.com/gaearon) in [#7461](https://github.com/facebook/react/pull/7461), [#7463](https://github.com/facebook/react/pull/7463), [#7483](https://github.com/facebook/react/pull/7483), [#7488](https://github.com/facebook/react/pull/7488), [#7491](https://github.com/facebook/react/pull/7491), [#7510](https://github.com/facebook/react/pull/7510)) <add>- Cleanup internal hooks to improve performance of development builds. ([@gaearon](https://github.com/gaearon) in [#7464](https://github.com/facebook/react/pull/7464), [#7472](https://github.com/facebook/react/pull/7472), [#7481](https://github.com/facebook/react/pull/7481), [#7496](https://github.com/facebook/react/pull/7496)) <add>- Upgrade fbjs to pick up another performance improvement from [@gaearon](https://github.com/gaearon) for development builds. ([@zpao](https://github.com/zpao) in [#7532](https://github.com/facebook/react/pull/7532)) <add>- Improve startup time of React in Node. ([@zertosh](https://github.com/zertosh) in [#7493](https://github.com/facebook/react/pull/7493)) <add>- Improve error message of `React.Children.only`. ([@spicyj](https://github.com/spicyj) in [#7514](https://github.com/facebook/react/pull/7514)) <add> <add>### React DOM <add>- Avoid `<input>` validation warning from browsers when changing `type`. ([@nhunzaker](https://github.com/nhunzaker) in [#7333](https://github.com/facebook/react/pull/7333)) <add>- Avoid "Member not found" exception in IE10 when calling `stopPropagation()` in Synthetic Events. ([@nhunzaker](https://github.com/nhunzaker) in [#7343](https://github.com/facebook/react/pull/7343)) <add>- Fix issue resulting in inability to update some `<input>` elements in mobile browsers. ([@keyanzhang](https://github.com/keyanzhang) in [#7397](https://github.com/facebook/react/pull/7397)) <add>- Fix memory leak in server rendering. ([@keyanzhang](https://github.com/keyanzhang) in [#7410](https://github.com/facebook/react/pull/7410)) <add>- Fix issue resulting in `<input type="range">` values not updating when changing `min` or `max`. ([@troydemonbreun](https://github.com/troydemonbreun) in [#7486](https://github.com/facebook/react/pull/7486)) <add>- Add new warning for rare case of attempting to unmount a container owned by a different copy of React. ([@ventuno](https://github.com/ventuno) in [#7456](https://github.com/facebook/react/pull/7456)) <add> <add>### React Test Renderer <add>- Fix ReactTestInstance::toJSON() with empty top-level components. ([@Morhaus](https://github.com/Morhaus) in [#7523](https://github.com/facebook/react/pull/7523)) <add> <add>### React Native Renderer <add>- Change `trackedTouchCount` invariant into a console.error for better reliability. ([@yungsters](https://github.com/yungsters) in [#7400](https://github.com/facebook/react/pull/7400)) <add> <add> <ide> ## 15.3.0 (July 29, 2016) <ide> <ide> ### React
1
Ruby
Ruby
list the major frameworks you can remove together
7956d4014b8f0862721cf274c600ef81dcc0a484
<ide><path>railties/lib/rails/generators/app_base.rb <ide> def self.add_shared_options_for(name) <ide> class_option :skip_active_record, type: :boolean, aliases: '-O', default: false, <ide> desc: 'Skip Active Record files' <ide> <add> class_option :skip_action_cable, type: :boolean, aliases: '-C', default: false, <add> desc: 'Skip Action Cable files' <add> <ide> class_option :skip_sprockets, type: :boolean, aliases: '-S', default: false, <ide> desc: 'Skip Sprockets files' <ide> <ide> class_option :skip_spring, type: :boolean, default: false, <ide> desc: "Don't install Spring application preloader" <ide> <del> class_option :skip_action_cable, type: :boolean, aliases: '-C', default: false, <del> desc: 'Skip Action Cable files' <del> <ide> class_option :database, type: :string, aliases: '-d', default: 'sqlite3', <ide> desc: "Preconfigure for selected database (options: #{DATABASES.join('/')})" <ide>
1
Javascript
Javascript
register default container on fallback registry
93ef88ff323bed9103a25df93cd35f8acf54e986
<ide><path>packages/container/lib/registry.js <ide> Registry.prototype = { <ide> container: function(options) { <ide> var container = new Container(this, options); <ide> <del> // Allow deprecated access to the first child container's `lookup` and <del> // `lookupFactory` methods to avoid breaking compatibility for Ember 1.x <del> // initializers. <add> // 2.0TODO - remove `registerContainer` <add> this.registerContainer(container); <add> <add> return container; <add> }, <add> <add> /** <add> Register the first container created for a registery to allow deprecated <add> access to its `lookup` and `lookupFactory` methods to avoid breaking <add> compatibility for Ember 1.x initializers. <add> <add> 2.0TODO: Remove this method. The bookkeeping is only needed to support <add> deprecated behavior. <add> <add> @param {Container} newly created container <add> */ <add> registerContainer: function(container) { <ide> if (!this._defaultContainer) { <ide> this._defaultContainer = container; <ide> } <del> <del> return container; <add> if (this.fallback) { <add> this.fallback.registerContainer(container); <add> } <ide> }, <ide> <ide> lookup: function(fullName, options) {
1
Text
Text
fix plugins links
c2cf349bcd3a32a01da6db83700613fc9c10e12a
<ide><path>docs/extend/index.md <ide> weight = 6 <ide> <ide> Currently, you can extend Docker by adding a plugin. This section contains the following topics: <ide> <del>* [Understand Docker plugins](plugins.md) <del>* [Write a volume plugin](plugins_volumes.md) <del>* [Docker plugin API](plugin_api.md) <del> <del> <ide>\ No newline at end of file <add>* [Understand Docker plugins](/extend/plugins) <add>* [Write a volume plugin](/extend/plugins_volume) <add>* [Docker plugin API](/extend/plugin_api) <ide><path>docs/extend/plugin_api.md <ide> Docker Engine. <ide> <ide> This page is intended for people who want to develop their own Docker plugin. <ide> If you just want to learn about or use Docker plugins, look <del>[here](plugins.md). <add>[here](/extend/plugins). <ide> <ide> ## What plugins are <ide> <ide><path>docs/extend/plugins.md <ide> plugins. <ide> ## Types of plugins <ide> <ide> Plugins extend Docker's functionality. They come in specific types. For <del>example, a [volume plugin](plugins_volume.md) might enable Docker <add>example, a [volume plugin](/extend/plugins_volume) might enable Docker <ide> volumes to persist across multiple Docker hosts. <ide> <ide> Currently Docker supports volume and network driver plugins. In the future it <ide> of the plugin for help. The Docker team may not be able to assist you. <ide> ## Writing a plugin <ide> <ide> If you are interested in writing a plugin for Docker, or seeing how they work <del>under the hood, see the [docker plugins reference](plugin_api.md). <add>under the hood, see the [docker plugins reference](/extend/plugin_api). <ide><path>docs/extend/plugins_volume.md <ide> parent = "mn_extend" <ide> <ide> Docker volume plugins enable Docker deployments to be integrated with external <ide> storage systems, such as Amazon EBS, and enable data volumes to persist beyond <del>the lifetime of a single Docker host. See the [plugin documentation](plugins.md) <add>the lifetime of a single Docker host. See the [plugin documentation](/extend/plugins) <ide> for more information. <ide> <ide> # Command-line changes
4
Text
Text
update jsfiddle with working cdn
bf1b3f8f1c8cf265c9e47e5d45ef17b2f8c5b502
<ide><path>README.md <ide> function animate() { <ide> } <ide> ``` <ide> <del>If everything went well you should see [this](https://jsfiddle.net/f2Lommf5/). <add>If everything went well you should see [this](https://jsfiddle.net/3hkq1L4s/). <ide> <ide> ### Change log ### <ide>
1
Python
Python
update head pruning
e4b46d86ce0cbcbc9011375add7f3713eb5ef967
<ide><path>examples/bertology.py <ide> def compute_heads_importance(args, model, eval_dataloader, compute_entropy=True, <ide> # Normalize <ide> attn_entropy /= tot_tokens <ide> head_importance /= tot_tokens <del> if args.normalize_importance: <add> # Layerwise importance normalization <add> if not args.dont_normalize_importance_by_layer: <add> exponent = 2 <add> norm_by_layer = torch.pow(torch.pow(head_importance, exponent).sum(-1), 1/exponent) <add> head_importance /= norm_by_layer.unsqueeze(-1) + 1e-20 <add> <add> if not args.dont_normalize_global_importance: <ide> head_importance = (head_importance - head_importance.min()) / (head_importance.max() - head_importance.min()) <ide> <ide> return attn_entropy, head_importance, preds, labels <ide> def run_model(): <ide> parser.add_argument("--data_subset", type=int, default=-1, help="If > 0: limit the data to a subset of data_subset instances.") <ide> parser.add_argument("--overwrite_output_dir", action='store_true', help="Whether to overwrite data in output directory") <ide> <del> parser.add_argument("--normalize_importance", action='store_true', help="Whether to normalize importance score between 0 and 1") <add> parser.add_argument("--dont_normalize_importance_by_layer", action='store_true', help="Don't normalize importance score by layers") <add> parser.add_argument("--dont_normalize_global_importance", action='store_true', help="Don't normalize all importance scores between 0 and 1") <ide> <ide> parser.add_argument("--try_masking", action='store_true', help="Whether to try to mask head until a threshold of accuracy.") <ide> parser.add_argument("--masking_threshold", default=0.9, type=float, help="masking threshold in term of metrics" <ide> def run_model(): <ide> <ide> current_score = original_score <ide> while current_score >= original_score * args.masking_threshold: <del> head_mask = new_head_mask <del> # heads from most important to least <del> heads_to_mask = head_importance.view(-1).sort(descending=True)[1] <del> # keep only not-masked heads <del> heads_to_mask = heads_to_mask[head_mask.view(-1).nonzero()][:, 0] <add> head_mask = new_head_mask # save current head mask <add> # heads from most important to least - keep only not-masked heads <add> head_importance = head_importance.view(-1)[head_mask.view(-1).nonzero()][:, 0] <add> current_heads_to_mask = head_importance.sort()[1] <ide> <del> if len(heads_to_mask) <= num_to_mask: <add> if len(current_heads_to_mask) <= num_to_mask: <ide> break <ide> <ide> # mask heads <del> heads_to_mask = heads_to_mask[-num_to_mask:] <del> logger.info("Heads to mask: %s", str(heads_to_mask.tolist())) <add> current_heads_to_mask = current_heads_to_mask[:num_to_mask] <add> logger.info("Heads to mask: %s", str(current_heads_to_mask.tolist())) <ide> new_head_mask = head_mask.view(-1) <del> new_head_mask[heads_to_mask] = 0.0 <del> new_head_mask = new_head_mask.view_as(head_importance) <add> new_head_mask[current_heads_to_mask] = 0.0 <add> new_head_mask = new_head_mask.view_as(head_mask) <ide> print_2d_tensor(new_head_mask) <ide> <ide> # Compute metric and head importance again
1
Text
Text
fix typo in linkinglibraries.md
22845b56f099f74cff26b7659c0938c914f06954
<ide><path>docs/LinkingLibraries.md <ide> received. <ide> <ide> For that we need to know the library's headers. To achieve that you have to go <ide> to your project's file, select `Build Settings` and search for `Header Search <del>Paths`. There you should include the path to you library (if it has relevant <add>Paths`. There you should include the path to your library (if it has relevant <ide> files on subdirectories remember to make it `recursive`, like `React` on the <ide> example). <ide>
1
Javascript
Javascript
fix viewport issue in with-react-native-web
c461d46efd16d99db73a0841b2ab4651d8371f0f
<ide><path>examples/with-react-native-web/pages/_document.js <ide> export default class MyDocument extends Document { <ide> <html style={{ height: '100%', width: '100%' }}> <ide> <Head> <ide> <title>react-native-web</title> <add> <meta name='viewport' content='width=device-width, initial-scale=1' /> <ide> </Head> <ide> <body style={{ height: '100%', width: '100%', overflowY: 'scroll' }}> <ide> <Main />
1