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
Mixed
Text
fix gfm formating issue
3b7e8d2e6ba35efa4fcf8df16c0c005662f2402d
<ide><path>examples/code-splitted-require.context-amd/README.md <ide> getTemplate("b", function(b) { <ide> <ide> # js/output.js <ide> <del><details><summary>`/******/ (function(modules) { /* webpackBootstrap */ })`</summary> <add><details><summary><code>/******/ (function(modules) { /* webpackBootstrap */ })</code></summary> <add> <ide> ``` javascript <ide> /******/ (function(modules) { // webpackBootstrap <ide> /******/ // install a JSONP callback for chunk loading <ide> getTemplate("b", function(b) { <ide> /******/ }) <ide> /************************************************************************/ <ide> ``` <add> <ide> </details> <add> <ide> ``` javascript <ide> /******/ ([ <ide> /* 0 */ <ide><path>examples/code-splitted-require.context/README.md <ide> getTemplate("b", function(b) { <ide> <ide> # js/output.js <ide> <del><details><summary>`/******/ (function(modules) { /* webpackBootstrap */ })`</summary> <add><details><summary><code>/******/ (function(modules) { /* webpackBootstrap */ })</code></summary> <add> <ide> ``` javascript <ide> /******/ (function(modules) { // webpackBootstrap <ide> /******/ // install a JSONP callback for chunk loading <ide> getTemplate("b", function(b) { <ide> /******/ }) <ide> /************************************************************************/ <ide> ``` <add> <ide> </details> <add> <ide> ``` javascript <ide> /******/ ([ <ide> /* 0 */ <ide><path>examples/code-splitting-bundle-loader/README.md <ide> module.exports = "It works"; <ide> <ide> # js/output.js <ide> <del><details><summary>`/******/ (function(modules) { /* webpackBootstrap */ })`</summary> <add><details><summary><code>/******/ (function(modules) { /* webpackBootstrap */ })</code></summary> <add> <ide> ``` javascript <ide> /******/ (function(modules) { // webpackBootstrap <ide> /******/ // install a JSONP callback for chunk loading <ide> module.exports = "It works"; <ide> /******/ }) <ide> /************************************************************************/ <ide> ``` <add> <ide> </details> <add> <ide> ``` javascript <ide> /******/ ([ <ide> /* 0 */ <ide><path>examples/code-splitting-harmony/README.md <ide> Promise.all([loadC("1"), loadC("2")]).then(function(arr) { <ide> <ide> # js/output.js <ide> <del><details><summary>`/******/ (function(modules) { /* webpackBootstrap */ })`</summary> <add><details><summary><code>/******/ (function(modules) { /* webpackBootstrap */ })</code></summary> <add> <ide> ``` javascript <ide> /******/ (function(modules) { // webpackBootstrap <ide> /******/ // install a JSONP callback for chunk loading <ide> Promise.all([loadC("1"), loadC("2")]).then(function(arr) { <ide> /******/ }) <ide> /************************************************************************/ <ide> ``` <add> <ide> </details> <add> <ide> ``` javascript <ide> /******/ ([ <ide> /* 0 */ <ide><path>examples/code-splitting-native-import-context/README.md <ide> export default foo; <ide> <ide> # js/output.js <ide> <del><details><summary>`/******/ (function(modules) { /* webpackBootstrap */ })`</summary> <add><details><summary><code>/******/ (function(modules) { /* webpackBootstrap */ })</code></summary> <add> <ide> ``` javascript <ide> /******/ (function(modules) { // webpackBootstrap <ide> /******/ // install a JSONP callback for chunk loading <ide> export default foo; <ide> /******/ }) <ide> /************************************************************************/ <ide> ``` <add> <ide> </details> <add> <ide> ``` javascript <ide> /******/ ([ <ide> /* 0 */ <ide><path>examples/code-splitting/README.md <ide> require.ensure(["c"], function(require) { <ide> <ide> # js/output.js <ide> <del><details><summary>`/******/ (function(modules) { /* webpackBootstrap */ })`</summary> <add><details><summary><code>/******/ (function(modules) { /* webpackBootstrap */ })</code></summary> <add> <ide> ``` javascript <ide> /******/ (function(modules) { // webpackBootstrap <ide> /******/ // install a JSONP callback for chunk loading <ide> require.ensure(["c"], function(require) { <ide> /******/ }) <ide> /************************************************************************/ <ide> ``` <add> <ide> </details> <add> <ide> ``` javascript <ide> /******/ ([ <ide> /* 0 */ <ide><path>examples/coffee-script/README.md <ide> module.exports = 42 <ide> <ide> # js/output.js <ide> <del><details><summary>`/******/ (function(modules) { /* webpackBootstrap */ })`</summary> <add><details><summary><code>/******/ (function(modules) { /* webpackBootstrap */ })</code></summary> <add> <ide> ``` javascript <ide> /******/ (function(modules) { // webpackBootstrap <ide> /******/ // The module cache <ide> module.exports = 42 <ide> /******/ }) <ide> /************************************************************************/ <ide> ``` <add> <ide> </details> <add> <ide> ``` javascript <ide> /******/ ([ <ide> /* 0 */ <ide><path>examples/common-chunk-and-vendor-chunk/README.md <ide> module.exports = { <ide> <ide> # js/vendor.js <ide> <del><details><summary>`/******/ (function(modules) { /* webpackBootstrap */ })`</summary> <add><details><summary><code>/******/ (function(modules) { /* webpackBootstrap */ })</code></summary> <add> <ide> ``` javascript <ide> /******/ (function(modules) { // webpackBootstrap <ide> /******/ // install a JSONP callback for chunk loading <ide> module.exports = { <ide> /******/ }) <ide> /************************************************************************/ <ide> ``` <add> <ide> </details> <add> <ide> ``` javascript <ide> /******/ ({ <ide> <ide><path>examples/commonjs/README.md <ide> exports.add = function() { <ide> <ide> # js/output.js <ide> <del><details><summary>`/******/ (function(modules) { /* webpackBootstrap */ })`</summary> <add><details><summary><code>/******/ (function(modules) { /* webpackBootstrap */ })</code></summary> <add> <ide> ``` javascript <ide> /******/ (function(modules) { // webpackBootstrap <ide> /******/ // The module cache <ide> exports.add = function() { <ide> /******/ }) <ide> /************************************************************************/ <ide> ``` <add> <ide> </details> <add> <ide> ``` javascript <ide> /******/ ([ <ide> /* 0 */ <ide><path>examples/css-bundle/README.md <ide> module.exports = { <ide> <ide> # js/output.js <ide> <del><details><summary>`/******/ (function(modules) { /* webpackBootstrap */ })`</summary> <add><details><summary><code>/******/ (function(modules) { /* webpackBootstrap */ })</code></summary> <add> <ide> ``` javascript <ide> /******/ (function(modules) { // webpackBootstrap <ide> /******/ // The module cache <ide> module.exports = { <ide> /******/ }) <ide> /************************************************************************/ <ide> ``` <add> <ide> </details> <add> <ide> ``` javascript <ide> /******/ ([ <ide> /* 0 */ <ide><path>examples/dll-user/README.md <ide> console.log(require("module")); <ide> <ide> # js/output.js <ide> <del><details><summary>`/******/ (function(modules) { /* webpackBootstrap */ })`</summary> <add><details><summary><code>/******/ (function(modules) { /* webpackBootstrap */ })</code></summary> <add> <ide> ``` javascript <ide> /******/ (function(modules) { // webpackBootstrap <ide> /******/ // The module cache <ide> console.log(require("module")); <ide> /******/ }) <ide> /************************************************************************/ <ide> ``` <add> <ide> </details> <add> <ide> ``` javascript <ide> /******/ ([ <ide> /* 0 */ <ide><path>examples/dll/README.md <ide> module.exports = { <ide> ``` javascript <ide> var alpha_282e8826843b2bb4eeb1 = <ide> ``` <del><details><summary>`/******/ (function(modules) { /* webpackBootstrap */ })`</summary> <add><details><summary><code>/******/ (function(modules) { /* webpackBootstrap */ })</code></summary> <add> <ide> ``` js <ide> /******/ (function(modules) { // webpackBootstrap <ide> /******/ // The module cache <ide> var alpha_282e8826843b2bb4eeb1 = <ide> /******/ }) <ide> /************************************************************************/ <ide> ``` <add> <ide> </details> <add> <ide> ``` js <ide> /******/ ([ <ide> /* 0 */ <ide><path>examples/explicit-vendor-chunk/README.md <ide> module.exports = [ <ide> ``` javascript <ide> var vendor_32199746b38d6e93b44b = <ide> ``` <del><details><summary>`/******/ (function(modules) { /* webpackBootstrap */ })`</summary> <add><details><summary><code>/******/ (function(modules) { /* webpackBootstrap */ })</code></summary> <add> <ide> ``` js <ide> /******/ (function(modules) { // webpackBootstrap <ide> /******/ // The module cache <ide> var vendor_32199746b38d6e93b44b = <ide> /******/ }) <ide> /************************************************************************/ <ide> ``` <add> <ide> </details> <add> <ide> ``` js <ide> /******/ ([ <ide> /* 0 */ <ide><path>examples/externals/README.md <ide> module.exports = { <ide> } <ide> })(this, function(__WEBPACK_EXTERNAL_MODULE_0__, __WEBPACK_EXTERNAL_MODULE_1__) { <ide> ``` <del><details><summary>`return /******/ (function(modules) { /* webpackBootstrap */ })`</summary> <add><details><summary><code>return /******/ (function(modules) { /* webpackBootstrap */ })</code></summary> <add> <ide> ``` js <ide> return /******/ (function(modules) { // webpackBootstrap <ide> /******/ // The module cache <ide> return /******/ (function(modules) { // webpackBootstrap <ide> /******/ }) <ide> /************************************************************************/ <ide> ``` <add> <ide> </details> <add> <ide> ``` js <ide> /******/ ([ <ide> /* 0 */ <ide><path>examples/extra-async-chunk-advanced/README.md <ide> module.exports = { <ide> <ide> # js/output.js <ide> <del><details><summary>`/******/ (function(modules) { /* webpackBootstrap */ })`</summary> <add><details><summary><code>/******/ (function(modules) { /* webpackBootstrap */ })</code></summary> <add> <ide> ``` javascript <ide> /******/ (function(modules) { // webpackBootstrap <ide> /******/ // install a JSONP callback for chunk loading <ide> module.exports = { <ide> /******/ }) <ide> /************************************************************************/ <ide> ``` <add> <ide> </details> <add> <ide> ``` javascript <ide> /******/ ({ <ide> <ide><path>examples/extra-async-chunk/README.md <ide> module.exports = { <ide> <ide> # js/output.js <ide> <del><details><summary>`/******/ (function(modules) { /* webpackBootstrap */ })`</summary> <add><details><summary><code>/******/ (function(modules) { /* webpackBootstrap */ })</code></summary> <add> <ide> ``` javascript <ide> /******/ (function(modules) { // webpackBootstrap <ide> /******/ // install a JSONP callback for chunk loading <ide> module.exports = { <ide> /******/ }) <ide> /************************************************************************/ <ide> ``` <add> <ide> </details> <add> <ide> ``` javascript <ide> /******/ ({ <ide> <ide><path>examples/harmony-interop/README.md <ide> export var named = "named"; <ide> <ide> # js/output.js <ide> <del><details><summary>`/******/ (function(modules) { /* webpackBootstrap */ })`</summary> <add><details><summary><code>/******/ (function(modules) { /* webpackBootstrap */ })</code></summary> <add> <ide> ``` javascript <ide> /******/ (function(modules) { // webpackBootstrap <ide> /******/ // The module cache <ide> export var named = "named"; <ide> /******/ }) <ide> /************************************************************************/ <ide> ``` <add> <ide> </details> <add> <ide> ``` javascript <ide> /******/ ([ <ide> /* 0 */ <ide><path>examples/harmony-library/README.md <ide> module.exports = { <ide> root["MyLibrary"] = factory(); <ide> })(this, function() { <ide> ``` <del><details><summary>`return /******/ (function(modules) { /* webpackBootstrap */ })`</summary> <add><details><summary><code>return /******/ (function(modules) { /* webpackBootstrap */ })</code></summary> <add> <ide> ``` js <ide> return /******/ (function(modules) { // webpackBootstrap <ide> /******/ // The module cache <ide> return /******/ (function(modules) { // webpackBootstrap <ide> /******/ }) <ide> /************************************************************************/ <ide> ``` <add> <ide> </details> <add> <ide> ``` js <ide> /******/ ([ <ide> /* 0 */ <ide><path>examples/harmony-unused/README.md <ide> export { add as reexportedAdd, multiply as reexportedMultiply } from "./math"; <ide> <ide> # js/output.js <ide> <del><details><summary>`/******/ (function(modules) { /* webpackBootstrap */ })`</summary> <add><details><summary><code>/******/ (function(modules) { /* webpackBootstrap */ })</code></summary> <add> <ide> ``` javascript <ide> /******/ (function(modules) { // webpackBootstrap <ide> /******/ // The module cache <ide> export { add as reexportedAdd, multiply as reexportedMultiply } from "./math"; <ide> /******/ }) <ide> /************************************************************************/ <ide> ``` <add> <ide> </details> <add> <ide> ``` javascript <ide> /******/ ([ <ide> /* 0 */ <ide><path>examples/harmony/README.md <ide> export function increment(val) { <ide> <ide> # js/output.js <ide> <del><details><summary>`/******/ (function(modules) { /* webpackBootstrap */ })`</summary> <add><details><summary><code>/******/ (function(modules) { /* webpackBootstrap */ })</code></summary> <add> <ide> ``` javascript <ide> /******/ (function(modules) { // webpackBootstrap <ide> /******/ // install a JSONP callback for chunk loading <ide> export function increment(val) { <ide> /******/ }) <ide> /************************************************************************/ <ide> ``` <add> <ide> </details> <add> <ide> ``` javascript <ide> /******/ ([ <ide> /* 0 */ <ide><path>examples/hybrid-routing/README.md <ide> window.onLinkToPage = function onLinkToPage(name) { // name is "a" or "b" <ide> <ide> # js/commons.js <ide> <del><details><summary>`/******/ (function(modules) { /* webpackBootstrap */ })`</summary> <add><details><summary><code>/******/ (function(modules) { /* webpackBootstrap */ })</code></summary> <add> <ide> ``` javascript <ide> /******/ (function(modules) { // webpackBootstrap <ide> /******/ // install a JSONP callback for chunk loading <ide> window.onLinkToPage = function onLinkToPage(name) { // name is "a" or "b" <ide> /******/ }) <ide> /************************************************************************/ <ide> ``` <add> <ide> </details> <add> <ide> ``` javascript <ide> /******/ ([ <ide> /* 0 */ <ide><path>examples/i18n/README.md <ide> module.exports = Object.keys(languages).map(function(language) { <ide> <ide> # js/de.output.js <ide> <del><details><summary>`/******/ (function(modules) { /* webpackBootstrap */ })`</summary> <add><details><summary><code>/******/ (function(modules) { /* webpackBootstrap */ })</code></summary> <add> <ide> ``` javascript <ide> /******/ (function(modules) { // webpackBootstrap <ide> /******/ // The module cache <ide> module.exports = Object.keys(languages).map(function(language) { <ide> /******/ }) <ide> /************************************************************************/ <ide> ``` <add> <ide> </details> <add> <ide> ``` javascript <ide> /******/ ([ <ide> /* 0 */ <ide><path>examples/loader/README.md <ide> module.exports = function(content) { <ide> <ide> # js/output.js <ide> <del><details><summary>`/******/ (function(modules) { /* webpackBootstrap */ })`</summary> <add><details><summary><code>/******/ (function(modules) { /* webpackBootstrap */ })</code></summary> <add> <ide> ``` javascript <ide> /******/ (function(modules) { // webpackBootstrap <ide> /******/ // The module cache <ide> module.exports = function(content) { <ide> /******/ }) <ide> /************************************************************************/ <ide> ``` <add> <ide> </details> <add> <ide> ``` javascript <ide> /******/ ([ <ide> /* 0 */ <ide><path>examples/mixed/README.md <ide> require( <ide> <ide> # js/output.js <ide> <del><details><summary>`/******/ (function(modules) { /* webpackBootstrap */ })`</summary> <add><details><summary><code>/******/ (function(modules) { /* webpackBootstrap */ })</code></summary> <add> <ide> ``` javascript <ide> /******/ (function(modules) { // webpackBootstrap <ide> /******/ // install a JSONP callback for chunk loading <ide> require( <ide> /******/ }) <ide> /************************************************************************/ <ide> ``` <add> <ide> </details> <add> <ide> ``` javascript <ide> /******/ ([ <ide> /* 0 */ <ide><path>examples/multi-compiler/README.md <ide> module.exports = [ <ide> <ide> # js/desktop.js <ide> <del><details><summary>`/******/ (function(modules) { /* webpackBootstrap */ })`</summary> <add><details><summary><code>/******/ (function(modules) { /* webpackBootstrap */ })</code></summary> <add> <ide> ``` javascript <ide> /******/ (function(modules) { // webpackBootstrap <ide> /******/ // The module cache <ide> module.exports = [ <ide> /******/ }) <ide> /************************************************************************/ <ide> ``` <add> <ide> </details> <add> <ide> ``` javascript <ide> /******/ ([ <ide> /* 0 */ <ide><path>examples/multi-part-library/README.md <ide> module.exports = { <ide> root["MyLibrary"] = root["MyLibrary"] || {}, root["MyLibrary"]["alpha"] = factory(); <ide> })(this, function() { <ide> ``` <del><details><summary>`return /******/ (function(modules) { /* webpackBootstrap */ })`</summary> <add><details><summary><code>return /******/ (function(modules) { /* webpackBootstrap */ })</code></summary> <add> <ide> ``` js <ide> return /******/ (function(modules) { // webpackBootstrap <ide> /******/ // The module cache <ide> return /******/ (function(modules) { // webpackBootstrap <ide> /******/ }) <ide> /************************************************************************/ <ide> ``` <add> <ide> </details> <add> <ide> ``` js <ide> /******/ ([ <ide> /* 0 */ <ide><path>examples/multiple-commons-chunks/README.md <ide> module.exports = { <ide> <ide> # js/commons.js <ide> <del><details><summary>`/******/ (function(modules) { /* webpackBootstrap */ })`</summary> <add><details><summary><code>/******/ (function(modules) { /* webpackBootstrap */ })</code></summary> <add> <ide> ``` javascript <ide> /******/ (function(modules) { // webpackBootstrap <ide> /******/ // install a JSONP callback for chunk loading <ide> module.exports = { <ide> /******/ }) <ide> /************************************************************************/ <ide> ``` <add> <ide> </details> <add> <ide> ``` javascript <ide> /******/ ([ <ide> /* 0 */ <ide><path>examples/multiple-entry-points/README.md <ide> module.exports = { <ide> <ide> # js/commons.js <ide> <del><details><summary>`/******/ (function(modules) { /* webpackBootstrap */ })`</summary> <add><details><summary><code>/******/ (function(modules) { /* webpackBootstrap */ })</code></summary> <add> <ide> ``` javascript <ide> /******/ (function(modules) { // webpackBootstrap <ide> /******/ // install a JSONP callback for chunk loading <ide> module.exports = { <ide> /******/ }) <ide> /************************************************************************/ <ide> ``` <add> <ide> </details> <add> <ide> ``` javascript <ide> /******/ ([ <ide> /* 0 */, <ide><path>examples/named-chunks/README.md <ide> require.ensure(["b"], function(require) { <ide> <ide> # js/output.js <ide> <del><details><summary>`/******/ (function(modules) { /* webpackBootstrap */ })`</summary> <add><details><summary><code>/******/ (function(modules) { /* webpackBootstrap */ })</code></summary> <add> <ide> ``` javascript <ide> /******/ (function(modules) { // webpackBootstrap <ide> /******/ // install a JSONP callback for chunk loading <ide> require.ensure(["b"], function(require) { <ide> /******/ }) <ide> /************************************************************************/ <ide> ``` <add> <ide> </details> <add> <ide> ``` javascript <ide> /******/ ([ <ide> /* 0 */, <ide><path>examples/require.context/README.md <ide> module.exports = function() { <ide> <ide> # js/output.js <ide> <del><details><summary>`/******/ (function(modules) { /* webpackBootstrap */ })`</summary> <add><details><summary><code>/******/ (function(modules) { /* webpackBootstrap */ })</code></summary> <add> <ide> ``` javascript <ide> /******/ (function(modules) { // webpackBootstrap <ide> /******/ // The module cache <ide> module.exports = function() { <ide> /******/ }) <ide> /************************************************************************/ <ide> ``` <add> <ide> </details> <add> <ide> ``` javascript <ide> /******/ ([ <ide> /* 0 */ <ide><path>examples/require.resolve/README.md <ide> module.exports = Math.random(); <ide> <ide> # js/output.js <ide> <del><details><summary>`/******/ (function(modules) { /* webpackBootstrap */ })`</summary> <add><details><summary><code>/******/ (function(modules) { /* webpackBootstrap */ })</code></summary> <add> <ide> ``` javascript <ide> /******/ (function(modules) { // webpackBootstrap <ide> /******/ // The module cache <ide> module.exports = Math.random(); <ide> /******/ }) <ide> /************************************************************************/ <ide> ``` <add> <ide> </details> <add> <ide> ``` javascript <ide> /******/ ([ <ide> /* 0 */ <ide><path>examples/template-common.js <ide> module.exports = function(template, baseDir, stdout, prefix) { <ide> match = runtimeRegexp.exec(match); <ide> var prefix = match[1] ? "" : "```\n"; <ide> var inner = match[1] ? match[1] : "``` js\n"; <del> return prefix + "<details><summary>`" + match[2] + "/******/ (function(modules) { /* webpackBootstrap */ })`</summary>\n" + inner + match[2] + match[3] + "```\n</details>\n" + inner; <add> return prefix + "<details><summary><code>" + match[2] + "/******/ (function(modules) { /* webpackBootstrap */ })</code></summary>\n\n" + inner + match[2] + match[3] + "```\n\n</details>\n\n" + inner; <ide> }); <ide> <ide> } <ide><path>examples/two-explicit-vendor-chunks/README.md <ide> module.exports = { <ide> <ide> # js/vendor1.js <ide> <del><details><summary>`/******/ (function(modules) { /* webpackBootstrap */ })`</summary> <add><details><summary><code>/******/ (function(modules) { /* webpackBootstrap */ })</code></summary> <add> <ide> ``` javascript <ide> /******/ (function(modules) { // webpackBootstrap <ide> /******/ // install a JSONP callback for chunk loading <ide> module.exports = { <ide> /******/ }) <ide> /************************************************************************/ <ide> ``` <add> <ide> </details> <add> <ide> ``` javascript <ide> /******/ ({ <ide> <ide><path>examples/web-worker/README.md <ide> onmessage = function(event) { <ide> <ide> # js/output.js <ide> <del><details><summary>`/******/ (function(modules) { /* webpackBootstrap */ })`</summary> <add><details><summary><code>/******/ (function(modules) { /* webpackBootstrap */ })</code></summary> <add> <ide> ``` javascript <ide> /******/ (function(modules) { // webpackBootstrap <ide> /******/ // The module cache <ide> onmessage = function(event) { <ide> /******/ }) <ide> /************************************************************************/ <ide> ``` <add> <ide> </details> <add> <ide> ``` javascript <ide> /******/ ([ <ide> /* 0 */
34
Text
Text
remove workspaceview from doc
f592a5d11fca374e0b14c6948631f6ccdc75d051
<ide><path>docs/advanced/globals.md <ide> Atom exposes several services through singleton objects accessible via the <ide> * workspace: <ide> Manipulate and query the state of the user interface for the current <ide> window. Open editors, manipulate panes. <del> * workspaceView: <del> Similar to workspace, but provides access to the root of all views in the <del> current window. <ide> * project: <ide> Access the directory associated with the current window. Load editors, <ide> perform project-wide searches, register custom openers for special file
1
Javascript
Javascript
show actual error in next-tick-when-exiting
8055bdbbc9badb2042e44a8e843e364f2b3f6284
<ide><path>test/parallel/test-next-tick-when-exiting.js <ide> 'use strict'; <ide> <del>require('../common'); <add>const common = require('../common'); <ide> const assert = require('assert'); <ide> <ide> process.on('exit', () => { <del> assert.strictEqual(process._exiting, true, 'process._exiting was not set!'); <add> assert.strictEqual(process._exiting, true); <ide> <del> process.nextTick(() => { <del> assert.fail('process is exiting, should not be called.'); <del> }); <add> process.nextTick( <add> common.mustNotCall('process is exiting, should not be called') <add> ); <ide> }); <ide> <ide> process.exit();
1
Text
Text
create an outline for creating a theme
93a0c6eeb50215dcccc6a2cef7c161bd779c9383
<ide><path>docs/creating-a-theme.md <ide> "title": "Creating a Theme" <ide> }}} <ide> <del># Authoring Themes (Not Yet Implemented) <add># Creating a Theme <add> <add>## Overview <add> <add>* Explain the difference between ui themes and syntax themes <add> <add>## Getting Started <add> <add>* What do I need to install? <add> * Atom - to edit text <add> * Git - to track and distribute your themes <add>* What do I need to know? <add> * CSS/LESS - as that's what themes are written in <add>* Is there an example I can start from? <add> * Yes, you can clone https://github.com/atom/solarized-dark-syntax <add> <add># Create a minimal syntax theme <add> <add>```bash <add>cd ~/.atom/packages <add>mkdir my-theme <add>cd my-theme <add>git init <add>mkdir stylesheets <add>cat > package.json <<END <add>{ <add> "name": "theme-rainbow", <add> "theme": true, <add> "stylesheets": [ <add> 'included-first.less', <add> 'included-second.less' <add> ] <add> "version": "0.0.1", <add> "description": "Rainbows are beautiful", <add> "repository": { <add> "type": "git", <add> "url": "https://github.com/atom/theme-rainbow.git" <add> }, <add> "bugs": { <add> "url": "https://github.com/atom/theme-rainbow/issues" <add> }, <add> "engines": { <add> "atom": "~>1.0" <add> } <add>} <add>END <add> <add>cat > stylesheets/included-first.less <<END <add>@import "ui-variables"; <add> <add>.editor { <add> color: fade(@text-color, 20%); <add>} <add>END <add> <add>cat > stylesheets/included-second.less <<END <add>@import "ui-colors"; <add> <add>.editor { <add> color: fade(@text-color, 80%); <add>} <add>END <add>``` <add> <add>### Important points <add> <add>* Notice the theme attribute in the package.json file. This is specific to Atom <add> and required for all theme packages. Otherwise they won't be displayed in the <add> theme chooser. <add>* Notice the stylesheets attribute. If have multiple stylesheets and their order <add> is meaningful than you should specify their relative pathnames here. Otherwise <add> all css or less files will be loaded alphabetically from the stylesheets <add> folder. <add>* Notice the ui-variables require. If you'd like to make your theme adapt to the <add> users choosen ui theme, these variables allow you to create your own colors <add> based on them. <add> <add>## Create a minimal ui theme <add> <add>* Needs to have a file called ui-variables and it must contain the following <add> variables: <add> * A list of variables from @benogle's theme refactor.
1
Python
Python
fix token_type_ids error for big_bird model.
5e04d7086803ae4a3892f4082f2835a756592c2c
<ide><path>src/transformers/models/big_bird/tokenization_big_bird.py <ide> def get_special_tokens_mask( <ide> if token_ids_1 is None: <ide> return [1] + ([0] * len(token_ids_0)) + [1] <ide> return [1] + ([0] * len(token_ids_0)) + [1] + ([0] * len(token_ids_1)) + [1] <add> <add> def create_token_type_ids_from_sequences( <add> self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None <add> ) -> List[int]: <add> """ <add> Create a mask from the two sequences passed to be used in a sequence-pair classification task. A BERT sequence <add> pair mask has the following format: :: 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 | first sequence | second <add> sequence | If :obj:`token_ids_1` is :obj:`None`, this method only returns the first portion of the mask (0s). <add> <add> Args: <add> token_ids_0 (:obj:`List[int]`): <add> List of IDs. <add> token_ids_1 (:obj:`List[int]`, `optional`): <add> Optional second list of IDs for sequence pairs. <add> <add> Returns: <add> :obj:`List[int]`: List of `token type IDs <../glossary.html#token-type-ids>`_ according to the given <add> sequence(s). <add> """ <add> sep = [self.sep_token_id] <add> cls = [self.cls_token_id] <add> if token_ids_1 is None: <add> return len(cls + token_ids_0 + sep) * [0] <add> return len(cls + token_ids_0 + sep) * [0] + len(token_ids_1 + sep) * [1]
1
Python
Python
fix .delete on object store example
bf8fe66f443381981ee0b1d8583895a5a57b69e5
<ide><path>examples/objectstore/views.py <ide> def put(self, request, key): <ide> pickle.dump(self.CONTENT, open(pathname, 'wb')) <ide> return self.CONTENT <ide> <del> def delete(self, request): <add> def delete(self, request, key): <ide> """ <ide> Delete a stored object, by removing it's pickled file. <ide> """
1
Javascript
Javascript
log exit code
7806c0875b97802247fbfbf552689272bbcdcc78
<ide><path>packager/react-packager/src/SocketInterface/SocketServer.js <ide> class SocketServer { <ide> options <ide> ); <ide> resolve(this); <del> process.on('exit', () => fs.unlinkSync(sockPath)); <add> process.on('exit', code => { <add> debug('exit code:', code); <add> fs.unlinkSync(sockPath); <add> }); <ide> }); <ide> }); <ide>
1
PHP
PHP
add link to psr-16 specs
fccc1e5eb4241e95404c54da6e90ca10ad671b50
<ide><path>src/Cache/SimpleCacheEngine.php <ide> * the PSR16 Simple Cache Interface <ide> * <ide> * @since 3.7.0 <add> * @link https://www.php-fig.org/psr/psr-16/ <ide> */ <ide> class SimpleCacheEngine implements CacheInterface <ide> {
1
Text
Text
fix bug in actionmailer guide
65158a6701b4200aaf4575b8f645acc7f2ae0895
<ide><path>guides/source/action_mailer_basics.md <ide> create test/mailers/previews/user_mailer_preview.rb <ide> ```ruby <ide> # app/mailers/application_mailer.rb <ide> class ApplicationMailer < ActionMailer::Base <del> default "from@example.com" <add> default from: "from@example.com" <ide> layout 'mailer' <ide> end <ide>
1
Python
Python
fix proxy objects to respect !=
d58c98d73c41b97e9543f88d3a81ffa6f23e4c7d
<ide><path>django/utils/functional.py <ide> def __cast(self): <ide> else: <ide> return func(*self.__args, **self.__kw) <ide> <add> def __ne__(self, other): <add> if isinstance(other, Promise): <add> other = other.__cast() <add> return self.__cast() != other <add> <ide> def __eq__(self, other): <ide> if isinstance(other, Promise): <ide> other = other.__cast()
1
PHP
PHP
fix sqlserver tests and add missing coverage
248ad972840847e7dd44c96341776cfabb1b330d
<ide><path>src/Database/Schema/SqlserverSchema.php <ide> protected function _convertColumn($col, $length = null, $precision = null, $scal <ide> } <ide> <ide> if ($col === 'tinyint') { <del> return ['type' => 'smallint', 'length' => $precision ?: 3]; <add> return ['type' => 'tinyint', 'length' => $precision ?: 3]; <ide> } <ide> if ($col === 'smallint') { <ide> return ['type' => 'smallint', 'length' => $precision ?: 5]; <ide><path>tests/TestCase/Database/Schema/SqlserverSchemaTest.php <ide> public static function convertColumnProvider() <ide> [ <ide> 'TINYINT', <ide> null, <del> 4, <add> 2, <ide> null, <del> ['type' => 'tinyint', 'length' => 4] <add> ['type' => 'tinyint', 'length' => 2] <add> ], <add> [ <add> 'TINYINT', <add> null, <add> null, <add> null, <add> ['type' => 'tinyint', 'length' => 3] <ide> ], <ide> [ <ide> 'SMALLINT', <ide> null, <del> 4, <add> 3, <add> null, <add> ['type' => 'smallint', 'length' => 3] <add> ], <add> [ <add> 'SMALLINT', <add> null, <add> null, <ide> null, <del> ['type' => 'smallint', 'length' => 4] <add> ['type' => 'smallint', 'length' => 5] <ide> ], <ide> [ <ide> 'INTEGER',
2
Ruby
Ruby
fix shebang handling for empty files. references
b056adf03bd8b331db80f40f484126795d5d9323
<ide><path>railties/lib/rails_generator/commands.rb <ide> def file(relative_source, relative_destination, file_options = {}, &block) <ide> if block_given? <ide> df.write(yield(sf)) <ide> else <del> line = sf.gets || '' <ide> if file_options[:shebang] <ide> df.puts("#!#{file_options[:shebang]}") <del> df.puts(line) if line !~ /^#!/ <del> else <del> df.puts(line) <add> if line = sf.gets <add> df.puts(line) if line !~ /^#!/ <add> end <ide> end <ide> df.write(sf.read) <ide> end
1
Mixed
Javascript
add support for eventtarget in once
34a61d563088c97f13e193d00c91cd893f1479b8
<ide><path>doc/api/events.md <ide> added: v11.13.0 <ide> * `name` {string} <ide> * Returns: {Promise} <ide> <del>Creates a `Promise` that is resolved when the `EventEmitter` emits the given <add>Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given <ide> event or that is rejected when the `EventEmitter` emits `'error'`. <ide> The `Promise` will resolve with an array of all the arguments emitted to the <ide> given event. <ide> <add>This method is intentionally generic and works with the web platform <add>[EventTarget](WHATWG-EventTarget) interface, which has no special <add>`'error'` event semantics and does not listen to the `'error'` event. <add> <ide> ```js <ide> const { once, EventEmitter } = require('events'); <ide> <ide> async function run() { <ide> <ide> run(); <ide> ``` <del> <add>[WHATWG-EventTarget](https://dom.spec.whatwg.org/#interface-eventtarget) <ide> [`--trace-warnings`]: cli.html#cli_trace_warnings <ide> [`EventEmitter.defaultMaxListeners`]: #events_eventemitter_defaultmaxlisteners <ide> [`domain`]: domain.html <ide><path>lib/events.js <ide> function unwrapListeners(arr) { <ide> <ide> function once(emitter, name) { <ide> return new Promise((resolve, reject) => { <add> if (typeof emitter.addEventListener === 'function') { <add> // EventTarget does not have `error` event semantics like Node <add> // EventEmitters, we do not listen to `error` events here. <add> emitter.addEventListener( <add> name, <add> (...args) => { resolve(args); }, <add> { once: true } <add> ); <add> return; <add> } <add> <ide> const eventListener = (...args) => { <ide> if (errorListener !== undefined) { <ide> emitter.removeListener('error', errorListener); <ide><path>test/parallel/test-events-once.js <ide> const common = require('../common'); <ide> const { once, EventEmitter } = require('events'); <ide> const { strictEqual, deepStrictEqual } = require('assert'); <ide> <add>class EventTargetMock { <add> constructor() { <add> this.events = {}; <add> } <add> <add> addEventListener = common.mustCall(function(name, listener, options) { <add> if (!(name in this.events)) { <add> this.events[name] = { listeners: [], options }; <add> } <add> this.events[name].listeners.push(listener); <add> }); <add> <add> removeEventListener = common.mustCall(function(name, callback) { <add> if (!(name in this.events)) { <add> return; <add> } <add> const event = this.events[name]; <add> const stack = event.listeners; <add> <add> for (let i = 0, l = stack.length; i < l; i++) { <add> if (stack[i] === callback) { <add> stack.splice(i, 1); <add> if (stack.length === 0) { <add> Reflect.deleteProperty(this.events, name); <add> } <add> return; <add> } <add> } <add> }); <add> <add> dispatchEvent = function(name, ...arg) { <add> if (!(name in this.events)) { <add> return true; <add> } <add> const event = this.events[name]; <add> const stack = event.listeners.slice(); <add> <add> for (let i = 0, l = stack.length; i < l; i++) { <add> stack[i].apply(this, arg); <add> if (event.options.once) { <add> this.removeEventListener(name, stack[i]); <add> } <add> } <add> return !name.defaultPrevented; <add> }; <add>} <add> <ide> async function onceAnEvent() { <ide> const ee = new EventEmitter(); <ide> <ide> async function onceError() { <ide> strictEqual(ee.listenerCount('myevent'), 0); <ide> } <ide> <add>async function onceWithEventTarget() { <add> const et = new EventTargetMock(); <add> <add> process.nextTick(() => { <add> et.dispatchEvent('myevent', 42); <add> }); <add> const [ value ] = await once(et, 'myevent'); <add> strictEqual(value, 42); <add> strictEqual(Reflect.has(et.events, 'myevent'), false); <add>} <add> <add>async function onceWithEventTargetTwoArgs() { <add> const et = new EventTargetMock(); <add> <add> process.nextTick(() => { <add> et.dispatchEvent('myevent', 42, 24); <add> }); <add> <add> const value = await once(et, 'myevent'); <add> deepStrictEqual(value, [42, 24]); <add>} <add> <add>async function onceWithEventTargetError() { <add> const et = new EventTargetMock(); <add> <add> const expected = new Error('kaboom'); <add> process.nextTick(() => { <add> et.dispatchEvent('error', expected); <add> }); <add> <add> const [err] = await once(et, 'error'); <add> strictEqual(err, expected); <add> strictEqual(Reflect.has(et.events, 'error'), false); <add>} <add> <ide> Promise.all([ <ide> onceAnEvent(), <ide> onceAnEventWithTwoArgs(), <ide> catchesErrors(), <ide> stopListeningAfterCatchingError(), <del> onceError() <add> onceError(), <add> onceWithEventTarget(), <add> onceWithEventTargetTwoArgs(), <add> onceWithEventTargetError(), <ide> ]).then(common.mustCall());
3
Python
Python
add $params to the isnat docstring
3723a5c3fe75ae250d7f332b797c00619f8f3796
<ide><path>numpy/core/code_generators/ufunc_docstrings.py <ide> def add_newdoc(place, name, doc): <ide> ---------- <ide> x : array_like <ide> Input array with datetime or timedelta data type. <add> $PARAMS <ide> <ide> Returns <ide> -------
1
Javascript
Javascript
show readable identifier in errors
8a4bb64611e313fb526ecfca6e7df08c919c39a3
<ide><path>lib/Stats.js <ide> Stats.prototype.toJson = function toJson(options, forToString) { <ide> } <ide> function formatError(e) { <ide> var text = ""; <del> if(e.module) { <del> // text += e.module.readableIdentifier(requestShortener) + "\n"; <del> text += e.module.identifier() + "\n"; <add> if(e.module && e.module.readableIdentifier && typeof e.module.readableIdentifier === "function") { <add> text += e.module.readableIdentifier(requestShortener) + "\n"; <ide> } else if(e.file) { <ide> text += e.file + "\n"; <ide> }
1
Javascript
Javascript
restrict the tbody search to child nodes
efdb8a46e4213dcf69f792c42c234c6b112ba471
<ide><path>src/manipulation.js <ide> var <ide> rscriptTypeMasked = /^true\/(.*)/, <ide> rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g; <ide> <add>// Prefer a tbody over its parent table for containing new rows <ide> function manipulationTarget( elem, content ) { <ide> if ( jQuery.nodeName( elem, "table" ) && <ide> jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { <ide> <del> return elem.getElementsByTagName( "tbody" )[ 0 ] || elem; <add> return jQuery( ">tbody", elem )[ 0 ] || elem; <ide> } <ide> <ide> return elem; <ide><path>test/unit/manipulation.js <ide> QUnit.test( "Make sure col element is appended correctly", function( assert ) { <ide> assert.strictEqual( table.find( "td" ).width(), 150 ); <ide> } ); <ide> <add>QUnit.test( "Make sure tr is not appended to the wrong tbody (gh-3439)", function( assert ) { <add> assert.expect( 1 ); <add> <add> var htmlOut, <add> htmlIn = <add> "<thead><tr><td>" + <add> "<table><tbody><tr><td>nested</td></tr></tbody></table>" + <add> "</td></tr></thead>", <add> newRow = "<tr><td>added</td></tr>", <add> htmlExpected = htmlIn.replace( "</thead>", "</thead>" + newRow ), <add> table = supportjQuery( "<table/>" ).html( htmlIn ).appendTo( "#qunit-fixture" )[ 0 ]; <add> <add> jQuery( table ).append( newRow ); <add> <add> // Lowercase and replace spaces to remove possible browser inconsistencies <add> htmlOut = table.innerHTML.toLowerCase().replace( /\s/g, "" ); <add> <add> assert.strictEqual( htmlOut, htmlExpected ); <add>} ); <add> <ide> QUnit.test( "Insert script with data-URI (gh-1887)", 1, function( assert ) { <ide> Globals.register( "testFoo" ); <ide> Globals.register( "testSrcFoo" );
2
Python
Python
display a specific message during the first scan
7044f27935d0d3d44c7aaf1f9de9a9cd39529876
<ide><path>glances/__init__.py <ide> def main(): <ide> standalone.serve_forever() <ide> <ide> elif core.is_client(): <del> if core.is_client_autodiscover(): <add> if core.is_client_browser(): <ide> logger.info("Start client mode (browser)") <ide> <ide> # Import the Glances client browser module <ide><path>glances/core/glances_autodiscover.py <ide> """Manage autodiscover Glances server (thk to the ZeroConf protocol).""" <ide> <ide> # Import system libs <add>import sys <ide> import socket <ide> try: <ide> import netifaces <ide> class GlancesAutoDiscoverServer(object): <ide> def __init__(self, args=None): <ide> if zeroconf_tag: <ide> logger.info("Init autodiscover mode (Zeroconf protocol)") <del> self.zeroconf = Zeroconf() <add> try: <add> self.zeroconf = Zeroconf() <add> except socker.error as e: <add> logger.critical("Can not start Zeroconf (%s)" % e) <add> sys.exit(2) <ide> self.listener = GlancesAutoDiscoverListener() <ide> self.browser = ServiceBrowser( <ide> self.zeroconf, zeroconf_type, self.listener) <ide> else: <del> logger.error( <add> logger.critical( <ide> "Can not start autodiscover mode (Zeroconf lib is not installed)") <add> sys.exit(2) <ide> <ide> def get_servers_list(self): <ide> """Return the current server list (dict of dict)""" <ide><path>glances/core/glances_client_browser.py <ide> def __init__(self, config=None, args=None): <ide> self.config = config <ide> <ide> # Start the autodiscover mode (Zeroconf listener) <del> if self.args.autodiscover: <add> if not self.args.disable_autodiscover: <ide> self.autodiscover_server = GlancesAutoDiscoverServer() <add> else: <add> self.autodiscover_server = None <ide> <ide> # Init screen <ide> self.screen = GlancesCursesBrowser(args=self.args) <ide> <ide> def get_servers_list(self): <ide> """Return the current server list (list of dict)""" <del> if self.args.autodiscover: <del> return self.autodiscover_server.get_servers_list() <add> if self.args.browser: <add> if self.autodiscover_server is not None: <add> return self.autodiscover_server.get_servers_list() <add> else: <add> return {} <ide> else: <ide> return {} <ide> <ide><path>glances/core/glances_config.py <ide> class Config(object): <ide> <ide> def __init__(self, location=None): <ide> self.location = location <del> <add> <ide> self.config_filename = 'glances.conf' <ide> <ide> self.parser = RawConfigParser() <ide> def load(self): <ide> self.parser.read(config_file) <ide> logger.info(_("Read configuration file %s") % config_file) <ide> except UnicodeDecodeError as e: <del> logger.error(_("Cannot decode configuration file '{0}': {1}").format(config_file, e)) <add> logger.error( <add> _("Cannot decode configuration file '{0}': {1}").format(config_file, e)) <ide> sys.exit(1) <ide> # Save the loaded configuration file path (issue #374) <ide> self._loaded_config_file = config_file <ide> def get_config_paths(self): <ide> * {/usr/local,}/etc directory (system-wide settings) <ide> """ <ide> paths = [] <del> conf_path = os.path.realpath(os.path.join(work_path, '..', '..', 'conf')) <add> conf_path = os.path.realpath( <add> os.path.join(work_path, '..', '..', 'conf')) <ide> <ide> if self.location is not None: <ide> paths.append(self.location) <ide> def get_config_paths(self): <ide> <ide> if is_linux or is_bsd: <ide> paths.append(os.path.join( <del> os.environ.get('XDG_CONFIG_HOME') or os.path.expanduser('~/.config'), <add> os.environ.get('XDG_CONFIG_HOME') or os.path.expanduser( <add> '~/.config'), <ide> appname, self.config_filename)) <ide> if hasattr(sys, 'real_prefix') or is_bsd: <del> paths.append(os.path.join(sys.prefix, 'etc', appname, self.config_filename)) <add> paths.append( <add> os.path.join(sys.prefix, 'etc', appname, self.config_filename)) <ide> else: <del> paths.append(os.path.join('/etc', appname, self.config_filename)) <add> paths.append( <add> os.path.join('/etc', appname, self.config_filename)) <ide> elif is_mac: <ide> paths.append(os.path.join( <ide> os.path.expanduser('~/Library/Application Support/'), <ide><path>glances/core/glances_main.py <ide> def init_args(self): <ide> help=_('connect to a Glances server by IPv4/IPv6 address or hostname')) <ide> parser.add_argument('-s', '--server', action='store_true', default=False, <ide> dest='server', help=_('run Glances in server mode')) <del> parser.add_argument('--autodiscover', action='store_true', default=False, <del> dest='autodiscover', help=_('autodetect all Glances servers on your local area network')) <add> parser.add_argument('--browser', action='store_true', default=False, <add> dest='browser', help=_('start the client browser (list of servers)')) <ide> parser.add_argument('--disable-autodiscover', action='store_true', default=False, <del> dest='disable_autodiscover', help=_('disable server announcement on the local area network')) <add> dest='disable_autodiscover', help=_('disable autodiscover feature')) <ide> parser.add_argument('-p', '--port', default=None, type=int, dest='port', <ide> help=_('define the client/server TCP port [default: {0}]').format(self.server_port)) <ide> parser.add_argument('-B', '--bind', default='0.0.0.0', dest='bind_address', <ide> def parse_args(self): <ide> else: <ide> args.port = self.server_port <ide> <add> # Autodiscover <add> if args.disable_autodiscover: <add> logger.info("Auto discover mode is disabled") <add> <ide> # In web server mode, defaul refresh time: 5 sec <ide> if args.webserver: <ide> args.time = 5 <ide> def __get_password(self, description='', confirm=False, clear=False): <ide> <ide> def is_standalone(self): <ide> """Return True if Glances is running in standalone mode.""" <del> return not self.args.client and not self.args.autodiscover and not self.args.server and not self.args.webserver <add> return not self.args.client and not self.args.browser and not self.args.server and not self.args.webserver <ide> <ide> def is_client(self): <ide> """Return True if Glances is running in client mode.""" <del> return (self.args.client or self.args.autodiscover) and not self.args.server <add> return (self.args.client or self.args.browser) and not self.args.server <ide> <del> def is_client_autodiscover(self): <del> """Return True if Glances is running in client mode with autodiscover.""" <del> return self.args.autodiscover and not self.args.server <add> def is_client_browser(self): <add> """Return True if Glances is running in client browser mode.""" <add> return self.args.browser and not self.args.server <ide> <ide> def is_server(self): <ide> """Return True if Glances is running in server mode.""" <ide><path>glances/outputs/glances_curses.py <ide> def __init__(self, args=None): <ide> # Init the father class <ide> _GlancesCurses.__init__(self, args=args) <ide> <add> # First time scan tag <add> # Used to display a specific message when the browser is started <add> self.first_scan = True <add> <ide> # Init refresh time <ide> self.__refresh_time = args.time <ide> <ide> def display(self, servers_list): <ide> <ide> # Display top header <ide> if len(servers_list) == 0: <del> msg = _("No Glances server detected on your network") <add> if self.first_scan: <add> msg = _("Glances is scanning your network (please wait)...") <add> else: <add> msg = _("No Glances server detected on your network") <ide> elif len(servers_list) == 1: <ide> msg = _("One Glances server detected on your network") <ide> else: <ide> msg = _("%d Glances servers detected on your network" % <ide> len(servers_list)) <add> if self.args.disable_autodiscover: <add> msg += ' ' + _("(autodiscover is disabled)") <ide> self.term_window.addnstr(y, x, <ide> msg, <ide> screen_x - x,
6
Python
Python
remove potential undefinederror
cb26b035c696f32b7f47df18a6d84b88b7b1745d
<ide><path>transformers/modeling_xlm.py <ide> def get_masks(slen, lengths, causal, padding_mask=None): <ide> mask = alen < lengths[:, None] <ide> <ide> # attention mask is the same as mask, or triangular inferior attention (causal) <add> bs = lengths.size(0) <ide> if causal: <del> bs = lengths.size(0) <ide> attn_mask = alen[None, None, :].repeat(bs, slen, 1) <= alen[None, :, None] <ide> else: <ide> attn_mask = mask
1
PHP
PHP
fix missing space after foreach
a0142e9745f68e3853a26675a5580cb6e63152ac
<ide><path>src/Illuminate/Support/MessageBag.php <ide> public function has($key = null) <ide> */ <ide> public function hasAll($keys = [], $true = true, $false = false) <ide> { <del> foreach($keys as $key) { <add> foreach ($keys as $key) { <ide> if ($this->first($key) === '') { <ide> return $false; <ide> } <ide> public function hasAll($keys = [], $true = true, $false = false) <ide> */ <ide> public function hasAny($keys = [], $true = true, $false = false) <ide> { <del> foreach($keys as $key) { <add> foreach ($keys as $key) { <ide> if ($this->first($key) !== '') { <ide> return $true; <ide> }
1
PHP
PHP
fix a bug with how commands are queued
3f5863966d90b5f76b3adb3582bc0b33569a3ccc
<ide><path>src/Illuminate/Foundation/Console/Kernel.php <ide> public function bootstrap() <ide> $this->app->bootstrapWith($this->bootstrappers()); <ide> } <ide> <del> // If we are just calling another queue command, we will only load the queue <del> // service provider. This saves a lot of file loading as we don't need to <del> // load the providers with commands for every possible console command. <del> $this->isCallingAQueueCommand() <del> ? $this->app->loadDeferredProvider('queue') <del> : $this->app->loadDeferredProviders(); <del> } <del> <del> /** <del> * Determine if the console is calling a queue command. <del> * <del> * @return bool <del> */ <del> protected function isCallingAQueueCommand() <del> { <del> return in_array((new ArgvInput)->getFirstArgument(), [ <del> 'queue:listen', 'queue:work' <del> ]); <add> $this->app->loadDeferredProviders(); <ide> } <ide> <ide> /**
1
Javascript
Javascript
remove unused method from chunkgroup
63c9a87af00ff80701b09f4a9e9a5bf522a78168
<ide><path>lib/ChunkGroup.js <ide> class ChunkGroup { <ide> return this._parents.getFromCache(getArray); <ide> } <ide> <del> /** <del> * @param {Iterable<ChunkGroup>} newParents the parent groups to be added into <del> * @returns {void} <del> */ <del> setParents(newParents) { <del> this._parents.clear(); <del> for (const p of newParents) { <del> this._parents.add(p); <del> } <del> } <del> <ide> getNumberOfParents() { <ide> return this._parents.size; <ide> }
1
Javascript
Javascript
use es6 spec for vector iterator. #68
66d66090ab3ba0159fc16fe69ca0a0433920d574
<ide><path>dist/Immutable.dev.js <ide> var $Vector = Vector; <ide> __deepEquals: function(other) { <ide> var iterator = this.__iterator__(); <ide> return other.every((function(v, k) { <del> var entry = iterator.next(); <del> return k === entry[0] && is(v, entry[1]); <add> var entry = iterator.next().value; <add> return entry && k === entry[0] && is(v, entry[1]); <ide> })); <ide> }, <ide> __iterator__: function() { <ide> function _nodeFor(vector, rawIndex) { <ide> return node; <ide> } <ide> } <add>Vector.prototype['@@iterator'] = Vector.prototype.__iterator__; <ide> Vector.prototype.update = Map.prototype.update; <ide> Vector.prototype.updateIn = Map.prototype.updateIn; <ide> Vector.prototype.cursor = Map.prototype.cursor; <ide> var VectorIterator = function VectorIterator(vector, origin, size, level, root, <ide> if (index >= 0 && index < stack.max && stack.node.hasOwnProperty(stack.rawIndex)) { <ide> var value = stack.node[stack.rawIndex]; <ide> stack.rawIndex++; <del> return [index, value]; <add> return { <add> value: [index, value], <add> done: true <add> }; <ide> } else { <ide> stack.rawIndex++; <ide> } <ide> var VectorIterator = function VectorIterator(vector, origin, size, level, root, <ide> } <ide> stack = this._stack = this._stack.__prev; <ide> } <del> if (global.StopIteration) { <del> throw global.StopIteration; <del> } <add> return {done: true}; <ide> }}, {}); <ide> function vectorWithLengthOfLongestSeq(vector, seqs) { <ide> var maxLength = Math.max.apply(null, seqs.map((function(seq) { <ide><path>dist/Immutable.js <ide> var c=this.__reversedIndices^l;if(s!==s||h!==h||c&&null==n.length){var f=n.count <ide> return D(this,t,e)},mergeDeep:function(){return D(this,O(null),arguments)},mergeDeepWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return D(this,O(t),e)},updateIn:function(t,e){return t&&0!==t.length?b(this,t,e,0):e(this)},cursor:function(t,e){return e||"function"!=typeof t||(e=t,t=null),t&&!Array.isArray(t)&&(t=[t]),new F(this,t,e)},withMutations:function(t){var e=this.asMutable();return t(e),e.__ensureOwner(this.__ownerID)},asMutable:function(){return this.__ownerID?this:this.__ensureOwner(new X)},asImmutable:function(){return this.__ensureOwner()},__ensureOwner:function(t){return t===this.__ownerID?this:t?T._make(this.length,this._root,t):(this.__ownerID=t,this)},__deepEqual:function(t){var e=this;return t.every(function(t,r){return w(e.get(r,N),t)})},__iterate:function(t,e){return this._root?this._root.iterate(this,t,e):0}},{empty:function(){return ee||(ee=T._make(0))},_make:function(t,e,r){var n=Object.create(T.prototype);return n.length=t,n._root=e,n.__ownerID=r,n}},R),Q.from=Q;var X=function(){};B.createClass(X,{},{});var Y=function(t,e,r,n){this.ownerID=t,this.bitmap=e,this.keys=r,this.values=n},Z=Y;B.createClass(Y,{get:function(t,e,r,n){var i=e>>>t&he;if(0===(this.bitmap&1<<i))return n;var s=this.keys[i],u=this.values[i];return null==s?u.get(t+oe,e,r,n):r===s?u:n},set:function(t,e,r,n,i,s){var u,o=r>>>e&he,a=1<<o;if(0===(this.bitmap&a))return s&&(s.value=!0),u=this.ensureOwner(t),u.keys[o]=n,u.values[o]=i,u.bitmap|=a,u;var h,l=this.keys[o],c=this.values[o];if(null==l)return h=c.set(t,e+oe,r,n,i,s),h===c?this:(u=this.ensureOwner(t),u.values[o]=h,u);if(n===l)return i===c?this:(u=this.ensureOwner(t),u.values[o]=i,u);var f=S(l);return h=r===f?new $(t,r,[l,n],[c,i]):k(t,e+oe,f,l,c).set(t,e+oe,r,n,i),s&&(s.value=!0),u=this.ensureOwner(t),delete u.keys[o],u.values[o]=h,u},"delete":function(t,e,r,n,i){var s,u=r>>>e&he,o=1<<u,a=this.keys[u];if(0===(this.bitmap&o)||null!=a&&n!==a)return this;if(null==a){var h=this.values[u],l=h.delete(t,e+oe,r,n,i);if(l===h)return this;if(l)return s=this.ensureOwner(t),s.values[u]=l,s <ide> }else i&&(i.value=!0);return this.bitmap===o?null:(s=this.ensureOwner(t),delete s.keys[u],delete s.values[u],s.bitmap^=o,s)},ensureOwner:function(t){return t&&t===this.ownerID?this:new Z(t,this.bitmap,this.keys.slice(),this.values.slice())},iterate:function(t,e,r){for(var n=this.values,i=this.keys,s=n.length,u=0;s>=u;u++){var o=r?s-u:u,a=i[o],h=n[o];if(null!=a){if(e(h,a,t)===!1)return!1}else if(h&&!h.iterate(t,e,r))return!1}return!0}},{});var $=function(t,e,r,n){this.ownerID=t,this.collisionHash=e,this.keys=r,this.values=n},te=$;B.createClass($,{get:function(t,e,r,n){var i=R(this.keys).indexOf(r);return-1===i?n:this.values[i]},set:function(t,e,r,n,i,s){if(r!==this.collisionHash)return s&&(s.value=!0),k(t,e,this.collisionHash,null,this).set(t,e,r,n,i);var u=R(this.keys).indexOf(n);if(u>=0&&this.values[u]===i)return this;var o=this.ensureOwner(t);return-1===u?(o.keys.push(n),o.values.push(i),s&&(s.value=!0)):o.values[u]=i,o},"delete":function(t,e,r,n,i){var s=this.keys.indexOf(n);if(-1===s)return this;if(i&&(i.value=!0),this.values.length>1){var u=this.ensureOwner(t);return u.keys[s]=u.keys.pop(),u.values[s]=u.values.pop(),u}},ensureOwner:function(t){return t&&t===this.ownerID?this:new te(t,this.collisionHash,this.keys.slice(),this.values.slice())},iterate:function(t,e,r){for(var n=this.values,i=this.keys,s=n.length-1,u=0;s>=u;u++){var o=r?s-u:u;if(e(n[o],i[o],t)===!1)return!1}return!0}},{});var ee,re={value:!1},ne=4294967296,ie=255,se=0,ue={},oe=5,ae=1<<oe,he=ae-1,N={},le=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return ce.from(t)},ce=le;B.createClass(le,{toString:function(){return this.__toString("Vector [","]")},get:function(t,e){if(t=q(t,this._origin),t>=this._size)return e;var r=E(this,t),n=t&he;return r&&(void 0===e||r.array.hasOwnProperty(n))?r.array[n]:e},first:function(){return this.get(0)},last:function(){return this.get(this.length?this.length-1:0)},set:function(t,e){var r=j(this._size);if(t>=this.length)return this.withMutations(function(r){return r._setBounds(0,t+1).set(t,e)}); <ide> if(this.get(t,N)===e)return this;if(t=q(t,this._origin),t>=r){var n=this._tail.ensureOwner(this.__ownerID);n.array[t&he]=e;var i=t>=this._size?t+1:this._size;return this.__ownerID?(this.length=i-this._origin,this._size=i,this._tail=n,this):ce._make(this._origin,i,this._level,this._root,n)}for(var s=this._root.ensureOwner(this.__ownerID),u=s,o=this._level;o>0;o-=oe){var a=t>>>o&he;u=u.array[a]=u.array[a]?u.array[a].ensureOwner(this.__ownerID):new fe([],this.__ownerID)}return u.array[t&he]=e,this.__ownerID?(this._root=s,this):ce._make(this._origin,this._size,this._level,s,this._tail)},"delete":function(t){if(!this.has(t))return this;var e=j(this._size);if(t=q(t,this._origin),t>=e){var r=this._tail.ensureOwner(this.__ownerID);return delete r.array[t&he],this.__ownerID?(this._tail=r,this):ce._make(this._origin,this._size,this._level,this._root,r)}for(var n=this._root.ensureOwner(this.__ownerID),i=n,s=this._level;s>0;s-=oe){var u=t>>>s&he;i=i.array[u]=i.array[u].ensureOwner(this.__ownerID)}return delete i.array[t&he],this.__ownerID?(this._root=n,this):ce._make(this._origin,this._size,this._level,n,this._tail)},clear:function(){return this.__ownerID?(this.length=this._origin=this._size=0,this._level=oe,this._root=this._tail=ge,this):ce.empty()},push:function(){var t=arguments,e=this.length;return this.withMutations(function(r){r._setBounds(0,e+t.length);for(var n=0;t.length>n;n++)r.set(e+n,t[n])})},pop:function(){return this._setBounds(0,-1)},unshift:function(){var t=arguments;return this.withMutations(function(e){e._setBounds(-t.length);for(var r=0;t.length>r;r++)e.set(r,t[r])})},shift:function(){return this._setBounds(1)},merge:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return Q.prototype.merge.apply(C(this,t),arguments)},mergeWith:function(){for(var t=[],e=1;arguments.length>e;e++)t[e-1]=arguments[e];return Q.prototype.mergeWith.apply(C(this,t),arguments)},mergeDeep:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return Q.prototype.mergeDeep.apply(C(this,t),arguments)},mergeDeepWith:function(){for(var t=[],e=1;arguments.length>e;e++)t[e-1]=arguments[e]; <del>return Q.prototype.mergeDeepWith.apply(C(this,t),arguments)},setLength:function(t){return this._setBounds(0,t)},_setBounds:function(t,e){var r=this.__ownerID||new X,n=this._origin,i=this._size,s=n+t,u=null==e?i:0>e?i+e:n+e;if(s===n&&u===i)return this;if(s>=u)return this.clear();for(var o=this._level,a=this._root,h=0;0>s+h;)a=new fe(a.array.length?[,a]:[],r),o+=oe,h+=1<<o;h&&(s+=h,n+=h,u+=h,i+=h);for(var l=j(i),c=j(u);c>=1<<o+oe;)a=new fe(a.array.length?[a]:[],r),o+=oe;var f=this._tail,_=l>c?E(this,u-1):c>l?new fe([],r):f;if(c>l&&i>s&&f.array.length){a=a.ensureOwner(r);for(var p=a,v=o;v>oe;v-=oe){var g=l>>>v&he;p=p.array[g]=p.array[g]?p.array[g].ensureOwner(r):new fe([],r)}p.array[l>>>oe&he]=f}if(i>u&&(_=_.removeAfter(r,0,u)),s>=c)s-=c,u-=c,o=oe,a=ge,_=_.removeBefore(r,0,s);else if(s>n||l>c){var y,m;h=0;do y=s>>>o&he,m=c-1>>>o&he,y===m&&(y&&(h+=(1<<o)*y),o-=oe,a=a&&a.array[y]);while(a&&y===m);a&&s>n&&(a=a.removeBefore(r,o,s-h)),a&&l>c&&(a=a.removeAfter(r,o,c-h)),h&&(s-=h,u-=h),a=a||ge}return this.__ownerID?(this.length=u-s,this._origin=s,this._size=u,this._level=o,this._root=a,this._tail=_,this):ce._make(s,u,o,a,_)},__ensureOwner:function(t){return t===this.__ownerID?this:t?ce._make(this._origin,this._size,this._level,this._root,this._tail,t):(this.__ownerID=t,this)},slice:function(t,e,r){var n=B.superCall(this,ce.prototype,"slice",[t,e,r]);if(!r&&n!==this){var i=this,s=i.length;n.toVector=function(){return i._setBounds(0>t?Math.max(0,s+t):s?Math.min(s,t):t,null==e?s:0>e?Math.max(0,s+e):s?Math.min(s,e):e)}}return n},__deepEquals:function(t){var e=this.__iterator__();return t.every(function(t,r){var n=e.next();return r===n[0]&&w(t,n[1])})},__iterator__:function(){return new pe(this,this._origin,this._size,this._level,this._root,this._tail)},__iterate:function(t,e,r){var n=this,i=0,s=n.length-1;r^=e;var u,o=function(e,u){return t(e,r?s-u:u,n)===!1?!1:(i=u,!0)},a=j(this._size);return u=e?this._tail.iterate(0,a-this._origin,this._size-this._origin,o,e)&&this._root.iterate(this._level,-this._origin,a-this._origin,o,e):this._root.iterate(this._level,-this._origin,a-this._origin,o,e)&&this._tail.iterate(0,a-this._origin,this._size-this._origin,o,e),(u?s:e?s-i:i)+1 <del>}},{empty:function(){return ve||(ve=ce._make(0,0,oe,ge,ge))},from:function(t){if(t&&t.constructor===ce)return t;if(!t||0===t.length)return ce.empty();var e=Array.isArray(t);return t.length>0&&ae>t.length?ce._make(0,t.length,oe,ge,new fe(e?t.slice():R(t).toArray())):(e||(t=R(t),t instanceof L||(t=t.values())),ce.empty().merge(t))},_make:function(t,e,r,n,i,s){var u=Object.create(ce.prototype);return u.length=e-t,u._origin=t,u._size=e,u._level=r,u._root=n,u._tail=i,u.__ownerID=s,u}},L),le.prototype.update=Q.prototype.update,le.prototype.updateIn=Q.prototype.updateIn,le.prototype.cursor=Q.prototype.cursor,le.prototype.withMutations=Q.prototype.withMutations,le.prototype.asMutable=Q.prototype.asMutable,le.prototype.asImmutable=Q.prototype.asImmutable;var X=function(){};B.createClass(X,{},{});var fe=function(t,e){this.array=t,this.ownerID=e},_e=fe;B.createClass(fe,{ensureOwner:function(t){return t&&t===this.ownerID?this:new _e(this.array.slice(),t)},removeBefore:function(t,e,r){if(r===e?1<<e:0||0===this.array.length)return this;var n=r>>>e&he;if(n>=this.array.length)return new _e([],t);var i,s=0===n;if(e>0){var u=this.array[n];if(i=u&&u.removeBefore(t,e-oe,r),i===u&&s)return this}if(s&&!i)return this;var o=this.ensureOwner();if(!s)for(var a=0;n>a;a++)delete o.array[a];return i&&(o.array[n]=i),o},removeAfter:function(t,e,r){if(r===e?1<<e:0||0===this.array.length)return this;var n=r-1>>>e&he;if(n>=this.array.length)return this;var i,s=n===this.array.length-1;if(e>0){var u=this.array[n];if(i=u&&u.removeAfter(t,e-oe,r),i===u&&s)return this}if(s&&!i)return this;var o=this.ensureOwner();return s||(o.array.length=n+1),i&&(o.array[n]=i),o},iterate:function(t,e,r,n,i){if(0===t){if(i){for(var s=this.array.length-1;s>=0;s--)if(this.array.hasOwnProperty(s)){var u=s+e;if(u>=0&&r>u&&n(this.array[s],u)===!1)return!1}return!0}return this.array.every(function(t,i){var s=i+e;return 0>s||s>=r||n(t,s)!==!1})}var o=1<<t,a=t-oe;if(i){for(var h=this.array.length-1;h>=0;h--){var l=e+h*o;if(r>l&&l+o>0&&this.array.hasOwnProperty(h)&&!this.array[h].iterate(a,l,r,n,i))return!1 <del>}return!0}return this.array.every(function(t,s){var u=e+s*o;return u>=r||0>=u+o||t.iterate(a,u,r,n,i)})}},{});var pe=function(t,e,r,n,i,s){var u=j(r);this._stack={node:i.array,level:n,offset:-e,max:u-e,__prev:{node:s.array,level:0,offset:u-e,max:r-e}}};B.createClass(pe,{next:function(){var t=this._stack;t:for(;t;){if(0===t.level)for(t.rawIndex||(t.rawIndex=0);t.node.length>t.rawIndex;){var e=t.rawIndex+t.offset;if(e>=0&&t.max>e&&t.node.hasOwnProperty(t.rawIndex)){var r=t.node[t.rawIndex];return t.rawIndex++,[e,r]}t.rawIndex++}else{var n=1<<t.level;for(t.levelIndex||(t.levelIndex=0);t.node.length>t.levelIndex;){var i=t.offset+t.levelIndex*n;if(i+n>0&&t.max>i&&t.node.hasOwnProperty(t.levelIndex)){var s=t.node[t.levelIndex].array;t.levelIndex++,t=this._stack={node:s,level:t.level-oe,offset:i,max:t.max,__prev:t};continue t}t.levelIndex++}}t=this._stack=this._stack.__prev}if(global.StopIteration)throw global.StopIteration}},{});var ve,oe=5,ae=1<<oe,he=ae-1,N={},ge=new fe([]),ye=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return me.from(t)},me=ye;B.createClass(ye,{toString:function(){return this.__toString("Set {","}")},has:function(t){return this._map?this._map.has(t):!1},get:function(t,e){return this.has(t)?t:e},add:function(t){if(null==t)return this;var e=this._map;return e||(e=Q.empty().__ensureOwner(this.__ownerID)),e=e.set(t,null),this.__ownerID?(this.length=e.length,this._map=e,this):e===this._map?this:me._make(e)},"delete":function(t){if(null==t||null==this._map)return this;var e=this._map.delete(t);return 0===e.length?this.clear():this.__ownerID?(this.length=e.length,this._map=e,this):e===this._map?this:me._make(e)},clear:function(){return this.__ownerID?(this.length=0,this._map=null,this):me.empty()},union:function(){var t=arguments;return 0===t.length?this:this.withMutations(function(e){for(var r=0;t.length>r;r++){var n=t[r];n=n.forEach?n:R(n),n.forEach(function(t){return e.add(t)})}})},intersect:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];if(0===t.length)return this; <del>t=t.map(function(t){return R(t)});var r=this;return this.withMutations(function(e){r.forEach(function(r){t.every(function(t){return t.contains(r)})||e.delete(r)})})},subtract:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];if(0===t.length)return this;t=t.map(function(t){return R(t)});var r=this;return this.withMutations(function(e){r.forEach(function(r){t.some(function(t){return t.contains(r)})&&e.delete(r)})})},isSubset:function(t){return t=R(t),this.every(function(e){return t.contains(e)})},isSuperset:function(t){var e=this;return t=R(t),t.every(function(t){return e.contains(t)})},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t);return t?me._make(e,t):(this.__ownerID=t,this._map=e,this)},__deepEquals:function(t){return!(this._map||t._map)||this._map.equals(t._map)},__iterate:function(t,e){var r=this;return this._map?this._map.__iterate(function(e,n){return t(n,n,r)},e):0}},{empty:function(){return de||(de=me._make())},from:function(t){return t&&t.constructor===me?t:t&&0!==t.length?me.empty().union(t):me.empty()},fromKeys:function(t){return me.from(R(t).flip())},_make:function(t,e){var r=Object.create(me.prototype);return r.length=t?t.length:0,r._map=t,r.__ownerID=e,r}},R),ye.prototype.contains=ye.prototype.has,ye.prototype.withMutations=Q.prototype.withMutations,ye.prototype.asMutable=Q.prototype.asMutable,ye.prototype.asImmutable=Q.prototype.asImmutable,ye.prototype.__toJS=L.prototype.__toJS,ye.prototype.__toStringMapper=L.prototype.__toStringMapper;var de,we=function(t){return t&&t.constructor===Ie?t:t&&0!==t.length?Ie.empty().merge(t):Ie.empty()},Ie=we;B.createClass(we,{toString:function(){return this.__toString("OrderedMap {","}")},get:function(t,e){if(null!=t&&this._map){var r=this._map.get(t);if(null!=r)return this._vector.get(r)[1]}return e},clear:function(){return this.__ownerID?(this.length=0,this._map=this._vector=null,this):Ie.empty()},set:function(t,e){if(null==t)return this;var r=this._map,n=this._vector;if(r){var i=r.get(t); <del>null==i?(r=r.set(t,n.length),n=n.push([t,e])):n.get(i)[1]!==e&&(n=n.set(i,[t,e]))}else n=le.empty().__ensureOwner(this.__ownerID).set(0,[t,e]),r=Q.empty().__ensureOwner(this.__ownerID).set(t,0);return this.__ownerID?(this.length=r.length,this._map=r,this._vector=n,this):n===this._vector?this:Ie._make(r,n)},"delete":function(t){if(null==t||null==this._map)return this;var e=this._map.get(t);if(null==e)return this;var r=this._map.delete(t),n=this._vector.delete(e);return 0===r.length?this.clear():this.__ownerID?(this.length=r.length,this._map=r,this._vector=n,this):r===this._map?this:Ie._make(r,n)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t),r=this._vector&&this._vector.__ensureOwner(t);return t?Ie._make(e,r,t):(this.__ownerID=t,this._map=e,this._vector=r,this)},__deepEqual:function(t){var e=this._vector.__iterator__();return t.every(function(t,r){var n=e.next();return n&&(n=n[1]),n&&w(r,n[0])&&w(t,n[1])})},__iterate:function(t,e){return this._vector?this._vector.fromEntries().__iterate(t,e):0}},{empty:function(){return ke||(ke=Ie._make())},_make:function(t,e,r){var n=Object.create(Ie.prototype);return n.length=t?t.length:0,n._map=t,n._vector=e,n.__ownerID=r,n}},Q),we.from=we;var ke,Oe=function(t,e){var r=function(t){this._map=Q(t)};t=R(t),r.prototype=Object.create(De.prototype),r.prototype.constructor=r,r.prototype._name=e,r.prototype._defaultValues=t;var n=Object.keys(t);return r.prototype.length=n.length,Object.defineProperty&&t.forEach(function(t,e){Object.defineProperty(r.prototype,e,{get:function(){return this.get(e)},set:function(t){if(!this.__ownerID)throw Error("Cannot set on an immutable record.");this.set(e,t)}})}),r},De=Oe;B.createClass(Oe,{toString:function(){return this.__toString((this._name||"Record")+" {","}")},has:function(t){return this._defaultValues.has(t)},get:function(t,e){return void 0===e||this.has(t)?this._map.get(t,this._defaultValues.get(t)):e},clear:function(){return this.__ownerID?(this._map.clear(),this):this._empty()},set:function(t,e){if(null==t||!this.has(t))return this; <del>var r=this._map.set(t,e);return this.__ownerID||r===this._map?this:this._make(r)},"delete":function(t){if(null==t||!this.has(t))return this;var e=this._map.delete(t);return this.__ownerID||e===this._map?this:this._make(e)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t);return t?this._make(e,t):(this.__ownerID=t,this._map=e,this)},__iterate:function(t,e){var r=this;return this._defaultValues.map(function(t,e){return r.get(e)}).__iterate(t,e)},_empty:function(){Object.getPrototypeOf(this).constructor;return De._empty||(De._empty=this._make(Q.empty()))},_make:function(t,e){var r=Object.create(Object.getPrototypeOf(this));return r._map=t,r.__ownerID=e,r}},{},R),Oe.prototype.__deepEqual=Q.prototype.__deepEqual,Oe.prototype.merge=Q.prototype.merge,Oe.prototype.mergeWith=Q.prototype.mergeWith,Oe.prototype.mergeDeep=Q.prototype.mergeDeep,Oe.prototype.mergeDeepWith=Q.prototype.mergeDeepWith,Oe.prototype.update=Q.prototype.update,Oe.prototype.updateIn=Q.prototype.updateIn,Oe.prototype.cursor=Q.prototype.cursor,Oe.prototype.withMutations=Q.prototype.withMutations,Oe.prototype.asMutable=Q.prototype.asMutable,Oe.prototype.asImmutable=Q.prototype.asImmutable;var be=function(t,e,r){return this instanceof Me?(A(0!==r,"Cannot step a Range by 0"),t=t||0,null==e&&(e=1/0),t===e&&Se?Se:(r=null==r?1:Math.abs(r),t>e&&(r=-r),this._start=t,this._end=e,this._step=r,void(this.length=Math.max(0,Math.ceil((e-t)/r-1)+1)))):new Me(t,e,r)},Me=be;B.createClass(be,{toString:function(){return 0===this.length?"Range []":"Range [ "+this._start+"..."+this._end+(this._step>1?" by "+this._step:"")+" ]"},has:function(t){return A(t>=0,"Index out of bounds"),this.length>t},get:function(t,e){return A(t>=0,"Index out of bounds"),1/0===this.length||this.length>t?this._start+t*this._step:e},contains:function(t){var e=(t-this._start)/this._step;return e>=0&&this.length>e&&e===Math.floor(e)},slice:function(t,e,r){return u(t,e,this.length)?this:r?B.superCall(this,Me.prototype,"slice",[t,e,r]):(t=o(t,this.length),e=a(e,this.length),t>=e?Se:new Me(this.get(t,this._end),this.get(e,this._end),this._step)) <add>return Q.prototype.mergeDeepWith.apply(C(this,t),arguments)},setLength:function(t){return this._setBounds(0,t)},_setBounds:function(t,e){var r=this.__ownerID||new X,n=this._origin,i=this._size,s=n+t,u=null==e?i:0>e?i+e:n+e;if(s===n&&u===i)return this;if(s>=u)return this.clear();for(var o=this._level,a=this._root,h=0;0>s+h;)a=new fe(a.array.length?[,a]:[],r),o+=oe,h+=1<<o;h&&(s+=h,n+=h,u+=h,i+=h);for(var l=j(i),c=j(u);c>=1<<o+oe;)a=new fe(a.array.length?[a]:[],r),o+=oe;var f=this._tail,_=l>c?E(this,u-1):c>l?new fe([],r):f;if(c>l&&i>s&&f.array.length){a=a.ensureOwner(r);for(var p=a,v=o;v>oe;v-=oe){var g=l>>>v&he;p=p.array[g]=p.array[g]?p.array[g].ensureOwner(r):new fe([],r)}p.array[l>>>oe&he]=f}if(i>u&&(_=_.removeAfter(r,0,u)),s>=c)s-=c,u-=c,o=oe,a=ge,_=_.removeBefore(r,0,s);else if(s>n||l>c){var y,m;h=0;do y=s>>>o&he,m=c-1>>>o&he,y===m&&(y&&(h+=(1<<o)*y),o-=oe,a=a&&a.array[y]);while(a&&y===m);a&&s>n&&(a=a.removeBefore(r,o,s-h)),a&&l>c&&(a=a.removeAfter(r,o,c-h)),h&&(s-=h,u-=h),a=a||ge}return this.__ownerID?(this.length=u-s,this._origin=s,this._size=u,this._level=o,this._root=a,this._tail=_,this):ce._make(s,u,o,a,_)},__ensureOwner:function(t){return t===this.__ownerID?this:t?ce._make(this._origin,this._size,this._level,this._root,this._tail,t):(this.__ownerID=t,this)},slice:function(t,e,r){var n=B.superCall(this,ce.prototype,"slice",[t,e,r]);if(!r&&n!==this){var i=this,s=i.length;n.toVector=function(){return i._setBounds(0>t?Math.max(0,s+t):s?Math.min(s,t):t,null==e?s:0>e?Math.max(0,s+e):s?Math.min(s,e):e)}}return n},__deepEquals:function(t){var e=this.__iterator__();return t.every(function(t,r){var n=e.next().value;return n&&r===n[0]&&w(t,n[1])})},__iterator__:function(){return new pe(this,this._origin,this._size,this._level,this._root,this._tail)},__iterate:function(t,e,r){var n=this,i=0,s=n.length-1;r^=e;var u,o=function(e,u){return t(e,r?s-u:u,n)===!1?!1:(i=u,!0)},a=j(this._size);return u=e?this._tail.iterate(0,a-this._origin,this._size-this._origin,o,e)&&this._root.iterate(this._level,-this._origin,a-this._origin,o,e):this._root.iterate(this._level,-this._origin,a-this._origin,o,e)&&this._tail.iterate(0,a-this._origin,this._size-this._origin,o,e),(u?s:e?s-i:i)+1 <add>}},{empty:function(){return ve||(ve=ce._make(0,0,oe,ge,ge))},from:function(t){if(t&&t.constructor===ce)return t;if(!t||0===t.length)return ce.empty();var e=Array.isArray(t);return t.length>0&&ae>t.length?ce._make(0,t.length,oe,ge,new fe(e?t.slice():R(t).toArray())):(e||(t=R(t),t instanceof L||(t=t.values())),ce.empty().merge(t))},_make:function(t,e,r,n,i,s){var u=Object.create(ce.prototype);return u.length=e-t,u._origin=t,u._size=e,u._level=r,u._root=n,u._tail=i,u.__ownerID=s,u}},L),le.prototype["@@iterator"]=le.prototype.__iterator__,le.prototype.update=Q.prototype.update,le.prototype.updateIn=Q.prototype.updateIn,le.prototype.cursor=Q.prototype.cursor,le.prototype.withMutations=Q.prototype.withMutations,le.prototype.asMutable=Q.prototype.asMutable,le.prototype.asImmutable=Q.prototype.asImmutable;var X=function(){};B.createClass(X,{},{});var fe=function(t,e){this.array=t,this.ownerID=e},_e=fe;B.createClass(fe,{ensureOwner:function(t){return t&&t===this.ownerID?this:new _e(this.array.slice(),t)},removeBefore:function(t,e,r){if(r===e?1<<e:0||0===this.array.length)return this;var n=r>>>e&he;if(n>=this.array.length)return new _e([],t);var i,s=0===n;if(e>0){var u=this.array[n];if(i=u&&u.removeBefore(t,e-oe,r),i===u&&s)return this}if(s&&!i)return this;var o=this.ensureOwner();if(!s)for(var a=0;n>a;a++)delete o.array[a];return i&&(o.array[n]=i),o},removeAfter:function(t,e,r){if(r===e?1<<e:0||0===this.array.length)return this;var n=r-1>>>e&he;if(n>=this.array.length)return this;var i,s=n===this.array.length-1;if(e>0){var u=this.array[n];if(i=u&&u.removeAfter(t,e-oe,r),i===u&&s)return this}if(s&&!i)return this;var o=this.ensureOwner();return s||(o.array.length=n+1),i&&(o.array[n]=i),o},iterate:function(t,e,r,n,i){if(0===t){if(i){for(var s=this.array.length-1;s>=0;s--)if(this.array.hasOwnProperty(s)){var u=s+e;if(u>=0&&r>u&&n(this.array[s],u)===!1)return!1}return!0}return this.array.every(function(t,i){var s=i+e;return 0>s||s>=r||n(t,s)!==!1})}var o=1<<t,a=t-oe;if(i){for(var h=this.array.length-1;h>=0;h--){var l=e+h*o;if(r>l&&l+o>0&&this.array.hasOwnProperty(h)&&!this.array[h].iterate(a,l,r,n,i))return!1 <add>}return!0}return this.array.every(function(t,s){var u=e+s*o;return u>=r||0>=u+o||t.iterate(a,u,r,n,i)})}},{});var pe=function(t,e,r,n,i,s){var u=j(r);this._stack={node:i.array,level:n,offset:-e,max:u-e,__prev:{node:s.array,level:0,offset:u-e,max:r-e}}};B.createClass(pe,{next:function(){var t=this._stack;t:for(;t;){if(0===t.level)for(t.rawIndex||(t.rawIndex=0);t.node.length>t.rawIndex;){var e=t.rawIndex+t.offset;if(e>=0&&t.max>e&&t.node.hasOwnProperty(t.rawIndex)){var r=t.node[t.rawIndex];return t.rawIndex++,{value:[e,r],done:!0}}t.rawIndex++}else{var n=1<<t.level;for(t.levelIndex||(t.levelIndex=0);t.node.length>t.levelIndex;){var i=t.offset+t.levelIndex*n;if(i+n>0&&t.max>i&&t.node.hasOwnProperty(t.levelIndex)){var s=t.node[t.levelIndex].array;t.levelIndex++,t=this._stack={node:s,level:t.level-oe,offset:i,max:t.max,__prev:t};continue t}t.levelIndex++}}t=this._stack=this._stack.__prev}return{done:!0}}},{});var ve,oe=5,ae=1<<oe,he=ae-1,N={},ge=new fe([]),ye=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return me.from(t)},me=ye;B.createClass(ye,{toString:function(){return this.__toString("Set {","}")},has:function(t){return this._map?this._map.has(t):!1},get:function(t,e){return this.has(t)?t:e},add:function(t){if(null==t)return this;var e=this._map;return e||(e=Q.empty().__ensureOwner(this.__ownerID)),e=e.set(t,null),this.__ownerID?(this.length=e.length,this._map=e,this):e===this._map?this:me._make(e)},"delete":function(t){if(null==t||null==this._map)return this;var e=this._map.delete(t);return 0===e.length?this.clear():this.__ownerID?(this.length=e.length,this._map=e,this):e===this._map?this:me._make(e)},clear:function(){return this.__ownerID?(this.length=0,this._map=null,this):me.empty()},union:function(){var t=arguments;return 0===t.length?this:this.withMutations(function(e){for(var r=0;t.length>r;r++){var n=t[r];n=n.forEach?n:R(n),n.forEach(function(t){return e.add(t)})}})},intersect:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];if(0===t.length)return this;t=t.map(function(t){return R(t) <add>});var r=this;return this.withMutations(function(e){r.forEach(function(r){t.every(function(t){return t.contains(r)})||e.delete(r)})})},subtract:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];if(0===t.length)return this;t=t.map(function(t){return R(t)});var r=this;return this.withMutations(function(e){r.forEach(function(r){t.some(function(t){return t.contains(r)})&&e.delete(r)})})},isSubset:function(t){return t=R(t),this.every(function(e){return t.contains(e)})},isSuperset:function(t){var e=this;return t=R(t),t.every(function(t){return e.contains(t)})},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t);return t?me._make(e,t):(this.__ownerID=t,this._map=e,this)},__deepEquals:function(t){return!(this._map||t._map)||this._map.equals(t._map)},__iterate:function(t,e){var r=this;return this._map?this._map.__iterate(function(e,n){return t(n,n,r)},e):0}},{empty:function(){return de||(de=me._make())},from:function(t){return t&&t.constructor===me?t:t&&0!==t.length?me.empty().union(t):me.empty()},fromKeys:function(t){return me.from(R(t).flip())},_make:function(t,e){var r=Object.create(me.prototype);return r.length=t?t.length:0,r._map=t,r.__ownerID=e,r}},R),ye.prototype.contains=ye.prototype.has,ye.prototype.withMutations=Q.prototype.withMutations,ye.prototype.asMutable=Q.prototype.asMutable,ye.prototype.asImmutable=Q.prototype.asImmutable,ye.prototype.__toJS=L.prototype.__toJS,ye.prototype.__toStringMapper=L.prototype.__toStringMapper;var de,we=function(t){return t&&t.constructor===Ie?t:t&&0!==t.length?Ie.empty().merge(t):Ie.empty()},Ie=we;B.createClass(we,{toString:function(){return this.__toString("OrderedMap {","}")},get:function(t,e){if(null!=t&&this._map){var r=this._map.get(t);if(null!=r)return this._vector.get(r)[1]}return e},clear:function(){return this.__ownerID?(this.length=0,this._map=this._vector=null,this):Ie.empty()},set:function(t,e){if(null==t)return this;var r=this._map,n=this._vector;if(r){var i=r.get(t);null==i?(r=r.set(t,n.length),n=n.push([t,e])):n.get(i)[1]!==e&&(n=n.set(i,[t,e])) <add>}else n=le.empty().__ensureOwner(this.__ownerID).set(0,[t,e]),r=Q.empty().__ensureOwner(this.__ownerID).set(t,0);return this.__ownerID?(this.length=r.length,this._map=r,this._vector=n,this):n===this._vector?this:Ie._make(r,n)},"delete":function(t){if(null==t||null==this._map)return this;var e=this._map.get(t);if(null==e)return this;var r=this._map.delete(t),n=this._vector.delete(e);return 0===r.length?this.clear():this.__ownerID?(this.length=r.length,this._map=r,this._vector=n,this):r===this._map?this:Ie._make(r,n)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t),r=this._vector&&this._vector.__ensureOwner(t);return t?Ie._make(e,r,t):(this.__ownerID=t,this._map=e,this._vector=r,this)},__deepEqual:function(t){var e=this._vector.__iterator__();return t.every(function(t,r){var n=e.next();return n&&(n=n[1]),n&&w(r,n[0])&&w(t,n[1])})},__iterate:function(t,e){return this._vector?this._vector.fromEntries().__iterate(t,e):0}},{empty:function(){return ke||(ke=Ie._make())},_make:function(t,e,r){var n=Object.create(Ie.prototype);return n.length=t?t.length:0,n._map=t,n._vector=e,n.__ownerID=r,n}},Q),we.from=we;var ke,Oe=function(t,e){var r=function(t){this._map=Q(t)};t=R(t),r.prototype=Object.create(De.prototype),r.prototype.constructor=r,r.prototype._name=e,r.prototype._defaultValues=t;var n=Object.keys(t);return r.prototype.length=n.length,Object.defineProperty&&t.forEach(function(t,e){Object.defineProperty(r.prototype,e,{get:function(){return this.get(e)},set:function(t){if(!this.__ownerID)throw Error("Cannot set on an immutable record.");this.set(e,t)}})}),r},De=Oe;B.createClass(Oe,{toString:function(){return this.__toString((this._name||"Record")+" {","}")},has:function(t){return this._defaultValues.has(t)},get:function(t,e){return void 0===e||this.has(t)?this._map.get(t,this._defaultValues.get(t)):e},clear:function(){return this.__ownerID?(this._map.clear(),this):this._empty()},set:function(t,e){if(null==t||!this.has(t))return this;var r=this._map.set(t,e);return this.__ownerID||r===this._map?this:this._make(r) <add>},"delete":function(t){if(null==t||!this.has(t))return this;var e=this._map.delete(t);return this.__ownerID||e===this._map?this:this._make(e)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t);return t?this._make(e,t):(this.__ownerID=t,this._map=e,this)},__iterate:function(t,e){var r=this;return this._defaultValues.map(function(t,e){return r.get(e)}).__iterate(t,e)},_empty:function(){Object.getPrototypeOf(this).constructor;return De._empty||(De._empty=this._make(Q.empty()))},_make:function(t,e){var r=Object.create(Object.getPrototypeOf(this));return r._map=t,r.__ownerID=e,r}},{},R),Oe.prototype.__deepEqual=Q.prototype.__deepEqual,Oe.prototype.merge=Q.prototype.merge,Oe.prototype.mergeWith=Q.prototype.mergeWith,Oe.prototype.mergeDeep=Q.prototype.mergeDeep,Oe.prototype.mergeDeepWith=Q.prototype.mergeDeepWith,Oe.prototype.update=Q.prototype.update,Oe.prototype.updateIn=Q.prototype.updateIn,Oe.prototype.cursor=Q.prototype.cursor,Oe.prototype.withMutations=Q.prototype.withMutations,Oe.prototype.asMutable=Q.prototype.asMutable,Oe.prototype.asImmutable=Q.prototype.asImmutable;var be=function(t,e,r){return this instanceof Me?(A(0!==r,"Cannot step a Range by 0"),t=t||0,null==e&&(e=1/0),t===e&&Se?Se:(r=null==r?1:Math.abs(r),t>e&&(r=-r),this._start=t,this._end=e,this._step=r,void(this.length=Math.max(0,Math.ceil((e-t)/r-1)+1)))):new Me(t,e,r)},Me=be;B.createClass(be,{toString:function(){return 0===this.length?"Range []":"Range [ "+this._start+"..."+this._end+(this._step>1?" by "+this._step:"")+" ]"},has:function(t){return A(t>=0,"Index out of bounds"),this.length>t},get:function(t,e){return A(t>=0,"Index out of bounds"),1/0===this.length||this.length>t?this._start+t*this._step:e},contains:function(t){var e=(t-this._start)/this._step;return e>=0&&this.length>e&&e===Math.floor(e)},slice:function(t,e,r){return u(t,e,this.length)?this:r?B.superCall(this,Me.prototype,"slice",[t,e,r]):(t=o(t,this.length),e=a(e,this.length),t>=e?Se:new Me(this.get(t,this._end),this.get(e,this._end),this._step)) <ide> },__deepEquals:function(t){return this._start===t._start&&this._end===t._end&&this._step===t._step},indexOf:function(t){var e=t-this._start;if(e%this._step===0){var r=e/this._step;if(r>=0&&this.length>r)return r}return-1},lastIndexOf:function(t){return this.indexOf(t)},take:function(t){return this.slice(0,t)},skip:function(t,e){return e?B.superCall(this,Me.prototype,"skip",[t]):this.slice(t)},__iterate:function(t,e,r){for(var n=e^r,i=this.length-1,s=this._step,u=e?this._start+i*s:this._start,o=0;i>=o&&t(u,n?i-o:o,this)!==!1;o++)u+=e?-s:s;return n?this.length:o}},{},L),be.prototype.__toJS=be.prototype.toArray,be.prototype.first=le.prototype.first,be.prototype.last=le.prototype.last;var Se=be(0,0),xe=function(t,e){return 0===e&&Ce?Ce:this instanceof Ee?(this._value=t,void(this.length=null==e?1/0:Math.max(0,e))):new Ee(t,e)},Ee=xe;B.createClass(xe,{toString:function(){return 0===this.length?"Repeat []":"Repeat [ "+this._value+" "+this.length+" times ]"},get:function(t,e){return A(t>=0,"Index out of bounds"),1/0===this.length||this.length>t?this._value:e},first:function(){return this._value},contains:function(t){return w(this._value,t)},__deepEquals:function(t){return w(this._value,t._value)},slice:function(t,e,r){if(r)return B.superCall(this,Ee.prototype,"slice",[t,e,r]);var n=this.length;return t=0>t?Math.max(0,n+t):Math.min(n,t),e=null==e?n:e>0?Math.min(n,e):Math.max(0,n+e),e>t?new Ee(this._value,e-t):Ce},reverse:function(t){return t?B.superCall(this,Ee.prototype,"reverse",[t]):this},indexOf:function(t){return w(this._value,t)?0:-1},lastIndexOf:function(t){return w(this._value,t)?this.length:-1},__iterate:function(t,e,r){var n=e^r;A(!n||1/0>this.length,"Cannot access end of infinite range.");for(var i=this.length-1,s=0;i>=s&&t(this._value,n?i-s:s,this)!==!1;s++);return n?this.length:s}},{},L),xe.prototype.last=xe.prototype.first,xe.prototype.has=be.prototype.has,xe.prototype.take=be.prototype.take,xe.prototype.skip=be.prototype.skip,xe.prototype.__toJS=be.prototype.__toJS;var Ce=new xe(void 0,0),qe={Sequence:R,Map:Q,Vector:le,Set:ye,OrderedMap:we,Record:Oe,Range:be,Repeat:xe,is:w,fromJS:P}; <ide> return qe}"object"==typeof exports?module.exports=t():"function"==typeof define&&define.amd?define(t):Immutable=t(); <ide>\ No newline at end of file <ide><path>src/Vector.js <ide> class Vector extends IndexedSequence { <ide> __deepEquals(other) { <ide> var iterator = this.__iterator__(); <ide> return other.every((v, k) => { <del> var entry = iterator.next(); <del> return k === entry[0] && is(v, entry[1]); <add> var entry = iterator.next().value; <add> return entry && k === entry[0] && is(v, entry[1]); <ide> }); <ide> } <ide> <ide> function _nodeFor(vector, rawIndex) { <ide> } <ide> } <ide> <add>Vector.prototype['@@iterator'] = Vector.prototype.__iterator__; <ide> Vector.prototype.update = Map.prototype.update; <ide> Vector.prototype.updateIn = Map.prototype.updateIn; <ide> Vector.prototype.cursor = Map.prototype.cursor; <ide> class VectorIterator { <ide> if (index >= 0 && index < stack.max && stack.node.hasOwnProperty(stack.rawIndex)) { <ide> var value = stack.node[stack.rawIndex]; <ide> stack.rawIndex++; <del> return [index, value]; <add> return { value: [index, value], done: true }; <ide> } else { <ide> stack.rawIndex++; <ide> } <ide> class VectorIterator { <ide> } <ide> stack = this._stack = this._stack.__prev; <ide> } <del> if (global.StopIteration) { <del> throw global.StopIteration; <del> } <add> return { done: true }; <ide> } <ide> } <ide>
3
Ruby
Ruby
use 1.9 hash syntax consistently
6f788b1d91cd1d9d5731527beec59c16df94862a
<ide><path>activerecord/test/schema/schema.rb <ide> def create_table(*args, &block) <ide> t.integer :ideal_reference_id <ide> end <ide> <del> create_table :keyboards, force: true, :id => false do |t| <add> create_table :keyboards, force: true, id: false do |t| <ide> t.primary_key :key_number <ide> t.string :name <ide> end
1
Python
Python
drop usage of validatiors.empty_values
e6c88a423361b084ba171af7a74a183bd557e73e
<ide><path>rest_framework/fields.py <ide> def run_validation(self, data=empty): <ide> return value <ide> <ide> def run_validators(self, value): <del> if value in validators.EMPTY_VALUES: <add> if value in (None, '', [], (), {}): <ide> return <ide> <ide> errors = [] <ide> def to_internal_value(self, value): <ide> than max_digits in the number, and no more than decimal_places digits <ide> after the decimal point. <ide> """ <del> if value in validators.EMPTY_VALUES: <add> if value in (None, ''): <ide> return None <ide> <ide> value = smart_text(value).strip() <ide> def __init__(self, format=None, input_formats=None, *args, **kwargs): <ide> super(DateField, self).__init__(*args, **kwargs) <ide> <ide> def to_internal_value(self, value): <del> if value in validators.EMPTY_VALUES: <add> if value in (None, ''): <ide> return None <ide> <ide> if isinstance(value, datetime.datetime): <ide> def __init__(self, format=None, input_formats=None, *args, **kwargs): <ide> super(DateTimeField, self).__init__(*args, **kwargs) <ide> <ide> def to_internal_value(self, value): <del> if value in validators.EMPTY_VALUES: <add> if value in (None, ''): <ide> return None <ide> <ide> if isinstance(value, datetime.datetime): <ide> def __init__(self, format=None, input_formats=None, *args, **kwargs): <ide> super(TimeField, self).__init__(*args, **kwargs) <ide> <ide> def from_native(self, value): <del> if value in validators.EMPTY_VALUES: <add> if value in (None, ''): <ide> return None <ide> <ide> if isinstance(value, datetime.time):
1
Python
Python
use feature detection instead of version detection
47bdf9f26fdd499c00a25efa4c0229c544cf682d
<ide><path>flask/_compat.py <ide> PY2 = sys.version_info[0] == 2 <ide> _identity = lambda x: x <ide> <del> <del>if not PY2: <add>try: # Python 2 <add> text_type = unicode <add> string_types = (str, unicode) <add> integer_types = (int, long) <add>except NameError: # Python 3 <ide> text_type = str <ide> string_types = (str,) <ide> integer_types = (int,) <ide> <add>if not PY2: <ide> iterkeys = lambda d: iter(d.keys()) <ide> itervalues = lambda d: iter(d.values()) <ide> iteritems = lambda d: iter(d.items()) <ide> def reraise(tp, value, tb=None): <ide> implements_to_string = _identity <ide> <ide> else: <del> text_type = unicode <del> string_types = (str, unicode) <del> integer_types = (int, long) <del> <ide> iterkeys = lambda d: d.iterkeys() <ide> itervalues = lambda d: d.itervalues() <ide> iteritems = lambda d: d.iteritems()
1
Ruby
Ruby
add an option to skip installation of turbolinks
e3dca3acc6919b0824bc126f8a397f5f4e7484a2
<ide><path>railties/lib/rails/generators/app_base.rb <ide> def self.add_shared_options_for(name) <ide> class_option :skip_spring, type: :boolean, default: false, <ide> desc: "Don't install Spring application preloader" <ide> <add> class_option :skip_turbolinks, type: :boolean, default: false, <add> desc: "Don't install Turbolinks" <add> <ide> class_option :database, type: :string, aliases: '-d', default: 'sqlite3', <ide> desc: "Preconfigure for selected database (options: #{DATABASES.join('/')})" <ide> <ide> def javascript_gemfile_entry <ide> gems << GemfileEntry.version("#{options[:javascript]}-rails", nil, <ide> "Use #{options[:javascript]} as the JavaScript library") <ide> <del> gems << GemfileEntry.version("turbolinks", nil, <del> "Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks") <add> unless options[:skip_turbolinks] <add> gems << GemfileEntry.version("turbolinks", nil, <add> "Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks") <add> end <ide> gems <ide> end <ide> end <ide><path>railties/test/generators/app_generator_test.rb <ide> def test_skip_spring <ide> end <ide> end <ide> <add> def test_skip_turbolinks <add> run_generator [destination_root, "--skip-turbolinks"] <add> <add> assert_file "Gemfile" do |content| <add> assert_no_match(/turbolinks/, content) <add> end <add> assert_file "app/views/layouts/application.html.erb" do |content| <add> assert_no_match(/data-turbolinks-track/, content) <add> end <add> assert_file "app/assets/javascripts/application.js" do |content| <add> assert_no_match(/turbolinks/, content) <add> end <add> end <add> <ide> def test_gitignore_when_sqlite3 <ide> run_generator <ide>
2
Javascript
Javascript
move flag check into each switch case
de3c069843af825503b91ed10d04d03db2aa1c94
<ide><path>packages/react-reconciler/src/ReactFiberCommitWork.new.js <ide> function commitPassiveMountEffects_complete( <ide> while (nextEffect !== null) { <ide> const fiber = nextEffect; <ide> <del> if ((fiber.flags & Passive) !== NoFlags) { <del> setCurrentDebugFiberInDEV(fiber); <del> try { <del> commitPassiveMountOnFiber( <del> root, <del> fiber, <del> committedLanes, <del> committedTransitions, <del> ); <del> } catch (error) { <del> captureCommitPhaseError(fiber, fiber.return, error); <del> } <del> resetCurrentDebugFiberInDEV(); <add> setCurrentDebugFiberInDEV(fiber); <add> try { <add> commitPassiveMountOnFiber( <add> root, <add> fiber, <add> committedLanes, <add> committedTransitions, <add> ); <add> } catch (error) { <add> captureCommitPhaseError(fiber, fiber.return, error); <ide> } <add> resetCurrentDebugFiberInDEV(); <ide> <ide> if (fiber === subtreeRoot) { <ide> nextEffect = null; <ide> function commitPassiveMountOnFiber( <ide> committedLanes: Lanes, <ide> committedTransitions: Array<Transition> | null, <ide> ): void { <add> const flags = finishedWork.flags; <ide> switch (finishedWork.tag) { <ide> case FunctionComponent: <ide> case ForwardRef: <ide> case SimpleMemoComponent: { <del> if ( <del> enableProfilerTimer && <del> enableProfilerCommitHooks && <del> finishedWork.mode & ProfileMode <del> ) { <del> startPassiveEffectTimer(); <del> try { <add> if (flags & Passive) { <add> if ( <add> enableProfilerTimer && <add> enableProfilerCommitHooks && <add> finishedWork.mode & ProfileMode <add> ) { <add> startPassiveEffectTimer(); <add> try { <add> commitHookEffectListMount( <add> HookPassive | HookHasEffect, <add> finishedWork, <add> ); <add> } finally { <add> recordPassiveEffectDuration(finishedWork); <add> } <add> } else { <ide> commitHookEffectListMount(HookPassive | HookHasEffect, finishedWork); <del> } finally { <del> recordPassiveEffectDuration(finishedWork); <ide> } <del> } else { <del> commitHookEffectListMount(HookPassive | HookHasEffect, finishedWork); <ide> } <ide> break; <ide> } <ide> case HostRoot: { <del> if (enableCache) { <del> let previousCache: Cache | null = null; <del> if (finishedWork.alternate !== null) { <del> previousCache = finishedWork.alternate.memoizedState.cache; <del> } <del> const nextCache = finishedWork.memoizedState.cache; <del> // Retain/release the root cache. <del> // Note that on initial mount, previousCache and nextCache will be the same <del> // and this retain won't occur. To counter this, we instead retain the HostRoot's <del> // initial cache when creating the root itself (see createFiberRoot() in <del> // ReactFiberRoot.js). Subsequent updates that change the cache are reflected <del> // here, such that previous/next caches are retained correctly. <del> if (nextCache !== previousCache) { <del> retainCache(nextCache); <del> if (previousCache != null) { <del> releaseCache(previousCache); <add> if (flags & Passive) { <add> if (enableCache) { <add> let previousCache: Cache | null = null; <add> if (finishedWork.alternate !== null) { <add> previousCache = finishedWork.alternate.memoizedState.cache; <add> } <add> const nextCache = finishedWork.memoizedState.cache; <add> // Retain/release the root cache. <add> // Note that on initial mount, previousCache and nextCache will be the same <add> // and this retain won't occur. To counter this, we instead retain the HostRoot's <add> // initial cache when creating the root itself (see createFiberRoot() in <add> // ReactFiberRoot.js). Subsequent updates that change the cache are reflected <add> // here, such that previous/next caches are retained correctly. <add> if (nextCache !== previousCache) { <add> retainCache(nextCache); <add> if (previousCache != null) { <add> releaseCache(previousCache); <add> } <ide> } <ide> } <del> } <ide> <del> if (enableTransitionTracing) { <del> // Get the transitions that were initiatized during the render <del> // and add a start transition callback for each of them <del> const root = finishedWork.stateNode; <del> const incompleteTransitions = root.incompleteTransitions; <del> // Initial render <del> if (committedTransitions !== null) { <del> committedTransitions.forEach(transition => { <del> addTransitionStartCallbackToPendingTransition(transition); <add> if (enableTransitionTracing) { <add> // Get the transitions that were initiatized during the render <add> // and add a start transition callback for each of them <add> const root = finishedWork.stateNode; <add> const incompleteTransitions = root.incompleteTransitions; <add> // Initial render <add> if (committedTransitions !== null) { <add> committedTransitions.forEach(transition => { <add> addTransitionStartCallbackToPendingTransition(transition); <add> }); <add> <add> clearTransitionsForLanes(finishedRoot, committedLanes); <add> } <add> <add> incompleteTransitions.forEach((markerInstance, transition) => { <add> const pendingBoundaries = markerInstance.pendingBoundaries; <add> if (pendingBoundaries === null || pendingBoundaries.size === 0) { <add> addTransitionCompleteCallbackToPendingTransition(transition); <add> incompleteTransitions.delete(transition); <add> } <ide> }); <ide> <ide> clearTransitionsForLanes(finishedRoot, committedLanes); <ide> } <del> <del> incompleteTransitions.forEach((markerInstance, transition) => { <del> const pendingBoundaries = markerInstance.pendingBoundaries; <del> if (pendingBoundaries === null || pendingBoundaries.size === 0) { <del> addTransitionCompleteCallbackToPendingTransition(transition); <del> incompleteTransitions.delete(transition); <del> } <del> }); <del> <del> clearTransitionsForLanes(finishedRoot, committedLanes); <ide> } <ide> break; <ide> } <ide> case LegacyHiddenComponent: <ide> case OffscreenComponent: { <del> if (enableCache) { <del> let previousCache: Cache | null = null; <del> if ( <del> finishedWork.alternate !== null && <del> finishedWork.alternate.memoizedState !== null && <del> finishedWork.alternate.memoizedState.cachePool !== null <del> ) { <del> previousCache = finishedWork.alternate.memoizedState.cachePool.pool; <del> } <del> let nextCache: Cache | null = null; <del> if ( <del> finishedWork.memoizedState !== null && <del> finishedWork.memoizedState.cachePool !== null <del> ) { <del> nextCache = finishedWork.memoizedState.cachePool.pool; <del> } <del> // Retain/release the cache used for pending (suspended) nodes. <del> // Note that this is only reached in the non-suspended/visible case: <del> // when the content is suspended/hidden, the retain/release occurs <del> // via the parent Suspense component (see case above). <del> if (nextCache !== previousCache) { <del> if (nextCache != null) { <del> retainCache(nextCache); <add> if (flags & Passive) { <add> if (enableCache) { <add> let previousCache: Cache | null = null; <add> if ( <add> finishedWork.alternate !== null && <add> finishedWork.alternate.memoizedState !== null && <add> finishedWork.alternate.memoizedState.cachePool !== null <add> ) { <add> previousCache = finishedWork.alternate.memoizedState.cachePool.pool; <ide> } <del> if (previousCache != null) { <del> releaseCache(previousCache); <add> let nextCache: Cache | null = null; <add> if ( <add> finishedWork.memoizedState !== null && <add> finishedWork.memoizedState.cachePool !== null <add> ) { <add> nextCache = finishedWork.memoizedState.cachePool.pool; <add> } <add> // Retain/release the cache used for pending (suspended) nodes. <add> // Note that this is only reached in the non-suspended/visible case: <add> // when the content is suspended/hidden, the retain/release occurs <add> // via the parent Suspense component (see case above). <add> if (nextCache !== previousCache) { <add> if (nextCache != null) { <add> retainCache(nextCache); <add> } <add> if (previousCache != null) { <add> releaseCache(previousCache); <add> } <ide> } <ide> } <del> } <ide> <del> if (enableTransitionTracing) { <del> const isFallback = finishedWork.memoizedState; <del> const queue: OffscreenQueue | null = (finishedWork.updateQueue: any); <del> const instance: OffscreenInstance = finishedWork.stateNode; <add> if (enableTransitionTracing) { <add> const isFallback = finishedWork.memoizedState; <add> const queue: OffscreenQueue | null = (finishedWork.updateQueue: any); <add> const instance: OffscreenInstance = finishedWork.stateNode; <ide> <del> if (queue !== null) { <del> if (isFallback) { <del> const transitions = queue.transitions; <del> if (transitions !== null) { <del> transitions.forEach(transition => { <del> // Add all the transitions saved in the update queue during <del> // the render phase (ie the transitions associated with this boundary) <del> // into the transitions set. <del> if (instance.transitions === null) { <del> instance.transitions = new Set(); <del> } <del> instance.transitions.add(transition); <del> }); <del> } <add> if (queue !== null) { <add> if (isFallback) { <add> const transitions = queue.transitions; <add> if (transitions !== null) { <add> transitions.forEach(transition => { <add> // Add all the transitions saved in the update queue during <add> // the render phase (ie the transitions associated with this boundary) <add> // into the transitions set. <add> if (instance.transitions === null) { <add> instance.transitions = new Set(); <add> } <add> instance.transitions.add(transition); <add> }); <add> } <ide> <del> const markerInstances = queue.markerInstances; <del> if (markerInstances !== null) { <del> markerInstances.forEach(markerInstance => { <del> const markerTransitions = markerInstance.transitions; <del> // There should only be a few tracing marker transitions because <del> // they should be only associated with the transition that <del> // caused them <del> if (markerTransitions !== null) { <del> markerTransitions.forEach(transition => { <del> if (instance.transitions === null) { <del> instance.transitions = new Set(); <del> } else if (instance.transitions.has(transition)) { <del> if (markerInstance.pendingBoundaries === null) { <del> markerInstance.pendingBoundaries = new Map(); <add> const markerInstances = queue.markerInstances; <add> if (markerInstances !== null) { <add> markerInstances.forEach(markerInstance => { <add> const markerTransitions = markerInstance.transitions; <add> // There should only be a few tracing marker transitions because <add> // they should be only associated with the transition that <add> // caused them <add> if (markerTransitions !== null) { <add> markerTransitions.forEach(transition => { <add> if (instance.transitions === null) { <add> instance.transitions = new Set(); <add> } else if (instance.transitions.has(transition)) { <add> if (markerInstance.pendingBoundaries === null) { <add> markerInstance.pendingBoundaries = new Map(); <add> } <add> if (instance.pendingMarkers === null) { <add> instance.pendingMarkers = new Set(); <add> } <add> <add> instance.pendingMarkers.add(markerInstance); <ide> } <del> if (instance.pendingMarkers === null) { <del> instance.pendingMarkers = new Set(); <del> } <del> <del> instance.pendingMarkers.add(markerInstance); <del> } <del> }); <del> } <del> }); <add> }); <add> } <add> }); <add> } <ide> } <add> <add> finishedWork.updateQueue = null; <ide> } <ide> <del> finishedWork.updateQueue = null; <add> commitTransitionProgress(finishedWork); <ide> } <del> <del> commitTransitionProgress(finishedWork); <ide> } <del> <ide> break; <ide> } <ide> case CacheComponent: { <del> if (enableCache) { <del> let previousCache: Cache | null = null; <del> if (finishedWork.alternate !== null) { <del> previousCache = finishedWork.alternate.memoizedState.cache; <del> } <del> const nextCache = finishedWork.memoizedState.cache; <del> // Retain/release the cache. In theory the cache component <del> // could be "borrowing" a cache instance owned by some parent, <del> // in which case we could avoid retaining/releasing. But it <del> // is non-trivial to determine when that is the case, so we <del> // always retain/release. <del> if (nextCache !== previousCache) { <del> retainCache(nextCache); <del> if (previousCache != null) { <del> releaseCache(previousCache); <add> if (flags & Passive) { <add> if (enableCache) { <add> let previousCache: Cache | null = null; <add> if (finishedWork.alternate !== null) { <add> previousCache = finishedWork.alternate.memoizedState.cache; <add> } <add> const nextCache = finishedWork.memoizedState.cache; <add> // Retain/release the cache. In theory the cache component <add> // could be "borrowing" a cache instance owned by some parent, <add> // in which case we could avoid retaining/releasing. But it <add> // is non-trivial to determine when that is the case, so we <add> // always retain/release. <add> if (nextCache !== previousCache) { <add> retainCache(nextCache); <add> if (previousCache != null) { <add> releaseCache(previousCache); <add> } <ide> } <ide> } <ide> } <ide> break; <ide> } <ide> case TracingMarkerComponent: { <ide> if (enableTransitionTracing) { <del> // Get the transitions that were initiatized during the render <del> // and add a start transition callback for each of them <del> const instance = finishedWork.stateNode; <del> if ( <del> instance.transitions !== null && <del> (instance.pendingBoundaries === null || <del> instance.pendingBoundaries.size === 0) <del> ) { <del> addMarkerCompleteCallbackToPendingTransition( <del> finishedWork.memoizedProps.name, <del> instance.transitions, <del> ); <del> instance.transitions = null; <del> instance.pendingBoundaries = null; <add> if (flags & Passive) { <add> // Get the transitions that were initiatized during the render <add> // and add a start transition callback for each of them <add> const instance = finishedWork.stateNode; <add> if ( <add> instance.transitions !== null && <add> (instance.pendingBoundaries === null || <add> instance.pendingBoundaries.size === 0) <add> ) { <add> instance.transitions.forEach(transition => { <add> addMarkerCompleteCallbackToPendingTransition( <add> finishedWork.memoizedProps.name, <add> instance.transitions, <add> ); <add> }); <add> instance.transitions = null; <add> instance.pendingBoundaries = null; <add> } <ide> } <ide> } <ide> break; <ide><path>packages/react-reconciler/src/ReactFiberCommitWork.old.js <ide> function commitPassiveMountEffects_complete( <ide> while (nextEffect !== null) { <ide> const fiber = nextEffect; <ide> <del> if ((fiber.flags & Passive) !== NoFlags) { <del> setCurrentDebugFiberInDEV(fiber); <del> try { <del> commitPassiveMountOnFiber( <del> root, <del> fiber, <del> committedLanes, <del> committedTransitions, <del> ); <del> } catch (error) { <del> captureCommitPhaseError(fiber, fiber.return, error); <del> } <del> resetCurrentDebugFiberInDEV(); <add> setCurrentDebugFiberInDEV(fiber); <add> try { <add> commitPassiveMountOnFiber( <add> root, <add> fiber, <add> committedLanes, <add> committedTransitions, <add> ); <add> } catch (error) { <add> captureCommitPhaseError(fiber, fiber.return, error); <ide> } <add> resetCurrentDebugFiberInDEV(); <ide> <ide> if (fiber === subtreeRoot) { <ide> nextEffect = null; <ide> function commitPassiveMountOnFiber( <ide> committedLanes: Lanes, <ide> committedTransitions: Array<Transition> | null, <ide> ): void { <add> const flags = finishedWork.flags; <ide> switch (finishedWork.tag) { <ide> case FunctionComponent: <ide> case ForwardRef: <ide> case SimpleMemoComponent: { <del> if ( <del> enableProfilerTimer && <del> enableProfilerCommitHooks && <del> finishedWork.mode & ProfileMode <del> ) { <del> startPassiveEffectTimer(); <del> try { <add> if (flags & Passive) { <add> if ( <add> enableProfilerTimer && <add> enableProfilerCommitHooks && <add> finishedWork.mode & ProfileMode <add> ) { <add> startPassiveEffectTimer(); <add> try { <add> commitHookEffectListMount( <add> HookPassive | HookHasEffect, <add> finishedWork, <add> ); <add> } finally { <add> recordPassiveEffectDuration(finishedWork); <add> } <add> } else { <ide> commitHookEffectListMount(HookPassive | HookHasEffect, finishedWork); <del> } finally { <del> recordPassiveEffectDuration(finishedWork); <ide> } <del> } else { <del> commitHookEffectListMount(HookPassive | HookHasEffect, finishedWork); <ide> } <ide> break; <ide> } <ide> case HostRoot: { <del> if (enableCache) { <del> let previousCache: Cache | null = null; <del> if (finishedWork.alternate !== null) { <del> previousCache = finishedWork.alternate.memoizedState.cache; <del> } <del> const nextCache = finishedWork.memoizedState.cache; <del> // Retain/release the root cache. <del> // Note that on initial mount, previousCache and nextCache will be the same <del> // and this retain won't occur. To counter this, we instead retain the HostRoot's <del> // initial cache when creating the root itself (see createFiberRoot() in <del> // ReactFiberRoot.js). Subsequent updates that change the cache are reflected <del> // here, such that previous/next caches are retained correctly. <del> if (nextCache !== previousCache) { <del> retainCache(nextCache); <del> if (previousCache != null) { <del> releaseCache(previousCache); <add> if (flags & Passive) { <add> if (enableCache) { <add> let previousCache: Cache | null = null; <add> if (finishedWork.alternate !== null) { <add> previousCache = finishedWork.alternate.memoizedState.cache; <add> } <add> const nextCache = finishedWork.memoizedState.cache; <add> // Retain/release the root cache. <add> // Note that on initial mount, previousCache and nextCache will be the same <add> // and this retain won't occur. To counter this, we instead retain the HostRoot's <add> // initial cache when creating the root itself (see createFiberRoot() in <add> // ReactFiberRoot.js). Subsequent updates that change the cache are reflected <add> // here, such that previous/next caches are retained correctly. <add> if (nextCache !== previousCache) { <add> retainCache(nextCache); <add> if (previousCache != null) { <add> releaseCache(previousCache); <add> } <ide> } <ide> } <del> } <ide> <del> if (enableTransitionTracing) { <del> // Get the transitions that were initiatized during the render <del> // and add a start transition callback for each of them <del> const root = finishedWork.stateNode; <del> const incompleteTransitions = root.incompleteTransitions; <del> // Initial render <del> if (committedTransitions !== null) { <del> committedTransitions.forEach(transition => { <del> addTransitionStartCallbackToPendingTransition(transition); <add> if (enableTransitionTracing) { <add> // Get the transitions that were initiatized during the render <add> // and add a start transition callback for each of them <add> const root = finishedWork.stateNode; <add> const incompleteTransitions = root.incompleteTransitions; <add> // Initial render <add> if (committedTransitions !== null) { <add> committedTransitions.forEach(transition => { <add> addTransitionStartCallbackToPendingTransition(transition); <add> }); <add> <add> clearTransitionsForLanes(finishedRoot, committedLanes); <add> } <add> <add> incompleteTransitions.forEach((markerInstance, transition) => { <add> const pendingBoundaries = markerInstance.pendingBoundaries; <add> if (pendingBoundaries === null || pendingBoundaries.size === 0) { <add> addTransitionCompleteCallbackToPendingTransition(transition); <add> incompleteTransitions.delete(transition); <add> } <ide> }); <ide> <ide> clearTransitionsForLanes(finishedRoot, committedLanes); <ide> } <del> <del> incompleteTransitions.forEach((markerInstance, transition) => { <del> const pendingBoundaries = markerInstance.pendingBoundaries; <del> if (pendingBoundaries === null || pendingBoundaries.size === 0) { <del> addTransitionCompleteCallbackToPendingTransition(transition); <del> incompleteTransitions.delete(transition); <del> } <del> }); <del> <del> clearTransitionsForLanes(finishedRoot, committedLanes); <ide> } <ide> break; <ide> } <ide> case LegacyHiddenComponent: <ide> case OffscreenComponent: { <del> if (enableCache) { <del> let previousCache: Cache | null = null; <del> if ( <del> finishedWork.alternate !== null && <del> finishedWork.alternate.memoizedState !== null && <del> finishedWork.alternate.memoizedState.cachePool !== null <del> ) { <del> previousCache = finishedWork.alternate.memoizedState.cachePool.pool; <del> } <del> let nextCache: Cache | null = null; <del> if ( <del> finishedWork.memoizedState !== null && <del> finishedWork.memoizedState.cachePool !== null <del> ) { <del> nextCache = finishedWork.memoizedState.cachePool.pool; <del> } <del> // Retain/release the cache used for pending (suspended) nodes. <del> // Note that this is only reached in the non-suspended/visible case: <del> // when the content is suspended/hidden, the retain/release occurs <del> // via the parent Suspense component (see case above). <del> if (nextCache !== previousCache) { <del> if (nextCache != null) { <del> retainCache(nextCache); <add> if (flags & Passive) { <add> if (enableCache) { <add> let previousCache: Cache | null = null; <add> if ( <add> finishedWork.alternate !== null && <add> finishedWork.alternate.memoizedState !== null && <add> finishedWork.alternate.memoizedState.cachePool !== null <add> ) { <add> previousCache = finishedWork.alternate.memoizedState.cachePool.pool; <ide> } <del> if (previousCache != null) { <del> releaseCache(previousCache); <add> let nextCache: Cache | null = null; <add> if ( <add> finishedWork.memoizedState !== null && <add> finishedWork.memoizedState.cachePool !== null <add> ) { <add> nextCache = finishedWork.memoizedState.cachePool.pool; <add> } <add> // Retain/release the cache used for pending (suspended) nodes. <add> // Note that this is only reached in the non-suspended/visible case: <add> // when the content is suspended/hidden, the retain/release occurs <add> // via the parent Suspense component (see case above). <add> if (nextCache !== previousCache) { <add> if (nextCache != null) { <add> retainCache(nextCache); <add> } <add> if (previousCache != null) { <add> releaseCache(previousCache); <add> } <ide> } <ide> } <del> } <ide> <del> if (enableTransitionTracing) { <del> const isFallback = finishedWork.memoizedState; <del> const queue: OffscreenQueue | null = (finishedWork.updateQueue: any); <del> const instance: OffscreenInstance = finishedWork.stateNode; <add> if (enableTransitionTracing) { <add> const isFallback = finishedWork.memoizedState; <add> const queue: OffscreenQueue | null = (finishedWork.updateQueue: any); <add> const instance: OffscreenInstance = finishedWork.stateNode; <ide> <del> if (queue !== null) { <del> if (isFallback) { <del> const transitions = queue.transitions; <del> if (transitions !== null) { <del> transitions.forEach(transition => { <del> // Add all the transitions saved in the update queue during <del> // the render phase (ie the transitions associated with this boundary) <del> // into the transitions set. <del> if (instance.transitions === null) { <del> instance.transitions = new Set(); <del> } <del> instance.transitions.add(transition); <del> }); <del> } <add> if (queue !== null) { <add> if (isFallback) { <add> const transitions = queue.transitions; <add> if (transitions !== null) { <add> transitions.forEach(transition => { <add> // Add all the transitions saved in the update queue during <add> // the render phase (ie the transitions associated with this boundary) <add> // into the transitions set. <add> if (instance.transitions === null) { <add> instance.transitions = new Set(); <add> } <add> instance.transitions.add(transition); <add> }); <add> } <ide> <del> const markerInstances = queue.markerInstances; <del> if (markerInstances !== null) { <del> markerInstances.forEach(markerInstance => { <del> const markerTransitions = markerInstance.transitions; <del> // There should only be a few tracing marker transitions because <del> // they should be only associated with the transition that <del> // caused them <del> if (markerTransitions !== null) { <del> markerTransitions.forEach(transition => { <del> if (instance.transitions === null) { <del> instance.transitions = new Set(); <del> } else if (instance.transitions.has(transition)) { <del> if (markerInstance.pendingBoundaries === null) { <del> markerInstance.pendingBoundaries = new Map(); <add> const markerInstances = queue.markerInstances; <add> if (markerInstances !== null) { <add> markerInstances.forEach(markerInstance => { <add> const markerTransitions = markerInstance.transitions; <add> // There should only be a few tracing marker transitions because <add> // they should be only associated with the transition that <add> // caused them <add> if (markerTransitions !== null) { <add> markerTransitions.forEach(transition => { <add> if (instance.transitions === null) { <add> instance.transitions = new Set(); <add> } else if (instance.transitions.has(transition)) { <add> if (markerInstance.pendingBoundaries === null) { <add> markerInstance.pendingBoundaries = new Map(); <add> } <add> if (instance.pendingMarkers === null) { <add> instance.pendingMarkers = new Set(); <add> } <add> <add> instance.pendingMarkers.add(markerInstance); <ide> } <del> if (instance.pendingMarkers === null) { <del> instance.pendingMarkers = new Set(); <del> } <del> <del> instance.pendingMarkers.add(markerInstance); <del> } <del> }); <del> } <del> }); <add> }); <add> } <add> }); <add> } <ide> } <add> <add> finishedWork.updateQueue = null; <ide> } <ide> <del> finishedWork.updateQueue = null; <add> commitTransitionProgress(finishedWork); <ide> } <del> <del> commitTransitionProgress(finishedWork); <ide> } <del> <ide> break; <ide> } <ide> case CacheComponent: { <del> if (enableCache) { <del> let previousCache: Cache | null = null; <del> if (finishedWork.alternate !== null) { <del> previousCache = finishedWork.alternate.memoizedState.cache; <del> } <del> const nextCache = finishedWork.memoizedState.cache; <del> // Retain/release the cache. In theory the cache component <del> // could be "borrowing" a cache instance owned by some parent, <del> // in which case we could avoid retaining/releasing. But it <del> // is non-trivial to determine when that is the case, so we <del> // always retain/release. <del> if (nextCache !== previousCache) { <del> retainCache(nextCache); <del> if (previousCache != null) { <del> releaseCache(previousCache); <add> if (flags & Passive) { <add> if (enableCache) { <add> let previousCache: Cache | null = null; <add> if (finishedWork.alternate !== null) { <add> previousCache = finishedWork.alternate.memoizedState.cache; <add> } <add> const nextCache = finishedWork.memoizedState.cache; <add> // Retain/release the cache. In theory the cache component <add> // could be "borrowing" a cache instance owned by some parent, <add> // in which case we could avoid retaining/releasing. But it <add> // is non-trivial to determine when that is the case, so we <add> // always retain/release. <add> if (nextCache !== previousCache) { <add> retainCache(nextCache); <add> if (previousCache != null) { <add> releaseCache(previousCache); <add> } <ide> } <ide> } <ide> } <ide> break; <ide> } <ide> case TracingMarkerComponent: { <ide> if (enableTransitionTracing) { <del> // Get the transitions that were initiatized during the render <del> // and add a start transition callback for each of them <del> const instance = finishedWork.stateNode; <del> if ( <del> instance.transitions !== null && <del> (instance.pendingBoundaries === null || <del> instance.pendingBoundaries.size === 0) <del> ) { <del> addMarkerCompleteCallbackToPendingTransition( <del> finishedWork.memoizedProps.name, <del> instance.transitions, <del> ); <del> instance.transitions = null; <del> instance.pendingBoundaries = null; <add> if (flags & Passive) { <add> // Get the transitions that were initiatized during the render <add> // and add a start transition callback for each of them <add> const instance = finishedWork.stateNode; <add> if ( <add> instance.transitions !== null && <add> (instance.pendingBoundaries === null || <add> instance.pendingBoundaries.size === 0) <add> ) { <add> instance.transitions.forEach(transition => { <add> addMarkerCompleteCallbackToPendingTransition( <add> finishedWork.memoizedProps.name, <add> instance.transitions, <add> ); <add> }); <add> instance.transitions = null; <add> instance.pendingBoundaries = null; <add> } <ide> } <ide> } <ide> break;
2
Javascript
Javascript
increase slop limit in memory leak test
997e97d9cd8c687284feb32e364ef434086d38d5
<ide><path>test/parallel/test-crypto-dh-leak.js <ide> const after = process.memoryUsage().rss; <ide> <ide> // RSS should stay the same, ceteris paribus, but allow for <ide> // some slop because V8 mallocs memory during execution. <del>assert(after - before < 5 << 20, `before=${before} after=${after}`); <add>assert(after - before < 10 << 20, `before=${before} after=${after}`);
1
Javascript
Javascript
fix referenceerror in truncatesync()
5fba3b85c5a50b6b8c9061d951dc09da8a221d40
<ide><path>lib/fs.js <ide> fs.truncate = function(path, len, callback) { <ide> fs.truncateSync = function(path, len) { <ide> if (typeof path === 'number') { <ide> // legacy <del> return fs.ftruncateSync(path, len, callback); <add> return fs.ftruncateSync(path, len); <ide> } <ide> if (typeof len === 'undefined') { <ide> len = 0;
1
Text
Text
update bash completion docs
1dcf8c689cb3e35d2b727903068c2df27c357ca6
<ide><path>docs/Shell-Completion.md <ide> Homebrew comes with completion definitions for the `brew` command. Some packages <ide> You must configure your shell to enable the completion support. This is because the Homebrew-managed completions are stored under `HOMEBREW_PREFIX`, which your system shell may not be aware of, and because it is difficult to automatically configure `bash` and `zsh` completions in a robust manner, so the Homebrew installer cannot do it for you. <ide> <ide> ## Configuring Completions in `bash` <add> <ide> To make Homebrew's completions available in `bash`, you must source the definitions as part of your shell startup. Add the following to your `~/.bashrc` file: <ide> <ide> ```sh <ide> if type brew 2&>/dev/null; then <del> for completion_file in $(brew --prefix)/etc/bash_completion.d/*; do <del> source "$completion_file" <del> done <add> source "$(brew --prefix)/etc/bash_completion" <add>else <add> echo "run: brew install git bash-completion" <ide> fi <ide> ``` <ide>
1
Javascript
Javascript
use hmrclient to send console logs to metro
81ec2112a15e3d66b7973f0e1aaa8986fcca753f
<ide><path>Libraries/Core/Devtools/logToConsole.js <del>/** <del> * Copyright (c) Facebook, Inc. and its affiliates. <del> * <del> * This source code is licensed under the MIT license found in the <del> * LICENSE file in the root directory of this source tree. <del> * <del> * @format <del> * @flow strict-local <del> */ <del> <del>'use strict'; <del> <del>const getDevServer = require('./getDevServer'); <del> <del>let ID = 0; <del> <del>function logToConsole( <del> level: <del> | 'trace' <del> | 'info' <del> | 'warn' <del> | 'log' <del> | 'group' <del> | 'groupCollapsed' <del> | 'groupEnd' <del> | 'debug', <del> data: Array<mixed>, <del>) { <del> let body; <del> try { <del> body = JSON.stringify({id: ID++, level, data}); <del> } catch (error) { <del> body = JSON.stringify({id: ID++, level, data: [error.message]}); <del> } <del> fetch(getDevServer().url + 'log-to-console', { <del> method: 'POST', <del> body, <del> }).catch(e => { <del> // ...Oh well! <del> // If metro is running, logs should be sent to metro. <del> // If metro is NOT running, this will throw an exception every time... and <del> // those exceptions will be caught and logged, which will throw another <del> // exception, etc, causing infinite exception loop which affects UI perf. <del> // If we swallow silently here, that won't happen. <del> }); <del>} <del> <del>module.exports = logToConsole; <ide><path>Libraries/Core/setUpDeveloperTools.js <ide> if (__DEV__) { <ide> } <ide> <ide> if (!Platform.isTesting) { <del> const logToConsole = require('./Devtools/logToConsole'); <add> const HMRClient = require('../Utilities/HMRClient'); <ide> [ <ide> 'trace', <ide> 'info', <ide> if (__DEV__) { <ide> const originalFunction = console[level]; <ide> // $FlowFixMe Overwrite console methods <ide> console[level] = function(...args) { <del> logToConsole(level, args); <add> HMRClient.log(level, args); <ide> originalFunction.apply(console, args); <ide> }; <ide> }); <ide><path>Libraries/Utilities/HMRClient.js <ide> let hmrClient = null; <ide> let hmrUnavailableReason: string | null = null; <ide> let currentCompileErrorMessage: string | null = null; <ide> <add>type LogLevel = <add> | 'trace' <add> | 'info' <add> | 'warn' <add> | 'log' <add> | 'group' <add> | 'groupCollapsed' <add> | 'groupEnd' <add> | 'debug'; <add> <ide> export type HMRClientNativeInterface = {| <ide> enable(): void, <ide> disable(): void, <ide> registerBundle(requestUrl: string): void, <add> log(level: LogLevel, data: Array<mixed>): void, <ide> setup( <ide> platform: string, <ide> bundleEntry: string, <ide> const HMRClient: HMRClientNativeInterface = { <ide> registerBundleEntryPoints(hmrClient); <ide> }, <ide> <add> log(level: LogLevel, data: Array<mixed>) { <add> let message; <add> try { <add> message = JSON.stringify({type: 'log', level, data}); <add> } catch (error) { <add> message = JSON.stringify({type: 'log', level, data: [error.message]}); <add> } <add> <add> try { <add> if (hmrClient) { <add> hmrClient.send(message); <add> } <add> } catch (error) { <add> // If sending logs causes any failures we want to silently ignore them <add> // to ensure we do not cause infinite-logging loops. <add> } <add> }, <add> <ide> // Called once by the bridge on startup, even if Fast Refresh is off. <ide> // It creates the HMR client but doesn't actually set up the socket yet. <ide> setup( <ide><path>Libraries/Utilities/HMRClientProdShim.js <ide> const HMRClientProdShim: HMRClientNativeInterface = { <ide> }, <ide> disable() {}, <ide> registerBundle() {}, <add> log() {}, <ide> }; <ide> <ide> module.exports = HMRClientProdShim;
4
Ruby
Ruby
handle more jenkins configurations
df1f9806a4e82d3a4f2a2a793f5ac8b6778344c1
<ide><path>Library/Homebrew/dev-cmd/test-bot.rb <ide> def test_ci_upload(tap) <ide> job = ENV["UPSTREAM_JOB_NAME"] <ide> id = ENV["UPSTREAM_BUILD_ID"] <ide> raise "Missing Jenkins variables!" if !jenkins || !job || !id <add> <ide> bottles = Dir["#{jenkins}/jobs/#{job}/configurations/axis-version/*/builds/#{id}/archive/*.bottle*.*"] <ide> return if bottles.empty? <del> end <ide> <del> FileUtils.cp bottles, Dir.pwd, :verbose => true <add> FileUtils.cp bottles, Dir.pwd, :verbose => true <add> end <ide> <ide> json_files = Dir.glob("*.bottle.json") <ide> bottles_hash = json_files.reduce({}) do |hash, json_file| <ide> def test_ci_upload(tap) <ide> ENV["GIT_WORK_TREE"] = tap.path <ide> ENV["GIT_DIR"] = "#{ENV["GIT_WORK_TREE"]}/.git" <ide> <del> pr = ENV["UPSTREAM_PULL_REQUEST"] <del> number = ENV["UPSTREAM_BUILD_NUMBER"] <del> <ide> quiet_system "git", "am", "--abort" <ide> quiet_system "git", "rebase", "--abort" <ide> safe_system "git", "checkout", "-f", "master" <ide> safe_system "git", "reset", "--hard", "origin/master" <ide> safe_system "brew", "update" <ide> <del> if pr <add> if (pr = ENV["UPSTREAM_PULL_REQUEST"]) <ide> pull_pr = "https://github.com/#{tap.user}/homebrew-#{tap.repo}/pull/#{pr}" <ide> safe_system "brew", "pull", "--clean", pull_pr <ide> end <ide> <del> if ENV["UPSTREAM_BOTTLE_KEEP_OLD"] <add> if ENV["UPSTREAM_BOTTLE_KEEP_OLD"] || ENV["BOT_PARAMS"].include?("--keep-old") <ide> system "brew", "bottle", "--merge", "--write", "--keep-old", *json_files <ide> else <ide> system "brew", "bottle", "--merge", "--write", *json_files <ide> end <ide> <ide> remote = "git@github.com:BrewTestBot/homebrew-#{tap.repo}.git" <del> git_tag = pr ? "pr-#{pr}" : "testing-#{number}" <del> safe_system "git", "push", "--force", remote, "master:master", ":refs/tags/#{git_tag}" <add> git_tag = if pr <add> "pr-#{pr}" <add> elsif (upstream_number = ENV["UPSTREAM_BUILD_NUMBER"]) <add> "testing-#{upstream_number}" <add> elsif (number = ENV["BUILD_NUMBER"]) <add> "other-#{number}" <add> end <add> if git_tag <add> safe_system "git", "push", "--force", remote, "master:master", ":refs/tags/#{git_tag}" <add> end <ide> <ide> formula_packaged = {} <ide> <ide> def test_ci_upload(tap) <ide> end <ide> end <ide> <del> safe_system "git", "tag", "--force", git_tag <del> safe_system "git", "push", "--force", remote, "master:master", "refs/tags/#{git_tag}" <add> if git_tag <add> safe_system "git", "tag", "--force", git_tag <add> safe_system "git", "push", "--force", remote, "master:master", "refs/tags/#{git_tag}" <add> end <ide> end <ide> <ide> def sanitize_ARGV_and_ENV
1
Python
Python
fix printing for python2 in lstm example
872a9faf180e1257e63c577c5f0273d12cd6ee9e
<ide><path>examples/lstm_text_generation.py <add>from __future__ import print_function <ide> from keras.models import Sequential <ide> from keras.layers.core import Dense, Activation <ide> from keras.layers.recurrent import LSTM
1
Ruby
Ruby
add additional options
fceaa2bb74d7beac30afe5fcf21c4d10e8ef53fa
<ide><path>Library/Homebrew/service.rb <ide> def working_dir(path = nil) <ide> end <ide> end <ide> <add> sig { params(path: T.nilable(T.any(String, Pathname))).returns(T.nilable(String)) } <add> def root_dir(path = nil) <add> case T.unsafe(path) <add> when nil <add> @root_dir <add> when String, Pathname <add> @root_dir = path.to_s <add> else <add> raise TypeError, "Service#root_dir expects a String" <add> end <add> end <add> <add> sig { params(path: T.nilable(T.any(String, Pathname))).returns(T.nilable(String)) } <add> def input_path(path = nil) <add> case T.unsafe(path) <add> when nil <add> @input_path <add> when String, Pathname <add> @input_path = path.to_s <add> else <add> raise TypeError, "Service#input_path expects a String" <add> end <add> end <add> <ide> sig { params(path: T.nilable(T.any(String, Pathname))).returns(T.nilable(String)) } <ide> def log_path(path = nil) <ide> case T.unsafe(path) <ide> def keep_alive(value = nil) <ide> end <ide> end <ide> <add> sig { params(value: T.nilable(Integer)).returns(T.nilable(Integer)) } <add> def restart_delay(value = nil) <add> case T.unsafe(value) <add> when nil <add> @restart_delay <add> when Integer <add> @restart_delay = value <add> else <add> raise TypeError, "Service#restart_delay expects an Integer" <add> end <add> end <add> <ide> sig { params(type: T.nilable(T.any(String, Symbol))).returns(T.nilable(String)) } <ide> def run_type(type = nil) <ide> case T.unsafe(type) <ide> def environment_variables(variables = {}) <ide> end <ide> end <ide> <add> sig { params(value: T.nilable(T::Boolean)).returns(T.nilable(T::Boolean)) } <add> def macos_legacy_timers(value = nil) <add> case T.unsafe(value) <add> when nil <add> @macos_legacy_timers <add> when true, false <add> @macos_legacy_timers = value <add> else <add> raise TypeError, "Service#macos_legacy_timers expects a Boolean" <add> end <add> end <add> <ide> delegate [:bin, :etc, :libexec, :opt_bin, :opt_libexec, :opt_pkgshare, :opt_prefix, :opt_sbin, :var] => :@formula <ide> <ide> sig { returns(String) } <ide> def to_plist <ide> } <ide> <ide> base[:KeepAlive] = @keep_alive if @keep_alive == true <add> base[:LegacyTimers] = @macos_legacy_timers if @macos_legacy_timers == true <add> base[:TimeOut] = @restart_delay if @restart_delay.present? <ide> base[:WorkingDirectory] = @working_dir if @working_dir.present? <add> base[:RootDirectory] = @root_dir if @root_dir.present? <add> base[:StandardInPath] = @input_path if @input_path.present? <ide> base[:StandardOutPath] = @log_path if @log_path.present? <ide> base[:StandardErrorPath] = @error_log_path if @error_log_path.present? <ide> base[:EnvironmentVariables] = @environment_variables unless @environment_variables.empty? <ide> def to_systemd_unit <ide> <ide> options = [] <ide> options << "Restart=always" if @keep_alive == true <add> options << "RestartSec=#{restart_delay}" if @restart_delay.present? <ide> options << "WorkingDirectory=#{@working_dir}" if @working_dir.present? <add> options << "RootDirectory=#{@root_dir}" if @root_dir.present? <add> options << "StandardInput=file:#{@input_path}" if @input_path.present? <ide> options << "StandardOutput=append:#{@log_path}" if @log_path.present? <ide> options << "StandardError=append:#{@error_log_path}" if @error_log_path.present? <ide> if @environment_variables.present? <ide><path>Library/Homebrew/test/service_spec.rb <ide> environment_variables PATH: std_service_path_env <ide> error_log_path var/"log/beanstalkd.error.log" <ide> log_path var/"log/beanstalkd.log" <add> input_path var/"in/beanstalkd" <add> root_dir var <ide> working_dir var <ide> keep_alive true <add> restart_delay 30 <add> macos_legacy_timers true <ide> end <ide> <ide> plist = f.service.to_plist <ide> \t<true/> <ide> \t<key>Label</key> <ide> \t<string>homebrew.mxcl.formula_name</string> <add> \t<key>LegacyTimers</key> <add> \t<true/> <ide> \t<key>ProgramArguments</key> <ide> \t<array> <ide> \t\t<string>#{HOMEBREW_PREFIX}/opt/formula_name/bin/beanstalkd</string> <ide> \t\t<string>test</string> <ide> \t</array> <add> \t<key>RootDirectory</key> <add> \t<string>#{HOMEBREW_PREFIX}/var</string> <ide> \t<key>RunAtLoad</key> <ide> \t<true/> <ide> \t<key>StandardErrorPath</key> <ide> \t<string>#{HOMEBREW_PREFIX}/var/log/beanstalkd.error.log</string> <add> \t<key>StandardInPath</key> <add> \t<string>#{HOMEBREW_PREFIX}/var/in/beanstalkd</string> <ide> \t<key>StandardOutPath</key> <ide> \t<string>#{HOMEBREW_PREFIX}/var/log/beanstalkd.log</string> <add> \t<key>TimeOut</key> <add> \t<integer>30</integer> <ide> \t<key>WorkingDirectory</key> <ide> \t<string>#{HOMEBREW_PREFIX}/var</string> <ide> </dict> <ide> environment_variables PATH: std_service_path_env <ide> error_log_path var/"log/beanstalkd.error.log" <ide> log_path var/"log/beanstalkd.log" <add> input_path var/"in/beanstalkd" <add> root_dir var <ide> working_dir var <ide> keep_alive true <add> restart_delay 30 <add> macos_legacy_timers true <ide> end <ide> <ide> unit = f.service.to_systemd_unit <ide> Type=simple <ide> ExecStart=#{HOMEBREW_PREFIX}/opt/#{name}/bin/beanstalkd test <ide> Restart=always <add> RestartSec=30 <ide> WorkingDirectory=#{HOMEBREW_PREFIX}/var <add> RootDirectory=#{HOMEBREW_PREFIX}/var <add> StandardInput=file:#{HOMEBREW_PREFIX}/var/in/beanstalkd <ide> StandardOutput=append:#{HOMEBREW_PREFIX}/var/log/beanstalkd.log <ide> StandardError=append:#{HOMEBREW_PREFIX}/var/log/beanstalkd.error.log <ide> Environment=\"PATH=#{std_path}\"
2
Python
Python
add test for
87f7ec34d503c3cde11570ce5b4ebb961dbb37fe
<ide><path>spacy/tests/regression/test_issue3880.py <add># coding: utf8 <add>from __future__ import unicode_literals <add>from spacy.lang.en import English <add>import pytest <add> <add> <add>@pytest.mark.xfail <add>def test_issue3880(): <add> """Test that `nlp.pipe()` works when an empty string ends the batch. <add> <add> Fixed in v7.0.5 of Thinc. <add> """ <add> texts = ["hello", "world", "", ""] <add> nlp = English() <add> nlp.add_pipe(nlp.create_pipe("parser")) <add> nlp.add_pipe(nlp.create_pipe("ner")) <add> nlp.add_pipe(nlp.create_pipe("tagger")) <add> nlp.get_pipe("parser").add_label("dep") <add> nlp.get_pipe("ner").add_label("PERSON") <add> nlp.get_pipe("tagger").add_label("NN") <add> nlp.begin_training() <add> for doc in nlp.pipe(texts): <add> pass
1
Text
Text
remove danbev from tsc member list
0c35fe02d3b202290ab19d2fc72e914397fdba3d
<ide><path>README.md <ide> For information about the governance of the Node.js project, see <ide> **Colin Ihrig** &lt;cjihrig@gmail.com&gt; (he/him) <ide> * [codebytere](https://github.com/codebytere) - <ide> **Shelley Vohr** &lt;shelley.vohr@gmail.com&gt; (she/her) <del>* [danbev](https://github.com/danbev) - <del>**Daniel Bevenius** &lt;daniel.bevenius@gmail.com&gt; (he/him) <ide> * [danielleadams](https://github.com/danielleadams) - <ide> **Danielle Adams** &lt;adamzdanielle@gmail.com&gt; (she/her) <ide> * [fhinkel](https://github.com/fhinkel) - <ide> For information about the governance of the Node.js project, see <ide> **Ben Noordhuis** &lt;info@bnoordhuis.nl&gt; <ide> * [chrisdickinson](https://github.com/chrisdickinson) - <ide> **Chris Dickinson** &lt;christopher.s.dickinson@gmail.com&gt; <add>* [danbev](https://github.com/danbev) - <add>**Daniel Bevenius** &lt;daniel.bevenius@gmail.com&gt; (he/him) <ide> * [evanlucas](https://github.com/evanlucas) - <ide> **Evan Lucas** &lt;evanlucas@me.com&gt; (he/him) <ide> * [Fishrock123](https://github.com/Fishrock123) -
1
Text
Text
remove lttng from tierlist
85fb533a247caae3b18eac8f5c6e6bdc2b7f7024
<ide><path>doc/contributing/diagnostic-tooling-support-tiers.md <ide> The tools are currently assigned to Tiers as follows: <ide> | Debugger | Command line Debug Client | ? | Yes | 1 | <ide> | Tracing | trace\_events (API) | No | Yes | 1 | <ide> | Tracing | trace\_gc | No | Yes | 1 | <del>| Tracing | LTTng | No | Removed? | N/A | <ide> | Tracing | Systemtap | No | Partial | ? | <ide> | Profiling | Windows Xperf | No | ? | ? | <ide> | F/P/T | appmetrics | No | No | ? |
1
PHP
PHP
add link helpers
0051c0fa2174b8c1ac51e44f224725474cb1c0e8
<ide><path>src/Illuminate/Support/helpers.php <ide> function head($array) <ide> } <ide> } <ide> <add>if ( ! function_exists('link_to')) <add>{ <add> /** <add> * Generate a HTML link. <add> * <add> * @param string $url <add> * @param string $title <add> * @param array $attributes <add> * @param bool $secure <add> * @return string <add> */ <add> function link_to($url, $title = null, $attributes = array(), $secure = null) <add> { <add> $app = app(); <add> <add> return $app['html']->link($url, $title, $attributes, $secure); <add> } <add>} <add> <add>if ( ! function_exists('link_to_asset')) <add>{ <add> /** <add> * Generate a HTML link to an asset. <add> * <add> * @param string $url <add> * @param string $title <add> * @param array $attributes <add> * @param bool $secure <add> * @return string <add> */ <add> function link_to_asset($url, $title = null, $attributes = array(), $secure = null) <add> { <add> $app = app(); <add> <add> return $app['html']->linkToAsset($url, $title, $attributes, $secure); <add> } <add>} <add> <add>if ( ! function_exists('link_to_route')) <add>{ <add> /** <add> * Generate a HTML link to a named route. <add> * <add> * @param string $name <add> * @param string $title <add> * @param array $parameters <add> * @param array $attributes <add> * @return string <add> */ <add> function link_to_route($name, $title = null, $parameters = array(), $attributes = array()) <add> { <add> $app = app(); <add> <add> return $app['html']->linkToRoute($name, $title, $parameters, $attributes); <add> } <add>} <add> <add>if ( ! function_exists('link_to_action')) <add>{ <add> /** <add> * Generate a HTML link to a controller action. <add> * <add> * @param string $action <add> * @param string $title <add> * @param array $parameters <add> * @param array $attributes <add> * @return string <add> */ <add> function link_to_action($action, $title = null, $parameters = array(), $attributes = array()) <add> { <add> $app = app(); <add> <add> return $app['html']->linkToAction($action, $title, $parameters, $attributes); <add> } <add>} <add> <ide> if ( ! function_exists('public_path')) <ide> { <ide> /**
1
Text
Text
remove unnecessary space
411394313e8d063baffdea5faafb883240a83bb7
<ide><path>docs/style-guide/style-guide.md <ide> Use of static typing does make this kind of code safer and somewhat more accepta <ide> <ide> ### Name State Slices Based On the Stored Data <ide> <del>As mentioned in [Reducers Should Own the State Shape ](#reducers-should-own-the-state-shape), the standard approach for splitting reducer logic is based on "slices" of state. Correspondingly, `combineReducers` is the standard function for joining those slice reducers into a larger reducer function. <add>As mentioned in [Reducers Should Own the State Shape](#reducers-should-own-the-state-shape), the standard approach for splitting reducer logic is based on "slices" of state. Correspondingly, `combineReducers` is the standard function for joining those slice reducers into a larger reducer function. <ide> <ide> The key names in the object passed to `combineReducers` will define the names of the keys in the resulting state object. Be sure to name these keys after the data that is kept inside, and avoid use of the word "reducer" in the key names. Your object should look like `{users: {}, posts: {}}`, rather than `{usersReducer: {}, postsReducer: {}}`. <ide>
1
Python
Python
remove reference to python 2
7da70ce023d9e5b1dcd3f71a782f12c080b1c590
<ide><path>numpy/distutils/command/config.py <ide> def _check_compiler (self): <ide> # XXX: hack to circumvent a python 2.6 bug with msvc9compiler: <ide> # initialize call query_vcvarsall, which throws an IOError, and <ide> # causes an error along the way without much information. We try to <del> # catch it here, hoping it is early enough, and print an helpful <add> # catch it here, hoping it is early enough, and print a helpful <ide> # message instead of Error: None. <ide> if not self.compiler.initialized: <ide> try: <ide> def _check_compiler (self): <ide> Could not initialize compiler instance: do you have Visual Studio <ide> installed? If you are trying to build with MinGW, please use "python setup.py <ide> build -c mingw32" instead. If you have Visual Studio installed, check it is <del> correctly installed, and the right version (VS 2008 for python 2.6, 2.7 and 3.2, <del> VS 2010 for >= 3.3). <add> correctly installed, and the right version (VS 2015 as of this writing). <ide> <ide> Original exception was: %s, and the Compiler class was %s <ide> ============================================================================""") \
1
Text
Text
add french translation
98388fcc43b1e2eb9bd17ab352e85331f33e0a15
<ide><path>threejs/lessons/fr/threejs-scenegraph.md <ide> Cet article fait partie d'une série consacrée à Three.js. <ide> Le premier article s'intitule [Principes de base](threejs-fundamentals.html). <ide> Si vous ne l'avez pas encore lu, vous voudriez peut-être commencer par là. <ide> <del>Le coeurs de Three.js est sans aucun doute son objet scène. Une scène est une représentation arborescente des objets que l’on souhaite afficher, où chaque nœud représente un espace local. <add>Le coeurs de Three.js est sans aucun doute son graphique de scène. Une scène est une représentation arborescente des objets que l’on souhaite afficher, où chaque nœud représente un espace local. <ide> <ide> <img src="resources/images/scenegraph-generic.svg" align="center"> <ide> <ide> objects.push(earthMesh); <ide> +moonOrbit.add(moonMesh); <ide> +objects.push(moonMesh); <ide> ``` <del>XXXXXXXXXXXXXXXX <ide> <del> <del>Again we added more invisible scene graph nodes. The first, an `Object3D` called `earthOrbit` <del>and added both the `earthMesh` and the `moonOrbit` to it, also new. We then added the `moonMesh` <del>to the `moonOrbit`. The new scene graph looks like this. <add>Ajoutons à nouveau d'autres noeuds à notre scène. D'abord, un `Object3D` appelé `earthOrbit` <add>ensuite ajoutons-lui un `earthMesh` et un `moonOrbit`. Finalement, ajoutons un `moonMesh` <add>au `moonOrbit`. Notre scène devrait ressembler à ceci : <ide> <ide> <img src="resources/images/scenegraph-sun-earth-moon.svg" align="center"> <ide> <del>and here's that <add>et à ça : <ide> <ide> {{{example url="../threejs-scenegraph-sun-earth-moon.html" }}} <ide> <del>You can see the moon follows the spirograph pattern shown at the top <del>of this article but we didn't have to manually compute it. We just <del>setup our scene graph to do it for us. <add>Vous pouvez voir que la lune suit le modèle de spirographe indiqué en haut de cet article, mais nous n'avons pas eu à le calculer manuellement. Nous venons de configurer notre graphe de scène pour le faire pour nous. <ide> <del>It is often useful to draw something to visualize the nodes in the scene graph. <del>Three.js has some helpful ummmm, helpers to ummm, ... help with this. <add>Il est souvent utile de dessiner quelque chose pour visualiser les nœuds dans le graphe de scène. <add>Three.js dispose pour cela de Helpers. <ide> <del>One is called an `AxesHelper`. It draws 3 lines representing the local <add>L'un d'entre eux s'appelle `AxesHelper`. Il dessine trois lignes représentant les axes <ide> <span style="color:red">X</span>, <del><span style="color:green">Y</span>, and <del><span style="color:blue">Z</span> axes. Let's add one to every node we <del>created. <add><span style="color:green">Y</span>, et <add><span style="color:blue">Z</span>. Ajoutons-en un à chacun de nos noeuds. <ide> <ide> ```js <ide> // add an AxesHelper to each node <ide> objects.forEach((node) => { <ide> }); <ide> ``` <ide> <del>On our case we want the axes to appear even though they are inside the spheres. <del>To do this we set their material's `depthTest` to false which means they will <del>not check to see if they are drawing behind something else. We also <del>set their `renderOrder` to 1 (the default is 0) so that they get drawn after <del>all the spheres. Otherwise a sphere might draw over them and cover them up. <add>Dans notre cas, nous voulons que les axes apparaissent même s'ils sont à l'intérieur des sphères. <add>Pour cela, nous définissons le `depthTest` de material à false, pour ne pas vérifier s'ils dessinent derrière quelque chose. Nous définissons également leur `renderOrder` sur 1 (la valeur par défaut est 0) afin qu'ils soient dessinés après toutes les sphères. Sinon, une sphère pourrait les recouvrir et les recouvrir. <ide> <ide> {{{example url="../threejs-scenegraph-sun-earth-moon-axes.html" }}} <ide> <del>We can see the <del><span style="color:red">x (red)</span> and <del><span style="color:blue">z (blue)</span> axes. Since we are looking <del>straight down and each of our objects is only rotating around its <del>y axis we don't see much of the <span style="color:green">y (green)</span> axes. <add>Vous pouvez voir les axes <add><span style="color:red">x (rouge)</span> et <add><span style="color:blue">z (bleu)</span>. Comme nous regardons vers le bas et que chacun de nos objets tourne autour de son axe y, nous ne voyons pas bien l'axe <span style="color:green">y (verte)</span>. <ide> <del>It might be hard to see some of them as there are 2 pairs of overlapping axes. Both the `sunMesh` <del>and the `solarSystem` are at the same position. Similarly the `earthMesh` and <del>`earthOrbit` are at the same position. Let's add some simple controls to allow us <del>to turn them on/off for each node. <del>While we're at it let's also add another helper called the `GridHelper`. It <del>makes a 2D grid on the X,Z plane. By default the grid is 10x10 units. <add>Il peut être difficile de voir certains d'entre eux car il y a 2 paires d'axes qui se chevauchent. Le `sunMesh` et le `solarSystem` sont tous les deux à la même position. De même, `earthMesh` et `earthOrbit` sont à la même position. Ajoutons quelques contrôles simples pour nous permettre de les activer/désactiver pour chaque nœud. Pendant que nous y sommes, ajoutons également un autre assistant appelé `GridHelper`. Il crée une grille 2D sur le plan X,Z. Par défaut, la grille est de 10x10 unités. <ide> <del>We're also going to use [dat.GUI](https://github.com/dataarts/dat.gui) which is <del>a UI library that is very popular with three.js projects. dat.GUI takes an <del>object and a property name on that object and based on the type of the property <del>automatically makes a UI to manipulate that property. <add>Nous allons également utiliser [dat.GUI](https://github.com/dataarts/dat.gui), une librairie d'interface utilisateur très populaire pour les projets Three.js. dat.GUI prend un objet et un nom de propriété sur cet objet et, en fonction du type de la propriété, crée automatiquement une interface utilisateur pour manipuler cette propriété. <ide> <del>We want to make both a `GridHelper` and an `AxesHelper` for each node. We need <del>a label for each node so we'll get rid of the old loop and switch to calling <del>some function to add the helpers for each node <add>Nous voulons créer à la fois un `GridHelper` et un `AxesHelper` pour chaque nœud. Nous avons besoin d'un label pour chaque nœud, nous allons donc nous débarrasser de l'ancienne boucle et faire appel à une fonction pour ajouter les helpers pour chaque nœud. <ide> <ide> ```js <ide> -// add an AxesHelper to each node <ide> some function to add the helpers for each node <ide> +makeAxisGrid(moonOrbit, 'moonOrbit'); <ide> +makeAxisGrid(moonMesh, 'moonMesh'); <ide> ``` <del> <del>`makeAxisGrid` makes an `AxisGridHelper` which is a class we'll create <del>to make dat.GUI happy. Like it says above dat.GUI <del>will automagically make a UI that manipulates the named property <del>of some object. It will create a different UI depending on the type <del>of property. We want it to create a checkbox so we need to specify <del>a `bool` property. But, we want both the axes and the grid <del>to appear/disappear based on a single property so we'll make a class <del>that has a getter and setter for a property. That way we can let dat.GUI <del>think it's manipulating a single property but internally we can set <del>the visible property of both the `AxesHelper` and `GridHelper` for a node. <add>`makeAxisGrid` crée un `AxisGridHelper` qui est une classe que nous allons créer pour rendre dat.GUI heureux. Comme il est dit ci-dessus, dat.GUI créera automatiquement une interface utilisateur qui manipule la propriété nommée d'un objet. Cela créera une interface utilisateur différente selon le type de propriété. Nous voulons qu'il crée une case à cocher, nous devons donc spécifier une propriété bool. Mais, nous voulons que les axes et la grille apparaissent/disparaissent en fonction d'une seule propriété, nous allons donc créer une classe qui a un getter et un setter pour une propriété. De cette façon, nous pouvons laisser dat.GUI penser qu'il manipule une seule propriété, mais en interne, nous pouvons définir la propriété visible de `AxesHelper` et `GridHelper` pour un nœud. <ide> <ide> ```js <del>// Turns both axes and grid visible on/off <del>// dat.GUI requires a property that returns a bool <del>// to decide to make a checkbox so we make a setter <del>// and getter for `visible` which we can tell dat.GUI <del>// to look at. <add>// Activer/désactiver les axes et la grille dat.GUI <add>// nécessite une propriété qui renvoie un bool <add>// pour décider de faire une case à cocher <add>// afin que nous créions un setter et un getter pour `visible` <add>// que nous pouvons dire à dat.GUI de regarder. <ide> class AxisGridHelper { <ide> constructor(node, units = 10) { <ide> const axes = new THREE.AxesHelper(); <ide> class AxisGridHelper { <ide> } <ide> ``` <ide> <del>One thing to notice is we set the `renderOrder` of the `AxesHelper` <del>to 2 and for the `GridHelper` to 1 so that the axes get drawn after the grid. <del>Otherwise the grid might overwrite the axes. <add>Une chose à noter est que nous définissons le `renderOrder` de l'`AxesHelper` sur 2 et pour le `GridHelper` sur 1 afin que les axes soient dessinés après la grille. Sinon, la grille pourrait écraser les axes. <ide> <ide> {{{example url="../threejs-scenegraph-sun-earth-moon-axes-grids.html" }}} <ide> <del>Turn on the `solarSystem` and you'll see how the earth is exactly 10 <del>units out from the center just like we set above. You can see how the <del>earth is in the *local space* of the `solarSystem`. Similarly if you <del>turn on the `earthOrbit` you'll see how the moon is exactly 2 units <del>from the center of the *local space* of the `earthOrbit`. <add>Cliquez sur `solarSystem` et vous verrez que la terre est exactement à 10 unités du centre, comme nous l'avons défini ci-dessus. Vous pouvez voir que la terre est dans l'espace local du `solarSystem`. De même, si vous cliquez sur `earthOrbit`, vous verrez que la lune est exactement à 2 unités du centre de *l'espace local* de `earthOrbit`. <ide> <del>A few more examples of scene graphs. An automobile in a simple game world might have a scene graph like this <add>Un autre exemple de scène. Une automobile dans un jeu simple pourrait avoir un graphique de scène comme celui-ci <ide> <ide> <img src="resources/images/scenegraph-car.svg" align="center"> <ide> <del>If you move the car's body all the wheels will move with it. If you wanted the body <del>to bounce separate from the wheels you might parent the body and the wheels to a "frame" node <del>that represents the car's frame. <add>Si vous déplacez la carrosserie de la voiture, toutes les roues bougeront avec elle. Si vous vouliez que le corps rebondisse séparément des roues, vous pouvez lier le corps et les roues à un nœud "cadre" qui représente le cadre de la voiture. <ide> <del>Another example is a human in a game world. <add>Un autre exemple avec un humain dans un jeu vidéo. <ide> <ide> <img src="resources/images/scenegraph-human.svg" align="center"> <ide> <del>You can see the scene graph gets pretty complex for a human. In fact <del>that scene graph above is simplified. For example you might extend it <del>to cover every finger (at least another 28 nodes) and every toe <del>(yet another 28 nodes) plus ones for the face and jaw, the eyes and maybe more. <add>Vous pouvez voir que le graphique de la scène devient assez complexe pour un humain. En fait, le graphe ci-dessus est simplifié. Par exemple, vous pouvez l'étendre pour couvrir chaque doigt (au moins 28 autres nœuds) et chaque orteil (encore 28 nœuds) plus ceux pour le visage et la mâchoire, les yeux et peut-être plus. <add> <add>Faisons un graphe semi-complexe. On va faire un char. Il aura 6 roues et une tourelle. Il pourra suivre un chemin. Il y aura une sphère qui se déplacera et le char ciblera la sphère. <ide> <ide> Let's make one semi-complex scene graph. We'll make a tank. The tank will have <ide> 6 wheels and a turret. The tank will follow a path. There will be a sphere that <ide> moves around and the tank will target the sphere. <ide> <del>Here's the scene graph. The meshes are colored in green, the `Object3D`s in blue, <del>the lights in gold, and the cameras in purple. One camera has not been added <del>to the scene graph. <add>Voici le graphique de la scène. Les maillages sont colorés en vert, les `Object3D` en bleu, les lumières en or et les caméras en violet. Une caméra n'a pas été ajoutée au graphique de la scène. <ide> <ide> <div class="threejs_center"><img src="resources/images/scenegraph-tank.svg" style="width: 800px;"></div> <ide> <del>Look in the code to see the setup of all of these nodes. <add>Regardez dans le code pour voir la configuration de tous ces nœuds. <ide> <del>For the target, the thing the tank is aiming at, there is a `targetOrbit` <del>(`Object3D`) which just rotates similar to the `earthOrbit` above. A <del>`targetElevation` (`Object3D`) which is a child of the `targetOrbit` provides an <del>offset from the `targetOrbit` and a base elevation. Childed to that is another <del>`Object3D` called `targetBob` which just bobs up and down relative to the <del>`targetElevation`. Finally there's the `targetMesh` which is just a cube we <del>rotate and change its colors <add>Pour la cible, la chose que le char vise, il y a une `targetOrbit` (Object3D) qui tourne juste de la même manière que la `earthOrbit` ci-dessus. Une `targetElevation` (Object3D) qui est un enfant de `targetOrbit` fournit un décalage par rapport à `targetOrbit` et une élévation de base. Un autre `Object3D` appelé `targetBob` qui monte et descend par rapport à la `targetElevation`. Enfin, il y a le `targetMesh` qui est juste un cube que nous faisons pivoter et changeons ses couleurs. <ide> <ide> ```js <del>// move target <add>// mettre en mouvement la cible <ide> targetOrbit.rotation.y = time * .27; <ide> targetBob.position.y = Math.sin(time * 2) * 4; <ide> targetMesh.rotation.x = time * 7; <ide> targetMaterial.emissive.setHSL(time * 10 % 1, 1, .25); <ide> targetMaterial.color.setHSL(time * 10 % 1, 1, .25); <ide> ``` <ide> <del>For the tank there's an `Object3D` called `tank` which is used to move everything <del>below it around. The code uses a `SplineCurve` which it can ask for positions <del>along that curve. 0.0 is the start of the curve. 1.0 is the end of the curve. It <del>asks for the current position where it puts the tank. It then asks for a <del>position slightly further down the curve and uses that to point the tank in that <del>direction using `Object3D.lookAt`. <add>Pour le char, il y a un `Object3D` appelé `tank` qui est utilisé pour déplacer tout ce qui se trouve en dessous. Le code utilise une `SplineCurve` à laquelle il peut demander des positions le long de cette courbe. 0.0 est le début de la courbe. 1,0 est la fin de la courbe. Il demande la position actuelle où il met le réservoir. Il demande ensuite une position légèrement plus bas dans la courbe et l'utilise pour pointer le réservoir dans cette direction à l'aide de `Object3D.lookAt`. <ide> <ide> ```js <ide> const tankPosition = new THREE.Vector2(); <ide> const tankTarget = new THREE.Vector2(); <ide> <ide> ... <ide> <del>// move tank <add>// mettre en mouvement le char <ide> const tankTime = time * .05; <ide> curve.getPointAt(tankTime % 1, tankPosition); <ide> curve.getPointAt((tankTime + 0.01) % 1, tankTarget); <ide> tank.position.set(tankPosition.x, 0, tankPosition.y); <ide> tank.lookAt(tankTarget.x, 0, tankTarget.y); <ide> ``` <ide> <del>The turret on top of the tank is moved automatically by being a child <del>of the tank. To point it at the target we just ask for the target's world position <del>and then again use `Object3D.lookAt` <add>La tourelle sur le dessus du char est déplacée automatiquement en tant qu'enfant du char. Pour le pointer sur la cible, nous demandons simplement la position de la cible, puis utilisons à nouveau `Object3D.lookAt`. <ide> <ide> ```js <ide> const targetPosition = new THREE.Vector3(); <ide> <ide> ... <ide> <del>// face turret at target <add>// tourelle face à la cible <ide> targetMesh.getWorldPosition(targetPosition); <ide> turretPivot.lookAt(targetPosition); <ide> ``` <del> <del>There's a `turretCamera` which is a child of the `turretMesh` so <del>it will move up and down and rotate with the turret. We make that <del>aim at the target. <add>Il y a une `tourretCamera` qui est un enfant de `turretMesh` donc il se déplacera de haut en bas et tournera avec la tourelle. On la fait viser la cible. <ide> <ide> ```js <del>// make the turretCamera look at target <add>// la turretCamera regarde la cible <ide> turretCamera.lookAt(targetPosition); <ide> ``` <del> <del>There is also a `targetCameraPivot` which is a child of `targetBob` so it floats <del>around with the target. We aim that back at the tank. Its purpose is to allow the <del>`targetCamera` to be offset from the target itself. If we instead made the camera <del>a child of `targetBob` and just aimed the camera itself it would be inside the <del>target. <add>Il y a aussi un `targetCameraPivot` qui est un enfant de `targetBob` donc il flotte <add>autour de la cible. Nous le pointons vers le char. Son but est de permettre à la <add>`targetCamera` d'être décalé par rapport à la cible elle-même. Si nous faisions de la caméra <add>un enfant de `targetBob`, elle serait à l'intérieur de la cible. <ide> <ide> ```js <del>// make the targetCameraPivot look at the tank <add>// faire en sorte que la cibleCameraPivot regarde le char <ide> tank.getWorldPosition(targetPosition); <ide> targetCameraPivot.lookAt(targetPosition); <ide> ``` <ide> <del>Finally we rotate all the wheels <add>Enfin on fait tourner toutes les roues <ide> <ide> ```js <ide> wheelMeshes.forEach((obj) => { <ide> obj.rotation.x = time * 3; <ide> }); <ide> ``` <ide> <del>For the cameras we setup an array of all 4 cameras at init time with descriptions. <add>Pour les caméras, nous avons configuré un ensemble de 4 caméras au moment de l'initialisation avec des descriptions. <ide> <ide> ```js <ide> const cameras = [ <ide> const cameras = [ <ide> const infoElem = document.querySelector('#info'); <ide> ``` <ide> <del>and cycle through our cameras at render time. <add>et nous parcourons chaque camera au moment du rendu <ide> <ide> ```js <ide> const camera = cameras[time * .25 % cameras.length | 0]; <ide> infoElem.textContent = camera.desc; <ide> <ide> {{{example url="../threejs-scenegraph-tank.html"}}} <ide> <del>I hope this gives some idea of how scene graphs work and how you might use them. <del>Making `Object3D` nodes and parenting things to them is an important step to using <del>a 3D engine like three.js well. Often it might seem like some complex math is necessary <del>to make something move and rotate the way you want. For example without a scene graph <del>computing the motion of the moon or where to put the wheels of the car relative to its <del>body would be very complicated but using a scene graph it becomes much easier. <add>J'espère que cela donne une idée du fonctionnement des graphiques de scène et de la façon dont vous pouvez les utiliser. <add>Faire des nœuds « Object3D » et leur attacher des choses est une étape importante pour utiliser <add>un moteur 3D comme Three.js bien. Souvent, on pourrait penser que des mathématiques complexes soient nécessaires <add>pour faire bouger quelque chose et faire pivoter comme vous le souhaitez. Par exemple sans graphique de scène <add>calculer le mouvement de la lune, savoir où placer les roues de la voiture par rapport à son <add>corps serait très compliqué, mais en utilisant un graphique de scène, cela devient beaucoup plus facile. <ide> <del>[Next up we'll go over materials](threejs-materials.html). <add>[Passons maintenant en revue les materials](threejs-materials.html).
1
Python
Python
adjust test for listfield(integerfield)
f8f8b3a1f1c1463d1836dc2e9f6614460d03fed4
<ide><path>tests/schemas/test_openapi.py <ide> def test_list_field_mapping(self): <ide> (serializers.ListField(child=serializers.FloatField()), {'items': {'type': 'number'}, 'type': 'array'}), <ide> (serializers.ListField(child=serializers.CharField()), {'items': {'type': 'string'}, 'type': 'array'}), <ide> (serializers.ListField(child=serializers.IntegerField(max_value=4294967295)), <del> {'items': {'type': 'integer', 'format': 'int64'}, 'type': 'array'}), <add> {'items': {'type': 'integer', 'maximum': 4294967295, 'format': 'int64'}, 'type': 'array'}), <ide> (serializers.ListField(child=serializers.ChoiceField(choices=[('a', 'Choice A'), ('b', 'Choice B')])), <ide> {'items': {'enum': ['a', 'b']}, 'type': 'array'}), <ide> (serializers.IntegerField(min_value=2147483648),
1
Java
Java
introduce failing test for spr-16652
4b9e3a9211b9c81148b2c2ebd54091a1fa037483
<ide><path>spring-core/src/test/java/org/springframework/core/MethodParameterTests.java <ide> /* <del> * Copyright 2002-2016 the original author or authors. <add> * Copyright 2002-2018 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> <ide> package org.springframework.core; <ide> <add>import java.lang.annotation.ElementType; <add>import java.lang.annotation.Retention; <add>import java.lang.annotation.RetentionPolicy; <add>import java.lang.annotation.Target; <add>import java.lang.reflect.Constructor; <ide> import java.lang.reflect.Method; <ide> <ide> import org.junit.Before; <add>import org.junit.Ignore; <ide> import org.junit.Test; <ide> <ide> import static org.junit.Assert.*; <ide> <ide> /** <ide> * @author Arjen Poutsma <ide> * @author Juergen Hoeller <add> * @author Sam Brannen <ide> */ <ide> public class MethodParameterTests { <ide> <ide> public void testIndexValidation() { <ide> new MethodParameter(method, 2); <ide> } <ide> <add> @Test <add> public void annotatedConstructorParameterInStaticNestedClass() throws Exception { <add> Constructor<?> constructor = NestedClass.class.getDeclaredConstructor(String.class); <add> MethodParameter methodParameter = MethodParameter.forExecutable(constructor, 0); <add> assertEquals(String.class, methodParameter.getParameterType()); <add> assertNotNull("Failed to find @Param annotation", methodParameter.getParameterAnnotation(Param.class)); <add> assertNotNull(methodParameter.getParameterAnnotation(Param.class)); <add> } <add> <add> @Test <add> @Ignore("Disabled until SPR-16652 is resolved") <add> public void annotatedConstructorParameterInInnerClass() throws Exception { <add> Constructor<?> constructor = InnerClass.class.getDeclaredConstructor(getClass(), String.class); <add> MethodParameter methodParameter = MethodParameter.forExecutable(constructor, 1); <add> assertEquals(String.class, methodParameter.getParameterType()); <add> assertNull(methodParameter.getParameterAnnotation(Override.class)); <add> // The following assertion currently fails if this test class is compiled using JDK 8. <add> assertNotNull("Failed to find @Param annotation", methodParameter.getParameterAnnotation(Param.class)); <add> } <add> <ide> <ide> public int method(String p1, long p2) { <ide> return 42; <ide> } <ide> <add> @SuppressWarnings("unused") <add> private static class NestedClass { <add> <add> NestedClass(@Param String s) { <add> } <add> } <add> <add> @SuppressWarnings("unused") <add> private class InnerClass { <add> <add> InnerClass(@Param String s) { <add> } <add> } <add> <add> @Retention(RetentionPolicy.RUNTIME) <add> @Target(ElementType.PARAMETER) <add> private @interface Param { <add> } <add> <ide> }
1
Ruby
Ruby
convert coffeescript to es6 syntax
801716395ccc4b436613c08cd4cfd68a2eb87102
<ide><path>actioncable/lib/action_cable/helpers/action_cable_helper.rb <ide> module ActionCableHelper <ide> # </head> <ide> # <ide> # This is then used by Action Cable to determine the URL of your WebSocket server. <del> # Your CoffeeScript can then connect to the server without needing to specify the <add> # Your JavaScript can then connect to the server without needing to specify the <ide> # URL directly: <ide> # <del> # #= require cable <del> # @App = {} <add> # window.Cable = require("@rails/actioncable") <add> # window.App = {} <ide> # App.cable = Cable.createConsumer() <ide> # <ide> # Make sure to specify the correct server location in each of your environment
1
Python
Python
remove print statement
1277abcde2782e4a5b3a6d856f304c57fa8c6b6e
<ide><path>spacy/cli/link.py <ide> <ide> <ide> def link(origin, link_name, force=False): <del> print("Linking", origin, link_name) <ide> if is_package(origin): <ide> link_package(origin, link_name, force) <ide> else:
1
Javascript
Javascript
prevent usage of array index in keys
36d4a969dd2e1ecf75166b24b6b0af3f7a70e71f
<ide><path>Libraries/NewAppScreen/components/LearnMoreLinks.js <ide> import React from 'react'; <ide> <ide> const links = [ <ide> { <add> id: 1, <ide> title: 'The Basics', <ide> link: 'https://facebook.github.io/react-native/docs/tutorial', <ide> description: 'Explains a Hello World for React Native.', <ide> }, <ide> { <add> id: 2, <ide> title: 'Style', <ide> link: 'https://facebook.github.io/react-native/docs/style', <ide> description: <ide> 'Covers how to use the prop named style which controls the visuals.', <ide> }, <ide> { <add> id: 3, <ide> title: 'Layout', <ide> link: 'https://facebook.github.io/react-native/docs/flexbox', <ide> description: 'React Native uses flexbox for layout, learn how it works.', <ide> }, <ide> { <add> id: 4, <ide> title: 'Components', <ide> link: 'https://facebook.github.io/react-native/docs/components-and-apis', <ide> description: 'The full list of components and APIs inside React Native.', <ide> }, <ide> { <add> id: 5, <ide> title: 'Navigation', <ide> link: 'https://facebook.github.io/react-native/docs/navigation', <ide> description: <ide> 'How to handle moving between screens inside your application.', <ide> }, <ide> { <add> id: 6, <ide> title: 'Networking', <ide> link: 'https://facebook.github.io/react-native/docs/network', <ide> description: 'How to use the Fetch API in React Native.', <ide> }, <ide> { <add> id: 7, <ide> title: 'Help', <ide> link: 'https://facebook.github.io/react-native/help', <ide> description: <ide> 'Need more help? There are many other React Native developers who may have the answer.', <ide> }, <ide> { <add> id: 8, <ide> title: 'Follow us on Twitter', <ide> link: 'https://twitter.com/reactnative', <ide> description: <ide> const links = [ <ide> <ide> const LinkList = (): Node => ( <ide> <View style={styles.container}> <del> {links.map((item, index) => { <add> {links.map(({id, title, link, description}) => { <ide> return ( <del> <React.Fragment key={index}> <add> <React.Fragment key={id}> <ide> <View style={styles.separator} /> <ide> <TouchableOpacity <ide> accessibilityRole={'button'} <del> onPress={() => openURLInBrowser(item.link)} <add> onPress={() => openURLInBrowser(link)} <ide> style={styles.linkContainer}> <del> <Text style={styles.link}>{item.title}</Text> <del> <Text style={styles.description}>{item.description}</Text> <add> <Text style={styles.link}>{title}</Text> <add> <Text style={styles.description}>{description}</Text> <ide> </TouchableOpacity> <ide> </React.Fragment> <ide> );
1
Python
Python
raise custom importerror if importing janome fails
d730eb0c0df2fb6784f7adcce479c4c9588764b9
<ide><path>spacy/ja/__init__.py <ide> class Japanese(Language): <ide> lang = 'ja' <ide> <ide> def make_doc(self, text): <del> from janome.tokenizer import Tokenizer <add> try: <add> from janome.tokenizer import Tokenizer <add> except ImportError: <add> raise ImportError("The Japanese tokenizer requires the Janome library: https://github.com/mocobeta/janome") <ide> words = [x.surface for x in Tokenizer().tokenize(text)] <ide> return Doc(self.vocab, words=words, spaces=[False]*len(words))
1
Ruby
Ruby
remove obsolete code
00725d086d23fbc304d9d5bd5ddcf7e79bb358d4
<ide><path>actionpack/lib/action_controller/test_case.rb <ide> def initialize(env = {}) <ide> <ide> class Result < ::Array #:nodoc: <ide> def to_s() join '/' end <del> def self.new_escaped(strings) <del> new strings.collect {|str| uri_parser.unescape str} <del> end <ide> end <ide> <ide> def assign_parameters(routes, controller_path, action, parameters = {})
1
Python
Python
fix crash when --ml_perf flag is not specified.
48a4b44355b9b2344d6407df95f3a487e1913dd9
<ide><path>official/recommendation/ncf_main.py <ide> def define_ncf_flags(): <ide> "achieved by MLPerf implementation.")) <ide> <ide> flags.DEFINE_bool( <del> name="ml_perf", default=None, <add> name="ml_perf", default=False, <ide> help=flags_core.help_wrap( <ide> "If set, changes the behavior of the model slightly to match the " <ide> "MLPerf reference implementations here: \n"
1
Ruby
Ruby
add new methods
edf832749784a836e0a7911a3ea5eeef22f525a5
<ide><path>Library/Homebrew/keg_relocate.rb <ide> class Keg <ide> LIBRARY_PLACEHOLDER = "" <ide> PERL_PLACEHOLDER = "" <ide> JAVA_PLACEHOLDER = "" <add> BINARY_NULL_CHARACTER = "\x00" <ide> <ide> class Relocation <ide> extend T::Sig <ide> def replace_text_in_files(relocation, files: nil) <ide> changed_files <ide> end <ide> <add> def relocate_build_prefix(keg, old_prefix, new_prefix) <add> # Find binaries which match prefix strings. <add> string_matches = Set.new <add> keg.each_unique_file_matching(old_prefix) do |file| <add> string_matches << file <add> end <add> <add> binary_string_matches = Set.new <add> keg.each_unique_binary_file do |file| <add> binary_string_matches << file if string_matches.include?(file) <add> end <add> <add> # Only consider string matches which are binary files with null bytes, and remove any <add> # matches which are sharballs found by text_files. <add> binary_string_matches -= text_files <add> <add> # Split binary by null characters into array and substitute new cellar for old cellar. <add> # Null padding is added if the new string is too short. <add> binary_string_matches.each do |binary_file| <add> binary_file.ensure_writable do <add> binary = File.binread binary_file <add> puts "Replacing build prefix in: #{binary_file}" <add> binary_strings = binary.split(BINARY_NULL_CHARACTER) <add> match_indices = binary_strings.each_index.select { |i| binary_strings[i].include?(old_prefix) } <add> <add> # Only perform substitution on strings which match prefix regex. <add> match_indices.each do |i| <add> s = binary_strings[i] <add> binary_strings[i] = s.gsub(old_prefix, new_prefix).ljust(s.size, BINARY_NULL_CHARACTER) <add> end <add> <add> # Add back null padding at the end of the binary if needed. <add> patched_binary = binary_strings.join(BINARY_NULL_CHARACTER).ljust(binary.size, BINARY_NULL_CHARACTER) <add> if patched_binary.size != binary.size <add> raise "Patching failed! Original and patched binary sizes do not match." <add> end <add> <add> binary_file.atomic_write patched_binary <add> end <add> codesign_patched_binary(binary_file) <add> end <add> end <add> <ide> def detect_cxx_stdlibs(_options = {}) <ide> [] <ide> end <ide> def recursive_fgrep_args <ide> end <ide> alias generic_recursive_fgrep_args recursive_fgrep_args <ide> <add> def egrep_args <add> grep_bin = "grep" <add> grep_args = recursive_fgrep_args <add> grep_args += "Pa" <add> [grep_bin, grep_args] <add> end <add> alias generic_egrep_args egrep_args <add> <ide> def each_unique_file_matching(string) <ide> Utils.popen_read("fgrep", recursive_fgrep_args, string, to_s) do |io| <ide> hardlinks = Set.new <ide> def each_unique_file_matching(string) <ide> end <ide> end <ide> <add> def each_unique_binary_file <add> grep_bin, grep_args = egrep_args <add> <add> # An extra \ is needed for the null character when calling grep <add> Utils.popen_read(grep_bin, grep_args, "\\x00", to_s) do |io| <add> hardlinks = Set.new <add> <add> until io.eof? <add> file = Pathname.new(io.readline.chomp) <add> next if file.symlink? <add> <add> yield file if hardlinks.add? file.stat.ino <add> end <add> end <add> end <add> <add> def codesign_patched_binary(_binary_file) <add> [] <add> end <add> <ide> def lib <ide> path/"lib" <ide> end
1
Python
Python
add a flag to switch layers module
7124ed1227aa3e7a3c38cd412e63994b942f3c63
<ide><path>official/vision/image_classification/common.py <ide> def define_keras_flags(dynamic_loss_scale=True): <ide> help='Number of steps per graph-mode loop. Only training step happens ' <ide> 'inside the loop. Callbacks will not be called inside. Will be capped at ' <ide> 'steps per epoch.') <add> flags.DEFINE_boolean( <add> name='use_tf_keras_layers', default=False, <add> help='Whether to use tf.keras.layers instead of tf.python.keras.layers.' <add> 'It only changes imagenet resnet model layers for now. This flag is ' <add> 'a temporal flag during transition to tf.keras.layers. Do not use this ' <add> 'flag for external usage. this will be removed shortly.') <ide> <ide> <ide> def get_synth_data(height, width, num_channels, num_classes, dtype): <ide><path>official/vision/image_classification/resnet_ctl_imagenet_main.py <ide> def run(flags_obj): <ide> flags_obj.log_steps) <ide> <ide> with distribution_utils.get_strategy_scope(strategy): <add> resnet_model.change_keras_layer(flags_obj.use_tf_keras_layers) <ide> model = resnet_model.resnet50( <ide> num_classes=imagenet_preprocessing.NUM_CLASSES, <ide> batch_size=flags_obj.batch_size, <ide><path>official/vision/image_classification/resnet_imagenet_main.py <ide> def run(flags_obj): <ide> model = trivial_model.trivial_model( <ide> imagenet_preprocessing.NUM_CLASSES) <ide> else: <add> resnet_model.change_keras_layer(flags_obj.use_tf_keras_layers) <ide> model = resnet_model.resnet50( <ide> num_classes=imagenet_preprocessing.NUM_CLASSES) <ide> <ide><path>official/vision/image_classification/resnet_model.py <ide> from __future__ import division <ide> from __future__ import print_function <ide> <add>import tensorflow as tf <add> <ide> from tensorflow.python.keras import backend <ide> from tensorflow.python.keras import initializers <del>from tensorflow.python.keras import layers <add>from tensorflow.python.keras import layers as tf_python_keras_layers <ide> from tensorflow.python.keras import models <ide> from tensorflow.python.keras import regularizers <ide> from official.vision.image_classification import imagenet_preprocessing <ide> BATCH_NORM_DECAY = 0.9 <ide> BATCH_NORM_EPSILON = 1e-5 <ide> <add>layers = tf_python_keras_layers <add> <add> <add>def change_keras_layer(use_tf_keras_layers=False): <add> """Change layers to either tf.keras.layers or tf.python.keras.layers. <add> <add> Layer version of tf.keras.layers is depends on tensorflow version, but <add> tf.python.keras.layers checks environment variable TF2_BEHAVIOR. <add> This function is a temporal function to use tf.keras.layers. <add> Currently, tf v2 batchnorm layer is slower than tf v1 batchnorm layer. <add> this function is useful for tracking benchmark result for each version. <add> This function will be removed when we use tf.keras.layers as default. <add> <add> TODO(b/146939027): Remove this function when tf v2 batchnorm reaches training <add> speed parity with tf v1 batchnorm. <add> <add> Args: <add> use_tf_keras_layers: whether to use tf.keras.layers. <add> """ <add> global layers <add> if use_tf_keras_layers: <add> layers = tf.keras.layers <add> else: <add> layers = tf_python_keras_layers <add> <ide> <ide> def _gen_l2_regularizer(use_l2_regularizer=True): <ide> return regularizers.l2(L2_WEIGHT_DECAY) if use_l2_regularizer else None
4
Text
Text
add text to article
a897631a0bd5499606ce9cb8e4c720e9ef118f82
<ide><path>guide/spanish/agile/acceptance-testing/index.md <ide> Las actividades de la prueba de aceptación están diseñadas para llegar a una <ide> <ide> # Informe de prueba de aceptación - Atributos <ide> <del>El informe de prueba de aceptación tiene los siguientes atributos: <add>El informe de prueba de aceptación tiene los atributos que estan abajo de esta lista: <ide> <ide> > Identificador de informe <ide> >
1
Javascript
Javascript
add animateddiffclamp node
cd1d652af4ebed123dbbee1d015ba3835ec33356
<ide><path>Libraries/Animated/src/AnimatedImplementation.js <ide> class AnimatedModulo extends AnimatedWithChildren { <ide> } <ide> } <ide> <add>class AnimatedDiffClamp extends AnimatedWithChildren { <add> _a: Animated; <add> _min: number; <add> _max: number; <add> _value: number; <add> _lastValue: number; <add> <add> constructor(a: Animated, min: number, max: number) { <add> super(); <add> <add> this._a = a; <add> this._min = min; <add> this._max = max; <add> this._value = this._lastValue = this._a.__getValue(); <add> } <add> <add> interpolate(config: InterpolationConfigType): AnimatedInterpolation { <add> return new AnimatedInterpolation(this, config); <add> } <add> <add> __getValue(): number { <add> const value = this._a.__getValue(); <add> const diff = value - this._lastValue; <add> this._lastValue = value; <add> this._value = Math.min(Math.max(this._value + diff, this._min), this._max); <add> return this._value; <add> } <add> <add> __attach(): void { <add> this._a.__addChild(this); <add> } <add> <add> __detach(): void { <add> this._a.__removeChild(this); <add> } <add>} <add> <ide> class AnimatedTransform extends AnimatedWithChildren { <ide> _transforms: Array<Object>; <ide> <ide> var modulo = function( <ide> return new AnimatedModulo(a, modulus); <ide> }; <ide> <add>var diffClamp = function( <add> a: Animated, <add> min: number, <add> max: number, <add>): AnimatedDiffClamp { <add> return new AnimatedDiffClamp(a, min, max); <add>}; <add> <ide> const _combineCallbacks = function(callback: ?EndCallback, config : AnimationConfig) { <ide> if (callback && config.onComplete) { <ide> return (...args) => { <ide> module.exports = { <ide> */ <ide> modulo, <ide> <add> /** <add> * Create a new Animated value that is limited between 2 values. It uses the <add> * difference between the last value so even if the value is far from the bounds <add> * it will start changing when the value starts getting closer again. <add> * (`value = clamp(value + diff, min, max)`). <add> * <add> * This is useful with scroll events, for example, to show the navbar when <add> * scrolling up and to hide it when scrolling down. <add> */ <add> diffClamp, <add> <ide> /** <ide> * Starts an animation after the given delay. <ide> */ <ide><path>Libraries/Animated/src/__tests__/Animated-test.js <ide> describe('Animated Listeners', () => { <ide> expect(listener.mock.calls.length).toBe(4); <ide> }); <ide> }); <add> <add>describe('Animated Diff Clamp', () => { <add> it('should get the proper value', () => { <add> const inputValues = [0, 20, 40, 30, 0, -40, -10, -20, 0]; <add> const expectedValues = [0, 20, 20, 10, 0, 0, 20, 10, 20]; <add> const value = new Animated.Value(0); <add> const diffClampValue = Animated.diffClamp(value, 0, 20); <add> for (let i = 0; i < inputValues.length; i++) { <add> value.setValue(inputValues[i]); <add> expect(diffClampValue.__getValue()).toBe(expectedValues[i]); <add> } <add> }); <add>});
2
Text
Text
update cluster entry in changelog
3dd7ebb0ba181960fb6d7131e11243a6ec85458d
<ide><path>CHANGELOG.md <ide> https://iojs.org/api/console.html <ide> <ide> https://iojs.org/api/cluster.html <ide> <del>(**DETAILS TO BE ADDED HERE**) <del> <ide> - Updated `cluster` to use round-robin load balancing by default on non-Windows platforms. The scheduling policy is configurable however. <add>- `--debug` has been made cluster-aware. <add>- Many bug fixes. <ide> <ide> ### crypto <ide>
1
Text
Text
add links to the expected common binary packages
cc6034ac862e058ee9faa5306f240d11150f960e
<ide><path>tools/email-footer.md <ide> Windows x64 Installer: http://nodejs.org/dist/__VERSION__/x64/node-__VERSION__-x <ide> <ide> Windows x64 Files: http://nodejs.org/dist/__VERSION__/x64/ <ide> <add>Linux 32-bit Binary Package: http://nodejs.org/dist/__VERSION__/node-__VERSION__-linux-i686.tar.gz <add> <add>Linux 64-bit Binary Package: http://nodejs.org/dist/__VERSION__/node-__VERSION__-linux-x86_64.tar.gz <add> <add>Solaris 32-bit Binary Package: http://nodejs.org/dist/__VERSION__/node-__VERSION__-sunos-i386.tar.gz <add> <add>Solaris 64-bit Binary Package: http://nodejs.org/dist/__VERSION__/node-__VERSION__-sunos-x86_64.tar.gz <add> <ide> Other release files: http://nodejs.org/dist/__VERSION__/ <ide> <ide> Website: http://nodejs.org/docs/__VERSION__/
1
Ruby
Ruby
add missing test cases for #assert_no_difference
bb5c1321d6eb97e08bd6cf134ae381410b8a6281
<ide><path>activesupport/test/test_test.rb <ide> def test_assert_not <ide> assert_equal 'custom', e.message <ide> end <ide> <del> def test_assert_no_difference <add> def test_assert_no_difference_pass <ide> assert_no_difference '@object.num' do <ide> # ... <ide> end <ide> end <ide> <add> def test_assert_no_difference_fail <add> error = assert_raises(Minitest::Assertion) do <add> assert_no_difference '@object.num' do <add> @object.increment <add> end <add> end <add> assert_equal "\"@object.num\" didn't change by 0.\nExpected: 0\n Actual: 1", error.message <add> end <add> <add> def test_assert_no_difference_with_message_fail <add> error = assert_raises(Minitest::Assertion) do <add> assert_no_difference '@object.num', 'Object Changed' do <add> @object.increment <add> end <add> end <add> assert_equal "Object Changed.\n\"@object.num\" didn't change by 0.\nExpected: 0\n Actual: 1", error.message <add> end <add> <ide> def test_assert_difference <ide> assert_difference '@object.num', +1 do <ide> @object.increment
1
Python
Python
fix partial update for the listserializer
53a1205dd03703e6f93bbf7bcb2686c617638242
<ide><path>rest_framework/serializers.py <ide> def __init__(self, *args, **kwargs): <ide> super(ListSerializer, self).__init__(*args, **kwargs) <ide> self.child.bind(field_name='', parent=self) <ide> <add> def bind(self, field_name, parent): <add> super(ListSerializer, self).bind(field_name, parent) <add> self.partial = self.parent.partial <add> <ide> def get_initial(self): <ide> if hasattr(self, 'initial_data'): <ide> return self.to_representation(self.initial_data) <ide> def to_internal_value(self, data): <ide> }) <ide> <ide> if not self.allow_empty and len(data) == 0: <add> if self.partial: <add> raise SkipField() <add> <ide> message = self.error_messages['empty'] <ide> raise ValidationError({ <ide> api_settings.NON_FIELD_ERRORS_KEY: [message]
1
Python
Python
fix the exception handling of windowserror
7ecafebdc70e01a41a68d6e4d8c8ac12ac507432
<ide><path>glances/processes.py <ide> <ide> import psutil <ide> <del># Workaround for old PsUtil version <del>if hasattr(psutil, 'WindowsError'): <del> PsUtilWindowsError = psutil.WindowsError <del>else: <del> PsUtilWindowsError = None <del> <ide> <ide> def is_kernel_thread(proc): <ide> """Return True if proc is a kernel thread, False instead.""" <ide> def __get_mandatory_stats(self, proc, procstat): <ide> # Patch for issue #391 <ide> try: <ide> self.cmdline_cache[procstat['pid']] = proc.cmdline() <del> except (AttributeError, UnicodeDecodeError, psutil.AccessDenied, psutil.NoSuchProcess, PsUtilWindowsError): <add> except (AttributeError, EnvironmentError, UnicodeDecodeError, <add> psutil.AccessDenied, psutil.NoSuchProcess): <ide> self.cmdline_cache[procstat['pid']] = "" <ide> procstat['cmdline'] = self.cmdline_cache[procstat['pid']] <ide>
1
Javascript
Javascript
add support for experimental scopes api
a16b34974508cd23ce0844ad09a0e37a879d5591
<ide><path>packages/react-debug-tools/src/ReactDebugHooks.js <ide> import type { <ide> ReactProviderType, <ide> ReactEventResponder, <ide> ReactEventResponderListener, <add> ReactScopeMethods, <ide> } from 'shared/ReactTypes'; <ide> import type {Fiber} from 'react-reconciler/src/ReactFiber'; <ide> import type {Hook, TimeoutConfig} from 'react-reconciler/src/ReactFiberHooks'; <ide> type HookLogEntry = { <ide> <ide> type ReactDebugListenerMap = {| <ide> clear: () => void, <del> setListener: (target: EventTarget, callback: ?(Event) => void) => void, <add> setListener: ( <add> target: EventTarget | ReactScopeMethods, <add> callback: ?(Event) => void, <add> ) => void, <ide> |}; <ide> <ide> let hookLog: Array<HookLogEntry> = []; <ide><path>packages/react-dom/src/client/ReactDOMHostConfig.js <ide> <ide> import type {TopLevelType} from 'legacy-events/TopLevelEventTypes'; <ide> import type {RootType} from './ReactDOMRoot'; <add>import type { <add> ReactDOMEventResponder, <add> ReactDOMEventResponderInstance, <add> ReactDOMFundamentalComponentInstance, <add> ReactDOMListener, <add> ReactDOMListenerEvent, <add> ReactDOMListenerMap, <add>} from '../shared/ReactDOMTypes'; <add>import type {ReactScopeMethods} from 'shared/ReactTypes'; <ide> <ide> import { <ide> precacheFiberNode, <ide> import { <ide> } from '../shared/HTMLNodeType'; <ide> import dangerousStyleValue from '../shared/dangerousStyleValue'; <ide> <del>import type { <del> ReactDOMEventResponder, <del> ReactDOMEventResponderInstance, <del> ReactDOMFundamentalComponentInstance, <del> ReactDOMListener, <del> ReactDOMListenerEvent, <del> ReactDOMListenerMap, <del>} from '../shared/ReactDOMTypes'; <ide> import { <ide> mountEventResponder, <ide> unmountEventResponder, <ide> import { <ide> enableDeprecatedFlareAPI, <ide> enableFundamentalAPI, <ide> enableUseEventAPI, <add> enableScopeAPI, <ide> } from 'shared/ReactFeatureFlags'; <ide> import {HostComponent} from 'react-reconciler/src/ReactWorkTags'; <ide> import { <ide> import { <ide> isManagedDOMElement, <ide> isValidEventTarget, <ide> listenToTopLevelEvent, <add> attachListenerToManagedDOMElement, <ide> detachListenerFromManagedDOMElement, <del> attachListenerFromManagedDOMElement, <del> detachTargetEventListener, <ide> attachTargetEventListener, <add> detachTargetEventListener, <add> isReactScope, <add> attachListenerToReactScope, <add> detachListenerFromReactScope, <ide> } from '../events/DOMModernPluginEventSystem'; <ide> import {getListenerMapForElement} from '../events/DOMEventListenerMap'; <ide> import {TOP_BEFORE_BLUR, TOP_AFTER_BLUR} from '../events/DOMTopLevelEventTypes'; <ide> export function mountEventListener(listener: ReactDOMListener): void { <ide> if (enableUseEventAPI) { <ide> const {target} = listener; <ide> if (isManagedDOMElement(target)) { <del> attachListenerFromManagedDOMElement(listener); <add> attachListenerToManagedDOMElement(listener); <add> } else if (enableScopeAPI && isReactScope(target)) { <add> attachListenerToReactScope(listener); <ide> } else { <ide> attachTargetEventListener(listener); <ide> } <ide> export function unmountEventListener(listener: ReactDOMListener): void { <ide> const {target} = listener; <ide> if (isManagedDOMElement(target)) { <ide> detachListenerFromManagedDOMElement(listener); <add> } else if (enableScopeAPI && isReactScope(target)) { <add> detachListenerFromReactScope(listener); <ide> } else { <ide> detachTargetEventListener(listener); <ide> } <ide> } <ide> } <ide> <ide> export function validateEventListenerTarget( <del> target: EventTarget, <add> target: EventTarget | ReactScopeMethods, <ide> listener: ?(Event) => void, <ide> ): boolean { <ide> if (enableUseEventAPI) { <ide> if ( <ide> target != null && <del> (isManagedDOMElement(target) || isValidEventTarget(target)) <add> (isManagedDOMElement(target) || <add> isValidEventTarget(target) || <add> isReactScope(target)) <ide> ) { <ide> if (listener == null || typeof listener === 'function') { <ide> return true; <ide><path>packages/react-dom/src/events/DOMModernPluginEventSystem.js <ide> import type { <ide> ElementListenerMapEntry, <ide> } from '../events/DOMEventListenerMap'; <ide> import type {EventSystemFlags} from 'legacy-events/EventSystemFlags'; <del>import type {EventPriority} from 'shared/ReactTypes'; <add>import type {EventPriority, ReactScopeMethods} from 'shared/ReactTypes'; <ide> import type {Fiber} from 'react-reconciler/src/ReactFiber'; <ide> import type {PluginModule} from 'legacy-events/PluginModuleType'; <ide> import type { <ide> const emptyDispatchConfigForCustomEvents: CustomDispatchConfig = { <ide> <ide> const isArray = Array.isArray; <ide> <del>// $FlowFixMe: Flow struggles with this pattern <del>const PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map; <add>// TODO: we should remove the FlowFixMes and the casting to figure out how to make <add>// these patterns work properly. <add>// $FlowFixMe: Flow struggles with this pattern, so we also have to cast it. <add>const PossiblyWeakMap = ((typeof WeakMap === 'function' ? WeakMap : Map): any); <add> <ide> // $FlowFixMe: Flow cannot handle polymorphic WeakMaps <ide> export const eventTargetEventListenerStore: WeakMap< <ide> EventTarget, <ide> export const eventTargetEventListenerStore: WeakMap< <ide> >, <ide> > = new PossiblyWeakMap(); <ide> <add>// $FlowFixMe: Flow cannot handle polymorphic WeakMaps <add>export const reactScopeListenerStore: WeakMap< <add> ReactScopeMethods, <add> Map< <add> DOMTopLevelEventType, <add> {bubbled: Set<ReactDOMListener>, captured: Set<ReactDOMListener>}, <add> >, <add>> = new PossiblyWeakMap(); <add> <ide> function dispatchEventsForPlugins( <ide> topLevelType: DOMTopLevelEventType, <ide> eventSystemFlags: EventSystemFlags, <ide> function isMatchingRootContainer( <ide> ); <ide> } <ide> <del>export function isManagedDOMElement(target: EventTarget): boolean { <add>export function isManagedDOMElement( <add> target: EventTarget | ReactScopeMethods, <add>): boolean { <ide> return getClosestInstanceFromNode(((target: any): Node)) !== null; <ide> } <ide> <del>export function isValidEventTarget(target: EventTarget): boolean { <del> return typeof target.addEventListener === 'function'; <add>export function isValidEventTarget( <add> target: EventTarget | ReactScopeMethods, <add>): boolean { <add> return typeof (target: any).addEventListener === 'function'; <add>} <add> <add>export function isReactScope(target: EventTarget | ReactScopeMethods): boolean { <add> return typeof (target: any).getChildContextValues === 'function'; <ide> } <ide> <ide> export function dispatchEventForPluginEventSystem( <ide> function addEventTypeToDispatchConfig(type: DOMTopLevelEventType): void { <ide> } <ide> } <ide> <del>export function attachListenerFromManagedDOMElement( <add>export function attachListenerToManagedDOMElement( <ide> listener: ReactDOMListener, <ide> ): void { <ide> const {event, target} = listener; <ide> const {passive, priority, type} = event; <del> const possibleManagedTarget = ((target: any): Element); <del> let containerEventTarget = target; <del> if (getClosestInstanceFromNode(possibleManagedTarget)) { <del> containerEventTarget = getNearestRootOrPortalContainer( <del> possibleManagedTarget, <del> ); <del> } <add> <add> const managedTargetElement = ((target: any): Element); <add> const containerEventTarget = getNearestRootOrPortalContainer( <add> managedTargetElement, <add> ); <ide> const listenerMap = getListenerMapForElement(containerEventTarget); <ide> // Add the event listener to the target container (falling back to <ide> // the target if we didn't find one). <ide> export function attachListenerFromManagedDOMElement( <ide> priority, <ide> ); <ide> // Get the internal listeners Set from the target instance. <del> let listeners = getListenersFromTarget(target); <add> let listeners = getListenersFromTarget(managedTargetElement); <ide> // If we don't have any listeners, then we need to init them. <ide> if (listeners === null) { <ide> listeners = new Set(); <del> initListenersSet(target, listeners); <add> initListenersSet(managedTargetElement, listeners); <ide> } <ide> // Add our listener to the listeners Set. <ide> listeners.add(listener); <ide> export function detachListenerFromManagedDOMElement( <ide> listener: ReactDOMListener, <ide> ): void { <ide> const {target} = listener; <add> const managedTargetElement = ((target: any): Element); <ide> // Get the internal listeners Set from the target instance. <del> const listeners = getListenersFromTarget(target); <add> const listeners = getListenersFromTarget(managedTargetElement); <ide> if (listeners !== null) { <ide> // Remove out listener from the listeners Set. <ide> listeners.delete(listener); <ide> export function detachListenerFromManagedDOMElement( <ide> export function attachTargetEventListener(listener: ReactDOMListener): void { <ide> const {event, target} = listener; <ide> const {capture, passive, priority, type} = event; <del> const listenerMap = getListenerMapForElement(target); <add> const eventTarget = ((target: any): EventTarget); <add> const listenerMap = getListenerMapForElement(eventTarget); <ide> // Add the event listener to the TargetEvent object. <del> listenToTopLevelEvent(type, target, listenerMap, passive, priority, capture); <del> let eventTypeMap = eventTargetEventListenerStore.get(target); <add> listenToTopLevelEvent( <add> type, <add> eventTarget, <add> listenerMap, <add> passive, <add> priority, <add> capture, <add> ); <add> let eventTypeMap = eventTargetEventListenerStore.get(eventTarget); <ide> if (eventTypeMap === undefined) { <ide> eventTypeMap = new Map(); <del> eventTargetEventListenerStore.set(target, eventTypeMap); <add> eventTargetEventListenerStore.set(eventTarget, eventTypeMap); <ide> } <ide> // Get the listeners by the event type <ide> let listeners = eventTypeMap.get(type); <ide> export function attachTargetEventListener(listener: ReactDOMListener): void { <ide> export function detachTargetEventListener(listener: ReactDOMListener): void { <ide> const {event, target} = listener; <ide> const {capture, type} = event; <del> const eventTypeMap = eventTargetEventListenerStore.get(target); <add> const validEventTarget = ((target: any): EventTarget); <add> const eventTypeMap = eventTargetEventListenerStore.get(validEventTarget); <add> if (eventTypeMap !== undefined) { <add> const listeners = eventTypeMap.get(type); <add> if (listeners !== undefined) { <add> // Remove out listener from the listeners Set. <add> if (capture) { <add> listeners.captured.delete(listener); <add> } else { <add> listeners.bubbled.delete(listener); <add> } <add> } <add> } <add>} <add> <add>export function attachListenerToReactScope(listener: ReactDOMListener): void { <add> const {event, target} = listener; <add> const {capture, type} = event; <add> const reactScope = ((target: any): ReactScopeMethods); <add> let eventTypeMap = reactScopeListenerStore.get(reactScope); <add> if (eventTypeMap === undefined) { <add> eventTypeMap = new Map(); <add> reactScopeListenerStore.set(reactScope, eventTypeMap); <add> } <add> // Get the listeners by the event type <add> let listeners = eventTypeMap.get(type); <add> if (listeners === undefined) { <add> listeners = {captured: new Set(), bubbled: new Set()}; <add> eventTypeMap.set(type, listeners); <add> } <add> // Add our listener to the listeners Set. <add> if (capture) { <add> listeners.captured.add(listener); <add> } else { <add> listeners.bubbled.add(listener); <add> } <add> // Finally, add the event to our known event types list. <add> addEventTypeToDispatchConfig(type); <add>} <add> <add>export function detachListenerFromReactScope(listener: ReactDOMListener): void { <add> const {event, target} = listener; <add> const {capture, type} = event; <add> const reactScope = ((target: any): ReactScopeMethods); <add> const eventTypeMap = reactScopeListenerStore.get(reactScope); <ide> if (eventTypeMap !== undefined) { <ide> const listeners = eventTypeMap.get(type); <ide> if (listeners !== undefined) { <ide><path>packages/react-dom/src/events/__tests__/DOMModernPluginEventSystem-test.internal.js <ide> describe('DOMModernPluginEventSystem', () => { <ide> document.body.removeChild(container2); <ide> }, <ide> ); <add> <add> describe('Compatibility with Scopes API', () => { <add> beforeEach(() => { <add> jest.resetModules(); <add> ReactFeatureFlags = require('shared/ReactFeatureFlags'); <add> ReactFeatureFlags.enableModernEventSystem = true; <add> ReactFeatureFlags.enableUseEventAPI = true; <add> ReactFeatureFlags.enableScopeAPI = true; <add> <add> React = require('react'); <add> ReactDOM = require('react-dom'); <add> Scheduler = require('scheduler'); <add> ReactDOMServer = require('react-dom/server'); <add> }); <add> <add> it('handle propagation of click events on a scope', () => { <add> const buttonRef = React.createRef(); <add> const log = []; <add> const onClick = jest.fn(e => <add> log.push(['bubble', e.currentTarget]), <add> ); <add> const onClickCapture = jest.fn(e => <add> log.push(['capture', e.currentTarget]), <add> ); <add> const TestScope = React.unstable_createScope(); <add> <add> function Test() { <add> const click = ReactDOM.unstable_useEvent('click'); <add> const clickCapture = ReactDOM.unstable_useEvent('click', { <add> capture: true, <add> }); <add> const scopeRef = React.useRef(null); <add> <add> React.useEffect(() => { <add> click.setListener(scopeRef.current, onClick); <add> clickCapture.setListener(scopeRef.current, onClickCapture); <add> }); <add> <add> return ( <add> <TestScope ref={scopeRef}> <add> <button ref={buttonRef} /> <add> </TestScope> <add> ); <add> } <add> <add> ReactDOM.render(<Test />, container); <add> Scheduler.unstable_flushAll(); <add> <add> const buttonElement = buttonRef.current; <add> dispatchClickEvent(buttonElement); <add> <add> expect(onClick).toHaveBeenCalledTimes(1); <add> expect(onClickCapture).toHaveBeenCalledTimes(1); <add> expect(log).toEqual([ <add> ['capture', buttonElement], <add> ['bubble', buttonElement], <add> ]); <add> }); <add> <add> it('handle mixed propagation of click events on a scope', () => { <add> const buttonRef = React.createRef(); <add> const divRef = React.createRef(); <add> const log = []; <add> const onClick = jest.fn(e => <add> log.push(['bubble', e.currentTarget]), <add> ); <add> const onClickCapture = jest.fn(e => <add> log.push(['capture', e.currentTarget]), <add> ); <add> const TestScope = React.unstable_createScope(); <add> <add> function Test() { <add> const click = ReactDOM.unstable_useEvent('click'); <add> const clickCapture = ReactDOM.unstable_useEvent('click', { <add> capture: true, <add> }); <add> const scopeRef = React.useRef(null); <add> <add> React.useEffect(() => { <add> click.setListener(scopeRef.current, onClick); <add> clickCapture.setListener(scopeRef.current, onClickCapture); <add> click.setListener(buttonRef.current, onClick); <add> clickCapture.setListener(buttonRef.current, onClickCapture); <add> }); <add> <add> return ( <add> <TestScope ref={scopeRef}> <add> <button ref={buttonRef}> <add> <div <add> ref={divRef} <add> onClick={onClick} <add> onClickCapture={onClickCapture}> <add> Click me! <add> </div> <add> </button> <add> </TestScope> <add> ); <add> } <add> <add> ReactDOM.render(<Test />, container); <add> Scheduler.unstable_flushAll(); <add> <add> const buttonElement = buttonRef.current; <add> dispatchClickEvent(buttonElement); <add> <add> expect(onClick).toHaveBeenCalledTimes(2); <add> expect(onClickCapture).toHaveBeenCalledTimes(2); <add> expect(log).toEqual([ <add> ['capture', buttonElement], <add> ['capture', buttonElement], <add> ['bubble', buttonElement], <add> ['bubble', buttonElement], <add> ]); <add> <add> log.length = 0; <add> onClick.mockClear(); <add> onClickCapture.mockClear(); <add> <add> const divElement = divRef.current; <add> dispatchClickEvent(divElement); <add> <add> expect(onClick).toHaveBeenCalledTimes(3); <add> expect(onClickCapture).toHaveBeenCalledTimes(3); <add> expect(log).toEqual([ <add> ['capture', buttonElement], <add> ['capture', buttonElement], <add> ['capture', divElement], <add> ['bubble', divElement], <add> ['bubble', buttonElement], <add> ['bubble', buttonElement], <add> ]); <add> }); <add> }); <ide> }); <ide> }, <ide> ); <ide><path>packages/react-dom/src/events/accumulateTwoPhaseListeners.js <ide> import type {DOMTopLevelEventType} from 'legacy-events/TopLevelEventTypes'; <ide> import type {EventSystemFlags} from 'legacy-events/EventSystemFlags'; <ide> import type {ReactSyntheticEvent} from 'legacy-events/ReactSyntheticEventType'; <ide> <del>import {HostComponent} from 'react-reconciler/src/ReactWorkTags'; <del>import {enableUseEventAPI} from 'shared/ReactFeatureFlags'; <add>import { <add> HostComponent, <add> ScopeComponent, <add>} from 'react-reconciler/src/ReactWorkTags'; <add>import {enableUseEventAPI, enableScopeAPI} from 'shared/ReactFeatureFlags'; <ide> <ide> import getListener from 'legacy-events/getListener'; <ide> import {getListenersFromTarget} from '../client/ReactDOMComponentTree'; <ide> import {IS_TARGET_EVENT_ONLY} from 'legacy-events/EventSystemFlags'; <del>import {eventTargetEventListenerStore} from './DOMModernPluginEventSystem'; <add>import { <add> eventTargetEventListenerStore, <add> reactScopeListenerStore, <add>} from './DOMModernPluginEventSystem'; <ide> <ide> export default function accumulateTwoPhaseListeners( <ide> event: ReactSyntheticEvent, <ide> export default function accumulateTwoPhaseListeners( <ide> // usual two phase accumulation using the React fiber tree to pick up <ide> // all relevant useEvent and on* prop events. <ide> let node = event._targetInst; <add> let lastHostComponent; <ide> <ide> // Accumulate all instances and listeners via the target -> root path. <ide> while (node !== null) { <del> // We only care for listeners that are on HostComponents (i.e. <div>) <add> // Handle listeners that are on HostComponents (i.e. <div>) <ide> if (node.tag === HostComponent) { <add> lastHostComponent = node.stateNode; <ide> // For useEvent listenrs <ide> if (enableUseEventAPI && accumulateUseEventListeners) { <ide> // useEvent event listeners <ide> export default function accumulateTwoPhaseListeners( <ide> dispatchInstances.push(node); <ide> } <ide> } <add> } else if (enableScopeAPI && node.tag === ScopeComponent) { <add> const reactScope = node.stateNode.methods; <add> const eventTypeMap = reactScopeListenerStore.get(reactScope); <add> if (eventTypeMap !== undefined) { <add> const type = ((event.type: any): DOMTopLevelEventType); <add> const listeners = eventTypeMap.get(type); <add> if (listeners !== undefined) { <add> const captureListeners = Array.from(listeners.captured); <add> const bubbleListeners = Array.from(listeners.bubbled); <add> <add> for (let i = 0; i < captureListeners.length; i++) { <add> const listener = captureListeners[i]; <add> const {callback} = listener; <add> dispatchListeners.unshift(callback); <add> dispatchInstances.unshift(((lastHostComponent: any): Element)); <add> } <add> for (let i = 0; i < bubbleListeners.length; i++) { <add> const listener = bubbleListeners[i]; <add> const {callback} = listener; <add> dispatchListeners.push(callback); <add> dispatchInstances.push(((lastHostComponent: any): Element)); <add> } <add> } <add> } <ide> } <ide> node = node.return; <ide> } <ide><path>packages/react-dom/src/shared/ReactDOMTypes.js <ide> import type { <ide> ReactEventResponder, <ide> ReactEventResponderInstance, <ide> EventPriority, <add> ReactScopeMethods, <ide> } from 'shared/ReactTypes'; <ide> import type {DOMTopLevelEventType} from 'legacy-events/TopLevelEventTypes'; <ide> <ide> export type ReactDOMListenerEvent = {| <ide> <ide> export type ReactDOMListenerMap = {| <ide> clear: () => void, <del> setListener: (target: EventTarget, callback: ?(Event) => void) => void, <add> setListener: ( <add> target: EventTarget | ReactScopeMethods, <add> callback: ?(Event) => void, <add> ) => void, <ide> |}; <ide> <ide> export type ReactDOMListener = {| <ide> callback: Event => void, <ide> destroy: Node => void, <ide> event: ReactDOMListenerEvent, <del> target: EventTarget, <add> target: EventTarget | ReactScopeMethods, <ide> |}; <ide><path>packages/react-reconciler/src/ReactFiberHooks.js <ide> import type { <ide> ReactEventResponder, <ide> ReactContext, <ide> ReactEventResponderListener, <add> ReactScopeMethods, <ide> } from 'shared/ReactTypes'; <ide> import type {Fiber} from './ReactFiber'; <ide> import type {ExpirationTime} from './ReactFiberExpirationTime'; <ide> function validateNotInFunctionRender(): boolean { <ide> function createReactListener( <ide> event: ReactListenerEvent, <ide> callback: Event => void, <del> target: EventTarget, <add> target: EventTarget | ReactScopeMethods, <ide> destroy: Node => void, <ide> ): ReactListener { <ide> return { <ide> function createReactListener( <ide> function mountEventListener(event: ReactListenerEvent): ReactListenerMap { <ide> if (enableUseEventAPI) { <ide> const hook = mountWorkInProgressHook(); <del> const listenerMap: Map<EventTarget, ReactListener> = new Map(); <add> const listenerMap: Map< <add> EventTarget | ReactScopeMethods, <add> ReactListener, <add> > = new Map(); <ide> const rootContainerInstance = getRootHostContainer(); <ide> <ide> // Register the event to the current root to ensure event <ide> function mountEventListener(event: ReactListenerEvent): ReactListenerMap { <ide> <ide> const reactListenerMap: ReactListenerMap = { <ide> clear, <del> setListener(target: EventTarget, callback: ?(Event) => void): void { <add> setListener( <add> target: EventTarget | ReactScopeMethods, <add> callback: ?(Event) => void, <add> ): void { <ide> if ( <ide> validateNotInFunctionRender() && <ide> validateEventListenerTarget(target, callback)
7
Javascript
Javascript
remove timers from streams test
45a716c9687849b7ade2ce01f2421c8f791f907c
<ide><path>test/parallel/test-stream2-readable-empty-buffer-no-eof.js <ide> 'use strict'; <del>const common = require('../common'); <add>require('../common'); <ide> const assert = require('assert'); <ide> <ide> const Readable = require('stream').Readable; <ide> function test1() { <ide> // <ide> // note that this is very unusual. it only works for crypto streams <ide> // because the other side of the stream will call read(0) to cycle <del> // data through openssl. that's why we set the timeouts to call <add> // data through openssl. that's why setImmediate() is used to call <ide> // r.read(0) again later, otherwise there is no more work being done <ide> // and the process just exits. <ide> <ide> const buf = Buffer.alloc(5, 'x'); <ide> let reads = 5; <del> const timeout = common.platformTimeout(50); <ide> r._read = function(n) { <ide> switch (reads--) { <del> case 0: <del> return r.push(null); // EOF <del> case 1: <del> return r.push(buf); <del> case 2: <del> setTimeout(r.read.bind(r, 0), timeout); <del> return r.push(Buffer.alloc(0)); // Not-EOF! <del> case 3: <del> setTimeout(r.read.bind(r, 0), timeout); <del> return process.nextTick(function() { <del> return r.push(Buffer.alloc(0)); <add> case 5: <add> return setImmediate(function() { <add> return r.push(buf); <ide> }); <ide> case 4: <del> setTimeout(r.read.bind(r, 0), timeout); <del> return setTimeout(function() { <add> setImmediate(function() { <ide> return r.push(Buffer.alloc(0)); <ide> }); <del> case 5: <del> return setTimeout(function() { <del> return r.push(buf); <add> return setImmediate(r.read.bind(r, 0)); <add> case 3: <add> setImmediate(r.read.bind(r, 0)); <add> return process.nextTick(function() { <add> return r.push(Buffer.alloc(0)); <ide> }); <add> case 2: <add> setImmediate(r.read.bind(r, 0)); <add> return r.push(Buffer.alloc(0)); // Not-EOF! <add> case 1: <add> return r.push(buf); <add> case 0: <add> return r.push(null); // EOF <ide> default: <ide> throw new Error('unreachable'); <ide> }
1
PHP
PHP
update dynamo store
8aa403ebafde3fd51048e427aaf2ae8081c2ff9d
<ide><path>src/Illuminate/Cache/DynamoDbStore.php <ide> protected function isExpired(array $item, $expiration = null) <ide> * @param string $key <ide> * @param mixed $value <ide> * @param float|int $minutes <del> * @return void <add> * @return bool <ide> */ <ide> public function put($key, $value, $minutes) <ide> { <ide> public function put($key, $value, $minutes) <ide> ], <ide> ], <ide> ]); <add> <add> return true; <ide> } <ide> <ide> /**
1
Javascript
Javascript
refine explanation of isolate scope `=`-binding
507cf31ff9eb31f7f5f5c8e86c924bae14e9d922
<ide><path>src/ng/compile.js <ide> * is bound to the parent scope, via matching attributes on the directive's element: <ide> * <ide> * * `@` or `@attr` - bind a local scope property to the value of DOM attribute. The result is <del> * always a string since DOM attributes are strings. If no `attr` name is specified then the <del> * attribute name is assumed to be the same as the local name. <del> * Given `<widget my-attr="hello {{name}}">` and widget definition <del> * of `scope: { localName:'@myAttr' }`, then widget scope property `localName` will reflect <del> * the interpolated value of `hello {{name}}`. As the `name` attribute changes so will the <del> * `localName` property on the widget scope. The `name` is read from the parent scope (not <del> * component scope). <del> * <del> * * `=` or `=attr` - set up bi-directional binding between a local scope property and the <del> * parent scope property of name defined via the value of the `attr` attribute. If no `attr` <del> * name is specified then the attribute name is assumed to be the same as the local name. <del> * Given `<widget my-attr="parentModel">` and widget definition of <del> * `scope: { localModel:'=myAttr' }`, then widget scope property `localModel` will reflect the <del> * value of `parentModel` on the parent scope. Any changes to `parentModel` will be reflected <del> * in `localModel` and any changes in `localModel` will reflect in `parentModel`. If the parent <del> * scope property doesn't exist, it will throw a NON_ASSIGNABLE_MODEL_EXPRESSION exception. You <del> * can avoid this behavior using `=?` or `=?attr` in order to flag the property as optional. If <del> * you want to shallow watch for changes (i.e. $watchCollection instead of $watch) you can use <del> * `=*` or `=*attr` (`=*?` or `=*?attr` if the property is optional). <del> * <del> * * `&` or `&attr` - provides a way to execute an expression in the context of the parent scope. <del> * If no `attr` name is specified then the attribute name is assumed to be the same as the <del> * local name. Given `<widget my-attr="count = count + value">` and widget definition of <del> * `scope: { localFn:'&myAttr' }`, then isolate scope property `localFn` will point to <del> * a function wrapper for the `count = count + value` expression. Often it's desirable to <del> * pass data from the isolated scope via an expression to the parent scope, this can be <del> * done by passing a map of local variable names and values into the expression wrapper fn. <del> * For example, if the expression is `increment(amount)` then we can specify the amount value <del> * by calling the `localFn` as `localFn({amount: 22})`. <add> * always a string since DOM attributes are strings. If no `attr` name is specified then the <add> * attribute name is assumed to be the same as the local name. Given `<my-component <add> * my-attr="hello {{name}}">` and the isolate scope definition `scope: { localName:'@myAttr' }`, <add> * the directive's scope property `localName` will reflect the interpolated value of `hello <add> * {{name}}`. As the `name` attribute changes so will the `localName` property on the directive's <add> * scope. The `name` is read from the parent scope (not the directive's scope). <add> * <add> * * `=` or `=attr` - set up a bidirectional binding between a local scope property and an expression <add> * passed via the attribute `attr`. The expression is evaluated in the context of the parent scope. <add> * If no `attr` name is specified then the attribute name is assumed to be the same as the local <add> * name. Given `<my-component my-attr="parentModel">` and the isolate scope definition `scope: { <add> * localModel: '=myAttr' }`, the property `localModel` on the directive's scope will reflect the <add> * value of `parentModel` on the parent scope. Changes to `parentModel` will be reflected in <add> * `localModel` and vice versa. Optional attributes should be marked as such with a question mark: <add> * `=?` or `=?attr`. If the binding expression is non-assignable, or if the attribute isn't <add> * optional and doesn't exist, an exception ({@link error/$compile/nonassign `$compile:nonassign`}) <add> * will be thrown upon discovering changes to the local value, since it will be impossible to sync <add> * them back to the parent scope. By default, the {@link ng.$rootScope.Scope#$watch `$watch`} <add> * method is used for tracking changes, and the equality check is based on object identity. <add> * However, if an object literal or an array literal is passed as the binding expression, the <add> * equality check is done by value (using the {@link angular.equals} function). It's also possible <add> * to watch the evaluated value shallowly with {@link ng.$rootScope.Scope#$watchCollection <add> * `$watchCollection`}: use `=*` or `=*attr` (`=*?` or `=*?attr` if the attribute is optional). <add> * <add> * * `&` or `&attr` - provides a way to execute an expression in the context of the parent scope. If <add> * no `attr` name is specified then the attribute name is assumed to be the same as the local name. <add> * Given `<my-component my-attr="count = count + value">` and the isolate scope definition `scope: { <add> * localFn:'&myAttr' }`, the isolate scope property `localFn` will point to a function wrapper for <add> * the `count = count + value` expression. Often it's desirable to pass data from the isolated scope <add> * via an expression to the parent scope. This can be done by passing a map of local variable names <add> * and values into the expression wrapper fn. For example, if the expression is `increment(amount)` <add> * then we can specify the amount value by calling the `localFn` as `localFn({amount: 22})`. <ide> * <ide> * In general it's possible to apply more than one directive to one element, but there might be limitations <ide> * depending on the type of scope required by the directives. The following points will help explain these limitations.
1
Java
Java
add writablechannel to writableresource
ed4bd43cacebf2d001a1d0b66b67ad5141499be1
<ide><path>spring-core/src/main/java/org/springframework/core/io/FileSystemResource.java <ide> /* <del> * Copyright 2002-2016 the original author or authors. <add> * Copyright 2002-2017 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> import java.net.URL; <ide> import java.nio.channels.ReadableByteChannel; <add>import java.nio.channels.WritableByteChannel; <ide> <ide> import org.springframework.util.Assert; <ide> import org.springframework.util.StringUtils; <ide> public ReadableByteChannel readableChannel() throws IOException { <ide> return new FileInputStream(this.file).getChannel(); <ide> } <ide> <add> /** <add> * This implementation opens a FileChannel for the underlying file. <add> * @see java.nio.channels.FileChannel <add> */ <add> @Override <add> public WritableByteChannel writableChannel() throws IOException { <add> return new FileOutputStream(this.file).getChannel(); <add> } <add> <ide> /** <ide> * This implementation returns the underlying File's length. <ide> */ <ide><path>spring-core/src/main/java/org/springframework/core/io/PathResource.java <ide> /* <del> * Copyright 2002-2016 the original author or authors. <add> * Copyright 2002-2017 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> import java.net.URL; <ide> import java.nio.channels.ReadableByteChannel; <add>import java.nio.channels.WritableByteChannel; <ide> import java.nio.file.Files; <ide> import java.nio.file.OpenOption; <ide> import java.nio.file.Path; <ide> public File getFile() throws IOException { <ide> } <ide> <ide> /** <del> * This implementation opens a InputStream for the underlying file. <del> * @see java.nio.file.spi.FileSystemProvider#newInputStream(Path, OpenOption...) <add> * This implementation opens a Channel for the underlying file. <add> * @see Files#newByteChannel(Path, OpenOption...) <ide> */ <ide> @Override <ide> public ReadableByteChannel readableChannel() throws IOException { <ide> return Files.newByteChannel(this.path, StandardOpenOption.READ); <ide> } <ide> <add> /** <add> * This implementation opens a Channel for the underlying file. <add> * @see Files#newByteChannel(Path, OpenOption...) <add> */ <add> @Override <add> public WritableByteChannel writableChannel() throws IOException { <add> return Files.newByteChannel(this.path, StandardOpenOption.WRITE); <add> } <add> <ide> /** <ide> * This implementation returns the underlying File's length. <ide> */ <ide><path>spring-core/src/main/java/org/springframework/core/io/WritableResource.java <ide> /* <del> * Copyright 2002-2016 the original author or authors. <add> * Copyright 2002-2017 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 java.io.IOException; <ide> import java.io.OutputStream; <add>import java.nio.channels.Channels; <add>import java.nio.channels.WritableByteChannel; <ide> <ide> /** <ide> * Extended interface for a resource that supports writing to it. <ide> default boolean isWritable() { <ide> */ <ide> OutputStream getOutputStream() throws IOException; <ide> <add> /** <add> * Return a {@link WritableByteChannel}. <add> * <p>It is expected that each call creates a <i>fresh</i> channel. <add> * <p>The default implementation returns {@link Channels#newChannel(OutputStream)} <add> * with the result of {@link #getOutputStream()}. <add> * @return the byte channel for the underlying resource (must not be {@code null}) <add> * @throws java.io.FileNotFoundException if the underlying resource doesn't exist <add> * @throws IOException if the content channel could not be opened <add> * @since 5.0 <add> * @see #getOutputStream() <add> */ <add> default WritableByteChannel writableChannel() throws IOException { <add> return Channels.newChannel(getOutputStream()); <add> } <add> <ide> } <ide><path>spring-core/src/test/java/org/springframework/core/io/PathResourceTests.java <ide> /* <del> * Copyright 2002-2016 the original author or authors. <add> * Copyright 2002-2017 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> import java.nio.ByteBuffer; <ide> import java.nio.channels.ReadableByteChannel; <add>import java.nio.channels.WritableByteChannel; <add>import java.nio.charset.StandardCharsets; <ide> import java.nio.file.AccessDeniedException; <ide> import java.nio.file.NoSuchFileException; <ide> import java.nio.file.Path; <ide> public void directoryIsNotWritable() throws Exception { <ide> @Test <ide> public void outputStream() throws Exception { <ide> PathResource resource = new PathResource(temporaryFolder.newFile("test").toPath()); <del> FileCopyUtils.copy("test".getBytes(), resource.getOutputStream()); <add> FileCopyUtils.copy("test".getBytes(StandardCharsets.UTF_8), resource.getOutputStream()); <ide> assertThat(resource.contentLength(), equalTo(4L)); <ide> } <ide> <ide> public void getReadableByteChannelDoesNotExist() throws Exception { <ide> resource.readableChannel(); <ide> } <ide> <add> @Test <add> public void getWritableChannel() throws Exception { <add> PathResource resource = new PathResource(temporaryFolder.newFile("test").toPath()); <add> ByteBuffer buffer = ByteBuffer.wrap("test".getBytes(StandardCharsets.UTF_8)); <add> WritableByteChannel channel = null; <add> try { <add> channel = resource.writableChannel(); <add> channel.write(buffer); <add> } <add> finally { <add> if (channel != null) { <add> channel.close(); <add> } <add> } <add> assertThat(resource.contentLength(), equalTo(4L)); <add> } <add> <ide> }
4
Ruby
Ruby
include selected spec in formula#inspect
eec4feccaa06ab909ffc02fcec7d63a3e23fdd2d
<ide><path>Library/Homebrew/formula.rb <ide> def to_s <ide> end <ide> <ide> def inspect <del> "#<#{self.class.name}: #{path}>" <add> s = "#<Formula #{name} (" <add> s << if head? then "head" elsif devel? then "devel" else "stable" end <add> s << ") #{path}>" <ide> end <ide> <ide> # Standard parameters for CMake builds.
1
Javascript
Javascript
add bumpthree grunt task
b2ed7e9aa9144e9ecc8841b915c3745b494050da
<ide><path>Gruntfile.js <ide> 'use strict'; <ide> <ide> const fs = require('fs'); <add>const path = require('path'); <add>const semver = require('semver'); <ide> <ide> module.exports = function(grunt) { <ide> <ide> module.exports = function(grunt) { <ide> }).done(); <ide> }); <ide> <del> grunt.registerTask('build', ['clean', 'copy', 'buildlessons']); <add> grunt.task.registerMultiTask('fixthreepaths', 'fix three paths', function() { <add> const options = this.options({}); <add> const oldVersionRE = new RegExp(`/${options.oldVersionStr}/`, 'g'); <add> const newVersionReplacement = `/${options.newVersionStr}/`; <add> this.files.forEach((files) => { <add> files.src.forEach((filename) => { <add> const oldContent = fs.readFileSync(filename, {encoding: 'utf8'}); <add> const newContent = oldContent.replace(oldVersionRE, newVersionReplacement); <add> if (oldContent !== newContent) { <add> grunt.log.writeln(`updating ${filename} to ${options.newVersionStr}`); <add> fs.writeFileSync(filename, newContent); <add> } <add> }); <add> }); <add> }); <add> <add> grunt.registerTask('bumpthree', function() { <add> const lessonInfo = JSON.parse(fs.readFileSync('package.json', {encoding: 'utf8'})); <add> const oldVersion = lessonInfo.threejsfundamentals.threeVersion; <add> const oldVersionStr = `r${oldVersion}`; <add> const threePath = path.join(__dirname, '..', 'three.js'); <add> const threeInfo = JSON.parse(fs.readFileSync(path.join(threePath, 'package.json'), {encoding: 'utf8'})); <add> const newVersion = semver.minor(threeInfo.version); <add> const newVersionStr = `r${newVersion}`; <add> const basePath = path.join('threejs', 'resources', 'threejs', newVersionStr); <add> grunt.config.merge({ <add> copy: { <add> threejs: { <add> files: [ <add> { expand: true, cwd: `${threePath}/build/`, src: 'three.js', dest: `${basePath}/`, }, <add> { expand: true, cwd: `${threePath}/build/`, src: 'three.min.js', dest: `${basePath}/`, }, <add> { expand: true, cwd: `${threePath}/examples/js/`, src: '**', dest: `${basePath}/js/`, }, <add> ], <add> }, <add> }, <add> fixthreepaths: { <add> options: { <add> oldVersionStr, <add> newVersionStr, <add> }, <add> src: [ <add> 'threejs/**/*.html', <add> 'threejs/**/*.md', <add> 'threejs/**/*.js', <add> '!threejs/resources/threejs/**', <add> ], <add> }, <add> }); <add> <add> lessonInfo.threejsfundamentals.threeVersion = newVersion; <add> fs.writeFileSync('package.json', JSON.stringify(lessonInfo, null, 2)); <add> grunt.task.run(['copy:threejs', 'fixthreepaths']); <add> }); <add> <add> grunt.registerTask('build', ['clean', 'copy:main', 'buildlessons']); <ide> <ide> grunt.registerTask('default', ['eslint', 'build']); <ide> };
1
PHP
PHP
add instance() to the container contract
c4d367a991f62c153c28769dc32b1353acff9383
<ide><path>src/Illuminate/Contracts/Container/Container.php <ide> public function singleton($abstract, $concrete = null); <ide> */ <ide> public function extend($abstract, Closure $closure); <ide> <add> /** <add> * Register an existing instance as shared in the container. <add> * <add> * @param string $abstract <add> * @param mixed $instance <add> * @return void <add> */ <add> public function instance($abstract, $instance); <add> <ide> /** <ide> * Define a contextual binding. <ide> *
1
Ruby
Ruby
fix warnings for undefined local variable
92fb0815ed3cb92ae18ce8c9cf401ee1b74a971d
<ide><path>activerecord/lib/active_record/schema_dumper.rb <ide> def tables(stream) <ide> end <ide> end <ide> <add> def primary_key_for(table) <add> if @connection.respond_to?(:pk_and_sequence_for) <add> pk, _ = @connection.pk_and_sequence_for(table) <add> return pk if pk <add> end <add> return @connection.primary_key(table) if @connection.respond_to?(:primary_key) <add> nil <add> end <add> <ide> def table(table, stream) <ide> columns = @connection.columns(table) <ide> begin <ide> tbl = StringIO.new <ide> <ide> # first dump primary key column <del> if @connection.respond_to?(:pk_and_sequence_for) <del> pk, _ = @connection.pk_and_sequence_for(table) <del> end <del> if !pk && @connection.respond_to?(:primary_key) <del> pk = @connection.primary_key(table) <del> end <add> pk = primary_key_for(table) <ide> <ide> tbl.print " create_table #{remove_prefix_and_suffix(table).inspect}" <ide> pkcol = columns.detect { |c| c.name == pk }
1
PHP
PHP
provide collection with final models in hydrate
644e13583e940bf3e76c7c74640376683fa4ad40
<ide><path>src/Illuminate/Database/Eloquent/Model.php <ide> public static function hydrate(array $items, $connection = null) <ide> { <ide> $instance = (new static)->setConnection($connection); <ide> <del> $collection = $instance->newCollection($items); <del> <del> return $collection->map(function ($item) use ($instance) <add> $items = array_map(function ($item) use ($instance) <ide> { <ide> return $instance->newFromBuilder($item); <del> }); <add> }, $items); <add> <add> return $instance->newCollection($items); <ide> } <ide> <ide> /**
1
Ruby
Ruby
add homebrew-completions to search
05eb740766d4b2611abd9a197d3fdf585db9f0ce
<ide><path>Library/Homebrew/cmd/search.rb <ide> def search <ide> threads << Thread.new { search_tap "Homebrew", "dupes", rx } <ide> threads << Thread.new { search_tap "Homebrew", "games", rx } <ide> threads << Thread.new { search_tap "Homebrew", "science", rx } <add> threads << Thread.new { search_tap "Homebrew", "completions", rx } <ide> <ide> threads.each do |t| <ide> results << t.value
1
Javascript
Javascript
fix existing lint warnings
908571de2f7a4b53dba3e8155464f426f5cc1a50
<ide><path>Libraries/Components/View/View.js <ide> const View: React.AbstractComponent< <ide> 'aria-disabled': ariaDisabled, <ide> 'aria-expanded': ariaExpanded, <ide> 'aria-selected': ariaSelected, <del> ...restProps <ide> } = otherProps; <ide> <ide> const _accessibilityState = { <ide><path>packages/babel-plugin-codegen/index.js <ide> try { <ide> RNCodegen = require('react-native-codegen/lib/generators/RNCodegen'); <ide> } <ide> <del>function parse(filename, code) { <add>function parseFile(filename, code) { <ide> if (filename.endsWith('js')) { <ide> return flowParser.parseString(code); <ide> } <ide> function parse(filename, code) { <ide> } <ide> <ide> function generateViewConfig(filename, code) { <del> const schema = parse(filename, code); <add> const schema = parseFile(filename, code); <ide> <ide> const libraryName = basename(filename).replace( <ide> /NativeComponent\.(js|ts)$/,
2
Javascript
Javascript
add support for big5 encoding
27d114bd11727ca570e8798db0d81bab797a7465
<ide><path>src/fonts.js <ide> var CMapConverterList = { <ide> '90ms-RKSJ-V': sjisToUnicode, <ide> '90msp-RKSJ-H': sjisToUnicode, <ide> '90msp-RKSJ-V': sjisToUnicode, <del> 'GBK-EUC-H': gbkToUnicode <add> 'GBK-EUC-H': gbkToUnicode, <add> 'ETenms-B5-H': big5ToUnicode, <add> 'ETenms-B5-V': big5ToUnicode, <ide> }; <ide> <ide> // CMaps using Hankaku (Halfwidth) Latin glyphs instead of proportional one. <ide> function gbkToUnicode(str) { <ide> return decodeBytes(stringToBytes(str), 'gbk'); <ide> } <ide> <add>function big5ToUnicode(str) { <add> return decodeBytes(stringToBytes(str), 'big5'); <add>} <add> <ide> // Some characters, e.g. copyrightserif, mapped to the private use area and <ide> // might not be displayed using standard fonts. Mapping/hacking well-known chars <ide> // to the similar equivalents in the normal characters range.
1
Python
Python
drop regex dependency
bed956c698918e10b32961cb257dee13fd13ac1a
<ide><path>setup.py <ide> def setup_package(): <ide> "thinc==7.0.0.dev6", <ide> "blis>=0.2.2,<0.3.0", <ide> "plac<1.0.0,>=0.9.6", <del> "regex==2018.01.10", <ide> "requests>=2.13.0,<3.0.0", <ide> "jsonschema>=2.6.0,<3.0.0", <ide> "wasabi>=0.0.12,<1.1.0",
1
Python
Python
fix typo of roles export command
00fd789258b48d92b16294b598956db271bc7b3d
<ide><path>airflow/cli/commands/role_command.py <ide> def roles_delete(args): <ide> @suppress_logs_and_warning <ide> def roles_export(args): <ide> """ <del> Exports all the rules from the data base to a file. <add> Exports all the roles from the data base to a file. <ide> Note, this function does not export the permissions associated for each role. <ide> Strictly, it exports the role names into the passed role json file. <ide> """
1
Python
Python
drop all compat support to django < 2 urls
bb795674f86828fc5f15d6d61501cc781811e053
<ide><path>rest_framework/compat.py <ide> from django.conf import settings <ide> from django.views.generic import View <ide> <del>try: <del> from django.urls import ( # noqa <del> URLPattern, <del> URLResolver, <del> ) <del>except ImportError: <del> # Will be removed in Django 2.0 <del> from django.urls import ( # noqa <del> RegexURLPattern as URLPattern, <del> RegexURLResolver as URLResolver, <del> ) <del> <del> <del>def get_original_route(urlpattern): <del> """ <del> Get the original route/regex that was typed in by the user into the path(), re_path() or url() directive. This <del> is in contrast with get_regex_pattern below, which for RoutePattern returns the raw regex generated from the path(). <del> """ <del> if hasattr(urlpattern, 'pattern'): <del> # Django 2.0 <del> return str(urlpattern.pattern) <del> else: <del> # Django < 2.0 <del> return urlpattern.regex.pattern <del> <del> <del>def get_regex_pattern(urlpattern): <del> """ <del> Get the raw regex out of the urlpattern's RegexPattern or RoutePattern. This is always a regular expression, <del> unlike get_original_route above. <del> """ <del> if hasattr(urlpattern, 'pattern'): <del> # Django 2.0 <del> return urlpattern.pattern.regex.pattern <del> else: <del> # Django < 2.0 <del> return urlpattern.regex.pattern <del> <del> <del>def is_route_pattern(urlpattern): <del> if hasattr(urlpattern, 'pattern'): <del> # Django 2.0 <del> from django.urls.resolvers import RoutePattern <del> return isinstance(urlpattern.pattern, RoutePattern) <del> else: <del> # Django < 2.0 <del> return False <del> <del> <del>def make_url_resolver(regex, urlpatterns): <del> try: <del> # Django 2.0 <del> from django.urls.resolvers import RegexPattern <del> return URLResolver(RegexPattern(regex), urlpatterns) <del> <del> except ImportError: <del> # Django < 2.0 <del> return URLResolver(regex, urlpatterns) <del> <ide> <ide> def unicode_http_header(value): <ide> # Coerce HTTP header value to unicode. <ide><path>rest_framework/schemas/generators.py <ide> from django.contrib.admindocs.views import simplify_regex <ide> from django.core.exceptions import PermissionDenied <ide> from django.http import Http404 <add>from django.urls import URLPattern, URLResolver <ide> <ide> from rest_framework import exceptions <del>from rest_framework.compat import URLPattern, URLResolver, get_original_route <ide> from rest_framework.request import clone_request <ide> from rest_framework.settings import api_settings <ide> from rest_framework.utils.model_meta import _get_pk <ide> def get_api_endpoints(self, patterns=None, prefix=''): <ide> api_endpoints = [] <ide> <ide> for pattern in patterns: <del> path_regex = prefix + get_original_route(pattern) <add> path_regex = prefix + str(pattern.pattern) <ide> if isinstance(pattern, URLPattern): <ide> path = self.get_path_from_regex(path_regex) <ide> callback = pattern.callback <ide><path>rest_framework/urlpatterns.py <ide> from django.conf.urls import include, url <del>from django.urls import path, register_converter <add>from django.urls import URLResolver, path, register_converter <add>from django.urls.resolvers import RoutePattern <ide> <del>from rest_framework.compat import ( <del> URLResolver, get_regex_pattern, is_route_pattern <del>) <ide> from rest_framework.settings import api_settings <ide> <ide> <ide> def apply_suffix_patterns(urlpatterns, suffix_pattern, suffix_required, suffix_r <ide> for urlpattern in urlpatterns: <ide> if isinstance(urlpattern, URLResolver): <ide> # Set of included URL patterns <del> regex = get_regex_pattern(urlpattern) <add> regex = urlpattern.pattern.regex.pattern <ide> namespace = urlpattern.namespace <ide> app_name = urlpattern.app_name <ide> kwargs = urlpattern.default_kwargs <ide> def apply_suffix_patterns(urlpatterns, suffix_pattern, suffix_required, suffix_r <ide> suffix_route) <ide> <ide> # if the original pattern was a RoutePattern we need to preserve it <del> if is_route_pattern(urlpattern): <add> if isinstance(urlpattern.pattern, RoutePattern): <ide> assert path is not None <ide> route = str(urlpattern.pattern) <ide> new_pattern = path(route, include((patterns, app_name), namespace), kwargs) <ide> def apply_suffix_patterns(urlpatterns, suffix_pattern, suffix_required, suffix_r <ide> ret.append(new_pattern) <ide> else: <ide> # Regular URL pattern <del> regex = get_regex_pattern(urlpattern).rstrip('$').rstrip('/') + suffix_pattern <add> regex = urlpattern.pattern.regex.pattern.rstrip('$').rstrip('/') + suffix_pattern <ide> view = urlpattern.callback <ide> kwargs = urlpattern.default_args <ide> name = urlpattern.name <ide> def apply_suffix_patterns(urlpatterns, suffix_pattern, suffix_required, suffix_r <ide> ret.append(urlpattern) <ide> <ide> # if the original pattern was a RoutePattern we need to preserve it <del> if is_route_pattern(urlpattern): <add> if isinstance(urlpattern.pattern, RoutePattern): <ide> assert path is not None <ide> assert suffix_route is not None <ide> route = str(urlpattern.pattern).rstrip('$').rstrip('/') + suffix_route <ide><path>tests/schemas/test_coreapi.py <ide> from rest_framework import ( <ide> filters, generics, pagination, permissions, serializers <ide> ) <del>from rest_framework.compat import coreapi, coreschema, get_regex_pattern <add>from rest_framework.compat import coreapi, coreschema <ide> from rest_framework.decorators import action, api_view, schema <ide> from rest_framework.request import Request <ide> from rest_framework.routers import DefaultRouter, SimpleRouter <ide> def test_should_include_endpoint_excludes_correctly(self): <ide> inspector = EndpointEnumerator(self.patterns) <ide> <ide> # Not pretty. Mimics internals of EndpointEnumerator to put should_include_endpoint under test <del> pairs = [(inspector.get_path_from_regex(get_regex_pattern(pattern)), pattern.callback) <add> pairs = [(inspector.get_path_from_regex(pattern.pattern.regex.pattern), pattern.callback) <ide> for pattern in self.patterns] <ide> <ide> should_include = [ <ide><path>tests/test_filters.py <ide> import datetime <ide> from importlib import reload as reload_module <ide> <del>import django <ide> import pytest <ide> from django.core.exceptions import ImproperlyConfigured <ide> from django.db import models <ide> def test_search_field_with_null_characters(self): <ide> <ide> assert terms == ['asdf'] <ide> <del> @pytest.mark.skipif(django.VERSION[:2] < (2, 2), reason="requires django 2.2 or higher") <ide> def test_search_field_with_additional_transforms(self): <ide> from django.test.utils import register_lookup <ide> <ide><path>tests/test_routers.py <ide> from django.urls import resolve, reverse <ide> <ide> from rest_framework import permissions, serializers, viewsets <del>from rest_framework.compat import get_regex_pattern <ide> from rest_framework.decorators import action <ide> from rest_framework.response import Response <ide> from rest_framework.routers import DefaultRouter, SimpleRouter <ide> def setUp(self): <ide> <ide> def test_custom_lookup_field_route(self): <ide> detail_route = notes_router.urls[-1] <del> detail_url_pattern = get_regex_pattern(detail_route) <del> assert '<uuid>' in detail_url_pattern <add> assert '<uuid>' in detail_route.pattern.regex.pattern <ide> <ide> def test_retrieve_lookup_field_list_view(self): <ide> response = self.client.get('/example/notes/') <ide> class NoteViewSet(viewsets.ModelViewSet): <ide> def test_urls_limited_by_lookup_value_regex(self): <ide> expected = ['^notes/$', '^notes/(?P<uuid>[0-9a-f]{32})/$'] <ide> for idx in range(len(expected)): <del> assert expected[idx] == get_regex_pattern(self.urls[idx]) <add> assert expected[idx] == self.urls[idx].pattern.regex.pattern <ide> <ide> <ide> @override_settings(ROOT_URLCONF='tests.test_routers') <ide> def setUp(self): <ide> <ide> def test_custom_lookup_url_kwarg_route(self): <ide> detail_route = kwarged_notes_router.urls[-1] <del> detail_url_pattern = get_regex_pattern(detail_route) <del> assert '^notes/(?P<text>' in detail_url_pattern <add> assert '^notes/(?P<text>' in detail_route.pattern.regex.pattern <ide> <ide> def test_retrieve_lookup_url_kwarg_detail_view(self): <ide> response = self.client.get('/example2/notes/fo/') <ide> class NoteViewSet(viewsets.ModelViewSet): <ide> def test_urls_have_trailing_slash_by_default(self): <ide> expected = ['^notes/$', '^notes/(?P<pk>[^/.]+)/$'] <ide> for idx in range(len(expected)): <del> assert expected[idx] == get_regex_pattern(self.urls[idx]) <add> assert expected[idx] == self.urls[idx].pattern.regex.pattern <ide> <ide> <ide> class TestTrailingSlashRemoved(TestCase): <ide> class NoteViewSet(viewsets.ModelViewSet): <ide> def test_urls_can_have_trailing_slash_removed(self): <ide> expected = ['^notes$', '^notes/(?P<pk>[^/.]+)$'] <ide> for idx in range(len(expected)): <del> assert expected[idx] == get_regex_pattern(self.urls[idx]) <add> assert expected[idx] == self.urls[idx].pattern.regex.pattern <ide> <ide> <ide> class TestNameableRoot(TestCase): <ide><path>tests/test_urlpatterns.py <ide> <ide> from django.conf.urls import include, url <ide> from django.test import TestCase <del>from django.urls import Resolver404, path, re_path <add>from django.urls import Resolver404, URLResolver, path, re_path <add>from django.urls.resolvers import RegexPattern <ide> <del>from rest_framework.compat import make_url_resolver <ide> from rest_framework.test import APIRequestFactory <ide> from rest_framework.urlpatterns import format_suffix_patterns <ide> <ide> def _resolve_urlpatterns(self, urlpatterns, test_paths, allowed=None): <ide> urlpatterns = format_suffix_patterns(urlpatterns, allowed=allowed) <ide> except Exception: <ide> self.fail("Failed to apply `format_suffix_patterns` on the supplied urlpatterns") <del> resolver = make_url_resolver(r'^/', urlpatterns) <add> resolver = URLResolver(RegexPattern(r'^/'), urlpatterns) <ide> for test_path in test_paths: <ide> try: <ide> test_path, expected_resolved = test_path
7
Ruby
Ruby
fix bad parameters
92cb62dace2d4e9480b2e9cac27239798dc89d95
<ide><path>Library/Homebrew/utils.rb <ide> def install_gem!(name) <ide> # having to find the right `gem` binary for the running Ruby interpreter. <ide> require "rubygems/commands/install_command" <ide> install_cmd = Gem::Commands::InstallCommand.new <del> install_cmd.handle_options("--no-document", name) <add> install_cmd.handle_options(["--no-document", name]) <ide> exit_code = 1 # Should not matter as `install_cmd.execute` always throws. <ide> begin <ide> install_cmd.execute
1
Go
Go
use human readable units when listing secrets
880e8be1eea086ee83e5ad22f953696365c5b799
<ide><path>cli/command/secret/ls.go <ide> import ( <ide> "context" <ide> "fmt" <ide> "text/tabwriter" <add> "time" <ide> <ide> "github.com/docker/docker/api/types" <ide> "github.com/docker/docker/cli" <ide> "github.com/docker/docker/cli/command" <add> "github.com/docker/go-units" <ide> "github.com/spf13/cobra" <ide> ) <ide> <ide> func runSecretList(dockerCli *command.DockerCli, opts listOptions) error { <ide> fmt.Fprintf(w, "\n") <ide> <ide> for _, s := range secrets { <del> fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%d\n", s.ID, s.Spec.Annotations.Name, s.Meta.CreatedAt, s.Meta.UpdatedAt, s.SecretSize) <add> created := units.HumanDuration(time.Now().UTC().Sub(s.Meta.CreatedAt)) + " ago" <add> updated := units.HumanDuration(time.Now().UTC().Sub(s.Meta.UpdatedAt)) + " ago" <add> size := units.HumanSizeWithPrecision(float64(s.SecretSize), 3) <add> <add> fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\n", s.ID, s.Spec.Annotations.Name, created, updated, size) <ide> } <ide> } <ide>
1
Text
Text
improve documentation of fs sync methods
65208d038e76cf24ba1afe6768d7b053b3bbf3f3
<ide><path>doc/api/fs.md <ide> changes: <ide> * `path` {string|Buffer|URL} <ide> * `mode` {integer} <ide> <del>Synchronously changes the permissions of a file. Returns `undefined`. <del>This is the synchronous version of [`fs.chmod()`][]. <add>For detailed information, see the documentation of the asynchronous version of <add>this API: [`fs.chmod()`][]. <ide> <ide> See also: chmod(2). <ide> <ide> changes: <ide> * `path` {string|Buffer|URL} <ide> * Returns: {boolean} <ide> <del>Synchronous version of [`fs.exists()`][]. <ide> Returns `true` if the path exists, `false` otherwise. <ide> <add>For detailed information, see the documentation of the asynchronous version of <add>this API: [`fs.exists()`][]. <add> <ide> `fs.exists()` is deprecated, but `fs.existsSync()` is not. The `callback` <ide> parameter to `fs.exists()` accepts parameters that are inconsistent with other <ide> Node.js callbacks. `fs.existsSync()` does not use a callback. <ide> <add> <ide> ## fs.fchmod(fd, mode, callback) <ide> <!-- YAML <ide> added: v0.4.7 <ide> added: v0.8.6 <ide> * `fd` {integer} <ide> * `len` {integer} **Default:** `0` <ide> <del>Synchronous ftruncate(2). Returns `undefined`. <add>Returns `undefined`. <add> <add>For detailed information, see the documentation of the asynchronous version of <add>this API: [`fs.ftruncate()`][]. <ide> <ide> ## fs.futimes(fd, atime, mtime, callback) <ide> <!-- YAML <ide> added: v5.10.0 <ide> * `encoding` {string} **Default:** `'utf8'` <ide> * Returns: {string} <ide> <del>The synchronous version of [`fs.mkdtemp()`][]. Returns the created <del>folder path. <add>Returns the created folder path. <add> <add>For detailed information, see the documentation of the asynchronous version of <add>this API: [`fs.mkdtemp()`][]. <ide> <ide> The optional `options` argument can be a string specifying an encoding, or an <ide> object with an `encoding` property specifying the character encoding to use. <ide> changes: <ide> * `mode` {integer} **Default:** `0o666` <ide> * Returns: {number} <ide> <del>Synchronous version of [`fs.open()`][]. Returns an integer representing the file <del>descriptor. <add>Returns an integer representing the file descriptor. <add> <add>For detailed information, see the documentation of the asynchronous version of <add>this API: [`fs.open()`][]. <ide> <ide> ## fs.read(fd, buffer, offset, length, position, callback) <ide> <!-- YAML <ide> changes: <ide> * `flag` {string} See [support of file system `flags`][]. **Default:** `'r'`. <ide> * Returns: {string|Buffer} <ide> <del>Synchronous version of [`fs.readFile()`][]. Returns the contents of the `path`. <add>Returns the contents of the `path`. <add> <add>For detailed information, see the documentation of the asynchronous version of <add>this API: [`fs.readFile()`][]. <ide> <ide> If the `encoding` option is specified then this function returns a <ide> string. Otherwise it returns a buffer. <ide> changes: <ide> * `position` {integer} <ide> * Returns: {number} <ide> <del>Synchronous version of [`fs.read()`][]. Returns the number of `bytesRead`. <add>Returns the number of `bytesRead`. <add> <add>For detailed information, see the documentation of the asynchronous version of <add>this API: [`fs.read()`][]. <ide> <ide> ## fs.realpath(path[, options], callback) <ide> <!-- YAML <ide> changes: <ide> * `encoding` {string} **Default:** `'utf8'` <ide> * Returns: {string|Buffer} <ide> <del>Synchronous version of [`fs.realpath()`][]. Returns the resolved pathname. <add>Returns the resolved pathname. <add> <add>For detailed information, see the documentation of the asynchronous version of <add>this API: [`fs.realpath()`][]. <ide> <ide> ## fs.realpathSync.native(path[, options]) <ide> <!-- YAML <ide> changes: <ide> * `path` {string|Buffer|URL} <ide> * `type` {string} **Default:** `'file'` <ide> <del>Synchronous symlink(2). Returns `undefined`. <add>Returns `undefined`. <add> <add>For detailed information, see the documentation of the asynchronous version of <add>this API: [`fs.symlink()`][]. <ide> <ide> ## fs.truncate(path[, len], callback) <ide> <!-- YAML <ide> changes: <ide> * `atime` {integer} <ide> * `mtime` {integer} <ide> <del>Synchronous version of [`fs.utimes()`][]. Returns `undefined`. <add>Returns `undefined`. <add> <add>For detailed information, see the documentation of the asynchronous version of <add>this API: [`fs.utimes()`][]. <ide> <ide> ## fs.watch(filename[, options][, listener]) <ide> <!-- YAML <ide> changes: <ide> * `mode` {integer} **Default:** `0o666` <ide> * `flag` {string} See [support of file system `flags`][]. **Default:** `'w'`. <ide> <del>The synchronous version of [`fs.writeFile()`][]. Returns `undefined`. <add>Returns `undefined`. <add> <add>For detailed information, see the documentation of the asynchronous version of <add>this API: [`fs.writeFile()`][]. <ide> <ide> ## fs.writeSync(fd, buffer[, offset[, length[, position]]]) <ide> <!-- YAML <ide> changes: <ide> * `encoding` {string} <ide> * Returns: {number} <ide> <del>Synchronous versions of [`fs.write()`][]. Returns the number of bytes written. <add>Returns the number of bytes written. <add> <add>For detailed information, see the documentation of the asynchronous version of <add>this API: [`fs.write()`][]. <ide> <ide> ## fs Promises API <ide> <ide> the file contents. <ide> [`fs.copyFile()`]: #fs_fs_copyfile_src_dest_flags_callback <ide> [`fs.exists()`]: fs.html#fs_fs_exists_path_callback <ide> [`fs.fstat()`]: #fs_fs_fstat_fd_options_callback <add>[`fs.ftruncate()`]: #fs_fs_ftruncate_fd_len_callback <ide> [`fs.futimes()`]: #fs_fs_futimes_fd_atime_mtime_callback <ide> [`fs.lstat()`]: #fs_fs_lstat_path_options_callback <ide> [`fs.mkdir()`]: #fs_fs_mkdir_path_mode_callback <ide> the file contents. <ide> [`fs.realpath()`]: #fs_fs_realpath_path_options_callback <ide> [`fs.rmdir()`]: #fs_fs_rmdir_path_callback <ide> [`fs.stat()`]: #fs_fs_stat_path_options_callback <add>[`fs.symlink()`]: #fs_fs_symlink_target_path_type_callback <ide> [`fs.utimes()`]: #fs_fs_utimes_path_atime_mtime_callback <ide> [`fs.watch()`]: #fs_fs_watch_filename_options_listener <ide> [`fs.write()`]: #fs_fs_write_fd_buffer_offset_length_position_callback
1
Python
Python
grab sensors temperature threshold
d6cdf7485e2bf9570588a15a88c38c1e8545a7c3
<ide><path>glances/plugins/glances_sensors.py <ide> def __set_type(self, stats, sensor_type): <ide> <ide> def update_views(self): <ide> """Update stats views.""" <add> # @TODO: manage limits coming from system here for temperature_core <add> # ... <add> <ide> # Call the father's method <ide> super(Plugin, self).update_views() <ide> <ide> def update_views(self): <ide> if not i['value']: <ide> continue <ide> if i['type'] == 'battery': <del> self.views[i[self.get_key()]]['value']['decoration'] = self.get_alert(100 - i['value'], <add> self.views[i[self.get_key()]]['value']['decoration'] = self.get_alert(current=100 - i['value'], <ide> header=i['type']) <ide> else: <del> self.views[i[self.get_key()]]['value']['decoration'] = self.get_alert(i['value'], <add> self.views[i[self.get_key()]]['value']['decoration'] = self.get_alert(current=i['value'], <ide> header=i['type']) <ide> <ide> def msg_curse(self, args=None, max_width=None): <ide> def build_sensors_list(self, type): <ide> sensors_current['label'] = chipname + ' ' + str(i) <ide> else: <ide> sensors_current['label'] = feature.label <del> # Fan speed and unit <del> sensors_current['value'] = int(feature.current) <add> # Sensors value, limit and unit <add> sensors_current['value'] = int(getattr(feature, 'current', 0)) <add> sensors_current['warning'] = int(getattr(feature, 'high', 0)) <add> sensors_current['critical'] = int(getattr(feature, 'critical', 0)) <ide> sensors_current['unit'] = type <ide> # Add sensor to the list <ide> ret.append(sensors_current)
1
Javascript
Javascript
improve message in test-fs-readfile-pipe-large
9a1565e41af291bef8cbe4597d2789e64e9bc5b4
<ide><path>test/parallel/test-fs-readfile-pipe-large.js <ide> const node = JSON.stringify(process.execPath); <ide> const cmd = `cat ${filename} | ${node} ${f} child`; <ide> exec(cmd, { maxBuffer: 1000000 }, function(err, stdout, stderr) { <ide> assert.ifError(err); <del> assert.strictEqual(stdout, dataExpected, 'it reads the file and outputs it'); <del> assert.strictEqual(stderr, '', 'it does not write to stderr'); <add> assert.strictEqual( <add> stdout, <add> dataExpected, <add> `expect it reads the file and outputs 999999 'a' but got : ${stdout}` <add> ); <add> assert.strictEqual( <add> stderr, <add> '', <add> `expect that it does not write to stderr, but got : ${stderr}` <add> ); <ide> console.log('ok'); <ide> }); <ide>
1
Javascript
Javascript
show a toast for hmr
7c2c6a9d3f1eb48462cf5fbb333b2d438e9b48b2
<ide><path>Libraries/Utilities/HMRClient.js <ide> * of patent rights can be found in the PATENTS file in the same directory. <ide> * <ide> * @providesModule HMRClient <add> * @flow <ide> */ <ide> 'use strict'; <ide> <ide> const Platform = require('Platform'); <ide> const invariant = require('invariant'); <del>const processColor = require('processColor'); <ide> <ide> /** <ide> * HMR Client that receives from the server HMR updates and propagates them <ide> * runtime to reflects those changes. <ide> */ <ide> const HMRClient = { <del> enable(platform, bundleEntry, host, port) { <add> enable(platform: string, bundleEntry: string, host: string, port: number) { <ide> invariant(platform, 'Missing required parameter `platform`'); <ide> invariant(bundleEntry, 'Missing required paramenter `bundleEntry`'); <ide> invariant(host, 'Missing required paramenter `host`'); <ide> Error: ${e.message}` <ide> ); <ide> }; <ide> activeWS.onmessage = ({data}) => { <del> let DevLoadingView = require('NativeModules').DevLoadingView; <del> if (!DevLoadingView) { <del> DevLoadingView = { <del> showMessage() {}, <del> hide() {}, <del> }; <del> } <add> // Moving to top gives errors due to NativeModules not being initialized <add> const HMRLoadingView = require('HMRLoadingView'); <add> <ide> data = JSON.parse(data); <ide> <ide> switch (data.type) { <ide> case 'update-start': { <del> DevLoadingView.showMessage( <del> 'Hot Loading...', <del> processColor('#000000'), <del> processColor('#aaaaaa'), <del> ); <add> HMRLoadingView.showMessage('Hot Loading...'); <ide> break; <ide> } <ide> case 'update': { <ide> Error: ${e.message}` <ide> injectFunction(code, sourceURLs[i]); <ide> }); <ide> <del> DevLoadingView.hide(); <add> HMRLoadingView.hide(); <ide> break; <ide> } <ide> case 'update-done': { <del> DevLoadingView.hide(); <add> HMRLoadingView.hide(); <ide> break; <ide> } <ide> case 'error': { <del> DevLoadingView.hide(); <add> HMRLoadingView.hide(); <ide> throw new Error(data.body.type + ' ' + data.body.description); <ide> } <ide> default: { <ide><path>Libraries/Utilities/HMRLoadingView.android.js <add>/** <add> * Copyright (c) 2015-present, Facebook, Inc. <add> * All rights reserved. <add> * <add> * This source code is licensed under the BSD-style license found in the <add> * LICENSE file in the root directory of this source tree. An additional grant <add> * of patent rights can be found in the PATENTS file in the same directory. <add> * <add> * @providesModule HMRLoadingView <add> * @flow <add> */ <add> <add>'use strict'; <add> <add>var ToastAndroid = require('ToastAndroid'); <add> <add>const TOAST_SHORT_DELAY = 2000; <add> <add>class HMRLoadingView { <add> static _showing: boolean; <add> <add> static showMessage(message: string) { <add> if (HMRLoadingView._showing) { <add> return; <add> } <add> ToastAndroid.show(message, ToastAndroid.SHORT); <add> HMRLoadingView._showing = true; <add> setTimeout(() => { <add> HMRLoadingView._showing = false; <add> }, TOAST_SHORT_DELAY); <add> } <add> <add> static hide() { <add> // noop <add> } <add>} <add> <add>module.exports = HMRLoadingView; <ide><path>Libraries/Utilities/HMRLoadingView.ios.js <add>/** <add> * Copyright (c) 2015-present, Facebook, Inc. <add> * All rights reserved. <add> * <add> * This source code is licensed under the BSD-style license found in the <add> * LICENSE file in the root directory of this source tree. An additional grant <add> * of patent rights can be found in the PATENTS file in the same directory. <add> * <add> * @providesModule HMRLoadingView <add> * @flow <add> */ <add> <add>'use strict'; <add> <add>const processColor = require('processColor'); <add>const { DevLoadingView } = require('NativeModules'); <add> <add>class HMRLoadingView { <add> static showMessage(message: string) { <add> DevLoadingView.showMessage( <add> message, <add> processColor('#000000'), <add> processColor('#aaaaaa'), <add> ); <add> } <add> <add> static hide() { <add> DevLoadingView.hide(); <add> } <add>} <add> <add>module.exports = HMRLoadingView;
3
Javascript
Javascript
defer more field detachments to passive phase
ab29695a050b806492351250a24221d622d5e4cc
<ide><path>packages/react-reconciler/src/ReactFiberCommitWork.new.js <ide> function commitNestedUnmounts( <ide> } <ide> <ide> function detachFiberMutation(fiber: Fiber) { <del> // Cut off the return pointers to disconnect it from the tree. Ideally, we <del> // should clear the child pointer of the parent alternate to let this <add> // Cut off the return pointer to disconnect it from the tree. <add> // This enables us to detect and warn against state updates on an unmounted component. <add> // It also prevents events from bubbling from within disconnected components. <add> // <add> // Ideally, we should also clear the child pointer of the parent alternate to let this <ide> // get GC:ed but we don't know which for sure which parent is the current <del> // one so we'll settle for GC:ing the subtree of this child. This child <del> // itself will be GC:ed when the parent updates the next time. <del> // Note: we cannot null out sibling here, otherwise it can cause issues <del> // with findDOMNode and how it requires the sibling field to carry out <del> // traversal in a later effect. See PR #16820. We now clear the sibling <del> // field after effects, see: detachFiberAfterEffects. <add> // one so we'll settle for GC:ing the subtree of this child. <add> // This child itself will be GC:ed when the parent updates the next time. <ide> // <del> // Don't disconnect stateNode now; it will be detached in detachFiberAfterEffects. <del> // It may be required if the current component is an error boundary, <del> // and one of its descendants throws while unmounting a passive effect. <del> fiber.alternate = null; <add> // Note that we can't clear child or sibling pointers yet. <add> // They're needed for passive effects and for findDOMNode. <add> // We defer those fields, and all other cleanup, to the passive phase (see detachFiberAfterEffects). <add> const alternate = fiber.alternate; <add> if (alternate !== null) { <add> alternate.return = null; <add> fiber.alternate = null; <add> } <add> fiber.return = null; <add>} <add> <add>export function detachFiberAfterEffects(fiber: Fiber): void { <add> // Null out fields to improve GC for references that may be lingering (e.g. DevTools). <add> // Note that we already cleared the return pointer in detachFiberMutation(). <ide> fiber.child = null; <ide> fiber.deletions = null; <ide> fiber.dependencies = null; <del> fiber.firstEffect = null; <del> fiber.lastEffect = null; <ide> fiber.memoizedProps = null; <ide> fiber.memoizedState = null; <ide> fiber.pendingProps = null; <del> fiber.return = null; <add> fiber.sibling = null; <add> fiber.stateNode = null; <ide> fiber.updateQueue = null; <add> fiber.nextEffect = null; <add> fiber.firstEffect = null; <add> fiber.lastEffect = null; <add> <ide> if (__DEV__) { <ide> fiber._debugOwner = null; <ide> } <ide><path>packages/react-reconciler/src/ReactFiberCommitWork.old.js <ide> function commitNestedUnmounts( <ide> } <ide> <ide> function detachFiberMutation(fiber: Fiber) { <del> // Cut off the return pointers to disconnect it from the tree. Ideally, we <del> // should clear the child pointer of the parent alternate to let this <add> // Cut off the return pointer to disconnect it from the tree. <add> // This enables us to detect and warn against state updates on an unmounted component. <add> // It also prevents events from bubbling from within disconnected components. <add> // <add> // Ideally, we should also clear the child pointer of the parent alternate to let this <ide> // get GC:ed but we don't know which for sure which parent is the current <del> // one so we'll settle for GC:ing the subtree of this child. This child <del> // itself will be GC:ed when the parent updates the next time. <del> // Note: we cannot null out sibling here, otherwise it can cause issues <del> // with findDOMNode and how it requires the sibling field to carry out <del> // traversal in a later effect. See PR #16820. We now clear the sibling <del> // field after effects, see: detachFiberAfterEffects. <add> // one so we'll settle for GC:ing the subtree of this child. <add> // This child itself will be GC:ed when the parent updates the next time. <ide> // <del> // Don't disconnect stateNode now; it will be detached in detachFiberAfterEffects. <del> // It may be required if the current component is an error boundary, <del> // and one of its descendants throws while unmounting a passive effect. <del> fiber.alternate = null; <add> // Note that we can't clear child or sibling pointers yet. <add> // They're needed for passive effects and for findDOMNode. <add> // We defer those fields, and all other cleanup, to the passive phase (see detachFiberAfterEffects). <add> const alternate = fiber.alternate; <add> if (alternate !== null) { <add> alternate.return = null; <add> fiber.alternate = null; <add> } <add> fiber.return = null; <add>} <add> <add>export function detachFiberAfterEffects(fiber: Fiber): void { <add> // Null out fields to improve GC for references that may be lingering (e.g. DevTools). <add> // Note that we already cleared the return pointer in detachFiberMutation(). <ide> fiber.child = null; <ide> fiber.deletions = null; <ide> fiber.dependencies = null; <del> fiber.firstEffect = null; <del> fiber.lastEffect = null; <ide> fiber.memoizedProps = null; <ide> fiber.memoizedState = null; <ide> fiber.pendingProps = null; <del> fiber.return = null; <add> fiber.sibling = null; <add> fiber.stateNode = null; <ide> fiber.updateQueue = null; <add> fiber.nextEffect = null; <add> fiber.firstEffect = null; <add> fiber.lastEffect = null; <add> <ide> if (__DEV__) { <ide> fiber._debugOwner = null; <ide> } <ide><path>packages/react-reconciler/src/ReactFiberWorkLoop.new.js <ide> import { <ide> Update, <ide> PlacementAndUpdate, <ide> Deletion, <add> ChildDeletion, <ide> Ref, <ide> ContentReset, <ide> Snapshot, <ide> import { <ide> commitResetTextContent, <ide> isSuspenseBoundaryBeingHidden, <ide> commitPassiveMountEffects, <add> detachFiberAfterEffects, <ide> } from './ReactFiberCommitWork.new'; <ide> import {enqueueUpdate} from './ReactUpdateQueue.new'; <ide> import {resetContextDependencies} from './ReactFiberNewContext.new'; <ide> function commitRootImpl(root, renderPriorityLevel) { <ide> } else { <ide> // We are done with the effect chain at this point so let's clear the <ide> // nextEffect pointers to assist with GC. If we have passive effects, we'll <del> // clear this in flushPassiveEffects. <add> // clear this in flushPassiveEffects <add> // TODO: We should always do this in the passive phase, by scheduling <add> // a passive callback for every deletion. <ide> nextEffect = firstEffect; <ide> while (nextEffect !== null) { <ide> const nextNextEffect = nextEffect.nextEffect; <ide> nextEffect.nextEffect = null; <del> if (nextEffect.flags & Deletion) { <del> detachFiberAfterEffects(nextEffect); <add> if (nextEffect.flags & ChildDeletion) { <add> const deletions = nextEffect.deletions; <add> if (deletions !== null) { <add> for (let i = 0; i < deletions.length; i++) { <add> const deletion = deletions[i]; <add> detachFiberAfterEffects(deletion); <add> } <add> } <ide> } <ide> nextEffect = nextNextEffect; <ide> } <ide> export function act(callback: () => Thenable<mixed>): Thenable<void> { <ide> }; <ide> } <ide> } <del> <del>function detachFiberAfterEffects(fiber: Fiber): void { <del> fiber.sibling = null; <del> fiber.stateNode = null; <del>} <ide><path>packages/react-reconciler/src/ReactFiberWorkLoop.old.js <ide> import { <ide> Update, <ide> PlacementAndUpdate, <ide> Deletion, <add> ChildDeletion, <ide> Ref, <ide> ContentReset, <ide> Snapshot, <ide> import { <ide> commitResetTextContent, <ide> isSuspenseBoundaryBeingHidden, <ide> commitPassiveMountEffects, <add> detachFiberAfterEffects, <ide> } from './ReactFiberCommitWork.old'; <ide> import {enqueueUpdate} from './ReactUpdateQueue.old'; <ide> import {resetContextDependencies} from './ReactFiberNewContext.old'; <ide> function commitRootImpl(root, renderPriorityLevel) { <ide> } else { <ide> // We are done with the effect chain at this point so let's clear the <ide> // nextEffect pointers to assist with GC. If we have passive effects, we'll <del> // clear this in flushPassiveEffects. <add> // clear this in flushPassiveEffects <add> // TODO: We should always do this in the passive phase, by scheduling <add> // a passive callback for every deletion. <ide> nextEffect = firstEffect; <ide> while (nextEffect !== null) { <ide> const nextNextEffect = nextEffect.nextEffect; <ide> nextEffect.nextEffect = null; <del> if (nextEffect.flags & Deletion) { <del> detachFiberAfterEffects(nextEffect); <add> if (nextEffect.flags & ChildDeletion) { <add> const deletions = nextEffect.deletions; <add> if (deletions !== null) { <add> for (let i = 0; i < deletions.length; i++) { <add> const deletion = deletions[i]; <add> detachFiberAfterEffects(deletion); <add> } <add> } <ide> } <ide> nextEffect = nextNextEffect; <ide> } <ide> export function act(callback: () => Thenable<mixed>): Thenable<void> { <ide> }; <ide> } <ide> } <del> <del>function detachFiberAfterEffects(fiber: Fiber): void { <del> fiber.sibling = null; <del> fiber.stateNode = null; <del>}
4
Javascript
Javascript
add writable* properties to compat api
99abaf9658861d21dfa20bf50b6076061e033973
<ide><path>lib/internal/http2/compat.js <ide> class Http2ServerResponse extends Stream { <ide> return this[kStream].writableCorked; <ide> } <ide> <add> get writableHighWaterMark() { <add> return this[kStream].writableHighWaterMark; <add> } <add> <add> get writableFinished() { <add> return this[kStream].writableFinished; <add> } <add> <add> get writableLength() { <add> return this[kStream].writableLength; <add> } <add> <ide> set statusCode(code) { <ide> code |= 0; <ide> if (code >= 100 && code < 200) <ide><path>test/parallel/test-http2-res-writable-properties.js <add>'use strict'; <add>const common = require('../common'); <add>if (!common.hasCrypto) { common.skip('missing crypto'); } <add>const assert = require('assert'); <add>const http2 = require('http2'); <add> <add>const server = http2.createServer(common.mustCall((req, res) => { <add> const hwm = req.socket.writableHighWaterMark; <add> assert.strictEqual(res.writableHighWaterMark, hwm); <add> assert.strictEqual(res.writableLength, 0); <add> res.write(''); <add> const len = res.writableLength; <add> res.write('asd'); <add> assert.strictEqual(res.writableLength, len + 3); <add> res.end(); <add> res.on('finish', common.mustCall(() => { <add> assert.strictEqual(res.writableLength, 0); <add> assert.ok(res.writableFinished, 'writableFinished is not truthy'); <add> server.close(); <add> })); <add>})); <add> <add>server.listen(0, common.mustCall(() => { <add> const client = http2.connect(`http://localhost:${server.address().port}`); <add> const request = client.request(); <add> request.on('data', common.mustCall()); <add> request.on('end', common.mustCall(() => { <add> client.close(); <add> })); <add>}));
2
Python
Python
move _no_tracing to testing._private
16e9d42c120a66fefaacb45684a3ff52944a4b38
<ide><path>numpy/core/tests/test_multiarray.py <ide> assert_allclose, IS_PYPY, HAS_REFCOUNT, assert_array_less, runstring, <ide> temppath, suppress_warnings, break_cycles, <ide> ) <add>from numpy.testing._private.utils import _no_tracing <ide> from numpy.core.tests._locales import CommaDecimalPointLocale <ide> <ide> # Need to test an object that does not fully implement math interface <ide> def _aligned_zeros(shape, dtype=float, order="C", align=None): <ide> data.fill(0) <ide> return data <ide> <del>def _no_tracing(func): <del> """ <del> Decorator to temporarily turn off tracing for the duration of a test. <del> Needed in tests that check refcounting, otherwise the tracing itself <del> influences the refcounts <del> """ <del> if not hasattr(sys, 'gettrace'): <del> return func <del> else: <del> @functools.wraps(func) <del> def wrapper(*args, **kwargs): <del> original_trace = sys.gettrace() <del> try: <del> sys.settrace(None) <del> return func(*args, **kwargs) <del> finally: <del> sys.settrace(original_trace) <del> return wrapper <del> <del> <ide> <ide> class TestFlags: <ide> def setup(self): <ide><path>numpy/core/tests/test_regression.py <ide> assert_raises_regex, assert_warns, suppress_warnings, <ide> _assert_valid_refcount, HAS_REFCOUNT, <ide> ) <add>from numpy.testing._private.utils import _no_tracing <ide> from numpy.compat import asbytes, asunicode, long, pickle <del>from test.support import no_tracing <ide> <ide> try: <ide> RecursionError <ide> def test_void_scalar_constructor(self): <ide> assert_(pickle.loads( <ide> pickle.dumps(test_record, protocol=proto)) == test_record) <ide> <del> @no_tracing <add> @_no_tracing <ide> def test_blasdot_uninitialized_memory(self): <ide> # Ticket #950 <ide> for m in [0, 1, 2]: <ide><path>numpy/testing/_private/utils.py <ide> def _get_mem_available(): <ide> return info['memfree'] + info['cached'] <ide> <ide> return None <add> <add> <add>def _no_tracing(func): <add> """ <add> Decorator to temporarily turn off tracing for the duration of a test. <add> Needed in tests that check refcounting, otherwise the tracing itself <add> influences the refcounts <add> """ <add> if not hasattr(sys, 'gettrace'): <add> return func <add> else: <add> @wraps(func) <add> def wrapper(*args, **kwargs): <add> original_trace = sys.gettrace() <add> try: <add> sys.settrace(None) <add> return func(*args, **kwargs) <add> finally: <add> sys.settrace(original_trace) <add> return wrapper <add>
3
Python
Python
remove unused imports
2d29d46f319719487ba160faa244df930995ee84
<ide><path>libcloud/storage/drivers/cloudfiles.py <ide> except: <ide> import simplejson as json <ide> <del>from libcloud.utils import fixxpath, findtext, in_development_warning <ide> from libcloud.utils import read_in_chunks <ide> from libcloud.common.types import MalformedResponseError, LibcloudError <ide> from libcloud.common.base import Response
1
Text
Text
add note in next/link docs about anchor props
1fa7114a010515f8c0d3d7ada436ba9290ec38e9
<ide><path>docs/api-reference/next/link.md <ide> export default Home <ide> - [`shallow`](/docs/routing/shallow-routing.md) - Update the path of the current page without rerunning [`getStaticProps`](/docs/basic-features/data-fetching/get-static-props.md), [`getServerSideProps`](/docs/basic-features/data-fetching/get-server-side-props.md) or [`getInitialProps`](/docs/api-reference/data-fetching/get-initial-props.md). Defaults to `false` <ide> - `locale` - The active locale is automatically prepended. `locale` allows for providing a different locale. When `false` `href` has to include the locale as the default behavior is disabled. <ide> <add>Note, when `legacyBehavior` is not set to `true`, all [`anchor`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a) tag properties can be passed to `next/link` as well such as, `className`, `onClick`, etc. <add> <ide> ## If the route has dynamic segments <ide> <ide> There is nothing to do when linking to a [dynamic route](/docs/routing/dynamic-routes.md), including [catch all routes](/docs/routing/dynamic-routes.md#catch-all-routes), since Next.js 9.5.3 (for older versions check our [previous docs](https://nextjs.org/docs/tag/v9.5.2/api-reference/next/link#dynamic-routes)). However, it can become quite common and handy to use [interpolation](/docs/routing/introduction.md#linking-to-dynamic-paths) or an [URL Object](#with-url-object) to generate the link.
1
Go
Go
move envconfig generation to lxc driver
4994b0fe5459996691dde18155a7b712762e8e53
<ide><path>daemon/container.go <ide> func (container *Container) WriteHostConfig() (err error) { <ide> return ioutil.WriteFile(container.hostConfigPath(), data, 0666) <ide> } <ide> <del>func (container *Container) generateEnvConfig(env []string) error { <del> data, err := json.Marshal(env) <del> if err != nil { <del> return err <del> } <del> p, err := container.EnvConfigPath() <del> if err != nil { <del> return err <del> } <del> ioutil.WriteFile(p, data, 0600) <del> return nil <del>} <del> <ide> func (container *Container) Attach(stdin io.ReadCloser, stdinCloser io.Closer, stdout io.Writer, stderr io.Writer) chan error { <ide> var cStdout, cStderr io.ReadCloser <ide> <ide> func (container *Container) Start() (err error) { <ide> if err != nil { <ide> return err <ide> } <del> env := container.createDaemonEnvironment(linkedEnv) <del> // TODO: This is only needed for lxc so we should look for a way to <del> // remove this dep <del> if err := container.generateEnvConfig(env); err != nil { <del> return err <del> } <ide> if err := container.setupWorkingDirectory(); err != nil { <ide> return err <ide> } <add> env := container.createDaemonEnvironment(linkedEnv) <ide> if err := populateCommand(container, env); err != nil { <ide> return err <ide> } <ide> func (container *Container) jsonPath() string { <ide> return path.Join(container.root, "config.json") <ide> } <ide> <del>func (container *Container) EnvConfigPath() (string, error) { <del> p := path.Join(container.root, "config.env") <del> if _, err := os.Stat(p); err != nil { <del> if os.IsNotExist(err) { <del> f, err := os.Create(p) <del> if err != nil { <del> return "", err <del> } <del> f.Close() <del> } else { <del> return "", err <del> } <del> } <del> return p, nil <del>} <del> <ide> // This method must be exported to be used from the lxc template <ide> // This directory is only usable when the container is running <ide> func (container *Container) RootfsPath() string { <ide><path>daemon/execdriver/lxc/driver.go <ide> package lxc <ide> <ide> import ( <add> "encoding/json" <ide> "fmt" <ide> "io/ioutil" <ide> "log" <ide> func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba <ide> if err := execdriver.SetTerminal(c, pipes); err != nil { <ide> return -1, err <ide> } <add> if err := d.generateEnvConfig(c); err != nil { <add> return -1, err <add> } <ide> configPath, err := d.generateLXCConfig(c) <ide> if err != nil { <ide> return -1, err <ide> func (d *driver) generateLXCConfig(c *execdriver.Command) (string, error) { <ide> } <ide> return root, nil <ide> } <add> <add>func (d *driver) generateEnvConfig(c *execdriver.Command) error { <add> data, err := json.Marshal(c.Env) <add> if err != nil { <add> return err <add> } <add> p := path.Join(d.root, "containers", c.ID, "config.env") <add> c.Mounts = append(c.Mounts, execdriver.Mount{p, "/.dockerenv", false, true}) <add> <add> return ioutil.WriteFile(p, data, 0600) <add>} <ide><path>daemon/volumes.go <ide> package daemon <ide> <ide> import ( <ide> "fmt" <del> "github.com/dotcloud/docker/archive" <del> "github.com/dotcloud/docker/daemon/execdriver" <del> "github.com/dotcloud/docker/utils" <ide> "io/ioutil" <ide> "os" <ide> "path/filepath" <ide> "strings" <ide> "syscall" <add> <add> "github.com/dotcloud/docker/archive" <add> "github.com/dotcloud/docker/daemon/execdriver" <add> "github.com/dotcloud/docker/utils" <ide> ) <ide> <ide> type BindMap struct { <ide> func prepareVolumesForContainer(container *Container) error { <ide> } <ide> <ide> func setupMountsForContainer(container *Container) error { <del> envPath, err := container.EnvConfigPath() <del> if err != nil { <del> return err <del> } <del> <ide> mounts := []execdriver.Mount{ <ide> {container.daemon.sysInitPath, "/.dockerinit", false, true}, <del> {envPath, "/.dockerenv", false, true}, <ide> {container.ResolvConfPath, "/etc/resolv.conf", false, true}, <ide> } <ide>
3
Text
Text
add new tip
2aeb03d17d8ca244a64045aa6c4b2b3708095944
<ide><path>guide/english/miscellaneous/tips-for-your-coding/index.md <ide> This list was created by compiling common issues and questions when working on t <ide> <ide> 3. Use the chrome javascript debugger console in conjunction with something like the netbeans IDE or sublime text to write your code. Both are free to download. The freeCodeCamp code editor is great but you can get a lot more feedback on your code's behaviour by using chrome's JS debugger and a bunch of **console.log(myVariableGoesHere);** <ide> <del>4. Posting your code in Gitter is as simple as adding a line consisting of only 3 backtics **`** then your code in a new line and another line with 3 more backtics.` <del> <del>5. Ask for help in Gitter! I can personally relate to staring at a problem for hours, then seeing the solution as soon as I try to explain it to someone, or having someone say something like "typo on line 6" as soon as they see it. Take advantage of message boards and social media groups as well as in-person peers to attempt to have a fresh set of eyes glance over your work. <del> <add>4. Use your resources. Stack overflow is your friend, and so is Google. However, don't limit yourself to just non-human resources. Sometimes talking about your code to a real person is enough to get you back on track, or spur some new ideas. <ide> <ide> References <ide>
1
Ruby
Ruby
test the full incineration flow
2e4df7cea354339cbae20252ae14106a0cce12b5
<ide><path>test/unit/inbound_email/incineration_test.rb <ide> class ActionMailbox::InboundEmail::IncinerationTest < ActiveSupport::TestCase <ide> assert_enqueued_with job: ActionMailbox::IncinerationJob, at: 30.days.from_now do <ide> create_inbound_email_from_fixture("welcome.eml").delivered! <ide> end <add> <add> travel 30.days <add> <add> assert_difference -> { ActionMailbox::InboundEmail.count }, -1 do <add> perform_enqueued_jobs only: ActionMailbox::IncinerationJob <add> end <ide> end <ide> <ide> test "incinerating 30 days after bounce" do <ide> class ActionMailbox::InboundEmail::IncinerationTest < ActiveSupport::TestCase <ide> assert_enqueued_with job: ActionMailbox::IncinerationJob, at: 30.days.from_now do <ide> create_inbound_email_from_fixture("welcome.eml").bounced! <ide> end <add> <add> travel 30.days <add> <add> assert_difference -> { ActionMailbox::InboundEmail.count }, -1 do <add> perform_enqueued_jobs only: ActionMailbox::IncinerationJob <add> end <ide> end <ide> <ide> test "incinerating 30 days after failure" do <ide> class ActionMailbox::InboundEmail::IncinerationTest < ActiveSupport::TestCase <ide> assert_enqueued_with job: ActionMailbox::IncinerationJob, at: 30.days.from_now do <ide> create_inbound_email_from_fixture("welcome.eml").failed! <ide> end <add> <add> travel 30.days <add> <add> assert_difference -> { ActionMailbox::InboundEmail.count }, -1 do <add> perform_enqueued_jobs only: ActionMailbox::IncinerationJob <add> end <ide> end <ide> end
1
Javascript
Javascript
remove type duplication
c6c3eba1c0d0182de5218067306de267a0e47a56
<ide><path>lib/Compiler.js <ide> const ConcurrentCompilationError = require("./ConcurrentCompilationError"); <ide> */ <ide> <ide> /** @typedef {string|string[]} EntryValues */ <del>/** @typedef {{[entryKey: string]: EntryValues}} EntryOptionValues */ <del>/** @typedef {(() => EntryOptionValues) | EntryOptionValues | EntryValues} EntryOptions */ <add>/** @typedef {Record<string, EntryValues>} EntryOptionValues */ <add> <add>/** <add> * @callback EntryOptionValuesFunction <add> * @returns {EntryOptionValues | EntryValues} the computed value <add> */ <add> <add>/** @typedef {EntryOptionValuesFunction | EntryOptionValues | EntryValues} EntryOptions */ <ide> <ide> class Compiler extends Tapable { <ide> constructor(context) { <ide><path>lib/DynamicEntryPlugin.js <ide> const MultiEntryPlugin = require("./MultiEntryPlugin"); <ide> const SingleEntryPlugin = require("./SingleEntryPlugin"); <ide> <ide> /** @typedef {import("./Compiler")} Compiler */ <del>/** @typedef {string|string[]} EntryValues */ <del>/** @typedef {Record<string, EntryValues>} EntryOptionValues */ <del> <del>/** <del> * @callback EntryOptionValuesFunction <del> * @returns {EntryOptionValues | EntryValues} the computed value <del> */ <add>/** @typedef {import("./Compiler").EntryOptionValuesFunction} EntryOptionValuesFunction */ <ide> <ide> class DynamicEntryPlugin { <ide> /**
2
PHP
PHP
fix null column errors in sqlite and postgres
ddd3baf7038e146cc1008481cce07545d3c5d529
<ide><path>lib/Cake/Test/Case/Model/Behavior/TreeBehaviorScopedTest.php <ide> public function testTranslatingTree() { <ide> $this->Tree->locale = 'eng'; <ide> $data = array('FlagTree' => array( <ide> 'title' => 'name #1', <add> 'name' => 'test', <ide> 'locale' => 'eng', <ide> 'parent_id' => null, <ide> )); <ide> public function testTranslatingTree() { <ide> $expected = array(array('FlagTree' => array( <ide> 'id' => 1, <ide> 'title' => 'name #1', <del> 'name' => '', <add> 'name' => 'test', <ide> 'parent_id' => null, <ide> 'lft' => 1, <ide> 'rght' => 2, <ide> public function testTranslatingTree() { <ide> $expected = array(array('FlagTree' => array( <ide> 'id' => 1, <ide> 'title' => 'Named 2', <del> 'name' => '', <add> 'name' => 'test', <ide> 'parent_id' => null, <ide> 'lft' => 1, <ide> 'rght' => 2, <ide> public function testTranslatingTree() { <ide> 'id' => 1, <ide> 'parent_id' => null, <ide> 'title' => 'namen #1', <add> 'name' => 'test', <ide> 'locale' => 'deu', <ide> )); <ide> $this->Tree->save($data); <ide> public function testTranslatingTree() { <ide> 'FlagTree' => array( <ide> 'id' => 1, <ide> 'title' => 'namen #1', <del> 'name' => '', <add> 'name' => 'test', <ide> 'parent_id' => null, <ide> 'lft' => 1, <ide> 'rght' => 2, <ide> public function testTranslatingTree() { <ide> $this->Tree->locale = 'eng'; <ide> $data = array( <ide> 'title' => array('eng' => 'New title', 'spa' => 'Nuevo leyenda'), <add> 'name' => 'test', <ide> 'parent_id' => null <ide> ); <ide> $this->Tree->create($data); <ide> public function testTranslatingTree() { <ide> 'id' => 2, <ide> 'parent_id' => null, <ide> 'locale' => 'eng', <del> 'name' => '', <add> 'name' => 'test', <ide> 'title' => 'New title', <ide> 'flag' => 0, <ide> 'lft' => 3,
1
Text
Text
use the visual as thumbnail
b4691a438d9a20297eb8e4856d36067272fa8f5a
<ide><path>model_cards/canwenxu/BERT-of-Theseus-MNLI/README.md <add>--- <add>thumbnail: https://github.com/JetRunner/BERT-of-Theseus/blob/master/bert-of-theseus.png?raw=true <add>--- <add> <ide> # BERT-of-Theseus <ide> See our paper ["BERT-of-Theseus: Compressing BERT by Progressive Module Replacing"](http://arxiv.org/abs/2002.02925). <ide>
1
Mixed
Javascript
add selectioncolor prop for text on android
72be2d35cca208d0b52b3c751ac01bf7a6bb28a8
<ide><path>Examples/UIExplorer/js/TextExample.android.js <ide> class TextExample extends React.Component { <ide> </Text> <ide> </UIExplorerBlock> <ide> <UIExplorerBlock title="selectable attribute"> <del> <Text selectable={true}> <add> <Text selectable> <ide> This text is selectable if you click-and-hold, and will offer the native Android selection menus. <ide> </Text> <ide> </UIExplorerBlock> <add> <UIExplorerBlock title="selectionColor attribute"> <add> <Text selectable selectionColor="orange"> <add> This text will have a orange highlight on selection. <add> </Text> <add> </UIExplorerBlock> <ide> <UIExplorerBlock title="Inline images"> <ide> <Text> <ide> This text contains an inline image <Image source={require('./flux.png')}/>. Neat, huh? <ide><path>Libraries/Text/Text.js <ide> */ <ide> 'use strict'; <ide> <add>const ColorPropType = require('ColorPropType'); <ide> const EdgeInsetsPropType = require('EdgeInsetsPropType'); <ide> const NativeMethodsMixin = require('NativeMethodsMixin'); <ide> const Platform = require('Platform'); <ide> const StyleSheetPropType = require('StyleSheetPropType'); <ide> const TextStylePropTypes = require('TextStylePropTypes'); <ide> const Touchable = require('Touchable'); <ide> <add>const processColor = require('processColor'); <ide> const createReactNativeComponentClass = require('createReactNativeComponentClass'); <ide> const mergeFast = require('mergeFast'); <ide> <add>const { PropTypes } = React; <add> <ide> const stylePropType = StyleSheetPropType(TextStylePropTypes); <ide> <ide> const viewConfig = { <ide> const viewConfig = { <ide> ellipsizeMode: true, <ide> allowFontScaling: true, <ide> selectable: true, <add> selectionColor: true, <ide> adjustsFontSizeToFit: true, <ide> minimumFontScale: true, <ide> textBreakStrategy: true, <ide> const Text = React.createClass({ <ide> * <ide> * > `clip` is working only for iOS <ide> */ <del> ellipsizeMode: React.PropTypes.oneOf(['head', 'middle', 'tail', 'clip']), <add> ellipsizeMode: PropTypes.oneOf(['head', 'middle', 'tail', 'clip']), <ide> /** <ide> * Used to truncate the text with an ellipsis after computing the text <ide> * layout, including line wrapping, such that the total number of lines <ide> * does not exceed this number. <ide> * <ide> * This prop is commonly used with `ellipsizeMode`. <ide> */ <del> numberOfLines: React.PropTypes.number, <add> numberOfLines: PropTypes.number, <ide> /** <ide> * Set text break strategy on Android API Level 23+, possible values are `simple`, `highQuality`, `balanced` <ide> * The default value is `highQuality`. <ide> * @platform android <ide> */ <del> textBreakStrategy: React.PropTypes.oneOf(['simple', 'highQuality', 'balanced']), <add> textBreakStrategy: PropTypes.oneOf(['simple', 'highQuality', 'balanced']), <ide> /** <ide> * Invoked on mount and layout changes with <ide> * <ide> * `{nativeEvent: {layout: {x, y, width, height}}}` <ide> */ <del> onLayout: React.PropTypes.func, <add> onLayout: PropTypes.func, <ide> /** <ide> * This function is called on press. <ide> * <ide> * e.g., `onPress={() => console.log('1st')}`` <ide> */ <del> onPress: React.PropTypes.func, <add> onPress: PropTypes.func, <ide> /** <ide> * This function is called on long press. <ide> * <ide> * e.g., `onLongPress={this.increaseSize}>`` <ide> */ <del> onLongPress: React.PropTypes.func, <add> onLongPress: PropTypes.func, <ide> /** <ide> * When the scroll view is disabled, this defines how far your touch may <ide> * move off of the button, before deactivating the button. Once deactivated, <ide> const Text = React.createClass({ <ide> /** <ide> * Lets the user select text, to use the native copy and paste functionality. <ide> */ <del> selectable: React.PropTypes.bool, <add> selectable: PropTypes.bool, <add> /** <add> * The highlight color of the text. <add> * @platform android <add> */ <add> selectionColor: ColorPropType, <ide> /** <ide> * When `true`, no visual change is made when text is pressed down. By <ide> * default, a gray oval highlights the text on press down. <del> * <ide> * @platform ios <ide> */ <del> suppressHighlighting: React.PropTypes.bool, <add> suppressHighlighting: PropTypes.bool, <ide> style: stylePropType, <ide> /** <ide> * Used to locate this view in end-to-end tests. <ide> */ <del> testID: React.PropTypes.string, <add> testID: PropTypes.string, <ide> /** <ide> * Specifies whether fonts should scale to respect Text Size accessibility setting on iOS. The <ide> * default is `true`. <ide> */ <del> allowFontScaling: React.PropTypes.bool, <add> allowFontScaling: PropTypes.bool, <ide> /** <ide> * When set to `true`, indicates that the view is an accessibility element. The default value <ide> * for a `Text` element is `true`. <ide> const Text = React.createClass({ <ide> * [Accessibility guide](/react-native/docs/accessibility.html#accessible-ios-android) <ide> * for more information. <ide> */ <del> accessible: React.PropTypes.bool, <add> accessible: PropTypes.bool, <ide> /** <ide> * Specifies whether font should be scaled down automatically to fit given style constraints. <ide> * @platform ios <ide> */ <del> adjustsFontSizeToFit: React.PropTypes.bool, <add> adjustsFontSizeToFit: PropTypes.bool, <ide> <ide> /** <ide> * Specifies smallest possible scale a font can reach when adjustsFontSizeToFit is enabled. (values 0.01-1.0). <ide> * @platform ios <ide> */ <del> minimumFontScale: React.PropTypes.number, <add> minimumFontScale: PropTypes.number, <ide> }, <ide> getDefaultProps(): Object { <ide> return { <ide> const Text = React.createClass({ <ide> return {isInAParentText: true}; <ide> }, <ide> childContextTypes: { <del> isInAParentText: React.PropTypes.bool <add> isInAParentText: PropTypes.bool <ide> }, <ide> contextTypes: { <del> isInAParentText: React.PropTypes.bool <add> isInAParentText: PropTypes.bool <ide> }, <ide> /** <ide> * Only assigned if touch is needed. <ide> const Text = React.createClass({ <ide> isHighlighted: this.state.isHighlighted, <ide> }; <ide> } <add> if (newProps.selectionColor != null) { <add> newProps = { <add> ...newProps, <add> selectionColor: processColor(newProps.selectionColor) <add> }; <add> } <ide> if (Touchable.TOUCH_TARGET_DEBUG && newProps.onPress) { <ide> newProps = { <ide> ...newProps, <ide><path>ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManager.java <ide> <ide> package com.facebook.react.views.text; <ide> <del>import javax.annotation.Nullable; <del> <ide> import android.text.Spannable; <ide> import android.text.TextUtils; <ide> import android.view.Gravity; <ide> import android.widget.TextView; <ide> <del>import com.facebook.yoga.YogaConstants; <ide> import com.facebook.react.bridge.JSApplicationIllegalArgumentException; <add>import com.facebook.react.common.annotations.VisibleForTesting; <ide> import com.facebook.react.module.annotations.ReactModule; <ide> import com.facebook.react.uimanager.BaseViewManager; <ide> import com.facebook.react.uimanager.PixelUtil; <del>import com.facebook.react.uimanager.annotations.ReactProp; <ide> import com.facebook.react.uimanager.Spacing; <ide> import com.facebook.react.uimanager.ThemedReactContext; <ide> import com.facebook.react.uimanager.ViewDefaults; <ide> import com.facebook.react.uimanager.ViewProps; <del>import com.facebook.react.common.annotations.VisibleForTesting; <add>import com.facebook.react.uimanager.annotations.ReactProp; <ide> import com.facebook.react.uimanager.annotations.ReactPropGroup; <add>import com.facebook.yoga.YogaConstants; <add> <add>import javax.annotation.Nullable; <ide> <ide> /** <ide> * Manages instances of spannable {@link TextView}. <ide> public void setSelectable(ReactTextView view, boolean isSelectable) { <ide> view.setTextIsSelectable(isSelectable); <ide> } <ide> <add> @ReactProp(name = "selectionColor", customType = "Color") <add> public void setSelectionColor(ReactTextView view, @Nullable Integer color) { <add> if (color == null) { <add> view.setHighlightColor(DefaultStyleValuesUtil.getDefaultTextColorHighlight(view.getContext())); <add> } else { <add> view.setHighlightColor(color); <add> } <add> } <add> <ide> @ReactPropGroup(names = { <ide> ViewProps.BORDER_RADIUS, <ide> ViewProps.BORDER_TOP_LEFT_RADIUS,
3
Python
Python
remove unnecessary werkzeug mock attribs from test
1a67e284d043818743ae9ef5a46b6b64a9db56f7
<ide><path>tests/test_templating.py <ide> def test_templates_auto_reload(): <ide> <ide> def test_templates_auto_reload_debug_run(monkeypatch): <ide> # debug is None in config, config option is None, app.run(debug=True) <del> rv = {} <del> <ide> # Mocks werkzeug.serving.run_simple method <ide> def run_simple_mock(*args, **kwargs): <del> rv['passthrough_errors'] = kwargs.get('passthrough_errors') <add> pass <ide> <ide> app = flask.Flask(__name__) <ide> monkeypatch.setattr(werkzeug.serving, 'run_simple', run_simple_mock)
1
Ruby
Ruby
remove to_ary from rackbody
7777a11625655d1b229e82ffd06373e61a6bf52a
<ide><path>actionpack/lib/action_dispatch/http/response.rb <ide> def respond_to?(method, include_private = false) <ide> def to_path <ide> @response.stream.to_path <ide> end <del> <del> def to_ary <del> nil <del> end <ide> end <ide> <ide> def handle_no_content!
1
Ruby
Ruby
fix typo in audit
4a4b960558b420676af25dfcd772cc5d4e35cc65
<ide><path>Library/Homebrew/cmd/audit.rb <ide> def audit_patches <ide> <ide> def audit_text <ide> if text =~ /system\s+['"]scons/ <del> problem "use \"scons, *args\" instead of \"system 'scons', *args\"" <add> problem "use \"scons *args\" instead of \"system 'scons', *args\"" <ide> end <ide> <ide> if text =~ /system\s+['"]xcodebuild/ && text !~ /SYMROOT=/
1
Python
Python
allow shared network/subnetwork
40fb1af22e5adc6f8bff9ed5739ebb92c815c5f2
<ide><path>libcloud/compute/drivers/gce.py <ide> def ex_get_subnetwork(self, name, region=None): <ide> region_name = None <ide> if name.startswith('https://'): <ide> parts = self._get_components_from_path(name) <del> name = parts['name'] <add> #name = parts['name'] <ide> region_name = parts['region'] <ide> else: <ide> if isinstance(region, GCERegion): <ide> def ex_get_subnetwork(self, name, region=None): <ide> else: <ide> region_name = region.name <ide> <del> request = '/regions/%s/subnetworks/%s' % (region_name, name) <add> #request = '/regions/%s/subnetworks/%s' % (region_name, name) <add> request = '%s' % (name) <ide> response = self.connection.request(request, method='GET').object <ide> return self._to_subnetwork(response) <ide> <ide> def ex_get_network(self, name): <ide> :return: A Network object for the network <ide> :rtype: :class:`GCENetwork` <ide> """ <del> request = '/global/networks/%s' % (name) <add> if name.startswith('https://'): <add> request = name <add> else: <add> request = '/global/networks/%s' % (name) <ide> response = self.connection.request(request, method='GET').object <ide> return self._to_network(response) <ide>
1
Ruby
Ruby
add docs for cachingkeygenerator
e6e3317c5409b069782e7b701a11bcd5283794ae
<ide><path>activesupport/lib/active_support/key_generator.rb <ide> def generate_key(salt, key_size=64) <ide> end <ide> end <ide> <add> # CachingKeyGenerator is a wrapper around KeyGenerator which allows users to avoid <add> # re-executing the key generation process when it's called using the same salt and <add> # key_size <ide> class CachingKeyGenerator <ide> def initialize(key_generator) <ide> @key_generator = key_generator <ide> @cache_keys = {}.extend(Mutex_m) <ide> end <ide> <add> # Returns a derived key suitable for use. The default key_size is chosen <add> # to be compatible with the default settings of ActiveSupport::MessageVerifier. <add> # i.e. OpenSSL::Digest::SHA1#block_length <ide> def generate_key(salt, key_size=64) <ide> @cache_keys.synchronize do <ide> @cache_keys["#{salt}#{key_size}"] ||= @key_generator.generate_key(salt, key_size)
1
Ruby
Ruby
add the choices option to pkg stanza
f4a3bc100b4b98a3d06222c15934abb36bf16594
<ide><path>Library/Homebrew/cask/lib/hbc/artifact/pkg.rb <ide> <ide> require "hbc/utils/hash_validator" <ide> <add>require "vendor/plist/plist" <add> <ide> module Hbc <ide> module Artifact <ide> class Pkg < Base <ide> def load_pkg_description(pkg_description) <ide> @pkg_install_opts = pkg_description.shift <ide> begin <ide> if @pkg_install_opts.respond_to?(:keys) <del> @pkg_install_opts.extend(HashValidator).assert_valid_keys(:allow_untrusted) <add> @pkg_install_opts.extend(HashValidator).assert_valid_keys(:allow_untrusted, :choices) <ide> elsif @pkg_install_opts <ide> raise <ide> end <ide> def run_installer(pkg_description) <ide> ] <ide> args << "-verboseR" if Hbc.verbose <ide> args << "-allowUntrusted" if pkg_install_opts :allow_untrusted <add> if pkg_install_opts :choices <add> args << "-applyChoiceChangesXML" <add> args << choices_xml <add> end <ide> @command.run!("/usr/sbin/installer", sudo: true, args: args, print_stdout: true) <ide> end <add> <add> def choices_xml <add> path = @cask.staged_path.join("Choices.xml") <add> unless File.exist? path <add> choices = pkg_install_opts :choices <add> IO.write path, Plist::Emit.dump(choices) <add> end <add> path <add> end <ide> end <ide> end <ide> end <ide><path>Library/Homebrew/cask/test/cask/artifact/pkg_test.rb <ide> end <ide> end <ide> end <add> <add> describe "choices" do <add> before do <add> @cask = Hbc.load("with-choices") <add> shutup do <add> TestHelper.install_without_artifacts(@cask) <add> end <add> end <add> <add> it "passes the choice changes xml to the system installer" do <add> pkg = Hbc::Artifact::Pkg.new(@cask, <add> command: Hbc::FakeSystemCommand) <add> <add> Hbc::FakeSystemCommand.expects_command(["/usr/bin/sudo", "-E", "--", "/usr/sbin/installer", "-pkg", @cask.staged_path.join("MyFancyPkg", "Fancy.pkg"), "-target", "/", "-applyChoiceChangesXML", @cask.staged_path.join("Choices.xml")]) <add> <add> shutup do <add> pkg.install_phase <add> end <add> <add> IO.read(@cask.staged_path.join("Choices.xml")).must_equal <<-EOS.undent <add> <?xml version="1.0" encoding="UTF-8"?> <add> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <add> <plist version="1.0"> <add> <array> <add> <dict> <add> <key>attributeSetting</key> <add> <integer>1</integer> <add> <key>choiceAttribute</key> <add> <string>selected</string> <add> <key>choiceIdentifier</key> <add> <string>choice1</string> <add> </dict> <add> </array> <add> </plist> <add> EOS <add> end <add> end <ide> end <ide><path>Library/Homebrew/cask/test/support/Casks/with-choices.rb <add>test_cask 'with-choices' do <add> version '1.2.3' <add> sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' <add> <add> url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" <add> homepage 'http://example.com/fancy-pkg' <add> <add> pkg 'MyFancyPkg/Fancy.pkg', <add> choices: [ <add> { <add> 'choiceIdentifier' => 'choice1', <add> 'choiceAttribute' => 'selected', <add> 'attributeSetting' => 1, <add> }, <add> ] <add>end
3
Javascript
Javascript
fix global leak
da96e07bbe922fba3f6c4c7bd83fcbf4236a90da
<ide><path>src/node.js <ide> // Modules <ide> <ide> var debugLevel = parseInt(process.env['NODE_DEBUG'], 16); <add> var debug; <ide> if (debugLevel & 1) { <ide> debug = function(x) { console.error(x); }; <ide> } else {
1
Ruby
Ruby
remove free usage of #tap
648a95b5263401264d4376a3819f9e232dcf3543
<ide><path>actionpack/lib/action_dispatch/middleware/flash.rb <ide> def self.from_session_value(value) <ide> else <ide> new <ide> end <del> <del> flash.tap(&:sweep) <add> <add> flash.sweep <add> flash <ide> end <ide> <ide> def to_session_value <ide> return nil if empty? <del> {'discard' => @discard.to_a, 'flashes' => @flashes} <add> { 'discard' => @discard.to_a, 'flashes' => @flashes } <ide> end <ide> <ide> def initialize(flashes = {}, discard = []) #:nodoc:
1