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
PHP
PHP
add option for null queue driver
91679d34f89876ef2d41719b87d584bdfdeea099
<ide><path>src/Illuminate/Queue/Connectors/NullConnector.php <add><?php namespace Illuminate\Queue\Connectors; <add> <add>class NullConnector implements ConnectorInterface { <add> <add> /** <add> * Establish a queue connection. <add> * <add> * @param array $config <add> * @return \Illuminate\Contracts\Queue\Queue <add> */ <add> public function connect(array $config) <add> { <add> return new \Illuminate\Queue\NullQueue; <add> } <add> <add>} <ide><path>src/Illuminate/Queue/NullQueue.php <add><?php namespace Illuminate\Queue; <add> <add>use Illuminate\Contracts\Queue\Queue as QueueContract; <add> <add>class NullQueue extends Queue implements QueueContract { <add> <add> /** <add> * Push a new job onto the queue. <add> * <add> * @param string $job <add> * @param mixed $data <add> * @param string $queue <add> * @return mixed <add> */ <add> public function push($job, $data = '', $queue = null) <add> { <add> // <add> } <add> <add> /** <add> * Push a raw payload onto the queue. <add> * <add> * @param string $payload <add> * @param string $queue <add> * @param array $options <add> * @return mixed <add> */ <add> public function pushRaw($payload, $queue = null, array $options = array()) <add> { <add> // <add> } <add> <add> /** <add> * Push a new job onto the queue after a delay. <add> * <add> * @param \DateTime|int $delay <add> * @param string $job <add> * @param mixed $data <add> * @param string $queue <add> * @return mixed <add> */ <add> public function later($delay, $job, $data = '', $queue = null) <add> { <add> // <add> } <add> <add> /** <add> * Pop the next job off of the queue. <add> * <add> * @param string $queue <add> * @return \Illuminate\Contracts\Queue\Job|null <add> */ <add> public function pop($queue = null) <add> { <add> // <add> } <add> <add>} <ide><path>src/Illuminate/Queue/QueueServiceProvider.php <ide> use Illuminate\Queue\Console\RestartCommand; <ide> use Illuminate\Queue\Connectors\SqsConnector; <ide> use Illuminate\Queue\Console\SubscribeCommand; <add>use Illuminate\Queue\Connectors\NullConnector; <ide> use Illuminate\Queue\Connectors\SyncConnector; <ide> use Illuminate\Queue\Connectors\IronConnector; <ide> use Illuminate\Queue\Connectors\RedisConnector; <ide> protected function registerSubscriber() <ide> */ <ide> public function registerConnectors($manager) <ide> { <del> foreach (array('Sync', 'Beanstalkd', 'Redis', 'Sqs', 'Iron') as $connector) <add> foreach (array('Null', 'Sync', 'Beanstalkd', 'Redis', 'Sqs', 'Iron') as $connector) <ide> { <ide> $this->{"register{$connector}Connector"}($manager); <ide> } <ide> } <ide> <add> /** <add> * Register the Null queue connector. <add> * <add> * @param \Illuminate\Queue\QueueManager $manager <add> * @return void <add> */ <add> protected function registerNullConnector($manager) <add> { <add> $manager->addConnector('null', function() <add> { <add> return new NullConnector; <add> }); <add> } <add> <ide> /** <ide> * Register the Sync queue connector. <ide> *
3
Javascript
Javascript
remove cache from array of matrices uniforms
310bd2b38764b33f3c61820b4b7aecef86ad3c74
<ide><path>src/renderers/webgl/WebGLUniforms.js <ide> function setValueV4a( gl, v ) { <ide> <ide> function setValueM2a( gl, v ) { <ide> <del> var cache = this.cache; <ide> var data = flatten( v, this.size, 4 ); <ide> <del> if ( arraysEqual( cache, data ) ) return; <del> <ide> gl.uniformMatrix2fv( this.addr, false, data ); <ide> <del> this.updateCache( data ); <del> <ide> } <ide> <ide> function setValueM3a( gl, v ) { <ide> <del> var cache = this.cache; <ide> var data = flatten( v, this.size, 9 ); <ide> <del> if ( arraysEqual( cache, data ) ) return; <del> <ide> gl.uniformMatrix3fv( this.addr, false, data ); <ide> <del> this.updateCache( data ); <del> <ide> } <ide> <ide> function setValueM4a( gl, v ) { <ide> <del> var cache = this.cache; <ide> var data = flatten( v, this.size, 16 ); <ide> <del> if ( arraysEqual( cache, data ) ) return; <del> <ide> gl.uniformMatrix4fv( this.addr, false, data ); <ide> <del> this.updateCache( data ); <del> <ide> } <ide> <ide> // Array of textures (2D / Cube)
1
Text
Text
replace _wg_ with _team_
fcb46a462635361daa922e9b38a1b7dbda461c8a
<ide><path>doc/guides/adding-new-napi-api.md <ide> N-API API. <ide> * There **should** be at least one test case per interesting use of the API. <ide> * There **should** be a sample provided that operates in a realistic way <ide> (operating how a real addon would be written). <del>* A new API **should** be discussed at the N-API working group meeting. <add>* A new API **should** be discussed at the N-API team meeting. <ide> * A new API addition **must** be signed off by at least two members of <del> the N-API WG. <add> the N-API team. <ide> * A new API addition **should** be simultaneously implemented in at least <ide> one other VM implementation of Node.js. <ide> * A new API **must** be considered experimental for at least one minor <ide> N-API API. <ide> following: <ide> * A new PR **must** be opened in `nodejs/node` to remove experimental <ide> status. This PR **must** be tagged as **n-api** and **semver-minor**. <del> * Exiting an API from experimental **must** be signed off by the <del> working group. <add> * Exiting an API from experimental **must** be signed off by the team. <ide> * If a backport is merited, an API **must** have a down-level <ide> implementation. <ide> * The API **should** be used by a published real-world module. Use of
1
PHP
PHP
remove non psr7 dispatchers
86238668f025adce1fb93e54ddee3b018e35f209
<ide><path>src/Routing/Dispatcher.php <del><?php <del>/** <del> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <del> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * <del> * Licensed under The MIT License <del> * For full copyright and license information, please see the LICENSE.txt <del> * Redistributions of files must retain the above copyright notice. <del> * <del> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * @link https://cakephp.org CakePHP(tm) Project <del> * @since 0.2.9 <del> * @license https://opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\Routing; <del> <del>use Cake\Event\EventDispatcherTrait; <del>use Cake\Event\EventListenerInterface; <del>use Cake\Http\ActionDispatcher; <del>use Cake\Http\Response; <del>use Cake\Http\ServerRequest; <del> <del>/** <del> * Dispatcher converts Requests into controller actions. It uses the dispatched Request <del> * to locate and load the correct controller. If found, the requested action is called on <del> * the controller <del> * <del> * @deprecated 3.6.0 Dispatcher is deprecated. You should update your application to use <del> * the Http\Server implementation instead. <del> */ <del>class Dispatcher <del>{ <del> <del> use EventDispatcherTrait; <del> <del> /** <del> * Connected filter objects <del> * <del> * @var \Cake\Event\EventListenerInterface[] <del> */ <del> protected $_filters = []; <del> <del> /** <del> * Dispatches and invokes given Request, handing over control to the involved controller. If the controller is set <del> * to autoRender, via Controller::$autoRender, then Dispatcher will render the view. <del> * <del> * Actions in CakePHP can be any public method on a controller, that is not declared in Controller. If you <del> * want controller methods to be public and in-accessible by URL, then prefix them with a `_`. <del> * For example `public function _loadPosts() { }` would not be accessible via URL. Private and protected methods <del> * are also not accessible via URL. <del> * <del> * If no controller of given name can be found, invoke() will throw an exception. <del> * If the controller is found, and the action is not found an exception will be thrown. <del> * <del> * @param \Cake\Http\ServerRequest $request Request object to dispatch. <del> * @param \Cake\Http\Response $response Response object to put the results of the dispatch into. <del> * @return string|null if `$request['return']` is set then it returns response body, null otherwise <del> * @throws \LogicException When the controller did not get created in the Dispatcher.beforeDispatch event. <del> */ <del> public function dispatch(ServerRequest $request, Response $response) <del> { <del> deprecationWarning( <del> 'Dispatcher is deprecated. You should update your application to use ' . <del> 'the Http\Server implementation instead.' <del> ); <del> $actionDispatcher = new ActionDispatcher(null, $this->getEventManager(), $this->_filters); <del> $response = $actionDispatcher->dispatch($request, $response); <del> if ($request->getParam('return', null) !== null) { <del> return $response->body(); <del> } <del> <del> return $response->send(); <del> } <del> <del> /** <del> * Add a filter to this dispatcher. <del> * <del> * The added filter will be attached to the event manager used <del> * by this dispatcher. <del> * <del> * @param \Cake\Event\EventListenerInterface $filter The filter to connect. Can be <del> * any EventListenerInterface. Typically an instance of \Cake\Routing\DispatcherFilter. <del> * @return void <del> */ <del> public function addFilter(EventListenerInterface $filter) <del> { <del> $this->_filters[] = $filter; <del> } <del> <del> /** <del> * Get the list of connected filters. <del> * <del> * @return \Cake\Event\EventListenerInterface[] <del> */ <del> public function filters() <del> { <del> return $this->_filters; <del> } <del>} <ide><path>src/Routing/DispatcherFactory.php <del><?php <del>/** <del> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <del> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * <del> * Licensed under The MIT License <del> * For full copyright and license information, please see the LICENSE.txt <del> * Redistributions of files must retain the above copyright notice. <del> * <del> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * @link https://cakephp.org CakePHP(tm) Project <del> * @since 3.0.0 <del> * @license https://opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\Routing; <del> <del>use Cake\Core\App; <del>use Cake\Routing\Exception\MissingDispatcherFilterException; <del> <del>/** <del> * A factory for creating dispatchers with all the desired middleware <del> * connected. <del> * <del> * @deprecated 3.6.0 This class is part of the deprecated dispatcher system. <del> * Use Http\Server instead. <del> */ <del>class DispatcherFactory <del>{ <del> <del> /** <del> * Stack of middleware to apply to dispatchers. <del> * <del> * @var \Cake\Routing\DispatcherFilter[] <del> */ <del> protected static $_stack = []; <del> <del> /** <del> * Add a new middleware object to the stack of middleware <del> * that will be executed. <del> * <del> * Instances of filters will be re-used across all sub-requests <del> * in a request. <del> * <del> * @param string|\Cake\Routing\DispatcherFilter $filter Either the classname of the filter <del> * or an instance to use. <del> * @param array $options Constructor arguments/options for the filter if you are using a string name. <del> * If you are passing an instance, this argument will be ignored. <del> * @return \Cake\Routing\DispatcherFilter <del> */ <del> public static function add($filter, array $options = []) <del> { <del> if (is_string($filter)) { <del> $filter = static::_createFilter($filter, $options); <del> } <del> static::$_stack[] = $filter; <del> <del> return $filter; <del> } <del> <del> /** <del> * Create an instance of a filter. <del> * <del> * @param string $name The name of the filter to build. <del> * @param array $options Constructor arguments/options for the filter. <del> * @return \Cake\Routing\DispatcherFilter <del> * @throws \Cake\Routing\Exception\MissingDispatcherFilterException When filters cannot be found. <del> */ <del> protected static function _createFilter($name, $options) <del> { <del> $className = App::className($name, 'Routing/Filter', 'Filter'); <del> if (!$className) { <del> $msg = sprintf('Cannot locate dispatcher filter named "%s".', $name); <del> throw new MissingDispatcherFilterException($msg); <del> } <del> <del> return new $className($options); <del> } <del> <del> /** <del> * Create a dispatcher that has all the configured middleware applied. <del> * <del> * @return \Cake\Routing\Dispatcher <del> */ <del> public static function create() <del> { <del> $dispatcher = new Dispatcher(); <del> foreach (static::$_stack as $middleware) { <del> $dispatcher->addFilter($middleware); <del> } <del> <del> return $dispatcher; <del> } <del> <del> /** <del> * Get the connected dispatcher filters. <del> * <del> * @return \Cake\Routing\DispatcherFilter[] <del> */ <del> public static function filters() <del> { <del> return static::$_stack; <del> } <del> <del> /** <del> * Clear the middleware stack. <del> * <del> * @return void <del> */ <del> public static function clear() <del> { <del> static::$_stack = []; <del> } <del>} <ide><path>src/Routing/DispatcherFilter.php <del><?php <del>/** <del> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <del> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * <del> * Licensed under The MIT License <del> * For full copyright and license information, please see the LICENSE.txt <del> * Redistributions of files must retain the above copyright notice. <del> * <del> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * @link https://cakephp.org CakePHP(tm) Project <del> * @since 2.2.0 <del> * @license https://opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\Routing; <del> <del>use Cake\Core\InstanceConfigTrait; <del>use Cake\Event\Event; <del>use Cake\Event\EventListenerInterface; <del>use InvalidArgumentException; <del> <del>/** <del> * This abstract class represents a filter to be applied to a dispatcher cycle. It acts as an <del> * event listener with the ability to alter the request or response as needed before it is handled <del> * by a controller or after the response body has already been built. <del> * <del> * Subclasses of this class use a class naming convention having a `Filter` suffix. <del> * <del> * ### Limiting filters to specific paths <del> * <del> * By using the `for` option you can limit with request paths a filter is applied to. <del> * Both the before and after event will have the same conditions applied to them. For <del> * example, if you only wanted a filter applied to blog requests you could do: <del> * <del> * ``` <del> * $filter = new BlogFilter(['for' => '/blog']); <del> * ``` <del> * <del> * When the above filter is connected to a dispatcher it will only fire <del> * its `beforeDispatch` and `afterDispatch` methods on requests that start with `/blog`. <del> * <del> * The for condition can also be a regular expression by using the `preg:` prefix: <del> * <del> * ``` <del> * $filter = new BlogFilter(['for' => 'preg:#^/blog/\d+$#']); <del> * ``` <del> * <del> * ### Limiting filters based on conditions <del> * <del> * In addition to simple path based matching you can use a closure to match on arbitrary request <del> * or response conditions. For example: <del> * <del> * ``` <del> * $cookieMonster = new CookieFilter([ <del> * 'when' => function ($req, $res) { <del> * // Custom code goes here. <del> * } <del> * ]); <del> * ``` <del> * <del> * If your when condition returns `true` the before/after methods will be called. <del> * <del> * When using the `for` or `when` matchers, conditions will be re-checked on the before and after <del> * callback as the conditions could change during the dispatch cycle. <del> * <del> * @mixin \Cake\Core\InstanceConfigTrait <del> */ <del>class DispatcherFilter implements EventListenerInterface <del>{ <del> <del> use InstanceConfigTrait; <del> <del> /** <del> * Default priority for all methods in this filter <del> * <del> * @var int <del> */ <del> protected $_priority = 10; <del> <del> /** <del> * Default config <del> * <del> * These are merged with user-provided config when the class is used. <del> * The when and for options allow you to define conditions that are checked before <del> * your filter is called. <del> * <del> * @var array <del> */ <del> protected $_defaultConfig = [ <del> 'when' => null, <del> 'for' => null, <del> 'priority' => null, <del> ]; <del> <del> /** <del> * Constructor. <del> * <del> * @param array $config Settings for the filter. <del> * @throws \InvalidArgumentException When 'when' conditions are not callable. <del> */ <del> public function __construct($config = []) <del> { <del> if (!isset($config['priority'])) { <del> $config['priority'] = $this->_priority; <del> } <del> $this->setConfig($config); <del> if (isset($config['when']) && !is_callable($config['when'])) { <del> throw new InvalidArgumentException('"when" conditions must be a callable.'); <del> } <del> } <del> <del> /** <del> * Returns the list of events this filter listens to. <del> * Dispatcher notifies 2 different events `Dispatcher.before` and `Dispatcher.after`. <del> * By default this class will attach `preDispatch` and `postDispatch` method respectively. <del> * <del> * Override this method at will to only listen to the events you are interested in. <del> * <del> * @return array <del> */ <del> public function implementedEvents() <del> { <del> return [ <del> 'Dispatcher.beforeDispatch' => [ <del> 'callable' => 'handle', <del> 'priority' => $this->_config['priority'] <del> ], <del> 'Dispatcher.afterDispatch' => [ <del> 'callable' => 'handle', <del> 'priority' => $this->_config['priority'] <del> ], <del> ]; <del> } <del> <del> /** <del> * Handler method that applies conditions and resolves the correct method to call. <del> * <del> * @param \Cake\Event\Event $event The event instance. <del> * @return mixed <del> */ <del> public function handle(Event $event) <del> { <del> $name = $event->getName(); <del> list(, $method) = explode('.', $name); <del> if (empty($this->_config['for']) && empty($this->_config['when'])) { <del> return $this->{$method}($event); <del> } <del> if ($this->matches($event)) { <del> return $this->{$method}($event); <del> } <del> } <del> <del> /** <del> * Check to see if the incoming request matches this filter's criteria. <del> * <del> * @param \Cake\Event\Event $event The event to match. <del> * @return bool <del> */ <del> public function matches(Event $event) <del> { <del> /* @var \Cake\Http\ServerRequest $request */ <del> $request = $event->getData('request'); <del> $pass = true; <del> if (!empty($this->_config['for'])) { <del> $len = strlen('preg:'); <del> $for = $this->_config['for']; <del> $url = $request->getRequestTarget(); <del> if (substr($for, 0, $len) === 'preg:') { <del> $pass = (bool)preg_match(substr($for, $len), $url); <del> } else { <del> $pass = strpos($url, $for) === 0; <del> } <del> } <del> if ($pass && !empty($this->_config['when'])) { <del> $response = $event->getData('response'); <del> $pass = $this->_config['when']($request, $response); <del> } <del> <del> return $pass; <del> } <del> <del> /** <del> * Method called before the controller is instantiated and called to serve a request. <del> * If used with default priority, it will be called after the Router has parsed the <del> * URL and set the routing params into the request object. <del> * <del> * If a Cake\Http\Response object instance is returned, it will be served at the end of the <del> * event cycle, not calling any controller as a result. This will also have the effect of <del> * not calling the after event in the dispatcher. <del> * <del> * If false is returned, the event will be stopped and no more listeners will be notified. <del> * Alternatively you can call `$event->stopPropagation()` to achieve the same result. <del> * <del> * @param \Cake\Event\Event $event container object having the `request`, `response` and `additionalParams` <del> * keys in the data property. <del> * @return void <del> */ <del> public function beforeDispatch(Event $event) <del> { <del> } <del> <del> /** <del> * Method called after the controller served a request and generated a response. <del> * It is possible to alter the response object at this point as it is not sent to the <del> * client yet. <del> * <del> * If false is returned, the event will be stopped and no more listeners will be notified. <del> * Alternatively you can call `$event->stopPropagation()` to achieve the same result. <del> * <del> * @param \Cake\Event\Event $event container object having the `request` and `response` <del> * keys in the data property. <del> * @return void <del> */ <del> public function afterDispatch(Event $event) <del> { <del> } <del>} <ide><path>src/Routing/Filter/AssetFilter.php <del><?php <del>/** <del> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <del> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * <del> * Licensed under The MIT License <del> * For full copyright and license information, please see the LICENSE.txt <del> * Redistributions of files must retain the above copyright notice. <del> * <del> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * @link https://cakephp.org CakePHP(tm) Project <del> * @since 2.2.0 <del> * @license https://opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\Routing\Filter; <del> <del>use Cake\Core\Plugin; <del>use Cake\Event\Event; <del>use Cake\Http\Response; <del>use Cake\Http\ServerRequest; <del>use Cake\Routing\DispatcherFilter; <del>use Cake\Utility\Inflector; <del> <del>/** <del> * Filters a request and tests whether it is a file in the webroot folder or not and <del> * serves the file to the client if appropriate. <del> */ <del>class AssetFilter extends DispatcherFilter <del>{ <del> <del> /** <del> * Default priority for all methods in this filter <del> * This filter should run before the request gets parsed by router <del> * <del> * @var int <del> */ <del> protected $_priority = 9; <del> <del> /** <del> * The amount of time to cache the asset. <del> * <del> * @var string <del> */ <del> protected $_cacheTime = '+1 day'; <del> <del> /** <del> * <del> * Constructor. <del> * <del> * @param array $config Array of config. <del> */ <del> public function __construct($config = []) <del> { <del> if (!empty($config['cacheTime'])) { <del> $this->_cacheTime = $config['cacheTime']; <del> } <del> parent::__construct($config); <del> } <del> <del> /** <del> * Checks if a requested asset exists and sends it to the browser <del> * <del> * @param \Cake\Event\Event $event Event containing the request and response object <del> * @return \Cake\Http\Response|null If the client is requesting a recognized asset, null otherwise <del> * @throws \Cake\Http\Exception\NotFoundException When asset not found <del> */ <del> public function beforeDispatch(Event $event) <del> { <del> /* @var \Cake\Http\ServerRequest $request */ <del> $request = $event->getData('request'); <del> <del> $url = urldecode($request->getUri()->getPath()); <del> if (strpos($url, '..') !== false || strpos($url, '.') === false) { <del> return null; <del> } <del> <del> $assetFile = $this->_getAssetFile($url); <del> if ($assetFile === null || !file_exists($assetFile)) { <del> return null; <del> } <del> /* @var \Cake\Http\Response $response */ <del> $response = $event->getData('response'); <del> $event->stopPropagation(); <del> <del> $response = $response->withModified(filemtime($assetFile)); <del> if ($response->checkNotModified($request)) { <del> return $response; <del> } <del> <del> $pathSegments = explode('.', $url); <del> $ext = array_pop($pathSegments); <del> <del> return $this->_deliverAsset($request, $response, $assetFile, $ext); <del> } <del> <del> /** <del> * Builds asset file path based off url <del> * <del> * @param string $url Asset URL <del> * @return string Absolute path for asset file <del> */ <del> protected function _getAssetFile($url) <del> { <del> $parts = explode('/', ltrim($url, '/')); <del> $pluginPart = []; <del> for ($i = 0; $i < 2; $i++) { <del> if (!isset($parts[$i])) { <del> break; <del> } <del> $pluginPart[] = Inflector::camelize($parts[$i]); <del> $plugin = implode('/', $pluginPart); <del> if ($plugin && Plugin::loaded($plugin)) { <del> $parts = array_slice($parts, $i + 1); <del> $fileFragment = implode(DIRECTORY_SEPARATOR, $parts); <del> $pluginWebroot = Plugin::path($plugin) . 'webroot' . DIRECTORY_SEPARATOR; <del> <del> return $pluginWebroot . $fileFragment; <del> } <del> } <del> } <del> <del> /** <del> * Sends an asset file to the client <del> * <del> * @param \Cake\Http\ServerRequest $request The request object to use. <del> * @param \Cake\Http\Response $response The response object to use. <del> * @param string $assetFile Path to the asset file in the file system <del> * @param string $ext The extension of the file to determine its mime type <del> * @return \Cake\Http\Response The updated response. <del> */ <del> protected function _deliverAsset(ServerRequest $request, Response $response, $assetFile, $ext) <del> { <del> $compressionEnabled = $response->compress(); <del> if ($response->getType() === $ext) { <del> $contentType = 'application/octet-stream'; <del> $agent = $request->getEnv('HTTP_USER_AGENT'); <del> if (preg_match('%Opera(/| )([0-9].[0-9]{1,2})%', $agent) || preg_match('/MSIE ([0-9].[0-9]{1,2})/', $agent)) { <del> $contentType = 'application/octetstream'; <del> } <del> $response = $response->withType($contentType); <del> } <del> if (!$compressionEnabled) { <del> $response = $response->withHeader('Content-Length', filesize($assetFile)); <del> } <del> $response = $response->withCache(filemtime($assetFile), $this->_cacheTime) <del> ->withFile($assetFile); <del> <del> return $response; <del> } <del>} <ide><path>src/Routing/Filter/ControllerFactoryFilter.php <del><?php <del>/** <del> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <del> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * <del> * Licensed under The MIT License <del> * For full copyright and license information, please see the LICENSE.txt <del> * Redistributions of files must retain the above copyright notice. <del> * <del> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * @link https://cakephp.org CakePHP(tm) Project <del> * @since 3.0.0 <del> * @license https://opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\Routing\Filter; <del> <del>use Cake\Event\Event; <del>use Cake\Http\ControllerFactory; <del>use Cake\Routing\DispatcherFilter; <del> <del>/** <del> * A dispatcher filter that builds the controller to dispatch <del> * in the request. <del> * <del> * This filter resolves the request parameters into a controller <del> * instance and attaches it to the event object. <del> */ <del>class ControllerFactoryFilter extends DispatcherFilter <del>{ <del> <del> /** <del> * Priority is set high to allow other filters to be called first. <del> * <del> * @var int <del> */ <del> protected $_priority = 50; <del> <del> /** <del> * Resolve the request parameters into a controller and attach the controller <del> * to the event object. <del> * <del> * @param \Cake\Event\Event $event The event instance. <del> * @return void <del> */ <del> public function beforeDispatch(Event $event) <del> { <del> $request = $event->getData('request'); <del> $response = $event->getData('response'); <del> $event->setData('controller', $this->_getController($request, $response)); <del> } <del> <del> /** <del> * Gets controller to use, either plugin or application controller. <del> * <del> * @param \Cake\Http\ServerRequest $request Request object <del> * @param \Cake\Http\Response $response Response for the controller. <del> * @return \Cake\Controller\Controller <del> * @throws \ReflectionException <del> */ <del> protected function _getController($request, $response) <del> { <del> $factory = new ControllerFactory(); <del> <del> return $factory->create($request, $response); <del> } <del>} <ide><path>src/Routing/Filter/LocaleSelectorFilter.php <del><?php <del>/** <del> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <del> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * <del> * Licensed under The MIT License <del> * For full copyright and license information, please see the LICENSE.txt <del> * Redistributions of files must retain the above copyright notice. <del> * <del> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * @link https://cakephp.org CakePHP(tm) Project <del> * @since 3.0.0 <del> * @license https://opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\Routing\Filter; <del> <del>use Cake\Event\Event; <del>use Cake\I18n\I18n; <del>use Cake\Routing\DispatcherFilter; <del>use Locale; <del> <del>/** <del> * Sets the runtime default locale for the request based on the <del> * Accept-Language header. The default will only be set if it <del> * matches the list of passed valid locales. <del> */ <del>class LocaleSelectorFilter extends DispatcherFilter <del>{ <del> <del> /** <del> * List of valid locales for the request <del> * <del> * @var array <del> */ <del> protected $_locales = []; <del> <del> /** <del> * Constructor. <del> * <del> * @param array $config Settings for the filter. <del> * @throws \Cake\Core\Exception\Exception When 'when' conditions are not callable. <del> */ <del> public function __construct($config = []) <del> { <del> parent::__construct($config); <del> if (!empty($config['locales'])) { <del> $this->_locales = $config['locales']; <del> } <del> } <del> <del> /** <del> * Inspects the request for the Accept-Language header and sets the <del> * Locale for the current runtime if it matches the list of valid locales <del> * as passed in the configuration. <del> * <del> * @param \Cake\Event\Event $event The event instance. <del> * @return void <del> */ <del> public function beforeDispatch(Event $event) <del> { <del> /* @var \Cake\Http\ServerRequest $request */ <del> $request = $event->getData('request'); <del> $locale = Locale::acceptFromHttp($request->getHeaderLine('Accept-Language')); <del> <del> if (!$locale || (!empty($this->_locales) && !in_array($locale, $this->_locales))) { <del> return; <del> } <del> <del> I18n::setLocale($locale); <del> } <del>} <ide><path>src/Routing/Filter/RoutingFilter.php <del><?php <del>/** <del> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <del> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * <del> * Licensed under The MIT License <del> * For full copyright and license information, please see the LICENSE.txt <del> * Redistributions of files must retain the above copyright notice. <del> * <del> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * @link https://cakephp.org CakePHP(tm) Project <del> * @since 3.0.0 <del> * @license https://opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\Routing\Filter; <del> <del>use Cake\Event\Event; <del>use Cake\Routing\DispatcherFilter; <del>use Cake\Routing\Exception\RedirectException; <del>use Cake\Routing\Router; <del> <del>/** <del> * A dispatcher filter that applies routing rules to the request. <del> * <del> * This filter will call Router::parse() when the request has no controller <del> * parameter defined. <del> */ <del>class RoutingFilter extends DispatcherFilter <del>{ <del> <del> /** <del> * Priority setting. <del> * <del> * This filter is normally fired last just before the request <del> * is dispatched. <del> * <del> * @var int <del> */ <del> protected $_priority = 10; <del> <del> /** <del> * Applies Routing and additionalParameters to the request to be dispatched. <del> * If Routes have not been loaded they will be loaded, and config/routes.php will be run. <del> * <del> * @param \Cake\Event\Event $event containing the request, response and additional params <del> * @return \Cake\Http\Response|null A response will be returned when a redirect route is encountered. <del> */ <del> public function beforeDispatch(Event $event) <del> { <del> /* @var \Cake\Http\ServerRequest $request */ <del> $request = $event->getData('request'); <del> if (Router::getRequest(true) !== $request) { <del> Router::setRequestInfo($request); <del> } <del> <del> try { <del> if (!$request->getParam('controller')) { <del> $params = Router::parseRequest($request); <del> $request->addParams($params); <del> } <del> <del> return null; <del> } catch (RedirectException $e) { <del> $event->stopPropagation(); <del> /* @var \Cake\Http\Response $response */ <del> $response = $event->getData('response'); <del> $response = $response->withStatus($e->getCode()) <del> ->withLocation($e->getMessage()); <del> <del> return $response; <del> } <del> } <del>} <ide><path>src/Routing/RequestActionTrait.php <del><?php <del>/** <del> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <del> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * <del> * Licensed under The MIT License <del> * Redistributions of files must retain the above copyright notice. <del> * <del> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * @link https://cakephp.org CakePHP(tm) Project <del> * @since 3.0.0 <del> * @license https://opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\Routing; <del> <del>use Cake\Core\Configure; <del>use Cake\Http\Response; <del>use Cake\Http\ServerRequest; <del>use Cake\Http\Session; <del>use Cake\Routing\Filter\ControllerFactoryFilter; <del>use Cake\Routing\Filter\RoutingFilter; <del> <del>/** <del> * Provides the requestAction() method for doing sub-requests <del> * <del> * @deprecated 3.3.0 Use view cells instead. <del> */ <del>trait RequestActionTrait <del>{ <del> <del> /** <del> * Calls a controller's method from any location. Can be used to connect controllers together <del> * or tie plugins into a main application. requestAction can be used to return rendered views <del> * or fetch the return value from controller actions. <del> * <del> * Under the hood this method uses Router::reverse() to convert the $url parameter into a string <del> * URL. You should use URL formats that are compatible with Router::reverse() <del> * <del> * ### Examples <del> * <del> * A basic example getting the return value of the controller action: <del> * <del> * ``` <del> * $variables = $this->requestAction('/articles/popular'); <del> * ``` <del> * <del> * A basic example of request action to fetch a rendered page without the layout. <del> * <del> * ``` <del> * $viewHtml = $this->requestAction('/articles/popular', ['return']); <del> * ``` <del> * <del> * You can also pass the URL as an array: <del> * <del> * ``` <del> * $vars = $this->requestAction(['controller' => 'articles', 'action' => 'popular']); <del> * ``` <del> * <del> * ### Passing other request data <del> * <del> * You can pass POST, GET, COOKIE and other data into the request using the appropriate keys. <del> * Cookies can be passed using the `cookies` key. Get parameters can be set with `query` and post <del> * data can be sent using the `post` key. <del> * <del> * ``` <del> * $vars = $this->requestAction('/articles/popular', [ <del> * 'query' => ['page' => 1], <del> * 'cookies' => ['remember_me' => 1], <del> * ]); <del> * ``` <del> * <del> * ### Sending environment or header values <del> * <del> * By default actions dispatched with this method will use the global $_SERVER and $_ENV <del> * values. If you want to override those values for a request action, you can specify the values: <del> * <del> * ``` <del> * $vars = $this->requestAction('/articles/popular', [ <del> * 'environment' => ['CONTENT_TYPE' => 'application/json'] <del> * ]); <del> * ``` <del> * <del> * ### Transmitting the session <del> * <del> * By default actions dispatched with this method will use the standard session object. <del> * If you want a particular session instance to be used, you need to specify it. <del> * <del> * ``` <del> * $vars = $this->requestAction('/articles/popular', [ <del> * 'session' => new Session($someSessionConfig) <del> * ]); <del> * ``` <del> * <del> * @param string|array $url String or array-based url. Unlike other url arrays in CakePHP, this <del> * url will not automatically handle passed arguments in the $url parameter. <del> * @param array $extra if array includes the key "return" it sets the autoRender to true. Can <del> * also be used to submit GET/POST data, and passed arguments. <del> * @return mixed Boolean true or false on success/failure, or contents <del> * of rendered action if 'return' is set in $extra. <del> * @deprecated 3.3.0 You should refactor your code to use View Cells instead of this method. <del> */ <del> public function requestAction($url, array $extra = []) <del> { <del> deprecationWarning( <del> 'RequestActionTrait::requestAction() is deprecated. ' . <del> 'You should refactor to use View Cells or Components instead.' <del> ); <del> if (empty($url)) { <del> return false; <del> } <del> if (($index = array_search('return', $extra)) !== false) { <del> $extra['return'] = 0; <del> $extra['autoRender'] = 1; <del> unset($extra[$index]); <del> } <del> $extra += ['autoRender' => 0, 'return' => 1, 'bare' => 1, 'requested' => 1]; <del> <del> $baseUrl = Configure::read('App.fullBaseUrl'); <del> if (is_string($url) && strpos($url, $baseUrl) === 0) { <del> $url = Router::normalize(str_replace($baseUrl, '', $url)); <del> } <del> if (is_string($url)) { <del> $params = [ <del> 'url' => $url <del> ]; <del> } elseif (is_array($url)) { <del> $defaultParams = ['plugin' => null, 'controller' => null, 'action' => null]; <del> $params = [ <del> 'params' => $url + $defaultParams, <del> 'base' => false, <del> 'url' => Router::reverse($url) <del> ]; <del> if (empty($params['params']['pass'])) { <del> $params['params']['pass'] = []; <del> } <del> } <del> $current = Router::getRequest(); <del> if ($current) { <del> $params['base'] = $current->getAttribute('base'); <del> $params['webroot'] = $current->getAttribute('webroot'); <del> } <del> <del> $params['post'] = $params['query'] = []; <del> if (isset($extra['post'])) { <del> $params['post'] = $extra['post']; <del> } <del> if (isset($extra['query'])) { <del> $params['query'] = $extra['query']; <del> } <del> if (isset($extra['cookies'])) { <del> $params['cookies'] = $extra['cookies']; <del> } <del> if (isset($extra['environment'])) { <del> $params['environment'] = $extra['environment'] + $_SERVER + $_ENV; <del> } <del> unset($extra['environment'], $extra['post'], $extra['query']); <del> <del> $params['session'] = isset($extra['session']) ? $extra['session'] : new Session(); <del> <del> $request = new ServerRequest($params); <del> $request->addParams($extra); <del> $dispatcher = DispatcherFactory::create(); <del> <del> // If an application is using PSR7 middleware, <del> // we need to 'fix' their missing dispatcher filters. <del> $needed = [ <del> 'routing' => RoutingFilter::class, <del> 'controller' => ControllerFactoryFilter::class <del> ]; <del> foreach ($dispatcher->filters() as $filter) { <del> if ($filter instanceof RoutingFilter) { <del> unset($needed['routing']); <del> } <del> if ($filter instanceof ControllerFactoryFilter) { <del> unset($needed['controller']); <del> } <del> } <del> foreach ($needed as $class) { <del> $dispatcher->addFilter(new $class); <del> } <del> $result = $dispatcher->dispatch($request, new Response()); <del> Router::popRequest(); <del> <del> return $result; <del> } <del>} <ide><path>tests/TestCase/Routing/DispatcherFactoryTest.php <del><?php <del>/** <del> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <del> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * <del> * Licensed under The MIT License <del> * For full copyright and license information, please see the LICENSE.txt <del> * Redistributions of files must retain the above copyright notice. <del> * <del> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * @link https://cakephp.org CakePHP(tm) Project <del> * @since 3.0.0 <del> * @license https://opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\Test\TestCase\Routing; <del> <del>use Cake\Http\ServerRequest; <del>use Cake\Routing\DispatcherFactory; <del>use Cake\TestSuite\TestCase; <del> <del>/** <del> * Dispatcher factory test case. <del> */ <del>class DispatcherFactoryTest extends TestCase <del>{ <del> protected $errorLevel; <del> <del> /** <del> * setup function <del> * <del> * @return void <del> */ <del> public function setUp() <del> { <del> parent::setUp(); <del> static::setAppNamespace(); <del> DispatcherFactory::clear(); <del> $this->errorLevel = error_reporting(E_ALL ^ E_USER_DEPRECATED); <del> } <del> <del> /** <del> * teardown function <del> * <del> * @return void <del> */ <del> public function tearDown() <del> { <del> parent::tearDown(); <del> error_reporting($this->errorLevel); <del> } <del> <del> /** <del> * Test add filter <del> * <del> * @return void <del> */ <del> public function testAddFilter() <del> { <del> $mw = $this->getMockBuilder('Cake\Routing\DispatcherFilter') <del> ->setMethods(['beforeDispatch']) <del> ->getMock(); <del> $result = DispatcherFactory::add($mw); <del> $this->assertSame($mw, $result); <del> } <del> <del> /** <del> * Test add filter as a string <del> * <del> * @return void <del> */ <del> public function testAddFilterString() <del> { <del> $result = DispatcherFactory::add('Routing'); <del> $this->assertInstanceOf('Cake\Routing\Filter\RoutingFilter', $result); <del> } <del> <del> /** <del> * Test add filter missing <del> * <del> * @return void <del> */ <del> public function testAddFilterMissing() <del> { <del> $this->expectException(\Cake\Routing\Exception\MissingDispatcherFilterException::class); <del> DispatcherFactory::add('NopeSauce'); <del> } <del> <del> /** <del> * Test add filter <del> * <del> * @return void <del> */ <del> public function testAddFilterWithOptions() <del> { <del> $config = ['config' => 'value', 'priority' => 999]; <del> $result = DispatcherFactory::add('Routing', $config); <del> $this->assertInstanceOf('Cake\Routing\Filter\RoutingFilter', $result); <del> $this->assertEquals($config['config'], $result->getConfig('config')); <del> $this->assertEquals($config['priority'], $result->getConfig('priority')); <del> } <del> <del> /** <del> * Test creating a dispatcher with the factory <del> * <del> * @return void <del> */ <del> public function testCreate() <del> { <del> $mw = $this->getMockBuilder('Cake\Routing\DispatcherFilter') <del> ->setMethods(['beforeDispatch']) <del> ->getMock(); <del> DispatcherFactory::add($mw); <del> $result = DispatcherFactory::create(); <del> $this->assertInstanceOf('Cake\Routing\Dispatcher', $result); <del> $this->assertCount(1, $result->filters()); <del> } <del> <del> /** <del> * test create() -> dispatch() -> response flow. <del> * <del> * @return void <del> */ <del> public function testCreateDispatchWithFilters() <del> { <del> $url = new ServerRequest([ <del> 'url' => 'posts', <del> 'params' => [ <del> 'controller' => 'Posts', <del> 'action' => 'index', <del> 'pass' => [], <del> 'bare' => true, <del> ] <del> ]); <del> $response = $this->getMockBuilder('Cake\Http\Response') <del> ->setMethods(['send']) <del> ->getMock(); <del> <del> $response->expects($this->once()) <del> ->method('send') <del> ->will($this->returnSelf()); <del> <del> DispatcherFactory::add('ControllerFactory'); <del> DispatcherFactory::add('Append'); <del> <del> $dispatcher = DispatcherFactory::create(); <del> $result = $dispatcher->dispatch($url, $response); <del> $this->assertEquals('posts index appended content', $result->body()); <del> } <del>} <ide><path>tests/TestCase/Routing/DispatcherFilterTest.php <del><?php <del>/** <del> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <del> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * <del> * Licensed under The MIT License <del> * For full copyright and license information, please see the LICENSE.txt <del> * Redistributions of files must retain the above copyright notice. <del> * <del> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * @link https://cakephp.org CakePHP(tm) Project <del> * @since 3.0.0 <del> * @license https://opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\Test\TestCase\Routing; <del> <del>use Cake\Event\Event; <del>use Cake\Http\Response; <del>use Cake\Http\ServerRequest; <del>use Cake\Routing\DispatcherFilter; <del>use Cake\TestSuite\TestCase; <del> <del>/** <del> * Dispatcher filter test. <del> */ <del>class DispatcherFilterTest extends TestCase <del>{ <del> <del> /** <del> * Test that the constructor takes config. <del> * <del> * @return void <del> */ <del> public function testConstructConfig() <del> { <del> $filter = new DispatcherFilter(['one' => 'value', 'on' => '/blog']); <del> $this->assertEquals('value', $filter->getConfig('one')); <del> } <del> <del> /** <del> * Test setting priority <del> * <del> * @return void <del> */ <del> public function testConstructPriority() <del> { <del> $filter = new DispatcherFilter(); <del> $this->assertEquals(10, $filter->getConfig('priority')); <del> <del> $filter = new DispatcherFilter(['priority' => 100]); <del> $this->assertEquals(100, $filter->getConfig('priority')); <del> } <del> <del> /** <del> * Test implemented events <del> * <del> * @return void <del> */ <del> public function testImplementedEvents() <del> { <del> $filter = new DispatcherFilter(['priority' => 100]); <del> $events = $filter->implementedEvents(); <del> $this->assertEquals(100, $events['Dispatcher.beforeDispatch']['priority']); <del> $this->assertEquals(100, $events['Dispatcher.afterDispatch']['priority']); <del> } <del> <del> /** <del> * Test constructor error invalid when <del> * <del> * @return void <del> */ <del> public function testConstructorInvalidWhen() <del> { <del> $this->expectException(\InvalidArgumentException::class); <del> $this->expectExceptionMessage('"when" conditions must be a callable.'); <del> new DispatcherFilter(['when' => 'nope']); <del> } <del> <del> /** <del> * Test basic matching with for option. <del> * <del> * @return void <del> * @triggers Dispatcher.beforeDispatch $this, compact('request') <del> * @triggers Dispatcher.beforeDispatch $this, compact('request') <del> * @triggers Dispatcher.beforeDispatch $this, compact('request') <del> * @triggers Dispatcher.beforeDispatch $this, compact('request') <del> */ <del> public function testMatchesWithFor() <del> { <del> $request = new ServerRequest(['url' => '/articles/view']); <del> $event = new Event('Dispatcher.beforeDispatch', $this, compact('request')); <del> $filter = new DispatcherFilter(['for' => '/articles']); <del> $this->assertTrue($filter->matches($event)); <del> <del> $request = new ServerRequest(['url' => '/blog/articles']); <del> $event = new Event('Dispatcher.beforeDispatch', $this, compact('request')); <del> $this->assertFalse($filter->matches($event), 'Does not start with /articles'); <del> <del> $request = new ServerRequest(['url' => '/articles/edit/1']); <del> $event = new Event('Dispatcher.beforeDispatch', $this, compact('request')); <del> $filter = new DispatcherFilter(['for' => 'preg:#^/articles/edit/\d+$#']); <del> $this->assertTrue($filter->matches($event)); <del> <del> $request = new ServerRequest(['url' => '/blog/articles/edit/1']); <del> $event = new Event('Dispatcher.beforeDispatch', $this, compact('request')); <del> $this->assertFalse($filter->matches($event), 'Does not start with /articles'); <del> } <del> <del> /** <del> * Test matching with when option. <del> * <del> * @return void <del> * @triggers Dispatcher.beforeDispatch $this, compact('response', 'request') <del> */ <del> public function testMatchesWithWhen() <del> { <del> $matcher = function ($request, $response) { <del> $this->assertInstanceOf('Cake\Http\ServerRequest', $request); <del> $this->assertInstanceOf('Cake\Http\Response', $response); <del> <del> return true; <del> }; <del> <del> $request = new ServerRequest(['url' => '/articles/view']); <del> $response = new Response(); <del> $event = new Event('Dispatcher.beforeDispatch', $this, compact('response', 'request')); <del> $filter = new DispatcherFilter(['when' => $matcher]); <del> $this->assertTrue($filter->matches($event)); <del> <del> $matcher = function () { <del> return false; <del> }; <del> $filter = new DispatcherFilter(['when' => $matcher]); <del> $this->assertFalse($filter->matches($event)); <del> } <del> <del> /** <del> * Test matching with for & when option. <del> * <del> * @return void <del> * @triggers Dispatcher.beforeDispatch $this, compact('response', 'request') <del> */ <del> public function testMatchesWithForAndWhen() <del> { <del> $request = new ServerRequest(['url' => '/articles/view']); <del> $response = new Response(); <del> <del> $matcher = function () { <del> return true; <del> }; <del> $event = new Event('Dispatcher.beforeDispatch', $this, compact('response', 'request')); <del> $filter = new DispatcherFilter(['for' => '/admin', 'when' => $matcher]); <del> $this->assertFalse($filter->matches($event)); <del> <del> $filter = new DispatcherFilter(['for' => '/articles', 'when' => $matcher]); <del> $this->assertTrue($filter->matches($event)); <del> <del> $matcher = function () { <del> return false; <del> }; <del> $filter = new DispatcherFilter(['for' => '/admin', 'when' => $matcher]); <del> $this->assertFalse($filter->matches($event)); <del> <del> $filter = new DispatcherFilter(['for' => '/articles', 'when' => $matcher]); <del> $this->assertFalse($filter->matches($event)); <del> } <del> <del> /** <del> * Test event bindings have use condition checker <del> * <del> * @return void <del> * @triggers Dispatcher.beforeDispatch $this, compact('response', 'request') <del> * @triggers Dispatcher.afterDispatch $this, compact('response', 'request') <del> */ <del> public function testImplementedEventsMethodName() <del> { <del> $request = new ServerRequest(['url' => '/articles/view']); <del> $response = new Response(); <del> <del> $beforeEvent = new Event('Dispatcher.beforeDispatch', $this, compact('response', 'request')); <del> $afterEvent = new Event('Dispatcher.afterDispatch', $this, compact('response', 'request')); <del> <del> $filter = $this->getMockBuilder('Cake\Routing\DispatcherFilter') <del> ->setMethods(['beforeDispatch', 'afterDispatch']) <del> ->getMock(); <del> $filter->expects($this->at(0)) <del> ->method('beforeDispatch') <del> ->with($beforeEvent); <del> $filter->expects($this->at(1)) <del> ->method('afterDispatch') <del> ->with($afterEvent); <del> <del> $filter->handle($beforeEvent); <del> $filter->handle($afterEvent); <del> } <del> <del> /** <del> * Test handle applies for conditions <del> * <del> * @return void <del> * @triggers Dispatcher.beforeDispatch $this, compact('response', 'request') <del> */ <del> public function testHandleAppliesFor() <del> { <del> $request = new ServerRequest(['url' => '/articles/view']); <del> $response = new Response(); <del> <del> $event = new Event('Dispatcher.beforeDispatch', $this, compact('response', 'request')); <del> <del> $filter = $this->getMockBuilder('Cake\Routing\DispatcherFilter') <del> ->setMethods(['beforeDispatch']) <del> ->setConstructorArgs([['for' => '/admin']]) <del> ->getMock(); <del> $filter->expects($this->never()) <del> ->method('beforeDispatch'); <del> <del> $filter->handle($event); <del> } <del> <del> /** <del> * Test handle applies when conditions <del> * <del> * @return void <del> * @triggers Dispatcher.beforeDispatch $this, compact('response', 'request') <del> */ <del> public function testHandleAppliesWhen() <del> { <del> $request = new ServerRequest(['url' => '/articles/view']); <del> $response = new Response(); <del> <del> $event = new Event('Dispatcher.beforeDispatch', $this, compact('response', 'request')); <del> $matcher = function () { <del> return false; <del> }; <del> <del> $filter = $this->getMockBuilder('Cake\Routing\DispatcherFilter') <del> ->setMethods(['beforeDispatch']) <del> ->setConstructorArgs([['when' => $matcher]]) <del> ->getMock(); <del> $filter->expects($this->never()) <del> ->method('beforeDispatch'); <del> <del> $filter->handle($event); <del> } <del>} <ide><path>tests/TestCase/Routing/DispatcherTest.php <del><?php <del>/** <del> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <del> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * <del> * Licensed under The MIT License <del> * Redistributions of files must retain the above copyright notice <del> * <del> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * @link https://cakephp.org CakePHP(tm) Project <del> * @since 1.2.0 <del> * @license https://opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\Test\TestCase\Routing; <del> <del>use Cake\Core\Configure; <del>use Cake\Core\Plugin; <del>use Cake\Http\Response; <del>use Cake\Http\ServerRequest; <del>use Cake\Http\Session; <del>use Cake\Routing\Dispatcher; <del>use Cake\Routing\Filter\ControllerFactoryFilter; <del>use Cake\TestSuite\TestCase; <del> <del>/** <del> * DispatcherTest class <del> * <del> * @group deprecated <del> */ <del>class DispatcherTest extends TestCase <del>{ <del> protected $errorLevel; <del> <del> /** <del> * setUp method <del> * <del> * @return void <del> */ <del> public function setUp() <del> { <del> parent::setUp(); <del> $_GET = []; <del> <del> $this->errorLevel = error_reporting(E_ALL ^ E_USER_DEPRECATED); <del> Configure::write('App.base', false); <del> Configure::write('App.baseUrl', false); <del> Configure::write('App.dir', 'app'); <del> Configure::write('App.webroot', 'webroot'); <del> static::setAppNamespace(); <del> <del> $this->dispatcher = new Dispatcher(); <del> $this->dispatcher->addFilter(new ControllerFactoryFilter()); <del> } <del> <del> /** <del> * tearDown method <del> * <del> * @return void <del> */ <del> public function tearDown() <del> { <del> error_reporting($this->errorLevel); <del> parent::tearDown(); <del> Plugin::unload(); <del> } <del> <del> /** <del> * testMissingController method <del> * <del> * @return void <del> */ <del> public function testMissingController() <del> { <del> $this->expectException(\Cake\Routing\Exception\MissingControllerException::class); <del> $this->expectExceptionMessage('Controller class SomeController could not be found.'); <del> $request = new ServerRequest([ <del> 'url' => 'some_controller/home', <del> 'params' => [ <del> 'controller' => 'SomeController', <del> 'action' => 'home', <del> ] <del> ]); <del> $response = $this->getMockBuilder('Cake\Http\Response')->getMock(); <del> $this->dispatcher->dispatch($request, $response, ['return' => 1]); <del> } <del> <del> /** <del> * testMissingControllerInterface method <del> * <del> * @return void <del> */ <del> public function testMissingControllerInterface() <del> { <del> $this->expectException(\Cake\Routing\Exception\MissingControllerException::class); <del> $this->expectExceptionMessage('Controller class Interface could not be found.'); <del> $request = new ServerRequest([ <del> 'url' => 'interface/index', <del> 'params' => [ <del> 'controller' => 'Interface', <del> 'action' => 'index', <del> ] <del> ]); <del> $url = new ServerRequest('dispatcher_test_interface/index'); <del> $response = $this->getMockBuilder('Cake\Http\Response')->getMock(); <del> $this->dispatcher->dispatch($request, $response, ['return' => 1]); <del> } <del> <del> /** <del> * testMissingControllerInterface method <del> * <del> * @return void <del> */ <del> public function testMissingControllerAbstract() <del> { <del> $this->expectException(\Cake\Routing\Exception\MissingControllerException::class); <del> $this->expectExceptionMessage('Controller class Abstract could not be found.'); <del> $request = new ServerRequest([ <del> 'url' => 'abstract/index', <del> 'params' => [ <del> 'controller' => 'Abstract', <del> 'action' => 'index', <del> ] <del> ]); <del> $response = $this->getMockBuilder('Cake\Http\Response')->getMock(); <del> $this->dispatcher->dispatch($request, $response, ['return' => 1]); <del> } <del> <del> /** <del> * Test that lowercase controller names result in missing controller errors. <del> * <del> * In case-insensitive file systems, lowercase controller names will kind of work. <del> * This causes annoying deployment issues for lots of folks. <del> * <del> * @return void <del> */ <del> public function testMissingControllerLowercase() <del> { <del> $this->expectException(\Cake\Routing\Exception\MissingControllerException::class); <del> $this->expectExceptionMessage('Controller class somepages could not be found.'); <del> $request = new ServerRequest([ <del> 'url' => 'pages/home', <del> 'params' => [ <del> 'controller' => 'somepages', <del> 'action' => 'display', <del> 'pass' => ['home'], <del> ] <del> ]); <del> $response = $this->getMockBuilder('Cake\Http\Response')->getMock(); <del> $this->dispatcher->dispatch($request, $response, ['return' => 1]); <del> } <del> <del> /** <del> * testDispatch method <del> * <del> * @return void <del> */ <del> public function testDispatchBasic() <del> { <del> $url = new ServerRequest([ <del> 'url' => 'pages/home', <del> 'params' => [ <del> 'controller' => 'Pages', <del> 'action' => 'display', <del> 'pass' => ['extract'], <del> ] <del> ]); <del> $response = $this->getMockBuilder('Cake\Http\Response') <del> ->setMethods(['send']) <del> ->getMock(); <del> $response->expects($this->once()) <del> ->method('send'); <del> <del> $result = $this->dispatcher->dispatch($url, $response); <del> $this->assertNull($result); <del> } <del> <del> /** <del> * Test that Dispatcher handles actions that return response objects. <del> * <del> * @return void <del> */ <del> public function testDispatchActionReturnsResponse() <del> { <del> $request = new ServerRequest([ <del> 'url' => 'some_pages/responseGenerator', <del> 'params' => [ <del> 'controller' => 'SomePages', <del> 'action' => 'responseGenerator', <del> 'pass' => [] <del> ] <del> ]); <del> $response = $this->getMockBuilder('Cake\Http\Response') <del> ->setMethods(['_sendHeader']) <del> ->getMock(); <del> <del> ob_start(); <del> $this->dispatcher->dispatch($request, $response); <del> $result = ob_get_clean(); <del> <del> $this->assertEquals('new response', $result); <del> } <del> <del> /** <del> * test forbidden controller names. <del> * <del> * @return void <del> */ <del> public function testDispatchBadPluginName() <del> { <del> $this->expectException(\Cake\Routing\Exception\MissingControllerException::class); <del> $this->expectExceptionMessage('Controller class TestPlugin.Tests could not be found.'); <del> Plugin::load('TestPlugin'); <del> <del> $request = new ServerRequest([ <del> 'url' => 'TestPlugin.Tests/index', <del> 'params' => [ <del> 'plugin' => '', <del> 'controller' => 'TestPlugin.Tests', <del> 'action' => 'index', <del> 'pass' => [], <del> 'return' => 1 <del> ] <del> ]); <del> $response = $this->getMockBuilder('Cake\Http\Response')->getMock(); <del> $this->dispatcher->dispatch($request, $response); <del> } <del> <del> /** <del> * test forbidden controller names. <del> * <del> * @return void <del> */ <del> public function testDispatchBadName() <del> { <del> $this->expectException(\Cake\Routing\Exception\MissingControllerException::class); <del> $this->expectExceptionMessage('Controller class TestApp\Controller\PostsController could not be found.'); <del> $request = new ServerRequest([ <del> 'url' => 'TestApp%5CController%5CPostsController/index', <del> 'params' => [ <del> 'plugin' => '', <del> 'controller' => 'TestApp\Controller\PostsController', <del> 'action' => 'index', <del> 'pass' => [], <del> 'return' => 1 <del> ] <del> ]); <del> $response = $this->getMockBuilder('Cake\Http\Response')->getMock(); <del> $this->dispatcher->dispatch($request, $response); <del> } <del> <del> /** <del> * Test dispatcher filters being called. <del> * <del> * @return void <del> */ <del> public function testDispatcherFilter() <del> { <del> $filter = $this->getMockBuilder('Cake\Routing\DispatcherFilter') <del> ->setMethods(['beforeDispatch', 'afterDispatch']) <del> ->getMock(); <del> <del> $filter->expects($this->at(0)) <del> ->method('beforeDispatch'); <del> $filter->expects($this->at(1)) <del> ->method('afterDispatch'); <del> $this->dispatcher->addFilter($filter); <del> <del> $request = new ServerRequest([ <del> 'url' => '/', <del> 'params' => [ <del> 'controller' => 'Pages', <del> 'action' => 'display', <del> 'home', <del> 'pass' => [] <del> ] <del> ]); <del> $response = $this->getMockBuilder('Cake\Http\Response') <del> ->setMethods(['send']) <del> ->getMock(); <del> $this->dispatcher->dispatch($request, $response); <del> } <del> <del> /** <del> * Test dispatcher filters being called and changing the response. <del> * <del> * @return void <del> */ <del> public function testBeforeDispatchAbortDispatch() <del> { <del> $response = $this->getMockBuilder('Cake\Http\Response') <del> ->setMethods(['send']) <del> ->getMock(); <del> $response->expects($this->once()) <del> ->method('send'); <del> <del> $filter = $this->getMockBuilder('Cake\Routing\DispatcherFilter') <del> ->setMethods(['beforeDispatch', 'afterDispatch']) <del> ->getMock(); <del> $filter->expects($this->once()) <del> ->method('beforeDispatch') <del> ->will($this->returnValue($response)); <del> <del> $filter->expects($this->never()) <del> ->method('afterDispatch'); <del> <del> $request = new ServerRequest([ <del> 'url' => '/', <del> 'params' => [ <del> 'controller' => 'Pages', <del> 'action' => 'display', <del> 'home', <del> 'pass' => [] <del> ] <del> ]); <del> $res = new Response(); <del> $this->dispatcher->addFilter($filter); <del> $this->dispatcher->dispatch($request, $res); <del> } <del> <del> /** <del> * Test dispatcher filters being called and changing the response. <del> * <del> * @return void <del> */ <del> public function testAfterDispatchReplaceResponse() <del> { <del> $response = $this->getMockBuilder('Cake\Http\Response') <del> ->setMethods(['_sendHeader', 'send']) <del> ->getMock(); <del> $response->expects($this->once()) <del> ->method('send'); <del> <del> $filter = $this->getMockBuilder('Cake\Routing\DispatcherFilter') <del> ->setMethods(['beforeDispatch', 'afterDispatch']) <del> ->getMock(); <del> <del> $filter->expects($this->once()) <del> ->method('afterDispatch') <del> ->will($this->returnValue($response)); <del> <del> $request = new ServerRequest([ <del> 'url' => '/posts', <del> 'params' => [ <del> 'plugin' => null, <del> 'controller' => 'Posts', <del> 'action' => 'index', <del> 'pass' => [], <del> ], <del> 'session' => new Session <del> ]); <del> $this->dispatcher->addFilter($filter); <del> $this->dispatcher->dispatch($request, $response); <del> } <del>} <ide><path>tests/TestCase/Routing/Filter/AssetFilterTest.php <del><?php <del>/** <del> * CakePHP(tm) Tests <https://book.cakephp.org/view/1196/Testing> <del> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * <del> * Licensed under The Open Group Test Suite License <del> * Redistributions of files must retain the above copyright notice. <del> * <del> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * @link https://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests <del> * @since 2.2.0 <del> * @license https://opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\Test\TestCase\Routing\Filter; <del> <del>use Cake\Core\Plugin; <del>use Cake\Event\Event; <del>use Cake\Http\ServerRequest; <del>use Cake\Routing\Filter\AssetFilter; <del>use Cake\TestSuite\TestCase; <del> <del>/** <del> * Asset filter test case. <del> */ <del>class AssetFilterTest extends TestCase <del>{ <del> <del> /** <del> * setUp method <del> * <del> * @return void <del> */ <del> public function setUp() <del> { <del> parent::setUp(); <del> Plugin::load(['TestTheme']); <del> } <del> <del> /** <del> * tearDown method <del> * <del> * @return void <del> */ <del> public function tearDown() <del> { <del> parent::tearDown(); <del> Plugin::unload(); <del> } <del> <del> /** <del> * Tests that $response->checkNotModified() is called and bypasses <del> * file dispatching <del> * <del> * @return void <del> * @triggers DispatcherTest $this, compact('request', 'response') <del> * @triggers DispatcherTest $this, compact('request', 'response') <del> */ <del> public function testNotModified() <del> { <del> $filter = new AssetFilter(); <del> $time = filemtime(Plugin::path('TestTheme') . 'webroot/img/cake.power.gif'); <del> $time = new \DateTime('@' . $time); <del> <del> $response = $this->getMockBuilder('Cake\Http\Response') <del> ->setMethods(['send', 'checkNotModified']) <del> ->getMock(); <del> $request = new ServerRequest('test_theme/img/cake.power.gif'); <del> <del> $response->expects($this->once())->method('checkNotModified') <del> ->with($request) <del> ->will($this->returnValue(true)); <del> $event = new Event('DispatcherTest', $this, compact('request', 'response')); <del> <del> ob_start(); <del> $response = $filter->beforeDispatch($event); <del> ob_end_clean(); <del> $this->assertEquals(200, $response->getStatusCode()); <del> $this->assertEquals($time->format('D, j M Y H:i:s') . ' GMT', $response->getHeaderLine('Last-Modified')); <del> <del> $response = $this->getMockBuilder('Cake\Http\Response') <del> ->setMethods(['_sendHeader', 'checkNotModified', 'send']) <del> ->getMock(); <del> $request = new ServerRequest('test_theme/img/cake.power.gif'); <del> <del> $response->expects($this->once())->method('checkNotModified') <del> ->with($request) <del> ->will($this->returnValue(true)); <del> $response->expects($this->never())->method('send'); <del> $event = new Event('DispatcherTest', $this, compact('request', 'response')); <del> <del> $response = $filter->beforeDispatch($event); <del> $this->assertEquals($time->format('D, j M Y H:i:s') . ' GMT', $response->getHeaderLine('Last-Modified')); <del> } <del> <del> /** <del> * Test that no exceptions are thrown for //index.php type URLs. <del> * <del> * @return void <del> * @triggers Dispatcher.beforeRequest $this, compact('request', 'response') <del> */ <del> public function test404OnDoubleSlash() <del> { <del> $filter = new AssetFilter(); <del> <del> $response = $this->getMockBuilder('Cake\Http\Response') <del> ->setMethods(['_sendHeader']) <del> ->getMock(); <del> $request = new ServerRequest('//index.php'); <del> $event = new Event('Dispatcher.beforeRequest', $this, compact('request', 'response')); <del> <del> $this->assertNull($filter->beforeDispatch($event)); <del> $this->assertFalse($event->isStopped()); <del> } <del> <del> /** <del> * Test that 404's are returned when .. is in the URL <del> * <del> * @return void <del> * @triggers Dispatcher.beforeRequest $this, compact('request', 'response') <del> * @triggers Dispatcher.beforeRequest $this, compact('request', 'response') <del> */ <del> public function test404OnDoubleDot() <del> { <del> $filter = new AssetFilter(); <del> <del> $response = $this->getMockBuilder('Cake\Http\Response') <del> ->setMethods(['_sendHeader']) <del> ->getMock(); <del> $request = new ServerRequest('test_theme/../webroot/css/test_asset.css'); <del> $event = new Event('Dispatcher.beforeRequest', $this, compact('request', 'response')); <del> <del> $this->assertNull($filter->beforeDispatch($event)); <del> $this->assertFalse($event->isStopped()); <del> <del> $request = new ServerRequest('test_theme/%3e./webroot/css/test_asset.css'); <del> $event = new Event('Dispatcher.beforeRequest', $this, compact('request', 'response')); <del> <del> $this->assertNull($filter->beforeDispatch($event)); <del> $this->assertFalse($event->isStopped()); <del> } <del> <del> /** <del> * Data provider for asset filter <del> * <del> * - theme assets. <del> * - plugin assets. <del> * - plugin assets in sub directories. <del> * - unknown plugin assets. <del> * <del> * @return array <del> */ <del> public static function assetProvider() <del> { <del> return [ <del> [ <del> 'test_theme/flash/theme_test.swf', <del> 'Plugin/TestTheme/webroot/flash/theme_test.swf' <del> ], <del> [ <del> 'test_theme/pdfs/theme_test.pdf', <del> 'Plugin/TestTheme/webroot/pdfs/theme_test.pdf' <del> ], <del> [ <del> 'test_theme/img/test.jpg', <del> 'Plugin/TestTheme/webroot/img/test.jpg' <del> ], <del> [ <del> 'test_theme/css/test_asset.css', <del> 'Plugin/TestTheme/webroot/css/test_asset.css' <del> ], <del> [ <del> 'test_theme/js/theme.js', <del> 'Plugin/TestTheme/webroot/js/theme.js' <del> ], <del> [ <del> 'test_theme/js/one/theme_one.js', <del> 'Plugin/TestTheme/webroot/js/one/theme_one.js' <del> ], <del> [ <del> 'test_theme/space%20image.text', <del> 'Plugin/TestTheme/webroot/space image.text' <del> ], <del> [ <del> 'test_plugin/root.js', <del> 'Plugin/TestPlugin/webroot/root.js' <del> ], <del> [ <del> 'test_plugin/flash/plugin_test.swf', <del> 'Plugin/TestPlugin/webroot/flash/plugin_test.swf' <del> ], <del> [ <del> 'test_plugin/pdfs/plugin_test.pdf', <del> 'Plugin/TestPlugin/webroot/pdfs/plugin_test.pdf' <del> ], <del> [ <del> 'test_plugin/js/test_plugin/test.js', <del> 'Plugin/TestPlugin/webroot/js/test_plugin/test.js' <del> ], <del> [ <del> 'test_plugin/css/test_plugin_asset.css', <del> 'Plugin/TestPlugin/webroot/css/test_plugin_asset.css' <del> ], <del> [ <del> 'test_plugin/img/cake.icon.gif', <del> 'Plugin/TestPlugin/webroot/img/cake.icon.gif' <del> ], <del> [ <del> 'plugin_js/js/plugin_js.js', <del> 'Plugin/PluginJs/webroot/js/plugin_js.js' <del> ], <del> [ <del> 'plugin_js/js/one/plugin_one.js', <del> 'Plugin/PluginJs/webroot/js/one/plugin_one.js' <del> ], <del> [ <del> 'test_plugin/css/unknown.extension', <del> 'Plugin/TestPlugin/webroot/css/unknown.extension' <del> ], <del> [ <del> 'test_plugin/css/theme_one.htc', <del> 'Plugin/TestPlugin/webroot/css/theme_one.htc' <del> ], <del> [ <del> 'company/test_plugin_three/css/company.css', <del> 'Plugin/Company/TestPluginThree/webroot/css/company.css' <del> ], <del> ]; <del> } <del> <del> /** <del> * Test assets <del> * <del> * @dataProvider assetProvider <del> * @return void <del> * @triggers Dispatcher.beforeDispatch $this, compact('request', 'response') <del> */ <del> public function testAsset($url, $file) <del> { <del> Plugin::load(['Company/TestPluginThree', 'TestPlugin', 'PluginJs']); <del> <del> $filter = new AssetFilter(); <del> $response = $this->getMockBuilder('Cake\Http\Response') <del> ->setMethods(['_sendHeader']) <del> ->getMock(); <del> $request = new ServerRequest($url); <del> $event = new Event('Dispatcher.beforeDispatch', $this, compact('request', 'response')); <del> <del> $response = $filter->beforeDispatch($event); <del> $result = $response->getFile(); <del> <del> $path = TEST_APP . str_replace('/', DS, $file); <del> $file = file_get_contents($path); <del> $this->assertEquals($file, $result->read()); <del> <del> $expected = filesize($path); <del> $this->assertEquals($expected, $response->getHeaderLine('Content-Length')); <del> } <del>} <ide><path>tests/TestCase/Routing/Filter/ControllerFactoryFilterTest.php <del><?php <del>/** <del> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <del> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * <del> * Licensed under The MIT License <del> * For full copyright and license information, please see the LICENSE.txt <del> * Redistributions of files must retain the above copyright notice. <del> * <del> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * @link https://cakephp.org CakePHP(tm) Project <del> * @since 3.2.1 <del> * @license https://opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\Test\TestCase\Routing\Filter; <del> <del>use Cake\Event\Event; <del>use Cake\Http\Response; <del>use Cake\Http\ServerRequest; <del>use Cake\Routing\Filter\ControllerFactoryFilter; <del>use Cake\TestSuite\TestCase; <del> <del>/** <del> * Controller factory filter test. <del> */ <del>class ControllerFactoryFilterTest extends TestCase <del>{ <del> <del> /** <del> * testBeforeDispatch <del> * <del> * @return void <del> */ <del> public function testBeforeDispatch() <del> { <del> static::setAppNamespace(); <del> <del> $filter = new ControllerFactoryFilter(); <del> <del> $request = new ServerRequest([ <del> 'params' => ['prefix' => 'admin', 'controller' => 'Posts', 'action' => 'index'] <del> ]); <del> $response = new Response(); <del> $event = new Event(__CLASS__, $this, compact('request', 'response')); <del> $filter->beforeDispatch($event); <del> <del> $this->assertEquals( <del> 'TestApp\Controller\Admin\PostsController', <del> get_class($event->getData('controller')) <del> ); <del> <del> $request = new ServerRequest([ <del> 'params' => ['prefix' => 'admin/sub', 'controller' => 'Posts', 'action' => 'index'] <del> ]); <del> $event = new Event(__CLASS__, $this, compact('request', 'response')); <del> $filter->beforeDispatch($event); <del> <del> $this->assertEquals( <del> 'TestApp\Controller\Admin\Sub\PostsController', <del> get_class($event->getData('controller')) <del> ); <del> } <del>} <ide><path>tests/TestCase/Routing/Filter/LocaleSelectorFilterTest.php <del><?php <del>/** <del> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <del> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * <del> * Licensed under The MIT License <del> * For full copyright and license information, please see the LICENSE.txt <del> * Redistributions of files must retain the above copyright notice. <del> * <del> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * @link https://cakephp.org CakePHP(tm) Project <del> * @since 3.0.0 <del> * @license https://opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\Test\TestCase\Routing\Filter; <del> <del>use Cake\Event\Event; <del>use Cake\Http\ServerRequest; <del>use Cake\I18n\I18n; <del>use Cake\Routing\Filter\LocaleSelectorFilter; <del>use Cake\TestSuite\TestCase; <del>use Locale; <del> <del>/** <del> * Locale selector filter test. <del> */ <del>class LocaleSelectorFilterTest extends TestCase <del>{ <del> <del> /** <del> * setup <del> * <del> * @return void <del> */ <del> public function setUp() <del> { <del> parent::setUp(); <del> $this->locale = Locale::getDefault(); <del> } <del> <del> /** <del> * Resets the default locale <del> * <del> * @return void <del> */ <del> public function tearDown() <del> { <del> parent::tearDown(); <del> Locale::setDefault($this->locale); <del> } <del> <del> /** <del> * Tests selecting a language from a http header <del> * <del> * @return void <del> * @triggers name null, [request => $request]) <del> * @triggers name null, [request => $request]) <del> * @triggers name null, [request => $request]) <del> */ <del> public function testSimpleSelection() <del> { <del> $filter = new LocaleSelectorFilter(); <del> $request = new ServerRequest([ <del> 'environment' => ['HTTP_ACCEPT_LANGUAGE' => 'en-GB,en;q=0.8,es;q=0.6,da;q=0.4'] <del> ]); <del> $filter->beforeDispatch(new Event('name', null, ['request' => $request])); <del> $this->assertEquals('en_GB', I18n::getLocale()); <del> <del> $request = new ServerRequest([ <del> 'environment' => ['HTTP_ACCEPT_LANGUAGE' => 'es_VE,en;q=0.8,es;q=0.6,da;q=0.4'] <del> ]); <del> $filter->beforeDispatch(new Event('name', null, ['request' => $request])); <del> $this->assertEquals('es_VE', I18n::getLocale()); <del> <del> $request = new ServerRequest([ <del> 'environment' => ['HTTP_ACCEPT_LANGUAGE' => 'en;q=0.4,es;q=0.6,da;q=0.8'] <del> ]); <del> $filter->beforeDispatch(new Event('name', null, ['request' => $request])); <del> $this->assertEquals('da', I18n::getLocale()); <del> } <del> <del> /** <del> * Tests selecting a language from a http header and filtering by a whitelist <del> * <del> * @return void <del> * @triggers name null, [request => $request]) <del> * @triggers name null, [request => $request]) <del> */ <del> public function testWithWhitelist() <del> { <del> Locale::setDefault('en_US'); <del> $filter = new LocaleSelectorFilter([ <del> 'locales' => ['en_CA', 'en_IN', 'es_VE'] <del> ]); <del> $request = new ServerRequest([ <del> 'environment' => [ <del> 'HTTP_ACCEPT_LANGUAGE' => 'en-GB;q=0.8,es-VE;q=0.9,da-DK;q=0.4' <del> ] <del> ]); <del> $filter->beforeDispatch(new Event('name', null, ['request' => $request])); <del> $this->assertEquals('es_VE', I18n::getLocale()); <del> <del> Locale::setDefault('en_US'); <del> $request = new ServerRequest([ <del> 'environment' => [ <del> 'HTTP_ACCEPT_LANGUAGE' => 'en-GB;q=0.8,es-ES;q=0.9,da-DK;q=0.4' <del> ] <del> ]); <del> $filter->beforeDispatch(new Event('name', null, ['request' => $request])); <del> $this->assertEquals('en_US', I18n::getLocale()); <del> } <del>} <ide><path>tests/TestCase/Routing/Filter/RoutingFilterTest.php <del><?php <del>/** <del> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <del> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * <del> * Licensed under The MIT License <del> * For full copyright and license information, please see the LICENSE.txt <del> * Redistributions of files must retain the above copyright notice. <del> * <del> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * @link https://cakephp.org CakePHP(tm) Project <del> * @since 3.0.0 <del> * @license https://opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\Test\TestCase\Routing\Filter; <del> <del>use Cake\Event\Event; <del>use Cake\Http\Response; <del>use Cake\Http\ServerRequest; <del>use Cake\Routing\Filter\RoutingFilter; <del>use Cake\Routing\Router; <del>use Cake\TestSuite\TestCase; <del> <del>/** <del> * Routing filter test. <del> * <del> * @group deprecated <del> */ <del>class RoutingFilterTest extends TestCase <del>{ <del> <del> /** <del> * test setting parameters in beforeDispatch method <del> * <del> * @return void <del> * @triggers __CLASS__ $this, compact(request) <del> */ <del> public function testBeforeDispatchSkipWhenControllerSet() <del> { <del> $filter = new RoutingFilter(); <del> <del> $request = new ServerRequest([ <del> 'url' => '/testcontroller/testaction/params1/params2/params3', <del> 'params' => ['controller' => 'articles'] <del> ]); <del> $event = new Event(__CLASS__, $this, compact('request')); <del> $filter->beforeDispatch($event); <del> <del> $this->assertSame($request->getParam('controller'), 'articles'); <del> $this->assertEmpty($request->getParam('action')); <del> } <del> <del> /** <del> * test setting parameters in beforeDispatch method <del> * <del> * @return void <del> * @triggers __CLASS__ $this, compact(request) <del> */ <del> public function testBeforeDispatchSetsParameters() <del> { <del> $this->deprecated(function () { <del> Router::connect('/:controller/:action/*'); <del> $filter = new RoutingFilter(); <del> <del> $request = new ServerRequest('/testcontroller/testaction/params1/params2/params3'); <del> $event = new Event(__CLASS__, $this, compact('request')); <del> $filter->beforeDispatch($event); <del> <del> $this->assertSame($request->getParam('controller'), 'testcontroller'); <del> $this->assertSame($request->getParam('action'), 'testaction'); <del> $this->assertSame($request->getParam('pass.0'), 'params1'); <del> $this->assertSame($request->getParam('pass.1'), 'params2'); <del> $this->assertSame($request->getParam('pass.2'), 'params3'); <del> }); <del> } <del> <del> /** <del> * test setting parameters in beforeDispatch method <del> * <del> * @return void <del> * @triggers __CLASS__ $this, compact(request) <del> */ <del> public function testBeforeDispatchRedirectRoute() <del> { <del> Router::scope('/', function ($routes) { <del> $routes->redirect('/home', ['controller' => 'articles']); <del> $routes->connect('/:controller/:action/*'); <del> }); <del> $filter = new RoutingFilter(); <del> <del> $request = new ServerRequest('/home'); <del> $response = new Response(); <del> $event = new Event(__CLASS__, $this, compact('request', 'response')); <del> $response = $filter->beforeDispatch($event); <del> $this->assertInstanceOf('Cake\Http\Response', $response); <del> $this->assertSame('http://localhost/articles', $response->getHeaderLine('Location')); <del> $this->assertSame(301, $response->getStatusCode()); <del> $this->assertTrue($event->isStopped()); <del> } <del> <del> /** <del> * test setting parameters in beforeDispatch method <del> * <del> * @return void <del> * @triggers __CLASS__ $this, compact(request) <del> * @triggers __CLASS__ $this, compact(request) <del> */ <del> public function testQueryStringOnRoot() <del> { <del> $this->deprecated(function () { <del> Router::reload(); <del> Router::connect('/', ['controller' => 'pages', 'action' => 'display', 'home']); <del> Router::connect('/pages/*', ['controller' => 'pages', 'action' => 'display']); <del> Router::connect('/:controller/:action/*'); <del> <del> $_GET = ['coffee' => 'life', 'sleep' => 'sissies']; <del> $filter = new RoutingFilter(); <del> $request = new ServerRequest('posts/home/?coffee=life&sleep=sissies'); <del> <del> $event = new Event(__CLASS__, $this, compact('request')); <del> $filter->beforeDispatch($event); <del> <del> $this->assertRegExp('/posts/', $request->getParam('controller')); <del> $this->assertRegExp('/home/', $request->getParam('action')); <del> $this->assertSame('sissies', $request->getQuery('sleep')); <del> $this->assertSame('life', $request->getQuery('coffee')); <del> <del> $request = new ServerRequest('/?coffee=life&sleep=sissy'); <del> <del> $event = new Event(__CLASS__, $this, compact('request')); <del> $filter->beforeDispatch($event); <del> <del> $this->assertRegExp('/pages/', $request->getParam('controller')); <del> $this->assertRegExp('/display/', $request->getParam('action')); <del> $this->assertSame('sissy', $request->getQuery('sleep')); <del> $this->assertSame('life', $request->getQuery('coffee')); <del> $this->assertEquals('life', $request->getQuery('coffee')); <del> }); <del> } <del>} <ide><path>tests/TestCase/Routing/RequestActionTraitTest.php <del><?php <del>/** <del> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <del> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * <del> * Licensed under The MIT License <del> * Redistributions of files must retain the above copyright notice. <del> * <del> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * @link https://cakephp.org CakePHP(tm) Project <del> * @since 3.0.0 <del> * @license https://opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\Test\TestCase\Routing; <del> <del>use Cake\Core\Configure; <del>use Cake\Core\Plugin; <del>use Cake\Http\ServerRequest; <del>use Cake\Http\Session; <del>use Cake\Routing\DispatcherFactory; <del>use Cake\Routing\Router; <del>use Cake\TestSuite\TestCase; <del>use Cake\Utility\Security; <del> <del>/** <del> * @group deprecated <del> */ <del>class RequestActionTraitTest extends TestCase <del>{ <del> /** <del> * fixtures <del> * <del> * @var string <del> */ <del> public $fixtures = ['core.comments', 'core.posts', 'core.test_plugin_comments']; <del> <del> /** <del> * Setup <del> * <del> * @return void <del> */ <del> public function setUp() <del> { <del> parent::setUp(); <del> static::setAppNamespace(); <del> Security::setSalt('not-the-default'); <del> DispatcherFactory::clear(); <del> DispatcherFactory::add('Routing'); <del> DispatcherFactory::add('ControllerFactory'); <del> $this->object = $this->getObjectForTrait('Cake\Routing\RequestActionTrait'); <del> Router::connect('/request_action/:action/*', ['controller' => 'RequestAction']); <del> Router::connect('/tests_apps/:action/*', ['controller' => 'TestsApps']); <del> <del> $this->errorLevel = error_reporting(); <del> error_reporting(E_ALL ^ E_USER_DEPRECATED); <del> } <del> <del> /** <del> * teardown <del> * <del> * @return void <del> */ <del> public function tearDown() <del> { <del> parent::tearDown(); <del> DispatcherFactory::clear(); <del> Router::reload(); <del> <del> error_reporting($this->errorLevel); <del> } <del> <del> /** <del> * testRequestAction method <del> * <del> * @return void <del> */ <del> public function testRequestAction() <del> { <del> $this->assertNull(Router::getRequest(), 'request stack should be empty.'); <del> <del> $result = $this->object->requestAction(''); <del> $this->assertFalse($result); <del> $this->assertNull(Router::getRequest(), 'requests were not popped off the stack, this will break url generation'); <del> <del> $result = $this->object->requestAction('/request_action/test_request_action'); <del> $expected = 'This is a test'; <del> $this->assertEquals($expected, $result); <del> $this->assertNull(Router::getRequest(), 'requests were not popped off the stack, this will break url generation'); <del> <del> $result = $this->object->requestAction(Configure::read('App.fullBaseUrl') . '/request_action/test_request_action'); <del> $expected = 'This is a test'; <del> $this->assertEquals($expected, $result); <del> $this->assertNull(Router::getRequest(), 'requests were not popped off the stack, this will break url generation'); <del> <del> $result = $this->object->requestAction('/request_action/another_ra_test/2/5'); <del> $expected = 7; <del> $this->assertEquals($expected, $result); <del> $this->assertNull(Router::getRequest(), 'requests were not popped off the stack, this will break url generation'); <del> <del> $result = $this->object->requestAction('/tests_apps/index', ['return']); <del> $expected = 'This is the TestsAppsController index view '; <del> $this->assertEquals($expected, $result); <del> $this->assertNull(Router::getRequest(), 'requests were not popped off the stack, this will break url generation'); <del> <del> $result = $this->object->requestAction('/tests_apps/some_method'); <del> $expected = 5; <del> $this->assertEquals($expected, $result); <del> $this->assertNull(Router::getRequest(), 'requests were not popped off the stack, this will break url generation'); <del> <del> $result = $this->object->requestAction('/request_action/paginate_request_action'); <del> $this->assertNull($result); <del> $this->assertNull(Router::getRequest(), 'requests were not popped off the stack, this will break url generation'); <del> <del> $result = $this->object->requestAction('/request_action/normal_request_action'); <del> $expected = 'Hello World'; <del> $this->assertEquals($expected, $result); <del> <del> $this->assertNull(Router::getRequest(), 'requests were not popped off the stack, this will break url generation'); <del> } <del> <del> /** <del> * test requestAction() and plugins. <del> * <del> * @return void <del> */ <del> public function testRequestActionPlugins() <del> { <del> Plugin::load('TestPlugin'); <del> Router::reload(); <del> Router::connect('/test_plugin/tests/:action/*', ['controller' => 'Tests', 'plugin' => 'TestPlugin']); <del> <del> $result = $this->object->requestAction('/test_plugin/tests/index', ['return']); <del> $expected = 'test plugin index'; <del> $this->assertEquals($expected, $result); <del> <del> $result = $this->object->requestAction('/test_plugin/tests/index/some_param', ['return']); <del> $expected = 'test plugin index'; <del> $this->assertEquals($expected, $result); <del> <del> $result = $this->object->requestAction( <del> ['controller' => 'Tests', 'action' => 'index', 'plugin' => 'TestPlugin'], <del> ['return'] <del> ); <del> $expected = 'test plugin index'; <del> $this->assertEquals($expected, $result); <del> <del> $result = $this->object->requestAction('/test_plugin/tests/some_method'); <del> $expected = 25; <del> $this->assertEquals($expected, $result); <del> <del> $result = $this->object->requestAction( <del> ['controller' => 'Tests', 'action' => 'some_method', 'plugin' => 'TestPlugin'] <del> ); <del> $expected = 25; <del> $this->assertEquals($expected, $result); <del> } <del> <del> /** <del> * test requestAction() with arrays. <del> * <del> * @return void <del> */ <del> public function testRequestActionArray() <del> { <del> Plugin::load(['TestPlugin']); <del> <del> $result = $this->object->requestAction( <del> ['controller' => 'RequestAction', 'action' => 'test_request_action'] <del> ); <del> $expected = 'This is a test'; <del> $this->assertEquals($expected, $result); <del> <del> $result = $this->object->requestAction( <del> ['controller' => 'RequestAction', 'action' => 'another_ra_test'], <del> ['pass' => ['5', '7']] <del> ); <del> $expected = 12; <del> $this->assertEquals($expected, $result); <del> <del> $result = $this->object->requestAction( <del> ['controller' => 'TestsApps', 'action' => 'index'], <del> ['return'] <del> ); <del> $expected = 'This is the TestsAppsController index view '; <del> $this->assertEquals($expected, $result); <del> <del> $result = $this->object->requestAction(['controller' => 'TestsApps', 'action' => 'some_method']); <del> $expected = 5; <del> $this->assertEquals($expected, $result); <del> <del> $result = $this->object->requestAction( <del> ['controller' => 'RequestAction', 'action' => 'normal_request_action'] <del> ); <del> $expected = 'Hello World'; <del> $this->assertEquals($expected, $result); <del> <del> $result = $this->object->requestAction( <del> ['controller' => 'RequestAction', 'action' => 'paginate_request_action'] <del> ); <del> $this->assertNull($result); <del> <del> $result = $this->object->requestAction( <del> ['controller' => 'RequestAction', 'action' => 'paginate_request_action'], <del> ['pass' => [5]] <del> ); <del> $this->assertNull($result); <del> } <del> <del> /** <del> * Test that the required parameter names are seeded by requestAction. <del> * <del> * @return void <del> */ <del> public function testRequestActionArraySetParamNames() <del> { <del> $result = $this->object->requestAction( <del> ['controller' => 'RequestAction', 'action' => 'params_pass'] <del> ); <del> $result = json_decode($result, true); <del> $this->assertArrayHasKey('action', $result['params']); <del> $this->assertArrayHasKey('controller', $result['params']); <del> $this->assertArrayHasKey('plugin', $result['params']); <del> } <del> <del> /** <del> * Test that requestAction() does not forward the 0 => return value. <del> * <del> * @return void <del> */ <del> public function testRequestActionRemoveReturnParam() <del> { <del> $result = $this->object->requestAction( <del> '/request_action/param_check', <del> ['return'] <del> ); <del> $this->assertEquals('', $result, 'Return key was found'); <del> } <del> <del> /** <del> * Test that requestAction() is populating $this->params properly <del> * <del> * @return void <del> */ <del> public function testRequestActionParamParseAndPass() <del> { <del> $result = $this->object->requestAction('/request_action/params_pass'); <del> $result = json_decode($result, true); <del> $this->assertEquals('/request_action/params_pass', $result['url']); <del> $this->assertEquals('RequestAction', $result['params']['controller']); <del> $this->assertEquals('params_pass', $result['params']['action']); <del> $this->assertNull($result['params']['plugin']); <del> } <del> <del> /** <del> * Test that requestAction() is populates the base and webroot properties properly <del> * <del> * @return void <del> */ <del> public function testRequestActionBaseAndWebroot() <del> { <del> $request = new ServerRequest([ <del> 'base' => '/subdir', <del> 'webroot' => '/subdir/' <del> ]); <del> Router::setRequestInfo($request); <del> $result = $this->object->requestAction('/request_action/params_pass'); <del> $result = json_decode($result, true); <del> $this->assertEquals($request->base, $result['base']); <del> $this->assertEquals($request->webroot, $result['webroot']); <del> } <del> <del> /** <del> * test that requestAction does not fish data out of the POST <del> * superglobal. <del> * <del> * @return void <del> */ <del> public function testRequestActionNoPostPassing() <del> { <del> $_POST = [ <del> 'item' => 'value' <del> ]; <del> $result = $this->object->requestAction(['controller' => 'RequestAction', 'action' => 'post_pass']); <del> $result = json_decode($result, true); <del> $this->assertEmpty($result); <del> <del> $result = $this->object->requestAction( <del> ['controller' => 'RequestAction', 'action' => 'post_pass'], <del> ['post' => $_POST] <del> ); <del> $result = json_decode($result, true); <del> $this->assertEquals($_POST, $result); <del> } <del> <del> /** <del> * test that requestAction() can get query data from the query string and <del> * query option. <del> * <del> * @return void <del> */ <del> public function testRequestActionWithQueryString() <del> { <del> $query = ['page' => 1, 'sort' => 'title']; <del> $result = $this->object->requestAction( <del> ['controller' => 'RequestAction', 'action' => 'query_pass'], <del> ['query' => $query] <del> ); <del> $result = json_decode($result, true); <del> $this->assertEquals($query, $result); <del> <del> $result = $this->object->requestAction([ <del> 'controller' => 'RequestAction', <del> 'action' => 'query_pass', <del> '?' => $query <del> ]); <del> $result = json_decode($result, true); <del> $this->assertEquals($query, $result); <del> <del> $result = $this->object->requestAction( <del> '/request_action/query_pass?page=3&sort=body' <del> ); <del> $result = json_decode($result, true); <del> $expected = ['page' => 3, 'sort' => 'body']; <del> $this->assertEquals($expected, $result); <del> } <del> <del> /** <del> * Test requestAction with post data. <del> * <del> * @return void <del> */ <del> public function testRequestActionPostWithData() <del> { <del> $data = [ <del> 'Post' => ['id' => 2] <del> ]; <del> $result = $this->object->requestAction( <del> ['controller' => 'RequestAction', 'action' => 'post_pass'], <del> ['post' => $data] <del> ); <del> $result = json_decode($result, true); <del> $this->assertEquals($data, $result); <del> <del> $result = $this->object->requestAction( <del> '/request_action/post_pass', <del> ['post' => $data] <del> ); <del> $result = json_decode($result, true); <del> $this->assertEquals($data, $result); <del> } <del> <del> /** <del> * Test that requestAction handles get parameters correctly. <del> * <del> * @return void <del> */ <del> public function testRequestActionGetParameters() <del> { <del> $result = $this->object->requestAction( <del> '/request_action/params_pass?get=value&limit=5' <del> ); <del> $result = json_decode($result, true); <del> $this->assertEquals('value', $result['query']['get']); <del> <del> $result = $this->object->requestAction( <del> ['controller' => 'RequestAction', 'action' => 'params_pass'], <del> ['query' => ['get' => 'value', 'limit' => 5]] <del> ); <del> $result = json_decode($result, true); <del> $this->assertEquals('value', $result['query']['get']); <del> } <del> <del> /** <del> * Test that requestAction handles cookies correctly. <del> * <del> * @return void <del> */ <del> public function testRequestActionCookies() <del> { <del> $cookies = [ <del> 'foo' => 'bar' <del> ]; <del> $result = $this->object->requestAction( <del> '/request_action/cookie_pass', <del> ['cookies' => $cookies] <del> ); <del> $result = json_decode($result, true); <del> $this->assertEquals($cookies, $result); <del> } <del> <del> /** <del> * Test that environment overrides can be set. <del> * <del> * @return void <del> */ <del> public function testRequestActionEnvironment() <del> { <del> $result = $this->object->requestAction('/request_action/params_pass'); <del> $result = json_decode($result, true); <del> $this->assertEquals('', $result['contentType'], 'Original content type not found.'); <del> <del> $result = $this->object->requestAction( <del> '/request_action/params_pass', <del> ['environment' => ['CONTENT_TYPE' => 'application/json']] <del> ); <del> $result = json_decode($result, true); <del> $this->assertEquals('application/json', $result['contentType']); <del> } <del> <del> /** <del> * Tests that it is possible to transmit the session for the request <del> * <del> * @return void <del> */ <del> public function testRequestActionSession() <del> { <del> $result = $this->object->requestAction('/request_action/session_test'); <del> $this->assertNull($result); <del> <del> $session = $this->getMockBuilder(Session::class)->getMock(); <del> $session->expects($this->once()) <del> ->method('read') <del> ->with('foo') <del> ->will($this->returnValue('bar')); <del> $result = $this->object->requestAction( <del> '/request_action/session_test', <del> ['session' => $session] <del> ); <del> $this->assertEquals('bar', $result); <del> } <del> <del> /** <del> * requestAction relies on both the RoutingFilter and ControllerFactory <del> * filters being connected. Ensure it can correct the missing state. <del> * <del> * @return void <del> */ <del> public function testRequestActionAddsRequiredFilters() <del> { <del> DispatcherFactory::clear(); <del> <del> $result = $this->object->requestAction('/request_action/test_request_action'); <del> $expected = 'This is a test'; <del> $this->assertEquals($expected, $result); <del> } <del>}
16
Text
Text
fix typo in custom-webpack-config docs
193ffe7616ed1e1578eea817d8808e9f556f6055
<ide><path>docs/api-reference/next.config.js/custom-webpack-config.md <ide> description: Extend the default webpack config added by Next.js. <ide> <ide> # Custom Webpack Config <ide> <del>Before continuing to add custom webpack configuration your application make sure Next.js doesn't already support your use-case: <add>Before continuing to add custom webpack configuration to your application make sure Next.js doesn't already support your use-case: <ide> <ide> - [CSS imports](/docs/basic-features/built-in-css-support#adding-a-global-stylesheet) <ide> - [CSS modules](/docs/basic-features/built-in-css-support#adding-component-level-css)
1
Ruby
Ruby
fix flaky activestorage test
948e9d74e31bb25b67e60ba1cdc59edebb2fb640
<ide><path>activestorage/lib/active_storage/fixture_set.rb <ide> class FixtureSet <ide> # # tests/fixtures/action_text/blobs.yml <ide> # second_thumbnail_blob: <%= ActiveStorage::FixtureSet.blob( <ide> # filename: "second.svg", <add> # ) %> <add> # <add> # third_thumbnail_blob: <%= ActiveStorage::FixtureSet.blob( <add> # filename: "third.svg", <ide> # content_type: "image/svg+xml", <add> # service_name: "public" <ide> # ) %> <ide> # <ide> def self.blob(filename:, **attributes) <ide><path>activestorage/test/fixture_set_test.rb <ide> require "database/setup" <ide> <ide> class ActiveStorage::FixtureSetTest < ActiveSupport::TestCase <del> self.fixture_path = File.expand_path("fixtures", __dir__) <del> self.use_transactional_tests = true <del> <ide> fixtures :all <ide> <ide> def test_active_storage_blob <ide><path>activestorage/test/models/attachment_test.rb <ide> class ActiveStorage::AttachmentTest < ActiveSupport::TestCase <ide> blob = create_blob <ide> @user.avatar.attach(blob) <ide> <del> signed_id_generated_old_way = ActiveStorage.verifier.generate(@user.avatar.id, purpose: :blob_id) <add> signed_id_generated_old_way = ActiveStorage.verifier.generate(@user.avatar.blob.id, purpose: :blob_id) <ide> assert_equal blob, ActiveStorage::Blob.find_signed!(signed_id_generated_old_way) <ide> end <ide> <ide><path>activestorage/test/test_helper.rb <ide> class ActiveSupport::TestCase <ide> <ide> include ActiveRecord::TestFixtures <ide> <add> self.fixture_path = File.expand_path("fixtures", __dir__) <add> <ide> setup do <ide> ActiveStorage::Current.host = "https://example.com" <ide> end
4
Javascript
Javascript
fix unsafe array iteration
c0e66e3e9d74d514e3ef8a06a652f45458d98d20
<ide><path>lib/internal/timers.js <ide> const { <ide> NumberMIN_SAFE_INTEGER, <ide> ObjectCreate, <ide> Symbol, <add> ReflectApply, <ide> } = primordials; <ide> <ide> const { <ide> function getTimerCallbacks(runNextTicks) { <ide> if (args === undefined) <ide> timer._onTimeout(); <ide> else <del> timer._onTimeout(...args); <add> ReflectApply(timer._onTimeout, timer, args); <ide> } finally { <ide> if (timer._repeat && timer._idleTimeout !== -1) { <ide> timer._idleTimeout = timer._repeat;
1
Javascript
Javascript
add d3.interpolators registry
40ba7913e0540a0a2f31445addf80209a35d5299
<ide><path>d3.js <ide> function d3_ease_bounce(t) { <ide> } <ide> d3.event = null; <ide> d3.interpolate = function(a, b) { <del> if (typeof b === "number") return d3.interpolateNumber(+a, b); <del> if (typeof b === "string") { <del> return (b in d3_rgb_names) || /^(#|rgb\(|hsl\()/.test(b) <del> ? d3.interpolateRgb(String(a), b) <del> : d3.interpolateString(String(a), b); <del> } <del> if (b instanceof Array) return d3.interpolateArray(a, b); <del> return d3.interpolateObject(a, b); <add> var i = d3.interpolators.length, f; <add> while (--i >= 0 && !(f = d3.interpolators[i](a, b))); <add> return f; <ide> }; <ide> <ide> d3.interpolateNumber = function(a, b) { <ide> function d3_interpolateByName(n) { <ide> ? d3.interpolateRgb <ide> : d3.interpolate; <ide> } <add> <add>d3.interpolators = [ <add> d3.interpolateObject, <add> function(a, b) { return (b instanceof Array) && d3.interpolateArray(a, b); }, <add> function(a, b) { return (typeof b === "string") && d3.interpolateString(String(a), b); }, <add> function(a, b) { return (b in d3_rgb_names || /^(#|rgb\(|hsl\()/.test(b)) && d3.interpolateRgb(String(a), b); }, <add> function(a, b) { return (typeof b === "number") && d3.interpolateNumber(+a, b); } <add>]; <ide> function d3_uninterpolateNumber(a, b) { <ide> b = 1 / (b - (a = +a)); <ide> return function(x) { return (x - a) * b; }; <ide><path>d3.min.js <del>(function(){function ce(){return"circle"}function cd(){return 64}function cc(a,b){var c=(a.ownerSVGElement||a).createSVGPoint();if(cb<0&&(window.scrollX||window.scrollY)){var d=d3.select(document.body).append("svg:svg").style("position","absolute").style("top",0).style("left",0),e=d[0][0].getScreenCTM();cb=!e.f&&!e.e,d.remove()}cb?(c.x=b.pageX,c.y=b.pageY):(c.x=b.clientX,c.y=b.clientY),c=c.matrixTransform(a.getScreenCTM().inverse());return[c.x,c.y]}function ca(a){return[a.x,a.y]}function b_(a){return a.endAngle}function b$(a){return a.startAngle}function bZ(a){return a.radius}function bY(a){return a.target}function bX(a){return a.source}function bW(){return 0}function bV(a){return a.length<3?bC(a):a[0]+bI(a,bU(a))}function bU(a){var b=[],c,d,e,f,g=bT(a),h=-1,i=a.length-1;while(++h<i)c=bS(a[h],a[h+1]),Math.abs(c)<1e-6?g[h]=g[h+1]=0:(d=g[h]/c,e=g[h+1]/c,f=d*d+e*e,f>9&&(f=c*3/Math.sqrt(f),g[h]=f*d,g[h+1]=f*e));h=-1;while(++h<=i)f=(a[Math.min(i,h+1)][0]-a[Math.max(0,h-1)][0])/(6*(1+g[h]*g[h])),b.push([f||0,g[h]*f||0]);return b}function bT(a){var b=0,c=a.length-1,d=[],e=a[0],f=a[1],g=d[0]=bS(e,f);while(++b<c)d[b]=g+(g=bS(e=f,f=a[b+1]));d[b]=g;return d}function bS(a,b){return(b[1]-a[1])/(b[0]-a[0])}function bR(a,b,c){a.push("C",bN(bO,b),",",bN(bO,c),",",bN(bP,b),",",bN(bP,c),",",bN(bQ,b),",",bN(bQ,c))}function bN(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function bM(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=[bN(bQ,g),",",bN(bQ,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),bR(b,g,h);return b.join("")}function bL(a){if(a.length<4)return bC(a);var b=[],c=-1,d=a.length,e,f=[0],g=[0];while(++c<3)e=a[c],f.push(e[0]),g.push(e[1]);b.push(bN(bQ,f)+","+bN(bQ,g)),--c;while(++c<d)e=a[c],f.shift(),f.push(e[0]),g.shift(),g.push(e[1]),bR(b,f,g);return b.join("")}function bK(a){if(a.length<3)return bC(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),bR(b,h,i);while(++c<d)e=a[c],h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),bR(b,h,i);c=-1;while(++c<2)h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),bR(b,h,i);return b.join("")}function bJ(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 bI(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return bC(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 bH(a,b,c){return a.length<3?bC(a):a[0]+bI(a,bJ(a,b))}function bG(a,b){return a.length<3?bC(a):a[0]+bI((a.push(a[0]),a),bJ([a[a.length-2]].concat(a,[a[1]]),b))}function bF(a,b){return a.length<4?bC(a):a[1]+bI(a.slice(1,a.length-1),bJ(a,b))}function bE(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 bD(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 bC(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 bA(a){return a[1]}function bz(a){return a[0]}function by(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 bx(a){return a.endAngle}function bw(a){return a.startAngle}function bv(a){return a.outerRadius}function bu(a){return a.innerRadius}function bn(a){return function(b){return-Math.pow(-b,a)}}function bm(a){return function(b){return Math.pow(b,a)}}function bl(a){return-Math.log(-a)/Math.LN10}function bk(a){return Math.log(a)/Math.LN10}function bj(a,b,c,d){var e=[],f=[],g=0,h=a.length;while(++g<h)e.push(c(a[g-1],a[g])),f.push(d(b[g-1],b[g]));return function(b){var c=d3.bisect(a,b,1,a.length-1)-1;return f[c](e[c](b))}}function bi(a,b,c,d){var e=c(a[0],a[1]),f=d(b[0],b[1]);return function(a){return f(e(a))}}function bg(){var a=null,b=bb,c=Infinity;while(b)b.flush?b=a?a.next=b.next:bb=b.next:(c=Math.min(c,b.then+b.delay),b=(a=b).next);return c}function bf(){var a,b=Date.now(),c=bb;while(c)a=b-c.then,a>c.delay&&(c.flush=c.callback(a)),c=c.next;var d=bg()-b;d>24?(isFinite(d)&&(clearTimeout(bd),bd=setTimeout(bf,d)),bc=0):(bc=1,bh(bf))}function be(a,b){var c=Date.now(),d=!1,e,f=bb;if(!!isFinite(b)){while(f){if(f.callback===a){f.then=c,f.delay=b,d=!0;break}e=f,f=f.next}d||(bb={callback:a,then:c,delay:b,next:bb}),bc||(bd=clearTimeout(bd),bc=1,bh(bf))}}function ba(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 _(a){function n(b){var h=!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){h=!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,g.start.dispatch.apply(this,arguments),q=e[l]={},n.active=c;for(p in d)if(o=d[p].apply(this,arguments))q[p]=o}o=m(a);for(p in q)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)),$=c,g.end.dispatch.apply(this,arguments),$=0,n.owner=r}}}});return h}var b={},c=$||++Z,d={},e=[],f=!1,g=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})),be(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,ba(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,ba(c),d)},b.text=function(a){d.text=function(b,c){this.textContent=typeof a=="function"?a.call(this,b,c):a};return b},b.select=function(b){var c,d=_(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=_(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){g[a].add(c);return b},b.call=h;return b.delay(0).duration(250)}function Y(a){return{__data__:a}}function X(a){arguments.length||(a=d3.ascending);return function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function W(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 V(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),S(c,b))}function d(b){return b.insertBefore(document.createElement(a),S(c,b))}a=d3.ns.qualify(a);return b(a.local?e:d)};return a}function V(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 V(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 V(c)}a.select=function(a){return b(function(b){return S(a,b)})},a.selectAll=function(a){return c(function(b){return T(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 V(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]=Y(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]=Y(p),l[g]=n[g]=null);for(;g<i;g++)m[g]=Y(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=V(e);k.enter=function(){return W(d)},k.exit=function(){return V(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)?f:h).call(this)}function h(){if(a=this.classList)return a.remove(b);var a=this.className,c=a.baseVal!=null,d=c?a.baseVal:a;d=g(d.replace(e," ")),c?a.baseVal=d:this.className=d}function f(){if(a=this.classList)return a.add(b);var a=this.className,c=a.baseVal!=null,d=c?a.baseVal:a;e.lastIndex=0,e.test(d)||(d=g(d+" "+b),c?a.baseVal=d:this.className=d)}var e=new RegExp("(^|\\s+)"+d3.requote(b)+"(\\s+|$)","g");if(arguments.length<2)return d(function(){if(a=this.classList)return a.contains(b);var a=this.className;e.lastIndex=0;return e.test(a.baseVal!=null?a.baseVal:a)});return a.each(typeof c=="function"?i:c?f: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="");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 e(){this.textContent=b.apply(this,arguments)}function c(){this.textContent=b}if(arguments.length<1)return d(function(){return this.textContent});return a.each(typeof b=="function"?e:c)},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),S(c,b))}function d(b){return b.insertBefore(document.createElement(a),S(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=X.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,d){arguments.length<3&&(d=!1);var e=b.indexOf("."),f=e===-1?b:b.substring(0,e),g="__on"+b;return a.each(function(a,b){function h(a){var d=d3.event;d3.event=a;try{c.call(this,e.__data__,b)}finally{d3.event=d}}this[g]&&this.removeEventListener(f,this[g],d),c&&this.addEventListener(f,this[g]=h,d);var e=this})},a.transition=function(){return _(a)},a.call=h;return a}function R(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 H(g(a+120),g(a),g(a-120))}function Q(a,b,c){this.h=a,this.s=b,this.l=c}function P(a,b,c){return new Q(a,b,c)}function M(a){var b=parseFloat(a);return a.charAt(a.length-1)==="%"?Math.round(b*2.55):b}function L(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 P(g,h,i)}function K(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(M(h[0]),M(h[1]),M(h[2]))}}if(i=N[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 J(a){return a<16?"0"+a.toString(16):a.toString(16)}function I(a,b,c){this.r=a,this.g=b,this.b=c}function H(a,b,c){return new I(a,b,c)}function G(a,b){b=1/(b-(a=+a));return function(c){return Math.max(0,Math.min(1,(c-a)*b))}}function F(a,b){b=1/(b-(a=+a));return function(c){return(c-a)*b}}function E(a){return a in D||/\bcolor\b/.test(a)?d3.interpolateRgb:d3.interpolate}function B(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 A(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}}function z(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 y(a){return 1-Math.sqrt(1-a*a)}function x(a){return a?Math.pow(2,10*(a-1))-.001:0}function w(a){return 1-Math.cos(a*Math.PI/2)}function v(a){return function(b){return Math.pow(b,a)}}function u(a){return a}function t(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function s(a){return function(b){return 1-a(1-b)}}function n(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 m(a){return a+""}function j(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 h(a){a.apply(this,(arguments[0]=this,arguments));return this}function g(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function f(a){return a==null}function e(a){return a.length}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.19.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=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&e>f&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&e>f&&(e=f)}return e},d3.max=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&f>e&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&f>e&&(e=f)}return e},d3.zip=function(){if(!(f=arguments.length))return[];for(var a=-1,b=d3.min(arguments,e),c=Array(b);++a<b;)for(var d=-1,f,g=c[a]=Array(f);++d<f;)g[d]=arguments[d][a];return c},d3.bisectLeft=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;a[e]<b?c=e+1:d=e}return c},d3.bisect=d3.bisectRight=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;b<a[e]?d=e:c=e+1}return c},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.permute=function(a,b){var c=[],d=-1,e=b.length;while(++d<e)c[d]=a[b[d]];return c},d3.merge=function(a){return Array.prototype.concat.apply([],a)},d3.split=function(a,b){var c=[],d=[],e,g=-1,h=a.length;arguments.length<2&&(b=f);while(++g<h)b.call(d,e=a[g],g)?d=[]:(d.length||c.push(d),d.push(e));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(i,"\\$&")};var i=/[\\\^\$\*\+\?\[\]\(\)\.\{\}]/g;d3.round=function(a,b){return b?Math.round(a*Math.pow(10,b))*Math.pow(10,-b):Math.round(a)},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]=j(c);return b},d3.format=function(a){var b=k.exec(a),c=b[1]||" ",d=b[3]||"",e=b[5],f=+b[6],g=b[7],h=b[8],i=b[9],j=!1,o=!1;h&&(h=h.substring(1)),e&&(c="0",g&&(f-=Math.floor((f-1)/4)));switch(i){case"n":g=!0,i="g";break;case"%":j=!0,i="f";break;case"p":j=!0,i="r";break;case"d":o=!0,h="0"}i=l[i]||m;return function(a){var b=j?a*100:+a,k=b<0&&(b=-b)?"−":d;if(o&&b%1)return"";a=i(b,h);if(e){var l=a.length+k.length;l<f&&(a=Array(f-l+1).join(c)+a),g&&(a=n(a)),a=k+a}else{g&&(a=n(a)),a=k+a;var l=a.length;l<f&&(a=Array(f-l+1).join(c)+a)}j&&(a+="%");return a}};var k=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,l={g:function(a,b){return a.toPrecision(b)},e:function(a,b){return a.toExponential(b)},f:function(a,b){return a.toFixed(b)},r:function(a,b){var c=1+Math.floor(1e-15+Math.log(a)/Math.LN10);return d3.round(a,b-c).toFixed(Math.max(0,b-c))}},o=v(2),p=v(3),q={linear:function(){return u},poly:v,quad:function(){return o},cubic:function(){return p},sin:function(){return w},exp:function(){return x},circle:function(){return y},elastic:z,back:A,bounce:function(){return B}},r={"in":function(a){return a},out:s,"in-out":t,"out-in":function(a){return t(s(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 r[d](q[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 N||/^(#|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;C.lastIndex=0;for(d=0;c=C.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=C.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=C.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 R(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]=E(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 C=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,D={background:1,fill:1,stroke:1};d3.rgb=function(a,b,c){return arguments.length===1?K(""+a,H,R):H(~~a,~~b,~~c)},I.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);var b=this.r,c=this.g,d=this.b,e=30;if(!b&&!c&&!d)return H(e,e,e);b&&b<e&&(b=e),c&&c<e&&(c=e),d&&d<e&&(d=e);return H(Math.min(255,Math.floor(b/a)),Math.min(255,Math.floor(c/a)),Math.min(255,Math.floor(d/a)))},I.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return H(Math.max(0,Math.floor(a*this.r)),Math.max(0,Math.floor(a*this.g)),Math.max(0,Math.floor(a*this.b)))},I.prototype.hsl=function(){return L(this.r,this.g,this.b)},I.prototype.toString=function(){return"#"+J(this.r)+J(this.g)+J(this.b)};var N={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 O in N)N[O]=K(N[O],H,R);d3.hsl=function(a,b,c){return arguments.length===1?K(""+a,L,P):P(+a,+b,+c)},Q.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);return P(this.h,this.s,this.l/a)},Q.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return P(this.h,this.s,a*this.l)},Q.prototype.rgb=function(){return R(this.h,this.s,this.l)},Q.prototype.toString=function(){return"hsl("+this.h+","+this.s*100+"%,"+this.l*100+"%)"};var S=function(a,b){return b.querySelector(a)},T=function(b,c){return a(c.querySelectorAll(b))};typeof Sizzle=="function"&&(S=function(a,b){return Sizzle(a,b)[0]},T=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))});var U=V([[document]]);U[0].parentNode=document.documentElement,d3.select=function(a){return typeof a=="string"?U.select(a):V([[a]])},d3.selectAll=function(b){return typeof b=="string"?U.selectAll(b):V([a(b)])},d3.transition=U.transition;var Z=0,$=0,bb=null,bc,bd;d3.timer=function(a){be(a,0)},d3.timer.flush=function(){var a,b=Date.now(),c=bb;while(c)a=b-c.then,c.delay||(c.flush=c.callback(a)),c=c.next;bg()};var bh=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.scale={},d3.scale.linear=function(){function i(b){var c=d3.min(a),d=d3.max(a),e=d-c,f=Math.pow(10,Math.floor(Math.log(e/b)/Math.LN10)),g=b/(e/f);g<=.15?f*=10:g<=.35?f*=5:g<=.75&&(f*=2);return{start:Math.ceil(c/f)*f,stop:Math.floor(d/f)*f+f*.5,step:f}}function h(a){return e(a)}function g(){var g=a.length==2?bi:bj,i=d?G:F;e=g(a,b,i,c),f=g(b,a,i,d3.interpolate);return h}var a=[0,1],b=[0,1],c=d3.interpolate,d=!1,e,f;h.invert=function(a){return f(a)},h.domain=function(b){if(!arguments.length)return a;a=b.map(Number);return g()},h.range=function(a){if(!arguments.length)return b;b=a;return g()},h.rangeRound=function(a){return h.range(a).interpolate(d3.interpolateRound)},h.clamp=function(a){if(!arguments.length)return d;d=a;return g()},h.interpolate=function(a){if(!arguments.length)return c;c=a;return g()},h.ticks=function(a){var b=i(a);return d3.range(b.start,b.stop,b.step)},h.tickFormat=function(a){var b=Math.max(0,-Math.floor(Math.log(i(a).step)/Math.LN10+.01));return d3.format(",."+b+"f")};return g()},d3.scale.log=function(){function d(c){return a(b(c))}var a=d3.scale.linear(),b=bk,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?bl:bk,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.clamp=d3.rebind(d,a.clamp),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===bl){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},bk.pow=function(a){return Math.pow(10,a)},bl.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?bn:bm;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.clamp=d3.rebind(f,a.clamp),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( <del>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(bo)},d3.scale.category20=function(){return d3.scale.ordinal().range(bp)},d3.scale.category20b=function(){return d3.scale.ordinal().range(bq)},d3.scale.category20c=function(){return d3.scale.ordinal().range(br)};var bo=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],bp=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],bq=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],br=["#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 e(a){if(isNaN(a=+a))return NaN;return b[d3.bisect(c,a)]}function d(){var d=0,e=a.length,f=b.length,g;c.length=Math.max(0,f-1);while(++d<f)c[d-1]=(g=e*d/f)%1?a[~~g]:(a[g=~~g]+a[g-1])/2}var a=[],b=[],c=[];e.domain=function(b){if(!arguments.length)return a;a=b.filter(function(a){return!isNaN(a)}).sort(d3.ascending),d();return e},e.range=function(a){if(!arguments.length)return b;b=a,d();return e},e.quantiles=function(){return c};return e},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)+bs,h=d.apply(this,arguments)+bs,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>=bt?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=bu,b=bv,c=bw,d=bx;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+bs;return[Math.cos(f)*e,Math.sin(f)*e]};return e};var bs=-Math.PI/2,bt=2*Math.PI-1e-6;d3.svg.line=function(){function f(c){return c.length<1?null:"M"+d(by(this,c,a,b),e)}var a=bz,b=bA,c="linear",d=bB[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=bB[c=a];return f},f.tension=function(a){if(!arguments.length)return e;e=a;return f};return f};var bB={linear:bC,"step-before":bD,"step-after":bE,basis:bK,"basis-open":bL,"basis-closed":bM,cardinal:bH,"cardinal-open":bF,"cardinal-closed":bG,monotone:bV},bO=[0,2/3,1/3,0],bP=[0,1/3,2/3,0],bQ=[0,1/6,2/3,1/6];d3.svg.area=function(){function g(d){return d.length<1?null:"M"+e(by(this,d,a,c),f)+"L"+e(by(this,d,a,b).reverse(),f)+"Z"}var a=bz,b=bW,c=bA,d="linear",e=bB[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=bB[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)+bs,k=e.call(a,h,g)+bs;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=bX,b=bY,c=bZ,d=bw,e=bx;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.diagonal=function(){function d(d,e){var f=a.call(this,d,e),g=b.call(this,d,e),h=(f.y+g.y)/2,i=[f,{x:f.x,y:h},{x:g.x,y:h},g];i=i.map(c);return"M"+i[0]+"C"+i[1]+" "+i[2]+" "+i[3]}var a=bX,b=bY,c=ca;d.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return d},d.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return d},d.projection=function(a){if(!arguments.length)return c;c=a;return d};return d},d3.svg.mouse=function(a){return cc(a,d3.event)};var cb=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.touches=function(b){var c=d3.event.touches;return c?a(c).map(function(a){var c=cc(b,a);c.identifier=a.identifier;return c}):[]},d3.svg.symbol=function(){function c(c,d){return(cf[a.call(this,c,d)]||cf.circle)(b.call(this,c,d))}var a=ce,b=cd;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 cf={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*ch)),c=b*ch;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/cg),c=b*cg/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.sqrt(a/cg),c=b*cg/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}},cg=Math.sqrt(3),ch=Math.tan(30*Math.PI/180)})() <ide>\ No newline at end of file <add>(function(){function ce(){return"circle"}function cd(){return 64}function cc(a,b){var c=(a.ownerSVGElement||a).createSVGPoint();if(cb<0&&(window.scrollX||window.scrollY)){var d=d3.select(document.body).append("svg:svg").style("position","absolute").style("top",0).style("left",0),e=d[0][0].getScreenCTM();cb=!e.f&&!e.e,d.remove()}cb?(c.x=b.pageX,c.y=b.pageY):(c.x=b.clientX,c.y=b.clientY),c=c.matrixTransform(a.getScreenCTM().inverse());return[c.x,c.y]}function ca(a){return[a.x,a.y]}function b_(a){return a.endAngle}function b$(a){return a.startAngle}function bZ(a){return a.radius}function bY(a){return a.target}function bX(a){return a.source}function bW(){return 0}function bV(a){return a.length<3?bC(a):a[0]+bI(a,bU(a))}function bU(a){var b=[],c,d,e,f,g=bT(a),h=-1,i=a.length-1;while(++h<i)c=bS(a[h],a[h+1]),Math.abs(c)<1e-6?g[h]=g[h+1]=0:(d=g[h]/c,e=g[h+1]/c,f=d*d+e*e,f>9&&(f=c*3/Math.sqrt(f),g[h]=f*d,g[h+1]=f*e));h=-1;while(++h<=i)f=(a[Math.min(i,h+1)][0]-a[Math.max(0,h-1)][0])/(6*(1+g[h]*g[h])),b.push([f||0,g[h]*f||0]);return b}function bT(a){var b=0,c=a.length-1,d=[],e=a[0],f=a[1],g=d[0]=bS(e,f);while(++b<c)d[b]=g+(g=bS(e=f,f=a[b+1]));d[b]=g;return d}function bS(a,b){return(b[1]-a[1])/(b[0]-a[0])}function bR(a,b,c){a.push("C",bN(bO,b),",",bN(bO,c),",",bN(bP,b),",",bN(bP,c),",",bN(bQ,b),",",bN(bQ,c))}function bN(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function bM(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=[bN(bQ,g),",",bN(bQ,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),bR(b,g,h);return b.join("")}function bL(a){if(a.length<4)return bC(a);var b=[],c=-1,d=a.length,e,f=[0],g=[0];while(++c<3)e=a[c],f.push(e[0]),g.push(e[1]);b.push(bN(bQ,f)+","+bN(bQ,g)),--c;while(++c<d)e=a[c],f.shift(),f.push(e[0]),g.shift(),g.push(e[1]),bR(b,f,g);return b.join("")}function bK(a){if(a.length<3)return bC(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),bR(b,h,i);while(++c<d)e=a[c],h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),bR(b,h,i);c=-1;while(++c<2)h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),bR(b,h,i);return b.join("")}function bJ(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 bI(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return bC(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 bH(a,b,c){return a.length<3?bC(a):a[0]+bI(a,bJ(a,b))}function bG(a,b){return a.length<3?bC(a):a[0]+bI((a.push(a[0]),a),bJ([a[a.length-2]].concat(a,[a[1]]),b))}function bF(a,b){return a.length<4?bC(a):a[1]+bI(a.slice(1,a.length-1),bJ(a,b))}function bE(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 bD(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 bC(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 bA(a){return a[1]}function bz(a){return a[0]}function by(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 bx(a){return a.endAngle}function bw(a){return a.startAngle}function bv(a){return a.outerRadius}function bu(a){return a.innerRadius}function bn(a){return function(b){return-Math.pow(-b,a)}}function bm(a){return function(b){return Math.pow(b,a)}}function bl(a){return-Math.log(-a)/Math.LN10}function bk(a){return Math.log(a)/Math.LN10}function bj(a,b,c,d){var e=[],f=[],g=0,h=a.length;while(++g<h)e.push(c(a[g-1],a[g])),f.push(d(b[g-1],b[g]));return function(b){var c=d3.bisect(a,b,1,a.length-1)-1;return f[c](e[c](b))}}function bi(a,b,c,d){var e=c(a[0],a[1]),f=d(b[0],b[1]);return function(a){return f(e(a))}}function bg(){var a=null,b=bb,c=Infinity;while(b)b.flush?b=a?a.next=b.next:bb=b.next:(c=Math.min(c,b.then+b.delay),b=(a=b).next);return c}function bf(){var a,b=Date.now(),c=bb;while(c)a=b-c.then,a>c.delay&&(c.flush=c.callback(a)),c=c.next;var d=bg()-b;d>24?(isFinite(d)&&(clearTimeout(bd),bd=setTimeout(bf,d)),bc=0):(bc=1,bh(bf))}function be(a,b){var c=Date.now(),d=!1,e,f=bb;if(!!isFinite(b)){while(f){if(f.callback===a){f.then=c,f.delay=b,d=!0;break}e=f,f=f.next}d||(bb={callback:a,then:c,delay:b,next:bb}),bc||(bd=clearTimeout(bd),bc=1,bh(bf))}}function ba(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 _(a){function n(b){var h=!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){h=!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,g.start.dispatch.apply(this,arguments),q=e[l]={},n.active=c;for(p in d)if(o=d[p].apply(this,arguments))q[p]=o}o=m(a);for(p in q)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)),$=c,g.end.dispatch.apply(this,arguments),$=0,n.owner=r}}}});return h}var b={},c=$||++Z,d={},e=[],f=!1,g=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})),be(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,ba(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,ba(c),d)},b.text=function(a){d.text=function(b,c){this.textContent=typeof a=="function"?a.call(this,b,c):a};return b},b.select=function(b){var c,d=_(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=_(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){g[a].add(c);return b},b.call=h;return b.delay(0).duration(250)}function Y(a){return{__data__:a}}function X(a){arguments.length||(a=d3.ascending);return function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function W(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 V(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),S(c,b))}function d(b){return b.insertBefore(document.createElement(a),S(c,b))}a=d3.ns.qualify(a);return b(a.local?e:d)};return a}function V(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 V(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 V(c)}a.select=function(a){return b(function(b){return S(a,b)})},a.selectAll=function(a){return c(function(b){return T(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 V(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]=Y(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]=Y(p),l[g]=n[g]=null);for(;g<i;g++)m[g]=Y(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=V(e);k.enter=function(){return W(d)},k.exit=function(){return V(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)?f:h).call(this)}function h(){if(a=this.classList)return a.remove(b);var a=this.className,c=a.baseVal!=null,d=c?a.baseVal:a;d=g(d.replace(e," ")),c?a.baseVal=d:this.className=d}function f(){if(a=this.classList)return a.add(b);var a=this.className,c=a.baseVal!=null,d=c?a.baseVal:a;e.lastIndex=0,e.test(d)||(d=g(d+" "+b),c?a.baseVal=d:this.className=d)}var e=new RegExp("(^|\\s+)"+d3.requote(b)+"(\\s+|$)","g");if(arguments.length<2)return d(function(){if(a=this.classList)return a.contains(b);var a=this.className;e.lastIndex=0;return e.test(a.baseVal!=null?a.baseVal:a)});return a.each(typeof c=="function"?i:c?f: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="");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 e(){this.textContent=b.apply(this,arguments)}function c(){this.textContent=b}if(arguments.length<1)return d(function(){return this.textContent});return a.each(typeof b=="function"?e:c)},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),S(c,b))}function d(b){return b.insertBefore(document.createElement(a),S(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=X.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,d){arguments.length<3&&(d=!1);var e=b.indexOf("."),f=e===-1?b:b.substring(0,e),g="__on"+b;return a.each(function(a,b){function h(a){var d=d3.event;d3.event=a;try{c.call(this,e.__data__,b)}finally{d3.event=d}}this[g]&&this.removeEventListener(f,this[g],d),c&&this.addEventListener(f,this[g]=h,d);var e=this})},a.transition=function(){return _(a)},a.call=h;return a}function R(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 H(g(a+120),g(a),g(a-120))}function Q(a,b,c){this.h=a,this.s=b,this.l=c}function P(a,b,c){return new Q(a,b,c)}function M(a){var b=parseFloat(a);return a.charAt(a.length-1)==="%"?Math.round(b*2.55):b}function L(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 P(g,h,i)}function K(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(M(h[0]),M(h[1]),M(h[2]))}}if(i=N[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 J(a){return a<16?"0"+a.toString(16):a.toString(16)}function I(a,b,c){this.r=a,this.g=b,this.b=c}function H(a,b,c){return new I(a,b,c)}function G(a,b){b=1/(b-(a=+a));return function(c){return Math.max(0,Math.min(1,(c-a)*b))}}function F(a,b){b=1/(b-(a=+a));return function(c){return(c-a)*b}}function E(a){return a in D||/\bcolor\b/.test(a)?d3.interpolateRgb:d3.interpolate}function B(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 A(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}}function z(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 y(a){return 1-Math.sqrt(1-a*a)}function x(a){return a?Math.pow(2,10*(a-1))-.001:0}function w(a){return 1-Math.cos(a*Math.PI/2)}function v(a){return function(b){return Math.pow(b,a)}}function u(a){return a}function t(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function s(a){return function(b){return 1-a(1-b)}}function n(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 m(a){return a+""}function j(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 h(a){a.apply(this,(arguments[0]=this,arguments));return this}function g(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function f(a){return a==null}function e(a){return a.length}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.19.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=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&e>f&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&e>f&&(e=f)}return e},d3.max=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&f>e&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&f>e&&(e=f)}return e},d3.zip=function(){if(!(f=arguments.length))return[];for(var a=-1,b=d3.min(arguments,e),c=Array(b);++a<b;)for(var d=-1,f,g=c[a]=Array(f);++d<f;)g[d]=arguments[d][a];return c},d3.bisectLeft=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;a[e]<b?c=e+1:d=e}return c},d3.bisect=d3.bisectRight=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;b<a[e]?d=e:c=e+1}return c},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.permute=function(a,b){var c=[],d=-1,e=b.length;while(++d<e)c[d]=a[b[d]];return c},d3.merge=function(a){return Array.prototype.concat.apply([],a)},d3.split=function(a,b){var c=[],d=[],e,g=-1,h=a.length;arguments.length<2&&(b=f);while(++g<h)b.call(d,e=a[g],g)?d=[]:(d.length||c.push(d),d.push(e));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(i,"\\$&")};var i=/[\\\^\$\*\+\?\[\]\(\)\.\{\}]/g;d3.round=function(a,b){return b?Math.round(a*Math.pow(10,b))*Math.pow(10,-b):Math.round(a)},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]=j(c);return b},d3.format=function(a){var b=k.exec(a),c=b[1]||" ",d=b[3]||"",e=b[5],f=+b[6],g=b[7],h=b[8],i=b[9],j=!1,o=!1;h&&(h=h.substring(1)),e&&(c="0",g&&(f-=Math.floor((f-1)/4)));switch(i){case"n":g=!0,i="g";break;case"%":j=!0,i="f";break;case"p":j=!0,i="r";break;case"d":o=!0,h="0"}i=l[i]||m;return function(a){var b=j?a*100:+a,k=b<0&&(b=-b)?"−":d;if(o&&b%1)return"";a=i(b,h);if(e){var l=a.length+k.length;l<f&&(a=Array(f-l+1).join(c)+a),g&&(a=n(a)),a=k+a}else{g&&(a=n(a)),a=k+a;var l=a.length;l<f&&(a=Array(f-l+1).join(c)+a)}j&&(a+="%");return a}};var k=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,l={g:function(a,b){return a.toPrecision(b)},e:function(a,b){return a.toExponential(b)},f:function(a,b){return a.toFixed(b)},r:function(a,b){var c=1+Math.floor(1e-15+Math.log(a)/Math.LN10);return d3.round(a,b-c).toFixed(Math.max(0,b-c))}},o=v(2),p=v(3),q={linear:function(){return u},poly:v,quad:function(){return o},cubic:function(){return p},sin:function(){return w},exp:function(){return x},circle:function(){return y},elastic:z,back:A,bounce:function(){return B}},r={"in":function(a){return a},out:s,"in-out":t,"out-in":function(a){return t(s(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 r[d](q[c].apply(null,Array.prototype.slice.call(arguments,1)))},d3.event=null,d3.interpolate=function(a,b){var c=d3.interpolators.length,d;while(--c>=0&&!(d=d3.interpolators[c](a,b)));return d},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;C.lastIndex=0;for(d=0;c=C.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=C.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=C.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 R(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]=E(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 C=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,D={background:1,fill:1,stroke:1};d3.interpolators=[d3.interpolateObject,function(a,b){return b instanceof Array&&d3.interpolateArray(a,b)},function(a,b){return typeof b=="string"&&d3.interpolateString(String(a),b)},function(a,b){return(b in N||/^(#|rgb\(|hsl\()/.test(b))&&d3.interpolateRgb(String(a),b)},function(a,b){return typeof b=="number"&&d3.interpolateNumber(+a,b)}],d3.rgb=function(a,b,c){return arguments.length===1?K(""+a,H,R):H(~~a,~~b,~~c)},I.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);var b=this.r,c=this.g,d=this.b,e=30;if(!b&&!c&&!d)return H(e,e,e);b&&b<e&&(b=e),c&&c<e&&(c=e),d&&d<e&&(d=e);return H(Math.min(255,Math.floor(b/a)),Math.min(255,Math.floor(c/a)),Math.min(255,Math.floor(d/a)))},I.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return H(Math.max(0,Math.floor(a*this.r)),Math.max(0,Math.floor(a*this.g)),Math.max(0,Math.floor(a*this.b)))},I.prototype.hsl=function(){return L(this.r,this.g,this.b)},I.prototype.toString=function(){return"#"+J(this.r)+J(this.g)+J(this.b)};var N={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 O in N)N[O]=K(N[O],H,R);d3.hsl=function(a,b,c){return arguments.length===1?K(""+a,L,P):P(+a,+b,+c)},Q.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);return P(this.h,this.s,this.l/a)},Q.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return P(this.h,this.s,a*this.l)},Q.prototype.rgb=function(){return R(this.h,this.s,this.l)},Q.prototype.toString=function(){return"hsl("+this.h+","+this.s*100+"%,"+this.l*100+"%)"};var S=function(a,b){return b.querySelector(a)},T=function(b,c){return a(c.querySelectorAll(b))};typeof Sizzle=="function"&&(S=function(a,b){return Sizzle(a,b)[0]},T=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))});var U=V([[document]]);U[0].parentNode=document.documentElement,d3.select=function(a){return typeof a=="string"?U.select(a):V([[a]])},d3.selectAll=function(b){return typeof b=="string"?U.selectAll(b):V([a(b)])},d3.transition=U.transition;var Z=0,$=0,bb=null,bc,bd;d3.timer=function(a){be(a,0)},d3.timer.flush=function(){var a,b=Date.now(),c=bb;while(c)a=b-c.then,c.delay||(c.flush=c.callback(a)),c=c.next;bg()};var bh=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.scale={},d3.scale.linear=function(){function i(b){var c=d3.min(a),d=d3.max(a),e=d-c,f=Math.pow(10,Math.floor(Math.log(e/b)/Math.LN10)),g=b/(e/f);g<=.15?f*=10:g<=.35?f*=5:g<=.75&&(f*=2);return{start:Math.ceil(c/f)*f,stop:Math.floor(d/f)*f+f*.5,step:f}}function h(a){return e(a)}function g(){var g=a.length==2?bi:bj,i=d?G:F;e=g(a,b,i,c),f=g(b,a,i,d3.interpolate);return h}var a=[0,1],b=[0,1],c=d3.interpolate,d=!1,e,f;h.invert=function(a){return f(a)},h.domain=function(b){if(!arguments.length)return a;a=b.map(Number);return g()},h.range=function(a){if(!arguments.length)return b;b=a;return g()},h.rangeRound=function(a){return h.range(a).interpolate(d3.interpolateRound)},h.clamp=function(a){if(!arguments.length)return d;d=a;return g()},h.interpolate=function(a){if(!arguments.length)return c;c=a;return g()},h.ticks=function(a){var b=i(a);return d3.range(b.start,b.stop,b.step)},h.tickFormat=function(a){var b=Math.max(0,-Math.floor(Math.log(i(a).step)/Math.LN10+.01));return d3.format(",."+b+"f")};return g()},d3.scale.log=function(){function d(c){return a(b(c))}var a=d3.scale.linear(),b=bk,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?bl:bk,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.clamp=d3.rebind(d,a.clamp),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===bl){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},bk.pow=function(a){return Math.pow(10,a)},bl.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?bn:bm;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.clamp=d3.rebind(f,a.clamp),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 <add>.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(bo)},d3.scale.category20=function(){return d3.scale.ordinal().range(bp)},d3.scale.category20b=function(){return d3.scale.ordinal().range(bq)},d3.scale.category20c=function(){return d3.scale.ordinal().range(br)};var bo=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],bp=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],bq=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],br=["#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 e(a){if(isNaN(a=+a))return NaN;return b[d3.bisect(c,a)]}function d(){var d=0,e=a.length,f=b.length,g;c.length=Math.max(0,f-1);while(++d<f)c[d-1]=(g=e*d/f)%1?a[~~g]:(a[g=~~g]+a[g-1])/2}var a=[],b=[],c=[];e.domain=function(b){if(!arguments.length)return a;a=b.filter(function(a){return!isNaN(a)}).sort(d3.ascending),d();return e},e.range=function(a){if(!arguments.length)return b;b=a,d();return e},e.quantiles=function(){return c};return e},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)+bs,h=d.apply(this,arguments)+bs,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>=bt?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=bu,b=bv,c=bw,d=bx;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+bs;return[Math.cos(f)*e,Math.sin(f)*e]};return e};var bs=-Math.PI/2,bt=2*Math.PI-1e-6;d3.svg.line=function(){function f(c){return c.length<1?null:"M"+d(by(this,c,a,b),e)}var a=bz,b=bA,c="linear",d=bB[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=bB[c=a];return f},f.tension=function(a){if(!arguments.length)return e;e=a;return f};return f};var bB={linear:bC,"step-before":bD,"step-after":bE,basis:bK,"basis-open":bL,"basis-closed":bM,cardinal:bH,"cardinal-open":bF,"cardinal-closed":bG,monotone:bV},bO=[0,2/3,1/3,0],bP=[0,1/3,2/3,0],bQ=[0,1/6,2/3,1/6];d3.svg.area=function(){function g(d){return d.length<1?null:"M"+e(by(this,d,a,c),f)+"L"+e(by(this,d,a,b).reverse(),f)+"Z"}var a=bz,b=bW,c=bA,d="linear",e=bB[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=bB[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)+bs,k=e.call(a,h,g)+bs;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=bX,b=bY,c=bZ,d=bw,e=bx;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.diagonal=function(){function d(d,e){var f=a.call(this,d,e),g=b.call(this,d,e),h=(f.y+g.y)/2,i=[f,{x:f.x,y:h},{x:g.x,y:h},g];i=i.map(c);return"M"+i[0]+"C"+i[1]+" "+i[2]+" "+i[3]}var a=bX,b=bY,c=ca;d.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return d},d.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return d},d.projection=function(a){if(!arguments.length)return c;c=a;return d};return d},d3.svg.mouse=function(a){return cc(a,d3.event)};var cb=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.touches=function(b){var c=d3.event.touches;return c?a(c).map(function(a){var c=cc(b,a);c.identifier=a.identifier;return c}):[]},d3.svg.symbol=function(){function c(c,d){return(cf[a.call(this,c,d)]||cf.circle)(b.call(this,c,d))}var a=ce,b=cd;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 cf={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*ch)),c=b*ch;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/cg),c=b*cg/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.sqrt(a/cg),c=b*cg/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}},cg=Math.sqrt(3),ch=Math.tan(30*Math.PI/180)})() <ide>\ No newline at end of file <ide><path>src/core/interpolate.js <ide> d3.interpolate = function(a, b) { <del> if (typeof b === "number") return d3.interpolateNumber(+a, b); <del> if (typeof b === "string") { <del> return (b in d3_rgb_names) || /^(#|rgb\(|hsl\()/.test(b) <del> ? d3.interpolateRgb(String(a), b) <del> : d3.interpolateString(String(a), b); <del> } <del> if (b instanceof Array) return d3.interpolateArray(a, b); <del> return d3.interpolateObject(a, b); <add> var i = d3.interpolators.length, f; <add> while (--i >= 0 && !(f = d3.interpolators[i](a, b))); <add> return f; <ide> }; <ide> <ide> d3.interpolateNumber = function(a, b) { <ide> function d3_interpolateByName(n) { <ide> ? d3.interpolateRgb <ide> : d3.interpolate; <ide> } <add> <add>d3.interpolators = [ <add> d3.interpolateObject, <add> function(a, b) { return (b instanceof Array) && d3.interpolateArray(a, b); }, <add> function(a, b) { return (typeof b === "string") && d3.interpolateString(String(a), b); }, <add> function(a, b) { return (b in d3_rgb_names || /^(#|rgb\(|hsl\()/.test(b)) && d3.interpolateRgb(String(a), b); }, <add> function(a, b) { return (typeof b === "number") && d3.interpolateNumber(+a, b); } <add>];
3
Text
Text
add 2.8.0 changelog
fa4ee2a5b1d1e4a663a5e32622aec9e5f6e453f5
<ide><path>CHANGELOG.md <ide> Changelog <ide> ========= <ide> <add>### 2.8.0 [See changelog](https://gist.github.com/ichernev/ac3899324a5fa6c8c9b4) <add> <add>* incompatible changes <add> * [#1761](https://github.com/moment/moment/issues/1761): moments created without a language are no longer following the global language, in case it changes. Only newly created moments take the global language by default. In case you're affected by this, wait, comment on [#1797](https://github.com/moment/moment/issues/1797) and wait for a proper reimplementation <add> * [#1642](https://github.com/moment/moment/issues/1642): 45 days is no longer "a month" according to humanize, cutoffs for month, and year have changed. Hopefully your code does not depend on a particular answer from humanize (which it shouldn't anyway) <add> * [#1784](https://github.com/moment/moment/issues/1784): if you use the human readable English datetime format in a weird way (like storing them in a database) that would break when the format changes you're at risk. <add> <add>* deprecations (old behavior will be dropped in 3.0) <add> * [#1761](https://github.com/moment/moment/issues/1761) `lang` is renamed to `locale`, `langData` -> `localeData`. Also there is now `defineLocale` that should be used when creating new locales <add> * [#1763](https://github.com/moment/moment/issues/1763) `add(unit, value)` and `subtract(unit, value)` are now deprecated. Use `add(value, unit)` and `subtract(value, unit)` instead. <add> * [#1759](https://github.com/moment/moment/issues/1759) rename `duration.toIsoString` to `duration.toISOString`. The js standard library and moment's `toISOString` follow that convention. <add> <add>* new locales <add> * [#1789](https://github.com/moment/moment/issues/1789) Tibetan (bo) <add> * [#1786](https://github.com/moment/moment/issues/1786) Africaans (af) <add> * [#1778](https://github.com/moment/moment/issues/1778) Burmese (my) <add> * [#1727](https://github.com/moment/moment/issues/1727) Belarusian (be) <add> <add>* bugfixes, locale bugfixes, performance improvements, features <add> <ide> ### 2.7.0 [See changelog](https://gist.github.com/ichernev/b0a3d456d5a84c9901d7) <ide> <ide> * new languages
1
Ruby
Ruby
remove redundant `env.delete` in `scrub_env!`
081dfef95ae70fe9311c8be20a094977dc7643ff
<ide><path>actionpack/lib/action_controller/test_case.rb <ide> def build_response(klass) <ide> def scrub_env!(env) <ide> env.delete_if { |k, v| k.match?(/^(action_dispatch|rack)\.request/) } <ide> env.delete_if { |k, v| k.match?(/^action_dispatch\.rescue/) } <del> env.delete "action_dispatch.request.query_parameters" <del> env.delete "action_dispatch.request.request_parameters" <ide> env["rack.input"] = StringIO.new <ide> env.delete "CONTENT_LENGTH" <ide> env.delete "RAW_POST_DATA"
1
Javascript
Javascript
add component stack to invalid style warnings
f56ca479be859c0fac416179a886962d90506425
<ide><path>packages/react-dom/src/ReactDOMFiberComponent.js <ide> var HTML = '__html'; <ide> <ide> var {Namespaces: {html: HTML_NAMESPACE}, getIntrinsicNamespace} = DOMNamespaces; <ide> <add>var getStack = emptyFunction; <add> <ide> if (__DEV__) { <add> getStack = getCurrentFiberStackAddendum; <add> <ide> var warnedUnknownTags = { <ide> // Chrome is the only major browser not shipping <time>. But as of July <ide> // 2017 it intends to ship it due to widespread usage. We intentionally <ide> function setInitialDOMProperties( <ide> } <ide> } <ide> // Relies on `updateStylesByID` not mutating `styleUpdates`. <del> CSSPropertyOperations.setValueForStyles(domElement, nextProp); <add> CSSPropertyOperations.setValueForStyles(domElement, nextProp, getStack); <ide> } else if (propKey === DANGEROUSLY_SET_INNER_HTML) { <ide> var nextHtml = nextProp ? nextProp[HTML] : undefined; <ide> if (nextHtml != null) { <ide> function updateDOMProperties( <ide> var propKey = updatePayload[i]; <ide> var propValue = updatePayload[i + 1]; <ide> if (propKey === STYLE) { <del> CSSPropertyOperations.setValueForStyles(domElement, propValue); <add> CSSPropertyOperations.setValueForStyles(domElement, propValue, getStack); <ide> } else if (propKey === DANGEROUSLY_SET_INNER_HTML) { <ide> setInnerHTML(domElement, propValue); <ide> } else if (propKey === CHILDREN) { <ide><path>packages/react-dom/src/server/ReactPartialRenderer.js <ide> var processStyleName = memoizeStringOnly(function(styleName) { <ide> return hyphenateStyleName(styleName); <ide> }); <ide> <del>function createMarkupForStyles(styles, component) { <add>function createMarkupForStyles(styles) { <ide> var serialized = ''; <ide> var delimiter = ''; <ide> for (var styleName in styles) { <ide> function createMarkupForStyles(styles, component) { <ide> var styleValue = styles[styleName]; <ide> if (__DEV__) { <ide> if (!isCustomProperty) { <del> warnValidStyle(styleName, styleValue, component); <add> warnValidStyle( <add> styleName, <add> styleValue, <add> () => '', // getCurrentFiberStackAddendum, <add> ); <ide> } <ide> } <ide> if (styleValue != null) { <ide> function createOpenTagMarkup( <ide> namespace, <ide> makeStaticMarkup, <ide> isRootElement, <del> instForDebug, <ide> ) { <ide> var ret = '<' + tagVerbatim; <ide> <ide> function createOpenTagMarkup( <ide> continue; <ide> } <ide> if (propKey === STYLE) { <del> propValue = createMarkupForStyles(propValue, instForDebug); <add> propValue = createMarkupForStyles(propValue); <ide> } <ide> var markup = null; <ide> if (isCustomComponent(tagLowercase, props)) { <ide> class ReactDOMServerRenderer { <ide> namespace, <ide> this.makeStaticMarkup, <ide> this.stack.length === 1, <del> null, <ide> ); <ide> var footer = ''; <ide> if (omittedCloseTags.hasOwnProperty(tag)) { <ide><path>packages/react-dom/src/shared/CSSPropertyOperations.js <ide> var CSSPropertyOperations = { <ide> * <ide> * @param {DOMElement} node <ide> * @param {object} styles <del> * @param {ReactDOMComponent} component <ide> */ <del> setValueForStyles: function(node, styles, component) { <add> setValueForStyles: function(node, styles, getStack) { <ide> var style = node.style; <ide> for (var styleName in styles) { <ide> if (!styles.hasOwnProperty(styleName)) { <ide> var CSSPropertyOperations = { <ide> var isCustomProperty = styleName.indexOf('--') === 0; <ide> if (__DEV__) { <ide> if (!isCustomProperty) { <del> warnValidStyle(styleName, styles[styleName], component); <add> warnValidStyle(styleName, styles[styleName], getStack); <ide> } <ide> } <ide> var styleValue = dangerousStyleValue( <ide><path>packages/react-dom/src/shared/__tests__/CSSPropertyOperations-test.js <ide> var React = require('react'); <ide> var ReactDOM = require('react-dom'); <ide> var ReactDOMServer = require('react-dom/server'); <ide> <add>function normalizeCodeLocInfo(str) { <add> return str && str.replace(/at .+?:\d+/g, 'at **'); <add>} <add> <ide> describe('CSSPropertyOperations', () => { <ide> it('should automatically append `px` to relevant styles', () => { <ide> var styles = { <ide> describe('CSSPropertyOperations', () => { <ide> var root = document.createElement('div'); <ide> ReactDOM.render(<Comp />, root); <ide> expectDev(console.error.calls.count()).toBe(1); <del> expectDev(console.error.calls.argsFor(0)[0]).toEqual( <add> expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toEqual( <ide> 'Warning: Unsupported style property background-color. Did you mean backgroundColor?' + <del> '\n\nCheck the render method of `Comp`.', <add> '\n in div (at **)' + <add> '\n in Comp (at **)', <ide> ); <ide> }); <ide> <ide> describe('CSSPropertyOperations', () => { <ide> ReactDOM.render(<Comp style={styles} />, root); <ide> <ide> expectDev(console.error.calls.count()).toBe(2); <del> expectDev(console.error.calls.argsFor(0)[0]).toEqual( <add> expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toEqual( <ide> 'Warning: Unsupported style property -ms-transform. Did you mean msTransform?' + <del> '\n\nCheck the render method of `Comp`.', <add> '\n in div (at **)' + <add> '\n in Comp (at **)', <ide> ); <del> expectDev(console.error.calls.argsFor(1)[0]).toEqual( <add> expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(1)[0])).toEqual( <ide> 'Warning: Unsupported style property -webkit-transform. Did you mean WebkitTransform?' + <del> '\n\nCheck the render method of `Comp`.', <add> '\n in div (at **)' + <add> '\n in Comp (at **)', <ide> ); <ide> }); <ide> <ide> describe('CSSPropertyOperations', () => { <ide> ReactDOM.render(<Comp />, root); <ide> // msTransform is correct already and shouldn't warn <ide> expectDev(console.error.calls.count()).toBe(2); <del> expectDev(console.error.calls.argsFor(0)[0]).toEqual( <add> expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toEqual( <ide> 'Warning: Unsupported vendor-prefixed style property oTransform. ' + <del> 'Did you mean OTransform?\n\nCheck the render method of `Comp`.', <add> 'Did you mean OTransform?' + <add> '\n in div (at **)' + <add> '\n in Comp (at **)', <ide> ); <del> expectDev(console.error.calls.argsFor(1)[0]).toEqual( <add> expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(1)[0])).toEqual( <ide> 'Warning: Unsupported vendor-prefixed style property webkitTransform. ' + <del> 'Did you mean WebkitTransform?\n\nCheck the render method of `Comp`.', <add> 'Did you mean WebkitTransform?' + <add> '\n in div (at **)' + <add> '\n in Comp (at **)', <ide> ); <ide> }); <ide> <ide> describe('CSSPropertyOperations', () => { <ide> var root = document.createElement('div'); <ide> ReactDOM.render(<Comp />, root); <ide> expectDev(console.error.calls.count()).toBe(2); <del> expectDev(console.error.calls.argsFor(0)[0]).toEqual( <del> "Warning: Style property values shouldn't contain a semicolon." + <del> '\n\nCheck the render method of `Comp`. Try "backgroundColor: blue" instead.', <add> expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toEqual( <add> "Warning: Style property values shouldn't contain a semicolon. " + <add> 'Try "backgroundColor: blue" instead.' + <add> '\n in div (at **)' + <add> '\n in Comp (at **)', <ide> ); <del> expectDev(console.error.calls.argsFor(1)[0]).toEqual( <del> "Warning: Style property values shouldn't contain a semicolon." + <del> '\n\nCheck the render method of `Comp`. Try "color: red" instead.', <add> expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(1)[0])).toEqual( <add> "Warning: Style property values shouldn't contain a semicolon. " + <add> 'Try "color: red" instead.' + <add> '\n in div (at **)' + <add> '\n in Comp (at **)', <ide> ); <ide> }); <ide> <ide> describe('CSSPropertyOperations', () => { <ide> ReactDOM.render(<Comp />, root); <ide> <ide> expectDev(console.error.calls.count()).toBe(1); <del> expectDev(console.error.calls.argsFor(0)[0]).toEqual( <add> expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toEqual( <ide> 'Warning: `NaN` is an invalid value for the `fontSize` css style property.' + <del> '\n\nCheck the render method of `Comp`.', <add> '\n in div (at **)' + <add> '\n in Comp (at **)', <ide> ); <ide> }); <ide> <ide> describe('CSSPropertyOperations', () => { <ide> } <ide> } <ide> <del> spyOn(console, 'error'); <ide> var root = document.createElement('div'); <ide> ReactDOM.render(<Comp />, root); <del> <del> expectDev(console.error.calls.count()).toBe(0); <ide> }); <ide> <ide> it('should warn about style containing a Infinity value', () => { <ide> describe('CSSPropertyOperations', () => { <ide> ReactDOM.render(<Comp />, root); <ide> <ide> expectDev(console.error.calls.count()).toBe(1); <del> expectDev(console.error.calls.argsFor(0)[0]).toEqual( <add> expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toEqual( <ide> 'Warning: `Infinity` is an invalid value for the `fontSize` css style property.' + <del> '\n\nCheck the render method of `Comp`.', <add> '\n in div (at **)' + <add> '\n in Comp (at **)', <ide> ); <ide> }); <ide> <ide><path>packages/react-dom/src/shared/__tests__/ReactDOMComponent-test.js <ide> describe('ReactDOMComponent', () => { <ide> ReactDOM.render(<span style={style} />, div); <ide> <ide> expectDev(console.error.calls.count()).toBe(1); <del> expectDev(console.error.calls.argsFor(0)[0]).toEqual( <del> 'Warning: `NaN` is an invalid value for the `fontSize` css style property.', <add> expectDev( <add> normalizeCodeLocInfo(console.error.calls.argsFor(0)[0]), <add> ).toEqual( <add> 'Warning: `NaN` is an invalid value for the `fontSize` css style property.' + <add> '\n in span (at **)', <ide> ); <ide> }); <ide> <ide><path>packages/react-dom/src/shared/warnValidStyle.js <ide> var warnValidStyle = emptyFunction; <ide> if (__DEV__) { <ide> var camelizeStyleName = require('fbjs/lib/camelizeStyleName'); <ide> var warning = require('fbjs/lib/warning'); <del> var {getCurrentFiberOwnerName} = require('ReactDebugCurrentFiber'); <ide> <ide> // 'msTransform' is correct, but the other prefixes should be capitalized <ide> var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/; <ide> if (__DEV__) { <ide> var warnedForNaNValue = false; <ide> var warnedForInfinityValue = false; <ide> <del> var warnHyphenatedStyleName = function(name) { <add> var warnHyphenatedStyleName = function(name, getStack) { <ide> if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) { <ide> return; <ide> } <ide> if (__DEV__) { <ide> 'Unsupported style property %s. Did you mean %s?%s', <ide> name, <ide> camelizeStyleName(name), <del> checkRenderMessage(), <add> getStack(), <ide> ); <ide> }; <ide> <del> var warnBadVendoredStyleName = function(name) { <add> var warnBadVendoredStyleName = function(name, getStack) { <ide> if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) { <ide> return; <ide> } <ide> if (__DEV__) { <ide> 'Unsupported vendor-prefixed style property %s. Did you mean %s?%s', <ide> name, <ide> name.charAt(0).toUpperCase() + name.slice(1), <del> checkRenderMessage(), <add> getStack(), <ide> ); <ide> }; <ide> <del> var warnStyleValueWithSemicolon = function(name, value) { <add> var warnStyleValueWithSemicolon = function(name, value, getStack) { <ide> if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) { <ide> return; <ide> } <ide> <ide> warnedStyleValues[value] = true; <ide> warning( <ide> false, <del> "Style property values shouldn't contain a semicolon.%s " + <del> 'Try "%s: %s" instead.', <del> checkRenderMessage(), <add> "Style property values shouldn't contain a semicolon. " + <add> 'Try "%s: %s" instead.%s', <ide> name, <ide> value.replace(badStyleValueWithSemicolonPattern, ''), <add> getStack(), <ide> ); <ide> }; <ide> <del> var warnStyleValueIsNaN = function(name, value) { <add> var warnStyleValueIsNaN = function(name, value, getStack) { <ide> if (warnedForNaNValue) { <ide> return; <ide> } <ide> if (__DEV__) { <ide> false, <ide> '`NaN` is an invalid value for the `%s` css style property.%s', <ide> name, <del> checkRenderMessage(), <add> getStack(), <ide> ); <ide> }; <ide> <del> var warnStyleValueIsInfinity = function(name, value) { <add> var warnStyleValueIsInfinity = function(name, value, getStack) { <ide> if (warnedForInfinityValue) { <ide> return; <ide> } <ide> if (__DEV__) { <ide> false, <ide> '`Infinity` is an invalid value for the `%s` css style property.%s', <ide> name, <del> checkRenderMessage(), <add> getStack(), <ide> ); <ide> }; <ide> <del> var checkRenderMessage = function() { <del> var ownerName; <del> // Fiber doesn't pass it but uses ReactDebugCurrentFiber to track it. <del> // It is only enabled in development and tracks host components too. <del> ownerName = getCurrentFiberOwnerName(); <del> // TODO: also report the stack. <del> if (ownerName) { <del> return '\n\nCheck the render method of `' + ownerName + '`.'; <del> } <del> return ''; <del> }; <del> <del> warnValidStyle = function(name, value, component) { <add> warnValidStyle = function(name, value, getStack) { <ide> if (name.indexOf('-') > -1) { <del> warnHyphenatedStyleName(name); <add> warnHyphenatedStyleName(name, getStack); <ide> } else if (badVendoredStyleNamePattern.test(name)) { <del> warnBadVendoredStyleName(name); <add> warnBadVendoredStyleName(name, getStack); <ide> } else if (badStyleValueWithSemicolonPattern.test(value)) { <del> warnStyleValueWithSemicolon(name, value); <add> warnStyleValueWithSemicolon(name, value, getStack); <ide> } <ide> <ide> if (typeof value === 'number') { <ide> if (isNaN(value)) { <del> warnStyleValueIsNaN(name, value); <add> warnStyleValueIsNaN(name, value, getStack); <ide> } else if (!isFinite(value)) { <del> warnStyleValueIsInfinity(name, value); <add> warnStyleValueIsInfinity(name, value, getStack); <ide> } <ide> } <ide> };
6
Text
Text
add changelog for 2.11.3 [ci skip]
e842e4c0a050263d8a0495e81f63d5b9a6f4666f
<ide><path>CHANGELOG.md <ide> - [#14852](https://github.com/emberjs/ember.js/pull/14852) [PERF] only `LOG_TRANSITIONS` and `LOG_TRANSITIONS_INTERNAL` in debug <ide> - [#14854](https://github.com/emberjs/ember.js/pull/14854) [PER] only `LOG_ACTIVE_GENERATION` and `LOG_RESOLVER` in debug <ide> <add>### 2.11.3 (March 8, 2017) <add> <add>- [#14987](https://github.com/emberjs/ember.js/pull/14987) [BUGFIX] Fix a memory leak when components are destroyed. <add>- [#14986](https://github.com/emberjs/ember.js/pull/14986) [BUGFIX] Fix a memory leak in RSVP.js. <add>- [#14985](https://github.com/emberjs/ember.js/pull/14985) [BUGFIX] Fix a bug that added babel helpers to the global scope. <add>- [#14898](https://github.com/emberjs/ember.js/pull/14898) [BUGFIX] Fix an issue where errors in tests sometimes do not cause a failure. <add>- [#14707](https://github.com/emberjs/ember.js/pull/14707) [BUGFIX] Improve deprecation message for unsafe `style` attribute bindings. <add> <ide> ### 2.11.2 (February 19, 2017) <ide> <ide> - [#14937](https://github.com/emberjs/ember.js/pull/14937) [BUGFIX] Fix issue preventing `ember generate *` from creating test files as appropriate.
1
Python
Python
fix polymul bug
e7a51c37517f0fc62624c7e8e40d63ba416d096d
<ide><path>numpy/core/tests/test_regression.py <ide> def check_noncommutative_reduce_accumulate(self, level=rlevel): <ide> assert_array_equal(N.divide.accumulate(todivide), <ide> N.array([2., 4., 16.])) <ide> <add> def check_mem_polymul(self, level=rlevel): <add> """Ticket #448""" <add> N.polymul([],[1.]) <add> <ide> if __name__ == "__main__": <ide> NumpyTest().run() <ide><path>numpy/lib/polynomial.py <ide> def polymul(a1, a2): <ide> """Multiplies two polynomials represented as sequences. <ide> """ <ide> truepoly = (isinstance(a1, poly1d) or isinstance(a2, poly1d)) <add> a1,a2 = poly1d(a1),poly1d(a2) <ide> val = NX.convolve(a1, a2) <ide> if truepoly: <ide> val = poly1d(val)
2
Python
Python
update version numbers
0242ca59ac0412b44419de2b6b4d07bebf975610
<ide><path>keras/__init__.py <del>__version__ = '0.3.2' <add>__version__ = '1.0.0' <ide><path>setup.py <ide> <ide> <ide> setup(name='Keras', <del> version='0.3.2', <add> version='1.0.0', <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/0.3.2', <add> download_url='https://github.com/fchollet/keras/tarball/1.0.0', <ide> license='MIT', <ide> install_requires=['theano', 'pyyaml', 'six'], <ide> extras_require={
2
Text
Text
update doc version
60a429f5cb2a1985ab1e43c5c3155a0bd6ebe963
<ide><path>docs/00-Getting-Started.md <ide> npm install chart.js --save <ide> bower install Chart.js --save <ide> ``` <ide> <del>CDN: https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.0.0-beta/Chart.js <add>CDN: https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.0.0/Chart.js <ide> <ide> ###Install Chart.js <ide>
1
Javascript
Javascript
add dynamic flags to react native
4c9eb2af1e917529cbefa4b4e0c2923efd016ff5
<ide><path>packages/shared/forks/ReactFeatureFlags.native-fb.js <ide> export const enableUseRefAccessWarning = false; <ide> export const enableRecursiveCommitTraversal = false; <ide> export const disableSchedulerTimeoutInWorkLoop = false; <ide> export const enableLazyContextPropagation = false; <del>export const enableSyncDefaultUpdates = true; <add>export const enableSyncDefaultUpdates = false; <ide> <ide> // Flow magic to verify the exports of this file match the original version. <ide> // eslint-disable-next-line no-unused-vars
1
Javascript
Javascript
reverse arguments in assert.strictequal
99c16900c8eba7baa64dbd4f5f978412871410a2
<ide><path>test/parallel/test-http-keep-alive-close-on-header.js <ide> server.listen(0, function() { <ide> port: this.address().port, <ide> agent: agent <ide> }, function(res) { <del> assert.strictEqual(1, agent.sockets[name].length); <add> assert.strictEqual(agent.sockets[name].length, 1); <ide> res.resume(); <ide> }); <ide> request.on('socket', function(s) { <ide> server.listen(0, function() { <ide> port: this.address().port, <ide> agent: agent <ide> }, function(res) { <del> assert.strictEqual(1, agent.sockets[name].length); <add> assert.strictEqual(agent.sockets[name].length, 1); <ide> res.resume(); <ide> }); <ide> request.on('socket', function(s) { <ide> server.listen(0, function() { <ide> agent: agent <ide> }, function(response) { <ide> response.on('end', function() { <del> assert.strictEqual(1, agent.sockets[name].length); <add> assert.strictEqual(agent.sockets[name].length, 1); <ide> server.close(); <ide> }); <ide> response.resume(); <ide> server.listen(0, function() { <ide> }); <ide> <ide> process.on('exit', function() { <del> assert.strictEqual(3, connectCount); <add> assert.strictEqual(connectCount, 3); <ide> });
1
PHP
PHP
reword exception explanation
8900def9d770b01bebb4bb0efc9ecc231e55a786
<ide><path>src/Cache/SimpleCacheEngine.php <ide> public function getMultiple($keys, $default = null) <ide> * the driver supports TTL then the library may set a default value <ide> * for it or let the driver take care of that. <ide> * @return bool True on success and false on failure. <del> * @throws \Psr\SimpleCache\InvalidArgumentException <del> * MUST be thrown if $values is neither an array nor a Traversable, <add> * @throws \Psr\SimpleCache\InvalidArgumentException If $values is neither an array nor a Traversable, <ide> * or if any of the $values are not a legal value. <ide> */ <ide> public function setMultiple($values, $ttl = null)
1
Ruby
Ruby
remove with_tags from query_logs
9c6b343a6fd29ae496d808904d875859bb1a9c9d
<ide><path>activerecord/lib/active_record/query_logs.rb <ide> def set_context(**options) <ide> update_context(**previous_context) <ide> end <ide> <del> # Temporarily tag any query executed within `&block`. Can be nested. <del> def with_tag(tag, &block) <del> inline_tags.push(tag) <del> yield if block_given? <del> ensure <del> inline_tags.pop <del> end <del> <ide> def call(sql) # :nodoc: <del> parts = self.comments <ide> if prepend_comment <del> parts << sql <add> "#{self.comment} #{sql}" <ide> else <del> parts.unshift(sql) <del> end <del> parts.join(" ") <add> "#{sql} #{self.comment}" <add> end.strip <ide> end <ide> <ide> private <del> # Returns an array of comments which need to be added to the query, comprised <del> # of configured and inline tags. <del> def comments <del> [ comment, inline_comment ].compact <del> end <del> <ide> # Returns an SQL comment +String+ containing the query log tags. <ide> # Sets and returns a cached comment if <tt>cache_query_log_tags</tt> is +true+. <ide> def comment <ide> def uncached_comment <ide> end <ide> end <ide> <del> # Returns a +String+ containing any inline comments from +with_tag+. <del> def inline_comment <del> return nil unless inline_tags.present? <del> "/*#{escape_sql_comment(inline_tag_content)}*/" <del> end <del> <del> # Return the set of active inline tags from +with_tag+. <del> def inline_tags <del> if context[:inline_tags].nil? <del> context[:inline_tags] = [] <del> else <del> context[:inline_tags] <del> end <del> end <del> <ide> def context <ide> Thread.current[:active_record_query_log_tags_context] ||= Hash.new { NullObject.new } <ide> end <ide> def tag_content <ide> "#{key}:#{val}" unless val.nil? <ide> end.join(",") <ide> end <del> <del> def inline_tag_content <del> inline_tags.join <del> end <ide> end <ide> end <ide> end <ide><path>activerecord/test/cases/query_logs_test.rb <ide> def test_retrieves_comment_from_cache_when_enabled_and_set <ide> ActiveRecord::QueryLogs.cache_query_log_tags = true <ide> ActiveRecord::QueryLogs.tags = [ :application ] <ide> <del> assert_equal " /*application:active_record*/", ActiveRecord::QueryLogs.call("") <add> assert_equal "/*application:active_record*/", ActiveRecord::QueryLogs.call("") <ide> <ide> ActiveRecord::QueryLogs.stub(:cached_comment, "/*cached_comment*/") do <del> assert_equal " /*cached_comment*/", ActiveRecord::QueryLogs.call("") <add> assert_equal "/*cached_comment*/", ActiveRecord::QueryLogs.call("") <ide> end <ide> ensure <ide> ActiveRecord::QueryLogs.cached_comment = nil <ide> def test_resets_cache_on_context_update <ide> ActiveRecord::QueryLogs.update_context(temporary: "value") <ide> ActiveRecord::QueryLogs.tags = [ temporary_tag: ->(context) { context[:temporary] } ] <ide> <del> assert_equal " /*temporary_tag:value*/", ActiveRecord::QueryLogs.call("") <add> assert_equal "/*temporary_tag:value*/", ActiveRecord::QueryLogs.call("") <ide> <ide> ActiveRecord::QueryLogs.update_context(temporary: "new_value") <ide> <ide> assert_nil ActiveRecord::QueryLogs.cached_comment <del> assert_equal " /*temporary_tag:new_value*/", ActiveRecord::QueryLogs.call("") <add> assert_equal "/*temporary_tag:new_value*/", ActiveRecord::QueryLogs.call("") <ide> ensure <ide> ActiveRecord::QueryLogs.cached_comment = nil <ide> ActiveRecord::QueryLogs.cache_query_log_tags = false <ide> def test_default_tag_behavior <ide> end <ide> end <ide> <del> def test_inline_tags_only_affect_block <del> # disable regular comment tags <del> ActiveRecord::QueryLogs.tags = [] <del> <del> # confirm single inline tag <del> assert_sql(%r{/\*foo\*/$}) do <del> ActiveRecord::QueryLogs.with_tag("foo") do <del> Dashboard.first <del> end <del> end <del> <del> # confirm different inline tag <del> assert_sql(%r{/\*bar\*/$}) do <del> ActiveRecord::QueryLogs.with_tag("bar") do <del> Dashboard.first <del> end <del> end <del> <del> # confirm no tags are persisted <del> ActiveRecord::QueryLogs.tags = [ :application ] <del> <del> assert_sql(%r{/\*application:active_record\*/$}) do <del> Dashboard.first <del> end <del> ensure <del> ActiveRecord::QueryLogs.tags = [ :application ] <del> end <del> <del> def test_nested_inline_tags <del> assert_sql(%r{/\*foobar\*/$}) do <del> ActiveRecord::QueryLogs.with_tag("foo") do <del> ActiveRecord::QueryLogs.with_tag("bar") do <del> Dashboard.first <del> end <del> end <del> end <del> end <del> <del> def test_bad_inline_tags <del> assert_sql(%r{/\*; DROP TABLE USERS;\*/$}) do <del> ActiveRecord::QueryLogs.with_tag("*/; DROP TABLE USERS;/*") do <del> Dashboard.first <del> end <del> end <del> <del> assert_sql(%r{/\*; DROP TABLE USERS;\*/$}) do <del> ActiveRecord::QueryLogs.with_tag("**//; DROP TABLE USERS;//**") do <del> Dashboard.first <del> end <del> end <del> end <del> <ide> def test_empty_comments_are_not_added <ide> original_tags = ActiveRecord::QueryLogs.tags <ide> ActiveRecord::QueryLogs.tags = [ empty: -> { nil } ]
2
Python
Python
fix flaky test_add_chord_to_chord
1f4af2d6c19ba83ec751fa2d71adc3ea232d0c21
<ide><path>t/integration/test_canvas.py <ide> def test_add_chord_to_chord(self, manager): <ide> <ide> c = group([add_chord_to_chord.s([1, 2, 3], 4)]) | identity.s() <ide> res = c() <del> assert res.get() == [0, 5 + 6 + 7] <add> assert sorted(res.get()) == [0, 5 + 6 + 7] <ide> <ide> @flaky <ide> def test_eager_chord_inside_task(self, manager):
1
Text
Text
add command for system administrators.
42151b51536b41960e728f31861371ac61c2c3d2
<ide><path>guide/english/linux/10-simple-and-useful-linux-commands/index.md <ide> Copy file from source to destination preserving same mode. <ide> 11. `mv` <ide> Move file from source to destination preserving same mode. <ide> <del>12. `ifconfig` to view ip and other information. <add>12. 'ifconfig' command <add>ifconfig allows you to see the addresses associated with each TCP/IP interface on your machine, or manipulate the state of the interface. A definite must have for any tech or SysAdmin. <ide> <ide> 13. `systemctl` Command <ide> This is a command which allows operators to work with the Linux system services. The standard use of the command is `systemctl <OPTION> <SERVICE-NAME>` by providing an `OPTION` (e.g. `start`, `stop`, `status`) and than providing a specific Service Name to act on. You can use the command to get a general status of your Linux services (e.g `systemctl status`). Note that you will either need Administrator access or use `sudo` to elevate your rights to run the command successfully. <ide> <del>These commands are frequently used by adminstrators. This is not a complete list, but it’s a compact list to refer to when needed. <add>These commands are frequently used by adminstrators. This is not a complete list, but it’s a compact list to refer to when needed. <ide>\ No newline at end of file
1
Ruby
Ruby
add scope to preload embeds as well
83d781ed01459cb80d10a1c8e91e3d6f36c01913
<ide><path>lib/action_text/attribute.rb <ide> def #{name}=(body) <ide> has_one :"rich_text_#{name}", -> { where(name: name) }, class_name: "ActionText::RichText", as: :record, inverse_of: :record, dependent: :destroy <ide> <ide> scope :"with_rich_text_#{name}", -> { includes("rich_text_#{name}") } <add> scope :"with_rich_text_#{name}_and_embeds", -> { includes("rich_text_#{name}": { embeds_attachments: :blob }) } <ide> <ide> after_save { public_send(name).save if public_send(name).changed? } <ide> end
1
Javascript
Javascript
simplify several debug() calls
69470c87cc65e92acb15883d2d031fe9fa1f4c54
<ide><path>lib/internal/http2/core.js <ide> function onOrigin(origins) { <ide> const session = this[kOwner]; <ide> if (session.destroyed) <ide> return; <del> debug(`Http2Session ${sessionName(session[kType])}: origin received: ` + <del> `${origins.join(', ')}`); <add> debug('Http2Session %s: origin received: %j', <add> sessionName(session[kType]), origins); <ide> session[kUpdateTimer](); <ide> if (!session.encrypted || session.destroyed) <ide> return undefined; <ide><path>lib/internal/modules/esm/create_dynamic_module.js <ide> const ArrayJoin = Function.call.bind(Array.prototype.join); <ide> const ArrayMap = Function.call.bind(Array.prototype.map); <ide> <ide> const createDynamicModule = (exports, url = '', evaluate) => { <del> debug( <del> `creating ESM facade for ${url} with exports: ${ArrayJoin(exports, ', ')}` <del> ); <add> debug('creating ESM facade for %s with exports: %j', url, exports); <ide> const names = ArrayMap(exports, (name) => `${name}`); <ide> <ide> const source = `
2
Python
Python
fix typo in the word "default" in www/forms.py
927885709f679de8f4841b76b127630555b433c7
<ide><path>airflow/www/forms.py <ide> def process_formdata(self, valuelist): <ide> # default timezone <ide> if len(date_str) == 19: <ide> parsed_datetime = dt.strptime(date_str, '%Y-%m-%d %H:%M:%S') <del> defualt_timezone = self._get_defualt_timezone() <del> self.data = defualt_timezone.convert(parsed_datetime) <add> default_timezone = self._get_default_timezone() <add> self.data = default_timezone.convert(parsed_datetime) <ide> else: <ide> self.data = pendulum.parse(date_str) <ide> except ValueError: <ide> self.data = None <ide> raise ValueError(self.gettext('Not a valid datetime value')) <ide> <del> def _get_defualt_timezone(self): <add> def _get_default_timezone(self): <ide> current_timezone = conf.get("core", "default_timezone") <ide> if current_timezone == "system": <del> defualt_timezone = pendulum.local_timezone() <add> default_timezone = pendulum.local_timezone() <ide> else: <del> defualt_timezone = pendulum.timezone(current_timezone) <del> return defualt_timezone <add> default_timezone = pendulum.timezone(current_timezone) <add> return default_timezone <ide> <ide> <ide> class DateTimeForm(FlaskForm):
1
Python
Python
use list comprehension instead
5a5f3d15135d966aefe96c8577d18e890bcefb2c
<ide><path>libcloud/test/compute/test_opsource.py <ide> def test_ex_list_networks(self): <ide> <ide> def test_node_public_ip(self): <ide> nodes = self.driver.list_nodes() <del> for node in nodes: <del> if node.id == "abadbc7e-9e10-46ca-9d4a-194bcc6b6c16": <del> self.assertEqual(node.public_ips[0], '200.16.132.7') <del> else: <del> self.assertEqual(len(node.public_ips), 0) <add> node = [n for n in nodes if n.id == <add> 'abadbc7e-9e10-46ca-9d4a-194bcc6b6c16'][0] <add> self.assertEqual(node.public_ips[0], '200.16.132.7') <ide> <ide> <ide> class OpsourceMockHttp(MockHttp):
1
PHP
PHP
fix failing tests in redirectroute
84d57e2a4b2a18f73f62e8eea835b68266619d35
<ide><path>lib/Cake/Routing/Route/RedirectRoute.php <ide> public function parse($url) { <ide> $redirect = $this->redirect[0]; <ide> } <ide> if (isset($this->options['persist']) && is_array($redirect)) { <del> $redirect += array('named' => $params['named'], 'pass' => $params['pass'], 'url' => array()); <add> $redirect += array('pass' => $params['pass'], 'url' => array()); <ide> $redirect = Router::reverse($redirect); <ide> } <ide> $status = 301; <ide><path>lib/Cake/Test/TestCase/Routing/Route/RedirectRouteTest.php <ide> public function testParsing() { <ide> $route = new RedirectRoute('/my_controllers/:action/*', array('controller' => 'tags', 'action' => 'add'), array('persist' => true)); <ide> $route->stop = false; <ide> $route->response = $this->getMock('Cake\Network\Response', array('_sendHeader')); <del> $result = $route->parse('/my_controllers/do_something/passme/named:param'); <add> $result = $route->parse('/my_controllers/do_something/passme'); <ide> $header = $route->response->header(); <del> $this->assertEquals(Router::url('/tags/add/passme/named:param', true), $header['Location']); <add> $this->assertEquals(Router::url('/tags/add/passme', true), $header['Location']); <ide> <ide> $route = new RedirectRoute('/my_controllers/:action/*', array('controller' => 'tags', 'action' => 'add')); <ide> $route->stop = false; <ide> $route->response = $this->getMock('Cake\Network\Response', array('_sendHeader')); <del> $result = $route->parse('/my_controllers/do_something/passme/named:param'); <add> $result = $route->parse('/my_controllers/do_something/passme'); <ide> $header = $route->response->header(); <ide> $this->assertEquals(Router::url('/tags/add', true), $header['Location']); <ide> }
2
Javascript
Javascript
ignore connection errors for hostname check
4d7946aec33d23dd0c1fa1125937baad7e11a8e3
<ide><path>test/parallel/test-http-hostname-typechecking.js <ide> vals.forEach((v) => { <ide> assert.throws(() => http.request({host: v}), errHost); <ide> }); <ide> <del>// These values are OK and should not throw synchronously <add>// These values are OK and should not throw synchronously. <add>// Only testing for 'hostname' validation so ignore connection errors. <add>const dontCare = () => {}; <ide> ['', undefined, null].forEach((v) => { <ide> assert.doesNotThrow(() => { <del> http.request({hostname: v}).on('error', () => {}).end(); <del> http.request({host: v}).on('error', () => {}).end(); <add> http.request({hostname: v}).on('error', dontCare).end(); <add> http.request({host: v}).on('error', dontCare).end(); <ide> }); <ide> });
1
Text
Text
add keys with examples
95e541882cfeb272726f11e5f720a4d2b2de7df9
<ide><path>guide/english/react/keys/index.md <add>--- <add>title: Keys <add>--- <add> <add># Keys <add> <add>Keys are the eyes and ears on your application battlefield letting React know which items have changed or were added. <add>```javascript <add>const bestCereal = ['cookie crisp','waffle crisp','fruit loops','cinnamon toast crunch','cocoa puffs']; <add>const cerealItems = bestCereal.map((cereal) => <add> <ul key={cereal}> <add> {cereal} <add> </ul> <add>); <add>``` <add>Notice that the keys selected were all unique. The `key` is required to be unique. If you are unable to provide a unique key from the list of items you are iterating over, you can use the `index`. <add>```javascript <add>const troops = ['general','major','platoon leader','cadet','cadet']; <add>const troopItems = troops.map((soldier, index) => <add> <ul key={index}> <add> {soldier} <add> </ul> <add>); <add>``` <add>Although it is not recommended to use index if the order of items change. Many in the React community use index as a last resort. <add> <add>### More Information <add>- [Keys Doc](https://reactjs.org/docs/lists-and-keys.html) <add>- [Dangers of Using Index as the Key](https://medium.com/@robinpokorny/index-as-a-key-is-an-anti-pattern-e0349aece318)
1
Ruby
Ruby
add tap_audit_exceptions attribute
089810709cfaae625867f2ee3e9c61f6822e9a2c
<ide><path>Library/Homebrew/dev-cmd/audit.rb <ide> def problem(text) <ide> end <ide> <ide> class TapAuditor <del> attr_reader :name, :path, :problems <add> attr_reader :name, :path, :tap_audit_exceptions, :problems <ide> <ide> def initialize(tap, options = {}) <ide> @name = tap.name
1
Python
Python
click detects program name when run as module
055cdc2625c0cdf8cea87524f5c6bcf07f7e5005
<ide><path>src/flask/__main__.py <ide> from .cli import main <ide> <del>main(as_module=True) <add>main() <ide><path>src/flask/cli.py <ide> def routes_command(sort, all_methods): <ide> ) <ide> <ide> <del>def main(as_module=False): <add>def main(): <ide> # TODO omit sys.argv once https://github.com/pallets/click/issues/536 is fixed <del> cli.main(args=sys.argv[1:], prog_name="python -m flask" if as_module else None) <add> cli.main(args=sys.argv[1:]) <ide> <ide> <ide> if __name__ == "__main__": <del> main(as_module=True) <add> main()
2
Javascript
Javascript
extract logic for detecting bad fallback to helper
bdd3d0807c6e9f417909bab93ffe9795128b04d8
<ide><path>packages/react-reconciler/src/ReactFiberCompleteWork.new.js <ide> import type {OffscreenState} from './ReactFiberOffscreenComponent'; <ide> import type {TracingMarkerInstance} from './ReactFiberTracingMarkerComponent.new'; <ide> import type {Cache} from './ReactFiberCacheComponent.new'; <ide> import { <del> enableSuspenseAvoidThisFallback, <ide> enableLegacyHidden, <ide> enableHostSingletons, <ide> enableSuspenseCallback, <ide> import { <ide> setShallowSuspenseListContext, <ide> ForceSuspenseFallback, <ide> setDefaultShallowSuspenseListContext, <add> isBadSuspenseFallback, <ide> } from './ReactFiberSuspenseContext.new'; <del>import { <del> popHiddenContext, <del> isCurrentTreeHidden, <del>} from './ReactFiberHiddenContext.new'; <add>import {popHiddenContext} from './ReactFiberHiddenContext.new'; <ide> import {findFirstSuspended} from './ReactFiberSuspenseComponent.new'; <ide> import { <ide> isContextProvider as isLegacyContextProvider, <ide> function completeWork( <ide> // If this render already had a ping or lower pri updates, <ide> // and this is the first time we know we're going to suspend we <ide> // should be able to immediately restart from within throwException. <del> <del> // Check if this is a "bad" fallback state or a good one. A bad <del> // fallback state is one that we only show as a last resort; if this <del> // is a transition, we'll block it from displaying, and wait for <del> // more data to arrive. <del> const isBadFallback = <del> // It's bad to switch to a fallback if content is already visible <del> (current !== null && !prevDidTimeout && !isCurrentTreeHidden()) || <del> // Experimental: Some fallbacks are always bad <del> (enableSuspenseAvoidThisFallback && <del> workInProgress.memoizedProps.unstable_avoidThisFallback === <del> true); <del> <del> if (isBadFallback) { <add> if (isBadSuspenseFallback(current, newProps)) { <ide> renderDidSuspendDelayIfPossible(); <ide> } else { <ide> renderDidSuspend(); <ide><path>packages/react-reconciler/src/ReactFiberCompleteWork.old.js <ide> import type {OffscreenState} from './ReactFiberOffscreenComponent'; <ide> import type {TracingMarkerInstance} from './ReactFiberTracingMarkerComponent.old'; <ide> import type {Cache} from './ReactFiberCacheComponent.old'; <ide> import { <del> enableSuspenseAvoidThisFallback, <ide> enableLegacyHidden, <ide> enableHostSingletons, <ide> enableSuspenseCallback, <ide> import { <ide> setShallowSuspenseListContext, <ide> ForceSuspenseFallback, <ide> setDefaultShallowSuspenseListContext, <add> isBadSuspenseFallback, <ide> } from './ReactFiberSuspenseContext.old'; <del>import { <del> popHiddenContext, <del> isCurrentTreeHidden, <del>} from './ReactFiberHiddenContext.old'; <add>import {popHiddenContext} from './ReactFiberHiddenContext.old'; <ide> import {findFirstSuspended} from './ReactFiberSuspenseComponent.old'; <ide> import { <ide> isContextProvider as isLegacyContextProvider, <ide> function completeWork( <ide> // If this render already had a ping or lower pri updates, <ide> // and this is the first time we know we're going to suspend we <ide> // should be able to immediately restart from within throwException. <del> <del> // Check if this is a "bad" fallback state or a good one. A bad <del> // fallback state is one that we only show as a last resort; if this <del> // is a transition, we'll block it from displaying, and wait for <del> // more data to arrive. <del> const isBadFallback = <del> // It's bad to switch to a fallback if content is already visible <del> (current !== null && !prevDidTimeout && !isCurrentTreeHidden()) || <del> // Experimental: Some fallbacks are always bad <del> (enableSuspenseAvoidThisFallback && <del> workInProgress.memoizedProps.unstable_avoidThisFallback === <del> true); <del> <del> if (isBadFallback) { <add> if (isBadSuspenseFallback(current, newProps)) { <ide> renderDidSuspendDelayIfPossible(); <ide> } else { <ide> renderDidSuspend(); <ide><path>packages/react-reconciler/src/ReactFiberSuspenseComponent.new.js <ide> export type SuspenseProps = { <ide> // TODO: Add "unstable_" prefix? <ide> suspenseCallback?: (Set<Wakeable> | null) => mixed, <ide> <add> unstable_avoidThisFallback?: boolean, <ide> unstable_expectedLoadTime?: number, <ide> unstable_name?: string, <ide> }; <ide><path>packages/react-reconciler/src/ReactFiberSuspenseComponent.old.js <ide> export type SuspenseProps = { <ide> // TODO: Add "unstable_" prefix? <ide> suspenseCallback?: (Set<Wakeable> | null) => mixed, <ide> <add> unstable_avoidThisFallback?: boolean, <ide> unstable_expectedLoadTime?: number, <ide> unstable_name?: string, <ide> }; <ide><path>packages/react-reconciler/src/ReactFiberSuspenseContext.new.js <ide> <ide> import type {Fiber} from './ReactInternalTypes'; <ide> import type {StackCursor} from './ReactFiberStack.new'; <del>import type {SuspenseState} from './ReactFiberSuspenseComponent.new'; <add>import type { <add> SuspenseState, <add> SuspenseProps, <add>} from './ReactFiberSuspenseComponent.new'; <ide> <ide> import {enableSuspenseAvoidThisFallback} from 'shared/ReactFeatureFlags'; <ide> import {createCursor, push, pop} from './ReactFiberStack.new'; <ide> function shouldAvoidedBoundaryCapture( <ide> return false; <ide> } <ide> <add>export function isBadSuspenseFallback( <add> current: Fiber | null, <add> nextProps: SuspenseProps, <add>): boolean { <add> // Check if this is a "bad" fallback state or a good one. A bad fallback state <add> // is one that we only show as a last resort; if this is a transition, we'll <add> // block it from displaying, and wait for more data to arrive. <add> if (current !== null) { <add> const prevState: SuspenseState = current.memoizedState; <add> const isShowingFallback = prevState !== null; <add> if (!isShowingFallback && !isCurrentTreeHidden()) { <add> // It's bad to switch to a fallback if content is already visible <add> return true; <add> } <add> } <add> <add> if ( <add> enableSuspenseAvoidThisFallback && <add> nextProps.unstable_avoidThisFallback === true <add> ) { <add> // Experimental: Some fallbacks are always bad <add> return true; <add> } <add> <add> return false; <add>} <add> <ide> export function pushPrimaryTreeSuspenseHandler(handler: Fiber): void { <ide> const props = handler.pendingProps; <ide> const handlerOnStack = suspenseHandlerStackCursor.current; <ide><path>packages/react-reconciler/src/ReactFiberSuspenseContext.old.js <ide> <ide> import type {Fiber} from './ReactInternalTypes'; <ide> import type {StackCursor} from './ReactFiberStack.old'; <del>import type {SuspenseState} from './ReactFiberSuspenseComponent.old'; <add>import type { <add> SuspenseState, <add> SuspenseProps, <add>} from './ReactFiberSuspenseComponent.old'; <ide> <ide> import {enableSuspenseAvoidThisFallback} from 'shared/ReactFeatureFlags'; <ide> import {createCursor, push, pop} from './ReactFiberStack.old'; <ide> function shouldAvoidedBoundaryCapture( <ide> return false; <ide> } <ide> <add>export function isBadSuspenseFallback( <add> current: Fiber | null, <add> nextProps: SuspenseProps, <add>): boolean { <add> // Check if this is a "bad" fallback state or a good one. A bad fallback state <add> // is one that we only show as a last resort; if this is a transition, we'll <add> // block it from displaying, and wait for more data to arrive. <add> if (current !== null) { <add> const prevState: SuspenseState = current.memoizedState; <add> const isShowingFallback = prevState !== null; <add> if (!isShowingFallback && !isCurrentTreeHidden()) { <add> // It's bad to switch to a fallback if content is already visible <add> return true; <add> } <add> } <add> <add> if ( <add> enableSuspenseAvoidThisFallback && <add> nextProps.unstable_avoidThisFallback === true <add> ) { <add> // Experimental: Some fallbacks are always bad <add> return true; <add> } <add> <add> return false; <add>} <add> <ide> export function pushPrimaryTreeSuspenseHandler(handler: Fiber): void { <ide> const props = handler.pendingProps; <ide> const handlerOnStack = suspenseHandlerStackCursor.current;
6
Text
Text
change text in user story to match test case
65816e0df4e473e433046f03a62f9d68b8ba8c90
<ide><path>curriculum/challenges/english/14-responsive-web-design-22/build-a-tribute-page-project/build-a-tribute-page.md <ide> dashedName: build-a-tribute-page <ide> <ide> **User Stories:** <ide> <del>1. Your tribute page should have an element with a corresponding `id="main"`, which contains all other elements <add>1. Your tribute page should have a `main` element with a corresponding `id` of `main`, which contains all other elements <ide> 1. You should see an element with an `id` of `title`, which contains a string (i.e. text), that describes the subject of the tribute page (e.g. "Dr. Norman Borlaug") <ide> 1. You should see either a `figure` or a `div` element with an `id` of `img-div` <ide> 1. Within the `#img-div` element, you should see an `img` element with a corresponding `id="image"`
1
Javascript
Javascript
use one history item for reentered line
3ea0397a1a679e7ffaaf353bc67afca2a4065fa5
<ide><path>lib/readline.js <ide> Interface.prototype._onLine = function(line) { <ide> Interface.prototype._addHistory = function() { <ide> if (this.line.length === 0) return ''; <ide> <del> this.history.unshift(this.line); <del> this.historyIndex = -1; <add> if (this.history.length === 0 || this.history[0] !== this.line) { <add> this.history.unshift(this.line); <ide> <del> // Only store so many <del> if (this.history.length > kHistorySize) this.history.pop(); <add> // Only store so many <add> if (this.history.length > kHistorySize) this.history.pop(); <add> } <ide> <add> this.historyIndex = -1; <ide> return this.history[0]; <ide> }; <ide>
1
Python
Python
switch bitnami images in tests to "standard" ones
eb26510d3a1ccfaa9e4f8e1e0c91b5c74ae7393e
<ide><path>tests/providers/docker/decorators/test_docker.py <ide> <ide> class TestDockerDecorator: <ide> def test_basic_docker_operator(self, dag_maker): <del> @task.docker(image="quay.io/bitnami/python:3.9") <add> @task.docker(image="python:3.9-slim") <ide> def f(): <ide> import random <ide> <ide> def f(): <ide> assert len(ti.xcom_pull()) == 100 <ide> <ide> def test_basic_docker_operator_with_param(self, dag_maker): <del> @task.docker(image="quay.io/bitnami/python:3.9") <add> @task.docker(image="python:3.9-slim") <ide> def f(num_results): <ide> import random <ide> <ide> def f(num_results): <ide> <ide> def test_basic_docker_operator_multiple_output(self, dag_maker): <ide> @task.docker( <del> image="quay.io/bitnami/python:3.9", <add> image="python:3.9-slim", <ide> multiple_outputs=True, <ide> ) <ide> def return_dict(number: int): <ide> def return_dict(number: int): <ide> assert ti.xcom_pull() == {"number": test_number + 1, "43": 43} <ide> <ide> def test_no_return(self, dag_maker): <del> @task.docker(image="quay.io/bitnami/python:3.9") <add> @task.docker(image="python:3.9-slim") <ide> def f(): <ide> pass <ide> <ide> def test_call_decorated_multiple_times(self): <ide> """Test calling decorated function 21 times in a DAG""" <ide> <ide> @task.docker( <del> image="quay.io/bitnami/python:3.9", <add> image="python:3.9-slim", <ide> network_mode="bridge", <ide> api_version="auto", <ide> )
1
Javascript
Javascript
exclude smart quotes at the end of the link
7c6be43e83590798cffef63d076fb79d5296fba2
<ide><path>src/ngSanitize/filter/linky.js <ide> */ <ide> angular.module('ngSanitize').filter('linky', ['$sanitize', function($sanitize) { <ide> var LINKY_URL_REGEXP = <del> /((ftp|https?):\/\/|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>"]/, <add> /((ftp|https?):\/\/|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>"”’]/, <ide> MAILTO_REGEXP = /^mailto:/; <ide> <ide> return function(text, target) { <ide><path>test/ngSanitize/filter/linkySpec.js <ide> describe('linky', function() { <ide> })); <ide> <ide> it('should do basic filter', function() { <del> expect(linky("http://ab/ (http://a/) <http://a/> http://1.2/v:~-123. c")). <add> expect(linky("http://ab/ (http://a/) <http://a/> http://1.2/v:~-123. c “http://example.com” ‘http://me.com’")). <ide> toEqual('<a href="http://ab/">http://ab/</a> ' + <ide> '(<a href="http://a/">http://a/</a>) ' + <ide> '&lt;<a href="http://a/">http://a/</a>&gt; ' + <del> '<a href="http://1.2/v:~-123">http://1.2/v:~-123</a>. c'); <add> '<a href="http://1.2/v:~-123">http://1.2/v:~-123</a>. c ' + <add> '&#8220;<a href="http://example.com">http://example.com</a>&#8221; ' + <add> '&#8216;<a href="http://me.com">http://me.com</a>&#8217;'); <ide> expect(linky(undefined)).not.toBeDefined(); <ide> }); <ide>
2
Ruby
Ruby
fix sse support on core 2 processors
c6d98678acaf899ea777d335a3abe1abb8a9e1d4
<ide><path>Library/Homebrew/brewkit.rb <ide> # http://gcc.gnu.org/onlinedocs/gcc-4.2.1/gcc/i386-and-x86_002d64-Options.html <ide> if MACOS_VERSION >= 10.6 <ide> case Hardware.intel_family <del> when :penryn <del> cflags<<'-march=core2'<<'-msse4.1' <del> when :core2 <del> cflags<<"-march=core2"<<'-msse4' <del> when :core1 <del> cflags<<"-march=prescott"<<'-msse3' <add> when :penryn, :core2 <add> cflags<<"-march=core2" <add> when :core <add> cflags<<"-march=prescott" <ide> end <ide> ENV['LDFLAGS']="-arch x86_64" <del> cflags<<'-m64'<<'-mmmx' <add> cflags<<"-m64" <ide> else <ide> case Hardware.intel_family <del> when :penryn <del> cflags<<"-march=nocona"<<'-msse4.1' <del> when :core2 <del> cflags<<"-march=nocona"<<'-msse4' <del> when :core1 <del> cflags<<"-march=prescott"<<'-msse3' <add> when :penryn, :core2 <add> cflags<<"-march=nocona" <add> when :core <add> cflags<<"-march=prescott" <ide> end <ide> # to be consistent with cflags, we ignore the existing environment <ide> ENV['LDFLAGS']="" <del> cflags<<'-mmmx'<<"-mfpmath=sse" <del> <add> cflags<<"-mfpmath=sse" <ide> # gcc 4.0 is the default on Leopard <del> ENV['CC']='gcc-4.2' <del> ENV['CXX']='g++-4.2' <add> ENV['CC']="gcc-4.2" <add> ENV['CXX']="g++-4.2" <add>end <add> <add>cflags<<"-mmmx" <add>case Hardware.intel_family <add>when :penryn <add> cflags<<"-msse4.1" <add>when :core2, :core <add> cflags<<"-msse3" <ide> end <ide> <ide> # -w: keep signal to noise high
1
Python
Python
fix logger format for non-main process
6bab83683bf46352b59ab01cf596804dfdf7d973
<ide><path>examples/seq2seq/finetune_trainer.py <ide> def main(): <ide> bool(training_args.parallel_mode == ParallelMode.DISTRIBUTED), <ide> training_args.fp16, <ide> ) <add> transformers.utils.logging.enable_default_handler() <add> transformers.utils.logging.enable_explicit_format() <ide> # Set the verbosity to info of the Transformers logger (on main process only): <ide> if is_main_process(training_args.local_rank): <ide> transformers.utils.logging.set_verbosity_info() <del> transformers.utils.logging.enable_default_handler() <del> transformers.utils.logging.enable_explicit_format() <ide> logger.info("Training/evaluation parameters %s", training_args) <ide> <ide> # Set seed
1
Ruby
Ruby
remove extra whitespaces
24586edae2f808c256a9e3d5e0bf09236358ee7e
<ide><path>activerecord/lib/active_record/connection_adapters/abstract_adapter.rb <ide> def initialize(connection, logger = nil) #:nodoc: <ide> @instrumenter = ActiveSupport::Notifications.instrumenter <ide> end <ide> <del> # Returns the human-readable name of the adapter. Use mixed case - one <add> # Returns the human-readable name of the adapter. Use mixed case - one <ide> # can always use downcase if needed. <ide> def adapter_name <ide> 'Abstract' <ide> end <ide> <del> # Does this adapter support migrations? Backend specific, as the <add> # Does this adapter support migrations? Backend specific, as the <ide> # abstract adapter always returns +false+. <ide> def supports_migrations? <ide> false <ide> end <ide> <ide> # Can this adapter determine the primary key for tables not attached <del> # to an Active Record class, such as join tables? Backend specific, as <add> # to an Active Record class, such as join tables? Backend specific, as <ide> # the abstract adapter always returns +false+. <ide> def supports_primary_key? <ide> false <ide> end <ide> <del> # Does this adapter support using DISTINCT within COUNT? This is +true+ <add> # Does this adapter support using DISTINCT within COUNT? This is +true+ <ide> # for all adapters except sqlite. <ide> def supports_count_distinct? <ide> true <ide> end <ide> <del> # Does this adapter support DDL rollbacks in transactions? That is, would <del> # CREATE TABLE or ALTER TABLE get rolled back by a transaction? PostgreSQL, <del> # SQL Server, and others support this. MySQL and others do not. <add> # Does this adapter support DDL rollbacks in transactions? That is, would <add> # CREATE TABLE or ALTER TABLE get rolled back by a transaction? PostgreSQL, <add> # SQL Server, and others support this. MySQL and others do not. <ide> def supports_ddl_transactions? <ide> false <ide> end <ide> def supports_savepoints? <ide> end <ide> <ide> # Should primary key values be selected from their corresponding <del> # sequence before the insert statement? If true, next_sequence_value <add> # sequence before the insert statement? If true, next_sequence_value <ide> # is called before each insert to set the record's primary key. <ide> # This is false for all adapters but Firebird. <ide> def prefetch_primary_key?(table_name = nil) <ide> def reset! <ide> <ide> ### <ide> # Clear any caching the database adapter may be doing, for example <del> # clearing the prepared statement cache. This is database specific. <add> # clearing the prepared statement cache. This is database specific. <ide> def clear_cache! <ide> # this should be overridden by concrete adapters <ide> end
1
Text
Text
remove entries included in 5.0 [ci skip]
df6aef2518884f65871f719125a972790518fd17
<ide><path>guides/source/5_1_release_notes.md <ide> Please refer to the [Changelog][action-cable] for detailed changes. <ide> with multiple applications. <ide> ([Pull Request](https://github.com/rails/rails/pull/27425)) <ide> <del>* Permit same-origin connections by default. <del> ([commit](https://github.com/rails/rails/commit/dae404473409fcab0e07976aec626df670e52282)) <del> <ide> * Add `ActiveSupport::Notifications` hook for broadcasting data. <ide> ([Pull Request](https://github.com/rails/rails/pull/24988)) <ide> <ide> Please refer to the [Changelog][action-pack] for detailed changes. <ide> <ide> ### Deprecations <ide> <del>* Deprecated `:controller` and `:action` path parameters. <del> ([Pull Request](https://github.com/rails/rails/pull/23980)) <del> <ide> * Deprecated `config.action_controller.raise_on_unfiltered_parameters`. <ide> It doesn't have any effect in Rails 5.1. <ide> ([Commit](https://github.com/rails/rails/commit/c6640fb62b10db26004a998d2ece98baede509e5)) <ide> Please refer to the [Changelog][action-mailer] for detailed changes. <ide> <ide> ### Notable changes <ide> <del>* Exception handling: use `rescue_from` to handle exceptions raised by <del> mailer actions, by message delivery, and by deferred delivery jobs. <del> ([commit](https://github.com/rails/rails/commit/e35b98e6f5c54330245645f2ed40d56c74538902)) <del> <ide> * Allowed setting custom content type when attachments are included <ide> and body is set inline. <ide> ([Pull Request](https://github.com/rails/rails/pull/27227))
1
Python
Python
fix broken type annotation
62266fb8286e0918366b9488b4aa4a38b9d49437
<ide><path>spacy/tokens/_serialize.py <ide> def __init__( <ide> self, <ide> attrs: Iterable[str] = ALL_ATTRS, <ide> store_user_data: bool = False, <del> docs=Iterable[Doc], <add> docs: Iterable[Doc] = tuple(), <ide> ) -> None: <ide> """Create a DocBin object to hold serialized annotations. <ide>
1
Javascript
Javascript
add streams benchmark test
902fd40ed59035ee10c3637e32616ce7b858c9e2
<ide><path>test/parallel/test-benchmark-streams.js <add>'use strict'; <add> <add>require('../common'); <add> <add>const runBenchmark = require('../common/benchmark'); <add> <add>runBenchmark('streams', <add> [ <add> 'kind=duplex', <add> 'type=buffer', <add> 'n=1' <add> ], <add> { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
1
Javascript
Javascript
add textinput example to rtl tester
35b8f76c9e7cc1660b7c32b95f9bd5509e600de7
<ide><path>packages/rn-tester/js/examples/RTL/RTLExample.js <ide> const { <ide> Platform, <ide> StyleSheet, <ide> Text, <add> TextInput, <ide> TouchableWithoutFeedback, <ide> Switch, <ide> View, <ide> const TextAlignmentExample = withRTLState(({isRTL, setRTL, ...props}) => { <ide> ); <ide> }); <ide> <add>const TextInputExample = withRTLState(({isRTL, setRTL, ...props}) => { <add> return ( <add> <View> <add> <RTLToggler setRTL={setRTL} isRTL={isRTL} /> <add> <View style={directionStyle(isRTL)}> <add> <Text style={props.style}>LRT or RTL TextInput.</Text> <add> <TextInput style={props.style} /> <add> </View> <add> </View> <add> ); <add>}); <add> <ide> const IconsExample = withRTLState(({isRTL, setRTL}) => { <ide> return ( <ide> <View> <ide> exports.examples = [ <ide> ); <ide> }, <ide> }, <add> { <add> title: "Using textAlign: 'right' for TextInput", <add> description: ('Flip TextInput direction to RTL': string), <add> render: function(): React.Element<any> { <add> return <TextInputExample style={[styles.textAlignRight]} />; <add> }, <add> }, <ide> { <ide> title: 'Working With Icons', <ide> render: function(): React.Element<any> {
1
PHP
PHP
add back test incorrectly removed
fae093220c93b78e7edde33465c0817d8ec21699
<ide><path>tests/TestCase/Database/QueryTest.php <ide> public function testSelectOrderByString() <ide> $result->closeCursor(); <ide> } <ide> <add> /** <add> * Test that order() works with an associative array which contains extra values. <add> * <add> * @return void <add> */ <add> public function testSelectOrderByAssociativeArrayContainingExtraExpressions() <add> { <add> $this->loadFixtures('Articles'); <add> $query = new Query($this->connection); <add> $query->select(['id']) <add> ->from('articles') <add> ->order([ <add> 'id' => 'desc -- Comment', <add> ]); <add> $result = $query->execute(); <add> $this->assertEquals(['id' => 3], $result->fetch('assoc')); <add> $this->assertEquals(['id' => 2], $result->fetch('assoc')); <add> $this->assertEquals(['id' => 1], $result->fetch('assoc')); <add> $result->closeCursor(); <add> } <add> <ide> /** <ide> * Tests that order() works with closures. <ide> *
1
Javascript
Javascript
handle font sizes that are set as strings
ac85ce41db282368de50cf7dfdb9cf386cbfbf62
<ide><path>src/helpers/helpers.options.js <ide> export function toPadding(value) { <ide> * @private <ide> */ <ide> export function _parseFont(options) { <del> var size = valueOrDefault(options.fontSize, defaults.fontSize); <del> var font = { <add> let size = valueOrDefault(options.fontSize, defaults.fontSize); <add> <add> if (typeof size === 'string') { <add> size = parseInt(size, 10); <add> } <add> <add> const font = { <ide> family: valueOrDefault(options.fontFamily, defaults.fontFamily), <ide> lineHeight: toLineHeight(valueOrDefault(options.lineHeight, defaults.lineHeight), size), <ide> size: size, <ide><path>test/specs/helpers.options.tests.js <ide> describe('Chart.helpers.options', function() { <ide> weight: null <ide> }); <ide> }); <add> it ('should handle a string font size', function() { <add> expect(parseFont({ <add> fontFamily: 'bla', <add> lineHeight: 8, <add> fontSize: '21', <add> fontStyle: 'zzz' <add> })).toEqual({ <add> family: 'bla', <add> lineHeight: 8 * 21, <add> size: 21, <add> string: 'zzz 21px bla', <add> style: 'zzz', <add> weight: null <add> }); <add> }); <ide> it('should return null as a font string if fontSize or fontFamily are missing', function() { <ide> const fontFamily = Chart.defaults.fontFamily; <ide> const fontSize = Chart.defaults.fontSize;
2
Javascript
Javascript
support object values for bar charts
bb5f12ad2abea9b92d1d2d1bae991a26a95c3cfb
<ide><path>src/scales/scale.category.js <ide> 'use strict'; <ide> <add>var helpers = require('../helpers/index'); <ide> var Scale = require('../core/core.scale'); <ide> <add>var isNullOrUndef = helpers.isNullOrUndef; <add> <ide> var defaultConfig = { <ide> position: 'bottom' <ide> }; <ide> module.exports = Scale.extend({ <ide> determineDataLimits: function() { <ide> var me = this; <ide> var labels = me._getLabels(); <del> me.minIndex = 0; <del> me.maxIndex = labels.length - 1; <add> var ticksOpts = me.options.ticks; <add> var min = ticksOpts.min; <add> var max = ticksOpts.max; <add> var minIndex = 0; <add> var maxIndex = labels.length - 1; <ide> var findIndex; <ide> <del> if (me.options.ticks.min !== undefined) { <add> if (min !== undefined) { <ide> // user specified min value <del> findIndex = labels.indexOf(me.options.ticks.min); <del> me.minIndex = findIndex !== -1 ? findIndex : me.minIndex; <add> findIndex = labels.indexOf(min); <add> if (findIndex >= 0) { <add> minIndex = findIndex; <add> } <ide> } <ide> <del> if (me.options.ticks.max !== undefined) { <add> if (max !== undefined) { <ide> // user specified max value <del> findIndex = labels.indexOf(me.options.ticks.max); <del> me.maxIndex = findIndex !== -1 ? findIndex : me.maxIndex; <add> findIndex = labels.indexOf(max); <add> if (findIndex >= 0) { <add> maxIndex = findIndex; <add> } <ide> } <ide> <del> me.min = labels[me.minIndex]; <del> me.max = labels[me.maxIndex]; <add> me.minIndex = minIndex; <add> me.maxIndex = maxIndex; <add> me.min = labels[minIndex]; <add> me.max = labels[maxIndex]; <ide> }, <ide> <ide> buildTicks: function() { <ide> var me = this; <ide> var labels = me._getLabels(); <add> var minIndex = me.minIndex; <add> var maxIndex = me.maxIndex; <add> <ide> // If we are viewing some subset of labels, slice the original array <del> me.ticks = (me.minIndex === 0 && me.maxIndex === labels.length - 1) ? labels : labels.slice(me.minIndex, me.maxIndex + 1); <add> me.ticks = (minIndex === 0 && maxIndex === labels.length - 1) ? labels : labels.slice(minIndex, maxIndex + 1); <ide> }, <ide> <ide> getLabelForIndex: function(index, datasetIndex) { <ide> module.exports = Scale.extend({ <ide> }, <ide> <ide> // Used to get data value locations. Value can either be an index or a numerical value <del> getPixelForValue: function(value, index) { <add> getPixelForValue: function(value, index, datasetIndex) { <ide> var me = this; <ide> var offset = me.options.offset; <add> <ide> // 1 is added because we need the length but we have the indexes <del> var offsetAmt = Math.max((me.maxIndex + 1 - me.minIndex - (offset ? 0 : 1)), 1); <add> var offsetAmt = Math.max(me.maxIndex + 1 - me.minIndex - (offset ? 0 : 1), 1); <add> <add> var isHorizontal = me.isHorizontal(); <add> var valueDimension = (isHorizontal ? me.width : me.height) / offsetAmt; <add> var valueCategory, labels, idx, pixel; <add> <add> if (!isNullOrUndef(index) && !isNullOrUndef(datasetIndex)) { <add> value = me.chart.data.datasets[datasetIndex].data[index]; <add> } <ide> <ide> // If value is a data object, then index is the index in the data array, <ide> // not the index of the scale. We need to change that. <del> var valueCategory; <del> if (value !== undefined && value !== null) { <del> valueCategory = me.isHorizontal() ? value.x : value.y; <add> if (!isNullOrUndef(value)) { <add> valueCategory = isHorizontal ? value.x : value.y; <ide> } <ide> if (valueCategory !== undefined || (value !== undefined && isNaN(index))) { <del> var labels = me._getLabels(); <del> value = valueCategory || value; <del> var idx = labels.indexOf(value); <add> labels = me._getLabels(); <add> value = helpers.valueOrDefault(valueCategory, value); <add> idx = labels.indexOf(value); <ide> index = idx !== -1 ? idx : index; <ide> } <ide> <del> if (me.isHorizontal()) { <del> var valueWidth = me.width / offsetAmt; <del> var widthOffset = (valueWidth * (index - me.minIndex)); <del> <del> if (offset) { <del> widthOffset += (valueWidth / 2); <del> } <del> <del> return me.left + widthOffset; <del> } <del> var valueHeight = me.height / offsetAmt; <del> var heightOffset = (valueHeight * (index - me.minIndex)); <add> pixel = valueDimension * (index - me.minIndex); <ide> <ide> if (offset) { <del> heightOffset += (valueHeight / 2); <add> pixel += valueDimension / 2; <ide> } <ide> <del> return me.top + heightOffset; <add> return (isHorizontal ? me.left : me.top) + pixel; <ide> }, <ide> <ide> getPixelForTick: function(index) { <del> return this.getPixelForValue(this.ticks[index], index + this.minIndex, null); <add> return this.getPixelForValue(this.ticks[index], index + this.minIndex); <ide> }, <ide> <ide> getValueForPixel: function(pixel) { <ide> var me = this; <ide> var offset = me.options.offset; <add> var offsetAmt = Math.max(me._ticks.length - (offset ? 0 : 1), 1); <add> var isHorizontal = me.isHorizontal(); <add> var valueDimension = (isHorizontal ? me.width : me.height) / offsetAmt; <ide> var value; <del> var offsetAmt = Math.max((me._ticks.length - (offset ? 0 : 1)), 1); <del> var horz = me.isHorizontal(); <del> var valueDimension = (horz ? me.width : me.height) / offsetAmt; <ide> <del> pixel -= horz ? me.left : me.top; <add> pixel -= isHorizontal ? me.left : me.top; <ide> <ide> if (offset) { <del> pixel -= (valueDimension / 2); <add> pixel -= valueDimension / 2; <ide> } <ide> <ide> if (pixel <= 0) { <ide><path>test/specs/scale.category.tests.js <ide> describe('Category scale tests', function() { <ide> expect(yScale.getPixelForValue(0, 1, 0)).toBeCloseToPixel(107); <ide> expect(yScale.getPixelForValue(0, 3, 0)).toBeCloseToPixel(407); <ide> }); <add> <add> it('Should get the correct pixel for an object value when horizontal', function() { <add> var chart = window.acquireChart({ <add> type: 'line', <add> data: { <add> datasets: [{ <add> xAxisID: 'xScale0', <add> yAxisID: 'yScale0', <add> data: [ <add> {x: 0, y: 10}, <add> {x: 1, y: 5}, <add> {x: 2, y: 0}, <add> {x: 3, y: 25}, <add> {x: 0, y: 78} <add> ] <add> }], <add> labels: [0, 1, 2, 3] <add> }, <add> options: { <add> scales: { <add> xAxes: [{ <add> id: 'xScale0', <add> type: 'category', <add> position: 'bottom' <add> }], <add> yAxes: [{ <add> id: 'yScale0', <add> type: 'linear' <add> }] <add> } <add> } <add> }); <add> <add> var xScale = chart.scales.xScale0; <add> expect(xScale.getPixelForValue({x: 0, y: 10}, 0, 0)).toBeCloseToPixel(29); <add> expect(xScale.getPixelForValue({x: 3, y: 25}, 3, 0)).toBeCloseToPixel(506); <add> expect(xScale.getPixelForValue({x: 0, y: 78}, 4, 0)).toBeCloseToPixel(29); <add> }); <add> <add> it('Should get the correct pixel for an object value when vertical', function() { <add> var chart = window.acquireChart({ <add> type: 'line', <add> data: { <add> datasets: [{ <add> xAxisID: 'xScale0', <add> yAxisID: 'yScale0', <add> data: [ <add> {x: 0, y: 2}, <add> {x: 1, y: 4}, <add> {x: 2, y: 0}, <add> {x: 3, y: 3}, <add> {x: 0, y: 1} <add> ] <add> }], <add> labels: [0, 1, 2, 3], <add> yLabels: [0, 1, 2, 3, 4] <add> }, <add> options: { <add> scales: { <add> xAxes: [{ <add> id: 'xScale0', <add> type: 'category', <add> position: 'bottom' <add> }], <add> yAxes: [{ <add> id: 'yScale0', <add> type: 'category', <add> position: 'left' <add> }] <add> } <add> } <add> }); <add> <add> var yScale = chart.scales.yScale0; <add> expect(yScale.getPixelForValue({x: 0, y: 2}, 0, 0)).toBeCloseToPixel(257); <add> expect(yScale.getPixelForValue({x: 0, y: 1}, 4, 0)).toBeCloseToPixel(144); <add> }); <add> <add> it('Should get the correct pixel for an object value in a bar chart', function() { <add> var chart = window.acquireChart({ <add> type: 'bar', <add> data: { <add> datasets: [{ <add> xAxisID: 'xScale0', <add> yAxisID: 'yScale0', <add> data: [ <add> {x: 0, y: 10}, <add> {x: 1, y: 5}, <add> {x: 2, y: 0}, <add> {x: 3, y: 25}, <add> {x: 0, y: 78} <add> ] <add> }], <add> labels: [0, 1, 2, 3] <add> }, <add> options: { <add> scales: { <add> xAxes: [{ <add> id: 'xScale0', <add> type: 'category', <add> position: 'bottom' <add> }], <add> yAxes: [{ <add> id: 'yScale0', <add> type: 'linear' <add> }] <add> } <add> } <add> }); <add> <add> var xScale = chart.scales.xScale0; <add> expect(xScale.getPixelForValue(null, 0, 0)).toBeCloseToPixel(89); <add> expect(xScale.getPixelForValue(null, 3, 0)).toBeCloseToPixel(449); <add> expect(xScale.getPixelForValue(null, 4, 0)).toBeCloseToPixel(89); <add> }); <add> <add> it('Should get the correct pixel for an object value in a horizontal bar chart', function() { <add> var chart = window.acquireChart({ <add> type: 'horizontalBar', <add> data: { <add> datasets: [{ <add> xAxisID: 'xScale0', <add> yAxisID: 'yScale0', <add> data: [ <add> {x: 10, y: 0}, <add> {x: 5, y: 1}, <add> {x: 0, y: 2}, <add> {x: 25, y: 3}, <add> {x: 78, y: 0} <add> ] <add> }], <add> labels: [0, 1, 2, 3] <add> }, <add> options: { <add> scales: { <add> xAxes: [{ <add> id: 'xScale0', <add> type: 'linear', <add> position: 'bottom' <add> }], <add> yAxes: [{ <add> id: 'yScale0', <add> type: 'category' <add> }] <add> } <add> } <add> }); <add> <add> var yScale = chart.scales.yScale0; <add> expect(yScale.getPixelForValue(null, 0, 0)).toBeCloseToPixel(88); <add> expect(yScale.getPixelForValue(null, 3, 0)).toBeCloseToPixel(426); <add> expect(yScale.getPixelForValue(null, 4, 0)).toBeCloseToPixel(88); <add> }); <ide> });
2
Javascript
Javascript
add spec for imagestore
5e6cebe50bb38ac257094227f5db9c5defd4c0f8
<ide><path>Libraries/Image/ImageStore.js <ide> */ <ide> 'use strict'; <ide> <del>const RCTImageStoreManager = require('../BatchedBridge/NativeModules') <del> .ImageStoreManager; <add>import NativeImageStore from './NativeImageStore'; <ide> <ide> const Platform = require('../Utilities/Platform'); <ide> <ide> class ImageStore { <ide> * @platform ios <ide> */ <ide> static hasImageForTag(uri: string, callback: (hasImage: boolean) => void) { <del> if (RCTImageStoreManager.hasImageForTag) { <del> RCTImageStoreManager.hasImageForTag(uri, callback); <add> if (NativeImageStore.hasImageForTag) { <add> NativeImageStore.hasImageForTag(uri, callback); <ide> } else { <ide> warnUnimplementedMethod('hasImageForTag'); <ide> } <ide> class ImageStore { <ide> * @platform ios <ide> */ <ide> static removeImageForTag(uri: string) { <del> if (RCTImageStoreManager.removeImageForTag) { <del> RCTImageStoreManager.removeImageForTag(uri); <add> if (NativeImageStore.removeImageForTag) { <add> NativeImageStore.removeImageForTag(uri); <ide> } else { <ide> warnUnimplementedMethod('removeImageForTag'); <ide> } <ide> class ImageStore { <ide> success: (uri: string) => void, <ide> failure: (error: any) => void, <ide> ) { <del> if (RCTImageStoreManager.addImageFromBase64) { <del> RCTImageStoreManager.addImageFromBase64( <del> base64ImageData, <del> success, <del> failure, <del> ); <add> if (NativeImageStore.addImageFromBase64) { <add> NativeImageStore.addImageFromBase64(base64ImageData, success, failure); <ide> } else { <ide> warnUnimplementedMethod('addImageFromBase64'); <ide> } <ide> class ImageStore { <ide> success: (base64ImageData: string) => void, <ide> failure: (error: any) => void, <ide> ) { <del> if (RCTImageStoreManager.getBase64ForTag) { <del> RCTImageStoreManager.getBase64ForTag(uri, success, failure); <add> if (NativeImageStore.getBase64ForTag) { <add> NativeImageStore.getBase64ForTag(uri, success, failure); <ide> } else { <ide> warnUnimplementedMethod('getBase64ForTag'); <ide> } <ide><path>Libraries/Image/NativeImageStore.js <add>/** <add> * Copyright (c) Facebook, Inc. and its affiliates. <add> * <add> * This source code is licensed under the MIT license found in the <add> * LICENSE file in the root directory of this source tree. <add> * <add> * @flow <add> * @format <add> */ <add> <add>'use strict'; <add> <add>import type {TurboModule} from '../TurboModule/RCTExport'; <add>import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; <add> <add>export interface Spec extends TurboModule { <add> // Common <add> +getBase64ForTag: ( <add> uri: string, <add> success: (base64ImageData: string) => void, <add> failure: (error: Object) => void, <add> ) => void; <add> <add> // iOS-only <add> +hasImageForTag: (uri: string, callback: (hasImage: boolean) => void) => void; <add> +removeImageForTag: (uri: string) => void; <add> +addImageFromBase64: ( <add> base64ImageData: string, <add> success: (uri: string) => void, <add> failure: (error: Object) => void, <add> ) => void; <add>} <add> <add>export default TurboModuleRegistry.getEnforcing<Spec>('ImageStoringManager');
2
PHP
PHP
fix composite key generation in postgres
06325003cfa27f20c4a2fb319d52efa77a16bad7
<ide><path>Cake/Database/Schema/PostgresSchema.php <ide> <?php <ide> /** <del> * PHP Version 5.4 <del> * <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> public function convertIndexDescription(Table $table, $row) { <ide> 'type' => $type, <ide> 'columns' => $columns <ide> ]); <add> <add> // If there is only one column in the primary key and it is integery, <add> // make it autoincrement. <add> $columnDef = $table->column($columns[0]); <add> if ( <add> count($columns) === 1 && <add> in_array($columnDef['type'], ['integer', 'biginteger']) <add> ) { <add> $columnDef['autoIncrement'] = true; <add> $table->addColumn($columns[0], $columnDef); <add> } <ide> return; <ide> } <ide> $table->addIndex($name, [ <ide> public function columnSql(Table $table, $name) { <ide> $data = $table->column($name); <ide> $out = $this->_driver->quoteIdentifier($name); <ide> $typeMap = [ <del> 'biginteger' => ' BIGINT', <ide> 'boolean' => ' BOOLEAN', <ide> 'binary' => ' BYTEA', <ide> 'float' => ' FLOAT', <ide> public function columnSql(Table $table, $name) { <ide> $out .= $typeMap[$data['type']]; <ide> } <ide> <del> if ($data['type'] === 'integer') { <del> $type = ' INTEGER'; <del> if (in_array($name, (array)$table->primaryKey())) { <del> $type = ' SERIAL'; <add> if ($data['type'] === 'integer' || $data['type'] === 'biginteger') { <add> $type = $data['type'] === 'integer' ? ' INTEGER' : ' BIGINT'; <add> if ([$name] === $table->primaryKey() || $data['autoIncrement'] === true) { <add> $type = $data['type'] === 'integer' ? ' SERIAL' : ' BIGSERIAL'; <ide> unset($data['null'], $data['default']); <ide> } <ide> $out .= $type; <ide><path>Cake/Test/TestCase/Database/Schema/PostgresSchemaTest.php <ide> public function testDescribeTable() { <ide> 'default' => null, <ide> 'length' => 20, <ide> 'precision' => null, <del> 'fixed' => null, <add> 'unsigned' => null, <ide> 'comment' => null, <add> 'autoIncrement' => true, <ide> ], <ide> 'title' => [ <ide> 'type' => 'string', <ide> public function testDescribeTable() { <ide> 'default' => null, <ide> 'length' => null, <ide> 'precision' => null, <del> 'fixed' => null, <ide> 'comment' => null, <ide> ], <ide> 'author_id' => [ <ide> public function testDescribeTable() { <ide> 'default' => null, <ide> 'length' => 10, <ide> 'precision' => null, <del> 'fixed' => null, <add> 'unsigned' => null, <ide> 'comment' => null, <add> 'autoIncrement' => null, <ide> ], <ide> 'published' => [ <ide> 'type' => 'boolean', <ide> 'null' => true, <ide> 'default' => 0, <ide> 'length' => null, <ide> 'precision' => null, <del> 'fixed' => null, <ide> 'comment' => null, <ide> ], <ide> 'views' => [ <ide> public function testDescribeTable() { <ide> 'default' => 0, <ide> 'length' => 5, <ide> 'precision' => null, <del> 'fixed' => null, <add> 'unsigned' => null, <ide> 'comment' => null, <add> 'autoIncrement' => null, <ide> ], <ide> 'created' => [ <ide> 'type' => 'datetime', <ide> 'null' => true, <ide> 'default' => null, <ide> 'length' => null, <ide> 'precision' => null, <del> 'fixed' => null, <ide> 'comment' => null, <ide> ], <ide> ]; <ide> public static function columnSqlProvider() { <ide> ['type' => 'biginteger', 'length' => 20], <ide> '"post_id" BIGINT' <ide> ], <add> [ <add> 'post_id', <add> ['type' => 'integer', 'autoIncrement' => true, 'length' => 11], <add> '"post_id" SERIAL' <add> ], <add> [ <add> 'post_id', <add> ['type' => 'biginteger', 'autoIncrement' => true, 'length' => 20], <add> '"post_id" BIGSERIAL' <add> ], <ide> // Decimal <ide> [ <ide> 'value', <ide> public function testCreateSql() { <ide> ); <ide> } <ide> <add>/** <add> * Test primary key generation & auto-increment. <add> * <add> * @return void <add> */ <add> public function testCreateSqlCompositeIntegerKey() { <add> $driver = $this->_getMockedDriver(); <add> $connection = $this->getMock('Cake\Database\Connection', [], [], '', false); <add> $connection->expects($this->any())->method('driver') <add> ->will($this->returnValue($driver)); <add> <add> $table = (new Table('articles_tags')) <add> ->addColumn('article_id', [ <add> 'type' => 'integer', <add> 'null' => false <add> ]) <add> ->addColumn('tag_id', [ <add> 'type' => 'integer', <add> 'null' => false, <add> ]) <add> ->addConstraint('primary', [ <add> 'type' => 'primary', <add> 'columns' => ['article_id', 'tag_id'] <add> ]); <add> <add> $expected = <<<SQL <add>CREATE TABLE "articles_tags" ( <add>"article_id" INTEGER NOT NULL, <add>"tag_id" INTEGER NOT NULL, <add>PRIMARY KEY ("article_id", "tag_id") <add>) <add>SQL; <add> $result = $table->createSql($connection); <add> $this->assertCount(1, $result); <add> $this->assertEquals($expected, $result[0]); <add> <add> $table = (new Table('composite_key')) <add> ->addColumn('id', [ <add> 'type' => 'integer', <add> 'null' => false, <add> 'autoIncrement' => true <add> ]) <add> ->addColumn('account_id', [ <add> 'type' => 'integer', <add> 'null' => false, <add> ]) <add> ->addConstraint('primary', [ <add> 'type' => 'primary', <add> 'columns' => ['id', 'account_id'] <add> ]); <add> <add> $expected = <<<SQL <add>CREATE TABLE "composite_key" ( <add>"id" SERIAL, <add>"account_id" INTEGER NOT NULL, <add>PRIMARY KEY ("id", "account_id") <add>) <add>SQL; <add> $result = $table->createSql($connection); <add> $this->assertCount(1, $result); <add> $this->assertEquals($expected, $result[0]); <add> } <add> <ide> /** <ide> * test dropSql <ide> *
2
Text
Text
improve the changelog entry [ci skip]
8f17a834ae98cea28ceff22bf11ce346b867bc90
<ide><path>activerecord/CHANGELOG.md <del>* Calling reset on a collection association should unload the assocation. <add>* Reset the collection association when calling `reset` on it. <add> <add> Before: <add> <add> post.comments.loaded? # => true <add> post.comments.reset <add> post.comments.loaded? # => true <add> <add> After: <add> <add> post.comments.loaded? # => true <add> post.comments.reset <add> post.comments.loaded? # => false <ide> <ide> Fixes #13777. <del> <add> <ide> *Kelsey Schlarman* <ide> <ide> * Make enum fields work as expected with the `ActiveModel::Dirty` API.
1
Ruby
Ruby
update github actions
acfdbce6d4259f9b6440f606f1dc48d4497d8393
<ide><path>Library/Homebrew/dev-cmd/tap-new.rb <ide> def tap_new <ide> pull_request: [] <ide> jobs: <ide> test-bot: <del> runs-on: macos-latest <add> runs-on: [ubuntu-latest, macos-latest] <ide> steps: <add> - name: Update Homebrew <add> run: brew update <add> <ide> - name: Set up Git repository <ide> uses: actions/checkout@v2 <del> - name: Run brew test-bot <add> <add> - name: Set up Homebrew <ide> run: | <del> set -e <del> brew update <ide> HOMEBREW_TAP_DIR="/usr/local/Homebrew/Library/Taps/#{tap.full_name}" <ide> mkdir -p "$HOMEBREW_TAP_DIR" <ide> rm -rf "$HOMEBREW_TAP_DIR" <ide> ln -s "$PWD" "$HOMEBREW_TAP_DIR" <del> brew test-bot <add> <add> - name: Run brew test-bot --only-cleanup-before <add> run: brew test-bot --only-cleanup-before <add> <add> - name: Run brew test-bot --only-setup <add> run: brew test-bot --only-setup <add> <add> - name: Run brew test-bot --only-tap-syntax <add> run: brew test-bot --only-tap-syntax <add> <add> - name: Run brew test-bot --only-formulae <add> if: github.event_name == 'pull_request' <add> run: brew test-bot --only-formulae <ide> YAML <ide> <ide> (tap.path/".github/workflows").mkpath <del> write_path(tap, ".github/workflows/main.yml", actions) <add> write_path(tap, ".github/workflows/tests.yml", actions) <ide> ohai "Created #{tap}" <ide> puts tap.path.to_s <ide> end <ide><path>Library/Homebrew/test/dev-cmd/tap-new_spec.rb <ide> end <ide> <ide> describe "brew tap-new", :integration_test do <del> it "initializes a new Tap with a ReadMe file and GitHub Actions CI" do <add> it "initializes a new tap with a README file and GitHub Actions CI" do <ide> expect { brew "tap-new", "homebrew/foo", "--verbose" } <ide> .to be_a_success <ide> .and output(%r{homebrew/foo}).to_stdout <ide> .and not_to_output.to_stderr <ide> <ide> expect(HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-foo/README.md").to exist <del> expect(HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-foo/.github/workflows/main.yml").to exist <add> expect(HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-foo/.github/workflows/tests.yml").to exist <ide> end <ide> end
2
Text
Text
fix typo in placeholder-blur-data-url error docs
57501fa7452f7d52aca29b2046f6d9e06ae2ba2e
<ide><path>errors/placeholder-blur-data-url.md <ide> <ide> You are attempting use the `next/image` component with `placeholder=blur` property but no `blurDataURL` property. <ide> <del>The `blurDataURL` might be missing because your using a string for `src` instead of a static import. <add>The `blurDataURL` might be missing because you're using a string for `src` instead of a static import. <ide> <ide> Or `blurDataURL` might be missing because the static import is an unsupported image format. Only jpg, png, and webp are supported at this time. <ide>
1
Python
Python
remove unused import
0c39654786cda773328f7b19a672cbcf7802006e
<ide><path>spacy/de/language_data.py <ide> # encoding: utf8 <ide> from __future__ import unicode_literals <del>import re <ide> <ide> from ..symbols import * <ide> from ..language_data import TOKENIZER_PREFIXES <ide><path>spacy/en/language_data.py <ide> # encoding: utf8 <ide> from __future__ import unicode_literals <del>import re <ide> <ide> from ..symbols import * <ide> from ..language_data import TOKENIZER_PREFIXES
2
Text
Text
add some missing imports
8ee763739d66bbaaa9c0f78fa05bbc17dce3de13
<ide><path>docs/tutorial/3-class-based-views.md <ide> We can also write our API views using class based views, rather than function ba <ide> We'll start by rewriting the root view as a class based view. All this involves is a little bit of refactoring. <ide> <ide> from blog.models import Comment <del> from blog.serializers import ComentSerializer <add> from blog.serializers import CommentSerializer <ide> from django.http import Http404 <ide> from djangorestframework.views import APIView <ide> from djangorestframework.response import Response <del> from djangorestframework.status import status <add> from djangorestframework import status <add> <ide> <ide> class CommentRoot(APIView): <ide> """ <ide> List all comments, or create a new comment. <del> """ <add> """ <ide> def get(self, request, format=None): <ide> comments = Comment.objects.all() <del> serializer = ComentSerializer(instance=comments) <add> serializer = CommentSerializer(instance=comments) <ide> return Response(serializer.data) <ide> <del> def post(self, request, format=None) <del> serializer = ComentSerializer(request.DATA) <add> def post(self, request, format=None): <add> serializer = CommentSerializer(request.DATA) <ide> if serializer.is_valid(): <ide> comment = serializer.object <ide> comment.save() <del> return Response(serializer.serialized, status=HTTP_201_CREATED) <del> return Response(serializer.serialized_errors, status=HTTP_400_BAD_REQUEST) <add> return Response(serializer.serialized, status=status.HTTP_201_CREATED) <add> return Response(serializer.serialized_errors, status=status.HTTP_400_BAD_REQUEST) <ide> <del> comment_root = CommentRoot.as_view() <add> comment_root = CommentRoot.as_view() <ide> <ide> So far, so good. It looks pretty similar to the previous case, but we've got better seperation between the different HTTP methods. We'll also need to update the instance view. <ide> <ide> class CommentInstance(APIView): <ide> """ <ide> Retrieve, update or delete a comment instance. <ide> """ <del> <add> <ide> def get_object(self, pk): <ide> try: <ide> return Comment.objects.get(pk=pk) <ide> except Comment.DoesNotExist: <ide> raise Http404 <del> <add> <ide> def get(self, request, pk, format=None): <ide> comment = self.get_object(pk) <ide> serializer = CommentSerializer(instance=comment) <ide> return Response(serializer.data) <del> <add> <ide> def put(self, request, pk, format=None): <ide> comment = self.get_object(pk) <ide> serializer = CommentSerializer(request.DATA, instance=comment) <ide> So far, so good. It looks pretty similar to the previous case, but we've got be <ide> comment.delete() <ide> return Response(status=status.HTTP_204_NO_CONTENT) <ide> <del> comment_instance = CommentInstance.as_view() <add> comment_instance = CommentInstance.as_view() <ide> <ide> That's looking good. Again, it's still pretty similar to the function based view right now. <ide> Okay, we're done. If you run the development server everything should be working just as before.
1
Javascript
Javascript
fix double application of ambient light
2d3f69905f8f426fdc43c1c082cac6b56bd54713
<ide><path>src/renderers/shaders/ShaderLib.js <ide> THREE.ShaderLib = { <ide> " #ifdef DOUBLE_SIDED", <ide> <ide> " if ( gl_FrontFacing )", <del> " outgoingLight += diffuseColor.rgb * ( vLightFront * shadowMask + totalAmbientLight ) + emissive;", <add> " outgoingLight += diffuseColor.rgb * ( vLightFront * shadowMask ) + emissive;", <ide> " else", <del> " outgoingLight += diffuseColor.rgb * ( vLightBack * shadowMask + totalAmbientLight ) + emissive;", <add> " outgoingLight += diffuseColor.rgb * ( vLightBack * shadowMask ) + emissive;", <ide> <ide> " #else", <ide> <del> " outgoingLight += diffuseColor.rgb * ( vLightFront * shadowMask + totalAmbientLight ) + emissive;", <add> " outgoingLight += diffuseColor.rgb * ( vLightFront * shadowMask ) + emissive;", <ide> <ide> " #endif", <ide>
1
Python
Python
remove unnecessary backslashes when not needed
78d269d847dcea87302580bf56a5c41b7b69f122
<ide><path>numpy/distutils/command/build_src.py <ide> def generate_sources(self, sources, extension): <ide> # incl_dirs = extension.include_dirs <ide> #if self.build_src not in incl_dirs: <ide> # incl_dirs.append(self.build_src) <del> build_dir = os.path.join(*([self.build_src]\ <add> build_dir = os.path.join(*([self.build_src] <ide> +name.split('.')[:-1])) <ide> self.mkpath(build_dir) <ide> for func in func_sources: <ide> def f2py_sources(self, sources, extension): <ide> if is_sequence(extension): <ide> name = extension[0] <ide> else: name = extension.name <del> target_dir = os.path.join(*([self.build_src]\ <add> target_dir = os.path.join(*([self.build_src] <ide> +name.split('.')[:-1])) <ide> target_file = os.path.join(target_dir, ext_name + 'module.c') <ide> new_sources.append(target_file) <ide><path>numpy/distutils/command/config.py <ide> def get_output(self, body, headers=None, include_dirs=None, <ide> of the program and its output. <ide> """ <ide> # 2008-11-16, RemoveMe <del> warnings.warn("\n+++++++++++++++++++++++++++++++++++++++++++++++++\n" \ <del> "Usage of get_output is deprecated: please do not \n" \ <del> "use it anymore, and avoid configuration checks \n" \ <del> "involving running executable on the target machine.\n" \ <add> warnings.warn("\n+++++++++++++++++++++++++++++++++++++++++++++++++\n" <add> "Usage of get_output is deprecated: please do not \n" <add> "use it anymore, and avoid configuration checks \n" <add> "involving running executable on the target machine.\n" <ide> "+++++++++++++++++++++++++++++++++++++++++++++++++\n", <ide> DeprecationWarning, stacklevel=2) <ide> self._check_compiler() <ide><path>numpy/distutils/cpuinfo.py <ide> def _is_Prescott(self): <ide> return self.is_PentiumIV() and self.has_sse3() <ide> <ide> def _is_Nocona(self): <del> return self.is_Intel() \ <del> and (self.info[0]['cpu family'] == '6' \ <del> or self.info[0]['cpu family'] == '15' ) \ <del> and (self.has_sse3() and not self.has_ssse3())\ <del> and re.match(r'.*?\blm\b', self.info[0]['flags']) is not None <add> return (self.is_Intel() <add> and (self.info[0]['cpu family'] == '6' <add> or self.info[0]['cpu family'] == '15') <add> and (self.has_sse3() and not self.has_ssse3()) <add> and re.match(r'.*?\blm\b', self.info[0]['flags']) is not None) <ide> <ide> def _is_Core2(self): <del> return self.is_64bit() and self.is_Intel() and \ <del> re.match(r'.*?Core\(TM\)2\b', \ <del> self.info[0]['model name']) is not None <add> return (self.is_64bit() and self.is_Intel() and <add> re.match(r'.*?Core\(TM\)2\b', <add> self.info[0]['model name']) is not None) <ide> <ide> def _is_Itanium(self): <ide> return re.match(r'.*?Itanium\b', <ide> def _has_mmx(self): <ide> <ide> def _has_sse(self): <ide> if self.is_Intel(): <del> return (self.info[0]['Family']==6 and \ <del> self.info[0]['Model'] in [7, 8, 9, 10, 11]) \ <del> or self.info[0]['Family']==15 <add> return ((self.info[0]['Family']==6 and <add> self.info[0]['Model'] in [7, 8, 9, 10, 11]) <add> or self.info[0]['Family']==15) <ide> elif self.is_AMD(): <del> return (self.info[0]['Family']==6 and \ <del> self.info[0]['Model'] in [6, 7, 8, 10]) \ <del> or self.info[0]['Family']==15 <add> return ((self.info[0]['Family']==6 and <add> self.info[0]['Model'] in [6, 7, 8, 10]) <add> or self.info[0]['Family']==15) <ide> else: <ide> return False <ide> <ide><path>numpy/distutils/exec_command.py <ide> def exec_command(command, execute_in='', use_shell=None, use_tee=None, <ide> # 2019-01-30, 1.17 <ide> warnings.warn('exec_command is deprecated since NumPy v1.17, use ' <ide> 'subprocess.Popen instead', DeprecationWarning, stacklevel=1) <del> log.debug('exec_command(%r,%s)' % (command,\ <add> log.debug('exec_command(%r,%s)' % (command, <ide> ','.join(['%s=%r'%kv for kv in env.items()]))) <ide> <ide> if use_tee is None: <ide><path>numpy/distutils/npy_pkg_config.py <ide> def read_config(pkgname, dirs=None): <ide> if options.define_variable: <ide> m = re.search(r'([\S]+)=([\S]+)', options.define_variable) <ide> if not m: <del> raise ValueError("--define-variable option should be of " \ <add> raise ValueError("--define-variable option should be of " <ide> "the form --define-variable=foo=bar") <ide> else: <ide> name = m.group(1) <ide><path>setup.py <ide> def get_version_info(): <ide> try: <ide> from numpy.version import git_revision as GIT_REVISION <ide> except ImportError: <del> raise ImportError("Unable to import git_revision. Try removing " \ <del> "numpy/version.py and the build directory " \ <add> raise ImportError("Unable to import git_revision. Try removing " <add> "numpy/version.py and the build directory " <ide> "before building.") <ide> else: <ide> GIT_REVISION = "Unknown"
6
Python
Python
add more context to the choicefield metadata
2484fc914159571a3867c2dae2d9b51314f4581d
<ide><path>rest_framework/fields.py <ide> def _set_choices(self, value): <ide> <ide> def metadata(self): <ide> data = super(ChoiceField, self).metadata() <del> data['choices'] = self.choices <add> data['choices'] = [{'value': v, 'name': n} for v, n in self.choices] <ide> return data <ide> <ide> def validate(self, value):
1
Go
Go
add the mediatype to the error
c127d9614f5b30bd73861877f8540a63e7d869e9
<ide><path>cli/command/image/pull.go <ide> func runPull(dockerCli *command.DockerCli, opts pullOptions) error { <ide> err = imagePullPrivileged(ctx, dockerCli, authConfig, reference.FamiliarString(distributionRef), requestPrivilege, opts.all) <ide> } <ide> if err != nil { <del> if strings.Contains(err.Error(), "target is plugin") { <add> if strings.Contains(err.Error(), "when fetching 'plugin'") { <ide> return errors.New(err.Error() + " - Use `docker plugin install`") <ide> } <ide> return err <ide><path>cli/command/plugin/install.go <ide> func runInstall(dockerCli *command.DockerCli, opts pluginOptions) error { <ide> <ide> responseBody, err := dockerCli.Client().PluginInstall(ctx, alias, options) <ide> if err != nil { <del> if strings.Contains(err.Error(), "target is image") { <add> if strings.Contains(err.Error(), "(image) when fetching") { <ide> return errors.New(err.Error() + " - Use `docker image pull`") <ide> } <ide> return err <ide><path>distribution/pull_v2.go <ide> func (p *v2Puller) pullV2Tag(ctx context.Context, ref reference.Named) (tagUpdat <ide> if configClass == "" { <ide> configClass = "unknown" <ide> } <del> return false, fmt.Errorf("target is %s", configClass) <add> return false, fmt.Errorf("Encountered remote %q(%s) when fetching", m.Manifest.Config.MediaType, configClass) <ide> } <ide> } <ide> <ide><path>integration-cli/docker_cli_plugins_test.go <ide> func (s *DockerRegistrySuite) TestPluginInstallImage(c *check.C) { <ide> <ide> out, _, err := dockerCmdWithError("plugin", "install", repoName) <ide> c.Assert(err, checker.NotNil) <del> c.Assert(out, checker.Contains, "target is image") <add> c.Assert(out, checker.Contains, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) <ide> } <ide> <ide> func (s *DockerSuite) TestPluginEnableDisableNegative(c *check.C) {
4
Ruby
Ruby
remove deprecation comment
ea8a66f38570ce81f433f44ddc0c25c2abe5fb8f
<ide><path>Library/Homebrew/cmd/tap.rb <ide> def tap_args <ide> switch "--full", <ide> description: "Convert a shallow clone to a full clone without untapping. Taps are only cloned as "\ <ide> "shallow clones if `--shallow` was originally passed." <del> # odeprecated "brew tap --shallow" <ide> switch "--shallow", <ide> description: "Fetch tap as a shallow clone rather than a full clone. Useful for continuous integration." <ide> switch "--force-auto-update",
1
PHP
PHP
use strpos instead of array_search
3cf9fe0005e42522b8528fa41fda6b8ed3cb1805
<ide><path>src/Http/Response.php <ide> protected function _sendFile($file, $range) <ide> } <ide> <ide> $bufferSize = 8192; <del> if (array_search('set_time_limit', explode(',', ini_get('disable_functions'))) === false) { <add> if (strpos(ini_get('disable_functions'),'set_time_limit') === false) { <ide> set_time_limit(0); <ide> } <ide> session_write_close();
1
Java
Java
fix drawimagewithpipeline for nodes
aadf4dfdc2579b8e67bf9833e9529026c9359e6f
<ide><path>ReactAndroid/src/main/java/com/facebook/react/flat/DrawImageWithPipeline.java <ide> <ide> @Override <ide> public boolean hasImageRequest() { <del> return mRequestHelper != null; <add> return mSources != null && !mSources.isEmpty(); <ide> } <ide> <ide> @Override
1
Text
Text
fix a typo in docs
c11310b0f152c1aef20016c6dc0e2833c35badcf
<ide><path>errors/invalid-page-config.md <ide> In one of your pages or API Routes you did `export const config` with an invalid <ide> #### Possible Ways to Fix It <ide> <ide> The page's config must be an object initialized directly when being exported and not modified dynamically. <del>The config object must only contains static constant literals without expressions. <add>The config object must only contain static constant literals without expressions. <ide> <ide> <table> <ide> <thead>
1
Javascript
Javascript
make matchlatestdefinitionenabled work
d86f6be57bbfc154c36e42469008a87bfaeef1d2
<ide><path>src/ngMock/angular-mocks.js <ide> function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { <ide> * as a getter <ide> */ <ide> $httpBackend.matchLatestDefinitionEnabled = function(value) { <del> if (isDefined(value)) { <add> if (angular.isDefined(value)) { <ide> matchLatestDefinition = value; <ide> return this; <ide> } else {
1
Ruby
Ruby
remove unused test cask
3dbbcd11cc8b2d70cf8cef901c2e268d3e75cc7f
<ide><path>Library/Homebrew/test/support/fixtures/cask/Casks/compat/with-dsl-version.rb <del>cask :v1 => 'with-dsl-version' do <del> version '1.2.3' <del> sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' <del> <del> url 'https://example.com/TestCask.dmg' <del> homepage 'https://example.com/' <del> <del> app 'TestCask.app' <del>end
1
PHP
PHP
queue
51647eb701307e7682f7489b605a146e750abf0f
<ide><path>src/Illuminate/Contracts/Console/Kernel.php <ide> public function call($command, array $parameters = []); <ide> * <ide> * @param string $command <ide> * @param array $parameters <del> * @return int <add> * @return \Illuminate\Foundation\Bus\PendingDispatch <ide> */ <ide> public function queue($command, array $parameters = []); <ide> <ide><path>src/Illuminate/Foundation/Console/Kernel.php <ide> public function call($command, array $parameters = [], $outputBuffer = null) <ide> * <ide> * @param string $command <ide> * @param array $parameters <del> * @return void <add> * @return \Illuminate\Foundation\Bus\PendingDispatch <ide> */ <ide> public function queue($command, array $parameters = []) <ide> { <del> $this->app[QueueContract::class]->push( <del> new QueuedCommand(func_get_args()) <del> ); <add> return QueuedCommand::dispatch(func_get_args()); <ide> } <ide> <ide> /** <ide><path>src/Illuminate/Foundation/Console/QueuedCommand.php <ide> <ide> namespace Illuminate\Foundation\Console; <ide> <add>use Illuminate\Bus\Queueable; <add>use Illuminate\Foundation\Bus\Dispatchable; <ide> use Illuminate\Contracts\Queue\ShouldQueue; <ide> use Illuminate\Contracts\Console\Kernel as KernelContract; <ide> <ide> class QueuedCommand implements ShouldQueue <ide> { <add> use Dispatchable, Queueable; <add> <ide> /** <ide> * The data to pass to the Artisan command. <ide> *
3
Text
Text
fix typo in collaborator guide
f35de1c98de972ae71af13f8aae266fcd7c66e78
<ide><path>COLLABORATOR_GUIDE.md <ide> <ide> ## Issues and Pull Requests <ide> <del>Full courtesey should always be shown in video.js projects. <add>Full courtesy should always be shown in video.js projects. <ide> <ide> Collaborators may manage issues they feel qualified to handle, being mindful of our guidelines. <ide>
1
Javascript
Javascript
fix linting errors
169334961646924f489172bcde0fdcb1c01846db
<ide><path>tools/doc/type-parser.js <ide> const jsPrimitiveUrl = 'https://developer.mozilla.org/en-US/docs/Web/' + <ide> 'JavaScript/Data_structures'; <ide> const jsPrimitives = [ <ide> 'Number', 'String', 'Boolean', 'Null', 'Symbol' <del>] <add>]; <ide> const jsGlobalTypes = [ <ide> 'Error', 'Object', 'Function', 'Array', 'Uint8Array', <ide> 'Uint16Array', 'Uint32Array', 'Int8Array', 'Int16Array', 'Int32Array', <ide> const typeMap = { <ide> }; <ide> <ide> module.exports = { <del> toLink: function (typeInput) { <del> let typeLinks = []; <add> toLink: function(typeInput) { <add> const typeLinks = []; <ide> typeInput = typeInput.replace('{', '').replace('}', ''); <del> let typeTexts = typeInput.split('|'); <add> const typeTexts = typeInput.split('|'); <ide> <del> typeTexts.forEach(function (typeText) { <add> typeTexts.forEach(function(typeText) { <ide> typeText = typeText.trim(); <ide> if (typeText) { <ide> let typeUrl = null; <ide> module.exports = { <ide> <ide> return typeLinks.length ? typeLinks.join(' | ') : typeInput; <ide> } <del>} <add>};
1
Python
Python
use the parameter epoch to stop iter
fc08c25fe535ec9f18bf92f80406f531bfb30906
<ide><path>keras/callbacks.py <ide> def on_epoch_end(self, epoch, logs=None): <ide> if self.baseline is None or self._is_improvement(current, self.baseline): <ide> self.wait = 0 <ide> <del> if self.wait >= self.patience: <add> #Only stop after first epoch <add> if self.wait >= self.patience and epoch > 0: <ide> self.stopped_epoch = epoch <ide> self.model.stop_training = True <ide> if self.restore_best_weights and self.best_weights is not None:
1
Go
Go
add tests of tcp port allocator
febaeebfb8848265267213b2f6a6fc3a40ad90f1
<ide><path>network.go <ide> func (alloc *PortAllocator) runFountain() { <ide> <ide> // FIXME: Release can no longer fail, change its prototype to reflect that. <ide> func (alloc *PortAllocator) Release(port int) error { <add> Debugf("Releasing %d", port) <ide> alloc.lock.Lock() <ide> delete(alloc.inUse, port) <ide> alloc.lock.Unlock() <ide> return nil <ide> } <ide> <ide> func (alloc *PortAllocator) Acquire(port int) (int, error) { <add> Debugf("Acquiring %d", port) <ide> if port == 0 { <ide> // Allocate a port from the fountain <ide> for port := range alloc.fountain { <ide><path>network_test.go <ide> func TestIptables(t *testing.T) { <ide> } <ide> } <ide> <add>func TestPortAllocation(t *testing.T) { <add> allocator, err := newPortAllocator() <add> if err != nil { <add> t.Fatal(err) <add> } <add> if port, err := allocator.Acquire(80); err != nil { <add> t.Fatal(err) <add> } else if port != 80 { <add> t.Fatalf("Acquire(80) should return 80, not %d", port) <add> } <add> port, err := allocator.Acquire(0) <add> if err != nil { <add> t.Fatal(err) <add> } <add> if port <= 0 { <add> t.Fatalf("Acquire(0) should return a non-zero port") <add> } <add> if _, err := allocator.Acquire(port); err == nil { <add> t.Fatalf("Acquiring a port already in use should return an error") <add> } <add> if newPort, err := allocator.Acquire(0); err != nil { <add> t.Fatal(err) <add> } else if newPort == port { <add> t.Fatalf("Acquire(0) allocated the same port twice: %d", port) <add> } <add> if _, err := allocator.Acquire(80); err == nil { <add> t.Fatalf("Acquiring a port already in use should return an error") <add> } <add> if err := allocator.Release(80); err != nil { <add> t.Fatal(err) <add> } <add> if _, err := allocator.Acquire(80); err != nil { <add> t.Fatal(err) <add> } <add>} <add> <ide> func TestNetworkRange(t *testing.T) { <ide> // Simple class C test <ide> _, network, _ := net.ParseCIDR("192.168.0.1/24")
2
Ruby
Ruby
restore i18n.locale after running tests
9b520d31e5d534dc5b93c0d4410efa933a6745c8
<ide><path>actionpack/test/controller/localized_templates_test.rb <ide> class LocalizedTemplatesTest < ActionController::TestCase <ide> tests LocalizedController <ide> <ide> def test_localized_template_is_used <add> old_locale = I18n.locale <ide> I18n.locale = :de <ide> get :hello_world <ide> assert_equal "Gutten Tag", @response.body <add> ensure <add> I18n.locale = old_locale <ide> end <ide> <ide> def test_default_locale_template_is_used_when_locale_is_missing <add> old_locale = I18n.locale <ide> I18n.locale = :dk <ide> get :hello_world <ide> assert_equal "Hello World", @response.body <add> ensure <add> I18n.locale = old_locale <ide> end <del>end <ide>\ No newline at end of file <add>end
1
Python
Python
set poll_interval to 0.0 in the tests
7c5c46c5b5a62b79b55296073de8c2b141366fbe
<ide><path>test/compute/test_cloudstack.py <ide> def setUp(self): <ide> self.driver.path = '/test/path' <ide> self.driver.type = -1 <ide> CloudStackMockHttp.fixture_tag = 'default' <add> self.driver.connection.poll_interval = 0.0 <ide> <ide> def test_create_node_immediate_failure(self): <ide> size = self.driver.list_sizes()[0] <ide><path>test/dns/test_rackspace.py <ide> def setUp(self): <ide> None, RackspaceMockHttp) <ide> RackspaceMockHttp.type = None <ide> self.driver = self.klass(*DNS_PARAMS_RACKSPACE) <add> self.driver.connection.poll_interval = 0.0 <ide> <ide> def test_list_record_types(self): <ide> record_types = self.driver.list_record_types()
2
PHP
PHP
fix array keys from cached routes
d3634359a13a078839363cf34ab24d197ffe4a69
<ide><path>src/Illuminate/Routing/CompiledRouteCollection.php <ide> public function getRoutesByMethod() <ide> }) <ide> ->map(function (Collection $routes) { <ide> return $routes->mapWithKeys(function (Route $route) { <del> if ($domain = $route->getDomain()) { <del> return [$domain.'/'.$route->uri => $route]; <del> } <del> <del> return [$route->uri => $route]; <add> return [$route->getDomain().$route->uri => $route]; <ide> })->all(); <ide> }) <ide> ->all(); <ide><path>tests/Integration/Routing/CompiledRouteCollectionTest.php <ide> public function testRouteWithSamePathAndSameMethodButDiffDomainNameWithOptionsMe <ide> <ide> $this->assertEquals([ <ide> 'HEAD' => [ <del> 'foo.localhost/same/path' => $routes['foo_domain'], <del> 'bar.localhost/same/path' => $routes['bar_domain'], <add> 'foo.localhostsame/path' => $routes['foo_domain'], <add> 'bar.localhostsame/path' => $routes['bar_domain'], <ide> 'same/path' => $routes['no_domain'], <ide> ], <ide> 'GET' => [ <del> 'foo.localhost/same/path' => $routes['foo_domain'], <del> 'bar.localhost/same/path' => $routes['bar_domain'], <add> 'foo.localhostsame/path' => $routes['foo_domain'], <add> 'bar.localhostsame/path' => $routes['bar_domain'], <ide> 'same/path' => $routes['no_domain'], <ide> ], <ide> ], $this->collection()->getRoutesByMethod());
2
Mixed
Javascript
add onfocusvisiblechange to focus
2cca18728e7d8a5691df6598629ba21020e22898
<ide><path>packages/react-events/docs/Focus.md <ide> # Focus <ide> <ide> The `Focus` module responds to focus and blur events on its child. Focus events <del>are dispatched for `mouse`, `pen`, `touch`, and `keyboard` <del>pointer types. <add>are dispatched for all input types, with the exception of `onFocusVisibleChange` <add>which is only dispatched when focusing with a keyboard. <ide> <ide> Focus events do not propagate between `Focus` event responders. <ide> <ide> ```js <ide> // Example <del>const TextField = (props) => ( <del> <Focus <del> onBlur={props.onBlur} <del> onFocus={props.onFocus} <del> > <del> <textarea></textarea> <del> </Focus> <del>); <add>const Button = (props) => { <add> const [ focusVisible, setFocusVisible ] = useState(false); <add> <add> return ( <add> <Focus <add> onBlur={props.onBlur} <add> onFocus={props.onFocus} <add> onFocusVisibleChange={setFocusVisible} <add> > <add> <button <add> children={props.children} <add> style={{ <add> ...(focusVisible && focusVisibleStyles) <add> }} <add> > <add> </Focus> <add> ); <add>}; <ide> ``` <ide> <ide> ## Types <ide> <ide> ```js <ide> type FocusEvent = { <ide> target: Element, <del> type: 'blur' | 'focus' | 'focuschange' <add> type: 'blur' | 'focus' | 'focuschange' | 'focusvisiblechange' <ide> } <ide> ``` <ide> <ide> Called when the element gains focus. <ide> <ide> ### onFocusChange: boolean => void <ide> <del>Called when the element changes hover state (i.e., after `onBlur` and <add>Called when the element changes focus state (i.e., after `onBlur` and <ide> `onFocus`). <add> <add>### onFocusVisibleChange: boolean => void <add> <add>Called when the element receives or loses focus following keyboard navigation. <add>This can be used to display focus styles only for keyboard interactions. <ide><path>packages/react-events/src/Focus.js <ide> type FocusProps = { <ide> onBlur: (e: FocusEvent) => void, <ide> onFocus: (e: FocusEvent) => void, <ide> onFocusChange: boolean => void, <add> onFocusVisibleChange: boolean => void, <ide> }; <ide> <ide> type FocusState = { <del> isFocused: boolean, <ide> focusTarget: null | Element | Document, <add> isFocused: boolean, <add> isLocalFocusVisible: boolean, <ide> }; <ide> <del>type FocusEventType = 'focus' | 'blur' | 'focuschange'; <add>type FocusEventType = 'focus' | 'blur' | 'focuschange' | 'focusvisiblechange'; <ide> <ide> type FocusEvent = {| <ide> target: Element | Document, <ide> const targetEventTypes = [ <ide> {name: 'blur', passive: true, capture: true}, <ide> ]; <ide> <add>const rootEventTypes = [ <add> 'keydown', <add> 'keypress', <add> 'keyup', <add> 'mousemove', <add> 'mousedown', <add> 'mouseup', <add> 'pointermove', <add> 'pointerdown', <add> 'pointerup', <add> 'touchmove', <add> 'touchstart', <add> 'touchend', <add>]; <add> <ide> function createFocusEvent( <ide> type: FocusEventType, <ide> target: Element | Document, <ide> function dispatchFocusInEvents( <ide> const syntheticEvent = createFocusEvent('focuschange', target); <ide> context.dispatchEvent(syntheticEvent, listener, {discrete: true}); <ide> } <add> if (props.onFocusVisibleChange && state.isLocalFocusVisible) { <add> const listener = () => { <add> props.onFocusVisibleChange(true); <add> }; <add> const syntheticEvent = createFocusEvent('focusvisiblechange', target); <add> context.dispatchEvent(syntheticEvent, listener, {discrete: true}); <add> } <ide> } <ide> <ide> function dispatchFocusOutEvents( <ide> function dispatchFocusOutEvents( <ide> const syntheticEvent = createFocusEvent('focuschange', target); <ide> context.dispatchEvent(syntheticEvent, listener, {discrete: true}); <ide> } <add> dispatchFocusVisibleOutEvent(context, props, state); <add>} <add> <add>function dispatchFocusVisibleOutEvent( <add> context: ReactResponderContext, <add> props: FocusProps, <add> state: FocusState, <add>) { <add> const target = ((state.focusTarget: any): Element | Document); <add> if (props.onFocusVisibleChange && state.isLocalFocusVisible) { <add> const listener = () => { <add> props.onFocusVisibleChange(false); <add> }; <add> const syntheticEvent = createFocusEvent('focusvisiblechange', target); <add> context.dispatchEvent(syntheticEvent, listener, {discrete: true}); <add> state.isLocalFocusVisible = false; <add> } <ide> } <ide> <ide> function unmountResponder( <ide> function unmountResponder( <ide> } <ide> } <ide> <add>let isGlobalFocusVisible = true; <add> <ide> const FocusResponder = { <ide> targetEventTypes, <add> rootEventTypes, <ide> createInitialState(): FocusState { <ide> return { <del> isFocused: false, <ide> focusTarget: null, <add> isFocused: false, <add> isLocalFocusVisible: false, <ide> }; <ide> }, <ide> stopLocalPropagation: true, <ide> const FocusResponder = { <ide> // Browser focus is not expected to bubble. <ide> state.focusTarget = getEventCurrentTarget(event, context); <ide> if (state.focusTarget === target) { <del> dispatchFocusInEvents(context, props, state); <ide> state.isFocused = true; <add> state.isLocalFocusVisible = isGlobalFocusVisible; <add> dispatchFocusInEvents(context, props, state); <ide> } <ide> } <ide> break; <ide> const FocusResponder = { <ide> } <ide> } <ide> }, <add> onRootEvent( <add> event: ReactResponderEvent, <add> context: ReactResponderContext, <add> props: FocusProps, <add> state: FocusState, <add> ): void { <add> const {type, target} = event; <add> <add> switch (type) { <add> case 'mousemove': <add> case 'mousedown': <add> case 'mouseup': <add> case 'pointermove': <add> case 'pointerdown': <add> case 'pointerup': <add> case 'touchmove': <add> case 'touchstart': <add> case 'touchend': { <add> // Ignore a Safari quirks where 'mousemove' is dispatched on the 'html' <add> // element when the window blurs. <add> if (type === 'mousemove' && target.nodeName === 'HTML') { <add> return; <add> } <add> <add> isGlobalFocusVisible = false; <add> <add> // Focus should stop being visible if a pointer is used on the element <add> // after it was focused using a keyboard. <add> if ( <add> state.focusTarget === getEventCurrentTarget(event, context) && <add> (type === 'mousedown' || <add> type === 'touchstart' || <add> type === 'pointerdown') <add> ) { <add> dispatchFocusVisibleOutEvent(context, props, state); <add> } <add> break; <add> } <add> <add> case 'keydown': <add> case 'keypress': <add> case 'keyup': { <add> const nativeEvent = event.nativeEvent; <add> if ( <add> nativeEvent.key === 'Tab' && <add> !(nativeEvent.metaKey || nativeEvent.altKey || nativeEvent.ctrlKey) <add> ) { <add> isGlobalFocusVisible = true; <add> } <add> break; <add> } <add> } <add> }, <ide> onUnmount( <ide> context: ReactResponderContext, <ide> props: FocusProps, <ide><path>packages/react-events/src/__tests__/Focus-test.internal.js <ide> const createFocusEvent = type => { <ide> return event; <ide> }; <ide> <add>const createKeyboardEvent = (type, data) => { <add> return new KeyboardEvent(type, { <add> bubbles: true, <add> cancelable: true, <add> ...data, <add> }); <add>}; <add> <add>const createPointerEvent = (type, data) => { <add> const event = document.createEvent('CustomEvent'); <add> event.initCustomEvent(type, true, true); <add> if (data != null) { <add> Object.entries(data).forEach(([key, value]) => { <add> event[key] = value; <add> }); <add> } <add> return event; <add>}; <add> <ide> describe('Focus event responder', () => { <ide> let container; <ide> <ide> describe('Focus event responder', () => { <ide> }); <ide> }); <ide> <add> describe('onFocusVisibleChange', () => { <add> let onFocusVisibleChange, ref; <add> <add> beforeEach(() => { <add> onFocusVisibleChange = jest.fn(); <add> ref = React.createRef(); <add> const element = ( <add> <Focus onFocusVisibleChange={onFocusVisibleChange}> <add> <div ref={ref} /> <add> </Focus> <add> ); <add> ReactDOM.render(element, container); <add> }); <add> <add> it('is called after "focus" and "blur" if keyboard navigation is active', () => { <add> // use keyboard first <add> container.dispatchEvent(createKeyboardEvent('keydown', {key: 'Tab'})); <add> ref.current.dispatchEvent(createFocusEvent('focus')); <add> expect(onFocusVisibleChange).toHaveBeenCalledTimes(1); <add> expect(onFocusVisibleChange).toHaveBeenCalledWith(true); <add> ref.current.dispatchEvent(createFocusEvent('blur')); <add> expect(onFocusVisibleChange).toHaveBeenCalledTimes(2); <add> expect(onFocusVisibleChange).toHaveBeenCalledWith(false); <add> }); <add> <add> it('is called if non-keyboard event is dispatched on target previously focused with keyboard', () => { <add> // use keyboard first <add> container.dispatchEvent(createKeyboardEvent('keydown', {key: 'Tab'})); <add> ref.current.dispatchEvent(createFocusEvent('focus')); <add> expect(onFocusVisibleChange).toHaveBeenCalledTimes(1); <add> expect(onFocusVisibleChange).toHaveBeenCalledWith(true); <add> // then use pointer on the target, focus should no longer be visible <add> ref.current.dispatchEvent(createPointerEvent('pointerdown')); <add> expect(onFocusVisibleChange).toHaveBeenCalledTimes(2); <add> expect(onFocusVisibleChange).toHaveBeenCalledWith(false); <add> // onFocusVisibleChange should not be called again <add> ref.current.dispatchEvent(createFocusEvent('blur')); <add> expect(onFocusVisibleChange).toHaveBeenCalledTimes(2); <add> }); <add> <add> it('is not called after "focus" and "blur" events without keyboard', () => { <add> ref.current.dispatchEvent(createPointerEvent('pointerdown')); <add> ref.current.dispatchEvent(createFocusEvent('focus')); <add> container.dispatchEvent(createPointerEvent('pointerdown')); <add> ref.current.dispatchEvent(createFocusEvent('blur')); <add> expect(onFocusVisibleChange).toHaveBeenCalledTimes(0); <add> }); <add> }); <add> <ide> describe('nested Focus components', () => { <ide> it('do not propagate events by default', () => { <ide> const events = []; <ide><path>packages/react-events/src/__tests__/Press-test.internal.js <ide> describe('Event responder: Press', () => { <ide> ref.current.dispatchEvent( <ide> createPointerEvent('pointermove', coordinatesInside), <ide> ); <del> ref.current.dispatchEvent( <add> container.dispatchEvent( <ide> createPointerEvent('pointermove', coordinatesOutside), <ide> ); <del> ref.current.dispatchEvent( <add> container.dispatchEvent( <ide> createPointerEvent('pointerup', coordinatesOutside), <ide> ); <ide> jest.runAllTimers(); <ide> describe('Event responder: Press', () => { <ide> ref.current.dispatchEvent( <ide> createPointerEvent('pointermove', coordinatesInside), <ide> ); <del> ref.current.dispatchEvent( <add> container.dispatchEvent( <ide> createPointerEvent('pointermove', coordinatesOutside), <ide> ); <ide> jest.runAllTimers(); <ide> expect(events).toEqual(['onPressMove']); <ide> events = []; <del> ref.current.dispatchEvent( <add> container.dispatchEvent( <ide> createPointerEvent('pointerup', coordinatesOutside), <ide> ); <ide> jest.runAllTimers();
4
Ruby
Ruby
raise a systemexit exception to prevent backtrace
4671526d70d33de7e44d42a28ce2eee912783dc6
<ide><path>Library/Homebrew/utils.rb <ide> def pretty_duration s <ide> <ide> def interactive_shell <ide> pid=fork <del> if pid.nil? <del> exec ENV['SHELL'] <del> else <del> Process.wait pid <del> end <add> exec ENV['SHELL'] if pid.nil? <add> Process.wait pid <add> raise SystemExit, "Aborting due to non-zero exit status" if $? != 0 <ide> end <ide> <ide> # Kernel.system but with exceptions
1
Java
Java
eliminate warnings in .validation package
f4e1cde33b077b1268cc5cae0c18c4b706653d25
<ide><path>org.springframework.beans/src/main/java/org/springframework/beans/PropertyEditorRegistry.java <ide> public interface PropertyEditorRegistry { <ide> * @param requiredType the type of the property <ide> * @param propertyEditor the editor to register <ide> */ <del> void registerCustomEditor(Class requiredType, PropertyEditor propertyEditor); <add> void registerCustomEditor(Class<?> requiredType, PropertyEditor propertyEditor); <ide> <ide> /** <ide> * Register the given custom property editor for the given type and <ide> public interface PropertyEditorRegistry { <ide> * <code>null</code> if registering an editor for all properties of the given type <ide> * @param propertyEditor editor to register <ide> */ <del> void registerCustomEditor(Class requiredType, String propertyPath, PropertyEditor propertyEditor); <add> void registerCustomEditor(Class<?> requiredType, String propertyPath, PropertyEditor propertyEditor); <ide> <ide> /** <ide> * Find a custom property editor for the given type and property. <ide> public interface PropertyEditorRegistry { <ide> * <code>null</code> if looking for an editor for all properties of the given type <ide> * @return the registered editor, or <code>null</code> if none <ide> */ <del> PropertyEditor findCustomEditor(Class requiredType, String propertyPath); <add> PropertyEditor findCustomEditor(Class<?> requiredType, String propertyPath); <ide> <ide> } <ide><path>org.springframework.context/src/main/java/org/springframework/validation/AbstractBindingResult.java <ide> * @since 2.0 <ide> * @see Errors <ide> */ <add>@SuppressWarnings("serial") <ide> public abstract class AbstractBindingResult extends AbstractErrors implements BindingResult, Serializable { <ide> <ide> private final String objectName; <ide> public String[] resolveMessageCodes(String errorCode) { <ide> } <ide> <ide> public String[] resolveMessageCodes(String errorCode, String field) { <del> Class fieldType = getFieldType(field); <add> Class<?> fieldType = getFieldType(field); <ide> return getMessageCodesResolver().resolveMessageCodes( <ide> errorCode, getObjectName(), fixedField(field), fieldType); <ide> } <ide> public Object getFieldValue(String field) { <ide> * @see #getActualFieldValue <ide> */ <ide> @Override <del> public Class getFieldType(String field) { <add> public Class<?> getFieldType(String field) { <ide> Object value = getActualFieldValue(fixedField(field)); <ide> if (value != null) { <ide> return value.getClass(); <ide> public Object getRawFieldValue(String field) { <ide> * {@link #getPropertyEditorRegistry() PropertyEditorRegistry}'s <ide> * editor lookup facility, if available. <ide> */ <del> public PropertyEditor findEditor(String field, Class valueType) { <add> public PropertyEditor findEditor(String field, Class<?> valueType) { <ide> PropertyEditorRegistry editorRegistry = getPropertyEditorRegistry(); <ide> if (editorRegistry != null) { <del> Class valueTypeToUse = valueType; <add> Class<?> valueTypeToUse = valueType; <ide> if (valueTypeToUse == null) { <ide> valueTypeToUse = getFieldType(field); <ide> } <ide><path>org.springframework.context/src/main/java/org/springframework/validation/AbstractErrors.java <ide> * @author Juergen Hoeller <ide> * @since 2.5.3 <ide> */ <add>@SuppressWarnings("serial") <ide> public abstract class AbstractErrors implements Errors, Serializable { <ide> <ide> private String nestedPath = ""; <ide> public int getGlobalErrorCount() { <ide> } <ide> <ide> public ObjectError getGlobalError() { <del> List globalErrors = getGlobalErrors(); <del> return (!globalErrors.isEmpty() ? (ObjectError) globalErrors.get(0) : null); <add> List<ObjectError> globalErrors = getGlobalErrors(); <add> return (!globalErrors.isEmpty() ? globalErrors.get(0) : null); <ide> } <ide> <ide> public boolean hasFieldErrors() { <ide> public int getFieldErrorCount() { <ide> } <ide> <ide> public FieldError getFieldError() { <del> List fieldErrors = getFieldErrors(); <del> return (!fieldErrors.isEmpty() ? (FieldError) fieldErrors.get(0) : null); <add> List<FieldError> fieldErrors = getFieldErrors(); <add> return (!fieldErrors.isEmpty() ? fieldErrors.get(0) : null); <ide> } <ide> <ide> public boolean hasFieldErrors(String field) { <ide> public List<FieldError> getFieldErrors(String field) { <ide> } <ide> <ide> public FieldError getFieldError(String field) { <del> List fieldErrors = getFieldErrors(field); <add> List<FieldError> fieldErrors = getFieldErrors(field); <ide> return (!fieldErrors.isEmpty() ? (FieldError) fieldErrors.get(0) : null); <ide> } <ide> <ide> <del> public Class getFieldType(String field) { <add> public Class<?> getFieldType(String field) { <ide> Object value = getFieldValue(field); <ide> if (value != null) { <ide> return value.getClass(); <ide><path>org.springframework.context/src/main/java/org/springframework/validation/AbstractPropertyBindingResult.java <ide> * @see org.springframework.beans.PropertyAccessor <ide> * @see org.springframework.beans.ConfigurablePropertyAccessor <ide> */ <add>@SuppressWarnings("serial") <ide> public abstract class AbstractPropertyBindingResult extends AbstractBindingResult { <ide> <ide> private ConversionService conversionService; <ide> protected String canonicalFieldName(String field) { <ide> * @see #getPropertyAccessor() <ide> */ <ide> @Override <del> public Class getFieldType(String field) { <add> public Class<?> getFieldType(String field) { <ide> return getPropertyAccessor().getPropertyType(fixedField(field)); <ide> } <ide> <ide> protected Object formatFieldValue(String field, Object value) { <ide> * @return the custom PropertyEditor, or <code>null</code> <ide> */ <ide> protected PropertyEditor getCustomEditor(String fixedField) { <del> Class targetType = getPropertyAccessor().getPropertyType(fixedField); <add> Class<?> targetType = getPropertyAccessor().getPropertyType(fixedField); <ide> PropertyEditor editor = getPropertyAccessor().findCustomEditor(targetType, fixedField); <ide> if (editor == null) { <ide> editor = BeanUtils.findEditorByConvention(targetType); <ide> protected PropertyEditor getCustomEditor(String fixedField) { <ide> * if applicable. <ide> */ <ide> @Override <del> public PropertyEditor findEditor(String field, Class valueType) { <del> Class valueTypeForLookup = valueType; <add> public PropertyEditor findEditor(String field, Class<?> valueType) { <add> Class<?> valueTypeForLookup = valueType; <ide> if (valueTypeForLookup == null) { <ide> valueTypeForLookup = getFieldType(field); <ide> } <ide><path>org.springframework.context/src/main/java/org/springframework/validation/BeanPropertyBindingResult.java <ide> * @see DataBinder#initBeanPropertyAccess() <ide> * @see DirectFieldBindingResult <ide> */ <add>@SuppressWarnings("serial") <ide> public class BeanPropertyBindingResult extends AbstractPropertyBindingResult implements Serializable { <ide> <ide> private final Object target; <ide><path>org.springframework.context/src/main/java/org/springframework/validation/BindException.java <ide> * @see DataBinder#getBindingResult() <ide> * @see DataBinder#close() <ide> */ <add>@SuppressWarnings("serial") <ide> public class BindException extends Exception implements BindingResult { <ide> <ide> private final BindingResult bindingResult; <ide> public int getErrorCount() { <ide> return this.bindingResult.getErrorCount(); <ide> } <ide> <del> public List getAllErrors() { <add> public List<ObjectError> getAllErrors() { <ide> return this.bindingResult.getAllErrors(); <ide> } <ide> <ide> public int getGlobalErrorCount() { <ide> return this.bindingResult.getGlobalErrorCount(); <ide> } <ide> <del> public List getGlobalErrors() { <add> public List<ObjectError> getGlobalErrors() { <ide> return this.bindingResult.getGlobalErrors(); <ide> } <ide> <ide> public int getFieldErrorCount() { <ide> return this.bindingResult.getFieldErrorCount(); <ide> } <ide> <del> public List getFieldErrors() { <add> public List<FieldError> getFieldErrors() { <ide> return this.bindingResult.getFieldErrors(); <ide> } <ide> <ide> public int getFieldErrorCount(String field) { <ide> return this.bindingResult.getFieldErrorCount(field); <ide> } <ide> <del> public List getFieldErrors(String field) { <add> public List<FieldError> getFieldErrors(String field) { <ide> return this.bindingResult.getFieldErrors(field); <ide> } <ide> <ide> public Object getFieldValue(String field) { <ide> return this.bindingResult.getFieldValue(field); <ide> } <ide> <del> public Class getFieldType(String field) { <add> public Class<?> getFieldType(String field) { <ide> return this.bindingResult.getFieldType(field); <ide> } <ide> <ide> public Object getRawFieldValue(String field) { <ide> return this.bindingResult.getRawFieldValue(field); <ide> } <ide> <add> @SuppressWarnings("rawtypes") <ide> public PropertyEditor findEditor(String field, Class valueType) { <ide> return this.bindingResult.findEditor(field, valueType); <ide> } <ide><path>org.springframework.context/src/main/java/org/springframework/validation/BindingResult.java <ide> public interface BindingResult extends Errors { <ide> * is given but should be specified in any case for consistency checking) <ide> * @return the registered editor, or <code>null</code> if none <ide> */ <del> PropertyEditor findEditor(String field, Class valueType); <add> PropertyEditor findEditor(String field, Class<?> valueType); <ide> <ide> /** <ide> * Return the underlying PropertyEditorRegistry. <ide><path>org.springframework.context/src/main/java/org/springframework/validation/BindingResultUtils.java <ide> public abstract class BindingResultUtils { <ide> * @return the BindingResult, or <code>null</code> if none found <ide> * @throws IllegalStateException if the attribute found is not of type BindingResult <ide> */ <del> public static BindingResult getBindingResult(Map model, String name) { <add> public static BindingResult getBindingResult(Map<?, ?> model, String name) { <ide> Assert.notNull(model, "Model map must not be null"); <ide> Assert.notNull(name, "Name must not be null"); <ide> Object attr = model.get(BindingResult.MODEL_KEY_PREFIX + name); <ide> public static BindingResult getBindingResult(Map model, String name) { <ide> * @return the BindingResult (never <code>null</code>) <ide> * @throws IllegalStateException if no BindingResult found <ide> */ <del> public static BindingResult getRequiredBindingResult(Map model, String name) { <add> public static BindingResult getRequiredBindingResult(Map<?, ?> model, String name) { <ide> BindingResult bindingResult = getBindingResult(model, name); <ide> if (bindingResult == null) { <ide> throw new IllegalStateException("No BindingResult attribute found for name '" + name + <ide><path>org.springframework.context/src/main/java/org/springframework/validation/DataBinder.java <ide> public ConversionService getConversionService() { <ide> return this.conversionService; <ide> } <ide> <del> @SuppressWarnings("unchecked") <del> public void registerCustomEditor(Class requiredType, PropertyEditor propertyEditor) { <add> public void registerCustomEditor(Class<?> requiredType, PropertyEditor propertyEditor) { <ide> getPropertyEditorRegistry().registerCustomEditor(requiredType, propertyEditor); <ide> } <ide> <del> @SuppressWarnings("unchecked") <del> public void registerCustomEditor(Class requiredType, String field, PropertyEditor propertyEditor) { <add> public void registerCustomEditor(Class<?> requiredType, String field, PropertyEditor propertyEditor) { <ide> getPropertyEditorRegistry().registerCustomEditor(requiredType, field, propertyEditor); <ide> } <ide> <del> @SuppressWarnings("unchecked") <del> public PropertyEditor findCustomEditor(Class requiredType, String propertyPath) { <add> public PropertyEditor findCustomEditor(Class<?> requiredType, String propertyPath) { <ide> return getPropertyEditorRegistry().findCustomEditor(requiredType, propertyPath); <ide> } <ide> <ide> public void validate() { <ide> * @throws BindException if there were any errors in the bind operation <ide> * @see BindingResult#getModel() <ide> */ <del> @SuppressWarnings("unchecked") <del> public Map close() throws BindException { <add> public Map<?, ?> close() throws BindException { <ide> if (getBindingResult().hasErrors()) { <ide> throw new BindException(getBindingResult()); <ide> } <ide><path>org.springframework.context/src/main/java/org/springframework/validation/DefaultMessageCodesResolver.java <ide> * @author Juergen Hoeller <ide> * @since 1.0.1 <ide> */ <add>@SuppressWarnings("serial") <ide> public class DefaultMessageCodesResolver implements MessageCodesResolver, Serializable { <ide> <ide> /** <ide> public String[] resolveMessageCodes(String errorCode, String objectName) { <ide> * details on the generated codes. <ide> * @return the list of codes <ide> */ <del> public String[] resolveMessageCodes(String errorCode, String objectName, String field, Class fieldType) { <add> public String[] resolveMessageCodes(String errorCode, String objectName, String field, Class<?> fieldType) { <ide> List<String> codeList = new ArrayList<String>(); <ide> List<String> fieldList = new ArrayList<String>(); <ide> buildFieldList(field, fieldList); <ide><path>org.springframework.context/src/main/java/org/springframework/validation/DirectFieldBindingResult.java <ide> * @see DataBinder#initDirectFieldAccess() <ide> * @see BeanPropertyBindingResult <ide> */ <add>@SuppressWarnings("serial") <ide> public class DirectFieldBindingResult extends AbstractPropertyBindingResult { <ide> <ide> private final Object target; <ide><path>org.springframework.context/src/main/java/org/springframework/validation/Errors.java <ide> public interface Errors { <ide> * @param field the field name <ide> * @return the type of the field, or <code>null</code> if not determinable <ide> */ <del> Class getFieldType(String field); <add> Class<?> getFieldType(String field); <ide> <ide> } <ide><path>org.springframework.context/src/main/java/org/springframework/validation/FieldError.java <ide> * @since 10.03.2003 <ide> * @see DefaultMessageCodesResolver <ide> */ <add>@SuppressWarnings("serial") <ide> public class FieldError extends ObjectError { <ide> <ide> private final String field; <ide><path>org.springframework.context/src/main/java/org/springframework/validation/MapBindingResult.java <ide> * @since 2.0 <ide> * @see java.util.Map <ide> */ <add>@SuppressWarnings("serial") <ide> public class MapBindingResult extends AbstractBindingResult implements Serializable { <ide> <del> private final Map target; <add> private final Map<?, ?> target; <ide> <ide> <ide> /** <ide> * Create a new MapBindingResult instance. <ide> * @param target the target Map to bind onto <ide> * @param objectName the name of the target object <ide> */ <del> public MapBindingResult(Map target, String objectName) { <add> public MapBindingResult(Map<?, ?> target, String objectName) { <ide> super(objectName); <ide> Assert.notNull(target, "Target Map must not be null"); <ide> this.target = target; <ide> } <ide> <ide> <del> public final Map getTargetMap() { <add> public final Map<?, ?> getTargetMap() { <ide> return this.target; <ide> } <ide> <ide><path>org.springframework.context/src/main/java/org/springframework/validation/MessageCodesResolver.java <ide> public interface MessageCodesResolver { <ide> * @param fieldType the field type (may be <code>null</code> if not determinable) <ide> * @return the message codes to use <ide> */ <del> String[] resolveMessageCodes(String errorCode, String objectName, String field, Class fieldType); <add> String[] resolveMessageCodes(String errorCode, String objectName, String field, Class<?> fieldType); <ide> <ide> } <ide><path>org.springframework.context/src/main/java/org/springframework/validation/ObjectError.java <ide> * @see DefaultMessageCodesResolver <ide> * @since 10.03.2003 <ide> */ <add>@SuppressWarnings("serial") <ide> public class ObjectError extends DefaultMessageSourceResolvable { <ide> <ide> private final String objectName; <ide><path>org.springframework.context/src/main/java/org/springframework/validation/beanvalidation/LocalValidatorFactoryBean.java <ide> public class LocalValidatorFactoryBean extends SpringValidatorAdapter <ide> implements ValidatorFactory, ApplicationContextAware, InitializingBean { <ide> <add> @SuppressWarnings("rawtypes") <ide> private Class providerClass; <ide> <ide> private MessageInterpolator messageInterpolator; <ide> public class LocalValidatorFactoryBean extends SpringValidatorAdapter <ide> * @see javax.validation.Validation#byProvider(Class) <ide> * @see javax.validation.Validation#byDefaultProvider() <ide> */ <add> @SuppressWarnings("rawtypes") <ide> public void setProviderClass(Class<? extends ValidationProvider> providerClass) { <ide> this.providerClass = providerClass; <ide> } <ide> public void setApplicationContext(ApplicationContext applicationContext) { <ide> <ide> @SuppressWarnings("unchecked") <ide> public void afterPropertiesSet() { <add> @SuppressWarnings("rawtypes") <ide> Configuration configuration = (this.providerClass != null ? <ide> Validation.byProvider(this.providerClass).configure() : <ide> Validation.byDefaultProvider().configure()); <ide><path>org.springframework.context/src/main/java/org/springframework/validation/beanvalidation/package-info.java <ide> * (such as Hibernate Validator 4.0) into a Spring ApplicationContext <ide> * and in particular with Spring's data binding and validation APIs. <ide> * <del> * <p>The central class is {@link LocalValidatorFactoryBean} which <del> * defines a shared ValidatorFactory/Validator setup for availability <add> * <p>The central class is {@link <add> * org.springframework.validation.beanvalidation.LocalValidatorFactoryBean} <add> * which defines a shared ValidatorFactory/Validator setup for availability <ide> * to other Spring components. <ide> */ <ide> package org.springframework.validation.beanvalidation;
18
PHP
PHP
fix cs error
094ef082587f936b4190af716c7c4a8f54f266e3
<ide><path>tests/TestCase/Http/ServerTest.php <ide> use Cake\Http\Server; <ide> use Cake\TestSuite\TestCase; <ide> use InvalidArgumentException; <del>use RuntimeException; <del>use TestApp\Http\InvalidMiddlewareApplication; <ide> use TestApp\Http\MiddlewareApplication; <ide> use Zend\Diactoros\Response; <ide> use Zend\Diactoros\ServerRequestFactory;
1
Ruby
Ruby
remove circular require
8bf2825205ad392c923070e722fc8d39687520e3
<ide><path>activesupport/lib/active_support/core_ext/module/aliasing.rb <del>require 'active_support/deprecation' <del> <ide> class Module <ide> # Encapsulates the common pattern of: <ide> # <ide><path>activesupport/lib/active_support/core_ext/module/deprecation.rb <del>require 'active_support/deprecation' <del> <ide> class Module <ide> # deprecate :foo <ide> # deprecate bar: 'message'
2
Python
Python
add comment for delayed imports
739de19d3bc61583c342678f386f917725b33c25
<ide><path>numpy/core/_dtype_ctypes.py <ide> class DummyStruct(ctypes.Structure): <ide> * ctypes cannot handle big-endian structs with PEP3118 (bpo-32780) <ide> """ <ide> <add># We delay-import ctypes for distributions that do not include it. <add># While this module is not used unless the user passes in ctypes <add># members, it is eagerly imported from numpy/core/__init__.py. <ide> import numpy as np <ide> <ide>
1
Ruby
Ruby
fix removing of previous source
2ce58f9fcba5a9c214d9f56c6101b1c5bab3a304
<ide><path>Library/Homebrew/mktemp.rb <ide> def to_s <ide> <ide> def run <ide> prefix_name = @prefix.tr "@", "AT" <del> if @retain_in_cache <add> if retain_in_cache? <ide> source_dir = "#{HOMEBREW_CACHE}/Sources/#{prefix_name}" <del> chmod_rm_rf(source_dir) # clear out previous (otherwise not sure what happens) <del> FileUtils.mkdir_p(source_dir) <ide> @tmpdir = Pathname.new(source_dir) <add> chmod_rm_rf(@tmpdir) # clear out previous (otherwise not sure what happens) <add> FileUtils.mkdir_p(source_dir) <ide> else <ide> @tmpdir = Pathname.new(Dir.mktmpdir("#{prefix_name}-", HOMEBREW_TEMP)) <ide> end
1
Ruby
Ruby
run inline jobs in separate threads
8319f9eceae0584bc4d360cd497b3b5e8e31c311
<ide><path>activejob/lib/active_job/queue_adapters/inline_adapter.rb <ide> module QueueAdapters <ide> # Rails.application.config.active_job.queue_adapter = :inline <ide> class InlineAdapter <ide> def enqueue(job) #:nodoc: <del> Base.execute(job.serialize) <add> Thread.new { Base.execute(job.serialize) }.join <ide> end <ide> <ide> def enqueue_at(*) #:nodoc: <ide><path>activejob/test/integration/queuing_test.rb <ide> require "jobs/logging_job" <ide> require "jobs/hello_job" <ide> require "jobs/provider_jid_job" <add>require "jobs/thread_job" <ide> require "active_support/core_ext/numeric/time" <ide> <ide> class QueuingTest < ActiveSupport::TestCase <ide> class QueuingTest < ActiveSupport::TestCase <ide> assert job_executed "#{@id}.2" <ide> assert job_executed_at("#{@id}.2") < job_executed_at("#{@id}.1") <ide> end <add> <add> test "inline jobs run on separate threads" do <add> skip unless adapter_is?(:inline) <add> <add> after_job_thread = Thread.new do <add> ThreadJob.latch.wait <add> assert_nil Thread.current[:job_ran] <add> assert ThreadJob.thread[:job_ran] <add> ThreadJob.test_latch.count_down <add> end <add> <add> ThreadJob.perform_later <add> <add> after_job_thread.join <add> <add> assert_nil Thread.current[:job_ran] <add> end <ide> end <ide><path>activejob/test/jobs/thread_job.rb <add># frozen_string_literal: true <add> <add>class ThreadJob < ActiveJob::Base <add> class << self <add> attr_accessor :thread <add> <add> def latch <add> @latch ||= Concurrent::CountDownLatch.new <add> end <add> <add> def test_latch <add> @test_latch ||= Concurrent::CountDownLatch.new <add> end <add> end <add> <add> def perform <add> Thread.current[:job_ran] = true <add> self.class.thread = Thread.current <add> self.class.latch.count_down <add> self.class.test_latch.wait <add> end <add>end
3
Ruby
Ruby
fix deprecation test
f0a9f814a3ea7237275b2c89df8b378b08e248f8
<ide><path>activesupport/lib/active_support/callbacks.rb <ide> def merge(chain, new_options) <ide> :unless => @options[:unless].dup <ide> } <ide> <add> deprecate_per_key_option new_options <add> <ide> _options[:if].concat Array(new_options.fetch(:unless, [])) <ide> _options[:unless].concat Array(new_options.fetch(:if, [])) <ide>
1
Text
Text
remove changelog entry for rails 5.0 only feature.
57a1d2bf9d71600ec872de125854e550b376caa5
<ide><path>activerecord/CHANGELOG.md <del>* `has_secure_token` does not overwrite value when already present. <del> <del> user = User.create(token: "custom-secure-token") <del> user.token # => "custom-secure-token" <del> <del> *Wojciech Wnętrzak* <del> <ide> * Use SQL COUNT and LIMIT 1 queries for `none?` and `one?` methods if no block or limit is given, <ide> instead of loading the entire collection to memory. <ide> This applies to relations (e.g. `User.all`) as well as associations (e.g. `account.users`)
1
Javascript
Javascript
fix quotes for releasing on windows
51c29dc1fecc675054762fb1f50a0cdd6b1f0df0
<ide><path>build/release/dist.js <ide> module.exports = function( Release, files, complete ) { <ide> fs.writeFileSync( Release.dir.dist + "/bower.json", generateBower() ); <ide> <ide> console.log( "Adding files to dist..." ); <del> Release.exec( "git add .", "Error adding files." ); <add> <add> Release.exec( "git add -A", "Error adding files." ); <ide> Release.exec( <del> "git commit -m 'Release " + Release.newVersion + "'", <add> "git commit -m \"Release " + Release.newVersion + "\"", <ide> "Error committing files." <ide> ); <ide> console.log(); <ide> <ide> console.log( "Tagging release on dist..." ); <ide> Release.exec( "git tag " + Release.newVersion, <ide> "Error tagging " + Release.newVersion + " on dist repo." ); <del> Release.tagTime = Release.exec( "git log -1 --format='%ad'", <add> Release.tagTime = Release.exec( "git log -1 --format=\"%ad\"", <ide> "Error getting tag timestamp." ).trim(); <ide> } <ide>
1
Ruby
Ruby
fix code style a bit
88dfe16d9536b8de4cc69bbe649131840bca9a2c
<ide><path>actionpack/lib/action_view/helpers/number_helper.rb <ide> def number_to_human(number, options = {}) <ide> raise ArgumentError, ":units must be a Hash or String translation scope." <ide> end.keys.map{|e_name| DECIMAL_UNITS.invert[e_name] }.sort_by{|e| -e} <ide> <del> number_exponent = 0 <del> number_exponent = Math.log10(number).floor if number != 0 <add> number_exponent = number != 0 ? Math.log10(number).floor : 0 <ide> display_exponent = unit_exponents.find{|e| number_exponent >= e } <ide> number /= 10 ** display_exponent <ide>
1
Text
Text
add example explaination
544401abd5bad50acf11737c2a59fabf2587856c
<ide><path>guide/english/html/html5-web-storage/index.md <ide> title: HTML5 Web Storage <ide> --- <ide> ## HTML5 Web Storage <ide> <del>Web storage allows web applications to store up to 5MB of information in browser storage per origin (per domain and protocol). <add>With web storage, web applications can store data locally within the user's browser. Web storage allows web applications to store up to 5MB of information in browser storage per origin (per domain and protocol). <ide> <ide> ### Types of Web Storage <ide> <ide> sessionStorage.setItem("foo", "bar"); <ide> // Get Item <ide> sessionStorage.getItem("foo"); //returns "bar" <ide> ``` <add>Example explained: <add>Create a localStorage name/value pair with name="foo" and value="bar" <add>Retrieve the value of "foo" and insert it into the element with id="foo" <ide> <ide> Since the current implementation only supports string-to-string mappings, you need to serialize and de-serialize other data structures. <ide>
1
PHP
PHP
fix failing test
63c624d2a0786585a0f65c2d72d944b3b4664112
<ide><path>src/Routing/Filter/AssetFilter.php <ide> protected function _getAssetFile($url) { <ide> } <ide> $pluginPart[] = Inflector::camelize($parts[$i]); <ide> $plugin = implode('/', $pluginPart); <del> if (Plugin::loaded($plugin)) { <add> if ($plugin && Plugin::loaded($plugin)) { <ide> $parts = array_slice($parts, $i + 1); <ide> $fileFragment = implode(DS, $parts); <ide> $pluginWebroot = Plugin::path($plugin) . 'webroot' . DS;
1
Mixed
Ruby
add `drop_enum` command for postgres
bd0fdc8094294fb214b102a78f72a2c0d0063b5b
<ide><path>activerecord/CHANGELOG.md <add>* Add `drop_enum` migration command for PostgreSQL <add> <add> This does the inverse of `create_enum`. Before dropping an enum, ensure you have <add> dropped columns that depend on it. <add> <add> *Alex Ghiculescu* <add> <ide> * Adds support for `if_exists` option when removing a check constraint. <ide> <ide> The `remove_check_constraint` method now accepts an `if_exists` option. If set <ide><path>activerecord/lib/active_record/connection_adapters/abstract_adapter.rb <ide> def enable_extension(name, **) <ide> def create_enum(*) # :nodoc: <ide> end <ide> <add> # This is meant to be implemented by the adapters that support custom enum types <add> def drop_enum(*) # :nodoc: <add> end <add> <ide> def advisory_locks_enabled? # :nodoc: <ide> supports_advisory_locks? && @advisory_locks_enabled <ide> end <ide><path>activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb <ide> def create_enum(name, values) <ide> exec_query(query) <ide> end <ide> <add> # Drops an enum type. <add> # If the `if_exists: true` option is provided, the enum is only dropped if it exists. <add> # Otherwise, if the enum doesn't exist, an error is raised. <add> def drop_enum(name, *args) <add> options = args.extract_options! <add> query = <<~SQL <add> DROP TYPE#{' IF EXISTS' if options[:if_exists]} #{quote_table_name(name)}; <add> SQL <add> exec_query(query) <add> end <add> <ide> # Returns the configured supported identifier length supported by PostgreSQL <ide> def max_identifier_length <ide> @max_identifier_length ||= query_value("SHOW max_identifier_length", "SCHEMA").to_i <ide><path>activerecord/lib/active_record/migration/command_recorder.rb <ide> class CommandRecorder <ide> :add_foreign_key, :remove_foreign_key, <ide> :change_column_comment, :change_table_comment, <ide> :add_check_constraint, :remove_check_constraint, <del> :add_exclusion_constraint, :remove_exclusion_constraint <add> :add_exclusion_constraint, :remove_exclusion_constraint, <add> :create_enum, :drop_enum <ide> ] <ide> include JoinTable <ide> <ide> module StraightReversions # :nodoc: <ide> add_foreign_key: :remove_foreign_key, <ide> add_check_constraint: :remove_check_constraint, <ide> add_exclusion_constraint: :remove_exclusion_constraint, <del> enable_extension: :disable_extension <add> enable_extension: :disable_extension, <add> create_enum: :drop_enum <ide> }.each do |cmd, inv| <ide> [[inv, cmd], [cmd, inv]].uniq.each do |method, inverse| <ide> class_eval <<-EOV, __FILE__, __LINE__ + 1 <ide><path>activerecord/test/cases/adapters/postgresql/enum_test.rb <ide> def setup <ide> end <ide> <ide> teardown do <add> reset_connection <ide> @connection.drop_table "postgresql_enums", if_exists: true <del> @connection.execute "DROP TYPE IF EXISTS mood" <add> @connection.drop_enum "mood", if_exists: true <ide> reset_connection <ide> end <ide> <ide> def test_schema_load <ide> $stdout = original <ide> end <ide> <add> def test_drop_enum <add> @connection.create_enum :unused, [] <add> <add> assert_nothing_raised do <add> @connection.drop_enum "unused" <add> end <add> <add> assert_nothing_raised do <add> @connection.drop_enum "unused", if_exists: true <add> end <add> <add> assert_raises ActiveRecord::StatementInvalid do <add> @connection.drop_enum "unused" <add> end <add> end <add> <ide> def test_works_with_activerecord_enum <ide> model = PostgresqlEnum.create! <ide> model.current_mood_okay! <ide> def test_enum_type_scoped_to_schemas <ide> @connection.create_schema("test_schema") <ide> @connection.schema_search_path = "test_schema" <ide> @connection.schema_cache.clear! <del> @connection.create_enum("mood", ["sad", "ok", "happy"]) <add> @connection.create_enum("mood_in_other_schema", ["sad", "ok", "happy"]) <ide> <ide> assert_nothing_raised do <del> @connection.create_table("postgresql_enums") do |t| <del> t.column :current_mood, :mood, default: "happy", null: false <add> @connection.create_table("postgresql_enums_in_other_schema") do |t| <add> t.column :current_mood, :mood_in_other_schema, default: "happy", null: false <ide> end <ide> end <add> <add> assert_nothing_raised do <add> @connection.drop_table("postgresql_enums_in_other_schema") <add> @connection.drop_enum("mood_in_other_schema") <add> end <ide> ensure <ide> @connection.drop_schema("test_schema") <ide> @connection.schema_search_path = old_search_path <ide> def test_enum_type_scoped_to_schemas <ide> <ide> def test_enum_type_explicit_schema <ide> @connection.create_schema("test_schema") <del> @connection.create_enum("test_schema.mood", ["sad", "ok", "happy"]) <add> @connection.create_enum("test_schema.mood_in_other_schema", ["sad", "ok", "happy"]) <ide> <del> @connection.create_table("test_schema.postgresql_enums") do |t| <del> t.column :current_mood, "test_schema.mood" <add> @connection.create_table("test_schema.postgresql_enums_in_other_schema") do |t| <add> t.column :current_mood, "test_schema.mood_in_other_schema" <ide> end <ide> <del> assert @connection.table_exists?("test_schema.postgresql_enums") <add> assert @connection.table_exists?("test_schema.postgresql_enums_in_other_schema") <add> <add> assert_nothing_raised do <add> @connection.drop_table("test_schema.postgresql_enums_in_other_schema") <add> @connection.drop_enum("test_schema.mood_in_other_schema") <add> end <ide> ensure <ide> @connection.drop_schema("test_schema", if_exists: true) <ide> end <ide><path>activerecord/test/cases/adapters/postgresql/invertible_migration_test.rb <ide> def change <ide> end <ide> end <ide> <add> class CreateEnumMigration < SilentMigration <add> def change <add> create_enum :color, ["blue", "green"] <add> create_table :enums do |t| <add> t.enum :best_color, enum_type: "color", default: "blue", null: false <add> end <add> end <add> end <add> <ide> self.use_transactional_tests = false <ide> <ide> setup do <ide> def change <ide> <ide> teardown do <ide> @connection.drop_table "settings", if_exists: true <add> @connection.drop_table "enums", if_exists: true <ide> end <ide> <ide> def test_migrate_revert_add_index_with_expression <ide> def test_migrate_revert_add_index_with_expression <ide> assert_not @connection.index_exists?(:settings, nil, name: "index_settings_data_foo"), <ide> "index index_settings_data_foo should not exist" <ide> end <add> <add> def test_revert_create_enum <add> CreateEnumMigration.new.migrate(:up) <add> <add> assert @connection.column_exists?(:enums, :best_color, sql_type: "color", default: "blue", null: false) <add> assert_equal [["color", "blue,green"]], @connection.enum_types <add> <add> CreateEnumMigration.new.migrate(:down) <add> <add> assert_not @connection.table_exists?(:enums) <add> assert_equal [], @connection.enum_types <add> end <ide> end <ide><path>activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb <ide> def test_raise_error_when_cannot_translate_exception <ide> end <ide> <ide> def test_reload_type_map_for_newly_defined_types <del> @connection.execute "CREATE TYPE feeling AS ENUM ('good', 'bad')" <add> @connection.create_enum "feeling", ["good", "bad"] <ide> result = @connection.select_all "SELECT 'good'::feeling" <ide> assert_instance_of(PostgreSQLAdapter::OID::Enum, <ide> result.column_types["feeling"]) <ide> ensure <del> @connection.execute "DROP TYPE IF EXISTS feeling" <add> @connection.drop_enum "feeling", if_exists: true <ide> reset_connection <ide> end <ide> <ide><path>guides/source/active_record_postgresql.md <ide> def up <ide> end <ide> end <ide> <del># There's no built in support for dropping enums, but you can do it manually. <del># You should first drop any table that depends on them. <add># The above migration is reversible (using #change), but you can <add># also define a #down method: <ide> def down <ide> drop_table :articles <ide> <del> execute <<-SQL <del> DROP TYPE article_status; <del> SQL <add> drop_enum :article_status <ide> end <ide> ``` <ide>
8
Python
Python
add defensive check
397a1814ef5d5039df8ef2d8c03761d4722e50e8
<ide><path>libcloud/compute/drivers/vsphere.py <ide> def list_images(self, location=None): <ide> ).view <ide> <ide> for vm in vms: <del> if vm.config.template: <add> if vm.config and vm.config.template: <ide> images.append(self._to_image(vm)) <ide> <ide> return images
1
PHP
PHP
use locatorawaretrait in translatebehavior
a2d86bc1444c3ef04301b8d9dc1830a16131ebcf
<ide><path>src/ORM/Behavior/TranslateBehavior.php <ide> use Cake\I18n\I18n; <ide> use Cake\ORM\Behavior; <ide> use Cake\ORM\Entity; <add>use Cake\ORM\Locator\LocatorAwareTrait; <ide> use Cake\ORM\Query; <ide> use Cake\ORM\Table; <del>use Cake\ORM\TableRegistry; <ide> use Cake\Utility\Inflector; <ide> <ide> /** <ide> class TranslateBehavior extends Behavior <ide> { <ide> <add> use LocatorAwareTrait; <add> <ide> /** <ide> * Table instance <ide> * <ide> class TranslateBehavior extends Behavior <ide> 'referenceName' => '', <ide> 'allowEmptyTranslations' => true, <ide> 'onlyTranslated' => false, <del> 'strategy' => 'subquery' <add> 'strategy' => 'subquery', <add> 'locator' => null <ide> ]; <ide> <ide> /** <ide> public function __construct(Table $table, array $config = []) <ide> 'defaultLocale' => I18n::defaultLocale(), <ide> 'referenceName' => $this->_referenceName($table) <ide> ]; <add> <add> if (isset($config['locator'])) { <add> $this->_locator = $config['locator']; <add> } <add> <ide> parent::__construct($table, $config); <ide> } <ide> <ide> public function __construct(Table $table, array $config = []) <ide> */ <ide> public function initialize(array $config) <ide> { <del> $this->_translationTable = TableRegistry::get($this->_config['translationTable']); <add> $this->_translationTable = $this->locator()->get($this->_config['translationTable']); <ide> <ide> $this->setupFieldAssociations( <ide> $this->_config['fields'], <ide> public function setupFieldAssociations($fields, $table, $model, $strategy) <ide> foreach ($fields as $field) { <ide> $name = $alias . '_' . $field . '_translation'; <ide> <del> if (!TableRegistry::exists($name)) { <del> $fieldTable = TableRegistry::get($name, [ <add> if (!$this->locator()->exists($name)) { <add> $fieldTable = $this->locator()->get($name, [ <ide> 'className' => $table, <ide> 'alias' => $name, <ide> 'table' => $this->_translationTable->table() <ide> ]); <ide> } else { <del> $fieldTable = TableRegistry::get($name); <add> $fieldTable = $this->locator()->get($name); <ide> } <ide> <ide> $conditions = [
1
Java
Java
increase time drift threshold
a2f78825f2dbdc0d48eb0a8015b1690a924c5566
<ide><path>ReactAndroid/src/main/java/com/facebook/react/modules/core/Timing.java <ide> public void createTimer( <ide> final int duration, <ide> final double jsSchedulingTime, <ide> final boolean repeat) { <add> long deviceTime = SystemClock.currentTimeMillis(); <add> long remoteTime = (long) jsSchedulingTime; <add> <ide> // If the times on the server and device have drifted throw an exception to warn the developer <ide> // that things might not work or results may not be accurate. This is required only for <ide> // developer builds. <del> if (mDevSupportManager.getDevSupportEnabled() && Math.abs(jsSchedulingTime - System.currentTimeMillis()) > 1000) { <del> throw new RuntimeException("System and emulator/device times have drifted. Please correct this by running adb shell \"date `date +%m%d%H%M%Y.%S`\" on your dev machine"); <add> if (mDevSupportManager.getDevSupportEnabled()) { <add> long driftTime = Math.abs(remoteTime - deviceTime); <add> if (driftTime > 60000) { <add> throw new RuntimeException( <add> "Debugger and device times have drifted by " + driftTime + "ms. " + <add> "Please correct this by running adb shell " + <add> "\"date `date +%m%d%H%M%Y.%S`\" on your debugger machine.\n" + <add> "Debugger Time = " + remoteTime + "\n" + <add> "Device Time = " + deviceTime <add> ); <add> } <ide> } <add> <ide> // Adjust for the amount of time it took for native to receive the timer registration call <del> long adjustedDuration = (long) Math.max( <del> 0, <del> jsSchedulingTime - SystemClock.currentTimeMillis() + duration); <add> long adjustedDuration = Math.max(0, remoteTime - deviceTime + duration); <ide> if (duration == 0 && !repeat) { <ide> WritableArray timerToCall = Arguments.createArray(); <ide> timerToCall.pushInt(callbackID);
1
Go
Go
remove jobs from registry.service
03d3d79b2b3f8b720fff2d649aff0ef791cff417
<ide><path>api/client/search.go <ide> func (cli *DockerCli) CmdSearch(args ...string) error { <ide> if _, err := outs.ReadListFrom(rawBody); err != nil { <ide> return err <ide> } <add> outs.ReverseSort() <ide> w := tabwriter.NewWriter(cli.out, 10, 1, 3, ' ', 0) <ide> fmt.Fprintf(w, "NAME\tDESCRIPTION\tSTARS\tOFFICIAL\tAUTOMATED\n") <ide> for _, out := range outs.Data { <ide><path>api/server/server.go <ide> import ( <ide> "encoding/json" <ide> "fmt" <ide> "io" <del> "io/ioutil" <ide> "net" <ide> "net/http" <ide> "os" <ide> import ( <ide> "github.com/Sirupsen/logrus" <ide> "github.com/docker/docker/api" <ide> "github.com/docker/docker/api/types" <add> "github.com/docker/docker/daemon" <ide> "github.com/docker/docker/daemon/networkdriver/bridge" <ide> "github.com/docker/docker/engine" <ide> "github.com/docker/docker/pkg/parsers" <ide> func getBoolParam(value string) (bool, error) { <ide> return ret, nil <ide> } <ide> <add>func getDaemon(eng *engine.Engine) *daemon.Daemon { <add> return eng.HackGetGlobalVar("httpapi.daemon").(*daemon.Daemon) <add>} <add> <ide> func postAuth(eng *engine.Engine, version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error { <del> var ( <del> authConfig, err = ioutil.ReadAll(r.Body) <del> job = eng.Job("auth") <del> stdoutBuffer = bytes.NewBuffer(nil) <del> ) <add> var config *registry.AuthConfig <add> err := json.NewDecoder(r.Body).Decode(&config) <add> r.Body.Close() <ide> if err != nil { <ide> return err <ide> } <del> job.Setenv("authConfig", string(authConfig)) <del> job.Stdout.Add(stdoutBuffer) <del> if err = job.Run(); err != nil { <add> d := getDaemon(eng) <add> status, err := d.RegistryService.Auth(config) <add> if err != nil { <ide> return err <ide> } <del> if status := engine.Tail(stdoutBuffer, 1); status != "" { <del> var env engine.Env <del> env.Set("Status", status) <del> return writeJSON(w, http.StatusOK, &types.AuthResponse{ <del> Status: status, <del> }) <del> } <del> w.WriteHeader(http.StatusNoContent) <del> return nil <add> return writeJSON(w, http.StatusOK, &types.AuthResponse{ <add> Status: status, <add> }) <ide> } <ide> <ide> func getVersion(eng *engine.Engine, version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error { <ide> func getImagesSearch(eng *engine.Engine, version version.Version, w http.Respons <ide> return err <ide> } <ide> var ( <add> config *registry.AuthConfig <ide> authEncoded = r.Header.Get("X-Registry-Auth") <del> authConfig = &registry.AuthConfig{} <del> metaHeaders = map[string][]string{} <add> headers = map[string][]string{} <ide> ) <ide> <ide> if authEncoded != "" { <ide> authJson := base64.NewDecoder(base64.URLEncoding, strings.NewReader(authEncoded)) <del> if err := json.NewDecoder(authJson).Decode(authConfig); err != nil { <add> if err := json.NewDecoder(authJson).Decode(&config); err != nil { <ide> // for a search it is not an error if no auth was given <ide> // to increase compatibility with the existing api it is defaulting to be empty <del> authConfig = &registry.AuthConfig{} <add> config = &registry.AuthConfig{} <ide> } <ide> } <ide> for k, v := range r.Header { <ide> if strings.HasPrefix(k, "X-Meta-") { <del> metaHeaders[k] = v <add> headers[k] = v <ide> } <ide> } <del> <del> var job = eng.Job("search", r.Form.Get("term")) <del> job.SetenvJson("metaHeaders", metaHeaders) <del> job.SetenvJson("authConfig", authConfig) <del> streamJSON(job, w, false) <del> <del> return job.Run() <add> d := getDaemon(eng) <add> query, err := d.RegistryService.Search(r.Form.Get("term"), config, headers) <add> if err != nil { <add> return err <add> } <add> return json.NewEncoder(w).Encode(query.Results) <ide> } <ide> <ide> func postImagesPush(eng *engine.Engine, version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error { <ide><path>builder/internals.go <ide> import ( <ide> "github.com/docker/docker/pkg/system" <ide> "github.com/docker/docker/pkg/tarsum" <ide> "github.com/docker/docker/pkg/urlutil" <del> "github.com/docker/docker/registry" <ide> "github.com/docker/docker/runconfig" <ide> "github.com/docker/docker/utils" <ide> ) <ide> func (b *Builder) pullImage(name string) (*imagepkg.Image, error) { <ide> pullRegistryAuth := b.AuthConfig <ide> if len(b.AuthConfigFile.Configs) > 0 { <ide> // The request came with a full auth config file, we prefer to use that <del> repoInfo, err := registry.ResolveRepositoryInfo(job, remote) <add> repoInfo, err := b.Daemon.RegistryService.ResolveRepository(remote) <ide> if err != nil { <ide> return nil, err <ide> } <ide><path>daemon/daemon.go <ide> import ( <ide> "github.com/docker/docker/pkg/stringid" <ide> "github.com/docker/docker/pkg/sysinfo" <ide> "github.com/docker/docker/pkg/truncindex" <add> "github.com/docker/docker/registry" <ide> "github.com/docker/docker/runconfig" <ide> "github.com/docker/docker/trust" <ide> "github.com/docker/docker/utils" <ide> type Daemon struct { <ide> trustStore *trust.TrustStore <ide> statsCollector *statsCollector <ide> defaultLogConfig runconfig.LogConfig <add> RegistryService *registry.Service <ide> } <ide> <ide> // Install installs daemon capabilities to eng. <ide> func (daemon *Daemon) RegisterLinks(container *Container, hostConfig *runconfig. <ide> } <ide> <ide> // FIXME: harmonize with NewGraph() <del>func NewDaemon(config *Config, eng *engine.Engine) (*Daemon, error) { <del> daemon, err := NewDaemonFromDirectory(config, eng) <add>func NewDaemon(config *Config, eng *engine.Engine, registryService *registry.Service) (*Daemon, error) { <add> daemon, err := NewDaemonFromDirectory(config, eng, registryService) <ide> if err != nil { <ide> return nil, err <ide> } <ide> return daemon, nil <ide> } <ide> <del>func NewDaemonFromDirectory(config *Config, eng *engine.Engine) (*Daemon, error) { <add>func NewDaemonFromDirectory(config *Config, eng *engine.Engine, registryService *registry.Service) (*Daemon, error) { <ide> if config.Mtu == 0 { <ide> config.Mtu = getDefaultNetworkMtu() <ide> } <ide> func NewDaemonFromDirectory(config *Config, eng *engine.Engine) (*Daemon, error) <ide> } <ide> <ide> logrus.Debug("Creating repository list") <del> repositories, err := graph.NewTagStore(path.Join(config.Root, "repositories-"+driver.String()), g, trustKey) <add> repositories, err := graph.NewTagStore(path.Join(config.Root, "repositories-"+driver.String()), g, trustKey, registryService) <ide> if err != nil { <ide> return nil, fmt.Errorf("Couldn't create Tag store: %s", err) <ide> } <ide> func NewDaemonFromDirectory(config *Config, eng *engine.Engine) (*Daemon, error) <ide> trustStore: t, <ide> statsCollector: newStatsCollector(1 * time.Second), <ide> defaultLogConfig: config.LogConfig, <add> RegistryService: registryService, <ide> } <ide> <ide> eng.OnShutdown(func() { <ide><path>daemon/info.go <ide> func (daemon *Daemon) CmdInfo(job *engine.Job) error { <ide> if err := cjob.Run(); err != nil { <ide> return err <ide> } <del> registryJob := job.Eng.Job("registry_config") <del> registryEnv, _ := registryJob.Stdout.AddEnv() <del> if err := registryJob.Run(); err != nil { <del> return err <del> } <del> registryConfig := registry.ServiceConfig{} <del> if err := registryEnv.GetJson("config", &registryConfig); err != nil { <del> return err <del> } <ide> v := &engine.Env{} <ide> v.SetJson("ID", daemon.ID) <ide> v.SetInt("Containers", len(daemon.List())) <ide> func (daemon *Daemon) CmdInfo(job *engine.Job) error { <ide> v.Set("KernelVersion", kernelVersion) <ide> v.Set("OperatingSystem", operatingSystem) <ide> v.Set("IndexServerAddress", registry.IndexServerAddress()) <del> v.SetJson("RegistryConfig", registryConfig) <add> v.SetJson("RegistryConfig", daemon.RegistryService.Config) <ide> v.Set("InitSha1", dockerversion.INITSHA1) <ide> v.Set("InitPath", initPath) <ide> v.SetInt("NCPU", runtime.NumCPU()) <ide><path>docker/daemon.go <ide> func mainDaemon() { <ide> logrus.Fatal(err) <ide> } <ide> <del> // load registry service <del> if err := registry.NewService(registryCfg).Install(eng); err != nil { <del> logrus.Fatal(err) <del> } <del> <add> registryService := registry.NewService(registryCfg) <ide> // load the daemon in the background so we can immediately start <ide> // the http api so that connections don't fail while the daemon <ide> // is booting <ide> daemonInitWait := make(chan error) <ide> go func() { <del> d, err := daemon.NewDaemon(daemonCfg, eng) <add> d, err := daemon.NewDaemon(daemonCfg, eng, registryService) <ide> if err != nil { <ide> daemonInitWait <- err <ide> return <ide><path>graph/pull.go <ide> func (s *TagStore) CmdPull(job *engine.Job) error { <ide> ) <ide> <ide> // Resolve the Repository name from fqn to RepositoryInfo <del> repoInfo, err := registry.ResolveRepositoryInfo(job, localName) <add> repoInfo, err := s.registryService.ResolveRepository(localName) <ide> if err != nil { <ide> return err <ide> } <ide><path>graph/push.go <ide> func (s *TagStore) CmdPush(job *engine.Job) error { <ide> ) <ide> <ide> // Resolve the Repository name from fqn to RepositoryInfo <del> repoInfo, err := registry.ResolveRepositoryInfo(job, localName) <add> repoInfo, err := s.registryService.ResolveRepository(localName) <ide> if err != nil { <ide> return err <ide> } <ide><path>graph/tags.go <ide> type TagStore struct { <ide> sync.Mutex <ide> // FIXME: move push/pull-related fields <ide> // to a helper type <del> pullingPool map[string]chan struct{} <del> pushingPool map[string]chan struct{} <add> pullingPool map[string]chan struct{} <add> pushingPool map[string]chan struct{} <add> registryService *registry.Service <ide> } <ide> <ide> type Repository map[string]string <ide> func (r Repository) Contains(u Repository) bool { <ide> return true <ide> } <ide> <del>func NewTagStore(path string, graph *Graph, key libtrust.PrivateKey) (*TagStore, error) { <add>func NewTagStore(path string, graph *Graph, key libtrust.PrivateKey, registryService *registry.Service) (*TagStore, error) { <ide> abspath, err := filepath.Abs(path) <ide> if err != nil { <ide> return nil, err <ide> } <ide> <ide> store := &TagStore{ <del> path: abspath, <del> graph: graph, <del> trustKey: key, <del> Repositories: make(map[string]Repository), <del> pullingPool: make(map[string]chan struct{}), <del> pushingPool: make(map[string]chan struct{}), <add> path: abspath, <add> graph: graph, <add> trustKey: key, <add> Repositories: make(map[string]Repository), <add> pullingPool: make(map[string]chan struct{}), <add> pushingPool: make(map[string]chan struct{}), <add> registryService: registryService, <ide> } <ide> // Load the json file if it exists, otherwise create it. <ide> if err := store.reload(); os.IsNotExist(err) { <ide><path>graph/tags_unit_test.go <ide> func mkTestTagStore(root string, t *testing.T) *TagStore { <ide> if err != nil { <ide> t.Fatal(err) <ide> } <del> store, err := NewTagStore(path.Join(root, "tags"), graph, nil) <add> store, err := NewTagStore(path.Join(root, "tags"), graph, nil, nil) <ide> if err != nil { <ide> t.Fatal(err) <ide> } <ide><path>integration/utils_test.go <ide> func newTestEngine(t Fataler, autorestart bool, root string) *engine.Engine { <ide> if err := builtins.Register(eng); err != nil { <ide> t.Fatal(err) <ide> } <del> // load registry service <del> if err := registry.NewService(nil).Install(eng); err != nil { <del> t.Fatal(err) <del> } <ide> <ide> // (This is manually copied and modified from main() until we have a more generic plugin system) <ide> cfg := &daemon.Config{ <ide> func newTestEngine(t Fataler, autorestart bool, root string) *engine.Engine { <ide> TrustKeyPath: filepath.Join(root, "key.json"), <ide> LogConfig: runconfig.LogConfig{Type: "json-file"}, <ide> } <del> d, err := daemon.NewDaemon(cfg, eng) <add> d, err := daemon.NewDaemon(cfg, eng, registry.NewService(nil)) <ide> if err != nil { <ide> t.Fatal(err) <ide> } <ide><path>registry/auth.go <ide> func Login(authConfig *AuthConfig, registryEndpoint *Endpoint, factory *requestd <ide> if registryEndpoint.Version == APIVersion2 { <ide> return loginV2(authConfig, registryEndpoint, factory) <ide> } <del> <ide> return loginV1(authConfig, registryEndpoint, factory) <ide> } <ide> <ide><path>registry/service.go <ide> package registry <ide> <del>import ( <del> "fmt" <del> <del> "github.com/Sirupsen/logrus" <del> "github.com/docker/docker/engine" <del>) <del> <del>// Service exposes registry capabilities in the standard Engine <del>// interface. Once installed, it extends the engine with the <del>// following calls: <del>// <del>// 'auth': Authenticate against the public registry <del>// 'search': Search for images on the public registry <del>// 'pull': Download images from any registry (TODO) <del>// 'push': Upload images to any registry (TODO) <ide> type Service struct { <ide> Config *ServiceConfig <ide> } <ide> func NewService(options *Options) *Service { <ide> } <ide> } <ide> <del>// Install installs registry capabilities to eng. <del>func (s *Service) Install(eng *engine.Engine) error { <del> eng.Register("auth", s.Auth) <del> eng.Register("search", s.Search) <del> eng.Register("resolve_repository", s.ResolveRepository) <del> eng.Register("resolve_index", s.ResolveIndex) <del> eng.Register("registry_config", s.GetRegistryConfig) <del> return nil <del>} <del> <ide> // Auth contacts the public registry with the provided credentials, <ide> // and returns OK if authentication was sucessful. <ide> // It can be used to verify the validity of a client's credentials. <del>func (s *Service) Auth(job *engine.Job) error { <del> var ( <del> authConfig = new(AuthConfig) <del> endpoint *Endpoint <del> index *IndexInfo <del> status string <del> err error <del> ) <del> <del> job.GetenvJson("authConfig", authConfig) <del> <add>func (s *Service) Auth(authConfig *AuthConfig) (string, error) { <ide> addr := authConfig.ServerAddress <ide> if addr == "" { <ide> // Use the official registry address if not specified. <ide> addr = IndexServerAddress() <ide> } <del> <del> if index, err = ResolveIndexInfo(job, addr); err != nil { <del> return err <add> index, err := s.ResolveIndex(addr) <add> if err != nil { <add> return "", err <ide> } <del> <del> if endpoint, err = NewEndpoint(index); err != nil { <del> logrus.Errorf("unable to get new registry endpoint: %s", err) <del> return err <add> endpoint, err := NewEndpoint(index) <add> if err != nil { <add> return "", err <ide> } <del> <ide> authConfig.ServerAddress = endpoint.String() <del> <del> if status, err = Login(authConfig, endpoint, HTTPRequestFactory(nil)); err != nil { <del> logrus.Errorf("unable to login against registry endpoint %s: %s", endpoint, err) <del> return err <del> } <del> <del> logrus.Infof("successful registry login for endpoint %s: %s", endpoint, status) <del> job.Printf("%s\n", status) <del> <del> return nil <add> return Login(authConfig, endpoint, HTTPRequestFactory(nil)) <ide> } <ide> <ide> // Search queries the public registry for images matching the specified <ide> // search terms, and returns the results. <del>// <del>// Argument syntax: search TERM <del>// <del>// Option environment: <del>// 'authConfig': json-encoded credentials to authenticate against the registry. <del>// The search extends to images only accessible via the credentials. <del>// <del>// 'metaHeaders': extra HTTP headers to include in the request to the registry. <del>// The headers should be passed as a json-encoded dictionary. <del>// <del>// Output: <del>// Results are sent as a collection of structured messages (using engine.Table). <del>// Each result is sent as a separate message. <del>// Results are ordered by number of stars on the public registry. <del>func (s *Service) Search(job *engine.Job) error { <del> if n := len(job.Args); n != 1 { <del> return fmt.Errorf("Usage: %s TERM", job.Name) <del> } <del> var ( <del> term = job.Args[0] <del> metaHeaders = map[string][]string{} <del> authConfig = &AuthConfig{} <del> ) <del> job.GetenvJson("authConfig", authConfig) <del> job.GetenvJson("metaHeaders", metaHeaders) <del> <del> repoInfo, err := ResolveRepositoryInfo(job, term) <add>func (s *Service) Search(term string, authConfig *AuthConfig, headers map[string][]string) (*SearchResults, error) { <add> repoInfo, err := s.ResolveRepository(term) <ide> if err != nil { <del> return err <add> return nil, err <ide> } <ide> // *TODO: Search multiple indexes. <ide> endpoint, err := repoInfo.GetEndpoint() <ide> if err != nil { <del> return err <del> } <del> r, err := NewSession(authConfig, HTTPRequestFactory(metaHeaders), endpoint, true) <del> if err != nil { <del> return err <add> return nil, err <ide> } <del> results, err := r.SearchRepositories(repoInfo.GetSearchTerm()) <add> r, err := NewSession(authConfig, HTTPRequestFactory(headers), endpoint, true) <ide> if err != nil { <del> return err <del> } <del> outs := engine.NewTable("star_count", 0) <del> for _, result := range results.Results { <del> out := &engine.Env{} <del> out.Import(result) <del> outs.Add(out) <del> } <del> outs.ReverseSort() <del> if _, err := outs.WriteListTo(job.Stdout); err != nil { <del> return err <add> return nil, err <ide> } <del> return nil <add> return r.SearchRepositories(repoInfo.GetSearchTerm()) <ide> } <ide> <ide> // ResolveRepository splits a repository name into its components <ide> // and configuration of the associated registry. <del>func (s *Service) ResolveRepository(job *engine.Job) error { <del> var ( <del> reposName = job.Args[0] <del> ) <del> <del> repoInfo, err := s.Config.NewRepositoryInfo(reposName) <del> if err != nil { <del> return err <del> } <del> <del> out := engine.Env{} <del> err = out.SetJson("repository", repoInfo) <del> if err != nil { <del> return err <del> } <del> out.WriteTo(job.Stdout) <del> <del> return nil <del>} <del> <del>// Convenience wrapper for calling resolve_repository Job from a running job. <del>func ResolveRepositoryInfo(jobContext *engine.Job, reposName string) (*RepositoryInfo, error) { <del> job := jobContext.Eng.Job("resolve_repository", reposName) <del> env, err := job.Stdout.AddEnv() <del> if err != nil { <del> return nil, err <del> } <del> if err := job.Run(); err != nil { <del> return nil, err <del> } <del> info := RepositoryInfo{} <del> if err := env.GetJson("repository", &info); err != nil { <del> return nil, err <del> } <del> return &info, nil <add>func (s *Service) ResolveRepository(name string) (*RepositoryInfo, error) { <add> return s.Config.NewRepositoryInfo(name) <ide> } <ide> <ide> // ResolveIndex takes indexName and returns index info <del>func (s *Service) ResolveIndex(job *engine.Job) error { <del> var ( <del> indexName = job.Args[0] <del> ) <del> <del> index, err := s.Config.NewIndexInfo(indexName) <del> if err != nil { <del> return err <del> } <del> <del> out := engine.Env{} <del> err = out.SetJson("index", index) <del> if err != nil { <del> return err <del> } <del> out.WriteTo(job.Stdout) <del> <del> return nil <del>} <del> <del>// Convenience wrapper for calling resolve_index Job from a running job. <del>func ResolveIndexInfo(jobContext *engine.Job, indexName string) (*IndexInfo, error) { <del> job := jobContext.Eng.Job("resolve_index", indexName) <del> env, err := job.Stdout.AddEnv() <del> if err != nil { <del> return nil, err <del> } <del> if err := job.Run(); err != nil { <del> return nil, err <del> } <del> info := IndexInfo{} <del> if err := env.GetJson("index", &info); err != nil { <del> return nil, err <del> } <del> return &info, nil <del>} <del> <del>// GetRegistryConfig returns current registry configuration. <del>func (s *Service) GetRegistryConfig(job *engine.Job) error { <del> out := engine.Env{} <del> err := out.SetJson("config", s.Config) <del> if err != nil { <del> return err <del> } <del> out.WriteTo(job.Stdout) <del> <del> return nil <add>func (s *Service) ResolveIndex(name string) (*IndexInfo, error) { <add> return s.Config.NewIndexInfo(name) <ide> }
13
Text
Text
clarify default queues per rails version [ci-skip]
ac3fcb8f7493394210f7c426db899e7430884e89
<ide><path>guides/source/action_mailer_basics.md <ide> pending jobs on restart. <ide> If you need a persistent backend, you will need to use an Active Job adapter <ide> that has a persistent backend (Sidekiq, Resque, etc). <ide> <del>NOTE: When calling `deliver_later` the job will be placed under `mailers` queue. Make sure Active Job adapter supports this queue, otherwise the job may be silently ignored preventing email delivery. You can change this queue name by specifying `config.action_mailer.deliver_later_queue_name` option. <del> <ide> If you want to send emails right away (from a cronjob for example) just call <ide> [`deliver_now`][]: <ide> <ide><path>guides/source/configuring.md <ide> Defaults to `'signed cookie'`. <ide> config.action_mailbox.incinerate_after = 14.days <ide> ``` <ide> <del>* `config.action_mailbox.queues.incineration` accepts a symbol indicating the Active Job queue to use for incineration jobs. When this option is `nil`, incineration jobs are sent to the default Active Job queue (see `config.active_job.default_queue_name`). It defaults to `:action_mailbox_incineration`. <add>* `config.action_mailbox.queues.incineration` accepts a symbol indicating the Active Job queue to use for incineration jobs. When this option is `nil`, incineration jobs are sent to the default Active Job queue (see `config.active_job.default_queue_name`). <ide> <del>* `config.action_mailbox.queues.routing` accepts a symbol indicating the Active Job queue to use for routing jobs. When this option is `nil`, routing jobs are sent to the default Active Job queue (see `config.active_job.default_queue_name`). It defaults to `:action_mailbox_routing`. <add>* `config.action_mailbox.queues.routing` accepts a symbol indicating the Active Job queue to use for routing jobs. When this option is `nil`, routing jobs are sent to the default Active Job queue (see `config.active_job.default_queue_name`). <ide> <ide> ### Configuring Action Mailer <ide> <ide> There are a number of settings available on `config.action_mailer`: <ide> config.action_mailer.show_previews = false <ide> ``` <ide> <del>* `config.action_mailer.deliver_later_queue_name` specifies the queue name for <del> mailers. By default this is `mailers`. <add>* `config.action_mailer.deliver_later_queue_name` specifies the Active Job queue to use for delivery jobs. When this option is set to `nil`, delivery jobs are sent to the default Active Job queue (see `config.active_job.default_queue_name`). Make sure that your Active Job adapter is also configured to process the specified queue, otherwise delivery jobs may be silently ignored. <ide> <ide> * `config.action_mailer.perform_caching` specifies whether the mailer templates should perform fragment caching or not. If it's not specified, the default will be `true`. <ide> <ide> text/javascript image/svg+xml application/postscript application/x-shockwave-fla <ide> <ide> * `config.active_storage.content_types_allowed_inline` accepts an array of strings indicating the content types that Active Storage allows to serve as inline. The default is `%w(image/png image/gif image/jpg image/jpeg image/tiff image/bmp image/vnd.adobe.photoshop image/vnd.microsoft.icon application/pdf)`. <ide> <del>* `config.active_storage.queues.analysis` accepts a symbol indicating the Active Job queue to use for analysis jobs. When this option is `nil`, analysis jobs are sent to the default Active Job queue (see `config.active_job.default_queue_name`). The default is `nil`. <add>* `config.active_storage.queues.analysis` accepts a symbol indicating the Active Job queue to use for analysis jobs. When this option is `nil`, analysis jobs are sent to the default Active Job queue (see `config.active_job.default_queue_name`). <ide> <ide> ```ruby <ide> config.active_storage.queues.analysis = :low_priority <ide> ``` <ide> <del>* `config.active_storage.queues.purge` accepts a symbol indicating the Active Job queue to use for purge jobs. When this option is `nil`, purge jobs are sent to the default Active Job queue (see `config.active_job.default_queue_name`). The default is `nil`. <add>* `config.active_storage.queues.purge` accepts a symbol indicating the Active Job queue to use for purge jobs. When this option is `nil`, purge jobs are sent to the default Active Job queue (see `config.active_job.default_queue_name`). <ide> <ide> ```ruby <ide> config.active_storage.queues.purge = :low_priority <ide> text/javascript image/svg+xml application/postscript application/x-shockwave-fla <ide> - `config.action_view.form_with_generates_ids`: `false` <ide> - `config.active_job.retry_jitter`: `0.0` <ide> - `config.active_job.skip_after_callbacks_if_terminated`: `false` <add>- `config.action_mailbox.queues.incineration`: `:action_mailbox_incineration` <add>- `config.action_mailbox.queues.routing`: `:action_mailbox_routing` <add>- `config.action_mailer.deliver_later_queue_name`: `:mailers` <ide> - `config.active_record.collection_cache_versioning`: `false` <ide> - `config.active_record.cache_versioning`: `false` <ide> - `config.active_record.has_many_inversing`: `false`
2
Ruby
Ruby
add message for asymptote
0c7c45a131251aaef24dfe5e6b803d136d51fbde
<ide><path>Library/Homebrew/missing_formula.rb <ide> def blacklisted_reason(name) <ide> Minimal installation: <ide> brew cask install basictex <ide> EOS <add> when "asymptote" then <<~EOS <add> Asymptote is bundled with MacTeX. Install it via TeX Live Utility or: <add> tlmgr install asymptote <add> EOS <ide> when "pip" then <<~EOS <ide> pip is part of the python formula: <ide> brew install python
1
PHP
PHP
use php_binary to serve development server
134147f89dedf5e80e3c27aa127983e1d0a58216
<ide><path>src/Illuminate/Foundation/Console/ServeCommand.php <ide> public function fire() <ide> <ide> $this->info("Laravel development server started on http://{$host}:{$port}"); <ide> <del> passthru("php -S {$host}:{$port} -t \"{$public}\" server.php"); <add> passthru(PHP_BINARY." -S {$host}:{$port} -t \"{$public}\" server.php"); <ide> } <ide> <ide> /**
1
Javascript
Javascript
append the release channel to the appusermodelid
0dfd8d409f66441b8b520feebef8e29753b3030c
<ide><path>src/main-process/start.js <ide> module.exports = function start(resourcePath, devResourcePath, startTime) { <ide> } <ide> <ide> // NB: This prevents Win10 from showing dupe items in the taskbar <del> app.setAppUserModelId('com.squirrel.atom.' + process.arch); <add> app.setAppUserModelId('com.squirrel.atom.' + process.arch + getReleaseChannel(app.getVersion())); <ide> <ide> function addPathToOpen(event, pathToOpen) { <ide> event.preventDefault();
1
Javascript
Javascript
use aborterror consistently
886516a14c57deb98b756c39fe0f5daef4e91d96
<ide><path>lib/events.js <ide> const kRejection = SymbolFor('nodejs.rejection'); <ide> let spliceOne; <ide> <ide> const { <del> hideStackFrames, <add> AbortError, <ide> kEnhanceStackBeforeInspector, <del> codes <add> codes: { <add> ERR_INVALID_ARG_TYPE, <add> ERR_OUT_OF_RANGE, <add> ERR_UNHANDLED_ERROR <add> }, <ide> } = require('internal/errors'); <del>const { <del> ERR_INVALID_ARG_TYPE, <del> ERR_OUT_OF_RANGE, <del> ERR_UNHANDLED_ERROR <del>} = codes; <ide> <ide> const { <ide> inspect <ide> const kMaxEventTargetListeners = Symbol('events.maxEventTargetListeners'); <ide> const kMaxEventTargetListenersWarned = <ide> Symbol('events.maxEventTargetListenersWarned'); <ide> <del>let DOMException; <del>const lazyDOMException = hideStackFrames((message, name) => { <del> if (DOMException === undefined) <del> DOMException = internalBinding('messaging').DOMException; <del> return new DOMException(message, name); <del>}); <del> <del> <ide> function EventEmitter(opts) { <ide> FunctionPrototypeCall(EventEmitter.init, this, opts); <ide> } <ide> async function once(emitter, name, options = {}) { <ide> const signal = options?.signal; <ide> validateAbortSignal(signal, 'options.signal'); <ide> if (signal?.aborted) <del> throw lazyDOMException('The operation was aborted', 'AbortError'); <add> throw new AbortError(); <ide> return new Promise((resolve, reject) => { <ide> const errorListener = (err) => { <ide> emitter.removeListener(name, resolver); <ide> async function once(emitter, name, options = {}) { <ide> function abortListener() { <ide> eventTargetAgnosticRemoveListener(emitter, name, resolver); <ide> eventTargetAgnosticRemoveListener(emitter, 'error', errorListener); <del> reject(lazyDOMException('The operation was aborted', 'AbortError')); <add> reject(new AbortError()); <ide> } <ide> if (signal != null) { <ide> eventTargetAgnosticAddListener( <ide> function eventTargetAgnosticAddListener(emitter, name, listener, flags) { <ide> function on(emitter, event, options) { <ide> const signal = options?.signal; <ide> validateAbortSignal(signal, 'options.signal'); <del> if (signal?.aborted) { <del> throw lazyDOMException('The operation was aborted', 'AbortError'); <del> } <add> if (signal?.aborted) <add> throw new AbortError(); <ide> <ide> const unconsumedEvents = []; <ide> const unconsumedPromises = []; <ide> function on(emitter, event, options) { <ide> return iterator; <ide> <ide> function abortListener() { <del> errorHandler(lazyDOMException('The operation was aborted', 'AbortError')); <add> errorHandler(new AbortError()); <ide> } <ide> <ide> function eventHandler(...args) { <ide><path>lib/fs.js <ide> const { <ide> ERR_INVALID_ARG_TYPE, <ide> ERR_FEATURE_UNAVAILABLE_ON_PLATFORM, <ide> }, <del> hideStackFrames, <add> AbortError, <ide> uvErrmapGet, <ide> uvException <ide> } = require('internal/errors'); <ide> let ReadStream; <ide> let WriteStream; <ide> let rimraf; <ide> let rimrafSync; <del>let DOMException; <del> <del>const lazyDOMException = hideStackFrames((message, name) => { <del> if (DOMException === undefined) <del> DOMException = internalBinding('messaging').DOMException; <del> return new DOMException(message, name); <del>}); <ide> <ide> // These have to be separate because of how graceful-fs happens to do it's <ide> // monkeypatching. <ide> function readFileAfterStat(err, stats) { <ide> context.read(); <ide> } <ide> <add>function checkAborted(signal, callback) { <add> if (signal?.aborted) { <add> callback(new AbortError()); <add> return true; <add> } <add> return false; <add>} <add> <ide> function readFile(path, options, callback) { <ide> callback = maybeCallback(callback || options); <ide> options = getOptions(options, { flag: 'r' }); <ide> function readFile(path, options, callback) { <ide> return; <ide> } <ide> <del> if (options.signal?.aborted) { <del> callback(lazyDOMException('The operation was aborted', 'AbortError')); <add> if (checkAborted(options.signal, callback)) <ide> return; <del> } <ide> <ide> const flagsNumber = stringToFlags(options.flag, 'options.flag'); <ide> path = getValidatedPath(path); <ide> function lutimesSync(path, atime, mtime) { <ide> function writeAll(fd, isUserFd, buffer, offset, length, signal, callback) { <ide> if (signal?.aborted) { <ide> if (isUserFd) { <del> callback(lazyDOMException('The operation was aborted', 'AbortError')); <add> callback(new AbortError()); <ide> } else { <ide> fs.close(fd, function() { <del> callback(lazyDOMException('The operation was aborted', 'AbortError')); <add> callback(new AbortError()); <ide> }); <ide> } <ide> return; <ide> function writeFile(path, data, options, callback) { <ide> return; <ide> } <ide> <del> if (options.signal?.aborted) { <del> callback(lazyDOMException('The operation was aborted', 'AbortError')); <add> if (checkAborted(options.signal, callback)) <ide> return; <del> } <add> <ide> fs.open(path, flag, options.mode, (openErr, fd) => { <ide> if (openErr) { <ide> callback(openErr); <ide><path>lib/internal/fs/promises.js <ide> const { <ide> const binding = internalBinding('fs'); <ide> const { Buffer } = require('buffer'); <ide> <del>const { codes, hideStackFrames } = require('internal/errors'); <ide> const { <del> ERR_FS_FILE_TOO_LARGE, <del> ERR_INVALID_ARG_TYPE, <del> ERR_INVALID_ARG_VALUE, <del> ERR_METHOD_NOT_IMPLEMENTED, <del>} = codes; <add> codes: { <add> ERR_FS_FILE_TOO_LARGE, <add> ERR_INVALID_ARG_TYPE, <add> ERR_INVALID_ARG_VALUE, <add> ERR_METHOD_NOT_IMPLEMENTED, <add> }, <add> AbortError, <add>} = require('internal/errors'); <ide> const { isArrayBufferView } = require('internal/util/types'); <ide> const { rimrafPromises } = require('internal/fs/rimraf'); <ide> const { <ide> const { <ide> const getDirectoryEntriesPromise = promisify(getDirents); <ide> const validateRmOptionsPromise = promisify(validateRmOptions); <ide> <del>let DOMException; <del>const lazyDOMException = hideStackFrames((message, name) => { <del> if (DOMException === undefined) <del> DOMException = internalBinding('messaging').DOMException; <del> return new DOMException(message, name); <del>}); <del> <ide> class FileHandle extends EventEmitterMixin(JSTransferable) { <ide> constructor(filehandle) { <ide> super(); <ide> async function fsCall(fn, handle, ...args) { <ide> } <ide> } <ide> <add>function checkAborted(signal) { <add> if (signal?.aborted) <add> throw new AbortError(); <add>} <add> <ide> async function writeFileHandle(filehandle, data, signal) { <ide> // `data` could be any kind of typed array. <ide> data = new Uint8Array(data.buffer, data.byteOffset, data.byteLength); <ide> let remaining = data.length; <ide> if (remaining === 0) return; <ide> do { <del> if (signal?.aborted) { <del> throw lazyDOMException('The operation was aborted', 'AbortError'); <del> } <add> checkAborted(signal); <ide> const { bytesWritten } = <ide> await write(filehandle, data, 0, <ide> MathMin(kWriteFileMaxChunkSize, data.length)); <ide> async function writeFileHandle(filehandle, data, signal) { <ide> async function readFileHandle(filehandle, options) { <ide> const signal = options?.signal; <ide> <del> if (signal?.aborted) { <del> throw lazyDOMException('The operation was aborted', 'AbortError'); <del> } <add> checkAborted(signal); <add> <ide> const statFields = await binding.fstat(filehandle.fd, false, kUsePromises); <ide> <del> if (signal?.aborted) { <del> throw lazyDOMException('The operation was aborted', 'AbortError'); <del> } <add> checkAborted(signal); <ide> <ide> let size; <ide> if ((statFields[1/* mode */] & S_IFMT) === S_IFREG) { <ide> async function readFileHandle(filehandle, options) { <ide> const buffers = []; <ide> const fullBuffer = noSize ? undefined : Buffer.allocUnsafeSlow(size); <ide> do { <del> if (signal?.aborted) { <del> throw lazyDOMException('The operation was aborted', 'AbortError'); <del> } <add> checkAborted(signal); <ide> let buffer; <ide> let offset; <ide> let length; <ide> async function writeFile(path, data, options) { <ide> if (path instanceof FileHandle) <ide> return writeFileHandle(path, data, options.signal); <ide> <del> if (options.signal?.aborted) { <del> throw lazyDOMException('The operation was aborted', 'AbortError'); <del> } <add> checkAborted(options.signal); <ide> <ide> const fd = await open(path, flag, options.mode); <ide> const { signal } = options; <ide> async function readFile(path, options) { <ide> if (path instanceof FileHandle) <ide> return readFileHandle(path, options); <ide> <del> if (options.signal?.aborted) { <del> throw lazyDOMException('The operation was aborted', 'AbortError'); <del> } <add> checkAborted(options.signal); <ide> <ide> const fd = await open(path, flag, 0o666); <ide> return PromisePrototypeFinally(readFileHandle(fd, options), fd.close); <ide><path>lib/internal/fs/read_file_context.js <ide> const { Buffer } = require('buffer'); <ide> <ide> const { FSReqCallback, close, read } = internalBinding('fs'); <ide> <del>const { hideStackFrames } = require('internal/errors'); <del> <del> <del>let DOMException; <del>const lazyDOMException = hideStackFrames((message, name) => { <del> if (DOMException === undefined) <del> DOMException = internalBinding('messaging').DOMException; <del> return new DOMException(message, name); <del>}); <add>const { <add> AbortError, <add>} = require('internal/errors'); <ide> <ide> // Use 64kb in case the file type is not a regular file and thus do not know the <ide> // actual file size. Increasing the value further results in more frequent over <ide> class ReadFileContext { <ide> let length; <ide> <ide> if (this.signal?.aborted) { <del> return this.close( <del> lazyDOMException('The operation was aborted', 'AbortError') <del> ); <add> return this.close(new AbortError()); <ide> } <ide> if (this.size === 0) { <ide> buffer = Buffer.allocUnsafeSlow(kReadFileUnknownBufferLength);
4
Python
Python
fix lint issues
7c0720aec293aaeb3afce2b8a07ed246b6e5d05f
<ide><path>libcloud/test/dns/test_hostvirtual.py <ide> def _dns_zones_ZONE_DOES_NOT_EXIST(self, method, url, body, headers): <ide> {}, httplib.responses[httplib.NOT_FOUND]) <ide> <ide> def _dns_record_ZONE_DOES_NOT_EXIST(self, method, <del> url, body, headers): <add> url, body, headers): <ide> body = self.fixtures.load('zone_does_not_exist.json') <ide> return (httplib.NOT_FOUND, body, <ide> {}, httplib.responses[httplib.NOT_FOUND]) <ide> <ide> def _dns_record_RECORD_DOES_NOT_EXIST(self, method, <del> url, body, headers): <add> url, body, headers): <ide> body = self.fixtures.load('zone_does_not_exist.json') <ide> return (httplib.NOT_FOUND, body, <ide> {}, httplib.responses[httplib.NOT_FOUND]) <ide> <ide> def _dns_records_ZONE_DOES_NOT_EXIST(self, method, <del> url, body, headers): <add> url, body, headers): <ide> body = self.fixtures.load('zone_does_not_exist.json') <ide> return (httplib.NOT_FOUND, body, <ide> {}, httplib.responses[httplib.NOT_FOUND]) <ide> <ide> def _dns_zones_RECORD_DOES_NOT_EXIST(self, method, <del> url, body, headers): <add> url, body, headers): <ide> body = self.fixtures.load('zone_does_not_exist.json') <ide> return (httplib.NOT_FOUND, body, <ide> {}, httplib.responses[httplib.NOT_FOUND])
1
Javascript
Javascript
fix double-binding to submit event
c72e9068418680c447ed029a894e6209d809776e
<ide><path>src/core/ReactEventEmitter.js <ide> var merge = require('merge'); <ide> var alreadyListeningTo = {}; <ide> var isMonitoringScrollValue = false; <ide> var reactTopListenersCounter = 0; <add> <add>// For events like 'submit' which don't consistently bubble (which we trap at a <add>// lower node than `document`), binding at `document` would cause duplicate <add>// events so we don't include them here <ide> var topEventMapping = { <ide> topBlur: 'blur', <ide> topChange: 'change', <ide> var topEventMapping = { <ide> topPaste: 'paste', <ide> topScroll: 'scroll', <ide> topSelectionChange: 'selectionchange', <del> topSubmit: 'submit', <ide> topTouchCancel: 'touchcancel', <ide> topTouchEnd: 'touchend', <ide> topTouchMove: 'touchmove', <ide> var ReactEventEmitter = merge(ReactEventEmitterMixin, { <ide> // to make sure blur and focus event listeners are only attached once <ide> isListening[topLevelTypes.topBlur] = true; <ide> isListening[topLevelTypes.topFocus] = true; <del> } else { <add> } else if (topEventMapping[dependency]) { <ide> trapBubbledEvent(topLevelType, topEventMapping[dependency], mountAt); <ide> } <ide>
1
Text
Text
remove unused headings
13eb67309ef31f2b61b74639ae8234adee3b9eac
<ide><path>guides/source/5_1_release_notes.md <ide> Action Cable <ide> <ide> Please refer to the [Changelog][action-cable] for detailed changes. <ide> <del>### Removals <del> <del>### Deprecations <del> <ide> ### Notable changes <ide> <ide> * Added support for `channel_prefix` to Redis and evented Redis adapters
1
Ruby
Ruby
add some fixme notes about documentation [ci skip]
ee73d9ff8d13cb9dd3f6ec8cf2e4d3289bfd0278
<ide><path>activesupport/lib/active_support/message_verifier.rb <ide> def initialize(secret, options = {}) <ide> @serializer = options[:serializer] || Marshal <ide> end <ide> <add> # FIXME: Document this method <ide> def valid_message?(signed_message) <ide> return if signed_message.blank? <ide> <ide> data, digest = signed_message.split("--") <ide> data.present? && digest.present? && ActiveSupport::SecurityUtils.secure_compare(digest, generate_digest(data)) <ide> end <ide> <add> # FIXME: Document this method <ide> def verified(signed_message) <ide> if valid_message?(signed_message) <ide> begin <ide> def verified(signed_message) <ide> end <ide> end <ide> <add> # FIXME: Document this method <ide> def verify(signed_message) <ide> verified(signed_message) || raise(InvalidSignature) <ide> end <ide> <add> # FIXME: Document this method <ide> def generate(value) <ide> data = encode(@serializer.dump(value)) <ide> "#{data}--#{generate_digest(data)}"
1
Ruby
Ruby
check existence rather than rescue exceptions
bd4aaac96b1f08d59a8e208095ac56ff446608df
<ide><path>Library/Homebrew/formula.rb <ide> def mirrors; @active_spec.mirrors; end <ide> <ide> # if the dir is there, but it's empty we consider it not installed <ide> def installed? <del> installed_prefix.children.length > 0 rescue false <add> (dir = installed_prefix).directory? && dir.children.length > 0 <ide> end <ide> <ide> def pinable? <ide><path>Library/Homebrew/test/test_formula.rb <ide> def test_prefix <ide> assert_kind_of Pathname, f.prefix <ide> end <ide> <add> def test_installed? <add> f = TestBall.new <add> f.stubs(:installed_prefix).returns(stub(:directory? => false)) <add> assert !f.installed? <add> <add> f.stubs(:installed_prefix).returns( <add> stub(:directory? => true, :children => []) <add> ) <add> assert !f.installed? <add> <add> f.stubs(:installed_prefix).returns( <add> stub(:directory? => true, :children => [stub]) <add> ) <add> assert f.installed? <add> end <add> <ide> def test_class_naming <ide> assert_equal 'ShellFm', Formula.class_s('shell.fm') <ide> assert_equal 'Fooxx', Formula.class_s('foo++')
2
Ruby
Ruby
add keg_only_reason to formula hash
00b588068fb8c2ae26cfd739968207a3259d43bc
<ide><path>Library/Homebrew/formula.rb <ide> def to_hash <ide> "version_scheme" => version_scheme, <ide> "bottle" => {}, <ide> "keg_only" => keg_only?, <add> "keg_only_reason" => keg_only_reason&.to_hash, <ide> "bottle_disabled" => bottle_disabled?, <ide> "options" => [], <ide> "build_dependencies" => dependencies.select(&:build?) <ide><path>Library/Homebrew/formula_support.rb <ide> def to_s <ide> @reason <ide> end.strip <ide> end <add> <add> def to_hash <add> reason_string = if @reason.is_a?(Symbol) <add> @reason.inspect <add> else <add> @reason.to_s <add> end <add> <add> { <add> "reason" => reason_string, <add> "explanation" => @explanation, <add> } <add> end <ide> end <ide> <ide> # Used to annotate formulae that don't require compiling or cannot build a bottle.
2