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
Python
Python
resolve some merge errors
7dbc5f2a540216222b25612c7f09c419aab92ee1
<ide><path>libcloud/test/common/test_osc.py <ide> from libcloud.compute.providers import get_driver <ide> <ide> <del>class EC2MockDriver(object): <del> region_name = 'eu-west-2' <del> service_name = 'api' <del> <del> <ide> class TestApiOutscale(unittest.TestCase): <ide> cls = get_driver(Provider.OUTSCALE) <del> driver = cls(key='xxxxxxxxxxxxxxxxxxxx', secret='xxxxxxxxxxxxxxxxxxxxxxxxx', region="xxxxxxxxxxxx") <add> driver = cls(key='my_key', secret='my_secret', region="my_region") <ide> <ide> def test_locations(self): <ide> response = self.driver.list_locations() <ide> def test_public_ips(self): <ide> self.assertEqual(response.status_code, 200) <ide> <ide> def test_images(self): <del> response = self.driver.create_image(image_name="test_libcloud2", vm_id="i-dab9397e") <add> response = self.driver.create_image(image_name="image_name", vm_id="vm_id") <ide> self.assertEqual(response.status_code, 200) <ide> image_id = response.json()["Image"]["ImageId"] <ide> <ide> def test_images(self): <ide> <ide> <ide> if __name__ == '__main__': <del> unittest.main() <ide>\ No newline at end of file <add> unittest.main()
1
Javascript
Javascript
fix failing test
7357a1f1d1513cda1326ff60a4d0dc629907d154
<ide><path>packages/ember-runtime/tests/core/is_empty_test.js <del>require('ember-metal/core'); <ide> module("Ember.isEmpty"); <ide> <ide> test("Ember.isEmpty", function() {
1
Javascript
Javascript
move architecture indicator to internal only
e92235ddf2461d6f5fd799564125e9adca16484a
<ide><path>Libraries/ReactNative/AppContainer.js <ide> type Context = { <ide> <ide> type Props = $ReadOnly<{| <ide> children?: React.Node, <add> fabric?: boolean, <ide> rootTag: number, <add> showArchitectureIndicator?: boolean, <ide> WrapperComponent?: ?React.ComponentType<any>, <ide> |}>; <ide> <ide> class AppContainer extends React.Component<Props, State> { <ide> <ide> const Wrapper = this.props.WrapperComponent; <ide> if (Wrapper != null) { <del> innerView = <Wrapper>{innerView}</Wrapper>; <add> innerView = ( <add> <Wrapper <add> fabric={this.props.fabric === true} <add> showArchitectureIndicator={ <add> this.props.showArchitectureIndicator === true <add> }> <add> {innerView} <add> </Wrapper> <add> ); <ide> } <ide> return ( <ide> <RootTagContext.Provider value={this.props.rootTag}> <ide><path>Libraries/ReactNative/ReactNativeArchitectureIndicator.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 <del> */ <del> <del>'use strict'; <del> <del>const React = require('react'); <del>const StyleSheet = require('../StyleSheet/StyleSheet'); <del>const Text = require('../Text/Text'); <del>const View = require('../Components/View/View'); <del> <del>const hasTurboModule = global.__turboModuleProxy != null; <del>const isBridgeless = global.RN$Bridgeless === true; <del> <del>// This is a temporary component to help with migration for the new architecture. <del>function ReactNativeArchitectureIndicator(props: {| <del> fabric: boolean, <del>|}): React.Node { <del> const parts = []; <del> if (isBridgeless) { <del> parts.push('NOBRIDGE'); <del> } else { <del> if (props.fabric) { <del> parts.push('FABRIC'); <del> } <del> if (hasTurboModule) { <del> parts.push('TM'); <del> } <del> } <del> <del> if (parts.length === 0) { <del> return null; <del> } <del> <del> return ( <del> <View style={styles.container}> <del> <Text style={styles.text}>{'(FB-ONLY) ' + parts.join('+')}</Text> <del> </View> <del> ); <del>} <del>const styles = StyleSheet.create({ <del> container: { <del> alignItems: 'center', <del> justifyContent: 'center', <del> backgroundColor: 'rgba(0,0,0, 0.25)', <del> position: 'absolute', <del> top: 0, <del> right: 0, <del> padding: 2, <del> }, <del> text: { <del> fontSize: 6, <del> color: '#ffffff', <del> }, <del>}); <del>module.exports = ReactNativeArchitectureIndicator; <ide><path>Libraries/ReactNative/renderApplication.js <ide> import GlobalPerformanceLogger from '../Utilities/GlobalPerformanceLogger'; <ide> import type {IPerformanceLogger} from '../Utilities/createPerformanceLogger'; <ide> import PerformanceLoggerContext from '../Utilities/PerformanceLoggerContext'; <ide> const React = require('react'); <del>const ReactNativeArchitectureIndicator = require('./ReactNativeArchitectureIndicator'); <ide> <ide> const invariant = require('invariant'); <ide> <ide> function renderApplication<Props: Object>( <ide> const renderable = ( <ide> <PerformanceLoggerContext.Provider <ide> value={scopedPerformanceLogger ?? GlobalPerformanceLogger}> <del> <AppContainer rootTag={rootTag} WrapperComponent={WrapperComponent}> <add> <AppContainer <add> rootTag={rootTag} <add> fabric={fabric} <add> showArchitectureIndicator={showArchitectureIndicator} <add> WrapperComponent={WrapperComponent}> <ide> <RootComponent {...initialProps} rootTag={rootTag} /> <del> {showArchitectureIndicator === true ? ( <del> <ReactNativeArchitectureIndicator fabric={!!fabric} /> <del> ) : null} <ide> </AppContainer> <ide> </PerformanceLoggerContext.Provider> <ide> );
3
Javascript
Javascript
add entry on examples files
7386f92ca436be2be5b25044dc4b265af632fe2a
<ide><path>examples/files.js <ide> var files = { <ide> "webxr_vr_handinput", <ide> "webxr_vr_handinput_cubes", <ide> "webxr_vr_handinput_profiles", <add> "webxr_vr_haptics", <ide> "webxr_vr_lorenzattractor", <ide> "webxr_vr_panorama", <ide> "webxr_vr_panorama_depth",
1
PHP
PHP
add plugins via application class methods
a09caafeeb5c54fc6eee24f29c917a6eae01b2c8
<ide><path>src/Shell/Task/LoadTask.php <ide> public function main($plugin = null) <ide> return false; <ide> } <ide> <del> return $this->_modifyBootstrap( <del> $plugin, <del> $this->params['bootstrap'], <del> $this->params['routes'], <del> $this->params['autoload'] <del> ); <add> $options = $this->makeOptions(); <add> <add> $app = APP . 'Application.php'; <add> if (file_exists($app) && !$this->param('no_app')) { <add> return $this->modifyApplication($app, $plugin, $options); <add> } <add> <add> return $this->_modifyBootstrap($plugin, $options); <add> } <add> <add> /** <add> * Create options string for the load call. <add> * <add> * @return string <add> */ <add> protected function makeOptions() <add> { <add> $autoloadString = $this->param('autoload') ? "'autoload' => true" : ''; <add> $bootstrapString = $this->param('bootstrap') ? "'bootstrap' => true" : ''; <add> $routesString = $this->param('routes') ? "'routes' => true" : ''; <add> <add> return implode(', ', array_filter([$autoloadString, $bootstrapString, $routesString])); <add> } <add> <add> /** <add> * Modify the application class <add> * <add> * @param string $app The Application file to modify. <add> * @param string $plugin The plugin name to add. <add> * @param string $options The plugin options to add <add> * @return void <add> */ <add> protected function modifyApplication($app, $plugin, $options) <add> { <add> $file = new File($app, false); <add> $contents = $file->read(); <add> <add> $append = "\n \$this->addPlugin('%s', [%s]);\n"; <add> $insert = str_replace(', []', '', sprintf($append, $plugin, $options)); <add> <add> if (!preg_match('/function bootstrap\(\)/m', $contents)) { <add> $this->abort('Your Application class does not have a bootstrap() method. Please add one.'); <add> } else { <add> $contents = preg_replace('/(function bootstrap\(\)(?:\s+)\{)/m', '$1' . $insert, $contents); <add> } <add> $file->write($contents); <add> <add> $this->out(''); <add> $this->out(sprintf('%s modified', $app)); <ide> } <ide> <ide> /** <ide> * Update the applications bootstrap.php file. <ide> * <ide> * @param string $plugin Name of plugin. <del> * @param bool $hasBootstrap Whether or not bootstrap should be loaded. <del> * @param bool $hasRoutes Whether or not routes should be loaded. <del> * @param bool $hasAutoloader Whether or not there is an autoloader configured for <del> * the plugin. <add> * @param string $options The options string <ide> * @return bool If modify passed. <ide> */ <del> protected function _modifyBootstrap($plugin, $hasBootstrap, $hasRoutes, $hasAutoloader) <add> protected function _modifyBootstrap($plugin, $options) <ide> { <ide> $bootstrap = new File($this->bootstrap, false); <ide> $contents = $bootstrap->read(); <ide> if (!preg_match("@\n\s*Plugin::loadAll@", $contents)) { <del> $autoloadString = $hasAutoloader ? "'autoload' => true" : ''; <del> $bootstrapString = $hasBootstrap ? "'bootstrap' => true" : ''; <del> $routesString = $hasRoutes ? "'routes' => true" : ''; <del> <ide> $append = "\nPlugin::load('%s', [%s]);\n"; <del> $options = implode(', ', array_filter([$autoloadString, $bootstrapString, $routesString])); <ide> <ide> $bootstrap->append(str_replace(', []', '', sprintf($append, $plugin, $options))); <ide> $this->out(''); <ide> public function getOptionParser() <ide> 'boolean' => true, <ide> 'default' => false, <ide> ]) <add> ->addOption('no_app', [ <add> 'help' => 'Do not update the Application if it exist. Forces config/bootstrap.php to be updated.', <add> 'boolean' => true, <add> 'default' => false, <add> ]) <ide> ->addArgument('plugin', [ <ide> 'help' => 'Name of the plugin to load.', <ide> ]); <ide><path>tests/TestCase/Shell/Task/LoadTaskTest.php <ide> public function setUp() <ide> { <ide> parent::setUp(); <ide> <del> $this->io = $this->getMockBuilder('Cake\Console\ConsoleIo') <del> ->disableOriginalConstructor() <del> ->getMock(); <del> <del> $this->Task = $this->getMockBuilder('Cake\Shell\Task\LoadTask') <del> ->setMethods(['in', 'out', 'err', '_stop']) <del> ->setConstructorArgs([$this->io]) <del> ->getMock(); <del> <ide> $this->app = APP . DS . 'Application.php'; <ide> $this->bootstrap = ROOT . DS . 'config' . DS . 'bootstrap.php'; <ide> $this->bootstrapCli = ROOT . DS . 'config' . DS . 'bootstrap_cli.php'; <ide> public function setUp() <ide> public function tearDown() <ide> { <ide> parent::tearDown(); <del> unset($this->shell); <del> Plugin::unload(); <ide> <ide> $bootstrap = new File($this->bootstrap, false); <ide> $bootstrap->write($this->originalBootstrapContent); <ide> public function testLoadNothing() <ide> $contents = file_get_contents($this->bootstrap); <ide> $this->assertContains("Plugin::load('TestPlugin');", $contents); <ide> } <add> <add> /** <add> * Test loading the app <add> * <add> * @return void <add> */ <add> public function testLoadApp() <add> { <add> $this->exec('plugin load TestPlugin'); <add> $this->assertExitCode(Shell::CODE_SUCCESS); <add> <add> $contents = file_get_contents($this->app); <add> $this->assertContains("\$this->addPlugin('TestPlugin');", $contents); <add> } <add> <add> /** <add> * Test loading the app <add> * <add> * @return void <add> */ <add> public function testLoadAppBootstrap() <add> { <add> $this->exec('plugin load --bootstrap TestPlugin'); <add> $this->assertExitCode(Shell::CODE_SUCCESS); <add> <add> $contents = file_get_contents($this->app); <add> $this->assertContains("\$this->addPlugin('TestPlugin', ['bootstrap' => true]);", $contents); <add> } <add> <add> /** <add> * Test loading the app <add> * <add> * @return void <add> */ <add> public function testLoadAppRoutes() <add> { <add> $this->exec('plugin load --routes TestPlugin'); <add> $this->assertExitCode(Shell::CODE_SUCCESS); <add> <add> $contents = file_get_contents($this->app); <add> $this->assertContains("\$this->addPlugin('TestPlugin', ['routes' => true]);", $contents); <add> } <ide> }
2
Javascript
Javascript
add parseresourcewithoutfragment to identifier.js
93ad32423f7ee78134e8bc03113424c3d7656033
<ide><path>lib/NormalModuleFactory.js <ide> const LazySet = require("./util/LazySet"); <ide> const { getScheme } = require("./util/URLAbsoluteSpecifier"); <ide> const { cachedCleverMerge, cachedSetProperty } = require("./util/cleverMerge"); <ide> const { join } = require("./util/fs"); <del>const { parseResource } = require("./util/identifier"); <add>const { <add> parseResource, <add> parseResourceWithoutFragment <add>} = require("./util/identifier"); <ide> <ide> /** @typedef {import("../declarations/WebpackOptions").ModuleOptionsNormalized} ModuleOptions */ <ide> /** @typedef {import("./Generator")} Generator */ <ide> const { parseResource } = require("./util/identifier"); <ide> <ide> /** @typedef {ResourceData & { data: Record<string, any> }} ResourceDataWithData */ <ide> <add>/** @typedef {Object} ParsedLoaderRequest <add> * @property {string} loader loader <add> * @property {string|undefined} options options <add> */ <add> <ide> const EMPTY_RESOLVE_OPTIONS = {}; <ide> const EMPTY_PARSER_OPTIONS = {}; <ide> const EMPTY_GENERATOR_OPTIONS = {}; <ide> const stringifyLoadersAndResource = (loaders, resource) => { <ide> return str + resource; <ide> }; <ide> <del>/** <del> * @param {string} resultString resultString <del> * @returns {{loader: string, options: string|undefined}} parsed loader request <del> */ <del>const identToLoaderRequest = resultString => { <del> const idx = resultString.indexOf("?"); <del> if (idx >= 0) { <del> const loader = resultString.substr(0, idx).replace(/\0(.)/g, "$1"); <del> const options = resultString.substr(idx + 1); <del> return { <del> loader, <del> options <del> }; <del> } else { <del> return { <del> loader: resultString.replace(/\0(.)/g, "$1"), <del> options: undefined <del> }; <del> } <del>}; <del> <ide> const needCalls = (times, callback) => { <ide> return err => { <ide> if (--times === 0) { <ide> class NormalModuleFactory extends ModuleFactory { <ide> const cacheParseResource = parseResource.bindCache( <ide> associatedObjectForCache <ide> ); <add> const cachedParseResourceWithoutFragment = <add> parseResourceWithoutFragment.bindCache(associatedObjectForCache); <add> this._parseResourceWithoutFragment = cachedParseResourceWithoutFragment; <ide> <ide> this.hooks.factorize.tapAsync( <ide> { <ide> class NormalModuleFactory extends ModuleFactory { <ide> let matchResourceData = undefined; <ide> /** @type {string} */ <ide> let unresolvedResource; <del> /** @type {{loader: string, options: string|undefined}[]} */ <add> /** @type {ParsedLoaderRequest[]} */ <ide> let elements; <ide> let noPreAutoLoaders = false; <ide> let noAutoLoaders = false; <ide> class NormalModuleFactory extends ModuleFactory { <ide> ) <ide> .split(/!+/); <ide> unresolvedResource = rawElements.pop(); <del> elements = rawElements.map(identToLoaderRequest); <add> elements = rawElements.map(el => { <add> const { path, query } = cachedParseResourceWithoutFragment(el); <add> return { <add> loader: path, <add> options: query ? query.slice(1) : undefined <add> }; <add> }); <ide> scheme = getScheme(unresolvedResource); <ide> } else { <ide> unresolvedResource = requestWithoutMatchResource; <ide> If changing the source code is not an option there is also a resolve options cal <ide> } <ide> if (err) return callback(err); <ide> <del> const parsedResult = identToLoaderRequest(result); <add> const parsedResult = this._parseResourceWithoutFragment(result); <ide> const resolved = { <del> loader: parsedResult.loader, <add> loader: parsedResult.path, <ide> options: <ide> item.options === undefined <del> ? parsedResult.options <add> ? parsedResult.query <add> ? parsedResult.query.slice(1) <add> : undefined <ide> : item.options, <ide> ident: item.options === undefined ? undefined : item.ident <ide> }; <ide><path>lib/util/identifier.js <ide> const requestToAbsolute = (context, relativePath) => { <ide> return relativePath; <ide> }; <ide> <del>const makeCacheable = fn => { <add>const makeCacheable = realFn => { <add> /** @type {WeakMap<object, Map<string, ParsedResource>>} */ <add> const cache = new WeakMap(); <add> <add> const getCache = associatedObjectForCache => { <add> const entry = cache.get(associatedObjectForCache); <add> if (entry !== undefined) return entry; <add> /** @type {Map<string, ParsedResource>} */ <add> const map = new Map(); <add> cache.set(associatedObjectForCache, map); <add> return map; <add> }; <add> <add> /** <add> * @param {string} str the path with query and fragment <add> * @param {Object=} associatedObjectForCache an object to which the cache will be attached <add> * @returns {ParsedResource} parsed parts <add> */ <add> const fn = (str, associatedObjectForCache) => { <add> if (!associatedObjectForCache) return realFn(str); <add> const cache = getCache(associatedObjectForCache); <add> const entry = cache.get(str); <add> if (entry !== undefined) return entry; <add> const result = realFn(str); <add> cache.set(str, result); <add> return result; <add> }; <add> <add> fn.bindCache = associatedObjectForCache => { <add> const cache = getCache(associatedObjectForCache); <add> return str => { <add> const entry = cache.get(str); <add> if (entry !== undefined) return entry; <add> const result = realFn(str); <add> cache.set(str, result); <add> return result; <add> }; <add> }; <add> <add> return fn; <add>}; <add> <add>const makeCacheableWithContext = fn => { <ide> /** @type {WeakMap<object, Map<string, Map<string, string>>>} */ <ide> const cache = new WeakMap(); <ide> <ide> const _makePathsRelative = (context, identifier) => { <ide> .join(""); <ide> }; <ide> <del>exports.makePathsRelative = makeCacheable(_makePathsRelative); <add>exports.makePathsRelative = makeCacheableWithContext(_makePathsRelative); <ide> <ide> /** <ide> * <ide> const _makePathsAbsolute = (context, identifier) => { <ide> .join(""); <ide> }; <ide> <del>exports.makePathsAbsolute = makeCacheable(_makePathsAbsolute); <add>exports.makePathsAbsolute = makeCacheableWithContext(_makePathsAbsolute); <ide> <ide> /** <ide> * @param {string} context absolute context path <ide> const _contextify = (context, request) => { <ide> .join("!"); <ide> }; <ide> <del>const contextify = makeCacheable(_contextify); <add>const contextify = makeCacheableWithContext(_contextify); <ide> exports.contextify = contextify; <ide> <ide> /** <ide> const _absolutify = (context, request) => { <ide> .join("!"); <ide> }; <ide> <del>const absolutify = makeCacheable(_absolutify); <add>const absolutify = makeCacheableWithContext(_absolutify); <ide> exports.absolutify = absolutify; <ide> <ide> const PATH_QUERY_FRAGMENT_REGEXP = <ide> /^((?:\0.|[^?#\0])*)(\?(?:\0.|[^#\0])*)?(#.*)?$/; <add>const PATH_QUERY_REGEXP = /^((?:\0.|[^?#\0])*)(\?.*)?$/; <ide> <ide> /** @typedef {{ resource: string, path: string, query: string, fragment: string }} ParsedResource */ <add>/** @typedef {{ resource: string, path: string, query: string }} ParsedResourceWithoutFragment */ <ide> <ide> /** <ide> * @param {string} str the path with query and fragment <ide> const _parseResource = str => { <ide> fragment: match[3] || "" <ide> }; <ide> }; <del>exports.parseResource = (realFn => { <del> /** @type {WeakMap<object, Map<string, ParsedResource>>} */ <del> const cache = new WeakMap(); <add>exports.parseResource = makeCacheable(_parseResource); <ide> <del> const getCache = associatedObjectForCache => { <del> const entry = cache.get(associatedObjectForCache); <del> if (entry !== undefined) return entry; <del> /** @type {Map<string, ParsedResource>} */ <del> const map = new Map(); <del> cache.set(associatedObjectForCache, map); <del> return map; <del> }; <del> <del> /** <del> * @param {string} str the path with query and fragment <del> * @param {Object=} associatedObjectForCache an object to which the cache will be attached <del> * @returns {ParsedResource} parsed parts <del> */ <del> const fn = (str, associatedObjectForCache) => { <del> if (!associatedObjectForCache) return realFn(str); <del> const cache = getCache(associatedObjectForCache); <del> const entry = cache.get(str); <del> if (entry !== undefined) return entry; <del> const result = realFn(str); <del> cache.set(str, result); <del> return result; <del> }; <del> <del> fn.bindCache = associatedObjectForCache => { <del> const cache = getCache(associatedObjectForCache); <del> return str => { <del> const entry = cache.get(str); <del> if (entry !== undefined) return entry; <del> const result = realFn(str); <del> cache.set(str, result); <del> return result; <del> }; <add>/** <add> * Parse resource, skips fragment part <add> * @param {string} str the path with query and fragment <add> * @returns {ParsedResourceWithoutFragment} parsed parts <add> */ <add>const _parseResourceWithoutFragment = str => { <add> const match = PATH_QUERY_REGEXP.exec(str); <add> return { <add> resource: str, <add> path: match[1].replace(/\0(.)/g, "$1"), <add> query: match[2] ? match[2].replace(/\0(.)/g, "$1") : "" <ide> }; <del> <del> return fn; <del>})(_parseResource); <add>}; <add>exports.parseResourceWithoutFragment = makeCacheable( <add> _parseResourceWithoutFragment <add>); <ide> <ide> /** <ide> * @param {string} filename the filename which should be undone <ide><path>test/identifier.unittest.js <ide> describe("util/identifier", () => { <ide> }); <ide> } <ide> }); <add> <add> describe("parseResourceWithoutFragment", () => { <add> // [input, expectedPath, expectedQuery] <add> /** @type {[string, string, string][]} */ <add> const cases = [ <add> ["path?query#hash", "path", "?query#hash"], <add> ["\0#path\0??\0#query#hash", "#path?", "?#query#hash"], <add> [ <add> './loader.js?{"items":["a\0^","b\0!","c#","d"]}', <add> "./loader.js", <add> '?{"items":["a^","b!","c#","d"]}' <add> ], <add> [ <add> "C:\\Users\\\0#\\repo\\loader.js?", <add> "C:\\Users\\#\\repo\\loader.js", <add> "?" <add> ], <add> ["/Users/\0#/repo/loader-\0#.js", "/Users/#/repo/loader-#.js", ""] <add> ]; <add> cases.forEach(case_ => { <add> it(case_[0], () => { <add> const { resource, path, query } = <add> identifierUtil.parseResourceWithoutFragment(case_[0]); <add> expect(case_[0]).toBe(resource); <add> expect(case_[1]).toBe(path); <add> expect(case_[2]).toBe(query); <add> }); <add> }); <add> }); <ide> });
3
Mixed
Javascript
add util.inspect compact option
c2203cb4dd240a6644177f04d0b40f40090b4c33
<ide><path>doc/api/util.md <ide> stream.write('With ES6'); <ide> <!-- YAML <ide> added: v0.3.0 <ide> changes: <add> - version: REPLACEME <add> pr-url: https://github.com/nodejs/node/pull/REPLACEME <add> description: The `compact` option is supported now. <ide> - version: v6.6.0 <ide> pr-url: https://github.com/nodejs/node/pull/8174 <ide> description: Custom inspection functions can now return `this`. <ide> changes: <ide> * `breakLength` {number} The length at which an object's keys are split <ide> across multiple lines. Set to `Infinity` to format an object as a single <ide> line. Defaults to 60 for legacy compatibility. <add> * `compact` {boolean} Setting this to `false` changes the default indentation <add> to use a line break for each object key instead of lining up multiple <add> properties in one line. It will also break text that is above the <add> `breakLength` size into smaller and better readable chunks and indents <add> objects the same as arrays. Note that no text will be reduced below 16 <add> characters, no matter the `breakLength` size. For more information, see the <add> example below. Defaults to `true`. <ide> <ide> The `util.inspect()` method returns a string representation of `object` that is <ide> intended for debugging. The output of `util.inspect` may change at any time <ide> Values may supply their own custom `inspect(depth, opts)` functions, when <ide> called these receive the current `depth` in the recursive inspection, as well as <ide> the options object passed to `util.inspect()`. <ide> <add>The following example highlights the difference with the `compact` option: <add> <add>```js <add>const util = require('util'); <add> <add>const o = { <add> a: [1, 2, [[ <add> 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do ' + <add> 'eiusmod tempor incididunt ut labore et dolore magna aliqua.', <add> 'test', <add> 'foo']], 4], <add> b: new Map([['za', 1], ['zb', 'test']]) <add>}; <add>console.log(util.inspect(o, { compact: true, depth: 5, breakLength: 80 })); <add> <add>// This will print <add> <add>// { a: <add>// [ 1, <add>// 2, <add>// [ [ 'Lorem ipsum dolor sit amet, consectetur [...]', // A long line <add>// 'test', <add>// 'foo' ] ], <add>// 4 ], <add>// b: Map { 'za' => 1, 'zb' => 'test' } } <add> <add>// Setting `compact` to false changes the output to be more reader friendly. <add>console.log(util.inspect(o, { compact: false, depth: 5, breakLength: 80 })); <add> <add>// { <add>// a: [ <add>// 1, <add>// 2, <add>// [ <add>// [ <add>// 'Lorem ipsum dolor sit amet, consectetur ' + <add>// 'adipiscing elit, sed do eiusmod tempor ' + <add>// 'incididunt ut labore et dolore magna ' + <add>// 'aliqua., <add>// 'test', <add>// 'foo' <add>// ] <add>// ], <add>// 4 <add>// ], <add>// b: Map { <add>// 'za' => 1, <add>// 'zb' => 'test' <add>// } <add>// } <add> <add>// Setting `breakLength` to e.g. 150 will print the "Lorem ipsum" text in a <add>// single line. <add>// Reducing the `breakLength` will split the "Lorem ipsum" text in smaller <add>// chunks. <add>``` <add> <ide> ### Customizing `util.inspect` colors <ide> <ide> <!-- type=misc --> <ide><path>lib/util.js <ide> const inspectDefaultOptions = Object.seal({ <ide> customInspect: true, <ide> showProxy: false, <ide> maxArrayLength: 100, <del> breakLength: 60 <add> breakLength: 60, <add> compact: true <ide> }); <ide> <ide> const propertyIsEnumerable = Object.prototype.propertyIsEnumerable; <ide> const keyStrRegExp = /^[a-zA-Z_][a-zA-Z_0-9]*$/; <ide> const colorRegExp = /\u001b\[\d\d?m/g; <ide> const numberRegExp = /^(0|[1-9][0-9]*)$/; <ide> <add>const readableRegExps = {}; <add> <add>const MIN_LINE_LENGTH = 16; <add> <ide> // Escaped special characters. Use empty strings to fill up unused entries. <ide> const meta = [ <ide> '\\u0000', '\\u0001', '\\u0002', '\\u0003', '\\u0004', <ide> function inspect(obj, opts) { <ide> showProxy: inspectDefaultOptions.showProxy, <ide> maxArrayLength: inspectDefaultOptions.maxArrayLength, <ide> breakLength: inspectDefaultOptions.breakLength, <del> indentationLvl: 0 <add> indentationLvl: 0, <add> compact: inspectDefaultOptions.compact <ide> }; <ide> // Legacy... <ide> if (arguments.length > 2) { <ide> function stylizeNoColor(str, styleType) { <ide> function formatValue(ctx, value, recurseTimes, ln) { <ide> // Primitive types cannot have properties <ide> if (typeof value !== 'object' && typeof value !== 'function') { <del> return formatPrimitive(ctx.stylize, value); <add> return formatPrimitive(ctx.stylize, value, ctx); <ide> } <ide> if (value === null) { <ide> return ctx.stylize('null', 'null'); <ide> function formatValue(ctx, value, recurseTimes, ln) { <ide> } catch (e) { /* ignore */ } <ide> <ide> if (typeof raw === 'string') { <del> const formatted = formatPrimitive(stylizeNoColor, raw); <add> const formatted = formatPrimitive(stylizeNoColor, raw, ctx); <ide> if (keyLength === raw.length) <ide> return ctx.stylize(`[String: ${formatted}]`, 'string'); <del> base = ` [String: ${formatted}]`; <add> base = `[String: ${formatted}]`; <ide> // For boxed Strings, we have to remove the 0-n indexed entries, <ide> // since they just noisy up the output and are redundant <ide> // Make boxed primitive Strings look like such <ide> function formatValue(ctx, value, recurseTimes, ln) { <ide> `${constructor || tag}${value.name ? `: ${value.name}` : ''}`; <ide> if (keyLength === 0) <ide> return ctx.stylize(`[${name}]`, 'special'); <del> base = ` [${name}]`; <add> base = `[${name}]`; <ide> } else if (isRegExp(value)) { <ide> // Make RegExps say that they are RegExps <ide> if (keyLength === 0 || recurseTimes < 0) <ide> return ctx.stylize(regExpToString.call(value), 'regexp'); <del> base = ` ${regExpToString.call(value)}`; <add> base = `${regExpToString.call(value)}`; <ide> } else if (isDate(value)) { <ide> if (keyLength === 0) { <ide> if (Number.isNaN(value.getTime())) <ide> return ctx.stylize(value.toString(), 'date'); <ide> return ctx.stylize(dateToISOString.call(value), 'date'); <ide> } <ide> // Make dates with properties first say the date <del> base = ` ${dateToISOString.call(value)}`; <add> base = `${dateToISOString.call(value)}`; <ide> } else if (isError(value)) { <ide> // Make error with message first say the error <ide> if (keyLength === 0) <ide> return formatError(value); <del> base = ` ${formatError(value)}`; <add> base = `${formatError(value)}`; <ide> } else if (isAnyArrayBuffer(value)) { <ide> // Fast path for ArrayBuffer and SharedArrayBuffer. <ide> // Can't do the same for DataView because it has a non-primitive <ide> function formatValue(ctx, value, recurseTimes, ln) { <ide> const formatted = formatPrimitive(stylizeNoColor, raw); <ide> if (keyLength === 0) <ide> return ctx.stylize(`[Number: ${formatted}]`, 'number'); <del> base = ` [Number: ${formatted}]`; <add> base = `[Number: ${formatted}]`; <ide> } else if (typeof raw === 'boolean') { <ide> // Make boxed primitive Booleans look like such <ide> const formatted = formatPrimitive(stylizeNoColor, raw); <ide> if (keyLength === 0) <ide> return ctx.stylize(`[Boolean: ${formatted}]`, 'boolean'); <del> base = ` [Boolean: ${formatted}]`; <add> base = `[Boolean: ${formatted}]`; <ide> } else if (typeof raw === 'symbol') { <ide> const formatted = formatPrimitive(stylizeNoColor, raw); <ide> return ctx.stylize(`[Symbol: ${formatted}]`, 'symbol'); <ide> function formatNumber(fn, value) { <ide> return fn(`${value}`, 'number'); <ide> } <ide> <del>function formatPrimitive(fn, value) { <del> if (typeof value === 'string') <add>function formatPrimitive(fn, value, ctx) { <add> if (typeof value === 'string') { <add> if (ctx.compact === false && <add> value.length > MIN_LINE_LENGTH && <add> ctx.indentationLvl + value.length > ctx.breakLength) { <add> // eslint-disable-next-line max-len <add> const minLineLength = Math.max(ctx.breakLength - ctx.indentationLvl, MIN_LINE_LENGTH); <add> // eslint-disable-next-line max-len <add> const averageLineLength = Math.ceil(value.length / Math.ceil(value.length / minLineLength)); <add> const divisor = Math.max(averageLineLength, MIN_LINE_LENGTH); <add> var res = ''; <add> if (readableRegExps[divisor] === undefined) { <add> // Build a new RegExp that naturally breaks text into multiple lines. <add> // <add> // Rules <add> // 1. Greedy match all text up the max line length that ends with a <add> // whitespace or the end of the string. <add> // 2. If none matches, non-greedy match any text up to a whitespace or <add> // the end of the string. <add> // <add> // eslint-disable-next-line max-len, no-unescaped-regexp-dot <add> readableRegExps[divisor] = new RegExp(`(.|\\n){1,${divisor}}(\\s|$)|(\\n|.)+?(\\s|$)`, 'gm'); <add> } <add> const indent = ' '.repeat(ctx.indentationLvl); <add> const matches = value.match(readableRegExps[divisor]); <add> if (matches.length > 1) { <add> res += `${fn(strEscape(matches[0]), 'string')} +\n`; <add> for (var i = 1; i < matches.length - 1; i++) { <add> res += `${indent} ${fn(strEscape(matches[i]), 'string')} +\n`; <add> } <add> res += `${indent} ${fn(strEscape(matches[i]), 'string')}`; <add> return res; <add> } <add> } <ide> return fn(strEscape(value), 'string'); <add> } <ide> if (typeof value === 'number') <ide> return formatNumber(fn, value); <ide> if (typeof value === 'boolean') <ide> function formatProperty(ctx, value, recurseTimes, key, array) { <ide> const desc = Object.getOwnPropertyDescriptor(value, key) || <ide> { value: value[key], enumerable: true }; <ide> if (desc.value !== undefined) { <del> const diff = array === 0 ? 3 : 2; <add> const diff = array !== 0 || ctx.compact === false ? 2 : 3; <ide> ctx.indentationLvl += diff; <ide> str = formatValue(ctx, desc.value, recurseTimes, array === 0); <ide> ctx.indentationLvl -= diff; <ide> function formatProperty(ctx, value, recurseTimes, key, array) { <ide> <ide> function reduceToSingleString(ctx, output, base, braces, addLn) { <ide> const breakLength = ctx.breakLength; <add> var i = 0; <add> if (ctx.compact === false) { <add> const indentation = ' '.repeat(ctx.indentationLvl); <add> var res = `${base ? `${base} ` : ''}${braces[0]}\n${indentation} `; <add> for (; i < output.length - 1; i++) { <add> res += `${output[i]},\n${indentation} `; <add> } <add> res += `${output[i]}\n${indentation}${braces[1]}`; <add> return res; <add> } <ide> if (output.length * 2 <= breakLength) { <ide> var length = 0; <del> for (var i = 0; i < output.length && length <= breakLength; i++) { <add> for (; i < output.length && length <= breakLength; i++) { <ide> if (ctx.colors) { <ide> length += output[i].replace(colorRegExp, '').length + 1; <ide> } else { <ide> length += output[i].length + 1; <ide> } <ide> } <ide> if (length <= breakLength) <del> return `${braces[0]}${base} ${join(output, ', ')} ${braces[1]}`; <add> return `${braces[0]}${base ? ` ${base}` : ''} ${join(output, ', ')} ` + <add> braces[1]; <ide> } <ide> // If the opening "brace" is too large, like in the case of "Set {", <ide> // we need to force the first item to be on the next line or the <ide> // items will not line up correctly. <ide> const indentation = ' '.repeat(ctx.indentationLvl); <ide> const extraLn = addLn === true ? `\n${indentation}` : ''; <ide> const ln = base === '' && braces[0].length === 1 ? <del> ' ' : `${base}\n${indentation} `; <add> ' ' : `${base ? ` ${base}` : base}\n${indentation} `; <ide> const str = join(output, `,\n${indentation} `); <ide> return `${extraLn}${braces[0]}${ln}${str} ${braces[1]}`; <ide> } <ide><path>test/parallel/test-util-inspect.js <ide> assert.doesNotThrow(() => util.inspect(process)); <ide> assert.strictEqual(util.inspect(new NotStringClass()), <ide> 'NotStringClass {}'); <ide> } <add> <add>{ <add> const o = { <add> a: [1, 2, [[ <add> 'Lorem ipsum dolor\nsit amet,\tconsectetur adipiscing elit, sed do ' + <add> 'eiusmod tempor incididunt ut labore et dolore magna aliqua.', <add> 'test', <add> 'foo']], 4], <add> b: new Map([['za', 1], ['zb', 'test']]) <add> }; <add> <add> let out = util.inspect(o, { compact: true, depth: 5, breakLength: 80 }); <add> let expect = [ <add> '{ a: ', <add> ' [ 1,', <add> ' 2,', <add> " [ [ 'Lorem ipsum dolor\\nsit amet,\\tconsectetur adipiscing elit, " + <add> "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',", <add> " 'test',", <add> " 'foo' ] ],", <add> ' 4 ],', <add> " b: Map { 'za' => 1, 'zb' => 'test' } }", <add> ].join('\n'); <add> assert.strictEqual(out, expect); <add> <add> out = util.inspect(o, { compact: false, depth: 5, breakLength: 60 }); <add> expect = [ <add> '{', <add> ' a: [', <add> ' 1,', <add> ' 2,', <add> ' [', <add> ' [', <add> ' \'Lorem ipsum dolor\\nsit amet,\\tconsectetur \' +', <add> ' \'adipiscing elit, sed do eiusmod tempor \' +', <add> ' \'incididunt ut labore et dolore magna \' +', <add> ' \'aliqua.\',', <add> ' \'test\',', <add> ' \'foo\'', <add> ' ]', <add> ' ],', <add> ' 4', <add> ' ],', <add> ' b: Map {', <add> ' \'za\' => 1,', <add> ' \'zb\' => \'test\'', <add> ' }', <add> '}' <add> ].join('\n'); <add> assert.strictEqual(out, expect); <add> <add> out = util.inspect(o.a[2][0][0], { compact: false, breakLength: 30 }); <add> expect = [ <add> '\'Lorem ipsum dolor\\nsit \' +', <add> ' \'amet,\\tconsectetur \' +', <add> ' \'adipiscing elit, sed do \' +', <add> ' \'eiusmod tempor incididunt \' +', <add> ' \'ut labore et dolore magna \' +', <add> ' \'aliqua.\'' <add> ].join('\n'); <add> assert.strictEqual(out, expect); <add> <add> out = util.inspect( <add> '12345678901234567890123456789012345678901234567890', <add> { compact: false, breakLength: 3 }); <add> expect = '\'12345678901234567890123456789012345678901234567890\''; <add> assert.strictEqual(out, expect); <add> <add> out = util.inspect( <add> '12 45 78 01 34 67 90 23 56 89 123456789012345678901234567890', <add> { compact: false, breakLength: 3 }); <add> expect = [ <add> '\'12 45 78 01 34 \' +', <add> ' \'67 90 23 56 89 \' +', <add> ' \'123456789012345678901234567890\'' <add> ].join('\n'); <add> assert.strictEqual(out, expect); <add> <add> out = util.inspect( <add> '12 45 78 01 34 67 90 23 56 89 1234567890123 0', <add> { compact: false, breakLength: 3 }); <add> expect = [ <add> '\'12 45 78 01 34 \' +', <add> ' \'67 90 23 56 89 \' +', <add> ' \'1234567890123 0\'' <add> ].join('\n'); <add> assert.strictEqual(out, expect); <add> <add> out = util.inspect( <add> '12 45 78 01 34 67 90 23 56 89 12345678901234567 0', <add> { compact: false, breakLength: 3 }); <add> expect = [ <add> '\'12 45 78 01 34 \' +', <add> ' \'67 90 23 56 89 \' +', <add> ' \'12345678901234567 \' +', <add> ' \'0\'' <add> ].join('\n'); <add> assert.strictEqual(out, expect); <add> <add> o.a = () => {}; <add> o.b = new Number(3); <add> out = util.inspect(o, { compact: false, breakLength: 3 }); <add> expect = [ <add> '{', <add> ' a: [Function],', <add> ' b: [Number: 3]', <add> '}' <add> ].join('\n'); <add> assert.strictEqual(out, expect); <add> <add> out = util.inspect(o, { compact: false, breakLength: 3, showHidden: true }); <add> expect = [ <add> '{', <add> ' a: [Function] {', <add> ' [length]: 0,', <add> " [name]: ''", <add> ' },', <add> ' b: [Number: 3]', <add> '}' <add> ].join('\n'); <add> assert.strictEqual(out, expect); <add> <add> o[util.inspect.custom] = () => 42; <add> out = util.inspect(o, { compact: false, breakLength: 3 }); <add> expect = '42'; <add> assert.strictEqual(out, expect); <add> <add> o[util.inspect.custom] = () => '12 45 78 01 34 67 90 23'; <add> out = util.inspect(o, { compact: false, breakLength: 3 }); <add> expect = '12 45 78 01 34 67 90 23'; <add> assert.strictEqual(out, expect); <add> <add> o[util.inspect.custom] = () => ({ a: '12 45 78 01 34 67 90 23' }); <add> out = util.inspect(o, { compact: false, breakLength: 3 }); <add> expect = '{\n a: \'12 45 78 01 34 \' +\n \'67 90 23\'\n}'; <add> assert.strictEqual(out, expect); <add>}
3
Go
Go
fix annoying bad log
69949df2420afcf0677d8ecb2ecc93a08e716619
<ide><path>daemon/execdriver/windows/namedpipes.go <ide> package windows <ide> <ide> import ( <add> "fmt" <ide> "io" <ide> <ide> "github.com/Sirupsen/logrus" <ide> func startStdinCopy(dst io.WriteCloser, src io.Reader) { <ide> go func() { <ide> defer dst.Close() <ide> bytes, err := io.Copy(dst, src) <del> logrus.Debugf("Copied %d bytes from stdin err=%s", bytes, err) <add> log := fmt.Sprintf("Copied %d bytes from stdin.", bytes) <add> if err != nil { <add> log = log + " err=" + err.Error() <add> } <add> logrus.Debugf(log) <ide> }() <ide> } <ide> <ide> func startStdouterrCopy(dst io.Writer, src io.ReadCloser, name string) { <ide> go func() { <ide> defer src.Close() <ide> bytes, err := io.Copy(dst, src) <del> logrus.Debugf("Copied %d bytes from %s err=%s", bytes, name, err) <add> log := fmt.Sprintf("Copied %d bytes from %s.", bytes, name) <add> if err != nil { <add> log = log + " err=" + err.Error() <add> } <add> logrus.Debugf(log) <ide> }() <ide> } <ide>
1
Ruby
Ruby
handle single usage flag case
7673c40f2502a64c1f28c9e0f4ec13fa9d27c5dd
<ide><path>Library/brew.rb <ide> def require? path <ide> <ide> # Usage instructions should be displayed if and only if one of: <ide> # - a help flag is passed AND an internal command is matched <add> # - a help flag is passed AND there is no command specified <ide> # - no arguments are passed <ide> # <ide> # It should never affect external commands so they can handle usage <ide> # arguments themselves. <ide> <del> if empty_argv || (internal_cmd && help_flag) <add> if empty_argv || (help_flag && (cmd.nil? || internal_cmd)) <ide> # TODO - `brew help cmd` should display subcommand help <ide> require 'cmd/help' <ide> puts ARGV.usage
1
Ruby
Ruby
add todo to canonical_name
3654822f77d05f692f4beffe6a77d7452ec5100b
<ide><path>Library/Homebrew/formula.rb <ide> def self.aliases <ide> Dir["#{HOMEBREW_REPOSITORY}/Library/Aliases/*"].map{ |f| File.basename f }.sort <ide> end <ide> <add> # TODO - document what this returns and why <ide> def self.canonical_name name <ide> # if name includes a '/', it may be a tap reference, path, or URL <ide> if name.include? "/"
1
Javascript
Javascript
fix bugs with the new hashing implementation
7abbe4d73e76d43bcd05b7a5e591969367c67b8d
<ide><path>lib/util/hash/BatchedHash.js <ide> class BatchedHash extends Hash { <ide> this.string = undefined; <ide> } <ide> if (typeof data === "string") { <del> if (data.length < MAX_SHORT_STRING) { <add> if ( <add> data.length < MAX_SHORT_STRING && <add> // base64 encoding is not valid since it may contain padding chars <add> (!inputEncoding || !inputEncoding.startsWith("ba")) <add> ) { <ide> this.string = data; <ide> this.encoding = inputEncoding; <ide> } else { <ide><path>lib/util/hash/wasm-hash.js <ide> class WasmHash { <ide> endPos += 2; <ide> } else { <ide> // bail-out for weird chars <del> endPos += mem.write(data.slice(endPos), endPos, encoding); <add> endPos += mem.write(data.slice(i), endPos, encoding); <ide> break; <ide> } <ide> } <ide><path>test/WasmHashes.unittest.js <ide> const wasmHashes = { <ide> regExp: /^[0-9a-f]{16}$/ <ide> }; <ide> }, <add> "xxhash64-createHash": () => { <add> const createXxHash = require("../lib/util/hash/xxhash64"); <add> const createHash = require("../lib/util/createHash"); <add> return { <add> createHash: () => createHash("xxhash64"), <add> createReferenceHash: createXxHash, <add> regExp: /^[0-9a-f]{16}$/ <add> }; <add> }, <ide> md4: () => { <ide> const createMd4Hash = require("../lib/util/hash/md4"); <ide> return { <ide> const wasmHashes = { <ide> : createMd4Hash, <ide> regExp: /^[0-9a-f]{32}$/ <ide> }; <add> }, <add> "md4-createHash": () => { <add> const createMd4Hash = require("../lib/util/hash/md4"); <add> const createHash = require("../lib/util/createHash"); <add> return { <add> createHash: () => createHash("md4"), <add> createReferenceHash: createMd4Hash, <add> regExp: /^[0-9a-f]{32}$/ <add> }; <ide> } <ide> }; <ide> <ide> for (const name of Object.keys(wasmHashes)) { <ide> test(`many updates 2`, sizes.slice().reverse()); <ide> test(`many updates 3`, sizes.concat(sizes.slice().reverse())); <ide> test(`many updates 4`, sizes.slice().reverse().concat(sizes)); <add> <add> const unicodeTest = (name, codePoints) => { <add> it(name + " should hash unicode chars correctly", async () => { <add> const hash = createHash(); <add> const reference = await createReferenceHash(); <add> const str = <add> typeof codePoints === "string" <add> ? codePoints <add> : String.fromCodePoint(...codePoints); <add> hash.update(str); <add> reference.update(str); <add> const result = hash.digest("hex"); <add> expect(result).toMatch(regExp); <add> const expected = reference.digest("hex"); <add> expect(result).toBe(expected); <add> }); <add> }; <add> <add> const uncodeRangeTest = (name, start, end) => { <add> const codePoints = []; <add> for (let i = start; i <= end; i++) { <add> codePoints.push(i); <add> } <add> unicodeTest(name, codePoints); <add> }; <add> <add> uncodeRangeTest("Latin-1 Supplement", 0xa0, 0xff); <add> uncodeRangeTest("Latin Extended", 0x100, 0x24f); <add> uncodeRangeTest("Thaana", 0x780, 0x7bf); <add> uncodeRangeTest("Devanagari", 0x900, 0x97f); <add> uncodeRangeTest("Emoticons", 0x1f600, 0x1f64f); <add> <add> unicodeTest("with zero char", "abc\0💩"); <add> unicodeTest("weird code point after long code point", [1497, 243248]); <add> <add> for (let i = 0; i < 1000; i++) { <add> const chars = Array.from({ length: 20 }, () => <add> Math.floor(Math.random() * 0x10ffff) <add> ); <add> unicodeTest(`fuzzy ${JSON.stringify(chars)}`, chars); <add> } <ide> }); <ide> }
3
Javascript
Javascript
add utfsequence module for common unicode usage
54870e0c6ca8611fed775e5ba12a0d6d9b1cdbd7
<ide><path>Libraries/UTFSequence.js <add>/** <add> * Copyright (c) 2016-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 UTFSequence <add> * @flow <add> * @format <add> */ <add> <add>'use strict'; <add> <add>/** <add> * A collection of Unicode sequences for various characters and emoji. <add> * <add> * - More explicit than using the sequences directly in code. <add> * - Source code should be limitted to ASCII. <add> * - Less chance of typos. <add> */ <add>const UTFSequence = { <add> MIDDOT: '\u00B7', // normal middle dot: &middot; <add> MIDDOT_SP: '\u00A0\u00B7\u00A0', // &nbsp;&middot;&nbsp; <add> MIDDOT_KATAKANA: '\u30FB', // katakana middle dot <add> MDASH: '\u2014', // em dash: &mdash; <add> MDASH_SP: '\u00A0\u2014\u00A0', // &nbsp;&mdash;&nbsp; <add> NDASH: '\u2013', // en dash: &ndash; <add> NDASH_SP: '\u00A0\u2013\u00A0', // &nbsp;&ndash;&nbsp; <add> NBSP: '\u00A0', // non-breaking space: &nbsp; <add> PIZZA: '\uD83C\uDF55', <add>}; <add> <add>module.exports = UTFSequence;
1
Python
Python
fix some typos in the docstrings
549af6229039e7fed7bcb2079737e45c27af998e
<ide><path>flask/app.py <ide> def __init__(self, import_name, static_path=None): <ide> #: A dictionary of all view functions registered. The keys will <ide> #: be function names which are also used to generate URLs and <ide> #: the values are the function objects themselves. <del> #: to register a view function, use the :meth:`route` decorator. <add> #: To register a view function, use the :meth:`route` decorator. <ide> self.view_functions = {} <ide> <ide> #: A dictionary of all registered error handlers. The key is <ide> def __init__(self, import_name, static_path=None): <ide> self.after_request_funcs = {} <ide> <ide> #: A dictionary with list of functions that are called without argument <del> #: to populate the template context. They key of the dictionary is the <add> #: to populate the template context. The key of the dictionary is the <ide> #: name of the module this function is active for, `None` for all <ide> #: requests. Each returns a dictionary that the template context is <ide> #: updated with. To register a function here, use the <ide><path>flask/helpers.py <ide> def url_for(endpoint, **values): <ide> """Generates a URL to the given endpoint with the method provided. <ide> The endpoint is relative to the active module if modules are in use. <ide> <del> Here some examples: <add> Here are some examples: <ide> <ide> ==================== ======================= ============================= <ide> Active Module Target Endpoint Target Function <ide><path>flask/module.py <ide> class Module(_PackageBoundObject): <ide> to be provided to keep them apart. If different import names are used, <ide> the rightmost part of the import name is used as name. <ide> <del> Here an example structure for a larger appliation:: <add> Here's an example structure for a larger application:: <ide> <ide> /myapplication <ide> /__init__.py <ide> class Module(_PackageBoundObject): <ide> app.register_module(admin, url_prefix='/admin') <ide> app.register_module(frontend) <ide> <del> And here an example view module (`myapplication/views/admin.py`):: <add> And here's an example view module (`myapplication/views/admin.py`):: <ide> <ide> from flask import Module <ide> <ide><path>flask/wrappers.py <ide> <ide> <ide> class Request(RequestBase): <del> """The request object used by default in flask. Remembers the <add> """The request object used by default in Flask. Remembers the <ide> matched endpoint and view arguments. <ide> <ide> It is what ends up as :class:`~flask.request`. If you want to replace <ide> def json(self): <ide> <ide> <ide> class Response(ResponseBase): <del> """The response object that is used by default in flask. Works like the <del> response object from Werkzeug but is set to have a HTML mimetype by <add> """The response object that is used by default in Flask. Works like the <add> response object from Werkzeug but is set to have an HTML mimetype by <ide> default. Quite often you don't have to create this object yourself because <ide> :meth:`~flask.Flask.make_response` will take care of that for you. <ide>
4
Ruby
Ruby
add tests for content_for() for read, closes #475
86a0f7f73594e5ba56b78b74c16cd6efa7e6cfa9
<ide><path>actionpack/lib/action_view/helpers/capture_helper.rb <ide> def capture(*args) <ide> # for elements that will be fragment cached. <ide> def content_for(name, content = nil, &block) <ide> content = capture(&block) if block_given? <del> result = @view_flow.append(name, content) if content <del> result unless content <add> if content <add> @view_flow.append(name, content) <add> nil <add> else <add> @view_flow.get(name) <add> end <ide> end <ide> <ide> # The same as +content_for+ but when used with streaming flushes <ide><path>actionpack/test/template/capture_helper_test.rb <ide> def test_capture_doesnt_escape_twice <ide> assert_equal '&lt;em&gt;bar&lt;/em&gt;', string <ide> end <ide> <del> def test_content_for <add> def test_capture_used_for_read <add> content_for :foo, "foo" <add> assert_equal "foo", content_for(:foo) <add> <add> content_for(:bar){ "bar" } <add> assert_equal "bar", content_for(:bar) <add> end <add> <add> def test_content_for_question_mark <ide> assert ! content_for?(:title) <ide> content_for :title, 'title' <ide> assert content_for?(:title) <ide> def test_provide <ide> assert !content_for?(:title) <ide> provide :title, "hi" <ide> assert content_for?(:title) <del> assert_equal "hi", @view_flow.get(:title) <add> assert_equal "hi", content_for(:title) <ide> provide :title, "<p>title</p>" <del> assert_equal "hi&lt;p&gt;title&lt;/p&gt;", @view_flow.get(:title) <add> assert_equal "hi&lt;p&gt;title&lt;/p&gt;", content_for(:title) <ide> <ide> @view_flow = ActionView::OutputFlow.new <ide> provide :title, "hi" <ide> provide :title, "<p>title</p>".html_safe <del> assert_equal "hi<p>title</p>", @view_flow.get(:title) <add> assert_equal "hi<p>title</p>", content_for(:title) <ide> end <ide> <ide> def test_with_output_buffer_swaps_the_output_buffer_given_no_argument
2
Python
Python
add doctests to other/word_patterns.py
bfac867e27328eeedf28b3cd4d8f8195d15e44a4
<ide><path>other/word_patterns.py <del>import pprint, time <del> <del> <del>def getWordPattern(word): <add>def get_word_pattern(word: str) -> str: <add> """ <add> >>> get_word_pattern("pattern") <add> '0.1.2.2.3.4.5' <add> >>> get_word_pattern("word pattern") <add> '0.1.2.3.4.5.6.7.7.8.2.9' <add> >>> get_word_pattern("get word pattern") <add> '0.1.2.3.4.5.6.7.3.8.9.2.2.1.6.10' <add> """ <ide> word = word.upper() <del> nextNum = 0 <del> letterNums = {} <del> wordPattern = [] <add> next_num = 0 <add> letter_nums = {} <add> word_pattern = [] <ide> <ide> for letter in word: <del> if letter not in letterNums: <del> letterNums[letter] = str(nextNum) <del> nextNum += 1 <del> wordPattern.append(letterNums[letter]) <del> return ".".join(wordPattern) <add> if letter not in letter_nums: <add> letter_nums[letter] = str(next_num) <add> next_num += 1 <add> word_pattern.append(letter_nums[letter]) <add> return ".".join(word_pattern) <ide> <ide> <del>def main(): <del> startTime = time.time() <del> allPatterns = {} <add>if __name__ == "__main__": <add> import pprint <add> import time <ide> <del> with open("Dictionary.txt") as fo: <del> wordList = fo.read().split("\n") <add> start_time = time.time() <add> with open("dictionary.txt") as in_file: <add> wordList = in_file.read().splitlines() <ide> <add> all_patterns = {} <ide> for word in wordList: <del> pattern = getWordPattern(word) <del> <del> if pattern not in allPatterns: <del> allPatterns[pattern] = [word] <add> pattern = get_word_pattern(word) <add> if pattern in all_patterns: <add> all_patterns[pattern].append(word) <ide> else: <del> allPatterns[pattern].append(word) <add> all_patterns[pattern] = [word] <ide> <del> with open("Word Patterns.txt", "w") as fo: <del> fo.write(pprint.pformat(allPatterns)) <add> with open("word_patterns.txt", "w") as out_file: <add> out_file.write(pprint.pformat(all_patterns)) <ide> <del> totalTime = round(time.time() - startTime, 2) <del> print(("Done! [", totalTime, "seconds ]")) <del> <del> <del>if __name__ == "__main__": <del> main() <add> totalTime = round(time.time() - start_time, 2) <add> print(f"Done! {len(all_patterns):,} word patterns found in {totalTime} seconds.") <add> # Done! 9,581 word patterns found in 0.58 seconds.
1
Text
Text
fix typo in i18n guide [ci skip]
36176c51d363e0640c1f9820308c69602c0bee64
<ide><path>guides/source/i18n.md <ide> If your translations are stored in YAML files, certain keys must be escaped. The <ide> Examples: <ide> <ide> ```erb <del># confing/locales/en.yml <add># config/locales/en.yml <ide> en: <ide> success: <ide> 'true': 'True!'
1
Javascript
Javascript
convert var to const/let in src files
6473f52c67a87f24c673bed551655bbecc7776ff
<ide><path>src/babel.js <ide> 'use strict'; <ide> <del>var crypto = require('crypto'); <del>var path = require('path'); <del>var defaultOptions = require('../static/babelrc.json'); <add>const crypto = require('crypto'); <add>const path = require('path'); <add>const defaultOptions = require('../static/babelrc.json'); <ide> <del>var babel = null; <del>var babelVersionDirectory = null; <add>let babel = null; <add>let babelVersionDirectory = null; <ide> <del>var PREFIXES = [ <add>const PREFIXES = [ <ide> '/** @babel */', <ide> '"use babel"', <ide> "'use babel'", <ide> '/* @flow */', <ide> '// @flow' <ide> ]; <ide> <del>var PREFIX_LENGTH = Math.max.apply( <add>const PREFIX_LENGTH = Math.max.apply( <ide> Math, <ide> PREFIXES.map(function(prefix) { <ide> return prefix.length; <ide> }) <ide> ); <ide> <ide> exports.shouldCompile = function(sourceCode) { <del> var start = sourceCode.substr(0, PREFIX_LENGTH); <add> const start = sourceCode.substr(0, PREFIX_LENGTH); <ide> return PREFIXES.some(function(prefix) { <ide> return start.indexOf(prefix) === 0; <ide> }); <ide> }; <ide> <ide> exports.getCachePath = function(sourceCode) { <ide> if (babelVersionDirectory == null) { <del> var babelVersion = require('babel-core/package.json').version; <add> const babelVersion = require('babel-core/package.json').version; <ide> babelVersionDirectory = path.join( <ide> 'js', <ide> 'babel', <ide> exports.getCachePath = function(sourceCode) { <ide> exports.compile = function(sourceCode, filePath) { <ide> if (!babel) { <ide> babel = require('babel-core'); <del> var Logger = require('babel-core/lib/transformation/file/logger'); <del> var noop = function() {}; <add> const Logger = require('babel-core/lib/transformation/file/logger'); <add> const noop = function() {}; <ide> Logger.prototype.debug = noop; <ide> Logger.prototype.verbose = noop; <ide> } <ide> exports.compile = function(sourceCode, filePath) { <ide> filePath = 'file:///' + path.resolve(filePath).replace(/\\/g, '/'); <ide> } <ide> <del> var options = { filename: filePath }; <del> for (var key in defaultOptions) { <add> const options = { filename: filePath }; <add> for (const key in defaultOptions) { <ide> options[key] = defaultOptions[key]; <ide> } <ide> return babel.transform(sourceCode, options).code; <ide><path>src/coffee-script.js <ide> 'use strict'; <ide> <del>var crypto = require('crypto'); <del>var path = require('path'); <del>var CoffeeScript = null; <add>const crypto = require('crypto'); <add>const path = require('path'); <add>let CoffeeScript = null; <ide> <ide> exports.shouldCompile = function() { <ide> return true; <ide> exports.getCachePath = function(sourceCode) { <ide> <ide> exports.compile = function(sourceCode, filePath) { <ide> if (!CoffeeScript) { <del> var previousPrepareStackTrace = Error.prepareStackTrace; <add> const previousPrepareStackTrace = Error.prepareStackTrace; <ide> CoffeeScript = require('coffee-script'); <ide> <ide> // When it loads, coffee-script reassigns Error.prepareStackTrace. We have <ide> exports.compile = function(sourceCode, filePath) { <ide> filePath = 'file:///' + path.resolve(filePath).replace(/\\/g, '/'); <ide> } <ide> <del> var output = CoffeeScript.compile(sourceCode, { <add> const output = CoffeeScript.compile(sourceCode, { <ide> filename: filePath, <ide> sourceFiles: [filePath], <ide> inlineMap: true <ide><path>src/compile-cache.js <ide> // Atom's compile-cache when installing or updating packages, using an older <ide> // version of node.js <ide> <del>var path = require('path'); <del>var fs = require('fs-plus'); <del>var sourceMapSupport = require('@atom/source-map-support'); <add>const path = require('path'); <add>const fs = require('fs-plus'); <add>const sourceMapSupport = require('@atom/source-map-support'); <ide> <del>var PackageTranspilationRegistry = require('./package-transpilation-registry'); <del>var CSON = null; <add>const PackageTranspilationRegistry = require('./package-transpilation-registry'); <add>let CSON = null; <ide> <del>var packageTranspilationRegistry = new PackageTranspilationRegistry(); <add>const packageTranspilationRegistry = new PackageTranspilationRegistry(); <ide> <del>var COMPILERS = { <add>const COMPILERS = { <ide> '.js': packageTranspilationRegistry.wrapTranspiler(require('./babel')), <ide> '.ts': packageTranspilationRegistry.wrapTranspiler(require('./typescript')), <ide> '.tsx': packageTranspilationRegistry.wrapTranspiler(require('./typescript')), <ide> exports.removeTranspilerConfigForPath = function(packagePath) { <ide> packageTranspilationRegistry.removeTranspilerConfigForPath(packagePath); <ide> }; <ide> <del>var cacheStats = {}; <del>var cacheDirectory = null; <add>const cacheStats = {}; <add>let cacheDirectory = null; <ide> <ide> exports.setAtomHomeDirectory = function(atomHome) { <del> var cacheDir = path.join(atomHome, 'compile-cache'); <add> let cacheDir = path.join(atomHome, 'compile-cache'); <ide> if ( <ide> process.env.USER === 'root' && <ide> process.env.SUDO_USER && <ide> exports.getCacheDirectory = function() { <ide> <ide> exports.addPathToCache = function(filePath, atomHome) { <ide> this.setAtomHomeDirectory(atomHome); <del> var extension = path.extname(filePath); <add> const extension = path.extname(filePath); <ide> <ide> if (extension === '.cson') { <ide> if (!CSON) { <ide> exports.addPathToCache = function(filePath, atomHome) { <ide> } <ide> return CSON.readFileSync(filePath); <ide> } else { <del> var compiler = COMPILERS[extension]; <add> const compiler = COMPILERS[extension]; <ide> if (compiler) { <ide> return compileFileAtPath(compiler, filePath, extension); <ide> } <ide> exports.resetCacheStats = function() { <ide> }; <ide> <ide> function compileFileAtPath(compiler, filePath, extension) { <del> var sourceCode = fs.readFileSync(filePath, 'utf8'); <add> const sourceCode = fs.readFileSync(filePath, 'utf8'); <ide> if (compiler.shouldCompile(sourceCode, filePath)) { <del> var cachePath = compiler.getCachePath(sourceCode, filePath); <del> var compiledCode = readCachedJavaScript(cachePath); <add> const cachePath = compiler.getCachePath(sourceCode, filePath); <add> let compiledCode = readCachedJavaScript(cachePath); <ide> if (compiledCode != null) { <ide> cacheStats[extension].hits++; <ide> } else { <ide> function compileFileAtPath(compiler, filePath, extension) { <ide> } <ide> <ide> function readCachedJavaScript(relativeCachePath) { <del> var cachePath = path.join(cacheDirectory, relativeCachePath); <add> const cachePath = path.join(cacheDirectory, relativeCachePath); <ide> if (fs.isFileSync(cachePath)) { <ide> try { <ide> return fs.readFileSync(cachePath, 'utf8'); <ide> function readCachedJavaScript(relativeCachePath) { <ide> } <ide> <ide> function writeCachedJavaScript(relativeCachePath, code) { <del> var cachePath = path.join(cacheDirectory, relativeCachePath); <add> const cachePath = path.join(cacheDirectory, relativeCachePath); <ide> fs.writeFileSync(cachePath, code, 'utf8'); <ide> } <ide> <del>var INLINE_SOURCE_MAP_REGEXP = /\/\/[#@]\s*sourceMappingURL=([^'"\n]+)\s*$/gm; <add>const INLINE_SOURCE_MAP_REGEXP = /\/\/[#@]\s*sourceMappingURL=([^'"\n]+)\s*$/gm; <ide> <ide> exports.install = function(resourcesPath, nodeRequire) { <ide> const snapshotSourceMapConsumer = { <ide> exports.install = function(resourcesPath, nodeRequire) { <ide> return null; <ide> } <ide> <del> var compiler = COMPILERS[path.extname(filePath)]; <add> let compiler = COMPILERS[path.extname(filePath)]; <ide> if (!compiler) compiler = COMPILERS['.js']; <ide> <ide> try { <ide> exports.install = function(resourcesPath, nodeRequire) { <ide> return null; <ide> } <ide> <del> var match, lastMatch; <add> let match, lastMatch; <ide> INLINE_SOURCE_MAP_REGEXP.lastIndex = 0; <ide> while ((match = INLINE_SOURCE_MAP_REGEXP.exec(fileData))) { <ide> lastMatch = match; <ide> exports.install = function(resourcesPath, nodeRequire) { <ide> return null; <ide> } <ide> <del> var sourceMappingURL = lastMatch[1]; <del> var rawData = sourceMappingURL.slice(sourceMappingURL.indexOf(',') + 1); <add> const sourceMappingURL = lastMatch[1]; <add> const rawData = sourceMappingURL.slice(sourceMappingURL.indexOf(',') + 1); <ide> <ide> try { <ide> var sourceMap = JSON.parse(Buffer.from(rawData, 'base64')); <ide> exports.install = function(resourcesPath, nodeRequire) { <ide> } <ide> }); <ide> <del> var prepareStackTraceWithSourceMapping = Error.prepareStackTrace; <add> const prepareStackTraceWithSourceMapping = Error.prepareStackTrace; <ide> var prepareStackTrace = prepareStackTraceWithSourceMapping; <ide> <ide> function prepareStackTraceWithRawStackAssignment(error, frames) { <ide> exports.install = function(resourcesPath, nodeRequire) { <ide> }; <ide> <ide> Object.keys(COMPILERS).forEach(function(extension) { <del> var compiler = COMPILERS[extension]; <add> const compiler = COMPILERS[extension]; <ide> <ide> Object.defineProperty(nodeRequire.extensions, extension, { <ide> enumerable: true, <ide> writable: false, <ide> value: function(module, filePath) { <del> var code = compileFileAtPath(compiler, filePath, extension); <add> const code = compileFileAtPath(compiler, filePath, extension); <ide> return module._compile(code, filePath); <ide> } <ide> }); <ide><path>src/delegated-listener.js <ide> const EventKit = require('event-kit'); <ide> <ide> module.exports = function listen(element, eventName, selector, handler) { <del> var innerHandler = function(event) { <add> const innerHandler = function(event) { <ide> if (selector) { <ide> var currentTarget = event.target; <ide> while (currentTarget) { <ide><path>src/history-manager.js <ide> class HistoryManager { <ide> } <ide> <ide> getProject(paths) { <del> for (var i = 0; i < this.projects.length; i++) { <add> for (let i = 0; i < this.projects.length; i++) { <ide> if (arrayEquivalent(paths, this.projects[i].paths)) { <ide> return this.projects[i]; <ide> } <ide> class HistoryManager { <ide> <ide> function arrayEquivalent(a, b) { <ide> if (a.length !== b.length) return false; <del> for (var i = 0; i < a.length; i++) { <add> for (let i = 0; i < a.length; i++) { <ide> if (a[i] !== b[i]) return false; <ide> } <ide> return true; <ide><path>src/module-cache.js <ide> function loadDependencies(modulePath, rootPath, rootMetadata, moduleCache) { <ide> <ide> const childMetadata = JSON.parse(fs.readFileSync(childMetadataPath)); <ide> if (childMetadata && childMetadata.version) { <del> var mainPath; <add> let mainPath; <ide> try { <ide> mainPath = require.resolve(childPath); <ide> } catch (error) { <ide><path>src/package-manager.js <ide> module.exports = class PackageManager { <ide> ) => { <ide> for (const packageName of packageNames) { <ide> if (!disabledPackageNames.has(packageName)) { <del> var pack = this.getLoadedPackage(packageName); <add> const pack = this.getLoadedPackage(packageName); <ide> if (pack != null) { <ide> action(pack); <ide> } <ide><path>src/package.js <ide> module.exports = class Package { <ide> return nativeModulePaths; <ide> } <ide> <del> var traversePath = nodeModulesPath => { <add> const traversePath = nodeModulesPath => { <ide> try { <ide> for (let modulePath of fs.listSync(nodeModulesPath)) { <ide> const modulePathNodeFiles = this.getModulePathNodeFiles(modulePath); <ide><path>src/state-store.js <ide> module.exports = class StateStore { <ide> this.dbPromise.then(db => { <ide> if (db == null) return resolve(); <ide> <del> var request = db <add> const request = db <ide> .transaction(['states'], 'readwrite') <ide> .objectStore('states') <ide> .put({ value: value, storedAt: new Date().toString() }, key); <ide> module.exports = class StateStore { <ide> if (!db) return; <ide> <ide> return new Promise((resolve, reject) => { <del> var request = db <add> const request = db <ide> .transaction(['states']) <ide> .objectStore('states') <ide> .get(key); <ide> module.exports = class StateStore { <ide> this.dbPromise.then(db => { <ide> if (db == null) return resolve(); <ide> <del> var request = db <add> const request = db <ide> .transaction(['states'], 'readwrite') <ide> .objectStore('states') <ide> .delete(key); <ide> module.exports = class StateStore { <ide> if (!db) return; <ide> <ide> return new Promise((resolve, reject) => { <del> var request = db <add> const request = db <ide> .transaction(['states'], 'readwrite') <ide> .objectStore('states') <ide> .clear(); <ide> module.exports = class StateStore { <ide> if (!db) return; <ide> <ide> return new Promise((resolve, reject) => { <del> var request = db <add> const request = db <ide> .transaction(['states']) <ide> .objectStore('states') <ide> .count(); <ide><path>src/style-manager.js <ide> module.exports = class StyleManager { <ide> } <ide> <ide> buildStylesElement() { <del> var stylesElement = new StylesElement(); <add> const stylesElement = new StylesElement(); <ide> stylesElement.initialize(this); <ide> return stylesElement; <ide> } <ide><path>src/text-editor-component.js <ide> module.exports = class TextEditorComponent { <ide> this.remeasureAllBlockDecorations = false; <ide> <ide> const decorations = this.props.model.getDecorations(); <del> for (var i = 0; i < decorations.length; i++) { <add> for (let i = 0; i < decorations.length; i++) { <ide> const decoration = decorations[i]; <ide> const marker = decoration.getMarker(); <ide> if (marker.isValid() && decoration.getProperties().type === 'block') { <ide> module.exports = class TextEditorComponent { <ide> } <ide> <ide> autoscrollOnMouseDrag({ clientX, clientY }, verticalOnly = false) { <del> var { <add> let { <ide> top, <ide> bottom, <ide> left, <ide> class LinesTileComponent { <ide> } <ide> <ide> updateLines(oldProps, newProps) { <del> var { <add> const { <ide> screenLines, <ide> tileStartRow, <ide> lineDecorations, <ide> class LinesTileComponent { <ide> lineComponentsByScreenLineId <ide> } = newProps; <ide> <del> var oldScreenLines = oldProps.screenLines; <del> var newScreenLines = screenLines; <del> var oldScreenLinesEndIndex = oldScreenLines.length; <del> var newScreenLinesEndIndex = newScreenLines.length; <del> var oldScreenLineIndex = 0; <del> var newScreenLineIndex = 0; <del> var lineComponentIndex = 0; <add> const oldScreenLines = oldProps.screenLines; <add> const newScreenLines = screenLines; <add> const oldScreenLinesEndIndex = oldScreenLines.length; <add> const newScreenLinesEndIndex = newScreenLines.length; <add> let oldScreenLineIndex = 0; <add> let newScreenLineIndex = 0; <add> let lineComponentIndex = 0; <ide> <ide> while ( <ide> oldScreenLineIndex < oldScreenLinesEndIndex || <ide> newScreenLineIndex < newScreenLinesEndIndex <ide> ) { <del> var oldScreenLine = oldScreenLines[oldScreenLineIndex]; <del> var newScreenLine = newScreenLines[newScreenLineIndex]; <add> const oldScreenLine = oldScreenLines[oldScreenLineIndex]; <add> const newScreenLine = newScreenLines[newScreenLineIndex]; <ide> <ide> if (oldScreenLineIndex >= oldScreenLinesEndIndex) { <ide> var newScreenLineComponent = new LineComponent({ <ide> class LinesTileComponent { <ide> <ide> oldScreenLineIndex++; <ide> } else if (oldScreenLine === newScreenLine) { <del> var lineComponent = this.lineComponents[lineComponentIndex]; <add> const lineComponent = this.lineComponents[lineComponentIndex]; <ide> lineComponent.update({ <ide> screenRow: tileStartRow + newScreenLineIndex, <ide> lineDecoration: lineDecorations[newScreenLineIndex], <ide> class LinesTileComponent { <ide> newScreenLineIndex++; <ide> lineComponentIndex++; <ide> } else { <del> var oldScreenLineIndexInNewScreenLines = newScreenLines.indexOf( <add> const oldScreenLineIndexInNewScreenLines = newScreenLines.indexOf( <ide> oldScreenLine <ide> ); <del> var newScreenLineIndexInOldScreenLines = oldScreenLines.indexOf( <add> const newScreenLineIndexInOldScreenLines = oldScreenLines.indexOf( <ide> newScreenLine <ide> ); <ide> if ( <ide> newScreenLineIndex < oldScreenLineIndexInNewScreenLines && <ide> oldScreenLineIndexInNewScreenLines < newScreenLinesEndIndex <ide> ) { <del> var newScreenLineComponents = []; <add> const newScreenLineComponents = []; <ide> while (newScreenLineIndex < oldScreenLineIndexInNewScreenLines) { <ide> // eslint-disable-next-line no-redeclare <ide> var newScreenLineComponent = new LineComponent({ <ide> class LinesTileComponent { <ide> oldScreenLineIndex++; <ide> } <ide> } else { <del> var oldScreenLineComponent = this.lineComponents[lineComponentIndex]; <add> const oldScreenLineComponent = this.lineComponents[lineComponentIndex]; <ide> // eslint-disable-next-line no-redeclare <ide> var newScreenLineComponent = new LineComponent({ <ide> screenLine: newScreenLines[newScreenLineIndex], <ide> class LinesTileComponent { <ide> } <ide> <ide> getFirstElementForScreenLine(oldProps, screenLine) { <del> var blockDecorations = oldProps.blockDecorations <add> const blockDecorations = oldProps.blockDecorations <ide> ? oldProps.blockDecorations.get(screenLine.id) <ide> : null; <ide> if (blockDecorations) { <del> var blockDecorationElementsBeforeOldScreenLine = []; <add> const blockDecorationElementsBeforeOldScreenLine = []; <ide> for (let i = 0; i < blockDecorations.length; i++) { <del> var decoration = blockDecorations[i]; <add> const decoration = blockDecorations[i]; <ide> if (decoration.position !== 'after') { <ide> blockDecorationElementsBeforeOldScreenLine.push( <ide> TextEditor.viewForItem(decoration.item) <ide> class LinesTileComponent { <ide> i < blockDecorationElementsBeforeOldScreenLine.length; <ide> i++ <ide> ) { <del> var blockDecorationElement = <add> const blockDecorationElement = <ide> blockDecorationElementsBeforeOldScreenLine[i]; <ide> if ( <ide> !blockDecorationElementsBeforeOldScreenLine.includes( <ide> class LinesTileComponent { <ide> } <ide> <ide> updateBlockDecorations(oldProps, newProps) { <del> var { blockDecorations, lineComponentsByScreenLineId } = newProps; <add> const { blockDecorations, lineComponentsByScreenLineId } = newProps; <ide> <ide> if (oldProps.blockDecorations) { <ide> oldProps.blockDecorations.forEach((oldDecorations, screenLineId) => { <del> var newDecorations = newProps.blockDecorations <add> const newDecorations = newProps.blockDecorations <ide> ? newProps.blockDecorations.get(screenLineId) <ide> : null; <del> for (var i = 0; i < oldDecorations.length; i++) { <del> var oldDecoration = oldDecorations[i]; <add> for (let i = 0; i < oldDecorations.length; i++) { <add> const oldDecoration = oldDecorations[i]; <ide> if (newDecorations && newDecorations.includes(oldDecoration)) <ide> continue; <ide> <del> var element = TextEditor.viewForItem(oldDecoration.item); <add> const element = TextEditor.viewForItem(oldDecoration.item); <ide> if (element.parentElement !== this.element) continue; <ide> <ide> element.remove(); <ide> class NodePool { <ide> } <ide> <ide> getElement(type, className, style) { <del> var element; <del> var elementsByDepth = this.elementsByType[type]; <add> let element; <add> const elementsByDepth = this.elementsByType[type]; <ide> if (elementsByDepth) { <ide> while (elementsByDepth.length > 0) { <del> var elements = elementsByDepth[elementsByDepth.length - 1]; <add> const elements = elementsByDepth[elementsByDepth.length - 1]; <ide> if (elements && elements.length > 0) { <ide> element = elements.pop(); <ide> if (elements.length === 0) elementsByDepth.pop(); <ide> class NodePool { <ide> while (element.firstChild) element.firstChild.remove(); <ide> return element; <ide> } else { <del> var newElement = document.createElement(type); <add> const newElement = document.createElement(type); <ide> if (className) newElement.className = className; <ide> if (style) Object.assign(newElement.style, style); <ide> return newElement; <ide> class NodePool { <ide> <ide> getTextNode(text) { <ide> if (this.textNodes.length > 0) { <del> var node = this.textNodes.pop(); <add> const node = this.textNodes.pop(); <ide> node.textContent = text; <ide> return node; <ide> } else { <ide> class NodePool { <ide> } <ide> <ide> release(node, depth = 0) { <del> var { nodeName } = node; <add> const { nodeName } = node; <ide> if (nodeName === '#text') { <ide> this.textNodes.push(node); <ide> } else { <del> var elementsByDepth = this.elementsByType[nodeName]; <add> let elementsByDepth = this.elementsByType[nodeName]; <ide> if (!elementsByDepth) { <ide> elementsByDepth = []; <ide> this.elementsByType[nodeName] = elementsByDepth; <ide> } <ide> <del> var elements = elementsByDepth[depth]; <add> let elements = elementsByDepth[depth]; <ide> if (!elements) { <ide> elements = []; <ide> elementsByDepth[depth] = elements; <ide> } <ide> <ide> elements.push(node); <del> for (var i = 0; i < node.childNodes.length; i++) { <add> for (let i = 0; i < node.childNodes.length; i++) { <ide> this.release(node.childNodes[i], depth + 1); <ide> } <ide> } <ide><path>src/text-editor-registry.js <ide> module.exports = class TextEditorRegistry { <ide> // <ide> // Returns a {Boolean} indicating whether the editor was successfully removed. <ide> remove(editor) { <del> var removed = this.editors.delete(editor); <add> const removed = this.editors.delete(editor); <ide> editor.registered = false; <ide> return removed; <ide> } <ide><path>src/text-mate-language-mode.js <ide> class TextMateLanguageMode { <ide> let rowsRemaining = this.chunkSize; <ide> <ide> while (this.firstInvalidRow() != null && rowsRemaining > 0) { <del> var endRow, filledRegion; <add> let endRow, filledRegion; <ide> const startRow = this.invalidRows.shift(); <ide> const lastRow = this.buffer.getLastRow(); <ide> if (startRow > lastRow) continue; <ide><path>src/tooltip.js <ide> const listen = require('./delegated-listener'); <ide> // This tooltip class is derived from Bootstrap 3, but modified to not require <ide> // jQuery, which is an expensive dependency we want to eliminate. <ide> <del>var followThroughTimer = null; <add>let followThroughTimer = null; <ide> <del>var Tooltip = function(element, options, viewRegistry) { <add>const Tooltip = function(element, options, viewRegistry) { <ide> this.options = null; <ide> this.enabled = null; <ide> this.timeout = null; <ide> Tooltip.prototype.init = function(element, options) { <ide> ); <ide> } <ide> <del> var triggers = this.options.trigger.split(' '); <add> const triggers = this.options.trigger.split(' '); <ide> <del> for (var i = triggers.length; i--; ) { <add> for (let i = triggers.length; i--; ) { <ide> var trigger = triggers[i]; <ide> <ide> if (trigger === 'click') { <ide> Tooltip.prototype.init = function(element, options) { <ide> } else if (trigger === 'manual') { <ide> this.show(); <ide> } else { <del> var eventIn, eventOut; <add> let eventIn, eventOut; <ide> <ide> if (trigger === 'hover') { <ide> this.hideOnKeydownOutsideOfTooltip = () => this.hide(); <ide> Tooltip.prototype.getOptions = function(options) { <ide> }; <ide> <ide> Tooltip.prototype.getDelegateOptions = function() { <del> var options = {}; <del> var defaults = this.getDefaults(); <add> const options = {}; <add> const defaults = this.getDefaults(); <ide> <ide> if (this._options) { <del> for (var key of Object.getOwnPropertyNames(this._options)) { <del> var value = this._options[key]; <add> for (const key of Object.getOwnPropertyNames(this._options)) { <add> const value = this._options[key]; <ide> if (defaults[key] !== value) options[key] = value; <ide> } <ide> } <ide> Tooltip.prototype.enter = function(event) { <ide> }; <ide> <ide> Tooltip.prototype.isInStateTrue = function() { <del> for (var key in this.inState) { <add> for (const key in this.inState) { <ide> if (this.inState[key]) return true; <ide> } <ide> <ide> Tooltip.prototype.show = function() { <ide> ); <ide> } <ide> <del> var tip = this.getTooltipElement(); <add> const tip = this.getTooltipElement(); <ide> this.startObservingMutations(); <del> var tipId = this.getUID('tooltip'); <add> const tipId = this.getUID('tooltip'); <ide> <ide> this.setContent(); <ide> tip.setAttribute('id', tipId); <ide> this.element.setAttribute('aria-describedby', tipId); <ide> <ide> if (this.options.animation) tip.classList.add('fade'); <ide> <del> var placement = <add> let placement = <ide> typeof this.options.placement === 'function' <ide> ? this.options.placement.call(this, tip, this.element) <ide> : this.options.placement; <ide> <del> var autoToken = /\s?auto?\s?/i; <del> var autoPlace = autoToken.test(placement); <add> const autoToken = /\s?auto?\s?/i; <add> const autoPlace = autoToken.test(placement); <ide> if (autoPlace) placement = placement.replace(autoToken, '') || 'top'; <ide> <ide> tip.remove(); <ide> Tooltip.prototype.show = function() { <ide> <ide> document.body.appendChild(tip); <ide> <del> var pos = this.element.getBoundingClientRect(); <del> var actualWidth = tip.offsetWidth; <del> var actualHeight = tip.offsetHeight; <add> const pos = this.element.getBoundingClientRect(); <add> const actualWidth = tip.offsetWidth; <add> const actualHeight = tip.offsetHeight; <ide> <ide> if (autoPlace) { <del> var orgPlacement = placement; <del> var viewportDim = this.viewport.getBoundingClientRect(); <add> const orgPlacement = placement; <add> const viewportDim = this.viewport.getBoundingClientRect(); <ide> <ide> placement = <ide> placement === 'bottom' && pos.bottom + actualHeight > viewportDim.bottom <ide> Tooltip.prototype.show = function() { <ide> tip.classList.add(placement); <ide> } <ide> <del> var calculatedOffset = this.getCalculatedOffset( <add> const calculatedOffset = this.getCalculatedOffset( <ide> placement, <ide> pos, <ide> actualWidth, <ide> Tooltip.prototype.show = function() { <ide> <ide> this.applyPlacement(calculatedOffset, placement); <ide> <del> var prevHoverState = this.hoverState; <add> const prevHoverState = this.hoverState; <ide> this.hoverState = null; <ide> <ide> if (prevHoverState === 'out') this.leave(); <ide> } <ide> }; <ide> <ide> Tooltip.prototype.applyPlacement = function(offset, placement) { <del> var tip = this.getTooltipElement(); <add> const tip = this.getTooltipElement(); <ide> <del> var width = tip.offsetWidth; <del> var height = tip.offsetHeight; <add> const width = tip.offsetWidth; <add> const height = tip.offsetHeight; <ide> <ide> // manually read margins because getBoundingClientRect includes difference <del> var computedStyle = window.getComputedStyle(tip); <del> var marginTop = parseInt(computedStyle.marginTop, 10); <del> var marginLeft = parseInt(computedStyle.marginLeft, 10); <add> const computedStyle = window.getComputedStyle(tip); <add> const marginTop = parseInt(computedStyle.marginTop, 10); <add> const marginLeft = parseInt(computedStyle.marginLeft, 10); <ide> <ide> offset.top += marginTop; <ide> offset.left += marginLeft; <ide> Tooltip.prototype.applyPlacement = function(offset, placement) { <ide> tip.classList.add('in'); <ide> <ide> // check to see if placing tip in new offset caused the tip to resize itself <del> var actualWidth = tip.offsetWidth; <del> var actualHeight = tip.offsetHeight; <add> const actualWidth = tip.offsetWidth; <add> const actualHeight = tip.offsetHeight; <ide> <ide> if (placement === 'top' && actualHeight !== height) { <ide> offset.top = offset.top + height - actualHeight; <ide> } <ide> <del> var delta = this.getViewportAdjustedDelta( <add> const delta = this.getViewportAdjustedDelta( <ide> placement, <ide> offset, <ide> actualWidth, <ide> Tooltip.prototype.applyPlacement = function(offset, placement) { <ide> if (delta.left) offset.left += delta.left; <ide> else offset.top += delta.top; <ide> <del> var isVertical = /top|bottom/.test(placement); <del> var arrowDelta = isVertical <add> const isVertical = /top|bottom/.test(placement); <add> const arrowDelta = isVertical <ide> ? delta.left * 2 - width + actualWidth <ide> : delta.top * 2 - height + actualHeight; <del> var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight'; <add> const arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight'; <ide> <ide> tip.style.top = offset.top + 'px'; <ide> tip.style.left = offset.left + 'px'; <ide> Tooltip.prototype.applyPlacement = function(offset, placement) { <ide> }; <ide> <ide> Tooltip.prototype.replaceArrow = function(delta, dimension, isVertical) { <del> var arrow = this.getArrowElement(); <del> var amount = 50 * (1 - delta / dimension) + '%'; <add> const arrow = this.getArrowElement(); <add> const amount = 50 * (1 - delta / dimension) + '%'; <ide> <ide> if (isVertical) { <ide> arrow.style.left = amount; <ide> Tooltip.prototype.replaceArrow = function(delta, dimension, isVertical) { <ide> }; <ide> <ide> Tooltip.prototype.setContent = function() { <del> var tip = this.getTooltipElement(); <add> const tip = this.getTooltipElement(); <ide> <ide> if (this.options.class) { <ide> tip.classList.add(this.options.class); <ide> } <ide> <del> var inner = tip.querySelector('.tooltip-inner'); <add> const inner = tip.querySelector('.tooltip-inner'); <ide> if (this.options.item) { <ide> inner.appendChild(this.viewRegistry.getView(this.options.item)); <ide> } else { <del> var title = this.getTitle(); <add> const title = this.getTitle(); <ide> if (this.options.html) { <ide> inner.innerHTML = title; <ide> } else { <ide> Tooltip.prototype.getViewportAdjustedDelta = function( <ide> actualWidth, <ide> actualHeight <ide> ) { <del> var delta = { top: 0, left: 0 }; <add> const delta = { top: 0, left: 0 }; <ide> if (!this.viewport) return delta; <ide> <del> var viewportPadding = <add> const viewportPadding = <ide> (this.options.viewport && this.options.viewport.padding) || 0; <del> var viewportDimensions = this.viewport.getBoundingClientRect(); <add> const viewportDimensions = this.viewport.getBoundingClientRect(); <ide> <ide> if (/right|left/.test(placement)) { <del> var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll; <del> var bottomEdgeOffset = <add> const topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll; <add> const bottomEdgeOffset = <ide> pos.top + viewportPadding - viewportDimensions.scroll + actualHeight; <ide> if (topEdgeOffset < viewportDimensions.top) { <ide> // top overflow <ide> Tooltip.prototype.getViewportAdjustedDelta = function( <ide> viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset; <ide> } <ide> } else { <del> var leftEdgeOffset = pos.left - viewportPadding; <del> var rightEdgeOffset = pos.left + viewportPadding + actualWidth; <add> const leftEdgeOffset = pos.left - viewportPadding; <add> const rightEdgeOffset = pos.left + viewportPadding + actualWidth; <ide> if (leftEdgeOffset < viewportDimensions.left) { <ide> // left overflow <ide> delta.left = viewportDimensions.left - leftEdgeOffset; <ide> Tooltip.prototype.getViewportAdjustedDelta = function( <ide> }; <ide> <ide> Tooltip.prototype.getTitle = function() { <del> var title = this.element.getAttribute('data-original-title'); <add> const title = this.element.getAttribute('data-original-title'); <ide> if (title) { <ide> return title; <ide> } else { <ide> Tooltip.prototype.destroy = function() { <ide> }; <ide> <ide> Tooltip.prototype.getDelegateComponent = function(element) { <del> var component = tooltipComponentsByElement.get(element); <add> let component = tooltipComponentsByElement.get(element); <ide> if (!component) { <ide> component = new Tooltip( <ide> element, <ide> Tooltip.prototype.getDelegateComponent = function(element) { <ide> }; <ide> <ide> Tooltip.prototype.recalculatePosition = function() { <del> var tip = this.getTooltipElement(); <add> const tip = this.getTooltipElement(); <ide> <del> var placement = <add> let placement = <ide> typeof this.options.placement === 'function' <ide> ? this.options.placement.call(this, tip, this.element) <ide> : this.options.placement; <ide> <del> var autoToken = /\s?auto?\s?/i; <del> var autoPlace = autoToken.test(placement); <add> const autoToken = /\s?auto?\s?/i; <add> const autoPlace = autoToken.test(placement); <ide> if (autoPlace) placement = placement.replace(autoToken, '') || 'top'; <ide> <ide> tip.classList.add(placement); <ide> <del> var pos = this.element.getBoundingClientRect(); <del> var actualWidth = tip.offsetWidth; <del> var actualHeight = tip.offsetHeight; <add> const pos = this.element.getBoundingClientRect(); <add> const actualWidth = tip.offsetWidth; <add> const actualHeight = tip.offsetHeight; <ide> <ide> if (autoPlace) { <del> var orgPlacement = placement; <del> var viewportDim = this.viewport.getBoundingClientRect(); <add> const orgPlacement = placement; <add> const viewportDim = this.viewport.getBoundingClientRect(); <ide> <ide> placement = <ide> placement === 'bottom' && pos.bottom + actualHeight > viewportDim.bottom <ide> Tooltip.prototype.recalculatePosition = function() { <ide> tip.classList.add(placement); <ide> } <ide> <del> var calculatedOffset = this.getCalculatedOffset( <add> const calculatedOffset = this.getCalculatedOffset( <ide> placement, <ide> pos, <ide> actualWidth, <ide> Tooltip.prototype.recalculatePosition = function() { <ide> }; <ide> <ide> function extend() { <del> var args = Array.prototype.slice.apply(arguments); <del> var target = args.shift(); <del> var source = args.shift(); <add> const args = Array.prototype.slice.apply(arguments); <add> const target = args.shift(); <add> let source = args.shift(); <ide> while (source) { <del> for (var key of Object.getOwnPropertyNames(source)) { <add> for (const key of Object.getOwnPropertyNames(source)) { <ide> target[key] = source[key]; <ide> } <ide> source = args.shift(); <ide><path>src/typescript.js <ide> 'use strict'; <ide> <del>var _ = require('underscore-plus'); <del>var crypto = require('crypto'); <del>var path = require('path'); <add>const _ = require('underscore-plus'); <add>const crypto = require('crypto'); <add>const path = require('path'); <ide> <del>var defaultOptions = { <add>const defaultOptions = { <ide> target: 1, <ide> module: 'commonjs', <ide> sourceMap: true <ide> }; <ide> <del>var TypeScriptSimple = null; <del>var typescriptVersionDir = null; <add>let TypeScriptSimple = null; <add>let typescriptVersionDir = null; <ide> <ide> exports.shouldCompile = function() { <ide> return true; <ide> }; <ide> <ide> exports.getCachePath = function(sourceCode) { <ide> if (typescriptVersionDir == null) { <del> var version = require('typescript-simple/package.json').version; <add> const version = require('typescript-simple/package.json').version; <ide> typescriptVersionDir = path.join( <ide> 'ts', <ide> createVersionAndOptionsDigest(version, defaultOptions) <ide> exports.compile = function(sourceCode, filePath) { <ide> filePath = 'file:///' + path.resolve(filePath).replace(/\\/g, '/'); <ide> } <ide> <del> var options = _.defaults({ filename: filePath }, defaultOptions); <add> const options = _.defaults({ filename: filePath }, defaultOptions); <ide> return new TypeScriptSimple(options, false).compile(sourceCode, filePath); <ide> }; <ide> <ide><path>src/view-registry.js <ide> module.exports = class ViewRegistry { <ide> this.nextUpdatePromise = null; <ide> this.resolveNextUpdatePromise = null; <ide> <del> var writer = this.documentWriters.shift(); <add> let writer = this.documentWriters.shift(); <ide> while (writer) { <ide> writer(); <ide> writer = this.documentWriters.shift(); <ide> } <ide> <del> var reader = this.documentReaders.shift(); <add> let reader = this.documentReaders.shift(); <ide> this.documentReadInProgress = true; <ide> while (reader) { <ide> reader();
16
Text
Text
remove ebpf from supported tooling list
170b4849b0c053baeddea44f6c5de08912f13fa4
<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)][trace_events (API)] | No | Yes | 1 | <ide> | Tracing | trace\_gc | No | Yes | 1 | <del>| M/T | eBPF tracing tool | No | No | ? | <ide> <ide> [0x]: https://github.com/davidmarkclements/0x <ide> [Async Hooks (API)]: https://nodejs.org/api/async_hooks.html
1
Javascript
Javascript
use invalid host according to rfc2606
467385a49b659b704973b8195328775b620ae6ab
<ide><path>test/internet/test-dns.js <ide> TEST(function test_resolveTxt_failure(done) { <ide> <ide> <ide> TEST(function test_lookup_failure(done) { <del> const req = dns.lookup('does.not.exist', 4, function(err, ip, family) { <add> const req = dns.lookup('this.hostname.is.invalid', 4, (err, ip, family) => { <ide> assert.ok(err instanceof Error); <ide> assert.strictEqual(err.errno, dns.NOTFOUND); <ide> assert.strictEqual(err.errno, 'ENOTFOUND'); <ide> assert.ok(!/ENOENT/.test(err.message)); <del> assert.ok(/does\.not\.exist/.test(err.message)); <add> assert.ok(err.message.includes('this.hostname.is.invalid')); <ide> <ide> done(); <ide> }); <ide> TEST(function test_reverse_failure(done) { <ide> <ide> <ide> TEST(function test_lookup_failure(done) { <del> const req = dns.lookup('nosuchhostimsure', function(err) { <add> const req = dns.lookup('this.hostname.is.invalid', (err) => { <ide> assert(err instanceof Error); <ide> assert.strictEqual(err.code, 'ENOTFOUND'); // Silly error code... <del> assert.strictEqual(err.hostname, 'nosuchhostimsure'); <del> assert.ok(/nosuchhostimsure/.test(err.message)); <add> assert.strictEqual(err.hostname, 'this.hostname.is.invalid'); <add> assert.ok(err.message.includes('this.hostname.is.invalid')); <ide> <ide> done(); <ide> }); <ide> TEST(function test_lookup_failure(done) { <ide> <ide> <ide> TEST(function test_resolve_failure(done) { <del> const req = dns.resolve4('nosuchhostimsure', function(err) { <add> const req = dns.resolve4('this.hostname.is.invalid', (err) => { <ide> assert(err instanceof Error); <ide> <ide> switch (err.code) { <ide> TEST(function test_resolve_failure(done) { <ide> break; <ide> } <ide> <del> assert.strictEqual(err.hostname, 'nosuchhostimsure'); <del> assert.ok(/nosuchhostimsure/.test(err.message)); <add> assert.strictEqual(err.hostname, 'this.hostname.is.invalid'); <add> assert.ok(err.message.includes('this.hostname.is.invalid')); <ide> <ide> done(); <ide> }); <ide><path>test/parallel/test-http-client-req-error-dont-double-fire.js <ide> const assert = require('assert'); <ide> const http = require('http'); <ide> const common = require('../common'); <ide> <del>// not exists host <del>const host = '*'.repeat(256); <add>// Invalid hostname as per https://tools.ietf.org/html/rfc2606#section-2 <add>const host = 'this.hostname.is.invalid'; <ide> const req = http.get({ host }); <ide> const err = new Error('mock unexpected code error'); <ide> req.on('error', common.mustCall(() => {
2
Go
Go
add initial logging to libcontainer
7294392c729de4c5884eb967f192b34a1d8857a7
<ide><path>execdriver/native/driver.go <ide> import ( <ide> "github.com/dotcloud/docker/pkg/libcontainer/nsinit" <ide> "github.com/dotcloud/docker/pkg/system" <ide> "io/ioutil" <add> "log" <ide> "os" <ide> "os/exec" <ide> "path/filepath" <ide> func init() { <ide> execdriver.RegisterInitFunc(DriverName, func(args *execdriver.InitArgs) error { <ide> var ( <ide> container *libcontainer.Container <del> ns = nsinit.NewNsInit(&nsinit.DefaultCommandFactory{}, &nsinit.DefaultStateWriter{args.Root}) <add> logger = log.New(ioutil.Discard, "[nsinit] ", log.LstdFlags) <add> ns = nsinit.NewNsInit(&nsinit.DefaultCommandFactory{}, &nsinit.DefaultStateWriter{args.Root}, logger) <ide> ) <ide> f, err := os.Open(filepath.Join(args.Root, "container.json")) <ide> if err != nil { <ide> func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba <ide> c: c, <ide> dsw: &nsinit.DefaultStateWriter{filepath.Join(d.root, c.ID)}, <ide> } <del> ns = nsinit.NewNsInit(factory, stateWriter) <del> args = append([]string{c.Entrypoint}, c.Arguments...) <add> logger = log.New(ioutil.Discard, "[nsinit] ", log.LstdFlags) <add> ns = nsinit.NewNsInit(factory, stateWriter, logger) <add> args = append([]string{c.Entrypoint}, c.Arguments...) <ide> ) <ide> if err := d.createContainerRoot(c.ID); err != nil { <ide> return -1, err <ide><path>pkg/libcontainer/nsinit/command.go <ide> package nsinit <ide> <ide> import ( <add> "fmt" <ide> "github.com/dotcloud/docker/pkg/libcontainer" <ide> "github.com/dotcloud/docker/pkg/system" <ide> "os" <ide> func (c *DefaultCommandFactory) Create(container *libcontainer.Container, consol <ide> // get our binary name from arg0 so we can always reexec ourself <ide> command := exec.Command(os.Args[0], append([]string{ <ide> "-console", console, <del> "-pipe", "3", <add> "-pipe", fmt.Sprint(pipe.Fd()), <ide> "-root", c.Root, <ide> "init"}, args...)...) <ide> <ide><path>pkg/libcontainer/nsinit/exec.go <ide> func (ns *linuxNs) Exec(container *libcontainer.Container, term Terminal, args [ <ide> } <ide> <ide> if container.Tty { <add> ns.logger.Println("creating master and console") <ide> master, console, err = system.CreateMasterAndConsole() <ide> if err != nil { <ide> return -1, err <ide> func (ns *linuxNs) Exec(container *libcontainer.Container, term Terminal, args [ <ide> } <ide> <ide> command := ns.commandFactory.Create(container, console, syncPipe.child, args) <add> ns.logger.Println("attach terminal to command") <ide> if err := term.Attach(command); err != nil { <ide> return -1, err <ide> } <ide> defer term.Close() <ide> <add> ns.logger.Println("starting command") <ide> if err := command.Start(); err != nil { <ide> return -1, err <ide> } <add> ns.logger.Printf("writting pid %d to file\n", command.Process.Pid) <ide> if err := ns.stateWriter.WritePid(command.Process.Pid); err != nil { <ide> command.Process.Kill() <ide> return -1, err <ide> } <del> defer ns.stateWriter.DeletePid() <add> defer func() { <add> ns.logger.Println("removing pid file") <add> ns.stateWriter.DeletePid() <add> }() <ide> <ide> // Do this before syncing with child so that no children <ide> // can escape the cgroup <add> ns.logger.Println("setting cgroups") <ide> if err := ns.SetupCgroups(container, command.Process.Pid); err != nil { <ide> command.Process.Kill() <ide> return -1, err <ide> } <add> ns.logger.Println("setting up network") <ide> if err := ns.InitializeNetworking(container, command.Process.Pid, syncPipe); err != nil { <ide> command.Process.Kill() <ide> return -1, err <ide> } <ide> <add> ns.logger.Println("closing sync pipe with child") <ide> // Sync with child <ide> syncPipe.Close() <ide> <ide> func (ns *linuxNs) Exec(container *libcontainer.Container, term Terminal, args [ <ide> return -1, err <ide> } <ide> } <del> return command.ProcessState.Sys().(syscall.WaitStatus).ExitStatus(), nil <add> status := command.ProcessState.Sys().(syscall.WaitStatus).ExitStatus() <add> ns.logger.Printf("process exited with status %d\n", status) <add> return status, err <ide> } <ide> <ide> func (ns *linuxNs) SetupCgroups(container *libcontainer.Container, nspid int) error { <ide><path>pkg/libcontainer/nsinit/execin.go <ide> import ( <ide> <ide> // ExecIn uses an existing pid and joins the pid's namespaces with the new command. <ide> func (ns *linuxNs) ExecIn(container *libcontainer.Container, nspid int, args []string) (int, error) { <add> ns.logger.Println("unshare namespaces") <ide> for _, ns := range container.Namespaces { <ide> if err := system.Unshare(ns.Value); err != nil { <ide> return -1, err <ide> func (ns *linuxNs) ExecIn(container *libcontainer.Container, nspid int, args []s <ide> // foreach namespace fd, use setns to join an existing container's namespaces <ide> for _, fd := range fds { <ide> if fd > 0 { <add> ns.logger.Printf("setns on %d\n", fd) <ide> if err := system.Setns(fd, 0); err != nil { <ide> closeFds() <ide> return -1, fmt.Errorf("setns %s", err) <ide> func (ns *linuxNs) ExecIn(container *libcontainer.Container, nspid int, args []s <ide> // if the container has a new pid and mount namespace we need to <ide> // remount proc and sys to pick up the changes <ide> if container.Namespaces.Contains("NEWNS") && container.Namespaces.Contains("NEWPID") { <add> ns.logger.Println("forking to remount /proc and /sys") <ide> pid, err := system.Fork() <ide> if err != nil { <ide> return -1, err <ide><path>pkg/libcontainer/nsinit/init.go <ide> func (ns *linuxNs) Init(container *libcontainer.Container, uncleanRootfs, consol <ide> syncPipe.Close() <ide> return err <ide> } <add> ns.logger.Println("received context from parent") <ide> syncPipe.Close() <ide> <ide> if console != "" { <add> ns.logger.Printf("setting up %s as console\n", console) <ide> slave, err := system.OpenTerminal(console, syscall.O_RDWR) <ide> if err != nil { <ide> return fmt.Errorf("open terminal %s", err) <ide> func (ns *linuxNs) Init(container *libcontainer.Container, uncleanRootfs, consol <ide> if err := system.ParentDeathSignal(); err != nil { <ide> return fmt.Errorf("parent death signal %s", err) <ide> } <add> ns.logger.Println("setup mount namespace") <ide> if err := setupNewMountNamespace(rootfs, container.Mounts, console, container.ReadonlyFs, container.NoPivotRoot); err != nil { <ide> return fmt.Errorf("setup mount namespace %s", err) <ide> } <ide> func (ns *linuxNs) Init(container *libcontainer.Container, uncleanRootfs, consol <ide> return fmt.Errorf("finalize namespace %s", err) <ide> } <ide> <del> if err := apparmor.ApplyProfile(os.Getpid(), container.Context["apparmor_profile"]); err != nil { <del> return err <add> if profile := container.Context["apparmor_profile"]; profile != "" { <add> ns.logger.Printf("setting apparmor prifile %s\n", profile) <add> if err := apparmor.ApplyProfile(os.Getpid(), profile); err != nil { <add> return err <add> } <ide> } <add> ns.logger.Printf("execing %s\n", args[0]) <ide> return system.Execv(args[0], args[0:], container.Env) <ide> } <ide> <ide><path>pkg/libcontainer/nsinit/nsinit.go <ide> package nsinit <ide> <ide> import ( <ide> "github.com/dotcloud/docker/pkg/libcontainer" <add> "log" <ide> ) <ide> <ide> // NsInit is an interface with the public facing methods to provide high level <ide> type linuxNs struct { <ide> root string <ide> commandFactory CommandFactory <ide> stateWriter StateWriter <add> logger *log.Logger <ide> } <ide> <del>func NewNsInit(command CommandFactory, state StateWriter) NsInit { <add>func NewNsInit(command CommandFactory, state StateWriter, logger *log.Logger) NsInit { <ide> return &linuxNs{ <ide> commandFactory: command, <ide> stateWriter: state, <add> logger: logger, <ide> } <ide> } <ide><path>pkg/libcontainer/nsinit/nsinit/main.go <ide> import ( <ide> "flag" <ide> "github.com/dotcloud/docker/pkg/libcontainer" <ide> "github.com/dotcloud/docker/pkg/libcontainer/nsinit" <add> "io" <ide> "io/ioutil" <ide> "log" <ide> "os" <ide> import ( <ide> ) <ide> <ide> var ( <del> root, console string <del> pipeFd int <add> root, console, logs string <add> pipeFd int <ide> ) <ide> <ide> func registerFlags() { <ide> flag.StringVar(&console, "console", "", "console (pty slave) path") <ide> flag.IntVar(&pipeFd, "pipe", 0, "sync pipe fd") <ide> flag.StringVar(&root, "root", ".", "root for storing configuration data") <add> flag.StringVar(&logs, "log", "none", "set stderr or a filepath to enable logging") <ide> <ide> flag.Parse() <ide> } <ide> func main() { <ide> if err != nil { <ide> log.Fatalf("Unable to load container: %s", err) <ide> } <del> ns, err := newNsInit() <add> l, err := getLogger("[exec] ") <add> if err != nil { <add> log.Fatal(err) <add> } <add> <add> ns, err := newNsInit(l) <ide> if err != nil { <ide> log.Fatalf("Unable to initialize nsinit: %s", err) <ide> } <ide> func main() { <ide> nspid, err := readPid() <ide> if err != nil { <ide> if !os.IsNotExist(err) { <del> log.Fatalf("Unable to read pid: %s", err) <add> l.Fatalf("Unable to read pid: %s", err) <ide> } <ide> } <ide> if nspid > 0 { <ide> func main() { <ide> exitCode, err = ns.Exec(container, term, flag.Args()[1:]) <ide> } <ide> if err != nil { <del> log.Fatalf("Failed to exec: %s", err) <add> l.Fatalf("Failed to exec: %s", err) <ide> } <ide> os.Exit(exitCode) <ide> case "init": // this is executed inside of the namespace to setup the container <ide> cwd, err := os.Getwd() <ide> if err != nil { <del> log.Fatal(err) <add> l.Fatal(err) <ide> } <ide> if flag.NArg() < 2 { <del> log.Fatalf("wrong number of argments %d", flag.NArg()) <add> l.Fatalf("wrong number of argments %d", flag.NArg()) <ide> } <ide> syncPipe, err := nsinit.NewSyncPipeFromFd(0, uintptr(pipeFd)) <ide> if err != nil { <del> log.Fatalf("Unable to create sync pipe: %s", err) <add> l.Fatalf("Unable to create sync pipe: %s", err) <ide> } <ide> if err := ns.Init(container, cwd, console, syncPipe, flag.Args()[1:]); err != nil { <del> log.Fatalf("Unable to initialize for container: %s", err) <add> l.Fatalf("Unable to initialize for container: %s", err) <ide> } <ide> default: <del> log.Fatalf("command not supported for nsinit %s", flag.Arg(0)) <add> l.Fatalf("command not supported for nsinit %s", flag.Arg(0)) <ide> } <ide> } <ide> <ide> func readPid() (int, error) { <ide> return pid, nil <ide> } <ide> <del>func newNsInit() (nsinit.NsInit, error) { <del> return nsinit.NewNsInit(&nsinit.DefaultCommandFactory{root}, &nsinit.DefaultStateWriter{root}), nil <add>func newNsInit(l *log.Logger) (nsinit.NsInit, error) { <add> return nsinit.NewNsInit(&nsinit.DefaultCommandFactory{root}, &nsinit.DefaultStateWriter{root}, l), nil <add>} <add> <add>func getLogger(prefix string) (*log.Logger, error) { <add> var w io.Writer <add> switch logs { <add> case "", "none": <add> w = ioutil.Discard <add> case "stderr": <add> w = os.Stderr <add> default: // we have a filepath <add> f, err := os.OpenFile(logs, os.O_CREATE|os.O_RDWR|os.O_APPEND, 0755) <add> if err != nil { <add> return nil, err <add> } <add> w = f <add> } <add> return log.New(w, prefix, log.LstdFlags), nil <ide> }
7
PHP
PHP
use hostname in environment detection
355cbe35a58a7ef9c0106cf773617e1b6359d8f1
<ide><path>laravel/request.php <ide> public static function detect_env(array $environments, $uri) <ide> // we will simply return the environment for that URI pattern. <ide> foreach ($patterns as $pattern) <ide> { <del> if (Str::is($pattern, $uri)) <add> if (Str::is($pattern, $uri) or $pattern == gethostname()) <ide> { <ide> return $environment; <ide> }
1
Javascript
Javascript
use timestamps from qpl by default
ce7dd53dab2b33b0cab640e48a089a8ef81d89ab
<ide><path>Libraries/Utilities/PerformanceLogger.js <ide> const performanceNow = <ide> /* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an <ide> * error found when Flow v0.54 was deployed. To see the error delete this <ide> * comment and run Flow. */ <del> global.nativePerformanceNow || require('fbjs/lib/performanceNow'); <add> global.nativeQPLTimestamp || <add> global.nativePerformanceNow || <add> require('fbjs/lib/performanceNow'); <ide> <ide> type Timespan = { <ide> description?: string,
1
Python
Python
add distilbert + update run_xnli wrt run_glue
d5478b939d64db58972e46b7218c765c918b76ac
<ide><path>examples/run_xnli.py <ide> # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <ide> # See the License for the specific language governing permissions and <ide> # limitations under the License. <del>""" Finetuning multi-lingual models on XNLI (Bert, XLM). <add>""" Finetuning multi-lingual models on XNLI (Bert, DistilBERT, XLM). <ide> Adapted from `examples/run_glue.py`""" <ide> <ide> from __future__ import absolute_import, division, print_function <ide> XLMConfig, XLMForSequenceClassification, XLMTokenizer, <ide> DistilBertConfig, DistilBertForSequenceClassification, DistilBertTokenizer) <ide> <del>from transformers import AdamW, WarmupLinearSchedule <add>from transformers import AdamW, get_linear_schedule_with_warmup <ide> <ide> from transformers import xnli_compute_metrics as compute_metrics <ide> from transformers import xnli_output_modes as output_modes <ide> <ide> logger = logging.getLogger(__name__) <ide> <del>ALL_MODELS = sum((tuple(conf.pretrained_config_archive_map.keys()) for conf in (BertConfig, XLMConfig)), ()) <add>ALL_MODELS = sum((tuple(conf.pretrained_config_archive_map.keys()) for conf in (BertConfig, DistilBertConfig, XLMConfig)), ()) <ide> <ide> MODEL_CLASSES = { <ide> 'bert': (BertConfig, BertForSequenceClassification, BertTokenizer), <ide> 'xlm': (XLMConfig, XLMForSequenceClassification, XLMTokenizer), <del> # 'distilbert': (DistilBertConfig, DistilBertForSequenceClassification, DistilBertTokenizer) <add> 'distilbert': (DistilBertConfig, DistilBertForSequenceClassification, DistilBertTokenizer) <ide> } <ide> <ide> <ide> def train(args, train_dataset, model, tokenizer): <ide> {'params': [p for n, p in model.named_parameters() if any(nd in n for nd in no_decay)], 'weight_decay': 0.0} <ide> ] <ide> optimizer = AdamW(optimizer_grouped_parameters, lr=args.learning_rate, eps=args.adam_epsilon) <del> scheduler = WarmupLinearSchedule(optimizer, warmup_steps=args.warmup_steps, t_total=t_total) <add> scheduler = get_linear_schedule_with_warmup(optimizer, num_warmup_steps=args.warmup_steps, num_training_steps=t_total) <ide> if args.fp16: <ide> try: <ide> from apex import amp <ide> def train(args, train_dataset, model, tokenizer): <ide> loss.backward() <ide> <ide> tr_loss += loss.item() <del> if (step + 1) % args.gradient_accumulation_steps == 0 and not args.tpu: <add> if (step + 1) % args.gradient_accumulation_steps == 0: <ide> if args.fp16: <ide> torch.nn.utils.clip_grad_norm_(amp.master_params(optimizer), args.max_grad_norm) <ide> else: <ide> def train(args, train_dataset, model, tokenizer): <ide> torch.save(args, os.path.join(output_dir, 'training_args.bin')) <ide> logger.info("Saving model checkpoint to %s", output_dir) <ide> <del> if args.tpu: <del> args.xla_model.optimizer_step(optimizer, barrier=True) <del> model.zero_grad() <del> global_step += 1 <del> <ide> if args.max_steps > 0 and global_step > args.max_steps: <ide> epoch_iterator.close() <ide> break <ide> def evaluate(args, model, tokenizer, prefix=""): <ide> eval_sampler = SequentialSampler(eval_dataset) if args.local_rank == -1 else DistributedSampler(eval_dataset) <ide> eval_dataloader = DataLoader(eval_dataset, sampler=eval_sampler, batch_size=args.eval_batch_size) <ide> <add> # multi-gpu eval <add> if args.n_gpu > 1: <add> model = torch.nn.DataParallel(model) <add> <ide> # Eval! <ide> logger.info("***** Running evaluation {} *****".format(prefix)) <ide> logger.info(" Num examples = %d", len(eval_dataset)) <ide> def main(): <ide> parser.add_argument('--seed', type=int, default=42, <ide> help="random seed for initialization") <ide> <del> parser.add_argument('--tpu', action='store_true', <del> help="Whether to run on the TPU defined in the environment variables") <del> parser.add_argument('--tpu_ip_address', type=str, default='', <del> help="TPU IP address if none are set in the environment variables") <del> parser.add_argument('--tpu_name', type=str, default='', <del> help="TPU name if none are set in the environment variables") <del> parser.add_argument('--xrt_tpu_config', type=str, default='', <del> help="XRT TPU config if none are set in the environment variables") <del> <ide> parser.add_argument('--fp16', action='store_true', <ide> help="Whether to use 16-bit (mixed) precision (through NVIDIA apex) instead of 32-bit") <ide> parser.add_argument('--fp16_opt_level', type=str, default='O1', <ide> def main(): <ide> args.n_gpu = 1 <ide> args.device = device <ide> <del> if args.tpu: <del> if args.tpu_ip_address: <del> os.environ["TPU_IP_ADDRESS"] = args.tpu_ip_address <del> if args.tpu_name: <del> os.environ["TPU_NAME"] = args.tpu_name <del> if args.xrt_tpu_config: <del> os.environ["XRT_TPU_CONFIG"] = args.xrt_tpu_config <del> <del> assert "TPU_IP_ADDRESS" in os.environ <del> assert "TPU_NAME" in os.environ <del> assert "XRT_TPU_CONFIG" in os.environ <del> <del> import torch_xla <del> import torch_xla.core.xla_model as xm <del> args.device = xm.xla_device() <del> args.xla_model = xm <del> <ide> # Setup logging <ide> logging.basicConfig(format = '%(asctime)s - %(levelname)s - %(name)s - %(message)s', <ide> datefmt = '%m/%d/%Y %H:%M:%S', <ide> def main(): <ide> <ide> <ide> # Saving best-practices: if you use defaults names for the model, you can reload it using from_pretrained() <del> if args.do_train and (args.local_rank == -1 or torch.distributed.get_rank() == 0) and not args.tpu: <add> if args.do_train and (args.local_rank == -1 or torch.distributed.get_rank() == 0): <ide> # Create output directory if needed <ide> if not os.path.exists(args.output_dir) and args.local_rank in [-1, 0]: <ide> os.makedirs(args.output_dir) <ide> def main(): <ide> <ide> # Load a trained model and vocabulary that you have fine-tuned <ide> model = model_class.from_pretrained(args.output_dir) <del> tokenizer = tokenizer_class.from_pretrained(args.output_dir, do_lower_case=args.do_lower_case) <add> tokenizer = tokenizer_class.from_pretrained(args.output_dir) <ide> model.to(args.device) <ide> <ide>
1
Python
Python
move shape to front to match rest of docs
48b61ec8c4b6e81100d96b3ab854947dd6ab1f64
<ide><path>numpy/lib/function_base.py <ide> def histogramdd(sample, bins=10, range=None, normed=False, weights=None): <ide> normed : bool, optional <ide> If False, returns the number of samples in each bin. If True, <ide> returns the bin density ``bin_count / sample_count / bin_volume``. <del> weights : array_like (N,), optional <add> weights : (N,) array_like, optional <ide> An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`. <ide> Weights are normalized to 1 if normed is True. If normed is False, <ide> the values of the returned histogram are equal to the sum of the <ide> def copy(a, order='K'): <ide> def gradient(f, *varargs, **kwargs): <ide> """ <ide> Return the gradient of an N-dimensional array. <del> <add> <ide> The gradient is computed using second order accurate central differences <del> in the interior and either first differences or second order accurate <add> in the interior and either first differences or second order accurate <ide> one-sides (forward or backwards) differences at the boundaries. The <ide> returned gradient hence has the same shape as the input array. <ide> <ide> def gradient(f, *varargs, **kwargs): <ide> edge_order : {1, 2}, optional <ide> Gradient is calculated using N\ :sup:`th` order accurate differences <ide> at the boundaries. Default: 1. <del> <add> <ide> .. versionadded:: 1.9.1 <ide> <ide> Returns
1
Ruby
Ruby
remove dead code in tests
c822d7f94063e7a3ff48692f87f40751f23a1c25
<ide><path>activerecord/test/cases/pooled_connections_test.rb <ide> def test_pooled_connection_remove <ide> ActiveRecord::Base.connection_pool.remove(extra_connection) <ide> assert_equal ActiveRecord::Base.connection, old_connection <ide> end <del> <del> private <del> def add_record(name) <del> ActiveRecord::Base.connection_pool.with_connection { Project.create! name: name } <del> end <ide> end unless in_memory_db?
1
Text
Text
remove distinctstate from undo history recipe
08101b9b37a07f81e5a603e61153e92d6445d9ef
<ide><path>docs/recipes/ImplementingUndoHistory.md <ide> You will need to wrap the reducer you wish to enhance with `undoable` function. <ide> #### `reducers/todos.js` <ide> <ide> ```js <del>import undoable, { distinctState } from 'redux-undo' <add>import undoable from 'redux-undo' <ide> <ide> /* ... */ <ide> <ide> const todos = (state = [], action) => { <ide> /* ... */ <ide> } <ide> <del>const undoableTodos = undoable(todos, { <del> filter: distinctState() <del>}) <add>const undoableTodos = undoable(todos) <ide> <ide> export default undoableTodos <ide> ``` <ide> <del>The `distinctState()` filter serves to ignore the actions that didn't result in a state change. There are [many other options](https://github.com/omnidan/redux-undo#configuration) to configure your undoable reducer, like setting the action type for Undo and Redo actions. <add>There are [many other options](https://github.com/omnidan/redux-undo#configuration) to configure your undoable reducer, like setting the action type for Undo and Redo actions. <ide> <ide> Note that your `combineReducers()` call will stay exactly as it was, but the `todos` reducer will now refer to the reducer enhanced with Redux Undo: <ide>
1
Ruby
Ruby
use i18n on actionmailer subjects by default
2aafdc839600240a55cea06c960d0a2a7f63016d
<ide><path>actionmailer/lib/action_mailer/base.rb <ide> def create!(method_name, *parameters) #:nodoc: <ide> # Create e-mail parts <ide> create_parts <ide> <del> # If this is a multipart e-mail add the mime_version if it is not <del> # already set. <del> @mime_version ||= "1.0" if !@parts.empty? <add> # Set the subject if not set yet <add> @subject ||= I18n.t(method_name, :scope => [:actionmailer, :subjects, mailer_name], <add> :default => method_name.humanize) <ide> <ide> # build the mail object itself <ide> @mail = create_mail <ide> def create_parts <ide> @content_type = "multipart/alternative" if @content_type !~ /^multipart/ <ide> @parts = sort_parts(@parts, @implicit_parts_order) <ide> end <add> <add> # If this is a multipart e-mail add the mime_version if it is not <add> # already set. <add> @mime_version ||= "1.0" if !@parts.empty? <ide> end <ide> end <ide> <ide><path>actionmailer/test/mail_service_test.rb <ide> def body_ivar(recipient) <ide> body :body => "foo", :bar => "baz" <ide> end <ide> <add> def subject_with_i18n(recipient) <add> recipients recipient <add> from "system@loudthinking.com" <add> render :text => "testing" <add> end <add> <ide> class << self <ide> attr_accessor :received_body <ide> end <ide> def test_signed_up <ide> assert_equal expected.encoded, ActionMailer::Base.deliveries.first.encoded <ide> end <ide> <add> def test_subject_with_i18n <add> assert_nothing_raised { TestMailer.deliver_subject_with_i18n(@recipient) } <add> assert_equal "Subject with i18n", ActionMailer::Base.deliveries.first.subject <add> <add> I18n.backend.store_translations('en', :actionmailer => {:subjects => {:test_mailer => {:subject_with_i18n => "New Subject!"}}}) <add> assert_nothing_raised { TestMailer.deliver_subject_with_i18n(@recipient) } <add> assert_equal "New Subject!", ActionMailer::Base.deliveries.last.subject <add> end <add> <ide> def test_custom_template <ide> expected = new_mail <ide> expected.to = @recipient
2
PHP
PHP
add basic test for post
5b8e16f81468793d53296809ddf5b05667170afb
<ide><path>lib/Cake/Network/Http/Client.php <ide> public function get($url, $data = [], $options = []) { <ide> * @return Cake\Network\Http\Response <ide> */ <ide> public function post($url, $data = [], $options = []) { <add> $options = $this->_mergeOptions($options); <add> $url = $this->buildUrl($url, [], $options); <add> $request = $this->_createRequest( <add> Request::METHOD_POST, <add> $url, <add> $data, <add> $options <add> ); <add> return $this->send($request, $options); <ide> } <ide> <ide> /** <ide> public function patch($url, $data = [], $options = []) { <ide> public function delete($url, $data = [], $options = []) { <ide> } <ide> <del> protected function _mergeOptions($options) <del> { <add>/** <add> * Does a recursive merge of the parameter with the scope config. <add> * <add> * @param array $options Options to merge. <add> * @return array Options merged with set config. <add> */ <add> protected function _mergeOptions($options) { <ide> return Hash::merge($this->_config, $options); <ide> } <ide> <ide><path>lib/Cake/Test/TestCase/Network/Http/ClientTest.php <ide> public function testGetSimple() { <ide> ->method('send') <ide> ->with($this->logicalAnd( <ide> $this->isInstanceOf('Cake\Network\Http\Request'), <add> $this->attributeEqualTo('_method', Request::METHOD_GET), <ide> $this->attributeEqualTo('_url', 'http://cakephp.org/test.html') <ide> )) <ide> ->will($this->returnValue($response)); <ide> public function testGetSimpleWithHeadersAndCookies() { <ide> ->method('send') <ide> ->with($this->logicalAnd( <ide> $this->isInstanceOf('Cake\Network\Http\Request'), <add> $this->attributeEqualTo('_method', Request::METHOD_GET), <ide> $this->attributeEqualTo('_url', 'http://cakephp.org/test.html'), <ide> $this->attributeEqualTo('_headers', $headers), <ide> $this->attributeEqualTo('_cookies', $cookies) <ide> public function testGetQuerystring() { <ide> ->method('send') <ide> ->with($this->logicalAnd( <ide> $this->isInstanceOf('Cake\Network\Http\Request'), <add> $this->attributeEqualTo('_method', Request::METHOD_GET), <ide> $this->attributeEqualTo('_url', 'http://cakephp.org/search?q=hi+there&Category%5Bid%5D%5B0%5D=2&Category%5Bid%5D%5B1%5D=3') <ide> )) <ide> ->will($this->returnValue($response)); <ide> public function testGetWithContent() { <ide> ->method('send') <ide> ->with($this->logicalAnd( <ide> $this->isInstanceOf('Cake\Network\Http\Request'), <add> $this->attributeEqualTo('_method', Request::METHOD_GET), <ide> $this->attributeEqualTo('_url', 'http://cakephp.org/search'), <ide> $this->attributeEqualTo('_content', 'some data') <ide> )) <ide> public function testGetWithContent() { <ide> ]); <ide> $this->assertSame($result, $response); <ide> } <add> <add>/** <add> * test simple POST request. <add> * <add> * @return void <add> */ <add> public function testPostSimple() { <add> $response = new Response(); <add> <add> $mock = $this->getMock('Cake\Network\Http\Adapter\Stream', ['send']); <add> $mock->expects($this->once()) <add> ->method('send') <add> ->with($this->logicalAnd( <add> $this->isInstanceOf('Cake\Network\Http\Request'), <add> $this->attributeEqualTo('_method', Request::METHOD_POST), <add> $this->attributeEqualTo('_url', 'http://cakephp.org/projects/add') <add> )) <add> ->will($this->returnValue($response)); <add> <add> $http = new Client([ <add> 'host' => 'cakephp.org', <add> 'adapter' => $mock <add> ]); <add> $result = $http->post('/projects/add'); <add> $this->assertSame($result, $response); <add> } <add> <ide> }
2
Text
Text
add some items to the release notes [ci skip]
377a07958904633b882b277ff51ada08e1e4d720
<ide><path>guides/source/5_1_release_notes.md <ide> Please refer to the [Changelog][action-pack] for detailed changes. <ide> <ide> ### Removals <ide> <add>* Removed support to non-keyword arguments in `#process`, `#get`, `#post`, <add> `#patch`, `#put`, `#delete`, and `#head` for the `ActionDispatch::IntegrationTest` <add> and `ActionController::TestCase` classes. <add> ([Commit](https://github.com/rails/rails/commit/98b8309569a326910a723f521911e54994b112fb), <add> [Commit](https://github.com/rails/rails/commit/de9542acd56f60d281465a59eac11e15ca8b3323)) <add> <add>* Removed deprecated `ActionDispatch::Callbacks.to_prepare` and <add> `ActionDispatch::Callbacks.to_cleanup`. <add> ([Commit](https://github.com/rails/rails/commit/3f2b7d60a52ffb2ad2d4fcf889c06b631db1946b)) <add> <add>* Removed deprecated methods related to controller filters. <add> ([Commit](https://github.com/rails/rails/commit/d7be30e8babf5e37a891522869e7b0191b79b757)) <add> <ide> ### Deprecations <ide> <add>* Deprecated `config.action_controller.raise_on_unfiltered_parameters`. <add> It doesn't have any effect in Rails 5.1. <add> ([Commit](https://github.com/rails/rails/commit/c6640fb62b10db26004a998d2ece98baede509e5)) <add> <ide> ### Notable changes <ide> <add>* Added the `direct` and `resolve` methods to the routing DSL. <add> ([Pull Request](https://github.com/rails/rails/pull/23138)) <add> <add>* Added a new `ActionDispatch::SystemTestCase` class to write system tests in <add> your applications. <add> ([Pull Request](https://github.com/rails/rails/pull/26703)) <add> <ide> Action View <ide> ------------- <ide> <ide> Please refer to the [Changelog][active-record] for detailed changes. <ide> <ide> ### Notable changes <ide> <add>* Transactional tests now wrap all Active Record connections in database <add> transactions. <add> ([Pull Request](https://github.com/rails/rails/pull/28726)) <add> <ide> * Skipped comments in the output of `mysqldump` command by default. <ide> ([Pull Request](https://github.com/rails/rails/pull/23301)) <ide> <ide> Please refer to the [Changelog][active-support] for detailed changes. <ide> <ide> ### Removals <ide> <add>* Removed the `ActiveSupport::Concurrency::Latch` class. <add> ([Commit](https://github.com/rails/rails/commit/0d7bd2031b4054fbdeab0a00dd58b1b08fb7fea6)) <add> <add>* Removed `halt_callback_chains_on_return_false`. <add> ([Commit](https://github.com/rails/rails/commit/4e63ce53fc25c3bc15c5ebf54bab54fa847ee02a)) <add> <add>* Removed deprecated behavior that halts callbacks when the return is false. <add> ([Commit](https://github.com/rails/rails/commit/3a25cdca3e0d29ee2040931d0cb6c275d612dffe)) <add> <ide> ### Deprecations <ide> <add>* The top level `HashWithIndifferentAccess` class has been softly deprecated <add> in favor of the `ActiveSupport::HashWithIndifferentAccess` one. <add> ([Pull request](https://github.com/rails/rails/pull/28157)) <add> <ide> ### Notable changes <ide> <add>* Fixed duration parsing and traveling to make it consistent across DST changes. <add> ([Commit](https://github.com/rails/rails/commit/8931916f4a1c1d8e70c06063ba63928c5c7eab1e), <add> [Pull Request](https://github.com/rails/rails/pull/26597)) <add> <add>* Updated Unicode to version 9.0.0. <add> ([Pull Request](https://github.com/rails/rails/pull/27822)) <add> <ide> * Added `Module#delegate_missing_to` to delegate method calls not <ide> defined for the current object to a proxy object. <ide> ([Pull Request](https://github.com/rails/rails/pull/23930)) <ide> Please refer to the [Changelog][active-support] for detailed changes. <ide> of the current date & time. <ide> ([Pull Request](https://github.com/rails/rails/pull/24930)) <ide> <add>* Introduced the `assert_changes` and `assert_no_changes` method for tests. <add> ([Pull Request](https://github.com/rails/rails/pull/25393)) <add> <add>* The `travel` and `travel_to` methods now raise on nested calls. <add> ([Pull Request](https://github.com/rails/rails/pull/24890)) <add> <ide> Credits <ide> ------- <ide>
1
Text
Text
add juanarbol as collaborator
8e55c277bf428c27c4b5d6abb21fcb1709fea0b0
<ide><path>README.md <ide> For information about the governance of the Node.js project, see <ide> **João Reis** &lt;reis@janeasystems.com&gt; <ide> * [joyeecheung](https://github.com/joyeecheung) - <ide> **Joyee Cheung** &lt;joyeec9h3@gmail.com&gt; (she/her) <add>* [juanarbol](https://github.com/juanarbol) - <add>**Juan José Arboleda** &lt;soyjuanarbol@gmail.com&gt; (he/him) <ide> * [JungMinu](https://github.com/JungMinu) - <ide> **Minwoo Jung** &lt;nodecorelab@gmail.com&gt; (he/him) <ide> * [kfarnung](https://github.com/kfarnung) -
1
PHP
PHP
update docblock for connectionname
5b6f297b6cec5c92fd42aed5802dddded905e587
<ide><path>src/Illuminate/Queue/Jobs/Job.php <ide> abstract class Job <ide> <ide> /** <ide> * The name of the connection the job belongs to. <add> * <add> * @var string <ide> */ <ide> protected $connectionName; <ide>
1
Java
Java
remove complex nativeanimated queueing mechanisms
934561b2953848c730471a96524e51639ddd2dbd
<ide><path>ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java <ide> public class NativeAnimatedModule extends NativeAnimatedModuleSpec <ide> <ide> private abstract class UIThreadOperation { <ide> abstract void execute(NativeAnimatedNodesManager animatedNodesManager); <del> <del> long mFrameNumber = -1; <del> <del> public void setFrameNumber(long frameNumber) { <del> mFrameNumber = frameNumber; <del> } <del> <del> public long getFrameNumber() { <del> return mFrameNumber; <del> } <ide> } <ide> <ide> @NonNull private final GuardedFrameCallback mAnimatedFrameCallback; <ide> public long getFrameNumber() { <ide> <ide> private @Nullable NativeAnimatedNodesManager mNodesManager; <ide> <del> private volatile long mFrameNumber = 0; <del> private long mDispatchedFrameNumber = 0; <ide> private boolean mInitializedForFabric = false; <ide> private boolean mInitializedForNonFabric = false; <ide> private @UIManagerType int mUIManagerType = UIManagerType.DEFAULT; <ide> public void onHostResume() { <ide> } <ide> <ide> private void addOperation(UIThreadOperation operation) { <del> operation.setFrameNumber(mFrameNumber); <ide> mOperations.add(operation); <ide> } <ide> <ide> private void addPreOperation(UIThreadOperation operation) { <del> operation.setFrameNumber(mFrameNumber); <ide> mPreOperations.add(operation); <ide> } <ide> <del> // For FabricUIManager only <del> @Override <del> public void didScheduleMountItems(UIManager uiManager) { <del> if (mUIManagerType != UIManagerType.FABRIC) { <del> return; <del> } <del> <del> mFrameNumber++; <del> } <del> <ide> // For FabricUIManager only <ide> @Override <ide> @UiThread <ide> public void didDispatchMountItems(UIManager uiManager) { <ide> return; <ide> } <ide> <del> // The problem we're trying to solve here: we could be in the middle of queueing <del> // a batch of related animation operations when Fabric flushes a batch of MountItems. <del> // It's visually bad if we execute half of the animation ops and then wait another frame <del> // (or more) to execute the rest. <del> // See mFrameNumber. If the dispatchedFrameNumber drifts too far - that <del> // is, if no MountItems are scheduled for a while, which can happen if a tree <del> // is committed but there are no changes - bring these counts back in sync and <del> // execute any queued operations. This number is arbitrary, but we want it low <del> // enough that the user shouldn't be able to see this delay in most cases. <del> mDispatchedFrameNumber++; <del> long currentFrameNo = mFrameNumber - 1; <del> if ((mDispatchedFrameNumber - mFrameNumber) > 2) { <del> mFrameNumber = mDispatchedFrameNumber; <del> currentFrameNo = mFrameNumber; <del> } <del> <ide> // This will execute all operations and preOperations queued <ide> // since the last time this was run, and will race with anything <ide> // being queued from the JS thread. That is, if the JS thread <ide> public void didDispatchMountItems(UIManager uiManager) { <ide> // is that `scheduleMountItems` happens as close to the JS commit as <ide> // possible, whereas execution of those same items might happen sometime <ide> // later on the UI thread while the JS thread keeps plugging along. <del> executeAllOperations(mPreOperations, currentFrameNo); <del> executeAllOperations(mOperations, currentFrameNo); <add> executeAllOperations(mPreOperations); <add> executeAllOperations(mOperations); <ide> } <ide> <del> private void executeAllOperations(Queue<UIThreadOperation> operationQueue, long maxFrameNumber) { <add> private void executeAllOperations(Queue<UIThreadOperation> operationQueue) { <ide> NativeAnimatedNodesManager nodesManager = getNodesManager(); <ide> while (true) { <del> // There is a race condition where `peek` may return a non-null value and isEmpty() is false, <del> // but `poll` returns a null value - it's not clear why since we only peek and poll on the UI <del> // thread, but it might be something that happens during teardown or a crash. Regardless, the <del> // root cause is not currently known so we're extra cautious here. <del> // It happens equally in Fabric and non-Fabric. <del> UIThreadOperation peekedOperation = operationQueue.peek(); <del> <del> // This is the same as operationQueue.isEmpty() <del> if (peekedOperation == null) { <del> return; <del> } <del> // The rest of the operations are for the next frame. <del> if (peekedOperation.getFrameNumber() > maxFrameNumber) { <del> return; <del> } <del> <del> // Since we apparently can't guarantee that there is still an operation on the queue, <del> // much less the same operation, we do a poll and another null check. If this isn't <del> // the same operation as the peeked operation, we can't do anything about it - we still <del> // need to execute it, we have no mechanism to put it at the front of the queue, and it <del> // won't cause any errors to execute it earlier than expected (just a bit of UI jank at worst) <del> // so we just continue happily along. <ide> UIThreadOperation polledOperation = operationQueue.poll(); <ide> if (polledOperation == null) { <ide> return; <ide> public void willDispatchViewUpdates(final UIManager uiManager) { <ide> return; <ide> } <ide> <del> final long frameNo = mFrameNumber++; <del> <ide> UIBlock preOperationsUIBlock = <ide> new UIBlock() { <ide> @Override <ide> public void execute(NativeViewHierarchyManager nativeViewHierarchyManager) { <del> executeAllOperations(mPreOperations, frameNo); <add> executeAllOperations(mPreOperations); <ide> } <ide> }; <ide> <ide> UIBlock operationsUIBlock = <ide> new UIBlock() { <ide> @Override <ide> public void execute(NativeViewHierarchyManager nativeViewHierarchyManager) { <del> executeAllOperations(mOperations, frameNo); <add> executeAllOperations(mOperations); <ide> } <ide> }; <ide> <ide><path>ReactAndroid/src/main/java/com/facebook/react/bridge/UIManagerListener.java <ide> public interface UIManagerListener { <ide> void willDispatchViewUpdates(UIManager uiManager); <ide> /* Called right after view updates are dispatched for a frame. */ <ide> void didDispatchMountItems(UIManager uiManager); <del> /* Called right after scheduleMountItems is called in Fabric, after a new tree is committed. */ <del> void didScheduleMountItems(UIManager uiManager); <ide> } <ide><path>ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java <ide> private void scheduleMountItem( <ide> boolean isBatchMountItem = mountItem instanceof BatchMountItem; <ide> boolean shouldSchedule = !(isBatchMountItem && ((BatchMountItem) mountItem).getSize() == 0); <ide> <del> // In case of sync rendering, this could be called on the UI thread. Otherwise, <del> // it should ~always be called on the JS thread. <del> for (UIManagerListener listener : mListeners) { <del> listener.didScheduleMountItems(this); <del> } <del> <ide> if (isBatchMountItem) { <ide> mCommitStartTime = commitStartTime; <ide> mLayoutTime = layoutEndTime - layoutStartTime;
3
Ruby
Ruby
reduce proc call
090aa9e535a36c55ca3f3177318c5900eb0b02fa
<ide><path>actionpack/lib/action_dispatch/middleware/cookies.rb <ide> class CookieJar #:nodoc: <ide> DOMAIN_REGEXP = /[^.]*\.([^.]*|..\...|...\...)$/ <ide> <ide> def self.build(req, cookies) <del> new(req).tap do |jar| <del> jar.update(cookies) <del> end <add> jar = new(req) <add> jar.update(cookies) <add> jar <ide> end <ide> <ide> attr_reader :request
1
Javascript
Javascript
update react jsx transforms
c4658c1728b39c452a86f371ecb1c51874456107
<ide><path>vendor/fbtransform/transforms/__tests__/react-test.js <ide> * See the License for the specific language governing permissions and <ide> * limitations under the License. <ide> * <del> * @emails jeffmo@fb.com <add> * @emails react-core <ide> */ <ide> <ide> /*jshint evil:true, unused:false*/ <ide> describe('react jsx', function() { <ide> }; <ide> <ide> it('should convert simple tags', function() { <del> var code = [ <del> '/**@jsx React.DOM*/', <del> 'var x = <div></div>;' <del> ].join('\n'); <del> var result = [ <del> '/**@jsx React.DOM*/', <del> 'var x = React.createElement(React.DOM.div, null);' <del> ].join('\n'); <add> var code = 'var x = <div></div>;'; <add> var result = 'var x = React.createElement("div", null);'; <ide> <ide> expect(transform(code).code).toEqual(result); <ide> }); <ide> <ide> it('should convert simple text', function() { <del> var code = [ <del> '/**@jsx React.DOM*/\n' + <del> 'var x = <div>text</div>;' <del> ].join('\n'); <del> var result = [ <del> '/**@jsx React.DOM*/', <del> 'var x = React.createElement(React.DOM.div, null, "text");' <del> ].join('\n'); <add> var code = 'var x = <div>text</div>;'; <add> var result = 'var x = React.createElement("div", null, "text");'; <ide> <ide> expect(transform(code).code).toEqual(result); <ide> }); <ide> <ide> it('should have correct comma in nested children', function() { <ide> var code = [ <del> '/**@jsx React.DOM*/', <ide> 'var x = <div>', <ide> ' <div><br /></div>', <ide> ' <Component>{foo}<br />{bar}</Component>', <ide> ' <br />', <ide> '</div>;' <ide> ].join('\n'); <ide> var result = [ <del> '/**@jsx React.DOM*/', <del> 'var x = React.createElement(React.DOM.div, null, ', <del> ' React.createElement(React.DOM.div, null, ' + <del> 'React.createElement(React.DOM.br, null)), ', <add> 'var x = React.createElement("div", null, ', <add> ' React.createElement("div", null, ' + <add> 'React.createElement("br", null)), ', <ide> ' React.createElement(Component, null, foo, ' + <del> 'React.createElement(React.DOM.br, null), bar), ', <del> ' React.createElement(React.DOM.br, null)', <add> 'React.createElement("br", null), bar), ', <add> ' React.createElement("br", null)', <ide> ');' <ide> ].join('\n'); <ide> <ide> describe('react jsx', function() { <ide> it('should avoid wrapping in extra parens if not needed', function() { <ide> // Try with a single composite child, wrapped in a div. <ide> var code = [ <del> '/**@jsx React.DOM*/', <ide> 'var x = <div>', <ide> ' <Component />', <ide> '</div>;' <ide> ].join('\n'); <ide> var result = [ <del> '/**@jsx React.DOM*/', <del> 'var x = React.createElement(React.DOM.div, null, ', <add> 'var x = React.createElement("div", null, ', <ide> ' React.createElement(Component, null)', <ide> ');' <ide> ].join('\n'); <ide> describe('react jsx', function() { <ide> <ide> // Try with a single interpolated child, wrapped in a div. <ide> code = [ <del> '/**@jsx React.DOM*/', <ide> 'var x = <div>', <ide> ' {this.props.children}', <ide> '</div>;' <ide> ].join('\n'); <ide> result = [ <del> '/**@jsx React.DOM*/', <del> 'var x = React.createElement(React.DOM.div, null, ', <add> 'var x = React.createElement("div", null, ', <ide> ' this.props.children', <ide> ');' <ide> ].join('\n'); <ide> expect(transform(code).code).toEqual(result); <ide> <ide> // Try with a single interpolated child, wrapped in a composite. <ide> code = [ <del> '/**@jsx React.DOM*/', <ide> 'var x = <Composite>', <ide> ' {this.props.children}', <ide> '</Composite>;' <ide> ].join('\n'); <ide> result = [ <del> '/**@jsx React.DOM*/', <ide> 'var x = React.createElement(Composite, null, ', <ide> ' this.props.children', <ide> ');' <ide> describe('react jsx', function() { <ide> <ide> // Try with a single composite child, wrapped in a composite. <ide> code = [ <del> '/**@jsx React.DOM*/', <ide> 'var x = <Composite>', <ide> ' <Composite2 />', <ide> '</Composite>;' <ide> ].join('\n'); <ide> result = [ <del> '/**@jsx React.DOM*/', <ide> 'var x = React.createElement(Composite, null, ', <ide> ' React.createElement(Composite2, null)', <ide> ');' <ide> describe('react jsx', function() { <ide> <ide> it('should insert commas after expressions before whitespace', function() { <ide> var code = [ <del> '/**@jsx React.DOM*/', <ide> 'var x =', <ide> ' <div', <ide> ' attr1={', <ide> describe('react jsx', function() { <ide> ' </div>;' <ide> ].join('\n'); <ide> var result = [ <del> '/**@jsx React.DOM*/', <ide> 'var x =', <del> ' React.createElement(React.DOM.div, {', <add> ' React.createElement("div", {', <ide> ' attr1: ', <ide> ' "foo" + "bar", ', <ide> ' ', <ide> describe('react jsx', function() { <ide> <ide> it('should properly handle comments adjacent to children', function() { <ide> var code = [ <del> '/**', <del> ' * @jsx React.DOM', <del> ' */', <ide> 'var x = (', <ide> ' <div>', <ide> ' {/* A comment at the beginning */}', <ide> describe('react jsx', function() { <ide> ');' <ide> ].join('\n'); <ide> var result = [ <del> '/**', <del> ' * @jsx React.DOM', <del> ' */', <ide> 'var x = (', <del> ' React.createElement(React.DOM.div, null, ', <add> ' React.createElement("div", null, ', <ide> ' /* A comment at the beginning */', <ide> ' /* A second comment at the beginning */', <del> ' React.createElement(React.DOM.span, null', <add> ' React.createElement("span", null', <ide> ' /* A nested comment */', <ide> ' ), ', <ide> ' /* A sandwiched comment */', <del> ' React.createElement(React.DOM.br, null)', <add> ' React.createElement("br", null)', <ide> ' /* A comment at the end */', <ide> ' /* A second comment at the end */', <ide> ' )', <ide> describe('react jsx', function() { <ide> <ide> it('should properly handle comments between props', function() { <ide> var code = [ <del> '/**', <del> ' * @jsx React.DOM', <del> ' */', <ide> 'var x = (', <ide> ' <div', <ide> ' /* a multi-line', <ide> describe('react jsx', function() { <ide> ');' <ide> ].join('\n'); <ide> var result = [ <del> '/**', <del> ' * @jsx React.DOM', <del> ' */', <ide> 'var x = (', <del> ' React.createElement(React.DOM.div, {', <add> ' React.createElement("div", {', <ide> ' /* a multi-line', <ide> ' comment */', <ide> ' attr1: "foo"}, ', <del> ' React.createElement(React.DOM.span, {// a double-slash comment', <add> ' React.createElement("span", {// a double-slash comment', <ide> ' attr2: "bar"}', <ide> ' )', <ide> ' )', <ide> describe('react jsx', function() { <ide> <ide> it('should not strip tags with a single child of &nbsp;', function() { <ide> var code = [ <del> '/**', <del> ' * @jsx React.DOM', <del> ' */', <ide> '<div>&nbsp;</div>;' <ide> ].join('\n'); <ide> var result = [ <del> '/**', <del> ' * @jsx React.DOM', <del> ' */', <del> 'React.createElement(React.DOM.div, null, "\u00A0");' <add> 'React.createElement("div", null, "\u00A0");' <ide> ].join('\n'); <ide> <ide> expect(transform(code).code).toBe(result); <ide> }); <ide> <ide> it('should not strip &nbsp; even coupled with other whitespace', function() { <ide> var code = [ <del> '/**', <del> ' * @jsx React.DOM', <del> ' */', <ide> '<div>&nbsp; </div>;' <ide> ].join('\n'); <ide> var result = [ <del> '/**', <del> ' * @jsx React.DOM', <del> ' */', <del> 'React.createElement(React.DOM.div, null, "\u00A0 ");' <add> 'React.createElement("div", null, "\u00A0 ");' <ide> ].join('\n'); <ide> <ide> expect(transform(code).code).toBe(result); <ide> }); <ide> <ide> it('should handle hasOwnProperty correctly', function() { <ide> var code = '<hasOwnProperty>testing</hasOwnProperty>;'; <del> var result = 'React.createElement(hasOwnProperty, null, "testing");'; <add> // var result = 'React.createElement("hasOwnProperty", null, "testing");'; <ide> <del> expect(transform(code).code).toBe(result); <add> // expect(transform(code).code).toBe(result); <add> <add> // This is currently not supported, and will generate a string tag in <add> // a follow up. <add> expect(() => transform(code)).toThrow(); <ide> }); <ide> <ide> it('should allow constructor as prop', function() { <ide> describe('react jsx', function() { <ide> }); <ide> <ide> it('should allow deeper JS namespacing', function() { <del> var code = [ <del> '/**', <del> ' * @jsx React.DOM', <del> ' */', <del> '<Namespace.DeepNamespace.Component />;' <del> ].join('\n'); <del> var result = [ <del> '/**', <del> ' * @jsx React.DOM', <del> ' */', <del> 'React.createElement(Namespace.DeepNamespace.Component, null);' <del> ].join('\n'); <add> var code = '<Namespace.DeepNamespace.Component />;'; <add> var result = <add> 'React.createElement(Namespace.DeepNamespace.Component, null);'; <ide> <ide> expect(transform(code).code).toBe(result); <ide> }); <ide> <ide> it('should disallow XML namespacing', function() { <del> var code = [ <del> '/**', <del> ' * @jsx React.DOM', <del> ' */', <del> '<Namespace:Component />;' <del> ].join('\n'); <add> var code = '<Namespace:Component />;'; <ide> <ide> expect(() => transform(code)).toThrow(); <ide> }); <ide> describe('react jsx', function() { <ide> }); <ide> <ide> it('should transform known hyphenated tags', function() { <del> var code = [ <del> '/**', <del> ' * @jsx React.DOM', <del> ' */', <del> '<font-face />;' <del> ].join('\n'); <del> var result = [ <del> '/**', <del> ' * @jsx React.DOM', <del> ' */', <del> 'React.createElement(React.DOM[\'font-face\'], null);' <del> ].join('\n'); <add> var code = '<font-face />;'; <add> var result = 'React.createElement("font-face", null);'; <ide> <ide> expect(transform(code).code).toBe(result); <ide> }); <ide> describe('react jsx', function() { <ide> }); <ide> <ide> it('should throw for unknown hyphenated tags', function() { <del> var code = [ <del> '/**', <del> ' * @jsx React.DOM', <del> ' */', <del> '<x-component />;' <del> ].join('\n'); <add> var code = '<x-component />;'; <ide> <ide> expect(() => transform(code)).toThrow(); <ide> }); <ide><path>vendor/fbtransform/transforms/react.js <ide> var quoteAttrName = require('./xjs').quoteAttrName; <ide> var trimLeft = require('./xjs').trimLeft; <ide> <ide> /** <del> * Customized desugar processor. <add> * Customized desugar processor for React JSX. Currently: <ide> * <del> * Currently: (Somewhat tailored to React) <del> * <X> </X> => X(null, null) <del> * <X prop="1" /> => X({prop: '1'}, null) <del> * <X prop="2"><Y /></X> => X({prop:'2'}, Y(null, null)) <del> * <X prop="2"><Y /><Z /></X> => X({prop:'2'}, [Y(null, null), Z(null, null)]) <del> * <del> * Exceptions to the simple rules above: <del> * if a property is named "class" it will be changed to "className" in the <del> * javascript since "class" is not a valid object key in javascript. <add> * <X> </X> => React.createElement(X, null) <add> * <X prop="1" /> => React.createElement(X, {prop: '1'}, null) <add> * <X prop="2"><Y /></X> => React.createElement(X, {prop:'2'}, <add> * React.createElement(Y, null) <add> * ) <add> * <div /> => React.createElement("div", null) <ide> */ <ide> <del>var JSX_ATTRIBUTE_TRANSFORMS = { <del> cxName: function(attr) { <del> throw new Error( <del> "cxName is no longer supported, use className={cx(...)} instead" <del> ); <del> } <del>}; <del> <ide> /** <ide> * Removes all non-whitespace/parenthesis characters <ide> */ <ide> function stripNonWhiteParen(value) { <ide> return value.replace(reNonWhiteParen, ''); <ide> } <ide> <add>var tagConvention = /^[a-z]|\-/; <add>function isTagName(name) { <add> return tagConvention.test(name); <add>} <add> <ide> function visitReactTag(traverse, object, path, state) { <del> var jsxObjIdent = utils.getDocblock(state).jsx; <ide> var openingElement = object.openingElement; <ide> var nameObject = openingElement.name; <ide> var attributesObject = openingElement.attributes; <ide> function visitReactTag(traverse, object, path, state) { <ide> throw new Error('Namespace tags are not supported. ReactJSX is not XML.'); <ide> } <ide> <del> var isReact = jsxObjIdent !== 'JSXDOM'; <del> <ide> // We assume that the React runtime is already in scope <del> if (isReact) { <del> utils.append('React.createElement(', state); <del> } <add> utils.append('React.createElement(', state); <ide> <del> // Only identifiers can be fallback tags or need quoting. We don't need to <del> // handle quoting for other types. <del> var didAddTag = false; <del> <del> // Only identifiers can be fallback tags. XJSMemberExpressions are not. <del> if (nameObject.type === Syntax.XJSIdentifier) { <del> var tagName = nameObject.name; <del> var quotedTagName = quoteAttrName(tagName); <del> <del> if (FALLBACK_TAGS.hasOwnProperty(tagName)) { <del> // "Properly" handle invalid identifiers, like <font-face>, which needs to <del> // be enclosed in quotes. <del> var predicate = <del> tagName === quotedTagName ? <del> ('.' + tagName) : <del> ('[' + quotedTagName + ']'); <del> utils.append(jsxObjIdent + predicate, state); <del> utils.move(nameObject.range[1], state); <del> didAddTag = true; <del> } else if (tagName !== quotedTagName) { <del> // If we're in the case where we need to quote and but don't recognize the <del> // tag, throw. <add> // Identifiers with lower case or hypthens are fallback tags (strings). <add> // XJSMemberExpressions are not. <add> if (nameObject.type === Syntax.XJSIdentifier && isTagName(nameObject.name)) { <add> // This is a temporary error message to assist upgrades <add> if (!FALLBACK_TAGS.hasOwnProperty(nameObject.name)) { <ide> throw new Error( <del> 'Tags must be valid JS identifiers or a recognized special case. `<' + <del> tagName + '>` is not one of them.' <add> 'Lower case component names (' + nameObject.name + ') are no longer ' + <add> 'supported in JSX: See http://fb.me/react-jsx-lower-case' <ide> ); <ide> } <del> } <ide> <del> // Use utils.catchup in this case so we can easily handle XJSMemberExpressions <del> // which look like Foo.Bar.Baz. This also handles unhyphenated XJSIdentifiers <del> // that aren't fallback tags. <del> if (!didAddTag) { <add> utils.append('"' + nameObject.name + '"', state); <add> utils.move(nameObject.range[1], state); <add> } else { <add> // Use utils.catchup in this case so we can easily handle <add> // XJSMemberExpressions which look like Foo.Bar.Baz. This also handles <add> // XJSIdentifiers that aren't fallback tags. <ide> utils.move(nameObject.range[0], state); <ide> utils.catchup(nameObject.range[1], state); <ide> } <ide> <del> if (isReact) { <del> utils.append(', ', state); <del> } else { <del> utils.append('(', state); <del> } <add> utils.append(', ', state); <ide> <ide> var hasAttributes = attributesObject.length; <ide> <ide> function visitReactTag(traverse, object, path, state) { <ide> utils.append('}, ', state); <ide> } <ide> <del> <ide> // Move to the expression start, ignoring everything except parenthesis <ide> // and whitespace. <ide> utils.catchup(attr.range[0], state, stripNonWhiteParen); <ide> function visitReactTag(traverse, object, path, state) { <ide> utils.move(attr.name.range[1], state); <ide> // Use catchupNewlines to skip over the '=' in the attribute <ide> utils.catchupNewlines(attr.value.range[0], state); <del> if (JSX_ATTRIBUTE_TRANSFORMS.hasOwnProperty(attr.name.name)) { <del> utils.append(JSX_ATTRIBUTE_TRANSFORMS[attr.name.name](attr), state); <del> utils.move(attr.value.range[1], state); <del> if (!isLast) { <del> utils.append(', ', state); <del> } <del> } else if (attr.value.type === Syntax.Literal) { <add> if (attr.value.type === Syntax.Literal) { <ide> renderXJSLiteral(attr.value, isLast, state); <ide> } else { <ide> renderXJSExpressionContainer(traverse, attr.value, isLast, path, state);
2
Text
Text
fix some text to pass the test
7024a9b08d88d74c4ae4321839af8d11da0219ab
<ide><path>curriculum/challenges/spanish/01-responsive-web-design/basic-html-and-html5/add-placeholder-text-to-a-text-field.spanish.md <ide> localeTitle: Añadir texto de marcador de posición a un campo de texto <ide> --- <ide> <ide> ## Description <del><section id="description"> El texto de marcador de posición es lo que se muestra en su elemento de <code>input</code> antes de que su usuario haya ingresado algo. Puede crear texto de marcador de posición de la siguiente forma: <code>&lt;input type=&quot;text&quot; placeholder=&quot;this is placeholder text&quot;&gt;</code> </section> <add><section id="description"> El texto de marcador de posición (<code>placeholder</code> ) es lo que se muestra en su elemento <code>input</code> antes de que su usuario haya ingresado algo. Puede crear texto de marcador de posición de la siguiente manera: <code>&lt;input type=&quot;text&quot; placeholder=&quot;this is placeholder text&quot;&gt;</code> </section> <ide> <del>## Instructions <del><section id="instructions"> Establezca el valor de <code>placeholder</code> de su <code>input</code> texto en &quot;URL de foto de gato&quot;. </section> <add><section id="instructions"> Establezca el valor del <code>placeholder</code> de su elemento <code>input</code> texto en &quot;URL de foto de gato&quot;. </section> <ide> <ide> ## Tests <ide> <section id='tests'> <ide> <ide> ```yml <ide> tests: <del> - text: Agregue un atributo de <code>placeholder</code> al elemento de <code>input</code> texto existente. <add> - text: Agregue un atributo <code>placeholder</code> al elemento <code>input</code> existente. <ide> testString: 'assert($("input[placeholder]").length > 0, "Add a <code>placeholder</code> attribute to the existing text <code>input</code> element.");' <del> - text: Establezca el valor de su atributo de marcador de posición en "URL de foto de gato". <add> - text: Establezca el valor de su atributo <code>placeholder</code> en "cat photo URL". <ide> testString: 'assert($("input") && $("input").attr("placeholder") && $("input").attr("placeholder").match(/cat\s+photo\s+URL/gi), "Set the value of your placeholder attribute to "cat photo URL".");' <del> - text: El elemento de <code>input</code> terminado debe tener una sintaxis válida. <add> - text: El elemento <code>input</code> completado debe tener una sintaxis válida. <ide> testString: 'assert($("input[type=text]").length > 0 && code.match(/<input((\s+\w+(\s*=\s*(?:".*?"|".*?"|[\^"">\s]+))?)+\s*|\s*)\/?>/gi), "The finished <code>input</code> element should have valid syntax.");' <ide> <ide> ```
1
Python
Python
add tests for ufunc.method overrides
c8ac77c427a880eec455a05b92de9a2260d5f9d9
<ide><path>numpy/core/tests/test_umath.py <ide> def __numpy_ufunc__(self, func, method, pos, inputs, **kwargs): <ide> def test_ufunc_override_methods(self): <ide> class A(object): <ide> def __numpy_ufunc__(self, ufunc, method, pos, inputs, **kwargs): <del> if method == "__call__": <del> return method <del> if method == "reduce": <del> return method <del> if method == "accumulate": <del> return method <del> if method == "reduceat": <del> return method <add> return self, ufunc, method, pos, inputs, kwargs <ide> <add> # __call__ <ide> a = A() <del> res = np.multiply(1, a) <del> assert_equal(res, "__call__") <del> <del> res = np.multiply.reduce(1, a) <del> assert_equal(res, "reduce") <del> <del> res = np.multiply.accumulate(1, a) <del> assert_equal(res, "accumulate") <del> <del> res = np.multiply.reduceat(1, a) <del> assert_equal(res, "reduceat") <del> <del> res = np.multiply(a, 1) <del> assert_equal(res, "__call__") <del> <del> res = np.multiply.reduce(a, 1) <del> assert_equal(res, "reduce") <del> <del> res = np.multiply.accumulate(a, 1) <del> assert_equal(res, "accumulate") <del> <del> res = np.multiply.reduceat(a, 1) <del> assert_equal(res, "reduceat") <add> res = np.multiply.__call__(1, a, foo='bar', answer=42) <add> assert_equal(res[0], a) <add> assert_equal(res[1], np.multiply) <add> assert_equal(res[2], '__call__') <add> assert_equal(res[3], 1) <add> assert_equal(res[4], (1, a)) <add> assert_equal(res[5], {'foo': 'bar', 'answer': 42}) <add> <add> # reduce, positional args <add> res = np.multiply.reduce(a, 'axis0', 'dtype0', 'out0', 'keep0') <add> assert_equal(res[0], a) <add> assert_equal(res[1], np.multiply) <add> assert_equal(res[2], 'reduce') <add> assert_equal(res[3], 0) <add> assert_equal(res[4], (a,)) <add> assert_equal(res[5], {'dtype':'dtype0', <add> 'out': 'out0', <add> 'keepdims': 'keep0', <add> 'axis': 'axis0'}) <add> <add> # reduce, kwargs <add> res = np.multiply.reduce(a, axis='axis0', dtype='dtype0', out='out0', <add> keepdims='keep0') <add> assert_equal(res[0], a) <add> assert_equal(res[1], np.multiply) <add> assert_equal(res[2], 'reduce') <add> assert_equal(res[3], 0) <add> assert_equal(res[4], (a,)) <add> assert_equal(res[5], {'dtype':'dtype0', <add> 'out': 'out0', <add> 'keepdims': 'keep0', <add> 'axis': 'axis0'}) <add> <add> # accumulate, pos args <add> res = np.multiply.accumulate(a, 'axis0', 'dtype0', 'out0') <add> assert_equal(res[0], a) <add> assert_equal(res[1], np.multiply) <add> assert_equal(res[2], 'accumulate') <add> assert_equal(res[3], 0) <add> assert_equal(res[4], (a,)) <add> assert_equal(res[5], {'dtype':'dtype0', <add> 'out': 'out0', <add> 'axis': 'axis0'}) <add> <add> # accumulate, kwargs <add> res = np.multiply.accumulate(a, axis='axis0', dtype='dtype0', <add> out='out0') <add> assert_equal(res[0], a) <add> assert_equal(res[1], np.multiply) <add> assert_equal(res[2], 'accumulate') <add> assert_equal(res[3], 0) <add> assert_equal(res[4], (a,)) <add> assert_equal(res[5], {'dtype':'dtype0', <add> 'out': 'out0', <add> 'axis': 'axis0'}) <add> <add> # reduceat, pos args <add> res = np.multiply.reduceat(a, [4, 2], 'axis0', 'dtype0', 'out0') <add> assert_equal(res[0], a) <add> assert_equal(res[1], np.multiply) <add> assert_equal(res[2], 'reduceat') <add> assert_equal(res[3], 0) <add> assert_equal(res[4], (a, [4, 2])) <add> assert_equal(res[5], {'dtype':'dtype0', <add> 'out': 'out0', <add> 'axis': 'axis0'}) <add> <add> # reduceat, kwargs <add> res = np.multiply.reduceat(a, [4, 2], axis='axis0', dtype='dtype0', <add> out='out0') <add> assert_equal(res[0], a) <add> assert_equal(res[1], np.multiply) <add> assert_equal(res[2], 'reduceat') <add> assert_equal(res[3], 0) <add> assert_equal(res[4], (a, [4, 2])) <add> assert_equal(res[5], {'dtype':'dtype0', <add> 'out': 'out0', <add> 'axis': 'axis0'}) <add> <add> # outer <add> res = np.multiply.outer(a, 42) <add> assert_equal(res[0], a) <add> assert_equal(res[1], np.multiply) <add> assert_equal(res[2], 'outer') <add> assert_equal(res[3], 0) <add> assert_equal(res[4], (a, 42)) <add> assert_equal(res[5], {}) <add> <add> # at <add> res = np.multiply.at(a, [4, 2], 'b0') <add> assert_equal(res[0], a) <add> assert_equal(res[1], np.multiply) <add> assert_equal(res[2], 'at') <add> assert_equal(res[3], 0) <add> assert_equal(res[4], (a, [4, 2], 'b0')) <ide> <ide> def test_ufunc_override_out(self): <ide> class A(object): <ide> def __numpy_ufunc__(self, ufunc, method, pos, inputs, **kwargs): <ide> assert_equal(res7['out'][0], 'out0') <ide> assert_equal(res7['out'][1], 'out1') <ide> <del> <ide> def test_ufunc_override_exception(self): <ide> class A(object): <ide> def __numpy_ufunc__(self, *a, **kwargs):
1
Python
Python
add trailing whitespace to multiline test text
d652ff215d1d6e32b25efa217370fa0c1ef9e0ba
<ide><path>spacy/tests/lang/tt/test_tokenizer.py <ide> <ide> LONG_TEXTS_TESTS = [ <ide> ( <del> "Иң борынгы кешеләр суыклар һәм салкын кышлар булмый торган җылы" <del> "якларда яшәгәннәр, шуңа күрә аларга кием кирәк булмаган.Йөз" <del> "меңнәрчә еллар үткән, борынгы кешеләр акрынлап Европа һәм Азиянең" <del> "салкын илләрендә дә яши башлаганнар. Алар кырыс һәм салкын" <add> "Иң борынгы кешеләр суыклар һәм салкын кышлар булмый торган җылы " <add> "якларда яшәгәннәр, шуңа күрә аларга кием кирәк булмаган.Йөз " <add> "меңнәрчә еллар үткән, борынгы кешеләр акрынлап Европа һәм Азиянең " <add> "салкын илләрендә дә яши башлаганнар. Алар кырыс һәм салкын " <ide> "кышлардан саклану өчен кием-салым уйлап тапканнар - итәк.", <del> "Иң борынгы кешеләр суыклар һәм салкын кышлар булмый торган җылы" <del> "якларда яшәгәннәр , шуңа күрә аларга кием кирәк булмаган . Йөз" <del> "меңнәрчә еллар үткән , борынгы кешеләр акрынлап Европа һәм Азиянең" <del> "салкын илләрендә дә яши башлаганнар . Алар кырыс һәм салкын" <add> "Иң борынгы кешеләр суыклар һәм салкын кышлар булмый торган җылы " <add> "якларда яшәгәннәр , шуңа күрә аларга кием кирәк булмаган . Йөз " <add> "меңнәрчә еллар үткән , борынгы кешеләр акрынлап Европа һәм Азиянең " <add> "салкын илләрендә дә яши башлаганнар . Алар кырыс һәм салкын " <ide> "кышлардан саклану өчен кием-салым уйлап тапканнар - итәк .".split(), <ide> ) <ide> ]
1
Java
Java
provide forcertl for ltr language to test
9de0b79e87f96d0b35d017466e081b9f3428b1fc
<ide><path>ReactAndroid/src/main/java/com/facebook/react/modules/i18nmanager/I18nManagerModule.java <ide> public Map<String, Object> getConstants() { <ide> <ide> @ReactMethod <ide> public void allowRTL(boolean value) { <del> sharedI18nUtilInstance.setAllowRTL( <add> sharedI18nUtilInstance.allowRTL( <add> getReactApplicationContext(), <add> value <add> ); <add> } <add> <add> @ReactMethod <add> public void forceRTL(boolean value) { <add> sharedI18nUtilInstance.forceRTL( <ide> getReactApplicationContext(), <ide> value <ide> ); <ide><path>ReactAndroid/src/main/java/com/facebook/react/modules/i18nmanager/I18nUtil.java <ide> public class I18nUtil { <ide> <ide> private static final String MY_PREFS_NAME = <ide> "com.facebook.react.modules.i18nmanager.I18nUtil"; <del> private static final String KEY_FOR_PREFS = <add> private static final String KEY_FOR_PREFS_ALLOWRTL = <ide> "RCTI18nUtil_allowRTL"; <add> private static final String KEY_FOR_PREFS_FORCERTL = <add> "RCTI18nUtil_forceRTL"; <ide> <ide> private I18nUtil() { <ide> // Exists only to defeat instantiation. <ide> public static I18nUtil getInstance() { <ide> return sharedI18nUtilInstance; <ide> } <ide> <del> // If the current device language is RTL and RTL is allowed for the app, <del> // the RN app will automatically have a RTL layout. <add> /** <add> * Check if the device is currently running on an RTL locale. <add> * This only happens when the app: <add> * - is forcing RTL layout, regardless of the active language (for development purpose) <add> * - allows RTL layout when using RTL locale <add> */ <ide> public boolean isRTL(Context context) { <del> return allowRTL(context) && <add> if (isRTLForced(context)) { <add> return true; <add> } <add> return isRTLAllowed(context) && <ide> isDevicePreferredLanguageRTL(); <ide> } <ide> <del> private boolean allowRTL(Context context) { <add> /** <add> * Should be used very early during app start up <add> * Before the bridge is initialized <add> */ <add> private boolean isRTLAllowed(Context context) { <add> SharedPreferences prefs = <add> context.getSharedPreferences(MY_PREFS_NAME, Context.MODE_PRIVATE); <add> return prefs.getBoolean(KEY_FOR_PREFS_ALLOWRTL, false); <add> } <add> <add> public void allowRTL(Context context, boolean allowRTL) { <add> SharedPreferences.Editor editor = <add> context.getSharedPreferences(MY_PREFS_NAME, Context.MODE_PRIVATE).edit(); <add> editor.putBoolean(KEY_FOR_PREFS_ALLOWRTL, allowRTL); <add> editor.apply(); <add> } <add> <add> /** <add> * Could be used to test RTL layout with English <add> * Used for development and testing purpose <add> */ <add> private boolean isRTLForced(Context context) { <ide> SharedPreferences prefs = <ide> context.getSharedPreferences(MY_PREFS_NAME, Context.MODE_PRIVATE); <del> return prefs.getBoolean(KEY_FOR_PREFS, false); <add> return prefs.getBoolean(KEY_FOR_PREFS_FORCERTL, false); <ide> } <ide> <del> public void setAllowRTL(Context context, boolean allowRTL) { <add> public void forceRTL(Context context, boolean allowRTL) { <ide> SharedPreferences.Editor editor = <ide> context.getSharedPreferences(MY_PREFS_NAME, Context.MODE_PRIVATE).edit(); <del> editor.putBoolean(KEY_FOR_PREFS, allowRTL); <add> editor.putBoolean(KEY_FOR_PREFS_FORCERTL, allowRTL); <ide> editor.apply(); <ide> } <ide>
2
Go
Go
move init layer to top rather than bottom
fdbc2695fe00d522c5c1a962f9be2f802bf53943
<ide><path>devmapper/deviceset_devmapper.go <ide> func (devices *DeviceSetDM) loadMetaData() error { <ide> return nil <ide> } <ide> <del>func (devices *DeviceSetDM) createBaseLayer(dir string) error { <del> for pth, typ := range map[string]string{ <del> "/dev/pts": "dir", <del> "/dev/shm": "dir", <del> "/proc": "dir", <del> "/sys": "dir", <del> "/.dockerinit": "file", <del> "/etc/resolv.conf": "file", <del> "/etc/hosts": "file", <del> "/etc/hostname": "file", <del> // "var/run": "dir", <del> // "var/lock": "dir", <del> } { <del> if _, err := os.Stat(path.Join(dir, pth)); err != nil { <del> if os.IsNotExist(err) { <del> switch typ { <del> case "dir": <del> if err := os.MkdirAll(path.Join(dir, pth), 0755); err != nil { <del> return err <del> } <del> case "file": <del> if err := os.MkdirAll(path.Join(dir, path.Dir(pth)), 0755); err != nil { <del> return err <del> } <del> <del> if f, err := os.OpenFile(path.Join(dir, pth), os.O_CREATE, 0755); err != nil { <del> return err <del> } else { <del> f.Close() <del> } <del> } <del> } else { <del> return err <del> } <del> } <del> } <del> return nil <del>} <del> <ide> func (devices *DeviceSetDM) setupBaseImage() error { <ide> oldInfo := devices.Devices[""] <ide> if oldInfo != nil && oldInfo.Initialized { <ide> func (devices *DeviceSetDM) setupBaseImage() error { <ide> return err <ide> } <ide> <del> tmpDir := path.Join(devices.loopbackDir(), "basefs") <del> if err = os.MkdirAll(tmpDir, 0700); err != nil && !os.IsExist(err) { <del> return err <del> } <del> <del> err = devices.MountDevice("", tmpDir) <del> if err != nil { <del> return err <del> } <del> <del> err = devices.createBaseLayer(tmpDir) <del> if err != nil { <del> _ = syscall.Unmount(tmpDir, 0) <del> return err <del> } <del> <del> err = devices.UnmountDevice("", tmpDir) <del> if err != nil { <del> return err <del> } <del> <del> _ = os.Remove(tmpDir) <del> <ide> info.Initialized = true <ide> <ide> err = devices.saveMetadata() <ide><path>image.go <ide> func (image *Image) ensureImageDevice(devices DeviceSet) error { <ide> return err <ide> } <ide> <add> // The docker init layer is conceptually above all other layers, so we apply <add> // it for every image. This is safe because the layer directory is the <add> // definition of the image, and the device-mapper device is just a cache <add> // of it instantiated. Diffs/commit compare the container device with the <add> // image device, which will then *not* pick up the init layer changes as <add> // part of the container changes <add> dockerinitLayer, err := image.getDockerInitLayer() <add> if err != nil { <add> _ = devices.RemoveDevice(image.ID) <add> return err <add> } <add> err = image.applyLayer(dockerinitLayer, mountDir) <add> if err != nil { <add> _ = devices.RemoveDevice(image.ID) <add> return err <add> } <add> <ide> err = devices.UnmountDevice(image.ID, mountDir) <ide> if err != nil { <ide> _ = devices.RemoveDevice(image.ID)
2
Ruby
Ruby
return compiler versions and builds as versions
20bbeb5e9c4cdd5fb5b7cc92b46325d86b543cf8
<ide><path>Library/Homebrew/compilers.rb <ide> module CompilerConstants <ide> <ide> class CompilerFailure <ide> attr_reader :name <del> attr_rw :version <add> <add> def version(val = nil) <add> if val <add> @version = Version.parse(val.to_s) <add> else <add> @version <add> end <add> end <ide> <ide> # Allows Apple compiler `fails_with` statements to keep using `build` <ide> # even though `build` and `version` are the same internally <ide> def self.create(spec, &block) <ide> <ide> def initialize(name, version, &block) <ide> @name = name <del> @version = version <add> @version = Version.parse(version.to_s) <ide> instance_eval(&block) if block_given? <ide> end <ide> <ide><path>Library/Homebrew/development_tools.rb <ide> def default_compiler <ide> def gcc_40_build_version <ide> @gcc_40_build_version ||= <ide> if (path = locate("gcc-4.0")) <del> `#{path} --version 2>/dev/null`[/build (\d{4,})/, 1].to_i <add> Version.new `#{path} --version 2>/dev/null`[/build (\d{4,})/, 1].to_i <add> else <add> Version::NULL <ide> end <ide> end <ide> alias gcc_4_0_build_version gcc_40_build_version <ide> def gcc_42_build_version <ide> begin <ide> gcc = locate("gcc-4.2") || HOMEBREW_PREFIX.join("opt/apple-gcc42/bin/gcc-4.2") <ide> if gcc.exist? && !gcc.realpath.basename.to_s.start_with?("llvm") <del> `#{gcc} --version 2>/dev/null`[/build (\d{4,})/, 1].to_i <add> Version.new `#{gcc} --version 2>/dev/null`[/build (\d{4,})/, 1] <add> else <add> Version::NULL <ide> end <ide> end <ide> end <ide> def gcc_42_build_version <ide> def clang_version <ide> @clang_version ||= <ide> if (path = locate("clang")) <del> `#{path} --version`[/(?:clang|LLVM) version (\d\.\d)/, 1] <add> Version.new `#{path} --version`[/(?:clang|LLVM) version (\d\.\d)/, 1] <add> else <add> Version::NULL <ide> end <ide> end <ide> <ide> def clang_build_version <ide> @clang_build_version ||= <ide> if (path = locate("clang")) <del> `#{path} --version`[/clang-(\d{2,})/, 1].to_i <add> Version.new `#{path} --version`[/clang-(\d{2,})/, 1] <add> else <add> Version::NULL <ide> end <ide> end <ide> <ide> def non_apple_gcc_version(cc) <ide> (@non_apple_gcc_version ||= {}).fetch(cc) do <ide> path = HOMEBREW_PREFIX.join("opt", "gcc", "bin", cc) <ide> path = locate(cc) unless path.exist? <del> version = `#{path} --version`[/gcc(?:-\d(?:\.\d)? \(.+\))? (\d\.\d\.\d)/, 1] if path <add> version = if path <add> Version.new(`#{path} --version`[/gcc(?:-\d(?:\.\d)? \(.+\))? (\d\.\d\.\d)/, 1]) <add> else <add> Version::NULL <add> end <ide> @non_apple_gcc_version[cc] = version <ide> end <ide> end
2
Python
Python
make polyint work well with object arrays
1a613e1c460d2e7756724b7e5c638c95519ee498
<ide><path>numpy/lib/polynomial.py <ide> def polyint(p, m=1, k=None): <ide> "k must be a scalar or a rank-1 array of length 1 or >m." <ide> <ide> truepoly = isinstance(p, poly1d) <del> p = NX.asarray(p) + 0.0 <add> p = NX.asarray(p) <ide> if m == 0: <ide> if truepoly: <ide> return poly1d(p) <ide> return p <ide> else: <del> y = NX.zeros(len(p) + 1, p.dtype) <del> y[:-1] = p*1.0/NX.arange(len(p), 0, -1) <del> y[-1] = k[0] <add> # Note: this must work also with object and integer arrays <add> y = NX.concatenate((p.__truediv__(NX.arange(len(p), 0, -1)), [k[0]])) <ide> val = polyint(y, m - 1, k=k[1:]) <ide> if truepoly: <ide> return poly1d(val) <ide><path>numpy/lib/tests/test_polynomial.py <ide> def test_polyfit(self) : <ide> cc = np.concatenate((c,c), axis=1) <ide> assert_almost_equal(cc, np.polyfit(x,yy,2)) <ide> <add> def test_objects(self): <add> from decimal import Decimal <add> p = np.poly1d([Decimal('4.0'), Decimal('3.0'), Decimal('2.0')]) <add> p2 = p * Decimal('1.333333333333333') <add> assert p2[1] == Decimal("3.9999999999999990") <add> p2 = p.deriv() <add> assert p2[1] == Decimal('8.0') <add> p2 = p.integ() <add> assert p2[3] == Decimal("1.333333333333333333333333333") <add> assert p2[2] == Decimal('1.5') <add> assert np.issubdtype(p2.coeffs.dtype, np.object_) <add> <add> def test_complex(self): <add> p = np.poly1d([3j, 2j, 1j]) <add> p2 = p.integ() <add> assert (p2.coeffs == [1j,1j,1j,0]).all() <add> p2 = p.deriv() <add> assert (p2.coeffs == [6j,2j]).all() <add> <add> def test_integ_coeffs(self): <add> p = np.poly1d([3,2,1]) <add> p2 = p.integ(3, k=[9,7,6]) <add> assert (p2.coeffs == [1/4./5.,1/3./4.,1/2./3.,9/1./2.,7,6]).all() <ide> <ide> if __name__ == "__main__": <ide> run_module_suite()
2
Text
Text
update experimental status to reflect use
5c2d1af310349e5476c3ce92ba7e965d43f0e7c5
<ide><path>doc/api/documentation.md <ide> <!-- type=misc --> <ide> <ide> The goal of this documentation is to comprehensively explain the Node.js <del>API, both from a reference as well as a conceptual point of view. Each <add>API, both from a reference as well as a conceptual point of view. Each <ide> section describes a built-in module or high-level concept. <ide> <ide> Where appropriate, property types, method arguments, and the arguments <ide> provided to event handlers are detailed in a list underneath the topic <ide> heading. <ide> <ide> Every `.html` document has a corresponding `.json` document presenting <del>the same information in a structured manner. This feature is <add>the same information in a structured manner. This feature is <ide> experimental, and added for the benefit of IDEs and other utilities that <ide> wish to do programmatic things with the documentation. <ide> <ide> Every `.html` and `.json` file is generated based on the corresponding <del>`.md` file in the `doc/api/` folder in Node.js's source tree. The <add>`.md` file in the `doc/api/` folder in Node.js's source tree. The <ide> documentation is generated using the `tools/doc/generate.js` program. <ide> The HTML template is located at `doc/template.html`. <ide> <ide> The stability indices are as follows: <ide> <ide> ```txt <ide> Stability: 0 - Deprecated <del>This feature is known to be problematic, and changes are <del>planned. Do not rely on it. Use of the feature may cause warnings. Backwards <del>compatibility should not be expected. <add>This feature is known to be problematic, and changes may be planned. Do <add>not rely on it. Use of the feature may cause warnings to be emitted. <add>Backwards compatibility across major versions should not be expected. <ide> ``` <ide> <ide> ```txt <ide> Stability: 1 - Experimental <del>This feature is subject to change, and is gated by a command line flag. <del>It may change or be removed in future versions. <add>This feature is still under active development and subject to non-backwards <add>compatible changes, or even removal, in any future version. Use of the feature <add>is not recommended in production environments. Experimental features are not <add>subject to the Node.js Semantic Versioning model. <ide> ``` <ide> <add>*Note*: Caution must be used when making use of `Experimental` features, <add>particularly within modules that may be used as dependencies (or dependencies <add>of dependencies) within a Node.js application. End users may not be aware that <add>experimental features are being used, and therefore may experience unexpected <add>failures or behavioral changes when changes occur. To help avoid such surprises, <add>`Experimental` features may require a command-line flag to explicitly enable <add>them, or may cause a process warning to be emitted. By default, such warnings <add>are printed to `stderr` and may be handled by attaching a listener to the <add>`process.on('warning')` event. <add> <ide> ```txt <ide> Stability: 2 - Stable <ide> The API has proven satisfactory. Compatibility with the npm ecosystem <ide> is a high priority, and will not be broken unless absolutely necessary. <ide> Every HTML file in the markdown has a corresponding JSON file with the <ide> same data. <ide> <del>This feature was added in Node.js v0.6.12. It is experimental. <add>This feature was added in Node.js v0.6.12. It is experimental. <ide> <ide> ## Syscalls and man pages <ide> <ide> and the underlying operating system. Node functions which simply wrap a syscall, <ide> like `fs.open()`, will document that. The docs link to the corresponding man <ide> pages (short for manual pages) which describe how the syscalls work. <ide> <del>**Caveat:** some syscalls, like lchown(2), are BSD-specific. That means, for <add>**Note:** some syscalls, like lchown(2), are BSD-specific. That means, for <ide> example, that `fs.lchown()` only works on macOS and other BSD-derived systems, <ide> and is not available on Linux. <ide>
1
Go
Go
implement changes for aufs driver
ed1884461331d7c2d6561be30b09da9df6612d39
<ide><path>aufs/aufs.go <ide> func (a *AufsDriver) Create(id, parent string) error { <ide> return err <ide> } <ide> <del> fmt.Fprintln(f, parent) <add> if _, err := fmt.Fprintln(f, parent); err != nil { <add> return err <add> } <ide> for _, i := range ids { <del> fmt.Fprintln(f, i) <add> if _, err := fmt.Fprintln(f, i); err != nil { <add> return err <add> } <ide> } <ide> } <ide> return nil <ide> func (a *AufsDriver) DiffSize(id string) (int64, error) { <ide> } <ide> <ide> func (a *AufsDriver) Changes(id string) ([]archive.Change, error) { <del> return nil, nil <add> layers, err := a.getParentLayerPaths(id) <add> if err != nil { <add> return nil, err <add> } <add> return archive.Changes(layers, path.Join(a.rootPath(), "diff", id)) <add>} <add> <add>func (a *AufsDriver) getParentLayerPaths(id string) ([]string, error) { <add> parentIds, err := getParentIds(a.rootPath(), id) <add> if err != nil { <add> return nil, err <add> } <add> if len(parentIds) == 0 { <add> return nil, fmt.Errorf("Dir %s does not have any parent layers", id) <add> } <add> layers := make([]string, len(parentIds)) <add> <add> // Get the diff paths for all the parent ids <add> for i, p := range parentIds { <add> layers[i] = path.Join(a.rootPath(), "diff", p) <add> } <add> return layers, nil <ide> } <ide> <ide> func (a *AufsDriver) mount(id string) error { <ide> func (a *AufsDriver) mount(id string) error { <ide> return err <ide> } <ide> <del> parentIds, err := getParentIds(a.rootPath(), id) <del> if err != nil { <del> return err <del> } <del> if len(parentIds) == 0 { <del> return fmt.Errorf("Dir %s does not have any parent layers", id) <del> } <ide> var ( <ide> target = path.Join(a.rootPath(), "mnt", id) <ide> rw = path.Join(a.rootPath(), "diff", id) <del> layers = make([]string, len(parentIds)) <ide> ) <ide> <del> // Get the diff paths for all the parent ids <del> for i, p := range parentIds { <del> layers[i] = path.Join(a.rootPath(), "diff", p) <add> layers, err := a.getParentLayerPaths(id) <add> if err != nil { <add> return err <ide> } <ide> <ide> if err := a.aufsMount(layers, rw, target); err != nil { <ide><path>aufs/aufs_test.go <ide> package aufs <ide> <ide> import ( <add> "github.com/dotcloud/docker/archive" <ide> "os" <ide> "path" <ide> "testing" <ide> func TestGetDiff(t *testing.T) { <ide> } <ide> } <ide> <add>func TestChanges(t *testing.T) { <add> d := newDriver(t) <add> defer os.RemoveAll(tmp) <add> <add> if err := d.Create("1", ""); err != nil { <add> t.Fatal(err) <add> } <add> if err := d.Create("2", "1"); err != nil { <add> t.Fatal(err) <add> } <add> <add> defer func() { <add> if err := d.Cleanup(); err != nil { <add> t.Fatal(err) <add> } <add> }() <add> <add> mntPoint, err := d.Get("2") <add> if err != nil { <add> t.Fatal(err) <add> } <add> <add> // Create a file to save in the mountpoint <add> f, err := os.Create(path.Join(mntPoint, "test.txt")) <add> if err != nil { <add> t.Fatal(err) <add> } <add> <add> if _, err := f.WriteString("testline"); err != nil { <add> t.Fatal(err) <add> } <add> if err := f.Close(); err != nil { <add> t.Fatal(err) <add> } <add> <add> changes, err := d.Changes("2") <add> if err != nil { <add> t.Fatal(err) <add> } <add> if len(changes) != 1 { <add> t.Fatalf("Dir 2 should have one change from parent got %d", len(changes)) <add> } <add> change := changes[0] <add> <add> expectedPath := "/test.txt" <add> if change.Path != expectedPath { <add> t.Fatalf("Expected path %s got %s", expectedPath, change.Path) <add> } <add> <add> if change.Kind != archive.ChangeAdd { <add> t.Fatalf("Change kind should be ChangeAdd got %s", change.Kind) <add> } <add>} <add> <ide> /* FIXME: How to properly test this? <ide> func TestDiffSize(t *testing.T) { <ide> d := newDriver(t) <ide><path>aufs/dirs.go <ide> func getParentIds(root, id string) ([]string, error) { <ide> s := bufio.NewScanner(f) <ide> <ide> for s.Scan() { <del> if err := s.Err(); err != nil { <del> return nil, err <add> if t := s.Text(); t != "" { <add> out = append(out, s.Text()) <ide> } <del> out = append(out, s.Text()) <ide> } <del> return out, nil <add> return out, s.Err() <ide> }
3
Javascript
Javascript
add log when in watch mode
9b92c4d4d1fcb641751064cded4b062f20bc521d
<ide><path>bin/webpack.js <ide> function processOptions(options) { <ide> process.stdin.resume(); <ide> } <ide> compiler.watch(watchOptions, compilerCallback); <add> console.log('\nWebpack is watching the files…\n'); <ide> } else <ide> compiler.run(compilerCallback); <ide>
1
Javascript
Javascript
convert a for in loop to a plain for loop
0fa2b3032398a168c7f0569d9b3c949a78e42155
<ide><path>packages/ember-metal/lib/mixin.js <ide> function addNormalizedProperty(base, key, value, meta, descs, values, concats) { <ide> } <ide> } <ide> <del>function mergeMixins(mixins, m, descs, values, base) { <add>function mergeMixins(mixins, m, descs, values, base, keys) { <ide> var mixin, props, key, concats, meta; <ide> <ide> function removeKeys(keyName) { <ide> function mergeMixins(mixins, m, descs, values, base) { <ide> <ide> for (key in props) { <ide> if (!props.hasOwnProperty(key)) { continue; } <add> keys.push(key); <ide> addNormalizedProperty(base, key, props[key], meta, descs, values, concats); <ide> } <ide> <ide> // manually copy toString() because some JS engines do not enumerate it <ide> if (props.hasOwnProperty('toString')) { base.toString = props.toString; } <ide> } else if (mixin.mixins) { <del> mergeMixins(mixin.mixins, m, descs, values, base); <add> mergeMixins(mixin.mixins, m, descs, values, base, keys); <ide> if (mixin._without) { a_forEach.call(mixin._without, removeKeys); } <ide> } <ide> } <ide> function replaceObservers(obj, key, observer) { <ide> <ide> function applyMixin(obj, mixins, partial) { <ide> var descs = {}, values = {}, m = Ember.meta(obj), <del> key, value, desc; <add> key, value, desc, keys = []; <ide> <ide> // Go through all mixins and hashes passed in, and: <ide> // <ide> // * Handle concatenated properties <ide> // * Set up _super wrapping if necessary <ide> // * Set up computed property descriptors <ide> // * Copying `toString` in broken browsers <del> mergeMixins(mixins, mixinsMeta(obj), descs, values, obj); <add> mergeMixins(mixins, mixinsMeta(obj), descs, values, obj, keys); <ide> <del> for(key in values) { <add> for(var i = 0, l = keys.length; i < l; i++) { <add> key = keys[i]; <ide> if (key === 'constructor' || !values.hasOwnProperty(key)) { continue; } <ide> <ide> desc = descs[key];
1
PHP
PHP
use cache repository
388c3a81b9aed8b936e5821a6141daa619954814
<ide><path>src/Illuminate/Queue/Worker.php <ide> <ide> use Illuminate\Queue\Jobs\Job; <ide> use Illuminate\Events\Dispatcher; <del>use Illuminate\Cache\StoreInterface; <add>use Illuminate\Cache\Repository as CacheRepository; <ide> use Illuminate\Queue\Failed\FailedJobProviderInterface; <ide> <ide> class Worker { <ide> class Worker { <ide> */ <ide> protected $events; <ide> <add> /** <add> * The cache repository implementation. <add> * <add> * @var \Illuminate\Cache\Repository <add> */ <add> protected $cache; <add> <ide> /** <ide> * The exception handler instance. <ide> * <ide> public function setDaemonExceptionHandler($handler) <ide> } <ide> <ide> /** <del> * Set the cache store implementation. <add> * Set the cache repository implementation. <ide> * <del> * @param \Illuminate\Cache\StoreInterface $cache <add> * @param \Illuminate\Cache\Repository $cache <ide> * @return void <ide> */ <del> public function setCache(StoreInterface $cache) <add> public function setCache(CacheRepository $cache) <ide> { <ide> $this->cache = $cache; <ide> }
1
Text
Text
add changelog for
d3e9ca92c7b5910e6a203af7fa90518e684d4e39
<ide><path>activerecord/CHANGELOG.md <add>* Add `update!` that works like `update` but raises exceptions <add> <add> *Dorian Marié* <add> <ide> * Add `ActiveRecord::Base#attributes_for_database` <ide> <ide> Returns attributes with values for assignment to the database.
1
Text
Text
add guidelines about releasing providers
77ab986f2bdf194048c69967a568a285cd8f440b
<ide><path>dev/PROJECT_GUIDELINES.md <ide> <!-- START doctoc generated TOC please keep comment here to allow auto update --> <ide> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <ide> <del>- [Overview](#overview) <del> - [Adding a Committer or PMC Member](#adding-a-committer-or-pmc-member) <del> - [Airflow Improvement Proposals (AIPs)](#airflow-improvement-proposals-aips) <del> - [Support for Airflow 1.10.x releases](#support-for-airflow-110x-releases) <del> - [Support for Backport Providers](#support-for-backport-providers) <del> - [Release Guidelines](#release-guidelines) <add>- [Adding a Committer or PMC Member](#adding-a-committer-or-pmc-member) <add>- [Airflow Improvement Proposals (AIPs)](#airflow-improvement-proposals-aips) <add>- [Support for Airflow 1.10.x releases](#support-for-airflow-110x-releases) <add>- [Support for Backport Providers](#support-for-backport-providers) <add>- [Release Guidelines](#release-guidelines) <ide> <ide> <!-- END doctoc generated TOC please keep comment here to allow auto update --> <ide> <del> <del># Overview <del> <ide> This document describes all the guidelines that have been agreed upon by the committers and PMC <ide> members on the mailing list. <ide> <ide> Backport providers within 1.10.x, are not released any more, as of (March 17, 20 <ide> <ide> - Follow Semantic Versioning ([SEMVER](https://semver.org/)) <ide> - Changing the version of dependency should not count as breaking change <add> <add>### Providers <add> <add>#### Batch & Ad-hoc Releases <add> <add>- Release Manager would default to releasing Providers in Batch <add>- If there is a critical bug that needs fixing in a single provider, an ad-hoc release for <add>that provider will be created <add> <add>#### Frequency <add> <add>We will release all providers **every month** (Mostly first week of the month) <add> <add>**Note**: that it generally takes around a week for the vote to pass even <add>though we have 72 hours minimum period <add> <add>#### Doc-only changes <add> <add>When provider(s) has doc-only changes during batch-release, we <add>will not release that provider with a new version. As unliked the <add>actual releases, our doc releases are mutable. <add> <add>So, we will simply tag that those providers with `*-doc1`, `*-doc2` tags in the repo <add>to release docs for it.
1
Javascript
Javascript
convert `container` to es6 class
0c62821a2f773457b57f1218ffede3f19e9b426d
<ide><path>packages/container/lib/container.js <ide> const CONTAINER_OVERRIDE = symbol('CONTAINER_OVERRIDE'); <ide> @private <ide> @class Container <ide> */ <del>export default function Container(registry, options = {}) { <del> this.registry = registry; <del> this.owner = options.owner || null; <del> this.cache = dictionary(options.cache || null); <del> this.factoryManagerCache = dictionary(options.factoryManagerCache || null); <del> this[CONTAINER_OVERRIDE] = undefined; <del> this.isDestroyed = false; <del> <del> if (DEBUG) { <del> this.validationCache = dictionary(options.validationCache || null); <add>export default class Container { <add> constructor(registry, options = {}) { <add> this.registry = registry; <add> this.owner = options.owner || null; <add> this.cache = dictionary(options.cache || null); <add> this.factoryManagerCache = dictionary(options.factoryManagerCache || null); <add> this[CONTAINER_OVERRIDE] = undefined; <add> this.isDestroyed = false; <add> <add> if (DEBUG) { <add> this.validationCache = dictionary(options.validationCache || null); <add> } <ide> } <del>} <ide> <del>Container.prototype = { <ide> /** <ide> @private <ide> @property registry <ide> Container.prototype = { <ide> lookup(fullName, options) { <ide> assert('fullName must be a proper full name', this.registry.validateFullName(fullName)); <ide> return lookup(this, this.registry.normalize(fullName), options); <del> }, <add> } <ide> <ide> /** <ide> A depth first traversal, destroying the container, its descendant containers and all <ide> Container.prototype = { <ide> destroy() { <ide> destroyDestroyables(this); <ide> this.isDestroyed = true; <del> }, <add> } <ide> <ide> /** <ide> Clear either the entire cache or just the cache for a particular key. <ide> Container.prototype = { <ide> } else { <ide> resetMember(this, this.registry.normalize(fullName)); <ide> } <del> }, <add> } <ide> <ide> /** <ide> Returns an object that can be used to provide an owner to a <ide> Container.prototype = { <ide> */ <ide> ownerInjection() { <ide> return { [OWNER]: this.owner }; <del> }, <add> } <ide> <ide> _resolverCacheKey(name, options) { <ide> return this.registry.resolverCacheKey(name, options); <del> }, <add> } <ide> <ide> /** <ide> Given a fullName, return the corresponding factory. The consumer of the factory <ide> Container.prototype = { <ide> this.factoryManagerCache[cacheKey] = manager; <ide> return manager; <ide> } <del>}; <del> <add>} <ide> /* <ide> * Wrap a factory manager in a proxy which will not permit properties to be <ide> * set on the manager.
1
Text
Text
move mafintosh to collaborators
acc328ef5884ab55538c3953caea144b3f00e07a
<ide><path>README.md <ide> For more information about the governance of the Node.js project, see <ide> **James M Snell** &lt;jasnell@gmail.com&gt; (he/him) <ide> * [joyeecheung](https://github.com/joyeecheung) - <ide> **Joyee Cheung** &lt;joyeec9h3@gmail.com&gt; (she/her) <del>* [mafintosh](https://github.com/mafintosh) <del>**Mathias Buus** &lt;mathiasbuus@gmail.com&gt; (he/him) <ide> * [mcollina](https://github.com/mcollina) - <ide> **Matteo Collina** &lt;matteo.collina@gmail.com&gt; (he/him) <ide> * [mhdawson](https://github.com/mhdawson) - <ide> For more information about the governance of the Node.js project, see <ide> **Luca Maraschi** &lt;luca.maraschi@gmail.com&gt; (he/him) <ide> * [maclover7](https://github.com/maclover7) - <ide> **Jon Moss** &lt;me@jonathanmoss.me&gt; (he/him) <add>* [mafintosh](https://github.com/mafintosh) <add>**Mathias Buus** &lt;mathiasbuus@gmail.com&gt; (he/him) <ide> * [mcollina](https://github.com/mcollina) - <ide> **Matteo Collina** &lt;matteo.collina@gmail.com&gt; (he/him) <ide> * [mhdawson](https://github.com/mhdawson) -
1
Ruby
Ruby
fix typo in deprecation warning
3cce44698e307e4b2f515b127be178340c6e7782
<ide><path>actionpack/lib/action_dispatch/http/response.rb <ide> def each(&block) <ide> <ide> def self.return_only_media_type_on_content_type=(*) <ide> ActiveSupport::Deprecation.warn( <del> ".return_only_media_type_on_content_type= is dreprecated with no replacement and will be removed in 7.0." <add> ".return_only_media_type_on_content_type= is deprecated with no replacement and will be removed in 7.0." <ide> ) <ide> end <ide> <ide> def self.return_only_media_type_on_content_type <ide> ActiveSupport::Deprecation.warn( <del> ".return_only_media_type_on_content_type is dreprecated with no replacement and will be removed in 7.0." <add> ".return_only_media_type_on_content_type is deprecated with no replacement and will be removed in 7.0." <ide> ) <ide> end <ide>
1
Javascript
Javascript
bring kde example up-to-date
0305892a9619cda5a1e169d25743ddd7f86bed33
<ide><path>examples/kde/kde.js <ide> // Based on http://bl.ocks.org/900762 by John Firebaugh <ide> d3.json("../data/faithful.json", function(faithful) { <ide> data = faithful; <del> var w = 800, <del> h = 400, <del> x = d3.scale.linear().domain([30, 110]).range([0, w]); <add> var width = 800, <add> height = 400, <ide> bins = d3.layout.histogram().frequency(false).bins(x.ticks(60))(data), <del> max = d3.max(bins, function(d) { return d.y; }), <del> y = d3.scale.linear().domain([0, .1]).range([0, h]), <del> kde = science.stats.kde().sample(data); <add> max = d3.max(bins, function(d) { return d.y; }); <add> <add> var x = d3.scale.linear() <add> .domain([30, 110]).range([0, width]); <add> <add> var y = d3.scale.linear() <add> .domain([0, .1]) <add> .range([0, height]); <add> <add> var kde = science.stats.kde().sample(data); <ide> <ide> var vis = d3.select("body") <ide> .append("svg") <del> .attr("width", w) <del> .attr("height", h); <add> .attr("width", width) <add> .attr("height", height); <ide> <ide> var bars = vis.selectAll("g.bar") <ide> .data(bins) <ide> .enter().append("g") <ide> .attr("class", "bar") <ide> .attr("transform", function(d, i) { <del> return "translate(" + x(d.x) + "," + (h - y(d.y)) + ")"; <add> return "translate(" + x(d.x) + "," + (height - y(d.y)) + ")"; <ide> }); <ide> <ide> bars.append("rect") <ide> d3.json("../data/faithful.json", function(faithful) { <ide> <ide> var line = d3.svg.line() <ide> .x(function(d) { return x(d[0]); }) <del> .y(function(d) { return h - y(d[1]); }); <add> .y(function(d) { return height - y(d[1]); }); <ide> <ide> vis.selectAll("path") <ide> .data(d3.values(science.stats.bandwidth))
1
Text
Text
add changelog entry for
40be61dfda1e04c3f306022a40370862e3a2ce39
<ide><path>actionmailer/CHANGELOG.md <add>* Add support to fragment cache in Action Mailer. <add> <add> Now you can use fragment caching in your mailers views. <add> <add> *Stan Lo* <add> <ide> * Reset `ActionMailer::Base.deliveries` after every test in <ide> `ActionDispatch::IntegrationTest`. <ide>
1
Python
Python
add counts to verbose list of ner labels
f00254ae276eca963991efb8a45748b2948b1c77
<ide><path>spacy/cli/debug_data.py <ide> def debug_data( <ide> if label != "-" <ide> ] <ide> labels_with_counts = _format_labels(labels_with_counts, counts=True) <del> msg.text(f"Labels in train data: {_format_labels(labels)}", show=verbose) <add> msg.text(f"Labels in train data: {labels_with_counts}", show=verbose) <ide> missing_labels = model_labels - labels <ide> if missing_labels: <ide> msg.warn(
1
Javascript
Javascript
fix manifest build order
3fd472e5948d54d9c3a217adec9eb97521f1a596
<ide><path>gulpfile.js <ide> function delRev(dest, manifestName) { <ide> }); <ide> } <ide> <del>gulp.task('serve', function(cb) { <add>gulp.task('serve', ['build-manifest'], function(cb) { <ide> var called = false; <ide> nodemon({ <ide> script: paths.server, <ide> function buildManifest() { <ide> .pipe(gulp.dest('server/')); <ide> } <ide> <del>var buildDependents = ['less', 'js', 'dependents']; <add>var buildDependents = ['less', 'js', 'dependents', 'pack-watch-manifest']; <ide> <ide> gulp.task('build-manifest', buildDependents, function() { <ide> return buildManifest(); <ide> var watchDependents = [ <ide> 'dependents', <ide> 'serve', <ide> 'sync', <del> 'build-manifest', <ide> 'pack-watch', <del> 'pack-watch-manifest' <add> 'pack-watch-manifest', <add> 'build-manifest' <ide> ]; <ide> <ide> gulp.task('reload', function() { <ide> gulp.task('default', [ <ide> 'serve', <ide> 'pack-watch', <ide> 'pack-watch-manifest', <add> 'build-manifest-watch', <ide> 'watch', <ide> 'sync' <ide> ]);
1
Text
Text
add api docs
1c63f02f99d6c3d663c4a9cfb0e3395986bd7598
<ide><path>website/docs/api/doc.md <ide> alignment mode `"strict". <ide> | `alignment_mode` | How character indices snap to token boundaries. Options: `"strict"` (no snapping), `"contract"` (span of all tokens completely within the character span), `"expand"` (span of all tokens at least partially covered by the character span). Defaults to `"strict"`. ~~str~~ | <ide> | **RETURNS** | The newly constructed object or `None`. ~~Optional[Span]~~ | <ide> <add>## Doc.set_ents {#ents tag="method" new="3"} <add> <add>Set the named entities in the document. <add> <add>> #### Example <add>> <add>> ```python <add>> from spacy.tokens import Span <add>> doc = nlp("Mr. Best flew to New York on Saturday morning.") <add>> doc.set_ents([Span(doc, 0, 2, "PERSON")]) <add>> ents = list(doc.ents) <add>> assert ents[0].label_ == "PERSON" <add>> assert ents[0].text == "Mr. Best" <add>> ``` <add> <add>| Name | Description | <add>| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | <add>| entities | Spans with labels to set as entities. ~~List[Span]~~ | <add>| _keyword-only_ | | <add>| blocked | Spans to set as "blocked" (never an entity) for spacy's built-in NER component. Other components may ignore this setting. ~~Optional[List[Span]]~~ | <add>| missing | Spans with missing/unknown entity information. ~~Optional[List[Span]]~~ | <add>| outside | Spans outside of entities (O in IOB). ~~Optional[List[Span]]~~ | <add>| default | How to set entity annotation for tokens outside of any provided spans. Options: "blocked", "missing", "outside" and "unmodified" (preserve current state). Defaults to "outside". ~~str~~ | <add> <ide> ## Doc.similarity {#similarity tag="method" model="vectors"} <ide> <ide> Make a semantic similarity estimate. The default estimate is cosine similarity <ide> objects, if the entity recognizer has been applied. <ide> > ```python <ide> > doc = nlp("Mr. Best flew to New York on Saturday morning.") <ide> > ents = list(doc.ents) <del>> assert ents[0].label == 346 <ide> > assert ents[0].label_ == "PERSON" <ide> > assert ents[0].text == "Mr. Best" <ide> > ```
1
Javascript
Javascript
use composition instead of mutable state
cc0e7d2a79c12c516368e14aacff3cc71d8e3868
<ide><path>examples/ballmer-peak/example.js <ide> function computeBallmerPeak(x) { <ide> ) / 1.6; <ide> } <ide> <add>function percentage(x) { <add> return isNaN(x) ? 'N/A' : (100 - Math.round(pct * 100)) + '%'; <add>} <add> <ide> var BallmerPeakCalculator = React.createClass({ <ide> getInitialState: function() { <ide> return {bac: 0}; <ide> var BallmerPeakCalculator = React.createClass({ <ide> this.setState({bac: event.target.value}); <ide> }, <ide> render: function() { <del> var pct = computeBallmerPeak(this.state.bac); <del> if (isNaN(pct)) { <del> pct = 'N/A'; <del> } else { <del> pct = (100 - Math.round(pct * 100)) + '%'; <del> } <add> var pct = percentage(computeBallmerPeak(this.state.bac)); <ide> return ( <ide> <div> <ide> <img src="./ballmer_peak.png" />
1
Text
Text
add link to eslint rules
63bf6a6f22cef9ec74af326bc59450188a6c9fa0
<ide><path>threejs/lessons/threejs-prerequisites.md <ide> You'll get warnings using `THREE` so add `/* global THREE */` at the top of your <ide> <ide> Above you can see eslint knows the rule that `UpperCaseNames` are constructors and so you should be using `new`. Another error caught and avoided. This is [the `new-cap` rule](https://eslint.org/docs/rules/new-cap). <ide> <del>There's 100s of rules you can turn on or off or customize. For example above I mentioned you should use `const` and `let` over `var`. <add>There are [100s of rules you can turn on or off or customize](https://eslint.org/docs/rules/). For example above I mentioned you should use `const` and `let` over `var`. <ide> <ide> Here I used `var` and it warned me I should use `let` or `const` <ide> <ide> Here I used `let` but it saw I never change the value so it suggested I use `con <ide> <ide> <div class="threejs_center"><img style="width: 615px;" src="resources/images/vscode-eslint-let.png"></div> <ide> <add>Of course if you'd prefer to keep using `var` you can just turn off that rule. As I said above though I prefer to use `const` and `let` over `var` as they just work better and prevent bugs. <add> <ide> For those cases where you really need to override a rule [you can add comments to disable them](https://eslint.org/docs/user-guide/configuring#disabling-rules-with-inline-comments) for a single line or a section of code. <ide> <ide> # If you really need to support legacy browsers use a transpiler
1
Ruby
Ruby
add regression test to `as` option
af2b7459090f108bdfe662618792f423c347d8ac
<ide><path>actionpack/test/controller/integration_test.rb <ide> def foos_wibble <ide> end <ide> end <ide> <add> def test_standard_json_encoding_works <add> with_routing do |routes| <add> routes.draw do <add> ActiveSupport::Deprecation.silence do <add> post ':action' => FooController <add> end <add> end <add> <add> post '/foos_json.json', params: { foo: 'fighters' }.to_json, <add> headers: { 'Content-Type' => 'application/json' } <add> <add> assert_response :success <add> assert_equal({ 'foo' => 'fighters' }, response.parsed_body) <add> end <add> end <add> <ide> def test_encoding_as_json <ide> post_to_foos as: :json do <ide> assert_response :success
1
Python
Python
add new deprecation date
31e3be19e9d1fa14e8961bcc4a1580ea2c0f6a26
<ide><path>numpy/testing/utils.py <ide> <ide> import warnings <ide> <del># 2018-04-04, numpy 1.15.0 <add># 2018-04-04, numpy 1.15.0 ImportWarning <add># 2019-09-18, numpy 1.18.0 DeprecatonWarning (changed) <ide> warnings.warn("Importing from numpy.testing.utils is deprecated " <ide> "since 1.15.0, import from numpy.testing instead.", <ide> DeprecationWarning, stacklevel=2)
1
Javascript
Javascript
switch text style to textstyleprop
44a289cf26be02a3426d3e7a9fd1bf696ea48ea3
<ide><path>Libraries/Text/TextProps.js <ide> <ide> import type {LayoutEvent, PressEvent, TextLayoutEvent} from 'CoreEventTypes'; <ide> import type React from 'React'; <del>import type {DangerouslyImpreciseStyleProp} from 'StyleSheet'; <add>import type {TextStyleProp} from 'StyleSheet'; <ide> import type { <ide> AccessibilityRole, <ide> AccessibilityStates, <ide> export type TextProps = $ReadOnly<{ <ide> * See https://facebook.github.io/react-native/docs/text.html#selectable <ide> */ <ide> selectable?: ?boolean, <del> style?: ?DangerouslyImpreciseStyleProp, <add> style?: ?TextStyleProp, <ide> <ide> /** <ide> * Used to locate this view in end-to-end tests.
1
Javascript
Javascript
incorporate discussed changes
f975373d9b6ab30bc3adf5d9082375b9ab0e78f6
<ide><path>src/lib/create/valid.js <ide> export function isValid(m) { <ide> flags.bigHour === undefined; <ide> } <ide> <del> if (!Object.isFrozen(m)) { <add> if (Object.isFrozen == null || !Object.isFrozen(m)) { <ide> m._isValid = isNowValid; <ide> } <ide> else { <ide><path>src/test/moment/to_type.js <ide> test('toJSON', function (assert) { <ide> test('toJSON works when moment is frozen', function (assert) { <ide> var expected = new Date().toISOString(); <ide> var m = moment(expected); <del> Object.freeze(m); <add> if (Object.freeze != null) { <add> Object.freeze(m); <add> } <ide> assert.deepEqual(m.toJSON(), expected, 'toJSON when frozen invalid'); <ide> });
2
PHP
PHP
add ability to add and remove observable events
031bb63c55b685c65d99c2590e60f6d1d690584b
<ide><path>src/Illuminate/Database/Eloquent/Model.php <ide> public function getObservableEvents() <ide> ); <ide> } <ide> <add> /** <add> * Set the observable event names. <add> * <add> * @return void <add> */ <add> public function setObservableEvents(array $observables) <add> { <add> $this->observables = $observables; <add> } <add> <add> /** <add> * Add an observable event name. <add> * <add> * @param mixed $observables <add> * @return void <add> */ <add> public function addObservableEvents($observables) <add> { <add> $observables = is_array($observables) ? $observables : func_get_args(); <add> <add> foreach ($observables as $observable) <add> { <add> if ( ! in_array($observable, $this->observables)) <add> { <add> $this->observables[] = $observable; <add> } <add> } <add> } <add> <add> /** <add> * Remove an observable event name. <add> * <add> * @param mixed $observables <add> * @return void <add> */ <add> public function removeObservableEvents($observables) <add> { <add> $observables = is_array($observables) ? $observables : func_get_args(); <add> <add> foreach ($observables as $observable) <add> { <add> if ($index = array_search($observable, $this->observables) !== false) <add> { <add> unset($this->observables[$index]); <add> } <add> } <add> } <add> <ide> /** <ide> * Increment a column's value by a given amount. <ide> * <ide><path>tests/Database/DatabaseEloquentModelTest.php <ide> public function testModelObserversCanBeAttachedToModels() <ide> } <ide> <ide> <add> public function testSetObservableEvents() <add> { <add> $class = new EloquentModelStub; <add> $class->setObservableEvents(array('foo')); <add> <add> $this->assertContains('foo', $class->getObservableEvents()); <add> } <add> <add> public function testAddObservableEvent() <add> { <add> $class = new EloquentModelStub; <add> $class->addObservableEvents('foo'); <add> <add> $this->assertContains('foo', $class->getObservableEvents()); <add> } <add> <add> public function testRemoveObservableEvent() <add> { <add> $class = new EloquentModelStub; <add> $class->setObservableEvents(array('foo', 'bar')); <add> $class->removeObservableEvents('bar'); <add> <add> $this->assertNotContains('bar', $class->getObservableEvents()); <add> } <add> <add> <ide> /** <ide> * @expectedException LogicException <ide> */
2
Javascript
Javascript
convert mutation phase to depth-first traversal
95feb0e701a5ae20996e8cc6c4acd0f504d5985a
<ide><path>packages/react-reconciler/src/ReactChildFiber.new.js <ide> function ChildReconciler(shouldTrackSideEffects) { <ide> childToDelete.nextEffect = null; <ide> childToDelete.flags = (childToDelete.flags & StaticMask) | Deletion; <ide> <del> let deletions = returnFiber.deletions; <add> const deletions = returnFiber.deletions; <ide> if (deletions === null) { <del> deletions = returnFiber.deletions = [childToDelete]; <add> returnFiber.deletions = [childToDelete]; <ide> returnFiber.flags |= ChildDeletion; <ide> } else { <ide> deletions.push(childToDelete); <ide> } <del> // Stash a reference to the return fiber's deletion array on each of the <del> // deleted children. This is really weird, but it's a temporary workaround <del> // while we're still using the effect list to traverse effect fibers. A <del> // better workaround would be to follow the `.return` pointer in the commit <del> // phase, but unfortunately we can't assume that `.return` points to the <del> // correct fiber, even in the commit phase, because `findDOMNode` might <del> // mutate it. <del> // TODO: Remove this line. <del> childToDelete.deletions = deletions; <ide> } <ide> <ide> function deleteRemainingChildren( <ide><path>packages/react-reconciler/src/ReactFiberBeginWork.new.js <ide> function updateSuspensePrimaryChildren( <ide> currentFallbackChildFragment.flags = <ide> (currentFallbackChildFragment.flags & StaticMask) | Deletion; <ide> workInProgress.firstEffect = workInProgress.lastEffect = currentFallbackChildFragment; <del> let deletions = workInProgress.deletions; <add> const deletions = workInProgress.deletions; <ide> if (deletions === null) { <del> deletions = workInProgress.deletions = [currentFallbackChildFragment]; <add> workInProgress.deletions = [currentFallbackChildFragment]; <ide> workInProgress.flags |= ChildDeletion; <ide> } else { <ide> deletions.push(currentFallbackChildFragment); <ide> } <del> currentFallbackChildFragment.deletions = deletions; <ide> } <ide> <ide> workInProgress.child = primaryChildFragment; <ide> function remountFiber( <ide> current.nextEffect = null; <ide> current.flags = (current.flags & StaticMask) | Deletion; <ide> <del> let deletions = returnFiber.deletions; <add> const deletions = returnFiber.deletions; <ide> if (deletions === null) { <del> deletions = returnFiber.deletions = [current]; <add> returnFiber.deletions = [current]; <ide> returnFiber.flags |= ChildDeletion; <ide> } else { <ide> deletions.push(current); <ide> } <del> current.deletions = deletions; <ide> <ide> newWorkInProgress.flags |= Placement; <ide> <ide><path>packages/react-reconciler/src/ReactFiberCommitWork.new.js <ide> import { <ide> NoFlags, <ide> ContentReset, <ide> Placement, <add> PlacementAndUpdate, <ide> ChildDeletion, <ide> Snapshot, <ide> Update, <ide> Callback, <ide> Ref, <add> Hydrating, <add> HydratingAndUpdate, <ide> Passive, <add> MutationMask, <ide> PassiveMask, <ide> LayoutMask, <ide> PassiveUnmountPendingDev, <ide> function commitResetTextContent(current: Fiber) { <ide> resetTextContent(current.stateNode); <ide> } <ide> <add>export function commitMutationEffects( <add> root: FiberRoot, <add> renderPriorityLevel: ReactPriorityLevel, <add> firstChild: Fiber, <add>) { <add> nextEffect = firstChild; <add> commitMutationEffects_begin(root, renderPriorityLevel); <add>} <add> <add>function commitMutationEffects_begin( <add> root: FiberRoot, <add> renderPriorityLevel: ReactPriorityLevel, <add>) { <add> while (nextEffect !== null) { <add> const fiber = nextEffect; <add> <add> // TODO: Should wrap this in flags check, too, as optimization <add> const deletions = fiber.deletions; <add> if (deletions !== null) { <add> for (let i = 0; i < deletions.length; i++) { <add> const childToDelete = deletions[i]; <add> if (__DEV__) { <add> invokeGuardedCallback( <add> null, <add> commitDeletion, <add> null, <add> root, <add> childToDelete, <add> renderPriorityLevel, <add> ); <add> if (hasCaughtError()) { <add> const error = clearCaughtError(); <add> captureCommitPhaseError(childToDelete, error); <add> } <add> } else { <add> try { <add> commitDeletion(root, childToDelete, renderPriorityLevel); <add> } catch (error) { <add> captureCommitPhaseError(childToDelete, error); <add> } <add> } <add> } <add> } <add> <add> const child = fiber.child; <add> if ((fiber.subtreeFlags & MutationMask) !== NoFlags && child !== null) { <add> ensureCorrectReturnPointer(child, fiber); <add> nextEffect = child; <add> } else { <add> commitMutationEffects_complete(root, renderPriorityLevel); <add> } <add> } <add>} <add> <add>function commitMutationEffects_complete( <add> root: FiberRoot, <add> renderPriorityLevel: ReactPriorityLevel, <add>) { <add> while (nextEffect !== null) { <add> const fiber = nextEffect; <add> if (__DEV__) { <add> setCurrentDebugFiberInDEV(fiber); <add> invokeGuardedCallback( <add> null, <add> commitMutationEffectsOnFiber, <add> null, <add> fiber, <add> root, <add> renderPriorityLevel, <add> ); <add> if (hasCaughtError()) { <add> const error = clearCaughtError(); <add> captureCommitPhaseError(fiber, error); <add> } <add> resetCurrentDebugFiberInDEV(); <add> } else { <add> try { <add> commitMutationEffectsOnFiber(fiber, root, renderPriorityLevel); <add> } catch (error) { <add> captureCommitPhaseError(fiber, error); <add> } <add> } <add> <add> const sibling = fiber.sibling; <add> if (sibling !== null) { <add> ensureCorrectReturnPointer(sibling, fiber.return); <add> nextEffect = sibling; <add> return; <add> } <add> <add> nextEffect = fiber.return; <add> } <add>} <add> <add>function commitMutationEffectsOnFiber( <add> finishedWork: Fiber, <add> root: FiberRoot, <add> renderPriorityLevel: ReactPriorityLevel, <add>) { <add> const flags = finishedWork.flags; <add> <add> if (flags & ContentReset) { <add> commitResetTextContent(finishedWork); <add> } <add> <add> if (flags & Ref) { <add> const current = finishedWork.alternate; <add> if (current !== null) { <add> commitDetachRef(current); <add> } <add> if (enableScopeAPI) { <add> // TODO: This is a temporary solution that allowed us to transition away <add> // from React Flare on www. <add> if (finishedWork.tag === ScopeComponent) { <add> commitAttachRef(finishedWork); <add> } <add> } <add> } <add> <add> // The following switch statement is only concerned about placement, <add> // updates, and deletions. To avoid needing to add a case for every possible <add> // bitmap value, we remove the secondary effects from the effect tag and <add> // switch on that value. <add> const primaryFlags = flags & (Placement | Update | Hydrating); <add> outer: switch (primaryFlags) { <add> case Placement: { <add> commitPlacement(finishedWork); <add> // Clear the "placement" from effect tag so that we know that this is <add> // inserted, before any life-cycles like componentDidMount gets called. <add> // TODO: findDOMNode doesn't rely on this any more but isMounted does <add> // and isMounted is deprecated anyway so we should be able to kill this. <add> finishedWork.flags &= ~Placement; <add> break; <add> } <add> case PlacementAndUpdate: { <add> // Placement <add> commitPlacement(finishedWork); <add> // Clear the "placement" from effect tag so that we know that this is <add> // inserted, before any life-cycles like componentDidMount gets called. <add> finishedWork.flags &= ~Placement; <add> <add> // Update <add> const current = finishedWork.alternate; <add> commitWork(current, finishedWork); <add> break; <add> } <add> case Hydrating: { <add> finishedWork.flags &= ~Hydrating; <add> break; <add> } <add> case HydratingAndUpdate: { <add> finishedWork.flags &= ~Hydrating; <add> <add> // Update <add> const current = finishedWork.alternate; <add> commitWork(current, finishedWork); <add> break; <add> } <add> case Update: { <add> const current = finishedWork.alternate; <add> commitWork(current, finishedWork); <add> break; <add> } <add> } <add>} <add> <ide> export function commitLayoutEffects( <ide> finishedWork: Fiber, <ide> root: FiberRoot, <ide><path>packages/react-reconciler/src/ReactFiberHydrationContext.new.js <ide> function deleteHydratableInstance( <ide> returnFiber.firstEffect = returnFiber.lastEffect = childToDelete; <ide> } <ide> <del> let deletions = returnFiber.deletions; <add> const deletions = returnFiber.deletions; <ide> if (deletions === null) { <del> deletions = returnFiber.deletions = [childToDelete]; <add> returnFiber.deletions = [childToDelete]; <ide> returnFiber.flags |= ChildDeletion; <ide> } else { <ide> deletions.push(childToDelete); <ide> } <del> childToDelete.deletions = deletions; <ide> } <ide> <ide> function insertNonHydratedInstance(returnFiber: Fiber, fiber: Fiber) { <ide><path>packages/react-reconciler/src/ReactFiberWorkLoop.new.js <ide> import { <ide> decoupleUpdatePriorityFromScheduler, <ide> enableDebugTracing, <ide> enableSchedulingProfiler, <del> enableScopeAPI, <ide> disableSchedulerTimeoutInWorkLoop, <ide> } from 'shared/ReactFeatureFlags'; <ide> import ReactSharedInternals from 'shared/ReactSharedInternals'; <ide> import { <ide> ForwardRef, <ide> MemoComponent, <ide> SimpleMemoComponent, <del> ScopeComponent, <ide> Profiler, <ide> } from './ReactWorkTags'; <ide> import {LegacyRoot} from './ReactRootTags'; <ide> import { <ide> NoFlags, <ide> PerformedWork, <ide> Placement, <del> Update, <del> PlacementAndUpdate, <ide> Deletion, <ide> ChildDeletion, <del> Ref, <del> ContentReset, <ide> Snapshot, <ide> Passive, <ide> PassiveStatic, <ide> Incomplete, <ide> HostEffectMask, <ide> Hydrating, <del> HydratingAndUpdate, <ide> StaticMask, <ide> } from './ReactFiberFlags'; <ide> import { <ide> import { <ide> import { <ide> commitBeforeMutationLifeCycles as commitBeforeMutationEffectOnFiber, <ide> commitLayoutEffects, <del> commitPlacement, <del> commitWork, <del> commitDeletion, <del> commitDetachRef, <del> commitAttachRef, <add> commitMutationEffects, <ide> commitPassiveEffectDurations, <del> commitResetTextContent, <ide> isSuspenseBoundaryBeingHidden, <ide> commitPassiveMountEffects, <ide> commitPassiveUnmountEffects, <ide> function commitRootImpl(root, renderPriorityLevel) { <ide> } <ide> <ide> // The next phase is the mutation phase, where we mutate the host tree. <del> nextEffect = firstEffect; <del> do { <del> if (__DEV__) { <del> invokeGuardedCallback( <del> null, <del> commitMutationEffects, <del> null, <del> root, <del> renderPriorityLevel, <del> ); <del> if (hasCaughtError()) { <del> invariant(nextEffect !== null, 'Should be working on an effect.'); <del> const error = clearCaughtError(); <del> captureCommitPhaseError(nextEffect, error); <del> nextEffect = nextEffect.nextEffect; <del> } <del> } else { <del> try { <del> commitMutationEffects(root, renderPriorityLevel); <del> } catch (error) { <del> invariant(nextEffect !== null, 'Should be working on an effect.'); <del> captureCommitPhaseError(nextEffect, error); <del> nextEffect = nextEffect.nextEffect; <del> } <del> } <del> } while (nextEffect !== null); <add> commitMutationEffects(root, renderPriorityLevel, finishedWork); <ide> <ide> if (shouldFireAfterActiveInstanceBlur) { <ide> afterActiveInstanceBlur(); <ide> function commitBeforeMutationEffects() { <ide> } <ide> } <ide> <del>function commitMutationEffects( <del> root: FiberRoot, <del> renderPriorityLevel: ReactPriorityLevel, <del>) { <del> // TODO: Should probably move the bulk of this function to commitWork. <del> while (nextEffect !== null) { <del> setCurrentDebugFiberInDEV(nextEffect); <del> <del> const flags = nextEffect.flags; <del> <del> if (flags & ContentReset) { <del> commitResetTextContent(nextEffect); <del> } <del> <del> if (flags & Ref) { <del> const current = nextEffect.alternate; <del> if (current !== null) { <del> commitDetachRef(current); <del> } <del> if (enableScopeAPI) { <del> // TODO: This is a temporary solution that allowed us to transition away <del> // from React Flare on www. <del> if (nextEffect.tag === ScopeComponent) { <del> commitAttachRef(nextEffect); <del> } <del> } <del> } <del> <del> // The following switch statement is only concerned about placement, <del> // updates, and deletions. To avoid needing to add a case for every possible <del> // bitmap value, we remove the secondary effects from the effect tag and <del> // switch on that value. <del> const primaryFlags = flags & (Placement | Update | Deletion | Hydrating); <del> outer: switch (primaryFlags) { <del> case Placement: { <del> commitPlacement(nextEffect); <del> // Clear the "placement" from effect tag so that we know that this is <del> // inserted, before any life-cycles like componentDidMount gets called. <del> // TODO: findDOMNode doesn't rely on this any more but isMounted does <del> // and isMounted is deprecated anyway so we should be able to kill this. <del> nextEffect.flags &= ~Placement; <del> break; <del> } <del> case PlacementAndUpdate: { <del> // Placement <del> commitPlacement(nextEffect); <del> // Clear the "placement" from effect tag so that we know that this is <del> // inserted, before any life-cycles like componentDidMount gets called. <del> nextEffect.flags &= ~Placement; <del> <del> // Update <del> const current = nextEffect.alternate; <del> commitWork(current, nextEffect); <del> break; <del> } <del> case Hydrating: { <del> nextEffect.flags &= ~Hydrating; <del> break; <del> } <del> case HydratingAndUpdate: { <del> nextEffect.flags &= ~Hydrating; <del> <del> // Update <del> const current = nextEffect.alternate; <del> commitWork(current, nextEffect); <del> break; <del> } <del> case Update: { <del> const current = nextEffect.alternate; <del> commitWork(current, nextEffect); <del> break; <del> } <del> case Deletion: { <del> // Reached a deletion effect. Instead of commit this effect like we <del> // normally do, we're going to use the `deletions` array of the parent. <del> // However, because the effect list is sorted in depth-first order, we <del> // can't wait until we reach the parent node, because the child effects <del> // will have run in the meantime. <del> // <del> // So instead, we use a trick where the first time we hit a deletion <del> // effect, we commit all the deletion effects that belong to that parent. <del> // <del> // This is an incremental step away from using the effect list and <del> // toward a DFS + subtreeFlags traversal. <del> // <del> // A reference to the deletion array of the parent is also stored on <del> // each of the deletions. This is really weird. It would be better to <del> // follow the `.return` pointer, but unfortunately we can't assume that <del> // `.return` points to the correct fiber, even in the commit phase, <del> // because `findDOMNode` might mutate it. <del> const deletedChild = nextEffect; <del> const deletions = deletedChild.deletions; <del> if (deletions !== null) { <del> for (let i = 0; i < deletions.length; i++) { <del> const deletion = deletions[i]; <del> // Clear the deletion effect so that we don't delete this node more <del> // than once. <del> deletion.flags &= ~Deletion; <del> deletion.deletions = null; <del> commitDeletion(root, deletion, renderPriorityLevel); <del> } <del> } <del> break; <del> } <del> } <del> <del> resetCurrentDebugFiberInDEV(); <del> nextEffect = nextEffect.nextEffect; <del> } <del>} <del> <ide> export function flushPassiveEffects(): boolean { <ide> // Returns whether passive effects were flushed. <ide> if (pendingPassiveEffectsRenderPriority !== NoSchedulerPriority) {
5
Javascript
Javascript
pass the resource to a dynamic param functions
aa8d783cff3b43996fc69c91a40fea187153c11b
<ide><path>src/ngResource/resource.js <ide> function shallowClearAndCopy(src, dst) { <ide> * can escape it with `/\.`. <ide> * <ide> * @param {Object=} paramDefaults Default values for `url` parameters. These can be overridden in <del> * `actions` methods. If a parameter value is a function, it will be executed every time <del> * when a param value needs to be obtained for a request (unless the param was overridden). <add> * `actions` methods. If a parameter value is a function, it will be called every time <add> * a param value needs to be obtained for a request (unless the param was overridden). The function <add> * will be passed the current data value as a argument. <ide> * <ide> * Each key value in the parameter object is first bound to url template if present and then any <ide> * excess keys are appended to the url search query after the `?`. <ide> function shallowClearAndCopy(src, dst) { <ide> * - **`method`** – {string} – Case insensitive HTTP method (e.g. `GET`, `POST`, `PUT`, <ide> * `DELETE`, `JSONP`, etc). <ide> * - **`params`** – {Object=} – Optional set of pre-bound parameters for this action. If any of <del> * the parameter value is a function, it will be executed every time when a param value needs to <del> * be obtained for a request (unless the param was overridden). <add> * the parameter value is a function, it will be called every time when a param value needs to <add> * be obtained for a request (unless the param was overridden). The function will be passed the <add> * current data value as a argument. <ide> * - **`url`** – {string} – action specific `url` override. The url templating is supported just <ide> * like for the resource-level urls. <ide> * - **`isArray`** – {boolean=} – If true then the returned object for this action is an array, <ide> angular.module('ngResource', ['ng']). <ide> var ids = {}; <ide> actionParams = extend({}, paramDefaults, actionParams); <ide> forEach(actionParams, function(value, key) { <del> if (isFunction(value)) { value = value(); } <add> if (isFunction(value)) { value = value(data); } <ide> ids[key] = value && value.charAt && value.charAt(0) === '@' ? <ide> lookupDottedPath(data, value.substr(1)) : value; <ide> }); <ide><path>test/ngResource/resourceSpec.js <ide> describe("basic usage", function() { <ide> var currentGroup = 'students', <ide> Person = $resource('/Person/:group/:id', { group: function() { return currentGroup; }}); <ide> <del> <ide> $httpBackend.expect('GET', '/Person/students/fedor').respond({id: 'fedor', email: 'f@f.com'}); <ide> <ide> var fedor = Person.get({id: 'fedor'}); <ide> describe("basic usage", function() { <ide> }); <ide> <ide> <add> it('should pass resource object to dynamic default parameters', function() { <add> var Person = $resource('/Person/:id', { <add> id: function(data) { <add> return data ? data.id : 'fedor'; <add> } <add> }); <add> <add> $httpBackend.expect('GET', '/Person/fedor').respond( <add> {id: 'fedor', email: 'f@f.com', count: 1}); <add> <add> var fedor = Person.get(); <add> $httpBackend.flush(); <add> <add> expect(fedor).toEqualData({id: 'fedor', email: 'f@f.com', count: 1}); <add> <add> $httpBackend.expect('POST', '/Person/fedor').respond( <add> {id: 'fedor', email: 'f@f.com', count: 2}); <add> fedor.$save(); <add> $httpBackend.flush(); <add> expect(fedor).toEqualData({id: 'fedor', email: 'f@f.com', count: 2}); <add> }); <add> <add> <ide> it('should support dynamic default parameters (action specific)', function() { <ide> var currentGroup = 'students', <ide> Person = $resource('/Person/:group/:id', {}, {
2
PHP
PHP
fix translation bug and add test
024067fd56b227d74ce0b70d6b78ef5ad7095d6d
<ide><path>src/Illuminate/Translation/Translator.php <ide> use Illuminate\Contracts\Translation\Loader; <ide> use Illuminate\Contracts\Translation\Translator as TranslatorContract; <ide> use Illuminate\Support\Arr; <del>use Illuminate\Support\Collection; <ide> use Illuminate\Support\NamespacedItemResolver; <ide> use Illuminate\Support\Str; <ide> use Illuminate\Support\Traits\Macroable; <ide> protected function makeReplacements($line, array $replace) <ide> return $line; <ide> } <ide> <del> $replace = $this->sortReplacements($replace); <add> $shouldReplace = []; <ide> <ide> foreach ($replace as $key => $value) { <del> $line = str_replace( <del> [':'.$key, ':'.Str::upper($key), ':'.Str::ucfirst($key)], <del> [$value, Str::upper($value), Str::ucfirst($value)], <del> $line <del> ); <add> $shouldReplace[':'.$key] = $value; <add> $shouldReplace[':'.Str::upper($key)] = Str::upper($value); <add> $shouldReplace[':'.Str::ucfirst($key)] = Str::ucfirst($value); <ide> } <ide> <del> return $line; <del> } <del> <del> /** <del> * Sort the replacements array. <del> * <del> * @param array $replace <del> * @return array <del> */ <del> protected function sortReplacements(array $replace) <del> { <del> return (new Collection($replace))->sortBy(function ($value, $key) { <del> return mb_strlen($key) * -1; <del> })->all(); <add> return strtr($line, $shouldReplace); <ide> } <ide> <ide> /** <ide><path>tests/Translation/TranslationTranslatorTest.php <ide> public function testGetJsonReplaces() <ide> $this->assertSame('bar onetwo three', $t->get('foo :i:c :u', ['i' => 'one', 'c' => 'two', 'u' => 'three'])); <ide> } <ide> <add> public function testGetJsonHasAtomicReplacements() <add> { <add> $t = new Translator($this->getLoader(), 'en'); <add> $t->getLoader()->shouldReceive('load')->once()->with('en', '*', '*')->andReturn(['Hello :foo!' => 'Hello :foo!']); <add> $this->assertSame('Hello baz:bar!', $t->get('Hello :foo!', ['foo' => 'baz:bar', 'bar' => 'abcdef'])); <add> } <add> <ide> public function testGetJsonReplacesForAssociativeInput() <ide> { <ide> $t = new Translator($this->getLoader(), 'en');
2
PHP
PHP
use cakeexception as a base
5d094c6b30e1bf3163a6756eaa08e2010a8e562d
<ide><path>src/Http/Client/Adapter/Mock.php <ide> public function send(RequestInterface $request, array $options): array <ide> return [$mock['response']]; <ide> } <ide> <del> throw new MissingResponseException($method, $requestUri); <add> throw new MissingResponseException(['method' => $method, 'url' => $requestUri]); <ide> } <ide> <ide> /** <ide><path>src/Http/Client/Exception/MissingResponseException.php <ide> */ <ide> namespace Cake\Http\Client\Exception; <ide> <del>use RuntimeException; <add>use Cake\Core\Exception\CakeException; <ide> <ide> /** <ide> * Used to indicate that a request did not have a matching mock response. <ide> */ <del>class MissingResponseException extends RuntimeException <add>class MissingResponseException extends CakeException <ide> { <ide> /** <del> * Constructor <del> * <del> * @param string $method The HTTP method used. <del> * @param string $url The request URL. <add> * @var string <ide> */ <del> public function __construct(string $method, string $url) <del> { <del> $message = "Unable to find a mocked response for {$method} to {$url}."; <del> parent::__construct($message); <del> } <add> protected $_messageTemplate = 'Unable to find a mocked response for `%s` to `%s`.'; <ide> } <ide><path>tests/TestCase/Http/ClientTest.php <ide> public function testAddMockResponseGlobMatch(): void <ide> <ide> /** <ide> * Custom match methods must be closures <add> * <add> * <add> * @return <ide> */ <ide> public function testAddMockResponseInvalidMatch(): void <ide> {
3
Ruby
Ruby
fix failing tests for
550c1f095028d480e486388b43b880b8f01c48c5
<ide><path>actionpack/test/controller/show_exceptions_test.rb <ide> def test_render_json_exception <ide> get "/", headers: { 'HTTP_ACCEPT' => 'application/json' } <ide> assert_response :internal_server_error <ide> assert_equal 'application/json', response.content_type.to_s <del> assert_equal({ :status => '500', :error => 'Internal Server Error' }.to_json, response.body) <add> assert_equal({ :status => 500, :error => 'Internal Server Error' }.to_json, response.body) <ide> end <ide> <ide> def test_render_xml_exception <ide> @app = ShowExceptionsOverriddenController.action(:boom) <ide> get "/", headers: { 'HTTP_ACCEPT' => 'application/xml' } <ide> assert_response :internal_server_error <ide> assert_equal 'application/xml', response.content_type.to_s <del> assert_equal({ :status => '500', :error => 'Internal Server Error' }.to_xml, response.body) <add> assert_equal({ :status => 500, :error => 'Internal Server Error' }.to_xml, response.body) <ide> end <ide> <ide> def test_render_fallback_exception
1
Mixed
Javascript
show a redbox when scripts fail to load
bbd1e455f391aef6dc8dfbd934377bf90016e35d
<ide><path>ReactAndroid/src/main/java/com/facebook/react/devsupport/JSDebuggerWebSocketClient.java <ide> <ide> import com.facebook.common.logging.FLog; <ide> import com.facebook.infer.annotation.Assertions; <add>import com.facebook.react.common.JavascriptException; <ide> <ide> import com.fasterxml.jackson.core.JsonFactory; <ide> import com.fasterxml.jackson.core.JsonGenerator; <ide> public void onMessage(ResponseBody response) throws IOException { <ide> } else if ("result".equals(field)) { <ide> parser.nextToken(); <ide> result = parser.getText(); <add> } else if ("error".equals(field)) { <add> parser.nextToken(); <add> String error = parser.getText(); <add> abort(error, new JavascriptException(error)); <ide> } <ide> } <ide> if (replyID != null) { <ide><path>local-cli/server/util/debuggerWorker.js <ide> var messageHandlers = { <ide> for (var key in message.inject) { <ide> self[key] = JSON.parse(message.inject[key]); <ide> } <del> importScripts(message.url); <del> sendReply(); <add> let error; <add> try { <add> importScripts(message.url); <add> } catch (err) { <add> error = JSON.stringify(err); <add> } <add> sendReply(null /* result */, error); <ide> } <ide> }; <ide> <ide> onmessage = function(message) { <ide> var object = message.data; <ide> <del> var sendReply = function(result) { <del> postMessage({replyID: object.id, result: result}); <add> var sendReply = function(result, error) { <add> postMessage({replyID: object.id, result: result, error: error}); <ide> }; <ide> <ide> var handler = messageHandlers[object.method];
2
Java
Java
remove configuration for avoiding jni refs
015b5ddc2ef690aa8d659e6352639352b8a118ca
<ide><path>ReactAndroid/src/main/java/com/facebook/yoga/YogaConfig.java <ide> public class YogaConfig { <ide> long mNativePointer; <ide> private YogaLogger mLogger; <ide> private YogaNodeCloneFunction mYogaNodeCloneFunction; <del> public boolean avoidGlobalJNIRefs = false; <ide> <ide> private native long jni_YGConfigNew(); <ide> public YogaConfig() {
1
Javascript
Javascript
improve flow typing for uimanagerinjection
5e07347948c83e2257c7a1cbc159df59e545c1c9
<ide><path>Libraries/ReactNative/UIManager.js <ide> export interface UIManagerJSInterface extends Spec { <ide> ) => void; <ide> } <ide> <del>var UIManager: UIManagerJSInterface; <del>if (global.RN$Bridgeless === true) { <del> // $FlowExpectedError[incompatible-type] <del> UIManager = require('./DummyUIManager'); <del>} else { <del> const {unstable_UIManager} = require('./UIManagerInjection'); <del> UIManager = unstable_UIManager <del> ? unstable_UIManager <del> : require('./PaperUIManager'); <del>} <add>const UIManager: UIManagerJSInterface = <add> global.RN$Bridgeless === true <add> ? require('./DummyUIManager') <add> : require('./UIManagerInjection').default.unstable_UIManager ?? <add> require('./PaperUIManager'); <ide> <ide> module.exports = UIManager; <ide><path>Libraries/ReactNative/UIManagerInjection.js <ide> <ide> import type {UIManagerJSInterface} from './UIManager'; <ide> <del>const unstable_UIManager: ?UIManagerJSInterface = null; <del> <del>export {unstable_UIManager}; <add>export default { <add> unstable_UIManager: (null: ?UIManagerJSInterface), <add>};
2
Ruby
Ruby
add test case for `font_url`
b407b5973552e266f3797285721438b304e3a7b7
<ide><path>actionview/test/template/asset_tag_helper_test.rb <ide> def url_for(*args) <ide> %(font_path("font.ttf?123")) => %(/fonts/font.ttf?123) <ide> } <ide> <add> FontUrlToTag = { <add> %(font_url("font.eot")) => %(http://www.example.com/fonts/font.eot), <add> %(font_url("font.eot#iefix")) => %(http://www.example.com/fonts/font.eot#iefix), <add> %(font_url("font.woff")) => %(http://www.example.com/fonts/font.woff), <add> %(font_url("font.ttf")) => %(http://www.example.com/fonts/font.ttf), <add> %(font_url("font.ttf?123")) => %(http://www.example.com/fonts/font.ttf?123), <add> %(font_url("font.ttf", host: "http://assets.example.com")) => %(http://assets.example.com/fonts/font.ttf) <add> } <add> <add> UrlToFontToTag = { <add> %(url_to_font("font.eot")) => %(http://www.example.com/fonts/font.eot), <add> %(url_to_font("font.eot#iefix")) => %(http://www.example.com/fonts/font.eot#iefix), <add> %(url_to_font("font.woff")) => %(http://www.example.com/fonts/font.woff), <add> %(url_to_font("font.ttf")) => %(http://www.example.com/fonts/font.ttf), <add> %(url_to_font("font.ttf?123")) => %(http://www.example.com/fonts/font.ttf?123), <add> %(url_to_font("font.ttf", host: "http://assets.example.com")) => %(http://assets.example.com/fonts/font.ttf) <add> } <add> <ide> def test_autodiscovery_link_tag_with_unknown_type_but_not_pass_type_option_key <ide> assert_raise(ArgumentError) do <ide> auto_discovery_link_tag(:xml) <ide> def test_font_path <ide> FontPathToTag.each { |method, tag| assert_dom_equal(tag, eval(method)) } <ide> end <ide> <add> def test_font_url <add> FontUrlToTag.each { |method, tag| assert_dom_equal(tag, eval(method)) } <add> end <add> <add> def test_url_to_font_alias_for_font_url <add> UrlToFontToTag.each { |method, tag| assert_dom_equal(tag, eval(method)) } <add> end <add> <ide> def test_video_audio_tag_does_not_modify_options <ide> options = { autoplay: true } <ide> video_tag("video", options)
1
Ruby
Ruby
implement case conditional expression
4c7e50f9328aca4e294b41fce0832bf6ac4a939a
<ide><path>lib/arel/nodes.rb <ide> # windows <ide> require 'arel/nodes/window' <ide> <add># conditional expressions <add>require 'arel/nodes/case' <add> <ide> # joins <ide> require 'arel/nodes/full_outer_join' <ide> require 'arel/nodes/inner_join' <ide><path>lib/arel/nodes/case.rb <add>module Arel <add> module Nodes <add> class Case < Arel::Nodes::Node <add> include Arel::OrderPredications <add> include Arel::Predications <add> include Arel::AliasPredication <add> <add> attr_accessor :case, :conditions, :default <add> <add> def initialize expression = nil, default = nil <add> @case = expression <add> @conditions = [] <add> @default = default <add> end <add> <add> def when condition, expression = nil <add> @conditions << When.new(Nodes.build_quoted(condition), expression) <add> self <add> end <add> <add> def then expression <add> @conditions.last.right = Nodes.build_quoted(expression) <add> self <add> end <add> <add> def else expression <add> @default = Else.new Nodes.build_quoted(expression) <add> self <add> end <add> <add> def initialize_copy other <add> super <add> @case = @case.clone if @case <add> @conditions = @conditions.map { |x| x.clone } <add> @default = @default.clone if @default <add> end <add> <add> def hash <add> [@case, @conditions, @default].hash <add> end <add> <add> def eql? other <add> self.class == other.class && <add> self.case == other.case && <add> self.conditions == other.conditions && <add> self.default == other.default <add> end <add> alias :== :eql? <add> end <add> <add> class When < Binary # :nodoc: <add> end <add> <add> class Else < Unary # :nodoc: <add> end <add> end <add>end <ide><path>lib/arel/predications.rb <ide> def lteq_all others <ide> grouping_all :lteq, others <ide> end <ide> <add> def when right <add> Nodes::Case.new(self).when quoted_node(right) <add> end <add> <ide> private <ide> <ide> def grouping_any method_id, others, *extras <ide><path>lib/arel/visitors/depth_first.rb <ide> def visit o <ide> def unary o <ide> visit o.expr <ide> end <add> alias :visit_Arel_Nodes_Else :unary <ide> alias :visit_Arel_Nodes_Group :unary <ide> alias :visit_Arel_Nodes_Grouping :unary <ide> alias :visit_Arel_Nodes_Having :unary <ide> def visit_Arel_Nodes_Count o <ide> visit o.distinct <ide> end <ide> <add> def visit_Arel_Nodes_Case o <add> visit o.case <add> visit o.conditions <add> visit o.default <add> end <add> <ide> def nary o <ide> o.children.each { |child| visit child} <ide> end <ide> def binary o <ide> alias :visit_Arel_Nodes_Regexp :binary <ide> alias :visit_Arel_Nodes_RightOuterJoin :binary <ide> alias :visit_Arel_Nodes_TableAlias :binary <del> alias :visit_Arel_Nodes_Values :binary <ide> alias :visit_Arel_Nodes_Union :binary <add> alias :visit_Arel_Nodes_Values :binary <add> alias :visit_Arel_Nodes_When :binary <ide> <ide> def visit_Arel_Nodes_StringJoin o <ide> visit o.left <ide><path>lib/arel/visitors/to_sql.rb <ide> def visit_Arel_Nodes_As o, collector <ide> visit o.right, collector <ide> end <ide> <add> def visit_Arel_Nodes_Case o, collector <add> collector << "CASE " <add> if o.case <add> visit o.case, collector <add> collector << " " <add> end <add> o.conditions.each do |condition| <add> visit condition, collector <add> collector << " " <add> end <add> if o.default <add> visit o.default, collector <add> collector << " " <add> end <add> collector << "END" <add> end <add> <add> def visit_Arel_Nodes_When o, collector <add> collector << "WHEN " <add> visit o.left, collector <add> collector << " THEN " <add> visit o.right, collector <add> end <add> <add> def visit_Arel_Nodes_Else o, collector <add> collector << "ELSE " <add> visit o.expr, collector <add> end <add> <ide> def visit_Arel_Nodes_UnqualifiedColumn o, collector <ide> collector << "#{quote_column_name o.name}" <ide> collector <ide><path>test/nodes/test_case.rb <add>require 'helper' <add> <add>module Arel <add> module Nodes <add> describe 'Case' do <add> describe '#initialize' do <add> it 'sets case expression from first argument' do <add> node = Case.new 'foo' <add> <add> assert_equal 'foo', node.case <add> end <add> <add> it 'sets default case from second argument' do <add> node = Case.new nil, 'bar' <add> <add> assert_equal 'bar', node.default <add> end <add> end <add> <add> describe '#clone' do <add> it 'clones case, conditions and default' do <add> foo = Nodes.build_quoted 'foo' <add> <add> node = Case.new <add> node.case = foo <add> node.conditions = [When.new(foo, foo)] <add> node.default = foo <add> <add> dolly = node.clone <add> <add> assert_equal dolly.case, node.case <add> refute_same dolly.case, node.case <add> <add> assert_equal dolly.conditions, node.conditions <add> refute_same dolly.conditions, node.conditions <add> <add> assert_equal dolly.default, node.default <add> refute_same dolly.default, node.default <add> end <add> end <add> <add> describe 'equality' do <add> it 'is equal with equal ivars' do <add> foo = Nodes.build_quoted 'foo' <add> one = Nodes.build_quoted 1 <add> zero = Nodes.build_quoted 0 <add> <add> case1 = Case.new foo <add> case1.conditions = [When.new(foo, one)] <add> case1.default = Else.new zero <add> <add> case2 = Case.new foo <add> case2.conditions = [When.new(foo, one)] <add> case2.default = Else.new zero <add> <add> array = [case1, case2] <add> <add> assert_equal 1, array.uniq.size <add> end <add> <add> it 'is not equal with different ivars' do <add> foo = Nodes.build_quoted 'foo' <add> bar = Nodes.build_quoted 'bar' <add> one = Nodes.build_quoted 1 <add> zero = Nodes.build_quoted 0 <add> <add> case1 = Case.new foo <add> case1.conditions = [When.new(foo, one)] <add> case1.default = Else.new zero <add> <add> case2 = Case.new foo <add> case2.conditions = [When.new(bar, one)] <add> case2.default = Else.new zero <add> <add> array = [case1, case2] <add> <add> assert_equal 2, array.uniq.size <add> end <add> end <add> end <add> end <add>end <ide><path>test/visitors/test_depth_first.rb <ide> def test_raises_with_object <ide> Arel::Nodes::UnqualifiedColumn, <ide> Arel::Nodes::Top, <ide> Arel::Nodes::Limit, <add> Arel::Nodes::Else, <ide> ].each do |klass| <ide> define_method("test_#{klass.name.gsub('::', '_')}") do <ide> op = klass.new(:a) <ide> def test_right_outer_join <ide> Arel::Nodes::As, <ide> Arel::Nodes::DeleteStatement, <ide> Arel::Nodes::JoinSource, <add> Arel::Nodes::When, <ide> ].each do |klass| <ide> define_method("test_#{klass.name.gsub('::', '_')}") do <ide> binary = klass.new(:a, :b) <ide> def test_insert_statement <ide> assert_equal [:a, :b, stmt.columns, :c, stmt], @collector.calls <ide> end <ide> <add> def test_case <add> node = Arel::Nodes::Case.new <add> node.case = :a <add> node.conditions << :b <add> node.default = :c <add> <add> @visitor.accept node <add> assert_equal [:a, :b, node.conditions, :c, node], @collector.calls <add> end <add> <ide> def test_node <ide> node = Nodes::Node.new <ide> @visitor.accept node <ide><path>test/visitors/test_to_sql.rb <ide> def quote value, column = nil <ide> end <ide> end <ide> end <add> <add> describe 'Nodes::Case' do <add> it 'supports simple case expressions' do <add> node = Arel::Nodes::Case.new(@table[:name]) <add> .when('foo').then(1) <add> .else(0) <add> <add> compile(node).must_be_like %{ <add> CASE "users"."name" WHEN 'foo' THEN 1 ELSE 0 END <add> } <add> end <add> <add> it 'supports extended case expressions' do <add> node = Arel::Nodes::Case.new <add> .when(@table[:name].in(%w(foo bar))).then(1) <add> .else(0) <add> <add> compile(node).must_be_like %{ <add> CASE WHEN "users"."name" IN ('foo', 'bar') THEN 1 ELSE 0 END <add> } <add> end <add> <add> it 'works without default branch' do <add> node = Arel::Nodes::Case.new(@table[:name]) <add> .when('foo').then(1) <add> <add> compile(node).must_be_like %{ <add> CASE "users"."name" WHEN 'foo' THEN 1 END <add> } <add> end <add> <add> it 'allows chaining multiple conditions' do <add> node = Arel::Nodes::Case.new(@table[:name]) <add> .when('foo').then(1) <add> .when('bar').then(2) <add> .else(0) <add> <add> compile(node).must_be_like %{ <add> CASE "users"."name" WHEN 'foo' THEN 1 WHEN 'bar' THEN 2 ELSE 0 END <add> } <add> end <add> <add> it 'supports #when with two arguments and no #then' do <add> node = Arel::Nodes::Case.new @table[:name] <add> <add> { foo: 1, bar: 0 }.reduce(node) { |node, pair| node.when *pair } <add> <add> compile(node).must_be_like %{ <add> CASE "users"."name" WHEN 'foo' THEN 1 WHEN 'bar' THEN 0 END <add> } <add> end <add> <add> it 'can be chained as a predicate' do <add> node = @table[:name].when('foo').then('bar').else('baz') <add> <add> compile(node).must_be_like %{ <add> CASE "users"."name" WHEN 'foo' THEN 'bar' ELSE 'baz' END <add> } <add> end <add> end <ide> end <ide> end <ide> end
8
Javascript
Javascript
fix the documentation style
3e7344394c01963a501b88732131ec93ebcff662
<ide><path>src/git-repository-async.js <ide> export default class GitRepositoryAsync { <ide> // <ide> // * `directoryPath` The {String} path to check. <ide> // <del> // Returns a promise resolving to a {Number} representing the status. This value can be passed to <del> // {::isStatusModified} or {::isStatusNew} to get more information. <add> // Returns a {Promise} resolving to a {Number} representing the status. This <add> // value can be passed to {::isStatusModified} or {::isStatusNew} to get more <add> // information. <ide> getDirectoryStatus (directoryPath) { <ide> let relativePath <ide> // XXX _filterSBD already gets repoPromise <ide> export default class GitRepositoryAsync { <ide> // Note that if the status of the path has changed, this will emit a <ide> // 'did-change-status' event. <ide> // <del> // path :: String <del> // The path whose status should be refreshed. <add> // * `path` The {String} path whose status should be refreshed. <ide> // <del> // Returns :: Promise<Number> <del> // The refreshed status bit for the path. <add> // Returns a {Promise} which resolves to a {Number} which is the refreshed <add> // status bit for the path. <ide> refreshStatusForPath (_path) { <ide> this._refreshingCount++ <ide> <ide> export default class GitRepositoryAsync { <ide> <ide> // Create a new branch with the given name. <ide> // <del> // name :: String <del> // The name of the new branch. <add> // * `name` The {String} name of the new branch. <ide> // <del> // Returns :: Promise<NodeGit.Ref> <del> // A reference to the created branch. <add> // Returns a {Promise} which resolves to a {NodeGit.Ref} reference to the <add> // created branch. <ide> _createBranch (name) { <ide> return this.repoPromise <ide> .then(repo => Promise.all([repo, repo.getHeadCommit()])) <ide> export default class GitRepositoryAsync { <ide> <ide> // Get all the hunks in the diff. <ide> // <del> // diff :: NodeGit.Diff <add> // * `diff` The {NodeGit.Diff} whose hunks should be retrieved. <ide> // <del> // Returns :: Promise<Array<NodeGit.Hunk>> <add> // Returns a {Promise} which resolves to an {Array} of {NodeGit.Hunk}. <ide> _getDiffHunks (diff) { <ide> return diff.patches() <ide> .then(patches => Promise.all(patches.map(p => p.hunks()))) // patches :: Array<Patch> <ide> export default class GitRepositoryAsync { <ide> <ide> // Get all the lines contained in the diff. <ide> // <del> // diff :: NodeGit.Diff <add> // * `diff` The {NodeGit.Diff} use lines should be retrieved. <ide> // <del> // Returns :: Promise<Array<NodeGit.Line>> <add> // Returns a {Promise} which resolves to an {Array} of {NodeGit.Line}. <ide> _getDiffLines (diff) { <ide> return this._getDiffHunks(diff) <ide> .then(hunks => Promise.all(hunks.map(h => h.lines()))) <ide> export default class GitRepositoryAsync { <ide> <ide> // Diff the given blob and buffer with the provided options. <ide> // <del> // blob :: NodeGit.Blob <del> // buffer :: String <del> // options :: NodeGit.DiffOptions <add> // * `blob` The {NodeGit.Blob} <add> // * `buffer` The {String} buffer. <add> // * `options` The {NodeGit.DiffOptions} <ide> // <del> // Returns :: Promise<Array<NodeGit.Hunk>> <add> // Returns a {Promise} which resolves to an {Array} of {NodeGit.Hunk}. <ide> _diffBlobToBuffer (blob, buffer, options) { <ide> const hunks = [] <ide> const hunkCallback = (delta, hunk, payload) => { <ide> export default class GitRepositoryAsync { <ide> <ide> // Get the current branch and update this.branch. <ide> // <del> // Returns :: Promise<String> <del> // The branch name. <add> // Returns a {Promise} which resolves to the {String} branch name. <ide> _refreshBranch () { <ide> return this.repoPromise <ide> .then(repo => repo.getCurrentBranch()) <ide> export default class GitRepositoryAsync { <ide> <ide> // Refresh the cached ahead/behind count with the given branch. <ide> // <del> // branchName :: String <del> // The name of the branch whose ahead/behind should be used for <del> // the refresh. <add> // * `branchName` The {String} name of the branch whose ahead/behind should be <add> // used for the refresh. <ide> // <del> // Returns :: Promise<null> <add> // Returns a {Promise} which will resolve to {null}. <ide> _refreshAheadBehindCount (branchName) { <ide> return this.getAheadBehindCount(branchName) <ide> .then(counts => this.upstreamByPath['.'] = counts) <ide> } <ide> <ide> // Refresh the cached status. <ide> // <del> // Returns :: Promise<null> <add> // Returns a {Promise} which will resolve to {null}. <ide> _refreshStatus () { <ide> this._refreshingCount++ <ide> <ide> export default class GitRepositoryAsync { <ide> <ide> // Refreshes the git status. <ide> // <del> // Returns :: Promise<null> <del> // Resolves when refresh has completed. <add> // Returns a {Promise} which will resolve to {null} when refresh is complete. <ide> refreshStatus () { <ide> // TODO add submodule tracking <ide> <ide> export default class GitRepositoryAsync { <ide> <ide> // Get the NodeGit repository for the given path. <ide> // <del> // path :: Optional<String> <del> // The path within the repository. This is only needed if you want <del> // to get the repository for that path if it is a submodule. <add> // * `path` The optional {String} path within the repository. This is only <add> // needed if you want to get the repository for that path if it is a <add> // submodule. <ide> // <del> // Returns :: Promise<NodeGit.Repository> <add> // Returns a {Promise} which resolves to the {NodeGit.Repository}. <ide> getRepo (_path) { <ide> if (this._destroyed()) { <ide> const error = new Error('Repository has been destroyed') <ide> export default class GitRepositoryAsync { <ide> <ide> // Is the repository currently refreshing its status? <ide> // <del> // Returns :: Bool <add> // Returns a {Boolean}. <ide> _isRefreshing () { <ide> return this._refreshingCount === 0 <ide> } <ide> <ide> // Has the repository been destroyed? <ide> // <del> // Returns :: Bool <add> // Returns a {Boolean}. <ide> _destroyed () { <ide> return this.repoPromise == null <ide> } <ide> export default class GitRepositoryAsync { <ide> <ide> // Get the status for the given path. <ide> // <del> // path :: String <del> // The path whose status is wanted. <add> // * `path` The {String} path whose status is wanted. <ide> // <del> // Returns :: Promise<NodeGit.StatusFile> <del> // The status for the path. <add> // Returns a {Promise} which resolves to the {NodeGit.StatusFile} status for <add> // the path. <ide> _filterStatusesByPath (_path) { <ide> // TODO: Is there a more efficient way to do this? <ide> let basePath = null <ide> export default class GitRepositoryAsync { <ide> <ide> // Get the status for everything in the given directory. <ide> // <del> // directoryPath :: String <del> // The directory whose status is wanted. <add> // * `directoryPath` The {String} directory whose status is wanted. <ide> // <del> // Returns :: Promise<Array<NodeGit.StatusFile>> <del> // The status for every file in the directory. <add> // Returns a {Promise} which resolves to an {Array} of {NodeGit.StatusFile} <add> // statuses for every file in the directory. <ide> _filterStatusesByDirectory (directoryPath) { <ide> return this.repoPromise <ide> .then(repo => repo.getStatus())
1
Javascript
Javascript
remove unused updatepropertiesbyid
9d443542f94e5dac7aa903952fa4e3b8280b8d91
<ide><path>src/core/ReactDOMIDOperations.js <ide> var ReactDOMIDOperations = { <ide> DOMPropertyOperations.deleteValueForProperty(node, name, value); <ide> }, <ide> <del> /** <del> * This should almost never be used instead of `updatePropertyByID()` due to <del> * the extra object allocation required by the API. That said, this is useful <del> * for batching up several operations across worker thread boundaries. <del> * <del> * @param {string} id ID of the node to update. <del> * @param {object} properties A mapping of valid property names. <del> * @internal <del> * @see {ReactDOMIDOperations.updatePropertyByID} <del> */ <del> updatePropertiesByID: function(id, properties) { <del> for (var name in properties) { <del> if (!properties.hasOwnProperty(name)) { <del> continue; <del> } <del> ReactDOMIDOperations.updatePropertiesByID(id, name, properties[name]); <del> } <del> }, <del> <ide> /** <ide> * Updates a DOM node with new style values. If a value is specified as '', <ide> * the corresponding style property will be unset.
1
Text
Text
add ternary operator to control flow statements
98f52a448e174a3e43ac04fe06f514757837a222
<ide><path>guide/english/java/control-flow/index.md <ide> if( cash < 25 ){ <ide> ``` <ide> In this example, `meetFriendsAtSportsBar()` will be executed. <ide> <del>![:rocket:](https://forum.freecodecamp.org/images/emoji/emoji_one/rocket.png?v=2 ":rocket:") <a href='https://repl.it/CJZi/1' target='_blank' rel='nofollow'>Run Code</a> <add>* `ternary operator` <add> <add>The ternary operator is a nice alternative to simple `if...else` structures. It is an expression taking 3 operands that allows you to write in one line what you would otherwise have written in 4-6 lines. This expression returns a value, so it can be used in assignments or as a continionnal parameter when calling a function. <add>```java <add>(condition) ? valueIfTrue : valueIfFalse <add>``` <add>```java <add>int number = 15; <add>String s = number > 10 ? "high" : "low"; <add> <add>System.out.println(number > 10 ? "high" : "low"); <add>```
1
Go
Go
use hostconfig in verifydaemonsettings
39932511c134938233e8bfe4796cec9a1b30d11e
<ide><path>daemon/container.go <ide> func (container *Container) initializeNetworking() error { <ide> <ide> // Make sure the config is compatible with the current kernel <ide> func (container *Container) verifyDaemonSettings() { <del> if container.Config.Memory > 0 && !container.daemon.sysInfo.MemoryLimit { <add> if container.hostConfig.Memory > 0 && !container.daemon.sysInfo.MemoryLimit { <ide> logrus.Warnf("Your kernel does not support memory limit capabilities. Limitation discarded.") <del> container.Config.Memory = 0 <add> container.hostConfig.Memory = 0 <ide> } <del> if container.Config.Memory > 0 && !container.daemon.sysInfo.SwapLimit { <add> if container.hostConfig.Memory > 0 && !container.daemon.sysInfo.SwapLimit { <ide> logrus.Warnf("Your kernel does not support swap limit capabilities. Limitation discarded.") <del> container.Config.MemorySwap = -1 <add> container.hostConfig.MemorySwap = -1 <ide> } <ide> if container.daemon.sysInfo.IPv4ForwardingDisabled { <ide> logrus.Warnf("IPv4 forwarding is disabled. Networking will not work")
1
Ruby
Ruby
qualify module name within module_evaled block
b5c8433a6f7f869bfcd2001f8c3c4660716e873b
<ide><path>actionpack/test/controller/helper_test.rb <ide> def test_helper_block <ide> def test_helper_block_include <ide> assert_equal expected_helper_methods, missing_methods <ide> assert_nothing_raised { <del> @controller_class.helper { include TestHelper } <add> @controller_class.helper { include HelperTest::TestHelper } <ide> } <ide> assert [], missing_methods <ide> end
1
Python
Python
make use of exitstack in npyio.py
aa276641d0943d17432d4ba02f8a00fdd6572237
<ide><path>numpy/lib/npyio.py <ide> def load(file, mmap_mode=None, allow_pickle=False, fix_imports=True, <ide> <ide> pickle_kwargs = dict(encoding=encoding, fix_imports=fix_imports) <ide> <del> # TODO: Use contextlib.ExitStack once we drop Python 2 <del> if hasattr(file, 'read'): <del> fid = file <del> own_fid = False <del> else: <del> fid = open(os_fspath(file), "rb") <del> own_fid = True <add> with contextlib.ExitStack() as stack: <add> if hasattr(file, 'read'): <add> fid = file <add> own_fid = False <add> else: <add> fid = stack.enter_context(open(os_fspath(file), "rb")) <add> own_fid = True <ide> <del> try: <ide> # Code to distinguish from NumPy binary files and pickles. <ide> _ZIP_PREFIX = b'PK\x03\x04' <ide> _ZIP_SUFFIX = b'PK\x05\x06' # empty zip files start with this <ide> def load(file, mmap_mode=None, allow_pickle=False, fix_imports=True, <ide> fid.seek(-min(N, len(magic)), 1) # back-up <ide> if magic.startswith(_ZIP_PREFIX) or magic.startswith(_ZIP_SUFFIX): <ide> # zip-file (assume .npz) <del> # Transfer file ownership to NpzFile <add> # Potentially transfer file ownership to NpzFile <add> stack.pop_all() <ide> ret = NpzFile(fid, own_fid=own_fid, allow_pickle=allow_pickle, <ide> pickle_kwargs=pickle_kwargs) <del> own_fid = False <ide> return ret <ide> elif magic == format.MAGIC_PREFIX: <ide> # .npy file <ide> def load(file, mmap_mode=None, allow_pickle=False, fix_imports=True, <ide> except Exception: <ide> raise IOError( <ide> "Failed to interpret file %s as a pickle" % repr(file)) <del> finally: <del> if own_fid: <del> fid.close() <ide> <ide> <ide> def _save_dispatcher(file, arr, allow_pickle=None, fix_imports=None): <ide> def save(file, arr, allow_pickle=True, fix_imports=True): <ide> >>> print(a, b) <ide> # [1 2] [1 3] <ide> """ <del> own_fid = False <ide> if hasattr(file, 'write'): <del> fid = file <add> file_ctx = contextlib_nullcontext(file) <ide> else: <ide> file = os_fspath(file) <ide> if not file.endswith('.npy'): <ide> file = file + '.npy' <del> fid = open(file, "wb") <del> own_fid = True <add> file_ctx = open(file, "wb") <ide> <del> try: <add> with file_ctx as fid: <ide> arr = np.asanyarray(arr) <ide> format.write_array(fid, arr, allow_pickle=allow_pickle, <ide> pickle_kwargs=dict(fix_imports=fix_imports)) <del> finally: <del> if own_fid: <del> fid.close() <ide> <ide> <ide> def _savez_dispatcher(file, *args, **kwds):
1
Python
Python
patch recursive import
1b652295c5940a45079c9056864009418c5a8054
<ide><path>src/transformers/convert_slow_tokenizer.py <ide> from tokenizers.models import BPE, Unigram, WordPiece <ide> <ide> from .file_utils import requires_backends <del>from .models.roformer.tokenization_utils import JiebaPreTokenizer <ide> <ide> <ide> class SentencePieceExtractor: <ide> def converted(self) -> Tokenizer: <ide> <ide> class RoFormerConverter(Converter): <ide> def converted(self) -> Tokenizer: <add> from .models.roformer.tokenization_utils import JiebaPreTokenizer <add> <ide> vocab = self.original_tokenizer.vocab <ide> tokenizer = Tokenizer(WordPiece(vocab, unk_token=str(self.original_tokenizer.unk_token))) <ide> <ide><path>tests/test_tokenization_utils.py <ide> # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <ide> # See the License for the specific language governing permissions and <ide> # limitations under the License. <add>""" <add>isort:skip_file <add>""" <ide> import os <ide> import pickle <ide> import tempfile <ide> <ide> import numpy as np <ide> <add># Ensure there are no circular imports when importing the parent class <add>from transformers import PreTrainedTokenizerFast <add> <ide> from transformers import ( <ide> BatchEncoding, <ide> BertTokenizer, <ide> BertTokenizerFast, <ide> PreTrainedTokenizer, <del> PreTrainedTokenizerFast, <ide> TensorType, <ide> TokenSpan, <ide> is_tokenizers_available,
2
Go
Go
ignore sigpipe events, resolves
55a367d2fe2feecf7b95fbddcdcb3ed179c197fe
<ide><path>cmd/dockerd/daemon.go <ide> func (cli *DaemonCli) start() (err error) { <ide> stopc := make(chan bool) <ide> defer close(stopc) <ide> <add> signal.Trap(func() { <add> cli.stop() <add> <-stopc // wait for daemonCli.start() to return <add> }) <add> <ide> // warn from uuid package when running the daemon <ide> uuid.Loggerf = logrus.Warnf <ide> <ide> func (cli *DaemonCli) start() (err error) { <ide> serveAPIWait := make(chan error) <ide> go api.Wait(serveAPIWait) <ide> <del> signal.Trap(func() { <del> cli.stop() <del> <-stopc // wait for daemonCli.start() to return <del> }) <del> <ide> // after the daemon is done setting up we can notify systemd api <ide> notifySystem() <ide> <ide><path>pkg/signal/trap.go <ide> import ( <ide> // * If SIGINT or SIGTERM are received 3 times before cleanup is complete, then cleanup is <ide> // skipped and the process is terminated immediately (allows force quit of stuck daemon) <ide> // * A SIGQUIT always causes an exit without cleanup, with a goroutine dump preceding exit. <add>// * Ignore SIGPIPE events. These are generated by systemd when journald is restarted while <add>// the docker daemon is not restarted and also running under systemd. <add>// Fixes https://github.com/docker/docker/issues/19728 <ide> // <ide> func Trap(cleanup func()) { <ide> c := make(chan os.Signal, 1) <del> // we will handle INT, TERM, QUIT here <del> signals := []os.Signal{os.Interrupt, syscall.SIGTERM, syscall.SIGQUIT} <add> // we will handle INT, TERM, QUIT, SIGPIPE here <add> signals := []os.Signal{os.Interrupt, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGPIPE} <ide> gosignal.Notify(c, signals...) <ide> go func() { <ide> interruptCount := uint32(0) <ide> for sig := range c { <add> if sig == syscall.SIGPIPE { <add> continue <add> } <add> <ide> go func(sig os.Signal) { <ide> logrus.Infof("Processing signal '%v'", sig) <ide> switch sig {
2
Python
Python
report p/r/f out of 100
f232d8db96c331b70c4b50e7173185e749e097f6
<ide><path>spacy/scorer.py <ide> def score_set(self, cand: set, gold: set) -> None: <ide> <ide> @property <ide> def precision(self) -> float: <del> return self.tp / (self.tp + self.fp + 1e-100) <add> return (self.tp / (self.tp + self.fp + 1e-100)) * 100 <ide> <ide> @property <ide> def recall(self) -> float: <del> return self.tp / (self.tp + self.fn + 1e-100) <add> return (self.tp / (self.tp + self.fn + 1e-100)) * 100 <ide> <ide> @property <ide> def fscore(self) -> float: <ide> p = self.precision <ide> r = self.recall <del> return 2 * ((p * r) / (p + r + 1e-100)) <add> return (2 * ((p * r) / (p + r + 1e-100))) * 100 <ide> <ide> def to_dict(self) -> Dict[str, float]: <ide> return {"p": self.precision, "r": self.recall, "f": self.fscore} <ide> def score_tokenization(examples: Iterable[Example], **cfg) -> Dict[str, float]: <ide> acc_score.tp += 1 <ide> prf_score.score_set(pred_spans, gold_spans) <ide> return { <del> "token_acc": acc_score.fscore, <del> "token_p": prf_score.precision, <del> "token_r": prf_score.recall, <del> "token_f": prf_score.fscore, <add> "token_acc": acc_score.fscore * 100, <add> "token_p": prf_score.precision * 100, <add> "token_r": prf_score.recall * 100, <add> "token_f": prf_score.fscore * 100, <ide> } <ide> <ide> @staticmethod
1
PHP
PHP
handle postgres time without timezone correctly
7f58bf1ffebe7a70d874cd473f916a37a309df30
<ide><path>src/Database/Schema/PostgresSchema.php <ide> protected function _convertColumn($column) <ide> if (strpos($col, 'timestamp') !== false) { <ide> return ['type' => 'timestamp', 'length' => null]; <ide> } <add> if (strpos($col, 'time') !== false) { <add> return ['type' => 'time', 'length' => null]; <add> } <ide> if ($col === 'serial' || $col === 'integer') { <ide> return ['type' => 'integer', 'length' => 10]; <ide> } <ide><path>tests/TestCase/Database/Schema/PostgresSchemaTest.php <ide> protected function _createTables($connection) <ide> author_id INTEGER NOT NULL, <ide> published BOOLEAN DEFAULT false, <ide> views SMALLINT DEFAULT 0, <add>readingtime TIME, <ide> created TIMESTAMP, <ide> CONSTRAINT "content_idx" UNIQUE ("title", "body"), <ide> CONSTRAINT "author_idx" FOREIGN KEY ("author_id") REFERENCES "schema_authors" ("id") ON DELETE RESTRICT ON UPDATE CASCADE <ide> public static function convertColumnProvider() <ide> 'TIME', <ide> ['type' => 'time', 'length' => null] <ide> ], <add> [ <add> 'TIME WITHOUT TIME ZONE', <add> ['type' => 'time', 'length' => null] <add> ], <ide> // Integer <ide> [ <ide> 'SMALLINT', <ide> public function testDescribeTable() <ide> 'comment' => null, <ide> 'autoIncrement' => null, <ide> ], <add> 'readingtime' => [ <add> 'type' => 'time', <add> 'null' => true, <add> 'default' => null, <add> 'length' => null, <add> 'precision' => null, <add> 'comment' => null, <add> ], <ide> 'created' => [ <ide> 'type' => 'timestamp', <ide> 'null' => true,
2
Javascript
Javascript
prepare tests for no-cond-assign eslint rule
d77754bfc7112ae68c818083ae0a75af9020b6aa
<ide><path>test/parallel/test-child-process-flush-stdio.js <ide> const spawnWithReadable = () => { <ide> })); <ide> p.stdout.on('readable', () => { <ide> let buf; <del> while (buf = p.stdout.read()) <add> while ((buf = p.stdout.read()) !== null) <ide> buffer.push(buf); <ide> }); <ide> }; <ide><path>test/parallel/test-net-server-max-connections.js <ide> function makeConnection(index) { <ide> if (closes === N / 2) { <ide> let cb; <ide> console.error('calling wait callback.'); <del> while (cb = waits.shift()) { <add> while ((cb = waits.shift()) !== undefined) { <ide> cb(); <ide> } <ide> server.close(); <ide><path>test/parallel/test-stream-readable-object-multi-push-async.js <ide> const BATCH = 10; <ide> readable.on('readable', () => { <ide> let data; <ide> console.log('readable emitted'); <del> while (data = readable.read()) { <add> while ((data = readable.read()) !== null) { <ide> console.log(data); <ide> } <ide> }); <ide><path>test/parallel/test-stream-unshift-empty-chunk.js <ide> let readAll = false; <ide> const seen = []; <ide> r.on('readable', () => { <ide> let chunk; <del> while (chunk = r.read()) { <add> while ((chunk = r.read()) !== null) { <ide> seen.push(chunk.toString()); <ide> // Simulate only reading a certain amount of the data, <ide> // and then putting the rest of the chunk back into the <ide><path>test/parallel/test-zlib-brotli-flush.js <ide> deflater.write(chunk, function() { <ide> deflater.flush(function() { <ide> const bufs = []; <ide> let buf; <del> while (buf = deflater.read()) <add> while ((buf = deflater.read()) !== null) <ide> bufs.push(buf); <ide> actualFull = Buffer.concat(bufs); <ide> }); <ide><path>test/parallel/test-zlib-flush.js <ide> deflater.write(chunk, function() { <ide> deflater.flush(function() { <ide> const bufs = []; <ide> let buf; <del> while (buf = deflater.read()) <add> while ((buf = deflater.read()) !== null) <ide> bufs.push(buf); <ide> actualFull = Buffer.concat(bufs); <ide> }); <ide><path>test/parallel/test-zlib-params.js <ide> deflater.write(chunk1, function() { <ide> deflater.end(chunk2, function() { <ide> const bufs = []; <ide> let buf; <del> while (buf = deflater.read()) <add> while ((buf = deflater.read()) !== null) <ide> bufs.push(buf); <ide> actual = Buffer.concat(bufs); <ide> });
7
Javascript
Javascript
add fxaa 3.11 antialiasing
a58d17160946f360644788681819a899aeeebf83
<ide><path>examples/js/shaders/FXAAShader.js <ide> THREE.FXAAShader = { <ide> <ide> vertexShader: [ <ide> <add> "varying vec2 vUv;", <add> <ide> "void main() {", <ide> <add> "vUv = uv;", <ide> "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", <ide> <ide> "}" <ide> <ide> ].join( "\n" ), <ide> <ide> fragmentShader: [ <del> <del> "uniform sampler2D tDiffuse;", <del> "uniform vec2 resolution;", <del> <del> "#define FXAA_REDUCE_MIN (1.0/128.0)", <del> "#define FXAA_REDUCE_MUL (1.0/8.0)", <del> "#define FXAA_SPAN_MAX 8.0", <del> <del> "void main() {", <del> <del> "vec3 rgbNW = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( -1.0, -1.0 ) ) * resolution ).xyz;", <del> "vec3 rgbNE = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( 1.0, -1.0 ) ) * resolution ).xyz;", <del> "vec3 rgbSW = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( -1.0, 1.0 ) ) * resolution ).xyz;", <del> "vec3 rgbSE = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( 1.0, 1.0 ) ) * resolution ).xyz;", <del> "vec4 rgbaM = texture2D( tDiffuse, gl_FragCoord.xy * resolution );", <del> "vec3 rgbM = rgbaM.xyz;", <del> "vec3 luma = vec3( 0.299, 0.587, 0.114 );", <del> <del> "float lumaNW = dot( rgbNW, luma );", <del> "float lumaNE = dot( rgbNE, luma );", <del> "float lumaSW = dot( rgbSW, luma );", <del> "float lumaSE = dot( rgbSE, luma );", <del> "float lumaM = dot( rgbM, luma );", <del> "float lumaMin = min( lumaM, min( min( lumaNW, lumaNE ), min( lumaSW, lumaSE ) ) );", <del> "float lumaMax = max( lumaM, max( max( lumaNW, lumaNE) , max( lumaSW, lumaSE ) ) );", <del> <del> "vec2 dir;", <del> "dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));", <del> "dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));", <del> <del> "float dirReduce = max( ( lumaNW + lumaNE + lumaSW + lumaSE ) * ( 0.25 * FXAA_REDUCE_MUL ), FXAA_REDUCE_MIN );", <del> <del> "float rcpDirMin = 1.0 / ( min( abs( dir.x ), abs( dir.y ) ) + dirReduce );", <del> "dir = min( vec2( FXAA_SPAN_MAX, FXAA_SPAN_MAX),", <del> "max( vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),", <del> "dir * rcpDirMin)) * resolution;", <del> "vec4 rgbA = (1.0/2.0) * (", <del> "texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (1.0/3.0 - 0.5)) +", <del> "texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (2.0/3.0 - 0.5)));", <del> "vec4 rgbB = rgbA * (1.0/2.0) + (1.0/4.0) * (", <del> "texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (0.0/3.0 - 0.5)) +", <del> "texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (3.0/3.0 - 0.5)));", <del> "float lumaB = dot(rgbB, vec4(luma, 0.0));", <del> <del> "if ( ( lumaB < lumaMin ) || ( lumaB > lumaMax ) ) {", <del> <del> "gl_FragColor = rgbA;", <del> <del> "} else {", <del> "gl_FragColor = rgbB;", <del> <del> "}", <del> <del> "}" <del> <del> ].join( "\n" ) <add> "precision highp float;", <add> "", <add> "uniform sampler2D tDiffuse;", <add> "", <add> "uniform vec2 resolution;", <add> "", <add> "varying vec2 vUv;", <add> "", <add> "// FXAA 3.11 implementation by NVIDIA, ported to WebGL by Agost Biro (biro@archilogic.com)", <add> "", <add> "//----------------------------------------------------------------------------------", <add> "// File: es3-kepler\FXAA\assets\shaders/FXAA_DefaultES.frag", <add> "// SDK Version: v3.00", <add> "// Email: gameworks@nvidia.com", <add> "// Site: http://developer.nvidia.com/", <add> "//", <add> "// Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.", <add> "//", <add> "// Redistribution and use in source and binary forms, with or without", <add> "// modification, are permitted provided that the following conditions", <add> "// are met:", <add> "// * Redistributions of source code must retain the above copyright", <add> "// notice, this list of conditions and the following disclaimer.", <add> "// * Redistributions in binary form must reproduce the above copyright", <add> "// notice, this list of conditions and the following disclaimer in the", <add> "// documentation and/or other materials provided with the distribution.", <add> "// * Neither the name of NVIDIA CORPORATION nor the names of its", <add> "// contributors may be used to endorse or promote products derived", <add> "// from this software without specific prior written permission.", <add> "//", <add> "// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY", <add> "// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE", <add> "// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR", <add> "// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR", <add> "// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,", <add> "// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,", <add> "// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR", <add> "// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY", <add> "// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT", <add> "// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE", <add> "// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.", <add> "//", <add> "//----------------------------------------------------------------------------------", <add> "", <add> "#define FXAA_PC 1", <add> "#define FXAA_GLSL_100 1", <add> "#define FXAA_QUALITY_PRESET 12", <add> "", <add> "#define FXAA_GREEN_AS_LUMA 1", <add> "", <add> "/*--------------------------------------------------------------------------*/", <add> "#ifndef FXAA_PC_CONSOLE", <add> " //", <add> " // The console algorithm for PC is included", <add> " // for developers targeting really low spec machines.", <add> " // Likely better to just run FXAA_PC, and use a really low preset.", <add> " //", <add> " #define FXAA_PC_CONSOLE 0", <add> "#endif", <add> "/*--------------------------------------------------------------------------*/", <add> "#ifndef FXAA_GLSL_120", <add> " #define FXAA_GLSL_120 0", <add> "#endif", <add> "/*--------------------------------------------------------------------------*/", <add> "#ifndef FXAA_GLSL_130", <add> " #define FXAA_GLSL_130 0", <add> "#endif", <add> "/*--------------------------------------------------------------------------*/", <add> "#ifndef FXAA_HLSL_3", <add> " #define FXAA_HLSL_3 0", <add> "#endif", <add> "/*--------------------------------------------------------------------------*/", <add> "#ifndef FXAA_HLSL_4", <add> " #define FXAA_HLSL_4 0", <add> "#endif", <add> "/*--------------------------------------------------------------------------*/", <add> "#ifndef FXAA_HLSL_5", <add> " #define FXAA_HLSL_5 0", <add> "#endif", <add> "/*==========================================================================*/", <add> "#ifndef FXAA_GREEN_AS_LUMA", <add> " //", <add> " // For those using non-linear color,", <add> " // and either not able to get luma in alpha, or not wanting to,", <add> " // this enables FXAA to run using green as a proxy for luma.", <add> " // So with this enabled, no need to pack luma in alpha.", <add> " //", <add> " // This will turn off AA on anything which lacks some amount of green.", <add> " // Pure red and blue or combination of only R and B, will get no AA.", <add> " //", <add> " // Might want to lower the settings for both,", <add> " // fxaaConsoleEdgeThresholdMin", <add> " // fxaaQualityEdgeThresholdMin", <add> " // In order to insure AA does not get turned off on colors", <add> " // which contain a minor amount of green.", <add> " //", <add> " // 1 = On.", <add> " // 0 = Off.", <add> " //", <add> " #define FXAA_GREEN_AS_LUMA 0", <add> "#endif", <add> "/*--------------------------------------------------------------------------*/", <add> "#ifndef FXAA_EARLY_EXIT", <add> " //", <add> " // Controls algorithm's early exit path.", <add> " // On PS3 turning this ON adds 2 cycles to the shader.", <add> " // On 360 turning this OFF adds 10ths of a millisecond to the shader.", <add> " // Turning this off on console will result in a more blurry image.", <add> " // So this defaults to on.", <add> " //", <add> " // 1 = On.", <add> " // 0 = Off.", <add> " //", <add> " #define FXAA_EARLY_EXIT 1", <add> "#endif", <add> "/*--------------------------------------------------------------------------*/", <add> "#ifndef FXAA_DISCARD", <add> " //", <add> " // Only valid for PC OpenGL currently.", <add> " // Probably will not work when FXAA_GREEN_AS_LUMA = 1.", <add> " //", <add> " // 1 = Use discard on pixels which don't need AA.", <add> " // For APIs which enable concurrent TEX+ROP from same surface.", <add> " // 0 = Return unchanged color on pixels which don't need AA.", <add> " //", <add> " #define FXAA_DISCARD 0", <add> "#endif", <add> "/*--------------------------------------------------------------------------*/", <add> "#ifndef FXAA_FAST_PIXEL_OFFSET", <add> " //", <add> " // Used for GLSL 120 only.", <add> " //", <add> " // 1 = GL API supports fast pixel offsets", <add> " // 0 = do not use fast pixel offsets", <add> " //", <add> " #ifdef GL_EXT_gpu_shader4", <add> " #define FXAA_FAST_PIXEL_OFFSET 1", <add> " #endif", <add> " #ifdef GL_NV_gpu_shader5", <add> " #define FXAA_FAST_PIXEL_OFFSET 1", <add> " #endif", <add> " #ifdef GL_ARB_gpu_shader5", <add> " #define FXAA_FAST_PIXEL_OFFSET 1", <add> " #endif", <add> " #ifndef FXAA_FAST_PIXEL_OFFSET", <add> " #define FXAA_FAST_PIXEL_OFFSET 0", <add> " #endif", <add> "#endif", <add> "/*--------------------------------------------------------------------------*/", <add> "#ifndef FXAA_GATHER4_ALPHA", <add> " //", <add> " // 1 = API supports gather4 on alpha channel.", <add> " // 0 = API does not support gather4 on alpha channel.", <add> " //", <add> " #if (FXAA_HLSL_5 == 1)", <add> " #define FXAA_GATHER4_ALPHA 1", <add> " #endif", <add> " #ifdef GL_ARB_gpu_shader5", <add> " #define FXAA_GATHER4_ALPHA 1", <add> " #endif", <add> " #ifdef GL_NV_gpu_shader5", <add> " #define FXAA_GATHER4_ALPHA 1", <add> " #endif", <add> " #ifndef FXAA_GATHER4_ALPHA", <add> " #define FXAA_GATHER4_ALPHA 0", <add> " #endif", <add> "#endif", <add> "", <add> "", <add> "/*============================================================================", <add> " FXAA QUALITY - TUNING KNOBS", <add> "------------------------------------------------------------------------------", <add> "NOTE the other tuning knobs are now in the shader function inputs!", <add> "============================================================================*/", <add> "#ifndef FXAA_QUALITY_PRESET", <add> " //", <add> " // Choose the quality preset.", <add> " // This needs to be compiled into the shader as it effects code.", <add> " // Best option to include multiple presets is to", <add> " // in each shader define the preset, then include this file.", <add> " //", <add> " // OPTIONS", <add> " // -----------------------------------------------------------------------", <add> " // 10 to 15 - default medium dither (10=fastest, 15=highest quality)", <add> " // 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality)", <add> " // 39 - no dither, very expensive", <add> " //", <add> " // NOTES", <add> " // -----------------------------------------------------------------------", <add> " // 12 = slightly faster then FXAA 3.9 and higher edge quality (default)", <add> " // 13 = about same speed as FXAA 3.9 and better than 12", <add> " // 23 = closest to FXAA 3.9 visually and performance wise", <add> " // _ = the lowest digit is directly related to performance", <add> " // _ = the highest digit is directly related to style", <add> " //", <add> " #define FXAA_QUALITY_PRESET 12", <add> "#endif", <add> "", <add> "", <add> "/*============================================================================", <add> "", <add> " FXAA QUALITY - PRESETS", <add> "", <add> "============================================================================*/", <add> "", <add> "/*============================================================================", <add> " FXAA QUALITY - MEDIUM DITHER PRESETS", <add> "============================================================================*/", <add> "#if (FXAA_QUALITY_PRESET == 10)", <add> " #define FXAA_QUALITY_PS 3", <add> " #define FXAA_QUALITY_P0 1.5", <add> " #define FXAA_QUALITY_P1 3.0", <add> " #define FXAA_QUALITY_P2 12.0", <add> "#endif", <add> "/*--------------------------------------------------------------------------*/", <add> "#if (FXAA_QUALITY_PRESET == 11)", <add> " #define FXAA_QUALITY_PS 4", <add> " #define FXAA_QUALITY_P0 1.0", <add> " #define FXAA_QUALITY_P1 1.5", <add> " #define FXAA_QUALITY_P2 3.0", <add> " #define FXAA_QUALITY_P3 12.0", <add> "#endif", <add> "/*--------------------------------------------------------------------------*/", <add> "#if (FXAA_QUALITY_PRESET == 12)", <add> " #define FXAA_QUALITY_PS 5", <add> " #define FXAA_QUALITY_P0 1.0", <add> " #define FXAA_QUALITY_P1 1.5", <add> " #define FXAA_QUALITY_P2 2.0", <add> " #define FXAA_QUALITY_P3 4.0", <add> " #define FXAA_QUALITY_P4 12.0", <add> "#endif", <add> "/*--------------------------------------------------------------------------*/", <add> "#if (FXAA_QUALITY_PRESET == 13)", <add> " #define FXAA_QUALITY_PS 6", <add> " #define FXAA_QUALITY_P0 1.0", <add> " #define FXAA_QUALITY_P1 1.5", <add> " #define FXAA_QUALITY_P2 2.0", <add> " #define FXAA_QUALITY_P3 2.0", <add> " #define FXAA_QUALITY_P4 4.0", <add> " #define FXAA_QUALITY_P5 12.0", <add> "#endif", <add> "/*--------------------------------------------------------------------------*/", <add> "#if (FXAA_QUALITY_PRESET == 14)", <add> " #define FXAA_QUALITY_PS 7", <add> " #define FXAA_QUALITY_P0 1.0", <add> " #define FXAA_QUALITY_P1 1.5", <add> " #define FXAA_QUALITY_P2 2.0", <add> " #define FXAA_QUALITY_P3 2.0", <add> " #define FXAA_QUALITY_P4 2.0", <add> " #define FXAA_QUALITY_P5 4.0", <add> " #define FXAA_QUALITY_P6 12.0", <add> "#endif", <add> "/*--------------------------------------------------------------------------*/", <add> "#if (FXAA_QUALITY_PRESET == 15)", <add> " #define FXAA_QUALITY_PS 8", <add> " #define FXAA_QUALITY_P0 1.0", <add> " #define FXAA_QUALITY_P1 1.5", <add> " #define FXAA_QUALITY_P2 2.0", <add> " #define FXAA_QUALITY_P3 2.0", <add> " #define FXAA_QUALITY_P4 2.0", <add> " #define FXAA_QUALITY_P5 2.0", <add> " #define FXAA_QUALITY_P6 4.0", <add> " #define FXAA_QUALITY_P7 12.0", <add> "#endif", <add> "", <add> "/*============================================================================", <add> " FXAA QUALITY - LOW DITHER PRESETS", <add> "============================================================================*/", <add> "#if (FXAA_QUALITY_PRESET == 20)", <add> " #define FXAA_QUALITY_PS 3", <add> " #define FXAA_QUALITY_P0 1.5", <add> " #define FXAA_QUALITY_P1 2.0", <add> " #define FXAA_QUALITY_P2 8.0", <add> "#endif", <add> "/*--------------------------------------------------------------------------*/", <add> "#if (FXAA_QUALITY_PRESET == 21)", <add> " #define FXAA_QUALITY_PS 4", <add> " #define FXAA_QUALITY_P0 1.0", <add> " #define FXAA_QUALITY_P1 1.5", <add> " #define FXAA_QUALITY_P2 2.0", <add> " #define FXAA_QUALITY_P3 8.0", <add> "#endif", <add> "/*--------------------------------------------------------------------------*/", <add> "#if (FXAA_QUALITY_PRESET == 22)", <add> " #define FXAA_QUALITY_PS 5", <add> " #define FXAA_QUALITY_P0 1.0", <add> " #define FXAA_QUALITY_P1 1.5", <add> " #define FXAA_QUALITY_P2 2.0", <add> " #define FXAA_QUALITY_P3 2.0", <add> " #define FXAA_QUALITY_P4 8.0", <add> "#endif", <add> "/*--------------------------------------------------------------------------*/", <add> "#if (FXAA_QUALITY_PRESET == 23)", <add> " #define FXAA_QUALITY_PS 6", <add> " #define FXAA_QUALITY_P0 1.0", <add> " #define FXAA_QUALITY_P1 1.5", <add> " #define FXAA_QUALITY_P2 2.0", <add> " #define FXAA_QUALITY_P3 2.0", <add> " #define FXAA_QUALITY_P4 2.0", <add> " #define FXAA_QUALITY_P5 8.0", <add> "#endif", <add> "/*--------------------------------------------------------------------------*/", <add> "#if (FXAA_QUALITY_PRESET == 24)", <add> " #define FXAA_QUALITY_PS 7", <add> " #define FXAA_QUALITY_P0 1.0", <add> " #define FXAA_QUALITY_P1 1.5", <add> " #define FXAA_QUALITY_P2 2.0", <add> " #define FXAA_QUALITY_P3 2.0", <add> " #define FXAA_QUALITY_P4 2.0", <add> " #define FXAA_QUALITY_P5 3.0", <add> " #define FXAA_QUALITY_P6 8.0", <add> "#endif", <add> "/*--------------------------------------------------------------------------*/", <add> "#if (FXAA_QUALITY_PRESET == 25)", <add> " #define FXAA_QUALITY_PS 8", <add> " #define FXAA_QUALITY_P0 1.0", <add> " #define FXAA_QUALITY_P1 1.5", <add> " #define FXAA_QUALITY_P2 2.0", <add> " #define FXAA_QUALITY_P3 2.0", <add> " #define FXAA_QUALITY_P4 2.0", <add> " #define FXAA_QUALITY_P5 2.0", <add> " #define FXAA_QUALITY_P6 4.0", <add> " #define FXAA_QUALITY_P7 8.0", <add> "#endif", <add> "/*--------------------------------------------------------------------------*/", <add> "#if (FXAA_QUALITY_PRESET == 26)", <add> " #define FXAA_QUALITY_PS 9", <add> " #define FXAA_QUALITY_P0 1.0", <add> " #define FXAA_QUALITY_P1 1.5", <add> " #define FXAA_QUALITY_P2 2.0", <add> " #define FXAA_QUALITY_P3 2.0", <add> " #define FXAA_QUALITY_P4 2.0", <add> " #define FXAA_QUALITY_P5 2.0", <add> " #define FXAA_QUALITY_P6 2.0", <add> " #define FXAA_QUALITY_P7 4.0", <add> " #define FXAA_QUALITY_P8 8.0", <add> "#endif", <add> "/*--------------------------------------------------------------------------*/", <add> "#if (FXAA_QUALITY_PRESET == 27)", <add> " #define FXAA_QUALITY_PS 10", <add> " #define FXAA_QUALITY_P0 1.0", <add> " #define FXAA_QUALITY_P1 1.5", <add> " #define FXAA_QUALITY_P2 2.0", <add> " #define FXAA_QUALITY_P3 2.0", <add> " #define FXAA_QUALITY_P4 2.0", <add> " #define FXAA_QUALITY_P5 2.0", <add> " #define FXAA_QUALITY_P6 2.0", <add> " #define FXAA_QUALITY_P7 2.0", <add> " #define FXAA_QUALITY_P8 4.0", <add> " #define FXAA_QUALITY_P9 8.0", <add> "#endif", <add> "/*--------------------------------------------------------------------------*/", <add> "#if (FXAA_QUALITY_PRESET == 28)", <add> " #define FXAA_QUALITY_PS 11", <add> " #define FXAA_QUALITY_P0 1.0", <add> " #define FXAA_QUALITY_P1 1.5", <add> " #define FXAA_QUALITY_P2 2.0", <add> " #define FXAA_QUALITY_P3 2.0", <add> " #define FXAA_QUALITY_P4 2.0", <add> " #define FXAA_QUALITY_P5 2.0", <add> " #define FXAA_QUALITY_P6 2.0", <add> " #define FXAA_QUALITY_P7 2.0", <add> " #define FXAA_QUALITY_P8 2.0", <add> " #define FXAA_QUALITY_P9 4.0", <add> " #define FXAA_QUALITY_P10 8.0", <add> "#endif", <add> "/*--------------------------------------------------------------------------*/", <add> "#if (FXAA_QUALITY_PRESET == 29)", <add> " #define FXAA_QUALITY_PS 12", <add> " #define FXAA_QUALITY_P0 1.0", <add> " #define FXAA_QUALITY_P1 1.5", <add> " #define FXAA_QUALITY_P2 2.0", <add> " #define FXAA_QUALITY_P3 2.0", <add> " #define FXAA_QUALITY_P4 2.0", <add> " #define FXAA_QUALITY_P5 2.0", <add> " #define FXAA_QUALITY_P6 2.0", <add> " #define FXAA_QUALITY_P7 2.0", <add> " #define FXAA_QUALITY_P8 2.0", <add> " #define FXAA_QUALITY_P9 2.0", <add> " #define FXAA_QUALITY_P10 4.0", <add> " #define FXAA_QUALITY_P11 8.0", <add> "#endif", <add> "", <add> "/*============================================================================", <add> " FXAA QUALITY - EXTREME QUALITY", <add> "============================================================================*/", <add> "#if (FXAA_QUALITY_PRESET == 39)", <add> " #define FXAA_QUALITY_PS 12", <add> " #define FXAA_QUALITY_P0 1.0", <add> " #define FXAA_QUALITY_P1 1.0", <add> " #define FXAA_QUALITY_P2 1.0", <add> " #define FXAA_QUALITY_P3 1.0", <add> " #define FXAA_QUALITY_P4 1.0", <add> " #define FXAA_QUALITY_P5 1.5", <add> " #define FXAA_QUALITY_P6 2.0", <add> " #define FXAA_QUALITY_P7 2.0", <add> " #define FXAA_QUALITY_P8 2.0", <add> " #define FXAA_QUALITY_P9 2.0", <add> " #define FXAA_QUALITY_P10 4.0", <add> " #define FXAA_QUALITY_P11 8.0", <add> "#endif", <add> "", <add> "", <add> "", <add> "/*============================================================================", <add> "", <add> " API PORTING", <add> "", <add> "============================================================================*/", <add> "#if (FXAA_GLSL_100 == 1) || (FXAA_GLSL_120 == 1) || (FXAA_GLSL_130 == 1)", <add> " #define FxaaBool bool", <add> " #define FxaaDiscard discard", <add> " #define FxaaFloat float", <add> " #define FxaaFloat2 vec2", <add> " #define FxaaFloat3 vec3", <add> " #define FxaaFloat4 vec4", <add> " #define FxaaHalf float", <add> " #define FxaaHalf2 vec2", <add> " #define FxaaHalf3 vec3", <add> " #define FxaaHalf4 vec4", <add> " #define FxaaInt2 ivec2", <add> " #define FxaaSat(x) clamp(x, 0.0, 1.0)", <add> " #define FxaaTex sampler2D", <add> "#else", <add> " #define FxaaBool bool", <add> " #define FxaaDiscard clip(-1)", <add> " #define FxaaFloat float", <add> " #define FxaaFloat2 float2", <add> " #define FxaaFloat3 float3", <add> " #define FxaaFloat4 float4", <add> " #define FxaaHalf half", <add> " #define FxaaHalf2 half2", <add> " #define FxaaHalf3 half3", <add> " #define FxaaHalf4 half4", <add> " #define FxaaSat(x) saturate(x)", <add> "#endif", <add> "/*--------------------------------------------------------------------------*/", <add> "#if (FXAA_GLSL_100 == 1)", <add> " #define FxaaTexTop(t, p) texture2D(t, p, 0.0)", <add> " #define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r), 0.0)", <add> "#endif", <add> "/*--------------------------------------------------------------------------*/", <add> "#if (FXAA_GLSL_120 == 1)", <add> " // Requires,", <add> " // #version 120", <add> " // And at least,", <add> " // #extension GL_EXT_gpu_shader4 : enable", <add> " // (or set FXAA_FAST_PIXEL_OFFSET 1 to work like DX9)", <add> " #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)", <add> " #if (FXAA_FAST_PIXEL_OFFSET == 1)", <add> " #define FxaaTexOff(t, p, o, r) texture2DLodOffset(t, p, 0.0, o)", <add> " #else", <add> " #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)", <add> " #endif", <add> " #if (FXAA_GATHER4_ALPHA == 1)", <add> " // use #extension GL_ARB_gpu_shader5 : enable", <add> " #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)", <add> " #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)", <add> " #define FxaaTexGreen4(t, p) textureGather(t, p, 1)", <add> " #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)", <add> " #endif", <add> "#endif", <add> "/*--------------------------------------------------------------------------*/", <add> "#if (FXAA_GLSL_130 == 1)", <add> " // Requires \"#version 130\" or better", <add> " #define FxaaTexTop(t, p) textureLod(t, p, 0.0)", <add> " #define FxaaTexOff(t, p, o, r) textureLodOffset(t, p, 0.0, o)", <add> " #if (FXAA_GATHER4_ALPHA == 1)", <add> " // use #extension GL_ARB_gpu_shader5 : enable", <add> " #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)", <add> " #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)", <add> " #define FxaaTexGreen4(t, p) textureGather(t, p, 1)", <add> " #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)", <add> " #endif", <add> "#endif", <add> "/*--------------------------------------------------------------------------*/", <add> "#if (FXAA_HLSL_3 == 1)", <add> " #define FxaaInt2 float2", <add> " #define FxaaTex sampler2D", <add> " #define FxaaTexTop(t, p) tex2Dlod(t, float4(p, 0.0, 0.0))", <add> " #define FxaaTexOff(t, p, o, r) tex2Dlod(t, float4(p + (o * r), 0, 0))", <add> "#endif", <add> "/*--------------------------------------------------------------------------*/", <add> "#if (FXAA_HLSL_4 == 1)", <add> " #define FxaaInt2 int2", <add> " struct FxaaTex { SamplerState smpl; Texture2D tex; };", <add> " #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)", <add> " #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)", <add> "#endif", <add> "/*--------------------------------------------------------------------------*/", <add> "#if (FXAA_HLSL_5 == 1)", <add> " #define FxaaInt2 int2", <add> " struct FxaaTex { SamplerState smpl; Texture2D tex; };", <add> " #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)", <add> " #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)", <add> " #define FxaaTexAlpha4(t, p) t.tex.GatherAlpha(t.smpl, p)", <add> " #define FxaaTexOffAlpha4(t, p, o) t.tex.GatherAlpha(t.smpl, p, o)", <add> " #define FxaaTexGreen4(t, p) t.tex.GatherGreen(t.smpl, p)", <add> " #define FxaaTexOffGreen4(t, p, o) t.tex.GatherGreen(t.smpl, p, o)", <add> "#endif", <add> "", <add> "", <add> "/*============================================================================", <add> " GREEN AS LUMA OPTION SUPPORT FUNCTION", <add> "============================================================================*/", <add> "#if (FXAA_GREEN_AS_LUMA == 0)", <add> " FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.w; }", <add> "#else", <add> " FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }", <add> "#endif", <add> "", <add> "", <add> "", <add> "", <add> "/*============================================================================", <add> "", <add> " FXAA3 QUALITY - PC", <add> "", <add> "============================================================================*/", <add> "#if (FXAA_PC == 1)", <add> "/*--------------------------------------------------------------------------*/", <add> "FxaaFloat4 FxaaPixelShader(", <add> " //", <add> " // Use noperspective interpolation here (turn off perspective interpolation).", <add> " // {xy} = center of pixel", <add> " FxaaFloat2 pos,", <add> " //", <add> " // Used only for FXAA Console, and not used on the 360 version.", <add> " // Use noperspective interpolation here (turn off perspective interpolation).", <add> " // {xy_} = upper left of pixel", <add> " // {_zw} = lower right of pixel", <add> " FxaaFloat4 fxaaConsolePosPos,", <add> " //", <add> " // Input color texture.", <add> " // {rgb_} = color in linear or perceptual color space", <add> " // if (FXAA_GREEN_AS_LUMA == 0)", <add> " // {__a} = luma in perceptual color space (not linear)", <add> " FxaaTex tex,", <add> " //", <add> " // Only used on the optimized 360 version of FXAA Console.", <add> " // For everything but 360, just use the same input here as for \"tex\".", <add> " // For 360, same texture, just alias with a 2nd sampler.", <add> " // This sampler needs to have an exponent bias of -1.", <add> " FxaaTex fxaaConsole360TexExpBiasNegOne,", <add> " //", <add> " // Only used on the optimized 360 version of FXAA Console.", <add> " // For everything but 360, just use the same input here as for \"tex\".", <add> " // For 360, same texture, just alias with a 3nd sampler.", <add> " // This sampler needs to have an exponent bias of -2.", <add> " FxaaTex fxaaConsole360TexExpBiasNegTwo,", <add> " //", <add> " // Only used on FXAA Quality.", <add> " // This must be from a constant/uniform.", <add> " // {x_} = 1.0/screenWidthInPixels", <add> " // {_y} = 1.0/screenHeightInPixels", <add> " FxaaFloat2 fxaaQualityRcpFrame,", <add> " //", <add> " // Only used on FXAA Console.", <add> " // This must be from a constant/uniform.", <add> " // This effects sub-pixel AA quality and inversely sharpness.", <add> " // Where N ranges between,", <add> " // N = 0.50 (default)", <add> " // N = 0.33 (sharper)", <add> " // {x__} = -N/screenWidthInPixels", <add> " // {_y_} = -N/screenHeightInPixels", <add> " // {_z_} = N/screenWidthInPixels", <add> " // {__w} = N/screenHeightInPixels", <add> " FxaaFloat4 fxaaConsoleRcpFrameOpt,", <add> " //", <add> " // Only used on FXAA Console.", <add> " // Not used on 360, but used on PS3 and PC.", <add> " // This must be from a constant/uniform.", <add> " // {x__} = -2.0/screenWidthInPixels", <add> " // {_y_} = -2.0/screenHeightInPixels", <add> " // {_z_} = 2.0/screenWidthInPixels", <add> " // {__w} = 2.0/screenHeightInPixels", <add> " FxaaFloat4 fxaaConsoleRcpFrameOpt2,", <add> " //", <add> " // Only used on FXAA Console.", <add> " // Only used on 360 in place of fxaaConsoleRcpFrameOpt2.", <add> " // This must be from a constant/uniform.", <add> " // {x__} = 8.0/screenWidthInPixels", <add> " // {_y_} = 8.0/screenHeightInPixels", <add> " // {_z_} = -4.0/screenWidthInPixels", <add> " // {__w} = -4.0/screenHeightInPixels", <add> " FxaaFloat4 fxaaConsole360RcpFrameOpt2,", <add> " //", <add> " // Only used on FXAA Quality.", <add> " // This used to be the FXAA_QUALITY_SUBPIX define.", <add> " // It is here now to allow easier tuning.", <add> " // Choose the amount of sub-pixel aliasing removal.", <add> " // This can effect sharpness.", <add> " // 1.00 - upper limit (softer)", <add> " // 0.75 - default amount of filtering", <add> " // 0.50 - lower limit (sharper, less sub-pixel aliasing removal)", <add> " // 0.25 - almost off", <add> " // 0.00 - completely off", <add> " FxaaFloat fxaaQualitySubpix,", <add> " //", <add> " // Only used on FXAA Quality.", <add> " // This used to be the FXAA_QUALITY_EDGE_THRESHOLD define.", <add> " // It is here now to allow easier tuning.", <add> " // The minimum amount of local contrast required to apply algorithm.", <add> " // 0.333 - too little (faster)", <add> " // 0.250 - low quality", <add> " // 0.166 - default", <add> " // 0.125 - high quality", <add> " // 0.063 - overkill (slower)", <add> " FxaaFloat fxaaQualityEdgeThreshold,", <add> " //", <add> " // Only used on FXAA Quality.", <add> " // This used to be the FXAA_QUALITY_EDGE_THRESHOLD_MIN define.", <add> " // It is here now to allow easier tuning.", <add> " // Trims the algorithm from processing darks.", <add> " // 0.0833 - upper limit (default, the start of visible unfiltered edges)", <add> " // 0.0625 - high quality (faster)", <add> " // 0.0312 - visible limit (slower)", <add> " // Special notes when using FXAA_GREEN_AS_LUMA,", <add> " // Likely want to set this to zero.", <add> " // As colors that are mostly not-green", <add> " // will appear very dark in the green channel!", <add> " // Tune by looking at mostly non-green content,", <add> " // then start at zero and increase until aliasing is a problem.", <add> " FxaaFloat fxaaQualityEdgeThresholdMin,", <add> " //", <add> " // Only used on FXAA Console.", <add> " // This used to be the FXAA_CONSOLE_EDGE_SHARPNESS define.", <add> " // It is here now to allow easier tuning.", <add> " // This does not effect PS3, as this needs to be compiled in.", <add> " // Use FXAA_CONSOLE_PS3_EDGE_SHARPNESS for PS3.", <add> " // Due to the PS3 being ALU bound,", <add> " // there are only three safe values here: 2 and 4 and 8.", <add> " // These options use the shaders ability to a free *|/ by 2|4|8.", <add> " // For all other platforms can be a non-power of two.", <add> " // 8.0 is sharper (default!!!)", <add> " // 4.0 is softer", <add> " // 2.0 is really soft (good only for vector graphics inputs)", <add> " FxaaFloat fxaaConsoleEdgeSharpness,", <add> " //", <add> " // Only used on FXAA Console.", <add> " // This used to be the FXAA_CONSOLE_EDGE_THRESHOLD define.", <add> " // It is here now to allow easier tuning.", <add> " // This does not effect PS3, as this needs to be compiled in.", <add> " // Use FXAA_CONSOLE_PS3_EDGE_THRESHOLD for PS3.", <add> " // Due to the PS3 being ALU bound,", <add> " // there are only two safe values here: 1/4 and 1/8.", <add> " // These options use the shaders ability to a free *|/ by 2|4|8.", <add> " // The console setting has a different mapping than the quality setting.", <add> " // Other platforms can use other values.", <add> " // 0.125 leaves less aliasing, but is softer (default!!!)", <add> " // 0.25 leaves more aliasing, and is sharper", <add> " FxaaFloat fxaaConsoleEdgeThreshold,", <add> " //", <add> " // Only used on FXAA Console.", <add> " // This used to be the FXAA_CONSOLE_EDGE_THRESHOLD_MIN define.", <add> " // It is here now to allow easier tuning.", <add> " // Trims the algorithm from processing darks.", <add> " // The console setting has a different mapping than the quality setting.", <add> " // This only applies when FXAA_EARLY_EXIT is 1.", <add> " // This does not apply to PS3,", <add> " // PS3 was simplified to avoid more shader instructions.", <add> " // 0.06 - faster but more aliasing in darks", <add> " // 0.05 - default", <add> " // 0.04 - slower and less aliasing in darks", <add> " // Special notes when using FXAA_GREEN_AS_LUMA,", <add> " // Likely want to set this to zero.", <add> " // As colors that are mostly not-green", <add> " // will appear very dark in the green channel!", <add> " // Tune by looking at mostly non-green content,", <add> " // then start at zero and increase until aliasing is a problem.", <add> " FxaaFloat fxaaConsoleEdgeThresholdMin,", <add> " //", <add> " // Extra constants for 360 FXAA Console only.", <add> " // Use zeros or anything else for other platforms.", <add> " // These must be in physical constant registers and NOT immedates.", <add> " // Immedates will result in compiler un-optimizing.", <add> " // {xyzw} = float4(1.0, -1.0, 0.25, -0.25)", <add> " FxaaFloat4 fxaaConsole360ConstDir", <add> ") {", <add> "/*--------------------------------------------------------------------------*/", <add> " FxaaFloat2 posM;", <add> " posM.x = pos.x;", <add> " posM.y = pos.y;", <add> " #if (FXAA_GATHER4_ALPHA == 1)", <add> " #if (FXAA_DISCARD == 0)", <add> " FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);", <add> " #if (FXAA_GREEN_AS_LUMA == 0)", <add> " #define lumaM rgbyM.w", <add> " #else", <add> " #define lumaM rgbyM.y", <add> " #endif", <add> " #endif", <add> " #if (FXAA_GREEN_AS_LUMA == 0)", <add> " FxaaFloat4 luma4A = FxaaTexAlpha4(tex, posM);", <add> " FxaaFloat4 luma4B = FxaaTexOffAlpha4(tex, posM, FxaaInt2(-1, -1));", <add> " #else", <add> " FxaaFloat4 luma4A = FxaaTexGreen4(tex, posM);", <add> " FxaaFloat4 luma4B = FxaaTexOffGreen4(tex, posM, FxaaInt2(-1, -1));", <add> " #endif", <add> " #if (FXAA_DISCARD == 1)", <add> " #define lumaM luma4A.w", <add> " #endif", <add> " #define lumaE luma4A.z", <add> " #define lumaS luma4A.x", <add> " #define lumaSE luma4A.y", <add> " #define lumaNW luma4B.w", <add> " #define lumaN luma4B.z", <add> " #define lumaW luma4B.x", <add> " #else", <add> " FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);", <add> " #if (FXAA_GREEN_AS_LUMA == 0)", <add> " #define lumaM rgbyM.w", <add> " #else", <add> " #define lumaM rgbyM.y", <add> " #endif", <add> " #if (FXAA_GLSL_100 == 1)", <add> " FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 0.0, 1.0), fxaaQualityRcpFrame.xy));", <add> " FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0, 0.0), fxaaQualityRcpFrame.xy));", <add> " FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 0.0,-1.0), fxaaQualityRcpFrame.xy));", <add> " FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 0.0), fxaaQualityRcpFrame.xy));", <add> " #else", <add> " FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));", <add> " FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));", <add> " FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));", <add> " FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));", <add> " #endif", <add> " #endif", <add> "/*--------------------------------------------------------------------------*/", <add> " FxaaFloat maxSM = max(lumaS, lumaM);", <add> " FxaaFloat minSM = min(lumaS, lumaM);", <add> " FxaaFloat maxESM = max(lumaE, maxSM);", <add> " FxaaFloat minESM = min(lumaE, minSM);", <add> " FxaaFloat maxWN = max(lumaN, lumaW);", <add> " FxaaFloat minWN = min(lumaN, lumaW);", <add> " FxaaFloat rangeMax = max(maxWN, maxESM);", <add> " FxaaFloat rangeMin = min(minWN, minESM);", <add> " FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;", <add> " FxaaFloat range = rangeMax - rangeMin;", <add> " FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);", <add> " FxaaBool earlyExit = range < rangeMaxClamped;", <add> "/*--------------------------------------------------------------------------*/", <add> " if(earlyExit)", <add> " #if (FXAA_DISCARD == 1)", <add> " FxaaDiscard;", <add> " #else", <add> " return rgbyM;", <add> " #endif", <add> "/*--------------------------------------------------------------------------*/", <add> " #if (FXAA_GATHER4_ALPHA == 0)", <add> " #if (FXAA_GLSL_100 == 1)", <add> " FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0,-1.0), fxaaQualityRcpFrame.xy));", <add> " FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0, 1.0), fxaaQualityRcpFrame.xy));", <add> " FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0,-1.0), fxaaQualityRcpFrame.xy));", <add> " FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 1.0), fxaaQualityRcpFrame.xy));", <add> " #else", <add> " FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));", <add> " FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));", <add> " FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));", <add> " FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));", <add> " #endif", <add> " #else", <add> " FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, -1), fxaaQualityRcpFrame.xy));", <add> " FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));", <add> " #endif", <add> "/*--------------------------------------------------------------------------*/", <add> " FxaaFloat lumaNS = lumaN + lumaS;", <add> " FxaaFloat lumaWE = lumaW + lumaE;", <add> " FxaaFloat subpixRcpRange = 1.0/range;", <add> " FxaaFloat subpixNSWE = lumaNS + lumaWE;", <add> " FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;", <add> " FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;", <add> "/*--------------------------------------------------------------------------*/", <add> " FxaaFloat lumaNESE = lumaNE + lumaSE;", <add> " FxaaFloat lumaNWNE = lumaNW + lumaNE;", <add> " FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;", <add> " FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;", <add> "/*--------------------------------------------------------------------------*/", <add> " FxaaFloat lumaNWSW = lumaNW + lumaSW;", <add> " FxaaFloat lumaSWSE = lumaSW + lumaSE;", <add> " FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);", <add> " FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);", <add> " FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;", <add> " FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;", <add> " FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;", <add> " FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;", <add> "/*--------------------------------------------------------------------------*/", <add> " FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;", <add> " FxaaFloat lengthSign = fxaaQualityRcpFrame.x;", <add> " FxaaBool horzSpan = edgeHorz >= edgeVert;", <add> " FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;", <add> "/*--------------------------------------------------------------------------*/", <add> " if(!horzSpan) lumaN = lumaW;", <add> " if(!horzSpan) lumaS = lumaE;", <add> " if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;", <add> " FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;", <add> "/*--------------------------------------------------------------------------*/", <add> " FxaaFloat gradientN = lumaN - lumaM;", <add> " FxaaFloat gradientS = lumaS - lumaM;", <add> " FxaaFloat lumaNN = lumaN + lumaM;", <add> " FxaaFloat lumaSS = lumaS + lumaM;", <add> " FxaaBool pairN = abs(gradientN) >= abs(gradientS);", <add> " FxaaFloat gradient = max(abs(gradientN), abs(gradientS));", <add> " if(pairN) lengthSign = -lengthSign;", <add> " FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);", <add> "/*--------------------------------------------------------------------------*/", <add> " FxaaFloat2 posB;", <add> " posB.x = posM.x;", <add> " posB.y = posM.y;", <add> " FxaaFloat2 offNP;", <add> " offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;", <add> " offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;", <add> " if(!horzSpan) posB.x += lengthSign * 0.5;", <add> " if( horzSpan) posB.y += lengthSign * 0.5;", <add> "/*--------------------------------------------------------------------------*/", <add> " FxaaFloat2 posN;", <add> " posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;", <add> " posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;", <add> " FxaaFloat2 posP;", <add> " posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;", <add> " posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;", <add> " FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;", <add> " FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));", <add> " FxaaFloat subpixE = subpixC * subpixC;", <add> " FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));", <add> "/*--------------------------------------------------------------------------*/", <add> " if(!pairN) lumaNN = lumaSS;", <add> " FxaaFloat gradientScaled = gradient * 1.0/4.0;", <add> " FxaaFloat lumaMM = lumaM - lumaNN * 0.5;", <add> " FxaaFloat subpixF = subpixD * subpixE;", <add> " FxaaBool lumaMLTZero = lumaMM < 0.0;", <add> "/*--------------------------------------------------------------------------*/", <add> " lumaEndN -= lumaNN * 0.5;", <add> " lumaEndP -= lumaNN * 0.5;", <add> " FxaaBool doneN = abs(lumaEndN) >= gradientScaled;", <add> " FxaaBool doneP = abs(lumaEndP) >= gradientScaled;", <add> " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;", <add> " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;", <add> " FxaaBool doneNP = (!doneN) || (!doneP);", <add> " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;", <add> " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;", <add> "/*--------------------------------------------------------------------------*/", <add> " if(doneNP) {", <add> " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", <add> " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", <add> " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", <add> " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", <add> " doneN = abs(lumaEndN) >= gradientScaled;", <add> " doneP = abs(lumaEndP) >= gradientScaled;", <add> " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;", <add> " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;", <add> " doneNP = (!doneN) || (!doneP);", <add> " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;", <add> " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;", <add> "/*--------------------------------------------------------------------------*/", <add> " #if (FXAA_QUALITY_PS > 3)", <add> " if(doneNP) {", <add> " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", <add> " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", <add> " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", <add> " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", <add> " doneN = abs(lumaEndN) >= gradientScaled;", <add> " doneP = abs(lumaEndP) >= gradientScaled;", <add> " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;", <add> " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;", <add> " doneNP = (!doneN) || (!doneP);", <add> " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;", <add> " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;", <add> "/*--------------------------------------------------------------------------*/", <add> " #if (FXAA_QUALITY_PS > 4)", <add> " if(doneNP) {", <add> " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", <add> " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", <add> " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", <add> " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", <add> " doneN = abs(lumaEndN) >= gradientScaled;", <add> " doneP = abs(lumaEndP) >= gradientScaled;", <add> " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;", <add> " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;", <add> " doneNP = (!doneN) || (!doneP);", <add> " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;", <add> " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;", <add> "/*--------------------------------------------------------------------------*/", <add> " #if (FXAA_QUALITY_PS > 5)", <add> " if(doneNP) {", <add> " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", <add> " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", <add> " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", <add> " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", <add> " doneN = abs(lumaEndN) >= gradientScaled;", <add> " doneP = abs(lumaEndP) >= gradientScaled;", <add> " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;", <add> " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;", <add> " doneNP = (!doneN) || (!doneP);", <add> " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;", <add> " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;", <add> "/*--------------------------------------------------------------------------*/", <add> " #if (FXAA_QUALITY_PS > 6)", <add> " if(doneNP) {", <add> " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", <add> " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", <add> " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", <add> " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", <add> " doneN = abs(lumaEndN) >= gradientScaled;", <add> " doneP = abs(lumaEndP) >= gradientScaled;", <add> " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;", <add> " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;", <add> " doneNP = (!doneN) || (!doneP);", <add> " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;", <add> " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;", <add> "/*--------------------------------------------------------------------------*/", <add> " #if (FXAA_QUALITY_PS > 7)", <add> " if(doneNP) {", <add> " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", <add> " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", <add> " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", <add> " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", <add> " doneN = abs(lumaEndN) >= gradientScaled;", <add> " doneP = abs(lumaEndP) >= gradientScaled;", <add> " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;", <add> " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;", <add> " doneNP = (!doneN) || (!doneP);", <add> " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;", <add> " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;", <add> "/*--------------------------------------------------------------------------*/", <add> " #if (FXAA_QUALITY_PS > 8)", <add> " if(doneNP) {", <add> " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", <add> " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", <add> " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", <add> " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", <add> " doneN = abs(lumaEndN) >= gradientScaled;", <add> " doneP = abs(lumaEndP) >= gradientScaled;", <add> " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;", <add> " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;", <add> " doneNP = (!doneN) || (!doneP);", <add> " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;", <add> " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;", <add> "/*--------------------------------------------------------------------------*/", <add> " #if (FXAA_QUALITY_PS > 9)", <add> " if(doneNP) {", <add> " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", <add> " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", <add> " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", <add> " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", <add> " doneN = abs(lumaEndN) >= gradientScaled;", <add> " doneP = abs(lumaEndP) >= gradientScaled;", <add> " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;", <add> " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;", <add> " doneNP = (!doneN) || (!doneP);", <add> " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;", <add> " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;", <add> "/*--------------------------------------------------------------------------*/", <add> " #if (FXAA_QUALITY_PS > 10)", <add> " if(doneNP) {", <add> " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", <add> " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", <add> " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", <add> " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", <add> " doneN = abs(lumaEndN) >= gradientScaled;", <add> " doneP = abs(lumaEndP) >= gradientScaled;", <add> " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;", <add> " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;", <add> " doneNP = (!doneN) || (!doneP);", <add> " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;", <add> " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;", <add> "/*--------------------------------------------------------------------------*/", <add> " #if (FXAA_QUALITY_PS > 11)", <add> " if(doneNP) {", <add> " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", <add> " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", <add> " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", <add> " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", <add> " doneN = abs(lumaEndN) >= gradientScaled;", <add> " doneP = abs(lumaEndP) >= gradientScaled;", <add> " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;", <add> " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;", <add> " doneNP = (!doneN) || (!doneP);", <add> " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;", <add> " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;", <add> "/*--------------------------------------------------------------------------*/", <add> " #if (FXAA_QUALITY_PS > 12)", <add> " if(doneNP) {", <add> " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", <add> " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", <add> " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", <add> " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", <add> " doneN = abs(lumaEndN) >= gradientScaled;", <add> " doneP = abs(lumaEndP) >= gradientScaled;", <add> " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;", <add> " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;", <add> " doneNP = (!doneN) || (!doneP);", <add> " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;", <add> " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;", <add> "/*--------------------------------------------------------------------------*/", <add> " }", <add> " #endif", <add> "/*--------------------------------------------------------------------------*/", <add> " }", <add> " #endif", <add> "/*--------------------------------------------------------------------------*/", <add> " }", <add> " #endif", <add> "/*--------------------------------------------------------------------------*/", <add> " }", <add> " #endif", <add> "/*--------------------------------------------------------------------------*/", <add> " }", <add> " #endif", <add> "/*--------------------------------------------------------------------------*/", <add> " }", <add> " #endif", <add> "/*--------------------------------------------------------------------------*/", <add> " }", <add> " #endif", <add> "/*--------------------------------------------------------------------------*/", <add> " }", <add> " #endif", <add> "/*--------------------------------------------------------------------------*/", <add> " }", <add> " #endif", <add> "/*--------------------------------------------------------------------------*/", <add> " }", <add> " #endif", <add> "/*--------------------------------------------------------------------------*/", <add> " }", <add> "/*--------------------------------------------------------------------------*/", <add> " FxaaFloat dstN = posM.x - posN.x;", <add> " FxaaFloat dstP = posP.x - posM.x;", <add> " if(!horzSpan) dstN = posM.y - posN.y;", <add> " if(!horzSpan) dstP = posP.y - posM.y;", <add> "/*--------------------------------------------------------------------------*/", <add> " FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;", <add> " FxaaFloat spanLength = (dstP + dstN);", <add> " FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;", <add> " FxaaFloat spanLengthRcp = 1.0/spanLength;", <add> "/*--------------------------------------------------------------------------*/", <add> " FxaaBool directionN = dstN < dstP;", <add> " FxaaFloat dst = min(dstN, dstP);", <add> " FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;", <add> " FxaaFloat subpixG = subpixF * subpixF;", <add> " FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;", <add> " FxaaFloat subpixH = subpixG * fxaaQualitySubpix;", <add> "/*--------------------------------------------------------------------------*/", <add> " FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;", <add> " FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);", <add> " if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;", <add> " if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;", <add> " #if (FXAA_DISCARD == 1)", <add> " return FxaaTexTop(tex, posM);", <add> " #else", <add> " return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);", <add> " #endif", <add> "}", <add> "/*==========================================================================*/", <add> "#endif", <add> "", <add> "void main() {", <add> " gl_FragColor = FxaaPixelShader(", <add> " vUv,", <add> " vec4(0.0),", <add> " tDiffuse,", <add> " tDiffuse,", <add> " tDiffuse,", <add> " resolution,", <add> " vec4(0.0),", <add> " vec4(0.0),", <add> " vec4(0.0),", <add> " 0.75,", <add> " 0.166,", <add> " 0.0833,", <add> " 0.0,", <add> " 0.0,", <add> " 0.0,", <add> " vec4(0.0)", <add> " );", <add> "", <add> " // TODO avoid querying texture twice for same texel", <add> " gl_FragColor.a = texture2D(tDiffuse, vUv).a;", <add> "}" <add> ].join("\n") <ide> <ide> };
1
PHP
PHP
simplify exception handler
35acc5408c4b6ad73c95f3bb5780232a5be735d5
<ide><path>app/Exceptions/Handler.php <ide> public function report(Exception $e) <ide> */ <ide> public function render($request, Exception $e) <ide> { <del> if ($this->isHttpException($e)) <del> { <del> return $this->renderHttpException($e); <del> } <del> else <del> { <del> return parent::render($request, $e); <del> } <add> return parent::render($request, $e); <ide> } <ide> <ide> }
1
Text
Text
update docs with details for cached images
79314ef5d882940a8042d3c718d47488a8b7e72f
<ide><path>docs/basic-features/image-optimization.md <ide> module.exports = { <ide> The following Image Optimization cloud providers are supported: <ide> <ide> - When using `next start` or a custom server image optimization works automatically. <del>- [Vercel](https://vercel.com): Works automatically when you deploy on Vercel <add>- [Vercel](https://vercel.com): Works automatically when you deploy on Vercel, no configuration necessary. <ide> - [Imgix](https://www.imgix.com): `loader: 'imgix'` <ide> - [Cloudinary](https://cloudinary.com): `loader: 'cloudinary'` <ide> - [Akamai](https://www.akamai.com): `loader: 'akamai'` <ide> <add>## Caching <add> <add>The following describes the caching algorithm for the default [loader](#loader). For all other loaders, please refer to your cloud provider's documentation. <add> <add>Images are optimized dynamically upon request and stored in the `<distDir>/cache/images` directory. The optimized image file will be served for subsequent requests until the expiration is reached. When a request is made that matches a cached but expired file, the cached file is deleted before generating a new optimized image and caching the new file. <add> <add>The expiration (or rather Max Age) is defined by the upstream server's `Cache-Control` header. <add> <add>If `s-maxage` is found in `Cache-Control`, it is used. If no `s-maxage` is found, then `max-age` is used. If no `max-age` is found, then 60 seconds is used. <add> <add>You can configure [`deviceSizes`](#device-sizes) to reduce the total number of possible generated images. <add> <ide> ## Related <ide> <ide> For more information on what to do next, we recommend the following sections:
1
Python
Python
update affected tests
74cc72311ddce0ae3f3794e85add9b20254940b1
<ide><path>libcloud/test/compute/test_openstack.py <ide> def test_list_sizes(self): <ide> self.assertEqual(len(sizes), 8, 'Wrong sizes count') <ide> <ide> for size in sizes: <del> self.assertTrue(isinstance(size.price, float), <add> self.assertTrue(size.price is None or isinstance(size.price, float), <ide> 'Wrong size price type') <ide> self.assertTrue(isinstance(size.ram, int)) <ide> self.assertTrue(isinstance(size.vcpus, int))
1
Text
Text
add homebrew-mode to editor plugins
9bd3e1eeab2b0942746b56e810764c0821666579
<ide><path>share/doc/homebrew/Tips-N'-Tricks.md <ide> export HOMEBREW_NO_EMOJI=1 <ide> <ide> This sets the HOMEBREW_NO_EMOJI environment variable, causing homebrew to hide all emoji. <ide> <del>## Sublime text: Syntax for formulae including the diff <add>## Editor plugins <ide> <del>In Sublime Text 2/3, you can use Package Control to install [Homebrew-formula-syntax](https://github.com/samueljohn/Homebrew-formula-syntax). <add>### Sublime Text <ide> <del>## Vim Syntax for formulae including the diff <add>In Sublime Text 2/3, you can use Package Control to install <add>[Homebrew-formula-syntax](https://github.com/samueljohn/Homebrew-formula-syntax), <add>which adds highlighting for inline patches. <ide> <del>If you are vim user, you can install [brew.vim](https://github.com/xu-cheng/brew.vim) plugin. <add>### Vim <add> <add>[brew.vim](https://github.com/xu-cheng/brew.vim) adds highlighting to <add>inline patches in Vim. <add> <add>### Emacs <add> <add>[homebrew-mode](https://github.com/dunn/homebrew-mode) provides syntax <add>highlighting for inline patches as well as a number of helper functions <add>for editing formula files.
1
Mixed
Javascript
add wrap attribute
1b5bfb516a90df615cd2bdcab1d7ed5c67e5e62d
<ide><path>docs/docs/ref-04-tags-and-attributes.md <ide> maxLength media mediaGroup method min multiple muted name noValidate open <ide> optimum pattern placeholder poster preload radioGroup readOnly rel required role <ide> rowSpan rows sandbox scope scoped scrolling seamless selected shape size sizes <ide> span spellCheck src srcDoc srcSet start step style tabIndex target title type <del>useMap value width wmode <add>useMap value width wmode wrap <ide> ``` <ide> <ide> In addition, the following non-standard attributes are supported: <ide><path>src/renderers/dom/shared/HTMLDOMPropertyConfig.js <ide> var HTMLDOMPropertyConfig = { <ide> value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS, <ide> width: MUST_USE_ATTRIBUTE, <ide> wmode: MUST_USE_ATTRIBUTE, <add> wrap: null, <ide> <ide> /** <ide> * Non-standard Properties
2
PHP
PHP
simplify constructor logic
62e68d0163cc61015d24175e0145282388f87d97
<ide><path>lib/Cake/ORM/ResultSet.php <ide> class ResultSet implements Iterator { <ide> */ <ide> protected $_defaultTable; <ide> <del>/** <del> * Default table alias <del> * <del> * @var string <del> */ <del> protected $_defaultAlias; <del> <ide> /** <ide> * List of associations that should be eager loaded <ide> * <ide> public function __construct($query, $statement) { <ide> $this->_query = $query; <ide> $this->_statement = $statement; <ide> $this->_defaultTable = $this->_query->repository(); <del> $this->_defaultAlias = $this->_defaultTable->alias(); <ide> $this->_calculateAssociationMap(); <ide> } <ide> <ide> protected function _fetchResult() { <ide> * @return array <ide> */ <ide> protected function _groupResult() { <add> $defaultAlias = $this->_defaultTable->alias(); <ide> $results = []; <ide> foreach ($this->_current as $key => $value) { <del> $table = $this->_defaultAlias; <add> $table = $defaultAlias; <ide> $field = $key; <ide> <ide> if (empty($this->_map[$key])) { <ide> protected function _groupResult() { <ide> $results[$table][$field] = $value; <ide> } <ide> <del> $results[$this->_defaultAlias] = $this->_castValues( <add> $results[$defaultAlias] = $this->_castValues( <ide> $this->_defaultTable, <del> $results[$this->_defaultAlias] <add> $results[$defaultAlias] <ide> ); <ide> <ide> foreach (array_reverse($this->_associationMap) as $alias => $assoc) { <ide> protected function _groupResult() { <ide> $results = $assoc->transformRow($results); <ide> } <ide> <del> return $results[$this->_defaultAlias]; <add> return $results[$defaultAlias]; <ide> } <ide> <ide> /** <ide> protected function _castValues($table, $values) { <ide> <ide> return $values; <ide> } <add> <ide> }
1
PHP
PHP
fix failing test
32f5b6f191dc18273a71e83ad54b19c61b7b4125
<ide><path>lib/Cake/Test/Case/Utility/ValidationTest.php <ide> public function testInList() { <ide> $this->assertTrue(Validation::inList('one', array('one', 'two'))); <ide> $this->assertTrue(Validation::inList('two', array('one', 'two'))); <ide> $this->assertFalse(Validation::inList('three', array('one', 'two'))); <del> $this->assertFalse(Validation::inList('one', '1one', array(0, 1, 2, 3))); <add> $this->assertFalse(Validation::inList('1one', array(0, 1, 2, 3))); <add> $this->assertFalse(Validation::inList('one', array(0, 1, 2, 3))); <ide> } <ide> <ide> /**
1
Javascript
Javascript
add my ip to showcase
d1dbe2dfa62dbe9da6db7383cf438765661841ea
<ide><path>website/src/react-native/showcase.js <ide> var apps = [ <ide> link: 'https://itunes.apple.com/us/app/mr.-dapper-men-fashion-app/id989735184?ls=1&mt=8', <ide> author: 'wei ping woon', <ide> }, <add> { <add> name: 'My IP', <add> icon: 'http://a3.mzstatic.com/us/r30/Purple69/v4/a2/61/58/a261584d-a4cd-cbfa-cf9d-b5f1f15a7139/icon175x175.jpeg', <add> link: 'https://itunes.apple.com/app/id1031729525?mt=8&at=11l7ss&ct=reactnativeshowcase', <add> author: 'Josh Buchea', <add> } <ide> { <ide> name: 'MyPED', <ide> icon: 'http://a2.mzstatic.com/eu/r30/Purple69/v4/88/1f/fb/881ffb3b-7986-d427-7fcf-eb5920a883af/icon175x175.png',
1
Javascript
Javascript
remove unnecessary existing check for `ember`
a24529e4742d45ffee624f2b6ddf2937c512b228
<ide><path>packages/ember-debug/lib/main.js <ide> Ember.debug = function(message) { <ide> will be displayed. <ide> */ <ide> Ember.deprecate = function(message, test) { <del> if (Ember && Ember.TESTING_DEPRECATION) { return; } <add> if (Ember.TESTING_DEPRECATION) { return; } <ide> <ide> if (arguments.length === 1) { test = false; } <ide> if (test) { return; } <ide> <del> if (Ember && Ember.ENV.RAISE_ON_DEPRECATION) { throw new Error(message); } <add> if (Ember.ENV.RAISE_ON_DEPRECATION) { throw new Error(message); } <ide> <ide> var error; <ide>
1
Go
Go
add integration test for xz path issue
0e9a7bc3cea20db258176b6f923c2b9cd009334f
<ide><path>integration-cli/docker_cli_build_test.go <ide> func TestBuildSymlinkBreakout(t *testing.T) { <ide> } <ide> logDone("build - symlink breakout") <ide> } <add> <add>func TestBuildXZHost(t *testing.T) { <add> name := "testbuildxzhost" <add> defer deleteImages(name) <add> <add> ctx, err := fakeContext(` <add>FROM busybox <add>ADD xz /usr/local/sbin/ <add>RUN chmod 755 /usr/local/sbin/xz <add>ADD test.xz / <add>RUN [ ! -e /injected ]`, <add> map[string]string{ <add> "test.xz": "\xfd\x37\x7a\x58\x5a\x00\x00\x04\xe6\xd6\xb4\x46\x02\x00" + <add> "\x21\x01\x16\x00\x00\x00\x74\x2f\xe5\xa3\x01\x00\x3f\xfd" + <add> "\x37\x7a\x58\x5a\x00\x00\x04\xe6\xd6\xb4\x46\x02\x00\x21", <add> "xz": "#!/bin/sh\ntouch /injected", <add> }) <add> <add> if err != nil { <add> t.Fatal(err) <add> } <add> defer ctx.Close() <add> <add> if _, err := buildImageFromContext(name, ctx, true); err != nil { <add> t.Fatal(err) <add> } <add> <add> logDone("build - xz host is being used") <add>}
1
Javascript
Javascript
use reference count rather than owner id
364bf941ca7efbb223d75932484242d8b5c8bc71
<ide><path>d3.js <ide> function d3_transition(groups, id) { <ide> node = this, <ide> delay = groups[j][i].delay, <ide> duration = groups[j][i].duration, <del> lock = node.__transition__; <add> lock = node.__transition__ || (node.__transition__ = {active: 0, count: 0}); <add> <add> ++lock.count; <ide> <del> if (!lock) lock = node.__transition__ = {active: 0, owner: id}; <del> else if (lock.owner < id) lock.owner = id; <ide> delay <= elapsed ? start() : d3.timer(start, delay, then); <ide> <ide> function start() { <del> if (lock.active <= id) { <del> lock.active = id; <del> event.start.dispatch.call(node, d, i); <del> <del> for (var tween in tweens) { <del> if (tween = tweens[tween].call(node, d, i)) { <del> tweened.push(tween); <del> } <del> } <add> if (lock.active > id) return stop(); <add> lock.active = id; <ide> <del> d3.timer(tick, 0, then); <add> for (var tween in tweens) { <add> if (tween = tweens[tween].call(node, d, i)) { <add> tweened.push(tween); <add> } <ide> } <del> return true; <add> <add> event.start.dispatch.call(node, d, i); <add> d3.timer(tick, 0, then); <add> return 1; <ide> } <ide> <ide> function tick(elapsed) { <del> if (lock.active !== id) return true; <add> if (lock.active !== id) return stop(); <ide> <ide> var t = Math.min(1, (elapsed - delay) / duration), <ide> e = ease(t), <ide> n = tweened.length; <ide> <del> while (--n >= 0) { <del> tweened[n].call(node, e); <add> while (n > 0) { <add> tweened[--n].call(node, e); <ide> } <ide> <ide> if (t === 1) { <del> lock.active = 0; <del> if (lock.owner === id) delete node.__transition__; <add> stop(); <ide> d3_transitionInheritId = id; <ide> event.end.dispatch.call(node, d, i); <ide> d3_transitionInheritId = 0; <del> return true; <add> return 1; <ide> } <ide> } <add> <add> function stop() { <add> if (!--lock.count) delete node.__transition__; <add> return 1; <add> } <ide> }); <del> return true; <add> return 1; <ide> }, 0, then); <ide> <ide> return groups; <ide><path>d3.min.js <del>(function(){function dl(a,b,c){function i(a,b){var c=a.__domain||(a.__domain=a.domain()),d=a.range().map(function(a){return(a-b)/h});a.domain(c).domain(d.map(a.invert))}var d=Math.pow(2,(c$[2]=a)-c[2]),e=c$[0]=b[0]-d*c[0],f=c$[1]=b[1]-d*c[1],g=d3.event,h=Math.pow(2,a);d3.event={scale:h,translate:[e,f],transform:function(a,b){a&&i(a,e),b&&i(b,f)}};try{c_.apply(da,db)}finally{d3.event=g}g.preventDefault()}function dk(){dd&&(d3.event.stopPropagation(),d3.event.preventDefault(),dd=!1)}function dj(){cW&&(dc&&(dd=!0),di(),cW=null)}function di(){cX=null,cW&&(dc=!0,dl(c$[2],d3.svg.mouse(da),cW))}function dh(){var a=d3.svg.touches(da);switch(a.length){case 1:var b=a[0];dl(c$[2],b,cY[b.identifier]);break;case 2:var c=a[0],d=a[1],e=[(c[0]+d[0])/2,(c[1]+d[1])/2],f=cY[c.identifier],g=cY[d.identifier],h=[(f[0]+g[0])/2,(f[1]+g[1])/2,f[2]];dl(Math.log(d3.event.scale)/Math.LN2+f[2],e,h)}}function dg(){var a=d3.svg.touches(da),b=-1,c=a.length,d;while(++b<c)cY[(d=a[b]).identifier]=de(d);return a}function df(){cV||(cV=d3.select("body").append("div").style("visibility","hidden").style("top",0).style("height",0).style("width",0).style("overflow-y","scroll").append("div").style("height","2000px").node().parentNode);var a=d3.event,b;try{cV.scrollTop=1e3,cV.dispatchEvent(a),b=1e3-cV.scrollTop}catch(c){b=a.wheelDelta||-a.detail}return b*.005}function de(a){return[a[0]-c$[0],a[1]-c$[1],c$[2]]}function cU(){d3.event.stopPropagation(),d3.event.preventDefault()}function cT(){cO&&(cU(),cO=!1)}function cS(){!cK||(cP("dragend"),cK=null,cN&&(cO=!0,cU()))}function cR(){if(!!cK){var a=cK.parentNode;if(!a)return cS();cP("drag"),cU()}}function cQ(a){return d3.event.touches?d3.svg.touches(a)[0]:d3.svg.mouse(a)}function cP(a){var b=d3.event,c=cK.parentNode,d=0,e=0;c&&(c=cQ(c),d=c[0]-cM[0],e=c[1]-cM[1],cM=c,cN|=d|e);try{d3.event={dx:d,dy:e},cJ[a].dispatch.apply(cK,cL)}finally{d3.event=b}b.preventDefault()}function cI(a,b,c){e=[];if(c&&b.length>1){var d=bm(a.domain()),e,f=-1,g=b.length,h=(b[1]-b[0])/++c,i,j;while(++f<g)for(i=c;--i>0;)(j=+b[f]-i*h)>=d[0]&&e.push(j);for(--f,i=0;++i<c&&(j=+b[f]+i*h)<d[1];)e.push(j)}return e}function cH(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function cG(a,b){a.attr("transform",function(a){return"translate("+b(a)+",0)"})}function cC(){return"circle"}function cB(){return 64}function cA(a,b){var c=(a.ownerSVGElement||a).createSVGPoint();if(cz<0&&(window.scrollX||window.scrollY)){var d=d3.select(document.body).append("svg:svg").style("position","absolute").style("top",0).style("left",0),e=d[0][0].getScreenCTM();cz=!e.f&&!e.e,d.remove()}cz?(c.x=b.pageX,c.y=b.pageY):(c.x=b.clientX,c.y=b.clientY),c=c.matrixTransform(a.getScreenCTM().inverse());return[c.x,c.y]}function cy(a){return function(){var b=a.apply(this,arguments),c=b[0],d=b[1]+bK;return[c*Math.cos(d),c*Math.sin(d)]}}function cx(a){return[a.x,a.y]}function cw(a){return a.endAngle}function cv(a){return a.startAngle}function cu(a){return a.radius}function ct(a){return a.target}function cs(a){return a.source}function cr(a){return function(b,c){return a[c][1]}}function cq(a){return function(b,c){return a[c][0]}}function cp(a){function i(f){if(f.length<1)return null;var i=bR(this,f,b,d),j=bR(this,f,b===c?cq(i):c,d===e?cr(i):e);return"M"+g(a(j),h)+"L"+g(a(i.reverse()),h)+"Z"}var b=bS,c=bS,d=0,e=bT,f="linear",g=bU[f],h=.7;i.x=function(a){if(!arguments.length)return c;b=c=a;return i},i.x0=function(a){if(!arguments.length)return b;b=a;return i},i.x1=function(a){if(!arguments.length)return c;c=a;return i},i.y=function(a){if(!arguments.length)return e;d=e=a;return i},i.y0=function(a){if(!arguments.length)return d;d=a;return i},i.y1=function(a){if(!arguments.length)return e;e=a;return i},i.interpolate=function(a){if(!arguments.length)return f;g=bU[f=a];return i},i.tension=function(a){if(!arguments.length)return h;h=a;return i};return i}function co(a){var b,c=-1,d=a.length,e,f;while(++c<d)b=a[c],e=b[0],f=b[1]+bK,b[0]=e*Math.cos(f),b[1]=e*Math.sin(f);return a}function cn(a){return a.length<3?bV(a):a[0]+b_(a,cm(a))}function cm(a){var b=[],c,d,e,f,g=cl(a),h=-1,i=a.length-1;while(++h<i)c=ck(a[h],a[h+1]),Math.abs(c)<1e-6?g[h]=g[h+1]=0:(d=g[h]/c,e=g[h+1]/c,f=d*d+e*e,f>9&&(f=c*3/Math.sqrt(f),g[h]=f*d,g[h+1]=f*e));h=-1;while(++h<=i)f=(a[Math.min(i,h+1)][0]-a[Math.max(0,h-1)][0])/(6*(1+g[h]*g[h])),b.push([f||0,g[h]*f||0]);return b}function cl(a){var b=0,c=a.length-1,d=[],e=a[0],f=a[1],g=d[0]=ck(e,f);while(++b<c)d[b]=g+(g=ck(e=f,f=a[b+1]));d[b]=g;return d}function ck(a,b){return(b[1]-a[1])/(b[0]-a[0])}function cj(a,b,c){a.push("C",cf(cg,b),",",cf(cg,c),",",cf(ch,b),",",cf(ch,c),",",cf(ci,b),",",cf(ci,c))}function cf(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function ce(a,b){var c=a.length-1,d=a[0][0],e=a[0][1],f=a[c][0]-d,g=a[c][1]-e,h=-1,i,j;while(++h<=c)i=a[h],j=h/c,i[0]=b*i[0]+(1-b)*(d+j*f),i[1]=b*i[1]+(1-b)*(e+j*g);return cb(a)}function cd(a){var b,c=-1,d=a.length,e=d+4,f,g=[],h=[];while(++c<4)f=a[c%d],g.push(f[0]),h.push(f[1]);b=[cf(ci,g),",",cf(ci,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),cj(b,g,h);return b.join("")}function cc(a){if(a.length<4)return bV(a);var b=[],c=-1,d=a.length,e,f=[0],g=[0];while(++c<3)e=a[c],f.push(e[0]),g.push(e[1]);b.push(cf(ci,f)+","+cf(ci,g)),--c;while(++c<d)e=a[c],f.shift(),f.push(e[0]),g.shift(),g.push(e[1]),cj(b,f,g);return b.join("")}function cb(a){if(a.length<3)return bV(a);var b=[],c=1,d=a.length,e=a[0],f=e[0],g=e[1],h=[f,f,f,(e=a[1])[0]],i=[g,g,g,e[1]];b.push(f,",",g),cj(b,h,i);while(++c<d)e=a[c],h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),cj(b,h,i);c=-1;while(++c<2)h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),cj(b,h,i);return b.join("")}function ca(a,b){var c=[],d=(1-b)/2,e,f=a[0],g=a[1],h=1,i=a.length;while(++h<i)e=f,f=g,g=a[h],c.push([d*(g[0]-e[0]),d*(g[1]-e[1])]);return c}function b_(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return bV(a);var c=a.length!=b.length,d="",e=a[0],f=a[1],g=b[0],h=g,i=1;c&&(d+="Q"+(f[0]-g[0]*2/3)+","+(f[1]-g[1]*2/3)+","+f[0]+","+f[1],e=a[1],i=2);if(b.length>1){h=b[1],f=a[i],i++,d+="C"+(e[0]+g[0])+","+(e[1]+g[1])+","+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1];for(var j=2;j<b.length;j++,i++)f=a[i],h=b[j],d+="S"+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1]}if(c){var k=a[i];d+="Q"+(f[0]+h[0]*2/3)+","+(f[1]+h[1]*2/3)+","+k[0]+","+k[1]}return d}function b$(a,b,c){return a.length<3?bV(a):a[0]+b_(a,ca(a,b))}function bZ(a,b){return a.length<3?bV(a):a[0]+b_((a.push(a[0]),a),ca([a[a.length-2]].concat(a,[a[1]]),b))}function bY(a,b){return a.length<4?bV(a):a[1]+b_(a.slice(1,a.length-1),ca(a,b))}function bX(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("H",(e=a[c])[0],"V",e[1]);return b.join("")}function bW(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("V",(e=a[c])[1],"H",e[0]);return b.join("")}function bV(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("L",(e=a[c])[0],",",e[1]);return b.join("")}function bT(a){return a[1]}function bS(a){return a[0]}function bR(a,b,c,d){var e=[],f=-1,g=b.length,h=typeof c=="function",i=typeof d=="function",j;if(h&&i)while(++f<g)e.push([c.call(a,j=b[f],f),d.call(a,j,f)]);else if(h)while(++f<g)e.push([c.call(a,b[f],f),d]);else if(i)while(++f<g)e.push([c,d.call(a,b[f],f)]);else while(++f<g)e.push([c,d]);return e}function bQ(a){function g(d){return d.length<1?null:"M"+e(a(bR(this,d,b,c)),f)}var b=bS,c=bT,d="linear",e=bU[d],f=.7;g.x=function(a){if(!arguments.length)return b;b=a;return g},g.y=function(a){if(!arguments.length)return c;c=a;return g},g.interpolate=function(a){if(!arguments.length)return d;e=bU[d=a];return g},g.tension=function(a){if(!arguments.length)return f;f=a;return g};return g}function bP(a){return a.endAngle}function bO(a){return a.startAngle}function bN(a){return a.outerRadius}function bM(a){return a.innerRadius}function bJ(a,b,c){function g(){d=c.length/(b-a),e=c.length-1;return f}function f(b){return c[Math.max(0,Math.min(e,Math.floor(d*(b-a))))]}var d,e;f.domain=function(c){if(!arguments.length)return[a,b];a=+c[0],b=+c[c.length-1];return g()},f.range=function(a){if(!arguments.length)return c;c=a;return g()},f.copy=function(){return bJ(a,b,c)};return g()}function bI(a,b){function e(a){return isNaN(a=+a)?NaN:b[d3.bisect(c,a)]}function d(){var d=0,f=a.length,g=b.length;c=[];while(++d<g)c[d-1]=d3.quantile(a,d/g);return e}var c;e.domain=function(b){if(!arguments.length)return a;a=b.filter(function(a){return!isNaN(a)}).sort(d3.ascending);return d()},e.range=function(a){if(!arguments.length)return b;b=a;return d()},e.quantiles=function(){return c},e.copy=function(){return bI(a,b)};return d()}function bD(a,b,c){function f(c){return d[((a[c]||(a[c]=++b))-1)%d.length]}var d,e;f.domain=function(d){if(!arguments.length)return d3.keys(a);a={},b=0;var e=-1,g=d.length,h;while(++e<g)a[h=d[e]]||(a[h]=++b);return f[c.t](c.x,c.p)},f.range=function(a){if(!arguments.length)return d;d=a,e=0,c={t:"range",x:a};return f},f.rangePoints=function(a,g){arguments.length<2&&(g=0);var h=a[0],i=a[1],j=(i-h)/(b-1+g);d=b<2?[(h+i)/2]:d3.range(h+j*g/2,i+j/2,j),e=0,c={t:"rangePoints",x:a,p:g};return f},f.rangeBands=function(a,g){arguments.length<2&&(g=0);var h=a[0],i=a[1],j=(i-h)/(b+g);d=d3.range(h+j*g,i,j),e=j*(1-g),c={t:"rangeBands",x:a,p:g};return f},f.rangeRoundBands=function(a,g){arguments.length<2&&(g=0);var h=a[0],i=a[1],j=Math.floor((i-h)/(b+g)),k=i-h-(b-g)*j;d=d3.range(h+Math.round(k/2),i,j),e=Math.round(j*(1-g)),c={t:"rangeRoundBands",x:a,p:g};return f},f.rangeBand=function(){return e},f.copy=function(){var d={},e;for(e in a)d[e]=a[e];return bD(d,b,c)};return f[c.t](c.x,c.p)}function bC(a){return function(b){return b<0?-Math.pow(-b,a):Math.pow(b,a)}}function bB(a,b){function e(b){return a(c(b))}var c=bC(b),d=bC(1/b);e.invert=function(b){return d(a.invert(b))},e.domain=function(b){if(!arguments.length)return a.domain().map(d);a.domain(b.map(c));return e},e.ticks=function(a){return bt(e.domain(),a)},e.tickFormat=function(a){return bu(e.domain(),a)},e.nice=function(){return e.domain(bn(e.domain(),br))},e.exponent=function(a){if(!arguments.length)return b;var f=e.domain();c=bC(b=a),d=bC(1/b);return e.domain(f)},e.copy=function(){return bB(a.copy(),b)};return bq(e,a)}function bA(a){return a.toPrecision(1)}function bz(a){return-Math.log(-a)/Math.LN10}function by(a){return Math.log(a)/Math.LN10}function bx(a,b){function d(c){return a(b(c))}var c=b.pow;d.invert=function(b){return c(a.invert(b))},d.domain=function(e){if(!arguments.length)return a.domain().map(c);b=e[0]<0?bz:by,c=b.pow,a.domain(e.map(b));return d},d.nice=function(){a.domain(bn(a.domain(),bo));return d},d.ticks=function(){var d=bm(a.domain()),e=[];if(d.every(isFinite)){var f=Math.floor(d[0]),g=Math.ceil(d[1]),h=c(d[0]),i=c(d[1]);if(b===bz){e.push(c(f));for(;f++<g;)for(var j=9;j>0;j--)e.push(c(f)*j)}else{for(;f<g;f++)for(var j=1;j<10;j++)e.push(c(f)*j);e.push(c(f))}for(f=0;e[f]<h;f++);for(g=e.length;e[g-1]>i;g--);e=e.slice(f,g)}return e},d.tickFormat=function(){return bA},d.copy=function(){return bx(a.copy(),b)};return bq(d,a)}function bw(a,b,c,d){var e=[],f=[],g=0,h=a.length;while(++g<h)e.push(c(a[g-1],a[g])),f.push(d(b[g-1],b[g]));return function(b){var c=d3.bisect(a,b,1,a.length-1)-1;return f[c](e[c](b))}}function bv(a,b,c,d){var e=c(a[0],a[1]),f=d(b[0],b[1]);return function(a){return f(e(a))}}function bu(a,b){return d3.format(",."+Math.max(0,-Math.floor(Math.log(bs(a,b)[2])/Math.LN10+.01))+"f")}function bt(a,b){return d3.range.apply(d3,bs(a,b))}function bs(a,b){var c=bm(a),d=c[1]-c[0],e=Math.pow(10,Math.floor(Math.log(d/b)/Math.LN10)),f=b/d*e;f<=.15?e*=10:f<=.35?e*=5:f<=.75&&(e*=2),c[0]=Math.ceil(c[0]/e)*e,c[1]=Math.floor(c[1]/e)*e+e*.5,c[2]=e;return c}function br(a){a=Math.pow(10,Math.round(Math.log(a)/Math.LN10)-1);return{floor:function(b){return Math.floor(b/a)*a},ceil:function(b){return Math.ceil(b/a)*a}}}function bq(a,b){a.range=d3.rebind(a,b.range),a.rangeRound=d3.rebind(a,b.rangeRound),a.interpolate=d3.rebind(a,b.interpolate),a.clamp=d3.rebind(a,b.clamp);return a}function bp(a,b,c,d){function h(a){return e(a)}function g(){var g=a.length==2?bv:bw,i=d?D:C;e=g(a,b,i,c),f=g(b,a,i,d3.interpolate);return h}var e,f;h.invert=function(a){return f(a)},h.domain=function(b){if(!arguments.length)return a;a=b.map(Number);return g()},h.range=function(a){if(!arguments.length)return b;b=a;return g()},h.rangeRound=function(a){return h.range(a).interpolate(d3.interpolateRound)},h.clamp=function(a){if(!arguments.length)return d;d=a;return g()},h.interpolate=function(a){if(!arguments.length)return c;c=a;return g()},h.ticks=function(b){return bt(a,b)},h.tickFormat=function(b){return bu(a,b)},h.nice=function(){bn(a,br);return g()},h.copy=function(){return bp(a,b,c,d)};return g()}function bo(){return Math}function bn(a,b){var c=0,d=a.length-1,e=a[c],f=a[d],g;f<e&&(g=c,c=d,d=g,g=e,e=f,f=g),b=b(f-e),a[c]=b.floor(e),a[d]=b.ceil(f);return a}function bm(a){var b=a[0],c=a[a.length-1];return b<c?[b,c]:[c,b]}function bl(){}function bj(){var a=null,b=bf,c=Infinity;while(b)b.flush?b=a?a.next=b.next:bf=b.next:(c=Math.min(c,b.then+b.delay),b=(a=b).next);return c}function bi(){var a,b=Date.now(),c=bf;while(c)a=b-c.then,a>=c.delay&&(c.flush=c.callback(a)),c=c.next;var d=bj()-b;d>24?(isFinite(d)&&(clearTimeout(bh),bh=setTimeout(bi,d)),bg=0):(bg=1,bk(bi))}function be(a){for(var b=0,c=this.length;b<c;b++)for(var d=this[b],e=0,f=d.length;e<f;e++){var g=d[e];g&&a.call(g=g.node,g.__data__,e,b)}return this}function _(a){return typeof a=="function"?function(b,c,d){var e=a.call(this,b,c)+"";return d!=e&&d3.interpolate(d,e)}:(a=a+"",function(b,c,d){return d!=a&&d3.interpolate(d,a)})}function $(b,c){a(b,ba);var d={},e=d3.dispatch("start","end"),f=bd,g=Date.now();b.id=c,b.tween=function(a,c){if(arguments.length<2)return d[a];c==null?delete d[a]:d[a]=c;return b},b.ease=function(a){if(!arguments.length)return f;f=typeof a=="function"?a:d3.ease.apply(d3,arguments);return b},b.each=function(a,c){if(arguments.length<2)return be.call(b,a);e[a].add(c);return b},d3.timer(function(a){b.each(function(h,i,j){function q(a){if(o.active!==c)return!0;var b=Math.min(1,(a-m)/n),d=f(b),g=k.length;while(--g>=0)k[g].call(l,d);if(b===1){o.active=0,o.owner===c&&delete l.__transition__,bc=c,e.end.dispatch.call(l,h,i),bc=0;return!0}}function p(){if(o.active<=c){o.active=c,e.start.dispatch.call(l,h,i);for(var a in d)(a=d[a].call(l,h,i))&&k.push(a);d3.timer(q,0,g)}return!0}var k=[],l=this,m=b[j][i].delay,n=b[j][i].duration,o=l.__transition__;o?o.owner<c&&(o.owner=c):o=l.__transition__={active:0,owner:c},m<=a?p():d3.timer(p,m,g)});return!0},0,g);return b}function Z(a){arguments.length||(a=d3.ascending);return function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function X(b){a(b,Y);return b}function W(a){return{__data__:a}}function V(a){return function(){return R(a,this)}}function U(a){return function(){return Q(a,this)}}function P(b){a(b,S);return b}function O(a,b,c){function g(a){return Math.round(f(a)*255)}function f(a){a>360?a-=360:a<0&&(a+=360);return a<60?d+(e-d)*a/60:a<180?e:a<240?d+(e-d)*(240-a)/60:d}var d,e;a=a%360,a<0&&(a+=360),b=b<0?0:b>1?1:b,c=c<0?0:c>1?1:c,e=c<=.5?c*(1+b):c+b-c*b,d=2*c-e;return E(g(a+120),g(a),g(a-120))}function N(a,b,c){this.h=a,this.s=b,this.l=c}function M(a,b,c){return new N(a,b,c)}function J(a){var b=parseFloat(a);return a.charAt(a.length-1)==="%"?Math.round(b*2.55):b}function I(a,b,c){var d=Math.min(a/=255,b/=255,c/=255),e=Math.max(a,b,c),f=e-d,g,h,i=(e+d)/2;f?(h=i<.5?f/(e+d):f/(2-e-d),a==e?g=(b-c)/f+(b<c?6:0):b==e?g=(c-a)/f+2:g=(a-b)/f+4,g*=60):h=g=0;return M(g,h,i)}function H(a,b,c){var d=0,e=0,f=0,g,h,i;g=/([a-z]+)\((.*)\)/i.exec(a);if(g){h=g[2].split(",");switch(g[1]){case"hsl":return c(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case"rgb":return b(J(h[0]),J(h[1]),J(h[2]))}}if(i=K[a])return b(i.r,i.g,i.b);a!=null&&a.charAt(0)==="#"&&(a.length===4?(d=a.charAt(1),d+=d,e=a.charAt(2),e+=e,f=a.charAt(3),f+=f):a.length===7&&(d=a.substring(1,3),e=a.substring(3,5),f=a.substring(5,7)),d=parseInt(d,16),e=parseInt(e,16),f=parseInt(f,16));return b(d,e,f)}function G(a){return a<16?"0"+a.toString(16):a.toString(16)}function F(a,b,c){this.r=a,this.g=b,this.b=c}function E(a,b,c){return new F(a,b,c)}function D(a,b){b=b-(a=+a)?1/(b-a):0;return function(c){return Math.max(0,Math.min(1,(c-a)*b))}}function C(a,b){b=b-(a=+a)?1/(b-a):0;return function(c){return(c-a)*b}}function B(a){return a in A||/\bcolor\b/.test(a)?d3.interpolateRgb:d3.interpolate}function y(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}function x(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}}function w(a,b){var c;arguments.length<2&&(b=.45),arguments.length<1?(a=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/a);return function(d){return 1+a*Math.pow(2,10*-d)*Math.sin((d-c)*2*Math.PI/b)}}function v(a){return 1-Math.sqrt(1-a*a)}function u(a){return Math.pow(2,10*(a-1))}function t(a){return 1-Math.cos(a*Math.PI/2)}function s(a){return function(b){return Math.pow(b,a)}}function r(a){return a}function q(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function p(a){return function(b){return 1-a(1-b)}}function k(a){var b=a.lastIndexOf("."),c=b>=0?a.substring(b):(b=a.length,""),d=[];while(b>0)d.push(a.substring(b-=3,b+3));return d.reverse().join(",")+c}function j(a){return a+""}function g(a){var b={},c=[];b.add=function(a){for(var d=0;d<c.length;d++)if(c[d].listener==a)return b;c.push({listener:a,on:!0});return b},b.remove=function(a){for(var d=0;d<c.length;d++){var e=c[d];if(e.listener==a){e.on=!1,c=c.slice(0,d).concat(c.slice(d+1));break}}return b},b.dispatch=function(){var a=c;for(var b=0,d=a.length;b<d;b++){var e=a[b];e.on&&e.listener.apply(this,arguments)}};return b}function e(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function d(a){return a==null}function c(a){return a.length}function b(){return this}d3={version:"2.0.3"},Date.now||(Date.now=function(){return+(new Date)}),Object.create||(Object.create=function(a){function b(){}b.prototype=a;return new b});var a=[].__proto__?function(a,b){a.__proto__=b}:function(a,b){for(var c in b)a[c]=b[c]};d3.functor=function(a){return typeof a=="function"?a:function(){return a}},d3.rebind=function(a,b){return function(){var c=b.apply(a,arguments);return arguments.length?a:c}},d3.ascending=function(a,b){return a<b?-1:a>b?1:a>=b?0:NaN},d3.descending=function(a,b){return b<a?-1:b>a?1:b>=a?0:NaN},d3.min=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&e>f&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&e>f&&(e=f)}return e},d3.max=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&f>e&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&f>e&&(e=f)}return e},d3.sum=function(a,b){var c=0,d=a.length,e,f=-1;if(arguments.length===1)while(++f<d)isNaN(e=+a[f])||(c+=e);else while(++f<d)isNaN(e=+b.call(a,a[f],f))||(c+=e);return c},d3.quantile=function(a,b){var c=(a.length-1)*b+1,d=Math.floor(c),e=a[d-1],f=c-d;return f?e+f*(a[d]-e):e},d3.zip=function(){if(!(f=arguments.length))return[];for(var a=-1,b=d3.min(arguments,c),d=Array(b);++a<b;)for(var e=-1,f,g=d[a]=Array(f);++e<f;)g[e]=arguments[e][a];return d},d3.bisectLeft=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;a[e]<b?c=e+1:d=e}return c},d3.bisect=d3.bisectRight=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;b<a[e]?d=e:c=e+1}return c},d3.first=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])>0&&(e=f);return e},d3.last=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])<=0&&(e=f);return e},d3.nest=function(){function g(a,d){if(d>=b.length)return a;var e=[],f=c[d++],h;for(h in a)e.push({key:h,values:g(a[h],d)});f&&e.sort(function(a,b){return f(a.key,b.key)});return e}function f(c,g){if(g>=b.length)return e?e.call(a,c):d?c.sort(d):c;var h=-1,i=c.length,j=b[g++],k,l,m={};while(++h<i)(k=j(l=c[h]))in m?m[k].push(l):m[k]=[l];for(k in m)m[k]=f(m[k],g);return m}var a={},b=[],c=[],d,e;a.map=function(a){return f(a,0)},a.entries=function(a){return g(f(a,0),0)},a.key=function(c){b.push(c);return a},a.sortKeys=function(d){c[b.length-1]=d;return a},a.sortValues=function(b){d=b;return a},a.rollup=function(b){e=b;return a};return a},d3.keys=function(a){var b=[];for(var c in a)b.push(c);return b},d3.values=function(a){var b=[];for(var c in a)b.push(a[c]);return b},d3.entries=function(a){var b=[];for(var c in a)b.push({key:c,value:a[c]});return b},d3.permute=function(a,b){var c=[],d=-1,e=b.length;while(++d<e)c[d]=a[b[d]];return c},d3.merge=function(a){return Array.prototype.concat.apply([],a)},d3.split=function(a,b){var c=[],e=[],f,g=-1,h=a.length;arguments.length<2&&(b=d);while(++g<h)b.call(e,f=a[g],g)?e=[]:(e.length||c.push(e),e.push(f));return c},d3.range=function(a,b,c){arguments.length<3&&(c=1,arguments.length<2&&(b=a,a=0));if((b-a)/c==Infinity)throw new Error("infinite range");var d=[],e=-1,f;if(c<0)while((f=a+c*++e)>b)d.push(f);else while((f=a+c*++e)<b)d.push(f);return d},d3.requote=function(a){return a.replace(f,"\\$&")};var f=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;d3.round=function(a,b){return b?Math.round(a*Math.pow(10,b))*Math.pow(10,-b):Math.round(a)},d3.xhr=function(a,b,c){var d=new XMLHttpRequest;arguments.length<3?c=b:b&&d.overrideMimeType&&d.overrideMimeType(b),d.open("GET",a,!0),d.onreadystatechange=function(){d.readyState===4&&c(d.status<300?d:null)},d.send(null)},d3.text=function(a,b,c){function d(a){c(a&&a.responseText)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.json=function(a,b){d3.text(a,"application/json",function(a){b(a?JSON.parse(a):null)})},d3.html=function(a,b){d3.text(a,"text/html",function(a){if(a!=null){var c=document.createRange();c.selectNode(document.body),a=c.createContextualFragment(a)}b(a)})},d3.xml=function(a,b,c){function d(a){c(a&&a.responseXML)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.ns={prefix:{svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},qualify:function(a){var b=a.indexOf(":");return b<0?a:{space:d3.ns.prefix[a.substring(0,b)],local:a.substring(b+1)}}},d3.dispatch=function(a){var b={},c;for(var d=0,e=arguments.length;d<e;d++)c=arguments[d],b[c]=g(c);return b},d3.format=function(a){var b=h.exec(a),c=b[1]||" ",d=b[3]||"",e=b[5],f=+b[6],g=b[7],l=b[8],m=b[9],n=!1,o=!1;l&&(l=l.substring(1)),e&&(c="0",g&&(f-=Math.floor((f-1)/4)));switch(m){case"n":g=!0,m="g";break;case"%":n=!0,m="f";break;case"p":n=!0,m="r";break;case"d":o=!0,l="0"}m=i[m]||j;return function(a){var b=n?a*100:+a,h=b<0&&(b=-b)?"−":d;if(o&&b%1)return"";a=m(b,l);if(e){var i=a.length+h.length;i<f&&(a=Array(f-i+1).join(c)+a),g&&(a=k(a)),a=h+a}else{g&&(a=k(a)),a=h+a;var i=a.length;i<f&&(a=Array(f-i+1).join(c)+a)}n&&(a+="%");return a}};var h=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,i={g:function(a,b){return a.toPrecision(b)},e:function(a,b){return a.toExponential(b)},f:function(a,b){return a.toFixed(b)},r:function(a,b){var c=1+Math.floor(1e-15+Math.log(a)/Math.LN10);return d3.round(a,b-c).toFixed(Math.max(0,Math.min(20,b-c)))}},l=s(2),m=s(3),n={linear:function(){return r},poly:s,quad:function(){return l},cubic:function(){return m},sin:function(){return t},exp:function(){return u},circle:function(){return v},elastic:w,back:x,bounce:function(){return y}},o={"in":function(a){return a},out:p,"in-out":q,"out-in":function(a){return q(p(a))}};d3.ease=function(a){var b=a.indexOf("-"),c=b>=0?a.substring(0,b):a,d=b>=0?a.substring(b+1):"in";return o[d](n[c].apply(null,Array.prototype.slice.call(arguments,1)))},d3.event=null,d3.interpolate=function(a,b){var c=d3.interpolators.length,d;while(--c>=0&&!(d=d3.interpolators[c](a,b)));return d},d3.interpolateNumber=function(a,b){b-=a;return function(c){return a+b*c}},d3.interpolateRound=function(a,b){b-=a;return function(c){return Math.round(a+b*c)}},d3.interpolateString=function(a,b){var c,d,e,f=0,g=0,h=[],i=[],j,k;z.lastIndex=0;for(d=0;c=z.exec(b);++d)c.index&&h.push(b.substring(f,g=c.index)),i.push({i:h.length,x:c[0]}),h.push(null),f=z.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=z.exec(a))&&d<j;++d){k=i[d];if(k.x==c[0]){if(k.i)if(h[k.i+1]==null){h[k.i-1]+=k.x,h.splice(k.i,1);for(e=d+1;e<j;++e)i[e].i--}else{h[k.i-1]+=k.x+h[k.i+1],h.splice(k.i,2);for(e=d+1;e<j;++e)i[e].i-=2}else if(h[k.i+1]==null)h[k.i]=k.x;else{h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1);for(e=d+1;e<j;++e)i[e].i--}i.splice(d,1),j--,d--}else k.x=d3.interpolateNumber(parseFloat(c[0]),parseFloat(k.x))}while(d<j)k=i.pop(),h[k.i+1]==null?h[k.i]=k.x:(h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1)),j--;return h.length===1?h[0]==null?i[0].x:function(){return b}:function(a){for(d=0;d<j;++d)h[(k=i[d]).i]=k.x(a);return h.join("")}},d3.interpolateRgb=function(a,b){a=d3.rgb(a),b=d3.rgb(b);var c=a.r,d=a.g,e=a.b,f=b.r-c,g=b.g-d,h=b.b-e;return function(a){return"rgb("+Math.round(c+f*a)+","+Math.round(d+g*a)+","+Math.round(e+h*a)+")"}},d3.interpolateHsl=function(a,b){a=d3.hsl(a),b=d3.hsl(b);var c=a.h,d=a.s,e=a.l,f=b.h-c,g=b.s-d,h=b.l-e;return function(a){return O(c+f*a,d+g*a,e+h*a).toString()}},d3.interpolateArray=function(a,b){var c=[],d=[],e=a.length,f=b.length,g=Math.min(a.length,b.length),h;for(h=0;h<g;++h)c.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)d[h]=a[h];for(;h<f;++h)d[h]=b[h];return function(a){for(h=0;h<g;++h)d[h]=c[h](a);return d}},d3.interpolateObject=function(a,b){var c={},d={},e;for(e in a)e in b?c[e]=B(e)(a[e],b[e]):d[e]=a[e];for(e in b)e in a||(d[e]=b[e]);return function(a){for(e in c)d[e]=c[e](a);return d}};var z=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,A={background:1,fill:1,stroke:1};d3.interpolators=[d3.interpolateObject,function(a,b){return b instanceof Array&&d3.interpolateArray(a,b)},function(a,b){return typeof b=="string"&&d3.interpolateString(String(a),b)},function(a,b){return(typeof b=="string"?b in K||/^(#|rgb\(|hsl\()/.test(b):b instanceof F||b instanceof N)&&d3.interpolateRgb(String(a),b)},function(a,b){return typeof b=="number"&&d3.interpolateNumber(+a,b)}],d3.rgb=function(a,b,c){return arguments.length===1?H(""+a,E,O):E(~~a,~~b,~~c)},F.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);var b=this.r,c=this.g,d=this.b,e=30;if(!b&&!c&&!d)return E(e,e,e);b&&b<e&&(b=e),c&&c<e&&(c=e),d&&d<e&&(d=e);return E(Math.min(255,Math.floor(b/a)),Math.min(255,Math.floor(c/a)),Math.min(255,Math.floor(d/a)))},F.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return E(Math.max(0,Math.floor(a*this.r)),Math.max(0,Math.floor(a*this.g)),Math.max(0,Math.floor(a*this.b)))},F.prototype.hsl=function(){return I(this.r,this.g,this.b)},F.prototype.toString=function(){return"#"+G(this.r)+G(this.g)+G(this.b)};var K={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};for(var L in K)K[L]=H(K[L],E,O);d3.hsl=function(a,b,c){return arguments.length===1?H(""+a,I,M):M(+a,+b,+c)},N.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);return M(this.h,this.s,this.l/a)},N.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return M(this.h,this.s,a*this.l)},N.prototype.rgb=function(){return O(this.h,this.s,this.l)},N.prototype.toString=function(){return"hsl("+this.h+","+this.s*100+"%,"+this.l*100+"%)"},d3.select=function(a){return typeof a=="string"?T.select(a):P([[a]])},d3.selectAll=function(a){return typeof a=="string"?T.selectAll(a):P([a])};var Q=function(a,b){return b.querySelector(a)},R=function(a,b){return b.querySelectorAll(a)};typeof Sizzle=="function"&&(Q=function(a,b){return Sizzle(a,b)[0]},R=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))});var S=[],T=P([[document]]);T[0].parentNode=document.documentElement,d3.selection=function(){return T},d3.selection.prototype=S,S.select=function(a){var b=[],c,d,e,f;typeof a!="function"&&(a=U(a));for(var g=-1,h=this.length;++g<h;){b.push(c=[]),c.parentNode=(e=this[g]).parentNode;for(var i=-1,j=e.length;++i<j;)(f=e[i])?(c.push(d=a.call(f,f.__data__,i)),d&&"__data__"in f&&(d.__data__=f.__data__)):c.push(null)}return P(b)},S.selectAll=function(a){var b=[],c,d;typeof a!="function"&&(a=V(a));for(var e=-1,f=this.length;++e<f;)for(var g=this[e],h=-1,i=g.length;++h<i;)if(d=g[h])b.push(c=a.call(d,d.__data__,h)),c.parentNode=d;return P(b)},S.attr=function(a,b){function i(){var c=b.apply(this,arguments);c==null?this.removeAttributeNS(a.space,a.local):this.setAttributeNS(a.space,a.local,c)}function h(){var c=b.apply(this,arguments);c==null?this.removeAttribute(a):this.setAttribute(a,c)}function g(){this.setAttributeNS(a.space,a.local,b)}function f(){this.setAttribute(a,b)}function e(){this.removeAttributeNS(a.space,a.local)}function d(){this.removeAttribute(a)}a=d3.ns.qualify(a);if(arguments.length<2){var c=this.node();return a.local?c.getAttributeNS(a.space,a.local):c.getAttribute(a)}return this.each(b==null?a.local?e:d:typeof b=="function"?a.local?i:h:a.local?g:f)},S.classed=function(a,b){function i(){(b.apply(this,arguments)?g:h).call(this)}function h(){if(b=this.classList)return b.remove(a);var b=this.className,d=b.baseVal!=null,f=d?b.baseVal:b;f=e(f.replace(c," ")),d?b.baseVal=f:this.className=f}function g(){if(b=this.classList)return b.add(a);var b=this.className,d=b.baseVal!=null,f=d?b.baseVal:b;c.lastIndex=0,c.test(f)||(f=e(f+" "+a),d?b.baseVal=f:this.className=f)}var c=new RegExp("(^|\\s+)"+d3.requote(a)+"(\\s+|$)","g");if(arguments.length<2){var d=this.node();if( <del>f=d.classList)return f.contains(a);var f=d.className;c.lastIndex=0;return c.test(f.baseVal!=null?f.baseVal:f)}return this.each(typeof b=="function"?i:b?g:h)},S.style=function(a,b,c){function f(){var d=b.apply(this,arguments);d==null?this.style.removeProperty(a):this.style.setProperty(a,d,c)}function e(){this.style.setProperty(a,b,c)}function d(){this.style.removeProperty(a)}arguments.length<3&&(c="");return arguments.length<2?window.getComputedStyle(this.node(),null).getPropertyValue(a):this.each(b==null?d:typeof b=="function"?f:e)},S.property=function(a,b){function e(){var c=b.apply(this,arguments);c==null?delete this[a]:this[a]=c}function d(){this[a]=b}function c(){delete this[a]}return arguments.length<2?this.node()[a]:this.each(b==null?c:typeof b=="function"?e:d)},S.text=function(a){return arguments.length<1?this.node().textContent:this.each(typeof a=="function"?function(){this.textContent=a.apply(this,arguments)}:function(){this.textContent=a})},S.html=function(a){return arguments.length<1?this.node().innerHTML:this.each(typeof a=="function"?function(){this.innerHTML=a.apply(this,arguments)}:function(){this.innerHTML=a})},S.append=function(a){function c(){return this.appendChild(document.createElementNS(a.space,a.local))}function b(){return this.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return this.select(a.local?c:b)},S.insert=function(a,b){function d(){return this.insertBefore(document.createElementNS(a.space,a.local),Q(b,this))}function c(){return this.insertBefore(document.createElement(a),Q(b,this))}a=d3.ns.qualify(a);return this.select(a.local?d:c)},S.remove=function(){return this.each(function(){var a=this.parentNode;a&&a.removeChild(this)})},S.data=function(a,b){function f(a,f){var g,h=a.length,i=f.length,j=Math.min(h,i),k=Math.max(h,i),l=[],m=[],n=[],o,p;if(b){var q={},r=[],s,t=f.length;for(g=-1;++g<h;)s=b.call(o=a[g],o.__data__,g),s in q?n[t++]=o:q[s]=o,r.push(s);for(g=-1;++g<i;)o=q[s=b.call(f,p=f[g],g)],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=W(p),l[g]=n[g]=null),delete q[s];for(g=-1;++g<h;)r[g]in q&&(n[g]=a[g])}else{for(g=-1;++g<j;)o=a[g],p=f[g],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=W(p),l[g]=n[g]=null);for(;g<i;++g)m[g]=W(f[g]),l[g]=n[g]=null;for(;g<k;++g)n[g]=a[g],m[g]=l[g]=null}m.update=l,m.parentNode=l.parentNode=n.parentNode=a.parentNode,c.push(m),d.push(l),e.push(n)}var c=[],d=[],e=[],g=-1,h=this.length,i;if(typeof a=="function")while(++g<h)f(i=this[g],a.call(i,i.parentNode.__data__,g));else while(++g<h)f(i=this[g],a);var j=P(d);j.enter=function(){return X(c)},j.exit=function(){return P(e)};return j};var Y=[];Y.append=S.append,Y.insert=S.insert,Y.empty=S.empty,Y.select=function(a){var b=[],c,d,e,f,g;for(var h=-1,i=this.length;++h<i;){e=(f=this[h]).update,b.push(c=[]),c.parentNode=f.parentNode;for(var j=-1,k=f.length;++j<k;)(g=f[j])?(c.push(e[j]=d=a.call(f.parentNode,g.__data__,j)),d.__data__=g.__data__):c.push(null)}return P(b)},S.filter=function(a){var b=[],c,d,e;for(var f=0,g=this.length;f<g;f++){b.push(c=[]),c.parentNode=(d=this[f]).parentNode;for(var h=0,i=d.length;h<i;h++)(e=d[h])&&a.call(e,e.__data__,h)&&c.push(e)}return P(b)},S.map=function(a){return this.each(function(){this.__data__=a.apply(this,arguments)})},S.sort=function(a){a=Z.apply(this,arguments);for(var b=0,c=this.length;b<c;b++)for(var d=this[b].sort(a),e=1,f=d.length,g=d[0];e<f;e++){var h=d[e];h&&(g&&g.parentNode.insertBefore(h,g.nextSibling),g=h)}return this},S.on=function(a,b,c){arguments.length<3&&(c=!1);var d="__on"+a,e=a.indexOf(".");e>0&&(a=a.substring(0,e));return arguments.length<2?(e=this.node()[d])&&e._:this.each(function(e,f){function h(a){var c=d3.event;d3.event=a;try{b.call(g,g.__data__,f)}finally{d3.event=c}}var g=this;g[d]&&g.removeEventListener(a,g[d],c),b&&g.addEventListener(a,g[d]=h,c),h._=b})},S.each=function(a){for(var b=-1,c=this.length;++b<c;)for(var d=this[b],e=-1,f=d.length;++e<f;){var g=d[e];g&&a.call(g,g.__data__,e,b)}return this},S.call=function(a){a.apply(this,(arguments[0]=this,arguments));return this},S.empty=function(){return!this.node()},S.node=function(a){for(var b=0,c=this.length;b<c;b++)for(var d=this[b],e=0,f=d.length;e<f;e++){var g=d[e];if(g)return g}return null},S.transition=function(){var a=[],b,c;for(var d=-1,e=this.length;++d<e;){a.push(b=[]);for(var f=this[d],g=-1,h=f.length;++g<h;)b.push((c=f[g])?{node:c,delay:0,duration:250}:null)}return $(a,bc||++bb)};var ba=[],bb=0,bc=0,bd=d3.ease("cubic-in-out");ba.call=S.call,d3.transition=function(){return T.transition()},d3.transition.prototype=ba,ba.select=function(a){var b=[],c,d,e;typeof a!="function"&&(a=U(a));for(var f=-1,g=this.length;++f<g;){b.push(c=[]);for(var h=this[f],i=-1,j=h.length;++i<j;)(e=h[i])&&(d=a.call(e.node,e.node.__data__,i))?("__data__"in e.node&&(d.__data__=e.node.__data__),c.push({node:d,delay:e.delay,duration:e.duration})):c.push(null)}return $(b,this.id).ease(this.ease())},ba.selectAll=function(a){var b=[],c,d;typeof a!="function"&&(a=V(a));for(var e=-1,f=this.length;++e<f;)for(var g=this[e],h=-1,i=g.length;++h<i;)if(d=g[h]){b.push(c=a.call(d.node,d.node.__data__,h));for(var j=-1,k=c.length;++j<k;)c[j]={node:c[j],delay:d.delay,duration:d.duration}}return $(b,this.id).ease(this.ease())},ba.attr=function(a,b){return this.attrTween(a,_(b))},ba.attrTween=function(a,b){function d(c,d){var e=b.call(this,c,d,this.getAttributeNS(a.space,a.local));return e&&function(b){this.setAttributeNS(a.space,a.local,e(b))}}function c(c,d){var e=b.call(this,c,d,this.getAttribute(a));return e&&function(b){this.setAttribute(a,e(b))}}a=d3.ns.qualify(a);return this.tween("attr."+a,a.local?d:c)},ba.style=function(a,b,c){arguments.length<3&&(c=null);return this.styleTween(a,_(b),c)},ba.styleTween=function(a,b,c){arguments.length<3&&(c=null);return this.tween("style."+a,function(d,e){var f=b.call(this,d,e,window.getComputedStyle(this,null).getPropertyValue(a));return f&&function(b){this.style.setProperty(a,f(b),c)}})},ba.text=function(a){return this.tween("text",function(b,c){this.textContent=typeof a=="function"?a.call(this,b,c):a})},ba.remove=function(){return this.each("end",function(){var a;!this.__transition__&&(a=this.parentNode)&&a.removeChild(this)})},ba.delay=function(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].delay=+a.apply(this,arguments)}:(a=+a,function(c,d,e){b[e][d].delay=a}))},ba.duration=function(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].duration=+a.apply(this,arguments)}:(a=+a,function(c,d,e){b[e][d].duration=a}))},ba.transition=function(){return this.select(b)};var bf=null,bg,bh;d3.timer=function(a,b,c){var d=!1,e,f=bf;if(arguments.length<3){if(arguments.length<2)b=0;else if(!isFinite(b))return;c=Date.now()}while(f){if(f.callback===a){f.then=c,f.delay=b,d=!0;break}e=f,f=f.next}d||(bf={callback:a,then:c,delay:b,next:bf}),bg||(bh=clearTimeout(bh),bg=1,bk(bi))},d3.timer.flush=function(){var a,b=Date.now(),c=bf;while(c)a=b-c.then,c.delay||(c.flush=c.callback(a)),c=c.next;bj()};var bk=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.scale={},d3.scale.linear=function(){return bp([0,1],[0,1],d3.interpolate,!1)},d3.scale.log=function(){return bx(d3.scale.linear(),by)},by.pow=function(a){return Math.pow(10,a)},bz.pow=function(a){return-Math.pow(10,-a)},d3.scale.pow=function(){return bB(d3.scale.linear(),1)},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){return bD({},0,{t:"range",x:[]})},d3.scale.category10=function(){return d3.scale.ordinal().range(bE)},d3.scale.category20=function(){return d3.scale.ordinal().range(bF)},d3.scale.category20b=function(){return d3.scale.ordinal().range(bG)},d3.scale.category20c=function(){return d3.scale.ordinal().range(bH)};var bE=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],bF=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],bG=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],bH=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){return bI([],[])},d3.scale.quantize=function(){return bJ(0,1,[0,1])},d3.svg={},d3.svg.arc=function(){function e(){var e=a.apply(this,arguments),f=b.apply(this,arguments),g=c.apply(this,arguments)+bK,h=d.apply(this,arguments)+bK,i=(h<g&&(i=g,g=h,h=i),h-g),j=i<Math.PI?"0":"1",k=Math.cos(g),l=Math.sin(g),m=Math.cos(h),n=Math.sin(h);return i>=bL?e?"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"M0,"+e+"A"+e+","+e+" 0 1,1 0,"+ -e+"A"+e+","+e+" 0 1,1 0,"+e+"Z":"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"Z":e?"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L"+e*m+","+e*n+"A"+e+","+e+" 0 "+j+",0 "+e*k+","+e*l+"Z":"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L0,0"+"Z"}var a=bM,b=bN,c=bO,d=bP;e.innerRadius=function(b){if(!arguments.length)return a;a=d3.functor(b);return e},e.outerRadius=function(a){if(!arguments.length)return b;b=d3.functor(a);return e},e.startAngle=function(a){if(!arguments.length)return c;c=d3.functor(a);return e},e.endAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return e},e.centroid=function(){var e=(a.apply(this,arguments)+b.apply(this,arguments))/2,f=(c.apply(this,arguments)+d.apply(this,arguments))/2+bK;return[Math.cos(f)*e,Math.sin(f)*e]};return e};var bK=-Math.PI/2,bL=2*Math.PI-1e-6;d3.svg.line=function(){return bQ(Object)};var bU={linear:bV,"step-before":bW,"step-after":bX,basis:cb,"basis-open":cc,"basis-closed":cd,bundle:ce,cardinal:b$,"cardinal-open":bY,"cardinal-closed":bZ,monotone:cn},cg=[0,2/3,1/3,0],ch=[0,1/3,2/3,0],ci=[0,1/6,2/3,1/6];d3.svg.line.radial=function(){var a=bQ(co);a.radius=a.x,delete a.x,a.angle=a.y,delete a.y;return a},d3.svg.area=function(){return cp(Object)},d3.svg.area.radial=function(){var a=cp(co);a.radius=a.x,delete a.x,a.innerRadius=a.x0,delete a.x0,a.outerRadius=a.x1,delete a.x1,a.angle=a.y,delete a.y,a.startAngle=a.y0,delete a.y0,a.endAngle=a.y1,delete a.y1;return a},d3.svg.chord=function(){function j(a,b,c,d){return"Q 0,0 "+d}function i(a,b){return"A"+a+","+a+" 0 0,1 "+b}function h(a,b){return a.a0==b.a0&&a.a1==b.a1}function g(a,b,f,g){var h=b.call(a,f,g),i=c.call(a,h,g),j=d.call(a,h,g)+bK,k=e.call(a,h,g)+bK;return{r:i,a0:j,a1:k,p0:[i*Math.cos(j),i*Math.sin(j)],p1:[i*Math.cos(k),i*Math.sin(k)]}}function f(c,d){var e=g(this,a,c,d),f=g(this,b,c,d);return"M"+e.p0+i(e.r,e.p1)+(h(e,f)?j(e.r,e.p1,e.r,e.p0):j(e.r,e.p1,f.r,f.p0)+i(f.r,f.p1)+j(f.r,f.p1,e.r,e.p0))+"Z"}var a=cs,b=ct,c=cu,d=bO,e=bP;f.radius=function(a){if(!arguments.length)return c;c=d3.functor(a);return f},f.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return f},f.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return f},f.startAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return f},f.endAngle=function(a){if(!arguments.length)return e;e=d3.functor(a);return f};return f},d3.svg.diagonal=function(){function d(d,e){var f=a.call(this,d,e),g=b.call(this,d,e),h=(f.y+g.y)/2,i=[f,{x:f.x,y:h},{x:g.x,y:h},g];i=i.map(c);return"M"+i[0]+"C"+i[1]+" "+i[2]+" "+i[3]}var a=cs,b=ct,c=cx;d.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return d},d.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return d},d.projection=function(a){if(!arguments.length)return c;c=a;return d};return d},d3.svg.diagonal.radial=function(){var a=d3.svg.diagonal(),b=cx,c=a.projection;a.projection=function(a){return arguments.length?c(cy(b=a)):b};return a},d3.svg.mouse=function(a){return cA(a,d3.event)};var cz=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.touches=function(a){var b=d3.event.touches;return b?Array.prototype.map.call(b,function(b){var c=cA(a,b);c.identifier=b.identifier;return c}):[]},d3.svg.symbol=function(){function c(c,d){return(cD[a.call(this,c,d)]||cD.circle)(b.call(this,c,d))}var a=cC,b=cB;c.type=function(b){if(!arguments.length)return a;a=d3.functor(b);return c},c.size=function(a){if(!arguments.length)return b;b=d3.functor(a);return c};return c};var cD={circle:function(a){var b=Math.sqrt(a/Math.PI);return"M0,"+b+"A"+b+","+b+" 0 1,1 0,"+ -b+"A"+b+","+b+" 0 1,1 0,"+b+"Z"},cross:function(a){var b=Math.sqrt(a/5)/2;return"M"+ -3*b+","+ -b+"H"+ -b+"V"+ -3*b+"H"+b+"V"+ -b+"H"+3*b+"V"+b+"H"+b+"V"+3*b+"H"+ -b+"V"+b+"H"+ -3*b+"Z"},diamond:function(a){var b=Math.sqrt(a/(2*cF)),c=b*cF;return"M0,"+ -b+"L"+c+",0"+" 0,"+b+" "+ -c+",0"+"Z"},square:function(a){var b=Math.sqrt(a)/2;return"M"+ -b+","+ -b+"L"+b+","+ -b+" "+b+","+b+" "+ -b+","+b+"Z"},"triangle-down":function(a){var b=Math.sqrt(a/cE),c=b*cE/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.sqrt(a/cE),c=b*cE/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}};d3.svg.symbolTypes=d3.keys(cD);var cE=Math.sqrt(3),cF=Math.tan(30*Math.PI/180);d3.svg.axis=function(){function j(j){j.each(function(k,l,m){function F(a){return j.delay?a.transition().delay(j[m][l].delay).duration(j[m][l].duration).ease(j.ease()):a}var n=d3.select(this),o=a.ticks.apply(a,g),p=h==null?a.tickFormat.apply(a,g):h,q=cI(a,o,i),r=n.selectAll(".minor").data(q,String),s=r.enter().insert("svg:line","g").attr("class","tick minor").style("opacity",1e-6),t=F(r.exit()).style("opacity",1e-6).remove(),u=F(r).style("opacity",1),v=n.selectAll("g").data(o,String),w=v.enter().insert("svg:g","path").style("opacity",1e-6),x=F(v.exit()).style("opacity",1e-6).remove(),y=F(v).style("opacity",1),z,A=bm(a.range()),B=n.selectAll(".domain").data([]),C=B.enter().append("svg:path").attr("class","domain"),D=F(B),E=this.__chart__||a;this.__chart__=a.copy(),w.append("svg:line").attr("class","tick"),w.append("svg:text"),y.select("text").text(p);switch(b){case"bottom":z=cG,u.attr("y2",d),w.select("text").attr("dy",".71em").attr("text-anchor","middle"),y.select("line").attr("y2",c),y.select("text").attr("y",Math.max(c,0)+f),D.attr("d","M"+A[0]+","+e+"V0H"+A[1]+"V"+e);break;case"top":z=cG,u.attr("y2",-d),w.select("text").attr("text-anchor","middle"),y.select("line").attr("y2",-c),y.select("text").attr("y",-(Math.max(c,0)+f)),D.attr("d","M"+A[0]+","+ -e+"V0H"+A[1]+"V"+ -e);break;case"left":z=cH,u.attr("x2",-d),w.select("text").attr("dy",".32em").attr("text-anchor","end"),y.select("line").attr("x2",-c),y.select("text").attr("x",-(Math.max(c,0)+f)),D.attr("d","M"+ -e+","+A[0]+"H0V"+A[1]+"H"+ -e);break;case"right":z=cH,u.attr("x2",d),w.select("text").attr("dy",".32em"),y.select("line").attr("x2",c),y.select("text").attr("x",Math.max(c,0)+f),D.attr("d","M"+e+","+A[0]+"H0V"+A[1]+"H"+e)}w.call(z,E),y.call(z,a),x.call(z,a),s.call(z,E),u.call(z,a),t.call(z,a)})}var a=d3.scale.linear(),b="bottom",c=6,d=6,e=6,f=3,g=[10],h,i=0;j.scale=function(b){if(!arguments.length)return a;a=b;return j},j.orient=function(a){if(!arguments.length)return b;b=a;return j},j.ticks=function(){if(!arguments.length)return g;g=arguments;return j},j.tickFormat=function(a){if(!arguments.length)return h;h=a;return j},j.tickSize=function(a,b,f){if(!arguments.length)return c;var g=arguments.length-1;c=+a,d=g>1?+b:c,e=g>0?+arguments[g]:c;return j},j.tickPadding=function(a){if(!arguments.length)return f;f=+a;return j},j.tickSubdivide=function(a){if(!arguments.length)return i;i=+a;return j};return j},d3.behavior={},d3.behavior.drag=function(){function d(){c.apply(this,arguments),cP("dragstart")}function c(){cJ=a,cM=cQ((cK=this).parentNode),cN=0,cL=arguments}function b(){this.on("mousedown.drag",d).on("touchstart.drag",d),d3.select(window).on("mousemove.drag",cR).on("touchmove.drag",cR).on("mouseup.drag",cS,!0).on("touchend.drag",cS,!0).on("click.drag",cT,!0)}var a=d3.dispatch("drag","dragstart","dragend");b.on=function(c,d){a[c].add(d);return b};return b};var cJ,cK,cL,cM,cN,cO;d3.behavior.zoom=function(){function h(){d.apply(this,arguments);var b=dg(),c,e=Date.now();b.length===1&&e-cZ<300&&dl(1+Math.floor(a[2]),c=b[0],cY[c.identifier]),cZ=e}function g(){d.apply(this,arguments);var b=d3.svg.mouse(da);dl(d3.event.shiftKey?Math.ceil(a[2]-1):Math.floor(a[2]+1),b,de(b))}function f(){d.apply(this,arguments),cX||(cX=de(d3.svg.mouse(da))),dl(df()+a[2],d3.svg.mouse(da),cX)}function e(){d.apply(this,arguments),cW=de(d3.svg.mouse(da)),dc=!1,d3.event.preventDefault(),window.focus()}function d(){c$=a,c_=b.zoom.dispatch,da=this,db=arguments}function c(){this.on("mousedown.zoom",e).on("mousewheel.zoom",f).on("DOMMouseScroll.zoom",g).on("dblclick.zoom",g).on("touchstart.zoom",h),d3.select(window).on("mousemove.zoom",di).on("mouseup.zoom",dj).on("touchmove.zoom",dh).on("touchend.zoom",dg).on("click.zoom",dk,!0)}var a=[0,0,0],b=d3.dispatch("zoom");c.on=function(a,d){b[a].add(d);return c};return c};var cV,cW,cX,cY={},cZ=0,c$,c_,da,db,dc,dd})() <ide>\ No newline at end of file <add>(function(){function dl(a,b,c){function i(a,b){var c=a.__domain||(a.__domain=a.domain()),d=a.range().map(function(a){return(a-b)/h});a.domain(c).domain(d.map(a.invert))}var d=Math.pow(2,(c$[2]=a)-c[2]),e=c$[0]=b[0]-d*c[0],f=c$[1]=b[1]-d*c[1],g=d3.event,h=Math.pow(2,a);d3.event={scale:h,translate:[e,f],transform:function(a,b){a&&i(a,e),b&&i(b,f)}};try{c_.apply(da,db)}finally{d3.event=g}g.preventDefault()}function dk(){dd&&(d3.event.stopPropagation(),d3.event.preventDefault(),dd=!1)}function dj(){cW&&(dc&&(dd=!0),di(),cW=null)}function di(){cX=null,cW&&(dc=!0,dl(c$[2],d3.svg.mouse(da),cW))}function dh(){var a=d3.svg.touches(da);switch(a.length){case 1:var b=a[0];dl(c$[2],b,cY[b.identifier]);break;case 2:var c=a[0],d=a[1],e=[(c[0]+d[0])/2,(c[1]+d[1])/2],f=cY[c.identifier],g=cY[d.identifier],h=[(f[0]+g[0])/2,(f[1]+g[1])/2,f[2]];dl(Math.log(d3.event.scale)/Math.LN2+f[2],e,h)}}function dg(){var a=d3.svg.touches(da),b=-1,c=a.length,d;while(++b<c)cY[(d=a[b]).identifier]=de(d);return a}function df(){cV||(cV=d3.select("body").append("div").style("visibility","hidden").style("top",0).style("height",0).style("width",0).style("overflow-y","scroll").append("div").style("height","2000px").node().parentNode);var a=d3.event,b;try{cV.scrollTop=1e3,cV.dispatchEvent(a),b=1e3-cV.scrollTop}catch(c){b=a.wheelDelta||-a.detail}return b*.005}function de(a){return[a[0]-c$[0],a[1]-c$[1],c$[2]]}function cU(){d3.event.stopPropagation(),d3.event.preventDefault()}function cT(){cO&&(cU(),cO=!1)}function cS(){!cK||(cP("dragend"),cK=null,cN&&(cO=!0,cU()))}function cR(){if(!!cK){var a=cK.parentNode;if(!a)return cS();cP("drag"),cU()}}function cQ(a){return d3.event.touches?d3.svg.touches(a)[0]:d3.svg.mouse(a)}function cP(a){var b=d3.event,c=cK.parentNode,d=0,e=0;c&&(c=cQ(c),d=c[0]-cM[0],e=c[1]-cM[1],cM=c,cN|=d|e);try{d3.event={dx:d,dy:e},cJ[a].dispatch.apply(cK,cL)}finally{d3.event=b}b.preventDefault()}function cI(a,b,c){e=[];if(c&&b.length>1){var d=bm(a.domain()),e,f=-1,g=b.length,h=(b[1]-b[0])/++c,i,j;while(++f<g)for(i=c;--i>0;)(j=+b[f]-i*h)>=d[0]&&e.push(j);for(--f,i=0;++i<c&&(j=+b[f]+i*h)<d[1];)e.push(j)}return e}function cH(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function cG(a,b){a.attr("transform",function(a){return"translate("+b(a)+",0)"})}function cC(){return"circle"}function cB(){return 64}function cA(a,b){var c=(a.ownerSVGElement||a).createSVGPoint();if(cz<0&&(window.scrollX||window.scrollY)){var d=d3.select(document.body).append("svg:svg").style("position","absolute").style("top",0).style("left",0),e=d[0][0].getScreenCTM();cz=!e.f&&!e.e,d.remove()}cz?(c.x=b.pageX,c.y=b.pageY):(c.x=b.clientX,c.y=b.clientY),c=c.matrixTransform(a.getScreenCTM().inverse());return[c.x,c.y]}function cy(a){return function(){var b=a.apply(this,arguments),c=b[0],d=b[1]+bK;return[c*Math.cos(d),c*Math.sin(d)]}}function cx(a){return[a.x,a.y]}function cw(a){return a.endAngle}function cv(a){return a.startAngle}function cu(a){return a.radius}function ct(a){return a.target}function cs(a){return a.source}function cr(a){return function(b,c){return a[c][1]}}function cq(a){return function(b,c){return a[c][0]}}function cp(a){function i(f){if(f.length<1)return null;var i=bR(this,f,b,d),j=bR(this,f,b===c?cq(i):c,d===e?cr(i):e);return"M"+g(a(j),h)+"L"+g(a(i.reverse()),h)+"Z"}var b=bS,c=bS,d=0,e=bT,f="linear",g=bU[f],h=.7;i.x=function(a){if(!arguments.length)return c;b=c=a;return i},i.x0=function(a){if(!arguments.length)return b;b=a;return i},i.x1=function(a){if(!arguments.length)return c;c=a;return i},i.y=function(a){if(!arguments.length)return e;d=e=a;return i},i.y0=function(a){if(!arguments.length)return d;d=a;return i},i.y1=function(a){if(!arguments.length)return e;e=a;return i},i.interpolate=function(a){if(!arguments.length)return f;g=bU[f=a];return i},i.tension=function(a){if(!arguments.length)return h;h=a;return i};return i}function co(a){var b,c=-1,d=a.length,e,f;while(++c<d)b=a[c],e=b[0],f=b[1]+bK,b[0]=e*Math.cos(f),b[1]=e*Math.sin(f);return a}function cn(a){return a.length<3?bV(a):a[0]+b_(a,cm(a))}function cm(a){var b=[],c,d,e,f,g=cl(a),h=-1,i=a.length-1;while(++h<i)c=ck(a[h],a[h+1]),Math.abs(c)<1e-6?g[h]=g[h+1]=0:(d=g[h]/c,e=g[h+1]/c,f=d*d+e*e,f>9&&(f=c*3/Math.sqrt(f),g[h]=f*d,g[h+1]=f*e));h=-1;while(++h<=i)f=(a[Math.min(i,h+1)][0]-a[Math.max(0,h-1)][0])/(6*(1+g[h]*g[h])),b.push([f||0,g[h]*f||0]);return b}function cl(a){var b=0,c=a.length-1,d=[],e=a[0],f=a[1],g=d[0]=ck(e,f);while(++b<c)d[b]=g+(g=ck(e=f,f=a[b+1]));d[b]=g;return d}function ck(a,b){return(b[1]-a[1])/(b[0]-a[0])}function cj(a,b,c){a.push("C",cf(cg,b),",",cf(cg,c),",",cf(ch,b),",",cf(ch,c),",",cf(ci,b),",",cf(ci,c))}function cf(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function ce(a,b){var c=a.length-1,d=a[0][0],e=a[0][1],f=a[c][0]-d,g=a[c][1]-e,h=-1,i,j;while(++h<=c)i=a[h],j=h/c,i[0]=b*i[0]+(1-b)*(d+j*f),i[1]=b*i[1]+(1-b)*(e+j*g);return cb(a)}function cd(a){var b,c=-1,d=a.length,e=d+4,f,g=[],h=[];while(++c<4)f=a[c%d],g.push(f[0]),h.push(f[1]);b=[cf(ci,g),",",cf(ci,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),cj(b,g,h);return b.join("")}function cc(a){if(a.length<4)return bV(a);var b=[],c=-1,d=a.length,e,f=[0],g=[0];while(++c<3)e=a[c],f.push(e[0]),g.push(e[1]);b.push(cf(ci,f)+","+cf(ci,g)),--c;while(++c<d)e=a[c],f.shift(),f.push(e[0]),g.shift(),g.push(e[1]),cj(b,f,g);return b.join("")}function cb(a){if(a.length<3)return bV(a);var b=[],c=1,d=a.length,e=a[0],f=e[0],g=e[1],h=[f,f,f,(e=a[1])[0]],i=[g,g,g,e[1]];b.push(f,",",g),cj(b,h,i);while(++c<d)e=a[c],h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),cj(b,h,i);c=-1;while(++c<2)h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),cj(b,h,i);return b.join("")}function ca(a,b){var c=[],d=(1-b)/2,e,f=a[0],g=a[1],h=1,i=a.length;while(++h<i)e=f,f=g,g=a[h],c.push([d*(g[0]-e[0]),d*(g[1]-e[1])]);return c}function b_(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return bV(a);var c=a.length!=b.length,d="",e=a[0],f=a[1],g=b[0],h=g,i=1;c&&(d+="Q"+(f[0]-g[0]*2/3)+","+(f[1]-g[1]*2/3)+","+f[0]+","+f[1],e=a[1],i=2);if(b.length>1){h=b[1],f=a[i],i++,d+="C"+(e[0]+g[0])+","+(e[1]+g[1])+","+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1];for(var j=2;j<b.length;j++,i++)f=a[i],h=b[j],d+="S"+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1]}if(c){var k=a[i];d+="Q"+(f[0]+h[0]*2/3)+","+(f[1]+h[1]*2/3)+","+k[0]+","+k[1]}return d}function b$(a,b,c){return a.length<3?bV(a):a[0]+b_(a,ca(a,b))}function bZ(a,b){return a.length<3?bV(a):a[0]+b_((a.push(a[0]),a),ca([a[a.length-2]].concat(a,[a[1]]),b))}function bY(a,b){return a.length<4?bV(a):a[1]+b_(a.slice(1,a.length-1),ca(a,b))}function bX(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("H",(e=a[c])[0],"V",e[1]);return b.join("")}function bW(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("V",(e=a[c])[1],"H",e[0]);return b.join("")}function bV(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("L",(e=a[c])[0],",",e[1]);return b.join("")}function bT(a){return a[1]}function bS(a){return a[0]}function bR(a,b,c,d){var e=[],f=-1,g=b.length,h=typeof c=="function",i=typeof d=="function",j;if(h&&i)while(++f<g)e.push([c.call(a,j=b[f],f),d.call(a,j,f)]);else if(h)while(++f<g)e.push([c.call(a,b[f],f),d]);else if(i)while(++f<g)e.push([c,d.call(a,b[f],f)]);else while(++f<g)e.push([c,d]);return e}function bQ(a){function g(d){return d.length<1?null:"M"+e(a(bR(this,d,b,c)),f)}var b=bS,c=bT,d="linear",e=bU[d],f=.7;g.x=function(a){if(!arguments.length)return b;b=a;return g},g.y=function(a){if(!arguments.length)return c;c=a;return g},g.interpolate=function(a){if(!arguments.length)return d;e=bU[d=a];return g},g.tension=function(a){if(!arguments.length)return f;f=a;return g};return g}function bP(a){return a.endAngle}function bO(a){return a.startAngle}function bN(a){return a.outerRadius}function bM(a){return a.innerRadius}function bJ(a,b,c){function g(){d=c.length/(b-a),e=c.length-1;return f}function f(b){return c[Math.max(0,Math.min(e,Math.floor(d*(b-a))))]}var d,e;f.domain=function(c){if(!arguments.length)return[a,b];a=+c[0],b=+c[c.length-1];return g()},f.range=function(a){if(!arguments.length)return c;c=a;return g()},f.copy=function(){return bJ(a,b,c)};return g()}function bI(a,b){function e(a){return isNaN(a=+a)?NaN:b[d3.bisect(c,a)]}function d(){var d=0,f=a.length,g=b.length;c=[];while(++d<g)c[d-1]=d3.quantile(a,d/g);return e}var c;e.domain=function(b){if(!arguments.length)return a;a=b.filter(function(a){return!isNaN(a)}).sort(d3.ascending);return d()},e.range=function(a){if(!arguments.length)return b;b=a;return d()},e.quantiles=function(){return c},e.copy=function(){return bI(a,b)};return d()}function bD(a,b,c){function f(c){return d[((a[c]||(a[c]=++b))-1)%d.length]}var d,e;f.domain=function(d){if(!arguments.length)return d3.keys(a);a={},b=0;var e=-1,g=d.length,h;while(++e<g)a[h=d[e]]||(a[h]=++b);return f[c.t](c.x,c.p)},f.range=function(a){if(!arguments.length)return d;d=a,e=0,c={t:"range",x:a};return f},f.rangePoints=function(a,g){arguments.length<2&&(g=0);var h=a[0],i=a[1],j=(i-h)/(b-1+g);d=b<2?[(h+i)/2]:d3.range(h+j*g/2,i+j/2,j),e=0,c={t:"rangePoints",x:a,p:g};return f},f.rangeBands=function(a,g){arguments.length<2&&(g=0);var h=a[0],i=a[1],j=(i-h)/(b+g);d=d3.range(h+j*g,i,j),e=j*(1-g),c={t:"rangeBands",x:a,p:g};return f},f.rangeRoundBands=function(a,g){arguments.length<2&&(g=0);var h=a[0],i=a[1],j=Math.floor((i-h)/(b+g)),k=i-h-(b-g)*j;d=d3.range(h+Math.round(k/2),i,j),e=Math.round(j*(1-g)),c={t:"rangeRoundBands",x:a,p:g};return f},f.rangeBand=function(){return e},f.copy=function(){var d={},e;for(e in a)d[e]=a[e];return bD(d,b,c)};return f[c.t](c.x,c.p)}function bC(a){return function(b){return b<0?-Math.pow(-b,a):Math.pow(b,a)}}function bB(a,b){function e(b){return a(c(b))}var c=bC(b),d=bC(1/b);e.invert=function(b){return d(a.invert(b))},e.domain=function(b){if(!arguments.length)return a.domain().map(d);a.domain(b.map(c));return e},e.ticks=function(a){return bt(e.domain(),a)},e.tickFormat=function(a){return bu(e.domain(),a)},e.nice=function(){return e.domain(bn(e.domain(),br))},e.exponent=function(a){if(!arguments.length)return b;var f=e.domain();c=bC(b=a),d=bC(1/b);return e.domain(f)},e.copy=function(){return bB(a.copy(),b)};return bq(e,a)}function bA(a){return a.toPrecision(1)}function bz(a){return-Math.log(-a)/Math.LN10}function by(a){return Math.log(a)/Math.LN10}function bx(a,b){function d(c){return a(b(c))}var c=b.pow;d.invert=function(b){return c(a.invert(b))},d.domain=function(e){if(!arguments.length)return a.domain().map(c);b=e[0]<0?bz:by,c=b.pow,a.domain(e.map(b));return d},d.nice=function(){a.domain(bn(a.domain(),bo));return d},d.ticks=function(){var d=bm(a.domain()),e=[];if(d.every(isFinite)){var f=Math.floor(d[0]),g=Math.ceil(d[1]),h=c(d[0]),i=c(d[1]);if(b===bz){e.push(c(f));for(;f++<g;)for(var j=9;j>0;j--)e.push(c(f)*j)}else{for(;f<g;f++)for(var j=1;j<10;j++)e.push(c(f)*j);e.push(c(f))}for(f=0;e[f]<h;f++);for(g=e.length;e[g-1]>i;g--);e=e.slice(f,g)}return e},d.tickFormat=function(){return bA},d.copy=function(){return bx(a.copy(),b)};return bq(d,a)}function bw(a,b,c,d){var e=[],f=[],g=0,h=a.length;while(++g<h)e.push(c(a[g-1],a[g])),f.push(d(b[g-1],b[g]));return function(b){var c=d3.bisect(a,b,1,a.length-1)-1;return f[c](e[c](b))}}function bv(a,b,c,d){var e=c(a[0],a[1]),f=d(b[0],b[1]);return function(a){return f(e(a))}}function bu(a,b){return d3.format(",."+Math.max(0,-Math.floor(Math.log(bs(a,b)[2])/Math.LN10+.01))+"f")}function bt(a,b){return d3.range.apply(d3,bs(a,b))}function bs(a,b){var c=bm(a),d=c[1]-c[0],e=Math.pow(10,Math.floor(Math.log(d/b)/Math.LN10)),f=b/d*e;f<=.15?e*=10:f<=.35?e*=5:f<=.75&&(e*=2),c[0]=Math.ceil(c[0]/e)*e,c[1]=Math.floor(c[1]/e)*e+e*.5,c[2]=e;return c}function br(a){a=Math.pow(10,Math.round(Math.log(a)/Math.LN10)-1);return{floor:function(b){return Math.floor(b/a)*a},ceil:function(b){return Math.ceil(b/a)*a}}}function bq(a,b){a.range=d3.rebind(a,b.range),a.rangeRound=d3.rebind(a,b.rangeRound),a.interpolate=d3.rebind(a,b.interpolate),a.clamp=d3.rebind(a,b.clamp);return a}function bp(a,b,c,d){function h(a){return e(a)}function g(){var g=a.length==2?bv:bw,i=d?D:C;e=g(a,b,i,c),f=g(b,a,i,d3.interpolate);return h}var e,f;h.invert=function(a){return f(a)},h.domain=function(b){if(!arguments.length)return a;a=b.map(Number);return g()},h.range=function(a){if(!arguments.length)return b;b=a;return g()},h.rangeRound=function(a){return h.range(a).interpolate(d3.interpolateRound)},h.clamp=function(a){if(!arguments.length)return d;d=a;return g()},h.interpolate=function(a){if(!arguments.length)return c;c=a;return g()},h.ticks=function(b){return bt(a,b)},h.tickFormat=function(b){return bu(a,b)},h.nice=function(){bn(a,br);return g()},h.copy=function(){return bp(a,b,c,d)};return g()}function bo(){return Math}function bn(a,b){var c=0,d=a.length-1,e=a[c],f=a[d],g;f<e&&(g=c,c=d,d=g,g=e,e=f,f=g),b=b(f-e),a[c]=b.floor(e),a[d]=b.ceil(f);return a}function bm(a){var b=a[0],c=a[a.length-1];return b<c?[b,c]:[c,b]}function bl(){}function bj(){var a=null,b=bf,c=Infinity;while(b)b.flush?b=a?a.next=b.next:bf=b.next:(c=Math.min(c,b.then+b.delay),b=(a=b).next);return c}function bi(){var a,b=Date.now(),c=bf;while(c)a=b-c.then,a>=c.delay&&(c.flush=c.callback(a)),c=c.next;var d=bj()-b;d>24?(isFinite(d)&&(clearTimeout(bh),bh=setTimeout(bi,d)),bg=0):(bg=1,bk(bi))}function be(a){for(var b=0,c=this.length;b<c;b++)for(var d=this[b],e=0,f=d.length;e<f;e++){var g=d[e];g&&a.call(g=g.node,g.__data__,e,b)}return this}function _(a){return typeof a=="function"?function(b,c,d){var e=a.call(this,b,c)+"";return d!=e&&d3.interpolate(d,e)}:(a=a+"",function(b,c,d){return d!=a&&d3.interpolate(d,a)})}function $(b,c){a(b,ba);var d={},e=d3.dispatch("start","end"),f=bd,g=Date.now();b.id=c,b.tween=function(a,c){if(arguments.length<2)return d[a];c==null?delete d[a]:d[a]=c;return b},b.ease=function(a){if(!arguments.length)return f;f=typeof a=="function"?a:d3.ease.apply(d3,arguments);return b},b.each=function(a,c){if(arguments.length<2)return be.call(b,a);e[a].add(c);return b},d3.timer(function(a){b.each(function(h,i,j){function r(){--o.count||delete l.__transition__;return 1}function q(a){if(o.active!==c)return r();var b=Math.min(1,(a-m)/n),d=f(b),g=k.length;while(g>0)k[--g].call(l,d);if(b===1){r(),bc=c,e.end.dispatch.call(l,h,i),bc=0;return 1}}function p(){if(o.active>c)return r();o.active=c;for(var a in d)(a=d[a].call(l,h,i))&&k.push(a);e.start.dispatch.call(l,h,i),d3.timer(q,0,g);return 1}var k=[],l=this,m=b[j][i].delay,n=b[j][i].duration,o=l.__transition__||(l.__transition__={active:0,count:0});++o.count,m<=a?p():d3.timer(p,m,g)});return 1},0,g);return b}function Z(a){arguments.length||(a=d3.ascending);return function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function X(b){a(b,Y);return b}function W(a){return{__data__:a}}function V(a){return function(){return R(a,this)}}function U(a){return function(){return Q(a,this)}}function P(b){a(b,S);return b}function O(a,b,c){function g(a){return Math.round(f(a)*255)}function f(a){a>360?a-=360:a<0&&(a+=360);return a<60?d+(e-d)*a/60:a<180?e:a<240?d+(e-d)*(240-a)/60:d}var d,e;a=a%360,a<0&&(a+=360),b=b<0?0:b>1?1:b,c=c<0?0:c>1?1:c,e=c<=.5?c*(1+b):c+b-c*b,d=2*c-e;return E(g(a+120),g(a),g(a-120))}function N(a,b,c){this.h=a,this.s=b,this.l=c}function M(a,b,c){return new N(a,b,c)}function J(a){var b=parseFloat(a);return a.charAt(a.length-1)==="%"?Math.round(b*2.55):b}function I(a,b,c){var d=Math.min(a/=255,b/=255,c/=255),e=Math.max(a,b,c),f=e-d,g,h,i=(e+d)/2;f?(h=i<.5?f/(e+d):f/(2-e-d),a==e?g=(b-c)/f+(b<c?6:0):b==e?g=(c-a)/f+2:g=(a-b)/f+4,g*=60):h=g=0;return M(g,h,i)}function H(a,b,c){var d=0,e=0,f=0,g,h,i;g=/([a-z]+)\((.*)\)/i.exec(a);if(g){h=g[2].split(",");switch(g[1]){case"hsl":return c(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case"rgb":return b(J(h[0]),J(h[1]),J(h[2]))}}if(i=K[a])return b(i.r,i.g,i.b);a!=null&&a.charAt(0)==="#"&&(a.length===4?(d=a.charAt(1),d+=d,e=a.charAt(2),e+=e,f=a.charAt(3),f+=f):a.length===7&&(d=a.substring(1,3),e=a.substring(3,5),f=a.substring(5,7)),d=parseInt(d,16),e=parseInt(e,16),f=parseInt(f,16));return b(d,e,f)}function G(a){return a<16?"0"+a.toString(16):a.toString(16)}function F(a,b,c){this.r=a,this.g=b,this.b=c}function E(a,b,c){return new F(a,b,c)}function D(a,b){b=b-(a=+a)?1/(b-a):0;return function(c){return Math.max(0,Math.min(1,(c-a)*b))}}function C(a,b){b=b-(a=+a)?1/(b-a):0;return function(c){return(c-a)*b}}function B(a){return a in A||/\bcolor\b/.test(a)?d3.interpolateRgb:d3.interpolate}function y(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}function x(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}}function w(a,b){var c;arguments.length<2&&(b=.45),arguments.length<1?(a=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/a);return function(d){return 1+a*Math.pow(2,10*-d)*Math.sin((d-c)*2*Math.PI/b)}}function v(a){return 1-Math.sqrt(1-a*a)}function u(a){return Math.pow(2,10*(a-1))}function t(a){return 1-Math.cos(a*Math.PI/2)}function s(a){return function(b){return Math.pow(b,a)}}function r(a){return a}function q(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function p(a){return function(b){return 1-a(1-b)}}function k(a){var b=a.lastIndexOf("."),c=b>=0?a.substring(b):(b=a.length,""),d=[];while(b>0)d.push(a.substring(b-=3,b+3));return d.reverse().join(",")+c}function j(a){return a+""}function g(a){var b={},c=[];b.add=function(a){for(var d=0;d<c.length;d++)if(c[d].listener==a)return b;c.push({listener:a,on:!0});return b},b.remove=function(a){for(var d=0;d<c.length;d++){var e=c[d];if(e.listener==a){e.on=!1,c=c.slice(0,d).concat(c.slice(d+1));break}}return b},b.dispatch=function(){var a=c;for(var b=0,d=a.length;b<d;b++){var e=a[b];e.on&&e.listener.apply(this,arguments)}};return b}function e(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function d(a){return a==null}function c(a){return a.length}function b(){return this}d3={version:"2.0.3"},Date.now||(Date.now=function(){return+(new Date)}),Object.create||(Object.create=function(a){function b(){}b.prototype=a;return new b});var a=[].__proto__?function(a,b){a.__proto__=b}:function(a,b){for(var c in b)a[c]=b[c]};d3.functor=function(a){return typeof a=="function"?a:function(){return a}},d3.rebind=function(a,b){return function(){var c=b.apply(a,arguments);return arguments.length?a:c}},d3.ascending=function(a,b){return a<b?-1:a>b?1:a>=b?0:NaN},d3.descending=function(a,b){return b<a?-1:b>a?1:b>=a?0:NaN},d3.min=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&e>f&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&e>f&&(e=f)}return e},d3.max=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&f>e&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&f>e&&(e=f)}return e},d3.sum=function(a,b){var c=0,d=a.length,e,f=-1;if(arguments.length===1)while(++f<d)isNaN(e=+a[f])||(c+=e);else while(++f<d)isNaN(e=+b.call(a,a[f],f))||(c+=e);return c},d3.quantile=function(a,b){var c=(a.length-1)*b+1,d=Math.floor(c),e=a[d-1],f=c-d;return f?e+f*(a[d]-e):e},d3.zip=function(){if(!(f=arguments.length))return[];for(var a=-1,b=d3.min(arguments,c),d=Array(b);++a<b;)for(var e=-1,f,g=d[a]=Array(f);++e<f;)g[e]=arguments[e][a];return d},d3.bisectLeft=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;a[e]<b?c=e+1:d=e}return c},d3.bisect=d3.bisectRight=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;b<a[e]?d=e:c=e+1}return c},d3.first=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])>0&&(e=f);return e},d3.last=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])<=0&&(e=f);return e},d3.nest=function(){function g(a,d){if(d>=b.length)return a;var e=[],f=c[d++],h;for(h in a)e.push({key:h,values:g(a[h],d)});f&&e.sort(function(a,b){return f(a.key,b.key)});return e}function f(c,g){if(g>=b.length)return e?e.call(a,c):d?c.sort(d):c;var h=-1,i=c.length,j=b[g++],k,l,m={};while(++h<i)(k=j(l=c[h]))in m?m[k].push(l):m[k]=[l];for(k in m)m[k]=f(m[k],g);return m}var a={},b=[],c=[],d,e;a.map=function(a){return f(a,0)},a.entries=function(a){return g(f(a,0),0)},a.key=function(c){b.push(c);return a},a.sortKeys=function(d){c[b.length-1]=d;return a},a.sortValues=function(b){d=b;return a},a.rollup=function(b){e=b;return a};return a},d3.keys=function(a){var b=[];for(var c in a)b.push(c);return b},d3.values=function(a){var b=[];for(var c in a)b.push(a[c]);return b},d3.entries=function(a){var b=[];for(var c in a)b.push({key:c,value:a[c]});return b},d3.permute=function(a,b){var c=[],d=-1,e=b.length;while(++d<e)c[d]=a[b[d]];return c},d3.merge=function(a){return Array.prototype.concat.apply([],a)},d3.split=function(a,b){var c=[],e=[],f,g=-1,h=a.length;arguments.length<2&&(b=d);while(++g<h)b.call(e,f=a[g],g)?e=[]:(e.length||c.push(e),e.push(f));return c},d3.range=function(a,b,c){arguments.length<3&&(c=1,arguments.length<2&&(b=a,a=0));if((b-a)/c==Infinity)throw new Error("infinite range");var d=[],e=-1,f;if(c<0)while((f=a+c*++e)>b)d.push(f);else while((f=a+c*++e)<b)d.push(f);return d},d3.requote=function(a){return a.replace(f,"\\$&")};var f=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;d3.round=function(a,b){return b?Math.round(a*Math.pow(10,b))*Math.pow(10,-b):Math.round(a)},d3.xhr=function(a,b,c){var d=new XMLHttpRequest;arguments.length<3?c=b:b&&d.overrideMimeType&&d.overrideMimeType(b),d.open("GET",a,!0),d.onreadystatechange=function(){d.readyState===4&&c(d.status<300?d:null)},d.send(null)},d3.text=function(a,b,c){function d(a){c(a&&a.responseText)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.json=function(a,b){d3.text(a,"application/json",function(a){b(a?JSON.parse(a):null)})},d3.html=function(a,b){d3.text(a,"text/html",function(a){if(a!=null){var c=document.createRange();c.selectNode(document.body),a=c.createContextualFragment(a)}b(a)})},d3.xml=function(a,b,c){function d(a){c(a&&a.responseXML)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.ns={prefix:{svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},qualify:function(a){var b=a.indexOf(":");return b<0?a:{space:d3.ns.prefix[a.substring(0,b)],local:a.substring(b+1)}}},d3.dispatch=function(a){var b={},c;for(var d=0,e=arguments.length;d<e;d++)c=arguments[d],b[c]=g(c);return b},d3.format=function(a){var b=h.exec(a),c=b[1]||" ",d=b[3]||"",e=b[5],f=+b[6],g=b[7],l=b[8],m=b[9],n=!1,o=!1;l&&(l=l.substring(1)),e&&(c="0",g&&(f-=Math.floor((f-1)/4)));switch(m){case"n":g=!0,m="g";break;case"%":n=!0,m="f";break;case"p":n=!0,m="r";break;case"d":o=!0,l="0"}m=i[m]||j;return function(a){var b=n?a*100:+a,h=b<0&&(b=-b)?"−":d;if(o&&b%1)return"";a=m(b,l);if(e){var i=a.length+h.length;i<f&&(a=Array(f-i+1).join(c)+a),g&&(a=k(a)),a=h+a}else{g&&(a=k(a)),a=h+a;var i=a.length;i<f&&(a=Array(f-i+1).join(c)+a)}n&&(a+="%");return a}};var h=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,i={g:function(a,b){return a.toPrecision(b)},e:function(a,b){return a.toExponential(b)},f:function(a,b){return a.toFixed(b)},r:function(a,b){var c=1+Math.floor(1e-15+Math.log(a)/Math.LN10);return d3.round(a,b-c).toFixed(Math.max(0,Math.min(20,b-c)))}},l=s(2),m=s(3),n={linear:function(){return r},poly:s,quad:function(){return l},cubic:function(){return m},sin:function(){return t},exp:function(){return u},circle:function(){return v},elastic:w,back:x,bounce:function(){return y}},o={"in":function(a){return a},out:p,"in-out":q,"out-in":function(a){return q(p(a))}};d3.ease=function(a){var b=a.indexOf("-"),c=b>=0?a.substring(0,b):a,d=b>=0?a.substring(b+1):"in";return o[d](n[c].apply(null,Array.prototype.slice.call(arguments,1)))},d3.event=null,d3.interpolate=function(a,b){var c=d3.interpolators.length,d;while(--c>=0&&!(d=d3.interpolators[c](a,b)));return d},d3.interpolateNumber=function(a,b){b-=a;return function(c){return a+b*c}},d3.interpolateRound=function(a,b){b-=a;return function(c){return Math.round(a+b*c)}},d3.interpolateString=function(a,b){var c,d,e,f=0,g=0,h=[],i=[],j,k;z.lastIndex=0;for(d=0;c=z.exec(b);++d)c.index&&h.push(b.substring(f,g=c.index)),i.push({i:h.length,x:c[0]}),h.push(null),f=z.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=z.exec(a))&&d<j;++d){k=i[d];if(k.x==c[0]){if(k.i)if(h[k.i+1]==null){h[k.i-1]+=k.x,h.splice(k.i,1);for(e=d+1;e<j;++e)i[e].i--}else{h[k.i-1]+=k.x+h[k.i+1],h.splice(k.i,2);for(e=d+1;e<j;++e)i[e].i-=2}else if(h[k.i+1]==null)h[k.i]=k.x;else{h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1);for(e=d+1;e<j;++e)i[e].i--}i.splice(d,1),j--,d--}else k.x=d3.interpolateNumber(parseFloat(c[0]),parseFloat(k.x))}while(d<j)k=i.pop(),h[k.i+1]==null?h[k.i]=k.x:(h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1)),j--;return h.length===1?h[0]==null?i[0].x:function(){return b}:function(a){for(d=0;d<j;++d)h[(k=i[d]).i]=k.x(a);return h.join("")}},d3.interpolateRgb=function(a,b){a=d3.rgb(a),b=d3.rgb(b);var c=a.r,d=a.g,e=a.b,f=b.r-c,g=b.g-d,h=b.b-e;return function(a){return"rgb("+Math.round(c+f*a)+","+Math.round(d+g*a)+","+Math.round(e+h*a)+")"}},d3.interpolateHsl=function(a,b){a=d3.hsl(a),b=d3.hsl(b);var c=a.h,d=a.s,e=a.l,f=b.h-c,g=b.s-d,h=b.l-e;return function(a){return O(c+f*a,d+g*a,e+h*a).toString()}},d3.interpolateArray=function(a,b){var c=[],d=[],e=a.length,f=b.length,g=Math.min(a.length,b.length),h;for(h=0;h<g;++h)c.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)d[h]=a[h];for(;h<f;++h)d[h]=b[h];return function(a){for(h=0;h<g;++h)d[h]=c[h](a);return d}},d3.interpolateObject=function(a,b){var c={},d={},e;for(e in a)e in b?c[e]=B(e)(a[e],b[e]):d[e]=a[e];for(e in b)e in a||(d[e]=b[e]);return function(a){for(e in c)d[e]=c[e](a);return d}};var z=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,A={background:1,fill:1,stroke:1};d3.interpolators=[d3.interpolateObject,function(a,b){return b instanceof Array&&d3.interpolateArray(a,b)},function(a,b){return typeof b=="string"&&d3.interpolateString(String(a),b)},function(a,b){return(typeof b=="string"?b in K||/^(#|rgb\(|hsl\()/.test(b):b instanceof F||b instanceof N)&&d3.interpolateRgb(String(a),b)},function(a,b){return typeof b=="number"&&d3.interpolateNumber(+a,b)}],d3.rgb=function(a,b,c){return arguments.length===1?H(""+a,E,O):E(~~a,~~b,~~c)},F.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);var b=this.r,c=this.g,d=this.b,e=30;if(!b&&!c&&!d)return E(e,e,e);b&&b<e&&(b=e),c&&c<e&&(c=e),d&&d<e&&(d=e);return E(Math.min(255,Math.floor(b/a)),Math.min(255,Math.floor(c/a)),Math.min(255,Math.floor(d/a)))},F.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return E(Math.max(0,Math.floor(a*this.r)),Math.max(0,Math.floor(a*this.g)),Math.max(0,Math.floor(a*this.b)))},F.prototype.hsl=function(){return I(this.r,this.g,this.b)},F.prototype.toString=function(){return"#"+G(this.r)+G(this.g)+G(this.b)};var K={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};for(var L in K)K[L]=H(K[L],E,O);d3.hsl=function(a,b,c){return arguments.length===1?H(""+a,I,M):M(+a,+b,+c)},N.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);return M(this.h,this.s,this.l/a)},N.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return M(this.h,this.s,a*this.l)},N.prototype.rgb=function(){return O(this.h,this.s,this.l)},N.prototype.toString=function(){return"hsl("+this.h+","+this.s*100+"%,"+this.l*100+"%)"},d3.select=function(a){return typeof a=="string"?T.select(a):P([[a]])},d3.selectAll=function(a){return typeof a=="string"?T.selectAll(a):P([a])};var Q=function(a,b){return b.querySelector(a)},R=function(a,b){return b.querySelectorAll(a)};typeof Sizzle=="function"&&(Q=function(a,b){return Sizzle(a,b)[0]},R=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))});var S=[],T=P([[document]]);T[0].parentNode=document.documentElement,d3.selection=function(){return T},d3.selection.prototype=S,S.select=function(a){var b=[],c,d,e,f;typeof a!="function"&&(a=U(a));for(var g=-1,h=this.length;++g<h;){b.push(c=[]),c.parentNode=(e=this[g]).parentNode;for(var i=-1,j=e.length;++i<j;)(f=e[i])?(c.push(d=a.call(f,f.__data__,i)),d&&"__data__"in f&&(d.__data__=f.__data__)):c.push(null)}return P(b)},S.selectAll=function(a){var b=[],c,d;typeof a!="function"&&(a=V(a));for(var e=-1,f=this.length;++e<f;)for(var g=this[e],h=-1,i=g.length;++h<i;)if(d=g[h])b.push(c=a.call(d,d.__data__,h)),c.parentNode=d;return P(b)},S.attr=function(a,b){function i(){var c=b.apply(this,arguments);c==null?this.removeAttributeNS(a.space,a.local):this.setAttributeNS(a.space,a.local,c)}function h(){var c=b.apply(this,arguments);c==null?this.removeAttribute(a):this.setAttribute(a,c)}function g(){this.setAttributeNS(a.space,a.local,b)}function f(){this.setAttribute(a,b)}function e(){this.removeAttributeNS(a.space,a.local)}function d(){this.removeAttribute(a)}a=d3.ns.qualify(a);if(arguments.length<2){var c=this.node();return a.local?c.getAttributeNS(a.space,a.local):c.getAttribute(a)}return this.each(b==null?a.local?e:d:typeof b=="function"?a.local?i:h:a.local?g:f)},S.classed=function(a,b){function i(){(b.apply(this,arguments)?g:h).call(this)}function h(){if(b=this.classList)return b.remove(a);var b=this.className,d=b.baseVal!=null,f=d?b.baseVal:b;f=e(f.replace(c," ")),d?b.baseVal=f:this.className=f}function g(){if(b=this.classList)return b.add(a);var b=this.className,d=b.baseVal!=null,f=d?b.baseVal:b;c.lastIndex=0,c.test(f)||(f=e(f+" "+a),d?b.baseVal=f:this.className=f)}var c=new RegExp("(^|\\s+)"+d3.requote(a)+"(\\s+|$)","g");if(arguments.length<2){var d=this <add>.node();if(f=d.classList)return f.contains(a);var f=d.className;c.lastIndex=0;return c.test(f.baseVal!=null?f.baseVal:f)}return this.each(typeof b=="function"?i:b?g:h)},S.style=function(a,b,c){function f(){var d=b.apply(this,arguments);d==null?this.style.removeProperty(a):this.style.setProperty(a,d,c)}function e(){this.style.setProperty(a,b,c)}function d(){this.style.removeProperty(a)}arguments.length<3&&(c="");return arguments.length<2?window.getComputedStyle(this.node(),null).getPropertyValue(a):this.each(b==null?d:typeof b=="function"?f:e)},S.property=function(a,b){function e(){var c=b.apply(this,arguments);c==null?delete this[a]:this[a]=c}function d(){this[a]=b}function c(){delete this[a]}return arguments.length<2?this.node()[a]:this.each(b==null?c:typeof b=="function"?e:d)},S.text=function(a){return arguments.length<1?this.node().textContent:this.each(typeof a=="function"?function(){this.textContent=a.apply(this,arguments)}:function(){this.textContent=a})},S.html=function(a){return arguments.length<1?this.node().innerHTML:this.each(typeof a=="function"?function(){this.innerHTML=a.apply(this,arguments)}:function(){this.innerHTML=a})},S.append=function(a){function c(){return this.appendChild(document.createElementNS(a.space,a.local))}function b(){return this.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return this.select(a.local?c:b)},S.insert=function(a,b){function d(){return this.insertBefore(document.createElementNS(a.space,a.local),Q(b,this))}function c(){return this.insertBefore(document.createElement(a),Q(b,this))}a=d3.ns.qualify(a);return this.select(a.local?d:c)},S.remove=function(){return this.each(function(){var a=this.parentNode;a&&a.removeChild(this)})},S.data=function(a,b){function f(a,f){var g,h=a.length,i=f.length,j=Math.min(h,i),k=Math.max(h,i),l=[],m=[],n=[],o,p;if(b){var q={},r=[],s,t=f.length;for(g=-1;++g<h;)s=b.call(o=a[g],o.__data__,g),s in q?n[t++]=o:q[s]=o,r.push(s);for(g=-1;++g<i;)o=q[s=b.call(f,p=f[g],g)],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=W(p),l[g]=n[g]=null),delete q[s];for(g=-1;++g<h;)r[g]in q&&(n[g]=a[g])}else{for(g=-1;++g<j;)o=a[g],p=f[g],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=W(p),l[g]=n[g]=null);for(;g<i;++g)m[g]=W(f[g]),l[g]=n[g]=null;for(;g<k;++g)n[g]=a[g],m[g]=l[g]=null}m.update=l,m.parentNode=l.parentNode=n.parentNode=a.parentNode,c.push(m),d.push(l),e.push(n)}var c=[],d=[],e=[],g=-1,h=this.length,i;if(typeof a=="function")while(++g<h)f(i=this[g],a.call(i,i.parentNode.__data__,g));else while(++g<h)f(i=this[g],a);var j=P(d);j.enter=function(){return X(c)},j.exit=function(){return P(e)};return j};var Y=[];Y.append=S.append,Y.insert=S.insert,Y.empty=S.empty,Y.select=function(a){var b=[],c,d,e,f,g;for(var h=-1,i=this.length;++h<i;){e=(f=this[h]).update,b.push(c=[]),c.parentNode=f.parentNode;for(var j=-1,k=f.length;++j<k;)(g=f[j])?(c.push(e[j]=d=a.call(f.parentNode,g.__data__,j)),d.__data__=g.__data__):c.push(null)}return P(b)},S.filter=function(a){var b=[],c,d,e;for(var f=0,g=this.length;f<g;f++){b.push(c=[]),c.parentNode=(d=this[f]).parentNode;for(var h=0,i=d.length;h<i;h++)(e=d[h])&&a.call(e,e.__data__,h)&&c.push(e)}return P(b)},S.map=function(a){return this.each(function(){this.__data__=a.apply(this,arguments)})},S.sort=function(a){a=Z.apply(this,arguments);for(var b=0,c=this.length;b<c;b++)for(var d=this[b].sort(a),e=1,f=d.length,g=d[0];e<f;e++){var h=d[e];h&&(g&&g.parentNode.insertBefore(h,g.nextSibling),g=h)}return this},S.on=function(a,b,c){arguments.length<3&&(c=!1);var d="__on"+a,e=a.indexOf(".");e>0&&(a=a.substring(0,e));return arguments.length<2?(e=this.node()[d])&&e._:this.each(function(e,f){function h(a){var c=d3.event;d3.event=a;try{b.call(g,g.__data__,f)}finally{d3.event=c}}var g=this;g[d]&&g.removeEventListener(a,g[d],c),b&&g.addEventListener(a,g[d]=h,c),h._=b})},S.each=function(a){for(var b=-1,c=this.length;++b<c;)for(var d=this[b],e=-1,f=d.length;++e<f;){var g=d[e];g&&a.call(g,g.__data__,e,b)}return this},S.call=function(a){a.apply(this,(arguments[0]=this,arguments));return this},S.empty=function(){return!this.node()},S.node=function(a){for(var b=0,c=this.length;b<c;b++)for(var d=this[b],e=0,f=d.length;e<f;e++){var g=d[e];if(g)return g}return null},S.transition=function(){var a=[],b,c;for(var d=-1,e=this.length;++d<e;){a.push(b=[]);for(var f=this[d],g=-1,h=f.length;++g<h;)b.push((c=f[g])?{node:c,delay:0,duration:250}:null)}return $(a,bc||++bb)};var ba=[],bb=0,bc=0,bd=d3.ease("cubic-in-out");ba.call=S.call,d3.transition=function(){return T.transition()},d3.transition.prototype=ba,ba.select=function(a){var b=[],c,d,e;typeof a!="function"&&(a=U(a));for(var f=-1,g=this.length;++f<g;){b.push(c=[]);for(var h=this[f],i=-1,j=h.length;++i<j;)(e=h[i])&&(d=a.call(e.node,e.node.__data__,i))?("__data__"in e.node&&(d.__data__=e.node.__data__),c.push({node:d,delay:e.delay,duration:e.duration})):c.push(null)}return $(b,this.id).ease(this.ease())},ba.selectAll=function(a){var b=[],c,d;typeof a!="function"&&(a=V(a));for(var e=-1,f=this.length;++e<f;)for(var g=this[e],h=-1,i=g.length;++h<i;)if(d=g[h]){b.push(c=a.call(d.node,d.node.__data__,h));for(var j=-1,k=c.length;++j<k;)c[j]={node:c[j],delay:d.delay,duration:d.duration}}return $(b,this.id).ease(this.ease())},ba.attr=function(a,b){return this.attrTween(a,_(b))},ba.attrTween=function(a,b){function d(c,d){var e=b.call(this,c,d,this.getAttributeNS(a.space,a.local));return e&&function(b){this.setAttributeNS(a.space,a.local,e(b))}}function c(c,d){var e=b.call(this,c,d,this.getAttribute(a));return e&&function(b){this.setAttribute(a,e(b))}}a=d3.ns.qualify(a);return this.tween("attr."+a,a.local?d:c)},ba.style=function(a,b,c){arguments.length<3&&(c=null);return this.styleTween(a,_(b),c)},ba.styleTween=function(a,b,c){arguments.length<3&&(c=null);return this.tween("style."+a,function(d,e){var f=b.call(this,d,e,window.getComputedStyle(this,null).getPropertyValue(a));return f&&function(b){this.style.setProperty(a,f(b),c)}})},ba.text=function(a){return this.tween("text",function(b,c){this.textContent=typeof a=="function"?a.call(this,b,c):a})},ba.remove=function(){return this.each("end",function(){var a;!this.__transition__&&(a=this.parentNode)&&a.removeChild(this)})},ba.delay=function(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].delay=+a.apply(this,arguments)}:(a=+a,function(c,d,e){b[e][d].delay=a}))},ba.duration=function(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].duration=+a.apply(this,arguments)}:(a=+a,function(c,d,e){b[e][d].duration=a}))},ba.transition=function(){return this.select(b)};var bf=null,bg,bh;d3.timer=function(a,b,c){var d=!1,e,f=bf;if(arguments.length<3){if(arguments.length<2)b=0;else if(!isFinite(b))return;c=Date.now()}while(f){if(f.callback===a){f.then=c,f.delay=b,d=!0;break}e=f,f=f.next}d||(bf={callback:a,then:c,delay:b,next:bf}),bg||(bh=clearTimeout(bh),bg=1,bk(bi))},d3.timer.flush=function(){var a,b=Date.now(),c=bf;while(c)a=b-c.then,c.delay||(c.flush=c.callback(a)),c=c.next;bj()};var bk=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.scale={},d3.scale.linear=function(){return bp([0,1],[0,1],d3.interpolate,!1)},d3.scale.log=function(){return bx(d3.scale.linear(),by)},by.pow=function(a){return Math.pow(10,a)},bz.pow=function(a){return-Math.pow(10,-a)},d3.scale.pow=function(){return bB(d3.scale.linear(),1)},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){return bD({},0,{t:"range",x:[]})},d3.scale.category10=function(){return d3.scale.ordinal().range(bE)},d3.scale.category20=function(){return d3.scale.ordinal().range(bF)},d3.scale.category20b=function(){return d3.scale.ordinal().range(bG)},d3.scale.category20c=function(){return d3.scale.ordinal().range(bH)};var bE=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],bF=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],bG=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],bH=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){return bI([],[])},d3.scale.quantize=function(){return bJ(0,1,[0,1])},d3.svg={},d3.svg.arc=function(){function e(){var e=a.apply(this,arguments),f=b.apply(this,arguments),g=c.apply(this,arguments)+bK,h=d.apply(this,arguments)+bK,i=(h<g&&(i=g,g=h,h=i),h-g),j=i<Math.PI?"0":"1",k=Math.cos(g),l=Math.sin(g),m=Math.cos(h),n=Math.sin(h);return i>=bL?e?"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"M0,"+e+"A"+e+","+e+" 0 1,1 0,"+ -e+"A"+e+","+e+" 0 1,1 0,"+e+"Z":"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"Z":e?"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L"+e*m+","+e*n+"A"+e+","+e+" 0 "+j+",0 "+e*k+","+e*l+"Z":"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L0,0"+"Z"}var a=bM,b=bN,c=bO,d=bP;e.innerRadius=function(b){if(!arguments.length)return a;a=d3.functor(b);return e},e.outerRadius=function(a){if(!arguments.length)return b;b=d3.functor(a);return e},e.startAngle=function(a){if(!arguments.length)return c;c=d3.functor(a);return e},e.endAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return e},e.centroid=function(){var e=(a.apply(this,arguments)+b.apply(this,arguments))/2,f=(c.apply(this,arguments)+d.apply(this,arguments))/2+bK;return[Math.cos(f)*e,Math.sin(f)*e]};return e};var bK=-Math.PI/2,bL=2*Math.PI-1e-6;d3.svg.line=function(){return bQ(Object)};var bU={linear:bV,"step-before":bW,"step-after":bX,basis:cb,"basis-open":cc,"basis-closed":cd,bundle:ce,cardinal:b$,"cardinal-open":bY,"cardinal-closed":bZ,monotone:cn},cg=[0,2/3,1/3,0],ch=[0,1/3,2/3,0],ci=[0,1/6,2/3,1/6];d3.svg.line.radial=function(){var a=bQ(co);a.radius=a.x,delete a.x,a.angle=a.y,delete a.y;return a},d3.svg.area=function(){return cp(Object)},d3.svg.area.radial=function(){var a=cp(co);a.radius=a.x,delete a.x,a.innerRadius=a.x0,delete a.x0,a.outerRadius=a.x1,delete a.x1,a.angle=a.y,delete a.y,a.startAngle=a.y0,delete a.y0,a.endAngle=a.y1,delete a.y1;return a},d3.svg.chord=function(){function j(a,b,c,d){return"Q 0,0 "+d}function i(a,b){return"A"+a+","+a+" 0 0,1 "+b}function h(a,b){return a.a0==b.a0&&a.a1==b.a1}function g(a,b,f,g){var h=b.call(a,f,g),i=c.call(a,h,g),j=d.call(a,h,g)+bK,k=e.call(a,h,g)+bK;return{r:i,a0:j,a1:k,p0:[i*Math.cos(j),i*Math.sin(j)],p1:[i*Math.cos(k),i*Math.sin(k)]}}function f(c,d){var e=g(this,a,c,d),f=g(this,b,c,d);return"M"+e.p0+i(e.r,e.p1)+(h(e,f)?j(e.r,e.p1,e.r,e.p0):j(e.r,e.p1,f.r,f.p0)+i(f.r,f.p1)+j(f.r,f.p1,e.r,e.p0))+"Z"}var a=cs,b=ct,c=cu,d=bO,e=bP;f.radius=function(a){if(!arguments.length)return c;c=d3.functor(a);return f},f.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return f},f.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return f},f.startAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return f},f.endAngle=function(a){if(!arguments.length)return e;e=d3.functor(a);return f};return f},d3.svg.diagonal=function(){function d(d,e){var f=a.call(this,d,e),g=b.call(this,d,e),h=(f.y+g.y)/2,i=[f,{x:f.x,y:h},{x:g.x,y:h},g];i=i.map(c);return"M"+i[0]+"C"+i[1]+" "+i[2]+" "+i[3]}var a=cs,b=ct,c=cx;d.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return d},d.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return d},d.projection=function(a){if(!arguments.length)return c;c=a;return d};return d},d3.svg.diagonal.radial=function(){var a=d3.svg.diagonal(),b=cx,c=a.projection;a.projection=function(a){return arguments.length?c(cy(b=a)):b};return a},d3.svg.mouse=function(a){return cA(a,d3.event)};var cz=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.touches=function(a){var b=d3.event.touches;return b?Array.prototype.map.call(b,function(b){var c=cA(a,b);c.identifier=b.identifier;return c}):[]},d3.svg.symbol=function(){function c(c,d){return(cD[a.call(this,c,d)]||cD.circle)(b.call(this,c,d))}var a=cC,b=cB;c.type=function(b){if(!arguments.length)return a;a=d3.functor(b);return c},c.size=function(a){if(!arguments.length)return b;b=d3.functor(a);return c};return c};var cD={circle:function(a){var b=Math.sqrt(a/Math.PI);return"M0,"+b+"A"+b+","+b+" 0 1,1 0,"+ -b+"A"+b+","+b+" 0 1,1 0,"+b+"Z"},cross:function(a){var b=Math.sqrt(a/5)/2;return"M"+ -3*b+","+ -b+"H"+ -b+"V"+ -3*b+"H"+b+"V"+ -b+"H"+3*b+"V"+b+"H"+b+"V"+3*b+"H"+ -b+"V"+b+"H"+ -3*b+"Z"},diamond:function(a){var b=Math.sqrt(a/(2*cF)),c=b*cF;return"M0,"+ -b+"L"+c+",0"+" 0,"+b+" "+ -c+",0"+"Z"},square:function(a){var b=Math.sqrt(a)/2;return"M"+ -b+","+ -b+"L"+b+","+ -b+" "+b+","+b+" "+ -b+","+b+"Z"},"triangle-down":function(a){var b=Math.sqrt(a/cE),c=b*cE/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.sqrt(a/cE),c=b*cE/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}};d3.svg.symbolTypes=d3.keys(cD);var cE=Math.sqrt(3),cF=Math.tan(30*Math.PI/180);d3.svg.axis=function(){function j(j){j.each(function(k,l,m){function F(a){return j.delay?a.transition().delay(j[m][l].delay).duration(j[m][l].duration).ease(j.ease()):a}var n=d3.select(this),o=a.ticks.apply(a,g),p=h==null?a.tickFormat.apply(a,g):h,q=cI(a,o,i),r=n.selectAll(".minor").data(q,String),s=r.enter().insert("svg:line","g").attr("class","tick minor").style("opacity",1e-6),t=F(r.exit()).style("opacity",1e-6).remove(),u=F(r).style("opacity",1),v=n.selectAll("g").data(o,String),w=v.enter().insert("svg:g","path").style("opacity",1e-6),x=F(v.exit()).style("opacity",1e-6).remove(),y=F(v).style("opacity",1),z,A=bm(a.range()),B=n.selectAll(".domain").data([]),C=B.enter().append("svg:path").attr("class","domain"),D=F(B),E=this.__chart__||a;this.__chart__=a.copy(),w.append("svg:line").attr("class","tick"),w.append("svg:text"),y.select("text").text(p);switch(b){case"bottom":z=cG,u.attr("y2",d),w.select("text").attr("dy",".71em").attr("text-anchor","middle"),y.select("line").attr("y2",c),y.select("text").attr("y",Math.max(c,0)+f),D.attr("d","M"+A[0]+","+e+"V0H"+A[1]+"V"+e);break;case"top":z=cG,u.attr("y2",-d),w.select("text").attr("text-anchor","middle"),y.select("line").attr("y2",-c),y.select("text").attr("y",-(Math.max(c,0)+f)),D.attr("d","M"+A[0]+","+ -e+"V0H"+A[1]+"V"+ -e);break;case"left":z=cH,u.attr("x2",-d),w.select("text").attr("dy",".32em").attr("text-anchor","end"),y.select("line").attr("x2",-c),y.select("text").attr("x",-(Math.max(c,0)+f)),D.attr("d","M"+ -e+","+A[0]+"H0V"+A[1]+"H"+ -e);break;case"right":z=cH,u.attr("x2",d),w.select("text").attr("dy",".32em"),y.select("line").attr("x2",c),y.select("text").attr("x",Math.max(c,0)+f),D.attr("d","M"+e+","+A[0]+"H0V"+A[1]+"H"+e)}w.call(z,E),y.call(z,a),x.call(z,a),s.call(z,E),u.call(z,a),t.call(z,a)})}var a=d3.scale.linear(),b="bottom",c=6,d=6,e=6,f=3,g=[10],h,i=0;j.scale=function(b){if(!arguments.length)return a;a=b;return j},j.orient=function(a){if(!arguments.length)return b;b=a;return j},j.ticks=function(){if(!arguments.length)return g;g=arguments;return j},j.tickFormat=function(a){if(!arguments.length)return h;h=a;return j},j.tickSize=function(a,b,f){if(!arguments.length)return c;var g=arguments.length-1;c=+a,d=g>1?+b:c,e=g>0?+arguments[g]:c;return j},j.tickPadding=function(a){if(!arguments.length)return f;f=+a;return j},j.tickSubdivide=function(a){if(!arguments.length)return i;i=+a;return j};return j},d3.behavior={},d3.behavior.drag=function(){function d(){c.apply(this,arguments),cP("dragstart")}function c(){cJ=a,cM=cQ((cK=this).parentNode),cN=0,cL=arguments}function b(){this.on("mousedown.drag",d).on("touchstart.drag",d),d3.select(window).on("mousemove.drag",cR).on("touchmove.drag",cR).on("mouseup.drag",cS,!0).on("touchend.drag",cS,!0).on("click.drag",cT,!0)}var a=d3.dispatch("drag","dragstart","dragend");b.on=function(c,d){a[c].add(d);return b};return b};var cJ,cK,cL,cM,cN,cO;d3.behavior.zoom=function(){function h(){d.apply(this,arguments);var b=dg(),c,e=Date.now();b.length===1&&e-cZ<300&&dl(1+Math.floor(a[2]),c=b[0],cY[c.identifier]),cZ=e}function g(){d.apply(this,arguments);var b=d3.svg.mouse(da);dl(d3.event.shiftKey?Math.ceil(a[2]-1):Math.floor(a[2]+1),b,de(b))}function f(){d.apply(this,arguments),cX||(cX=de(d3.svg.mouse(da))),dl(df()+a[2],d3.svg.mouse(da),cX)}function e(){d.apply(this,arguments),cW=de(d3.svg.mouse(da)),dc=!1,d3.event.preventDefault(),window.focus()}function d(){c$=a,c_=b.zoom.dispatch,da=this,db=arguments}function c(){this.on("mousedown.zoom",e).on("mousewheel.zoom",f).on("DOMMouseScroll.zoom",g).on("dblclick.zoom",g).on("touchstart.zoom",h),d3.select(window).on("mousemove.zoom",di).on("mouseup.zoom",dj).on("touchmove.zoom",dh).on("touchend.zoom",dg).on("click.zoom",dk,!0)}var a=[0,0,0],b=d3.dispatch("zoom");c.on=function(a,d){b[a].add(d);return c};return c};var cV,cW,cX,cY={},cZ=0,c$,c_,da,db,dc,dd})() <ide>\ No newline at end of file <ide><path>src/core/transition.js <ide> function d3_transition(groups, id) { <ide> node = this, <ide> delay = groups[j][i].delay, <ide> duration = groups[j][i].duration, <del> lock = node.__transition__; <add> lock = node.__transition__ || (node.__transition__ = {active: 0, count: 0}); <add> <add> ++lock.count; <ide> <del> if (!lock) lock = node.__transition__ = {active: 0, owner: id}; <del> else if (lock.owner < id) lock.owner = id; <ide> delay <= elapsed ? start() : d3.timer(start, delay, then); <ide> <ide> function start() { <del> if (lock.active <= id) { <del> lock.active = id; <del> event.start.dispatch.call(node, d, i); <del> <del> for (var tween in tweens) { <del> if (tween = tweens[tween].call(node, d, i)) { <del> tweened.push(tween); <del> } <del> } <add> if (lock.active > id) return stop(); <add> lock.active = id; <ide> <del> d3.timer(tick, 0, then); <add> for (var tween in tweens) { <add> if (tween = tweens[tween].call(node, d, i)) { <add> tweened.push(tween); <add> } <ide> } <del> return true; <add> <add> event.start.dispatch.call(node, d, i); <add> d3.timer(tick, 0, then); <add> return 1; <ide> } <ide> <ide> function tick(elapsed) { <del> if (lock.active !== id) return true; <add> if (lock.active !== id) return stop(); <ide> <ide> var t = Math.min(1, (elapsed - delay) / duration), <ide> e = ease(t), <ide> n = tweened.length; <ide> <del> while (--n >= 0) { <del> tweened[n].call(node, e); <add> while (n > 0) { <add> tweened[--n].call(node, e); <ide> } <ide> <ide> if (t === 1) { <del> lock.active = 0; <del> if (lock.owner === id) delete node.__transition__; <add> stop(); <ide> d3_transitionInheritId = id; <ide> event.end.dispatch.call(node, d, i); <ide> d3_transitionInheritId = 0; <del> return true; <add> return 1; <ide> } <ide> } <add> <add> function stop() { <add> if (!--lock.count) delete node.__transition__; <add> return 1; <add> } <ide> }); <del> return true; <add> return 1; <ide> }, 0, then); <ide> <ide> return groups; <ide><path>test/core/transition-test-each.js <ide> module.exports = { <ide> "sets an exclusive lock on transitioning nodes": function(result) { <ide> var id = result.id; <ide> assert.isTrue(id > 0); <del> assert.equal(result.selection[0][0].__transition__.owner, id); <del> assert.equal(result.selection[0][1].__transition__.owner, id); <add> assert.equal(result.selection[0][0].__transition__.count, 1); <add> assert.equal(result.selection[0][1].__transition__.count, 1); <ide> assert.equal(result.selection[0][0].__transition__.active, id); <ide> assert.equal(result.selection[0][1].__transition__.active, id); <ide> } <ide> module.exports = { <ide> }, <ide> "inherits the same transition id": function(result) { <ide> assert.isTrue(result.id > 0); <del> assert.equal(result.node.__transition__.owner, result.id); <add> assert.equal(result.node.__transition__.count, 1); <ide> assert.equal(result.node.__transition__.active, result.id); <ide> } <ide> } <ide><path>test/core/transition-test-transition.js <add>require("../env"); <add>require("../../d3"); <add> <add>var assert = require("assert"); <add> <add>module.exports = { <add> topic: function() { <add> return d3.select("body").append("div").transition() <add> .delay(100) <add> .duration(150) <add> .ease("bounce"); <add> }, <add> <add> "inherits the delay": function(t1) { <add> var t2 = t1.transition(); <add> assert.equal(t2[0][0].delay, 100); <add> }, <add> "inherits the duration": function(t1) { <add> var t2 = t1.transition(); <add> assert.equal(t2[0][0].duration, 150); <add> }, <add> "inherits easing": function(t1) { <add> // TODO how to test this? <add> }, <add> "inherits the transition id": function(t1) { <add> var t2 = t1.transition(); <add> assert.equal(t2.id, t1.id); <add> }, <add> <add> "while transitioning": { <add> topic: function(t1) { <add> var t2 = t1.transition(), <add> cb = this.callback; <add> t2.each("start", function() { <add> d3.timer(function() { <add> cb(null, t2); <add> return true; <add> }); <add> }); <add> }, <add> "increments the lock's reference count": function(t2) { <add> assert.isTrue(t2[0][0].node.__transition__.count > 1); <add> } <add> }, <add> <add> "after transitioning": { <add> topic: function(t1) { <add> var cb = this.callback; <add> t1.each("end", function() { <add> d3.timer(function() { <add> cb(null, t1); <add> return true; <add> }); <add> }); <add> }, <add> "decrements the lock's reference count": function(t1) { <add> assert.isFalse("__transition__" in t1[0][0].node); <add> } <add> } <add>}; <ide><path>test/core/transition-test.js <ide> suite.addBatch({ <ide> // Subtransitions <ide> "select": require("./transition-test-select"), <ide> "selectAll": require("./transition-test-selectAll"), <add> "transition": require("./transition-test-transition"), <ide> <ide> // Content <ide> "attr": require("./transition-test-attr"),
6
PHP
PHP
fix failing test
6e8330890ecbd29b197cc94ce61923eebd77c164
<ide><path>tests/TestCase/Error/ExceptionRendererTest.php <ide> public function testPDOException() { <ide> <ide> $result = $ExceptionRenderer->render()->body(); <ide> <del> $this->assertContains('<h2>Database Error</h2>', $result); <add> $this->assertContains('Database Error', $result); <ide> $this->assertContains('There was an error in the SQL query', $result); <ide> $this->assertContains(h('SELECT * from poo_query < 5 and :seven'), $result); <ide> $this->assertContains("'seven' => (int) 7", $result);
1
Go
Go
use json.encoder for container.writehostconfig
cf1a6c08fa03aa7020f8f5b414bb9349a9c8371a
<ide><path>daemon/container.go <ide> import ( <ide> "errors" <ide> "fmt" <ide> "io" <del> "io/ioutil" <ide> "os" <ide> "path/filepath" <ide> "strings" <ide> func (container *Container) readHostConfig() error { <ide> } <ide> <ide> func (container *Container) writeHostConfig() error { <del> data, err := json.Marshal(container.hostConfig) <add> pth, err := container.hostConfigPath() <ide> if err != nil { <ide> return err <ide> } <ide> <del> pth, err := container.hostConfigPath() <add> f, err := os.Create(pth) <ide> if err != nil { <ide> return err <ide> } <add> defer f.Close() <ide> <del> return ioutil.WriteFile(pth, data, 0666) <add> return json.NewEncoder(f).Encode(&container.hostConfig) <ide> } <ide> <ide> func (container *Container) logEvent(action string) {
1
PHP
PHP
adjust partial of test case for emailcomponent
b2f948dfeb3f3e9e2c9091dc5b9482a994d26e04
<ide><path>lib/Cake/tests/Case/Controller/Component/EmailComponentTest.php <ide> */ <ide> App::uses('Controller', 'Controller'); <ide> App::uses('EmailComponent', 'Controller/Component'); <add>App::uses('AbstractTransport', 'Network/Email'); <ide> <ide> /** <ide> * EmailTestComponent class <ide> function strip($content, $message = false) { <ide> <ide> } <ide> <add>/** <add> * DebugCompTransport class <add> * <add> * @package cake.tests.cases.libs.controller.components <add> */ <add>class DebugCompTransport extends AbstractTransport { <add> <add>/** <add> * Last email <add> * <add> * @var string <add> */ <add> public static $lastEmail = null; <add> <add>/** <add> * Send mail <add> * <add> * @params object $email CakeEmail <add> * @return boolean <add> */ <add> public function send(CakeEmail $email) { <add> $headers = $email->getHeaders(array_fill_keys(array('from', 'replyTo', 'readReceipt', 'returnPath', 'to', 'cc', 'bcc', 'subject'), true)); <add> $to = $headers['To']; <add> $subject = $headers['Subject']; <add> unset($headers['To'], $headers['Subject']); <add> <add> $message = implode("\n", $email->message()); <add> <add> $last = '<pre>'; <add> $last .= sprintf("%s %s\n", 'To:', $to); <add> $last .= sprintf("%s %s\n", 'From:', $headers['From']); <add> $last .= sprintf("%s %s\n", 'Subject:', $subject); <add> $last .= sprintf("%s\n\n%s", 'Header:', $this->_headersToString($headers, "\n")); <add> $last .= sprintf("%s\n\n%s", 'Message:', $message); <add> $last .= '</pre>'; <add> <add> self::$lastEmail = $last; <add> <add> return true; <add> } <add> <add>} <add> <ide> /** <ide> * EmailTestController class <ide> * <ide> class EmailTestController extends Controller { <ide> */ <ide> public $components = array('Session', 'EmailTest'); <ide> <del>/** <del> * pageTitle property <del> * <del> * @var string <del> * @access public <del> */ <del> public $pageTitle = 'EmailTest'; <ide> } <ide> <ide> /** <ide> function setUp() { <ide> function tearDown() { <ide> Configure::write('App.encoding', $this->_appEncoding); <ide> App::build(); <del> $this->Controller->Session->delete('Message'); <ide> ClassRegistry::flush(); <ide> } <ide> <ide> function __osFix($string) { <ide> * @return void <ide> */ <ide> function testSendFormats() { <del> $this->Controller->EmailTest->to = 'postmaster@localhost'; <add> $this->Controller->EmailTest->to = 'postmaster@example.com'; <ide> $this->Controller->EmailTest->from = 'noreply@example.com'; <ide> $this->Controller->EmailTest->subject = 'Cake SMTP test'; <ide> $this->Controller->EmailTest->replyTo = 'noreply@example.com'; <ide> $this->Controller->EmailTest->template = null; <del> $this->Controller->EmailTest->delivery = 'debug'; <add> $this->Controller->EmailTest->delivery = 'DebugComp'; <ide> $this->Controller->EmailTest->messageId = false; <ide> <ide> $date = date(DATE_RFC2822); <ide> $message = <<<MSGBLOC <del><pre>To: postmaster@localhost <add><pre>To: postmaster@example.com <ide> From: noreply@example.com <ide> Subject: Cake SMTP test <ide> Header: <ide> <ide> From: noreply@example.com <ide> Reply-To: noreply@example.com <del>Date: $date <ide> X-Mailer: CakePHP Email Component <add>Date: $date <ide> Content-Type: {CONTENTTYPE} <del>Content-Transfer-Encoding: 7bitParameters: <del> <del>Message: <add>Content-Transfer-Encoding: 7bitMessage: <ide> <ide> This is the body of the message <ide> <ide> </pre> <ide> MSGBLOC; <add> <ide> $this->Controller->EmailTest->sendAs = 'text'; <ide> $expect = str_replace('{CONTENTTYPE}', 'text/plain; charset=UTF-8', $message); <ide> $this->assertTrue($this->Controller->EmailTest->send('This is the body of the message')); <del> $this->assertEqual($this->Controller->Session->read('Message.email.message'), $this->__osFix($expect)); <add> $this->assertEqual(DebugCompTransport::$lastEmail, $this->__osFix($expect)); <ide> <ide> $this->Controller->EmailTest->sendAs = 'html'; <ide> $expect = str_replace('{CONTENTTYPE}', 'text/html; charset=UTF-8', $message); <ide> $this->assertTrue($this->Controller->EmailTest->send('This is the body of the message')); <del> $this->assertEqual($this->Controller->Session->read('Message.email.message'), $this->__osFix($expect)); <add> $this->assertEqual(DebugCompTransport::$lastEmail, $this->__osFix($expect)); <ide> <ide> // TODO: better test for format of message sent? <ide> $this->Controller->EmailTest->sendAs = 'both'; <ide> $expect = str_replace('{CONTENTTYPE}', 'multipart/alternative; boundary="alt-"', $message); <del> <ide> $this->assertTrue($this->Controller->EmailTest->send('This is the body of the message')); <del> $this->assertEqual($this->Controller->Session->read('Message.email.message'), $this->__osFix($expect)); <add> $this->assertEqual(DebugCompTransport::$lastEmail, $this->__osFix($expect)); <ide> } <ide> <ide> /** <ide> function testSendFormats() { <ide> function testTemplates() { <ide> ClassRegistry::flush(); <ide> <del> $this->Controller->EmailTest->to = 'postmaster@localhost'; <add> $this->Controller->EmailTest->to = 'postmaster@example.com'; <ide> $this->Controller->EmailTest->from = 'noreply@example.com'; <ide> $this->Controller->EmailTest->subject = 'Cake SMTP test'; <ide> $this->Controller->EmailTest->replyTo = 'noreply@example.com'; <ide> <del> $this->Controller->EmailTest->delivery = 'debug'; <add> $this->Controller->EmailTest->delivery = 'DebugComp'; <ide> $this->Controller->EmailTest->messageId = false; <ide> <ide> $date = date(DATE_RFC2822); <ide> $header = <<<HEADBLOC <del>To: postmaster@localhost <add>To: postmaster@example.com <ide> From: noreply@example.com <ide> Subject: Cake SMTP test <ide> Header: <ide> <ide> From: noreply@example.com <ide> Reply-To: noreply@example.com <del>Date: $date <ide> X-Mailer: CakePHP Email Component <add>Date: $date <ide> Content-Type: {CONTENTTYPE} <del>Content-Transfer-Encoding: 7bitParameters: <del> <del>Message: <add>Content-Transfer-Encoding: 7bitMessage: <ide> <ide> <ide> HEADBLOC; <ide> function testTemplates() { <ide> $this->Controller->EmailTest->sendAs = 'text'; <ide> $expect = '<pre>' . str_replace('{CONTENTTYPE}', 'text/plain; charset=UTF-8', $header) . $text . "\n" . '</pre>'; <ide> $this->assertTrue($this->Controller->EmailTest->send('This is the body of the message')); <del> $this->assertEqual($this->Controller->Session->read('Message.email.message'), $this->__osFix($expect)); <add> $this->assertEqual(DebugCompTransport::$lastEmail, $this->__osFix($expect)); <ide> <ide> $this->Controller->EmailTest->sendAs = 'html'; <ide> $expect = '<pre>' . str_replace('{CONTENTTYPE}', 'text/html; charset=UTF-8', $header) . $html . "\n" . '</pre>'; <ide> $this->assertTrue($this->Controller->EmailTest->send('This is the body of the message')); <del> $this->assertEqual($this->Controller->Session->read('Message.email.message'), $this->__osFix($expect)); <add> $this->assertEqual(DebugCompTransport::$lastEmail, $this->__osFix($expect)); <ide> <ide> $this->Controller->EmailTest->sendAs = 'both'; <ide> $expect = str_replace('{CONTENTTYPE}', 'multipart/alternative; boundary="alt-"', $header); <ide> function testTemplates() { <ide> $expect = '<pre>' . $expect . '--alt---' . "\n\n" . '</pre>'; <ide> <ide> $this->assertTrue($this->Controller->EmailTest->send('This is the body of the message')); <del> $this->assertEqual($this->Controller->Session->read('Message.email.message'), $this->__osFix($expect)); <add> $this->assertEqual(DebugCompTransport::$lastEmail, $this->__osFix($expect)); <ide> <ide> $html = <<<HTMLBLOC <ide> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> <ide> function testTemplates() { <ide> $this->Controller->EmailTest->sendAs = 'html'; <ide> $expect = '<pre>' . str_replace('{CONTENTTYPE}', 'text/html; charset=UTF-8', $header) . $html . '</pre>'; <ide> $this->assertTrue($this->Controller->EmailTest->send('This is the body of the message', 'default', 'thin')); <del> $this->assertEqual($this->Controller->Session->read('Message.email.message'), $this->__osFix($expect)); <add> $this->assertEqual(DebugCompTransport::$lastEmail, $this->__osFix($expect)); <ide> <ide> $result = ClassRegistry::getObject('view'); <ide> $this->assertFalse($result); <ide> function testTemplates() { <ide> * @return void <ide> */ <ide> function testTemplateNestedElements() { <del> $this->Controller->EmailTest->to = 'postmaster@localhost'; <add> $this->Controller->EmailTest->to = 'postmaster@example.com'; <ide> $this->Controller->EmailTest->from = 'noreply@example.com'; <ide> $this->Controller->EmailTest->subject = 'Cake SMTP test'; <ide> $this->Controller->EmailTest->replyTo = 'noreply@example.com'; <ide> <del> $this->Controller->EmailTest->delivery = 'debug'; <add> $this->Controller->EmailTest->delivery = 'DebugComp'; <ide> $this->Controller->EmailTest->messageId = false; <ide> $this->Controller->EmailTest->layout = 'default'; <ide> $this->Controller->EmailTest->template = 'nested_element'; <ide> $this->Controller->EmailTest->sendAs = 'html'; <ide> $this->Controller->helpers = array('Html'); <ide> <ide> $this->Controller->EmailTest->send(); <del> $result = $this->Controller->Session->read('Message.email.message'); <add> $result = DebugCompTransport::$lastEmail; <ide> $this->assertPattern('/Test/', $result); <ide> $this->assertPattern('/http\:\/\/example\.com/', $result); <ide> } <ide> function testTemplateNestedElements() { <ide> * @return void <ide> */ <ide> function testSendDebug() { <del> $this->Controller->EmailTest->to = 'postmaster@localhost'; <add> $this->Controller->EmailTest->to = 'postmaster@example.com'; <ide> $this->Controller->EmailTest->from = 'noreply@example.com'; <ide> $this->Controller->EmailTest->cc = 'cc@example.com'; <ide> $this->Controller->EmailTest->bcc = 'bcc@example.com'; <ide> $this->Controller->EmailTest->subject = 'Cake Debug Test'; <ide> $this->Controller->EmailTest->replyTo = 'noreply@example.com'; <ide> $this->Controller->EmailTest->template = null; <ide> <del> $this->Controller->EmailTest->delivery = 'debug'; <add> $this->Controller->EmailTest->delivery = 'DebugComp'; <ide> $this->assertTrue($this->Controller->EmailTest->send('This is the body of the message')); <del> $result = $this->Controller->Session->read('Message.email.message'); <add> $result = DebugCompTransport::$lastEmail; <ide> <del> $this->assertPattern('/To: postmaster@localhost\n/', $result); <add> $this->assertPattern('/To: postmaster@example.com\n/', $result); <ide> $this->assertPattern('/Subject: Cake Debug Test\n/', $result); <ide> $this->assertPattern('/Reply-To: noreply@example.com\n/', $result); <ide> $this->assertPattern('/From: noreply@example.com\n/', $result); <ide> function testSendDebug() { <ide> $this->assertPattern('/Date: ' . preg_quote(date(DATE_RFC2822)) . '\n/', $result); <ide> $this->assertPattern('/X-Mailer: CakePHP Email Component\n/', $result); <ide> $this->assertPattern('/Content-Type: text\/plain; charset=UTF-8\n/', $result); <del> $this->assertPattern('/Content-Transfer-Encoding: 7bitParameters:\n/', $result); <add> $this->assertPattern('/Content-Transfer-Encoding: 7bitMessage:\n/', $result); <ide> $this->assertPattern('/This is the body of the message/', $result); <ide> } <ide> <ide> function testSendDebug() { <ide> function testSendDebugWithNoSessions() { <ide> $session = $this->Controller->Session; <ide> unset($this->Controller->Session); <del> $this->Controller->EmailTest->to = 'postmaster@localhost'; <add> $this->Controller->EmailTest->to = 'postmaster@example.com'; <ide> $this->Controller->EmailTest->from = 'noreply@example.com'; <ide> $this->Controller->EmailTest->subject = 'Cake Debug Test'; <ide> $this->Controller->EmailTest->replyTo = 'noreply@example.com'; <ide> $this->Controller->EmailTest->template = null; <ide> <del> $this->Controller->EmailTest->delivery = 'debug'; <del> $result = $this->Controller->EmailTest->send('This is the body of the message'); <add> $this->Controller->EmailTest->delivery = 'DebugComp'; <add> $this->Controller->EmailTest->send('This is the body of the message'); <add> $result = DebugCompTransport::$lastEmail; <ide> <del> $this->assertPattern('/To: postmaster@localhost\n/', $result); <add> $this->assertPattern('/To: postmaster@example.com\n/', $result); <ide> $this->assertPattern('/Subject: Cake Debug Test\n/', $result); <ide> $this->assertPattern('/Reply-To: noreply@example.com\n/', $result); <ide> $this->assertPattern('/From: noreply@example.com\n/', $result); <ide> $this->assertPattern('/Date: ' . preg_quote(date(DATE_RFC2822)) . '\n/', $result); <ide> $this->assertPattern('/X-Mailer: CakePHP Email Component\n/', $result); <ide> $this->assertPattern('/Content-Type: text\/plain; charset=UTF-8\n/', $result); <del> $this->assertPattern('/Content-Transfer-Encoding: 7bitParameters:\n/', $result); <add> $this->assertPattern('/Content-Transfer-Encoding: 7bitMessage:\n/', $result); <ide> $this->assertPattern('/This is the body of the message/', $result); <ide> $this->Controller->Session = $session; <ide> } <ide> function testMessageRetrievalWithoutTemplate() { <ide> 'View' => array(LIBS . 'tests' . DS . 'test_app' . DS . 'View'. DS) <ide> )); <ide> <del> $this->Controller->EmailTest->to = 'postmaster@localhost'; <add> $this->Controller->EmailTest->to = 'postmaster@example.com'; <ide> $this->Controller->EmailTest->from = 'noreply@example.com'; <ide> $this->Controller->EmailTest->subject = 'Cake Debug Test'; <ide> $this->Controller->EmailTest->replyTo = 'noreply@example.com'; <ide> $this->Controller->EmailTest->layout = 'default'; <ide> $this->Controller->EmailTest->template = null; <ide> <del> $this->Controller->EmailTest->delivery = 'debug'; <add> $this->Controller->EmailTest->delivery = 'DebugComp'; <ide> <ide> $text = $html = 'This is the body of the message'; <ide> <ide> function testMessageRetrievalWithTemplate() { <ide> $this->Controller->set('value', 22091985); <ide> $this->Controller->set('title_for_layout', 'EmailTest'); <ide> <del> $this->Controller->EmailTest->to = 'postmaster@localhost'; <add> $this->Controller->EmailTest->to = 'postmaster@example.com'; <ide> $this->Controller->EmailTest->from = 'noreply@example.com'; <ide> $this->Controller->EmailTest->subject = 'Cake Debug Test'; <ide> $this->Controller->EmailTest->replyTo = 'noreply@example.com'; <ide> $this->Controller->EmailTest->layout = 'default'; <ide> $this->Controller->EmailTest->template = 'custom'; <ide> <del> $this->Controller->EmailTest->delivery = 'debug'; <add> $this->Controller->EmailTest->delivery = 'DebugComp'; <ide> <ide> $text = <<<TEXTBLOC <ide> <ide> function testMessageRetrievalWithTemplate() { <ide> * @return void <ide> */ <ide> function testSendContentArray() { <del> $this->Controller->EmailTest->to = 'postmaster@localhost'; <add> $this->Controller->EmailTest->to = 'postmaster@example.com'; <ide> $this->Controller->EmailTest->from = 'noreply@example.com'; <ide> $this->Controller->EmailTest->subject = 'Cake Debug Test'; <ide> $this->Controller->EmailTest->replyTo = 'noreply@example.com'; <ide> $this->Controller->EmailTest->template = null; <del> $this->Controller->EmailTest->delivery = 'debug'; <add> $this->Controller->EmailTest->delivery = 'DebugComp'; <ide> <ide> $content = array('First line', 'Second line', 'Third line'); <ide> $this->assertTrue($this->Controller->EmailTest->send($content)); <del> $result = $this->Controller->Session->read('Message.email.message'); <add> $result = DebugCompTransport::$lastEmail; <ide> <del> $this->assertPattern('/To: postmaster@localhost\n/', $result); <add> $this->assertPattern('/To: postmaster@example.com\n/', $result); <ide> $this->assertPattern('/Subject: Cake Debug Test\n/', $result); <ide> $this->assertPattern('/Reply-To: noreply@example.com\n/', $result); <ide> $this->assertPattern('/From: noreply@example.com\n/', $result); <ide> $this->assertPattern('/X-Mailer: CakePHP Email Component\n/', $result); <ide> $this->assertPattern('/Content-Type: text\/plain; charset=UTF-8\n/', $result); <del> $this->assertPattern('/Content-Transfer-Encoding: 7bitParameters:\n/', $result); <add> $this->assertPattern('/Content-Transfer-Encoding: 7bitMessage:\n/', $result); <ide> $this->assertPattern('/First line\n/', $result); <ide> $this->assertPattern('/Second line\n/', $result); <ide> $this->assertPattern('/Third line\n/', $result); <ide> function testSendContentArray() { <ide> * @return void <ide> */ <ide> function testDateProperty() { <del> $this->Controller->EmailTest->to = 'postmaster@localhost'; <add> $this->Controller->EmailTest->to = 'postmaster@example.com'; <ide> $this->Controller->EmailTest->from = 'noreply@example.com'; <ide> $this->Controller->EmailTest->subject = 'Cake Debug Test'; <ide> $this->Controller->EmailTest->date = 'Today!'; <ide> $this->Controller->EmailTest->template = null; <del> $this->Controller->EmailTest->delivery = 'debug'; <add> $this->Controller->EmailTest->delivery = 'DebugComp'; <ide> <ide> $this->assertTrue($this->Controller->EmailTest->send('test message')); <del> $result = $this->Controller->Session->read('Message.email.message'); <add> $result = DebugCompTransport::$lastEmail; <ide> $this->assertPattern('/Date: Today!\n/', $result); <ide> } <ide> <ide> function test_encodeSettingInternalCharset() { <ide> mb_internal_encoding('ISO-8859-1'); <ide> <ide> $this->Controller->charset = 'UTF-8'; <del> $this->Controller->EmailTest->to = 'postmaster@localhost'; <add> $this->Controller->EmailTest->to = 'postmaster@example.com'; <ide> $this->Controller->EmailTest->from = 'noreply@example.com'; <ide> $this->Controller->EmailTest->subject = 'هذه رسالة بعنوان طويل مرسل للمستلم'; <ide> $this->Controller->EmailTest->replyTo = 'noreply@example.com'; <ide> $this->Controller->EmailTest->template = null; <del> $this->Controller->EmailTest->delivery = 'debug'; <add> $this->Controller->EmailTest->delivery = 'DebugComp'; <ide> <ide> $this->Controller->EmailTest->sendAs = 'text'; <ide> $this->assertTrue($this->Controller->EmailTest->send('This is the body of the message')); <ide> <ide> $subject = '=?UTF-8?B?2YfYsNmHINix2LPYp9mE2Kkg2KjYudmG2YjYp9mGINi32YjZitmEINmF2LE=?=' . "\r\n" . ' =?UTF-8?B?2LPZhCDZhNmE2YXYs9iq2YTZhQ==?='; <ide> <del> preg_match('/Subject: (.*)Header:/s', $this->Controller->Session->read('Message.email.message'), $matches); <add> preg_match('/Subject: (.*)Header:/s', DebugCompTransport::$lastEmail, $matches); <ide> $this->assertEqual(trim($matches[1]), $subject); <ide> <ide> $result = mb_internal_encoding(); <ide> function test_encodeSettingInternalCharset() { <ide> */ <ide> function testMultibyte() { <ide> $this->Controller->charset = 'UTF-8'; <del> $this->Controller->EmailTest->to = 'postmaster@localhost'; <add> $this->Controller->EmailTest->to = 'postmaster@example.com'; <ide> $this->Controller->EmailTest->from = 'noreply@example.com'; <ide> $this->Controller->EmailTest->subject = 'هذه رسالة بعنوان طويل مرسل للمستلم'; <ide> $this->Controller->EmailTest->replyTo = 'noreply@example.com'; <ide> $this->Controller->EmailTest->template = null; <del> $this->Controller->EmailTest->delivery = 'debug'; <add> $this->Controller->EmailTest->delivery = 'DebugComp'; <ide> <ide> $subject = '=?UTF-8?B?2YfYsNmHINix2LPYp9mE2Kkg2KjYudmG2YjYp9mGINi32YjZitmEINmF2LE=?=' . "\r\n" . ' =?UTF-8?B?2LPZhCDZhNmE2YXYs9iq2YTZhQ==?='; <ide> <ide> $this->Controller->EmailTest->sendAs = 'text'; <ide> $this->assertTrue($this->Controller->EmailTest->send('This is the body of the message')); <del> preg_match('/Subject: (.*)Header:/s', $this->Controller->Session->read('Message.email.message'), $matches); <add> preg_match('/Subject: (.*)Header:/s', DebugCompTransport::$lastEmail, $matches); <ide> $this->assertEqual(trim($matches[1]), $subject); <ide> <ide> $this->Controller->EmailTest->sendAs = 'html'; <ide> $this->assertTrue($this->Controller->EmailTest->send('This is the body of the message')); <del> preg_match('/Subject: (.*)Header:/s', $this->Controller->Session->read('Message.email.message'), $matches); <add> preg_match('/Subject: (.*)Header:/s', DebugCompTransport::$lastEmail, $matches); <ide> $this->assertEqual(trim($matches[1]), $subject); <ide> <ide> $this->Controller->EmailTest->sendAs = 'both'; <ide> $this->assertTrue($this->Controller->EmailTest->send('This is the body of the message')); <del> preg_match('/Subject: (.*)Header:/s', $this->Controller->Session->read('Message.email.message'), $matches); <add> preg_match('/Subject: (.*)Header:/s', DebugCompTransport::$lastEmail, $matches); <ide> $this->assertEqual(trim($matches[1]), $subject); <ide> } <ide> <ide> function testMultibyte() { <ide> * @return void <ide> */ <ide> public function testSendWithAttachments() { <del> $this->Controller->EmailTest->to = 'postmaster@localhost'; <add> $this->Controller->EmailTest->to = 'postmaster@example.com'; <ide> $this->Controller->EmailTest->from = 'noreply@example.com'; <ide> $this->Controller->EmailTest->subject = 'Attachment Test'; <ide> $this->Controller->EmailTest->replyTo = 'noreply@example.com'; <ide> $this->Controller->EmailTest->template = null; <del> $this->Controller->EmailTest->delivery = 'debug'; <add> $this->Controller->EmailTest->delivery = 'DebugComp'; <ide> $this->Controller->EmailTest->attachments = array( <ide> __FILE__, <ide> 'some-name.php' => __FILE__ <ide> public function testSendWithAttachments() { <ide> <ide> $this->Controller->EmailTest->sendAs = 'text'; <ide> $this->assertTrue($this->Controller->EmailTest->send($body)); <del> $msg = $this->Controller->Session->read('Message.email.message'); <add> $msg = DebugCompTransport::$lastEmail; <ide> $this->assertPattern('/' . preg_quote('Content-Disposition: attachment; filename="EmailComponentTest.php"') . '/', $msg); <ide> $this->assertPattern('/' . preg_quote('Content-Disposition: attachment; filename="some-name.php"') . '/', $msg); <ide> } <ide> public function testSendWithAttachments() { <ide> * @return void <ide> */ <ide> public function testSendAsIsNotIgnoredIfAttachmentsPresent() { <del> $this->Controller->EmailTest->to = 'postmaster@localhost'; <add> $this->Controller->EmailTest->to = 'postmaster@example.com'; <ide> $this->Controller->EmailTest->from = 'noreply@example.com'; <ide> $this->Controller->EmailTest->subject = 'Attachment Test'; <ide> $this->Controller->EmailTest->replyTo = 'noreply@example.com'; <ide> $this->Controller->EmailTest->template = null; <del> $this->Controller->EmailTest->delivery = 'debug'; <add> $this->Controller->EmailTest->delivery = 'DebugComp'; <ide> $this->Controller->EmailTest->attachments = array(__FILE__); <ide> $body = '<p>This is the body of the message</p>'; <ide> <ide> $this->Controller->EmailTest->sendAs = 'html'; <ide> $this->assertTrue($this->Controller->EmailTest->send($body)); <del> $msg = $this->Controller->Session->read('Message.email.message'); <add> $msg = DebugCompTransport::$lastEmail; <ide> $this->assertNoPattern('/text\/plain/', $msg); <ide> $this->assertPattern('/text\/html/', $msg); <ide> <ide> $this->Controller->EmailTest->sendAs = 'text'; <ide> $this->assertTrue($this->Controller->EmailTest->send($body)); <del> $msg = $this->Controller->Session->read('Message.email.message'); <add> $msg = DebugCompTransport::$lastEmail; <ide> $this->assertPattern('/text\/plain/', $msg); <ide> $this->assertNoPattern('/text\/html/', $msg); <ide> <ide> $this->Controller->EmailTest->sendAs = 'both'; <ide> $this->assertTrue($this->Controller->EmailTest->send($body)); <del> $msg = $this->Controller->Session->read('Message.email.message'); <add> $msg = DebugCompTransport::$lastEmail; <ide> <ide> $this->assertNoPattern('/text\/plain/', $msg); <ide> $this->assertNoPattern('/text\/html/', $msg); <ide> public function testSendAsIsNotIgnoredIfAttachmentsPresent() { <ide> * @return void <ide> */ <ide> public function testNoDoubleNewlinesInHeaders() { <del> $this->Controller->EmailTest->to = 'postmaster@localhost'; <add> $this->Controller->EmailTest->to = 'postmaster@example.com'; <ide> $this->Controller->EmailTest->from = 'noreply@example.com'; <ide> $this->Controller->EmailTest->subject = 'Attachment Test'; <ide> $this->Controller->EmailTest->replyTo = 'noreply@example.com'; <ide> $this->Controller->EmailTest->template = null; <del> $this->Controller->EmailTest->delivery = 'debug'; <add> $this->Controller->EmailTest->delivery = 'DebugComp'; <ide> $body = '<p>This is the body of the message</p>'; <ide> <ide> $this->Controller->EmailTest->sendAs = 'both'; <ide> $this->assertTrue($this->Controller->EmailTest->send($body)); <del> $msg = $this->Controller->Session->read('Message.email.message'); <add> $msg = DebugCompTransport::$lastEmail; <ide> <ide> $this->assertNoPattern('/\n\nContent-Transfer-Encoding/', $msg); <ide> $this->assertPattern('/\nContent-Transfer-Encoding/', $msg); <ide> function testPluginCustomViewClass() { <ide> <ide> $this->Controller->view = 'TestPlugin.Email'; <ide> <del> $this->Controller->EmailTest->to = 'postmaster@localhost'; <add> $this->Controller->EmailTest->to = 'postmaster@example.com'; <ide> $this->Controller->EmailTest->from = 'noreply@example.com'; <ide> $this->Controller->EmailTest->subject = 'CustomViewClass test'; <del> $this->Controller->EmailTest->delivery = 'debug'; <add> $this->Controller->EmailTest->delivery = 'DebugComp'; <ide> $body = 'Body of message'; <ide> <ide> $this->assertTrue($this->Controller->EmailTest->send($body)); <del> $result = $this->Controller->Session->read('Message.email.message'); <add> $result = DebugCompTransport::$lastEmail; <ide> <ide> $this->assertPattern('/Body of message/', $result); <ide> <ide> function testStartup() { <ide> * @return void <ide> */ <ide> function testMessageId() { <del> $this->Controller->EmailTest->to = 'postmaster@localhost'; <add> $this->Controller->EmailTest->to = 'postmaster@example.com'; <ide> $this->Controller->EmailTest->from = 'noreply@example.com'; <ide> $this->Controller->EmailTest->subject = 'Cake Debug Test'; <ide> $this->Controller->EmailTest->replyTo = 'noreply@example.com'; <ide> $this->Controller->EmailTest->template = null; <ide> <del> $this->Controller->EmailTest->delivery = 'debug'; <add> $this->Controller->EmailTest->delivery = 'DebugComp'; <ide> $this->assertTrue($this->Controller->EmailTest->send('This is the body of the message')); <del> $result = $this->Controller->Session->read('Message.email.message'); <add> $result = DebugCompTransport::$lastEmail; <ide> <ide> $this->assertPattern('/Message-ID: \<[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}@' . env('HTTP_HOST') . '\>\n/', $result); <ide> <del> $this->Controller->EmailTest->messageId = '<22091985.998877@localhost>'; <add> $this->Controller->EmailTest->messageId = '<22091985.998877@example.com>'; <ide> <ide> $this->assertTrue($this->Controller->EmailTest->send('This is the body of the message')); <del> $result = $this->Controller->Session->read('Message.email.message'); <add> $result = DebugCompTransport::$lastEmail; <ide> <del> $this->assertPattern('/Message-ID: <22091985.998877@localhost>\n/', $result); <add> $this->assertPattern('/Message-ID: <22091985.998877@example.com>\n/', $result); <ide> <ide> $this->Controller->EmailTest->messageId = false; <ide> <ide> $this->assertTrue($this->Controller->EmailTest->send('This is the body of the message')); <del> $result = $this->Controller->Session->read('Message.email.message'); <add> $result = DebugCompTransport::$lastEmail; <ide> <ide> $this->assertNoPattern('/Message-ID:/', $result); <ide> } <ide> <del>/** <del> * testSendMessage method <del> * <del> * @access public <del> * @return void <del> */ <del> function testSendMessage() { <del> $this->Controller->EmailTest->delivery = 'getMessage'; <del> $this->Controller->EmailTest->lineLength = 70; <del> <del> $text = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'; <del> $this->Controller->EmailTest->sendAs = 'text'; <del> $result = $this->Controller->EmailTest->send($text); <del> $expected = array( <del> 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do', <del> 'eiusmod tempor incididunt ut labore et dolore magna aliqua.', <del> '', <del> '' <del> ); <del> $this->assertEqual($expected, $result); <del> <del> $text = 'Lorem ipsum dolor sit amet, <b>consectetur</b> adipisicing elit, sed do <span>eiusmod tempor</span> incididunt ut labore et dolore magna aliqua.'; <del> $this->Controller->EmailTest->sendAs = 'html'; <del> $result = $this->Controller->EmailTest->send($text); <del> $expected = array( <del> $text, <del> '', <del> '' <del> ); <del> $this->assertEqual($expected, $result); <del> } <del> <ide> }
1
Javascript
Javascript
add template & compile functions for htmlbars
7ffbd9ca809bb33bc10f358589439b6c10073042
<ide><path>packages/ember-htmlbars/lib/main.js <add>import Ember from "ember-metal/core"; <ide> import { content, element, subexpr } from "ember-htmlbars/hooks"; <ide> import { DOMHelper } from "morph"; <add>import template from "ember-htmlbars/system/template"; <add>import compile from "ember-htmlbars/system/compile"; <ide> <ide> import { <ide> registerHelper, <ide> registerHelper('template', templateHelper); <ide> registerHelper('bind-attr', bindAttrHelper); <ide> registerHelper('bindAttr', bindAttrHelperDeprecated); <ide> <add>if (Ember.FEATURES.isEnabled('ember-htmlbars')) { <add> Ember.HTMLBars = { <add> template: template, <add> compile: compile <add> }; <add>} <add> <ide> export var defaultEnv = { <ide> dom: new DOMHelper(), <ide> <ide><path>packages/ember-htmlbars/lib/system/compile.js <add>import { compile } from "htmlbars-compiler/compiler"; <add>import template from "ember-htmlbars/system/template"; <add> <add>/** <add> Uses HTMLBars `compile` function to process a string into a compiled template. <add> <add> This is not present in production builds. <add> <add> @private <add> @method template <add> @param {String} templateString This is the string to be compiled by HTMLBars. <add>*/ <add> <add>export default function(templateString) { <add> var templateSpec = compile(templateString); <add> <add> return template(templateSpec); <add>} <ide><path>packages/ember-htmlbars/lib/system/template.js <add>/** <add> Augments the detault precompiled output of an HTMLBars template with <add> additional information needed by Ember. <add> <add> @private <add> @method template <add> @param {Function} templateSpec This is the compiled HTMLBars template spec. <add>*/ <add> <add>export default function(templateSpec) { <add> templateSpec.isTop = true; <add> templateSpec.isMethod = false; <add> <add> return templateSpec; <add>} <ide><path>packages/ember-htmlbars/tests/helpers/bind_attr_test.js <ide> import { set } from "ember-metal/property_set"; <ide> import { <ide> default as htmlbarsHelpers <ide> } from "ember-htmlbars/helpers"; <del>import { <del> compile as htmlbarsCompile <del>} from "htmlbars-compiler/compiler"; <add>import htmlbarsCompile from "ember-htmlbars/system/compile"; <ide> <ide> var compile, helpers; <ide> if (Ember.FEATURES.isEnabled('ember-htmlbars')) { <ide><path>packages/ember-htmlbars/tests/helpers/bind_test.js <ide> import EmberView from "ember-views/views/view"; <ide> import EmberObject from "ember-runtime/system/object"; <ide> import run from "ember-metal/run_loop"; <ide> import EmberHandlebars from "ember-handlebars"; <del>import { compile as htmlbarsCompile } from "htmlbars-compiler/compiler"; <add>import htmlbarsCompile from "ember-htmlbars/system/compile"; <ide> <ide> function appendView(view) { <ide> run(function() { view.appendTo('#qunit-fixture'); }); <ide><path>packages/ember-htmlbars/tests/helpers/debug_test.js <ide> import run from "ember-metal/run_loop"; <ide> import EmberView from "ember-views/views/view"; <ide> import EmberHandlebars from "ember-handlebars-compiler"; <ide> import { logHelper } from "ember-handlebars/helpers/debug"; <del>import { compile as htmlbarsCompile } from "htmlbars-compiler/compiler"; <add>import htmlbarsCompile from "ember-htmlbars/system/compile"; <ide> <ide> var compile; <ide> if (Ember.FEATURES.isEnabled('ember-htmlbars')) { <ide><path>packages/ember-htmlbars/tests/helpers/if_unless_test.js <ide> import run from "ember-metal/run_loop"; <ide> import EmberView from "ember-views/views/view"; <ide> import ObjectProxy from "ember-runtime/system/object_proxy"; <ide> import EmberHandlebars from "ember-handlebars"; <del>import { compile as htmlbarsCompile } from "htmlbars-compiler/compiler"; <add>import htmlbarsCompile from "ember-htmlbars/system/compile"; <ide> <ide> var compile; <ide> if (Ember.FEATURES.isEnabled('ember-htmlbars')) { <ide><path>packages/ember-htmlbars/tests/helpers/loc_test.js <ide> import run from 'ember-metal/run_loop'; <ide> import EmberView from 'ember-views/views/view'; <ide> import EmberHandlebars from 'ember-handlebars-compiler'; <del>import { compile as htmlbarsCompile } from 'htmlbars-compiler/compiler'; <add>import htmlbarsCompile from "ember-htmlbars/system/compile"; <ide> <ide> var compile; <ide> if (Ember.FEATURES.isEnabled('ember-htmlbars')) { <ide><path>packages/ember-htmlbars/tests/helpers/partial_test.js <ide> import jQuery from "ember-views/system/jquery"; <ide> var trim = jQuery.trim; <ide> import Container from "ember-runtime/system/container"; <ide> import EmberHandlebars from "ember-handlebars-compiler"; <del>import { compile as htmlbarsCompile } from "htmlbars-compiler/compiler"; <add>import htmlbarsCompile from "ember-htmlbars/system/compile"; <ide> <ide> var MyApp, lookup, view, container; <ide> var originalLookup = Ember.lookup; <ide><path>packages/ember-htmlbars/tests/helpers/template_test.js <ide> var trim = jQuery.trim; <ide> <ide> import Container from "ember-runtime/system/container"; <ide> import EmberHandlebars from "ember-handlebars-compiler"; <del>import { compile as htmlbarsCompile } from "htmlbars-compiler/compiler"; <add>import htmlbarsCompile from "ember-htmlbars/system/compile"; <ide> <ide> var MyApp, lookup, view, container; <ide> var originalLookup = Ember.lookup; <ide><path>packages/ember-htmlbars/tests/helpers/view_test.js <ide> import Container from 'container/container'; <ide> import run from "ember-metal/run_loop"; <ide> import jQuery from "ember-views/system/jquery"; <ide> import EmberHandlebars from "ember-handlebars"; <del>import { compile as htmlbarsCompile } from "htmlbars-compiler/compiler"; <add>import htmlbarsCompile from "ember-htmlbars/system/compile"; <ide> <ide> var compile; <ide> if (Ember.FEATURES.isEnabled('ember-htmlbars')) { <ide><path>packages/ember-htmlbars/tests/helpers/with_test.js <ide> import ObjectController from "ember-runtime/controllers/object_controller"; <ide> import Container from "ember-runtime/system/container"; <ide> // import { A } from "ember-runtime/system/native_array"; <ide> import EmberHandlebars from "ember-handlebars"; <del>import { compile as htmlbarsCompile } from "htmlbars-compiler/compiler"; <add>import htmlbarsCompile from "ember-htmlbars/system/compile"; <ide> <ide> var compile; <ide> if (Ember.FEATURES.isEnabled('ember-htmlbars')) { <ide><path>packages/ember-htmlbars/tests/helpers/yield_test.js <ide> import { <ide> } from "ember-htmlbars/helpers"; <ide> <ide> import EmberHandlebars from "ember-handlebars"; <del>import { compile as htmlbarsCompile } from "htmlbars-compiler/compiler"; <add>import htmlbarsCompile from "ember-htmlbars/system/compile"; <ide> <ide> var compile, helper; <ide> if (Ember.FEATURES.isEnabled('ember-htmlbars')) { <ide><path>packages/ember-htmlbars/tests/system/compile_test.js <add>import compile from "ember-htmlbars/system/compile"; <add>import { <add> compile as htmlbarsCompile <add>} from "htmlbars-compiler/compiler"; <add> <add>if (Ember.FEATURES.isEnabled('ember-htmlbars')) { <add> <add>QUnit.module('ember-htmlbars: compile'); <add> <add>test('compiles the provided template with htmlbars', function() { <add> var templateString = "{{foo}} -- {{some-bar blah='foo'}}"; <add> <add> var actual = compile(templateString); <add> var expected = htmlbarsCompile(templateString); <add> <add> equal(actual.toString(), expected.toString(), 'compile function matches content with htmlbars compile'); <add>}); <add> <add>test('calls template on the compiled function', function() { <add> var templateString = "{{foo}} -- {{some-bar blah='foo'}}"; <add> <add> var actual = compile(templateString); <add> <add> ok(actual.isTop, 'sets isTop via template function'); <add> ok(actual.isMethod === false, 'sets isMethod via template function'); <add>}); <add> <add>} <ide><path>packages/ember-htmlbars/tests/system/template_test.js <add>import template from "ember-htmlbars/system/template"; <add> <add>if (Ember.FEATURES.isEnabled('ember-htmlbars')) { <add> <add>QUnit.module('ember-htmlbars: template'); <add> <add>test('sets `isTop` on the provided function', function() { <add> function test() { } <add> <add> template(test); <add> <add> equal(test.isTop, true, 'sets isTop on the provided function'); <add>}); <add> <add>test('sets `isMethod` on the provided function', function() { <add> function test() { } <add> <add> template(test); <add> <add> equal(test.isMethod, false, 'sets isMethod on the provided function'); <add>}); <add> <add>}
15