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
Ruby
Ruby
remove build attribute from xcode dep
4c6defbcf6768094a4e73fbeb6671b9915611617
<ide><path>Library/Homebrew/requirements.rb <ide> <ide> class XcodeDependency < Requirement <ide> fatal true <del> build true <ide> <ide> satisfy(:build_env => false) { MacOS::Xcode.installed? } <ide>
1
Text
Text
add 2.12.2 to changelog.md
466960d48fcb83cd53a92f353eccb7461307ede2
<ide><path>CHANGELOG.md <ide> # Ember Changelog <ide> <del># 2.13.0-beta.2 (April 7, 2017) <add>### 2.13.0-beta.2 (April 7, 2017) <ide> <ide> - [#15111](https://github.com/emberjs/ember.js/pull/15111) / [#15029](https://github.com/emberjs/ember.js/pull/15029) [PERF] `factoryFor` should cache when possible. <ide> - [#14961](https://github.com/emberjs/ember.js/pull/14961) [BUGIX] [Fixes #14925] remove duplicate `/` in pathname <ide> - [#15106](https://github.com/emberjs/ember.js/pull/15106) [DOC] Introduce a more debugging data to warnings about CP dependencies. <ide> - [#15107](https://github.com/emberjs/ember.js/pull/15107) [PERF] avoid toBoolean conversion when possible (chains). <ide> <del># 2.13.0-beta.1 (March 15, 2017) <add>### 2.13.0-beta.1 (March 15, 2017) <ide> <ide> - [#14011](https://github.com/emberjs/ember.js/pull/14011) [FEATURE ember-unique-location-history-state] Implements [RFC #186](https://github.com/emberjs/rfcs/pull/186). <ide> - [#13231](https://github.com/emberjs/ember.js/pull/13231) [BUGFIX] Fix a bug when using commas in computer property dependent keys. <ide> - [#14970](https://github.com/emberjs/ember.js/pull/14970) [BUGFIX] Generate integration tests for template helpers by default. <ide> - [#14976](https://github.com/emberjs/ember.js/pull/14976) [BUGFIX] Remove "no use strict" workaround for old versions of iOS 8. <ide> <add>### 2.12.2 (April 27, 2017) <add> <add>- [#15160](https://github.com/emberjs/ember.js/pull/15160) [BUGFIX] Ensure `Ember.Test` global is setup when including `ember-testing.js`. <add>- [#15142](https://github.com/emberjs/ember.js/pull/15142) / [#15163](https://github.com/emberjs/ember.js/pull/15163) [BUGFIX] Don’t leak deprecated `container`. <add>- [#15161](https://github.com/emberjs/ember.js/pull/15161) [BUGFIX] Prevent errors from being triggered during error processing on non ES6 platforms. <add>- [#15180](https://github.com/emberjs/ember.js/pull/15180) [BUGFIX] Correct `until` values for `this.container` deprecations. <add> <add> <ide> ### 2.12.1 (April 7, 2017) <ide> <ide> - [#14961](https://github.com/emberjs/ember.js/pull/14961) [BUGIX] Remove duplicate trailing `/` in pathname.
1
Go
Go
fix serveraddress setting
d96832cbd2c62103944518866e1fc1219ce048d5
<ide><path>registry/auth.go <ide> func LoadConfig(rootPath string) (*ConfigFile, error) { <ide> return &configFile, err <ide> } <ide> authConfig.Auth = "" <del> configFile.Configs[k] = authConfig <ide> authConfig.ServerAddress = k <add> configFile.Configs[k] = authConfig <ide> } <ide> } <ide> return &configFile, nil
1
PHP
PHP
use a template method to reduce duplicated code
3bae222307b003241a7e33ac972ede2427faf529
<ide><path>lib/Cake/Console/TaskRegistry.php <ide> public function __construct(Shell $Shell) { <ide> } <ide> <ide> /** <del> * Loads/constructs a task. Will return the instance in the registry if it already exists. <add> * Resolve a task classname. <ide> * <del> * You can alias your task as an existing task by setting the 'className' key, i.e., <del> * {{{ <del> * public $tasks = array( <del> * 'DbConfig' => array( <del> * 'className' => 'Bakeplus.DbConfigure' <del> * ); <del> * ); <del> * }}} <del> * All calls to the `DbConfig` task would use `DbConfigure` found in the `Bakeplus` plugin instead. <add> * Part of the template method for Cake\Utility\ObjectRegistry::load() <ide> * <del> * @param string $task Task name to load <del> * @param array $settings Settings for the task. <del> * @return Task A task object, Either the existing loaded task or a new one. <del> * @throws Cake\Error\MissingTaskException when the task could not be found <add> * @param string $class Partial classname to resolve. <add> * @return string|false Either the correct classname or false. <ide> */ <del> public function load($task, $settings = array()) { <del> if (is_array($settings) && isset($settings['className'])) { <del> $alias = $task; <del> $task = $settings['className']; <del> } <del> list($plugin, $name) = pluginSplit($task, true); <del> if (!isset($alias)) { <del> $alias = $name; <del> } <del> <del> if (isset($this->_loaded[$alias])) { <del> return $this->_loaded[$alias]; <del> } <add> protected function _resolveClassName($class) { <add> return App::classname($class, 'Console/Command/Task', 'Task'); <add> } <ide> <del> $taskClass = App::classname($task, 'Console/Command/Task', 'Task'); <del> if (!$taskClass) { <del> throw new Error\MissingTaskException(array( <del> 'class' => $name <del> )); <del> } <add>/** <add> * Throws an exception when a task is missing. <add> * <add> * Part of the template method for Cake\Utility\ObjectRegistry::load() <add> * <add> * @param string $class The classname that is missing. <add> * @param string $plugin The plugin the task is missing in. <add> * @throws Cake\Error\MissingTaskException <add> */ <add> protected function _throwMissingClassError($class, $plugin) { <add> throw new Error\MissingTaskException([ <add> 'class' => $class, <add> 'plugin' => $plugin <add> ]); <add> } <ide> <del> $this->_loaded[$alias] = new $taskClass( <del> $this->_Shell->stdout, $this->_Shell->stderr, $this->_Shell->stdin <add>/** <add> * Create the task instance. <add> * <add> * Part of the template method for Cake\Utility\ObjectRegistry::load() <add> * <add> * @param string $class The classname that is missing. <add> * @param array $settings An array of settings to use for the task. <add> * @return Component The constructed task class. <add> */ <add> protected function _create($class, $settings) { <add> return new $class( <add> $this->_Shell->stdout, <add> $this->_Shell->stderr, <add> $this->_Shell->stdin <ide> ); <del> return $this->_loaded[$alias]; <ide> } <ide> <ide> } <ide><path>lib/Cake/Controller/ComponentRegistry.php <ide> public function getController() { <ide> } <ide> <ide> /** <del> * Loads/constructs a component. Will return the instance in the registry if it already exists. <del> * You can use `$settings['enabled'] = false` to disable callbacks on a component when loading it. <del> * Callbacks default to on. Disabled component methods work as normal, only callbacks are disabled. <add> * Resolve a component classname. <ide> * <del> * You can alias your component as an existing component by setting the 'className' key, i.e., <del> * {{{ <del> * public $components = array( <del> * 'Email' => array( <del> * 'className' => '\App\Controller\Component\AliasedEmailComponent' <del> * ); <del> * ); <del> * }}} <del> * All calls to the `Email` component would use `AliasedEmail` instead. <add> * Part of the template method for Cake\Utility\ObjectRegistry::load() <ide> * <del> * @param string $component Component name to load <del> * @param array $settings Settings for the component. <del> * @return Component A component object, Either the existing loaded component or a new one. <del> * @throws Cake\Error\MissingComponentException when the component could not be found <add> * @param string $class Partial classname to resolve. <add> * @return string|false Either the correct classname or false. <ide> */ <del> public function load($component, $settings = array()) { <del> if (is_array($settings) && isset($settings['className'])) { <del> $alias = $component; <del> $component = $settings['className']; <del> } <del> list($plugin, $name) = pluginSplit($component, true); <del> if (!isset($alias)) { <del> $alias = $name; <del> } <del> if (isset($this->_loaded[$alias])) { <del> return $this->_loaded[$alias]; <del> } <del> $componentClass = App::classname($plugin . $name, 'Controller/Component', 'Component'); <del> if (!$componentClass) { <del> throw new Error\MissingComponentException(array( <del> 'class' => $component, <del> 'plugin' => substr($plugin, 0, -1) <del> )); <del> } <del> $component = new $componentClass($this, $settings); <add> protected function _resolveClassName($class) { <add> return App::classname($class, 'Controller/Component', 'Component'); <add> } <add> <add>/** <add> * Throws an exception when a component is missing. <add> * <add> * Part of the template method for Cake\Utility\ObjectRegistry::load() <add> * <add> * @param string $class The classname that is missing. <add> * @param string $plugin The plugin the component is missing in. <add> * @throws Cake\Error\MissingComponentException <add> */ <add> protected function _throwMissingClassError($class, $plugin) { <add> throw new Error\MissingComponentException([ <add> 'class' => $class, <add> 'plugin' => $plugin <add> ]); <add> } <add> <add>/** <add> * Create the component instance. <add> * <add> * Part of the template method for Cake\Utility\ObjectRegistry::load() <add> * Enabled components will be registered with the event manager. <add> * <add> * @param string $class The classname that is missing. <add> * @param array $settings An array of settings to use for the component. <add> * @return Component The constructed component class. <add> */ <add> protected function _create($class, $settings) { <add> $instance = new $class($this, $settings); <ide> $enable = isset($settings['enabled']) ? $settings['enabled'] : true; <ide> if ($enable) { <del> $this->_eventManager->attach($component); <add> $this->_eventManager->attach($instance); <ide> } <del> $this->_loaded[$alias] = $component; <del> return $this->_loaded[$alias]; <add> return $instance; <ide> } <ide> <ide> } <ide><path>lib/Cake/Utility/ObjectRegistry.php <ide> abstract class ObjectRegistry { <ide> protected $_loaded = []; <ide> <ide> /** <del> * Load instances for this registry. <add> * Loads/constructs a object instance. <ide> * <del> * Overridden in subclasses. <add> * Will return the instance in the registry if it already exists. <add> * You can use `$settings['enabled'] = false` to disable events on an object when loading it. <add> * Not all registry subclasses support events. <add> * <add> * You can alias an object by setting the 'className' key, i.e., <add> * {{{ <add> * public $components = [ <add> * 'Email' => [ <add> * 'className' => '\App\Controller\Component\AliasedEmailComponent' <add> * ]; <add> * ]; <add> * }}} <add> * <add> * All calls to the `Email` component would use `AliasedEmail` instead. <ide> * <ide> * @param string $name The name/class of the object to load. <ide> * @param array $settings Additional settings to use when loading the object. <del> * @return mixed. <add> * @return mixed <add> */ <add> public function load($objectName, $settings = []) { <add> list($plugin, $name) = pluginSplit($objectName); <add> if (isset($this->_loaded[$name])) { <add> return $this->_loaded[$name]; <add> } <add> if (is_array($settings) && isset($settings['className'])) { <add> $className = $this->_resolveClassName($settings['className']); <add> } <add> if (!isset($className)) { <add> $className = $this->_resolveClassName($objectName); <add> } <add> if (!$className) { <add> $this->_throwMissingClassError($objectName, substr($plugin, 0, -1)); <add> } <add> $instance = $this->_create($className, $settings); <add> $this->_loaded[$name] = $instance; <add> return $instance; <add> } <add> <add>/** <add> * Should resolve the classname for a given object type. <add> * <add> * @param string $class The class to resolve. <add> * @return string|false The resolved name or false for failure. <add> */ <add> abstract protected function _resolveClassName($class); <add> <add>/** <add> * Throw an exception when the requested object name is missing. <add> * <add> * @param string $class The class that is missing. <add> * @param string $plugin The plugin $class is missing from. <add> * @throw Cake\Exception <add> */ <add> abstract protected function _throwMissingClassError($class, $plugin); <add> <add>/** <add> * Create an instance of a given classname. <add> * <add> * This method should construct and do any other initialization logic <add> * required. <add> * <add> * @param string $class The class to build. <add> * @param array $settings The settings for construction <add> * @return mixed <ide> */ <del> abstract public function load($name, $settings = []); <add> abstract protected function _create($class, $settings); <ide> <ide> /** <ide> * Get the loaded object list, or get the object instance at a given name. <ide><path>lib/Cake/View/HelperRegistry.php <ide> public function __get($name) { <ide> } <ide> <ide> /** <del> * Loads/constructs a helper. Will return the instance in the registry if it already exists. <del> * By setting `$enable` to false you can disable callbacks for a helper. Alternatively you <del> * can set `$settings['enabled'] = false` to disable callbacks. This alias is provided so that when <del> * declaring $helpers arrays you can disable callbacks on helpers. <add> * Resolve a helper classname. <ide> * <del> * You can alias your helper as an existing helper by setting the 'className' key, i.e., <del> * {{{ <del> * public $helpers = array( <del> * 'Html' => array( <del> * 'className' => '\App\View\Helper\AliasedHtmlHelper' <del> * ); <del> * ); <del> * }}} <del> * All calls to the `Html` helper would use `AliasedHtml` instead. <add> * Part of the template method for Cake\Utility\ObjectRegistry::load() <ide> * <del> * @param string $helper Helper name to load <del> * @param array $settings Settings for the helper. <del> * @return Helper A helper object, Either the existing loaded helper or a new one. <del> * @throws Cake\Error\MissingHelperException when the helper could not be found <add> * @param string $class Partial classname to resolve. <add> * @return string|false Either the correct classname or false. <ide> */ <del> public function load($helper, $settings = array()) { <del> list($plugin, $name) = pluginSplit($helper); <del> if (isset($this->_loaded[$name])) { <del> return $this->_loaded[$name]; <del> } <del> if (is_array($settings) && isset($settings['className'])) { <del> $helperClass = App::classname($settings['className'], 'View/Helper', 'Helper'); <del> } <del> if (!isset($helperClass)) { <del> $helperClass = App::classname($helper, 'View/Helper', 'Helper'); <del> } <del> if (!$helperClass) { <del> throw new Error\MissingHelperException(array( <del> 'class' => $helper, <del> 'plugin' => substr($plugin, 0, -1) <del> )); <del> } <del> $helperObject = new $helperClass($this->_View, $settings); <add> protected function _resolveClassName($class) { <add> return App::classname($class, 'View/Helper', 'Helper'); <add> } <ide> <add>/** <add> * Throws an exception when a helper is missing. <add> * <add> * Part of the template method for Cake\Utility\ObjectRegistry::load() <add> * <add> * @param string $class The classname that is missing. <add> * @param string $plugin The plugin the helper is missing in. <add> * @throws Cake\Error\MissingHelperException <add> */ <add> protected function _throwMissingClassError($class, $plugin) { <add> throw new Error\MissingHelperException([ <add> 'class' => $class, <add> 'plugin' => $plugin <add> ]); <add> } <add> <add>/** <add> * Create the helper instance. <add> * <add> * Part of the template method for Cake\Utility\ObjectRegistry::load() <add> * Enabled helpers will be registered with the event manager. <add> * <add> * @param string $class The classname that is missing. <add> * @param array $settings An array of settings to use for the helper. <add> * @return Component The constructed helper class. <add> */ <add> protected function _create($class, $settings) { <add> $instance = new $class($this->_View, $settings); <ide> $vars = array('request', 'theme', 'plugin'); <ide> foreach ($vars as $var) { <del> $helperObject->{$var} = $this->_View->{$var}; <add> $instance->{$var} = $this->_View->{$var}; <ide> } <del> <del> $this->_loaded[$name] = $helperObject; <del> <ide> $enable = isset($settings['enabled']) ? $settings['enabled'] : true; <ide> if ($enable) { <del> $this->_eventManager->attach($helperObject); <add> $this->_eventManager->attach($instance); <ide> } <del> return $helperObject; <add> return $instance; <ide> } <ide> <ide> }
4
Mixed
Python
improve random prefix generation in displacy arcs
4a6af0852a9da399b7d73279cfea00cbc3b5ca99
<ide><path>.github/contributors/willprice.md <add># spaCy contributor agreement <add> <add>This spaCy Contributor Agreement (**"SCA"**) is based on the <add>[Oracle Contributor Agreement](http://www.oracle.com/technetwork/oca-405177.pdf). <add>The SCA applies to any contribution that you make to any product or project <add>managed by us (the **"project"**), and sets out the intellectual property rights <add>you grant to us in the contributed materials. The term **"us"** shall mean <add>[ExplosionAI UG (haftungsbeschränkt)](https://explosion.ai/legal). The term <add>**"you"** shall mean the person or entity identified below. <add> <add>If you agree to be bound by these terms, fill in the information requested <add>below and include the filled-in version with your first pull request, under the <add>folder [`.github/contributors/`](/.github/contributors/). The name of the file <add>should be your GitHub username, with the extension `.md`. For example, the user <add>example_user would create the file `.github/contributors/example_user.md`. <add> <add>Read this agreement carefully before signing. These terms and conditions <add>constitute a binding legal agreement. <add> <add>## Contributor Agreement <add> <add>1. The term "contribution" or "contributed materials" means any source code, <add>object code, patch, tool, sample, graphic, specification, manual, <add>documentation, or any other material posted or submitted by you to the project. <add> <add>2. With respect to any worldwide copyrights, or copyright applications and <add>registrations, in your contribution: <add> <add> * you hereby assign to us joint ownership, and to the extent that such <add> assignment is or becomes invalid, ineffective or unenforceable, you hereby <add> grant to us a perpetual, irrevocable, non-exclusive, worldwide, no-charge, <add> royalty-free, unrestricted license to exercise all rights under those <add> copyrights. This includes, at our option, the right to sublicense these same <add> rights to third parties through multiple levels of sublicensees or other <add> licensing arrangements; <add> <add> * you agree that each of us can do all things in relation to your <add> contribution as if each of us were the sole owners, and if one of us makes <add> a derivative work of your contribution, the one who makes the derivative <add> work (or has it made will be the sole owner of that derivative work; <add> <add> * you agree that you will not assert any moral rights in your contribution <add> against us, our licensees or transferees; <add> <add> * you agree that we may register a copyright in your contribution and <add> exercise all ownership rights associated with it; and <add> <add> * you agree that neither of us has any duty to consult with, obtain the <add> consent of, pay or render an accounting to the other for any use or <add> distribution of your contribution. <add> <add>3. With respect to any patents you own, or that you can license without payment <add>to any third party, you hereby grant to us a perpetual, irrevocable, <add>non-exclusive, worldwide, no-charge, royalty-free license to: <add> <add> * make, have made, use, sell, offer to sell, import, and otherwise transfer <add> your contribution in whole or in part, alone or in combination with or <add> included in any product, work or materials arising out of the project to <add> which your contribution was submitted, and <add> <add> * at our option, to sublicense these same rights to third parties through <add> multiple levels of sublicensees or other licensing arrangements. <add> <add>4. Except as set out above, you keep all right, title, and interest in your <add>contribution. The rights that you grant to us under these terms are effective <add>on the date you first submitted a contribution to us, even if your submission <add>took place before the date you sign these terms. <add> <add>5. You covenant, represent, warrant and agree that: <add> <add> * Each contribution that you submit is and shall be an original work of <add> authorship and you can legally grant the rights set out in this SCA; <add> <add> * to the best of your knowledge, each contribution will not violate any <add> third party's copyrights, trademarks, patents, or other intellectual <add> property rights; and <add> <add> * each contribution shall be in compliance with U.S. export control laws and <add> other applicable export and import laws. You agree to notify us if you <add> become aware of any circumstance which would make any of the foregoing <add> representations inaccurate in any respect. We may publicly disclose your <add> participation in the project, including the fact that you have signed the SCA. <add> <add>6. This SCA is governed by the laws of the State of California and applicable <add>U.S. Federal law. Any choice of law rules will not apply. <add> <add>7. Please place an “x” on one of the applicable statement below. Please do NOT <add>mark both statements: <add> <add> * [x] I am signing on behalf of myself as an individual and no other person <add> or entity, including my employer, has or will have rights with respect to my <add> contributions. <add> <add> * [ ] I am signing on behalf of my employer or a legal entity and I have the <add> actual authority to contractually bind that entity. <add> <add>## Contributor Details <add> <add>| Field | Entry | <add>|------------------------------- | --------------------- | <add>| Name | Will Price | <add>| Company name (if applicable) | N/A | <add>| Title or role (if applicable) | N/A | <add>| Date | 26/12/2018 | <add>| GitHub username | willprice | <add>| Website (optional) | https://willprice.org | <ide><path>spacy/displacy/render.py <ide> # coding: utf8 <ide> from __future__ import unicode_literals <ide> <del>import random <add>import uuid <ide> <ide> from .templates import TPL_DEP_SVG, TPL_DEP_WORDS, TPL_DEP_ARCS <ide> from .templates import TPL_ENT, TPL_ENTS, TPL_FIGURE, TPL_TITLE, TPL_PAGE <ide> def render(self, parsed, page=False, minify=False): <ide> """ <ide> # Create a random ID prefix to make sure parses don't receive the <ide> # same ID, even if they're identical <del> id_prefix = random.randint(0, 999) <add> id_prefix = uuid.uuid4().hex <ide> rendered = [self.render_svg('{}-{}'.format(id_prefix, i), p['words'], p['arcs']) <ide> for i, p in enumerate(parsed)] <ide> if page:
2
Javascript
Javascript
add ability to use custom elements inside tooltips
e9200e5bc04a0945215caf7cd02ddb68111454d1
<ide><path>src/tooltip.js <ide> Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) { <ide> <ide> Tooltip.prototype.setContent = function () { <ide> var tip = this.getTooltipElement() <del> var title = this.getTitle() <add> <add> if (this.options.tooltipClass) { <add> tip.classList.add(this.options.tooltipClass) <add> } <ide> <ide> var inner = tip.querySelector('.tooltip-inner') <del> if (this.options.html) { <del> inner.innerHTML = title <add> if (this.options.tooltipElement) { <add> inner.appendChild(this.options.tooltipElement) <ide> } else { <del> inner.textContent = title <add> var title = this.getTitle() <add> if (this.options.html) { <add> inner.innerHTML = title <add> } else { <add> inner.textContent = title <add> } <ide> } <ide> <ide> tip.classList.remove('fade', 'in', 'top', 'bottom', 'left', 'right') <ide> Tooltip.prototype.fixTitle = function () { <ide> } <ide> <ide> Tooltip.prototype.hasContent = function () { <del> return this.getTitle() <add> return this.getTitle() || this.options.tooltipElement <ide> } <ide> <ide> Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
1
Text
Text
update api docs for unmountandreleasereactrootnode
10f3d93df728274685b3ce16468862199b6876ff
<ide><path>docs/docs/ref-01-top-level-api.md <ide> If the React component was previously rendered into `container`, this will perfo <ide> If the optional callback is provided, it will be executed after the component is rendered or updated. <ide> <ide> <del>### React.unmountAndReleaseReactRootNode <add>### React.unmountComponentAtNode <ide> <ide> ```javascript <del>unmountAndReleaseReactRootNode(DOMElement container) <add>unmountComponentAtNode(DOMElement container) <ide> ``` <ide> <ide> Remove a mounted React component from the DOM and clean up its event handlers and state. <ide> <add>> Note: <add>> <add>> This method was called `React.unmountAndReleaseReactRootNode` until v0.5. It still works in v0.5 but will be removed in future versions. <add> <ide> <ide> ### React.renderComponentToString <ide>
1
Go
Go
adjust warnings for transient lb endpoint conds
ac0aa6485be2982d815d6a89c20fb2567449882b
<ide><path>libnetwork/service_linux.go <ide> func (n *network) addLBBackend(ip net.IP, lb *loadBalancer) { <ide> } <ide> ep, sb, err := n.findLBEndpointSandbox() <ide> if err != nil { <del> logrus.Errorf("error in addLBBackend for %s/%s for %v", n.ID(), n.Name(), err) <add> logrus.Errorf("addLBBackend %s/%s: %v", n.ID(), n.Name(), err) <ide> return <ide> } <ide> if sb.osSbox == nil { <ide> return <ide> } <del> if n.ingress && !sb.ingress { <del> return <del> } <ide> <ide> eIP := ep.Iface().Address() <ide> <ide> func (n *network) rmLBBackend(ip net.IP, lb *loadBalancer, rmService bool, fullR <ide> } <ide> ep, sb, err := n.findLBEndpointSandbox() <ide> if err != nil { <del> logrus.Errorf("error in rmLBBackend for %s/%s for %v", n.ID(), n.Name(), err) <add> logrus.Debugf("rmLBBackend for %s/%s: %v -- probably transient state", n.ID(), n.Name(), err) <ide> return <ide> } <ide> if sb.osSbox == nil { <ide> return <ide> } <del> if n.ingress && !sb.ingress { <del> return <del> } <ide> <ide> eIP := ep.Iface().Address() <ide>
1
Javascript
Javascript
keep strict mode even if code is inserted
b98debb80970643ddc848344ac92ae1be4f99643
<ide><path>lib/FunctionModuleTemplatePlugin.js <ide> FunctionModuleTemplatePlugin.prototype.apply = function(moduleTemplate) { <ide> defaultArguments.push("__webpack_require__"); <ide> } <ide> source.add("/***/ function(" + defaultArguments.concat(module.arguments || []).join(", ") + ") {\n\n"); <add> if(module.strict) source.add("\"use strict\";\n"); <ide> source.add(new PrefixSource(this.outputOptions.sourcePrefix, moduleSource)); <ide> source.add("\n\n/***/ }"); <ide> return source; <ide><path>lib/Module.js <ide> function Module() { <ide> this.dependenciesWarnings = []; <ide> this.errors = []; <ide> this.dependenciesErrors = []; <add> this.strict = false; <ide> } <ide> module.exports = Module; <ide> <ide><path>lib/UseStrictPlugin.js <add>/* <add> MIT License http://www.opensource.org/licenses/mit-license.php <add> Author Tobias Koppers @sokra <add>*/ <add>var ConstDependency = require("./dependencies/ConstDependency"); <add>var BasicEvaluatedExpression = require("./BasicEvaluatedExpression"); <add> <add>var NullFactory = require("./NullFactory"); <add> <add>function UseStrictPlugin() {} <add>module.exports = UseStrictPlugin; <add> <add>UseStrictPlugin.prototype.apply = function(compiler) { <add> compiler.parser.plugin("program", function(ast) { <add> var body = ast.body[0] <add> if(body && <add> body.type === "ExpressionStatement" && <add> body.expression.type === "Literal" && <add> body.expression.value === "use strict") <add> this.state.module.strict = true; <add> }); <add>}; <ide><path>lib/WebpackOptionsApply.js <ide> var CompatibilityPlugin = require("./CompatibilityPlugin"); <ide> <ide> var TemplatedPathPlugin = require("./TemplatedPathPlugin"); <ide> var WarnCaseSensitiveModulesPlugin = require("./WarnCaseSensitiveModulesPlugin"); <add>var UseStrictPlugin = require("./UseStrictPlugin"); <ide> <ide> var LoaderPlugin = require("./dependencies/LoaderPlugin"); <ide> var CommonJsPlugin = require("./dependencies/CommonJsPlugin"); <ide> WebpackOptionsApply.prototype.process = function(options, compiler) { <ide> new RequireJsStuffPlugin(), <ide> new APIPlugin(), <ide> new ConstPlugin(), <add> new UseStrictPlugin(), <ide> new RequireIncludePlugin(), <ide> new RequireEnsurePlugin(), <ide> new RequireContextPlugin(options.resolve.modules, options.resolve.extensions),
4
Go
Go
fix docker run -it on windows
8c014db3027b1ddecd42389e24b9c46d5f7a93ae
<ide><path>cli/command/in.go <ide> package command <ide> <ide> import ( <ide> "errors" <del> "github.com/docker/docker/pkg/term" <ide> "io" <add> "os" <ide> "runtime" <add> <add> "github.com/docker/docker/pkg/term" <ide> ) <ide> <ide> // InStream is an input stream used by the DockerCli to read user input <ide> func (i *InStream) Close() error { <ide> return i.in.Close() <ide> } <ide> <add>// SetRawTerminal sets raw mode on the input terminal <add>func (i *InStream) SetRawTerminal() (err error) { <add> if os.Getenv("NORAW") != "" || !i.CommonStream.isTerminal { <add> return nil <add> } <add> i.CommonStream.state, err = term.SetRawTerminal(i.CommonStream.fd) <add> return err <add>} <add> <ide> // CheckTty checks if we are trying to attach to a container tty <ide> // from a non-tty client input stream, and if so, returns an error. <ide> func (i *InStream) CheckTty(attachStdin, ttyMode bool) error { <ide><path>cli/command/out.go <ide> package command <ide> <ide> import ( <add> "io" <add> "os" <add> <ide> "github.com/Sirupsen/logrus" <ide> "github.com/docker/docker/pkg/term" <del> "io" <ide> ) <ide> <ide> // OutStream is an output stream used by the DockerCli to write normal program <ide> func (o *OutStream) Write(p []byte) (int, error) { <ide> return o.out.Write(p) <ide> } <ide> <add>// SetRawTerminal sets raw mode on the input terminal <add>func (o *OutStream) SetRawTerminal() (err error) { <add> if os.Getenv("NORAW") != "" || !o.CommonStream.isTerminal { <add> return nil <add> } <add> o.CommonStream.state, err = term.SetRawTerminalOutput(o.CommonStream.fd) <add> return err <add>} <add> <ide> // GetTtySize returns the height and width in characters of the tty <ide> func (o *OutStream) GetTtySize() (uint, uint) { <ide> if !o.isTerminal { <ide><path>cli/command/stream.go <ide> package command <ide> <ide> import ( <ide> "github.com/docker/docker/pkg/term" <del> "os" <ide> ) <ide> <ide> // CommonStream is an input stream used by the DockerCli to read user input <ide> func (s *CommonStream) IsTerminal() bool { <ide> return s.isTerminal <ide> } <ide> <del>// SetRawTerminal sets raw mode on the input terminal <del>func (s *CommonStream) SetRawTerminal() (err error) { <del> if os.Getenv("NORAW") != "" || !s.isTerminal { <del> return nil <del> } <del> s.state, err = term.SetRawTerminal(s.fd) <del> return err <del>} <del> <ide> // RestoreTerminal restores normal mode to the terminal <ide> func (s *CommonStream) RestoreTerminal() { <ide> if s.state != nil {
3
Ruby
Ruby
improve no formula output
021468c8c0b5d587d6102535be2d4dc66d3b5863
<ide><path>Library/Homebrew/dev-cmd/bump-formula-pr.rb <ide> def bump_formula_pr <ide> odie "Couldn't guess formula for sure: could be one of these:\n#{guesses}" <ide> end <ide> end <del> odie "No formula found!" unless formula <add> raise FormulaUnspecifiedError unless formula <ide> <ide> check_for_duplicate_pull_requests(formula) unless checked_for_duplicates <ide>
1
Python
Python
improve test protocol for inputs_embeds in tf
cf62bdc962c53d9fb7a5820217f1bf844bb6da3b
<ide><path>transformers/tests/modeling_tf_common_test.py <ide> def test_inputs_embeds(self): <ide> try: <ide> x = wte([input_ids], mode="embedding") <ide> except: <del> if hasattr(self.model_tester, "embedding_size"): <del> x = tf.ones(input_ids.shape + [model.config.embedding_size], dtype=tf.dtypes.float32) <del> else: <del> x = tf.ones(input_ids.shape + [self.model_tester.hidden_size], dtype=tf.dtypes.float32) <add> x = wte([input_ids, None, None, None], mode="embedding") <add> # ^^ In our TF models, the input_embeddings can take slightly different forms, <add> # so we try a few of them. <add> # We used to fall back to just synthetically creating a dummy tensor of ones: <add> # <add> # if hasattr(self.model_tester, "embedding_size"): <add> # x = tf.ones(input_ids.shape + [self.model_tester.embedding_size], dtype=tf.dtypes.float32) <add> # else: <add> # x = tf.ones(input_ids.shape + [self.model_tester.hidden_size], dtype=tf.dtypes.float32) <ide> inputs_dict["inputs_embeds"] = x <ide> outputs = model(inputs_dict) <ide>
1
Text
Text
put positive case in if statement
39530535b98894bfc4552119c9ea7ee415913483
<ide><path>docs/intro.md <ide> configuration data options: <ide> ```coffeescript <ide> wrapGuideConfig = <ide> getGuideColumn: (path, defaultColumn) -> <del> if path.indexOf('.mm', path.length - 3) isnt -1 <del> return -1 # Disable the guide for Objective-C files <del> else <add> if path.indexOf('.mm', path.length - 3) is -1 <ide> return defaultColumn <add> else <add> return -1 # Disable the guide for Objective-C files <ide> requireExtension 'wrap-guide', wrapGuideConfig <ide> ``` <ide>
1
Mixed
Javascript
add writablecorked property
de119131bc87cf4168c949ecbbf1c1504f96a499
<ide><path>doc/api/stream.md <ide> Is `true` after [`writable.end()`][] has been called. This property <ide> does not indicate whether the data has been flushed, for this use <ide> [`writable.writableFinished`][] instead. <ide> <add>##### writable.writableCorked <add><!-- YAML <add>added: REPLACEME <add>--> <add> <add>* {integer} <add> <add>Number of times [`writable.uncork()`][stream-uncork] needs to be <add>called in order to fully uncork the stream. <add> <ide> ##### writable.writableFinished <ide> <!-- YAML <ide> added: v12.6.0 <ide> contain multi-byte characters. <ide> [stream-push]: #stream_readable_push_chunk_encoding <ide> [stream-read]: #stream_readable_read_size <ide> [stream-resume]: #stream_readable_resume <add>[stream-uncork]: #stream_writable_uncork <ide> [stream-write]: #stream_writable_write_chunk_encoding_callback <ide> [Stream Three States]: #stream_three_states <ide> [writable-_destroy]: #stream_writable_destroy_err_callback <ide><path>lib/_http_outgoing.js <ide> const { validateString } = require('internal/validators'); <ide> const HIGH_WATER_MARK = getDefaultHighWaterMark(); <ide> const { CRLF, debug } = common; <ide> <del>const kIsCorked = Symbol('isCorked'); <del> <ide> const RE_CONN_CLOSE = /(?:^|\W)close(?:$|\W)/i; <ide> const RE_TE_CHUNKED = common.chunkExpression; <ide> <ide> function OutgoingMessage() { <ide> <ide> this.finished = false; <ide> this._headerSent = false; <del> this[kIsCorked] = false; <ide> <ide> this.socket = null; <ide> this._header = null; <ide> function write_(msg, chunk, encoding, callback, fromEnd) { <ide> ['string', 'Buffer'], chunk); <ide> } <ide> <del> if (!fromEnd && msg.socket && !msg[kIsCorked]) { <add> if (!fromEnd && msg.socket && !msg.socket.writableCorked) { <ide> msg.socket.cork(); <del> msg[kIsCorked] = true; <del> process.nextTick(connectionCorkNT, msg, msg.socket); <add> process.nextTick(connectionCorkNT, msg.socket); <ide> } <ide> <ide> var len, ret; <ide> function writeAfterEndNT(msg, err, callback) { <ide> } <ide> <ide> <del>function connectionCorkNT(msg, conn) { <del> msg[kIsCorked] = false; <add>function connectionCorkNT(conn) { <ide> conn.uncork(); <ide> } <ide> <ide><path>lib/_stream_writable.js <ide> Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { <ide> } <ide> }); <ide> <add>Object.defineProperty(Writable.prototype, 'writableCorked', { <add> // Making it explicit this property is not enumerable <add> // because otherwise some prototype manipulation in <add> // userland will fail <add> enumerable: false, <add> get: function() { <add> return this._writableState ? this._writableState.corked : 0; <add> } <add>}); <add> <ide> // If we're already writing something, then just put this <ide> // in the queue, and wait our turn. Otherwise, call _write <ide> // If we return false, then we need a drain event, so set that flag. <ide><path>test/parallel/test-stream-writable-properties.js <add>'use strict'; <add>require('../common'); <add>const assert = require('assert'); <add> <add>const { Writable } = require('stream'); <add> <add>{ <add> const w = new Writable(); <add> assert.strictEqual(w.writableCorked, 0); <add> w.uncork(); <add> assert.strictEqual(w.writableCorked, 0); <add> w.cork(); <add> assert.strictEqual(w.writableCorked, 1); <add> w.cork(); <add> assert.strictEqual(w.writableCorked, 2); <add> w.uncork(); <add> assert.strictEqual(w.writableCorked, 1); <add> w.uncork(); <add> assert.strictEqual(w.writableCorked, 0); <add> w.uncork(); <add> assert.strictEqual(w.writableCorked, 0); <add>}
4
Ruby
Ruby
reduce duplicate where removal to one loop
dbc5d2694f0c77ca9de43306602969fdd3dbd20e
<ide><path>activerecord/lib/active_record/relation/spawn_methods.rb <ide> def merge(r) <ide> <ide> merged_relation = merged_relation.joins(r.joins_values) <ide> <del> merged_wheres = @where_values.dup + r.where_values <del> <del> equality_wheres = merged_wheres.find_all { |w| <del> w.respond_to?(:operator) && w.operator == :== <del> } <del> <del> equality_wheres_by_operand = equality_wheres.group_by { |eq| <del> eq.left.name <del> } <del> <del> duplicates = equality_wheres_by_operand.map { |name, list| <del> list[0...-1] <del> }.flatten <del> <del> merged_wheres -= duplicates <add> merged_wheres = @where_values + r.where_values <add> <add> # Remove duplicates, last one wins. <add> seen = {} <add> merged_wheres = merged_wheres.reverse.reject { |w| <add> nuke = false <add> if w.respond_to?(:operator) && w.operator == :== <add> name = w.left.name <add> nuke = seen[name] <add> seen[name] = true <add> end <add> nuke <add> }.reverse <ide> <ide> merged_relation.where_values = merged_wheres <ide>
1
Javascript
Javascript
update benchmarks with new createchildprocess api
1a2762b78e496dac4cc9fd0fb4ffb1d4f036692b
<ide><path>benchmark/process_loop.js <ide> node.mixin(require("/utils.js")); <ide> function next (i) { <ide> if (i <= 0) return; <ide> <del> var child = node.createChildProcess("echo hello"); <add> var child = node.createChildProcess("echo", ["hello"]); <ide> <ide> child.addListener("output", function (chunk) { <ide> if (chunk) print(chunk); <ide><path>benchmark/run.js <ide> var benchmarks = [ "static_http_server.js" <ide> var benchmark_dir = node.path.dirname(__filename); <ide> <ide> function exec (script, callback) { <del> var command = ARGV[0] + " " + node.path.join(benchmark_dir, script); <ide> var start = new Date(); <del> var child = node.createChildProcess(command); <add> var child = node.createChildProcess(ARGV[0], [node.path.join(benchmark_dir, script)]); <ide> child.addListener("exit", function (code) { <ide> var elapsed = new Date() - start; <ide> callback(elapsed, code);
2
Go
Go
use prefix naming for inspect tests
3812a6a8466f639cfd538c05c3ff2730a70b1440
<ide><path>integration-cli/docker_api_inspect_test.go <ide> import ( <ide> "testing" <ide> ) <ide> <del>func TestInspectContainerResponse(t *testing.T) { <add>func TestInspectApiContainerResponse(t *testing.T) { <ide> runCmd := exec.Command(dockerBinary, "run", "-d", "busybox", "true") <ide> out, _, err := runCommandWithOutput(runCmd) <ide> errorOut(err, t, fmt.Sprintf("failed to create a container: %v %v", out, err))
1
PHP
PHP
remove elixir helper
cd17572c9d8e1e039b738d595d83cda5a43f938e
<ide><path>src/Illuminate/Foundation/helpers.php <ide> function dispatch_now($job, $handler = null) <ide> } <ide> } <ide> <del>if (! function_exists('elixir')) { <del> /** <del> * Get the path to a versioned Elixir file. <del> * <del> * @param string $file <del> * @param string $buildDirectory <del> * @return string <del> * <del> * @throws \InvalidArgumentException <del> */ <del> function elixir($file, $buildDirectory = 'build') <del> { <del> static $manifest = []; <del> static $manifestPath; <del> <del> if (empty($manifest) || $manifestPath !== $buildDirectory) { <del> $path = public_path($buildDirectory.'/rev-manifest.json'); <del> <del> if (file_exists($path)) { <del> $manifest = json_decode(file_get_contents($path), true); <del> $manifestPath = $buildDirectory; <del> } <del> } <del> <del> $file = ltrim($file, '/'); <del> <del> if (isset($manifest[$file])) { <del> return '/'.trim($buildDirectory.'/'.$manifest[$file], '/'); <del> } <del> <del> $unversioned = public_path($file); <del> <del> if (file_exists($unversioned)) { <del> return '/'.trim($file, '/'); <del> } <del> <del> throw new InvalidArgumentException("File {$file} not defined in asset manifest."); <del> } <del>} <del> <ide> if (! function_exists('encrypt')) { <ide> /** <ide> * Encrypt the given value. <ide><path>tests/Foundation/FoundationHelpersTest.php <ide> public function testCache() <ide> $this->assertSame('default', cache('baz', 'default')); <ide> } <ide> <del> public function testUnversionedElixir() <del> { <del> $file = 'unversioned.css'; <del> <del> app()->singleton('path.public', function () { <del> return __DIR__; <del> }); <del> <del> touch(public_path($file)); <del> <del> $this->assertSame('/'.$file, elixir($file)); <del> <del> unlink(public_path($file)); <del> } <del> <ide> public function testMixDoesNotIncludeHost() <ide> { <ide> $app = new Application;
2
PHP
PHP
add ability to remove a defined join
f25eac3b46b9b3e23eb29e8e0e41ce6fdae29d36
<ide><path>src/Database/Query.php <ide> public function join($tables = null, $types = [], $overwrite = false) <ide> return $this; <ide> } <ide> <add> /** <add> * Remove a join if it has been defined. <add> * <add> * Useful when you are redefining joins or want to re-order <add> * the join clauses. <add> * <add> * @param string $name The alias/name of the join to remove. <add> * @return $this <add> */ <add> public function removeJoin($name) <add> { <add> unset($this->_parts['join'][$name]); <add> $this->_dirty(); <add> return $this; <add> } <add> <ide> /** <ide> * Adds a single LEFT JOIN clause to the query. <ide> * <ide><path>tests/TestCase/Database/QueryTest.php <ide> public function testDeepClone() <ide> $this->assertNotEquals($query->clause('order'), $dupe->clause('order')); <ide> } <ide> <add> /** <add> * Test removeJoin(). <add> * <add> * @return void <add> */ <add> public function testRemoveJoin() <add> { <add> $query = new Query($this->connection); <add> $query->select(['id', 'title']) <add> ->from('articles') <add> ->join(['authors' => [ <add> 'type' => 'INNER', <add> 'conditions' => ['articles.author_id = authors.id'] <add> ]]); <add> $this->assertArrayHasKey('authors', $query->join()); <add> <add> $this->assertSame($query, $query->removeJoin('authors')); <add> $this->assertArrayNotHasKey('authors', $query->join()); <add> } <add> <ide> /** <ide> * Assertion for comparing a table's contents with what is in it. <ide> *
2
Javascript
Javascript
fix wrong type check in jquery.prop
213118c81e3c441a99f2e0d3b8753538ffbc9b46
<ide><path>src/jquery/jquery.js <ide> jQuery.extend({ <ide> return value.call( elem ); <ide> <ide> // Handle passing in a number to a CSS property <del> if ( value.constructor == Number && type == "css" ) <add> if ( value.constructor == Number && type == "curCSS" ) <ide> return value + "px"; <ide> <ide> return value;
1
Ruby
Ruby
ensure postgresql previous version exists
f15f665b989aaa152e8bed11aacbdecb155021ec
<ide><path>Library/Homebrew/dev-cmd/audit.rb <ide> def audit_keg_only_style <ide> problem "keg_only reason should not end with a period." <ide> end <ide> <add> def audit_postgresql <add> return unless formula.name == "postgresql" <add> major_version = formula.version <add> .to_s <add> .split(".") <add> .first <add> .to_i <add> previous_major_version = major_version - 1 <add> previous_formula_name = "postgresql@#{previous_major_version}" <add> begin <add> Formula[previous_formula_name] <add> rescue FormulaUnavailableError <add> problem "Versioned #{previous_formula_name} must be created for " \ <add> "`brew-postgresql-upgrade-database` and `pg_upgrade` to work." <add> end <add> end <add> <ide> def audit_versioned_keg_only <ide> return unless @versioned_formula <ide> return unless @core_tap
1
Javascript
Javascript
add weakset polyfill
06c40663a22e1a225d3308fd35487b27bdeef83d
<ide><path>packages/ember-metal/lib/is_proxy.js <del>const PROXIES = new WeakMap(); <add>import WeakSet from './weak_set'; <add> <add>const PROXIES = new WeakSet(); <ide> <ide> export function isProxy(object) { <ide> return PROXIES.has(object); <ide> } <ide> <ide> export function setProxy(object) { <del> return PROXIES.set(object, true); <add> return PROXIES.add(object); <ide> } <ide><path>packages/ember-metal/lib/weak_set.js <add>const HAS_WEAK_SET = typeof WeakSet === 'function'; <add> <add>class WeakSetPolyFill { <add> constructor() { <add> this._weakmap = new WeakMap(); <add> } <add> <add> add(val) { <add> this._weakmap.set(val, true); <add> return this; <add> } <add> <add> delete(val) { <add> return this._weakmap.delete(val); <add> } <add> <add> has(val) { <add> return this._weakmap.has(val); <add> } <add>} <add> <add>export default HAS_WEAK_SET ? WeakSet : WeakSetPolyFill; // eslint-disable-line
2
PHP
PHP
remove deprecated language line
4852f483466bdc83bac132421832d3eec07bcfaf
<ide><path>resources/lang/en/passwords.php <ide> | <ide> */ <ide> <del> 'password' => 'Passwords must be at least eight characters and match the confirmation.', <ide> 'reset' => 'Your password has been reset!', <ide> 'sent' => 'We have e-mailed your password reset link!', <ide> 'token' => 'This password reset token is invalid.',
1
PHP
PHP
apply fixes from styleci
15823659f213c20b74929e88b2c57248721d180b
<ide><path>src/Illuminate/Support/HtmlString.php <ide> public function toHtml() <ide> public function isEmpty() <ide> { <ide> return empty($this->html); <del> } <add> } <ide> <ide> /** <ide> * Get the HTML string.
1
Java
Java
fix prefixresourceresolver implementation
c4843577bab0a9ebf5277853dd70a2e01dd1facd
<ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/resource/PrefixResourceResolver.java <ide> public class PrefixResourceResolver extends AbstractResourceResolver { <ide> <ide> public PrefixResourceResolver(String prefix) { <ide> Assert.hasText(prefix, "prefix must not be null or empty"); <del> this.prefix = prefix.startsWith("/") ? prefix : "/" + prefix; <add> this.prefix = prefix.startsWith("/") ? prefix.substring(1) : prefix; <ide> } <ide> <ide> @Override <ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/resource/PrefixResourceResolverTests.java <ide> public void setUp() { <ide> public void resolveResource() { <ide> String resourceId = "foo.css"; <ide> Resource expected = new ClassPathResource("test/foo.css", getClass()); <del> Resource actual = this.chain.resolveResource(null, "/" + this.shaPrefix + "/" + resourceId, this.locations); <add> Resource actual = this.chain.resolveResource(null, this.shaPrefix + "/" + resourceId, this.locations); <ide> assertEquals(expected, actual); <ide> } <ide> <ide> @Test <ide> public void resolvePublicUrlPath() { <ide> String resourceId = "/foo.css"; <del> String url = "/" + this.shaPrefix + resourceId; <add> String url = this.shaPrefix + resourceId; <ide> assertEquals(url, chain.resolvePublicUrlPath(resourceId, locations)); <ide> } <ide>
2
Ruby
Ruby
add a handful of cache store tests
e59de6046cf01852e1b16e7a6a39de94aefa7e72
<ide><path>activesupport/lib/active_support/cache.rb <add>require 'benchmark' <add> <ide> module ActiveSupport <ide> module Cache <ide> def self.lookup_store(*store_option) <ide><path>activesupport/test/caching_test.rb <ide> def test_object_assigned_fragment_cache_store <ide> assert_equal "/path/to/cache/directory", store.cache_path <ide> end <ide> end <add> <add>uses_mocha 'high-level cache store tests' do <add> class CacheStoreTest < Test::Unit::TestCase <add> def setup <add> @cache = ActiveSupport::Cache.lookup_store(:memory_store) <add> end <add> <add> def test_fetch_without_cache_miss <add> @cache.stubs(:read).with('foo', {}).returns('bar') <add> @cache.expects(:write).never <add> assert_equal 'bar', @cache.fetch('foo') { 'baz' } <add> end <add> <add> def test_fetch_with_cache_miss <add> @cache.stubs(:read).with('foo', {}).returns(nil) <add> @cache.expects(:write).with('foo', 'baz', {}) <add> assert_equal 'baz', @cache.fetch('foo') { 'baz' } <add> end <add> <add> def test_fetch_with_forced_cache_miss <add> @cache.expects(:read).never <add> @cache.expects(:write).with('foo', 'bar', :force => true) <add> @cache.fetch('foo', :force => true) { 'bar' } <add> end <add> end <add>end
2
Javascript
Javascript
ignore items outside chart area for interaction
77cfac17859c0e086dc90b4c85ac2108581d56dc
<ide><path>src/core/core.interaction.js <ide> function getNearestItems(chart, position, axis, intersect, useFinalPosition) { <ide> } <ide> <ide> const center = element.getCenterPoint(useFinalPosition); <add> if (!_isPointInArea(center, chart.chartArea, chart._minPadding)) { <add> return; <add> } <ide> const distance = distanceMetric(position, center); <ide> if (distance < minDistance) { <ide> items = [{element, datasetIndex, index}];
1
Javascript
Javascript
fix react warnings
84df87ef64b97ede858931437ee22a660ab8b412
<ide><path>Libraries/Components/Touchable/TouchableNativeFeedback.android.js <ide> var processColor = require('processColor'); <ide> <ide> var rippleBackgroundPropType = createStrictShapeTypeChecker({ <ide> type: React.PropTypes.oneOf(['RippleAndroid']), <del> color: PropTypes.string, <add> color: PropTypes.number, <ide> borderless: PropTypes.bool, <ide> }); <ide>
1
Python
Python
fix comment with path of export_tfhub_lib_test.py
52531231b59559c247a87832ad3003aa046ce027
<ide><path>official/nlp/modeling/layers/text_layers_test.py <ide> def test_input(start, lengths): <ide> <ide> # This test covers the in-process behavior of a BertTokenizer layer. <ide> # For saving, restoring, and the restored behavior (incl. shape inference), <del># see export_tfub_test.py. <add># see nlp/tools/export_tfhub_lib_test.py. <ide> class BertTokenizerTest(tf.test.TestCase): <ide> <ide> def _make_vocab_file(self, vocab, filename="vocab.txt"):
1
Text
Text
add docs for building with rollup
e69ff955f4960d4192107437f000e6bc08ffb804
<ide><path>docs/docs/installation.md <ide> If you use [Create React App](https://github.com/facebookincubator/create-react- <ide> <ide> #### Webpack <ide> <del>-Include both `DefinePlugin` and `UglifyJsPlugin` into your production Webpack configuration as described in [this guide](https://webpack.js.org/guides/production-build/). <add>Include both `DefinePlugin` and `UglifyJsPlugin` into your production Webpack configuration as described in [this guide](https://webpack.js.org/guides/production-build/). <ide> <ide> > **Note:** <ide> > <ide> If you use [Create React App](https://github.com/facebookincubator/create-react- <ide> <ide> Run Browserify with `NODE_ENV` environment variable set to `production` and use [UglifyJS](https://github.com/mishoo/UglifyJS) as the last build step so that development-only code gets stripped out. <ide> <add>#### Rollup <add> <add>Use [rollup-plugin-replace](https://github.com/rollup/rollup-plugin-replace) plugin together with [rollup-plugin-commonjs](https://github.com/rollup/rollup-plugin-commonjs) (in that order) to remove development-only code. [See this gist](https://gist.github.com/Rich-Harris/cb14f4bc0670c47d00d191565be36bf0) for a complete setup example. <add> <ide> ### Using a CDN <ide> <ide> If you don't want to use npm to manage client packages, the `react` and `react-dom` npm packages also provide single-file distributions in `dist` folders, which are hosted on a CDN: <ide><path>docs/docs/optimizing-performance.md <ide> new webpack.DefinePlugin({ <ide> new webpack.optimize.UglifyJsPlugin() <ide> ``` <ide> <add>* For Rollup, you need to use the [replace](https://github.com/rollup/rollup-plugin-replace) plugin *before* the [commonjs](https://github.com/rollup/rollup-plugin-commonjs) plugin so that development-only modules are not imported. For a complete setup example [see this gist](https://gist.github.com/Rich-Harris/cb14f4bc0670c47d00d191565be36bf0). <add> <add>```js <add>plugins: [ <add> require('rollup-plugin-replace')({ <add> 'process.env.NODE_ENV': JSON.stringify('production') <add> }), <add> require('rollup-plugin-commonjs')(), <add> // ... <add>] <add>``` <add> <ide> The development build includes extra warnings that are helpful when building your apps, but it is slower due to the extra bookkeeping it does. <ide> <ide> ## Profiling Components with Chrome Timeline
2
Text
Text
fix demo for angular v8+.
8f930c5857e10974b4578e489c63bf7fb322a236
<ide><path>docs/guides/angular.md <ide> import videojs from 'video.js'; <ide> encapsulation: ViewEncapsulation.None, <ide> }) <ide> export class VjsPlayerComponent implements OnInit, OnDestroy { <del> @ViewChild('target') target: ElementRef; <add> @ViewChild('target', {static: true}) target: ElementRef; <ide> // see options: https://github.com/videojs/video.js/blob/master/docs/guides/options.md <ide> @Input() options: { <ide> fluid: boolean,
1
PHP
PHP
add tests for other ru plural rules
ed09383e6d7721375aee5a68156518759709f6c2
<ide><path>tests/TestCase/I18n/PluralRulesTest.php <ide> public function localesProvider() <ide> ['ru', 0, 2], <ide> ['ru', 1, 0], <ide> ['ru', 2, 1], <add> ['ru', 21, 0], <add> ['ru', 22, 1], <add> ['ru', 5, 2], <add> ['ru', 7, 2], <ide> ['sk', 0, 2], <ide> ['sk', 1, 0], <ide> ['sk', 2, 1],
1
Python
Python
fix filename conversion for conllu
eca41f0cf6c8773813fc7e73096881d3eef38850
<ide><path>spacy/cli/converters/conllu2json.py <ide> def conllu2json(input_path, output_path, n_sents=10, use_morphology=False): <ide> docs.append(doc) <ide> sentences = [] <ide> <add> output_filename = input_path.parts[-1].replace(".conll", ".json") <ide> output_filename = input_path.parts[-1].replace(".conllu", ".json") <del> output_filename = output_filename.parts[-1].replace(".conll", ".json") <ide> output_file = output_path / output_filename <ide> with output_file.open('w', encoding='utf-8') as f: <ide> f.write(json_dumps(docs))
1
Javascript
Javascript
add $name property
e0198c1cda768e8711fc182b4f42643ba11cad04
<ide><path>src/ng/directive/input.js <ide> var VALID_CLASS = 'ng-valid', <ide> * @property {boolean} $dirty True if user has already interacted with the control. <ide> * @property {boolean} $valid True if there is no error. <ide> * @property {boolean} $invalid True if at least one error on the control. <add> * @property {string} $name The name attribute of the control. <ide> * <ide> * @description <ide> *
1
PHP
PHP
add custom message to response code assertions
4acf17fbae95ff55e8cb7d946fd8c43f1690f508
<ide><path>src/TestSuite/IntegrationTestCase.php <ide> public function viewVariable($name) <ide> * <ide> * @return void <ide> */ <del> public function assertResponseOk() <add> public function assertResponseOk($message) <ide> { <del> $this->_assertStatus(200, 204, 'Status code is not between 200 and 204'); <add> if (empty($message)) { <add> $message = 'Status code is not between 200 and 204'; <add> } <add> $this->_assertStatus(200, 204, $message); <ide> } <ide> <ide> /** <ide> * Asserts that the response status code is in the 2xx/3xx range. <ide> * <ide> * @return void <ide> */ <del> public function assertResponseSuccess() <add> public function assertResponseSuccess($message) <ide> { <del> $this->_assertStatus(200, 308, 'Status code is not between 200 and 308'); <add> if (empty($message)) { <add> $message = 'Status code is not between 200 and 308'; <add> } <add> $this->_assertStatus(200, 308, $message); <ide> } <ide> <ide> /** <ide> * Asserts that the response status code is in the 4xx range. <ide> * <ide> * @return void <ide> */ <del> public function assertResponseError() <add> public function assertResponseError($message) <ide> { <del> $this->_assertStatus(400, 429, 'Status code is not between 400 and 429'); <add> if (empty($message)) { <add> $message = 'Status code is not between 400 and 429'; <add> } <add> $this->_assertStatus(400, 429, $message); <ide> } <ide> <ide> /** <ide> * Asserts that the response status code is in the 5xx range. <ide> * <ide> * @return void <ide> */ <del> public function assertResponseFailure() <add> public function assertResponseFailure($message) <ide> { <del> $this->_assertStatus(500, 505, 'Status code is not between 500 and 505'); <add> if (empty($message)) { <add> $message = 'Status code is not between 500 and 505'; <add> } <add> $this->_assertStatus(500, 505, $message); <ide> } <ide> <ide> /** <ide> public function assertResponseFailure() <ide> * @param int $code Status code to assert. <ide> * @return void <ide> */ <del> public function assertResponseCode($code) <add> public function assertResponseCode($code, $message) <ide> { <ide> $actual = $this->_response->getStatusCode(); <del> $this->_assertStatus($code, $code, 'Status code is not ' . $code . ' but ' . $actual); <add> <add> if (empty($message)) { <add> $message = 'Status code is not ' . $code . ' but ' . $actual; <add> } <add> <add> $this->_assertStatus($code, $code, $message); <ide> } <ide> <ide> /**
1
Text
Text
use appropriate `classname` attribute for jsx
1cd34dd640f868b405a834e6e1755711c2cfcd33
<ide><path>errors/next-script-for-ga.md <ide> import Script from 'next/script' <ide> <ide> function Home() { <ide> return ( <del> <div class="container"> <add> <div className="container"> <ide> <!-- Global site tag (gtag.js) - Google Analytics --> <ide> <Script <ide> src="https://www.googletagmanager.com/gtag/js?id=GA_MEASUREMENT_ID" <ide> import Script from 'next/script' <ide> <ide> function Home() { <ide> return ( <del> <div class="container"> <add> <div className="container"> <ide> <Script id="google-analytics" strategy="afterInteractive"> <ide> {` <ide> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ <ide> import Script from 'next/script' <ide> <ide> function Home() { <ide> return ( <del> <div class="container"> <add> <div className="container"> <ide> <Script id="google-analytics" strategy="afterInteractive"> <ide> {` <ide> window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
1
Text
Text
fix typo in transformer docs
165993d8e57f2bd0ea35f4792f414951dc6c4787
<ide><path>website/docs/api/transformer.md <ide> on the transformer architectures and their arguments and hyperparameters. <ide> > nlp.add_pipe("transformer", config=DEFAULT_CONFIG) <ide> > ``` <ide> <del>| Setting | Description | <del>| ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | <del>| `max_batch_items` | Maximum size of a padded batch. Defaults to `4096`. ~~int~~ | <del>| `set_extra_annotations` | Function that takes a batch of `Doc` objects and transformer outputs to set additional annotations on the `Doc`. The `Doc._.transformer_data` attribute is set prior to calling the callback. Defaults to `null_annotation_setter` (no additional annotations). ~~Callable[[List[Doc], FullTransformerBatch], None]~~ | <del>| `model` | The Thinc [`Model`](https://thinc.ai/docs/api-model) wrapping the transformer. Defaults to [TransformerModel](/api/architectures#TransformerModel). ~~Model[List[Doc], FullTransformerBatch]~~ | <add>| Setting | Description | <add>| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | <add>| `max_batch_items` | Maximum size of a padded batch. Defaults to `4096`. ~~int~~ | <add>| `set_extra_annotations` | Function that takes a batch of `Doc` objects and transformer outputs to set additional annotations on the `Doc`. The `Doc._.trf_data` attribute is set prior to calling the callback. Defaults to `null_annotation_setter` (no additional annotations). ~~Callable[[List[Doc], FullTransformerBatch], None]~~ | <add>| `model` | The Thinc [`Model`](https://thinc.ai/docs/api-model) wrapping the transformer. Defaults to [TransformerModel](/api/architectures#TransformerModel). ~~Model[List[Doc], FullTransformerBatch]~~ | <ide> <ide> ```python <ide> https://github.com/explosion/spacy-transformers/blob/master/spacy_transformers/pipeline_component.py
1
Python
Python
fix e302 flake8 warning (x3)
eed46f38b77b83cdd3df4c20a1a12e1d20a31dac
<ide><path>templates/adding_a_new_model/modeling_tf_xxx.py <ide> "xxx-large-uncased": "https://s3.amazonaws.com/models.huggingface.co/bert/xxx-large-uncased-tf_model.h5", <ide> } <ide> <add> <ide> #################################################### <ide> # TF 2.0 Models are constructed using Keras imperative API by sub-classing <ide> # - tf.keras.layers.Layer for the layers and <ide><path>templates/adding_a_new_model/modeling_xxx.py <ide> "xxx-large-uncased": "https://s3.amazonaws.com/models.huggingface.co/bert/xxx-large-uncased-pytorch_model.bin", <ide> } <ide> <add> <ide> #################################################### <ide> # This is a conversion method from TF 1.0 to PyTorch <ide> # More details: https://medium.com/huggingface/from-tensorflow-to-pytorch-265f40ef2a28 <ide><path>transformers/modeling_t5.py <ide> "t5-11b": "https://s3.amazonaws.com/models.huggingface.co/bert/t5-11b-pytorch_model.bin", <ide> } <ide> <add> <ide> #################################################### <ide> # This is a conversion method from TF 1.0 to PyTorch <ide> # More details: https://medium.com/huggingface/from-tensorflow-to-pytorch-265f40ef2a28
3
Javascript
Javascript
remove redundant assignment in url.parse
4bd3620382a200736342b6c2adf12a3477e1d41f
<ide><path>lib/url.js <ide> Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) { <ide> var p = this.port ? ':' + this.port : ''; <ide> var h = this.hostname || ''; <ide> this.host = h + p; <del> this.href += this.host; <ide> <ide> // strip [ and ] from the hostname <ide> // the host field still retains them, though
1
Javascript
Javascript
initialize tcpwrap when receiving socket
0d7a0216dc8e0d79bdc32aa7c48097bebfcba8eb
<ide><path>lib/net.js <ide> function Socket(options) { <ide> stream.Duplex.call(this, options); <ide> <ide> if (options.handle) { <add> // Initialize TCPWrap and PipeWrap <add> process.binding('tcp_wrap'); <add> process.binding('pipe_wrap'); <add> <ide> this._handle = options.handle; // private <ide> } else if (typeof options.fd !== 'undefined') { <ide> this._handle = createPipe(); <ide><path>test/simple/test-cluster-net-send.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <add>var common = require('../common'); <add>var assert = require('assert'); <add>var fork = require('child_process').fork; <add>var net = require('net'); <add> <add>if (process.argv[2] !== 'child') { <add> console.error('[%d] master', process.pid); <add> <add> var worker = fork(__filename, ['child']); <add> var called = false; <add> <add> worker.once('message', function(msg, handle) { <add> assert.equal(msg, 'handle'); <add> assert.ok(handle); <add> worker.send('got'); <add> <add> handle.on('data', function(data) { <add> called = true; <add> assert.equal(data.toString(), 'hello'); <add> worker.kill(); <add> }); <add> }); <add> <add> process.once('exit', function() { <add> assert.ok(called); <add> }); <add>} else { <add> console.error('[%d] worker', process.pid); <add> <add> var server = net.createServer(function(c) { <add> process.once('message', function(msg) { <add> assert.equal(msg, 'got'); <add> c.end('hello'); <add> }); <add> }); <add> server.listen(common.PORT, function() { <add> var socket = net.connect(common.PORT, '127.0.0.1', function() { <add> process.send('handle', socket); <add> }); <add> }); <add> <add> process.on('disconnect', function() { <add> process.exit(); <add> server.close(); <add> }); <add>}
2
Python
Python
fix documentation misstatement
88da562d1c02b2c1803b4bfb3fc81ba1470e0d5c
<ide><path>numpy/core/tests/test_regression.py <ide> def test_string_truncation(self): <ide> <ide> def test_string_truncation_ucs2(self): <ide> # Ticket #2081. Python compiled with two byte unicode <del> # can lead to truncation if numpy itemsize is adjusted <del> # for 4 byte unicode. <add> # can lead to truncation if itemsize is not properly <add> # adjusted for Numpy's four byte unicode. <ide> if sys.version_info[0] >= 3: <ide> a = np.array(['abcd']) <ide> else:
1
Java
Java
add tryonerror to create/xemitter api
8bf04e968584ed49139af9f81854ae28b225e0b0
<ide><path>src/main/java/io/reactivex/CompletableEmitter.java <ide> public interface CompletableEmitter { <ide> * @return true if the downstream disposed the sequence <ide> */ <ide> boolean isDisposed(); <add> <add> /** <add> * Attempts to emit the specified {@code Throwable} error if the downstream <add> * hasn't cancelled the sequence or is otherwise terminated, returning false <add> * if the emission is not allowed to happen due to lifecycle restrictions. <add> * <p> <add> * Unlike {@link #onError(Throwable)}, the {@code RxJavaPlugins.onError} is not called <add> * if the error could not be delivered. <add> * @param t the throwable error to signal if possible <add> * @return true if successful, false if the downstream is not able to accept further <add> * events <add> * @since 2.1.1 - experimental <add> */ <add> @Experimental <add> boolean tryOnError(@NonNull Throwable t); <ide> } <ide><path>src/main/java/io/reactivex/FlowableEmitter.java <ide> */ <ide> @NonNull <ide> FlowableEmitter<T> serialize(); <add> <add> /** <add> * Attempts to emit the specified {@code Throwable} error if the downstream <add> * hasn't cancelled the sequence or is otherwise terminated, returning false <add> * if the emission is not allowed to happen due to lifecycle restrictions. <add> * <p> <add> * Unlike {@link #onError(Throwable)}, the {@code RxJavaPlugins.onError} is not called <add> * if the error could not be delivered. <add> * @param t the throwable error to signal if possible <add> * @return true if successful, false if the downstream is not able to accept further <add> * events <add> * @since 2.1.1 - experimental <add> */ <add> @Experimental <add> boolean tryOnError(@NonNull Throwable t); <ide> } <ide><path>src/main/java/io/reactivex/MaybeEmitter.java <ide> * @return true if the downstream cancelled the sequence <ide> */ <ide> boolean isDisposed(); <add> <add> /** <add> * Attempts to emit the specified {@code Throwable} error if the downstream <add> * hasn't cancelled the sequence or is otherwise terminated, returning false <add> * if the emission is not allowed to happen due to lifecycle restrictions. <add> * <p> <add> * Unlike {@link #onError(Throwable)}, the {@code RxJavaPlugins.onError} is not called <add> * if the error could not be delivered. <add> * @param t the throwable error to signal if possible <add> * @return true if successful, false if the downstream is not able to accept further <add> * events <add> * @since 2.1.1 - experimental <add> */ <add> @Experimental <add> boolean tryOnError(@NonNull Throwable t); <ide> } <ide><path>src/main/java/io/reactivex/ObservableEmitter.java <ide> */ <ide> @NonNull <ide> ObservableEmitter<T> serialize(); <add> <add> /** <add> * Attempts to emit the specified {@code Throwable} error if the downstream <add> * hasn't cancelled the sequence or is otherwise terminated, returning false <add> * if the emission is not allowed to happen due to lifecycle restrictions. <add> * <p> <add> * Unlike {@link #onError(Throwable)}, the {@code RxJavaPlugins.onError} is not called <add> * if the error could not be delivered. <add> * @param t the throwable error to signal if possible <add> * @return true if successful, false if the downstream is not able to accept further <add> * events <add> * @since 2.1.1 - experimental <add> */ <add> @Experimental <add> boolean tryOnError(@NonNull Throwable t); <ide> } <ide><path>src/main/java/io/reactivex/SingleEmitter.java <ide> * @return true if the downstream cancelled the sequence <ide> */ <ide> boolean isDisposed(); <add> <add> /** <add> * Attempts to emit the specified {@code Throwable} error if the downstream <add> * hasn't cancelled the sequence or is otherwise terminated, returning false <add> * if the emission is not allowed to happen due to lifecycle restrictions. <add> * <p> <add> * Unlike {@link #onError(Throwable)}, the {@code RxJavaPlugins.onError} is not called <add> * if the error could not be delivered. <add> * @param t the throwable error to signal if possible <add> * @return true if successful, false if the downstream is not able to accept further <add> * events <add> * @since 2.1.1 - experimental <add> */ <add> @Experimental <add> boolean tryOnError(@NonNull Throwable t); <ide> } <ide><path>src/main/java/io/reactivex/internal/operators/completable/CompletableCreate.java <ide> public void onComplete() { <ide> <ide> @Override <ide> public void onError(Throwable t) { <add> if (!tryOnError(t)) { <add> RxJavaPlugins.onError(t); <add> } <add> } <add> <add> @Override <add> public boolean tryOnError(Throwable t) { <ide> if (t == null) { <ide> t = new NullPointerException("onError called with null. Null values are generally not allowed in 2.x operators and sources."); <ide> } <ide> public void onError(Throwable t) { <ide> d.dispose(); <ide> } <ide> } <del> return; <add> return true; <ide> } <ide> } <del> RxJavaPlugins.onError(t); <add> return false; <ide> } <ide> <ide> @Override <ide><path>src/main/java/io/reactivex/internal/operators/flowable/FlowableCreate.java <ide> public void onNext(T t) { <ide> <ide> @Override <ide> public void onError(Throwable t) { <del> if (emitter.isCancelled() || done) { <del> RxJavaPlugins.onError(t); <del> return; <del> } <del> if (t == null) { <del> t = new NullPointerException("onError called with null. Null values are generally not allowed in 2.x operators and sources."); <del> } <del> if (error.addThrowable(t)) { <del> done = true; <del> drain(); <del> } else { <add> if (!tryOnError(t)) { <ide> RxJavaPlugins.onError(t); <ide> } <ide> } <ide> <add> @Override <add> public boolean tryOnError(Throwable t) { <add> if (emitter.isCancelled() || done) { <add> return false; <add> } <add> if (t == null) { <add> t = new NullPointerException("onError called with null. Null values are generally not allowed in 2.x operators and sources."); <add> } <add> if (error.addThrowable(t)) { <add> done = true; <add> drain(); <add> return true; <add> } <add> return false; <add> } <add> <ide> @Override <ide> public void onComplete() { <ide> if (emitter.isCancelled() || done) { <ide> public FlowableEmitter<T> serialize() { <ide> <ide> @Override <ide> public void onComplete() { <add> complete(); <add> } <add> <add> protected void complete() { <ide> if (isCancelled()) { <ide> return; <ide> } <ide> public void onComplete() { <ide> } <ide> <ide> @Override <del> public void onError(Throwable e) { <add> public final void onError(Throwable e) { <add> if (!tryOnError(e)) { <add> RxJavaPlugins.onError(e); <add> } <add> } <add> <add> @Override <add> public boolean tryOnError(Throwable e) { <add> return error(e); <add> } <add> <add> protected boolean error(Throwable e) { <ide> if (e == null) { <ide> e = new NullPointerException("onError called with null. Null values are generally not allowed in 2.x operators and sources."); <ide> } <ide> if (isCancelled()) { <del> RxJavaPlugins.onError(e); <del> return; <add> return false; <ide> } <ide> try { <ide> actual.onError(e); <ide> } finally { <ide> serial.dispose(); <ide> } <add> return true; <ide> } <ide> <ide> @Override <ide> public void onNext(T t) { <ide> } <ide> <ide> @Override <del> public void onError(Throwable e) { <add> public boolean tryOnError(Throwable e) { <ide> if (done || isCancelled()) { <del> RxJavaPlugins.onError(e); <del> return; <add> return false; <ide> } <ide> <ide> if (e == null) { <ide> public void onError(Throwable e) { <ide> error = e; <ide> done = true; <ide> drain(); <add> return true; <ide> } <ide> <ide> @Override <ide> void drain() { <ide> if (d && empty) { <ide> Throwable ex = error; <ide> if (ex != null) { <del> super.onError(ex); <add> error(ex); <ide> } else { <del> super.onComplete(); <add> complete(); <ide> } <ide> return; <ide> } <ide> void drain() { <ide> if (d && empty) { <ide> Throwable ex = error; <ide> if (ex != null) { <del> super.onError(ex); <add> error(ex); <ide> } else { <del> super.onComplete(); <add> complete(); <ide> } <ide> return; <ide> } <ide> public void onNext(T t) { <ide> } <ide> <ide> @Override <del> public void onError(Throwable e) { <add> public boolean tryOnError(Throwable e) { <ide> if (done || isCancelled()) { <del> RxJavaPlugins.onError(e); <del> return; <add> return false; <ide> } <ide> if (e == null) { <ide> onError(new NullPointerException("onError called with null. Null values are generally not allowed in 2.x operators and sources.")); <ide> } <ide> error = e; <ide> done = true; <ide> drain(); <add> return true; <ide> } <ide> <ide> @Override <ide> void drain() { <ide> if (d && empty) { <ide> Throwable ex = error; <ide> if (ex != null) { <del> super.onError(ex); <add> error(ex); <ide> } else { <del> super.onComplete(); <add> complete(); <ide> } <ide> return; <ide> } <ide> void drain() { <ide> if (d && empty) { <ide> Throwable ex = error; <ide> if (ex != null) { <del> super.onError(ex); <add> error(ex); <ide> } else { <del> super.onComplete(); <add> complete(); <ide> } <ide> return; <ide> } <ide><path>src/main/java/io/reactivex/internal/operators/maybe/MaybeCreate.java <ide> public void onSuccess(T value) { <ide> <ide> @Override <ide> public void onError(Throwable t) { <add> if (!tryOnError(t)) { <add> RxJavaPlugins.onError(t); <add> } <add> } <add> <add> @Override <add> public boolean tryOnError(Throwable t) { <ide> if (t == null) { <ide> t = new NullPointerException("onError called with null. Null values are generally not allowed in 2.x operators and sources."); <ide> } <ide> public void onError(Throwable t) { <ide> d.dispose(); <ide> } <ide> } <del> return; <add> return true; <ide> } <ide> } <del> RxJavaPlugins.onError(t); <add> return false; <ide> } <ide> <ide> @Override <ide><path>src/main/java/io/reactivex/internal/operators/observable/ObservableCreate.java <ide> public void onNext(T t) { <ide> <ide> @Override <ide> public void onError(Throwable t) { <add> if (!tryOnError(t)) { <add> RxJavaPlugins.onError(t); <add> } <add> } <add> <add> @Override <add> public boolean tryOnError(Throwable t) { <ide> if (t == null) { <ide> t = new NullPointerException("onError called with null. Null values are generally not allowed in 2.x operators and sources."); <ide> } <ide> public void onError(Throwable t) { <ide> } finally { <ide> dispose(); <ide> } <del> } else { <del> RxJavaPlugins.onError(t); <add> return true; <ide> } <add> return false; <ide> } <ide> <ide> @Override <ide> public void onNext(T t) { <ide> <ide> @Override <ide> public void onError(Throwable t) { <del> if (emitter.isDisposed() || done) { <add> if (!tryOnError(t)) { <ide> RxJavaPlugins.onError(t); <del> return; <add> } <add> } <add> <add> @Override <add> public boolean tryOnError(Throwable t) { <add> if (emitter.isDisposed() || done) { <add> return false; <ide> } <ide> if (t == null) { <ide> t = new NullPointerException("onError called with null. Null values are generally not allowed in 2.x operators and sources."); <ide> } <ide> if (error.addThrowable(t)) { <ide> done = true; <ide> drain(); <del> } else { <del> RxJavaPlugins.onError(t); <add> return true; <ide> } <add> return false; <ide> } <ide> <ide> @Override <ide><path>src/main/java/io/reactivex/internal/operators/single/SingleCreate.java <ide> public void onSuccess(T value) { <ide> <ide> @Override <ide> public void onError(Throwable t) { <add> if (!tryOnError(t)) { <add> RxJavaPlugins.onError(t); <add> } <add> } <add> <add> @Override <add> public boolean tryOnError(Throwable t) { <ide> if (t == null) { <ide> t = new NullPointerException("onError called with null. Null values are generally not allowed in 2.x operators and sources."); <ide> } <ide> public void onError(Throwable t) { <ide> d.dispose(); <ide> } <ide> } <del> return; <add> return true; <ide> } <ide> } <del> RxJavaPlugins.onError(t); <add> return false; <ide> } <ide> <ide> @Override <ide><path>src/test/java/io/reactivex/internal/operators/completable/CompletableCreateTest.java <ide> import static org.junit.Assert.*; <ide> <ide> import java.io.IOException; <add>import java.util.List; <ide> <ide> import org.junit.Test; <ide> <ide> import io.reactivex.*; <ide> import io.reactivex.disposables.*; <ide> import io.reactivex.exceptions.TestException; <ide> import io.reactivex.functions.Cancellable; <add>import io.reactivex.plugins.RxJavaPlugins; <ide> <ide> public class CompletableCreateTest { <ide> <ide> public void onComplete() { <ide> } <ide> }); <ide> } <add> <add> @Test <add> public void tryOnError() { <add> List<Throwable> errors = TestHelper.trackPluginErrors(); <add> try { <add> final Boolean[] response = { null }; <add> Completable.create(new CompletableOnSubscribe() { <add> @Override <add> public void subscribe(CompletableEmitter e) throws Exception { <add> e.onComplete(); <add> response[0] = e.tryOnError(new TestException()); <add> } <add> }) <add> .test() <add> .assertResult(); <add> <add> assertFalse(response[0]); <add> <add> assertTrue(errors.toString(), errors.isEmpty()); <add> } finally { <add> RxJavaPlugins.reset(); <add> } <add> } <ide> } <ide><path>src/test/java/io/reactivex/internal/operators/flowable/FlowableCreateTest.java <ide> public void cancel() throws Exception { <ide> } <ide> } <ide> <add> <add> @Test <add> public void tryOnError() { <add> for (BackpressureStrategy strategy : BackpressureStrategy.values()) { <add> List<Throwable> errors = TestHelper.trackPluginErrors(); <add> try { <add> final Boolean[] response = { null }; <add> Flowable.create(new FlowableOnSubscribe<Object>() { <add> @Override <add> public void subscribe(FlowableEmitter<Object> e) throws Exception { <add> e.onNext(1); <add> response[0] = e.tryOnError(new TestException()); <add> } <add> }, strategy) <add> .take(1) <add> .test() <add> .withTag(strategy.toString()) <add> .assertResult(1); <add> <add> assertFalse(response[0]); <add> <add> assertTrue(strategy + ": " + errors.toString(), errors.isEmpty()); <add> } finally { <add> RxJavaPlugins.reset(); <add> } <add> } <add> } <add> <add> @Test <add> public void tryOnErrorSerialized() { <add> for (BackpressureStrategy strategy : BackpressureStrategy.values()) { <add> List<Throwable> errors = TestHelper.trackPluginErrors(); <add> try { <add> final Boolean[] response = { null }; <add> Flowable.create(new FlowableOnSubscribe<Object>() { <add> @Override <add> public void subscribe(FlowableEmitter<Object> e) throws Exception { <add> e = e.serialize(); <add> e.onNext(1); <add> response[0] = e.tryOnError(new TestException()); <add> } <add> }, strategy) <add> .take(1) <add> .test() <add> .withTag(strategy.toString()) <add> .assertResult(1); <add> <add> assertFalse(response[0]); <add> <add> assertTrue(strategy + ": " + errors.toString(), errors.isEmpty()); <add> } finally { <add> RxJavaPlugins.reset(); <add> } <add> } <add> } <ide> } <ide><path>src/test/java/io/reactivex/internal/operators/maybe/MaybeCreateTest.java <ide> import static org.junit.Assert.*; <ide> <ide> import java.io.IOException; <add>import java.util.List; <ide> <ide> import org.junit.Test; <ide> <ide> import io.reactivex.*; <ide> import io.reactivex.disposables.*; <ide> import io.reactivex.exceptions.TestException; <add>import io.reactivex.plugins.RxJavaPlugins; <ide> <ide> public class MaybeCreateTest { <ide> <ide> public void onComplete() { <ide> } <ide> }); <ide> } <add> <add> @Test <add> public void tryOnError() { <add> List<Throwable> errors = TestHelper.trackPluginErrors(); <add> try { <add> final Boolean[] response = { null }; <add> Maybe.create(new MaybeOnSubscribe<Object>() { <add> @Override <add> public void subscribe(MaybeEmitter<Object> e) throws Exception { <add> e.onSuccess(1); <add> response[0] = e.tryOnError(new TestException()); <add> } <add> }) <add> .test() <add> .assertResult(1); <add> <add> assertFalse(response[0]); <add> <add> assertTrue(errors.toString(), errors.isEmpty()); <add> } finally { <add> RxJavaPlugins.reset(); <add> } <add> } <ide> } <ide><path>src/test/java/io/reactivex/internal/operators/observable/ObservableCreateTest.java <ide> public void run() { <ide> .assertResult(); <ide> } <ide> } <add> <add> @Test <add> public void tryOnError() { <add> List<Throwable> errors = TestHelper.trackPluginErrors(); <add> try { <add> final Boolean[] response = { null }; <add> Observable.create(new ObservableOnSubscribe<Object>() { <add> @Override <add> public void subscribe(ObservableEmitter<Object> e) throws Exception { <add> e.onNext(1); <add> response[0] = e.tryOnError(new TestException()); <add> } <add> }) <add> .take(1) <add> .test() <add> .assertResult(1); <add> <add> assertFalse(response[0]); <add> <add> assertTrue(errors.toString(), errors.isEmpty()); <add> } finally { <add> RxJavaPlugins.reset(); <add> } <add> } <add> <add> @Test <add> public void tryOnErrorSerialized() { <add> List<Throwable> errors = TestHelper.trackPluginErrors(); <add> try { <add> final Boolean[] response = { null }; <add> Observable.create(new ObservableOnSubscribe<Object>() { <add> @Override <add> public void subscribe(ObservableEmitter<Object> e) throws Exception { <add> e = e.serialize(); <add> e.onNext(1); <add> response[0] = e.tryOnError(new TestException()); <add> } <add> }) <add> .take(1) <add> .test() <add> .assertResult(1); <add> <add> assertFalse(response[0]); <add> <add> assertTrue(errors.toString(), errors.isEmpty()); <add> } finally { <add> RxJavaPlugins.reset(); <add> } <add> } <ide> } <ide><path>src/test/java/io/reactivex/internal/operators/single/SingleCreateTest.java <ide> import static org.junit.Assert.*; <ide> <ide> import java.io.IOException; <add>import java.util.List; <ide> <ide> import org.junit.Test; <ide> <ide> import io.reactivex.*; <ide> import io.reactivex.disposables.*; <ide> import io.reactivex.exceptions.TestException; <ide> import io.reactivex.functions.Cancellable; <add>import io.reactivex.plugins.RxJavaPlugins; <ide> <ide> public class SingleCreateTest { <ide> <ide> public void onError(Throwable e) { <ide> } <ide> }); <ide> } <add> <add> @Test <add> public void tryOnError() { <add> List<Throwable> errors = TestHelper.trackPluginErrors(); <add> try { <add> final Boolean[] response = { null }; <add> Single.create(new SingleOnSubscribe<Object>() { <add> @Override <add> public void subscribe(SingleEmitter<Object> e) throws Exception { <add> e.onSuccess(1); <add> response[0] = e.tryOnError(new TestException()); <add> } <add> }) <add> .test() <add> .assertResult(1); <add> <add> assertFalse(response[0]); <add> <add> assertTrue(errors.toString(), errors.isEmpty()); <add> } finally { <add> RxJavaPlugins.reset(); <add> } <add> } <ide> }
15
Go
Go
remove job from image_export
2a14b7dd35901167d83735a25ff626596391c4ed
<ide><path>api/server/server.go <ide> func (s *Server) getImagesGet(eng *engine.Engine, version version.Version, w htt <ide> if err := parseForm(r); err != nil { <ide> return err <ide> } <del> if version.GreaterThan("1.0") { <add> <add> useJSON := version.GreaterThan("1.0") <add> if useJSON { <ide> w.Header().Set("Content-Type", "application/x-tar") <ide> } <del> var job *engine.Job <add> <add> output := utils.NewWriteFlusher(w) <add> imageExportConfig := &graph.ImageExportConfig{ <add> Engine: eng, <add> Outstream: output, <add> } <ide> if name, ok := vars["name"]; ok { <del> job = eng.Job("image_export", name) <add> imageExportConfig.Names = []string{name} <ide> } else { <del> job = eng.Job("image_export", r.Form["names"]...) <add> imageExportConfig.Names = r.Form["names"] <ide> } <del> job.Stdout.Add(w) <del> return job.Run() <add> <add> if err := s.daemon.Repositories().ImageExport(imageExportConfig); err != nil { <add> if !output.Flushed() { <add> return err <add> } <add> sf := streamformatter.NewStreamFormatter(useJSON) <add> output.Write(sf.FormatError(err)) <add> } <add> return nil <add> <ide> } <ide> <ide> func (s *Server) postImagesLoad(eng *engine.Engine, version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error { <ide><path>graph/export.go <ide> package graph <ide> <ide> import ( <ide> "encoding/json" <del> "fmt" <ide> "io" <ide> "io/ioutil" <ide> "os" <ide> import ( <ide> // uncompressed tar ball. <ide> // name is the set of tags to export. <ide> // out is the writer where the images are written to. <del>func (s *TagStore) CmdImageExport(job *engine.Job) error { <del> if len(job.Args) < 1 { <del> return fmt.Errorf("Usage: %s IMAGE [IMAGE...]\n", job.Name) <del> } <add>type ImageExportConfig struct { <add> Names []string <add> Outstream io.Writer <add> Engine *engine.Engine <add>} <add> <add>func (s *TagStore) ImageExport(imageExportConfig *ImageExportConfig) error { <add> <ide> // get image json <ide> tempdir, err := ioutil.TempDir("", "docker-export-") <ide> if err != nil { <ide> func (s *TagStore) CmdImageExport(job *engine.Job) error { <ide> repo[tag] = id <ide> } <ide> } <del> for _, name := range job.Args { <add> for _, name := range imageExportConfig.Names { <ide> name = registry.NormalizeLocalName(name) <ide> logrus.Debugf("Serializing %s", name) <ide> rootRepo := s.Repositories[name] <ide> if rootRepo != nil { <ide> // this is a base repo name, like 'busybox' <ide> for tag, id := range rootRepo { <ide> addKey(name, tag, id) <del> if err := s.exportImage(job.Eng, id, tempdir); err != nil { <add> if err := s.exportImage(imageExportConfig.Engine, id, tempdir); err != nil { <ide> return err <ide> } <ide> } <ide> func (s *TagStore) CmdImageExport(job *engine.Job) error { <ide> if len(repoTag) > 0 { <ide> addKey(repoName, repoTag, img.ID) <ide> } <del> if err := s.exportImage(job.Eng, img.ID, tempdir); err != nil { <add> if err := s.exportImage(imageExportConfig.Engine, img.ID, tempdir); err != nil { <ide> return err <ide> } <ide> <ide> } else { <ide> // this must be an ID that didn't get looked up just right? <del> if err := s.exportImage(job.Eng, name, tempdir); err != nil { <add> if err := s.exportImage(imageExportConfig.Engine, name, tempdir); err != nil { <ide> return err <ide> } <ide> } <ide> func (s *TagStore) CmdImageExport(job *engine.Job) error { <ide> } <ide> defer fs.Close() <ide> <del> if _, err := io.Copy(job.Stdout, fs); err != nil { <add> if _, err := io.Copy(imageExportConfig.Outstream, fs); err != nil { <ide> return err <ide> } <del> logrus.Debugf("End export job: %s", job.Name) <add> logrus.Debugf("End export image") <ide> return nil <ide> } <ide> <ide><path>graph/service.go <ide> import ( <ide> func (s *TagStore) Install(eng *engine.Engine) error { <ide> for name, handler := range map[string]engine.Handler{ <ide> "image_inspect": s.CmdLookup, <del> "image_export": s.CmdImageExport, <ide> "viz": s.CmdViz, <ide> } { <ide> if err := eng.Register(name, handler); err != nil {
3
Text
Text
remove warning from `response.writehead`
61e589f8ecff12451a71bc736812004bed302f6b
<ide><path>doc/api/http.md <ide> const server = http.createServer((req, res) => { <ide> }); <ide> ``` <ide> <del>`Content-Length` is given in bytes not characters. The above example <del>works because the string `'hello world'` contains only single byte characters. <del>If the body contains higher coded characters then `Buffer.byteLength()` <del>should be used to determine the number of bytes in a given encoding. <del>And Node.js does not check whether `Content-Length` and the length of the body <del>which has been transmitted are equal or not. <add>`Content-Length` is given in bytes, not characters. Use <add>[`Buffer.byteLength()`][] to determine the length of the body in bytes. Node.js <add>does not check whether `Content-Length` and the length of the body which has <add>been transmitted are equal or not. <ide> <ide> Attempting to set a header field name or value that contains invalid characters <ide> will result in a [`TypeError`][] being thrown. <ide> not abort the request or do anything besides add a `'timeout'` event. <ide> [`'response'`]: #http_event_response <ide> [`'upgrade'`]: #http_event_upgrade <ide> [`Agent`]: #http_class_http_agent <add>[`Buffer.byteLength()`]: buffer.html#buffer_class_method_buffer_bytelength_string_encoding <ide> [`Duplex`]: stream.html#stream_class_stream_duplex <ide> [`TypeError`]: errors.html#errors_class_typeerror <ide> [`URL`]: url.html#url_the_whatwg_url_api
1
Python
Python
add tests for the array api creation functions
3b91f476fbbecbd111f10efd0aae1df8eed5d667
<ide><path>numpy/_array_api/tests/test_creation_functions.py <add>from numpy.testing import assert_raises <add>import numpy as np <add> <add>from .. import all <add>from .._creation_functions import (asarray, arange, empty, empty_like, eye, from_dlpack, full, full_like, linspace, meshgrid, ones, ones_like, zeros, zeros_like) <add>from .._array_object import Array <add>from .._dtypes import (_all_dtypes, _boolean_dtypes, _floating_dtypes, <add> _integer_dtypes, _integer_or_boolean_dtypes, <add> _numeric_dtypes, int8, int16, int32, int64, uint64) <add> <add>def test_asarray_errors(): <add> # Test various protections against incorrect usage <add> assert_raises(TypeError, lambda: Array([1])) <add> assert_raises(TypeError, lambda: asarray(['a'])) <add> assert_raises(ValueError, lambda: asarray([1.], dtype=np.float16)) <add> assert_raises(OverflowError, lambda: asarray(2**100)) <add> # Preferably this would be OverflowError <add> # assert_raises(OverflowError, lambda: asarray([2**100])) <add> assert_raises(TypeError, lambda: asarray([2**100])) <add> asarray([1], device='cpu') # Doesn't error <add> assert_raises(ValueError, lambda: asarray([1], device='gpu')) <add> <add> assert_raises(ValueError, lambda: asarray([1], dtype=int)) <add> assert_raises(ValueError, lambda: asarray([1], dtype='i')) <add> <add>def test_asarray_copy(): <add> a = asarray([1]) <add> b = asarray(a, copy=True) <add> a[0] = 0 <add> assert all(b[0] == 1) <add> assert all(a[0] == 0) <add> # Once copy=False is implemented, replace this with <add> # a = asarray([1]) <add> # b = asarray(a, copy=False) <add> # a[0] = 0 <add> # assert all(b[0] == 0) <add> assert_raises(NotImplementedError, lambda: asarray(a, copy=False)) <add> <add>def test_arange_errors(): <add> arange(1, device='cpu') # Doesn't error <add> assert_raises(ValueError, lambda: arange(1, device='gpu')) <add> assert_raises(ValueError, lambda: arange(1, dtype=int)) <add> assert_raises(ValueError, lambda: arange(1, dtype='i')) <add> <add>def test_empty_errors(): <add> empty((1,), device='cpu') # Doesn't error <add> assert_raises(ValueError, lambda: empty((1,), device='gpu')) <add> assert_raises(ValueError, lambda: empty((1,), dtype=int)) <add> assert_raises(ValueError, lambda: empty((1,), dtype='i')) <add> <add>def test_empty_like_errors(): <add> empty_like(asarray(1), device='cpu') # Doesn't error <add> assert_raises(ValueError, lambda: empty_like(asarray(1), device='gpu')) <add> assert_raises(ValueError, lambda: empty_like(asarray(1), dtype=int)) <add> assert_raises(ValueError, lambda: empty_like(asarray(1), dtype='i')) <add> <add>def test_eye_errors(): <add> eye(1, device='cpu') # Doesn't error <add> assert_raises(ValueError, lambda: eye(1, device='gpu')) <add> assert_raises(ValueError, lambda: eye(1, dtype=int)) <add> assert_raises(ValueError, lambda: eye(1, dtype='i')) <add> <add>def test_full_errors(): <add> full((1,), 0, device='cpu') # Doesn't error <add> assert_raises(ValueError, lambda: full((1,), 0, device='gpu')) <add> assert_raises(ValueError, lambda: full((1,), 0, dtype=int)) <add> assert_raises(ValueError, lambda: full((1,), 0, dtype='i')) <add> <add>def test_full_like_errors(): <add> full_like(asarray(1), 0, device='cpu') # Doesn't error <add> assert_raises(ValueError, lambda: full_like(asarray(1), 0, device='gpu')) <add> assert_raises(ValueError, lambda: full_like(asarray(1), 0, dtype=int)) <add> assert_raises(ValueError, lambda: full_like(asarray(1), 0, dtype='i')) <add> <add>def test_linspace_errors(): <add> linspace(0, 1, 10, device='cpu') # Doesn't error <add> assert_raises(ValueError, lambda: linspace(0, 1, 10, device='gpu')) <add> assert_raises(ValueError, lambda: linspace(0, 1, 10, dtype=float)) <add> assert_raises(ValueError, lambda: linspace(0, 1, 10, dtype='f')) <add> <add>def test_ones_errors(): <add> ones((1,), device='cpu') # Doesn't error <add> assert_raises(ValueError, lambda: ones((1,), device='gpu')) <add> assert_raises(ValueError, lambda: ones((1,), dtype=int)) <add> assert_raises(ValueError, lambda: ones((1,), dtype='i')) <add> <add>def test_ones_like_errors(): <add> ones_like(asarray(1), device='cpu') # Doesn't error <add> assert_raises(ValueError, lambda: ones_like(asarray(1), device='gpu')) <add> assert_raises(ValueError, lambda: ones_like(asarray(1), dtype=int)) <add> assert_raises(ValueError, lambda: ones_like(asarray(1), dtype='i')) <add> <add>def test_zeros_errors(): <add> zeros((1,), device='cpu') # Doesn't error <add> assert_raises(ValueError, lambda: zeros((1,), device='gpu')) <add> assert_raises(ValueError, lambda: zeros((1,), dtype=int)) <add> assert_raises(ValueError, lambda: zeros((1,), dtype='i')) <add> <add>def test_zeros_like_errors(): <add> zeros_like(asarray(1), device='cpu') # Doesn't error <add> assert_raises(ValueError, lambda: zeros_like(asarray(1), device='gpu')) <add> assert_raises(ValueError, lambda: zeros_like(asarray(1), dtype=int)) <add> assert_raises(ValueError, lambda: zeros_like(asarray(1), dtype='i'))
1
Ruby
Ruby
add version method to top level modules
c07e1515f7c66f5599cbb3c7e9fe42e166bf3edc
<ide><path>actionmailer/lib/action_mailer/version.rb <ide> module ActionMailer <del> module VERSION #:nodoc: <del> MAJOR = 4 <del> MINOR = 0 <del> TINY = 0 <del> PRE = "beta1" <add> # Returns the version of the currently loaded ActionMailer as a Gem::Version <add> def self.version <add> Gem::Version.new "4.0.0.beta1" <add> end <ide> <del> STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.') <add> module VERSION #:nodoc: <add> MAJOR, MINOR, TINY, PRE = ActionMailer.version.segments <add> STRING = ActionMailer.version.to_s <ide> end <ide> end <ide><path>actionpack/lib/action_pack/version.rb <ide> module ActionPack <del> module VERSION #:nodoc: <del> MAJOR = 4 <del> MINOR = 0 <del> TINY = 0 <del> PRE = "beta1" <add> # Returns the version of the currently loaded ActionPack as a Gem::Version <add> def self.version <add> Gem::Version.new "4.0.0.beta1" <add> end <ide> <del> STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.') <add> module VERSION #:nodoc: <add> MAJOR, MINOR, TINY, PRE = ActionPack.version.segments <add> STRING = ActionPack.version.to_s <ide> end <ide> end <ide><path>activemodel/lib/active_model/version.rb <ide> module ActiveModel <del> module VERSION #:nodoc: <del> MAJOR = 4 <del> MINOR = 0 <del> TINY = 0 <del> PRE = "beta1" <add> # Returns the version of the currently loaded ActiveModel as a Gem::Version <add> def self.version <add> Gem::Version.new "4.0.0.beta1" <add> end <ide> <del> STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.') <add> module VERSION #:nodoc: <add> MAJOR, MINOR, TINY, PRE = ActiveModel.version.segments <add> STRING = ActiveModel.version.to_s <ide> end <ide> end <ide><path>activerecord/lib/active_record/version.rb <ide> module ActiveRecord <del> module VERSION #:nodoc: <del> MAJOR = 4 <del> MINOR = 0 <del> TINY = 0 <del> PRE = "beta1" <add> # Returns the version of the currently loaded ActiveRecord as a Gem::Version <add> def self.version <add> Gem::Version.new "4.0.0.beta1" <add> end <ide> <del> STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.') <add> module VERSION #:nodoc: <add> MAJOR, MINOR, TINY, PRE = ActiveRecord.version.segments <add> STRING = ActiveRecord.version.to_s <ide> end <ide> end <ide><path>activesupport/lib/active_support/version.rb <ide> module ActiveSupport <del> module VERSION #:nodoc: <del> MAJOR = 4 <del> MINOR = 0 <del> TINY = 0 <del> PRE = "beta1" <add> # Returns the version of the currently loaded ActiveSupport as a Gem::Version <add> def self.version <add> Gem::Version.new "4.0.0.beta1" <add> end <ide> <del> STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.') <add> module VERSION #:nodoc: <add> MAJOR, MINOR, TINY, PRE = ActiveSupport.version.segments <add> STRING = ActiveSupport.version.to_s <ide> end <ide> end <ide><path>railties/lib/rails/version.rb <ide> module Rails <del> module VERSION #:nodoc: <del> MAJOR = 4 <del> MINOR = 0 <del> TINY = 0 <del> PRE = "beta1" <add> # Returns the version of the currently loaded Rails as a Gem::Version <add> def self.version <add> Gem::Version.new "4.0.0.beta1" <add> end <ide> <del> STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.') <add> module VERSION #:nodoc: <add> MAJOR, MINOR, TINY, PRE = Rails.version.segments <add> STRING = Rails.version.to_s <ide> end <ide> end <ide><path>version.rb <ide> module Rails <del> module VERSION #:nodoc: <del> MAJOR = 4 <del> MINOR = 0 <del> TINY = 0 <del> PRE = "beta1" <add> def self.version <add> Gem::Version.new "4.0.0.beta1" <add> end <ide> <del> STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.') <add> module VERSION #:nodoc: <add> MAJOR, MINOR, TINY, PRE = Rails.version.segments <add> STRING = Rails.version.to_s <ide> end <ide> end
7
Javascript
Javascript
remove _node.matrixautoupdate = false;
96893766ca6adf918cb21a30e8abc4b3b7c18223
<ide><path>examples/js/loaders/GLTFLoader.js <ide> THREE.GLTFLoader = ( function () { <ide> <ide> if ( node.extras ) _node.userData = node.extras; <ide> <del> _node.matrixAutoUpdate = false; <del> <ide> if ( node.matrix !== undefined ) { <ide> <ide> matrix.fromArray( node.matrix );
1
Text
Text
remove example labels from buffer.md
acacf85fecae4a2b72e7cce2dff3a1ac21d40f97
<ide><path>doc/api/buffer.md <ide> impact* on performance. Use of the `--zero-fill-buffers` option is recommended <ide> only when necessary to enforce that newly allocated `Buffer` instances cannot <ide> contain potentially sensitive data. <ide> <del>Example: <del> <ide> ```txt <ide> $ node --zero-fill-buffers <ide> > Buffer.allocUnsafe(5); <ide> such as UTF-8, UCS2, Base64, or even Hex-encoded data. It is possible to <ide> convert back and forth between `Buffer` instances and ordinary JavaScript strings <ide> by using an explicit character encoding. <ide> <del>Example: <del> <ide> ```js <ide> const buf = Buffer.from('hello world', 'ascii'); <ide> <ide> elements, and not as a byte array of the target type. That is, <ide> It is possible to create a new `Buffer` that shares the same allocated memory as <ide> a [`TypedArray`] instance by using the TypeArray object's `.buffer` property. <ide> <del>Example: <del> <ide> ```js <ide> const arr = new Uint16Array(2); <ide> <ide> Note that when creating a `Buffer` using a [`TypedArray`]'s `.buffer`, it is <ide> possible to use only a portion of the underlying [`ArrayBuffer`] by passing in <ide> `byteOffset` and `length` parameters. <ide> <del>Example: <del> <ide> ```js <ide> const arr = new Uint16Array(20); <ide> const buf = Buffer.from(arr.buffer, 0, 16); <ide> function: <ide> `Buffer` instances can be iterated over using the [`ECMAScript 2015`] (ES6) `for..of` <ide> syntax. <ide> <del>Example: <del> <ide> ```js <ide> const buf = Buffer.from([1, 2, 3]); <ide> <ide> changes: <ide> <ide> Allocates a new `Buffer` using an `array` of octets. <ide> <del>Example: <del> <ide> ```js <ide> // Creates a new Buffer containing the UTF-8 bytes of the string 'buffer' <ide> const buf = new Buffer([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]); <ide> share the same allocated memory as the [`TypedArray`]. <ide> The optional `byteOffset` and `length` arguments specify a memory range within <ide> the `arrayBuffer` that will be shared by the `Buffer`. <ide> <del>Example: <del> <ide> ```js <ide> const arr = new Uint16Array(2); <ide> <ide> changes: <ide> <ide> Copies the passed `buffer` data onto a new `Buffer` instance. <ide> <del>Example: <del> <ide> ```js <ide> const buf1 = new Buffer('buffer'); <ide> const buf2 = new Buffer(buf1); <ide> created in this way is *not initialized*. The contents of a newly created <ide> [`Buffer.alloc(size)`][`Buffer.alloc()`] instead to initialize a `Buffer` <ide> to zeroes. <ide> <del>Example: <del> <ide> ```js <ide> const buf = new Buffer(10); <ide> <ide> changes: <ide> Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the <ide> `Buffer` will be *zero-filled*. <ide> <del>Example: <del> <ide> ```js <ide> const buf = Buffer.alloc(5); <ide> <ide> thrown. A zero-length `Buffer` will be created if `size` is 0. <ide> If `fill` is specified, the allocated `Buffer` will be initialized by calling <ide> [`buf.fill(fill)`][`buf.fill()`]. <ide> <del>Example: <del> <ide> ```js <ide> const buf = Buffer.alloc(5, 'a'); <ide> <ide> console.log(buf); <ide> If both `fill` and `encoding` are specified, the allocated `Buffer` will be <ide> initialized by calling [`buf.fill(fill, encoding)`][`buf.fill()`]. <ide> <del>Example: <del> <ide> ```js <ide> const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64'); <ide> <ide> initialized*. The contents of the newly created `Buffer` are unknown and <ide> *may contain sensitive data*. Use [`Buffer.alloc()`] instead to initialize <ide> `Buffer` instances to zeroes. <ide> <del>Example: <del> <ide> ```js <ide> const buf = Buffer.allocUnsafe(10); <ide> <ide> memory from a pool for an indeterminate amount of time, it may be appropriate <ide> to create an un-pooled `Buffer` instance using `Buffer.allocUnsafeSlow()` then <ide> copy out the relevant bits. <ide> <del>Example: <del> <ide> ```js <ide> // Need to keep around a few small chunks of memory <ide> const store = []; <ide> For `'base64'` and `'hex'`, this function assumes valid input. For strings that <ide> contain non-Base64/Hex-encoded data (e.g. whitespace), the return value might be <ide> greater than the length of a `Buffer` created from the string. <ide> <del>Example: <del> <ide> ```js <ide> const str = '\u00bd + \u00bc = \u00be'; <ide> <ide> Compares `buf1` to `buf2` typically for the purpose of sorting arrays of <ide> `Buffer` instances. This is equivalent to calling <ide> [`buf1.compare(buf2)`][`buf.compare()`]. <ide> <del>Example: <del> <ide> ```js <ide> const buf1 = Buffer.from('1234'); <ide> const buf2 = Buffer.from('0123'); <ide> If `totalLength` is provided, it is coerced to an unsigned integer. If the <ide> combined length of the `Buffer`s in `list` exceeds `totalLength`, the result is <ide> truncated to `totalLength`. <ide> <del>Example: Create a single `Buffer` from a list of three `Buffer` instances <del> <ide> ```js <add>// Create a single `Buffer` from a list of three `Buffer` instances. <add> <ide> const buf1 = Buffer.alloc(10); <ide> const buf2 = Buffer.alloc(14); <ide> const buf3 = Buffer.alloc(18); <ide> added: v5.10.0 <ide> <ide> Allocates a new `Buffer` using an `array` of octets. <ide> <del>Example: <del> <ide> ```js <ide> // Creates a new Buffer containing UTF-8 bytes of the string 'buffer' <ide> const buf = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]); <ide> memory. For example, when passed a reference to the `.buffer` property of a <ide> [`TypedArray`] instance, the newly created `Buffer` will share the same <ide> allocated memory as the [`TypedArray`]. <ide> <del>Example: <del> <ide> ```js <ide> const arr = new Uint16Array(2); <ide> <ide> console.log(buf); <ide> The optional `byteOffset` and `length` arguments specify a memory range within <ide> the `arrayBuffer` that will be shared by the `Buffer`. <ide> <del>Example: <del> <ide> ```js <ide> const ab = new ArrayBuffer(10); <ide> const buf = Buffer.from(ab, 0, 2); <ide> added: v5.10.0 <ide> <ide> Copies the passed `buffer` data onto a new `Buffer` instance. <ide> <del>Example: <del> <ide> ```js <ide> const buf1 = Buffer.from('buffer'); <ide> const buf2 = Buffer.from(buf1); <ide> This operator is inherited from `Uint8Array`, so its behavior on out-of-bounds <ide> access is the same as `UInt8Array` - that is, getting returns `undefined` and <ide> setting does nothing. <ide> <del>Example: Copy an ASCII string into a `Buffer`, one byte at a time <del> <ide> ```js <add>// Copy an ASCII string into a `Buffer` one byte at a time. <add> <ide> const str = 'Node.js'; <ide> const buf = Buffer.allocUnsafe(str.length); <ide> <ide> added: v0.1.90 <ide> Copies data from a region of `buf` to a region in `target` even if the `target` <ide> memory region overlaps with `buf`. <ide> <del>Example: Create two `Buffer` instances, `buf1` and `buf2`, and copy `buf1` from <del>byte 16 through byte 19 into `buf2`, starting at the 8th byte in `buf2` <del> <ide> ```js <add>// Create two `Buffer` instances. <ide> const buf1 = Buffer.allocUnsafe(26); <ide> const buf2 = Buffer.allocUnsafe(26).fill('!'); <ide> <ide> for (let i = 0; i < 26; i++) { <ide> buf1[i] = i + 97; <ide> } <ide> <add>// Copy `buf1` bytes 16 through 19 into `buf2` starting at byte 8 of `buf2` <ide> buf1.copy(buf2, 8, 16, 20); <ide> <ide> console.log(buf2.toString('ascii', 0, 25)); <ide> // Prints: !!!!!!!!qrst!!!!!!!!!!!!! <ide> ``` <ide> <del>Example: Create a single `Buffer` and copy data from one region to an <del>overlapping region within the same `Buffer` <del> <ide> ```js <add>// Create a `Buffer` and copy data from one region to an overlapping region <add>// within the same `Buffer`. <add> <ide> const buf = Buffer.allocUnsafe(26); <ide> <ide> for (let i = 0; i < 26; i++) { <ide> added: v1.1.0 <ide> Creates and returns an [iterator] of `[index, byte]` pairs from the contents of <ide> `buf`. <ide> <del>Example: Log the entire contents of a `Buffer` <del> <ide> ```js <add>// Log the entire contents of a `Buffer`. <add> <ide> const buf = Buffer.from('buffer'); <ide> <ide> for (const pair of buf.entries()) { <ide> Fills `buf` with the specified `value`. If the `offset` and `end` are not given, <ide> the entire `buf` will be filled. This is meant to be a small simplification to <ide> allow the creation and filling of a `Buffer` to be done on a single line. <ide> <del>Example: Fill a `Buffer` with the ASCII character `'h'` <del> <ide> ```js <add>// Fill a `Buffer` with the ASCII character 'h'. <add> <ide> const b = Buffer.allocUnsafe(50).fill('h'); <ide> <ide> console.log(b.toString()); <ide> console.log(b.toString()); <ide> If the final write of a `fill()` operation falls on a multi-byte character, <ide> then only the first bytes of that character that fit into `buf` are written. <ide> <del>Example: Fill a `Buffer` with a two-byte character <del> <ide> ```js <add>// Fill a `Buffer` with a two-byte character. <add> <ide> console.log(Buffer.allocUnsafe(3).fill('\u0222')); <ide> // Prints: <Buffer c8 a2 c8> <ide> ``` <ide> added: v1.1.0 <ide> <ide> Creates and returns an [iterator] of `buf` keys (indices). <ide> <del>Example: <del> <ide> ```js <ide> const buf = Buffer.from('buffer'); <ide> <ide> added: v0.1.90 <ide> Returns the amount of memory allocated for `buf` in bytes. Note that this <ide> does not necessarily reflect the amount of "usable" data within `buf`. <ide> <del>Example: Create a `Buffer` and write a shorter ASCII string to it <del> <ide> ```js <add>// Create a `Buffer` and write a shorter ASCII string to it. <add> <ide> const buf = Buffer.alloc(1234); <ide> <ide> console.log(buf.length); <ide> that of `end` equal to [`buf.length`]. <ide> Modifying the new `Buffer` slice will modify the memory in the original `Buffer` <ide> because the allocated memory of the two objects overlap. <ide> <del>Example: Create a `Buffer` with the ASCII alphabet, take a slice, and then modify <del>one byte from the original `Buffer` <del> <ide> ```js <add>// Create a `Buffer` with the ASCII alphabet, take a slice, and modify one byte <add>// from the original `Buffer`. <add> <ide> const buf1 = Buffer.allocUnsafe(26); <ide> <ide> for (let i = 0; i < 26; i++) { <ide> added: v0.9.2 <ide> Returns a JSON representation of `buf`. [`JSON.stringify()`] implicitly calls <ide> this function when stringifying a `Buffer` instance. <ide> <del>Example: <del> <ide> ```js <ide> const buf = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5]); <ide> const json = JSON.stringify(buf); <ide> The `length` parameter is the number of bytes to write. If `buf` did not contain <ide> enough space to fit the entire string, only a partial amount of `string` will <ide> be written. However, partially encoded characters will not be written. <ide> <del>Example: <del> <ide> ```js <ide> const buf = Buffer.allocUnsafe(256); <ide> <ide> In the case where a developer may need to retain a small chunk of memory from a <ide> pool for an indeterminate amount of time, it may be appropriate to create an <ide> un-pooled `Buffer` instance using `SlowBuffer` then copy out the relevant bits. <ide> <del>Example: <del> <ide> ```js <ide> // Need to keep around a few small chunks of memory <ide> const store = []; <ide> Allocates a new `Buffer` of `size` bytes. If the `size` is larger than <ide> thrown. A zero-length `Buffer` will be created if `size` is 0. <ide> <ide> The underlying memory for `SlowBuffer` instances is *not initialized*. The <del>contents of a newly created `SlowBuffer` are unknown and may contain <del>sensitive data. Use [`buf.fill(0)`][`buf.fill()`] to initialize a `SlowBuffer` to zeroes. <del> <del>Example: <add>contents of a newly created `SlowBuffer` are unknown and may contain sensitive <add>data. Use [`buf.fill(0)`][`buf.fill()`] to initialize a `SlowBuffer` to zeroes. <ide> <ide> ```js <ide> const { SlowBuffer } = require('buffer');
1
Go
Go
check len inside public function
bb05c188927cdc7a5f86dceace3a4043b0dfeb28
<ide><path>builder/dockerfile/internals.go <ide> func (b *Builder) create() (string, error) { <ide> b.tmpContainers[c.ID] = struct{}{} <ide> fmt.Fprintf(b.Stdout, " ---> Running in %s\n", stringid.TruncateID(c.ID)) <ide> <del> if len(config.Cmd) > 0 { <del> // override the entry point that may have been picked up from the base image <del> if err := b.docker.ContainerUpdateCmdOnBuild(c.ID, config.Cmd); err != nil { <del> return "", err <del> } <add> // override the entry point that may have been picked up from the base image <add> if err := b.docker.ContainerUpdateCmdOnBuild(c.ID, config.Cmd); err != nil { <add> return "", err <ide> } <ide> <ide> return c.ID, nil <ide><path>daemon/update.go <ide> func (daemon *Daemon) ContainerUpdate(name string, hostConfig *container.HostCon <ide> <ide> // ContainerUpdateCmdOnBuild updates Path and Args for the container with ID cID. <ide> func (daemon *Daemon) ContainerUpdateCmdOnBuild(cID string, cmd []string) error { <add> if len(cmd) == 0 { <add> return nil <add> } <ide> c, err := daemon.GetContainer(cID) <ide> if err != nil { <ide> return err <ide><path>registry/registry_test.go <ide> func TestGetRemoteImageJSON(t *testing.T) { <ide> t.Fatal(err) <ide> } <ide> assertEqual(t, size, int64(154), "Expected size 154") <del> if len(json) <= 0 { <add> if len(json) == 0 { <ide> t.Fatal("Expected non-empty json") <ide> } <ide>
3
Text
Text
add user token workflow
f34c125da4191dc8d3cbd27375436941911deb5e
<ide><path>docs/_sidebar.md <ide> - [Understand the curriculum file structure](curriculum-file-structure.md) <ide> - [Debug outgoing emails locally](how-to-catch-outgoing-emails-locally.md) <ide> - [Set up freeCodeCamp on Windows (WSL)](how-to-setup-wsl.md) <add> - [User Token Workflow](user-token-workflow.md) <ide> <ide> --- <ide> <ide><path>docs/user-token-workflow.md <add># How the User Token Workflow Works <add> <add>User tokens are used to identify users to third parties so challenges completed using those services can be saved to a user's account. <add> <add>## How they are created <add> <add>At the moment, the tokens are only used to submit the Relational Database challenges. A token gets created when a signed in user clicks the "Click here to start the course" or "Click here to start the project" buttons to start one of the Relational Database courses or projects. <add> <add>## When they get deleted <add> <add>A user token will be deleted when a user signs out of freeCodeCamp, resets their progress, deletes their account, or manually deletes the token using the widget on the settings page. <add> <add>## How they work <add> <add>Tokens are stored in a `UserToken` collection in the database. Each record has a unique `_id`, which is the token, and a `user_id` that links to the user's account from the `user` collection. The token is encoded using JWT and sent to the client when it's created. That encoded token is then given to third party services that need it and sent to our API by them when a challenge is completed. When our API gets it, it is decoded so we can identify the user submitting a challenge and save the completed challenge to their `completedChallenges`.
2
PHP
PHP
remove redundant capture and fix linter errors
90f65b79d19d4a0ed0781cbf3df8b34d7cdfcb14
<ide><path>src/Error/Middleware/ErrorHandlerMiddleware.php <ide> public function process(ServerRequestInterface $request, RequestHandlerInterface <ide> public function handleException(Throwable $exception, ServerRequestInterface $request): ResponseInterface <ide> { <ide> if ($this->errorHandler === null) { <del> $trap = $this->getExceptionTrap(); <del> $trap->logException($exception, $request); <add> $handler = $this->getExceptionTrap(); <add> $handler->logException($exception, $request); <ide> <del> $renderer = $trap->renderer($exception, $request); <add> $renderer = $handler->renderer($exception, $request); <ide> } else { <del> $errorHandler = $this->getErrorHandler(); <del> $errorHandler->logException($exception, $request); <add> $handler = $this->getErrorHandler(); <add> $handler->logException($exception, $request); <ide> <del> $renderer = $errorHandler->getRenderer($exception, $request); <add> $renderer = $handler->getRenderer($exception, $request); <ide> } <ide> <ide> try { <ide> public function handleException(Throwable $exception, ServerRequestInterface $re <ide> <ide> return $response; <ide> } catch (Throwable $internalException) { <del> $errorHandler->logException($internalException, $request); <add> $handler->logException($internalException, $request); <ide> <ide> return $this->handleInternalError(); <ide> } <ide><path>tests/TestCase/Error/ExceptionTrapTest.php <ide> public function testSkipLogException(): void <ide> 'skipLog' => [InvalidArgumentException::class], <ide> ]); <ide> <del> $trap->getEventManager()->on('Exception.beforeRender', function () use (&$triggered) { <add> $trap->getEventManager()->on('Exception.beforeRender', function () { <ide> $this->triggered = true; <ide> }); <ide>
2
Javascript
Javascript
normalize scroll wheel
5067e5df79656cc8f101c3842552a29a2df50efd
<ide><path>examples/js/controls/EditorControls.js <ide> THREE.EditorControls = function ( object, domElement ) { <ide> this.enabled = true; <ide> this.center = new THREE.Vector3(); <ide> this.panSpeed = 0.001; <del> this.zoomSpeed = 0.001; <add> this.zoomSpeed = 0.1; <ide> this.rotationSpeed = 0.005; <ide> <ide> // internals <ide> THREE.EditorControls = function ( object, domElement ) { <ide> <ide> // if ( scope.enabled === false ) return; <ide> <del> scope.zoom( new THREE.Vector3( 0, 0, event.deltaY ) ); <add> scope.zoom( new THREE.Vector3( 0, 0, event.deltaY > 0 ? 1 : - 1 ) ); <ide> <ide> } <ide>
1
PHP
PHP
upgrade shell - 'configure' subcommand
b5d602e491b612b3d09ca4e86d5ed2a7d09ab847
<ide><path>cake/console/shells/upgrade.php <ide> public function basics() { <ide> $patterns = array( <ide> array( <ide> 'a(*) -> array(*)', <del> '/a\((.*)\)/', <add> '/\ba\((.*)\)/', <ide> 'array(\1)' <ide> ), <ide> array( <ide> public function request() { <ide> $this->_filesRegexpUpdate($patterns); <ide> } <ide> <add>/** <add> * Update Configure::read() calls with no params. <add> * <add> * @return void <add> */ <add> public function configure() { <add> $this->_paths = array( <add> APP <add> ); <add> if (!empty($this->params['plugin'])) { <add> $this->_paths = array(App::pluginPath($this->params['plugin'])); <add> } <add> $patterns = array( <add> array( <add> "Configure::read() -> Configure::read('debug')", <add> '/Configure::read\(\)/', <add> 'Configure::read(\'debug\')' <add> ), <add> ); <add> $this->_filesRegexpUpdate($patterns); <add> } <add> <ide> /** <ide> * Updates files based on regular expressions. <ide> * <ide> function getOptionParser() { <ide> ->addSubcommand('request', array( <ide> 'help' => 'Update removed request access, and replace with $this->request.', <ide> 'parser' => $subcommandParser <add> )) <add> ->addSubcommand('configure', array( <add> 'help' => "Update Configure::read() to Configure::read('debug')", <add> 'parser' => $subcommandParser <ide> )); <ide> } <ide> } <ide>\ No newline at end of file
1
Javascript
Javascript
add @flow to backhandler
471e8c168a07ec2f4efcd2cfa815232b1bc3cd26
<ide><path>Libraries/Utilities/BackHandler.android.js <ide> * LICENSE file in the root directory of this source tree. <ide> * <ide> * @format <add> * @flow <ide> */ <ide> <ide> 'use strict'; <ide> const DEVICE_BACK_EVENT = 'hardwareBackPress'; <ide> <ide> type BackPressEventName = $Enum<{ <ide> backPress: string, <add> hardwareBackPress: string, <ide> }>; <ide> <ide> const _backPressSubscriptions = []; <ide> RCTDeviceEventEmitter.addListener(DEVICE_BACK_EVENT, function() { <ide> * ``` <ide> */ <ide> const BackHandler = { <del> exitApp: function() { <add> exitApp: function(): void { <ide> DeviceEventManager.invokeDefaultBackPressHandler(); <ide> }, <ide> <ide> const BackHandler = { <ide> _backPressSubscriptions.push(handler); <ide> } <ide> return { <del> remove: () => BackHandler.removeEventListener(eventName, handler), <add> remove: (): void => BackHandler.removeEventListener(eventName, handler), <ide> }; <ide> }, <ide> <ide><path>Libraries/Utilities/BackHandler.ios.js <ide> * On iOS, this just implements a stub. <ide> * <ide> * @format <add> * @flow <ide> */ <ide> <ide> 'use strict'; <ide> const TVEventHandler = require('TVEventHandler'); <ide> <ide> type BackPressEventName = $Enum<{ <ide> backPress: string, <add> hardwareBackPress: string, <ide> }>; <ide> <del>function emptyFunction() {} <add>function emptyFunction(): void {} <ide> <ide> /** <ide> * Detect hardware button presses for back navigation. <ide> if (Platform.isTV) { <ide> } else { <ide> BackHandler = { <ide> exitApp: emptyFunction, <del> addEventListener() { <add> addEventListener(_eventName: BackPressEventName, _handler: Function) { <ide> return { <ide> remove: emptyFunction, <ide> }; <ide> }, <del> removeEventListener: emptyFunction, <add> removeEventListener(_eventName: BackPressEventName, _handler: Function) {}, <ide> }; <ide> } <ide>
2
Ruby
Ruby
remove `engine` from `treemanager` and subclasses
98fc25991137ee09b6800578117f8c1c322680f2
<ide><path>lib/arel/crud.rb <ide> module Arel <ide> # FIXME hopefully we can remove this <ide> module Crud <ide> def compile_update values, pk <del> um = UpdateManager.new @engine <add> um = UpdateManager.new <ide> <ide> if Nodes::SqlLiteral === values <ide> relation = @ctx.from <ide> def compile_insert values <ide> end <ide> <ide> def create_insert <del> InsertManager.new @engine <add> InsertManager.new <ide> end <ide> <ide> def compile_delete <del> dm = DeleteManager.new @engine <add> dm = DeleteManager.new <ide> dm.wheres = @ctx.wheres <ide> dm.from @ctx.froms <ide> dm <ide><path>lib/arel/delete_manager.rb <ide> module Arel <ide> class DeleteManager < Arel::TreeManager <del> def initialize engine <add> def initialize <ide> super <ide> @ast = Nodes::DeleteStatement.new <ide> @ctx = @ast <ide><path>lib/arel/insert_manager.rb <ide> module Arel <ide> class InsertManager < Arel::TreeManager <del> def initialize engine <add> def initialize <ide> super <ide> @ast = Nodes::InsertStatement.new <ide> end <ide><path>lib/arel/nodes/table_alias.rb <ide> def [] name <ide> def table_name <ide> relation.respond_to?(:name) ? relation.name : name <ide> end <del> <del> def engine <del> relation.engine <del> end <ide> end <ide> end <ide> end <ide><path>lib/arel/select_manager.rb <ide> class SelectManager < Arel::TreeManager <ide> <ide> STRING_OR_SYMBOL_CLASS = [Symbol, String] <ide> <del> def initialize engine, table = nil <del> super(engine) <add> def initialize table = nil <add> super() <ide> @ast = Nodes::SelectStatement.new <ide> @ctx = @ast.cores.last <ide> from table <ide> def orders <ide> @ast.orders <ide> end <ide> <del> def where_sql <add> def where_sql engine = Table.engine <ide> return if @ctx.wheres.empty? <ide> <del> viz = Visitors::WhereSql.new @engine.connection <add> viz = Visitors::WhereSql.new engine.connection <ide> Nodes::SqlLiteral.new viz.accept(@ctx, Collectors::SQLString.new).value <ide> end <ide> <ide><path>lib/arel/table.rb <ide> class Table <ide> @engine = nil <ide> class << self; attr_accessor :engine; end <ide> <del> attr_accessor :name, :engine, :aliases, :table_alias <add> attr_accessor :name, :aliases, :table_alias <ide> <ide> # TableAlias and Table both have a #table_name which is the name of the underlying table <ide> alias :table_name :name <ide> def initialize name, options = {} <ide> @name = name.to_s <ide> @columns = nil <ide> @aliases = [] <del> @engine = Table.engine <ide> <ide> # Sometime AR sends an :as parameter to table, to let the table know <ide> # that it is an Alias. We may want to override new, and return a <ide> def alias name = "#{self.name}_2" <ide> end <ide> end <ide> <del> def from engine = Table.engine <del> SelectManager.new(engine, self) <add> def from <add> SelectManager.new(self) <ide> end <ide> <ide> def join relation, klass = Nodes::InnerJoin <ide><path>lib/arel/tree_manager.rb <ide> class TreeManager <ide> <ide> attr_accessor :bind_values <ide> <del> def initialize engine <del> @engine = engine <add> def initialize <ide> @ctx = nil <ide> @bind_values = [] <ide> end <ide> def to_dot <ide> collector.value <ide> end <ide> <del> def visitor <del> engine.connection.visitor <del> end <del> <del> def to_sql <add> def to_sql engine = Table.engine <ide> collector = Arel::Collectors::SQLString.new <del> collector = visitor.accept @ast, collector <add> collector = engine.connection.visitor.accept @ast, collector <ide> collector.value <ide> end <ide> <ide><path>lib/arel/update_manager.rb <ide> module Arel <ide> class UpdateManager < Arel::TreeManager <del> def initialize engine <add> def initialize <ide> super <ide> @ast = Nodes::UpdateStatement.new <ide> @ctx = @ast <ide><path>test/collectors/test_bind_collector.rb <ide> def compile node <ide> <ide> def ast_with_binds bv <ide> table = Table.new(:users) <del> manager = Arel::SelectManager.new Table.engine, table <add> manager = Arel::SelectManager.new table <ide> manager.where(table[:age].eq(bv)) <ide> manager.where(table[:name].eq(bv)) <ide> manager.ast <ide><path>test/collectors/test_sql_string.rb <ide> def compile node <ide> <ide> def ast_with_binds bv <ide> table = Table.new(:users) <del> manager = Arel::SelectManager.new Table.engine, table <add> manager = Arel::SelectManager.new table <ide> manager.where(table[:age].eq(bv)) <ide> manager.where(table[:name].eq(bv)) <ide> manager.ast <ide><path>test/nodes/test_table_alias.rb <ide> module Arel <ide> module Nodes <ide> describe 'table alias' do <del> it 'has an #engine which delegates to the relation' do <del> relation = OpenStruct.new(engine: 'vroom') <del> <del> node = TableAlias.new relation, :foo <del> node.engine.must_equal 'vroom' <del> end <del> <ide> describe 'equality' do <ide> it 'is equal with equal ivars' do <ide> relation1 = Table.new(:users) <ide><path>test/test_delete_manager.rb <ide> module Arel <ide> describe 'delete manager' do <ide> describe 'new' do <ide> it 'takes an engine' do <del> Arel::DeleteManager.new Table.engine <add> Arel::DeleteManager.new <ide> end <ide> end <ide> <ide> describe 'from' do <ide> it 'uses from' do <ide> table = Table.new(:users) <del> dm = Arel::DeleteManager.new Table.engine <add> dm = Arel::DeleteManager.new <ide> dm.from table <ide> dm.to_sql.must_be_like %{ DELETE FROM "users" } <ide> end <ide> <ide> it 'chains' do <ide> table = Table.new(:users) <del> dm = Arel::DeleteManager.new Table.engine <add> dm = Arel::DeleteManager.new <ide> dm.from(table).must_equal dm <ide> end <ide> end <ide> <ide> describe 'where' do <ide> it 'uses where values' do <ide> table = Table.new(:users) <del> dm = Arel::DeleteManager.new Table.engine <add> dm = Arel::DeleteManager.new <ide> dm.from table <ide> dm.where table[:id].eq(10) <ide> dm.to_sql.must_be_like %{ DELETE FROM "users" WHERE "users"."id" = 10} <ide> end <ide> <ide> it 'chains' do <ide> table = Table.new(:users) <del> dm = Arel::DeleteManager.new Table.engine <add> dm = Arel::DeleteManager.new <ide> dm.where(table[:id].eq(10)).must_equal dm <ide> end <ide> end <ide><path>test/test_insert_manager.rb <ide> module Arel <ide> describe 'insert manager' do <ide> describe 'new' do <ide> it 'takes an engine' do <del> Arel::InsertManager.new Table.engine <add> Arel::InsertManager.new <ide> end <ide> end <ide> <ide> describe 'insert' do <ide> it 'can create a Values node' do <del> manager = Arel::InsertManager.new Table.engine <add> manager = Arel::InsertManager.new <ide> values = manager.create_values %w{ a b }, %w{ c d } <ide> <ide> assert_kind_of Arel::Nodes::Values, values <ide> module Arel <ide> end <ide> <ide> it 'allows sql literals' do <del> manager = Arel::InsertManager.new Table.engine <add> manager = Arel::InsertManager.new <ide> manager.into Table.new(:users) <ide> manager.values = manager.create_values [Arel.sql('*')], %w{ a } <ide> manager.to_sql.must_be_like %{ <ide> module Arel <ide> <ide> it "inserts false" do <ide> table = Table.new(:users) <del> manager = Arel::InsertManager.new Table.engine <add> manager = Arel::InsertManager.new <ide> <ide> manager.insert [[table[:bool], false]] <ide> manager.to_sql.must_be_like %{ <ide> module Arel <ide> <ide> it "inserts null" do <ide> table = Table.new(:users) <del> manager = Arel::InsertManager.new Table.engine <add> manager = Arel::InsertManager.new <ide> manager.insert [[table[:id], nil]] <ide> manager.to_sql.must_be_like %{ <ide> INSERT INTO "users" ("id") VALUES (NULL) <ide> module Arel <ide> <ide> it "inserts time" do <ide> table = Table.new(:users) <del> manager = Arel::InsertManager.new Table.engine <add> manager = Arel::InsertManager.new <ide> <ide> time = Time.now <ide> attribute = table[:created_at] <ide> module Arel <ide> <ide> it 'takes a list of lists' do <ide> table = Table.new(:users) <del> manager = Arel::InsertManager.new Table.engine <add> manager = Arel::InsertManager.new <ide> manager.into table <ide> manager.insert [[table[:id], 1], [table[:name], 'aaron']] <ide> manager.to_sql.must_be_like %{ <ide> module Arel <ide> <ide> it 'defaults the table' do <ide> table = Table.new(:users) <del> manager = Arel::InsertManager.new Table.engine <add> manager = Arel::InsertManager.new <ide> manager.insert [[table[:id], 1], [table[:name], 'aaron']] <ide> manager.to_sql.must_be_like %{ <ide> INSERT INTO "users" ("id", "name") VALUES (1, 'aaron') <ide> module Arel <ide> <ide> it 'noop for empty list' do <ide> table = Table.new(:users) <del> manager = Arel::InsertManager.new Table.engine <add> manager = Arel::InsertManager.new <ide> manager.insert [[table[:id], 1]] <ide> manager.insert [] <ide> manager.to_sql.must_be_like %{ <ide> module Arel <ide> <ide> describe 'into' do <ide> it 'takes a Table and chains' do <del> manager = Arel::InsertManager.new Table.engine <add> manager = Arel::InsertManager.new <ide> manager.into(Table.new(:users)).must_equal manager <ide> end <ide> <ide> it 'converts to sql' do <ide> table = Table.new :users <del> manager = Arel::InsertManager.new Table.engine <add> manager = Arel::InsertManager.new <ide> manager.into table <ide> manager.to_sql.must_be_like %{ <ide> INSERT INTO "users" <ide> module Arel <ide> describe 'columns' do <ide> it "converts to sql" do <ide> table = Table.new :users <del> manager = Arel::InsertManager.new Table.engine <add> manager = Arel::InsertManager.new <ide> manager.into table <ide> manager.columns << table[:id] <ide> manager.to_sql.must_be_like %{ <ide> module Arel <ide> describe "values" do <ide> it "converts to sql" do <ide> table = Table.new :users <del> manager = Arel::InsertManager.new Table.engine <add> manager = Arel::InsertManager.new <ide> manager.into table <ide> <ide> manager.values = Nodes::Values.new [1] <ide> module Arel <ide> describe "combo" do <ide> it "combines columns and values list in order" do <ide> table = Table.new :users <del> manager = Arel::InsertManager.new Table.engine <add> manager = Arel::InsertManager.new <ide> manager.into table <ide> <ide> manager.values = Nodes::Values.new [1, 'aaron'] <ide> module Arel <ide> it "accepts a select query in place of a VALUES clause" do <ide> table = Table.new :users <ide> <del> manager = Arel::InsertManager.new Table.engine <add> manager = Arel::InsertManager.new <ide> manager.into table <ide> <del> select = Arel::SelectManager.new Table.engine <add> select = Arel::SelectManager.new <ide> select.project Arel.sql('1') <ide> select.project Arel.sql('"aaron"') <ide> <ide><path>test/test_select_manager.rb <ide> module Arel <ide> <ide> describe 'select manager' do <ide> def test_join_sources <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.join_sources << Arel::Nodes::StringJoin.new(Nodes.build_quoted('foo')) <ide> assert_equal "SELECT FROM 'foo'", manager.to_sql <ide> end <ide> <ide> def test_manager_stores_bind_values <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> assert_equal [], manager.bind_values <ide> manager.bind_values = [1] <ide> assert_equal [1], manager.bind_values <ide> def test_manager_stores_bind_values <ide> describe 'project' do <ide> it 'accepts symbols as sql literals' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.project :id <ide> manager.from table <ide> manager.to_sql.must_be_like %{ <ide> def test_manager_stores_bind_values <ide> describe 'order' do <ide> it 'accepts symbols' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.project Nodes::SqlLiteral.new '*' <ide> manager.from table <ide> manager.order :foo <ide> def test_manager_stores_bind_values <ide> describe 'group' do <ide> it 'takes a symbol' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.from table <ide> manager.group :foo <ide> manager.to_sql.must_be_like %{ SELECT FROM "users" GROUP BY foo } <ide> def test_manager_stores_bind_values <ide> <ide> describe 'as' do <ide> it 'makes an AS node by grouping the AST' do <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> as = manager.as(Arel.sql('foo')) <ide> assert_kind_of Arel::Nodes::Grouping, as.left <ide> assert_equal manager.ast, as.left.expr <ide> assert_equal 'foo', as.right <ide> end <ide> <ide> it 'converts right to SqlLiteral if a string' do <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> as = manager.as('foo') <ide> assert_kind_of Arel::Nodes::SqlLiteral, as.right <ide> end <ide> <ide> it 'can make a subselect' do <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.project Arel.star <ide> manager.from Arel.sql('zomg') <ide> as = manager.as(Arel.sql('foo')) <ide> <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.project Arel.sql('name') <ide> manager.from as <ide> manager.to_sql.must_be_like "SELECT name FROM (SELECT * FROM zomg) foo" <ide> def test_manager_stores_bind_values <ide> describe 'from' do <ide> it 'ignores strings when table of same name exists' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> <ide> manager.from table <ide> manager.from 'users' <ide> def test_manager_stores_bind_values <ide> <ide> it 'should support any ast' do <ide> table = Table.new :users <del> manager1 = Arel::SelectManager.new Table.engine <add> manager1 = Arel::SelectManager.new <ide> <del> manager2 = Arel::SelectManager.new Table.engine <add> manager2 = Arel::SelectManager.new <ide> manager2.project(Arel.sql('*')) <ide> manager2.from table <ide> <ide> def test_manager_stores_bind_values <ide> describe 'exists' do <ide> it 'should create an exists clause' do <ide> table = Table.new(:users) <del> manager = Arel::SelectManager.new Table.engine, table <add> manager = Arel::SelectManager.new table <ide> manager.project Nodes::SqlLiteral.new '*' <ide> m2 = Arel::SelectManager.new(manager.engine) <ide> m2.project manager.exists <ide> def test_manager_stores_bind_values <ide> <ide> it 'can be aliased' do <ide> table = Table.new(:users) <del> manager = Arel::SelectManager.new Table.engine, table <add> manager = Arel::SelectManager.new table <ide> manager.project Nodes::SqlLiteral.new '*' <ide> m2 = Arel::SelectManager.new(manager.engine) <ide> m2.project manager.exists.as('foo') <ide> def test_manager_stores_bind_values <ide> describe 'union' do <ide> before do <ide> table = Table.new :users <del> @m1 = Arel::SelectManager.new Table.engine, table <add> @m1 = Arel::SelectManager.new table <ide> @m1.project Arel.star <ide> @m1.where(table[:age].lt(18)) <ide> <del> @m2 = Arel::SelectManager.new Table.engine, table <add> @m2 = Arel::SelectManager.new table <ide> @m2.project Arel.star <ide> @m2.where(table[:age].gt(99)) <ide> <ide> def test_manager_stores_bind_values <ide> describe 'intersect' do <ide> before do <ide> table = Table.new :users <del> @m1 = Arel::SelectManager.new Table.engine, table <add> @m1 = Arel::SelectManager.new table <ide> @m1.project Arel.star <ide> @m1.where(table[:age].gt(18)) <ide> <del> @m2 = Arel::SelectManager.new Table.engine, table <add> @m2 = Arel::SelectManager.new table <ide> @m2.project Arel.star <ide> @m2.where(table[:age].lt(99)) <ide> <ide> def test_manager_stores_bind_values <ide> describe 'except' do <ide> before do <ide> table = Table.new :users <del> @m1 = Arel::SelectManager.new Table.engine, table <add> @m1 = Arel::SelectManager.new table <ide> @m1.project Arel.star <ide> @m1.where(table[:age].between(18..60)) <ide> <del> @m2 = Arel::SelectManager.new Table.engine, table <add> @m2 = Arel::SelectManager.new table <ide> @m2.project Arel.star <ide> @m2.where(table[:age].between(40..99)) <ide> end <ide> def test_manager_stores_bind_values <ide> replies = Table.new(:replies) <ide> replies_id = replies[:id] <ide> <del> recursive_term = Arel::SelectManager.new Table.engine <add> recursive_term = Arel::SelectManager.new <ide> recursive_term.from(comments).project(comments_id, comments_parent_id).where(comments_id.eq 42) <ide> <del> non_recursive_term = Arel::SelectManager.new Table.engine <add> non_recursive_term = Arel::SelectManager.new <ide> non_recursive_term.from(comments).project(comments_id, comments_parent_id).join(replies).on(comments_parent_id.eq replies_id) <ide> <ide> union = recursive_term.union(non_recursive_term) <ide> <ide> as_statement = Arel::Nodes::As.new replies, union <ide> <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.with(:recursive, as_statement).from(replies).project(Arel.star) <ide> <ide> sql = manager.to_sql <ide> def test_manager_stores_bind_values <ide> <ide> describe 'taken' do <ide> it 'should return limit' do <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.take 10 <ide> manager.taken.must_equal 10 <ide> end <ide> def test_manager_stores_bind_values <ide> describe 'orders' do <ide> it 'returns order clauses' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> order = table[:id] <ide> manager.order table[:id] <ide> manager.orders.must_equal [order] <ide> def test_manager_stores_bind_values <ide> describe 'order' do <ide> it 'generates order clauses' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.project Nodes::SqlLiteral.new '*' <ide> manager.from table <ide> manager.order table[:id] <ide> def test_manager_stores_bind_values <ide> # FIXME: I would like to deprecate this <ide> it 'takes *args' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.project Nodes::SqlLiteral.new '*' <ide> manager.from table <ide> manager.order table[:id], table[:name] <ide> def test_manager_stores_bind_values <ide> <ide> it 'chains' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.order(table[:id]).must_equal manager <ide> end <ide> <ide> it 'has order attributes' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.project Nodes::SqlLiteral.new '*' <ide> manager.from table <ide> manager.order table[:id].desc <ide> def test_manager_stores_bind_values <ide> left = Table.new :users <ide> right = left.alias <ide> predicate = left[:id].eq(right[:id]) <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> <ide> manager.from left <ide> manager.join(right).on(predicate, predicate) <ide> def test_manager_stores_bind_values <ide> left = Table.new :users <ide> right = left.alias <ide> predicate = left[:id].eq(right[:id]) <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> <ide> manager.from left <ide> manager.join(right).on( <ide> def test_manager_stores_bind_values <ide> end <ide> <ide> it 'should hand back froms' do <del> relation = Arel::SelectManager.new Table.engine <add> relation = Arel::SelectManager.new <ide> assert_equal [], relation.froms <ide> end <ide> <ide> it 'should create and nodes' do <del> relation = Arel::SelectManager.new Table.engine <add> relation = Arel::SelectManager.new <ide> children = ['foo', 'bar', 'baz'] <ide> clause = relation.create_and children <ide> assert_kind_of Arel::Nodes::And, clause <ide> assert_equal children, clause.children <ide> end <ide> <ide> it 'should create insert managers' do <del> relation = Arel::SelectManager.new Table.engine <add> relation = Arel::SelectManager.new <ide> insert = relation.create_insert <ide> assert_kind_of Arel::InsertManager, insert <ide> end <ide> <ide> it 'should create join nodes' do <del> relation = Arel::SelectManager.new Table.engine <add> relation = Arel::SelectManager.new <ide> join = relation.create_join 'foo', 'bar' <ide> assert_kind_of Arel::Nodes::InnerJoin, join <ide> assert_equal 'foo', join.left <ide> assert_equal 'bar', join.right <ide> end <ide> <ide> it 'should create join nodes with a full outer join klass' do <del> relation = Arel::SelectManager.new Table.engine <add> relation = Arel::SelectManager.new <ide> join = relation.create_join 'foo', 'bar', Arel::Nodes::FullOuterJoin <ide> assert_kind_of Arel::Nodes::FullOuterJoin, join <ide> assert_equal 'foo', join.left <ide> assert_equal 'bar', join.right <ide> end <ide> <ide> it 'should create join nodes with a outer join klass' do <del> relation = Arel::SelectManager.new Table.engine <add> relation = Arel::SelectManager.new <ide> join = relation.create_join 'foo', 'bar', Arel::Nodes::OuterJoin <ide> assert_kind_of Arel::Nodes::OuterJoin, join <ide> assert_equal 'foo', join.left <ide> assert_equal 'bar', join.right <ide> end <ide> <ide> it 'should create join nodes with a right outer join klass' do <del> relation = Arel::SelectManager.new Table.engine <add> relation = Arel::SelectManager.new <ide> join = relation.create_join 'foo', 'bar', Arel::Nodes::RightOuterJoin <ide> assert_kind_of Arel::Nodes::RightOuterJoin, join <ide> assert_equal 'foo', join.left <ide> def test_manager_stores_bind_values <ide> left = Table.new :users <ide> right = left.alias <ide> predicate = left[:id].eq(right[:id]) <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> <ide> manager.from left <ide> manager.join(right).on(predicate) <ide> def test_manager_stores_bind_values <ide> left = Table.new :users <ide> right = left.alias <ide> predicate = left[:id].eq(right[:id]) <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> <ide> manager.from left <ide> manager.join(right, Nodes::OuterJoin).on(predicate) <ide> def test_manager_stores_bind_values <ide> end <ide> <ide> it 'noops on nil' do <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.join(nil).must_equal manager <ide> end <ide> end <ide> def test_manager_stores_bind_values <ide> left = Table.new :users <ide> right = left.alias <ide> predicate = left[:id].eq(right[:id]) <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> <ide> manager.from left <ide> manager.outer_join(right).on(predicate) <ide> def test_manager_stores_bind_values <ide> end <ide> <ide> it 'noops on nil' do <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.outer_join(nil).must_equal manager <ide> end <ide> end <ide> def test_manager_stores_bind_values <ide> it 'returns inner join sql' do <ide> table = Table.new :users <ide> aliaz = table.alias <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.from Nodes::InnerJoin.new(aliaz, table[:id].eq(aliaz[:id])) <ide> assert_match 'INNER JOIN "users" "users_2" "users"."id" = "users_2"."id"', <ide> manager.to_sql <ide> def test_manager_stores_bind_values <ide> it 'returns outer join sql' do <ide> table = Table.new :users <ide> aliaz = table.alias <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.from Nodes::OuterJoin.new(aliaz, table[:id].eq(aliaz[:id])) <ide> assert_match 'LEFT OUTER JOIN "users" "users_2" "users"."id" = "users_2"."id"', <ide> manager.to_sql <ide> def test_manager_stores_bind_values <ide> users = Table.new :users <ide> comments = Table.new :comments <ide> <del> counts = comments.from(comments). <add> counts = comments.from. <ide> group(comments[:user_id]). <ide> project( <ide> comments[:user_id].as("user_id"), <ide> def test_manager_stores_bind_values <ide> end <ide> <ide> it 'returns string join sql' do <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.from Nodes::StringJoin.new(Nodes.build_quoted('hello')) <ide> assert_match "'hello'", manager.to_sql <ide> end <ide> def test_manager_stores_bind_values <ide> describe 'group' do <ide> it 'takes an attribute' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.from table <ide> manager.group table[:id] <ide> manager.to_sql.must_be_like %{ <ide> def test_manager_stores_bind_values <ide> <ide> it 'chains' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.group(table[:id]).must_equal manager <ide> end <ide> <ide> it 'takes multiple args' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.from table <ide> manager.group table[:id], table[:name] <ide> manager.to_sql.must_be_like %{ <ide> def test_manager_stores_bind_values <ide> # FIXME: backwards compat <ide> it 'makes strings literals' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.from table <ide> manager.group 'foo' <ide> manager.to_sql.must_be_like %{ SELECT FROM "users" GROUP BY foo } <ide> def test_manager_stores_bind_values <ide> describe 'window definition' do <ide> it 'can be empty' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.from table <ide> manager.window('a_window') <ide> manager.to_sql.must_be_like %{ <ide> def test_manager_stores_bind_values <ide> <ide> it 'takes an order' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.from table <ide> manager.window('a_window').order(table['foo'].asc) <ide> manager.to_sql.must_be_like %{ <ide> def test_manager_stores_bind_values <ide> <ide> it 'takes an order with multiple columns' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.from table <ide> manager.window('a_window').order(table['foo'].asc, table['bar'].desc) <ide> manager.to_sql.must_be_like %{ <ide> def test_manager_stores_bind_values <ide> <ide> it 'takes a partition' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.from table <ide> manager.window('a_window').partition(table['bar']) <ide> manager.to_sql.must_be_like %{ <ide> def test_manager_stores_bind_values <ide> <ide> it 'takes a partition and an order' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.from table <ide> manager.window('a_window').partition(table['foo']).order(table['foo'].asc) <ide> manager.to_sql.must_be_like %{ <ide> def test_manager_stores_bind_values <ide> <ide> it 'takes a partition with multiple columns' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.from table <ide> manager.window('a_window').partition(table['bar'], table['baz']) <ide> manager.to_sql.must_be_like %{ <ide> def test_manager_stores_bind_values <ide> <ide> it 'takes a rows frame, unbounded preceding' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.from table <ide> manager.window('a_window').rows(Arel::Nodes::Preceding.new) <ide> manager.to_sql.must_be_like %{ <ide> def test_manager_stores_bind_values <ide> <ide> it 'takes a rows frame, bounded preceding' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.from table <ide> manager.window('a_window').rows(Arel::Nodes::Preceding.new(5)) <ide> manager.to_sql.must_be_like %{ <ide> def test_manager_stores_bind_values <ide> <ide> it 'takes a rows frame, unbounded following' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.from table <ide> manager.window('a_window').rows(Arel::Nodes::Following.new) <ide> manager.to_sql.must_be_like %{ <ide> def test_manager_stores_bind_values <ide> <ide> it 'takes a rows frame, bounded following' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.from table <ide> manager.window('a_window').rows(Arel::Nodes::Following.new(5)) <ide> manager.to_sql.must_be_like %{ <ide> def test_manager_stores_bind_values <ide> <ide> it 'takes a rows frame, current row' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.from table <ide> manager.window('a_window').rows(Arel::Nodes::CurrentRow.new) <ide> manager.to_sql.must_be_like %{ <ide> def test_manager_stores_bind_values <ide> <ide> it 'takes a rows frame, between two delimiters' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.from table <ide> window = manager.window('a_window') <ide> window.frame( <ide> def test_manager_stores_bind_values <ide> <ide> it 'takes a range frame, unbounded preceding' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.from table <ide> manager.window('a_window').range(Arel::Nodes::Preceding.new) <ide> manager.to_sql.must_be_like %{ <ide> def test_manager_stores_bind_values <ide> <ide> it 'takes a range frame, bounded preceding' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.from table <ide> manager.window('a_window').range(Arel::Nodes::Preceding.new(5)) <ide> manager.to_sql.must_be_like %{ <ide> def test_manager_stores_bind_values <ide> <ide> it 'takes a range frame, unbounded following' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.from table <ide> manager.window('a_window').range(Arel::Nodes::Following.new) <ide> manager.to_sql.must_be_like %{ <ide> def test_manager_stores_bind_values <ide> <ide> it 'takes a range frame, bounded following' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.from table <ide> manager.window('a_window').range(Arel::Nodes::Following.new(5)) <ide> manager.to_sql.must_be_like %{ <ide> def test_manager_stores_bind_values <ide> <ide> it 'takes a range frame, current row' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.from table <ide> manager.window('a_window').range(Arel::Nodes::CurrentRow.new) <ide> manager.to_sql.must_be_like %{ <ide> def test_manager_stores_bind_values <ide> <ide> it 'takes a range frame, between two delimiters' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.from table <ide> window = manager.window('a_window') <ide> window.frame( <ide> def test_manager_stores_bind_values <ide> describe 'delete' do <ide> it "copies from" do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.from table <ide> stmt = manager.compile_delete <ide> <ide> def test_manager_stores_bind_values <ide> <ide> it "copies where" do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.from table <ide> manager.where table[:id].eq 10 <ide> stmt = manager.compile_delete <ide> def test_manager_stores_bind_values <ide> describe 'where_sql' do <ide> it 'gives me back the where sql' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.from table <ide> manager.where table[:id].eq 10 <ide> manager.where_sql.must_be_like %{ WHERE "users"."id" = 10 } <ide> end <ide> <ide> it 'returns nil when there are no wheres' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.from table <ide> manager.where_sql.must_be_nil <ide> end <ide> def test_manager_stores_bind_values <ide> <ide> it 'creates an update statement' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.from table <ide> stmt = manager.compile_update({table[:id] => 1}, Arel::Attributes::Attribute.new(table, 'id')) <ide> <ide> def test_manager_stores_bind_values <ide> <ide> it 'takes a string' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.from table <ide> stmt = manager.compile_update(Nodes::SqlLiteral.new('foo = bar'), Arel::Attributes::Attribute.new(table, 'id')) <ide> <ide> def test_manager_stores_bind_values <ide> <ide> it 'copies limits' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.from table <ide> manager.take 1 <ide> stmt = manager.compile_update(Nodes::SqlLiteral.new('foo = bar'), Arel::Attributes::Attribute.new(table, 'id')) <ide> def test_manager_stores_bind_values <ide> <ide> it 'copies order' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.from table <ide> manager.order :foo <ide> stmt = manager.compile_update(Nodes::SqlLiteral.new('foo = bar'), Arel::Attributes::Attribute.new(table, 'id')) <ide> def test_manager_stores_bind_values <ide> <ide> it 'copies where clauses' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.where table[:id].eq 10 <ide> manager.from table <ide> stmt = manager.compile_update({table[:id] => 1}, Arel::Attributes::Attribute.new(table, 'id')) <ide> def test_manager_stores_bind_values <ide> <ide> it 'copies where clauses when nesting is triggered' do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.where table[:foo].eq 10 <ide> manager.take 42 <ide> manager.from table <ide> def test_manager_stores_bind_values <ide> <ide> describe 'project' do <ide> it "takes sql literals" do <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.project Nodes::SqlLiteral.new '*' <ide> manager.to_sql.must_be_like %{ SELECT * } <ide> end <ide> <ide> it 'takes multiple args' do <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.project Nodes::SqlLiteral.new('foo'), <ide> Nodes::SqlLiteral.new('bar') <ide> manager.to_sql.must_be_like %{ SELECT foo, bar } <ide> end <ide> <ide> it 'takes strings' do <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.project '*' <ide> manager.to_sql.must_be_like %{ SELECT * } <ide> end <ide> def test_manager_stores_bind_values <ide> <ide> describe 'projections' do <ide> it 'reads projections' do <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.project Arel.sql('foo'), Arel.sql('bar') <ide> manager.projections.must_equal [Arel.sql('foo'), Arel.sql('bar')] <ide> end <ide> end <ide> <ide> describe 'projections=' do <ide> it 'overwrites projections' do <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.project Arel.sql('foo') <ide> manager.projections = [Arel.sql('bar')] <ide> manager.to_sql.must_be_like %{ SELECT bar } <ide> def test_manager_stores_bind_values <ide> describe 'take' do <ide> it "knows take" do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.from(table).project(table['id']) <ide> manager.where(table['id'].eq(1)) <ide> manager.take 1 <ide> def test_manager_stores_bind_values <ide> end <ide> <ide> it "chains" do <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.take(1).must_equal manager <ide> end <ide> <ide> it 'removes LIMIT when nil is passed' do <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.limit = 10 <ide> assert_match('LIMIT', manager.to_sql) <ide> <ide> def test_manager_stores_bind_values <ide> describe 'where' do <ide> it "knows where" do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.from(table).project(table['id']) <ide> manager.where(table['id'].eq(1)) <ide> manager.to_sql.must_be_like %{ <ide> def test_manager_stores_bind_values <ide> <ide> it "chains" do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.from(table) <ide> manager.project(table['id']).where(table['id'].eq 1).must_equal manager <ide> end <ide> def test_manager_stores_bind_values <ide> describe 'from' do <ide> it "makes sql" do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> <ide> manager.from table <ide> manager.project table['id'] <ide> def test_manager_stores_bind_values <ide> <ide> it "chains" do <ide> table = Table.new :users <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.from(table).project(table['id']).must_equal manager <ide> manager.to_sql.must_be_like 'SELECT "users"."id" FROM "users"' <ide> end <ide> end <ide> <ide> describe 'source' do <ide> it 'returns the join source of the select core' do <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.source.must_equal manager.ast.cores.last.source <ide> end <ide> end <ide> <ide> describe 'distinct' do <ide> it 'sets the quantifier' do <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> <ide> manager.distinct <ide> manager.ast.cores.last.set_quantifier.class.must_equal Arel::Nodes::Distinct <ide> def test_manager_stores_bind_values <ide> end <ide> <ide> it "chains" do <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> manager.distinct.must_equal manager <ide> manager.distinct(false).must_equal manager <ide> end <ide> end <ide> <ide> describe 'distinct_on' do <ide> it 'sets the quantifier' do <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> table = Table.new :users <ide> <ide> manager.distinct_on(table['id']) <ide> def test_manager_stores_bind_values <ide> end <ide> <ide> it "chains" do <del> manager = Arel::SelectManager.new Table.engine <add> manager = Arel::SelectManager.new <ide> table = Table.new :users <ide> <ide> manager.distinct_on(table['id']).must_equal manager <ide><path>test/test_table.rb <ide> module Arel <ide> @relation.table_name.must_equal 'users' <ide> end <ide> <del> it "should have an engine" do <del> @relation.engine.must_equal Table.engine <del> end <del> <ide> describe '[]' do <ide> describe 'when given a Symbol' do <ide> it "manufactures an attribute if the symbol names an attribute within the relation" do <ide><path>test/test_update_manager.rb <ide> module Arel <ide> describe 'update manager' do <ide> describe 'new' do <ide> it 'takes an engine' do <del> Arel::UpdateManager.new Table.engine <add> Arel::UpdateManager.new <ide> end <ide> end <ide> <ide> it "should not quote sql literals" do <ide> table = Table.new(:users) <del> um = Arel::UpdateManager.new Table.engine <add> um = Arel::UpdateManager.new <ide> um.table table <ide> um.set [[table[:name], Arel::Nodes::BindParam.new]] <ide> um.to_sql.must_be_like %{ UPDATE "users" SET "name" = ? } <ide> end <ide> <ide> it 'handles limit properly' do <ide> table = Table.new(:users) <del> um = Arel::UpdateManager.new Table.engine <add> um = Arel::UpdateManager.new <ide> um.key = 'id' <ide> um.take 10 <ide> um.table table <ide> module Arel <ide> describe 'set' do <ide> it "updates with null" do <ide> table = Table.new(:users) <del> um = Arel::UpdateManager.new Table.engine <add> um = Arel::UpdateManager.new <ide> um.table table <ide> um.set [[table[:name], nil]] <ide> um.to_sql.must_be_like %{ UPDATE "users" SET "name" = NULL } <ide> end <ide> <ide> it 'takes a string' do <ide> table = Table.new(:users) <del> um = Arel::UpdateManager.new Table.engine <add> um = Arel::UpdateManager.new <ide> um.table table <ide> um.set Nodes::SqlLiteral.new "foo = bar" <ide> um.to_sql.must_be_like %{ UPDATE "users" SET foo = bar } <ide> end <ide> <ide> it 'takes a list of lists' do <ide> table = Table.new(:users) <del> um = Arel::UpdateManager.new Table.engine <add> um = Arel::UpdateManager.new <ide> um.table table <ide> um.set [[table[:id], 1], [table[:name], 'hello']] <ide> um.to_sql.must_be_like %{ <ide> module Arel <ide> <ide> it 'chains' do <ide> table = Table.new(:users) <del> um = Arel::UpdateManager.new Table.engine <add> um = Arel::UpdateManager.new <ide> um.set([[table[:id], 1], [table[:name], 'hello']]).must_equal um <ide> end <ide> end <ide> <ide> describe 'table' do <ide> it 'generates an update statement' do <del> um = Arel::UpdateManager.new Table.engine <add> um = Arel::UpdateManager.new <ide> um.table Table.new(:users) <ide> um.to_sql.must_be_like %{ UPDATE "users" } <ide> end <ide> <ide> it 'chains' do <del> um = Arel::UpdateManager.new Table.engine <add> um = Arel::UpdateManager.new <ide> um.table(Table.new(:users)).must_equal um <ide> end <ide> <ide> it 'generates an update statement with joins' do <del> um = Arel::UpdateManager.new Table.engine <add> um = Arel::UpdateManager.new <ide> <ide> table = Table.new(:users) <ide> join_source = Arel::Nodes::JoinSource.new( <ide> module Arel <ide> describe 'where' do <ide> it 'generates a where clause' do <ide> table = Table.new :users <del> um = Arel::UpdateManager.new Table.engine <add> um = Arel::UpdateManager.new <ide> um.table table <ide> um.where table[:id].eq(1) <ide> um.to_sql.must_be_like %{ <ide> module Arel <ide> <ide> it 'chains' do <ide> table = Table.new :users <del> um = Arel::UpdateManager.new Table.engine <add> um = Arel::UpdateManager.new <ide> um.table table <ide> um.where(table[:id].eq(1)).must_equal um <ide> end <ide> module Arel <ide> describe 'key' do <ide> before do <ide> @table = Table.new :users <del> @um = Arel::UpdateManager.new Table.engine <add> @um = Arel::UpdateManager.new <ide> @um.key = @table[:foo] <ide> end <ide> <ide><path>test/visitors/test_bind_visitor.rb <ide> def setup <ide> # substitutes binds with values from block <ide> def test_assignment_binds_are_substituted <ide> table = Table.new(:users) <del> um = Arel::UpdateManager.new Table.engine <add> um = Arel::UpdateManager.new <ide> bp = Nodes::BindParam.new <ide> um.set [[table[:name], bp]] <ide> visitor = Class.new(Arel::Visitors::ToSql) {
17
Text
Text
add 0.66.4 changelog
896a5c92305066c4e2dc1abe2621c3f3120811be
<ide><path>CHANGELOG.md <ide> # Changelog <ide> <add>## v0.66.4 <add> <add>### Fixed <add> <add>#### iOS specific <add> <add>- Revert "Fix Deadlock in RCTi18nUtil (iOS)" ([70ddf46](https://github.com/facebook/react-native/commit/70ddf46c8afcd720e188b6d82568eac6ac8125e6) by [@Saadnajmi](https://github.com/Saadnajmi)) <add>- `apply_Xcode_12_5_M1_post_install_workaround` causing pods targetting iOS 12 and above to fail ([a4a3e67554](https://github.com/facebook/react-native/commit/a4a3e675542827bb281a7ceccc7b8f5533eae29f) by [@Yonom](https://github.com/Yonom)) <add> <ide> ## v0.66.3 <ide> <ide> ### Changed
1
Python
Python
fix formatting and remove unused imports
1101fd3855c90ece679e4b9af37c5f3f5dc343eb
<ide><path>spacy/en/__init__.py <ide> # coding: utf8 <del>from __future__ import unicode_literals, print_function <add>from __future__ import unicode_literals <ide> <del>from os import path <ide> from ..language import Language <ide> from ..lemmatizer import Lemmatizer <ide> from ..vocab import Vocab <ide> <ide> from .language_data import * <ide> <add> <ide> try: <ide> basestring <ide> except NameError:
1
Ruby
Ruby
install plists in formulainstaller, not build.rb
523f50862bf41886688521ae4a3acf68ca0c264b
<ide><path>Library/Homebrew/build.rb <ide> def install f <ide> f.prefix.mkpath <ide> f.install <ide> <del> # Install a plist if one is defined <del> unless f.startup_plist.nil? <del> unless f.plist_path.exist? <del> f.plist_path.write f.startup_plist <del> f.plist_path.chmod 0644 <del> end <del> end <del> <ide> # Find and link metafiles <ide> FORMULA_META_FILES.each do |filename| <ide> next if File.directory? filename <ide><path>Library/Homebrew/formula_installer.rb <ide> def finish <ide> check_PATH unless f.keg_only? <ide> end <ide> <add> install_plist <ide> fix_install_names <ide> <ide> ohai "Summary" if ARGV.verbose? or show_summary_heading <ide> def link <ide> end <ide> end <ide> <add> def install_plist <add> # Install a plist if one is defined <add> if f.startup_plist and not f.plist_path.exist? <add> f.plist_path.write f.startup_plist <add> f.plist_path.chmod 0644 <add> end <add> end <add> <ide> def fix_install_names <ide> Keg.new(f.prefix).fix_install_names <ide> rescue Exception => e
2
Java
Java
fix javadoc warnings of buffer(publisher|callable)
f671b57b11845af04cc110792550ecc4f5464712
<ide><path>src/main/java/io/reactivex/Flowable.java <ide> public final <B, U extends Collection<? super T>> Flowable<U> buffer(Publisher<B <ide> * new buffer whenever the Publisher produced by the specified {@code boundaryIndicatorSupplier} emits an item. <ide> * <p> <ide> * <img width="640" height="395" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/buffer1.png" alt=""> <del> * <dl> <del> * If either the source Publisher or the boundary Publisher issues an onError notification the event is passed on <add> * <p> <add> * If either the source {@code Publisher} or the boundary {@code Publisher} issues an {@code onError} notification the event is passed on <ide> * immediately without first emitting the buffer it is in the process of assembling. <add> * <dl> <ide> * <dt><b>Backpressure:</b></dt> <ide> * <dd>This operator does not support backpressure as it is instead controlled by the given Publishers and <ide> * buffers data. It requests {@code Long.MAX_VALUE} upstream and does not obey downstream requests.</dd> <ide> public final <B, U extends Collection<? super T>> Flowable<U> buffer(Publisher<B <ide> @SchedulerSupport(SchedulerSupport.NONE) <ide> public final <B> Flowable<List<T>> buffer(Callable<? extends Publisher<B>> boundaryIndicatorSupplier) { <ide> return buffer(boundaryIndicatorSupplier, ArrayListSupplier.<T>asCallable()); <del> <ide> } <ide> <ide> /** <ide> public final <B> Flowable<List<T>> buffer(Callable<? extends Publisher<B>> bound <ide> * new buffer whenever the Publisher produced by the specified {@code boundaryIndicatorSupplier} emits an item. <ide> * <p> <ide> * <img width="640" height="395" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/buffer1.png" alt=""> <del> * <dl> <del> * If either the source Publisher or the boundary Publisher issues an onError notification the event is passed on <add> * <p> <add> * If either the source {@code Publisher} or the boundary {@code Publisher} issues an {@code onError} notification the event is passed on <ide> * immediately without first emitting the buffer it is in the process of assembling. <add> * <dl> <ide> * <dt><b>Backpressure:</b></dt> <ide> * <dd>This operator does not support backpressure as it is instead controlled by the given Publishers and <ide> * buffers data. It requests {@code Long.MAX_VALUE} upstream and does not obey downstream requests.</dd> <ide><path>src/main/java/io/reactivex/Observable.java <ide> public final <B, U extends Collection<? super T>> Observable<U> buffer(Observabl <ide> * new buffer whenever the ObservableSource produced by the specified {@code boundarySupplier} emits an item. <ide> * <p> <ide> * <img width="640" height="395" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/buffer1.png" alt=""> <del> * <dl> <del> * If either the source ObservableSource or the boundary ObservableSource issues an onError notification the event <add> * <p> <add> * If either the source {@code ObservableSource} or the boundary {@code ObservableSource} issues an {@code onError} notification the event <ide> * is passed on immediately without first emitting the buffer it is in the process of assembling. <add> * <dl> <ide> * <dt><b>Scheduler:</b></dt> <ide> * <dd>This version of {@code buffer} does not operate by default on a particular {@link Scheduler}.</dd> <ide> * </dl> <ide> public final <B, U extends Collection<? super T>> Observable<U> buffer(Observabl <ide> @SchedulerSupport(SchedulerSupport.NONE) <ide> public final <B> Observable<List<T>> buffer(Callable<? extends ObservableSource<B>> boundarySupplier) { <ide> return buffer(boundarySupplier, ArrayListSupplier.<T>asCallable()); <del> <ide> } <ide> <ide> /** <ide> public final <B> Observable<List<T>> buffer(Callable<? extends ObservableSource< <ide> * new buffer whenever the ObservableSource produced by the specified {@code boundarySupplier} emits an item. <ide> * <p> <ide> * <img width="640" height="395" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/buffer1.png" alt=""> <del> * <dl> <del> * If either the source ObservableSource or the boundary ObservableSource issues an onError notification the event <add> * <p> <add> * If either the source {@code ObservableSource} or the boundary {@code ObservableSource} issues an {@code onError} notification the event <ide> * is passed on immediately without first emitting the buffer it is in the process of assembling. <add> * <dl> <ide> * <dt><b>Scheduler:</b></dt> <ide> * <dd>This version of {@code buffer} does not operate by default on a particular {@link Scheduler}.</dd> <ide> * </dl>
2
PHP
PHP
fix function check
e80be6d389096a07175513c84101a4bef8c565cb
<ide><path>src/Illuminate/Support/helpers.php <ide> function object_get($object, $key, $default = null) <ide> } <ide> } <ide> <del>if ( ! function_exists('preg_replace_array')) <add>if ( ! function_exists('preg_replace_sub')) <ide> { <ide> /** <ide> * Replace a given pattern with each value in the array in sequentially.
1
Java
Java
add buffercontent option to mockrestserviceserver
541ee13934cf8c1dfcbcfadce2bb6299bd25900c
<ide><path>spring-test/src/main/java/org/springframework/test/web/client/MockRestServiceServer.java <ide> /* <del> * Copyright 2002-2017 the original author or authors. <add> * Copyright 2002-2018 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> import java.net.URI; <ide> <ide> import org.springframework.http.HttpMethod; <add>import org.springframework.http.client.BufferingClientHttpRequestFactory; <ide> import org.springframework.http.client.ClientHttpRequest; <ide> import org.springframework.http.client.ClientHttpRequestFactory; <ide> import org.springframework.http.client.ClientHttpResponse; <ide> public interface MockRestServiceServerBuilder { <ide> */ <ide> MockRestServiceServerBuilder ignoreExpectOrder(boolean ignoreExpectOrder); <ide> <add> /** <add> * Use the {@link BufferingClientHttpRequestFactory} wrapper to buffer <add> * the input and output streams, and for example, allow multiple reads <add> * of the response body. <add> * @since 5.0.5 <add> */ <add> MockRestServiceServerBuilder bufferContent(); <add> <ide> /** <ide> * Build the {@code MockRestServiceServer} and set up the underlying <ide> * {@code RestTemplate} or {@code AsyncRestTemplate} with a <ide> private static class DefaultBuilder implements MockRestServiceServerBuilder { <ide> <ide> private boolean ignoreExpectOrder; <ide> <add> private boolean bufferContent; <add> <add> <ide> public DefaultBuilder(RestTemplate restTemplate) { <ide> Assert.notNull(restTemplate, "RestTemplate must not be null"); <ide> this.restTemplate = restTemplate; <ide> public MockRestServiceServerBuilder ignoreExpectOrder(boolean ignoreExpectOrder) <ide> return this; <ide> } <ide> <add> @Override <add> public MockRestServiceServerBuilder bufferContent() { <add> this.bufferContent = true; <add> return this; <add> } <add> <ide> @Override <ide> public MockRestServiceServer build() { <ide> if (this.ignoreExpectOrder) { <ide> public MockRestServiceServer build(RequestExpectationManager manager) { <ide> MockRestServiceServer server = new MockRestServiceServer(manager); <ide> MockClientHttpRequestFactory factory = server.new MockClientHttpRequestFactory(); <ide> if (this.restTemplate != null) { <del> this.restTemplate.setRequestFactory(factory); <add> if (this.bufferContent) { <add> this.restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(factory)); <add> } <add> else { <add> this.restTemplate.setRequestFactory(factory); <add> } <ide> } <ide> if (this.asyncRestTemplate != null) { <ide> this.asyncRestTemplate.setAsyncRequestFactory(factory); <ide><path>spring-test/src/test/java/org/springframework/test/web/client/samples/SampleTests.java <ide> */ <ide> package org.springframework.test.web.client.samples; <ide> <add>import java.io.IOException; <add>import java.util.Collections; <add> <ide> import org.junit.Before; <ide> import org.junit.Test; <ide> <ide> import org.springframework.core.io.ClassPathResource; <ide> import org.springframework.core.io.Resource; <ide> import org.springframework.http.HttpMethod; <add>import org.springframework.http.HttpRequest; <ide> import org.springframework.http.MediaType; <add>import org.springframework.http.client.ClientHttpRequestExecution; <add>import org.springframework.http.client.ClientHttpRequestInterceptor; <add>import org.springframework.http.client.ClientHttpResponse; <ide> import org.springframework.test.web.Person; <ide> import org.springframework.test.web.client.MockRestServiceServer; <add>import org.springframework.util.FileCopyUtils; <ide> import org.springframework.web.client.RestTemplate; <ide> <del>import static org.junit.Assert.assertTrue; <add>import static org.junit.Assert.*; <ide> import static org.springframework.test.web.client.ExpectedCount.manyTimes; <ide> import static org.springframework.test.web.client.ExpectedCount.never; <ide> import static org.springframework.test.web.client.ExpectedCount.once; <ide> public void setup() { <ide> } <ide> <ide> @Test <del> public void performGet() throws Exception { <add> public void performGet() { <ide> <ide> String responseBody = "{\"name\" : \"Ludwig van Beethoven\", \"someDouble\" : \"1.6035\"}"; <ide> <ide> public void performGet() throws Exception { <ide> } <ide> <ide> @Test <del> public void performGetManyTimes() throws Exception { <add> public void performGetManyTimes() { <ide> <ide> String responseBody = "{\"name\" : \"Ludwig van Beethoven\", \"someDouble\" : \"1.6035\"}"; <ide> <ide> public void performGetManyTimes() throws Exception { <ide> } <ide> <ide> @Test <del> public void expectNever() throws Exception { <add> public void expectNever() { <ide> <ide> String responseBody = "{\"name\" : \"Ludwig van Beethoven\", \"someDouble\" : \"1.6035\"}"; <ide> <ide> public void expectNever() throws Exception { <ide> } <ide> <ide> @Test(expected = AssertionError.class) <del> public void expectNeverViolated() throws Exception { <add> public void expectNeverViolated() { <ide> <ide> String responseBody = "{\"name\" : \"Ludwig van Beethoven\", \"someDouble\" : \"1.6035\"}"; <ide> <ide> public void expectNeverViolated() throws Exception { <ide> } <ide> <ide> @Test <del> public void performGetWithResponseBodyFromFile() throws Exception { <add> public void performGetWithResponseBodyFromFile() { <ide> <ide> Resource responseBody = new ClassPathResource("ludwig.json", this.getClass()); <ide> <ide> public void verify() { <ide> assertTrue(error.getMessage(), error.getMessage().contains("2 unsatisfied expectation(s)")); <ide> } <ide> } <add> <add> @Test // SPR-14694 <add> public void repeatedAccessToResponseViaResource() { <add> <add> Resource resource = new ClassPathResource("ludwig.json", this.getClass()); <add> <add> RestTemplate restTemplate = new RestTemplate(); <add> restTemplate.setInterceptors(Collections.singletonList(new ContentInterceptor(resource))); <add> <add> MockRestServiceServer mockServer = MockRestServiceServer.bindTo(restTemplate) <add> .ignoreExpectOrder(true) <add> .bufferContent() // enable repeated reads of response body <add> .build(); <add> <add> mockServer.expect(requestTo("/composers/42")).andExpect(method(HttpMethod.GET)) <add> .andRespond(withSuccess(resource, MediaType.APPLICATION_JSON)); <add> <add> restTemplate.getForObject("/composers/{id}", Person.class, 42); <add> <add> mockServer.verify(); <add> } <add> <add> <add> private static class ContentInterceptor implements ClientHttpRequestInterceptor { <add> <add> private final Resource resource; <add> <add> <add> private ContentInterceptor(Resource resource) { <add> this.resource = resource; <add> } <add> <add> @Override <add> public ClientHttpResponse intercept(HttpRequest request, byte[] body, <add> ClientHttpRequestExecution execution) throws IOException { <add> <add> ClientHttpResponse response = execution.execute(request, body); <add> byte[] expected = FileCopyUtils.copyToByteArray(this.resource.getInputStream()); <add> byte[] actual = FileCopyUtils.copyToByteArray(response.getBody()); <add> assertEquals(new String(expected), new String(actual)); <add> return response; <add> } <add> } <add> <ide> }
2
Text
Text
add contributor agreement
a90ca0e1fbf2dff4f5750613240d95f1154e326f
<ide><path>.github/contributors/rafguns.md <add># spaCy contributor agreement <add> <add>This spaCy Contributor Agreement (**"SCA"**) is based on the <add>[Oracle Contributor Agreement](http://www.oracle.com/technetwork/oca-405177.pdf). <add>The SCA applies to any contribution that you make to any product or project <add>managed by us (the **"project"**), and sets out the intellectual property rights <add>you grant to us in the contributed materials. The term **"us"** shall mean <add>[ExplosionAI GmbH](https://explosion.ai/legal). The term <add>**"you"** shall mean the person or entity identified below. <add> <add>If you agree to be bound by these terms, fill in the information requested <add>below and include the filled-in version with your first pull request, under the <add>folder [`.github/contributors/`](/.github/contributors/). The name of the file <add>should be your GitHub username, with the extension `.md`. For example, the user <add>example_user would create the file `.github/contributors/example_user.md`. <add> <add>Read this agreement carefully before signing. These terms and conditions <add>constitute a binding legal agreement. <add> <add>## Contributor Agreement <add> <add>1. The term "contribution" or "contributed materials" means any source code, <add>object code, patch, tool, sample, graphic, specification, manual, <add>documentation, or any other material posted or submitted by you to the project. <add> <add>2. With respect to any worldwide copyrights, or copyright applications and <add>registrations, in your contribution: <add> <add> * you hereby assign to us joint ownership, and to the extent that such <add> assignment is or becomes invalid, ineffective or unenforceable, you hereby <add> grant to us a perpetual, irrevocable, non-exclusive, worldwide, no-charge, <add> royalty-free, unrestricted license to exercise all rights under those <add> copyrights. This includes, at our option, the right to sublicense these same <add> rights to third parties through multiple levels of sublicensees or other <add> licensing arrangements; <add> <add> * you agree that each of us can do all things in relation to your <add> contribution as if each of us were the sole owners, and if one of us makes <add> a derivative work of your contribution, the one who makes the derivative <add> work (or has it made will be the sole owner of that derivative work; <add> <add> * you agree that you will not assert any moral rights in your contribution <add> against us, our licensees or transferees; <add> <add> * you agree that we may register a copyright in your contribution and <add> exercise all ownership rights associated with it; and <add> <add> * you agree that neither of us has any duty to consult with, obtain the <add> consent of, pay or render an accounting to the other for any use or <add> distribution of your contribution. <add> <add>3. With respect to any patents you own, or that you can license without payment <add>to any third party, you hereby grant to us a perpetual, irrevocable, <add>non-exclusive, worldwide, no-charge, royalty-free license to: <add> <add> * make, have made, use, sell, offer to sell, import, and otherwise transfer <add> your contribution in whole or in part, alone or in combination with or <add> included in any product, work or materials arising out of the project to <add> which your contribution was submitted, and <add> <add> * at our option, to sublicense these same rights to third parties through <add> multiple levels of sublicensees or other licensing arrangements. <add> <add>4. Except as set out above, you keep all right, title, and interest in your <add>contribution. The rights that you grant to us under these terms are effective <add>on the date you first submitted a contribution to us, even if your submission <add>took place before the date you sign these terms. <add> <add>5. You covenant, represent, warrant and agree that: <add> <add> * Each contribution that you submit is and shall be an original work of <add> authorship and you can legally grant the rights set out in this SCA; <add> <add> * to the best of your knowledge, each contribution will not violate any <add> third party's copyrights, trademarks, patents, or other intellectual <add> property rights; and <add> <add> * each contribution shall be in compliance with U.S. export control laws and <add> other applicable export and import laws. You agree to notify us if you <add> become aware of any circumstance which would make any of the foregoing <add> representations inaccurate in any respect. We may publicly disclose your <add> participation in the project, including the fact that you have signed the SCA. <add> <add>6. This SCA is governed by the laws of the State of California and applicable <add>U.S. Federal law. Any choice of law rules will not apply. <add> <add>7. Please place an “x” on one of the applicable statement below. Please do NOT <add>mark both statements: <add> <add> * [x] I am signing on behalf of myself as an individual and no other person <add> or entity, including my employer, has or will have rights with respect to my <add> contributions. <add> <add> * [ ] I am signing on behalf of my employer or a legal entity and I have the <add> actual authority to contractually bind that entity. <add> <add>## Contributor Details <add> <add>| Field | Entry | <add>|------------------------------- | -------------------- | <add>| Name | Raf Guns | <add>| Company name (if applicable) | | <add>| Title or role (if applicable) | | <add>| Date | 2020-12-09 | <add>| GitHub username | rafguns | <add>| Website (optional) | |
1
Text
Text
add a note about expiring otp codes
241c4467eef7c2a8858c96d5dfe4e8ef84c47bad
<ide><path>scripts/release/README.md <ide> Once the canary has been checked out and tested locally, you're ready to publish <ide> scripts/release/publish.js --tags next <ide> ``` <ide> <add>If the OTP code expires while publishing, re-run this command and answer "y" to the questions about whether it was expected for already published packages. <add> <ide> <sup>1: You can omit the `build` param if you just want to release the latest commit as a canary.</sup> <ide> <ide> ## Publishing an Experimental Canary <ide> When publishing an experimental canary, use the `experimental` tag: <ide> scripts/release/publish.js --tags experimental <ide> ``` <ide> <add>If the OTP code expires while publishing, re-run this command and answer "y" to the questions about whether it was expected for already published packages. <add> <ide> ## Publishing a Stable Release <ide> <ide> Stable releases should always be created from a previously-released canary. This encourages better testing of the actual release artifacts and reduces the chance of unintended changes accidentally being included in a stable release. <ide> Once this step is complete, you're ready to publish the release: <ide> scripts/release/publish.js --tags next latest <ide> ``` <ide> <add>If the OTP code expires while publishing, re-run this command and answer "y" to the questions about whether it was expected for already published packages. <add> <ide> After successfully publishing the release, follow the on-screen instructions to ensure that all of the appropriate post-release steps are executed. <ide> <ide> <sup>1: You can omit the `version` param if you just want to promote the latest canary to stable.</sup>
1
Javascript
Javascript
use getactiveelement module
3f2ba221ef3cb514d15680b7736c37b016aa2064
<ide><path>src/core/ReactInputSelection.js <ide> <ide> var ReactDOMSelection = require('ReactDOMSelection'); <ide> <add>var getActiveElement = require('getActiveElement'); <ide> var nodeContains = require('nodeContains'); <ide> <del>// It is not safe to read the document.activeElement property in IE if there's <del>// nothing focused. <del>function getActiveElement() { <del> try { <del> return document.activeElement; <del> } catch (e) { <del> } <del>} <del> <ide> function isInDocument(node) { <ide> return nodeContains(document.documentElement, node); <ide> }
1
PHP
PHP
fix docblock on argument type
87e71db68fbf0d34fa1b1a729360b90f92806a2a
<ide><path>src/Illuminate/Validation/Concerns/FormatsMessages.php <ide> protected function getMessage($attribute, $rule) <ide> * <ide> * @param string $attribute <ide> * @param string $lowerRule <del> * @param array $source <add> * @param array|null $source <ide> * @return string|null <ide> */ <ide> protected function getFromLocalArray($attribute, $lowerRule, $source = null)
1
Javascript
Javascript
return this (line)
306a8f1d9c4522292b8ffff5e285c150e84253db
<ide><path>src/math/Box3.js <ide> Box3.prototype = { <ide> this.max.set( maxX, maxY, maxZ ); <ide> <ide> return this; <add> <ide> }, <ide> <ide> setFromBufferAttribute: function ( attribute ) {
1
Java
Java
fix warnings due to unused import statements
51b307681a8ee7d89180f58f967856b9c4bf9232
<ide><path>spring-aop/src/test/java/org/springframework/aop/interceptor/CustomizableTraceInterceptorTests.java <ide> /* <del> * Copyright 2002-2012 the original author or authors. <add> * Copyright 2002-2013 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> import static org.mockito.Mockito.times; <ide> import static org.mockito.Mockito.verify; <ide> <del>import java.lang.reflect.Method; <del> <ide> import org.aopalliance.intercept.MethodInvocation; <ide> import org.apache.commons.logging.Log; <ide> import org.junit.Test; <ide><path>spring-aop/src/test/java/org/springframework/aop/interceptor/SimpleTraceInterceptorTests.java <ide> /* <del> * Copyright 2002-2012 the original author or authors. <add> * Copyright 2002-2013 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> import static org.mockito.Mockito.times; <ide> import static org.mockito.Mockito.verify; <ide> <del>import java.lang.reflect.Method; <del> <ide> import org.aopalliance.intercept.MethodInvocation; <ide> import org.apache.commons.logging.Log; <ide> import org.junit.Test; <ide><path>spring-beans/src/test/java/org/springframework/beans/factory/support/BeanFactoryGenericsTests.java <ide> import org.springframework.tests.Assume; <ide> import org.springframework.tests.TestGroup; <ide> <del>import org.springframework.tests.Assume; <del>import org.springframework.tests.TestGroup; <ide> import org.springframework.tests.sample.beans.GenericBean; <ide> import org.springframework.tests.sample.beans.GenericIntegerBean; <ide> import org.springframework.tests.sample.beans.GenericSetOfIntegerBean; <ide><path>spring-beans/src/test/java/org/springframework/beans/support/PagedListHolderTests.java <ide> import org.springframework.tests.Assume; <ide> import org.springframework.tests.TestGroup; <ide> <del>import org.springframework.tests.Assume; <del>import org.springframework.tests.TestGroup; <ide> import org.springframework.tests.sample.beans.TestBean; <ide> <ide> import static org.junit.Assert.*; <ide><path>spring-beans/src/test/java/org/springframework/tests/beans/CollectingReaderEventListener.java <ide> /* <del> * Copyright 2002-2012 the original author or authors. <add> * Copyright 2002-2013 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> import org.springframework.beans.factory.parsing.DefaultsDefinition; <ide> import org.springframework.beans.factory.parsing.ImportDefinition; <ide> import org.springframework.beans.factory.parsing.ReaderEventListener; <del>import org.springframework.core.CollectionFactory; <ide> <ide> /** <ide> * @author Rob Harrop <ide><path>spring-context/src/test/java/org/springframework/ejb/access/SimpleRemoteSlsbInvokerInterceptorTests.java <ide> /* <del> * Copyright 2002-2012 the original author or authors. <add> * Copyright 2002-2013 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> <ide> import static org.junit.Assert.*; <ide> import static org.mockito.BDDMockito.given; <del>import static org.mockito.Mockito.atLeastOnce; <ide> import static org.mockito.Mockito.mock; <ide> import static org.mockito.Mockito.times; <ide> import static org.mockito.Mockito.verify; <ide><path>spring-jdbc/src/test/java/org/springframework/jdbc/core/AbstractRowMapperTests.java <ide> /* <del> * Copyright 2002-2012 the original author or authors. <add> * Copyright 2002-2013 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> import java.sql.Connection; <ide> import java.sql.ResultSet; <ide> import java.sql.ResultSetMetaData; <del>import java.sql.SQLException; <ide> import java.sql.Statement; <ide> import java.sql.Timestamp; <ide> <ide><path>spring-jdbc/src/test/java/org/springframework/jdbc/core/simple/TableMetaDataContextTests.java <add>/* <add> * Copyright 2002-2013 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add> <ide> package org.springframework.jdbc.core.simple; <ide> <ide> import static org.junit.Assert.*; <ide> import java.sql.Connection; <ide> import java.sql.DatabaseMetaData; <ide> import java.sql.ResultSet; <del>import java.sql.SQLException; <ide> import java.sql.Types; <ide> import java.util.ArrayList; <ide> import java.util.Date; <ide><path>spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/bind/PortletRequestUtilsTests.java <ide> /* <del> * Copyright 2002-2012 the original author or authors. <add> * Copyright 2002-2013 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> <ide> package org.springframework.web.portlet.bind; <ide> <del>import junit.framework.TestCase; <del> <ide> import org.junit.Test; <ide> import org.springframework.tests.Assume; <ide> import org.springframework.tests.TestGroup; <ide><path>spring-webmvc/src/test/java/org/springframework/web/context/support/ServletContextSupportTests.java <ide> import org.springframework.beans.factory.support.ManagedMap; <ide> import org.springframework.beans.factory.support.ManagedSet; <ide> import org.springframework.beans.factory.support.RootBeanDefinition; <del>import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; <ide> import org.springframework.core.io.Resource; <ide> import org.springframework.mock.web.test.MockServletContext; <ide>
10
Text
Text
add info about baseoperatormeta to updating.md
a19ff1572c68f5821e290a3cab6f2d3798e094b1
<ide><path>UPDATING.md <ide> https://developers.google.com/style/inclusive-documentation <ide> <ide> --> <ide> <del>### Not-nullable conn_type collumn in connection table <add>### BaseOperator uses metaclass <add> <add>`BaseOperator` class uses a `BaseOperatorMeta` as a metaclass. This meta class is based on <add>`abc.ABCMeta`. If your custom operator uses different metaclass then you will have to adjust it. <add> <add>### Not-nullable conn_type column in connection table <ide> <ide> The `conn_type` column in the `connection` table must contain content. Previously, this rule was enforced <ide> by application logic, but was not enforced by the database schema.
1
Python
Python
make layer and shape caches more robust
523e9845d7c11259feda86076c5ecadb7ed4075a
<ide><path>keras/layers/containers.py <ide> def cache_enabled(self, value): <ide> for l in self.layers: <ide> l.cache_enabled = value <ide> <add> @property <add> def layer_cache(self): <add> return super(Sequential, self).layer_cache <add> <add> @layer_cache.setter <add> def layer_cache(self, value): <add> self._layer_cache = value <add> for layer in self.layers: <add> layer.layer_cache = self._layer_cache <add> <add> @property <add> def shape_cache(self): <add> return super(Sequential, self).shape_cache <add> <add> @shape_cache.setter <add> def shape_cache(self, value): <add> self._shape_cache = value <add> for layer in self.layers: <add> layer.shape_cache = self._shape_cache <add> <ide> def set_previous(self, layer, reset_weights=True): <ide> self.layers[0].set_previous(layer, reset_weights) <ide> <ide> def cache_enabled(self, value): <ide> for l in self.inputs.values(): <ide> l.cache_enabled = value <ide> <add> @property <add> def layer_cache(self): <add> return super(Graph, self).layer_cache <add> <add> @layer_cache.setter <add> def layer_cache(self, value): <add> self._layer_cache = value <add> for layer in self.nodes.values(): <add> layer.layer_cache = self._layer_cache <add> for layer in self.inputs.values(): <add> layer.layer_cache = self._layer_cache <add> <add> @property <add> def shape_cache(self): <add> return super(Graph, self).shape_cache <add> <add> @shape_cache.setter <add> def shape_cache(self, value): <add> self._shape_cache = value <add> for layer in self.nodes.values(): <add> layer.shape_cache = self._shape_cache <add> for layer in self.inputs.values(): <add> layer.shape_cache = self._shape_cache <add> <ide> @property <ide> def nb_input(self): <ide> return len(self.inputs) <ide><path>keras/layers/core.py <ide> def cache_enabled(self): <ide> def cache_enabled(self, value): <ide> self._cache_enabled = value <ide> <add> @property <add> def layer_cache(self): <add> if hasattr(self, '_layer_cache'): <add> return self._layer_cache <add> else: <add> return None <add> <add> @layer_cache.setter <add> def layer_cache(self, value): <add> self._layer_cache = value <add> <add> @property <add> def shape_cache(self): <add> if hasattr(self, '_shape_cache'): <add> return self._shape_cache <add> else: <add> return None <add> <add> @shape_cache.setter <add> def shape_cache(self, value): <add> self._shape_cache = value <add> <ide> def __call__(self, X, mask=None, train=False): <del> # turn off layer cache temporarily <del> tmp_cache_enabled = self.cache_enabled <del> self.cache_enabled = False <add> # reset layer cache temporarily <add> tmp_layer_cache = self.layer_cache <add> tmp_shape_cache = self.shape_cache <add> self.layer_cache = {} <add> self.shape_cache = {} <ide> # create a temporary layer <ide> layer = Layer(batch_input_shape=self.input_shape) <ide> layer.name = "dummy" <ide> def __call__(self, X, mask=None, train=False): <ide> self.set_previous(tmp_previous, False) <ide> else: <ide> self.clear_previous(False) <del> self.cache_enabled = tmp_cache_enabled <add> self.layer_cache = tmp_layer_cache <add> self.shape_cache = tmp_shape_cache <ide> return Y <ide> <ide> def set_previous(self, layer, reset_weights=True): <ide> def input_shape(self): <ide> # if layer is not connected (e.g. input layer), <ide> # input shape can be set manually via _input_shape attribute. <ide> if hasattr(self, 'previous'): <del> if hasattr(self, 'shape_cache') and self.cache_enabled: <add> if self.shape_cache is not None and self.cache_enabled: <ide> previous_layer_id = id(self.previous) <ide> if previous_layer_id in self.shape_cache: <ide> return self.shape_cache[previous_layer_id] <ide> previous_size = self.previous.output_shape <del> if hasattr(self, 'shape_cache') and self.cache_enabled: <add> if self.shape_cache is not None and self.cache_enabled: <ide> previous_layer_id = id(self.previous) <ide> self.shape_cache[previous_layer_id] = previous_size <ide> return previous_size <ide> def get_input(self, train=False): <ide> if hasattr(self, 'previous'): <ide> # to avoid redundant computations, <ide> # layer outputs are cached when possible. <del> if hasattr(self, 'layer_cache') and self.cache_enabled: <add> if self.layer_cache is not None and self.cache_enabled: <ide> previous_layer_id = '%s_%s' % (id(self.previous), train) <ide> if previous_layer_id in self.layer_cache: <ide> return self.layer_cache[previous_layer_id] <ide> previous_output = self.previous.get_output(train=train) <del> if hasattr(self, 'layer_cache') and self.cache_enabled: <add> if self.layer_cache is not None and self.cache_enabled: <ide> previous_layer_id = '%s_%s' % (id(self.previous), train) <ide> self.layer_cache[previous_layer_id] = previous_output <ide> return previous_output <ide> def __init__(self, encoder, decoder, output_reconstruction=True, <ide> <ide> self._output_reconstruction = output_reconstruction <ide> self.encoder = encoder <add> self.encoder.layer_cache = self.layer_cache <ide> self.decoder = decoder <add> self.decoder.layer_cache = self.layer_cache <ide> <ide> if output_reconstruction: <ide> self.decoder.set_previous(self.encoder) <ide> def build(self): <ide> self.trainable_weights.append(p) <ide> self.constraints.append(c) <ide> <add> @property <add> def layer_cache(self): <add> return super(AutoEncoder, self).layer_cache <add> <add> @layer_cache.setter <add> def layer_cache(self, value): <add> self._layer_cache = value <add> self.encoder.layer_cache = self._layer_cache <add> self.decoder.layer_cache = self._layer_cache <add> <add> @property <add> def shape_cache(self): <add> return super(AutoEncoder, self).shape_cache <add> <add> @shape_cache.setter <add> def shape_cache(self, value): <add> self._shape_cache = value <add> self.encoder.shape_cache = self._shape_cache <add> self.decoder.shape_cache = self._shape_cache <add> <ide> def set_previous(self, node, reset_weights=True): <ide> self.encoder.set_previous(node, reset_weights) <ide> if reset_weights:
2
Javascript
Javascript
add donut.me chat apps to showcase
8f295f16b19d1346a683b1448684144c804a973c
<ide><path>website/src/react-native/showcase.js <ide> var apps = [ <ide> ], <ide> author: 'Genki Takiuchi (s21g Inc.)', <ide> }, <add> { <add> name: 'DONUT chatrooms for communities', <add> icon: 'http://a2.mzstatic.com/eu/r30/Purple49/v4/d4/2d/e5/d42de510-6802-2694-1b60-ca80ffa1e2cb/icon175x175.png', <add> linkAppStore: 'https://itunes.apple.com/fr/app/donut-chat/id1067579321', <add> linkPlayStore: 'https://play.google.com/store/apps/details?id=me.donut.mobile', <add> author: 'Damien Brugne', <add> }, <ide> { <ide> name: 'Due', <ide> icon: 'http://a1.mzstatic.com/us/r30/Purple69/v4/a2/41/5d/a2415d5f-407a-c565-ffb4-4f27f23d8ac2/icon175x175.png',
1
Python
Python
replace tf.to_float, tf.to_int with tf.cast
b548c7fdba6289acabb2c16de3c28d7cce74e252
<ide><path>official/nlp/transformer/utils/metrics.py <ide> def padded_cross_entropy_loss(logits, labels, smoothing, vocab_size): <ide> # Calculate smoothing cross entropy <ide> with tf.name_scope("smoothing_cross_entropy", values=[logits, labels]): <ide> confidence = 1.0 - smoothing <del> low_confidence = (1.0 - confidence) / tf.to_float(vocab_size - 1) <add> low_confidence = (1.0 - confidence) / tf.cast(vocab_size - 1, tf.float32) <ide> soft_targets = tf.one_hot( <ide> tf.cast(labels, tf.int32), <ide> depth=vocab_size, <ide> def padded_cross_entropy_loss(logits, labels, smoothing, vocab_size): <ide> # Calculate the best (lowest) possible value of cross entropy, and <ide> # subtract from the cross entropy loss. <ide> normalizing_constant = -( <del> confidence * tf.log(confidence) + tf.to_float(vocab_size - 1) * <del> low_confidence * tf.log(low_confidence + 1e-20)) <add> confidence * tf.log(confidence) + tf.cast(vocab_size - 1, tf.float32) <add> * low_confidence * tf.log(low_confidence + 1e-20)) <ide> xentropy -= normalizing_constant <ide> <del> weights = tf.to_float(tf.not_equal(labels, 0)) <add> weights = tf.cast(tf.not_equal(labels, 0), tf.float32) <ide> return xentropy * weights, weights <ide> <ide> <ide> def padded_accuracy(logits, labels): <ide> """Percentage of times that predictions matches labels on non-0s.""" <ide> with tf.variable_scope("padded_accuracy", values=[logits, labels]): <ide> logits, labels = _pad_tensors_to_same_length(logits, labels) <del> weights = tf.to_float(tf.not_equal(labels, 0)) <del> outputs = tf.to_int32(tf.argmax(logits, axis=-1)) <del> padded_labels = tf.to_int32(labels) <del> return tf.to_float(tf.equal(outputs, padded_labels)), weights <add> weights = tf.cast(tf.not_equal(labels, 0), tf.float32) <add> outputs = tf.cast(tf.argmax(logits, axis=-1), tf.int32) <add> padded_labels = tf.cast(labels, tf.int32) <add> return tf.cast(tf.equal(outputs, padded_labels), tf.float32), weights <ide> <ide> <ide> def padded_accuracy_topk(logits, labels, k): <ide> """Percentage of times that top-k predictions matches labels on non-0s.""" <ide> with tf.variable_scope("padded_accuracy_topk", values=[logits, labels]): <ide> logits, labels = _pad_tensors_to_same_length(logits, labels) <del> weights = tf.to_float(tf.not_equal(labels, 0)) <add> weights = tf.cast(tf.not_equal(labels, 0), tf.float32) <ide> effective_k = tf.minimum(k, tf.shape(logits)[-1]) <ide> _, outputs = tf.nn.top_k(logits, k=effective_k) <del> outputs = tf.to_int32(outputs) <del> padded_labels = tf.to_int32(labels) <add> outputs = tf.cast(outputs, tf.int32) <add> padded_labels = tf.cast(labels, tf.int32) <ide> padded_labels = tf.expand_dims(padded_labels, axis=-1) <ide> padded_labels += tf.zeros_like(outputs) # Pad to same shape. <del> same = tf.to_float(tf.equal(outputs, padded_labels)) <add> same = tf.cast(tf.equal(outputs, padded_labels), tf.float32) <ide> same_topk = tf.reduce_sum(same, axis=-1) <ide> return same_topk, weights <ide> <ide> def padded_sequence_accuracy(logits, labels): <ide> """Percentage of times that predictions matches labels everywhere (non-0).""" <ide> with tf.variable_scope("padded_sequence_accuracy", values=[logits, labels]): <ide> logits, labels = _pad_tensors_to_same_length(logits, labels) <del> weights = tf.to_float(tf.not_equal(labels, 0)) <del> outputs = tf.to_int32(tf.argmax(logits, axis=-1)) <del> padded_labels = tf.to_int32(labels) <del> not_correct = tf.to_float(tf.not_equal(outputs, padded_labels)) * weights <add> weights = tf.cast(tf.not_equal(labels, 0), tf.float32) <add> outputs = tf.cast(tf.argmax(logits, axis=-1), tf.int32) <add> padded_labels = tf.cast(labels, tf.int32) <add> not_correct = (tf.cast(tf.not_equal(outputs, padded_labels), tf.float32) * <add> weights) <ide> axis = list(range(1, len(outputs.get_shape()))) <ide> correct_seq = 1.0 - tf.minimum(1.0, tf.reduce_sum(not_correct, axis=axis)) <ide> return correct_seq, tf.constant(1.0) <ide> def bleu_score(logits, labels): <ide> Returns: <ide> bleu: int, approx bleu score <ide> """ <del> predictions = tf.to_int32(tf.argmax(logits, axis=-1)) <add> predictions = tf.cast(tf.argmax(logits, axis=-1), tf.int32) <ide> # TODO: Look into removing use of py_func <ide> bleu = tf.py_func(compute_bleu, (labels, predictions), tf.float32) <ide> return bleu, tf.constant(1.0) <ide> def rouge_2_fscore(logits, labels): <ide> Returns: <ide> rouge2_fscore: approx rouge-2 f1 score. <ide> """ <del> predictions = tf.to_int32(tf.argmax(logits, axis=-1)) <add> predictions = tf.cast(tf.argmax(logits, axis=-1), tf.int32) <ide> # TODO: Look into removing use of py_func <ide> rouge_2_f_score = tf.py_func(rouge_n, (predictions, labels), tf.float32) <ide> return rouge_2_f_score, tf.constant(1.0) <ide> def rouge_l_fscore(predictions, labels): <ide> Returns: <ide> rouge_l_fscore: approx rouge-l f1 score. <ide> """ <del> outputs = tf.to_int32(tf.argmax(predictions, axis=-1)) <add> outputs = tf.cast(tf.argmax(predictions, axis=-1), tf.int32) <ide> rouge_l_f_score = tf.py_func(rouge_l_sentence_level, (outputs, labels), <ide> tf.float32) <ide> return rouge_l_f_score, tf.constant(1.0)
1
Python
Python
build context strings out of [u|n]gettext
afbf913b90a820702a2a4cad669c25d8808a5843
<ide><path>django/utils/translation/trans_real.py <ide> def ugettext(message): <ide> return do_translate(message, 'ugettext') <ide> <ide> def pgettext(context, message): <del> result = ugettext("%s%s%s" % (context, CONTEXT_SEPARATOR, message)) <add> msg_with_ctxt = "%s%s%s" % (context, CONTEXT_SEPARATOR, message) <add> result = ugettext(msg_with_ctxt) <ide> if CONTEXT_SEPARATOR in result: <ide> # Translation not found <ide> result = message <ide> def ungettext(singular, plural, number): <ide> return do_ntranslate(singular, plural, number, 'ungettext') <ide> <ide> def npgettext(context, singular, plural, number): <del> result = ungettext("%s%s%s" % (context, CONTEXT_SEPARATOR, singular), <del> "%s%s%s" % (context, CONTEXT_SEPARATOR, plural), <del> number) <add> msgs_with_ctxt = ("%s%s%s" % (context, CONTEXT_SEPARATOR, singular), <add> "%s%s%s" % (context, CONTEXT_SEPARATOR, plural), <add> number) <add> result = ungettext(*msgs_with_ctxt) <ide> if CONTEXT_SEPARATOR in result: <ide> # Translation not found <ide> result = ungettext(singular, plural, number)
1
Javascript
Javascript
add support for foveation
ee1812f926718cdd159943c5e5ef14fc629e5ddc
<ide><path>src/renderers/webxr/WebXRManager.js <ide> class WebXRManager extends EventDispatcher { <ide> <ide> }; <ide> <add> this.getFoveation = function () { <add> <add> if ( glProjLayer !== null ) { <add> <add> return glProjLayer.fixedFoveation; <add> <add> } <add> <add> if ( glBaseLayer !== null ) { <add> <add> return glBaseLayer.fixedFoveation; <add> <add> } <add> <add> return undefined; <add> <add> }; <add> <add> this.setFoveation = function ( foveation ) { <add> <add> if ( glProjLayer !== null ) { <add> <add> glProjLayer.fixedFoveation = foveation; <add> <add> } <add> <add> if ( glBaseLayer !== null && glBaseLayer.fixedFoveation !== undefined ) { <add> <add> glBaseLayer.fixedFoveation = foveation; <add> <add> } <add> <add> }; <add> <ide> // Animation Loop <ide> <ide> let onAnimationFrameCallback = null;
1
Java
Java
fix negative letterspacing in fabric android
7935174d48b698edfaeea14bf8ea690106ee56f4
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java <ide> public class TextAttributeProps { <ide> private static final int DEFAULT_TEXT_SHADOW_COLOR = 0x55000000; <ide> <ide> protected float mLineHeight = Float.NaN; <del> protected float mLetterSpacing = Float.NaN; <ide> protected boolean mIsColorSet = false; <ide> protected boolean mAllowFontScaling = true; <ide> protected int mColor; <ide> public void setLineHeight(float lineHeight) { <ide> <ide> public void setLetterSpacing(float letterSpacing) { <ide> mLetterSpacingInput = letterSpacing; <del> mLetterSpacing = <add> } <add> <add> public float getLetterSpacing() { <add> float letterSpacingPixels = <ide> mAllowFontScaling <ide> ? PixelUtil.toPixelFromSP(mLetterSpacingInput) <ide> : PixelUtil.toPixelFromDIP(mLetterSpacingInput); <add> <add> // `letterSpacingPixels` and `mFontSize` are both in pixels, <add> // yielding an accurate em value. <add> return letterSpacingPixels / mFontSize; <ide> } <ide> <ide> public void setAllowFontScaling(boolean allowFontScaling) { <ide><path>ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.java <ide> private static void buildSpannableFromFragment( <ide> start, end, new ReactBackgroundColorSpan(textAttributes.mBackgroundColor))); <ide> } <ide> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { <del> if (!Float.isNaN(textAttributes.mLetterSpacing)) { <add> if (!Float.isNaN(textAttributes.getLetterSpacing())) { <ide> ops.add( <ide> new SetSpanOperation( <del> start, end, new CustomLetterSpacingSpan(textAttributes.mLetterSpacing))); <add> start, end, new CustomLetterSpacingSpan(textAttributes.getLetterSpacing()))); <ide> } <ide> } <ide> ops.add(
2
PHP
PHP
add test case to prevent future regression
a3e131529a516a1c0ce8e652656c10fffd9f9933
<ide><path>tests/TestCase/ORM/RulesCheckerIntegrationTest.php <ide> namespace Cake\Test\TestCase\ORM; <ide> <ide> use Cake\ORM\Entity; <add>use Cake\ORM\RulesChecker; <ide> use Cake\ORM\TableRegistry; <ide> use Cake\TestSuite\TestCase; <ide> <ide> class RulesCheckerIntegrationTest extends TestCase <ide> * <ide> * @var array <ide> */ <del> public $fixtures = ['core.articles', 'core.articles_tags', 'core.authors', 'core.tags']; <add> public $fixtures = ['core.articles', 'core.articles_tags', 'core.authors', 'core.tags', 'core.categories']; <ide> <ide> /** <ide> * Tear down <ide> public function testExistsInNullValue() <ide> $this->assertEquals([], $entity->errors('author_id')); <ide> } <ide> <add> /** <add> * Test ExistsIn on a new entity that doesn't have the field populated. <add> * <add> * This use case is important for saving records and their <add> * associated belongsTo records in one pass. <add> * <add> * @return void <add> */ <add> public function testExistsInNotNullValueNewEntity() <add> { <add> $entity = new Entity([ <add> 'name' => 'A Category', <add> ]); <add> $table = TableRegistry::get('Categories'); <add> $table->belongsTo('Categories', [ <add> 'foreignKey' => 'parent_id', <add> 'bindingKey' => 'id', <add> ]); <add> $rules = $table->rulesChecker(); <add> $rules->add($rules->existsIn('parent_id', 'Categories')); <add> $this->assertTrue($table->checkRules($entity, RulesChecker::CREATE)); <add> $this->assertEmpty($entity->errors('parent_id')); <add> } <add> <ide> /** <ide> * Tests exists in uses the bindingKey of the association <ide> *
1
PHP
PHP
apply fixes from styleci
d1683918a619c07305319e62f8c863c4ee7818c3
<ide><path>src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php <ide> public function whereBelongsTo($related, $relationshipName = null, $boolean = 'a <ide> } <ide> <ide> if ($relatedCollection->isEmpty()) { <del> throw new InvalidArgumentException("Collection given to whereBelongsTo method may not be empty."); <add> throw new InvalidArgumentException('Collection given to whereBelongsTo method may not be empty.'); <ide> } <ide> <ide> if ($relationshipName === null) {
1
Mixed
Ruby
add docs to serializers. update changelogs
696d01f7f4a8ed787924a41cce6df836cd73c46f
<ide><path>actionpack/lib/action_controller/metal/serialization.rb <ide> module ActionController <add> # Action Controller Serialization <add> # <add> # Overrides render :json to check if the given object implements +active_model_serializer+ <add> # as a method. If so, use the returned serializer instead of calling +to_json+ in the object. <add> # <add> # This module also provides a serialization_scope method that allows you to configure the <add> # +serialization_scope+ of the serializer. Most apps will likely set the +serialization_scope+ <add> # to the current user: <add> # <add> # class ApplicationController < ActionController::Base <add> # serialization_scope :current_user <add> # end <add> # <add> # If you need more complex scope rules, you can simply override the serialization_scope: <add> # <add> # class ApplicationController < ActionController::Base <add> # private <add> # <add> # def serialization_scope <add> # current_user <add> # end <add> # end <add> # <ide> module Serialization <ide> extend ActiveSupport::Concern <ide> <ide><path>activemodel/CHANGELOG.md <del>* Added ActiveModel::Errors#added? to check if a specific error has been added *Martin Svalin* <add>## Rails 3.2.0 (unreleased) ## <add> <add>* Add ActiveModel::Serializer that encapsulates an ActiveModel object serialization *José Valim* <add> <add>* Renamed (with a deprecation the following constants): <add> <add> ActiveModel::Serialization => ActiveModel::Serializable <add> ActiveModel::Serializers::JSON => ActiveModel::Serializable::JSON <add> ActiveModel::Serializers::Xml => ActiveModel::Serializable::XML <add> <add> *José Valim* <add> <add>* Add ActiveModel::Errors#added? to check if a specific error has been added *Martin Svalin* <ide> <ide> * Add ability to define strict validation(with :strict => true option) that always raises exception when fails *Bogdan Gusiev* <ide> <ide><path>activemodel/lib/active_model/serializer.rb <ide> <ide> module ActiveModel <ide> # Active Model Array Serializer <add> # <add> # It serializes an array checking if each element that implements <add> # the +active_model_serializer+ method passing down the current scope. <ide> class ArraySerializer <ide> attr_reader :object, :scope <ide> <ide> def as_json(*args) <ide> end <ide> <ide> # Active Model Serializer <add> # <add> # Provides a basic serializer implementation that allows you to easily <add> # control how a given object is going to be serialized. On initialization, <add> # it expects to object as arguments, a resource and a scope. For example, <add> # one may do in a controller: <add> # <add> # PostSerializer.new(@post, current_user).to_json <add> # <add> # The object to be serialized is the +@post+ and the scope is +current_user+. <add> # <add> # We use the scope to check if a given attribute should be serialized or not. <add> # For example, some attributes maybe only be returned if +current_user+ is the <add> # author of the post: <add> # <add> # class PostSerializer < ActiveModel::Serializer <add> # attributes :title, :body <add> # has_many :comments <add> # <add> # private <add> # <add> # def attributes <add> # hash = super <add> # hash.merge!(:email => post.email) if author? <add> # hash <add> # end <add> # <add> # def author? <add> # post.author == scope <add> # end <add> # end <add> # <ide> class Serializer <del> module Associations <del> class Config < Struct.new(:name, :options) <add> module Associations #:nodoc: <add> class Config < Struct.new(:name, :options) #:nodoc: <ide> def serializer <ide> options[:serializer] <ide> end <ide> end <ide> <del> class HasMany < Config <add> class HasMany < Config #:nodoc: <ide> def serialize(collection, scope) <ide> collection.map do |item| <ide> serializer.new(item, scope).serializable_hash <ide> def serialize(collection, scope) <ide> <ide> def serialize_ids(collection, scope) <ide> # use named scopes if they are present <del> #return collection.ids if collection.respond_to?(:ids) <add> # return collection.ids if collection.respond_to?(:ids) <ide> <ide> collection.map do |item| <ide> item.read_attribute_for_serialization(:id) <ide> end <ide> end <ide> end <ide> <del> class HasOne < Config <add> class HasOne < Config #:nodoc: <ide> def serialize(object, scope) <ide> object && serializer.new(object, scope).serializable_hash <ide> end <ide> def serialize_ids(object, scope) <ide> class_attribute :_root_embed <ide> <ide> class << self <add> # Define attributes to be used in the serialization. <ide> def attributes(*attrs) <ide> self._attributes += attrs <ide> end <ide> <del> def associate(klass, attrs) <add> def associate(klass, attrs) #:nodoc: <ide> options = attrs.extract_options! <ide> self._associations += attrs.map do |attr| <ide> unless method_defined?(attr) <ide> def associate(klass, attrs) <ide> end <ide> end <ide> <add> # Defines an association in the object should be rendered. <add> # <add> # The serializer object should implement the association name <add> # as a method which should return an array when invoked. If a method <add> # with the association name does not exist, the association name is <add> # dispatched to the serialized object. <ide> def has_many(*attrs) <ide> associate(Associations::HasMany, attrs) <ide> end <ide> <add> # Defines an association in the object should be rendered. <add> # <add> # The serializer object should implement the association name <add> # as a method which should return an object when invoked. If a method <add> # with the association name does not exist, the association name is <add> # dispatched to the serialized object. <ide> def has_one(*attrs) <ide> associate(Associations::HasOne, attrs) <ide> end <ide> <add> # Define how associations should be embedded. <add> # <add> # embed :objects # Embed associations as full objects <add> # embed :ids # Embed only the association ids <add> # embed :ids, :include => true # Embed the association ids and include objects in the root <add> # <ide> def embed(type, options={}) <ide> self._embed = type <ide> self._root_embed = true if options[:include] <ide> end <ide> <add> # Defines the root used on serialization. If false, disables the root. <ide> def root(name) <ide> self._root = name <ide> end <ide> <del> def inherited(klass) <add> def inherited(klass) #:nodoc: <ide> return if klass.anonymous? <ide> <ide> name = klass.name.demodulize.underscore.sub(/_serializer$/, '') <ide> def initialize(object, scope) <ide> @object, @scope = object, scope <ide> end <ide> <add> # Returns a json representation of the serializable <add> # object including the root. <ide> def as_json(*) <ide> if _root <ide> hash = { _root => serializable_hash } <ide> def as_json(*) <ide> end <ide> end <ide> <add> # Returns a hash representation of the serializable <add> # object without the root. <ide> def serializable_hash <ide> if _embed == :ids <ide> attributes.merge(association_ids) <ide> def serializable_hash <ide> end <ide> end <ide> <add> # Returns a hash representation of the serializable <add> # object associations. <ide> def associations <ide> hash = {} <ide> <ide> def associations <ide> hash <ide> end <ide> <add> # Returns a hash representation of the serializable <add> # object associations ids. <ide> def association_ids <ide> hash = {} <ide> <ide> def association_ids <ide> hash <ide> end <ide> <add> # Returns a hash representation of the serializable <add> # object attributes. <ide> def attributes <ide> hash = {} <ide> <ide><path>railties/CHANGELOG.md <ide> ## Rails 3.2.0 (unreleased) ## <ide> <add>* Add a serializer generator and add a hook for it in the scaffold generators *José Valim* <add> <ide> * Scaffold returns 204 No Content for API requests without content. This makes scaffold work with jQuery out of the box. *José Valim* <ide> <del>* Updated Rails::Rack::Logger middleware to apply any tags set in config.log_tags to the newly ActiveSupport::TaggedLogging Rails.logger. This makes it easy to tag log lines with debug information like subdomain and request id -- both very helpful in debugging multi-user production applications *DHH* <add>* Update Rails::Rack::Logger middleware to apply any tags set in config.log_tags to the newly ActiveSupport::TaggedLogging Rails.logger. This makes it easy to tag log lines with debug information like subdomain and request id -- both very helpful in debugging multi-user production applications *DHH* <ide> <ide> * Default options to `rails new` can be set in ~/.railsrc *Guillermo Iguaran* <ide> <del>* Added destroy alias to Rails engines. *Guillermo Iguaran* <add>* Add destroy alias to Rails engines *Guillermo Iguaran* <ide> <del>* Added destroy alias for Rails command line. This allows the following: `rails d model post`. *Andrey Ognevsky* <add>* Add destroy alias for Rails command line. This allows the following: `rails d model post` *Andrey Ognevsky* <ide> <ide> * Attributes on scaffold and model generators default to string. This allows the following: "rails g scaffold Post title body:text author" *José Valim* <ide> <del>* Removed old plugin generator (`rails generate plugin`) in favor of `rails plugin new` command. *Guillermo Iguaran* <add>* Remove old plugin generator (`rails generate plugin`) in favor of `rails plugin new` command *Guillermo Iguaran* <ide> <del>* Removed old 'config.paths.app.controller' API in favor of 'config.paths["app/controller"]' API. *Guillermo Iguaran* <add>* Remove old 'config.paths.app.controller' API in favor of 'config.paths["app/controller"]' API *Guillermo Iguaran* <ide> <ide> <ide> * Rails 3.1.1
4
Text
Text
fix "opencollective" references
4c75c82a79737a0f4bb9867ca11fcaf6a2bfa0ca
<ide><path>docs/Homebrew-Governance.md <ide> <ide> ## 4. Project Leadership Committee <ide> <del>1. The financial administration of Homebrew, organisation of the AGM, enforcement of the code of conduct and removal of members are performed by the PLC. The PLC will represent Homebrew in all dealings with OpenCollective. <add>1. The financial administration of Homebrew, organisation of the AGM, enforcement of the code of conduct and removal of members are performed by the PLC. The PLC will represent Homebrew in all dealings with Open Collective. <ide> <ide> 2. The PLC consists of five members including the Project Leader. Committee members are elected by Homebrew members in a [Meek Single Transferable Vote](https://en.wikipedia.org/wiki/Counting_single_transferable_votes#Meek) election using the Droop quota. Each PLC member will serve a term of two years or until the member's successor is elected. Any sudden vacancy in the PLC will be filled by the usual procedure for electing PLC members at the next general meeting, typically the next AGM. <ide> <ide><path>docs/Homebrew-Leadership-Responsibilities.md <ide> <ide> ### PLC Shared Responsibilities <ide> <del>- approving OpenCollective expenses that are expected or have already been agreed upon by the PLC (e.g. Homebrew cloud usage on a personal credit card) (only one approval needed) <add>- approving Open Collective expenses that are expected or have already been agreed upon by the PLC (e.g. Homebrew cloud usage on a personal credit card) (only one approval needed) <ide> - blocking abusive GitHub users <ide> - performing GitHub admin operations on the Homebrew GitHub organisation <ide> - performing Slack admin operations on the Homebrew Slack <ide> ### PL Shared Responsibilities <ide> <ide> - approving new Homebrew maintainers (only one approval needed) <del>- approving OpenCollective expenses that are expected or have already been agreed upon by the PLC (e.g. Homebrew cloud usage on a personal credit card) (only one approval needed) <add>- approving Open Collective expenses that are expected or have already been agreed upon by the PLC (e.g. Homebrew cloud usage on a personal credit card) (only one approval needed) <ide> - blocking abusive GitHub users <ide> - performing GitHub admin operations on the Homebrew GitHub organisation <ide> - performing Slack admin operations on the Homebrew Slack
2
Javascript
Javascript
use fs rimraf to refresh tmpdir
4a5fb74fb15f41ebde50ccbb05c3ad25bf1dd499
<ide><path>test/common/tmpdir.js <ide> function rimrafSync(pathname, { spawn = true } = {}) { <ide> } <ide> } <ide> <del> try { <del> if (st.isDirectory()) <del> rmdirSync(pathname, null); <del> else <del> fs.unlinkSync(pathname); <del> } catch (e) { <del> debug(e); <del> switch (e.code) { <del> case 'ENOENT': <del> // It's not there anymore. Work is done. Exiting. <del> return; <del> <del> case 'EPERM': <del> // This can happen, try again with `rmdirSync`. <del> break; <del> <del> case 'EISDIR': <del> // Got 'EISDIR' even after testing `st.isDirectory()`... <del> // Try again with `rmdirSync`. <del> break; <del> <del> default: <del> throw e; <del> } <del> rmdirSync(pathname, e); <del> } <add> fs.rmdirSync(pathname, { recursive: true, maxRetries: 5 }); <ide> <ide> if (fs.existsSync(pathname)) <ide> throw new Error(`Unable to rimraf ${pathname}`); <ide> } <ide> <del>function rmdirSync(p, originalEr) { <del> try { <del> fs.rmdirSync(p); <del> } catch (e) { <del> if (e.code === 'ENOTDIR') <del> throw originalEr; <del> if (e.code === 'ENOTEMPTY' || e.code === 'EEXIST' || e.code === 'EPERM') { <del> const enc = process.platform === 'linux' ? 'buffer' : 'utf8'; <del> fs.readdirSync(p, enc).forEach((f) => { <del> if (f instanceof Buffer) { <del> const buf = Buffer.concat([Buffer.from(p), Buffer.from(path.sep), f]); <del> rimrafSync(buf); <del> } else { <del> rimrafSync(path.join(p, f)); <del> } <del> }); <del> fs.rmdirSync(p); <del> return; <del> } <del> throw e; <del> } <del>} <del> <ide> const testRoot = process.env.NODE_TEST_DIR ? <ide> fs.realpathSync(process.env.NODE_TEST_DIR) : path.resolve(__dirname, '..'); <ide>
1
PHP
PHP
fix plural form calculation for turkish
e2d248a07f3b1247f4a7a48867da06e95ddc999d
<ide><path>src/I18n/PluralRules.php <ide> class PluralRules <ide> 'th' => 0, <ide> 'ti' => 2, <ide> 'tk' => 1, <del> 'tr' => 0, <add> 'tr' => 1, <ide> 'uk' => 3, <ide> 'ur' => 1, <ide> 'vi' => 0, <ide><path>tests/TestCase/I18n/PluralRulesTest.php <ide> public function localesProvider() <ide> ['cy', 10, 2], <ide> ['cy', 11, 3], <ide> ['cy', 8, 3], <add> ['tr', 0, 1], <add> ['tr', 1, 0], <add> ['tr', 2, 1], <ide> ]; <ide> } <ide>
2
Javascript
Javascript
fix renderorder reflectorrtt
6787bbc2af6c5b91f231d60d208c1890185bcf6e
<ide><path>examples/js/objects/ReflectorRTT.js <ide> THREE.ReflectorRTT = function ( geometry, options ) { <ide> <ide> this.geometry.setDrawRange( 0, 0 ); // avoid rendering geometry <ide> <add> this.renderOrder = -Infinity; // render RTT first <add> <ide> }; <ide> <ide> THREE.ReflectorRTT.prototype = Object.create( THREE.Reflector.prototype );
1
Javascript
Javascript
improve triangle closure performance
d5b9bc6806ea51490eed10ce56f550cf9459bb80
<ide><path>src/math/Triangle.js <ide> Object.assign( Triangle.prototype, { <ide> <ide> closestPointToPoint: function () { <ide> <del> var plane, edgeList, projectedPoint, closestPoint; <add> var plane = new Plane(); <add> var edgeList = [ new Line3(), new Line3(), new Line3() ]; <add> var projectedPoint = new Vector3(); <add> var closestPoint = new Vector3(); <ide> <ide> return function closestPointToPoint( point, optionalTarget ) { <ide> <del> if ( plane === undefined ) { <del> <del> plane = new Plane(); <del> edgeList = [ new Line3(), new Line3(), new Line3() ]; <del> projectedPoint = new Vector3(); <del> closestPoint = new Vector3(); <del> <del> } <del> <ide> var result = optionalTarget || new Vector3(); <ide> var minDistance = Infinity; <ide>
1
Javascript
Javascript
add test for @ngdoc function
9e37ebe635a37a12535922ac9902ebd492d7cba9
<ide><path>docs/spec/ngdocSpec.js <ide> describe('ngdoc', function(){ <ide> }); <ide> <ide> <add> describe('function', function(){ <add> it('should format', function(){ <add> var doc = new Doc({ <add> ngdoc:'function', <add> name:'some.name', <add> param: [ <add> {name:'a', optional: true}, <add> {name:'b', type: 'someType', optional: true, 'default': '"xxx"'}, <add> {name:'c', type: 'string', description: 'param desc'} <add> ], <add> returns: {type: 'number', description: 'return desc'} <add> }); <add> doc.html_usage_function(dom); <add> expect(dom).toContain('some.name([a][, b], c)'); //TODO(i) the comma position here is lame <add> expect(dom).toContain('param desc'); <add> expect(dom).toContain('(optional="xxx")'); <add> expect(dom).toContain('return desc'); <add> }); <add> }); <add> <ide> describe('filter', function(){ <ide> it('should format', function(){ <ide> var doc = new Doc({
1
PHP
PHP
allow setting level (depth) of tree nodes on save
17264790d762e89189819ebc3cbdea5ef05ec22a
<ide><path>src/ORM/Behavior/TreeBehavior.php <ide> class TreeBehavior extends Behavior <ide> 'parent' => 'parent_id', <ide> 'left' => 'lft', <ide> 'right' => 'rght', <del> 'scope' => null <add> 'scope' => null, <add> 'level' => null <ide> ]; <ide> <ide> /** <ide> public function beforeSave(Event $event, Entity $entity) <ide> $parent = $entity->get($config['parent']); <ide> $primaryKey = $this->_getPrimaryKey(); <ide> $dirty = $entity->dirty($config['parent']); <add> $level = $config['level']; <ide> <ide> if ($isNew && $parent) { <ide> if ($entity->get($primaryKey[0]) == $parent) { <ide> public function beforeSave(Event $event, Entity $entity) <ide> $entity->set($config['left'], $edge); <ide> $entity->set($config['right'], $edge + 1); <ide> $this->_sync(2, '+', ">= {$edge}"); <add> <add> if ($level) { <add> $entity->set($config[$level], $parentNode[$level] + 1); <add> } <add> return; <ide> } <ide> <ide> if ($isNew && !$parent) { <ide> $edge = $this->_getMax(); <ide> $entity->set($config['left'], $edge + 1); <ide> $entity->set($config['right'], $edge + 2); <add> <add> if ($level) { <add> $entity->set($config[$level], 0); <add> } <add> return; <ide> } <ide> <ide> if (!$isNew && $dirty && $parent) { <ide> $this->_setParent($entity, $parent); <add> <add> if ($level) { <add> $parentNode = $this->_getNode($parent); <add> $entity->set($config[$level], $parentNode[$level] + 1); <add> } <add> return; <ide> } <ide> <ide> if (!$isNew && $dirty && !$parent) { <ide> $this->_setAsRoot($entity); <add> <add> if ($level) { <add> $entity->set($config[$level], 0); <add> } <add> } <add> } <add> <add> /** <add> * After save listener. <add> * <add> * Manages updating level of descendents of currently saved entity. <add> * <add> * @param \Cake\Event\Event $event The beforeSave event that was fired <add> * @param \Cake\ORM\Entity $entity the entity that is going to be saved <add> * @return void <add> */ <add> public function afterSave(Event $event, Entity $entity) <add> { <add> if (!$this->_config['level'] || $entity->isNew()) { <add> return; <add> } <add> <add> $this->_setChildrenLevel($entity); <add> } <add> <add> /** <add> * Set level for descendents. <add> * <add> * @param \Cake\ORM\Entity $entity <add> * @return void <add> */ <add> protected function _setChildrenLevel(Entity $entity) <add> { <add> $config = $this->config(); <add> <add> if ($entity->get($config['left']) + 1 === $entity->get($config['right'])) { <add> return; <add> } <add> <add> $primaryKey = $this->_getPrimaryKey(); <add> $primaryKeyValue = $entity->get($primaryKey); <add> $depths = [$primaryKeyValue => $entity->get($config['level'])]; <add> <add> $children = $this->_table->find('children', [ <add> 'for' => $primaryKeyValue, <add> 'fields' => [$this->_getPrimaryKey(), $config['parent'], $config['level']], <add> 'order' => $config['left'] <add> ]); <add> <add> foreach ($children as $node) { <add> $parentIdValue = $node->get($config['parent']); <add> $depth = $depths[$parentIdValue] + 1; <add> $depths[$node->get($primaryKey)] = $depth; <add> <add> $node->set($config['level'], $depth); <add> $this->_table->save($node, ['checkRules' => false, 'atomic' => false]); <ide> } <ide> } <ide> <ide> protected function _getNode($id) <ide> $config = $this->config(); <ide> list($parent, $left, $right) = [$config['parent'], $config['left'], $config['right']]; <ide> $primaryKey = $this->_getPrimaryKey(); <add> $fields = [$parent, $left, $right]; <add> if ($config['level']) { <add> $fields[] = $config['level']; <add> } <ide> <ide> $node = $this->_scope($this->_table->find()) <del> ->select([$parent, $left, $right]) <add> ->select($fields) <ide> ->where([$this->_table->alias() . '.' . $primaryKey => $id]) <ide> ->first(); <ide> <ide><path>tests/Fixture/NumberTreesFixture.php <ide> class NumberTreesFixture extends TestFixture <ide> 'parent_id' => 'integer', <ide> 'lft' => ['type' => 'integer'], <ide> 'rght' => ['type' => 'integer'], <add> 'level' => ['type' => 'integer'], <ide> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]] <ide> ]; <ide> <ide> class NumberTreesFixture extends TestFixture <ide> 'name' => 'electronics', <ide> 'parent_id' => null, <ide> 'lft' => '1', <del> 'rght' => '20' <add> 'rght' => '20', <add> 'level' => 0 <ide> ], <ide> [ <ide> 'name' => 'televisions', <ide> 'parent_id' => '1', <ide> 'lft' => '2', <del> 'rght' => '9' <add> 'rght' => '9', <add> 'level' => 1 <ide> ], <ide> [ <ide> 'name' => 'tube', <ide> 'parent_id' => '2', <ide> 'lft' => '3', <del> 'rght' => '4' <add> 'rght' => '4', <add> 'level' => 2 <ide> ], <ide> [ <ide> 'name' => 'lcd', <ide> 'parent_id' => '2', <ide> 'lft' => '5', <del> 'rght' => '6' <add> 'rght' => '6', <add> 'level' => 2 <ide> ], <ide> [ <ide> 'name' => 'plasma', <ide> 'parent_id' => '2', <ide> 'lft' => '7', <del> 'rght' => '8' <add> 'rght' => '8', <add> 'level' => 2 <ide> ], <ide> [ <ide> 'name' => 'portable', <ide> 'parent_id' => '1', <ide> 'lft' => '10', <del> 'rght' => '19' <add> 'rght' => '19', <add> 'level' => 1 <ide> ], <ide> [ <ide> 'name' => 'mp3', <ide> 'parent_id' => '6', <ide> 'lft' => '11', <del> 'rght' => '14' <add> 'rght' => '14', <add> 'level' => 2 <ide> ], <ide> [ <ide> 'name' => 'flash', <ide> 'parent_id' => '7', <ide> 'lft' => '12', <del> 'rght' => '13' <add> 'rght' => '13', <add> 'level' => 3 <ide> ], <ide> [ <ide> 'name' => 'cd', <ide> 'parent_id' => '6', <ide> 'lft' => '15', <del> 'rght' => '16' <add> 'rght' => '16', <add> 'level' => 2 <ide> ], <ide> [ <ide> 'name' => 'radios', <ide> 'parent_id' => '6', <ide> 'lft' => '17', <del> 'rght' => '18' <add> 'rght' => '18', <add> 'level' => 2 <ide> ], <ide> [ <ide> 'name' => 'alien hardware', <ide> 'parent_id' => null, <ide> 'lft' => '21', <del> 'rght' => '22' <add> 'rght' => '22', <add> 'level' => 0 <ide> ] <ide> ]; <ide> } <ide><path>tests/TestCase/ORM/Behavior/TreeBehaviorTest.php <ide> public function testAddOrphan() <ide> { <ide> $table = $this->table; <ide> $entity = new Entity( <del> ['name' => 'New Orphan', 'parent_id' => null], <add> ['name' => 'New Orphan', 'parent_id' => null, 'level' => null], <ide> ['markNew' => true] <ide> ); <ide> $expected = $table->find()->order('lft')->hydrate(false)->toArray(); <ide> public function testGetLevel() <ide> $this->assertFalse($result); <ide> } <ide> <add> /** <add> * Test setting level for new nodes <add> * <add> * @return void <add> */ <add> public function testSetLevelNewNode() <add> { <add> $this->table->behaviors()->Tree->config('level', 'level'); <add> <add> $entity = new Entity(['parent_id' => null, 'name' => 'Depth 0']); <add> $this->table->save($entity); <add> $entity = $this->table->get(12); <add> $this->assertEquals(0, $entity->level); <add> <add> $entity = new Entity(['parent_id' => 1, 'name' => 'Depth 1']); <add> $this->table->save($entity); <add> $entity = $this->table->get(13); <add> $this->assertEquals(1, $entity->level); <add> <add> $entity = new Entity(['parent_id' => 8, 'name' => 'Depth 4']); <add> $this->table->save($entity); <add> $entity = $this->table->get(14); <add> $this->assertEquals(4, $entity->level); <add> } <add> <add> /** <add> * Test setting level for existing nodes <add> * <add> * @return void <add> */ <add> public function testSetLevelExistingNode() <add> { <add> $this->table->behaviors()->Tree->config('level', 'level'); <add> <add> // Leaf node <add> $entity = $this->table->get(4); <add> $this->assertEquals(2, $entity->level); <add> $this->table->save($entity); <add> $entity = $this->table->get(4); <add> $this->assertEquals(2, $entity->level); <add> <add> // Non leaf node so depth of descendents will also change <add> $entity = $this->table->get(6); <add> $this->assertEquals(1, $entity->level); <add> <add> $entity->parent_id = null; <add> $this->table->save($entity); <add> $entity = $this->table->get(6); <add> $this->assertEquals(0, $entity->level); <add> <add> $entity = $this->table->get(7); <add> $this->assertEquals(1, $entity->level); <add> <add> $entity = $this->table->get(8); <add> $this->assertEquals(2, $entity->level); <add> } <add> <ide> /** <ide> * Custom assertion use to verify tha a tree is returned in the expected order <ide> * and that it is still valid
3
Javascript
Javascript
add docs to api
c207d4a7d6e383de4c9b1b1eedbda6f56860f1b7
<ide><path>src/api.js <ide> /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ <ide> /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ <ide> <add>/** <add> * This is the main entry point for loading a PDF and interacting with it. <add> * NOTE: If a URL is used to fetch the PDF data a standard XMLHttpRequest(XHR) <add> * is used, which means it must follow the same origin rules that any XHR does <add> * e.g. No cross domain requests without CORS. <add> * <add> * @param {string|TypedAray} source Either a url to a PDF is located or a <add> * typed array already populated with data. <add> * @return {Promise} A promise that is resolved with {PDFDocumentProxy} object. <add> */ <ide> PDFJS.getDocument = function getDocument(source) { <ide> var promise = new PDFJS.Promise(); <ide> var transport = new WorkerTransport(promise); <ide> PDFJS.getDocument = function getDocument(source) { <ide> return promise; <ide> }; <ide> <add>/** <add> * Proxy to a PDFDocument in the worker thread. Also, contains commonly used <add> * properties that can be read synchronously. <add> */ <ide> var PDFDocumentProxy = (function() { <ide> function PDFDocumentProxy(pdfInfo, transport) { <ide> this.pdfInfo = pdfInfo; <ide> this.transport = transport; <ide> } <ide> PDFDocumentProxy.prototype = { <add> /** <add> * @return {number} Total number of pages the PDF contains. <add> */ <ide> get numPages() { <ide> return this.pdfInfo.numPages; <ide> }, <add> /** <add> * @return {string} A unique ID to identify a PDF. Not guaranteed to be <add> * unique. <add> */ <ide> get fingerprint() { <ide> return this.pdfInfo.fingerprint; <ide> }, <add> /** <add> * @param {number} The page number to get. The first page is 1. <add> * @return {Promise} A promise that is resolved with a {PDFPageProxy} <add> * object. <add> */ <ide> getPage: function(number) { <ide> return this.transport.getPage(number); <ide> }, <add> /** <add> * @return {Promise} A promise that is resolved with a lookup table for <add> * mapping named destinations to reference numbers. <add> */ <ide> getDestinations: function() { <ide> var promise = new PDFJS.Promise(); <ide> var destinations = this.pdfInfo.destinations; <ide> promise.resolve(destinations); <ide> return promise; <ide> }, <add> /** <add> * @return {Promise} A promise that is resolved with an {array} that is a <add> * tree outline (if it has one) of the PDF. The tree is in the format of: <add> * [ <add> * { <add> * title: string, <add> * bold: boolean, <add> * italic: boolean, <add> * color: rgb array, <add> * dest: dest obj, <add> * items: array of more items like this <add> * }, <add> * ... <add> * ]. <add> */ <ide> getOutline: function() { <ide> var promise = new PDFJS.Promise(); <ide> var outline = this.pdfInfo.outline; <ide> promise.resolve(outline); <ide> return promise; <ide> }, <add> /** <add> * @return {Promise} A promise that is resolved with an {object} that has <add> * info and metadata properties. Info is an {object} filled with anything <add> * available in the information dictionary and similarly metadata is a <add> * {Metadata} object with information from the metadata section of the PDF. <add> */ <ide> getMetadata: function() { <ide> var promise = new PDFJS.Promise(); <ide> var info = this.pdfInfo.info; <ide> var PDFPageProxy = (function PDFPageProxyClosure() { <ide> this.objs = transport.objs; <ide> } <ide> PDFPageProxy.prototype = { <add> /** <add> * @return {number} Page number of the page. First page is 1. <add> */ <ide> get pageNumber() { <ide> return this.pageInfo.pageIndex + 1; <ide> }, <add> /** <add> * @return {number} The number of degrees the page is rotated clockwise. <add> */ <ide> get rotate() { <ide> return this.pageInfo.rotate; <ide> }, <add> /** <add> * @return {object} The reference that points to this page. It has 'num' and <add> * 'gen' properties. <add> */ <ide> get ref() { <ide> return this.pageInfo.ref; <ide> }, <add> /** <add> * @return {array} An array of the visible portion of the PDF page in the <add> * user space units - [x1, y1, x2, y2]. <add> */ <ide> get view() { <ide> return this.pageInfo.view; <ide> }, <add> /** <add> * @param {number} scale The desired scale of the viewport. <add> * @param {number} rotate Degrees to rotate the viewport. If omitted this <add> * defaults to the page rotation. <add> * @return {PageViewport} Contains 'width' and 'height' properties along <add> * with transforms required for rendering. <add> */ <ide> getViewport: function(scale, rotate) { <ide> if (arguments.length < 2) <ide> rotate = this.rotate; <ide> return new PDFJS.PageViewport(this.view, scale, rotate, 0, 0); <ide> }, <add> /** <add> * @return {Promise} A promise that is resolved with an {array} of the <add> * annotation objects. <add> */ <ide> getAnnotations: function() { <ide> var promise = new PDFJS.Promise(); <ide> var annotations = this.pageInfo.annotations; <ide> promise.resolve(annotations); <ide> return promise; <ide> }, <del> render: function(renderContext) { <add> /** <add> * Begins the process of rendering a page to the desired context. <add> * @param {object} params A parameter object that supports: <add> * { <add> * canvasContext(required): A 2D context of a DOM Canvas object., <add> * textLayer(optional): An object that has beginLayout, endLayout, and <add> * appendText functions. <add> * } <add> * @return {Promise} A promise that is resolved when the page finishes <add> * rendering. <add> */ <add> render: function(params) { <ide> var promise = new Promise(); <ide> var stats = this.stats; <ide> stats.time('Overall'); <ide> var PDFPageProxy = (function PDFPageProxyClosure() { <ide> // Once the operatorList and fonts are loaded, do the actual rendering. <ide> this.displayReadyPromise.then( <ide> function pageDisplayReadyPromise() { <del> var gfx = new CanvasGraphics(renderContext.canvasContext, <del> this.objs, renderContext.textLayer); <add> var gfx = new CanvasGraphics(params.canvasContext, <add> this.objs, params.textLayer); <ide> try { <del> this.display(gfx, renderContext.viewport, complete); <add> this.display(gfx, params.viewport, complete); <ide> } catch (e) { <ide> complete(e); <ide> } <ide> var PDFPageProxy = (function PDFPageProxyClosure() { <ide> <ide> return promise; <ide> }, <del> <add> /** <add> * For internal use only. <add> */ <ide> startRenderingFromOperatorList: <ide> function PDFPageWrapper_startRenderingFromOperatorList(operatorList, <ide> fonts) { <ide> var PDFPageProxy = (function PDFPageProxyClosure() { <ide> } <ide> ); <ide> }, <del> <add> /** <add> * For internal use only. <add> */ <ide> ensureFonts: function PDFPageWrapper_ensureFonts(fonts, callback) { <ide> this.stats.time('Font Loading'); <ide> // Convert the font names to the corresponding font obj. <ide> var PDFPageProxy = (function PDFPageProxyClosure() { <ide> }.bind(this) <ide> ); <ide> }, <del> <add> /** <add> * For internal use only. <add> */ <ide> display: function PDFPageWrapper_display(gfx, viewport, callback) { <ide> var stats = this.stats; <ide> stats.time('Rendering'); <ide> var PDFPageProxy = (function PDFPageProxyClosure() { <ide> } <ide> next(); <ide> }, <del> <add> /** <add> * Stub for future feature. <add> */ <ide> getTextContent: function() { <ide> var promise = new PDFJS.Promise(); <ide> var textContent = 'page text'; // not implemented <ide> promise.resolve(textContent); <ide> return promise; <ide> }, <add> /** <add> * Stub for future feature. <add> */ <ide> getOperationList: function() { <ide> var promise = new PDFJS.Promise(); <ide> var operationList = { // not implemented <ide> var PDFPageProxy = (function PDFPageProxyClosure() { <ide> }; <ide> return PDFPageProxy; <ide> })(); <del> <add>/** <add> * For internal use only. <add> */ <ide> var WorkerTransport = (function WorkerTransportClosure() { <ide> function WorkerTransport(promise) { <ide> this.workerReadyPromise = promise;
1
PHP
PHP
fix array syntax for php 5.3
5d5091f2fca543104c5635953ab36bbbe84a4c72
<ide><path>tests/View/ViewEnvironmentTest.php <ide> public function testComposersCanBeMassRegistered() <ide> $env->getDispatcher()->shouldReceive('listen')->once()->with('composing: foo', m::type('Closure')); <ide> $composers = $env->composers(array( <ide> 'foo' => 'bar', <del> 'baz@baz' => ['qux', 'foo'], <add> 'baz@baz' => array('qux', 'foo'), <ide> )); <ide> <ide> $reflections = array(
1
Javascript
Javascript
replace vars in child.js
18ce3a3b05018bd83d076365192584a4bb2c2763
<ide><path>lib/internal/cluster/child.js <ide> function rr(message, indexesKey, cb) { <ide> if (message.errno) <ide> return cb(message.errno, null); <ide> <del> var key = message.key; <add> let key = message.key; <ide> <ide> function listen(backlog) { <ide> // TODO(bnoordhuis) Send a message to the master that tells it to
1
Javascript
Javascript
update parser helpers to be compatible with hooks
c8e60b43220e1a825d876bedb1f8698635c3530f
<ide><path>lib/APIPlugin.js <ide> class APIPlugin { <ide> <ide> const handler = parser => { <ide> Object.keys(REPLACEMENTS).forEach(key => { <del> parser.plugin(`expression ${key}`, NO_WEBPACK_REQUIRE[key] ? ParserHelpers.toConstantDependency(REPLACEMENTS[key]) : ParserHelpers.toConstantDependencyWithWebpackRequire(REPLACEMENTS[key])); <add> parser.plugin(`expression ${key}`, NO_WEBPACK_REQUIRE[key] ? ParserHelpers.toConstantDependency(parser, REPLACEMENTS[key]) : ParserHelpers.toConstantDependencyWithWebpackRequire(parser, REPLACEMENTS[key])); <ide> parser.plugin(`evaluate typeof ${key}`, ParserHelpers.evaluateToString(REPLACEMENT_TYPES[key])); <ide> }); <ide> }; <ide><path>lib/DefinePlugin.js <ide> class DefinePlugin { <ide> res.setRange(expr.range); <ide> return res; <ide> }); <del> parser.plugin("expression " + key, /__webpack_require__/.test(code) ? ParserHelpers.toConstantDependencyWithWebpackRequire(code) : ParserHelpers.toConstantDependency(code)); <add> parser.plugin("expression " + key, /__webpack_require__/.test(code) ? ParserHelpers.toConstantDependencyWithWebpackRequire(parser, code) : ParserHelpers.toConstantDependency(parser, code)); <ide> } <ide> const typeofCode = isTypeof ? code : "typeof (" + code + ")"; <ide> parser.plugin("evaluate typeof " + key, (expr) => { <ide> class DefinePlugin { <ide> parser.plugin("typeof " + key, (expr) => { <ide> const res = parser.evaluate(typeofCode); <ide> if(!res.isString()) return; <del> return ParserHelpers.toConstantDependency(JSON.stringify(res.string)).bind(parser)(expr); <add> return ParserHelpers.toConstantDependency(parser, JSON.stringify(res.string)).bind(parser)(expr); <ide> }); <ide> }; <ide> <ide> class DefinePlugin { <ide> parser.plugin("can-rename " + key, ParserHelpers.approve); <ide> parser.plugin("evaluate Identifier " + key, (expr) => new BasicEvaluatedExpression().setTruthy().setRange(expr.range)); <ide> parser.plugin("evaluate typeof " + key, ParserHelpers.evaluateToString("object")); <del> parser.plugin("expression " + key, /__webpack_require__/.test(code) ? ParserHelpers.toConstantDependencyWithWebpackRequire(code) : ParserHelpers.toConstantDependency(code)); <del> parser.plugin("typeof " + key, ParserHelpers.toConstantDependency(JSON.stringify("object"))); <add> parser.plugin("expression " + key, /__webpack_require__/.test(code) ? ParserHelpers.toConstantDependencyWithWebpackRequire(parser, code) : ParserHelpers.toConstantDependency(parser, code)); <add> parser.plugin("typeof " + key, ParserHelpers.toConstantDependency(parser, JSON.stringify("object"))); <ide> }; <ide> <ide> walkDefinitions(definitions, ""); <ide><path>lib/ExtendedAPIPlugin.js <ide> class ExtendedAPIPlugin { <ide> <ide> const handler = (parser, parserOptions) => { <ide> Object.keys(REPLACEMENTS).forEach(key => { <del> parser.plugin(`expression ${key}`, ParserHelpers.toConstantDependencyWithWebpackRequire(REPLACEMENTS[key])); <add> parser.plugin(`expression ${key}`, ParserHelpers.toConstantDependencyWithWebpackRequire(parser, REPLACEMENTS[key])); <ide> parser.plugin(`evaluate typeof ${key}`, ParserHelpers.evaluateToString(REPLACEMENT_TYPES[key])); <ide> }); <ide> }; <ide><path>lib/HotModuleReplacementPlugin.js <ide> module.exports = class HotModuleReplacementPlugin { <ide> }); <ide> <ide> const handler = (parser, parserOptions) => { <del> parser.plugin("expression __webpack_hash__", ParserHelpers.toConstantDependencyWithWebpackRequire("__webpack_require__.h()")); <add> parser.plugin("expression __webpack_hash__", ParserHelpers.toConstantDependencyWithWebpackRequire(parser, "__webpack_require__.h()")); <ide> parser.plugin("evaluate typeof __webpack_hash__", ParserHelpers.evaluateToString("string")); <ide> parser.plugin("evaluate Identifier module.hot", expr => { <ide> return ParserHelpers.evaluateToIdentifier("module.hot", !!parser.state.compilation.hotUpdateChunkTemplate)(expr); <ide><path>lib/NodeStuffPlugin.js <ide> class NodeStuffPlugin { <ide> if(!parser.state.module) return; <ide> return ParserHelpers.evaluateToString(parser.state.module.context)(expr); <ide> }); <del> parser.plugin("expression require.main", ParserHelpers.toConstantDependencyWithWebpackRequire("__webpack_require__.c[__webpack_require__.s]")); <add> parser.plugin("expression require.main", ParserHelpers.toConstantDependencyWithWebpackRequire(parser, "__webpack_require__.c[__webpack_require__.s]")); <ide> parser.plugin( <ide> "expression require.extensions", <del> ParserHelpers.expressionIsUnsupported("require.extensions is not supported by webpack. Use a loader instead.") <add> ParserHelpers.expressionIsUnsupported(parser, "require.extensions is not supported by webpack. Use a loader instead.") <ide> ); <del> parser.plugin("expression module.loaded", ParserHelpers.toConstantDependency("module.l")); <del> parser.plugin("expression module.id", ParserHelpers.toConstantDependency("module.i")); <add> parser.plugin("expression module.loaded", ParserHelpers.toConstantDependency(parser, "module.l")); <add> parser.plugin("expression module.id", ParserHelpers.toConstantDependency(parser, "module.i")); <ide> parser.plugin("expression module.exports", () => { <ide> const module = parser.state.module; <ide> const isHarmony = module.buildMeta && module.buildMeta.harmonyModule; <ide><path>lib/ParserHelpers.js <ide> ParserHelpers.requireFileAsExpression = (context, pathToModule) => { <ide> return "require(" + JSON.stringify(moduleJsPath) + ")"; <ide> }; <ide> <del>ParserHelpers.toConstantDependency = (value) => { <add>ParserHelpers.toConstantDependency = (parser, value) => { <ide> return function constDependency(expr) { <ide> var dep = new ConstDependency(value, expr.range, false); <ide> dep.loc = expr.loc; <del> this.state.current.addDependency(dep); <add> parser.state.current.addDependency(dep); <ide> return true; <ide> }; <ide> }; <ide> <del>ParserHelpers.toConstantDependencyWithWebpackRequire = (value) => { <add>ParserHelpers.toConstantDependencyWithWebpackRequire = (parser, value) => { <ide> return function constDependencyWithWebpackRequire(expr) { <ide> var dep = new ConstDependency(value, expr.range, true); <ide> dep.loc = expr.loc; <del> this.state.current.addDependency(dep); <add> parser.state.current.addDependency(dep); <ide> return true; <ide> }; <ide> }; <ide> ParserHelpers.evaluateToIdentifier = (identifier, truthy) => { <ide> }; <ide> }; <ide> <del>ParserHelpers.expressionIsUnsupported = (message) => { <add>ParserHelpers.expressionIsUnsupported = (parser, message) => { <ide> return function unsupportedExpression(expr) { <ide> var dep = new ConstDependency("(void 0)", expr.range, false); <ide> dep.loc = expr.loc; <del> this.state.current.addDependency(dep); <del> if(!this.state.module) return; <del> this.state.module.warnings.push(new UnsupportedFeatureWarning(this.state.module, message)); <add> parser.state.current.addDependency(dep); <add> if(!parser.state.module) return; <add> parser.state.module.warnings.push(new UnsupportedFeatureWarning(parser.state.module, message)); <ide> return true; <ide> }; <ide> }; <ide><path>lib/ProvidePlugin.js <ide> class ProvidePlugin { <ide> return false; <ide> } <ide> if(scopedName) { <del> ParserHelpers.toConstantDependency(nameIdentifier).call(parser, expr); <add> ParserHelpers.toConstantDependency(parser, nameIdentifier)(expr); <ide> } <ide> return true; <ide> }); <ide><path>lib/RequireJsStuffPlugin.js <ide> module.exports = class RequireJsStuffPlugin { <ide> if(typeof parserOptions.requireJs !== "undefined" && !parserOptions.requireJs) <ide> return; <ide> <del> parser.plugin("call require.config", ParserHelpers.toConstantDependency("undefined")); <del> parser.plugin("call requirejs.config", ParserHelpers.toConstantDependency("undefined")); <add> parser.plugin("call require.config", ParserHelpers.toConstantDependency(parser, "undefined")); <add> parser.plugin("call requirejs.config", ParserHelpers.toConstantDependency(parser, "undefined")); <ide> <del> parser.plugin("expression require.version", ParserHelpers.toConstantDependency(JSON.stringify("0.0.0"))); <del> parser.plugin("expression requirejs.onError", ParserHelpers.toConstantDependencyWithWebpackRequire("__webpack_require__.oe")); <add> parser.plugin("expression require.version", ParserHelpers.toConstantDependency(parser, JSON.stringify("0.0.0"))); <add> parser.plugin("expression requirejs.onError", ParserHelpers.toConstantDependencyWithWebpackRequire(parser, "__webpack_require__.oe")); <ide> }; <ide> normalModuleFactory.hooks.parser.for("javascript/auto").tap("RequireJsStuffPlugin", handler); <ide> normalModuleFactory.hooks.parser.for("javascript/dynamic").tap("RequireJsStuffPlugin", handler); <ide><path>lib/dependencies/AMDPlugin.js <ide> class AMDPlugin { <ide> parser.plugin("evaluate typeof require.amd", ParserHelpers.evaluateToString(typeof amdOptions)); <ide> parser.plugin("evaluate Identifier define.amd", ParserHelpers.evaluateToIdentifier("define.amd", true)); <ide> parser.plugin("evaluate Identifier require.amd", ParserHelpers.evaluateToIdentifier("require.amd", true)); <del> parser.plugin("typeof define", ParserHelpers.toConstantDependency(JSON.stringify("function"))); <add> parser.plugin("typeof define", ParserHelpers.toConstantDependency(parser, JSON.stringify("function"))); <ide> parser.plugin("evaluate typeof define", ParserHelpers.evaluateToString("function")); <ide> parser.plugin("can-rename define", ParserHelpers.approve); <ide> parser.plugin("rename define", (expr) => { <ide> class AMDPlugin { <ide> parser.state.current.addDependency(dep); <ide> return false; <ide> }); <del> parser.plugin("typeof require", ParserHelpers.toConstantDependency(JSON.stringify("function"))); <add> parser.plugin("typeof require", ParserHelpers.toConstantDependency(parser, JSON.stringify("function"))); <ide> parser.plugin("evaluate typeof require", ParserHelpers.evaluateToString("function")); <ide> }; <ide> <ide><path>lib/dependencies/CommonJsPlugin.js <ide> class CommonJsPlugin { <ide> <ide> const requireExpressions = ["require", "require.resolve", "require.resolveWeak"]; <ide> for(let expression of requireExpressions) { <del> parser.plugin(`typeof ${expression}`, ParserHelpers.toConstantDependency(JSON.stringify("function"))); <add> parser.plugin(`typeof ${expression}`, ParserHelpers.toConstantDependency(parser, JSON.stringify("function"))); <ide> parser.plugin(`evaluate typeof ${expression}`, ParserHelpers.evaluateToString("function")); <ide> parser.plugin(`evaluate Identifier ${expression}`, ParserHelpers.evaluateToIdentifier(expression, true)); <ide> } <ide><path>lib/dependencies/CommonJsRequireDependencyParserPlugin.js <ide> class CommonJsRequireDependencyParserPlugin { <ide> return true; <ide> }; <ide> <del> parser.plugin("expression require.cache", ParserHelpers.toConstantDependencyWithWebpackRequire("__webpack_require__.c")); <add> parser.plugin("expression require.cache", ParserHelpers.toConstantDependencyWithWebpackRequire(parser, "__webpack_require__.c")); <ide> parser.plugin("expression require", (expr) => { <ide> const dep = new CommonJsRequireContextDependency({ <ide> request: options.unknownContextRequest, <ide><path>lib/dependencies/RequireEnsurePlugin.js <ide> class RequireEnsurePlugin { <ide> <ide> parser.apply(new RequireEnsureDependenciesBlockParserPlugin()); <ide> parser.plugin("evaluate typeof require.ensure", ParserHelpers.evaluateToString("function")); <del> parser.plugin("typeof require.ensure", ParserHelpers.toConstantDependency(JSON.stringify("function"))); <add> parser.plugin("typeof require.ensure", ParserHelpers.toConstantDependency(parser, JSON.stringify("function"))); <ide> }; <ide> <ide> normalModuleFactory.hooks.parser.for("javascript/auto").tap("RequireEnsurePlugin", handler); <ide><path>lib/dependencies/RequireIncludePlugin.js <ide> class RequireIncludePlugin { <ide> <ide> parser.apply(new RequireIncludeDependencyParserPlugin()); <ide> parser.plugin("evaluate typeof require.include", ParserHelpers.evaluateToString("function")); <del> parser.plugin("typeof require.include", ParserHelpers.toConstantDependency(JSON.stringify("function"))); <add> parser.plugin("typeof require.include", ParserHelpers.toConstantDependency(parser, JSON.stringify("function"))); <ide> }; <ide> <ide> normalModuleFactory.hooks.parser.for("javascript/auto").tap("RequireIncludePlugin", handler); <ide><path>lib/dependencies/SystemPlugin.js <ide> class SystemPlugin { <ide> const setNotSupported = name => { <ide> parser.plugin("evaluate typeof " + name, ParserHelpers.evaluateToString("undefined")); <ide> parser.plugin("expression " + name, <del> ParserHelpers.expressionIsUnsupported(name + " is not supported by webpack.") <add> ParserHelpers.expressionIsUnsupported(parser, name + " is not supported by webpack.") <ide> ); <ide> }; <ide> <del> parser.plugin("typeof System.import", ParserHelpers.toConstantDependency(JSON.stringify("function"))); <add> parser.plugin("typeof System.import", ParserHelpers.toConstantDependency(parser, JSON.stringify("function"))); <ide> parser.plugin("evaluate typeof System.import", ParserHelpers.evaluateToString("function")); <del> parser.plugin("typeof System", ParserHelpers.toConstantDependency(JSON.stringify("object"))); <add> parser.plugin("typeof System", ParserHelpers.toConstantDependency(parser, JSON.stringify("object"))); <ide> parser.plugin("evaluate typeof System", ParserHelpers.evaluateToString("object")); <ide> <ide> setNotSupported("System.set");
14
Mixed
Javascript
fix status bar default on android
6c501eb666db91286283c0faad748c6a43af5e78
<ide><path>Libraries/Components/StatusBar/StatusBar.js <ide> class StatusBar extends React.Component<Props> { <ide> static _defaultProps = createStackEntry({ <ide> animated: false, <ide> showHideTransition: 'fade', <del> backgroundColor: 'black', <add> backgroundColor: Platform.select({ <add> android: StatusBarManager.DEFAULT_BACKGROUND_COLOR ?? 'black', <add> ios: 'black', <add> }), <ide> barStyle: 'default', <ide> translucent: false, <ide> hidden: false, <ide><path>ReactAndroid/src/main/java/com/facebook/react/modules/statusbar/StatusBarModule.java <ide> public class StatusBarModule extends ReactContextBaseJavaModule { <ide> <ide> private static final String HEIGHT_KEY = "HEIGHT"; <add> private static final String DEFAULT_BACKGROUND_COLOR_KEY = "DEFAULT_BACKGROUND_COLOR"; <ide> public static final String NAME = "StatusBarManager"; <ide> <ide> public StatusBarModule(ReactApplicationContext reactContext) { <ide> public String getName() { <ide> @Override <ide> public @Nullable Map<String, Object> getConstants() { <ide> final Context context = getReactApplicationContext(); <add> final Activity activity = getCurrentActivity(); <add> <ide> final int heightResId = context.getResources() <ide> .getIdentifier("status_bar_height", "dimen", "android"); <ide> final float height = heightResId > 0 ? <ide> PixelUtil.toDIPFromPixel(context.getResources().getDimensionPixelSize(heightResId)) : <ide> 0; <add> String statusBarColorString = "black"; <add> <add> if (activity != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { <add> final int statusBarColor = activity.getWindow().getStatusBarColor(); <add> statusBarColorString = String.format("#%06X", (0xFFFFFF & statusBarColor)); <add> } <ide> <ide> return MapBuilder.<String, Object>of( <del> HEIGHT_KEY, height); <add> HEIGHT_KEY, height, DEFAULT_BACKGROUND_COLOR_KEY, statusBarColorString); <ide> } <ide> <ide> @ReactMethod
2
Python
Python
fix typo in comment (issue #596)
f0a09ec10fcaed37d226a4d8ee969cbd14d13f46
<ide><path>glances/core/glances_actions.py <ide> def run(self, stat_name, criticity, commands, mustache_dict=None): <ide> criticity, <ide> mustache_dict)) <ide> <del> # Ran all actions in background <add> # Run all actions in background <ide> for cmd in commands: <ide> # Replace {{arg}} by the dict one (Thk to {Mustache}) <ide> if pystache_tag:
1
PHP
PHP
remove temporary variable
361992f1578bc1db37936845cdedf58af1047bf9
<ide><path>src/Illuminate/Foundation/Application.php <ide> public function isLocale($locale) <ide> */ <ide> public function registerCoreContainerAliases() <ide> { <del> $aliases = [ <add> foreach ([ <ide> 'app' => [\Illuminate\Foundation\Application::class, \Illuminate\Contracts\Container\Container::class, \Illuminate\Contracts\Foundation\Application::class], <ide> 'auth' => [\Illuminate\Auth\AuthManager::class, \Illuminate\Contracts\Auth\Factory::class], <ide> 'auth.driver' => [\Illuminate\Contracts\Auth\Guard::class], <ide> public function registerCoreContainerAliases() <ide> 'url' => [\Illuminate\Routing\UrlGenerator::class, \Illuminate\Contracts\Routing\UrlGenerator::class], <ide> 'validator' => [\Illuminate\Validation\Factory::class, \Illuminate\Contracts\Validation\Factory::class], <ide> 'view' => [\Illuminate\View\Factory::class, \Illuminate\Contracts\View\Factory::class], <del> ]; <del> <del> foreach ($aliases as $key => $classes) { <del> foreach ($classes as $alias) { <add> ] as $key => $aliases) { <add> foreach ($aliases as $alias) { <ide> $this->alias($key, $alias); <ide> } <ide> }
1
Text
Text
add v3.24.0 to changelog
df3c7a65d14822155c9876f50849fa123edc1219
<ide><path>CHANGELOG.md <ide> # Ember Changelog <ide> <del>### v3.24.0-beta.3 (December 21, 2020) <del> <del>- [#19280](https://github.com/emberjs/ember.js/pull/19280) [BUGFIX] Ensure aliases cause recompute of a computed property when used with `@each` in the dependent keys of that property <del> <del>### v3.24.0-beta.2 (November 24, 2020) <del> <del>- [#19282](https://github.com/emberjs/ember.js/pull/19282) [BUGFIX] Issue deprecations (instead of assertions) for tracked mutation in constructor during rendering <del> <del>### v3.24.0-beta.1 (November 16, 2020) <add>### v3.24.0 (December 28, 2020) <ide> <ide> - [#19224](https://github.com/emberjs/ember.js/pull/19224) [FEATURE] Add `{{page-title}}` helper to route template blueprints to implement [RFC #0654](https://github.com/emberjs/rfcs/blob/master/text/0645-add-ember-page-title-addon.md). <ide> - [#19133](https://github.com/emberjs/ember.js/pull/19133) [FEATURE / DEPRECATION] Add new options to `deprecate()` for `for` and `since` and deprecate using `deprecate()` without those options per the [Deprecation Staging RFC](https://github.com/emberjs/rfcs/blob/master/text/0649-deprecation-staging.md). <ide> - [#19080](https://github.com/emberjs/ember.js/pull/19080) [BUGFIX] Lazily setup the router in non-application tests <ide> - [#19253](https://github.com/emberjs/ember.js/pull/19253) [BUGFIX] Correct return of getComponentTemplate from null to undefined to align with original RFC (#481) <ide> - [#19223](https://github.com/emberjs/ember.js/pull/19223) [BUGFIX] `<LinkTo>` should link within the engine when used inside one <add>- [#19280](https://github.com/emberjs/ember.js/pull/19280) [BUGFIX] Ensure aliases cause recompute of a computed property when used with `@each` in the dependent keys of that property <ide> - [#19196](https://github.com/emberjs/ember.js/pull/19196) [CLEANUP] Remove EMBER_GLIMMER_IN_ELEMENT feature flag <ide> - [#19204](https://github.com/emberjs/ember.js/pull/19204) [CLEANUP] Remove EMBER_CACHE_API feature flag <ide> - [#19206](https://github.com/emberjs/ember.js/pull/19206) [CLEANUP] Remove EMBER_ROUTING_MODEL_ARG feature flag
1
Text
Text
add changelog for 5.5.12 release
266b60e56066617fe60acb145b79348a094852cb
<ide><path>CHANGELOG-5.5.md <ide> # Release Notes for 5.5.x <ide> <add>## v5.5.12 (2017-09-22) <add> <add>### Added <add>- Added "software" as an uncountable word ([#21324](https://github.com/laravel/framework/pull/21324)) <add> <add>### Fixed <add>- Fixed null remember token error on EloquentUserProvider ([#21328](https://github.com/laravel/framework/pull/21328)) <add> <ide> ## v5.5.11 (2017-09-21) <ide> <ide> ### Fixed
1
Javascript
Javascript
add support for local plugins and plugin options
3187a788e17f79ad69da509748aeb64cdbac48f0
<ide><path>src/chart.js <ide> var Chart = require('./core/core.js')(); <ide> <ide> require('./core/core.helpers')(Chart); <ide> require('./core/core.canvasHelpers')(Chart); <add>require('./core/core.plugin.js')(Chart); <ide> require('./core/core.element')(Chart); <ide> require('./core/core.animation')(Chart); <ide> require('./core/core.controller')(Chart); <ide> require('./core/core.datasetController')(Chart); <ide> require('./core/core.layoutService')(Chart); <ide> require('./core/core.scaleService')(Chart); <del>require('./core/core.plugin.js')(Chart); <ide> require('./core/core.ticks.js')(Chart); <ide> require('./core/core.scale')(Chart); <ide> require('./core/core.title')(Chart); <ide><path>src/core/core.controller.js <ide> module.exports = function(Chart) { <ide> var me = this; <ide> <ide> // Before init plugin notification <del> Chart.plugins.notify('beforeInit', [me]); <add> Chart.plugins.notify(me, 'beforeInit'); <ide> <ide> me.bindEvents(); <ide> <ide> module.exports = function(Chart) { <ide> me.update(); <ide> <ide> // After init plugin notification <del> Chart.plugins.notify('afterInit', [me]); <add> Chart.plugins.notify(me, 'afterInit'); <ide> <ide> return me; <ide> }, <ide> module.exports = function(Chart) { <ide> if (!silent) { <ide> // Notify any plugins about the resize <ide> var newSize = {width: newWidth, height: newHeight}; <del> Chart.plugins.notify('resize', [me, newSize]); <add> Chart.plugins.notify(me, 'resize', [newSize]); <ide> <ide> // Notify of resize <ide> if (me.options.onResize) { <ide> module.exports = function(Chart) { <ide> var me = this; <ide> <ide> updateConfig(me); <del> Chart.plugins.notify('beforeUpdate', [me]); <add> Chart.plugins.notify(me, 'beforeUpdate'); <ide> <ide> // In case the entire data object changed <ide> me.tooltip._data = me.data; <ide> module.exports = function(Chart) { <ide> Chart.layoutService.update(me, me.chart.width, me.chart.height); <ide> <ide> // Apply changes to the datasets that require the scales to have been calculated i.e BorderColor changes <del> Chart.plugins.notify('afterScaleUpdate', [me]); <add> Chart.plugins.notify(me, 'afterScaleUpdate'); <ide> <ide> // Can only reset the new controllers after the scales have been updated <ide> helpers.each(newControllers, function(controller) { <ide> module.exports = function(Chart) { <ide> me.updateDatasets(); <ide> <ide> // Do this before render so that any plugins that need final scale updates can use it <del> Chart.plugins.notify('afterUpdate', [me]); <add> Chart.plugins.notify(me, 'afterUpdate'); <ide> <ide> if (me._bufferedRender) { <ide> me._bufferedRequest = { <ide> module.exports = function(Chart) { <ide> var me = this; <ide> var i, ilen; <ide> <del> if (Chart.plugins.notify('beforeDatasetsUpdate', [me])) { <add> if (Chart.plugins.notify(me, 'beforeDatasetsUpdate')) { <ide> for (i = 0, ilen = me.data.datasets.length; i < ilen; ++i) { <ide> me.getDatasetMeta(i).controller.update(); <ide> } <ide> <del> Chart.plugins.notify('afterDatasetsUpdate', [me]); <add> Chart.plugins.notify(me, 'afterDatasetsUpdate'); <ide> } <ide> }, <ide> <ide> render: function(duration, lazy) { <ide> var me = this; <del> Chart.plugins.notify('beforeRender', [me]); <add> Chart.plugins.notify(me, 'beforeRender'); <ide> <ide> var animationOptions = me.options.animation; <ide> if (animationOptions && ((typeof duration !== 'undefined' && duration !== 0) || (typeof duration === 'undefined' && animationOptions.duration !== 0))) { <ide> module.exports = function(Chart) { <ide> var easingDecimal = ease || 1; <ide> me.clear(); <ide> <del> Chart.plugins.notify('beforeDraw', [me, easingDecimal]); <add> Chart.plugins.notify(me, 'beforeDraw', [easingDecimal]); <ide> <ide> // Draw all the scales <ide> helpers.each(me.boxes, function(box) { <ide> module.exports = function(Chart) { <ide> me.scale.draw(); <ide> } <ide> <del> Chart.plugins.notify('beforeDatasetsDraw', [me, easingDecimal]); <add> Chart.plugins.notify(me, 'beforeDatasetsDraw', [easingDecimal]); <ide> <ide> // Draw each dataset via its respective controller (reversed to support proper line stacking) <ide> helpers.each(me.data.datasets, function(dataset, datasetIndex) { <ide> module.exports = function(Chart) { <ide> } <ide> }, me, true); <ide> <del> Chart.plugins.notify('afterDatasetsDraw', [me, easingDecimal]); <add> Chart.plugins.notify(me, 'afterDatasetsDraw', [easingDecimal]); <ide> <ide> // Finally draw the tooltip <ide> me.tooltip.transition(easingDecimal).draw(); <ide> <del> Chart.plugins.notify('afterDraw', [me, easingDecimal]); <add> Chart.plugins.notify(me, 'afterDraw', [easingDecimal]); <ide> }, <ide> <ide> // Get the single element that was clicked on <ide> module.exports = function(Chart) { <ide> me.chart.ctx = null; <ide> } <ide> <del> Chart.plugins.notify('destroy', [me]); <add> Chart.plugins.notify(me, 'destroy'); <ide> <ide> delete Chart.instances[me.id]; <ide> }, <ide><path>src/core/core.plugin.js <ide> <ide> module.exports = function(Chart) { <ide> <del> var noop = Chart.helpers.noop; <add> var helpers = Chart.helpers; <add> var noop = helpers.noop; <add> <add> Chart.defaults.global.plugins = {}; <ide> <ide> /** <ide> * The plugin service singleton <ide> * @namespace Chart.plugins <ide> * @since 2.1.0 <ide> */ <ide> Chart.plugins = { <add> /** <add> * Globally registered plugins. <add> * @private <add> */ <ide> _plugins: [], <ide> <add> /** <add> * This identifier is used to invalidate the descriptors cache attached to each chart <add> * when a global plugin is registered or unregistered. In this case, the cache ID is <add> * incremented and descriptors are regenerated during following API calls. <add> * @private <add> */ <add> _cacheId: 0, <add> <ide> /** <ide> * Registers the given plugin(s) if not already registered. <ide> * @param {Array|Object} plugins plugin instance(s). <ide> module.exports = function(Chart) { <ide> p.push(plugin); <ide> } <ide> }); <add> <add> this._cacheId++; <ide> }, <ide> <ide> /** <ide> module.exports = function(Chart) { <ide> p.splice(idx, 1); <ide> } <ide> }); <add> <add> this._cacheId++; <ide> }, <ide> <ide> /** <ide> module.exports = function(Chart) { <ide> */ <ide> clear: function() { <ide> this._plugins = []; <add> this._cacheId++; <ide> }, <ide> <ide> /** <ide> module.exports = function(Chart) { <ide> }, <ide> <ide> /** <del> * Calls registered plugins on the specified extension, with the given args. This <del> * method immediately returns as soon as a plugin explicitly returns false. The <add> * Calls enabled plugins for chart, on the specified extension and with the given args. <add> * This method immediately returns as soon as a plugin explicitly returns false. The <ide> * returned value can be used, for instance, to interrupt the current action. <add> * @param {Object} chart chart instance for which plugins should be called. <ide> * @param {String} extension the name of the plugin method to call (e.g. 'beforeUpdate'). <ide> * @param {Array} [args] extra arguments to apply to the extension call. <ide> * @returns {Boolean} false if any of the plugins return false, else returns true. <ide> */ <del> notify: function(extension, args) { <del> var plugins = this._plugins; <del> var ilen = plugins.length; <del> var i, plugin; <add> notify: function(chart, extension, args) { <add> var descriptors = this.descriptors(chart); <add> var ilen = descriptors.length; <add> var i, descriptor, plugin, params, method; <ide> <ide> for (i=0; i<ilen; ++i) { <del> plugin = plugins[i]; <del> if (typeof plugin[extension] === 'function') { <del> if (plugin[extension].apply(plugin, args || []) === false) { <add> descriptor = descriptors[i]; <add> plugin = descriptor.plugin; <add> method = plugin[extension]; <add> if (typeof method === 'function') { <add> params = [chart].concat(args || []); <add> params.push(descriptor.options); <add> if (method.apply(plugin, params) === false) { <ide> return false; <ide> } <ide> } <ide> } <ide> <ide> return true; <add> }, <add> <add> /** <add> * Returns descriptors of enabled plugins for the given chart. <add> * @returns {Array} [{ plugin, options }] <add> * @private <add> */ <add> descriptors: function(chart) { <add> var cache = chart._plugins || (chart._plugins = {}); <add> if (cache.id === this._cacheId) { <add> return cache.descriptors; <add> } <add> <add> var plugins = []; <add> var descriptors = []; <add> var config = (chart && chart.config) || {}; <add> var defaults = Chart.defaults.global.plugins; <add> var options = (config.options && config.options.plugins) || {}; <add> <add> this._plugins.concat(config.plugins || []).forEach(function(plugin) { <add> var idx = plugins.indexOf(plugin); <add> if (idx !== -1) { <add> return; <add> } <add> <add> var id = plugin.id; <add> var opts = options[id]; <add> if (opts === false) { <add> return; <add> } <add> <add> if (opts === true) { <add> opts = helpers.clone(defaults[id]); <add> } <add> <add> plugins.push(plugin); <add> descriptors.push({ <add> plugin: plugin, <add> options: opts || {} <add> }); <add> }); <add> <add> cache.descriptors = descriptors; <add> cache.id = this._cacheId; <add> return descriptors; <ide> } <ide> }; <ide> <ide> module.exports = function(Chart) { <ide> * @interface Chart.PluginBase <ide> * @since 2.1.0 <ide> */ <del> Chart.PluginBase = Chart.Element.extend({ <add> Chart.PluginBase = helpers.inherits({ <ide> // Called at start of chart init <ide> beforeInit: noop, <ide> <ide> module.exports = function(Chart) { <ide> * Provided for backward compatibility, use Chart.plugins instead <ide> * @namespace Chart.pluginService <ide> * @deprecated since version 2.1.5 <del> * @todo remove me at version 3 <add> * TODO remove me at version 3 <ide> */ <ide> Chart.pluginService = Chart.plugins; <ide> }; <ide><path>test/core.plugin.tests.js <ide> describe('Chart.plugins', function() { <del> var oldPlugins; <del> <del> beforeAll(function() { <del> oldPlugins = Chart.plugins.getAll(); <del> }); <del> <del> afterAll(function() { <del> Chart.plugins.register(oldPlugins); <add> beforeEach(function() { <add> this._plugins = Chart.plugins.getAll(); <add> Chart.plugins.clear(); <ide> }); <ide> <del> beforeEach(function() { <add> afterEach(function() { <ide> Chart.plugins.clear(); <add> Chart.plugins.register(this._plugins); <add> delete this._plugins; <ide> }); <ide> <ide> describe('Chart.plugins.register', function() { <ide> describe('Chart.plugins', function() { <ide> }); <ide> <ide> describe('Chart.plugins.notify', function() { <del> it('should call plugins with arguments', function() { <del> var myplugin = { <del> count: 0, <del> trigger: function(chart) { <del> myplugin.count = chart.count; <add> it('should call inline plugins with arguments', function() { <add> var plugin = {hook: function() {}}; <add> var chart = window.acquireChart({ <add> plugins: [plugin] <add> }); <add> <add> spyOn(plugin, 'hook'); <add> <add> Chart.plugins.notify(chart, 'hook', 42); <add> expect(plugin.hook.calls.count()).toBe(1); <add> expect(plugin.hook.calls.first().args[0]).toBe(chart); <add> expect(plugin.hook.calls.first().args[1]).toBe(42); <add> expect(plugin.hook.calls.first().args[2]).toEqual({}); <add> }); <add> <add> it('should call global plugins with arguments', function() { <add> var plugin = {hook: function() {}}; <add> var chart = window.acquireChart({}); <add> <add> spyOn(plugin, 'hook'); <add> <add> Chart.plugins.register(plugin); <add> Chart.plugins.notify(chart, 'hook', 42); <add> expect(plugin.hook.calls.count()).toBe(1); <add> expect(plugin.hook.calls.first().args[0]).toBe(chart); <add> expect(plugin.hook.calls.first().args[1]).toBe(42); <add> expect(plugin.hook.calls.first().args[2]).toEqual({}); <add> }); <add> <add> it('should call plugin only once even if registered multiple times', function() { <add> var plugin = {hook: function() {}}; <add> var chart = window.acquireChart({ <add> plugins: [plugin, plugin] <add> }); <add> <add> spyOn(plugin, 'hook'); <add> <add> Chart.plugins.register([plugin, plugin]); <add> Chart.plugins.notify(chart, 'hook'); <add> expect(plugin.hook.calls.count()).toBe(1); <add> }); <add> <add> it('should call plugins in the correct order (global first)', function() { <add> var results = []; <add> var chart = window.acquireChart({ <add> plugins: [{ <add> hook: function() { <add> results.push(1); <add> } <add> }, { <add> hook: function() { <add> results.push(2); <add> } <add> }, { <add> hook: function() { <add> results.push(3); <add> } <add> }] <add> }); <add> <add> Chart.plugins.register([{ <add> hook: function() { <add> results.push(4); <ide> } <del> }; <add> }, { <add> hook: function() { <add> results.push(5); <add> } <add> }, { <add> hook: function() { <add> results.push(6); <add> } <add> }]); <ide> <del> Chart.plugins.register(myplugin); <del> Chart.plugins.notify('trigger', [{count: 10}]); <del> expect(myplugin.count).toBe(10); <add> var ret = Chart.plugins.notify(chart, 'hook'); <add> expect(ret).toBeTruthy(); <add> expect(results).toEqual([4, 5, 6, 1, 2, 3]); <ide> }); <ide> <ide> it('should return TRUE if no plugin explicitly returns FALSE', function() { <del> Chart.plugins.register({ <del> check: function() {} <add> var chart = window.acquireChart({ <add> plugins: [{ <add> hook: function() {} <add> }, { <add> hook: function() { <add> return null; <add> } <add> }, { <add> hook: function() { <add> return 0; <add> } <add> }, { <add> hook: function() { <add> return true; <add> } <add> }, { <add> hook: function() { <add> return 1; <add> } <add> }] <ide> }); <del> Chart.plugins.register({ <del> check: function() { <del> return; <del> } <add> <add> var plugins = chart.config.plugins; <add> plugins.forEach(function(plugin) { <add> spyOn(plugin, 'hook').and.callThrough(); <ide> }); <del> Chart.plugins.register({ <del> check: function() { <del> return null; <del> } <add> <add> var ret = Chart.plugins.notify(chart, 'hook'); <add> expect(ret).toBeTruthy(); <add> plugins.forEach(function(plugin) { <add> expect(plugin.hook).toHaveBeenCalled(); <ide> }); <del> Chart.plugins.register({ <del> check: function() { <del> return 42; <del> } <add> }); <add> <add> it('should return FALSE if any plugin explicitly returns FALSE', function() { <add> var chart = window.acquireChart({ <add> plugins: [{ <add> hook: function() {} <add> }, { <add> hook: function() { <add> return null; <add> } <add> }, { <add> hook: function() { <add> return false; <add> } <add> }, { <add> hook: function() { <add> return 42; <add> } <add> }, { <add> hook: function() { <add> return 'bar'; <add> } <add> }] <ide> }); <del> var res = Chart.plugins.notify('check'); <del> expect(res).toBeTruthy(); <add> <add> var plugins = chart.config.plugins; <add> plugins.forEach(function(plugin) { <add> spyOn(plugin, 'hook').and.callThrough(); <add> }); <add> <add> var ret = Chart.plugins.notify(chart, 'hook'); <add> expect(ret).toBeFalsy(); <add> expect(plugins[0].hook).toHaveBeenCalled(); <add> expect(plugins[1].hook).toHaveBeenCalled(); <add> expect(plugins[2].hook).toHaveBeenCalled(); <add> expect(plugins[3].hook).not.toHaveBeenCalled(); <add> expect(plugins[4].hook).not.toHaveBeenCalled(); <ide> }); <add> }); <ide> <del> it('should return FALSE if no plugin explicitly returns FALSE', function() { <del> Chart.plugins.register({ <del> check: function() {} <add> describe('config.options.plugins', function() { <add> it('should call plugins with options at last argument', function() { <add> var plugin = {id: 'foo', hook: function() {}}; <add> var chart = window.acquireChart({ <add> options: { <add> plugins: { <add> foo: {a: '123'}, <add> } <add> } <ide> }); <del> Chart.plugins.register({ <del> check: function() { <del> return; <add> <add> spyOn(plugin, 'hook'); <add> <add> Chart.plugins.register(plugin); <add> Chart.plugins.notify(chart, 'hook'); <add> Chart.plugins.notify(chart, 'hook', ['bla']); <add> Chart.plugins.notify(chart, 'hook', ['bla', 42]); <add> <add> expect(plugin.hook.calls.count()).toBe(3); <add> expect(plugin.hook.calls.argsFor(0)[1]).toEqual({a: '123'}); <add> expect(plugin.hook.calls.argsFor(1)[2]).toEqual({a: '123'}); <add> expect(plugin.hook.calls.argsFor(2)[3]).toEqual({a: '123'}); <add> }); <add> <add> it('should call plugins with options associated to their identifier', function() { <add> var plugins = { <add> a: {id: 'a', hook: function() {}}, <add> b: {id: 'b', hook: function() {}}, <add> c: {id: 'c', hook: function() {}} <add> }; <add> <add> Chart.plugins.register(plugins.a); <add> <add> var chart = window.acquireChart({ <add> plugins: [plugins.b, plugins.c], <add> options: { <add> plugins: { <add> a: {a: '123'}, <add> b: {b: '456'}, <add> c: {c: '789'} <add> } <ide> } <ide> }); <del> Chart.plugins.register({ <del> check: function() { <del> return false; <add> <add> spyOn(plugins.a, 'hook'); <add> spyOn(plugins.b, 'hook'); <add> spyOn(plugins.c, 'hook'); <add> <add> Chart.plugins.notify(chart, 'hook'); <add> <add> expect(plugins.a.hook).toHaveBeenCalled(); <add> expect(plugins.b.hook).toHaveBeenCalled(); <add> expect(plugins.c.hook).toHaveBeenCalled(); <add> expect(plugins.a.hook.calls.first().args[1]).toEqual({a: '123'}); <add> expect(plugins.b.hook.calls.first().args[1]).toEqual({b: '456'}); <add> expect(plugins.c.hook.calls.first().args[1]).toEqual({c: '789'}); <add> }); <add> <add> it('should not called plugins when config.options.plugins.{id} is FALSE', function() { <add> var plugins = { <add> a: {id: 'a', hook: function() {}}, <add> b: {id: 'b', hook: function() {}}, <add> c: {id: 'c', hook: function() {}} <add> }; <add> <add> Chart.plugins.register(plugins.a); <add> <add> var chart = window.acquireChart({ <add> plugins: [plugins.b, plugins.c], <add> options: { <add> plugins: { <add> a: false, <add> b: false <add> } <ide> } <ide> }); <del> Chart.plugins.register({ <del> check: function() { <del> return 42; <add> <add> spyOn(plugins.a, 'hook'); <add> spyOn(plugins.b, 'hook'); <add> spyOn(plugins.c, 'hook'); <add> <add> Chart.plugins.notify(chart, 'hook'); <add> <add> expect(plugins.a.hook).not.toHaveBeenCalled(); <add> expect(plugins.b.hook).not.toHaveBeenCalled(); <add> expect(plugins.c.hook).toHaveBeenCalled(); <add> }); <add> <add> it('should call plugins with default options when plugin options is TRUE', function() { <add> var plugin = {id: 'a', hook: function() {}}; <add> <add> Chart.defaults.global.plugins.a = {a: 42}; <add> Chart.plugins.register(plugin); <add> <add> var chart = window.acquireChart({ <add> options: { <add> plugins: { <add> a: true <add> } <ide> } <ide> }); <del> var res = Chart.plugins.notify('check'); <del> expect(res).toBeFalsy(); <add> <add> spyOn(plugin, 'hook'); <add> <add> Chart.plugins.notify(chart, 'hook'); <add> <add> expect(plugin.hook).toHaveBeenCalled(); <add> expect(plugin.hook.calls.first().args[1]).toEqual({a: 42}); <add> }); <add> <add> <add> it('should call plugins with default options if plugin config options is undefined', function() { <add> var plugin = {id: 'a', hook: function() {}}; <add> <add> Chart.defaults.global.plugins.a = {a: 'foobar'}; <add> Chart.plugins.register(plugin); <add> spyOn(plugin, 'hook'); <add> <add> var chart = window.acquireChart(); <add> <add> Chart.plugins.notify(chart, 'hook'); <add> <add> expect(plugin.hook).toHaveBeenCalled(); <add> expect(plugin.hook.calls.first().args[1]).toEqual({a: 'foobar'}); <ide> }); <ide> }); <ide> }); <ide><path>test/mockContext.js <ide> var canvas = document.createElement('canvas'); <ide> var chart, key; <ide> <add> config = config || {}; <ide> options = options || {}; <ide> options.canvas = options.canvas || {height: 512, width: 512}; <ide> options.wrapper = options.wrapper || {class: 'chartjs-wrapper'};
5
PHP
PHP
fix behavior of --plugin param
c727444880b5fc7e63493cc46fec6063e7b347f7
<ide><path>lib/Cake/Console/Shell.php <ide> public function runCommand($command, $argv) { <ide> if (!empty($this->params['quiet'])) { <ide> $this->_useLogger(false); <ide> } <del> <add> if (!empty($this->params['plugin'])) { <add> CakePlugin::load($this->params['plugin']); <add> } <ide> $this->command = $command; <ide> if (!empty($this->params['help'])) { <ide> return $this->_displayHelp($command);
1
PHP
PHP
send full job back into redisqueue
16e862c1e22795acab869fa01ec5f8bcd7d400b3
<ide><path>src/Illuminate/Queue/Jobs/RedisJob.php <ide> public function delete() <ide> { <ide> parent::delete(); <ide> <del> $this->redis->deleteReserved($this->queue, $this->reserved); <add> $this->redis->deleteReserved($this->queue, $this); <ide> } <ide> <ide> /** <ide> public function release($delay = 0) <ide> { <ide> parent::release($delay); <ide> <del> $this->redis->deleteAndRelease($this->queue, $this->reserved, $delay); <add> $this->redis->deleteAndRelease($this->queue, $this, $delay); <ide> } <ide> <ide> /** <ide><path>src/Illuminate/Queue/RedisQueue.php <ide> protected function retrieveNextJob($queue) <ide> * Delete a reserved job from the queue. <ide> * <ide> * @param string $queue <del> * @param string $job <add> * @param \Illuminate\Queues\Jobs\RedisJob $job <ide> * @return void <ide> */ <ide> public function deleteReserved($queue, $job) <ide> { <del> $this->getConnection()->zrem($this->getQueue($queue).':reserved', $job); <add> $this->getConnection()->zrem($this->getQueue($queue).':reserved', $job->getReservedJob()); <ide> } <ide> <ide> /** <ide> * Delete a reserved job from the reserved queue and release it. <ide> * <ide> * @param string $queue <del> * @param string $job <add> * @param \Illuminate\Queues\Jobs\RedisJob $job <ide> * @param int $delay <ide> * @return void <ide> */ <ide> public function deleteAndRelease($queue, $job, $delay) <ide> <ide> $this->getConnection()->eval( <ide> LuaScripts::release(), 2, $queue.':delayed', $queue.':reserved', <del> $job, $this->availableAt($delay) <add> $job->getReservedJob(), $this->availableAt($delay) <ide> ); <ide> } <ide> <ide><path>tests/Queue/QueueRedisJobTest.php <ide> public function testDeleteRemovesTheJobFromRedis() <ide> { <ide> $job = $this->getJob(); <ide> $job->getRedisQueue()->shouldReceive('deleteReserved')->once() <del> ->with('default', json_encode(['job' => 'foo', 'data' => ['data'], 'attempts' => 2])); <add> ->with('default', $job); <ide> <ide> $job->delete(); <ide> } <ide> public function testReleaseProperlyReleasesJobOntoRedis() <ide> { <ide> $job = $this->getJob(); <ide> $job->getRedisQueue()->shouldReceive('deleteAndRelease')->once() <del> ->with('default', json_encode(['job' => 'foo', 'data' => ['data'], 'attempts' => 2]), 1); <add> ->with('default', $job, 1); <ide> <ide> $job->release(1); <ide> }
3
Text
Text
clarify language in article
e59727cea76af92878b183099feb0f522763e586
<ide><path>client/src/pages/guide/english/bootstrap/fontawesome-icons/index.md <ide> title: Fontawesome Icons For Bootstrap <ide> --- <ide> ## Fontawesome Icons For Bootstrap <ide> <del>Bootstrap (version 4) have dropped Glyphicon icons font in their latest release. <del>Fontawesome Icons provide you with over 675 icons, they come in font format. <add>Bootstrap (from version 4 onwards) have dropped Glyphicon icons font in their latest release. <add>Fontawesome Icons provide you with over 675 icons and they come in font format. <ide> <ide> #### How To Use: <ide>
1
Javascript
Javascript
add copyhooks function
5a4a1cba2445d71aadf4ebf4350090dfdb32d871
<ide><path>lib/internal/async_hooks.js <ide> function storeActiveHooks() { <ide> // Don't want to make the assumption that kInit to kDestroy are indexes 0 to <ide> // 4. So do this the long way. <ide> active_hooks.tmp_fields = []; <del> active_hooks.tmp_fields[kInit] = async_hook_fields[kInit]; <del> active_hooks.tmp_fields[kBefore] = async_hook_fields[kBefore]; <del> active_hooks.tmp_fields[kAfter] = async_hook_fields[kAfter]; <del> active_hooks.tmp_fields[kDestroy] = async_hook_fields[kDestroy]; <del> active_hooks.tmp_fields[kPromiseResolve] = async_hook_fields[kPromiseResolve]; <add> copyHooks(active_hooks.tmp_fields, async_hook_fields); <add>} <add> <add>function copyHooks(destination, source) { <add> destination[kInit] = source[kInit]; <add> destination[kBefore] = source[kBefore]; <add> destination[kAfter] = source[kAfter]; <add> destination[kDestroy] = source[kDestroy]; <add> destination[kPromiseResolve] = source[kPromiseResolve]; <ide> } <ide> <ide> <ide> // Then restore the correct hooks array in case any hooks were added/removed <ide> // during hook callback execution. <ide> function restoreActiveHooks() { <ide> active_hooks.array = active_hooks.tmp_array; <del> async_hook_fields[kInit] = active_hooks.tmp_fields[kInit]; <del> async_hook_fields[kBefore] = active_hooks.tmp_fields[kBefore]; <del> async_hook_fields[kAfter] = active_hooks.tmp_fields[kAfter]; <del> async_hook_fields[kDestroy] = active_hooks.tmp_fields[kDestroy]; <del> async_hook_fields[kPromiseResolve] = active_hooks.tmp_fields[kPromiseResolve]; <add> copyHooks(async_hook_fields, active_hooks.tmp_fields); <ide> <ide> active_hooks.tmp_array = null; <ide> active_hooks.tmp_fields = null;
1
Text
Text
fix code snippet in essentials tutorial part-6
df18e8a96b7bdc31a8ceeba63db019354494f9b8
<ide><path>docs/tutorials/essentials/part-6-performance-normalization.md <ide> export const fetchNotifications = createAsyncThunk( <ide> const response = await client.get( <ide> `/fakeApi/notifications?since=${latestTimestamp}` <ide> ) <del> return response.notifications <add> return response.data <ide> } <ide> ) <ide>
1
Text
Text
consolidate issue templates
25ee3e00f42e4b8dddebd378a40b6475f9d52a63
<ide><path>.github/ISSUE_TEMPLATE/bug_report.md <ide> --- <ide> name: "🐛 Bug Report" <del>about: You want to report a reproducible bug or regression in React Native. <add>about: Report a reproducible bug or regression in React Native. <ide> title: '' <ide> labels: 'Bug' <ide> <ide> --- <ide> <del>## 🐛 Bug Report <ide> <!-- <del> A clear and concise description of what the bug is. <add> Please provide a clear and concise description of what the bug is. <ide> Include screenshots if needed. <add> Please test using the latest React Native release to make sure your issue has not already been fixed: http://facebook.github.io/react-native/docs/upgrading.html <ide> --> <ide> <del>## To Reproduce <add>React Native version: <ide> <!-- <del> Steps to reproduce the behavior. <add> Run `react-native info` in your terminal and copy the results here. <ide> --> <ide> <del>## Expected Behavior <add>## Steps To Reproduce <add> <add>1. <add>2. <add> <ide> <!-- <del> A clear and concise description of what you expected to happen. <add> Issues without reproduction steps or code are likely to stall. <ide> --> <ide> <del>## Code Example <add>Describe what you expected to happen: <add> <add> <add>Snack, code example, or link to a repository: <add> <add> <ide> <!-- <ide> Please provide a Snack (https://snack.expo.io/), a link to a repository on GitHub, or <ide> provide a minimal code example that reproduces the problem. <ide> Here are some tips for providing a minimal example: https://stackoverflow.com/help/mcve. <del> <del> Issues without a reproduction link are likely to stall. <ide> --> <ide> <del>## Environment <del><!-- <del> Run `react-native info` in your terminal and copy the results here. <del>--> <ide><path>.github/ISSUE_TEMPLATE/discussion.md <del>--- <del>name: "🚀 Discussion" <del>about: You have an idea that could make React Native better, or you want to discuss some aspect of the framework. <del>title: 'Discussion: ' <del>labels: 'Type: Discussion' <del> <del>--- <del> <del>If you want to participate in casual discussions about the use of React Native, consider participating in one of the following forums: <del>- Discord Community: https://discord.gg/0ZcbPKXt5bZjGY5n <del>- Spectrum Chat: https://spectrum.chat/react-native <del>- Facebook Group: https://www.facebook.com/groups/react.native.community <del> <del>For a full list of community resources: <del>- http://facebook.github.io/react-native/help <del> <del>If you'd like to discuss topics related to the future of React Native, please check out the discussions and proposals repo: <del>- https://github.com/react-native-community/discussions-and-proposals <del> <del>### Please note that discussions opened as issues in the core React Native repository will be closed. <ide><path>.github/ISSUE_TEMPLATE/documentation.md <ide> --- <del>name: "📃 Documentation Bug" <del>about: You want to report something that is wrong or missing from the documentation. <add>name: "📃 Documentation Issue" <add>about: Documentation issues are handled in https://github.com/facebook/react-native-website. <ide> title: 'Docs:' <ide> labels: 'Type: Docs' <ide> <ide> --- <ide> <add>🚨 Please do not open a documentation issue in the core React Native repository. 🚨 <add> <ide> The React Native website is hosted on a separate repository. You may let the <ide> team know about any issues with the documentation by opening an issue there: <ide> - https://github.com/facebook/react-native-website <ide> - https://github.com/facebook/react-native-website/issues <del> <del>### Please do not open a documentation issue in the core React Native repository. <ide><path>.github/ISSUE_TEMPLATE/question.md <ide> --- <ide> name: "🤔 Questions and Help" <del>about: You need help writing your React Native app. <add>about: The issue tracker is not for questions. Please ask questions on https://stackoverflow.com/questions/tagged/react-native. <ide> title: 'Question: ' <ide> labels: 'Type: Question' <ide> <ide> --- <ide> <del>We use GitHub Issues exclusively to track bugs in React Native. As it happens, support requests that are created as issues are likely to be closed. We want to make sure you are able to find the help you seek. Please take a look at the following resources. <add>🚨 The issue tracker is not for questions. 🚨 <ide> <add>As it happens, support requests that are created as issues are likely to be closed. We want to make sure you are able to find the help you seek. Please take a look at the following resources. <ide> <ide> ## Coding Questions <ide> <ide> If you have a coding question related to React Native, it might be better suited <ide> <ide> Reactiflux is an active community of React and React Native developers. If you are looking for immediate assistance or have a general question about React Native, the #react-native channel is a good place to start. <ide> <add>If you want to participate in casual discussions about the use of React Native, consider participating in one of the following forums: <add>- Discord Community: https://discord.gg/0ZcbPKXt5bZjGY5n <add>- Spectrum Chat: https://spectrum.chat/react-native <add>- Facebook Group: https://www.facebook.com/groups/react.native.community <add> <add>If you'd like to discuss topics related to the future of React Native, or would like to propose a new feature or change before sending a pull request, please check out the discussions and proposals repo: <add>- https://github.com/react-native-community/discussions-and-proposals <ide> <ide> > For a full list of community resources, check out React Native's Community page at https://facebook.github.io/react-native/help. <ide><path>.github/ISSUE_TEMPLATE/regression.md <del>--- <del>name: "💥 Regression Report" <del>about: You want to report unexpected behavior that worked in previous releases. <del>title: 'Regression: ' <del>labels: 'Type: Bug Report, Impact: Regression' <del> <del>--- <del> <del>## 💥 Regression Report <del><!-- <del> A clear and concise description of what the regression is. <del> Include screenshots if needed. <del>--> <del> <del>## Last working version <del> <del>Worked up to version: <del> <del>Stopped working in version: <del> <del>## To Reproduce <del> <del><!-- <del> Steps to reproduce the behavior. <del>--> <del> <del>## Expected Behavior <del> <del><!-- <del> A clear and concise description of what you expected to happen. <del>--> <del> <del>## Code Example <del><!-- <del> Please provide a Snack (https://snack.expo.io/), a link to a repository on GitHub, or <del> provide a minimal code example that reproduces the problem. <del> Here are some tips for providing a minimal example: https://stackoverflow.com/help/mcve. <del> <del> Issues without a reproduction link are likely to stall. <del>--> <del> <del>## Environment <del><!-- <del> Run `react-native info` in your terminal and copy the results here. <del>-->
5